From: Andrea Bianco Date: Tue, 19 Nov 2019 11:14:47 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.3.95 X-Git-Tag: 2.3.95 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=8f479c237d4a7374b0f1cd6b6e59ffc9f6ab7b8f;p=motion2.git Built motion from commit (unavailable).|2.3.95 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c371ffe..210c771 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.3.94", "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 -u admin:password 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": "2019-11-18T17:42:05.452Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); +define({ "name": "xCALLY Motion API", "version": "2.3.95", "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 -u admin:password 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": "2019-11-19T11:09:06.278Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 797f258..c72909c 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.3.94", "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 -u admin:password 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": "2019-11-18T17:42:05.452Z", "url": "http://apidocjs.com", "version": "0.17.7" } } +{ "name": "xCALLY Motion API", "version": "2.3.95", "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 -u admin:password 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": "2019-11-19T11:09:06.278Z", "url": "http://apidocjs.com", "version": "0.17.7" } } diff --git a/package.json b/package.json index 466aef2..15fecf5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.3.94", + "version": "2.3.95", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 2ecdb55..601fc79 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 _0x3eea=['integration','motionbar','jscripty','urlForward','browser','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager'];(function(_0x3c0b76,_0x170065){var _0x51906d=function(_0x2bbd72){while(--_0x2bbd72){_0x3c0b76['push'](_0x3c0b76['shift']());}};_0x51906d(++_0x170065);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x4b5343,_0x11e310){_0x4b5343=_0x4b5343-0x0;var _0x1fb2af=_0x3eea[_0x4b5343];return _0x1fb2af;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'get':function(_0x2abe9e){return this[_0xa3ee('0x2')](_0xa3ee('0x3'));}},'action':{'type':Sequelize[_0xa3ee('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xa3ee('0x5'),_0xa3ee('0x6'),_0xa3ee('0x7'),_0xa3ee('0x8'),_0xa3ee('0x9'),_0xa3ee('0xa'),'bot']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot'}},'comment':_0xa3ee('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xa3ee('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xa3ee('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xa3ee('0xe')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0xa3ee('0x4')](0x1000)},'data6':{'type':Sequelize[_0xa3ee('0x4')]},'data7':{'type':Sequelize[_0xa3ee('0xf')]}}; \ No newline at end of file +var _0xeda8=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot','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','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot'];(function(_0x18dbdc,_0x2789e2){var _0x46f4a6=function(_0x2822ca){while(--_0x2822ca){_0x18dbdc['push'](_0x18dbdc['shift']());}};_0x46f4a6(++_0x2789e2);}(_0xeda8,0x104));var _0x8eda=function(_0x219933,_0x3dc254){_0x219933=_0x219933-0x0;var _0x33f4c8=_0xeda8[_0x219933];return _0x33f4c8;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x12899a){return this[_0x8eda('0x2')](_0x8eda('0x3'));}},'action':{'type':Sequelize[_0x8eda('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8eda('0x5'),_0x8eda('0x6'),_0x8eda('0x7'),_0x8eda('0x8'),_0x8eda('0x9'),_0x8eda('0xa'),_0x8eda('0xb')]],'msg':_0x8eda('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot'},'data1':{'type':Sequelize[_0x8eda('0x4')](0x1000),'comment':_0x8eda('0xd')},'data2':{'type':Sequelize[_0x8eda('0x4')](0x1000),'comment':_0x8eda('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x8eda('0x4')]},'data7':{'type':Sequelize[_0x8eda('0xf')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 8d267a3..25189b8 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 _0x2782=['../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api'];(function(_0x9bdb7,_0x2a2c90){var _0x3328d8=function(_0x8c085b){while(--_0x8c085b){_0x9bdb7['push'](_0x9bdb7['shift']());}};_0x3328d8(++_0x2a2c90);}(_0x2782,0x106));var _0x2278=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0x2782[_0x33ebf5];return _0x66957b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2278('0x0'));var rimraf=require(_0x2278('0x1'));var zipdir=require(_0x2278('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2278('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2278('0x4'));var util=require(_0x2278('0x5'));var path=require(_0x2278('0x6'));var sox=require('sox');var csv=require(_0x2278('0x7'));var ejs=require(_0x2278('0x8'));var fs=require('fs');var _=require(_0x2278('0x9'));var squel=require(_0x2278('0xa'));var crypto=require(_0x2278('0xb'));var jsforce=require(_0x2278('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2278('0x7'));var querystring=require(_0x2278('0xd'));var Papa=require(_0x2278('0xe'));var authService=require(_0x2278('0xf'));var hardwareService=require(_0x2278('0x10'));var Redis=require(_0x2278('0x11'));var qs=require(_0x2278('0x12'));var logger=require('../../config/logger')(_0x2278('0x13'));var utils=require(_0x2278('0x14'));var config=require(_0x2278('0x15'));var db=require(_0x2278('0x16'))['db'];function respondWithStatusCode(_0x5b8b38,_0x3138d2){_0x3138d2=_0x3138d2||0xcc;return function(_0x3dfd59){if(_0x3dfd59){return _0x5b8b38['sendStatus'](_0x3138d2);}return _0x5b8b38[_0x2278('0x17')](_0x3138d2)['end']();};}function respondWithResult(_0x3393c4,_0x3d2b93){_0x3d2b93=_0x3d2b93||0xc8;return function(_0x27703e){if(_0x27703e){return _0x3393c4[_0x2278('0x17')](_0x3d2b93)[_0x2278('0x18')](_0x27703e);}};}function respondWithFilteredResult(_0x5900b1,_0x578092){return function(_0x2797fe){if(_0x2797fe){var _0x308e42=_0x2797fe[_0x2278('0x19')],_0x4ae84f=_0x578092[_0x2278('0x1a')],_0x36769f=_0x578092['offset']+_0x578092[_0x2278('0x1b')],_0x5df13c;if(_0x36769f>=_0x308e42){_0x36769f=_0x308e42;_0x5df13c=0xc8;}else{_0x5df13c=0xce;}_0x5900b1[_0x2278('0x17')](_0x5df13c);return _0x5900b1[_0x2278('0x1c')](_0x2278('0x1d'),_0x4ae84f+'-'+_0x36769f+'/'+_0x308e42)['json'](_0x2797fe);}return null;};}function patchUpdates(_0x1b848e){return function(_0xde324a){try{jsonpatch[_0x2278('0x1e')](_0xde324a,_0x1b848e,!![]);}catch(_0xf7c30d){return BPromise[_0x2278('0x1f')](_0xf7c30d);}return _0xde324a[_0x2278('0x20')]();};}function saveUpdates(_0x509d85,_0x13adb9){return function(_0x126081){if(_0x126081){return _0x126081[_0x2278('0x21')](_0x509d85)['then'](function(_0x213481){return _0x213481;});}return null;};}function removeEntity(_0x2d22e7,_0x28e9ec){return function(_0x9f0067){if(_0x9f0067){return _0x9f0067[_0x2278('0x22')]()[_0x2278('0x23')](function(){_0x2d22e7[_0x2278('0x17')](0xcc)[_0x2278('0x24')]();});}};}function handleEntityNotFound(_0x44c1b1,_0x375868){return function(_0x42ecb1){if(!_0x42ecb1){_0x44c1b1[_0x2278('0x25')](0x194);}return _0x42ecb1;};}function handleError(_0x5a9e6a,_0x1bd7b9){_0x1bd7b9=_0x1bd7b9||0x1f4;return function(_0x4d3ab4){logger[_0x2278('0x26')](_0x4d3ab4[_0x2278('0x27')]);if(_0x4d3ab4[_0x2278('0x28')]){delete _0x4d3ab4['name'];}_0x5a9e6a['status'](_0x1bd7b9)[_0x2278('0x29')](_0x4d3ab4);};}exports['update']=function(_0x3ae869,_0x143c4f){if(_0x3ae869[_0x2278('0x2a')]['id']){delete _0x3ae869[_0x2278('0x2a')]['id'];}return db[_0x2278('0x2b')][_0x2278('0x2c')]({'where':{'id':_0x3ae869[_0x2278('0x2d')]['id']}})[_0x2278('0x23')](handleEntityNotFound(_0x143c4f,null))[_0x2278('0x23')](saveUpdates(_0x3ae869['body'],null))[_0x2278('0x23')](respondWithResult(_0x143c4f,null))[_0x2278('0x2e')](handleError(_0x143c4f,null));};exports[_0x2278('0x22')]=function(_0x395d6d,_0x2553e9){return db[_0x2278('0x2b')][_0x2278('0x2c')]({'where':{'id':_0x395d6d[_0x2278('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2553e9,null))[_0x2278('0x23')](removeEntity(_0x2553e9,null))['catch'](handleError(_0x2553e9,null));}; \ No newline at end of file +var _0x95e0=['find','catch','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','body','Action'];(function(_0x3a3148,_0x33159c){var _0x118587=function(_0x29040e){while(--_0x29040e){_0x3a3148['push'](_0x3a3148['shift']());}};_0x118587(++_0x33159c);}(_0x95e0,0x10b));var _0x095e=function(_0x110134,_0x5bb465){_0x110134=_0x110134-0x0;var _0x99b8d2=_0x95e0[_0x110134];return _0x99b8d2;};'use strict';var pdf=require(_0x095e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x095e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x095e('0x2'));var rp=require(_0x095e('0x3'));var moment=require(_0x095e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x095e('0x5'));var util=require('util');var path=require(_0x095e('0x6'));var sox=require(_0x095e('0x7'));var csv=require(_0x095e('0x8'));var ejs=require(_0x095e('0x9'));var fs=require('fs');var _=require(_0x095e('0xa'));var squel=require(_0x095e('0xb'));var crypto=require(_0x095e('0xc'));var jsforce=require(_0x095e('0xd'));var deskjs=require(_0x095e('0xe'));var toCsv=require(_0x095e('0x8'));var querystring=require(_0x095e('0xf'));var Papa=require(_0x095e('0x10'));var authService=require(_0x095e('0x11'));var hardwareService=require(_0x095e('0x12'));var Redis=require(_0x095e('0x13'));var qs=require(_0x095e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x095e('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54f248,_0xe34958){_0xe34958=_0xe34958||0xcc;return function(_0xf635ad){if(_0xf635ad){return _0x54f248['sendStatus'](_0xe34958);}return _0x54f248[_0x095e('0x16')](_0xe34958)['end']();};}function respondWithResult(_0x1ea8bc,_0x126a4e){_0x126a4e=_0x126a4e||0xc8;return function(_0x48bcad){if(_0x48bcad){return _0x1ea8bc[_0x095e('0x16')](_0x126a4e)[_0x095e('0x17')](_0x48bcad);}};}function respondWithFilteredResult(_0x5acad9,_0x25a3f8){return function(_0x58188b){if(_0x58188b){var _0x2e55b2=_0x58188b[_0x095e('0x18')],_0x4bebdc=_0x25a3f8[_0x095e('0x19')],_0x1d3d9b=_0x25a3f8[_0x095e('0x19')]+_0x25a3f8[_0x095e('0x1a')],_0x4ee1e5;if(_0x1d3d9b>=_0x2e55b2){_0x1d3d9b=_0x2e55b2;_0x4ee1e5=0xc8;}else{_0x4ee1e5=0xce;}_0x5acad9[_0x095e('0x16')](_0x4ee1e5);return _0x5acad9[_0x095e('0x1b')]('Content-Range',_0x4bebdc+'-'+_0x1d3d9b+'/'+_0x2e55b2)[_0x095e('0x17')](_0x58188b);}return null;};}function patchUpdates(_0x2031a1){return function(_0x2cf683){try{jsonpatch[_0x095e('0x1c')](_0x2cf683,_0x2031a1,!![]);}catch(_0x21f62c){return BPromise[_0x095e('0x1d')](_0x21f62c);}return _0x2cf683[_0x095e('0x1e')]();};}function saveUpdates(_0x557b1a,_0x1f75a1){return function(_0x7a2d85){if(_0x7a2d85){return _0x7a2d85[_0x095e('0x1f')](_0x557b1a)['then'](function(_0x55dd4b){return _0x55dd4b;});}return null;};}function removeEntity(_0x121898,_0x3f4c4a){return function(_0x114adf){if(_0x114adf){return _0x114adf[_0x095e('0x20')]()[_0x095e('0x21')](function(){_0x121898[_0x095e('0x16')](0xcc)[_0x095e('0x22')]();});}};}function handleEntityNotFound(_0x27b5b6,_0x58008c){return function(_0x4e1056){if(!_0x4e1056){_0x27b5b6['sendStatus'](0x194);}return _0x4e1056;};}function handleError(_0x394460,_0x35777){_0x35777=_0x35777||0x1f4;return function(_0x9eb851){logger[_0x095e('0x23')](_0x9eb851[_0x095e('0x24')]);if(_0x9eb851[_0x095e('0x25')]){delete _0x9eb851[_0x095e('0x25')];}_0x394460['status'](_0x35777)[_0x095e('0x26')](_0x9eb851);};}exports[_0x095e('0x1f')]=function(_0x457f8a,_0x5eded0){if(_0x457f8a[_0x095e('0x27')]['id']){delete _0x457f8a[_0x095e('0x27')]['id'];}return db[_0x095e('0x28')][_0x095e('0x29')]({'where':{'id':_0x457f8a['params']['id']}})['then'](handleEntityNotFound(_0x5eded0,null))[_0x095e('0x21')](saveUpdates(_0x457f8a[_0x095e('0x27')],null))['then'](respondWithResult(_0x5eded0,null))[_0x095e('0x2a')](handleError(_0x5eded0,null));};exports['destroy']=function(_0x5513be,_0x1bcc91){return db[_0x095e('0x28')][_0x095e('0x29')]({'where':{'id':_0x5513be[_0x095e('0x2b')]['id']}})[_0x095e('0x21')](handleEntityNotFound(_0x1bcc91,null))['then'](removeEntity(_0x1bcc91,null))[_0x095e('0x2a')](handleError(_0x1bcc91,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 06fec9e..85d54ab 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 _0x3f7d=['./action.attributes','exports','define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0x3f7d,0x126));var _0xd3f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f7d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd3f7('0x0'));var util=require(_0xd3f7('0x1'));var logger=require(_0xd3f7('0x2'))(_0xd3f7('0x3'));var moment=require(_0xd3f7('0x4'));var BPromise=require(_0xd3f7('0x5'));var rp=require('request-promise');var attributes=require(_0xd3f7('0x6'));module[_0xd3f7('0x7')]=function(_0x159a2d,_0x20b7e8){return _0x159a2d[_0xd3f7('0x8')]('Action',attributes,{'tableName':_0xd3f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a6e=['../../config/logger','api','moment','bluebird','request-promise','./action.attributes','exports','define','lodash','util'];(function(_0x164e2e,_0x1a0428){var _0x13f566=function(_0x1393e4){while(--_0x1393e4){_0x164e2e['push'](_0x164e2e['shift']());}};_0x13f566(++_0x1a0428);}(_0x4a6e,0x94));var _0xe4a6=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x4a6e[_0x478414];return _0x5eb6b9;};'use strict';var _=require(_0xe4a6('0x0'));var util=require(_0xe4a6('0x1'));var logger=require(_0xe4a6('0x2'))(_0xe4a6('0x3'));var moment=require(_0xe4a6('0x4'));var BPromise=require(_0xe4a6('0x5'));var rp=require(_0xe4a6('0x6'));var attributes=require(_0xe4a6('0x7'));module[_0xe4a6('0x8')]=function(_0x55e973,_0x3d2c68){return _0x55e973[_0xe4a6('0x9')]('Action',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 4c0e0e5..efdaaf4 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 _0x165d=['request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http'];(function(_0x28912e,_0x3ecdf8){var _0x1bb553=function(_0x516927){while(--_0x516927){_0x28912e['push'](_0x28912e['shift']());}};_0x1bb553(++_0x3ecdf8);}(_0x165d,0x14a));var _0xd165=function(_0xdae398,_0x447190){_0xdae398=_0xdae398-0x0;var _0x1130f8=_0x165d[_0xdae398];return _0x1130f8;};'use strict';var _=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var moment=require(_0xd165('0x2'));var BPromise=require(_0xd165('0x3'));var rs=require(_0xd165('0x4'));var fs=require('fs');var Redis=require(_0xd165('0x5'));var db=require(_0xd165('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd165('0x7'))(_0xd165('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd165('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2305bc,_0x4dccaa,_0x5eec53){return new BPromise(function(_0x3fd82e,_0x41a937){return client[_0xd165('0xa')](_0x2305bc,_0x5eec53)[_0xd165('0xb')](function(_0x3a29a0){logger[_0xd165('0xc')](_0xd165('0xd'),_0x4dccaa,_0xd165('0xe'));logger['debug'](_0xd165('0xf'),_0x4dccaa,_0xd165('0xe'),JSON[_0xd165('0x10')](_0x3a29a0));if(_0x3a29a0['error']){if(_0x3a29a0[_0xd165('0x11')]['code']===0x1f4){logger[_0xd165('0x11')](_0xd165('0xd'),_0x4dccaa,_0x3a29a0[_0xd165('0x11')][_0xd165('0x12')]);return _0x41a937(_0x3a29a0['error']['message']);}logger[_0xd165('0x11')](_0xd165('0xd'),_0x4dccaa,_0x3a29a0[_0xd165('0x11')]['message']);return _0x3fd82e(_0x3a29a0['error']['message']);}else{logger[_0xd165('0xc')](_0xd165('0xd'),_0x4dccaa,'request\x20sent');_0x3fd82e(_0x3a29a0[_0xd165('0x13')][_0xd165('0x12')]);}})['catch'](function(_0x522b83){logger[_0xd165('0x11')](_0xd165('0xd'),_0x4dccaa,_0x522b83);_0x41a937(_0x522b83);});});} \ No newline at end of file +var _0xa566=['Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','info'];(function(_0x4119bf,_0x2e4b8e){var _0xcd3e8f=function(_0x567d5b){while(--_0x567d5b){_0x4119bf['push'](_0x4119bf['shift']());}};_0xcd3e8f(++_0x2e4b8e);}(_0xa566,0x1c1));var _0x6a56=function(_0x51db8a,_0x35d1da){_0x51db8a=_0x51db8a-0x0;var _0x500d4b=_0xa566[_0x51db8a];return _0x500d4b;};'use strict';var _=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var moment=require(_0x6a56('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a56('0x3'));var fs=require('fs');var Redis=require(_0x6a56('0x4'));var db=require(_0x6a56('0x5'))['db'];var utils=require(_0x6a56('0x6'));var logger=require('../../config/logger')(_0x6a56('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3712ee,_0x50ae34,_0x472c60){return new BPromise(function(_0x4947a9,_0x33240c){return client[_0x6a56('0x8')](_0x3712ee,_0x472c60)['then'](function(_0x2f49ab){logger[_0x6a56('0x9')](_0x6a56('0xa'),_0x50ae34,_0x6a56('0xb'));logger['debug'](_0x6a56('0xc'),_0x50ae34,_0x6a56('0xb'),JSON['stringify'](_0x2f49ab));if(_0x2f49ab['error']){if(_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xe')]===0x1f4){logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xf')]);return _0x33240c(_0x2f49ab[_0x6a56('0xd')]['message']);}logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xf')]);return _0x4947a9(_0x2f49ab[_0x6a56('0xd')]['message']);}else{logger[_0x6a56('0x9')](_0x6a56('0xa'),_0x50ae34,_0x6a56('0xb'));_0x4947a9(_0x2f49ab[_0x6a56('0x10')][_0x6a56('0xf')]);}})['catch'](function(_0x5e9895){logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x5e9895);_0x33240c(_0x5e9895);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index d34c40a..3f9d208 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 _0x9348=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x240f46,_0x16a64b){var _0x172bf3=function(_0x33cde9){while(--_0x33cde9){_0x240f46['push'](_0x240f46['shift']());}};_0x172bf3(++_0x16a64b);}(_0x9348,0x10d));var _0x8934=function(_0x19e615,_0x39c761){_0x19e615=_0x19e615-0x0;var _0x32ada4=_0x9348[_0x19e615];return _0x32ada4;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var auth=require(_0x8934('0x5'));var interaction=require(_0x8934('0x6'));var config=require('../../config/environment');var controller=require(_0x8934('0x7'));router[_0x8934('0x8')](_0x8934('0x9'),auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0xc')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xd')]);module[_0x8934('0xe')]=router; \ No newline at end of file +var _0x983c=['put','/:id','isAuthenticated','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0x5d687b,_0x23bebd){var _0xcf1011=function(_0xc6d486){while(--_0xc6d486){_0x5d687b['push'](_0x5d687b['shift']());}};_0xcf1011(++_0x23bebd);}(_0x983c,0xf3));var _0xc983=function(_0x19a7f6,_0x3abadc){_0x19a7f6=_0x19a7f6-0x0;var _0x5831b8=_0x983c[_0x19a7f6];return _0x5831b8;};'use strict';var multer=require(_0xc983('0x0'));var util=require(_0xc983('0x1'));var path=require(_0xc983('0x2'));var timeout=require(_0xc983('0x3'));var express=require(_0xc983('0x4'));var router=express['Router']();var auth=require(_0xc983('0x5'));var interaction=require(_0xc983('0x6'));var config=require(_0xc983('0x7'));var controller=require(_0xc983('0x8'));router[_0xc983('0x9')](_0xc983('0xa'),auth[_0xc983('0xb')](),controller['update']);router[_0xc983('0xc')](_0xc983('0xa'),auth[_0xc983('0xb')](),controller[_0xc983('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index b59b8eb..fe79a6d 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 _0x0ba2=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ba2,0x1e4));var _0x20ba=function(_0x1729b2,_0xc95bcf){_0x1729b2=_0x1729b2-0x0;var _0x4fe362=_0x0ba2[_0x1729b2];return _0x4fe362;};'use strict';var Sequelize=require(_0x20ba('0x0'));module['exports']={'name':{'type':Sequelize[_0x20ba('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x20ba('0x1')]},'parent':{'type':Sequelize[_0x20ba('0x1')]},'table':{'type':Sequelize[_0x20ba('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x20ba('0x2')]}}; \ No newline at end of file +var _0x16fc=['STRING','TEXT'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x16fc,0x1a8));var _0xc16f=function(_0x56cae6,_0xd096c3){_0x56cae6=_0x56cae6-0x0;var _0xdfd4c3=_0x16fc[_0x56cae6];return _0xdfd4c3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc16f('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xc16f('0x0')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xc16f('0x0')]},'conditions':{'type':Sequelize[_0xc16f('0x1')]},'joins':{'type':Sequelize[_0xc16f('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index cac35b1..de55e92 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 _0x2964=['type','key','VIRTUAL','field','options','count','includeAll','include','rows','catch','show','params','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','replace','groupBy','orderBy','DESC','joins','parse','parentKey','foreignKey','foreignTable','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','includes','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','function','alias','output','web','fullPath','randomstring','generate','csv','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','COUNT(*)','run','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','set','json','reject','save','then','destroy','CustomReports','error','stack','name','send','AnalyticCustomReport','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2964,0x108));var _0x4296=function(_0x4d44e7,_0x474f27){_0x4d44e7=_0x4d44e7-0x0;var _0x330d51=_0x2964[_0x4d44e7];return _0x330d51;};'use strict';var pdf=require(_0x4296('0x0'));var emlformat=require(_0x4296('0x1'));var rimraf=require(_0x4296('0x2'));var zipdir=require(_0x4296('0x3'));var jsonpatch=require(_0x4296('0x4'));var rp=require(_0x4296('0x5'));var moment=require(_0x4296('0x6'));var BPromise=require(_0x4296('0x7'));var Mustache=require(_0x4296('0x8'));var util=require('util');var path=require(_0x4296('0x9'));var sox=require(_0x4296('0xa'));var csv=require(_0x4296('0xb'));var ejs=require(_0x4296('0xc'));var fs=require('fs');var _=require(_0x4296('0xd'));var squel=require(_0x4296('0xe'));var crypto=require('crypto');var jsforce=require(_0x4296('0xf'));var deskjs=require(_0x4296('0x10'));var toCsv=require(_0x4296('0xb'));var querystring=require(_0x4296('0x11'));var Papa=require(_0x4296('0x12'));var authService=require(_0x4296('0x13'));var hardwareService=require(_0x4296('0x14'));var Redis=require(_0x4296('0x15'));var qs=require(_0x4296('0x16'));var logger=require(_0x4296('0x17'))(_0x4296('0x18'));var utils=require(_0x4296('0x19'));var config=require('../../config/environment');var db=require(_0x4296('0x1a'))['db'];function respondWithStatusCode(_0x39d66a,_0x4881c4){_0x4881c4=_0x4881c4||0xcc;return function(_0x367c95){if(_0x367c95){return _0x39d66a[_0x4296('0x1b')](_0x4881c4);}return _0x39d66a[_0x4296('0x1c')](_0x4881c4)[_0x4296('0x1d')]();};}function respondWithResult(_0x48b66c,_0x302ac3){_0x302ac3=_0x302ac3||0xc8;return function(_0x350b4b){if(_0x350b4b){return _0x48b66c[_0x4296('0x1c')](_0x302ac3)['json'](_0x350b4b);}};}function respondWithFilteredResult(_0x1c192c,_0x1203f0){return function(_0x3f4699){if(_0x3f4699){var _0x53af4b=_0x3f4699['count'],_0x182910=_0x1203f0[_0x4296('0x1e')],_0x2e63c4=_0x1203f0[_0x4296('0x1e')]+_0x1203f0[_0x4296('0x1f')],_0x1e7af8;if(_0x2e63c4>=_0x53af4b){_0x2e63c4=_0x53af4b;_0x1e7af8=0xc8;}else{_0x1e7af8=0xce;}_0x1c192c[_0x4296('0x1c')](_0x1e7af8);return _0x1c192c[_0x4296('0x20')]('Content-Range',_0x182910+'-'+_0x2e63c4+'/'+_0x53af4b)[_0x4296('0x21')](_0x3f4699);}return null;};}function patchUpdates(_0x4ac668){return function(_0x2d544c){try{jsonpatch['apply'](_0x2d544c,_0x4ac668,!![]);}catch(_0x13f40f){return BPromise[_0x4296('0x22')](_0x13f40f);}return _0x2d544c[_0x4296('0x23')]();};}function saveUpdates(_0x3d3b2e,_0x1826c4){return function(_0x336894){if(_0x336894){return _0x336894['update'](_0x3d3b2e)[_0x4296('0x24')](function(_0x2243ee){return _0x2243ee;});}return null;};}function removeEntity(_0x5456ca,_0xf545d2){return function(_0x3de482){if(_0x3de482){return _0x3de482[_0x4296('0x25')]()[_0x4296('0x24')](function(){var _0x5d285d=_0x3de482['get']({'plain':!![]});var _0x2fb2b4=_0x4296('0x26');return db['UserProfileResource'][_0x4296('0x25')]({'where':{'type':_0x2fb2b4,'resourceId':_0x5d285d['id']}})['then'](function(){return _0x3de482;});})[_0x4296('0x24')](function(){_0x5456ca[_0x4296('0x1c')](0xcc)[_0x4296('0x1d')]();});}};}function handleEntityNotFound(_0x3d2028,_0x5098c1){return function(_0x3b8b48){if(!_0x3b8b48){_0x3d2028['sendStatus'](0x194);}return _0x3b8b48;};}function handleError(_0x372779,_0x516365){_0x516365=_0x516365||0x1f4;return function(_0x4f2d8e){logger[_0x4296('0x27')](_0x4f2d8e[_0x4296('0x28')]);if(_0x4f2d8e[_0x4296('0x29')]){delete _0x4f2d8e['name'];}_0x372779[_0x4296('0x1c')](_0x516365)[_0x4296('0x2a')](_0x4f2d8e);};}exports['index']=function(_0x30fa22,_0x5cb6b7){var _0x4f9a1a={},_0x14c84f={},_0x2f5a2e={'count':0x0,'rows':[]};var _0x37f4e5=db[_0x4296('0x2b')][_0x4296('0x2c')];_0x14c84f[_0x4296('0x2d')]=_[_0x4296('0x2e')](_0x37f4e5);_0x14c84f[_0x4296('0x2f')]=_['keys'](_0x30fa22[_0x4296('0x2f')]);_0x14c84f['filters']=_[_0x4296('0x30')](_0x14c84f['model'],_0x14c84f['query']);_0x4f9a1a[_0x4296('0x31')]=_['intersection'](_0x14c84f[_0x4296('0x2d')],qs[_0x4296('0x32')](_0x30fa22[_0x4296('0x2f')][_0x4296('0x32')]));_0x4f9a1a[_0x4296('0x31')]=_0x4f9a1a[_0x4296('0x31')][_0x4296('0x33')]?_0x4f9a1a[_0x4296('0x31')]:_0x14c84f[_0x4296('0x2d')];if(!_0x30fa22[_0x4296('0x2f')][_0x4296('0x34')]('nolimit')){_0x4f9a1a['limit']=qs[_0x4296('0x1f')](_0x30fa22[_0x4296('0x2f')][_0x4296('0x1f')]);_0x4f9a1a[_0x4296('0x1e')]=qs['offset'](_0x30fa22['query'][_0x4296('0x1e')]);}_0x4f9a1a[_0x4296('0x35')]=qs[_0x4296('0x36')](_0x30fa22[_0x4296('0x2f')]['sort']);_0x4f9a1a[_0x4296('0x37')]=qs[_0x4296('0x38')](_['pick'](_0x30fa22['query'],_0x14c84f['filters']));if(_0x30fa22[_0x4296('0x2f')][_0x4296('0x39')]){_0x4f9a1a['where']=_[_0x4296('0x3a')](_0x4f9a1a[_0x4296('0x37')],{'$or':_[_0x4296('0x3b')](_0x37f4e5,function(_0x792cc6){if(_0x792cc6[_0x4296('0x3c')][_0x4296('0x3d')]!==_0x4296('0x3e')){var _0x268bdd={};_0x268bdd[_0x792cc6[_0x4296('0x3f')]]={'$like':'%'+_0x30fa22[_0x4296('0x2f')][_0x4296('0x39')]+'%'};return _0x268bdd;}})});}_0x4f9a1a=_[_0x4296('0x3a')]({},_0x4f9a1a,_0x30fa22[_0x4296('0x40')]);var _0x542ef9={'where':_0x4f9a1a[_0x4296('0x37')]};return db[_0x4296('0x2b')][_0x4296('0x41')](_0x542ef9)[_0x4296('0x24')](function(_0x3a86fa){_0x2f5a2e[_0x4296('0x41')]=_0x3a86fa;if(_0x30fa22['query'][_0x4296('0x42')]){_0x4f9a1a[_0x4296('0x43')]=[{'all':!![]}];}return db[_0x4296('0x2b')]['findAll'](_0x4f9a1a);})[_0x4296('0x24')](function(_0x53a825){_0x2f5a2e[_0x4296('0x44')]=_0x53a825;return _0x2f5a2e;})[_0x4296('0x24')](respondWithFilteredResult(_0x5cb6b7,_0x4f9a1a))[_0x4296('0x45')](handleError(_0x5cb6b7,null));};exports[_0x4296('0x46')]=function(_0x344eb5,_0x43e3b2){var _0x4dafad={'raw':![],'where':{'id':_0x344eb5[_0x4296('0x47')]['id']}},_0x379f47={};_0x379f47['model']=_['keys'](db[_0x4296('0x2b')][_0x4296('0x2c')]);_0x379f47[_0x4296('0x2f')]=_[_0x4296('0x2e')](_0x344eb5[_0x4296('0x2f')]);_0x379f47['filters']=_['intersection'](_0x379f47[_0x4296('0x2d')],_0x379f47[_0x4296('0x2f')]);_0x4dafad[_0x4296('0x31')]=_[_0x4296('0x30')](_0x379f47[_0x4296('0x2d')],qs[_0x4296('0x32')](_0x344eb5[_0x4296('0x2f')][_0x4296('0x32')]));_0x4dafad[_0x4296('0x31')]=_0x4dafad['attributes'][_0x4296('0x33')]?_0x4dafad[_0x4296('0x31')]:_0x379f47[_0x4296('0x2d')];if(_0x344eb5['query'][_0x4296('0x42')]){_0x4dafad[_0x4296('0x43')]=[{'all':!![]}];}_0x4dafad=_['merge']({},_0x4dafad,_0x344eb5['options']);return db[_0x4296('0x2b')][_0x4296('0x48')](_0x4dafad)[_0x4296('0x24')](handleEntityNotFound(_0x43e3b2,null))['then'](respondWithResult(_0x43e3b2,null))['catch'](handleError(_0x43e3b2,null));};exports['create']=function(_0x2d2863,_0x29c731){return db[_0x4296('0x2b')]['create'](_0x2d2863['body'],{})[_0x4296('0x24')](function(_0x1ddb06){var _0x403e7d=_0x2d2863[_0x4296('0x49')][_0x4296('0x4a')]({'plain':!![]});if(!_0x403e7d)throw new Error(_0x4296('0x4b'));if(_0x403e7d[_0x4296('0x4c')]===_0x4296('0x49')){var _0x598292=_0x1ddb06[_0x4296('0x4a')]({'plain':!![]});var _0x1f050b=_0x4296('0x4d');return db[_0x4296('0x4e')][_0x4296('0x48')]({'where':{'name':_0x1f050b,'userProfileId':_0x403e7d[_0x4296('0x4f')]},'raw':!![]})['then'](function(_0x5aa943){if(_0x5aa943&&_0x5aa943['autoAssociation']===0x0){return db[_0x4296('0x50')][_0x4296('0x51')]({'name':_0x598292[_0x4296('0x29')],'resourceId':_0x598292['id'],'type':_0x4296('0x26'),'sectionId':_0x5aa943['id']},{})['then'](function(){return _0x1ddb06;});}else{return _0x1ddb06;}})[_0x4296('0x45')](function(_0x348fa1){logger[_0x4296('0x27')](_0x4296('0x52'),_0x348fa1);throw _0x348fa1;});}return _0x1ddb06;})[_0x4296('0x24')](respondWithResult(_0x29c731,0xc9))[_0x4296('0x45')](handleError(_0x29c731,null));};exports[_0x4296('0x53')]=function(_0x5ccb51,_0x468453){if(_0x5ccb51['body']['id']){delete _0x5ccb51['body']['id'];}return db[_0x4296('0x2b')][_0x4296('0x48')]({'where':{'id':_0x5ccb51['params']['id']}})[_0x4296('0x24')](handleEntityNotFound(_0x468453,null))['then'](saveUpdates(_0x5ccb51['body'],null))[_0x4296('0x24')](respondWithResult(_0x468453,null))[_0x4296('0x45')](handleError(_0x468453,null));};exports['destroy']=function(_0x4faac4,_0x4691b4){return db[_0x4296('0x2b')][_0x4296('0x48')]({'where':{'id':_0x4faac4[_0x4296('0x47')]['id']}})[_0x4296('0x24')](handleEntityNotFound(_0x4691b4,null))['then'](removeEntity(_0x4691b4,null))[_0x4296('0x45')](handleError(_0x4691b4,null));};exports[_0x4296('0x54')]=function(_0x4f8d4f,_0xd905a0){var _0x21d487=0xa;var _0x31956e=[_0x4296('0x55'),_0x4296('0x56'),_0x4296('0x57'),'cross_join'];var _0x4544f1={'SUM':_0x4296('0x58'),'COUNT':_0x4296('0x59'),'COUNT DISTINCT':_0x4296('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4296('0x5b'),'GROUP_CONCAT':_0x4296('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4296('0x5d')};var _0x2e9f27={'SEC_TO_TIME':_0x4296('0x5e'),'DATE':_0x4296('0x5f'),'HOUR':_0x4296('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4296('0x61')};var _0x4dc6c8=function(_0x3f2025){return!_['includes']([_0x4296('0x62'),_0x4296('0x63'),_0x4296('0x64'),_0x4296('0x65')],_0x3f2025);};var _0x2e8b42=function(_0x264196){if(!_0x264196||!_0x264196[_0x4296('0x66')][_0x4296('0x33')]){return'';}for(var _0x53313f='(',_0x1fc90f=0x0;_0x1fc90f<_0x264196[_0x4296('0x66')][_0x4296('0x33')];_0x1fc90f+=0x1){_0x1fc90f>0x0&&(_0x53313f+='\x20'+_0x264196[_0x4296('0x67')]+'\x20');_0x53313f+=_0x264196['rules'][_0x1fc90f][_0x4296('0x68')]?_0x2e8b42(_0x264196[_0x4296('0x66')][_0x1fc90f][_0x4296('0x68')]):_0x264196[_0x4296('0x66')][_0x1fc90f][_0x4296('0x3f')]+'\x20'+_0x264196[_0x4296('0x66')][_0x1fc90f][_0x4296('0x69')]+(_0x4dc6c8(_0x264196[_0x4296('0x66')][_0x1fc90f][_0x4296('0x69')])?'\x20'+_0x264196[_0x4296('0x66')][_0x1fc90f][_0x4296('0x6a')]:'');}return _0x53313f+')';};var _0x36e517={'where':{'id':_0x4f8d4f[_0x4296('0x47')]['id']}},_0x3841c1,_0x40a61b,_0x896447,_0x54d960,_0x2c2823;_0x36e517=_[_0x4296('0x3a')]({},_0x36e517,_0x4f8d4f[_0x4296('0x40')]);return db[_0x4296('0x2b')]['find'](_0x36e517)['then'](function(_0x7aacf3){if(_0x7aacf3){_0x3841c1=_0x7aacf3;return _0x7aacf3[_0x4296('0x6b')]();}return null;})[_0x4296('0x24')](function(_0x24054b){if(_0x24054b){if(!_0x24054b[_0x4296('0x33')]){throw new db[(_0x4296('0x6c'))][(_0x4296('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x40a61b=_0x24054b;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4296('0x24')](function(_0x338884){if(_0x338884){_0x896447=_[_0x4296('0x6e')](_0x338884,'id');var _0x5839ee;var _0xd368d3=squel[_0x4296('0x6f')]();_0xd368d3[_0x4296('0x70')](_0x3841c1[_0x4296('0x71')]);for(var _0x4cc957=0x0;_0x4cc957<_0x40a61b[_0x4296('0x33')];_0x4cc957+=0x1){_0x5839ee=_0x40a61b[_0x4cc957][_0x4296('0x72')]?_0x896447[_0x40a61b[_0x4cc957][_0x4296('0x72')]]['metric']:_0x40a61b[_0x4cc957][_0x4296('0x3f')];_0x5839ee=_0x40a61b[_0x4cc957]['function']?_[_0x4296('0x73')](_0x4544f1[_0x40a61b[_0x4cc957]['function']],'%s',_0x5839ee):_0x5839ee;_0x5839ee=_0x40a61b[_0x4cc957]['format']?_[_0x4296('0x73')](_0x2e9f27[_0x40a61b[_0x4cc957]['format']],'%s',_0x5839ee):_0x5839ee;if(_0x40a61b[_0x4cc957][_0x4296('0x74')]){_0xd368d3[_0x4296('0x68')](_0x5839ee);}_0x40a61b[_0x4cc957][_0x4296('0x75')]&&_0xd368d3[_0x4296('0x35')](_0x5839ee,_0x40a61b[_0x4cc957][_0x4296('0x75')]===_0x4296('0x76')?![]:!![]);_0xd368d3[_0x4296('0x3f')](_0x5839ee,_0x40a61b[_0x4cc957]['alias']||_0x5839ee);}if(_0x3841c1[_0x4296('0x77')]){_0x3841c1['joins']=JSON[_0x4296('0x78')](_0x3841c1['joins']);for(var _0x50d182=0x0;_0x50d182<_0x3841c1[_0x4296('0x77')]['length'];_0x50d182+=0x1){if(_0x3841c1[_0x4296('0x77')][_0x50d182]['type']&&_['includes'](_0x31956e,_0x3841c1[_0x4296('0x77')][_0x50d182][_0x4296('0x3c')])&&_0x3841c1['joins'][_0x50d182][_0x4296('0x79')]&&_0x3841c1[_0x4296('0x77')][_0x50d182]['foreignTable']&&_0x3841c1[_0x4296('0x77')][_0x50d182][_0x4296('0x7a')]){_0xd368d3[_0x3841c1['joins'][_0x50d182][_0x4296('0x3c')]](_0x3841c1[_0x4296('0x77')][_0x50d182][_0x4296('0x7b')],null,util[_0x4296('0x7c')](_0x4296('0x7d'),_0x3841c1[_0x4296('0x71')],_0x3841c1['joins'][_0x50d182][_0x4296('0x79')],_0x3841c1[_0x4296('0x77')][_0x50d182][_0x4296('0x7b')],_0x3841c1[_0x4296('0x77')][_0x50d182][_0x4296('0x7a')]));}}}if(_0x3841c1[_0x4296('0x7e')]){_0x3841c1[_0x4296('0x7e')]=JSON['parse'](_0x3841c1[_0x4296('0x7e')]);_0xd368d3[_0x4296('0x37')](_0x2e8b42(_0x3841c1[_0x4296('0x7e')][_0x4296('0x68')]));}_0x2c2823=_0xd368d3[_0x4296('0x7f')]();_0xd368d3[_0x4296('0x1f')](_0x21d487);_0xd368d3[_0x4296('0x1e')](0x0);logger[_0x4296('0x80')](_0x4296('0x81'),_0xd368d3[_0x4296('0x82')]());return db[_0x4296('0x83')]['query'](_0xd368d3[_0x4296('0x82')](),{'type':db[_0x4296('0x83')][_0x4296('0x84')][_0x4296('0x85')]});}})['then'](respondWithResult(_0xd905a0,null))[_0x4296('0x45')](handleError(_0xd905a0,null));};function runReport(_0x5b3dce,_0x10dcd6,_0xc3f0a8){var _0x2a371c=_0x10dcd6['name'];var _0x4eeaa8=0xa;var _0x280829=['join','left_join',_0x4296('0x57'),_0x4296('0x86')];var _0x1d7944={'SUM':_0x4296('0x58'),'COUNT':_0x4296('0x59'),'COUNT DISTINCT':_0x4296('0x5a'),'MAX':_0x4296('0x87'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x4296('0x5c'),'GROUP_CONCAT ASC':_0x4296('0x88'),'GROUP_CONCAT DESC':_0x4296('0x5d')};var _0x8f0bd6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4296('0x5f'),'HOUR':_0x4296('0x60'),'ROUND':_0x4296('0x89'),'UNIX_TIMESTAMP':_0x4296('0x61')};var _0x4fe1a5=function(_0x1012ac){return!_[_0x4296('0x8a')]([_0x4296('0x62'),_0x4296('0x63'),_0x4296('0x64'),_0x4296('0x65')],_0x1012ac);};var _0xf0a62=function(_0x467584){if(!_0x467584||!_0x467584[_0x4296('0x66')][_0x4296('0x33')]){return'';}for(var _0x20b663='(',_0x1b0c65=0x0;_0x1b0c65<_0x467584[_0x4296('0x66')][_0x4296('0x33')];_0x1b0c65+=0x1){_0x1b0c65>0x0&&(_0x20b663+='\x20'+_0x467584[_0x4296('0x67')]+'\x20');_0x20b663+=_0x467584[_0x4296('0x66')][_0x1b0c65][_0x4296('0x68')]?_0xf0a62(_0x467584[_0x4296('0x66')][_0x1b0c65][_0x4296('0x68')]):_0x467584[_0x4296('0x66')][_0x1b0c65][_0x4296('0x3f')]+'\x20'+_0x467584[_0x4296('0x66')][_0x1b0c65]['condition']+(_0x4fe1a5(_0x467584['rules'][_0x1b0c65]['condition'])?'\x20'+_0x467584[_0x4296('0x66')][_0x1b0c65][_0x4296('0x6a')]:'');}return _0x20b663+')';};var _0x4b4024={'where':{'id':_0x5b3dce['id']}},_0x1d216c,_0xd21211,_0x5f2bd5,_0x40ed7f,_0x488278;_0x4b4024=_[_0x4296('0x3a')]({},_0x4b4024,_0xc3f0a8);return db[_0x4296('0x2b')]['find'](_0x4b4024)[_0x4296('0x24')](function(_0x3ad0e5){if(_0x3ad0e5){_0x1d216c=_0x3ad0e5;return _0x3ad0e5['getFields']();}return null;})[_0x4296('0x24')](function(_0x2ca1ef){if(_0x2ca1ef){if(!_0x2ca1ef[_0x4296('0x33')]){throw new db['Sequelize'][(_0x4296('0x6d'))](_0x4296('0x8b'),0x193);}_0xd21211=_0x2ca1ef;return db[_0x4296('0x8c')][_0x4296('0x8d')]({'raw':!![]});}return null;})[_0x4296('0x24')](function(_0x47cc99){if(_0x47cc99){_0x5f2bd5=_[_0x4296('0x6e')](_0x47cc99,'id');var _0x3089f4;var _0x57bf5c=squel[_0x4296('0x6f')]();_0x57bf5c[_0x4296('0x70')](_0x1d216c['table']);for(var _0x49efab=0x0;_0x49efab<_0xd21211[_0x4296('0x33')];_0x49efab+=0x1){_0x3089f4=_0xd21211[_0x49efab][_0x4296('0x72')]?_0x5f2bd5[_0xd21211[_0x49efab]['MetricId']]['metric']:_0xd21211[_0x49efab][_0x4296('0x3f')];_0x3089f4=_0xd21211[_0x49efab]['function']?_['replace'](_0x1d7944[_0xd21211[_0x49efab][_0x4296('0x8e')]],'%s',_0x3089f4):_0x3089f4;_0x3089f4=_0xd21211[_0x49efab]['format']?_[_0x4296('0x73')](_0x8f0bd6[_0xd21211[_0x49efab]['format']],'%s',_0x3089f4):_0x3089f4;if(_0xd21211[_0x49efab][_0x4296('0x74')]){_0x57bf5c[_0x4296('0x68')](_0x3089f4);}_0xd21211[_0x49efab]['orderBy']&&_0x57bf5c[_0x4296('0x35')](_0x3089f4,_0xd21211[_0x49efab][_0x4296('0x75')]===_0x4296('0x76')?![]:!![]);_0x57bf5c[_0x4296('0x3f')](_0x3089f4,_0xd21211[_0x49efab][_0x4296('0x8f')]||_0x3089f4);}if(_0x1d216c[_0x4296('0x77')]){_0x1d216c[_0x4296('0x77')]=JSON[_0x4296('0x78')](_0x1d216c[_0x4296('0x77')]);for(var _0x29d2dc=0x0;_0x29d2dc<_0x1d216c[_0x4296('0x77')]['length'];_0x29d2dc+=0x1){if(_0x1d216c[_0x4296('0x77')][_0x29d2dc][_0x4296('0x3c')]&&_['includes'](_0x280829,_0x1d216c[_0x4296('0x77')][_0x29d2dc][_0x4296('0x3c')])&&_0x1d216c[_0x4296('0x77')][_0x29d2dc][_0x4296('0x79')]&&_0x1d216c[_0x4296('0x77')][_0x29d2dc]['foreignTable']&&_0x1d216c[_0x4296('0x77')][_0x29d2dc]['foreignKey']){_0x57bf5c[_0x1d216c['joins'][_0x29d2dc][_0x4296('0x3c')]](_0x1d216c[_0x4296('0x77')][_0x29d2dc][_0x4296('0x7b')],null,util[_0x4296('0x7c')](_0x4296('0x7d'),_0x1d216c[_0x4296('0x71')],_0x1d216c['joins'][_0x29d2dc][_0x4296('0x79')],_0x1d216c[_0x4296('0x77')][_0x29d2dc]['foreignTable'],_0x1d216c[_0x4296('0x77')][_0x29d2dc][_0x4296('0x7a')]));}}}if(_0x1d216c[_0x4296('0x7e')]){_0x1d216c['conditions']=JSON['parse'](_0x1d216c[_0x4296('0x7e')]);_0x57bf5c[_0x4296('0x37')](_0xf0a62(_0x1d216c['conditions'][_0x4296('0x68')]));}_0x488278=_0x57bf5c[_0x4296('0x7f')]();_0x57bf5c['limit'](_0x4eeaa8);_0x57bf5c['offset'](0x0);logger[_0x4296('0x80')](_0x4296('0x81'),_0x57bf5c[_0x4296('0x82')]());return db[_0x4296('0x83')]['query'](_0x57bf5c[_0x4296('0x82')](),{'type':db[_0x4296('0x83')]['QueryTypes'][_0x4296('0x85')]});}})['then'](function(_0x1dfd3a){if(!_0x1dfd3a[_0x4296('0x33')]){throw new db[(_0x4296('0x6c'))]['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x10dcd6[_0x4296('0x90')]===_0x4296('0x91')){return null;}var _0x28c88f=_[_0x4296('0x3a')](_0x10dcd6,{'name':_0x10dcd6[_0x4296('0x92')]||_0x10dcd6[_0x4296('0x29')]||_0x1d216c[_0x4296('0x29')],'basename':_0x2a371c,'savename':util[_0x4296('0x7c')]('%s-%s.%s',_0x10dcd6[_0x4296('0x29')]||_0x1d216c['name'],require(_0x4296('0x93'))[_0x4296('0x94')](0x4),_0x10dcd6['output']||_0x4296('0x95')),'reportId':_0x1d216c['id'],'reportType':_0x4296('0x96')});return db['AnalyticExtractedReport'][_0x4296('0x51')](_0x28c88f,{'raw':!![]});})['then'](function(_0x207c7c){if(_0x1d216c[_0x4296('0x71')]==='cdr'){_0x488278[_0x4296('0x37')](_0x1d216c[_0x4296('0x71')]+_0x4296('0x97'),_0x10dcd6[_0x4296('0x98')],_0x10dcd6[_0x4296('0x99')]);}else{_0x488278[_0x4296('0x37')](_0x1d216c[_0x4296('0x71')]+_0x4296('0x9a'),_0x10dcd6[_0x4296('0x98')],_0x10dcd6['endDate']);}if(_0x207c7c){logger[_0x4296('0x9b')](_0x4296('0x9c'),_0x488278['toString']());require(_0x4296('0x9d'))['fork'](path['join'](__dirname,_0x4296('0x9e'),_0x207c7c[_0x4296('0x90')]),[_0x207c7c['id'],_0x488278[_0x4296('0x82')](),path[_0x4296('0x55')](__dirname,'../../files/reports',_0x207c7c[_0x4296('0x9f')]),_0x2a371c]);return _0x207c7c;}else{var _0x3d5c9d=squel[_0x4296('0x6f')]();_0x3d5c9d[_0x4296('0x70')]('('+_0x488278[_0x4296('0x82')]()+')','countTable');_0x3d5c9d[_0x4296('0x3f')](_0x4296('0xa0'),_0x4296('0x41'));_0x488278[_0x4296('0x1f')](_0x10dcd6['limit']||_0x4eeaa8);_0x488278[_0x4296('0x1e')](_0x10dcd6[_0x4296('0x1e')]||0x0);return db[_0x4296('0x83')]['query'](_0x3d5c9d[_0x4296('0x82')](),{'type':db[_0x4296('0x83')][_0x4296('0x84')]['SELECT']})[_0x4296('0x24')](function(_0x5b6f94){if(!_0x5b6f94[_0x4296('0x33')]){_0x40ed7f=0x0;}else{_0x40ed7f=_0x5b6f94[0x0][_0x4296('0x41')]||0x0;}return db[_0x4296('0x83')][_0x4296('0x2f')](_0x488278[_0x4296('0x82')](),{'type':db[_0x4296('0x83')][_0x4296('0x84')][_0x4296('0x85')]});})[_0x4296('0x24')](function(_0x5dc3ad){return{'rows':_0x5dc3ad||[],'count':_0x40ed7f};});}});}exports[_0x4296('0xa1')]=function(_0x39156f,_0x39e960){return runReport(_0x39156f['params'],_0x39156f[_0x4296('0x2f')],_0x39156f[_0x4296('0x40')])[_0x4296('0x24')](respondWithResult(_0x39e960,null))['catch'](handleError(_0x39e960,null));};exports['runReport']=runReport;exports[_0x4296('0x2f')]=function(_0x17a6fa,_0x2d4ff6){var _0x5af316=0xa;var _0x46b14b=[_0x4296('0x55'),_0x4296('0x56'),_0x4296('0x57'),_0x4296('0x86')];var _0x20a678={'SUM':_0x4296('0x58'),'COUNT':_0x4296('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4296('0x87'),'MIN':'MIN(%s)','AVG':_0x4296('0x5b'),'GROUP_CONCAT':_0x4296('0x5c'),'GROUP_CONCAT ASC':_0x4296('0x88'),'GROUP_CONCAT DESC':_0x4296('0x5d')};var _0x23a71e={'SEC_TO_TIME':_0x4296('0x5e'),'DATE':_0x4296('0x5f'),'HOUR':_0x4296('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x100c9b=function(_0xb351b8){return!_[_0x4296('0x8a')]([_0x4296('0x62'),'IS\x20NOT\x20NULL',_0x4296('0x64'),_0x4296('0x65')],_0xb351b8);};var _0x11eb4b=function(_0x2c45bb){if(!_0x2c45bb||!_0x2c45bb[_0x4296('0x66')][_0x4296('0x33')]){return'';}for(var _0x27dbf1='(',_0x439c05=0x0;_0x439c05<_0x2c45bb[_0x4296('0x66')][_0x4296('0x33')];_0x439c05+=0x1){_0x439c05>0x0&&(_0x27dbf1+='\x20'+_0x2c45bb[_0x4296('0x67')]+'\x20');_0x27dbf1+=_0x2c45bb[_0x4296('0x66')][_0x439c05][_0x4296('0x68')]?_0x11eb4b(_0x2c45bb['rules'][_0x439c05][_0x4296('0x68')]):_0x2c45bb['rules'][_0x439c05][_0x4296('0x3f')]+'\x20'+_0x2c45bb[_0x4296('0x66')][_0x439c05][_0x4296('0x69')]+(_0x100c9b(_0x2c45bb[_0x4296('0x66')][_0x439c05]['condition'])?'\x20'+_0x2c45bb[_0x4296('0x66')][_0x439c05]['value']:'');}return _0x27dbf1+')';};var _0x5cc2e4={'where':{'id':_0x17a6fa[_0x4296('0x47')]['id']}},_0x205e06,_0x1f4eb7,_0x59f2fe,_0x47ffdc,_0x2e26a5;_0x5cc2e4=_[_0x4296('0x3a')]({},_0x5cc2e4,_0x17a6fa[_0x4296('0x40')]);return db[_0x4296('0x2b')][_0x4296('0x48')](_0x5cc2e4)[_0x4296('0x24')](function(_0x1e3ce9){if(_0x1e3ce9){_0x205e06=_0x1e3ce9;return _0x1e3ce9[_0x4296('0x6b')]();}return null;})[_0x4296('0x24')](function(_0x39cb34){if(_0x39cb34){if(!_0x39cb34[_0x4296('0x33')]){throw new db[(_0x4296('0x6c'))][(_0x4296('0x6d'))](_0x4296('0x8b'),0x193);}_0x1f4eb7=_0x39cb34;return db['AnalyticMetric'][_0x4296('0x8d')]({'raw':!![]});}return null;})[_0x4296('0x24')](function(_0x3b2656){if(_0x3b2656){_0x59f2fe=_[_0x4296('0x6e')](_0x3b2656,'id');var _0x458e61;var _0x4e9c34=squel['select']();_0x4e9c34['from'](_0x205e06[_0x4296('0x71')]);for(var _0x136e39=0x0;_0x136e39<_0x1f4eb7['length'];_0x136e39+=0x1){_0x458e61=_0x1f4eb7[_0x136e39]['MetricId']?_0x59f2fe[_0x1f4eb7[_0x136e39][_0x4296('0x72')]]['metric']:_0x1f4eb7[_0x136e39][_0x4296('0x3f')];_0x458e61=_0x1f4eb7[_0x136e39][_0x4296('0x8e')]?_['replace'](_0x20a678[_0x1f4eb7[_0x136e39][_0x4296('0x8e')]],'%s',_0x458e61):_0x458e61;_0x458e61=_0x1f4eb7[_0x136e39][_0x4296('0x7c')]?_[_0x4296('0x73')](_0x23a71e[_0x1f4eb7[_0x136e39][_0x4296('0x7c')]],'%s',_0x458e61):_0x458e61;if(_0x1f4eb7[_0x136e39][_0x4296('0x74')]){_0x4e9c34['group'](_0x458e61);}_0x1f4eb7[_0x136e39][_0x4296('0x75')]&&_0x4e9c34[_0x4296('0x35')](_0x458e61,_0x1f4eb7[_0x136e39]['orderBy']===_0x4296('0x76')?![]:!![]);_0x4e9c34[_0x4296('0x3f')](_0x458e61,_0x1f4eb7[_0x136e39][_0x4296('0x8f')]||_0x458e61);}if(_0x205e06[_0x4296('0x77')]){_0x205e06['joins']=JSON[_0x4296('0x78')](_0x205e06[_0x4296('0x77')]);for(var _0x5a5420=0x0;_0x5a5420<_0x205e06[_0x4296('0x77')][_0x4296('0x33')];_0x5a5420+=0x1){if(_0x205e06[_0x4296('0x77')][_0x5a5420][_0x4296('0x3c')]&&_[_0x4296('0x8a')](_0x46b14b,_0x205e06['joins'][_0x5a5420][_0x4296('0x3c')])&&_0x205e06[_0x4296('0x77')][_0x5a5420]['parentKey']&&_0x205e06[_0x4296('0x77')][_0x5a5420][_0x4296('0x7b')]&&_0x205e06[_0x4296('0x77')][_0x5a5420][_0x4296('0x7a')]){_0x4e9c34[_0x205e06[_0x4296('0x77')][_0x5a5420][_0x4296('0x3c')]](_0x205e06[_0x4296('0x77')][_0x5a5420][_0x4296('0x7b')],null,util[_0x4296('0x7c')](_0x4296('0x7d'),_0x205e06[_0x4296('0x71')],_0x205e06[_0x4296('0x77')][_0x5a5420][_0x4296('0x79')],_0x205e06[_0x4296('0x77')][_0x5a5420][_0x4296('0x7b')],_0x205e06[_0x4296('0x77')][_0x5a5420][_0x4296('0x7a')]));}}}if(_0x205e06[_0x4296('0x7e')]){_0x205e06[_0x4296('0x7e')]=JSON[_0x4296('0x78')](_0x205e06[_0x4296('0x7e')]);_0x4e9c34[_0x4296('0x37')](_0x11eb4b(_0x205e06[_0x4296('0x7e')][_0x4296('0x68')]));}_0x2e26a5=_0x4e9c34[_0x4296('0x7f')]();_0x4e9c34[_0x4296('0x1f')](_0x5af316);_0x4e9c34['offset'](0x0);logger[_0x4296('0x80')](_0x4296('0x81'),_0x4e9c34['toString']());return db[_0x4296('0x83')][_0x4296('0x2f')](_0x4e9c34[_0x4296('0x82')](),{'type':db[_0x4296('0x83')][_0x4296('0x84')]['SELECT']});}})[_0x4296('0x24')](function(){return{'sql':_0x2e26a5[_0x4296('0x82')]()};})[_0x4296('0x24')](respondWithResult(_0x2d4ff6,null))[_0x4296('0x45')](handleError(_0x2d4ff6,null));}; \ No newline at end of file +var _0xfa28=['../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','CustomReports','destroy','error','stack','name','AnalyticCustomReport','rawAttributes','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','VIRTUAL','field','options','includeAll','findAll','rows','catch','params','length','include','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','select','table','MetricId','metric','function','replace','format','group','orderBy','alias','joins','parse','type','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','operator','AnalyticMetric','keyBy','DESC','QueryTypes','Sequelize','No\x20available\x20data','fullPath','%s-%s.%s','randomstring','output','csv','custom','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','../../files/reports','savename','from','countTable','COUNT(*)','run','runReport','COUNT(%s)','COUNT(DISTINCT\x20%s)','groupBy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x26c777,_0x33c292){var _0x4ef25a=function(_0x14e425){while(--_0x14e425){_0x26c777['push'](_0x26c777['shift']());}};_0x4ef25a(++_0x33c292);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xfa28[_0x13e741];return _0x3f8bb3;};'use strict';var pdf=require(_0x8fa2('0x0'));var emlformat=require(_0x8fa2('0x1'));var rimraf=require(_0x8fa2('0x2'));var zipdir=require(_0x8fa2('0x3'));var jsonpatch=require(_0x8fa2('0x4'));var rp=require(_0x8fa2('0x5'));var moment=require(_0x8fa2('0x6'));var BPromise=require(_0x8fa2('0x7'));var Mustache=require('mustache');var util=require(_0x8fa2('0x8'));var path=require(_0x8fa2('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8fa2('0xa'));var crypto=require(_0x8fa2('0xb'));var jsforce=require(_0x8fa2('0xc'));var deskjs=require(_0x8fa2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8fa2('0xe'));var Papa=require(_0x8fa2('0xf'));var authService=require(_0x8fa2('0x10'));var hardwareService=require(_0x8fa2('0x11'));var Redis=require(_0x8fa2('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8fa2('0x13'));var utils=require(_0x8fa2('0x14'));var config=require(_0x8fa2('0x15'));var db=require(_0x8fa2('0x16'))['db'];function respondWithStatusCode(_0x24170a,_0x60a19a){_0x60a19a=_0x60a19a||0xcc;return function(_0x523730){if(_0x523730){return _0x24170a[_0x8fa2('0x17')](_0x60a19a);}return _0x24170a[_0x8fa2('0x18')](_0x60a19a)[_0x8fa2('0x19')]();};}function respondWithResult(_0x2ff0d8,_0x49de04){_0x49de04=_0x49de04||0xc8;return function(_0x37574c){if(_0x37574c){return _0x2ff0d8['status'](_0x49de04)[_0x8fa2('0x1a')](_0x37574c);}};}function respondWithFilteredResult(_0x15d207,_0x377d84){return function(_0x4d6332){if(_0x4d6332){var _0x2b3192=_0x4d6332[_0x8fa2('0x1b')],_0x2f9a3d=_0x377d84[_0x8fa2('0x1c')],_0x28457d=_0x377d84['offset']+_0x377d84[_0x8fa2('0x1d')],_0x1e7c4d;if(_0x28457d>=_0x2b3192){_0x28457d=_0x2b3192;_0x1e7c4d=0xc8;}else{_0x1e7c4d=0xce;}_0x15d207['status'](_0x1e7c4d);return _0x15d207[_0x8fa2('0x1e')](_0x8fa2('0x1f'),_0x2f9a3d+'-'+_0x28457d+'/'+_0x2b3192)[_0x8fa2('0x1a')](_0x4d6332);}return null;};}function patchUpdates(_0x375c17){return function(_0x5be2c1){try{jsonpatch['apply'](_0x5be2c1,_0x375c17,!![]);}catch(_0x52de4c){return BPromise[_0x8fa2('0x20')](_0x52de4c);}return _0x5be2c1[_0x8fa2('0x21')]();};}function saveUpdates(_0x440e45,_0x56624a){return function(_0x3c1263){if(_0x3c1263){return _0x3c1263[_0x8fa2('0x22')](_0x440e45)['then'](function(_0xb038cd){return _0xb038cd;});}return null;};}function removeEntity(_0xd3c700,_0x5b66ec){return function(_0x54d8d3){if(_0x54d8d3){return _0x54d8d3['destroy']()[_0x8fa2('0x23')](function(){var _0x265a56=_0x54d8d3[_0x8fa2('0x24')]({'plain':!![]});var _0x3e8a44=_0x8fa2('0x25');return db['UserProfileResource'][_0x8fa2('0x26')]({'where':{'type':_0x3e8a44,'resourceId':_0x265a56['id']}})[_0x8fa2('0x23')](function(){return _0x54d8d3;});})['then'](function(){_0xd3c700['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59bad4,_0x9fa89){return function(_0x2a9b83){if(!_0x2a9b83){_0x59bad4[_0x8fa2('0x17')](0x194);}return _0x2a9b83;};}function handleError(_0x5c2c08,_0x57d197){_0x57d197=_0x57d197||0x1f4;return function(_0x3aafaf){logger[_0x8fa2('0x27')](_0x3aafaf[_0x8fa2('0x28')]);if(_0x3aafaf[_0x8fa2('0x29')]){delete _0x3aafaf[_0x8fa2('0x29')];}_0x5c2c08[_0x8fa2('0x18')](_0x57d197)['send'](_0x3aafaf);};}exports['index']=function(_0x3b95e6,_0x3808e3){var _0x42baf8={},_0x28c18d={},_0x3ca12a={'count':0x0,'rows':[]};var _0x5ddd54=db[_0x8fa2('0x2a')][_0x8fa2('0x2b')];_0x28c18d[_0x8fa2('0x2c')]=_[_0x8fa2('0x2d')](_0x5ddd54);_0x28c18d['query']=_[_0x8fa2('0x2d')](_0x3b95e6[_0x8fa2('0x2e')]);_0x28c18d[_0x8fa2('0x2f')]=_[_0x8fa2('0x30')](_0x28c18d['model'],_0x28c18d[_0x8fa2('0x2e')]);_0x42baf8['attributes']=_['intersection'](_0x28c18d[_0x8fa2('0x2c')],qs[_0x8fa2('0x31')](_0x3b95e6[_0x8fa2('0x2e')][_0x8fa2('0x31')]));_0x42baf8[_0x8fa2('0x32')]=_0x42baf8[_0x8fa2('0x32')]['length']?_0x42baf8['attributes']:_0x28c18d[_0x8fa2('0x2c')];if(!_0x3b95e6[_0x8fa2('0x2e')]['hasOwnProperty'](_0x8fa2('0x33'))){_0x42baf8['limit']=qs[_0x8fa2('0x1d')](_0x3b95e6[_0x8fa2('0x2e')]['limit']);_0x42baf8['offset']=qs['offset'](_0x3b95e6[_0x8fa2('0x2e')][_0x8fa2('0x1c')]);}_0x42baf8[_0x8fa2('0x34')]=qs[_0x8fa2('0x35')](_0x3b95e6[_0x8fa2('0x2e')]['sort']);_0x42baf8[_0x8fa2('0x36')]=qs['filters'](_['pick'](_0x3b95e6[_0x8fa2('0x2e')],_0x28c18d[_0x8fa2('0x2f')]));if(_0x3b95e6[_0x8fa2('0x2e')][_0x8fa2('0x37')]){_0x42baf8['where']=_['merge'](_0x42baf8[_0x8fa2('0x36')],{'$or':_['map'](_0x5ddd54,function(_0x296a15){if(_0x296a15['type']['key']!==_0x8fa2('0x38')){var _0x564169={};_0x564169[_0x296a15[_0x8fa2('0x39')]]={'$like':'%'+_0x3b95e6[_0x8fa2('0x2e')]['filter']+'%'};return _0x564169;}})});}_0x42baf8=_['merge']({},_0x42baf8,_0x3b95e6[_0x8fa2('0x3a')]);var _0x5dc4b3={'where':_0x42baf8['where']};return db['AnalyticCustomReport'][_0x8fa2('0x1b')](_0x5dc4b3)[_0x8fa2('0x23')](function(_0x2e8489){_0x3ca12a[_0x8fa2('0x1b')]=_0x2e8489;if(_0x3b95e6[_0x8fa2('0x2e')][_0x8fa2('0x3b')]){_0x42baf8['include']=[{'all':!![]}];}return db[_0x8fa2('0x2a')][_0x8fa2('0x3c')](_0x42baf8);})[_0x8fa2('0x23')](function(_0x406f33){_0x3ca12a[_0x8fa2('0x3d')]=_0x406f33;return _0x3ca12a;})[_0x8fa2('0x23')](respondWithFilteredResult(_0x3808e3,_0x42baf8))[_0x8fa2('0x3e')](handleError(_0x3808e3,null));};exports['show']=function(_0x58aeb5,_0x1cd59f){var _0x1f2e93={'raw':![],'where':{'id':_0x58aeb5[_0x8fa2('0x3f')]['id']}},_0x4d35d3={};_0x4d35d3['model']=_[_0x8fa2('0x2d')](db[_0x8fa2('0x2a')]['rawAttributes']);_0x4d35d3['query']=_['keys'](_0x58aeb5[_0x8fa2('0x2e')]);_0x4d35d3['filters']=_['intersection'](_0x4d35d3[_0x8fa2('0x2c')],_0x4d35d3[_0x8fa2('0x2e')]);_0x1f2e93['attributes']=_[_0x8fa2('0x30')](_0x4d35d3[_0x8fa2('0x2c')],qs[_0x8fa2('0x31')](_0x58aeb5[_0x8fa2('0x2e')]['fields']));_0x1f2e93['attributes']=_0x1f2e93[_0x8fa2('0x32')][_0x8fa2('0x40')]?_0x1f2e93[_0x8fa2('0x32')]:_0x4d35d3['model'];if(_0x58aeb5[_0x8fa2('0x2e')][_0x8fa2('0x3b')]){_0x1f2e93[_0x8fa2('0x41')]=[{'all':!![]}];}_0x1f2e93=_[_0x8fa2('0x42')]({},_0x1f2e93,_0x58aeb5[_0x8fa2('0x3a')]);return db[_0x8fa2('0x2a')][_0x8fa2('0x43')](_0x1f2e93)[_0x8fa2('0x23')](handleEntityNotFound(_0x1cd59f,null))[_0x8fa2('0x23')](respondWithResult(_0x1cd59f,null))[_0x8fa2('0x3e')](handleError(_0x1cd59f,null));};exports[_0x8fa2('0x44')]=function(_0x56da91,_0x213aea){return db[_0x8fa2('0x2a')][_0x8fa2('0x44')](_0x56da91[_0x8fa2('0x45')],{})[_0x8fa2('0x23')](function(_0x50d43f){var _0x2ba42a=_0x56da91['user'][_0x8fa2('0x24')]({'plain':!![]});if(!_0x2ba42a)throw new Error(_0x8fa2('0x46'));if(_0x2ba42a[_0x8fa2('0x47')]==='user'){var _0x497152=_0x50d43f[_0x8fa2('0x24')]({'plain':!![]});var _0x182398=_0x8fa2('0x48');return db[_0x8fa2('0x49')][_0x8fa2('0x43')]({'where':{'name':_0x182398,'userProfileId':_0x2ba42a[_0x8fa2('0x4a')]},'raw':!![]})[_0x8fa2('0x23')](function(_0x2f2f20){if(_0x2f2f20&&_0x2f2f20['autoAssociation']===0x0){return db[_0x8fa2('0x4b')][_0x8fa2('0x44')]({'name':_0x497152[_0x8fa2('0x29')],'resourceId':_0x497152['id'],'type':_0x8fa2('0x25'),'sectionId':_0x2f2f20['id']},{})['then'](function(){return _0x50d43f;});}else{return _0x50d43f;}})[_0x8fa2('0x3e')](function(_0x10bf47){logger[_0x8fa2('0x27')](_0x8fa2('0x4c'),_0x10bf47);throw _0x10bf47;});}return _0x50d43f;})[_0x8fa2('0x23')](respondWithResult(_0x213aea,0xc9))['catch'](handleError(_0x213aea,null));};exports[_0x8fa2('0x22')]=function(_0x4d75b1,_0x25e2df){if(_0x4d75b1[_0x8fa2('0x45')]['id']){delete _0x4d75b1['body']['id'];}return db[_0x8fa2('0x2a')][_0x8fa2('0x43')]({'where':{'id':_0x4d75b1[_0x8fa2('0x3f')]['id']}})[_0x8fa2('0x23')](handleEntityNotFound(_0x25e2df,null))[_0x8fa2('0x23')](saveUpdates(_0x4d75b1[_0x8fa2('0x45')],null))[_0x8fa2('0x23')](respondWithResult(_0x25e2df,null))[_0x8fa2('0x3e')](handleError(_0x25e2df,null));};exports[_0x8fa2('0x26')]=function(_0x85d21,_0x2ec440){return db['AnalyticCustomReport'][_0x8fa2('0x43')]({'where':{'id':_0x85d21[_0x8fa2('0x3f')]['id']}})[_0x8fa2('0x23')](handleEntityNotFound(_0x2ec440,null))['then'](removeEntity(_0x2ec440,null))['catch'](handleError(_0x2ec440,null));};exports[_0x8fa2('0x4d')]=function(_0x57b9f0,_0x27c1ac){var _0x58e9e3=0xa;var _0x4ad6bc=[_0x8fa2('0x4e'),_0x8fa2('0x4f'),_0x8fa2('0x50'),_0x8fa2('0x51')];var _0x5e2d7c={'SUM':_0x8fa2('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x8fa2('0x53'),'MIN':_0x8fa2('0x54'),'AVG':_0x8fa2('0x55'),'GROUP_CONCAT':_0x8fa2('0x56'),'GROUP_CONCAT ASC':_0x8fa2('0x57'),'GROUP_CONCAT DESC':_0x8fa2('0x58')};var _0x3d4521={'SEC_TO_TIME':_0x8fa2('0x59'),'DATE':_0x8fa2('0x5a'),'HOUR':_0x8fa2('0x5b'),'ROUND':_0x8fa2('0x5c'),'UNIX_TIMESTAMP':_0x8fa2('0x5d')};var _0x2c5fb0=function(_0x192983){return!_[_0x8fa2('0x5e')]([_0x8fa2('0x5f'),_0x8fa2('0x60'),_0x8fa2('0x61'),_0x8fa2('0x62')],_0x192983);};var _0x2b9888=function(_0x376a34){if(!_0x376a34||!_0x376a34[_0x8fa2('0x63')][_0x8fa2('0x40')]){return'';}for(var _0x109aa3='(',_0x21b87a=0x0;_0x21b87a<_0x376a34[_0x8fa2('0x63')][_0x8fa2('0x40')];_0x21b87a+=0x1){_0x21b87a>0x0&&(_0x109aa3+='\x20'+_0x376a34['operator']+'\x20');_0x109aa3+=_0x376a34['rules'][_0x21b87a]['group']?_0x2b9888(_0x376a34['rules'][_0x21b87a]['group']):_0x376a34[_0x8fa2('0x63')][_0x21b87a][_0x8fa2('0x39')]+'\x20'+_0x376a34[_0x8fa2('0x63')][_0x21b87a][_0x8fa2('0x64')]+(_0x2c5fb0(_0x376a34['rules'][_0x21b87a]['condition'])?'\x20'+_0x376a34[_0x8fa2('0x63')][_0x21b87a][_0x8fa2('0x65')]:'');}return _0x109aa3+')';};var _0x3c5ca4={'where':{'id':_0x57b9f0[_0x8fa2('0x3f')]['id']}},_0x3eddbf,_0x2b61f2,_0x4fe519,_0x372417,_0x30b933;_0x3c5ca4=_['merge']({},_0x3c5ca4,_0x57b9f0[_0x8fa2('0x3a')]);return db['AnalyticCustomReport'][_0x8fa2('0x43')](_0x3c5ca4)[_0x8fa2('0x23')](function(_0xe38cc3){if(_0xe38cc3){_0x3eddbf=_0xe38cc3;return _0xe38cc3[_0x8fa2('0x66')]();}return null;})[_0x8fa2('0x23')](function(_0x5b4fe2){if(_0x5b4fe2){if(!_0x5b4fe2[_0x8fa2('0x40')]){throw new db['Sequelize'][(_0x8fa2('0x67'))](_0x8fa2('0x68'),0x193);}_0x2b61f2=_0x5b4fe2;return db['AnalyticMetric'][_0x8fa2('0x3c')]({'raw':!![]});}return null;})[_0x8fa2('0x23')](function(_0x118a1a){if(_0x118a1a){_0x4fe519=_['keyBy'](_0x118a1a,'id');var _0x41eeab;var _0x5256b1=squel[_0x8fa2('0x69')]();_0x5256b1['from'](_0x3eddbf[_0x8fa2('0x6a')]);for(var _0x4b2055=0x0;_0x4b2055<_0x2b61f2[_0x8fa2('0x40')];_0x4b2055+=0x1){_0x41eeab=_0x2b61f2[_0x4b2055]['MetricId']?_0x4fe519[_0x2b61f2[_0x4b2055][_0x8fa2('0x6b')]][_0x8fa2('0x6c')]:_0x2b61f2[_0x4b2055][_0x8fa2('0x39')];_0x41eeab=_0x2b61f2[_0x4b2055][_0x8fa2('0x6d')]?_[_0x8fa2('0x6e')](_0x5e2d7c[_0x2b61f2[_0x4b2055]['function']],'%s',_0x41eeab):_0x41eeab;_0x41eeab=_0x2b61f2[_0x4b2055][_0x8fa2('0x6f')]?_[_0x8fa2('0x6e')](_0x3d4521[_0x2b61f2[_0x4b2055]['format']],'%s',_0x41eeab):_0x41eeab;if(_0x2b61f2[_0x4b2055]['groupBy']){_0x5256b1[_0x8fa2('0x70')](_0x41eeab);}_0x2b61f2[_0x4b2055][_0x8fa2('0x71')]&&_0x5256b1['order'](_0x41eeab,_0x2b61f2[_0x4b2055][_0x8fa2('0x71')]==='DESC'?![]:!![]);_0x5256b1[_0x8fa2('0x39')](_0x41eeab,_0x2b61f2[_0x4b2055][_0x8fa2('0x72')]||_0x41eeab);}if(_0x3eddbf[_0x8fa2('0x73')]){_0x3eddbf[_0x8fa2('0x73')]=JSON[_0x8fa2('0x74')](_0x3eddbf[_0x8fa2('0x73')]);for(var _0xda3ddf=0x0;_0xda3ddf<_0x3eddbf[_0x8fa2('0x73')]['length'];_0xda3ddf+=0x1){if(_0x3eddbf[_0x8fa2('0x73')][_0xda3ddf]['type']&&_[_0x8fa2('0x5e')](_0x4ad6bc,_0x3eddbf[_0x8fa2('0x73')][_0xda3ddf][_0x8fa2('0x75')])&&_0x3eddbf[_0x8fa2('0x73')][_0xda3ddf]['parentKey']&&_0x3eddbf[_0x8fa2('0x73')][_0xda3ddf][_0x8fa2('0x76')]&&_0x3eddbf[_0x8fa2('0x73')][_0xda3ddf][_0x8fa2('0x77')]){_0x5256b1[_0x3eddbf['joins'][_0xda3ddf][_0x8fa2('0x75')]](_0x3eddbf[_0x8fa2('0x73')][_0xda3ddf][_0x8fa2('0x76')],null,util['format'](_0x8fa2('0x78'),_0x3eddbf[_0x8fa2('0x6a')],_0x3eddbf[_0x8fa2('0x73')][_0xda3ddf][_0x8fa2('0x79')],_0x3eddbf[_0x8fa2('0x73')][_0xda3ddf][_0x8fa2('0x76')],_0x3eddbf[_0x8fa2('0x73')][_0xda3ddf][_0x8fa2('0x77')]));}}}if(_0x3eddbf['conditions']){_0x3eddbf[_0x8fa2('0x7a')]=JSON[_0x8fa2('0x74')](_0x3eddbf[_0x8fa2('0x7a')]);_0x5256b1['where'](_0x2b9888(_0x3eddbf[_0x8fa2('0x7a')]['group']));}_0x30b933=_0x5256b1[_0x8fa2('0x7b')]();_0x5256b1[_0x8fa2('0x1d')](_0x58e9e3);_0x5256b1['offset'](0x0);logger[_0x8fa2('0x7c')](_0x8fa2('0x7d'),_0x5256b1['toString']());return db[_0x8fa2('0x7e')]['query'](_0x5256b1[_0x8fa2('0x7f')](),{'type':db[_0x8fa2('0x7e')]['QueryTypes'][_0x8fa2('0x80')]});}})[_0x8fa2('0x23')](respondWithResult(_0x27c1ac,null))['catch'](handleError(_0x27c1ac,null));};function runReport(_0xf3eeb1,_0x1ef64c,_0x45960f){var _0xcda0a3=_0x1ef64c['name'];var _0x26b13f=0xa;var _0x1b2284=[_0x8fa2('0x4e'),'left_join',_0x8fa2('0x50'),_0x8fa2('0x51')];var _0x481b8f={'SUM':_0x8fa2('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x8fa2('0x53'),'MIN':'MIN(%s)','AVG':_0x8fa2('0x55'),'GROUP_CONCAT':_0x8fa2('0x56'),'GROUP_CONCAT ASC':_0x8fa2('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x30c0c2={'SEC_TO_TIME':_0x8fa2('0x59'),'DATE':_0x8fa2('0x5a'),'HOUR':_0x8fa2('0x5b'),'ROUND':_0x8fa2('0x5c'),'UNIX_TIMESTAMP':_0x8fa2('0x5d')};var _0x108ec9=function(_0x36b6ae){return!_[_0x8fa2('0x5e')](['IS\x20NULL',_0x8fa2('0x60'),_0x8fa2('0x61'),_0x8fa2('0x62')],_0x36b6ae);};var _0x185a28=function(_0x55e207){if(!_0x55e207||!_0x55e207[_0x8fa2('0x63')][_0x8fa2('0x40')]){return'';}for(var _0x25eb36='(',_0x4151d7=0x0;_0x4151d7<_0x55e207[_0x8fa2('0x63')][_0x8fa2('0x40')];_0x4151d7+=0x1){_0x4151d7>0x0&&(_0x25eb36+='\x20'+_0x55e207[_0x8fa2('0x81')]+'\x20');_0x25eb36+=_0x55e207['rules'][_0x4151d7]['group']?_0x185a28(_0x55e207[_0x8fa2('0x63')][_0x4151d7]['group']):_0x55e207['rules'][_0x4151d7][_0x8fa2('0x39')]+'\x20'+_0x55e207[_0x8fa2('0x63')][_0x4151d7][_0x8fa2('0x64')]+(_0x108ec9(_0x55e207['rules'][_0x4151d7][_0x8fa2('0x64')])?'\x20'+_0x55e207[_0x8fa2('0x63')][_0x4151d7][_0x8fa2('0x65')]:'');}return _0x25eb36+')';};var _0x172c4d={'where':{'id':_0xf3eeb1['id']}},_0xeb27a,_0x1876c7,_0x477592,_0x2531d7,_0x20cc15;_0x172c4d=_[_0x8fa2('0x42')]({},_0x172c4d,_0x45960f);return db[_0x8fa2('0x2a')][_0x8fa2('0x43')](_0x172c4d)['then'](function(_0x3a4ec6){if(_0x3a4ec6){_0xeb27a=_0x3a4ec6;return _0x3a4ec6[_0x8fa2('0x66')]();}return null;})[_0x8fa2('0x23')](function(_0x5b9e9b){if(_0x5b9e9b){if(!_0x5b9e9b[_0x8fa2('0x40')]){throw new db['Sequelize']['ValidationErrorItem'](_0x8fa2('0x68'),0x193);}_0x1876c7=_0x5b9e9b;return db[_0x8fa2('0x82')][_0x8fa2('0x3c')]({'raw':!![]});}return null;})[_0x8fa2('0x23')](function(_0x4bedd4){if(_0x4bedd4){_0x477592=_[_0x8fa2('0x83')](_0x4bedd4,'id');var _0x147545;var _0x33358c=squel[_0x8fa2('0x69')]();_0x33358c['from'](_0xeb27a[_0x8fa2('0x6a')]);for(var _0x25038a=0x0;_0x25038a<_0x1876c7['length'];_0x25038a+=0x1){_0x147545=_0x1876c7[_0x25038a]['MetricId']?_0x477592[_0x1876c7[_0x25038a][_0x8fa2('0x6b')]][_0x8fa2('0x6c')]:_0x1876c7[_0x25038a][_0x8fa2('0x39')];_0x147545=_0x1876c7[_0x25038a][_0x8fa2('0x6d')]?_[_0x8fa2('0x6e')](_0x481b8f[_0x1876c7[_0x25038a][_0x8fa2('0x6d')]],'%s',_0x147545):_0x147545;_0x147545=_0x1876c7[_0x25038a]['format']?_[_0x8fa2('0x6e')](_0x30c0c2[_0x1876c7[_0x25038a]['format']],'%s',_0x147545):_0x147545;if(_0x1876c7[_0x25038a]['groupBy']){_0x33358c[_0x8fa2('0x70')](_0x147545);}_0x1876c7[_0x25038a][_0x8fa2('0x71')]&&_0x33358c['order'](_0x147545,_0x1876c7[_0x25038a]['orderBy']===_0x8fa2('0x84')?![]:!![]);_0x33358c['field'](_0x147545,_0x1876c7[_0x25038a][_0x8fa2('0x72')]||_0x147545);}if(_0xeb27a[_0x8fa2('0x73')]){_0xeb27a['joins']=JSON[_0x8fa2('0x74')](_0xeb27a[_0x8fa2('0x73')]);for(var _0x68a347=0x0;_0x68a347<_0xeb27a[_0x8fa2('0x73')][_0x8fa2('0x40')];_0x68a347+=0x1){if(_0xeb27a['joins'][_0x68a347][_0x8fa2('0x75')]&&_[_0x8fa2('0x5e')](_0x1b2284,_0xeb27a[_0x8fa2('0x73')][_0x68a347][_0x8fa2('0x75')])&&_0xeb27a[_0x8fa2('0x73')][_0x68a347][_0x8fa2('0x79')]&&_0xeb27a[_0x8fa2('0x73')][_0x68a347][_0x8fa2('0x76')]&&_0xeb27a[_0x8fa2('0x73')][_0x68a347][_0x8fa2('0x77')]){_0x33358c[_0xeb27a[_0x8fa2('0x73')][_0x68a347][_0x8fa2('0x75')]](_0xeb27a[_0x8fa2('0x73')][_0x68a347][_0x8fa2('0x76')],null,util[_0x8fa2('0x6f')](_0x8fa2('0x78'),_0xeb27a[_0x8fa2('0x6a')],_0xeb27a[_0x8fa2('0x73')][_0x68a347][_0x8fa2('0x79')],_0xeb27a[_0x8fa2('0x73')][_0x68a347][_0x8fa2('0x76')],_0xeb27a[_0x8fa2('0x73')][_0x68a347]['foreignKey']));}}}if(_0xeb27a['conditions']){_0xeb27a[_0x8fa2('0x7a')]=JSON[_0x8fa2('0x74')](_0xeb27a[_0x8fa2('0x7a')]);_0x33358c['where'](_0x185a28(_0xeb27a[_0x8fa2('0x7a')][_0x8fa2('0x70')]));}_0x20cc15=_0x33358c[_0x8fa2('0x7b')]();_0x33358c[_0x8fa2('0x1d')](_0x26b13f);_0x33358c[_0x8fa2('0x1c')](0x0);logger[_0x8fa2('0x7c')](_0x8fa2('0x7d'),_0x33358c[_0x8fa2('0x7f')]());return db['sequelize']['query'](_0x33358c['toString'](),{'type':db[_0x8fa2('0x7e')][_0x8fa2('0x85')]['SELECT']});}})[_0x8fa2('0x23')](function(_0x1dcbd7){if(!_0x1dcbd7[_0x8fa2('0x40')]){throw new db[(_0x8fa2('0x86'))][(_0x8fa2('0x67'))](_0x8fa2('0x87'),0xcc);}if(_0x1ef64c['output']==='web'){return null;}var _0x53f9c9=_[_0x8fa2('0x42')](_0x1ef64c,{'name':_0x1ef64c[_0x8fa2('0x88')]||_0x1ef64c[_0x8fa2('0x29')]||_0xeb27a['name'],'basename':_0xcda0a3,'savename':util[_0x8fa2('0x6f')](_0x8fa2('0x89'),_0x1ef64c[_0x8fa2('0x29')]||_0xeb27a[_0x8fa2('0x29')],require(_0x8fa2('0x8a'))['generate'](0x4),_0x1ef64c[_0x8fa2('0x8b')]||_0x8fa2('0x8c')),'reportId':_0xeb27a['id'],'reportType':_0x8fa2('0x8d')});return db['AnalyticExtractedReport'][_0x8fa2('0x44')](_0x53f9c9,{'raw':!![]});})['then'](function(_0x580485){if(_0xeb27a[_0x8fa2('0x6a')]==='cdr'){_0x20cc15[_0x8fa2('0x36')](_0xeb27a[_0x8fa2('0x6a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1ef64c['startDate'],_0x1ef64c['endDate']);}else{_0x20cc15[_0x8fa2('0x36')](_0xeb27a['table']+_0x8fa2('0x8e'),_0x1ef64c[_0x8fa2('0x8f')],_0x1ef64c[_0x8fa2('0x90')]);}if(_0x580485){logger['info'](_0x8fa2('0x91'),_0x20cc15[_0x8fa2('0x7f')]());require(_0x8fa2('0x92'))['fork'](path[_0x8fa2('0x4e')](__dirname,'../../components/export/',_0x580485[_0x8fa2('0x8b')]),[_0x580485['id'],_0x20cc15[_0x8fa2('0x7f')](),path[_0x8fa2('0x4e')](__dirname,_0x8fa2('0x93'),_0x580485[_0x8fa2('0x94')]),_0xcda0a3]);return _0x580485;}else{var _0x11798c=squel[_0x8fa2('0x69')]();_0x11798c[_0x8fa2('0x95')]('('+_0x20cc15[_0x8fa2('0x7f')]()+')',_0x8fa2('0x96'));_0x11798c[_0x8fa2('0x39')](_0x8fa2('0x97'),'count');_0x20cc15[_0x8fa2('0x1d')](_0x1ef64c[_0x8fa2('0x1d')]||_0x26b13f);_0x20cc15[_0x8fa2('0x1c')](_0x1ef64c[_0x8fa2('0x1c')]||0x0);return db[_0x8fa2('0x7e')][_0x8fa2('0x2e')](_0x11798c[_0x8fa2('0x7f')](),{'type':db['sequelize'][_0x8fa2('0x85')][_0x8fa2('0x80')]})[_0x8fa2('0x23')](function(_0x556dd9){if(!_0x556dd9[_0x8fa2('0x40')]){_0x2531d7=0x0;}else{_0x2531d7=_0x556dd9[0x0][_0x8fa2('0x1b')]||0x0;}return db['sequelize'][_0x8fa2('0x2e')](_0x20cc15[_0x8fa2('0x7f')](),{'type':db[_0x8fa2('0x7e')]['QueryTypes'][_0x8fa2('0x80')]});})[_0x8fa2('0x23')](function(_0x18c02c){return{'rows':_0x18c02c||[],'count':_0x2531d7};});}});}exports[_0x8fa2('0x98')]=function(_0x4a9840,_0xb8cd85){return runReport(_0x4a9840[_0x8fa2('0x3f')],_0x4a9840['query'],_0x4a9840[_0x8fa2('0x3a')])[_0x8fa2('0x23')](respondWithResult(_0xb8cd85,null))[_0x8fa2('0x3e')](handleError(_0xb8cd85,null));};exports[_0x8fa2('0x99')]=runReport;exports[_0x8fa2('0x2e')]=function(_0x3a1d1b,_0x388d77){var _0x31e48e=0xa;var _0x3cbe93=[_0x8fa2('0x4e'),_0x8fa2('0x4f'),_0x8fa2('0x50'),_0x8fa2('0x51')];var _0x3fb277={'SUM':_0x8fa2('0x52'),'COUNT':_0x8fa2('0x9a'),'COUNT DISTINCT':_0x8fa2('0x9b'),'MAX':'MAX(%s)','MIN':_0x8fa2('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x8fa2('0x56'),'GROUP_CONCAT ASC':_0x8fa2('0x57'),'GROUP_CONCAT DESC':_0x8fa2('0x58')};var _0x35dd67={'SEC_TO_TIME':_0x8fa2('0x59'),'DATE':_0x8fa2('0x5a'),'HOUR':_0x8fa2('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x8fa2('0x5d')};var _0x47df5c=function(_0x37d5e6){return!_['includes'](['IS\x20NULL',_0x8fa2('0x60'),_0x8fa2('0x61'),_0x8fa2('0x62')],_0x37d5e6);};var _0x330e5a=function(_0x16e551){if(!_0x16e551||!_0x16e551[_0x8fa2('0x63')][_0x8fa2('0x40')]){return'';}for(var _0x4864c4='(',_0x520a4d=0x0;_0x520a4d<_0x16e551[_0x8fa2('0x63')][_0x8fa2('0x40')];_0x520a4d+=0x1){_0x520a4d>0x0&&(_0x4864c4+='\x20'+_0x16e551['operator']+'\x20');_0x4864c4+=_0x16e551[_0x8fa2('0x63')][_0x520a4d]['group']?_0x330e5a(_0x16e551[_0x8fa2('0x63')][_0x520a4d][_0x8fa2('0x70')]):_0x16e551[_0x8fa2('0x63')][_0x520a4d][_0x8fa2('0x39')]+'\x20'+_0x16e551[_0x8fa2('0x63')][_0x520a4d][_0x8fa2('0x64')]+(_0x47df5c(_0x16e551[_0x8fa2('0x63')][_0x520a4d][_0x8fa2('0x64')])?'\x20'+_0x16e551[_0x8fa2('0x63')][_0x520a4d][_0x8fa2('0x65')]:'');}return _0x4864c4+')';};var _0xeda7ba={'where':{'id':_0x3a1d1b[_0x8fa2('0x3f')]['id']}},_0x1e1703,_0x2ab013,_0x166b29,_0xeab7a0,_0x153bef;_0xeda7ba=_['merge']({},_0xeda7ba,_0x3a1d1b[_0x8fa2('0x3a')]);return db[_0x8fa2('0x2a')][_0x8fa2('0x43')](_0xeda7ba)['then'](function(_0x30f467){if(_0x30f467){_0x1e1703=_0x30f467;return _0x30f467[_0x8fa2('0x66')]();}return null;})[_0x8fa2('0x23')](function(_0x32b9b6){if(_0x32b9b6){if(!_0x32b9b6[_0x8fa2('0x40')]){throw new db[(_0x8fa2('0x86'))][(_0x8fa2('0x67'))](_0x8fa2('0x68'),0x193);}_0x2ab013=_0x32b9b6;return db[_0x8fa2('0x82')][_0x8fa2('0x3c')]({'raw':!![]});}return null;})[_0x8fa2('0x23')](function(_0x26f702){if(_0x26f702){_0x166b29=_['keyBy'](_0x26f702,'id');var _0x1cf56d;var _0x30eb33=squel[_0x8fa2('0x69')]();_0x30eb33[_0x8fa2('0x95')](_0x1e1703['table']);for(var _0x6521e1=0x0;_0x6521e1<_0x2ab013[_0x8fa2('0x40')];_0x6521e1+=0x1){_0x1cf56d=_0x2ab013[_0x6521e1][_0x8fa2('0x6b')]?_0x166b29[_0x2ab013[_0x6521e1]['MetricId']][_0x8fa2('0x6c')]:_0x2ab013[_0x6521e1]['field'];_0x1cf56d=_0x2ab013[_0x6521e1][_0x8fa2('0x6d')]?_[_0x8fa2('0x6e')](_0x3fb277[_0x2ab013[_0x6521e1]['function']],'%s',_0x1cf56d):_0x1cf56d;_0x1cf56d=_0x2ab013[_0x6521e1][_0x8fa2('0x6f')]?_['replace'](_0x35dd67[_0x2ab013[_0x6521e1]['format']],'%s',_0x1cf56d):_0x1cf56d;if(_0x2ab013[_0x6521e1][_0x8fa2('0x9c')]){_0x30eb33[_0x8fa2('0x70')](_0x1cf56d);}_0x2ab013[_0x6521e1][_0x8fa2('0x71')]&&_0x30eb33[_0x8fa2('0x34')](_0x1cf56d,_0x2ab013[_0x6521e1]['orderBy']===_0x8fa2('0x84')?![]:!![]);_0x30eb33[_0x8fa2('0x39')](_0x1cf56d,_0x2ab013[_0x6521e1][_0x8fa2('0x72')]||_0x1cf56d);}if(_0x1e1703[_0x8fa2('0x73')]){_0x1e1703[_0x8fa2('0x73')]=JSON[_0x8fa2('0x74')](_0x1e1703['joins']);for(var _0x506727=0x0;_0x506727<_0x1e1703[_0x8fa2('0x73')][_0x8fa2('0x40')];_0x506727+=0x1){if(_0x1e1703[_0x8fa2('0x73')][_0x506727][_0x8fa2('0x75')]&&_[_0x8fa2('0x5e')](_0x3cbe93,_0x1e1703['joins'][_0x506727]['type'])&&_0x1e1703[_0x8fa2('0x73')][_0x506727][_0x8fa2('0x79')]&&_0x1e1703['joins'][_0x506727][_0x8fa2('0x76')]&&_0x1e1703[_0x8fa2('0x73')][_0x506727]['foreignKey']){_0x30eb33[_0x1e1703[_0x8fa2('0x73')][_0x506727][_0x8fa2('0x75')]](_0x1e1703['joins'][_0x506727][_0x8fa2('0x76')],null,util['format'](_0x8fa2('0x78'),_0x1e1703['table'],_0x1e1703[_0x8fa2('0x73')][_0x506727][_0x8fa2('0x79')],_0x1e1703['joins'][_0x506727][_0x8fa2('0x76')],_0x1e1703[_0x8fa2('0x73')][_0x506727][_0x8fa2('0x77')]));}}}if(_0x1e1703['conditions']){_0x1e1703['conditions']=JSON[_0x8fa2('0x74')](_0x1e1703['conditions']);_0x30eb33[_0x8fa2('0x36')](_0x330e5a(_0x1e1703[_0x8fa2('0x7a')][_0x8fa2('0x70')]));}_0x153bef=_0x30eb33[_0x8fa2('0x7b')]();_0x30eb33[_0x8fa2('0x1d')](_0x31e48e);_0x30eb33['offset'](0x0);logger[_0x8fa2('0x7c')](_0x8fa2('0x7d'),_0x30eb33[_0x8fa2('0x7f')]());return db[_0x8fa2('0x7e')][_0x8fa2('0x2e')](_0x30eb33['toString'](),{'type':db[_0x8fa2('0x7e')][_0x8fa2('0x85')]['SELECT']});}})[_0x8fa2('0x23')](function(){return{'sql':_0x153bef[_0x8fa2('0x7f')]()};})[_0x8fa2('0x23')](respondWithResult(_0x388d77,null))['catch'](handleError(_0x388d77,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 6dff928..f18a911 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 _0xff50=['request-promise','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','api','moment'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xff50,0x1ad));var _0x0ff5=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0xff50[_0x1dbaf7];return _0x593f05;};'use strict';var _=require(_0x0ff5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0ff5('0x1'));var moment=require(_0x0ff5('0x2'));var BPromise=require('bluebird');var rp=require(_0x0ff5('0x3'));var attributes=require(_0x0ff5('0x4'));module[_0x0ff5('0x5')]=function(_0x576ee8,_0x301e13){return _0x576ee8[_0x0ff5('0x6')](_0x0ff5('0x7'),attributes,{'tableName':_0x0ff5('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x932d=['request-promise','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','../../config/logger','moment','bluebird'];(function(_0xa6cacd,_0x26a294){var _0x540610=function(_0x5ab7a5){while(--_0x5ab7a5){_0xa6cacd['push'](_0xa6cacd['shift']());}};_0x540610(++_0x26a294);}(_0x932d,0x113));var _0xd932=function(_0x57790a,_0x2a94f8){_0x57790a=_0x57790a-0x0;var _0x5d3223=_0x932d[_0x57790a];return _0x5d3223;};'use strict';var _=require(_0xd932('0x0'));var util=require('util');var logger=require(_0xd932('0x1'))('api');var moment=require(_0xd932('0x2'));var BPromise=require(_0xd932('0x3'));var rp=require(_0xd932('0x4'));var attributes=require(_0xd932('0x5'));module[_0xd932('0x6')]=function(_0x319a02,_0x1e1f11){return _0x319a02[_0xd932('0x7')]('AnalyticCustomReport',attributes,{'tableName':_0xd932('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 173dccf..66cf43e 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 _0xa9e0=['http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\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(_0x4f1f0b,_0x27bb88){var _0x1cd954=function(_0x246304){while(--_0x246304){_0x4f1f0b['push'](_0x4f1f0b['shift']());}};_0x1cd954(++_0x27bb88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\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(_0x2bff68,_0x35f8f8){var _0x506c42=function(_0xa685b5){while(--_0xa685b5){_0x2bff68['push'](_0x2bff68['shift']());}};_0x506c42(++_0x35f8f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3ae652c..ea0008c 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 _0x14a0=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','preview','query','create','put','/:id','update','delete'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x14a0,0x8e));var _0x014a=function(_0x5d2eaf,_0x5c6431){_0x5d2eaf=_0x5d2eaf-0x0;var _0x4a4c9c=_0x14a0[_0x5d2eaf];return _0x4a4c9c;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var auth=require(_0x014a('0x5'));var interaction=require(_0x014a('0x6'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x014a('0x7')]('/',auth[_0x014a('0x8')](),controller[_0x014a('0x9')]);router['get']('/:id',auth[_0x014a('0x8')](),controller[_0x014a('0xa')]);router[_0x014a('0x7')]('/:id/preview',auth['isAuthenticated'](),controller[_0x014a('0xb')]);router['get']('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0x014a('0x7')]('/:id/query',auth[_0x014a('0x8')](),controller[_0x014a('0xc')]);router['post']('/',auth[_0x014a('0x8')](),controller[_0x014a('0xd')]);router[_0x014a('0xe')](_0x014a('0xf'),auth[_0x014a('0x8')](),controller[_0x014a('0x10')]);router[_0x014a('0x11')](_0x014a('0xf'),auth[_0x014a('0x8')](),controller[_0x014a('0x12')]);module[_0x014a('0x13')]=router; \ No newline at end of file +var _0x28f2=['update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put'];(function(_0x1afaec,_0x47ab02){var _0x2260b7=function(_0x169075){while(--_0x169075){_0x1afaec['push'](_0x1afaec['shift']());}};_0x2260b7(++_0x47ab02);}(_0x28f2,0x193));var _0x228f=function(_0x2d0375,_0x4016c7){_0x2d0375=_0x2d0375-0x0;var _0x15027e=_0x28f2[_0x2d0375];return _0x15027e;};'use strict';var multer=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var path=require(_0x228f('0x2'));var timeout=require(_0x228f('0x3'));var express=require(_0x228f('0x4'));var router=express['Router']();var auth=require(_0x228f('0x5'));var interaction=require(_0x228f('0x6'));var config=require(_0x228f('0x7'));var controller=require(_0x228f('0x8'));router[_0x228f('0x9')]('/',auth[_0x228f('0xa')](),controller[_0x228f('0xb')]);router['get'](_0x228f('0xc'),auth['isAuthenticated'](),controller[_0x228f('0xd')]);router[_0x228f('0x9')](_0x228f('0xe'),auth['isAuthenticated'](),controller[_0x228f('0xf')]);router['get'](_0x228f('0x10'),auth[_0x228f('0xa')](),controller['run']);router[_0x228f('0x9')](_0x228f('0x11'),auth[_0x228f('0xa')](),controller[_0x228f('0x12')]);router[_0x228f('0x13')]('/',auth['isAuthenticated'](),controller[_0x228f('0x14')]);router[_0x228f('0x15')](_0x228f('0xc'),auth[_0x228f('0xa')](),controller[_0x228f('0x16')]);router[_0x228f('0x17')](_0x228f('0xc'),auth[_0x228f('0xa')](),controller['destroy']);module[_0x228f('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index a325c00..6371f3c 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 _0xb615=['exports','STRING','TEXT'];(function(_0x19b082,_0x4749a9){var _0x34bb24=function(_0x4405b5){while(--_0x4405b5){_0x19b082['push'](_0x19b082['shift']());}};_0x34bb24(++_0x4749a9);}(_0xb615,0x198));var _0x5b61=function(_0x559355,_0x26f42d){_0x559355=_0x559355-0x0;var _0x4e82fe=_0xb615[_0x559355];return _0x4e82fe;};'use strict';var Sequelize=require('sequelize');module[_0x5b61('0x0')]={'name':{'type':Sequelize[_0x5b61('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5b61('0x1')]},'parent':{'type':Sequelize[_0x5b61('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x5b61('0x2')]},'joins':{'type':Sequelize[_0x5b61('0x2')]}}; \ No newline at end of file +var _0x151e=['TEXT','sequelize','STRING'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0x151e,0x16c));var _0xe151=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0x151e[_0x330414];return _0x99dbff;};'use strict';var Sequelize=require(_0xe151('0x0'));module['exports']={'name':{'type':Sequelize[_0xe151('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe151('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xe151('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xe151('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index f1ae60f..ec4e46b 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 _0xc53f=['crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','end','error','stack','send','AnalyticDefaultReport','rawAttributes','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','key','field','options','rows','catch','show','params','includeAll','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','UserProfileResource','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20NULL','value','getFields','ValidationErrorItem','groupBy','DESC','toString','No\x20available\x20data','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x54bf13,_0x546508){var _0x4f3a82=function(_0x182432){while(--_0x182432){_0x54bf13['push'](_0x54bf13['shift']());}};_0x4f3a82(++_0x546508);}(_0xc53f,0x1e5));var _0xfc53=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xc53f[_0x1e3c16];return _0x47a0c9;};'use strict';var pdf=require(_0xfc53('0x0'));var emlformat=require(_0xfc53('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfc53('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc53('0x3'));var moment=require(_0xfc53('0x4'));var BPromise=require(_0xfc53('0x5'));var Mustache=require('mustache');var util=require(_0xfc53('0x6'));var path=require(_0xfc53('0x7'));var sox=require(_0xfc53('0x8'));var csv=require(_0xfc53('0x9'));var ejs=require(_0xfc53('0xa'));var fs=require('fs');var _=require(_0xfc53('0xb'));var squel=require(_0xfc53('0xc'));var crypto=require(_0xfc53('0xd'));var jsforce=require(_0xfc53('0xe'));var deskjs=require(_0xfc53('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfc53('0x10'));var Papa=require(_0xfc53('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0xfc53('0x12'));var Redis=require(_0xfc53('0x13'));var qs=require(_0xfc53('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfc53('0x15'));var db=require(_0xfc53('0x16'))['db'];function respondWithStatusCode(_0x55368a,_0xe5b311){_0xe5b311=_0xe5b311||0xcc;return function(_0x899f57){if(_0x899f57){return _0x55368a['sendStatus'](_0xe5b311);}return _0x55368a[_0xfc53('0x17')](_0xe5b311)['end']();};}function respondWithResult(_0x2c619e,_0x54fb4c){_0x54fb4c=_0x54fb4c||0xc8;return function(_0x346d6e){if(_0x346d6e){return _0x2c619e[_0xfc53('0x17')](_0x54fb4c)[_0xfc53('0x18')](_0x346d6e);}};}function respondWithFilteredResult(_0x340b9b,_0x39c1f8){return function(_0xed405d){if(_0xed405d){var _0x1f2709=_0xed405d[_0xfc53('0x19')],_0xade7ae=_0x39c1f8[_0xfc53('0x1a')],_0x3b0191=_0x39c1f8[_0xfc53('0x1a')]+_0x39c1f8[_0xfc53('0x1b')],_0x59aef9;if(_0x3b0191>=_0x1f2709){_0x3b0191=_0x1f2709;_0x59aef9=0xc8;}else{_0x59aef9=0xce;}_0x340b9b['status'](_0x59aef9);return _0x340b9b[_0xfc53('0x1c')](_0xfc53('0x1d'),_0xade7ae+'-'+_0x3b0191+'/'+_0x1f2709)['json'](_0xed405d);}return null;};}function patchUpdates(_0x5c4f15){return function(_0x485e2f){try{jsonpatch[_0xfc53('0x1e')](_0x485e2f,_0x5c4f15,!![]);}catch(_0x4e5750){return BPromise[_0xfc53('0x1f')](_0x4e5750);}return _0x485e2f[_0xfc53('0x20')]();};}function saveUpdates(_0x513d4c,_0x3513e3){return function(_0x15fd8b){if(_0x15fd8b){return _0x15fd8b[_0xfc53('0x21')](_0x513d4c)[_0xfc53('0x22')](function(_0x92958b){return _0x92958b;});}return null;};}function removeEntity(_0x4de131,_0x2d66bb){return function(_0x4a41e3){if(_0x4a41e3){return _0x4a41e3[_0xfc53('0x23')]()['then'](function(){var _0x452ebe=_0x4a41e3['get']({'plain':!![]});var _0x1f8b5c=_0xfc53('0x24');return db['UserProfileResource'][_0xfc53('0x23')]({'where':{'type':_0x1f8b5c,'resourceId':_0x452ebe['id']}})[_0xfc53('0x22')](function(){return _0x4a41e3;});})['then'](function(){_0x4de131[_0xfc53('0x17')](0xcc)[_0xfc53('0x25')]();});}};}function handleEntityNotFound(_0x4d818f,_0x1984aa){return function(_0x4ac87c){if(!_0x4ac87c){_0x4d818f['sendStatus'](0x194);}return _0x4ac87c;};}function handleError(_0x160b35,_0x180ce3){_0x180ce3=_0x180ce3||0x1f4;return function(_0x3758a2){logger[_0xfc53('0x26')](_0x3758a2[_0xfc53('0x27')]);if(_0x3758a2['name']){delete _0x3758a2['name'];}_0x160b35['status'](_0x180ce3)[_0xfc53('0x28')](_0x3758a2);};}exports['index']=function(_0x3490d7,_0x2447cf){var _0x4a2324={},_0x463478={},_0x57bcaf={'count':0x0,'rows':[]};var _0xa2769e=db[_0xfc53('0x29')][_0xfc53('0x2a')];_0x463478['model']=_[_0xfc53('0x2b')](_0xa2769e);_0x463478[_0xfc53('0x2c')]=_[_0xfc53('0x2b')](_0x3490d7[_0xfc53('0x2c')]);_0x463478[_0xfc53('0x2d')]=_['intersection'](_0x463478[_0xfc53('0x2e')],_0x463478['query']);_0x4a2324[_0xfc53('0x2f')]=_[_0xfc53('0x30')](_0x463478[_0xfc53('0x2e')],qs[_0xfc53('0x31')](_0x3490d7['query'][_0xfc53('0x31')]));_0x4a2324[_0xfc53('0x2f')]=_0x4a2324[_0xfc53('0x2f')]['length']?_0x4a2324[_0xfc53('0x2f')]:_0x463478[_0xfc53('0x2e')];if(!_0x3490d7[_0xfc53('0x2c')][_0xfc53('0x32')]('nolimit')){_0x4a2324[_0xfc53('0x1b')]=qs[_0xfc53('0x1b')](_0x3490d7[_0xfc53('0x2c')][_0xfc53('0x1b')]);_0x4a2324[_0xfc53('0x1a')]=qs[_0xfc53('0x1a')](_0x3490d7[_0xfc53('0x2c')][_0xfc53('0x1a')]);}_0x4a2324[_0xfc53('0x33')]=qs['sort'](_0x3490d7[_0xfc53('0x2c')][_0xfc53('0x34')]);_0x4a2324[_0xfc53('0x35')]=qs[_0xfc53('0x2d')](_[_0xfc53('0x36')](_0x3490d7['query'],_0x463478[_0xfc53('0x2d')]));if(_0x3490d7[_0xfc53('0x2c')][_0xfc53('0x37')]){_0x4a2324[_0xfc53('0x35')]=_[_0xfc53('0x38')](_0x4a2324[_0xfc53('0x35')],{'$or':_[_0xfc53('0x39')](_0xa2769e,function(_0x4f4424){if(_0x4f4424[_0xfc53('0x3a')][_0xfc53('0x3b')]!=='VIRTUAL'){var _0xe62c5e={};_0xe62c5e[_0x4f4424[_0xfc53('0x3c')]]={'$like':'%'+_0x3490d7['query'][_0xfc53('0x37')]+'%'};return _0xe62c5e;}})});}_0x4a2324=_[_0xfc53('0x38')]({},_0x4a2324,_0x3490d7[_0xfc53('0x3d')]);var _0x49a8b2={'where':_0x4a2324[_0xfc53('0x35')]};return db[_0xfc53('0x29')]['count'](_0x49a8b2)[_0xfc53('0x22')](function(_0x1a1d50){_0x57bcaf[_0xfc53('0x19')]=_0x1a1d50;if(_0x3490d7[_0xfc53('0x2c')]['includeAll']){_0x4a2324['include']=[{'all':!![]}];}return db[_0xfc53('0x29')]['findAll'](_0x4a2324);})['then'](function(_0x56dfa6){_0x57bcaf[_0xfc53('0x3e')]=_0x56dfa6;return _0x57bcaf;})['then'](respondWithFilteredResult(_0x2447cf,_0x4a2324))[_0xfc53('0x3f')](handleError(_0x2447cf,null));};exports[_0xfc53('0x40')]=function(_0x48576f,_0x22fc7f){var _0x22e19c={'raw':!![],'where':{'id':_0x48576f[_0xfc53('0x41')]['id']}},_0x2265a9={};_0x2265a9['model']=_[_0xfc53('0x2b')](db[_0xfc53('0x29')]['rawAttributes']);_0x2265a9[_0xfc53('0x2c')]=_['keys'](_0x48576f['query']);_0x2265a9[_0xfc53('0x2d')]=_[_0xfc53('0x30')](_0x2265a9[_0xfc53('0x2e')],_0x2265a9['query']);_0x22e19c['attributes']=_[_0xfc53('0x30')](_0x2265a9[_0xfc53('0x2e')],qs[_0xfc53('0x31')](_0x48576f[_0xfc53('0x2c')][_0xfc53('0x31')]));_0x22e19c[_0xfc53('0x2f')]=_0x22e19c[_0xfc53('0x2f')]['length']?_0x22e19c['attributes']:_0x2265a9[_0xfc53('0x2e')];if(_0x48576f['query'][_0xfc53('0x42')]){_0x22e19c[_0xfc53('0x43')]=[{'all':!![]}];}_0x22e19c=_[_0xfc53('0x38')]({},_0x22e19c,_0x48576f['options']);return db[_0xfc53('0x29')][_0xfc53('0x44')](_0x22e19c)[_0xfc53('0x22')](handleEntityNotFound(_0x22fc7f,null))[_0xfc53('0x22')](respondWithResult(_0x22fc7f,null))[_0xfc53('0x3f')](handleError(_0x22fc7f,null));};exports[_0xfc53('0x45')]=function(_0x53a360,_0x2cdab8){return db['AnalyticDefaultReport'][_0xfc53('0x45')](_0x53a360['body'],{})[_0xfc53('0x22')](function(_0x2ee05f){var _0x1f9531=_0x53a360[_0xfc53('0x46')][_0xfc53('0x47')]({'plain':!![]});if(!_0x1f9531)throw new Error(_0xfc53('0x48'));if(_0x1f9531[_0xfc53('0x49')]===_0xfc53('0x46')){var _0x418194=_0x2ee05f[_0xfc53('0x47')]({'plain':!![]});var _0x418a02=_0xfc53('0x4a');return db[_0xfc53('0x4b')]['find']({'where':{'name':_0x418a02,'userProfileId':_0x1f9531['userProfileId']},'raw':!![]})['then'](function(_0x44c738){if(_0x44c738&&_0x44c738[_0xfc53('0x4c')]===0x0){return db[_0xfc53('0x4d')][_0xfc53('0x45')]({'name':_0x418194[_0xfc53('0x4e')],'resourceId':_0x418194['id'],'type':_0xfc53('0x24'),'sectionId':_0x44c738['id']},{})[_0xfc53('0x22')](function(){return _0x2ee05f;});}else{return _0x2ee05f;}})['catch'](function(_0xabf62e){logger[_0xfc53('0x26')](_0xfc53('0x4f'),_0xabf62e);throw _0xabf62e;});}return _0x2ee05f;})[_0xfc53('0x22')](respondWithResult(_0x2cdab8,0xc9))['catch'](handleError(_0x2cdab8,null));};exports[_0xfc53('0x21')]=function(_0xb30071,_0x2195cc){if(_0xb30071[_0xfc53('0x50')]['id']){delete _0xb30071[_0xfc53('0x50')]['id'];}return db[_0xfc53('0x29')][_0xfc53('0x44')]({'where':{'id':_0xb30071['params']['id']}})[_0xfc53('0x22')](handleEntityNotFound(_0x2195cc,null))['then'](saveUpdates(_0xb30071[_0xfc53('0x50')],null))[_0xfc53('0x22')](respondWithResult(_0x2195cc,null))[_0xfc53('0x3f')](handleError(_0x2195cc,null));};exports['destroy']=function(_0x226539,_0xc2c760){return db[_0xfc53('0x29')][_0xfc53('0x44')]({'where':{'id':_0x226539['params']['id']}})[_0xfc53('0x22')](handleEntityNotFound(_0xc2c760,null))[_0xfc53('0x22')](removeEntity(_0xc2c760,null))[_0xfc53('0x3f')](handleError(_0xc2c760,null));};exports[_0xfc53('0x51')]=function(_0x4cce42,_0x26fdf7){var _0x52ada5=0xa;var _0x920c30=[_0xfc53('0x52'),_0xfc53('0x53'),_0xfc53('0x54'),_0xfc53('0x55')];var _0x5be695={'SUM':'SUM(%s)','COUNT':_0xfc53('0x56'),'COUNT DISTINCT':_0xfc53('0x57'),'MAX':_0xfc53('0x58'),'MIN':_0xfc53('0x59'),'AVG':_0xfc53('0x5a'),'GROUP_CONCAT':_0xfc53('0x5b'),'GROUP_CONCAT ASC':_0xfc53('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x7ff5ad={'SEC_TO_TIME':_0xfc53('0x5d'),'DATE':_0xfc53('0x5e'),'HOUR':_0xfc53('0x5f'),'ROUND':_0xfc53('0x60'),'UNIX_TIMESTAMP':_0xfc53('0x61')};var _0x4361d1=function(_0xd2fb9a){return!_[_0xfc53('0x62')]([_0xfc53('0x63'),'IS\x20NOT\x20NULL',_0xfc53('0x64'),_0xfc53('0x65')],_0xd2fb9a);};var _0x49bb2c=function(_0x585e7f){if(!_0x585e7f||!_0x585e7f[_0xfc53('0x66')][_0xfc53('0x67')]){return'';}for(var _0x14ca34='(',_0x5f3046=0x0;_0x5f3046<_0x585e7f[_0xfc53('0x66')][_0xfc53('0x67')];_0x5f3046+=0x1){_0x5f3046>0x0&&(_0x14ca34+='\x20'+_0x585e7f[_0xfc53('0x68')]+'\x20');_0x14ca34+=_0x585e7f['rules'][_0x5f3046][_0xfc53('0x69')]?_0x49bb2c(_0x585e7f['rules'][_0x5f3046]['group']):_0x585e7f[_0xfc53('0x66')][_0x5f3046][_0xfc53('0x3c')]+'\x20'+_0x585e7f[_0xfc53('0x66')][_0x5f3046][_0xfc53('0x6a')]+(_0x4361d1(_0x585e7f[_0xfc53('0x66')][_0x5f3046][_0xfc53('0x6a')])?'\x20'+_0x585e7f[_0xfc53('0x66')][_0x5f3046]['value']:'');}return _0x14ca34+')';};var _0x458ea8={'where':{'id':_0x4cce42[_0xfc53('0x41')]['id']}},_0x14254b,_0x230473,_0x48bd61,_0x17e397,_0x1c862f;_0x458ea8=_[_0xfc53('0x38')]({},_0x458ea8,_0x4cce42[_0xfc53('0x3d')]);return db[_0xfc53('0x29')][_0xfc53('0x44')](_0x458ea8)[_0xfc53('0x22')](function(_0x1b906b){if(_0x1b906b){_0x14254b=_0x1b906b;return _0x1b906b['getFields']();}return null;})[_0xfc53('0x22')](function(_0x3666fe){if(_0x3666fe){if(!_0x3666fe[_0xfc53('0x67')]){throw new db[(_0xfc53('0x6b'))]['ValidationErrorItem'](_0xfc53('0x6c'),0x193);}_0x230473=_0x3666fe;return db[_0xfc53('0x6d')][_0xfc53('0x6e')]({'raw':!![]});}return null;})[_0xfc53('0x22')](function(_0x356577){if(_0x356577){_0x48bd61=_[_0xfc53('0x6f')](_0x356577,'id');var _0x4417db;var _0x84a139=squel[_0xfc53('0x70')]();_0x84a139[_0xfc53('0x71')](_0x14254b[_0xfc53('0x72')]);for(var _0x106cbf=0x0;_0x106cbf<_0x230473[_0xfc53('0x67')];_0x106cbf+=0x1){_0x4417db=_0x230473[_0x106cbf][_0xfc53('0x73')]?_0x48bd61[_0x230473[_0x106cbf]['MetricId']][_0xfc53('0x74')]:_0x230473[_0x106cbf]['field'];_0x4417db=_0x230473[_0x106cbf][_0xfc53('0x75')]?_[_0xfc53('0x76')](_0x5be695[_0x230473[_0x106cbf][_0xfc53('0x75')]],'%s',_0x4417db):_0x4417db;_0x4417db=_0x230473[_0x106cbf][_0xfc53('0x77')]?_['replace'](_0x7ff5ad[_0x230473[_0x106cbf][_0xfc53('0x77')]],'%s',_0x4417db):_0x4417db;if(_0x230473[_0x106cbf]['groupBy']){_0x84a139[_0xfc53('0x69')](_0x4417db);}_0x230473[_0x106cbf][_0xfc53('0x78')]&&_0x84a139['order'](_0x4417db,_0x230473[_0x106cbf]['orderBy']==='DESC'?![]:!![]);_0x84a139[_0xfc53('0x3c')](_0x4417db,_0x230473[_0x106cbf][_0xfc53('0x79')]||_0x4417db);}if(_0x14254b[_0xfc53('0x7a')]){_0x14254b[_0xfc53('0x7a')]=JSON[_0xfc53('0x7b')](_0x14254b[_0xfc53('0x7a')]);for(var _0x544ed6=0x0;_0x544ed6<_0x14254b[_0xfc53('0x7a')][_0xfc53('0x67')];_0x544ed6+=0x1){if(_0x14254b[_0xfc53('0x7a')][_0x544ed6]['type']&&_[_0xfc53('0x62')](_0x920c30,_0x14254b[_0xfc53('0x7a')][_0x544ed6][_0xfc53('0x3a')])&&_0x14254b['joins'][_0x544ed6][_0xfc53('0x7c')]&&_0x14254b['joins'][_0x544ed6][_0xfc53('0x7d')]&&_0x14254b[_0xfc53('0x7a')][_0x544ed6][_0xfc53('0x7e')]){_0x84a139[_0x14254b['joins'][_0x544ed6][_0xfc53('0x3a')]](_0x14254b[_0xfc53('0x7a')][_0x544ed6][_0xfc53('0x7d')],null,util['format'](_0xfc53('0x7f'),_0x14254b[_0xfc53('0x72')],_0x14254b[_0xfc53('0x7a')][_0x544ed6][_0xfc53('0x7c')],_0x14254b[_0xfc53('0x7a')][_0x544ed6][_0xfc53('0x7d')],_0x14254b[_0xfc53('0x7a')][_0x544ed6][_0xfc53('0x7e')]));}}}if(_0x14254b['conditions']){_0x14254b[_0xfc53('0x80')]=JSON['parse'](_0x14254b[_0xfc53('0x80')]);_0x84a139[_0xfc53('0x35')](_0x49bb2c(_0x14254b[_0xfc53('0x80')][_0xfc53('0x69')]));}_0x1c862f=_0x84a139[_0xfc53('0x81')]();_0x84a139[_0xfc53('0x1b')](_0x52ada5);_0x84a139[_0xfc53('0x1a')](0x0);logger[_0xfc53('0x82')](_0xfc53('0x83'),_0x84a139['toString']());return db[_0xfc53('0x84')][_0xfc53('0x2c')](_0x84a139['toString'](),{'type':db[_0xfc53('0x84')][_0xfc53('0x85')][_0xfc53('0x86')]});}})[_0xfc53('0x22')](respondWithResult(_0x26fdf7,null))[_0xfc53('0x3f')](handleError(_0x26fdf7,null));};function runReport(_0x1fdb17,_0x2b0c37,_0x2f4ba2){var _0x26be07=_0x2b0c37[_0xfc53('0x4e')];var _0x4a10a9=0xa;var _0x47227f=[_0xfc53('0x52'),_0xfc53('0x53'),'right_join','cross_join'];var _0x1a9a2e={'SUM':_0xfc53('0x87'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xfc53('0x57'),'MAX':_0xfc53('0x58'),'MIN':_0xfc53('0x59'),'AVG':_0xfc53('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xfc53('0x5c'),'GROUP_CONCAT DESC':_0xfc53('0x88')};var _0x1ec694={'SEC_TO_TIME':_0xfc53('0x5d'),'DATE':'DATE(%s)','HOUR':_0xfc53('0x5f'),'ROUND':_0xfc53('0x60'),'UNIX_TIMESTAMP':_0xfc53('0x61')};var _0x5e3539=function(_0x2548b6){return!_['includes'](['IS\x20NULL',_0xfc53('0x89'),'IS\x20EMPTY',_0xfc53('0x65')],_0x2548b6);};var _0x47f8e8=function(_0xc15e20){if(!_0xc15e20||!_0xc15e20['rules'][_0xfc53('0x67')]){return'';}for(var _0x25c9ef='(',_0x34ab5a=0x0;_0x34ab5a<_0xc15e20[_0xfc53('0x66')]['length'];_0x34ab5a+=0x1){_0x34ab5a>0x0&&(_0x25c9ef+='\x20'+_0xc15e20[_0xfc53('0x68')]+'\x20');_0x25c9ef+=_0xc15e20[_0xfc53('0x66')][_0x34ab5a][_0xfc53('0x69')]?_0x47f8e8(_0xc15e20[_0xfc53('0x66')][_0x34ab5a][_0xfc53('0x69')]):_0xc15e20[_0xfc53('0x66')][_0x34ab5a][_0xfc53('0x3c')]+'\x20'+_0xc15e20[_0xfc53('0x66')][_0x34ab5a][_0xfc53('0x6a')]+(_0x5e3539(_0xc15e20[_0xfc53('0x66')][_0x34ab5a][_0xfc53('0x6a')])?'\x20'+_0xc15e20['rules'][_0x34ab5a][_0xfc53('0x8a')]:'');}return _0x25c9ef+')';};var _0x2d31a6={'where':{'id':_0x1fdb17['id']}},_0x53ca40,_0x145916,_0x170968,_0x466c86,_0x3ad6c0;_0x2d31a6=_['merge']({},_0x2d31a6,_0x2f4ba2);return db['AnalyticDefaultReport'][_0xfc53('0x44')](_0x2d31a6)[_0xfc53('0x22')](function(_0x4ab508){if(_0x4ab508){_0x53ca40=_0x4ab508;return _0x4ab508[_0xfc53('0x8b')]();}return null;})[_0xfc53('0x22')](function(_0x291d7e){if(_0x291d7e){if(!_0x291d7e[_0xfc53('0x67')]){throw new db[(_0xfc53('0x6b'))][(_0xfc53('0x8c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x145916=_0x291d7e;return db['AnalyticMetric'][_0xfc53('0x6e')]({'raw':!![]});}return null;})[_0xfc53('0x22')](function(_0x330936){if(_0x330936){_0x170968=_['keyBy'](_0x330936,'id');var _0x1bfada;var _0xc050de=squel[_0xfc53('0x70')]();_0xc050de['from'](_0x53ca40[_0xfc53('0x72')]);for(var _0x930915=0x0;_0x930915<_0x145916[_0xfc53('0x67')];_0x930915+=0x1){_0x1bfada=_0x145916[_0x930915][_0xfc53('0x73')]?_0x170968[_0x145916[_0x930915][_0xfc53('0x73')]]['metric']:_0x145916[_0x930915][_0xfc53('0x3c')];_0x1bfada=_0x145916[_0x930915][_0xfc53('0x75')]?_[_0xfc53('0x76')](_0x1a9a2e[_0x145916[_0x930915]['function']],'%s',_0x1bfada):_0x1bfada;_0x1bfada=_0x145916[_0x930915][_0xfc53('0x77')]?_[_0xfc53('0x76')](_0x1ec694[_0x145916[_0x930915]['format']],'%s',_0x1bfada):_0x1bfada;if(_0x145916[_0x930915][_0xfc53('0x8d')]){_0xc050de[_0xfc53('0x69')](_0x1bfada);}_0x145916[_0x930915][_0xfc53('0x78')]&&_0xc050de[_0xfc53('0x33')](_0x1bfada,_0x145916[_0x930915]['orderBy']===_0xfc53('0x8e')?![]:!![]);_0xc050de['field'](_0x1bfada,_0x145916[_0x930915][_0xfc53('0x79')]||_0x1bfada);}if(_0x53ca40[_0xfc53('0x7a')]){_0x53ca40[_0xfc53('0x7a')]=JSON[_0xfc53('0x7b')](_0x53ca40['joins']);for(var _0xc93f33=0x0;_0xc93f33<_0x53ca40[_0xfc53('0x7a')][_0xfc53('0x67')];_0xc93f33+=0x1){if(_0x53ca40[_0xfc53('0x7a')][_0xc93f33]['type']&&_['includes'](_0x47227f,_0x53ca40[_0xfc53('0x7a')][_0xc93f33][_0xfc53('0x3a')])&&_0x53ca40['joins'][_0xc93f33]['parentKey']&&_0x53ca40[_0xfc53('0x7a')][_0xc93f33][_0xfc53('0x7d')]&&_0x53ca40['joins'][_0xc93f33]['foreignKey']){_0xc050de[_0x53ca40[_0xfc53('0x7a')][_0xc93f33][_0xfc53('0x3a')]](_0x53ca40[_0xfc53('0x7a')][_0xc93f33][_0xfc53('0x7d')],null,util[_0xfc53('0x77')](_0xfc53('0x7f'),_0x53ca40[_0xfc53('0x72')],_0x53ca40[_0xfc53('0x7a')][_0xc93f33][_0xfc53('0x7c')],_0x53ca40[_0xfc53('0x7a')][_0xc93f33]['foreignTable'],_0x53ca40[_0xfc53('0x7a')][_0xc93f33]['foreignKey']));}}}if(_0x53ca40['conditions']){_0x53ca40[_0xfc53('0x80')]=JSON[_0xfc53('0x7b')](_0x53ca40[_0xfc53('0x80')]);_0xc050de[_0xfc53('0x35')](_0x47f8e8(_0x53ca40[_0xfc53('0x80')]['group']));}_0x3ad6c0=_0xc050de[_0xfc53('0x81')]();_0xc050de[_0xfc53('0x1b')](_0x4a10a9);_0xc050de[_0xfc53('0x1a')](0x0);logger[_0xfc53('0x82')](_0xfc53('0x83'),_0xc050de[_0xfc53('0x8f')]());return db[_0xfc53('0x84')][_0xfc53('0x2c')](_0xc050de[_0xfc53('0x8f')](),{'type':db[_0xfc53('0x84')][_0xfc53('0x85')][_0xfc53('0x86')]});}})[_0xfc53('0x22')](function(_0xa657d6){if(!_0xa657d6[_0xfc53('0x67')]){throw new db[(_0xfc53('0x6b'))][(_0xfc53('0x8c'))](_0xfc53('0x90'),0xcc);}if(_0x2b0c37['output']==='web'){return null;}var _0x59c0c7=_[_0xfc53('0x38')](_0x2b0c37,{'name':_0x2b0c37[_0xfc53('0x91')]||_0x2b0c37[_0xfc53('0x4e')]||_0x53ca40[_0xfc53('0x4e')],'basename':_0x26be07,'savename':util[_0xfc53('0x77')](_0xfc53('0x92'),_0x2b0c37['name']||_0x53ca40[_0xfc53('0x4e')],require('randomstring')[_0xfc53('0x93')](0x4),_0x2b0c37[_0xfc53('0x94')]||_0xfc53('0x95')),'reportId':_0x53ca40['id'],'reportType':'default'});return db[_0xfc53('0x96')][_0xfc53('0x45')](_0x59c0c7,{'raw':!![]});})[_0xfc53('0x22')](function(_0x3420c1){if(_0x53ca40[_0xfc53('0x72')]===_0xfc53('0x97')){_0x3ad6c0[_0xfc53('0x35')](_0x53ca40[_0xfc53('0x72')]+_0xfc53('0x98'),_0x2b0c37[_0xfc53('0x99')],_0x2b0c37[_0xfc53('0x9a')]);}else{_0x3ad6c0['where'](_0x53ca40[_0xfc53('0x72')]+_0xfc53('0x9b'),_0x2b0c37[_0xfc53('0x99')],_0x2b0c37[_0xfc53('0x9a')]);}if(_0x3420c1){logger['info'](_0xfc53('0x9c'),_0x3ad6c0[_0xfc53('0x8f')]());require(_0xfc53('0x9d'))[_0xfc53('0x9e')](path[_0xfc53('0x52')](__dirname,_0xfc53('0x9f'),_0x3420c1['output']),[_0x3420c1['id'],_0x3ad6c0[_0xfc53('0x8f')](),path[_0xfc53('0x52')](__dirname,_0xfc53('0xa0'),_0x3420c1[_0xfc53('0xa1')]),_0x26be07]);return _0x3420c1;}else{var _0xff440=squel['select']();_0xff440[_0xfc53('0x71')]('('+_0x3ad6c0[_0xfc53('0x8f')]()+')',_0xfc53('0xa2'));_0xff440[_0xfc53('0x3c')](_0xfc53('0xa3'),_0xfc53('0x19'));_0x3ad6c0['limit'](_0x2b0c37['limit']||_0x4a10a9);_0x3ad6c0[_0xfc53('0x1a')](_0x2b0c37['offset']||0x0);return db[_0xfc53('0x84')][_0xfc53('0x2c')](_0xff440['toString'](),{'type':db['sequelize'][_0xfc53('0x85')][_0xfc53('0x86')]})['then'](function(_0x40c3b4){if(!_0x40c3b4[_0xfc53('0x67')]){_0x466c86=0x0;}else{_0x466c86=_0x40c3b4[0x0][_0xfc53('0x19')]||0x0;}return db[_0xfc53('0x84')][_0xfc53('0x2c')](_0x3ad6c0[_0xfc53('0x8f')](),{'type':db[_0xfc53('0x84')][_0xfc53('0x85')][_0xfc53('0x86')]});})[_0xfc53('0x22')](function(_0x4c34d9){return{'rows':_0x4c34d9||[],'count':_0x466c86};});}});}exports[_0xfc53('0xa4')]=function(_0x5cab16,_0x395d0d){return runReport(_0x5cab16[_0xfc53('0x41')],_0x5cab16[_0xfc53('0x2c')],_0x5cab16[_0xfc53('0x3d')])[_0xfc53('0x22')](respondWithResult(_0x395d0d,null))[_0xfc53('0x3f')](handleError(_0x395d0d,null));};exports[_0xfc53('0xa5')]=runReport;exports[_0xfc53('0x2c')]=function(_0x23d772,_0x43741c){var _0x4c2db9=0xa;var _0x2f89f4=[_0xfc53('0x52'),_0xfc53('0x53'),_0xfc53('0x54'),_0xfc53('0x55')];var _0x4a6102={'SUM':_0xfc53('0x87'),'COUNT':_0xfc53('0x56'),'COUNT DISTINCT':_0xfc53('0x57'),'MAX':_0xfc53('0x58'),'MIN':_0xfc53('0x59'),'AVG':_0xfc53('0x5a'),'GROUP_CONCAT':_0xfc53('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4ea58c={'SEC_TO_TIME':_0xfc53('0x5d'),'DATE':_0xfc53('0x5e'),'HOUR':_0xfc53('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xfc53('0x61')};var _0x2a8435=function(_0x19a040){return!_[_0xfc53('0x62')]([_0xfc53('0x63'),'IS\x20NOT\x20NULL',_0xfc53('0x64'),'IS\x20NOT\x20EMPTY'],_0x19a040);};var _0x543f6d=function(_0x3242de){if(!_0x3242de||!_0x3242de['rules'][_0xfc53('0x67')]){return'';}for(var _0x1114c1='(',_0x4cde97=0x0;_0x4cde97<_0x3242de[_0xfc53('0x66')]['length'];_0x4cde97+=0x1){_0x4cde97>0x0&&(_0x1114c1+='\x20'+_0x3242de[_0xfc53('0x68')]+'\x20');_0x1114c1+=_0x3242de[_0xfc53('0x66')][_0x4cde97][_0xfc53('0x69')]?_0x543f6d(_0x3242de[_0xfc53('0x66')][_0x4cde97][_0xfc53('0x69')]):_0x3242de[_0xfc53('0x66')][_0x4cde97]['field']+'\x20'+_0x3242de[_0xfc53('0x66')][_0x4cde97][_0xfc53('0x6a')]+(_0x2a8435(_0x3242de[_0xfc53('0x66')][_0x4cde97][_0xfc53('0x6a')])?'\x20'+_0x3242de['rules'][_0x4cde97][_0xfc53('0x8a')]:'');}return _0x1114c1+')';};var _0xa6d49={'where':{'id':_0x23d772[_0xfc53('0x41')]['id']}},_0x114351,_0x4e70a3,_0x226a87,_0x33d9d9,_0x3cd0f5;_0xa6d49=_[_0xfc53('0x38')]({},_0xa6d49,_0x23d772['options']);return db['AnalyticDefaultReport'][_0xfc53('0x44')](_0xa6d49)[_0xfc53('0x22')](function(_0x5d1bc5){if(_0x5d1bc5){_0x114351=_0x5d1bc5;return _0x5d1bc5['getFields']();}return null;})[_0xfc53('0x22')](function(_0x293883){if(_0x293883){if(!_0x293883[_0xfc53('0x67')]){throw new db[(_0xfc53('0x6b'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4e70a3=_0x293883;return db['AnalyticMetric'][_0xfc53('0x6e')]({'raw':!![]});}return null;})[_0xfc53('0x22')](function(_0x4ac182){if(_0x4ac182){_0x226a87=_[_0xfc53('0x6f')](_0x4ac182,'id');var _0xcecd5e;var _0x22e216=squel[_0xfc53('0x70')]();_0x22e216['from'](_0x114351[_0xfc53('0x72')]);for(var _0x3a6e19=0x0;_0x3a6e19<_0x4e70a3['length'];_0x3a6e19+=0x1){_0xcecd5e=_0x4e70a3[_0x3a6e19][_0xfc53('0x73')]?_0x226a87[_0x4e70a3[_0x3a6e19]['MetricId']][_0xfc53('0x74')]:_0x4e70a3[_0x3a6e19]['field'];_0xcecd5e=_0x4e70a3[_0x3a6e19][_0xfc53('0x75')]?_[_0xfc53('0x76')](_0x4a6102[_0x4e70a3[_0x3a6e19][_0xfc53('0x75')]],'%s',_0xcecd5e):_0xcecd5e;_0xcecd5e=_0x4e70a3[_0x3a6e19][_0xfc53('0x77')]?_[_0xfc53('0x76')](_0x4ea58c[_0x4e70a3[_0x3a6e19][_0xfc53('0x77')]],'%s',_0xcecd5e):_0xcecd5e;if(_0x4e70a3[_0x3a6e19][_0xfc53('0x8d')]){_0x22e216['group'](_0xcecd5e);}_0x4e70a3[_0x3a6e19][_0xfc53('0x78')]&&_0x22e216['order'](_0xcecd5e,_0x4e70a3[_0x3a6e19][_0xfc53('0x78')]===_0xfc53('0x8e')?![]:!![]);_0x22e216['field'](_0xcecd5e,_0x4e70a3[_0x3a6e19][_0xfc53('0x79')]||_0xcecd5e);}if(_0x114351['joins']){_0x114351['joins']=JSON[_0xfc53('0x7b')](_0x114351[_0xfc53('0x7a')]);for(var _0x51996a=0x0;_0x51996a<_0x114351[_0xfc53('0x7a')]['length'];_0x51996a+=0x1){if(_0x114351[_0xfc53('0x7a')][_0x51996a][_0xfc53('0x3a')]&&_[_0xfc53('0x62')](_0x2f89f4,_0x114351['joins'][_0x51996a]['type'])&&_0x114351[_0xfc53('0x7a')][_0x51996a][_0xfc53('0x7c')]&&_0x114351[_0xfc53('0x7a')][_0x51996a][_0xfc53('0x7d')]&&_0x114351[_0xfc53('0x7a')][_0x51996a][_0xfc53('0x7e')]){_0x22e216[_0x114351[_0xfc53('0x7a')][_0x51996a][_0xfc53('0x3a')]](_0x114351[_0xfc53('0x7a')][_0x51996a][_0xfc53('0x7d')],null,util[_0xfc53('0x77')](_0xfc53('0x7f'),_0x114351[_0xfc53('0x72')],_0x114351[_0xfc53('0x7a')][_0x51996a][_0xfc53('0x7c')],_0x114351[_0xfc53('0x7a')][_0x51996a][_0xfc53('0x7d')],_0x114351[_0xfc53('0x7a')][_0x51996a]['foreignKey']));}}}if(_0x114351[_0xfc53('0x80')]){_0x114351[_0xfc53('0x80')]=JSON[_0xfc53('0x7b')](_0x114351['conditions']);_0x22e216[_0xfc53('0x35')](_0x543f6d(_0x114351[_0xfc53('0x80')][_0xfc53('0x69')]));}_0x3cd0f5=_0x22e216[_0xfc53('0x81')]();_0x22e216[_0xfc53('0x1b')](_0x4c2db9);_0x22e216[_0xfc53('0x1a')](0x0);logger[_0xfc53('0x82')]('Limited\x20Query:',_0x22e216['toString']());return db[_0xfc53('0x84')]['query'](_0x22e216['toString'](),{'type':db[_0xfc53('0x84')]['QueryTypes'][_0xfc53('0x86')]});}})['then'](function(){return{'sql':_0x3cd0f5[_0xfc53('0x8f')]()};})[_0xfc53('0x22')](respondWithResult(_0x43741c,null))['catch'](handleError(_0x43741c,null));}; \ No newline at end of file +var _0x52d0=['sequelize','SELECT','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','Sequelize','keyBy','orderBy','QueryTypes','No\x20available\x20data','output','%s-%s.%s','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','groupBy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','DefaultReports','destroy','error','stack','name','send','index','rawAttributes','model','keys','filters','intersection','fields','query','attributes','nolimit','sort','where','pick','filter','map','type','key','VIRTUAL','field','AnalyticDefaultReport','includeAll','findAll','catch','show','params','length','include','merge','options','find','create','body','user','get','role','Reports','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','order','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x52d0,0xc2));var _0x052d=function(_0x38b71f,_0x3d0fc6){_0x38b71f=_0x38b71f-0x0;var _0xde7e35=_0x52d0[_0x38b71f];return _0xde7e35;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x052d('0x0'));var rimraf=require(_0x052d('0x1'));var zipdir=require(_0x052d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x052d('0x3'));var moment=require(_0x052d('0x4'));var BPromise=require(_0x052d('0x5'));var Mustache=require(_0x052d('0x6'));var util=require(_0x052d('0x7'));var path=require('path');var sox=require(_0x052d('0x8'));var csv=require(_0x052d('0x9'));var ejs=require(_0x052d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x052d('0xb'));var crypto=require(_0x052d('0xc'));var jsforce=require(_0x052d('0xd'));var deskjs=require(_0x052d('0xe'));var toCsv=require(_0x052d('0x9'));var querystring=require('querystring');var Papa=require(_0x052d('0xf'));var authService=require(_0x052d('0x10'));var hardwareService=require(_0x052d('0x11'));var Redis=require(_0x052d('0x12'));var qs=require(_0x052d('0x13'));var logger=require(_0x052d('0x14'))(_0x052d('0x15'));var utils=require(_0x052d('0x16'));var config=require(_0x052d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d530e,_0x1a179e){_0x1a179e=_0x1a179e||0xcc;return function(_0x1b6657){if(_0x1b6657){return _0x5d530e[_0x052d('0x18')](_0x1a179e);}return _0x5d530e['status'](_0x1a179e)[_0x052d('0x19')]();};}function respondWithResult(_0x3ff077,_0x1bef52){_0x1bef52=_0x1bef52||0xc8;return function(_0x19e65a){if(_0x19e65a){return _0x3ff077[_0x052d('0x1a')](_0x1bef52)[_0x052d('0x1b')](_0x19e65a);}};}function respondWithFilteredResult(_0x4f5acb,_0x4248dc){return function(_0x3171b9){if(_0x3171b9){var _0x2d80f6=_0x3171b9[_0x052d('0x1c')],_0x560848=_0x4248dc[_0x052d('0x1d')],_0x32390d=_0x4248dc['offset']+_0x4248dc[_0x052d('0x1e')],_0x973a93;if(_0x32390d>=_0x2d80f6){_0x32390d=_0x2d80f6;_0x973a93=0xc8;}else{_0x973a93=0xce;}_0x4f5acb[_0x052d('0x1a')](_0x973a93);return _0x4f5acb[_0x052d('0x1f')](_0x052d('0x20'),_0x560848+'-'+_0x32390d+'/'+_0x2d80f6)[_0x052d('0x1b')](_0x3171b9);}return null;};}function patchUpdates(_0x397ec1){return function(_0x325ef6){try{jsonpatch[_0x052d('0x21')](_0x325ef6,_0x397ec1,!![]);}catch(_0x50e4fe){return BPromise[_0x052d('0x22')](_0x50e4fe);}return _0x325ef6[_0x052d('0x23')]();};}function saveUpdates(_0x3be92f,_0x577caf){return function(_0x148d71){if(_0x148d71){return _0x148d71[_0x052d('0x24')](_0x3be92f)[_0x052d('0x25')](function(_0xd082f0){return _0xd082f0;});}return null;};}function removeEntity(_0x2cbf97,_0x2e5cc2){return function(_0x2042bd){if(_0x2042bd){return _0x2042bd['destroy']()[_0x052d('0x25')](function(){var _0x4407ec=_0x2042bd['get']({'plain':!![]});var _0xa26be2=_0x052d('0x26');return db['UserProfileResource'][_0x052d('0x27')]({'where':{'type':_0xa26be2,'resourceId':_0x4407ec['id']}})[_0x052d('0x25')](function(){return _0x2042bd;});})[_0x052d('0x25')](function(){_0x2cbf97[_0x052d('0x1a')](0xcc)[_0x052d('0x19')]();});}};}function handleEntityNotFound(_0x579da3,_0x3d5db4){return function(_0x5f4221){if(!_0x5f4221){_0x579da3[_0x052d('0x18')](0x194);}return _0x5f4221;};}function handleError(_0x1c618c,_0x4b364d){_0x4b364d=_0x4b364d||0x1f4;return function(_0x3c2e4f){logger[_0x052d('0x28')](_0x3c2e4f[_0x052d('0x29')]);if(_0x3c2e4f[_0x052d('0x2a')]){delete _0x3c2e4f[_0x052d('0x2a')];}_0x1c618c[_0x052d('0x1a')](_0x4b364d)[_0x052d('0x2b')](_0x3c2e4f);};}exports[_0x052d('0x2c')]=function(_0x3d48bb,_0x30dcd5){var _0x312448={},_0x4b4b25={},_0x2a3837={'count':0x0,'rows':[]};var _0x38b099=db['AnalyticDefaultReport'][_0x052d('0x2d')];_0x4b4b25[_0x052d('0x2e')]=_[_0x052d('0x2f')](_0x38b099);_0x4b4b25['query']=_[_0x052d('0x2f')](_0x3d48bb['query']);_0x4b4b25[_0x052d('0x30')]=_['intersection'](_0x4b4b25['model'],_0x4b4b25['query']);_0x312448['attributes']=_[_0x052d('0x31')](_0x4b4b25[_0x052d('0x2e')],qs[_0x052d('0x32')](_0x3d48bb[_0x052d('0x33')]['fields']));_0x312448[_0x052d('0x34')]=_0x312448[_0x052d('0x34')]['length']?_0x312448[_0x052d('0x34')]:_0x4b4b25[_0x052d('0x2e')];if(!_0x3d48bb[_0x052d('0x33')]['hasOwnProperty'](_0x052d('0x35'))){_0x312448[_0x052d('0x1e')]=qs[_0x052d('0x1e')](_0x3d48bb['query'][_0x052d('0x1e')]);_0x312448['offset']=qs[_0x052d('0x1d')](_0x3d48bb['query']['offset']);}_0x312448['order']=qs[_0x052d('0x36')](_0x3d48bb[_0x052d('0x33')][_0x052d('0x36')]);_0x312448[_0x052d('0x37')]=qs[_0x052d('0x30')](_[_0x052d('0x38')](_0x3d48bb['query'],_0x4b4b25['filters']));if(_0x3d48bb['query'][_0x052d('0x39')]){_0x312448[_0x052d('0x37')]=_['merge'](_0x312448['where'],{'$or':_[_0x052d('0x3a')](_0x38b099,function(_0x2041b5){if(_0x2041b5[_0x052d('0x3b')][_0x052d('0x3c')]!==_0x052d('0x3d')){var _0x31d6b9={};_0x31d6b9[_0x2041b5[_0x052d('0x3e')]]={'$like':'%'+_0x3d48bb[_0x052d('0x33')][_0x052d('0x39')]+'%'};return _0x31d6b9;}})});}_0x312448=_['merge']({},_0x312448,_0x3d48bb['options']);var _0x3d94c5={'where':_0x312448[_0x052d('0x37')]};return db[_0x052d('0x3f')][_0x052d('0x1c')](_0x3d94c5)[_0x052d('0x25')](function(_0xb1fb8d){_0x2a3837['count']=_0xb1fb8d;if(_0x3d48bb[_0x052d('0x33')][_0x052d('0x40')]){_0x312448['include']=[{'all':!![]}];}return db[_0x052d('0x3f')][_0x052d('0x41')](_0x312448);})['then'](function(_0x530cef){_0x2a3837['rows']=_0x530cef;return _0x2a3837;})['then'](respondWithFilteredResult(_0x30dcd5,_0x312448))[_0x052d('0x42')](handleError(_0x30dcd5,null));};exports[_0x052d('0x43')]=function(_0x5872ff,_0x461d36){var _0x30f458={'raw':!![],'where':{'id':_0x5872ff[_0x052d('0x44')]['id']}},_0x289ba6={};_0x289ba6[_0x052d('0x2e')]=_[_0x052d('0x2f')](db[_0x052d('0x3f')][_0x052d('0x2d')]);_0x289ba6['query']=_[_0x052d('0x2f')](_0x5872ff['query']);_0x289ba6[_0x052d('0x30')]=_['intersection'](_0x289ba6[_0x052d('0x2e')],_0x289ba6[_0x052d('0x33')]);_0x30f458[_0x052d('0x34')]=_['intersection'](_0x289ba6[_0x052d('0x2e')],qs[_0x052d('0x32')](_0x5872ff['query'][_0x052d('0x32')]));_0x30f458[_0x052d('0x34')]=_0x30f458[_0x052d('0x34')][_0x052d('0x45')]?_0x30f458[_0x052d('0x34')]:_0x289ba6[_0x052d('0x2e')];if(_0x5872ff[_0x052d('0x33')][_0x052d('0x40')]){_0x30f458[_0x052d('0x46')]=[{'all':!![]}];}_0x30f458=_[_0x052d('0x47')]({},_0x30f458,_0x5872ff[_0x052d('0x48')]);return db[_0x052d('0x3f')][_0x052d('0x49')](_0x30f458)[_0x052d('0x25')](handleEntityNotFound(_0x461d36,null))[_0x052d('0x25')](respondWithResult(_0x461d36,null))[_0x052d('0x42')](handleError(_0x461d36,null));};exports[_0x052d('0x4a')]=function(_0xec1043,_0x122794){return db['AnalyticDefaultReport'][_0x052d('0x4a')](_0xec1043[_0x052d('0x4b')],{})[_0x052d('0x25')](function(_0x5cdd29){var _0x5d9f5a=_0xec1043[_0x052d('0x4c')][_0x052d('0x4d')]({'plain':!![]});if(!_0x5d9f5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d9f5a[_0x052d('0x4e')]===_0x052d('0x4c')){var _0x84de76=_0x5cdd29[_0x052d('0x4d')]({'plain':!![]});var _0x5d5737=_0x052d('0x4f');return db[_0x052d('0x50')][_0x052d('0x49')]({'where':{'name':_0x5d5737,'userProfileId':_0x5d9f5a[_0x052d('0x51')]},'raw':!![]})[_0x052d('0x25')](function(_0x16e64e){if(_0x16e64e&&_0x16e64e['autoAssociation']===0x0){return db[_0x052d('0x52')][_0x052d('0x4a')]({'name':_0x84de76[_0x052d('0x2a')],'resourceId':_0x84de76['id'],'type':_0x052d('0x26'),'sectionId':_0x16e64e['id']},{})[_0x052d('0x25')](function(){return _0x5cdd29;});}else{return _0x5cdd29;}})[_0x052d('0x42')](function(_0x28f244){logger['error'](_0x052d('0x53'),_0x28f244);throw _0x28f244;});}return _0x5cdd29;})['then'](respondWithResult(_0x122794,0xc9))[_0x052d('0x42')](handleError(_0x122794,null));};exports['update']=function(_0x12bae3,_0x523ae6){if(_0x12bae3[_0x052d('0x4b')]['id']){delete _0x12bae3[_0x052d('0x4b')]['id'];}return db[_0x052d('0x3f')][_0x052d('0x49')]({'where':{'id':_0x12bae3[_0x052d('0x44')]['id']}})['then'](handleEntityNotFound(_0x523ae6,null))[_0x052d('0x25')](saveUpdates(_0x12bae3[_0x052d('0x4b')],null))[_0x052d('0x25')](respondWithResult(_0x523ae6,null))[_0x052d('0x42')](handleError(_0x523ae6,null));};exports[_0x052d('0x27')]=function(_0x5d7826,_0x5141d4){return db['AnalyticDefaultReport'][_0x052d('0x49')]({'where':{'id':_0x5d7826[_0x052d('0x44')]['id']}})[_0x052d('0x25')](handleEntityNotFound(_0x5141d4,null))['then'](removeEntity(_0x5141d4,null))[_0x052d('0x42')](handleError(_0x5141d4,null));};exports['preview']=function(_0x108228,_0x45c661){var _0x49bb10=0xa;var _0x264524=[_0x052d('0x54'),_0x052d('0x55'),_0x052d('0x56'),_0x052d('0x57')];var _0x8b578d={'SUM':_0x052d('0x58'),'COUNT':_0x052d('0x59'),'COUNT DISTINCT':_0x052d('0x5a'),'MAX':_0x052d('0x5b'),'MIN':_0x052d('0x5c'),'AVG':_0x052d('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x052d('0x5e'),'GROUP_CONCAT DESC':_0x052d('0x5f')};var _0x192211={'SEC_TO_TIME':_0x052d('0x60'),'DATE':_0x052d('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x442772=function(_0x6ca390){return!_['includes']([_0x052d('0x62'),_0x052d('0x63'),_0x052d('0x64'),_0x052d('0x65')],_0x6ca390);};var _0x5eae46=function(_0x257587){if(!_0x257587||!_0x257587[_0x052d('0x66')][_0x052d('0x45')]){return'';}for(var _0x241c17='(',_0x4b2ba1=0x0;_0x4b2ba1<_0x257587['rules'][_0x052d('0x45')];_0x4b2ba1+=0x1){_0x4b2ba1>0x0&&(_0x241c17+='\x20'+_0x257587[_0x052d('0x67')]+'\x20');_0x241c17+=_0x257587[_0x052d('0x66')][_0x4b2ba1][_0x052d('0x68')]?_0x5eae46(_0x257587[_0x052d('0x66')][_0x4b2ba1][_0x052d('0x68')]):_0x257587[_0x052d('0x66')][_0x4b2ba1]['field']+'\x20'+_0x257587[_0x052d('0x66')][_0x4b2ba1][_0x052d('0x69')]+(_0x442772(_0x257587[_0x052d('0x66')][_0x4b2ba1][_0x052d('0x69')])?'\x20'+_0x257587[_0x052d('0x66')][_0x4b2ba1][_0x052d('0x6a')]:'');}return _0x241c17+')';};var _0x25d914={'where':{'id':_0x108228['params']['id']}},_0x320fcd,_0x86ded9,_0x44d271,_0x5e3a4a,_0x15c6f6;_0x25d914=_[_0x052d('0x47')]({},_0x25d914,_0x108228[_0x052d('0x48')]);return db[_0x052d('0x3f')][_0x052d('0x49')](_0x25d914)['then'](function(_0x24ce41){if(_0x24ce41){_0x320fcd=_0x24ce41;return _0x24ce41[_0x052d('0x6b')]();}return null;})[_0x052d('0x25')](function(_0xd98e04){if(_0xd98e04){if(!_0xd98e04[_0x052d('0x45')]){throw new db['Sequelize'][(_0x052d('0x6c'))](_0x052d('0x6d'),0x193);}_0x86ded9=_0xd98e04;return db[_0x052d('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x052d('0x25')](function(_0x3fb95d){if(_0x3fb95d){_0x44d271=_['keyBy'](_0x3fb95d,'id');var _0x5ccef8;var _0x1dd58f=squel[_0x052d('0x6f')]();_0x1dd58f[_0x052d('0x70')](_0x320fcd[_0x052d('0x71')]);for(var _0x10c6e7=0x0;_0x10c6e7<_0x86ded9[_0x052d('0x45')];_0x10c6e7+=0x1){_0x5ccef8=_0x86ded9[_0x10c6e7][_0x052d('0x72')]?_0x44d271[_0x86ded9[_0x10c6e7][_0x052d('0x72')]][_0x052d('0x73')]:_0x86ded9[_0x10c6e7][_0x052d('0x3e')];_0x5ccef8=_0x86ded9[_0x10c6e7][_0x052d('0x74')]?_[_0x052d('0x75')](_0x8b578d[_0x86ded9[_0x10c6e7]['function']],'%s',_0x5ccef8):_0x5ccef8;_0x5ccef8=_0x86ded9[_0x10c6e7][_0x052d('0x76')]?_[_0x052d('0x75')](_0x192211[_0x86ded9[_0x10c6e7]['format']],'%s',_0x5ccef8):_0x5ccef8;if(_0x86ded9[_0x10c6e7]['groupBy']){_0x1dd58f[_0x052d('0x68')](_0x5ccef8);}_0x86ded9[_0x10c6e7]['orderBy']&&_0x1dd58f[_0x052d('0x77')](_0x5ccef8,_0x86ded9[_0x10c6e7]['orderBy']===_0x052d('0x78')?![]:!![]);_0x1dd58f[_0x052d('0x3e')](_0x5ccef8,_0x86ded9[_0x10c6e7][_0x052d('0x79')]||_0x5ccef8);}if(_0x320fcd['joins']){_0x320fcd[_0x052d('0x7a')]=JSON[_0x052d('0x7b')](_0x320fcd['joins']);for(var _0xd4fafc=0x0;_0xd4fafc<_0x320fcd[_0x052d('0x7a')][_0x052d('0x45')];_0xd4fafc+=0x1){if(_0x320fcd[_0x052d('0x7a')][_0xd4fafc][_0x052d('0x3b')]&&_[_0x052d('0x7c')](_0x264524,_0x320fcd[_0x052d('0x7a')][_0xd4fafc][_0x052d('0x3b')])&&_0x320fcd['joins'][_0xd4fafc][_0x052d('0x7d')]&&_0x320fcd[_0x052d('0x7a')][_0xd4fafc][_0x052d('0x7e')]&&_0x320fcd[_0x052d('0x7a')][_0xd4fafc][_0x052d('0x7f')]){_0x1dd58f[_0x320fcd[_0x052d('0x7a')][_0xd4fafc][_0x052d('0x3b')]](_0x320fcd[_0x052d('0x7a')][_0xd4fafc][_0x052d('0x7e')],null,util[_0x052d('0x76')](_0x052d('0x80'),_0x320fcd[_0x052d('0x71')],_0x320fcd[_0x052d('0x7a')][_0xd4fafc][_0x052d('0x7d')],_0x320fcd[_0x052d('0x7a')][_0xd4fafc][_0x052d('0x7e')],_0x320fcd[_0x052d('0x7a')][_0xd4fafc][_0x052d('0x7f')]));}}}if(_0x320fcd['conditions']){_0x320fcd[_0x052d('0x81')]=JSON['parse'](_0x320fcd[_0x052d('0x81')]);_0x1dd58f[_0x052d('0x37')](_0x5eae46(_0x320fcd['conditions']['group']));}_0x15c6f6=_0x1dd58f[_0x052d('0x82')]();_0x1dd58f[_0x052d('0x1e')](_0x49bb10);_0x1dd58f[_0x052d('0x1d')](0x0);logger[_0x052d('0x83')](_0x052d('0x84'),_0x1dd58f[_0x052d('0x85')]());return db[_0x052d('0x86')][_0x052d('0x33')](_0x1dd58f[_0x052d('0x85')](),{'type':db['sequelize']['QueryTypes'][_0x052d('0x87')]});}})['then'](respondWithResult(_0x45c661,null))[_0x052d('0x42')](handleError(_0x45c661,null));};function runReport(_0x1dce81,_0x2263f6,_0x4dd30c){var _0x172d0f=_0x2263f6[_0x052d('0x2a')];var _0x27ad5f=0xa;var _0x305471=[_0x052d('0x54'),_0x052d('0x55'),_0x052d('0x56'),_0x052d('0x57')];var _0x1572de={'SUM':_0x052d('0x58'),'COUNT':_0x052d('0x59'),'COUNT DISTINCT':_0x052d('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x052d('0x5d'),'GROUP_CONCAT':_0x052d('0x88'),'GROUP_CONCAT ASC':_0x052d('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x46c080={'SEC_TO_TIME':_0x052d('0x60'),'DATE':_0x052d('0x61'),'HOUR':_0x052d('0x89'),'ROUND':_0x052d('0x8a'),'UNIX_TIMESTAMP':_0x052d('0x8b')};var _0x15129f=function(_0x493a9f){return!_[_0x052d('0x7c')]([_0x052d('0x62'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x052d('0x65')],_0x493a9f);};var _0x41c8f8=function(_0x4864a3){if(!_0x4864a3||!_0x4864a3[_0x052d('0x66')]['length']){return'';}for(var _0x8a868b='(',_0x16760c=0x0;_0x16760c<_0x4864a3['rules']['length'];_0x16760c+=0x1){_0x16760c>0x0&&(_0x8a868b+='\x20'+_0x4864a3[_0x052d('0x67')]+'\x20');_0x8a868b+=_0x4864a3['rules'][_0x16760c][_0x052d('0x68')]?_0x41c8f8(_0x4864a3[_0x052d('0x66')][_0x16760c][_0x052d('0x68')]):_0x4864a3[_0x052d('0x66')][_0x16760c][_0x052d('0x3e')]+'\x20'+_0x4864a3[_0x052d('0x66')][_0x16760c][_0x052d('0x69')]+(_0x15129f(_0x4864a3[_0x052d('0x66')][_0x16760c]['condition'])?'\x20'+_0x4864a3[_0x052d('0x66')][_0x16760c][_0x052d('0x6a')]:'');}return _0x8a868b+')';};var _0x553478={'where':{'id':_0x1dce81['id']}},_0x4b4044,_0x56103c,_0x5ee571,_0x135b85,_0x33d826;_0x553478=_[_0x052d('0x47')]({},_0x553478,_0x4dd30c);return db['AnalyticDefaultReport'][_0x052d('0x49')](_0x553478)['then'](function(_0x359443){if(_0x359443){_0x4b4044=_0x359443;return _0x359443['getFields']();}return null;})['then'](function(_0x2485e5){if(_0x2485e5){if(!_0x2485e5[_0x052d('0x45')]){throw new db[(_0x052d('0x8c'))][(_0x052d('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x56103c=_0x2485e5;return db[_0x052d('0x6e')][_0x052d('0x41')]({'raw':!![]});}return null;})[_0x052d('0x25')](function(_0x5ece82){if(_0x5ece82){_0x5ee571=_[_0x052d('0x8d')](_0x5ece82,'id');var _0x34bad7;var _0x2c311b=squel[_0x052d('0x6f')]();_0x2c311b['from'](_0x4b4044[_0x052d('0x71')]);for(var _0x1cb444=0x0;_0x1cb444<_0x56103c[_0x052d('0x45')];_0x1cb444+=0x1){_0x34bad7=_0x56103c[_0x1cb444][_0x052d('0x72')]?_0x5ee571[_0x56103c[_0x1cb444][_0x052d('0x72')]][_0x052d('0x73')]:_0x56103c[_0x1cb444][_0x052d('0x3e')];_0x34bad7=_0x56103c[_0x1cb444]['function']?_[_0x052d('0x75')](_0x1572de[_0x56103c[_0x1cb444][_0x052d('0x74')]],'%s',_0x34bad7):_0x34bad7;_0x34bad7=_0x56103c[_0x1cb444]['format']?_[_0x052d('0x75')](_0x46c080[_0x56103c[_0x1cb444]['format']],'%s',_0x34bad7):_0x34bad7;if(_0x56103c[_0x1cb444]['groupBy']){_0x2c311b[_0x052d('0x68')](_0x34bad7);}_0x56103c[_0x1cb444]['orderBy']&&_0x2c311b[_0x052d('0x77')](_0x34bad7,_0x56103c[_0x1cb444][_0x052d('0x8e')]==='DESC'?![]:!![]);_0x2c311b['field'](_0x34bad7,_0x56103c[_0x1cb444][_0x052d('0x79')]||_0x34bad7);}if(_0x4b4044[_0x052d('0x7a')]){_0x4b4044[_0x052d('0x7a')]=JSON[_0x052d('0x7b')](_0x4b4044['joins']);for(var _0x35a12c=0x0;_0x35a12c<_0x4b4044[_0x052d('0x7a')][_0x052d('0x45')];_0x35a12c+=0x1){if(_0x4b4044[_0x052d('0x7a')][_0x35a12c][_0x052d('0x3b')]&&_['includes'](_0x305471,_0x4b4044[_0x052d('0x7a')][_0x35a12c][_0x052d('0x3b')])&&_0x4b4044[_0x052d('0x7a')][_0x35a12c][_0x052d('0x7d')]&&_0x4b4044[_0x052d('0x7a')][_0x35a12c][_0x052d('0x7e')]&&_0x4b4044[_0x052d('0x7a')][_0x35a12c]['foreignKey']){_0x2c311b[_0x4b4044[_0x052d('0x7a')][_0x35a12c][_0x052d('0x3b')]](_0x4b4044['joins'][_0x35a12c][_0x052d('0x7e')],null,util[_0x052d('0x76')](_0x052d('0x80'),_0x4b4044[_0x052d('0x71')],_0x4b4044[_0x052d('0x7a')][_0x35a12c][_0x052d('0x7d')],_0x4b4044[_0x052d('0x7a')][_0x35a12c][_0x052d('0x7e')],_0x4b4044[_0x052d('0x7a')][_0x35a12c]['foreignKey']));}}}if(_0x4b4044[_0x052d('0x81')]){_0x4b4044['conditions']=JSON['parse'](_0x4b4044[_0x052d('0x81')]);_0x2c311b[_0x052d('0x37')](_0x41c8f8(_0x4b4044[_0x052d('0x81')][_0x052d('0x68')]));}_0x33d826=_0x2c311b['clone']();_0x2c311b[_0x052d('0x1e')](_0x27ad5f);_0x2c311b[_0x052d('0x1d')](0x0);logger['debug']('Limited\x20Query:',_0x2c311b[_0x052d('0x85')]());return db[_0x052d('0x86')][_0x052d('0x33')](_0x2c311b['toString'](),{'type':db[_0x052d('0x86')][_0x052d('0x8f')][_0x052d('0x87')]});}})['then'](function(_0x5b57ce){if(!_0x5b57ce[_0x052d('0x45')]){throw new db['Sequelize'][(_0x052d('0x6c'))](_0x052d('0x90'),0xcc);}if(_0x2263f6[_0x052d('0x91')]==='web'){return null;}var _0x2928c0=_['merge'](_0x2263f6,{'name':_0x2263f6['fullPath']||_0x2263f6['name']||_0x4b4044[_0x052d('0x2a')],'basename':_0x172d0f,'savename':util[_0x052d('0x76')](_0x052d('0x92'),_0x2263f6['name']||_0x4b4044[_0x052d('0x2a')],require('randomstring')[_0x052d('0x93')](0x4),_0x2263f6[_0x052d('0x91')]||'csv'),'reportId':_0x4b4044['id'],'reportType':_0x052d('0x94')});return db['AnalyticExtractedReport'][_0x052d('0x4a')](_0x2928c0,{'raw':!![]});})[_0x052d('0x25')](function(_0x20b72){if(_0x4b4044['table']===_0x052d('0x95')){_0x33d826[_0x052d('0x37')](_0x4b4044[_0x052d('0x71')]+_0x052d('0x96'),_0x2263f6[_0x052d('0x97')],_0x2263f6['endDate']);}else{_0x33d826[_0x052d('0x37')](_0x4b4044['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2263f6[_0x052d('0x97')],_0x2263f6[_0x052d('0x98')]);}if(_0x20b72){logger[_0x052d('0x99')](_0x052d('0x9a'),_0x33d826[_0x052d('0x85')]());require(_0x052d('0x9b'))['fork'](path[_0x052d('0x54')](__dirname,_0x052d('0x9c'),_0x20b72[_0x052d('0x91')]),[_0x20b72['id'],_0x33d826['toString'](),path[_0x052d('0x54')](__dirname,_0x052d('0x9d'),_0x20b72[_0x052d('0x9e')]),_0x172d0f]);return _0x20b72;}else{var _0x4e7114=squel[_0x052d('0x6f')]();_0x4e7114[_0x052d('0x70')]('('+_0x33d826[_0x052d('0x85')]()+')',_0x052d('0x9f'));_0x4e7114[_0x052d('0x3e')](_0x052d('0xa0'),'count');_0x33d826[_0x052d('0x1e')](_0x2263f6[_0x052d('0x1e')]||_0x27ad5f);_0x33d826[_0x052d('0x1d')](_0x2263f6[_0x052d('0x1d')]||0x0);return db[_0x052d('0x86')][_0x052d('0x33')](_0x4e7114['toString'](),{'type':db['sequelize'][_0x052d('0x8f')][_0x052d('0x87')]})[_0x052d('0x25')](function(_0x4dc3e2){if(!_0x4dc3e2[_0x052d('0x45')]){_0x135b85=0x0;}else{_0x135b85=_0x4dc3e2[0x0]['count']||0x0;}return db['sequelize']['query'](_0x33d826['toString'](),{'type':db[_0x052d('0x86')]['QueryTypes'][_0x052d('0x87')]});})[_0x052d('0x25')](function(_0x29fa2b){return{'rows':_0x29fa2b||[],'count':_0x135b85};});}});}exports[_0x052d('0xa1')]=function(_0x3cf910,_0x3cdffc){return runReport(_0x3cf910[_0x052d('0x44')],_0x3cf910[_0x052d('0x33')],_0x3cf910[_0x052d('0x48')])[_0x052d('0x25')](respondWithResult(_0x3cdffc,null))[_0x052d('0x42')](handleError(_0x3cdffc,null));};exports[_0x052d('0xa2')]=runReport;exports['query']=function(_0x313f8e,_0x1be6ed){var _0x515a91=0xa;var _0x56e0aa=['join',_0x052d('0x55'),_0x052d('0x56'),_0x052d('0x57')];var _0x4ef9c3={'SUM':_0x052d('0x58'),'COUNT':_0x052d('0x59'),'COUNT DISTINCT':_0x052d('0x5a'),'MAX':_0x052d('0x5b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x052d('0x88'),'GROUP_CONCAT ASC':_0x052d('0x5e'),'GROUP_CONCAT DESC':_0x052d('0x5f')};var _0x522ddb={'SEC_TO_TIME':_0x052d('0x60'),'DATE':_0x052d('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3005f1=function(_0x3bc277){return!_[_0x052d('0x7c')]([_0x052d('0x62'),_0x052d('0x63'),'IS\x20EMPTY',_0x052d('0x65')],_0x3bc277);};var _0x2ef378=function(_0x26ccb8){if(!_0x26ccb8||!_0x26ccb8[_0x052d('0x66')][_0x052d('0x45')]){return'';}for(var _0x33c0d2='(',_0x43e40b=0x0;_0x43e40b<_0x26ccb8[_0x052d('0x66')][_0x052d('0x45')];_0x43e40b+=0x1){_0x43e40b>0x0&&(_0x33c0d2+='\x20'+_0x26ccb8[_0x052d('0x67')]+'\x20');_0x33c0d2+=_0x26ccb8['rules'][_0x43e40b][_0x052d('0x68')]?_0x2ef378(_0x26ccb8[_0x052d('0x66')][_0x43e40b][_0x052d('0x68')]):_0x26ccb8['rules'][_0x43e40b][_0x052d('0x3e')]+'\x20'+_0x26ccb8[_0x052d('0x66')][_0x43e40b][_0x052d('0x69')]+(_0x3005f1(_0x26ccb8[_0x052d('0x66')][_0x43e40b][_0x052d('0x69')])?'\x20'+_0x26ccb8['rules'][_0x43e40b]['value']:'');}return _0x33c0d2+')';};var _0x228d3f={'where':{'id':_0x313f8e[_0x052d('0x44')]['id']}},_0x60fc85,_0x212602,_0x5f5209,_0x18de97,_0x42c2a1;_0x228d3f=_[_0x052d('0x47')]({},_0x228d3f,_0x313f8e[_0x052d('0x48')]);return db['AnalyticDefaultReport'][_0x052d('0x49')](_0x228d3f)[_0x052d('0x25')](function(_0x3f4963){if(_0x3f4963){_0x60fc85=_0x3f4963;return _0x3f4963[_0x052d('0x6b')]();}return null;})['then'](function(_0xd758a0){if(_0xd758a0){if(!_0xd758a0[_0x052d('0x45')]){throw new db[(_0x052d('0x8c'))][(_0x052d('0x6c'))](_0x052d('0x6d'),0x193);}_0x212602=_0xd758a0;return db[_0x052d('0x6e')][_0x052d('0x41')]({'raw':!![]});}return null;})['then'](function(_0x10a593){if(_0x10a593){_0x5f5209=_[_0x052d('0x8d')](_0x10a593,'id');var _0x7685a5;var _0x97509b=squel[_0x052d('0x6f')]();_0x97509b[_0x052d('0x70')](_0x60fc85['table']);for(var _0x5490fd=0x0;_0x5490fd<_0x212602[_0x052d('0x45')];_0x5490fd+=0x1){_0x7685a5=_0x212602[_0x5490fd][_0x052d('0x72')]?_0x5f5209[_0x212602[_0x5490fd]['MetricId']][_0x052d('0x73')]:_0x212602[_0x5490fd][_0x052d('0x3e')];_0x7685a5=_0x212602[_0x5490fd][_0x052d('0x74')]?_[_0x052d('0x75')](_0x4ef9c3[_0x212602[_0x5490fd]['function']],'%s',_0x7685a5):_0x7685a5;_0x7685a5=_0x212602[_0x5490fd][_0x052d('0x76')]?_[_0x052d('0x75')](_0x522ddb[_0x212602[_0x5490fd]['format']],'%s',_0x7685a5):_0x7685a5;if(_0x212602[_0x5490fd][_0x052d('0xa3')]){_0x97509b[_0x052d('0x68')](_0x7685a5);}_0x212602[_0x5490fd]['orderBy']&&_0x97509b[_0x052d('0x77')](_0x7685a5,_0x212602[_0x5490fd][_0x052d('0x8e')]==='DESC'?![]:!![]);_0x97509b[_0x052d('0x3e')](_0x7685a5,_0x212602[_0x5490fd][_0x052d('0x79')]||_0x7685a5);}if(_0x60fc85['joins']){_0x60fc85[_0x052d('0x7a')]=JSON[_0x052d('0x7b')](_0x60fc85['joins']);for(var _0x4f03e1=0x0;_0x4f03e1<_0x60fc85['joins'][_0x052d('0x45')];_0x4f03e1+=0x1){if(_0x60fc85[_0x052d('0x7a')][_0x4f03e1][_0x052d('0x3b')]&&_['includes'](_0x56e0aa,_0x60fc85[_0x052d('0x7a')][_0x4f03e1][_0x052d('0x3b')])&&_0x60fc85['joins'][_0x4f03e1][_0x052d('0x7d')]&&_0x60fc85[_0x052d('0x7a')][_0x4f03e1][_0x052d('0x7e')]&&_0x60fc85[_0x052d('0x7a')][_0x4f03e1][_0x052d('0x7f')]){_0x97509b[_0x60fc85[_0x052d('0x7a')][_0x4f03e1][_0x052d('0x3b')]](_0x60fc85[_0x052d('0x7a')][_0x4f03e1][_0x052d('0x7e')],null,util[_0x052d('0x76')](_0x052d('0x80'),_0x60fc85[_0x052d('0x71')],_0x60fc85[_0x052d('0x7a')][_0x4f03e1][_0x052d('0x7d')],_0x60fc85['joins'][_0x4f03e1][_0x052d('0x7e')],_0x60fc85[_0x052d('0x7a')][_0x4f03e1]['foreignKey']));}}}if(_0x60fc85[_0x052d('0x81')]){_0x60fc85[_0x052d('0x81')]=JSON['parse'](_0x60fc85['conditions']);_0x97509b[_0x052d('0x37')](_0x2ef378(_0x60fc85[_0x052d('0x81')][_0x052d('0x68')]));}_0x42c2a1=_0x97509b[_0x052d('0x82')]();_0x97509b['limit'](_0x515a91);_0x97509b['offset'](0x0);logger['debug'](_0x052d('0x84'),_0x97509b[_0x052d('0x85')]());return db[_0x052d('0x86')][_0x052d('0x33')](_0x97509b['toString'](),{'type':db[_0x052d('0x86')][_0x052d('0x8f')][_0x052d('0x87')]});}})[_0x052d('0x25')](function(){return{'sql':_0x42c2a1['toString']()};})['then'](respondWithResult(_0x1be6ed,null))['catch'](handleError(_0x1be6ed,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 4b567a7..bd9a95d 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 _0x40d9=['analytics_default_reports','../../config/logger','api','bluebird','exports'];(function(_0x4c251a,_0x47049d){var _0x46fd1d=function(_0x308ecf){while(--_0x308ecf){_0x4c251a['push'](_0x4c251a['shift']());}};_0x46fd1d(++_0x47049d);}(_0x40d9,0x15f));var _0x940d=function(_0x3ed9e8,_0x2ea173){_0x3ed9e8=_0x3ed9e8-0x0;var _0xd41c2c=_0x40d9[_0x3ed9e8];return _0xd41c2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x940d('0x0'))(_0x940d('0x1'));var moment=require('moment');var BPromise=require(_0x940d('0x2'));var rp=require('request-promise');var attributes=require('./analyticDefaultReport.attributes');module[_0x940d('0x3')]=function(_0x280919,_0x1fbee6){return _0x280919['define']('AnalyticDefaultReport',attributes,{'tableName':_0x940d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa814=['analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport'];(function(_0x2d0d97,_0x2d9560){var _0xfb96e9=function(_0x52a340){while(--_0x52a340){_0x2d0d97['push'](_0x2d0d97['shift']());}};_0xfb96e9(++_0x2d9560);}(_0xa814,0x1a3));var _0x4a81=function(_0x20dc74,_0x309f67){_0x20dc74=_0x20dc74-0x0;var _0x31490a=_0xa814[_0x20dc74];return _0x31490a;};'use strict';var _=require(_0x4a81('0x0'));var util=require(_0x4a81('0x1'));var logger=require(_0x4a81('0x2'))(_0x4a81('0x3'));var moment=require(_0x4a81('0x4'));var BPromise=require(_0x4a81('0x5'));var rp=require(_0x4a81('0x6'));var attributes=require(_0x4a81('0x7'));module[_0x4a81('0x8')]=function(_0x18b87a,_0x5cd61b){return _0x18b87a['define'](_0x4a81('0x9'),attributes,{'tableName':_0x4a81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index a91fddf..c601c5d 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 _0xa9e0=['http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\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(_0x36faf9,_0x24951c){var _0x2d17fd=function(_0x257146){while(--_0x257146){_0x36faf9['push'](_0x36faf9['shift']());}};_0x2d17fd(++_0x24951c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 _0xf4eb=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3819d4,_0x37a30e){_0x3819d4=_0x3819d4-0x0;var _0x4cc81d=_0xf4eb[_0x3819d4];return _0x4cc81d;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index dd1adbc..51f0bf2 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 _0xd51f=['post','create','put','update','delete','/:id','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id/preview','preview','/:id/run','run','/:id/query','query'];(function(_0x4d2bca,_0x80f58a){var _0x387bbd=function(_0x38d9d3){while(--_0x38d9d3){_0x4d2bca['push'](_0x4d2bca['shift']());}};_0x387bbd(++_0x80f58a);}(_0xd51f,0x92));var _0xfd51=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd51f[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xfd51('0x0'));var util=require(_0xfd51('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfd51('0x2'));var router=express[_0xfd51('0x3')]();var auth=require(_0xfd51('0x4'));var interaction=require(_0xfd51('0x5'));var config=require(_0xfd51('0x6'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0xfd51('0x7')](),controller['index']);router['get']('/:id',auth[_0xfd51('0x7')](),controller['show']);router[_0xfd51('0x8')](_0xfd51('0x9'),auth[_0xfd51('0x7')](),controller[_0xfd51('0xa')]);router[_0xfd51('0x8')](_0xfd51('0xb'),auth['isAuthenticated'](),controller[_0xfd51('0xc')]);router[_0xfd51('0x8')](_0xfd51('0xd'),auth[_0xfd51('0x7')](),controller[_0xfd51('0xe')]);router[_0xfd51('0xf')]('/',auth['isAuthenticated'](),controller[_0xfd51('0x10')]);router[_0xfd51('0x11')]('/:id',auth[_0xfd51('0x7')](),controller[_0xfd51('0x12')]);router[_0xfd51('0x13')](_0xfd51('0x14'),auth[_0xfd51('0x7')](),controller[_0xfd51('0x15')]);module[_0xfd51('0x16')]=router; \ No newline at end of file +var _0x8f96=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','preview','run','query','post','create','put','update'];(function(_0x1780d4,_0x1406d6){var _0x46dcac=function(_0x151005){while(--_0x151005){_0x1780d4['push'](_0x1780d4['shift']());}};_0x46dcac(++_0x1406d6);}(_0x8f96,0x10b));var _0x68f9=function(_0x326526,_0x2e995b){_0x326526=_0x326526-0x0;var _0x2456c3=_0x8f96[_0x326526];return _0x2456c3;};'use strict';var multer=require(_0x68f9('0x0'));var util=require('util');var path=require(_0x68f9('0x1'));var timeout=require(_0x68f9('0x2'));var express=require(_0x68f9('0x3'));var router=express[_0x68f9('0x4')]();var auth=require(_0x68f9('0x5'));var interaction=require(_0x68f9('0x6'));var config=require(_0x68f9('0x7'));var controller=require(_0x68f9('0x8'));router[_0x68f9('0x9')]('/',auth[_0x68f9('0xa')](),controller[_0x68f9('0xb')]);router[_0x68f9('0x9')](_0x68f9('0xc'),auth[_0x68f9('0xa')](),controller[_0x68f9('0xd')]);router['get']('/:id/preview',auth[_0x68f9('0xa')](),controller[_0x68f9('0xe')]);router[_0x68f9('0x9')]('/:id/run',auth[_0x68f9('0xa')](),controller[_0x68f9('0xf')]);router['get']('/:id/query',auth[_0x68f9('0xa')](),controller[_0x68f9('0x10')]);router[_0x68f9('0x11')]('/',auth[_0x68f9('0xa')](),controller[_0x68f9('0x12')]);router[_0x68f9('0x13')](_0x68f9('0xc'),auth['isAuthenticated'](),controller[_0x68f9('0x14')]);router[_0x68f9('0x15')](_0x68f9('0xc'),auth['isAuthenticated'](),controller[_0x68f9('0x16')]);module[_0x68f9('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 bde2703..5c07edb 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 _0x1541=['UNSIGNED','sequelize','moment','exports','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','INTEGER'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x1541,0x146));var _0x1154=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0x1541[_0x3042c5];return _0x7cd140;};'use strict';var Sequelize=require(_0x1154('0x0'));var moment=require(_0x1154('0x1'));module[_0x1154('0x2')]={'name':{'type':Sequelize[_0x1154('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x1154('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x1154('0x4')]('csv',_0x1154('0x5'),_0x1154('0x6')),'allowNull':![],'defaultValue':_0x1154('0x7')},'savename':{'type':Sequelize[_0x1154('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1154('0x8')]},'endDate':{'type':Sequelize[_0x1154('0x8')]},'status':{'type':Sequelize[_0x1154('0x3')],'defaultValue':_0x1154('0x9')},'type':{'type':Sequelize['ENUM'](_0x1154('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0x1154('0xa')},'reportId':{'type':Sequelize[_0x1154('0xb')](0xb)[_0x1154('0xc')]},'reportType':{'type':Sequelize[_0x1154('0x3')]}}; \ No newline at end of file +var _0xaee2=['DATE','Loading','manual','INTEGER','UNSIGNED','moment','STRING','ENUM','csv','pdf','xlsx'];(function(_0x66ce8f,_0xaf29fc){var _0x128d6c=function(_0xb724e9){while(--_0xb724e9){_0x66ce8f['push'](_0x66ce8f['shift']());}};_0x128d6c(++_0xaf29fc);}(_0xaee2,0xe1));var _0x2aee=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xaee2[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2aee('0x0'));module['exports']={'name':{'type':Sequelize[_0x2aee('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x2aee('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x2aee('0x2')](_0x2aee('0x3'),_0x2aee('0x4'),_0x2aee('0x5')),'allowNull':![],'defaultValue':_0x2aee('0x3')},'savename':{'type':Sequelize[_0x2aee('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x2aee('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x2aee('0x7')},'type':{'type':Sequelize['ENUM'](_0x2aee('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x2aee('0x8')},'reportId':{'type':Sequelize[_0x2aee('0x9')](0xb)[_0x2aee('0xa')]},'reportType':{'type':Sequelize[_0x2aee('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 64f2e26..c23e7d0 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 _0x2f24=['json','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','model','query','keys','filters','intersection','attributes','fields','length','limit','offset','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','count','includeAll','include','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','output','existsSync','join','root','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','toLowerCase','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','Content-Range'];(function(_0x4d3bf9,_0x291c07){var _0xce3c10=function(_0x5c384c){while(--_0x5c384c){_0x4d3bf9['push'](_0x4d3bf9['shift']());}};_0xce3c10(++_0x291c07);}(_0x2f24,0x9a));var _0x42f2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2f24[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x42f2('0x0'));var emlformat=require(_0x42f2('0x1'));var rimraf=require(_0x42f2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x42f2('0x3'));var moment=require(_0x42f2('0x4'));var BPromise=require(_0x42f2('0x5'));var Mustache=require(_0x42f2('0x6'));var util=require(_0x42f2('0x7'));var path=require(_0x42f2('0x8'));var sox=require('sox');var csv=require(_0x42f2('0x9'));var ejs=require(_0x42f2('0xa'));var fs=require('fs');var _=require(_0x42f2('0xb'));var squel=require(_0x42f2('0xc'));var crypto=require(_0x42f2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x42f2('0xe'));var toCsv=require(_0x42f2('0x9'));var querystring=require(_0x42f2('0xf'));var Papa=require(_0x42f2('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x42f2('0x11'));var Redis=require(_0x42f2('0x12'));var qs=require(_0x42f2('0x13'));var logger=require(_0x42f2('0x14'))(_0x42f2('0x15'));var utils=require(_0x42f2('0x16'));var config=require('../../config/environment');var db=require(_0x42f2('0x17'))['db'];function respondWithStatusCode(_0x5c5aaf,_0x5e27a8){_0x5e27a8=_0x5e27a8||0xcc;return function(_0x32b429){if(_0x32b429){return _0x5c5aaf[_0x42f2('0x18')](_0x5e27a8);}return _0x5c5aaf[_0x42f2('0x19')](_0x5e27a8)[_0x42f2('0x1a')]();};}function respondWithResult(_0x1c4823,_0x22c301){_0x22c301=_0x22c301||0xc8;return function(_0x48d406){if(_0x48d406){return _0x1c4823[_0x42f2('0x19')](_0x22c301)['json'](_0x48d406);}};}function respondWithFilteredResult(_0x461c4d,_0x2c1355){return function(_0x28c57d){if(_0x28c57d){var _0x142d13=_0x28c57d['count'],_0x47b1ba=_0x2c1355['offset'],_0x4f3d2f=_0x2c1355['offset']+_0x2c1355['limit'],_0x5d79be;if(_0x4f3d2f>=_0x142d13){_0x4f3d2f=_0x142d13;_0x5d79be=0xc8;}else{_0x5d79be=0xce;}_0x461c4d[_0x42f2('0x19')](_0x5d79be);return _0x461c4d['set'](_0x42f2('0x1b'),_0x47b1ba+'-'+_0x4f3d2f+'/'+_0x142d13)[_0x42f2('0x1c')](_0x28c57d);}return null;};}function patchUpdates(_0x3bae90){return function(_0x4736c7){try{jsonpatch['apply'](_0x4736c7,_0x3bae90,!![]);}catch(_0x4c35a9){return BPromise[_0x42f2('0x1d')](_0x4c35a9);}return _0x4736c7[_0x42f2('0x1e')]();};}function saveUpdates(_0xfb9b7d,_0x48c6ac){return function(_0x52b51a){if(_0x52b51a){return _0x52b51a['update'](_0xfb9b7d)[_0x42f2('0x1f')](function(_0x27bfbc){return _0x27bfbc;});}return null;};}function removeEntity(_0x362a30,_0x15e8a5){return function(_0x4ce2f4){if(_0x4ce2f4){return _0x4ce2f4[_0x42f2('0x20')]()['then'](function(){var _0xae2b53=_0x4ce2f4[_0x42f2('0x21')]({'plain':!![]});var _0x10fd22='ExtractedReports';return db[_0x42f2('0x22')][_0x42f2('0x20')]({'where':{'type':_0x10fd22,'resourceId':_0xae2b53['id']}})[_0x42f2('0x1f')](function(){return _0x4ce2f4;});})['then'](function(){_0x362a30['status'](0xcc)[_0x42f2('0x1a')]();});}};}function handleEntityNotFound(_0x11e793,_0x3e9764){return function(_0x504b1f){if(!_0x504b1f){_0x11e793[_0x42f2('0x18')](0x194);}return _0x504b1f;};}function handleError(_0x2351c8,_0xa51c74){_0xa51c74=_0xa51c74||0x1f4;return function(_0x32dad0){logger[_0x42f2('0x23')](_0x32dad0[_0x42f2('0x24')]);if(_0x32dad0['name']){delete _0x32dad0[_0x42f2('0x25')];}_0x2351c8['status'](_0xa51c74)[_0x42f2('0x26')](_0x32dad0);};}exports[_0x42f2('0x27')]=function(_0x100679,_0x3d7318){var _0x4b3fe4={},_0x5af956={},_0x25f9f6={'count':0x0,'rows':[]};var _0x2600b3=db[_0x42f2('0x28')]['rawAttributes'];_0x5af956[_0x42f2('0x29')]=_['keys'](_0x2600b3);_0x5af956[_0x42f2('0x2a')]=_[_0x42f2('0x2b')](_0x100679[_0x42f2('0x2a')]);_0x5af956[_0x42f2('0x2c')]=_[_0x42f2('0x2d')](_0x5af956['model'],_0x5af956['query']);_0x4b3fe4[_0x42f2('0x2e')]=_[_0x42f2('0x2d')](_0x5af956[_0x42f2('0x29')],qs[_0x42f2('0x2f')](_0x100679[_0x42f2('0x2a')][_0x42f2('0x2f')]));_0x4b3fe4['attributes']=_0x4b3fe4[_0x42f2('0x2e')][_0x42f2('0x30')]?_0x4b3fe4[_0x42f2('0x2e')]:_0x5af956[_0x42f2('0x29')];if(!_0x100679[_0x42f2('0x2a')]['hasOwnProperty']('nolimit')){_0x4b3fe4['limit']=qs[_0x42f2('0x31')](_0x100679[_0x42f2('0x2a')]['limit']);_0x4b3fe4[_0x42f2('0x32')]=qs['offset'](_0x100679[_0x42f2('0x2a')][_0x42f2('0x32')]);}_0x4b3fe4[_0x42f2('0x33')]=qs[_0x42f2('0x34')](_0x100679[_0x42f2('0x2a')][_0x42f2('0x34')]);_0x4b3fe4[_0x42f2('0x35')]=qs[_0x42f2('0x2c')](_[_0x42f2('0x36')](_0x100679[_0x42f2('0x2a')],_0x5af956[_0x42f2('0x2c')]));if(_0x100679[_0x42f2('0x2a')][_0x42f2('0x37')]){_0x4b3fe4['where']=_[_0x42f2('0x38')](_0x4b3fe4[_0x42f2('0x35')],{'$or':_[_0x42f2('0x39')](_0x2600b3,function(_0x2346ae){if(_0x2346ae['type'][_0x42f2('0x3a')]!==_0x42f2('0x3b')){var _0x3c8bb3={};_0x3c8bb3[_0x2346ae[_0x42f2('0x3c')]]={'$like':'%'+_0x100679[_0x42f2('0x2a')][_0x42f2('0x37')]+'%'};return _0x3c8bb3;}})});}_0x4b3fe4=_[_0x42f2('0x38')]({},_0x4b3fe4,_0x100679['options']);var _0x36a6cf={'where':_0x4b3fe4[_0x42f2('0x35')]};return db[_0x42f2('0x28')][_0x42f2('0x3d')](_0x36a6cf)[_0x42f2('0x1f')](function(_0x1bd055){_0x25f9f6[_0x42f2('0x3d')]=_0x1bd055;if(_0x100679[_0x42f2('0x2a')][_0x42f2('0x3e')]){_0x4b3fe4[_0x42f2('0x3f')]=[{'all':!![]}];}return db[_0x42f2('0x28')]['findAll'](_0x4b3fe4);})['then'](function(_0x4d044d){_0x25f9f6['rows']=_0x4d044d;return _0x25f9f6;})[_0x42f2('0x1f')](respondWithFilteredResult(_0x3d7318,_0x4b3fe4))[_0x42f2('0x40')](handleError(_0x3d7318,null));};exports[_0x42f2('0x41')]=function(_0x2cdb4b,_0x4c2006){var _0x36d774={'raw':!![],'where':{'id':_0x2cdb4b[_0x42f2('0x42')]['id']}},_0x686c08={};_0x686c08['model']=_[_0x42f2('0x2b')](db[_0x42f2('0x28')]['rawAttributes']);_0x686c08[_0x42f2('0x2a')]=_[_0x42f2('0x2b')](_0x2cdb4b[_0x42f2('0x2a')]);_0x686c08[_0x42f2('0x2c')]=_['intersection'](_0x686c08['model'],_0x686c08[_0x42f2('0x2a')]);_0x36d774['attributes']=_[_0x42f2('0x2d')](_0x686c08[_0x42f2('0x29')],qs[_0x42f2('0x2f')](_0x2cdb4b[_0x42f2('0x2a')][_0x42f2('0x2f')]));_0x36d774[_0x42f2('0x2e')]=_0x36d774[_0x42f2('0x2e')][_0x42f2('0x30')]?_0x36d774[_0x42f2('0x2e')]:_0x686c08[_0x42f2('0x29')];if(_0x2cdb4b[_0x42f2('0x2a')][_0x42f2('0x3e')]){_0x36d774['include']=[{'all':!![]}];}_0x36d774=_[_0x42f2('0x38')]({},_0x36d774,_0x2cdb4b[_0x42f2('0x43')]);return db[_0x42f2('0x28')][_0x42f2('0x44')](_0x36d774)[_0x42f2('0x1f')](handleEntityNotFound(_0x4c2006,null))['then'](respondWithResult(_0x4c2006,null))['catch'](handleError(_0x4c2006,null));};exports[_0x42f2('0x45')]=function(_0x193f25,_0x375031){return db[_0x42f2('0x28')]['create'](_0x193f25[_0x42f2('0x46')],{})['then'](function(_0x147283){var _0x3aff41=_0x193f25['user'][_0x42f2('0x21')]({'plain':!![]});if(!_0x3aff41)throw new Error(_0x42f2('0x47'));if(_0x3aff41[_0x42f2('0x48')]===_0x42f2('0x49')){var _0x16cdd7=_0x147283['get']({'plain':!![]});var _0x1f7dcb=_0x42f2('0x4a');return db[_0x42f2('0x4b')][_0x42f2('0x44')]({'where':{'name':_0x1f7dcb,'userProfileId':_0x3aff41['userProfileId']},'raw':!![]})[_0x42f2('0x1f')](function(_0x4feee9){if(_0x4feee9&&_0x4feee9['autoAssociation']===0x0){return db[_0x42f2('0x22')][_0x42f2('0x45')]({'name':_0x16cdd7[_0x42f2('0x25')],'resourceId':_0x16cdd7['id'],'type':_0x4feee9[_0x42f2('0x25')],'sectionId':_0x4feee9['id']},{})[_0x42f2('0x1f')](function(){return _0x147283;});}else{return _0x147283;}})[_0x42f2('0x40')](function(_0xeef55){logger['error'](_0x42f2('0x4c'),_0xeef55);throw _0xeef55;});}return _0x147283;})['then'](respondWithResult(_0x375031,0xc9))[_0x42f2('0x40')](handleError(_0x375031,null));};exports['update']=function(_0x1c1bfb,_0x54468d){if(_0x1c1bfb['body']['id']){delete _0x1c1bfb[_0x42f2('0x46')]['id'];}return db[_0x42f2('0x28')][_0x42f2('0x44')]({'where':{'id':_0x1c1bfb[_0x42f2('0x42')]['id']}})[_0x42f2('0x1f')](handleEntityNotFound(_0x54468d,null))[_0x42f2('0x1f')](saveUpdates(_0x1c1bfb[_0x42f2('0x46')],null))['then'](respondWithResult(_0x54468d,null))[_0x42f2('0x40')](handleError(_0x54468d,null));};exports['destroy']=function(_0x134395,_0x1e2b31){return db[_0x42f2('0x28')][_0x42f2('0x44')]({'where':{'id':_0x134395[_0x42f2('0x42')]['id']}})[_0x42f2('0x1f')](handleEntityNotFound(_0x1e2b31,null))['then'](removeEntity(_0x1e2b31,null))[_0x42f2('0x40')](handleError(_0x1e2b31,null));};exports[_0x42f2('0x4d')]=function(_0x2134c5,_0x54ce17,_0x442b9e){return db[_0x42f2('0x28')]['find']({'where':{'id':_0x2134c5[_0x42f2('0x42')]['id']},'attributes':[_0x42f2('0x25'),'basename','savename',_0x42f2('0x4e')],'raw':!![]})[_0x42f2('0x1f')](handleEntityNotFound(_0x54ce17,null))[_0x42f2('0x1f')](function(_0x20f0ba){if(_0x20f0ba){if(!fs[_0x42f2('0x4f')](path[_0x42f2('0x50')](config[_0x42f2('0x51')],'server/files/reports',_0x20f0ba[_0x42f2('0x52')]))){throw new db[(_0x42f2('0x53'))][(_0x42f2('0x54'))](_0x42f2('0x55'));}if(_0x2134c5[_0x42f2('0x2a')][_0x42f2('0x56')]){return _0x54ce17['sendStatus'](0xc8);}return _0x54ce17['download'](path[_0x42f2('0x50')](config[_0x42f2('0x51')],'server/files/reports',_0x20f0ba[_0x42f2('0x52')]),util[_0x42f2('0x57')](_0x42f2('0x58'),_0x20f0ba[_0x42f2('0x59')]||_0x20f0ba[_0x42f2('0x25')],_0x20f0ba['output'][_0x42f2('0x5a')]()));}})['catch'](handleError(_0x54ce17,null));}; \ No newline at end of file +var _0x8be7=['lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','end','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','where','merge','map','key','VIRTUAL','filter','count','includeAll','findAll','rows','catch','show','params','AnalyticExtractedReport','length','options','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','root','server/files/reports','savename','ValidationError','exists','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs'];(function(_0x503bf0,_0x22e46f){var _0x1f10dc=function(_0x57da13){while(--_0x57da13){_0x503bf0['push'](_0x503bf0['shift']());}};_0x1f10dc(++_0x22e46f);}(_0x8be7,0x111));var _0x78be=function(_0x4a3ee3,_0x304512){_0x4a3ee3=_0x4a3ee3-0x0;var _0x56d16d=_0x8be7[_0x4a3ee3];return _0x56d16d;};'use strict';var pdf=require(_0x78be('0x0'));var emlformat=require(_0x78be('0x1'));var rimraf=require(_0x78be('0x2'));var zipdir=require(_0x78be('0x3'));var jsonpatch=require(_0x78be('0x4'));var rp=require(_0x78be('0x5'));var moment=require(_0x78be('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x78be('0x7'));var util=require(_0x78be('0x8'));var path=require(_0x78be('0x9'));var sox=require('sox');var csv=require(_0x78be('0xa'));var ejs=require(_0x78be('0xb'));var fs=require('fs');var _=require(_0x78be('0xc'));var squel=require('squel');var crypto=require(_0x78be('0xd'));var jsforce=require(_0x78be('0xe'));var deskjs=require(_0x78be('0xf'));var toCsv=require('to-csv');var querystring=require(_0x78be('0x10'));var Papa=require('papaparse');var authService=require(_0x78be('0x11'));var hardwareService=require(_0x78be('0x12'));var Redis=require(_0x78be('0x13'));var qs=require(_0x78be('0x14'));var logger=require('../../config/logger')(_0x78be('0x15'));var utils=require(_0x78be('0x16'));var config=require(_0x78be('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1603ad,_0x190886){_0x190886=_0x190886||0xcc;return function(_0x1e7756){if(_0x1e7756){return _0x1603ad[_0x78be('0x18')](_0x190886);}return _0x1603ad[_0x78be('0x19')](_0x190886)['end']();};}function respondWithResult(_0x42e37e,_0x55da1d){_0x55da1d=_0x55da1d||0xc8;return function(_0x434b9b){if(_0x434b9b){return _0x42e37e[_0x78be('0x19')](_0x55da1d)[_0x78be('0x1a')](_0x434b9b);}};}function respondWithFilteredResult(_0x482f4c,_0x209caf){return function(_0x126131){if(_0x126131){var _0x3a8087=_0x126131['count'],_0x1f3dd0=_0x209caf[_0x78be('0x1b')],_0x57488f=_0x209caf['offset']+_0x209caf['limit'],_0x55621c;if(_0x57488f>=_0x3a8087){_0x57488f=_0x3a8087;_0x55621c=0xc8;}else{_0x55621c=0xce;}_0x482f4c[_0x78be('0x19')](_0x55621c);return _0x482f4c[_0x78be('0x1c')](_0x78be('0x1d'),_0x1f3dd0+'-'+_0x57488f+'/'+_0x3a8087)[_0x78be('0x1a')](_0x126131);}return null;};}function patchUpdates(_0x1c9ca0){return function(_0x23d1de){try{jsonpatch[_0x78be('0x1e')](_0x23d1de,_0x1c9ca0,!![]);}catch(_0x431d7c){return BPromise[_0x78be('0x1f')](_0x431d7c);}return _0x23d1de[_0x78be('0x20')]();};}function saveUpdates(_0x3bf533,_0x24fc70){return function(_0x2b4dcd){if(_0x2b4dcd){return _0x2b4dcd[_0x78be('0x21')](_0x3bf533)[_0x78be('0x22')](function(_0x2b1c90){return _0x2b1c90;});}return null;};}function removeEntity(_0x19d6c0,_0x5462c4){return function(_0x258f43){if(_0x258f43){return _0x258f43[_0x78be('0x23')]()[_0x78be('0x22')](function(){var _0x59b268=_0x258f43[_0x78be('0x24')]({'plain':!![]});var _0xe4deb0=_0x78be('0x25');return db[_0x78be('0x26')]['destroy']({'where':{'type':_0xe4deb0,'resourceId':_0x59b268['id']}})[_0x78be('0x22')](function(){return _0x258f43;});})['then'](function(){_0x19d6c0[_0x78be('0x19')](0xcc)[_0x78be('0x27')]();});}};}function handleEntityNotFound(_0x21e76c,_0x4ba1ec){return function(_0x38c3e9){if(!_0x38c3e9){_0x21e76c[_0x78be('0x18')](0x194);}return _0x38c3e9;};}function handleError(_0x3414b6,_0x327d40){_0x327d40=_0x327d40||0x1f4;return function(_0x11e32b){logger[_0x78be('0x28')](_0x11e32b[_0x78be('0x29')]);if(_0x11e32b[_0x78be('0x2a')]){delete _0x11e32b[_0x78be('0x2a')];}_0x3414b6[_0x78be('0x19')](_0x327d40)[_0x78be('0x2b')](_0x11e32b);};}exports[_0x78be('0x2c')]=function(_0x5548c1,_0x7f7f49){var _0x4c8b8d={},_0x135768={},_0xe485cd={'count':0x0,'rows':[]};var _0x415abb=db['AnalyticExtractedReport'][_0x78be('0x2d')];_0x135768[_0x78be('0x2e')]=_['keys'](_0x415abb);_0x135768['query']=_[_0x78be('0x2f')](_0x5548c1[_0x78be('0x30')]);_0x135768[_0x78be('0x31')]=_[_0x78be('0x32')](_0x135768[_0x78be('0x2e')],_0x135768['query']);_0x4c8b8d[_0x78be('0x33')]=_[_0x78be('0x32')](_0x135768[_0x78be('0x2e')],qs[_0x78be('0x34')](_0x5548c1[_0x78be('0x30')][_0x78be('0x34')]));_0x4c8b8d[_0x78be('0x33')]=_0x4c8b8d[_0x78be('0x33')]['length']?_0x4c8b8d['attributes']:_0x135768[_0x78be('0x2e')];if(!_0x5548c1[_0x78be('0x30')]['hasOwnProperty'](_0x78be('0x35'))){_0x4c8b8d['limit']=qs[_0x78be('0x36')](_0x5548c1[_0x78be('0x30')][_0x78be('0x36')]);_0x4c8b8d[_0x78be('0x1b')]=qs[_0x78be('0x1b')](_0x5548c1['query'][_0x78be('0x1b')]);}_0x4c8b8d[_0x78be('0x37')]=qs[_0x78be('0x38')](_0x5548c1[_0x78be('0x30')][_0x78be('0x38')]);_0x4c8b8d['where']=qs['filters'](_[_0x78be('0x39')](_0x5548c1[_0x78be('0x30')],_0x135768[_0x78be('0x31')]));if(_0x5548c1[_0x78be('0x30')]['filter']){_0x4c8b8d[_0x78be('0x3a')]=_[_0x78be('0x3b')](_0x4c8b8d[_0x78be('0x3a')],{'$or':_[_0x78be('0x3c')](_0x415abb,function(_0x5cc5c0){if(_0x5cc5c0['type'][_0x78be('0x3d')]!==_0x78be('0x3e')){var _0x4fcee8={};_0x4fcee8[_0x5cc5c0['field']]={'$like':'%'+_0x5548c1[_0x78be('0x30')][_0x78be('0x3f')]+'%'};return _0x4fcee8;}})});}_0x4c8b8d=_[_0x78be('0x3b')]({},_0x4c8b8d,_0x5548c1['options']);var _0xcad331={'where':_0x4c8b8d[_0x78be('0x3a')]};return db['AnalyticExtractedReport'][_0x78be('0x40')](_0xcad331)[_0x78be('0x22')](function(_0x59e945){_0xe485cd[_0x78be('0x40')]=_0x59e945;if(_0x5548c1[_0x78be('0x30')][_0x78be('0x41')]){_0x4c8b8d['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x78be('0x42')](_0x4c8b8d);})[_0x78be('0x22')](function(_0x4754e3){_0xe485cd[_0x78be('0x43')]=_0x4754e3;return _0xe485cd;})[_0x78be('0x22')](respondWithFilteredResult(_0x7f7f49,_0x4c8b8d))[_0x78be('0x44')](handleError(_0x7f7f49,null));};exports[_0x78be('0x45')]=function(_0xcd6baa,_0x17d9ad){var _0x7ba0ae={'raw':!![],'where':{'id':_0xcd6baa[_0x78be('0x46')]['id']}},_0x4ec7d6={};_0x4ec7d6[_0x78be('0x2e')]=_[_0x78be('0x2f')](db[_0x78be('0x47')][_0x78be('0x2d')]);_0x4ec7d6[_0x78be('0x30')]=_['keys'](_0xcd6baa[_0x78be('0x30')]);_0x4ec7d6['filters']=_[_0x78be('0x32')](_0x4ec7d6[_0x78be('0x2e')],_0x4ec7d6[_0x78be('0x30')]);_0x7ba0ae[_0x78be('0x33')]=_['intersection'](_0x4ec7d6['model'],qs[_0x78be('0x34')](_0xcd6baa['query'][_0x78be('0x34')]));_0x7ba0ae['attributes']=_0x7ba0ae[_0x78be('0x33')][_0x78be('0x48')]?_0x7ba0ae[_0x78be('0x33')]:_0x4ec7d6['model'];if(_0xcd6baa[_0x78be('0x30')][_0x78be('0x41')]){_0x7ba0ae['include']=[{'all':!![]}];}_0x7ba0ae=_[_0x78be('0x3b')]({},_0x7ba0ae,_0xcd6baa[_0x78be('0x49')]);return db[_0x78be('0x47')][_0x78be('0x4a')](_0x7ba0ae)[_0x78be('0x22')](handleEntityNotFound(_0x17d9ad,null))[_0x78be('0x22')](respondWithResult(_0x17d9ad,null))[_0x78be('0x44')](handleError(_0x17d9ad,null));};exports[_0x78be('0x4b')]=function(_0x59b515,_0x3ab581){return db[_0x78be('0x47')][_0x78be('0x4b')](_0x59b515[_0x78be('0x4c')],{})[_0x78be('0x22')](function(_0x55cf27){var _0x397ff7=_0x59b515[_0x78be('0x4d')][_0x78be('0x24')]({'plain':!![]});if(!_0x397ff7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x397ff7[_0x78be('0x4e')]==='user'){var _0x50536b=_0x55cf27[_0x78be('0x24')]({'plain':!![]});var _0x4ac12b=_0x78be('0x25');return db['UserProfileSection'][_0x78be('0x4a')]({'where':{'name':_0x4ac12b,'userProfileId':_0x397ff7[_0x78be('0x4f')]},'raw':!![]})['then'](function(_0x59547a){if(_0x59547a&&_0x59547a[_0x78be('0x50')]===0x0){return db['UserProfileResource'][_0x78be('0x4b')]({'name':_0x50536b[_0x78be('0x2a')],'resourceId':_0x50536b['id'],'type':_0x59547a[_0x78be('0x2a')],'sectionId':_0x59547a['id']},{})['then'](function(){return _0x55cf27;});}else{return _0x55cf27;}})[_0x78be('0x44')](function(_0x223536){logger[_0x78be('0x28')](_0x78be('0x51'),_0x223536);throw _0x223536;});}return _0x55cf27;})[_0x78be('0x22')](respondWithResult(_0x3ab581,0xc9))[_0x78be('0x44')](handleError(_0x3ab581,null));};exports[_0x78be('0x21')]=function(_0x11d7ac,_0x2f2c61){if(_0x11d7ac[_0x78be('0x4c')]['id']){delete _0x11d7ac[_0x78be('0x4c')]['id'];}return db[_0x78be('0x47')][_0x78be('0x4a')]({'where':{'id':_0x11d7ac[_0x78be('0x46')]['id']}})[_0x78be('0x22')](handleEntityNotFound(_0x2f2c61,null))[_0x78be('0x22')](saveUpdates(_0x11d7ac['body'],null))[_0x78be('0x22')](respondWithResult(_0x2f2c61,null))[_0x78be('0x44')](handleError(_0x2f2c61,null));};exports[_0x78be('0x23')]=function(_0x292a32,_0x5647f8){return db[_0x78be('0x47')][_0x78be('0x4a')]({'where':{'id':_0x292a32['params']['id']}})[_0x78be('0x22')](handleEntityNotFound(_0x5647f8,null))[_0x78be('0x22')](removeEntity(_0x5647f8,null))[_0x78be('0x44')](handleError(_0x5647f8,null));};exports[_0x78be('0x52')]=function(_0x1f1466,_0xa13e6b,_0x56523a){return db[_0x78be('0x47')][_0x78be('0x4a')]({'where':{'id':_0x1f1466[_0x78be('0x46')]['id']},'attributes':['name',_0x78be('0x53'),'savename',_0x78be('0x54')],'raw':!![]})[_0x78be('0x22')](handleEntityNotFound(_0xa13e6b,null))[_0x78be('0x22')](function(_0x2a2a60){if(_0x2a2a60){if(!fs[_0x78be('0x55')](path[_0x78be('0x56')](config[_0x78be('0x57')],_0x78be('0x58'),_0x2a2a60[_0x78be('0x59')]))){throw new db['Sequelize'][(_0x78be('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x1f1466[_0x78be('0x30')][_0x78be('0x5b')]){return _0xa13e6b['sendStatus'](0xc8);}return _0xa13e6b[_0x78be('0x52')](path[_0x78be('0x56')](config['root'],_0x78be('0x58'),_0x2a2a60[_0x78be('0x59')]),util[_0x78be('0x5c')](_0x78be('0x5d'),_0x2a2a60[_0x78be('0x53')]||_0x2a2a60[_0x78be('0x2a')],_0x2a2a60[_0x78be('0x54')][_0x78be('0x5e')]()));}})['catch'](handleError(_0xa13e6b,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 612e476..f79ee61 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 _0x9a1b=['analytics_extracted_reports','lodash','moment','bluebird','request-promise','./analyticExtractedReport.attributes','AnalyticExtractedReport'];(function(_0x4cd690,_0x4797cc){var _0x4a74a9=function(_0x4cbbc5){while(--_0x4cbbc5){_0x4cd690['push'](_0x4cd690['shift']());}};_0x4a74a9(++_0x4797cc);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x309441,_0x533721){_0x309441=_0x309441-0x0;var _0x3918e8=_0x9a1b[_0x309441];return _0x3918e8;};'use strict';var _=require(_0xb9a1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb9a1('0x1'));var BPromise=require(_0xb9a1('0x2'));var rp=require(_0xb9a1('0x3'));var attributes=require(_0xb9a1('0x4'));module['exports']=function(_0x20ac68,_0xc70825){return _0x20ac68['define'](_0xb9a1('0x5'),attributes,{'tableName':_0xb9a1('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90e0=['request-promise','./analyticExtractedReport.attributes','exports','util','../../config/logger','api','moment','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x90e0,0xe3));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x090e('0x0'));var logger=require(_0x090e('0x1'))(_0x090e('0x2'));var moment=require(_0x090e('0x3'));var BPromise=require(_0x090e('0x4'));var rp=require(_0x090e('0x5'));var attributes=require(_0x090e('0x6'));module[_0x090e('0x7')]=function(_0x24bd63,_0x15c0ce){return _0x24bd63['define']('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 634a479..050c437 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 _0x1529=['client','http','request','info','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x1529,0xfe));var _0x9152=function(_0x3a115e,_0x3dac39){_0x3a115e=_0x3a115e-0x0;var _0x1b7e61=_0x1529[_0x3a115e];return _0x1b7e61;};'use strict';var _=require(_0x9152('0x0'));var util=require(_0x9152('0x1'));var moment=require(_0x9152('0x2'));var BPromise=require(_0x9152('0x3'));var rs=require(_0x9152('0x4'));var fs=require('fs');var Redis=require(_0x9152('0x5'));var db=require(_0x9152('0x6'))['db'];var utils=require(_0x9152('0x7'));var logger=require(_0x9152('0x8'))(_0x9152('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9152('0xa')][_0x9152('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4df935,_0x50a6ca,_0x357f57){return new BPromise(function(_0x58e6a5,_0x3056ea){return client[_0x9152('0xc')](_0x4df935,_0x357f57)['then'](function(_0x1ef33c){logger[_0x9152('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x50a6ca,'request\x20sent');logger[_0x9152('0xe')](_0x9152('0xf'),_0x50a6ca,'request\x20sent',JSON[_0x9152('0x10')](_0x1ef33c));if(_0x1ef33c[_0x9152('0x11')]){if(_0x1ef33c[_0x9152('0x11')][_0x9152('0x12')]===0x1f4){logger[_0x9152('0x11')](_0x9152('0x13'),_0x50a6ca,_0x1ef33c[_0x9152('0x11')]['message']);return _0x3056ea(_0x1ef33c[_0x9152('0x11')][_0x9152('0x14')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x50a6ca,_0x1ef33c[_0x9152('0x11')]['message']);return _0x58e6a5(_0x1ef33c[_0x9152('0x11')][_0x9152('0x14')]);}else{logger[_0x9152('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x50a6ca,_0x9152('0x15'));_0x58e6a5(_0x1ef33c[_0x9152('0x16')][_0x9152('0x14')]);}})[_0x9152('0x17')](function(_0x5d1ea5){logger[_0x9152('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x50a6ca,_0x5d1ea5);_0x3056ea(_0x5d1ea5);});});} \ No newline at end of file +var _0x9e94=['info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x4772b3,_0x49a7fe){var _0x4d2e1c=function(_0x3dcd71){while(--_0x3dcd71){_0x4772b3['push'](_0x4772b3['shift']());}};_0x4d2e1c(++_0x49a7fe);}(_0x9e94,0xbd));var _0x49e9=function(_0x47c679,_0x2e9e9e){_0x47c679=_0x47c679-0x0;var _0x289b8e=_0x9e94[_0x47c679];return _0x289b8e;};'use strict';var _=require('lodash');var util=require(_0x49e9('0x0'));var moment=require(_0x49e9('0x1'));var BPromise=require(_0x49e9('0x2'));var rs=require(_0x49e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49e9('0x4'))['db'];var utils=require(_0x49e9('0x5'));var logger=require(_0x49e9('0x6'))('rpc');var config=require(_0x49e9('0x7'));var jayson=require(_0x49e9('0x8'));var client=jayson['client'][_0x49e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xefb0d1,_0x2c5b38,_0x5d67ed){return new BPromise(function(_0x1acb9d,_0x5237a5){return client[_0x49e9('0xa')](_0xefb0d1,_0x5d67ed)['then'](function(_0x56a55e){logger[_0x49e9('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2c5b38,_0x49e9('0xc'));logger[_0x49e9('0xd')](_0x49e9('0xe'),_0x2c5b38,_0x49e9('0xc'),JSON[_0x49e9('0xf')](_0x56a55e));if(_0x56a55e[_0x49e9('0x10')]){if(_0x56a55e[_0x49e9('0x10')]['code']===0x1f4){logger['error'](_0x49e9('0x11'),_0x2c5b38,_0x56a55e[_0x49e9('0x10')][_0x49e9('0x12')]);return _0x5237a5(_0x56a55e[_0x49e9('0x10')][_0x49e9('0x12')]);}logger[_0x49e9('0x10')](_0x49e9('0x11'),_0x2c5b38,_0x56a55e['error']['message']);return _0x1acb9d(_0x56a55e[_0x49e9('0x10')]['message']);}else{logger[_0x49e9('0xb')](_0x49e9('0x11'),_0x2c5b38,_0x49e9('0xc'));_0x1acb9d(_0x56a55e[_0x49e9('0x13')][_0x49e9('0x12')]);}})['catch'](function(_0x5bf843){logger['error'](_0x49e9('0x11'),_0x2c5b38,_0x5bf843);_0x5237a5(_0x5bf843);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 94794d8..70ac6b7 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 _0xf6fb=['./analyticExtractedReport.controller','get','isAuthenticated','/:id','/:id/download','download','post','create','put','update','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf6fb,0x12b));var _0xbf6f=function(_0x422bf9,_0xf80fd0){_0x422bf9=_0x422bf9-0x0;var _0x38333a=_0xf6fb[_0x422bf9];return _0x38333a;};'use strict';var multer=require(_0xbf6f('0x0'));var util=require(_0xbf6f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbf6f('0x2'));var router=express[_0xbf6f('0x3')]();var auth=require(_0xbf6f('0x4'));var interaction=require(_0xbf6f('0x5'));var config=require(_0xbf6f('0x6'));var controller=require(_0xbf6f('0x7'));router[_0xbf6f('0x8')]('/',auth[_0xbf6f('0x9')](),controller['index']);router[_0xbf6f('0x8')](_0xbf6f('0xa'),auth[_0xbf6f('0x9')](),controller['show']);router[_0xbf6f('0x8')](_0xbf6f('0xb'),auth[_0xbf6f('0x9')](),controller[_0xbf6f('0xc')]);router[_0xbf6f('0xd')]('/',auth[_0xbf6f('0x9')](),controller[_0xbf6f('0xe')]);router[_0xbf6f('0xf')](_0xbf6f('0xa'),auth[_0xbf6f('0x9')](),controller[_0xbf6f('0x10')]);router['delete'](_0xbf6f('0xa'),auth[_0xbf6f('0x9')](),controller[_0xbf6f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6f05=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','update'];(function(_0x1391d8,_0x1db437){var _0x2fcb82=function(_0x24ae47){while(--_0x24ae47){_0x1391d8['push'](_0x1391d8['shift']());}};_0x2fcb82(++_0x1db437);}(_0x6f05,0x18e));var _0x56f0=function(_0x24fd9c,_0x1f99be){_0x24fd9c=_0x24fd9c-0x0;var _0x2ba8de=_0x6f05[_0x24fd9c];return _0x2ba8de;};'use strict';var multer=require('multer');var util=require(_0x56f0('0x0'));var path=require('path');var timeout=require(_0x56f0('0x1'));var express=require(_0x56f0('0x2'));var router=express[_0x56f0('0x3')]();var auth=require(_0x56f0('0x4'));var interaction=require(_0x56f0('0x5'));var config=require(_0x56f0('0x6'));var controller=require(_0x56f0('0x7'));router[_0x56f0('0x8')]('/',auth[_0x56f0('0x9')](),controller[_0x56f0('0xa')]);router[_0x56f0('0x8')](_0x56f0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x56f0('0x8')](_0x56f0('0xc'),auth['isAuthenticated'](),controller[_0x56f0('0xd')]);router['post']('/',auth[_0x56f0('0x9')](),controller[_0x56f0('0xe')]);router['put'](_0x56f0('0xb'),auth['isAuthenticated'](),controller[_0x56f0('0xf')]);router[_0x56f0('0x10')](_0x56f0('0xb'),auth[_0x56f0('0x9')](),controller['destroy']);module[_0x56f0('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index d5728ba..21cec2c 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 _0x991b=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x264194,_0x48ee77){var _0x584be0=function(_0x4f9b57){while(--_0x4f9b57){_0x264194['push'](_0x264194['shift']());}};_0x584be0(++_0x48ee77);}(_0x991b,0x1e4));var _0xb991=function(_0x1a861e,_0x54c334){_0x1a861e=_0x1a861e-0x0;var _0x738fee=_0x991b[_0x1a861e];return _0x738fee;};'use strict';var Sequelize=require(_0xb991('0x0'));module[_0xb991('0x1')]={'field':{'type':Sequelize[_0xb991('0x2')]},'alias':{'type':Sequelize[_0xb991('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xb991('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb991('0x3')]},'custom':{'type':Sequelize[_0xb991('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x0a35=['STRING','BOOLEAN'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x0a35,0x18e));var _0x50a3=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0x0a35[_0x5c768b];return _0x335af8;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x50a3('0x0')]},'function':{'type':Sequelize[_0x50a3('0x0')]},'format':{'type':Sequelize[_0x50a3('0x0')]},'groupBy':{'type':Sequelize[_0x50a3('0x1')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x50a3('0x0')]},'custom':{'type':Sequelize[_0x50a3('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e70ab94..9b76484 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 _0x2d15=['findAll','show','rawAttributes','include','find','catch','create','body','bulkCreate','params','bulkDestroy','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticFieldReport','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options'];(function(_0x24cc6f,_0x197c5e){var _0xcd0f56=function(_0x4c1727){while(--_0x4c1727){_0x24cc6f['push'](_0x24cc6f['shift']());}};_0xcd0f56(++_0x197c5e);}(_0x2d15,0xab));var _0x52d1=function(_0x297c0b,_0x11308d){_0x297c0b=_0x297c0b-0x0;var _0x232dba=_0x2d15[_0x297c0b];return _0x232dba;};'use strict';var pdf=require(_0x52d1('0x0'));var emlformat=require(_0x52d1('0x1'));var rimraf=require(_0x52d1('0x2'));var zipdir=require(_0x52d1('0x3'));var jsonpatch=require(_0x52d1('0x4'));var rp=require(_0x52d1('0x5'));var moment=require(_0x52d1('0x6'));var BPromise=require(_0x52d1('0x7'));var Mustache=require(_0x52d1('0x8'));var util=require('util');var path=require(_0x52d1('0x9'));var sox=require(_0x52d1('0xa'));var csv=require(_0x52d1('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x52d1('0xc'));var squel=require(_0x52d1('0xd'));var crypto=require('crypto');var jsforce=require(_0x52d1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x52d1('0xb'));var querystring=require(_0x52d1('0xf'));var Papa=require('papaparse');var authService=require(_0x52d1('0x10'));var hardwareService=require(_0x52d1('0x11'));var Redis=require(_0x52d1('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x52d1('0x13'))('api');var utils=require(_0x52d1('0x14'));var config=require('../../config/environment');var db=require(_0x52d1('0x15'))['db'];function respondWithStatusCode(_0x585f2a,_0x395820){_0x395820=_0x395820||0xcc;return function(_0x347906){if(_0x347906){return _0x585f2a[_0x52d1('0x16')](_0x395820);}return _0x585f2a[_0x52d1('0x17')](_0x395820)[_0x52d1('0x18')]();};}function respondWithResult(_0x39ad97,_0x42c7ce){_0x42c7ce=_0x42c7ce||0xc8;return function(_0x2abae3){if(_0x2abae3){return _0x39ad97['status'](_0x42c7ce)[_0x52d1('0x19')](_0x2abae3);}};}function respondWithFilteredResult(_0x3a35eb,_0x16f9fb){return function(_0x41b1e1){if(_0x41b1e1){var _0x10e2f7=_0x41b1e1[_0x52d1('0x1a')],_0x478da4=_0x16f9fb[_0x52d1('0x1b')],_0x4000bb=_0x16f9fb[_0x52d1('0x1b')]+_0x16f9fb['limit'],_0x1368c6;if(_0x4000bb>=_0x10e2f7){_0x4000bb=_0x10e2f7;_0x1368c6=0xc8;}else{_0x1368c6=0xce;}_0x3a35eb[_0x52d1('0x17')](_0x1368c6);return _0x3a35eb[_0x52d1('0x1c')]('Content-Range',_0x478da4+'-'+_0x4000bb+'/'+_0x10e2f7)[_0x52d1('0x19')](_0x41b1e1);}return null;};}function patchUpdates(_0x1f2691){return function(_0xe9ddc){try{jsonpatch[_0x52d1('0x1d')](_0xe9ddc,_0x1f2691,!![]);}catch(_0x23c33a){return BPromise[_0x52d1('0x1e')](_0x23c33a);}return _0xe9ddc[_0x52d1('0x1f')]();};}function saveUpdates(_0x51829b,_0x2dee34){return function(_0x84f7eb){if(_0x84f7eb){return _0x84f7eb[_0x52d1('0x20')](_0x51829b)[_0x52d1('0x21')](function(_0x2f8c89){return _0x2f8c89;});}return null;};}function removeEntity(_0x560908,_0x4d8096){return function(_0x2d83b6){if(_0x2d83b6){return _0x2d83b6[_0x52d1('0x22')]()['then'](function(){_0x560908['status'](0xcc)[_0x52d1('0x18')]();});}};}function handleEntityNotFound(_0x9dedf4,_0x476de3){return function(_0x3aa69a){if(!_0x3aa69a){_0x9dedf4[_0x52d1('0x16')](0x194);}return _0x3aa69a;};}function handleError(_0x292f62,_0x46adf0){_0x46adf0=_0x46adf0||0x1f4;return function(_0x4261c7){logger[_0x52d1('0x23')](_0x4261c7[_0x52d1('0x24')]);if(_0x4261c7[_0x52d1('0x25')]){delete _0x4261c7['name'];}_0x292f62[_0x52d1('0x17')](_0x46adf0)[_0x52d1('0x26')](_0x4261c7);};}exports[_0x52d1('0x27')]=function(_0x426719,_0x3a7073){var _0xacefd3={},_0x5e54b4={},_0x1d2d6a={'count':0x0,'rows':[]};var _0x4dc50b=db[_0x52d1('0x28')]['rawAttributes'];_0x5e54b4[_0x52d1('0x29')]=_[_0x52d1('0x2a')](_0x4dc50b);_0x5e54b4[_0x52d1('0x2b')]=_[_0x52d1('0x2a')](_0x426719[_0x52d1('0x2b')]);_0x5e54b4[_0x52d1('0x2c')]=_[_0x52d1('0x2d')](_0x5e54b4[_0x52d1('0x29')],_0x5e54b4[_0x52d1('0x2b')]);_0xacefd3[_0x52d1('0x2e')]=_[_0x52d1('0x2d')](_0x5e54b4[_0x52d1('0x29')],qs['fields'](_0x426719[_0x52d1('0x2b')][_0x52d1('0x2f')]));_0xacefd3[_0x52d1('0x2e')]=_0xacefd3[_0x52d1('0x2e')][_0x52d1('0x30')]?_0xacefd3['attributes']:_0x5e54b4['model'];if(!_0x426719[_0x52d1('0x2b')][_0x52d1('0x31')](_0x52d1('0x32'))){_0xacefd3[_0x52d1('0x33')]=qs[_0x52d1('0x33')](_0x426719[_0x52d1('0x2b')]['limit']);_0xacefd3['offset']=qs['offset'](_0x426719[_0x52d1('0x2b')][_0x52d1('0x1b')]);}_0xacefd3[_0x52d1('0x34')]=qs[_0x52d1('0x35')](_0x426719[_0x52d1('0x2b')][_0x52d1('0x35')]);_0xacefd3[_0x52d1('0x36')]=qs[_0x52d1('0x2c')](_[_0x52d1('0x37')](_0x426719[_0x52d1('0x2b')],_0x5e54b4[_0x52d1('0x2c')]));if(_0x426719['query'][_0x52d1('0x38')]){_0xacefd3['where']=_[_0x52d1('0x39')](_0xacefd3[_0x52d1('0x36')],{'$or':_[_0x52d1('0x3a')](_0x4dc50b,function(_0xd60422){if(_0xd60422[_0x52d1('0x3b')]['key']!==_0x52d1('0x3c')){var _0x3f8867={};_0x3f8867[_0xd60422[_0x52d1('0x3d')]]={'$like':'%'+_0x426719[_0x52d1('0x2b')][_0x52d1('0x38')]+'%'};return _0x3f8867;}})});}_0xacefd3=_[_0x52d1('0x39')]({},_0xacefd3,_0x426719[_0x52d1('0x3e')]);var _0x364d78={'where':_0xacefd3[_0x52d1('0x36')]};return db[_0x52d1('0x28')][_0x52d1('0x1a')](_0x364d78)[_0x52d1('0x21')](function(_0x1a42f8){_0x1d2d6a[_0x52d1('0x1a')]=_0x1a42f8;if(_0x426719['query']['includeAll']){_0xacefd3['include']=[{'all':!![]}];}return db[_0x52d1('0x28')][_0x52d1('0x3f')](_0xacefd3);})['then'](function(_0x2bd43f){_0x1d2d6a['rows']=_0x2bd43f;return _0x1d2d6a;})[_0x52d1('0x21')](respondWithFilteredResult(_0x3a7073,_0xacefd3))['catch'](handleError(_0x3a7073,null));};exports[_0x52d1('0x40')]=function(_0x530333,_0x3d5d9b){var _0x51e712={'raw':![],'where':{'id':_0x530333['params']['id']}},_0x55276a={};_0x55276a[_0x52d1('0x29')]=_['keys'](db[_0x52d1('0x28')][_0x52d1('0x41')]);_0x55276a['query']=_[_0x52d1('0x2a')](_0x530333[_0x52d1('0x2b')]);_0x55276a[_0x52d1('0x2c')]=_['intersection'](_0x55276a['model'],_0x55276a['query']);_0x51e712[_0x52d1('0x2e')]=_[_0x52d1('0x2d')](_0x55276a[_0x52d1('0x29')],qs[_0x52d1('0x2f')](_0x530333['query'][_0x52d1('0x2f')]));_0x51e712[_0x52d1('0x2e')]=_0x51e712[_0x52d1('0x2e')]['length']?_0x51e712['attributes']:_0x55276a[_0x52d1('0x29')];if(_0x530333[_0x52d1('0x2b')]['includeAll']){_0x51e712[_0x52d1('0x42')]=[{'all':!![]}];}_0x51e712=_[_0x52d1('0x39')]({},_0x51e712,_0x530333[_0x52d1('0x3e')]);return db[_0x52d1('0x28')][_0x52d1('0x43')](_0x51e712)[_0x52d1('0x21')](handleEntityNotFound(_0x3d5d9b,null))[_0x52d1('0x21')](respondWithResult(_0x3d5d9b,null))[_0x52d1('0x44')](handleError(_0x3d5d9b,null));};exports[_0x52d1('0x45')]=function(_0x451802,_0x45a162){return db[_0x52d1('0x28')][_0x52d1('0x45')](_0x451802[_0x52d1('0x46')],{})[_0x52d1('0x21')](respondWithResult(_0x45a162,0xc9))[_0x52d1('0x44')](handleError(_0x45a162,null));};exports[_0x52d1('0x47')]=function(_0x44f6f6,_0xd238f2){return db[_0x52d1('0x28')][_0x52d1('0x47')](_0x44f6f6[_0x52d1('0x46')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xd238f2,0xc9))[_0x52d1('0x44')](handleError(_0xd238f2,null));};exports['update']=function(_0x555fa2,_0x47883a){if(_0x555fa2[_0x52d1('0x46')]['id']){delete _0x555fa2[_0x52d1('0x46')]['id'];}return db[_0x52d1('0x28')][_0x52d1('0x43')]({'where':{'id':_0x555fa2[_0x52d1('0x48')]['id']}})[_0x52d1('0x21')](handleEntityNotFound(_0x47883a,null))[_0x52d1('0x21')](saveUpdates(_0x555fa2[_0x52d1('0x46')],null))[_0x52d1('0x21')](respondWithResult(_0x47883a,null))[_0x52d1('0x44')](handleError(_0x47883a,null));};exports[_0x52d1('0x22')]=function(_0x356981,_0x2e8e93){return db[_0x52d1('0x28')][_0x52d1('0x43')]({'where':{'id':_0x356981['params']['id']}})[_0x52d1('0x21')](handleEntityNotFound(_0x2e8e93,null))['then'](removeEntity(_0x2e8e93,null))[_0x52d1('0x44')](handleError(_0x2e8e93,null));};exports[_0x52d1('0x49')]=function(_0x4904fc,_0x3edd11){return db[_0x52d1('0x28')][_0x52d1('0x22')]({'where':{'id':_0x4904fc[_0x52d1('0x2b')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x52d1('0x21')](respondWithResult(_0x3edd11,0xcc))[_0x52d1('0x44')](handleError(_0x3edd11,null));};exports['addFields']=function(_0x1f6bd9,_0x5c1ec7,_0x4ec25b){return db[_0x52d1('0x4a')]['findOne']({'where':{'id':_0x1f6bd9[_0x52d1('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c1ec7,null))[_0x52d1('0x21')](function(_0x2a30db){if(_0x2a30db){return db[_0x52d1('0x4b')][_0x52d1('0x4c')](function(_0x39e365){return db[_0x52d1('0x28')][_0x52d1('0x22')]({'where':{'CustomReportId':_0x1f6bd9[_0x52d1('0x48')]['id']},'transaction':_0x39e365})['then'](function(_0x21afec){var _0xefb656=_[_0x52d1('0x3a')](_0x1f6bd9[_0x52d1('0x46')],function(_0x246fb5){delete _0x246fb5['id'];_0x246fb5[_0x52d1('0x4d')]=_0x1f6bd9[_0x52d1('0x48')]['id'];return _0x246fb5;});return db[_0x52d1('0x28')][_0x52d1('0x47')](_0xefb656,{'transaction':_0x39e365});});})[_0x52d1('0x21')](function(){return db['AnalyticFieldReport'][_0x52d1('0x3f')]({'where':{'CustomReportId':_0x1f6bd9[_0x52d1('0x48')]['id']}});});}})[_0x52d1('0x21')](respondWithResult(_0x5c1ec7,null))[_0x52d1('0x44')](handleError(_0x5c1ec7,null));}; \ No newline at end of file +var _0x5fdb=['sort','where','pick','merge','map','type','key','field','filter','options','includeAll','findAll','rows','show','rawAttributes','length','include','create','body','bulkCreate','catch','update','params','destroy','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','sendStatus','status','end','json','count','offset','limit','reject','save','then','error','stack','name','send','index','AnalyticFieldReport','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x5fdb,0xff));var _0xb5fd=function(_0x59136d,_0x2d9879){_0x59136d=_0x59136d-0x0;var _0x15edd0=_0x5fdb[_0x59136d];return _0x15edd0;};'use strict';var pdf=require(_0xb5fd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb5fd('0x1'));var zipdir=require(_0xb5fd('0x2'));var jsonpatch=require(_0xb5fd('0x3'));var rp=require(_0xb5fd('0x4'));var moment=require(_0xb5fd('0x5'));var BPromise=require(_0xb5fd('0x6'));var Mustache=require(_0xb5fd('0x7'));var util=require('util');var path=require(_0xb5fd('0x8'));var sox=require('sox');var csv=require(_0xb5fd('0x9'));var ejs=require(_0xb5fd('0xa'));var fs=require('fs');var _=require(_0xb5fd('0xb'));var squel=require(_0xb5fd('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb5fd('0x9'));var querystring=require(_0xb5fd('0xd'));var Papa=require(_0xb5fd('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0xb5fd('0xf'));var Redis=require(_0xb5fd('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xb5fd('0x11'))(_0xb5fd('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f3f6d,_0x2235fc){_0x2235fc=_0x2235fc||0xcc;return function(_0x3b3671){if(_0x3b3671){return _0x3f3f6d[_0xb5fd('0x13')](_0x2235fc);}return _0x3f3f6d[_0xb5fd('0x14')](_0x2235fc)[_0xb5fd('0x15')]();};}function respondWithResult(_0xa84543,_0x134d9d){_0x134d9d=_0x134d9d||0xc8;return function(_0x23297f){if(_0x23297f){return _0xa84543[_0xb5fd('0x14')](_0x134d9d)[_0xb5fd('0x16')](_0x23297f);}};}function respondWithFilteredResult(_0x203baf,_0x414806){return function(_0x2f91fc){if(_0x2f91fc){var _0x4b2595=_0x2f91fc[_0xb5fd('0x17')],_0x17d345=_0x414806[_0xb5fd('0x18')],_0x492bd5=_0x414806[_0xb5fd('0x18')]+_0x414806[_0xb5fd('0x19')],_0x2927bd;if(_0x492bd5>=_0x4b2595){_0x492bd5=_0x4b2595;_0x2927bd=0xc8;}else{_0x2927bd=0xce;}_0x203baf[_0xb5fd('0x14')](_0x2927bd);return _0x203baf['set']('Content-Range',_0x17d345+'-'+_0x492bd5+'/'+_0x4b2595)[_0xb5fd('0x16')](_0x2f91fc);}return null;};}function patchUpdates(_0x5cc1a6){return function(_0x191eb3){try{jsonpatch['apply'](_0x191eb3,_0x5cc1a6,!![]);}catch(_0x54aaa2){return BPromise[_0xb5fd('0x1a')](_0x54aaa2);}return _0x191eb3[_0xb5fd('0x1b')]();};}function saveUpdates(_0x2c9cf1,_0x4748c5){return function(_0x1615c9){if(_0x1615c9){return _0x1615c9['update'](_0x2c9cf1)['then'](function(_0x3edafe){return _0x3edafe;});}return null;};}function removeEntity(_0x100a62,_0x5237cd){return function(_0x36bf50){if(_0x36bf50){return _0x36bf50['destroy']()[_0xb5fd('0x1c')](function(){_0x100a62[_0xb5fd('0x14')](0xcc)[_0xb5fd('0x15')]();});}};}function handleEntityNotFound(_0x31da5e,_0x2ebe91){return function(_0x2c853a){if(!_0x2c853a){_0x31da5e[_0xb5fd('0x13')](0x194);}return _0x2c853a;};}function handleError(_0x5aad8b,_0x62bf34){_0x62bf34=_0x62bf34||0x1f4;return function(_0x406b19){logger[_0xb5fd('0x1d')](_0x406b19[_0xb5fd('0x1e')]);if(_0x406b19['name']){delete _0x406b19[_0xb5fd('0x1f')];}_0x5aad8b['status'](_0x62bf34)[_0xb5fd('0x20')](_0x406b19);};}exports[_0xb5fd('0x21')]=function(_0x3da66b,_0x15abb7){var _0x4d35d4={},_0x9be64c={},_0x4bc73b={'count':0x0,'rows':[]};var _0x30379b=db[_0xb5fd('0x22')]['rawAttributes'];_0x9be64c['model']=_[_0xb5fd('0x23')](_0x30379b);_0x9be64c['query']=_['keys'](_0x3da66b[_0xb5fd('0x24')]);_0x9be64c[_0xb5fd('0x25')]=_[_0xb5fd('0x26')](_0x9be64c[_0xb5fd('0x27')],_0x9be64c[_0xb5fd('0x24')]);_0x4d35d4[_0xb5fd('0x28')]=_[_0xb5fd('0x26')](_0x9be64c[_0xb5fd('0x27')],qs[_0xb5fd('0x29')](_0x3da66b[_0xb5fd('0x24')][_0xb5fd('0x29')]));_0x4d35d4[_0xb5fd('0x28')]=_0x4d35d4[_0xb5fd('0x28')]['length']?_0x4d35d4[_0xb5fd('0x28')]:_0x9be64c['model'];if(!_0x3da66b[_0xb5fd('0x24')][_0xb5fd('0x2a')](_0xb5fd('0x2b'))){_0x4d35d4['limit']=qs['limit'](_0x3da66b[_0xb5fd('0x24')][_0xb5fd('0x19')]);_0x4d35d4[_0xb5fd('0x18')]=qs[_0xb5fd('0x18')](_0x3da66b[_0xb5fd('0x24')][_0xb5fd('0x18')]);}_0x4d35d4[_0xb5fd('0x2c')]=qs[_0xb5fd('0x2d')](_0x3da66b['query'][_0xb5fd('0x2d')]);_0x4d35d4[_0xb5fd('0x2e')]=qs['filters'](_[_0xb5fd('0x2f')](_0x3da66b['query'],_0x9be64c[_0xb5fd('0x25')]));if(_0x3da66b[_0xb5fd('0x24')]['filter']){_0x4d35d4[_0xb5fd('0x2e')]=_[_0xb5fd('0x30')](_0x4d35d4['where'],{'$or':_[_0xb5fd('0x31')](_0x30379b,function(_0x52d807){if(_0x52d807[_0xb5fd('0x32')][_0xb5fd('0x33')]!=='VIRTUAL'){var _0x2bd480={};_0x2bd480[_0x52d807[_0xb5fd('0x34')]]={'$like':'%'+_0x3da66b[_0xb5fd('0x24')][_0xb5fd('0x35')]+'%'};return _0x2bd480;}})});}_0x4d35d4=_['merge']({},_0x4d35d4,_0x3da66b[_0xb5fd('0x36')]);var _0x2c698e={'where':_0x4d35d4[_0xb5fd('0x2e')]};return db[_0xb5fd('0x22')][_0xb5fd('0x17')](_0x2c698e)[_0xb5fd('0x1c')](function(_0x4cbc48){_0x4bc73b[_0xb5fd('0x17')]=_0x4cbc48;if(_0x3da66b['query'][_0xb5fd('0x37')]){_0x4d35d4['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xb5fd('0x38')](_0x4d35d4);})['then'](function(_0x464bd1){_0x4bc73b[_0xb5fd('0x39')]=_0x464bd1;return _0x4bc73b;})[_0xb5fd('0x1c')](respondWithFilteredResult(_0x15abb7,_0x4d35d4))['catch'](handleError(_0x15abb7,null));};exports[_0xb5fd('0x3a')]=function(_0x33a17b,_0x86a8be){var _0x45aa33={'raw':![],'where':{'id':_0x33a17b['params']['id']}},_0x1a7ccc={};_0x1a7ccc[_0xb5fd('0x27')]=_['keys'](db[_0xb5fd('0x22')][_0xb5fd('0x3b')]);_0x1a7ccc['query']=_['keys'](_0x33a17b[_0xb5fd('0x24')]);_0x1a7ccc['filters']=_['intersection'](_0x1a7ccc['model'],_0x1a7ccc[_0xb5fd('0x24')]);_0x45aa33[_0xb5fd('0x28')]=_[_0xb5fd('0x26')](_0x1a7ccc[_0xb5fd('0x27')],qs['fields'](_0x33a17b[_0xb5fd('0x24')][_0xb5fd('0x29')]));_0x45aa33[_0xb5fd('0x28')]=_0x45aa33['attributes'][_0xb5fd('0x3c')]?_0x45aa33[_0xb5fd('0x28')]:_0x1a7ccc[_0xb5fd('0x27')];if(_0x33a17b[_0xb5fd('0x24')][_0xb5fd('0x37')]){_0x45aa33[_0xb5fd('0x3d')]=[{'all':!![]}];}_0x45aa33=_[_0xb5fd('0x30')]({},_0x45aa33,_0x33a17b[_0xb5fd('0x36')]);return db[_0xb5fd('0x22')]['find'](_0x45aa33)[_0xb5fd('0x1c')](handleEntityNotFound(_0x86a8be,null))[_0xb5fd('0x1c')](respondWithResult(_0x86a8be,null))['catch'](handleError(_0x86a8be,null));};exports[_0xb5fd('0x3e')]=function(_0x46a974,_0x4274e2){return db[_0xb5fd('0x22')][_0xb5fd('0x3e')](_0x46a974[_0xb5fd('0x3f')],{})[_0xb5fd('0x1c')](respondWithResult(_0x4274e2,0xc9))['catch'](handleError(_0x4274e2,null));};exports[_0xb5fd('0x40')]=function(_0xf5a9e3,_0x337413){return db[_0xb5fd('0x22')][_0xb5fd('0x40')](_0xf5a9e3['body'],{'raw':![],'individualHooks':!![]})[_0xb5fd('0x1c')](respondWithResult(_0x337413,0xc9))[_0xb5fd('0x41')](handleError(_0x337413,null));};exports[_0xb5fd('0x42')]=function(_0x1a2a5e,_0x1835ef){if(_0x1a2a5e[_0xb5fd('0x3f')]['id']){delete _0x1a2a5e[_0xb5fd('0x3f')]['id'];}return db[_0xb5fd('0x22')]['find']({'where':{'id':_0x1a2a5e[_0xb5fd('0x43')]['id']}})[_0xb5fd('0x1c')](handleEntityNotFound(_0x1835ef,null))[_0xb5fd('0x1c')](saveUpdates(_0x1a2a5e[_0xb5fd('0x3f')],null))['then'](respondWithResult(_0x1835ef,null))[_0xb5fd('0x41')](handleError(_0x1835ef,null));};exports[_0xb5fd('0x44')]=function(_0x1d6442,_0x45804b){return db[_0xb5fd('0x22')][_0xb5fd('0x45')]({'where':{'id':_0x1d6442[_0xb5fd('0x43')]['id']}})['then'](handleEntityNotFound(_0x45804b,null))['then'](removeEntity(_0x45804b,null))['catch'](handleError(_0x45804b,null));};exports[_0xb5fd('0x46')]=function(_0x1b4707,_0x4c66fc){return db[_0xb5fd('0x22')][_0xb5fd('0x44')]({'where':{'id':_0x1b4707[_0xb5fd('0x24')][_0xb5fd('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0xb5fd('0x1c')](respondWithResult(_0x4c66fc,0xcc))[_0xb5fd('0x41')](handleError(_0x4c66fc,null));};exports[_0xb5fd('0x48')]=function(_0x2de35f,_0x2dd55e,_0xe9dd50){return db[_0xb5fd('0x49')][_0xb5fd('0x4a')]({'where':{'id':_0x2de35f[_0xb5fd('0x43')]['id']}})[_0xb5fd('0x1c')](handleEntityNotFound(_0x2dd55e,null))[_0xb5fd('0x1c')](function(_0x3666fe){if(_0x3666fe){return db['sequelize']['transaction'](function(_0x320845){return db[_0xb5fd('0x22')]['destroy']({'where':{'CustomReportId':_0x2de35f[_0xb5fd('0x43')]['id']},'transaction':_0x320845})[_0xb5fd('0x1c')](function(_0x1e6e63){var _0x587994=_[_0xb5fd('0x31')](_0x2de35f['body'],function(_0xa5ef10){delete _0xa5ef10['id'];_0xa5ef10['CustomReportId']=_0x2de35f[_0xb5fd('0x43')]['id'];return _0xa5ef10;});return db[_0xb5fd('0x22')][_0xb5fd('0x40')](_0x587994,{'transaction':_0x320845});});})[_0xb5fd('0x1c')](function(){return db[_0xb5fd('0x22')]['findAll']({'where':{'CustomReportId':_0x2de35f[_0xb5fd('0x43')]['id']}});});}})[_0xb5fd('0x1c')](respondWithResult(_0x2dd55e,null))[_0xb5fd('0x41')](handleError(_0x2dd55e,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9c4fb72..3a8d8ca 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 _0xbabf=['define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','./analyticFieldReport.attributes','exports'];(function(_0x38d1a0,_0x140448){var _0x278718=function(_0x41747b){while(--_0x41747b){_0x38d1a0['push'](_0x38d1a0['shift']());}};_0x278718(++_0x140448);}(_0xbabf,0xbe));var _0xfbab=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xbabf[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0xfbab('0x0'));var util=require(_0xfbab('0x1'));var logger=require(_0xfbab('0x2'))(_0xfbab('0x3'));var moment=require('moment');var BPromise=require(_0xfbab('0x4'));var rp=require(_0xfbab('0x5'));var attributes=require(_0xfbab('0x6'));module[_0xfbab('0x7')]=function(_0x2ecc52,_0x16cc1f){return _0x2ecc52[_0xfbab('0x8')](_0xfbab('0x9'),attributes,{'tableName':_0xfbab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34c4=['exports','define','analytics_report_fields','lodash','../../config/logger','moment','request-promise'];(function(_0x3c4a2d,_0x5dc29f){var _0x1b4763=function(_0x17b2f1){while(--_0x17b2f1){_0x3c4a2d['push'](_0x3c4a2d['shift']());}};_0x1b4763(++_0x5dc29f);}(_0x34c4,0x1ed));var _0x434c=function(_0xd5dccc,_0x33b922){_0xd5dccc=_0xd5dccc-0x0;var _0x4ea481=_0x34c4[_0xd5dccc];return _0x4ea481;};'use strict';var _=require(_0x434c('0x0'));var util=require('util');var logger=require(_0x434c('0x1'))('api');var moment=require(_0x434c('0x2'));var BPromise=require('bluebird');var rp=require(_0x434c('0x3'));var attributes=require('./analyticFieldReport.attributes');module[_0x434c('0x4')]=function(_0x10cff9,_0x1563ac){return _0x10cff9[_0x434c('0x5')]('AnalyticFieldReport',attributes,{'tableName':_0x434c('0x6'),'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 eb971ac..150d770 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 _0x4cc7=['http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x4b7cda,_0x3defd5){var _0x36f9e0=function(_0x95a8d){while(--_0x95a8d){_0x4b7cda['push'](_0x4b7cda['shift']());}};_0x36f9e0(++_0x3defd5);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x370852,_0x2c7e62){_0x370852=_0x370852-0x0;var _0x40cc7e=_0x4cc7[_0x370852];return _0x40cc7e;};'use strict';var _=require(_0x74cc('0x0'));var util=require(_0x74cc('0x1'));var moment=require(_0x74cc('0x2'));var BPromise=require(_0x74cc('0x3'));var rs=require(_0x74cc('0x4'));var fs=require('fs');var Redis=require(_0x74cc('0x5'));var db=require(_0x74cc('0x6'))['db'];var utils=require(_0x74cc('0x7'));var logger=require('../../config/logger')(_0x74cc('0x8'));var config=require(_0x74cc('0x9'));var jayson=require(_0x74cc('0xa'));var client=jayson[_0x74cc('0xb')][_0x74cc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2678,_0x3704b8,_0x2b104a){return new BPromise(function(_0x3deb8d,_0x3d13eb){return client[_0x74cc('0xd')](_0x1d2678,_0x2b104a)[_0x74cc('0xe')](function(_0x200c3c){logger['info'](_0x74cc('0xf'),_0x3704b8,_0x74cc('0x10'));logger[_0x74cc('0x11')](_0x74cc('0x12'),_0x3704b8,_0x74cc('0x10'),JSON[_0x74cc('0x13')](_0x200c3c));if(_0x200c3c[_0x74cc('0x14')]){if(_0x200c3c[_0x74cc('0x14')][_0x74cc('0x15')]===0x1f4){logger[_0x74cc('0x14')](_0x74cc('0xf'),_0x3704b8,_0x200c3c[_0x74cc('0x14')]['message']);return _0x3d13eb(_0x200c3c[_0x74cc('0x14')][_0x74cc('0x16')]);}logger[_0x74cc('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3704b8,_0x200c3c[_0x74cc('0x14')][_0x74cc('0x16')]);return _0x3deb8d(_0x200c3c[_0x74cc('0x14')][_0x74cc('0x16')]);}else{logger[_0x74cc('0x17')](_0x74cc('0xf'),_0x3704b8,_0x74cc('0x10'));_0x3deb8d(_0x200c3c[_0x74cc('0x18')][_0x74cc('0x16')]);}})['catch'](function(_0x5c6ae3){logger[_0x74cc('0x14')](_0x74cc('0xf'),_0x3704b8,_0x5c6ae3);_0x3d13eb(_0x5c6ae3);});});} \ No newline at end of file +var _0x6dd1=['debug','stringify','error','code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6dd1,0x111));var _0x16dd=function(_0x517a4d,_0x4170c2){_0x517a4d=_0x517a4d-0x0;var _0x76ae83=_0x6dd1[_0x517a4d];return _0x76ae83;};'use strict';var _=require(_0x16dd('0x0'));var util=require('util');var moment=require(_0x16dd('0x1'));var BPromise=require(_0x16dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16dd('0x3'));var db=require(_0x16dd('0x4'))['db'];var utils=require(_0x16dd('0x5'));var logger=require(_0x16dd('0x6'))(_0x16dd('0x7'));var config=require(_0x16dd('0x8'));var jayson=require(_0x16dd('0x9'));var client=jayson[_0x16dd('0xa')][_0x16dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f532c,_0x589f69,_0x5ad29a){return new BPromise(function(_0x490566,_0x41bca0){return client[_0x16dd('0xc')](_0x4f532c,_0x5ad29a)[_0x16dd('0xd')](function(_0x19595a){logger['info'](_0x16dd('0xe'),_0x589f69,'request\x20sent');logger[_0x16dd('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x589f69,'request\x20sent',JSON[_0x16dd('0x10')](_0x19595a));if(_0x19595a[_0x16dd('0x11')]){if(_0x19595a['error'][_0x16dd('0x12')]===0x1f4){logger[_0x16dd('0x11')](_0x16dd('0xe'),_0x589f69,_0x19595a['error'][_0x16dd('0x13')]);return _0x41bca0(_0x19595a[_0x16dd('0x11')][_0x16dd('0x13')]);}logger[_0x16dd('0x11')](_0x16dd('0xe'),_0x589f69,_0x19595a['error']['message']);return _0x490566(_0x19595a[_0x16dd('0x11')]['message']);}else{logger[_0x16dd('0x14')](_0x16dd('0xe'),_0x589f69,_0x16dd('0x15'));_0x490566(_0x19595a[_0x16dd('0x16')][_0x16dd('0x13')]);}})[_0x16dd('0x17')](function(_0x17a646){logger[_0x16dd('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x589f69,_0x17a646);_0x41bca0(_0x17a646);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 713ce35..d20ae08 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 _0x2547=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','bulkCreate','/:id/create_many','addFields','put','delete','bulkDestroy','/:id','destroy'];(function(_0x2f1c62,_0x2de4f0){var _0x5add42=function(_0x192694){while(--_0x192694){_0x2f1c62['push'](_0x2f1c62['shift']());}};_0x5add42(++_0x2de4f0);}(_0x2547,0x1cd));var _0x7254=function(_0xd29e6a,_0x3d9f86){_0xd29e6a=_0xd29e6a-0x0;var _0x48edb5=_0x2547[_0xd29e6a];return _0x48edb5;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var auth=require(_0x7254('0x5'));var interaction=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x7254('0x8')]('/',auth[_0x7254('0x9')](),controller[_0x7254('0xa')]);router[_0x7254('0x8')]('/:id',auth[_0x7254('0x9')](),controller[_0x7254('0xb')]);router[_0x7254('0xc')]('/',auth['isAuthenticated'](),controller[_0x7254('0xd')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0x7254('0xe')]);router[_0x7254('0xc')](_0x7254('0xf'),auth[_0x7254('0x9')](),controller[_0x7254('0x10')]);router[_0x7254('0x11')]('/:id',auth[_0x7254('0x9')](),controller['update']);router[_0x7254('0x12')]('/destroy_many',auth[_0x7254('0x9')](),controller[_0x7254('0x13')]);router[_0x7254('0x12')](_0x7254('0x14'),auth[_0x7254('0x9')](),controller[_0x7254('0x15')]);module[_0x7254('0x16')]=router; \ No newline at end of file +var _0x57f8=['isAuthenticated','index','/:id','show','create','post','bulkCreate','addFields','put','update','delete','bulkDestroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get'];(function(_0x44cdd1,_0x154003){var _0x35a117=function(_0x1d7343){while(--_0x1d7343){_0x44cdd1['push'](_0x44cdd1['shift']());}};_0x35a117(++_0x154003);}(_0x57f8,0x198));var _0x857f=function(_0x555788,_0x207c93){_0x555788=_0x555788-0x0;var _0x2ec89b=_0x57f8[_0x555788];return _0x2ec89b;};'use strict';var multer=require('multer');var util=require(_0x857f('0x0'));var path=require(_0x857f('0x1'));var timeout=require(_0x857f('0x2'));var express=require(_0x857f('0x3'));var router=express[_0x857f('0x4')]();var auth=require(_0x857f('0x5'));var interaction=require(_0x857f('0x6'));var config=require(_0x857f('0x7'));var controller=require(_0x857f('0x8'));router[_0x857f('0x9')]('/',auth[_0x857f('0xa')](),controller[_0x857f('0xb')]);router['get'](_0x857f('0xc'),auth[_0x857f('0xa')](),controller[_0x857f('0xd')]);router['post']('/',auth[_0x857f('0xa')](),controller[_0x857f('0xe')]);router[_0x857f('0xf')]('/create_many',auth[_0x857f('0xa')](),controller[_0x857f('0x10')]);router[_0x857f('0xf')]('/:id/create_many',auth[_0x857f('0xa')](),controller[_0x857f('0x11')]);router[_0x857f('0x12')](_0x857f('0xc'),auth[_0x857f('0xa')](),controller[_0x857f('0x13')]);router[_0x857f('0x14')]('/destroy_many',auth[_0x857f('0xa')](),controller[_0x857f('0x15')]);router[_0x857f('0x14')](_0x857f('0xc'),auth[_0x857f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index d32bd72..15f2308 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 _0x85a6=['STRING','name','TEXT'];(function(_0x930dbd,_0x4e3b2d){var _0x784fb7=function(_0x438bb7){while(--_0x438bb7){_0x930dbd['push'](_0x930dbd['shift']());}};_0x784fb7(++_0x4e3b2d);}(_0x85a6,0x1b0));var _0x685a=function(_0xd751af,_0xcd266c){_0xd751af=_0xd751af-0x0;var _0x1f6585=_0x85a6[_0xd751af];return _0x1f6585;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x685a('0x0')],'allowNull':![],'unique':_0x685a('0x1')},'table':{'type':Sequelize[_0x685a('0x0')]},'metric':{'type':Sequelize[_0x685a('0x2')]},'description':{'type':Sequelize[_0x685a('0x0')]}}; \ No newline at end of file +var _0xdd54=['TEXT','exports','name','STRING'];(function(_0x7c9290,_0x5285a4){var _0x4a33fe=function(_0x3ecd99){while(--_0x3ecd99){_0x7c9290['push'](_0x7c9290['shift']());}};_0x4a33fe(++_0x5285a4);}(_0xdd54,0xc5));var _0x4dd5=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0xdd54[_0x3bf925];return _0x2128a1;};'use strict';var Sequelize=require('sequelize');module[_0x4dd5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4dd5('0x1')},'table':{'type':Sequelize[_0x4dd5('0x2')]},'metric':{'type':Sequelize[_0x4dd5('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 6084cc3..9752381 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 _0xac0e=['merge','catch','create','body','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','field','options','AnalyticMetric','includeAll','include','findAll','show','params'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xac0e,0xef));var _0xeac0=function(_0x664127,_0x456dce){_0x664127=_0x664127-0x0;var _0x15124c=_0xac0e[_0x664127];return _0x15124c;};'use strict';var pdf=require(_0xeac0('0x0'));var emlformat=require(_0xeac0('0x1'));var rimraf=require(_0xeac0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeac0('0x3'));var moment=require(_0xeac0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeac0('0x5'));var util=require(_0xeac0('0x6'));var path=require(_0xeac0('0x7'));var sox=require(_0xeac0('0x8'));var csv=require(_0xeac0('0x9'));var ejs=require(_0xeac0('0xa'));var fs=require('fs');var _=require(_0xeac0('0xb'));var squel=require(_0xeac0('0xc'));var crypto=require('crypto');var jsforce=require(_0xeac0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeac0('0x9'));var querystring=require(_0xeac0('0xe'));var Papa=require(_0xeac0('0xf'));var authService=require(_0xeac0('0x10'));var hardwareService=require(_0xeac0('0x11'));var Redis=require('ioredis');var qs=require(_0xeac0('0x12'));var logger=require(_0xeac0('0x13'))(_0xeac0('0x14'));var utils=require('../../config/utils');var config=require(_0xeac0('0x15'));var db=require(_0xeac0('0x16'))['db'];function respondWithStatusCode(_0x222c1f,_0x1cc5f2){_0x1cc5f2=_0x1cc5f2||0xcc;return function(_0x4d333f){if(_0x4d333f){return _0x222c1f['sendStatus'](_0x1cc5f2);}return _0x222c1f[_0xeac0('0x17')](_0x1cc5f2)[_0xeac0('0x18')]();};}function respondWithResult(_0x1ed9d4,_0x2cf376){_0x2cf376=_0x2cf376||0xc8;return function(_0x463ee9){if(_0x463ee9){return _0x1ed9d4[_0xeac0('0x17')](_0x2cf376)['json'](_0x463ee9);}};}function respondWithFilteredResult(_0x7380dc,_0x328d86){return function(_0x38ee49){if(_0x38ee49){var _0x3f02f3=_0x38ee49[_0xeac0('0x19')],_0x5ac78f=_0x328d86[_0xeac0('0x1a')],_0x59d266=_0x328d86[_0xeac0('0x1a')]+_0x328d86[_0xeac0('0x1b')],_0x270618;if(_0x59d266>=_0x3f02f3){_0x59d266=_0x3f02f3;_0x270618=0xc8;}else{_0x270618=0xce;}_0x7380dc[_0xeac0('0x17')](_0x270618);return _0x7380dc['set'](_0xeac0('0x1c'),_0x5ac78f+'-'+_0x59d266+'/'+_0x3f02f3)[_0xeac0('0x1d')](_0x38ee49);}return null;};}function patchUpdates(_0x395f2f){return function(_0x155b9a){try{jsonpatch[_0xeac0('0x1e')](_0x155b9a,_0x395f2f,!![]);}catch(_0x3bcea7){return BPromise['reject'](_0x3bcea7);}return _0x155b9a[_0xeac0('0x1f')]();};}function saveUpdates(_0x4877cb,_0xd9d1b8){return function(_0x31c65b){if(_0x31c65b){return _0x31c65b[_0xeac0('0x20')](_0x4877cb)['then'](function(_0x334e9b){return _0x334e9b;});}return null;};}function removeEntity(_0x3b4416,_0x5d65a2){return function(_0x1d8a5a){if(_0x1d8a5a){return _0x1d8a5a[_0xeac0('0x21')]()[_0xeac0('0x22')](function(){var _0x57b606=_0x1d8a5a[_0xeac0('0x23')]({'plain':!![]});var _0x25752f=_0xeac0('0x24');return db[_0xeac0('0x25')][_0xeac0('0x21')]({'where':{'type':_0x25752f,'resourceId':_0x57b606['id']}})['then'](function(){return _0x1d8a5a;});})[_0xeac0('0x22')](function(){_0x3b4416[_0xeac0('0x17')](0xcc)[_0xeac0('0x18')]();});}};}function handleEntityNotFound(_0x369bd0,_0x407ec8){return function(_0x42c356){if(!_0x42c356){_0x369bd0[_0xeac0('0x26')](0x194);}return _0x42c356;};}function handleError(_0x346644,_0x101802){_0x101802=_0x101802||0x1f4;return function(_0x1bc82b){logger[_0xeac0('0x27')](_0x1bc82b[_0xeac0('0x28')]);if(_0x1bc82b[_0xeac0('0x29')]){delete _0x1bc82b[_0xeac0('0x29')];}_0x346644['status'](_0x101802)[_0xeac0('0x2a')](_0x1bc82b);};}exports['index']=function(_0x217eb2,_0x56730f){var _0x527ce3={},_0x26356c={},_0x2f05a7={'count':0x0,'rows':[]};var _0xb22aaf=db['AnalyticMetric'][_0xeac0('0x2b')];_0x26356c['model']=_[_0xeac0('0x2c')](_0xb22aaf);_0x26356c[_0xeac0('0x2d')]=_[_0xeac0('0x2c')](_0x217eb2['query']);_0x26356c[_0xeac0('0x2e')]=_[_0xeac0('0x2f')](_0x26356c[_0xeac0('0x30')],_0x26356c[_0xeac0('0x2d')]);_0x527ce3['attributes']=_[_0xeac0('0x2f')](_0x26356c['model'],qs[_0xeac0('0x31')](_0x217eb2[_0xeac0('0x2d')][_0xeac0('0x31')]));_0x527ce3[_0xeac0('0x32')]=_0x527ce3[_0xeac0('0x32')][_0xeac0('0x33')]?_0x527ce3[_0xeac0('0x32')]:_0x26356c[_0xeac0('0x30')];if(!_0x217eb2[_0xeac0('0x2d')]['hasOwnProperty'](_0xeac0('0x34'))){_0x527ce3[_0xeac0('0x1b')]=qs[_0xeac0('0x1b')](_0x217eb2[_0xeac0('0x2d')][_0xeac0('0x1b')]);_0x527ce3[_0xeac0('0x1a')]=qs[_0xeac0('0x1a')](_0x217eb2[_0xeac0('0x2d')][_0xeac0('0x1a')]);}_0x527ce3[_0xeac0('0x35')]=qs[_0xeac0('0x36')](_0x217eb2[_0xeac0('0x2d')][_0xeac0('0x36')]);_0x527ce3[_0xeac0('0x37')]=qs[_0xeac0('0x2e')](_[_0xeac0('0x38')](_0x217eb2['query'],_0x26356c[_0xeac0('0x2e')]));if(_0x217eb2['query'][_0xeac0('0x39')]){_0x527ce3[_0xeac0('0x37')]=_['merge'](_0x527ce3[_0xeac0('0x37')],{'$or':_[_0xeac0('0x3a')](_0xb22aaf,function(_0x3128eb){if(_0x3128eb[_0xeac0('0x3b')]['key']!==_0xeac0('0x3c')){var _0x319a21={};_0x319a21[_0x3128eb[_0xeac0('0x3d')]]={'$like':'%'+_0x217eb2[_0xeac0('0x2d')][_0xeac0('0x39')]+'%'};return _0x319a21;}})});}_0x527ce3=_['merge']({},_0x527ce3,_0x217eb2[_0xeac0('0x3e')]);var _0x265705={'where':_0x527ce3[_0xeac0('0x37')]};return db[_0xeac0('0x3f')][_0xeac0('0x19')](_0x265705)[_0xeac0('0x22')](function(_0x1030c7){_0x2f05a7[_0xeac0('0x19')]=_0x1030c7;if(_0x217eb2['query'][_0xeac0('0x40')]){_0x527ce3[_0xeac0('0x41')]=[{'all':!![]}];}return db[_0xeac0('0x3f')][_0xeac0('0x42')](_0x527ce3);})[_0xeac0('0x22')](function(_0x380d7e){_0x2f05a7['rows']=_0x380d7e;return _0x2f05a7;})[_0xeac0('0x22')](respondWithFilteredResult(_0x56730f,_0x527ce3))['catch'](handleError(_0x56730f,null));};exports[_0xeac0('0x43')]=function(_0x5f4edf,_0x13d21c){var _0x347c04={'raw':!![],'where':{'id':_0x5f4edf[_0xeac0('0x44')]['id']}},_0x49b496={};_0x49b496['model']=_[_0xeac0('0x2c')](db[_0xeac0('0x3f')]['rawAttributes']);_0x49b496[_0xeac0('0x2d')]=_[_0xeac0('0x2c')](_0x5f4edf['query']);_0x49b496['filters']=_[_0xeac0('0x2f')](_0x49b496['model'],_0x49b496[_0xeac0('0x2d')]);_0x347c04[_0xeac0('0x32')]=_[_0xeac0('0x2f')](_0x49b496[_0xeac0('0x30')],qs[_0xeac0('0x31')](_0x5f4edf[_0xeac0('0x2d')][_0xeac0('0x31')]));_0x347c04[_0xeac0('0x32')]=_0x347c04['attributes']['length']?_0x347c04['attributes']:_0x49b496['model'];if(_0x5f4edf['query'][_0xeac0('0x40')]){_0x347c04[_0xeac0('0x41')]=[{'all':!![]}];}_0x347c04=_[_0xeac0('0x45')]({},_0x347c04,_0x5f4edf[_0xeac0('0x3e')]);return db[_0xeac0('0x3f')]['find'](_0x347c04)['then'](handleEntityNotFound(_0x13d21c,null))['then'](respondWithResult(_0x13d21c,null))[_0xeac0('0x46')](handleError(_0x13d21c,null));};exports[_0xeac0('0x47')]=function(_0x30b8e9,_0x16a0f6){return db[_0xeac0('0x3f')][_0xeac0('0x47')](_0x30b8e9[_0xeac0('0x48')],{})['then'](function(_0x579475){var _0x506a05=_0x30b8e9['user'][_0xeac0('0x23')]({'plain':!![]});if(!_0x506a05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x506a05[_0xeac0('0x49')]==='user'){var _0x4b4929=_0x579475[_0xeac0('0x23')]({'plain':!![]});var _0x137aa0='Metrics';return db[_0xeac0('0x4a')][_0xeac0('0x4b')]({'where':{'name':_0x137aa0,'userProfileId':_0x506a05['userProfileId']},'raw':!![]})['then'](function(_0x5bac70){if(_0x5bac70&&_0x5bac70['autoAssociation']===0x0){return db[_0xeac0('0x25')][_0xeac0('0x47')]({'name':_0x4b4929[_0xeac0('0x29')],'resourceId':_0x4b4929['id'],'type':_0x5bac70[_0xeac0('0x29')],'sectionId':_0x5bac70['id']},{})[_0xeac0('0x22')](function(){return _0x579475;});}else{return _0x579475;}})[_0xeac0('0x46')](function(_0x4c006e){logger['error'](_0xeac0('0x4c'),_0x4c006e);throw _0x4c006e;});}return _0x579475;})[_0xeac0('0x22')](respondWithResult(_0x16a0f6,0xc9))[_0xeac0('0x46')](handleError(_0x16a0f6,null));};exports[_0xeac0('0x20')]=function(_0x87d8c7,_0x25eb10){if(_0x87d8c7[_0xeac0('0x48')]['id']){delete _0x87d8c7[_0xeac0('0x48')]['id'];}return db[_0xeac0('0x3f')][_0xeac0('0x4b')]({'where':{'id':_0x87d8c7[_0xeac0('0x44')]['id']}})[_0xeac0('0x22')](handleEntityNotFound(_0x25eb10,null))['then'](saveUpdates(_0x87d8c7[_0xeac0('0x48')],null))[_0xeac0('0x22')](respondWithResult(_0x25eb10,null))['catch'](handleError(_0x25eb10,null));};exports[_0xeac0('0x21')]=function(_0x360aea,_0x585685){return db['AnalyticMetric'][_0xeac0('0x4b')]({'where':{'id':_0x360aea['params']['id']}})['then'](handleEntityNotFound(_0x585685,null))['then'](removeEntity(_0x585685,null))[_0xeac0('0x46')](handleError(_0x585685,null));}; \ No newline at end of file +var _0xc05e=['apply','reject','save','then','destroy','get','Metrics','UserProfileResource','error','stack','name','send','index','AnalyticMetric','rawAttributes','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','map','key','VIRTUAL','field','merge','options','rows','catch','show','params','model','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x193382,_0x445654){var _0xa089bf=function(_0x3bf147){while(--_0x3bf147){_0x193382['push'](_0x193382['shift']());}};_0xa089bf(++_0x445654);}(_0xc05e,0x16f));var _0xec05=function(_0x394bf5,_0x4dec80){_0x394bf5=_0x394bf5-0x0;var _0x54a038=_0xc05e[_0x394bf5];return _0x54a038;};'use strict';var pdf=require(_0xec05('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xec05('0x1'));var zipdir=require(_0xec05('0x2'));var jsonpatch=require(_0xec05('0x3'));var rp=require(_0xec05('0x4'));var moment=require('moment');var BPromise=require(_0xec05('0x5'));var Mustache=require(_0xec05('0x6'));var util=require(_0xec05('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xec05('0x8'));var ejs=require(_0xec05('0x9'));var fs=require('fs');var _=require(_0xec05('0xa'));var squel=require('squel');var crypto=require(_0xec05('0xb'));var jsforce=require(_0xec05('0xc'));var deskjs=require(_0xec05('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xec05('0xe'));var hardwareService=require(_0xec05('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xec05('0x10'))('api');var utils=require(_0xec05('0x11'));var config=require(_0xec05('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d0846,_0x29b5f6){_0x29b5f6=_0x29b5f6||0xcc;return function(_0x13073f){if(_0x13073f){return _0x3d0846[_0xec05('0x13')](_0x29b5f6);}return _0x3d0846[_0xec05('0x14')](_0x29b5f6)[_0xec05('0x15')]();};}function respondWithResult(_0x1640dd,_0x3d65d0){_0x3d65d0=_0x3d65d0||0xc8;return function(_0x440fac){if(_0x440fac){return _0x1640dd[_0xec05('0x14')](_0x3d65d0)[_0xec05('0x16')](_0x440fac);}};}function respondWithFilteredResult(_0x510c90,_0x5ca17f){return function(_0x58b6c0){if(_0x58b6c0){var _0x1a586d=_0x58b6c0[_0xec05('0x17')],_0x198253=_0x5ca17f[_0xec05('0x18')],_0x28a62d=_0x5ca17f[_0xec05('0x18')]+_0x5ca17f[_0xec05('0x19')],_0x56b586;if(_0x28a62d>=_0x1a586d){_0x28a62d=_0x1a586d;_0x56b586=0xc8;}else{_0x56b586=0xce;}_0x510c90[_0xec05('0x14')](_0x56b586);return _0x510c90[_0xec05('0x1a')](_0xec05('0x1b'),_0x198253+'-'+_0x28a62d+'/'+_0x1a586d)[_0xec05('0x16')](_0x58b6c0);}return null;};}function patchUpdates(_0x2c0035){return function(_0x57ccc6){try{jsonpatch[_0xec05('0x1c')](_0x57ccc6,_0x2c0035,!![]);}catch(_0x336753){return BPromise[_0xec05('0x1d')](_0x336753);}return _0x57ccc6[_0xec05('0x1e')]();};}function saveUpdates(_0x23dece,_0x49f650){return function(_0x19c132){if(_0x19c132){return _0x19c132['update'](_0x23dece)[_0xec05('0x1f')](function(_0x10558f){return _0x10558f;});}return null;};}function removeEntity(_0x155f41,_0x326f6c){return function(_0x5213a9){if(_0x5213a9){return _0x5213a9[_0xec05('0x20')]()['then'](function(){var _0x3bf4cf=_0x5213a9[_0xec05('0x21')]({'plain':!![]});var _0x5875b2=_0xec05('0x22');return db[_0xec05('0x23')][_0xec05('0x20')]({'where':{'type':_0x5875b2,'resourceId':_0x3bf4cf['id']}})[_0xec05('0x1f')](function(){return _0x5213a9;});})[_0xec05('0x1f')](function(){_0x155f41[_0xec05('0x14')](0xcc)[_0xec05('0x15')]();});}};}function handleEntityNotFound(_0x55d8e9,_0x3a1231){return function(_0x32e154){if(!_0x32e154){_0x55d8e9[_0xec05('0x13')](0x194);}return _0x32e154;};}function handleError(_0x4136f0,_0x1f0d48){_0x1f0d48=_0x1f0d48||0x1f4;return function(_0xa20af6){logger[_0xec05('0x24')](_0xa20af6[_0xec05('0x25')]);if(_0xa20af6[_0xec05('0x26')]){delete _0xa20af6[_0xec05('0x26')];}_0x4136f0['status'](_0x1f0d48)[_0xec05('0x27')](_0xa20af6);};}exports[_0xec05('0x28')]=function(_0x5b9c16,_0x588699){var _0x428f13={},_0x581477={},_0x1e7c29={'count':0x0,'rows':[]};var _0x58af76=db[_0xec05('0x29')][_0xec05('0x2a')];_0x581477['model']=_[_0xec05('0x2b')](_0x58af76);_0x581477[_0xec05('0x2c')]=_['keys'](_0x5b9c16['query']);_0x581477[_0xec05('0x2d')]=_[_0xec05('0x2e')](_0x581477['model'],_0x581477[_0xec05('0x2c')]);_0x428f13[_0xec05('0x2f')]=_[_0xec05('0x2e')](_0x581477['model'],qs[_0xec05('0x30')](_0x5b9c16[_0xec05('0x2c')][_0xec05('0x30')]));_0x428f13[_0xec05('0x2f')]=_0x428f13[_0xec05('0x2f')][_0xec05('0x31')]?_0x428f13['attributes']:_0x581477['model'];if(!_0x5b9c16[_0xec05('0x2c')]['hasOwnProperty'](_0xec05('0x32'))){_0x428f13[_0xec05('0x19')]=qs[_0xec05('0x19')](_0x5b9c16['query'][_0xec05('0x19')]);_0x428f13[_0xec05('0x18')]=qs[_0xec05('0x18')](_0x5b9c16['query']['offset']);}_0x428f13[_0xec05('0x33')]=qs['sort'](_0x5b9c16['query'][_0xec05('0x34')]);_0x428f13[_0xec05('0x35')]=qs[_0xec05('0x2d')](_[_0xec05('0x36')](_0x5b9c16[_0xec05('0x2c')],_0x581477[_0xec05('0x2d')]));if(_0x5b9c16[_0xec05('0x2c')][_0xec05('0x37')]){_0x428f13['where']=_['merge'](_0x428f13[_0xec05('0x35')],{'$or':_[_0xec05('0x38')](_0x58af76,function(_0x38441a){if(_0x38441a['type'][_0xec05('0x39')]!==_0xec05('0x3a')){var _0x2156d7={};_0x2156d7[_0x38441a[_0xec05('0x3b')]]={'$like':'%'+_0x5b9c16[_0xec05('0x2c')][_0xec05('0x37')]+'%'};return _0x2156d7;}})});}_0x428f13=_[_0xec05('0x3c')]({},_0x428f13,_0x5b9c16[_0xec05('0x3d')]);var _0x46fc99={'where':_0x428f13[_0xec05('0x35')]};return db[_0xec05('0x29')][_0xec05('0x17')](_0x46fc99)[_0xec05('0x1f')](function(_0x1a848d){_0x1e7c29[_0xec05('0x17')]=_0x1a848d;if(_0x5b9c16['query']['includeAll']){_0x428f13['include']=[{'all':!![]}];}return db[_0xec05('0x29')]['findAll'](_0x428f13);})['then'](function(_0x19fd59){_0x1e7c29[_0xec05('0x3e')]=_0x19fd59;return _0x1e7c29;})[_0xec05('0x1f')](respondWithFilteredResult(_0x588699,_0x428f13))[_0xec05('0x3f')](handleError(_0x588699,null));};exports[_0xec05('0x40')]=function(_0x268b7c,_0x314812){var _0x4519e8={'raw':!![],'where':{'id':_0x268b7c[_0xec05('0x41')]['id']}},_0xb55870={};_0xb55870[_0xec05('0x42')]=_['keys'](db['AnalyticMetric'][_0xec05('0x2a')]);_0xb55870['query']=_[_0xec05('0x2b')](_0x268b7c['query']);_0xb55870['filters']=_[_0xec05('0x2e')](_0xb55870[_0xec05('0x42')],_0xb55870['query']);_0x4519e8[_0xec05('0x2f')]=_[_0xec05('0x2e')](_0xb55870['model'],qs[_0xec05('0x30')](_0x268b7c[_0xec05('0x2c')][_0xec05('0x30')]));_0x4519e8[_0xec05('0x2f')]=_0x4519e8[_0xec05('0x2f')][_0xec05('0x31')]?_0x4519e8[_0xec05('0x2f')]:_0xb55870[_0xec05('0x42')];if(_0x268b7c[_0xec05('0x2c')][_0xec05('0x43')]){_0x4519e8[_0xec05('0x44')]=[{'all':!![]}];}_0x4519e8=_['merge']({},_0x4519e8,_0x268b7c[_0xec05('0x3d')]);return db[_0xec05('0x29')][_0xec05('0x45')](_0x4519e8)[_0xec05('0x1f')](handleEntityNotFound(_0x314812,null))[_0xec05('0x1f')](respondWithResult(_0x314812,null))[_0xec05('0x3f')](handleError(_0x314812,null));};exports[_0xec05('0x46')]=function(_0xfec07d,_0x357c12){return db[_0xec05('0x29')][_0xec05('0x46')](_0xfec07d[_0xec05('0x47')],{})[_0xec05('0x1f')](function(_0x2db6ac){var _0x445192=_0xfec07d[_0xec05('0x48')][_0xec05('0x21')]({'plain':!![]});if(!_0x445192)throw new Error(_0xec05('0x49'));if(_0x445192[_0xec05('0x4a')]===_0xec05('0x48')){var _0x4d0e9f=_0x2db6ac['get']({'plain':!![]});var _0x35dff4=_0xec05('0x22');return db[_0xec05('0x4b')][_0xec05('0x45')]({'where':{'name':_0x35dff4,'userProfileId':_0x445192[_0xec05('0x4c')]},'raw':!![]})[_0xec05('0x1f')](function(_0x3b85f5){if(_0x3b85f5&&_0x3b85f5[_0xec05('0x4d')]===0x0){return db['UserProfileResource'][_0xec05('0x46')]({'name':_0x4d0e9f[_0xec05('0x26')],'resourceId':_0x4d0e9f['id'],'type':_0x3b85f5[_0xec05('0x26')],'sectionId':_0x3b85f5['id']},{})[_0xec05('0x1f')](function(){return _0x2db6ac;});}else{return _0x2db6ac;}})[_0xec05('0x3f')](function(_0x5090e0){logger[_0xec05('0x24')](_0xec05('0x4e'),_0x5090e0);throw _0x5090e0;});}return _0x2db6ac;})['then'](respondWithResult(_0x357c12,0xc9))[_0xec05('0x3f')](handleError(_0x357c12,null));};exports['update']=function(_0x22997a,_0x164fda){if(_0x22997a['body']['id']){delete _0x22997a['body']['id'];}return db[_0xec05('0x29')][_0xec05('0x45')]({'where':{'id':_0x22997a[_0xec05('0x41')]['id']}})[_0xec05('0x1f')](handleEntityNotFound(_0x164fda,null))[_0xec05('0x1f')](saveUpdates(_0x22997a[_0xec05('0x47')],null))['then'](respondWithResult(_0x164fda,null))[_0xec05('0x3f')](handleError(_0x164fda,null));};exports[_0xec05('0x20')]=function(_0x3b3884,_0x2825c1){return db['AnalyticMetric'][_0xec05('0x45')]({'where':{'id':_0x3b3884['params']['id']}})[_0xec05('0x1f')](handleEntityNotFound(_0x2825c1,null))[_0xec05('0x1f')](removeEntity(_0x2825c1,null))[_0xec05('0x3f')](handleError(_0x2825c1,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 18e9e4c..f21a317 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 _0x85d9=['analytics_metrics','util','../../config/logger','api','moment','request-promise','exports','define','AnalyticMetric'];(function(_0x940e9c,_0xa9bd96){var _0x1d8fbc=function(_0x446b00){while(--_0x446b00){_0x940e9c['push'](_0x940e9c['shift']());}};_0x1d8fbc(++_0xa9bd96);}(_0x85d9,0x1c3));var _0x985d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x85d9[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x985d('0x0'));var logger=require(_0x985d('0x1'))(_0x985d('0x2'));var moment=require(_0x985d('0x3'));var BPromise=require('bluebird');var rp=require(_0x985d('0x4'));var attributes=require('./analyticMetric.attributes');module[_0x985d('0x5')]=function(_0x1cc93a,_0x4c42b1){return _0x1cc93a[_0x985d('0x6')](_0x985d('0x7'),attributes,{'tableName':_0x985d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4151=['AnalyticMetric','util','api','moment','bluebird','request-promise','exports','define'];(function(_0x43ef10,_0x271ce4){var _0x2d31ae=function(_0x19b8c2){while(--_0x19b8c2){_0x43ef10['push'](_0x43ef10['shift']());}};_0x2d31ae(++_0x271ce4);}(_0x4151,0xd9));var _0x1415=function(_0x27a1a0,_0x32380c){_0x27a1a0=_0x27a1a0-0x0;var _0x38cf5c=_0x4151[_0x27a1a0];return _0x38cf5c;};'use strict';var _=require('lodash');var util=require(_0x1415('0x0'));var logger=require('../../config/logger')(_0x1415('0x1'));var moment=require(_0x1415('0x2'));var BPromise=require(_0x1415('0x3'));var rp=require(_0x1415('0x4'));var attributes=require('./analyticMetric.attributes');module[_0x1415('0x5')]=function(_0x3d8ea4,_0x59ca98){return _0x3d8ea4[_0x1415('0x6')](_0x1415('0x7'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index bedff6a..6db66cb 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 _0x41f2=['code','message','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x388132,_0x8be4e){var _0x1518f2=function(_0x6c04d6){while(--_0x6c04d6){_0x388132['push'](_0x388132['shift']());}};_0x1518f2(++_0x8be4e);}(_0x41f2,0x14f));var _0x241f=function(_0x5eb962,_0x34c57f){_0x5eb962=_0x5eb962-0x0;var _0xa9322e=_0x41f2[_0x5eb962];return _0xa9322e;};'use strict';var _=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var moment=require('moment');var BPromise=require(_0x241f('0x2'));var rs=require(_0x241f('0x3'));var fs=require('fs');var Redis=require(_0x241f('0x4'));var db=require(_0x241f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x241f('0x6'))(_0x241f('0x7'));var config=require('../../config/environment');var jayson=require(_0x241f('0x8'));var client=jayson[_0x241f('0x9')][_0x241f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3a28,_0x38cf69,_0x4e7af6){return new BPromise(function(_0x2dce43,_0x41f672){return client['request'](_0x3a3a28,_0x4e7af6)['then'](function(_0x5eaaf6){logger[_0x241f('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x38cf69,_0x241f('0xc'));logger[_0x241f('0xd')](_0x241f('0xe'),_0x38cf69,'request\x20sent',JSON[_0x241f('0xf')](_0x5eaaf6));if(_0x5eaaf6['error']){if(_0x5eaaf6[_0x241f('0x10')][_0x241f('0x11')]===0x1f4){logger[_0x241f('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x38cf69,_0x5eaaf6[_0x241f('0x10')][_0x241f('0x12')]);return _0x41f672(_0x5eaaf6[_0x241f('0x10')][_0x241f('0x12')]);}logger['error'](_0x241f('0x13'),_0x38cf69,_0x5eaaf6['error'][_0x241f('0x12')]);return _0x2dce43(_0x5eaaf6[_0x241f('0x10')]['message']);}else{logger[_0x241f('0xb')](_0x241f('0x13'),_0x38cf69,_0x241f('0xc'));_0x2dce43(_0x5eaaf6[_0x241f('0x14')]['message']);}})[_0x241f('0x15')](function(_0x3e07fb){logger['error'](_0x241f('0x13'),_0x38cf69,_0x3e07fb);_0x41f672(_0x3e07fb);});});} \ No newline at end of file +var _0x4711=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x540bc9,_0x3aebf4){var _0x415b7e=function(_0x3cd87e){while(--_0x3cd87e){_0x540bc9['push'](_0x540bc9['shift']());}};_0x415b7e(++_0x3aebf4);}(_0x4711,0x10c));var _0x1471=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4711[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1471('0x0'));var util=require(_0x1471('0x1'));var moment=require(_0x1471('0x2'));var BPromise=require(_0x1471('0x3'));var rs=require(_0x1471('0x4'));var fs=require('fs');var Redis=require(_0x1471('0x5'));var db=require(_0x1471('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1471('0x7'))('rpc');var config=require(_0x1471('0x8'));var jayson=require(_0x1471('0x9'));var client=jayson[_0x1471('0xa')][_0x1471('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1be347,_0x4d1a90,_0x1cf7db){return new BPromise(function(_0x853506,_0x319c27){return client[_0x1471('0xc')](_0x1be347,_0x1cf7db)[_0x1471('0xd')](function(_0x4ddede){logger['info'](_0x1471('0xe'),_0x4d1a90,_0x1471('0xf'));logger[_0x1471('0x10')](_0x1471('0x11'),_0x4d1a90,_0x1471('0xf'),JSON[_0x1471('0x12')](_0x4ddede));if(_0x4ddede[_0x1471('0x13')]){if(_0x4ddede[_0x1471('0x13')]['code']===0x1f4){logger[_0x1471('0x13')](_0x1471('0xe'),_0x4d1a90,_0x4ddede[_0x1471('0x13')][_0x1471('0x14')]);return _0x319c27(_0x4ddede[_0x1471('0x13')]['message']);}logger[_0x1471('0x13')](_0x1471('0xe'),_0x4d1a90,_0x4ddede[_0x1471('0x13')]['message']);return _0x853506(_0x4ddede[_0x1471('0x13')][_0x1471('0x14')]);}else{logger[_0x1471('0x15')](_0x1471('0xe'),_0x4d1a90,_0x1471('0xf'));_0x853506(_0x4ddede[_0x1471('0x16')][_0x1471('0x14')]);}})[_0x1471('0x17')](function(_0x11ea35){logger[_0x1471('0x13')](_0x1471('0xe'),_0x4d1a90,_0x11ea35);_0x319c27(_0x11ea35);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f6101af..253be4d 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 _0x4cf8=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1cace5,_0xc6640c){var _0x5c34ed=function(_0x2f2a16){while(--_0x2f2a16){_0x1cace5['push'](_0x1cace5['shift']());}};_0x5c34ed(++_0xc6640c);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x3541e4,_0x4dcf9a){_0x3541e4=_0x3541e4-0x0;var _0x3ca5d9=_0x4cf8[_0x3541e4];return _0x3ca5d9;};'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')]('/',auth[_0x84cf('0xb')](),controller['index']);router['get'](_0x84cf('0xc'),auth['isAuthenticated'](),controller[_0x84cf('0xd')]);router[_0x84cf('0xe')]('/',auth['isAuthenticated'](),controller[_0x84cf('0xf')]);router[_0x84cf('0x10')]('/:id',auth[_0x84cf('0xb')](),controller[_0x84cf('0x11')]);router[_0x84cf('0x12')](_0x84cf('0xc'),auth['isAuthenticated'](),controller[_0x84cf('0x13')]);module[_0x84cf('0x14')]=router; \ No newline at end of file +var _0xc0d7=['/:id','show','create','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x51946f,_0x473c98){var _0x551273=function(_0x303cf4){while(--_0x303cf4){_0x51946f['push'](_0x51946f['shift']());}};_0x551273(++_0x473c98);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x32605d,_0x1018d1){_0x32605d=_0x32605d-0x0;var _0x2dc19c=_0xc0d7[_0x32605d];return _0x2dc19c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7c0d('0x0'));var express=require(_0x7c0d('0x1'));var router=express[_0x7c0d('0x2')]();var auth=require(_0x7c0d('0x3'));var interaction=require(_0x7c0d('0x4'));var config=require(_0x7c0d('0x5'));var controller=require(_0x7c0d('0x6'));router[_0x7c0d('0x7')]('/',auth[_0x7c0d('0x8')](),controller['index']);router[_0x7c0d('0x7')](_0x7c0d('0x9'),auth[_0x7c0d('0x8')](),controller[_0x7c0d('0xa')]);router['post']('/',auth[_0x7c0d('0x8')](),controller[_0x7c0d('0xb')]);router[_0x7c0d('0xc')](_0x7c0d('0x9'),auth['isAuthenticated'](),controller[_0x7c0d('0xd')]);router[_0x7c0d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7c0d('0xf')]);module[_0x7c0d('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 5c3b172..5c84669 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 _0x7635=['TEXT','exports'];(function(_0x2f15c1,_0x48002e){var _0x4c28ce=function(_0x1260ea){while(--_0x1260ea){_0x2f15c1['push'](_0x2f15c1['shift']());}};_0x4c28ce(++_0x48002e);}(_0x7635,0x1ed));var _0x5763=function(_0x7cf457,_0x10f7dc){_0x7cf457=_0x7cf457-0x0;var _0x12ab70=_0x7635[_0x7cf457];return _0x12ab70;};'use strict';var Sequelize=require('sequelize');module[_0x5763('0x0')]={'tree':{'type':Sequelize[_0x5763('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x88d4=['TEXT','sequelize','exports'];(function(_0x3b5a22,_0x2ad223){var _0x7e236a=function(_0x3084d0){while(--_0x3084d0){_0x3b5a22['push'](_0x3b5a22['shift']());}};_0x7e236a(++_0x2ad223);}(_0x88d4,0x1c3));var _0x488d=function(_0x1b1942,_0x458c19){_0x1b1942=_0x1b1942-0x0;var _0x471eb8=_0x88d4[_0x1b1942];return _0x471eb8;};'use strict';var Sequelize=require(_0x488d('0x0'));module[_0x488d('0x1')]={'tree':{'type':Sequelize[_0x488d('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 2d11f6a..5f1b97f 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 _0xfb51=['limit','set','save','then','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','AnalyticTreeReport','includeAll','findAll','catch','show','params','include','create','update','body','find','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xfb51,0x1c1));var _0x1fb5=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0xfb51[_0x3f2d02];return _0x54092b;};'use strict';var pdf=require(_0x1fb5('0x0'));var emlformat=require(_0x1fb5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1fb5('0x2'));var jsonpatch=require(_0x1fb5('0x3'));var rp=require('request-promise');var moment=require(_0x1fb5('0x4'));var BPromise=require(_0x1fb5('0x5'));var Mustache=require(_0x1fb5('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1fb5('0x7'));var csv=require(_0x1fb5('0x8'));var ejs=require(_0x1fb5('0x9'));var fs=require('fs');var _=require(_0x1fb5('0xa'));var squel=require('squel');var crypto=require(_0x1fb5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1fb5('0xc'));var toCsv=require(_0x1fb5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x1fb5('0xd'));var hardwareService=require(_0x1fb5('0xe'));var Redis=require(_0x1fb5('0xf'));var qs=require(_0x1fb5('0x10'));var logger=require(_0x1fb5('0x11'))(_0x1fb5('0x12'));var utils=require('../../config/utils');var config=require(_0x1fb5('0x13'));var db=require(_0x1fb5('0x14'))['db'];function respondWithStatusCode(_0x14fdf1,_0x4a5397){_0x4a5397=_0x4a5397||0xcc;return function(_0x1b754e){if(_0x1b754e){return _0x14fdf1[_0x1fb5('0x15')](_0x4a5397);}return _0x14fdf1[_0x1fb5('0x16')](_0x4a5397)[_0x1fb5('0x17')]();};}function respondWithResult(_0x189f2f,_0x3f4c52){_0x3f4c52=_0x3f4c52||0xc8;return function(_0x4eb096){if(_0x4eb096){return _0x189f2f[_0x1fb5('0x16')](_0x3f4c52)[_0x1fb5('0x18')](_0x4eb096);}};}function respondWithFilteredResult(_0x3e7769,_0x29f033){return function(_0x265afc){if(_0x265afc){var _0x35fd01=_0x265afc[_0x1fb5('0x19')],_0x37274f=_0x29f033[_0x1fb5('0x1a')],_0x1ef073=_0x29f033[_0x1fb5('0x1a')]+_0x29f033[_0x1fb5('0x1b')],_0x1e5406;if(_0x1ef073>=_0x35fd01){_0x1ef073=_0x35fd01;_0x1e5406=0xc8;}else{_0x1e5406=0xce;}_0x3e7769['status'](_0x1e5406);return _0x3e7769[_0x1fb5('0x1c')]('Content-Range',_0x37274f+'-'+_0x1ef073+'/'+_0x35fd01)[_0x1fb5('0x18')](_0x265afc);}return null;};}function patchUpdates(_0x19b4b4){return function(_0x16e4f7){try{jsonpatch['apply'](_0x16e4f7,_0x19b4b4,!![]);}catch(_0x16e37e){return BPromise['reject'](_0x16e37e);}return _0x16e4f7[_0x1fb5('0x1d')]();};}function saveUpdates(_0x2e8b12,_0x175150){return function(_0x5e1bec){if(_0x5e1bec){return _0x5e1bec['update'](_0x2e8b12)[_0x1fb5('0x1e')](function(_0x3c2c57){return _0x3c2c57;});}return null;};}function removeEntity(_0x1707bb,_0x18af1b){return function(_0x37835f){if(_0x37835f){return _0x37835f['destroy']()[_0x1fb5('0x1e')](function(){_0x1707bb[_0x1fb5('0x16')](0xcc)[_0x1fb5('0x17')]();});}};}function handleEntityNotFound(_0x3177ae,_0x312d0b){return function(_0x3eeea7){if(!_0x3eeea7){_0x3177ae[_0x1fb5('0x15')](0x194);}return _0x3eeea7;};}function handleError(_0x2db493,_0x4ac297){_0x4ac297=_0x4ac297||0x1f4;return function(_0x3f1473){logger[_0x1fb5('0x1f')](_0x3f1473[_0x1fb5('0x20')]);if(_0x3f1473[_0x1fb5('0x21')]){delete _0x3f1473[_0x1fb5('0x21')];}_0x2db493[_0x1fb5('0x16')](_0x4ac297)[_0x1fb5('0x22')](_0x3f1473);};}exports[_0x1fb5('0x23')]=function(_0x3eb9da,_0x512f41){var _0x4db9e1={},_0x349f4d={},_0x5eb4ce={'count':0x0,'rows':[]};var _0x314739=db['AnalyticTreeReport'][_0x1fb5('0x24')];_0x349f4d[_0x1fb5('0x25')]=_[_0x1fb5('0x26')](_0x314739);_0x349f4d[_0x1fb5('0x27')]=_[_0x1fb5('0x26')](_0x3eb9da[_0x1fb5('0x27')]);_0x349f4d[_0x1fb5('0x28')]=_[_0x1fb5('0x29')](_0x349f4d[_0x1fb5('0x25')],_0x349f4d[_0x1fb5('0x27')]);_0x4db9e1[_0x1fb5('0x2a')]=_[_0x1fb5('0x29')](_0x349f4d[_0x1fb5('0x25')],qs['fields'](_0x3eb9da[_0x1fb5('0x27')][_0x1fb5('0x2b')]));_0x4db9e1[_0x1fb5('0x2a')]=_0x4db9e1[_0x1fb5('0x2a')][_0x1fb5('0x2c')]?_0x4db9e1[_0x1fb5('0x2a')]:_0x349f4d[_0x1fb5('0x25')];if(!_0x3eb9da[_0x1fb5('0x27')][_0x1fb5('0x2d')]('nolimit')){_0x4db9e1['limit']=qs[_0x1fb5('0x1b')](_0x3eb9da[_0x1fb5('0x27')]['limit']);_0x4db9e1['offset']=qs[_0x1fb5('0x1a')](_0x3eb9da[_0x1fb5('0x27')][_0x1fb5('0x1a')]);}_0x4db9e1['order']=qs['sort'](_0x3eb9da[_0x1fb5('0x27')]['sort']);_0x4db9e1[_0x1fb5('0x2e')]=qs[_0x1fb5('0x28')](_[_0x1fb5('0x2f')](_0x3eb9da['query'],_0x349f4d['filters']));if(_0x3eb9da[_0x1fb5('0x27')]['filter']){_0x4db9e1['where']=_[_0x1fb5('0x30')](_0x4db9e1[_0x1fb5('0x2e')],{'$or':_[_0x1fb5('0x31')](_0x314739,function(_0x3bb8b9){if(_0x3bb8b9[_0x1fb5('0x32')][_0x1fb5('0x33')]!==_0x1fb5('0x34')){var _0x21af90={};_0x21af90[_0x3bb8b9[_0x1fb5('0x35')]]={'$like':'%'+_0x3eb9da[_0x1fb5('0x27')][_0x1fb5('0x36')]+'%'};return _0x21af90;}})});}_0x4db9e1=_[_0x1fb5('0x30')]({},_0x4db9e1,_0x3eb9da[_0x1fb5('0x37')]);var _0x456606={'where':_0x4db9e1[_0x1fb5('0x2e')]};return db[_0x1fb5('0x38')][_0x1fb5('0x19')](_0x456606)[_0x1fb5('0x1e')](function(_0x11ce0c){_0x5eb4ce[_0x1fb5('0x19')]=_0x11ce0c;if(_0x3eb9da[_0x1fb5('0x27')][_0x1fb5('0x39')]){_0x4db9e1['include']=[{'all':!![]}];}return db[_0x1fb5('0x38')][_0x1fb5('0x3a')](_0x4db9e1);})[_0x1fb5('0x1e')](function(_0x34651f){_0x5eb4ce['rows']=_0x34651f;return _0x5eb4ce;})['then'](respondWithFilteredResult(_0x512f41,_0x4db9e1))[_0x1fb5('0x3b')](handleError(_0x512f41,null));};exports[_0x1fb5('0x3c')]=function(_0x493286,_0x29cd41){var _0x4d9a43={'raw':!![],'where':{'id':_0x493286[_0x1fb5('0x3d')]['id']}},_0x493682={};_0x493682[_0x1fb5('0x25')]=_[_0x1fb5('0x26')](db[_0x1fb5('0x38')][_0x1fb5('0x24')]);_0x493682[_0x1fb5('0x27')]=_['keys'](_0x493286['query']);_0x493682[_0x1fb5('0x28')]=_['intersection'](_0x493682[_0x1fb5('0x25')],_0x493682['query']);_0x4d9a43['attributes']=_[_0x1fb5('0x29')](_0x493682['model'],qs[_0x1fb5('0x2b')](_0x493286[_0x1fb5('0x27')][_0x1fb5('0x2b')]));_0x4d9a43[_0x1fb5('0x2a')]=_0x4d9a43[_0x1fb5('0x2a')][_0x1fb5('0x2c')]?_0x4d9a43[_0x1fb5('0x2a')]:_0x493682[_0x1fb5('0x25')];if(_0x493286[_0x1fb5('0x27')][_0x1fb5('0x39')]){_0x4d9a43[_0x1fb5('0x3e')]=[{'all':!![]}];}_0x4d9a43=_[_0x1fb5('0x30')]({},_0x4d9a43,_0x493286[_0x1fb5('0x37')]);return db[_0x1fb5('0x38')]['find'](_0x4d9a43)[_0x1fb5('0x1e')](handleEntityNotFound(_0x29cd41,null))['then'](respondWithResult(_0x29cd41,null))[_0x1fb5('0x3b')](handleError(_0x29cd41,null));};exports[_0x1fb5('0x3f')]=function(_0x4655cd,_0xb9400b){return db['AnalyticTreeReport']['create'](_0x4655cd['body'],{})[_0x1fb5('0x1e')](respondWithResult(_0xb9400b,0xc9))[_0x1fb5('0x3b')](handleError(_0xb9400b,null));};exports[_0x1fb5('0x40')]=function(_0x1cb294,_0x3ced18){if(_0x1cb294[_0x1fb5('0x41')]['id']){delete _0x1cb294[_0x1fb5('0x41')]['id'];}return db[_0x1fb5('0x38')][_0x1fb5('0x42')]({'where':{'id':_0x1cb294[_0x1fb5('0x3d')]['id']}})[_0x1fb5('0x1e')](handleEntityNotFound(_0x3ced18,null))[_0x1fb5('0x1e')](saveUpdates(_0x1cb294['body'],null))[_0x1fb5('0x1e')](respondWithResult(_0x3ced18,null))[_0x1fb5('0x3b')](handleError(_0x3ced18,null));};exports[_0x1fb5('0x43')]=function(_0x109b00,_0x14b2a5){return db[_0x1fb5('0x38')][_0x1fb5('0x42')]({'where':{'id':_0x109b00[_0x1fb5('0x3d')]['id']}})[_0x1fb5('0x1e')](handleEntityNotFound(_0x14b2a5,null))[_0x1fb5('0x1e')](removeEntity(_0x14b2a5,null))[_0x1fb5('0x3b')](handleError(_0x14b2a5,null));}; \ No newline at end of file +var _0x98b8=['../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','sendStatus','error','name','send','index','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','map','type','key','VIRTUAL','field','AnalyticTreeReport','findAll','rows','catch','params','include','find','create','body','html-pdf','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api'];(function(_0x42f4db,_0x2bbcc4){var _0x1b38ee=function(_0x3cba9c){while(--_0x3cba9c){_0x42f4db['push'](_0x42f4db['shift']());}};_0x1b38ee(++_0x2bbcc4);}(_0x98b8,0x70));var _0x898b=function(_0x1098ec,_0x2afc61){_0x1098ec=_0x1098ec-0x0;var _0x35b0ca=_0x98b8[_0x1098ec];return _0x35b0ca;};'use strict';var pdf=require(_0x898b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x898b('0x1'));var moment=require(_0x898b('0x2'));var BPromise=require(_0x898b('0x3'));var Mustache=require(_0x898b('0x4'));var util=require('util');var path=require(_0x898b('0x5'));var sox=require('sox');var csv=require(_0x898b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x898b('0x7'));var squel=require(_0x898b('0x8'));var crypto=require(_0x898b('0x9'));var jsforce=require(_0x898b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x898b('0x6'));var querystring=require(_0x898b('0xb'));var Papa=require(_0x898b('0xc'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x898b('0xd'));var qs=require(_0x898b('0xe'));var logger=require('../../config/logger')(_0x898b('0xf'));var utils=require(_0x898b('0x10'));var config=require(_0x898b('0x11'));var db=require(_0x898b('0x12'))['db'];function respondWithStatusCode(_0xdb0859,_0x14e2e6){_0x14e2e6=_0x14e2e6||0xcc;return function(_0xe038a4){if(_0xe038a4){return _0xdb0859['sendStatus'](_0x14e2e6);}return _0xdb0859[_0x898b('0x13')](_0x14e2e6)['end']();};}function respondWithResult(_0x40ec57,_0x105f91){_0x105f91=_0x105f91||0xc8;return function(_0x440218){if(_0x440218){return _0x40ec57['status'](_0x105f91)[_0x898b('0x14')](_0x440218);}};}function respondWithFilteredResult(_0x30e81e,_0x51177b){return function(_0x405e81){if(_0x405e81){var _0x34c614=_0x405e81[_0x898b('0x15')],_0xa6a61d=_0x51177b[_0x898b('0x16')],_0x17124b=_0x51177b[_0x898b('0x16')]+_0x51177b[_0x898b('0x17')],_0xc70235;if(_0x17124b>=_0x34c614){_0x17124b=_0x34c614;_0xc70235=0xc8;}else{_0xc70235=0xce;}_0x30e81e[_0x898b('0x13')](_0xc70235);return _0x30e81e['set'](_0x898b('0x18'),_0xa6a61d+'-'+_0x17124b+'/'+_0x34c614)[_0x898b('0x14')](_0x405e81);}return null;};}function patchUpdates(_0x5980bf){return function(_0x26cd1c){try{jsonpatch[_0x898b('0x19')](_0x26cd1c,_0x5980bf,!![]);}catch(_0x414381){return BPromise['reject'](_0x414381);}return _0x26cd1c[_0x898b('0x1a')]();};}function saveUpdates(_0x187d2e,_0x16da57){return function(_0x133311){if(_0x133311){return _0x133311['update'](_0x187d2e)[_0x898b('0x1b')](function(_0x57e298){return _0x57e298;});}return null;};}function removeEntity(_0x5c2630,_0x1c57b7){return function(_0x332060){if(_0x332060){return _0x332060[_0x898b('0x1c')]()[_0x898b('0x1b')](function(){_0x5c2630[_0x898b('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d7fc4,_0x5707bf){return function(_0xc2fb46){if(!_0xc2fb46){_0x2d7fc4[_0x898b('0x1d')](0x194);}return _0xc2fb46;};}function handleError(_0x4f64e6,_0x56cb7b){_0x56cb7b=_0x56cb7b||0x1f4;return function(_0x917dd9){logger[_0x898b('0x1e')](_0x917dd9['stack']);if(_0x917dd9[_0x898b('0x1f')]){delete _0x917dd9[_0x898b('0x1f')];}_0x4f64e6[_0x898b('0x13')](_0x56cb7b)[_0x898b('0x20')](_0x917dd9);};}exports[_0x898b('0x21')]=function(_0x2d0a1b,_0x50f84c){var _0x414814={},_0x1ad5b7={},_0x498ef5={'count':0x0,'rows':[]};var _0x16148c=db['AnalyticTreeReport'][_0x898b('0x22')];_0x1ad5b7[_0x898b('0x23')]=_[_0x898b('0x24')](_0x16148c);_0x1ad5b7[_0x898b('0x25')]=_[_0x898b('0x24')](_0x2d0a1b[_0x898b('0x25')]);_0x1ad5b7['filters']=_[_0x898b('0x26')](_0x1ad5b7['model'],_0x1ad5b7[_0x898b('0x25')]);_0x414814[_0x898b('0x27')]=_[_0x898b('0x26')](_0x1ad5b7[_0x898b('0x23')],qs[_0x898b('0x28')](_0x2d0a1b[_0x898b('0x25')][_0x898b('0x28')]));_0x414814[_0x898b('0x27')]=_0x414814[_0x898b('0x27')][_0x898b('0x29')]?_0x414814[_0x898b('0x27')]:_0x1ad5b7[_0x898b('0x23')];if(!_0x2d0a1b['query'][_0x898b('0x2a')](_0x898b('0x2b'))){_0x414814['limit']=qs[_0x898b('0x17')](_0x2d0a1b[_0x898b('0x25')][_0x898b('0x17')]);_0x414814[_0x898b('0x16')]=qs[_0x898b('0x16')](_0x2d0a1b[_0x898b('0x25')][_0x898b('0x16')]);}_0x414814[_0x898b('0x2c')]=qs['sort'](_0x2d0a1b[_0x898b('0x25')]['sort']);_0x414814[_0x898b('0x2d')]=qs[_0x898b('0x2e')](_[_0x898b('0x2f')](_0x2d0a1b[_0x898b('0x25')],_0x1ad5b7[_0x898b('0x2e')]));if(_0x2d0a1b[_0x898b('0x25')][_0x898b('0x30')]){_0x414814['where']=_[_0x898b('0x31')](_0x414814[_0x898b('0x2d')],{'$or':_[_0x898b('0x32')](_0x16148c,function(_0x357811){if(_0x357811[_0x898b('0x33')][_0x898b('0x34')]!==_0x898b('0x35')){var _0x29bdd3={};_0x29bdd3[_0x357811[_0x898b('0x36')]]={'$like':'%'+_0x2d0a1b[_0x898b('0x25')][_0x898b('0x30')]+'%'};return _0x29bdd3;}})});}_0x414814=_['merge']({},_0x414814,_0x2d0a1b['options']);var _0x3faf9c={'where':_0x414814[_0x898b('0x2d')]};return db[_0x898b('0x37')]['count'](_0x3faf9c)['then'](function(_0xdfda66){_0x498ef5[_0x898b('0x15')]=_0xdfda66;if(_0x2d0a1b['query']['includeAll']){_0x414814['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x898b('0x38')](_0x414814);})[_0x898b('0x1b')](function(_0x4dcc2c){_0x498ef5[_0x898b('0x39')]=_0x4dcc2c;return _0x498ef5;})['then'](respondWithFilteredResult(_0x50f84c,_0x414814))[_0x898b('0x3a')](handleError(_0x50f84c,null));};exports['show']=function(_0x1aa85c,_0x41fe59){var _0x14393b={'raw':!![],'where':{'id':_0x1aa85c[_0x898b('0x3b')]['id']}},_0x597590={};_0x597590[_0x898b('0x23')]=_['keys'](db[_0x898b('0x37')][_0x898b('0x22')]);_0x597590[_0x898b('0x25')]=_[_0x898b('0x24')](_0x1aa85c[_0x898b('0x25')]);_0x597590['filters']=_[_0x898b('0x26')](_0x597590[_0x898b('0x23')],_0x597590[_0x898b('0x25')]);_0x14393b['attributes']=_[_0x898b('0x26')](_0x597590[_0x898b('0x23')],qs[_0x898b('0x28')](_0x1aa85c['query'][_0x898b('0x28')]));_0x14393b[_0x898b('0x27')]=_0x14393b['attributes'][_0x898b('0x29')]?_0x14393b[_0x898b('0x27')]:_0x597590[_0x898b('0x23')];if(_0x1aa85c[_0x898b('0x25')]['includeAll']){_0x14393b[_0x898b('0x3c')]=[{'all':!![]}];}_0x14393b=_[_0x898b('0x31')]({},_0x14393b,_0x1aa85c['options']);return db[_0x898b('0x37')][_0x898b('0x3d')](_0x14393b)['then'](handleEntityNotFound(_0x41fe59,null))[_0x898b('0x1b')](respondWithResult(_0x41fe59,null))[_0x898b('0x3a')](handleError(_0x41fe59,null));};exports[_0x898b('0x3e')]=function(_0x5e64dd,_0x23b745){return db[_0x898b('0x37')][_0x898b('0x3e')](_0x5e64dd[_0x898b('0x3f')],{})[_0x898b('0x1b')](respondWithResult(_0x23b745,0xc9))['catch'](handleError(_0x23b745,null));};exports['update']=function(_0x52fdf8,_0x3d1ea8){if(_0x52fdf8['body']['id']){delete _0x52fdf8['body']['id'];}return db[_0x898b('0x37')][_0x898b('0x3d')]({'where':{'id':_0x52fdf8[_0x898b('0x3b')]['id']}})[_0x898b('0x1b')](handleEntityNotFound(_0x3d1ea8,null))[_0x898b('0x1b')](saveUpdates(_0x52fdf8[_0x898b('0x3f')],null))[_0x898b('0x1b')](respondWithResult(_0x3d1ea8,null))[_0x898b('0x3a')](handleError(_0x3d1ea8,null));};exports[_0x898b('0x1c')]=function(_0xf4e6f2,_0x3584b5){return db[_0x898b('0x37')][_0x898b('0x3d')]({'where':{'id':_0xf4e6f2['params']['id']}})[_0x898b('0x1b')](handleEntityNotFound(_0x3584b5,null))[_0x898b('0x1b')](removeEntity(_0x3584b5,null))[_0x898b('0x3a')](handleError(_0x3584b5,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 3cbdf52..c2bace7 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 _0xe9e3=['AnalyticTreeReport','lodash','util','moment','bluebird','request-promise'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0xe9e3,0xf7));var _0x3e9e=function(_0x5a5f28,_0x4df93b){_0x5a5f28=_0x5a5f28-0x0;var _0x49b893=_0xe9e3[_0x5a5f28];return _0x49b893;};'use strict';var _=require(_0x3e9e('0x0'));var util=require(_0x3e9e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3e9e('0x2'));var BPromise=require(_0x3e9e('0x3'));var rp=require(_0x3e9e('0x4'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x4547c7,_0x43916e){return _0x4547c7['define'](_0x3e9e('0x5'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9367=['lodash','util','../../config/logger','moment','request-promise','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9367,0x156));var _0x7936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9367[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7936('0x0'));var util=require(_0x7936('0x1'));var logger=require(_0x7936('0x2'))('api');var moment=require(_0x7936('0x3'));var BPromise=require('bluebird');var rp=require(_0x7936('0x4'));var attributes=require(_0x7936('0x5'));module['exports']=function(_0x407bbc,_0x131c92){return _0x407bbc[_0x7936('0x6')](_0x7936('0x7'),attributes,{'tableName':_0x7936('0x8'),'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 6e0eb8e..f4c9852 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 _0x6f23=['request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticTreeReport,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x24e7e4,_0x23326c){var _0x15d30d=function(_0x3670a1){while(--_0x3670a1){_0x24e7e4['push'](_0x24e7e4['shift']());}};_0x15d30d(++_0x23326c);}(_0x6f23,0x85));var _0x36f2=function(_0x181bb1,_0x4b881f){_0x181bb1=_0x181bb1-0x0;var _0x25e0ae=_0x6f23[_0x181bb1];return _0x25e0ae;};'use strict';var _=require(_0x36f2('0x0'));var util=require(_0x36f2('0x1'));var moment=require(_0x36f2('0x2'));var BPromise=require('bluebird');var rs=require(_0x36f2('0x3'));var fs=require('fs');var Redis=require(_0x36f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x36f2('0x5'));var logger=require(_0x36f2('0x6'))(_0x36f2('0x7'));var config=require('../../config/environment');var jayson=require(_0x36f2('0x8'));var client=jayson[_0x36f2('0x9')][_0x36f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa95ddd,_0x1cffc0,_0x465167){return new BPromise(function(_0x184743,_0x73c6aa){return client[_0x36f2('0xb')](_0xa95ddd,_0x465167)[_0x36f2('0xc')](function(_0x556971){logger[_0x36f2('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1cffc0,_0x36f2('0xe'));logger['debug'](_0x36f2('0xf'),_0x1cffc0,'request\x20sent',JSON[_0x36f2('0x10')](_0x556971));if(_0x556971[_0x36f2('0x11')]){if(_0x556971[_0x36f2('0x11')]['code']===0x1f4){logger[_0x36f2('0x11')](_0x36f2('0x12'),_0x1cffc0,_0x556971[_0x36f2('0x11')][_0x36f2('0x13')]);return _0x73c6aa(_0x556971[_0x36f2('0x11')]['message']);}logger[_0x36f2('0x11')](_0x36f2('0x12'),_0x1cffc0,_0x556971['error'][_0x36f2('0x13')]);return _0x184743(_0x556971[_0x36f2('0x11')][_0x36f2('0x13')]);}else{logger['info'](_0x36f2('0x12'),_0x1cffc0,_0x36f2('0xe'));_0x184743(_0x556971[_0x36f2('0x14')][_0x36f2('0x13')]);}})['catch'](function(_0x2101a7){logger[_0x36f2('0x11')](_0x36f2('0x12'),_0x1cffc0,_0x2101a7);_0x73c6aa(_0x2101a7);});});} \ No newline at end of file +var _0x1187=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2cd1e4,_0x23d906){var _0x167374=function(_0x496435){while(--_0x496435){_0x2cd1e4['push'](_0x2cd1e4['shift']());}};_0x167374(++_0x23d906);}(_0x1187,0x17c));var _0x7118=function(_0x49d221,_0x13dba8){_0x49d221=_0x49d221-0x0;var _0x37b800=_0x1187[_0x49d221];return _0x37b800;};'use strict';var _=require(_0x7118('0x0'));var util=require('util');var moment=require(_0x7118('0x1'));var BPromise=require('bluebird');var rs=require(_0x7118('0x2'));var fs=require('fs');var Redis=require(_0x7118('0x3'));var db=require(_0x7118('0x4'))['db'];var utils=require(_0x7118('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7118('0x6'));var jayson=require(_0x7118('0x7'));var client=jayson['client'][_0x7118('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x382dda,_0x54c4e6,_0x326667){return new BPromise(function(_0x3a6a8f,_0x305a0f){return client[_0x7118('0x9')](_0x382dda,_0x326667)[_0x7118('0xa')](function(_0x5a4c3f){logger[_0x7118('0xb')](_0x7118('0xc'),_0x54c4e6,'request\x20sent');logger[_0x7118('0xd')](_0x7118('0xe'),_0x54c4e6,_0x7118('0xf'),JSON['stringify'](_0x5a4c3f));if(_0x5a4c3f['error']){if(_0x5a4c3f[_0x7118('0x10')][_0x7118('0x11')]===0x1f4){logger['error'](_0x7118('0xc'),_0x54c4e6,_0x5a4c3f['error'][_0x7118('0x12')]);return _0x305a0f(_0x5a4c3f[_0x7118('0x10')][_0x7118('0x12')]);}logger['error'](_0x7118('0xc'),_0x54c4e6,_0x5a4c3f['error'][_0x7118('0x12')]);return _0x3a6a8f(_0x5a4c3f[_0x7118('0x10')][_0x7118('0x12')]);}else{logger[_0x7118('0xb')]('AnalyticTreeReport,\x20%s,\x20%s',_0x54c4e6,_0x7118('0xf'));_0x3a6a8f(_0x5a4c3f[_0x7118('0x13')][_0x7118('0x12')]);}})[_0x7118('0x14')](function(_0x4f603f){logger['error'](_0x7118('0xc'),_0x54c4e6,_0x4f603f);_0x305a0f(_0x4f603f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 4e3df66..708d88d 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 _0x4ade=['../../config/environment','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service'];(function(_0x10b48e,_0x6218d){var _0x36f338=function(_0x3ef8e1){while(--_0x3ef8e1){_0x10b48e['push'](_0x10b48e['shift']());}};_0x36f338(++_0x6218d);}(_0x4ade,0x91));var _0xe4ad=function(_0x15f9e5,_0x1cfbc4){_0x15f9e5=_0x15f9e5-0x0;var _0x8d534=_0x4ade[_0x15f9e5];return _0x8d534;};'use strict';var multer=require(_0xe4ad('0x0'));var util=require('util');var path=require(_0xe4ad('0x1'));var timeout=require('connect-timeout');var express=require(_0xe4ad('0x2'));var router=express[_0xe4ad('0x3')]();var auth=require(_0xe4ad('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe4ad('0x5'));var controller=require('./analyticTreeReport.controller');router[_0xe4ad('0x6')]('/',auth[_0xe4ad('0x7')](),controller['index']);router['get'](_0xe4ad('0x8'),auth[_0xe4ad('0x7')](),controller['show']);router[_0xe4ad('0x9')]('/',auth[_0xe4ad('0x7')](),controller[_0xe4ad('0xa')]);router[_0xe4ad('0xb')]('/:id',auth[_0xe4ad('0x7')](),controller[_0xe4ad('0xc')]);router[_0xe4ad('0xd')](_0xe4ad('0x8'),auth[_0xe4ad('0x7')](),controller[_0xe4ad('0xe')]);module['exports']=router; \ No newline at end of file +var _0x710d=['create','destroy','multer','path','express','Router','../../components/auth/service','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x28b902,_0x27ab41){var _0x3c5701=function(_0x53a3f4){while(--_0x53a3f4){_0x28b902['push'](_0x28b902['shift']());}};_0x3c5701(++_0x27ab41);}(_0x710d,0x1c2));var _0xd710=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x710d[_0x7c0074];return _0x13e95b;};'use strict';var multer=require(_0xd710('0x0'));var util=require('util');var path=require(_0xd710('0x1'));var timeout=require('connect-timeout');var express=require(_0xd710('0x2'));var router=express[_0xd710('0x3')]();var auth=require(_0xd710('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd710('0x5'));router[_0xd710('0x6')]('/',auth['isAuthenticated'](),controller[_0xd710('0x7')]);router[_0xd710('0x6')](_0xd710('0x8'),auth[_0xd710('0x9')](),controller[_0xd710('0xa')]);router[_0xd710('0xb')]('/',auth[_0xd710('0x9')](),controller[_0xd710('0xc')]);router['put'](_0xd710('0x8'),auth[_0xd710('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd710('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index fed8207..a0d8afb 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 _0xedc5=['STRING','sequelize'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0xedc5,0x85));var _0x5edc=function(_0x45ad09,_0x521ab1){_0x45ad09=_0x45ad09-0x0;var _0x2084fd=_0xedc5[_0x45ad09];return _0x2084fd;};'use strict';var Sequelize=require(_0x5edc('0x0'));module['exports']={'name':{'type':Sequelize[_0x5edc('0x1')]},'basename':{'type':Sequelize[_0x5edc('0x1')]},'type':{'type':Sequelize[_0x5edc('0x1')]}}; \ No newline at end of file +var _0x0285=['exports','STRING','sequelize'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x0285,0x89));var _0x5028=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x0285[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require(_0x5028('0x0'));module[_0x5028('0x1')]={'name':{'type':Sequelize[_0x5028('0x2')]},'basename':{'type':Sequelize[_0x5028('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 2917a11..eaa4b27 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 _0x760b=['length','hasOwnProperty','nolimit','sort','where','merge','map','key','VIRTUAL','field','options','then','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','file','originalname','filename','mimetype','findOne','download','join','server/files/attachments/','basename','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','save','error','name','index','Attachment','rawAttributes','model','keys','query','filters','intersection','fields','attributes'];(function(_0x459094,_0x5e04d5){var _0x18bc8d=function(_0x31a401){while(--_0x31a401){_0x459094['push'](_0x459094['shift']());}};_0x18bc8d(++_0x5e04d5);}(_0x760b,0x1ee));var _0xb760=function(_0x59ddee,_0x24601c){_0x59ddee=_0x59ddee-0x0;var _0x1169a7=_0x760b[_0x59ddee];return _0x1169a7;};'use strict';var pdf=require(_0xb760('0x0'));var emlformat=require(_0xb760('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb760('0x2'));var rp=require(_0xb760('0x3'));var moment=require(_0xb760('0x4'));var BPromise=require(_0xb760('0x5'));var Mustache=require(_0xb760('0x6'));var util=require(_0xb760('0x7'));var path=require(_0xb760('0x8'));var sox=require(_0xb760('0x9'));var csv=require('to-csv');var ejs=require(_0xb760('0xa'));var fs=require('fs');var _=require(_0xb760('0xb'));var squel=require(_0xb760('0xc'));var crypto=require(_0xb760('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb760('0xe'));var toCsv=require(_0xb760('0xf'));var querystring=require(_0xb760('0x10'));var Papa=require(_0xb760('0x11'));var authService=require(_0xb760('0x12'));var hardwareService=require(_0xb760('0x13'));var Redis=require('ioredis');var qs=require(_0xb760('0x14'));var logger=require(_0xb760('0x15'))(_0xb760('0x16'));var utils=require('../../config/utils');var config=require(_0xb760('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31cb95,_0x402476){_0x402476=_0x402476||0xcc;return function(_0x3bfbcb){if(_0x3bfbcb){return _0x31cb95[_0xb760('0x18')](_0x402476);}return _0x31cb95[_0xb760('0x19')](_0x402476)['end']();};}function respondWithResult(_0x14eb11,_0x51675e){_0x51675e=_0x51675e||0xc8;return function(_0x2a4bfd){if(_0x2a4bfd){return _0x14eb11[_0xb760('0x19')](_0x51675e)['json'](_0x2a4bfd);}};}function respondWithFilteredResult(_0x3ac556,_0x359370){return function(_0x50b9b2){if(_0x50b9b2){var _0x425b52=_0x50b9b2[_0xb760('0x1a')],_0x58f444=_0x359370[_0xb760('0x1b')],_0xfc5484=_0x359370[_0xb760('0x1b')]+_0x359370[_0xb760('0x1c')],_0x32e2e1;if(_0xfc5484>=_0x425b52){_0xfc5484=_0x425b52;_0x32e2e1=0xc8;}else{_0x32e2e1=0xce;}_0x3ac556[_0xb760('0x19')](_0x32e2e1);return _0x3ac556[_0xb760('0x1d')](_0xb760('0x1e'),_0x58f444+'-'+_0xfc5484+'/'+_0x425b52)[_0xb760('0x1f')](_0x50b9b2);}return null;};}function patchUpdates(_0x4e1629){return function(_0x5ad8aa){try{jsonpatch['apply'](_0x5ad8aa,_0x4e1629,!![]);}catch(_0x380d5e){return BPromise['reject'](_0x380d5e);}return _0x5ad8aa[_0xb760('0x20')]();};}function saveUpdates(_0x179726,_0x3a98dd){return function(_0xe493a3){if(_0xe493a3){return _0xe493a3['update'](_0x179726)['then'](function(_0x2f884a){return _0x2f884a;});}return null;};}function removeEntity(_0x4ebf6e,_0x3f9860){return function(_0x5a2f6d){if(_0x5a2f6d){return _0x5a2f6d['destroy']()['then'](function(){_0x4ebf6e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0487,_0x3db548){return function(_0x1de9c6){if(!_0x1de9c6){_0x3b0487[_0xb760('0x18')](0x194);}return _0x1de9c6;};}function handleError(_0xad195b,_0x45b7fd){_0x45b7fd=_0x45b7fd||0x1f4;return function(_0x255d0d){logger[_0xb760('0x21')](_0x255d0d['stack']);if(_0x255d0d[_0xb760('0x22')]){delete _0x255d0d[_0xb760('0x22')];}_0xad195b['status'](_0x45b7fd)['send'](_0x255d0d);};}exports[_0xb760('0x23')]=function(_0x36abc9,_0x68e3c2){var _0x456605={},_0x44747f={},_0x160dcd={'count':0x0,'rows':[]};var _0x2b6fee=db[_0xb760('0x24')][_0xb760('0x25')];_0x44747f[_0xb760('0x26')]=_[_0xb760('0x27')](_0x2b6fee);_0x44747f['query']=_[_0xb760('0x27')](_0x36abc9[_0xb760('0x28')]);_0x44747f[_0xb760('0x29')]=_[_0xb760('0x2a')](_0x44747f[_0xb760('0x26')],_0x44747f[_0xb760('0x28')]);_0x456605['attributes']=_[_0xb760('0x2a')](_0x44747f[_0xb760('0x26')],qs[_0xb760('0x2b')](_0x36abc9[_0xb760('0x28')][_0xb760('0x2b')]));_0x456605[_0xb760('0x2c')]=_0x456605[_0xb760('0x2c')][_0xb760('0x2d')]?_0x456605['attributes']:_0x44747f['model'];if(!_0x36abc9[_0xb760('0x28')][_0xb760('0x2e')](_0xb760('0x2f'))){_0x456605[_0xb760('0x1c')]=qs[_0xb760('0x1c')](_0x36abc9[_0xb760('0x28')][_0xb760('0x1c')]);_0x456605[_0xb760('0x1b')]=qs[_0xb760('0x1b')](_0x36abc9['query'][_0xb760('0x1b')]);}_0x456605['order']=qs[_0xb760('0x30')](_0x36abc9[_0xb760('0x28')][_0xb760('0x30')]);_0x456605['where']=qs[_0xb760('0x29')](_['pick'](_0x36abc9[_0xb760('0x28')],_0x44747f['filters']));if(_0x36abc9['query']['filter']){_0x456605[_0xb760('0x31')]=_[_0xb760('0x32')](_0x456605[_0xb760('0x31')],{'$or':_[_0xb760('0x33')](_0x2b6fee,function(_0x3cd5a3){if(_0x3cd5a3['type'][_0xb760('0x34')]!==_0xb760('0x35')){var _0x26e4ab={};_0x26e4ab[_0x3cd5a3[_0xb760('0x36')]]={'$like':'%'+_0x36abc9[_0xb760('0x28')]['filter']+'%'};return _0x26e4ab;}})});}_0x456605=_[_0xb760('0x32')]({},_0x456605,_0x36abc9[_0xb760('0x37')]);var _0x4facf6={'where':_0x456605[_0xb760('0x31')]};return db['Attachment'][_0xb760('0x1a')](_0x4facf6)[_0xb760('0x38')](function(_0x11c361){_0x160dcd[_0xb760('0x1a')]=_0x11c361;if(_0x36abc9[_0xb760('0x28')][_0xb760('0x39')]){_0x456605[_0xb760('0x3a')]=[{'all':!![]}];}return db[_0xb760('0x24')][_0xb760('0x3b')](_0x456605);})[_0xb760('0x38')](function(_0x17ad88){_0x160dcd[_0xb760('0x3c')]=_0x17ad88;return _0x160dcd;})[_0xb760('0x38')](respondWithFilteredResult(_0x68e3c2,_0x456605))[_0xb760('0x3d')](handleError(_0x68e3c2,null));};exports[_0xb760('0x3e')]=function(_0x15278a,_0x3bf11e){var _0x15707e={'raw':!![],'where':{'id':_0x15278a[_0xb760('0x3f')]['id']}},_0x1d70a4={};_0x1d70a4[_0xb760('0x26')]=_[_0xb760('0x27')](db['Attachment'][_0xb760('0x25')]);_0x1d70a4[_0xb760('0x28')]=_['keys'](_0x15278a[_0xb760('0x28')]);_0x1d70a4[_0xb760('0x29')]=_[_0xb760('0x2a')](_0x1d70a4['model'],_0x1d70a4[_0xb760('0x28')]);_0x15707e[_0xb760('0x2c')]=_['intersection'](_0x1d70a4[_0xb760('0x26')],qs[_0xb760('0x2b')](_0x15278a[_0xb760('0x28')][_0xb760('0x2b')]));_0x15707e[_0xb760('0x2c')]=_0x15707e['attributes'][_0xb760('0x2d')]?_0x15707e[_0xb760('0x2c')]:_0x1d70a4[_0xb760('0x26')];if(_0x15278a[_0xb760('0x28')][_0xb760('0x39')]){_0x15707e[_0xb760('0x3a')]=[{'all':!![]}];}_0x15707e=_['merge']({},_0x15707e,_0x15278a['options']);return db[_0xb760('0x24')][_0xb760('0x40')](_0x15707e)['then'](handleEntityNotFound(_0x3bf11e,null))[_0xb760('0x38')](respondWithResult(_0x3bf11e,null))['catch'](handleError(_0x3bf11e,null));};exports[_0xb760('0x41')]=function(_0x1e246f,_0x3f3d50){if(_0x1e246f['body']['id']){delete _0x1e246f['body']['id'];}return db[_0xb760('0x24')]['find']({'where':{'id':_0x1e246f[_0xb760('0x3f')]['id']}})[_0xb760('0x38')](handleEntityNotFound(_0x3f3d50,null))[_0xb760('0x38')](saveUpdates(_0x1e246f[_0xb760('0x42')],null))[_0xb760('0x38')](respondWithResult(_0x3f3d50,null))['catch'](handleError(_0x3f3d50,null));};exports['destroy']=function(_0x1fab54,_0xd260fb){return db[_0xb760('0x24')][_0xb760('0x40')]({'where':{'id':_0x1fab54[_0xb760('0x3f')]['id']}})[_0xb760('0x38')](handleEntityNotFound(_0xd260fb,null))[_0xb760('0x38')](removeEntity(_0xd260fb,null))[_0xb760('0x3d')](handleError(_0xd260fb,null));};exports[_0xb760('0x43')]=function(_0x1d29b0,_0x5a99a4,_0x3d5e13){_0x1d29b0[_0xb760('0x42')]['name']=_0x1d29b0[_0xb760('0x44')][_0xb760('0x45')];_0x1d29b0[_0xb760('0x42')]['basename']=_0x1d29b0[_0xb760('0x44')][_0xb760('0x46')];_0x1d29b0[_0xb760('0x42')]['type']=_0x1d29b0[_0xb760('0x44')][_0xb760('0x47')];return db['Attachment'][_0xb760('0x43')](_0x1d29b0['body'])[_0xb760('0x38')](respondWithResult(_0x5a99a4,0xc9))[_0xb760('0x3d')](handleError(_0x5a99a4,null));};exports['download']=function(_0x3e4520,_0x285051,_0x3fd646){return db[_0xb760('0x24')][_0xb760('0x48')]({'where':{'id':_0x3e4520[_0xb760('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x285051,null))[_0xb760('0x38')](function(_0xc4858d){if(_0xc4858d){return _0x285051[_0xb760('0x49')](path[_0xb760('0x4a')](config['root'],_0xb760('0x4b'),_0xc4858d[_0xb760('0x4c')]));}})[_0xb760('0x3d')](handleError(_0x285051,null));}; \ No newline at end of file +var _0xf95f=['squel','to-csv','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','Attachment','rawAttributes','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','field','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','create','file','originalname','basename','filename','mimetype','download','root','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash'];(function(_0x2cecd1,_0x41529a){var _0x516586=function(_0x4cbe95){while(--_0x4cbe95){_0x2cecd1['push'](_0x2cecd1['shift']());}};_0x516586(++_0x41529a);}(_0xf95f,0xda));var _0xff95=function(_0x9102f8,_0x578620){_0x9102f8=_0x9102f8-0x0;var _0x356161=_0xf95f[_0x9102f8];return _0x356161;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff95('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff95('0x1'));var jsonpatch=require(_0xff95('0x2'));var rp=require('request-promise');var moment=require(_0xff95('0x3'));var BPromise=require(_0xff95('0x4'));var Mustache=require(_0xff95('0x5'));var util=require(_0xff95('0x6'));var path=require(_0xff95('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xff95('0x8'));var fs=require('fs');var _=require(_0xff95('0x9'));var squel=require(_0xff95('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff95('0xb'));var querystring=require(_0xff95('0xc'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xff95('0xd'));var Redis=require(_0xff95('0xe'));var qs=require(_0xff95('0xf'));var logger=require(_0xff95('0x10'))(_0xff95('0x11'));var utils=require('../../config/utils');var config=require(_0xff95('0x12'));var db=require(_0xff95('0x13'))['db'];function respondWithStatusCode(_0xace09e,_0x48be85){_0x48be85=_0x48be85||0xcc;return function(_0x1ece78){if(_0x1ece78){return _0xace09e[_0xff95('0x14')](_0x48be85);}return _0xace09e[_0xff95('0x15')](_0x48be85)[_0xff95('0x16')]();};}function respondWithResult(_0x56b2eb,_0x486cb3){_0x486cb3=_0x486cb3||0xc8;return function(_0x1a767e){if(_0x1a767e){return _0x56b2eb[_0xff95('0x15')](_0x486cb3)['json'](_0x1a767e);}};}function respondWithFilteredResult(_0x49bffa,_0xde6cec){return function(_0x28cff3){if(_0x28cff3){var _0x3b11a0=_0x28cff3[_0xff95('0x17')],_0x1501ba=_0xde6cec['offset'],_0x1e2c58=_0xde6cec[_0xff95('0x18')]+_0xde6cec[_0xff95('0x19')],_0x477041;if(_0x1e2c58>=_0x3b11a0){_0x1e2c58=_0x3b11a0;_0x477041=0xc8;}else{_0x477041=0xce;}_0x49bffa[_0xff95('0x15')](_0x477041);return _0x49bffa[_0xff95('0x1a')](_0xff95('0x1b'),_0x1501ba+'-'+_0x1e2c58+'/'+_0x3b11a0)[_0xff95('0x1c')](_0x28cff3);}return null;};}function patchUpdates(_0x329f37){return function(_0x31ec45){try{jsonpatch[_0xff95('0x1d')](_0x31ec45,_0x329f37,!![]);}catch(_0x4759d){return BPromise[_0xff95('0x1e')](_0x4759d);}return _0x31ec45[_0xff95('0x1f')]();};}function saveUpdates(_0x42650f,_0x3fba66){return function(_0x244b4d){if(_0x244b4d){return _0x244b4d[_0xff95('0x20')](_0x42650f)[_0xff95('0x21')](function(_0x3beef6){return _0x3beef6;});}return null;};}function removeEntity(_0x499f72,_0x4569b6){return function(_0x1d14e8){if(_0x1d14e8){return _0x1d14e8[_0xff95('0x22')]()[_0xff95('0x21')](function(){_0x499f72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1061a1,_0x46c4a1){return function(_0x227d5a){if(!_0x227d5a){_0x1061a1[_0xff95('0x14')](0x194);}return _0x227d5a;};}function handleError(_0x66dd51,_0x510e78){_0x510e78=_0x510e78||0x1f4;return function(_0x264f2f){logger['error'](_0x264f2f[_0xff95('0x23')]);if(_0x264f2f[_0xff95('0x24')]){delete _0x264f2f[_0xff95('0x24')];}_0x66dd51[_0xff95('0x15')](_0x510e78)[_0xff95('0x25')](_0x264f2f);};}exports[_0xff95('0x26')]=function(_0x30e1dd,_0x45263b){var _0x44af82={},_0x2d2496={},_0x347513={'count':0x0,'rows':[]};var _0x395819=db[_0xff95('0x27')][_0xff95('0x28')];_0x2d2496[_0xff95('0x29')]=_['keys'](_0x395819);_0x2d2496['query']=_['keys'](_0x30e1dd['query']);_0x2d2496['filters']=_[_0xff95('0x2a')](_0x2d2496[_0xff95('0x29')],_0x2d2496[_0xff95('0x2b')]);_0x44af82[_0xff95('0x2c')]=_['intersection'](_0x2d2496[_0xff95('0x29')],qs[_0xff95('0x2d')](_0x30e1dd[_0xff95('0x2b')][_0xff95('0x2d')]));_0x44af82['attributes']=_0x44af82[_0xff95('0x2c')][_0xff95('0x2e')]?_0x44af82[_0xff95('0x2c')]:_0x2d2496[_0xff95('0x29')];if(!_0x30e1dd['query'][_0xff95('0x2f')](_0xff95('0x30'))){_0x44af82[_0xff95('0x19')]=qs[_0xff95('0x19')](_0x30e1dd['query']['limit']);_0x44af82[_0xff95('0x18')]=qs[_0xff95('0x18')](_0x30e1dd[_0xff95('0x2b')][_0xff95('0x18')]);}_0x44af82[_0xff95('0x31')]=qs['sort'](_0x30e1dd[_0xff95('0x2b')][_0xff95('0x32')]);_0x44af82[_0xff95('0x33')]=qs['filters'](_['pick'](_0x30e1dd[_0xff95('0x2b')],_0x2d2496[_0xff95('0x34')]));if(_0x30e1dd[_0xff95('0x2b')][_0xff95('0x35')]){_0x44af82[_0xff95('0x33')]=_[_0xff95('0x36')](_0x44af82[_0xff95('0x33')],{'$or':_[_0xff95('0x37')](_0x395819,function(_0x521ca7){if(_0x521ca7['type']['key']!=='VIRTUAL'){var _0xdfbf9d={};_0xdfbf9d[_0x521ca7[_0xff95('0x38')]]={'$like':'%'+_0x30e1dd['query'][_0xff95('0x35')]+'%'};return _0xdfbf9d;}})});}_0x44af82=_[_0xff95('0x36')]({},_0x44af82,_0x30e1dd[_0xff95('0x39')]);var _0x404b37={'where':_0x44af82[_0xff95('0x33')]};return db[_0xff95('0x27')][_0xff95('0x17')](_0x404b37)['then'](function(_0xbd1043){_0x347513[_0xff95('0x17')]=_0xbd1043;if(_0x30e1dd[_0xff95('0x2b')][_0xff95('0x3a')]){_0x44af82[_0xff95('0x3b')]=[{'all':!![]}];}return db[_0xff95('0x27')][_0xff95('0x3c')](_0x44af82);})[_0xff95('0x21')](function(_0x12a83b){_0x347513[_0xff95('0x3d')]=_0x12a83b;return _0x347513;})[_0xff95('0x21')](respondWithFilteredResult(_0x45263b,_0x44af82))[_0xff95('0x3e')](handleError(_0x45263b,null));};exports[_0xff95('0x3f')]=function(_0x43824a,_0x3e3807){var _0x4c443b={'raw':!![],'where':{'id':_0x43824a[_0xff95('0x40')]['id']}},_0x55dfc3={};_0x55dfc3[_0xff95('0x29')]=_['keys'](db[_0xff95('0x27')][_0xff95('0x28')]);_0x55dfc3['query']=_[_0xff95('0x41')](_0x43824a[_0xff95('0x2b')]);_0x55dfc3[_0xff95('0x34')]=_[_0xff95('0x2a')](_0x55dfc3[_0xff95('0x29')],_0x55dfc3['query']);_0x4c443b[_0xff95('0x2c')]=_[_0xff95('0x2a')](_0x55dfc3['model'],qs[_0xff95('0x2d')](_0x43824a[_0xff95('0x2b')][_0xff95('0x2d')]));_0x4c443b[_0xff95('0x2c')]=_0x4c443b[_0xff95('0x2c')]['length']?_0x4c443b['attributes']:_0x55dfc3['model'];if(_0x43824a[_0xff95('0x2b')]['includeAll']){_0x4c443b[_0xff95('0x3b')]=[{'all':!![]}];}_0x4c443b=_[_0xff95('0x36')]({},_0x4c443b,_0x43824a[_0xff95('0x39')]);return db[_0xff95('0x27')][_0xff95('0x42')](_0x4c443b)[_0xff95('0x21')](handleEntityNotFound(_0x3e3807,null))[_0xff95('0x21')](respondWithResult(_0x3e3807,null))[_0xff95('0x3e')](handleError(_0x3e3807,null));};exports['update']=function(_0x1038c6,_0x56ae35){if(_0x1038c6[_0xff95('0x43')]['id']){delete _0x1038c6['body']['id'];}return db[_0xff95('0x27')][_0xff95('0x42')]({'where':{'id':_0x1038c6[_0xff95('0x40')]['id']}})[_0xff95('0x21')](handleEntityNotFound(_0x56ae35,null))[_0xff95('0x21')](saveUpdates(_0x1038c6['body'],null))[_0xff95('0x21')](respondWithResult(_0x56ae35,null))[_0xff95('0x3e')](handleError(_0x56ae35,null));};exports[_0xff95('0x22')]=function(_0x58fa03,_0x16392d){return db['Attachment'][_0xff95('0x42')]({'where':{'id':_0x58fa03[_0xff95('0x40')]['id']}})[_0xff95('0x21')](handleEntityNotFound(_0x16392d,null))[_0xff95('0x21')](removeEntity(_0x16392d,null))['catch'](handleError(_0x16392d,null));};exports[_0xff95('0x44')]=function(_0x501c03,_0x3de896,_0x9bd2d8){_0x501c03[_0xff95('0x43')]['name']=_0x501c03[_0xff95('0x45')][_0xff95('0x46')];_0x501c03[_0xff95('0x43')][_0xff95('0x47')]=_0x501c03[_0xff95('0x45')][_0xff95('0x48')];_0x501c03['body']['type']=_0x501c03[_0xff95('0x45')][_0xff95('0x49')];return db[_0xff95('0x27')][_0xff95('0x44')](_0x501c03['body'])[_0xff95('0x21')](respondWithResult(_0x3de896,0xc9))[_0xff95('0x3e')](handleError(_0x3de896,null));};exports['download']=function(_0x21856b,_0x4adaa5,_0x4fa6ab){return db[_0xff95('0x27')]['findOne']({'where':{'id':_0x21856b[_0xff95('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4adaa5,null))[_0xff95('0x21')](function(_0x1a286c){if(_0x1a286c){return _0x4adaa5[_0xff95('0x4a')](path['join'](config[_0xff95('0x4b')],'server/files/attachments/',_0x1a286c[_0xff95('0x47')]));}})[_0xff95('0x3e')](handleError(_0x4adaa5,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d57994d..d5b109d 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 _0x9957=['exports','define','Attachment','attachments','lodash','util','../../config/logger','api','bluebird','request-promise','./attachment.attributes'];(function(_0x27f0b7,_0x170bc3){var _0xe52ba5=function(_0x5447c8){while(--_0x5447c8){_0x27f0b7['push'](_0x27f0b7['shift']());}};_0xe52ba5(++_0x170bc3);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 attributes=require(_0x7995('0x6'));module[_0x7995('0x7')]=function(_0x576d89,_0x744bea){return _0x576d89[_0x7995('0x8')](_0x7995('0x9'),attributes,{'tableName':_0x7995('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['lodash','../../config/logger','api','moment','bluebird','request-promise','define','Attachment','attachments'];(function(_0x58e28,_0x36cb83){var _0x41f75a=function(_0x272c6d){while(--_0x272c6d){_0x58e28['push'](_0x58e28['shift']());}};_0x41f75a(++_0x36cb83);}(_0x7217,0x19e));var _0x7721=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7217[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var attributes=require('./attachment.attributes');module['exports']=function(_0x472a96,_0xce17f9){return _0x472a96[_0x7721('0x6')](_0x7721('0x7'),attributes,{'tableName':_0x7721('0x8'),'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 bd4d333..74de79a 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 _0x3176=['result','CreateAttachment','Attachment','create','body','options','raw','then','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message'];(function(_0x22cc36,_0x2c8292){var _0x7fc85=function(_0x4e476d){while(--_0x4e476d){_0x22cc36['push'](_0x22cc36['shift']());}};_0x7fc85(++_0x2c8292);}(_0x3176,0x1d8));var _0x6317=function(_0x1a1fad,_0x13265f){_0x1a1fad=_0x1a1fad-0x0;var _0x53ec66=_0x3176[_0x1a1fad];return _0x53ec66;};'use strict';var _=require(_0x6317('0x0'));var util=require(_0x6317('0x1'));var moment=require(_0x6317('0x2'));var BPromise=require(_0x6317('0x3'));var rs=require(_0x6317('0x4'));var fs=require('fs');var Redis=require(_0x6317('0x5'));var db=require(_0x6317('0x6'))['db'];var utils=require(_0x6317('0x7'));var logger=require(_0x6317('0x8'))(_0x6317('0x9'));var config=require(_0x6317('0xa'));var jayson=require(_0x6317('0xb'));var client=jayson[_0x6317('0xc')][_0x6317('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1c95dc,_0x2275a4,_0x4afa7d){return new BPromise(function(_0x25c09c,_0x2fa3c3){return client[_0x6317('0xe')](_0x1c95dc,_0x4afa7d)['then'](function(_0x25abc7){logger['info']('Attachment,\x20%s,\x20%s',_0x2275a4,_0x6317('0xf'));logger[_0x6317('0x10')](_0x6317('0x11'),_0x2275a4,_0x6317('0xf'),JSON[_0x6317('0x12')](_0x25abc7));if(_0x25abc7['error']){if(_0x25abc7[_0x6317('0x13')][_0x6317('0x14')]===0x1f4){logger['error'](_0x6317('0x15'),_0x2275a4,_0x25abc7[_0x6317('0x13')]['message']);return _0x2fa3c3(_0x25abc7[_0x6317('0x13')][_0x6317('0x16')]);}logger['error'](_0x6317('0x15'),_0x2275a4,_0x25abc7[_0x6317('0x13')][_0x6317('0x16')]);return _0x25c09c(_0x25abc7[_0x6317('0x13')][_0x6317('0x16')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x2275a4,'request\x20sent');_0x25c09c(_0x25abc7[_0x6317('0x17')]['message']);}})['catch'](function(_0x24f67e){logger['error']('Attachment,\x20%s,\x20%s',_0x2275a4,_0x24f67e);_0x2fa3c3(_0x24f67e);});});}exports[_0x6317('0x18')]=function(_0x1d8497){var _0x4ad386=this;return new Promise(function(_0xc90572,_0x519851){return db[_0x6317('0x19')][_0x6317('0x1a')](_0x1d8497[_0x6317('0x1b')],{'raw':_0x1d8497[_0x6317('0x1c')]?_0x1d8497['options'][_0x6317('0x1d')]===undefined?!![]:![]:!![]})[_0x6317('0x1e')](function(_0x30c5f1){logger[_0x6317('0x1f')](_0x6317('0x18'),_0x1d8497);logger[_0x6317('0x10')](_0x6317('0x18'),_0x1d8497,JSON[_0x6317('0x12')](_0x30c5f1));_0xc90572(_0x30c5f1);})[_0x6317('0x20')](function(_0x1e9b7e){logger['error'](_0x6317('0x18'),_0x1e9b7e['message'],_0x1d8497);_0x519851(_0x4ad386[_0x6317('0x13')](0x1f4,_0x1e9b7e['message']));});});}; \ No newline at end of file +var _0xc496=['../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateAttachment','create','body','options','raw','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x591d95,_0x3df684){var _0x472982=function(_0x20942b){while(--_0x20942b){_0x591d95['push'](_0x591d95['shift']());}};_0x472982(++_0x3df684);}(_0xc496,0x170));var _0x6c49=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0xc496[_0x15dbca];return _0x326533;};'use strict';var _=require(_0x6c49('0x0'));var util=require(_0x6c49('0x1'));var moment=require(_0x6c49('0x2'));var BPromise=require(_0x6c49('0x3'));var rs=require(_0x6c49('0x4'));var fs=require('fs');var Redis=require(_0x6c49('0x5'));var db=require(_0x6c49('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c49('0x7'))(_0x6c49('0x8'));var config=require(_0x6c49('0x9'));var jayson=require(_0x6c49('0xa'));var client=jayson['client'][_0x6c49('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b7124,_0x215be8,_0x304fac){return new BPromise(function(_0x8cca61,_0xdf4cc5){return client[_0x6c49('0xc')](_0x4b7124,_0x304fac)[_0x6c49('0xd')](function(_0x50fa5f){logger[_0x6c49('0xe')](_0x6c49('0xf'),_0x215be8,_0x6c49('0x10'));logger[_0x6c49('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x215be8,_0x6c49('0x10'),JSON['stringify'](_0x50fa5f));if(_0x50fa5f[_0x6c49('0x12')]){if(_0x50fa5f[_0x6c49('0x12')][_0x6c49('0x13')]===0x1f4){logger[_0x6c49('0x12')](_0x6c49('0xf'),_0x215be8,_0x50fa5f[_0x6c49('0x12')][_0x6c49('0x14')]);return _0xdf4cc5(_0x50fa5f[_0x6c49('0x12')][_0x6c49('0x14')]);}logger[_0x6c49('0x12')]('Attachment,\x20%s,\x20%s',_0x215be8,_0x50fa5f[_0x6c49('0x12')]['message']);return _0x8cca61(_0x50fa5f[_0x6c49('0x12')]['message']);}else{logger[_0x6c49('0xe')](_0x6c49('0xf'),_0x215be8,_0x6c49('0x10'));_0x8cca61(_0x50fa5f[_0x6c49('0x15')][_0x6c49('0x14')]);}})['catch'](function(_0x2af366){logger[_0x6c49('0x12')](_0x6c49('0xf'),_0x215be8,_0x2af366);_0xdf4cc5(_0x2af366);});});}exports[_0x6c49('0x16')]=function(_0x276ed8){var _0x5651c1=this;return new Promise(function(_0x5de542,_0x495284){return db['Attachment'][_0x6c49('0x17')](_0x276ed8[_0x6c49('0x18')],{'raw':_0x276ed8[_0x6c49('0x19')]?_0x276ed8[_0x6c49('0x19')][_0x6c49('0x1a')]===undefined?!![]:![]:!![]})[_0x6c49('0xd')](function(_0x452a5d){logger[_0x6c49('0xe')](_0x6c49('0x16'),_0x276ed8);logger['debug'](_0x6c49('0x16'),_0x276ed8,JSON[_0x6c49('0x1b')](_0x452a5d));_0x5de542(_0x452a5d);})[_0x6c49('0x1c')](function(_0x39d626){logger[_0x6c49('0x12')](_0x6c49('0x16'),_0x39d626[_0x6c49('0x14')],_0x276ed8);_0x495284(_0x5651c1[_0x6c49('0x12')](0x1f4,_0x39d626['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 10ac957..190d0ec 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 _0xc576=['isAuthenticated','download','join','server/files/attachments/','format','%s-%s','originalname','replace','post','single','file','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./attachment.controller','get','index','/:id'];(function(_0x24b1a2,_0x70069d){var _0x4c9f5a=function(_0x5ee915){while(--_0x5ee915){_0x24b1a2['push'](_0x24b1a2['shift']());}};_0x4c9f5a(++_0x70069d);}(_0xc576,0x1ea));var _0x6c57=function(_0x90e575,_0x48c2ec){_0x90e575=_0x90e575-0x0;var _0x1aae60=_0xc576[_0x90e575];return _0x1aae60;};'use strict';var multer=require(_0x6c57('0x0'));var util=require(_0x6c57('0x1'));var path=require(_0x6c57('0x2'));var timeout=require(_0x6c57('0x3'));var express=require(_0x6c57('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6c57('0x5'));var config=require('../../config/environment');var controller=require(_0x6c57('0x6'));router[_0x6c57('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c57('0x8')]);router['get'](_0x6c57('0x9'),auth[_0x6c57('0xa')](),controller['show']);router[_0x6c57('0x7')]('/:id/download',auth[_0x6c57('0xa')](),controller[_0x6c57('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb2eec3,_0x344c26,_0x1cef2c){_0x1cef2c(null,path[_0x6c57('0xc')](config['root'],_0x6c57('0xd')));},'filename':function(_0x78dda8,_0x33befd,_0x39e3c9){_0x39e3c9(null,util[_0x6c57('0xe')](_0x6c57('0xf'),Date['now'](),_0x33befd[_0x6c57('0x10')][_0x6c57('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6c57('0x12')]('/',upload[_0x6c57('0x13')](_0x6c57('0x14')),controller['create']);router['put'](_0x6c57('0x9'),auth[_0x6c57('0xa')](),controller[_0x6c57('0x15')]);router[_0x6c57('0x16')](_0x6c57('0x9'),auth[_0x6c57('0xa')](),controller[_0x6c57('0x17')]);module[_0x6c57('0x18')]=router; \ No newline at end of file +var _0x292b=['../../config/environment','./attachment.controller','get','/:id','isAuthenticated','/:id/download','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x313cc1,_0x1f3bec){var _0x4b9d60=function(_0x571815){while(--_0x571815){_0x313cc1['push'](_0x313cc1['shift']());}};_0x4b9d60(++_0x1f3bec);}(_0x292b,0x64));var _0xb292=function(_0x3c68ac,_0x38b406){_0x3c68ac=_0x3c68ac-0x0;var _0x35d849=_0x292b[_0x3c68ac];return _0x35d849;};'use strict';var multer=require(_0xb292('0x0'));var util=require(_0xb292('0x1'));var path=require(_0xb292('0x2'));var timeout=require(_0xb292('0x3'));var express=require(_0xb292('0x4'));var router=express[_0xb292('0x5')]();var auth=require(_0xb292('0x6'));var interaction=require(_0xb292('0x7'));var config=require(_0xb292('0x8'));var controller=require(_0xb292('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb292('0xa')](_0xb292('0xb'),auth[_0xb292('0xc')](),controller['show']);router[_0xb292('0xa')](_0xb292('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xb292('0xe')]({'destination':function(_0xa30857,_0x36be8a,_0x5b4b7a){_0x5b4b7a(null,path[_0xb292('0xf')](config[_0xb292('0x10')],_0xb292('0x11')));},'filename':function(_0x19a27d,_0x537d8b,_0x2587cf){_0x2587cf(null,util[_0xb292('0x12')](_0xb292('0x13'),Date[_0xb292('0x14')](),_0x537d8b['originalname'][_0xb292('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb292('0x16')]('/',upload['single']('file'),controller['create']);router[_0xb292('0x17')](_0xb292('0xb'),auth[_0xb292('0xc')](),controller[_0xb292('0x18')]);router[_0xb292('0x19')](_0xb292('0xb'),auth[_0xb292('0xc')](),controller['destroy']);module[_0xb292('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index bb153de..f6986c1 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 _0x27a8=['callbackURL','User','map','value','admin','user','Incorrect\x20username\x20and/or\x20password','catch','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret'];(function(_0x3e47c2,_0x29b32b){var _0x4be87c=function(_0x3a6876){while(--_0x3a6876){_0x3e47c2['push'](_0x3e47c2['shift']());}};_0x4be87c(++_0x29b32b);}(_0x27a8,0x170));var _0x827a=function(_0x133de2,_0x2ecfc2){_0x133de2=_0x133de2-0x0;var _0x3de2cc=_0x27a8[_0x133de2];return _0x3de2cc;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0x827a('0x0'))[_0x827a('0x1')];var db=require(_0x827a('0x2'))['db'];var config=require(_0x827a('0x3'));var signToken=require(_0x827a('0x4'))[_0x827a('0x5')];exports[_0x827a('0x6')]=passport[_0x827a('0x7')](_0x827a('0x8'),{'failureRedirect':_0x827a('0x9'),'scope':[_0x827a('0xa'),_0x827a('0xb')],'session':![]});exports[_0x827a('0xc')]=passport[_0x827a('0x7')](_0x827a('0x8'),{'failureRedirect':_0x827a('0x9'),'session':![]});passport[_0x827a('0xd')](new GoogleStrategy({'clientID':config[_0x827a('0x8')]?config[_0x827a('0x8')][_0x827a('0xe')]:'id','clientSecret':config[_0x827a('0x8')]?config[_0x827a('0x8')][_0x827a('0xf')]:'secret','callbackURL':config['google']?config[_0x827a('0x8')][_0x827a('0x10')]:''},function(_0x2d04a3,_0x588e28,_0x5d56f2,_0x9c6b92){db[_0x827a('0x11')]['find']({'where':{'email':_[_0x827a('0x12')](_0x5d56f2['emails'],_0x827a('0x13')),'role':{'$or':[_0x827a('0x14'),_0x827a('0x15'),'agent']}}})['then'](function(_0x2b8117){if(_0x2b8117){return _0x9c6b92(null,_0x2b8117);}_0x9c6b92(_0x827a('0x16'));})[_0x827a('0x17')](function(_0x4a3e8a){_0x9c6b92(_0x4a3e8a);});})); \ No newline at end of file +var _0x8f6b=['../../config/environment','signToken','login','google','profile','callback','/login','clientID','clientSecret','secret','callbackURL','User','find','emails','value','admin','agent','Incorrect\x20username\x20and/or\x20password','lodash','passport','passport-google-oauth20','../../mysqldb'];(function(_0x3b3bea,_0x2aef1f){var _0x13a6a8=function(_0x47ee43){while(--_0x47ee43){_0x3b3bea['push'](_0x3b3bea['shift']());}};_0x13a6a8(++_0x2aef1f);}(_0x8f6b,0x146));var _0xb8f6=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8f6b[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xb8f6('0x0'));var passport=require(_0xb8f6('0x1'));var GoogleStrategy=require(_0xb8f6('0x2'))['Strategy'];var db=require(_0xb8f6('0x3'))['db'];var config=require(_0xb8f6('0x4'));var signToken=require('../../components/auth/service')[_0xb8f6('0x5')];exports[_0xb8f6('0x6')]=passport['authenticate'](_0xb8f6('0x7'),{'failureRedirect':'/login','scope':[_0xb8f6('0x8'),'email'],'session':![]});exports[_0xb8f6('0x9')]=passport['authenticate'](_0xb8f6('0x7'),{'failureRedirect':_0xb8f6('0xa'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config[_0xb8f6('0x7')][_0xb8f6('0xb')]:'id','clientSecret':config[_0xb8f6('0x7')]?config[_0xb8f6('0x7')][_0xb8f6('0xc')]:_0xb8f6('0xd'),'callbackURL':config[_0xb8f6('0x7')]?config[_0xb8f6('0x7')][_0xb8f6('0xe')]:''},function(_0x2ef5c1,_0x4eb721,_0x3f4863,_0x51895e){db[_0xb8f6('0xf')][_0xb8f6('0x10')]({'where':{'email':_['map'](_0x3f4863[_0xb8f6('0x11')],_0xb8f6('0x12')),'role':{'$or':[_0xb8f6('0x13'),'user',_0xb8f6('0x14')]}}})['then'](function(_0x237dc3){if(_0x237dc3){return _0x51895e(null,_0x237dc3);}_0x51895e(_0xb8f6('0x15'));})['catch'](function(_0x48b20b){_0x51895e(_0x48b20b);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index e0f7f80..2b27f8f 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 _0xaced=['exports','express','passport','Router','../../components/auth/service','login','get','callback'];(function(_0xab3677,_0x11172b){var _0x5cbf7a=function(_0x2405ab){while(--_0x2405ab){_0xab3677['push'](_0xab3677['shift']());}};_0x5cbf7a(++_0x11172b);}(_0xaced,0x1b9));var _0xdace=function(_0x5e5891,_0x727f09){_0x5e5891=_0x5e5891-0x0;var _0x812cfd=_0xaced[_0x5e5891];return _0x812cfd;};'use strict';var express=require(_0xdace('0x0'));var passport=require(_0xdace('0x1'));var router=express[_0xdace('0x2')]();var controller=require('./authGoogle.controller');var setTokenCookie=require(_0xdace('0x3'))['setTokenCookie'];router['get']('/',controller[_0xdace('0x4')]);router[_0xdace('0x5')]('/callback',controller[_0xdace('0x6')],setTokenCookie);module[_0xdace('0x7')]=router; \ No newline at end of file +var _0x4f3c=['../../components/auth/service','setTokenCookie','login','get','/callback','callback','exports','express','passport','Router','./authGoogle.controller'];(function(_0x567c0d,_0x4fd237){var _0x541ecd=function(_0x10fc77){while(--_0x10fc77){_0x567c0d['push'](_0x567c0d['shift']());}};_0x541ecd(++_0x4fd237);}(_0x4f3c,0x167));var _0xc4f3=function(_0xf33afd,_0x2363b6){_0xf33afd=_0xf33afd-0x0;var _0x5f432a=_0x4f3c[_0xf33afd];return _0x5f432a;};'use strict';var express=require(_0xc4f3('0x0'));var passport=require(_0xc4f3('0x1'));var router=express[_0xc4f3('0x2')]();var controller=require(_0xc4f3('0x3'));var setTokenCookie=require(_0xc4f3('0x4'))[_0xc4f3('0x5')];router['get']('/',controller[_0xc4f3('0x6')]);router[_0xc4f3('0x7')](_0xc4f3('0x8'),controller[_0xc4f3('0x9')],setTokenCookie);module[_0xc4f3('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 93d2d7d..76bf664 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 _0x955f=['Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','error','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','http://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','catch','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','use','util','passport','passport-local','Strategy','bluebird','lodash','randomstring','../../components/auth/service','signToken','client','role','agent','User','count','then','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','find','admin','user','name','authenticate','Incorrect\x20username\x20and/or\x20password','MailAccount','email','MailServerOut'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x955f,0x1eb));var _0xf955=function(_0x5c1150,_0x2ac026){_0x5c1150=_0x5c1150-0x0;var _0x3b11e5=_0x955f[_0x5c1150];return _0x3b11e5;};'use strict';var util=require(_0xf955('0x0'));var passport=require(_0xf955('0x1'));var LocalStrategy=require(_0xf955('0x2'))[_0xf955('0x3')];var BPromise=require(_0xf955('0x4'));var jayson=require('jayson/promise');var _=require(_0xf955('0x5'));var logger=require('../../config/logger')('api');var rs=require(_0xf955('0x6'));var db=require('../../mysqldb')['db'];var signToken=require(_0xf955('0x7'))[_0xf955('0x8')];var client=jayson[_0xf955('0x9')]['http']({'port':0x232b});var getLicense=function(_0x18432f){return new BPromise(function(_0x20c096,_0x4f58fb){var _0x254b38=0x0;_0x18432f[_0xf955('0xa')]!==_0xf955('0xb')&&_0x20c096(_0x18432f);return db[_0xf955('0xc')][_0xf955('0xd')]({'where':{'role':_0xf955('0xb'),'online':!![],'id':{'$ne':_0x18432f['id']}}})[_0xf955('0xe')](function(_0x4d213a){_0x254b38=_0x4d213a;return require(_0xf955('0xf'))['getLicense']();})[_0xf955('0xe')](function(_0x5d6211){if(_0x5d6211&&_0x5d6211[_0xf955('0x10')]&&_0x254b38>=_0x5d6211['agents']){return _0x4f58fb({'message':_0xf955('0x11')});}return _0x20c096(_0x18432f);})['catch'](function(_0x23e0c6){return _0x4f58fb(_0x23e0c6);});});};function localAuthenticate(_0x50d9a9,_0x19c94a,_0x2ff7e5,_0x22507a){_0x50d9a9[_0xf955('0x12')]({'where':{'name':_0x19c94a,'role':{'$or':[_0xf955('0x13'),_0xf955('0x14'),_0xf955('0xb')]}}})[_0xf955('0xe')](function(_0x3c6af7){if(!_0x3c6af7||_0x3c6af7&&_0x3c6af7[_0xf955('0x15')]!==_0x19c94a){return _0x22507a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password'});}return getLicense(_0x3c6af7);})[_0xf955('0xe')](function(_0x54e60b){_0x54e60b[_0xf955('0x16')](_0x2ff7e5,function(_0x3a814f,_0x2f881b){if(_0x3a814f){return _0x22507a(_0x3a814f);}if(!_0x2f881b){return _0x22507a(null,![],{'message':_0xf955('0x17')});}else{return _0x22507a(null,_0x54e60b);}});})['catch'](function(_0x5ac6cb){_0x22507a(_0x5ac6cb);});}function sendServiceMail(_0x1e20d1){return db[_0xf955('0x18')][_0xf955('0x12')]({'where':{'service':!![]},'attributes':['id','name',_0xf955('0x19')],'include':[{'model':db[_0xf955('0x1a')],'as':_0xf955('0x1b')}]})[_0xf955('0xe')](function(_0x3ae4fb){if(!_0x3ae4fb){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x17d86a={'tls':{'rejectUnauthorized':![]}};if(_0x3ae4fb[_0xf955('0x1b')][_0xf955('0x1c')]){_0x17d86a['service']=_0x3ae4fb[_0xf955('0x1b')]['service'];}else{_0x17d86a[_0xf955('0x1d')]=_0x3ae4fb[_0xf955('0x1b')][_0xf955('0x1d')];_0x17d86a[_0xf955('0x1e')]=_0x3ae4fb[_0xf955('0x1b')]['port'];_0x17d86a[_0xf955('0x1f')]=_0x3ae4fb[_0xf955('0x1b')][_0xf955('0x1f')];}if(_0x3ae4fb[_0xf955('0x1b')][_0xf955('0x20')]){_0x17d86a[_0xf955('0x21')]={'user':_0x3ae4fb[_0xf955('0x1b')]['user'],'pass':_0x3ae4fb[_0xf955('0x1b')][_0xf955('0x22')]};}var _0xba8a22={'account':_0x17d86a,'message':_[_0xf955('0x23')]({'from':util[_0xf955('0x24')](_0xf955('0x25'),_0x3ae4fb[_0xf955('0x15')],_0x3ae4fb['email']||_0x3ae4fb[_0xf955('0x1b')][_0xf955('0x14')])},_0x1e20d1)};return client[_0xf955('0x26')](_0xf955('0x27'),_0xba8a22);})[_0xf955('0xe')](function(_0x264f6d){if(_0x264f6d['error']){throw new Error(util[_0xf955('0x24')](_0xf955('0x28'),_0x264f6d['error'][_0xf955('0x29')]||JSON[_0xf955('0x2a')](_0x264f6d[_0xf955('0x2b')])));}return!![];});}function handleError(_0x1ef794,_0x59bfb5,_0x3a951c){return _0x1ef794['status'](_0x59bfb5||0x1f4)[_0xf955('0x2c')]({'message':_0x3a951c?_0x3a951c[_0xf955('0x29')]||_0x3a951c:''});}exports[_0xf955('0x2d')]=function(_0x4069fe,_0x1e8024,_0x32121b){passport[_0xf955('0x16')](_0xf955('0x2e'),function(_0x483a12,_0x45e913,_0x165cc4){var _0x3964d3=_0x483a12||_0x165cc4;if(_0x3964d3){return handleError(_0x1e8024,0x191,_0x3964d3);}if(!_0x45e913){return handleError(_0x1e8024,0x194,{'message':_0xf955('0x2f')});}var _0x4fea0c=signToken(_0x45e913['id'],_0x45e913[_0xf955('0xa')]);_0x1e8024[_0xf955('0x30')]({'id':_0x45e913['id'],'token':_0x4fea0c,'statusCall':'','isAlreadyLogged':_0x45e913[_0xf955('0x31')]});})(_0x4069fe,_0x1e8024,_0x32121b);};exports[_0xf955('0x32')]=function(_0xdbc53e,_0x4eb2c3,_0x4d7155){if(!_0xdbc53e['body'][_0xf955('0x19')]){return handleError(_0x4eb2c3,0x1f4,{'message':_0xf955('0x33')});}var _0x374e95=rs[_0xf955('0x34')]();_0xdbc53e[_0xf955('0x35')][_0xf955('0x19')]=_0xdbc53e['body'][_0xf955('0x19')]['trim']()[_0xf955('0x36')]();return db[_0xf955('0xc')][_0xf955('0x12')]({'where':{'email':_0xdbc53e['body'][_0xf955('0x19')]}})['then'](function(_0x2bc1a0){if(!_0x2bc1a0){throw new Error(_0xf955('0x37'));}_0x2bc1a0[_0xf955('0x38')]=_0x374e95;_0x2bc1a0[_0xf955('0x39')]=Date['now']()+0x36ee80;return _0x2bc1a0[_0xf955('0x3a')]();})[_0xf955('0xe')](function(){return sendServiceMail({'to':_0xdbc53e['body'][_0xf955('0x19')],'subject':_0xf955('0x3b'),'text':_0xf955('0x3c')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xf955('0x3d')+_0xdbc53e[_0xf955('0x3e')][_0xf955('0x1d')]+'/reset/'+_0x374e95+'\x0a\x0a'+_0xf955('0x3f')});})[_0xf955('0xe')](function(){_0x4eb2c3[_0xf955('0x40')](0xc8)[_0xf955('0x2c')]({'message':_0xf955('0x41')});})[_0xf955('0x42')](function(_0x2b614d){return handleError(_0x4eb2c3,0x1f4,_0x2b614d);});};exports[_0xf955('0x43')]=function(_0x5671c7,_0x8fa41b,_0x7123c1){return db[_0xf955('0xc')][_0xf955('0x12')]({'where':{'resetPasswordToken':_0x5671c7[_0xf955('0x44')][_0xf955('0x45')],'resetPasswordExpires':{'$gt':Date[_0xf955('0x46')]()}}})[_0xf955('0xe')](function(_0x47651b){if(!_0x47651b){throw new Error(_0xf955('0x47'));}_0x47651b[_0xf955('0x48')]=_0x5671c7[_0xf955('0x35')][_0xf955('0x48')];_0x47651b[_0xf955('0x38')]=null;_0x47651b[_0xf955('0x39')]=null;return _0x47651b[_0xf955('0x3a')]();})[_0xf955('0xe')](function(){_0x8fa41b[_0xf955('0x40')](0xc8)[_0xf955('0x2c')]({'message':'Password\x20reset!'});})[_0xf955('0x42')](function(_0x25d809){return handleError(_0x8fa41b,0x1f4,_0x25d809);});};passport[_0xf955('0x49')](new LocalStrategy({'usernameField':'name','passwordField':_0xf955('0x48')},function(_0x485e77,_0x398224,_0x56a4ca){return localAuthenticate(db[_0xf955('0xc')],_0x485e77,_0x398224,_0x56a4ca);})); \ No newline at end of file +var _0xb6fa=['service','host','port','secure','authentication','auth','user','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','format','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','save','Password\x20reset!','use','util','Strategy','lodash','../../config/logger','randomstring','../../mysqldb','../../components/auth/service','signToken','client','http','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','find','admin','name','authenticate','MailAccount','email','Smtp'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xb6fa[_0x249e96];return _0x17444c;};'use strict';var util=require(_0xab6f('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0xab6f('0x1')];var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xab6f('0x2'));var logger=require(_0xab6f('0x3'))('api');var rs=require(_0xab6f('0x4'));var db=require(_0xab6f('0x5'))['db'];var signToken=require(_0xab6f('0x6'))[_0xab6f('0x7')];var client=jayson[_0xab6f('0x8')][_0xab6f('0x9')]({'port':0x232b});var getLicense=function(_0x16b84e){return new BPromise(function(_0x1b4da9,_0x46b0f6){var _0x85cb19=0x0;_0x16b84e[_0xab6f('0xa')]!==_0xab6f('0xb')&&_0x1b4da9(_0x16b84e);return db[_0xab6f('0xc')][_0xab6f('0xd')]({'where':{'role':_0xab6f('0xb'),'online':!![],'id':{'$ne':_0x16b84e['id']}}})[_0xab6f('0xe')](function(_0x4838a8){_0x85cb19=_0x4838a8;return require('../../config/license/util')[_0xab6f('0xf')]();})[_0xab6f('0xe')](function(_0x48c542){if(_0x48c542&&_0x48c542[_0xab6f('0x10')]&&_0x85cb19>=_0x48c542[_0xab6f('0x10')]){return _0x46b0f6({'message':_0xab6f('0x11')});}return _0x1b4da9(_0x16b84e);})[_0xab6f('0x12')](function(_0x139fcf){return _0x46b0f6(_0x139fcf);});});};function localAuthenticate(_0x245ac9,_0x45ee53,_0x5eac8b,_0x383c30){_0x245ac9[_0xab6f('0x13')]({'where':{'name':_0x45ee53,'role':{'$or':[_0xab6f('0x14'),'user',_0xab6f('0xb')]}}})['then'](function(_0x49d9f1){if(!_0x49d9f1||_0x49d9f1&&_0x49d9f1[_0xab6f('0x15')]!==_0x45ee53){return _0x383c30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password'});}return getLicense(_0x49d9f1);})[_0xab6f('0xe')](function(_0x3653f0){_0x3653f0[_0xab6f('0x16')](_0x5eac8b,function(_0x59b934,_0x255021){if(_0x59b934){return _0x383c30(_0x59b934);}if(!_0x255021){return _0x383c30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password'});}else{return _0x383c30(null,_0x3653f0);}});})[_0xab6f('0x12')](function(_0x439b73){_0x383c30(_0x439b73);});}function sendServiceMail(_0x3e616c){return db[_0xab6f('0x17')][_0xab6f('0x13')]({'where':{'service':!![]},'attributes':['id',_0xab6f('0x15'),_0xab6f('0x18')],'include':[{'model':db['MailServerOut'],'as':_0xab6f('0x19')}]})[_0xab6f('0xe')](function(_0x175426){if(!_0x175426){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x43eda0={'tls':{'rejectUnauthorized':![]}};if(_0x175426[_0xab6f('0x19')][_0xab6f('0x1a')]){_0x43eda0[_0xab6f('0x1a')]=_0x175426[_0xab6f('0x19')][_0xab6f('0x1a')];}else{_0x43eda0['host']=_0x175426['Smtp'][_0xab6f('0x1b')];_0x43eda0[_0xab6f('0x1c')]=_0x175426[_0xab6f('0x19')][_0xab6f('0x1c')];_0x43eda0[_0xab6f('0x1d')]=_0x175426[_0xab6f('0x19')][_0xab6f('0x1d')];}if(_0x175426['Smtp'][_0xab6f('0x1e')]){_0x43eda0[_0xab6f('0x1f')]={'user':_0x175426['Smtp'][_0xab6f('0x20')],'pass':_0x175426[_0xab6f('0x19')][_0xab6f('0x21')]};}var _0x2e10a7={'account':_0x43eda0,'message':_[_0xab6f('0x22')]({'from':util['format'](_0xab6f('0x23'),_0x175426[_0xab6f('0x15')],_0x175426['email']||_0x175426[_0xab6f('0x19')][_0xab6f('0x20')])},_0x3e616c)};return client[_0xab6f('0x24')](_0xab6f('0x25'),_0x2e10a7);})[_0xab6f('0xe')](function(_0x181bab){if(_0x181bab['error']){throw new Error(util[_0xab6f('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x181bab['error']['message']||JSON['stringify'](_0x181bab['error'])));}return!![];});}function handleError(_0x14af68,_0xd58fdf,_0x4110dd){return _0x14af68[_0xab6f('0x27')](_0xd58fdf||0x1f4)[_0xab6f('0x28')]({'message':_0x4110dd?_0x4110dd['message']||_0x4110dd:''});}exports[_0xab6f('0x29')]=function(_0x11a4d4,_0x86ed70,_0x26c62b){passport[_0xab6f('0x16')](_0xab6f('0x2a'),function(_0x140cac,_0x5b5966,_0x19b056){var _0xab5bb=_0x140cac||_0x19b056;if(_0xab5bb){return handleError(_0x86ed70,0x191,_0xab5bb);}if(!_0x5b5966){return handleError(_0x86ed70,0x194,{'message':_0xab6f('0x2b')});}var _0x5479db=signToken(_0x5b5966['id'],_0x5b5966[_0xab6f('0xa')]);_0x86ed70['json']({'id':_0x5b5966['id'],'token':_0x5479db,'statusCall':'','isAlreadyLogged':_0x5b5966[_0xab6f('0x2c')]});})(_0x11a4d4,_0x86ed70,_0x26c62b);};exports[_0xab6f('0x2d')]=function(_0x3b4e24,_0x37d187,_0x2e9eca){if(!_0x3b4e24[_0xab6f('0x2e')][_0xab6f('0x18')]){return handleError(_0x37d187,0x1f4,{'message':_0xab6f('0x2f')});}var _0x679c47=rs['generate']();_0x3b4e24[_0xab6f('0x2e')]['email']=_0x3b4e24['body'][_0xab6f('0x18')][_0xab6f('0x30')]()[_0xab6f('0x31')]();return db[_0xab6f('0xc')][_0xab6f('0x13')]({'where':{'email':_0x3b4e24[_0xab6f('0x2e')]['email']}})['then'](function(_0x5baf96){if(!_0x5baf96){throw new Error(_0xab6f('0x32'));}_0x5baf96[_0xab6f('0x33')]=_0x679c47;_0x5baf96[_0xab6f('0x34')]=Date[_0xab6f('0x35')]()+0x36ee80;return _0x5baf96['save']();})[_0xab6f('0xe')](function(){return sendServiceMail({'to':_0x3b4e24[_0xab6f('0x2e')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xab6f('0x36')+_0xab6f('0x37')+_0xab6f('0x38')+_0x3b4e24[_0xab6f('0x39')]['host']+'/reset/'+_0x679c47+'\x0a\x0a'+_0xab6f('0x3a')});})[_0xab6f('0xe')](function(){_0x37d187[_0xab6f('0x27')](0xc8)[_0xab6f('0x28')]({'message':_0xab6f('0x3b')});})[_0xab6f('0x12')](function(_0x4e835f){return handleError(_0x37d187,0x1f4,_0x4e835f);});};exports[_0xab6f('0x3c')]=function(_0xedcac4,_0x3be090,_0x435525){return db[_0xab6f('0xc')][_0xab6f('0x13')]({'where':{'resetPasswordToken':_0xedcac4[_0xab6f('0x3d')][_0xab6f('0x3e')],'resetPasswordExpires':{'$gt':Date[_0xab6f('0x35')]()}}})[_0xab6f('0xe')](function(_0x3df7f1){if(!_0x3df7f1){throw new Error(_0xab6f('0x3f'));}_0x3df7f1[_0xab6f('0x40')]=_0xedcac4[_0xab6f('0x2e')][_0xab6f('0x40')];_0x3df7f1[_0xab6f('0x33')]=null;_0x3df7f1['resetPasswordExpires']=null;return _0x3df7f1[_0xab6f('0x41')]();})[_0xab6f('0xe')](function(){_0x3be090[_0xab6f('0x27')](0xc8)[_0xab6f('0x28')]({'message':_0xab6f('0x42')});})['catch'](function(_0x4da669){return handleError(_0x3be090,0x1f4,_0x4da669);});};passport[_0xab6f('0x43')](new LocalStrategy({'usernameField':_0xab6f('0x15'),'passwordField':_0xab6f('0x40')},function(_0x1f7e4c,_0x3e3ef1,_0x4f84d7){return localAuthenticate(db[_0xab6f('0xc')],_0x1f7e4c,_0x3e3ef1,_0x4f84d7);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1dc62de..994fd4b 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 _0xb8e9=['Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','express'];(function(_0x3f6dd2,_0x267a99){var _0x4bc222=function(_0x4caec7){while(--_0x4caec7){_0x3f6dd2['push'](_0x3f6dd2['shift']());}};_0x4bc222(++_0x267a99);}(_0xb8e9,0xce));var _0x9b8e=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0xb8e9[_0x54de5d];return _0x1b349e;};'use strict';var express=require(_0x9b8e('0x0'));var router=express[_0x9b8e('0x1')]();var controller=require(_0x9b8e('0x2'));router[_0x9b8e('0x3')]('/',controller[_0x9b8e('0x4')]);router[_0x9b8e('0x3')](_0x9b8e('0x5'),controller[_0x9b8e('0x6')]);router['post'](_0x9b8e('0x7'),controller[_0x9b8e('0x8')]);module['exports']=router; \ No newline at end of file +var _0xbe2a=['/forgot','forgot','/reset/:token','exports','express','./authLocal.controller','login'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe2a,0xf2));var _0xabe2=function(_0x43dcf9,_0x528619){_0x43dcf9=_0x43dcf9-0x0;var _0x57027e=_0xbe2a[_0x43dcf9];return _0x57027e;};'use strict';var express=require(_0xabe2('0x0'));var router=express['Router']();var controller=require(_0xabe2('0x1'));router['post']('/',controller[_0xabe2('0x2')]);router['post'](_0xabe2('0x3'),controller[_0xabe2('0x4')]);router['post'](_0xabe2('0x5'),controller['reset']);module[_0xabe2('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index f62d114..374c558 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 _0x505d=['STRING','BOOLEAN','INTEGER'];(function(_0x2eec1f,_0x1b9987){var _0x543075=function(_0x5792d2){while(--_0x5792d2){_0x2eec1f['push'](_0x2eec1f['shift']());}};_0x543075(++_0x1b9987);}(_0x505d,0x93));var _0xd505=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x505d[_0x39772f];return _0xc9edbf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd505('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0xd505('0x0')]},'description':{'type':Sequelize[_0xd505('0x0')]},'status':{'type':Sequelize[_0xd505('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd505('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7382=['exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7382,0x111));var _0x2738=function(_0x55cab9,_0x52d1e9){_0x55cab9=_0x55cab9-0x0;var _0x48b567=_0x7382[_0x55cab9];return _0x48b567;};'use strict';var Sequelize=require('sequelize');module[_0x2738('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 0111eb6..1dee583 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 _0x2488=['jsforce','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','limit','order','sort','where','filter','map','VIRTUAL','field','merge','options','includeAll','findAll','rows','show','include','Automation','find','catch','create','body','update','params','Condition','ids','omit','getConditions','pick','addActions','Action','getActions','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x42235f,_0x5dabfd){var _0x3f5fab=function(_0x358fd7){while(--_0x358fd7){_0x42235f['push'](_0x42235f['shift']());}};_0x3f5fab(++_0x5dabfd);}(_0x2488,0x1d8));var _0x8248=function(_0x181d2d,_0x480cc8){_0x181d2d=_0x181d2d-0x0;var _0x4a0cfc=_0x2488[_0x181d2d];return _0x4a0cfc;};'use strict';var pdf=require(_0x8248('0x0'));var emlformat=require(_0x8248('0x1'));var rimraf=require(_0x8248('0x2'));var zipdir=require(_0x8248('0x3'));var jsonpatch=require(_0x8248('0x4'));var rp=require(_0x8248('0x5'));var moment=require('moment');var BPromise=require(_0x8248('0x6'));var Mustache=require('mustache');var util=require(_0x8248('0x7'));var path=require(_0x8248('0x8'));var sox=require(_0x8248('0x9'));var csv=require(_0x8248('0xa'));var ejs=require(_0x8248('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8248('0xc'));var crypto=require(_0x8248('0xd'));var jsforce=require(_0x8248('0xe'));var deskjs=require(_0x8248('0xf'));var toCsv=require(_0x8248('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x8248('0x10'));var hardwareService=require(_0x8248('0x11'));var Redis=require(_0x8248('0x12'));var qs=require(_0x8248('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8248('0x14'));var config=require(_0x8248('0x15'));var db=require(_0x8248('0x16'))['db'];function respondWithStatusCode(_0x37a8b7,_0x386ad4){_0x386ad4=_0x386ad4||0xcc;return function(_0x1da28d){if(_0x1da28d){return _0x37a8b7[_0x8248('0x17')](_0x386ad4);}return _0x37a8b7[_0x8248('0x18')](_0x386ad4)[_0x8248('0x19')]();};}function respondWithResult(_0x1fac3b,_0x1168b9){_0x1168b9=_0x1168b9||0xc8;return function(_0x509faf){if(_0x509faf){return _0x1fac3b[_0x8248('0x18')](_0x1168b9)['json'](_0x509faf);}};}function respondWithFilteredResult(_0x1a9244,_0x3fd41c){return function(_0x2158b2){if(_0x2158b2){var _0x54abfc=_0x2158b2[_0x8248('0x1a')],_0x51deb1=_0x3fd41c['offset'],_0x1ba395=_0x3fd41c[_0x8248('0x1b')]+_0x3fd41c['limit'],_0x58f67f;if(_0x1ba395>=_0x54abfc){_0x1ba395=_0x54abfc;_0x58f67f=0xc8;}else{_0x58f67f=0xce;}_0x1a9244['status'](_0x58f67f);return _0x1a9244['set'](_0x8248('0x1c'),_0x51deb1+'-'+_0x1ba395+'/'+_0x54abfc)[_0x8248('0x1d')](_0x2158b2);}return null;};}function patchUpdates(_0xcfd3f2){return function(_0x3c6ae8){try{jsonpatch[_0x8248('0x1e')](_0x3c6ae8,_0xcfd3f2,!![]);}catch(_0x5e42a2){return BPromise[_0x8248('0x1f')](_0x5e42a2);}return _0x3c6ae8[_0x8248('0x20')]();};}function saveUpdates(_0x285253,_0x664813){return function(_0x33aaab){if(_0x33aaab){return _0x33aaab['update'](_0x285253)[_0x8248('0x21')](function(_0xb48389){return _0xb48389;});}return null;};}function removeEntity(_0x3d2879,_0x549687){return function(_0x2374e6){if(_0x2374e6){return _0x2374e6[_0x8248('0x22')]()[_0x8248('0x21')](function(){_0x3d2879[_0x8248('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d5dc2,_0x150b8e){return function(_0x14bb7f){if(!_0x14bb7f){_0x4d5dc2[_0x8248('0x17')](0x194);}return _0x14bb7f;};}function handleError(_0x2b0179,_0x50106d){_0x50106d=_0x50106d||0x1f4;return function(_0x5a58d8){logger[_0x8248('0x23')](_0x5a58d8[_0x8248('0x24')]);if(_0x5a58d8[_0x8248('0x25')]){delete _0x5a58d8[_0x8248('0x25')];}_0x2b0179[_0x8248('0x18')](_0x50106d)[_0x8248('0x26')](_0x5a58d8);};}exports[_0x8248('0x27')]=function(_0x5e0acc,_0x47ade0){var _0x3a272a={},_0x5a3fef={},_0x3621ca={'count':0x0,'rows':[]};var _0x4c95a0=db['Automation'][_0x8248('0x28')];_0x5a3fef['model']=_['keys'](_0x4c95a0);_0x5a3fef[_0x8248('0x29')]=_[_0x8248('0x2a')](_0x5e0acc[_0x8248('0x29')]);_0x5a3fef[_0x8248('0x2b')]=_[_0x8248('0x2c')](_0x5a3fef['model'],_0x5a3fef[_0x8248('0x29')]);_0x3a272a[_0x8248('0x2d')]=_[_0x8248('0x2c')](_0x5a3fef['model'],qs['fields'](_0x5e0acc[_0x8248('0x29')][_0x8248('0x2e')]));_0x3a272a[_0x8248('0x2d')]=_0x3a272a[_0x8248('0x2d')][_0x8248('0x2f')]?_0x3a272a['attributes']:_0x5a3fef[_0x8248('0x30')];if(!_0x5e0acc['query'][_0x8248('0x31')]('nolimit')){_0x3a272a[_0x8248('0x32')]=qs['limit'](_0x5e0acc[_0x8248('0x29')]['limit']);_0x3a272a[_0x8248('0x1b')]=qs[_0x8248('0x1b')](_0x5e0acc[_0x8248('0x29')][_0x8248('0x1b')]);}_0x3a272a[_0x8248('0x33')]=qs[_0x8248('0x34')](_0x5e0acc[_0x8248('0x29')][_0x8248('0x34')]);_0x3a272a[_0x8248('0x35')]=qs[_0x8248('0x2b')](_['pick'](_0x5e0acc['query'],_0x5a3fef['filters']));if(_0x5e0acc['query'][_0x8248('0x36')]){_0x3a272a['where']=_['merge'](_0x3a272a[_0x8248('0x35')],{'$or':_[_0x8248('0x37')](_0x4c95a0,function(_0x2796e7){if(_0x2796e7['type']['key']!==_0x8248('0x38')){var _0x3e19fb={};_0x3e19fb[_0x2796e7[_0x8248('0x39')]]={'$like':'%'+_0x5e0acc[_0x8248('0x29')][_0x8248('0x36')]+'%'};return _0x3e19fb;}})});}_0x3a272a=_[_0x8248('0x3a')]({},_0x3a272a,_0x5e0acc[_0x8248('0x3b')]);var _0x4a3a1a={'where':_0x3a272a[_0x8248('0x35')]};return db['Automation']['count'](_0x4a3a1a)[_0x8248('0x21')](function(_0x493736){_0x3621ca[_0x8248('0x1a')]=_0x493736;if(_0x5e0acc[_0x8248('0x29')][_0x8248('0x3c')]){_0x3a272a['include']=[{'all':!![]}];}return db['Automation'][_0x8248('0x3d')](_0x3a272a);})['then'](function(_0x136427){_0x3621ca[_0x8248('0x3e')]=_0x136427;return _0x3621ca;})[_0x8248('0x21')](respondWithFilteredResult(_0x47ade0,_0x3a272a))['catch'](handleError(_0x47ade0,null));};exports[_0x8248('0x3f')]=function(_0x28d22f,_0x35a920){var _0x4d6475={'raw':![],'where':{'id':_0x28d22f['params']['id']}},_0x2f4204={};_0x2f4204[_0x8248('0x30')]=_[_0x8248('0x2a')](db['Automation']['rawAttributes']);_0x2f4204[_0x8248('0x29')]=_[_0x8248('0x2a')](_0x28d22f[_0x8248('0x29')]);_0x2f4204[_0x8248('0x2b')]=_[_0x8248('0x2c')](_0x2f4204[_0x8248('0x30')],_0x2f4204[_0x8248('0x29')]);_0x4d6475['attributes']=_[_0x8248('0x2c')](_0x2f4204['model'],qs[_0x8248('0x2e')](_0x28d22f[_0x8248('0x29')][_0x8248('0x2e')]));_0x4d6475['attributes']=_0x4d6475['attributes']['length']?_0x4d6475[_0x8248('0x2d')]:_0x2f4204[_0x8248('0x30')];if(_0x28d22f[_0x8248('0x29')]['includeAll']){_0x4d6475[_0x8248('0x40')]=[{'all':!![]}];}_0x4d6475=_[_0x8248('0x3a')]({},_0x4d6475,_0x28d22f[_0x8248('0x3b')]);return db[_0x8248('0x41')][_0x8248('0x42')](_0x4d6475)[_0x8248('0x21')](handleEntityNotFound(_0x35a920,null))[_0x8248('0x21')](respondWithResult(_0x35a920,null))[_0x8248('0x43')](handleError(_0x35a920,null));};exports[_0x8248('0x44')]=function(_0x2f0d77,_0x51735f){return db['Automation'][_0x8248('0x44')](_0x2f0d77[_0x8248('0x45')],{})[_0x8248('0x21')](respondWithResult(_0x51735f,0xc9))['catch'](handleError(_0x51735f,null));};exports[_0x8248('0x46')]=function(_0x4ff51d,_0x285e77){if(_0x4ff51d[_0x8248('0x45')]['id']){delete _0x4ff51d[_0x8248('0x45')]['id'];}return db[_0x8248('0x41')][_0x8248('0x42')]({'where':{'id':_0x4ff51d[_0x8248('0x47')]['id']}})[_0x8248('0x21')](handleEntityNotFound(_0x285e77,null))[_0x8248('0x21')](saveUpdates(_0x4ff51d[_0x8248('0x45')],null))['then'](respondWithResult(_0x285e77,null))[_0x8248('0x43')](handleError(_0x285e77,null));};exports[_0x8248('0x22')]=function(_0x32cf20,_0x329e44){return db[_0x8248('0x41')][_0x8248('0x42')]({'where':{'id':_0x32cf20[_0x8248('0x47')]['id']}})[_0x8248('0x21')](handleEntityNotFound(_0x329e44,null))[_0x8248('0x21')](removeEntity(_0x329e44,null))[_0x8248('0x43')](handleError(_0x329e44,null));};exports['addConditions']=function(_0x241b0a,_0x195ffa,_0x3f6a75){return db[_0x8248('0x48')][_0x8248('0x42')]({'where':{'id':_0x241b0a[_0x8248('0x47')]['id']}})[_0x8248('0x21')](handleEntityNotFound(_0x195ffa,null))[_0x8248('0x21')](function(_0x2fbfab){if(_0x2fbfab){return _0x2fbfab['addConditions'](_0x241b0a[_0x8248('0x45')][_0x8248('0x49')],_[_0x8248('0x4a')](_0x241b0a[_0x8248('0x45')],[_0x8248('0x49'),'id'])||{});}})['then'](respondWithResult(_0x195ffa,null))['catch'](handleError(_0x195ffa,null));};exports[_0x8248('0x4b')]=function(_0x5a952a,_0x2cc370,_0x3c32a4){var _0x3741c6={};var _0x48a99e={};var _0x1aa860;var _0x5729fd;return db[_0x8248('0x41')]['findOne']({'where':{'id':_0x5a952a[_0x8248('0x47')]['id']}})[_0x8248('0x21')](handleEntityNotFound(_0x2cc370,null))['then'](function(_0x3309b2){if(_0x3309b2){_0x1aa860=_0x3309b2;_0x48a99e[_0x8248('0x30')]=_['keys'](db[_0x8248('0x48')]['rawAttributes']);_0x48a99e[_0x8248('0x29')]=_[_0x8248('0x2a')](_0x5a952a[_0x8248('0x29')]);_0x48a99e[_0x8248('0x2b')]=_[_0x8248('0x2c')](_0x48a99e[_0x8248('0x30')],_0x48a99e[_0x8248('0x29')]);_0x3741c6['attributes']=_['intersection'](_0x48a99e[_0x8248('0x30')],qs[_0x8248('0x2e')](_0x5a952a[_0x8248('0x29')][_0x8248('0x2e')]));_0x3741c6[_0x8248('0x2d')]=_0x3741c6[_0x8248('0x2d')]['length']?_0x3741c6[_0x8248('0x2d')]:_0x48a99e[_0x8248('0x30')];_0x3741c6['order']=qs[_0x8248('0x34')](_0x5a952a[_0x8248('0x29')]['sort']);_0x3741c6[_0x8248('0x35')]=qs[_0x8248('0x2b')](_[_0x8248('0x4c')](_0x5a952a[_0x8248('0x29')],_0x48a99e['filters']));if(_0x5a952a[_0x8248('0x29')]['filter']){_0x3741c6[_0x8248('0x35')]=_[_0x8248('0x3a')](_0x3741c6[_0x8248('0x35')],{'$or':_[_0x8248('0x37')](_0x3741c6[_0x8248('0x2d')],function(_0x586c40){var _0x2de72a={};_0x2de72a[_0x586c40]={'$like':'%'+_0x5a952a[_0x8248('0x29')][_0x8248('0x36')]+'%'};return _0x2de72a;})});}_0x3741c6=_[_0x8248('0x3a')]({},_0x3741c6,_0x5a952a[_0x8248('0x3b')]);return _0x1aa860[_0x8248('0x4b')](_0x3741c6);}})['then'](function(_0x14a2e5){if(_0x14a2e5){_0x5729fd=_0x14a2e5[_0x8248('0x2f')];if(!_0x5a952a[_0x8248('0x29')][_0x8248('0x31')]('nolimit')){_0x3741c6[_0x8248('0x32')]=qs[_0x8248('0x32')](_0x5a952a[_0x8248('0x29')][_0x8248('0x32')]);_0x3741c6[_0x8248('0x1b')]=qs['offset'](_0x5a952a[_0x8248('0x29')][_0x8248('0x1b')]);}return _0x1aa860[_0x8248('0x4b')](_0x3741c6);}})[_0x8248('0x21')](function(_0x37b7d5){if(_0x37b7d5){return _0x37b7d5?{'count':_0x5729fd,'rows':_0x37b7d5}:null;}})[_0x8248('0x21')](respondWithResult(_0x2cc370,null))[_0x8248('0x43')](handleError(_0x2cc370,null));};exports[_0x8248('0x4d')]=function(_0x4d7dbf,_0x57d1de,_0x282948){return db[_0x8248('0x4e')][_0x8248('0x42')]({'where':{'id':_0x4d7dbf[_0x8248('0x47')]['id']}})[_0x8248('0x21')](handleEntityNotFound(_0x57d1de,null))[_0x8248('0x21')](function(_0x45a4e4){if(_0x45a4e4){return _0x45a4e4['addActions'](_0x4d7dbf[_0x8248('0x45')][_0x8248('0x49')],_[_0x8248('0x4a')](_0x4d7dbf[_0x8248('0x45')],[_0x8248('0x49'),'id'])||{});}})['then'](respondWithResult(_0x57d1de,null))[_0x8248('0x43')](handleError(_0x57d1de,null));};exports[_0x8248('0x4f')]=function(_0x3d2088,_0x4f2730,_0x3409d1){var _0x1299e7={};var _0x65a956={};var _0x1a66d5;var _0x47923c;return db['Automation']['findOne']({'where':{'id':_0x3d2088[_0x8248('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f2730,null))[_0x8248('0x21')](function(_0x4d1de2){if(_0x4d1de2){_0x1a66d5=_0x4d1de2;_0x65a956[_0x8248('0x30')]=_[_0x8248('0x2a')](db[_0x8248('0x4e')][_0x8248('0x28')]);_0x65a956['query']=_[_0x8248('0x2a')](_0x3d2088[_0x8248('0x29')]);_0x65a956[_0x8248('0x2b')]=_[_0x8248('0x2c')](_0x65a956[_0x8248('0x30')],_0x65a956['query']);_0x1299e7[_0x8248('0x2d')]=_[_0x8248('0x2c')](_0x65a956['model'],qs['fields'](_0x3d2088[_0x8248('0x29')][_0x8248('0x2e')]));_0x1299e7['attributes']=_0x1299e7[_0x8248('0x2d')][_0x8248('0x2f')]?_0x1299e7['attributes']:_0x65a956[_0x8248('0x30')];_0x1299e7[_0x8248('0x33')]=qs['sort'](_0x3d2088[_0x8248('0x29')][_0x8248('0x34')]);_0x1299e7[_0x8248('0x35')]=qs['filters'](_[_0x8248('0x4c')](_0x3d2088[_0x8248('0x29')],_0x65a956['filters']));if(_0x3d2088['query'][_0x8248('0x36')]){_0x1299e7[_0x8248('0x35')]=_['merge'](_0x1299e7['where'],{'$or':_['map'](_0x1299e7['attributes'],function(_0x12c439){var _0x1878e8={};_0x1878e8[_0x12c439]={'$like':'%'+_0x3d2088[_0x8248('0x29')][_0x8248('0x36')]+'%'};return _0x1878e8;})});}_0x1299e7=_[_0x8248('0x3a')]({},_0x1299e7,_0x3d2088[_0x8248('0x3b')]);return _0x1a66d5[_0x8248('0x4f')](_0x1299e7);}})['then'](function(_0x4f2fd0){if(_0x4f2fd0){_0x47923c=_0x4f2fd0[_0x8248('0x2f')];if(!_0x3d2088[_0x8248('0x29')][_0x8248('0x31')](_0x8248('0x50'))){_0x1299e7[_0x8248('0x32')]=qs[_0x8248('0x32')](_0x3d2088[_0x8248('0x29')][_0x8248('0x32')]);_0x1299e7[_0x8248('0x1b')]=qs[_0x8248('0x1b')](_0x3d2088[_0x8248('0x29')][_0x8248('0x1b')]);}return _0x1a66d5[_0x8248('0x4f')](_0x1299e7);}})[_0x8248('0x21')](function(_0x41d2fa){if(_0x41d2fa){return _0x41d2fa?{'count':_0x47923c,'rows':_0x41d2fa}:null;}})[_0x8248('0x21')](respondWithResult(_0x4f2730,null))[_0x8248('0x43')](handleError(_0x4f2730,null));}; \ No newline at end of file +var _0x2868=['where','map','VIRTUAL','field','options','count','include','findAll','catch','show','rawAttributes','includeAll','merge','create','body','params','find','addConditions','Condition','ids','omit','getConditions','findOne','order','pick','filter','addActions','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','Automation','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x105278,_0x774ed2){var _0x47b1f=function(_0xf8a100){while(--_0xf8a100){_0x105278['push'](_0x105278['shift']());}};_0x47b1f(++_0x774ed2);}(_0x2868,0x1bc));var _0x8286=function(_0x544144,_0xdf5230){_0x544144=_0x544144-0x0;var _0x5d88b6=_0x2868[_0x544144];return _0x5d88b6;};'use strict';var pdf=require(_0x8286('0x0'));var emlformat=require(_0x8286('0x1'));var rimraf=require(_0x8286('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8286('0x3'));var rp=require(_0x8286('0x4'));var moment=require(_0x8286('0x5'));var BPromise=require(_0x8286('0x6'));var Mustache=require(_0x8286('0x7'));var util=require(_0x8286('0x8'));var path=require(_0x8286('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8286('0xa'));var fs=require('fs');var _=require(_0x8286('0xb'));var squel=require(_0x8286('0xc'));var crypto=require(_0x8286('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8286('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8286('0xf'));var Papa=require(_0x8286('0x10'));var authService=require(_0x8286('0x11'));var hardwareService=require(_0x8286('0x12'));var Redis=require(_0x8286('0x13'));var qs=require(_0x8286('0x14'));var logger=require(_0x8286('0x15'))(_0x8286('0x16'));var utils=require(_0x8286('0x17'));var config=require(_0x8286('0x18'));var db=require(_0x8286('0x19'))['db'];function respondWithStatusCode(_0x5316bf,_0x44fa5b){_0x44fa5b=_0x44fa5b||0xcc;return function(_0x2d25fb){if(_0x2d25fb){return _0x5316bf['sendStatus'](_0x44fa5b);}return _0x5316bf[_0x8286('0x1a')](_0x44fa5b)[_0x8286('0x1b')]();};}function respondWithResult(_0x39bfcb,_0x518df6){_0x518df6=_0x518df6||0xc8;return function(_0x4e10dd){if(_0x4e10dd){return _0x39bfcb[_0x8286('0x1a')](_0x518df6)[_0x8286('0x1c')](_0x4e10dd);}};}function respondWithFilteredResult(_0x525e79,_0x463b54){return function(_0x2a4b0c){if(_0x2a4b0c){var _0x409662=_0x2a4b0c['count'],_0x1f2b7b=_0x463b54['offset'],_0x67317b=_0x463b54[_0x8286('0x1d')]+_0x463b54[_0x8286('0x1e')],_0x5b953f;if(_0x67317b>=_0x409662){_0x67317b=_0x409662;_0x5b953f=0xc8;}else{_0x5b953f=0xce;}_0x525e79[_0x8286('0x1a')](_0x5b953f);return _0x525e79[_0x8286('0x1f')]('Content-Range',_0x1f2b7b+'-'+_0x67317b+'/'+_0x409662)[_0x8286('0x1c')](_0x2a4b0c);}return null;};}function patchUpdates(_0x366c66){return function(_0x39d235){try{jsonpatch[_0x8286('0x20')](_0x39d235,_0x366c66,!![]);}catch(_0x7940d7){return BPromise[_0x8286('0x21')](_0x7940d7);}return _0x39d235[_0x8286('0x22')]();};}function saveUpdates(_0xdba3b3,_0x5d4668){return function(_0x4eebb9){if(_0x4eebb9){return _0x4eebb9[_0x8286('0x23')](_0xdba3b3)[_0x8286('0x24')](function(_0x3f617e){return _0x3f617e;});}return null;};}function removeEntity(_0x364c12,_0x1c9e38){return function(_0x3de49a){if(_0x3de49a){return _0x3de49a[_0x8286('0x25')]()[_0x8286('0x24')](function(){_0x364c12['status'](0xcc)[_0x8286('0x1b')]();});}};}function handleEntityNotFound(_0xae7343,_0x51b068){return function(_0x566473){if(!_0x566473){_0xae7343['sendStatus'](0x194);}return _0x566473;};}function handleError(_0x4d03ef,_0x283706){_0x283706=_0x283706||0x1f4;return function(_0x40a28d){logger[_0x8286('0x26')](_0x40a28d['stack']);if(_0x40a28d[_0x8286('0x27')]){delete _0x40a28d[_0x8286('0x27')];}_0x4d03ef['status'](_0x283706)[_0x8286('0x28')](_0x40a28d);};}exports[_0x8286('0x29')]=function(_0x5827ad,_0x464ba8){var _0x57de86={},_0x36ade1={},_0x75ba9b={'count':0x0,'rows':[]};var _0x209a4f=db[_0x8286('0x2a')]['rawAttributes'];_0x36ade1['model']=_[_0x8286('0x2b')](_0x209a4f);_0x36ade1[_0x8286('0x2c')]=_[_0x8286('0x2b')](_0x5827ad['query']);_0x36ade1[_0x8286('0x2d')]=_[_0x8286('0x2e')](_0x36ade1[_0x8286('0x2f')],_0x36ade1[_0x8286('0x2c')]);_0x57de86[_0x8286('0x30')]=_[_0x8286('0x2e')](_0x36ade1[_0x8286('0x2f')],qs[_0x8286('0x31')](_0x5827ad['query']['fields']));_0x57de86[_0x8286('0x30')]=_0x57de86[_0x8286('0x30')][_0x8286('0x32')]?_0x57de86[_0x8286('0x30')]:_0x36ade1[_0x8286('0x2f')];if(!_0x5827ad[_0x8286('0x2c')][_0x8286('0x33')](_0x8286('0x34'))){_0x57de86['limit']=qs[_0x8286('0x1e')](_0x5827ad['query'][_0x8286('0x1e')]);_0x57de86[_0x8286('0x1d')]=qs[_0x8286('0x1d')](_0x5827ad[_0x8286('0x2c')][_0x8286('0x1d')]);}_0x57de86['order']=qs[_0x8286('0x35')](_0x5827ad[_0x8286('0x2c')][_0x8286('0x35')]);_0x57de86[_0x8286('0x36')]=qs[_0x8286('0x2d')](_['pick'](_0x5827ad[_0x8286('0x2c')],_0x36ade1[_0x8286('0x2d')]));if(_0x5827ad['query']['filter']){_0x57de86[_0x8286('0x36')]=_['merge'](_0x57de86[_0x8286('0x36')],{'$or':_[_0x8286('0x37')](_0x209a4f,function(_0x14c33b){if(_0x14c33b['type']['key']!==_0x8286('0x38')){var _0xd7c468={};_0xd7c468[_0x14c33b[_0x8286('0x39')]]={'$like':'%'+_0x5827ad[_0x8286('0x2c')]['filter']+'%'};return _0xd7c468;}})});}_0x57de86=_['merge']({},_0x57de86,_0x5827ad[_0x8286('0x3a')]);var _0x2666c4={'where':_0x57de86[_0x8286('0x36')]};return db['Automation'][_0x8286('0x3b')](_0x2666c4)[_0x8286('0x24')](function(_0x580272){_0x75ba9b['count']=_0x580272;if(_0x5827ad[_0x8286('0x2c')]['includeAll']){_0x57de86[_0x8286('0x3c')]=[{'all':!![]}];}return db[_0x8286('0x2a')][_0x8286('0x3d')](_0x57de86);})[_0x8286('0x24')](function(_0x56964c){_0x75ba9b['rows']=_0x56964c;return _0x75ba9b;})[_0x8286('0x24')](respondWithFilteredResult(_0x464ba8,_0x57de86))[_0x8286('0x3e')](handleError(_0x464ba8,null));};exports[_0x8286('0x3f')]=function(_0x297908,_0x4162e5){var _0x32a798={'raw':![],'where':{'id':_0x297908['params']['id']}},_0x403a99={};_0x403a99[_0x8286('0x2f')]=_[_0x8286('0x2b')](db['Automation'][_0x8286('0x40')]);_0x403a99[_0x8286('0x2c')]=_['keys'](_0x297908[_0x8286('0x2c')]);_0x403a99[_0x8286('0x2d')]=_[_0x8286('0x2e')](_0x403a99['model'],_0x403a99[_0x8286('0x2c')]);_0x32a798[_0x8286('0x30')]=_['intersection'](_0x403a99[_0x8286('0x2f')],qs[_0x8286('0x31')](_0x297908[_0x8286('0x2c')][_0x8286('0x31')]));_0x32a798[_0x8286('0x30')]=_0x32a798['attributes'][_0x8286('0x32')]?_0x32a798[_0x8286('0x30')]:_0x403a99[_0x8286('0x2f')];if(_0x297908[_0x8286('0x2c')][_0x8286('0x41')]){_0x32a798[_0x8286('0x3c')]=[{'all':!![]}];}_0x32a798=_[_0x8286('0x42')]({},_0x32a798,_0x297908['options']);return db[_0x8286('0x2a')]['find'](_0x32a798)[_0x8286('0x24')](handleEntityNotFound(_0x4162e5,null))[_0x8286('0x24')](respondWithResult(_0x4162e5,null))[_0x8286('0x3e')](handleError(_0x4162e5,null));};exports['create']=function(_0x51a996,_0x1ed1a9){return db['Automation'][_0x8286('0x43')](_0x51a996['body'],{})[_0x8286('0x24')](respondWithResult(_0x1ed1a9,0xc9))[_0x8286('0x3e')](handleError(_0x1ed1a9,null));};exports[_0x8286('0x23')]=function(_0x5964ec,_0x58e537){if(_0x5964ec[_0x8286('0x44')]['id']){delete _0x5964ec[_0x8286('0x44')]['id'];}return db[_0x8286('0x2a')]['find']({'where':{'id':_0x5964ec[_0x8286('0x45')]['id']}})['then'](handleEntityNotFound(_0x58e537,null))[_0x8286('0x24')](saveUpdates(_0x5964ec[_0x8286('0x44')],null))[_0x8286('0x24')](respondWithResult(_0x58e537,null))[_0x8286('0x3e')](handleError(_0x58e537,null));};exports['destroy']=function(_0x542adb,_0x5e7f35){return db[_0x8286('0x2a')][_0x8286('0x46')]({'where':{'id':_0x542adb[_0x8286('0x45')]['id']}})[_0x8286('0x24')](handleEntityNotFound(_0x5e7f35,null))['then'](removeEntity(_0x5e7f35,null))['catch'](handleError(_0x5e7f35,null));};exports[_0x8286('0x47')]=function(_0x590829,_0x30a173,_0x2ec7a2){return db[_0x8286('0x48')][_0x8286('0x46')]({'where':{'id':_0x590829[_0x8286('0x45')]['id']}})[_0x8286('0x24')](handleEntityNotFound(_0x30a173,null))[_0x8286('0x24')](function(_0x13cde0){if(_0x13cde0){return _0x13cde0[_0x8286('0x47')](_0x590829['body'][_0x8286('0x49')],_[_0x8286('0x4a')](_0x590829[_0x8286('0x44')],[_0x8286('0x49'),'id'])||{});}})[_0x8286('0x24')](respondWithResult(_0x30a173,null))[_0x8286('0x3e')](handleError(_0x30a173,null));};exports[_0x8286('0x4b')]=function(_0x2af378,_0x3cc8e8,_0x52f8d3){var _0x34a066={};var _0x5bbf04={};var _0xedb912;var _0x2ca1f4;return db['Automation'][_0x8286('0x4c')]({'where':{'id':_0x2af378[_0x8286('0x45')]['id']}})[_0x8286('0x24')](handleEntityNotFound(_0x3cc8e8,null))[_0x8286('0x24')](function(_0x13141a){if(_0x13141a){_0xedb912=_0x13141a;_0x5bbf04[_0x8286('0x2f')]=_['keys'](db[_0x8286('0x48')][_0x8286('0x40')]);_0x5bbf04[_0x8286('0x2c')]=_['keys'](_0x2af378[_0x8286('0x2c')]);_0x5bbf04[_0x8286('0x2d')]=_[_0x8286('0x2e')](_0x5bbf04['model'],_0x5bbf04[_0x8286('0x2c')]);_0x34a066['attributes']=_['intersection'](_0x5bbf04[_0x8286('0x2f')],qs['fields'](_0x2af378[_0x8286('0x2c')][_0x8286('0x31')]));_0x34a066[_0x8286('0x30')]=_0x34a066[_0x8286('0x30')]['length']?_0x34a066[_0x8286('0x30')]:_0x5bbf04[_0x8286('0x2f')];_0x34a066[_0x8286('0x4d')]=qs['sort'](_0x2af378[_0x8286('0x2c')][_0x8286('0x35')]);_0x34a066[_0x8286('0x36')]=qs[_0x8286('0x2d')](_[_0x8286('0x4e')](_0x2af378['query'],_0x5bbf04[_0x8286('0x2d')]));if(_0x2af378[_0x8286('0x2c')][_0x8286('0x4f')]){_0x34a066[_0x8286('0x36')]=_[_0x8286('0x42')](_0x34a066[_0x8286('0x36')],{'$or':_['map'](_0x34a066[_0x8286('0x30')],function(_0x1536ad){var _0x24b84f={};_0x24b84f[_0x1536ad]={'$like':'%'+_0x2af378[_0x8286('0x2c')][_0x8286('0x4f')]+'%'};return _0x24b84f;})});}_0x34a066=_[_0x8286('0x42')]({},_0x34a066,_0x2af378['options']);return _0xedb912[_0x8286('0x4b')](_0x34a066);}})['then'](function(_0x2c7ed2){if(_0x2c7ed2){_0x2ca1f4=_0x2c7ed2[_0x8286('0x32')];if(!_0x2af378[_0x8286('0x2c')][_0x8286('0x33')](_0x8286('0x34'))){_0x34a066[_0x8286('0x1e')]=qs[_0x8286('0x1e')](_0x2af378[_0x8286('0x2c')][_0x8286('0x1e')]);_0x34a066['offset']=qs['offset'](_0x2af378[_0x8286('0x2c')]['offset']);}return _0xedb912['getConditions'](_0x34a066);}})[_0x8286('0x24')](function(_0x449407){if(_0x449407){return _0x449407?{'count':_0x2ca1f4,'rows':_0x449407}:null;}})[_0x8286('0x24')](respondWithResult(_0x3cc8e8,null))['catch'](handleError(_0x3cc8e8,null));};exports[_0x8286('0x50')]=function(_0x3b9224,_0x14b835,_0x29b78e){return db[_0x8286('0x51')][_0x8286('0x46')]({'where':{'id':_0x3b9224[_0x8286('0x45')]['id']}})['then'](handleEntityNotFound(_0x14b835,null))['then'](function(_0xd1b3d9){if(_0xd1b3d9){return _0xd1b3d9[_0x8286('0x50')](_0x3b9224['body']['ids'],_[_0x8286('0x4a')](_0x3b9224['body'],[_0x8286('0x49'),'id'])||{});}})[_0x8286('0x24')](respondWithResult(_0x14b835,null))[_0x8286('0x3e')](handleError(_0x14b835,null));};exports['getActions']=function(_0x4cd3f7,_0x2b3739,_0x163122){var _0x4f6166={};var _0x508ff9={};var _0x270d37;var _0x5ca52e;return db[_0x8286('0x2a')][_0x8286('0x4c')]({'where':{'id':_0x4cd3f7[_0x8286('0x45')]['id']}})[_0x8286('0x24')](handleEntityNotFound(_0x2b3739,null))[_0x8286('0x24')](function(_0x12e041){if(_0x12e041){_0x270d37=_0x12e041;_0x508ff9[_0x8286('0x2f')]=_['keys'](db[_0x8286('0x51')]['rawAttributes']);_0x508ff9[_0x8286('0x2c')]=_[_0x8286('0x2b')](_0x4cd3f7['query']);_0x508ff9[_0x8286('0x2d')]=_[_0x8286('0x2e')](_0x508ff9[_0x8286('0x2f')],_0x508ff9['query']);_0x4f6166['attributes']=_[_0x8286('0x2e')](_0x508ff9[_0x8286('0x2f')],qs[_0x8286('0x31')](_0x4cd3f7['query'][_0x8286('0x31')]));_0x4f6166['attributes']=_0x4f6166['attributes'][_0x8286('0x32')]?_0x4f6166[_0x8286('0x30')]:_0x508ff9['model'];_0x4f6166[_0x8286('0x4d')]=qs[_0x8286('0x35')](_0x4cd3f7[_0x8286('0x2c')][_0x8286('0x35')]);_0x4f6166[_0x8286('0x36')]=qs['filters'](_[_0x8286('0x4e')](_0x4cd3f7[_0x8286('0x2c')],_0x508ff9[_0x8286('0x2d')]));if(_0x4cd3f7[_0x8286('0x2c')]['filter']){_0x4f6166[_0x8286('0x36')]=_['merge'](_0x4f6166[_0x8286('0x36')],{'$or':_[_0x8286('0x37')](_0x4f6166[_0x8286('0x30')],function(_0x24cc8f){var _0x95c22={};_0x95c22[_0x24cc8f]={'$like':'%'+_0x4cd3f7[_0x8286('0x2c')][_0x8286('0x4f')]+'%'};return _0x95c22;})});}_0x4f6166=_[_0x8286('0x42')]({},_0x4f6166,_0x4cd3f7[_0x8286('0x3a')]);return _0x270d37[_0x8286('0x52')](_0x4f6166);}})[_0x8286('0x24')](function(_0x124838){if(_0x124838){_0x5ca52e=_0x124838['length'];if(!_0x4cd3f7[_0x8286('0x2c')][_0x8286('0x33')]('nolimit')){_0x4f6166[_0x8286('0x1e')]=qs[_0x8286('0x1e')](_0x4cd3f7[_0x8286('0x2c')]['limit']);_0x4f6166[_0x8286('0x1d')]=qs['offset'](_0x4cd3f7[_0x8286('0x2c')][_0x8286('0x1d')]);}return _0x270d37[_0x8286('0x52')](_0x4f6166);}})[_0x8286('0x24')](function(_0x4ca16f){if(_0x4ca16f){return _0x4ca16f?{'count':_0x5ca52e,'rows':_0x4ca16f}:null;}})[_0x8286('0x24')](respondWithResult(_0x2b3739,null))[_0x8286('0x3e')](handleError(_0x2b3739,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 64e5aaa..6c5e46a 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 _0x6cfa=['lodash','api','bluebird','request-promise','define','Automation','tools_automations'];(function(_0x9ee5e8,_0x3fac59){var _0x581b8d=function(_0x31a708){while(--_0x31a708){_0x9ee5e8['push'](_0x9ee5e8['shift']());}};_0x581b8d(++_0x3fac59);}(_0x6cfa,0xa1));var _0xa6cf=function(_0x460ab9,_0x3815ac){_0x460ab9=_0x460ab9-0x0;var _0x27ef6e=_0x6cfa[_0x460ab9];return _0x27ef6e;};'use strict';var _=require(_0xa6cf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa6cf('0x1'));var moment=require('moment');var BPromise=require(_0xa6cf('0x2'));var rp=require(_0xa6cf('0x3'));var attributes=require('./automation.attributes');module['exports']=function(_0x552064,_0x416dc1){return _0x552064[_0xa6cf('0x4')](_0xa6cf('0x5'),attributes,{'tableName':_0xa6cf('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fc3=['../../config/logger','api','moment','bluebird','request-promise','./automation.attributes','exports','define','Automation','lodash'];(function(_0x531ec4,_0x203380){var _0x43fd6f=function(_0x350608){while(--_0x350608){_0x531ec4['push'](_0x531ec4['shift']());}};_0x43fd6f(++_0x203380);}(_0x9fc3,0x199));var _0x39fc=function(_0x4cc409,_0x49d302){_0x4cc409=_0x4cc409-0x0;var _0x5d72a1=_0x9fc3[_0x4cc409];return _0x5d72a1;};'use strict';var _=require(_0x39fc('0x0'));var util=require('util');var logger=require(_0x39fc('0x1'))(_0x39fc('0x2'));var moment=require(_0x39fc('0x3'));var BPromise=require(_0x39fc('0x4'));var rp=require(_0x39fc('0x5'));var attributes=require(_0x39fc('0x6'));module[_0x39fc('0x7')]=function(_0x547b14,_0x3a8ac7){return _0x547b14[_0x39fc('0x8')](_0x39fc('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index c2f7451..e3a742c 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 _0x5785=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3ac882,_0x370ae4){var _0x505c4c=function(_0x2abd9c){while(--_0x2abd9c){_0x3ac882['push'](_0x3ac882['shift']());}};_0x505c4c(++_0x370ae4);}(_0x5785,0x119));var _0x5578=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x5785[_0x556927];return _0x5f1235;};'use strict';var _=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var moment=require(_0x5578('0x2'));var BPromise=require(_0x5578('0x3'));var rs=require(_0x5578('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5578('0x5'))['db'];var utils=require(_0x5578('0x6'));var logger=require(_0x5578('0x7'))(_0x5578('0x8'));var config=require(_0x5578('0x9'));var jayson=require(_0x5578('0xa'));var client=jayson[_0x5578('0xb')][_0x5578('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x464ab2,_0x287860,_0x545581){return new BPromise(function(_0x520bbf,_0x3d37dc){return client[_0x5578('0xd')](_0x464ab2,_0x545581)['then'](function(_0x433ed0){logger['info'](_0x5578('0xe'),_0x287860,'request\x20sent');logger[_0x5578('0xf')](_0x5578('0x10'),_0x287860,_0x5578('0x11'),JSON['stringify'](_0x433ed0));if(_0x433ed0['error']){if(_0x433ed0[_0x5578('0x12')][_0x5578('0x13')]===0x1f4){logger[_0x5578('0x12')](_0x5578('0xe'),_0x287860,_0x433ed0[_0x5578('0x12')][_0x5578('0x14')]);return _0x3d37dc(_0x433ed0[_0x5578('0x12')][_0x5578('0x14')]);}logger[_0x5578('0x12')](_0x5578('0xe'),_0x287860,_0x433ed0['error'][_0x5578('0x14')]);return _0x520bbf(_0x433ed0[_0x5578('0x12')][_0x5578('0x14')]);}else{logger[_0x5578('0x15')](_0x5578('0xe'),_0x287860,_0x5578('0x11'));_0x520bbf(_0x433ed0[_0x5578('0x16')][_0x5578('0x14')]);}})[_0x5578('0x17')](function(_0xc9c5a4){logger['error'](_0x5578('0xe'),_0x287860,_0xc9c5a4);_0x3d37dc(_0xc9c5a4);});});} \ No newline at end of file +var _0x8c97=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x547c89,_0x17d597){var _0x186d5a=function(_0x2cba70){while(--_0x2cba70){_0x547c89['push'](_0x547c89['shift']());}};_0x186d5a(++_0x17d597);}(_0x8c97,0x194));var _0x78c9=function(_0x1d32ea,_0x310a61){_0x1d32ea=_0x1d32ea-0x0;var _0x2a6176=_0x8c97[_0x1d32ea];return _0x2a6176;};'use strict';var _=require(_0x78c9('0x0'));var util=require(_0x78c9('0x1'));var moment=require(_0x78c9('0x2'));var BPromise=require(_0x78c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78c9('0x4'));var db=require(_0x78c9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x78c9('0x6'))(_0x78c9('0x7'));var config=require(_0x78c9('0x8'));var jayson=require(_0x78c9('0x9'));var client=jayson[_0x78c9('0xa')][_0x78c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x211916,_0x20a61e,_0x266713){return new BPromise(function(_0x5cb610,_0x2e355a){return client[_0x78c9('0xc')](_0x211916,_0x266713)[_0x78c9('0xd')](function(_0x5b1e02){logger[_0x78c9('0xe')](_0x78c9('0xf'),_0x20a61e,_0x78c9('0x10'));logger[_0x78c9('0x11')](_0x78c9('0x12'),_0x20a61e,_0x78c9('0x10'),JSON[_0x78c9('0x13')](_0x5b1e02));if(_0x5b1e02['error']){if(_0x5b1e02[_0x78c9('0x14')][_0x78c9('0x15')]===0x1f4){logger[_0x78c9('0x14')]('Automation,\x20%s,\x20%s',_0x20a61e,_0x5b1e02[_0x78c9('0x14')]['message']);return _0x2e355a(_0x5b1e02['error'][_0x78c9('0x16')]);}logger[_0x78c9('0x14')]('Automation,\x20%s,\x20%s',_0x20a61e,_0x5b1e02['error'][_0x78c9('0x16')]);return _0x5cb610(_0x5b1e02[_0x78c9('0x14')][_0x78c9('0x16')]);}else{logger[_0x78c9('0xe')](_0x78c9('0xf'),_0x20a61e,_0x78c9('0x10'));_0x5cb610(_0x5b1e02['result'][_0x78c9('0x16')]);}})[_0x78c9('0x17')](function(_0x1ec89e){logger[_0x78c9('0x14')](_0x78c9('0xf'),_0x20a61e,_0x1ec89e);_0x2e355a(_0x1ec89e);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 4538d8b..5feb95f 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 _0x302e=['/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','get','index','/:id','isAuthenticated','show'];(function(_0x4a3ed0,_0x4ed2c0){var _0x12ba9=function(_0x141c7b){while(--_0x141c7b){_0x4a3ed0['push'](_0x4a3ed0['shift']());}};_0x12ba9(++_0x4ed2c0);}(_0x302e,0x1eb));var _0xe302=function(_0x401b30,_0x434fc4){_0x401b30=_0x401b30-0x0;var _0x8474e1=_0x302e[_0x401b30];return _0x8474e1;};'use strict';var multer=require(_0xe302('0x0'));var util=require(_0xe302('0x1'));var path=require(_0xe302('0x2'));var timeout=require(_0xe302('0x3'));var express=require('express');var router=express[_0xe302('0x4')]();var auth=require(_0xe302('0x5'));var interaction=require(_0xe302('0x6'));var config=require('../../config/environment');var controller=require(_0xe302('0x7'));router[_0xe302('0x8')]('/',auth['isAuthenticated'](),controller[_0xe302('0x9')]);router[_0xe302('0x8')](_0xe302('0xa'),auth[_0xe302('0xb')](),controller[_0xe302('0xc')]);router[_0xe302('0x8')](_0xe302('0xd'),auth[_0xe302('0xb')](),controller[_0xe302('0xe')]);router[_0xe302('0x8')](_0xe302('0xf'),auth[_0xe302('0xb')](),controller[_0xe302('0x10')]);router[_0xe302('0x11')]('/',auth[_0xe302('0xb')](),controller[_0xe302('0x12')]);router['post'](_0xe302('0xd'),auth['isAuthenticated'](),controller[_0xe302('0x13')]);router[_0xe302('0x11')]('/:id/actions',auth[_0xe302('0xb')](),controller[_0xe302('0x14')]);router['put'](_0xe302('0xa'),auth[_0xe302('0xb')](),controller['update']);router[_0xe302('0x15')]('/:id',auth[_0xe302('0xb')](),controller[_0xe302('0x16')]);module[_0xe302('0x17')]=router; \ No newline at end of file +var _0xe0ae=['delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','getConditions','getActions','post','create','/:id/conditions','addConditions','/:id/actions','addActions','update'];(function(_0x5bb1ad,_0x4641a4){var _0x3abbce=function(_0x223ed3){while(--_0x223ed3){_0x5bb1ad['push'](_0x5bb1ad['shift']());}};_0x3abbce(++_0x4641a4);}(_0xe0ae,0x1a1));var _0xee0a=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0xe0ae[_0x2300f2];return _0x6bd508;};'use strict';var multer=require(_0xee0a('0x0'));var util=require('util');var path=require(_0xee0a('0x1'));var timeout=require('connect-timeout');var express=require(_0xee0a('0x2'));var router=express[_0xee0a('0x3')]();var auth=require(_0xee0a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xee0a('0x5'));var controller=require('./automation.controller');router[_0xee0a('0x6')]('/',auth['isAuthenticated'](),controller[_0xee0a('0x7')]);router[_0xee0a('0x6')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller[_0xee0a('0xa')]);router[_0xee0a('0x6')]('/:id/conditions',auth[_0xee0a('0x9')](),controller[_0xee0a('0xb')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0xee0a('0xc')]);router[_0xee0a('0xd')]('/',auth[_0xee0a('0x9')](),controller[_0xee0a('0xe')]);router[_0xee0a('0xd')](_0xee0a('0xf'),auth[_0xee0a('0x9')](),controller[_0xee0a('0x10')]);router[_0xee0a('0xd')](_0xee0a('0x11'),auth['isAuthenticated'](),controller[_0xee0a('0x12')]);router['put'](_0xee0a('0x8'),auth['isAuthenticated'](),controller[_0xee0a('0x13')]);router[_0xee0a('0x14')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller[_0xee0a('0x15')]);module[_0xee0a('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index feeeeb7..7b92eb6 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 _0xf44e=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','STRING','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#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)'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xf44e,0x1d3));var _0xef44=function(_0x36bac0,_0x1a0871){_0x36bac0=_0x36bac0-0x0;var _0x2e3f3d=_0xf44e[_0x36bac0];return _0x2e3f3d;};'use strict';var Sequelize=require(_0xef44('0x0'));module['exports']={'name':{'type':Sequelize[_0xef44('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xef44('0x2')),'allowNull':![],'defaultValue':_0xef44('0x2')},'description':{'type':Sequelize[_0xef44('0x1')]},'active':{'type':Sequelize[_0xef44('0x3')],'defaultValue':0x0,'comment':_0xef44('0x4')},'limitCalls':{'type':Sequelize[_0xef44('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xef44('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xef44('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xef44('0x5')](0x3)[_0xef44('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xef44('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef44('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xef44('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef44('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0xef44('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef44('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0xef44('0x5')](0x5)[_0xef44('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef44('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xef44('0x6')],'defaultValue':0x3,'comment':_0xef44('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xef44('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef44('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xef44('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xef44('0xd')},'dialTimezone':{'type':Sequelize[_0xef44('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xef44('0x1')],'defaultValue':_0xef44('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xef44('0xf')]('always',_0xef44('0x10'),_0xef44('0x11')),'defaultValue':_0xef44('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xef44('0x5')](0x9)[_0xef44('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xef44('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xef44('0x5')](0x9)[_0xef44('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xef44('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xef44('0x5')](0x9)[_0xef44('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xef44('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xef44('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xef44('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xef44('0x5')](0x9)[_0xef44('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xef44('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xef44('0x5')](0x9)[_0xef44('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xef44('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xef44('0x5')](0x5)[_0xef44('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xef44('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xef44('0x5')](0x9)[_0xef44('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xef44('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xef44('0x1a'),_0xef44('0x1b')),'defaultValue':_0xef44('0x1a')},'dialPrefix':{'type':Sequelize[_0xef44('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xef44('0x5')](0x3)[_0xef44('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xef44('0x1c')},'dialCutDigit':{'type':Sequelize[_0xef44('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xef44('0x1d')}}; \ No newline at end of file +var _0x1ec8=['ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','always','onlyIfOpen','#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'];(function(_0x9db795,_0x49b59e){var _0x38413a=function(_0x5d9580){while(--_0x5d9580){_0x9db795['push'](_0x9db795['shift']());}};_0x38413a(++_0x49b59e);}(_0x1ec8,0x1d4));var _0x81ec=function(_0x47bfb8,_0xd4b559){_0x47bfb8=_0x47bfb8-0x0;var _0x4f9f0d=_0x1ec8[_0x47bfb8];return _0x4f9f0d;};'use strict';var Sequelize=require(_0x81ec('0x0'));module[_0x81ec('0x1')]={'name':{'type':Sequelize[_0x81ec('0x2')],'unique':_0x81ec('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x81ec('0x4')),'allowNull':![],'defaultValue':_0x81ec('0x4')},'description':{'type':Sequelize[_0x81ec('0x2')]},'active':{'type':Sequelize[_0x81ec('0x5')],'defaultValue':0x0,'comment':_0x81ec('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x81ec('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x81ec('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x81ec('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x81ec('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x81ec('0x9')](0x3)[_0x81ec('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81ec('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x81ec('0x9')](0x3)[_0x81ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81ec('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x81ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81ec('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81ec('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x81ec('0x9')](0x5)[_0x81ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x81ec('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81ec('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x81ec('0x9')](0x3)[_0x81ec('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x81ec('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x81ec('0x2')],'defaultValue':_0x81ec('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x81ec('0x10')](_0x81ec('0x11'),'never',_0x81ec('0x12')),'defaultValue':_0x81ec('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x81ec('0x9')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x81ec('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x81ec('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x81ec('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x81ec('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x81ec('0x9')](0x9)[_0x81ec('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x81ec('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x81ec('0x9')](0x9)[_0x81ec('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x81ec('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x81ec('0x9')](0x9)[_0x81ec('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x81ec('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x81ec('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x81ec('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x81ec('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x81ec('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x81ec('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x81ec('0x10')](_0x81ec('0x1b'),_0x81ec('0x1c')),'defaultValue':_0x81ec('0x1b')},'dialPrefix':{'type':Sequelize[_0x81ec('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x81ec('0x9')](0x3)[_0x81ec('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x81ec('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x81ec('0x1e')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 6679744..093d879 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 _0x7b9a=['hasOwnProperty','order','CampaignId','rows','CmHopperHistory','map','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','NOW()','scheduledAt','CmListId','toString','from','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_contacts','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','IvrCampaigns','destroy','stack','name','send','index','Campaign','keys','query','filters','intersection','attributes','model','fields','nolimit','sort','pick','filter','merge','type','key','field','options','where','includeAll','include','findAll','catch','rawAttributes','find','create','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','getHoppers','findOne','CmHopper','length'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x7b9a,0x1bf));var _0xa7b9=function(_0x1f47c1,_0x56fda7){_0x1f47c1=_0x1f47c1-0x0;var _0x3a1a80=_0x7b9a[_0x1f47c1];return _0x3a1a80;};'use strict';var pdf=require(_0xa7b9('0x0'));var emlformat=require(_0xa7b9('0x1'));var rimraf=require(_0xa7b9('0x2'));var zipdir=require(_0xa7b9('0x3'));var jsonpatch=require(_0xa7b9('0x4'));var rp=require(_0xa7b9('0x5'));var moment=require('moment');var BPromise=require(_0xa7b9('0x6'));var Mustache=require(_0xa7b9('0x7'));var util=require(_0xa7b9('0x8'));var path=require(_0xa7b9('0x9'));var sox=require(_0xa7b9('0xa'));var csv=require('to-csv');var ejs=require(_0xa7b9('0xb'));var fs=require('fs');var _=require(_0xa7b9('0xc'));var squel=require(_0xa7b9('0xd'));var crypto=require(_0xa7b9('0xe'));var jsforce=require(_0xa7b9('0xf'));var deskjs=require(_0xa7b9('0x10'));var toCsv=require(_0xa7b9('0x11'));var querystring=require(_0xa7b9('0x12'));var Papa=require(_0xa7b9('0x13'));var authService=require('../../components/auth/service');var hardwareService=require(_0xa7b9('0x14'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xa7b9('0x15'))('api');var utils=require(_0xa7b9('0x16'));var config=require('../../config/environment');var db=require(_0xa7b9('0x17'))['db'];function respondWithStatusCode(_0x39e469,_0x1a6667){_0x1a6667=_0x1a6667||0xcc;return function(_0x3af408){if(_0x3af408){return _0x39e469[_0xa7b9('0x18')](_0x1a6667);}return _0x39e469[_0xa7b9('0x19')](_0x1a6667)[_0xa7b9('0x1a')]();};}function respondWithResult(_0xdfcab7,_0x208316){_0x208316=_0x208316||0xc8;return function(_0x3e6305){if(_0x3e6305){return _0xdfcab7['status'](_0x208316)['json'](_0x3e6305);}};}function respondWithFilteredResult(_0x4ede50,_0x138692){return function(_0x37fd7a){if(_0x37fd7a){var _0x52d503=_0x37fd7a[_0xa7b9('0x1b')],_0x4fc7d9=_0x138692[_0xa7b9('0x1c')],_0x415208=_0x138692[_0xa7b9('0x1c')]+_0x138692[_0xa7b9('0x1d')],_0x44ea89;if(_0x415208>=_0x52d503){_0x415208=_0x52d503;_0x44ea89=0xc8;}else{_0x44ea89=0xce;}_0x4ede50[_0xa7b9('0x19')](_0x44ea89);return _0x4ede50[_0xa7b9('0x1e')](_0xa7b9('0x1f'),_0x4fc7d9+'-'+_0x415208+'/'+_0x52d503)[_0xa7b9('0x20')](_0x37fd7a);}return null;};}function patchUpdates(_0x1adb3e){return function(_0x5f23bb){try{jsonpatch[_0xa7b9('0x21')](_0x5f23bb,_0x1adb3e,!![]);}catch(_0x31aa65){return BPromise[_0xa7b9('0x22')](_0x31aa65);}return _0x5f23bb[_0xa7b9('0x23')]();};}function saveUpdates(_0x3d2365,_0x151be3){return function(_0x197d7e){if(_0x197d7e){return _0x197d7e[_0xa7b9('0x24')](_0x3d2365)['then'](function(_0x5eec04){return _0x5eec04;});}return null;};}function removeEntity(_0x13d735,_0x44e008){return function(_0x3b066e){if(_0x3b066e){return _0x3b066e['destroy']()[_0xa7b9('0x25')](function(){var _0x41b76e=_0x3b066e[_0xa7b9('0x26')]({'plain':!![]});var _0x46caa5=_0xa7b9('0x27');return db['UserProfileResource'][_0xa7b9('0x28')]({'where':{'type':_0x46caa5,'resourceId':_0x41b76e['id']}})[_0xa7b9('0x25')](function(){return _0x3b066e;});})[_0xa7b9('0x25')](function(){_0x13d735[_0xa7b9('0x19')](0xcc)[_0xa7b9('0x1a')]();});}};}function handleEntityNotFound(_0x73d431,_0x5a0fa8){return function(_0x58b4f3){if(!_0x58b4f3){_0x73d431[_0xa7b9('0x18')](0x194);}return _0x58b4f3;};}function handleError(_0x15eb00,_0x34cb6b){_0x34cb6b=_0x34cb6b||0x1f4;return function(_0x31a399){logger['error'](_0x31a399[_0xa7b9('0x29')]);if(_0x31a399[_0xa7b9('0x2a')]){delete _0x31a399[_0xa7b9('0x2a')];}_0x15eb00[_0xa7b9('0x19')](_0x34cb6b)[_0xa7b9('0x2b')](_0x31a399);};}exports[_0xa7b9('0x2c')]=function(_0xf8680,_0x10ecdf){var _0x27f7b3={},_0x1431df={},_0x5819ec={'count':0x0,'rows':[]};var _0x137ef7=db[_0xa7b9('0x2d')]['rawAttributes'];_0x1431df['model']=_[_0xa7b9('0x2e')](_0x137ef7);_0x1431df['query']=_[_0xa7b9('0x2e')](_0xf8680[_0xa7b9('0x2f')]);_0x1431df[_0xa7b9('0x30')]=_[_0xa7b9('0x31')](_0x1431df['model'],_0x1431df[_0xa7b9('0x2f')]);_0x27f7b3[_0xa7b9('0x32')]=_[_0xa7b9('0x31')](_0x1431df[_0xa7b9('0x33')],qs[_0xa7b9('0x34')](_0xf8680[_0xa7b9('0x2f')][_0xa7b9('0x34')]));_0x27f7b3[_0xa7b9('0x32')]=_0x27f7b3[_0xa7b9('0x32')]['length']?_0x27f7b3[_0xa7b9('0x32')]:_0x1431df['model'];if(!_0xf8680[_0xa7b9('0x2f')]['hasOwnProperty'](_0xa7b9('0x35'))){_0x27f7b3[_0xa7b9('0x1d')]=qs[_0xa7b9('0x1d')](_0xf8680['query']['limit']);_0x27f7b3[_0xa7b9('0x1c')]=qs[_0xa7b9('0x1c')](_0xf8680['query'][_0xa7b9('0x1c')]);}_0x27f7b3['order']=qs[_0xa7b9('0x36')](_0xf8680[_0xa7b9('0x2f')][_0xa7b9('0x36')]);_0x27f7b3['where']=qs[_0xa7b9('0x30')](_[_0xa7b9('0x37')](_0xf8680[_0xa7b9('0x2f')],_0x1431df[_0xa7b9('0x30')]));if(_0xf8680[_0xa7b9('0x2f')][_0xa7b9('0x38')]){_0x27f7b3['where']=_[_0xa7b9('0x39')](_0x27f7b3['where'],{'$or':_['map'](_0x137ef7,function(_0x596224){if(_0x596224[_0xa7b9('0x3a')][_0xa7b9('0x3b')]!=='VIRTUAL'){var _0xe0c1e2={};_0xe0c1e2[_0x596224[_0xa7b9('0x3c')]]={'$like':'%'+_0xf8680[_0xa7b9('0x2f')][_0xa7b9('0x38')]+'%'};return _0xe0c1e2;}})});}_0x27f7b3=_['merge']({},_0x27f7b3,_0xf8680[_0xa7b9('0x3d')]);var _0x48b19b={'where':_0x27f7b3[_0xa7b9('0x3e')]};return db['Campaign'][_0xa7b9('0x1b')](_0x48b19b)[_0xa7b9('0x25')](function(_0x591f61){_0x5819ec[_0xa7b9('0x1b')]=_0x591f61;if(_0xf8680[_0xa7b9('0x2f')][_0xa7b9('0x3f')]){_0x27f7b3[_0xa7b9('0x40')]=[{'all':!![]}];}return db[_0xa7b9('0x2d')][_0xa7b9('0x41')](_0x27f7b3);})['then'](function(_0x3d8506){_0x5819ec['rows']=_0x3d8506;return _0x5819ec;})['then'](respondWithFilteredResult(_0x10ecdf,_0x27f7b3))[_0xa7b9('0x42')](handleError(_0x10ecdf,null));};exports['show']=function(_0x4710e9,_0x57a97c){var _0x2ae300={'raw':![],'where':{'id':_0x4710e9['params']['id']}},_0x83401b={};_0x83401b[_0xa7b9('0x33')]=_[_0xa7b9('0x2e')](db[_0xa7b9('0x2d')][_0xa7b9('0x43')]);_0x83401b[_0xa7b9('0x2f')]=_['keys'](_0x4710e9['query']);_0x83401b[_0xa7b9('0x30')]=_[_0xa7b9('0x31')](_0x83401b[_0xa7b9('0x33')],_0x83401b[_0xa7b9('0x2f')]);_0x2ae300[_0xa7b9('0x32')]=_[_0xa7b9('0x31')](_0x83401b[_0xa7b9('0x33')],qs[_0xa7b9('0x34')](_0x4710e9[_0xa7b9('0x2f')]['fields']));_0x2ae300[_0xa7b9('0x32')]=_0x2ae300[_0xa7b9('0x32')]['length']?_0x2ae300[_0xa7b9('0x32')]:_0x83401b['model'];if(_0x4710e9[_0xa7b9('0x2f')][_0xa7b9('0x3f')]){_0x2ae300[_0xa7b9('0x40')]=[{'all':!![]}];}_0x2ae300=_[_0xa7b9('0x39')]({},_0x2ae300,_0x4710e9[_0xa7b9('0x3d')]);return db[_0xa7b9('0x2d')][_0xa7b9('0x44')](_0x2ae300)[_0xa7b9('0x25')](handleEntityNotFound(_0x57a97c,null))[_0xa7b9('0x25')](respondWithResult(_0x57a97c,null))[_0xa7b9('0x42')](handleError(_0x57a97c,null));};exports[_0xa7b9('0x45')]=function(_0x20c009,_0x24ec29){return db[_0xa7b9('0x2d')][_0xa7b9('0x45')](_0x20c009['body'],{})[_0xa7b9('0x25')](function(_0x4b2982){var _0x248892=_0x20c009['user'][_0xa7b9('0x26')]({'plain':!![]});if(!_0x248892)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x248892['role']===_0xa7b9('0x46')){var _0x12b4b2=_0x4b2982[_0xa7b9('0x26')]({'plain':!![]});var _0x3a3a45=_0xa7b9('0x27');return db[_0xa7b9('0x47')]['find']({'where':{'name':_0x3a3a45,'userProfileId':_0x248892[_0xa7b9('0x48')]},'raw':!![]})[_0xa7b9('0x25')](function(_0x40ccc3){if(_0x40ccc3&&_0x40ccc3[_0xa7b9('0x49')]===0x0){return db[_0xa7b9('0x4a')][_0xa7b9('0x45')]({'name':_0x12b4b2['name'],'resourceId':_0x12b4b2['id'],'type':_0x40ccc3[_0xa7b9('0x2a')],'sectionId':_0x40ccc3['id']},{})[_0xa7b9('0x25')](function(){return _0x4b2982;});}else{return _0x4b2982;}})[_0xa7b9('0x42')](function(_0x84cbfb){logger['error'](_0xa7b9('0x4b'),_0x84cbfb);throw _0x84cbfb;});}return _0x4b2982;})[_0xa7b9('0x25')](respondWithResult(_0x24ec29,0xc9))[_0xa7b9('0x42')](handleError(_0x24ec29,null));};exports[_0xa7b9('0x4c')]=function(_0x41f0c1,_0x26437d){var _0x130d76={'raw':![],'where':{'id':_0x41f0c1[_0xa7b9('0x4d')]['id']}},_0xc912b3={};_0xc912b3[_0xa7b9('0x33')]=_[_0xa7b9('0x2e')](db[_0xa7b9('0x2d')][_0xa7b9('0x43')]);_0x130d76[_0xa7b9('0x32')]=_[_0xa7b9('0x31')](_0xc912b3[_0xa7b9('0x33')],qs[_0xa7b9('0x34')](_0x41f0c1[_0xa7b9('0x2f')][_0xa7b9('0x34')]));_0x130d76[_0xa7b9('0x32')]=_0x130d76[_0xa7b9('0x32')]['length']?_0x130d76[_0xa7b9('0x32')]:_0xc912b3[_0xa7b9('0x33')];if(_0x41f0c1[_0xa7b9('0x2f')]['includeAll']){_0x130d76[_0xa7b9('0x40')]=[{'all':!![]}];}_0x130d76=_[_0xa7b9('0x39')]({},_0x130d76,_0x41f0c1['options']);return db[_0xa7b9('0x2d')][_0xa7b9('0x44')](_0x130d76)[_0xa7b9('0x25')](handleEntityNotFound(_0x26437d,null))[_0xa7b9('0x25')](function(_0x3b5ef9){if(_0x3b5ef9){var _0x191688=_0x3b5ef9[_0xa7b9('0x26')]({'plain':!![]});_0x191688=qs[_0xa7b9('0x4e')](_0x191688,['id','createdAt',_0xa7b9('0x4f')]);_0x41f0c1[_0xa7b9('0x50')]=_[_0xa7b9('0x4e')](_0x41f0c1[_0xa7b9('0x50')],['id',_0xa7b9('0x51'),_0xa7b9('0x4f')]);return db[_0xa7b9('0x2d')][_0xa7b9('0x45')](_[_0xa7b9('0x39')](_0x191688,_0x41f0c1['body']),{'include':_0x41f0c1[_0xa7b9('0x2f')]['includeAll']?[{'all':!![]}]:undefined})[_0xa7b9('0x25')](function(_0x174c9f){var _0xfc76e2=_0x41f0c1['user']['get']({'plain':!![]});if(!_0xfc76e2)throw new Error(_0xa7b9('0x52'));if(_0xfc76e2[_0xa7b9('0x53')]===_0xa7b9('0x46')){var _0x2cba7b=_0x174c9f[_0xa7b9('0x26')]({'plain':!![]});var _0x1d63c7=_0xa7b9('0x27');return db['UserProfileSection'][_0xa7b9('0x44')]({'where':{'name':_0x1d63c7,'userProfileId':_0xfc76e2[_0xa7b9('0x48')]},'raw':!![]})[_0xa7b9('0x25')](function(_0x25c245){if(_0x25c245&&_0x25c245[_0xa7b9('0x49')]===0x0){return db[_0xa7b9('0x4a')][_0xa7b9('0x45')]({'name':_0x2cba7b[_0xa7b9('0x2a')],'resourceId':_0x2cba7b['id'],'type':_0x25c245[_0xa7b9('0x2a')],'sectionId':_0x25c245['id']},{})[_0xa7b9('0x25')](function(){return _0x174c9f;});}else{return _0x174c9f;}})['catch'](function(_0x2ca14f){logger[_0xa7b9('0x54')](_0xa7b9('0x4b'),_0x2ca14f);throw _0x2ca14f;});}return _0x174c9f;});}})[_0xa7b9('0x25')](respondWithResult(_0x26437d,0xc9))[_0xa7b9('0x42')](handleError(_0x26437d,null));};exports['update']=function(_0x4cc22e,_0x238444){if(_0x4cc22e['body']['id']){delete _0x4cc22e[_0xa7b9('0x50')]['id'];}return db[_0xa7b9('0x2d')][_0xa7b9('0x44')]({'where':{'id':_0x4cc22e['params']['id']}})[_0xa7b9('0x25')](handleEntityNotFound(_0x238444,null))[_0xa7b9('0x25')](saveUpdates(_0x4cc22e[_0xa7b9('0x50')],null))[_0xa7b9('0x25')](respondWithResult(_0x238444,null))['catch'](handleError(_0x238444,null));};exports['destroy']=function(_0x3c96cd,_0x5f08a4){return db[_0xa7b9('0x2d')][_0xa7b9('0x44')]({'where':{'id':_0x3c96cd[_0xa7b9('0x4d')]['id']}})[_0xa7b9('0x25')](handleEntityNotFound(_0x5f08a4,null))['then'](removeEntity(_0x5f08a4,null))[_0xa7b9('0x42')](handleError(_0x5f08a4,null));};exports[_0xa7b9('0x55')]=function(_0x59bcf7,_0x3b53ca,_0x197877){var _0xe82144={'raw':!![],'where':{}};var _0x30a6d9={};var _0x3b9176={'count':0x0,'rows':[]};return db[_0xa7b9('0x2d')][_0xa7b9('0x56')]({'where':{'id':_0x59bcf7['params']['id']}})[_0xa7b9('0x25')](handleEntityNotFound(_0x3b53ca,null))[_0xa7b9('0x25')](function(_0x2e9a1e){if(_0x2e9a1e){_0x30a6d9[_0xa7b9('0x33')]=_[_0xa7b9('0x2e')](db[_0xa7b9('0x57')][_0xa7b9('0x43')]);_0x30a6d9[_0xa7b9('0x2f')]=_[_0xa7b9('0x2e')](_0x59bcf7[_0xa7b9('0x2f')]);_0x30a6d9[_0xa7b9('0x30')]=_[_0xa7b9('0x31')](_0x30a6d9['model'],_0x30a6d9[_0xa7b9('0x2f')]);_0xe82144[_0xa7b9('0x32')]=_['intersection'](_0x30a6d9['model'],qs[_0xa7b9('0x34')](_0x59bcf7['query']['fields']));_0xe82144[_0xa7b9('0x32')]=_0xe82144[_0xa7b9('0x32')][_0xa7b9('0x58')]?_0xe82144[_0xa7b9('0x32')]:_0x30a6d9[_0xa7b9('0x33')];if(!_0x59bcf7[_0xa7b9('0x2f')][_0xa7b9('0x59')](_0xa7b9('0x35'))){_0xe82144['limit']=qs[_0xa7b9('0x1d')](_0x59bcf7[_0xa7b9('0x2f')]['limit']);_0xe82144['offset']=qs[_0xa7b9('0x1c')](_0x59bcf7['query']['offset']);}_0xe82144[_0xa7b9('0x5a')]=qs[_0xa7b9('0x36')](_0x59bcf7[_0xa7b9('0x2f')][_0xa7b9('0x36')]);_0xe82144[_0xa7b9('0x3e')]=qs[_0xa7b9('0x30')](_[_0xa7b9('0x37')](_0x59bcf7[_0xa7b9('0x2f')],_0x30a6d9['filters']));_0xe82144[_0xa7b9('0x3e')][_0xa7b9('0x5b')]=_0x2e9a1e['id'];if(_0x59bcf7[_0xa7b9('0x2f')][_0xa7b9('0x38')]){_0xe82144[_0xa7b9('0x3e')]=_[_0xa7b9('0x39')](_0xe82144[_0xa7b9('0x3e')],{'$or':_['map'](_0xe82144[_0xa7b9('0x32')],function(_0x3c2aa2){var _0x9e9196={};_0x9e9196[_0x3c2aa2]={'$like':'%'+_0x59bcf7[_0xa7b9('0x2f')][_0xa7b9('0x38')]+'%'};return _0x9e9196;})});}_0xe82144=_[_0xa7b9('0x39')]({},_0xe82144,_0x59bcf7['options']);return db[_0xa7b9('0x57')][_0xa7b9('0x1b')]({'where':_0xe82144['where']})['then'](function(_0x540b2e){_0x3b9176[_0xa7b9('0x1b')]=_0x540b2e;if(_0x59bcf7[_0xa7b9('0x2f')][_0xa7b9('0x3f')]){_0xe82144[_0xa7b9('0x40')]=[{'all':!![]}];}return db[_0xa7b9('0x57')][_0xa7b9('0x41')](_0xe82144);})[_0xa7b9('0x25')](function(_0x18edaf){_0x3b9176[_0xa7b9('0x5c')]=_0x18edaf;return _0x3b9176;});}})[_0xa7b9('0x25')](respondWithFilteredResult(_0x3b53ca,_0xe82144))[_0xa7b9('0x42')](handleError(_0x3b53ca,null));};exports['getHopperHistories']=function(_0x184852,_0x4dd4be,_0xded0e8){var _0x211396={'raw':!![],'where':{}};var _0x49e1b8={};var _0x3f1afe={'count':0x0,'rows':[]};return db[_0xa7b9('0x2d')][_0xa7b9('0x56')]({'where':{'id':_0x184852['params']['id']}})[_0xa7b9('0x25')](handleEntityNotFound(_0x4dd4be,null))['then'](function(_0x1bddb2){if(_0x1bddb2){_0x49e1b8[_0xa7b9('0x33')]=_[_0xa7b9('0x2e')](db[_0xa7b9('0x5d')][_0xa7b9('0x43')]);_0x49e1b8['query']=_[_0xa7b9('0x2e')](_0x184852[_0xa7b9('0x2f')]);_0x49e1b8[_0xa7b9('0x30')]=_[_0xa7b9('0x31')](_0x49e1b8[_0xa7b9('0x33')],_0x49e1b8[_0xa7b9('0x2f')]);_0x211396[_0xa7b9('0x32')]=_[_0xa7b9('0x31')](_0x49e1b8[_0xa7b9('0x33')],qs[_0xa7b9('0x34')](_0x184852[_0xa7b9('0x2f')][_0xa7b9('0x34')]));_0x211396[_0xa7b9('0x32')]=_0x211396[_0xa7b9('0x32')][_0xa7b9('0x58')]?_0x211396[_0xa7b9('0x32')]:_0x49e1b8['model'];if(!_0x184852[_0xa7b9('0x2f')][_0xa7b9('0x59')]('nolimit')){_0x211396['limit']=qs[_0xa7b9('0x1d')](_0x184852[_0xa7b9('0x2f')]['limit']);_0x211396[_0xa7b9('0x1c')]=qs[_0xa7b9('0x1c')](_0x184852['query']['offset']);}_0x211396['order']=qs[_0xa7b9('0x36')](_0x184852['query']['sort']);_0x211396[_0xa7b9('0x3e')]=qs[_0xa7b9('0x30')](_[_0xa7b9('0x37')](_0x184852[_0xa7b9('0x2f')],_0x49e1b8[_0xa7b9('0x30')]));_0x211396['where'][_0xa7b9('0x5b')]=_0x1bddb2['id'];if(_0x184852[_0xa7b9('0x2f')]['filter']){_0x211396[_0xa7b9('0x3e')]=_[_0xa7b9('0x39')](_0x211396[_0xa7b9('0x3e')],{'$or':_[_0xa7b9('0x5e')](_0x211396[_0xa7b9('0x32')],function(_0x1025a4){var _0x4d31e6={};_0x4d31e6[_0x1025a4]={'$like':'%'+_0x184852['query'][_0xa7b9('0x38')]+'%'};return _0x4d31e6;})});}_0x211396=_[_0xa7b9('0x39')]({},_0x211396,_0x184852[_0xa7b9('0x3d')]);return db[_0xa7b9('0x5d')][_0xa7b9('0x1b')]({'where':_0x211396['where']})[_0xa7b9('0x25')](function(_0x5e8ca4){_0x3f1afe['count']=_0x5e8ca4;if(_0x184852[_0xa7b9('0x2f')][_0xa7b9('0x3f')]){_0x211396[_0xa7b9('0x40')]=[{'all':!![]}];}return db[_0xa7b9('0x5d')][_0xa7b9('0x41')](_0x211396);})[_0xa7b9('0x25')](function(_0x58907a){_0x3f1afe['rows']=_0x58907a;return _0x3f1afe;});}})[_0xa7b9('0x25')](respondWithFilteredResult(_0x4dd4be,_0x211396))['catch'](handleError(_0x4dd4be,null));};exports[_0xa7b9('0x5f')]=function(_0x232438,_0x6993bf,_0x2fd21d){var _0xd5ec4d={'raw':!![],'where':{}};var _0x7070fd={};var _0x482992={'count':0x0,'rows':[]};return db[_0xa7b9('0x2d')][_0xa7b9('0x56')]({'where':{'id':_0x232438[_0xa7b9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x6993bf,null))[_0xa7b9('0x25')](function(_0x1e1330){if(_0x1e1330){_0x7070fd[_0xa7b9('0x33')]=_[_0xa7b9('0x2e')](db[_0xa7b9('0x60')]['rawAttributes']);_0x7070fd[_0xa7b9('0x2f')]=_['keys'](_0x232438[_0xa7b9('0x2f')]);_0x7070fd[_0xa7b9('0x30')]=_['intersection'](_0x7070fd[_0xa7b9('0x33')],_0x7070fd['query']);_0xd5ec4d[_0xa7b9('0x32')]=_[_0xa7b9('0x31')](_0x7070fd[_0xa7b9('0x33')],qs[_0xa7b9('0x34')](_0x232438[_0xa7b9('0x2f')][_0xa7b9('0x34')]));_0xd5ec4d[_0xa7b9('0x32')]=_0xd5ec4d[_0xa7b9('0x32')][_0xa7b9('0x58')]?_0xd5ec4d[_0xa7b9('0x32')]:_0x7070fd['model'];if(!_0x232438[_0xa7b9('0x2f')]['hasOwnProperty'](_0xa7b9('0x35'))){_0xd5ec4d[_0xa7b9('0x1d')]=qs[_0xa7b9('0x1d')](_0x232438[_0xa7b9('0x2f')]['limit']);_0xd5ec4d[_0xa7b9('0x1c')]=qs['offset'](_0x232438['query'][_0xa7b9('0x1c')]);}_0xd5ec4d[_0xa7b9('0x5a')]=qs[_0xa7b9('0x36')](_0x232438[_0xa7b9('0x2f')][_0xa7b9('0x36')]);_0xd5ec4d['where']=qs[_0xa7b9('0x30')](_['pick'](_0x232438['query'],_0x7070fd[_0xa7b9('0x30')]));_0xd5ec4d[_0xa7b9('0x3e')][_0xa7b9('0x5b')]=_0x1e1330['id'];if(_0x232438[_0xa7b9('0x2f')][_0xa7b9('0x38')]){_0xd5ec4d['where']=_[_0xa7b9('0x39')](_0xd5ec4d['where'],{'$or':_[_0xa7b9('0x5e')](_0xd5ec4d[_0xa7b9('0x32')],function(_0x48333e){var _0x1f31e1={};_0x1f31e1[_0x48333e]={'$like':'%'+_0x232438['query']['filter']+'%'};return _0x1f31e1;})});}_0xd5ec4d=_[_0xa7b9('0x39')]({},_0xd5ec4d,_0x232438[_0xa7b9('0x3d')]);return db[_0xa7b9('0x60')]['count']({'where':_0xd5ec4d[_0xa7b9('0x3e')]})[_0xa7b9('0x25')](function(_0x5d0c41){_0x482992[_0xa7b9('0x1b')]=_0x5d0c41;if(_0x232438[_0xa7b9('0x2f')]['includeAll']){_0xd5ec4d['include']=[{'all':!![]}];}return db[_0xa7b9('0x60')]['findAll'](_0xd5ec4d);})[_0xa7b9('0x25')](function(_0x55ff7f){_0x482992['rows']=_0x55ff7f;return _0x482992;});}})[_0xa7b9('0x25')](respondWithFilteredResult(_0x6993bf,_0xd5ec4d))[_0xa7b9('0x42')](handleError(_0x6993bf,null));};exports['getHopperBlacks']=function(_0xf8a405,_0xf5e526,_0x42259b){var _0x4e896c={'raw':!![],'where':{}};var _0x507c37={};var _0xc8ec4c={'count':0x0,'rows':[]};return db[_0xa7b9('0x2d')][_0xa7b9('0x56')]({'where':{'id':_0xf8a405['params']['id']}})[_0xa7b9('0x25')](handleEntityNotFound(_0xf5e526,null))[_0xa7b9('0x25')](function(_0x436002){if(_0x436002){_0x507c37['model']=_[_0xa7b9('0x2e')](db[_0xa7b9('0x61')]['rawAttributes']);_0x507c37[_0xa7b9('0x2f')]=_['keys'](_0xf8a405['query']);_0x507c37[_0xa7b9('0x30')]=_[_0xa7b9('0x31')](_0x507c37[_0xa7b9('0x33')],_0x507c37[_0xa7b9('0x2f')]);_0x4e896c[_0xa7b9('0x32')]=_['intersection'](_0x507c37[_0xa7b9('0x33')],qs['fields'](_0xf8a405[_0xa7b9('0x2f')]['fields']));_0x4e896c[_0xa7b9('0x32')]=_0x4e896c[_0xa7b9('0x32')][_0xa7b9('0x58')]?_0x4e896c[_0xa7b9('0x32')]:_0x507c37[_0xa7b9('0x33')];if(!_0xf8a405[_0xa7b9('0x2f')][_0xa7b9('0x59')](_0xa7b9('0x35'))){_0x4e896c[_0xa7b9('0x1d')]=qs['limit'](_0xf8a405[_0xa7b9('0x2f')][_0xa7b9('0x1d')]);_0x4e896c['offset']=qs[_0xa7b9('0x1c')](_0xf8a405[_0xa7b9('0x2f')]['offset']);}_0x4e896c['order']=qs[_0xa7b9('0x36')](_0xf8a405[_0xa7b9('0x2f')][_0xa7b9('0x36')]);_0x4e896c[_0xa7b9('0x3e')]=qs[_0xa7b9('0x30')](_['pick'](_0xf8a405['query'],_0x507c37[_0xa7b9('0x30')]));_0x4e896c[_0xa7b9('0x3e')]['CampaignId']=_0x436002['id'];if(_0xf8a405[_0xa7b9('0x2f')][_0xa7b9('0x38')]){_0x4e896c[_0xa7b9('0x3e')]=_[_0xa7b9('0x39')](_0x4e896c[_0xa7b9('0x3e')],{'$or':_[_0xa7b9('0x5e')](_0x4e896c[_0xa7b9('0x32')],function(_0x1735d9){var _0x39c3c6={};_0x39c3c6[_0x1735d9]={'$like':'%'+_0xf8a405['query']['filter']+'%'};return _0x39c3c6;})});}_0x4e896c=_[_0xa7b9('0x39')]({},_0x4e896c,_0xf8a405[_0xa7b9('0x3d')]);return db[_0xa7b9('0x61')]['count']({'where':_0x4e896c[_0xa7b9('0x3e')]})[_0xa7b9('0x25')](function(_0x4a4bbc){_0xc8ec4c[_0xa7b9('0x1b')]=_0x4a4bbc;if(_0xf8a405[_0xa7b9('0x2f')][_0xa7b9('0x3f')]){_0x4e896c[_0xa7b9('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xa7b9('0x41')](_0x4e896c);})['then'](function(_0x8f5eb4){_0xc8ec4c[_0xa7b9('0x5c')]=_0x8f5eb4;return _0xc8ec4c;});}})[_0xa7b9('0x25')](respondWithFilteredResult(_0xf5e526,_0x4e896c))[_0xa7b9('0x42')](handleError(_0xf5e526,null));};exports[_0xa7b9('0x62')]=function(_0x387750,_0x3d59a9,_0x5cdc88){var _0x21b565={};var _0x66cfa4={};var _0x2706a7;var _0x4224f8;return db[_0xa7b9('0x2d')]['findOne']({'where':{'id':_0x387750['params']['id']}})['then'](handleEntityNotFound(_0x3d59a9,null))[_0xa7b9('0x25')](function(_0x862c7b){if(_0x862c7b){_0x2706a7=_0x862c7b;_0x66cfa4[_0xa7b9('0x33')]=_[_0xa7b9('0x2e')](db[_0xa7b9('0x63')][_0xa7b9('0x43')]);_0x66cfa4[_0xa7b9('0x2f')]=_[_0xa7b9('0x2e')](_0x387750[_0xa7b9('0x2f')]);_0x66cfa4[_0xa7b9('0x30')]=_[_0xa7b9('0x31')](_0x66cfa4[_0xa7b9('0x33')],_0x66cfa4[_0xa7b9('0x2f')]);_0x21b565[_0xa7b9('0x32')]=_[_0xa7b9('0x31')](_0x66cfa4[_0xa7b9('0x33')],qs[_0xa7b9('0x34')](_0x387750[_0xa7b9('0x2f')][_0xa7b9('0x34')]));_0x21b565[_0xa7b9('0x32')]=_0x21b565[_0xa7b9('0x32')][_0xa7b9('0x58')]?_0x21b565[_0xa7b9('0x32')]:_0x66cfa4[_0xa7b9('0x33')];_0x21b565[_0xa7b9('0x5a')]=qs[_0xa7b9('0x36')](_0x387750[_0xa7b9('0x2f')]['sort']);_0x21b565[_0xa7b9('0x3e')]=qs[_0xa7b9('0x30')](_[_0xa7b9('0x37')](_0x387750[_0xa7b9('0x2f')],_0x66cfa4[_0xa7b9('0x30')]));if(_0x387750[_0xa7b9('0x2f')][_0xa7b9('0x38')]){_0x21b565[_0xa7b9('0x3e')]=_['merge'](_0x21b565[_0xa7b9('0x3e')],{'$or':_[_0xa7b9('0x5e')](_0x21b565[_0xa7b9('0x32')],function(_0x146238){var _0x4c5977={};_0x4c5977[_0x146238]={'$like':'%'+_0x387750['query'][_0xa7b9('0x38')]+'%'};return _0x4c5977;})});}_0x21b565=_[_0xa7b9('0x39')]({},_0x21b565,_0x387750[_0xa7b9('0x3d')]);return _0x2706a7[_0xa7b9('0x62')](_0x21b565);}})['then'](function(_0xf2b447){if(_0xf2b447){_0x4224f8=_0xf2b447[_0xa7b9('0x58')];if(!_0x387750[_0xa7b9('0x2f')]['hasOwnProperty']('nolimit')){_0x21b565['limit']=qs['limit'](_0x387750[_0xa7b9('0x2f')]['limit']);_0x21b565[_0xa7b9('0x1c')]=qs[_0xa7b9('0x1c')](_0x387750[_0xa7b9('0x2f')][_0xa7b9('0x1c')]);}return _0x2706a7[_0xa7b9('0x62')](_0x21b565);}})[_0xa7b9('0x25')](function(_0x37652a){if(_0x37652a){return _0x37652a?{'count':_0x4224f8,'rows':_0x37652a}:null;}})['then'](respondWithResult(_0x3d59a9,null))['catch'](handleError(_0x3d59a9,null));};exports['addLists']=function(_0x424d65,_0x11f7df,_0x42f0b3){var _0x10b1ae,_0xa044e2;return db[_0xa7b9('0x2d')]['find']({'where':{'id':_0x424d65[_0xa7b9('0x4d')]['id']}})[_0xa7b9('0x25')](handleEntityNotFound(_0x11f7df,null))[_0xa7b9('0x25')](function(_0x44813f){if(_0x44813f){_0xa044e2=_0x44813f;return _0x44813f[_0xa7b9('0x64')](_0x424d65[_0xa7b9('0x50')][_0xa7b9('0x65')],_[_0xa7b9('0x4e')](_0x424d65[_0xa7b9('0x50')],[_0xa7b9('0x65'),'id'])||{});}return null;})['spread'](function(_0x177b48){var _0x134c06;_0x10b1ae=_0x177b48||[];var _0x297fe5=[];if(_0x177b48){for(var _0x31094a=0x0;_0x31094a<_0x177b48['length'];_0x31094a+=0x1){var _0x21eee9=_0x177b48[_0x31094a][_0xa7b9('0x26')]({'plain':!![]});_0xa044e2[_0xa7b9('0x66')]=_0x424d65[_0xa7b9('0x50')]['dialCheckDuplicateType']?_0x424d65[_0xa7b9('0x50')]['dialCheckDuplicateType']:_0xa044e2[_0xa7b9('0x66')];switch(_0xa044e2[_0xa7b9('0x66')]){case _0xa7b9('0x67'):_0x134c06=squel[_0xa7b9('0x68')]()[_0xa7b9('0x69')](_0xa7b9('0x6a'))[_0xa7b9('0x6b')]([_0xa7b9('0x6c'),'scheduledAt',_0xa7b9('0x6d'),_0xa7b9('0x6e'),_0xa7b9('0x5b'),_0xa7b9('0x51'),'updatedAt'],squel[_0xa7b9('0x6f')]()['field'](_0xa7b9('0x6c'),_0xa7b9('0x6c'))['field'](_0xa7b9('0x70'),_0xa7b9('0x71'))[_0xa7b9('0x3c')]('id',_0xa7b9('0x6d'))[_0xa7b9('0x3c')](_0x21eee9[_0xa7b9('0x72')][_0xa7b9('0x73')](),_0xa7b9('0x6e'))[_0xa7b9('0x3c')](_0x424d65[_0xa7b9('0x4d')]['id'][_0xa7b9('0x73')](),_0xa7b9('0x5b'))[_0xa7b9('0x3c')](_0xa7b9('0x70'),'createdAt')['field'](_0xa7b9('0x70'),_0xa7b9('0x4f'))[_0xa7b9('0x74')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xa7b9('0x3e')](_0xa7b9('0x75'),_0x21eee9['CmListId'][_0xa7b9('0x73')]())[_0xa7b9('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xa7b9('0x3e')](_0xa7b9('0x76'),squel['select']()['field'](_0xa7b9('0x77'))[_0xa7b9('0x74')]('cm_hopper_final')[_0xa7b9('0x3e')](_0xa7b9('0x78'),_0x424d65['params']['id'][_0xa7b9('0x73')]()))[_0xa7b9('0x3e')](_0xa7b9('0x76'),squel[_0xa7b9('0x6f')]()['field'](_0xa7b9('0x79'))[_0xa7b9('0x74')](_0xa7b9('0x6a'))['where']('CampaignId\x20=\x20?',_0x424d65[_0xa7b9('0x4d')]['id']['toString']())))[_0xa7b9('0x73')]();break;case _0xa7b9('0x7a'):_0x134c06=squel[_0xa7b9('0x68')]()[_0xa7b9('0x69')](_0xa7b9('0x6a'))[_0xa7b9('0x6b')](['phone','scheduledAt','ContactId',_0xa7b9('0x6e'),_0xa7b9('0x5b'),'createdAt',_0xa7b9('0x4f')],squel[_0xa7b9('0x6f')]()[_0xa7b9('0x3c')]('phone',_0xa7b9('0x6c'))[_0xa7b9('0x3c')](_0xa7b9('0x70'),_0xa7b9('0x71'))[_0xa7b9('0x3c')]('id','ContactId')[_0xa7b9('0x3c')](_0x21eee9['CmListId']['toString'](),_0xa7b9('0x6e'))[_0xa7b9('0x3c')](_0x424d65['params']['id'][_0xa7b9('0x73')](),_0xa7b9('0x5b'))[_0xa7b9('0x3c')]('NOW()',_0xa7b9('0x51'))[_0xa7b9('0x3c')]('NOW()',_0xa7b9('0x4f'))[_0xa7b9('0x74')]('cm_contacts')['where'](_0xa7b9('0x7b'))[_0xa7b9('0x3e')](_0xa7b9('0x75'),_0x21eee9[_0xa7b9('0x72')][_0xa7b9('0x73')]())[_0xa7b9('0x3e')](_0xa7b9('0x7c'))[_0xa7b9('0x3e')](_0xa7b9('0x76'),squel['select']()[_0xa7b9('0x3c')]('COALESCE(phone,\x27\x27)')[_0xa7b9('0x74')](_0xa7b9('0x6a'))[_0xa7b9('0x3e')](_0xa7b9('0x78'),_0x424d65['params']['id'][_0xa7b9('0x73')]())))[_0xa7b9('0x73')]();break;default:_0x134c06=squel[_0xa7b9('0x68')]()[_0xa7b9('0x69')](_0xa7b9('0x6a'))[_0xa7b9('0x6b')](['phone',_0xa7b9('0x71'),_0xa7b9('0x6d'),_0xa7b9('0x6e'),_0xa7b9('0x5b'),_0xa7b9('0x51'),_0xa7b9('0x4f')],squel[_0xa7b9('0x6f')]()[_0xa7b9('0x3c')](_0xa7b9('0x6c'),_0xa7b9('0x6c'))[_0xa7b9('0x3c')](_0xa7b9('0x70'),'scheduledAt')[_0xa7b9('0x3c')]('id',_0xa7b9('0x6d'))['field'](_0x21eee9[_0xa7b9('0x72')][_0xa7b9('0x73')](),_0xa7b9('0x6e'))[_0xa7b9('0x3c')](_0x424d65[_0xa7b9('0x4d')]['id']['toString'](),'CampaignId')[_0xa7b9('0x3c')](_0xa7b9('0x70'),_0xa7b9('0x51'))['field']('NOW()',_0xa7b9('0x4f'))[_0xa7b9('0x74')]('cm_contacts')[_0xa7b9('0x3e')](_0xa7b9('0x7b'))[_0xa7b9('0x3e')]('ListId\x20=\x20?',_0x21eee9[_0xa7b9('0x72')][_0xa7b9('0x73')]())['where'](_0xa7b9('0x7c')))['toString']();}_0x297fe5[_0xa7b9('0x7d')](db[_0xa7b9('0x7e')][_0xa7b9('0x2f')](_0x134c06));}return BPromise[_0xa7b9('0x7f')](_0x297fe5);}})['then'](function(){return _0x10b1ae;})[_0xa7b9('0x25')](respondWithResult(_0x11f7df,null))['catch'](handleError(_0x11f7df,null));};exports[_0xa7b9('0x80')]=function(_0x8815e7,_0x456538,_0x5d3ee2){var _0x2ba0e3;return db[_0xa7b9('0x2d')][_0xa7b9('0x44')]({'where':{'id':_0x8815e7['params']['id']}})['then'](handleEntityNotFound(_0x456538,null))[_0xa7b9('0x25')](function(_0x2f3b1f){if(_0x2f3b1f){return _0x2f3b1f[_0xa7b9('0x80')](_0x8815e7[_0xa7b9('0x2f')][_0xa7b9('0x65')]);}})['then'](function(_0x1b18cc){if(_0x1b18cc){_0x2ba0e3=_0x1b18cc;return db[_0xa7b9('0x57')]['destroy']({'where':{'ListId':_0x8815e7[_0xa7b9('0x2f')][_0xa7b9('0x65')],'CampaignId':_0x8815e7[_0xa7b9('0x4d')]['id']}})[_0xa7b9('0x25')](function(){return _0x2ba0e3;});}})['then'](respondWithStatusCode(_0x456538,null))[_0xa7b9('0x42')](handleError(_0x456538,null));};exports[_0xa7b9('0x81')]=function(_0x15d466,_0x5265de,_0x2a58d7){var _0x277973={'raw':!![],'where':{}};var _0x282309={};var _0x217a18={'count':0x0,'rows':[]};return db[_0xa7b9('0x2d')][_0xa7b9('0x56')]({'where':{'id':_0x15d466[_0xa7b9('0x4d')]['id']}})[_0xa7b9('0x25')](handleEntityNotFound(_0x5265de,null))[_0xa7b9('0x25')](function(_0x106fbe){if(_0x106fbe){_0x282309[_0xa7b9('0x33')]=_[_0xa7b9('0x2e')](db['CmList'][_0xa7b9('0x43')]);_0x282309[_0xa7b9('0x2f')]=_['keys'](_0x15d466[_0xa7b9('0x2f')]);_0x282309[_0xa7b9('0x30')]=_[_0xa7b9('0x31')](_0x282309[_0xa7b9('0x33')],_0x282309[_0xa7b9('0x2f')]);_0x277973[_0xa7b9('0x32')]=_[_0xa7b9('0x31')](_0x282309[_0xa7b9('0x33')],qs['fields'](_0x15d466['query']['fields']));_0x277973[_0xa7b9('0x32')]=_0x277973[_0xa7b9('0x32')][_0xa7b9('0x58')]?_0x277973[_0xa7b9('0x32')]:_0x282309['model'];if(!_0x15d466[_0xa7b9('0x2f')][_0xa7b9('0x59')](_0xa7b9('0x35'))){_0x277973[_0xa7b9('0x1d')]=qs[_0xa7b9('0x1d')](_0x15d466[_0xa7b9('0x2f')][_0xa7b9('0x1d')]);_0x277973[_0xa7b9('0x1c')]=qs[_0xa7b9('0x1c')](_0x15d466[_0xa7b9('0x2f')]['offset']);}_0x277973[_0xa7b9('0x5a')]=qs['sort'](_0x15d466['query'][_0xa7b9('0x36')]);_0x277973[_0xa7b9('0x3e')]=qs['filters'](_[_0xa7b9('0x37')](_0x15d466[_0xa7b9('0x2f')],_0x282309[_0xa7b9('0x30')]));_0x277973[_0xa7b9('0x3e')]['CampaignId']=_0x106fbe['id'];if(_0x15d466[_0xa7b9('0x2f')][_0xa7b9('0x38')]){_0x277973[_0xa7b9('0x3e')]=_['merge'](_0x277973[_0xa7b9('0x3e')],{'$or':_[_0xa7b9('0x5e')](_0x277973[_0xa7b9('0x32')],function(_0x24cbbb){var _0x346a0f={};_0x346a0f[_0x24cbbb]={'$like':'%'+_0x15d466['query'][_0xa7b9('0x38')]+'%'};return _0x346a0f;})});}_0x277973=_[_0xa7b9('0x39')]({},_0x277973,_0x15d466['options']);return db['CmList'][_0xa7b9('0x1b')]({'where':_0x277973[_0xa7b9('0x3e')]})[_0xa7b9('0x25')](function(_0x552d2b){_0x217a18[_0xa7b9('0x1b')]=_0x552d2b;if(_0x15d466[_0xa7b9('0x2f')][_0xa7b9('0x3f')]){_0x277973['include']=[{'all':!![]}];}return db['CmList'][_0xa7b9('0x41')](_0x277973);})[_0xa7b9('0x25')](function(_0x214023){_0x217a18[_0xa7b9('0x5c')]=_0x214023;return _0x217a18;});}})[_0xa7b9('0x25')](respondWithFilteredResult(_0x5265de,_0x277973))[_0xa7b9('0x42')](handleError(_0x5265de,null));};exports[_0xa7b9('0x82')]=function(_0xad674a,_0x2c79b0,_0x133b01){var _0x16db65,_0x58c146;return db['Campaign']['find']({'where':{'id':_0xad674a['params']['id']}})[_0xa7b9('0x25')](handleEntityNotFound(_0x2c79b0,null))[_0xa7b9('0x25')](function(_0x1d51c2){if(_0x1d51c2){_0x58c146=_0x1d51c2;return _0x1d51c2[_0xa7b9('0x82')](_0xad674a[_0xa7b9('0x50')]['ids'],_[_0xa7b9('0x4e')](_0xad674a[_0xa7b9('0x50')],['ids','id'])||{});}return null;})[_0xa7b9('0x83')](function(_0x153e4f){var _0xf69575;_0x16db65=_0x153e4f||[];var _0x5efdb6=[];if(_0x153e4f){for(var _0x1eb281=0x0;_0x1eb281<_0x153e4f[_0xa7b9('0x58')];_0x1eb281+=0x1){var _0x565da2=_0x153e4f[_0x1eb281][_0xa7b9('0x26')]({'plain':!![]});_0xf69575=squel[_0xa7b9('0x68')]()['into']('cm_hopper_black')['fromQuery'](['phone',_0xa7b9('0x6d'),_0xa7b9('0x6e'),_0xa7b9('0x5b'),_0xa7b9('0x51'),_0xa7b9('0x4f')],squel[_0xa7b9('0x6f')]()['field'](_0xa7b9('0x6c'),'phone')[_0xa7b9('0x3c')]('id',_0xa7b9('0x6d'))[_0xa7b9('0x3c')](_0x565da2[_0xa7b9('0x72')][_0xa7b9('0x73')](),_0xa7b9('0x6e'))[_0xa7b9('0x3c')](_0xad674a['params']['id'][_0xa7b9('0x73')](),_0xa7b9('0x5b'))[_0xa7b9('0x3c')](_0xa7b9('0x70'),_0xa7b9('0x51'))[_0xa7b9('0x3c')]('NOW()',_0xa7b9('0x4f'))[_0xa7b9('0x74')](_0xa7b9('0x84'))[_0xa7b9('0x3e')](_0xa7b9('0x7b'))[_0xa7b9('0x3e')]('ListId\x20=\x20?',_0x565da2['CmListId'][_0xa7b9('0x73')]())[_0xa7b9('0x3e')](_0xa7b9('0x7c')))['toString']();_0x5efdb6[_0xa7b9('0x7d')](db[_0xa7b9('0x7e')][_0xa7b9('0x2f')](_0xf69575));}return BPromise[_0xa7b9('0x7f')](_0x5efdb6);}})[_0xa7b9('0x25')](function(){return _0x16db65;})[_0xa7b9('0x25')](respondWithResult(_0x2c79b0,null))[_0xa7b9('0x42')](handleError(_0x2c79b0,null));};exports['removeBlackLists']=function(_0x52981b,_0x41f419,_0x1cc740){var _0x22b9de;return db[_0xa7b9('0x2d')][_0xa7b9('0x44')]({'where':{'id':_0x52981b[_0xa7b9('0x4d')]['id']}})[_0xa7b9('0x25')](handleEntityNotFound(_0x41f419,null))['then'](function(_0x5aae13){if(_0x5aae13){return _0x5aae13[_0xa7b9('0x85')](_0x52981b[_0xa7b9('0x2f')][_0xa7b9('0x65')]);}})[_0xa7b9('0x25')](function(_0x3251fa){if(_0x3251fa){_0x22b9de=_0x3251fa;return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x52981b[_0xa7b9('0x2f')][_0xa7b9('0x65')],'CampaignId':_0x52981b[_0xa7b9('0x4d')]['id']}})[_0xa7b9('0x25')](function(){return _0x22b9de;});}})[_0xa7b9('0x25')](respondWithStatusCode(_0x41f419,null))[_0xa7b9('0x42')](handleError(_0x41f419,null));}; \ No newline at end of file +var _0xb899=['getHoppers','CmHopper','nolimit','CampaignId','getHopperHistories','CmHopperHistory','findAll','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','into','push','removeLists','CmList','addBlackLists','spread','cm_hopper_black','sequelize','all','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','send','index','Campaign','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','filters','pick','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','show','params','create','body','user','role','UserProfileSection','autoAssociation','catch','error','clone','find','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb899,0x136));var _0x9b89=function(_0x1eb8bc,_0x222d2b){_0x1eb8bc=_0x1eb8bc-0x0;var _0x1ea9ad=_0xb899[_0x1eb8bc];return _0x1ea9ad;};'use strict';var pdf=require(_0x9b89('0x0'));var emlformat=require(_0x9b89('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9b89('0x2'));var jsonpatch=require(_0x9b89('0x3'));var rp=require(_0x9b89('0x4'));var moment=require(_0x9b89('0x5'));var BPromise=require(_0x9b89('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9b89('0x7'));var sox=require(_0x9b89('0x8'));var csv=require(_0x9b89('0x9'));var ejs=require(_0x9b89('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9b89('0xb'));var crypto=require(_0x9b89('0xc'));var jsforce=require(_0x9b89('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9b89('0x9'));var querystring=require('querystring');var Papa=require(_0x9b89('0xe'));var authService=require(_0x9b89('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x9b89('0x10'));var logger=require(_0x9b89('0x11'))(_0x9b89('0x12'));var utils=require(_0x9b89('0x13'));var config=require(_0x9b89('0x14'));var db=require(_0x9b89('0x15'))['db'];function respondWithStatusCode(_0x18b1e4,_0x41dc1c){_0x41dc1c=_0x41dc1c||0xcc;return function(_0x2382a8){if(_0x2382a8){return _0x18b1e4[_0x9b89('0x16')](_0x41dc1c);}return _0x18b1e4[_0x9b89('0x17')](_0x41dc1c)['end']();};}function respondWithResult(_0x3c382f,_0x5db3f8){_0x5db3f8=_0x5db3f8||0xc8;return function(_0x332fe4){if(_0x332fe4){return _0x3c382f[_0x9b89('0x17')](_0x5db3f8)[_0x9b89('0x18')](_0x332fe4);}};}function respondWithFilteredResult(_0x580383,_0x477252){return function(_0x4c39d4){if(_0x4c39d4){var _0xa74340=_0x4c39d4[_0x9b89('0x19')],_0x36a0b1=_0x477252['offset'],_0x6d7bd2=_0x477252['offset']+_0x477252[_0x9b89('0x1a')],_0x126f54;if(_0x6d7bd2>=_0xa74340){_0x6d7bd2=_0xa74340;_0x126f54=0xc8;}else{_0x126f54=0xce;}_0x580383[_0x9b89('0x17')](_0x126f54);return _0x580383[_0x9b89('0x1b')](_0x9b89('0x1c'),_0x36a0b1+'-'+_0x6d7bd2+'/'+_0xa74340)[_0x9b89('0x18')](_0x4c39d4);}return null;};}function patchUpdates(_0x3c02fd){return function(_0xc4aa0d){try{jsonpatch['apply'](_0xc4aa0d,_0x3c02fd,!![]);}catch(_0x16447d){return BPromise[_0x9b89('0x1d')](_0x16447d);}return _0xc4aa0d[_0x9b89('0x1e')]();};}function saveUpdates(_0x4be97d,_0x114be4){return function(_0xd7468b){if(_0xd7468b){return _0xd7468b[_0x9b89('0x1f')](_0x4be97d)[_0x9b89('0x20')](function(_0x28b376){return _0x28b376;});}return null;};}function removeEntity(_0xde7fa7,_0x3f45ce){return function(_0xf9ace8){if(_0xf9ace8){return _0xf9ace8[_0x9b89('0x21')]()[_0x9b89('0x20')](function(){var _0x35d8dc=_0xf9ace8[_0x9b89('0x22')]({'plain':!![]});var _0x407cdf=_0x9b89('0x23');return db[_0x9b89('0x24')]['destroy']({'where':{'type':_0x407cdf,'resourceId':_0x35d8dc['id']}})['then'](function(){return _0xf9ace8;});})[_0x9b89('0x20')](function(){_0xde7fa7[_0x9b89('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f236,_0x46d110){return function(_0x8c92f5){if(!_0x8c92f5){_0x47f236[_0x9b89('0x16')](0x194);}return _0x8c92f5;};}function handleError(_0x39c4af,_0x3f5a81){_0x3f5a81=_0x3f5a81||0x1f4;return function(_0x3aaa96){logger['error'](_0x3aaa96[_0x9b89('0x25')]);if(_0x3aaa96[_0x9b89('0x26')]){delete _0x3aaa96[_0x9b89('0x26')];}_0x39c4af['status'](_0x3f5a81)[_0x9b89('0x27')](_0x3aaa96);};}exports[_0x9b89('0x28')]=function(_0x1752da,_0x3baa74){var _0x319901={},_0x281f85={},_0x1b0cd0={'count':0x0,'rows':[]};var _0xe6728b=db[_0x9b89('0x29')][_0x9b89('0x2a')];_0x281f85[_0x9b89('0x2b')]=_[_0x9b89('0x2c')](_0xe6728b);_0x281f85[_0x9b89('0x2d')]=_[_0x9b89('0x2c')](_0x1752da[_0x9b89('0x2d')]);_0x281f85['filters']=_[_0x9b89('0x2e')](_0x281f85[_0x9b89('0x2b')],_0x281f85['query']);_0x319901[_0x9b89('0x2f')]=_[_0x9b89('0x2e')](_0x281f85['model'],qs[_0x9b89('0x30')](_0x1752da[_0x9b89('0x2d')][_0x9b89('0x30')]));_0x319901[_0x9b89('0x2f')]=_0x319901[_0x9b89('0x2f')][_0x9b89('0x31')]?_0x319901[_0x9b89('0x2f')]:_0x281f85[_0x9b89('0x2b')];if(!_0x1752da[_0x9b89('0x2d')][_0x9b89('0x32')]('nolimit')){_0x319901[_0x9b89('0x1a')]=qs[_0x9b89('0x1a')](_0x1752da['query']['limit']);_0x319901['offset']=qs['offset'](_0x1752da[_0x9b89('0x2d')][_0x9b89('0x33')]);}_0x319901[_0x9b89('0x34')]=qs[_0x9b89('0x35')](_0x1752da[_0x9b89('0x2d')][_0x9b89('0x35')]);_0x319901['where']=qs[_0x9b89('0x36')](_[_0x9b89('0x37')](_0x1752da[_0x9b89('0x2d')],_0x281f85['filters']));if(_0x1752da[_0x9b89('0x2d')][_0x9b89('0x38')]){_0x319901['where']=_[_0x9b89('0x39')](_0x319901[_0x9b89('0x3a')],{'$or':_[_0x9b89('0x3b')](_0xe6728b,function(_0x5436d3){if(_0x5436d3[_0x9b89('0x3c')][_0x9b89('0x3d')]!==_0x9b89('0x3e')){var _0x60bd79={};_0x60bd79[_0x5436d3['field']]={'$like':'%'+_0x1752da['query']['filter']+'%'};return _0x60bd79;}})});}_0x319901=_[_0x9b89('0x39')]({},_0x319901,_0x1752da[_0x9b89('0x3f')]);var _0x4c99e8={'where':_0x319901['where']};return db[_0x9b89('0x29')][_0x9b89('0x19')](_0x4c99e8)[_0x9b89('0x20')](function(_0x1f78b6){_0x1b0cd0[_0x9b89('0x19')]=_0x1f78b6;if(_0x1752da['query'][_0x9b89('0x40')]){_0x319901[_0x9b89('0x41')]=[{'all':!![]}];}return db[_0x9b89('0x29')]['findAll'](_0x319901);})[_0x9b89('0x20')](function(_0x5f06f9){_0x1b0cd0[_0x9b89('0x42')]=_0x5f06f9;return _0x1b0cd0;})[_0x9b89('0x20')](respondWithFilteredResult(_0x3baa74,_0x319901))['catch'](handleError(_0x3baa74,null));};exports[_0x9b89('0x43')]=function(_0x5d61c8,_0x44792c){var _0x841739={'raw':![],'where':{'id':_0x5d61c8[_0x9b89('0x44')]['id']}},_0x266d72={};_0x266d72[_0x9b89('0x2b')]=_['keys'](db[_0x9b89('0x29')][_0x9b89('0x2a')]);_0x266d72['query']=_['keys'](_0x5d61c8['query']);_0x266d72['filters']=_[_0x9b89('0x2e')](_0x266d72[_0x9b89('0x2b')],_0x266d72['query']);_0x841739['attributes']=_['intersection'](_0x266d72[_0x9b89('0x2b')],qs[_0x9b89('0x30')](_0x5d61c8[_0x9b89('0x2d')][_0x9b89('0x30')]));_0x841739[_0x9b89('0x2f')]=_0x841739[_0x9b89('0x2f')][_0x9b89('0x31')]?_0x841739[_0x9b89('0x2f')]:_0x266d72[_0x9b89('0x2b')];if(_0x5d61c8[_0x9b89('0x2d')]['includeAll']){_0x841739['include']=[{'all':!![]}];}_0x841739=_[_0x9b89('0x39')]({},_0x841739,_0x5d61c8[_0x9b89('0x3f')]);return db['Campaign']['find'](_0x841739)[_0x9b89('0x20')](handleEntityNotFound(_0x44792c,null))['then'](respondWithResult(_0x44792c,null))['catch'](handleError(_0x44792c,null));};exports[_0x9b89('0x45')]=function(_0x1065ce,_0x390b23){return db['Campaign'][_0x9b89('0x45')](_0x1065ce[_0x9b89('0x46')],{})[_0x9b89('0x20')](function(_0x7c157){var _0x1b9bba=_0x1065ce[_0x9b89('0x47')][_0x9b89('0x22')]({'plain':!![]});if(!_0x1b9bba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b9bba[_0x9b89('0x48')]==='user'){var _0x372416=_0x7c157[_0x9b89('0x22')]({'plain':!![]});var _0x189f72='IvrCampaigns';return db[_0x9b89('0x49')]['find']({'where':{'name':_0x189f72,'userProfileId':_0x1b9bba['userProfileId']},'raw':!![]})[_0x9b89('0x20')](function(_0x3fce60){if(_0x3fce60&&_0x3fce60[_0x9b89('0x4a')]===0x0){return db[_0x9b89('0x24')]['create']({'name':_0x372416['name'],'resourceId':_0x372416['id'],'type':_0x3fce60[_0x9b89('0x26')],'sectionId':_0x3fce60['id']},{})['then'](function(){return _0x7c157;});}else{return _0x7c157;}})[_0x9b89('0x4b')](function(_0x328cde){logger[_0x9b89('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x328cde);throw _0x328cde;});}return _0x7c157;})[_0x9b89('0x20')](respondWithResult(_0x390b23,0xc9))[_0x9b89('0x4b')](handleError(_0x390b23,null));};exports[_0x9b89('0x4d')]=function(_0x204e6d,_0x5cb84a){var _0x1f2971={'raw':![],'where':{'id':_0x204e6d[_0x9b89('0x44')]['id']}},_0xb0c5b2={};_0xb0c5b2[_0x9b89('0x2b')]=_['keys'](db['Campaign'][_0x9b89('0x2a')]);_0x1f2971['attributes']=_['intersection'](_0xb0c5b2['model'],qs[_0x9b89('0x30')](_0x204e6d[_0x9b89('0x2d')][_0x9b89('0x30')]));_0x1f2971[_0x9b89('0x2f')]=_0x1f2971['attributes'][_0x9b89('0x31')]?_0x1f2971[_0x9b89('0x2f')]:_0xb0c5b2[_0x9b89('0x2b')];if(_0x204e6d[_0x9b89('0x2d')][_0x9b89('0x40')]){_0x1f2971[_0x9b89('0x41')]=[{'all':!![]}];}_0x1f2971=_[_0x9b89('0x39')]({},_0x1f2971,_0x204e6d[_0x9b89('0x3f')]);return db[_0x9b89('0x29')][_0x9b89('0x4e')](_0x1f2971)[_0x9b89('0x20')](handleEntityNotFound(_0x5cb84a,null))['then'](function(_0xee12f1){if(_0xee12f1){var _0x42a10f=_0xee12f1[_0x9b89('0x22')]({'plain':!![]});_0x42a10f=qs[_0x9b89('0x4f')](_0x42a10f,['id',_0x9b89('0x50'),_0x9b89('0x51')]);_0x204e6d[_0x9b89('0x46')]=_['omit'](_0x204e6d[_0x9b89('0x46')],['id',_0x9b89('0x50'),_0x9b89('0x51')]);return db[_0x9b89('0x29')][_0x9b89('0x45')](_[_0x9b89('0x39')](_0x42a10f,_0x204e6d[_0x9b89('0x46')]),{'include':_0x204e6d[_0x9b89('0x2d')]['includeAll']?[{'all':!![]}]:undefined})[_0x9b89('0x20')](function(_0x4a831d){var _0x3161e5=_0x204e6d[_0x9b89('0x47')]['get']({'plain':!![]});if(!_0x3161e5)throw new Error(_0x9b89('0x52'));if(_0x3161e5[_0x9b89('0x48')]===_0x9b89('0x47')){var _0x496ba7=_0x4a831d[_0x9b89('0x22')]({'plain':!![]});var _0x8d5df6='IvrCampaigns';return db['UserProfileSection'][_0x9b89('0x4e')]({'where':{'name':_0x8d5df6,'userProfileId':_0x3161e5['userProfileId']},'raw':!![]})[_0x9b89('0x20')](function(_0x2d3724){if(_0x2d3724&&_0x2d3724['autoAssociation']===0x0){return db[_0x9b89('0x24')][_0x9b89('0x45')]({'name':_0x496ba7[_0x9b89('0x26')],'resourceId':_0x496ba7['id'],'type':_0x2d3724['name'],'sectionId':_0x2d3724['id']},{})[_0x9b89('0x20')](function(){return _0x4a831d;});}else{return _0x4a831d;}})[_0x9b89('0x4b')](function(_0x1a4aff){logger[_0x9b89('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a4aff);throw _0x1a4aff;});}return _0x4a831d;});}})[_0x9b89('0x20')](respondWithResult(_0x5cb84a,0xc9))[_0x9b89('0x4b')](handleError(_0x5cb84a,null));};exports[_0x9b89('0x1f')]=function(_0x147224,_0x574588){if(_0x147224[_0x9b89('0x46')]['id']){delete _0x147224[_0x9b89('0x46')]['id'];}return db[_0x9b89('0x29')][_0x9b89('0x4e')]({'where':{'id':_0x147224[_0x9b89('0x44')]['id']}})['then'](handleEntityNotFound(_0x574588,null))['then'](saveUpdates(_0x147224[_0x9b89('0x46')],null))[_0x9b89('0x20')](respondWithResult(_0x574588,null))[_0x9b89('0x4b')](handleError(_0x574588,null));};exports[_0x9b89('0x21')]=function(_0x430a51,_0x37caff){return db[_0x9b89('0x29')][_0x9b89('0x4e')]({'where':{'id':_0x430a51[_0x9b89('0x44')]['id']}})[_0x9b89('0x20')](handleEntityNotFound(_0x37caff,null))[_0x9b89('0x20')](removeEntity(_0x37caff,null))[_0x9b89('0x4b')](handleError(_0x37caff,null));};exports[_0x9b89('0x53')]=function(_0x21a7fa,_0x3c9e76,_0x461b24){var _0xaead3f={'raw':!![],'where':{}};var _0x470a99={};var _0x4a968b={'count':0x0,'rows':[]};return db[_0x9b89('0x29')]['findOne']({'where':{'id':_0x21a7fa[_0x9b89('0x44')]['id']}})[_0x9b89('0x20')](handleEntityNotFound(_0x3c9e76,null))[_0x9b89('0x20')](function(_0x41ca33){if(_0x41ca33){_0x470a99[_0x9b89('0x2b')]=_['keys'](db[_0x9b89('0x54')][_0x9b89('0x2a')]);_0x470a99[_0x9b89('0x2d')]=_['keys'](_0x21a7fa['query']);_0x470a99['filters']=_[_0x9b89('0x2e')](_0x470a99[_0x9b89('0x2b')],_0x470a99[_0x9b89('0x2d')]);_0xaead3f[_0x9b89('0x2f')]=_['intersection'](_0x470a99[_0x9b89('0x2b')],qs[_0x9b89('0x30')](_0x21a7fa[_0x9b89('0x2d')]['fields']));_0xaead3f['attributes']=_0xaead3f[_0x9b89('0x2f')]['length']?_0xaead3f[_0x9b89('0x2f')]:_0x470a99[_0x9b89('0x2b')];if(!_0x21a7fa[_0x9b89('0x2d')][_0x9b89('0x32')](_0x9b89('0x55'))){_0xaead3f[_0x9b89('0x1a')]=qs[_0x9b89('0x1a')](_0x21a7fa[_0x9b89('0x2d')][_0x9b89('0x1a')]);_0xaead3f[_0x9b89('0x33')]=qs[_0x9b89('0x33')](_0x21a7fa['query'][_0x9b89('0x33')]);}_0xaead3f[_0x9b89('0x34')]=qs[_0x9b89('0x35')](_0x21a7fa['query']['sort']);_0xaead3f['where']=qs[_0x9b89('0x36')](_[_0x9b89('0x37')](_0x21a7fa[_0x9b89('0x2d')],_0x470a99[_0x9b89('0x36')]));_0xaead3f[_0x9b89('0x3a')][_0x9b89('0x56')]=_0x41ca33['id'];if(_0x21a7fa[_0x9b89('0x2d')][_0x9b89('0x38')]){_0xaead3f['where']=_[_0x9b89('0x39')](_0xaead3f[_0x9b89('0x3a')],{'$or':_['map'](_0xaead3f[_0x9b89('0x2f')],function(_0x52294a){var _0x168a25={};_0x168a25[_0x52294a]={'$like':'%'+_0x21a7fa[_0x9b89('0x2d')][_0x9b89('0x38')]+'%'};return _0x168a25;})});}_0xaead3f=_[_0x9b89('0x39')]({},_0xaead3f,_0x21a7fa[_0x9b89('0x3f')]);return db[_0x9b89('0x54')][_0x9b89('0x19')]({'where':_0xaead3f[_0x9b89('0x3a')]})[_0x9b89('0x20')](function(_0x870109){_0x4a968b['count']=_0x870109;if(_0x21a7fa['query'][_0x9b89('0x40')]){_0xaead3f[_0x9b89('0x41')]=[{'all':!![]}];}return db[_0x9b89('0x54')]['findAll'](_0xaead3f);})[_0x9b89('0x20')](function(_0x4b49b0){_0x4a968b['rows']=_0x4b49b0;return _0x4a968b;});}})[_0x9b89('0x20')](respondWithFilteredResult(_0x3c9e76,_0xaead3f))['catch'](handleError(_0x3c9e76,null));};exports[_0x9b89('0x57')]=function(_0x1f4f69,_0x45783f,_0x1ef0a9){var _0x415979={'raw':!![],'where':{}};var _0x58fe80={};var _0xdffa06={'count':0x0,'rows':[]};return db[_0x9b89('0x29')]['findOne']({'where':{'id':_0x1f4f69[_0x9b89('0x44')]['id']}})[_0x9b89('0x20')](handleEntityNotFound(_0x45783f,null))[_0x9b89('0x20')](function(_0x217536){if(_0x217536){_0x58fe80[_0x9b89('0x2b')]=_[_0x9b89('0x2c')](db[_0x9b89('0x58')][_0x9b89('0x2a')]);_0x58fe80[_0x9b89('0x2d')]=_[_0x9b89('0x2c')](_0x1f4f69[_0x9b89('0x2d')]);_0x58fe80[_0x9b89('0x36')]=_[_0x9b89('0x2e')](_0x58fe80[_0x9b89('0x2b')],_0x58fe80[_0x9b89('0x2d')]);_0x415979[_0x9b89('0x2f')]=_['intersection'](_0x58fe80['model'],qs[_0x9b89('0x30')](_0x1f4f69['query'][_0x9b89('0x30')]));_0x415979['attributes']=_0x415979[_0x9b89('0x2f')][_0x9b89('0x31')]?_0x415979['attributes']:_0x58fe80[_0x9b89('0x2b')];if(!_0x1f4f69['query'][_0x9b89('0x32')]('nolimit')){_0x415979[_0x9b89('0x1a')]=qs[_0x9b89('0x1a')](_0x1f4f69['query'][_0x9b89('0x1a')]);_0x415979[_0x9b89('0x33')]=qs['offset'](_0x1f4f69[_0x9b89('0x2d')]['offset']);}_0x415979[_0x9b89('0x34')]=qs[_0x9b89('0x35')](_0x1f4f69[_0x9b89('0x2d')]['sort']);_0x415979[_0x9b89('0x3a')]=qs[_0x9b89('0x36')](_[_0x9b89('0x37')](_0x1f4f69['query'],_0x58fe80[_0x9b89('0x36')]));_0x415979[_0x9b89('0x3a')][_0x9b89('0x56')]=_0x217536['id'];if(_0x1f4f69[_0x9b89('0x2d')][_0x9b89('0x38')]){_0x415979[_0x9b89('0x3a')]=_[_0x9b89('0x39')](_0x415979[_0x9b89('0x3a')],{'$or':_['map'](_0x415979[_0x9b89('0x2f')],function(_0x1b6def){var _0x23980f={};_0x23980f[_0x1b6def]={'$like':'%'+_0x1f4f69['query'][_0x9b89('0x38')]+'%'};return _0x23980f;})});}_0x415979=_['merge']({},_0x415979,_0x1f4f69[_0x9b89('0x3f')]);return db[_0x9b89('0x58')][_0x9b89('0x19')]({'where':_0x415979[_0x9b89('0x3a')]})[_0x9b89('0x20')](function(_0x1c6d11){_0xdffa06['count']=_0x1c6d11;if(_0x1f4f69[_0x9b89('0x2d')]['includeAll']){_0x415979[_0x9b89('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x9b89('0x59')](_0x415979);})[_0x9b89('0x20')](function(_0x8e3335){_0xdffa06[_0x9b89('0x42')]=_0x8e3335;return _0xdffa06;});}})[_0x9b89('0x20')](respondWithFilteredResult(_0x45783f,_0x415979))['catch'](handleError(_0x45783f,null));};exports[_0x9b89('0x5a')]=function(_0x334fde,_0x36f9ad,_0x586ca2){var _0x5d9dbb={'raw':!![],'where':{}};var _0x299600={};var _0x17fb35={'count':0x0,'rows':[]};return db[_0x9b89('0x29')][_0x9b89('0x5b')]({'where':{'id':_0x334fde[_0x9b89('0x44')]['id']}})[_0x9b89('0x20')](handleEntityNotFound(_0x36f9ad,null))[_0x9b89('0x20')](function(_0x484745){if(_0x484745){_0x299600[_0x9b89('0x2b')]=_[_0x9b89('0x2c')](db[_0x9b89('0x5c')]['rawAttributes']);_0x299600[_0x9b89('0x2d')]=_['keys'](_0x334fde[_0x9b89('0x2d')]);_0x299600['filters']=_[_0x9b89('0x2e')](_0x299600['model'],_0x299600[_0x9b89('0x2d')]);_0x5d9dbb[_0x9b89('0x2f')]=_[_0x9b89('0x2e')](_0x299600[_0x9b89('0x2b')],qs[_0x9b89('0x30')](_0x334fde[_0x9b89('0x2d')]['fields']));_0x5d9dbb[_0x9b89('0x2f')]=_0x5d9dbb[_0x9b89('0x2f')][_0x9b89('0x31')]?_0x5d9dbb[_0x9b89('0x2f')]:_0x299600[_0x9b89('0x2b')];if(!_0x334fde['query']['hasOwnProperty'](_0x9b89('0x55'))){_0x5d9dbb[_0x9b89('0x1a')]=qs[_0x9b89('0x1a')](_0x334fde[_0x9b89('0x2d')][_0x9b89('0x1a')]);_0x5d9dbb['offset']=qs[_0x9b89('0x33')](_0x334fde[_0x9b89('0x2d')]['offset']);}_0x5d9dbb[_0x9b89('0x34')]=qs[_0x9b89('0x35')](_0x334fde[_0x9b89('0x2d')][_0x9b89('0x35')]);_0x5d9dbb[_0x9b89('0x3a')]=qs[_0x9b89('0x36')](_[_0x9b89('0x37')](_0x334fde[_0x9b89('0x2d')],_0x299600[_0x9b89('0x36')]));_0x5d9dbb[_0x9b89('0x3a')][_0x9b89('0x56')]=_0x484745['id'];if(_0x334fde[_0x9b89('0x2d')][_0x9b89('0x38')]){_0x5d9dbb['where']=_['merge'](_0x5d9dbb[_0x9b89('0x3a')],{'$or':_['map'](_0x5d9dbb[_0x9b89('0x2f')],function(_0x298565){var _0x558707={};_0x558707[_0x298565]={'$like':'%'+_0x334fde[_0x9b89('0x2d')][_0x9b89('0x38')]+'%'};return _0x558707;})});}_0x5d9dbb=_['merge']({},_0x5d9dbb,_0x334fde[_0x9b89('0x3f')]);return db[_0x9b89('0x5c')][_0x9b89('0x19')]({'where':_0x5d9dbb['where']})[_0x9b89('0x20')](function(_0xabc0d7){_0x17fb35[_0x9b89('0x19')]=_0xabc0d7;if(_0x334fde[_0x9b89('0x2d')][_0x9b89('0x40')]){_0x5d9dbb[_0x9b89('0x41')]=[{'all':!![]}];}return db[_0x9b89('0x5c')]['findAll'](_0x5d9dbb);})['then'](function(_0x5135f3){_0x17fb35[_0x9b89('0x42')]=_0x5135f3;return _0x17fb35;});}})['then'](respondWithFilteredResult(_0x36f9ad,_0x5d9dbb))['catch'](handleError(_0x36f9ad,null));};exports[_0x9b89('0x5d')]=function(_0xbac577,_0xa41030,_0x444a33){var _0x1d4ef2={'raw':!![],'where':{}};var _0x2f3c8c={};var _0x3f2a0b={'count':0x0,'rows':[]};return db['Campaign'][_0x9b89('0x5b')]({'where':{'id':_0xbac577[_0x9b89('0x44')]['id']}})[_0x9b89('0x20')](handleEntityNotFound(_0xa41030,null))['then'](function(_0x5bfd69){if(_0x5bfd69){_0x2f3c8c[_0x9b89('0x2b')]=_[_0x9b89('0x2c')](db[_0x9b89('0x5e')][_0x9b89('0x2a')]);_0x2f3c8c['query']=_[_0x9b89('0x2c')](_0xbac577[_0x9b89('0x2d')]);_0x2f3c8c[_0x9b89('0x36')]=_[_0x9b89('0x2e')](_0x2f3c8c[_0x9b89('0x2b')],_0x2f3c8c[_0x9b89('0x2d')]);_0x1d4ef2[_0x9b89('0x2f')]=_[_0x9b89('0x2e')](_0x2f3c8c['model'],qs['fields'](_0xbac577[_0x9b89('0x2d')][_0x9b89('0x30')]));_0x1d4ef2['attributes']=_0x1d4ef2['attributes'][_0x9b89('0x31')]?_0x1d4ef2['attributes']:_0x2f3c8c['model'];if(!_0xbac577[_0x9b89('0x2d')][_0x9b89('0x32')](_0x9b89('0x55'))){_0x1d4ef2[_0x9b89('0x1a')]=qs[_0x9b89('0x1a')](_0xbac577[_0x9b89('0x2d')][_0x9b89('0x1a')]);_0x1d4ef2[_0x9b89('0x33')]=qs[_0x9b89('0x33')](_0xbac577[_0x9b89('0x2d')][_0x9b89('0x33')]);}_0x1d4ef2[_0x9b89('0x34')]=qs[_0x9b89('0x35')](_0xbac577[_0x9b89('0x2d')][_0x9b89('0x35')]);_0x1d4ef2[_0x9b89('0x3a')]=qs[_0x9b89('0x36')](_['pick'](_0xbac577[_0x9b89('0x2d')],_0x2f3c8c[_0x9b89('0x36')]));_0x1d4ef2['where'][_0x9b89('0x56')]=_0x5bfd69['id'];if(_0xbac577['query'][_0x9b89('0x38')]){_0x1d4ef2[_0x9b89('0x3a')]=_[_0x9b89('0x39')](_0x1d4ef2[_0x9b89('0x3a')],{'$or':_[_0x9b89('0x3b')](_0x1d4ef2['attributes'],function(_0x16f79b){var _0xd6b600={};_0xd6b600[_0x16f79b]={'$like':'%'+_0xbac577[_0x9b89('0x2d')]['filter']+'%'};return _0xd6b600;})});}_0x1d4ef2=_[_0x9b89('0x39')]({},_0x1d4ef2,_0xbac577['options']);return db[_0x9b89('0x5e')]['count']({'where':_0x1d4ef2[_0x9b89('0x3a')]})[_0x9b89('0x20')](function(_0x436d16){_0x3f2a0b[_0x9b89('0x19')]=_0x436d16;if(_0xbac577[_0x9b89('0x2d')][_0x9b89('0x40')]){_0x1d4ef2['include']=[{'all':!![]}];}return db[_0x9b89('0x5e')]['findAll'](_0x1d4ef2);})[_0x9b89('0x20')](function(_0x39c428){_0x3f2a0b[_0x9b89('0x42')]=_0x39c428;return _0x3f2a0b;});}})[_0x9b89('0x20')](respondWithFilteredResult(_0xa41030,_0x1d4ef2))[_0x9b89('0x4b')](handleError(_0xa41030,null));};exports['getLists']=function(_0x312e22,_0x335a1a,_0x3e309d){var _0x1aea22={};var _0xdb6462={};var _0x2297d3;var _0x898c25;return db[_0x9b89('0x29')][_0x9b89('0x5b')]({'where':{'id':_0x312e22['params']['id']}})[_0x9b89('0x20')](handleEntityNotFound(_0x335a1a,null))[_0x9b89('0x20')](function(_0x5c60ff){if(_0x5c60ff){_0x2297d3=_0x5c60ff;_0xdb6462[_0x9b89('0x2b')]=_[_0x9b89('0x2c')](db['CmList'][_0x9b89('0x2a')]);_0xdb6462[_0x9b89('0x2d')]=_[_0x9b89('0x2c')](_0x312e22[_0x9b89('0x2d')]);_0xdb6462['filters']=_[_0x9b89('0x2e')](_0xdb6462[_0x9b89('0x2b')],_0xdb6462[_0x9b89('0x2d')]);_0x1aea22['attributes']=_[_0x9b89('0x2e')](_0xdb6462[_0x9b89('0x2b')],qs[_0x9b89('0x30')](_0x312e22[_0x9b89('0x2d')][_0x9b89('0x30')]));_0x1aea22[_0x9b89('0x2f')]=_0x1aea22['attributes']['length']?_0x1aea22[_0x9b89('0x2f')]:_0xdb6462[_0x9b89('0x2b')];_0x1aea22[_0x9b89('0x34')]=qs[_0x9b89('0x35')](_0x312e22[_0x9b89('0x2d')]['sort']);_0x1aea22['where']=qs[_0x9b89('0x36')](_['pick'](_0x312e22[_0x9b89('0x2d')],_0xdb6462['filters']));if(_0x312e22[_0x9b89('0x2d')][_0x9b89('0x38')]){_0x1aea22[_0x9b89('0x3a')]=_[_0x9b89('0x39')](_0x1aea22['where'],{'$or':_[_0x9b89('0x3b')](_0x1aea22[_0x9b89('0x2f')],function(_0x3ed9dc){var _0x400b04={};_0x400b04[_0x3ed9dc]={'$like':'%'+_0x312e22[_0x9b89('0x2d')][_0x9b89('0x38')]+'%'};return _0x400b04;})});}_0x1aea22=_[_0x9b89('0x39')]({},_0x1aea22,_0x312e22[_0x9b89('0x3f')]);return _0x2297d3[_0x9b89('0x5f')](_0x1aea22);}})[_0x9b89('0x20')](function(_0x1a1b03){if(_0x1a1b03){_0x898c25=_0x1a1b03['length'];if(!_0x312e22[_0x9b89('0x2d')][_0x9b89('0x32')](_0x9b89('0x55'))){_0x1aea22[_0x9b89('0x1a')]=qs[_0x9b89('0x1a')](_0x312e22[_0x9b89('0x2d')][_0x9b89('0x1a')]);_0x1aea22['offset']=qs['offset'](_0x312e22['query'][_0x9b89('0x33')]);}return _0x2297d3[_0x9b89('0x5f')](_0x1aea22);}})['then'](function(_0x379346){if(_0x379346){return _0x379346?{'count':_0x898c25,'rows':_0x379346}:null;}})['then'](respondWithResult(_0x335a1a,null))[_0x9b89('0x4b')](handleError(_0x335a1a,null));};exports[_0x9b89('0x60')]=function(_0x23936d,_0x4025ae,_0x285d0e){var _0x56d1f3,_0x34aa1d;return db['Campaign'][_0x9b89('0x4e')]({'where':{'id':_0x23936d[_0x9b89('0x44')]['id']}})['then'](handleEntityNotFound(_0x4025ae,null))['then'](function(_0xa7a0b3){if(_0xa7a0b3){_0x34aa1d=_0xa7a0b3;return _0xa7a0b3[_0x9b89('0x60')](_0x23936d[_0x9b89('0x46')]['ids'],_[_0x9b89('0x4f')](_0x23936d['body'],[_0x9b89('0x61'),'id'])||{});}return null;})['spread'](function(_0x2c711d){var _0x2a4653;_0x56d1f3=_0x2c711d||[];var _0x9e803e=[];if(_0x2c711d){for(var _0x1057e0=0x0;_0x1057e0<_0x2c711d[_0x9b89('0x31')];_0x1057e0+=0x1){var _0x51475f=_0x2c711d[_0x1057e0][_0x9b89('0x22')]({'plain':!![]});_0x34aa1d[_0x9b89('0x62')]=_0x23936d['body'][_0x9b89('0x62')]?_0x23936d['body']['dialCheckDuplicateType']:_0x34aa1d[_0x9b89('0x62')];switch(_0x34aa1d[_0x9b89('0x62')]){case'always':_0x2a4653=squel[_0x9b89('0x63')]()['into'](_0x9b89('0x64'))[_0x9b89('0x65')]([_0x9b89('0x66'),_0x9b89('0x67'),_0x9b89('0x68'),_0x9b89('0x69'),'CampaignId',_0x9b89('0x50'),'updatedAt'],squel['select']()[_0x9b89('0x6a')]('phone',_0x9b89('0x66'))['field'](_0x9b89('0x6b'),'scheduledAt')[_0x9b89('0x6a')]('id',_0x9b89('0x68'))['field'](_0x51475f[_0x9b89('0x6c')][_0x9b89('0x6d')](),_0x9b89('0x69'))[_0x9b89('0x6a')](_0x23936d['params']['id'][_0x9b89('0x6d')](),_0x9b89('0x56'))[_0x9b89('0x6a')](_0x9b89('0x6b'),_0x9b89('0x50'))[_0x9b89('0x6a')]('NOW()',_0x9b89('0x51'))[_0x9b89('0x6e')](_0x9b89('0x6f'))[_0x9b89('0x3a')](_0x9b89('0x70'))[_0x9b89('0x3a')](_0x9b89('0x71'),_0x51475f[_0x9b89('0x6c')][_0x9b89('0x6d')]())[_0x9b89('0x3a')](_0x9b89('0x72'))[_0x9b89('0x3a')](_0x9b89('0x73'),squel[_0x9b89('0x74')]()[_0x9b89('0x6a')](_0x9b89('0x75'))['from'](_0x9b89('0x76'))[_0x9b89('0x3a')]('CampaignId\x20=\x20?',_0x23936d[_0x9b89('0x44')]['id'][_0x9b89('0x6d')]()))[_0x9b89('0x3a')](_0x9b89('0x73'),squel[_0x9b89('0x74')]()[_0x9b89('0x6a')](_0x9b89('0x77'))[_0x9b89('0x6e')](_0x9b89('0x64'))[_0x9b89('0x3a')](_0x9b89('0x78'),_0x23936d[_0x9b89('0x44')]['id'][_0x9b89('0x6d')]())))[_0x9b89('0x6d')]();break;case'onlyIfOpen':_0x2a4653=squel['insert']()['into'](_0x9b89('0x64'))[_0x9b89('0x65')](['phone',_0x9b89('0x67'),'ContactId',_0x9b89('0x69'),_0x9b89('0x56'),_0x9b89('0x50'),_0x9b89('0x51')],squel[_0x9b89('0x74')]()[_0x9b89('0x6a')](_0x9b89('0x66'),_0x9b89('0x66'))[_0x9b89('0x6a')](_0x9b89('0x6b'),'scheduledAt')[_0x9b89('0x6a')]('id',_0x9b89('0x68'))[_0x9b89('0x6a')](_0x51475f['CmListId']['toString'](),_0x9b89('0x69'))[_0x9b89('0x6a')](_0x23936d['params']['id']['toString'](),_0x9b89('0x56'))[_0x9b89('0x6a')](_0x9b89('0x6b'),_0x9b89('0x50'))[_0x9b89('0x6a')](_0x9b89('0x6b'),_0x9b89('0x51'))[_0x9b89('0x6e')](_0x9b89('0x6f'))[_0x9b89('0x3a')](_0x9b89('0x70'))[_0x9b89('0x3a')](_0x9b89('0x71'),_0x51475f[_0x9b89('0x6c')][_0x9b89('0x6d')]())['where'](_0x9b89('0x72'))[_0x9b89('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x9b89('0x77'))['from'](_0x9b89('0x64'))[_0x9b89('0x3a')](_0x9b89('0x78'),_0x23936d[_0x9b89('0x44')]['id'][_0x9b89('0x6d')]())))[_0x9b89('0x6d')]();break;default:_0x2a4653=squel[_0x9b89('0x63')]()[_0x9b89('0x79')](_0x9b89('0x64'))['fromQuery']([_0x9b89('0x66'),_0x9b89('0x67'),_0x9b89('0x68'),'ListId','CampaignId',_0x9b89('0x50'),_0x9b89('0x51')],squel[_0x9b89('0x74')]()[_0x9b89('0x6a')]('phone',_0x9b89('0x66'))[_0x9b89('0x6a')]('NOW()',_0x9b89('0x67'))['field']('id',_0x9b89('0x68'))[_0x9b89('0x6a')](_0x51475f['CmListId']['toString'](),'ListId')[_0x9b89('0x6a')](_0x23936d[_0x9b89('0x44')]['id']['toString'](),_0x9b89('0x56'))['field'](_0x9b89('0x6b'),'createdAt')[_0x9b89('0x6a')](_0x9b89('0x6b'),_0x9b89('0x51'))['from'](_0x9b89('0x6f'))[_0x9b89('0x3a')](_0x9b89('0x70'))[_0x9b89('0x3a')](_0x9b89('0x71'),_0x51475f[_0x9b89('0x6c')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x9b89('0x6d')]();}_0x9e803e[_0x9b89('0x7a')](db['sequelize']['query'](_0x2a4653));}return BPromise['all'](_0x9e803e);}})[_0x9b89('0x20')](function(){return _0x56d1f3;})['then'](respondWithResult(_0x4025ae,null))[_0x9b89('0x4b')](handleError(_0x4025ae,null));};exports[_0x9b89('0x7b')]=function(_0x56139e,_0x1e05d4,_0x29270c){var _0x2dd5e4;return db[_0x9b89('0x29')]['find']({'where':{'id':_0x56139e['params']['id']}})[_0x9b89('0x20')](handleEntityNotFound(_0x1e05d4,null))['then'](function(_0x72e9a2){if(_0x72e9a2){return _0x72e9a2[_0x9b89('0x7b')](_0x56139e[_0x9b89('0x2d')][_0x9b89('0x61')]);}})['then'](function(_0x3ce034){if(_0x3ce034){_0x2dd5e4=_0x3ce034;return db[_0x9b89('0x54')][_0x9b89('0x21')]({'where':{'ListId':_0x56139e[_0x9b89('0x2d')]['ids'],'CampaignId':_0x56139e[_0x9b89('0x44')]['id']}})[_0x9b89('0x20')](function(){return _0x2dd5e4;});}})[_0x9b89('0x20')](respondWithStatusCode(_0x1e05d4,null))['catch'](handleError(_0x1e05d4,null));};exports['getBlackLists']=function(_0x343221,_0x300a80,_0x2efd9e){var _0x16410c={'raw':!![],'where':{}};var _0xf79263={};var _0x903c90={'count':0x0,'rows':[]};return db[_0x9b89('0x29')][_0x9b89('0x5b')]({'where':{'id':_0x343221[_0x9b89('0x44')]['id']}})[_0x9b89('0x20')](handleEntityNotFound(_0x300a80,null))[_0x9b89('0x20')](function(_0xb425dc){if(_0xb425dc){_0xf79263[_0x9b89('0x2b')]=_[_0x9b89('0x2c')](db[_0x9b89('0x7c')][_0x9b89('0x2a')]);_0xf79263['query']=_[_0x9b89('0x2c')](_0x343221[_0x9b89('0x2d')]);_0xf79263[_0x9b89('0x36')]=_[_0x9b89('0x2e')](_0xf79263[_0x9b89('0x2b')],_0xf79263[_0x9b89('0x2d')]);_0x16410c[_0x9b89('0x2f')]=_[_0x9b89('0x2e')](_0xf79263[_0x9b89('0x2b')],qs[_0x9b89('0x30')](_0x343221['query'][_0x9b89('0x30')]));_0x16410c[_0x9b89('0x2f')]=_0x16410c['attributes'][_0x9b89('0x31')]?_0x16410c[_0x9b89('0x2f')]:_0xf79263[_0x9b89('0x2b')];if(!_0x343221[_0x9b89('0x2d')][_0x9b89('0x32')](_0x9b89('0x55'))){_0x16410c[_0x9b89('0x1a')]=qs[_0x9b89('0x1a')](_0x343221[_0x9b89('0x2d')]['limit']);_0x16410c[_0x9b89('0x33')]=qs['offset'](_0x343221['query'][_0x9b89('0x33')]);}_0x16410c[_0x9b89('0x34')]=qs[_0x9b89('0x35')](_0x343221[_0x9b89('0x2d')][_0x9b89('0x35')]);_0x16410c['where']=qs['filters'](_[_0x9b89('0x37')](_0x343221['query'],_0xf79263[_0x9b89('0x36')]));_0x16410c[_0x9b89('0x3a')]['CampaignId']=_0xb425dc['id'];if(_0x343221['query'][_0x9b89('0x38')]){_0x16410c[_0x9b89('0x3a')]=_[_0x9b89('0x39')](_0x16410c[_0x9b89('0x3a')],{'$or':_[_0x9b89('0x3b')](_0x16410c[_0x9b89('0x2f')],function(_0x46f24a){var _0x4c3100={};_0x4c3100[_0x46f24a]={'$like':'%'+_0x343221['query']['filter']+'%'};return _0x4c3100;})});}_0x16410c=_['merge']({},_0x16410c,_0x343221[_0x9b89('0x3f')]);return db[_0x9b89('0x7c')][_0x9b89('0x19')]({'where':_0x16410c['where']})[_0x9b89('0x20')](function(_0x4fb028){_0x903c90[_0x9b89('0x19')]=_0x4fb028;if(_0x343221[_0x9b89('0x2d')][_0x9b89('0x40')]){_0x16410c[_0x9b89('0x41')]=[{'all':!![]}];}return db[_0x9b89('0x7c')][_0x9b89('0x59')](_0x16410c);})['then'](function(_0x352710){_0x903c90[_0x9b89('0x42')]=_0x352710;return _0x903c90;});}})[_0x9b89('0x20')](respondWithFilteredResult(_0x300a80,_0x16410c))[_0x9b89('0x4b')](handleError(_0x300a80,null));};exports[_0x9b89('0x7d')]=function(_0x23ab66,_0x5b1563,_0x1e76f1){var _0x328db1,_0x18adcc;return db['Campaign'][_0x9b89('0x4e')]({'where':{'id':_0x23ab66[_0x9b89('0x44')]['id']}})[_0x9b89('0x20')](handleEntityNotFound(_0x5b1563,null))[_0x9b89('0x20')](function(_0x2be13f){if(_0x2be13f){_0x18adcc=_0x2be13f;return _0x2be13f['addBlackLists'](_0x23ab66[_0x9b89('0x46')][_0x9b89('0x61')],_[_0x9b89('0x4f')](_0x23ab66[_0x9b89('0x46')],[_0x9b89('0x61'),'id'])||{});}return null;})[_0x9b89('0x7e')](function(_0x3b6c7c){var _0x507875;_0x328db1=_0x3b6c7c||[];var _0x8ed75a=[];if(_0x3b6c7c){for(var _0x208662=0x0;_0x208662<_0x3b6c7c[_0x9b89('0x31')];_0x208662+=0x1){var _0x3a492f=_0x3b6c7c[_0x208662][_0x9b89('0x22')]({'plain':!![]});_0x507875=squel['insert']()[_0x9b89('0x79')](_0x9b89('0x7f'))[_0x9b89('0x65')]([_0x9b89('0x66'),_0x9b89('0x68'),'ListId',_0x9b89('0x56'),_0x9b89('0x50'),_0x9b89('0x51')],squel[_0x9b89('0x74')]()['field'](_0x9b89('0x66'),_0x9b89('0x66'))[_0x9b89('0x6a')]('id',_0x9b89('0x68'))[_0x9b89('0x6a')](_0x3a492f[_0x9b89('0x6c')][_0x9b89('0x6d')](),_0x9b89('0x69'))[_0x9b89('0x6a')](_0x23ab66[_0x9b89('0x44')]['id'][_0x9b89('0x6d')](),'CampaignId')['field']('NOW()','createdAt')[_0x9b89('0x6a')](_0x9b89('0x6b'),_0x9b89('0x51'))[_0x9b89('0x6e')](_0x9b89('0x6f'))[_0x9b89('0x3a')](_0x9b89('0x70'))[_0x9b89('0x3a')](_0x9b89('0x71'),_0x3a492f[_0x9b89('0x6c')][_0x9b89('0x6d')]())[_0x9b89('0x3a')](_0x9b89('0x72')))[_0x9b89('0x6d')]();_0x8ed75a[_0x9b89('0x7a')](db[_0x9b89('0x80')][_0x9b89('0x2d')](_0x507875));}return BPromise[_0x9b89('0x81')](_0x8ed75a);}})['then'](function(){return _0x328db1;})[_0x9b89('0x20')](respondWithResult(_0x5b1563,null))[_0x9b89('0x4b')](handleError(_0x5b1563,null));};exports['removeBlackLists']=function(_0x47d5a1,_0x24ffd5,_0x1b8147){var _0x1c69ab;return db['Campaign'][_0x9b89('0x4e')]({'where':{'id':_0x47d5a1[_0x9b89('0x44')]['id']}})[_0x9b89('0x20')](handleEntityNotFound(_0x24ffd5,null))[_0x9b89('0x20')](function(_0x156c24){if(_0x156c24){return _0x156c24[_0x9b89('0x82')](_0x47d5a1[_0x9b89('0x2d')][_0x9b89('0x61')]);}})[_0x9b89('0x20')](function(_0x3f9c7c){if(_0x3f9c7c){_0x1c69ab=_0x3f9c7c;return db[_0x9b89('0x5e')][_0x9b89('0x21')]({'where':{'ListId':_0x47d5a1[_0x9b89('0x2d')]['ids'],'CampaignId':_0x47d5a1[_0x9b89('0x44')]['id']}})[_0x9b89('0x20')](function(){return _0x1c69ab;});}})[_0x9b89('0x20')](respondWithStatusCode(_0x24ffd5,null))[_0x9b89('0x4b')](handleError(_0x24ffd5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 2ca8fb3..d195e7a 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 _0x6d9d=['api','moment','bluebird','request-promise','./campaign.attributes','define','Campaign','campaigns','lodash','util','../../config/logger'];(function(_0x511eb1,_0x1c02b9){var _0x2f879d=function(_0x1ec7e6){while(--_0x1ec7e6){_0x511eb1['push'](_0x511eb1['shift']());}};_0x2f879d(++_0x1c02b9);}(_0x6d9d,0x126));var _0xd6d9=function(_0x1ec3e8,_0x2e99b8){_0x1ec3e8=_0x1ec3e8-0x0;var _0x15651f=_0x6d9d[_0x1ec3e8];return _0x15651f;};'use strict';var _=require(_0xd6d9('0x0'));var util=require(_0xd6d9('0x1'));var logger=require(_0xd6d9('0x2'))(_0xd6d9('0x3'));var moment=require(_0xd6d9('0x4'));var BPromise=require(_0xd6d9('0x5'));var rp=require(_0xd6d9('0x6'));var attributes=require(_0xd6d9('0x7'));module['exports']=function(_0x595257,_0x5ca1a1){return _0x595257[_0xd6d9('0x8')](_0xd6d9('0x9'),attributes,{'tableName':_0xd6d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf30d=['moment','bluebird','./campaign.attributes','exports','define','Campaign','lodash','util'];(function(_0x2104ad,_0x489c40){var _0x17b079=function(_0x58a79b){while(--_0x58a79b){_0x2104ad['push'](_0x2104ad['shift']());}};_0x17b079(++_0x489c40);}(_0xf30d,0xd6));var _0xdf30=function(_0x49ffa6,_0x9ba27){_0x49ffa6=_0x49ffa6-0x0;var _0x2ecf90=_0xf30d[_0x49ffa6];return _0x2ecf90;};'use strict';var _=require(_0xdf30('0x0'));var util=require(_0xdf30('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdf30('0x2'));var BPromise=require(_0xdf30('0x3'));var rp=require('request-promise');var attributes=require(_0xdf30('0x4'));module[_0xdf30('0x5')]=function(_0x521b17,_0x3f9e8c){return _0x521b17[_0xdf30('0x6')](_0xdf30('0x7'),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 f21e9e7..d10afed 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 _0xc464=['message','Campaign,\x20%s,\x20%s','catch','Campaign','options','raw','where','attributes','limit','include','map','model','GetCampaign','lodash','util','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xc464,0x143));var _0x4c46=function(_0x4146ec,_0x4971bd){_0x4146ec=_0x4146ec-0x0;var _0x26dce4=_0xc464[_0x4146ec];return _0x26dce4;};'use strict';var _=require(_0x4c46('0x0'));var util=require(_0x4c46('0x1'));var moment=require('moment');var BPromise=require(_0x4c46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4c46('0x3'));var logger=require(_0x4c46('0x4'))('rpc');var config=require(_0x4c46('0x5'));var jayson=require(_0x4c46('0x6'));var client=jayson[_0x4c46('0x7')][_0x4c46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f7fef,_0x35b84f,_0x928f85){return new BPromise(function(_0x1811ed,_0x371d59){return client[_0x4c46('0x9')](_0x4f7fef,_0x928f85)[_0x4c46('0xa')](function(_0x5d58d2){logger[_0x4c46('0xb')]('Campaign,\x20%s,\x20%s',_0x35b84f,_0x4c46('0xc'));logger[_0x4c46('0xd')](_0x4c46('0xe'),_0x35b84f,_0x4c46('0xc'),JSON[_0x4c46('0xf')](_0x5d58d2));if(_0x5d58d2[_0x4c46('0x10')]){if(_0x5d58d2[_0x4c46('0x10')][_0x4c46('0x11')]===0x1f4){logger['error']('Campaign,\x20%s,\x20%s',_0x35b84f,_0x5d58d2['error'][_0x4c46('0x12')]);return _0x371d59(_0x5d58d2[_0x4c46('0x10')][_0x4c46('0x12')]);}logger[_0x4c46('0x10')](_0x4c46('0x13'),_0x35b84f,_0x5d58d2[_0x4c46('0x10')][_0x4c46('0x12')]);return _0x1811ed(_0x5d58d2[_0x4c46('0x10')][_0x4c46('0x12')]);}else{logger[_0x4c46('0xb')]('Campaign,\x20%s,\x20%s',_0x35b84f,'request\x20sent');_0x1811ed(_0x5d58d2['result']['message']);}})[_0x4c46('0x14')](function(_0x4028b1){logger[_0x4c46('0x10')](_0x4c46('0x13'),_0x35b84f,_0x4028b1);_0x371d59(_0x4028b1);});});}exports['GetCampaign']=function(_0x4c15aa){var _0x30d0f1=this;return new Promise(function(_0x295d88,_0x1e397c){return db[_0x4c46('0x15')]['findAll']({'raw':_0x4c15aa[_0x4c46('0x16')]?_0x4c15aa[_0x4c46('0x16')][_0x4c46('0x17')]===undefined?!![]:![]:!![],'where':_0x4c15aa[_0x4c46('0x16')]?_0x4c15aa[_0x4c46('0x16')][_0x4c46('0x18')]||null:null,'attributes':_0x4c15aa['options']?_0x4c15aa[_0x4c46('0x16')][_0x4c46('0x19')]||null:null,'limit':_0x4c15aa[_0x4c46('0x16')]?_0x4c15aa[_0x4c46('0x16')][_0x4c46('0x1a')]||null:null,'include':_0x4c15aa[_0x4c46('0x16')]?_0x4c15aa['options'][_0x4c46('0x1b')]?_[_0x4c46('0x1c')](_0x4c15aa[_0x4c46('0x16')][_0x4c46('0x1b')],function(_0x39a06d){return{'model':db[_0x39a06d[_0x4c46('0x1d')]],'as':_0x39a06d['as'],'attributes':_0x39a06d[_0x4c46('0x19')],'include':_0x39a06d[_0x4c46('0x1b')]?_[_0x4c46('0x1c')](_0x39a06d[_0x4c46('0x1b')],function(_0x12607d){return{'model':db[_0x12607d[_0x4c46('0x1d')]],'as':_0x12607d['as'],'attributes':_0x12607d[_0x4c46('0x19')],'include':_0x12607d['include']?_[_0x4c46('0x1c')](_0x12607d[_0x4c46('0x1b')],function(_0x2e6db2){return{'model':db[_0x2e6db2[_0x4c46('0x1d')]],'as':_0x2e6db2['as'],'attributes':_0x2e6db2[_0x4c46('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4c46('0xa')](function(_0xf3693d){logger[_0x4c46('0xb')]('GetCampaign',_0x4c15aa);logger[_0x4c46('0xd')](_0x4c46('0x1e'),_0x4c15aa,JSON[_0x4c46('0xf')](_0xf3693d));_0x295d88(_0xf3693d);})['catch'](function(_0x1c50de){logger['error'](_0x4c46('0x1e'),_0x1c50de[_0x4c46('0x12')],_0x4c15aa);_0x1e397c(_0x30d0f1[_0x4c46('0x10')](0x1f4,_0x1c50de[_0x4c46('0x12')]));});});}; \ No newline at end of file +var _0xf8be=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','lodash','util','moment','bluebird'];(function(_0x4361b0,_0x242cda){var _0x2cd624=function(_0x10bb1a){while(--_0x10bb1a){_0x4361b0['push'](_0x4361b0['shift']());}};_0x2cd624(++_0x242cda);}(_0xf8be,0x146));var _0xef8b=function(_0x401b7e,_0x11c4d3){_0x401b7e=_0x401b7e-0x0;var _0x9ad042=_0xf8be[_0x401b7e];return _0x9ad042;};'use strict';var _=require(_0xef8b('0x0'));var util=require(_0xef8b('0x1'));var moment=require(_0xef8b('0x2'));var BPromise=require(_0xef8b('0x3'));var rs=require(_0xef8b('0x4'));var fs=require('fs');var Redis=require(_0xef8b('0x5'));var db=require(_0xef8b('0x6'))['db'];var utils=require(_0xef8b('0x7'));var logger=require(_0xef8b('0x8'))(_0xef8b('0x9'));var config=require('../../config/environment');var jayson=require(_0xef8b('0xa'));var client=jayson['client'][_0xef8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3924c1,_0x537df9,_0x1ea0e8){return new BPromise(function(_0x195ad3,_0x1f85b9){return client[_0xef8b('0xc')](_0x3924c1,_0x1ea0e8)[_0xef8b('0xd')](function(_0xe049a8){logger[_0xef8b('0xe')](_0xef8b('0xf'),_0x537df9,_0xef8b('0x10'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x537df9,_0xef8b('0x10'),JSON[_0xef8b('0x11')](_0xe049a8));if(_0xe049a8['error']){if(_0xe049a8['error'][_0xef8b('0x12')]===0x1f4){logger[_0xef8b('0x13')]('Campaign,\x20%s,\x20%s',_0x537df9,_0xe049a8['error']['message']);return _0x1f85b9(_0xe049a8['error'][_0xef8b('0x14')]);}logger[_0xef8b('0x13')](_0xef8b('0xf'),_0x537df9,_0xe049a8['error'][_0xef8b('0x14')]);return _0x195ad3(_0xe049a8['error']['message']);}else{logger[_0xef8b('0xe')]('Campaign,\x20%s,\x20%s',_0x537df9,_0xef8b('0x10'));_0x195ad3(_0xe049a8['result'][_0xef8b('0x14')]);}})[_0xef8b('0x15')](function(_0x16728f){logger[_0xef8b('0x13')](_0xef8b('0xf'),_0x537df9,_0x16728f);_0x1f85b9(_0x16728f);});});}exports['GetCampaign']=function(_0xf421ce){var _0x4b1b78=this;return new Promise(function(_0x3ebdc2,_0x9040c9){return db[_0xef8b('0x16')][_0xef8b('0x17')]({'raw':_0xf421ce[_0xef8b('0x18')]?_0xf421ce[_0xef8b('0x18')][_0xef8b('0x19')]===undefined?!![]:![]:!![],'where':_0xf421ce['options']?_0xf421ce[_0xef8b('0x18')][_0xef8b('0x1a')]||null:null,'attributes':_0xf421ce[_0xef8b('0x18')]?_0xf421ce[_0xef8b('0x18')][_0xef8b('0x1b')]||null:null,'limit':_0xf421ce[_0xef8b('0x18')]?_0xf421ce['options'][_0xef8b('0x1c')]||null:null,'include':_0xf421ce[_0xef8b('0x18')]?_0xf421ce[_0xef8b('0x18')][_0xef8b('0x1d')]?_[_0xef8b('0x1e')](_0xf421ce[_0xef8b('0x18')][_0xef8b('0x1d')],function(_0x418989){return{'model':db[_0x418989[_0xef8b('0x1f')]],'as':_0x418989['as'],'attributes':_0x418989['attributes'],'include':_0x418989[_0xef8b('0x1d')]?_[_0xef8b('0x1e')](_0x418989[_0xef8b('0x1d')],function(_0x353766){return{'model':db[_0x353766['model']],'as':_0x353766['as'],'attributes':_0x353766['attributes'],'include':_0x353766[_0xef8b('0x1d')]?_[_0xef8b('0x1e')](_0x353766[_0xef8b('0x1d')],function(_0x353ea1){return{'model':db[_0x353ea1['model']],'as':_0x353ea1['as'],'attributes':_0x353ea1[_0xef8b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xef8b('0xd')](function(_0x18459b){logger[_0xef8b('0xe')](_0xef8b('0x20'),_0xf421ce);logger['debug']('GetCampaign',_0xf421ce,JSON[_0xef8b('0x11')](_0x18459b));_0x3ebdc2(_0x18459b);})['catch'](function(_0x240a02){logger[_0xef8b('0x13')](_0xef8b('0x20'),_0x240a02[_0xef8b('0x14')],_0xf421ce);_0x9040c9(_0x4b1b78[_0xef8b('0x13')](0x1f4,_0x240a02[_0xef8b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e9a0c70..0417d97 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 _0xdd93=['create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','update','destroy','delete','removeBlackLists','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xdd93,0x18c));var _0x3dd9=function(_0x3ff063,_0x25c86f){_0x3ff063=_0x3ff063-0x0;var _0x42644f=_0xdd93[_0x3ff063];return _0x42644f;};'use strict';var multer=require('multer');var util=require(_0x3dd9('0x0'));var path=require(_0x3dd9('0x1'));var timeout=require(_0x3dd9('0x2'));var express=require(_0x3dd9('0x3'));var router=express[_0x3dd9('0x4')]();var auth=require(_0x3dd9('0x5'));var interaction=require(_0x3dd9('0x6'));var config=require('../../config/environment');var controller=require(_0x3dd9('0x7'));router[_0x3dd9('0x8')]('/',auth[_0x3dd9('0x9')](),controller[_0x3dd9('0xa')]);router[_0x3dd9('0x8')](_0x3dd9('0xb'),auth[_0x3dd9('0x9')](),controller[_0x3dd9('0xc')]);router[_0x3dd9('0x8')](_0x3dd9('0xd'),auth[_0x3dd9('0x9')](),controller[_0x3dd9('0xe')]);router[_0x3dd9('0x8')](_0x3dd9('0xf'),auth['isAuthenticated'](),controller[_0x3dd9('0x10')]);router[_0x3dd9('0x8')](_0x3dd9('0x11'),auth[_0x3dd9('0x9')](),controller['getHopperFinals']);router[_0x3dd9('0x8')](_0x3dd9('0x12'),auth[_0x3dd9('0x9')](),controller[_0x3dd9('0x13')]);router[_0x3dd9('0x8')]('/:id/lists',auth[_0x3dd9('0x9')](),controller[_0x3dd9('0x14')]);router[_0x3dd9('0x8')](_0x3dd9('0x15'),auth[_0x3dd9('0x9')](),controller[_0x3dd9('0x16')]);router[_0x3dd9('0x17')]('/',auth[_0x3dd9('0x9')](),controller[_0x3dd9('0x18')]);router[_0x3dd9('0x17')](_0x3dd9('0x19'),auth['isAuthenticated'](),controller[_0x3dd9('0x1a')]);router[_0x3dd9('0x17')](_0x3dd9('0x1b'),auth[_0x3dd9('0x9')](),controller[_0x3dd9('0x1c')]);router[_0x3dd9('0x17')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x3dd9('0x1d')]);router[_0x3dd9('0x1e')](_0x3dd9('0xb'),auth[_0x3dd9('0x9')](),controller[_0x3dd9('0x1f')]);router['delete'](_0x3dd9('0xb'),auth[_0x3dd9('0x9')](),controller[_0x3dd9('0x20')]);router['delete'](_0x3dd9('0x1b'),auth['isAuthenticated'](),controller['removeLists']);router[_0x3dd9('0x21')](_0x3dd9('0x15'),auth[_0x3dd9('0x9')](),controller[_0x3dd9('0x22')]);module['exports']=router; \ No newline at end of file +var _0xadd7=['removeLists','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','/:id/hoppers','isAuthenticated','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','clone','addLists','addBlackLists','put','update','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xadd7,0x1d0));var _0x7add=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xadd7[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x7add('0x0'));var util=require(_0x7add('0x1'));var path=require(_0x7add('0x2'));var timeout=require('connect-timeout');var express=require(_0x7add('0x3'));var router=express['Router']();var auth=require(_0x7add('0x4'));var interaction=require(_0x7add('0x5'));var config=require(_0x7add('0x6'));var controller=require(_0x7add('0x7'));router[_0x7add('0x8')]('/',auth['isAuthenticated'](),controller[_0x7add('0x9')]);router[_0x7add('0x8')](_0x7add('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7add('0x8')](_0x7add('0xb'),auth[_0x7add('0xc')](),controller[_0x7add('0xd')]);router[_0x7add('0x8')]('/:id/hopper_histories',auth[_0x7add('0xc')](),controller[_0x7add('0xe')]);router[_0x7add('0x8')](_0x7add('0xf'),auth['isAuthenticated'](),controller[_0x7add('0x10')]);router[_0x7add('0x8')](_0x7add('0x11'),auth[_0x7add('0xc')](),controller[_0x7add('0x12')]);router[_0x7add('0x8')](_0x7add('0x13'),auth['isAuthenticated'](),controller[_0x7add('0x14')]);router['get'](_0x7add('0x15'),auth[_0x7add('0xc')](),controller[_0x7add('0x16')]);router[_0x7add('0x17')]('/',auth[_0x7add('0xc')](),controller['create']);router['post']('/:id/clone',auth[_0x7add('0xc')](),controller[_0x7add('0x18')]);router[_0x7add('0x17')](_0x7add('0x13'),auth[_0x7add('0xc')](),controller[_0x7add('0x19')]);router['post'](_0x7add('0x15'),auth[_0x7add('0xc')](),controller[_0x7add('0x1a')]);router[_0x7add('0x1b')]('/:id',auth[_0x7add('0xc')](),controller[_0x7add('0x1c')]);router[_0x7add('0x1d')](_0x7add('0xa'),auth['isAuthenticated'](),controller[_0x7add('0x1e')]);router[_0x7add('0x1d')]('/:id/lists',auth[_0x7add('0xc')](),controller[_0x7add('0x1f')]);router[_0x7add('0x1d')](_0x7add('0x15'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x7add('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index b908a42..5c5d1a0 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 _0x2de5=['STRING','TEXT','getDataValue','key','exports'];(function(_0x206084,_0x327273){var _0x1b00cb=function(_0x184e9f){while(--_0x184e9f){_0x206084['push'](_0x206084['shift']());}};_0x1b00cb(++_0x327273);}(_0x2de5,0x14e));var _0x52de=function(_0x4d2263,_0x3fbf0d){_0x4d2263=_0x4d2263-0x0;var _0x24aba0=_0x2de5[_0x4d2263];return _0x24aba0;};'use strict';var Sequelize=require('sequelize');module[_0x52de('0x0')]={'key':{'type':Sequelize[_0x52de('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x52de('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x52de('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x52de('0x3')](_0x52de('0x4'));}}}; \ No newline at end of file +var _0x7bf1=['TEXT','getDataValue','key','sequelize','STRING'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0x7bf1,0x12f));var _0x17bf=function(_0x13a78b,_0x171395){_0x13a78b=_0x13a78b-0x0;var _0x3de69d=_0x7bf1[_0x13a78b];return _0x3de69d;};'use strict';var Sequelize=require(_0x17bf('0x0'));module['exports']={'key':{'type':Sequelize[_0x17bf('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x17bf('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x17bf('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x17bf('0x3')](_0x17bf('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 26bfbc1..3a08634 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 _0x9127=['OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','json','reject','save','update','destroy','then','get','CannedAnswers','UserProfileResource','end','stack','name','send','index','CannedAnswer','rawAttributes','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','length','find','body','create','MailAccountId','SmsAccountId'];(function(_0x2732c3,_0x328de0){var _0x14d9f0=function(_0xb13833){while(--_0xb13833){_0x2732c3['push'](_0x2732c3['shift']());}};_0x14d9f0(++_0x328de0);}(_0x9127,0x111));var _0x7912=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x9127[_0x26da89];return _0xc95b7b;};'use strict';var pdf=require(_0x7912('0x0'));var emlformat=require(_0x7912('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7912('0x2'));var jsonpatch=require(_0x7912('0x3'));var rp=require(_0x7912('0x4'));var moment=require(_0x7912('0x5'));var BPromise=require(_0x7912('0x6'));var Mustache=require(_0x7912('0x7'));var util=require(_0x7912('0x8'));var path=require(_0x7912('0x9'));var sox=require(_0x7912('0xa'));var csv=require(_0x7912('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7912('0xc'));var squel=require(_0x7912('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7912('0xe'));var toCsv=require(_0x7912('0xb'));var querystring=require(_0x7912('0xf'));var Papa=require(_0x7912('0x10'));var authService=require(_0x7912('0x11'));var hardwareService=require(_0x7912('0x12'));var Redis=require(_0x7912('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7912('0x14'));var utils=require(_0x7912('0x15'));var config=require('../../config/environment');var db=require(_0x7912('0x16'))['db'];function respondWithStatusCode(_0x1b2368,_0x5ec97c){_0x5ec97c=_0x5ec97c||0xcc;return function(_0xea5294){if(_0xea5294){return _0x1b2368[_0x7912('0x17')](_0x5ec97c);}return _0x1b2368[_0x7912('0x18')](_0x5ec97c)['end']();};}function respondWithResult(_0x307aa2,_0x19ceef){_0x19ceef=_0x19ceef||0xc8;return function(_0x197faf){if(_0x197faf){return _0x307aa2[_0x7912('0x18')](_0x19ceef)['json'](_0x197faf);}};}function respondWithFilteredResult(_0xceba47,_0x217570){return function(_0x2fb0d8){if(_0x2fb0d8){var _0x180d4d=_0x2fb0d8[_0x7912('0x19')],_0x9e96a6=_0x217570[_0x7912('0x1a')],_0x4a6b6b=_0x217570['offset']+_0x217570[_0x7912('0x1b')],_0x1df865;if(_0x4a6b6b>=_0x180d4d){_0x4a6b6b=_0x180d4d;_0x1df865=0xc8;}else{_0x1df865=0xce;}_0xceba47[_0x7912('0x18')](_0x1df865);return _0xceba47[_0x7912('0x1c')]('Content-Range',_0x9e96a6+'-'+_0x4a6b6b+'/'+_0x180d4d)[_0x7912('0x1d')](_0x2fb0d8);}return null;};}function patchUpdates(_0x4df0b3){return function(_0x57f17a){try{jsonpatch['apply'](_0x57f17a,_0x4df0b3,!![]);}catch(_0x34c19c){return BPromise[_0x7912('0x1e')](_0x34c19c);}return _0x57f17a[_0x7912('0x1f')]();};}function saveUpdates(_0x57a407,_0x655a9){return function(_0x2460fb){if(_0x2460fb){return _0x2460fb[_0x7912('0x20')](_0x57a407)['then'](function(_0x3edb69){return _0x3edb69;});}return null;};}function removeEntity(_0x27e0bb,_0x585f21){return function(_0x4f278c){if(_0x4f278c){return _0x4f278c[_0x7912('0x21')]()[_0x7912('0x22')](function(){var _0x284dc1=_0x4f278c[_0x7912('0x23')]({'plain':!![]});var _0x9587c4=_0x7912('0x24');return db[_0x7912('0x25')][_0x7912('0x21')]({'where':{'type':_0x9587c4,'resourceId':_0x284dc1['id']}})['then'](function(){return _0x4f278c;});})[_0x7912('0x22')](function(){_0x27e0bb[_0x7912('0x18')](0xcc)[_0x7912('0x26')]();});}};}function handleEntityNotFound(_0x578b56,_0x3a4355){return function(_0x13c568){if(!_0x13c568){_0x578b56[_0x7912('0x17')](0x194);}return _0x13c568;};}function handleError(_0x35027b,_0x76185a){_0x76185a=_0x76185a||0x1f4;return function(_0x2f117c){logger['error'](_0x2f117c[_0x7912('0x27')]);if(_0x2f117c[_0x7912('0x28')]){delete _0x2f117c[_0x7912('0x28')];}_0x35027b[_0x7912('0x18')](_0x76185a)[_0x7912('0x29')](_0x2f117c);};}exports[_0x7912('0x2a')]=function(_0x2863dc,_0x233d18){var _0x43a093={},_0x363bf9={},_0x168265={'count':0x0,'rows':[]};var _0x3ac439=db[_0x7912('0x2b')][_0x7912('0x2c')];_0x363bf9[_0x7912('0x2d')]=_[_0x7912('0x2e')](_0x3ac439);_0x363bf9[_0x7912('0x2f')]=_[_0x7912('0x2e')](_0x2863dc[_0x7912('0x2f')]);_0x363bf9['filters']=_[_0x7912('0x30')](_0x363bf9['model'],_0x363bf9[_0x7912('0x2f')]);_0x43a093['attributes']=_[_0x7912('0x30')](_0x363bf9[_0x7912('0x2d')],qs[_0x7912('0x31')](_0x2863dc[_0x7912('0x2f')]['fields']));_0x43a093[_0x7912('0x32')]=_0x43a093['attributes']['length']?_0x43a093[_0x7912('0x32')]:_0x363bf9[_0x7912('0x2d')];if(!_0x2863dc[_0x7912('0x2f')][_0x7912('0x33')](_0x7912('0x34'))){_0x43a093[_0x7912('0x1b')]=qs[_0x7912('0x1b')](_0x2863dc[_0x7912('0x2f')]['limit']);_0x43a093[_0x7912('0x1a')]=qs[_0x7912('0x1a')](_0x2863dc[_0x7912('0x2f')][_0x7912('0x1a')]);}_0x43a093[_0x7912('0x35')]=qs[_0x7912('0x36')](_0x2863dc[_0x7912('0x2f')]['sort']);_0x43a093[_0x7912('0x37')]=qs[_0x7912('0x38')](_['pick'](_0x2863dc['query'],_0x363bf9[_0x7912('0x38')]));if(_0x2863dc[_0x7912('0x2f')][_0x7912('0x39')]){_0x43a093[_0x7912('0x37')]=_[_0x7912('0x3a')](_0x43a093[_0x7912('0x37')],{'$or':_['map'](_0x3ac439,function(_0x268eb9){if(_0x268eb9['type'][_0x7912('0x3b')]!==_0x7912('0x3c')){var _0xe3705d={};_0xe3705d[_0x268eb9[_0x7912('0x3d')]]={'$like':'%'+_0x2863dc[_0x7912('0x2f')][_0x7912('0x39')]+'%'};return _0xe3705d;}})});}_0x43a093=_[_0x7912('0x3a')]({},_0x43a093,_0x2863dc[_0x7912('0x3e')]);var _0x88cd12={'where':_0x43a093[_0x7912('0x37')]};return db[_0x7912('0x2b')][_0x7912('0x19')](_0x88cd12)['then'](function(_0x160c23){_0x168265['count']=_0x160c23;if(_0x2863dc['query'][_0x7912('0x3f')]){_0x43a093[_0x7912('0x40')]=[{'all':!![]}];}return db[_0x7912('0x2b')][_0x7912('0x41')](_0x43a093);})[_0x7912('0x22')](function(_0x59306f){_0x168265[_0x7912('0x42')]=_0x59306f;return _0x168265;})[_0x7912('0x22')](respondWithFilteredResult(_0x233d18,_0x43a093))[_0x7912('0x43')](handleError(_0x233d18,null));};exports[_0x7912('0x44')]=function(_0x1a1c8b,_0x4e6916){var _0x1aba74={'raw':!![],'where':{'id':_0x1a1c8b['params']['id']}},_0x2c931d={};_0x2c931d[_0x7912('0x2d')]=_[_0x7912('0x2e')](db[_0x7912('0x2b')][_0x7912('0x2c')]);_0x2c931d['query']=_[_0x7912('0x2e')](_0x1a1c8b['query']);_0x2c931d[_0x7912('0x38')]=_[_0x7912('0x30')](_0x2c931d['model'],_0x2c931d[_0x7912('0x2f')]);_0x1aba74[_0x7912('0x32')]=_[_0x7912('0x30')](_0x2c931d[_0x7912('0x2d')],qs[_0x7912('0x31')](_0x1a1c8b[_0x7912('0x2f')][_0x7912('0x31')]));_0x1aba74['attributes']=_0x1aba74['attributes'][_0x7912('0x45')]?_0x1aba74['attributes']:_0x2c931d['model'];if(_0x1a1c8b[_0x7912('0x2f')]['includeAll']){_0x1aba74['include']=[{'all':!![]}];}_0x1aba74=_[_0x7912('0x3a')]({},_0x1aba74,_0x1a1c8b[_0x7912('0x3e')]);return db[_0x7912('0x2b')][_0x7912('0x46')](_0x1aba74)[_0x7912('0x22')](handleEntityNotFound(_0x4e6916,null))[_0x7912('0x22')](respondWithResult(_0x4e6916,null))[_0x7912('0x43')](handleError(_0x4e6916,null));};exports[_0x7912('0x20')]=function(_0x1d22ce,_0x599eb7){if(_0x1d22ce[_0x7912('0x47')]['id']){delete _0x1d22ce['body']['id'];}return db[_0x7912('0x2b')][_0x7912('0x46')]({'where':{'id':_0x1d22ce['params']['id']}})[_0x7912('0x22')](handleEntityNotFound(_0x599eb7,null))[_0x7912('0x22')](saveUpdates(_0x1d22ce[_0x7912('0x47')],null))['then'](respondWithResult(_0x599eb7,null))[_0x7912('0x43')](handleError(_0x599eb7,null));};exports['destroy']=function(_0x3d9ac9,_0x20458a){return db[_0x7912('0x2b')][_0x7912('0x46')]({'where':{'id':_0x3d9ac9['params']['id']}})['then'](handleEntityNotFound(_0x20458a,null))['then'](removeEntity(_0x20458a,null))[_0x7912('0x43')](handleError(_0x20458a,null));};exports[_0x7912('0x48')]=function(_0x24300f,_0x4d57bd){var _0x50befc={'key':_0x24300f[_0x7912('0x47')]['key']};if(_0x24300f[_0x7912('0x47')][_0x7912('0x49')]){_0x50befc['MailAccountId']=_0x24300f[_0x7912('0x47')]['MailAccountId'];}else if(_0x24300f['body'][_0x7912('0x4a')]){_0x50befc[_0x7912('0x4a')]=_0x24300f['body']['SmsAccountId'];}else if(_0x24300f[_0x7912('0x47')]['OpenchannelAccountId']){_0x50befc[_0x7912('0x4b')]=_0x24300f[_0x7912('0x47')][_0x7912('0x4b')];}else if(_0x24300f[_0x7912('0x47')][_0x7912('0x4c')]){_0x50befc[_0x7912('0x4c')]=_0x24300f['body'][_0x7912('0x4c')];}return db['CannedAnswer']['find']({'where':_0x50befc})[_0x7912('0x22')](function(_0x4831ee){if(_0x4831ee){throw new db[(_0x7912('0x4d'))][(_0x7912('0x4e'))](_0x7912('0x4f'));}return db[_0x7912('0x2b')][_0x7912('0x48')](_0x24300f['body']);})[_0x7912('0x22')](function(_0x35a88b){var _0x5ce5c4=_0x24300f[_0x7912('0x50')]['get']({'plain':!![]});if(!_0x5ce5c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ce5c4[_0x7912('0x51')]===_0x7912('0x50')){var _0x2ee3fc=_0x35a88b[_0x7912('0x23')]({'plain':!![]});return db[_0x7912('0x52')][_0x7912('0x46')]({'where':{'name':_0x7912('0x24'),'userProfileId':_0x5ce5c4[_0x7912('0x53')]},'raw':!![]})[_0x7912('0x22')](function(_0x52155b){if(_0x52155b&&_0x52155b[_0x7912('0x54')]===0x0){return db['UserProfileResource'][_0x7912('0x48')]({'name':_0x2ee3fc[_0x7912('0x28')],'resourceId':_0x2ee3fc['id'],'type':_0x52155b[_0x7912('0x28')],'sectionId':_0x52155b['id']},{})['then'](function(){return _0x35a88b;});}else{return _0x35a88b;}})['catch'](function(_0x133c54){logger[_0x7912('0x55')](_0x7912('0x56'),_0x133c54);throw _0x133c54;});}return _0x35a88b;})[_0x7912('0x22')](respondWithResult(_0x4d57bd,0xc9))[_0x7912('0x43')](handleError(_0x4d57bd,null));}; \ No newline at end of file +var _0x3df2=['The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','CannedAnswer','count','includeAll','include','rows','catch','params','length','options','update','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId'];(function(_0x3ea49f,_0x42d1ad){var _0x41fedb=function(_0x22f831){while(--_0x22f831){_0x3ea49f['push'](_0x3ea49f['shift']());}};_0x41fedb(++_0x42d1ad);}(_0x3df2,0x1af));var _0x23df=function(_0x1197a2,_0x45ac1c){_0x1197a2=_0x1197a2-0x0;var _0x1e76b6=_0x3df2[_0x1197a2];return _0x1e76b6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x23df('0x0'));var rimraf=require(_0x23df('0x1'));var zipdir=require(_0x23df('0x2'));var jsonpatch=require(_0x23df('0x3'));var rp=require(_0x23df('0x4'));var moment=require(_0x23df('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x23df('0x6'));var util=require(_0x23df('0x7'));var path=require(_0x23df('0x8'));var sox=require(_0x23df('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x23df('0xa'));var squel=require(_0x23df('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23df('0xc'));var toCsv=require(_0x23df('0xd'));var querystring=require(_0x23df('0xe'));var Papa=require(_0x23df('0xf'));var authService=require(_0x23df('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x23df('0x11'));var qs=require(_0x23df('0x12'));var logger=require(_0x23df('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x23df('0x14'));var db=require(_0x23df('0x15'))['db'];function respondWithStatusCode(_0x5ed5a4,_0x45586e){_0x45586e=_0x45586e||0xcc;return function(_0x168079){if(_0x168079){return _0x5ed5a4['sendStatus'](_0x45586e);}return _0x5ed5a4[_0x23df('0x16')](_0x45586e)[_0x23df('0x17')]();};}function respondWithResult(_0x509c0b,_0x4a47ef){_0x4a47ef=_0x4a47ef||0xc8;return function(_0x35b6f6){if(_0x35b6f6){return _0x509c0b[_0x23df('0x16')](_0x4a47ef)[_0x23df('0x18')](_0x35b6f6);}};}function respondWithFilteredResult(_0x33342e,_0x91f4ca){return function(_0x35b23f){if(_0x35b23f){var _0x4ca4a8=_0x35b23f['count'],_0x7b801a=_0x91f4ca[_0x23df('0x19')],_0x5793c7=_0x91f4ca[_0x23df('0x19')]+_0x91f4ca[_0x23df('0x1a')],_0x5da26e;if(_0x5793c7>=_0x4ca4a8){_0x5793c7=_0x4ca4a8;_0x5da26e=0xc8;}else{_0x5da26e=0xce;}_0x33342e[_0x23df('0x16')](_0x5da26e);return _0x33342e[_0x23df('0x1b')](_0x23df('0x1c'),_0x7b801a+'-'+_0x5793c7+'/'+_0x4ca4a8)[_0x23df('0x18')](_0x35b23f);}return null;};}function patchUpdates(_0x1336c0){return function(_0x18dafc){try{jsonpatch['apply'](_0x18dafc,_0x1336c0,!![]);}catch(_0x3d6643){return BPromise[_0x23df('0x1d')](_0x3d6643);}return _0x18dafc[_0x23df('0x1e')]();};}function saveUpdates(_0x1cbd5b,_0x417600){return function(_0x1c7b59){if(_0x1c7b59){return _0x1c7b59['update'](_0x1cbd5b)[_0x23df('0x1f')](function(_0x988e98){return _0x988e98;});}return null;};}function removeEntity(_0x32d578,_0x5a2682){return function(_0x563c02){if(_0x563c02){return _0x563c02[_0x23df('0x20')]()[_0x23df('0x1f')](function(){var _0x44830a=_0x563c02[_0x23df('0x21')]({'plain':!![]});var _0x48f932=_0x23df('0x22');return db[_0x23df('0x23')][_0x23df('0x20')]({'where':{'type':_0x48f932,'resourceId':_0x44830a['id']}})[_0x23df('0x1f')](function(){return _0x563c02;});})['then'](function(){_0x32d578[_0x23df('0x16')](0xcc)[_0x23df('0x17')]();});}};}function handleEntityNotFound(_0x451afd,_0x86760e){return function(_0x399439){if(!_0x399439){_0x451afd[_0x23df('0x24')](0x194);}return _0x399439;};}function handleError(_0x4d59bc,_0x5207c8){_0x5207c8=_0x5207c8||0x1f4;return function(_0x135cc2){logger[_0x23df('0x25')](_0x135cc2[_0x23df('0x26')]);if(_0x135cc2['name']){delete _0x135cc2[_0x23df('0x27')];}_0x4d59bc[_0x23df('0x16')](_0x5207c8)[_0x23df('0x28')](_0x135cc2);};}exports[_0x23df('0x29')]=function(_0x1ebd5b,_0xc87b69){var _0x478d1a={},_0x2d3a2a={},_0x3e6e00={'count':0x0,'rows':[]};var _0x5f7ef3=db['CannedAnswer'][_0x23df('0x2a')];_0x2d3a2a[_0x23df('0x2b')]=_[_0x23df('0x2c')](_0x5f7ef3);_0x2d3a2a[_0x23df('0x2d')]=_[_0x23df('0x2c')](_0x1ebd5b[_0x23df('0x2d')]);_0x2d3a2a[_0x23df('0x2e')]=_[_0x23df('0x2f')](_0x2d3a2a[_0x23df('0x2b')],_0x2d3a2a[_0x23df('0x2d')]);_0x478d1a['attributes']=_[_0x23df('0x2f')](_0x2d3a2a['model'],qs[_0x23df('0x30')](_0x1ebd5b['query']['fields']));_0x478d1a[_0x23df('0x31')]=_0x478d1a[_0x23df('0x31')]['length']?_0x478d1a[_0x23df('0x31')]:_0x2d3a2a[_0x23df('0x2b')];if(!_0x1ebd5b[_0x23df('0x2d')][_0x23df('0x32')](_0x23df('0x33'))){_0x478d1a[_0x23df('0x1a')]=qs[_0x23df('0x1a')](_0x1ebd5b[_0x23df('0x2d')][_0x23df('0x1a')]);_0x478d1a[_0x23df('0x19')]=qs[_0x23df('0x19')](_0x1ebd5b[_0x23df('0x2d')][_0x23df('0x19')]);}_0x478d1a[_0x23df('0x34')]=qs[_0x23df('0x35')](_0x1ebd5b[_0x23df('0x2d')]['sort']);_0x478d1a[_0x23df('0x36')]=qs[_0x23df('0x2e')](_[_0x23df('0x37')](_0x1ebd5b[_0x23df('0x2d')],_0x2d3a2a[_0x23df('0x2e')]));if(_0x1ebd5b['query'][_0x23df('0x38')]){_0x478d1a['where']=_[_0x23df('0x39')](_0x478d1a[_0x23df('0x36')],{'$or':_[_0x23df('0x3a')](_0x5f7ef3,function(_0x1009e5){if(_0x1009e5['type'][_0x23df('0x3b')]!==_0x23df('0x3c')){var _0x38dea4={};_0x38dea4[_0x1009e5[_0x23df('0x3d')]]={'$like':'%'+_0x1ebd5b[_0x23df('0x2d')][_0x23df('0x38')]+'%'};return _0x38dea4;}})});}_0x478d1a=_[_0x23df('0x39')]({},_0x478d1a,_0x1ebd5b['options']);var _0xf5a7a7={'where':_0x478d1a['where']};return db[_0x23df('0x3e')][_0x23df('0x3f')](_0xf5a7a7)[_0x23df('0x1f')](function(_0x4bbafa){_0x3e6e00[_0x23df('0x3f')]=_0x4bbafa;if(_0x1ebd5b['query'][_0x23df('0x40')]){_0x478d1a[_0x23df('0x41')]=[{'all':!![]}];}return db[_0x23df('0x3e')]['findAll'](_0x478d1a);})[_0x23df('0x1f')](function(_0x2d6702){_0x3e6e00[_0x23df('0x42')]=_0x2d6702;return _0x3e6e00;})[_0x23df('0x1f')](respondWithFilteredResult(_0xc87b69,_0x478d1a))[_0x23df('0x43')](handleError(_0xc87b69,null));};exports['show']=function(_0x35864c,_0x4dae3a){var _0x4d7105={'raw':!![],'where':{'id':_0x35864c[_0x23df('0x44')]['id']}},_0x47dd13={};_0x47dd13[_0x23df('0x2b')]=_[_0x23df('0x2c')](db[_0x23df('0x3e')][_0x23df('0x2a')]);_0x47dd13['query']=_[_0x23df('0x2c')](_0x35864c[_0x23df('0x2d')]);_0x47dd13[_0x23df('0x2e')]=_['intersection'](_0x47dd13['model'],_0x47dd13[_0x23df('0x2d')]);_0x4d7105[_0x23df('0x31')]=_[_0x23df('0x2f')](_0x47dd13[_0x23df('0x2b')],qs[_0x23df('0x30')](_0x35864c[_0x23df('0x2d')]['fields']));_0x4d7105['attributes']=_0x4d7105[_0x23df('0x31')][_0x23df('0x45')]?_0x4d7105[_0x23df('0x31')]:_0x47dd13[_0x23df('0x2b')];if(_0x35864c[_0x23df('0x2d')]['includeAll']){_0x4d7105[_0x23df('0x41')]=[{'all':!![]}];}_0x4d7105=_[_0x23df('0x39')]({},_0x4d7105,_0x35864c[_0x23df('0x46')]);return db[_0x23df('0x3e')]['find'](_0x4d7105)['then'](handleEntityNotFound(_0x4dae3a,null))[_0x23df('0x1f')](respondWithResult(_0x4dae3a,null))[_0x23df('0x43')](handleError(_0x4dae3a,null));};exports[_0x23df('0x47')]=function(_0x1e76f6,_0x2583b3){if(_0x1e76f6[_0x23df('0x48')]['id']){delete _0x1e76f6[_0x23df('0x48')]['id'];}return db[_0x23df('0x3e')][_0x23df('0x49')]({'where':{'id':_0x1e76f6['params']['id']}})['then'](handleEntityNotFound(_0x2583b3,null))[_0x23df('0x1f')](saveUpdates(_0x1e76f6[_0x23df('0x48')],null))['then'](respondWithResult(_0x2583b3,null))['catch'](handleError(_0x2583b3,null));};exports[_0x23df('0x20')]=function(_0x55ca96,_0x14c93a){return db[_0x23df('0x3e')][_0x23df('0x49')]({'where':{'id':_0x55ca96[_0x23df('0x44')]['id']}})[_0x23df('0x1f')](handleEntityNotFound(_0x14c93a,null))[_0x23df('0x1f')](removeEntity(_0x14c93a,null))[_0x23df('0x43')](handleError(_0x14c93a,null));};exports[_0x23df('0x4a')]=function(_0x401dd4,_0x274176){var _0x5a7835={'key':_0x401dd4[_0x23df('0x48')][_0x23df('0x3b')]};if(_0x401dd4[_0x23df('0x48')][_0x23df('0x4b')]){_0x5a7835['MailAccountId']=_0x401dd4[_0x23df('0x48')][_0x23df('0x4b')];}else if(_0x401dd4['body'][_0x23df('0x4c')]){_0x5a7835['SmsAccountId']=_0x401dd4[_0x23df('0x48')][_0x23df('0x4c')];}else if(_0x401dd4['body'][_0x23df('0x4d')]){_0x5a7835[_0x23df('0x4d')]=_0x401dd4['body'][_0x23df('0x4d')];}else if(_0x401dd4[_0x23df('0x48')][_0x23df('0x4e')]){_0x5a7835['ChatWebsiteId']=_0x401dd4[_0x23df('0x48')][_0x23df('0x4e')];}return db[_0x23df('0x3e')][_0x23df('0x49')]({'where':_0x5a7835})[_0x23df('0x1f')](function(_0x515c50){if(_0x515c50){throw new db['Sequelize']['ValidationError'](_0x23df('0x4f'));}return db[_0x23df('0x3e')][_0x23df('0x4a')](_0x401dd4[_0x23df('0x48')]);})['then'](function(_0x15c772){var _0x3e6d68=_0x401dd4[_0x23df('0x50')]['get']({'plain':!![]});if(!_0x3e6d68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e6d68[_0x23df('0x51')]===_0x23df('0x50')){var _0x2c7ed4=_0x15c772[_0x23df('0x21')]({'plain':!![]});return db[_0x23df('0x52')][_0x23df('0x49')]({'where':{'name':_0x23df('0x22'),'userProfileId':_0x3e6d68[_0x23df('0x53')]},'raw':!![]})['then'](function(_0x5197dd){if(_0x5197dd&&_0x5197dd['autoAssociation']===0x0){return db[_0x23df('0x23')]['create']({'name':_0x2c7ed4[_0x23df('0x27')],'resourceId':_0x2c7ed4['id'],'type':_0x5197dd[_0x23df('0x27')],'sectionId':_0x5197dd['id']},{})[_0x23df('0x1f')](function(){return _0x15c772;});}else{return _0x15c772;}})['catch'](function(_0x46e1a9){logger[_0x23df('0x25')](_0x23df('0x54'),_0x46e1a9);throw _0x46e1a9;});}return _0x15c772;})[_0x23df('0x1f')](respondWithResult(_0x274176,0xc9))[_0x23df('0x43')](handleError(_0x274176,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ce5f5a3..045c56e 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 _0x198c=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0xc9c7d3,_0x3cf9ab){var _0x237902=function(_0x160bc0){while(--_0x160bc0){_0xc9c7d3['push'](_0xc9c7d3['shift']());}};_0x237902(++_0x3cf9ab);}(_0x198c,0x1f1));var _0xc198=function(_0x5f144a,_0x2dbd67){_0x5f144a=_0x5f144a-0x0;var _0x1c4e98=_0x198c[_0x5f144a];return _0x1c4e98;};'use strict';var _=require(_0xc198('0x0'));var util=require(_0xc198('0x1'));var logger=require(_0xc198('0x2'))(_0xc198('0x3'));var moment=require('moment');var BPromise=require(_0xc198('0x4'));var rp=require(_0xc198('0x5'));var attributes=require(_0xc198('0x6'));module[_0xc198('0x7')]=function(_0x1f5a80,_0x1cbfb0){return _0x1f5a80[_0xc198('0x8')](_0xc198('0x9'),attributes,{'tableName':_0xc198('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc198('0xb'),'collate':_0xc198('0xc')});}; \ No newline at end of file +var _0x0f5e=['CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','exports','define'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0f5e,0xb4));var _0xe0f5=function(_0x374c78,_0x3ad403){_0x374c78=_0x374c78-0x0;var _0x582efa=_0x0f5e[_0x374c78];return _0x582efa;};'use strict';var _=require('lodash');var util=require(_0xe0f5('0x0'));var logger=require(_0xe0f5('0x1'))(_0xe0f5('0x2'));var moment=require('moment');var BPromise=require(_0xe0f5('0x3'));var rp=require(_0xe0f5('0x4'));var attributes=require('./cannedAnswer.attributes');module[_0xe0f5('0x5')]=function(_0x87e684,_0x2eae73){return _0x87e684[_0xe0f5('0x6')](_0xe0f5('0x7'),attributes,{'tableName':_0xe0f5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe0f5('0x9'),'collate':_0xe0f5('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index c82c46d..f8d0b95 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 _0x3e4e=['request','CannedAnswer,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http'];(function(_0x460789,_0x2cbd28){var _0x19f1b1=function(_0x629ed6){while(--_0x629ed6){_0x460789['push'](_0x460789['shift']());}};_0x19f1b1(++_0x2cbd28);}(_0x3e4e,0xb4));var _0xe3e4=function(_0x57a68f,_0x5da321){_0x57a68f=_0x57a68f-0x0;var _0x510ed1=_0x3e4e[_0x57a68f];return _0x510ed1;};'use strict';var _=require(_0xe3e4('0x0'));var util=require(_0xe3e4('0x1'));var moment=require('moment');var BPromise=require(_0xe3e4('0x2'));var rs=require(_0xe3e4('0x3'));var fs=require('fs');var Redis=require(_0xe3e4('0x4'));var db=require(_0xe3e4('0x5'))['db'];var utils=require(_0xe3e4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe3e4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe3e4('0x8')][_0xe3e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x495a4f,_0x4f8987,_0x1241d3){return new BPromise(function(_0x95f6eb,_0x5547f2){return client[_0xe3e4('0xa')](_0x495a4f,_0x1241d3)['then'](function(_0x135f07){logger['info'](_0xe3e4('0xb'),_0x4f8987,'request\x20sent');logger[_0xe3e4('0xc')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x4f8987,_0xe3e4('0xd'),JSON['stringify'](_0x135f07));if(_0x135f07[_0xe3e4('0xe')]){if(_0x135f07[_0xe3e4('0xe')]['code']===0x1f4){logger['error'](_0xe3e4('0xb'),_0x4f8987,_0x135f07[_0xe3e4('0xe')][_0xe3e4('0xf')]);return _0x5547f2(_0x135f07[_0xe3e4('0xe')]['message']);}logger[_0xe3e4('0xe')](_0xe3e4('0xb'),_0x4f8987,_0x135f07[_0xe3e4('0xe')][_0xe3e4('0xf')]);return _0x95f6eb(_0x135f07[_0xe3e4('0xe')][_0xe3e4('0xf')]);}else{logger[_0xe3e4('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x4f8987,'request\x20sent');_0x95f6eb(_0x135f07[_0xe3e4('0x11')][_0xe3e4('0xf')]);}})[_0xe3e4('0x12')](function(_0x44d7e0){logger[_0xe3e4('0xe')](_0xe3e4('0xb'),_0x4f8987,_0x44d7e0);_0x5547f2(_0x44d7e0);});});} \ No newline at end of file +var _0x5e8d=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','moment'];(function(_0x3d7166,_0x36075e){var _0x20a285=function(_0x1f71d6){while(--_0x1f71d6){_0x3d7166['push'](_0x3d7166['shift']());}};_0x20a285(++_0x36075e);}(_0x5e8d,0x1c9));var _0xd5e8=function(_0x22ddb1,_0x5f567c){_0x22ddb1=_0x22ddb1-0x0;var _0x31b637=_0x5e8d[_0x22ddb1];return _0x31b637;};'use strict';var _=require(_0xd5e8('0x0'));var util=require(_0xd5e8('0x1'));var moment=require(_0xd5e8('0x2'));var BPromise=require(_0xd5e8('0x3'));var rs=require(_0xd5e8('0x4'));var fs=require('fs');var Redis=require(_0xd5e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5e8('0x6'));var logger=require(_0xd5e8('0x7'))(_0xd5e8('0x8'));var config=require(_0xd5e8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd5e8('0xa')][_0xd5e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d5a96,_0x54cb7c,_0x171509){return new BPromise(function(_0x281dab,_0x45ff70){return client[_0xd5e8('0xc')](_0x2d5a96,_0x171509)[_0xd5e8('0xd')](function(_0x17e338){logger[_0xd5e8('0xe')](_0xd5e8('0xf'),_0x54cb7c,'request\x20sent');logger[_0xd5e8('0x10')](_0xd5e8('0x11'),_0x54cb7c,'request\x20sent',JSON[_0xd5e8('0x12')](_0x17e338));if(_0x17e338['error']){if(_0x17e338[_0xd5e8('0x13')][_0xd5e8('0x14')]===0x1f4){logger[_0xd5e8('0x13')](_0xd5e8('0xf'),_0x54cb7c,_0x17e338[_0xd5e8('0x13')]['message']);return _0x45ff70(_0x17e338[_0xd5e8('0x13')][_0xd5e8('0x15')]);}logger['error'](_0xd5e8('0xf'),_0x54cb7c,_0x17e338[_0xd5e8('0x13')][_0xd5e8('0x15')]);return _0x281dab(_0x17e338[_0xd5e8('0x13')]['message']);}else{logger[_0xd5e8('0xe')](_0xd5e8('0xf'),_0x54cb7c,_0xd5e8('0x16'));_0x281dab(_0x17e338['result'][_0xd5e8('0x15')]);}})['catch'](function(_0x3f12c4){logger[_0xd5e8('0x13')](_0xd5e8('0xf'),_0x54cb7c,_0x3f12c4);_0x45ff70(_0x3f12c4);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 7acc613..c55c74a 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 _0x1e8f=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x40d8d7,_0x30dd5e){var _0x3454cc=function(_0x512c1b){while(--_0x512c1b){_0x40d8d7['push'](_0x40d8d7['shift']());}};_0x3454cc(++_0x30dd5e);}(_0x1e8f,0x169));var _0xf1e8=function(_0x281765,_0x2b0a8a){_0x281765=_0x281765-0x0;var _0xde5a97=_0x1e8f[_0x281765];return _0xde5a97;};'use strict';var multer=require(_0xf1e8('0x0'));var util=require('util');var path=require(_0xf1e8('0x1'));var timeout=require(_0xf1e8('0x2'));var express=require(_0xf1e8('0x3'));var router=express[_0xf1e8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf1e8('0x5'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0xf1e8('0x6')]('/',auth[_0xf1e8('0x7')](),controller['index']);router[_0xf1e8('0x6')](_0xf1e8('0x8'),auth[_0xf1e8('0x7')](),controller[_0xf1e8('0x9')]);router[_0xf1e8('0xa')]('/',auth[_0xf1e8('0x7')](),controller[_0xf1e8('0xb')]);router[_0xf1e8('0xc')](_0xf1e8('0x8'),auth[_0xf1e8('0x7')](),controller[_0xf1e8('0xd')]);router[_0xf1e8('0xe')]('/:id',auth[_0xf1e8('0x7')](),controller[_0xf1e8('0xf')]);module[_0xf1e8('0x10')]=router; \ No newline at end of file +var _0x6394=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x2232ff,_0x193749){var _0x1f6ef5=function(_0x325631){while(--_0x325631){_0x2232ff['push'](_0x2232ff['shift']());}};_0x1f6ef5(++_0x193749);}(_0x6394,0x177));var _0x4639=function(_0x1e2a33,_0x18a3bf){_0x1e2a33=_0x1e2a33-0x0;var _0x2c57c0=_0x6394[_0x1e2a33];return _0x2c57c0;};'use strict';var multer=require(_0x4639('0x0'));var util=require(_0x4639('0x1'));var path=require(_0x4639('0x2'));var timeout=require('connect-timeout');var express=require(_0x4639('0x3'));var router=express['Router']();var auth=require(_0x4639('0x4'));var interaction=require(_0x4639('0x5'));var config=require(_0x4639('0x6'));var controller=require(_0x4639('0x7'));router[_0x4639('0x8')]('/',auth[_0x4639('0x9')](),controller[_0x4639('0xa')]);router['get'](_0x4639('0xb'),auth[_0x4639('0x9')](),controller[_0x4639('0xc')]);router[_0x4639('0xd')]('/',auth[_0x4639('0x9')](),controller[_0x4639('0xe')]);router['put'](_0x4639('0xb'),auth[_0x4639('0x9')](),controller[_0x4639('0xf')]);router['delete'](_0x4639('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4639('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index c98aeac..a52b014 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 _0x6806=['STRING','INTEGER','exports','DATE'];(function(_0x52c24e,_0x4072e7){var _0x13f14f=function(_0x4d3a33){while(--_0x4d3a33){_0x52c24e['push'](_0x52c24e['shift']());}};_0x13f14f(++_0x4072e7);}(_0x6806,0xc6));var _0x6680=function(_0x5a4789,_0x4a1044){_0x5a4789=_0x5a4789-0x0;var _0x59f547=_0x6806[_0x5a4789];return _0x59f547;};'use strict';var Sequelize=require('sequelize');module[_0x6680('0x0')]={'calldate':{'type':Sequelize[_0x6680('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x6680('0x2')]},'src':{'type':Sequelize[_0x6680('0x2')]},'dst':{'type':Sequelize[_0x6680('0x2')]},'dcontext':{'type':Sequelize[_0x6680('0x2')]},'channel':{'type':Sequelize[_0x6680('0x2')]},'dstchannel':{'type':Sequelize[_0x6680('0x2')]},'lastapp':{'type':Sequelize[_0x6680('0x2')]},'lastdata':{'type':Sequelize[_0x6680('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6680('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6680('0x2')]},'amaflags':{'type':Sequelize[_0x6680('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6680('0x2')]},'userfield':{'type':Sequelize[_0x6680('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x6680('0x2')]},'peeraccount':{'type':Sequelize[_0x6680('0x2')]},'type':{'type':Sequelize[_0x6680('0x2')]},'tag':{'type':Sequelize[_0x6680('0x2')]}}; \ No newline at end of file +var _0x5c1d=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x5c1d,0xf2));var _0xd5c1=function(_0x97a492,_0x4773d5){_0x97a492=_0x97a492-0x0;var _0x1dc593=_0x5c1d[_0x97a492];return _0x1dc593;};'use strict';var Sequelize=require('sequelize');module[_0xd5c1('0x0')]={'calldate':{'type':Sequelize[_0xd5c1('0x1')],'allowNull':![],'defaultValue':_0xd5c1('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xd5c1('0x3')]},'dst':{'type':Sequelize[_0xd5c1('0x3')]},'dcontext':{'type':Sequelize[_0xd5c1('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xd5c1('0x3')]},'lastapp':{'type':Sequelize[_0xd5c1('0x3')]},'lastdata':{'type':Sequelize[_0xd5c1('0x3')]},'duration':{'type':Sequelize[_0xd5c1('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd5c1('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd5c1('0x3')]},'amaflags':{'type':Sequelize[_0xd5c1('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd5c1('0x3')]},'userfield':{'type':Sequelize[_0xd5c1('0x3')]},'uniqueid':{'type':Sequelize[_0xd5c1('0x3')]},'linkedid':{'type':Sequelize[_0xd5c1('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xd5c1('0x3')]},'type':{'type':Sequelize[_0xd5c1('0x3')]},'tag':{'type':Sequelize[_0xd5c1('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7e12657..25fa07f 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 _0x9263=['map','type','VIRTUAL','field','include','rows','show','params','rawAttributes','includeAll','options','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','reject','save','update','then','sendStatus','error','stack','index','Cdr','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x9263,0xdd));var _0x3926=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x9263[_0x36eaaa];return _0x461349;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3926('0x0'));var zipdir=require(_0x3926('0x1'));var jsonpatch=require(_0x3926('0x2'));var rp=require(_0x3926('0x3'));var moment=require('moment');var BPromise=require(_0x3926('0x4'));var Mustache=require(_0x3926('0x5'));var util=require(_0x3926('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3926('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3926('0x8'));var crypto=require(_0x3926('0x9'));var jsforce=require(_0x3926('0xa'));var deskjs=require(_0x3926('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3926('0xc'));var Papa=require(_0x3926('0xd'));var authService=require(_0x3926('0xe'));var hardwareService=require(_0x3926('0xf'));var Redis=require(_0x3926('0x10'));var qs=require(_0x3926('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3926('0x12'));var config=require(_0x3926('0x13'));var db=require(_0x3926('0x14'))['db'];function respondWithStatusCode(_0x32ddaf,_0x198829){_0x198829=_0x198829||0xcc;return function(_0x35503c){if(_0x35503c){return _0x32ddaf['sendStatus'](_0x198829);}return _0x32ddaf['status'](_0x198829)[_0x3926('0x15')]();};}function respondWithResult(_0x3a68c9,_0x29a882){_0x29a882=_0x29a882||0xc8;return function(_0x1e70c1){if(_0x1e70c1){return _0x3a68c9[_0x3926('0x16')](_0x29a882)[_0x3926('0x17')](_0x1e70c1);}};}function respondWithFilteredResult(_0x2bc9f4,_0x5eb352){return function(_0x7c0597){if(_0x7c0597){var _0x24894d=_0x7c0597[_0x3926('0x18')],_0x12e02e=_0x5eb352['offset'],_0x373d6c=_0x5eb352[_0x3926('0x19')]+_0x5eb352[_0x3926('0x1a')],_0x33fe4b;if(_0x373d6c>=_0x24894d){_0x373d6c=_0x24894d;_0x33fe4b=0xc8;}else{_0x33fe4b=0xce;}_0x2bc9f4[_0x3926('0x16')](_0x33fe4b);return _0x2bc9f4['set']('Content-Range',_0x12e02e+'-'+_0x373d6c+'/'+_0x24894d)[_0x3926('0x17')](_0x7c0597);}return null;};}function patchUpdates(_0x286eab){return function(_0x50e213){try{jsonpatch['apply'](_0x50e213,_0x286eab,!![]);}catch(_0x5bdd42){return BPromise[_0x3926('0x1b')](_0x5bdd42);}return _0x50e213[_0x3926('0x1c')]();};}function saveUpdates(_0x1a9a1f,_0x4fce){return function(_0x123e93){if(_0x123e93){return _0x123e93[_0x3926('0x1d')](_0x1a9a1f)[_0x3926('0x1e')](function(_0x287926){return _0x287926;});}return null;};}function removeEntity(_0x151da3,_0x57f3f6){return function(_0x2644e5){if(_0x2644e5){return _0x2644e5['destroy']()[_0x3926('0x1e')](function(){_0x151da3[_0x3926('0x16')](0xcc)[_0x3926('0x15')]();});}};}function handleEntityNotFound(_0x41ab10,_0xd17132){return function(_0x420ba0){if(!_0x420ba0){_0x41ab10[_0x3926('0x1f')](0x194);}return _0x420ba0;};}function handleError(_0x42695f,_0x586236){_0x586236=_0x586236||0x1f4;return function(_0x29ecca){logger[_0x3926('0x20')](_0x29ecca[_0x3926('0x21')]);if(_0x29ecca['name']){delete _0x29ecca['name'];}_0x42695f[_0x3926('0x16')](_0x586236)['send'](_0x29ecca);};}exports[_0x3926('0x22')]=function(_0x3c7c9e,_0x4f4139){var _0x21fa2b={},_0x2af952={},_0x134267={'count':0x0,'rows':[]};var _0x4d3cdf=db[_0x3926('0x23')]['rawAttributes'];_0x2af952[_0x3926('0x24')]=_[_0x3926('0x25')](_0x4d3cdf);_0x2af952[_0x3926('0x26')]=_[_0x3926('0x25')](_0x3c7c9e[_0x3926('0x26')]);_0x2af952[_0x3926('0x27')]=_[_0x3926('0x28')](_0x2af952[_0x3926('0x24')],_0x2af952[_0x3926('0x26')]);_0x21fa2b[_0x3926('0x29')]=_[_0x3926('0x28')](_0x2af952['model'],qs[_0x3926('0x2a')](_0x3c7c9e[_0x3926('0x26')][_0x3926('0x2a')]));_0x21fa2b['attributes']=_0x21fa2b[_0x3926('0x29')][_0x3926('0x2b')]?_0x21fa2b[_0x3926('0x29')]:_0x2af952[_0x3926('0x24')];if(!_0x3c7c9e[_0x3926('0x26')][_0x3926('0x2c')](_0x3926('0x2d'))){_0x21fa2b[_0x3926('0x1a')]=qs[_0x3926('0x1a')](_0x3c7c9e['query']['limit']);_0x21fa2b[_0x3926('0x19')]=qs[_0x3926('0x19')](_0x3c7c9e[_0x3926('0x26')][_0x3926('0x19')]);}_0x21fa2b[_0x3926('0x2e')]=qs['sort'](_0x3c7c9e[_0x3926('0x26')][_0x3926('0x2f')]);_0x21fa2b['where']=qs[_0x3926('0x27')](_['pick'](_0x3c7c9e['query'],_0x2af952[_0x3926('0x27')]));if(_0x3c7c9e[_0x3926('0x26')][_0x3926('0x30')]){_0x21fa2b[_0x3926('0x31')]=_[_0x3926('0x32')](_0x21fa2b[_0x3926('0x31')],{'$or':_[_0x3926('0x33')](_0x4d3cdf,function(_0x1b668b){if(_0x1b668b[_0x3926('0x34')]['key']!==_0x3926('0x35')){var _0x25e02f={};_0x25e02f[_0x1b668b[_0x3926('0x36')]]={'$like':'%'+_0x3c7c9e[_0x3926('0x26')][_0x3926('0x30')]+'%'};return _0x25e02f;}})});}_0x21fa2b=_['merge']({},_0x21fa2b,_0x3c7c9e['options']);var _0x50f352={'where':_0x21fa2b['where']};return db[_0x3926('0x23')][_0x3926('0x18')](_0x50f352)[_0x3926('0x1e')](function(_0x599919){_0x134267[_0x3926('0x18')]=_0x599919;if(_0x3c7c9e[_0x3926('0x26')]['includeAll']){_0x21fa2b[_0x3926('0x37')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0x21fa2b);})[_0x3926('0x1e')](function(_0x1db754){_0x134267[_0x3926('0x38')]=_0x1db754;return _0x134267;})[_0x3926('0x1e')](respondWithFilteredResult(_0x4f4139,_0x21fa2b))['catch'](handleError(_0x4f4139,null));};exports[_0x3926('0x39')]=function(_0x2f2237,_0x5b498c){var _0xbb44c7={'raw':!![],'where':{'id':_0x2f2237[_0x3926('0x3a')]['id']}},_0x26ee45={};_0x26ee45[_0x3926('0x24')]=_[_0x3926('0x25')](db[_0x3926('0x23')][_0x3926('0x3b')]);_0x26ee45[_0x3926('0x26')]=_['keys'](_0x2f2237['query']);_0x26ee45['filters']=_['intersection'](_0x26ee45[_0x3926('0x24')],_0x26ee45[_0x3926('0x26')]);_0xbb44c7[_0x3926('0x29')]=_[_0x3926('0x28')](_0x26ee45[_0x3926('0x24')],qs[_0x3926('0x2a')](_0x2f2237[_0x3926('0x26')][_0x3926('0x2a')]));_0xbb44c7[_0x3926('0x29')]=_0xbb44c7['attributes']['length']?_0xbb44c7[_0x3926('0x29')]:_0x26ee45[_0x3926('0x24')];if(_0x2f2237[_0x3926('0x26')][_0x3926('0x3c')]){_0xbb44c7[_0x3926('0x37')]=[{'all':!![]}];}_0xbb44c7=_[_0x3926('0x32')]({},_0xbb44c7,_0x2f2237[_0x3926('0x3d')]);return db['Cdr'][_0x3926('0x3e')](_0xbb44c7)[_0x3926('0x1e')](handleEntityNotFound(_0x5b498c,null))[_0x3926('0x1e')](respondWithResult(_0x5b498c,null))[_0x3926('0x3f')](handleError(_0x5b498c,null));};exports[_0x3926('0x40')]=function(_0x4b4192,_0xe56ce0){return db[_0x3926('0x23')][_0x3926('0x40')](_0x4b4192[_0x3926('0x41')],{})[_0x3926('0x1e')](respondWithResult(_0xe56ce0,0xc9))[_0x3926('0x3f')](handleError(_0xe56ce0,null));};exports[_0x3926('0x1d')]=function(_0x4482a2,_0x5ad751){if(_0x4482a2['body']['id']){delete _0x4482a2[_0x3926('0x41')]['id'];}return db['Cdr'][_0x3926('0x3e')]({'where':{'id':_0x4482a2[_0x3926('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5ad751,null))[_0x3926('0x1e')](saveUpdates(_0x4482a2[_0x3926('0x41')],null))[_0x3926('0x1e')](respondWithResult(_0x5ad751,null))[_0x3926('0x3f')](handleError(_0x5ad751,null));};exports[_0x3926('0x42')]=function(_0x94b870,_0x562f7f){return db[_0x3926('0x23')][_0x3926('0x3e')]({'where':{'id':_0x94b870[_0x3926('0x3a')]['id']}})[_0x3926('0x1e')](handleEntityNotFound(_0x562f7f,null))[_0x3926('0x1e')](removeEntity(_0x562f7f,null))['catch'](handleError(_0x562f7f,null));};exports[_0x3926('0x43')]=function(_0x2bea87,_0xea81c2){return db[_0x3926('0x23')]['describe']()['then'](respondWithResult(_0xea81c2,null))['catch'](handleError(_0xea81c2,null));}; \ No newline at end of file +var _0x94e0=['index','Cdr','rawAttributes','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','key','field','options','findAll','rows','catch','show','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send'];(function(_0xf83492,_0x28c979){var _0x2eaf19=function(_0x5859f7){while(--_0x5859f7){_0xf83492['push'](_0xf83492['shift']());}};_0x2eaf19(++_0x28c979);}(_0x94e0,0x13c));var _0x094e=function(_0x192fcb,_0x2a6655){_0x192fcb=_0x192fcb-0x0;var _0x689383=_0x94e0[_0x192fcb];return _0x689383;};'use strict';var pdf=require(_0x094e('0x0'));var emlformat=require(_0x094e('0x1'));var rimraf=require(_0x094e('0x2'));var zipdir=require(_0x094e('0x3'));var jsonpatch=require(_0x094e('0x4'));var rp=require(_0x094e('0x5'));var moment=require(_0x094e('0x6'));var BPromise=require(_0x094e('0x7'));var Mustache=require('mustache');var util=require(_0x094e('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x094e('0x9'));var ejs=require(_0x094e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x094e('0xb'));var jsforce=require(_0x094e('0xc'));var deskjs=require(_0x094e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x094e('0xe'));var Papa=require(_0x094e('0xf'));var authService=require(_0x094e('0x10'));var hardwareService=require(_0x094e('0x11'));var Redis=require(_0x094e('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x094e('0x13'))(_0x094e('0x14'));var utils=require('../../config/utils');var config=require(_0x094e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x262f3a,_0x1a6d8d){_0x1a6d8d=_0x1a6d8d||0xcc;return function(_0x289599){if(_0x289599){return _0x262f3a[_0x094e('0x16')](_0x1a6d8d);}return _0x262f3a[_0x094e('0x17')](_0x1a6d8d)[_0x094e('0x18')]();};}function respondWithResult(_0x2b4cd3,_0x3e1355){_0x3e1355=_0x3e1355||0xc8;return function(_0x12d95b){if(_0x12d95b){return _0x2b4cd3[_0x094e('0x17')](_0x3e1355)[_0x094e('0x19')](_0x12d95b);}};}function respondWithFilteredResult(_0x36d8c2,_0x53d310){return function(_0x4530d6){if(_0x4530d6){var _0x23e802=_0x4530d6[_0x094e('0x1a')],_0x2955d7=_0x53d310[_0x094e('0x1b')],_0xb3f8ed=_0x53d310[_0x094e('0x1b')]+_0x53d310[_0x094e('0x1c')],_0x259173;if(_0xb3f8ed>=_0x23e802){_0xb3f8ed=_0x23e802;_0x259173=0xc8;}else{_0x259173=0xce;}_0x36d8c2[_0x094e('0x17')](_0x259173);return _0x36d8c2[_0x094e('0x1d')](_0x094e('0x1e'),_0x2955d7+'-'+_0xb3f8ed+'/'+_0x23e802)[_0x094e('0x19')](_0x4530d6);}return null;};}function patchUpdates(_0x4db56e){return function(_0x3e329f){try{jsonpatch[_0x094e('0x1f')](_0x3e329f,_0x4db56e,!![]);}catch(_0x4adbfc){return BPromise[_0x094e('0x20')](_0x4adbfc);}return _0x3e329f[_0x094e('0x21')]();};}function saveUpdates(_0xc50516,_0x372773){return function(_0x4c20dc){if(_0x4c20dc){return _0x4c20dc[_0x094e('0x22')](_0xc50516)[_0x094e('0x23')](function(_0x44a150){return _0x44a150;});}return null;};}function removeEntity(_0x59fdf9,_0x428fd8){return function(_0x3ac989){if(_0x3ac989){return _0x3ac989[_0x094e('0x24')]()[_0x094e('0x23')](function(){_0x59fdf9[_0x094e('0x17')](0xcc)[_0x094e('0x18')]();});}};}function handleEntityNotFound(_0x147a42,_0x5e0c82){return function(_0x276fa3){if(!_0x276fa3){_0x147a42['sendStatus'](0x194);}return _0x276fa3;};}function handleError(_0x1b28c3,_0x509608){_0x509608=_0x509608||0x1f4;return function(_0x2ea5d8){logger['error'](_0x2ea5d8['stack']);if(_0x2ea5d8[_0x094e('0x25')]){delete _0x2ea5d8['name'];}_0x1b28c3[_0x094e('0x17')](_0x509608)[_0x094e('0x26')](_0x2ea5d8);};}exports[_0x094e('0x27')]=function(_0x1691c8,_0x3cce0b){var _0x3e3aef={},_0x1203d1={},_0xf0685={'count':0x0,'rows':[]};var _0x3e79b7=db[_0x094e('0x28')][_0x094e('0x29')];_0x1203d1[_0x094e('0x2a')]=_[_0x094e('0x2b')](_0x3e79b7);_0x1203d1['query']=_[_0x094e('0x2b')](_0x1691c8['query']);_0x1203d1[_0x094e('0x2c')]=_[_0x094e('0x2d')](_0x1203d1['model'],_0x1203d1[_0x094e('0x2e')]);_0x3e3aef[_0x094e('0x2f')]=_[_0x094e('0x2d')](_0x1203d1[_0x094e('0x2a')],qs['fields'](_0x1691c8['query'][_0x094e('0x30')]));_0x3e3aef['attributes']=_0x3e3aef['attributes'][_0x094e('0x31')]?_0x3e3aef['attributes']:_0x1203d1['model'];if(!_0x1691c8[_0x094e('0x2e')][_0x094e('0x32')](_0x094e('0x33'))){_0x3e3aef[_0x094e('0x1c')]=qs['limit'](_0x1691c8[_0x094e('0x2e')]['limit']);_0x3e3aef[_0x094e('0x1b')]=qs[_0x094e('0x1b')](_0x1691c8[_0x094e('0x2e')]['offset']);}_0x3e3aef['order']=qs[_0x094e('0x34')](_0x1691c8['query'][_0x094e('0x34')]);_0x3e3aef[_0x094e('0x35')]=qs['filters'](_['pick'](_0x1691c8[_0x094e('0x2e')],_0x1203d1['filters']));if(_0x1691c8[_0x094e('0x2e')][_0x094e('0x36')]){_0x3e3aef[_0x094e('0x35')]=_[_0x094e('0x37')](_0x3e3aef[_0x094e('0x35')],{'$or':_[_0x094e('0x38')](_0x3e79b7,function(_0x5cb985){if(_0x5cb985[_0x094e('0x39')][_0x094e('0x3a')]!=='VIRTUAL'){var _0x228c2c={};_0x228c2c[_0x5cb985[_0x094e('0x3b')]]={'$like':'%'+_0x1691c8['query'][_0x094e('0x36')]+'%'};return _0x228c2c;}})});}_0x3e3aef=_[_0x094e('0x37')]({},_0x3e3aef,_0x1691c8[_0x094e('0x3c')]);var _0x2ee833={'where':_0x3e3aef[_0x094e('0x35')]};return db[_0x094e('0x28')][_0x094e('0x1a')](_0x2ee833)[_0x094e('0x23')](function(_0x8c03d6){_0xf0685[_0x094e('0x1a')]=_0x8c03d6;if(_0x1691c8[_0x094e('0x2e')]['includeAll']){_0x3e3aef['include']=[{'all':!![]}];}return db['Cdr'][_0x094e('0x3d')](_0x3e3aef);})[_0x094e('0x23')](function(_0x127ba2){_0xf0685[_0x094e('0x3e')]=_0x127ba2;return _0xf0685;})['then'](respondWithFilteredResult(_0x3cce0b,_0x3e3aef))[_0x094e('0x3f')](handleError(_0x3cce0b,null));};exports[_0x094e('0x40')]=function(_0x5b2c21,_0x562be7){var _0x520f42={'raw':!![],'where':{'id':_0x5b2c21['params']['id']}},_0x17c4e2={};_0x17c4e2[_0x094e('0x2a')]=_[_0x094e('0x2b')](db['Cdr']['rawAttributes']);_0x17c4e2['query']=_['keys'](_0x5b2c21['query']);_0x17c4e2[_0x094e('0x2c')]=_[_0x094e('0x2d')](_0x17c4e2[_0x094e('0x2a')],_0x17c4e2[_0x094e('0x2e')]);_0x520f42[_0x094e('0x2f')]=_[_0x094e('0x2d')](_0x17c4e2[_0x094e('0x2a')],qs['fields'](_0x5b2c21[_0x094e('0x2e')]['fields']));_0x520f42['attributes']=_0x520f42[_0x094e('0x2f')][_0x094e('0x31')]?_0x520f42[_0x094e('0x2f')]:_0x17c4e2[_0x094e('0x2a')];if(_0x5b2c21[_0x094e('0x2e')]['includeAll']){_0x520f42[_0x094e('0x41')]=[{'all':!![]}];}_0x520f42=_[_0x094e('0x37')]({},_0x520f42,_0x5b2c21['options']);return db['Cdr'][_0x094e('0x42')](_0x520f42)['then'](handleEntityNotFound(_0x562be7,null))['then'](respondWithResult(_0x562be7,null))[_0x094e('0x3f')](handleError(_0x562be7,null));};exports[_0x094e('0x43')]=function(_0x4e3ebc,_0x2b70b2){return db[_0x094e('0x28')][_0x094e('0x43')](_0x4e3ebc[_0x094e('0x44')],{})[_0x094e('0x23')](respondWithResult(_0x2b70b2,0xc9))['catch'](handleError(_0x2b70b2,null));};exports[_0x094e('0x22')]=function(_0x10cee6,_0x334709){if(_0x10cee6['body']['id']){delete _0x10cee6[_0x094e('0x44')]['id'];}return db[_0x094e('0x28')][_0x094e('0x42')]({'where':{'id':_0x10cee6['params']['id']}})['then'](handleEntityNotFound(_0x334709,null))[_0x094e('0x23')](saveUpdates(_0x10cee6[_0x094e('0x44')],null))[_0x094e('0x23')](respondWithResult(_0x334709,null))[_0x094e('0x3f')](handleError(_0x334709,null));};exports['destroy']=function(_0x377fa5,_0x35ea3f){return db[_0x094e('0x28')][_0x094e('0x42')]({'where':{'id':_0x377fa5[_0x094e('0x45')]['id']}})[_0x094e('0x23')](handleEntityNotFound(_0x35ea3f,null))[_0x094e('0x23')](removeEntity(_0x35ea3f,null))[_0x094e('0x3f')](handleError(_0x35ea3f,null));};exports[_0x094e('0x46')]=function(_0xf8b6b2,_0x59538e){return db[_0x094e('0x28')]['describe']()[_0x094e('0x23')](respondWithResult(_0x59538e,null))['catch'](handleError(_0x59538e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4e2a95f..a800b51 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 _0xb19b=['request-promise','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','dst','src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4bf40a,_0x1612c0){var _0x238f74=function(_0x3f6853){while(--_0x3f6853){_0x4bf40a['push'](_0x4bf40a['shift']());}};_0x238f74(++_0x1612c0);}(_0xb19b,0x1ca));var _0xbb19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb19b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbb19('0x0'));var util=require(_0xbb19('0x1'));var logger=require(_0xbb19('0x2'))(_0xbb19('0x3'));var moment=require(_0xbb19('0x4'));var BPromise=require(_0xbb19('0x5'));var rp=require(_0xbb19('0x6'));var attributes=require(_0xbb19('0x7'));module[_0xbb19('0x8')]=function(_0x308015,_0x555f87){return _0x308015['define'](_0xbb19('0x9'),attributes,{'tableName':_0xbb19('0xa'),'paranoid':![],'indexes':[{'name':_0xbb19('0xb'),'fields':['accountcode']},{'name':'calldate','fields':[_0xbb19('0xc')]},{'name':'disposition','fields':['disposition']},{'name':_0xbb19('0xd'),'fields':[_0xbb19('0xd')]},{'name':_0xbb19('0xe'),'fields':[_0xbb19('0xe')]},{'name':_0xbb19('0xf'),'fields':[_0xbb19('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5b61=['bluebird','request-promise','./cdr.attributes','exports','cdr','accountcode','calldate','disposition','src','uniqueid','util','../../config/logger','api','moment'];(function(_0x1feb73,_0x460e19){var _0x4b9d73=function(_0x5487ad){while(--_0x5487ad){_0x1feb73['push'](_0x1feb73['shift']());}};_0x4b9d73(++_0x460e19);}(_0x5b61,0xc0));var _0x15b6=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0x5b61[_0x3aeb36];return _0xa2ef21;};'use strict';var _=require('lodash');var util=require(_0x15b6('0x0'));var logger=require(_0x15b6('0x1'))(_0x15b6('0x2'));var moment=require(_0x15b6('0x3'));var BPromise=require(_0x15b6('0x4'));var rp=require(_0x15b6('0x5'));var attributes=require(_0x15b6('0x6'));module[_0x15b6('0x7')]=function(_0x3d4766,_0x438827){return _0x3d4766['define']('Cdr',attributes,{'tableName':_0x15b6('0x8'),'paranoid':![],'indexes':[{'name':_0x15b6('0x9'),'fields':[_0x15b6('0x9')]},{'name':_0x15b6('0xa'),'fields':['calldate']},{'name':_0x15b6('0xb'),'fields':['disposition']},{'name':'dst','fields':['dst']},{'name':'src','fields':[_0x15b6('0xc')]},{'name':'uniqueid','fields':[_0x15b6('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index f20617c..f6c8af9 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 _0x97d2=['error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x146305,_0x2c7be9){var _0x5b8133=function(_0x5138eb){while(--_0x5138eb){_0x146305['push'](_0x146305['shift']());}};_0x5b8133(++_0x2c7be9);}(_0x97d2,0x129));var _0x297d=function(_0x17e35c,_0x28fba3){_0x17e35c=_0x17e35c-0x0;var _0x1737bd=_0x97d2[_0x17e35c];return _0x1737bd;};'use strict';var _=require(_0x297d('0x0'));var util=require(_0x297d('0x1'));var moment=require(_0x297d('0x2'));var BPromise=require(_0x297d('0x3'));var rs=require(_0x297d('0x4'));var fs=require('fs');var Redis=require(_0x297d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x297d('0x6'))(_0x297d('0x7'));var config=require(_0x297d('0x8'));var jayson=require(_0x297d('0x9'));var client=jayson[_0x297d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xeeae86,_0x921dc7,_0x5c4530){return new BPromise(function(_0x16ac80,_0x3ab04d){return client[_0x297d('0xb')](_0xeeae86,_0x5c4530)[_0x297d('0xc')](function(_0x3e6c12){logger[_0x297d('0xd')](_0x297d('0xe'),_0x921dc7,_0x297d('0xf'));logger['debug'](_0x297d('0x10'),_0x921dc7,_0x297d('0xf'),JSON[_0x297d('0x11')](_0x3e6c12));if(_0x3e6c12['error']){if(_0x3e6c12[_0x297d('0x12')][_0x297d('0x13')]===0x1f4){logger[_0x297d('0x12')]('Cdr,\x20%s,\x20%s',_0x921dc7,_0x3e6c12[_0x297d('0x12')][_0x297d('0x14')]);return _0x3ab04d(_0x3e6c12[_0x297d('0x12')]['message']);}logger[_0x297d('0x12')](_0x297d('0xe'),_0x921dc7,_0x3e6c12[_0x297d('0x12')]['message']);return _0x16ac80(_0x3e6c12[_0x297d('0x12')][_0x297d('0x14')]);}else{logger[_0x297d('0xd')](_0x297d('0xe'),_0x921dc7,'request\x20sent');_0x16ac80(_0x3e6c12['result'][_0x297d('0x14')]);}})['catch'](function(_0x50f0ab){logger[_0x297d('0x12')](_0x297d('0xe'),_0x921dc7,_0x50f0ab);_0x3ab04d(_0x50f0ab);});});} \ No newline at end of file +var _0x9df2=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','result','catch'];(function(_0x52b3a1,_0xd9ad11){var _0x32a8ed=function(_0x3a2c79){while(--_0x3a2c79){_0x52b3a1['push'](_0x52b3a1['shift']());}};_0x32a8ed(++_0xd9ad11);}(_0x9df2,0x180));var _0x29df=function(_0x14179e,_0x5075e5){_0x14179e=_0x14179e-0x0;var _0x6bcd95=_0x9df2[_0x14179e];return _0x6bcd95;};'use strict';var _=require(_0x29df('0x0'));var util=require(_0x29df('0x1'));var moment=require(_0x29df('0x2'));var BPromise=require(_0x29df('0x3'));var rs=require(_0x29df('0x4'));var fs=require('fs');var Redis=require(_0x29df('0x5'));var db=require(_0x29df('0x6'))['db'];var utils=require(_0x29df('0x7'));var logger=require('../../config/logger')(_0x29df('0x8'));var config=require('../../config/environment');var jayson=require(_0x29df('0x9'));var client=jayson[_0x29df('0xa')][_0x29df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1997b0,_0x5111a9,_0x3aa2e0){return new BPromise(function(_0x8f8686,_0x57d09c){return client[_0x29df('0xc')](_0x1997b0,_0x3aa2e0)[_0x29df('0xd')](function(_0x2f1840){logger[_0x29df('0xe')]('Cdr,\x20%s,\x20%s',_0x5111a9,_0x29df('0xf'));logger['debug'](_0x29df('0x10'),_0x5111a9,_0x29df('0xf'),JSON[_0x29df('0x11')](_0x2f1840));if(_0x2f1840['error']){if(_0x2f1840[_0x29df('0x12')][_0x29df('0x13')]===0x1f4){logger[_0x29df('0x12')]('Cdr,\x20%s,\x20%s',_0x5111a9,_0x2f1840[_0x29df('0x12')][_0x29df('0x14')]);return _0x57d09c(_0x2f1840[_0x29df('0x12')][_0x29df('0x14')]);}logger[_0x29df('0x12')]('Cdr,\x20%s,\x20%s',_0x5111a9,_0x2f1840['error'][_0x29df('0x14')]);return _0x8f8686(_0x2f1840[_0x29df('0x12')][_0x29df('0x14')]);}else{logger['info'](_0x29df('0x15'),_0x5111a9,_0x29df('0xf'));_0x8f8686(_0x2f1840[_0x29df('0x16')][_0x29df('0x14')]);}})[_0x29df('0x17')](function(_0x27e48b){logger[_0x29df('0x12')](_0x29df('0x15'),_0x5111a9,_0x27e48b);_0x57d09c(_0x27e48b);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index fac514a..314c16f 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 _0x81ef=['Router','../../components/auth/service','./cdr.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x470fee,_0x34276e){var _0xd527c=function(_0x12e38a){while(--_0x12e38a){_0x470fee['push'](_0x470fee['shift']());}};_0xd527c(++_0x34276e);}(_0x81ef,0xc3));var _0xf81e=function(_0x241917,_0x392c9f){_0x241917=_0x241917-0x0;var _0x377470=_0x81ef[_0x241917];return _0x377470;};'use strict';var multer=require(_0xf81e('0x0'));var util=require(_0xf81e('0x1'));var path=require(_0xf81e('0x2'));var timeout=require(_0xf81e('0x3'));var express=require(_0xf81e('0x4'));var router=express[_0xf81e('0x5')]();var auth=require(_0xf81e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf81e('0x7'));router[_0xf81e('0x8')]('/',auth[_0xf81e('0x9')](),controller[_0xf81e('0xa')]);router[_0xf81e('0x8')](_0xf81e('0xb'),auth[_0xf81e('0x9')](),controller[_0xf81e('0xc')]);router[_0xf81e('0x8')]('/:id',auth[_0xf81e('0x9')](),controller['show']);router[_0xf81e('0xd')]('/',auth[_0xf81e('0x9')](),controller['create']);router[_0xf81e('0xe')](_0xf81e('0xf'),auth[_0xf81e('0x9')](),controller[_0xf81e('0x10')]);router[_0xf81e('0x11')](_0xf81e('0xf'),auth['isAuthenticated'](),controller[_0xf81e('0x12')]);module[_0xf81e('0x13')]=router; \ No newline at end of file +var _0x8838=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','show','post','create','put','update'];(function(_0x1f1e84,_0x2a0df7){var _0x1617e7=function(_0x160aa4){while(--_0x160aa4){_0x1f1e84['push'](_0x1f1e84['shift']());}};_0x1617e7(++_0x2a0df7);}(_0x8838,0xeb));var _0x8883=function(_0x469463,_0x4e0a30){_0x469463=_0x469463-0x0;var _0x41175b=_0x8838[_0x469463];return _0x41175b;};'use strict';var multer=require(_0x8883('0x0'));var util=require(_0x8883('0x1'));var path=require(_0x8883('0x2'));var timeout=require(_0x8883('0x3'));var express=require(_0x8883('0x4'));var router=express['Router']();var auth=require(_0x8883('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8883('0x6'));var controller=require(_0x8883('0x7'));router[_0x8883('0x8')]('/',auth['isAuthenticated'](),controller[_0x8883('0x9')]);router[_0x8883('0x8')]('/describe',auth[_0x8883('0xa')](),controller[_0x8883('0xb')]);router[_0x8883('0x8')]('/:id',auth[_0x8883('0xa')](),controller[_0x8883('0xc')]);router[_0x8883('0xd')]('/',auth['isAuthenticated'](),controller[_0x8883('0xe')]);router[_0x8883('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8883('0x10')]);router[_0x8883('0x11')](_0x8883('0x12'),auth['isAuthenticated'](),controller[_0x8883('0x13')]);module[_0x8883('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 27ed9c3..697c573 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 _0xd61c=['noop','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5591cf,_0x4d0320){var _0x1c4cf0=function(_0x531cbf){while(--_0x531cbf){_0x5591cf['push'](_0x5591cf['shift']());}};_0x1c4cf0(++_0x4d0320);}(_0xd61c,0xb1));var _0xcd61=function(_0x3a9440,_0xd54c24){_0x3a9440=_0x3a9440-0x0;var _0x27d927=_0xd61c[_0x3a9440];return _0x27d927;};'use strict';var Sequelize=require(_0xcd61('0x0'));module[_0xcd61('0x1')]={'priority':{'type':Sequelize[_0xcd61('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcd61('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xcd61('0x4')]},'interval':{'type':Sequelize[_0xcd61('0x4')],'defaultValue':_0xcd61('0x5')}}; \ No newline at end of file +var _0xd287=['*,*,*,*','sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x3f4bc1,_0x15ace5){var _0x46fcf6=function(_0x3a19c1){while(--_0x3a19c1){_0x3f4bc1['push'](_0x3f4bc1['shift']());}};_0x46fcf6(++_0x15ace5);}(_0xd287,0x97));var _0x7d28=function(_0x3eca16,_0x5d8100){_0x3eca16=_0x3eca16-0x0;var _0x47eb8d=_0xd287[_0x3eca16];return _0x47eb8d;};'use strict';var Sequelize=require(_0x7d28('0x0'));module[_0x7d28('0x1')]={'priority':{'type':Sequelize[_0x7d28('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7d28('0x3')]()},'description':{'type':Sequelize[_0x7d28('0x4')]},'interval':{'type':Sequelize[_0x7d28('0x4')],'defaultValue':_0x7d28('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 6af5632..28b2f79 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 _0xea81=['Content-Range','apply','reject','save','update','then','destroy','end','stack','name','show','params','model','ChatApplication','query','filters','attributes','intersection','fields','length','includeAll','options','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0x40e847,_0x826366){var _0x3a6ece=function(_0x4ffb8a){while(--_0x4ffb8a){_0x40e847['push'](_0x40e847['shift']());}};_0x3a6ece(++_0x826366);}(_0xea81,0x1ed));var _0x1ea8=function(_0x213f91,_0x8f3782){_0x213f91=_0x213f91-0x0;var _0x5cf677=_0xea81[_0x213f91];return _0x5cf677;};'use strict';var pdf=require(_0x1ea8('0x0'));var emlformat=require(_0x1ea8('0x1'));var rimraf=require(_0x1ea8('0x2'));var zipdir=require(_0x1ea8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1ea8('0x4'));var BPromise=require(_0x1ea8('0x5'));var Mustache=require(_0x1ea8('0x6'));var util=require(_0x1ea8('0x7'));var path=require(_0x1ea8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ea8('0x9'));var squel=require(_0x1ea8('0xa'));var crypto=require(_0x1ea8('0xb'));var jsforce=require(_0x1ea8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1ea8('0xd'));var querystring=require(_0x1ea8('0xe'));var Papa=require(_0x1ea8('0xf'));var authService=require(_0x1ea8('0x10'));var hardwareService=require(_0x1ea8('0x11'));var Redis=require('ioredis');var qs=require(_0x1ea8('0x12'));var logger=require('../../config/logger')(_0x1ea8('0x13'));var utils=require(_0x1ea8('0x14'));var config=require(_0x1ea8('0x15'));var db=require(_0x1ea8('0x16'))['db'];function respondWithStatusCode(_0x90eccb,_0x5b35ea){_0x5b35ea=_0x5b35ea||0xcc;return function(_0x5a1f3e){if(_0x5a1f3e){return _0x90eccb[_0x1ea8('0x17')](_0x5b35ea);}return _0x90eccb[_0x1ea8('0x18')](_0x5b35ea)['end']();};}function respondWithResult(_0x2abad7,_0x431b97){_0x431b97=_0x431b97||0xc8;return function(_0x97d328){if(_0x97d328){return _0x2abad7[_0x1ea8('0x18')](_0x431b97)[_0x1ea8('0x19')](_0x97d328);}};}function respondWithFilteredResult(_0x5d0ef1,_0x25218d){return function(_0x3f9156){if(_0x3f9156){var _0x3e072d=_0x3f9156['count'],_0x4f1197=_0x25218d['offset'],_0x2d5b07=_0x25218d[_0x1ea8('0x1a')]+_0x25218d['limit'],_0x3a600c;if(_0x2d5b07>=_0x3e072d){_0x2d5b07=_0x3e072d;_0x3a600c=0xc8;}else{_0x3a600c=0xce;}_0x5d0ef1[_0x1ea8('0x18')](_0x3a600c);return _0x5d0ef1['set'](_0x1ea8('0x1b'),_0x4f1197+'-'+_0x2d5b07+'/'+_0x3e072d)[_0x1ea8('0x19')](_0x3f9156);}return null;};}function patchUpdates(_0xc9dabd){return function(_0xc24384){try{jsonpatch[_0x1ea8('0x1c')](_0xc24384,_0xc9dabd,!![]);}catch(_0x8db288){return BPromise[_0x1ea8('0x1d')](_0x8db288);}return _0xc24384[_0x1ea8('0x1e')]();};}function saveUpdates(_0x5344ca,_0x45db99){return function(_0x2a3b4c){if(_0x2a3b4c){return _0x2a3b4c[_0x1ea8('0x1f')](_0x5344ca)[_0x1ea8('0x20')](function(_0x106f33){return _0x106f33;});}return null;};}function removeEntity(_0x39fce5,_0x13e5fa){return function(_0x13f554){if(_0x13f554){return _0x13f554[_0x1ea8('0x21')]()[_0x1ea8('0x20')](function(){_0x39fce5['status'](0xcc)[_0x1ea8('0x22')]();});}};}function handleEntityNotFound(_0x489180,_0x4276f0){return function(_0x4e03ee){if(!_0x4e03ee){_0x489180[_0x1ea8('0x17')](0x194);}return _0x4e03ee;};}function handleError(_0x528ede,_0x1ce201){_0x1ce201=_0x1ce201||0x1f4;return function(_0x5106f7){logger['error'](_0x5106f7[_0x1ea8('0x23')]);if(_0x5106f7[_0x1ea8('0x24')]){delete _0x5106f7[_0x1ea8('0x24')];}_0x528ede['status'](_0x1ce201)['send'](_0x5106f7);};}exports[_0x1ea8('0x25')]=function(_0x386dce,_0x34e04b){var _0x226803={'raw':!![],'where':{'id':_0x386dce[_0x1ea8('0x26')]['id']}},_0x2e3fe6={};_0x2e3fe6[_0x1ea8('0x27')]=_['keys'](db[_0x1ea8('0x28')]['rawAttributes']);_0x2e3fe6[_0x1ea8('0x29')]=_['keys'](_0x386dce[_0x1ea8('0x29')]);_0x2e3fe6[_0x1ea8('0x2a')]=_['intersection'](_0x2e3fe6[_0x1ea8('0x27')],_0x2e3fe6[_0x1ea8('0x29')]);_0x226803[_0x1ea8('0x2b')]=_[_0x1ea8('0x2c')](_0x2e3fe6[_0x1ea8('0x27')],qs[_0x1ea8('0x2d')](_0x386dce[_0x1ea8('0x29')][_0x1ea8('0x2d')]));_0x226803[_0x1ea8('0x2b')]=_0x226803[_0x1ea8('0x2b')][_0x1ea8('0x2e')]?_0x226803[_0x1ea8('0x2b')]:_0x2e3fe6[_0x1ea8('0x27')];if(_0x386dce[_0x1ea8('0x29')][_0x1ea8('0x2f')]){_0x226803['include']=[{'all':!![]}];}_0x226803=_['merge']({},_0x226803,_0x386dce[_0x1ea8('0x30')]);return db['ChatApplication'][_0x1ea8('0x31')](_0x226803)[_0x1ea8('0x20')](handleEntityNotFound(_0x34e04b,null))[_0x1ea8('0x20')](respondWithResult(_0x34e04b,null))[_0x1ea8('0x32')](handleError(_0x34e04b,null));};exports['update']=function(_0x349f9c,_0x4ea0c0){if(_0x349f9c['body']['id']){delete _0x349f9c[_0x1ea8('0x33')]['id'];}return db[_0x1ea8('0x28')][_0x1ea8('0x31')]({'where':{'id':_0x349f9c[_0x1ea8('0x26')]['id']}})[_0x1ea8('0x20')](handleEntityNotFound(_0x4ea0c0,null))[_0x1ea8('0x20')](saveUpdates(_0x349f9c[_0x1ea8('0x33')],null))['then'](respondWithResult(_0x4ea0c0,null))[_0x1ea8('0x32')](handleError(_0x4ea0c0,null));};exports[_0x1ea8('0x21')]=function(_0x45564f,_0x4dd633){return db['ChatApplication'][_0x1ea8('0x31')]({'where':{'id':_0x45564f[_0x1ea8('0x26')]['id']}})[_0x1ea8('0x20')](handleEntityNotFound(_0x4dd633,null))['then'](removeEntity(_0x4dd633,null))[_0x1ea8('0x32')](handleError(_0x4dd633,null));}; \ No newline at end of file +var _0x9aa2=['reject','update','destroy','end','sendStatus','error','stack','name','show','params','model','ChatApplication','rawAttributes','query','keys','intersection','attributes','fields','length','includeAll','include','options','find','then','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','status','json','count','offset','Content-Range','apply'];(function(_0x2acc6e,_0x558f93){var _0x4f1f2b=function(_0x577641){while(--_0x577641){_0x2acc6e['push'](_0x2acc6e['shift']());}};_0x4f1f2b(++_0x558f93);}(_0x9aa2,0x194));var _0x29aa=function(_0x40eeb5,_0x50b494){_0x40eeb5=_0x40eeb5-0x0;var _0x3c9337=_0x9aa2[_0x40eeb5];return _0x3c9337;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x29aa('0x0'));var rimraf=require(_0x29aa('0x1'));var zipdir=require(_0x29aa('0x2'));var jsonpatch=require(_0x29aa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x29aa('0x4'));var Mustache=require('mustache');var util=require(_0x29aa('0x5'));var path=require(_0x29aa('0x6'));var sox=require(_0x29aa('0x7'));var csv=require(_0x29aa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x29aa('0x9'));var squel=require(_0x29aa('0xa'));var crypto=require(_0x29aa('0xb'));var jsforce=require(_0x29aa('0xc'));var deskjs=require(_0x29aa('0xd'));var toCsv=require(_0x29aa('0x8'));var querystring=require(_0x29aa('0xe'));var Papa=require(_0x29aa('0xf'));var authService=require(_0x29aa('0x10'));var hardwareService=require(_0x29aa('0x11'));var Redis=require(_0x29aa('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x29aa('0x13'))(_0x29aa('0x14'));var utils=require(_0x29aa('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2861be,_0x46a1dd){_0x46a1dd=_0x46a1dd||0xcc;return function(_0x3cb282){if(_0x3cb282){return _0x2861be['sendStatus'](_0x46a1dd);}return _0x2861be[_0x29aa('0x16')](_0x46a1dd)['end']();};}function respondWithResult(_0x5b4821,_0x34ab76){_0x34ab76=_0x34ab76||0xc8;return function(_0x17bb42){if(_0x17bb42){return _0x5b4821[_0x29aa('0x16')](_0x34ab76)[_0x29aa('0x17')](_0x17bb42);}};}function respondWithFilteredResult(_0x48eadd,_0x467d64){return function(_0x849cf4){if(_0x849cf4){var _0x641655=_0x849cf4[_0x29aa('0x18')],_0x20047f=_0x467d64[_0x29aa('0x19')],_0x2c4d4c=_0x467d64['offset']+_0x467d64['limit'],_0x38a838;if(_0x2c4d4c>=_0x641655){_0x2c4d4c=_0x641655;_0x38a838=0xc8;}else{_0x38a838=0xce;}_0x48eadd[_0x29aa('0x16')](_0x38a838);return _0x48eadd['set'](_0x29aa('0x1a'),_0x20047f+'-'+_0x2c4d4c+'/'+_0x641655)[_0x29aa('0x17')](_0x849cf4);}return null;};}function patchUpdates(_0x19e809){return function(_0x302f70){try{jsonpatch[_0x29aa('0x1b')](_0x302f70,_0x19e809,!![]);}catch(_0x1a4163){return BPromise[_0x29aa('0x1c')](_0x1a4163);}return _0x302f70['save']();};}function saveUpdates(_0x371473,_0x1f382e){return function(_0x510ac0){if(_0x510ac0){return _0x510ac0[_0x29aa('0x1d')](_0x371473)['then'](function(_0x41e244){return _0x41e244;});}return null;};}function removeEntity(_0x1b083c,_0x400f68){return function(_0x4137f7){if(_0x4137f7){return _0x4137f7[_0x29aa('0x1e')]()['then'](function(){_0x1b083c[_0x29aa('0x16')](0xcc)[_0x29aa('0x1f')]();});}};}function handleEntityNotFound(_0x58cc39,_0x116d74){return function(_0x4cd18b){if(!_0x4cd18b){_0x58cc39[_0x29aa('0x20')](0x194);}return _0x4cd18b;};}function handleError(_0x4dd8e7,_0x47fc8c){_0x47fc8c=_0x47fc8c||0x1f4;return function(_0x26f604){logger[_0x29aa('0x21')](_0x26f604[_0x29aa('0x22')]);if(_0x26f604['name']){delete _0x26f604[_0x29aa('0x23')];}_0x4dd8e7[_0x29aa('0x16')](_0x47fc8c)['send'](_0x26f604);};}exports[_0x29aa('0x24')]=function(_0x13f3cc,_0x131d56){var _0x49b88b={'raw':!![],'where':{'id':_0x13f3cc[_0x29aa('0x25')]['id']}},_0x2ba26e={};_0x2ba26e[_0x29aa('0x26')]=_['keys'](db[_0x29aa('0x27')][_0x29aa('0x28')]);_0x2ba26e[_0x29aa('0x29')]=_[_0x29aa('0x2a')](_0x13f3cc[_0x29aa('0x29')]);_0x2ba26e['filters']=_[_0x29aa('0x2b')](_0x2ba26e[_0x29aa('0x26')],_0x2ba26e[_0x29aa('0x29')]);_0x49b88b[_0x29aa('0x2c')]=_['intersection'](_0x2ba26e[_0x29aa('0x26')],qs[_0x29aa('0x2d')](_0x13f3cc[_0x29aa('0x29')]['fields']));_0x49b88b[_0x29aa('0x2c')]=_0x49b88b[_0x29aa('0x2c')][_0x29aa('0x2e')]?_0x49b88b[_0x29aa('0x2c')]:_0x2ba26e['model'];if(_0x13f3cc[_0x29aa('0x29')][_0x29aa('0x2f')]){_0x49b88b[_0x29aa('0x30')]=[{'all':!![]}];}_0x49b88b=_['merge']({},_0x49b88b,_0x13f3cc[_0x29aa('0x31')]);return db[_0x29aa('0x27')][_0x29aa('0x32')](_0x49b88b)['then'](handleEntityNotFound(_0x131d56,null))[_0x29aa('0x33')](respondWithResult(_0x131d56,null))[_0x29aa('0x34')](handleError(_0x131d56,null));};exports['update']=function(_0x3ddb95,_0x1a0a7e){if(_0x3ddb95[_0x29aa('0x35')]['id']){delete _0x3ddb95[_0x29aa('0x35')]['id'];}return db[_0x29aa('0x27')]['find']({'where':{'id':_0x3ddb95[_0x29aa('0x25')]['id']}})['then'](handleEntityNotFound(_0x1a0a7e,null))[_0x29aa('0x33')](saveUpdates(_0x3ddb95['body'],null))['then'](respondWithResult(_0x1a0a7e,null))['catch'](handleError(_0x1a0a7e,null));};exports[_0x29aa('0x1e')]=function(_0x1fad58,_0x64d7ee){return db['ChatApplication']['find']({'where':{'id':_0x1fad58[_0x29aa('0x25')]['id']}})['then'](handleEntityNotFound(_0x64d7ee,null))['then'](removeEntity(_0x64d7ee,null))[_0x29aa('0x34')](handleError(_0x64d7ee,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f72a903..df307b5 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 _0xd1fc=['util','../../config/logger','bluebird','./chatApplication.attributes','ChatApplication'];(function(_0x5a7607,_0x2ebe67){var _0x4ca3a4=function(_0x341438){while(--_0x341438){_0x5a7607['push'](_0x5a7607['shift']());}};_0x4ca3a4(++_0x2ebe67);}(_0xd1fc,0x16d));var _0xcd1f=function(_0x3ad9b3,_0x5c76e9){_0x3ad9b3=_0x3ad9b3-0x0;var _0x4ef8d1=_0xd1fc[_0x3ad9b3];return _0x4ef8d1;};'use strict';var _=require('lodash');var util=require(_0xcd1f('0x0'));var logger=require(_0xcd1f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcd1f('0x2'));var rp=require('request-promise');var attributes=require(_0xcd1f('0x3'));module['exports']=function(_0x1f66bc,_0xb374ce){return _0x1f66bc['define'](_0xcd1f('0x4'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86b6=['chat_applications','../../config/logger','api','moment','bluebird','exports','ChatApplication'];(function(_0x3267d1,_0x173963){var _0x5762ef=function(_0x1fb818){while(--_0x1fb818){_0x3267d1['push'](_0x3267d1['shift']());}};_0x5762ef(++_0x173963);}(_0x86b6,0x1dd));var _0x686b=function(_0x1c8abb,_0x4fe2f9){_0x1c8abb=_0x1c8abb-0x0;var _0x58eb71=_0x86b6[_0x1c8abb];return _0x58eb71;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x686b('0x0'))(_0x686b('0x1'));var moment=require(_0x686b('0x2'));var BPromise=require(_0x686b('0x3'));var rp=require('request-promise');var attributes=require('./chatApplication.attributes');module[_0x686b('0x4')]=function(_0x9a15d2,_0x18fe33){return _0x9a15d2['define'](_0x686b('0x5'),attributes,{'tableName':_0x686b('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f954d26..048729d 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 _0x577e=['info','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x577e,0x154));var _0xe577=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x577e[_0x3bb5b4];return _0x586c60;};'use strict';var _=require(_0xe577('0x0'));var util=require(_0xe577('0x1'));var moment=require(_0xe577('0x2'));var BPromise=require(_0xe577('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe577('0x4'));var db=require(_0xe577('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe577('0x6'))(_0xe577('0x7'));var config=require(_0xe577('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe577('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a4014,_0x745820,_0x1df4cf){return new BPromise(function(_0x4256d4,_0x4dabf3){return client['request'](_0x5a4014,_0x1df4cf)[_0xe577('0xa')](function(_0x381ff4){logger['info'](_0xe577('0xb'),_0x745820,'request\x20sent');logger[_0xe577('0xc')](_0xe577('0xd'),_0x745820,'request\x20sent',JSON['stringify'](_0x381ff4));if(_0x381ff4[_0xe577('0xe')]){if(_0x381ff4[_0xe577('0xe')][_0xe577('0xf')]===0x1f4){logger[_0xe577('0xe')]('ChatApplication,\x20%s,\x20%s',_0x745820,_0x381ff4['error']['message']);return _0x4dabf3(_0x381ff4[_0xe577('0xe')][_0xe577('0x10')]);}logger[_0xe577('0xe')](_0xe577('0xb'),_0x745820,_0x381ff4[_0xe577('0xe')][_0xe577('0x10')]);return _0x4256d4(_0x381ff4['error'][_0xe577('0x10')]);}else{logger[_0xe577('0x11')](_0xe577('0xb'),_0x745820,_0xe577('0x12'));_0x4256d4(_0x381ff4[_0xe577('0x13')][_0xe577('0x10')]);}})[_0xe577('0x14')](function(_0x4c257c){logger[_0xe577('0xe')](_0xe577('0xb'),_0x745820,_0x4c257c);_0x4dabf3(_0x4c257c);});});} \ No newline at end of file +var _0x338b=['client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3aea4e,_0x3da357){var _0x2e9db0=function(_0x577203){while(--_0x577203){_0x3aea4e['push'](_0x3aea4e['shift']());}};_0x2e9db0(++_0x3da357);}(_0x338b,0xbc));var _0xb338=function(_0x2235db,_0x4a5c0b){_0x2235db=_0x2235db-0x0;var _0x160df0=_0x338b[_0x2235db];return _0x160df0;};'use strict';var _=require(_0xb338('0x0'));var util=require(_0xb338('0x1'));var moment=require(_0xb338('0x2'));var BPromise=require(_0xb338('0x3'));var rs=require(_0xb338('0x4'));var fs=require('fs');var Redis=require(_0xb338('0x5'));var db=require(_0xb338('0x6'))['db'];var utils=require(_0xb338('0x7'));var logger=require(_0xb338('0x8'))(_0xb338('0x9'));var config=require(_0xb338('0xa'));var jayson=require(_0xb338('0xb'));var client=jayson[_0xb338('0xc')][_0xb338('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5af1b6,_0x25532d,_0x58beb8){return new BPromise(function(_0x5bdc9,_0x466b62){return client[_0xb338('0xe')](_0x5af1b6,_0x58beb8)[_0xb338('0xf')](function(_0x247cd6){logger[_0xb338('0x10')](_0xb338('0x11'),_0x25532d,_0xb338('0x12'));logger[_0xb338('0x13')](_0xb338('0x14'),_0x25532d,_0xb338('0x12'),JSON['stringify'](_0x247cd6));if(_0x247cd6[_0xb338('0x15')]){if(_0x247cd6[_0xb338('0x15')][_0xb338('0x16')]===0x1f4){logger[_0xb338('0x15')](_0xb338('0x11'),_0x25532d,_0x247cd6[_0xb338('0x15')][_0xb338('0x17')]);return _0x466b62(_0x247cd6[_0xb338('0x15')]['message']);}logger[_0xb338('0x15')](_0xb338('0x11'),_0x25532d,_0x247cd6['error']['message']);return _0x5bdc9(_0x247cd6['error'][_0xb338('0x17')]);}else{logger[_0xb338('0x10')](_0xb338('0x11'),_0x25532d,'request\x20sent');_0x5bdc9(_0x247cd6['result'][_0xb338('0x17')]);}})[_0xb338('0x18')](function(_0x1bbd86){logger['error'](_0xb338('0x11'),_0x25532d,_0x1bbd86);_0x466b62(_0x1bbd86);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a943d5e..ffa7cb8 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 _0xccd5=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util'];(function(_0x32b301,_0x380389){var _0xd0c417=function(_0xd9cde3){while(--_0xd9cde3){_0x32b301['push'](_0x32b301['shift']());}};_0xd0c417(++_0x380389);}(_0xccd5,0x1ed));var _0x5ccd=function(_0x4489f2,_0x1f9128){_0x4489f2=_0x4489f2-0x0;var _0x5cc527=_0xccd5[_0x4489f2];return _0x5cc527;};'use strict';var multer=require(_0x5ccd('0x0'));var util=require(_0x5ccd('0x1'));var path=require('path');var timeout=require(_0x5ccd('0x2'));var express=require('express');var router=express[_0x5ccd('0x3')]();var auth=require(_0x5ccd('0x4'));var interaction=require(_0x5ccd('0x5'));var config=require('../../config/environment');var controller=require(_0x5ccd('0x6'));router[_0x5ccd('0x7')](_0x5ccd('0x8'),auth[_0x5ccd('0x9')](),controller[_0x5ccd('0xa')]);router[_0x5ccd('0xb')](_0x5ccd('0x8'),auth[_0x5ccd('0x9')](),controller['update']);router[_0x5ccd('0xc')](_0x5ccd('0x8'),auth[_0x5ccd('0x9')](),controller[_0x5ccd('0xd')]);module[_0x5ccd('0xe')]=router; \ No newline at end of file +var _0xf31d=['show','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0xf31d,0xf6));var _0xdf31=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0xf31d[_0x5466ab];return _0x40751a;};'use strict';var multer=require('multer');var util=require(_0xdf31('0x0'));var path=require(_0xdf31('0x1'));var timeout=require(_0xdf31('0x2'));var express=require(_0xdf31('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdf31('0x4'));var config=require(_0xdf31('0x5'));var controller=require(_0xdf31('0x6'));router[_0xdf31('0x7')]('/:id',auth[_0xdf31('0x8')](),controller[_0xdf31('0x9')]);router['put']('/:id',auth[_0xdf31('0x8')](),controller[_0xdf31('0xa')]);router[_0xdf31('0xb')](_0xdf31('0xc'),auth[_0xdf31('0x8')](),controller[_0xdf31('0xd')]);module[_0xdf31('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 8f6fcba..848ed9b 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 _0x4bc4=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1a3bce,_0x38d7be){var _0x6bb895=function(_0x2cfb8d){while(--_0x2cfb8d){_0x1a3bce['push'](_0x1a3bce['shift']());}};_0x6bb895(++_0x38d7be);}(_0x4bc4,0x17f));var _0x44bc=function(_0x31ca14,_0x3b0ec7){_0x31ca14=_0x31ca14-0x0;var _0x454a4c=_0x4bc4[_0x31ca14];return _0x454a4c;};'use strict';var Sequelize=require(_0x44bc('0x0'));module[_0x44bc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x44bc('0x2')]},'write':{'type':Sequelize[_0x44bc('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1e84=['STRING','sequelize','exports'];(function(_0x3de867,_0x1f61b0){var _0x2a2c44=function(_0x8af4e8){while(--_0x8af4e8){_0x3de867['push'](_0x3de867['shift']());}};_0x2a2c44(++_0x1f61b0);}(_0x1e84,0xeb));var _0x41e8=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0x1e84[_0x43a6cd];return _0x5acb36;};'use strict';var Sequelize=require(_0x41e8('0x0'));module[_0x41e8('0x1')]={'name':{'type':Sequelize[_0x41e8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x41e8('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index bb74ba0..fb2394b 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 _0x5109=['findOne','length','removeMembers','addMessage','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','defaults','redis','localhost','socket.io-emitter','register','client','http','request','then','request\x20sent','debug','error','code','message','ChatGroup,\x20%s,\x20%s','info','result','sendStatus','end','status','json','offset','limit','set','apply','reject','name','send','index','rawAttributes','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','ChatGroup','count','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers'];(function(_0x50ae40,_0x51bfa9){var _0xf78f91=function(_0x5ce751){while(--_0x5ce751){_0x50ae40['push'](_0x50ae40['shift']());}};_0xf78f91(++_0x51bfa9);}(_0x5109,0x1e7));var _0x9510=function(_0x3e1904,_0x117ed3){_0x3e1904=_0x3e1904-0x0;var _0x56f930=_0x5109[_0x3e1904];return _0x56f930;};'use strict';var pdf=require(_0x9510('0x0'));var emlformat=require(_0x9510('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9510('0x2'));var jsonpatch=require(_0x9510('0x3'));var rp=require(_0x9510('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9510('0x5'));var util=require('util');var path=require(_0x9510('0x6'));var sox=require('sox');var csv=require(_0x9510('0x7'));var ejs=require(_0x9510('0x8'));var fs=require('fs');var _=require(_0x9510('0x9'));var squel=require(_0x9510('0xa'));var crypto=require(_0x9510('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9510('0xc'));var authService=require(_0x9510('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x9510('0xe'));var qs=require(_0x9510('0xf'));var logger=require(_0x9510('0x10'))('api');var utils=require(_0x9510('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9510('0x12')](config[_0x9510('0x13')],{'host':_0x9510('0x14'),'port':0x18eb});var socket=require(_0x9510('0x15'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x9510('0x16')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9510('0x17')][_0x9510('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x28bacc,_0x1983e9,_0x4034cc,_0x51af78){return new BPromise(function(_0x560bd7,_0x2050e5){var _0x4aea54=_0x51af78||client;return _0x4aea54[_0x9510('0x19')](_0x28bacc,_0x4034cc)[_0x9510('0x1a')](function(_0x27ace3){logger['info']('ChatGroup,\x20%s,\x20%s',_0x1983e9,_0x9510('0x1b'));logger[_0x9510('0x1c')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1983e9,'request\x20sent',JSON['stringify'](_0x27ace3));if(_0x27ace3[_0x9510('0x1d')]){if(_0x27ace3[_0x9510('0x1d')][_0x9510('0x1e')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x1983e9,_0x27ace3[_0x9510('0x1d')][_0x9510('0x1f')]);return _0x2050e5(_0x27ace3[_0x9510('0x1d')][_0x9510('0x1f')]);}logger['error'](_0x9510('0x20'),_0x1983e9,_0x27ace3[_0x9510('0x1d')][_0x9510('0x1f')]);return _0x560bd7(_0x27ace3[_0x9510('0x1d')]['message']);}else{logger[_0x9510('0x21')](_0x9510('0x20'),_0x1983e9,_0x9510('0x1b'));_0x560bd7(_0x27ace3[_0x9510('0x22')][_0x9510('0x1f')]);}})['catch'](function(_0x28b26b){logger[_0x9510('0x1d')]('ChatGroup,\x20%s,\x20%s',_0x1983e9,_0x28b26b);_0x2050e5(_0x28b26b);});});}function respondWithStatusCode(_0x182e00,_0x139de8){_0x139de8=_0x139de8||0xcc;return function(_0x488c5d){if(_0x488c5d){return _0x182e00[_0x9510('0x23')](_0x139de8);}return _0x182e00['status'](_0x139de8)[_0x9510('0x24')]();};}function respondWithResult(_0x1402cb,_0x2d93d7){_0x2d93d7=_0x2d93d7||0xc8;return function(_0xa0dfd4){if(_0xa0dfd4){return _0x1402cb[_0x9510('0x25')](_0x2d93d7)[_0x9510('0x26')](_0xa0dfd4);}};}function respondWithFilteredResult(_0x509317,_0xd1404d){return function(_0x11b8b7){if(_0x11b8b7){var _0x49eed9=_0x11b8b7['count'],_0x186e16=_0xd1404d['offset'],_0x4aab35=_0xd1404d[_0x9510('0x27')]+_0xd1404d[_0x9510('0x28')],_0x1e3684;if(_0x4aab35>=_0x49eed9){_0x4aab35=_0x49eed9;_0x1e3684=0xc8;}else{_0x1e3684=0xce;}_0x509317[_0x9510('0x25')](_0x1e3684);return _0x509317[_0x9510('0x29')]('Content-Range',_0x186e16+'-'+_0x4aab35+'/'+_0x49eed9)[_0x9510('0x26')](_0x11b8b7);}return null;};}function patchUpdates(_0x2948d5){return function(_0x4503f8){try{jsonpatch[_0x9510('0x2a')](_0x4503f8,_0x2948d5,!![]);}catch(_0x21446f){return BPromise[_0x9510('0x2b')](_0x21446f);}return _0x4503f8['save']();};}function saveUpdates(_0x41f9fb,_0x4fd946){return function(_0xbf0392){if(_0xbf0392){return _0xbf0392['update'](_0x41f9fb)['then'](function(_0x148f25){return _0x148f25;});}return null;};}function removeEntity(_0x2287e8,_0x2ee564){return function(_0x130bd5){if(_0x130bd5){return _0x130bd5['destroy']()[_0x9510('0x1a')](function(){_0x2287e8[_0x9510('0x25')](0xcc)[_0x9510('0x24')]();});}};}function handleEntityNotFound(_0x262ef8,_0x5895a4){return function(_0x482687){if(!_0x482687){_0x262ef8[_0x9510('0x23')](0x194);}return _0x482687;};}function handleError(_0x2abbbc,_0x2e6261){_0x2e6261=_0x2e6261||0x1f4;return function(_0x51ec45){logger[_0x9510('0x1d')](_0x51ec45['stack']);if(_0x51ec45[_0x9510('0x2c')]){delete _0x51ec45['name'];}_0x2abbbc['status'](_0x2e6261)[_0x9510('0x2d')](_0x51ec45);};}exports[_0x9510('0x2e')]=function(_0x48ffc7,_0x34a0a4){var _0x35d33c={},_0x148677={},_0x3a586f={'count':0x0,'rows':[]};var _0x2841e2=db['ChatGroup'][_0x9510('0x2f')];_0x148677[_0x9510('0x30')]=_['keys'](_0x2841e2);_0x148677[_0x9510('0x31')]=_['keys'](_0x48ffc7[_0x9510('0x31')]);_0x148677[_0x9510('0x32')]=_['intersection'](_0x148677[_0x9510('0x30')],_0x148677[_0x9510('0x31')]);_0x35d33c[_0x9510('0x33')]=_[_0x9510('0x34')](_0x148677[_0x9510('0x30')],qs[_0x9510('0x35')](_0x48ffc7['query'][_0x9510('0x35')]));_0x35d33c[_0x9510('0x33')]=_0x35d33c[_0x9510('0x33')]['length']?_0x35d33c[_0x9510('0x33')]:_0x148677[_0x9510('0x30')];if(!_0x48ffc7[_0x9510('0x31')][_0x9510('0x36')](_0x9510('0x37'))){_0x35d33c['limit']=qs[_0x9510('0x28')](_0x48ffc7[_0x9510('0x31')][_0x9510('0x28')]);_0x35d33c[_0x9510('0x27')]=qs[_0x9510('0x27')](_0x48ffc7[_0x9510('0x31')]['offset']);}_0x35d33c[_0x9510('0x38')]=qs[_0x9510('0x39')](_0x48ffc7['query'][_0x9510('0x39')]);_0x35d33c[_0x9510('0x3a')]=qs[_0x9510('0x32')](_[_0x9510('0x3b')](_0x48ffc7['query'],_0x148677['filters']));if(_0x48ffc7[_0x9510('0x31')][_0x9510('0x3c')]){_0x35d33c[_0x9510('0x3a')]=_[_0x9510('0x3d')](_0x35d33c[_0x9510('0x3a')],{'$or':_[_0x9510('0x3e')](_0x2841e2,function(_0x22c617){if(_0x22c617[_0x9510('0x3f')][_0x9510('0x40')]!==_0x9510('0x41')){var _0x1b7e87={};_0x1b7e87[_0x22c617[_0x9510('0x42')]]={'$like':'%'+_0x48ffc7[_0x9510('0x31')][_0x9510('0x3c')]+'%'};return _0x1b7e87;}})});}_0x35d33c=_[_0x9510('0x3d')]({},_0x35d33c,_0x48ffc7['options']);var _0x2589d6={'where':_0x35d33c[_0x9510('0x3a')]};return db[_0x9510('0x43')]['count'](_0x2589d6)[_0x9510('0x1a')](function(_0x214ece){_0x3a586f[_0x9510('0x44')]=_0x214ece;if(_0x48ffc7[_0x9510('0x31')][_0x9510('0x45')]){_0x35d33c[_0x9510('0x46')]=[{'all':!![]}];}return db[_0x9510('0x43')][_0x9510('0x47')](_0x35d33c);})[_0x9510('0x1a')](function(_0x4c7991){_0x3a586f['rows']=_0x4c7991;return _0x3a586f;})[_0x9510('0x1a')](respondWithFilteredResult(_0x34a0a4,_0x35d33c))[_0x9510('0x48')](handleError(_0x34a0a4,null));};exports[_0x9510('0x49')]=function(_0x5ae18f,_0x146c26){var _0x4388ad={'raw':!![],'where':{'id':_0x5ae18f[_0x9510('0x4a')]['id']}},_0x2d2a6d={};_0x2d2a6d['model']=_[_0x9510('0x4b')](db[_0x9510('0x43')][_0x9510('0x2f')]);_0x2d2a6d[_0x9510('0x31')]=_[_0x9510('0x4b')](_0x5ae18f['query']);_0x2d2a6d[_0x9510('0x32')]=_[_0x9510('0x34')](_0x2d2a6d[_0x9510('0x30')],_0x2d2a6d['query']);_0x4388ad[_0x9510('0x33')]=_[_0x9510('0x34')](_0x2d2a6d[_0x9510('0x30')],qs[_0x9510('0x35')](_0x5ae18f['query'][_0x9510('0x35')]));_0x4388ad[_0x9510('0x33')]=_0x4388ad[_0x9510('0x33')]['length']?_0x4388ad[_0x9510('0x33')]:_0x2d2a6d[_0x9510('0x30')];if(_0x5ae18f[_0x9510('0x31')][_0x9510('0x45')]){_0x4388ad['include']=[{'all':!![]}];}_0x4388ad=_[_0x9510('0x3d')]({},_0x4388ad,_0x5ae18f[_0x9510('0x4c')]);return db[_0x9510('0x43')][_0x9510('0x4d')](_0x4388ad)[_0x9510('0x1a')](handleEntityNotFound(_0x146c26,null))['then'](respondWithResult(_0x146c26,null))[_0x9510('0x48')](handleError(_0x146c26,null));};exports[_0x9510('0x4e')]=function(_0x9b79cd,_0x21fbc5){return db[_0x9510('0x43')]['create'](_0x9b79cd[_0x9510('0x4f')],{})[_0x9510('0x1a')](respondWithResult(_0x21fbc5,0xc9))[_0x9510('0x48')](handleError(_0x21fbc5,null));};exports['update']=function(_0x5c2872,_0x3ccda1){if(_0x5c2872[_0x9510('0x4f')]['id']){delete _0x5c2872[_0x9510('0x4f')]['id'];}return db[_0x9510('0x43')][_0x9510('0x4d')]({'where':{'id':_0x5c2872[_0x9510('0x4a')]['id']}})[_0x9510('0x1a')](handleEntityNotFound(_0x3ccda1,null))[_0x9510('0x1a')](saveUpdates(_0x5c2872[_0x9510('0x4f')],null))[_0x9510('0x1a')](respondWithResult(_0x3ccda1,null))[_0x9510('0x48')](handleError(_0x3ccda1,null));};exports[_0x9510('0x50')]=function(_0x2e9c19,_0x4807bf){return db[_0x9510('0x43')][_0x9510('0x4d')]({'where':{'id':_0x2e9c19[_0x9510('0x4a')]['id']}})[_0x9510('0x1a')](handleEntityNotFound(_0x4807bf,null))[_0x9510('0x1a')](removeEntity(_0x4807bf,null))[_0x9510('0x48')](handleError(_0x4807bf,null));};exports[_0x9510('0x51')]=function(_0x2a71fc,_0x2188c3){return db['ChatGroup']['describe']()[_0x9510('0x1a')](respondWithResult(_0x2188c3,null))[_0x9510('0x48')](handleError(_0x2188c3,null));};exports[_0x9510('0x52')]=function(_0x34958a,_0x2879bb,_0x1188a1){return db[_0x9510('0x53')][_0x9510('0x44')]({'where':{'ChatGroupId':_0x34958a[_0x9510('0x4a')]['id'],'ToId':_0x34958a[_0x9510('0x54')]['id'],'read':![]}})[_0x9510('0x1a')](function(_0x3c3525){return{'id':_[_0x9510('0x55')](_0x34958a[_0x9510('0x4a')]['id']),'count':_0x3c3525};})[_0x9510('0x1a')](respondWithResult(_0x2879bb,null))[_0x9510('0x48')](handleError(_0x2879bb,null));};exports[_0x9510('0x56')]=function(_0x5e008c,_0x35e34b,_0x1fed2c){return db[_0x9510('0x43')]['find']({'where':{'id':_0x5e008c[_0x9510('0x4a')]['id']}})[_0x9510('0x1a')](handleEntityNotFound(_0x35e34b,null))['then'](function(_0x544dc7){if(_0x544dc7){return _0x544dc7[_0x9510('0x56')](_0x5e008c['body']['ids'],_['omit'](_0x5e008c[_0x9510('0x4f')],[_0x9510('0x57'),'id'])||{});}})[_0x9510('0x1a')](respondWithResult(_0x35e34b,null))[_0x9510('0x48')](handleError(_0x35e34b,null));};exports[_0x9510('0x58')]=function(_0x2376ca,_0x420e57,_0x4d7504){var _0x11da43={};var _0x6b4614={};var _0x3a9b05;var _0x3176d6;return db[_0x9510('0x43')][_0x9510('0x59')]({'where':{'id':_0x2376ca[_0x9510('0x4a')]['id']}})[_0x9510('0x1a')](handleEntityNotFound(_0x420e57,null))[_0x9510('0x1a')](function(_0x5251d7){if(_0x5251d7){_0x3a9b05=_0x5251d7;_0x6b4614[_0x9510('0x30')]=_['keys'](db['User'][_0x9510('0x2f')]);_0x6b4614[_0x9510('0x31')]=_[_0x9510('0x4b')](_0x2376ca[_0x9510('0x31')]);_0x6b4614[_0x9510('0x32')]=_[_0x9510('0x34')](_0x6b4614[_0x9510('0x30')],_0x6b4614[_0x9510('0x31')]);_0x11da43['attributes']=_[_0x9510('0x34')](_0x6b4614[_0x9510('0x30')],qs[_0x9510('0x35')](_0x2376ca[_0x9510('0x31')]['fields']));_0x11da43[_0x9510('0x33')]=_0x11da43[_0x9510('0x33')][_0x9510('0x5a')]?_0x11da43['attributes']:_0x6b4614[_0x9510('0x30')];_0x11da43[_0x9510('0x38')]=qs[_0x9510('0x39')](_0x2376ca[_0x9510('0x31')]['sort']);_0x11da43[_0x9510('0x3a')]=qs[_0x9510('0x32')](_['pick'](_0x2376ca['query'],_0x6b4614['filters']));if(_0x2376ca[_0x9510('0x31')][_0x9510('0x3c')]){_0x11da43[_0x9510('0x3a')]=_['merge'](_0x11da43[_0x9510('0x3a')],{'$or':_[_0x9510('0x3e')](_0x11da43['attributes'],function(_0x45d6b5){var _0x3eaf41={};_0x3eaf41[_0x45d6b5]={'$like':'%'+_0x2376ca[_0x9510('0x31')][_0x9510('0x3c')]+'%'};return _0x3eaf41;})});}_0x11da43=_[_0x9510('0x3d')]({},_0x11da43,_0x2376ca['options']);return _0x3a9b05[_0x9510('0x58')](_0x11da43);}})[_0x9510('0x1a')](function(_0xf3de4e){if(_0xf3de4e){_0x3176d6=_0xf3de4e[_0x9510('0x5a')];if(!_0x2376ca['query']['hasOwnProperty']('nolimit')){_0x11da43[_0x9510('0x28')]=qs[_0x9510('0x28')](_0x2376ca['query'][_0x9510('0x28')]);_0x11da43[_0x9510('0x27')]=qs['offset'](_0x2376ca[_0x9510('0x31')]['offset']);}return _0x3a9b05[_0x9510('0x58')](_0x11da43);}})[_0x9510('0x1a')](function(_0x2f6ddc){if(_0x2f6ddc){return _0x2f6ddc?{'count':_0x3176d6,'rows':_0x2f6ddc}:null;}})[_0x9510('0x1a')](respondWithResult(_0x420e57,null))['catch'](handleError(_0x420e57,null));};exports[_0x9510('0x5b')]=function(_0x1aac73,_0x482a3a,_0x1ce4c1){var _0x6ceec9;return db['ChatGroup'][_0x9510('0x4d')]({'where':{'id':_0x1aac73[_0x9510('0x4a')]['id']}})[_0x9510('0x1a')](handleEntityNotFound(_0x482a3a,null))[_0x9510('0x1a')](function(_0x307af5){if(_0x307af5){return _0x307af5[_0x9510('0x5b')](_0x1aac73[_0x9510('0x31')][_0x9510('0x57')]);}})[_0x9510('0x1a')](respondWithStatusCode(_0x482a3a,null))['catch'](handleError(_0x482a3a,null));};exports[_0x9510('0x5c')]=function(_0x1dbd51,_0x37757e,_0x4d2577){if(_0x1dbd51[_0x9510('0x4f')]['id']){delete _0x1dbd51[_0x9510('0x4f')]['id'];}return db[_0x9510('0x43')][_0x9510('0x4d')]({'where':{'id':_0x1dbd51[_0x9510('0x4a')]['id']}})[_0x9510('0x1a')](handleEntityNotFound(_0x37757e,null))['then'](function(_0x18718c){if(_0x18718c){_0x1dbd51[_0x9510('0x4f')]['ChatGroupId']=_0x18718c['id'];return db[_0x9510('0x53')][_0x9510('0x4e')](_0x1dbd51['body']);}})[_0x9510('0x1a')](respondWithResult(_0x37757e,null))['catch'](handleError(_0x37757e,null));};exports[_0x9510('0x5d')]=function(_0x4fd236,_0xa700ac,_0x3a1c79){var _0x240d8f={};var _0x5287c3={};var _0xc5727;var _0x24b8bc;return db[_0x9510('0x43')]['findOne']({'where':{'id':_0x4fd236[_0x9510('0x4a')]['id']}})[_0x9510('0x1a')](handleEntityNotFound(_0xa700ac,null))['then'](function(_0x2a5d2e){if(_0x2a5d2e){_0xc5727=_0x2a5d2e;_0x5287c3[_0x9510('0x30')]=_[_0x9510('0x4b')](db[_0x9510('0x53')][_0x9510('0x2f')]);_0x5287c3[_0x9510('0x31')]=_[_0x9510('0x4b')](_0x4fd236[_0x9510('0x31')]);_0x5287c3[_0x9510('0x32')]=_[_0x9510('0x34')](_0x5287c3[_0x9510('0x30')],_0x5287c3['query']);_0x240d8f[_0x9510('0x33')]=_[_0x9510('0x34')](_0x5287c3['model'],qs[_0x9510('0x35')](_0x4fd236[_0x9510('0x31')][_0x9510('0x35')]));_0x240d8f[_0x9510('0x33')]=_0x240d8f[_0x9510('0x33')][_0x9510('0x5a')]?_0x240d8f[_0x9510('0x33')]:_0x5287c3[_0x9510('0x30')];_0x240d8f[_0x9510('0x38')]=qs[_0x9510('0x39')](_0x4fd236['query'][_0x9510('0x39')]);_0x240d8f[_0x9510('0x3a')]=qs['filters'](_[_0x9510('0x3b')](_0x4fd236[_0x9510('0x31')],_0x5287c3[_0x9510('0x32')]));if(_0x4fd236['query'][_0x9510('0x3c')]){_0x240d8f[_0x9510('0x3a')]=_['merge'](_0x240d8f[_0x9510('0x3a')],{'$or':_[_0x9510('0x3e')](_0x240d8f[_0x9510('0x33')],function(_0x14c3af){var _0x12d85a={};_0x12d85a[_0x14c3af]={'$like':'%'+_0x4fd236[_0x9510('0x31')]['filter']+'%'};return _0x12d85a;})});}if(_0x4fd236['query']['$gte']){var _0x3b1b90=_0x4fd236[_0x9510('0x31')]['$gte']['split'](',');var _0x381007={};_0x381007[_0x3b1b90[0x0]]={'$gte':moment(_0x3b1b90[0x1])[_0x9510('0x5e')](_0x9510('0x5f'))};_0x240d8f['where']=_[_0x9510('0x3d')](_0x240d8f['where'],_0x381007);}_0x240d8f=_[_0x9510('0x3d')]({},_0x240d8f,_0x4fd236[_0x9510('0x4c')]);return _0xc5727[_0x9510('0x5d')](_0x240d8f);}})[_0x9510('0x1a')](function(_0x5e2c63){if(_0x5e2c63){_0x24b8bc=_0x5e2c63[_0x9510('0x5a')];if(!_0x4fd236[_0x9510('0x31')][_0x9510('0x36')]('nolimit')){_0x240d8f[_0x9510('0x28')]=qs[_0x9510('0x28')](_0x4fd236[_0x9510('0x31')][_0x9510('0x28')]);_0x240d8f['offset']=qs[_0x9510('0x27')](_0x4fd236['query'][_0x9510('0x27')]);}return _0xc5727['getMessages'](_0x240d8f);}})[_0x9510('0x1a')](function(_0xcb5f8){if(_0xcb5f8){return _0xcb5f8?{'count':_0x24b8bc,'rows':_0xcb5f8}:null;}})[_0x9510('0x1a')](respondWithResult(_0xa700ac,null))[_0x9510('0x48')](handleError(_0xa700ac,null));}; \ No newline at end of file +var _0xd0d7=['client','http','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatGroup,\x20%s,\x20%s','result','sendStatus','json','offset','limit','status','set','Content-Range','save','destroy','end','stack','name','send','index','ChatGroup','rawAttributes','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','merge','map','key','VIRTUAL','field','filter','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','$gte','format','getMessages','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','jayson/promise'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xd0d7,0x126));var _0x7d0d=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0xd0d7[_0x421e36];return _0x20b3e3;};'use strict';var pdf=require(_0x7d0d('0x0'));var emlformat=require(_0x7d0d('0x1'));var rimraf=require(_0x7d0d('0x2'));var zipdir=require(_0x7d0d('0x3'));var jsonpatch=require(_0x7d0d('0x4'));var rp=require(_0x7d0d('0x5'));var moment=require(_0x7d0d('0x6'));var BPromise=require(_0x7d0d('0x7'));var Mustache=require('mustache');var util=require(_0x7d0d('0x8'));var path=require(_0x7d0d('0x9'));var sox=require(_0x7d0d('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7d0d('0xb'));var crypto=require(_0x7d0d('0xc'));var jsforce=require(_0x7d0d('0xd'));var deskjs=require(_0x7d0d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7d0d('0xf'));var Papa=require(_0x7d0d('0x10'));var authService=require(_0x7d0d('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x7d0d('0x12'));var qs=require(_0x7d0d('0x13'));var logger=require(_0x7d0d('0x14'))(_0x7d0d('0x15'));var utils=require(_0x7d0d('0x16'));var config=require('../../config/environment');var db=require(_0x7d0d('0x17'))['db'];config[_0x7d0d('0x18')]=_[_0x7d0d('0x19')](config['redis'],{'host':_0x7d0d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7d0d('0x1b'))[_0x7d0d('0x1c')](socket);var jayson=require(_0x7d0d('0x1d'));var client=jayson[_0x7d0d('0x1e')][_0x7d0d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x180cd9,_0x4a20ed,_0x2980cb,_0x42f2e8){return new BPromise(function(_0x3f8570,_0x2de9e9){var _0x29c280=_0x42f2e8||client;return _0x29c280['request'](_0x180cd9,_0x2980cb)[_0x7d0d('0x20')](function(_0x584c96){logger[_0x7d0d('0x21')]('ChatGroup,\x20%s,\x20%s',_0x4a20ed,'request\x20sent');logger[_0x7d0d('0x22')](_0x7d0d('0x23'),_0x4a20ed,_0x7d0d('0x24'),JSON[_0x7d0d('0x25')](_0x584c96));if(_0x584c96[_0x7d0d('0x26')]){if(_0x584c96[_0x7d0d('0x26')]['code']===0x1f4){logger[_0x7d0d('0x26')]('ChatGroup,\x20%s,\x20%s',_0x4a20ed,_0x584c96['error'][_0x7d0d('0x27')]);return _0x2de9e9(_0x584c96[_0x7d0d('0x26')][_0x7d0d('0x27')]);}logger['error'](_0x7d0d('0x28'),_0x4a20ed,_0x584c96[_0x7d0d('0x26')][_0x7d0d('0x27')]);return _0x3f8570(_0x584c96[_0x7d0d('0x26')][_0x7d0d('0x27')]);}else{logger[_0x7d0d('0x21')](_0x7d0d('0x28'),_0x4a20ed,'request\x20sent');_0x3f8570(_0x584c96[_0x7d0d('0x29')][_0x7d0d('0x27')]);}})['catch'](function(_0x1ce088){logger[_0x7d0d('0x26')](_0x7d0d('0x28'),_0x4a20ed,_0x1ce088);_0x2de9e9(_0x1ce088);});});}function respondWithStatusCode(_0x580888,_0x326348){_0x326348=_0x326348||0xcc;return function(_0x1c6ca9){if(_0x1c6ca9){return _0x580888[_0x7d0d('0x2a')](_0x326348);}return _0x580888['status'](_0x326348)['end']();};}function respondWithResult(_0x59829c,_0x370134){_0x370134=_0x370134||0xc8;return function(_0x59e865){if(_0x59e865){return _0x59829c['status'](_0x370134)[_0x7d0d('0x2b')](_0x59e865);}};}function respondWithFilteredResult(_0x281ba3,_0x2fa836){return function(_0x25d840){if(_0x25d840){var _0x7ef5fe=_0x25d840['count'],_0x2e8428=_0x2fa836[_0x7d0d('0x2c')],_0x347102=_0x2fa836['offset']+_0x2fa836[_0x7d0d('0x2d')],_0x3561ee;if(_0x347102>=_0x7ef5fe){_0x347102=_0x7ef5fe;_0x3561ee=0xc8;}else{_0x3561ee=0xce;}_0x281ba3[_0x7d0d('0x2e')](_0x3561ee);return _0x281ba3[_0x7d0d('0x2f')](_0x7d0d('0x30'),_0x2e8428+'-'+_0x347102+'/'+_0x7ef5fe)[_0x7d0d('0x2b')](_0x25d840);}return null;};}function patchUpdates(_0x5b9228){return function(_0x19a719){try{jsonpatch['apply'](_0x19a719,_0x5b9228,!![]);}catch(_0x2341a0){return BPromise['reject'](_0x2341a0);}return _0x19a719[_0x7d0d('0x31')]();};}function saveUpdates(_0x311853,_0x16735d){return function(_0x309492){if(_0x309492){return _0x309492['update'](_0x311853)[_0x7d0d('0x20')](function(_0x42c46f){return _0x42c46f;});}return null;};}function removeEntity(_0x9a201,_0x4891f5){return function(_0x37b3b){if(_0x37b3b){return _0x37b3b[_0x7d0d('0x32')]()[_0x7d0d('0x20')](function(){_0x9a201[_0x7d0d('0x2e')](0xcc)[_0x7d0d('0x33')]();});}};}function handleEntityNotFound(_0x1d1890,_0x20bee1){return function(_0x35427c){if(!_0x35427c){_0x1d1890[_0x7d0d('0x2a')](0x194);}return _0x35427c;};}function handleError(_0x23ee09,_0x45fcdf){_0x45fcdf=_0x45fcdf||0x1f4;return function(_0x5d4a16){logger[_0x7d0d('0x26')](_0x5d4a16[_0x7d0d('0x34')]);if(_0x5d4a16[_0x7d0d('0x35')]){delete _0x5d4a16['name'];}_0x23ee09[_0x7d0d('0x2e')](_0x45fcdf)[_0x7d0d('0x36')](_0x5d4a16);};}exports[_0x7d0d('0x37')]=function(_0x53516d,_0x160046){var _0x4cf9fa={},_0x830241={},_0x8acf63={'count':0x0,'rows':[]};var _0x561152=db[_0x7d0d('0x38')][_0x7d0d('0x39')];_0x830241[_0x7d0d('0x3a')]=_[_0x7d0d('0x3b')](_0x561152);_0x830241['query']=_[_0x7d0d('0x3b')](_0x53516d['query']);_0x830241[_0x7d0d('0x3c')]=_[_0x7d0d('0x3d')](_0x830241[_0x7d0d('0x3a')],_0x830241['query']);_0x4cf9fa[_0x7d0d('0x3e')]=_['intersection'](_0x830241[_0x7d0d('0x3a')],qs[_0x7d0d('0x3f')](_0x53516d[_0x7d0d('0x40')][_0x7d0d('0x3f')]));_0x4cf9fa['attributes']=_0x4cf9fa[_0x7d0d('0x3e')][_0x7d0d('0x41')]?_0x4cf9fa[_0x7d0d('0x3e')]:_0x830241['model'];if(!_0x53516d['query'][_0x7d0d('0x42')]('nolimit')){_0x4cf9fa[_0x7d0d('0x2d')]=qs[_0x7d0d('0x2d')](_0x53516d[_0x7d0d('0x40')][_0x7d0d('0x2d')]);_0x4cf9fa[_0x7d0d('0x2c')]=qs[_0x7d0d('0x2c')](_0x53516d['query'][_0x7d0d('0x2c')]);}_0x4cf9fa[_0x7d0d('0x43')]=qs[_0x7d0d('0x44')](_0x53516d[_0x7d0d('0x40')]['sort']);_0x4cf9fa[_0x7d0d('0x45')]=qs[_0x7d0d('0x3c')](_[_0x7d0d('0x46')](_0x53516d[_0x7d0d('0x40')],_0x830241[_0x7d0d('0x3c')]));if(_0x53516d[_0x7d0d('0x40')]['filter']){_0x4cf9fa[_0x7d0d('0x45')]=_[_0x7d0d('0x47')](_0x4cf9fa[_0x7d0d('0x45')],{'$or':_[_0x7d0d('0x48')](_0x561152,function(_0x24dc65){if(_0x24dc65['type'][_0x7d0d('0x49')]!==_0x7d0d('0x4a')){var _0x32b139={};_0x32b139[_0x24dc65[_0x7d0d('0x4b')]]={'$like':'%'+_0x53516d[_0x7d0d('0x40')][_0x7d0d('0x4c')]+'%'};return _0x32b139;}})});}_0x4cf9fa=_['merge']({},_0x4cf9fa,_0x53516d['options']);var _0x206789={'where':_0x4cf9fa[_0x7d0d('0x45')]};return db[_0x7d0d('0x38')][_0x7d0d('0x4d')](_0x206789)[_0x7d0d('0x20')](function(_0x149aa3){_0x8acf63['count']=_0x149aa3;if(_0x53516d['query'][_0x7d0d('0x4e')]){_0x4cf9fa[_0x7d0d('0x4f')]=[{'all':!![]}];}return db[_0x7d0d('0x38')][_0x7d0d('0x50')](_0x4cf9fa);})[_0x7d0d('0x20')](function(_0x3ca372){_0x8acf63[_0x7d0d('0x51')]=_0x3ca372;return _0x8acf63;})[_0x7d0d('0x20')](respondWithFilteredResult(_0x160046,_0x4cf9fa))[_0x7d0d('0x52')](handleError(_0x160046,null));};exports[_0x7d0d('0x53')]=function(_0x3783b6,_0x487c6c){var _0x2a7140={'raw':!![],'where':{'id':_0x3783b6[_0x7d0d('0x54')]['id']}},_0x353e81={};_0x353e81[_0x7d0d('0x3a')]=_[_0x7d0d('0x3b')](db['ChatGroup'][_0x7d0d('0x39')]);_0x353e81[_0x7d0d('0x40')]=_['keys'](_0x3783b6['query']);_0x353e81['filters']=_[_0x7d0d('0x3d')](_0x353e81[_0x7d0d('0x3a')],_0x353e81['query']);_0x2a7140['attributes']=_[_0x7d0d('0x3d')](_0x353e81[_0x7d0d('0x3a')],qs[_0x7d0d('0x3f')](_0x3783b6[_0x7d0d('0x40')]['fields']));_0x2a7140['attributes']=_0x2a7140['attributes'][_0x7d0d('0x41')]?_0x2a7140[_0x7d0d('0x3e')]:_0x353e81['model'];if(_0x3783b6[_0x7d0d('0x40')][_0x7d0d('0x4e')]){_0x2a7140[_0x7d0d('0x4f')]=[{'all':!![]}];}_0x2a7140=_['merge']({},_0x2a7140,_0x3783b6[_0x7d0d('0x55')]);return db['ChatGroup'][_0x7d0d('0x56')](_0x2a7140)['then'](handleEntityNotFound(_0x487c6c,null))[_0x7d0d('0x20')](respondWithResult(_0x487c6c,null))[_0x7d0d('0x52')](handleError(_0x487c6c,null));};exports[_0x7d0d('0x57')]=function(_0x166abc,_0x57ecfc){return db[_0x7d0d('0x38')][_0x7d0d('0x57')](_0x166abc[_0x7d0d('0x58')],{})[_0x7d0d('0x20')](respondWithResult(_0x57ecfc,0xc9))[_0x7d0d('0x52')](handleError(_0x57ecfc,null));};exports[_0x7d0d('0x59')]=function(_0x485ada,_0x3b3a5b){if(_0x485ada[_0x7d0d('0x58')]['id']){delete _0x485ada[_0x7d0d('0x58')]['id'];}return db['ChatGroup'][_0x7d0d('0x56')]({'where':{'id':_0x485ada[_0x7d0d('0x54')]['id']}})[_0x7d0d('0x20')](handleEntityNotFound(_0x3b3a5b,null))[_0x7d0d('0x20')](saveUpdates(_0x485ada[_0x7d0d('0x58')],null))[_0x7d0d('0x20')](respondWithResult(_0x3b3a5b,null))['catch'](handleError(_0x3b3a5b,null));};exports[_0x7d0d('0x32')]=function(_0x5e5dd5,_0x5732a8){return db[_0x7d0d('0x38')]['find']({'where':{'id':_0x5e5dd5['params']['id']}})[_0x7d0d('0x20')](handleEntityNotFound(_0x5732a8,null))[_0x7d0d('0x20')](removeEntity(_0x5732a8,null))[_0x7d0d('0x52')](handleError(_0x5732a8,null));};exports[_0x7d0d('0x5a')]=function(_0xdab545,_0x2cb472){return db[_0x7d0d('0x38')]['describe']()['then'](respondWithResult(_0x2cb472,null))[_0x7d0d('0x52')](handleError(_0x2cb472,null));};exports[_0x7d0d('0x5b')]=function(_0x149d2a,_0x37d3b6,_0x554072){return db[_0x7d0d('0x5c')][_0x7d0d('0x4d')]({'where':{'ChatGroupId':_0x149d2a[_0x7d0d('0x54')]['id'],'ToId':_0x149d2a[_0x7d0d('0x5d')]['id'],'read':![]}})[_0x7d0d('0x20')](function(_0xc01ab4){return{'id':_[_0x7d0d('0x5e')](_0x149d2a['params']['id']),'count':_0xc01ab4};})[_0x7d0d('0x20')](respondWithResult(_0x37d3b6,null))[_0x7d0d('0x52')](handleError(_0x37d3b6,null));};exports['addMembers']=function(_0x3da59e,_0x1d6184,_0x27babc){return db[_0x7d0d('0x38')][_0x7d0d('0x56')]({'where':{'id':_0x3da59e[_0x7d0d('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d6184,null))[_0x7d0d('0x20')](function(_0xe24797){if(_0xe24797){return _0xe24797[_0x7d0d('0x5f')](_0x3da59e[_0x7d0d('0x58')][_0x7d0d('0x60')],_[_0x7d0d('0x61')](_0x3da59e[_0x7d0d('0x58')],[_0x7d0d('0x60'),'id'])||{});}})[_0x7d0d('0x20')](respondWithResult(_0x1d6184,null))[_0x7d0d('0x52')](handleError(_0x1d6184,null));};exports[_0x7d0d('0x62')]=function(_0x45ac93,_0x78efa0,_0x2678e8){var _0xb560d4={};var _0x22cf76={};var _0x283164;var _0x5d6a8a;return db['ChatGroup'][_0x7d0d('0x63')]({'where':{'id':_0x45ac93['params']['id']}})[_0x7d0d('0x20')](handleEntityNotFound(_0x78efa0,null))[_0x7d0d('0x20')](function(_0x3e017d){if(_0x3e017d){_0x283164=_0x3e017d;_0x22cf76[_0x7d0d('0x3a')]=_[_0x7d0d('0x3b')](db[_0x7d0d('0x64')][_0x7d0d('0x39')]);_0x22cf76[_0x7d0d('0x40')]=_[_0x7d0d('0x3b')](_0x45ac93[_0x7d0d('0x40')]);_0x22cf76['filters']=_['intersection'](_0x22cf76['model'],_0x22cf76[_0x7d0d('0x40')]);_0xb560d4['attributes']=_[_0x7d0d('0x3d')](_0x22cf76['model'],qs[_0x7d0d('0x3f')](_0x45ac93[_0x7d0d('0x40')]['fields']));_0xb560d4[_0x7d0d('0x3e')]=_0xb560d4[_0x7d0d('0x3e')][_0x7d0d('0x41')]?_0xb560d4[_0x7d0d('0x3e')]:_0x22cf76[_0x7d0d('0x3a')];_0xb560d4[_0x7d0d('0x43')]=qs[_0x7d0d('0x44')](_0x45ac93[_0x7d0d('0x40')][_0x7d0d('0x44')]);_0xb560d4[_0x7d0d('0x45')]=qs[_0x7d0d('0x3c')](_[_0x7d0d('0x46')](_0x45ac93[_0x7d0d('0x40')],_0x22cf76[_0x7d0d('0x3c')]));if(_0x45ac93['query'][_0x7d0d('0x4c')]){_0xb560d4['where']=_['merge'](_0xb560d4[_0x7d0d('0x45')],{'$or':_[_0x7d0d('0x48')](_0xb560d4[_0x7d0d('0x3e')],function(_0x58d1aa){var _0x594aba={};_0x594aba[_0x58d1aa]={'$like':'%'+_0x45ac93['query'][_0x7d0d('0x4c')]+'%'};return _0x594aba;})});}_0xb560d4=_[_0x7d0d('0x47')]({},_0xb560d4,_0x45ac93[_0x7d0d('0x55')]);return _0x283164[_0x7d0d('0x62')](_0xb560d4);}})[_0x7d0d('0x20')](function(_0x3da0e6){if(_0x3da0e6){_0x5d6a8a=_0x3da0e6[_0x7d0d('0x41')];if(!_0x45ac93[_0x7d0d('0x40')][_0x7d0d('0x42')]('nolimit')){_0xb560d4[_0x7d0d('0x2d')]=qs[_0x7d0d('0x2d')](_0x45ac93[_0x7d0d('0x40')]['limit']);_0xb560d4[_0x7d0d('0x2c')]=qs['offset'](_0x45ac93[_0x7d0d('0x40')]['offset']);}return _0x283164[_0x7d0d('0x62')](_0xb560d4);}})[_0x7d0d('0x20')](function(_0x50568b){if(_0x50568b){return _0x50568b?{'count':_0x5d6a8a,'rows':_0x50568b}:null;}})['then'](respondWithResult(_0x78efa0,null))[_0x7d0d('0x52')](handleError(_0x78efa0,null));};exports[_0x7d0d('0x65')]=function(_0x37f63e,_0x306dc7,_0x3b1cc8){var _0x2273a5;return db[_0x7d0d('0x38')]['find']({'where':{'id':_0x37f63e[_0x7d0d('0x54')]['id']}})[_0x7d0d('0x20')](handleEntityNotFound(_0x306dc7,null))[_0x7d0d('0x20')](function(_0x2acbdb){if(_0x2acbdb){return _0x2acbdb['removeMembers'](_0x37f63e[_0x7d0d('0x40')]['ids']);}})[_0x7d0d('0x20')](respondWithStatusCode(_0x306dc7,null))[_0x7d0d('0x52')](handleError(_0x306dc7,null));};exports[_0x7d0d('0x66')]=function(_0x2d5b6b,_0x2b3b4a,_0x29d5a3){if(_0x2d5b6b[_0x7d0d('0x58')]['id']){delete _0x2d5b6b['body']['id'];}return db[_0x7d0d('0x38')]['find']({'where':{'id':_0x2d5b6b[_0x7d0d('0x54')]['id']}})[_0x7d0d('0x20')](handleEntityNotFound(_0x2b3b4a,null))[_0x7d0d('0x20')](function(_0x4484ae){if(_0x4484ae){_0x2d5b6b[_0x7d0d('0x58')][_0x7d0d('0x67')]=_0x4484ae['id'];return db[_0x7d0d('0x5c')][_0x7d0d('0x57')](_0x2d5b6b[_0x7d0d('0x58')]);}})['then'](respondWithResult(_0x2b3b4a,null))[_0x7d0d('0x52')](handleError(_0x2b3b4a,null));};exports['getMessages']=function(_0x39f597,_0x28a33b,_0x40b77e){var _0x1a0f4c={};var _0x8d1e94={};var _0x478ef0;var _0x515025;return db['ChatGroup']['findOne']({'where':{'id':_0x39f597[_0x7d0d('0x54')]['id']}})['then'](handleEntityNotFound(_0x28a33b,null))[_0x7d0d('0x20')](function(_0x1f638a){if(_0x1f638a){_0x478ef0=_0x1f638a;_0x8d1e94['model']=_[_0x7d0d('0x3b')](db[_0x7d0d('0x5c')]['rawAttributes']);_0x8d1e94[_0x7d0d('0x40')]=_[_0x7d0d('0x3b')](_0x39f597[_0x7d0d('0x40')]);_0x8d1e94[_0x7d0d('0x3c')]=_[_0x7d0d('0x3d')](_0x8d1e94[_0x7d0d('0x3a')],_0x8d1e94[_0x7d0d('0x40')]);_0x1a0f4c[_0x7d0d('0x3e')]=_[_0x7d0d('0x3d')](_0x8d1e94['model'],qs[_0x7d0d('0x3f')](_0x39f597[_0x7d0d('0x40')]['fields']));_0x1a0f4c[_0x7d0d('0x3e')]=_0x1a0f4c[_0x7d0d('0x3e')]['length']?_0x1a0f4c[_0x7d0d('0x3e')]:_0x8d1e94[_0x7d0d('0x3a')];_0x1a0f4c[_0x7d0d('0x43')]=qs[_0x7d0d('0x44')](_0x39f597[_0x7d0d('0x40')]['sort']);_0x1a0f4c[_0x7d0d('0x45')]=qs['filters'](_[_0x7d0d('0x46')](_0x39f597[_0x7d0d('0x40')],_0x8d1e94[_0x7d0d('0x3c')]));if(_0x39f597[_0x7d0d('0x40')]['filter']){_0x1a0f4c[_0x7d0d('0x45')]=_[_0x7d0d('0x47')](_0x1a0f4c[_0x7d0d('0x45')],{'$or':_['map'](_0x1a0f4c['attributes'],function(_0x4c5cba){var _0x4e05fb={};_0x4e05fb[_0x4c5cba]={'$like':'%'+_0x39f597[_0x7d0d('0x40')][_0x7d0d('0x4c')]+'%'};return _0x4e05fb;})});}if(_0x39f597[_0x7d0d('0x40')][_0x7d0d('0x68')]){var _0x436238=_0x39f597[_0x7d0d('0x40')]['$gte']['split'](',');var _0x1e43c0={};_0x1e43c0[_0x436238[0x0]]={'$gte':moment(_0x436238[0x1])[_0x7d0d('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1a0f4c[_0x7d0d('0x45')]=_[_0x7d0d('0x47')](_0x1a0f4c[_0x7d0d('0x45')],_0x1e43c0);}_0x1a0f4c=_[_0x7d0d('0x47')]({},_0x1a0f4c,_0x39f597[_0x7d0d('0x55')]);return _0x478ef0[_0x7d0d('0x6a')](_0x1a0f4c);}})[_0x7d0d('0x20')](function(_0x19f4ff){if(_0x19f4ff){_0x515025=_0x19f4ff[_0x7d0d('0x41')];if(!_0x39f597[_0x7d0d('0x40')][_0x7d0d('0x42')](_0x7d0d('0x6b'))){_0x1a0f4c[_0x7d0d('0x2d')]=qs[_0x7d0d('0x2d')](_0x39f597['query'][_0x7d0d('0x2d')]);_0x1a0f4c['offset']=qs[_0x7d0d('0x2c')](_0x39f597[_0x7d0d('0x40')]['offset']);}return _0x478ef0['getMessages'](_0x1a0f4c);}})[_0x7d0d('0x20')](function(_0x347476){if(_0x347476){return _0x347476?{'count':_0x515025,'rows':_0x347476}:null;}})[_0x7d0d('0x20')](respondWithResult(_0x28a33b,null))['catch'](handleError(_0x28a33b,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 274d076..9be7300 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 _0x65fa=['ChatGroup','setMaxListeners','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1a761d,_0x3f9565){var _0x453ef2=function(_0x5e74d2){while(--_0x5e74d2){_0x1a761d['push'](_0x1a761d['shift']());}};_0x453ef2(++_0x3f9565);}(_0x65fa,0x16e));var _0xa65f=function(_0x357a74,_0x49ae28){_0x357a74=_0x357a74-0x0;var _0x431fbc=_0x65fa[_0x357a74];return _0x431fbc;};'use strict';var EventEmitter=require(_0xa65f('0x0'));var ChatGroup=require(_0xa65f('0x1'))['db'][_0xa65f('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xa65f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa65f('0x4')};function emitEvent(_0x3fc437){return function(_0x12c258,_0x2fe024,_0x2430c8){ChatGroupEvents['emit'](_0x3fc437+':'+_0x12c258['id'],_0x12c258);ChatGroupEvents['emit'](_0x3fc437,_0x12c258);_0x2430c8(null);};}for(var e in events){if(events[_0xa65f('0x5')](e)){var event=events[e];ChatGroup[_0xa65f('0x6')](e,emitEvent(event));}}module[_0xa65f('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x2c80=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x2c80,0x1cb));var _0x02c8=function(_0x19922e,_0x3d380d){_0x19922e=_0x19922e-0x0;var _0x1fe954=_0x2c80[_0x19922e];return _0x1fe954;};'use strict';var EventEmitter=require(_0x02c8('0x0'));var ChatGroup=require(_0x02c8('0x1'))['db'][_0x02c8('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x02c8('0x3')](0x0);var events={'afterCreate':_0x02c8('0x4'),'afterUpdate':_0x02c8('0x5'),'afterDestroy':_0x02c8('0x6')};function emitEvent(_0x599c07){return function(_0x5a86a5,_0x21ebda,_0x1f76ba){ChatGroupEvents[_0x02c8('0x7')](_0x599c07+':'+_0x5a86a5['id'],_0x5a86a5);ChatGroupEvents[_0x02c8('0x7')](_0x599c07,_0x5a86a5);_0x1f76ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x02c8('0x8')](e,emitEvent(event));}}module[_0x02c8('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 92049a3..d751f9b 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 _0xe961=['exports','define','chat_groups','util','../../config/logger','api','moment','request-promise','./chatGroup.attributes'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xe961,0x17d));var _0x1e96=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xe961[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require(_0x1e96('0x0'));var logger=require(_0x1e96('0x1'))(_0x1e96('0x2'));var moment=require(_0x1e96('0x3'));var BPromise=require('bluebird');var rp=require(_0x1e96('0x4'));var attributes=require(_0x1e96('0x5'));module[_0x1e96('0x6')]=function(_0xa8d425,_0x41f9cd){return _0xa8d425[_0x1e96('0x7')]('ChatGroup',attributes,{'tableName':_0x1e96('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c1d=['util','../../config/logger','api','moment','bluebird','./chatGroup.attributes','define','chat_groups','lodash'];(function(_0x4bef2c,_0x24b163){var _0x451c0f=function(_0x60ec06){while(--_0x60ec06){_0x4bef2c['push'](_0x4bef2c['shift']());}};_0x451c0f(++_0x24b163);}(_0x9c1d,0x179));var _0xd9c1=function(_0x34d6cd,_0x4590ec){_0x34d6cd=_0x34d6cd-0x0;var _0x5824df=_0x9c1d[_0x34d6cd];return _0x5824df;};'use strict';var _=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var logger=require(_0xd9c1('0x2'))(_0xd9c1('0x3'));var moment=require(_0xd9c1('0x4'));var BPromise=require(_0xd9c1('0x5'));var rp=require('request-promise');var attributes=require(_0xd9c1('0x6'));module['exports']=function(_0x29eb40,_0x12cd6a){return _0x29eb40[_0xd9c1('0x7')]('ChatGroup',attributes,{'tableName':_0xd9c1('0x8'),'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 29b2562..b64ab0b 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 _0x3435=['register','request','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','defaults','redis','localhost','socket.io-emitter'];(function(_0xaef08,_0x4ab990){var _0x3ab5af=function(_0xa48e84){while(--_0xa48e84){_0xaef08['push'](_0xaef08['shift']());}};_0x3ab5af(++_0x4ab990);}(_0x3435,0xfa));var _0x5343=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3435[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var moment=require(_0x5343('0x2'));var BPromise=require(_0x5343('0x3'));var rs=require(_0x5343('0x4'));var fs=require('fs');var Redis=require(_0x5343('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5343('0x6'));var logger=require(_0x5343('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5343('0x8'));var client=jayson[_0x5343('0x9')]['http']({'port':0x232a});config['redis']=_[_0x5343('0xa')](config[_0x5343('0xb')],{'host':_0x5343('0xc'),'port':0x18eb});var socket=require(_0x5343('0xd'))(new Redis(config[_0x5343('0xb')]));require('./chatGroup.socket')[_0x5343('0xe')](socket);function respondWithRpcPromise(_0x50d857,_0x1b310a,_0x328e54){return new BPromise(function(_0x27ed68,_0x2e6df1){return client[_0x5343('0xf')](_0x50d857,_0x328e54)['then'](function(_0x42a94a){logger[_0x5343('0x10')](_0x5343('0x11'),_0x1b310a,'request\x20sent');logger[_0x5343('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1b310a,_0x5343('0x13'),JSON[_0x5343('0x14')](_0x42a94a));if(_0x42a94a['error']){if(_0x42a94a[_0x5343('0x15')]['code']===0x1f4){logger[_0x5343('0x15')](_0x5343('0x11'),_0x1b310a,_0x42a94a[_0x5343('0x15')][_0x5343('0x16')]);return _0x2e6df1(_0x42a94a['error'][_0x5343('0x16')]);}logger[_0x5343('0x15')](_0x5343('0x11'),_0x1b310a,_0x42a94a[_0x5343('0x15')][_0x5343('0x16')]);return _0x27ed68(_0x42a94a[_0x5343('0x15')][_0x5343('0x16')]);}else{logger[_0x5343('0x10')]('ChatGroup,\x20%s,\x20%s',_0x1b310a,_0x5343('0x13'));_0x27ed68(_0x42a94a[_0x5343('0x17')][_0x5343('0x16')]);}})['catch'](function(_0x1eb3bd){logger[_0x5343('0x15')](_0x5343('0x11'),_0x1b310a,_0x1eb3bd);_0x2e6df1(_0x1eb3bd);});});} \ No newline at end of file +var _0x5fd1=['http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x258ba3,_0x2556d1){var _0x6f0e39=function(_0x935359){while(--_0x935359){_0x258ba3['push'](_0x258ba3['shift']());}};_0x6f0e39(++_0x2556d1);}(_0x5fd1,0x155));var _0x15fd=function(_0xfa05f9,_0x366925){_0xfa05f9=_0xfa05f9-0x0;var _0x4167c0=_0x5fd1[_0xfa05f9];return _0x4167c0;};'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});config[_0x15fd('0xa')]=_[_0x15fd('0xb')](config['redis'],{'host':_0x15fd('0xc'),'port':0x18eb});var socket=require(_0x15fd('0xd'))(new Redis(config[_0x15fd('0xa')]));require('./chatGroup.socket')[_0x15fd('0xe')](socket);function respondWithRpcPromise(_0x5c9c63,_0x3dfdbb,_0x250457){return new BPromise(function(_0x4c226a,_0x4883fd){return client['request'](_0x5c9c63,_0x250457)[_0x15fd('0xf')](function(_0x2a4d55){logger[_0x15fd('0x10')](_0x15fd('0x11'),_0x3dfdbb,_0x15fd('0x12'));logger[_0x15fd('0x13')](_0x15fd('0x14'),_0x3dfdbb,_0x15fd('0x12'),JSON[_0x15fd('0x15')](_0x2a4d55));if(_0x2a4d55['error']){if(_0x2a4d55['error']['code']===0x1f4){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);return _0x4883fd(_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);}logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55['error']['message']);return _0x4c226a(_0x2a4d55[_0x15fd('0x16')]['message']);}else{logger[_0x15fd('0x10')]('ChatGroup,\x20%s,\x20%s',_0x3dfdbb,_0x15fd('0x12'));_0x4c226a(_0x2a4d55[_0x15fd('0x18')][_0x15fd('0x17')]);}})['catch'](function(_0x367c36){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x367c36);_0x4883fd(_0x367c36);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 6348a9a..02ae4ed 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 _0x1db3=['emit','removeListener','register','length','chatGroup:','save','remove','update'];(function(_0x367df0,_0x1da548){var _0x35d629=function(_0x59a3a7){while(--_0x59a3a7){_0x367df0['push'](_0x367df0['shift']());}};_0x35d629(++_0x1da548);}(_0x1db3,0x1e5));var _0x31db=function(_0x21efcf,_0x7ea75c){_0x21efcf=_0x21efcf-0x0;var _0x3b9c35=_0x1db3[_0x21efcf];return _0x3b9c35;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x31db('0x0'),_0x31db('0x1'),_0x31db('0x2')];function createListener(_0x31ccc6,_0x840c38){return function(_0x4537f0){_0x840c38[_0x31db('0x3')](_0x31ccc6,_0x4537f0);};}function removeListener(_0x7041d7,_0x291c40){return function(){ChatGroupEvents[_0x31db('0x4')](_0x7041d7,_0x291c40);};}exports[_0x31db('0x5')]=function(_0x3f252a){for(var _0x2b4eb6=0x0,_0x156381=events[_0x31db('0x6')];_0x2b4eb6<_0x156381;_0x2b4eb6++){var _0x44e204=events[_0x2b4eb6];var _0x3a431e=createListener(_0x31db('0x7')+_0x44e204,_0x3f252a);ChatGroupEvents['on'](_0x44e204,_0x3a431e);}}; \ No newline at end of file +var _0xc91b=['save','remove','update','emit','removeListener','length','chatGroup:','./chatGroup.events'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0xc91b,0x16f));var _0xbc91=function(_0x1ffb8e,_0x295305){_0x1ffb8e=_0x1ffb8e-0x0;var _0x2457f2=_0xc91b[_0x1ffb8e];return _0x2457f2;};'use strict';var ChatGroupEvents=require(_0xbc91('0x0'));var events=[_0xbc91('0x1'),_0xbc91('0x2'),_0xbc91('0x3')];function createListener(_0x2a5f39,_0xb4810d){return function(_0x1ac340){_0xb4810d[_0xbc91('0x4')](_0x2a5f39,_0x1ac340);};}function removeListener(_0x5e8e01,_0x38fe3a){return function(){ChatGroupEvents[_0xbc91('0x5')](_0x5e8e01,_0x38fe3a);};}exports['register']=function(_0x222ed7){for(var _0x1e295b=0x0,_0x535cb9=events[_0xbc91('0x6')];_0x1e295b<_0x535cb9;_0x1e295b++){var _0x43731a=events[_0x1e295b];var _0x36e15f=createListener(_0xbc91('0x7')+_0x43731a,_0x222ed7);ChatGroupEvents['on'](_0x43731a,_0x36e15f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index c723b52..7e3bea1 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 _0xcf43=['put','delete','destroy','removeMembers','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMessages','post','create','addMembers'];(function(_0x4110a7,_0x4fc2aa){var _0x949463=function(_0x17d3ab){while(--_0x17d3ab){_0x4110a7['push'](_0x4110a7['shift']());}};_0x949463(++_0x4fc2aa);}(_0xcf43,0x14a));var _0x3cf4=function(_0x23855b,_0x110d7b){_0x23855b=_0x23855b-0x0;var _0x5dbac8=_0xcf43[_0x23855b];return _0x5dbac8;};'use strict';var multer=require(_0x3cf4('0x0'));var util=require('util');var path=require(_0x3cf4('0x1'));var timeout=require(_0x3cf4('0x2'));var express=require(_0x3cf4('0x3'));var router=express['Router']();var auth=require(_0x3cf4('0x4'));var interaction=require(_0x3cf4('0x5'));var config=require(_0x3cf4('0x6'));var controller=require('./chatGroup.controller');router[_0x3cf4('0x7')]('/',auth[_0x3cf4('0x8')](),controller[_0x3cf4('0x9')]);router[_0x3cf4('0x7')]('/describe',auth[_0x3cf4('0x8')](),controller[_0x3cf4('0xa')]);router['get'](_0x3cf4('0xb'),auth[_0x3cf4('0x8')](),controller[_0x3cf4('0xc')]);router[_0x3cf4('0x7')](_0x3cf4('0xd'),auth[_0x3cf4('0x8')](),controller[_0x3cf4('0xe')]);router['get'](_0x3cf4('0xf'),auth[_0x3cf4('0x8')](),controller['getMembers']);router[_0x3cf4('0x7')]('/:id/messages',auth[_0x3cf4('0x8')](),controller[_0x3cf4('0x10')]);router[_0x3cf4('0x11')]('/',auth['isAuthenticated'](),controller[_0x3cf4('0x12')]);router[_0x3cf4('0x11')](_0x3cf4('0xf'),auth[_0x3cf4('0x8')](),controller[_0x3cf4('0x13')]);router[_0x3cf4('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x3cf4('0x14')]('/:id',auth[_0x3cf4('0x8')](),controller['update']);router[_0x3cf4('0x15')](_0x3cf4('0xb'),auth[_0x3cf4('0x8')](),controller[_0x3cf4('0x16')]);router['delete'](_0x3cf4('0xf'),auth[_0x3cf4('0x8')](),controller[_0x3cf4('0x17')]);module[_0x3cf4('0x18')]=router; \ No newline at end of file +var _0xe159=['getMembers','/:id/messages','post','addMembers','addMessage','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/:id','show','/:id/unread','getUnread','/:id/members'];(function(_0x26a3a4,_0x253d57){var _0x2dbc4a=function(_0x514962){while(--_0x514962){_0x26a3a4['push'](_0x26a3a4['shift']());}};_0x2dbc4a(++_0x253d57);}(_0xe159,0x176));var _0x9e15=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe159[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x9e15('0x0'));var util=require(_0x9e15('0x1'));var path=require(_0x9e15('0x2'));var timeout=require(_0x9e15('0x3'));var express=require(_0x9e15('0x4'));var router=express[_0x9e15('0x5')]();var auth=require(_0x9e15('0x6'));var interaction=require(_0x9e15('0x7'));var config=require(_0x9e15('0x8'));var controller=require(_0x9e15('0x9'));router[_0x9e15('0xa')]('/',auth[_0x9e15('0xb')](),controller[_0x9e15('0xc')]);router[_0x9e15('0xa')]('/describe',auth[_0x9e15('0xb')](),controller['describe']);router['get'](_0x9e15('0xd'),auth['isAuthenticated'](),controller[_0x9e15('0xe')]);router[_0x9e15('0xa')](_0x9e15('0xf'),auth[_0x9e15('0xb')](),controller[_0x9e15('0x10')]);router[_0x9e15('0xa')](_0x9e15('0x11'),auth[_0x9e15('0xb')](),controller[_0x9e15('0x12')]);router[_0x9e15('0xa')](_0x9e15('0x13'),auth[_0x9e15('0xb')](),controller['getMessages']);router[_0x9e15('0x14')]('/',auth[_0x9e15('0xb')](),controller['create']);router[_0x9e15('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0x9e15('0x15')]);router[_0x9e15('0x14')]('/:id/messages',auth[_0x9e15('0xb')](),controller[_0x9e15('0x16')]);router[_0x9e15('0x17')]('/:id',auth[_0x9e15('0xb')](),controller[_0x9e15('0x18')]);router[_0x9e15('0x19')](_0x9e15('0xd'),auth[_0x9e15('0xb')](),controller[_0x9e15('0x1a')]);router[_0x9e15('0x19')]('/:id/members',auth[_0x9e15('0xb')](),controller['removeMembers']);module[_0x9e15('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 2244b44..b59b16c 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 _0x6c76=['BOOLEAN','ENUM','star','TEXT','DATE','STRING','long','out','sequelize','exports'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0x6c76,0x184));var _0x66c7=function(_0x2b0d35,_0x1969ae){_0x2b0d35=_0x2b0d35-0x0;var _0x763f30=_0x6c76[_0x2b0d35];return _0x763f30;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'closed':{'type':Sequelize[_0x66c7('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x66c7('0x3')](_0x66c7('0x4'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x66c7('0x5')]},'pathTranscript':{'type':Sequelize[_0x66c7('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x66c7('0x6')]},'disposition':{'type':Sequelize[_0x66c7('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x66c7('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x66c7('0x7')]},'deviceModel':{'type':Sequelize[_0x66c7('0x7')]},'deviceVendor':{'type':Sequelize[_0x66c7('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x66c7('0x7')]},'customerIp':{'type':Sequelize[_0x66c7('0x7')]},'formData':{'type':Sequelize[_0x66c7('0x5')](_0x66c7('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x66c7('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x66c7('0x3')]('in',_0x66c7('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x66c7('0x7')]}}; \ No newline at end of file +var _0x878f=['long','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x878f,0x173));var _0xf878=function(_0x2b966b,_0x23e116){_0x2b966b=_0x2b966b-0x0;var _0x336421=_0x878f[_0x2b966b];return _0x336421;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'closed':{'type':Sequelize[_0xf878('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xf878('0x2')]},'ratingType':{'type':Sequelize[_0xf878('0x3')](_0xf878('0x4'),_0xf878('0x5')),'defaultValue':_0xf878('0x4')},'ratingMessage':{'type':Sequelize[_0xf878('0x6')]},'pathTranscript':{'type':Sequelize[_0xf878('0x6')]},'mailTranscript':{'type':Sequelize[_0xf878('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf878('0x8')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xf878('0x7')]},'browserVersion':{'type':Sequelize[_0xf878('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xf878('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['STRING']},'customerIp':{'type':Sequelize[_0xf878('0x7')]},'formData':{'type':Sequelize[_0xf878('0x6')](_0xf878('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xf878('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xf878('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf878('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 62195dc..a642487 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 _0x2373=['sort','pick','where','merge','key','VIRTUAL','field','filter','options','include','tag','push','Tags','distinct','ChatMessage','Messages','direction','createdAt','read','User','Users','fullname','CmContact','Contact','Owner','ChatWebsite','Account','Tag','ThroughTags','color','findAll','rows','show','params','includeAll','find','create','body','describe','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','findOne','attachId','download','basename','close','join','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','ChatWebsiteId','ContactId','agentAlias','UserId','System','format','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','SendMail','sendMail','\x22%s\x22\x20<%s>','email','user','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','ChatInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','map','alias','addTags','setTags','emit','removeTags','toString','server','files','tmp','interaction-%s.zip','firstName','Letter','1cm','mkdirSync','

Chat\x20Interaction:\x20#%d

','
','','','createReadStream','pipe','toFile','interaction-','.pdf','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','name','send','ChatInteraction','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0xd02e66,_0x4b5c4c){var _0x3af15f=function(_0x4d3c9a){while(--_0x4d3c9a){_0xd02e66['push'](_0xd02e66['shift']());}};_0x3af15f(++_0x4b5c4c);}(_0x2373,0x144));var _0x3237=function(_0x219188,_0x350eae){_0x219188=_0x219188-0x0;var _0x16e584=_0x2373[_0x219188];return _0x16e584;};'use strict';var pdf=require(_0x3237('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3237('0x1'));var zipdir=require(_0x3237('0x2'));var jsonpatch=require(_0x3237('0x3'));var rp=require('request-promise');var moment=require(_0x3237('0x4'));var BPromise=require(_0x3237('0x5'));var Mustache=require(_0x3237('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3237('0x7'));var csv=require(_0x3237('0x8'));var ejs=require(_0x3237('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3237('0xa'));var crypto=require(_0x3237('0xb'));var jsforce=require(_0x3237('0xc'));var deskjs=require(_0x3237('0xd'));var toCsv=require(_0x3237('0x8'));var querystring=require(_0x3237('0xe'));var Papa=require(_0x3237('0xf'));var authService=require(_0x3237('0x10'));var hardwareService=require(_0x3237('0x11'));var Redis=require(_0x3237('0x12'));var qs=require(_0x3237('0x13'));var logger=require(_0x3237('0x14'))(_0x3237('0x15'));var utils=require(_0x3237('0x16'));var config=require(_0x3237('0x17'));var db=require(_0x3237('0x18'))['db'];config[_0x3237('0x19')]=_['defaults'](config[_0x3237('0x19')],{'host':_0x3237('0x1a'),'port':0x18eb});var socket=require(_0x3237('0x1b'))(new Redis(config[_0x3237('0x19')]));require(_0x3237('0x1c'))[_0x3237('0x1d')](socket);var jayson=require(_0x3237('0x1e'));var client=jayson[_0x3237('0x1f')]['http']({'port':0x232b});var client9004=jayson[_0x3237('0x1f')][_0x3237('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x4c6ec3,_0x434a51,_0x395fad,_0x491461){return new BPromise(function(_0x361b60,_0x538ee6){var _0x4ca690=_0x491461||client;return _0x4ca690['request'](_0x4c6ec3,_0x395fad)['then'](function(_0x4e9103){logger[_0x3237('0x21')](_0x3237('0x22'),_0x434a51,_0x3237('0x23'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x434a51,_0x3237('0x23'),JSON[_0x3237('0x24')](_0x4e9103));if(_0x4e9103[_0x3237('0x25')]){if(_0x4e9103[_0x3237('0x25')]['code']===0x1f4){logger['error'](_0x3237('0x22'),_0x434a51,_0x4e9103[_0x3237('0x25')]['message']);return _0x538ee6(_0x4e9103[_0x3237('0x25')][_0x3237('0x26')]);}logger[_0x3237('0x25')](_0x3237('0x22'),_0x434a51,_0x4e9103[_0x3237('0x25')][_0x3237('0x26')]);return _0x361b60(_0x4e9103['error'][_0x3237('0x26')]);}else{logger['info'](_0x3237('0x22'),_0x434a51,_0x3237('0x23'));_0x361b60(_0x4e9103['result'][_0x3237('0x26')]);}})[_0x3237('0x27')](function(_0x1374b2){logger['error'](_0x3237('0x22'),_0x434a51,_0x1374b2);_0x538ee6(_0x1374b2);});});}function respondWithStatusCode(_0x969ec2,_0x45ee24){_0x45ee24=_0x45ee24||0xcc;return function(_0x5e85d7){if(_0x5e85d7){return _0x969ec2[_0x3237('0x28')](_0x45ee24);}return _0x969ec2[_0x3237('0x29')](_0x45ee24)[_0x3237('0x2a')]();};}function respondWithResult(_0x2c02a3,_0x1e54c4){_0x1e54c4=_0x1e54c4||0xc8;return function(_0x189752){if(_0x189752){return _0x2c02a3['status'](_0x1e54c4)[_0x3237('0x2b')](_0x189752);}};}function respondWithFilteredResult(_0x863d97,_0x5a2119){return function(_0x3932ad){if(_0x3932ad){var _0x45ce9f=_0x3932ad[_0x3237('0x2c')],_0x476665=_0x5a2119[_0x3237('0x2d')],_0x4822c3=_0x5a2119[_0x3237('0x2d')]+_0x5a2119['limit'],_0x353d34;if(_0x4822c3>=_0x45ce9f){_0x4822c3=_0x45ce9f;_0x353d34=0xc8;}else{_0x353d34=0xce;}_0x863d97['status'](_0x353d34);return _0x863d97[_0x3237('0x2e')]('Content-Range',_0x476665+'-'+_0x4822c3+'/'+_0x45ce9f)[_0x3237('0x2b')](_0x3932ad);}return null;};}function patchUpdates(_0x2b7429){return function(_0x3d4f01){try{jsonpatch[_0x3237('0x2f')](_0x3d4f01,_0x2b7429,!![]);}catch(_0x54433e){return BPromise[_0x3237('0x30')](_0x54433e);}return _0x3d4f01[_0x3237('0x31')]();};}function saveUpdates(_0x3ecc95,_0x33245d){return function(_0x54cc12){if(_0x54cc12){return _0x54cc12[_0x3237('0x32')](_0x3ecc95)[_0x3237('0x33')](function(_0x24548d){return _0x24548d;});}return null;};}function removeEntity(_0x557f45,_0x1f7151){return function(_0x28b27d){if(_0x28b27d){return _0x28b27d['destroy']()[_0x3237('0x33')](function(){_0x557f45[_0x3237('0x29')](0xcc)[_0x3237('0x2a')]();});}};}function handleEntityNotFound(_0x38e6db,_0x14d397){return function(_0x4a52c3){if(!_0x4a52c3){_0x38e6db['sendStatus'](0x194);}return _0x4a52c3;};}function handleError(_0x1c013f,_0x16ab6b){_0x16ab6b=_0x16ab6b||0x1f4;return function(_0x122533){logger['error'](_0x122533['stack']);if(_0x122533[_0x3237('0x34')]){delete _0x122533['name'];}_0x1c013f[_0x3237('0x29')](_0x16ab6b)[_0x3237('0x35')](_0x122533);};}exports['index']=function(_0x2c6c28,_0x16725b){var _0x35ac17={},_0x2721cf={},_0x36f715={'count':0x0,'rows':[]};var _0x42245e=db[_0x3237('0x36')][_0x3237('0x37')];_0x2721cf[_0x3237('0x38')]=_[_0x3237('0x39')](_0x42245e);_0x2721cf[_0x3237('0x3a')]=_['keys'](_0x2c6c28[_0x3237('0x3a')]);_0x2721cf[_0x3237('0x3b')]=_[_0x3237('0x3c')](_0x2721cf['model'],_0x2721cf[_0x3237('0x3a')]);_0x35ac17[_0x3237('0x3d')]=_[_0x3237('0x3c')](_0x2721cf['model'],qs[_0x3237('0x3e')](_0x2c6c28['query'][_0x3237('0x3e')]));_0x35ac17['attributes']=_0x35ac17[_0x3237('0x3d')][_0x3237('0x3f')]?_0x35ac17[_0x3237('0x3d')]:_0x2721cf[_0x3237('0x38')];if(!_0x2c6c28[_0x3237('0x3a')][_0x3237('0x40')](_0x3237('0x41'))){_0x35ac17[_0x3237('0x42')]=qs[_0x3237('0x42')](_0x2c6c28[_0x3237('0x3a')][_0x3237('0x42')]);_0x35ac17['offset']=qs[_0x3237('0x2d')](_0x2c6c28[_0x3237('0x3a')][_0x3237('0x2d')]);}_0x35ac17[_0x3237('0x43')]=qs['sort'](_0x2c6c28[_0x3237('0x3a')][_0x3237('0x44')]);_0x35ac17['where']=qs[_0x3237('0x3b')](_[_0x3237('0x45')](_0x2c6c28[_0x3237('0x3a')],_0x2721cf[_0x3237('0x3b')]));if(_0x2c6c28[_0x3237('0x3a')]['filter']){_0x35ac17[_0x3237('0x46')]=_[_0x3237('0x47')](_0x35ac17[_0x3237('0x46')],{'$or':_['map'](_0x42245e,function(_0x2dafc4){if(_0x2dafc4['type'][_0x3237('0x48')]!==_0x3237('0x49')){var _0x34778e={};_0x34778e[_0x2dafc4[_0x3237('0x4a')]]={'$like':'%'+_0x2c6c28[_0x3237('0x3a')][_0x3237('0x4b')]+'%'};return _0x34778e;}})});}_0x35ac17=_[_0x3237('0x47')]({},_0x35ac17,_0x2c6c28[_0x3237('0x4c')]);var _0xbcd3ff={'where':_0x35ac17[_0x3237('0x46')]};_0xbcd3ff[_0x3237('0x4d')]=[];if(_0x2c6c28[_0x3237('0x3a')][_0x3237('0x4e')]){_0xbcd3ff[_0x3237('0x4d')][_0x3237('0x4f')]({'model':db['Tag'],'as':_0x3237('0x50'),'attributes':['id'],'where':{'id':_0x2c6c28[_0x3237('0x3a')][_0x3237('0x4e')]},'required':!![]});_0xbcd3ff[_0x3237('0x51')]=!![];}if(_0x2c6c28['query']['read']){_0xbcd3ff['include'][_0x3237('0x4f')]({'model':db[_0x3237('0x52')],'as':_0x3237('0x53'),'attributes':['id',_0x3237('0x54'),_0x3237('0x55'),_0x3237('0x56')],'where':{'direction':'in','read':_0x2c6c28[_0x3237('0x3a')][_0x3237('0x56')]||![]},'required':!![]});_0xbcd3ff[_0x3237('0x51')]=!![];}return db[_0x3237('0x36')][_0x3237('0x2c')](_0xbcd3ff)[_0x3237('0x33')](function(_0x2e639b){_0x36f715['count']=_0x2e639b;if(_0x2c6c28[_0x3237('0x3a')]['includeAll']){_0x35ac17[_0x3237('0x4d')]=[{'model':db[_0x3237('0x57')],'as':_0x3237('0x58'),'required':![],'attributes':['id',_0x3237('0x34'),_0x3237('0x59')]},{'model':db[_0x3237('0x5a')],'as':_0x3237('0x5b'),'required':![]},{'model':db['User'],'as':_0x3237('0x5c'),'attributes':[_0x3237('0x34'),_0x3237('0x59'),'internal'],'required':![]},{'model':db[_0x3237('0x5d')],'as':_0x3237('0x5e'),'attributes':[_0x3237('0x34'),'key'],'required':![]},{'model':db[_0x3237('0x52')],'as':'Messages','attributes':['id','direction',_0x3237('0x55'),_0x3237('0x56')],'where':{'direction':'in','read':_0x2c6c28[_0x3237('0x3a')][_0x3237('0x56')]||![]},'required':_0x2c6c28[_0x3237('0x3a')][_0x3237('0x56')]||![]},{'model':db[_0x3237('0x5f')],'as':_0x3237('0x50'),'attributes':['id',_0x3237('0x34'),'color'],'required':_0x2c6c28[_0x3237('0x3a')]['tag']?!![]:![]},{'model':db['Tag'],'as':_0x3237('0x60'),'attributes':['id',_0x3237('0x34'),_0x3237('0x61')],'through':_0x2c6c28['query'][_0x3237('0x4e')]?{'attributes':[],'where':{'TagId':_0x2c6c28[_0x3237('0x3a')]['tag']||undefined}}:{},'required':_0x2c6c28[_0x3237('0x3a')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0x3237('0x62')](_0x35ac17);})[_0x3237('0x33')](function(_0x58aade){_0x36f715[_0x3237('0x63')]=_0x58aade;return _0x36f715;})[_0x3237('0x33')](respondWithFilteredResult(_0x16725b,_0x35ac17))[_0x3237('0x27')](handleError(_0x16725b,null));};exports[_0x3237('0x64')]=function(_0x5314f9,_0x2e317f){var _0x5b1d00={'raw':![],'where':{'id':_0x5314f9[_0x3237('0x65')]['id']}},_0x4bd3f2={};_0x4bd3f2[_0x3237('0x38')]=_['keys'](db[_0x3237('0x36')][_0x3237('0x37')]);_0x4bd3f2[_0x3237('0x3a')]=_[_0x3237('0x39')](_0x5314f9[_0x3237('0x3a')]);_0x4bd3f2[_0x3237('0x3b')]=_[_0x3237('0x3c')](_0x4bd3f2[_0x3237('0x38')],_0x4bd3f2['query']);_0x5b1d00[_0x3237('0x3d')]=_[_0x3237('0x3c')](_0x4bd3f2[_0x3237('0x38')],qs[_0x3237('0x3e')](_0x5314f9[_0x3237('0x3a')][_0x3237('0x3e')]));_0x5b1d00['attributes']=_0x5b1d00[_0x3237('0x3d')][_0x3237('0x3f')]?_0x5b1d00[_0x3237('0x3d')]:_0x4bd3f2[_0x3237('0x38')];if(_0x5314f9[_0x3237('0x3a')][_0x3237('0x66')]){_0x5b1d00['include']=[{'all':!![]}];}_0x5b1d00=_['merge']({},_0x5b1d00,_0x5314f9[_0x3237('0x4c')]);return db[_0x3237('0x36')][_0x3237('0x67')](_0x5b1d00)[_0x3237('0x33')](handleEntityNotFound(_0x2e317f,null))['then'](respondWithResult(_0x2e317f,null))[_0x3237('0x27')](handleError(_0x2e317f,null));};exports[_0x3237('0x68')]=function(_0xdff4f6,_0x2071f2){return db[_0x3237('0x36')][_0x3237('0x68')](_0xdff4f6[_0x3237('0x69')],{})['then'](respondWithResult(_0x2071f2,0xc9))[_0x3237('0x27')](handleError(_0x2071f2,null));};exports[_0x3237('0x32')]=function(_0x3ec89f,_0x9c5ca6){if(_0x3ec89f[_0x3237('0x69')]['id']){delete _0x3ec89f[_0x3237('0x69')]['id'];}return db[_0x3237('0x36')][_0x3237('0x67')]({'where':{'id':_0x3ec89f[_0x3237('0x65')]['id']}})['then'](handleEntityNotFound(_0x9c5ca6,null))[_0x3237('0x33')](saveUpdates(_0x3ec89f[_0x3237('0x69')],null))[_0x3237('0x33')](respondWithResult(_0x9c5ca6,null))['catch'](handleError(_0x9c5ca6,null));};exports['destroy']=function(_0x1139bf,_0x56d92f){return db[_0x3237('0x36')][_0x3237('0x67')]({'where':{'id':_0x1139bf[_0x3237('0x65')]['id']}})[_0x3237('0x33')](handleEntityNotFound(_0x56d92f,null))[_0x3237('0x33')](removeEntity(_0x56d92f,null))[_0x3237('0x27')](handleError(_0x56d92f,null));};exports[_0x3237('0x6a')]=function(_0xd292d4,_0x2cf3e8){return db[_0x3237('0x36')][_0x3237('0x6a')]()['then'](respondWithResult(_0x2cf3e8,null))['catch'](handleError(_0x2cf3e8,null));};exports['customUpdate']=function(_0x3f20ed,_0x1706f4){if(_0x3f20ed[_0x3237('0x69')]['id']){delete _0x3f20ed[_0x3237('0x69')]['id'];}return db[_0x3237('0x36')][_0x3237('0x67')]({'where':{'id':_0x3f20ed[_0x3237('0x65')]['id']}})[_0x3237('0x33')](handleEntityNotFound(_0x1706f4,null))['then'](saveUpdates(_0x3f20ed[_0x3237('0x69')],null))[_0x3237('0x33')](respondWithResult(_0x1706f4,null))[_0x3237('0x27')](handleError(_0x1706f4,null));};exports[_0x3237('0x6b')]=function(_0x5ae242,_0x2fc875,_0x965b30){if(_0x5ae242[_0x3237('0x69')]['id']){delete _0x5ae242[_0x3237('0x69')]['id'];}return db['ChatInteraction'][_0x3237('0x67')]({'where':{'id':_0x5ae242[_0x3237('0x65')]['id']}})[_0x3237('0x33')](function(_0x388598){if(!_0x388598){logger[_0x3237('0x25')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x3237('0x6c'));_0x2fc875[_0x3237('0x28')](0x194);}else{if(_0x388598['UserId']){throw new db['Sequelize']['ValidationError'](_0x3237('0x6d'));}}return _0x388598;})[_0x3237('0x33')](function(_0x1cd3cf){if(_0x1cd3cf){return _0x1cd3cf[_0x3237('0x32')]({'closed':_0x5ae242['body'][_0x3237('0x6e')],'disposition':_0x5ae242['body'][_0x3237('0x6f')]})[_0x3237('0x33')](function(_0x329e9f){return _0x329e9f;});}})[_0x3237('0x33')](function(_0x2b41e4){return respondWithRpcPromise(_0x3237('0x70'),_0x3237('0x6b'),_0x5ae242[_0x3237('0x69')],client9004);})[_0x3237('0x33')](respondWithResult(_0x2fc875,null))[_0x3237('0x27')](handleError(_0x2fc875,null));};exports[_0x3237('0x71')]=function(_0x440c39,_0x494705,_0x578a49){_0x440c39[_0x3237('0x69')][_0x3237('0x34')]=_0x440c39['file'][_0x3237('0x72')];_0x440c39[_0x3237('0x69')]['basename']=_0x440c39[_0x3237('0x73')][_0x3237('0x74')];_0x440c39[_0x3237('0x69')]['type']=_0x440c39[_0x3237('0x73')][_0x3237('0x75')];return db[_0x3237('0x76')][_0x3237('0x68')](_0x440c39['body'])['then'](respondWithResult(_0x494705,0xc9))[_0x3237('0x27')](handleError(_0x494705,null));};exports[_0x3237('0x77')]=function(_0x2522da,_0x5c1421,_0x56d331){return db['ChatInteraction']['findOne']({'where':{'id':_0x2522da[_0x3237('0x65')]['id']},'raw':!![]})[_0x3237('0x33')](handleEntityNotFound(_0x5c1421,null))[_0x3237('0x33')](function(_0x39bca1){if(_0x39bca1){if(_0x39bca1[_0x3237('0x6e')]){return _0x5c1421[_0x3237('0x29')](0x193)[_0x3237('0x2b')]({'status':0x193,'message':_0x3237('0x78')});}return db['Attachment'][_0x3237('0x79')]({'where':{'id':_0x2522da['query'][_0x3237('0x7a')]},'raw':!![]})[_0x3237('0x33')](handleEntityNotFound(_0x5c1421,null));}})['then'](function(_0x5308f0){if(_0x5308f0){return _0x5c1421[_0x3237('0x7b')](path['join'](config['root'],'server/files/attachments/',_0x5308f0[_0x3237('0x7c')]));}})[_0x3237('0x27')](handleError(_0x5c1421,null));};exports[_0x3237('0x7d')]=function(_0x2b4710,_0x52c9d4){var _0x1276ec=null;var _0x108492=null;var _0x355eec=null;var _0x2dce61=null;if(_0x2b4710[_0x3237('0x69')]['id']){delete _0x2b4710['body']['id'];}if(_0x2b4710[_0x3237('0x69')]['mailTranscript']){_0x2dce61=path[_0x3237('0x7e')](config[_0x3237('0x7f')],_0x3237('0x80'),util['format'](_0x3237('0x81'),Date[_0x3237('0x82')]()));_0x2b4710['body'][_0x3237('0x83')]=_0x2dce61;}return db['ChatInteraction']['find']({'where':{'id':_0x2b4710['params']['id']},'include':[{'model':db[_0x3237('0x52')],'as':_0x3237('0x53'),'include':[{'model':db[_0x3237('0x57')],'as':_0x3237('0x57')}]}]})[_0x3237('0x33')](handleEntityNotFound(_0x52c9d4,null))[_0x3237('0x33')](saveUpdates(_0x2b4710[_0x3237('0x69')],null))[_0x3237('0x33')](function(_0x3ea25c){if(_0x3ea25c){_0x1276ec=_0x3ea25c;return db[_0x3237('0x5d')][_0x3237('0x67')]({'where':{'id':_0x1276ec[_0x3237('0x84')]}});}})[_0x3237('0x33')](function(_0x54d635){if(_0x54d635){_0x355eec=_0x54d635;return db[_0x3237('0x5a')]['find']({'where':{'id':_0x1276ec[_0x3237('0x85')]}});}})[_0x3237('0x33')](function(_0x44f748){if(_0x44f748){_0x108492=_0x44f748;if(_0x2dce61){var _0x315d37=null;for(var _0x4f482f=0x1;_0x4f482f<_0x1276ec[_0x3237('0x53')][_0x3237('0x3f')];++_0x4f482f){_0x315d37=_0x1276ec[_0x3237('0x53')][_0x4f482f];var _0x33fdb5=_0x315d37['UserId']?util['format']('%s%d',_0x355eec[_0x3237('0x86')],_0x315d37[_0x3237('0x87')]):_0x3237('0x88');var _0x37c642=_0x2b4710['body']['customer']||util[_0x3237('0x89')](_0x3237('0x8a'),_0x3237('0x8b'),_0x315d37[_0x3237('0x85')]);switch(_0x355eec[_0x3237('0x8c')]){case _0x3237('0x8d'):_0x33fdb5=_0x315d37[_0x3237('0x87')]?util[_0x3237('0x89')]('%s%d',_0x355eec[_0x3237('0x86')],_0x315d37[_0x3237('0x87')]):_0x3237('0x88');break;case _0x3237('0x8e'):_0x33fdb5=_0x315d37['UserId']?_0x315d37['User']['alias']||_0x315d37['User'][_0x3237('0x59')]:_0x3237('0x88');break;case _0x3237('0x8f'):_0x33fdb5=_0x315d37['UserId']?_0x315d37[_0x3237('0x57')][_0x3237('0x59')]:_0x3237('0x88');break;default:_0x33fdb5=_0x315d37['UserId']?util[_0x3237('0x89')](_0x3237('0x8a'),_0x355eec[_0x3237('0x86')],_0x315d37[_0x3237('0x87')]):'System';}var _0xde770a=util[_0x3237('0x89')](_0x3237('0x90'),moment(_0x315d37[_0x3237('0x55')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x315d37[_0x3237('0x54')]==='in'?_0x37c642:_0x33fdb5,_0x315d37['body']);if(!_0x315d37[_0x3237('0x91')]){fs['appendFileSync'](_0x2dce61,_0xde770a);}}return db[_0x3237('0x92')][_0x3237('0x79')]({'where':{'service':!![]},'include':[{'model':db[_0x3237('0x93')],'as':'Smtp','raw':!![]}]});}}})[_0x3237('0x33')](function(_0x56fed8){if(_0x56fed8&&_0x56fed8[_0x3237('0x94')]&&_0x2b4710[_0x3237('0x69')]){var _0x300645={'tls':{'rejectUnauthorized':![]}};if(_0x56fed8[_0x3237('0x94')][_0x3237('0x95')]){_0x300645[_0x3237('0x95')]=_0x56fed8[_0x3237('0x94')][_0x3237('0x95')];}else{_0x300645['host']=_0x56fed8[_0x3237('0x94')][_0x3237('0x96')];_0x300645[_0x3237('0x97')]=_0x56fed8[_0x3237('0x94')][_0x3237('0x97')];_0x300645['secure']=_0x56fed8['Smtp'][_0x3237('0x98')];}if(_0x56fed8[_0x3237('0x94')]['authentication']){_0x300645['auth']={'user':_0x56fed8[_0x3237('0x94')]['user'],'pass':_0x56fed8[_0x3237('0x94')]['pass']};}return respondWithRpcPromise(_0x3237('0x99'),_0x3237('0x9a'),{'account':_0x300645,'message':{'from':util[_0x3237('0x89')](_0x3237('0x9b'),_0x56fed8[_0x3237('0x34')],_0x56fed8[_0x3237('0x9c')]||_0x56fed8[_0x3237('0x94')][_0x3237('0x9d')]),'to':_0x2b4710['body'][_0x3237('0x9e')],'subject':_0x3237('0x9f'),'text':util[_0x3237('0x89')](_0x3237('0xa0'),_0x2b4710[_0x3237('0x69')][_0x3237('0x9e')]),'attachments':[{'path':_0x2dce61}]}})['then'](function(){return _0x1276ec;})['catch'](function(_0x1c5834){console[_0x3237('0x25')](_0x1c5834);});}else{return _0x1276ec;}})[_0x3237('0x33')](respondWithStatusCode(_0x52c9d4,0xc8))['catch'](handleError(_0x52c9d4,null));};exports[_0x3237('0xa1')]=function(_0x44a381,_0x57945e,_0x508e42){return db[_0x3237('0x52')][_0x3237('0x67')]({'where':{'id':_0x44a381[_0x3237('0x65')]['id']}})[_0x3237('0x33')](handleEntityNotFound(_0x57945e,null))[_0x3237('0x33')](function(_0x32d844){if(_0x32d844){return _0x32d844[_0x3237('0xa1')](_0x44a381[_0x3237('0x69')]['ids'],_[_0x3237('0xa2')](_0x44a381[_0x3237('0x69')],[_0x3237('0xa3'),'id'])||{});}})[_0x3237('0x33')](respondWithResult(_0x57945e,null))[_0x3237('0x27')](handleError(_0x57945e,null));};exports[_0x3237('0xa4')]=function(_0xdd3317,_0x3eb577,_0x103886){var _0x185111={'raw':![],'where':{}};var _0x3291f0={};var _0xe91098={'count':0x0,'rows':[]};return db[_0x3237('0x36')]['findOne']({'where':{'id':_0xdd3317[_0x3237('0x65')]['id']}})[_0x3237('0x33')](handleEntityNotFound(_0x3eb577,null))[_0x3237('0x33')](function(_0x25f763){if(_0x25f763){_0x3291f0[_0x3237('0x38')]=_[_0x3237('0x39')](db[_0x3237('0x52')]['rawAttributes']);_0x3291f0[_0x3237('0x3a')]=_[_0x3237('0x39')](_0xdd3317['query']);_0x3291f0[_0x3237('0x3b')]=_[_0x3237('0x3c')](_0x3291f0[_0x3237('0x38')],_0x3291f0[_0x3237('0x3a')]);_0x185111[_0x3237('0x3d')]=_[_0x3237('0x3c')](_0x3291f0['model'],qs[_0x3237('0x3e')](_0xdd3317[_0x3237('0x3a')][_0x3237('0x3e')]));_0x185111[_0x3237('0x3d')]=_0x185111[_0x3237('0x3d')][_0x3237('0x3f')]?_0x185111[_0x3237('0x3d')]:_0x3291f0['model'];if(!_0xdd3317[_0x3237('0x3a')][_0x3237('0x40')](_0x3237('0x41'))){_0x185111[_0x3237('0x42')]=qs[_0x3237('0x42')](_0xdd3317[_0x3237('0x3a')][_0x3237('0x42')]);_0x185111[_0x3237('0x2d')]=qs['offset'](_0xdd3317[_0x3237('0x3a')][_0x3237('0x2d')]);}_0x185111[_0x3237('0x43')]=qs['sort'](_0xdd3317[_0x3237('0x3a')][_0x3237('0x44')]);_0x185111[_0x3237('0x46')]=qs[_0x3237('0x3b')](_[_0x3237('0x45')](_0xdd3317[_0x3237('0x3a')],_0x3291f0[_0x3237('0x3b')]));_0x185111[_0x3237('0x46')][_0x3237('0xa5')]=_0x25f763['id'];if(_0xdd3317[_0x3237('0x3a')]['filter']){_0x185111[_0x3237('0x46')]=_[_0x3237('0x47')](_0x185111[_0x3237('0x46')],{'$or':_['map'](_0x185111[_0x3237('0x3d')],function(_0x5299dd){var _0x5ed9c8={};_0x5ed9c8[_0x5299dd]={'$like':'%'+_0xdd3317[_0x3237('0x3a')][_0x3237('0x4b')]+'%'};return _0x5ed9c8;})});}if(_0xdd3317[_0x3237('0x3a')][_0x3237('0xa6')]){var _0x2a71ba=_0xdd3317[_0x3237('0x3a')][_0x3237('0xa6')][_0x3237('0xa7')](',');var _0x5a6119={};_0x5a6119[_0x2a71ba[0x0]]={'$gte':moment(_0x2a71ba[0x1])[_0x3237('0x89')](_0x3237('0xa8'))};_0x185111['where']=_[_0x3237('0x47')](_0x185111[_0x3237('0x46')],_0x5a6119);}_0x185111=_['merge']({},_0x185111,_0xdd3317['options']);return db[_0x3237('0x52')][_0x3237('0x2c')]({'where':_0x185111[_0x3237('0x46')]})[_0x3237('0x33')](function(_0x55cd82){_0xe91098['count']=_0x55cd82;if(_0xdd3317[_0x3237('0x3a')][_0x3237('0x66')]){_0x185111[_0x3237('0x4d')]=[{'all':!![]}];}return db[_0x3237('0x52')][_0x3237('0x62')](_0x185111);})[_0x3237('0x33')](function(_0x477ad6){_0xe91098[_0x3237('0x63')]=_0x477ad6;return _0xe91098;});}})['then'](respondWithFilteredResult(_0x3eb577,_0x185111))[_0x3237('0x27')](handleError(_0x3eb577,null));};exports[_0x3237('0xa9')]=function(_0x40f332,_0x294270,_0x272329){var _0xd6efaf={'where':{}},_0x981b9a={},_0x9188ee={'count':0x0,'rows':[]};return db[_0x3237('0x36')]['findOne']({'where':{'id':_0x40f332['params']['id']}})[_0x3237('0x33')](handleEntityNotFound(_0x294270,null))[_0x3237('0x33')](function(_0x30e79d){if(_0x30e79d){_0x981b9a[_0x3237('0x38')]=_[_0x3237('0x39')](db[_0x3237('0x52')][_0x3237('0x37')]);_0x981b9a[_0x3237('0x3a')]=_['keys'](_0x40f332[_0x3237('0x3a')]);_0x981b9a[_0x3237('0x3b')]=_[_0x3237('0x3c')](_0x981b9a['model'],_0x981b9a[_0x3237('0x3a')]);_0xd6efaf[_0x3237('0x3d')]=_[_0x3237('0x3c')](_0x981b9a[_0x3237('0x38')],qs[_0x3237('0x3e')](_0x40f332[_0x3237('0x3a')][_0x3237('0x3e')]));_0xd6efaf[_0x3237('0x3d')]=_0xd6efaf[_0x3237('0x3d')][_0x3237('0x3f')]?_0xd6efaf[_0x3237('0x3d')]:_0x981b9a[_0x3237('0x38')];if(!_0x40f332[_0x3237('0x3a')][_0x3237('0x40')](_0x3237('0x41'))){_0xd6efaf[_0x3237('0x42')]=qs[_0x3237('0x42')](_0x40f332[_0x3237('0x3a')][_0x3237('0x42')]);_0xd6efaf[_0x3237('0x2d')]=qs[_0x3237('0x2d')](_0x40f332[_0x3237('0x3a')]['offset']);}_0xd6efaf[_0x3237('0x43')]=qs['sort'](_0x40f332[_0x3237('0x3a')][_0x3237('0x44')]);_0xd6efaf[_0x3237('0x46')]=qs[_0x3237('0x3b')](_[_0x3237('0x45')](_0x40f332[_0x3237('0x3a')],_0x981b9a[_0x3237('0x3b')]));_0xd6efaf[_0x3237('0x46')]['ChatInteractionId']=_0x30e79d['id'];if(_0x40f332[_0x3237('0x3a')][_0x3237('0x4b')]){_0xd6efaf[_0x3237('0x46')]=_[_0x3237('0x47')](_0xd6efaf[_0x3237('0x46')],{'$or':_[_0x3237('0xaa')](_0xd6efaf[_0x3237('0x3d')],function(_0x57a147){var _0x257dcf={};_0x257dcf[_0x57a147]={'$like':'%'+_0x40f332['query'][_0x3237('0x4b')]+'%'};return _0x257dcf;})});}_0xd6efaf[_0x3237('0x46')]['secret']=![];if(_0x40f332[_0x3237('0x3a')]['id']){_0xd6efaf[_0x3237('0x46')]['id']={'$gt':_0x40f332[_0x3237('0x3a')]['id']};}_0xd6efaf=_[_0x3237('0x47')]({},_0xd6efaf,_0x40f332[_0x3237('0x4c')]);return db[_0x3237('0x52')][_0x3237('0x2c')]({'where':_0xd6efaf[_0x3237('0x46')]})['then'](function(_0x6d735){_0x9188ee[_0x3237('0x2c')]=_0x6d735;_0xd6efaf[_0x3237('0x4d')]=[];if(_0x40f332['query']['includeAgent']){_0xd6efaf[_0x3237('0x4d')]['push']({'model':db[_0x3237('0x57')],'as':_0x3237('0x57'),'attributes':['id',_0x3237('0x59'),_0x3237('0xab')]});}if(_0x40f332[_0x3237('0x3a')][_0x3237('0x66')]){_0xd6efaf[_0x3237('0x4d')]=[{'all':!![]}];}return db[_0x3237('0x52')]['findAll'](_0xd6efaf);})[_0x3237('0x33')](function(_0x3a5fed){_0x9188ee[_0x3237('0x63')]=_0x3a5fed;return _0x9188ee;});}})[_0x3237('0x33')](respondWithFilteredResult(_0x294270,_0xd6efaf))[_0x3237('0x27')](handleError(_0x294270,null));};exports[_0x3237('0xac')]=function(_0x5c0c7c,_0x13e975,_0x4fab5a){return db['ChatInteraction'][_0x3237('0x67')]({'where':{'id':_0x5c0c7c[_0x3237('0x65')]['id']}})['then'](handleEntityNotFound(_0x13e975,null))[_0x3237('0x33')](function(_0x15f14e){if(_0x15f14e){return _0x15f14e[_0x3237('0xad')](_0x5c0c7c[_0x3237('0x69')]['ids'],_[_0x3237('0xa2')](_0x5c0c7c[_0x3237('0x69')],[_0x3237('0xa3'),'id'])||{})['spread'](function(){return db[_0x3237('0x5f')]['findAll']({'attributes':['id',_0x3237('0x34'),_0x3237('0x61')],'where':{'id':_0x5c0c7c['body'][_0x3237('0xa3')]}});})[_0x3237('0x33')](function(_0x5b6a13){socket[_0x3237('0xae')]('chatInteractionTags:save',{'id':Number(_0x5c0c7c[_0x3237('0x65')]['id']),'tags':_0x5b6a13||[]});return{'id':Number(_0x5c0c7c[_0x3237('0x65')]['id']),'tags':_0x5b6a13||[]};});}})[_0x3237('0x33')](respondWithResult(_0x13e975,null))['catch'](handleError(_0x13e975,null));};exports[_0x3237('0xaf')]=function(_0x409b75,_0x3db1d9,_0x3c8a8e){var _0x3e40f9;return db[_0x3237('0x36')][_0x3237('0x67')]({'where':{'id':_0x409b75['params']['id']}})[_0x3237('0x33')](handleEntityNotFound(_0x3db1d9,null))[_0x3237('0x33')](function(_0x33eee5){if(_0x33eee5){return _0x33eee5[_0x3237('0xaf')](_0x409b75[_0x3237('0x3a')][_0x3237('0xa3')]);}})[_0x3237('0x33')](respondWithStatusCode(_0x3db1d9,null))['catch'](handleError(_0x3db1d9,null));};exports[_0x3237('0x7b')]=function(_0x59cfbb,_0x35b75a){var _0x133c62=moment()['unix']()[_0x3237('0xb0')]();var _0x34104c=path[_0x3237('0x7e')](config['root'],_0x3237('0xb1'),_0x3237('0xb2'),_0x3237('0xb3'));var _0x1adf93=path['join'](config[_0x3237('0x7f')],_0x3237('0xb1'),'files','attachments');var _0x5edd38=path[_0x3237('0x7e')](_0x34104c,_0x133c62);var _0x2425c1=util['format'](_0x3237('0xb4'),_0x133c62);var _0x4df32c=path[_0x3237('0x7e')](_0x34104c,_0x2425c1);var _0xff432d=![];return db[_0x3237('0x36')]['find']({'where':{'id':_0x59cfbb[_0x3237('0x65')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x3237('0x53'),'attributes':['id','body'],'include':[{'model':db[_0x3237('0x57')],'as':_0x3237('0x57'),'attributes':['id',_0x3237('0x59')],'raw':!![]},{'model':db[_0x3237('0x5a')],'as':_0x3237('0x5b'),'attributes':['id',_0x3237('0xb5')],'raw':!![]},{'model':db['Attachment'],'as':_0x3237('0x76'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x35b75a,null))[_0x3237('0x33')](function(_0x572b4f){if(_0x572b4f){_0xff432d=!![];var _0x2f9ffe='';var _0x21933f={'format':_0x3237('0xb6'),'border':_0x3237('0xb7')};fs[_0x3237('0xb8')](_0x5edd38);_0x2f9ffe+=util['format'](_0x3237('0xb9'),_0x572b4f['id']);_0x2f9ffe+=util[_0x3237('0x89')]('

Date:\x20%s

',moment()[_0x3237('0x89')]('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')[_0x3237('0xb0')]());_0x2f9ffe+=_0x3237('0xba');for(var _0x56fce7=0x1;_0x56fce7<_0x572b4f['Messages'][_0x3237('0x3f')];_0x56fce7++){var _0xb4765f=_0x572b4f[_0x3237('0x53')][_0x56fce7];_0x2f9ffe+=_0x3237('0xbb');_0x2f9ffe+=util['format']('%s:\x20%s

',_0xb4765f[_0x3237('0x57')]?_0xb4765f['User'][_0x3237('0x59')]:_0xb4765f['Contact'][_0x3237('0xb5')],_0xb4765f[_0x3237('0x69')]);_0x2f9ffe+=_0x3237('0xbc');if(_0xb4765f[_0x3237('0x76')]){var _0x2220eb=_0xb4765f['Attachment'];var _0xc73ab3=path['join'](_0x1adf93,_0x2220eb[_0x3237('0x7c')]);if(fs['existsSync'](_0xc73ab3)){fs[_0x3237('0xbd')](_0xc73ab3)[_0x3237('0xbe')](fs['createWriteStream'](path[_0x3237('0x7e')](_0x5edd38,_0x2220eb['basename'])));}}}return new BPromise(function(_0x411f0c,_0x2c7f0d){pdf[_0x3237('0x68')](_0x2f9ffe,_0x21933f)[_0x3237('0xbf')](path[_0x3237('0x7e')](_0x5edd38,_0x3237('0xc0')+_0x133c62+_0x3237('0xc1')),function(_0x4221aa,_0x3c09e0){if(_0x4221aa)return _0x2c7f0d(_0x4221aa);_0x411f0c(_0x3c09e0);});});}})[_0x3237('0x33')](function(){if(_0xff432d){return new BPromise(function(_0x1c8ae3,_0x4eb88d){zipdir(_0x5edd38,{'saveTo':_0x4df32c},function(_0x4eb0e8,_0x5d822f){if(_0x4eb0e8)return _0x4eb88d(_0x4eb0e8);return _0x1c8ae3(_0x5d822f);});});}})['then'](function(){if(_0xff432d){return new BPromise(function(_0x4a7ba0,_0x476d2a){rimraf(_0x5edd38,function(_0x2cc50c){if(_0x2cc50c)_0x476d2a(_0x2cc50c);return _0x4a7ba0();});});}})[_0x3237('0x33')](function(){if(_0xff432d){return _0x35b75a[_0x3237('0x7b')](_0x4df32c,_0x2425c1,function(_0x2929a1){if(_0x2929a1){console[_0x3237('0xc2')]('err',_0x2929a1);}else{fs[_0x3237('0xc3')](_0x4df32c);}});}else{return _0x35b75a[_0x3237('0x28')](0xc8);}})['catch'](handleError(_0x35b75a,null));}; \ No newline at end of file +var _0x5e53=['port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','user','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','order','map','$gte','YYYY-MM-DD\x20HH:mm:ss','nolimit','pick','includeAgent','push','setTags','chatInteractionTags:save','removeTags','download','unix','files','tmp','server','firstName','Letter','1cm','mkdirSync','

Chat\x20Interaction:\x20#%d

','toString','
','','%s:\x20%s

','existsSync','createReadStream','createWriteStream','toFile','interaction-','.pdf','log','err','unlinkSync','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','./chatInteraction.socket','register','jayson/promise','http','client','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','rawAttributes','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','sort','where','merge','key','VIRTUAL','filter','options','include','tag','Tag','Tags','read','ChatMessage','Messages','createdAt','distinct','ChatInteraction','includeAll','Users','CmContact','Contact','User','Owner','fullname','internal','Account','color','ThroughTags','findAll','rows','show','params','length','find','create','body','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Sequelize','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','type','Attachment','attachmentDownload','findOne','Unauthorized','attachId','join','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','ChatWebsite','ContactId','agentAlias','System','customer','%s%d','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service'];(function(_0x570571,_0x513c24){var _0x2882fe=function(_0x5c40fb){while(--_0x5c40fb){_0x570571['push'](_0x570571['shift']());}};_0x2882fe(++_0x513c24);}(_0x5e53,0xf5));var _0x35e5=function(_0x866770,_0x5217ec){_0x866770=_0x866770-0x0;var _0x3d9580=_0x5e53[_0x866770];return _0x3d9580;};'use strict';var pdf=require(_0x35e5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x35e5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35e5('0x2'));var moment=require(_0x35e5('0x3'));var BPromise=require(_0x35e5('0x4'));var Mustache=require(_0x35e5('0x5'));var util=require(_0x35e5('0x6'));var path=require('path');var sox=require(_0x35e5('0x7'));var csv=require(_0x35e5('0x8'));var ejs=require(_0x35e5('0x9'));var fs=require('fs');var _=require(_0x35e5('0xa'));var squel=require(_0x35e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x35e5('0xc'));var deskjs=require(_0x35e5('0xd'));var toCsv=require(_0x35e5('0x8'));var querystring=require(_0x35e5('0xe'));var Papa=require(_0x35e5('0xf'));var authService=require(_0x35e5('0x10'));var hardwareService=require(_0x35e5('0x11'));var Redis=require('ioredis');var qs=require(_0x35e5('0x12'));var logger=require('../../config/logger')(_0x35e5('0x13'));var utils=require('../../config/utils');var config=require(_0x35e5('0x14'));var db=require(_0x35e5('0x15'))['db'];config[_0x35e5('0x16')]=_['defaults'](config[_0x35e5('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x35e5('0x17'))[_0x35e5('0x18')](socket);var jayson=require(_0x35e5('0x19'));var client=jayson['client'][_0x35e5('0x1a')]({'port':0x232b});var client9004=jayson[_0x35e5('0x1b')][_0x35e5('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x40d02f,_0x32e8d1,_0x5da14a,_0x2483aa){return new BPromise(function(_0x5c6248,_0x460ec5){var _0x3b8d13=_0x2483aa||client;return _0x3b8d13['request'](_0x40d02f,_0x5da14a)['then'](function(_0x35acbe){logger[_0x35e5('0x1c')](_0x35e5('0x1d'),_0x32e8d1,_0x35e5('0x1e'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x32e8d1,_0x35e5('0x1e'),JSON[_0x35e5('0x1f')](_0x35acbe));if(_0x35acbe[_0x35e5('0x20')]){if(_0x35acbe[_0x35e5('0x20')]['code']===0x1f4){logger[_0x35e5('0x20')](_0x35e5('0x1d'),_0x32e8d1,_0x35acbe[_0x35e5('0x20')][_0x35e5('0x21')]);return _0x460ec5(_0x35acbe[_0x35e5('0x20')][_0x35e5('0x21')]);}logger[_0x35e5('0x20')](_0x35e5('0x1d'),_0x32e8d1,_0x35acbe[_0x35e5('0x20')][_0x35e5('0x21')]);return _0x5c6248(_0x35acbe[_0x35e5('0x20')][_0x35e5('0x21')]);}else{logger[_0x35e5('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x32e8d1,_0x35e5('0x1e'));_0x5c6248(_0x35acbe[_0x35e5('0x22')][_0x35e5('0x21')]);}})[_0x35e5('0x23')](function(_0x512de6){logger['error'](_0x35e5('0x1d'),_0x32e8d1,_0x512de6);_0x460ec5(_0x512de6);});});}function respondWithStatusCode(_0x49455a,_0x4b4327){_0x4b4327=_0x4b4327||0xcc;return function(_0x1cea99){if(_0x1cea99){return _0x49455a['sendStatus'](_0x4b4327);}return _0x49455a[_0x35e5('0x24')](_0x4b4327)[_0x35e5('0x25')]();};}function respondWithResult(_0x680877,_0x309111){_0x309111=_0x309111||0xc8;return function(_0x24fb51){if(_0x24fb51){return _0x680877[_0x35e5('0x24')](_0x309111)[_0x35e5('0x26')](_0x24fb51);}};}function respondWithFilteredResult(_0x1eea68,_0x29dcad){return function(_0x4f7892){if(_0x4f7892){var _0x551502=_0x4f7892[_0x35e5('0x27')],_0x776169=_0x29dcad[_0x35e5('0x28')],_0x507f0a=_0x29dcad[_0x35e5('0x28')]+_0x29dcad[_0x35e5('0x29')],_0x35cb45;if(_0x507f0a>=_0x551502){_0x507f0a=_0x551502;_0x35cb45=0xc8;}else{_0x35cb45=0xce;}_0x1eea68['status'](_0x35cb45);return _0x1eea68[_0x35e5('0x2a')](_0x35e5('0x2b'),_0x776169+'-'+_0x507f0a+'/'+_0x551502)[_0x35e5('0x26')](_0x4f7892);}return null;};}function patchUpdates(_0x237ab9){return function(_0x3b2695){try{jsonpatch[_0x35e5('0x2c')](_0x3b2695,_0x237ab9,!![]);}catch(_0x519d0d){return BPromise[_0x35e5('0x2d')](_0x519d0d);}return _0x3b2695[_0x35e5('0x2e')]();};}function saveUpdates(_0x563c29,_0x16184e){return function(_0x22b599){if(_0x22b599){return _0x22b599[_0x35e5('0x2f')](_0x563c29)['then'](function(_0x1c5814){return _0x1c5814;});}return null;};}function removeEntity(_0x26fbb8,_0x22ea98){return function(_0x59a304){if(_0x59a304){return _0x59a304[_0x35e5('0x30')]()[_0x35e5('0x31')](function(){_0x26fbb8[_0x35e5('0x24')](0xcc)[_0x35e5('0x25')]();});}};}function handleEntityNotFound(_0x1f9078,_0x5b3fd0){return function(_0x5e5da9){if(!_0x5e5da9){_0x1f9078[_0x35e5('0x32')](0x194);}return _0x5e5da9;};}function handleError(_0x44c1ef,_0x182a1b){_0x182a1b=_0x182a1b||0x1f4;return function(_0x4484f4){logger['error'](_0x4484f4[_0x35e5('0x33')]);if(_0x4484f4[_0x35e5('0x34')]){delete _0x4484f4[_0x35e5('0x34')];}_0x44c1ef['status'](_0x182a1b)[_0x35e5('0x35')](_0x4484f4);};}exports[_0x35e5('0x36')]=function(_0x1c5708,_0x3d89a0){var _0x401eb0={},_0x7e129f={},_0x3ecc29={'count':0x0,'rows':[]};var _0x4ac231=db['ChatInteraction'][_0x35e5('0x37')];_0x7e129f[_0x35e5('0x38')]=_[_0x35e5('0x39')](_0x4ac231);_0x7e129f[_0x35e5('0x3a')]=_[_0x35e5('0x39')](_0x1c5708[_0x35e5('0x3a')]);_0x7e129f[_0x35e5('0x3b')]=_['intersection'](_0x7e129f[_0x35e5('0x38')],_0x7e129f[_0x35e5('0x3a')]);_0x401eb0[_0x35e5('0x3c')]=_[_0x35e5('0x3d')](_0x7e129f[_0x35e5('0x38')],qs['fields'](_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x3e')]));_0x401eb0[_0x35e5('0x3c')]=_0x401eb0[_0x35e5('0x3c')]['length']?_0x401eb0['attributes']:_0x7e129f[_0x35e5('0x38')];if(!_0x1c5708['query'][_0x35e5('0x3f')]('nolimit')){_0x401eb0['limit']=qs[_0x35e5('0x29')](_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x29')]);_0x401eb0[_0x35e5('0x28')]=qs['offset'](_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x28')]);}_0x401eb0['order']=qs[_0x35e5('0x40')](_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x40')]);_0x401eb0[_0x35e5('0x41')]=qs[_0x35e5('0x3b')](_['pick'](_0x1c5708[_0x35e5('0x3a')],_0x7e129f[_0x35e5('0x3b')]));if(_0x1c5708[_0x35e5('0x3a')]['filter']){_0x401eb0[_0x35e5('0x41')]=_[_0x35e5('0x42')](_0x401eb0[_0x35e5('0x41')],{'$or':_['map'](_0x4ac231,function(_0x2da501){if(_0x2da501['type'][_0x35e5('0x43')]!==_0x35e5('0x44')){var _0x87cf35={};_0x87cf35[_0x2da501['field']]={'$like':'%'+_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x45')]+'%'};return _0x87cf35;}})});}_0x401eb0=_[_0x35e5('0x42')]({},_0x401eb0,_0x1c5708[_0x35e5('0x46')]);var _0x3f1afa={'where':_0x401eb0['where']};_0x3f1afa[_0x35e5('0x47')]=[];if(_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x48')]){_0x3f1afa[_0x35e5('0x47')]['push']({'model':db[_0x35e5('0x49')],'as':_0x35e5('0x4a'),'attributes':['id'],'where':{'id':_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x48')]},'required':!![]});_0x3f1afa['distinct']=!![];}if(_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x4b')]){_0x3f1afa[_0x35e5('0x47')]['push']({'model':db[_0x35e5('0x4c')],'as':_0x35e5('0x4d'),'attributes':['id','direction',_0x35e5('0x4e'),'read'],'where':{'direction':'in','read':_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x4b')]||![]},'required':!![]});_0x3f1afa[_0x35e5('0x4f')]=!![];}return db[_0x35e5('0x50')][_0x35e5('0x27')](_0x3f1afa)['then'](function(_0x48cee0){_0x3ecc29['count']=_0x48cee0;if(_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x51')]){_0x401eb0['include']=[{'model':db['User'],'as':_0x35e5('0x52'),'required':![],'attributes':['id',_0x35e5('0x34'),'fullname']},{'model':db[_0x35e5('0x53')],'as':_0x35e5('0x54'),'required':![]},{'model':db[_0x35e5('0x55')],'as':_0x35e5('0x56'),'attributes':[_0x35e5('0x34'),_0x35e5('0x57'),_0x35e5('0x58')],'required':![]},{'model':db['ChatWebsite'],'as':_0x35e5('0x59'),'attributes':[_0x35e5('0x34'),'key'],'required':![]},{'model':db[_0x35e5('0x4c')],'as':_0x35e5('0x4d'),'attributes':['id','direction','createdAt',_0x35e5('0x4b')],'where':{'direction':'in','read':_0x1c5708['query'][_0x35e5('0x4b')]||![]},'required':_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x4b')]||![]},{'model':db[_0x35e5('0x49')],'as':_0x35e5('0x4a'),'attributes':['id',_0x35e5('0x34'),_0x35e5('0x5a')],'required':_0x1c5708[_0x35e5('0x3a')]['tag']?!![]:![]},{'model':db[_0x35e5('0x49')],'as':_0x35e5('0x5b'),'attributes':['id',_0x35e5('0x34'),_0x35e5('0x5a')],'through':_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x48')]?{'attributes':[],'where':{'TagId':_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x48')]||undefined}}:{},'required':_0x1c5708[_0x35e5('0x3a')][_0x35e5('0x48')]?!![]:![]}];}return db[_0x35e5('0x50')][_0x35e5('0x5c')](_0x401eb0);})[_0x35e5('0x31')](function(_0x4353fd){_0x3ecc29[_0x35e5('0x5d')]=_0x4353fd;return _0x3ecc29;})[_0x35e5('0x31')](respondWithFilteredResult(_0x3d89a0,_0x401eb0))['catch'](handleError(_0x3d89a0,null));};exports[_0x35e5('0x5e')]=function(_0xc225aa,_0x573930){var _0x40cf92={'raw':![],'where':{'id':_0xc225aa[_0x35e5('0x5f')]['id']}},_0x33c68f={};_0x33c68f[_0x35e5('0x38')]=_['keys'](db[_0x35e5('0x50')][_0x35e5('0x37')]);_0x33c68f[_0x35e5('0x3a')]=_['keys'](_0xc225aa[_0x35e5('0x3a')]);_0x33c68f[_0x35e5('0x3b')]=_['intersection'](_0x33c68f[_0x35e5('0x38')],_0x33c68f[_0x35e5('0x3a')]);_0x40cf92[_0x35e5('0x3c')]=_[_0x35e5('0x3d')](_0x33c68f[_0x35e5('0x38')],qs[_0x35e5('0x3e')](_0xc225aa[_0x35e5('0x3a')][_0x35e5('0x3e')]));_0x40cf92[_0x35e5('0x3c')]=_0x40cf92['attributes'][_0x35e5('0x60')]?_0x40cf92[_0x35e5('0x3c')]:_0x33c68f['model'];if(_0xc225aa[_0x35e5('0x3a')][_0x35e5('0x51')]){_0x40cf92[_0x35e5('0x47')]=[{'all':!![]}];}_0x40cf92=_[_0x35e5('0x42')]({},_0x40cf92,_0xc225aa[_0x35e5('0x46')]);return db[_0x35e5('0x50')][_0x35e5('0x61')](_0x40cf92)[_0x35e5('0x31')](handleEntityNotFound(_0x573930,null))[_0x35e5('0x31')](respondWithResult(_0x573930,null))[_0x35e5('0x23')](handleError(_0x573930,null));};exports['create']=function(_0x59936a,_0x9baca8){return db['ChatInteraction'][_0x35e5('0x62')](_0x59936a[_0x35e5('0x63')],{})['then'](respondWithResult(_0x9baca8,0xc9))[_0x35e5('0x23')](handleError(_0x9baca8,null));};exports['update']=function(_0x5acc81,_0x3182a9){if(_0x5acc81[_0x35e5('0x63')]['id']){delete _0x5acc81['body']['id'];}return db['ChatInteraction'][_0x35e5('0x61')]({'where':{'id':_0x5acc81['params']['id']}})[_0x35e5('0x31')](handleEntityNotFound(_0x3182a9,null))[_0x35e5('0x31')](saveUpdates(_0x5acc81['body'],null))[_0x35e5('0x31')](respondWithResult(_0x3182a9,null))['catch'](handleError(_0x3182a9,null));};exports['destroy']=function(_0x2f8023,_0x100c19){return db[_0x35e5('0x50')][_0x35e5('0x61')]({'where':{'id':_0x2f8023['params']['id']}})['then'](handleEntityNotFound(_0x100c19,null))[_0x35e5('0x31')](removeEntity(_0x100c19,null))[_0x35e5('0x23')](handleError(_0x100c19,null));};exports[_0x35e5('0x64')]=function(_0x505118,_0x14b725){return db[_0x35e5('0x50')][_0x35e5('0x64')]()['then'](respondWithResult(_0x14b725,null))['catch'](handleError(_0x14b725,null));};exports[_0x35e5('0x65')]=function(_0x2fb170,_0x507423){if(_0x2fb170['body']['id']){delete _0x2fb170[_0x35e5('0x63')]['id'];}return db['ChatInteraction'][_0x35e5('0x61')]({'where':{'id':_0x2fb170[_0x35e5('0x5f')]['id']}})[_0x35e5('0x31')](handleEntityNotFound(_0x507423,null))[_0x35e5('0x31')](saveUpdates(_0x2fb170['body'],null))[_0x35e5('0x31')](respondWithResult(_0x507423,null))[_0x35e5('0x23')](handleError(_0x507423,null));};exports[_0x35e5('0x66')]=function(_0x57eb5b,_0x4bf440,_0x4e789e){if(_0x57eb5b[_0x35e5('0x63')]['id']){delete _0x57eb5b['body']['id'];}return db[_0x35e5('0x50')][_0x35e5('0x61')]({'where':{'id':_0x57eb5b[_0x35e5('0x5f')]['id']}})[_0x35e5('0x31')](function(_0x2968c0){if(!_0x2968c0){logger[_0x35e5('0x20')](_0x35e5('0x67'),_0x35e5('0x66'),0x194,_0x35e5('0x68'));_0x4bf440['sendStatus'](0x194);}else{if(_0x2968c0[_0x35e5('0x69')]){throw new db[(_0x35e5('0x6a'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x2968c0;})['then'](function(_0x45a055){if(_0x45a055){return _0x45a055[_0x35e5('0x2f')]({'closed':_0x57eb5b['body'][_0x35e5('0x6b')],'disposition':_0x57eb5b[_0x35e5('0x63')]['disposition']})['then'](function(_0xca14a1){return _0xca14a1;});}})['then'](function(_0x265317){return respondWithRpcPromise(_0x35e5('0x6c'),_0x35e5('0x66'),_0x57eb5b['body'],client9004);})[_0x35e5('0x31')](respondWithResult(_0x4bf440,null))['catch'](handleError(_0x4bf440,null));};exports[_0x35e5('0x6d')]=function(_0x218b19,_0x109b7e,_0x4d1871){_0x218b19[_0x35e5('0x63')]['name']=_0x218b19[_0x35e5('0x6e')][_0x35e5('0x6f')];_0x218b19[_0x35e5('0x63')][_0x35e5('0x70')]=_0x218b19[_0x35e5('0x6e')][_0x35e5('0x71')];_0x218b19[_0x35e5('0x63')][_0x35e5('0x72')]=_0x218b19[_0x35e5('0x6e')]['mimetype'];return db[_0x35e5('0x73')][_0x35e5('0x62')](_0x218b19[_0x35e5('0x63')])['then'](respondWithResult(_0x109b7e,0xc9))[_0x35e5('0x23')](handleError(_0x109b7e,null));};exports[_0x35e5('0x74')]=function(_0x43e0ef,_0x43127,_0x292bb1){return db[_0x35e5('0x50')][_0x35e5('0x75')]({'where':{'id':_0x43e0ef[_0x35e5('0x5f')]['id']},'raw':!![]})[_0x35e5('0x31')](handleEntityNotFound(_0x43127,null))[_0x35e5('0x31')](function(_0x15bbae){if(_0x15bbae){if(_0x15bbae[_0x35e5('0x6b')]){return _0x43127[_0x35e5('0x24')](0x193)[_0x35e5('0x26')]({'status':0x193,'message':_0x35e5('0x76')});}return db[_0x35e5('0x73')]['findOne']({'where':{'id':_0x43e0ef['query'][_0x35e5('0x77')]},'raw':!![]})[_0x35e5('0x31')](handleEntityNotFound(_0x43127,null));}})[_0x35e5('0x31')](function(_0x26fe57){if(_0x26fe57){return _0x43127['download'](path[_0x35e5('0x78')](config[_0x35e5('0x79')],_0x35e5('0x7a'),_0x26fe57['basename']));}})[_0x35e5('0x23')](handleError(_0x43127,null));};exports['close']=function(_0x5ecdbf,_0x4427f2){var _0x407e42=null;var _0x1e3e4e=null;var _0x5b6f6b=null;var _0x15a189=null;if(_0x5ecdbf[_0x35e5('0x63')]['id']){delete _0x5ecdbf[_0x35e5('0x63')]['id'];}if(_0x5ecdbf[_0x35e5('0x63')][_0x35e5('0x7b')]){_0x15a189=path[_0x35e5('0x78')](config[_0x35e5('0x79')],_0x35e5('0x7c'),util[_0x35e5('0x7d')](_0x35e5('0x7e'),Date['now']()));_0x5ecdbf[_0x35e5('0x63')][_0x35e5('0x7f')]=_0x15a189;}return db[_0x35e5('0x50')][_0x35e5('0x61')]({'where':{'id':_0x5ecdbf[_0x35e5('0x5f')]['id']},'include':[{'model':db[_0x35e5('0x4c')],'as':_0x35e5('0x4d'),'include':[{'model':db[_0x35e5('0x55')],'as':_0x35e5('0x55')}]}]})[_0x35e5('0x31')](handleEntityNotFound(_0x4427f2,null))['then'](saveUpdates(_0x5ecdbf[_0x35e5('0x63')],null))[_0x35e5('0x31')](function(_0x2520ea){if(_0x2520ea){_0x407e42=_0x2520ea;return db[_0x35e5('0x80')]['find']({'where':{'id':_0x407e42['ChatWebsiteId']}});}})[_0x35e5('0x31')](function(_0x400215){if(_0x400215){_0x5b6f6b=_0x400215;return db['CmContact']['find']({'where':{'id':_0x407e42[_0x35e5('0x81')]}});}})[_0x35e5('0x31')](function(_0x57407b){if(_0x57407b){_0x1e3e4e=_0x57407b;if(_0x15a189){var _0x3fd4e9=null;for(var _0x4e0ce1=0x1;_0x4e0ce1<_0x407e42['Messages'][_0x35e5('0x60')];++_0x4e0ce1){_0x3fd4e9=_0x407e42[_0x35e5('0x4d')][_0x4e0ce1];var _0x363cad=_0x3fd4e9[_0x35e5('0x69')]?util[_0x35e5('0x7d')]('%s%d',_0x5b6f6b[_0x35e5('0x82')],_0x3fd4e9[_0x35e5('0x69')]):_0x35e5('0x83');var _0x3a1eff=_0x5ecdbf[_0x35e5('0x63')][_0x35e5('0x84')]||util[_0x35e5('0x7d')](_0x35e5('0x85'),'Visitor',_0x3fd4e9[_0x35e5('0x81')]);switch(_0x5b6f6b[_0x35e5('0x86')]){case _0x35e5('0x87'):_0x363cad=_0x3fd4e9[_0x35e5('0x69')]?util[_0x35e5('0x7d')](_0x35e5('0x85'),_0x5b6f6b[_0x35e5('0x82')],_0x3fd4e9[_0x35e5('0x69')]):_0x35e5('0x83');break;case _0x35e5('0x88'):_0x363cad=_0x3fd4e9[_0x35e5('0x69')]?_0x3fd4e9['User'][_0x35e5('0x89')]||_0x3fd4e9[_0x35e5('0x55')][_0x35e5('0x57')]:_0x35e5('0x83');break;case _0x35e5('0x8a'):_0x363cad=_0x3fd4e9[_0x35e5('0x69')]?_0x3fd4e9[_0x35e5('0x55')]['fullname']:_0x35e5('0x83');break;default:_0x363cad=_0x3fd4e9[_0x35e5('0x69')]?util['format']('%s%d',_0x5b6f6b[_0x35e5('0x82')],_0x3fd4e9[_0x35e5('0x69')]):'System';}var _0x6f37a3=util[_0x35e5('0x7d')]('[%s]\x20%s:\x20%s\x0a',moment(_0x3fd4e9[_0x35e5('0x4e')])[_0x35e5('0x7d')](_0x35e5('0x8b')),_0x3fd4e9[_0x35e5('0x8c')]==='in'?_0x3a1eff:_0x363cad,_0x3fd4e9[_0x35e5('0x63')]);if(!_0x3fd4e9[_0x35e5('0x8d')]){fs[_0x35e5('0x8e')](_0x15a189,_0x6f37a3);}}return db[_0x35e5('0x8f')][_0x35e5('0x75')]({'where':{'service':!![]},'include':[{'model':db[_0x35e5('0x90')],'as':_0x35e5('0x91'),'raw':!![]}]});}}})[_0x35e5('0x31')](function(_0x568bc9){if(_0x568bc9&&_0x568bc9['Smtp']&&_0x5ecdbf['body']){var _0x1e5077={'tls':{'rejectUnauthorized':![]}};if(_0x568bc9[_0x35e5('0x91')][_0x35e5('0x92')]){_0x1e5077[_0x35e5('0x92')]=_0x568bc9[_0x35e5('0x91')][_0x35e5('0x92')];}else{_0x1e5077['host']=_0x568bc9[_0x35e5('0x91')]['host'];_0x1e5077['port']=_0x568bc9[_0x35e5('0x91')][_0x35e5('0x93')];_0x1e5077[_0x35e5('0x94')]=_0x568bc9[_0x35e5('0x91')][_0x35e5('0x94')];}if(_0x568bc9[_0x35e5('0x91')][_0x35e5('0x95')]){_0x1e5077[_0x35e5('0x96')]={'user':_0x568bc9[_0x35e5('0x91')]['user'],'pass':_0x568bc9['Smtp'][_0x35e5('0x97')]};}return respondWithRpcPromise('SendMail',_0x35e5('0x98'),{'account':_0x1e5077,'message':{'from':util[_0x35e5('0x7d')](_0x35e5('0x99'),_0x568bc9[_0x35e5('0x34')],_0x568bc9[_0x35e5('0x9a')]||_0x568bc9[_0x35e5('0x91')][_0x35e5('0x9b')]),'to':_0x5ecdbf[_0x35e5('0x63')][_0x35e5('0x7b')],'subject':_0x35e5('0x9c'),'text':util['format'](_0x35e5('0x9d'),_0x5ecdbf[_0x35e5('0x63')][_0x35e5('0x7b')]),'attachments':[{'path':_0x15a189}]}})[_0x35e5('0x31')](function(){return _0x407e42;})['catch'](function(_0x581b92){console[_0x35e5('0x20')](_0x581b92);});}else{return _0x407e42;}})[_0x35e5('0x31')](respondWithStatusCode(_0x4427f2,0xc8))[_0x35e5('0x23')](handleError(_0x4427f2,null));};exports[_0x35e5('0x9e')]=function(_0x105aa0,_0x58a32e,_0x4b3c32){return db[_0x35e5('0x4c')][_0x35e5('0x61')]({'where':{'id':_0x105aa0[_0x35e5('0x5f')]['id']}})['then'](handleEntityNotFound(_0x58a32e,null))['then'](function(_0x12a714){if(_0x12a714){return _0x12a714[_0x35e5('0x9e')](_0x105aa0[_0x35e5('0x63')][_0x35e5('0x9f')],_[_0x35e5('0xa0')](_0x105aa0[_0x35e5('0x63')],[_0x35e5('0x9f'),'id'])||{});}})['then'](respondWithResult(_0x58a32e,null))[_0x35e5('0x23')](handleError(_0x58a32e,null));};exports[_0x35e5('0xa1')]=function(_0x4ec5da,_0x420647,_0x4bedfc){var _0x18e55a={'raw':![],'where':{}};var _0x43c9e4={};var _0x31793b={'count':0x0,'rows':[]};return db[_0x35e5('0x50')][_0x35e5('0x75')]({'where':{'id':_0x4ec5da[_0x35e5('0x5f')]['id']}})['then'](handleEntityNotFound(_0x420647,null))[_0x35e5('0x31')](function(_0x424123){if(_0x424123){_0x43c9e4[_0x35e5('0x38')]=_[_0x35e5('0x39')](db[_0x35e5('0x4c')][_0x35e5('0x37')]);_0x43c9e4[_0x35e5('0x3a')]=_[_0x35e5('0x39')](_0x4ec5da[_0x35e5('0x3a')]);_0x43c9e4[_0x35e5('0x3b')]=_[_0x35e5('0x3d')](_0x43c9e4['model'],_0x43c9e4[_0x35e5('0x3a')]);_0x18e55a[_0x35e5('0x3c')]=_[_0x35e5('0x3d')](_0x43c9e4[_0x35e5('0x38')],qs[_0x35e5('0x3e')](_0x4ec5da[_0x35e5('0x3a')][_0x35e5('0x3e')]));_0x18e55a[_0x35e5('0x3c')]=_0x18e55a[_0x35e5('0x3c')][_0x35e5('0x60')]?_0x18e55a[_0x35e5('0x3c')]:_0x43c9e4[_0x35e5('0x38')];if(!_0x4ec5da[_0x35e5('0x3a')][_0x35e5('0x3f')]('nolimit')){_0x18e55a['limit']=qs['limit'](_0x4ec5da[_0x35e5('0x3a')]['limit']);_0x18e55a[_0x35e5('0x28')]=qs['offset'](_0x4ec5da[_0x35e5('0x3a')]['offset']);}_0x18e55a[_0x35e5('0xa2')]=qs[_0x35e5('0x40')](_0x4ec5da[_0x35e5('0x3a')]['sort']);_0x18e55a[_0x35e5('0x41')]=qs[_0x35e5('0x3b')](_['pick'](_0x4ec5da[_0x35e5('0x3a')],_0x43c9e4[_0x35e5('0x3b')]));_0x18e55a[_0x35e5('0x41')]['ChatInteractionId']=_0x424123['id'];if(_0x4ec5da[_0x35e5('0x3a')][_0x35e5('0x45')]){_0x18e55a[_0x35e5('0x41')]=_[_0x35e5('0x42')](_0x18e55a[_0x35e5('0x41')],{'$or':_[_0x35e5('0xa3')](_0x18e55a[_0x35e5('0x3c')],function(_0x2150e8){var _0x1b9970={};_0x1b9970[_0x2150e8]={'$like':'%'+_0x4ec5da['query'][_0x35e5('0x45')]+'%'};return _0x1b9970;})});}if(_0x4ec5da[_0x35e5('0x3a')]['$gte']){var _0x5dae5d=_0x4ec5da[_0x35e5('0x3a')][_0x35e5('0xa4')]['split'](',');var _0x8e60f7={};_0x8e60f7[_0x5dae5d[0x0]]={'$gte':moment(_0x5dae5d[0x1])[_0x35e5('0x7d')](_0x35e5('0xa5'))};_0x18e55a[_0x35e5('0x41')]=_['merge'](_0x18e55a[_0x35e5('0x41')],_0x8e60f7);}_0x18e55a=_[_0x35e5('0x42')]({},_0x18e55a,_0x4ec5da[_0x35e5('0x46')]);return db[_0x35e5('0x4c')]['count']({'where':_0x18e55a[_0x35e5('0x41')]})[_0x35e5('0x31')](function(_0x4c2e10){_0x31793b[_0x35e5('0x27')]=_0x4c2e10;if(_0x4ec5da['query'][_0x35e5('0x51')]){_0x18e55a[_0x35e5('0x47')]=[{'all':!![]}];}return db[_0x35e5('0x4c')]['findAll'](_0x18e55a);})[_0x35e5('0x31')](function(_0x2b0bab){_0x31793b[_0x35e5('0x5d')]=_0x2b0bab;return _0x31793b;});}})['then'](respondWithFilteredResult(_0x420647,_0x18e55a))['catch'](handleError(_0x420647,null));};exports['getMyMessages']=function(_0x1bc1b8,_0x1ae63d,_0x57bbe2){var _0x130144={'where':{}},_0xf7d178={},_0x82219e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x35e5('0x75')]({'where':{'id':_0x1bc1b8[_0x35e5('0x5f')]['id']}})[_0x35e5('0x31')](handleEntityNotFound(_0x1ae63d,null))[_0x35e5('0x31')](function(_0x31fbfa){if(_0x31fbfa){_0xf7d178[_0x35e5('0x38')]=_[_0x35e5('0x39')](db[_0x35e5('0x4c')][_0x35e5('0x37')]);_0xf7d178[_0x35e5('0x3a')]=_['keys'](_0x1bc1b8['query']);_0xf7d178['filters']=_[_0x35e5('0x3d')](_0xf7d178[_0x35e5('0x38')],_0xf7d178['query']);_0x130144['attributes']=_['intersection'](_0xf7d178[_0x35e5('0x38')],qs['fields'](_0x1bc1b8['query'][_0x35e5('0x3e')]));_0x130144[_0x35e5('0x3c')]=_0x130144[_0x35e5('0x3c')]['length']?_0x130144['attributes']:_0xf7d178['model'];if(!_0x1bc1b8[_0x35e5('0x3a')][_0x35e5('0x3f')](_0x35e5('0xa6'))){_0x130144[_0x35e5('0x29')]=qs[_0x35e5('0x29')](_0x1bc1b8[_0x35e5('0x3a')][_0x35e5('0x29')]);_0x130144[_0x35e5('0x28')]=qs[_0x35e5('0x28')](_0x1bc1b8['query'][_0x35e5('0x28')]);}_0x130144['order']=qs[_0x35e5('0x40')](_0x1bc1b8[_0x35e5('0x3a')][_0x35e5('0x40')]);_0x130144[_0x35e5('0x41')]=qs[_0x35e5('0x3b')](_[_0x35e5('0xa7')](_0x1bc1b8[_0x35e5('0x3a')],_0xf7d178[_0x35e5('0x3b')]));_0x130144[_0x35e5('0x41')]['ChatInteractionId']=_0x31fbfa['id'];if(_0x1bc1b8[_0x35e5('0x3a')][_0x35e5('0x45')]){_0x130144[_0x35e5('0x41')]=_[_0x35e5('0x42')](_0x130144[_0x35e5('0x41')],{'$or':_[_0x35e5('0xa3')](_0x130144['attributes'],function(_0x230235){var _0x3b8c71={};_0x3b8c71[_0x230235]={'$like':'%'+_0x1bc1b8[_0x35e5('0x3a')][_0x35e5('0x45')]+'%'};return _0x3b8c71;})});}_0x130144[_0x35e5('0x41')]['secret']=![];if(_0x1bc1b8[_0x35e5('0x3a')]['id']){_0x130144[_0x35e5('0x41')]['id']={'$gt':_0x1bc1b8[_0x35e5('0x3a')]['id']};}_0x130144=_[_0x35e5('0x42')]({},_0x130144,_0x1bc1b8['options']);return db[_0x35e5('0x4c')][_0x35e5('0x27')]({'where':_0x130144[_0x35e5('0x41')]})[_0x35e5('0x31')](function(_0x221675){_0x82219e[_0x35e5('0x27')]=_0x221675;_0x130144[_0x35e5('0x47')]=[];if(_0x1bc1b8[_0x35e5('0x3a')][_0x35e5('0xa8')]){_0x130144[_0x35e5('0x47')][_0x35e5('0xa9')]({'model':db[_0x35e5('0x55')],'as':_0x35e5('0x55'),'attributes':['id','fullname',_0x35e5('0x89')]});}if(_0x1bc1b8[_0x35e5('0x3a')][_0x35e5('0x51')]){_0x130144['include']=[{'all':!![]}];}return db[_0x35e5('0x4c')][_0x35e5('0x5c')](_0x130144);})['then'](function(_0x2e4dd8){_0x82219e[_0x35e5('0x5d')]=_0x2e4dd8;return _0x82219e;});}})[_0x35e5('0x31')](respondWithFilteredResult(_0x1ae63d,_0x130144))['catch'](handleError(_0x1ae63d,null));};exports['addTags']=function(_0x578e11,_0x31dff7,_0x3fcefa){return db[_0x35e5('0x50')][_0x35e5('0x61')]({'where':{'id':_0x578e11[_0x35e5('0x5f')]['id']}})['then'](handleEntityNotFound(_0x31dff7,null))[_0x35e5('0x31')](function(_0x2edced){if(_0x2edced){return _0x2edced[_0x35e5('0xaa')](_0x578e11[_0x35e5('0x63')][_0x35e5('0x9f')],_['omit'](_0x578e11[_0x35e5('0x63')],[_0x35e5('0x9f'),'id'])||{})['spread'](function(){return db[_0x35e5('0x49')]['findAll']({'attributes':['id',_0x35e5('0x34'),_0x35e5('0x5a')],'where':{'id':_0x578e11[_0x35e5('0x63')]['ids']}});})[_0x35e5('0x31')](function(_0x931c4e){socket['emit'](_0x35e5('0xab'),{'id':Number(_0x578e11[_0x35e5('0x5f')]['id']),'tags':_0x931c4e||[]});return{'id':Number(_0x578e11[_0x35e5('0x5f')]['id']),'tags':_0x931c4e||[]};});}})[_0x35e5('0x31')](respondWithResult(_0x31dff7,null))[_0x35e5('0x23')](handleError(_0x31dff7,null));};exports[_0x35e5('0xac')]=function(_0x4f8ab4,_0x262428,_0x11696b){var _0x53a53b;return db['ChatInteraction'][_0x35e5('0x61')]({'where':{'id':_0x4f8ab4[_0x35e5('0x5f')]['id']}})[_0x35e5('0x31')](handleEntityNotFound(_0x262428,null))['then'](function(_0x4cce8c){if(_0x4cce8c){return _0x4cce8c[_0x35e5('0xac')](_0x4f8ab4[_0x35e5('0x3a')][_0x35e5('0x9f')]);}})['then'](respondWithStatusCode(_0x262428,null))[_0x35e5('0x23')](handleError(_0x262428,null));};exports[_0x35e5('0xad')]=function(_0xf6c053,_0x50b4a8){var _0x401609=moment()[_0x35e5('0xae')]()['toString']();var _0x132010=path[_0x35e5('0x78')](config[_0x35e5('0x79')],'server',_0x35e5('0xaf'),_0x35e5('0xb0'));var _0x36a6dd=path[_0x35e5('0x78')](config[_0x35e5('0x79')],_0x35e5('0xb1'),_0x35e5('0xaf'),'attachments');var _0x4ba7df=path[_0x35e5('0x78')](_0x132010,_0x401609);var _0x1ec9ce=util[_0x35e5('0x7d')]('interaction-%s.zip',_0x401609);var _0x540231=path[_0x35e5('0x78')](_0x132010,_0x1ec9ce);var _0x1aa6ea=![];return db[_0x35e5('0x50')]['find']({'where':{'id':_0xf6c053[_0x35e5('0x5f')]['id']},'include':[{'model':db[_0x35e5('0x4c')],'as':_0x35e5('0x4d'),'attributes':['id',_0x35e5('0x63')],'include':[{'model':db[_0x35e5('0x55')],'as':_0x35e5('0x55'),'attributes':['id',_0x35e5('0x57')],'raw':!![]},{'model':db[_0x35e5('0x53')],'as':_0x35e5('0x54'),'attributes':['id',_0x35e5('0xb2')],'raw':!![]},{'model':db[_0x35e5('0x73')],'as':_0x35e5('0x73'),'raw':!![]}]}]})[_0x35e5('0x31')](handleEntityNotFound(_0x50b4a8,null))['then'](function(_0x574d2b){if(_0x574d2b){_0x1aa6ea=!![];var _0x50643a='';var _0x390d34={'format':_0x35e5('0xb3'),'border':_0x35e5('0xb4')};fs[_0x35e5('0xb5')](_0x4ba7df);_0x50643a+=util[_0x35e5('0x7d')](_0x35e5('0xb6'),_0x574d2b['id']);_0x50643a+=util[_0x35e5('0x7d')]('

Date:\x20%s

',moment()['format']('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')[_0x35e5('0xb7')]());_0x50643a+=_0x35e5('0xb8');for(var _0x4120ef=0x1;_0x4120ef<_0x574d2b[_0x35e5('0x4d')]['length'];_0x4120ef++){var _0x4ca892=_0x574d2b[_0x35e5('0x4d')][_0x4120ef];_0x50643a+=_0x35e5('0xb9');_0x50643a+=util['format'](_0x35e5('0xba'),_0x4ca892[_0x35e5('0x55')]?_0x4ca892[_0x35e5('0x55')]['fullname']:_0x4ca892['Contact'][_0x35e5('0xb2')],_0x4ca892[_0x35e5('0x63')]);_0x50643a+='';if(_0x4ca892[_0x35e5('0x73')]){var _0x288c50=_0x4ca892[_0x35e5('0x73')];var _0x981cae=path[_0x35e5('0x78')](_0x36a6dd,_0x288c50['basename']);if(fs[_0x35e5('0xbb')](_0x981cae)){fs[_0x35e5('0xbc')](_0x981cae)['pipe'](fs[_0x35e5('0xbd')](path[_0x35e5('0x78')](_0x4ba7df,_0x288c50[_0x35e5('0x70')])));}}}return new BPromise(function(_0x7bc216,_0x12ff18){pdf[_0x35e5('0x62')](_0x50643a,_0x390d34)[_0x35e5('0xbe')](path[_0x35e5('0x78')](_0x4ba7df,_0x35e5('0xbf')+_0x401609+_0x35e5('0xc0')),function(_0x2acc0f,_0x12e06c){if(_0x2acc0f)return _0x12ff18(_0x2acc0f);_0x7bc216(_0x12e06c);});});}})['then'](function(){if(_0x1aa6ea){return new BPromise(function(_0x242277,_0x3d0b8e){zipdir(_0x4ba7df,{'saveTo':_0x540231},function(_0x2de6e5,_0x1e1cde){if(_0x2de6e5)return _0x3d0b8e(_0x2de6e5);return _0x242277(_0x1e1cde);});});}})['then'](function(){if(_0x1aa6ea){return new BPromise(function(_0x56cae3,_0x14964f){rimraf(_0x4ba7df,function(_0x29b440){if(_0x29b440)_0x14964f(_0x29b440);return _0x56cae3();});});}})[_0x35e5('0x31')](function(){if(_0x1aa6ea){return _0x50b4a8[_0x35e5('0xad')](_0x540231,_0x1ec9ce,function(_0x121695){if(_0x121695){console[_0x35e5('0xc1')](_0x35e5('0xc2'),_0x121695);}else{fs[_0x35e5('0xc3')](_0x540231);}});}else{return _0x50b4a8[_0x35e5('0x32')](0xc8);}})[_0x35e5('0x23')](handleError(_0x50b4a8,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a93578e..ddf2716 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 _0x80c7=['hasOwnProperty','hook','exports','events','ChatInteraction','save','update','emit'];(function(_0x264511,_0x22e6bb){var _0x18091c=function(_0x1a8b60){while(--_0x1a8b60){_0x264511['push'](_0x264511['shift']());}};_0x18091c(++_0x22e6bb);}(_0x80c7,0x73));var _0x780c=function(_0x283cf2,_0x5d685f){_0x283cf2=_0x283cf2-0x0;var _0x1bcbfe=_0x80c7[_0x283cf2];return _0x1bcbfe;};'use strict';var EventEmitter=require(_0x780c('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x780c('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x780c('0x2'),'afterUpdate':_0x780c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1377ae){return function(_0x10c550,_0x1ee316,_0x20708e){ChatInteractionEvents[_0x780c('0x4')](_0x1377ae+':'+_0x10c550['id'],_0x10c550);ChatInteractionEvents[_0x780c('0x4')](_0x1377ae,_0x10c550);_0x20708e(null);};}for(var e in events){if(events[_0x780c('0x5')](e)){var event=events[e];ChatInteraction[_0x780c('0x6')](e,emitEvent(event));}}module[_0x780c('0x7')]=ChatInteractionEvents; \ No newline at end of file +var _0xc44d=['save','update','remove','hook','exports','events','ChatInteraction','setMaxListeners'];(function(_0x43389f,_0x5a81c9){var _0x1978e0=function(_0x544938){while(--_0x544938){_0x43389f['push'](_0x43389f['shift']());}};_0x1978e0(++_0x5a81c9);}(_0xc44d,0x7d));var _0xdc44=function(_0x28085b,_0x2f6171){_0x28085b=_0x28085b-0x0;var _0x4f1700=_0xc44d[_0x28085b];return _0x4f1700;};'use strict';var EventEmitter=require(_0xdc44('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xdc44('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xdc44('0x2')](0x0);var events={'afterCreate':_0xdc44('0x3'),'afterUpdate':_0xdc44('0x4'),'afterDestroy':_0xdc44('0x5')};function emitEvent(_0x4b35bd){return function(_0x20627e,_0x15623b,_0x2af1dd){ChatInteractionEvents['emit'](_0x4b35bd+':'+_0x20627e['id'],_0x20627e);ChatInteractionEvents['emit'](_0x4b35bd,_0x20627e);_0x2af1dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xdc44('0x6')](e,emitEvent(event));}}module[_0xdc44('0x7')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 8912aa9..1afe677 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 _0xce79=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','define','ChatInteraction','chat_interactions','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xce79,0xc2));var _0x9ce7=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0xce79[_0x5b8310];return _0xd3ebc1;};'use strict';var _=require(_0x9ce7('0x0'));var util=require(_0x9ce7('0x1'));var logger=require('../../config/logger')(_0x9ce7('0x2'));var moment=require(_0x9ce7('0x3'));var BPromise=require(_0x9ce7('0x4'));var rp=require('request-promise');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x20d30c,_0x144d2e){return _0x20d30c[_0x9ce7('0x5')](_0x9ce7('0x6'),attributes,{'tableName':_0x9ce7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f1216,_0x2d834c,_0x41e47e){if(_0x5f1216['changed']('closed')){_0x5f1216['closedAt']=moment()[_0x9ce7('0x8')](_0x9ce7('0x9'));}_0x41e47e(null,_0x5f1216);}},'charset':_0x9ce7('0xa'),'collate':_0x9ce7('0xb')});}; \ No newline at end of file +var _0x4a01=['request-promise','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x4a01,0xdd));var _0x14a0=function(_0x1d8ffd,_0x2ad938){_0x1d8ffd=_0x1d8ffd-0x0;var _0x43b76d=_0x4a01[_0x1d8ffd];return _0x43b76d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x14a0('0x0'))(_0x14a0('0x1'));var moment=require(_0x14a0('0x2'));var BPromise=require(_0x14a0('0x3'));var rp=require(_0x14a0('0x4'));var attributes=require(_0x14a0('0x5'));module[_0x14a0('0x6')]=function(_0x1377a3,_0x2266c5){return _0x1377a3[_0x14a0('0x7')](_0x14a0('0x8'),attributes,{'tableName':_0x14a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x154722,_0x539811,_0x41ae05){if(_0x154722[_0x14a0('0xa')]('closed')){_0x154722[_0x14a0('0xb')]=moment()[_0x14a0('0xc')](_0x14a0('0xd'));}_0x41ae05(null,_0x154722);}},'charset':'utf8mb4','collate':_0x14a0('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 79aba5c..38f8a8f 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 _0x07fb=['message','info','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3256bc,_0x957b5c){var _0x51f4b7=function(_0xca4ee3){while(--_0xca4ee3){_0x3256bc['push'](_0x3256bc['shift']());}};_0x51f4b7(++_0x957b5c);}(_0x07fb,0x16a));var _0xb07f=function(_0xf43cb,_0x465374){_0xf43cb=_0xf43cb-0x0;var _0x14e869=_0x07fb[_0xf43cb];return _0x14e869;};'use strict';var _=require(_0xb07f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb07f('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb07f('0x2'))('rpc');var config=require(_0xb07f('0x3'));var jayson=require(_0xb07f('0x4'));var client=jayson[_0xb07f('0x5')][_0xb07f('0x6')]({'port':0x232a});config[_0xb07f('0x7')]=_[_0xb07f('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb07f('0x9'))['register'](socket);function respondWithRpcPromise(_0x3717c6,_0x128b9b,_0x4ad856){return new BPromise(function(_0x5e2523,_0x1d3c76){return client[_0xb07f('0xa')](_0x3717c6,_0x4ad856)[_0xb07f('0xb')](function(_0xebb28c){logger['info'](_0xb07f('0xc'),_0x128b9b,_0xb07f('0xd'));logger[_0xb07f('0xe')](_0xb07f('0xf'),_0x128b9b,_0xb07f('0xd'),JSON['stringify'](_0xebb28c));if(_0xebb28c[_0xb07f('0x10')]){if(_0xebb28c[_0xb07f('0x10')][_0xb07f('0x11')]===0x1f4){logger[_0xb07f('0x10')](_0xb07f('0xc'),_0x128b9b,_0xebb28c[_0xb07f('0x10')][_0xb07f('0x12')]);return _0x1d3c76(_0xebb28c[_0xb07f('0x10')][_0xb07f('0x12')]);}logger[_0xb07f('0x10')](_0xb07f('0xc'),_0x128b9b,_0xebb28c[_0xb07f('0x10')][_0xb07f('0x12')]);return _0x5e2523(_0xebb28c[_0xb07f('0x10')][_0xb07f('0x12')]);}else{logger[_0xb07f('0x13')](_0xb07f('0xc'),_0x128b9b,_0xb07f('0xd'));_0x5e2523(_0xebb28c['result'][_0xb07f('0x12')]);}})[_0xb07f('0x14')](function(_0x35683b){logger['error'](_0xb07f('0xc'),_0x128b9b,_0x35683b);_0x1d3c76(_0x35683b);});});}exports['UpdateChatInteraction']=function(_0x1963e5){var _0x19460c=this;return new Promise(function(_0x417b06,_0x4f9f6c){return db[_0xb07f('0x15')][_0xb07f('0x16')](_0x1963e5[_0xb07f('0x17')],{'raw':_0x1963e5[_0xb07f('0x18')]?_0x1963e5[_0xb07f('0x18')][_0xb07f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1963e5[_0xb07f('0x18')]?_0x1963e5[_0xb07f('0x18')][_0xb07f('0x1a')]||null:null,'attributes':_0x1963e5[_0xb07f('0x18')]?_0x1963e5['options'][_0xb07f('0x1b')]||null:null,'limit':_0x1963e5[_0xb07f('0x18')]?_0x1963e5[_0xb07f('0x18')][_0xb07f('0x1c')]||null:null})[_0xb07f('0xb')](function(_0x49a194){logger[_0xb07f('0x13')](_0xb07f('0x1d'),_0x1963e5);logger[_0xb07f('0xe')]('UpdateChatInteraction',_0x1963e5,JSON[_0xb07f('0x1e')](_0x49a194));_0x417b06(_0x49a194);})[_0xb07f('0x14')](function(_0x5bd049){logger[_0xb07f('0x10')]('UpdateChatInteraction',_0x5bd049[_0xb07f('0x12')],_0x1963e5);_0x4f9f6c(_0x19460c['error'](0x1f4,_0x5bd049[_0xb07f('0x12')]));});});};exports[_0xb07f('0x1f')]=function(_0x175855){return new Promise(function(_0x6e3b96,_0x1a102b){return db[_0xb07f('0x15')][_0xb07f('0x20')]({'where':_0x175855[_0xb07f('0x18')]?_0x175855[_0xb07f('0x18')][_0xb07f('0x1a')]||null:null})[_0xb07f('0xb')](function(_0x533104){if(_0x533104){return _0x533104[_0xb07f('0x21')](_0x175855['body'][_0xb07f('0x22')],_[_0xb07f('0x23')](_0x175855['body'],[_0xb07f('0x22'),'id'])||{});}})[_0xb07f('0x24')](function(_0x5aaf58){logger['info'](_0xb07f('0x25'),_0x175855);logger[_0xb07f('0xe')]('AddTags',_0x175855,JSON[_0xb07f('0x1e')](_0x5aaf58));_0x6e3b96(_0x5aaf58);})['catch'](function(_0x11b1c2){logger[_0xb07f('0x10')](_0xb07f('0x25'),_0x11b1c2[_0xb07f('0x12')],_0x175855);_0x1a102b(_this['error'](0x1f4,_0x11b1c2[_0xb07f('0x12')]));});});}; \ No newline at end of file +var _0x2c7b=['ioredis','../../mysqldb','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x2c7b,0x1c4));var _0xb2c7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2c7b[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xb2c7('0x0'));var moment=require(_0xb2c7('0x1'));var BPromise=require(_0xb2c7('0x2'));var rs=require(_0xb2c7('0x3'));var fs=require('fs');var Redis=require(_0xb2c7('0x4'));var db=require(_0xb2c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2c7('0x6'))(_0xb2c7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2c7('0x8')]['http']({'port':0x232a});config[_0xb2c7('0x9')]=_[_0xb2c7('0xa')](config[_0xb2c7('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb2c7('0xb'))(new Redis(config[_0xb2c7('0x9')]));require(_0xb2c7('0xc'))[_0xb2c7('0xd')](socket);function respondWithRpcPromise(_0x42a835,_0x1f9b2c,_0x18bcd2){return new BPromise(function(_0x411d8f,_0x401f07){return client['request'](_0x42a835,_0x18bcd2)[_0xb2c7('0xe')](function(_0x499a38){logger[_0xb2c7('0xf')](_0xb2c7('0x10'),_0x1f9b2c,_0xb2c7('0x11'));logger[_0xb2c7('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1f9b2c,_0xb2c7('0x11'),JSON[_0xb2c7('0x13')](_0x499a38));if(_0x499a38[_0xb2c7('0x14')]){if(_0x499a38[_0xb2c7('0x14')]['code']===0x1f4){logger[_0xb2c7('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x1f9b2c,_0x499a38[_0xb2c7('0x14')][_0xb2c7('0x15')]);return _0x401f07(_0x499a38[_0xb2c7('0x14')][_0xb2c7('0x15')]);}logger['error'](_0xb2c7('0x10'),_0x1f9b2c,_0x499a38[_0xb2c7('0x14')][_0xb2c7('0x15')]);return _0x411d8f(_0x499a38[_0xb2c7('0x14')]['message']);}else{logger[_0xb2c7('0xf')](_0xb2c7('0x10'),_0x1f9b2c,_0xb2c7('0x11'));_0x411d8f(_0x499a38[_0xb2c7('0x16')][_0xb2c7('0x15')]);}})[_0xb2c7('0x17')](function(_0x22dc22){logger[_0xb2c7('0x14')](_0xb2c7('0x10'),_0x1f9b2c,_0x22dc22);_0x401f07(_0x22dc22);});});}exports[_0xb2c7('0x18')]=function(_0x69852b){var _0x41a074=this;return new Promise(function(_0x229353,_0x107856){return db[_0xb2c7('0x19')]['update'](_0x69852b['body'],{'raw':_0x69852b['options']?_0x69852b[_0xb2c7('0x1a')][_0xb2c7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x69852b[_0xb2c7('0x1a')]?_0x69852b['options'][_0xb2c7('0x1c')]||null:null,'attributes':_0x69852b['options']?_0x69852b[_0xb2c7('0x1a')][_0xb2c7('0x1d')]||null:null,'limit':_0x69852b[_0xb2c7('0x1a')]?_0x69852b[_0xb2c7('0x1a')][_0xb2c7('0x1e')]||null:null})['then'](function(_0x43ec6e){logger['info']('UpdateChatInteraction',_0x69852b);logger[_0xb2c7('0x12')]('UpdateChatInteraction',_0x69852b,JSON[_0xb2c7('0x13')](_0x43ec6e));_0x229353(_0x43ec6e);})['catch'](function(_0x6ca349){logger[_0xb2c7('0x14')](_0xb2c7('0x18'),_0x6ca349[_0xb2c7('0x15')],_0x69852b);_0x107856(_0x41a074[_0xb2c7('0x14')](0x1f4,_0x6ca349[_0xb2c7('0x15')]));});});};exports[_0xb2c7('0x1f')]=function(_0x393b24){return new Promise(function(_0x1c7fce,_0x56ae16){return db[_0xb2c7('0x19')][_0xb2c7('0x20')]({'where':_0x393b24[_0xb2c7('0x1a')]?_0x393b24[_0xb2c7('0x1a')][_0xb2c7('0x1c')]||null:null})['then'](function(_0x4140ff){if(_0x4140ff){return _0x4140ff['addTags'](_0x393b24[_0xb2c7('0x21')][_0xb2c7('0x22')],_[_0xb2c7('0x23')](_0x393b24[_0xb2c7('0x21')],['ids','id'])||{});}})[_0xb2c7('0x24')](function(_0x2795e0){logger['info']('AddTags',_0x393b24);logger['debug'](_0xb2c7('0x25'),_0x393b24,JSON[_0xb2c7('0x13')](_0x2795e0));_0x1c7fce(_0x2795e0);})['catch'](function(_0x24964c){logger[_0xb2c7('0x14')]('AddTags',_0x24964c['message'],_0x393b24);_0x56ae16(_this['error'](0x1f4,_0x24964c[_0xb2c7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b72d1b2..dd4e538 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 _0x8f99=['length','./chatInteraction.events','save','remove','update','register'];(function(_0x3bfe89,_0x1c609c){var _0x64e6ed=function(_0x356172){while(--_0x356172){_0x3bfe89['push'](_0x3bfe89['shift']());}};_0x64e6ed(++_0x1c609c);}(_0x8f99,0x91));var _0x98f9=function(_0x1098da,_0x1a1da9){_0x1098da=_0x1098da-0x0;var _0x1021bb=_0x8f99[_0x1098da];return _0x1021bb;};'use strict';var ChatInteractionEvents=require(_0x98f9('0x0'));var events=[_0x98f9('0x1'),_0x98f9('0x2'),_0x98f9('0x3')];function createListener(_0x597a0b,_0x46a9b7){return function(_0x2c1c46){_0x46a9b7['emit'](_0x597a0b,_0x2c1c46);};}function removeListener(_0x10a3a2,_0x4d0ff1){return function(){ChatInteractionEvents['removeListener'](_0x10a3a2,_0x4d0ff1);};}exports[_0x98f9('0x4')]=function(_0x46cdb3){for(var _0x58ce1f=0x0,_0x4854ee=events[_0x98f9('0x5')];_0x58ce1f<_0x4854ee;_0x58ce1f++){var _0x347dea=events[_0x58ce1f];var _0x99afde=createListener('chatInteraction:'+_0x347dea,_0x46cdb3);ChatInteractionEvents['on'](_0x347dea,_0x99afde);}}; \ No newline at end of file +var _0x562f=['length','chatInteraction:','./chatInteraction.events','save','remove','update','removeListener'];(function(_0x42a0e4,_0x419ccb){var _0x88ecc9=function(_0x542ee9){while(--_0x542ee9){_0x42a0e4['push'](_0x42a0e4['shift']());}};_0x88ecc9(++_0x419ccb);}(_0x562f,0x80));var _0xf562=function(_0x560e64,_0x3b0905){_0x560e64=_0x560e64-0x0;var _0x5a9701=_0x562f[_0x560e64];return _0x5a9701;};'use strict';var ChatInteractionEvents=require(_0xf562('0x0'));var events=[_0xf562('0x1'),_0xf562('0x2'),_0xf562('0x3')];function createListener(_0x202f3d,_0x498061){return function(_0x524c22){_0x498061['emit'](_0x202f3d,_0x524c22);};}function removeListener(_0x2b375b,_0x51b24b){return function(){ChatInteractionEvents[_0xf562('0x4')](_0x2b375b,_0x51b24b);};}exports['register']=function(_0x240e78){for(var _0x21f7aa=0x0,_0x1deb08=events[_0xf562('0x5')];_0x21f7aa<_0x1deb08;_0x21f7aa++){var _0x2507eb=events[_0x21f7aa];var _0x2fff72=createListener(_0xf562('0x6')+_0x2507eb,_0x240e78);ChatInteractionEvents['on'](_0x2507eb,_0x2fff72);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index e8cd785..d8a158e 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 _0xda3f=['exports','util','path','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','describe','get','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xda3f,0xec));var _0xfda3=function(_0x47110d,_0x612369){_0x47110d=_0x47110d-0x0;var _0x557847=_0xda3f[_0x47110d];return _0x557847;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xfda3('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xfda3('0x3'));var controller=require(_0xfda3('0x4'));router['get']('/',auth[_0xfda3('0x5')](),controller[_0xfda3('0x6')]);router['get']('/describe',auth[_0xfda3('0x5')](),controller[_0xfda3('0x7')]);router[_0xfda3('0x8')](_0xfda3('0x9'),auth[_0xfda3('0xa')](),controller[_0xfda3('0xb')]);router[_0xfda3('0x8')](_0xfda3('0xc'),auth[_0xfda3('0xa')](),controller[_0xfda3('0xd')]);router[_0xfda3('0x8')](_0xfda3('0xe'),auth['isAuthenticated'](),controller[_0xfda3('0xf')]);router[_0xfda3('0x8')](_0xfda3('0x10'),auth[_0xfda3('0xa')](),controller[_0xfda3('0x11')]);router['get'](_0xfda3('0x12'),auth['isAuthenticated'](),controller[_0xfda3('0x13')]);router[_0xfda3('0x14')]('/',auth['isAuthenticated'](),controller['create']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x227d72,_0x477fc0,_0x5ea793){_0x5ea793(null,path['join'](config['root'],_0xfda3('0x15')));},'filename':function(_0x474707,_0x249dc6,_0x3d8bcd){_0x3d8bcd(null,util[_0xfda3('0x16')](_0xfda3('0x17'),Date[_0xfda3('0x18')](),_0x249dc6[_0xfda3('0x19')][_0xfda3('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfda3('0x14')]('/:id/attachment_upload',upload[_0xfda3('0x1b')](_0xfda3('0x1c')),controller[_0xfda3('0x1d')]);router[_0xfda3('0x14')]('/:id/messages',auth[_0xfda3('0xa')](),controller[_0xfda3('0x1e')]);router[_0xfda3('0x14')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xfda3('0x1f')](_0xfda3('0x20'),_0xfda3('0x21')),controller['addTags']);router[_0xfda3('0x22')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),interaction[_0xfda3('0x1f')](_0xfda3('0x20'),_0xfda3('0x23')),controller[_0xfda3('0x24')]);router[_0xfda3('0x22')](_0xfda3('0x25'),controller['customUpdate']);router[_0xfda3('0x22')](_0xfda3('0x26'),auth[_0xfda3('0xa')](),controller['abandon']);router[_0xfda3('0x22')](_0xfda3('0x27'),controller[_0xfda3('0x28')]);router[_0xfda3('0x29')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),interaction['tracked'](_0xfda3('0x20'),_0xfda3('0x2a')),controller[_0xfda3('0x2b')]);router[_0xfda3('0x29')](_0xfda3('0x2c'),auth['isAuthenticated'](),controller[_0xfda3('0x2d')]);module[_0xfda3('0x2e')]=router; \ No newline at end of file +var _0x7072=['addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','chatinteraction:destroy','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','post','/:id/attachment_upload','single','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags'];(function(_0x252179,_0x3f5493){var _0x58525c=function(_0x378b3f){while(--_0x378b3f){_0x252179['push'](_0x252179['shift']());}};_0x58525c(++_0x3f5493);}(_0x7072,0x138));var _0x2707=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x7072[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2707('0x5'));var controller=require('./chatInteraction.controller');router[_0x2707('0x6')]('/',auth[_0x2707('0x7')](),controller[_0x2707('0x8')]);router[_0x2707('0x6')](_0x2707('0x9'),auth[_0x2707('0x7')](),controller[_0x2707('0xa')]);router[_0x2707('0x6')](_0x2707('0xb'),auth[_0x2707('0xc')](),controller['show']);router['get'](_0x2707('0xd'),auth[_0x2707('0xc')](),controller[_0x2707('0xe')]);router[_0x2707('0x6')](_0x2707('0xf'),auth[_0x2707('0x7')](),controller[_0x2707('0x10')]);router[_0x2707('0x6')](_0x2707('0x11'),auth[_0x2707('0xc')](),controller[_0x2707('0x12')]);router[_0x2707('0x6')](_0x2707('0x13'),auth['isAuthenticated'](),controller[_0x2707('0x14')]);router['post']('/',auth[_0x2707('0x7')](),controller[_0x2707('0x15')]);var upload=multer({'storage':multer[_0x2707('0x16')]({'destination':function(_0x3a67f2,_0x13d9ac,_0x4e52a3){_0x4e52a3(null,path[_0x2707('0x17')](config[_0x2707('0x18')],_0x2707('0x19')));},'filename':function(_0x5d523f,_0x1153d7,_0x42f374){_0x42f374(null,util[_0x2707('0x1a')](_0x2707('0x1b'),Date[_0x2707('0x1c')](),_0x1153d7[_0x2707('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2707('0x1e')](_0x2707('0x1f'),upload[_0x2707('0x20')]('file'),controller['attachmentUpload']);router['post'](_0x2707('0xf'),auth[_0x2707('0xc')](),controller[_0x2707('0x21')]);router[_0x2707('0x1e')](_0x2707('0x22'),auth[_0x2707('0x7')](),interaction[_0x2707('0x23')](_0x2707('0x24'),_0x2707('0x25')),controller[_0x2707('0x26')]);router[_0x2707('0x27')](_0x2707('0xb'),auth[_0x2707('0x7')](),interaction[_0x2707('0x23')]('chat',_0x2707('0x28')),controller[_0x2707('0x29')]);router[_0x2707('0x27')](_0x2707('0x2a'),controller[_0x2707('0x2b')]);router[_0x2707('0x27')]('/:id/abandon',auth[_0x2707('0xc')](),controller[_0x2707('0x2c')]);router[_0x2707('0x27')](_0x2707('0x2d'),controller[_0x2707('0x2e')]);router['delete'](_0x2707('0xb'),auth['isAuthenticated'](),interaction[_0x2707('0x23')](_0x2707('0x24'),_0x2707('0x2f')),controller['destroy']);router[_0x2707('0x30')](_0x2707('0x22'),auth[_0x2707('0x7')](),controller['removeTags']);module[_0x2707('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 817039d..ad744e0 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 _0x4ccb=['INTEGER','sequelize','exports','TEXT','BOOLEAN'];(function(_0x41f96e,_0x333851){var _0x48a4ac=function(_0xdad934){while(--_0xdad934){_0x41f96e['push'](_0x41f96e['shift']());}};_0x48a4ac(++_0x333851);}(_0x4ccb,0x196));var _0xb4cc=function(_0x120d87,_0x4f9682){_0x120d87=_0x120d87-0x0;var _0x1a98d2=_0x4ccb[_0x120d87];return _0x1a98d2;};'use strict';var Sequelize=require(_0xb4cc('0x0'));module[_0xb4cc('0x1')]={'body':{'type':Sequelize[_0xb4cc('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb4cc('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb4cc('0x4')]}}; \ No newline at end of file +var _0xe785=['INTEGER','sequelize','exports','medium','BOOLEAN'];(function(_0x3e9986,_0x4dc6b2){var _0x1eca35=function(_0xeafdd8){while(--_0xeafdd8){_0x3e9986['push'](_0x3e9986['shift']());}};_0x1eca35(++_0x4dc6b2);}(_0xe785,0x128));var _0x5e78=function(_0x1cc7bf,_0x143305){_0x1cc7bf=_0x1cc7bf-0x0;var _0x2ca440=_0xe785[_0x1cc7bf];return _0x2ca440;};'use strict';var Sequelize=require(_0x5e78('0x0'));module[_0x5e78('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5e78('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5e78('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5e78('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f1c3685..0036c47 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 _0xe59a=['querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','ChatInternalMessage','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','agent','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','resourceId','push','messages','FromId','read','-createdAt','all','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x168813,_0x4c0625){var _0xb9cc85=function(_0x1dc6d0){while(--_0x1dc6d0){_0x168813['push'](_0x168813['shift']());}};_0xb9cc85(++_0x4c0625);}(_0xe59a,0x19f));var _0xae59=function(_0x4fb3f,_0x273ded){_0x4fb3f=_0x4fb3f-0x0;var _0x48ab2c=_0xe59a[_0x4fb3f];return _0x48ab2c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xae59('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae59('0x1'));var rp=require(_0xae59('0x2'));var moment=require('moment');var BPromise=require(_0xae59('0x3'));var Mustache=require(_0xae59('0x4'));var util=require(_0xae59('0x5'));var path=require('path');var sox=require(_0xae59('0x6'));var csv=require(_0xae59('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xae59('0x8'));var squel=require(_0xae59('0x9'));var crypto=require(_0xae59('0xa'));var jsforce=require(_0xae59('0xb'));var deskjs=require(_0xae59('0xc'));var toCsv=require(_0xae59('0x7'));var querystring=require(_0xae59('0xd'));var Papa=require(_0xae59('0xe'));var authService=require(_0xae59('0xf'));var hardwareService=require(_0xae59('0x10'));var Redis=require(_0xae59('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0xae59('0x12'))(_0xae59('0x13'));var utils=require('../../config/utils');var config=require(_0xae59('0x14'));var db=require(_0xae59('0x15'))['db'];config['redis']=_[_0xae59('0x16')](config['redis'],{'host':_0xae59('0x17'),'port':0x18eb});var socket=require(_0xae59('0x18'))(new Redis(config[_0xae59('0x19')]));require(_0xae59('0x1a'))[_0xae59('0x1b')](socket);function respondWithStatusCode(_0x5bb177,_0x78c798){_0x78c798=_0x78c798||0xcc;return function(_0x266dfb){if(_0x266dfb){return _0x5bb177['sendStatus'](_0x78c798);}return _0x5bb177[_0xae59('0x1c')](_0x78c798)[_0xae59('0x1d')]();};}function respondWithResult(_0x340447,_0x17dce6){_0x17dce6=_0x17dce6||0xc8;return function(_0x4f9cde){if(_0x4f9cde){return _0x340447['status'](_0x17dce6)[_0xae59('0x1e')](_0x4f9cde);}};}function respondWithFilteredResult(_0x8069bd,_0xd3414){return function(_0x17d105){if(_0x17d105){var _0x2652cc=_0x17d105[_0xae59('0x1f')],_0x55c512=_0xd3414[_0xae59('0x20')],_0x26cf63=_0xd3414[_0xae59('0x20')]+_0xd3414[_0xae59('0x21')],_0x1afb13;if(_0x26cf63>=_0x2652cc){_0x26cf63=_0x2652cc;_0x1afb13=0xc8;}else{_0x1afb13=0xce;}_0x8069bd[_0xae59('0x1c')](_0x1afb13);return _0x8069bd['set'](_0xae59('0x22'),_0x55c512+'-'+_0x26cf63+'/'+_0x2652cc)[_0xae59('0x1e')](_0x17d105);}return null;};}function patchUpdates(_0x244f36){return function(_0x4cecc2){try{jsonpatch[_0xae59('0x23')](_0x4cecc2,_0x244f36,!![]);}catch(_0x43617a){return BPromise[_0xae59('0x24')](_0x43617a);}return _0x4cecc2['save']();};}function saveUpdates(_0x395f00,_0x2e9a3d){return function(_0x229530){if(_0x229530){return _0x229530[_0xae59('0x25')](_0x395f00)[_0xae59('0x26')](function(_0xde809a){return _0xde809a;});}return null;};}function removeEntity(_0x42b928,_0x420848){return function(_0x376511){if(_0x376511){return _0x376511[_0xae59('0x27')]()[_0xae59('0x26')](function(){_0x42b928[_0xae59('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d8a1,_0x30925d){return function(_0xd9d6ad){if(!_0xd9d6ad){_0x19d8a1[_0xae59('0x28')](0x194);}return _0xd9d6ad;};}function handleError(_0x14cf6a,_0x3063ce){_0x3063ce=_0x3063ce||0x1f4;return function(_0x4f8b9c){logger[_0xae59('0x29')](_0x4f8b9c[_0xae59('0x2a')]);if(_0x4f8b9c[_0xae59('0x2b')]){delete _0x4f8b9c[_0xae59('0x2b')];}_0x14cf6a['status'](_0x3063ce)[_0xae59('0x2c')](_0x4f8b9c);};}exports[_0xae59('0x2d')]=function(_0x44ae17,_0x3127cb){var _0xddc205={},_0x32d78b={},_0x2b56b1={'count':0x0,'rows':[]};var _0x270253=db[_0xae59('0x2e')][_0xae59('0x2f')];_0x32d78b[_0xae59('0x30')]=_[_0xae59('0x31')](_0x270253);_0x32d78b[_0xae59('0x32')]=_['keys'](_0x44ae17[_0xae59('0x32')]);_0x32d78b[_0xae59('0x33')]=_[_0xae59('0x34')](_0x32d78b[_0xae59('0x30')],_0x32d78b[_0xae59('0x32')]);_0xddc205[_0xae59('0x35')]=_[_0xae59('0x34')](_0x32d78b[_0xae59('0x30')],qs[_0xae59('0x36')](_0x44ae17[_0xae59('0x32')]['fields']));_0xddc205['attributes']=_0xddc205[_0xae59('0x35')][_0xae59('0x37')]?_0xddc205[_0xae59('0x35')]:_0x32d78b['model'];if(!_0x44ae17[_0xae59('0x32')][_0xae59('0x38')](_0xae59('0x39'))){_0xddc205['limit']=qs[_0xae59('0x21')](_0x44ae17['query'][_0xae59('0x21')]);_0xddc205[_0xae59('0x20')]=qs[_0xae59('0x20')](_0x44ae17[_0xae59('0x32')][_0xae59('0x20')]);}_0xddc205['order']=qs[_0xae59('0x3a')](_0x44ae17[_0xae59('0x32')]['sort']);_0xddc205[_0xae59('0x3b')]=qs['filters'](_['pick'](_0x44ae17[_0xae59('0x32')],_0x32d78b[_0xae59('0x33')]));if(_0x44ae17[_0xae59('0x32')]['filter']){_0xddc205[_0xae59('0x3b')]=_[_0xae59('0x3c')](_0xddc205[_0xae59('0x3b')],{'$or':_[_0xae59('0x3d')](_0x270253,function(_0x404a3b){if(_0x404a3b[_0xae59('0x3e')][_0xae59('0x3f')]!==_0xae59('0x40')){var _0x430591={};_0x430591[_0x404a3b[_0xae59('0x41')]]={'$like':'%'+_0x44ae17[_0xae59('0x32')][_0xae59('0x42')]+'%'};return _0x430591;}})});}_0xddc205=_[_0xae59('0x3c')]({},_0xddc205,_0x44ae17[_0xae59('0x43')]);var _0x419480={'where':_0xddc205[_0xae59('0x3b')]};return db['ChatInternalMessage'][_0xae59('0x1f')](_0x419480)[_0xae59('0x26')](function(_0x4a997e){_0x2b56b1['count']=_0x4a997e;if(_0x44ae17['query'][_0xae59('0x44')]){_0xddc205[_0xae59('0x45')]=[{'all':!![]}];}return db[_0xae59('0x2e')][_0xae59('0x46')](_0xddc205);})[_0xae59('0x26')](function(_0x1be213){_0x2b56b1[_0xae59('0x47')]=_0x1be213;return _0x2b56b1;})[_0xae59('0x26')](respondWithFilteredResult(_0x3127cb,_0xddc205))[_0xae59('0x48')](handleError(_0x3127cb,null));};exports[_0xae59('0x49')]=function(_0x420926,_0xe85616){var _0x33d6ea={'raw':!![],'where':{'id':_0x420926[_0xae59('0x4a')]['id']}},_0x5ccdda={};_0x5ccdda[_0xae59('0x30')]=_['keys'](db[_0xae59('0x2e')][_0xae59('0x2f')]);_0x5ccdda[_0xae59('0x32')]=_[_0xae59('0x31')](_0x420926[_0xae59('0x32')]);_0x5ccdda[_0xae59('0x33')]=_[_0xae59('0x34')](_0x5ccdda[_0xae59('0x30')],_0x5ccdda[_0xae59('0x32')]);_0x33d6ea['attributes']=_[_0xae59('0x34')](_0x5ccdda['model'],qs['fields'](_0x420926[_0xae59('0x32')][_0xae59('0x36')]));_0x33d6ea[_0xae59('0x35')]=_0x33d6ea[_0xae59('0x35')][_0xae59('0x37')]?_0x33d6ea['attributes']:_0x5ccdda['model'];if(_0x420926[_0xae59('0x32')][_0xae59('0x44')]){_0x33d6ea[_0xae59('0x45')]=[{'all':!![]}];}_0x33d6ea=_[_0xae59('0x3c')]({},_0x33d6ea,_0x420926[_0xae59('0x43')]);return db['ChatInternalMessage'][_0xae59('0x4b')](_0x33d6ea)[_0xae59('0x26')](handleEntityNotFound(_0xe85616,null))['then'](respondWithResult(_0xe85616,null))[_0xae59('0x48')](handleError(_0xe85616,null));};exports[_0xae59('0x4c')]=function(_0x579619,_0x3facec){return db['ChatInternalMessage'][_0xae59('0x4c')](_0x579619[_0xae59('0x4d')],{})[_0xae59('0x26')](respondWithResult(_0x3facec,0xc9))['catch'](handleError(_0x3facec,null));};exports[_0xae59('0x25')]=function(_0x49b193,_0x178363){if(_0x49b193['body']['id']){delete _0x49b193[_0xae59('0x4d')]['id'];}return db['ChatInternalMessage'][_0xae59('0x4b')]({'where':{'id':_0x49b193[_0xae59('0x4a')]['id']}})[_0xae59('0x26')](handleEntityNotFound(_0x178363,null))[_0xae59('0x26')](saveUpdates(_0x49b193[_0xae59('0x4d')],null))[_0xae59('0x26')](respondWithResult(_0x178363,null))[_0xae59('0x48')](handleError(_0x178363,null));};exports['destroy']=function(_0xfb4eb2,_0x2dcd6b){return db['ChatInternalMessage']['find']({'where':{'id':_0xfb4eb2[_0xae59('0x4a')]['id']}})[_0xae59('0x26')](handleEntityNotFound(_0x2dcd6b,null))[_0xae59('0x26')](removeEntity(_0x2dcd6b,null))[_0xae59('0x48')](handleError(_0x2dcd6b,null));};exports['describe']=function(_0x4e358a,_0x3768a7){return db[_0xae59('0x2e')][_0xae59('0x4e')]()[_0xae59('0x26')](respondWithResult(_0x3768a7,null))['catch'](handleError(_0x3768a7,null));};function wrapUser(_0x4e8912){return function(_0x54d960){var _0x1e58e8=_0x4e8912[_0xae59('0x4f')]({'plain':!![]});_0x1e58e8['messages']=[];if(_0x54d960){_0x1e58e8[_0xae59('0x50')]=_0x54d960[_0xae59('0x51')];_0x1e58e8[_0xae59('0x52')]=_0x54d960;}else{_0x1e58e8['lastMessageAt']=moment(0x0)['format'](_0xae59('0x53'));_0x1e58e8['lastMessage']={};}return _0x1e58e8;};}exports['getUsers']=function(_0x5447e4,_0x6d96a1,_0x10cbc3){var _0x5cb1a4=[];return db['User'][_0xae59('0x46')]({'where':{'role':[_0xae59('0x54'),'admin',_0xae59('0x55')]},'attributes':['id',_0xae59('0x56'),'name',_0xae59('0x57'),_0xae59('0x58'),_0xae59('0x59'),_0xae59('0x5a'),_0xae59('0x5b'),_0xae59('0x5c'),'showWebBar'],'order':qs['sort'](_0xae59('0x5d')),'include':[{'model':db[_0xae59('0x5e')],'as':_0xae59('0x5f'),'attributes':['id',_0xae59('0x2b'),'type'],'through':{'attributes':[]}}]})[_0xae59('0x26')](function(_0xc7be42){if(_0xc7be42){var _0x35a622=_0x5447e4['user'][_0xae59('0x4f')]({'plain':!![]});if(!_0x35a622)throw new Error(_0xae59('0x60'));if(_0x35a622['role']==='user'){return db['UserProfileSection'][_0xae59('0x4b')]({'where':{'name':'Agents','userProfileId':_0x35a622[_0xae59('0x61')]},'raw':!![]})[_0xae59('0x26')](function(_0x4534fd){if(_0x4534fd){if(_0x4534fd[_0xae59('0x62')]===0x0){return db[_0xae59('0x63')][_0xae59('0x46')]({'where':{'sectionId':_0x4534fd['id']},'raw':!![]})[_0xae59('0x26')](function(_0x3bff5d){var _0x37e245=[];if(_['isEmpty'](_0x3bff5d)){_0x37e245=_[_0xae59('0x42')](_0xc7be42,function(_0x5b9044){if(_0x5b9044[_0xae59('0x57')]!==_0xae59('0x54')){return _0x5b9044;}});return _0x37e245;}else{for(var _0x3a15db=0x0;_0x3a15db<_0xc7be42[_0xae59('0x37')];_0x3a15db++){var _0x45bdb2=_0xc7be42[_0x3a15db];if(_0x45bdb2[_0xae59('0x57')]===_0xae59('0x54')){var _0x119ccb=_[_0xae59('0x4b')](_0x3bff5d,function(_0x4d487a){return _0x4d487a[_0xae59('0x64')]===_0x45bdb2['id'];});if(_0x119ccb)_0x37e245[_0xae59('0x65')](_0x45bdb2);}else{_0x37e245['push'](_0x45bdb2);}}return _0x37e245;}});}else{return _0xc7be42;}}else{var _0x5ed46d=_[_0xae59('0x42')](_0xc7be42,function(_0x35bb86){if(_0x35bb86[_0xae59('0x57')]!=='agent'){return _0x35bb86;}});return _0x5ed46d;}});}else{return _0xc7be42;}}})[_0xae59('0x26')](function(_0x3bc127){var _0x4b64db=[];if(_0x3bc127){_0x5cb1a4=_0x3bc127;for(var _0x3d3916=0x0;_0x3d3916<_0x3bc127[_0xae59('0x37')];_0x3d3916+=0x1){_0x5cb1a4[_0x3d3916][_0xae59('0x66')]=[];_0x4b64db[_0xae59('0x65')](db['ChatInternalMessage'][_0xae59('0x4b')]({'where':{'FromId':[_0x5447e4[_0xae59('0x55')]['id'],_0x3bc127[_0x3d3916]['id']],'ToId':[_0x5447e4[_0xae59('0x55')]['id'],_0x3bc127[_0x3d3916]['id']],'ChatGroupId':null},'attributes':['id',_0xae59('0x51'),_0xae59('0x67'),'ToId',_0xae59('0x68'),'body'],'order':qs[_0xae59('0x3a')](_0xae59('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xae59('0x26')](wrapUser(_0x3bc127[_0x3d3916])));}return BPromise[_0xae59('0x6a')](_0x4b64db);}return[];})['then'](function(_0x2ea7a6){return{'rows':_0x2ea7a6,'count':_0x2ea7a6[_0xae59('0x37')]};})[_0xae59('0x26')](respondWithResult(_0x6d96a1,null))[_0xae59('0x48')](handleError(_0x6d96a1,null));}; \ No newline at end of file +var _0xa639=['papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','ChatInternalMessage','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','jsforce','querystring'];(function(_0xd9b7e,_0x2626e8){var _0x49386f=function(_0x2a29d4){while(--_0x2a29d4){_0xd9b7e['push'](_0xd9b7e['shift']());}};_0x49386f(++_0x2626e8);}(_0xa639,0x140));var _0x9a63=function(_0xadd386,_0x1fda2a){_0xadd386=_0xadd386-0x0;var _0xb996dd=_0xa639[_0xadd386];return _0xb996dd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9a63('0x0'));var rimraf=require(_0x9a63('0x1'));var zipdir=require(_0x9a63('0x2'));var jsonpatch=require(_0x9a63('0x3'));var rp=require(_0x9a63('0x4'));var moment=require('moment');var BPromise=require(_0x9a63('0x5'));var Mustache=require('mustache');var util=require(_0x9a63('0x6'));var path=require('path');var sox=require(_0x9a63('0x7'));var csv=require(_0x9a63('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a63('0x9'));var squel=require(_0x9a63('0xa'));var crypto=require('crypto');var jsforce=require(_0x9a63('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9a63('0x8'));var querystring=require(_0x9a63('0xc'));var Papa=require(_0x9a63('0xd'));var authService=require(_0x9a63('0xe'));var hardwareService=require(_0x9a63('0xf'));var Redis=require(_0x9a63('0x10'));var qs=require(_0x9a63('0x11'));var logger=require(_0x9a63('0x12'))('api');var utils=require(_0x9a63('0x13'));var config=require('../../config/environment');var db=require(_0x9a63('0x14'))['db'];config['redis']=_['defaults'](config[_0x9a63('0x15')],{'host':_0x9a63('0x16'),'port':0x18eb});var socket=require(_0x9a63('0x17'))(new Redis(config[_0x9a63('0x15')]));require('./chatInternalMessage.socket')[_0x9a63('0x18')](socket);function respondWithStatusCode(_0x116786,_0x486a5b){_0x486a5b=_0x486a5b||0xcc;return function(_0x2189de){if(_0x2189de){return _0x116786[_0x9a63('0x19')](_0x486a5b);}return _0x116786[_0x9a63('0x1a')](_0x486a5b)[_0x9a63('0x1b')]();};}function respondWithResult(_0x16f835,_0x19af35){_0x19af35=_0x19af35||0xc8;return function(_0x2479e7){if(_0x2479e7){return _0x16f835[_0x9a63('0x1a')](_0x19af35)[_0x9a63('0x1c')](_0x2479e7);}};}function respondWithFilteredResult(_0x83738e,_0x11860a){return function(_0x3d9aeb){if(_0x3d9aeb){var _0x5d9eda=_0x3d9aeb[_0x9a63('0x1d')],_0x7ac2c2=_0x11860a[_0x9a63('0x1e')],_0x13a98e=_0x11860a[_0x9a63('0x1e')]+_0x11860a[_0x9a63('0x1f')],_0x27ca0e;if(_0x13a98e>=_0x5d9eda){_0x13a98e=_0x5d9eda;_0x27ca0e=0xc8;}else{_0x27ca0e=0xce;}_0x83738e['status'](_0x27ca0e);return _0x83738e[_0x9a63('0x20')](_0x9a63('0x21'),_0x7ac2c2+'-'+_0x13a98e+'/'+_0x5d9eda)[_0x9a63('0x1c')](_0x3d9aeb);}return null;};}function patchUpdates(_0xf31ed4){return function(_0x3b8459){try{jsonpatch[_0x9a63('0x22')](_0x3b8459,_0xf31ed4,!![]);}catch(_0x5afa25){return BPromise[_0x9a63('0x23')](_0x5afa25);}return _0x3b8459[_0x9a63('0x24')]();};}function saveUpdates(_0x1dbf11,_0x54226c){return function(_0x435a5c){if(_0x435a5c){return _0x435a5c['update'](_0x1dbf11)[_0x9a63('0x25')](function(_0x2c37e4){return _0x2c37e4;});}return null;};}function removeEntity(_0xb8bd4a,_0x17aabc){return function(_0x4c7a6a){if(_0x4c7a6a){return _0x4c7a6a['destroy']()[_0x9a63('0x25')](function(){_0xb8bd4a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c57d9,_0x132dba){return function(_0x47f5fd){if(!_0x47f5fd){_0x3c57d9[_0x9a63('0x19')](0x194);}return _0x47f5fd;};}function handleError(_0x5d2bfe,_0x2c0d8c){_0x2c0d8c=_0x2c0d8c||0x1f4;return function(_0x2f5b22){logger[_0x9a63('0x26')](_0x2f5b22[_0x9a63('0x27')]);if(_0x2f5b22[_0x9a63('0x28')]){delete _0x2f5b22['name'];}_0x5d2bfe[_0x9a63('0x1a')](_0x2c0d8c)[_0x9a63('0x29')](_0x2f5b22);};}exports['index']=function(_0x3d66ab,_0x136a7a){var _0x44a1b2={},_0x478fdc={},_0x26e3da={'count':0x0,'rows':[]};var _0x5ab632=db[_0x9a63('0x2a')][_0x9a63('0x2b')];_0x478fdc[_0x9a63('0x2c')]=_[_0x9a63('0x2d')](_0x5ab632);_0x478fdc[_0x9a63('0x2e')]=_[_0x9a63('0x2d')](_0x3d66ab[_0x9a63('0x2e')]);_0x478fdc[_0x9a63('0x2f')]=_[_0x9a63('0x30')](_0x478fdc[_0x9a63('0x2c')],_0x478fdc['query']);_0x44a1b2[_0x9a63('0x31')]=_['intersection'](_0x478fdc[_0x9a63('0x2c')],qs[_0x9a63('0x32')](_0x3d66ab[_0x9a63('0x2e')][_0x9a63('0x32')]));_0x44a1b2[_0x9a63('0x31')]=_0x44a1b2[_0x9a63('0x31')][_0x9a63('0x33')]?_0x44a1b2[_0x9a63('0x31')]:_0x478fdc[_0x9a63('0x2c')];if(!_0x3d66ab[_0x9a63('0x2e')][_0x9a63('0x34')](_0x9a63('0x35'))){_0x44a1b2[_0x9a63('0x1f')]=qs[_0x9a63('0x1f')](_0x3d66ab['query'][_0x9a63('0x1f')]);_0x44a1b2[_0x9a63('0x1e')]=qs[_0x9a63('0x1e')](_0x3d66ab[_0x9a63('0x2e')][_0x9a63('0x1e')]);}_0x44a1b2[_0x9a63('0x36')]=qs[_0x9a63('0x37')](_0x3d66ab[_0x9a63('0x2e')][_0x9a63('0x37')]);_0x44a1b2[_0x9a63('0x38')]=qs[_0x9a63('0x2f')](_[_0x9a63('0x39')](_0x3d66ab[_0x9a63('0x2e')],_0x478fdc['filters']));if(_0x3d66ab['query'][_0x9a63('0x3a')]){_0x44a1b2[_0x9a63('0x38')]=_['merge'](_0x44a1b2[_0x9a63('0x38')],{'$or':_['map'](_0x5ab632,function(_0x39920a){if(_0x39920a[_0x9a63('0x3b')]['key']!==_0x9a63('0x3c')){var _0x39211a={};_0x39211a[_0x39920a['field']]={'$like':'%'+_0x3d66ab[_0x9a63('0x2e')][_0x9a63('0x3a')]+'%'};return _0x39211a;}})});}_0x44a1b2=_[_0x9a63('0x3d')]({},_0x44a1b2,_0x3d66ab[_0x9a63('0x3e')]);var _0x506774={'where':_0x44a1b2['where']};return db[_0x9a63('0x2a')][_0x9a63('0x1d')](_0x506774)[_0x9a63('0x25')](function(_0x376549){_0x26e3da[_0x9a63('0x1d')]=_0x376549;if(_0x3d66ab[_0x9a63('0x2e')][_0x9a63('0x3f')]){_0x44a1b2[_0x9a63('0x40')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x9a63('0x41')](_0x44a1b2);})['then'](function(_0x4fcd23){_0x26e3da[_0x9a63('0x42')]=_0x4fcd23;return _0x26e3da;})[_0x9a63('0x25')](respondWithFilteredResult(_0x136a7a,_0x44a1b2))[_0x9a63('0x43')](handleError(_0x136a7a,null));};exports[_0x9a63('0x44')]=function(_0x403364,_0x462a0e){var _0x179d4f={'raw':!![],'where':{'id':_0x403364[_0x9a63('0x45')]['id']}},_0x28f3f6={};_0x28f3f6['model']=_[_0x9a63('0x2d')](db[_0x9a63('0x2a')][_0x9a63('0x2b')]);_0x28f3f6['query']=_[_0x9a63('0x2d')](_0x403364[_0x9a63('0x2e')]);_0x28f3f6[_0x9a63('0x2f')]=_['intersection'](_0x28f3f6[_0x9a63('0x2c')],_0x28f3f6[_0x9a63('0x2e')]);_0x179d4f[_0x9a63('0x31')]=_[_0x9a63('0x30')](_0x28f3f6[_0x9a63('0x2c')],qs[_0x9a63('0x32')](_0x403364[_0x9a63('0x2e')][_0x9a63('0x32')]));_0x179d4f[_0x9a63('0x31')]=_0x179d4f[_0x9a63('0x31')][_0x9a63('0x33')]?_0x179d4f[_0x9a63('0x31')]:_0x28f3f6[_0x9a63('0x2c')];if(_0x403364[_0x9a63('0x2e')][_0x9a63('0x3f')]){_0x179d4f[_0x9a63('0x40')]=[{'all':!![]}];}_0x179d4f=_[_0x9a63('0x3d')]({},_0x179d4f,_0x403364[_0x9a63('0x3e')]);return db['ChatInternalMessage'][_0x9a63('0x46')](_0x179d4f)[_0x9a63('0x25')](handleEntityNotFound(_0x462a0e,null))[_0x9a63('0x25')](respondWithResult(_0x462a0e,null))['catch'](handleError(_0x462a0e,null));};exports['create']=function(_0xe6b835,_0x9f210a){return db[_0x9a63('0x2a')][_0x9a63('0x47')](_0xe6b835[_0x9a63('0x48')],{})[_0x9a63('0x25')](respondWithResult(_0x9f210a,0xc9))[_0x9a63('0x43')](handleError(_0x9f210a,null));};exports[_0x9a63('0x49')]=function(_0x484d44,_0x4ac4b3){if(_0x484d44[_0x9a63('0x48')]['id']){delete _0x484d44[_0x9a63('0x48')]['id'];}return db[_0x9a63('0x2a')][_0x9a63('0x46')]({'where':{'id':_0x484d44[_0x9a63('0x45')]['id']}})[_0x9a63('0x25')](handleEntityNotFound(_0x4ac4b3,null))[_0x9a63('0x25')](saveUpdates(_0x484d44['body'],null))[_0x9a63('0x25')](respondWithResult(_0x4ac4b3,null))[_0x9a63('0x43')](handleError(_0x4ac4b3,null));};exports[_0x9a63('0x4a')]=function(_0x460e0e,_0x425650){return db[_0x9a63('0x2a')]['find']({'where':{'id':_0x460e0e[_0x9a63('0x45')]['id']}})[_0x9a63('0x25')](handleEntityNotFound(_0x425650,null))[_0x9a63('0x25')](removeEntity(_0x425650,null))[_0x9a63('0x43')](handleError(_0x425650,null));};exports[_0x9a63('0x4b')]=function(_0x502bbf,_0x2788d3){return db['ChatInternalMessage'][_0x9a63('0x4b')]()[_0x9a63('0x25')](respondWithResult(_0x2788d3,null))['catch'](handleError(_0x2788d3,null));};function wrapUser(_0x287bbe){return function(_0x2b9124){var _0x3275b0=_0x287bbe[_0x9a63('0x4c')]({'plain':!![]});_0x3275b0[_0x9a63('0x4d')]=[];if(_0x2b9124){_0x3275b0[_0x9a63('0x4e')]=_0x2b9124[_0x9a63('0x4f')];_0x3275b0[_0x9a63('0x50')]=_0x2b9124;}else{_0x3275b0[_0x9a63('0x4e')]=moment(0x0)[_0x9a63('0x51')](_0x9a63('0x52'));_0x3275b0['lastMessage']={};}return _0x3275b0;};}exports[_0x9a63('0x53')]=function(_0x1458df,_0x27c0a5,_0x48b2a7){var _0x2cd398=[];return db[_0x9a63('0x54')][_0x9a63('0x41')]({'where':{'role':[_0x9a63('0x55'),_0x9a63('0x56'),'user']},'attributes':['id',_0x9a63('0x57'),_0x9a63('0x28'),_0x9a63('0x58'),_0x9a63('0x59'),_0x9a63('0x5a'),_0x9a63('0x5b'),_0x9a63('0x5c'),_0x9a63('0x5d'),_0x9a63('0x5e')],'order':qs[_0x9a63('0x37')](_0x9a63('0x5f')),'include':[{'model':db[_0x9a63('0x60')],'as':_0x9a63('0x61'),'attributes':['id',_0x9a63('0x28'),'type'],'through':{'attributes':[]}}]})[_0x9a63('0x25')](function(_0x265034){if(_0x265034){var _0x237025=_0x1458df['user'][_0x9a63('0x4c')]({'plain':!![]});if(!_0x237025)throw new Error(_0x9a63('0x62'));if(_0x237025[_0x9a63('0x58')]===_0x9a63('0x63')){return db[_0x9a63('0x64')][_0x9a63('0x46')]({'where':{'name':_0x9a63('0x65'),'userProfileId':_0x237025[_0x9a63('0x66')]},'raw':!![]})[_0x9a63('0x25')](function(_0x54e579){if(_0x54e579){if(_0x54e579[_0x9a63('0x67')]===0x0){return db[_0x9a63('0x68')]['findAll']({'where':{'sectionId':_0x54e579['id']},'raw':!![]})['then'](function(_0x3fb32e){var _0x374a34=[];if(_[_0x9a63('0x69')](_0x3fb32e)){_0x374a34=_['filter'](_0x265034,function(_0x1b2e4d){if(_0x1b2e4d['role']!=='agent'){return _0x1b2e4d;}});return _0x374a34;}else{for(var _0x2f09e0=0x0;_0x2f09e0<_0x265034[_0x9a63('0x33')];_0x2f09e0++){var _0x9d04de=_0x265034[_0x2f09e0];if(_0x9d04de[_0x9a63('0x58')]===_0x9a63('0x55')){var _0x199a7e=_[_0x9a63('0x46')](_0x3fb32e,function(_0x205ac7){return _0x205ac7['resourceId']===_0x9d04de['id'];});if(_0x199a7e)_0x374a34[_0x9a63('0x6a')](_0x9d04de);}else{_0x374a34[_0x9a63('0x6a')](_0x9d04de);}}return _0x374a34;}});}else{return _0x265034;}}else{var _0x2bd2b6=_[_0x9a63('0x3a')](_0x265034,function(_0x6d118a){if(_0x6d118a[_0x9a63('0x58')]!==_0x9a63('0x55')){return _0x6d118a;}});return _0x2bd2b6;}});}else{return _0x265034;}}})[_0x9a63('0x25')](function(_0x3f72c7){var _0x1d774f=[];if(_0x3f72c7){_0x2cd398=_0x3f72c7;for(var _0x47fb34=0x0;_0x47fb34<_0x3f72c7['length'];_0x47fb34+=0x1){_0x2cd398[_0x47fb34][_0x9a63('0x4d')]=[];_0x1d774f[_0x9a63('0x6a')](db[_0x9a63('0x2a')]['find']({'where':{'FromId':[_0x1458df[_0x9a63('0x63')]['id'],_0x3f72c7[_0x47fb34]['id']],'ToId':[_0x1458df['user']['id'],_0x3f72c7[_0x47fb34]['id']],'ChatGroupId':null},'attributes':['id',_0x9a63('0x4f'),'FromId',_0x9a63('0x6b'),_0x9a63('0x6c'),_0x9a63('0x48')],'order':qs[_0x9a63('0x37')](_0x9a63('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3f72c7[_0x47fb34])));}return BPromise[_0x9a63('0x6e')](_0x1d774f);}return[];})[_0x9a63('0x25')](function(_0x36a9f6){return{'rows':_0x36a9f6,'count':_0x36a9f6['length']};})[_0x9a63('0x25')](respondWithResult(_0x27c0a5,null))[_0x9a63('0x43')](handleError(_0x27c0a5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 2ea830d..29be498 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 _0x9cf7=['exports','events','../../mysqldb','ChatInternalMessage','save','emit'];(function(_0x215942,_0x1bec5a){var _0x26b17e=function(_0x34b1ec){while(--_0x34b1ec){_0x215942['push'](_0x215942['shift']());}};_0x26b17e(++_0x1bec5a);}(_0x9cf7,0x1c3));var _0x79cf=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9cf7[_0x15bc81];return _0x59440e;};'use strict';var EventEmitter=require(_0x79cf('0x0'));var ChatInternalMessage=require(_0x79cf('0x1'))['db'][_0x79cf('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x79cf('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e5150){return function(_0x16b522,_0x1ff990,_0x5419d1){ChatInternalMessageEvents['emit'](_0x2e5150+':'+_0x16b522['id'],_0x16b522);ChatInternalMessageEvents[_0x79cf('0x4')](_0x2e5150,_0x16b522);_0x5419d1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x79cf('0x5')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xab43=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2f4f99,_0x58a215){var _0x492242=function(_0x58f633){while(--_0x58f633){_0x2f4f99['push'](_0x2f4f99['shift']());}};_0x492242(++_0x58a215);}(_0xab43,0x10f));var _0x3ab4=function(_0x4b44b0,_0x5c1093){_0x4b44b0=_0x4b44b0-0x0;var _0x3ef9fa=_0xab43[_0x4b44b0];return _0x3ef9fa;};'use strict';var EventEmitter=require(_0x3ab4('0x0'));var ChatInternalMessage=require(_0x3ab4('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3ab4('0x2')](0x0);var events={'afterCreate':_0x3ab4('0x3'),'afterUpdate':_0x3ab4('0x4'),'afterDestroy':_0x3ab4('0x5')};function emitEvent(_0x4a3834){return function(_0x3e57a5,_0x3e1005,_0x338fca){ChatInternalMessageEvents[_0x3ab4('0x6')](_0x4a3834+':'+_0x3e57a5['id'],_0x3e57a5);ChatInternalMessageEvents[_0x3ab4('0x6')](_0x4a3834,_0x3e57a5);_0x338fca(null);};}for(var e in events){if(events[_0x3ab4('0x7')](e)){var event=events[e];ChatInternalMessage[_0x3ab4('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index d23d18c..3112bef 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 _0xc1b2=['utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x56b409,_0x4dbbf0){var _0x5154f4=function(_0x20e9e8){while(--_0x20e9e8){_0x56b409['push'](_0x56b409['shift']());}};_0x5154f4(++_0x4dbbf0);}(_0xc1b2,0x69));var _0x2c1b=function(_0x54b321,_0x33d76a){_0x54b321=_0x54b321-0x0;var _0x1fdf6b=_0xc1b2[_0x54b321];return _0x1fdf6b;};'use strict';var _=require(_0x2c1b('0x0'));var util=require(_0x2c1b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2c1b('0x2'));var rp=require(_0x2c1b('0x3'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0xa9f71e,_0x5a87d9){return _0xa9f71e['define'](_0x2c1b('0x4'),attributes,{'tableName':_0x2c1b('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2c1b('0x6'),'collate':_0x2c1b('0x7')});}; \ No newline at end of file +var _0x0078=['request-promise','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird'];(function(_0x9809bb,_0x133edb){var _0x3d7f24=function(_0x2ce486){while(--_0x2ce486){_0x9809bb['push'](_0x9809bb['shift']());}};_0x3d7f24(++_0x133edb);}(_0x0078,0xf7));var _0x8007=function(_0x35d45f,_0x567567){_0x35d45f=_0x35d45f-0x0;var _0x1378e9=_0x0078[_0x35d45f];return _0x1378e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8007('0x0'));var moment=require(_0x8007('0x1'));var BPromise=require(_0x8007('0x2'));var rp=require(_0x8007('0x3'));var attributes=require(_0x8007('0x4'));module[_0x8007('0x5')]=function(_0x35f6a4,_0x28f81d){return _0x35f6a4['define'](_0x8007('0x6'),attributes,{'tableName':_0x8007('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8007('0x8'),'collate':_0x8007('0x9')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index cdd302e..4667dfd 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 _0x3ec7=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request','then','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','ChatInternalMessage,\x20%s,\x20%s','result'];(function(_0x516eb0,_0x2bf9ee){var _0x4a9a49=function(_0x3142a0){while(--_0x3142a0){_0x516eb0['push'](_0x516eb0['shift']());}};_0x4a9a49(++_0x2bf9ee);}(_0x3ec7,0x1e7));var _0x73ec=function(_0x258506,_0x663262){_0x258506=_0x258506-0x0;var _0x1a4dc1=_0x3ec7[_0x258506];return _0x1a4dc1;};'use strict';var _=require('lodash');var util=require(_0x73ec('0x0'));var moment=require(_0x73ec('0x1'));var BPromise=require('bluebird');var rs=require(_0x73ec('0x2'));var fs=require('fs');var Redis=require(_0x73ec('0x3'));var db=require(_0x73ec('0x4'))['db'];var utils=require(_0x73ec('0x5'));var logger=require(_0x73ec('0x6'))(_0x73ec('0x7'));var config=require(_0x73ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x73ec('0x9')][_0x73ec('0xa')]({'port':0x232a});config[_0x73ec('0xb')]=_[_0x73ec('0xc')](config[_0x73ec('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x73ec('0xd'))(new Redis(config[_0x73ec('0xb')]));require(_0x73ec('0xe'))['register'](socket);function respondWithRpcPromise(_0x5b36e1,_0x312fe5,_0x2d12ba){return new BPromise(function(_0x6027b5,_0x5cc8c7){return client[_0x73ec('0xf')](_0x5b36e1,_0x2d12ba)[_0x73ec('0x10')](function(_0x4c258c){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x312fe5,'request\x20sent');logger[_0x73ec('0x11')](_0x73ec('0x12'),_0x312fe5,_0x73ec('0x13'),JSON[_0x73ec('0x14')](_0x4c258c));if(_0x4c258c[_0x73ec('0x15')]){if(_0x4c258c[_0x73ec('0x15')]['code']===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x312fe5,_0x4c258c[_0x73ec('0x15')]['message']);return _0x5cc8c7(_0x4c258c[_0x73ec('0x15')][_0x73ec('0x16')]);}logger[_0x73ec('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x312fe5,_0x4c258c[_0x73ec('0x15')][_0x73ec('0x16')]);return _0x6027b5(_0x4c258c[_0x73ec('0x15')][_0x73ec('0x16')]);}else{logger[_0x73ec('0x17')](_0x73ec('0x18'),_0x312fe5,_0x73ec('0x13'));_0x6027b5(_0x4c258c[_0x73ec('0x19')][_0x73ec('0x16')]);}})[_0x73ec('0x1a')](function(_0x366c98){logger[_0x73ec('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x312fe5,_0x366c98);_0x5cc8c7(_0x366c98);});});} \ No newline at end of file +var _0xd765=['then','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request'];(function(_0x3c2b07,_0x1c2f21){var _0x5b18ec=function(_0x3459e0){while(--_0x3459e0){_0x3c2b07['push'](_0x3c2b07['shift']());}};_0x5b18ec(++_0x1c2f21);}(_0xd765,0x167));var _0x5d76=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd765[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x5d76('0x0'));var util=require(_0x5d76('0x1'));var moment=require(_0x5d76('0x2'));var BPromise=require(_0x5d76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d76('0x4'));var db=require(_0x5d76('0x5'))['db'];var utils=require(_0x5d76('0x6'));var logger=require(_0x5d76('0x7'))(_0x5d76('0x8'));var config=require(_0x5d76('0x9'));var jayson=require(_0x5d76('0xa'));var client=jayson['client'][_0x5d76('0xb')]({'port':0x232a});config[_0x5d76('0xc')]=_['defaults'](config[_0x5d76('0xc')],{'host':_0x5d76('0xd'),'port':0x18eb});var socket=require(_0x5d76('0xe'))(new Redis(config[_0x5d76('0xc')]));require(_0x5d76('0xf'))[_0x5d76('0x10')](socket);function respondWithRpcPromise(_0x3c8fee,_0x543a9b,_0x925056){return new BPromise(function(_0x288ea7,_0x37854a){return client[_0x5d76('0x11')](_0x3c8fee,_0x925056)[_0x5d76('0x12')](function(_0x3cdfd8){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x543a9b,_0x5d76('0x13'));logger[_0x5d76('0x14')](_0x5d76('0x15'),_0x543a9b,_0x5d76('0x13'),JSON[_0x5d76('0x16')](_0x3cdfd8));if(_0x3cdfd8[_0x5d76('0x17')]){if(_0x3cdfd8[_0x5d76('0x17')][_0x5d76('0x18')]===0x1f4){logger[_0x5d76('0x17')](_0x5d76('0x19'),_0x543a9b,_0x3cdfd8['error']['message']);return _0x37854a(_0x3cdfd8['error'][_0x5d76('0x1a')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x543a9b,_0x3cdfd8[_0x5d76('0x17')]['message']);return _0x288ea7(_0x3cdfd8[_0x5d76('0x17')][_0x5d76('0x1a')]);}else{logger['info'](_0x5d76('0x19'),_0x543a9b,_0x5d76('0x13'));_0x288ea7(_0x3cdfd8[_0x5d76('0x1b')][_0x5d76('0x1a')]);}})[_0x5d76('0x1c')](function(_0x5546a5){logger[_0x5d76('0x17')](_0x5d76('0x19'),_0x543a9b,_0x5546a5);_0x37854a(_0x5546a5);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 1dd5580..cf34561 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 _0xad89=['removeListener','length','chatInternalMessage:','save','remove','update','emit'];(function(_0x45a9be,_0x22a47c){var _0x140af4=function(_0x5201b6){while(--_0x5201b6){_0x45a9be['push'](_0x45a9be['shift']());}};_0x140af4(++_0x22a47c);}(_0xad89,0xab));var _0x9ad8=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0xad89[_0x4629ee];return _0x47fb5b;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x9ad8('0x0'),_0x9ad8('0x1'),_0x9ad8('0x2')];function createListener(_0x4a3fb1,_0x68efb){return function(_0x3c13e6){_0x68efb[_0x9ad8('0x3')](_0x4a3fb1,_0x3c13e6);};}function removeListener(_0x5d350b,_0xf3735b){return function(){ChatInternalMessageEvents[_0x9ad8('0x4')](_0x5d350b,_0xf3735b);};}exports['register']=function(_0x3cfe27){for(var _0x55c4e8=0x0,_0x1dc8d3=events[_0x9ad8('0x5')];_0x55c4e8<_0x1dc8d3;_0x55c4e8++){var _0xf2349b=events[_0x55c4e8];var _0x1a8b81=createListener(_0x9ad8('0x6')+_0xf2349b,_0x3cfe27);ChatInternalMessageEvents['on'](_0xf2349b,_0x1a8b81);}}; \ No newline at end of file +var _0x882a=['length','chatInternalMessage:','./chatInternalMessage.events','save','emit','removeListener','register'];(function(_0x4a7926,_0x58e1de){var _0x598e78=function(_0x1e4774){while(--_0x1e4774){_0x4a7926['push'](_0x4a7926['shift']());}};_0x598e78(++_0x58e1de);}(_0x882a,0x1de));var _0xa882=function(_0x317e70,_0x3461a5){_0x317e70=_0x317e70-0x0;var _0x3bbb21=_0x882a[_0x317e70];return _0x3bbb21;};'use strict';var ChatInternalMessageEvents=require(_0xa882('0x0'));var events=[_0xa882('0x1'),'remove','update'];function createListener(_0x1ddd80,_0x4a6f33){return function(_0x182e0b){_0x4a6f33[_0xa882('0x2')](_0x1ddd80,_0x182e0b);};}function removeListener(_0x48c861,_0x2bdf2a){return function(){ChatInternalMessageEvents[_0xa882('0x3')](_0x48c861,_0x2bdf2a);};}exports[_0xa882('0x4')]=function(_0x24938b){for(var _0x5ce870=0x0,_0x14d622=events[_0xa882('0x5')];_0x5ce870<_0x14d622;_0x5ce870++){var _0x20e921=events[_0x5ce870];var _0x2c192f=createListener(_0xa882('0x6')+_0x20e921,_0x24938b);ChatInternalMessageEvents['on'](_0x20e921,_0x2c192f);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 0e1f0d6..cc8bd61 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 _0xf32f=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4a1353,_0x2fbe86){var _0x3805cc=function(_0x39a7ee){while(--_0x39a7ee){_0x4a1353['push'](_0x4a1353['shift']());}};_0x3805cc(++_0x2fbe86);}(_0xf32f,0x140));var _0xff32=function(_0x1b113c,_0x5684d2){_0x1b113c=_0x1b113c-0x0;var _0x1c2877=_0xf32f[_0x1b113c];return _0x1c2877;};'use strict';var multer=require('multer');var util=require(_0xff32('0x0'));var path=require(_0xff32('0x1'));var timeout=require(_0xff32('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xff32('0x3'));var config=require(_0xff32('0x4'));var controller=require(_0xff32('0x5'));router[_0xff32('0x6')]('/',auth[_0xff32('0x7')](),controller['index']);router[_0xff32('0x6')](_0xff32('0x8'),auth['isAuthenticated'](),controller[_0xff32('0x9')]);router[_0xff32('0x6')](_0xff32('0xa'),auth[_0xff32('0x7')](),controller['getUsers']);router[_0xff32('0x6')](_0xff32('0xb'),auth[_0xff32('0x7')](),controller[_0xff32('0xc')]);router[_0xff32('0xd')]('/',auth['isAuthenticated'](),controller[_0xff32('0xe')]);router[_0xff32('0xf')]('/:id',controller[_0xff32('0x10')]);router[_0xff32('0x11')](_0xff32('0xb'),auth[_0xff32('0x7')](),controller[_0xff32('0x12')]);module[_0xff32('0x13')]=router; \ No newline at end of file +var _0x71c3=['index','/describe','isAuthenticated','describe','/users','get','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x1444dd,_0x4494de){var _0x37035d=function(_0x15c2ae){while(--_0x15c2ae){_0x1444dd['push'](_0x1444dd['shift']());}};_0x37035d(++_0x4494de);}(_0x71c3,0xc6));var _0x371c=function(_0x9259e2,_0x5a79e8){_0x9259e2=_0x9259e2-0x0;var _0x4de1db=_0x71c3[_0x9259e2];return _0x4de1db;};'use strict';var multer=require(_0x371c('0x0'));var util=require(_0x371c('0x1'));var path=require('path');var timeout=require(_0x371c('0x2'));var express=require(_0x371c('0x3'));var router=express[_0x371c('0x4')]();var auth=require(_0x371c('0x5'));var interaction=require(_0x371c('0x6'));var config=require(_0x371c('0x7'));var controller=require(_0x371c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x371c('0x9')]);router['get'](_0x371c('0xa'),auth[_0x371c('0xb')](),controller[_0x371c('0xc')]);router['get'](_0x371c('0xd'),auth['isAuthenticated'](),controller['getUsers']);router[_0x371c('0xe')](_0x371c('0xf'),auth[_0x371c('0xb')](),controller[_0x371c('0x10')]);router[_0x371c('0x11')]('/',auth[_0x371c('0xb')](),controller[_0x371c('0x12')]);router[_0x371c('0x13')](_0x371c('0xf'),controller['update']);router[_0x371c('0x14')](_0x371c('0xf'),auth[_0x371c('0xb')](),controller[_0x371c('0x15')]);module[_0x371c('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 56ec39b..738d79c 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 _0x38ab=['out','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x316752,_0x2c3428){var _0x4bb427=function(_0x591ae3){while(--_0x591ae3){_0x316752['push'](_0x316752['shift']());}};_0x4bb427(++_0x2c3428);}(_0x38ab,0xbc));var _0xb38a=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x38ab[_0x2d34d6];return _0x1d3d12;};'use strict';var Sequelize=require(_0xb38a('0x0'));module[_0xb38a('0x1')]={'body':{'type':Sequelize[_0xb38a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb38a('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb38a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb38a('0x4')),'defaultValue':_0xb38a('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb38a('0x5')]}}; \ No newline at end of file +var _0x0186=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0186,0x139));var _0x6018=function(_0x164e57,_0x532572){_0x164e57=_0x164e57-0x0;var _0xfa712b=_0x0186[_0x164e57];return _0xfa712b;};'use strict';var Sequelize=require(_0x6018('0x0'));module[_0x6018('0x1')]={'body':{'type':Sequelize['TEXT'](_0x6018('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x6018('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6018('0x4')]('in','out'),'defaultValue':_0x6018('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x6018('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index a263176..cd01217 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 _0x0a27=['ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','status','stack','name','send','index','ChatMessage','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','type','key','VIRTUAL','field','filter','includeAll','rows','catch','show','options','find','create','body','params','describe','chat-interactions','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','reject','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware'];(function(_0x532b5b,_0xce6ec8){var _0x169ff9=function(_0x4d2804){while(--_0x4d2804){_0x532b5b['push'](_0x532b5b['shift']());}};_0x169ff9(++_0xce6ec8);}(_0x0a27,0x160));var _0x70a2=function(_0x3ed3fc,_0x21b644){_0x3ed3fc=_0x3ed3fc-0x0;var _0x26d8bd=_0x0a27[_0x3ed3fc];return _0x26d8bd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x70a2('0x0'));var rimraf=require(_0x70a2('0x1'));var zipdir=require(_0x70a2('0x2'));var jsonpatch=require(_0x70a2('0x3'));var rp=require('request-promise');var moment=require(_0x70a2('0x4'));var BPromise=require(_0x70a2('0x5'));var Mustache=require(_0x70a2('0x6'));var util=require(_0x70a2('0x7'));var path=require('path');var sox=require(_0x70a2('0x8'));var csv=require(_0x70a2('0x9'));var ejs=require(_0x70a2('0xa'));var fs=require('fs');var _=require(_0x70a2('0xb'));var squel=require(_0x70a2('0xc'));var crypto=require(_0x70a2('0xd'));var jsforce=require(_0x70a2('0xe'));var deskjs=require(_0x70a2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x70a2('0x10'));var Papa=require(_0x70a2('0x11'));var authService=require(_0x70a2('0x12'));var hardwareService=require(_0x70a2('0x13'));var Redis=require(_0x70a2('0x14'));var qs=require(_0x70a2('0x15'));var logger=require(_0x70a2('0x16'))(_0x70a2('0x17'));var utils=require(_0x70a2('0x18'));var config=require(_0x70a2('0x19'));var db=require(_0x70a2('0x1a'))['db'];config[_0x70a2('0x1b')]=_[_0x70a2('0x1c')](config[_0x70a2('0x1b')],{'host':_0x70a2('0x1d'),'port':0x18eb});var socket=require(_0x70a2('0x1e'))(new Redis(config[_0x70a2('0x1b')]));require(_0x70a2('0x1f'))[_0x70a2('0x20')](socket);var jayson=require(_0x70a2('0x21'));var client=jayson[_0x70a2('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x70a2('0x22')][_0x70a2('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x44f9ca,_0x168f99,_0x5c7f2c,_0x1a77e3){return new BPromise(function(_0x43c9fd,_0xc1f187){var _0x390641=_0x1a77e3||client;return _0x390641[_0x70a2('0x24')](_0x44f9ca,_0x5c7f2c)['then'](function(_0x2ac156){logger[_0x70a2('0x25')](_0x70a2('0x26'),_0x168f99,_0x70a2('0x27'));logger[_0x70a2('0x28')](_0x70a2('0x29'),_0x168f99,'request\x20sent',JSON[_0x70a2('0x2a')](_0x2ac156));if(_0x2ac156['error']){if(_0x2ac156['error']['code']===0x1f4){logger['error'](_0x70a2('0x26'),_0x168f99,_0x2ac156[_0x70a2('0x2b')][_0x70a2('0x2c')]);return _0xc1f187(_0x2ac156['error'][_0x70a2('0x2c')]);}logger[_0x70a2('0x2b')]('ChatMessage,\x20%s,\x20%s',_0x168f99,_0x2ac156[_0x70a2('0x2b')]['message']);return _0x43c9fd(_0x2ac156[_0x70a2('0x2b')][_0x70a2('0x2c')]);}else{logger[_0x70a2('0x25')](_0x70a2('0x26'),_0x168f99,_0x70a2('0x27'));_0x43c9fd(_0x2ac156['result']['message']);}})['catch'](function(_0x4c7cd5){logger[_0x70a2('0x2b')](_0x70a2('0x26'),_0x168f99,_0x4c7cd5);_0xc1f187(_0x4c7cd5);});});}function respondWithStatusCode(_0x45fa23,_0x398ef5){_0x398ef5=_0x398ef5||0xcc;return function(_0x33a763){if(_0x33a763){return _0x45fa23[_0x70a2('0x2d')](_0x398ef5);}return _0x45fa23['status'](_0x398ef5)[_0x70a2('0x2e')]();};}function respondWithResult(_0x5fd129,_0x40c71a){_0x40c71a=_0x40c71a||0xc8;return function(_0x221649){if(_0x221649){return _0x5fd129['status'](_0x40c71a)[_0x70a2('0x2f')](_0x221649);}};}function respondWithFilteredResult(_0x55e34f,_0x115d06){return function(_0xe36872){if(_0xe36872){var _0x272d93=_0xe36872[_0x70a2('0x30')],_0x246ab7=_0x115d06['offset'],_0x42bffb=_0x115d06[_0x70a2('0x31')]+_0x115d06[_0x70a2('0x32')],_0x463480;if(_0x42bffb>=_0x272d93){_0x42bffb=_0x272d93;_0x463480=0xc8;}else{_0x463480=0xce;}_0x55e34f['status'](_0x463480);return _0x55e34f[_0x70a2('0x33')](_0x70a2('0x34'),_0x246ab7+'-'+_0x42bffb+'/'+_0x272d93)[_0x70a2('0x2f')](_0xe36872);}return null;};}function patchUpdates(_0x468380){return function(_0x1ea1f2){try{jsonpatch['apply'](_0x1ea1f2,_0x468380,!![]);}catch(_0x5e6d7c){return BPromise['reject'](_0x5e6d7c);}return _0x1ea1f2[_0x70a2('0x35')]();};}function saveUpdates(_0x244982,_0x2042f0){return function(_0x38bc2c){if(_0x38bc2c){return _0x38bc2c[_0x70a2('0x36')](_0x244982)[_0x70a2('0x37')](function(_0xc54a82){return _0xc54a82;});}return null;};}function removeEntity(_0x2b61d4,_0x181dfa){return function(_0x52431c){if(_0x52431c){return _0x52431c[_0x70a2('0x38')]()[_0x70a2('0x37')](function(){_0x2b61d4[_0x70a2('0x39')](0xcc)['end']();});}};}function handleEntityNotFound(_0x566b14,_0x1ab9a3){return function(_0x1c6f4f){if(!_0x1c6f4f){_0x566b14['sendStatus'](0x194);}return _0x1c6f4f;};}function handleError(_0x2ecf1b,_0x5016e6){_0x5016e6=_0x5016e6||0x1f4;return function(_0x364c8e){logger[_0x70a2('0x2b')](_0x364c8e[_0x70a2('0x3a')]);if(_0x364c8e[_0x70a2('0x3b')]){delete _0x364c8e[_0x70a2('0x3b')];}_0x2ecf1b[_0x70a2('0x39')](_0x5016e6)[_0x70a2('0x3c')](_0x364c8e);};}exports[_0x70a2('0x3d')]=function(_0x772949,_0x5171d8){var _0x34ce09={},_0x124db0={},_0x2f9824={'count':0x0,'rows':[]};var _0x252912=db[_0x70a2('0x3e')][_0x70a2('0x3f')];_0x124db0[_0x70a2('0x40')]=_[_0x70a2('0x41')](_0x252912);_0x124db0[_0x70a2('0x42')]=_['keys'](_0x772949[_0x70a2('0x42')]);_0x124db0['filters']=_[_0x70a2('0x43')](_0x124db0['model'],_0x124db0[_0x70a2('0x42')]);_0x34ce09['attributes']=_[_0x70a2('0x43')](_0x124db0[_0x70a2('0x40')],qs[_0x70a2('0x44')](_0x772949[_0x70a2('0x42')][_0x70a2('0x44')]));_0x34ce09[_0x70a2('0x45')]=_0x34ce09[_0x70a2('0x45')][_0x70a2('0x46')]?_0x34ce09[_0x70a2('0x45')]:_0x124db0[_0x70a2('0x40')];if(!_0x772949[_0x70a2('0x42')][_0x70a2('0x47')](_0x70a2('0x48'))){_0x34ce09[_0x70a2('0x32')]=qs[_0x70a2('0x32')](_0x772949[_0x70a2('0x42')][_0x70a2('0x32')]);_0x34ce09[_0x70a2('0x31')]=qs['offset'](_0x772949['query'][_0x70a2('0x31')]);}_0x34ce09['order']=qs[_0x70a2('0x49')](_0x772949[_0x70a2('0x42')][_0x70a2('0x49')]);_0x34ce09[_0x70a2('0x4a')]=qs[_0x70a2('0x4b')](_['pick'](_0x772949['query'],_0x124db0[_0x70a2('0x4b')]));if(_0x772949['query']['filter']){_0x34ce09[_0x70a2('0x4a')]=_[_0x70a2('0x4c')](_0x34ce09[_0x70a2('0x4a')],{'$or':_['map'](_0x252912,function(_0x2bf595){if(_0x2bf595[_0x70a2('0x4d')][_0x70a2('0x4e')]!==_0x70a2('0x4f')){var _0x43d7be={};_0x43d7be[_0x2bf595[_0x70a2('0x50')]]={'$like':'%'+_0x772949[_0x70a2('0x42')][_0x70a2('0x51')]+'%'};return _0x43d7be;}})});}_0x34ce09=_['merge']({},_0x34ce09,_0x772949['options']);var _0x1f829a={'where':_0x34ce09['where']};return db['ChatMessage'][_0x70a2('0x30')](_0x1f829a)['then'](function(_0x5bcc44){_0x2f9824['count']=_0x5bcc44;if(_0x772949[_0x70a2('0x42')][_0x70a2('0x52')]){_0x34ce09['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x34ce09);})['then'](function(_0x4bb4a0){_0x2f9824[_0x70a2('0x53')]=_0x4bb4a0;return _0x2f9824;})[_0x70a2('0x37')](respondWithFilteredResult(_0x5171d8,_0x34ce09))[_0x70a2('0x54')](handleError(_0x5171d8,null));};exports[_0x70a2('0x55')]=function(_0x11eabc,_0x1fa253){var _0x25d1dc={'raw':!![],'where':{'id':_0x11eabc['params']['id']}},_0x7d16b8={};_0x7d16b8['model']=_[_0x70a2('0x41')](db[_0x70a2('0x3e')][_0x70a2('0x3f')]);_0x7d16b8[_0x70a2('0x42')]=_[_0x70a2('0x41')](_0x11eabc[_0x70a2('0x42')]);_0x7d16b8[_0x70a2('0x4b')]=_[_0x70a2('0x43')](_0x7d16b8[_0x70a2('0x40')],_0x7d16b8['query']);_0x25d1dc[_0x70a2('0x45')]=_[_0x70a2('0x43')](_0x7d16b8[_0x70a2('0x40')],qs[_0x70a2('0x44')](_0x11eabc[_0x70a2('0x42')][_0x70a2('0x44')]));_0x25d1dc[_0x70a2('0x45')]=_0x25d1dc[_0x70a2('0x45')][_0x70a2('0x46')]?_0x25d1dc['attributes']:_0x7d16b8[_0x70a2('0x40')];if(_0x11eabc[_0x70a2('0x42')][_0x70a2('0x52')]){_0x25d1dc['include']=[{'all':!![]}];}_0x25d1dc=_[_0x70a2('0x4c')]({},_0x25d1dc,_0x11eabc[_0x70a2('0x56')]);return db[_0x70a2('0x3e')][_0x70a2('0x57')](_0x25d1dc)['then'](handleEntityNotFound(_0x1fa253,null))[_0x70a2('0x37')](respondWithResult(_0x1fa253,null))[_0x70a2('0x54')](handleError(_0x1fa253,null));};exports[_0x70a2('0x58')]=function(_0x5840d1,_0x642450){return db[_0x70a2('0x3e')][_0x70a2('0x58')](_0x5840d1[_0x70a2('0x59')],{})[_0x70a2('0x37')](respondWithResult(_0x642450,0xc9))[_0x70a2('0x54')](handleError(_0x642450,null));};exports[_0x70a2('0x36')]=function(_0x1fa270,_0x1c9578){if(_0x1fa270[_0x70a2('0x59')]['id']){delete _0x1fa270[_0x70a2('0x59')]['id'];}return db[_0x70a2('0x3e')]['find']({'where':{'id':_0x1fa270[_0x70a2('0x5a')]['id']}})[_0x70a2('0x37')](handleEntityNotFound(_0x1c9578,null))[_0x70a2('0x37')](saveUpdates(_0x1fa270[_0x70a2('0x59')],null))[_0x70a2('0x37')](respondWithResult(_0x1c9578,null))[_0x70a2('0x54')](handleError(_0x1c9578,null));};exports[_0x70a2('0x38')]=function(_0x42f45e,_0x5829d6){return db[_0x70a2('0x3e')][_0x70a2('0x57')]({'where':{'id':_0x42f45e['params']['id']}})[_0x70a2('0x37')](handleEntityNotFound(_0x5829d6,null))['then'](removeEntity(_0x5829d6,null))[_0x70a2('0x54')](handleError(_0x5829d6,null));};exports[_0x70a2('0x5b')]=function(_0x2558ea,_0x1f6a33){return db[_0x70a2('0x3e')][_0x70a2('0x5b')]()['then'](respondWithResult(_0x1f6a33,null))['catch'](handleError(_0x1f6a33,null));};var interaction_log=require(_0x70a2('0x16'))(_0x70a2('0x5c'));exports['accept']=function(_0x47cd19,_0x1426c4,_0x33e997){var _0x516075={'channel':_0x70a2('0x5d')};if(_0x47cd19[_0x70a2('0x59')]['id']){delete _0x47cd19[_0x70a2('0x59')]['id'];}_0x47cd19['body'][_0x70a2('0x5e')]=!![];_0x47cd19[_0x70a2('0x59')]['readAt']=moment()[_0x70a2('0x5f')](_0x70a2('0x60'));_0x47cd19[_0x70a2('0x59')][_0x70a2('0x61')]=_0x47cd19[_0x70a2('0x59')][_0x70a2('0x61')]||_0x47cd19[_0x70a2('0x62')]['id'];return db[_0x70a2('0x3e')][_0x70a2('0x57')]({'where':{'id':_0x47cd19[_0x70a2('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x70a2('0x63')],'as':_0x70a2('0x64')}]})[_0x70a2('0x37')](handleEntityNotFound(_0x1426c4,null))[_0x70a2('0x37')](saveUpdates(_0x47cd19[_0x70a2('0x59')],null))[_0x70a2('0x37')](function(_0x30b510){if(_0x30b510){_0x516075[_0x70a2('0x2c')]=_0x30b510[_0x70a2('0x65')]({'plain':!![]});return db[_0x70a2('0x66')][_0x70a2('0x57')]({'where':{'id':_0x30b510[_0x70a2('0x67')]}});}return null;})[_0x70a2('0x37')](handleEntityNotFound(_0x1426c4,null))[_0x70a2('0x37')](function(_0x239356){if(_0x239356){return _0x239356[_0x70a2('0x36')]({'UserId':_0x47cd19[_0x70a2('0x59')][_0x70a2('0x61')],'read1stAt':_['isNil'](_0x239356[_0x70a2('0x68')])?moment()[_0x70a2('0x5f')](_0x70a2('0x60')):undefined});}return null;})['then'](function(_0x4f6d4a){if(_0x4f6d4a){_0x516075[_0x70a2('0x69')]=_0x4f6d4a['get']({'plain':!![]});interaction_log[_0x70a2('0x25')](_0x70a2('0x6a'),_0x47cd19['user']['id'],_0x47cd19[_0x70a2('0x62')][_0x70a2('0x3b')],_0x47cd19['user'][_0x70a2('0x6b')],_0x516075[_0x70a2('0x69')]['id'],_0x47cd19['body']?JSON[_0x70a2('0x2a')](_0x47cd19[_0x70a2('0x59')]):_0x70a2('0x6c'));return respondWithRpcPromise(_0x70a2('0x6d'),_0x70a2('0x6e'),_0x516075);}return null;})[_0x70a2('0x37')](function(_0x191d1e){if(_0x191d1e){if(_0x47cd19[_0x70a2('0x59')][_0x70a2('0x6f')]){_0x516075[_0x70a2('0x2c')][_0x70a2('0x70')]=util[_0x70a2('0x5f')](_0x70a2('0x71'),_0x47cd19[_0x70a2('0x62')][_0x70a2('0x3b')]);_0x516075[_0x70a2('0x2c')][_0x70a2('0x72')]=_0x516075['channel'];_0x516075[_0x70a2('0x2c')][_0x70a2('0x73')]=_0x70a2('0x74');return respondWithRpcPromise('EventManager',_0x70a2('0x75'),{'event':_0x70a2('0x76'),'message':_['merge'](_0x516075['message'],JSON['parse'](_0x516075[_0x70a2('0x69')]['formData']))},client9002)['then'](function(){return _0x516075;});}return _0x516075;}return null;})[_0x70a2('0x37')](respondWithResult(_0x1426c4,null))[_0x70a2('0x54')](handleError(_0x1426c4,null));};var interaction_log=require(_0x70a2('0x16'))(_0x70a2('0x5c'));exports['reject']=function(_0x3ec3cc,_0x69319c,_0x4b10eb){var _0x33a551={'agent':{},'channel':_0x70a2('0x5d')};if(_0x3ec3cc[_0x70a2('0x59')]['id']){delete _0x3ec3cc[_0x70a2('0x59')]['id'];}_0x3ec3cc[_0x70a2('0x59')][_0x70a2('0x61')]=_0x3ec3cc['body'][_0x70a2('0x61')]||_0x3ec3cc[_0x70a2('0x62')]['id'];_0x33a551[_0x70a2('0x77')]['id']=_0x3ec3cc[_0x70a2('0x59')]['UserId'];return db[_0x70a2('0x3e')][_0x70a2('0x57')]({'where':{'id':_0x3ec3cc['params']['id'],'UserId':null}})[_0x70a2('0x37')](handleEntityNotFound(_0x69319c,null))[_0x70a2('0x37')](function(_0x39acfd){if(_0x39acfd){_0x33a551[_0x70a2('0x2c')]=_0x39acfd[_0x70a2('0x65')]({'plain':!![]});return db[_0x70a2('0x66')]['find']({'where':{'id':_0x39acfd['ChatInteractionId']}});}return null;})[_0x70a2('0x37')](handleEntityNotFound(_0x69319c,null))[_0x70a2('0x37')](function(_0x441f12){if(_0x441f12){_0x33a551[_0x70a2('0x69')]=_0x441f12['get']({'plain':!![]});interaction_log['info'](_0x70a2('0x78'),_0x3ec3cc[_0x70a2('0x62')]['id'],_0x3ec3cc['user'][_0x70a2('0x3b')],_0x3ec3cc[_0x70a2('0x62')][_0x70a2('0x6b')],_0x33a551[_0x70a2('0x69')]['id'],_0x3ec3cc[_0x70a2('0x59')]?JSON[_0x70a2('0x2a')](_0x3ec3cc[_0x70a2('0x59')]):_0x70a2('0x6c'));return respondWithRpcPromise(_0x70a2('0x79'),_0x70a2('0x7a'),_0x33a551);}return null;})[_0x70a2('0x37')](function(_0x5222c3){if(_0x5222c3){_0x5222c3[_0x70a2('0x2c')][_0x70a2('0x70')]=util[_0x70a2('0x5f')](_0x70a2('0x71'),_0x3ec3cc[_0x70a2('0x62')][_0x70a2('0x3b')]);_0x5222c3[_0x70a2('0x2c')]['channel']=_0x33a551['channel'];_0x5222c3[_0x70a2('0x2c')][_0x70a2('0x73')]=_0x70a2('0x7b');respondWithRpcPromise('EventManager',_0x70a2('0x75'),{'event':'rejectmessage','message':_0x5222c3[_0x70a2('0x2c')]},client9002);return _0x33a551;}return null;})[_0x70a2('0x37')](respondWithResult(_0x69319c,null))[_0x70a2('0x54')](handleError(_0x69319c,null));}; \ No newline at end of file +var _0x3550=['order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','include','rows','show','includeAll','body','update','params','describe','../../config/logger','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','find','CmContact','Contact','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','user','role','acceptMessage','manual','interface','SIP/%s','event','EventManager','acceptmessage','parse','formData','chat-interactions','agent','null','RejectMessage','rejectMessage','channel','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','redis','socket.io-emitter','http','client','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','ChatMessage','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x3550,0x11b));var _0x0355=function(_0xc94265,_0x6978cc){_0xc94265=_0xc94265-0x0;var _0x2d2a25=_0x3550[_0xc94265];return _0x2d2a25;};'use strict';var pdf=require(_0x0355('0x0'));var emlformat=require(_0x0355('0x1'));var rimraf=require(_0x0355('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0355('0x3'));var rp=require(_0x0355('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0355('0x5'));var util=require(_0x0355('0x6'));var path=require(_0x0355('0x7'));var sox=require(_0x0355('0x8'));var csv=require(_0x0355('0x9'));var ejs=require(_0x0355('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0355('0xb'));var crypto=require(_0x0355('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0355('0xd'));var toCsv=require(_0x0355('0x9'));var querystring=require(_0x0355('0xe'));var Papa=require(_0x0355('0xf'));var authService=require(_0x0355('0x10'));var hardwareService=require(_0x0355('0x11'));var Redis=require(_0x0355('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x0355('0x13'));var utils=require(_0x0355('0x14'));var config=require(_0x0355('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0355('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0355('0x17'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x0355('0x18')]({'port':0x232c});var client9002=jayson[_0x0355('0x19')][_0x0355('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1ec3de,_0x56e60c,_0x155725,_0x513ed8){return new BPromise(function(_0x1ff1f2,_0x5aa066){var _0x8c6924=_0x513ed8||client;return _0x8c6924[_0x0355('0x1a')](_0x1ec3de,_0x155725)['then'](function(_0x5e1e66){logger[_0x0355('0x1b')](_0x0355('0x1c'),_0x56e60c,_0x0355('0x1d'));logger[_0x0355('0x1e')](_0x0355('0x1f'),_0x56e60c,_0x0355('0x1d'),JSON[_0x0355('0x20')](_0x5e1e66));if(_0x5e1e66['error']){if(_0x5e1e66[_0x0355('0x21')]['code']===0x1f4){logger[_0x0355('0x21')](_0x0355('0x1c'),_0x56e60c,_0x5e1e66[_0x0355('0x21')][_0x0355('0x22')]);return _0x5aa066(_0x5e1e66[_0x0355('0x21')][_0x0355('0x22')]);}logger[_0x0355('0x21')](_0x0355('0x1c'),_0x56e60c,_0x5e1e66[_0x0355('0x21')][_0x0355('0x22')]);return _0x1ff1f2(_0x5e1e66['error'][_0x0355('0x22')]);}else{logger[_0x0355('0x1b')](_0x0355('0x1c'),_0x56e60c,_0x0355('0x1d'));_0x1ff1f2(_0x5e1e66[_0x0355('0x23')]['message']);}})[_0x0355('0x24')](function(_0x158666){logger[_0x0355('0x21')](_0x0355('0x1c'),_0x56e60c,_0x158666);_0x5aa066(_0x158666);});});}function respondWithStatusCode(_0x53df95,_0x21e5a4){_0x21e5a4=_0x21e5a4||0xcc;return function(_0x1af650){if(_0x1af650){return _0x53df95['sendStatus'](_0x21e5a4);}return _0x53df95[_0x0355('0x25')](_0x21e5a4)[_0x0355('0x26')]();};}function respondWithResult(_0x62387d,_0x50acc0){_0x50acc0=_0x50acc0||0xc8;return function(_0x57d2a5){if(_0x57d2a5){return _0x62387d['status'](_0x50acc0)[_0x0355('0x27')](_0x57d2a5);}};}function respondWithFilteredResult(_0xd022d,_0x53b742){return function(_0x4fa9da){if(_0x4fa9da){var _0x275e10=_0x4fa9da[_0x0355('0x28')],_0xf8a0af=_0x53b742[_0x0355('0x29')],_0x1be6c4=_0x53b742['offset']+_0x53b742[_0x0355('0x2a')],_0x201fb0;if(_0x1be6c4>=_0x275e10){_0x1be6c4=_0x275e10;_0x201fb0=0xc8;}else{_0x201fb0=0xce;}_0xd022d[_0x0355('0x25')](_0x201fb0);return _0xd022d[_0x0355('0x2b')](_0x0355('0x2c'),_0xf8a0af+'-'+_0x1be6c4+'/'+_0x275e10)[_0x0355('0x27')](_0x4fa9da);}return null;};}function patchUpdates(_0x9c95b3){return function(_0x1d2a7d){try{jsonpatch[_0x0355('0x2d')](_0x1d2a7d,_0x9c95b3,!![]);}catch(_0xed2d36){return BPromise[_0x0355('0x2e')](_0xed2d36);}return _0x1d2a7d[_0x0355('0x2f')]();};}function saveUpdates(_0x5690eb,_0x5a0523){return function(_0x1ead5e){if(_0x1ead5e){return _0x1ead5e['update'](_0x5690eb)[_0x0355('0x30')](function(_0x376564){return _0x376564;});}return null;};}function removeEntity(_0x50769e,_0x53fe58){return function(_0x1c78be){if(_0x1c78be){return _0x1c78be[_0x0355('0x31')]()[_0x0355('0x30')](function(){_0x50769e[_0x0355('0x25')](0xcc)[_0x0355('0x26')]();});}};}function handleEntityNotFound(_0x59d701,_0xbf10a8){return function(_0xe8511f){if(!_0xe8511f){_0x59d701['sendStatus'](0x194);}return _0xe8511f;};}function handleError(_0x2b378d,_0x47d38a){_0x47d38a=_0x47d38a||0x1f4;return function(_0x44b3f2){logger[_0x0355('0x21')](_0x44b3f2[_0x0355('0x32')]);if(_0x44b3f2['name']){delete _0x44b3f2[_0x0355('0x33')];}_0x2b378d[_0x0355('0x25')](_0x47d38a)['send'](_0x44b3f2);};}exports['index']=function(_0x17a0d2,_0x221426){var _0x288134={},_0x1ad0ed={},_0x5c8880={'count':0x0,'rows':[]};var _0xa74c89=db[_0x0355('0x34')]['rawAttributes'];_0x1ad0ed[_0x0355('0x35')]=_['keys'](_0xa74c89);_0x1ad0ed[_0x0355('0x36')]=_[_0x0355('0x37')](_0x17a0d2['query']);_0x1ad0ed[_0x0355('0x38')]=_[_0x0355('0x39')](_0x1ad0ed[_0x0355('0x35')],_0x1ad0ed[_0x0355('0x36')]);_0x288134[_0x0355('0x3a')]=_[_0x0355('0x39')](_0x1ad0ed[_0x0355('0x35')],qs[_0x0355('0x3b')](_0x17a0d2[_0x0355('0x36')][_0x0355('0x3b')]));_0x288134[_0x0355('0x3a')]=_0x288134[_0x0355('0x3a')][_0x0355('0x3c')]?_0x288134[_0x0355('0x3a')]:_0x1ad0ed['model'];if(!_0x17a0d2['query'][_0x0355('0x3d')]('nolimit')){_0x288134[_0x0355('0x2a')]=qs[_0x0355('0x2a')](_0x17a0d2['query'][_0x0355('0x2a')]);_0x288134['offset']=qs['offset'](_0x17a0d2[_0x0355('0x36')]['offset']);}_0x288134[_0x0355('0x3e')]=qs['sort'](_0x17a0d2[_0x0355('0x36')][_0x0355('0x3f')]);_0x288134[_0x0355('0x40')]=qs[_0x0355('0x38')](_[_0x0355('0x41')](_0x17a0d2[_0x0355('0x36')],_0x1ad0ed[_0x0355('0x38')]));if(_0x17a0d2[_0x0355('0x36')][_0x0355('0x42')]){_0x288134[_0x0355('0x40')]=_[_0x0355('0x43')](_0x288134['where'],{'$or':_[_0x0355('0x44')](_0xa74c89,function(_0x82d39e){if(_0x82d39e[_0x0355('0x45')][_0x0355('0x46')]!==_0x0355('0x47')){var _0x33ff8f={};_0x33ff8f[_0x82d39e[_0x0355('0x48')]]={'$like':'%'+_0x17a0d2[_0x0355('0x36')]['filter']+'%'};return _0x33ff8f;}})});}_0x288134=_['merge']({},_0x288134,_0x17a0d2[_0x0355('0x49')]);var _0x1d8f89={'where':_0x288134['where']};return db[_0x0355('0x34')][_0x0355('0x28')](_0x1d8f89)[_0x0355('0x30')](function(_0x51e20b){_0x5c8880[_0x0355('0x28')]=_0x51e20b;if(_0x17a0d2[_0x0355('0x36')]['includeAll']){_0x288134[_0x0355('0x4a')]=[{'all':!![]}];}return db[_0x0355('0x34')]['findAll'](_0x288134);})[_0x0355('0x30')](function(_0x7b6724){_0x5c8880[_0x0355('0x4b')]=_0x7b6724;return _0x5c8880;})[_0x0355('0x30')](respondWithFilteredResult(_0x221426,_0x288134))[_0x0355('0x24')](handleError(_0x221426,null));};exports[_0x0355('0x4c')]=function(_0x395410,_0x1c7a36){var _0x2f957a={'raw':!![],'where':{'id':_0x395410['params']['id']}},_0x2b7137={};_0x2b7137[_0x0355('0x35')]=_[_0x0355('0x37')](db[_0x0355('0x34')]['rawAttributes']);_0x2b7137[_0x0355('0x36')]=_[_0x0355('0x37')](_0x395410[_0x0355('0x36')]);_0x2b7137['filters']=_['intersection'](_0x2b7137[_0x0355('0x35')],_0x2b7137[_0x0355('0x36')]);_0x2f957a[_0x0355('0x3a')]=_[_0x0355('0x39')](_0x2b7137[_0x0355('0x35')],qs[_0x0355('0x3b')](_0x395410[_0x0355('0x36')][_0x0355('0x3b')]));_0x2f957a[_0x0355('0x3a')]=_0x2f957a[_0x0355('0x3a')][_0x0355('0x3c')]?_0x2f957a[_0x0355('0x3a')]:_0x2b7137[_0x0355('0x35')];if(_0x395410[_0x0355('0x36')][_0x0355('0x4d')]){_0x2f957a[_0x0355('0x4a')]=[{'all':!![]}];}_0x2f957a=_['merge']({},_0x2f957a,_0x395410[_0x0355('0x49')]);return db[_0x0355('0x34')]['find'](_0x2f957a)['then'](handleEntityNotFound(_0x1c7a36,null))[_0x0355('0x30')](respondWithResult(_0x1c7a36,null))[_0x0355('0x24')](handleError(_0x1c7a36,null));};exports['create']=function(_0x48d0a2,_0x2171f8){return db[_0x0355('0x34')]['create'](_0x48d0a2[_0x0355('0x4e')],{})[_0x0355('0x30')](respondWithResult(_0x2171f8,0xc9))[_0x0355('0x24')](handleError(_0x2171f8,null));};exports[_0x0355('0x4f')]=function(_0x514214,_0x1cb462){if(_0x514214[_0x0355('0x4e')]['id']){delete _0x514214[_0x0355('0x4e')]['id'];}return db[_0x0355('0x34')]['find']({'where':{'id':_0x514214[_0x0355('0x50')]['id']}})[_0x0355('0x30')](handleEntityNotFound(_0x1cb462,null))[_0x0355('0x30')](saveUpdates(_0x514214[_0x0355('0x4e')],null))[_0x0355('0x30')](respondWithResult(_0x1cb462,null))[_0x0355('0x24')](handleError(_0x1cb462,null));};exports[_0x0355('0x31')]=function(_0x4024da,_0xebeaf){return db[_0x0355('0x34')]['find']({'where':{'id':_0x4024da[_0x0355('0x50')]['id']}})[_0x0355('0x30')](handleEntityNotFound(_0xebeaf,null))[_0x0355('0x30')](removeEntity(_0xebeaf,null))[_0x0355('0x24')](handleError(_0xebeaf,null));};exports[_0x0355('0x51')]=function(_0x3cbd34,_0x968b40){return db[_0x0355('0x34')]['describe']()['then'](respondWithResult(_0x968b40,null))[_0x0355('0x24')](handleError(_0x968b40,null));};var interaction_log=require(_0x0355('0x52'))('chat-interactions');exports[_0x0355('0x53')]=function(_0x18de70,_0x1987ec,_0x248dab){var _0x15dea3={'channel':_0x0355('0x54')};if(_0x18de70[_0x0355('0x4e')]['id']){delete _0x18de70[_0x0355('0x4e')]['id'];}_0x18de70['body'][_0x0355('0x55')]=!![];_0x18de70[_0x0355('0x4e')]['readAt']=moment()[_0x0355('0x56')](_0x0355('0x57'));_0x18de70['body'][_0x0355('0x58')]=_0x18de70[_0x0355('0x4e')][_0x0355('0x58')]||_0x18de70['user']['id'];return db[_0x0355('0x34')][_0x0355('0x59')]({'where':{'id':_0x18de70['params']['id'],'UserId':null},'include':[{'model':db[_0x0355('0x5a')],'as':_0x0355('0x5b')}]})[_0x0355('0x30')](handleEntityNotFound(_0x1987ec,null))[_0x0355('0x30')](saveUpdates(_0x18de70[_0x0355('0x4e')],null))['then'](function(_0x837502){if(_0x837502){_0x15dea3['message']=_0x837502[_0x0355('0x5c')]({'plain':!![]});return db[_0x0355('0x5d')][_0x0355('0x59')]({'where':{'id':_0x837502[_0x0355('0x5e')]}});}return null;})[_0x0355('0x30')](handleEntityNotFound(_0x1987ec,null))[_0x0355('0x30')](function(_0x2e5289){if(_0x2e5289){return _0x2e5289[_0x0355('0x4f')]({'UserId':_0x18de70[_0x0355('0x4e')]['UserId'],'read1stAt':_['isNil'](_0x2e5289[_0x0355('0x5f')])?moment()[_0x0355('0x56')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0355('0x30')](function(_0x5b6909){if(_0x5b6909){_0x15dea3[_0x0355('0x60')]=_0x5b6909['get']({'plain':!![]});interaction_log[_0x0355('0x1b')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x18de70[_0x0355('0x61')]['id'],_0x18de70['user'][_0x0355('0x33')],_0x18de70[_0x0355('0x61')][_0x0355('0x62')],_0x15dea3[_0x0355('0x60')]['id'],_0x18de70[_0x0355('0x4e')]?JSON[_0x0355('0x20')](_0x18de70[_0x0355('0x4e')]):'null');return respondWithRpcPromise('AcceptMessage',_0x0355('0x63'),_0x15dea3);}return null;})[_0x0355('0x30')](function(_0x131165){if(_0x131165){if(_0x18de70[_0x0355('0x4e')][_0x0355('0x64')]){_0x15dea3[_0x0355('0x22')][_0x0355('0x65')]=util['format'](_0x0355('0x66'),_0x18de70[_0x0355('0x61')][_0x0355('0x33')]);_0x15dea3[_0x0355('0x22')]['channel']=_0x15dea3['channel'];_0x15dea3[_0x0355('0x22')][_0x0355('0x67')]=_0x0355('0x53');return respondWithRpcPromise('EventManager',_0x0355('0x68'),{'event':_0x0355('0x69'),'message':_[_0x0355('0x43')](_0x15dea3['message'],JSON[_0x0355('0x6a')](_0x15dea3[_0x0355('0x60')][_0x0355('0x6b')]))},client9002)[_0x0355('0x30')](function(){return _0x15dea3;});}return _0x15dea3;}return null;})[_0x0355('0x30')](respondWithResult(_0x1987ec,null))[_0x0355('0x24')](handleError(_0x1987ec,null));};var interaction_log=require(_0x0355('0x52'))(_0x0355('0x6c'));exports[_0x0355('0x2e')]=function(_0x406604,_0x1f38c9,_0xd9a6e5){var _0x3dd60e={'agent':{},'channel':_0x0355('0x54')};if(_0x406604['body']['id']){delete _0x406604[_0x0355('0x4e')]['id'];}_0x406604[_0x0355('0x4e')][_0x0355('0x58')]=_0x406604[_0x0355('0x4e')][_0x0355('0x58')]||_0x406604['user']['id'];_0x3dd60e[_0x0355('0x6d')]['id']=_0x406604['body']['UserId'];return db[_0x0355('0x34')][_0x0355('0x59')]({'where':{'id':_0x406604['params']['id'],'UserId':null}})[_0x0355('0x30')](handleEntityNotFound(_0x1f38c9,null))[_0x0355('0x30')](function(_0x330e24){if(_0x330e24){_0x3dd60e[_0x0355('0x22')]=_0x330e24['get']({'plain':!![]});return db[_0x0355('0x5d')][_0x0355('0x59')]({'where':{'id':_0x330e24[_0x0355('0x5e')]}});}return null;})[_0x0355('0x30')](handleEntityNotFound(_0x1f38c9,null))[_0x0355('0x30')](function(_0x209fa6){if(_0x209fa6){_0x3dd60e[_0x0355('0x60')]=_0x209fa6[_0x0355('0x5c')]({'plain':!![]});interaction_log[_0x0355('0x1b')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x406604[_0x0355('0x61')]['id'],_0x406604[_0x0355('0x61')][_0x0355('0x33')],_0x406604['user'][_0x0355('0x62')],_0x3dd60e[_0x0355('0x60')]['id'],_0x406604[_0x0355('0x4e')]?JSON[_0x0355('0x20')](_0x406604['body']):_0x0355('0x6e'));return respondWithRpcPromise(_0x0355('0x6f'),_0x0355('0x70'),_0x3dd60e);}return null;})[_0x0355('0x30')](function(_0x21f9a7){if(_0x21f9a7){_0x21f9a7[_0x0355('0x22')][_0x0355('0x65')]=util[_0x0355('0x56')](_0x0355('0x66'),_0x406604[_0x0355('0x61')][_0x0355('0x33')]);_0x21f9a7[_0x0355('0x22')][_0x0355('0x71')]=_0x3dd60e['channel'];_0x21f9a7[_0x0355('0x22')][_0x0355('0x67')]='reject';respondWithRpcPromise(_0x0355('0x68'),_0x0355('0x68'),{'event':_0x0355('0x72'),'message':_0x21f9a7[_0x0355('0x22')]},client9002);return _0x3dd60e;}return null;})[_0x0355('0x30')](respondWithResult(_0x1f38c9,null))[_0x0355('0x24')](handleError(_0x1f38c9,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 6464987..277ae3f 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 _0x3039=['emit','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','remove'];(function(_0x51b82d,_0x5b8d67){var _0x5e7993=function(_0x2f9360){while(--_0x2f9360){_0x51b82d['push'](_0x51b82d['shift']());}};_0x5e7993(++_0x5b8d67);}(_0x3039,0x18b));var _0x9303=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3039[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x9303('0x0'))['db'][_0x9303('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9303('0x2')](0x0);var events={'afterCreate':_0x9303('0x3'),'afterUpdate':'update','afterDestroy':_0x9303('0x4')};function emitEvent(_0x49f46f){return function(_0x189981,_0x442524,_0x268661){ChatMessageEvents['emit'](_0x49f46f+':'+_0x189981['id'],_0x189981);ChatMessageEvents[_0x9303('0x5')](_0x49f46f,_0x189981);_0x268661(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x9303('0x6')](e,emitEvent(event));}}module[_0x9303('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x3189=['hasOwnProperty','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit'];(function(_0x28b2c4,_0x3f1312){var _0x48e31b=function(_0x19faf9){while(--_0x19faf9){_0x28b2c4['push'](_0x28b2c4['shift']());}};_0x48e31b(++_0x3f1312);}(_0x3189,0x134));var _0x9318=function(_0x23d849,_0x43c31d){_0x23d849=_0x23d849-0x0;var _0x56acc2=_0x3189[_0x23d849];return _0x56acc2;};'use strict';var EventEmitter=require(_0x9318('0x0'));var ChatMessage=require(_0x9318('0x1'))['db'][_0x9318('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9318('0x3')](0x0);var events={'afterCreate':_0x9318('0x4'),'afterUpdate':_0x9318('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2798e7){return function(_0x54a583,_0x4c74e4,_0x311d15){ChatMessageEvents['emit'](_0x2798e7+':'+_0x54a583['id'],_0x54a583);ChatMessageEvents[_0x9318('0x6')](_0x2798e7,_0x54a583);_0x311d15(null);};}for(var e in events){if(events[_0x9318('0x7')](e)){var event=events[e];ChatMessage[_0x9318('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 406413b..7edec93 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 _0xab40=['exports','ChatMessage','direction','toLowerCase','out','secret','isNil','UserId','ChatInteractionId','update','createdAt','body','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','./chatMessage.attributes'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0xab40,0xcd));var _0x0ab4=function(_0x1a875c,_0xbcf418){_0x1a875c=_0x1a875c-0x0;var _0x54cd56=_0xab40[_0x1a875c];return _0x54cd56;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0ab4('0x2'));var rp=require(_0x0ab4('0x3'));var attributes=require(_0x0ab4('0x4'));module[_0x0ab4('0x5')]=function(_0x14634a,_0x57fac1){return _0x14634a['define'](_0x0ab4('0x6'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x10d92b,_0x46d16a,_0x11e99f){var _0x6d135d=_0x14634a['models'];var _0x55263d=_0x10d92b['get']({'plain':!![]});if(_0x55263d[_0x0ab4('0x7')][_0x0ab4('0x8')]()==='in'||_0x55263d[_0x0ab4('0x7')][_0x0ab4('0x8')]()===_0x0ab4('0x9')&&!_0x55263d[_0x0ab4('0xa')]&&!_[_0x0ab4('0xb')](_0x55263d[_0x0ab4('0xc')])){_0x6d135d['ChatInteraction']['findOne']({'where':{'id':_0x55263d[_0x0ab4('0xd')]}})['then'](function(_0x249dc3){if(_0x249dc3){_0x249dc3[_0x0ab4('0xe')]({'lastMsgAt':_0x55263d[_0x0ab4('0xf')],'lastMsgDirection':_0x55263d[_0x0ab4('0x7')][_0x0ab4('0x8')](),'lastMsgBody':_0x55263d[_0x0ab4('0x10')]});}})[_0x0ab4('0x11')](function(_0x2cc644){console[_0x0ab4('0x12')](_0x2cc644);});}_0x11e99f();}},'charset':_0x0ab4('0x13'),'collate':_0x0ab4('0x14')});}; \ No newline at end of file +var _0xd5f1=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','./chatMessage.attributes','ChatMessage','models','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','body','catch','error','utf8mb4'];(function(_0x25c9ce,_0x10152a){var _0xcc7ac0=function(_0x363263){while(--_0x363263){_0x25c9ce['push'](_0x25c9ce['shift']());}};_0xcc7ac0(++_0x10152a);}(_0xd5f1,0x1b1));var _0x1d5f=function(_0x5c431c,_0x3f1b8c){_0x5c431c=_0x5c431c-0x0;var _0x3ce6fb=_0xd5f1[_0x5c431c];return _0x3ce6fb;};'use strict';var _=require(_0x1d5f('0x0'));var util=require(_0x1d5f('0x1'));var logger=require(_0x1d5f('0x2'))(_0x1d5f('0x3'));var moment=require('moment');var BPromise=require(_0x1d5f('0x4'));var rp=require(_0x1d5f('0x5'));var attributes=require(_0x1d5f('0x6'));module['exports']=function(_0x4b6c76,_0x4c5bae){return _0x4b6c76['define'](_0x1d5f('0x7'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x56521a,_0x2c6236,_0x3314bc){var _0x2ee4eb=_0x4b6c76[_0x1d5f('0x8')];var _0x4bc7e0=_0x56521a['get']({'plain':!![]});if(_0x4bc7e0[_0x1d5f('0x9')][_0x1d5f('0xa')]()==='in'||_0x4bc7e0[_0x1d5f('0x9')][_0x1d5f('0xa')]()===_0x1d5f('0xb')&&!_0x4bc7e0[_0x1d5f('0xc')]&&!_['isNil'](_0x4bc7e0[_0x1d5f('0xd')])){_0x2ee4eb[_0x1d5f('0xe')][_0x1d5f('0xf')]({'where':{'id':_0x4bc7e0[_0x1d5f('0x10')]}})[_0x1d5f('0x11')](function(_0x22592d){if(_0x22592d){_0x22592d['update']({'lastMsgAt':_0x4bc7e0[_0x1d5f('0x12')],'lastMsgDirection':_0x4bc7e0['direction'][_0x1d5f('0xa')](),'lastMsgBody':_0x4bc7e0[_0x1d5f('0x13')]});}})[_0x1d5f('0x14')](function(_0xabdf1e){console[_0x1d5f('0x15')](_0xabdf1e);});}_0x3314bc();}},'charset':_0x1d5f('0x16'),'collate':_0x1d5f('0x17')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index bdb39c7..b82baf4 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 _0xae52=['request','info','request\x20sent','debug','error','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','create','body','options','raw','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register'];(function(_0x49cfdf,_0xfc5087){var _0x144219=function(_0x100c99){while(--_0x100c99){_0x49cfdf['push'](_0x49cfdf['shift']());}};_0x144219(++_0xfc5087);}(_0xae52,0x127));var _0x2ae5=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xae52[_0x2cfb58];return _0xd99951;};'use strict';var _=require('lodash');var util=require(_0x2ae5('0x0'));var moment=require(_0x2ae5('0x1'));var BPromise=require(_0x2ae5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ae5('0x3'));var db=require(_0x2ae5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2ae5('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2ae5('0x6')]({'port':0x232a});config[_0x2ae5('0x7')]=_[_0x2ae5('0x8')](config['redis'],{'host':_0x2ae5('0x9'),'port':0x18eb});var socket=require(_0x2ae5('0xa'))(new Redis(config[_0x2ae5('0x7')]));require(_0x2ae5('0xb'))[_0x2ae5('0xc')](socket);function respondWithRpcPromise(_0x4ad297,_0x22f7f3,_0x35d134){return new BPromise(function(_0xc58324,_0x33dcde){return client[_0x2ae5('0xd')](_0x4ad297,_0x35d134)['then'](function(_0x33d6c3){logger[_0x2ae5('0xe')]('ChatMessage,\x20%s,\x20%s',_0x22f7f3,_0x2ae5('0xf'));logger[_0x2ae5('0x10')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x22f7f3,_0x2ae5('0xf'),JSON['stringify'](_0x33d6c3));if(_0x33d6c3[_0x2ae5('0x11')]){if(_0x33d6c3[_0x2ae5('0x11')]['code']===0x1f4){logger[_0x2ae5('0x11')](_0x2ae5('0x12'),_0x22f7f3,_0x33d6c3[_0x2ae5('0x11')]['message']);return _0x33dcde(_0x33d6c3[_0x2ae5('0x11')][_0x2ae5('0x13')]);}logger[_0x2ae5('0x11')]('ChatMessage,\x20%s,\x20%s',_0x22f7f3,_0x33d6c3[_0x2ae5('0x11')][_0x2ae5('0x13')]);return _0xc58324(_0x33d6c3[_0x2ae5('0x11')]['message']);}else{logger[_0x2ae5('0xe')](_0x2ae5('0x12'),_0x22f7f3,_0x2ae5('0xf'));_0xc58324(_0x33d6c3[_0x2ae5('0x14')][_0x2ae5('0x13')]);}})[_0x2ae5('0x15')](function(_0x371ef5){logger['error'](_0x2ae5('0x12'),_0x22f7f3,_0x371ef5);_0x33dcde(_0x371ef5);});});}exports[_0x2ae5('0x16')]=function(_0x199664){var _0x5ee623=this;return new Promise(function(_0x2ced37,_0xc35223){return db['ChatMessage'][_0x2ae5('0x17')](_0x199664[_0x2ae5('0x18')],{'raw':_0x199664[_0x2ae5('0x19')]?_0x199664[_0x2ae5('0x19')][_0x2ae5('0x1a')]===undefined?!![]:![]:!![]})[_0x2ae5('0x1b')](function(_0x388ffe){logger[_0x2ae5('0xe')](_0x2ae5('0x16'),_0x199664);logger['debug'](_0x2ae5('0x16'),_0x199664,JSON['stringify'](_0x388ffe));_0x2ced37(_0x388ffe);})['catch'](function(_0x4e59a5){logger['error'](_0x2ae5('0x16'),_0x4e59a5[_0x2ae5('0x13')],_0x199664);_0xc35223(_0x5ee623['error'](0x1f4,_0x4e59a5[_0x2ae5('0x13')]));});});}; \ No newline at end of file +var _0xd99e=['../../config/logger','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateChatMessage','ChatMessage','create','body','options','raw','then','debug','util','moment','bluebird','randomstring','ioredis'];(function(_0x359940,_0x361167){var _0x57e618=function(_0x38780c){while(--_0x38780c){_0x359940['push'](_0x359940['shift']());}};_0x57e618(++_0x361167);}(_0xd99e,0xeb));var _0xed99=function(_0xa98302,_0x844f27){_0xa98302=_0xa98302-0x0;var _0x1ad8e3=_0xd99e[_0xa98302];return _0x1ad8e3;};'use strict';var _=require('lodash');var util=require(_0xed99('0x0'));var moment=require(_0xed99('0x1'));var BPromise=require(_0xed99('0x2'));var rs=require(_0xed99('0x3'));var fs=require('fs');var Redis=require(_0xed99('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed99('0x5'))('rpc');var config=require(_0xed99('0x6'));var jayson=require(_0xed99('0x7'));var client=jayson['client'][_0xed99('0x8')]({'port':0x232a});config[_0xed99('0x9')]=_['defaults'](config[_0xed99('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xed99('0xa'))(new Redis(config['redis']));require(_0xed99('0xb'))[_0xed99('0xc')](socket);function respondWithRpcPromise(_0x2a2428,_0x2dea8f,_0x300fbf){return new BPromise(function(_0x21d880,_0x3a14c2){return client[_0xed99('0xd')](_0x2a2428,_0x300fbf)['then'](function(_0x4a2277){logger[_0xed99('0xe')](_0xed99('0xf'),_0x2dea8f,_0xed99('0x10'));logger['debug'](_0xed99('0x11'),_0x2dea8f,_0xed99('0x10'),JSON[_0xed99('0x12')](_0x4a2277));if(_0x4a2277[_0xed99('0x13')]){if(_0x4a2277['error']['code']===0x1f4){logger[_0xed99('0x13')](_0xed99('0xf'),_0x2dea8f,_0x4a2277[_0xed99('0x13')][_0xed99('0x14')]);return _0x3a14c2(_0x4a2277['error']['message']);}logger[_0xed99('0x13')](_0xed99('0xf'),_0x2dea8f,_0x4a2277['error']['message']);return _0x21d880(_0x4a2277[_0xed99('0x13')][_0xed99('0x14')]);}else{logger[_0xed99('0xe')]('ChatMessage,\x20%s,\x20%s',_0x2dea8f,_0xed99('0x10'));_0x21d880(_0x4a2277[_0xed99('0x15')]['message']);}})['catch'](function(_0xacd6e5){logger[_0xed99('0x13')]('ChatMessage,\x20%s,\x20%s',_0x2dea8f,_0xacd6e5);_0x3a14c2(_0xacd6e5);});});}exports[_0xed99('0x16')]=function(_0x3fafb9){var _0x4ff1ad=this;return new Promise(function(_0x1821ac,_0x3ff761){return db[_0xed99('0x17')][_0xed99('0x18')](_0x3fafb9[_0xed99('0x19')],{'raw':_0x3fafb9['options']?_0x3fafb9[_0xed99('0x1a')][_0xed99('0x1b')]===undefined?!![]:![]:!![]})[_0xed99('0x1c')](function(_0xe2692e){logger[_0xed99('0xe')](_0xed99('0x16'),_0x3fafb9);logger[_0xed99('0x1d')]('CreateChatMessage',_0x3fafb9,JSON['stringify'](_0xe2692e));_0x1821ac(_0xe2692e);})['catch'](function(_0x133713){logger[_0xed99('0x13')](_0xed99('0x16'),_0x133713[_0xed99('0x14')],_0x3fafb9);_0x3ff761(_0x4ff1ad[_0xed99('0x13')](0x1f4,_0x133713[_0xed99('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7e06fcd..f807093 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 _0x70e0=['chatMessage:','./chatMessage.events','save','remove','emit','removeListener'];(function(_0x2bd0b0,_0x22e4d8){var _0x55207c=function(_0x3ac019){while(--_0x3ac019){_0x2bd0b0['push'](_0x2bd0b0['shift']());}};_0x55207c(++_0x22e4d8);}(_0x70e0,0x17b));var _0x070e=function(_0x216d0c,_0x4a63a4){_0x216d0c=_0x216d0c-0x0;var _0x13fcbe=_0x70e0[_0x216d0c];return _0x13fcbe;};'use strict';var ChatMessageEvents=require(_0x070e('0x0'));var events=[_0x070e('0x1'),_0x070e('0x2'),'update'];function createListener(_0x579b83,_0x16e651){return function(_0xee173){_0x16e651[_0x070e('0x3')](_0x579b83,_0xee173);};}function removeListener(_0x2593e5,_0x5c90fc){return function(){ChatMessageEvents[_0x070e('0x4')](_0x2593e5,_0x5c90fc);};}exports['register']=function(_0x46fe68){for(var _0x4b041d=0x0,_0x56e420=events['length'];_0x4b041d<_0x56e420;_0x4b041d++){var _0x35ab0c=events[_0x4b041d];var _0x1e11f0=createListener(_0x070e('0x5')+_0x35ab0c,_0x46fe68);ChatMessageEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file +var _0x3e74=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','remove','update'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x3e74,0x175));var _0x43e7=function(_0xde3641,_0x4de4b2){_0xde3641=_0xde3641-0x0;var _0x1712b6=_0x3e74[_0xde3641];return _0x1712b6;};'use strict';var ChatMessageEvents=require(_0x43e7('0x0'));var events=['save',_0x43e7('0x1'),_0x43e7('0x2')];function createListener(_0x151ad2,_0x494e45){return function(_0x490ced){_0x494e45[_0x43e7('0x3')](_0x151ad2,_0x490ced);};}function removeListener(_0x4f9bbe,_0x128b0f){return function(){ChatMessageEvents[_0x43e7('0x4')](_0x4f9bbe,_0x128b0f);};}exports[_0x43e7('0x5')]=function(_0x1c503b){for(var _0xc98b9c=0x0,_0x503698=events[_0x43e7('0x6')];_0xc98b9c<_0x503698;_0xc98b9c++){var _0x3491d6=events[_0xc98b9c];var _0x2ede2d=createListener(_0x43e7('0x7')+_0x3491d6,_0x1c503b);ChatMessageEvents['on'](_0x3491d6,_0x2ede2d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 04c0ad9..e95b346 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 _0xc671=['../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','chatmessage:create','create','put','/:id/accept','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0xc671,0xd7));var _0x1c67=function(_0x32ca04,_0x2339ac){_0x32ca04=_0x32ca04-0x0;var _0x2e4800=_0xc671[_0x32ca04];return _0x2e4800;};'use strict';var multer=require(_0x1c67('0x0'));var util=require(_0x1c67('0x1'));var path=require('path');var timeout=require(_0x1c67('0x2'));var express=require(_0x1c67('0x3'));var router=express['Router']();var auth=require(_0x1c67('0x4'));var interaction=require(_0x1c67('0x5'));var config=require(_0x1c67('0x6'));var controller=require(_0x1c67('0x7'));router[_0x1c67('0x8')]('/',auth[_0x1c67('0x9')](),controller[_0x1c67('0xa')]);router[_0x1c67('0x8')](_0x1c67('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x1c67('0xc'),auth[_0x1c67('0x9')](),controller[_0x1c67('0xd')]);router[_0x1c67('0xe')]('/',auth[_0x1c67('0x9')](),interaction[_0x1c67('0xf')]('chat',_0x1c67('0x10')),controller[_0x1c67('0x11')]);router[_0x1c67('0x12')]('/:id',controller['update']);router[_0x1c67('0x12')](_0x1c67('0x13'),auth[_0x1c67('0x9')](),controller['accept']);router[_0x1c67('0x12')]('/:id/reject',auth[_0x1c67('0x9')](),controller['reject']);router[_0x1c67('0x14')](_0x1c67('0xc'),auth[_0x1c67('0x9')](),controller[_0x1c67('0x15')]);module['exports']=router; \ No newline at end of file +var _0x17fb=['../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','reject','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x369219,_0x2bbd68){var _0x3bd48f=function(_0x2f34dd){while(--_0x2f34dd){_0x369219['push'](_0x369219['shift']());}};_0x3bd48f(++_0x2bbd68);}(_0x17fb,0xc1));var _0xb17f=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x17fb[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0xb17f('0x0'));var util=require(_0xb17f('0x1'));var path=require('path');var timeout=require(_0xb17f('0x2'));var express=require(_0xb17f('0x3'));var router=express['Router']();var auth=require(_0xb17f('0x4'));var interaction=require(_0xb17f('0x5'));var config=require(_0xb17f('0x6'));var controller=require(_0xb17f('0x7'));router[_0xb17f('0x8')]('/',auth[_0xb17f('0x9')](),controller[_0xb17f('0xa')]);router['get'](_0xb17f('0xb'),auth[_0xb17f('0x9')](),controller['describe']);router[_0xb17f('0x8')](_0xb17f('0xc'),auth[_0xb17f('0x9')](),controller[_0xb17f('0xd')]);router[_0xb17f('0xe')]('/',auth[_0xb17f('0x9')](),interaction[_0xb17f('0xf')](_0xb17f('0x10'),_0xb17f('0x11')),controller[_0xb17f('0x12')]);router[_0xb17f('0x13')]('/:id',controller[_0xb17f('0x14')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth[_0xb17f('0x9')](),controller[_0xb17f('0x15')]);router['delete'](_0xb17f('0xc'),auth[_0xb17f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 3589bf5..855c033 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 _0x9aec=['sequelize','exports','TEXT','medium'];(function(_0x5da22d,_0x88451b){var _0x3410c1=function(_0x25559f){while(--_0x25559f){_0x5da22d['push'](_0x5da22d['shift']());}};_0x3410c1(++_0x88451b);}(_0x9aec,0xe8));var _0xc9ae=function(_0xe2579b,_0x4c7225){_0xe2579b=_0xe2579b-0x0;var _0x2498eb=_0x9aec[_0xe2579b];return _0x2498eb;};'use strict';var Sequelize=require(_0xc9ae('0x0'));module[_0xc9ae('0x1')]={'body':{'type':Sequelize[_0xc9ae('0x2')](_0xc9ae('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x18a5=['sequelize','exports'];(function(_0x53a2a1,_0x595e09){var _0x270bc4=function(_0x27c716){while(--_0x27c716){_0x53a2a1['push'](_0x53a2a1['shift']());}};_0x270bc4(++_0x595e09);}(_0x18a5,0x164));var _0x518a=function(_0x43c4bd,_0x4b0c31){_0x43c4bd=_0x43c4bd-0x0;var _0x422adc=_0x18a5[_0x43c4bd];return _0x422adc;};'use strict';var Sequelize=require(_0x518a('0x0'));module[_0x518a('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 8a8bf59..99466c3 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 _0x5392=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','then','destroy','stack','name','send','ChatOfflineMessage','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','field','findAll','show','params','length','includeAll','include','options','find','catch','create','update','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0xa11885,_0x512c0e){var _0x4a2188=function(_0x16300e){while(--_0x16300e){_0xa11885['push'](_0xa11885['shift']());}};_0x4a2188(++_0x512c0e);}(_0x5392,0x192));var _0x2539=function(_0x2225fa,_0x48cd10){_0x2225fa=_0x2225fa-0x0;var _0x408cbb=_0x5392[_0x2225fa];return _0x408cbb;};'use strict';var pdf=require(_0x2539('0x0'));var emlformat=require(_0x2539('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2539('0x2'));var jsonpatch=require(_0x2539('0x3'));var rp=require(_0x2539('0x4'));var moment=require(_0x2539('0x5'));var BPromise=require(_0x2539('0x6'));var Mustache=require(_0x2539('0x7'));var util=require(_0x2539('0x8'));var path=require(_0x2539('0x9'));var sox=require(_0x2539('0xa'));var csv=require(_0x2539('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2539('0xc'));var squel=require('squel');var crypto=require(_0x2539('0xd'));var jsforce=require(_0x2539('0xe'));var deskjs=require(_0x2539('0xf'));var toCsv=require(_0x2539('0xb'));var querystring=require(_0x2539('0x10'));var Papa=require('papaparse');var authService=require(_0x2539('0x11'));var hardwareService=require(_0x2539('0x12'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x2539('0x13'))(_0x2539('0x14'));var utils=require(_0x2539('0x15'));var config=require(_0x2539('0x16'));var db=require(_0x2539('0x17'))['db'];function respondWithStatusCode(_0x168089,_0x386d72){_0x386d72=_0x386d72||0xcc;return function(_0x31a80b){if(_0x31a80b){return _0x168089[_0x2539('0x18')](_0x386d72);}return _0x168089['status'](_0x386d72)[_0x2539('0x19')]();};}function respondWithResult(_0x233b4d,_0x371d99){_0x371d99=_0x371d99||0xc8;return function(_0x26d8f9){if(_0x26d8f9){return _0x233b4d[_0x2539('0x1a')](_0x371d99)[_0x2539('0x1b')](_0x26d8f9);}};}function respondWithFilteredResult(_0x17ca56,_0x496252){return function(_0x32fc5e){if(_0x32fc5e){var _0x232736=_0x32fc5e[_0x2539('0x1c')],_0x296a40=_0x496252[_0x2539('0x1d')],_0x4f93cc=_0x496252[_0x2539('0x1d')]+_0x496252[_0x2539('0x1e')],_0x5e2d9d;if(_0x4f93cc>=_0x232736){_0x4f93cc=_0x232736;_0x5e2d9d=0xc8;}else{_0x5e2d9d=0xce;}_0x17ca56[_0x2539('0x1a')](_0x5e2d9d);return _0x17ca56['set']('Content-Range',_0x296a40+'-'+_0x4f93cc+'/'+_0x232736)[_0x2539('0x1b')](_0x32fc5e);}return null;};}function patchUpdates(_0x571520){return function(_0x59bcd7){try{jsonpatch[_0x2539('0x1f')](_0x59bcd7,_0x571520,!![]);}catch(_0x4e4d07){return BPromise[_0x2539('0x20')](_0x4e4d07);}return _0x59bcd7['save']();};}function saveUpdates(_0x7fe33c,_0x8602c4){return function(_0x216f1e){if(_0x216f1e){return _0x216f1e['update'](_0x7fe33c)[_0x2539('0x21')](function(_0x1fc2a0){return _0x1fc2a0;});}return null;};}function removeEntity(_0x47ac1e,_0x3007b8){return function(_0x271f14){if(_0x271f14){return _0x271f14[_0x2539('0x22')]()[_0x2539('0x21')](function(){_0x47ac1e['status'](0xcc)[_0x2539('0x19')]();});}};}function handleEntityNotFound(_0x5dd0e4,_0x399bf6){return function(_0x2bcc6e){if(!_0x2bcc6e){_0x5dd0e4[_0x2539('0x18')](0x194);}return _0x2bcc6e;};}function handleError(_0x476bfa,_0x5933df){_0x5933df=_0x5933df||0x1f4;return function(_0x397b49){logger['error'](_0x397b49[_0x2539('0x23')]);if(_0x397b49[_0x2539('0x24')]){delete _0x397b49['name'];}_0x476bfa[_0x2539('0x1a')](_0x5933df)[_0x2539('0x25')](_0x397b49);};}exports['index']=function(_0x1b08b5,_0x57d9ab){var _0x197363={},_0x49491e={},_0x4d6e3f={'count':0x0,'rows':[]};var _0x2e398f=db[_0x2539('0x26')][_0x2539('0x27')];_0x49491e[_0x2539('0x28')]=_[_0x2539('0x29')](_0x2e398f);_0x49491e[_0x2539('0x2a')]=_[_0x2539('0x29')](_0x1b08b5[_0x2539('0x2a')]);_0x49491e[_0x2539('0x2b')]=_[_0x2539('0x2c')](_0x49491e['model'],_0x49491e['query']);_0x197363[_0x2539('0x2d')]=_[_0x2539('0x2c')](_0x49491e['model'],qs[_0x2539('0x2e')](_0x1b08b5[_0x2539('0x2a')][_0x2539('0x2e')]));_0x197363[_0x2539('0x2d')]=_0x197363[_0x2539('0x2d')]['length']?_0x197363['attributes']:_0x49491e[_0x2539('0x28')];if(!_0x1b08b5['query']['hasOwnProperty'](_0x2539('0x2f'))){_0x197363['limit']=qs['limit'](_0x1b08b5[_0x2539('0x2a')][_0x2539('0x1e')]);_0x197363['offset']=qs['offset'](_0x1b08b5['query'][_0x2539('0x1d')]);}_0x197363[_0x2539('0x30')]=qs[_0x2539('0x31')](_0x1b08b5[_0x2539('0x2a')][_0x2539('0x31')]);_0x197363[_0x2539('0x32')]=qs['filters'](_[_0x2539('0x33')](_0x1b08b5[_0x2539('0x2a')],_0x49491e[_0x2539('0x2b')]));if(_0x1b08b5[_0x2539('0x2a')][_0x2539('0x34')]){_0x197363[_0x2539('0x32')]=_[_0x2539('0x35')](_0x197363[_0x2539('0x32')],{'$or':_['map'](_0x2e398f,function(_0x446781){if(_0x446781[_0x2539('0x36')]['key']!==_0x2539('0x37')){var _0x3f27bd={};_0x3f27bd[_0x446781[_0x2539('0x38')]]={'$like':'%'+_0x1b08b5['query'][_0x2539('0x34')]+'%'};return _0x3f27bd;}})});}_0x197363=_['merge']({},_0x197363,_0x1b08b5['options']);var _0xbcd42={'where':_0x197363[_0x2539('0x32')]};return db[_0x2539('0x26')]['count'](_0xbcd42)[_0x2539('0x21')](function(_0x219901){_0x4d6e3f[_0x2539('0x1c')]=_0x219901;if(_0x1b08b5[_0x2539('0x2a')]['includeAll']){_0x197363['include']=[{'all':!![]}];}return db[_0x2539('0x26')][_0x2539('0x39')](_0x197363);})[_0x2539('0x21')](function(_0x599126){_0x4d6e3f['rows']=_0x599126;return _0x4d6e3f;})[_0x2539('0x21')](respondWithFilteredResult(_0x57d9ab,_0x197363))['catch'](handleError(_0x57d9ab,null));};exports[_0x2539('0x3a')]=function(_0x53de67,_0x5a3822){var _0x57efc2={'raw':!![],'where':{'id':_0x53de67[_0x2539('0x3b')]['id']}},_0x185685={};_0x185685['model']=_[_0x2539('0x29')](db[_0x2539('0x26')][_0x2539('0x27')]);_0x185685['query']=_[_0x2539('0x29')](_0x53de67[_0x2539('0x2a')]);_0x185685['filters']=_['intersection'](_0x185685[_0x2539('0x28')],_0x185685[_0x2539('0x2a')]);_0x57efc2[_0x2539('0x2d')]=_['intersection'](_0x185685[_0x2539('0x28')],qs[_0x2539('0x2e')](_0x53de67['query'][_0x2539('0x2e')]));_0x57efc2[_0x2539('0x2d')]=_0x57efc2['attributes'][_0x2539('0x3c')]?_0x57efc2[_0x2539('0x2d')]:_0x185685[_0x2539('0x28')];if(_0x53de67[_0x2539('0x2a')][_0x2539('0x3d')]){_0x57efc2[_0x2539('0x3e')]=[{'all':!![]}];}_0x57efc2=_[_0x2539('0x35')]({},_0x57efc2,_0x53de67[_0x2539('0x3f')]);return db[_0x2539('0x26')][_0x2539('0x40')](_0x57efc2)[_0x2539('0x21')](handleEntityNotFound(_0x5a3822,null))[_0x2539('0x21')](respondWithResult(_0x5a3822,null))[_0x2539('0x41')](handleError(_0x5a3822,null));};exports['create']=function(_0x4cbd89,_0x42420d){return db['ChatOfflineMessage'][_0x2539('0x42')](_0x4cbd89['body'],{})[_0x2539('0x21')](respondWithResult(_0x42420d,0xc9))[_0x2539('0x41')](handleError(_0x42420d,null));};exports[_0x2539('0x43')]=function(_0x5c49af,_0x1d95eb){if(_0x5c49af[_0x2539('0x44')]['id']){delete _0x5c49af[_0x2539('0x44')]['id'];}return db['ChatOfflineMessage']['find']({'where':{'id':_0x5c49af[_0x2539('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1d95eb,null))['then'](saveUpdates(_0x5c49af[_0x2539('0x44')],null))[_0x2539('0x21')](respondWithResult(_0x1d95eb,null))[_0x2539('0x41')](handleError(_0x1d95eb,null));};exports[_0x2539('0x22')]=function(_0x446eb6,_0x410c89){return db[_0x2539('0x26')]['find']({'where':{'id':_0x446eb6[_0x2539('0x3b')]['id']}})[_0x2539('0x21')](handleEntityNotFound(_0x410c89,null))['then'](removeEntity(_0x410c89,null))[_0x2539('0x41')](handleError(_0x410c89,null));};exports[_0x2539('0x45')]=function(_0xb2aa9f,_0x350c5e){return db[_0x2539('0x26')][_0x2539('0x45')]()[_0x2539('0x21')](respondWithResult(_0x350c5e,null))['catch'](handleError(_0x350c5e,null));}; \ No newline at end of file +var _0xc32d=['create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','ChatOfflineMessage','rawAttributes','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','merge','map','type','key','field','options','includeAll','findAll','catch','show','fields','include'];(function(_0x39c49b,_0x556674){var _0x445ebc=function(_0x293b61){while(--_0x293b61){_0x39c49b['push'](_0x39c49b['shift']());}};_0x445ebc(++_0x556674);}(_0xc32d,0x16d));var _0xdc32=function(_0x19c750,_0x460688){_0x19c750=_0x19c750-0x0;var _0x51ee14=_0xc32d[_0x19c750];return _0x51ee14;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdc32('0x0'));var rimraf=require(_0xdc32('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc32('0x2'));var rp=require(_0xdc32('0x3'));var moment=require('moment');var BPromise=require(_0xdc32('0x4'));var Mustache=require(_0xdc32('0x5'));var util=require(_0xdc32('0x6'));var path=require('path');var sox=require(_0xdc32('0x7'));var csv=require(_0xdc32('0x8'));var ejs=require(_0xdc32('0x9'));var fs=require('fs');var _=require(_0xdc32('0xa'));var squel=require('squel');var crypto=require(_0xdc32('0xb'));var jsforce=require(_0xdc32('0xc'));var deskjs=require(_0xdc32('0xd'));var toCsv=require(_0xdc32('0x8'));var querystring=require(_0xdc32('0xe'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xdc32('0xf'));var Redis=require(_0xdc32('0x10'));var qs=require(_0xdc32('0x11'));var logger=require(_0xdc32('0x12'))(_0xdc32('0x13'));var utils=require(_0xdc32('0x14'));var config=require(_0xdc32('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e71c7,_0x1b810b){_0x1b810b=_0x1b810b||0xcc;return function(_0x2a4936){if(_0x2a4936){return _0x5e71c7[_0xdc32('0x16')](_0x1b810b);}return _0x5e71c7[_0xdc32('0x17')](_0x1b810b)[_0xdc32('0x18')]();};}function respondWithResult(_0x2db845,_0x1f5058){_0x1f5058=_0x1f5058||0xc8;return function(_0x14d38e){if(_0x14d38e){return _0x2db845[_0xdc32('0x17')](_0x1f5058)[_0xdc32('0x19')](_0x14d38e);}};}function respondWithFilteredResult(_0x43b886,_0x4ffa6f){return function(_0x4a02bd){if(_0x4a02bd){var _0x370d40=_0x4a02bd[_0xdc32('0x1a')],_0x141747=_0x4ffa6f['offset'],_0x354108=_0x4ffa6f[_0xdc32('0x1b')]+_0x4ffa6f[_0xdc32('0x1c')],_0x54f316;if(_0x354108>=_0x370d40){_0x354108=_0x370d40;_0x54f316=0xc8;}else{_0x54f316=0xce;}_0x43b886[_0xdc32('0x17')](_0x54f316);return _0x43b886[_0xdc32('0x1d')](_0xdc32('0x1e'),_0x141747+'-'+_0x354108+'/'+_0x370d40)[_0xdc32('0x19')](_0x4a02bd);}return null;};}function patchUpdates(_0x4a23c3){return function(_0x519224){try{jsonpatch[_0xdc32('0x1f')](_0x519224,_0x4a23c3,!![]);}catch(_0x30695d){return BPromise[_0xdc32('0x20')](_0x30695d);}return _0x519224[_0xdc32('0x21')]();};}function saveUpdates(_0x366f9a,_0x22b23d){return function(_0x503a36){if(_0x503a36){return _0x503a36[_0xdc32('0x22')](_0x366f9a)['then'](function(_0x729b12){return _0x729b12;});}return null;};}function removeEntity(_0x2cdf43,_0x4b9bc2){return function(_0x1f1c14){if(_0x1f1c14){return _0x1f1c14[_0xdc32('0x23')]()[_0xdc32('0x24')](function(){_0x2cdf43['status'](0xcc)[_0xdc32('0x18')]();});}};}function handleEntityNotFound(_0x5c9d66,_0x57251a){return function(_0x5f0cf5){if(!_0x5f0cf5){_0x5c9d66[_0xdc32('0x16')](0x194);}return _0x5f0cf5;};}function handleError(_0x52251a,_0x55bcae){_0x55bcae=_0x55bcae||0x1f4;return function(_0x4607ab){logger[_0xdc32('0x25')](_0x4607ab['stack']);if(_0x4607ab[_0xdc32('0x26')]){delete _0x4607ab[_0xdc32('0x26')];}_0x52251a[_0xdc32('0x17')](_0x55bcae)['send'](_0x4607ab);};}exports[_0xdc32('0x27')]=function(_0x5a2b17,_0x4e95c8){var _0x410bed={},_0x35fb17={},_0x4d583c={'count':0x0,'rows':[]};var _0x1745d7=db[_0xdc32('0x28')][_0xdc32('0x29')];_0x35fb17[_0xdc32('0x2a')]=_[_0xdc32('0x2b')](_0x1745d7);_0x35fb17['query']=_['keys'](_0x5a2b17[_0xdc32('0x2c')]);_0x35fb17[_0xdc32('0x2d')]=_[_0xdc32('0x2e')](_0x35fb17[_0xdc32('0x2a')],_0x35fb17[_0xdc32('0x2c')]);_0x410bed[_0xdc32('0x2f')]=_[_0xdc32('0x2e')](_0x35fb17[_0xdc32('0x2a')],qs['fields'](_0x5a2b17[_0xdc32('0x2c')]['fields']));_0x410bed[_0xdc32('0x2f')]=_0x410bed[_0xdc32('0x2f')][_0xdc32('0x30')]?_0x410bed[_0xdc32('0x2f')]:_0x35fb17[_0xdc32('0x2a')];if(!_0x5a2b17[_0xdc32('0x2c')]['hasOwnProperty'](_0xdc32('0x31'))){_0x410bed[_0xdc32('0x1c')]=qs['limit'](_0x5a2b17[_0xdc32('0x2c')][_0xdc32('0x1c')]);_0x410bed['offset']=qs[_0xdc32('0x1b')](_0x5a2b17[_0xdc32('0x2c')][_0xdc32('0x1b')]);}_0x410bed[_0xdc32('0x32')]=qs['sort'](_0x5a2b17[_0xdc32('0x2c')][_0xdc32('0x33')]);_0x410bed['where']=qs['filters'](_[_0xdc32('0x34')](_0x5a2b17[_0xdc32('0x2c')],_0x35fb17[_0xdc32('0x2d')]));if(_0x5a2b17['query'][_0xdc32('0x35')]){_0x410bed[_0xdc32('0x36')]=_[_0xdc32('0x37')](_0x410bed['where'],{'$or':_[_0xdc32('0x38')](_0x1745d7,function(_0x246543){if(_0x246543[_0xdc32('0x39')][_0xdc32('0x3a')]!=='VIRTUAL'){var _0x5b40a0={};_0x5b40a0[_0x246543[_0xdc32('0x3b')]]={'$like':'%'+_0x5a2b17[_0xdc32('0x2c')]['filter']+'%'};return _0x5b40a0;}})});}_0x410bed=_[_0xdc32('0x37')]({},_0x410bed,_0x5a2b17[_0xdc32('0x3c')]);var _0x647b28={'where':_0x410bed[_0xdc32('0x36')]};return db['ChatOfflineMessage'][_0xdc32('0x1a')](_0x647b28)['then'](function(_0x372b38){_0x4d583c[_0xdc32('0x1a')]=_0x372b38;if(_0x5a2b17['query'][_0xdc32('0x3d')]){_0x410bed['include']=[{'all':!![]}];}return db[_0xdc32('0x28')][_0xdc32('0x3e')](_0x410bed);})[_0xdc32('0x24')](function(_0x1e688f){_0x4d583c['rows']=_0x1e688f;return _0x4d583c;})[_0xdc32('0x24')](respondWithFilteredResult(_0x4e95c8,_0x410bed))[_0xdc32('0x3f')](handleError(_0x4e95c8,null));};exports[_0xdc32('0x40')]=function(_0x5f4338,_0xe76f85){var _0x339845={'raw':!![],'where':{'id':_0x5f4338['params']['id']}},_0x442f27={};_0x442f27[_0xdc32('0x2a')]=_['keys'](db['ChatOfflineMessage'][_0xdc32('0x29')]);_0x442f27['query']=_['keys'](_0x5f4338['query']);_0x442f27[_0xdc32('0x2d')]=_[_0xdc32('0x2e')](_0x442f27[_0xdc32('0x2a')],_0x442f27['query']);_0x339845[_0xdc32('0x2f')]=_[_0xdc32('0x2e')](_0x442f27[_0xdc32('0x2a')],qs[_0xdc32('0x41')](_0x5f4338[_0xdc32('0x2c')][_0xdc32('0x41')]));_0x339845[_0xdc32('0x2f')]=_0x339845[_0xdc32('0x2f')][_0xdc32('0x30')]?_0x339845[_0xdc32('0x2f')]:_0x442f27[_0xdc32('0x2a')];if(_0x5f4338[_0xdc32('0x2c')][_0xdc32('0x3d')]){_0x339845[_0xdc32('0x42')]=[{'all':!![]}];}_0x339845=_['merge']({},_0x339845,_0x5f4338[_0xdc32('0x3c')]);return db['ChatOfflineMessage']['find'](_0x339845)[_0xdc32('0x24')](handleEntityNotFound(_0xe76f85,null))[_0xdc32('0x24')](respondWithResult(_0xe76f85,null))[_0xdc32('0x3f')](handleError(_0xe76f85,null));};exports[_0xdc32('0x43')]=function(_0x4c97a9,_0x42c02e){return db[_0xdc32('0x28')][_0xdc32('0x43')](_0x4c97a9['body'],{})['then'](respondWithResult(_0x42c02e,0xc9))[_0xdc32('0x3f')](handleError(_0x42c02e,null));};exports[_0xdc32('0x22')]=function(_0x662443,_0xeef3b9){if(_0x662443[_0xdc32('0x44')]['id']){delete _0x662443['body']['id'];}return db[_0xdc32('0x28')][_0xdc32('0x45')]({'where':{'id':_0x662443['params']['id']}})['then'](handleEntityNotFound(_0xeef3b9,null))['then'](saveUpdates(_0x662443[_0xdc32('0x44')],null))[_0xdc32('0x24')](respondWithResult(_0xeef3b9,null))[_0xdc32('0x3f')](handleError(_0xeef3b9,null));};exports[_0xdc32('0x23')]=function(_0x26462e,_0x46a610){return db[_0xdc32('0x28')][_0xdc32('0x45')]({'where':{'id':_0x26462e[_0xdc32('0x46')]['id']}})[_0xdc32('0x24')](handleEntityNotFound(_0x46a610,null))['then'](removeEntity(_0x46a610,null))[_0xdc32('0x3f')](handleError(_0x46a610,null));};exports[_0xdc32('0x47')]=function(_0xdd1656,_0x51bd83){return db['ChatOfflineMessage']['describe']()['then'](respondWithResult(_0x51bd83,null))['catch'](handleError(_0x51bd83,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 296ca2f..1debac4 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 _0x7fcc=['chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','./chatOfflineMessage.attributes','exports','define'];(function(_0x266076,_0x38ab0d){var _0x2563a9=function(_0x57f361){while(--_0x57f361){_0x266076['push'](_0x266076['shift']());}};_0x2563a9(++_0x38ab0d);}(_0x7fcc,0x1bc));var _0xc7fc=function(_0x29b548,_0x2ac01c){_0x29b548=_0x29b548-0x0;var _0x10c70e=_0x7fcc[_0x29b548];return _0x10c70e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc7fc('0x0'))('api');var moment=require(_0xc7fc('0x1'));var BPromise=require('bluebird');var rp=require(_0xc7fc('0x2'));var attributes=require(_0xc7fc('0x3'));module[_0xc7fc('0x4')]=function(_0x3bfe56,_0x424718){return _0x3bfe56[_0xc7fc('0x5')]('ChatOfflineMessage',attributes,{'tableName':_0xc7fc('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc7fc('0x7'),'collate':_0xc7fc('0x8')});}; \ No newline at end of file +var _0xc5f1=['./chatOfflineMessage.attributes','exports','ChatOfflineMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise'];(function(_0x3ee728,_0x49e1b9){var _0x10aa27=function(_0x4da4ac){while(--_0x4da4ac){_0x3ee728['push'](_0x3ee728['shift']());}};_0x10aa27(++_0x49e1b9);}(_0xc5f1,0x15a));var _0x1c5f=function(_0x581419,_0x409195){_0x581419=_0x581419-0x0;var _0x514d4e=_0xc5f1[_0x581419];return _0x514d4e;};'use strict';var _=require(_0x1c5f('0x0'));var util=require(_0x1c5f('0x1'));var logger=require(_0x1c5f('0x2'))(_0x1c5f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1c5f('0x4'));var attributes=require(_0x1c5f('0x5'));module[_0x1c5f('0x6')]=function(_0x5caff4,_0x5ac7fe){return _0x5caff4['define'](_0x1c5f('0x7'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1c5f('0x8')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 92383f6..060c30f 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 _0x6021=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','moment','bluebird'];(function(_0x339d45,_0x5b91d4){var _0x5e4a60=function(_0x4de526){while(--_0x4de526){_0x339d45['push'](_0x339d45['shift']());}};_0x5e4a60(++_0x5b91d4);}(_0x6021,0x179));var _0x1602=function(_0x51221f,_0x3b7dc5){_0x51221f=_0x51221f-0x0;var _0x529054=_0x6021[_0x51221f];return _0x529054;};'use strict';var _=require(_0x1602('0x0'));var util=require('util');var moment=require(_0x1602('0x1'));var BPromise=require(_0x1602('0x2'));var rs=require(_0x1602('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1602('0x4'))['db'];var utils=require(_0x1602('0x5'));var logger=require('../../config/logger')(_0x1602('0x6'));var config=require('../../config/environment');var jayson=require(_0x1602('0x7'));var client=jayson[_0x1602('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25503b,_0x394859,_0x104796){return new BPromise(function(_0x4eb900,_0x56fb3f){return client[_0x1602('0x9')](_0x25503b,_0x104796)[_0x1602('0xa')](function(_0x2317ab){logger[_0x1602('0xb')](_0x1602('0xc'),_0x394859,_0x1602('0xd'));logger[_0x1602('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x394859,_0x1602('0xd'),JSON[_0x1602('0xf')](_0x2317ab));if(_0x2317ab[_0x1602('0x10')]){if(_0x2317ab['error'][_0x1602('0x11')]===0x1f4){logger[_0x1602('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x394859,_0x2317ab[_0x1602('0x10')][_0x1602('0x12')]);return _0x56fb3f(_0x2317ab[_0x1602('0x10')][_0x1602('0x12')]);}logger[_0x1602('0x10')](_0x1602('0xc'),_0x394859,_0x2317ab[_0x1602('0x10')][_0x1602('0x12')]);return _0x4eb900(_0x2317ab['error']['message']);}else{logger[_0x1602('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x394859,_0x1602('0xd'));_0x4eb900(_0x2317ab['result'][_0x1602('0x12')]);}})['catch'](function(_0x12039a){logger[_0x1602('0x10')](_0x1602('0xc'),_0x394859,_0x12039a);_0x56fb3f(_0x12039a);});});} \ No newline at end of file +var _0xad65=['request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xad65,0x1cf));var _0x5ad6=function(_0x246426,_0x505c21){_0x246426=_0x246426-0x0;var _0x320fcf=_0xad65[_0x246426];return _0x320fcf;};'use strict';var _=require(_0x5ad6('0x0'));var util=require(_0x5ad6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5ad6('0x2'));var fs=require('fs');var Redis=require(_0x5ad6('0x3'));var db=require(_0x5ad6('0x4'))['db'];var utils=require(_0x5ad6('0x5'));var logger=require(_0x5ad6('0x6'))(_0x5ad6('0x7'));var config=require('../../config/environment');var jayson=require(_0x5ad6('0x8'));var client=jayson[_0x5ad6('0x9')][_0x5ad6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x305cd5,_0x13753f,_0x1de12){return new BPromise(function(_0x3579ca,_0x312517){return client[_0x5ad6('0xb')](_0x305cd5,_0x1de12)[_0x5ad6('0xc')](function(_0x5270df){logger[_0x5ad6('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x13753f,'request\x20sent');logger[_0x5ad6('0xe')](_0x5ad6('0xf'),_0x13753f,'request\x20sent',JSON['stringify'](_0x5270df));if(_0x5270df['error']){if(_0x5270df[_0x5ad6('0x10')][_0x5ad6('0x11')]===0x1f4){logger[_0x5ad6('0x10')](_0x5ad6('0x12'),_0x13753f,_0x5270df[_0x5ad6('0x10')][_0x5ad6('0x13')]);return _0x312517(_0x5270df[_0x5ad6('0x10')][_0x5ad6('0x13')]);}logger[_0x5ad6('0x10')](_0x5ad6('0x12'),_0x13753f,_0x5270df[_0x5ad6('0x10')][_0x5ad6('0x13')]);return _0x3579ca(_0x5270df['error']['message']);}else{logger[_0x5ad6('0xd')](_0x5ad6('0x12'),_0x13753f,_0x5ad6('0x14'));_0x3579ca(_0x5270df[_0x5ad6('0x15')][_0x5ad6('0x13')]);}})[_0x5ad6('0x16')](function(_0x46656a){logger[_0x5ad6('0x10')](_0x5ad6('0x12'),_0x13753f,_0x46656a);_0x312517(_0x46656a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index cd0f452..6848f95 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 _0x7e16=['isAuthenticated','index','get','/describe','show','post','put','/:id','update','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller'];(function(_0x23ab7f,_0x4251d2){var _0x405ca9=function(_0x47e585){while(--_0x47e585){_0x23ab7f['push'](_0x23ab7f['shift']());}};_0x405ca9(++_0x4251d2);}(_0x7e16,0x16f));var _0x67e1=function(_0x3cd27a,_0x2f9a53){_0x3cd27a=_0x3cd27a-0x0;var _0x49b67c=_0x7e16[_0x3cd27a];return _0x49b67c;};'use strict';var multer=require(_0x67e1('0x0'));var util=require(_0x67e1('0x1'));var path=require(_0x67e1('0x2'));var timeout=require(_0x67e1('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x67e1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x67e1('0x5'));var controller=require(_0x67e1('0x6'));router['get']('/',auth[_0x67e1('0x7')](),controller[_0x67e1('0x8')]);router[_0x67e1('0x9')](_0x67e1('0xa'),auth[_0x67e1('0x7')](),controller['describe']);router['get']('/:id',auth[_0x67e1('0x7')](),controller[_0x67e1('0xb')]);router[_0x67e1('0xc')]('/',auth[_0x67e1('0x7')](),controller['create']);router[_0x67e1('0xd')](_0x67e1('0xe'),auth[_0x67e1('0x7')](),controller[_0x67e1('0xf')]);router['delete'](_0x67e1('0xe'),auth['isAuthenticated'](),controller[_0x67e1('0x10')]);module['exports']=router; \ No newline at end of file +var _0x79d8=['isAuthenticated','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe'];(function(_0x250010,_0x489f87){var _0x2448f2=function(_0x56f2b2){while(--_0x56f2b2){_0x250010['push'](_0x250010['shift']());}};_0x2448f2(++_0x489f87);}(_0x79d8,0x67));var _0x879d=function(_0x217812,_0x4bd3f7){_0x217812=_0x217812-0x0;var _0x5c4d4d=_0x79d8[_0x217812];return _0x5c4d4d;};'use strict';var multer=require(_0x879d('0x0'));var util=require(_0x879d('0x1'));var path=require(_0x879d('0x2'));var timeout=require(_0x879d('0x3'));var express=require('express');var router=express[_0x879d('0x4')]();var auth=require(_0x879d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x879d('0x6'));var controller=require(_0x879d('0x7'));router[_0x879d('0x8')]('/',auth['isAuthenticated'](),controller[_0x879d('0x9')]);router[_0x879d('0x8')](_0x879d('0xa'),auth[_0x879d('0xb')](),controller['describe']);router[_0x879d('0x8')](_0x879d('0xc'),auth[_0x879d('0xb')](),controller[_0x879d('0xd')]);router[_0x879d('0xe')]('/',auth['isAuthenticated'](),controller[_0x879d('0xf')]);router['put']('/:id',auth[_0x879d('0xb')](),controller[_0x879d('0x10')]);router[_0x879d('0x11')]('/:id',auth[_0x879d('0xb')](),controller[_0x879d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index b3b3164..609a3fa 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 _0x215d=['timeout','sequelize','STRING','ENUM','mouseOver'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x215d,0x187));var _0xd215=function(_0x1c6364,_0x38916e){_0x1c6364=_0x1c6364-0x0;var _0x29cd5d=_0x215d[_0x1c6364];return _0x29cd5d;};'use strict';var Sequelize=require(_0xd215('0x0'));module['exports']={'name':{'type':Sequelize[_0xd215('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd215('0x2')](_0xd215('0x3'),_0xd215('0x4')),'defaultValue':_0xd215('0x3')},'selector':{'type':Sequelize[_0xd215('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1956=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1956,0x15c));var _0x6195=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0x1956[_0x1b3a5c];return _0x2ae8cb;};'use strict';var Sequelize=require(_0x6195('0x0'));module[_0x6195('0x1')]={'name':{'type':Sequelize[_0x6195('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6195('0x3')](_0x6195('0x4'),_0x6195('0x5')),'defaultValue':_0x6195('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6195('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c056fdc..e632cd8 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 _0x1a8f=['send','params','model','ChatProactiveAction','rawAttributes','filters','intersection','query','attributes','fields','length','includeAll','include','merge','find','catch','update','body','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','stack','name'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x1a8f,0x88));var _0xf1a8=function(_0x6ba53a,_0x29277a){_0x6ba53a=_0x6ba53a-0x0;var _0x2842ca=_0x1a8f[_0x6ba53a];return _0x2842ca;};'use strict';var pdf=require(_0xf1a8('0x0'));var emlformat=require(_0xf1a8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf1a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf1a8('0x3'));var moment=require(_0xf1a8('0x4'));var BPromise=require(_0xf1a8('0x5'));var Mustache=require('mustache');var util=require(_0xf1a8('0x6'));var path=require(_0xf1a8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf1a8('0x8'));var fs=require('fs');var _=require(_0xf1a8('0x9'));var squel=require(_0xf1a8('0xa'));var crypto=require(_0xf1a8('0xb'));var jsforce=require(_0xf1a8('0xc'));var deskjs=require(_0xf1a8('0xd'));var toCsv=require(_0xf1a8('0xe'));var querystring=require(_0xf1a8('0xf'));var Papa=require(_0xf1a8('0x10'));var authService=require(_0xf1a8('0x11'));var hardwareService=require(_0xf1a8('0x12'));var Redis=require(_0xf1a8('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0xf1a8('0x14'))(_0xf1a8('0x15'));var utils=require(_0xf1a8('0x16'));var config=require(_0xf1a8('0x17'));var db=require(_0xf1a8('0x18'))['db'];function respondWithStatusCode(_0x1f8c1d,_0x598398){_0x598398=_0x598398||0xcc;return function(_0x48cc6a){if(_0x48cc6a){return _0x1f8c1d[_0xf1a8('0x19')](_0x598398);}return _0x1f8c1d[_0xf1a8('0x1a')](_0x598398)['end']();};}function respondWithResult(_0xb2e6a8,_0x3dd305){_0x3dd305=_0x3dd305||0xc8;return function(_0x35d340){if(_0x35d340){return _0xb2e6a8[_0xf1a8('0x1a')](_0x3dd305)[_0xf1a8('0x1b')](_0x35d340);}};}function respondWithFilteredResult(_0x78b03a,_0x217093){return function(_0x4c59af){if(_0x4c59af){var _0x2d9440=_0x4c59af[_0xf1a8('0x1c')],_0x28aca3=_0x217093[_0xf1a8('0x1d')],_0x35285c=_0x217093['offset']+_0x217093[_0xf1a8('0x1e')],_0x2f18cc;if(_0x35285c>=_0x2d9440){_0x35285c=_0x2d9440;_0x2f18cc=0xc8;}else{_0x2f18cc=0xce;}_0x78b03a[_0xf1a8('0x1a')](_0x2f18cc);return _0x78b03a[_0xf1a8('0x1f')](_0xf1a8('0x20'),_0x28aca3+'-'+_0x35285c+'/'+_0x2d9440)[_0xf1a8('0x1b')](_0x4c59af);}return null;};}function patchUpdates(_0x3610df){return function(_0x2bde4a){try{jsonpatch[_0xf1a8('0x21')](_0x2bde4a,_0x3610df,!![]);}catch(_0x392a0d){return BPromise[_0xf1a8('0x22')](_0x392a0d);}return _0x2bde4a[_0xf1a8('0x23')]();};}function saveUpdates(_0x10adb7,_0x4a60f9){return function(_0x41d6b1){if(_0x41d6b1){return _0x41d6b1['update'](_0x10adb7)['then'](function(_0x102483){return _0x102483;});}return null;};}function removeEntity(_0x5afde9,_0x5c03e8){return function(_0x26a707){if(_0x26a707){return _0x26a707[_0xf1a8('0x24')]()[_0xf1a8('0x25')](function(){_0x5afde9[_0xf1a8('0x1a')](0xcc)[_0xf1a8('0x26')]();});}};}function handleEntityNotFound(_0x5a0c38,_0x2feec7){return function(_0x420d3e){if(!_0x420d3e){_0x5a0c38[_0xf1a8('0x19')](0x194);}return _0x420d3e;};}function handleError(_0x455d78,_0x1154ed){_0x1154ed=_0x1154ed||0x1f4;return function(_0x4a9f7b){logger['error'](_0x4a9f7b[_0xf1a8('0x27')]);if(_0x4a9f7b[_0xf1a8('0x28')]){delete _0x4a9f7b[_0xf1a8('0x28')];}_0x455d78[_0xf1a8('0x1a')](_0x1154ed)[_0xf1a8('0x29')](_0x4a9f7b);};}exports['show']=function(_0x4a1fa6,_0x3ceaba){var _0x1d700f={'raw':!![],'where':{'id':_0x4a1fa6[_0xf1a8('0x2a')]['id']}},_0x2e1268={};_0x2e1268[_0xf1a8('0x2b')]=_['keys'](db[_0xf1a8('0x2c')][_0xf1a8('0x2d')]);_0x2e1268['query']=_['keys'](_0x4a1fa6['query']);_0x2e1268[_0xf1a8('0x2e')]=_[_0xf1a8('0x2f')](_0x2e1268[_0xf1a8('0x2b')],_0x2e1268[_0xf1a8('0x30')]);_0x1d700f[_0xf1a8('0x31')]=_[_0xf1a8('0x2f')](_0x2e1268[_0xf1a8('0x2b')],qs[_0xf1a8('0x32')](_0x4a1fa6[_0xf1a8('0x30')]['fields']));_0x1d700f[_0xf1a8('0x31')]=_0x1d700f[_0xf1a8('0x31')][_0xf1a8('0x33')]?_0x1d700f[_0xf1a8('0x31')]:_0x2e1268[_0xf1a8('0x2b')];if(_0x4a1fa6[_0xf1a8('0x30')][_0xf1a8('0x34')]){_0x1d700f[_0xf1a8('0x35')]=[{'all':!![]}];}_0x1d700f=_[_0xf1a8('0x36')]({},_0x1d700f,_0x4a1fa6['options']);return db[_0xf1a8('0x2c')][_0xf1a8('0x37')](_0x1d700f)[_0xf1a8('0x25')](handleEntityNotFound(_0x3ceaba,null))[_0xf1a8('0x25')](respondWithResult(_0x3ceaba,null))[_0xf1a8('0x38')](handleError(_0x3ceaba,null));};exports['create']=function(_0x314eef,_0x444ffd){return db['ChatProactiveAction']['create'](_0x314eef['body'],{})[_0xf1a8('0x25')](respondWithResult(_0x444ffd,0xc9))['catch'](handleError(_0x444ffd,null));};exports[_0xf1a8('0x39')]=function(_0x2b7e45,_0x4b1809){if(_0x2b7e45[_0xf1a8('0x3a')]['id']){delete _0x2b7e45[_0xf1a8('0x3a')]['id'];}return db[_0xf1a8('0x2c')][_0xf1a8('0x37')]({'where':{'id':_0x2b7e45[_0xf1a8('0x2a')]['id']}})[_0xf1a8('0x25')](handleEntityNotFound(_0x4b1809,null))['then'](saveUpdates(_0x2b7e45['body'],null))[_0xf1a8('0x25')](respondWithResult(_0x4b1809,null))['catch'](handleError(_0x4b1809,null));};exports[_0xf1a8('0x24')]=function(_0x22367e,_0x7c3817){return db['ChatProactiveAction']['find']({'where':{'id':_0x22367e[_0xf1a8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x7c3817,null))[_0xf1a8('0x25')](removeEntity(_0x7c3817,null))[_0xf1a8('0x38')](handleError(_0x7c3817,null));}; \ No newline at end of file +var _0xd881=['bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','end','status','json','count','offset','set','Content-Range','apply','save','then','sendStatus','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','options','ChatProactiveAction','catch','create','body','update','find','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x36b444,_0x505b35){var _0x786323=function(_0x146af0){while(--_0x146af0){_0x36b444['push'](_0x36b444['shift']());}};_0x786323(++_0x505b35);}(_0xd881,0x182));var _0x1d88=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd881[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0x1d88('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1d88('0x1'));var zipdir=require(_0x1d88('0x2'));var jsonpatch=require(_0x1d88('0x3'));var rp=require(_0x1d88('0x4'));var moment=require(_0x1d88('0x5'));var BPromise=require(_0x1d88('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1d88('0x7'));var sox=require(_0x1d88('0x8'));var csv=require(_0x1d88('0x9'));var ejs=require(_0x1d88('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1d88('0xb'));var crypto=require(_0x1d88('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1d88('0xd'));var toCsv=require(_0x1d88('0x9'));var querystring=require(_0x1d88('0xe'));var Papa=require(_0x1d88('0xf'));var authService=require(_0x1d88('0x10'));var hardwareService=require(_0x1d88('0x11'));var Redis=require(_0x1d88('0x12'));var qs=require(_0x1d88('0x13'));var logger=require('../../config/logger')(_0x1d88('0x14'));var utils=require(_0x1d88('0x15'));var config=require(_0x1d88('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3de233,_0x485406){_0x485406=_0x485406||0xcc;return function(_0x37c67a){if(_0x37c67a){return _0x3de233['sendStatus'](_0x485406);}return _0x3de233['status'](_0x485406)[_0x1d88('0x17')]();};}function respondWithResult(_0xc2d0fb,_0x57e3dc){_0x57e3dc=_0x57e3dc||0xc8;return function(_0x28f286){if(_0x28f286){return _0xc2d0fb[_0x1d88('0x18')](_0x57e3dc)[_0x1d88('0x19')](_0x28f286);}};}function respondWithFilteredResult(_0x32d9e1,_0x1ef677){return function(_0x59dccd){if(_0x59dccd){var _0x3e99b5=_0x59dccd[_0x1d88('0x1a')],_0x344a76=_0x1ef677['offset'],_0x17a740=_0x1ef677[_0x1d88('0x1b')]+_0x1ef677['limit'],_0x4c49a8;if(_0x17a740>=_0x3e99b5){_0x17a740=_0x3e99b5;_0x4c49a8=0xc8;}else{_0x4c49a8=0xce;}_0x32d9e1[_0x1d88('0x18')](_0x4c49a8);return _0x32d9e1[_0x1d88('0x1c')](_0x1d88('0x1d'),_0x344a76+'-'+_0x17a740+'/'+_0x3e99b5)[_0x1d88('0x19')](_0x59dccd);}return null;};}function patchUpdates(_0x567cc5){return function(_0x1fa0c4){try{jsonpatch[_0x1d88('0x1e')](_0x1fa0c4,_0x567cc5,!![]);}catch(_0x3cf39c){return BPromise['reject'](_0x3cf39c);}return _0x1fa0c4[_0x1d88('0x1f')]();};}function saveUpdates(_0xb285ec,_0x417e36){return function(_0x175aae){if(_0x175aae){return _0x175aae['update'](_0xb285ec)[_0x1d88('0x20')](function(_0x318b7c){return _0x318b7c;});}return null;};}function removeEntity(_0x492457,_0x5c4520){return function(_0x1efb3e){if(_0x1efb3e){return _0x1efb3e['destroy']()[_0x1d88('0x20')](function(){_0x492457[_0x1d88('0x18')](0xcc)[_0x1d88('0x17')]();});}};}function handleEntityNotFound(_0x180984,_0x113fec){return function(_0x56658c){if(!_0x56658c){_0x180984[_0x1d88('0x21')](0x194);}return _0x56658c;};}function handleError(_0xee3ee6,_0x1a799a){_0x1a799a=_0x1a799a||0x1f4;return function(_0x526c98){logger['error'](_0x526c98[_0x1d88('0x22')]);if(_0x526c98['name']){delete _0x526c98[_0x1d88('0x23')];}_0xee3ee6[_0x1d88('0x18')](_0x1a799a)[_0x1d88('0x24')](_0x526c98);};}exports[_0x1d88('0x25')]=function(_0x4f1850,_0x9b2853){var _0x2af74c={'raw':!![],'where':{'id':_0x4f1850[_0x1d88('0x26')]['id']}},_0x363587={};_0x363587[_0x1d88('0x27')]=_[_0x1d88('0x28')](db['ChatProactiveAction'][_0x1d88('0x29')]);_0x363587[_0x1d88('0x2a')]=_[_0x1d88('0x28')](_0x4f1850[_0x1d88('0x2a')]);_0x363587[_0x1d88('0x2b')]=_[_0x1d88('0x2c')](_0x363587['model'],_0x363587[_0x1d88('0x2a')]);_0x2af74c[_0x1d88('0x2d')]=_['intersection'](_0x363587[_0x1d88('0x27')],qs[_0x1d88('0x2e')](_0x4f1850[_0x1d88('0x2a')][_0x1d88('0x2e')]));_0x2af74c[_0x1d88('0x2d')]=_0x2af74c['attributes']['length']?_0x2af74c[_0x1d88('0x2d')]:_0x363587[_0x1d88('0x27')];if(_0x4f1850['query'][_0x1d88('0x2f')]){_0x2af74c['include']=[{'all':!![]}];}_0x2af74c=_['merge']({},_0x2af74c,_0x4f1850[_0x1d88('0x30')]);return db[_0x1d88('0x31')]['find'](_0x2af74c)[_0x1d88('0x20')](handleEntityNotFound(_0x9b2853,null))['then'](respondWithResult(_0x9b2853,null))[_0x1d88('0x32')](handleError(_0x9b2853,null));};exports['create']=function(_0x555329,_0x5da349){return db[_0x1d88('0x31')][_0x1d88('0x33')](_0x555329[_0x1d88('0x34')],{})[_0x1d88('0x20')](respondWithResult(_0x5da349,0xc9))[_0x1d88('0x32')](handleError(_0x5da349,null));};exports[_0x1d88('0x35')]=function(_0x5ca2bf,_0x5bef8f){if(_0x5ca2bf[_0x1d88('0x34')]['id']){delete _0x5ca2bf['body']['id'];}return db[_0x1d88('0x31')][_0x1d88('0x36')]({'where':{'id':_0x5ca2bf[_0x1d88('0x26')]['id']}})['then'](handleEntityNotFound(_0x5bef8f,null))[_0x1d88('0x20')](saveUpdates(_0x5ca2bf[_0x1d88('0x34')],null))[_0x1d88('0x20')](respondWithResult(_0x5bef8f,null))[_0x1d88('0x32')](handleError(_0x5bef8f,null));};exports[_0x1d88('0x37')]=function(_0x9a005b,_0x3e5825){return db[_0x1d88('0x31')][_0x1d88('0x36')]({'where':{'id':_0x9a005b[_0x1d88('0x26')]['id']}})[_0x1d88('0x20')](handleEntityNotFound(_0x3e5825,null))[_0x1d88('0x20')](removeEntity(_0x3e5825,null))['catch'](handleError(_0x3e5825,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index af072db..3b0189b 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 _0x14a0=['api','moment','bluebird','request-promise','./chatProactiveAction.attributes','define','ChatProactiveAction','util','../../config/logger'];(function(_0x54f6a6,_0xde810f){var _0x37a293=function(_0x3dad2c){while(--_0x3dad2c){_0x54f6a6['push'](_0x54f6a6['shift']());}};_0x37a293(++_0xde810f);}(_0x14a0,0x8e));var _0x014a=function(_0x5393a6,_0x3c972d){_0x5393a6=_0x5393a6-0x0;var _0x477463=_0x14a0[_0x5393a6];return _0x477463;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var attributes=require(_0x014a('0x6'));module['exports']=function(_0x57a522,_0x1730a5){return _0x57a522[_0x014a('0x7')](_0x014a('0x8'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['chat_proactive_actions','util','../../config/logger','api','bluebird','request-promise','exports','define','ChatProactiveAction'];(function(_0x12bbf8,_0x36413c){var _0x5d81b1=function(_0x19dba5){while(--_0x19dba5){_0x12bbf8['push'](_0x12bbf8['shift']());}};_0x5d81b1(++_0x36413c);}(_0x2032,0xd9));var _0x2203=function(_0x19988d,_0x1cc4c3){_0x19988d=_0x19988d-0x0;var _0x12def0=_0x2032[_0x19988d];return _0x12def0;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var attributes=require('./chatProactiveAction.attributes');module[_0x2203('0x5')]=function(_0x880dcd,_0x44ccfd){return _0x880dcd[_0x2203('0x6')](_0x2203('0x7'),attributes,{'tableName':_0x2203('0x8'),'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 0215e17..e2d40f5 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 _0xa9e0=['http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\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(_0x5272bc,_0x5c974f){var _0x2c66ce=function(_0x23718d){while(--_0x23718d){_0x5272bc['push'](_0x5272bc['shift']());}};_0x2c66ce(++_0x5c974f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x32f250,_0x1fbca3){var _0x39ead3=function(_0x7e79d6){while(--_0x7e79d6){_0x32f250['push'](_0x32f250['shift']());}};_0x39ead3(++_0x1fbca3);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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']('ChatProactiveAction,\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);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 22693db..85d5c50 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 _0xa32b=['multer','path','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','put','update','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa32b,0x68));var _0xba32=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0xa32b[_0x2f6f50];return _0x2cf365;};'use strict';var multer=require(_0xba32('0x0'));var util=require('util');var path=require(_0xba32('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xba32('0x2')]();var auth=require(_0xba32('0x3'));var interaction=require(_0xba32('0x4'));var config=require('../../config/environment');var controller=require(_0xba32('0x5'));router[_0xba32('0x6')](_0xba32('0x7'),auth[_0xba32('0x8')](),controller[_0xba32('0x9')]);router['post']('/',auth[_0xba32('0x8')](),controller['create']);router[_0xba32('0xa')](_0xba32('0x7'),auth[_0xba32('0x8')](),controller[_0xba32('0xb')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xba32('0xc')]=router; \ No newline at end of file +var _0x235b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x148084,_0x6282d6){var _0x2f764a=function(_0x3f124a){while(--_0x3f124a){_0x148084['push'](_0x148084['shift']());}};_0x2f764a(++_0x6282d6);}(_0x235b,0x1ed));var _0xb235=function(_0xd86335,_0xd90bf9){_0xd86335=_0xd86335-0x0;var _0x1be0e8=_0x235b[_0xd86335];return _0x1be0e8;};'use strict';var multer=require(_0xb235('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb235('0x1'));var express=require(_0xb235('0x2'));var router=express[_0xb235('0x3')]();var auth=require(_0xb235('0x4'));var interaction=require(_0xb235('0x5'));var config=require(_0xb235('0x6'));var controller=require('./chatProactiveAction.controller');router[_0xb235('0x7')](_0xb235('0x8'),auth[_0xb235('0x9')](),controller['show']);router[_0xb235('0xa')]('/',auth[_0xb235('0x9')](),controller[_0xb235('0xb')]);router[_0xb235('0xc')](_0xb235('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xb235('0xd')](_0xb235('0x8'),auth[_0xb235('0x9')](),controller[_0xb235('0xe')]);module[_0xb235('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 8d50f86..0f0b36a 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 _0x738f=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x579b6e,_0x3c4f91){var _0x33afd0=function(_0x1fc28a){while(--_0x1fc28a){_0x579b6e['push'](_0x579b6e['shift']());}};_0x33afd0(++_0x3c4f91);}(_0x738f,0xb5));var _0xf738=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0x738f[_0x498334];return _0x13bb70;};'use strict';var Sequelize=require(_0xf738('0x0'));module[_0xf738('0x1')]={'name':{'type':Sequelize[_0xf738('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf738('0x2')]},'timeout':{'type':Sequelize[_0xf738('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf738('0x4')](_0xf738('0x5'),'beepall',_0xf738('0x6'))}}; \ No newline at end of file +var _0xb090=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x35a553,_0x26a6ec){var _0x1591b8=function(_0xa595a5){while(--_0xa595a5){_0x35a553['push'](_0x35a553['shift']());}};_0x1591b8(++_0x26a6ec);}(_0xb090,0xd9));var _0x0b09=function(_0x2215c8,_0x32ea49){_0x2215c8=_0x2215c8-0x0;var _0x2d8d10=_0xb090[_0x2215c8];return _0x2d8d10;};'use strict';var Sequelize=require(_0x0b09('0x0'));module[_0x0b09('0x1')]={'name':{'type':Sequelize[_0x0b09('0x2')],'unique':_0x0b09('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0b09('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0b09('0x4')](_0x0b09('0x5'),_0x0b09('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index fbd7cf1..6f826e3 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 _0x0757=['create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','findAll','ids','Agents','union','addAgents','penalty','removeAgents','removeTeams','omit','spread','emit','userChatQueue:save','isArray','userChatQueue:remove','getAgents','html-pdf','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','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','offset','limit','Content-Range','apply','save','update','destroy','then','get','ChatQueues','UserProfileResource','end','stack','name','send','index','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','key','field','options','count','includeAll','include','ChatQueue','rows','show','params','rawAttributes','find'];(function(_0x4f6f84,_0x31e197){var _0x20d989=function(_0x34db70){while(--_0x34db70){_0x4f6f84['push'](_0x4f6f84['shift']());}};_0x20d989(++_0x31e197);}(_0x0757,0x1a8));var _0x7075=function(_0x108d74,_0x8d3727){_0x108d74=_0x108d74-0x0;var _0x54ca93=_0x0757[_0x108d74];return _0x54ca93;};'use strict';var pdf=require(_0x7075('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7075('0x1'));var jsonpatch=require(_0x7075('0x2'));var rp=require(_0x7075('0x3'));var moment=require(_0x7075('0x4'));var BPromise=require(_0x7075('0x5'));var Mustache=require(_0x7075('0x6'));var util=require(_0x7075('0x7'));var path=require(_0x7075('0x8'));var sox=require(_0x7075('0x9'));var csv=require(_0x7075('0xa'));var ejs=require(_0x7075('0xb'));var fs=require('fs');var _=require(_0x7075('0xc'));var squel=require(_0x7075('0xd'));var crypto=require(_0x7075('0xe'));var jsforce=require(_0x7075('0xf'));var deskjs=require(_0x7075('0x10'));var toCsv=require(_0x7075('0xa'));var querystring=require(_0x7075('0x11'));var Papa=require(_0x7075('0x12'));var authService=require(_0x7075('0x13'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x7075('0x14'));var qs=require(_0x7075('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x7075('0x16'));var config=require(_0x7075('0x17'));var db=require(_0x7075('0x18'))['db'];config[_0x7075('0x19')]=_[_0x7075('0x1a')](config[_0x7075('0x19')],{'host':_0x7075('0x1b'),'port':0x18eb});var socket=require(_0x7075('0x1c'))(new Redis(config['redis']));require(_0x7075('0x1d'))[_0x7075('0x1e')](socket);var jayson=require(_0x7075('0x1f'));var client=jayson[_0x7075('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a893d,_0x22d831,_0x2168e5,_0xdc7ca6){return new BPromise(function(_0x342de4,_0x3a81a5){var _0x171df5=_0xdc7ca6||client;return _0x171df5[_0x7075('0x21')](_0x1a893d,_0x2168e5)['then'](function(_0x5d9335){logger[_0x7075('0x22')](_0x7075('0x23'),_0x22d831,_0x7075('0x24'));logger[_0x7075('0x25')](_0x7075('0x26'),_0x22d831,_0x7075('0x24'),JSON['stringify'](_0x5d9335));if(_0x5d9335[_0x7075('0x27')]){if(_0x5d9335['error'][_0x7075('0x28')]===0x1f4){logger[_0x7075('0x27')](_0x7075('0x23'),_0x22d831,_0x5d9335[_0x7075('0x27')][_0x7075('0x29')]);return _0x3a81a5(_0x5d9335[_0x7075('0x27')][_0x7075('0x29')]);}logger[_0x7075('0x27')](_0x7075('0x23'),_0x22d831,_0x5d9335[_0x7075('0x27')][_0x7075('0x29')]);return _0x342de4(_0x5d9335[_0x7075('0x27')][_0x7075('0x29')]);}else{logger[_0x7075('0x22')](_0x7075('0x23'),_0x22d831,'request\x20sent');_0x342de4(_0x5d9335['result'][_0x7075('0x29')]);}})[_0x7075('0x2a')](function(_0x35232c){logger['error'](_0x7075('0x23'),_0x22d831,_0x35232c);_0x3a81a5(_0x35232c);});});}function respondWithStatusCode(_0x180a40,_0x2a273f){_0x2a273f=_0x2a273f||0xcc;return function(_0x2ea1aa){if(_0x2ea1aa){return _0x180a40[_0x7075('0x2b')](_0x2a273f);}return _0x180a40['status'](_0x2a273f)['end']();};}function respondWithResult(_0x174c8f,_0x28ab15){_0x28ab15=_0x28ab15||0xc8;return function(_0x2284ae){if(_0x2284ae){return _0x174c8f[_0x7075('0x2c')](_0x28ab15)[_0x7075('0x2d')](_0x2284ae);}};}function respondWithFilteredResult(_0x56ad8b,_0x45fcb2){return function(_0xe13c85){if(_0xe13c85){var _0x183099=_0xe13c85['count'],_0x1b3e64=_0x45fcb2[_0x7075('0x2e')],_0x43dbe1=_0x45fcb2[_0x7075('0x2e')]+_0x45fcb2[_0x7075('0x2f')],_0x5726c9;if(_0x43dbe1>=_0x183099){_0x43dbe1=_0x183099;_0x5726c9=0xc8;}else{_0x5726c9=0xce;}_0x56ad8b['status'](_0x5726c9);return _0x56ad8b['set'](_0x7075('0x30'),_0x1b3e64+'-'+_0x43dbe1+'/'+_0x183099)[_0x7075('0x2d')](_0xe13c85);}return null;};}function patchUpdates(_0x34e44b){return function(_0x36871f){try{jsonpatch[_0x7075('0x31')](_0x36871f,_0x34e44b,!![]);}catch(_0x1dd698){return BPromise['reject'](_0x1dd698);}return _0x36871f[_0x7075('0x32')]();};}function saveUpdates(_0x3fa394,_0x5eff13){return function(_0x173dd1){if(_0x173dd1){return _0x173dd1[_0x7075('0x33')](_0x3fa394)['then'](function(_0x3efc16){return _0x3efc16;});}return null;};}function removeEntity(_0x1e0869,_0x59fd1a){return function(_0x1ce5f8){if(_0x1ce5f8){return _0x1ce5f8[_0x7075('0x34')]()[_0x7075('0x35')](function(){var _0x840a77=_0x1ce5f8[_0x7075('0x36')]({'plain':!![]});var _0x4aa512=_0x7075('0x37');return db[_0x7075('0x38')]['destroy']({'where':{'type':_0x4aa512,'resourceId':_0x840a77['id']}})['then'](function(){return _0x1ce5f8;});})[_0x7075('0x35')](function(){_0x1e0869['status'](0xcc)[_0x7075('0x39')]();});}};}function handleEntityNotFound(_0x3436e9,_0x3cb32d){return function(_0xadac01){if(!_0xadac01){_0x3436e9[_0x7075('0x2b')](0x194);}return _0xadac01;};}function handleError(_0x56ebd1,_0x5d8bc8){_0x5d8bc8=_0x5d8bc8||0x1f4;return function(_0x27dab6){logger[_0x7075('0x27')](_0x27dab6[_0x7075('0x3a')]);if(_0x27dab6[_0x7075('0x3b')]){delete _0x27dab6[_0x7075('0x3b')];}_0x56ebd1['status'](_0x5d8bc8)[_0x7075('0x3c')](_0x27dab6);};}exports[_0x7075('0x3d')]=function(_0x4502ef,_0x5b337e){var _0x4ab1ce={},_0x1cfaa7={},_0x451d9e={'count':0x0,'rows':[]};var _0xca8a1d=db['ChatQueue']['rawAttributes'];_0x1cfaa7[_0x7075('0x3e')]=_[_0x7075('0x3f')](_0xca8a1d);_0x1cfaa7[_0x7075('0x40')]=_[_0x7075('0x3f')](_0x4502ef[_0x7075('0x40')]);_0x1cfaa7[_0x7075('0x41')]=_[_0x7075('0x42')](_0x1cfaa7['model'],_0x1cfaa7[_0x7075('0x40')]);_0x4ab1ce[_0x7075('0x43')]=_[_0x7075('0x42')](_0x1cfaa7[_0x7075('0x3e')],qs[_0x7075('0x44')](_0x4502ef[_0x7075('0x40')][_0x7075('0x44')]));_0x4ab1ce[_0x7075('0x43')]=_0x4ab1ce[_0x7075('0x43')][_0x7075('0x45')]?_0x4ab1ce[_0x7075('0x43')]:_0x1cfaa7[_0x7075('0x3e')];if(!_0x4502ef[_0x7075('0x40')][_0x7075('0x46')](_0x7075('0x47'))){_0x4ab1ce[_0x7075('0x2f')]=qs['limit'](_0x4502ef[_0x7075('0x40')][_0x7075('0x2f')]);_0x4ab1ce[_0x7075('0x2e')]=qs[_0x7075('0x2e')](_0x4502ef[_0x7075('0x40')][_0x7075('0x2e')]);}_0x4ab1ce[_0x7075('0x48')]=qs[_0x7075('0x49')](_0x4502ef['query']['sort']);_0x4ab1ce['where']=qs[_0x7075('0x41')](_[_0x7075('0x4a')](_0x4502ef[_0x7075('0x40')],_0x1cfaa7[_0x7075('0x41')]));if(_0x4502ef[_0x7075('0x40')][_0x7075('0x4b')]){_0x4ab1ce[_0x7075('0x4c')]=_[_0x7075('0x4d')](_0x4ab1ce[_0x7075('0x4c')],{'$or':_[_0x7075('0x4e')](_0xca8a1d,function(_0x4281a2){if(_0x4281a2[_0x7075('0x4f')][_0x7075('0x50')]!=='VIRTUAL'){var _0x31ceb9={};_0x31ceb9[_0x4281a2[_0x7075('0x51')]]={'$like':'%'+_0x4502ef[_0x7075('0x40')][_0x7075('0x4b')]+'%'};return _0x31ceb9;}})});}_0x4ab1ce=_[_0x7075('0x4d')]({},_0x4ab1ce,_0x4502ef[_0x7075('0x52')]);var _0x38dac4={'where':_0x4ab1ce['where']};return db['ChatQueue'][_0x7075('0x53')](_0x38dac4)['then'](function(_0x55205f){_0x451d9e['count']=_0x55205f;if(_0x4502ef[_0x7075('0x40')][_0x7075('0x54')]){_0x4ab1ce[_0x7075('0x55')]=[{'all':!![]}];}return db[_0x7075('0x56')]['findAll'](_0x4ab1ce);})[_0x7075('0x35')](function(_0xb3e20d){_0x451d9e[_0x7075('0x57')]=_0xb3e20d;return _0x451d9e;})['then'](respondWithFilteredResult(_0x5b337e,_0x4ab1ce))[_0x7075('0x2a')](handleError(_0x5b337e,null));};exports[_0x7075('0x58')]=function(_0x2e57cc,_0x229cf8){var _0x4cb615={'raw':!![],'where':{'id':_0x2e57cc[_0x7075('0x59')]['id']}},_0x26b195={};_0x26b195[_0x7075('0x3e')]=_[_0x7075('0x3f')](db['ChatQueue'][_0x7075('0x5a')]);_0x26b195[_0x7075('0x40')]=_['keys'](_0x2e57cc['query']);_0x26b195[_0x7075('0x41')]=_['intersection'](_0x26b195['model'],_0x26b195[_0x7075('0x40')]);_0x4cb615[_0x7075('0x43')]=_['intersection'](_0x26b195['model'],qs[_0x7075('0x44')](_0x2e57cc[_0x7075('0x40')][_0x7075('0x44')]));_0x4cb615[_0x7075('0x43')]=_0x4cb615['attributes'][_0x7075('0x45')]?_0x4cb615[_0x7075('0x43')]:_0x26b195[_0x7075('0x3e')];if(_0x2e57cc[_0x7075('0x40')][_0x7075('0x54')]){_0x4cb615[_0x7075('0x55')]=[{'all':!![]}];}_0x4cb615=_[_0x7075('0x4d')]({},_0x4cb615,_0x2e57cc[_0x7075('0x52')]);return db[_0x7075('0x56')][_0x7075('0x5b')](_0x4cb615)['then'](handleEntityNotFound(_0x229cf8,null))[_0x7075('0x35')](respondWithResult(_0x229cf8,null))[_0x7075('0x2a')](handleError(_0x229cf8,null));};exports[_0x7075('0x5c')]=function(_0x1195ec,_0x299050){return db[_0x7075('0x56')][_0x7075('0x5c')](_0x1195ec[_0x7075('0x5d')],{})[_0x7075('0x35')](function(_0x5ea147){var _0x91c255=_0x1195ec[_0x7075('0x5e')]['get']({'plain':!![]});if(!_0x91c255)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x91c255['role']===_0x7075('0x5e')){var _0x2b32e5=_0x5ea147[_0x7075('0x36')]({'plain':!![]});var _0x4f50fb=_0x7075('0x37');return db[_0x7075('0x5f')][_0x7075('0x5b')]({'where':{'name':_0x4f50fb,'userProfileId':_0x91c255[_0x7075('0x60')]},'raw':!![]})[_0x7075('0x35')](function(_0x1509ef){if(_0x1509ef&&_0x1509ef['autoAssociation']===0x0){return db[_0x7075('0x38')][_0x7075('0x5c')]({'name':_0x2b32e5[_0x7075('0x3b')],'resourceId':_0x2b32e5['id'],'type':_0x1509ef[_0x7075('0x3b')],'sectionId':_0x1509ef['id']},{})[_0x7075('0x35')](function(){return _0x5ea147;});}else{return _0x5ea147;}})[_0x7075('0x2a')](function(_0x16c9f3){logger['error'](_0x7075('0x61'),_0x16c9f3);throw _0x16c9f3;});}return _0x5ea147;})[_0x7075('0x35')](respondWithResult(_0x299050,0xc9))[_0x7075('0x2a')](handleError(_0x299050,null));};exports[_0x7075('0x33')]=function(_0x4230a8,_0x3e6e69){if(_0x4230a8[_0x7075('0x5d')]['id']){delete _0x4230a8['body']['id'];}return db['ChatQueue'][_0x7075('0x5b')]({'where':{'id':_0x4230a8[_0x7075('0x59')]['id']}})[_0x7075('0x35')](handleEntityNotFound(_0x3e6e69,null))['then'](saveUpdates(_0x4230a8[_0x7075('0x5d')],null))[_0x7075('0x35')](respondWithResult(_0x3e6e69,null))['catch'](handleError(_0x3e6e69,null));};exports['destroy']=function(_0x515cce,_0x409ba7){return db[_0x7075('0x56')][_0x7075('0x5b')]({'where':{'id':_0x515cce[_0x7075('0x59')]['id']}})[_0x7075('0x35')](handleEntityNotFound(_0x409ba7,null))[_0x7075('0x35')](removeEntity(_0x409ba7,null))[_0x7075('0x2a')](handleError(_0x409ba7,null));};exports['describe']=function(_0x374081,_0x1a1da0){return db[_0x7075('0x56')][_0x7075('0x62')]()[_0x7075('0x35')](respondWithResult(_0x1a1da0,null))['catch'](handleError(_0x1a1da0,null));};exports['getMembers']=function(_0x365dfd,_0x1762a7,_0x284df0){var _0x1a68fa={'raw':!![],'where':{}},_0x57d436={},_0x54410f;return db[_0x7075('0x56')]['findOne']({'where':{'id':_0x365dfd[_0x7075('0x59')]['id']}})[_0x7075('0x35')](handleEntityNotFound(_0x1762a7,null))[_0x7075('0x35')](function(_0x500c24){if(_0x500c24){_0x54410f=_0x500c24[_0x7075('0x36')]({'plain':!![]});_0x57d436[_0x7075('0x3e')]=_['keys'](db[_0x7075('0x63')][_0x7075('0x5a')]);_0x57d436[_0x7075('0x40')]=_['keys'](_0x365dfd[_0x7075('0x40')]);_0x57d436[_0x7075('0x41')]=_['intersection'](_0x57d436[_0x7075('0x3e')],_0x57d436[_0x7075('0x40')]);_0x1a68fa[_0x7075('0x43')]=_[_0x7075('0x42')](_0x57d436[_0x7075('0x3e')],qs['fields'](_0x365dfd[_0x7075('0x40')][_0x7075('0x44')]));_0x1a68fa[_0x7075('0x43')]=_0x1a68fa[_0x7075('0x43')][_0x7075('0x45')]?_0x1a68fa[_0x7075('0x43')]:_0x57d436['model'];if(!_0x365dfd[_0x7075('0x40')][_0x7075('0x46')](_0x7075('0x47'))){_0x1a68fa[_0x7075('0x2f')]=qs['limit'](_0x365dfd[_0x7075('0x40')][_0x7075('0x2f')]);_0x1a68fa['offset']=qs[_0x7075('0x2e')](_0x365dfd[_0x7075('0x40')][_0x7075('0x2e')]);}_0x1a68fa[_0x7075('0x48')]=qs['sort'](_0x365dfd[_0x7075('0x40')]['sort']);_0x1a68fa[_0x7075('0x4c')]=qs[_0x7075('0x41')](_[_0x7075('0x4a')](_0x365dfd['query'],_0x57d436['filters']));_0x1a68fa[_0x7075('0x4c')][_0x7075('0x64')]=_0x500c24['id'];if(_0x365dfd['query']['filter']){_0x1a68fa[_0x7075('0x4c')]=_[_0x7075('0x4d')](_0x1a68fa[_0x7075('0x4c')],{'$or':_[_0x7075('0x4e')](_0x1a68fa[_0x7075('0x43')],function(_0xe992db){var _0x5d67b2={};_0x5d67b2[_0xe992db]={'$like':'%'+_0x365dfd['query'][_0x7075('0x4b')]+'%'};return _0x5d67b2;})});}_0x1a68fa=_[_0x7075('0x4d')]({},_0x1a68fa,_0x365dfd[_0x7075('0x52')]);return db[_0x7075('0x63')]['findAll'](_0x1a68fa);}})[_0x7075('0x35')](function(_0x55c51c){if(_0x55c51c){return db[_0x7075('0x65')][_0x7075('0x66')]({'where':{'id':_[_0x7075('0x4e')](_0x55c51c,_0x7075('0x67')),'role':'agent'},'attributes':['id','name',_0x7075('0x68'),_0x7075('0x69'),_0x7075('0x6a')]});}})[_0x7075('0x35')](function(_0x1c8d41){if(_0x1c8d41){return{'count':_0x1c8d41[_0x7075('0x53')],'rows':_[_0x7075('0x4e')](_0x1c8d41[_0x7075('0x57')],function(_0xe7d8d2){return{'membername':_0xe7d8d2[_0x7075('0x3b')],'UserId':_0xe7d8d2['id'],'queue_name':_0x54410f[_0x7075('0x3b')],'ChatQueueId':_0x54410f['id'],'interface':util[_0x7075('0x6b')](_0x7075('0x6c'),_0x7075('0x6d'),_0xe7d8d2[_0x7075('0x3b')]),'penalty':0x0,'paused':_0xe7d8d2[_0x7075('0x68')],'createdAt':_0xe7d8d2['createdAt'],'updatedAt':_0xe7d8d2[_0x7075('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1762a7,_0x1a68fa))[_0x7075('0x2a')](handleError(_0x1762a7,null));};exports[_0x7075('0x6e')]=function(_0x2a694d,_0x17d9d1,_0x49eb08){var _0x25561d={};var _0xcef145={};var _0x477611;var _0x34d485;return db['ChatQueue'][_0x7075('0x6f')]({'where':{'id':_0x2a694d['params']['id']}})['then'](handleEntityNotFound(_0x17d9d1,null))[_0x7075('0x35')](function(_0x45dc17){if(_0x45dc17){_0x477611=_0x45dc17;_0xcef145[_0x7075('0x3e')]=_[_0x7075('0x3f')](db[_0x7075('0x70')]['rawAttributes']);_0xcef145[_0x7075('0x40')]=_[_0x7075('0x3f')](_0x2a694d[_0x7075('0x40')]);_0xcef145[_0x7075('0x41')]=_[_0x7075('0x42')](_0xcef145[_0x7075('0x3e')],_0xcef145[_0x7075('0x40')]);_0x25561d[_0x7075('0x43')]=_['intersection'](_0xcef145[_0x7075('0x3e')],qs[_0x7075('0x44')](_0x2a694d[_0x7075('0x40')][_0x7075('0x44')]));_0x25561d[_0x7075('0x43')]=_0x25561d[_0x7075('0x43')]['length']?_0x25561d[_0x7075('0x43')]:_0xcef145[_0x7075('0x3e')];_0x25561d[_0x7075('0x48')]=qs['sort'](_0x2a694d[_0x7075('0x40')]['sort']);_0x25561d[_0x7075('0x4c')]=qs[_0x7075('0x41')](_[_0x7075('0x4a')](_0x2a694d[_0x7075('0x40')],_0xcef145[_0x7075('0x41')]));if(_0x2a694d['query'][_0x7075('0x4b')]){_0x25561d[_0x7075('0x4c')]=_['merge'](_0x25561d['where'],{'$or':_[_0x7075('0x4e')](_0x25561d[_0x7075('0x43')],function(_0x448229){var _0x55d7af={};_0x55d7af[_0x448229]={'$like':'%'+_0x2a694d[_0x7075('0x40')][_0x7075('0x4b')]+'%'};return _0x55d7af;})});}_0x25561d=_['merge']({},_0x25561d,_0x2a694d[_0x7075('0x52')]);return _0x477611[_0x7075('0x6e')](_0x25561d);}})['then'](function(_0x3eb51d){if(_0x3eb51d){_0x34d485=_0x3eb51d[_0x7075('0x45')];if(!_0x2a694d[_0x7075('0x40')]['hasOwnProperty'](_0x7075('0x47'))){_0x25561d[_0x7075('0x2f')]=qs[_0x7075('0x2f')](_0x2a694d['query'][_0x7075('0x2f')]);_0x25561d['offset']=qs[_0x7075('0x2e')](_0x2a694d[_0x7075('0x40')]['offset']);}return _0x477611[_0x7075('0x6e')](_0x25561d);}})[_0x7075('0x35')](function(_0x1fb8be){if(_0x1fb8be){return _0x1fb8be?{'count':_0x34d485,'rows':_0x1fb8be}:null;}})[_0x7075('0x35')](respondWithResult(_0x17d9d1,null))[_0x7075('0x2a')](handleError(_0x17d9d1,null));};exports[_0x7075('0x71')]=function(_0x9df17d,_0x5590a4,_0x9cec23){var _0x51f2b1=[];var _0xab6e23;return db[_0x7075('0x70')][_0x7075('0x72')]({'where':{'id':_0x9df17d[_0x7075('0x5d')][_0x7075('0x73')]},'attributes':['id'],'include':[{'model':db[_0x7075('0x65')],'as':_0x7075('0x74'),'attributes':['id'],'raw':!![]}]})[_0x7075('0x35')](function(_0x1e95be){if(_0x1e95be){for(var _0x55e304=0x0;_0x55e304<_0x1e95be[_0x7075('0x45')];_0x55e304+=0x1){for(var _0x57e782=0x0;_0x57e782<_0x1e95be[_0x55e304][_0x7075('0x74')][_0x7075('0x45')];_0x57e782+=0x1){_0x51f2b1=_[_0x7075('0x75')](_0x51f2b1,[_0x1e95be[_0x55e304][_0x7075('0x74')][_0x57e782]['id']]);}}return _0x51f2b1;}})[_0x7075('0x35')](function(_0x89ea88){if(_0x89ea88){return db[_0x7075('0x56')][_0x7075('0x5b')]({'where':{'id':_0x9df17d['params']['id']}});}})[_0x7075('0x35')](function(_0x26bf48){if(_0x26bf48){_0xab6e23=_0x26bf48;return _0xab6e23[_0x7075('0x76')](_0x51f2b1,{'penalty':_0x9df17d['body'][_0x7075('0x77')]});}})['then'](function(_0x5af940){if(_0x5af940){return _0xab6e23[_0x7075('0x71')](_0x9df17d[_0x7075('0x5d')][_0x7075('0x73')]);}})[_0x7075('0x35')](handleEntityNotFound(_0x5590a4,null))[_0x7075('0x35')](respondWithStatusCode(_0x5590a4,null))['catch'](handleError(_0x5590a4,null));};exports['removeTeams']=function(_0x44d23d,_0x1d0e92,_0x1eb3a2){var _0xf0fcec=[];var _0x2b5b60;return db['Team'][_0x7075('0x72')]({'where':{'id':_0x44d23d['query'][_0x7075('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7075('0x74'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x507088){if(_0x507088){for(var _0x2d419d=0x0;_0x2d419d<_0x507088[_0x7075('0x45')];_0x2d419d+=0x1){for(var _0x55b8a0=0x0;_0x55b8a0<_0x507088[_0x2d419d][_0x7075('0x74')][_0x7075('0x45')];_0x55b8a0+=0x1){_0xf0fcec=_[_0x7075('0x75')](_0xf0fcec,[_0x507088[_0x2d419d][_0x7075('0x74')][_0x55b8a0]['id']]);}}return _0xf0fcec;}})[_0x7075('0x35')](function(_0x5557fc){if(_0x5557fc){return db[_0x7075('0x56')][_0x7075('0x5b')]({'where':{'id':_0x44d23d[_0x7075('0x59')]['id']}});}})[_0x7075('0x35')](function(_0x3887ce){if(_0x3887ce){_0x2b5b60=_0x3887ce;return _0x2b5b60[_0x7075('0x78')](_0xf0fcec);}})['then'](function(_0x54c2b2){if(_0x2b5b60){return _0x2b5b60[_0x7075('0x79')](_0x44d23d[_0x7075('0x40')][_0x7075('0x73')]);}})[_0x7075('0x35')](handleEntityNotFound(_0x1d0e92,null))[_0x7075('0x35')](respondWithStatusCode(_0x1d0e92,null))[_0x7075('0x2a')](handleError(_0x1d0e92,null));};exports['addAgents']=function(_0x51c674,_0x4a3bd5,_0x3c79e9){return db[_0x7075('0x56')]['find']({'where':{'id':_0x51c674['params']['id']}})[_0x7075('0x35')](handleEntityNotFound(_0x4a3bd5,null))['then'](function(_0x43f846){if(_0x43f846){return _0x43f846['addAgents'](_0x51c674['body'][_0x7075('0x73')],_[_0x7075('0x7a')](_0x51c674[_0x7075('0x5d')],['ids','id'])||{})[_0x7075('0x7b')](function(_0x52ed14){for(var _0x21dd5f=0x0;_0x21dd5f<_0x51c674[_0x7075('0x5d')][_0x7075('0x73')][_0x7075('0x45')];_0x21dd5f+=0x1){socket[_0x7075('0x7c')](_0x7075('0x7d'),{'UserId':_0x51c674[_0x7075('0x5d')]['ids'][_0x21dd5f],'ChatQueueId':_0x51c674[_0x7075('0x59')]['id']});}return _0x52ed14;});}})['then'](respondWithResult(_0x4a3bd5,null))[_0x7075('0x2a')](handleError(_0x4a3bd5,null));};exports[_0x7075('0x78')]=function(_0x2fef88,_0x153848,_0x2d1be8){var _0xc1c8bb;return db[_0x7075('0x56')]['find']({'where':{'id':_0x2fef88[_0x7075('0x59')]['id']}})[_0x7075('0x35')](handleEntityNotFound(_0x153848,null))[_0x7075('0x35')](function(_0x36d8e1){if(_0x36d8e1){return _0x36d8e1[_0x7075('0x78')](_0x2fef88['query'][_0x7075('0x73')])[_0x7075('0x35')](function(_0x40e7f7){if(_[_0x7075('0x7e')](_0x2fef88[_0x7075('0x40')]['ids'])){for(var _0x38ced9=0x0;_0x38ced9<_0x2fef88['query']['ids'][_0x7075('0x45')];_0x38ced9+=0x1){socket['emit'](_0x7075('0x7f'),{'UserId':_0x2fef88[_0x7075('0x40')][_0x7075('0x73')][_0x38ced9],'ChatQueueId':_0x2fef88[_0x7075('0x59')]['id']});}}else{socket['emit'](_0x7075('0x7f'),{'UserId':_0x2fef88[_0x7075('0x40')][_0x7075('0x73')],'ChatQueueId':_0x2fef88[_0x7075('0x59')]['id']});}});}})['then'](respondWithStatusCode(_0x153848,null))[_0x7075('0x2a')](handleError(_0x153848,null));};exports['getAgents']=function(_0x2b309b,_0x5e81aa,_0x420a12){var _0x5dee3f={};var _0xde6200={};var _0x416de9;var _0x766bca;return db['ChatQueue']['findOne']({'where':{'id':_0x2b309b['params']['id']}})['then'](handleEntityNotFound(_0x5e81aa,null))[_0x7075('0x35')](function(_0x1edf9b){if(_0x1edf9b){_0x416de9=_0x1edf9b;_0xde6200[_0x7075('0x3e')]=_[_0x7075('0x3f')](db[_0x7075('0x65')][_0x7075('0x5a')]);_0xde6200['query']=_[_0x7075('0x3f')](_0x2b309b['query']);_0xde6200[_0x7075('0x41')]=_['intersection'](_0xde6200['model'],_0xde6200[_0x7075('0x40')]);_0x5dee3f[_0x7075('0x43')]=_['intersection'](_0xde6200[_0x7075('0x3e')],qs['fields'](_0x2b309b['query'][_0x7075('0x44')]));_0x5dee3f[_0x7075('0x43')]=_0x5dee3f[_0x7075('0x43')][_0x7075('0x45')]?_0x5dee3f['attributes']:_0xde6200[_0x7075('0x3e')];_0x5dee3f[_0x7075('0x48')]=qs[_0x7075('0x49')](_0x2b309b['query']['sort']);_0x5dee3f[_0x7075('0x4c')]=qs[_0x7075('0x41')](_[_0x7075('0x4a')](_0x2b309b[_0x7075('0x40')],_0xde6200[_0x7075('0x41')]));if(_0x2b309b[_0x7075('0x40')][_0x7075('0x4b')]){_0x5dee3f[_0x7075('0x4c')]=_[_0x7075('0x4d')](_0x5dee3f[_0x7075('0x4c')],{'$or':_[_0x7075('0x4e')](_0x5dee3f[_0x7075('0x43')],function(_0x595b81){var _0x3f4815={};_0x3f4815[_0x595b81]={'$like':'%'+_0x2b309b[_0x7075('0x40')][_0x7075('0x4b')]+'%'};return _0x3f4815;})});}_0x5dee3f=_[_0x7075('0x4d')]({},_0x5dee3f,_0x2b309b['options']);return _0x416de9['getAgents'](_0x5dee3f);}})[_0x7075('0x35')](function(_0x8f6354){if(_0x8f6354){_0x766bca=_0x8f6354[_0x7075('0x45')];if(!_0x2b309b[_0x7075('0x40')][_0x7075('0x46')](_0x7075('0x47'))){_0x5dee3f[_0x7075('0x2f')]=qs[_0x7075('0x2f')](_0x2b309b['query'][_0x7075('0x2f')]);_0x5dee3f[_0x7075('0x2e')]=qs['offset'](_0x2b309b[_0x7075('0x40')][_0x7075('0x2e')]);}return _0x416de9[_0x7075('0x80')](_0x5dee3f);}})[_0x7075('0x35')](function(_0x4ed7cd){if(_0x4ed7cd){return _0x4ed7cd?{'count':_0x766bca,'rows':_0x4ed7cd}:null;}})[_0x7075('0x35')](respondWithResult(_0x5e81aa,null))[_0x7075('0x2a')](handleError(_0x5e81aa,null));}; \ No newline at end of file +var _0x7729=['../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','update','destroy','get','ChatQueues','UserProfileResource','name','index','ChatQueue','rawAttributes','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','field','merge','count','includeAll','include','findAll','rows','params','length','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','addAgents','penalty','addTeams','removeTeams','emit','userChatQueue:save','removeAgents','isArray','userChatQueue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','ioredis'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7729,0x66));var _0x9772=function(_0x3d6030,_0x20d669){_0x3d6030=_0x3d6030-0x0;var _0xa1f111=_0x7729[_0x3d6030];return _0xa1f111;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9772('0x0'));var zipdir=require(_0x9772('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9772('0x2'));var moment=require(_0x9772('0x3'));var BPromise=require(_0x9772('0x4'));var Mustache=require(_0x9772('0x5'));var util=require(_0x9772('0x6'));var path=require(_0x9772('0x7'));var sox=require(_0x9772('0x8'));var csv=require(_0x9772('0x9'));var ejs=require(_0x9772('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9772('0xb'));var crypto=require(_0x9772('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9772('0xd'));var toCsv=require(_0x9772('0x9'));var querystring=require(_0x9772('0xe'));var Papa=require(_0x9772('0xf'));var authService=require(_0x9772('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x9772('0x11'));var qs=require(_0x9772('0x12'));var logger=require('../../config/logger')(_0x9772('0x13'));var utils=require(_0x9772('0x14'));var config=require(_0x9772('0x15'));var db=require(_0x9772('0x16'))['db'];config[_0x9772('0x17')]=_[_0x9772('0x18')](config[_0x9772('0x17')],{'host':_0x9772('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x9772('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9772('0x1b')][_0x9772('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x288095,_0x1565fd,_0x5d1ffc,_0x58f92d){return new BPromise(function(_0x1e837b,_0x5eda84){var _0x261b18=_0x58f92d||client;return _0x261b18[_0x9772('0x1d')](_0x288095,_0x5d1ffc)[_0x9772('0x1e')](function(_0x3656e4){logger[_0x9772('0x1f')](_0x9772('0x20'),_0x1565fd,'request\x20sent');logger['debug'](_0x9772('0x21'),_0x1565fd,_0x9772('0x22'),JSON[_0x9772('0x23')](_0x3656e4));if(_0x3656e4[_0x9772('0x24')]){if(_0x3656e4[_0x9772('0x24')][_0x9772('0x25')]===0x1f4){logger[_0x9772('0x24')](_0x9772('0x20'),_0x1565fd,_0x3656e4[_0x9772('0x24')][_0x9772('0x26')]);return _0x5eda84(_0x3656e4[_0x9772('0x24')]['message']);}logger[_0x9772('0x24')](_0x9772('0x20'),_0x1565fd,_0x3656e4['error'][_0x9772('0x26')]);return _0x1e837b(_0x3656e4['error'][_0x9772('0x26')]);}else{logger['info'](_0x9772('0x20'),_0x1565fd,_0x9772('0x22'));_0x1e837b(_0x3656e4['result']['message']);}})[_0x9772('0x27')](function(_0x572060){logger[_0x9772('0x24')](_0x9772('0x20'),_0x1565fd,_0x572060);_0x5eda84(_0x572060);});});}function respondWithStatusCode(_0x6431eb,_0x4f8c8f){_0x4f8c8f=_0x4f8c8f||0xcc;return function(_0x3f7af6){if(_0x3f7af6){return _0x6431eb[_0x9772('0x28')](_0x4f8c8f);}return _0x6431eb[_0x9772('0x29')](_0x4f8c8f)[_0x9772('0x2a')]();};}function respondWithResult(_0xc57761,_0x248f3d){_0x248f3d=_0x248f3d||0xc8;return function(_0xd1d616){if(_0xd1d616){return _0xc57761['status'](_0x248f3d)['json'](_0xd1d616);}};}function respondWithFilteredResult(_0x10ab50,_0x1ffc1b){return function(_0x32239c){if(_0x32239c){var _0x5bb49a=_0x32239c['count'],_0x4d40fb=_0x1ffc1b[_0x9772('0x2b')],_0x512af3=_0x1ffc1b[_0x9772('0x2b')]+_0x1ffc1b[_0x9772('0x2c')],_0x4003e9;if(_0x512af3>=_0x5bb49a){_0x512af3=_0x5bb49a;_0x4003e9=0xc8;}else{_0x4003e9=0xce;}_0x10ab50['status'](_0x4003e9);return _0x10ab50['set'](_0x9772('0x2d'),_0x4d40fb+'-'+_0x512af3+'/'+_0x5bb49a)[_0x9772('0x2e')](_0x32239c);}return null;};}function patchUpdates(_0x4de186){return function(_0x408b41){try{jsonpatch[_0x9772('0x2f')](_0x408b41,_0x4de186,!![]);}catch(_0x1d6768){return BPromise[_0x9772('0x30')](_0x1d6768);}return _0x408b41['save']();};}function saveUpdates(_0x3a9189,_0x1a34f5){return function(_0x322e36){if(_0x322e36){return _0x322e36[_0x9772('0x31')](_0x3a9189)['then'](function(_0xe7fb29){return _0xe7fb29;});}return null;};}function removeEntity(_0x5ab25f,_0x112e83){return function(_0x41d929){if(_0x41d929){return _0x41d929[_0x9772('0x32')]()[_0x9772('0x1e')](function(){var _0x43bec6=_0x41d929[_0x9772('0x33')]({'plain':!![]});var _0x4c9105=_0x9772('0x34');return db[_0x9772('0x35')][_0x9772('0x32')]({'where':{'type':_0x4c9105,'resourceId':_0x43bec6['id']}})[_0x9772('0x1e')](function(){return _0x41d929;});})[_0x9772('0x1e')](function(){_0x5ab25f[_0x9772('0x29')](0xcc)[_0x9772('0x2a')]();});}};}function handleEntityNotFound(_0x1a0ab2,_0x8ead65){return function(_0x21856c){if(!_0x21856c){_0x1a0ab2['sendStatus'](0x194);}return _0x21856c;};}function handleError(_0x462f9e,_0x59878a){_0x59878a=_0x59878a||0x1f4;return function(_0x8a39a7){logger['error'](_0x8a39a7['stack']);if(_0x8a39a7[_0x9772('0x36')]){delete _0x8a39a7[_0x9772('0x36')];}_0x462f9e[_0x9772('0x29')](_0x59878a)['send'](_0x8a39a7);};}exports[_0x9772('0x37')]=function(_0x4c291b,_0x92a11d){var _0x2be59e={},_0x47206f={},_0x349904={'count':0x0,'rows':[]};var _0xa46c07=db[_0x9772('0x38')][_0x9772('0x39')];_0x47206f[_0x9772('0x3a')]=_[_0x9772('0x3b')](_0xa46c07);_0x47206f['query']=_[_0x9772('0x3b')](_0x4c291b['query']);_0x47206f[_0x9772('0x3c')]=_[_0x9772('0x3d')](_0x47206f[_0x9772('0x3a')],_0x47206f[_0x9772('0x3e')]);_0x2be59e[_0x9772('0x3f')]=_['intersection'](_0x47206f[_0x9772('0x3a')],qs['fields'](_0x4c291b[_0x9772('0x3e')][_0x9772('0x40')]));_0x2be59e[_0x9772('0x3f')]=_0x2be59e[_0x9772('0x3f')]['length']?_0x2be59e[_0x9772('0x3f')]:_0x47206f['model'];if(!_0x4c291b[_0x9772('0x3e')][_0x9772('0x41')](_0x9772('0x42'))){_0x2be59e['limit']=qs[_0x9772('0x2c')](_0x4c291b[_0x9772('0x3e')][_0x9772('0x2c')]);_0x2be59e[_0x9772('0x2b')]=qs[_0x9772('0x2b')](_0x4c291b[_0x9772('0x3e')][_0x9772('0x2b')]);}_0x2be59e[_0x9772('0x43')]=qs[_0x9772('0x44')](_0x4c291b['query'][_0x9772('0x44')]);_0x2be59e[_0x9772('0x45')]=qs[_0x9772('0x3c')](_[_0x9772('0x46')](_0x4c291b['query'],_0x47206f['filters']));if(_0x4c291b[_0x9772('0x3e')][_0x9772('0x47')]){_0x2be59e[_0x9772('0x45')]=_['merge'](_0x2be59e[_0x9772('0x45')],{'$or':_[_0x9772('0x48')](_0xa46c07,function(_0x1fd952){if(_0x1fd952[_0x9772('0x49')]['key']!=='VIRTUAL'){var _0xe9a838={};_0xe9a838[_0x1fd952[_0x9772('0x4a')]]={'$like':'%'+_0x4c291b['query']['filter']+'%'};return _0xe9a838;}})});}_0x2be59e=_[_0x9772('0x4b')]({},_0x2be59e,_0x4c291b['options']);var _0x54cca8={'where':_0x2be59e[_0x9772('0x45')]};return db['ChatQueue'][_0x9772('0x4c')](_0x54cca8)[_0x9772('0x1e')](function(_0x54fddc){_0x349904[_0x9772('0x4c')]=_0x54fddc;if(_0x4c291b[_0x9772('0x3e')][_0x9772('0x4d')]){_0x2be59e[_0x9772('0x4e')]=[{'all':!![]}];}return db[_0x9772('0x38')][_0x9772('0x4f')](_0x2be59e);})[_0x9772('0x1e')](function(_0x376b10){_0x349904[_0x9772('0x50')]=_0x376b10;return _0x349904;})['then'](respondWithFilteredResult(_0x92a11d,_0x2be59e))[_0x9772('0x27')](handleError(_0x92a11d,null));};exports['show']=function(_0x1b274e,_0x13cad8){var _0x226707={'raw':!![],'where':{'id':_0x1b274e[_0x9772('0x51')]['id']}},_0x54d2ea={};_0x54d2ea[_0x9772('0x3a')]=_[_0x9772('0x3b')](db[_0x9772('0x38')][_0x9772('0x39')]);_0x54d2ea[_0x9772('0x3e')]=_['keys'](_0x1b274e[_0x9772('0x3e')]);_0x54d2ea[_0x9772('0x3c')]=_[_0x9772('0x3d')](_0x54d2ea[_0x9772('0x3a')],_0x54d2ea['query']);_0x226707[_0x9772('0x3f')]=_['intersection'](_0x54d2ea['model'],qs[_0x9772('0x40')](_0x1b274e[_0x9772('0x3e')][_0x9772('0x40')]));_0x226707[_0x9772('0x3f')]=_0x226707[_0x9772('0x3f')][_0x9772('0x52')]?_0x226707['attributes']:_0x54d2ea[_0x9772('0x3a')];if(_0x1b274e['query'][_0x9772('0x4d')]){_0x226707['include']=[{'all':!![]}];}_0x226707=_[_0x9772('0x4b')]({},_0x226707,_0x1b274e[_0x9772('0x53')]);return db[_0x9772('0x38')]['find'](_0x226707)[_0x9772('0x1e')](handleEntityNotFound(_0x13cad8,null))[_0x9772('0x1e')](respondWithResult(_0x13cad8,null))[_0x9772('0x27')](handleError(_0x13cad8,null));};exports['create']=function(_0x2c113f,_0x299564){return db[_0x9772('0x38')][_0x9772('0x54')](_0x2c113f['body'],{})[_0x9772('0x1e')](function(_0x542519){var _0x4a78f5=_0x2c113f[_0x9772('0x55')][_0x9772('0x33')]({'plain':!![]});if(!_0x4a78f5)throw new Error(_0x9772('0x56'));if(_0x4a78f5[_0x9772('0x57')]==='user'){var _0x2ec40b=_0x542519[_0x9772('0x33')]({'plain':!![]});var _0x43a2b1=_0x9772('0x34');return db[_0x9772('0x58')][_0x9772('0x59')]({'where':{'name':_0x43a2b1,'userProfileId':_0x4a78f5[_0x9772('0x5a')]},'raw':!![]})[_0x9772('0x1e')](function(_0x113e8a){if(_0x113e8a&&_0x113e8a['autoAssociation']===0x0){return db[_0x9772('0x35')][_0x9772('0x54')]({'name':_0x2ec40b[_0x9772('0x36')],'resourceId':_0x2ec40b['id'],'type':_0x113e8a[_0x9772('0x36')],'sectionId':_0x113e8a['id']},{})[_0x9772('0x1e')](function(){return _0x542519;});}else{return _0x542519;}})['catch'](function(_0x2f4e4a){logger[_0x9772('0x24')](_0x9772('0x5b'),_0x2f4e4a);throw _0x2f4e4a;});}return _0x542519;})[_0x9772('0x1e')](respondWithResult(_0x299564,0xc9))[_0x9772('0x27')](handleError(_0x299564,null));};exports['update']=function(_0x4d9eea,_0x58e104){if(_0x4d9eea[_0x9772('0x5c')]['id']){delete _0x4d9eea[_0x9772('0x5c')]['id'];}return db[_0x9772('0x38')][_0x9772('0x59')]({'where':{'id':_0x4d9eea['params']['id']}})[_0x9772('0x1e')](handleEntityNotFound(_0x58e104,null))['then'](saveUpdates(_0x4d9eea[_0x9772('0x5c')],null))['then'](respondWithResult(_0x58e104,null))[_0x9772('0x27')](handleError(_0x58e104,null));};exports[_0x9772('0x32')]=function(_0x471d78,_0x16ac78){return db['ChatQueue'][_0x9772('0x59')]({'where':{'id':_0x471d78[_0x9772('0x51')]['id']}})[_0x9772('0x1e')](handleEntityNotFound(_0x16ac78,null))[_0x9772('0x1e')](removeEntity(_0x16ac78,null))[_0x9772('0x27')](handleError(_0x16ac78,null));};exports['describe']=function(_0x2ae103,_0x1cbf3a){return db[_0x9772('0x38')][_0x9772('0x5d')]()['then'](respondWithResult(_0x1cbf3a,null))[_0x9772('0x27')](handleError(_0x1cbf3a,null));};exports[_0x9772('0x5e')]=function(_0x2f878b,_0x27a0ed,_0x2b7716){var _0x1bc436={'raw':!![],'where':{}},_0x17ee60={},_0x262fb0;return db[_0x9772('0x38')][_0x9772('0x5f')]({'where':{'id':_0x2f878b[_0x9772('0x51')]['id']}})[_0x9772('0x1e')](handleEntityNotFound(_0x27a0ed,null))[_0x9772('0x1e')](function(_0x4ba6a4){if(_0x4ba6a4){_0x262fb0=_0x4ba6a4[_0x9772('0x33')]({'plain':!![]});_0x17ee60[_0x9772('0x3a')]=_[_0x9772('0x3b')](db[_0x9772('0x60')][_0x9772('0x39')]);_0x17ee60['query']=_[_0x9772('0x3b')](_0x2f878b[_0x9772('0x3e')]);_0x17ee60[_0x9772('0x3c')]=_[_0x9772('0x3d')](_0x17ee60['model'],_0x17ee60[_0x9772('0x3e')]);_0x1bc436[_0x9772('0x3f')]=_[_0x9772('0x3d')](_0x17ee60['model'],qs['fields'](_0x2f878b[_0x9772('0x3e')][_0x9772('0x40')]));_0x1bc436[_0x9772('0x3f')]=_0x1bc436[_0x9772('0x3f')][_0x9772('0x52')]?_0x1bc436[_0x9772('0x3f')]:_0x17ee60[_0x9772('0x3a')];if(!_0x2f878b[_0x9772('0x3e')][_0x9772('0x41')](_0x9772('0x42'))){_0x1bc436[_0x9772('0x2c')]=qs['limit'](_0x2f878b[_0x9772('0x3e')][_0x9772('0x2c')]);_0x1bc436[_0x9772('0x2b')]=qs[_0x9772('0x2b')](_0x2f878b[_0x9772('0x3e')][_0x9772('0x2b')]);}_0x1bc436[_0x9772('0x43')]=qs['sort'](_0x2f878b[_0x9772('0x3e')][_0x9772('0x44')]);_0x1bc436[_0x9772('0x45')]=qs['filters'](_['pick'](_0x2f878b[_0x9772('0x3e')],_0x17ee60[_0x9772('0x3c')]));_0x1bc436[_0x9772('0x45')][_0x9772('0x61')]=_0x4ba6a4['id'];if(_0x2f878b[_0x9772('0x3e')][_0x9772('0x47')]){_0x1bc436[_0x9772('0x45')]=_[_0x9772('0x4b')](_0x1bc436[_0x9772('0x45')],{'$or':_[_0x9772('0x48')](_0x1bc436[_0x9772('0x3f')],function(_0x4800af){var _0x3f50a1={};_0x3f50a1[_0x4800af]={'$like':'%'+_0x2f878b[_0x9772('0x3e')]['filter']+'%'};return _0x3f50a1;})});}_0x1bc436=_[_0x9772('0x4b')]({},_0x1bc436,_0x2f878b[_0x9772('0x53')]);return db[_0x9772('0x60')][_0x9772('0x4f')](_0x1bc436);}})[_0x9772('0x1e')](function(_0x11d0b1){if(_0x11d0b1){return db[_0x9772('0x62')][_0x9772('0x63')]({'where':{'id':_[_0x9772('0x48')](_0x11d0b1,'UserId'),'role':_0x9772('0x64')},'attributes':['id','name','chatPause',_0x9772('0x65'),_0x9772('0x66')]});}})['then'](function(_0x5c02fc){if(_0x5c02fc){return{'count':_0x5c02fc[_0x9772('0x4c')],'rows':_[_0x9772('0x48')](_0x5c02fc[_0x9772('0x50')],function(_0x156638){return{'membername':_0x156638[_0x9772('0x36')],'UserId':_0x156638['id'],'queue_name':_0x262fb0[_0x9772('0x36')],'ChatQueueId':_0x262fb0['id'],'interface':util[_0x9772('0x67')](_0x9772('0x68'),_0x9772('0x69'),_0x156638[_0x9772('0x36')]),'penalty':0x0,'paused':_0x156638['chatPause'],'createdAt':_0x156638[_0x9772('0x66')],'updatedAt':_0x156638['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9772('0x1e')](respondWithFilteredResult(_0x27a0ed,_0x1bc436))['catch'](handleError(_0x27a0ed,null));};exports[_0x9772('0x6a')]=function(_0x4f00e6,_0x3b9183,_0x9a51df){var _0x4efcf7={};var _0x54025e={};var _0xf0a9a0;var _0x539319;return db[_0x9772('0x38')][_0x9772('0x5f')]({'where':{'id':_0x4f00e6['params']['id']}})[_0x9772('0x1e')](handleEntityNotFound(_0x3b9183,null))[_0x9772('0x1e')](function(_0x5ca9c1){if(_0x5ca9c1){_0xf0a9a0=_0x5ca9c1;_0x54025e[_0x9772('0x3a')]=_[_0x9772('0x3b')](db[_0x9772('0x6b')][_0x9772('0x39')]);_0x54025e[_0x9772('0x3e')]=_[_0x9772('0x3b')](_0x4f00e6[_0x9772('0x3e')]);_0x54025e['filters']=_[_0x9772('0x3d')](_0x54025e[_0x9772('0x3a')],_0x54025e[_0x9772('0x3e')]);_0x4efcf7['attributes']=_['intersection'](_0x54025e['model'],qs[_0x9772('0x40')](_0x4f00e6[_0x9772('0x3e')][_0x9772('0x40')]));_0x4efcf7['attributes']=_0x4efcf7[_0x9772('0x3f')][_0x9772('0x52')]?_0x4efcf7[_0x9772('0x3f')]:_0x54025e[_0x9772('0x3a')];_0x4efcf7[_0x9772('0x43')]=qs[_0x9772('0x44')](_0x4f00e6[_0x9772('0x3e')][_0x9772('0x44')]);_0x4efcf7['where']=qs[_0x9772('0x3c')](_[_0x9772('0x46')](_0x4f00e6[_0x9772('0x3e')],_0x54025e[_0x9772('0x3c')]));if(_0x4f00e6['query'][_0x9772('0x47')]){_0x4efcf7[_0x9772('0x45')]=_['merge'](_0x4efcf7['where'],{'$or':_['map'](_0x4efcf7['attributes'],function(_0x3c4d1c){var _0x5af4fa={};_0x5af4fa[_0x3c4d1c]={'$like':'%'+_0x4f00e6[_0x9772('0x3e')][_0x9772('0x47')]+'%'};return _0x5af4fa;})});}_0x4efcf7=_[_0x9772('0x4b')]({},_0x4efcf7,_0x4f00e6['options']);return _0xf0a9a0[_0x9772('0x6a')](_0x4efcf7);}})[_0x9772('0x1e')](function(_0x5af14c){if(_0x5af14c){_0x539319=_0x5af14c['length'];if(!_0x4f00e6[_0x9772('0x3e')][_0x9772('0x41')](_0x9772('0x42'))){_0x4efcf7[_0x9772('0x2c')]=qs[_0x9772('0x2c')](_0x4f00e6[_0x9772('0x3e')][_0x9772('0x2c')]);_0x4efcf7[_0x9772('0x2b')]=qs['offset'](_0x4f00e6[_0x9772('0x3e')]['offset']);}return _0xf0a9a0[_0x9772('0x6a')](_0x4efcf7);}})[_0x9772('0x1e')](function(_0x58fe6e){if(_0x58fe6e){return _0x58fe6e?{'count':_0x539319,'rows':_0x58fe6e}:null;}})['then'](respondWithResult(_0x3b9183,null))[_0x9772('0x27')](handleError(_0x3b9183,null));};exports['addTeams']=function(_0x5c95a6,_0x51e9cd,_0x93e77c){var _0x16c2e5=[];var _0x18b0ed;return db[_0x9772('0x6b')][_0x9772('0x4f')]({'where':{'id':_0x5c95a6[_0x9772('0x5c')][_0x9772('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](function(_0xb464a4){if(_0xb464a4){for(var _0x546188=0x0;_0x546188<_0xb464a4['length'];_0x546188+=0x1){for(var _0x51e686=0x0;_0x51e686<_0xb464a4[_0x546188][_0x9772('0x6d')][_0x9772('0x52')];_0x51e686+=0x1){_0x16c2e5=_['union'](_0x16c2e5,[_0xb464a4[_0x546188][_0x9772('0x6d')][_0x51e686]['id']]);}}return _0x16c2e5;}})[_0x9772('0x1e')](function(_0x46e9ff){if(_0x46e9ff){return db[_0x9772('0x38')]['find']({'where':{'id':_0x5c95a6['params']['id']}});}})[_0x9772('0x1e')](function(_0x564b89){if(_0x564b89){_0x18b0ed=_0x564b89;return _0x18b0ed[_0x9772('0x6e')](_0x16c2e5,{'penalty':_0x5c95a6[_0x9772('0x5c')][_0x9772('0x6f')]});}})[_0x9772('0x1e')](function(_0x2896a5){if(_0x2896a5){return _0x18b0ed[_0x9772('0x70')](_0x5c95a6['body']['ids']);}})[_0x9772('0x1e')](handleEntityNotFound(_0x51e9cd,null))['then'](respondWithStatusCode(_0x51e9cd,null))['catch'](handleError(_0x51e9cd,null));};exports[_0x9772('0x71')]=function(_0x19f470,_0x3954b6,_0x15144f){var _0x208e5d=[];var _0x488cbd;return db[_0x9772('0x6b')]['findAll']({'where':{'id':_0x19f470['query'][_0x9772('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x9772('0x62')],'as':_0x9772('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x9772('0x1e')](function(_0x291153){if(_0x291153){for(var _0x85cf74=0x0;_0x85cf74<_0x291153[_0x9772('0x52')];_0x85cf74+=0x1){for(var _0x4418b4=0x0;_0x4418b4<_0x291153[_0x85cf74][_0x9772('0x6d')]['length'];_0x4418b4+=0x1){_0x208e5d=_['union'](_0x208e5d,[_0x291153[_0x85cf74]['Agents'][_0x4418b4]['id']]);}}return _0x208e5d;}})[_0x9772('0x1e')](function(_0x3993fc){if(_0x3993fc){return db[_0x9772('0x38')]['find']({'where':{'id':_0x19f470[_0x9772('0x51')]['id']}});}})[_0x9772('0x1e')](function(_0x568785){if(_0x568785){_0x488cbd=_0x568785;return _0x488cbd['removeAgents'](_0x208e5d);}})[_0x9772('0x1e')](function(_0x24af79){if(_0x488cbd){return _0x488cbd[_0x9772('0x71')](_0x19f470[_0x9772('0x3e')][_0x9772('0x6c')]);}})[_0x9772('0x1e')](handleEntityNotFound(_0x3954b6,null))[_0x9772('0x1e')](respondWithStatusCode(_0x3954b6,null))['catch'](handleError(_0x3954b6,null));};exports[_0x9772('0x6e')]=function(_0x233219,_0x4ee1b1,_0x16e8c6){return db[_0x9772('0x38')][_0x9772('0x59')]({'where':{'id':_0x233219[_0x9772('0x51')]['id']}})[_0x9772('0x1e')](handleEntityNotFound(_0x4ee1b1,null))[_0x9772('0x1e')](function(_0x4ced47){if(_0x4ced47){return _0x4ced47[_0x9772('0x6e')](_0x233219[_0x9772('0x5c')][_0x9772('0x6c')],_['omit'](_0x233219[_0x9772('0x5c')],[_0x9772('0x6c'),'id'])||{})['spread'](function(_0x2d9e3){for(var _0x949874=0x0;_0x949874<_0x233219[_0x9772('0x5c')][_0x9772('0x6c')]['length'];_0x949874+=0x1){socket[_0x9772('0x72')](_0x9772('0x73'),{'UserId':_0x233219[_0x9772('0x5c')][_0x9772('0x6c')][_0x949874],'ChatQueueId':_0x233219[_0x9772('0x51')]['id']});}return _0x2d9e3;});}})[_0x9772('0x1e')](respondWithResult(_0x4ee1b1,null))['catch'](handleError(_0x4ee1b1,null));};exports[_0x9772('0x74')]=function(_0x38ed61,_0x16055e,_0x33213d){var _0x58290d;return db[_0x9772('0x38')]['find']({'where':{'id':_0x38ed61[_0x9772('0x51')]['id']}})[_0x9772('0x1e')](handleEntityNotFound(_0x16055e,null))[_0x9772('0x1e')](function(_0x4b8495){if(_0x4b8495){return _0x4b8495['removeAgents'](_0x38ed61[_0x9772('0x3e')][_0x9772('0x6c')])['then'](function(_0x18b129){if(_[_0x9772('0x75')](_0x38ed61[_0x9772('0x3e')][_0x9772('0x6c')])){for(var _0x3a3ad8=0x0;_0x3a3ad8<_0x38ed61[_0x9772('0x3e')][_0x9772('0x6c')][_0x9772('0x52')];_0x3a3ad8+=0x1){socket[_0x9772('0x72')](_0x9772('0x76'),{'UserId':_0x38ed61[_0x9772('0x3e')][_0x9772('0x6c')][_0x3a3ad8],'ChatQueueId':_0x38ed61['params']['id']});}}else{socket[_0x9772('0x72')](_0x9772('0x76'),{'UserId':_0x38ed61[_0x9772('0x3e')][_0x9772('0x6c')],'ChatQueueId':_0x38ed61['params']['id']});}});}})[_0x9772('0x1e')](respondWithStatusCode(_0x16055e,null))[_0x9772('0x27')](handleError(_0x16055e,null));};exports[_0x9772('0x77')]=function(_0x468951,_0x1cd5f6,_0x2b4be3){var _0xe5426d={};var _0x1d576b={};var _0xa377c9;var _0x56010e;return db['ChatQueue'][_0x9772('0x5f')]({'where':{'id':_0x468951['params']['id']}})[_0x9772('0x1e')](handleEntityNotFound(_0x1cd5f6,null))[_0x9772('0x1e')](function(_0x3bd92f){if(_0x3bd92f){_0xa377c9=_0x3bd92f;_0x1d576b[_0x9772('0x3a')]=_[_0x9772('0x3b')](db[_0x9772('0x62')][_0x9772('0x39')]);_0x1d576b[_0x9772('0x3e')]=_[_0x9772('0x3b')](_0x468951['query']);_0x1d576b[_0x9772('0x3c')]=_['intersection'](_0x1d576b['model'],_0x1d576b[_0x9772('0x3e')]);_0xe5426d['attributes']=_['intersection'](_0x1d576b['model'],qs[_0x9772('0x40')](_0x468951['query'][_0x9772('0x40')]));_0xe5426d['attributes']=_0xe5426d[_0x9772('0x3f')][_0x9772('0x52')]?_0xe5426d[_0x9772('0x3f')]:_0x1d576b[_0x9772('0x3a')];_0xe5426d[_0x9772('0x43')]=qs[_0x9772('0x44')](_0x468951[_0x9772('0x3e')][_0x9772('0x44')]);_0xe5426d['where']=qs['filters'](_[_0x9772('0x46')](_0x468951['query'],_0x1d576b[_0x9772('0x3c')]));if(_0x468951[_0x9772('0x3e')][_0x9772('0x47')]){_0xe5426d[_0x9772('0x45')]=_[_0x9772('0x4b')](_0xe5426d[_0x9772('0x45')],{'$or':_['map'](_0xe5426d['attributes'],function(_0x3fcefb){var _0x58a271={};_0x58a271[_0x3fcefb]={'$like':'%'+_0x468951[_0x9772('0x3e')]['filter']+'%'};return _0x58a271;})});}_0xe5426d=_[_0x9772('0x4b')]({},_0xe5426d,_0x468951[_0x9772('0x53')]);return _0xa377c9['getAgents'](_0xe5426d);}})[_0x9772('0x1e')](function(_0x496475){if(_0x496475){_0x56010e=_0x496475[_0x9772('0x52')];if(!_0x468951[_0x9772('0x3e')][_0x9772('0x41')](_0x9772('0x42'))){_0xe5426d[_0x9772('0x2c')]=qs['limit'](_0x468951[_0x9772('0x3e')][_0x9772('0x2c')]);_0xe5426d['offset']=qs[_0x9772('0x2b')](_0x468951[_0x9772('0x3e')][_0x9772('0x2b')]);}return _0xa377c9[_0x9772('0x77')](_0xe5426d);}})[_0x9772('0x1e')](function(_0x15697a){if(_0x15697a){return _0x15697a?{'count':_0x56010e,'rows':_0x15697a}:null;}})[_0x9772('0x1e')](respondWithResult(_0x1cd5f6,null))[_0x9772('0x27')](handleError(_0x1cd5f6,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 8d8c07a..9c7e181 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 _0x008d=['exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x46bb00,_0x22cd2d){var _0x1992ed=function(_0x2159ae){while(--_0x2159ae){_0x46bb00['push'](_0x46bb00['shift']());}};_0x1992ed(++_0x22cd2d);}(_0x008d,0x9b));var _0xd008=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x008d[_0x1cc8fe];return _0x230054;};'use strict';var EventEmitter=require(_0xd008('0x0'));var ChatQueue=require(_0xd008('0x1'))['db'][_0xd008('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd008('0x3')](0x0);var events={'afterCreate':_0xd008('0x4'),'afterUpdate':_0xd008('0x5'),'afterDestroy':_0xd008('0x6')};function emitEvent(_0xdce7fa){return function(_0x1a7cb5,_0x5dcfa7,_0x373444){ChatQueueEvents[_0xd008('0x7')](_0xdce7fa+':'+_0x1a7cb5['id'],_0x1a7cb5);ChatQueueEvents[_0xd008('0x7')](_0xdce7fa,_0x1a7cb5);_0x373444(null);};}for(var e in events){if(events[_0xd008('0x8')](e)){var event=events[e];ChatQueue[_0xd008('0x9')](e,emitEvent(event));}}module[_0xd008('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x24dd=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x58036d,_0x3863b8){var _0x12fb9f=function(_0x745f7b){while(--_0x745f7b){_0x58036d['push'](_0x58036d['shift']());}};_0x12fb9f(++_0x3863b8);}(_0x24dd,0x84));var _0xd24d=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x24dd[_0x3e112d];return _0x531c31;};'use strict';var EventEmitter=require(_0xd24d('0x0'));var ChatQueue=require(_0xd24d('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd24d('0x2')](0x0);var events={'afterCreate':_0xd24d('0x3'),'afterUpdate':_0xd24d('0x4'),'afterDestroy':_0xd24d('0x5')};function emitEvent(_0x974c7d){return function(_0x5be948,_0x23577a,_0x14c749){ChatQueueEvents['emit'](_0x974c7d+':'+_0x5be948['id'],_0x5be948);ChatQueueEvents[_0xd24d('0x6')](_0x974c7d,_0x5be948);_0x14c749(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xd24d('0x7')](e,emitEvent(event));}}module[_0xd24d('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index bd5c489..1b58744 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 _0x72b1=['define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','./chatQueue.attributes','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x72b1,0x16e));var _0x172b=function(_0x2e9b4b,_0x1607d5){_0x2e9b4b=_0x2e9b4b-0x0;var _0x544617=_0x72b1[_0x2e9b4b];return _0x544617;};'use strict';var _=require(_0x172b('0x0'));var util=require('util');var logger=require(_0x172b('0x1'))(_0x172b('0x2'));var moment=require(_0x172b('0x3'));var BPromise=require(_0x172b('0x4'));var rp=require(_0x172b('0x5'));var attributes=require(_0x172b('0x6'));module[_0x172b('0x7')]=function(_0x558038,_0x3781f3){return _0x558038[_0x172b('0x8')](_0x172b('0x9'),attributes,{'tableName':_0x172b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0309=['bluebird','request-promise','./chatQueue.attributes','exports','chat_queues','lodash','../../config/logger','moment'];(function(_0x163b19,_0x292188){var _0x2b5180=function(_0x131c6a){while(--_0x131c6a){_0x163b19['push'](_0x163b19['shift']());}};_0x2b5180(++_0x292188);}(_0x0309,0x165));var _0x9030=function(_0x2c0375,_0x4f6744){_0x2c0375=_0x2c0375-0x0;var _0x36964f=_0x0309[_0x2c0375];return _0x36964f;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var attributes=require(_0x9030('0x5'));module[_0x9030('0x6')]=function(_0x2e6276,_0xcbbe57){return _0x2e6276['define']('ChatQueue',attributes,{'tableName':_0x9030('0x7'),'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 4141809..87bb9b4 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 _0xe085=['ShowChatQueue','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe085,0x79));var _0x5e08=function(_0x5ca84,_0x21acbe){_0x5ca84=_0x5ca84-0x0;var _0x24a6fd=_0xe085[_0x5ca84];return _0x24a6fd;};'use strict';var _=require(_0x5e08('0x0'));var util=require('util');var moment=require(_0x5e08('0x1'));var BPromise=require(_0x5e08('0x2'));var rs=require(_0x5e08('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e08('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e08('0x5'));var config=require(_0x5e08('0x6'));var jayson=require(_0x5e08('0x7'));var client=jayson[_0x5e08('0x8')][_0x5e08('0x9')]({'port':0x232a});config[_0x5e08('0xa')]=_[_0x5e08('0xb')](config['redis'],{'host':_0x5e08('0xc'),'port':0x18eb});var socket=require(_0x5e08('0xd'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x5e08('0xe')](socket);function respondWithRpcPromise(_0xdd649d,_0x1db72d,_0x435e29){return new BPromise(function(_0x32bfc8,_0xce4605){return client['request'](_0xdd649d,_0x435e29)[_0x5e08('0xf')](function(_0x10107a){logger[_0x5e08('0x10')]('ChatQueue,\x20%s,\x20%s',_0x1db72d,_0x5e08('0x11'));logger[_0x5e08('0x12')](_0x5e08('0x13'),_0x1db72d,_0x5e08('0x11'),JSON[_0x5e08('0x14')](_0x10107a));if(_0x10107a['error']){if(_0x10107a['error'][_0x5e08('0x15')]===0x1f4){logger[_0x5e08('0x16')](_0x5e08('0x17'),_0x1db72d,_0x10107a[_0x5e08('0x16')][_0x5e08('0x18')]);return _0xce4605(_0x10107a['error'][_0x5e08('0x18')]);}logger[_0x5e08('0x16')](_0x5e08('0x17'),_0x1db72d,_0x10107a[_0x5e08('0x16')][_0x5e08('0x18')]);return _0x32bfc8(_0x10107a['error'][_0x5e08('0x18')]);}else{logger[_0x5e08('0x10')]('ChatQueue,\x20%s,\x20%s',_0x1db72d,_0x5e08('0x11'));_0x32bfc8(_0x10107a[_0x5e08('0x19')]['message']);}})[_0x5e08('0x1a')](function(_0x519fbf){logger[_0x5e08('0x16')](_0x5e08('0x17'),_0x1db72d,_0x519fbf);_0xce4605(_0x519fbf);});});}exports[_0x5e08('0x1b')]=function(_0x29ff9c){var _0x527b84=this;return new Promise(function(_0x4e3ded,_0x5e9fcb){return db[_0x5e08('0x1c')][_0x5e08('0x1d')]({'raw':_0x29ff9c[_0x5e08('0x1e')]?_0x29ff9c['options'][_0x5e08('0x1f')]===undefined?!![]:![]:!![],'where':_0x29ff9c['options']?_0x29ff9c[_0x5e08('0x1e')][_0x5e08('0x20')]||null:null,'attributes':_0x29ff9c['options']?_0x29ff9c['options'][_0x5e08('0x21')]||null:null,'limit':_0x29ff9c['options']?_0x29ff9c[_0x5e08('0x1e')][_0x5e08('0x22')]||null:null,'include':_0x29ff9c[_0x5e08('0x1e')]?_0x29ff9c[_0x5e08('0x1e')]['include']?_['map'](_0x29ff9c[_0x5e08('0x1e')][_0x5e08('0x23')],function(_0x4c1092){return{'model':db[_0x4c1092[_0x5e08('0x24')]],'as':_0x4c1092['as'],'attributes':_0x4c1092['attributes'],'include':_0x4c1092['include']?_[_0x5e08('0x25')](_0x4c1092[_0x5e08('0x23')],function(_0x556e4a){return{'model':db[_0x556e4a['model']],'as':_0x556e4a['as'],'attributes':_0x556e4a[_0x5e08('0x21')],'include':_0x556e4a[_0x5e08('0x23')]?_[_0x5e08('0x25')](_0x556e4a[_0x5e08('0x23')],function(_0x2d1107){return{'model':db[_0x2d1107['model']],'as':_0x2d1107['as'],'attributes':_0x2d1107[_0x5e08('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5e08('0xf')](function(_0x4001a1){logger[_0x5e08('0x10')](_0x5e08('0x1b'),_0x29ff9c);logger[_0x5e08('0x12')](_0x5e08('0x1b'),_0x29ff9c,JSON[_0x5e08('0x14')](_0x4001a1));_0x4e3ded(_0x4001a1);})[_0x5e08('0x1a')](function(_0x18ae70){logger[_0x5e08('0x16')](_0x5e08('0x1b'),_0x18ae70[_0x5e08('0x18')],_0x29ff9c);_0x5e9fcb(_0x527b84[_0x5e08('0x16')](0x1f4,_0x18ae70['message']));});});};exports['ShowChatQueue']=function(_0x1b155b){var _0x1ef0d3=this;return new Promise(function(_0x308573,_0x303466){return db[_0x5e08('0x1c')][_0x5e08('0x26')]({'raw':_0x1b155b['options']?_0x1b155b[_0x5e08('0x1e')][_0x5e08('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b155b[_0x5e08('0x1e')]?_0x1b155b[_0x5e08('0x1e')]['where']||null:null,'attributes':_0x1b155b[_0x5e08('0x1e')]?_0x1b155b[_0x5e08('0x1e')]['attributes']||null:null,'include':_0x1b155b['options']?_0x1b155b[_0x5e08('0x1e')][_0x5e08('0x23')]?_[_0x5e08('0x25')](_0x1b155b[_0x5e08('0x1e')][_0x5e08('0x23')],function(_0x138651){return{'model':db[_0x138651[_0x5e08('0x24')]],'as':_0x138651['as'],'attributes':_0x138651[_0x5e08('0x21')],'include':_0x138651['include']?_['map'](_0x138651['include'],function(_0x2801ed){return{'model':db[_0x2801ed[_0x5e08('0x24')]],'as':_0x2801ed['as'],'attributes':_0x2801ed[_0x5e08('0x21')],'include':_0x2801ed[_0x5e08('0x23')]?_[_0x5e08('0x25')](_0x2801ed[_0x5e08('0x23')],function(_0x40249c){return{'model':db[_0x40249c[_0x5e08('0x24')]],'as':_0x40249c['as'],'attributes':_0x40249c[_0x5e08('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5e08('0xf')](function(_0x364566){logger[_0x5e08('0x10')](_0x5e08('0x27'),_0x1b155b);logger[_0x5e08('0x12')]('ShowChatQueue',_0x1b155b,JSON[_0x5e08('0x14')](_0x364566));_0x308573(_0x364566);})['catch'](function(_0x55b570){logger[_0x5e08('0x16')]('ShowChatQueue',_0x55b570[_0x5e08('0x18')],_0x1b155b);_0x303466(_0x1ef0d3[_0x5e08('0x16')](0x1f4,_0x55b570['message']));});});}; \ No newline at end of file +var _0xe0a1=['register','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','ChatQueue','options','raw','attributes','limit','include','map','model','GetChatQueue','catch','ShowChatQueue','find','where','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0xe0a1,0x179));var _0x1e0a=function(_0x47bc58,_0x1e1998){_0x47bc58=_0x47bc58-0x0;var _0x4a0860=_0xe0a1[_0x47bc58];return _0x4a0860;};'use strict';var _=require(_0x1e0a('0x0'));var util=require(_0x1e0a('0x1'));var moment=require(_0x1e0a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e0a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e0a('0x4'))(_0x1e0a('0x5'));var config=require(_0x1e0a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1e0a('0x7')][_0x1e0a('0x8')]({'port':0x232a});config[_0x1e0a('0x9')]=_[_0x1e0a('0xa')](config[_0x1e0a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e0a('0xb'))(new Redis(config['redis']));require(_0x1e0a('0xc'))[_0x1e0a('0xd')](socket);function respondWithRpcPromise(_0x3c4b3e,_0x5d7b3a,_0xae3b16){return new BPromise(function(_0x3aecb1,_0x36020c){return client[_0x1e0a('0xe')](_0x3c4b3e,_0xae3b16)[_0x1e0a('0xf')](function(_0x1b1bcc){logger['info'](_0x1e0a('0x10'),_0x5d7b3a,'request\x20sent');logger[_0x1e0a('0x11')](_0x1e0a('0x12'),_0x5d7b3a,'request\x20sent',JSON[_0x1e0a('0x13')](_0x1b1bcc));if(_0x1b1bcc[_0x1e0a('0x14')]){if(_0x1b1bcc[_0x1e0a('0x14')][_0x1e0a('0x15')]===0x1f4){logger[_0x1e0a('0x14')](_0x1e0a('0x10'),_0x5d7b3a,_0x1b1bcc['error'][_0x1e0a('0x16')]);return _0x36020c(_0x1b1bcc[_0x1e0a('0x14')][_0x1e0a('0x16')]);}logger['error'](_0x1e0a('0x10'),_0x5d7b3a,_0x1b1bcc['error'][_0x1e0a('0x16')]);return _0x3aecb1(_0x1b1bcc[_0x1e0a('0x14')]['message']);}else{logger[_0x1e0a('0x17')](_0x1e0a('0x10'),_0x5d7b3a,_0x1e0a('0x18'));_0x3aecb1(_0x1b1bcc[_0x1e0a('0x19')]['message']);}})['catch'](function(_0x53585c){logger[_0x1e0a('0x14')](_0x1e0a('0x10'),_0x5d7b3a,_0x53585c);_0x36020c(_0x53585c);});});}exports['GetChatQueue']=function(_0x523f81){var _0xab0a0c=this;return new Promise(function(_0x220856,_0x523b9c){return db[_0x1e0a('0x1a')]['findAll']({'raw':_0x523f81[_0x1e0a('0x1b')]?_0x523f81['options'][_0x1e0a('0x1c')]===undefined?!![]:![]:!![],'where':_0x523f81['options']?_0x523f81['options']['where']||null:null,'attributes':_0x523f81[_0x1e0a('0x1b')]?_0x523f81[_0x1e0a('0x1b')][_0x1e0a('0x1d')]||null:null,'limit':_0x523f81['options']?_0x523f81[_0x1e0a('0x1b')][_0x1e0a('0x1e')]||null:null,'include':_0x523f81[_0x1e0a('0x1b')]?_0x523f81['options'][_0x1e0a('0x1f')]?_[_0x1e0a('0x20')](_0x523f81[_0x1e0a('0x1b')][_0x1e0a('0x1f')],function(_0x449cba){return{'model':db[_0x449cba[_0x1e0a('0x21')]],'as':_0x449cba['as'],'attributes':_0x449cba[_0x1e0a('0x1d')],'include':_0x449cba[_0x1e0a('0x1f')]?_[_0x1e0a('0x20')](_0x449cba[_0x1e0a('0x1f')],function(_0x18e80a){return{'model':db[_0x18e80a[_0x1e0a('0x21')]],'as':_0x18e80a['as'],'attributes':_0x18e80a[_0x1e0a('0x1d')],'include':_0x18e80a[_0x1e0a('0x1f')]?_[_0x1e0a('0x20')](_0x18e80a[_0x1e0a('0x1f')],function(_0x3ff05b){return{'model':db[_0x3ff05b[_0x1e0a('0x21')]],'as':_0x3ff05b['as'],'attributes':_0x3ff05b[_0x1e0a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1e0a('0xf')](function(_0x1ba3db){logger['info']('GetChatQueue',_0x523f81);logger[_0x1e0a('0x11')](_0x1e0a('0x22'),_0x523f81,JSON[_0x1e0a('0x13')](_0x1ba3db));_0x220856(_0x1ba3db);})[_0x1e0a('0x23')](function(_0x242d99){logger[_0x1e0a('0x14')](_0x1e0a('0x22'),_0x242d99[_0x1e0a('0x16')],_0x523f81);_0x523b9c(_0xab0a0c['error'](0x1f4,_0x242d99[_0x1e0a('0x16')]));});});};exports[_0x1e0a('0x24')]=function(_0x30cd5f){var _0x268559=this;return new Promise(function(_0x33499a,_0x341816){return db[_0x1e0a('0x1a')][_0x1e0a('0x25')]({'raw':_0x30cd5f[_0x1e0a('0x1b')]?_0x30cd5f[_0x1e0a('0x1b')][_0x1e0a('0x1c')]===undefined?!![]:![]:!![],'where':_0x30cd5f['options']?_0x30cd5f[_0x1e0a('0x1b')][_0x1e0a('0x26')]||null:null,'attributes':_0x30cd5f[_0x1e0a('0x1b')]?_0x30cd5f['options'][_0x1e0a('0x1d')]||null:null,'include':_0x30cd5f[_0x1e0a('0x1b')]?_0x30cd5f[_0x1e0a('0x1b')][_0x1e0a('0x1f')]?_[_0x1e0a('0x20')](_0x30cd5f[_0x1e0a('0x1b')]['include'],function(_0x46628c){return{'model':db[_0x46628c['model']],'as':_0x46628c['as'],'attributes':_0x46628c['attributes'],'include':_0x46628c[_0x1e0a('0x1f')]?_[_0x1e0a('0x20')](_0x46628c[_0x1e0a('0x1f')],function(_0x24142e){return{'model':db[_0x24142e[_0x1e0a('0x21')]],'as':_0x24142e['as'],'attributes':_0x24142e[_0x1e0a('0x1d')],'include':_0x24142e[_0x1e0a('0x1f')]?_['map'](_0x24142e[_0x1e0a('0x1f')],function(_0x3b54fd){return{'model':db[_0x3b54fd[_0x1e0a('0x21')]],'as':_0x3b54fd['as'],'attributes':_0x3b54fd[_0x1e0a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1e0a('0xf')](function(_0x4ec37c){logger[_0x1e0a('0x17')]('ShowChatQueue',_0x30cd5f);logger['debug'](_0x1e0a('0x24'),_0x30cd5f,JSON[_0x1e0a('0x13')](_0x4ec37c));_0x33499a(_0x4ec37c);})[_0x1e0a('0x23')](function(_0x1a2b1c){logger[_0x1e0a('0x14')](_0x1e0a('0x24'),_0x1a2b1c[_0x1e0a('0x16')],_0x30cd5f);_0x341816(_0x268559['error'](0x1f4,_0x1a2b1c['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 221bbcd..52ff7cc 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 _0xa9e0=['register','length','chatQueue:','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var ChatQueueEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){ChatQueueEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);ChatQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','chatQueue:','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var ChatQueueEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){ChatQueueEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);ChatQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 9d57d56..faccf78 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 _0x1c2c=['describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','removeTeams','removeAgents','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x20e8d6,_0x4d9a75){var _0x44ea29=function(_0x1eb036){while(--_0x1eb036){_0x20e8d6['push'](_0x20e8d6['shift']());}};_0x44ea29(++_0x4d9a75);}(_0x1c2c,0x8f));var _0xc1c2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1c2c[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xc1c2('0x0'));var util=require('util');var path=require(_0xc1c2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc1c2('0x2')]();var auth=require(_0xc1c2('0x3'));var interaction=require(_0xc1c2('0x4'));var config=require('../../config/environment');var controller=require('./chatQueue.controller');router[_0xc1c2('0x5')]('/',auth[_0xc1c2('0x6')](),controller['index']);router['get']('/describe',auth[_0xc1c2('0x6')](),controller[_0xc1c2('0x7')]);router['get']('/:id',auth[_0xc1c2('0x6')](),controller[_0xc1c2('0x8')]);router[_0xc1c2('0x5')](_0xc1c2('0x9'),auth[_0xc1c2('0x6')](),controller[_0xc1c2('0xa')]);router[_0xc1c2('0x5')](_0xc1c2('0xb'),auth[_0xc1c2('0x6')](),controller[_0xc1c2('0xc')]);router[_0xc1c2('0x5')](_0xc1c2('0xd'),auth[_0xc1c2('0x6')](),controller[_0xc1c2('0xe')]);router[_0xc1c2('0xf')]('/',auth[_0xc1c2('0x6')](),controller[_0xc1c2('0x10')]);router[_0xc1c2('0xf')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc1c2('0x11')]);router[_0xc1c2('0xf')]('/:id/users',auth[_0xc1c2('0x6')](),controller[_0xc1c2('0x12')]);router['put'](_0xc1c2('0x13'),auth[_0xc1c2('0x6')](),controller[_0xc1c2('0x14')]);router['delete']('/:id',auth[_0xc1c2('0x6')](),controller['destroy']);router[_0xc1c2('0x15')](_0xc1c2('0xb'),auth[_0xc1c2('0x6')](),controller[_0xc1c2('0x16')]);router['delete']('/:id/users',auth[_0xc1c2('0x6')](),controller[_0xc1c2('0x17')]);module[_0xc1c2('0x18')]=router; \ No newline at end of file +var _0x8c4a=['removeTeams','removeAgents','exports','path','express','Router','../../config/environment','isAuthenticated','describe','/:id','show','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy'];(function(_0x3b42ab,_0x228050){var _0x4a633e=function(_0x128448){while(--_0x128448){_0x3b42ab['push'](_0x3b42ab['shift']());}};_0x4a633e(++_0x228050);}(_0x8c4a,0x13b));var _0xa8c4=function(_0x39a8e0,_0x49ff10){_0x39a8e0=_0x39a8e0-0x0;var _0x232e69=_0x8c4a[_0x39a8e0];return _0x232e69;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa8c4('0x0'));var timeout=require('connect-timeout');var express=require(_0xa8c4('0x1'));var router=express[_0xa8c4('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa8c4('0x3'));var controller=require('./chatQueue.controller');router['get']('/',auth[_0xa8c4('0x4')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xa8c4('0x5')]);router['get'](_0xa8c4('0x6'),auth['isAuthenticated'](),controller[_0xa8c4('0x7')]);router[_0xa8c4('0x8')](_0xa8c4('0x9'),auth['isAuthenticated'](),controller[_0xa8c4('0xa')]);router[_0xa8c4('0x8')](_0xa8c4('0xb'),auth[_0xa8c4('0x4')](),controller[_0xa8c4('0xc')]);router[_0xa8c4('0x8')](_0xa8c4('0xd'),auth['isAuthenticated'](),controller[_0xa8c4('0xe')]);router[_0xa8c4('0xf')]('/',auth[_0xa8c4('0x4')](),controller[_0xa8c4('0x10')]);router['post']('/:id/teams',auth[_0xa8c4('0x4')](),controller[_0xa8c4('0x11')]);router[_0xa8c4('0xf')](_0xa8c4('0xd'),auth['isAuthenticated'](),controller[_0xa8c4('0x12')]);router[_0xa8c4('0x13')](_0xa8c4('0x6'),auth[_0xa8c4('0x4')](),controller[_0xa8c4('0x14')]);router[_0xa8c4('0x15')](_0xa8c4('0x6'),auth[_0xa8c4('0x4')](),controller[_0xa8c4('0x16')]);router[_0xa8c4('0x15')](_0xa8c4('0xb'),auth[_0xa8c4('0x4')](),controller[_0xa8c4('0x17')]);router['delete']('/:id/users',auth[_0xa8c4('0x4')](),controller[_0xa8c4('0x18')]);module[_0xa8c4('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 81390cf..43a8f44 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 _0x50ab=['moment','exports','STRING','DATE'];(function(_0x36a06a,_0x54a85b){var _0x10ff65=function(_0x40c221){while(--_0x40c221){_0x36a06a['push'](_0x36a06a['shift']());}};_0x10ff65(++_0x54a85b);}(_0x50ab,0x154));var _0xb50a=function(_0x2be9e6,_0x46d6ef){_0x2be9e6=_0x2be9e6-0x0;var _0x1dfbda=_0x50ab[_0x2be9e6];return _0x1dfbda;};'use strict';var moment=require(_0xb50a('0x0'));var Sequelize=require('sequelize');module[_0xb50a('0x1')]={'uniqueid':{'type':Sequelize[_0xb50a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb50a('0x2')]},'joinAt':{'type':Sequelize[_0xb50a('0x3')]},'leaveAt':{'type':Sequelize[_0xb50a('0x3')]},'acceptAt':{'type':Sequelize[_0xb50a('0x3')]},'exitAt':{'type':Sequelize[_0xb50a('0x3')]},'reason':{'type':Sequelize[_0xb50a('0x2')]}}; \ No newline at end of file +var _0x286c=['DATE','moment','exports','STRING'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x286c,0x1e5));var _0xc286=function(_0x55a731,_0x1b2ee1){_0x55a731=_0x55a731-0x0;var _0x2ae7fd=_0x286c[_0x55a731];return _0x2ae7fd;};'use strict';var moment=require(_0xc286('0x0'));var Sequelize=require('sequelize');module[_0xc286('0x1')]={'uniqueid':{'type':Sequelize[_0xc286('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc286('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc286('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc286('0x3')]},'reason':{'type':Sequelize[_0xc286('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 701ebf3..f257c9d 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 _0x6ab0=['end','status','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','error','stack','name','index','ChatQueueReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','map','type','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','lodash','squel','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x23fc40,_0x16b9e6){var _0x2fcef0=function(_0x1cf8b0){while(--_0x1cf8b0){_0x23fc40['push'](_0x23fc40['shift']());}};_0x2fcef0(++_0x16b9e6);}(_0x6ab0,0x1c6));var _0x06ab=function(_0x3d17d8,_0xbb8b03){_0x3d17d8=_0x3d17d8-0x0;var _0x377efe=_0x6ab0[_0x3d17d8];return _0x377efe;};'use strict';var pdf=require(_0x06ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x06ab('0x1'));var zipdir=require(_0x06ab('0x2'));var jsonpatch=require(_0x06ab('0x3'));var rp=require('request-promise');var moment=require(_0x06ab('0x4'));var BPromise=require(_0x06ab('0x5'));var Mustache=require(_0x06ab('0x6'));var util=require('util');var path=require(_0x06ab('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x06ab('0x8'));var squel=require(_0x06ab('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x06ab('0xa'));var toCsv=require(_0x06ab('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x06ab('0xc'));var hardwareService=require(_0x06ab('0xd'));var Redis=require(_0x06ab('0xe'));var qs=require(_0x06ab('0xf'));var logger=require(_0x06ab('0x10'))(_0x06ab('0x11'));var utils=require(_0x06ab('0x12'));var config=require(_0x06ab('0x13'));var db=require(_0x06ab('0x14'))['db'];function respondWithStatusCode(_0x1bd9bc,_0x469bc7){_0x469bc7=_0x469bc7||0xcc;return function(_0x4146f7){if(_0x4146f7){return _0x1bd9bc[_0x06ab('0x15')](_0x469bc7);}return _0x1bd9bc['status'](_0x469bc7)[_0x06ab('0x16')]();};}function respondWithResult(_0x43effb,_0x57574d){_0x57574d=_0x57574d||0xc8;return function(_0x4934ad){if(_0x4934ad){return _0x43effb[_0x06ab('0x17')](_0x57574d)['json'](_0x4934ad);}};}function respondWithFilteredResult(_0x39b637,_0x41c882){return function(_0x44c010){if(_0x44c010){var _0x586e93=_0x44c010[_0x06ab('0x18')],_0x3790d5=_0x41c882[_0x06ab('0x19')],_0x456917=_0x41c882['offset']+_0x41c882[_0x06ab('0x1a')],_0x1afa11;if(_0x456917>=_0x586e93){_0x456917=_0x586e93;_0x1afa11=0xc8;}else{_0x1afa11=0xce;}_0x39b637[_0x06ab('0x17')](_0x1afa11);return _0x39b637[_0x06ab('0x1b')](_0x06ab('0x1c'),_0x3790d5+'-'+_0x456917+'/'+_0x586e93)[_0x06ab('0x1d')](_0x44c010);}return null;};}function patchUpdates(_0xea22c1){return function(_0x2aa424){try{jsonpatch['apply'](_0x2aa424,_0xea22c1,!![]);}catch(_0x23b82c){return BPromise[_0x06ab('0x1e')](_0x23b82c);}return _0x2aa424['save']();};}function saveUpdates(_0x3c3412,_0x4af586){return function(_0x5f2c23){if(_0x5f2c23){return _0x5f2c23[_0x06ab('0x1f')](_0x3c3412)[_0x06ab('0x20')](function(_0x12fe46){return _0x12fe46;});}return null;};}function removeEntity(_0x1e0638,_0x302c3d){return function(_0x32b210){if(_0x32b210){return _0x32b210[_0x06ab('0x21')]()['then'](function(){_0x1e0638[_0x06ab('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf77a20,_0x1b658a){return function(_0x888158){if(!_0x888158){_0xf77a20['sendStatus'](0x194);}return _0x888158;};}function handleError(_0x520d47,_0x594b95){_0x594b95=_0x594b95||0x1f4;return function(_0x17ebed){logger[_0x06ab('0x22')](_0x17ebed[_0x06ab('0x23')]);if(_0x17ebed['name']){delete _0x17ebed[_0x06ab('0x24')];}_0x520d47[_0x06ab('0x17')](_0x594b95)['send'](_0x17ebed);};}exports[_0x06ab('0x25')]=function(_0xe8aae8,_0x36300f){var _0x141970={},_0x20f7a0={},_0x144a2f={'count':0x0,'rows':[]};var _0x5118c8=db[_0x06ab('0x26')][_0x06ab('0x27')];_0x20f7a0['model']=_[_0x06ab('0x28')](_0x5118c8);_0x20f7a0[_0x06ab('0x29')]=_[_0x06ab('0x28')](_0xe8aae8[_0x06ab('0x29')]);_0x20f7a0[_0x06ab('0x2a')]=_[_0x06ab('0x2b')](_0x20f7a0[_0x06ab('0x2c')],_0x20f7a0['query']);_0x141970[_0x06ab('0x2d')]=_['intersection'](_0x20f7a0[_0x06ab('0x2c')],qs['fields'](_0xe8aae8[_0x06ab('0x29')][_0x06ab('0x2e')]));_0x141970[_0x06ab('0x2d')]=_0x141970[_0x06ab('0x2d')][_0x06ab('0x2f')]?_0x141970['attributes']:_0x20f7a0[_0x06ab('0x2c')];if(!_0xe8aae8[_0x06ab('0x29')][_0x06ab('0x30')]('nolimit')){_0x141970[_0x06ab('0x1a')]=qs[_0x06ab('0x1a')](_0xe8aae8[_0x06ab('0x29')]['limit']);_0x141970[_0x06ab('0x19')]=qs['offset'](_0xe8aae8[_0x06ab('0x29')][_0x06ab('0x19')]);}_0x141970[_0x06ab('0x31')]=qs[_0x06ab('0x32')](_0xe8aae8['query'][_0x06ab('0x32')]);_0x141970['where']=qs[_0x06ab('0x2a')](_[_0x06ab('0x33')](_0xe8aae8[_0x06ab('0x29')],_0x20f7a0[_0x06ab('0x2a')]));if(_0xe8aae8[_0x06ab('0x29')][_0x06ab('0x34')]){_0x141970[_0x06ab('0x35')]=_['merge'](_0x141970['where'],{'$or':_[_0x06ab('0x36')](_0x5118c8,function(_0x43a397){if(_0x43a397[_0x06ab('0x37')]['key']!==_0x06ab('0x38')){var _0x520708={};_0x520708[_0x43a397['field']]={'$like':'%'+_0xe8aae8[_0x06ab('0x29')][_0x06ab('0x34')]+'%'};return _0x520708;}})});}_0x141970=_[_0x06ab('0x39')]({},_0x141970,_0xe8aae8[_0x06ab('0x3a')]);var _0xbe65e7={'where':_0x141970[_0x06ab('0x35')]};return db[_0x06ab('0x26')][_0x06ab('0x18')](_0xbe65e7)[_0x06ab('0x20')](function(_0x502288){_0x144a2f[_0x06ab('0x18')]=_0x502288;if(_0xe8aae8[_0x06ab('0x29')][_0x06ab('0x3b')]){_0x141970[_0x06ab('0x3c')]=[{'all':!![]}];}return db[_0x06ab('0x26')]['findAll'](_0x141970);})[_0x06ab('0x20')](function(_0x149f38){_0x144a2f['rows']=_0x149f38;return _0x144a2f;})[_0x06ab('0x20')](respondWithFilteredResult(_0x36300f,_0x141970))[_0x06ab('0x3d')](handleError(_0x36300f,null));};exports[_0x06ab('0x3e')]=function(_0x30ece0,_0x347b42){var _0x4dffd8={'raw':!![],'where':{'id':_0x30ece0[_0x06ab('0x3f')]['id']}},_0x554842={};_0x554842[_0x06ab('0x2c')]=_[_0x06ab('0x28')](db[_0x06ab('0x26')][_0x06ab('0x27')]);_0x554842['query']=_[_0x06ab('0x28')](_0x30ece0[_0x06ab('0x29')]);_0x554842[_0x06ab('0x2a')]=_[_0x06ab('0x2b')](_0x554842[_0x06ab('0x2c')],_0x554842[_0x06ab('0x29')]);_0x4dffd8[_0x06ab('0x2d')]=_[_0x06ab('0x2b')](_0x554842[_0x06ab('0x2c')],qs[_0x06ab('0x2e')](_0x30ece0[_0x06ab('0x29')][_0x06ab('0x2e')]));_0x4dffd8[_0x06ab('0x2d')]=_0x4dffd8[_0x06ab('0x2d')][_0x06ab('0x2f')]?_0x4dffd8['attributes']:_0x554842[_0x06ab('0x2c')];if(_0x30ece0[_0x06ab('0x29')][_0x06ab('0x3b')]){_0x4dffd8[_0x06ab('0x3c')]=[{'all':!![]}];}_0x4dffd8=_['merge']({},_0x4dffd8,_0x30ece0['options']);return db[_0x06ab('0x26')][_0x06ab('0x40')](_0x4dffd8)[_0x06ab('0x20')](handleEntityNotFound(_0x347b42,null))[_0x06ab('0x20')](respondWithResult(_0x347b42,null))[_0x06ab('0x3d')](handleError(_0x347b42,null));};exports['create']=function(_0x24d729,_0x5c7562){return db['ChatQueueReport'][_0x06ab('0x41')](_0x24d729[_0x06ab('0x42')],{})[_0x06ab('0x20')](respondWithResult(_0x5c7562,0xc9))[_0x06ab('0x3d')](handleError(_0x5c7562,null));};exports[_0x06ab('0x1f')]=function(_0x2bbd75,_0xe68c5b){if(_0x2bbd75['body']['id']){delete _0x2bbd75[_0x06ab('0x42')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x2bbd75[_0x06ab('0x3f')]['id']}})[_0x06ab('0x20')](handleEntityNotFound(_0xe68c5b,null))[_0x06ab('0x20')](saveUpdates(_0x2bbd75[_0x06ab('0x42')],null))[_0x06ab('0x20')](respondWithResult(_0xe68c5b,null))['catch'](handleError(_0xe68c5b,null));};exports['destroy']=function(_0x84fe39,_0x2bc23d){return db[_0x06ab('0x26')]['find']({'where':{'id':_0x84fe39['params']['id']}})[_0x06ab('0x20')](handleEntityNotFound(_0x2bc23d,null))[_0x06ab('0x20')](removeEntity(_0x2bc23d,null))[_0x06ab('0x3d')](handleError(_0x2bc23d,null));};exports[_0x06ab('0x43')]=function(_0x1f7849,_0x2b38e7){return db['ChatQueueReport'][_0x06ab('0x43')]()['then'](respondWithResult(_0x2b38e7,null))[_0x06ab('0x3d')](handleError(_0x2b38e7,null));}; \ No newline at end of file +var _0x3f4b=['bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','name','send','index','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','options','ChatQueueReport','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x4b7380,_0x3e040b){var _0x3a2f6b=function(_0x4792de){while(--_0x4792de){_0x4b7380['push'](_0x4b7380['shift']());}};_0x3a2f6b(++_0x3e040b);}(_0x3f4b,0x1d8));var _0xb3f4=function(_0x5948eb,_0x5bd90a){_0x5948eb=_0x5948eb-0x0;var _0x408531=_0x3f4b[_0x5948eb];return _0x408531;};'use strict';var pdf=require(_0xb3f4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb3f4('0x1'));var zipdir=require(_0xb3f4('0x2'));var jsonpatch=require(_0xb3f4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb3f4('0x4'));var Mustache=require(_0xb3f4('0x5'));var util=require(_0xb3f4('0x6'));var path=require(_0xb3f4('0x7'));var sox=require('sox');var csv=require(_0xb3f4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb3f4('0x9'));var squel=require(_0xb3f4('0xa'));var crypto=require(_0xb3f4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb3f4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xb3f4('0xd'));var Redis=require(_0xb3f4('0xe'));var qs=require(_0xb3f4('0xf'));var logger=require(_0xb3f4('0x10'))('api');var utils=require(_0xb3f4('0x11'));var config=require(_0xb3f4('0x12'));var db=require(_0xb3f4('0x13'))['db'];function respondWithStatusCode(_0x2e8ce1,_0x4711aa){_0x4711aa=_0x4711aa||0xcc;return function(_0xf567a8){if(_0xf567a8){return _0x2e8ce1[_0xb3f4('0x14')](_0x4711aa);}return _0x2e8ce1['status'](_0x4711aa)[_0xb3f4('0x15')]();};}function respondWithResult(_0x39849a,_0x4fcca3){_0x4fcca3=_0x4fcca3||0xc8;return function(_0x2a9df3){if(_0x2a9df3){return _0x39849a[_0xb3f4('0x16')](_0x4fcca3)['json'](_0x2a9df3);}};}function respondWithFilteredResult(_0x16b44c,_0x307ab1){return function(_0xfa8513){if(_0xfa8513){var _0x2e4d8b=_0xfa8513[_0xb3f4('0x17')],_0x480a41=_0x307ab1[_0xb3f4('0x18')],_0x39e21a=_0x307ab1[_0xb3f4('0x18')]+_0x307ab1[_0xb3f4('0x19')],_0x3705dd;if(_0x39e21a>=_0x2e4d8b){_0x39e21a=_0x2e4d8b;_0x3705dd=0xc8;}else{_0x3705dd=0xce;}_0x16b44c[_0xb3f4('0x16')](_0x3705dd);return _0x16b44c['set'](_0xb3f4('0x1a'),_0x480a41+'-'+_0x39e21a+'/'+_0x2e4d8b)['json'](_0xfa8513);}return null;};}function patchUpdates(_0x110359){return function(_0x551ecd){try{jsonpatch[_0xb3f4('0x1b')](_0x551ecd,_0x110359,!![]);}catch(_0x298006){return BPromise[_0xb3f4('0x1c')](_0x298006);}return _0x551ecd['save']();};}function saveUpdates(_0x57f189,_0x56e02d){return function(_0x12f1a7){if(_0x12f1a7){return _0x12f1a7[_0xb3f4('0x1d')](_0x57f189)[_0xb3f4('0x1e')](function(_0x46c954){return _0x46c954;});}return null;};}function removeEntity(_0x4cec22,_0x511649){return function(_0x4b5afe){if(_0x4b5afe){return _0x4b5afe[_0xb3f4('0x1f')]()[_0xb3f4('0x1e')](function(){_0x4cec22[_0xb3f4('0x16')](0xcc)[_0xb3f4('0x15')]();});}};}function handleEntityNotFound(_0x4ef8c0,_0x4448ab){return function(_0x1660c7){if(!_0x1660c7){_0x4ef8c0[_0xb3f4('0x14')](0x194);}return _0x1660c7;};}function handleError(_0xc5453c,_0x4d9c80){_0x4d9c80=_0x4d9c80||0x1f4;return function(_0xe8d60f){logger[_0xb3f4('0x20')](_0xe8d60f['stack']);if(_0xe8d60f['name']){delete _0xe8d60f[_0xb3f4('0x21')];}_0xc5453c[_0xb3f4('0x16')](_0x4d9c80)[_0xb3f4('0x22')](_0xe8d60f);};}exports[_0xb3f4('0x23')]=function(_0x4def5f,_0x5a9682){var _0x4d0634={},_0x44591c={},_0x481548={'count':0x0,'rows':[]};var _0x2a2f8a=db['ChatQueueReport']['rawAttributes'];_0x44591c[_0xb3f4('0x24')]=_[_0xb3f4('0x25')](_0x2a2f8a);_0x44591c['query']=_['keys'](_0x4def5f[_0xb3f4('0x26')]);_0x44591c[_0xb3f4('0x27')]=_[_0xb3f4('0x28')](_0x44591c['model'],_0x44591c[_0xb3f4('0x26')]);_0x4d0634[_0xb3f4('0x29')]=_[_0xb3f4('0x28')](_0x44591c[_0xb3f4('0x24')],qs[_0xb3f4('0x2a')](_0x4def5f[_0xb3f4('0x26')][_0xb3f4('0x2a')]));_0x4d0634['attributes']=_0x4d0634[_0xb3f4('0x29')][_0xb3f4('0x2b')]?_0x4d0634[_0xb3f4('0x29')]:_0x44591c[_0xb3f4('0x24')];if(!_0x4def5f[_0xb3f4('0x26')][_0xb3f4('0x2c')](_0xb3f4('0x2d'))){_0x4d0634[_0xb3f4('0x19')]=qs[_0xb3f4('0x19')](_0x4def5f['query'][_0xb3f4('0x19')]);_0x4d0634['offset']=qs[_0xb3f4('0x18')](_0x4def5f[_0xb3f4('0x26')][_0xb3f4('0x18')]);}_0x4d0634[_0xb3f4('0x2e')]=qs['sort'](_0x4def5f[_0xb3f4('0x26')][_0xb3f4('0x2f')]);_0x4d0634[_0xb3f4('0x30')]=qs[_0xb3f4('0x27')](_[_0xb3f4('0x31')](_0x4def5f[_0xb3f4('0x26')],_0x44591c[_0xb3f4('0x27')]));if(_0x4def5f[_0xb3f4('0x26')][_0xb3f4('0x32')]){_0x4d0634[_0xb3f4('0x30')]=_[_0xb3f4('0x33')](_0x4d0634['where'],{'$or':_[_0xb3f4('0x34')](_0x2a2f8a,function(_0x473a17){if(_0x473a17[_0xb3f4('0x35')][_0xb3f4('0x36')]!=='VIRTUAL'){var _0x826cdb={};_0x826cdb[_0x473a17['field']]={'$like':'%'+_0x4def5f[_0xb3f4('0x26')]['filter']+'%'};return _0x826cdb;}})});}_0x4d0634=_['merge']({},_0x4d0634,_0x4def5f[_0xb3f4('0x37')]);var _0x3f8a38={'where':_0x4d0634['where']};return db[_0xb3f4('0x38')]['count'](_0x3f8a38)[_0xb3f4('0x1e')](function(_0x21d89a){_0x481548['count']=_0x21d89a;if(_0x4def5f[_0xb3f4('0x26')][_0xb3f4('0x39')]){_0x4d0634[_0xb3f4('0x3a')]=[{'all':!![]}];}return db[_0xb3f4('0x38')][_0xb3f4('0x3b')](_0x4d0634);})['then'](function(_0x150c48){_0x481548['rows']=_0x150c48;return _0x481548;})[_0xb3f4('0x1e')](respondWithFilteredResult(_0x5a9682,_0x4d0634))[_0xb3f4('0x3c')](handleError(_0x5a9682,null));};exports[_0xb3f4('0x3d')]=function(_0x16280d,_0x4b5a72){var _0xaeff34={'raw':!![],'where':{'id':_0x16280d[_0xb3f4('0x3e')]['id']}},_0x496505={};_0x496505[_0xb3f4('0x24')]=_[_0xb3f4('0x25')](db[_0xb3f4('0x38')][_0xb3f4('0x3f')]);_0x496505[_0xb3f4('0x26')]=_['keys'](_0x16280d['query']);_0x496505['filters']=_[_0xb3f4('0x28')](_0x496505[_0xb3f4('0x24')],_0x496505['query']);_0xaeff34[_0xb3f4('0x29')]=_[_0xb3f4('0x28')](_0x496505[_0xb3f4('0x24')],qs[_0xb3f4('0x2a')](_0x16280d[_0xb3f4('0x26')][_0xb3f4('0x2a')]));_0xaeff34[_0xb3f4('0x29')]=_0xaeff34[_0xb3f4('0x29')][_0xb3f4('0x2b')]?_0xaeff34[_0xb3f4('0x29')]:_0x496505['model'];if(_0x16280d[_0xb3f4('0x26')][_0xb3f4('0x39')]){_0xaeff34[_0xb3f4('0x3a')]=[{'all':!![]}];}_0xaeff34=_[_0xb3f4('0x33')]({},_0xaeff34,_0x16280d[_0xb3f4('0x37')]);return db[_0xb3f4('0x38')]['find'](_0xaeff34)[_0xb3f4('0x1e')](handleEntityNotFound(_0x4b5a72,null))[_0xb3f4('0x1e')](respondWithResult(_0x4b5a72,null))['catch'](handleError(_0x4b5a72,null));};exports[_0xb3f4('0x40')]=function(_0x1107f4,_0x49f975){return db['ChatQueueReport'][_0xb3f4('0x40')](_0x1107f4[_0xb3f4('0x41')],{})[_0xb3f4('0x1e')](respondWithResult(_0x49f975,0xc9))[_0xb3f4('0x3c')](handleError(_0x49f975,null));};exports[_0xb3f4('0x1d')]=function(_0x3f489f,_0x4ae180){if(_0x3f489f[_0xb3f4('0x41')]['id']){delete _0x3f489f[_0xb3f4('0x41')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x3f489f[_0xb3f4('0x3e')]['id']}})[_0xb3f4('0x1e')](handleEntityNotFound(_0x4ae180,null))['then'](saveUpdates(_0x3f489f[_0xb3f4('0x41')],null))[_0xb3f4('0x1e')](respondWithResult(_0x4ae180,null))['catch'](handleError(_0x4ae180,null));};exports[_0xb3f4('0x1f')]=function(_0x9311b7,_0x3ce683){return db['ChatQueueReport'][_0xb3f4('0x42')]({'where':{'id':_0x9311b7[_0xb3f4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3ce683,null))[_0xb3f4('0x1e')](removeEntity(_0x3ce683,null))[_0xb3f4('0x3c')](handleError(_0x3ce683,null));};exports[_0xb3f4('0x43')]=function(_0x4c7a51,_0x22d05c){return db[_0xb3f4('0x38')][_0xb3f4('0x43')]()['then'](respondWithResult(_0x22d05c,null))[_0xb3f4('0x3c')](handleError(_0x22d05c,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 997822f..5e0b3ba 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 _0x55ca=['request-promise','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','bluebird'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x55ca,0x126));var _0xa55c=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x55ca[_0x29d915];return _0x160f86;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var attributes=require('./chatQueueReport.attributes');module[_0xa55c('0x4')]=function(_0x2db02a,_0xcb02e3){return _0x2db02a[_0xa55c('0x5')](_0xa55c('0x6'),attributes,{'tableName':_0xa55c('0x7'),'paranoid':![],'indexes':[{'name':_0xa55c('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['request-promise','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','bluebird'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0x55ca,0x126));var _0xa55c=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x55ca[_0xaa6a4];return _0xdc31a4;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var attributes=require('./chatQueueReport.attributes');module[_0xa55c('0x4')]=function(_0x2db02a,_0xcb02e3){return _0x2db02a[_0xa55c('0x5')](_0xa55c('0x6'),attributes,{'tableName':_0xa55c('0x7'),'paranoid':![],'indexes':[{'name':_0xa55c('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 4eedaaf..1c403d1 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 _0x79c0=['update','body','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateChatQueueReport','ChatQueueReport','create','options','raw','info','catch','UpdateChatQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x79c0,0x125));var _0x079c=function(_0x308621,_0x1d4e9d){_0x308621=_0x308621-0x0;var _0x522b5f=_0x79c0[_0x308621];return _0x522b5f;};'use strict';var _=require(_0x079c('0x0'));var util=require('util');var moment=require(_0x079c('0x1'));var BPromise=require(_0x079c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x079c('0x3'));var db=require(_0x079c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x079c('0x5'))(_0x079c('0x6'));var config=require(_0x079c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x079c('0x8')][_0x079c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x589e8d,_0xc758c,_0x481544){return new BPromise(function(_0x32dbe6,_0x341aa9){return client['request'](_0x589e8d,_0x481544)[_0x079c('0xa')](function(_0x15dc20){logger['info'](_0x079c('0xb'),_0xc758c,_0x079c('0xc'));logger[_0x079c('0xd')](_0x079c('0xe'),_0xc758c,_0x079c('0xc'),JSON[_0x079c('0xf')](_0x15dc20));if(_0x15dc20[_0x079c('0x10')]){if(_0x15dc20[_0x079c('0x10')]['code']===0x1f4){logger[_0x079c('0x10')](_0x079c('0xb'),_0xc758c,_0x15dc20[_0x079c('0x10')][_0x079c('0x11')]);return _0x341aa9(_0x15dc20[_0x079c('0x10')][_0x079c('0x11')]);}logger[_0x079c('0x10')](_0x079c('0xb'),_0xc758c,_0x15dc20['error']['message']);return _0x32dbe6(_0x15dc20[_0x079c('0x10')][_0x079c('0x11')]);}else{logger['info'](_0x079c('0xb'),_0xc758c,_0x079c('0xc'));_0x32dbe6(_0x15dc20[_0x079c('0x12')]['message']);}})['catch'](function(_0xfbd950){logger[_0x079c('0x10')](_0x079c('0xb'),_0xc758c,_0xfbd950);_0x341aa9(_0xfbd950);});});}exports[_0x079c('0x13')]=function(_0x2b7028){var _0x5b44d7=this;return new Promise(function(_0x3cef6c,_0x1fcad3){return db[_0x079c('0x14')][_0x079c('0x15')](_0x2b7028['body'],{'raw':_0x2b7028[_0x079c('0x16')]?_0x2b7028[_0x079c('0x16')][_0x079c('0x17')]===undefined?!![]:![]:!![]})[_0x079c('0xa')](function(_0x4581d7){logger[_0x079c('0x18')]('CreateChatQueueReport',_0x2b7028);logger[_0x079c('0xd')](_0x079c('0x13'),_0x2b7028,JSON[_0x079c('0xf')](_0x4581d7));_0x3cef6c(_0x4581d7);})[_0x079c('0x19')](function(_0x43dabe){logger[_0x079c('0x10')](_0x079c('0x13'),_0x43dabe[_0x079c('0x11')],_0x2b7028);_0x1fcad3(_0x5b44d7['error'](0x1f4,_0x43dabe[_0x079c('0x11')]));});});};exports[_0x079c('0x1a')]=function(_0x8c83ea){var _0x4cc064=this;return new Promise(function(_0x1f35bf,_0x449241){return db[_0x079c('0x14')][_0x079c('0x1b')](_0x8c83ea[_0x079c('0x1c')],{'raw':_0x8c83ea['options']?_0x8c83ea[_0x079c('0x16')][_0x079c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8c83ea['options']?_0x8c83ea['options'][_0x079c('0x1d')]||null:null,'attributes':_0x8c83ea[_0x079c('0x16')]?_0x8c83ea[_0x079c('0x16')][_0x079c('0x1e')]||null:null,'limit':_0x8c83ea[_0x079c('0x16')]?_0x8c83ea[_0x079c('0x16')][_0x079c('0x1f')]||null:null})['then'](function(_0x22a8d2){logger[_0x079c('0x18')]('UpdateChatQueueReport',_0x8c83ea);logger['debug'](_0x079c('0x1a'),_0x8c83ea,JSON['stringify'](_0x22a8d2));_0x1f35bf(_0x22a8d2);})['catch'](function(_0x319b6e){logger[_0x079c('0x10')]('UpdateChatQueueReport',_0x319b6e[_0x079c('0x11')],_0x8c83ea);_0x449241(_0x4cc064[_0x079c('0x10')](0x1f4,_0x319b6e[_0x079c('0x11')]));});});}; \ No newline at end of file +var _0x7ca6=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','body','options','raw','debug','UpdateChatQueueReport','ChatQueueReport','where','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x1f049e,_0x16a334){var _0x443456=function(_0x4526e1){while(--_0x4526e1){_0x1f049e['push'](_0x1f049e['shift']());}};_0x443456(++_0x16a334);}(_0x7ca6,0x145));var _0x67ca=function(_0x4f62b9,_0x55595b){_0x4f62b9=_0x4f62b9-0x0;var _0x549d03=_0x7ca6[_0x4f62b9];return _0x549d03;};'use strict';var _=require(_0x67ca('0x0'));var util=require(_0x67ca('0x1'));var moment=require(_0x67ca('0x2'));var BPromise=require(_0x67ca('0x3'));var rs=require(_0x67ca('0x4'));var fs=require('fs');var Redis=require(_0x67ca('0x5'));var db=require(_0x67ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x67ca('0x7'))(_0x67ca('0x8'));var config=require(_0x67ca('0x9'));var jayson=require(_0x67ca('0xa'));var client=jayson[_0x67ca('0xb')][_0x67ca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eac66,_0xe30cee,_0x1371e1){return new BPromise(function(_0x2bf601,_0x3e669b){return client['request'](_0x5eac66,_0x1371e1)[_0x67ca('0xd')](function(_0x2cc578){logger[_0x67ca('0xe')](_0x67ca('0xf'),_0xe30cee,_0x67ca('0x10'));logger['debug'](_0x67ca('0x11'),_0xe30cee,_0x67ca('0x10'),JSON[_0x67ca('0x12')](_0x2cc578));if(_0x2cc578[_0x67ca('0x13')]){if(_0x2cc578['error'][_0x67ca('0x14')]===0x1f4){logger[_0x67ca('0x13')](_0x67ca('0xf'),_0xe30cee,_0x2cc578[_0x67ca('0x13')][_0x67ca('0x15')]);return _0x3e669b(_0x2cc578[_0x67ca('0x13')]['message']);}logger[_0x67ca('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0xe30cee,_0x2cc578[_0x67ca('0x13')][_0x67ca('0x15')]);return _0x2bf601(_0x2cc578['error'][_0x67ca('0x15')]);}else{logger[_0x67ca('0xe')](_0x67ca('0xf'),_0xe30cee,_0x67ca('0x10'));_0x2bf601(_0x2cc578[_0x67ca('0x16')][_0x67ca('0x15')]);}})[_0x67ca('0x17')](function(_0x11ef5f){logger[_0x67ca('0x13')](_0x67ca('0xf'),_0xe30cee,_0x11ef5f);_0x3e669b(_0x11ef5f);});});}exports[_0x67ca('0x18')]=function(_0x58b918){var _0x3c85db=this;return new Promise(function(_0x1bd80e,_0x267065){return db['ChatQueueReport']['create'](_0x58b918[_0x67ca('0x19')],{'raw':_0x58b918[_0x67ca('0x1a')]?_0x58b918['options'][_0x67ca('0x1b')]===undefined?!![]:![]:!![]})[_0x67ca('0xd')](function(_0x4549ad){logger[_0x67ca('0xe')](_0x67ca('0x18'),_0x58b918);logger[_0x67ca('0x1c')](_0x67ca('0x18'),_0x58b918,JSON[_0x67ca('0x12')](_0x4549ad));_0x1bd80e(_0x4549ad);})[_0x67ca('0x17')](function(_0x4ec063){logger[_0x67ca('0x13')](_0x67ca('0x18'),_0x4ec063[_0x67ca('0x15')],_0x58b918);_0x267065(_0x3c85db[_0x67ca('0x13')](0x1f4,_0x4ec063[_0x67ca('0x15')]));});});};exports[_0x67ca('0x1d')]=function(_0x1b5346){var _0x451c77=this;return new Promise(function(_0x4e5455,_0x431e74){return db[_0x67ca('0x1e')]['update'](_0x1b5346[_0x67ca('0x19')],{'raw':_0x1b5346[_0x67ca('0x1a')]?_0x1b5346[_0x67ca('0x1a')][_0x67ca('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b5346[_0x67ca('0x1a')]?_0x1b5346[_0x67ca('0x1a')][_0x67ca('0x1f')]||null:null,'attributes':_0x1b5346[_0x67ca('0x1a')]?_0x1b5346[_0x67ca('0x1a')]['attributes']||null:null,'limit':_0x1b5346[_0x67ca('0x1a')]?_0x1b5346[_0x67ca('0x1a')][_0x67ca('0x20')]||null:null})['then'](function(_0x453fd1){logger[_0x67ca('0xe')](_0x67ca('0x1d'),_0x1b5346);logger[_0x67ca('0x1c')](_0x67ca('0x1d'),_0x1b5346,JSON[_0x67ca('0x12')](_0x453fd1));_0x4e5455(_0x453fd1);})[_0x67ca('0x17')](function(_0x35cc7a){logger[_0x67ca('0x13')](_0x67ca('0x1d'),_0x35cc7a[_0x67ca('0x15')],_0x1b5346);_0x431e74(_0x451c77[_0x67ca('0x13')](0x1f4,_0x35cc7a[_0x67ca('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 43a8c6d..84749fb 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 _0x2e4b=['../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','create','put','update','delete','exports','path','connect-timeout','Router'];(function(_0x2e9a00,_0x12c84f){var _0x51ba53=function(_0xe32171){while(--_0xe32171){_0x2e9a00['push'](_0x2e9a00['shift']());}};_0x51ba53(++_0x12c84f);}(_0x2e4b,0xfd));var _0xb2e4=function(_0x29e3ec,_0x138a18){_0x29e3ec=_0x29e3ec-0x0;var _0x25727e=_0x2e4b[_0x29e3ec];return _0x25727e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb2e4('0x0'));var timeout=require(_0xb2e4('0x1'));var express=require('express');var router=express[_0xb2e4('0x2')]();var auth=require(_0xb2e4('0x3'));var interaction=require(_0xb2e4('0x4'));var config=require('../../config/environment');var controller=require(_0xb2e4('0x5'));router[_0xb2e4('0x6')]('/',auth[_0xb2e4('0x7')](),controller[_0xb2e4('0x8')]);router[_0xb2e4('0x6')]('/describe',auth[_0xb2e4('0x7')](),controller[_0xb2e4('0x9')]);router[_0xb2e4('0x6')](_0xb2e4('0xa'),auth[_0xb2e4('0x7')](),controller['show']);router['post']('/',auth[_0xb2e4('0x7')](),controller[_0xb2e4('0xb')]);router[_0xb2e4('0xc')](_0xb2e4('0xa'),auth[_0xb2e4('0x7')](),controller[_0xb2e4('0xd')]);router[_0xb2e4('0xe')](_0xb2e4('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xb2e4('0xf')]=router; \ No newline at end of file +var _0xd0d6=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0xdfe866,_0x2e1ba1){var _0x39f106=function(_0x45b204){while(--_0x45b204){_0xdfe866['push'](_0xdfe866['shift']());}};_0x39f106(++_0x2e1ba1);}(_0xd0d6,0x140));var _0x6d0d=function(_0xb08ec2,_0x4b13cd){_0xb08ec2=_0xb08ec2-0x0;var _0x3938c4=_0xd0d6[_0xb08ec2];return _0x3938c4;};'use strict';var multer=require(_0x6d0d('0x0'));var util=require('util');var path=require(_0x6d0d('0x1'));var timeout=require(_0x6d0d('0x2'));var express=require(_0x6d0d('0x3'));var router=express[_0x6d0d('0x4')]();var auth=require(_0x6d0d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6d0d('0x6'));var controller=require(_0x6d0d('0x7'));router[_0x6d0d('0x8')]('/',auth[_0x6d0d('0x9')](),controller['index']);router[_0x6d0d('0x8')]('/describe',auth[_0x6d0d('0x9')](),controller[_0x6d0d('0xa')]);router[_0x6d0d('0x8')]('/:id',auth[_0x6d0d('0x9')](),controller[_0x6d0d('0xb')]);router[_0x6d0d('0xc')]('/',auth[_0x6d0d('0x9')](),controller[_0x6d0d('0xd')]);router[_0x6d0d('0xe')](_0x6d0d('0xf'),auth[_0x6d0d('0x9')](),controller[_0x6d0d('0x10')]);router[_0x6d0d('0x11')]('/:id',auth[_0x6d0d('0x9')](),controller[_0x6d0d('0x12')]);module[_0x6d0d('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 408e9fb..a3bc818 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 _0x0576=['moment','ENUM','queue'];(function(_0x1aff16,_0x108929){var _0x4b4cca=function(_0x13adc9){while(--_0x13adc9){_0x1aff16['push'](_0x1aff16['shift']());}};_0x4b4cca(++_0x108929);}(_0x0576,0xbd));var _0x6057=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0576[_0x397e5f];return _0x5302b8;};'use strict';var moment=require(_0x6057('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6057('0x1')]('account','agent',_0x6057('0x2')),'allowNull':![],'defaultValue':_0x6057('0x2')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x2e21=['sequelize','exports','STRING','ENUM','account','agent','queue','NOW'];(function(_0x6f1031,_0x3c0a6f){var _0x4e1b8d=function(_0x159882){while(--_0x159882){_0x6f1031['push'](_0x6f1031['shift']());}};_0x4e1b8d(++_0x3c0a6f);}(_0x2e21,0x68));var _0x12e2=function(_0x4f4f67,_0x4868dc){_0x4f4f67=_0x4f4f67-0x0;var _0x4b3475=_0x2e21[_0x4f4f67];return _0x4b3475;};'use strict';var moment=require('moment');var Sequelize=require(_0x12e2('0x0'));module[_0x12e2('0x1')]={'uniqueid':{'type':Sequelize[_0x12e2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x12e2('0x3')](_0x12e2('0x4'),_0x12e2('0x5'),'queue'),'allowNull':![],'defaultValue':_0x12e2('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x12e2('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 1dd17f0..16592bd 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 _0x3aa2=['then','destroy','sendStatus','stack','name','send','index','ChatTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','map','key','VIRTUAL','field','merge','options','include','findAll','catch','show','includeAll','create','body','update','find','params','describe','html-pdf','eml-format','zip-dir','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save'];(function(_0x2500e1,_0x3cee01){var _0xf0a772=function(_0x31419e){while(--_0x31419e){_0x2500e1['push'](_0x2500e1['shift']());}};_0xf0a772(++_0x3cee01);}(_0x3aa2,0x13b));var _0x23aa=function(_0x45b771,_0x2caece){_0x45b771=_0x45b771-0x0;var _0x7ef73d=_0x3aa2[_0x45b771];return _0x7ef73d;};'use strict';var pdf=require(_0x23aa('0x0'));var emlformat=require(_0x23aa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x23aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x23aa('0x3'));var BPromise=require(_0x23aa('0x4'));var Mustache=require('mustache');var util=require(_0x23aa('0x5'));var path=require('path');var sox=require(_0x23aa('0x6'));var csv=require(_0x23aa('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x23aa('0x8'));var squel=require(_0x23aa('0x9'));var crypto=require(_0x23aa('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x23aa('0xb'));var toCsv=require(_0x23aa('0x7'));var querystring=require(_0x23aa('0xc'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x23aa('0xd'));var Redis=require('ioredis');var qs=require(_0x23aa('0xe'));var logger=require(_0x23aa('0xf'))(_0x23aa('0x10'));var utils=require(_0x23aa('0x11'));var config=require(_0x23aa('0x12'));var db=require(_0x23aa('0x13'))['db'];function respondWithStatusCode(_0x402b42,_0x5ed160){_0x5ed160=_0x5ed160||0xcc;return function(_0x4fdd70){if(_0x4fdd70){return _0x402b42['sendStatus'](_0x5ed160);}return _0x402b42[_0x23aa('0x14')](_0x5ed160)[_0x23aa('0x15')]();};}function respondWithResult(_0x109649,_0x1d3725){_0x1d3725=_0x1d3725||0xc8;return function(_0xeab146){if(_0xeab146){return _0x109649[_0x23aa('0x14')](_0x1d3725)[_0x23aa('0x16')](_0xeab146);}};}function respondWithFilteredResult(_0x12cda0,_0x574a95){return function(_0x3df6e1){if(_0x3df6e1){var _0x4d83ca=_0x3df6e1[_0x23aa('0x17')],_0x5dacbe=_0x574a95[_0x23aa('0x18')],_0x3cbbde=_0x574a95[_0x23aa('0x18')]+_0x574a95[_0x23aa('0x19')],_0x409c47;if(_0x3cbbde>=_0x4d83ca){_0x3cbbde=_0x4d83ca;_0x409c47=0xc8;}else{_0x409c47=0xce;}_0x12cda0['status'](_0x409c47);return _0x12cda0[_0x23aa('0x1a')](_0x23aa('0x1b'),_0x5dacbe+'-'+_0x3cbbde+'/'+_0x4d83ca)['json'](_0x3df6e1);}return null;};}function patchUpdates(_0x4eef91){return function(_0x4d660f){try{jsonpatch['apply'](_0x4d660f,_0x4eef91,!![]);}catch(_0x443933){return BPromise[_0x23aa('0x1c')](_0x443933);}return _0x4d660f[_0x23aa('0x1d')]();};}function saveUpdates(_0x545ac6,_0x2f5918){return function(_0x140c66){if(_0x140c66){return _0x140c66['update'](_0x545ac6)[_0x23aa('0x1e')](function(_0x1f066f){return _0x1f066f;});}return null;};}function removeEntity(_0x1aec62,_0x26d3d4){return function(_0x106bde){if(_0x106bde){return _0x106bde[_0x23aa('0x1f')]()[_0x23aa('0x1e')](function(){_0x1aec62[_0x23aa('0x14')](0xcc)[_0x23aa('0x15')]();});}};}function handleEntityNotFound(_0x559af5,_0x319277){return function(_0x3c79ce){if(!_0x3c79ce){_0x559af5[_0x23aa('0x20')](0x194);}return _0x3c79ce;};}function handleError(_0x737b9d,_0x5ad637){_0x5ad637=_0x5ad637||0x1f4;return function(_0x23771b){logger['error'](_0x23771b[_0x23aa('0x21')]);if(_0x23771b[_0x23aa('0x22')]){delete _0x23771b[_0x23aa('0x22')];}_0x737b9d['status'](_0x5ad637)[_0x23aa('0x23')](_0x23771b);};}exports[_0x23aa('0x24')]=function(_0x3e3adc,_0x8af77e){var _0x593354={},_0x53ac30={},_0x492f0b={'count':0x0,'rows':[]};var _0x38e380=db[_0x23aa('0x25')][_0x23aa('0x26')];_0x53ac30[_0x23aa('0x27')]=_[_0x23aa('0x28')](_0x38e380);_0x53ac30[_0x23aa('0x29')]=_[_0x23aa('0x28')](_0x3e3adc[_0x23aa('0x29')]);_0x53ac30[_0x23aa('0x2a')]=_[_0x23aa('0x2b')](_0x53ac30[_0x23aa('0x27')],_0x53ac30[_0x23aa('0x29')]);_0x593354[_0x23aa('0x2c')]=_[_0x23aa('0x2b')](_0x53ac30['model'],qs['fields'](_0x3e3adc[_0x23aa('0x29')][_0x23aa('0x2d')]));_0x593354[_0x23aa('0x2c')]=_0x593354['attributes']['length']?_0x593354[_0x23aa('0x2c')]:_0x53ac30[_0x23aa('0x27')];if(!_0x3e3adc[_0x23aa('0x29')]['hasOwnProperty'](_0x23aa('0x2e'))){_0x593354[_0x23aa('0x19')]=qs['limit'](_0x3e3adc[_0x23aa('0x29')][_0x23aa('0x19')]);_0x593354['offset']=qs[_0x23aa('0x18')](_0x3e3adc[_0x23aa('0x29')]['offset']);}_0x593354[_0x23aa('0x2f')]=qs[_0x23aa('0x30')](_0x3e3adc[_0x23aa('0x29')][_0x23aa('0x30')]);_0x593354[_0x23aa('0x31')]=qs[_0x23aa('0x2a')](_[_0x23aa('0x32')](_0x3e3adc['query'],_0x53ac30[_0x23aa('0x2a')]));if(_0x3e3adc[_0x23aa('0x29')][_0x23aa('0x33')]){_0x593354['where']=_['merge'](_0x593354[_0x23aa('0x31')],{'$or':_[_0x23aa('0x34')](_0x38e380,function(_0x3884a7){if(_0x3884a7['type'][_0x23aa('0x35')]!==_0x23aa('0x36')){var _0x3dc3b6={};_0x3dc3b6[_0x3884a7[_0x23aa('0x37')]]={'$like':'%'+_0x3e3adc[_0x23aa('0x29')][_0x23aa('0x33')]+'%'};return _0x3dc3b6;}})});}_0x593354=_[_0x23aa('0x38')]({},_0x593354,_0x3e3adc[_0x23aa('0x39')]);var _0x1798af={'where':_0x593354[_0x23aa('0x31')]};return db[_0x23aa('0x25')][_0x23aa('0x17')](_0x1798af)['then'](function(_0x49d1b9){_0x492f0b[_0x23aa('0x17')]=_0x49d1b9;if(_0x3e3adc['query']['includeAll']){_0x593354[_0x23aa('0x3a')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x23aa('0x3b')](_0x593354);})[_0x23aa('0x1e')](function(_0x20df7f){_0x492f0b['rows']=_0x20df7f;return _0x492f0b;})[_0x23aa('0x1e')](respondWithFilteredResult(_0x8af77e,_0x593354))[_0x23aa('0x3c')](handleError(_0x8af77e,null));};exports[_0x23aa('0x3d')]=function(_0x22401c,_0x3d3a96){var _0x244194={'raw':!![],'where':{'id':_0x22401c['params']['id']}},_0x20b565={};_0x20b565[_0x23aa('0x27')]=_['keys'](db[_0x23aa('0x25')]['rawAttributes']);_0x20b565['query']=_['keys'](_0x22401c[_0x23aa('0x29')]);_0x20b565['filters']=_['intersection'](_0x20b565[_0x23aa('0x27')],_0x20b565[_0x23aa('0x29')]);_0x244194[_0x23aa('0x2c')]=_[_0x23aa('0x2b')](_0x20b565[_0x23aa('0x27')],qs['fields'](_0x22401c['query'][_0x23aa('0x2d')]));_0x244194[_0x23aa('0x2c')]=_0x244194[_0x23aa('0x2c')]['length']?_0x244194[_0x23aa('0x2c')]:_0x20b565['model'];if(_0x22401c[_0x23aa('0x29')][_0x23aa('0x3e')]){_0x244194[_0x23aa('0x3a')]=[{'all':!![]}];}_0x244194=_['merge']({},_0x244194,_0x22401c[_0x23aa('0x39')]);return db[_0x23aa('0x25')]['find'](_0x244194)[_0x23aa('0x1e')](handleEntityNotFound(_0x3d3a96,null))['then'](respondWithResult(_0x3d3a96,null))[_0x23aa('0x3c')](handleError(_0x3d3a96,null));};exports[_0x23aa('0x3f')]=function(_0x18c454,_0x316309){return db[_0x23aa('0x25')]['create'](_0x18c454[_0x23aa('0x40')],{})[_0x23aa('0x1e')](respondWithResult(_0x316309,0xc9))['catch'](handleError(_0x316309,null));};exports[_0x23aa('0x41')]=function(_0x31df62,_0x2c3fc7){if(_0x31df62['body']['id']){delete _0x31df62[_0x23aa('0x40')]['id'];}return db['ChatTransferReport'][_0x23aa('0x42')]({'where':{'id':_0x31df62[_0x23aa('0x43')]['id']}})[_0x23aa('0x1e')](handleEntityNotFound(_0x2c3fc7,null))[_0x23aa('0x1e')](saveUpdates(_0x31df62[_0x23aa('0x40')],null))['then'](respondWithResult(_0x2c3fc7,null))[_0x23aa('0x3c')](handleError(_0x2c3fc7,null));};exports[_0x23aa('0x1f')]=function(_0x5a6653,_0x7ab87f){return db[_0x23aa('0x25')][_0x23aa('0x42')]({'where':{'id':_0x5a6653[_0x23aa('0x43')]['id']}})[_0x23aa('0x1e')](handleEntityNotFound(_0x7ab87f,null))['then'](removeEntity(_0x7ab87f,null))[_0x23aa('0x3c')](handleError(_0x7ab87f,null));};exports[_0x23aa('0x44')]=function(_0x5dd120,_0x32f608){return db[_0x23aa('0x25')][_0x23aa('0x44')]()[_0x23aa('0x1e')](respondWithResult(_0x32f608,null))[_0x23aa('0x3c')](handleError(_0x32f608,null));}; \ No newline at end of file +var _0x2c64=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','field','ChatTransferReport','includeAll','include','rows','show','params','options','find','catch','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','keys','query','filters','attributes','intersection','model','fields'];(function(_0x1db8b4,_0x2d21b6){var _0x403069=function(_0x2c3312){while(--_0x2c3312){_0x1db8b4['push'](_0x1db8b4['shift']());}};_0x403069(++_0x2d21b6);}(_0x2c64,0x181));var _0x42c6=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x2c64[_0x9fd887];return _0x1a54ab;};'use strict';var pdf=require(_0x42c6('0x0'));var emlformat=require(_0x42c6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x42c6('0x2'));var jsonpatch=require(_0x42c6('0x3'));var rp=require(_0x42c6('0x4'));var moment=require(_0x42c6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x42c6('0x6'));var path=require(_0x42c6('0x7'));var sox=require(_0x42c6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x42c6('0x9'));var crypto=require(_0x42c6('0xa'));var jsforce=require(_0x42c6('0xb'));var deskjs=require(_0x42c6('0xc'));var toCsv=require(_0x42c6('0xd'));var querystring=require('querystring');var Papa=require(_0x42c6('0xe'));var authService=require(_0x42c6('0xf'));var hardwareService=require(_0x42c6('0x10'));var Redis=require('ioredis');var qs=require(_0x42c6('0x11'));var logger=require(_0x42c6('0x12'))('api');var utils=require(_0x42c6('0x13'));var config=require(_0x42c6('0x14'));var db=require(_0x42c6('0x15'))['db'];function respondWithStatusCode(_0x1e69e2,_0x427671){_0x427671=_0x427671||0xcc;return function(_0x7aaae2){if(_0x7aaae2){return _0x1e69e2[_0x42c6('0x16')](_0x427671);}return _0x1e69e2['status'](_0x427671)[_0x42c6('0x17')]();};}function respondWithResult(_0x1e9287,_0x21f74a){_0x21f74a=_0x21f74a||0xc8;return function(_0x43ebc5){if(_0x43ebc5){return _0x1e9287[_0x42c6('0x18')](_0x21f74a)[_0x42c6('0x19')](_0x43ebc5);}};}function respondWithFilteredResult(_0x373598,_0x51a06c){return function(_0x376d62){if(_0x376d62){var _0x1a2863=_0x376d62[_0x42c6('0x1a')],_0x189e46=_0x51a06c['offset'],_0x1ac8bd=_0x51a06c[_0x42c6('0x1b')]+_0x51a06c[_0x42c6('0x1c')],_0x56eba5;if(_0x1ac8bd>=_0x1a2863){_0x1ac8bd=_0x1a2863;_0x56eba5=0xc8;}else{_0x56eba5=0xce;}_0x373598[_0x42c6('0x18')](_0x56eba5);return _0x373598['set'](_0x42c6('0x1d'),_0x189e46+'-'+_0x1ac8bd+'/'+_0x1a2863)[_0x42c6('0x19')](_0x376d62);}return null;};}function patchUpdates(_0x3ff835){return function(_0x3fce8d){try{jsonpatch[_0x42c6('0x1e')](_0x3fce8d,_0x3ff835,!![]);}catch(_0x12b285){return BPromise[_0x42c6('0x1f')](_0x12b285);}return _0x3fce8d['save']();};}function saveUpdates(_0x51aae3,_0x141e3e){return function(_0x3139bc){if(_0x3139bc){return _0x3139bc[_0x42c6('0x20')](_0x51aae3)[_0x42c6('0x21')](function(_0x553fa7){return _0x553fa7;});}return null;};}function removeEntity(_0x542367,_0x2694e3){return function(_0x43f0e4){if(_0x43f0e4){return _0x43f0e4['destroy']()[_0x42c6('0x21')](function(){_0x542367['status'](0xcc)[_0x42c6('0x17')]();});}};}function handleEntityNotFound(_0x18c809,_0x11557c){return function(_0x1e5dc4){if(!_0x1e5dc4){_0x18c809[_0x42c6('0x16')](0x194);}return _0x1e5dc4;};}function handleError(_0x2734d5,_0x57dedd){_0x57dedd=_0x57dedd||0x1f4;return function(_0x9ed602){logger[_0x42c6('0x22')](_0x9ed602[_0x42c6('0x23')]);if(_0x9ed602[_0x42c6('0x24')]){delete _0x9ed602[_0x42c6('0x24')];}_0x2734d5['status'](_0x57dedd)[_0x42c6('0x25')](_0x9ed602);};}exports[_0x42c6('0x26')]=function(_0x1d9c11,_0x432253){var _0x496aaf={},_0x1b0fe7={},_0x3972b8={'count':0x0,'rows':[]};var _0x9fac8c=db['ChatTransferReport'][_0x42c6('0x27')];_0x1b0fe7['model']=_[_0x42c6('0x28')](_0x9fac8c);_0x1b0fe7[_0x42c6('0x29')]=_[_0x42c6('0x28')](_0x1d9c11[_0x42c6('0x29')]);_0x1b0fe7[_0x42c6('0x2a')]=_['intersection'](_0x1b0fe7['model'],_0x1b0fe7['query']);_0x496aaf[_0x42c6('0x2b')]=_[_0x42c6('0x2c')](_0x1b0fe7[_0x42c6('0x2d')],qs[_0x42c6('0x2e')](_0x1d9c11['query'][_0x42c6('0x2e')]));_0x496aaf[_0x42c6('0x2b')]=_0x496aaf['attributes'][_0x42c6('0x2f')]?_0x496aaf['attributes']:_0x1b0fe7[_0x42c6('0x2d')];if(!_0x1d9c11['query'][_0x42c6('0x30')](_0x42c6('0x31'))){_0x496aaf[_0x42c6('0x1c')]=qs[_0x42c6('0x1c')](_0x1d9c11[_0x42c6('0x29')][_0x42c6('0x1c')]);_0x496aaf[_0x42c6('0x1b')]=qs['offset'](_0x1d9c11[_0x42c6('0x29')][_0x42c6('0x1b')]);}_0x496aaf[_0x42c6('0x32')]=qs[_0x42c6('0x33')](_0x1d9c11[_0x42c6('0x29')][_0x42c6('0x33')]);_0x496aaf[_0x42c6('0x34')]=qs[_0x42c6('0x2a')](_[_0x42c6('0x35')](_0x1d9c11[_0x42c6('0x29')],_0x1b0fe7['filters']));if(_0x1d9c11[_0x42c6('0x29')][_0x42c6('0x36')]){_0x496aaf[_0x42c6('0x34')]=_[_0x42c6('0x37')](_0x496aaf[_0x42c6('0x34')],{'$or':_['map'](_0x9fac8c,function(_0xcaab0){if(_0xcaab0[_0x42c6('0x38')]['key']!==_0x42c6('0x39')){var _0x479ce6={};_0x479ce6[_0xcaab0[_0x42c6('0x3a')]]={'$like':'%'+_0x1d9c11['query'][_0x42c6('0x36')]+'%'};return _0x479ce6;}})});}_0x496aaf=_[_0x42c6('0x37')]({},_0x496aaf,_0x1d9c11['options']);var _0x111d2b={'where':_0x496aaf[_0x42c6('0x34')]};return db[_0x42c6('0x3b')]['count'](_0x111d2b)[_0x42c6('0x21')](function(_0x25d1e6){_0x3972b8[_0x42c6('0x1a')]=_0x25d1e6;if(_0x1d9c11['query'][_0x42c6('0x3c')]){_0x496aaf[_0x42c6('0x3d')]=[{'all':!![]}];}return db[_0x42c6('0x3b')]['findAll'](_0x496aaf);})[_0x42c6('0x21')](function(_0x2c96ac){_0x3972b8[_0x42c6('0x3e')]=_0x2c96ac;return _0x3972b8;})[_0x42c6('0x21')](respondWithFilteredResult(_0x432253,_0x496aaf))['catch'](handleError(_0x432253,null));};exports[_0x42c6('0x3f')]=function(_0x1ee2b2,_0x4df770){var _0x1c1020={'raw':!![],'where':{'id':_0x1ee2b2[_0x42c6('0x40')]['id']}},_0x360d29={};_0x360d29[_0x42c6('0x2d')]=_[_0x42c6('0x28')](db[_0x42c6('0x3b')][_0x42c6('0x27')]);_0x360d29['query']=_[_0x42c6('0x28')](_0x1ee2b2[_0x42c6('0x29')]);_0x360d29['filters']=_[_0x42c6('0x2c')](_0x360d29[_0x42c6('0x2d')],_0x360d29['query']);_0x1c1020[_0x42c6('0x2b')]=_['intersection'](_0x360d29[_0x42c6('0x2d')],qs['fields'](_0x1ee2b2[_0x42c6('0x29')][_0x42c6('0x2e')]));_0x1c1020[_0x42c6('0x2b')]=_0x1c1020['attributes'][_0x42c6('0x2f')]?_0x1c1020[_0x42c6('0x2b')]:_0x360d29[_0x42c6('0x2d')];if(_0x1ee2b2[_0x42c6('0x29')]['includeAll']){_0x1c1020[_0x42c6('0x3d')]=[{'all':!![]}];}_0x1c1020=_[_0x42c6('0x37')]({},_0x1c1020,_0x1ee2b2[_0x42c6('0x41')]);return db[_0x42c6('0x3b')][_0x42c6('0x42')](_0x1c1020)[_0x42c6('0x21')](handleEntityNotFound(_0x4df770,null))[_0x42c6('0x21')](respondWithResult(_0x4df770,null))[_0x42c6('0x43')](handleError(_0x4df770,null));};exports[_0x42c6('0x44')]=function(_0x405713,_0x2139ca){return db[_0x42c6('0x3b')][_0x42c6('0x44')](_0x405713['body'],{})[_0x42c6('0x21')](respondWithResult(_0x2139ca,0xc9))['catch'](handleError(_0x2139ca,null));};exports['update']=function(_0x61bdeb,_0x3326fb){if(_0x61bdeb[_0x42c6('0x45')]['id']){delete _0x61bdeb[_0x42c6('0x45')]['id'];}return db['ChatTransferReport'][_0x42c6('0x42')]({'where':{'id':_0x61bdeb[_0x42c6('0x40')]['id']}})[_0x42c6('0x21')](handleEntityNotFound(_0x3326fb,null))['then'](saveUpdates(_0x61bdeb[_0x42c6('0x45')],null))[_0x42c6('0x21')](respondWithResult(_0x3326fb,null))[_0x42c6('0x43')](handleError(_0x3326fb,null));};exports[_0x42c6('0x46')]=function(_0x4d1fd5,_0xccc63){return db[_0x42c6('0x3b')]['find']({'where':{'id':_0x4d1fd5[_0x42c6('0x40')]['id']}})[_0x42c6('0x21')](handleEntityNotFound(_0xccc63,null))[_0x42c6('0x21')](removeEntity(_0xccc63,null))[_0x42c6('0x43')](handleError(_0xccc63,null));};exports[_0x42c6('0x47')]=function(_0x27d3c2,_0x5e1567){return db['ChatTransferReport'][_0x42c6('0x47')]()[_0x42c6('0x21')](respondWithResult(_0x5e1567,null))[_0x42c6('0x43')](handleError(_0x5e1567,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 892c107..9ced42c 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 _0x7505=['request-promise','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','api','moment','bluebird'];(function(_0x428b89,_0x1d8f40){var _0x423a73=function(_0xd783a7){while(--_0xd783a7){_0x428b89['push'](_0x428b89['shift']());}};_0x423a73(++_0x1d8f40);}(_0x7505,0xe3));var _0x5750=function(_0x1c67cd,_0x4d1c5d){_0x1c67cd=_0x1c67cd-0x0;var _0x2c6a0=_0x7505[_0x1c67cd];return _0x2c6a0;};'use strict';var _=require('lodash');var util=require(_0x5750('0x0'));var logger=require('../../config/logger')(_0x5750('0x1'));var moment=require(_0x5750('0x2'));var BPromise=require(_0x5750('0x3'));var rp=require(_0x5750('0x4'));var attributes=require(_0x5750('0x5'));module[_0x5750('0x6')]=function(_0x3cdec8,_0x562ab2){return _0x3cdec8[_0x5750('0x7')](_0x5750('0x8'),attributes,{'tableName':_0x5750('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5750('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x86d8=['uniqueid','lodash','util','../../config/logger','api','request-promise','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x440122,_0x257f29){var _0x17f90b=function(_0x1f0135){while(--_0x1f0135){_0x440122['push'](_0x440122['shift']());}};_0x17f90b(++_0x257f29);}(_0x86d8,0x123));var _0x886d=function(_0x28109f,_0x57bc0d){_0x28109f=_0x28109f-0x0;var _0x24c79f=_0x86d8[_0x28109f];return _0x24c79f;};'use strict';var _=require(_0x886d('0x0'));var util=require(_0x886d('0x1'));var logger=require(_0x886d('0x2'))(_0x886d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x886d('0x4'));var attributes=require(_0x886d('0x5'));module[_0x886d('0x6')]=function(_0x45c5fa,_0x6ddc00){return _0x45c5fa[_0x886d('0x7')](_0x886d('0x8'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x886d('0x9'),'fields':[_0x886d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index fd10f88..ea36875 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 _0x2c59=['stringify','code','error','ChatTransferReport,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent'];(function(_0x56a94a,_0x5aba20){var _0x173c1e=function(_0x1945ba){while(--_0x1945ba){_0x56a94a['push'](_0x56a94a['shift']());}};_0x173c1e(++_0x5aba20);}(_0x2c59,0xb7));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x92c5('0x0'));var BPromise=require(_0x92c5('0x1'));var rs=require(_0x92c5('0x2'));var fs=require('fs');var Redis=require(_0x92c5('0x3'));var db=require(_0x92c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x92c5('0x5'))(_0x92c5('0x6'));var config=require(_0x92c5('0x7'));var jayson=require(_0x92c5('0x8'));var client=jayson[_0x92c5('0x9')][_0x92c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6fef34,_0x1bff7b,_0x20f742){return new BPromise(function(_0x14690e,_0x36079d){return client[_0x92c5('0xb')](_0x6fef34,_0x20f742)[_0x92c5('0xc')](function(_0x2fdb8b){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x1bff7b,'request\x20sent');logger[_0x92c5('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x1bff7b,_0x92c5('0xe'),JSON[_0x92c5('0xf')](_0x2fdb8b));if(_0x2fdb8b['error']){if(_0x2fdb8b['error'][_0x92c5('0x10')]===0x1f4){logger[_0x92c5('0x11')](_0x92c5('0x12'),_0x1bff7b,_0x2fdb8b['error'][_0x92c5('0x13')]);return _0x36079d(_0x2fdb8b[_0x92c5('0x11')][_0x92c5('0x13')]);}logger['error'](_0x92c5('0x12'),_0x1bff7b,_0x2fdb8b[_0x92c5('0x11')][_0x92c5('0x13')]);return _0x14690e(_0x2fdb8b[_0x92c5('0x11')][_0x92c5('0x13')]);}else{logger[_0x92c5('0x14')](_0x92c5('0x12'),_0x1bff7b,_0x92c5('0xe'));_0x14690e(_0x2fdb8b['result'][_0x92c5('0x13')]);}})[_0x92c5('0x15')](function(_0x4f14da){logger[_0x92c5('0x11')](_0x92c5('0x12'),_0x1bff7b,_0x4f14da);_0x36079d(_0x4f14da);});});} \ No newline at end of file +var _0xc3fe=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message'];(function(_0x2e76a7,_0x23871a){var _0x454cde=function(_0x51724d){while(--_0x51724d){_0x2e76a7['push'](_0x2e76a7['shift']());}};_0x454cde(++_0x23871a);}(_0xc3fe,0xff));var _0xec3f=function(_0x2a0034,_0x51c1a1){_0x2a0034=_0x2a0034-0x0;var _0x55c1b0=_0xc3fe[_0x2a0034];return _0x55c1b0;};'use strict';var _=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var moment=require(_0xec3f('0x2'));var BPromise=require('bluebird');var rs=require(_0xec3f('0x3'));var fs=require('fs');var Redis=require(_0xec3f('0x4'));var db=require(_0xec3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec3f('0x6'))(_0xec3f('0x7'));var config=require(_0xec3f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xec3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b0b84,_0x526183,_0x503775){return new BPromise(function(_0xcb8557,_0x5df7fc){return client[_0xec3f('0xa')](_0x3b0b84,_0x503775)[_0xec3f('0xb')](function(_0x12a7c5){logger[_0xec3f('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));logger[_0xec3f('0xe')](_0xec3f('0xf'),_0x526183,_0xec3f('0xd'),JSON[_0xec3f('0x10')](_0x12a7c5));if(_0x12a7c5[_0xec3f('0x11')]){if(_0x12a7c5['error'][_0xec3f('0x12')]===0x1f4){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0x12a7c5['error']['message']);return _0x5df7fc(_0x12a7c5[_0xec3f('0x11')]['message']);}logger['error'](_0xec3f('0x13'),_0x526183,_0x12a7c5[_0xec3f('0x11')][_0xec3f('0x14')]);return _0xcb8557(_0x12a7c5['error']['message']);}else{logger[_0xec3f('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));_0xcb8557(_0x12a7c5[_0xec3f('0x15')]['message']);}})[_0xec3f('0x16')](function(_0xb8ee6f){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0xb8ee6f);_0x5df7fc(_0xb8ee6f);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index fc250fd..1fa5d0e 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 _0xe01f=['/describe','describe','post','create','put','update','delete','/:id','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3b9cf3,_0x457407){var _0x11eb3c=function(_0x4e71d7){while(--_0x4e71d7){_0x3b9cf3['push'](_0x3b9cf3['shift']());}};_0x11eb3c(++_0x457407);}(_0xe01f,0x185));var _0xfe01=function(_0x5b1c37,_0x2359c5){_0x5b1c37=_0x5b1c37-0x0;var _0x987361=_0xe01f[_0x5b1c37];return _0x987361;};'use strict';var multer=require(_0xfe01('0x0'));var util=require(_0xfe01('0x1'));var path=require(_0xfe01('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe01('0x3'));var router=express[_0xfe01('0x4')]();var auth=require(_0xfe01('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfe01('0x6'));var controller=require('./chatTransferReport.controller');router[_0xfe01('0x7')]('/',auth[_0xfe01('0x8')](),controller[_0xfe01('0x9')]);router[_0xfe01('0x7')](_0xfe01('0xa'),auth['isAuthenticated'](),controller[_0xfe01('0xb')]);router[_0xfe01('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xfe01('0xc')]('/',auth['isAuthenticated'](),controller[_0xfe01('0xd')]);router[_0xfe01('0xe')]('/:id',auth[_0xfe01('0x8')](),controller[_0xfe01('0xf')]);router[_0xfe01('0x10')](_0xfe01('0x11'),auth[_0xfe01('0x8')](),controller['destroy']);module[_0xfe01('0x12')]=router; \ No newline at end of file +var _0x5a59=['destroy','multer','path','express','Router','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','isAuthenticated','post','put','/:id','update'];(function(_0x3b5dbf,_0x491c60){var _0x3b27d7=function(_0x1bc171){while(--_0x1bc171){_0x3b5dbf['push'](_0x3b5dbf['shift']());}};_0x3b27d7(++_0x491c60);}(_0x5a59,0x97));var _0x95a5=function(_0x2e4b05,_0x152a02){_0x2e4b05=_0x2e4b05-0x0;var _0x506cd3=_0x5a59[_0x2e4b05];return _0x506cd3;};'use strict';var multer=require(_0x95a5('0x0'));var util=require('util');var path=require(_0x95a5('0x1'));var timeout=require('connect-timeout');var express=require(_0x95a5('0x2'));var router=express[_0x95a5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x95a5('0x4'));var config=require(_0x95a5('0x5'));var controller=require(_0x95a5('0x6'));router[_0x95a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x95a5('0x8')]);router['get']('/describe',auth[_0x95a5('0x9')](),controller['describe']);router[_0x95a5('0x7')]('/:id',auth[_0x95a5('0x9')](),controller['show']);router[_0x95a5('0xa')]('/',auth[_0x95a5('0x9')](),controller['create']);router[_0x95a5('0xb')](_0x95a5('0xc'),auth['isAuthenticated'](),controller[_0x95a5('0xd')]);router['delete']('/:id',auth[_0x95a5('0x9')](),controller[_0x95a5('0xe')]);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 3311e2a..4164cc2 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 _0xe375=['squared','rounded','Chat','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','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','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#9f946a','#ffffff','BOOLEAN','ENUM'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe375,0xea));var _0x5e37=function(_0x45a4cd,_0x31dd97){_0x45a4cd=_0x45a4cd-0x0;var _0x4b6369=_0xe375[_0x45a4cd];return _0x4b6369;};'use strict';var Sequelize=require(_0x5e37('0x0'));var rs=require(_0x5e37('0x1'));module[_0x5e37('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x5e37('0x3')],'allowNull':![],'unique':_0x5e37('0x4')},'description':{'type':Sequelize[_0x5e37('0x3')]},'mapKey':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x5')},'mapKeyOffline':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x5')},'key':{'type':Sequelize[_0x5e37('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x5e37('0x6')},'customerAlias':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5e37('0x3')],'allowNull':![],'defaultValue':_0x5e37('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5e37('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5e37('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5e37('0x3')]},'animation':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5e37('0xa')]('rounded',_0x5e37('0xb')),'defaultValue':_0x5e37('0xc')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5e37('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5e37('0x11')]},'closingQuestion':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x13')},'noteTitle':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5e37('0x14')},'closingMessage':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x15')},'closingMessageButton':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x16')},'skipMessageButton':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x17')},'conditionAgreement':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0x5e37('0xa')]('star',_0x5e37('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x5e37('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x5e37('0x19')]({'items':[{'type':_0x5e37('0x1a'),'variable':null,'config':{'placeholder':_0x5e37('0x1b'),'type':_0x5e37('0x1c'),'required':!![]},'props':{'title':_0x5e37('0x1b'),'helpText':''}},{'type':_0x5e37('0x1a'),'props':{'title':_0x5e37('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x5e37('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5e37('0x1d')](_0x5e37('0x1e'))?JSON[_0x5e37('0x1f')](this[_0x5e37('0x1d')]('onlineForm')):{};},'set':function(_0x35474a){return this[_0x5e37('0x20')]('onlineForm',JSON[_0x5e37('0x19')](_0x35474a));}},'offlineForm':{'type':Sequelize[_0x5e37('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5e37('0x5'),'type':_0x5e37('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0x5e37('0x21')},'props':{'title':_0x5e37('0x21'),'helpText':_0x5e37('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x5e37('0x23'))?JSON[_0x5e37('0x1f')](this[_0x5e37('0x1d')](_0x5e37('0x23'))):{};},'set':function(_0x13fc2f){return this['setDataValue'](_0x5e37('0x23'),JSON[_0x5e37('0x19')](_0x13fc2f));}},'token':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':function(){return rs[_0x5e37('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5e37('0x3')]},'forwardOffline':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5e37('0x3')]},'waitingTitle':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x26')},'offlineMessageBody':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x28')},'skipUnmanaged':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x17')},'sendUnmanaged':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x16')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5e37('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5e37('0x11')],'defaultValue':function(){return _0x5e37('0x29');}},'notificationSound':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5e37('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x5e37('0x2b')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x2c')},'defaultTitle':{'type':Sequelize[_0x5e37('0x3')]},'customerAvatar':{'type':Sequelize[_0x5e37('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5e37('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5e37('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5e37('0x3')],'defaultValue':_0x5e37('0x2d')},'systemAvatar':{'type':Sequelize[_0x5e37('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5e37('0xf')],'comment':_0x5e37('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x5e37('0x9')],'defaultValue':![],'comment':_0x5e37('0x2f'),'set':function(_0x2a6ff9){if(!_0x2a6ff9)this[_0x5e37('0x20')]('mandatoryDispositionPauseId',null);this[_0x5e37('0x20')](_0x5e37('0x30'),_0x2a6ff9);}}}; \ No newline at end of file +var _0x83c2=['Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','thumb','star','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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.','website_alias','bottom_right','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','randomstring','exports','STRING','address','email','Agent','#9f946a','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us'];(function(_0x227033,_0x34dc79){var _0x494c08=function(_0x3f6b16){while(--_0x3f6b16){_0x227033['push'](_0x227033['shift']());}};_0x494c08(++_0x34dc79);}(_0x83c2,0xa8));var _0x283c=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x83c2[_0x1562a2];return _0x39a636;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x283c('0x0'));module[_0x283c('0x1')]={'name':{'type':Sequelize[_0x283c('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x283c('0x3')},'description':{'type':Sequelize[_0x283c('0x2')]},'mapKey':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0x4')},'mapKeyOffline':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x283c('0x2')],'allowNull':![],'defaultValue':_0x283c('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x283c('0x2')],'allowNull':![],'defaultValue':_0x283c('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x283c('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x283c('0x2')]},'animation':{'type':Sequelize[_0x283c('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x283c('0xa')]('rounded','squared'),'defaultValue':_0x283c('0xb')},'header_online':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x283c('0xd')},'offline_chat_button':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0xe')},'header_offline':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0xf')},'download_transcript':{'type':Sequelize[_0x283c('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x283c('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x283c('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x283c('0x11')]},'closingQuestion':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x283c('0x13')},'noteTitle':{'type':Sequelize[_0x283c('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x283c('0x14')},'closingMessage':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x283c('0xe')},'skipMessageButton':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0x16')},'conditionAgreement':{'type':Sequelize[_0x283c('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x283c('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x283c('0x9')],'defaultValue':![]},'ratingType':{'type':Sequelize['ENUM']('star',_0x283c('0x17')),'defaultValue':_0x283c('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x283c('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x283c('0x11')],'defaultValue':function(){return JSON[_0x283c('0x19')]({'items':[{'type':_0x283c('0x1a'),'variable':null,'config':{'placeholder':_0x283c('0x1b'),'type':_0x283c('0x1c'),'required':!![]},'props':{'title':_0x283c('0x1b'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x283c('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x283c('0x1d')](_0x283c('0x1e'))?JSON[_0x283c('0x1f')](this[_0x283c('0x1d')](_0x283c('0x1e'))):{};},'set':function(_0x534613){return this[_0x283c('0x20')](_0x283c('0x1e'),JSON[_0x283c('0x19')](_0x534613));}},'offlineForm':{'type':Sequelize[_0x283c('0x11')],'defaultValue':function(){return JSON[_0x283c('0x19')]({'items':[{'type':_0x283c('0x1a'),'props':{'title':_0x283c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x283c('0x4'),'type':_0x283c('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x283c('0x21')},'props':{'title':_0x283c('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x283c('0x1d')](_0x283c('0x22'))?JSON[_0x283c('0x1f')](this[_0x283c('0x1d')](_0x283c('0x22'))):{};},'set':function(_0xc5e9a2){return this[_0x283c('0x20')](_0x283c('0x22'),JSON[_0x283c('0x19')](_0xc5e9a2));}},'token':{'type':Sequelize[_0x283c('0x2')],'defaultValue':function(){return rs[_0x283c('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x283c('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x283c('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x283c('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x283c('0x24')},'waitingMessage':{'type':Sequelize[_0x283c('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0x25')},'offlineMessageBody':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x283c('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x283c('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x283c('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x283c('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x283c('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x283c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x283c('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x283c('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x283c('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x283c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x283c('0x29')},'verticalAlignment':{'type':Sequelize[_0x283c('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x283c('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x283c('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x283c('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x283c('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x283c('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x283c('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x283c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x283c('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x283c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x283c('0x2')],'defaultValue':_0x283c('0x2b')},'systemAvatar':{'type':Sequelize[_0x283c('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x283c('0x2c'),'set':function(_0x28d9d9){if(!_0x28d9d9)this[_0x283c('0x20')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x283c('0x2d'),_0x28d9d9);}}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 8cdd913..19cf842 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 _0xbaf0=['getOfflineMessages','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','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','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','UserProfileResource','destroy','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','key','VIRTUAL','field','filter','includeAll','include','rows','show','params','options','create','body','user','ChatWebsites','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','agentAvatar','addCustomerAvatar','customerAvatar','filename','addSystemAvatar','systemAvatar','join','root','sitepic','getLicense','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','account','applications','Applications','orderBy','asc','Contacts','defaults','contact','firstName','lastName','customerIp','browser','version','format','%s\x20%s','unknown','device','vendor','type','stringify','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','CompanyId','mapKeyOffline','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','findOne','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','License','increment','all','some','x-forwarded-for','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','addApplications','sequelize','ChatApplication','bulkCreate','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey'];(function(_0x16d88b,_0x178d31){var _0x506f20=function(_0x55096b){while(--_0x55096b){_0x16d88b['push'](_0x16d88b['shift']());}};_0x506f20(++_0x178d31);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 authService=require(_0x0baf('0x12'));var hardwareService=require(_0x0baf('0x13'));var Redis=require(_0x0baf('0x14'));var qs=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('./chatWebsite.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});var client9003=jayson[_0x0baf('0x1f')][_0x0baf('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x4f80a8,_0x4cd79d,_0x2312c7,_0x38395b){return new BPromise(function(_0x283408,_0x3d83a3){var _0x2cf7da=_0x38395b||client;return _0x2cf7da[_0x0baf('0x21')](_0x4f80a8,_0x2312c7)['then'](function(_0x63c820){logger[_0x0baf('0x22')](_0x0baf('0x23'),_0x4cd79d,_0x0baf('0x24'));logger[_0x0baf('0x25')](_0x0baf('0x26'),_0x4cd79d,'request\x20sent',JSON['stringify'](_0x63c820));if(_0x63c820[_0x0baf('0x27')]){if(_0x63c820[_0x0baf('0x27')][_0x0baf('0x28')]===0x1f4){logger[_0x0baf('0x27')](_0x0baf('0x23'),_0x4cd79d,_0x63c820[_0x0baf('0x27')][_0x0baf('0x29')]);return _0x3d83a3(_0x63c820[_0x0baf('0x27')][_0x0baf('0x29')]);}logger[_0x0baf('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x4cd79d,_0x63c820[_0x0baf('0x27')]['message']);return _0x283408(_0x63c820[_0x0baf('0x27')]['message']);}else{logger['info'](_0x0baf('0x23'),_0x4cd79d,'request\x20sent');_0x283408(_0x63c820['result'][_0x0baf('0x29')]);}})[_0x0baf('0x2a')](function(_0x34e264){logger[_0x0baf('0x27')](_0x0baf('0x23'),_0x4cd79d,_0x34e264);_0x3d83a3(_0x34e264);});});}function respondWithStatusCode(_0x56b299,_0x448617){_0x448617=_0x448617||0xcc;return function(_0x4681c5){if(_0x4681c5){return _0x56b299[_0x0baf('0x2b')](_0x448617);}return _0x56b299[_0x0baf('0x2c')](_0x448617)[_0x0baf('0x2d')]();};}function respondWithResult(_0x3b9b31,_0x453525){_0x453525=_0x453525||0xc8;return function(_0x549fd0){if(_0x549fd0){return _0x3b9b31[_0x0baf('0x2c')](_0x453525)[_0x0baf('0x2e')](_0x549fd0);}};}function respondWithFilteredResult(_0xcaf13d,_0x265915){return function(_0x55c715){if(_0x55c715){var _0x29dbdf=_0x55c715[_0x0baf('0x2f')],_0x34a58a=_0x265915[_0x0baf('0x30')],_0x5d9d7f=_0x265915[_0x0baf('0x30')]+_0x265915[_0x0baf('0x31')],_0x44ec31;if(_0x5d9d7f>=_0x29dbdf){_0x5d9d7f=_0x29dbdf;_0x44ec31=0xc8;}else{_0x44ec31=0xce;}_0xcaf13d[_0x0baf('0x2c')](_0x44ec31);return _0xcaf13d[_0x0baf('0x32')]('Content-Range',_0x34a58a+'-'+_0x5d9d7f+'/'+_0x29dbdf)[_0x0baf('0x2e')](_0x55c715);}return null;};}function patchUpdates(_0x156ed7){return function(_0x37be4e){try{jsonpatch[_0x0baf('0x33')](_0x37be4e,_0x156ed7,!![]);}catch(_0x24ecee){return BPromise[_0x0baf('0x34')](_0x24ecee);}return _0x37be4e[_0x0baf('0x35')]();};}function saveUpdates(_0x2f0a45,_0x59431b){return function(_0x3ded64){if(_0x3ded64){return _0x3ded64[_0x0baf('0x36')](_0x2f0a45)[_0x0baf('0x37')](function(_0x45294a){return _0x45294a;});}return null;};}function removeEntity(_0x3a3353,_0x57a6bb){return function(_0x2fd426){if(_0x2fd426){return _0x2fd426['destroy']()[_0x0baf('0x37')](function(){var _0x2b205b=_0x2fd426[_0x0baf('0x38')]({'plain':!![]});var _0x3d65f2='ChatWebsites';return db[_0x0baf('0x39')][_0x0baf('0x3a')]({'where':{'type':_0x3d65f2,'resourceId':_0x2b205b['id']}})['then'](function(){return _0x2fd426;});})[_0x0baf('0x37')](function(){_0x3a3353[_0x0baf('0x2c')](0xcc)[_0x0baf('0x2d')]();});}};}function handleEntityNotFound(_0xbaa9a7,_0x1f60bd){return function(_0x1b0991){if(!_0x1b0991){_0xbaa9a7[_0x0baf('0x2b')](0x194);}return _0x1b0991;};}function handleError(_0x675461,_0x4aa6ed){_0x4aa6ed=_0x4aa6ed||0x1f4;return function(_0x7e765b){logger[_0x0baf('0x27')](_0x7e765b['stack']);if(_0x7e765b[_0x0baf('0x3b')]){delete _0x7e765b['name'];}_0x675461['status'](_0x4aa6ed)[_0x0baf('0x3c')](_0x7e765b);};}exports[_0x0baf('0x3d')]=function(_0x5d3ad1,_0x49e792){var _0x628603={'include':[{'model':db[_0x0baf('0x3e')],'as':_0x0baf('0x3f')}]},_0x2243f1={},_0x3412bc={'count':0x0,'rows':[]};var _0x2028ad=db[_0x0baf('0x40')][_0x0baf('0x41')];_0x2243f1[_0x0baf('0x42')]=_[_0x0baf('0x43')](_0x2028ad);_0x2243f1[_0x0baf('0x44')]=_[_0x0baf('0x43')](_0x5d3ad1[_0x0baf('0x44')]);_0x2243f1[_0x0baf('0x45')]=_['intersection'](_0x2243f1[_0x0baf('0x42')],_0x2243f1[_0x0baf('0x44')]);_0x628603['attributes']=_[_0x0baf('0x46')](_0x2243f1[_0x0baf('0x42')],qs[_0x0baf('0x47')](_0x5d3ad1[_0x0baf('0x44')][_0x0baf('0x47')]));_0x628603[_0x0baf('0x48')]=_0x628603['attributes'][_0x0baf('0x49')]?_0x628603[_0x0baf('0x48')]:_0x2243f1['model'];if(!_0x5d3ad1[_0x0baf('0x44')][_0x0baf('0x4a')](_0x0baf('0x4b'))){_0x628603[_0x0baf('0x31')]=qs['limit'](_0x5d3ad1[_0x0baf('0x44')][_0x0baf('0x31')]);_0x628603[_0x0baf('0x30')]=qs[_0x0baf('0x30')](_0x5d3ad1[_0x0baf('0x44')][_0x0baf('0x30')]);}_0x628603[_0x0baf('0x4c')]=qs[_0x0baf('0x4d')](_0x5d3ad1[_0x0baf('0x44')][_0x0baf('0x4d')]);_0x628603['where']=qs[_0x0baf('0x45')](_[_0x0baf('0x4e')](_0x5d3ad1[_0x0baf('0x44')],_0x2243f1[_0x0baf('0x45')]));if(_0x5d3ad1[_0x0baf('0x44')]['filter']){_0x628603[_0x0baf('0x4f')]=_[_0x0baf('0x50')](_0x628603[_0x0baf('0x4f')],{'$or':_[_0x0baf('0x51')](_0x2028ad,function(_0x35b5db){if(_0x35b5db['type'][_0x0baf('0x52')]!==_0x0baf('0x53')){var _0x2fd9bb={};_0x2fd9bb[_0x35b5db[_0x0baf('0x54')]]={'$like':'%'+_0x5d3ad1[_0x0baf('0x44')][_0x0baf('0x55')]+'%'};return _0x2fd9bb;}})});}_0x628603=_[_0x0baf('0x50')]({},_0x628603,_0x5d3ad1['options']);var _0x399be0={'where':_0x628603[_0x0baf('0x4f')]};return db[_0x0baf('0x40')]['count'](_0x399be0)[_0x0baf('0x37')](function(_0x2222b6){_0x3412bc[_0x0baf('0x2f')]=_0x2222b6;if(_0x5d3ad1[_0x0baf('0x44')][_0x0baf('0x56')]){_0x628603[_0x0baf('0x57')]=[{'all':!![]}];}return db[_0x0baf('0x40')]['findAll'](_0x628603);})[_0x0baf('0x37')](function(_0x428c9b){_0x3412bc[_0x0baf('0x58')]=_0x428c9b;return _0x3412bc;})[_0x0baf('0x37')](respondWithFilteredResult(_0x49e792,_0x628603))[_0x0baf('0x2a')](handleError(_0x49e792,null));};exports[_0x0baf('0x59')]=function(_0x40d4a6,_0x1af4aa){var _0x2be7fe={'raw':![],'where':{'id':_0x40d4a6[_0x0baf('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x19c008={};_0x19c008[_0x0baf('0x42')]=_[_0x0baf('0x43')](db[_0x0baf('0x40')][_0x0baf('0x41')]);_0x19c008[_0x0baf('0x44')]=_[_0x0baf('0x43')](_0x40d4a6[_0x0baf('0x44')]);_0x19c008['filters']=_[_0x0baf('0x46')](_0x19c008[_0x0baf('0x42')],_0x19c008[_0x0baf('0x44')]);_0x2be7fe[_0x0baf('0x48')]=_[_0x0baf('0x46')](_0x19c008[_0x0baf('0x42')],qs['fields'](_0x40d4a6[_0x0baf('0x44')]['fields']));_0x2be7fe[_0x0baf('0x48')]=_0x2be7fe['attributes'][_0x0baf('0x49')]?_0x2be7fe['attributes']:_0x19c008[_0x0baf('0x42')];if(_0x40d4a6['query'][_0x0baf('0x56')]){_0x2be7fe[_0x0baf('0x57')]=[{'all':!![]}];}_0x2be7fe=_[_0x0baf('0x50')]({},_0x2be7fe,_0x40d4a6[_0x0baf('0x5b')]);return db[_0x0baf('0x40')]['find'](_0x2be7fe)[_0x0baf('0x37')](handleEntityNotFound(_0x1af4aa,null))[_0x0baf('0x37')](respondWithResult(_0x1af4aa,null))[_0x0baf('0x2a')](handleError(_0x1af4aa,null));};exports[_0x0baf('0x5c')]=function(_0x5fbabf,_0xa19b21){return db['ChatWebsite'][_0x0baf('0x5c')](_0x5fbabf[_0x0baf('0x5d')],{})[_0x0baf('0x37')](function(_0xabafaa){var _0xbc7cc2=_0x5fbabf[_0x0baf('0x5e')][_0x0baf('0x38')]({'plain':!![]});if(!_0xbc7cc2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbc7cc2['role']===_0x0baf('0x5e')){var _0x11e18a=_0xabafaa[_0x0baf('0x38')]({'plain':!![]});var _0x337d94=_0x0baf('0x5f');return db[_0x0baf('0x60')][_0x0baf('0x61')]({'where':{'name':_0x337d94,'userProfileId':_0xbc7cc2[_0x0baf('0x62')]},'raw':!![]})[_0x0baf('0x37')](function(_0x585969){if(_0x585969&&_0x585969[_0x0baf('0x63')]===0x0){return db[_0x0baf('0x39')][_0x0baf('0x5c')]({'name':_0x11e18a[_0x0baf('0x3b')],'resourceId':_0x11e18a['id'],'type':_0x585969[_0x0baf('0x3b')],'sectionId':_0x585969['id']},{})[_0x0baf('0x37')](function(){return _0xabafaa;});}else{return _0xabafaa;}})[_0x0baf('0x2a')](function(_0x51d75f){logger[_0x0baf('0x27')](_0x0baf('0x64'),_0x51d75f);throw _0x51d75f;});}return _0xabafaa;})[_0x0baf('0x37')](respondWithResult(_0xa19b21,0xc9))[_0x0baf('0x2a')](handleError(_0xa19b21,null));};exports[_0x0baf('0x36')]=function(_0x1a6d22,_0x14e6d0){if(_0x1a6d22[_0x0baf('0x5d')]['id']){delete _0x1a6d22['body']['id'];}return db[_0x0baf('0x40')]['find']({'where':{'id':_0x1a6d22[_0x0baf('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x0baf('0x37')](handleEntityNotFound(_0x14e6d0,null))['then'](saveUpdates(_0x1a6d22[_0x0baf('0x5d')],null))[_0x0baf('0x37')](respondWithResult(_0x14e6d0,null))['catch'](handleError(_0x14e6d0,null));};exports[_0x0baf('0x3a')]=function(_0xfb6708,_0x156572){return db['ChatWebsite']['find']({'where':{'id':_0xfb6708[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x156572,null))[_0x0baf('0x37')](removeEntity(_0x156572,null))[_0x0baf('0x2a')](handleError(_0x156572,null));};exports[_0x0baf('0x65')]=function(_0x588b88,_0x1e669a){return db['ChatWebsite']['describe']()['then'](respondWithResult(_0x1e669a,null))[_0x0baf('0x2a')](handleError(_0x1e669a,null));};exports['addDisposition']=function(_0x4946d4,_0x11a81e,_0x288f17){if(_0x4946d4[_0x0baf('0x5d')]['id']){delete _0x4946d4[_0x0baf('0x5d')]['id'];}return db[_0x0baf('0x40')][_0x0baf('0x61')]({'where':{'id':_0x4946d4['params']['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x11a81e,null))[_0x0baf('0x37')](function(_0x185473){if(_0x185473){_0x4946d4[_0x0baf('0x5d')][_0x0baf('0x66')]=_0x185473['id'];return db[_0x0baf('0x67')]['create'](_0x4946d4[_0x0baf('0x5d')]);}})[_0x0baf('0x37')](respondWithResult(_0x11a81e,null))[_0x0baf('0x2a')](handleError(_0x11a81e,null));};exports['getDispositions']=function(_0x89484d,_0x1e474f,_0x3d333d){var _0x2c20fe={'raw':![],'where':{}};var _0x125906={};var _0x27a959={'count':0x0,'rows':[]};return db[_0x0baf('0x40')]['findOne']({'where':{'id':_0x89484d['params']['id']}})['then'](handleEntityNotFound(_0x1e474f,null))[_0x0baf('0x37')](function(_0x89bec7){if(_0x89bec7){_0x125906[_0x0baf('0x42')]=_[_0x0baf('0x43')](db[_0x0baf('0x67')][_0x0baf('0x41')]);_0x125906['query']=_['keys'](_0x89484d[_0x0baf('0x44')]);_0x125906['filters']=_[_0x0baf('0x46')](_0x125906[_0x0baf('0x42')],_0x125906['query']);_0x2c20fe[_0x0baf('0x48')]=_[_0x0baf('0x46')](_0x125906[_0x0baf('0x42')],qs[_0x0baf('0x47')](_0x89484d[_0x0baf('0x44')][_0x0baf('0x47')]));_0x2c20fe[_0x0baf('0x48')]=_0x2c20fe[_0x0baf('0x48')][_0x0baf('0x49')]?_0x2c20fe['attributes']:_0x125906['model'];if(!_0x89484d['query']['hasOwnProperty']('nolimit')){_0x2c20fe[_0x0baf('0x31')]=qs[_0x0baf('0x31')](_0x89484d[_0x0baf('0x44')][_0x0baf('0x31')]);_0x2c20fe['offset']=qs[_0x0baf('0x30')](_0x89484d[_0x0baf('0x44')]['offset']);}_0x2c20fe['order']=qs[_0x0baf('0x4d')](_0x89484d[_0x0baf('0x44')][_0x0baf('0x4d')]);_0x2c20fe[_0x0baf('0x4f')]=qs[_0x0baf('0x45')](_[_0x0baf('0x4e')](_0x89484d[_0x0baf('0x44')],_0x125906[_0x0baf('0x45')]));_0x2c20fe['where'][_0x0baf('0x66')]=_0x89bec7['id'];if(_0x89484d[_0x0baf('0x44')]['filter']){_0x2c20fe[_0x0baf('0x4f')]=_[_0x0baf('0x50')](_0x2c20fe['where'],{'$or':_[_0x0baf('0x51')](_0x2c20fe[_0x0baf('0x48')],function(_0x421ca0){var _0x2baede={};_0x2baede[_0x421ca0]={'$like':'%'+_0x89484d[_0x0baf('0x44')]['filter']+'%'};return _0x2baede;})});}_0x2c20fe=_['merge']({},_0x2c20fe,_0x89484d[_0x0baf('0x5b')]);return db[_0x0baf('0x67')]['count']({'where':_0x2c20fe[_0x0baf('0x4f')]})[_0x0baf('0x37')](function(_0x21ad25){_0x27a959['count']=_0x21ad25;if(_0x89484d[_0x0baf('0x44')][_0x0baf('0x56')]){_0x2c20fe[_0x0baf('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x0baf('0x68')](_0x2c20fe);})['then'](function(_0x316397){_0x27a959[_0x0baf('0x58')]=_0x316397;return _0x27a959;});}})[_0x0baf('0x37')](respondWithFilteredResult(_0x1e474f,_0x2c20fe))[_0x0baf('0x2a')](handleError(_0x1e474f,null));};exports[_0x0baf('0x69')]=function(_0x52e845,_0x866e6e,_0x57f33c){var _0x5c8805;return db[_0x0baf('0x40')][_0x0baf('0x61')]({'where':{'id':_0x52e845[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x866e6e,null))[_0x0baf('0x37')](function(_0x250df2){if(_0x250df2){return _0x250df2[_0x0baf('0x69')](_0x52e845[_0x0baf('0x44')][_0x0baf('0x6a')]);}})[_0x0baf('0x37')](respondWithStatusCode(_0x866e6e,null))[_0x0baf('0x2a')](handleError(_0x866e6e,null));};exports[_0x0baf('0x6b')]=function(_0x5985f9,_0x599ac0,_0x29a036){if(_0x5985f9[_0x0baf('0x5d')]['id']){delete _0x5985f9[_0x0baf('0x5d')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x5985f9[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x599ac0,null))[_0x0baf('0x37')](function(_0x371b78){if(_0x371b78){_0x5985f9[_0x0baf('0x5d')][_0x0baf('0x66')]=_0x371b78['id'];return db[_0x0baf('0x6c')][_0x0baf('0x5c')](_0x5985f9[_0x0baf('0x5d')]);}})['then'](respondWithResult(_0x599ac0,null))[_0x0baf('0x2a')](handleError(_0x599ac0,null));};exports[_0x0baf('0x6d')]=function(_0x1897b7,_0x2a9107,_0x4929c3){var _0x5d26e6={'raw':![],'where':{}};var _0x488b32={};var _0x15fa4c={'count':0x0,'rows':[]};return db[_0x0baf('0x40')]['findOne']({'where':{'id':_0x1897b7['params']['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x2a9107,null))[_0x0baf('0x37')](function(_0x52e0c4){if(_0x52e0c4){_0x488b32[_0x0baf('0x42')]=_[_0x0baf('0x43')](db[_0x0baf('0x6c')][_0x0baf('0x41')]);_0x488b32[_0x0baf('0x44')]=_[_0x0baf('0x43')](_0x1897b7[_0x0baf('0x44')]);_0x488b32[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x488b32[_0x0baf('0x42')],_0x488b32[_0x0baf('0x44')]);_0x5d26e6[_0x0baf('0x48')]=_['intersection'](_0x488b32[_0x0baf('0x42')],qs[_0x0baf('0x47')](_0x1897b7[_0x0baf('0x44')][_0x0baf('0x47')]));_0x5d26e6[_0x0baf('0x48')]=_0x5d26e6[_0x0baf('0x48')]['length']?_0x5d26e6[_0x0baf('0x48')]:_0x488b32[_0x0baf('0x42')];if(!_0x1897b7[_0x0baf('0x44')][_0x0baf('0x4a')](_0x0baf('0x4b'))){_0x5d26e6['limit']=qs[_0x0baf('0x31')](_0x1897b7[_0x0baf('0x44')][_0x0baf('0x31')]);_0x5d26e6[_0x0baf('0x30')]=qs[_0x0baf('0x30')](_0x1897b7['query']['offset']);}_0x5d26e6[_0x0baf('0x4c')]=qs['sort'](_0x1897b7[_0x0baf('0x44')]['sort']);_0x5d26e6[_0x0baf('0x4f')]=qs[_0x0baf('0x45')](_[_0x0baf('0x4e')](_0x1897b7[_0x0baf('0x44')],_0x488b32['filters']));_0x5d26e6[_0x0baf('0x4f')][_0x0baf('0x66')]=_0x52e0c4['id'];if(_0x1897b7[_0x0baf('0x44')]['filter']){_0x5d26e6['where']=_['merge'](_0x5d26e6['where'],{'$or':_[_0x0baf('0x51')](_0x5d26e6[_0x0baf('0x48')],function(_0x2b7f13){var _0x450c17={};_0x450c17[_0x2b7f13]={'$like':'%'+_0x1897b7['query'][_0x0baf('0x55')]+'%'};return _0x450c17;})});}_0x5d26e6=_[_0x0baf('0x50')]({},_0x5d26e6,_0x1897b7[_0x0baf('0x5b')]);return db['CannedAnswer'][_0x0baf('0x2f')]({'where':_0x5d26e6[_0x0baf('0x4f')]})['then'](function(_0x4631fc){_0x15fa4c['count']=_0x4631fc;if(_0x1897b7[_0x0baf('0x44')][_0x0baf('0x56')]){_0x5d26e6[_0x0baf('0x57')]=[{'all':!![]}];}return db[_0x0baf('0x6c')]['findAll'](_0x5d26e6);})['then'](function(_0x2ee3cc){_0x15fa4c['rows']=_0x2ee3cc;return _0x15fa4c;});}})[_0x0baf('0x37')](respondWithFilteredResult(_0x2a9107,_0x5d26e6))[_0x0baf('0x2a')](handleError(_0x2a9107,null));};exports[_0x0baf('0x6e')]=function(_0x2094e6,_0x3131da,_0x49e05b){var _0x12991a;return db['ChatWebsite'][_0x0baf('0x61')]({'where':{'id':_0x2094e6['params']['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x3131da,null))['then'](function(_0x1832a1){if(_0x1832a1){return _0x1832a1[_0x0baf('0x6e')](_0x2094e6[_0x0baf('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x3131da,null))[_0x0baf('0x2a')](handleError(_0x3131da,null));};exports[_0x0baf('0x6f')]=function(_0x2ef33b,_0x252a15,_0x422570){_0x2ef33b[_0x0baf('0x5d')]['sitepic']=_0x2ef33b[_0x0baf('0x70')]['filename'];return db[_0x0baf('0x40')]['find']({'where':{'id':_0x2ef33b[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x252a15,null))[_0x0baf('0x37')](saveUpdates(_0x2ef33b['body'],null))[_0x0baf('0x37')](respondWithResult(_0x252a15,null))[_0x0baf('0x2a')](handleError(_0x252a15,null));};exports['addAvatar']=function(_0x544498,_0x3394ee,_0xbb5a43){_0x544498[_0x0baf('0x5d')][_0x0baf('0x71')]=_0x544498['file']['filename'];return db[_0x0baf('0x40')][_0x0baf('0x61')]({'where':{'id':_0x544498[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x3394ee,null))[_0x0baf('0x37')](saveUpdates(_0x544498[_0x0baf('0x5d')],null))[_0x0baf('0x37')](respondWithResult(_0x3394ee,null))[_0x0baf('0x2a')](handleError(_0x3394ee,null));};exports[_0x0baf('0x72')]=function(_0x2369f0,_0x58f95c,_0xdb96c0){_0x2369f0['body'][_0x0baf('0x73')]=_0x2369f0[_0x0baf('0x70')][_0x0baf('0x74')];return db[_0x0baf('0x40')]['find']({'where':{'id':_0x2369f0[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x58f95c,null))[_0x0baf('0x37')](saveUpdates(_0x2369f0[_0x0baf('0x5d')],null))[_0x0baf('0x37')](respondWithResult(_0x58f95c,null))[_0x0baf('0x2a')](handleError(_0x58f95c,null));};exports[_0x0baf('0x75')]=function(_0x205075,_0xb61593,_0x4b6cd5){_0x205075[_0x0baf('0x5d')][_0x0baf('0x76')]=_0x205075['file'][_0x0baf('0x74')];return db[_0x0baf('0x40')][_0x0baf('0x61')]({'where':{'id':_0x205075[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0xb61593,null))[_0x0baf('0x37')](saveUpdates(_0x205075[_0x0baf('0x5d')],null))[_0x0baf('0x37')](respondWithResult(_0xb61593,null))[_0x0baf('0x2a')](handleError(_0xb61593,null));};exports['getLogo']=function(_0x56c480,_0x218fc5,_0x36bfaa){var _0xee44cb=path[_0x0baf('0x77')](config[_0x0baf('0x78')],'server/files/images/logos/default_logo.png');var _0x121718={'where':{'id':_0x56c480[_0x0baf('0x5a')]['id']},'attributes':['id',_0x0baf('0x79')],'raw':!![]};var _0x5c1760=![];return require('../../config/license/util')[_0x0baf('0x7a')]()[_0x0baf('0x37')](function(_0x30896e){if(_0x30896e){_0x5c1760=_0x30896e['custom'];}})[_0x0baf('0x37')](function(){return db['ChatWebsite'][_0x0baf('0x61')](_0x121718);})['then'](handleEntityNotFound(_0x218fc5,null))[_0x0baf('0x37')](function(_0x3f2838){if(_0x3f2838){if(!_['isNil'](_0x3f2838[_0x0baf('0x79')])){if(fs[_0x0baf('0x7b')](path[_0x0baf('0x77')](config[_0x0baf('0x78')],_0x0baf('0x7c'),_0x3f2838[_0x0baf('0x79')]))&&_0x5c1760){_0xee44cb=path[_0x0baf('0x77')](config['root'],_0x0baf('0x7c'),_0x3f2838[_0x0baf('0x79')]);}}return _0x218fc5[_0x0baf('0x7d')](_0xee44cb);}})[_0x0baf('0x2a')](handleError(_0x218fc5,null));};exports[_0x0baf('0x7e')]=function(_0x6cf988,_0x66ba44,_0x1a5e23){var _0x4415c2=path[_0x0baf('0x77')](config[_0x0baf('0x78')],_0x0baf('0x7f'));var _0x1390cd={'where':{'id':_0x6cf988[_0x0baf('0x5a')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0x0baf('0x61')](_0x1390cd)[_0x0baf('0x37')](handleEntityNotFound(_0x66ba44,null))[_0x0baf('0x37')](function(_0x41d397){if(_0x41d397){if(!_['isNil'](_0x41d397[_0x0baf('0x71')])){if(fs[_0x0baf('0x7b')](path[_0x0baf('0x77')](config[_0x0baf('0x78')],_0x0baf('0x80'),_0x41d397[_0x0baf('0x71')]))){_0x4415c2=path['join'](config[_0x0baf('0x78')],_0x0baf('0x80'),_0x41d397[_0x0baf('0x71')]);}}return _0x66ba44['download'](_0x4415c2);}})[_0x0baf('0x2a')](handleError(_0x66ba44,null));};exports[_0x0baf('0x81')]=function(_0x331469,_0x500a91,_0x4f7145){var _0x535440=path[_0x0baf('0x77')](config['root'],_0x0baf('0x82'));var _0x29b824={'where':{'id':_0x331469['params']['id']},'attributes':['id',_0x0baf('0x73'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0x0baf('0x61')](_0x29b824)['then'](handleEntityNotFound(_0x500a91,null))[_0x0baf('0x37')](function(_0x5ed9f1){if(_0x5ed9f1){if(!_['isNil'](_0x5ed9f1['customerAvatar'])){if(fs[_0x0baf('0x7b')](path[_0x0baf('0x77')](config[_0x0baf('0x78')],_0x0baf('0x80'),_0x5ed9f1[_0x0baf('0x73')]))&&_0x5ed9f1[_0x0baf('0x83')]){_0x535440=path[_0x0baf('0x77')](config['root'],_0x0baf('0x80'),_0x5ed9f1[_0x0baf('0x73')]);}}return _0x500a91[_0x0baf('0x7d')](_0x535440);}})['catch'](handleError(_0x500a91,null));};exports[_0x0baf('0x84')]=function(_0x1e78d6,_0x12311d,_0x52c7f7){var _0x25eccd=path['join'](config[_0x0baf('0x78')],_0x0baf('0x85'));var _0x57846e={'where':{'id':_0x1e78d6[_0x0baf('0x5a')]['id']},'attributes':['id',_0x0baf('0x76')],'raw':!![]};return db[_0x0baf('0x40')][_0x0baf('0x61')](_0x57846e)['then'](handleEntityNotFound(_0x12311d,null))[_0x0baf('0x37')](function(_0x39eb13){if(_0x39eb13){if(!_['isNil'](_0x39eb13['systemAvatar'])){if(fs[_0x0baf('0x7b')](path[_0x0baf('0x77')](config[_0x0baf('0x78')],_0x0baf('0x80'),_0x39eb13['systemAvatar']))){_0x25eccd=path['join'](config[_0x0baf('0x78')],_0x0baf('0x80'),_0x39eb13[_0x0baf('0x76')]);}}return _0x12311d[_0x0baf('0x7d')](_0x25eccd);}})[_0x0baf('0x2a')](handleError(_0x12311d,null));};exports['notify']=function(_0x419b7f,_0x40ca16,_0x4a4f9c){var _0x24f84d=require(_0x0baf('0x86'));var _0x56565d=new _0x24f84d();var _0x1382d2=_0x56565d[_0x0baf('0x87')](_0x419b7f[_0x0baf('0x88')][_0x0baf('0x89')])[_0x0baf('0x8a')]();var _0x359991={'body':_0x419b7f[_0x0baf('0x5d')],'channel':_0x0baf('0x8b')};var _0x5143a5=[];var _0x23049d=[];var _0x25f184={};var _0x226edd=![];return db[_0x0baf('0x8c')]['describe']()[_0x0baf('0x37')](function(_0x108909){if(!_0x108909){throw new db['Sequelize'][(_0x0baf('0x8d'))](_0x0baf('0x8e'));}_0x5143a5=_[_0x0baf('0x8f')](_[_0x0baf('0x43')](_0x108909),['createdAt',_0x0baf('0x90')]);_0x23049d=_[_0x0baf('0x8f')](_[_0x0baf('0x43')](_0x108909),[_0x0baf('0x91'),_0x0baf('0x90'),'CompanyId',_0x0baf('0x92')]);if(_0x419b7f[_0x0baf('0x5d')]['id']){delete _0x419b7f[_0x0baf('0x5d')]['id'];}if(_['isNil'](_0x419b7f[_0x0baf('0x5d')][_0x0baf('0x93')])){throw new db[(_0x0baf('0x94'))][(_0x0baf('0x8d'))](_0x0baf('0x95'));}if(_['isNil'](_0x419b7f['body'][_0x0baf('0x5d')])||_0x419b7f[_0x0baf('0x5d')][_0x0baf('0x5d')]===''){throw new db['Sequelize'][(_0x0baf('0x8d'))](_0x0baf('0x96'));}if(_[_0x0baf('0x97')](_0x419b7f[_0x0baf('0x5d')][_0x0baf('0x98')])){throw new db[(_0x0baf('0x94'))][(_0x0baf('0x8d'))](_0x0baf('0x99')+_0x23049d);}if(!_[_0x0baf('0x9a')](_0x23049d,_0x419b7f[_0x0baf('0x5d')]['mapKey'])){throw new db[(_0x0baf('0x94'))][(_0x0baf('0x8d'))](_0x0baf('0x9b')+_0x23049d);}_0x25f184[_0x419b7f[_0x0baf('0x5d')]['mapKey']]=_0x419b7f[_0x0baf('0x5d')][_0x0baf('0x93')];})[_0x0baf('0x37')](function(){return db['ChatWebsite'][_0x0baf('0x61')]({'where':{'id':_0x419b7f[_0x0baf('0x5a')]['id']},'include':[{'model':db[_0x0baf('0x9c')],'as':_0x0baf('0x9d'),'include':[{'model':db[_0x0baf('0x8c')],'as':'Contacts','where':_0x25f184,'limit':0x1,'order':[[_0x0baf('0x90'),_0x0baf('0x9e')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x0baf('0x37')](handleEntityNotFound(_0x40ca16,null))[_0x0baf('0x37')](function(_0x10f378){if(_0x10f378&&_0x10f378[_0x0baf('0x9d')]){_0x359991[_0x0baf('0x9f')]=_0x10f378;_0x359991[_0x0baf('0xa0')]=_0x10f378[_0x0baf('0xa1')];_0x359991['list']=_0x10f378['List'];_0x359991[_0x0baf('0xa0')]=_[_0x0baf('0xa2')](_0x359991[_0x0baf('0xa0')],['priority'],[_0x0baf('0xa3')]);if(_0x359991[_0x0baf('0x9f')]['Applications']){delete _0x359991[_0x0baf('0x9f')][_0x0baf('0xa1')];}if(_0x359991['account'][_0x0baf('0x9d')]&&_0x359991[_0x0baf('0x9f')][_0x0baf('0x9d')]['Contacts'][_0x0baf('0x49')]){return _0x359991[_0x0baf('0x9f')][_0x0baf('0x9d')][_0x0baf('0xa4')][0x0];}var _0x3021f7=_[_0x0baf('0xa5')](_0x419b7f[_0x0baf('0x5d')],{'firstName':_0x419b7f['body'][_0x0baf('0x93')],'ListId':_0x10f378['ListId']});_0x3021f7[_0x419b7f[_0x0baf('0x5d')][_0x0baf('0x98')]]=_0x419b7f['body']['from'];return db[_0x0baf('0x8c')][_0x0baf('0x5c')](_0x3021f7,{'fields':_0x5143a5,'raw':!![]});}})[_0x0baf('0x37')](handleEntityNotFound(_0x40ca16,null))['then'](function(_0x24d854){_0x359991[_0x0baf('0xa6')]=_0x24d854;if(_0x24d854){var _0x67acc7={'ContactId':_0x24d854['id'],'ChatWebsiteId':_0x419b7f[_0x0baf('0x5a')]['id'],'from':(_0x24d854[_0x0baf('0xa7')]||'')+'\x20'+(_0x24d854[_0x0baf('0xa8')]||''),'customerIp':_0x419b7f[_0x0baf('0x5d')][_0x0baf('0xa9')],'referer':_0x419b7f['body']['referer'],'browserName':_0x1382d2[_0x0baf('0xaa')][_0x0baf('0x3b')]&&_0x1382d2['browser'][_0x0baf('0xab')]?util[_0x0baf('0xac')](_0x0baf('0xad'),_0x1382d2[_0x0baf('0xaa')][_0x0baf('0x3b')],_0x1382d2[_0x0baf('0xaa')][_0x0baf('0xab')]):'unknown','browserVersion':_0x1382d2[_0x0baf('0xaa')]['version']||_0x0baf('0xae'),'osName':util[_0x0baf('0xac')]('%s\x20%s',_0x1382d2['os']['name'],_0x1382d2['os'][_0x0baf('0xab')]),'osVersion':_0x1382d2['os'][_0x0baf('0xab')],'deviceModel':_0x1382d2[_0x0baf('0xaf')][_0x0baf('0x42')]&&_0x1382d2[_0x0baf('0xaf')][_0x0baf('0xb0')]?util[_0x0baf('0xac')]('%s\x20%s\x20%s',_0x1382d2['device']['model'],_0x1382d2[_0x0baf('0xaf')]['vendor'],_0x1382d2[_0x0baf('0xaf')][_0x0baf('0xb1')]):null,'deviceVendor':_0x1382d2['device']['vendor'],'deviceType':_0x1382d2[_0x0baf('0xaf')][_0x0baf('0xb1')],'formData':JSON[_0x0baf('0xb2')](_0x419b7f[_0x0baf('0x5d')])};var _0x32553b={'ChatWebsiteId':_0x419b7f['params']['id'],'closed':![]};if(_0x419b7f[_0x0baf('0x5d')][_0x0baf('0xb3')]){_0x32553b[_0x0baf('0xb3')]=_0x419b7f[_0x0baf('0x5d')][_0x0baf('0xb3')];return db[_0x0baf('0xb4')]['find']({'where':_0x32553b})[_0x0baf('0x37')](function(_0x149438){if(_0x149438){return[_0x149438,![]];}_0x67acc7[_0x0baf('0xb3')]=_0x419b7f['body'][_0x0baf('0xb3')];_0x67acc7[_0x0baf('0xb5')]=_0x419b7f['body'][_0x0baf('0xb5')];return db[_0x0baf('0xb4')][_0x0baf('0x5c')](_0x67acc7)[_0x0baf('0x37')](function(_0x51c98c){return[_0x51c98c,!![]];});});}_0x32553b['ContactId']=_0x24d854['id'];if(_0x419b7f[_0x0baf('0x5d')][_0x0baf('0xb6')]&&_0x419b7f['body'][_0x0baf('0xb6')]['id']){_0x32553b['id']=_0x419b7f[_0x0baf('0x5d')][_0x0baf('0xb6')]['id'];return db[_0x0baf('0xb4')][_0x0baf('0x61')]({'where':_0x32553b})['then'](function(_0x9249ea){if(_0x9249ea){return[_0x9249ea,![]];}return db[_0x0baf('0xb4')][_0x0baf('0x5c')](_0x67acc7)[_0x0baf('0x37')](function(_0x51287e){return[_0x51287e,!![]];});});}return db[_0x0baf('0xb4')]['create'](_0x67acc7)[_0x0baf('0x37')](function(_0x2bf5c7){return[_0x2bf5c7,!![]];});}})[_0x0baf('0xb7')](function(_0x4f0772,_0x1cdd2d){if(_0x4f0772){_0x226edd=_0x1cdd2d;if(!_0x1cdd2d){var _0x2b8a88={'from':(_0x359991[_0x0baf('0xa6')][_0x0baf('0xa7')]||'')+'\x20'+(_0x359991[_0x0baf('0xa6')][_0x0baf('0xa8')]||'')};if(_0x419b7f[_0x0baf('0x5d')][_0x0baf('0xb3')]&&_0x419b7f[_0x0baf('0x5d')][_0x0baf('0xb8')]&&_0x419b7f[_0x0baf('0x5d')][_0x0baf('0xb3')]!=_0x419b7f['body']['messageId']){_0x2b8a88[_0x0baf('0xb3')]=_0x419b7f['body']['messageId'];}return _0x4f0772['update'](_0x2b8a88);}else{return _0x4f0772;}}})['then'](function(_0x1886e7){_0x359991[_0x0baf('0xb6')]=_0x1886e7['get']({'plain':!![]});_0x359991['interaction']['created']=_0x226edd;if(_0x359991['interaction'][_0x0baf('0xb9')]){if(_0x359991['account'][_0x0baf('0xba')]){_0x359991[_0x0baf('0xa0')][_0x0baf('0xbb')]({'id':0x0,'priority':_0x359991[_0x0baf('0xa0')][_0x0baf('0x49')]+0x1,'app':_0x0baf('0xbc'),'appdata':_0x0baf('0xbd'),'interval':_0x0baf('0xbe')});}}return db['ChatMessage']['create']({'body':_0x419b7f[_0x0baf('0x5d')][_0x0baf('0x5d')],'ChatWebsiteId':_0x419b7f['params']['id'],'ChatInteractionId':_0x1886e7['id'],'direction':'in','ContactId':_0x359991[_0x0baf('0xa6')]['id'],'AttachmentId':_0x419b7f['body'][_0x0baf('0xbf')]});})['then'](function(_0x5a673d){_0x359991[_0x0baf('0x29')]=_0x5a673d;if(_0x359991[_0x0baf('0xb6')][_0x0baf('0xc0')]){return db[_0x0baf('0xc1')][_0x0baf('0x61')]({'attributes':['id',_0x0baf('0x3b')],'where':{'id':_0x359991[_0x0baf('0xb6')][_0x0baf('0xc0')]}})[_0x0baf('0x37')](function(_0x3348c6){if(_0x3348c6){_0x359991[_0x0baf('0xa0')][_0x0baf('0xc2')]({'id':0x0,'priority':0x0,'app':_0x0baf('0xc3'),'appdata':_0x3348c6[_0x0baf('0x3b')]+','+(_0x359991[_0x0baf('0x9f')][_0x0baf('0xc4')]||0xa),'interval':'*,*,*,*'});_0x359991[_0x0baf('0xc5')]=!![];}return respondWithRpcPromise(_0x0baf('0xc6'),'startRouting',_0x359991);});}return respondWithRpcPromise(_0x0baf('0xc6'),_0x0baf('0xc7'),_0x359991);})['then'](function(_0x186d83){respondWithRpcPromise('EventManager',_0x0baf('0xc8'),{'event':'notify','message':_0x186d83},client9002);return _0x186d83;})[_0x0baf('0x37')](respondWithResult(_0x40ca16,null))['catch'](handleError(_0x40ca16,null));};exports[_0x0baf('0xc9')]=function(_0x298cb5,_0x45015b,_0xc33363){var _0x5631b2,_0x3d5352,_0x43afc9;var _0x2a207a=[];var _0x28ab7b=[];var _0x49adaf={};return db['CmContact'][_0x0baf('0x65')]()[_0x0baf('0x37')](function(_0xe35e55){if(!_0xe35e55){throw new db[(_0x0baf('0x94'))]['ValidationError'](_0x0baf('0x8e'));}_0x28ab7b=_[_0x0baf('0x8f')](_[_0x0baf('0x43')](_0xe35e55),['createdAt','updatedAt']);_0x2a207a=_[_0x0baf('0x8f')](_['keys'](_0xe35e55),[_0x0baf('0x91'),'updatedAt',_0x0baf('0xca'),_0x0baf('0x92')]);if(_0x298cb5[_0x0baf('0x5d')]['id']){delete _0x298cb5['body']['id'];}if(_[_0x0baf('0x97')](_0x298cb5[_0x0baf('0x5d')]['from'])){throw _0x45015b['status'](0x1f4)[_0x0baf('0x3c')](new db['Sequelize'][(_0x0baf('0x8d'))](_0x0baf('0x95')));}if(_['isNil'](_0x298cb5['body'][_0x0baf('0x5d')])||_0x298cb5[_0x0baf('0x5d')]['body']===''){throw _0x45015b[_0x0baf('0x2c')](0x1f4)['send'](new db[(_0x0baf('0x94'))][(_0x0baf('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0baf('0x97')](_0x298cb5[_0x0baf('0x5d')][_0x0baf('0xcb')])){throw _0x45015b[_0x0baf('0x2c')](0x1f4)[_0x0baf('0x3c')](new db['Sequelize'][(_0x0baf('0x8d'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a207a));}if(!_['includes'](_0x2a207a,_0x298cb5['body'][_0x0baf('0xcb')])){throw _0x45015b[_0x0baf('0x2c')](0x1f4)['send'](new db[(_0x0baf('0x94'))][(_0x0baf('0x8d'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a207a));}_0x49adaf[_0x298cb5[_0x0baf('0x5d')][_0x0baf('0xcb')]]=_0x298cb5[_0x0baf('0x5d')][_0x0baf('0x93')];})[_0x0baf('0x37')](function(){return db[_0x0baf('0x40')][_0x0baf('0x61')]({'where':{'id':_0x298cb5[_0x0baf('0x5a')]['id']},'include':[{'model':db[_0x0baf('0x9c')],'as':_0x0baf('0x9d')}]});})['then'](handleEntityNotFound(_0x45015b,null))[_0x0baf('0x37')](function(_0x3a3675){if(_0x3a3675&&_0x3a3675[_0x0baf('0x9d')]){_0x3d5352=_0x3a3675;var _0x3457a9=_[_0x0baf('0xa5')](_0x298cb5['body'],{'firstName':_0x298cb5[_0x0baf('0x5d')]['from'],'phone':_0x298cb5[_0x0baf('0x5d')][_0x0baf('0x93')],'ListId':_0x3a3675[_0x0baf('0x92')]});_0x3457a9[_0x298cb5[_0x0baf('0x5d')][_0x0baf('0xcb')]]=_0x298cb5[_0x0baf('0x5d')][_0x0baf('0x93')];return db['CmContact'][_0x0baf('0xcc')]({'where':_0x49adaf,'defaults':_0x3457a9});}})[_0x0baf('0xb7')](function(_0x4750b3){if(_0x4750b3){_0x43afc9=_0x4750b3;var _0x4582cf=fs[_0x0baf('0xcd')](path[_0x0baf('0x77')](config[_0x0baf('0x78')],_0x0baf('0xce')),_0x0baf('0xcf'));var _0x1ee4c7=ejs[_0x0baf('0xd0')](_0x4582cf,{'body':_[_0x0baf('0xd1')](_0x298cb5[_0x0baf('0x5d')][_0x0baf('0x5d')]),'bodyTitle':_0x3d5352[_0x0baf('0xd2')]});return db[_0x0baf('0xd3')][_0x0baf('0x5c')]({'body':_0x1ee4c7,'ContactId':_0x4750b3['id'],'ChatWebsiteId':_0x3d5352['id']});}})[_0x0baf('0x37')](function(_0x5b1ca0){if(_0x5b1ca0){_0x5631b2=_0x5b1ca0;return db[_0x0baf('0xd4')][_0x0baf('0xd5')]({'where':{'service':!![]},'include':[{'model':db[_0x0baf('0xd6')],'as':_0x0baf('0xd7'),'raw':!![]}]});}})[_0x0baf('0x37')](function(_0x23be9d){if(_0x23be9d&&_0x23be9d[_0x0baf('0xd7')]&&_0x3d5352['forwardOfflineAddress']){var _0xa7a73a={'tls':{'rejectUnauthorized':![]}};if(_0x23be9d[_0x0baf('0xd7')][_0x0baf('0xd8')]){_0xa7a73a[_0x0baf('0xd8')]=_0x23be9d[_0x0baf('0xd7')][_0x0baf('0xd8')];}else{_0xa7a73a[_0x0baf('0xd9')]=_0x23be9d['Smtp'][_0x0baf('0xd9')];_0xa7a73a[_0x0baf('0xda')]=_0x23be9d[_0x0baf('0xd7')][_0x0baf('0xda')];_0xa7a73a[_0x0baf('0xdb')]=_0x23be9d[_0x0baf('0xd7')]['secure'];}if(_0x23be9d[_0x0baf('0xd7')][_0x0baf('0xdc')]){_0xa7a73a[_0x0baf('0xdd')]={'user':_0x23be9d[_0x0baf('0xd7')][_0x0baf('0x5e')],'pass':_0x23be9d['Smtp']['pass']};}return respondWithRpcPromise(_0x0baf('0xde'),_0x0baf('0xdf'),{'account':_0xa7a73a,'message':{'from':util[_0x0baf('0xac')](_0x0baf('0xe0'),_0x23be9d[_0x0baf('0x3b')],_0x23be9d[_0x0baf('0xe1')]||_0x23be9d[_0x0baf('0xd7')][_0x0baf('0x5e')]),'to':_0x3d5352[_0x0baf('0xe2')],'subject':_0x3d5352[_0x0baf('0xe3')],'text':_0x5631b2[_0x0baf('0x5d')]}},client9003)[_0x0baf('0x37')](function(){return _0x5631b2;})[_0x0baf('0x2a')](function(_0x1b256f){console[_0x0baf('0x27')](_0x1b256f);});}})[_0x0baf('0x37')](function(){if(_0x5631b2){return _0x5631b2;}})[_0x0baf('0x37')](respondWithResult(_0x45015b,null))[_0x0baf('0x2a')](handleError(_0x45015b,null));};exports[_0x0baf('0xe4')]=function(_0x4637d1,_0x152eb8,_0x37262b){return db[_0x0baf('0xb4')][_0x0baf('0x61')]({'where':{'id':_0x4637d1[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x152eb8,null))[_0x0baf('0x37')](function(_0x4c6010){if(_0x4c6010){return _0x4c6010[_0x0baf('0xe4')](_0x4637d1[_0x0baf('0x5d')][_0x0baf('0x6a')],_[_0x0baf('0xe5')](_0x4637d1[_0x0baf('0x5d')],['ids','id'])||{});}})[_0x0baf('0x37')](respondWithResult(_0x152eb8,null))[_0x0baf('0x2a')](handleError(_0x152eb8,null));};exports[_0x0baf('0xe6')]=function(_0x9cc3a9,_0x1db841,_0x328641){var _0x3358f5={'raw':![],'where':{}};var _0x237a20={};var _0x26dd4c={'count':0x0,'rows':[]};return db[_0x0baf('0x40')][_0x0baf('0xd5')]({'where':{'id':_0x9cc3a9[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x1db841,null))[_0x0baf('0x37')](function(_0x2867b7){if(_0x2867b7){_0x237a20[_0x0baf('0x42')]=_[_0x0baf('0x43')](db[_0x0baf('0xb4')]['rawAttributes']);_0x237a20[_0x0baf('0x44')]=_['keys'](_0x9cc3a9['query']);_0x237a20[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x237a20[_0x0baf('0x42')],_0x237a20['query']);_0x3358f5[_0x0baf('0x48')]=_[_0x0baf('0x46')](_0x237a20[_0x0baf('0x42')],qs[_0x0baf('0x47')](_0x9cc3a9[_0x0baf('0x44')][_0x0baf('0x47')]));_0x3358f5['attributes']=_0x3358f5[_0x0baf('0x48')][_0x0baf('0x49')]?_0x3358f5[_0x0baf('0x48')]:_0x237a20[_0x0baf('0x42')];if(!_0x9cc3a9[_0x0baf('0x44')][_0x0baf('0x4a')]('nolimit')){_0x3358f5[_0x0baf('0x31')]=qs['limit'](_0x9cc3a9[_0x0baf('0x44')][_0x0baf('0x31')]);_0x3358f5['offset']=qs['offset'](_0x9cc3a9[_0x0baf('0x44')][_0x0baf('0x30')]);}_0x3358f5[_0x0baf('0x4c')]=qs['sort'](_0x9cc3a9[_0x0baf('0x44')][_0x0baf('0x4d')]);_0x3358f5['where']=qs[_0x0baf('0x45')](_[_0x0baf('0x4e')](_0x9cc3a9[_0x0baf('0x44')],_0x237a20[_0x0baf('0x45')]));_0x3358f5[_0x0baf('0x4f')][_0x0baf('0x66')]=_0x2867b7['id'];if(_0x9cc3a9[_0x0baf('0x44')]['filter']){_0x3358f5['where']=_[_0x0baf('0x50')](_0x3358f5[_0x0baf('0x4f')],{'$or':_[_0x0baf('0x51')](_0x3358f5[_0x0baf('0x48')],function(_0x1a8c41){var _0x40c626={};_0x40c626[_0x1a8c41]={'$like':'%'+_0x9cc3a9[_0x0baf('0x44')][_0x0baf('0x55')]+'%'};return _0x40c626;})});}_0x3358f5=_[_0x0baf('0x50')]({},_0x3358f5,_0x9cc3a9[_0x0baf('0x5b')]);return db['ChatInteraction']['count']({'where':_0x3358f5[_0x0baf('0x4f')]})[_0x0baf('0x37')](function(_0x399a37){_0x26dd4c['count']=_0x399a37;if(_0x9cc3a9['query'][_0x0baf('0x56')]){_0x3358f5[_0x0baf('0x57')]=[{'model':db[_0x0baf('0x8c')],'as':_0x0baf('0xe7'),'required':![]},{'model':db['User'],'as':_0x0baf('0xe8'),'attributes':[_0x0baf('0x3b'),_0x0baf('0xe9'),_0x0baf('0xea')],'required':![]},{'model':db[_0x0baf('0xeb')],'as':_0x0baf('0xec'),'attributes':['id',_0x0baf('0x3b'),_0x0baf('0xed')],'where':_0x9cc3a9['query'][_0x0baf('0xee')]?{'id':_0x9cc3a9[_0x0baf('0x44')][_0x0baf('0xee')]}:undefined,'required':_0x9cc3a9[_0x0baf('0x44')][_0x0baf('0xee')]?!![]:![]}];}return db[_0x0baf('0xb4')]['findAll'](_0x3358f5);})[_0x0baf('0x37')](function(_0x35babf){_0x26dd4c['rows']=_0x35babf;return _0x26dd4c;});}})['then'](respondWithFilteredResult(_0x1db841,_0x3358f5))[_0x0baf('0x2a')](handleError(_0x1db841,null));};function iftimePromise(_0x555504,_0x466437){return respondWithRpcPromise(_0x0baf('0xef'),_0x0baf('0xf0'),{'command':_0x466437[_0x0baf('0xf1')]?util['format'](_0x0baf('0xf2'),_0x555504[_0x0baf('0xf3')],_0x466437[_0x0baf('0xf1')]):util['format'](_0x0baf('0xf4'),_0x555504[_0x0baf('0xf3')])},client9002)['then'](function(_0x309cbe){var _0x4d3ef9=_0x309cbe&&_0x309cbe[_0x0baf('0xf5')](_0x0baf('0xf6'))>=0x0?!![]:![];logger[_0x0baf('0x22')](_0x0baf('0xf7'),_0x466437['id'],_0x555504['id'],_0x555504['interval'],_0x4d3ef9?_0x0baf('0xf8'):_0x0baf('0xf9'),_0x466437['timezone']?_0x466437[_0x0baf('0xf1')]:_0x0baf('0xfa'));return _0x4d3ef9;})['catch'](function(_0x2d0dc0){logger[_0x0baf('0x27')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x466437['id'],_0x555504['id'],_0x555504[_0x0baf('0xf3')],util[_0x0baf('0xfb')](_0x2d0dc0,{'showHidden':![],'depth':null}),_0x466437[_0x0baf('0xf1')]?_0x466437[_0x0baf('0xf1')]:_0x0baf('0xfa'));return![];});}exports[_0x0baf('0xf0')]=function(_0x5f3f45,_0x181385,_0x120f68){var _0x230a32=0x0;var _0x2135c3=0x0;var _0x297194=![];var _0x1ca912;var _0xc8fb46;return db[_0x0baf('0x40')][_0x0baf('0x61')]({'where':{'id':_0x5f3f45[_0x0baf('0x5a')]['id']},'include':[{'model':db[_0x0baf('0xfc')],'as':_0x0baf('0xfc'),'include':[{'model':db[_0x0baf('0xfc')],'as':_0x0baf('0xfd'),'attributes':['id',_0x0baf('0xf3')],'raw':!![]}]}]})[_0x0baf('0x37')](handleEntityNotFound(_0x181385,null))[_0x0baf('0x37')](function(_0x20da7c){if(_0x20da7c){_0x1ca912=_0x20da7c;return _0x20da7c[_0x0baf('0xfe')]({'raw':!![]});}})[_0x0baf('0x37')](function(_0xc3ea13){if(_0x1ca912){if(_0xc3ea13){_0xc8fb46=_0xc3ea13;}}return require(_0x0baf('0xff'))['getLicense']();})[_0x0baf('0x37')](function(_0x3358f3){if(_0x3358f3){_0x2135c3=_0x3358f3['virtual'];_0x297194=_0x3358f3['custom'];}})['then'](function(){return db[_0x0baf('0xb4')]['count']({'where':{'closed':![]}});})['then'](function(_0x4c2364){_0x230a32=_0x4c2364;if(_0x2135c3&&_0x4c2364>_0x2135c3){return db[_0x0baf('0x100')][_0x0baf('0xd5')]({'where':{'id':0x1}})[_0x0baf('0x37')](function(_0x5ab269){if(_0x5ab269){_0x5ab269[_0x0baf('0x101')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x1ca912[_0x0baf('0xfc')]&&_0x1ca912[_0x0baf('0xfc')][_0x0baf('0xfd')]){var _0x5722b2=[];for(var _0x507374=0x0;_0x507374<_0x1ca912[_0x0baf('0xfc')][_0x0baf('0xfd')][_0x0baf('0x49')];_0x507374++){var _0x217a03=_0x1ca912[_0x0baf('0xfc')][_0x0baf('0xfd')][_0x507374]['get']({'plain':!![]});_0x5722b2['push'](iftimePromise(_0x217a03,_0x1ca912));}return BPromise[_0x0baf('0x102')](_0x5722b2)[_0x0baf('0x37')](function(_0x5f0333){return _[_0x0baf('0x103')](_0x5f0333);});}else{return!![];}})[_0x0baf('0x37')](function(_0x2f96b3){var _0x372a6e=fs['readFileSync'](path[_0x0baf('0x77')](config['root'],'server/files/chat/iframe.js'),_0x0baf('0xcf'));var _0x5d2c0d={'remote':_0x1ca912['remote'],'query':querystring[_0x0baf('0xb2')](_[_0x0baf('0x50')](_0x1ca912['get']({'plain':!![]}),{'customerIp':_0x5f3f45[_0x0baf('0x88')][_0x0baf('0x104')]||_0x5f3f45[_0x0baf('0x88')][_0x0baf('0x105')]||_0x5f3f45[_0x0baf('0x106')][_0x0baf('0x107')]||_0x5f3f45['ip'],'referer':_0x5f3f45['headers'][_0x0baf('0x108')],'openedInteractions':_0x230a32,'maxInteractions':_0x2135c3,'virtual':_0x297194['virtual'],'online':_0x2f96b3,'custom':_0x297194}))[_0x0baf('0x109')](/'/g,'\x5c\x27')};_0x181385[_0x0baf('0x3c')](ejs['render'](Mustache['render'](_0x372a6e,_0x5d2c0d),{'proactiveActions':_0xc8fb46,'alignment':_0x1ca912[_0x0baf('0x10a')],'verticalAlignment':_0x1ca912[_0x0baf('0x10b')]}));})['catch'](handleError(_0x181385,null));};exports[_0x0baf('0x10c')]=function(_0x33579a,_0xcbb33a,_0x167fc8){return db[_0x0baf('0x40')][_0x0baf('0xd5')]({'where':{'id':_0x33579a[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0xcbb33a,null))['then'](function(_0x3f136e){if(_0x3f136e){return db[_0x0baf('0x10d')]['transaction'](function(_0x5b5677){return db[_0x0baf('0x10e')][_0x0baf('0x3a')]({'where':{'ChatWebsiteId':_0x33579a['params']['id']},'transaction':_0x5b5677})[_0x0baf('0x37')](function(_0x12b0b0){var _0x513dc1=_[_0x0baf('0x51')](_0x33579a[_0x0baf('0x5d')],function(_0x38ef79){_0x38ef79[_0x0baf('0x66')]=_0x33579a[_0x0baf('0x5a')]['id'];return _0x38ef79;});return db[_0x0baf('0x10e')][_0x0baf('0x10f')](_0x513dc1,{'transaction':_0x5b5677});});})[_0x0baf('0x37')](function(){return db[_0x0baf('0x10e')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x33579a[_0x0baf('0x5a')]['id']},'order':_0x0baf('0x110')});});}})['then'](respondWithResult(_0xcbb33a,null))['catch'](handleError(_0xcbb33a,null));};exports[_0x0baf('0x111')]=function(_0x4a7131,_0x460711,_0x3752fd){var _0x428001={};var _0x334647={};var _0x10e796;var _0x24e087;return db[_0x0baf('0x40')][_0x0baf('0xd5')]({'where':{'id':_0x4a7131[_0x0baf('0x5a')]['id']}})['then'](handleEntityNotFound(_0x460711,null))[_0x0baf('0x37')](function(_0x6721e9){if(_0x6721e9){_0x10e796=_0x6721e9;_0x334647[_0x0baf('0x42')]=_[_0x0baf('0x43')](db['ChatApplication'][_0x0baf('0x41')]);_0x334647[_0x0baf('0x44')]=_[_0x0baf('0x43')](_0x4a7131['query']);_0x334647[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x334647[_0x0baf('0x42')],_0x334647[_0x0baf('0x44')]);_0x428001['attributes']=_[_0x0baf('0x46')](_0x334647[_0x0baf('0x42')],qs['fields'](_0x4a7131['query']['fields']));_0x428001[_0x0baf('0x48')]=_0x428001[_0x0baf('0x48')][_0x0baf('0x49')]?_0x428001['attributes']:_0x334647[_0x0baf('0x42')];_0x428001[_0x0baf('0x4c')]=qs[_0x0baf('0x4d')](_0x4a7131[_0x0baf('0x44')][_0x0baf('0x4d')]);_0x428001['where']=qs[_0x0baf('0x45')](_[_0x0baf('0x4e')](_0x4a7131[_0x0baf('0x44')],_0x334647[_0x0baf('0x45')]));if(_0x4a7131[_0x0baf('0x44')][_0x0baf('0x55')]){_0x428001['where']=_[_0x0baf('0x50')](_0x428001[_0x0baf('0x4f')],{'$or':_[_0x0baf('0x51')](_0x428001[_0x0baf('0x48')],function(_0x29605d){var _0x1cf4b5={};_0x1cf4b5[_0x29605d]={'$like':'%'+_0x4a7131['query'][_0x0baf('0x55')]+'%'};return _0x1cf4b5;})});}_0x428001=_[_0x0baf('0x50')]({},_0x428001,_0x4a7131[_0x0baf('0x5b')]);return _0x10e796['getApplications'](_0x428001);}})[_0x0baf('0x37')](function(_0x3aa48a){if(_0x3aa48a){_0x24e087=_0x3aa48a[_0x0baf('0x49')];if(!_0x4a7131[_0x0baf('0x44')]['hasOwnProperty'](_0x0baf('0x4b'))){_0x428001['limit']=qs[_0x0baf('0x31')](_0x4a7131[_0x0baf('0x44')][_0x0baf('0x31')]);_0x428001['offset']=qs['offset'](_0x4a7131[_0x0baf('0x44')][_0x0baf('0x30')]);}return _0x10e796[_0x0baf('0x111')](_0x428001);}})[_0x0baf('0x37')](function(_0x5c089d){if(_0x5c089d){return _0x5c089d?{'count':_0x24e087,'rows':_0x5c089d}:null;}})['then'](respondWithResult(_0x460711,null))['catch'](handleError(_0x460711,null));};exports[_0x0baf('0x112')]=function(_0x1100ea,_0x46171d,_0x52fc58){return db[_0x0baf('0x113')][_0x0baf('0x61')]({'where':{'id':_0x1100ea[_0x0baf('0x5a')]['id']}})['then'](handleEntityNotFound(_0x46171d,null))[_0x0baf('0x37')](function(_0x3f800b){if(_0x3f800b){return _0x3f800b[_0x0baf('0x112')](_0x1100ea['body']['ids'],_['omit'](_0x1100ea['body'],[_0x0baf('0x6a'),'id'])||{});}})[_0x0baf('0x37')](respondWithResult(_0x46171d,null))[_0x0baf('0x2a')](handleError(_0x46171d,null));};exports['getProactiveActions']=function(_0xcbc041,_0x5b1808,_0x1abba8){var _0x23ceb2={};var _0x562796={};var _0x4adea0;var _0x2cfffe;return db[_0x0baf('0x40')][_0x0baf('0xd5')]({'where':{'id':_0xcbc041['params']['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x5b1808,null))[_0x0baf('0x37')](function(_0x5e1888){if(_0x5e1888){_0x4adea0=_0x5e1888;_0x562796['model']=_[_0x0baf('0x43')](db[_0x0baf('0x114')][_0x0baf('0x41')]);_0x562796[_0x0baf('0x44')]=_[_0x0baf('0x43')](_0xcbc041[_0x0baf('0x44')]);_0x562796[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x562796[_0x0baf('0x42')],_0x562796[_0x0baf('0x44')]);_0x23ceb2[_0x0baf('0x48')]=_[_0x0baf('0x46')](_0x562796[_0x0baf('0x42')],qs[_0x0baf('0x47')](_0xcbc041[_0x0baf('0x44')]['fields']));_0x23ceb2[_0x0baf('0x48')]=_0x23ceb2[_0x0baf('0x48')][_0x0baf('0x49')]?_0x23ceb2['attributes']:_0x562796['model'];_0x23ceb2[_0x0baf('0x4c')]=qs[_0x0baf('0x4d')](_0xcbc041[_0x0baf('0x44')][_0x0baf('0x4d')]);_0x23ceb2[_0x0baf('0x4f')]=qs[_0x0baf('0x45')](_[_0x0baf('0x4e')](_0xcbc041[_0x0baf('0x44')],_0x562796[_0x0baf('0x45')]));if(_0xcbc041[_0x0baf('0x44')][_0x0baf('0x55')]){_0x23ceb2[_0x0baf('0x4f')]=_[_0x0baf('0x50')](_0x23ceb2[_0x0baf('0x4f')],{'$or':_[_0x0baf('0x51')](_0x23ceb2['attributes'],function(_0x46f7a2){var _0x3ea745={};_0x3ea745[_0x46f7a2]={'$like':'%'+_0xcbc041[_0x0baf('0x44')][_0x0baf('0x55')]+'%'};return _0x3ea745;})});}_0x23ceb2=_[_0x0baf('0x50')]({},_0x23ceb2,_0xcbc041[_0x0baf('0x5b')]);return _0x4adea0[_0x0baf('0xfe')](_0x23ceb2);}})['then'](function(_0x5c6742){if(_0x5c6742){_0x2cfffe=_0x5c6742[_0x0baf('0x49')];if(!_0xcbc041['query']['hasOwnProperty'](_0x0baf('0x4b'))){_0x23ceb2['limit']=qs[_0x0baf('0x31')](_0xcbc041[_0x0baf('0x44')][_0x0baf('0x31')]);_0x23ceb2[_0x0baf('0x30')]=qs[_0x0baf('0x30')](_0xcbc041[_0x0baf('0x44')][_0x0baf('0x30')]);}return _0x4adea0[_0x0baf('0xfe')](_0x23ceb2);}})['then'](function(_0x4bcc76){if(_0x4bcc76){return _0x4bcc76?{'count':_0x2cfffe,'rows':_0x4bcc76}:null;}})[_0x0baf('0x37')](respondWithResult(_0x5b1808,null))[_0x0baf('0x2a')](handleError(_0x5b1808,null));};exports[_0x0baf('0x115')]=function(_0x4eb477,_0x231be0,_0x50b5be){var _0x123037=_0x4eb477[_0x0baf('0x44')][_0x0baf('0x116')]===_0x0baf('0x117')?_0x0baf('0x118'):_0x0baf('0x119');return db[_0x0baf('0x40')][_0x0baf('0x61')]({'attributes':['id',_0x123037],'where':{'id':_0x4eb477[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x231be0,null))[_0x0baf('0x37')](function(_0x30ef34){if(_0x30ef34){var _0x43c6a6=_0x30ef34[_0x123037];var _0x2448dd=_0x43c6a6&&_0x43c6a6[_0x0baf('0x11a')]?_0x43c6a6[_0x0baf('0x11a')]:[];_0x231be0[_0x0baf('0x3c')]({'fromKey':_[_0x0baf('0x97')](_0x43c6a6[_0x0baf('0x11b')])?undefined:_0x43c6a6[_0x0baf('0x11b')],'count':_0x2448dd['length'],'rows':_0x2448dd});}})[_0x0baf('0x2a')](handleError(_0x231be0,null));};exports[_0x0baf('0x11c')]=function(_0x37b03b,_0x526452,_0x5bedb5){var _0x2308a1={'raw':!![],'where':{}};var _0x3832b9={};var _0x54221c={'count':0x0,'rows':[]};return db[_0x0baf('0x40')][_0x0baf('0xd5')]({'where':{'id':_0x37b03b['params']['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x526452,null))[_0x0baf('0x37')](function(_0xc33be0){if(_0xc33be0){_0x3832b9[_0x0baf('0x42')]=_[_0x0baf('0x43')](db[_0x0baf('0xd3')][_0x0baf('0x41')]);_0x3832b9['query']=_['keys'](_0x37b03b[_0x0baf('0x44')]);_0x3832b9['filters']=_[_0x0baf('0x46')](_0x3832b9[_0x0baf('0x42')],_0x3832b9[_0x0baf('0x44')]);_0x2308a1['attributes']=_[_0x0baf('0x46')](_0x3832b9[_0x0baf('0x42')],qs['fields'](_0x37b03b[_0x0baf('0x44')][_0x0baf('0x47')]));_0x2308a1[_0x0baf('0x48')]=_0x2308a1[_0x0baf('0x48')][_0x0baf('0x49')]?_0x2308a1[_0x0baf('0x48')]:_0x3832b9[_0x0baf('0x42')];if(!_0x37b03b[_0x0baf('0x44')][_0x0baf('0x4a')]('nolimit')){_0x2308a1[_0x0baf('0x31')]=qs[_0x0baf('0x31')](_0x37b03b['query']['limit']);_0x2308a1[_0x0baf('0x30')]=qs[_0x0baf('0x30')](_0x37b03b[_0x0baf('0x44')][_0x0baf('0x30')]);}_0x2308a1[_0x0baf('0x4c')]=qs['sort'](_0x37b03b['query'][_0x0baf('0x4d')]);_0x2308a1['where']=qs[_0x0baf('0x45')](_['pick'](_0x37b03b[_0x0baf('0x44')],_0x3832b9[_0x0baf('0x45')]));_0x2308a1[_0x0baf('0x4f')]['ChatWebsiteId']=_0xc33be0['id'];if(_0x37b03b[_0x0baf('0x44')][_0x0baf('0x55')]){_0x2308a1[_0x0baf('0x4f')]=_['merge'](_0x2308a1[_0x0baf('0x4f')],{'$or':_[_0x0baf('0x51')](_0x2308a1[_0x0baf('0x48')],function(_0x16a839){var _0x3597fe={};_0x3597fe[_0x16a839]={'$like':'%'+_0x37b03b[_0x0baf('0x44')][_0x0baf('0x55')]+'%'};return _0x3597fe;})});}_0x2308a1=_[_0x0baf('0x50')]({},_0x2308a1,_0x37b03b[_0x0baf('0x5b')]);return db[_0x0baf('0xd3')]['count']({'where':_0x2308a1[_0x0baf('0x4f')]})[_0x0baf('0x37')](function(_0x5700da){_0x54221c[_0x0baf('0x2f')]=_0x5700da;if(_0x37b03b[_0x0baf('0x44')][_0x0baf('0x56')]){_0x2308a1[_0x0baf('0x57')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x0baf('0x68')](_0x2308a1);})[_0x0baf('0x37')](function(_0x2a73f7){_0x54221c['rows']=_0x2a73f7;return _0x54221c;});}})['then'](respondWithFilteredResult(_0x526452,_0x2308a1))[_0x0baf('0x2a')](handleError(_0x526452,null));};exports['addAgents']=function(_0xd8e50a,_0x1f7c6d,_0x5058fb){return db['ChatWebsite']['find']({'where':{'id':_0xd8e50a['params']['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x1f7c6d,null))[_0x0baf('0x37')](function(_0x3b4a98){if(_0x3b4a98){return _0x3b4a98[_0x0baf('0x11d')](_0xd8e50a[_0x0baf('0x5d')]['ids'],_['omit'](_0xd8e50a[_0x0baf('0x5d')],[_0x0baf('0x6a'),'id'])||{})['spread'](function(_0xc70030){for(var _0x571300=0x0;_0x571300<_0xd8e50a[_0x0baf('0x5d')][_0x0baf('0x6a')]['length'];_0x571300+=0x1){socket[_0x0baf('0x11e')](_0x0baf('0x11f'),{'UserId':_0xd8e50a['body'][_0x0baf('0x6a')][_0x571300],'ChatWebsiteId':_0xd8e50a[_0x0baf('0x5a')]['id']});}return _0xc70030;});}})[_0x0baf('0x37')](respondWithResult(_0x1f7c6d,null))[_0x0baf('0x2a')](handleError(_0x1f7c6d,null));};exports['removeAgents']=function(_0x33d831,_0x480629,_0x23abaf){var _0x23e4b5;return db[_0x0baf('0x40')]['find']({'where':{'id':_0x33d831['params']['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x480629,null))[_0x0baf('0x37')](function(_0x828d13){if(_0x828d13){return _0x828d13['removeAgents'](_0x33d831[_0x0baf('0x44')][_0x0baf('0x6a')])[_0x0baf('0x37')](function(_0x5b60a8){if(_[_0x0baf('0x120')](_0x33d831['query'][_0x0baf('0x6a')])){for(var _0x1ef53b=0x0;_0x1ef53b<_0x33d831[_0x0baf('0x44')][_0x0baf('0x6a')][_0x0baf('0x49')];_0x1ef53b+=0x1){socket[_0x0baf('0x11e')](_0x0baf('0x121'),{'UserId':_0x33d831[_0x0baf('0x44')][_0x0baf('0x6a')][_0x1ef53b],'ChatWebsiteId':_0x33d831['params']['id']});}}else{socket[_0x0baf('0x11e')](_0x0baf('0x121'),{'UserId':_0x33d831[_0x0baf('0x44')][_0x0baf('0x6a')],'ChatWebsiteId':_0x33d831[_0x0baf('0x5a')]['id']});}});}})[_0x0baf('0x37')](respondWithStatusCode(_0x480629,null))[_0x0baf('0x2a')](handleError(_0x480629,null));};exports[_0x0baf('0x122')]=function(_0x743143,_0x410e8e,_0x54facf){var _0x13fd68={};var _0x12aadb={};var _0x57e8d4;var _0x3c8bb1;return db[_0x0baf('0x40')][_0x0baf('0xd5')]({'where':{'id':_0x743143[_0x0baf('0x5a')]['id']}})[_0x0baf('0x37')](handleEntityNotFound(_0x410e8e,null))[_0x0baf('0x37')](function(_0xa55c25){if(_0xa55c25){_0x57e8d4=_0xa55c25;_0x12aadb[_0x0baf('0x42')]=_[_0x0baf('0x43')](db['User'][_0x0baf('0x41')]);_0x12aadb[_0x0baf('0x44')]=_[_0x0baf('0x43')](_0x743143[_0x0baf('0x44')]);_0x12aadb[_0x0baf('0x45')]=_['intersection'](_0x12aadb['model'],_0x12aadb[_0x0baf('0x44')]);_0x13fd68['attributes']=_[_0x0baf('0x46')](_0x12aadb[_0x0baf('0x42')],qs[_0x0baf('0x47')](_0x743143[_0x0baf('0x44')][_0x0baf('0x47')]));_0x13fd68[_0x0baf('0x48')]=_0x13fd68[_0x0baf('0x48')][_0x0baf('0x49')]?_0x13fd68[_0x0baf('0x48')]:_0x12aadb['model'];_0x13fd68['order']=qs[_0x0baf('0x4d')](_0x743143[_0x0baf('0x44')][_0x0baf('0x4d')]);_0x13fd68[_0x0baf('0x4f')]=qs['filters'](_[_0x0baf('0x4e')](_0x743143['query'],_0x12aadb[_0x0baf('0x45')]));if(_0x743143['query'][_0x0baf('0x55')]){_0x13fd68[_0x0baf('0x4f')]=_[_0x0baf('0x50')](_0x13fd68['where'],{'$or':_[_0x0baf('0x51')](_0x13fd68[_0x0baf('0x48')],function(_0x4a64cf){var _0x5a5954={};_0x5a5954[_0x4a64cf]={'$like':'%'+_0x743143['query']['filter']+'%'};return _0x5a5954;})});}_0x13fd68=_[_0x0baf('0x50')]({},_0x13fd68,_0x743143[_0x0baf('0x5b')]);return _0x57e8d4[_0x0baf('0x122')](_0x13fd68);}})[_0x0baf('0x37')](function(_0x43977d){if(_0x43977d){_0x3c8bb1=_0x43977d[_0x0baf('0x49')];if(!_0x743143[_0x0baf('0x44')][_0x0baf('0x4a')](_0x0baf('0x4b'))){_0x13fd68[_0x0baf('0x31')]=qs[_0x0baf('0x31')](_0x743143[_0x0baf('0x44')]['limit']);_0x13fd68[_0x0baf('0x30')]=qs['offset'](_0x743143[_0x0baf('0x44')][_0x0baf('0x30')]);}return _0x57e8d4[_0x0baf('0x122')](_0x13fd68);}})[_0x0baf('0x37')](function(_0x2aadba){if(_0x2aadba){return _0x2aadba?{'count':_0x3c8bb1,'rows':_0x2aadba}:null;}})[_0x0baf('0x37')](respondWithResult(_0x410e8e,null))[_0x0baf('0x2a')](handleError(_0x410e8e,null));}; \ No newline at end of file +var _0xb10b=['findAndCountAll','getApplications','chatProactiveAction','ChatProactiveAction','false','offlineForm','onlineForm','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','mandatoryDispositionPause','ChatWebsite','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','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','pick','findAll','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','sitepic','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','getSystemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','no\x20available\x20attributes','difference','updatedAt','ListId','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','list','applications','priority','asc','account','contact','lastName','referer','browser','format','%s\x20%s','version','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','createdAt','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','SendMail','sendMail','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','getSnippet','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','timezone','No\x20timezone','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.js','remote','x-forwarded-for','x-real-ip','connection','remoteAddress','replace','verticalAlignment','sequelize','transaction'];(function(_0x5b670d,_0x4e6d01){var _0x32c35b=function(_0x5cab28){while(--_0x5cab28){_0x5b670d['push'](_0x5b670d['shift']());}};_0x32c35b(++_0x4e6d01);}(_0xb10b,0x12a));var _0xbb10=function(_0x16c2b1,_0x36a70c){_0x16c2b1=_0x16c2b1-0x0;var _0x199ac4=_0xb10b[_0x16c2b1];return _0x199ac4;};'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 authService=require(_0xbb10('0x12'));var hardwareService=require(_0xbb10('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];config['redis']=_[_0xbb10('0x18')](config[_0xbb10('0x19')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config[_0xbb10('0x19')]));require(_0xbb10('0x1c'))['register'](socket);var jayson=require(_0xbb10('0x1d'));var client=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232c});var client9002=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232a});var client9003=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x36b5e8,_0x3e26f4,_0x2b184e,_0x4a2bfc){return new BPromise(function(_0x2eca0f,_0x1145f1){var _0x133ac2=_0x4a2bfc||client;return _0x133ac2[_0xbb10('0x20')](_0x36b5e8,_0x2b184e)[_0xbb10('0x21')](function(_0x1682a4){logger[_0xbb10('0x22')](_0xbb10('0x23'),_0x3e26f4,_0xbb10('0x24'));logger[_0xbb10('0x25')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3e26f4,_0xbb10('0x24'),JSON[_0xbb10('0x26')](_0x1682a4));if(_0x1682a4[_0xbb10('0x27')]){if(_0x1682a4[_0xbb10('0x27')][_0xbb10('0x28')]===0x1f4){logger[_0xbb10('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x3e26f4,_0x1682a4[_0xbb10('0x27')][_0xbb10('0x29')]);return _0x1145f1(_0x1682a4['error']['message']);}logger[_0xbb10('0x27')](_0xbb10('0x23'),_0x3e26f4,_0x1682a4[_0xbb10('0x27')][_0xbb10('0x29')]);return _0x2eca0f(_0x1682a4[_0xbb10('0x27')][_0xbb10('0x29')]);}else{logger[_0xbb10('0x22')](_0xbb10('0x23'),_0x3e26f4,_0xbb10('0x24'));_0x2eca0f(_0x1682a4[_0xbb10('0x2a')][_0xbb10('0x29')]);}})[_0xbb10('0x2b')](function(_0x537898){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3e26f4,_0x537898);_0x1145f1(_0x537898);});});}function respondWithStatusCode(_0xc93a04,_0x3c5ae7){_0x3c5ae7=_0x3c5ae7||0xcc;return function(_0x2c89b9){if(_0x2c89b9){return _0xc93a04['sendStatus'](_0x3c5ae7);}return _0xc93a04[_0xbb10('0x2c')](_0x3c5ae7)[_0xbb10('0x2d')]();};}function respondWithResult(_0x6ed43b,_0x1d5e95){_0x1d5e95=_0x1d5e95||0xc8;return function(_0x1acce9){if(_0x1acce9){return _0x6ed43b[_0xbb10('0x2c')](_0x1d5e95)[_0xbb10('0x2e')](_0x1acce9);}};}function respondWithFilteredResult(_0x4aabb9,_0x3796c7){return function(_0x21ac54){if(_0x21ac54){var _0xfc3595=_0x21ac54['count'],_0x2e0249=_0x3796c7[_0xbb10('0x2f')],_0x1d30aa=_0x3796c7['offset']+_0x3796c7[_0xbb10('0x30')],_0x2ff4c1;if(_0x1d30aa>=_0xfc3595){_0x1d30aa=_0xfc3595;_0x2ff4c1=0xc8;}else{_0x2ff4c1=0xce;}_0x4aabb9['status'](_0x2ff4c1);return _0x4aabb9[_0xbb10('0x31')](_0xbb10('0x32'),_0x2e0249+'-'+_0x1d30aa+'/'+_0xfc3595)[_0xbb10('0x2e')](_0x21ac54);}return null;};}function patchUpdates(_0x491db4){return function(_0x518d47){try{jsonpatch[_0xbb10('0x33')](_0x518d47,_0x491db4,!![]);}catch(_0x34f65e){return BPromise['reject'](_0x34f65e);}return _0x518d47[_0xbb10('0x34')]();};}function saveUpdates(_0x37dde7,_0x2f653f){return function(_0x1c0b57){if(_0x1c0b57){return _0x1c0b57[_0xbb10('0x35')](_0x37dde7)[_0xbb10('0x21')](function(_0xf85197){return _0xf85197;});}return null;};}function removeEntity(_0x4975f5,_0x25acb3){return function(_0x1da9c9){if(_0x1da9c9){return _0x1da9c9[_0xbb10('0x36')]()[_0xbb10('0x21')](function(){var _0xfb2c5e=_0x1da9c9[_0xbb10('0x37')]({'plain':!![]});var _0x188cbd=_0xbb10('0x38');return db[_0xbb10('0x39')]['destroy']({'where':{'type':_0x188cbd,'resourceId':_0xfb2c5e['id']}})[_0xbb10('0x21')](function(){return _0x1da9c9;});})[_0xbb10('0x21')](function(){_0x4975f5[_0xbb10('0x2c')](0xcc)[_0xbb10('0x2d')]();});}};}function handleEntityNotFound(_0x570f5a,_0x111762){return function(_0x5de37b){if(!_0x5de37b){_0x570f5a['sendStatus'](0x194);}return _0x5de37b;};}function handleError(_0x3eb3cc,_0x40c164){_0x40c164=_0x40c164||0x1f4;return function(_0x26e76a){logger[_0xbb10('0x27')](_0x26e76a[_0xbb10('0x3a')]);if(_0x26e76a[_0xbb10('0x3b')]){delete _0x26e76a['name'];}_0x3eb3cc[_0xbb10('0x2c')](_0x40c164)[_0xbb10('0x3c')](_0x26e76a);};}exports['index']=function(_0x5e3fbd,_0x5cd55f){var _0x31bee3={'include':[{'model':db['Pause'],'as':_0xbb10('0x3d')}]},_0x2b0b45={},_0x2b658a={'count':0x0,'rows':[]};var _0x3e8538=db[_0xbb10('0x3e')]['rawAttributes'];_0x2b0b45[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x3e8538);_0x2b0b45[_0xbb10('0x41')]=_[_0xbb10('0x40')](_0x5e3fbd['query']);_0x2b0b45[_0xbb10('0x42')]=_[_0xbb10('0x43')](_0x2b0b45['model'],_0x2b0b45[_0xbb10('0x41')]);_0x31bee3[_0xbb10('0x44')]=_[_0xbb10('0x43')](_0x2b0b45[_0xbb10('0x3f')],qs[_0xbb10('0x45')](_0x5e3fbd[_0xbb10('0x41')]['fields']));_0x31bee3[_0xbb10('0x44')]=_0x31bee3[_0xbb10('0x44')][_0xbb10('0x46')]?_0x31bee3[_0xbb10('0x44')]:_0x2b0b45['model'];if(!_0x5e3fbd[_0xbb10('0x41')][_0xbb10('0x47')](_0xbb10('0x48'))){_0x31bee3[_0xbb10('0x30')]=qs['limit'](_0x5e3fbd[_0xbb10('0x41')][_0xbb10('0x30')]);_0x31bee3['offset']=qs['offset'](_0x5e3fbd[_0xbb10('0x41')]['offset']);}_0x31bee3[_0xbb10('0x49')]=qs[_0xbb10('0x4a')](_0x5e3fbd['query'][_0xbb10('0x4a')]);_0x31bee3[_0xbb10('0x4b')]=qs[_0xbb10('0x42')](_['pick'](_0x5e3fbd[_0xbb10('0x41')],_0x2b0b45[_0xbb10('0x42')]));if(_0x5e3fbd[_0xbb10('0x41')][_0xbb10('0x4c')]){_0x31bee3[_0xbb10('0x4b')]=_[_0xbb10('0x4d')](_0x31bee3[_0xbb10('0x4b')],{'$or':_[_0xbb10('0x4e')](_0x3e8538,function(_0x205bb4){if(_0x205bb4[_0xbb10('0x4f')][_0xbb10('0x50')]!==_0xbb10('0x51')){var _0x4d30d6={};_0x4d30d6[_0x205bb4[_0xbb10('0x52')]]={'$like':'%'+_0x5e3fbd[_0xbb10('0x41')]['filter']+'%'};return _0x4d30d6;}})});}_0x31bee3=_[_0xbb10('0x4d')]({},_0x31bee3,_0x5e3fbd[_0xbb10('0x53')]);var _0x1a7df6={'where':_0x31bee3[_0xbb10('0x4b')]};return db[_0xbb10('0x3e')][_0xbb10('0x54')](_0x1a7df6)[_0xbb10('0x21')](function(_0x5be85e){_0x2b658a['count']=_0x5be85e;if(_0x5e3fbd[_0xbb10('0x41')][_0xbb10('0x55')]){_0x31bee3[_0xbb10('0x56')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x31bee3);})[_0xbb10('0x21')](function(_0x34cf4e){_0x2b658a[_0xbb10('0x57')]=_0x34cf4e;return _0x2b658a;})[_0xbb10('0x21')](respondWithFilteredResult(_0x5cd55f,_0x31bee3))[_0xbb10('0x2b')](handleError(_0x5cd55f,null));};exports[_0xbb10('0x58')]=function(_0x2f2552,_0x460788){var _0x2626d8={'raw':![],'where':{'id':_0x2f2552['params']['id']},'include':[{'model':db['Pause'],'as':_0xbb10('0x3d')}]},_0x3d7e7e={};_0x3d7e7e[_0xbb10('0x3f')]=_[_0xbb10('0x40')](db[_0xbb10('0x3e')][_0xbb10('0x59')]);_0x3d7e7e[_0xbb10('0x41')]=_[_0xbb10('0x40')](_0x2f2552[_0xbb10('0x41')]);_0x3d7e7e[_0xbb10('0x42')]=_[_0xbb10('0x43')](_0x3d7e7e[_0xbb10('0x3f')],_0x3d7e7e[_0xbb10('0x41')]);_0x2626d8[_0xbb10('0x44')]=_[_0xbb10('0x43')](_0x3d7e7e[_0xbb10('0x3f')],qs['fields'](_0x2f2552[_0xbb10('0x41')]['fields']));_0x2626d8[_0xbb10('0x44')]=_0x2626d8[_0xbb10('0x44')][_0xbb10('0x46')]?_0x2626d8[_0xbb10('0x44')]:_0x3d7e7e[_0xbb10('0x3f')];if(_0x2f2552[_0xbb10('0x41')][_0xbb10('0x55')]){_0x2626d8[_0xbb10('0x56')]=[{'all':!![]}];}_0x2626d8=_[_0xbb10('0x4d')]({},_0x2626d8,_0x2f2552[_0xbb10('0x53')]);return db[_0xbb10('0x3e')][_0xbb10('0x5a')](_0x2626d8)[_0xbb10('0x21')](handleEntityNotFound(_0x460788,null))[_0xbb10('0x21')](respondWithResult(_0x460788,null))[_0xbb10('0x2b')](handleError(_0x460788,null));};exports['create']=function(_0x4571b6,_0x466eb7){return db[_0xbb10('0x3e')][_0xbb10('0x5b')](_0x4571b6[_0xbb10('0x5c')],{})[_0xbb10('0x21')](function(_0x4bedd0){var _0x120bda=_0x4571b6[_0xbb10('0x5d')][_0xbb10('0x37')]({'plain':!![]});if(!_0x120bda)throw new Error(_0xbb10('0x5e'));if(_0x120bda[_0xbb10('0x5f')]===_0xbb10('0x5d')){var _0x175872=_0x4bedd0[_0xbb10('0x37')]({'plain':!![]});var _0x205e01=_0xbb10('0x38');return db[_0xbb10('0x60')][_0xbb10('0x5a')]({'where':{'name':_0x205e01,'userProfileId':_0x120bda[_0xbb10('0x61')]},'raw':!![]})['then'](function(_0x4ea1a6){if(_0x4ea1a6&&_0x4ea1a6[_0xbb10('0x62')]===0x0){return db[_0xbb10('0x39')][_0xbb10('0x5b')]({'name':_0x175872[_0xbb10('0x3b')],'resourceId':_0x175872['id'],'type':_0x4ea1a6['name'],'sectionId':_0x4ea1a6['id']},{})['then'](function(){return _0x4bedd0;});}else{return _0x4bedd0;}})[_0xbb10('0x2b')](function(_0xaf2cc3){logger[_0xbb10('0x27')](_0xbb10('0x63'),_0xaf2cc3);throw _0xaf2cc3;});}return _0x4bedd0;})[_0xbb10('0x21')](respondWithResult(_0x466eb7,0xc9))[_0xbb10('0x2b')](handleError(_0x466eb7,null));};exports[_0xbb10('0x35')]=function(_0x4a5fb9,_0x117e84){if(_0x4a5fb9[_0xbb10('0x5c')]['id']){delete _0x4a5fb9['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x4a5fb9[_0xbb10('0x64')]['id']},'include':[{'model':db[_0xbb10('0x65')],'as':_0xbb10('0x3d')}]})['then'](handleEntityNotFound(_0x117e84,null))['then'](saveUpdates(_0x4a5fb9['body'],null))[_0xbb10('0x21')](respondWithResult(_0x117e84,null))[_0xbb10('0x2b')](handleError(_0x117e84,null));};exports[_0xbb10('0x36')]=function(_0x4e9fbd,_0xa1bbd9){return db[_0xbb10('0x3e')]['find']({'where':{'id':_0x4e9fbd['params']['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0xa1bbd9,null))[_0xbb10('0x21')](removeEntity(_0xa1bbd9,null))[_0xbb10('0x2b')](handleError(_0xa1bbd9,null));};exports[_0xbb10('0x66')]=function(_0x54b7c5,_0x43eaec){return db[_0xbb10('0x3e')][_0xbb10('0x66')]()['then'](respondWithResult(_0x43eaec,null))[_0xbb10('0x2b')](handleError(_0x43eaec,null));};exports[_0xbb10('0x67')]=function(_0x3e3617,_0x5b2bd4,_0x2ca491){if(_0x3e3617[_0xbb10('0x5c')]['id']){delete _0x3e3617[_0xbb10('0x5c')]['id'];}return db[_0xbb10('0x3e')]['find']({'where':{'id':_0x3e3617[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x5b2bd4,null))[_0xbb10('0x21')](function(_0x2d0f4b){if(_0x2d0f4b){_0x3e3617['body'][_0xbb10('0x68')]=_0x2d0f4b['id'];return db[_0xbb10('0x69')][_0xbb10('0x5b')](_0x3e3617[_0xbb10('0x5c')]);}})[_0xbb10('0x21')](respondWithResult(_0x5b2bd4,null))[_0xbb10('0x2b')](handleError(_0x5b2bd4,null));};exports[_0xbb10('0x6a')]=function(_0x4a30c5,_0x4a13d7,_0x5acd5e){var _0xdfbc0b={'raw':![],'where':{}};var _0x9c672d={};var _0x3eda96={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x4a30c5[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x4a13d7,null))[_0xbb10('0x21')](function(_0x3a9677){if(_0x3a9677){_0x9c672d[_0xbb10('0x3f')]=_[_0xbb10('0x40')](db['Disposition'][_0xbb10('0x59')]);_0x9c672d[_0xbb10('0x41')]=_[_0xbb10('0x40')](_0x4a30c5[_0xbb10('0x41')]);_0x9c672d[_0xbb10('0x42')]=_['intersection'](_0x9c672d['model'],_0x9c672d['query']);_0xdfbc0b[_0xbb10('0x44')]=_[_0xbb10('0x43')](_0x9c672d[_0xbb10('0x3f')],qs[_0xbb10('0x45')](_0x4a30c5[_0xbb10('0x41')][_0xbb10('0x45')]));_0xdfbc0b['attributes']=_0xdfbc0b[_0xbb10('0x44')]['length']?_0xdfbc0b['attributes']:_0x9c672d['model'];if(!_0x4a30c5[_0xbb10('0x41')][_0xbb10('0x47')](_0xbb10('0x48'))){_0xdfbc0b[_0xbb10('0x30')]=qs['limit'](_0x4a30c5[_0xbb10('0x41')]['limit']);_0xdfbc0b['offset']=qs[_0xbb10('0x2f')](_0x4a30c5[_0xbb10('0x41')][_0xbb10('0x2f')]);}_0xdfbc0b[_0xbb10('0x49')]=qs[_0xbb10('0x4a')](_0x4a30c5['query'][_0xbb10('0x4a')]);_0xdfbc0b[_0xbb10('0x4b')]=qs[_0xbb10('0x42')](_[_0xbb10('0x6b')](_0x4a30c5[_0xbb10('0x41')],_0x9c672d[_0xbb10('0x42')]));_0xdfbc0b[_0xbb10('0x4b')]['ChatWebsiteId']=_0x3a9677['id'];if(_0x4a30c5[_0xbb10('0x41')][_0xbb10('0x4c')]){_0xdfbc0b[_0xbb10('0x4b')]=_[_0xbb10('0x4d')](_0xdfbc0b[_0xbb10('0x4b')],{'$or':_[_0xbb10('0x4e')](_0xdfbc0b[_0xbb10('0x44')],function(_0x312a08){var _0x5a4429={};_0x5a4429[_0x312a08]={'$like':'%'+_0x4a30c5[_0xbb10('0x41')][_0xbb10('0x4c')]+'%'};return _0x5a4429;})});}_0xdfbc0b=_[_0xbb10('0x4d')]({},_0xdfbc0b,_0x4a30c5['options']);return db['Disposition']['count']({'where':_0xdfbc0b[_0xbb10('0x4b')]})['then'](function(_0x4e3d6a){_0x3eda96[_0xbb10('0x54')]=_0x4e3d6a;if(_0x4a30c5[_0xbb10('0x41')][_0xbb10('0x55')]){_0xdfbc0b[_0xbb10('0x56')]=[{'all':!![]}];}return db[_0xbb10('0x69')][_0xbb10('0x6c')](_0xdfbc0b);})[_0xbb10('0x21')](function(_0x417304){_0x3eda96[_0xbb10('0x57')]=_0x417304;return _0x3eda96;});}})['then'](respondWithFilteredResult(_0x4a13d7,_0xdfbc0b))[_0xbb10('0x2b')](handleError(_0x4a13d7,null));};exports[_0xbb10('0x6d')]=function(_0x46b6d2,_0x35b811,_0x5c8eb8){var _0x4c0795;return db[_0xbb10('0x3e')][_0xbb10('0x5a')]({'where':{'id':_0x46b6d2[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x35b811,null))['then'](function(_0x17d596){if(_0x17d596){return _0x17d596[_0xbb10('0x6d')](_0x46b6d2[_0xbb10('0x41')][_0xbb10('0x6e')]);}})[_0xbb10('0x21')](respondWithStatusCode(_0x35b811,null))['catch'](handleError(_0x35b811,null));};exports['addAnswer']=function(_0x372636,_0x53c698,_0x22c030){if(_0x372636['body']['id']){delete _0x372636[_0xbb10('0x5c')]['id'];}return db[_0xbb10('0x3e')]['find']({'where':{'id':_0x372636['params']['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x53c698,null))[_0xbb10('0x21')](function(_0x177f77){if(_0x177f77){_0x372636['body'][_0xbb10('0x68')]=_0x177f77['id'];return db[_0xbb10('0x6f')][_0xbb10('0x5b')](_0x372636[_0xbb10('0x5c')]);}})[_0xbb10('0x21')](respondWithResult(_0x53c698,null))[_0xbb10('0x2b')](handleError(_0x53c698,null));};exports[_0xbb10('0x70')]=function(_0x226363,_0x3e6246,_0x479d51){var _0x3367d4={'raw':![],'where':{}};var _0x28cc46={};var _0x412fbf={'count':0x0,'rows':[]};return db[_0xbb10('0x3e')][_0xbb10('0x71')]({'where':{'id':_0x226363[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x3e6246,null))[_0xbb10('0x21')](function(_0x17ed20){if(_0x17ed20){_0x28cc46[_0xbb10('0x3f')]=_[_0xbb10('0x40')](db[_0xbb10('0x6f')]['rawAttributes']);_0x28cc46['query']=_[_0xbb10('0x40')](_0x226363[_0xbb10('0x41')]);_0x28cc46[_0xbb10('0x42')]=_[_0xbb10('0x43')](_0x28cc46[_0xbb10('0x3f')],_0x28cc46['query']);_0x3367d4[_0xbb10('0x44')]=_[_0xbb10('0x43')](_0x28cc46[_0xbb10('0x3f')],qs[_0xbb10('0x45')](_0x226363[_0xbb10('0x41')][_0xbb10('0x45')]));_0x3367d4['attributes']=_0x3367d4[_0xbb10('0x44')][_0xbb10('0x46')]?_0x3367d4['attributes']:_0x28cc46[_0xbb10('0x3f')];if(!_0x226363['query'][_0xbb10('0x47')](_0xbb10('0x48'))){_0x3367d4[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x226363[_0xbb10('0x41')]['limit']);_0x3367d4[_0xbb10('0x2f')]=qs['offset'](_0x226363[_0xbb10('0x41')][_0xbb10('0x2f')]);}_0x3367d4['order']=qs['sort'](_0x226363[_0xbb10('0x41')][_0xbb10('0x4a')]);_0x3367d4[_0xbb10('0x4b')]=qs[_0xbb10('0x42')](_[_0xbb10('0x6b')](_0x226363[_0xbb10('0x41')],_0x28cc46[_0xbb10('0x42')]));_0x3367d4[_0xbb10('0x4b')][_0xbb10('0x68')]=_0x17ed20['id'];if(_0x226363[_0xbb10('0x41')][_0xbb10('0x4c')]){_0x3367d4['where']=_[_0xbb10('0x4d')](_0x3367d4[_0xbb10('0x4b')],{'$or':_[_0xbb10('0x4e')](_0x3367d4[_0xbb10('0x44')],function(_0xfe02f5){var _0x86a6ff={};_0x86a6ff[_0xfe02f5]={'$like':'%'+_0x226363[_0xbb10('0x41')][_0xbb10('0x4c')]+'%'};return _0x86a6ff;})});}_0x3367d4=_[_0xbb10('0x4d')]({},_0x3367d4,_0x226363[_0xbb10('0x53')]);return db[_0xbb10('0x6f')][_0xbb10('0x54')]({'where':_0x3367d4['where']})[_0xbb10('0x21')](function(_0x5e0741){_0x412fbf[_0xbb10('0x54')]=_0x5e0741;if(_0x226363[_0xbb10('0x41')][_0xbb10('0x55')]){_0x3367d4[_0xbb10('0x56')]=[{'all':!![]}];}return db[_0xbb10('0x6f')]['findAll'](_0x3367d4);})[_0xbb10('0x21')](function(_0x217107){_0x412fbf[_0xbb10('0x57')]=_0x217107;return _0x412fbf;});}})[_0xbb10('0x21')](respondWithFilteredResult(_0x3e6246,_0x3367d4))[_0xbb10('0x2b')](handleError(_0x3e6246,null));};exports[_0xbb10('0x72')]=function(_0x4970fe,_0x4bd470,_0x5cc9d7){var _0x11ab88;return db[_0xbb10('0x3e')]['find']({'where':{'id':_0x4970fe[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x4bd470,null))['then'](function(_0x2831de){if(_0x2831de){return _0x2831de[_0xbb10('0x72')](_0x4970fe['query'][_0xbb10('0x6e')]);}})['then'](respondWithStatusCode(_0x4bd470,null))[_0xbb10('0x2b')](handleError(_0x4bd470,null));};exports[_0xbb10('0x73')]=function(_0x5d82e4,_0x34a5a3,_0x28cc74){_0x5d82e4['body']['sitepic']=_0x5d82e4[_0xbb10('0x74')][_0xbb10('0x75')];return db[_0xbb10('0x3e')][_0xbb10('0x5a')]({'where':{'id':_0x5d82e4[_0xbb10('0x64')]['id']}})['then'](handleEntityNotFound(_0x34a5a3,null))[_0xbb10('0x21')](saveUpdates(_0x5d82e4[_0xbb10('0x5c')],null))[_0xbb10('0x21')](respondWithResult(_0x34a5a3,null))['catch'](handleError(_0x34a5a3,null));};exports[_0xbb10('0x76')]=function(_0x4f90e6,_0x248887,_0xa5391d){_0x4f90e6[_0xbb10('0x5c')][_0xbb10('0x77')]=_0x4f90e6[_0xbb10('0x74')][_0xbb10('0x75')];return db[_0xbb10('0x3e')]['find']({'where':{'id':_0x4f90e6['params']['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x248887,null))[_0xbb10('0x21')](saveUpdates(_0x4f90e6[_0xbb10('0x5c')],null))[_0xbb10('0x21')](respondWithResult(_0x248887,null))[_0xbb10('0x2b')](handleError(_0x248887,null));};exports[_0xbb10('0x78')]=function(_0x1cccec,_0x1674f7,_0x3ede66){_0x1cccec[_0xbb10('0x5c')][_0xbb10('0x79')]=_0x1cccec[_0xbb10('0x74')][_0xbb10('0x75')];return db['ChatWebsite'][_0xbb10('0x5a')]({'where':{'id':_0x1cccec[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x1674f7,null))[_0xbb10('0x21')](saveUpdates(_0x1cccec[_0xbb10('0x5c')],null))[_0xbb10('0x21')](respondWithResult(_0x1674f7,null))[_0xbb10('0x2b')](handleError(_0x1674f7,null));};exports[_0xbb10('0x7a')]=function(_0x3c6c45,_0x3c92f4,_0x2a1c53){_0x3c6c45['body'][_0xbb10('0x7b')]=_0x3c6c45['file'][_0xbb10('0x75')];return db[_0xbb10('0x3e')][_0xbb10('0x5a')]({'where':{'id':_0x3c6c45[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x3c92f4,null))[_0xbb10('0x21')](saveUpdates(_0x3c6c45['body'],null))[_0xbb10('0x21')](respondWithResult(_0x3c92f4,null))['catch'](handleError(_0x3c92f4,null));};exports[_0xbb10('0x7c')]=function(_0x2141e9,_0xda122,_0x576bb6){var _0x2b652c=path[_0xbb10('0x7d')](config[_0xbb10('0x7e')],_0xbb10('0x7f'));var _0x25c5b2={'where':{'id':_0x2141e9[_0xbb10('0x64')]['id']},'attributes':['id',_0xbb10('0x80')],'raw':!![]};var _0xa09041=![];return require('../../config/license/util')[_0xbb10('0x81')]()['then'](function(_0xe70161){if(_0xe70161){_0xa09041=_0xe70161[_0xbb10('0x82')];}})[_0xbb10('0x21')](function(){return db[_0xbb10('0x3e')][_0xbb10('0x5a')](_0x25c5b2);})[_0xbb10('0x21')](handleEntityNotFound(_0xda122,null))[_0xbb10('0x21')](function(_0x5e9888){if(_0x5e9888){if(!_[_0xbb10('0x83')](_0x5e9888['sitepic'])){if(fs['existsSync'](path[_0xbb10('0x7d')](config[_0xbb10('0x7e')],_0xbb10('0x84'),_0x5e9888[_0xbb10('0x80')]))&&_0xa09041){_0x2b652c=path[_0xbb10('0x7d')](config[_0xbb10('0x7e')],'server/files/images/logos/',_0x5e9888[_0xbb10('0x80')]);}}return _0xda122[_0xbb10('0x85')](_0x2b652c);}})[_0xbb10('0x2b')](handleError(_0xda122,null));};exports[_0xbb10('0x86')]=function(_0x136520,_0x28127c,_0x528aff){var _0xdfdc42=path[_0xbb10('0x7d')](config[_0xbb10('0x7e')],_0xbb10('0x87'));var _0x31718f={'where':{'id':_0x136520[_0xbb10('0x64')]['id']},'attributes':['id',_0xbb10('0x77')],'raw':!![]};return db['ChatWebsite'][_0xbb10('0x5a')](_0x31718f)['then'](handleEntityNotFound(_0x28127c,null))[_0xbb10('0x21')](function(_0x4a6660){if(_0x4a6660){if(!_['isNil'](_0x4a6660[_0xbb10('0x77')])){if(fs[_0xbb10('0x88')](path[_0xbb10('0x7d')](config[_0xbb10('0x7e')],_0xbb10('0x89'),_0x4a6660['agentAvatar']))){_0xdfdc42=path[_0xbb10('0x7d')](config['root'],'server/files/images/avatars/',_0x4a6660['agentAvatar']);}}return _0x28127c[_0xbb10('0x85')](_0xdfdc42);}})[_0xbb10('0x2b')](handleError(_0x28127c,null));};exports[_0xbb10('0x8a')]=function(_0x8a7c27,_0x2882d1,_0x5abedf){var _0x125bcf=path[_0xbb10('0x7d')](config[_0xbb10('0x7e')],_0xbb10('0x8b'));var _0x4b3b21={'where':{'id':_0x8a7c27[_0xbb10('0x64')]['id']},'attributes':['id',_0xbb10('0x79'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x4b3b21)[_0xbb10('0x21')](handleEntityNotFound(_0x2882d1,null))[_0xbb10('0x21')](function(_0x2ae3c6){if(_0x2ae3c6){if(!_[_0xbb10('0x83')](_0x2ae3c6[_0xbb10('0x79')])){if(fs[_0xbb10('0x88')](path[_0xbb10('0x7d')](config[_0xbb10('0x7e')],_0xbb10('0x89'),_0x2ae3c6[_0xbb10('0x79')]))&&_0x2ae3c6['showCustomerAvatar']){_0x125bcf=path['join'](config['root'],_0xbb10('0x89'),_0x2ae3c6[_0xbb10('0x79')]);}}return _0x2882d1[_0xbb10('0x85')](_0x125bcf);}})['catch'](handleError(_0x2882d1,null));};exports[_0xbb10('0x8c')]=function(_0x2f6be3,_0x2c638d,_0x290280){var _0x2a6589=path[_0xbb10('0x7d')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x356660={'where':{'id':_0x2f6be3['params']['id']},'attributes':['id',_0xbb10('0x7b')],'raw':!![]};return db[_0xbb10('0x3e')][_0xbb10('0x5a')](_0x356660)[_0xbb10('0x21')](handleEntityNotFound(_0x2c638d,null))[_0xbb10('0x21')](function(_0x2dfa04){if(_0x2dfa04){if(!_[_0xbb10('0x83')](_0x2dfa04[_0xbb10('0x7b')])){if(fs[_0xbb10('0x88')](path[_0xbb10('0x7d')](config['root'],_0xbb10('0x89'),_0x2dfa04['systemAvatar']))){_0x2a6589=path[_0xbb10('0x7d')](config['root'],_0xbb10('0x89'),_0x2dfa04[_0xbb10('0x7b')]);}}return _0x2c638d[_0xbb10('0x85')](_0x2a6589);}})[_0xbb10('0x2b')](handleError(_0x2c638d,null));};exports['notify']=function(_0xcc246f,_0x4960b1,_0xfe1154){var _0x1b6b9f=require(_0xbb10('0x8d'));var _0x5388dc=new _0x1b6b9f();var _0x298167=_0x5388dc[_0xbb10('0x8e')](_0xcc246f[_0xbb10('0x8f')][_0xbb10('0x90')])[_0xbb10('0x91')]();var _0x309ec1={'body':_0xcc246f['body'],'channel':'chat'};var _0x522a88=[];var _0x26a752=[];var _0x5ad3f1={};var _0x318908=![];return db['CmContact'][_0xbb10('0x66')]()[_0xbb10('0x21')](function(_0x385ad3){if(!_0x385ad3){throw new db['Sequelize']['ValidationError'](_0xbb10('0x92'));}_0x522a88=_[_0xbb10('0x93')](_[_0xbb10('0x40')](_0x385ad3),['createdAt',_0xbb10('0x94')]);_0x26a752=_[_0xbb10('0x93')](_[_0xbb10('0x40')](_0x385ad3),['createdAt','updatedAt','CompanyId',_0xbb10('0x95')]);if(_0xcc246f['body']['id']){delete _0xcc246f[_0xbb10('0x5c')]['id'];}if(_[_0xbb10('0x83')](_0xcc246f[_0xbb10('0x5c')][_0xbb10('0x96')])){throw new db[(_0xbb10('0x97'))][(_0xbb10('0x98'))](_0xbb10('0x99'));}if(_[_0xbb10('0x83')](_0xcc246f[_0xbb10('0x5c')][_0xbb10('0x5c')])||_0xcc246f[_0xbb10('0x5c')]['body']===''){throw new db[(_0xbb10('0x97'))][(_0xbb10('0x98'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbb10('0x83')](_0xcc246f['body']['mapKey'])){throw new db[(_0xbb10('0x97'))][(_0xbb10('0x98'))](_0xbb10('0x9a')+_0x26a752);}if(!_[_0xbb10('0x9b')](_0x26a752,_0xcc246f[_0xbb10('0x5c')]['mapKey'])){throw new db[(_0xbb10('0x97'))][(_0xbb10('0x98'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x26a752);}_0x5ad3f1[_0xcc246f[_0xbb10('0x5c')][_0xbb10('0x9c')]]=_0xcc246f['body'][_0xbb10('0x96')];})['then'](function(){return db[_0xbb10('0x3e')][_0xbb10('0x5a')]({'where':{'id':_0xcc246f[_0xbb10('0x64')]['id']},'include':[{'model':db[_0xbb10('0x9d')],'as':_0xbb10('0x9e'),'include':[{'model':db[_0xbb10('0x9f')],'as':_0xbb10('0xa0'),'where':_0x5ad3f1,'limit':0x1,'order':[['updatedAt',_0xbb10('0xa1')]]}]},{'model':db[_0xbb10('0xa2')],'as':_0xbb10('0xa3')}]});})[_0xbb10('0x21')](handleEntityNotFound(_0x4960b1,null))[_0xbb10('0x21')](function(_0x1301e3){if(_0x1301e3&&_0x1301e3['List']){_0x309ec1['account']=_0x1301e3;_0x309ec1['applications']=_0x1301e3[_0xbb10('0xa3')];_0x309ec1[_0xbb10('0xa4')]=_0x1301e3[_0xbb10('0x9e')];_0x309ec1[_0xbb10('0xa5')]=_['orderBy'](_0x309ec1[_0xbb10('0xa5')],[_0xbb10('0xa6')],[_0xbb10('0xa7')]);if(_0x309ec1['account']['Applications']){delete _0x309ec1[_0xbb10('0xa8')]['Applications'];}if(_0x309ec1[_0xbb10('0xa8')][_0xbb10('0x9e')]&&_0x309ec1[_0xbb10('0xa8')][_0xbb10('0x9e')][_0xbb10('0xa0')][_0xbb10('0x46')]){return _0x309ec1[_0xbb10('0xa8')]['List'][_0xbb10('0xa0')][0x0];}var _0x1eca6c=_['defaults'](_0xcc246f[_0xbb10('0x5c')],{'firstName':_0xcc246f[_0xbb10('0x5c')][_0xbb10('0x96')],'ListId':_0x1301e3['ListId']});_0x1eca6c[_0xcc246f['body']['mapKey']]=_0xcc246f[_0xbb10('0x5c')][_0xbb10('0x96')];return db['CmContact'][_0xbb10('0x5b')](_0x1eca6c,{'fields':_0x522a88,'raw':!![]});}})[_0xbb10('0x21')](handleEntityNotFound(_0x4960b1,null))[_0xbb10('0x21')](function(_0x24b0ea){_0x309ec1[_0xbb10('0xa9')]=_0x24b0ea;if(_0x24b0ea){var _0x1fe91e={'ContactId':_0x24b0ea['id'],'ChatWebsiteId':_0xcc246f[_0xbb10('0x64')]['id'],'from':(_0x24b0ea['firstName']||'')+'\x20'+(_0x24b0ea[_0xbb10('0xaa')]||''),'customerIp':_0xcc246f['body']['customerIp'],'referer':_0xcc246f['body'][_0xbb10('0xab')],'browserName':_0x298167[_0xbb10('0xac')]['name']&&_0x298167[_0xbb10('0xac')]['version']?util[_0xbb10('0xad')](_0xbb10('0xae'),_0x298167[_0xbb10('0xac')]['name'],_0x298167['browser'][_0xbb10('0xaf')]):'unknown','browserVersion':_0x298167[_0xbb10('0xac')][_0xbb10('0xaf')]||'unknown','osName':util['format'](_0xbb10('0xae'),_0x298167['os'][_0xbb10('0x3b')],_0x298167['os'][_0xbb10('0xaf')]),'osVersion':_0x298167['os']['version'],'deviceModel':_0x298167[_0xbb10('0xb0')][_0xbb10('0x3f')]&&_0x298167[_0xbb10('0xb0')]['vendor']?util[_0xbb10('0xad')](_0xbb10('0xb1'),_0x298167[_0xbb10('0xb0')][_0xbb10('0x3f')],_0x298167[_0xbb10('0xb0')][_0xbb10('0xb2')],_0x298167[_0xbb10('0xb0')][_0xbb10('0x4f')]):null,'deviceVendor':_0x298167[_0xbb10('0xb0')][_0xbb10('0xb2')],'deviceType':_0x298167[_0xbb10('0xb0')][_0xbb10('0x4f')],'formData':JSON[_0xbb10('0x26')](_0xcc246f['body'])};var _0x5eea19={'ChatWebsiteId':_0xcc246f[_0xbb10('0x64')]['id'],'closed':![]};if(_0xcc246f['body'][_0xbb10('0xb3')]){_0x5eea19[_0xbb10('0xb3')]=_0xcc246f[_0xbb10('0x5c')]['threadId'];return db[_0xbb10('0xb4')][_0xbb10('0x5a')]({'where':_0x5eea19})[_0xbb10('0x21')](function(_0xe5f8e2){if(_0xe5f8e2){return[_0xe5f8e2,![]];}_0x1fe91e[_0xbb10('0xb3')]=_0xcc246f['body'][_0xbb10('0xb3')];_0x1fe91e[_0xbb10('0xb5')]=_0xcc246f[_0xbb10('0x5c')][_0xbb10('0xb5')];return db[_0xbb10('0xb4')][_0xbb10('0x5b')](_0x1fe91e)['then'](function(_0x3d8043){return[_0x3d8043,!![]];});});}_0x5eea19[_0xbb10('0xb6')]=_0x24b0ea['id'];if(_0xcc246f['body'][_0xbb10('0xb7')]&&_0xcc246f[_0xbb10('0x5c')][_0xbb10('0xb7')]['id']){_0x5eea19['id']=_0xcc246f[_0xbb10('0x5c')][_0xbb10('0xb7')]['id'];return db[_0xbb10('0xb4')][_0xbb10('0x5a')]({'where':_0x5eea19})[_0xbb10('0x21')](function(_0x1d45c5){if(_0x1d45c5){return[_0x1d45c5,![]];}return db[_0xbb10('0xb4')][_0xbb10('0x5b')](_0x1fe91e)[_0xbb10('0x21')](function(_0x1db646){return[_0x1db646,!![]];});});}return db[_0xbb10('0xb4')][_0xbb10('0x5b')](_0x1fe91e)['then'](function(_0x12e6cb){return[_0x12e6cb,!![]];});}})[_0xbb10('0xb8')](function(_0x5507f6,_0x5baeaa){if(_0x5507f6){_0x318908=_0x5baeaa;if(!_0x5baeaa){var _0x237258={'from':(_0x309ec1[_0xbb10('0xa9')][_0xbb10('0xb9')]||'')+'\x20'+(_0x309ec1[_0xbb10('0xa9')][_0xbb10('0xaa')]||'')};if(_0xcc246f[_0xbb10('0x5c')][_0xbb10('0xb3')]&&_0xcc246f[_0xbb10('0x5c')][_0xbb10('0xba')]&&_0xcc246f['body']['threadId']!=_0xcc246f['body']['messageId']){_0x237258['threadId']=_0xcc246f['body'][_0xbb10('0xba')];}return _0x5507f6[_0xbb10('0x35')](_0x237258);}else{return _0x5507f6;}}})[_0xbb10('0x21')](function(_0x395ac8){_0x309ec1['interaction']=_0x395ac8[_0xbb10('0x37')]({'plain':!![]});_0x309ec1[_0xbb10('0xb7')][_0xbb10('0xbb')]=_0x318908;if(_0x309ec1[_0xbb10('0xb7')]['created']){if(_0x309ec1['account'][_0xbb10('0xbc')]){_0x309ec1[_0xbb10('0xa5')]['push']({'id':0x0,'priority':_0x309ec1['applications'][_0xbb10('0x46')]+0x1,'app':_0xbb10('0xbd'),'appdata':_0xbb10('0xbe'),'interval':_0xbb10('0xbf')});}}return db[_0xbb10('0xc0')]['create']({'body':_0xcc246f[_0xbb10('0x5c')]['body'],'ChatWebsiteId':_0xcc246f['params']['id'],'ChatInteractionId':_0x395ac8['id'],'direction':'in','ContactId':_0x309ec1[_0xbb10('0xa9')]['id'],'AttachmentId':_0xcc246f[_0xbb10('0x5c')][_0xbb10('0xc1')]});})[_0xbb10('0x21')](function(_0x3b1e6f){_0x309ec1[_0xbb10('0x29')]=_0x3b1e6f;if(_0x309ec1['interaction'][_0xbb10('0xc2')]){return db[_0xbb10('0xc3')][_0xbb10('0x5a')]({'attributes':['id',_0xbb10('0x3b')],'where':{'id':_0x309ec1[_0xbb10('0xb7')][_0xbb10('0xc2')]}})[_0xbb10('0x21')](function(_0xce60f4){if(_0xce60f4){_0x309ec1[_0xbb10('0xa5')][_0xbb10('0xc4')]({'id':0x0,'priority':0x0,'app':_0xbb10('0xc5'),'appdata':_0xce60f4[_0xbb10('0x3b')]+','+(_0x309ec1[_0xbb10('0xa8')][_0xbb10('0xc6')]||0xa),'interval':_0xbb10('0xbf')});_0x309ec1[_0xbb10('0xc7')]=!![];}return respondWithRpcPromise(_0xbb10('0xc8'),_0xbb10('0xc9'),_0x309ec1);});}return respondWithRpcPromise(_0xbb10('0xc8'),_0xbb10('0xc9'),_0x309ec1);})[_0xbb10('0x21')](function(_0x1f84b0){respondWithRpcPromise('EventManager',_0xbb10('0xca'),{'event':'notify','message':_0x1f84b0},client9002);return _0x1f84b0;})[_0xbb10('0x21')](respondWithResult(_0x4960b1,null))[_0xbb10('0x2b')](handleError(_0x4960b1,null));};exports[_0xbb10('0xcb')]=function(_0x2b1f0f,_0x40bbf1,_0x4f5689){var _0x5997f3,_0x572b4d,_0x36be49;var _0x2fac6c=[];var _0x482f7d=[];var _0x31b7f9={};return db[_0xbb10('0x9f')][_0xbb10('0x66')]()['then'](function(_0xae8e0a){if(!_0xae8e0a){throw new db[(_0xbb10('0x97'))][(_0xbb10('0x98'))]('no\x20available\x20attributes');}_0x482f7d=_[_0xbb10('0x93')](_['keys'](_0xae8e0a),[_0xbb10('0xcc'),'updatedAt']);_0x2fac6c=_['difference'](_['keys'](_0xae8e0a),['createdAt','updatedAt','CompanyId',_0xbb10('0x95')]);if(_0x2b1f0f[_0xbb10('0x5c')]['id']){delete _0x2b1f0f[_0xbb10('0x5c')]['id'];}if(_[_0xbb10('0x83')](_0x2b1f0f['body'][_0xbb10('0x96')])){throw _0x40bbf1[_0xbb10('0x2c')](0x1f4)[_0xbb10('0x3c')](new db[(_0xbb10('0x97'))][(_0xbb10('0x98'))](_0xbb10('0x99')));}if(_[_0xbb10('0x83')](_0x2b1f0f[_0xbb10('0x5c')][_0xbb10('0x5c')])||_0x2b1f0f[_0xbb10('0x5c')]['body']===''){throw _0x40bbf1[_0xbb10('0x2c')](0x1f4)[_0xbb10('0x3c')](new db[(_0xbb10('0x97'))]['ValidationError'](_0xbb10('0xcd')));}if(_[_0xbb10('0x83')](_0x2b1f0f[_0xbb10('0x5c')][_0xbb10('0xce')])){throw _0x40bbf1['status'](0x1f4)[_0xbb10('0x3c')](new db[(_0xbb10('0x97'))][(_0xbb10('0x98'))](_0xbb10('0xcf')+_0x2fac6c));}if(!_[_0xbb10('0x9b')](_0x2fac6c,_0x2b1f0f[_0xbb10('0x5c')][_0xbb10('0xce')])){throw _0x40bbf1[_0xbb10('0x2c')](0x1f4)[_0xbb10('0x3c')](new db[(_0xbb10('0x97'))][(_0xbb10('0x98'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2fac6c));}_0x31b7f9[_0x2b1f0f[_0xbb10('0x5c')][_0xbb10('0xce')]]=_0x2b1f0f['body']['from'];})[_0xbb10('0x21')](function(){return db[_0xbb10('0x3e')]['find']({'where':{'id':_0x2b1f0f[_0xbb10('0x64')]['id']},'include':[{'model':db[_0xbb10('0x9d')],'as':'List'}]});})[_0xbb10('0x21')](handleEntityNotFound(_0x40bbf1,null))[_0xbb10('0x21')](function(_0xb563e5){if(_0xb563e5&&_0xb563e5[_0xbb10('0x9e')]){_0x572b4d=_0xb563e5;var _0x3c92db=_['defaults'](_0x2b1f0f['body'],{'firstName':_0x2b1f0f['body'][_0xbb10('0x96')],'phone':_0x2b1f0f['body'][_0xbb10('0x96')],'ListId':_0xb563e5['ListId']});_0x3c92db[_0x2b1f0f['body'][_0xbb10('0xce')]]=_0x2b1f0f[_0xbb10('0x5c')][_0xbb10('0x96')];return db[_0xbb10('0x9f')][_0xbb10('0xd0')]({'where':_0x31b7f9,'defaults':_0x3c92db});}})[_0xbb10('0xb8')](function(_0x5b9d3f){if(_0x5b9d3f){_0x36be49=_0x5b9d3f;var _0x54d45b=fs['readFileSync'](path[_0xbb10('0x7d')](config[_0xbb10('0x7e')],_0xbb10('0xd1')),_0xbb10('0xd2'));var _0x26bc1c=ejs[_0xbb10('0xd3')](_0x54d45b,{'body':_[_0xbb10('0xd4')](_0x2b1f0f['body'][_0xbb10('0x5c')]),'bodyTitle':_0x572b4d[_0xbb10('0xd5')]});return db[_0xbb10('0xd6')][_0xbb10('0x5b')]({'body':_0x26bc1c,'ContactId':_0x5b9d3f['id'],'ChatWebsiteId':_0x572b4d['id']});}})['then'](function(_0x287d4f){if(_0x287d4f){_0x5997f3=_0x287d4f;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xbb10('0xd7')],'as':_0xbb10('0xd8'),'raw':!![]}]});}})[_0xbb10('0x21')](function(_0xf0c285){if(_0xf0c285&&_0xf0c285[_0xbb10('0xd8')]&&_0x572b4d[_0xbb10('0xd9')]){var _0x4b7bf8={'tls':{'rejectUnauthorized':![]}};if(_0xf0c285[_0xbb10('0xd8')][_0xbb10('0xda')]){_0x4b7bf8[_0xbb10('0xda')]=_0xf0c285[_0xbb10('0xd8')][_0xbb10('0xda')];}else{_0x4b7bf8[_0xbb10('0xdb')]=_0xf0c285[_0xbb10('0xd8')]['host'];_0x4b7bf8[_0xbb10('0xdc')]=_0xf0c285[_0xbb10('0xd8')][_0xbb10('0xdc')];_0x4b7bf8['secure']=_0xf0c285['Smtp'][_0xbb10('0xdd')];}if(_0xf0c285[_0xbb10('0xd8')][_0xbb10('0xde')]){_0x4b7bf8[_0xbb10('0xdf')]={'user':_0xf0c285[_0xbb10('0xd8')][_0xbb10('0x5d')],'pass':_0xf0c285[_0xbb10('0xd8')]['pass']};}return respondWithRpcPromise(_0xbb10('0xe0'),_0xbb10('0xe1'),{'account':_0x4b7bf8,'message':{'from':util[_0xbb10('0xad')]('\x22%s\x22\x20<%s>',_0xf0c285['name'],_0xf0c285['email']||_0xf0c285['Smtp'][_0xbb10('0x5d')]),'to':_0x572b4d[_0xbb10('0xd9')],'subject':_0x572b4d[_0xbb10('0xe2')],'text':_0x5997f3[_0xbb10('0x5c')]}},client9003)['then'](function(){return _0x5997f3;})[_0xbb10('0x2b')](function(_0x4f6b12){console[_0xbb10('0x27')](_0x4f6b12);});}})[_0xbb10('0x21')](function(){if(_0x5997f3){return _0x5997f3;}})[_0xbb10('0x21')](respondWithResult(_0x40bbf1,null))[_0xbb10('0x2b')](handleError(_0x40bbf1,null));};exports[_0xbb10('0xe3')]=function(_0x163fdd,_0x3c93d0,_0x4541f2){return db[_0xbb10('0xb4')][_0xbb10('0x5a')]({'where':{'id':_0x163fdd[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x3c93d0,null))['then'](function(_0x1bd6db){if(_0x1bd6db){return _0x1bd6db[_0xbb10('0xe3')](_0x163fdd[_0xbb10('0x5c')]['ids'],_[_0xbb10('0xe4')](_0x163fdd['body'],[_0xbb10('0x6e'),'id'])||{});}})[_0xbb10('0x21')](respondWithResult(_0x3c93d0,null))[_0xbb10('0x2b')](handleError(_0x3c93d0,null));};exports[_0xbb10('0xe5')]=function(_0x36a054,_0x533327,_0x5345df){var _0x842d94={'raw':![],'where':{}};var _0x4cf5cc={};var _0x553bb8={'count':0x0,'rows':[]};return db[_0xbb10('0x3e')]['findOne']({'where':{'id':_0x36a054[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x533327,null))[_0xbb10('0x21')](function(_0x4469c4){if(_0x4469c4){_0x4cf5cc[_0xbb10('0x3f')]=_[_0xbb10('0x40')](db[_0xbb10('0xb4')][_0xbb10('0x59')]);_0x4cf5cc['query']=_[_0xbb10('0x40')](_0x36a054['query']);_0x4cf5cc[_0xbb10('0x42')]=_['intersection'](_0x4cf5cc[_0xbb10('0x3f')],_0x4cf5cc[_0xbb10('0x41')]);_0x842d94['attributes']=_[_0xbb10('0x43')](_0x4cf5cc[_0xbb10('0x3f')],qs[_0xbb10('0x45')](_0x36a054['query'][_0xbb10('0x45')]));_0x842d94[_0xbb10('0x44')]=_0x842d94[_0xbb10('0x44')]['length']?_0x842d94[_0xbb10('0x44')]:_0x4cf5cc[_0xbb10('0x3f')];if(!_0x36a054[_0xbb10('0x41')]['hasOwnProperty'](_0xbb10('0x48'))){_0x842d94['limit']=qs[_0xbb10('0x30')](_0x36a054[_0xbb10('0x41')][_0xbb10('0x30')]);_0x842d94[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x36a054[_0xbb10('0x41')][_0xbb10('0x2f')]);}_0x842d94[_0xbb10('0x49')]=qs[_0xbb10('0x4a')](_0x36a054[_0xbb10('0x41')]['sort']);_0x842d94['where']=qs[_0xbb10('0x42')](_[_0xbb10('0x6b')](_0x36a054[_0xbb10('0x41')],_0x4cf5cc['filters']));_0x842d94[_0xbb10('0x4b')][_0xbb10('0x68')]=_0x4469c4['id'];if(_0x36a054[_0xbb10('0x41')][_0xbb10('0x4c')]){_0x842d94[_0xbb10('0x4b')]=_[_0xbb10('0x4d')](_0x842d94[_0xbb10('0x4b')],{'$or':_[_0xbb10('0x4e')](_0x842d94[_0xbb10('0x44')],function(_0x4d2c8d){var _0xa7e6bd={};_0xa7e6bd[_0x4d2c8d]={'$like':'%'+_0x36a054[_0xbb10('0x41')][_0xbb10('0x4c')]+'%'};return _0xa7e6bd;})});}_0x842d94=_[_0xbb10('0x4d')]({},_0x842d94,_0x36a054['options']);return db[_0xbb10('0xb4')][_0xbb10('0x54')]({'where':_0x842d94[_0xbb10('0x4b')]})['then'](function(_0x59f9b2){_0x553bb8[_0xbb10('0x54')]=_0x59f9b2;if(_0x36a054['query'][_0xbb10('0x55')]){_0x842d94['include']=[{'model':db[_0xbb10('0x9f')],'as':_0xbb10('0xe6'),'required':![]},{'model':db[_0xbb10('0xc3')],'as':_0xbb10('0xe7'),'attributes':[_0xbb10('0x3b'),_0xbb10('0xe8'),_0xbb10('0xe9')],'required':![]},{'model':db['Tag'],'as':_0xbb10('0xea'),'attributes':['id',_0xbb10('0x3b'),_0xbb10('0xeb')],'where':_0x36a054[_0xbb10('0x41')][_0xbb10('0xec')]?{'id':_0x36a054[_0xbb10('0x41')]['tag']}:undefined,'required':_0x36a054[_0xbb10('0x41')][_0xbb10('0xec')]?!![]:![]}];}return db[_0xbb10('0xb4')][_0xbb10('0x6c')](_0x842d94);})[_0xbb10('0x21')](function(_0x16edac){_0x553bb8[_0xbb10('0x57')]=_0x16edac;return _0x553bb8;});}})['then'](respondWithFilteredResult(_0x533327,_0x842d94))[_0xbb10('0x2b')](handleError(_0x533327,null));};function iftimePromise(_0x183e57,_0x1e8713){return respondWithRpcPromise('Command',_0xbb10('0xed'),{'command':_0x1e8713['timezone']?util[_0xbb10('0xad')](_0xbb10('0xee'),_0x183e57[_0xbb10('0xef')],_0x1e8713['timezone']):util['format'](_0xbb10('0xf0'),_0x183e57[_0xbb10('0xef')])},client9002)[_0xbb10('0x21')](function(_0x27ea82){var _0x8ef7c1=_0x27ea82&&_0x27ea82[_0xbb10('0xf1')](_0xbb10('0xf2'))>=0x0?!![]:![];logger[_0xbb10('0x22')](_0xbb10('0xf3'),_0x1e8713['id'],_0x183e57['id'],_0x183e57[_0xbb10('0xef')],_0x8ef7c1?_0xbb10('0xf4'):'OFFLINE',_0x1e8713['timezone']?_0x1e8713[_0xbb10('0xf5')]:_0xbb10('0xf6'));return _0x8ef7c1;})['catch'](function(_0x576df0){logger[_0xbb10('0x27')](_0xbb10('0xf3'),_0x1e8713['id'],_0x183e57['id'],_0x183e57[_0xbb10('0xef')],util['inspect'](_0x576df0,{'showHidden':![],'depth':null}),_0x1e8713[_0xbb10('0xf5')]?_0x1e8713[_0xbb10('0xf5')]:'No\x20timezone');return![];});}exports[_0xbb10('0xed')]=function(_0x97224a,_0x544c9c,_0x5a5349){var _0x3eb533=0x0;var _0x26ec8e=0x0;var _0xfefdc=![];var _0x5cab64;var _0x5acd22;return db[_0xbb10('0x3e')][_0xbb10('0x5a')]({'where':{'id':_0x97224a['params']['id']},'include':[{'model':db[_0xbb10('0xf7')],'as':_0xbb10('0xf7'),'include':[{'model':db['Interval'],'as':_0xbb10('0xf8'),'attributes':['id',_0xbb10('0xef')],'raw':!![]}]}]})[_0xbb10('0x21')](handleEntityNotFound(_0x544c9c,null))[_0xbb10('0x21')](function(_0x5ac4e6){if(_0x5ac4e6){_0x5cab64=_0x5ac4e6;return _0x5ac4e6[_0xbb10('0xf9')]({'raw':!![]});}})['then'](function(_0x423253){if(_0x5cab64){if(_0x423253){_0x5acd22=_0x423253;}}return require(_0xbb10('0xfa'))[_0xbb10('0x81')]();})[_0xbb10('0x21')](function(_0x3b2ed0){if(_0x3b2ed0){_0x26ec8e=_0x3b2ed0[_0xbb10('0xfb')];_0xfefdc=_0x3b2ed0[_0xbb10('0x82')];}})[_0xbb10('0x21')](function(){return db['ChatInteraction'][_0xbb10('0x54')]({'where':{'closed':![]}});})[_0xbb10('0x21')](function(_0x6cdbe6){_0x3eb533=_0x6cdbe6;if(_0x26ec8e&&_0x6cdbe6>_0x26ec8e){return db[_0xbb10('0xfc')]['findOne']({'where':{'id':0x1}})['then'](function(_0xd23108){if(_0xd23108){_0xd23108[_0xbb10('0xfd')](_0xbb10('0xfe'));}});}})[_0xbb10('0x21')](function(){if(_0x5cab64['Interval']&&_0x5cab64[_0xbb10('0xf7')][_0xbb10('0xf8')]){var _0x4f0a22=[];for(var _0x327a34=0x0;_0x327a34<_0x5cab64['Interval']['Intervals'][_0xbb10('0x46')];_0x327a34++){var _0x18cede=_0x5cab64[_0xbb10('0xf7')][_0xbb10('0xf8')][_0x327a34][_0xbb10('0x37')]({'plain':!![]});_0x4f0a22['push'](iftimePromise(_0x18cede,_0x5cab64));}return BPromise[_0xbb10('0xff')](_0x4f0a22)[_0xbb10('0x21')](function(_0x356601){return _[_0xbb10('0x100')](_0x356601);});}else{return!![];}})[_0xbb10('0x21')](function(_0x344089){var _0xb90ba5=fs[_0xbb10('0x101')](path[_0xbb10('0x7d')](config[_0xbb10('0x7e')],_0xbb10('0x102')),_0xbb10('0xd2'));var _0x74ca46={'remote':_0x5cab64[_0xbb10('0x103')],'query':querystring[_0xbb10('0x26')](_[_0xbb10('0x4d')](_0x5cab64[_0xbb10('0x37')]({'plain':!![]}),{'customerIp':_0x97224a[_0xbb10('0x8f')][_0xbb10('0x104')]||_0x97224a[_0xbb10('0x8f')][_0xbb10('0x105')]||_0x97224a[_0xbb10('0x106')][_0xbb10('0x107')]||_0x97224a['ip'],'referer':_0x97224a[_0xbb10('0x8f')][_0xbb10('0xab')],'openedInteractions':_0x3eb533,'maxInteractions':_0x26ec8e,'virtual':_0xfefdc[_0xbb10('0xfb')],'online':_0x344089,'custom':_0xfefdc}))[_0xbb10('0x108')](/'/g,'\x5c\x27')};_0x544c9c['send'](ejs[_0xbb10('0xd3')](Mustache[_0xbb10('0xd3')](_0xb90ba5,_0x74ca46),{'proactiveActions':_0x5acd22,'alignment':_0x5cab64['alignment'],'verticalAlignment':_0x5cab64[_0xbb10('0x109')]}));})[_0xbb10('0x2b')](handleError(_0x544c9c,null));};exports['addApplications']=function(_0x3a20c0,_0x3b96dd,_0x4e97fd){return db[_0xbb10('0x3e')][_0xbb10('0x71')]({'where':{'id':_0x3a20c0[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x3b96dd,null))['then'](function(_0x170061){if(_0x170061){return db[_0xbb10('0x10a')][_0xbb10('0x10b')](function(_0x16ebc4){return db['ChatApplication'][_0xbb10('0x36')]({'where':{'ChatWebsiteId':_0x3a20c0[_0xbb10('0x64')]['id']},'transaction':_0x16ebc4})[_0xbb10('0x21')](function(_0x420a2e){var _0x385e4b=_[_0xbb10('0x4e')](_0x3a20c0[_0xbb10('0x5c')],function(_0x135604){_0x135604[_0xbb10('0x68')]=_0x3a20c0[_0xbb10('0x64')]['id'];return _0x135604;});return db[_0xbb10('0xa2')]['bulkCreate'](_0x385e4b,{'transaction':_0x16ebc4});});})[_0xbb10('0x21')](function(){return db[_0xbb10('0xa2')][_0xbb10('0x10c')]({'where':{'ChatWebsiteId':_0x3a20c0[_0xbb10('0x64')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x3b96dd,null))[_0xbb10('0x2b')](handleError(_0x3b96dd,null));};exports[_0xbb10('0x10d')]=function(_0x4785fb,_0x366ded,_0x5f0576){var _0x473cee={};var _0x3cf414={};var _0x2c5dd1;var _0x5df18b;return db['ChatWebsite'][_0xbb10('0x71')]({'where':{'id':_0x4785fb[_0xbb10('0x64')]['id']}})['then'](handleEntityNotFound(_0x366ded,null))['then'](function(_0x424bb1){if(_0x424bb1){_0x2c5dd1=_0x424bb1;_0x3cf414[_0xbb10('0x3f')]=_[_0xbb10('0x40')](db[_0xbb10('0xa2')][_0xbb10('0x59')]);_0x3cf414[_0xbb10('0x41')]=_['keys'](_0x4785fb[_0xbb10('0x41')]);_0x3cf414[_0xbb10('0x42')]=_[_0xbb10('0x43')](_0x3cf414[_0xbb10('0x3f')],_0x3cf414[_0xbb10('0x41')]);_0x473cee[_0xbb10('0x44')]=_[_0xbb10('0x43')](_0x3cf414[_0xbb10('0x3f')],qs[_0xbb10('0x45')](_0x4785fb[_0xbb10('0x41')]['fields']));_0x473cee[_0xbb10('0x44')]=_0x473cee[_0xbb10('0x44')]['length']?_0x473cee['attributes']:_0x3cf414['model'];_0x473cee['order']=qs['sort'](_0x4785fb['query']['sort']);_0x473cee['where']=qs[_0xbb10('0x42')](_[_0xbb10('0x6b')](_0x4785fb['query'],_0x3cf414[_0xbb10('0x42')]));if(_0x4785fb[_0xbb10('0x41')][_0xbb10('0x4c')]){_0x473cee[_0xbb10('0x4b')]=_[_0xbb10('0x4d')](_0x473cee[_0xbb10('0x4b')],{'$or':_[_0xbb10('0x4e')](_0x473cee[_0xbb10('0x44')],function(_0x405428){var _0x14d9e7={};_0x14d9e7[_0x405428]={'$like':'%'+_0x4785fb[_0xbb10('0x41')][_0xbb10('0x4c')]+'%'};return _0x14d9e7;})});}_0x473cee=_['merge']({},_0x473cee,_0x4785fb[_0xbb10('0x53')]);return _0x2c5dd1[_0xbb10('0x10d')](_0x473cee);}})[_0xbb10('0x21')](function(_0x3a6298){if(_0x3a6298){_0x5df18b=_0x3a6298[_0xbb10('0x46')];if(!_0x4785fb['query'][_0xbb10('0x47')]('nolimit')){_0x473cee['limit']=qs[_0xbb10('0x30')](_0x4785fb[_0xbb10('0x41')]['limit']);_0x473cee[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4785fb[_0xbb10('0x41')][_0xbb10('0x2f')]);}return _0x2c5dd1[_0xbb10('0x10d')](_0x473cee);}})['then'](function(_0x486a2f){if(_0x486a2f){return _0x486a2f?{'count':_0x5df18b,'rows':_0x486a2f}:null;}})[_0xbb10('0x21')](respondWithResult(_0x366ded,null))[_0xbb10('0x2b')](handleError(_0x366ded,null));};exports['addProactiveActions']=function(_0x108f23,_0x4cf976,_0x5a83de){return db[_0xbb10('0x10e')][_0xbb10('0x5a')]({'where':{'id':_0x108f23[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x4cf976,null))[_0xbb10('0x21')](function(_0x23bea4){if(_0x23bea4){return _0x23bea4['addProactiveActions'](_0x108f23[_0xbb10('0x5c')][_0xbb10('0x6e')],_[_0xbb10('0xe4')](_0x108f23[_0xbb10('0x5c')],['ids','id'])||{});}})[_0xbb10('0x21')](respondWithResult(_0x4cf976,null))[_0xbb10('0x2b')](handleError(_0x4cf976,null));};exports['getProactiveActions']=function(_0x49ef50,_0xeac82d,_0x5a4de3){var _0x40ff8e={};var _0x30ffca={};var _0x214dcb;var _0x3e19f4;return db['ChatWebsite'][_0xbb10('0x71')]({'where':{'id':_0x49ef50['params']['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0xeac82d,null))[_0xbb10('0x21')](function(_0x1d926f){if(_0x1d926f){_0x214dcb=_0x1d926f;_0x30ffca[_0xbb10('0x3f')]=_[_0xbb10('0x40')](db[_0xbb10('0x10f')][_0xbb10('0x59')]);_0x30ffca[_0xbb10('0x41')]=_[_0xbb10('0x40')](_0x49ef50['query']);_0x30ffca[_0xbb10('0x42')]=_[_0xbb10('0x43')](_0x30ffca[_0xbb10('0x3f')],_0x30ffca[_0xbb10('0x41')]);_0x40ff8e[_0xbb10('0x44')]=_['intersection'](_0x30ffca[_0xbb10('0x3f')],qs[_0xbb10('0x45')](_0x49ef50[_0xbb10('0x41')][_0xbb10('0x45')]));_0x40ff8e[_0xbb10('0x44')]=_0x40ff8e['attributes']['length']?_0x40ff8e['attributes']:_0x30ffca[_0xbb10('0x3f')];_0x40ff8e['order']=qs['sort'](_0x49ef50[_0xbb10('0x41')]['sort']);_0x40ff8e[_0xbb10('0x4b')]=qs[_0xbb10('0x42')](_['pick'](_0x49ef50[_0xbb10('0x41')],_0x30ffca[_0xbb10('0x42')]));if(_0x49ef50[_0xbb10('0x41')][_0xbb10('0x4c')]){_0x40ff8e['where']=_['merge'](_0x40ff8e['where'],{'$or':_[_0xbb10('0x4e')](_0x40ff8e[_0xbb10('0x44')],function(_0x551d64){var _0x31c019={};_0x31c019[_0x551d64]={'$like':'%'+_0x49ef50[_0xbb10('0x41')][_0xbb10('0x4c')]+'%'};return _0x31c019;})});}_0x40ff8e=_[_0xbb10('0x4d')]({},_0x40ff8e,_0x49ef50[_0xbb10('0x53')]);return _0x214dcb['getProactiveActions'](_0x40ff8e);}})[_0xbb10('0x21')](function(_0x7e9e52){if(_0x7e9e52){_0x3e19f4=_0x7e9e52[_0xbb10('0x46')];if(!_0x49ef50['query'][_0xbb10('0x47')]('nolimit')){_0x40ff8e[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x49ef50[_0xbb10('0x41')]['limit']);_0x40ff8e[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x49ef50['query'][_0xbb10('0x2f')]);}return _0x214dcb[_0xbb10('0xf9')](_0x40ff8e);}})[_0xbb10('0x21')](function(_0x2e03eb){if(_0x2e03eb){return _0x2e03eb?{'count':_0x3e19f4,'rows':_0x2e03eb}:null;}})[_0xbb10('0x21')](respondWithResult(_0xeac82d,null))['catch'](handleError(_0xeac82d,null));};exports['getFields']=function(_0x1ef039,_0x3fe59b,_0x22dd3d){var _0x1b0734=_0x1ef039[_0xbb10('0x41')]['online']===_0xbb10('0x110')?_0xbb10('0x111'):_0xbb10('0x112');return db[_0xbb10('0x3e')][_0xbb10('0x5a')]({'attributes':['id',_0x1b0734],'where':{'id':_0x1ef039['params']['id']}})['then'](handleEntityNotFound(_0x3fe59b,null))[_0xbb10('0x21')](function(_0x18f6b1){if(_0x18f6b1){var _0x1052f5=_0x18f6b1[_0x1b0734];var _0x119e8f=_0x1052f5&&_0x1052f5['items']?_0x1052f5['items']:[];_0x3fe59b[_0xbb10('0x3c')]({'fromKey':_['isNil'](_0x1052f5['fromKey'])?undefined:_0x1052f5['fromKey'],'count':_0x119e8f['length'],'rows':_0x119e8f});}})[_0xbb10('0x2b')](handleError(_0x3fe59b,null));};exports[_0xbb10('0x113')]=function(_0x8dfa5e,_0x1f0938,_0x11e17e){var _0x520856={'raw':!![],'where':{}};var _0x12829c={};var _0x10c2cb={'count':0x0,'rows':[]};return db[_0xbb10('0x3e')]['findOne']({'where':{'id':_0x8dfa5e[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x1f0938,null))[_0xbb10('0x21')](function(_0x45c642){if(_0x45c642){_0x12829c[_0xbb10('0x3f')]=_[_0xbb10('0x40')](db[_0xbb10('0xd6')][_0xbb10('0x59')]);_0x12829c[_0xbb10('0x41')]=_[_0xbb10('0x40')](_0x8dfa5e[_0xbb10('0x41')]);_0x12829c[_0xbb10('0x42')]=_[_0xbb10('0x43')](_0x12829c[_0xbb10('0x3f')],_0x12829c[_0xbb10('0x41')]);_0x520856['attributes']=_['intersection'](_0x12829c['model'],qs[_0xbb10('0x45')](_0x8dfa5e['query'][_0xbb10('0x45')]));_0x520856['attributes']=_0x520856[_0xbb10('0x44')]['length']?_0x520856['attributes']:_0x12829c[_0xbb10('0x3f')];if(!_0x8dfa5e[_0xbb10('0x41')]['hasOwnProperty'](_0xbb10('0x48'))){_0x520856[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x8dfa5e[_0xbb10('0x41')]['limit']);_0x520856['offset']=qs[_0xbb10('0x2f')](_0x8dfa5e[_0xbb10('0x41')][_0xbb10('0x2f')]);}_0x520856[_0xbb10('0x49')]=qs[_0xbb10('0x4a')](_0x8dfa5e[_0xbb10('0x41')][_0xbb10('0x4a')]);_0x520856['where']=qs[_0xbb10('0x42')](_['pick'](_0x8dfa5e['query'],_0x12829c[_0xbb10('0x42')]));_0x520856['where'][_0xbb10('0x68')]=_0x45c642['id'];if(_0x8dfa5e[_0xbb10('0x41')][_0xbb10('0x4c')]){_0x520856[_0xbb10('0x4b')]=_[_0xbb10('0x4d')](_0x520856['where'],{'$or':_[_0xbb10('0x4e')](_0x520856[_0xbb10('0x44')],function(_0xf6f7ed){var _0x2701e8={};_0x2701e8[_0xf6f7ed]={'$like':'%'+_0x8dfa5e[_0xbb10('0x41')][_0xbb10('0x4c')]+'%'};return _0x2701e8;})});}_0x520856=_['merge']({},_0x520856,_0x8dfa5e['options']);return db[_0xbb10('0xd6')][_0xbb10('0x54')]({'where':_0x520856[_0xbb10('0x4b')]})[_0xbb10('0x21')](function(_0x38a9dc){_0x10c2cb['count']=_0x38a9dc;if(_0x8dfa5e['query'][_0xbb10('0x55')]){_0x520856[_0xbb10('0x56')]=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0x520856);})[_0xbb10('0x21')](function(_0xed53e6){_0x10c2cb[_0xbb10('0x57')]=_0xed53e6;return _0x10c2cb;});}})[_0xbb10('0x21')](respondWithFilteredResult(_0x1f0938,_0x520856))[_0xbb10('0x2b')](handleError(_0x1f0938,null));};exports[_0xbb10('0x114')]=function(_0x5ca40a,_0x23fa34,_0x205784){return db[_0xbb10('0x3e')][_0xbb10('0x5a')]({'where':{'id':_0x5ca40a[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x23fa34,null))[_0xbb10('0x21')](function(_0x22e865){if(_0x22e865){return _0x22e865[_0xbb10('0x114')](_0x5ca40a['body']['ids'],_['omit'](_0x5ca40a[_0xbb10('0x5c')],[_0xbb10('0x6e'),'id'])||{})[_0xbb10('0xb8')](function(_0x270853){for(var _0x55265e=0x0;_0x55265e<_0x5ca40a['body']['ids'][_0xbb10('0x46')];_0x55265e+=0x1){socket[_0xbb10('0x115')](_0xbb10('0x116'),{'UserId':_0x5ca40a[_0xbb10('0x5c')][_0xbb10('0x6e')][_0x55265e],'ChatWebsiteId':_0x5ca40a[_0xbb10('0x64')]['id']});}return _0x270853;});}})[_0xbb10('0x21')](respondWithResult(_0x23fa34,null))[_0xbb10('0x2b')](handleError(_0x23fa34,null));};exports[_0xbb10('0x117')]=function(_0xb3139c,_0x332ea6,_0x1d227f){var _0x3e148f;return db[_0xbb10('0x3e')]['find']({'where':{'id':_0xb3139c[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x332ea6,null))[_0xbb10('0x21')](function(_0x2cf657){if(_0x2cf657){return _0x2cf657[_0xbb10('0x117')](_0xb3139c[_0xbb10('0x41')]['ids'])[_0xbb10('0x21')](function(_0x9d612b){if(_[_0xbb10('0x118')](_0xb3139c[_0xbb10('0x41')][_0xbb10('0x6e')])){for(var _0x425743=0x0;_0x425743<_0xb3139c[_0xbb10('0x41')][_0xbb10('0x6e')][_0xbb10('0x46')];_0x425743+=0x1){socket['emit'](_0xbb10('0x119'),{'UserId':_0xb3139c[_0xbb10('0x41')][_0xbb10('0x6e')][_0x425743],'ChatWebsiteId':_0xb3139c[_0xbb10('0x64')]['id']});}}else{socket[_0xbb10('0x115')](_0xbb10('0x119'),{'UserId':_0xb3139c[_0xbb10('0x41')][_0xbb10('0x6e')],'ChatWebsiteId':_0xb3139c[_0xbb10('0x64')]['id']});}});}})['then'](respondWithStatusCode(_0x332ea6,null))[_0xbb10('0x2b')](handleError(_0x332ea6,null));};exports['getAgents']=function(_0x15c71d,_0x2cd1b0,_0x57e0b2){var _0x57b52d={};var _0x366f28={};var _0x1157fb;var _0x2b355f;return db[_0xbb10('0x3e')][_0xbb10('0x71')]({'where':{'id':_0x15c71d[_0xbb10('0x64')]['id']}})[_0xbb10('0x21')](handleEntityNotFound(_0x2cd1b0,null))[_0xbb10('0x21')](function(_0x3108fc){if(_0x3108fc){_0x1157fb=_0x3108fc;_0x366f28[_0xbb10('0x3f')]=_[_0xbb10('0x40')](db[_0xbb10('0xc3')][_0xbb10('0x59')]);_0x366f28[_0xbb10('0x41')]=_[_0xbb10('0x40')](_0x15c71d['query']);_0x366f28[_0xbb10('0x42')]=_['intersection'](_0x366f28[_0xbb10('0x3f')],_0x366f28[_0xbb10('0x41')]);_0x57b52d[_0xbb10('0x44')]=_[_0xbb10('0x43')](_0x366f28[_0xbb10('0x3f')],qs[_0xbb10('0x45')](_0x15c71d[_0xbb10('0x41')][_0xbb10('0x45')]));_0x57b52d[_0xbb10('0x44')]=_0x57b52d['attributes']['length']?_0x57b52d[_0xbb10('0x44')]:_0x366f28[_0xbb10('0x3f')];_0x57b52d[_0xbb10('0x49')]=qs['sort'](_0x15c71d[_0xbb10('0x41')]['sort']);_0x57b52d[_0xbb10('0x4b')]=qs[_0xbb10('0x42')](_['pick'](_0x15c71d[_0xbb10('0x41')],_0x366f28[_0xbb10('0x42')]));if(_0x15c71d[_0xbb10('0x41')][_0xbb10('0x4c')]){_0x57b52d[_0xbb10('0x4b')]=_['merge'](_0x57b52d[_0xbb10('0x4b')],{'$or':_[_0xbb10('0x4e')](_0x57b52d['attributes'],function(_0x358e1c){var _0x1b0a9b={};_0x1b0a9b[_0x358e1c]={'$like':'%'+_0x15c71d['query'][_0xbb10('0x4c')]+'%'};return _0x1b0a9b;})});}_0x57b52d=_[_0xbb10('0x4d')]({},_0x57b52d,_0x15c71d[_0xbb10('0x53')]);return _0x1157fb[_0xbb10('0x11a')](_0x57b52d);}})['then'](function(_0xa0f8c3){if(_0xa0f8c3){_0x2b355f=_0xa0f8c3[_0xbb10('0x46')];if(!_0x15c71d[_0xbb10('0x41')]['hasOwnProperty']('nolimit')){_0x57b52d[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x15c71d[_0xbb10('0x41')][_0xbb10('0x30')]);_0x57b52d['offset']=qs[_0xbb10('0x2f')](_0x15c71d[_0xbb10('0x41')][_0xbb10('0x2f')]);}return _0x1157fb[_0xbb10('0x11a')](_0x57b52d);}})[_0xbb10('0x21')](function(_0x5cfad3){if(_0x5cfad3){return _0x5cfad3?{'count':_0x2b355f,'rows':_0x5cfad3}:null;}})['then'](respondWithResult(_0x2cd1b0,null))[_0xbb10('0x2b')](handleError(_0x2cd1b0,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c5c8acb..8b16398 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 _0xd89f=['exports','events','../../mysqldb','ChatWebsite','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x316a44,_0x5ec854){var _0x54aff9=function(_0x38ef43){while(--_0x38ef43){_0x316a44['push'](_0x316a44['shift']());}};_0x54aff9(++_0x5ec854);}(_0xd89f,0x191));var _0xfd89=function(_0x297f41,_0x430b4d){_0x297f41=_0x297f41-0x0;var _0x3f2a46=_0xd89f[_0x297f41];return _0x3f2a46;};'use strict';var EventEmitter=require(_0xfd89('0x0'));var ChatWebsite=require(_0xfd89('0x1'))['db'][_0xfd89('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd89('0x3'),'afterUpdate':_0xfd89('0x4'),'afterDestroy':_0xfd89('0x5')};function emitEvent(_0x2ff053){return function(_0x3de2e2,_0x15bdb8,_0x4e6429){ChatWebsiteEvents[_0xfd89('0x6')](_0x2ff053+':'+_0x3de2e2['id'],_0x3de2e2);ChatWebsiteEvents[_0xfd89('0x6')](_0x2ff053,_0x3de2e2);_0x4e6429(null);};}for(var e in events){if(events[_0xfd89('0x7')](e)){var event=events[e];ChatWebsite[_0xfd89('0x8')](e,emitEvent(event));}}module[_0xfd89('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x5a63=['../../mysqldb','save','emit','hasOwnProperty','exports','events'];(function(_0x545a3a,_0x3123aa){var _0x5a5493=function(_0x4e6bce){while(--_0x4e6bce){_0x545a3a['push'](_0x545a3a['shift']());}};_0x5a5493(++_0x3123aa);}(_0x5a63,0xe3));var _0x35a6=function(_0x232a78,_0x59ff9a){_0x232a78=_0x232a78-0x0;var _0x5907eb=_0x5a63[_0x232a78];return _0x5907eb;};'use strict';var EventEmitter=require(_0x35a6('0x0'));var ChatWebsite=require(_0x35a6('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x35a6('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x308a05){return function(_0x3462ed,_0x7a89ee,_0x4c032d){ChatWebsiteEvents[_0x35a6('0x3')](_0x308a05+':'+_0x3462ed['id'],_0x3462ed);ChatWebsiteEvents['emit'](_0x308a05,_0x3462ed);_0x4c032d(null);};}for(var e in events){if(events[_0x35a6('0x4')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x35a6('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 1f3bfc0..2821322 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 _0xf6fb=['chat_websites','../../config/logger','api','bluebird','request-promise','exports','define','ChatWebsite'];(function(_0x1a9fd3,_0x3520c6){var _0x21dff6=function(_0x9d0372){while(--_0x9d0372){_0x1a9fd3['push'](_0x1a9fd3['shift']());}};_0x21dff6(++_0x3520c6);}(_0xf6fb,0x111));var _0xbf6f=function(_0x14c2a1,_0x1defb8){_0x14c2a1=_0x14c2a1-0x0;var _0xa9333=_0xf6fb[_0x14c2a1];return _0xa9333;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf6f('0x0'))(_0xbf6f('0x1'));var moment=require('moment');var BPromise=require(_0xbf6f('0x2'));var rp=require(_0xbf6f('0x3'));var attributes=require('./chatWebsite.attributes');module[_0xbf6f('0x4')]=function(_0x4f7bc9,_0x121ca1){return _0x4f7bc9[_0xbf6f('0x5')](_0xbf6f('0x6'),attributes,{'tableName':_0xbf6f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0834=['define','chat_websites','../../config/logger','api','./chatWebsite.attributes','exports'];(function(_0x37b9f7,_0x33e9a1){var _0x311feb=function(_0x4fc773){while(--_0x4fc773){_0x37b9f7['push'](_0x37b9f7['shift']());}};_0x311feb(++_0x33e9a1);}(_0x0834,0x18e));var _0x4083=function(_0x3bafe6,_0x3432b7){_0x3bafe6=_0x3bafe6-0x0;var _0x30bc43=_0x0834[_0x3bafe6];return _0x30bc43;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4083('0x0'))(_0x4083('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x4083('0x2'));module[_0x4083('0x3')]=function(_0x4e3837,_0x3579bb){return _0x4e3837[_0x4083('0x4')]('ChatWebsite',attributes,{'tableName':_0x4083('0x5'),'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 24e6151..d981d6c 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 _0xa0e1=['request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatWebsite.socket','register','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xa0e1,0x14d));var _0x1a0e=function(_0x99dc77,_0x42f2f5){_0x99dc77=_0x99dc77-0x0;var _0x2b1a91=_0xa0e1[_0x99dc77];return _0x2b1a91;};'use strict';var _=require('lodash');var util=require(_0x1a0e('0x0'));var moment=require(_0x1a0e('0x1'));var BPromise=require('bluebird');var rs=require(_0x1a0e('0x2'));var fs=require('fs');var Redis=require(_0x1a0e('0x3'));var db=require(_0x1a0e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a0e('0x5'))(_0x1a0e('0x6'));var config=require(_0x1a0e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1a0e('0x8')][_0x1a0e('0x9')]({'port':0x232a});config[_0x1a0e('0xa')]=_[_0x1a0e('0xb')](config['redis'],{'host':_0x1a0e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1a0e('0xd'))[_0x1a0e('0xe')](socket);function respondWithRpcPromise(_0xa308af,_0x2d30ae,_0x322f77){return new BPromise(function(_0x2f6a7e,_0x43af93){return client['request'](_0xa308af,_0x322f77)['then'](function(_0x20f806){logger[_0x1a0e('0xf')](_0x1a0e('0x10'),_0x2d30ae,_0x1a0e('0x11'));logger['debug'](_0x1a0e('0x12'),_0x2d30ae,_0x1a0e('0x11'),JSON[_0x1a0e('0x13')](_0x20f806));if(_0x20f806[_0x1a0e('0x14')]){if(_0x20f806[_0x1a0e('0x14')][_0x1a0e('0x15')]===0x1f4){logger[_0x1a0e('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x2d30ae,_0x20f806[_0x1a0e('0x14')][_0x1a0e('0x16')]);return _0x43af93(_0x20f806[_0x1a0e('0x14')]['message']);}logger[_0x1a0e('0x14')](_0x1a0e('0x10'),_0x2d30ae,_0x20f806[_0x1a0e('0x14')][_0x1a0e('0x16')]);return _0x2f6a7e(_0x20f806[_0x1a0e('0x14')][_0x1a0e('0x16')]);}else{logger[_0x1a0e('0xf')](_0x1a0e('0x10'),_0x2d30ae,_0x1a0e('0x11'));_0x2f6a7e(_0x20f806[_0x1a0e('0x17')][_0x1a0e('0x16')]);}})[_0x1a0e('0x18')](function(_0x133eff){logger[_0x1a0e('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x2d30ae,_0x133eff);_0x43af93(_0x133eff);});});} \ No newline at end of file +var _0x9e8e=['code','message','result','lodash','util','moment','bluebird','ioredis','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatWebsite.socket','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x6c823,_0x3f5e35){var _0x1fda1b=function(_0x1eb5b5){while(--_0x1eb5b5){_0x6c823['push'](_0x6c823['shift']());}};_0x1fda1b(++_0x3f5e35);}(_0x9e8e,0x179));var _0xe9e8=function(_0xe6946,_0x8c96ef){_0xe6946=_0xe6946-0x0;var _0x372213=_0x9e8e[_0xe6946];return _0x372213;};'use strict';var _=require(_0xe9e8('0x0'));var util=require(_0xe9e8('0x1'));var moment=require(_0xe9e8('0x2'));var BPromise=require(_0xe9e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe9e8('0x5'));var config=require('../../config/environment');var jayson=require(_0xe9e8('0x6'));var client=jayson[_0xe9e8('0x7')][_0xe9e8('0x8')]({'port':0x232a});config['redis']=_[_0xe9e8('0x9')](config[_0xe9e8('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe9e8('0xb'))(new Redis(config[_0xe9e8('0xa')]));require(_0xe9e8('0xc'))['register'](socket);function respondWithRpcPromise(_0x583d48,_0x4bef65,_0x5ad8ae){return new BPromise(function(_0x10cd4b,_0x5e444b){return client['request'](_0x583d48,_0x5ad8ae)['then'](function(_0x49e8ce){logger[_0xe9e8('0xd')](_0xe9e8('0xe'),_0x4bef65,_0xe9e8('0xf'));logger[_0xe9e8('0x10')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4bef65,_0xe9e8('0xf'),JSON[_0xe9e8('0x11')](_0x49e8ce));if(_0x49e8ce[_0xe9e8('0x12')]){if(_0x49e8ce['error'][_0xe9e8('0x13')]===0x1f4){logger['error'](_0xe9e8('0xe'),_0x4bef65,_0x49e8ce[_0xe9e8('0x12')][_0xe9e8('0x14')]);return _0x5e444b(_0x49e8ce[_0xe9e8('0x12')][_0xe9e8('0x14')]);}logger['error'](_0xe9e8('0xe'),_0x4bef65,_0x49e8ce['error'][_0xe9e8('0x14')]);return _0x10cd4b(_0x49e8ce[_0xe9e8('0x12')]['message']);}else{logger[_0xe9e8('0xd')](_0xe9e8('0xe'),_0x4bef65,_0xe9e8('0xf'));_0x10cd4b(_0x49e8ce[_0xe9e8('0x15')]['message']);}})['catch'](function(_0x1d56b2){logger[_0xe9e8('0x12')](_0xe9e8('0xe'),_0x4bef65,_0x1d56b2);_0x5e444b(_0x1d56b2);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 1c46d78..66d8523 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 _0x4c71=['length','chatWebsite:','./chatWebsite.events','save','remove','update','emit','removeListener','register'];(function(_0x40951a,_0x2e792e){var _0x1de4c8=function(_0x225b4d){while(--_0x225b4d){_0x40951a['push'](_0x40951a['shift']());}};_0x1de4c8(++_0x2e792e);}(_0x4c71,0x185));var _0x14c7=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x4c71[_0x465a0c];return _0x1e202e;};'use strict';var ChatWebsiteEvents=require(_0x14c7('0x0'));var events=[_0x14c7('0x1'),_0x14c7('0x2'),_0x14c7('0x3')];function createListener(_0x2c9b77,_0x5a55a3){return function(_0xb2d5e0){_0x5a55a3[_0x14c7('0x4')](_0x2c9b77,_0xb2d5e0);};}function removeListener(_0x2192ae,_0xf1308d){return function(){ChatWebsiteEvents[_0x14c7('0x5')](_0x2192ae,_0xf1308d);};}exports[_0x14c7('0x6')]=function(_0x139738){for(var _0x3ce766=0x0,_0x1cbb74=events[_0x14c7('0x7')];_0x3ce766<_0x1cbb74;_0x3ce766++){var _0x68cd=events[_0x3ce766];var _0x1d4816=createListener(_0x14c7('0x8')+_0x68cd,_0x139738);ChatWebsiteEvents['on'](_0x68cd,_0x1d4816);}}; \ No newline at end of file +var _0x7380=['removeListener','chatWebsite:','save','remove'];(function(_0x13fac4,_0x3ca5b9){var _0x3daa35=function(_0x562144){while(--_0x562144){_0x13fac4['push'](_0x13fac4['shift']());}};_0x3daa35(++_0x3ca5b9);}(_0x7380,0x172));var _0x0738=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x7380[_0x1fc122];return _0xa2cb13;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x0738('0x0'),_0x0738('0x1'),'update'];function createListener(_0x48479a,_0x151b00){return function(_0xdb7ed1){_0x151b00['emit'](_0x48479a,_0xdb7ed1);};}function removeListener(_0x235e91,_0x2ed2be){return function(){ChatWebsiteEvents[_0x0738('0x2')](_0x235e91,_0x2ed2be);};}exports['register']=function(_0x5eef50){for(var _0x53272=0x0,_0x2d20bb=events['length'];_0x53272<_0x2d20bb;_0x53272++){var _0x5820db=events[_0x53272];var _0x14789c=createListener(_0x0738('0x3')+_0x5820db,_0x5eef50);ChatWebsiteEvents['on'](_0x5820db,_0x14789c);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index a683a6c..5b7cfe1 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 _0x3308=['/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','/:id/interactions','addApplications','addProactiveActions','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5538d5,_0x190032){var _0x323b1a=function(_0x179caa){while(--_0x179caa){_0x5538d5['push'](_0x5538d5['shift']());}};_0x323b1a(++_0x190032);}(_0x3308,0x12e));var _0x8330=function(_0x9e5824,_0x1cc6bd){_0x9e5824=_0x9e5824-0x0;var _0x50aff2=_0x3308[_0x9e5824];return _0x50aff2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8330('0x0'));var express=require(_0x8330('0x1'));var router=express[_0x8330('0x2')]();var auth=require(_0x8330('0x3'));var interaction=require(_0x8330('0x4'));var config=require('../../config/environment');var controller=require(_0x8330('0x5'));router[_0x8330('0x6')]('/',auth[_0x8330('0x7')](),controller[_0x8330('0x8')]);router[_0x8330('0x6')](_0x8330('0x9'),auth['isAuthenticated'](),controller[_0x8330('0xa')]);router[_0x8330('0x6')](_0x8330('0xb'),auth['isAuthenticated'](),controller[_0x8330('0xc')]);router[_0x8330('0x6')]('/:id/dispositions',auth[_0x8330('0x7')](),controller['getDispositions']);router[_0x8330('0x6')](_0x8330('0xd'),auth['isAuthenticated'](),controller[_0x8330('0xe')]);router['get'](_0x8330('0xf'),controller['getLogo']);router['get'](_0x8330('0x10'),controller['getAvatar']);router[_0x8330('0x6')](_0x8330('0x11'),controller[_0x8330('0x12')]);router[_0x8330('0x6')](_0x8330('0x13'),controller[_0x8330('0x14')]);router['get']('/:id/interactions',auth[_0x8330('0x7')](),controller[_0x8330('0x15')]);router['get'](_0x8330('0x16'),controller['getSnippet']);router[_0x8330('0x6')](_0x8330('0x17'),auth['isAuthenticated'](),controller[_0x8330('0x18')]);router[_0x8330('0x6')](_0x8330('0x19'),auth[_0x8330('0x7')](),controller['getProactiveActions']);router['get'](_0x8330('0x1a'),controller[_0x8330('0x1b')]);router[_0x8330('0x6')](_0x8330('0x1c'),auth[_0x8330('0x7')](),controller[_0x8330('0x1d')]);router['get'](_0x8330('0x1e'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8330('0x1f')]('/:id/dispositions',auth[_0x8330('0x7')](),controller[_0x8330('0x20')]);router[_0x8330('0x1f')](_0x8330('0xd'),auth[_0x8330('0x7')](),controller[_0x8330('0x21')]);var upload=multer({'storage':multer[_0x8330('0x22')]({'destination':function(_0xf06a95,_0x326876,_0x2981eb){_0x2981eb(null,path[_0x8330('0x23')](config[_0x8330('0x24')],_0x8330('0x25')));},'filename':function(_0x1f0b66,_0x443978,_0x48d355){_0x48d355(null,util[_0x8330('0x26')](_0x8330('0x27'),Date[_0x8330('0x28')](),_0x443978[_0x8330('0x29')]));}})});router[_0x8330('0x1f')](_0x8330('0xf'),upload[_0x8330('0x2a')](_0x8330('0x2b')),controller['addLogo']);var upload=multer({'storage':multer[_0x8330('0x22')]({'destination':function(_0xa81757,_0xb9585f,_0x52bd34){_0x52bd34(null,path[_0x8330('0x23')](config[_0x8330('0x24')],_0x8330('0x2c')));},'filename':function(_0x21e02d,_0x24707e,_0x20defe){_0x20defe(null,util[_0x8330('0x26')](_0x8330('0x27'),Date[_0x8330('0x28')](),_0x24707e['originalname']));}})});router[_0x8330('0x1f')]('/:id/avatar',upload['single'](_0x8330('0x2b')),controller[_0x8330('0x2d')]);var upload=multer({'storage':multer[_0x8330('0x22')]({'destination':function(_0xc97d52,_0x400657,_0x4c852a){_0x4c852a(null,path[_0x8330('0x23')](config[_0x8330('0x24')],'server/files/images/avatars/'));},'filename':function(_0x2f025a,_0x1a46f7,_0x486d36){_0x486d36(null,util[_0x8330('0x26')](_0x8330('0x27'),Date[_0x8330('0x28')](),_0x1a46f7[_0x8330('0x29')]));}})});router[_0x8330('0x1f')](_0x8330('0x11'),upload[_0x8330('0x2a')](_0x8330('0x2b')),controller[_0x8330('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x35a8fb,_0x240e63,_0x480d43){_0x480d43(null,path[_0x8330('0x23')](config[_0x8330('0x24')],_0x8330('0x2c')));},'filename':function(_0x242e18,_0x180a21,_0x11ba63){_0x11ba63(null,util[_0x8330('0x26')]('%s-%s',Date[_0x8330('0x28')](),_0x180a21[_0x8330('0x29')]));}})});router[_0x8330('0x1f')](_0x8330('0x13'),upload[_0x8330('0x2a')](_0x8330('0x2b')),controller[_0x8330('0x2f')]);router['post'](_0x8330('0x30'),controller[_0x8330('0x31')]);router['post'](_0x8330('0x32'),controller['offline']);router[_0x8330('0x1f')](_0x8330('0x33'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x8330('0x1f')](_0x8330('0x17'),auth[_0x8330('0x7')](),controller[_0x8330('0x34')]);router['post'](_0x8330('0x19'),auth[_0x8330('0x7')](),controller[_0x8330('0x35')]);router['post'](_0x8330('0x1e'),auth[_0x8330('0x7')](),controller['addAgents']);router[_0x8330('0x36')](_0x8330('0xb'),auth[_0x8330('0x7')](),controller[_0x8330('0x37')]);router[_0x8330('0x38')](_0x8330('0xb'),auth['isAuthenticated'](),controller[_0x8330('0x39')]);router[_0x8330('0x38')](_0x8330('0x3a'),auth[_0x8330('0x7')](),controller[_0x8330('0x3b')]);router[_0x8330('0x38')](_0x8330('0xd'),auth[_0x8330('0x7')](),controller[_0x8330('0x3c')]);router['delete']('/:id/users',auth[_0x8330('0x7')](),controller[_0x8330('0x3d')]);module[_0x8330('0x3e')]=router; \ No newline at end of file +var _0x2b37=['addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','file','addLogo','server/files/images/avatars/','now','addAvatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addApplications','update','delete','destroy','removeDispositions','/:id/users','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','get','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getAgents','post','create','addDisposition'];(function(_0x47888a,_0x7d2f3a){var _0x2b15a4=function(_0x12a3e9){while(--_0x12a3e9){_0x47888a['push'](_0x47888a['shift']());}};_0x2b15a4(++_0x7d2f3a);}(_0x2b37,0x12b));var _0x72b3=function(_0x21dce8,_0x14adba){_0x21dce8=_0x21dce8-0x0;var _0x34a5c9=_0x2b37[_0x21dce8];return _0x34a5c9;};'use strict';var multer=require(_0x72b3('0x0'));var util=require(_0x72b3('0x1'));var path=require(_0x72b3('0x2'));var timeout=require(_0x72b3('0x3'));var express=require(_0x72b3('0x4'));var router=express[_0x72b3('0x5')]();var auth=require(_0x72b3('0x6'));var interaction=require(_0x72b3('0x7'));var config=require(_0x72b3('0x8'));var controller=require(_0x72b3('0x9'));router['get']('/',auth[_0x72b3('0xa')](),controller[_0x72b3('0xb')]);router['get'](_0x72b3('0xc'),auth[_0x72b3('0xa')](),controller[_0x72b3('0xd')]);router['get'](_0x72b3('0xe'),auth[_0x72b3('0xa')](),controller[_0x72b3('0xf')]);router['get'](_0x72b3('0x10'),auth[_0x72b3('0xa')](),controller[_0x72b3('0x11')]);router[_0x72b3('0x12')](_0x72b3('0x13'),auth[_0x72b3('0xa')](),controller[_0x72b3('0x14')]);router['get'](_0x72b3('0x15'),controller[_0x72b3('0x16')]);router['get'](_0x72b3('0x17'),controller['getAvatar']);router['get'](_0x72b3('0x18'),controller[_0x72b3('0x19')]);router[_0x72b3('0x12')](_0x72b3('0x1a'),controller[_0x72b3('0x1b')]);router[_0x72b3('0x12')](_0x72b3('0x1c'),auth[_0x72b3('0xa')](),controller[_0x72b3('0x1d')]);router[_0x72b3('0x12')](_0x72b3('0x1e'),controller['getSnippet']);router[_0x72b3('0x12')](_0x72b3('0x1f'),auth[_0x72b3('0xa')](),controller[_0x72b3('0x20')]);router[_0x72b3('0x12')](_0x72b3('0x21'),auth[_0x72b3('0xa')](),controller['getProactiveActions']);router[_0x72b3('0x12')](_0x72b3('0x22'),controller[_0x72b3('0x23')]);router[_0x72b3('0x12')](_0x72b3('0x24'),auth[_0x72b3('0xa')](),controller['getOfflineMessages']);router[_0x72b3('0x12')]('/:id/users',auth[_0x72b3('0xa')](),controller[_0x72b3('0x25')]);router[_0x72b3('0x26')]('/',auth[_0x72b3('0xa')](),controller[_0x72b3('0x27')]);router['post']('/:id/dispositions',auth[_0x72b3('0xa')](),controller[_0x72b3('0x28')]);router[_0x72b3('0x26')](_0x72b3('0x13'),auth[_0x72b3('0xa')](),controller[_0x72b3('0x29')]);var upload=multer({'storage':multer[_0x72b3('0x2a')]({'destination':function(_0x277cee,_0x5007de,_0x59763b){_0x59763b(null,path[_0x72b3('0x2b')](config[_0x72b3('0x2c')],_0x72b3('0x2d')));},'filename':function(_0x46e584,_0x3df948,_0x5509ad){_0x5509ad(null,util[_0x72b3('0x2e')](_0x72b3('0x2f'),Date['now'](),_0x3df948[_0x72b3('0x30')]));}})});router[_0x72b3('0x26')](_0x72b3('0x15'),upload['single'](_0x72b3('0x31')),controller[_0x72b3('0x32')]);var upload=multer({'storage':multer[_0x72b3('0x2a')]({'destination':function(_0x546dfd,_0xfa238c,_0x19afed){_0x19afed(null,path[_0x72b3('0x2b')](config[_0x72b3('0x2c')],_0x72b3('0x33')));},'filename':function(_0x1f2ec9,_0x354a39,_0xa3cd5){_0xa3cd5(null,util[_0x72b3('0x2e')]('%s-%s',Date[_0x72b3('0x34')](),_0x354a39[_0x72b3('0x30')]));}})});router[_0x72b3('0x26')]('/:id/avatar',upload['single'](_0x72b3('0x31')),controller[_0x72b3('0x35')]);var upload=multer({'storage':multer[_0x72b3('0x2a')]({'destination':function(_0x5c743f,_0x5bfea0,_0x4078bf){_0x4078bf(null,path[_0x72b3('0x2b')](config[_0x72b3('0x2c')],_0x72b3('0x33')));},'filename':function(_0x23ce77,_0x8b44c2,_0x440ce1){_0x440ce1(null,util[_0x72b3('0x2e')](_0x72b3('0x2f'),Date[_0x72b3('0x34')](),_0x8b44c2[_0x72b3('0x30')]));}})});router['post'](_0x72b3('0x18'),upload[_0x72b3('0x36')](_0x72b3('0x31')),controller[_0x72b3('0x37')]);var upload=multer({'storage':multer[_0x72b3('0x2a')]({'destination':function(_0x3b7f0e,_0x7a9d85,_0x574415){_0x574415(null,path[_0x72b3('0x2b')](config[_0x72b3('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x40d4b0,_0x57200c,_0x3c5257){_0x3c5257(null,util[_0x72b3('0x2e')](_0x72b3('0x2f'),Date['now'](),_0x57200c[_0x72b3('0x30')]));}})});router[_0x72b3('0x26')](_0x72b3('0x1a'),upload[_0x72b3('0x36')]('file'),controller[_0x72b3('0x38')]);router['post'](_0x72b3('0x39'),controller[_0x72b3('0x3a')]);router[_0x72b3('0x26')](_0x72b3('0x3b'),controller[_0x72b3('0x3c')]);router['post'](_0x72b3('0x1c'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x72b3('0x26')](_0x72b3('0x1f'),auth[_0x72b3('0xa')](),controller[_0x72b3('0x3d')]);router[_0x72b3('0x26')]('/:id/proactive_actions',auth[_0x72b3('0xa')](),controller['addProactiveActions']);router[_0x72b3('0x26')]('/:id/users',auth[_0x72b3('0xa')](),controller['addAgents']);router['put'](_0x72b3('0xe'),auth[_0x72b3('0xa')](),controller[_0x72b3('0x3e')]);router[_0x72b3('0x3f')](_0x72b3('0xe'),auth[_0x72b3('0xa')](),controller[_0x72b3('0x40')]);router[_0x72b3('0x3f')](_0x72b3('0x10'),auth[_0x72b3('0xa')](),controller[_0x72b3('0x41')]);router[_0x72b3('0x3f')](_0x72b3('0x13'),auth[_0x72b3('0xa')](),controller['removeAnswers']);router['delete'](_0x72b3('0x42'),auth[_0x72b3('0xa')](),controller['removeAgents']);module[_0x72b3('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 f233030..17e3c97 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 _0xaaa7=['exports','STRING','name','sequelize'];(function(_0xaf42e3,_0x57b8de){var _0x597a81=function(_0x1f006a){while(--_0x1f006a){_0xaf42e3['push'](_0xaf42e3['shift']());}};_0x597a81(++_0x57b8de);}(_0xaaa7,0xf3));var _0x7aaa=function(_0x308451,_0x5959f9){_0x308451=_0x308451-0x0;var _0x520c04=_0xaaa7[_0x308451];return _0x520c04;};'use strict';var Sequelize=require(_0x7aaa('0x0'));module[_0x7aaa('0x1')]={'name':{'type':Sequelize[_0x7aaa('0x2')],'unique':_0x7aaa('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7aaa('0x2')]},'companyId':{'type':Sequelize[_0x7aaa('0x2')]},'website':{'type':Sequelize[_0x7aaa('0x2')]},'phone':{'type':Sequelize[_0x7aaa('0x2')]},'fax':{'type':Sequelize[_0x7aaa('0x2')]},'type':{'type':Sequelize[_0x7aaa('0x2')]},'street':{'type':Sequelize[_0x7aaa('0x2')]},'postalCode':{'type':Sequelize[_0x7aaa('0x2')]},'city':{'type':Sequelize[_0x7aaa('0x2')]},'country':{'type':Sequelize[_0x7aaa('0x2')]},'email':{'type':Sequelize[_0x7aaa('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7aaa('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x7aaa('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x7aaa('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2e2d=['sequelize','exports','name','STRING'];(function(_0x4a0e4f,_0xd472aa){var _0x2ffa66=function(_0x3a9915){while(--_0x3a9915){_0x4a0e4f['push'](_0x4a0e4f['shift']());}};_0x2ffa66(++_0xd472aa);}(_0x2e2d,0x10c));var _0xd2e2=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x2e2d[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0xd2e2('0x0'));module[_0xd2e2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd2e2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd2e2('0x3')]},'companyId':{'type':Sequelize[_0xd2e2('0x3')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xd2e2('0x3')]},'fax':{'type':Sequelize[_0xd2e2('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd2e2('0x3')]},'postalCode':{'type':Sequelize[_0xd2e2('0x3')]},'city':{'type':Sequelize[_0xd2e2('0x3')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd2e2('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xd2e2('0x3')]},'sPostalCode':{'type':Sequelize[_0xd2e2('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xd2e2('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 9ee2727..d23f32a 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 _0x5d26=['papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','CmCompany','rawAttributes','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','include','findAll','rows','params','catch','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','update','addContacts','CmContact','ids','omit','getContacts','findOne','length','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','to-csv'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5d26,0xa3));var _0x65d2=function(_0x342fc4,_0x5352d3){_0x342fc4=_0x342fc4-0x0;var _0x1a9915=_0x5d26[_0x342fc4];return _0x1a9915;};'use strict';var pdf=require(_0x65d2('0x0'));var emlformat=require(_0x65d2('0x1'));var rimraf=require(_0x65d2('0x2'));var zipdir=require(_0x65d2('0x3'));var jsonpatch=require(_0x65d2('0x4'));var rp=require(_0x65d2('0x5'));var moment=require(_0x65d2('0x6'));var BPromise=require(_0x65d2('0x7'));var Mustache=require(_0x65d2('0x8'));var util=require(_0x65d2('0x9'));var path=require('path');var sox=require(_0x65d2('0xa'));var csv=require('to-csv');var ejs=require(_0x65d2('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x65d2('0xc'));var crypto=require('crypto');var jsforce=require(_0x65d2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x65d2('0xe'));var querystring=require('querystring');var Papa=require(_0x65d2('0xf'));var authService=require(_0x65d2('0x10'));var hardwareService=require(_0x65d2('0x11'));var Redis=require(_0x65d2('0x12'));var qs=require(_0x65d2('0x13'));var logger=require(_0x65d2('0x14'))(_0x65d2('0x15'));var utils=require(_0x65d2('0x16'));var config=require(_0x65d2('0x17'));var db=require(_0x65d2('0x18'))['db'];function respondWithStatusCode(_0x29fe84,_0x25483a){_0x25483a=_0x25483a||0xcc;return function(_0x558c81){if(_0x558c81){return _0x29fe84[_0x65d2('0x19')](_0x25483a);}return _0x29fe84[_0x65d2('0x1a')](_0x25483a)[_0x65d2('0x1b')]();};}function respondWithResult(_0x12c4f0,_0x39c58d){_0x39c58d=_0x39c58d||0xc8;return function(_0xa8afea){if(_0xa8afea){return _0x12c4f0[_0x65d2('0x1a')](_0x39c58d)['json'](_0xa8afea);}};}function respondWithFilteredResult(_0x2f3777,_0x2a7615){return function(_0x22525d){if(_0x22525d){var _0x4384d8=_0x22525d[_0x65d2('0x1c')],_0x2a6d42=_0x2a7615[_0x65d2('0x1d')],_0x178332=_0x2a7615['offset']+_0x2a7615[_0x65d2('0x1e')],_0x1c1b3f;if(_0x178332>=_0x4384d8){_0x178332=_0x4384d8;_0x1c1b3f=0xc8;}else{_0x1c1b3f=0xce;}_0x2f3777[_0x65d2('0x1a')](_0x1c1b3f);return _0x2f3777[_0x65d2('0x1f')](_0x65d2('0x20'),_0x2a6d42+'-'+_0x178332+'/'+_0x4384d8)[_0x65d2('0x21')](_0x22525d);}return null;};}function patchUpdates(_0x21cc24){return function(_0x5e6b43){try{jsonpatch['apply'](_0x5e6b43,_0x21cc24,!![]);}catch(_0x113afe){return BPromise['reject'](_0x113afe);}return _0x5e6b43[_0x65d2('0x22')]();};}function saveUpdates(_0xbce3a7,_0x35c02c){return function(_0x7106f9){if(_0x7106f9){return _0x7106f9['update'](_0xbce3a7)[_0x65d2('0x23')](function(_0x56eb9e){return _0x56eb9e;});}return null;};}function removeEntity(_0x2fec01,_0x596276){return function(_0x20f63b){if(_0x20f63b){return _0x20f63b[_0x65d2('0x24')]()[_0x65d2('0x23')](function(){var _0x4c8dc6=_0x20f63b[_0x65d2('0x25')]({'plain':!![]});var _0xfd296a=_0x65d2('0x26');return db[_0x65d2('0x27')][_0x65d2('0x24')]({'where':{'type':_0xfd296a,'resourceId':_0x4c8dc6['id']}})[_0x65d2('0x23')](function(){return _0x20f63b;});})['then'](function(){_0x2fec01['status'](0xcc)[_0x65d2('0x1b')]();});}};}function handleEntityNotFound(_0x1396de,_0x20b0eb){return function(_0x5dcf9d){if(!_0x5dcf9d){_0x1396de['sendStatus'](0x194);}return _0x5dcf9d;};}function handleError(_0x258d1b,_0x1838b7){_0x1838b7=_0x1838b7||0x1f4;return function(_0x3b490b){logger[_0x65d2('0x28')](_0x3b490b[_0x65d2('0x29')]);if(_0x3b490b['name']){delete _0x3b490b[_0x65d2('0x2a')];}_0x258d1b['status'](_0x1838b7)[_0x65d2('0x2b')](_0x3b490b);};}exports['index']=function(_0xb9d57d,_0x500a85){var _0x4a59b3={},_0x116831={},_0x2a9886={'count':0x0,'rows':[]};var _0x59aea0=db[_0x65d2('0x2c')][_0x65d2('0x2d')];_0x116831[_0x65d2('0x2e')]=_[_0x65d2('0x2f')](_0x59aea0);_0x116831['query']=_[_0x65d2('0x2f')](_0xb9d57d['query']);_0x116831[_0x65d2('0x30')]=_[_0x65d2('0x31')](_0x116831['model'],_0x116831[_0x65d2('0x32')]);_0x4a59b3[_0x65d2('0x33')]=_[_0x65d2('0x31')](_0x116831[_0x65d2('0x2e')],qs['fields'](_0xb9d57d[_0x65d2('0x32')][_0x65d2('0x34')]));_0x4a59b3['attributes']=_0x4a59b3[_0x65d2('0x33')]['length']?_0x4a59b3[_0x65d2('0x33')]:_0x116831[_0x65d2('0x2e')];if(!_0xb9d57d['query'][_0x65d2('0x35')](_0x65d2('0x36'))){_0x4a59b3[_0x65d2('0x1e')]=qs[_0x65d2('0x1e')](_0xb9d57d[_0x65d2('0x32')][_0x65d2('0x1e')]);_0x4a59b3[_0x65d2('0x1d')]=qs[_0x65d2('0x1d')](_0xb9d57d['query']['offset']);}_0x4a59b3[_0x65d2('0x37')]=qs[_0x65d2('0x38')](_0xb9d57d[_0x65d2('0x32')][_0x65d2('0x38')]);_0x4a59b3[_0x65d2('0x39')]=qs['filters'](_['pick'](_0xb9d57d[_0x65d2('0x32')],_0x116831[_0x65d2('0x30')]));if(_0xb9d57d[_0x65d2('0x32')][_0x65d2('0x3a')]){_0x4a59b3[_0x65d2('0x39')]=_[_0x65d2('0x3b')](_0x4a59b3[_0x65d2('0x39')],{'$or':_[_0x65d2('0x3c')](_0x59aea0,function(_0x2b389e){if(_0x2b389e[_0x65d2('0x3d')][_0x65d2('0x3e')]!==_0x65d2('0x3f')){var _0x357244={};_0x357244[_0x2b389e[_0x65d2('0x40')]]={'$like':'%'+_0xb9d57d[_0x65d2('0x32')][_0x65d2('0x3a')]+'%'};return _0x357244;}})});}_0x4a59b3=_['merge']({},_0x4a59b3,_0xb9d57d[_0x65d2('0x41')]);var _0x2e26dd={'where':_0x4a59b3['where']};return db['CmCompany'][_0x65d2('0x1c')](_0x2e26dd)[_0x65d2('0x23')](function(_0x18f07d){_0x2a9886[_0x65d2('0x1c')]=_0x18f07d;if(_0xb9d57d['query']['includeAll']){_0x4a59b3[_0x65d2('0x42')]=[{'all':!![]}];}return db[_0x65d2('0x2c')][_0x65d2('0x43')](_0x4a59b3);})[_0x65d2('0x23')](function(_0x2b9583){_0x2a9886[_0x65d2('0x44')]=_0x2b9583;return _0x2a9886;})[_0x65d2('0x23')](respondWithFilteredResult(_0x500a85,_0x4a59b3))['catch'](handleError(_0x500a85,null));};exports['show']=function(_0x5a93ce,_0x3fb985){var _0x5b47cf={'raw':![],'where':{'id':_0x5a93ce[_0x65d2('0x45')]['id']}},_0x23eefd={};_0x23eefd['model']=_[_0x65d2('0x2f')](db[_0x65d2('0x2c')]['rawAttributes']);_0x23eefd[_0x65d2('0x32')]=_[_0x65d2('0x2f')](_0x5a93ce[_0x65d2('0x32')]);_0x23eefd[_0x65d2('0x30')]=_[_0x65d2('0x31')](_0x23eefd[_0x65d2('0x2e')],_0x23eefd[_0x65d2('0x32')]);_0x5b47cf['attributes']=_[_0x65d2('0x31')](_0x23eefd['model'],qs[_0x65d2('0x34')](_0x5a93ce['query'][_0x65d2('0x34')]));_0x5b47cf[_0x65d2('0x33')]=_0x5b47cf[_0x65d2('0x33')]['length']?_0x5b47cf[_0x65d2('0x33')]:_0x23eefd[_0x65d2('0x2e')];if(_0x5a93ce[_0x65d2('0x32')]['includeAll']){_0x5b47cf[_0x65d2('0x42')]=[{'all':!![]}];}_0x5b47cf=_[_0x65d2('0x3b')]({},_0x5b47cf,_0x5a93ce[_0x65d2('0x41')]);return db[_0x65d2('0x2c')]['find'](_0x5b47cf)['then'](handleEntityNotFound(_0x3fb985,null))[_0x65d2('0x23')](respondWithResult(_0x3fb985,null))[_0x65d2('0x46')](handleError(_0x3fb985,null));};exports[_0x65d2('0x47')]=function(_0x15e272,_0x21a78d){return db[_0x65d2('0x2c')]['create'](_0x15e272[_0x65d2('0x48')],{})[_0x65d2('0x23')](function(_0x569978){var _0x60462b=_0x15e272[_0x65d2('0x49')][_0x65d2('0x25')]({'plain':!![]});if(!_0x60462b)throw new Error(_0x65d2('0x4a'));if(_0x60462b[_0x65d2('0x4b')]==='user'){var _0x505a01=_0x569978[_0x65d2('0x25')]({'plain':!![]});var _0x51b3d7=_0x65d2('0x26');return db[_0x65d2('0x4c')][_0x65d2('0x4d')]({'where':{'name':_0x51b3d7,'userProfileId':_0x60462b[_0x65d2('0x4e')]},'raw':!![]})[_0x65d2('0x23')](function(_0x4fbe04){if(_0x4fbe04&&_0x4fbe04[_0x65d2('0x4f')]===0x0){return db[_0x65d2('0x27')][_0x65d2('0x47')]({'name':_0x505a01['name'],'resourceId':_0x505a01['id'],'type':_0x4fbe04[_0x65d2('0x2a')],'sectionId':_0x4fbe04['id']},{})['then'](function(){return _0x569978;});}else{return _0x569978;}})[_0x65d2('0x46')](function(_0x1c791d){logger[_0x65d2('0x28')](_0x65d2('0x50'),_0x1c791d);throw _0x1c791d;});}return _0x569978;})[_0x65d2('0x23')](respondWithResult(_0x21a78d,0xc9))[_0x65d2('0x46')](handleError(_0x21a78d,null));};exports[_0x65d2('0x51')]=function(_0xf1605,_0x5a4ec3){if(_0xf1605[_0x65d2('0x48')]['id']){delete _0xf1605[_0x65d2('0x48')]['id'];}return db[_0x65d2('0x2c')][_0x65d2('0x4d')]({'where':{'id':_0xf1605[_0x65d2('0x45')]['id']}})[_0x65d2('0x23')](handleEntityNotFound(_0x5a4ec3,null))['then'](saveUpdates(_0xf1605[_0x65d2('0x48')],null))['then'](respondWithResult(_0x5a4ec3,null))[_0x65d2('0x46')](handleError(_0x5a4ec3,null));};exports[_0x65d2('0x24')]=function(_0x1775b8,_0x1ceaa0){return db['CmCompany'][_0x65d2('0x4d')]({'where':{'id':_0x1775b8['params']['id']}})[_0x65d2('0x23')](handleEntityNotFound(_0x1ceaa0,null))[_0x65d2('0x23')](removeEntity(_0x1ceaa0,null))[_0x65d2('0x46')](handleError(_0x1ceaa0,null));};exports[_0x65d2('0x52')]=function(_0x487eca,_0x2df424,_0x4b9cab){return db[_0x65d2('0x53')][_0x65d2('0x4d')]({'where':{'id':_0x487eca[_0x65d2('0x45')]['id']}})[_0x65d2('0x23')](handleEntityNotFound(_0x2df424,null))[_0x65d2('0x23')](function(_0x44ecc2){if(_0x44ecc2){return _0x44ecc2['addContacts'](_0x487eca[_0x65d2('0x48')][_0x65d2('0x54')],_[_0x65d2('0x55')](_0x487eca[_0x65d2('0x48')],[_0x65d2('0x54'),'id'])||{});}})[_0x65d2('0x23')](respondWithResult(_0x2df424,null))[_0x65d2('0x46')](handleError(_0x2df424,null));};exports[_0x65d2('0x56')]=function(_0x2ec1b8,_0x539d40,_0x5093a5){var _0x18026c={};var _0x3bb890={};var _0x1b547a;var _0xf62bd4;return db[_0x65d2('0x2c')][_0x65d2('0x57')]({'where':{'id':_0x2ec1b8['params']['id']}})[_0x65d2('0x23')](handleEntityNotFound(_0x539d40,null))[_0x65d2('0x23')](function(_0x26ace8){if(_0x26ace8){_0x1b547a=_0x26ace8;_0x3bb890[_0x65d2('0x2e')]=_['keys'](db[_0x65d2('0x53')][_0x65d2('0x2d')]);_0x3bb890['query']=_['keys'](_0x2ec1b8[_0x65d2('0x32')]);_0x3bb890['filters']=_[_0x65d2('0x31')](_0x3bb890[_0x65d2('0x2e')],_0x3bb890[_0x65d2('0x32')]);_0x18026c[_0x65d2('0x33')]=_[_0x65d2('0x31')](_0x3bb890['model'],qs[_0x65d2('0x34')](_0x2ec1b8['query']['fields']));_0x18026c['attributes']=_0x18026c[_0x65d2('0x33')][_0x65d2('0x58')]?_0x18026c['attributes']:_0x3bb890[_0x65d2('0x2e')];_0x18026c[_0x65d2('0x37')]=qs[_0x65d2('0x38')](_0x2ec1b8[_0x65d2('0x32')][_0x65d2('0x38')]);_0x18026c['where']=qs[_0x65d2('0x30')](_['pick'](_0x2ec1b8['query'],_0x3bb890[_0x65d2('0x30')]));if(_0x2ec1b8[_0x65d2('0x32')]['filter']){_0x18026c[_0x65d2('0x39')]=_['merge'](_0x18026c[_0x65d2('0x39')],{'$or':_[_0x65d2('0x3c')](_0x18026c[_0x65d2('0x33')],function(_0x3dfeb7){var _0x1355d6={};_0x1355d6[_0x3dfeb7]={'$like':'%'+_0x2ec1b8[_0x65d2('0x32')][_0x65d2('0x3a')]+'%'};return _0x1355d6;})});}_0x18026c=_[_0x65d2('0x3b')]({},_0x18026c,_0x2ec1b8[_0x65d2('0x41')]);return _0x1b547a[_0x65d2('0x56')](_0x18026c);}})[_0x65d2('0x23')](function(_0xee410f){if(_0xee410f){_0xf62bd4=_0xee410f[_0x65d2('0x58')];if(!_0x2ec1b8[_0x65d2('0x32')][_0x65d2('0x35')](_0x65d2('0x36'))){_0x18026c[_0x65d2('0x1e')]=qs[_0x65d2('0x1e')](_0x2ec1b8['query'][_0x65d2('0x1e')]);_0x18026c[_0x65d2('0x1d')]=qs[_0x65d2('0x1d')](_0x2ec1b8[_0x65d2('0x32')][_0x65d2('0x1d')]);}return _0x1b547a[_0x65d2('0x56')](_0x18026c);}})[_0x65d2('0x23')](function(_0x81eec6){if(_0x81eec6){return _0x81eec6?{'count':_0xf62bd4,'rows':_0x81eec6}:null;}})[_0x65d2('0x23')](respondWithResult(_0x539d40,null))['catch'](handleError(_0x539d40,null));}; \ No newline at end of file +var _0xef4b=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','get','Companies','UserProfileResource','destroy','end','stack','name','send','CmCompany','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','sort','where','map','type','key','VIRTUAL','field','merge','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','update','params','CmContact','addContacts','ids','omit','order','pick','filter','options','getContacts','nolimit','html-pdf'];(function(_0x462b5b,_0x16ed50){var _0x5af19a=function(_0x57e221){while(--_0x57e221){_0x462b5b['push'](_0x462b5b['shift']());}};_0x5af19a(++_0x16ed50);}(_0xef4b,0x16b));var _0xbef4=function(_0x1f404a,_0x5088b2){_0x1f404a=_0x1f404a-0x0;var _0x2cdcd5=_0xef4b[_0x1f404a];return _0x2cdcd5;};'use strict';var pdf=require(_0xbef4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbef4('0x1'));var zipdir=require(_0xbef4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbef4('0x3'));var moment=require(_0xbef4('0x4'));var BPromise=require(_0xbef4('0x5'));var Mustache=require(_0xbef4('0x6'));var util=require(_0xbef4('0x7'));var path=require(_0xbef4('0x8'));var sox=require(_0xbef4('0x9'));var csv=require(_0xbef4('0xa'));var ejs=require(_0xbef4('0xb'));var fs=require('fs');var _=require(_0xbef4('0xc'));var squel=require(_0xbef4('0xd'));var crypto=require('crypto');var jsforce=require(_0xbef4('0xe'));var deskjs=require(_0xbef4('0xf'));var toCsv=require(_0xbef4('0xa'));var querystring=require(_0xbef4('0x10'));var Papa=require('papaparse');var authService=require(_0xbef4('0x11'));var hardwareService=require(_0xbef4('0x12'));var Redis=require(_0xbef4('0x13'));var qs=require(_0xbef4('0x14'));var logger=require(_0xbef4('0x15'))(_0xbef4('0x16'));var utils=require(_0xbef4('0x17'));var config=require(_0xbef4('0x18'));var db=require(_0xbef4('0x19'))['db'];function respondWithStatusCode(_0x4ffac9,_0x3a945f){_0x3a945f=_0x3a945f||0xcc;return function(_0x45c79a){if(_0x45c79a){return _0x4ffac9[_0xbef4('0x1a')](_0x3a945f);}return _0x4ffac9[_0xbef4('0x1b')](_0x3a945f)['end']();};}function respondWithResult(_0xd116db,_0x65c3ff){_0x65c3ff=_0x65c3ff||0xc8;return function(_0x5693b2){if(_0x5693b2){return _0xd116db[_0xbef4('0x1b')](_0x65c3ff)[_0xbef4('0x1c')](_0x5693b2);}};}function respondWithFilteredResult(_0x2d2b1e,_0x2c242f){return function(_0x1e3be4){if(_0x1e3be4){var _0x5e68c1=_0x1e3be4[_0xbef4('0x1d')],_0x447e1e=_0x2c242f[_0xbef4('0x1e')],_0x1f8674=_0x2c242f[_0xbef4('0x1e')]+_0x2c242f[_0xbef4('0x1f')],_0xe9ab3;if(_0x1f8674>=_0x5e68c1){_0x1f8674=_0x5e68c1;_0xe9ab3=0xc8;}else{_0xe9ab3=0xce;}_0x2d2b1e['status'](_0xe9ab3);return _0x2d2b1e['set'](_0xbef4('0x20'),_0x447e1e+'-'+_0x1f8674+'/'+_0x5e68c1)['json'](_0x1e3be4);}return null;};}function patchUpdates(_0x147672){return function(_0x476553){try{jsonpatch[_0xbef4('0x21')](_0x476553,_0x147672,!![]);}catch(_0x245568){return BPromise[_0xbef4('0x22')](_0x245568);}return _0x476553[_0xbef4('0x23')]();};}function saveUpdates(_0x42e284,_0x41798d){return function(_0x2ceaac){if(_0x2ceaac){return _0x2ceaac['update'](_0x42e284)[_0xbef4('0x24')](function(_0x35044d){return _0x35044d;});}return null;};}function removeEntity(_0x4cab7a,_0x2591fc){return function(_0xa072f7){if(_0xa072f7){return _0xa072f7['destroy']()['then'](function(){var _0xbe9835=_0xa072f7[_0xbef4('0x25')]({'plain':!![]});var _0x39e4fa=_0xbef4('0x26');return db[_0xbef4('0x27')][_0xbef4('0x28')]({'where':{'type':_0x39e4fa,'resourceId':_0xbe9835['id']}})['then'](function(){return _0xa072f7;});})[_0xbef4('0x24')](function(){_0x4cab7a[_0xbef4('0x1b')](0xcc)[_0xbef4('0x29')]();});}};}function handleEntityNotFound(_0x45e699,_0x42cbdc){return function(_0x4f391f){if(!_0x4f391f){_0x45e699[_0xbef4('0x1a')](0x194);}return _0x4f391f;};}function handleError(_0x37bb4a,_0x2cdfe6){_0x2cdfe6=_0x2cdfe6||0x1f4;return function(_0x1f5a1f){logger['error'](_0x1f5a1f[_0xbef4('0x2a')]);if(_0x1f5a1f['name']){delete _0x1f5a1f[_0xbef4('0x2b')];}_0x37bb4a[_0xbef4('0x1b')](_0x2cdfe6)[_0xbef4('0x2c')](_0x1f5a1f);};}exports['index']=function(_0x40a908,_0xfd430d){var _0x48e0b4={},_0x193a67={},_0x26faec={'count':0x0,'rows':[]};var _0x3b057f=db[_0xbef4('0x2d')][_0xbef4('0x2e')];_0x193a67[_0xbef4('0x2f')]=_[_0xbef4('0x30')](_0x3b057f);_0x193a67['query']=_['keys'](_0x40a908[_0xbef4('0x31')]);_0x193a67[_0xbef4('0x32')]=_['intersection'](_0x193a67[_0xbef4('0x2f')],_0x193a67[_0xbef4('0x31')]);_0x48e0b4[_0xbef4('0x33')]=_[_0xbef4('0x34')](_0x193a67[_0xbef4('0x2f')],qs[_0xbef4('0x35')](_0x40a908['query'][_0xbef4('0x35')]));_0x48e0b4[_0xbef4('0x33')]=_0x48e0b4[_0xbef4('0x33')][_0xbef4('0x36')]?_0x48e0b4[_0xbef4('0x33')]:_0x193a67[_0xbef4('0x2f')];if(!_0x40a908[_0xbef4('0x31')]['hasOwnProperty']('nolimit')){_0x48e0b4[_0xbef4('0x1f')]=qs[_0xbef4('0x1f')](_0x40a908[_0xbef4('0x31')][_0xbef4('0x1f')]);_0x48e0b4[_0xbef4('0x1e')]=qs[_0xbef4('0x1e')](_0x40a908[_0xbef4('0x31')]['offset']);}_0x48e0b4['order']=qs[_0xbef4('0x37')](_0x40a908[_0xbef4('0x31')][_0xbef4('0x37')]);_0x48e0b4['where']=qs[_0xbef4('0x32')](_['pick'](_0x40a908[_0xbef4('0x31')],_0x193a67[_0xbef4('0x32')]));if(_0x40a908[_0xbef4('0x31')]['filter']){_0x48e0b4[_0xbef4('0x38')]=_['merge'](_0x48e0b4['where'],{'$or':_[_0xbef4('0x39')](_0x3b057f,function(_0x8f51f5){if(_0x8f51f5[_0xbef4('0x3a')][_0xbef4('0x3b')]!==_0xbef4('0x3c')){var _0x3707bb={};_0x3707bb[_0x8f51f5[_0xbef4('0x3d')]]={'$like':'%'+_0x40a908['query']['filter']+'%'};return _0x3707bb;}})});}_0x48e0b4=_[_0xbef4('0x3e')]({},_0x48e0b4,_0x40a908['options']);var _0x1241e3={'where':_0x48e0b4[_0xbef4('0x38')]};return db[_0xbef4('0x2d')][_0xbef4('0x1d')](_0x1241e3)[_0xbef4('0x24')](function(_0x47029e){_0x26faec[_0xbef4('0x1d')]=_0x47029e;if(_0x40a908['query'][_0xbef4('0x3f')]){_0x48e0b4[_0xbef4('0x40')]=[{'all':!![]}];}return db[_0xbef4('0x2d')][_0xbef4('0x41')](_0x48e0b4);})[_0xbef4('0x24')](function(_0x47b7f5){_0x26faec[_0xbef4('0x42')]=_0x47b7f5;return _0x26faec;})[_0xbef4('0x24')](respondWithFilteredResult(_0xfd430d,_0x48e0b4))[_0xbef4('0x43')](handleError(_0xfd430d,null));};exports[_0xbef4('0x44')]=function(_0x41d97e,_0x4887b6){var _0x4a0317={'raw':![],'where':{'id':_0x41d97e['params']['id']}},_0x4e0174={};_0x4e0174[_0xbef4('0x2f')]=_['keys'](db[_0xbef4('0x2d')][_0xbef4('0x2e')]);_0x4e0174['query']=_['keys'](_0x41d97e[_0xbef4('0x31')]);_0x4e0174['filters']=_[_0xbef4('0x34')](_0x4e0174[_0xbef4('0x2f')],_0x4e0174[_0xbef4('0x31')]);_0x4a0317['attributes']=_[_0xbef4('0x34')](_0x4e0174[_0xbef4('0x2f')],qs[_0xbef4('0x35')](_0x41d97e['query'][_0xbef4('0x35')]));_0x4a0317[_0xbef4('0x33')]=_0x4a0317['attributes'][_0xbef4('0x36')]?_0x4a0317[_0xbef4('0x33')]:_0x4e0174[_0xbef4('0x2f')];if(_0x41d97e['query'][_0xbef4('0x3f')]){_0x4a0317[_0xbef4('0x40')]=[{'all':!![]}];}_0x4a0317=_[_0xbef4('0x3e')]({},_0x4a0317,_0x41d97e['options']);return db[_0xbef4('0x2d')][_0xbef4('0x45')](_0x4a0317)['then'](handleEntityNotFound(_0x4887b6,null))['then'](respondWithResult(_0x4887b6,null))[_0xbef4('0x43')](handleError(_0x4887b6,null));};exports[_0xbef4('0x46')]=function(_0x1f55e5,_0x4d1fa1){return db[_0xbef4('0x2d')][_0xbef4('0x46')](_0x1f55e5[_0xbef4('0x47')],{})[_0xbef4('0x24')](function(_0x49b5c9){var _0x2b3da8=_0x1f55e5['user']['get']({'plain':!![]});if(!_0x2b3da8)throw new Error(_0xbef4('0x48'));if(_0x2b3da8[_0xbef4('0x49')]===_0xbef4('0x4a')){var _0x328418=_0x49b5c9[_0xbef4('0x25')]({'plain':!![]});var _0x6bbb50=_0xbef4('0x26');return db[_0xbef4('0x4b')][_0xbef4('0x45')]({'where':{'name':_0x6bbb50,'userProfileId':_0x2b3da8[_0xbef4('0x4c')]},'raw':!![]})[_0xbef4('0x24')](function(_0xe276c){if(_0xe276c&&_0xe276c[_0xbef4('0x4d')]===0x0){return db[_0xbef4('0x27')][_0xbef4('0x46')]({'name':_0x328418[_0xbef4('0x2b')],'resourceId':_0x328418['id'],'type':_0xe276c['name'],'sectionId':_0xe276c['id']},{})[_0xbef4('0x24')](function(){return _0x49b5c9;});}else{return _0x49b5c9;}})['catch'](function(_0x2f6cbc){logger[_0xbef4('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f6cbc);throw _0x2f6cbc;});}return _0x49b5c9;})[_0xbef4('0x24')](respondWithResult(_0x4d1fa1,0xc9))[_0xbef4('0x43')](handleError(_0x4d1fa1,null));};exports[_0xbef4('0x4f')]=function(_0x4b83d3,_0x459d24){if(_0x4b83d3[_0xbef4('0x47')]['id']){delete _0x4b83d3['body']['id'];}return db[_0xbef4('0x2d')][_0xbef4('0x45')]({'where':{'id':_0x4b83d3[_0xbef4('0x50')]['id']}})[_0xbef4('0x24')](handleEntityNotFound(_0x459d24,null))[_0xbef4('0x24')](saveUpdates(_0x4b83d3[_0xbef4('0x47')],null))['then'](respondWithResult(_0x459d24,null))['catch'](handleError(_0x459d24,null));};exports[_0xbef4('0x28')]=function(_0x1af836,_0x42d103){return db[_0xbef4('0x2d')][_0xbef4('0x45')]({'where':{'id':_0x1af836[_0xbef4('0x50')]['id']}})['then'](handleEntityNotFound(_0x42d103,null))[_0xbef4('0x24')](removeEntity(_0x42d103,null))[_0xbef4('0x43')](handleError(_0x42d103,null));};exports['addContacts']=function(_0x546883,_0x5916da,_0x3a88dc){return db[_0xbef4('0x51')][_0xbef4('0x45')]({'where':{'id':_0x546883['params']['id']}})[_0xbef4('0x24')](handleEntityNotFound(_0x5916da,null))[_0xbef4('0x24')](function(_0x9dbbae){if(_0x9dbbae){return _0x9dbbae[_0xbef4('0x52')](_0x546883[_0xbef4('0x47')][_0xbef4('0x53')],_[_0xbef4('0x54')](_0x546883[_0xbef4('0x47')],[_0xbef4('0x53'),'id'])||{});}})[_0xbef4('0x24')](respondWithResult(_0x5916da,null))['catch'](handleError(_0x5916da,null));};exports['getContacts']=function(_0x5cb4ba,_0x3598ba,_0x63ab61){var _0x47ef5c={};var _0x255ab3={};var _0x347570;var _0x1bb8ca;return db['CmCompany']['findOne']({'where':{'id':_0x5cb4ba['params']['id']}})[_0xbef4('0x24')](handleEntityNotFound(_0x3598ba,null))[_0xbef4('0x24')](function(_0x1a6f6b){if(_0x1a6f6b){_0x347570=_0x1a6f6b;_0x255ab3[_0xbef4('0x2f')]=_[_0xbef4('0x30')](db[_0xbef4('0x51')][_0xbef4('0x2e')]);_0x255ab3[_0xbef4('0x31')]=_['keys'](_0x5cb4ba[_0xbef4('0x31')]);_0x255ab3['filters']=_[_0xbef4('0x34')](_0x255ab3[_0xbef4('0x2f')],_0x255ab3[_0xbef4('0x31')]);_0x47ef5c[_0xbef4('0x33')]=_[_0xbef4('0x34')](_0x255ab3['model'],qs[_0xbef4('0x35')](_0x5cb4ba[_0xbef4('0x31')][_0xbef4('0x35')]));_0x47ef5c['attributes']=_0x47ef5c['attributes'][_0xbef4('0x36')]?_0x47ef5c['attributes']:_0x255ab3[_0xbef4('0x2f')];_0x47ef5c[_0xbef4('0x55')]=qs[_0xbef4('0x37')](_0x5cb4ba[_0xbef4('0x31')][_0xbef4('0x37')]);_0x47ef5c[_0xbef4('0x38')]=qs[_0xbef4('0x32')](_[_0xbef4('0x56')](_0x5cb4ba[_0xbef4('0x31')],_0x255ab3[_0xbef4('0x32')]));if(_0x5cb4ba['query']['filter']){_0x47ef5c[_0xbef4('0x38')]=_[_0xbef4('0x3e')](_0x47ef5c[_0xbef4('0x38')],{'$or':_[_0xbef4('0x39')](_0x47ef5c[_0xbef4('0x33')],function(_0x49134d){var _0x1522a1={};_0x1522a1[_0x49134d]={'$like':'%'+_0x5cb4ba[_0xbef4('0x31')][_0xbef4('0x57')]+'%'};return _0x1522a1;})});}_0x47ef5c=_[_0xbef4('0x3e')]({},_0x47ef5c,_0x5cb4ba[_0xbef4('0x58')]);return _0x347570[_0xbef4('0x59')](_0x47ef5c);}})['then'](function(_0x13283a){if(_0x13283a){_0x1bb8ca=_0x13283a[_0xbef4('0x36')];if(!_0x5cb4ba[_0xbef4('0x31')]['hasOwnProperty'](_0xbef4('0x5a'))){_0x47ef5c[_0xbef4('0x1f')]=qs[_0xbef4('0x1f')](_0x5cb4ba[_0xbef4('0x31')][_0xbef4('0x1f')]);_0x47ef5c[_0xbef4('0x1e')]=qs[_0xbef4('0x1e')](_0x5cb4ba[_0xbef4('0x31')][_0xbef4('0x1e')]);}return _0x347570[_0xbef4('0x59')](_0x47ef5c);}})[_0xbef4('0x24')](function(_0x4c25be){if(_0x4c25be){return _0x4c25be?{'count':_0x1bb8ca,'rows':_0x4c25be}:null;}})['then'](respondWithResult(_0x3598ba,null))[_0xbef4('0x43')](handleError(_0x3598ba,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 9e19ac3..dacbd79 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 _0xcea2=['request-promise','exports','CmCompany','lodash','../../config/logger','moment','bluebird'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcea2,0x15a));var _0x2cea=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xcea2[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var attributes=require('./cmCompany.attributes');module[_0x2cea('0x5')]=function(_0x46060b,_0x11596e){return _0x46060b['define'](_0x2cea('0x6'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2750=['request-promise','./cmCompany.attributes','exports','define','cm_companies','lodash','../../config/logger','api','moment','bluebird'];(function(_0x56568a,_0x25efcb){var _0x3eeb13=function(_0x2b6123){while(--_0x2b6123){_0x56568a['push'](_0x56568a['shift']());}};_0x3eeb13(++_0x25efcb);}(_0x2750,0x13b));var _0x0275=function(_0x29ec0e,_0x2094cc){_0x29ec0e=_0x29ec0e-0x0;var _0x2aef8c=_0x2750[_0x29ec0e];return _0x2aef8c;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var attributes=require(_0x0275('0x6'));module[_0x0275('0x7')]=function(_0x4960,_0x3d0c9c){return _0x4960[_0x0275('0x8')]('CmCompany',attributes,{'tableName':_0x0275('0x9'),'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 c881bf4..06f69e9 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 _0x1b90=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','debug'];(function(_0x5ea8ac,_0x4fb153){var _0x5a498b=function(_0x11ec6a){while(--_0x11ec6a){_0x5ea8ac['push'](_0x5ea8ac['shift']());}};_0x5a498b(++_0x4fb153);}(_0x1b90,0x140));var _0x01b9=function(_0x5be5c8,_0x3e779b){_0x5be5c8=_0x5be5c8-0x0;var _0x3f4098=_0x1b90[_0x5be5c8];return _0x3f4098;};'use strict';var _=require('lodash');var util=require(_0x01b9('0x0'));var moment=require(_0x01b9('0x1'));var BPromise=require(_0x01b9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01b9('0x3'))['db'];var utils=require(_0x01b9('0x4'));var logger=require(_0x01b9('0x5'))(_0x01b9('0x6'));var config=require(_0x01b9('0x7'));var jayson=require(_0x01b9('0x8'));var client=jayson[_0x01b9('0x9')][_0x01b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d3984,_0x27c508,_0x4c11e1){return new BPromise(function(_0x17e16a,_0x27105b){return client[_0x01b9('0xb')](_0x2d3984,_0x4c11e1)[_0x01b9('0xc')](function(_0x407dba){logger[_0x01b9('0xd')](_0x01b9('0xe'),_0x27c508,'request\x20sent');logger[_0x01b9('0xf')](_0x01b9('0x10'),_0x27c508,_0x01b9('0x11'),JSON[_0x01b9('0x12')](_0x407dba));if(_0x407dba[_0x01b9('0x13')]){if(_0x407dba[_0x01b9('0x13')][_0x01b9('0x14')]===0x1f4){logger[_0x01b9('0x13')](_0x01b9('0xe'),_0x27c508,_0x407dba[_0x01b9('0x13')][_0x01b9('0x15')]);return _0x27105b(_0x407dba[_0x01b9('0x13')][_0x01b9('0x15')]);}logger['error'](_0x01b9('0xe'),_0x27c508,_0x407dba[_0x01b9('0x13')][_0x01b9('0x15')]);return _0x17e16a(_0x407dba['error'][_0x01b9('0x15')]);}else{logger[_0x01b9('0xd')]('CmCompany,\x20%s,\x20%s',_0x27c508,_0x01b9('0x11'));_0x17e16a(_0x407dba[_0x01b9('0x16')][_0x01b9('0x15')]);}})[_0x01b9('0x17')](function(_0xf27e74){logger[_0x01b9('0x13')](_0x01b9('0xe'),_0x27c508,_0xf27e74);_0x27105b(_0xf27e74);});});} \ No newline at end of file +var _0xb6b0=['randomstring','../../mysqldb','../../config/logger','jayson/promise','http','then','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','moment','bluebird'];(function(_0x43af74,_0x18ea36){var _0x427ae5=function(_0x13eca4){while(--_0x13eca4){_0x43af74['push'](_0x43af74['shift']());}};_0x427ae5(++_0x18ea36);}(_0xb6b0,0x6a));var _0x0b6b=function(_0x24c0ba,_0xb888ba){_0x24c0ba=_0x24c0ba-0x0;var _0x3a5dee=_0xb6b0[_0x24c0ba];return _0x3a5dee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b6b('0x0'));var BPromise=require(_0x0b6b('0x1'));var rs=require(_0x0b6b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b6b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b6b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0b6b('0x5'));var client=jayson['client'][_0x0b6b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x16c1c4,_0x4e909c,_0x382d57){return new BPromise(function(_0xd9f299,_0x21ec4a){return client['request'](_0x16c1c4,_0x382d57)[_0x0b6b('0x7')](function(_0x322b00){logger[_0x0b6b('0x8')]('CmCompany,\x20%s,\x20%s',_0x4e909c,_0x0b6b('0x9'));logger['debug'](_0x0b6b('0xa'),_0x4e909c,'request\x20sent',JSON[_0x0b6b('0xb')](_0x322b00));if(_0x322b00['error']){if(_0x322b00[_0x0b6b('0xc')][_0x0b6b('0xd')]===0x1f4){logger[_0x0b6b('0xc')](_0x0b6b('0xe'),_0x4e909c,_0x322b00['error'][_0x0b6b('0xf')]);return _0x21ec4a(_0x322b00[_0x0b6b('0xc')][_0x0b6b('0xf')]);}logger[_0x0b6b('0xc')](_0x0b6b('0xe'),_0x4e909c,_0x322b00[_0x0b6b('0xc')][_0x0b6b('0xf')]);return _0xd9f299(_0x322b00[_0x0b6b('0xc')][_0x0b6b('0xf')]);}else{logger[_0x0b6b('0x8')](_0x0b6b('0xe'),_0x4e909c,_0x0b6b('0x9'));_0xd9f299(_0x322b00[_0x0b6b('0x10')][_0x0b6b('0xf')]);}})[_0x0b6b('0x11')](function(_0x443c47){logger[_0x0b6b('0xc')](_0x0b6b('0xe'),_0x4e909c,_0x443c47);_0x21ec4a(_0x443c47);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ffa6e0b..dab500f 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 _0x748e=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/contacts','post','create','addContacts','put','update','delete','destroy','util'];(function(_0xcfe954,_0x4cb77a){var _0x158407=function(_0x452909){while(--_0x452909){_0xcfe954['push'](_0xcfe954['shift']());}};_0x158407(++_0x4cb77a);}(_0x748e,0x103));var _0xe748=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x748e[_0xa60623];return _0x4a6487;};'use strict';var multer=require('multer');var util=require(_0xe748('0x0'));var path=require(_0xe748('0x1'));var timeout=require(_0xe748('0x2'));var express=require(_0xe748('0x3'));var router=express[_0xe748('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe748('0x5'));var config=require(_0xe748('0x6'));var controller=require('./cmCompany.controller');router[_0xe748('0x7')]('/',auth[_0xe748('0x8')](),controller[_0xe748('0x9')]);router[_0xe748('0x7')](_0xe748('0xa'),auth[_0xe748('0x8')](),controller[_0xe748('0xb')]);router[_0xe748('0x7')](_0xe748('0xc'),auth[_0xe748('0x8')](),controller['getContacts']);router[_0xe748('0xd')]('/',auth['isAuthenticated'](),controller[_0xe748('0xe')]);router[_0xe748('0xd')](_0xe748('0xc'),auth[_0xe748('0x8')](),controller[_0xe748('0xf')]);router[_0xe748('0x10')](_0xe748('0xa'),auth[_0xe748('0x8')](),controller[_0xe748('0x11')]);router[_0xe748('0x12')]('/:id',auth[_0xe748('0x8')](),controller[_0xe748('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe04b=['post','addContacts','put','update','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/:id','/:id/contacts','getContacts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe04b,0x1c8));var _0xbe04=function(_0x26fc18,_0x117bde){_0x26fc18=_0x26fc18-0x0;var _0x2ec2e7=_0xe04b[_0x26fc18];return _0x2ec2e7;};'use strict';var multer=require(_0xbe04('0x0'));var util=require(_0xbe04('0x1'));var path=require('path');var timeout=require(_0xbe04('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xbe04('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbe04('0x4'));var controller=require(_0xbe04('0x5'));router[_0xbe04('0x6')]('/',auth[_0xbe04('0x7')](),controller[_0xbe04('0x8')]);router[_0xbe04('0x6')](_0xbe04('0x9'),auth[_0xbe04('0x7')](),controller['show']);router[_0xbe04('0x6')](_0xbe04('0xa'),auth[_0xbe04('0x7')](),controller[_0xbe04('0xb')]);router[_0xbe04('0xc')]('/',auth[_0xbe04('0x7')](),controller['create']);router[_0xbe04('0xc')](_0xbe04('0xa'),auth[_0xbe04('0x7')](),controller[_0xbe04('0xd')]);router[_0xbe04('0xe')](_0xbe04('0x9'),auth[_0xbe04('0x7')](),controller[_0xbe04('0xf')]);router[_0xbe04('0x10')](_0xbe04('0x9'),auth[_0xbe04('0x7')](),controller['destroy']);module[_0xbe04('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3f31860..0822947 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 _0x875f=['sequelize','STRING','TEXT','UNSIGNED','NOW'];(function(_0x186d5e,_0x1e7475){var _0x12b3f9=function(_0x3026a2){while(--_0x3026a2){_0x186d5e['push'](_0x186d5e['shift']());}};_0x12b3f9(++_0x1e7475);}(_0x875f,0xaa));var _0xf875=function(_0x150d92,_0x2a984d){_0x150d92=_0x150d92-0x0;var _0x13e62f=_0x875f[_0x150d92];return _0x13e62f;};'use strict';var _=require('lodash');var Sequelize=require(_0xf875('0x0'));module['exports']={'firstName':{'type':Sequelize[_0xf875('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf875('0x1')]},'street':{'type':Sequelize[_0xf875('0x1')]},'postalCode':{'type':Sequelize[_0xf875('0x1')]},'city':{'type':Sequelize[_0xf875('0x1')]},'country':{'type':Sequelize[_0xf875('0x1')]},'dateOfBirth':{'type':Sequelize[_0xf875('0x1')]},'description':{'type':Sequelize[_0xf875('0x2')]},'phone':{'type':Sequelize[_0xf875('0x1')]},'mobile':{'type':Sequelize[_0xf875('0x1')]},'fax':{'type':Sequelize[_0xf875('0x1')]},'email':{'type':Sequelize[_0xf875('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xf875('0x1')]},'fb_data':{'type':Sequelize[_0xf875('0x1')]},'twitter':{'type':Sequelize[_0xf875('0x1')]},'skype':{'type':Sequelize[_0xf875('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xf875('0x1')]},'line':{'type':Sequelize[_0xf875('0x1')]},'wechat':{'type':Sequelize[_0xf875('0x1')]},'telegram':{'type':Sequelize[_0xf875('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xf875('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xf875('0x4')]}}; \ No newline at end of file +var _0x0855=['exports','STRING','TEXT','INTEGER','UNSIGNED','NOW','lodash','sequelize'];(function(_0x35108f,_0x4ecd1a){var _0x5f3cec=function(_0x66be48){while(--_0x66be48){_0x35108f['push'](_0x35108f['shift']());}};_0x5f3cec(++_0x4ecd1a);}(_0x0855,0xce));var _0x5085=function(_0x259ee5,_0x2b5109){_0x259ee5=_0x259ee5-0x0;var _0x1aa9cb=_0x0855[_0x259ee5];return _0x1aa9cb;};'use strict';var _=require(_0x5085('0x0'));var Sequelize=require(_0x5085('0x1'));module[_0x5085('0x2')]={'firstName':{'type':Sequelize[_0x5085('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x5085('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5085('0x3')]},'city':{'type':Sequelize[_0x5085('0x3')]},'country':{'type':Sequelize[_0x5085('0x3')]},'dateOfBirth':{'type':Sequelize[_0x5085('0x3')]},'description':{'type':Sequelize[_0x5085('0x4')]},'phone':{'type':Sequelize[_0x5085('0x3')]},'mobile':{'type':Sequelize[_0x5085('0x3')]},'fax':{'type':Sequelize[_0x5085('0x3')]},'email':{'type':Sequelize[_0x5085('0x3')]},'url':{'type':Sequelize[_0x5085('0x3')]},'facebook':{'type':Sequelize[_0x5085('0x3')]},'fb_data':{'type':Sequelize[_0x5085('0x3')]},'twitter':{'type':Sequelize[_0x5085('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x5085('0x3')]},'line':{'type':Sequelize[_0x5085('0x3')]},'wechat':{'type':Sequelize[_0x5085('0x3')]},'telegram':{'type':Sequelize[_0x5085('0x3')]},'UserId':{'type':Sequelize[_0x5085('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x5085('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x5085('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f2f51c9..947057a 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 _0x404b=['register','sendStatus','end','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmContact','describe','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','options','include','push','Tag','Tags','distinct','includeAll','color','tag','ThroughTags','findAll','rows','find','params','catch','startsWith','cf_','displayName','CmCustomField','columnName','body','from','get','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','info','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelMessage','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','bulkCreate','each','duplicates','$or','ListId','spread','show','map','format','cf_%d','$and','omit','pickBy','cm_contacts','setFields','id\x20=\x20?','toParam','sequelize','values','phone','CmHopper','getTags','findOne','rawAttributes','intersection','setTags','ids','ContactId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','import','User','agent','binding','No\x20phone\x20column\x20specified','firstName','child_process','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./cmContact.socket'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x404b,0x14e));var _0xb404=function(_0x470d1e,_0xbcad55){_0x470d1e=_0x470d1e-0x0;var _0x113440=_0x404b[_0x470d1e];return _0x113440;};'use strict';var pdf=require(_0xb404('0x0'));var emlformat=require(_0xb404('0x1'));var rimraf=require(_0xb404('0x2'));var zipdir=require(_0xb404('0x3'));var jsonpatch=require(_0xb404('0x4'));var rp=require('request-promise');var moment=require(_0xb404('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb404('0x6'));var util=require(_0xb404('0x7'));var path=require(_0xb404('0x8'));var sox=require(_0xb404('0x9'));var csv=require(_0xb404('0xa'));var ejs=require(_0xb404('0xb'));var fs=require('fs');var _=require(_0xb404('0xc'));var squel=require(_0xb404('0xd'));var crypto=require('crypto');var jsforce=require(_0xb404('0xe'));var deskjs=require(_0xb404('0xf'));var toCsv=require(_0xb404('0xa'));var querystring=require(_0xb404('0x10'));var Papa=require(_0xb404('0x11'));var authService=require(_0xb404('0x12'));var hardwareService=require(_0xb404('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xb404('0x14'))(_0xb404('0x15'));var utils=require(_0xb404('0x16'));var config=require(_0xb404('0x17'));var db=require(_0xb404('0x18'))['db'];config[_0xb404('0x19')]=_[_0xb404('0x1a')](config[_0xb404('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb404('0x19')]));require(_0xb404('0x1b'))[_0xb404('0x1c')](socket);function respondWithStatusCode(_0x2525f6,_0xb78ae9){_0xb78ae9=_0xb78ae9||0xcc;return function(_0x5bfe94){if(_0x5bfe94){return _0x2525f6[_0xb404('0x1d')](_0xb78ae9);}return _0x2525f6['status'](_0xb78ae9)[_0xb404('0x1e')]();};}function respondWithResult(_0x4fb15f,_0xae65f3){_0xae65f3=_0xae65f3||0xc8;return function(_0x5c4eb9){if(_0x5c4eb9){return _0x4fb15f[_0xb404('0x1f')](_0xae65f3)[_0xb404('0x20')](_0x5c4eb9);}};}function respondWithFilteredResult(_0x2cf979,_0x1e1418){return function(_0x4406a1){if(_0x4406a1){var _0x2fb5ea=_0x4406a1[_0xb404('0x21')],_0x2f2319=_0x1e1418['offset'],_0x379848=_0x1e1418['offset']+_0x1e1418[_0xb404('0x22')],_0x1b058c;if(_0x379848>=_0x2fb5ea){_0x379848=_0x2fb5ea;_0x1b058c=0xc8;}else{_0x1b058c=0xce;}_0x2cf979[_0xb404('0x1f')](_0x1b058c);return _0x2cf979[_0xb404('0x23')](_0xb404('0x24'),_0x2f2319+'-'+_0x379848+'/'+_0x2fb5ea)[_0xb404('0x20')](_0x4406a1);}return null;};}function patchUpdates(_0x4efa9e){return function(_0x45c562){try{jsonpatch[_0xb404('0x25')](_0x45c562,_0x4efa9e,!![]);}catch(_0x13f53f){return BPromise[_0xb404('0x26')](_0x13f53f);}return _0x45c562[_0xb404('0x27')]();};}function saveUpdates(_0x189c80,_0x336dac){return function(_0x257991){if(_0x257991){return _0x257991[_0xb404('0x28')](_0x189c80)[_0xb404('0x29')](function(_0x2c56bf){return _0x2c56bf;});}return null;};}function removeEntity(_0xfc0f5f,_0xf1a571){return function(_0x1ce2be){if(_0x1ce2be){return _0x1ce2be[_0xb404('0x2a')]()[_0xb404('0x29')](function(){_0xfc0f5f[_0xb404('0x1f')](0xcc)[_0xb404('0x1e')]();});}};}function handleEntityNotFound(_0x3462ed,_0x767cae){return function(_0x4d759a){if(!_0x4d759a){_0x3462ed[_0xb404('0x1d')](0x194);}return _0x4d759a;};}function handleError(_0x33e8dd,_0x41443a){_0x41443a=_0x41443a||0x1f4;return function(_0x3bb727){logger[_0xb404('0x2b')](_0x3bb727[_0xb404('0x2c')]);if(_0x3bb727[_0xb404('0x2d')]){delete _0x3bb727[_0xb404('0x2d')];}_0x33e8dd[_0xb404('0x1f')](_0x41443a)[_0xb404('0x2e')](_0x3bb727);};}exports[_0xb404('0x2f')]=function(_0x3832b3,_0x29d0b6){var _0x49b651={},_0x570cbe={},_0x39281b={'count':0x0,'rows':[]};return db[_0xb404('0x30')][_0xb404('0x31')]()[_0xb404('0x29')](function(_0x53e8be){_0x570cbe[_0xb404('0x32')]=_['keys'](_0x53e8be);_0x570cbe[_0xb404('0x33')]=_[_0xb404('0x34')](_0x3832b3['query']);_0x570cbe['filters']=_['intersection'](_0x570cbe[_0xb404('0x32')],_0x570cbe[_0xb404('0x33')]);_0x49b651[_0xb404('0x35')]=_['intersection'](_0x570cbe[_0xb404('0x32')],qs[_0xb404('0x36')](_0x3832b3[_0xb404('0x33')]['fields']));_0x49b651[_0xb404('0x35')]=_0x49b651[_0xb404('0x35')][_0xb404('0x37')]?_0x49b651[_0xb404('0x35')]:_0x570cbe[_0xb404('0x32')];if(!_0x3832b3['query'][_0xb404('0x38')](_0xb404('0x39'))){_0x49b651[_0xb404('0x22')]=qs['limit'](_0x3832b3['query'][_0xb404('0x22')]);_0x49b651[_0xb404('0x3a')]=qs[_0xb404('0x3a')](_0x3832b3[_0xb404('0x33')][_0xb404('0x3a')]);}_0x49b651[_0xb404('0x3b')]=qs[_0xb404('0x3c')](_0x3832b3[_0xb404('0x33')][_0xb404('0x3c')]);_0x49b651[_0xb404('0x3d')]=qs[_0xb404('0x3e')](_[_0xb404('0x3f')](_0x3832b3[_0xb404('0x33')],_0x570cbe[_0xb404('0x3e')]));if(_0x3832b3[_0xb404('0x33')][_0xb404('0x40')]){_0x49b651[_0xb404('0x3d')]=_[_0xb404('0x41')](_0x49b651[_0xb404('0x3d')],{'$or':_['map'](_0x49b651[_0xb404('0x35')],function(_0x3ad501){var _0x561cff={};_0x561cff[_0x3ad501]={'$like':'%'+_0x3832b3['query'][_0xb404('0x40')]+'%'};return _0x561cff;})});}_0x49b651=_[_0xb404('0x41')]({},_0x49b651,_0x3832b3[_0xb404('0x42')]);var _0x4367ae={'where':_0x49b651['where']};_0x4367ae[_0xb404('0x43')]=[];if(_0x3832b3[_0xb404('0x33')]['tag']){_0x4367ae[_0xb404('0x43')][_0xb404('0x44')]({'model':db[_0xb404('0x45')],'as':_0xb404('0x46'),'attributes':['id'],'where':{'id':_0x3832b3[_0xb404('0x33')]['tag']},'required':!![]});_0x4367ae[_0xb404('0x47')]=!![];}return db[_0xb404('0x30')][_0xb404('0x21')](_0x4367ae)[_0xb404('0x29')](function(_0x4513d7){_0x39281b[_0xb404('0x21')]=_0x4513d7;if(_0x3832b3['query'][_0xb404('0x48')]){_0x49b651[_0xb404('0x43')]=[{'model':db[_0xb404('0x45')],'as':_0xb404('0x46'),'attributes':['id',_0xb404('0x2d'),_0xb404('0x49')],'required':_0x3832b3['query'][_0xb404('0x4a')]?!![]:![]},{'model':db['Tag'],'as':_0xb404('0x4b'),'attributes':['id',_0xb404('0x2d'),_0xb404('0x49')],'through':_0x3832b3[_0xb404('0x33')][_0xb404('0x4a')]?{'attributes':[],'where':{'TagId':_0x3832b3[_0xb404('0x33')][_0xb404('0x4a')]||undefined}}:{},'required':_0x3832b3[_0xb404('0x33')][_0xb404('0x4a')]?!![]:![]}];}return db['CmContact'][_0xb404('0x4c')](_0x49b651);})[_0xb404('0x29')](function(_0x27bc9c){_0x39281b[_0xb404('0x4d')]=_0x27bc9c;return _0x39281b;})[_0xb404('0x29')](respondWithFilteredResult(_0x29d0b6,_0x49b651))['catch'](handleError(_0x29d0b6,null));});};exports[_0xb404('0x2a')]=function(_0x4582a8,_0x27c8cb){return db[_0xb404('0x30')][_0xb404('0x4e')]({'where':{'id':_0x4582a8[_0xb404('0x4f')]['id']}})[_0xb404('0x29')](handleEntityNotFound(_0x27c8cb,null))[_0xb404('0x29')](removeEntity(_0x27c8cb,null))[_0xb404('0x50')](handleError(_0x27c8cb,null));};exports['describe']=function(_0x2d990c,_0x406976){return db[_0xb404('0x30')][_0xb404('0x31')]()[_0xb404('0x29')](function(_0x33c899){for(var _0x37261b=0x0;_0x37261b=_0x471071){_0x35f528=_0x471071;_0x49650e=0xc8;}else{_0x49650e=0xce;}_0x22d402['status'](_0x49650e);return _0x22d402[_0x12d8('0x21')]('Content-Range',_0x44a5d1+'-'+_0x35f528+'/'+_0x471071)[_0x12d8('0x1d')](_0x4a036c);}return null;};}function patchUpdates(_0x1b294e){return function(_0x23b1c5){try{jsonpatch[_0x12d8('0x22')](_0x23b1c5,_0x1b294e,!![]);}catch(_0x283548){return BPromise[_0x12d8('0x23')](_0x283548);}return _0x23b1c5[_0x12d8('0x24')]();};}function saveUpdates(_0x3022c4,_0x48a519){return function(_0x5e5b4c){if(_0x5e5b4c){return _0x5e5b4c[_0x12d8('0x25')](_0x3022c4)[_0x12d8('0x26')](function(_0x5b2b51){return _0x5b2b51;});}return null;};}function removeEntity(_0x40f8a1,_0x4ceee0){return function(_0x4ff1ac){if(_0x4ff1ac){return _0x4ff1ac[_0x12d8('0x27')]()[_0x12d8('0x26')](function(){_0x40f8a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x431640,_0x377a56){return function(_0x184771){if(!_0x184771){_0x431640['sendStatus'](0x194);}return _0x184771;};}function handleError(_0x4c72f6,_0x600d06){_0x600d06=_0x600d06||0x1f4;return function(_0x318a21){logger[_0x12d8('0x28')](_0x318a21[_0x12d8('0x29')]);if(_0x318a21[_0x12d8('0x2a')]){delete _0x318a21['name'];}_0x4c72f6['status'](_0x600d06)[_0x12d8('0x2b')](_0x318a21);};}exports[_0x12d8('0x2c')]=function(_0x4cd80c,_0x399bcd){var _0x5e0321={},_0x18318c={},_0x205d77={'count':0x0,'rows':[]};return db[_0x12d8('0x2d')][_0x12d8('0x2e')]()[_0x12d8('0x26')](function(_0x2c7e16){_0x18318c['model']=_[_0x12d8('0x2f')](_0x2c7e16);_0x18318c[_0x12d8('0x30')]=_['keys'](_0x4cd80c[_0x12d8('0x30')]);_0x18318c[_0x12d8('0x31')]=_['intersection'](_0x18318c[_0x12d8('0x32')],_0x18318c[_0x12d8('0x30')]);_0x5e0321[_0x12d8('0x33')]=_[_0x12d8('0x34')](_0x18318c['model'],qs[_0x12d8('0x35')](_0x4cd80c['query'][_0x12d8('0x35')]));_0x5e0321[_0x12d8('0x33')]=_0x5e0321[_0x12d8('0x33')][_0x12d8('0x36')]?_0x5e0321[_0x12d8('0x33')]:_0x18318c['model'];if(!_0x4cd80c[_0x12d8('0x30')][_0x12d8('0x37')]('nolimit')){_0x5e0321[_0x12d8('0x20')]=qs[_0x12d8('0x20')](_0x4cd80c['query']['limit']);_0x5e0321['offset']=qs[_0x12d8('0x1f')](_0x4cd80c[_0x12d8('0x30')][_0x12d8('0x1f')]);}_0x5e0321['order']=qs[_0x12d8('0x38')](_0x4cd80c[_0x12d8('0x30')][_0x12d8('0x38')]);_0x5e0321[_0x12d8('0x39')]=qs[_0x12d8('0x31')](_['pick'](_0x4cd80c[_0x12d8('0x30')],_0x18318c[_0x12d8('0x31')]));if(_0x4cd80c[_0x12d8('0x30')][_0x12d8('0x3a')]){_0x5e0321[_0x12d8('0x39')]=_[_0x12d8('0x3b')](_0x5e0321['where'],{'$or':_[_0x12d8('0x3c')](_0x5e0321[_0x12d8('0x33')],function(_0x1fc187){var _0x297d6b={};_0x297d6b[_0x1fc187]={'$like':'%'+_0x4cd80c[_0x12d8('0x30')][_0x12d8('0x3a')]+'%'};return _0x297d6b;})});}_0x5e0321=_['merge']({},_0x5e0321,_0x4cd80c[_0x12d8('0x3d')]);var _0x4692aa={'where':_0x5e0321[_0x12d8('0x39')]};_0x4692aa[_0x12d8('0x3e')]=[];if(_0x4cd80c[_0x12d8('0x30')][_0x12d8('0x3f')]){_0x4692aa['include'][_0x12d8('0x40')]({'model':db[_0x12d8('0x41')],'as':'Tags','attributes':['id'],'where':{'id':_0x4cd80c[_0x12d8('0x30')][_0x12d8('0x3f')]},'required':!![]});_0x4692aa[_0x12d8('0x42')]=!![];}return db[_0x12d8('0x2d')][_0x12d8('0x1e')](_0x4692aa)[_0x12d8('0x26')](function(_0x47b570){_0x205d77[_0x12d8('0x1e')]=_0x47b570;if(_0x4cd80c[_0x12d8('0x30')][_0x12d8('0x43')]){_0x5e0321[_0x12d8('0x3e')]=[{'model':db[_0x12d8('0x41')],'as':'Tags','attributes':['id',_0x12d8('0x2a'),_0x12d8('0x44')],'required':_0x4cd80c[_0x12d8('0x30')][_0x12d8('0x3f')]?!![]:![]},{'model':db[_0x12d8('0x41')],'as':'ThroughTags','attributes':['id','name',_0x12d8('0x44')],'through':_0x4cd80c[_0x12d8('0x30')]['tag']?{'attributes':[],'where':{'TagId':_0x4cd80c[_0x12d8('0x30')]['tag']||undefined}}:{},'required':_0x4cd80c[_0x12d8('0x30')][_0x12d8('0x3f')]?!![]:![]}];}return db[_0x12d8('0x2d')][_0x12d8('0x45')](_0x5e0321);})[_0x12d8('0x26')](function(_0x54b81e){_0x205d77[_0x12d8('0x46')]=_0x54b81e;return _0x205d77;})[_0x12d8('0x26')](respondWithFilteredResult(_0x399bcd,_0x5e0321))[_0x12d8('0x47')](handleError(_0x399bcd,null));});};exports[_0x12d8('0x27')]=function(_0x1328a6,_0x14b17a){return db[_0x12d8('0x2d')][_0x12d8('0x48')]({'where':{'id':_0x1328a6['params']['id']}})['then'](handleEntityNotFound(_0x14b17a,null))[_0x12d8('0x26')](removeEntity(_0x14b17a,null))[_0x12d8('0x47')](handleError(_0x14b17a,null));};exports[_0x12d8('0x2e')]=function(_0x343c03,_0x55b1e6){return db[_0x12d8('0x2d')][_0x12d8('0x2e')]()[_0x12d8('0x26')](function(_0x50e69a){for(var _0x3e7197=0x0;_0x3e7197{}\s\\|]/g,'-');_0x5705b9(null,util[_0xdf5f('0x21')](_0xdf5f('0x22'),path[_0xdf5f('0x23')](_0x5cd074['originalname'],path[_0xdf5f('0x24')](_0x5cd074[_0xdf5f('0x1f')])),Date[_0xdf5f('0x25')](),path[_0xdf5f('0x24')](_0x5cd074[_0xdf5f('0x1f')])));}})});router[_0xdf5f('0x18')](_0xdf5f('0x26'),upload[_0xdf5f('0x27')](_0xdf5f('0x28')),controller[_0xdf5f('0x29')]);var upload=multer({'storage':multer[_0xdf5f('0x1c')]({'destination':function(_0x65b516,_0x360186,_0x11b68f){_0x11b68f(null,path[_0xdf5f('0x2a')](config[_0xdf5f('0x1d')],_0xdf5f('0x1e')));},'filename':function(_0x5f0cd4,_0x519ad3,_0x2869fd){_0x519ad3['originalname']=_0x519ad3['originalname'][_0xdf5f('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2869fd(null,util[_0xdf5f('0x21')](_0xdf5f('0x22'),path[_0xdf5f('0x23')](_0x519ad3['originalname'],path[_0xdf5f('0x24')](_0x519ad3[_0xdf5f('0x1f')])),Date[_0xdf5f('0x25')](),path['extname'](_0x519ad3[_0xdf5f('0x1f')])));}})});router['post'](_0xdf5f('0x2b'),upload[_0xdf5f('0x27')](_0xdf5f('0x28')),controller[_0xdf5f('0x2c')]);router[_0xdf5f('0x18')]('/upload/:id',auth[_0xdf5f('0xa')](),controller[_0xdf5f('0x2d')]);router[_0xdf5f('0x2e')](_0xdf5f('0xe'),auth[_0xdf5f('0xa')](),controller[_0xdf5f('0x2f')]);router[_0xdf5f('0x30')](_0xdf5f('0xe'),auth[_0xdf5f('0xa')](),controller[_0xdf5f('0x31')]);module[_0xdf5f('0x32')]=router; \ No newline at end of file +var _0x482f=['join','root','format','put','update','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmContact.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/tags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','merge','post','create','/create_many','bulkCreate','setTags','diskStorage','originalname','replace','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv'];(function(_0x5c3ff7,_0x32ae45){var _0x3526fe=function(_0x330c8b){while(--_0x330c8b){_0x5c3ff7['push'](_0x5c3ff7['shift']());}};_0x3526fe(++_0x32ae45);}(_0x482f,0x166));var _0xf482=function(_0x368dd3,_0x17f569){_0x368dd3=_0x368dd3-0x0;var _0x3783a7=_0x482f[_0x368dd3];return _0x3783a7;};'use strict';var multer=require(_0xf482('0x0'));var util=require(_0xf482('0x1'));var path=require('path');var timeout=require(_0xf482('0x2'));var express=require('express');var router=express[_0xf482('0x3')]();var auth=require(_0xf482('0x4'));var interaction=require(_0xf482('0x5'));var config=require('../../config/environment');var controller=require(_0xf482('0x6'));router[_0xf482('0x7')]('/',auth[_0xf482('0x8')](),controller[_0xf482('0x9')]);router[_0xf482('0x7')](_0xf482('0xa'),auth[_0xf482('0x8')](),controller['describe']);router['get'](_0xf482('0xb'),auth[_0xf482('0x8')](),controller[_0xf482('0xc')]);router[_0xf482('0x7')](_0xf482('0xd'),auth[_0xf482('0x8')](),controller['getTags']);router[_0xf482('0x7')](_0xf482('0xe'),auth[_0xf482('0x8')](),controller[_0xf482('0xf')]);router[_0xf482('0x7')](_0xf482('0x10'),auth['isAuthenticated'](),controller[_0xf482('0x11')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xf482('0x12')]);router[_0xf482('0x7')](_0xf482('0x13'),auth[_0xf482('0x8')](),controller[_0xf482('0x14')]);router['post']('/merge',auth[_0xf482('0x8')](),controller[_0xf482('0x15')]);router[_0xf482('0x16')]('/',auth[_0xf482('0x8')](),controller[_0xf482('0x17')]);router[_0xf482('0x16')](_0xf482('0x18'),auth['isAuthenticated'](),controller[_0xf482('0x19')]);router[_0xf482('0x16')](_0xf482('0xd'),auth['isAuthenticated'](),controller[_0xf482('0x1a')]);var upload=multer({'storage':multer[_0xf482('0x1b')]({'destination':function(_0x2b6f43,_0x4b4504,_0x20d415){_0x20d415(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0x2a5378,_0x1e5f45,_0x59b5a4){_0x1e5f45[_0xf482('0x1c')]=_0x1e5f45[_0xf482('0x1c')][_0xf482('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59b5a4(null,util['format'](_0xf482('0x1e'),path[_0xf482('0x1f')](_0x1e5f45[_0xf482('0x1c')],path[_0xf482('0x20')](_0x1e5f45[_0xf482('0x1c')])),Date[_0xf482('0x21')](),path[_0xf482('0x20')](_0x1e5f45['originalname'])));}})});router[_0xf482('0x16')](_0xf482('0x22'),upload[_0xf482('0x23')](_0xf482('0x24')),controller[_0xf482('0x25')]);var upload=multer({'storage':multer[_0xf482('0x1b')]({'destination':function(_0x52d060,_0x294db7,_0x5dee08){_0x5dee08(null,path[_0xf482('0x26')](config[_0xf482('0x27')],'server/files/tmp'));},'filename':function(_0x1aaa1e,_0x589184,_0x9cb67c){_0x589184[_0xf482('0x1c')]=_0x589184['originalname'][_0xf482('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9cb67c(null,util[_0xf482('0x28')]('%s-%s%s',path[_0xf482('0x1f')](_0x589184[_0xf482('0x1c')],path['extname'](_0x589184[_0xf482('0x1c')])),Date[_0xf482('0x21')](),path[_0xf482('0x20')](_0x589184['originalname'])));}})});router[_0xf482('0x16')]('/upload',upload['single'](_0xf482('0x24')),controller['upload']);router[_0xf482('0x16')]('/upload/:id',auth[_0xf482('0x8')](),controller['import']);router[_0xf482('0x29')]('/:id',auth[_0xf482('0x8')](),controller[_0xf482('0x2a')]);router['delete'](_0xf482('0xb'),auth[_0xf482('0x8')](),controller[_0xf482('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 0f67511..003b864 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 _0x44d2=['sequelize','exports','getDataValue','alias','STRING','setDataValue','name','long','select','parse','values','isArray','stringify','BOOLEAN'];(function(_0x13ad9a,_0x2ca0f5){var _0x8ca3cb=function(_0xd89a67){while(--_0xd89a67){_0x13ad9a['push'](_0x13ad9a['shift']());}};_0x8ca3cb(++_0x2ca0f5);}(_0x44d2,0x126));var _0x244d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x44d2[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0x244d('0x0'));var _=require('lodash');module[_0x244d('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x428f52){return this[_0x244d('0x2')](_0x244d('0x3'));}},'alias':{'type':Sequelize[_0x244d('0x4')],'allowNull':![],'set':function(_0x7c9c23){this[_0x244d('0x5')](_0x244d('0x3'),_0x7c9c23?_0x7c9c23:this[_0x244d('0x2')](_0x244d('0x6')));}},'type':{'type':Sequelize[_0x244d('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x244d('0x7')),'get':function(){if(this[_0x244d('0x2')]('type')===_0x244d('0x8')){return JSON[_0x244d('0x9')](this['getDataValue'](_0x244d('0xa')));}else{return this['getDataValue'](_0x244d('0xa'));}},'set':function(_0x21c4d5){if(Array[_0x244d('0xb')](_0x21c4d5)){this[_0x244d('0x5')](_0x244d('0xa'),JSON[_0x244d('0xc')](_0x21c4d5));}else{this[_0x244d('0x5')]('values',_0x21c4d5);}}},'required':{'type':Sequelize[_0x244d('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x2d3e=['VIRTUAL','getDataValue','alias','STRING','name','TEXT','long','select','values','isArray','setDataValue','BOOLEAN','sequelize','lodash','exports'];(function(_0x41ba6a,_0x4e4743){var _0x471956=function(_0x3d252f){while(--_0x3d252f){_0x41ba6a['push'](_0x41ba6a['shift']());}};_0x471956(++_0x4e4743);}(_0x2d3e,0x1ce));var _0xe2d3=function(_0x59f6fa,_0x201b35){_0x59f6fa=_0x59f6fa-0x0;var _0x274f7c=_0x2d3e[_0x59f6fa];return _0x274f7c;};'use strict';var Sequelize=require(_0xe2d3('0x0'));var _=require(_0xe2d3('0x1'));module[_0xe2d3('0x2')]={'name':{'type':Sequelize[_0xe2d3('0x3')],'get':function(_0x4a3769){return this[_0xe2d3('0x4')](_0xe2d3('0x5'));}},'alias':{'type':Sequelize[_0xe2d3('0x6')],'allowNull':![],'set':function(_0x33dbfe){this['setDataValue'](_0xe2d3('0x5'),_0x33dbfe?_0x33dbfe:this[_0xe2d3('0x4')](_0xe2d3('0x7')));}},'type':{'type':Sequelize[_0xe2d3('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xe2d3('0x8')](_0xe2d3('0x9')),'get':function(){if(this[_0xe2d3('0x4')]('type')===_0xe2d3('0xa')){return JSON['parse'](this[_0xe2d3('0x4')](_0xe2d3('0xb')));}else{return this[_0xe2d3('0x4')](_0xe2d3('0xb'));}},'set':function(_0x442d3d){if(Array[_0xe2d3('0xc')](_0x442d3d)){this[_0xe2d3('0xd')](_0xe2d3('0xb'),JSON['stringify'](_0x442d3d));}else{this[_0xe2d3('0xd')](_0xe2d3('0xb'),_0x442d3d);}}},'required':{'type':Sequelize[_0xe2d3('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 378f7cc..830817b 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 _0xf373=['cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','end','stack','name','send','index','rawAttributes','model','differenceBy','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','map','type','key','VIRTUAL','filter','options','includeAll','CmCustomField','findAll','rows','catch','show','params','include','find','destroy','create','sequelize','body','Sequelize','text','TEXT','number','BOOLEAN','queryInterface','addColumn','cm_contacts'];(function(_0x5b53f9,_0x347585){var _0x34c074=function(_0x5b8308){while(--_0x5b8308){_0x5b53f9['push'](_0x5b53f9['shift']());}};_0x34c074(++_0x347585);}(_0xf373,0x1b9));var _0x3f37=function(_0x1066ed,_0x305144){_0x1066ed=_0x1066ed-0x0;var _0x5a6957=_0xf373[_0x1066ed];return _0x5a6957;};'use strict';var pdf=require(_0x3f37('0x0'));var emlformat=require(_0x3f37('0x1'));var rimraf=require(_0x3f37('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f37('0x3'));var rp=require(_0x3f37('0x4'));var moment=require('moment');var BPromise=require(_0x3f37('0x5'));var Mustache=require(_0x3f37('0x6'));var util=require(_0x3f37('0x7'));var path=require(_0x3f37('0x8'));var sox=require('sox');var csv=require(_0x3f37('0x9'));var ejs=require(_0x3f37('0xa'));var fs=require('fs');var _=require(_0x3f37('0xb'));var squel=require(_0x3f37('0xc'));var crypto=require(_0x3f37('0xd'));var jsforce=require(_0x3f37('0xe'));var deskjs=require(_0x3f37('0xf'));var toCsv=require(_0x3f37('0x9'));var querystring=require(_0x3f37('0x10'));var Papa=require('papaparse');var authService=require(_0x3f37('0x11'));var hardwareService=require(_0x3f37('0x12'));var Redis=require(_0x3f37('0x13'));var qs=require(_0x3f37('0x14'));var logger=require(_0x3f37('0x15'))(_0x3f37('0x16'));var utils=require(_0x3f37('0x17'));var config=require(_0x3f37('0x18'));var db=require(_0x3f37('0x19'))['db'];function respondWithStatusCode(_0x57bc72,_0x4be7b4){_0x4be7b4=_0x4be7b4||0xcc;return function(_0x35907c){if(_0x35907c){return _0x57bc72[_0x3f37('0x1a')](_0x4be7b4);}return _0x57bc72['status'](_0x4be7b4)['end']();};}function respondWithResult(_0x318c89,_0xbec006){_0xbec006=_0xbec006||0xc8;return function(_0x236b02){if(_0x236b02){return _0x318c89[_0x3f37('0x1b')](_0xbec006)[_0x3f37('0x1c')](_0x236b02);}};}function respondWithFilteredResult(_0x2d8eaf,_0x4f1049){return function(_0x28b4d7){if(_0x28b4d7){var _0x470171=_0x28b4d7[_0x3f37('0x1d')],_0x206a53=_0x4f1049[_0x3f37('0x1e')],_0x335949=_0x4f1049[_0x3f37('0x1e')]+_0x4f1049[_0x3f37('0x1f')],_0xcef624;if(_0x335949>=_0x470171){_0x335949=_0x470171;_0xcef624=0xc8;}else{_0xcef624=0xce;}_0x2d8eaf[_0x3f37('0x1b')](_0xcef624);return _0x2d8eaf[_0x3f37('0x20')]('Content-Range',_0x206a53+'-'+_0x335949+'/'+_0x470171)['json'](_0x28b4d7);}return null;};}function patchUpdates(_0x32f2d5){return function(_0x1961ac){try{jsonpatch[_0x3f37('0x21')](_0x1961ac,_0x32f2d5,!![]);}catch(_0x56ba08){return BPromise[_0x3f37('0x22')](_0x56ba08);}return _0x1961ac[_0x3f37('0x23')]();};}function saveUpdates(_0x42a670,_0x326a27){return function(_0x50522c){if(_0x50522c){return _0x50522c[_0x3f37('0x24')](_0x42a670)[_0x3f37('0x25')](function(_0x364af7){return _0x364af7;});}return null;};}function removeEntity(_0x50ffb3,_0x243983){return function(_0x166672){if(_0x166672){return _0x166672['destroy']()[_0x3f37('0x25')](function(){_0x50ffb3[_0x3f37('0x1b')](0xcc)[_0x3f37('0x26')]();});}};}function handleEntityNotFound(_0xd0b3bc,_0x463f00){return function(_0x3827dc){if(!_0x3827dc){_0xd0b3bc[_0x3f37('0x1a')](0x194);}return _0x3827dc;};}function handleError(_0x27b44c,_0x3b5abe){_0x3b5abe=_0x3b5abe||0x1f4;return function(_0x5dbeab){logger['error'](_0x5dbeab[_0x3f37('0x27')]);if(_0x5dbeab[_0x3f37('0x28')]){delete _0x5dbeab[_0x3f37('0x28')];}_0x27b44c['status'](_0x3b5abe)[_0x3f37('0x29')](_0x5dbeab);};}exports[_0x3f37('0x2a')]=function(_0x17523c,_0x13e66d){var _0x4dfe79={},_0x4e6495={},_0x194b47={'count':0x0,'rows':[]};var _0x246bb2=db['CmCustomField'][_0x3f37('0x2b')];_0x4e6495[_0x3f37('0x2c')]=_[_0x3f37('0x2d')](_[_0x3f37('0x2e')](_0x246bb2),[_0x3f37('0x28')]);_0x4e6495[_0x3f37('0x2f')]=_[_0x3f37('0x2e')](_0x17523c['query']);_0x4e6495['filters']=_[_0x3f37('0x30')](_0x4e6495[_0x3f37('0x2c')],_0x4e6495['query']);_0x4dfe79['attributes']=_[_0x3f37('0x30')](_0x4e6495['model'],qs['fields'](_0x17523c[_0x3f37('0x2f')][_0x3f37('0x31')]));_0x4dfe79[_0x3f37('0x32')]=_0x4dfe79[_0x3f37('0x32')][_0x3f37('0x33')]?_0x4dfe79[_0x3f37('0x32')]:_0x4e6495['model'];if(!_0x17523c[_0x3f37('0x2f')][_0x3f37('0x34')](_0x3f37('0x35'))){_0x4dfe79[_0x3f37('0x1f')]=qs['limit'](_0x17523c[_0x3f37('0x2f')][_0x3f37('0x1f')]);_0x4dfe79['offset']=qs['offset'](_0x17523c['query'][_0x3f37('0x1e')]);}_0x4dfe79[_0x3f37('0x36')]=qs[_0x3f37('0x37')](_0x17523c['query'][_0x3f37('0x37')]);_0x4dfe79[_0x3f37('0x38')]=qs['filters'](_[_0x3f37('0x39')](_0x17523c['query'],_0x4e6495[_0x3f37('0x3a')]));if(_0x17523c['query']['filter']){_0x4dfe79[_0x3f37('0x38')]=_[_0x3f37('0x3b')](_0x4dfe79[_0x3f37('0x38')],{'$or':_[_0x3f37('0x3c')](_0x246bb2,function(_0x56dcda){if(_0x56dcda[_0x3f37('0x3d')][_0x3f37('0x3e')]!==_0x3f37('0x3f')){var _0x31c6c4={};_0x31c6c4[_0x56dcda['field']]={'$like':'%'+_0x17523c[_0x3f37('0x2f')][_0x3f37('0x40')]+'%'};return _0x31c6c4;}})});}_0x4dfe79=_[_0x3f37('0x3b')]({},_0x4dfe79,_0x17523c[_0x3f37('0x41')]);var _0x17efe0={'where':_0x4dfe79[_0x3f37('0x38')]};return db['CmCustomField'][_0x3f37('0x1d')](_0x17efe0)[_0x3f37('0x25')](function(_0x33d6b9){_0x194b47[_0x3f37('0x1d')]=_0x33d6b9;if(_0x17523c[_0x3f37('0x2f')][_0x3f37('0x42')]){_0x4dfe79['include']=[{'all':!![]}];}return db[_0x3f37('0x43')][_0x3f37('0x44')](_0x4dfe79);})[_0x3f37('0x25')](function(_0x4b424a){_0x194b47[_0x3f37('0x45')]=_0x4b424a;return _0x194b47;})[_0x3f37('0x25')](respondWithFilteredResult(_0x13e66d,_0x4dfe79))[_0x3f37('0x46')](handleError(_0x13e66d,null));};exports[_0x3f37('0x47')]=function(_0x218449,_0x86ddbf){var _0x96f9a2={'raw':!![],'where':{'id':_0x218449[_0x3f37('0x48')]['id']}},_0x2346b2={};_0x2346b2[_0x3f37('0x2c')]=_['keys'](db[_0x3f37('0x43')][_0x3f37('0x2b')]);_0x2346b2[_0x3f37('0x2f')]=_['keys'](_0x218449[_0x3f37('0x2f')]);_0x2346b2['filters']=_['intersection'](_0x2346b2[_0x3f37('0x2c')],_0x2346b2[_0x3f37('0x2f')]);_0x96f9a2[_0x3f37('0x32')]=_[_0x3f37('0x30')](_0x2346b2[_0x3f37('0x2c')],qs['fields'](_0x218449['query'][_0x3f37('0x31')]));_0x96f9a2[_0x3f37('0x32')]=_0x96f9a2[_0x3f37('0x32')][_0x3f37('0x33')]?_0x96f9a2['attributes']:_0x2346b2['model'];if(_0x218449[_0x3f37('0x2f')][_0x3f37('0x42')]){_0x96f9a2[_0x3f37('0x49')]=[{'all':!![]}];}_0x96f9a2=_[_0x3f37('0x3b')]({},_0x96f9a2,_0x218449[_0x3f37('0x41')]);return db[_0x3f37('0x43')][_0x3f37('0x4a')](_0x96f9a2)[_0x3f37('0x25')](handleEntityNotFound(_0x86ddbf,null))[_0x3f37('0x25')](respondWithResult(_0x86ddbf,null))[_0x3f37('0x46')](handleError(_0x86ddbf,null));};exports[_0x3f37('0x24')]=function(_0x5e6177,_0x43c8a4){if(_0x5e6177['body']['id']){delete _0x5e6177['body']['id'];}return db['CmCustomField']['find']({'where':{'id':_0x5e6177[_0x3f37('0x48')]['id']}})[_0x3f37('0x25')](handleEntityNotFound(_0x43c8a4,null))[_0x3f37('0x25')](saveUpdates(_0x5e6177['body'],null))[_0x3f37('0x25')](respondWithResult(_0x43c8a4,null))[_0x3f37('0x46')](handleError(_0x43c8a4,null));};exports[_0x3f37('0x4b')]=function(_0x17619a,_0x1e8eba){return db['CmCustomField'][_0x3f37('0x4a')]({'where':{'id':_0x17619a[_0x3f37('0x48')]['id']}})['then'](handleEntityNotFound(_0x1e8eba,null))['then'](removeEntity(_0x1e8eba,null))['catch'](handleError(_0x1e8eba,null));};exports[_0x3f37('0x4c')]=function(_0x53ba23,_0x163df6){var _0x34d8b7;return db[_0x3f37('0x4d')]['transaction'](function(_0x4ce45e){return db[_0x3f37('0x43')][_0x3f37('0x4c')](_0x53ba23[_0x3f37('0x4e')],{'transaction':_0x4ce45e})[_0x3f37('0x25')](function(_0x1d36e2){_0x34d8b7=_0x1d36e2;var _0x5588d9={'type':db[_0x3f37('0x4f')]['TEXT'],'transaction':_0x4ce45e};switch(_0x53ba23[_0x3f37('0x4e')][_0x3f37('0x3d')]){case _0x3f37('0x50'):_0x5588d9[_0x3f37('0x3d')]=db[_0x3f37('0x4f')][_0x3f37('0x51')];break;case _0x3f37('0x52'):_0x5588d9[_0x3f37('0x3d')]=db[_0x3f37('0x4f')]['INTEGER'];break;case'switch':_0x5588d9[_0x3f37('0x3d')]=db[_0x3f37('0x4f')][_0x3f37('0x53')];_0x5588d9['defaultValue']=![];break;default:}return db[_0x3f37('0x4d')][_0x3f37('0x54')][_0x3f37('0x55')](_0x3f37('0x56'),util['format'](_0x3f37('0x57'),_0x34d8b7['id']),_0x5588d9);})[_0x3f37('0x25')](function(){return _0x34d8b7;});})[_0x3f37('0x25')](respondWithResult(_0x163df6,0xc9))[_0x3f37('0x46')](handleError(_0x163df6,null));}; \ No newline at end of file +var _0x971c=['cf_%d','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','error','name','index','CmCustomField','rawAttributes','model','differenceBy','keys','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','filter','map','key','VIRTUAL','field','merge','options','count','includeAll','include','findAll','catch','show','params','length','find','body','transaction','create','Sequelize','TEXT','type','text','number','INTEGER','defaultValue','sequelize','queryInterface','cm_contacts','format'];(function(_0x189307,_0x188a83){var _0xb5dd95=function(_0xad5ffa){while(--_0xad5ffa){_0x189307['push'](_0x189307['shift']());}};_0xb5dd95(++_0x188a83);}(_0x971c,0x151));var _0xc971=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x971c[_0x2bf141];return _0x48277b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc971('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc971('0x1'));var rp=require(_0xc971('0x2'));var moment=require(_0xc971('0x3'));var BPromise=require(_0xc971('0x4'));var Mustache=require(_0xc971('0x5'));var util=require(_0xc971('0x6'));var path=require(_0xc971('0x7'));var sox=require(_0xc971('0x8'));var csv=require(_0xc971('0x9'));var ejs=require(_0xc971('0xa'));var fs=require('fs');var _=require(_0xc971('0xb'));var squel=require('squel');var crypto=require(_0xc971('0xc'));var jsforce=require(_0xc971('0xd'));var deskjs=require(_0xc971('0xe'));var toCsv=require(_0xc971('0x9'));var querystring=require(_0xc971('0xf'));var Papa=require(_0xc971('0x10'));var authService=require(_0xc971('0x11'));var hardwareService=require(_0xc971('0x12'));var Redis=require(_0xc971('0x13'));var qs=require(_0xc971('0x14'));var logger=require(_0xc971('0x15'))(_0xc971('0x16'));var utils=require('../../config/utils');var config=require(_0xc971('0x17'));var db=require(_0xc971('0x18'))['db'];function respondWithStatusCode(_0x2bccba,_0x20a955){_0x20a955=_0x20a955||0xcc;return function(_0xc6193b){if(_0xc6193b){return _0x2bccba[_0xc971('0x19')](_0x20a955);}return _0x2bccba[_0xc971('0x1a')](_0x20a955)[_0xc971('0x1b')]();};}function respondWithResult(_0x67afd1,_0x1c10f2){_0x1c10f2=_0x1c10f2||0xc8;return function(_0x33e197){if(_0x33e197){return _0x67afd1[_0xc971('0x1a')](_0x1c10f2)[_0xc971('0x1c')](_0x33e197);}};}function respondWithFilteredResult(_0x400f3f,_0x262593){return function(_0x3e3cd2){if(_0x3e3cd2){var _0x423387=_0x3e3cd2['count'],_0x4c4078=_0x262593[_0xc971('0x1d')],_0x4758ef=_0x262593['offset']+_0x262593[_0xc971('0x1e')],_0x5623b6;if(_0x4758ef>=_0x423387){_0x4758ef=_0x423387;_0x5623b6=0xc8;}else{_0x5623b6=0xce;}_0x400f3f['status'](_0x5623b6);return _0x400f3f['set']('Content-Range',_0x4c4078+'-'+_0x4758ef+'/'+_0x423387)[_0xc971('0x1c')](_0x3e3cd2);}return null;};}function patchUpdates(_0x4a9103){return function(_0x182a67){try{jsonpatch[_0xc971('0x1f')](_0x182a67,_0x4a9103,!![]);}catch(_0x18b030){return BPromise[_0xc971('0x20')](_0x18b030);}return _0x182a67[_0xc971('0x21')]();};}function saveUpdates(_0x4c590d,_0x14b7fd){return function(_0x273961){if(_0x273961){return _0x273961[_0xc971('0x22')](_0x4c590d)[_0xc971('0x23')](function(_0x508ff5){return _0x508ff5;});}return null;};}function removeEntity(_0x3d18e6,_0x568115){return function(_0x382cb7){if(_0x382cb7){return _0x382cb7[_0xc971('0x24')]()[_0xc971('0x23')](function(){_0x3d18e6[_0xc971('0x1a')](0xcc)[_0xc971('0x1b')]();});}};}function handleEntityNotFound(_0x1f17bb,_0x1168df){return function(_0x422544){if(!_0x422544){_0x1f17bb[_0xc971('0x19')](0x194);}return _0x422544;};}function handleError(_0xdae3b7,_0x233228){_0x233228=_0x233228||0x1f4;return function(_0xcb64fc){logger[_0xc971('0x25')](_0xcb64fc['stack']);if(_0xcb64fc[_0xc971('0x26')]){delete _0xcb64fc['name'];}_0xdae3b7[_0xc971('0x1a')](_0x233228)['send'](_0xcb64fc);};}exports[_0xc971('0x27')]=function(_0x41018c,_0x11363f){var _0x77de40={},_0x37c206={},_0x56f155={'count':0x0,'rows':[]};var _0x1223f8=db[_0xc971('0x28')][_0xc971('0x29')];_0x37c206[_0xc971('0x2a')]=_[_0xc971('0x2b')](_[_0xc971('0x2c')](_0x1223f8),[_0xc971('0x26')]);_0x37c206[_0xc971('0x2d')]=_[_0xc971('0x2c')](_0x41018c['query']);_0x37c206['filters']=_[_0xc971('0x2e')](_0x37c206[_0xc971('0x2a')],_0x37c206['query']);_0x77de40[_0xc971('0x2f')]=_[_0xc971('0x2e')](_0x37c206[_0xc971('0x2a')],qs[_0xc971('0x30')](_0x41018c['query']['fields']));_0x77de40[_0xc971('0x2f')]=_0x77de40['attributes']['length']?_0x77de40[_0xc971('0x2f')]:_0x37c206[_0xc971('0x2a')];if(!_0x41018c['query'][_0xc971('0x31')]('nolimit')){_0x77de40[_0xc971('0x1e')]=qs[_0xc971('0x1e')](_0x41018c[_0xc971('0x2d')]['limit']);_0x77de40[_0xc971('0x1d')]=qs[_0xc971('0x1d')](_0x41018c[_0xc971('0x2d')][_0xc971('0x1d')]);}_0x77de40['order']=qs[_0xc971('0x32')](_0x41018c[_0xc971('0x2d')][_0xc971('0x32')]);_0x77de40[_0xc971('0x33')]=qs[_0xc971('0x34')](_['pick'](_0x41018c[_0xc971('0x2d')],_0x37c206[_0xc971('0x34')]));if(_0x41018c[_0xc971('0x2d')][_0xc971('0x35')]){_0x77de40[_0xc971('0x33')]=_['merge'](_0x77de40[_0xc971('0x33')],{'$or':_[_0xc971('0x36')](_0x1223f8,function(_0x188ed4){if(_0x188ed4['type'][_0xc971('0x37')]!==_0xc971('0x38')){var _0x163153={};_0x163153[_0x188ed4[_0xc971('0x39')]]={'$like':'%'+_0x41018c[_0xc971('0x2d')][_0xc971('0x35')]+'%'};return _0x163153;}})});}_0x77de40=_[_0xc971('0x3a')]({},_0x77de40,_0x41018c[_0xc971('0x3b')]);var _0x433e3b={'where':_0x77de40['where']};return db[_0xc971('0x28')][_0xc971('0x3c')](_0x433e3b)[_0xc971('0x23')](function(_0xee140f){_0x56f155['count']=_0xee140f;if(_0x41018c[_0xc971('0x2d')][_0xc971('0x3d')]){_0x77de40[_0xc971('0x3e')]=[{'all':!![]}];}return db[_0xc971('0x28')][_0xc971('0x3f')](_0x77de40);})['then'](function(_0x2e3dea){_0x56f155['rows']=_0x2e3dea;return _0x56f155;})[_0xc971('0x23')](respondWithFilteredResult(_0x11363f,_0x77de40))[_0xc971('0x40')](handleError(_0x11363f,null));};exports[_0xc971('0x41')]=function(_0x25278c,_0x362069){var _0x53ec1c={'raw':!![],'where':{'id':_0x25278c[_0xc971('0x42')]['id']}},_0x8074cc={};_0x8074cc[_0xc971('0x2a')]=_['keys'](db[_0xc971('0x28')]['rawAttributes']);_0x8074cc[_0xc971('0x2d')]=_[_0xc971('0x2c')](_0x25278c[_0xc971('0x2d')]);_0x8074cc[_0xc971('0x34')]=_['intersection'](_0x8074cc[_0xc971('0x2a')],_0x8074cc[_0xc971('0x2d')]);_0x53ec1c[_0xc971('0x2f')]=_[_0xc971('0x2e')](_0x8074cc[_0xc971('0x2a')],qs[_0xc971('0x30')](_0x25278c[_0xc971('0x2d')][_0xc971('0x30')]));_0x53ec1c[_0xc971('0x2f')]=_0x53ec1c[_0xc971('0x2f')][_0xc971('0x43')]?_0x53ec1c[_0xc971('0x2f')]:_0x8074cc[_0xc971('0x2a')];if(_0x25278c[_0xc971('0x2d')][_0xc971('0x3d')]){_0x53ec1c['include']=[{'all':!![]}];}_0x53ec1c=_[_0xc971('0x3a')]({},_0x53ec1c,_0x25278c[_0xc971('0x3b')]);return db['CmCustomField'][_0xc971('0x44')](_0x53ec1c)[_0xc971('0x23')](handleEntityNotFound(_0x362069,null))[_0xc971('0x23')](respondWithResult(_0x362069,null))[_0xc971('0x40')](handleError(_0x362069,null));};exports[_0xc971('0x22')]=function(_0xc7207,_0x24b0b7){if(_0xc7207['body']['id']){delete _0xc7207['body']['id'];}return db[_0xc971('0x28')][_0xc971('0x44')]({'where':{'id':_0xc7207[_0xc971('0x42')]['id']}})[_0xc971('0x23')](handleEntityNotFound(_0x24b0b7,null))['then'](saveUpdates(_0xc7207[_0xc971('0x45')],null))[_0xc971('0x23')](respondWithResult(_0x24b0b7,null))[_0xc971('0x40')](handleError(_0x24b0b7,null));};exports[_0xc971('0x24')]=function(_0x457c98,_0x2ff24a){return db[_0xc971('0x28')]['find']({'where':{'id':_0x457c98[_0xc971('0x42')]['id']}})['then'](handleEntityNotFound(_0x2ff24a,null))[_0xc971('0x23')](removeEntity(_0x2ff24a,null))[_0xc971('0x40')](handleError(_0x2ff24a,null));};exports['create']=function(_0x9e217c,_0x587ea3){var _0x5e2620;return db['sequelize'][_0xc971('0x46')](function(_0x154d85){return db[_0xc971('0x28')][_0xc971('0x47')](_0x9e217c[_0xc971('0x45')],{'transaction':_0x154d85})[_0xc971('0x23')](function(_0x1cd263){_0x5e2620=_0x1cd263;var _0x530e32={'type':db[_0xc971('0x48')][_0xc971('0x49')],'transaction':_0x154d85};switch(_0x9e217c[_0xc971('0x45')][_0xc971('0x4a')]){case _0xc971('0x4b'):_0x530e32['type']=db[_0xc971('0x48')][_0xc971('0x49')];break;case _0xc971('0x4c'):_0x530e32[_0xc971('0x4a')]=db[_0xc971('0x48')][_0xc971('0x4d')];break;case'switch':_0x530e32[_0xc971('0x4a')]=db[_0xc971('0x48')]['BOOLEAN'];_0x530e32[_0xc971('0x4e')]=![];break;default:}return db[_0xc971('0x4f')][_0xc971('0x50')]['addColumn'](_0xc971('0x51'),util[_0xc971('0x52')](_0xc971('0x53'),_0x5e2620['id']),_0x530e32);})[_0xc971('0x23')](function(){return _0x5e2620;});})[_0xc971('0x23')](respondWithResult(_0x587ea3,0xc9))[_0xc971('0x40')](handleError(_0x587ea3,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 539160f..9166468 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 _0x13dc=['lodash','util','../../config/logger','moment','request-promise','exports','CmCustomField'];(function(_0x5be687,_0x57849f){var _0x636f06=function(_0x8933cf){while(--_0x8933cf){_0x5be687['push'](_0x5be687['shift']());}};_0x636f06(++_0x57849f);}(_0x13dc,0x16c));var _0xc13d=function(_0x21c579,_0x418347){_0x21c579=_0x21c579-0x0;var _0x59866d=_0x13dc[_0x21c579];return _0x59866d;};'use strict';var _=require(_0xc13d('0x0'));var util=require(_0xc13d('0x1'));var logger=require(_0xc13d('0x2'))('api');var moment=require(_0xc13d('0x3'));var BPromise=require('bluebird');var rp=require(_0xc13d('0x4'));var attributes=require('./cmCustomField.attributes');module[_0xc13d('0x5')]=function(_0x374e5f,_0x585d01){return _0x374e5f['define'](_0xc13d('0x6'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9de2=['../../config/logger','bluebird','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0x9de2,0x1ae));var _0x29de=function(_0x3db088,_0x30295f){_0x3db088=_0x3db088-0x0;var _0x5d2c40=_0x9de2[_0x3db088];return _0x5d2c40;};'use strict';var _=require(_0x29de('0x0'));var util=require(_0x29de('0x1'));var logger=require(_0x29de('0x2'))('api');var moment=require('moment');var BPromise=require(_0x29de('0x3'));var rp=require('request-promise');var attributes=require(_0x29de('0x4'));module[_0x29de('0x5')]=function(_0x168004,_0x5df66f){return _0x168004[_0x29de('0x6')](_0x29de('0x7'),attributes,{'tableName':_0x29de('0x8'),'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 11ef495..c416739 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 _0xa624=['../../config/logger','../../config/environment','client','http','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x29d5d3,_0x49c0c6){var _0x420fdf=function(_0x44517b){while(--_0x44517b){_0x29d5d3['push'](_0x29d5d3['shift']());}};_0x420fdf(++_0x49c0c6);}(_0xa624,0xb1));var _0x4a62=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0xa624[_0x5e3701];return _0x345dcf;};'use strict';var _=require(_0x4a62('0x0'));var util=require(_0x4a62('0x1'));var moment=require(_0x4a62('0x2'));var BPromise=require(_0x4a62('0x3'));var rs=require(_0x4a62('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a62('0x5'))['db'];var utils=require(_0x4a62('0x6'));var logger=require(_0x4a62('0x7'))('rpc');var config=require(_0x4a62('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4a62('0x9')][_0x4a62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb322ce,_0x3df6f5,_0x1abf4b){return new BPromise(function(_0x388ded,_0x3747cd){return client['request'](_0xb322ce,_0x1abf4b)[_0x4a62('0xb')](function(_0x4b75b2){logger[_0x4a62('0xc')](_0x4a62('0xd'),_0x3df6f5,'request\x20sent');logger[_0x4a62('0xe')](_0x4a62('0xf'),_0x3df6f5,_0x4a62('0x10'),JSON[_0x4a62('0x11')](_0x4b75b2));if(_0x4b75b2[_0x4a62('0x12')]){if(_0x4b75b2[_0x4a62('0x12')][_0x4a62('0x13')]===0x1f4){logger[_0x4a62('0x12')]('CmCustomField,\x20%s,\x20%s',_0x3df6f5,_0x4b75b2['error']['message']);return _0x3747cd(_0x4b75b2['error']['message']);}logger[_0x4a62('0x12')](_0x4a62('0xd'),_0x3df6f5,_0x4b75b2['error']['message']);return _0x388ded(_0x4b75b2[_0x4a62('0x12')]['message']);}else{logger[_0x4a62('0xc')]('CmCustomField,\x20%s,\x20%s',_0x3df6f5,_0x4a62('0x10'));_0x388ded(_0x4b75b2[_0x4a62('0x14')][_0x4a62('0x15')]);}})[_0x4a62('0x16')](function(_0x6801d1){logger['error'](_0x4a62('0xd'),_0x3df6f5,_0x6801d1);_0x3747cd(_0x6801d1);});});} \ No newline at end of file +var _0xb4c9=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0xb4c9,0x104));var _0x9b4c=function(_0x207fcf,_0x521e3a){_0x207fcf=_0x207fcf-0x0;var _0x4bbd40=_0xb4c9[_0x207fcf];return _0x4bbd40;};'use strict';var _=require(_0x9b4c('0x0'));var util=require(_0x9b4c('0x1'));var moment=require(_0x9b4c('0x2'));var BPromise=require(_0x9b4c('0x3'));var rs=require(_0x9b4c('0x4'));var fs=require('fs');var Redis=require(_0x9b4c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9b4c('0x6'))(_0x9b4c('0x7'));var config=require(_0x9b4c('0x8'));var jayson=require(_0x9b4c('0x9'));var client=jayson[_0x9b4c('0xa')][_0x9b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ac12d,_0xee769a,_0x4f62ba){return new BPromise(function(_0x230139,_0x137664){return client['request'](_0x3ac12d,_0x4f62ba)[_0x9b4c('0xc')](function(_0x186165){logger['info']('CmCustomField,\x20%s,\x20%s',_0xee769a,_0x9b4c('0xd'));logger['debug'](_0x9b4c('0xe'),_0xee769a,'request\x20sent',JSON[_0x9b4c('0xf')](_0x186165));if(_0x186165[_0x9b4c('0x10')]){if(_0x186165[_0x9b4c('0x10')]['code']===0x1f4){logger['error'](_0x9b4c('0x11'),_0xee769a,_0x186165['error'][_0x9b4c('0x12')]);return _0x137664(_0x186165[_0x9b4c('0x10')][_0x9b4c('0x12')]);}logger[_0x9b4c('0x10')]('CmCustomField,\x20%s,\x20%s',_0xee769a,_0x186165[_0x9b4c('0x10')]['message']);return _0x230139(_0x186165[_0x9b4c('0x10')]['message']);}else{logger[_0x9b4c('0x13')]('CmCustomField,\x20%s,\x20%s',_0xee769a,'request\x20sent');_0x230139(_0x186165[_0x9b4c('0x14')][_0x9b4c('0x12')]);}})[_0x9b4c('0x15')](function(_0xc33c01){logger['error'](_0x9b4c('0x11'),_0xee769a,_0xc33c01);_0x137664(_0xc33c01);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 11d0922..3341779 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 _0x2ec6=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','post','create','put','/:id','update'];(function(_0x188d40,_0x34fb59){var _0x44130c=function(_0x5905a9){while(--_0x5905a9){_0x188d40['push'](_0x188d40['shift']());}};_0x44130c(++_0x34fb59);}(_0x2ec6,0xf2));var _0x62ec=function(_0xa2ba12,_0x3430e3){_0xa2ba12=_0xa2ba12-0x0;var _0x3e32d3=_0x2ec6[_0xa2ba12];return _0x3e32d3;};'use strict';var multer=require(_0x62ec('0x0'));var util=require(_0x62ec('0x1'));var path=require(_0x62ec('0x2'));var timeout=require(_0x62ec('0x3'));var express=require(_0x62ec('0x4'));var router=express[_0x62ec('0x5')]();var auth=require(_0x62ec('0x6'));var interaction=require(_0x62ec('0x7'));var config=require(_0x62ec('0x8'));var controller=require(_0x62ec('0x9'));router[_0x62ec('0xa')]('/',auth[_0x62ec('0xb')](),controller[_0x62ec('0xc')]);router[_0x62ec('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x62ec('0xd')]('/',auth['isAuthenticated'](),controller[_0x62ec('0xe')]);router[_0x62ec('0xf')](_0x62ec('0x10'),auth[_0x62ec('0xb')](),controller[_0x62ec('0x11')]);router['delete']('/:id',auth[_0x62ec('0xb')](),controller[_0x62ec('0x12')]);module[_0x62ec('0x13')]=router; \ No newline at end of file +var _0xb568=['connect-timeout','express','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x40932e,_0x4b8aa6){var _0x10b2fc=function(_0x4cb6a6){while(--_0x4cb6a6){_0x40932e['push'](_0x40932e['shift']());}};_0x10b2fc(++_0x4b8aa6);}(_0xb568,0x85));var _0x8b56=function(_0x273f3a,_0x3c3708){_0x273f3a=_0x273f3a-0x0;var _0x3272ab=_0xb568[_0x273f3a];return _0x3272ab;};'use strict';var multer=require(_0x8b56('0x0'));var util=require(_0x8b56('0x1'));var path=require(_0x8b56('0x2'));var timeout=require(_0x8b56('0x3'));var express=require(_0x8b56('0x4'));var router=express['Router']();var auth=require(_0x8b56('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b56('0x6'));var controller=require(_0x8b56('0x7'));router[_0x8b56('0x8')]('/',auth[_0x8b56('0x9')](),controller['index']);router[_0x8b56('0x8')](_0x8b56('0xa'),auth[_0x8b56('0x9')](),controller['show']);router[_0x8b56('0xb')]('/',auth[_0x8b56('0x9')](),controller['create']);router[_0x8b56('0xc')](_0x8b56('0xa'),auth[_0x8b56('0x9')](),controller[_0x8b56('0xd')]);router[_0x8b56('0xe')]('/:id',auth[_0x8b56('0x9')](),controller[_0x8b56('0xf')]);module[_0x8b56('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 2594ee8..932f210 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 _0x9e7d=['sequelize','exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e7d,0x13f));var _0xd9e7=function(_0x51472d,_0x592b0b){_0x51472d=_0x51472d-0x0;var _0x5f00f1=_0x9e7d[_0x51472d];return _0x5f00f1;};'use strict';var moment=require(_0xd9e7('0x0'));var Sequelize=require(_0xd9e7('0x1'));module[_0xd9e7('0x2')]={'phone':{'type':Sequelize[_0xd9e7('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xd9e7('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xd9e7('0x5'))},'countbusyretry':{'type':Sequelize[_0xd9e7('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd9e7('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd9e7('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd9e7('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd9e7('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd9e7('0x7')]},'priority':{'type':Sequelize[_0xd9e7('0x6')](0x2)[_0xd9e7('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd9e7('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd9e7('0x6')],'unique':_0xd9e7('0x9')},'ListId':{'type':Sequelize[_0xd9e7('0x6')],'unique':_0xd9e7('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xd9e7('0x6')],'unique':_0xd9e7('0x9')},'CampaignId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb387=['sequelize','exports','DATE','format','INTEGER','BOOLEAN','STRING','contactListQueue','moment'];(function(_0x274598,_0x1e5206){var _0x4c0878=function(_0x1f2f12){while(--_0x1f2f12){_0x274598['push'](_0x274598['shift']());}};_0x4c0878(++_0x1e5206);}(_0xb387,0x182));var _0x7b38=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xb387[_0x56740a];return _0x257144;};'use strict';var moment=require(_0x7b38('0x0'));var Sequelize=require(_0x7b38('0x1'));module[_0x7b38('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7b38('0x3')],'defaultValue':moment()[_0x7b38('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x7b38('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7b38('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7b38('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7b38('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7b38('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7b38('0x3')]},'priority':{'type':Sequelize[_0x7b38('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7b38('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7b38('0x5')],'unique':_0x7b38('0x8')},'ListId':{'type':Sequelize[_0x7b38('0x5')],'unique':_0x7b38('0x8')},'UserId':{'type':Sequelize[_0x7b38('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x7b38('0x8')},'CampaignId':{'type':Sequelize[_0x7b38('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 8946541..c9ba3f8 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 _0xf820=['fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','status','end','json','count','offset','set','apply','reject','save','then','sendStatus','stack','name','send','index','CmHopper','rawAttributes','model','keys','query','filters','intersection','$and','$or','$gte','$lt','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','merge','map','key','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','length','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','calleridnum','phone','queue','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','transaction','format','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','sequelize','literal','DESC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Company','List','Queue','dialActive','update','getOpenContacts','preview','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','zip-dir'];(function(_0x38d977,_0x42be1d){var _0x355379=function(_0x3ad70a){while(--_0x3ad70a){_0x38d977['push'](_0x38d977['shift']());}};_0x355379(++_0x42be1d);}(_0xf820,0x1a1));var _0x0f82=function(_0x3226c4,_0x3e50ad){_0x3226c4=_0x3226c4-0x0;var _0x294d8c=_0xf820[_0x3226c4];return _0x294d8c;};'use strict';var pdf=require(_0x0f82('0x0'));var emlformat=require(_0x0f82('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0f82('0x2'));var jsonpatch=require(_0x0f82('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0f82('0x4'));var Mustache=require(_0x0f82('0x5'));var util=require(_0x0f82('0x6'));var path=require(_0x0f82('0x7'));var sox=require(_0x0f82('0x8'));var csv=require(_0x0f82('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0f82('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0f82('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0f82('0xc'));var Papa=require(_0x0f82('0xd'));var authService=require(_0x0f82('0xe'));var hardwareService=require(_0x0f82('0xf'));var Redis=require('ioredis');var qs=require(_0x0f82('0x10'));var logger=require(_0x0f82('0x11'))('api');var utils=require(_0x0f82('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d892,_0x196de9){_0x196de9=_0x196de9||0xcc;return function(_0xdbfdb7){if(_0xdbfdb7){return _0x56d892['sendStatus'](_0x196de9);}return _0x56d892[_0x0f82('0x13')](_0x196de9)[_0x0f82('0x14')]();};}function respondWithResult(_0x28c85c,_0x12a3c5){_0x12a3c5=_0x12a3c5||0xc8;return function(_0x135f28){if(_0x135f28){return _0x28c85c['status'](_0x12a3c5)[_0x0f82('0x15')](_0x135f28);}};}function respondWithFilteredResult(_0x3605db,_0x20de9d){return function(_0x1865fa){if(_0x1865fa){var _0x1282b9=_0x1865fa[_0x0f82('0x16')],_0x5141e5=_0x20de9d[_0x0f82('0x17')],_0x14ade5=_0x20de9d[_0x0f82('0x17')]+_0x20de9d['limit'],_0x1bb135;if(_0x14ade5>=_0x1282b9){_0x14ade5=_0x1282b9;_0x1bb135=0xc8;}else{_0x1bb135=0xce;}_0x3605db[_0x0f82('0x13')](_0x1bb135);return _0x3605db[_0x0f82('0x18')]('Content-Range',_0x5141e5+'-'+_0x14ade5+'/'+_0x1282b9)[_0x0f82('0x15')](_0x1865fa);}return null;};}function patchUpdates(_0x252b9f){return function(_0x40d7fc){try{jsonpatch[_0x0f82('0x19')](_0x40d7fc,_0x252b9f,!![]);}catch(_0x4adc14){return BPromise[_0x0f82('0x1a')](_0x4adc14);}return _0x40d7fc[_0x0f82('0x1b')]();};}function saveUpdates(_0x485b6e,_0x7b4d07){return function(_0x26e9e7){if(_0x26e9e7){return _0x26e9e7['update'](_0x485b6e)['then'](function(_0x18b467){return _0x18b467;});}return null;};}function removeEntity(_0x41fabf,_0x3a8d6b){return function(_0x5a40bc){if(_0x5a40bc){return _0x5a40bc['destroy']()[_0x0f82('0x1c')](function(){_0x41fabf[_0x0f82('0x13')](0xcc)[_0x0f82('0x14')]();});}};}function handleEntityNotFound(_0x2eac7c,_0x330ff7){return function(_0x3d3425){if(!_0x3d3425){_0x2eac7c[_0x0f82('0x1d')](0x194);}return _0x3d3425;};}function handleError(_0x2f6708,_0x583f53){_0x583f53=_0x583f53||0x1f4;return function(_0x4a7812){logger['error'](_0x4a7812[_0x0f82('0x1e')]);if(_0x4a7812[_0x0f82('0x1f')]){delete _0x4a7812[_0x0f82('0x1f')];}_0x2f6708[_0x0f82('0x13')](_0x583f53)[_0x0f82('0x20')](_0x4a7812);};}exports[_0x0f82('0x21')]=function(_0x14a447,_0x2bbbbd){var _0x5f5680={},_0x207bfd={},_0x430a72={'count':0x0,'rows':[]};var _0x40da21=db[_0x0f82('0x22')][_0x0f82('0x23')];_0x207bfd[_0x0f82('0x24')]=_[_0x0f82('0x25')](_0x40da21);_0x207bfd['query']=_['keys'](_0x14a447[_0x0f82('0x26')]);_0x207bfd[_0x0f82('0x27')]=_[_0x0f82('0x28')](_0x207bfd['model'],_0x207bfd[_0x0f82('0x26')]);_0x207bfd[_0x0f82('0x27')]=_['concat'](_0x207bfd[_0x0f82('0x27')],[_0x0f82('0x29'),_0x0f82('0x2a'),'$gt',_0x0f82('0x2b'),_0x0f82('0x2c'),'$lte','$ne',_0x0f82('0x2d'),_0x0f82('0x2e'),_0x0f82('0x2f'),_0x0f82('0x30'),_0x0f82('0x31'),_0x0f82('0x32'),'$like',_0x0f82('0x33'),_0x0f82('0x34'),_0x0f82('0x35'),_0x0f82('0x36'),_0x0f82('0x37'),_0x0f82('0x38'),_0x0f82('0x39'),_0x0f82('0x3a')]);_0x5f5680[_0x0f82('0x3b')]=_['intersection'](_0x207bfd['model'],qs[_0x0f82('0x3c')](_0x14a447[_0x0f82('0x26')][_0x0f82('0x3c')]));_0x5f5680[_0x0f82('0x3b')]=_0x5f5680[_0x0f82('0x3b')]['length']?_0x5f5680['attributes']:_0x207bfd[_0x0f82('0x24')];if(!_0x14a447[_0x0f82('0x26')][_0x0f82('0x3d')](_0x0f82('0x3e'))){_0x5f5680[_0x0f82('0x3f')]=qs[_0x0f82('0x3f')](_0x14a447[_0x0f82('0x26')][_0x0f82('0x3f')]);_0x5f5680[_0x0f82('0x17')]=qs[_0x0f82('0x17')](_0x14a447[_0x0f82('0x26')][_0x0f82('0x17')]);}_0x5f5680['order']=qs[_0x0f82('0x40')](_0x14a447[_0x0f82('0x26')][_0x0f82('0x40')]);_0x5f5680[_0x0f82('0x41')]=qs[_0x0f82('0x27')](_['pick'](_0x14a447[_0x0f82('0x26')],_0x207bfd[_0x0f82('0x27')]));if(_0x14a447[_0x0f82('0x26')]['filter']){_0x5f5680['where']=_[_0x0f82('0x42')](_0x5f5680[_0x0f82('0x41')],{'$or':_[_0x0f82('0x43')](_0x40da21,function(_0x33dbd2){if(_0x33dbd2['type'][_0x0f82('0x44')]!==_0x0f82('0x45')){var _0x359b07={};_0x359b07[_0x33dbd2['field']]={'$like':'%'+_0x14a447[_0x0f82('0x26')][_0x0f82('0x46')]+'%'};return _0x359b07;}})});}_0x5f5680=_[_0x0f82('0x42')]({},_0x5f5680,_0x14a447[_0x0f82('0x47')]);var _0x2c9fa1={'where':_0x5f5680[_0x0f82('0x41')]};return db[_0x0f82('0x22')][_0x0f82('0x16')](_0x2c9fa1)['then'](function(_0x46b4f0){_0x430a72[_0x0f82('0x16')]=_0x46b4f0;if(_0x14a447['query'][_0x0f82('0x48')]){_0x5f5680[_0x0f82('0x49')]=[{'all':!![]}];}return db[_0x0f82('0x22')][_0x0f82('0x4a')](_0x5f5680);})[_0x0f82('0x1c')](function(_0x56f60e){_0x430a72['rows']=_0x56f60e;return _0x430a72;})[_0x0f82('0x1c')](respondWithFilteredResult(_0x2bbbbd,_0x5f5680))[_0x0f82('0x4b')](handleError(_0x2bbbbd,null));};exports['show']=function(_0xe9d25a,_0x513976){var _0x5dc198={'raw':!![],'where':{'id':_0xe9d25a[_0x0f82('0x4c')]['id']}},_0x5d79ba={};_0x5d79ba[_0x0f82('0x24')]=_['keys'](db['CmHopper'][_0x0f82('0x23')]);_0x5d79ba[_0x0f82('0x26')]=_[_0x0f82('0x25')](_0xe9d25a[_0x0f82('0x26')]);_0x5d79ba[_0x0f82('0x27')]=_['intersection'](_0x5d79ba[_0x0f82('0x24')],_0x5d79ba[_0x0f82('0x26')]);_0x5dc198[_0x0f82('0x3b')]=_[_0x0f82('0x28')](_0x5d79ba[_0x0f82('0x24')],qs[_0x0f82('0x3c')](_0xe9d25a[_0x0f82('0x26')][_0x0f82('0x3c')]));_0x5dc198[_0x0f82('0x3b')]=_0x5dc198[_0x0f82('0x3b')][_0x0f82('0x4d')]?_0x5dc198['attributes']:_0x5d79ba[_0x0f82('0x24')];if(_0xe9d25a['query']['includeAll']){_0x5dc198['include']=[{'all':!![]}];}_0x5dc198=_[_0x0f82('0x42')]({},_0x5dc198,_0xe9d25a[_0x0f82('0x47')]);return db[_0x0f82('0x22')][_0x0f82('0x4e')](_0x5dc198)[_0x0f82('0x1c')](handleEntityNotFound(_0x513976,null))[_0x0f82('0x1c')](respondWithResult(_0x513976,null))[_0x0f82('0x4b')](handleError(_0x513976,null));};exports[_0x0f82('0x4f')]=function(_0x149688,_0x5fb24f){return db[_0x0f82('0x22')][_0x0f82('0x4f')](_0x149688[_0x0f82('0x50')],{})[_0x0f82('0x1c')](respondWithResult(_0x5fb24f,0xc9))[_0x0f82('0x4b')](handleError(_0x5fb24f,null));};exports['update']=function(_0x4fc07d,_0x31134b){if(_0x4fc07d['body']['id']){delete _0x4fc07d[_0x0f82('0x50')]['id'];}return db[_0x0f82('0x22')][_0x0f82('0x4e')]({'where':{'id':_0x4fc07d[_0x0f82('0x4c')]['id']}})[_0x0f82('0x1c')](handleEntityNotFound(_0x31134b,null))[_0x0f82('0x1c')](saveUpdates(_0x4fc07d[_0x0f82('0x50')],null))['then'](respondWithResult(_0x31134b,null))['catch'](handleError(_0x31134b,null));};exports[_0x0f82('0x51')]=function(_0x20e3ff,_0x347a66){return db[_0x0f82('0x22')][_0x0f82('0x51')]()['then'](respondWithResult(_0x347a66,null))[_0x0f82('0x4b')](handleError(_0x347a66,null));};exports['destroy']=function(_0x1a90fd,_0x433510){var _0x43cbf9;return db[_0x0f82('0x22')][_0x0f82('0x4e')]({'where':{'id':_0x1a90fd[_0x0f82('0x4c')]['id']}})[_0x0f82('0x1c')](handleEntityNotFound(_0x433510,null))[_0x0f82('0x1c')](function(_0x1c4029){if(_0x1c4029){return _0x1c4029[_0x0f82('0x52')]()[_0x0f82('0x1c')](function(_0x3bf5d7){return _0x3bf5d7;});}})['then'](function(_0x4a2b61){_0x43cbf9=_0x4a2b61;if(_0x4a2b61){if(_0x4a2b61['VoiceQueueId']||_0x4a2b61[_0x0f82('0x53')]){return db[_0x4a2b61[_0x0f82('0x54')]?_0x0f82('0x55'):_0x0f82('0x56')][_0x0f82('0x4e')]({'where':{'id':_0x4a2b61['VoiceQueueId']?_0x4a2b61[_0x0f82('0x54')]:_0x4a2b61['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x4c2650){var _0x56cbfc={};if(_0x4c2650){_[_0x0f82('0x42')](_0x56cbfc,_['omit'](_0x43cbf9[_0x0f82('0x57')],[_0x0f82('0x58'),_0x0f82('0x59'),'id']));_0x56cbfc[_0x0f82('0x5a')]=0x15;_0x56cbfc[_0x0f82('0x5b')]=_0x0f82('0x5c');_0x56cbfc[_0x0f82('0x5d')]=_0x4c2650['name'];_0x56cbfc[_0x0f82('0x5e')]=_0x1a90fd[_0x0f82('0x5f')][_0x0f82('0x1f')];_0x56cbfc[_0x0f82('0x60')]=_0x1a90fd[_0x0f82('0x5f')]['id'];_0x56cbfc[_0x0f82('0x5c')]=!![];_0x56cbfc[_0x0f82('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x56cbfc[_0x0f82('0x62')]=_0x43cbf9[_0x0f82('0x63')];_0x56cbfc['campaigntype']=_0x43cbf9[_0x0f82('0x54')]?_0x0f82('0x64'):'ivr';return db[_0x0f82('0x65')][_0x0f82('0x4e')]({'where':{'id':_0x56cbfc['ContactId']},'attributes':['firstName',_0x0f82('0x66')]})[_0x0f82('0x1c')](function(_0x4bfa4b){if(!_[_0x0f82('0x67')](_0x433510)&&!_[_0x0f82('0x67')](_0x4bfa4b[_0x0f82('0x68')])){_0x56cbfc[_0x0f82('0x69')]=_0x4bfa4b[_0x0f82('0x68')];if(!_[_0x0f82('0x67')](_0x4bfa4b['lastName'])){_0x56cbfc[_0x0f82('0x69')]+='\x20'+_0x4bfa4b['lastName'];}}})[_0x0f82('0x6a')](function(){return db[_0x0f82('0x6b')][_0x0f82('0x4f')](_0x56cbfc);});}})['then'](function(){return _0x433510['status'](0xcc)['end']();})[_0x0f82('0x4b')](handleError(_0x433510,null));};exports[_0x0f82('0x6c')]=function(_0x28a2d4,_0x55425b,_0x2c78b0){var _0x3b1467=[];return db[_0x0f82('0x65')][_0x0f82('0x51')]()['then'](function(_0x337e6e){_0x3b1467=_['keys'](_0x337e6e);return _0x28a2d4[_0x0f82('0x5f')][_0x0f82('0x6d')]({'where':{'type':_0x0f82('0x6e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x0f82('0x6f')],'raw':!![]});})['then'](function(_0x2ae755){if(_0x2ae755&&_0x2ae755['length']){return db['sequelize'][_0x0f82('0x70')](function(_0x337330){var _0x14ad67={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0f82('0x71')](_0x0f82('0x72'))},'VoiceQueueId':{'$in':_['map'](_0x2ae755,'id')},'$or':[{'UserId':null},{'UserId':_0x28a2d4[_0x0f82('0x5f')]['id']}]};var _0x21f348=[];if(_0x28a2d4['body']['direction']&&_0x28a2d4[_0x0f82('0x50')][_0x0f82('0x73')]===_0x0f82('0x74')){if(!_[_0x0f82('0x75')](_0x28a2d4[_0x0f82('0x50')]['hopperIds'])){_0x14ad67['id']={'$in':_0x28a2d4[_0x0f82('0x50')][_0x0f82('0x76')]};}_0x21f348=[[_0x0f82('0x77'),_0x0f82('0x78')],['scheduledAt',_0x2ae755[0x0][_0x0f82('0x6f')]==='ASC'?'DESC':'ASC'],db[_0x0f82('0x79')][_0x0f82('0x7a')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x0f82('0x7b')]];}else{if(!_[_0x0f82('0x75')](_0x28a2d4[_0x0f82('0x50')][_0x0f82('0x76')])){_0x14ad67['id']={'$notIn':_0x28a2d4['body']['hopperIds']};}_0x21f348=[[_0x0f82('0x77'),_0x0f82('0x7b')],[_0x0f82('0x7c'),_0x2ae755[0x0][_0x0f82('0x6f')]],db[_0x0f82('0x79')][_0x0f82('0x7a')](_0x0f82('0x7d')),['id',_0x0f82('0x78')]];}return db[_0x0f82('0x22')][_0x0f82('0x7e')]({'attributes':['id',_0x0f82('0x7f')],'where':_0x14ad67,'order':_0x21f348,'transaction':_0x337330,'lock':_0x337330[_0x0f82('0x80')]['UPDATE'],'include':[{'model':db[_0x0f82('0x65')],'as':'Contact','attributes':_0x3b1467,'include':[{'model':db['CmCompany'],'as':_0x0f82('0x81'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x0f82('0x82'),'attributes':['id','name']},{'model':db[_0x0f82('0x55')],'as':_0x0f82('0x83'),'attributes':['id','name',_0x0f82('0x84')]}]})[_0x0f82('0x1c')](function(_0x18bcf0){if(_0x18bcf0){return _0x18bcf0[_0x0f82('0x85')]({'UserId':_0x28a2d4[_0x0f82('0x5f')]['id']},{'transaction':_0x337330});}});});}})['then'](handleEntityNotFound(_0x55425b,null))['then'](respondWithResult(_0x55425b,null))['catch'](handleError(_0x55425b,null));};exports[_0x0f82('0x86')]=function(_0x218d70,_0x468b2f,_0x331656){return _0x218d70[_0x0f82('0x5f')][_0x0f82('0x6d')]({'where':{'type':_0x0f82('0x6e'),'dialActive':!![],'dialMethod':_0x0f82('0x87')},'attributes':['id'],'raw':!![]})['then'](function(_0x1fbcd0){if(_0x1fbcd0&&_0x1fbcd0[_0x0f82('0x4d')]){return db[_0x0f82('0x22')][_0x0f82('0x16')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0f82('0x71')](_0x0f82('0x72'))},'VoiceQueueId':{'$in':_[_0x0f82('0x43')](_0x1fbcd0,'id')},'$or':[{'UserId':null},{'UserId':_0x218d70['user']['id']}]}});}return 0x0;})['then'](function(_0x255503){if(!_['isNil'](_0x255503)&&_[_0x0f82('0x88')](_0x255503)){return _0x468b2f[_0x0f82('0x13')](0xc8)[_0x0f82('0x15')]({'contacts':_0x255503});}else{logger[_0x0f82('0x89')](_0x0f82('0x8a'),_0x0f82('0x86'),0x194,_0x0f82('0x8b'));_0x468b2f[_0x0f82('0x1d')](0x194);}})[_0x0f82('0x4b')](handleError(_0x468b2f,null));}; \ No newline at end of file +var _0xc8e2=['phone','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','sequelize','transaction','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','isNumber','error','getOpenContacts','entity\x20not\x20found','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','update','then','destroy','name','send','index','CmHopper','rawAttributes','model','keys','query','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','order','sort','where','merge','map','type','VIRTUAL','filter','options','count','includeAll','rows','catch','show','params','intersection','include','find','create','body','describe','VoiceQueueId','CampaignId','Campaign','createdAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum'];(function(_0x3f663a,_0x1f7fc5){var _0x37ea73=function(_0x40cde1){while(--_0x40cde1){_0x3f663a['push'](_0x3f663a['shift']());}};_0x37ea73(++_0x1f7fc5);}(_0xc8e2,0x1c9));var _0x2c8e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc8e2[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x2c8e('0x0'));var emlformat=require(_0x2c8e('0x1'));var rimraf=require(_0x2c8e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c8e('0x3'));var rp=require(_0x2c8e('0x4'));var moment=require(_0x2c8e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2c8e('0x6'));var util=require('util');var path=require(_0x2c8e('0x7'));var sox=require('sox');var csv=require(_0x2c8e('0x8'));var ejs=require(_0x2c8e('0x9'));var fs=require('fs');var _=require(_0x2c8e('0xa'));var squel=require('squel');var crypto=require(_0x2c8e('0xb'));var jsforce=require(_0x2c8e('0xc'));var deskjs=require(_0x2c8e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2c8e('0xe'));var Papa=require(_0x2c8e('0xf'));var authService=require(_0x2c8e('0x10'));var hardwareService=require(_0x2c8e('0x11'));var Redis=require('ioredis');var qs=require(_0x2c8e('0x12'));var logger=require(_0x2c8e('0x13'))(_0x2c8e('0x14'));var utils=require(_0x2c8e('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe08113,_0x30f459){_0x30f459=_0x30f459||0xcc;return function(_0x114ffb){if(_0x114ffb){return _0xe08113[_0x2c8e('0x16')](_0x30f459);}return _0xe08113['status'](_0x30f459)[_0x2c8e('0x17')]();};}function respondWithResult(_0x586439,_0x23e214){_0x23e214=_0x23e214||0xc8;return function(_0x442f29){if(_0x442f29){return _0x586439[_0x2c8e('0x18')](_0x23e214)[_0x2c8e('0x19')](_0x442f29);}};}function respondWithFilteredResult(_0x682881,_0x380e67){return function(_0x1b3e40){if(_0x1b3e40){var _0x30d046=_0x1b3e40['count'],_0x5edfa5=_0x380e67['offset'],_0x34e809=_0x380e67[_0x2c8e('0x1a')]+_0x380e67[_0x2c8e('0x1b')],_0x25098c;if(_0x34e809>=_0x30d046){_0x34e809=_0x30d046;_0x25098c=0xc8;}else{_0x25098c=0xce;}_0x682881['status'](_0x25098c);return _0x682881[_0x2c8e('0x1c')](_0x2c8e('0x1d'),_0x5edfa5+'-'+_0x34e809+'/'+_0x30d046)[_0x2c8e('0x19')](_0x1b3e40);}return null;};}function patchUpdates(_0x3bf008){return function(_0x5821b5){try{jsonpatch['apply'](_0x5821b5,_0x3bf008,!![]);}catch(_0x552606){return BPromise[_0x2c8e('0x1e')](_0x552606);}return _0x5821b5['save']();};}function saveUpdates(_0xa4354f,_0x49145a){return function(_0x540b0f){if(_0x540b0f){return _0x540b0f[_0x2c8e('0x1f')](_0xa4354f)[_0x2c8e('0x20')](function(_0x77be8e){return _0x77be8e;});}return null;};}function removeEntity(_0x16cf94,_0x8a199f){return function(_0x27e873){if(_0x27e873){return _0x27e873[_0x2c8e('0x21')]()['then'](function(){_0x16cf94[_0x2c8e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35ea37,_0x15f23){return function(_0x34762a){if(!_0x34762a){_0x35ea37['sendStatus'](0x194);}return _0x34762a;};}function handleError(_0xe2278a,_0x5acbb4){_0x5acbb4=_0x5acbb4||0x1f4;return function(_0x1ec516){logger['error'](_0x1ec516['stack']);if(_0x1ec516['name']){delete _0x1ec516[_0x2c8e('0x22')];}_0xe2278a['status'](_0x5acbb4)[_0x2c8e('0x23')](_0x1ec516);};}exports[_0x2c8e('0x24')]=function(_0x2d12f7,_0x5d4c37){var _0xfc0118={},_0x670a1c={},_0x36c79c={'count':0x0,'rows':[]};var _0x446161=db[_0x2c8e('0x25')][_0x2c8e('0x26')];_0x670a1c[_0x2c8e('0x27')]=_[_0x2c8e('0x28')](_0x446161);_0x670a1c[_0x2c8e('0x29')]=_['keys'](_0x2d12f7[_0x2c8e('0x29')]);_0x670a1c[_0x2c8e('0x2a')]=_['intersection'](_0x670a1c[_0x2c8e('0x27')],_0x670a1c[_0x2c8e('0x29')]);_0x670a1c[_0x2c8e('0x2a')]=_['concat'](_0x670a1c[_0x2c8e('0x2a')],[_0x2c8e('0x2b'),_0x2c8e('0x2c'),_0x2c8e('0x2d'),_0x2c8e('0x2e'),_0x2c8e('0x2f'),_0x2c8e('0x30'),_0x2c8e('0x31'),_0x2c8e('0x32'),'$not',_0x2c8e('0x33'),_0x2c8e('0x34'),'$in','$notIn',_0x2c8e('0x35'),'$notLike',_0x2c8e('0x36'),_0x2c8e('0x37'),_0x2c8e('0x35'),_0x2c8e('0x38'),_0x2c8e('0x39'),_0x2c8e('0x3a'),_0x2c8e('0x3b')]);_0xfc0118[_0x2c8e('0x3c')]=_['intersection'](_0x670a1c[_0x2c8e('0x27')],qs[_0x2c8e('0x3d')](_0x2d12f7['query'][_0x2c8e('0x3d')]));_0xfc0118[_0x2c8e('0x3c')]=_0xfc0118['attributes'][_0x2c8e('0x3e')]?_0xfc0118[_0x2c8e('0x3c')]:_0x670a1c[_0x2c8e('0x27')];if(!_0x2d12f7[_0x2c8e('0x29')]['hasOwnProperty']('nolimit')){_0xfc0118[_0x2c8e('0x1b')]=qs[_0x2c8e('0x1b')](_0x2d12f7[_0x2c8e('0x29')]['limit']);_0xfc0118['offset']=qs[_0x2c8e('0x1a')](_0x2d12f7[_0x2c8e('0x29')][_0x2c8e('0x1a')]);}_0xfc0118[_0x2c8e('0x3f')]=qs[_0x2c8e('0x40')](_0x2d12f7[_0x2c8e('0x29')][_0x2c8e('0x40')]);_0xfc0118[_0x2c8e('0x41')]=qs['filters'](_['pick'](_0x2d12f7['query'],_0x670a1c['filters']));if(_0x2d12f7[_0x2c8e('0x29')]['filter']){_0xfc0118['where']=_[_0x2c8e('0x42')](_0xfc0118[_0x2c8e('0x41')],{'$or':_[_0x2c8e('0x43')](_0x446161,function(_0x462044){if(_0x462044[_0x2c8e('0x44')]['key']!==_0x2c8e('0x45')){var _0x1d82e9={};_0x1d82e9[_0x462044['field']]={'$like':'%'+_0x2d12f7['query'][_0x2c8e('0x46')]+'%'};return _0x1d82e9;}})});}_0xfc0118=_['merge']({},_0xfc0118,_0x2d12f7[_0x2c8e('0x47')]);var _0x141c96={'where':_0xfc0118[_0x2c8e('0x41')]};return db[_0x2c8e('0x25')][_0x2c8e('0x48')](_0x141c96)[_0x2c8e('0x20')](function(_0x2e7199){_0x36c79c[_0x2c8e('0x48')]=_0x2e7199;if(_0x2d12f7[_0x2c8e('0x29')][_0x2c8e('0x49')]){_0xfc0118['include']=[{'all':!![]}];}return db[_0x2c8e('0x25')]['findAll'](_0xfc0118);})['then'](function(_0x4e1973){_0x36c79c[_0x2c8e('0x4a')]=_0x4e1973;return _0x36c79c;})['then'](respondWithFilteredResult(_0x5d4c37,_0xfc0118))[_0x2c8e('0x4b')](handleError(_0x5d4c37,null));};exports[_0x2c8e('0x4c')]=function(_0x152569,_0x403198){var _0x308253={'raw':!![],'where':{'id':_0x152569[_0x2c8e('0x4d')]['id']}},_0x480d39={};_0x480d39['model']=_[_0x2c8e('0x28')](db['CmHopper']['rawAttributes']);_0x480d39['query']=_[_0x2c8e('0x28')](_0x152569[_0x2c8e('0x29')]);_0x480d39[_0x2c8e('0x2a')]=_[_0x2c8e('0x4e')](_0x480d39[_0x2c8e('0x27')],_0x480d39[_0x2c8e('0x29')]);_0x308253[_0x2c8e('0x3c')]=_[_0x2c8e('0x4e')](_0x480d39[_0x2c8e('0x27')],qs[_0x2c8e('0x3d')](_0x152569[_0x2c8e('0x29')]['fields']));_0x308253[_0x2c8e('0x3c')]=_0x308253[_0x2c8e('0x3c')]['length']?_0x308253[_0x2c8e('0x3c')]:_0x480d39[_0x2c8e('0x27')];if(_0x152569['query'][_0x2c8e('0x49')]){_0x308253[_0x2c8e('0x4f')]=[{'all':!![]}];}_0x308253=_['merge']({},_0x308253,_0x152569[_0x2c8e('0x47')]);return db['CmHopper'][_0x2c8e('0x50')](_0x308253)[_0x2c8e('0x20')](handleEntityNotFound(_0x403198,null))[_0x2c8e('0x20')](respondWithResult(_0x403198,null))[_0x2c8e('0x4b')](handleError(_0x403198,null));};exports[_0x2c8e('0x51')]=function(_0x9c0432,_0x201001){return db[_0x2c8e('0x25')]['create'](_0x9c0432[_0x2c8e('0x52')],{})['then'](respondWithResult(_0x201001,0xc9))['catch'](handleError(_0x201001,null));};exports[_0x2c8e('0x1f')]=function(_0x38ca63,_0x2379ce){if(_0x38ca63[_0x2c8e('0x52')]['id']){delete _0x38ca63[_0x2c8e('0x52')]['id'];}return db[_0x2c8e('0x25')][_0x2c8e('0x50')]({'where':{'id':_0x38ca63['params']['id']}})[_0x2c8e('0x20')](handleEntityNotFound(_0x2379ce,null))[_0x2c8e('0x20')](saveUpdates(_0x38ca63[_0x2c8e('0x52')],null))[_0x2c8e('0x20')](respondWithResult(_0x2379ce,null))[_0x2c8e('0x4b')](handleError(_0x2379ce,null));};exports[_0x2c8e('0x53')]=function(_0x15bf1a,_0x4a50a0){return db[_0x2c8e('0x25')][_0x2c8e('0x53')]()[_0x2c8e('0x20')](respondWithResult(_0x4a50a0,null))[_0x2c8e('0x4b')](handleError(_0x4a50a0,null));};exports[_0x2c8e('0x21')]=function(_0x516007,_0x2be9a4){var _0x434b50;return db[_0x2c8e('0x25')][_0x2c8e('0x50')]({'where':{'id':_0x516007['params']['id']}})['then'](handleEntityNotFound(_0x2be9a4,null))[_0x2c8e('0x20')](function(_0x13429d){if(_0x13429d){return _0x13429d[_0x2c8e('0x21')]()[_0x2c8e('0x20')](function(_0x4b76a1){return _0x4b76a1;});}})[_0x2c8e('0x20')](function(_0x433590){_0x434b50=_0x433590;if(_0x433590){if(_0x433590[_0x2c8e('0x54')]||_0x433590[_0x2c8e('0x55')]){return db[_0x433590[_0x2c8e('0x54')]?'VoiceQueue':_0x2c8e('0x56')][_0x2c8e('0x50')]({'where':{'id':_0x433590[_0x2c8e('0x54')]?_0x433590[_0x2c8e('0x54')]:_0x433590[_0x2c8e('0x55')]},'attributes':['id','name'],'raw':!![]});}}})[_0x2c8e('0x20')](function(_0x51630d){var _0x21148b={};if(_0x51630d){_[_0x2c8e('0x42')](_0x21148b,_['omit'](_0x434b50['dataValues'],[_0x2c8e('0x57'),'updatedAt','id']));_0x21148b[_0x2c8e('0x58')]=0x15;_0x21148b[_0x2c8e('0x59')]='deleted';_0x21148b[_0x2c8e('0x5a')]=_0x51630d[_0x2c8e('0x22')];_0x21148b[_0x2c8e('0x5b')]=_0x516007[_0x2c8e('0x5c')]['name'];_0x21148b[_0x2c8e('0x5d')]=_0x516007['user']['id'];_0x21148b[_0x2c8e('0x5e')]=!![];_0x21148b[_0x2c8e('0x5f')]=moment()[_0x2c8e('0x60')](_0x2c8e('0x61'));_0x21148b[_0x2c8e('0x62')]=_0x434b50[_0x2c8e('0x63')];_0x21148b['campaigntype']=_0x434b50[_0x2c8e('0x54')]?_0x2c8e('0x64'):_0x2c8e('0x65');return db[_0x2c8e('0x66')][_0x2c8e('0x50')]({'where':{'id':_0x21148b[_0x2c8e('0x67')]},'attributes':['firstName',_0x2c8e('0x68')]})[_0x2c8e('0x20')](function(_0x33f071){if(!_[_0x2c8e('0x69')](_0x2be9a4)&&!_[_0x2c8e('0x69')](_0x33f071[_0x2c8e('0x6a')])){_0x21148b[_0x2c8e('0x6b')]=_0x33f071[_0x2c8e('0x6a')];if(!_[_0x2c8e('0x69')](_0x33f071[_0x2c8e('0x68')])){_0x21148b[_0x2c8e('0x6b')]+='\x20'+_0x33f071[_0x2c8e('0x68')];}}})[_0x2c8e('0x6c')](function(){return db[_0x2c8e('0x6d')][_0x2c8e('0x51')](_0x21148b);});}})[_0x2c8e('0x20')](function(){return _0x2be9a4[_0x2c8e('0x18')](0xcc)[_0x2c8e('0x17')]();})[_0x2c8e('0x4b')](handleError(_0x2be9a4,null));};exports['getPreview']=function(_0x7305ce,_0x424f44,_0x146e94){var _0x547c12=[];return db[_0x2c8e('0x66')]['describe']()[_0x2c8e('0x20')](function(_0x14f0d6){_0x547c12=_[_0x2c8e('0x28')](_0x14f0d6);return _0x7305ce['user'][_0x2c8e('0x6e')]({'where':{'type':_0x2c8e('0x6f'),'dialActive':!![],'dialMethod':_0x2c8e('0x70')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x2c8e('0x20')](function(_0x423651){if(_0x423651&&_0x423651[_0x2c8e('0x3e')]){return db[_0x2c8e('0x71')][_0x2c8e('0x72')](function(_0x1e3638){var _0x1c28ac={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x2c8e('0x61'))},'VoiceQueueId':{'$in':_[_0x2c8e('0x43')](_0x423651,'id')},'$or':[{'UserId':null},{'UserId':_0x7305ce[_0x2c8e('0x5c')]['id']}]};var _0x2b0118=[];if(_0x7305ce[_0x2c8e('0x52')][_0x2c8e('0x73')]&&_0x7305ce['body'][_0x2c8e('0x73')]==='prev'){if(!_[_0x2c8e('0x74')](_0x7305ce[_0x2c8e('0x52')][_0x2c8e('0x75')])){_0x1c28ac['id']={'$in':_0x7305ce[_0x2c8e('0x52')][_0x2c8e('0x75')]};}_0x2b0118=[[_0x2c8e('0x76'),_0x2c8e('0x77')],[_0x2c8e('0x78'),_0x423651[0x0][_0x2c8e('0x79')]===_0x2c8e('0x77')?_0x2c8e('0x7a'):_0x2c8e('0x77')],db['sequelize'][_0x2c8e('0x7b')](_0x2c8e('0x7c')),['id','DESC']];}else{if(!_[_0x2c8e('0x74')](_0x7305ce[_0x2c8e('0x52')][_0x2c8e('0x75')])){_0x1c28ac['id']={'$notIn':_0x7305ce[_0x2c8e('0x52')][_0x2c8e('0x75')]};}_0x2b0118=[[_0x2c8e('0x76'),'DESC'],[_0x2c8e('0x78'),_0x423651[0x0][_0x2c8e('0x79')]],db[_0x2c8e('0x71')][_0x2c8e('0x7b')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x2c8e('0x77')]];}return db[_0x2c8e('0x25')][_0x2c8e('0x7d')]({'attributes':['id',_0x2c8e('0x7e')],'where':_0x1c28ac,'order':_0x2b0118,'transaction':_0x1e3638,'lock':_0x1e3638[_0x2c8e('0x7f')]['UPDATE'],'include':[{'model':db[_0x2c8e('0x66')],'as':_0x2c8e('0x80'),'attributes':_0x547c12,'include':[{'model':db[_0x2c8e('0x81')],'as':_0x2c8e('0x82'),'attributes':['id',_0x2c8e('0x22')]}]},{'model':db[_0x2c8e('0x83')],'as':_0x2c8e('0x84'),'attributes':['id',_0x2c8e('0x22')]},{'model':db['VoiceQueue'],'as':_0x2c8e('0x85'),'attributes':['id',_0x2c8e('0x22'),_0x2c8e('0x86')]}]})[_0x2c8e('0x20')](function(_0x3a4b26){if(_0x3a4b26){return _0x3a4b26[_0x2c8e('0x1f')]({'UserId':_0x7305ce[_0x2c8e('0x5c')]['id']},{'transaction':_0x1e3638});}});});}})[_0x2c8e('0x20')](handleEntityNotFound(_0x424f44,null))[_0x2c8e('0x20')](respondWithResult(_0x424f44,null))[_0x2c8e('0x4b')](handleError(_0x424f44,null));};exports['getOpenContacts']=function(_0x12e8ef,_0x4d9ade,_0x111f5b){return _0x12e8ef[_0x2c8e('0x5c')]['getVoiceQueues']({'where':{'type':_0x2c8e('0x6f'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x2c8e('0x20')](function(_0x34b2e9){if(_0x34b2e9&&_0x34b2e9[_0x2c8e('0x3e')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2c8e('0x60')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x2c8e('0x43')](_0x34b2e9,'id')},'$or':[{'UserId':null},{'UserId':_0x12e8ef[_0x2c8e('0x5c')]['id']}]}});}return 0x0;})[_0x2c8e('0x20')](function(_0x5193a1){if(!_[_0x2c8e('0x69')](_0x5193a1)&&_[_0x2c8e('0x87')](_0x5193a1)){return _0x4d9ade[_0x2c8e('0x18')](0xc8)[_0x2c8e('0x19')]({'contacts':_0x5193a1});}else{logger[_0x2c8e('0x88')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x2c8e('0x89'),0x194,_0x2c8e('0x8a'));_0x4d9ade[_0x2c8e('0x16')](0x194);}})[_0x2c8e('0x4b')](handleError(_0x4d9ade,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 07d6861..44e126b 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 _0x173b=['util','../../config/logger','api','moment','bluebird','request-promise','exports','CmHopper','cm_hopper','scheduledat','priority','lodash'];(function(_0x42f568,_0x1650f1){var _0x49046b=function(_0x682fff){while(--_0x682fff){_0x42f568['push'](_0x42f568['shift']());}};_0x49046b(++_0x1650f1);}(_0x173b,0x107));var _0xb173=function(_0x229c74,_0x3de5a0){_0x229c74=_0x229c74-0x0;var _0x3cb9e0=_0x173b[_0x229c74];return _0x3cb9e0;};'use strict';var _=require(_0xb173('0x0'));var util=require(_0xb173('0x1'));var logger=require(_0xb173('0x2'))(_0xb173('0x3'));var moment=require(_0xb173('0x4'));var BPromise=require(_0xb173('0x5'));var rp=require(_0xb173('0x6'));var attributes=require('./cmHopper.attributes');module[_0xb173('0x7')]=function(_0x36bf19,_0x1934db){return _0x36bf19['define'](_0xb173('0x8'),attributes,{'tableName':_0xb173('0x9'),'paranoid':![],'indexes':[{'name':_0xb173('0xa'),'fields':[_0xb173('0xa')]},{'name':'phone','fields':['phone']},{'name':'priority','fields':[_0xb173('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5542=['./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone','priority','lodash','api','moment','bluebird','request-promise'];(function(_0x411090,_0x294774){var _0x3608f2=function(_0x807123){while(--_0x807123){_0x411090['push'](_0x411090['shift']());}};_0x3608f2(++_0x294774);}(_0x5542,0x1b7));var _0x2554=function(_0x1af71a,_0x1d18ee){_0x1af71a=_0x1af71a-0x0;var _0x3acd6a=_0x5542[_0x1af71a];return _0x3acd6a;};'use strict';var _=require(_0x2554('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2554('0x1'));var moment=require(_0x2554('0x2'));var BPromise=require(_0x2554('0x3'));var rp=require(_0x2554('0x4'));var attributes=require(_0x2554('0x5'));module[_0x2554('0x6')]=function(_0x8ead41,_0x37f07e){return _0x8ead41[_0x2554('0x7')]('CmHopper',attributes,{'tableName':_0x2554('0x8'),'paranoid':![],'indexes':[{'name':_0x2554('0x9'),'fields':[_0x2554('0x9')]},{'name':_0x2554('0xa'),'fields':[_0x2554('0xa')]},{'name':_0x2554('0xb'),'fields':[_0x2554('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 2ccd28d..b0f4720 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 _0x74f3=['debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopper','CmHopper','options','limit','include','map','model','stringify','ShowCmHopper','raw','where','attributes','CreateCmHopper','create','UpdateCmHopper','update','body','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','findAll','order','Contact','length','push','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','LOCK','UPDATE','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent'];(function(_0x33983d,_0x3976bb){var _0x3a855c=function(_0x13f5a3){while(--_0x13f5a3){_0x33983d['push'](_0x33983d['shift']());}};_0x3a855c(++_0x3976bb);}(_0x74f3,0x1e9));var _0x374f=function(_0x2f9db8,_0x18b2ab){_0x2f9db8=_0x2f9db8-0x0;var _0xed18c1=_0x74f3[_0x2f9db8];return _0xed18c1;};'use strict';var _=require(_0x374f('0x0'));var util=require(_0x374f('0x1'));var moment=require(_0x374f('0x2'));var BPromise=require('bluebird');var rs=require(_0x374f('0x3'));var fs=require('fs');var Redis=require(_0x374f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x374f('0x5'));var logger=require(_0x374f('0x6'))(_0x374f('0x7'));var config=require('../../config/environment');var jayson=require(_0x374f('0x8'));var client=jayson[_0x374f('0x9')][_0x374f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cb61c,_0x345634,_0x5534d2){return new BPromise(function(_0x204644,_0x5cb1cf){return client['request'](_0x4cb61c,_0x5534d2)[_0x374f('0xb')](function(_0x2eec6a){logger[_0x374f('0xc')](_0x374f('0xd'),_0x345634,_0x374f('0xe'));logger[_0x374f('0xf')](_0x374f('0x10'),_0x345634,_0x374f('0xe'),JSON['stringify'](_0x2eec6a));if(_0x2eec6a[_0x374f('0x11')]){if(_0x2eec6a[_0x374f('0x11')][_0x374f('0x12')]===0x1f4){logger[_0x374f('0x11')](_0x374f('0xd'),_0x345634,_0x2eec6a['error'][_0x374f('0x13')]);return _0x5cb1cf(_0x2eec6a[_0x374f('0x11')][_0x374f('0x13')]);}logger['error'](_0x374f('0xd'),_0x345634,_0x2eec6a[_0x374f('0x11')][_0x374f('0x13')]);return _0x204644(_0x2eec6a['error']['message']);}else{logger[_0x374f('0xc')](_0x374f('0xd'),_0x345634,_0x374f('0xe'));_0x204644(_0x2eec6a[_0x374f('0x14')]['message']);}})[_0x374f('0x15')](function(_0x482bdf){logger[_0x374f('0x11')](_0x374f('0xd'),_0x345634,_0x482bdf);_0x5cb1cf(_0x482bdf);});});}exports[_0x374f('0x16')]=function(_0x1f29eb){var _0x56fad0=this;return new Promise(function(_0x233c87,_0x2a7eb5){return db[_0x374f('0x17')]['findAll']({'raw':_0x1f29eb[_0x374f('0x18')]?_0x1f29eb[_0x374f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1f29eb[_0x374f('0x18')]?_0x1f29eb[_0x374f('0x18')]['where']||null:null,'attributes':_0x1f29eb[_0x374f('0x18')]?_0x1f29eb[_0x374f('0x18')]['attributes']||null:null,'limit':_0x1f29eb[_0x374f('0x18')]?_0x1f29eb[_0x374f('0x18')][_0x374f('0x19')]||null:null,'include':_0x1f29eb[_0x374f('0x18')]?_0x1f29eb[_0x374f('0x18')][_0x374f('0x1a')]?_[_0x374f('0x1b')](_0x1f29eb[_0x374f('0x18')][_0x374f('0x1a')],function(_0x19d645){return{'model':db[_0x19d645['model']],'as':_0x19d645['as'],'attributes':_0x19d645['attributes'],'include':_0x19d645[_0x374f('0x1a')]?_['map'](_0x19d645[_0x374f('0x1a')],function(_0x24aa7a){return{'model':db[_0x24aa7a[_0x374f('0x1c')]],'as':_0x24aa7a['as'],'attributes':_0x24aa7a['attributes'],'include':_0x24aa7a[_0x374f('0x1a')]?_[_0x374f('0x1b')](_0x24aa7a[_0x374f('0x1a')],function(_0x543412){return{'model':db[_0x543412['model']],'as':_0x543412['as'],'attributes':_0x543412['attributes']};}):[]};}):[]};}):[]:[]})[_0x374f('0xb')](function(_0x5a3782){logger[_0x374f('0xc')](_0x374f('0x16'),_0x1f29eb);logger['debug']('GetCmHopper',_0x1f29eb,JSON[_0x374f('0x1d')](_0x5a3782));_0x233c87(_0x5a3782);})[_0x374f('0x15')](function(_0x24d290){logger[_0x374f('0x11')](_0x374f('0x16'),_0x24d290[_0x374f('0x13')],_0x1f29eb);_0x2a7eb5(_0x56fad0['error'](0x1f4,_0x24d290['message']));});});};exports[_0x374f('0x1e')]=function(_0x54402b){var _0x2f2a0e=this;return new Promise(function(_0x1f3c28,_0x2c1f9d){return db[_0x374f('0x17')]['find']({'raw':_0x54402b[_0x374f('0x18')]?_0x54402b['options'][_0x374f('0x1f')]===undefined?!![]:![]:!![],'where':_0x54402b[_0x374f('0x18')]?_0x54402b['options'][_0x374f('0x20')]||null:null,'attributes':_0x54402b['options']?_0x54402b[_0x374f('0x18')][_0x374f('0x21')]||null:null,'include':_0x54402b['options']?_0x54402b['options'][_0x374f('0x1a')]?_['map'](_0x54402b[_0x374f('0x18')][_0x374f('0x1a')],function(_0x426e){return{'model':db[_0x426e[_0x374f('0x1c')]],'as':_0x426e['as'],'attributes':_0x426e[_0x374f('0x21')],'include':_0x426e[_0x374f('0x1a')]?_[_0x374f('0x1b')](_0x426e[_0x374f('0x1a')],function(_0x41d6ce){return{'model':db[_0x41d6ce[_0x374f('0x1c')]],'as':_0x41d6ce['as'],'attributes':_0x41d6ce[_0x374f('0x21')],'include':_0x41d6ce[_0x374f('0x1a')]?_[_0x374f('0x1b')](_0x41d6ce[_0x374f('0x1a')],function(_0x554475){return{'model':db[_0x554475[_0x374f('0x1c')]],'as':_0x554475['as'],'attributes':_0x554475['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e3096){logger['info'](_0x374f('0x1e'),_0x54402b);logger[_0x374f('0xf')](_0x374f('0x1e'),_0x54402b,JSON[_0x374f('0x1d')](_0x4e3096));_0x1f3c28(_0x4e3096);})['catch'](function(_0x634c13){logger[_0x374f('0x11')](_0x374f('0x1e'),_0x634c13[_0x374f('0x13')],_0x54402b);_0x2c1f9d(_0x2f2a0e[_0x374f('0x11')](0x1f4,_0x634c13[_0x374f('0x13')]));});});};exports[_0x374f('0x22')]=function(_0x44d069){var _0x3ceaa6=this;return new Promise(function(_0x3de551,_0x3fd603){return db[_0x374f('0x17')][_0x374f('0x23')](_0x44d069['body'],{'raw':_0x44d069['options']?_0x44d069[_0x374f('0x18')][_0x374f('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x12b65f){logger['info'](_0x374f('0x22'),_0x44d069);logger['debug']('CreateCmHopper',_0x44d069,JSON[_0x374f('0x1d')](_0x12b65f));_0x3de551(_0x12b65f);})['catch'](function(_0x3e50ff){logger[_0x374f('0x11')]('CreateCmHopper',_0x3e50ff[_0x374f('0x13')],_0x44d069);_0x3fd603(_0x3ceaa6[_0x374f('0x11')](0x1f4,_0x3e50ff[_0x374f('0x13')]));});});};exports[_0x374f('0x24')]=function(_0x57347a){var _0x4da470=this;return new Promise(function(_0x43b468,_0x2334cf){return db[_0x374f('0x17')][_0x374f('0x25')](_0x57347a[_0x374f('0x26')],{'raw':_0x57347a['options']?_0x57347a[_0x374f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57347a[_0x374f('0x18')]?_0x57347a[_0x374f('0x18')][_0x374f('0x20')]||null:null,'attributes':_0x57347a['options']?_0x57347a[_0x374f('0x18')][_0x374f('0x21')]||null:null,'limit':_0x57347a[_0x374f('0x18')]?_0x57347a['options']['limit']||null:null})[_0x374f('0xb')](function(_0x2e4285){logger['info'](_0x374f('0x24'),_0x57347a);logger[_0x374f('0xf')](_0x374f('0x24'),_0x57347a,JSON['stringify'](_0x2e4285));_0x43b468(_0x2e4285);})[_0x374f('0x15')](function(_0x16c8b1){logger[_0x374f('0x11')]('UpdateCmHopper',_0x16c8b1['message'],_0x57347a);_0x2334cf(_0x4da470['error'](0x1f4,_0x16c8b1[_0x374f('0x13')]));});});};exports[_0x374f('0x27')]=function(_0x4623c4){var _0x55aa64=this;return new Promise(function(_0x41736f,_0x545085){return db[_0x374f('0x17')][_0x374f('0x28')]({'where':_0x4623c4[_0x374f('0x18')]?_0x4623c4[_0x374f('0x18')][_0x374f('0x20')]||null:null})['then'](function(_0x3d8bc4){logger[_0x374f('0xc')](_0x374f('0x27'),_0x4623c4);logger[_0x374f('0xf')](_0x374f('0x27'),_0x4623c4,JSON['stringify'](_0x3d8bc4));_0x41736f(_0x3d8bc4);})[_0x374f('0x15')](function(_0x3d8ce7){logger[_0x374f('0x11')](_0x374f('0x27'),_0x3d8ce7[_0x374f('0x13')],_0x4623c4);_0x545085(_0x55aa64[_0x374f('0x11')](0x1f4,_0x3d8ce7[_0x374f('0x13')]));});});};exports[_0x374f('0x29')]=function(_0x4cab15){var _0x1a953f=this;return new Promise(function(_0x767ee1,_0x45ba5c){return db[_0x374f('0x2a')]['describe']()[_0x374f('0xb')](function(_0x579402){return db[_0x374f('0x2b')][_0x374f('0x2c')](function(_0x469e17){return db['CmHopper'][_0x374f('0x2d')]({'where':_0x4cab15[_0x374f('0x18')]?_0x4cab15[_0x374f('0x18')][_0x374f('0x20')]||null:null,'attributes':_0x4cab15[_0x374f('0x18')]?_0x4cab15[_0x374f('0x18')][_0x374f('0x21')]||null:null,'limit':_0x4cab15['options']?_0x4cab15[_0x374f('0x18')][_0x374f('0x19')]||null:null,'order':_0x4cab15[_0x374f('0x18')]?_0x4cab15[_0x374f('0x18')][_0x374f('0x2e')]||null:null,'transaction':_0x469e17,'lock':_0x469e17['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x374f('0x2f'),'attributes':_['keys'](_0x579402)}]})[_0x374f('0xb')](function(_0x3c3bba){var _0x2247a2=[];for(var _0x3366cc=0x0;_0x3366cc<_0x3c3bba[_0x374f('0x30')];_0x3366cc+=0x1){_0x2247a2[_0x374f('0x31')](_0x3c3bba[_0x3366cc][_0x374f('0x25')](_0x4cab15[_0x374f('0x26')],{'transaction':_0x469e17}));}return BPromise[_0x374f('0x32')](_0x2247a2);});})[_0x374f('0xb')](function(_0x305c15){logger[_0x374f('0xc')](_0x374f('0x29'),_0x4cab15);logger['debug'](_0x374f('0x29'),_0x4cab15,JSON[_0x374f('0x1d')](_0x305c15));_0x767ee1(_0x305c15);})['catch'](function(_0x1aea45){logger[_0x374f('0x11')]('GetContactDialer',_0x1aea45[_0x374f('0x13')],_0x4cab15);_0x45ba5c(_0x1a953f['error'](0x1f4,_0x1aea45[_0x374f('0x13')]));});});});};exports[_0x374f('0x33')]=function(_0x6b4b5){var _0x597ccc=this;return new Promise(function(_0x306042,_0x281930){return db[_0x374f('0x2b')]['transaction'](function(_0x51d475){return db[_0x374f('0x34')][_0x374f('0x23')](_0x6b4b5[_0x374f('0x26')],{'raw':_0x6b4b5[_0x374f('0x18')]?_0x6b4b5[_0x374f('0x18')][_0x374f('0x1f')]===undefined?!![]:![]:!![],'transaction':_0x51d475})[_0x374f('0xb')](function(){return db[_0x374f('0x17')][_0x374f('0x28')]({'where':_0x6b4b5[_0x374f('0x18')]?_0x6b4b5[_0x374f('0x18')]['where']||null:null,'transaction':_0x51d475});});})['then'](function(_0x385c84){logger['info'](_0x374f('0x33'),_0x6b4b5);logger[_0x374f('0xf')](_0x374f('0x33'),_0x6b4b5,JSON[_0x374f('0x1d')](_0x385c84));_0x306042(_0x385c84);})['catch'](function(_0x8d47){logger[_0x374f('0x11')](_0x374f('0x33'),_0x8d47[_0x374f('0x13')],_0x6b4b5);_0x281930(_0x597ccc[_0x374f('0x11')](0x1f4,_0x8d47[_0x374f('0x13')]));});});};exports[_0x374f('0x35')]=function(_0x344d22){var _0x5487bf=this;return new Promise(function(_0x46e3cb,_0x1c410b){return db['CmHopper'][_0x374f('0x2d')]({'raw':_0x344d22['options']?_0x344d22[_0x374f('0x18')][_0x374f('0x1f')]===undefined?!![]:![]:!![],'where':_0x344d22[_0x374f('0x18')]?_0x344d22[_0x374f('0x18')][_0x374f('0x20')]||null:null,'attributes':[[db[_0x374f('0x2b')]['fn'](_0x374f('0x36'),db[_0x374f('0x2b')]['fn']('IF',db[_0x374f('0x2b')]['literal'](_0x374f('0x37')+util['format'](_0x374f('0x38'),moment()[_0x374f('0x39')](_0x374f('0x3a')))+'\x20,\x201,\x20null'))),_0x374f('0x3b')]]})[_0x374f('0xb')](function(_0x27f68c){logger[_0x374f('0xc')]('CountReScheduled',_0x344d22);logger['debug']('CountReScheduled',_0x344d22,JSON[_0x374f('0x1d')](_0x27f68c));_0x46e3cb(_0x27f68c);})[_0x374f('0x15')](function(_0xa7b0af){logger['error'](_0x374f('0x35'),_0xa7b0af['message'],_0x344d22);_0x1c410b(_0x5487bf[_0x374f('0x11')](0x1f4,_0xa7b0af[_0x374f('0x13')]));});});};exports[_0x374f('0x3c')]=function(_0x7ff508){var _0xd4ee80=this;return new Promise(function(_0x3600c1,_0x2a4643){return db[_0x374f('0x2a')]['describe']()['then'](function(_0x217ba5){return db[_0x374f('0x2b')][_0x374f('0x2c')](function(_0x4892be){return db['CmHopper'][_0x374f('0x2d')]({'where':_0x7ff508[_0x374f('0x18')]?_0x7ff508['options'][_0x374f('0x20')]||null:null,'attributes':_0x7ff508['options']?_0x7ff508[_0x374f('0x18')][_0x374f('0x21')]||null:null,'limit':0x1,'order':_0x7ff508[_0x374f('0x18')]?_0x7ff508[_0x374f('0x18')][_0x374f('0x2e')]||null:null,'group':db[_0x374f('0x17')]['UserId'],'transaction':_0x4892be,'lock':_0x4892be[_0x374f('0x3d')][_0x374f('0x3e')],'include':_0x7ff508['options']?_0x7ff508[_0x374f('0x18')]['include']?_['map'](_0x7ff508[_0x374f('0x18')]['include'],function(_0x31deba){return{'model':db[_0x31deba[_0x374f('0x1c')]],'as':_0x31deba['as'],'attributes':_0x31deba[_0x374f('0x21')],'include':_0x31deba[_0x374f('0x1a')]?_['map'](_0x31deba[_0x374f('0x1a')],function(_0x9fc4a){return{'model':db[_0x9fc4a[_0x374f('0x1c')]],'as':_0x9fc4a['as'],'attributes':_0x9fc4a[_0x374f('0x21')],'include':_0x9fc4a['include']?_[_0x374f('0x1b')](_0x9fc4a[_0x374f('0x1a')],function(_0x257596){return{'model':db[_0x257596[_0x374f('0x1c')]],'as':_0x257596['as'],'attributes':_0x257596['attributes']};}):[]};}):[]};}):[]:[]})[_0x374f('0xb')](function(_0x30f701){var _0x517bf9=[];for(var _0x3e0b89=0x0;_0x3e0b89<_0x30f701[_0x374f('0x30')];_0x3e0b89+=0x1){_0x517bf9[_0x374f('0x31')](_0x30f701[_0x3e0b89][_0x374f('0x25')](_0x7ff508[_0x374f('0x26')],{'transaction':_0x4892be}));}return BPromise[_0x374f('0x32')](_0x517bf9);});})[_0x374f('0xb')](function(_0x5aefd0){logger[_0x374f('0xc')](_0x374f('0x3c'),_0x7ff508);logger[_0x374f('0xf')](_0x374f('0x3c'),_0x7ff508,JSON['stringify'](_0x5aefd0));_0x3600c1(_0x5aefd0);})[_0x374f('0x15')](function(_0x16f40c){logger['error'](_0x374f('0x3c'),_0x16f40c[_0x374f('0x13')],_0x7ff508);_0x2a4643(_0xd4ee80[_0x374f('0x11')](0x1f4,_0x16f40c['message']));});});});}; \ No newline at end of file +var _0x105d=['destroy','MoveContactManagedDialer','CountReScheduled','findAll','COUNT','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','UserId','UPDATE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request\x20sent','debug','stringify','code','error','CmHopper,\x20%s,\x20%s','message','info','result','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','map','model','catch','ShowCmHopper','find','then','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','CmContact','describe','sequelize','transaction','LOCK','Contact','keys','length','push','all','GetContactDialer','CmHopperFinal'];(function(_0x798ed8,_0x57b66a){var _0x18cbda=function(_0x5b0309){while(--_0x5b0309){_0x798ed8['push'](_0x798ed8['shift']());}};_0x18cbda(++_0x57b66a);}(_0x105d,0x96));var _0xd105=function(_0x239e4f,_0x4dc70e){_0x239e4f=_0x239e4f-0x0;var _0xd7a42a=_0x105d[_0x239e4f];return _0xd7a42a;};'use strict';var _=require(_0xd105('0x0'));var util=require(_0xd105('0x1'));var moment=require(_0xd105('0x2'));var BPromise=require(_0xd105('0x3'));var rs=require(_0xd105('0x4'));var fs=require('fs');var Redis=require(_0xd105('0x5'));var db=require(_0xd105('0x6'))['db'];var utils=require(_0xd105('0x7'));var logger=require(_0xd105('0x8'))('rpc');var config=require(_0xd105('0x9'));var jayson=require(_0xd105('0xa'));var client=jayson[_0xd105('0xb')][_0xd105('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x159ad5,_0x17dddb,_0x1b30e2){return new BPromise(function(_0x56dc8a,_0xe782d6){return client['request'](_0x159ad5,_0x1b30e2)['then'](function(_0x6818be){logger['info']('CmHopper,\x20%s,\x20%s',_0x17dddb,_0xd105('0xd'));logger[_0xd105('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x17dddb,_0xd105('0xd'),JSON[_0xd105('0xf')](_0x6818be));if(_0x6818be['error']){if(_0x6818be['error'][_0xd105('0x10')]===0x1f4){logger[_0xd105('0x11')](_0xd105('0x12'),_0x17dddb,_0x6818be[_0xd105('0x11')]['message']);return _0xe782d6(_0x6818be[_0xd105('0x11')][_0xd105('0x13')]);}logger[_0xd105('0x11')](_0xd105('0x12'),_0x17dddb,_0x6818be[_0xd105('0x11')][_0xd105('0x13')]);return _0x56dc8a(_0x6818be[_0xd105('0x11')]['message']);}else{logger[_0xd105('0x14')]('CmHopper,\x20%s,\x20%s',_0x17dddb,_0xd105('0xd'));_0x56dc8a(_0x6818be[_0xd105('0x15')][_0xd105('0x13')]);}})['catch'](function(_0x5e7d67){logger['error']('CmHopper,\x20%s,\x20%s',_0x17dddb,_0x5e7d67);_0xe782d6(_0x5e7d67);});});}exports[_0xd105('0x16')]=function(_0x3ba144){var _0x487f95=this;return new Promise(function(_0x280798,_0x499e7e){return db[_0xd105('0x17')]['findAll']({'raw':_0x3ba144[_0xd105('0x18')]?_0x3ba144['options'][_0xd105('0x19')]===undefined?!![]:![]:!![],'where':_0x3ba144[_0xd105('0x18')]?_0x3ba144[_0xd105('0x18')][_0xd105('0x1a')]||null:null,'attributes':_0x3ba144['options']?_0x3ba144[_0xd105('0x18')][_0xd105('0x1b')]||null:null,'limit':_0x3ba144['options']?_0x3ba144[_0xd105('0x18')][_0xd105('0x1c')]||null:null,'include':_0x3ba144['options']?_0x3ba144[_0xd105('0x18')][_0xd105('0x1d')]?_[_0xd105('0x1e')](_0x3ba144[_0xd105('0x18')][_0xd105('0x1d')],function(_0xb3b653){return{'model':db[_0xb3b653['model']],'as':_0xb3b653['as'],'attributes':_0xb3b653[_0xd105('0x1b')],'include':_0xb3b653['include']?_[_0xd105('0x1e')](_0xb3b653[_0xd105('0x1d')],function(_0x3047dd){return{'model':db[_0x3047dd[_0xd105('0x1f')]],'as':_0x3047dd['as'],'attributes':_0x3047dd['attributes'],'include':_0x3047dd[_0xd105('0x1d')]?_[_0xd105('0x1e')](_0x3047dd['include'],function(_0x2af4f2){return{'model':db[_0x2af4f2['model']],'as':_0x2af4f2['as'],'attributes':_0x2af4f2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e9283){logger[_0xd105('0x14')]('GetCmHopper',_0x3ba144);logger[_0xd105('0xe')](_0xd105('0x16'),_0x3ba144,JSON[_0xd105('0xf')](_0x1e9283));_0x280798(_0x1e9283);})[_0xd105('0x20')](function(_0x2bf38a){logger[_0xd105('0x11')](_0xd105('0x16'),_0x2bf38a[_0xd105('0x13')],_0x3ba144);_0x499e7e(_0x487f95[_0xd105('0x11')](0x1f4,_0x2bf38a['message']));});});};exports[_0xd105('0x21')]=function(_0x124bb4){var _0x12f296=this;return new Promise(function(_0x578c8f,_0x5c4524){return db[_0xd105('0x17')][_0xd105('0x22')]({'raw':_0x124bb4[_0xd105('0x18')]?_0x124bb4[_0xd105('0x18')][_0xd105('0x19')]===undefined?!![]:![]:!![],'where':_0x124bb4[_0xd105('0x18')]?_0x124bb4['options'][_0xd105('0x1a')]||null:null,'attributes':_0x124bb4[_0xd105('0x18')]?_0x124bb4[_0xd105('0x18')]['attributes']||null:null,'include':_0x124bb4[_0xd105('0x18')]?_0x124bb4['options'][_0xd105('0x1d')]?_[_0xd105('0x1e')](_0x124bb4[_0xd105('0x18')][_0xd105('0x1d')],function(_0x12991b){return{'model':db[_0x12991b[_0xd105('0x1f')]],'as':_0x12991b['as'],'attributes':_0x12991b[_0xd105('0x1b')],'include':_0x12991b['include']?_[_0xd105('0x1e')](_0x12991b[_0xd105('0x1d')],function(_0x431d8a){return{'model':db[_0x431d8a[_0xd105('0x1f')]],'as':_0x431d8a['as'],'attributes':_0x431d8a['attributes'],'include':_0x431d8a['include']?_[_0xd105('0x1e')](_0x431d8a[_0xd105('0x1d')],function(_0x4ab677){return{'model':db[_0x4ab677['model']],'as':_0x4ab677['as'],'attributes':_0x4ab677[_0xd105('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd105('0x23')](function(_0x4dd7a9){logger[_0xd105('0x14')]('ShowCmHopper',_0x124bb4);logger[_0xd105('0xe')](_0xd105('0x21'),_0x124bb4,JSON[_0xd105('0xf')](_0x4dd7a9));_0x578c8f(_0x4dd7a9);})[_0xd105('0x20')](function(_0x198faa){logger[_0xd105('0x11')](_0xd105('0x21'),_0x198faa[_0xd105('0x13')],_0x124bb4);_0x5c4524(_0x12f296['error'](0x1f4,_0x198faa[_0xd105('0x13')]));});});};exports[_0xd105('0x24')]=function(_0x4fa827){var _0xcb97e8=this;return new Promise(function(_0x1796f0,_0x4e1787){return db[_0xd105('0x17')][_0xd105('0x25')](_0x4fa827[_0xd105('0x26')],{'raw':_0x4fa827['options']?_0x4fa827[_0xd105('0x18')][_0xd105('0x19')]===undefined?!![]:![]:!![]})[_0xd105('0x23')](function(_0x1a8f23){logger['info'](_0xd105('0x24'),_0x4fa827);logger[_0xd105('0xe')](_0xd105('0x24'),_0x4fa827,JSON['stringify'](_0x1a8f23));_0x1796f0(_0x1a8f23);})[_0xd105('0x20')](function(_0x2a80c5){logger[_0xd105('0x11')](_0xd105('0x24'),_0x2a80c5[_0xd105('0x13')],_0x4fa827);_0x4e1787(_0xcb97e8[_0xd105('0x11')](0x1f4,_0x2a80c5[_0xd105('0x13')]));});});};exports[_0xd105('0x27')]=function(_0x1e7b07){var _0x496186=this;return new Promise(function(_0x484e1f,_0x126482){return db[_0xd105('0x17')][_0xd105('0x28')](_0x1e7b07[_0xd105('0x26')],{'raw':_0x1e7b07[_0xd105('0x18')]?_0x1e7b07['options'][_0xd105('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e7b07[_0xd105('0x18')]?_0x1e7b07[_0xd105('0x18')][_0xd105('0x1a')]||null:null,'attributes':_0x1e7b07['options']?_0x1e7b07['options'][_0xd105('0x1b')]||null:null,'limit':_0x1e7b07[_0xd105('0x18')]?_0x1e7b07[_0xd105('0x18')][_0xd105('0x1c')]||null:null})['then'](function(_0x4cccca){logger[_0xd105('0x14')](_0xd105('0x27'),_0x1e7b07);logger[_0xd105('0xe')]('UpdateCmHopper',_0x1e7b07,JSON['stringify'](_0x4cccca));_0x484e1f(_0x4cccca);})[_0xd105('0x20')](function(_0x3a4c1c){logger['error'](_0xd105('0x27'),_0x3a4c1c['message'],_0x1e7b07);_0x126482(_0x496186[_0xd105('0x11')](0x1f4,_0x3a4c1c['message']));});});};exports[_0xd105('0x29')]=function(_0x595418){var _0x38e025=this;return new Promise(function(_0x1f62aa,_0x1f2dbd){return db[_0xd105('0x17')]['destroy']({'where':_0x595418[_0xd105('0x18')]?_0x595418[_0xd105('0x18')]['where']||null:null})['then'](function(_0x675abf){logger['info']('DestroyCmHopper',_0x595418);logger[_0xd105('0xe')](_0xd105('0x29'),_0x595418,JSON['stringify'](_0x675abf));_0x1f62aa(_0x675abf);})[_0xd105('0x20')](function(_0x492e87){logger['error'](_0xd105('0x29'),_0x492e87['message'],_0x595418);_0x1f2dbd(_0x38e025[_0xd105('0x11')](0x1f4,_0x492e87['message']));});});};exports['GetContactDialer']=function(_0x25636a){var _0xc56a3c=this;return new Promise(function(_0x4bdc2c,_0x20a8a6){return db[_0xd105('0x2a')][_0xd105('0x2b')]()[_0xd105('0x23')](function(_0x587376){return db[_0xd105('0x2c')][_0xd105('0x2d')](function(_0x130fa2){return db[_0xd105('0x17')]['findAll']({'where':_0x25636a[_0xd105('0x18')]?_0x25636a[_0xd105('0x18')][_0xd105('0x1a')]||null:null,'attributes':_0x25636a[_0xd105('0x18')]?_0x25636a[_0xd105('0x18')][_0xd105('0x1b')]||null:null,'limit':_0x25636a[_0xd105('0x18')]?_0x25636a[_0xd105('0x18')][_0xd105('0x1c')]||null:null,'order':_0x25636a[_0xd105('0x18')]?_0x25636a['options']['order']||null:null,'transaction':_0x130fa2,'lock':_0x130fa2[_0xd105('0x2e')]['UPDATE'],'include':[{'model':db[_0xd105('0x2a')],'as':_0xd105('0x2f'),'attributes':_[_0xd105('0x30')](_0x587376)}]})[_0xd105('0x23')](function(_0x399c40){var _0x53b955=[];for(var _0x46f071=0x0;_0x46f071<_0x399c40[_0xd105('0x31')];_0x46f071+=0x1){_0x53b955[_0xd105('0x32')](_0x399c40[_0x46f071][_0xd105('0x28')](_0x25636a[_0xd105('0x26')],{'transaction':_0x130fa2}));}return BPromise[_0xd105('0x33')](_0x53b955);});})[_0xd105('0x23')](function(_0x59f8e3){logger[_0xd105('0x14')](_0xd105('0x34'),_0x25636a);logger[_0xd105('0xe')](_0xd105('0x34'),_0x25636a,JSON[_0xd105('0xf')](_0x59f8e3));_0x4bdc2c(_0x59f8e3);})[_0xd105('0x20')](function(_0x4a7ba6){logger[_0xd105('0x11')](_0xd105('0x34'),_0x4a7ba6[_0xd105('0x13')],_0x25636a);_0x20a8a6(_0xc56a3c[_0xd105('0x11')](0x1f4,_0x4a7ba6[_0xd105('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x5ac86d){var _0x1affc9=this;return new Promise(function(_0x3f48c7,_0xf2ac43){return db['sequelize']['transaction'](function(_0x1c40ce){return db[_0xd105('0x35')]['create'](_0x5ac86d[_0xd105('0x26')],{'raw':_0x5ac86d['options']?_0x5ac86d[_0xd105('0x18')]['raw']===undefined?!![]:![]:!![],'transaction':_0x1c40ce})[_0xd105('0x23')](function(){return db[_0xd105('0x17')][_0xd105('0x36')]({'where':_0x5ac86d[_0xd105('0x18')]?_0x5ac86d[_0xd105('0x18')][_0xd105('0x1a')]||null:null,'transaction':_0x1c40ce});});})[_0xd105('0x23')](function(_0x111a47){logger[_0xd105('0x14')]('MoveContactManagedDialer',_0x5ac86d);logger[_0xd105('0xe')](_0xd105('0x37'),_0x5ac86d,JSON[_0xd105('0xf')](_0x111a47));_0x3f48c7(_0x111a47);})['catch'](function(_0x1f7fef){logger[_0xd105('0x11')]('MoveContactManagedDialer',_0x1f7fef[_0xd105('0x13')],_0x5ac86d);_0xf2ac43(_0x1affc9['error'](0x1f4,_0x1f7fef[_0xd105('0x13')]));});});};exports[_0xd105('0x38')]=function(_0x1d4e92){var _0x4c29d5=this;return new Promise(function(_0x4bdd80,_0x20fffd){return db[_0xd105('0x17')][_0xd105('0x39')]({'raw':_0x1d4e92[_0xd105('0x18')]?_0x1d4e92[_0xd105('0x18')][_0xd105('0x19')]===undefined?!![]:![]:!![],'where':_0x1d4e92['options']?_0x1d4e92['options'][_0xd105('0x1a')]||null:null,'attributes':[[db[_0xd105('0x2c')]['fn'](_0xd105('0x3a'),db['sequelize']['fn']('IF',db[_0xd105('0x2c')]['literal'](_0xd105('0x3b')+util['format'](_0xd105('0x3c'),moment()['format'](_0xd105('0x3d')))+_0xd105('0x3e')))),_0xd105('0x3f')]]})[_0xd105('0x23')](function(_0x2d33e3){logger[_0xd105('0x14')](_0xd105('0x38'),_0x1d4e92);logger['debug'](_0xd105('0x38'),_0x1d4e92,JSON[_0xd105('0xf')](_0x2d33e3));_0x4bdd80(_0x2d33e3);})['catch'](function(_0x2e1a9b){logger[_0xd105('0x11')](_0xd105('0x38'),_0x2e1a9b[_0xd105('0x13')],_0x1d4e92);_0x20fffd(_0x4c29d5[_0xd105('0x11')](0x1f4,_0x2e1a9b[_0xd105('0x13')]));});});};exports[_0xd105('0x40')]=function(_0x352f0a){var _0x2ffa06=this;return new Promise(function(_0x58ac5d,_0x28db28){return db[_0xd105('0x2a')][_0xd105('0x2b')]()[_0xd105('0x23')](function(_0x224fe1){return db[_0xd105('0x2c')][_0xd105('0x2d')](function(_0x40d3a0){return db[_0xd105('0x17')][_0xd105('0x39')]({'where':_0x352f0a['options']?_0x352f0a[_0xd105('0x18')][_0xd105('0x1a')]||null:null,'attributes':_0x352f0a['options']?_0x352f0a[_0xd105('0x18')][_0xd105('0x1b')]||null:null,'limit':0x1,'order':_0x352f0a['options']?_0x352f0a[_0xd105('0x18')][_0xd105('0x41')]||null:null,'group':db[_0xd105('0x17')][_0xd105('0x42')],'transaction':_0x40d3a0,'lock':_0x40d3a0[_0xd105('0x2e')][_0xd105('0x43')],'include':_0x352f0a[_0xd105('0x18')]?_0x352f0a['options'][_0xd105('0x1d')]?_[_0xd105('0x1e')](_0x352f0a[_0xd105('0x18')][_0xd105('0x1d')],function(_0x82c2a4){return{'model':db[_0x82c2a4['model']],'as':_0x82c2a4['as'],'attributes':_0x82c2a4[_0xd105('0x1b')],'include':_0x82c2a4[_0xd105('0x1d')]?_[_0xd105('0x1e')](_0x82c2a4[_0xd105('0x1d')],function(_0x3e9552){return{'model':db[_0x3e9552[_0xd105('0x1f')]],'as':_0x3e9552['as'],'attributes':_0x3e9552[_0xd105('0x1b')],'include':_0x3e9552[_0xd105('0x1d')]?_[_0xd105('0x1e')](_0x3e9552[_0xd105('0x1d')],function(_0x4e4802){return{'model':db[_0x4e4802['model']],'as':_0x4e4802['as'],'attributes':_0x4e4802['attributes']};}):[]};}):[]};}):[]:[]})[_0xd105('0x23')](function(_0x4871d7){var _0x59c225=[];for(var _0x19b88a=0x0;_0x19b88a<_0x4871d7[_0xd105('0x31')];_0x19b88a+=0x1){_0x59c225[_0xd105('0x32')](_0x4871d7[_0x19b88a]['update'](_0x352f0a['body'],{'transaction':_0x40d3a0}));}return BPromise[_0xd105('0x33')](_0x59c225);});})[_0xd105('0x23')](function(_0x27d3e5){logger[_0xd105('0x14')]('GetContactRecallMe',_0x352f0a);logger[_0xd105('0xe')](_0xd105('0x40'),_0x352f0a,JSON[_0xd105('0xf')](_0x27d3e5));_0x58ac5d(_0x27d3e5);})['catch'](function(_0x454c1a){logger[_0xd105('0x11')](_0xd105('0x40'),_0x454c1a[_0xd105('0x13')],_0x352f0a);_0x28db28(_0x2ffa06['error'](0x1f4,_0x454c1a[_0xd105('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 6a870ba..c3aaac3 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 _0x9957=['/:id','show','post','/preview','getPreview','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmHopper.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0x11'),auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x13')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x15')](_0x7995('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x16')]=router; \ No newline at end of file +var _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','describe','/opencontacts','/:id','post','/preview','getPreview','put','delete'];(function(_0x2b92c3,_0x58bf52){var _0x32fdd8=function(_0x4d4be6){while(--_0x4d4be6){_0x2b92c3['push'](_0x2b92c3['shift']());}};_0x32fdd8(++_0x58bf52);}(_0x7a54,0x106));var _0x47a5=function(_0x4e1b0b,_0x579131){_0x4e1b0b=_0x4e1b0b-0x0;var _0x5a3796=_0x7a54[_0x4e1b0b];return _0x5a3796;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['getOpenContacts']);router['get'](_0x47a5('0xc'),auth[_0x47a5('0x9')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x47a5('0xd')](_0x47a5('0xe'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xc'),auth[_0x47a5('0x9')](),controller['update']);router[_0x47a5('0x11')](_0x47a5('0xc'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x12')]);module[_0x47a5('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 8a649bb..9b0ed7f 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 _0xbb4d=['moment','STRING','contactListQueue','INTEGER'];(function(_0x24a921,_0x105358){var _0x2ea411=function(_0x8ee010){while(--_0x8ee010){_0x24a921['push'](_0x24a921['shift']());}};_0x2ea411(++_0x105358);}(_0xbb4d,0xc4));var _0xdbb4=function(_0x152fe2,_0x4554b7){_0x152fe2=_0x152fe2-0x0;var _0x145bd8=_0xbb4d[_0x152fe2];return _0x145bd8;};'use strict';var moment=require(_0xdbb4('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xdbb4('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xdbb4('0x2')},'VoiceQueueId':{'type':Sequelize[_0xdbb4('0x3')],'unique':_0xdbb4('0x2')}}; \ No newline at end of file +var _0xb83e=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0xb83e,0x117));var _0xeb83=function(_0x3eadd1,_0x6edfbc){_0x3eadd1=_0x3eadd1-0x0;var _0x15a676=_0xb83e[_0x3eadd1];return _0x15a676;};'use strict';var moment=require(_0xeb83('0x0'));var Sequelize=require(_0xeb83('0x1'));module[_0xeb83('0x2')]={'phone':{'type':Sequelize[_0xeb83('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xeb83('0x4')],'unique':_0xeb83('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xeb83('0x4')],'unique':_0xeb83('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index fa9fe90..84df72f 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 _0x7f0d=['params','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','send','index','CmHopperBlack','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','map','key','VIRTUAL','field','options','findAll','rows','catch','show'];(function(_0x3d7317,_0x6ceb3){var _0x398623=function(_0x1af56e){while(--_0x1af56e){_0x3d7317['push'](_0x3d7317['shift']());}};_0x398623(++_0x6ceb3);}(_0x7f0d,0x1e0));var _0xd7f0=function(_0x54215a,_0x32f211){_0x54215a=_0x54215a-0x0;var _0x56d0c1=_0x7f0d[_0x54215a];return _0x56d0c1;};'use strict';var pdf=require(_0xd7f0('0x0'));var emlformat=require(_0xd7f0('0x1'));var rimraf=require(_0xd7f0('0x2'));var zipdir=require(_0xd7f0('0x3'));var jsonpatch=require(_0xd7f0('0x4'));var rp=require(_0xd7f0('0x5'));var moment=require('moment');var BPromise=require(_0xd7f0('0x6'));var Mustache=require(_0xd7f0('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd7f0('0x8'));var fs=require('fs');var _=require(_0xd7f0('0x9'));var squel=require('squel');var crypto=require(_0xd7f0('0xa'));var jsforce=require(_0xd7f0('0xb'));var deskjs=require(_0xd7f0('0xc'));var toCsv=require(_0xd7f0('0xd'));var querystring=require(_0xd7f0('0xe'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xd7f0('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xd7f0('0x10'))(_0xd7f0('0x11'));var utils=require(_0xd7f0('0x12'));var config=require(_0xd7f0('0x13'));var db=require(_0xd7f0('0x14'))['db'];function respondWithStatusCode(_0x46f183,_0x3cef9f){_0x3cef9f=_0x3cef9f||0xcc;return function(_0x1f25a9){if(_0x1f25a9){return _0x46f183[_0xd7f0('0x15')](_0x3cef9f);}return _0x46f183['status'](_0x3cef9f)[_0xd7f0('0x16')]();};}function respondWithResult(_0x50279d,_0x1aea69){_0x1aea69=_0x1aea69||0xc8;return function(_0x283309){if(_0x283309){return _0x50279d[_0xd7f0('0x17')](_0x1aea69)[_0xd7f0('0x18')](_0x283309);}};}function respondWithFilteredResult(_0x2c7e35,_0x431b60){return function(_0x347cd3){if(_0x347cd3){var _0x105128=_0x347cd3[_0xd7f0('0x19')],_0x30d653=_0x431b60['offset'],_0x1877fc=_0x431b60[_0xd7f0('0x1a')]+_0x431b60[_0xd7f0('0x1b')],_0x4b1bac;if(_0x1877fc>=_0x105128){_0x1877fc=_0x105128;_0x4b1bac=0xc8;}else{_0x4b1bac=0xce;}_0x2c7e35[_0xd7f0('0x17')](_0x4b1bac);return _0x2c7e35[_0xd7f0('0x1c')]('Content-Range',_0x30d653+'-'+_0x1877fc+'/'+_0x105128)[_0xd7f0('0x18')](_0x347cd3);}return null;};}function patchUpdates(_0x144150){return function(_0x24071a){try{jsonpatch['apply'](_0x24071a,_0x144150,!![]);}catch(_0x41f972){return BPromise[_0xd7f0('0x1d')](_0x41f972);}return _0x24071a[_0xd7f0('0x1e')]();};}function saveUpdates(_0x187ede,_0x58e7c9){return function(_0x3290ba){if(_0x3290ba){return _0x3290ba[_0xd7f0('0x1f')](_0x187ede)[_0xd7f0('0x20')](function(_0x42e5bc){return _0x42e5bc;});}return null;};}function removeEntity(_0xfd4288,_0x58c358){return function(_0x274eb7){if(_0x274eb7){return _0x274eb7[_0xd7f0('0x21')]()[_0xd7f0('0x20')](function(){_0xfd4288[_0xd7f0('0x17')](0xcc)[_0xd7f0('0x16')]();});}};}function handleEntityNotFound(_0x1b2230,_0x3f2019){return function(_0x237d80){if(!_0x237d80){_0x1b2230[_0xd7f0('0x15')](0x194);}return _0x237d80;};}function handleError(_0x326340,_0x1e4e22){_0x1e4e22=_0x1e4e22||0x1f4;return function(_0x5b9a42){logger[_0xd7f0('0x22')](_0x5b9a42[_0xd7f0('0x23')]);if(_0x5b9a42['name']){delete _0x5b9a42['name'];}_0x326340[_0xd7f0('0x17')](_0x1e4e22)[_0xd7f0('0x24')](_0x5b9a42);};}exports[_0xd7f0('0x25')]=function(_0x4882c8,_0x33c5a9){var _0x5e67af={},_0x1ca8bb={},_0x505bc3={'count':0x0,'rows':[]};var _0x5233f2=db[_0xd7f0('0x26')][_0xd7f0('0x27')];_0x1ca8bb[_0xd7f0('0x28')]=_[_0xd7f0('0x29')](_0x5233f2);_0x1ca8bb[_0xd7f0('0x2a')]=_[_0xd7f0('0x29')](_0x4882c8[_0xd7f0('0x2a')]);_0x1ca8bb[_0xd7f0('0x2b')]=_[_0xd7f0('0x2c')](_0x1ca8bb[_0xd7f0('0x28')],_0x1ca8bb[_0xd7f0('0x2a')]);_0x5e67af[_0xd7f0('0x2d')]=_[_0xd7f0('0x2c')](_0x1ca8bb[_0xd7f0('0x28')],qs[_0xd7f0('0x2e')](_0x4882c8['query'][_0xd7f0('0x2e')]));_0x5e67af['attributes']=_0x5e67af[_0xd7f0('0x2d')][_0xd7f0('0x2f')]?_0x5e67af[_0xd7f0('0x2d')]:_0x1ca8bb[_0xd7f0('0x28')];if(!_0x4882c8['query'][_0xd7f0('0x30')](_0xd7f0('0x31'))){_0x5e67af[_0xd7f0('0x1b')]=qs[_0xd7f0('0x1b')](_0x4882c8['query']['limit']);_0x5e67af[_0xd7f0('0x1a')]=qs[_0xd7f0('0x1a')](_0x4882c8['query'][_0xd7f0('0x1a')]);}_0x5e67af['order']=qs[_0xd7f0('0x32')](_0x4882c8['query'][_0xd7f0('0x32')]);_0x5e67af['where']=qs['filters'](_[_0xd7f0('0x33')](_0x4882c8[_0xd7f0('0x2a')],_0x1ca8bb[_0xd7f0('0x2b')]));if(_0x4882c8[_0xd7f0('0x2a')][_0xd7f0('0x34')]){_0x5e67af['where']=_[_0xd7f0('0x35')](_0x5e67af[_0xd7f0('0x36')],{'$or':_[_0xd7f0('0x37')](_0x5233f2,function(_0x33afbe){if(_0x33afbe['type'][_0xd7f0('0x38')]!==_0xd7f0('0x39')){var _0x459227={};_0x459227[_0x33afbe[_0xd7f0('0x3a')]]={'$like':'%'+_0x4882c8[_0xd7f0('0x2a')][_0xd7f0('0x34')]+'%'};return _0x459227;}})});}_0x5e67af=_['merge']({},_0x5e67af,_0x4882c8[_0xd7f0('0x3b')]);var _0x244a17={'where':_0x5e67af[_0xd7f0('0x36')]};return db['CmHopperBlack']['count'](_0x244a17)['then'](function(_0x399324){_0x505bc3[_0xd7f0('0x19')]=_0x399324;if(_0x4882c8[_0xd7f0('0x2a')]['includeAll']){_0x5e67af['include']=[{'all':!![]}];}return db[_0xd7f0('0x26')][_0xd7f0('0x3c')](_0x5e67af);})[_0xd7f0('0x20')](function(_0x1b821a){_0x505bc3[_0xd7f0('0x3d')]=_0x1b821a;return _0x505bc3;})[_0xd7f0('0x20')](respondWithFilteredResult(_0x33c5a9,_0x5e67af))[_0xd7f0('0x3e')](handleError(_0x33c5a9,null));};exports[_0xd7f0('0x3f')]=function(_0x13b947,_0x4b0d37){var _0x39359a={'raw':!![],'where':{'id':_0x13b947[_0xd7f0('0x40')]['id']}},_0x32db91={};_0x32db91['model']=_[_0xd7f0('0x29')](db[_0xd7f0('0x26')][_0xd7f0('0x27')]);_0x32db91['query']=_[_0xd7f0('0x29')](_0x13b947['query']);_0x32db91['filters']=_[_0xd7f0('0x2c')](_0x32db91[_0xd7f0('0x28')],_0x32db91[_0xd7f0('0x2a')]);_0x39359a['attributes']=_['intersection'](_0x32db91[_0xd7f0('0x28')],qs['fields'](_0x13b947['query'][_0xd7f0('0x2e')]));_0x39359a['attributes']=_0x39359a['attributes'][_0xd7f0('0x2f')]?_0x39359a['attributes']:_0x32db91[_0xd7f0('0x28')];if(_0x13b947[_0xd7f0('0x2a')]['includeAll']){_0x39359a['include']=[{'all':!![]}];}_0x39359a=_[_0xd7f0('0x35')]({},_0x39359a,_0x13b947[_0xd7f0('0x3b')]);return db[_0xd7f0('0x26')][_0xd7f0('0x41')](_0x39359a)[_0xd7f0('0x20')](handleEntityNotFound(_0x4b0d37,null))['then'](respondWithResult(_0x4b0d37,null))[_0xd7f0('0x3e')](handleError(_0x4b0d37,null));};exports[_0xd7f0('0x1f')]=function(_0x530ae8,_0x16a406){if(_0x530ae8[_0xd7f0('0x42')]['id']){delete _0x530ae8[_0xd7f0('0x42')]['id'];}return db[_0xd7f0('0x26')][_0xd7f0('0x41')]({'where':{'id':_0x530ae8[_0xd7f0('0x40')]['id']}})[_0xd7f0('0x20')](handleEntityNotFound(_0x16a406,null))['then'](saveUpdates(_0x530ae8[_0xd7f0('0x42')],null))[_0xd7f0('0x20')](respondWithResult(_0x16a406,null))['catch'](handleError(_0x16a406,null));};exports[_0xd7f0('0x21')]=function(_0x298af3,_0x36cbab){return db[_0xd7f0('0x26')][_0xd7f0('0x41')]({'where':{'id':_0x298af3['params']['id']}})['then'](handleEntityNotFound(_0x36cbab,null))[_0xd7f0('0x20')](removeEntity(_0x36cbab,null))[_0xd7f0('0x3e')](handleError(_0x36cbab,null));};exports[_0xd7f0('0x43')]=function(_0x2cc1fd,_0x47c897){return db[_0xd7f0('0x26')][_0xd7f0('0x43')]()['then'](respondWithResult(_0x47c897,null))[_0xd7f0('0x3e')](handleError(_0x47c897,null));}; \ No newline at end of file +var _0x4d39=['length','order','sort','filters','filter','where','merge','type','key','VIRTUAL','field','options','findAll','rows','catch','includeAll','find','body','destroy','params','describe','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','CmHopperBlack','rawAttributes','keys','query','intersection','model','fields','attributes'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x4d39,0x1b3));var _0x94d3=function(_0x206d7e,_0x17ddce){_0x206d7e=_0x206d7e-0x0;var _0x3987db=_0x4d39[_0x206d7e];return _0x3987db;};'use strict';var pdf=require(_0x94d3('0x0'));var emlformat=require(_0x94d3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x94d3('0x2'));var rp=require('request-promise');var moment=require(_0x94d3('0x3'));var BPromise=require(_0x94d3('0x4'));var Mustache=require(_0x94d3('0x5'));var util=require('util');var path=require(_0x94d3('0x6'));var sox=require('sox');var csv=require(_0x94d3('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x94d3('0x8'));var squel=require(_0x94d3('0x9'));var crypto=require(_0x94d3('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x94d3('0xb'));var Papa=require(_0x94d3('0xc'));var authService=require(_0x94d3('0xd'));var hardwareService=require(_0x94d3('0xe'));var Redis=require(_0x94d3('0xf'));var qs=require(_0x94d3('0x10'));var logger=require(_0x94d3('0x11'))(_0x94d3('0x12'));var utils=require(_0x94d3('0x13'));var config=require(_0x94d3('0x14'));var db=require(_0x94d3('0x15'))['db'];function respondWithStatusCode(_0x1fa856,_0x1d75c4){_0x1d75c4=_0x1d75c4||0xcc;return function(_0xaee478){if(_0xaee478){return _0x1fa856['sendStatus'](_0x1d75c4);}return _0x1fa856[_0x94d3('0x16')](_0x1d75c4)['end']();};}function respondWithResult(_0xf12c1e,_0x4f0365){_0x4f0365=_0x4f0365||0xc8;return function(_0x1a2ba0){if(_0x1a2ba0){return _0xf12c1e[_0x94d3('0x16')](_0x4f0365)[_0x94d3('0x17')](_0x1a2ba0);}};}function respondWithFilteredResult(_0x12fe5d,_0x7ae63d){return function(_0xd99185){if(_0xd99185){var _0xea6499=_0xd99185[_0x94d3('0x18')],_0x17f051=_0x7ae63d[_0x94d3('0x19')],_0x3105ac=_0x7ae63d[_0x94d3('0x19')]+_0x7ae63d[_0x94d3('0x1a')],_0x217094;if(_0x3105ac>=_0xea6499){_0x3105ac=_0xea6499;_0x217094=0xc8;}else{_0x217094=0xce;}_0x12fe5d[_0x94d3('0x16')](_0x217094);return _0x12fe5d[_0x94d3('0x1b')](_0x94d3('0x1c'),_0x17f051+'-'+_0x3105ac+'/'+_0xea6499)[_0x94d3('0x17')](_0xd99185);}return null;};}function patchUpdates(_0x5d7c3c){return function(_0x594928){try{jsonpatch[_0x94d3('0x1d')](_0x594928,_0x5d7c3c,!![]);}catch(_0x11a23f){return BPromise[_0x94d3('0x1e')](_0x11a23f);}return _0x594928[_0x94d3('0x1f')]();};}function saveUpdates(_0x393a93,_0x18f80a){return function(_0x3d454){if(_0x3d454){return _0x3d454[_0x94d3('0x20')](_0x393a93)[_0x94d3('0x21')](function(_0xe642a3){return _0xe642a3;});}return null;};}function removeEntity(_0x59f50d,_0x24171c){return function(_0x1a4ca3){if(_0x1a4ca3){return _0x1a4ca3['destroy']()['then'](function(){_0x59f50d[_0x94d3('0x16')](0xcc)[_0x94d3('0x22')]();});}};}function handleEntityNotFound(_0x3f0b7e,_0x3463d5){return function(_0x521e0f){if(!_0x521e0f){_0x3f0b7e[_0x94d3('0x23')](0x194);}return _0x521e0f;};}function handleError(_0x1e18bb,_0xf2b2d1){_0xf2b2d1=_0xf2b2d1||0x1f4;return function(_0x152b02){logger[_0x94d3('0x24')](_0x152b02[_0x94d3('0x25')]);if(_0x152b02[_0x94d3('0x26')]){delete _0x152b02['name'];}_0x1e18bb[_0x94d3('0x16')](_0xf2b2d1)[_0x94d3('0x27')](_0x152b02);};}exports['index']=function(_0x56a373,_0x45919a){var _0x52d593={},_0x49db66={},_0x51a7a8={'count':0x0,'rows':[]};var _0x4a4954=db[_0x94d3('0x28')][_0x94d3('0x29')];_0x49db66['model']=_[_0x94d3('0x2a')](_0x4a4954);_0x49db66[_0x94d3('0x2b')]=_[_0x94d3('0x2a')](_0x56a373[_0x94d3('0x2b')]);_0x49db66['filters']=_[_0x94d3('0x2c')](_0x49db66[_0x94d3('0x2d')],_0x49db66[_0x94d3('0x2b')]);_0x52d593['attributes']=_[_0x94d3('0x2c')](_0x49db66[_0x94d3('0x2d')],qs[_0x94d3('0x2e')](_0x56a373['query'][_0x94d3('0x2e')]));_0x52d593[_0x94d3('0x2f')]=_0x52d593['attributes'][_0x94d3('0x30')]?_0x52d593['attributes']:_0x49db66['model'];if(!_0x56a373['query']['hasOwnProperty']('nolimit')){_0x52d593[_0x94d3('0x1a')]=qs[_0x94d3('0x1a')](_0x56a373[_0x94d3('0x2b')][_0x94d3('0x1a')]);_0x52d593[_0x94d3('0x19')]=qs[_0x94d3('0x19')](_0x56a373[_0x94d3('0x2b')][_0x94d3('0x19')]);}_0x52d593[_0x94d3('0x31')]=qs[_0x94d3('0x32')](_0x56a373[_0x94d3('0x2b')][_0x94d3('0x32')]);_0x52d593['where']=qs[_0x94d3('0x33')](_['pick'](_0x56a373[_0x94d3('0x2b')],_0x49db66[_0x94d3('0x33')]));if(_0x56a373['query'][_0x94d3('0x34')]){_0x52d593[_0x94d3('0x35')]=_[_0x94d3('0x36')](_0x52d593['where'],{'$or':_['map'](_0x4a4954,function(_0x4547f2){if(_0x4547f2[_0x94d3('0x37')][_0x94d3('0x38')]!==_0x94d3('0x39')){var _0x19a794={};_0x19a794[_0x4547f2[_0x94d3('0x3a')]]={'$like':'%'+_0x56a373[_0x94d3('0x2b')][_0x94d3('0x34')]+'%'};return _0x19a794;}})});}_0x52d593=_[_0x94d3('0x36')]({},_0x52d593,_0x56a373[_0x94d3('0x3b')]);var _0x5d6794={'where':_0x52d593['where']};return db[_0x94d3('0x28')]['count'](_0x5d6794)[_0x94d3('0x21')](function(_0x1362a6){_0x51a7a8[_0x94d3('0x18')]=_0x1362a6;if(_0x56a373[_0x94d3('0x2b')]['includeAll']){_0x52d593['include']=[{'all':!![]}];}return db[_0x94d3('0x28')][_0x94d3('0x3c')](_0x52d593);})[_0x94d3('0x21')](function(_0x4fe1a1){_0x51a7a8[_0x94d3('0x3d')]=_0x4fe1a1;return _0x51a7a8;})[_0x94d3('0x21')](respondWithFilteredResult(_0x45919a,_0x52d593))[_0x94d3('0x3e')](handleError(_0x45919a,null));};exports['show']=function(_0x59b179,_0x1629d8){var _0x4bc4ce={'raw':!![],'where':{'id':_0x59b179['params']['id']}},_0x26446d={};_0x26446d['model']=_[_0x94d3('0x2a')](db[_0x94d3('0x28')]['rawAttributes']);_0x26446d[_0x94d3('0x2b')]=_[_0x94d3('0x2a')](_0x59b179[_0x94d3('0x2b')]);_0x26446d[_0x94d3('0x33')]=_['intersection'](_0x26446d['model'],_0x26446d[_0x94d3('0x2b')]);_0x4bc4ce[_0x94d3('0x2f')]=_[_0x94d3('0x2c')](_0x26446d['model'],qs[_0x94d3('0x2e')](_0x59b179[_0x94d3('0x2b')][_0x94d3('0x2e')]));_0x4bc4ce[_0x94d3('0x2f')]=_0x4bc4ce[_0x94d3('0x2f')]['length']?_0x4bc4ce[_0x94d3('0x2f')]:_0x26446d[_0x94d3('0x2d')];if(_0x59b179['query'][_0x94d3('0x3f')]){_0x4bc4ce['include']=[{'all':!![]}];}_0x4bc4ce=_['merge']({},_0x4bc4ce,_0x59b179['options']);return db[_0x94d3('0x28')][_0x94d3('0x40')](_0x4bc4ce)[_0x94d3('0x21')](handleEntityNotFound(_0x1629d8,null))[_0x94d3('0x21')](respondWithResult(_0x1629d8,null))['catch'](handleError(_0x1629d8,null));};exports[_0x94d3('0x20')]=function(_0x3acd61,_0x3014a6){if(_0x3acd61[_0x94d3('0x41')]['id']){delete _0x3acd61[_0x94d3('0x41')]['id'];}return db[_0x94d3('0x28')][_0x94d3('0x40')]({'where':{'id':_0x3acd61['params']['id']}})[_0x94d3('0x21')](handleEntityNotFound(_0x3014a6,null))[_0x94d3('0x21')](saveUpdates(_0x3acd61['body'],null))[_0x94d3('0x21')](respondWithResult(_0x3014a6,null))[_0x94d3('0x3e')](handleError(_0x3014a6,null));};exports[_0x94d3('0x42')]=function(_0x4e676b,_0x3aba14){return db[_0x94d3('0x28')][_0x94d3('0x40')]({'where':{'id':_0x4e676b[_0x94d3('0x43')]['id']}})[_0x94d3('0x21')](handleEntityNotFound(_0x3aba14,null))[_0x94d3('0x21')](removeEntity(_0x3aba14,null))[_0x94d3('0x3e')](handleError(_0x3aba14,null));};exports[_0x94d3('0x44')]=function(_0x3c833f,_0x54093b){return db[_0x94d3('0x28')]['describe']()[_0x94d3('0x21')](respondWithResult(_0x54093b,null))['catch'](handleError(_0x54093b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 93ae964..32e4309 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 _0x6141=['cm_hopper_black','lodash','util','../../config/logger','bluebird','./cmHopperBlack.attributes','define','CmHopperBlack'];(function(_0x49b59f,_0x1f3a28){var _0x46f0de=function(_0x3841f1){while(--_0x3841f1){_0x49b59f['push'](_0x49b59f['shift']());}};_0x46f0de(++_0x1f3a28);}(_0x6141,0x81));var _0x1614=function(_0xd86ed9,_0x258bd3){_0xd86ed9=_0xd86ed9-0x0;var _0x3b9c12=_0x6141[_0xd86ed9];return _0x3b9c12;};'use strict';var _=require(_0x1614('0x0'));var util=require(_0x1614('0x1'));var logger=require(_0x1614('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1614('0x3'));var rp=require('request-promise');var attributes=require(_0x1614('0x4'));module['exports']=function(_0x4e1ab7,_0x1aa779){return _0x4e1ab7[_0x1614('0x5')](_0x1614('0x6'),attributes,{'tableName':_0x1614('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8888=['../../config/logger','bluebird','request-promise','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util'];(function(_0x15f4fb,_0x4d8f47){var _0x59ca7d=function(_0x17e664){while(--_0x17e664){_0x15f4fb['push'](_0x15f4fb['shift']());}};_0x59ca7d(++_0x4d8f47);}(_0x8888,0x7c));var _0x8888=function(_0x3410b9,_0x4711c2){_0x3410b9=_0x3410b9-0x0;var _0x5270ea=_0x8888[_0x3410b9];return _0x5270ea;};'use strict';var _=require(_0x8888('0x0'));var util=require(_0x8888('0x1'));var logger=require(_0x8888('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8888('0x3'));var rp=require(_0x8888('0x4'));var attributes=require(_0x8888('0x5'));module[_0x8888('0x6')]=function(_0x2a5703,_0x2a59ad){return _0x2a5703[_0x8888('0x7')]('CmHopperBlack',attributes,{'tableName':_0x8888('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 6cd6ac9..2af4de5 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 _0xf0c6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','options','raw','attributes','limit','include','model','GetCmHopperBlack','debug','CmHopperBlack','body','where','UpdateCmHopperBlack','stringify','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x51cd45,_0xd7d3bb){var _0x33166c=function(_0x51eb97){while(--_0x51eb97){_0x51cd45['push'](_0x51cd45['shift']());}};_0x33166c(++_0xd7d3bb);}(_0xf0c6,0xa9));var _0x6f0c=function(_0x2754a8,_0x25feb3){_0x2754a8=_0x2754a8-0x0;var _0x557255=_0xf0c6[_0x2754a8];return _0x557255;};'use strict';var _=require(_0x6f0c('0x0'));var util=require('util');var moment=require(_0x6f0c('0x1'));var BPromise=require(_0x6f0c('0x2'));var rs=require(_0x6f0c('0x3'));var fs=require('fs');var Redis=require(_0x6f0c('0x4'));var db=require(_0x6f0c('0x5'))['db'];var utils=require(_0x6f0c('0x6'));var logger=require(_0x6f0c('0x7'))('rpc');var config=require(_0x6f0c('0x8'));var jayson=require(_0x6f0c('0x9'));var client=jayson[_0x6f0c('0xa')][_0x6f0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fbdae,_0xb1ce23,_0x4eb791){return new BPromise(function(_0x17dcb4,_0x4e538b){return client['request'](_0x3fbdae,_0x4eb791)[_0x6f0c('0xc')](function(_0x149b4d){logger[_0x6f0c('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0xb1ce23,_0x6f0c('0xe'));logger['debug'](_0x6f0c('0xf'),_0xb1ce23,'request\x20sent',JSON['stringify'](_0x149b4d));if(_0x149b4d[_0x6f0c('0x10')]){if(_0x149b4d[_0x6f0c('0x10')]['code']===0x1f4){logger[_0x6f0c('0x10')](_0x6f0c('0x11'),_0xb1ce23,_0x149b4d['error'][_0x6f0c('0x12')]);return _0x4e538b(_0x149b4d[_0x6f0c('0x10')]['message']);}logger[_0x6f0c('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0xb1ce23,_0x149b4d['error'][_0x6f0c('0x12')]);return _0x17dcb4(_0x149b4d[_0x6f0c('0x10')][_0x6f0c('0x12')]);}else{logger[_0x6f0c('0xd')](_0x6f0c('0x11'),_0xb1ce23,_0x6f0c('0xe'));_0x17dcb4(_0x149b4d[_0x6f0c('0x13')][_0x6f0c('0x12')]);}})[_0x6f0c('0x14')](function(_0x48de23){logger[_0x6f0c('0x10')](_0x6f0c('0x11'),_0xb1ce23,_0x48de23);_0x4e538b(_0x48de23);});});}exports['GetCmHopperBlack']=function(_0x313f66){var _0x5d949c=this;return new Promise(function(_0x4fbe14,_0x40d758){return db['CmHopperBlack']['findAll']({'raw':_0x313f66[_0x6f0c('0x15')]?_0x313f66['options'][_0x6f0c('0x16')]===undefined?!![]:![]:!![],'where':_0x313f66[_0x6f0c('0x15')]?_0x313f66[_0x6f0c('0x15')]['where']||null:null,'attributes':_0x313f66[_0x6f0c('0x15')]?_0x313f66[_0x6f0c('0x15')][_0x6f0c('0x17')]||null:null,'limit':_0x313f66['options']?_0x313f66['options'][_0x6f0c('0x18')]||null:null,'include':_0x313f66[_0x6f0c('0x15')]?_0x313f66[_0x6f0c('0x15')][_0x6f0c('0x19')]?_['map'](_0x313f66[_0x6f0c('0x15')]['include'],function(_0xd0ed8b){return{'model':db[_0xd0ed8b['model']],'as':_0xd0ed8b['as'],'attributes':_0xd0ed8b[_0x6f0c('0x17')],'include':_0xd0ed8b[_0x6f0c('0x19')]?_['map'](_0xd0ed8b[_0x6f0c('0x19')],function(_0x19fcfb){return{'model':db[_0x19fcfb[_0x6f0c('0x1a')]],'as':_0x19fcfb['as'],'attributes':_0x19fcfb[_0x6f0c('0x17')],'include':_0x19fcfb[_0x6f0c('0x19')]?_['map'](_0x19fcfb[_0x6f0c('0x19')],function(_0x5cd2dd){return{'model':db[_0x5cd2dd[_0x6f0c('0x1a')]],'as':_0x5cd2dd['as'],'attributes':_0x5cd2dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f0c('0xc')](function(_0x2f0edc){logger[_0x6f0c('0xd')](_0x6f0c('0x1b'),_0x313f66);logger[_0x6f0c('0x1c')]('GetCmHopperBlack',_0x313f66,JSON['stringify'](_0x2f0edc));_0x4fbe14(_0x2f0edc);})[_0x6f0c('0x14')](function(_0x5c749e){logger[_0x6f0c('0x10')]('GetCmHopperBlack',_0x5c749e[_0x6f0c('0x12')],_0x313f66);_0x40d758(_0x5d949c[_0x6f0c('0x10')](0x1f4,_0x5c749e[_0x6f0c('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x3e2b66){var _0x3963f9=this;return new Promise(function(_0x4c0adc,_0x3fadcd){return db[_0x6f0c('0x1d')]['update'](_0x3e2b66[_0x6f0c('0x1e')],{'raw':_0x3e2b66[_0x6f0c('0x15')]?_0x3e2b66[_0x6f0c('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e2b66[_0x6f0c('0x15')]?_0x3e2b66[_0x6f0c('0x15')][_0x6f0c('0x1f')]||null:null,'attributes':_0x3e2b66[_0x6f0c('0x15')]?_0x3e2b66[_0x6f0c('0x15')][_0x6f0c('0x17')]||null:null,'limit':_0x3e2b66[_0x6f0c('0x15')]?_0x3e2b66[_0x6f0c('0x15')][_0x6f0c('0x18')]||null:null})[_0x6f0c('0xc')](function(_0x5f04d6){logger['info'](_0x6f0c('0x20'),_0x3e2b66);logger['debug'](_0x6f0c('0x20'),_0x3e2b66,JSON[_0x6f0c('0x21')](_0x5f04d6));_0x4c0adc(_0x5f04d6);})[_0x6f0c('0x14')](function(_0x265492){logger['error']('UpdateCmHopperBlack',_0x265492[_0x6f0c('0x12')],_0x3e2b66);_0x3fadcd(_0x3963f9[_0x6f0c('0x10')](0x1f4,_0x265492['message']));});});};exports[_0x6f0c('0x22')]=function(_0x4139f5){var _0x7f8fff=this;return new Promise(function(_0x199f29,_0x35e106){return db[_0x6f0c('0x1d')]['destroy']({'where':_0x4139f5[_0x6f0c('0x15')]?_0x4139f5['options'][_0x6f0c('0x1f')]||null:null})['then'](function(_0x12c1cd){logger['info']('DestroyCmHopperBlack',_0x4139f5);logger['debug'](_0x6f0c('0x22'),_0x4139f5,JSON[_0x6f0c('0x21')](_0x12c1cd));_0x199f29(_0x12c1cd);})[_0x6f0c('0x14')](function(_0x6a8328){logger[_0x6f0c('0x10')](_0x6f0c('0x22'),_0x6a8328[_0x6f0c('0x12')],_0x4139f5);_0x35e106(_0x7f8fff[_0x6f0c('0x10')](0x1f4,_0x6a8328[_0x6f0c('0x12')]));});});}; \ No newline at end of file +var _0x324d=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','limit','include','map','model','attributes','debug','body','raw','where','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1db7ae,_0x270fe7){var _0x5e7433=function(_0x653e46){while(--_0x653e46){_0x1db7ae['push'](_0x1db7ae['shift']());}};_0x5e7433(++_0x270fe7);}(_0x324d,0x8e));var _0xd324=function(_0x27711c,_0x55d53c){_0x27711c=_0x27711c-0x0;var _0x355fb0=_0x324d[_0x27711c];return _0x355fb0;};'use strict';var _=require(_0xd324('0x0'));var util=require('util');var moment=require(_0xd324('0x1'));var BPromise=require(_0xd324('0x2'));var rs=require(_0xd324('0x3'));var fs=require('fs');var Redis=require(_0xd324('0x4'));var db=require(_0xd324('0x5'))['db'];var utils=require(_0xd324('0x6'));var logger=require(_0xd324('0x7'))('rpc');var config=require(_0xd324('0x8'));var jayson=require(_0xd324('0x9'));var client=jayson[_0xd324('0xa')][_0xd324('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f0c26,_0x44c7ab,_0x8a1130){return new BPromise(function(_0x29aa3a,_0x2d8d92){return client[_0xd324('0xc')](_0x5f0c26,_0x8a1130)[_0xd324('0xd')](function(_0x106fa0){logger[_0xd324('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x44c7ab,_0xd324('0xf'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x44c7ab,_0xd324('0xf'),JSON[_0xd324('0x10')](_0x106fa0));if(_0x106fa0[_0xd324('0x11')]){if(_0x106fa0['error'][_0xd324('0x12')]===0x1f4){logger[_0xd324('0x11')](_0xd324('0x13'),_0x44c7ab,_0x106fa0['error'][_0xd324('0x14')]);return _0x2d8d92(_0x106fa0[_0xd324('0x11')][_0xd324('0x14')]);}logger[_0xd324('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x44c7ab,_0x106fa0[_0xd324('0x11')]['message']);return _0x29aa3a(_0x106fa0[_0xd324('0x11')][_0xd324('0x14')]);}else{logger[_0xd324('0xe')](_0xd324('0x13'),_0x44c7ab,_0xd324('0xf'));_0x29aa3a(_0x106fa0['result'][_0xd324('0x14')]);}})[_0xd324('0x15')](function(_0x285cc9){logger[_0xd324('0x11')](_0xd324('0x13'),_0x44c7ab,_0x285cc9);_0x2d8d92(_0x285cc9);});});}exports[_0xd324('0x16')]=function(_0x3759cb){var _0x45fc79=this;return new Promise(function(_0x5de5c9,_0x367bd3){return db[_0xd324('0x17')][_0xd324('0x18')]({'raw':_0x3759cb[_0xd324('0x19')]?_0x3759cb[_0xd324('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3759cb['options']?_0x3759cb['options']['where']||null:null,'attributes':_0x3759cb[_0xd324('0x19')]?_0x3759cb['options']['attributes']||null:null,'limit':_0x3759cb[_0xd324('0x19')]?_0x3759cb[_0xd324('0x19')][_0xd324('0x1a')]||null:null,'include':_0x3759cb[_0xd324('0x19')]?_0x3759cb[_0xd324('0x19')][_0xd324('0x1b')]?_[_0xd324('0x1c')](_0x3759cb[_0xd324('0x19')][_0xd324('0x1b')],function(_0x4eff11){return{'model':db[_0x4eff11[_0xd324('0x1d')]],'as':_0x4eff11['as'],'attributes':_0x4eff11[_0xd324('0x1e')],'include':_0x4eff11['include']?_[_0xd324('0x1c')](_0x4eff11['include'],function(_0x221bb7){return{'model':db[_0x221bb7[_0xd324('0x1d')]],'as':_0x221bb7['as'],'attributes':_0x221bb7[_0xd324('0x1e')],'include':_0x221bb7[_0xd324('0x1b')]?_[_0xd324('0x1c')](_0x221bb7[_0xd324('0x1b')],function(_0x1b5441){return{'model':db[_0x1b5441['model']],'as':_0x1b5441['as'],'attributes':_0x1b5441[_0xd324('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd324('0xd')](function(_0x49f183){logger['info'](_0xd324('0x16'),_0x3759cb);logger[_0xd324('0x1f')]('GetCmHopperBlack',_0x3759cb,JSON['stringify'](_0x49f183));_0x5de5c9(_0x49f183);})[_0xd324('0x15')](function(_0x32161a){logger[_0xd324('0x11')]('GetCmHopperBlack',_0x32161a[_0xd324('0x14')],_0x3759cb);_0x367bd3(_0x45fc79[_0xd324('0x11')](0x1f4,_0x32161a[_0xd324('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x27625e){var _0x3769a3=this;return new Promise(function(_0x49492d,_0x200256){return db[_0xd324('0x17')]['update'](_0x27625e[_0xd324('0x20')],{'raw':_0x27625e[_0xd324('0x19')]?_0x27625e[_0xd324('0x19')][_0xd324('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27625e[_0xd324('0x19')]?_0x27625e[_0xd324('0x19')][_0xd324('0x22')]||null:null,'attributes':_0x27625e[_0xd324('0x19')]?_0x27625e['options']['attributes']||null:null,'limit':_0x27625e[_0xd324('0x19')]?_0x27625e['options'][_0xd324('0x1a')]||null:null})[_0xd324('0xd')](function(_0x479732){logger[_0xd324('0xe')](_0xd324('0x23'),_0x27625e);logger['debug'](_0xd324('0x23'),_0x27625e,JSON[_0xd324('0x10')](_0x479732));_0x49492d(_0x479732);})[_0xd324('0x15')](function(_0x20ecb0){logger[_0xd324('0x11')](_0xd324('0x23'),_0x20ecb0[_0xd324('0x14')],_0x27625e);_0x200256(_0x3769a3['error'](0x1f4,_0x20ecb0['message']));});});};exports[_0xd324('0x24')]=function(_0x321494){var _0x12aadd=this;return new Promise(function(_0x5cb431,_0x36d792){return db[_0xd324('0x17')]['destroy']({'where':_0x321494[_0xd324('0x19')]?_0x321494[_0xd324('0x19')][_0xd324('0x22')]||null:null})[_0xd324('0xd')](function(_0x2f7f31){logger[_0xd324('0xe')](_0xd324('0x24'),_0x321494);logger[_0xd324('0x1f')]('DestroyCmHopperBlack',_0x321494,JSON['stringify'](_0x2f7f31));_0x5cb431(_0x2f7f31);})[_0xd324('0x15')](function(_0xe86e88){logger[_0xd324('0x11')](_0xd324('0x24'),_0xe86e88[_0xd324('0x14')],_0x321494);_0x36d792(_0x12aadd['error'](0x1f4,_0xe86e88[_0xd324('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 370f34c..1d7f885 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 _0x54a1=['index','/describe','describe','/:id','update','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x54a1,0xf1));var _0x154a=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x54a1[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0x154a('0x0'));var util=require('util');var path=require(_0x154a('0x1'));var timeout=require(_0x154a('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x154a('0x3'));var config=require('../../config/environment');var controller=require(_0x154a('0x4'));router['get']('/',auth[_0x154a('0x5')](),controller[_0x154a('0x6')]);router['get'](_0x154a('0x7'),auth[_0x154a('0x5')](),controller[_0x154a('0x8')]);router['get'](_0x154a('0x9'),auth[_0x154a('0x5')](),controller['show']);router['put'](_0x154a('0x9'),auth['isAuthenticated'](),controller[_0x154a('0xa')]);router['delete'](_0x154a('0x9'),auth[_0x154a('0x5')](),controller[_0x154a('0xb')]);module[_0x154a('0xc')]=router; \ No newline at end of file +var _0xe4ec=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4af407,_0x2db4c7){var _0x36875c=function(_0x25d2f6){while(--_0x25d2f6){_0x4af407['push'](_0x4af407['shift']());}};_0x36875c(++_0x2db4c7);}(_0xe4ec,0x11c));var _0xce4e=function(_0x111853,_0x24a74e){_0x111853=_0x111853-0x0;var _0x492812=_0xe4ec[_0x111853];return _0x492812;};'use strict';var multer=require('multer');var util=require(_0xce4e('0x0'));var path=require('path');var timeout=require(_0xce4e('0x1'));var express=require(_0xce4e('0x2'));var router=express[_0xce4e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xce4e('0x4'));var config=require(_0xce4e('0x5'));var controller=require(_0xce4e('0x6'));router[_0xce4e('0x7')]('/',auth[_0xce4e('0x8')](),controller[_0xce4e('0x9')]);router[_0xce4e('0x7')]('/describe',auth[_0xce4e('0x8')](),controller['describe']);router['get'](_0xce4e('0xa'),auth[_0xce4e('0x8')](),controller[_0xce4e('0xb')]);router[_0xce4e('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xce4e('0xd')](_0xce4e('0xa'),auth[_0xce4e('0x8')](),controller[_0xce4e('0xe')]);module[_0xce4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 5f1d6dc..30945ae 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 _0x5668=['dispositionat','BOOLEAN','INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds'];(function(_0xfe027f,_0xe56f9d){var _0x471990=function(_0x1e23f1){while(--_0x1e23f1){_0xfe027f['push'](_0xfe027f['shift']());}};_0x471990(++_0xe56f9d);}(_0x5668,0x1d0));var _0x8566=function(_0x5c2761,_0x2f127a){_0x5c2761=_0x5c2761-0x0;var _0x5ddf8b=_0x5668[_0x5c2761];return _0x5ddf8b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x8566('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8566('0x1')]},'countbusyretry':{'type':Sequelize[_0x8566('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8566('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8566('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8566('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x8566('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8566('0x2')]},'calleridname':{'type':Sequelize[_0x8566('0x2')]},'starttime':{'type':Sequelize[_0x8566('0x1')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x8566('0x1')]},'droptime':{'type':Sequelize[_0x8566('0x1')]},'endtime':{'type':Sequelize[_0x8566('0x1')]},'ringtime':{'type':Sequelize[_0x8566('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8566('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8566('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8566('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8566('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8566('0x2')]},'membername':{'type':Sequelize[_0x8566('0x2')]},'reason':{'type':Sequelize[_0x8566('0x2')]},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x8566('0x1')],'set':function(_0x45e44e){var _0xe01473=this[_0x8566('0x3')](_0x8566('0x4'));if(_0xe01473&&_0x45e44e){this[_0x8566('0x5')](_0x8566('0x6'),moment(_0x45e44e)[_0x8566('0x7')](moment(_0xe01473),_0x8566('0x8')));}return this[_0x8566('0x5')](_0x8566('0x9'),_0x45e44e);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8566('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8566('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x8566('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8566('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8566('0x1')]},'deleted':{'type':Sequelize[_0x8566('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8566('0x1')]},'recallme':{'type':Sequelize[_0x8566('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8566('0x1')]}}; \ No newline at end of file +var _0x2553=['INTEGER','STRING','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','moment','DATE'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x2553,0x1c0));var _0x3255=function(_0x2defc4,_0x25dbea){_0x2defc4=_0x2defc4-0x0;var _0x10e80a=_0x2553[_0x2defc4];return _0x10e80a;};'use strict';var Sequelize=require(_0x3255('0x0'));var moment=require(_0x3255('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x3255('0x2')]},'countbusyretry':{'type':Sequelize[_0x3255('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3255('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3255('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3255('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x3255('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3255('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x3255('0x2')]},'responsetime':{'type':Sequelize[_0x3255('0x2')]},'answertime':{'type':Sequelize[_0x3255('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3255('0x2')]},'ringtime':{'type':Sequelize[_0x3255('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3255('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3255('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3255('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3255('0x4')]},'campaign':{'type':Sequelize[_0x3255('0x4')]},'campaigntype':{'type':Sequelize[_0x3255('0x4')]},'membername':{'type':Sequelize[_0x3255('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x3255('0x4')]},'dispositionat':{'type':Sequelize[_0x3255('0x2')],'set':function(_0x2e98e6){var _0x2a4209=this[_0x3255('0x5')](_0x3255('0x6'));if(_0x2a4209&&_0x2e98e6){this[_0x3255('0x7')]('followuptime',moment(_0x2e98e6)[_0x3255('0x8')](moment(_0x2a4209),_0x3255('0x9')));}return this['setDataValue']('dispositionat',_0x2e98e6);}},'amd':{'type':Sequelize[_0x3255('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3255('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3255('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3255('0x2')]},'callback':{'type':Sequelize[_0x3255('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3255('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3255('0x2')]},'deleted':{'type':Sequelize[_0x3255('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3255('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 7d70fd6..63e73c8 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 _0xbdb7=['uniqueid','body','find','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`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','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','phone','cm_hopper','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','from','state','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','status','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','name','send','index','CmHopperFinal','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','where','filter','merge','map','type','key','VIRTUAL','field','include','findAll','rows','catch','show','includeAll','options','describe','update'];(function(_0x456897,_0x3d0fd6){var _0x3d5d04=function(_0xf7a8bb){while(--_0xf7a8bb){_0x456897['push'](_0x456897['shift']());}};_0x3d5d04(++_0x3d0fd6);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2776c0,_0x3bdc05){_0x2776c0=_0x2776c0-0x0;var _0x42b7b7=_0xbdb7[_0x2776c0];return _0x42b7b7;};'use strict';var pdf=require(_0x7bdb('0x0'));var emlformat=require(_0x7bdb('0x1'));var rimraf=require(_0x7bdb('0x2'));var zipdir=require(_0x7bdb('0x3'));var jsonpatch=require(_0x7bdb('0x4'));var rp=require(_0x7bdb('0x5'));var moment=require(_0x7bdb('0x6'));var BPromise=require(_0x7bdb('0x7'));var Mustache=require(_0x7bdb('0x8'));var util=require('util');var path=require(_0x7bdb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bdb('0xa'));var fs=require('fs');var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var authService=require(_0x7bdb('0xf'));var hardwareService=require(_0x7bdb('0x10'));var Redis=require(_0x7bdb('0x11'));var qs=require(_0x7bdb('0x12'));var logger=require(_0x7bdb('0x13'))(_0x7bdb('0x14'));var utils=require(_0x7bdb('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b9b9,_0x3053d0){_0x3053d0=_0x3053d0||0xcc;return function(_0x25e3cb){if(_0x25e3cb){return _0x52b9b9['sendStatus'](_0x3053d0);}return _0x52b9b9[_0x7bdb('0x16')](_0x3053d0)['end']();};}function respondWithResult(_0x5898c1,_0x2abca6){_0x2abca6=_0x2abca6||0xc8;return function(_0x46dd4a){if(_0x46dd4a){return _0x5898c1['status'](_0x2abca6)['json'](_0x46dd4a);}};}function respondWithFilteredResult(_0x4e98f7,_0x4476ff){return function(_0x195b2e){if(_0x195b2e){var _0xe9919f=_0x195b2e[_0x7bdb('0x17')],_0x25d417=_0x4476ff[_0x7bdb('0x18')],_0x31c909=_0x4476ff['offset']+_0x4476ff[_0x7bdb('0x19')],_0xbde12a;if(_0x31c909>=_0xe9919f){_0x31c909=_0xe9919f;_0xbde12a=0xc8;}else{_0xbde12a=0xce;}_0x4e98f7[_0x7bdb('0x16')](_0xbde12a);return _0x4e98f7[_0x7bdb('0x1a')](_0x7bdb('0x1b'),_0x25d417+'-'+_0x31c909+'/'+_0xe9919f)['json'](_0x195b2e);}return null;};}function patchUpdates(_0x41f540){return function(_0x23e9eb){try{jsonpatch['apply'](_0x23e9eb,_0x41f540,!![]);}catch(_0x3e5f8e){return BPromise[_0x7bdb('0x1c')](_0x3e5f8e);}return _0x23e9eb[_0x7bdb('0x1d')]();};}function saveUpdates(_0x45d552,_0x112793){return function(_0x5bfc35){if(_0x5bfc35){return _0x5bfc35['update'](_0x45d552)[_0x7bdb('0x1e')](function(_0xcb25f2){return _0xcb25f2;});}return null;};}function removeEntity(_0x5daea4,_0x341fe4){return function(_0x118ea1){if(_0x118ea1){return _0x118ea1[_0x7bdb('0x1f')]()[_0x7bdb('0x1e')](function(){_0x5daea4[_0x7bdb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d37ac,_0xdad53d){return function(_0x40c447){if(!_0x40c447){_0x1d37ac[_0x7bdb('0x20')](0x194);}return _0x40c447;};}function handleError(_0x481f4b,_0x4d6e44){_0x4d6e44=_0x4d6e44||0x1f4;return function(_0x3c423f){logger['error'](_0x3c423f['stack']);if(_0x3c423f['name']){delete _0x3c423f[_0x7bdb('0x21')];}_0x481f4b['status'](_0x4d6e44)[_0x7bdb('0x22')](_0x3c423f);};}exports[_0x7bdb('0x23')]=function(_0x3ec129,_0x7c09cf){var _0x2a494e={},_0x523869={},_0x10e818={'count':0x0,'rows':[]};var _0x32242d=db[_0x7bdb('0x24')][_0x7bdb('0x25')];_0x523869[_0x7bdb('0x26')]=_[_0x7bdb('0x27')](_0x32242d);_0x523869[_0x7bdb('0x28')]=_[_0x7bdb('0x27')](_0x3ec129[_0x7bdb('0x28')]);_0x523869[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](_0x523869[_0x7bdb('0x26')],_0x523869['query']);_0x2a494e[_0x7bdb('0x2b')]=_[_0x7bdb('0x2a')](_0x523869[_0x7bdb('0x26')],qs[_0x7bdb('0x2c')](_0x3ec129[_0x7bdb('0x28')]['fields']));_0x2a494e[_0x7bdb('0x2b')]=_0x2a494e[_0x7bdb('0x2b')][_0x7bdb('0x2d')]?_0x2a494e[_0x7bdb('0x2b')]:_0x523869['model'];if(!_0x3ec129['query']['hasOwnProperty'](_0x7bdb('0x2e'))){_0x2a494e['limit']=qs[_0x7bdb('0x19')](_0x3ec129['query'][_0x7bdb('0x19')]);_0x2a494e[_0x7bdb('0x18')]=qs[_0x7bdb('0x18')](_0x3ec129['query'][_0x7bdb('0x18')]);}_0x2a494e['order']=qs['sort'](_0x3ec129[_0x7bdb('0x28')]['sort']);_0x2a494e[_0x7bdb('0x2f')]=qs['filters'](_['pick'](_0x3ec129[_0x7bdb('0x28')],_0x523869[_0x7bdb('0x29')]));if(_0x3ec129[_0x7bdb('0x28')][_0x7bdb('0x30')]){_0x2a494e[_0x7bdb('0x2f')]=_[_0x7bdb('0x31')](_0x2a494e['where'],{'$or':_[_0x7bdb('0x32')](_0x32242d,function(_0x464fde){if(_0x464fde[_0x7bdb('0x33')][_0x7bdb('0x34')]!==_0x7bdb('0x35')){var _0x14c522={};_0x14c522[_0x464fde[_0x7bdb('0x36')]]={'$like':'%'+_0x3ec129[_0x7bdb('0x28')][_0x7bdb('0x30')]+'%'};return _0x14c522;}})});}_0x2a494e=_['merge']({},_0x2a494e,_0x3ec129['options']);var _0x19c237={'where':_0x2a494e[_0x7bdb('0x2f')]};return db[_0x7bdb('0x24')][_0x7bdb('0x17')](_0x19c237)[_0x7bdb('0x1e')](function(_0x509e90){_0x10e818['count']=_0x509e90;if(_0x3ec129[_0x7bdb('0x28')]['includeAll']){_0x2a494e[_0x7bdb('0x37')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7bdb('0x38')](_0x2a494e);})['then'](function(_0x4cf3fa){_0x10e818[_0x7bdb('0x39')]=_0x4cf3fa;return _0x10e818;})[_0x7bdb('0x1e')](respondWithFilteredResult(_0x7c09cf,_0x2a494e))[_0x7bdb('0x3a')](handleError(_0x7c09cf,null));};exports[_0x7bdb('0x3b')]=function(_0x43c7d3,_0x2b4829){var _0x2e10f3={'raw':!![],'where':{'id':_0x43c7d3['params']['id']}},_0x501aff={};_0x501aff[_0x7bdb('0x26')]=_[_0x7bdb('0x27')](db[_0x7bdb('0x24')][_0x7bdb('0x25')]);_0x501aff[_0x7bdb('0x28')]=_[_0x7bdb('0x27')](_0x43c7d3[_0x7bdb('0x28')]);_0x501aff['filters']=_['intersection'](_0x501aff[_0x7bdb('0x26')],_0x501aff[_0x7bdb('0x28')]);_0x2e10f3[_0x7bdb('0x2b')]=_[_0x7bdb('0x2a')](_0x501aff['model'],qs[_0x7bdb('0x2c')](_0x43c7d3['query'][_0x7bdb('0x2c')]));_0x2e10f3[_0x7bdb('0x2b')]=_0x2e10f3[_0x7bdb('0x2b')][_0x7bdb('0x2d')]?_0x2e10f3[_0x7bdb('0x2b')]:_0x501aff[_0x7bdb('0x26')];if(_0x43c7d3[_0x7bdb('0x28')][_0x7bdb('0x3c')]){_0x2e10f3[_0x7bdb('0x37')]=[{'all':!![]}];}_0x2e10f3=_['merge']({},_0x2e10f3,_0x43c7d3[_0x7bdb('0x3d')]);return db[_0x7bdb('0x24')]['find'](_0x2e10f3)[_0x7bdb('0x1e')](handleEntityNotFound(_0x2b4829,null))['then'](respondWithResult(_0x2b4829,null))[_0x7bdb('0x3a')](handleError(_0x2b4829,null));};exports[_0x7bdb('0x3e')]=function(_0x122beb,_0x3a8415){return db[_0x7bdb('0x24')]['describe']()[_0x7bdb('0x1e')](respondWithResult(_0x3a8415,null))[_0x7bdb('0x3a')](handleError(_0x3a8415,null));};exports[_0x7bdb('0x3f')]=function(_0x3eda2e,_0x31244f){if(_0x3eda2e['body'][_0x7bdb('0x40')]){delete _0x3eda2e[_0x7bdb('0x41')][_0x7bdb('0x40')];}return db[_0x7bdb('0x24')][_0x7bdb('0x42')]({'where':{'uniqueid':_0x3eda2e[_0x7bdb('0x43')]['id']}})[_0x7bdb('0x1e')](handleEntityNotFound(_0x31244f,null))[_0x7bdb('0x1e')](saveUpdates(_0x3eda2e[_0x7bdb('0x41')],null))[_0x7bdb('0x1e')](respondWithResult(_0x31244f,null))['catch'](handleError(_0x31244f,null));};exports[_0x7bdb('0x44')]=function(_0x58c4bc,_0x47cccd,_0x1a7cbf){return db[_0x7bdb('0x24')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x58c4bc[_0x7bdb('0x43')]['id']},'attributes':[[db[_0x7bdb('0x45')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x7bdb('0x46')](_0x7bdb('0x47')))),_0x7bdb('0x48')],[db[_0x7bdb('0x45')]['fn'](_0x7bdb('0x49'),db[_0x7bdb('0x45')]['fn']('IF',db[_0x7bdb('0x45')][_0x7bdb('0x46')](_0x7bdb('0x4a')))),_0x7bdb('0x4b')],[db['sequelize']['fn'](_0x7bdb('0x49'),db['sequelize']['fn']('IF',db[_0x7bdb('0x45')][_0x7bdb('0x46')](_0x7bdb('0x4c')))),_0x7bdb('0x4d')],[db['sequelize']['fn'](_0x7bdb('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x7bdb('0x46')](_0x7bdb('0x4e')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x7bdb('0x45')]['fn']('IF',db['sequelize']['literal'](_0x7bdb('0x4f')))),_0x7bdb('0x50')],[db[_0x7bdb('0x45')]['fn'](_0x7bdb('0x49'),db['sequelize']['fn']('IF',db[_0x7bdb('0x45')]['literal'](_0x7bdb('0x51')))),_0x7bdb('0x52')],[db[_0x7bdb('0x45')]['fn'](_0x7bdb('0x49'),db[_0x7bdb('0x45')]['fn']('IF',db[_0x7bdb('0x45')]['literal'](_0x7bdb('0x53')))),_0x7bdb('0x54')],[db[_0x7bdb('0x45')]['fn']('COUNT',db[_0x7bdb('0x45')]['fn']('IF',db[_0x7bdb('0x45')]['literal'](_0x7bdb('0x55')))),'answeringMachine']]})[_0x7bdb('0x1e')](handleEntityNotFound(_0x47cccd,null))[_0x7bdb('0x1e')](respondWithResult(_0x47cccd,null))['catch'](handleError(_0x47cccd,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x21a54f,_0x2a6c5b,_0x560f54){return db[_0x7bdb('0x24')]['findAll']({'raw':![],'where':{'CampaignId':_0x21a54f[_0x7bdb('0x43')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x7bdb('0x45')]['fn']('IF',db[_0x7bdb('0x45')][_0x7bdb('0x46')](_0x7bdb('0x47')))),_0x7bdb('0x48')],[db[_0x7bdb('0x45')]['fn'](_0x7bdb('0x49'),db[_0x7bdb('0x45')]['fn']('IF',db[_0x7bdb('0x45')][_0x7bdb('0x46')](_0x7bdb('0x4a')))),_0x7bdb('0x4b')],[db['sequelize']['fn'](_0x7bdb('0x49'),db[_0x7bdb('0x45')]['fn']('IF',db['sequelize'][_0x7bdb('0x46')](_0x7bdb('0x4c')))),_0x7bdb('0x4d')],[db[_0x7bdb('0x45')]['fn'](_0x7bdb('0x49'),db['sequelize']['fn']('IF',db[_0x7bdb('0x45')][_0x7bdb('0x46')](_0x7bdb('0x4e')))),'congestionContacts'],[db[_0x7bdb('0x45')]['fn'](_0x7bdb('0x49'),db[_0x7bdb('0x45')]['fn']('IF',db[_0x7bdb('0x45')][_0x7bdb('0x46')](_0x7bdb('0x4f')))),_0x7bdb('0x50')],[db[_0x7bdb('0x45')]['fn'](_0x7bdb('0x49'),db['sequelize']['fn']('IF',db[_0x7bdb('0x45')][_0x7bdb('0x46')](_0x7bdb('0x51')))),_0x7bdb('0x52')],[db[_0x7bdb('0x45')]['fn'](_0x7bdb('0x49'),db[_0x7bdb('0x45')]['fn']('IF',db[_0x7bdb('0x45')][_0x7bdb('0x46')](_0x7bdb('0x53')))),_0x7bdb('0x54')],[db[_0x7bdb('0x45')]['fn'](_0x7bdb('0x49'),db['sequelize']['fn']('IF',db[_0x7bdb('0x45')]['literal'](_0x7bdb('0x55')))),_0x7bdb('0x56')]]})[_0x7bdb('0x1e')](handleEntityNotFound(_0x2a6c5b,null))['then'](respondWithResult(_0x2a6c5b,null))[_0x7bdb('0x3a')](handleError(_0x2a6c5b,null));};exports[_0x7bdb('0x57')]=function(_0x4ebc9f,_0x3b4736,_0x1f9024){return db['VoiceQueue'][_0x7bdb('0x42')]({'where':{'id':_0x4ebc9f[_0x7bdb('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b4736,null))[_0x7bdb('0x1e')](function(_0x237688){var _0x4fbb58;if(_0x237688){_0x4fbb58=squel[_0x7bdb('0x58')]()[_0x7bdb('0x59')]('cm_hopper')[_0x7bdb('0x5a')](['phone',_0x7bdb('0x5b'),_0x7bdb('0x5c'),_0x7bdb('0x5d'),_0x7bdb('0x5e'),_0x7bdb('0x5f'),'updatedAt'],squel['select']()['field'](_0x7bdb('0x60'),'phone')[_0x7bdb('0x36')](_0x7bdb('0x61'),_0x7bdb('0x5b'))['field']('ANY_VALUE(ContactId)',_0x7bdb('0x5c'))[_0x7bdb('0x36')](_0x7bdb('0x62'),_0x7bdb('0x5d'))['field'](_0x7bdb('0x63'),_0x7bdb('0x5e'))[_0x7bdb('0x36')](_0x7bdb('0x61'),_0x7bdb('0x5f'))[_0x7bdb('0x36')]('NOW()',_0x7bdb('0x64'))['from'](_0x7bdb('0x65'))['where'](_0x7bdb('0x66'),_0x4ebc9f[_0x7bdb('0x43')]['id'][_0x7bdb('0x67')]())[_0x7bdb('0x2f')](_0x7bdb('0x68'),_0x4ebc9f['body']['state'][_0x7bdb('0x67')]())[_0x7bdb('0x2f')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x7bdb('0x2f')](_0x7bdb('0x69'),squel['select']()[_0x7bdb('0x36')](_0x7bdb('0x6a'))['from'](_0x7bdb('0x6b'))['where']('VoiceQueueId\x20=\x20?',_0x4ebc9f[_0x7bdb('0x43')]['id'][_0x7bdb('0x67')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7bdb('0x6c')]()['field'](_0x7bdb('0x6d'))['from'](_0x7bdb('0x65'))[_0x7bdb('0x2f')](_0x7bdb('0x66'),_0x4ebc9f[_0x7bdb('0x43')]['id']['toString']())[_0x7bdb('0x2f')](_0x7bdb('0x6e')))['group'](_0x7bdb('0x5c')))[_0x7bdb('0x67')]();return db['sequelize'][_0x7bdb('0x28')](_0x4fbb58);}return[];})[_0x7bdb('0x1e')](respondWithResult(_0x3b4736,null))[_0x7bdb('0x3a')](handleError(_0x3b4736,null));};exports[_0x7bdb('0x6f')]=function(_0x521d68,_0x324285,_0x5af736){return db[_0x7bdb('0x70')][_0x7bdb('0x42')]({'where':{'id':_0x521d68[_0x7bdb('0x43')]['id']}})['then'](handleEntityNotFound(_0x324285,null))[_0x7bdb('0x1e')](function(_0x4c1b4b){var _0x12bd09;if(_0x4c1b4b){_0x12bd09=squel[_0x7bdb('0x58')]()[_0x7bdb('0x59')](_0x7bdb('0x6b'))[_0x7bdb('0x5a')]([_0x7bdb('0x6a'),_0x7bdb('0x5b'),_0x7bdb('0x5c'),_0x7bdb('0x5d'),_0x7bdb('0x71'),_0x7bdb('0x5f'),_0x7bdb('0x64')],squel[_0x7bdb('0x6c')]()[_0x7bdb('0x36')](_0x7bdb('0x60'),_0x7bdb('0x6a'))['field'](_0x7bdb('0x61'),_0x7bdb('0x5b'))[_0x7bdb('0x36')](_0x7bdb('0x72'),_0x7bdb('0x5c'))[_0x7bdb('0x36')](_0x7bdb('0x62'),_0x7bdb('0x5d'))[_0x7bdb('0x36')](_0x7bdb('0x73'),_0x7bdb('0x71'))['field']('NOW()','createdAt')[_0x7bdb('0x36')](_0x7bdb('0x61'),'updatedAt')[_0x7bdb('0x74')](_0x7bdb('0x65'))['where']('CampaignId\x20=\x20?',_0x521d68['params']['id'][_0x7bdb('0x67')]())['where']('state\x20=\x20?',_0x521d68['body'][_0x7bdb('0x75')][_0x7bdb('0x67')]())[_0x7bdb('0x2f')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x7bdb('0x2f')](_0x7bdb('0x69'),squel[_0x7bdb('0x6c')]()[_0x7bdb('0x36')]('phone')[_0x7bdb('0x74')]('cm_hopper')[_0x7bdb('0x2f')](_0x7bdb('0x76'),_0x521d68[_0x7bdb('0x43')]['id']['toString']()))[_0x7bdb('0x2f')](_0x7bdb('0x69'),squel[_0x7bdb('0x6c')]()['field'](_0x7bdb('0x6d'))[_0x7bdb('0x74')]('cm_hopper_final')[_0x7bdb('0x2f')](_0x7bdb('0x76'),_0x521d68['params']['id'][_0x7bdb('0x67')]())[_0x7bdb('0x2f')](_0x7bdb('0x6e')))[_0x7bdb('0x77')](_0x7bdb('0x5c')))['toString']();return db[_0x7bdb('0x45')]['query'](_0x12bd09);}return[];})[_0x7bdb('0x1e')](respondWithResult(_0x324285,null))[_0x7bdb('0x3a')](handleError(_0x324285,null));};exports[_0x7bdb('0x78')]=function(_0x4b7730,_0xeebdc2,_0x59f4da){return db[_0x7bdb('0x79')]['findOne']({'where':{'VoiceQueueId':_0x4b7730[_0x7bdb('0x41')][_0x7bdb('0x5e')],'CampaignId':_0x4b7730[_0x7bdb('0x41')][_0x7bdb('0x71')],'ContactId':_0x4b7730[_0x7bdb('0x41')]['ContactId']}})['then'](handleEntityNotFound(_0xeebdc2,null))[_0x7bdb('0x1e')](function(_0x1175c6){if(_0x1175c6){return _0x1175c6;}return null;})[_0x7bdb('0x1e')](respondWithResult(_0xeebdc2,null))[_0x7bdb('0x3a')](handleError(_0xeebdc2,null));}; \ No newline at end of file +var _0x4fc2=['ANY_VALUE(VoiceQueueId)','VoiceQueueId','createdAt','NOW()','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','updatedAt','CampaignId','CampaignId\x20=\x20?','state','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','CmHopperFinal','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','key','VIRTUAL','field','options','includeAll','findAll','catch','show','params','include','find','describe','body','uniqueid','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','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4fc2,0x111));var _0x24fc=function(_0x5a4257,_0x3ae34d){_0x5a4257=_0x5a4257-0x0;var _0x3746a7=_0x4fc2[_0x5a4257];return _0x3746a7;};'use strict';var pdf=require(_0x24fc('0x0'));var emlformat=require(_0x24fc('0x1'));var rimraf=require(_0x24fc('0x2'));var zipdir=require(_0x24fc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24fc('0x4'));var moment=require(_0x24fc('0x5'));var BPromise=require(_0x24fc('0x6'));var Mustache=require('mustache');var util=require(_0x24fc('0x7'));var path=require(_0x24fc('0x8'));var sox=require('sox');var csv=require(_0x24fc('0x9'));var ejs=require(_0x24fc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0x9'));var querystring=require(_0x24fc('0xf'));var Papa=require('papaparse');var authService=require(_0x24fc('0x10'));var hardwareService=require(_0x24fc('0x11'));var Redis=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var logger=require(_0x24fc('0x14'))(_0x24fc('0x15'));var utils=require(_0x24fc('0x16'));var config=require(_0x24fc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bd032,_0x1cde5d){_0x1cde5d=_0x1cde5d||0xcc;return function(_0x5cc65e){if(_0x5cc65e){return _0x3bd032[_0x24fc('0x18')](_0x1cde5d);}return _0x3bd032[_0x24fc('0x19')](_0x1cde5d)[_0x24fc('0x1a')]();};}function respondWithResult(_0x3bc30b,_0x30f19b){_0x30f19b=_0x30f19b||0xc8;return function(_0x326276){if(_0x326276){return _0x3bc30b['status'](_0x30f19b)[_0x24fc('0x1b')](_0x326276);}};}function respondWithFilteredResult(_0x18c0a7,_0x2ffed3){return function(_0x42cbe8){if(_0x42cbe8){var _0x4acd36=_0x42cbe8[_0x24fc('0x1c')],_0x2ac989=_0x2ffed3[_0x24fc('0x1d')],_0x588543=_0x2ffed3[_0x24fc('0x1d')]+_0x2ffed3[_0x24fc('0x1e')],_0x4af098;if(_0x588543>=_0x4acd36){_0x588543=_0x4acd36;_0x4af098=0xc8;}else{_0x4af098=0xce;}_0x18c0a7['status'](_0x4af098);return _0x18c0a7[_0x24fc('0x1f')](_0x24fc('0x20'),_0x2ac989+'-'+_0x588543+'/'+_0x4acd36)[_0x24fc('0x1b')](_0x42cbe8);}return null;};}function patchUpdates(_0x8ac114){return function(_0x4c5a43){try{jsonpatch[_0x24fc('0x21')](_0x4c5a43,_0x8ac114,!![]);}catch(_0x4073e0){return BPromise[_0x24fc('0x22')](_0x4073e0);}return _0x4c5a43['save']();};}function saveUpdates(_0x32a57d,_0x36a771){return function(_0xbf1d6b){if(_0xbf1d6b){return _0xbf1d6b[_0x24fc('0x23')](_0x32a57d)['then'](function(_0x323beb){return _0x323beb;});}return null;};}function removeEntity(_0x545939,_0x339b50){return function(_0x591c8f){if(_0x591c8f){return _0x591c8f[_0x24fc('0x24')]()[_0x24fc('0x25')](function(){_0x545939[_0x24fc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313a25,_0x552035){return function(_0x35a9c7){if(!_0x35a9c7){_0x313a25[_0x24fc('0x18')](0x194);}return _0x35a9c7;};}function handleError(_0x36a9b4,_0x34b5b2){_0x34b5b2=_0x34b5b2||0x1f4;return function(_0x3296fc){logger[_0x24fc('0x26')](_0x3296fc[_0x24fc('0x27')]);if(_0x3296fc[_0x24fc('0x28')]){delete _0x3296fc[_0x24fc('0x28')];}_0x36a9b4[_0x24fc('0x19')](_0x34b5b2)['send'](_0x3296fc);};}exports[_0x24fc('0x29')]=function(_0x16f27f,_0x3ee302){var _0x5bb4c8={},_0xf2f77d={},_0x3d1ec8={'count':0x0,'rows':[]};var _0x35f9f9=db[_0x24fc('0x2a')][_0x24fc('0x2b')];_0xf2f77d[_0x24fc('0x2c')]=_['keys'](_0x35f9f9);_0xf2f77d[_0x24fc('0x2d')]=_[_0x24fc('0x2e')](_0x16f27f[_0x24fc('0x2d')]);_0xf2f77d[_0x24fc('0x2f')]=_[_0x24fc('0x30')](_0xf2f77d['model'],_0xf2f77d['query']);_0x5bb4c8['attributes']=_[_0x24fc('0x30')](_0xf2f77d['model'],qs[_0x24fc('0x31')](_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x31')]));_0x5bb4c8[_0x24fc('0x32')]=_0x5bb4c8['attributes'][_0x24fc('0x33')]?_0x5bb4c8[_0x24fc('0x32')]:_0xf2f77d['model'];if(!_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x34')]('nolimit')){_0x5bb4c8['limit']=qs[_0x24fc('0x1e')](_0x16f27f['query'][_0x24fc('0x1e')]);_0x5bb4c8[_0x24fc('0x1d')]=qs['offset'](_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x1d')]);}_0x5bb4c8[_0x24fc('0x35')]=qs[_0x24fc('0x36')](_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x36')]);_0x5bb4c8[_0x24fc('0x37')]=qs[_0x24fc('0x2f')](_[_0x24fc('0x38')](_0x16f27f['query'],_0xf2f77d[_0x24fc('0x2f')]));if(_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x39')]){_0x5bb4c8[_0x24fc('0x37')]=_[_0x24fc('0x3a')](_0x5bb4c8['where'],{'$or':_['map'](_0x35f9f9,function(_0xd52d10){if(_0xd52d10['type'][_0x24fc('0x3b')]!==_0x24fc('0x3c')){var _0x10399f={};_0x10399f[_0xd52d10[_0x24fc('0x3d')]]={'$like':'%'+_0x16f27f['query'][_0x24fc('0x39')]+'%'};return _0x10399f;}})});}_0x5bb4c8=_['merge']({},_0x5bb4c8,_0x16f27f[_0x24fc('0x3e')]);var _0x3b8fb6={'where':_0x5bb4c8[_0x24fc('0x37')]};return db[_0x24fc('0x2a')][_0x24fc('0x1c')](_0x3b8fb6)['then'](function(_0xadedb4){_0x3d1ec8[_0x24fc('0x1c')]=_0xadedb4;if(_0x16f27f[_0x24fc('0x2d')][_0x24fc('0x3f')]){_0x5bb4c8['include']=[{'all':!![]}];}return db[_0x24fc('0x2a')][_0x24fc('0x40')](_0x5bb4c8);})['then'](function(_0xf40435){_0x3d1ec8['rows']=_0xf40435;return _0x3d1ec8;})[_0x24fc('0x25')](respondWithFilteredResult(_0x3ee302,_0x5bb4c8))[_0x24fc('0x41')](handleError(_0x3ee302,null));};exports[_0x24fc('0x42')]=function(_0x1e045a,_0x431189){var _0x278b18={'raw':!![],'where':{'id':_0x1e045a[_0x24fc('0x43')]['id']}},_0x77b959={};_0x77b959['model']=_[_0x24fc('0x2e')](db[_0x24fc('0x2a')][_0x24fc('0x2b')]);_0x77b959['query']=_[_0x24fc('0x2e')](_0x1e045a[_0x24fc('0x2d')]);_0x77b959['filters']=_[_0x24fc('0x30')](_0x77b959[_0x24fc('0x2c')],_0x77b959[_0x24fc('0x2d')]);_0x278b18['attributes']=_[_0x24fc('0x30')](_0x77b959[_0x24fc('0x2c')],qs['fields'](_0x1e045a[_0x24fc('0x2d')][_0x24fc('0x31')]));_0x278b18[_0x24fc('0x32')]=_0x278b18[_0x24fc('0x32')]['length']?_0x278b18[_0x24fc('0x32')]:_0x77b959[_0x24fc('0x2c')];if(_0x1e045a[_0x24fc('0x2d')][_0x24fc('0x3f')]){_0x278b18[_0x24fc('0x44')]=[{'all':!![]}];}_0x278b18=_['merge']({},_0x278b18,_0x1e045a[_0x24fc('0x3e')]);return db[_0x24fc('0x2a')][_0x24fc('0x45')](_0x278b18)[_0x24fc('0x25')](handleEntityNotFound(_0x431189,null))['then'](respondWithResult(_0x431189,null))[_0x24fc('0x41')](handleError(_0x431189,null));};exports[_0x24fc('0x46')]=function(_0x5ea251,_0x5bbb6c){return db[_0x24fc('0x2a')]['describe']()['then'](respondWithResult(_0x5bbb6c,null))[_0x24fc('0x41')](handleError(_0x5bbb6c,null));};exports['update']=function(_0x281194,_0x264854){if(_0x281194[_0x24fc('0x47')]['uniqueid']){delete _0x281194[_0x24fc('0x47')][_0x24fc('0x48')];}return db[_0x24fc('0x2a')][_0x24fc('0x45')]({'where':{'uniqueid':_0x281194[_0x24fc('0x43')]['id']}})[_0x24fc('0x25')](handleEntityNotFound(_0x264854,null))[_0x24fc('0x25')](saveUpdates(_0x281194[_0x24fc('0x47')],null))['then'](respondWithResult(_0x264854,null))['catch'](handleError(_0x264854,null));};exports[_0x24fc('0x49')]=function(_0x2f1a99,_0x12e9f7,_0x5b5e7a){return db['CmHopperFinal'][_0x24fc('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x2f1a99[_0x24fc('0x43')]['id']},'attributes':[[db[_0x24fc('0x4a')]['fn'](_0x24fc('0x4b'),db[_0x24fc('0x4a')]['fn']('IF',db[_0x24fc('0x4a')][_0x24fc('0x4c')](_0x24fc('0x4d')))),_0x24fc('0x4e')],[db[_0x24fc('0x4a')]['fn'](_0x24fc('0x4b'),db[_0x24fc('0x4a')]['fn']('IF',db['sequelize'][_0x24fc('0x4c')](_0x24fc('0x4f')))),_0x24fc('0x50')],[db[_0x24fc('0x4a')]['fn'](_0x24fc('0x4b'),db['sequelize']['fn']('IF',db[_0x24fc('0x4a')]['literal'](_0x24fc('0x51')))),_0x24fc('0x52')],[db[_0x24fc('0x4a')]['fn'](_0x24fc('0x4b'),db[_0x24fc('0x4a')]['fn']('IF',db[_0x24fc('0x4a')]['literal'](_0x24fc('0x53')))),_0x24fc('0x54')],[db[_0x24fc('0x4a')]['fn'](_0x24fc('0x4b'),db[_0x24fc('0x4a')]['fn']('IF',db[_0x24fc('0x4a')]['literal'](_0x24fc('0x55')))),_0x24fc('0x56')],[db[_0x24fc('0x4a')]['fn'](_0x24fc('0x4b'),db[_0x24fc('0x4a')]['fn']('IF',db[_0x24fc('0x4a')][_0x24fc('0x4c')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x24fc('0x57')],[db[_0x24fc('0x4a')]['fn']('COUNT',db[_0x24fc('0x4a')]['fn']('IF',db[_0x24fc('0x4a')][_0x24fc('0x4c')](_0x24fc('0x58')))),_0x24fc('0x59')],[db[_0x24fc('0x4a')]['fn']('COUNT',db[_0x24fc('0x4a')]['fn']('IF',db['sequelize'][_0x24fc('0x4c')](_0x24fc('0x5a')))),'answeringMachine']]})[_0x24fc('0x25')](handleEntityNotFound(_0x12e9f7,null))['then'](respondWithResult(_0x12e9f7,null))[_0x24fc('0x41')](handleError(_0x12e9f7,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xdff811,_0x27b612,_0x57daaf){return db[_0x24fc('0x2a')]['findAll']({'raw':![],'where':{'CampaignId':_0xdff811[_0x24fc('0x43')]['id']},'attributes':[[db[_0x24fc('0x4a')]['fn']('COUNT',db[_0x24fc('0x4a')]['fn']('IF',db[_0x24fc('0x4a')][_0x24fc('0x4c')](_0x24fc('0x4d')))),_0x24fc('0x4e')],[db['sequelize']['fn'](_0x24fc('0x4b'),db[_0x24fc('0x4a')]['fn']('IF',db[_0x24fc('0x4a')][_0x24fc('0x4c')](_0x24fc('0x4f')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x24fc('0x4b'),db[_0x24fc('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x24fc('0x51')))),_0x24fc('0x52')],[db[_0x24fc('0x4a')]['fn'](_0x24fc('0x4b'),db['sequelize']['fn']('IF',db[_0x24fc('0x4a')][_0x24fc('0x4c')](_0x24fc('0x53')))),_0x24fc('0x54')],[db[_0x24fc('0x4a')]['fn'](_0x24fc('0x4b'),db[_0x24fc('0x4a')]['fn']('IF',db[_0x24fc('0x4a')][_0x24fc('0x4c')](_0x24fc('0x55')))),_0x24fc('0x56')],[db[_0x24fc('0x4a')]['fn'](_0x24fc('0x4b'),db[_0x24fc('0x4a')]['fn']('IF',db[_0x24fc('0x4a')]['literal'](_0x24fc('0x5b')))),_0x24fc('0x57')],[db[_0x24fc('0x4a')]['fn'](_0x24fc('0x4b'),db[_0x24fc('0x4a')]['fn']('IF',db[_0x24fc('0x4a')][_0x24fc('0x4c')](_0x24fc('0x58')))),'reCallContacts'],[db[_0x24fc('0x4a')]['fn'](_0x24fc('0x4b'),db[_0x24fc('0x4a')]['fn']('IF',db[_0x24fc('0x4a')]['literal'](_0x24fc('0x5a')))),_0x24fc('0x5c')]]})['then'](handleEntityNotFound(_0x27b612,null))['then'](respondWithResult(_0x27b612,null))['catch'](handleError(_0x27b612,null));};exports[_0x24fc('0x5d')]=function(_0x698283,_0x246ef1,_0x2c6a97){return db[_0x24fc('0x5e')][_0x24fc('0x45')]({'where':{'id':_0x698283['params']['id']}})[_0x24fc('0x25')](handleEntityNotFound(_0x246ef1,null))[_0x24fc('0x25')](function(_0x5a2c09){var _0x51b1c0;if(_0x5a2c09){_0x51b1c0=squel[_0x24fc('0x5f')]()[_0x24fc('0x60')](_0x24fc('0x61'))['fromQuery']([_0x24fc('0x62'),_0x24fc('0x63'),_0x24fc('0x64'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel['select']()[_0x24fc('0x3d')](_0x24fc('0x65'),_0x24fc('0x62'))[_0x24fc('0x3d')]('NOW()',_0x24fc('0x63'))['field'](_0x24fc('0x66'),'ContactId')[_0x24fc('0x3d')](_0x24fc('0x67'),_0x24fc('0x68'))[_0x24fc('0x3d')](_0x24fc('0x69'),_0x24fc('0x6a'))[_0x24fc('0x3d')]('NOW()',_0x24fc('0x6b'))[_0x24fc('0x3d')](_0x24fc('0x6c'),'updatedAt')['from'](_0x24fc('0x6d'))[_0x24fc('0x37')]('VoiceQueueId\x20=\x20?',_0x698283[_0x24fc('0x43')]['id'][_0x24fc('0x6e')]())['where'](_0x24fc('0x6f'),_0x698283[_0x24fc('0x47')]['state'][_0x24fc('0x6e')]())[_0x24fc('0x37')](_0x24fc('0x70'))[_0x24fc('0x37')](_0x24fc('0x71'),squel[_0x24fc('0x72')]()['field']('phone')[_0x24fc('0x73')]('cm_hopper')[_0x24fc('0x37')]('VoiceQueueId\x20=\x20?',_0x698283['params']['id'][_0x24fc('0x6e')]()))[_0x24fc('0x37')](_0x24fc('0x71'),squel[_0x24fc('0x72')]()[_0x24fc('0x3d')](_0x24fc('0x74'))[_0x24fc('0x73')](_0x24fc('0x6d'))['where'](_0x24fc('0x75'),_0x698283[_0x24fc('0x43')]['id']['toString']())['where'](_0x24fc('0x76')))[_0x24fc('0x77')](_0x24fc('0x64')))[_0x24fc('0x6e')]();return db[_0x24fc('0x4a')]['query'](_0x51b1c0);}return[];})[_0x24fc('0x25')](respondWithResult(_0x246ef1,null))[_0x24fc('0x41')](handleError(_0x246ef1,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x13ab57,_0x400fa7,_0x235ae2){return db['Campaign'][_0x24fc('0x45')]({'where':{'id':_0x13ab57[_0x24fc('0x43')]['id']}})[_0x24fc('0x25')](handleEntityNotFound(_0x400fa7,null))[_0x24fc('0x25')](function(_0x1ca1bb){var _0x1ce8cb;if(_0x1ca1bb){_0x1ce8cb=squel[_0x24fc('0x5f')]()[_0x24fc('0x60')](_0x24fc('0x61'))['fromQuery']([_0x24fc('0x62'),_0x24fc('0x63'),_0x24fc('0x64'),'ListId','CampaignId','createdAt',_0x24fc('0x78')],squel['select']()[_0x24fc('0x3d')](_0x24fc('0x65'),'phone')[_0x24fc('0x3d')]('NOW()',_0x24fc('0x63'))['field'](_0x24fc('0x66'),_0x24fc('0x64'))[_0x24fc('0x3d')](_0x24fc('0x67'),_0x24fc('0x68'))[_0x24fc('0x3d')]('ANY_VALUE(CampaignId)',_0x24fc('0x79'))[_0x24fc('0x3d')](_0x24fc('0x6c'),_0x24fc('0x6b'))[_0x24fc('0x3d')](_0x24fc('0x6c'),_0x24fc('0x78'))[_0x24fc('0x73')](_0x24fc('0x6d'))['where'](_0x24fc('0x7a'),_0x13ab57[_0x24fc('0x43')]['id'][_0x24fc('0x6e')]())[_0x24fc('0x37')]('state\x20=\x20?',_0x13ab57[_0x24fc('0x47')][_0x24fc('0x7b')][_0x24fc('0x6e')]())['where'](_0x24fc('0x70'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x24fc('0x3d')]('phone')[_0x24fc('0x73')](_0x24fc('0x61'))[_0x24fc('0x37')](_0x24fc('0x7a'),_0x13ab57['params']['id'][_0x24fc('0x6e')]()))[_0x24fc('0x37')](_0x24fc('0x71'),squel[_0x24fc('0x72')]()[_0x24fc('0x3d')]('calleridnum')[_0x24fc('0x73')](_0x24fc('0x6d'))[_0x24fc('0x37')](_0x24fc('0x7a'),_0x13ab57['params']['id']['toString']())[_0x24fc('0x37')](_0x24fc('0x76')))[_0x24fc('0x77')](_0x24fc('0x64')))[_0x24fc('0x6e')]();return db['sequelize'][_0x24fc('0x2d')](_0x1ce8cb);}return[];})[_0x24fc('0x25')](respondWithResult(_0x400fa7,null))[_0x24fc('0x41')](handleError(_0x400fa7,null));};exports['checkContactHopper']=function(_0xa8881f,_0x69a2cd,_0x437233){return db[_0x24fc('0x7c')][_0x24fc('0x7d')]({'where':{'VoiceQueueId':_0xa8881f['body']['VoiceQueueId'],'CampaignId':_0xa8881f['body'][_0x24fc('0x79')],'ContactId':_0xa8881f[_0x24fc('0x47')][_0x24fc('0x64')]}})[_0x24fc('0x25')](handleEntityNotFound(_0x69a2cd,null))[_0x24fc('0x25')](function(_0x2ac3e8){if(_0x2ac3e8){return _0x2ac3e8;}return null;})[_0x24fc('0x25')](respondWithResult(_0x69a2cd,null))[_0x24fc('0x41')](handleError(_0x69a2cd,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 60accd7..565e705 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 _0xdb28=['../../config/logger','api','bluebird','request-promise','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x37f40e,_0x5c5a1d){var _0x1bab3f=function(_0x3a5eb9){while(--_0x3a5eb9){_0x37f40e['push'](_0x37f40e['shift']());}};_0x1bab3f(++_0x5c5a1d);}(_0xdb28,0x106));var _0x8db2=function(_0x4c29a5,_0x2a867f){_0x4c29a5=_0x4c29a5-0x0;var _0x142c19=_0xdb28[_0x4c29a5];return _0x142c19;};'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 attributes=require(_0x8db2('0x6'));module[_0x8db2('0x7')]=function(_0x11109e,_0x52bf99){return _0x11109e[_0x8db2('0x8')](_0x8db2('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x8db2('0xa')]},{'name':_0x8db2('0xb'),'fields':[_0x8db2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57ca=['util','../../config/logger','moment','bluebird','request-promise','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x57ca,0x108));var _0xa57c=function(_0x29a7d1,_0x513ff3){_0x29a7d1=_0x29a7d1-0x0;var _0x408c79=_0x57ca[_0x29a7d1];return _0x408c79;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var attributes=require(_0xa57c('0x5'));module[_0xa57c('0x6')]=function(_0x48be2d,_0x40ba22){return _0x48be2d[_0xa57c('0x7')](_0xa57c('0x8'),attributes,{'tableName':_0xa57c('0x9'),'paranoid':![],'indexes':[{'name':_0xa57c('0xa'),'fields':[_0xa57c('0xa')]},{'name':_0xa57c('0xb'),'fields':[_0xa57c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 3d7af1b..e1c4873 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 _0xa75b=['client','http','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CmHopperFinal','create','options','CreateCmHopperFinal','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa75b,0x170));var _0xba75=function(_0x5dd4e1,_0x85247e){_0x5dd4e1=_0x5dd4e1-0x0;var _0x58695a=_0xa75b[_0x5dd4e1];return _0x58695a;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});}exports['CreateCmHopperFinal']=function(_0x2822af){var _0xd8850f=this;return new Promise(function(_0xc4bf17,_0x132750){return db[_0xba75('0x16')][_0xba75('0x17')](_0x2822af['body'],{'raw':_0x2822af[_0xba75('0x18')]?_0x2822af[_0xba75('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x35ffd2){logger[_0xba75('0x14')]('CreateCmHopperFinal',_0x2822af);logger['debug'](_0xba75('0x19'),_0x2822af,JSON['stringify'](_0x35ffd2));_0xc4bf17(_0x35ffd2);})[_0xba75('0x1a')](function(_0x2ece41){logger[_0xba75('0x11')]('CreateCmHopperFinal',_0x2ece41[_0xba75('0x13')],_0x2822af);_0x132750(_0xd8850f[_0xba75('0x11')](0x1f4,_0x2ece41[_0xba75('0x13')]));});});}; \ No newline at end of file +var _0xaa88=['debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','CmHopperFinal,\x20%s,\x20%s','message','result','catch','create','body','options','CreateCmHopperFinal','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent'];(function(_0x663d33,_0xa05498){var _0x6dbcde=function(_0x1b0710){while(--_0x1b0710){_0x663d33['push'](_0x663d33['shift']());}};_0x6dbcde(++_0xa05498);}(_0xaa88,0x137));var _0x8aa8=function(_0x4df85c,_0x248dfb){_0x4df85c=_0x4df85c-0x0;var _0x4e2a61=_0xaa88[_0x4df85c];return _0x4e2a61;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});}exports['CreateCmHopperFinal']=function(_0x2c1b9a){var _0x49d80d=this;return new Promise(function(_0x557adc,_0xab7af5){return db['CmHopperFinal'][_0x8aa8('0x15')](_0x2c1b9a[_0x8aa8('0x16')],{'raw':_0x2c1b9a[_0x8aa8('0x17')]?_0x2c1b9a[_0x8aa8('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x8aa8('0xb')](function(_0x36c445){logger[_0x8aa8('0xc')](_0x8aa8('0x18'),_0x2c1b9a);logger[_0x8aa8('0xe')](_0x8aa8('0x18'),_0x2c1b9a,JSON['stringify'](_0x36c445));_0x557adc(_0x36c445);})[_0x8aa8('0x14')](function(_0x4cc455){logger[_0x8aa8('0x10')]('CreateCmHopperFinal',_0x4cc455[_0x8aa8('0x12')],_0x2c1b9a);_0xab7af5(_0x49d80d['error'](0x1f4,_0x4cc455[_0x8aa8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 5250899..c3f92d3 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 _0x3e74=['isAuthenticated','index','describe','/:id','countContactsQueueCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','update','exports','multer','path','connect-timeout','express','../../components/interaction/service','./cmHopperFinal.controller','get'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0x3e74,0x175));var _0x43e7=function(_0x3102f0,_0x462a77){_0x3102f0=_0x3102f0-0x0;var _0x52a4a2=_0x3e74[_0x3102f0];return _0x52a4a2;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0x6')]('/campaign/countAttributes/:id',auth[_0x43e7('0x7')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x43e7('0xc')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xc')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x43e7('0x10'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);router['put']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);module[_0x43e7('0x13')]=router; \ No newline at end of file +var _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update'];(function(_0x469492,_0x2d5107){var _0x22dfda=function(_0x1d0107){while(--_0x1d0107){_0x469492['push'](_0x469492['shift']());}};_0x22dfda(++_0x2d5107);}(_0x34e8,0x12c));var _0x834e=function(_0x1ae35e,_0x2edfb5){_0x1ae35e=_0x1ae35e-0x0;var _0x32d49e=_0x34e8[_0x1ae35e];return _0x32d49e;};'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')]('/describe',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0x9')](_0x834e('0xe'),auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x9')](_0x834e('0x10'),auth[_0x834e('0xa')](),controller[_0x834e('0x11')]);router[_0x834e('0x12')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x834e('0x12')](_0x834e('0x14'),auth['isAuthenticated'](),controller[_0x834e('0x15')]);router[_0x834e('0x12')](_0x834e('0x16'),auth[_0x834e('0xa')](),controller['checkContactHopper']);router[_0x834e('0x17')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f7325a5..a738288 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 _0x885a=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x44d01b,_0x4218b1){var _0x11822b=function(_0x3071b4){while(--_0x3071b4){_0x44d01b['push'](_0x44d01b['shift']());}};_0x11822b(++_0x4218b1);}(_0x885a,0x180));var _0xa885=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x885a[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xa885('0x0')]={'state':{'type':Sequelize[_0xa885('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa885('0x2')]},'scheduledat':{'type':Sequelize[_0xa885('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa885('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa885('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa885('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa885('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xa885('0x2')]},'originatecalleridname':{'type':Sequelize[_0xa885('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa885('0x2')]},'starttime':{'type':Sequelize[_0xa885('0x3')]},'responsetime':{'type':Sequelize[_0xa885('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xa885('0x3')]},'endtime':{'type':Sequelize[_0xa885('0x3')]},'ringtime':{'type':Sequelize[_0xa885('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa885('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa885('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa885('0x2')]},'campaign':{'type':Sequelize[_0xa885('0x2')]},'campaigntype':{'type':Sequelize[_0xa885('0x2')]},'membername':{'type':Sequelize[_0xa885('0x2')]},'reason':{'type':Sequelize[_0xa885('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xa885('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xa885('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa885('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa885('0x3')]},'recallme':{'type':Sequelize[_0xa885('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa885('0x3')]},'edited':{'type':Sequelize[_0xa885('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x5a2a=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x107cf5,_0x9fea45){var _0x2bd836=function(_0x10ac93){while(--_0x10ac93){_0x107cf5['push'](_0x107cf5['shift']());}};_0x2bd836(++_0x9fea45);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x5d698f,_0x20cccf){_0x5d698f=_0x5d698f-0x0;var _0x5099d0=_0x5a2a[_0x5d698f];return _0x5099d0;};'use strict';var Sequelize=require(_0xa5a2('0x0'));module[_0xa5a2('0x1')]={'state':{'type':Sequelize[_0xa5a2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa5a2('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa5a2('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa5a2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xa5a2('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa5a2('0x3')]},'calleridnum':{'type':Sequelize[_0xa5a2('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xa5a2('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa5a2('0x4')]},'droptime':{'type':Sequelize[_0xa5a2('0x4')]},'endtime':{'type':Sequelize[_0xa5a2('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa5a2('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa5a2('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa5a2('0x3')]},'campaign':{'type':Sequelize[_0xa5a2('0x3')]},'campaigntype':{'type':Sequelize[_0xa5a2('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xa5a2('0x3')]},'amd':{'type':Sequelize[_0xa5a2('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa5a2('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xa5a2('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa5a2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa5a2('0x4')]},'recallme':{'type':Sequelize[_0xa5a2('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'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 e7d8b79..3a0c1b4 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 _0x225c=['error','stack','name','send','index','CmHopperHistory','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','key','VIRTUAL','field','merge','count','includeAll','include','findAll','catch','show','params','options','find','create','body','describe','uniqueid','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','offset','status','set','json','apply','reject','save','update','then'];(function(_0x3898f1,_0x213649){var _0xfc6f9a=function(_0x3b5002){while(--_0x3b5002){_0x3898f1['push'](_0x3898f1['shift']());}};_0xfc6f9a(++_0x213649);}(_0x225c,0x106));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0xc225('0x0'));var emlformat=require(_0xc225('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc225('0x2'));var rp=require('request-promise');var moment=require(_0xc225('0x3'));var BPromise=require(_0xc225('0x4'));var Mustache=require(_0xc225('0x5'));var util=require(_0xc225('0x6'));var path=require(_0xc225('0x7'));var sox=require(_0xc225('0x8'));var csv=require(_0xc225('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc225('0xa'));var squel=require(_0xc225('0xb'));var crypto=require(_0xc225('0xc'));var jsforce=require(_0xc225('0xd'));var deskjs=require(_0xc225('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc225('0xf'));var Papa=require('papaparse');var authService=require(_0xc225('0x10'));var hardwareService=require(_0xc225('0x11'));var Redis=require(_0xc225('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0xc225('0x13'))(_0xc225('0x14'));var utils=require(_0xc225('0x15'));var config=require(_0xc225('0x16'));var db=require(_0xc225('0x17'))['db'];function respondWithStatusCode(_0x5797e3,_0x34f8c9){_0x34f8c9=_0x34f8c9||0xcc;return function(_0x460f86){if(_0x460f86){return _0x5797e3['sendStatus'](_0x34f8c9);}return _0x5797e3['status'](_0x34f8c9)[_0xc225('0x18')]();};}function respondWithResult(_0x3dc064,_0x2c53af){_0x2c53af=_0x2c53af||0xc8;return function(_0x5a3e02){if(_0x5a3e02){return _0x3dc064['status'](_0x2c53af)['json'](_0x5a3e02);}};}function respondWithFilteredResult(_0x57685c,_0x56727b){return function(_0x4d55be){if(_0x4d55be){var _0xe950b8=_0x4d55be['count'],_0x40b1a6=_0x56727b['offset'],_0x520049=_0x56727b[_0xc225('0x19')]+_0x56727b['limit'],_0x1bc1ef;if(_0x520049>=_0xe950b8){_0x520049=_0xe950b8;_0x1bc1ef=0xc8;}else{_0x1bc1ef=0xce;}_0x57685c[_0xc225('0x1a')](_0x1bc1ef);return _0x57685c[_0xc225('0x1b')]('Content-Range',_0x40b1a6+'-'+_0x520049+'/'+_0xe950b8)[_0xc225('0x1c')](_0x4d55be);}return null;};}function patchUpdates(_0x203877){return function(_0x3a92b){try{jsonpatch[_0xc225('0x1d')](_0x3a92b,_0x203877,!![]);}catch(_0x14e2a0){return BPromise[_0xc225('0x1e')](_0x14e2a0);}return _0x3a92b[_0xc225('0x1f')]();};}function saveUpdates(_0x48f42c,_0xcae4a1){return function(_0x1efef5){if(_0x1efef5){return _0x1efef5[_0xc225('0x20')](_0x48f42c)[_0xc225('0x21')](function(_0x571841){return _0x571841;});}return null;};}function removeEntity(_0x2de910,_0x5a108d){return function(_0x45a276){if(_0x45a276){return _0x45a276['destroy']()[_0xc225('0x21')](function(){_0x2de910[_0xc225('0x1a')](0xcc)[_0xc225('0x18')]();});}};}function handleEntityNotFound(_0x54000c,_0x5cede3){return function(_0x5572e4){if(!_0x5572e4){_0x54000c['sendStatus'](0x194);}return _0x5572e4;};}function handleError(_0x1b5d5b,_0x563732){_0x563732=_0x563732||0x1f4;return function(_0x347247){logger[_0xc225('0x22')](_0x347247[_0xc225('0x23')]);if(_0x347247[_0xc225('0x24')]){delete _0x347247[_0xc225('0x24')];}_0x1b5d5b[_0xc225('0x1a')](_0x563732)[_0xc225('0x25')](_0x347247);};}exports[_0xc225('0x26')]=function(_0x3c121f,_0x5d54f8){var _0x76b9={},_0x4e9cee={},_0x1caf12={'count':0x0,'rows':[]};var _0x22bffe=db[_0xc225('0x27')][_0xc225('0x28')];_0x4e9cee[_0xc225('0x29')]=_[_0xc225('0x2a')](_0x22bffe);_0x4e9cee[_0xc225('0x2b')]=_[_0xc225('0x2a')](_0x3c121f['query']);_0x4e9cee[_0xc225('0x2c')]=_[_0xc225('0x2d')](_0x4e9cee['model'],_0x4e9cee[_0xc225('0x2b')]);_0x76b9[_0xc225('0x2e')]=_['intersection'](_0x4e9cee[_0xc225('0x29')],qs[_0xc225('0x2f')](_0x3c121f[_0xc225('0x2b')]['fields']));_0x76b9['attributes']=_0x76b9[_0xc225('0x2e')][_0xc225('0x30')]?_0x76b9[_0xc225('0x2e')]:_0x4e9cee[_0xc225('0x29')];if(!_0x3c121f[_0xc225('0x2b')][_0xc225('0x31')](_0xc225('0x32'))){_0x76b9[_0xc225('0x33')]=qs[_0xc225('0x33')](_0x3c121f[_0xc225('0x2b')][_0xc225('0x33')]);_0x76b9[_0xc225('0x19')]=qs[_0xc225('0x19')](_0x3c121f[_0xc225('0x2b')][_0xc225('0x19')]);}_0x76b9[_0xc225('0x34')]=qs['sort'](_0x3c121f[_0xc225('0x2b')][_0xc225('0x35')]);_0x76b9[_0xc225('0x36')]=qs[_0xc225('0x2c')](_['pick'](_0x3c121f[_0xc225('0x2b')],_0x4e9cee[_0xc225('0x2c')]));if(_0x3c121f['query'][_0xc225('0x37')]){_0x76b9[_0xc225('0x36')]=_['merge'](_0x76b9[_0xc225('0x36')],{'$or':_['map'](_0x22bffe,function(_0x28a7da){if(_0x28a7da[_0xc225('0x38')][_0xc225('0x39')]!==_0xc225('0x3a')){var _0x15c206={};_0x15c206[_0x28a7da[_0xc225('0x3b')]]={'$like':'%'+_0x3c121f[_0xc225('0x2b')][_0xc225('0x37')]+'%'};return _0x15c206;}})});}_0x76b9=_[_0xc225('0x3c')]({},_0x76b9,_0x3c121f['options']);var _0x1c2ca0={'where':_0x76b9[_0xc225('0x36')]};return db['CmHopperHistory'][_0xc225('0x3d')](_0x1c2ca0)[_0xc225('0x21')](function(_0x263432){_0x1caf12[_0xc225('0x3d')]=_0x263432;if(_0x3c121f[_0xc225('0x2b')][_0xc225('0x3e')]){_0x76b9[_0xc225('0x3f')]=[{'all':!![]}];}return db[_0xc225('0x27')][_0xc225('0x40')](_0x76b9);})[_0xc225('0x21')](function(_0x764bc8){_0x1caf12['rows']=_0x764bc8;return _0x1caf12;})[_0xc225('0x21')](respondWithFilteredResult(_0x5d54f8,_0x76b9))[_0xc225('0x41')](handleError(_0x5d54f8,null));};exports[_0xc225('0x42')]=function(_0x42cad1,_0x36d1e6){var _0x4c17f8={'raw':!![],'where':{'id':_0x42cad1[_0xc225('0x43')]['id']}},_0x55241c={};_0x55241c['model']=_[_0xc225('0x2a')](db[_0xc225('0x27')][_0xc225('0x28')]);_0x55241c[_0xc225('0x2b')]=_[_0xc225('0x2a')](_0x42cad1['query']);_0x55241c[_0xc225('0x2c')]=_[_0xc225('0x2d')](_0x55241c[_0xc225('0x29')],_0x55241c[_0xc225('0x2b')]);_0x4c17f8[_0xc225('0x2e')]=_[_0xc225('0x2d')](_0x55241c[_0xc225('0x29')],qs[_0xc225('0x2f')](_0x42cad1[_0xc225('0x2b')]['fields']));_0x4c17f8['attributes']=_0x4c17f8['attributes'][_0xc225('0x30')]?_0x4c17f8[_0xc225('0x2e')]:_0x55241c[_0xc225('0x29')];if(_0x42cad1['query'][_0xc225('0x3e')]){_0x4c17f8[_0xc225('0x3f')]=[{'all':!![]}];}_0x4c17f8=_['merge']({},_0x4c17f8,_0x42cad1[_0xc225('0x44')]);return db[_0xc225('0x27')][_0xc225('0x45')](_0x4c17f8)[_0xc225('0x21')](handleEntityNotFound(_0x36d1e6,null))['then'](respondWithResult(_0x36d1e6,null))['catch'](handleError(_0x36d1e6,null));};exports[_0xc225('0x46')]=function(_0xedff27,_0x109fb9){return db[_0xc225('0x27')]['create'](_0xedff27[_0xc225('0x47')],{})[_0xc225('0x21')](respondWithResult(_0x109fb9,0xc9))[_0xc225('0x41')](handleError(_0x109fb9,null));};exports['describe']=function(_0x550830,_0x5358a1){return db[_0xc225('0x27')][_0xc225('0x48')]()[_0xc225('0x21')](respondWithResult(_0x5358a1,null))[_0xc225('0x41')](handleError(_0x5358a1,null));};exports[_0xc225('0x20')]=function(_0xa6359,_0x55e40c){if(_0xa6359[_0xc225('0x47')]['uniqueid']){delete _0xa6359[_0xc225('0x47')][_0xc225('0x49')];}return db['CmHopperHistory'][_0xc225('0x45')]({'where':{'uniqueid':_0xa6359['params']['id']}})[_0xc225('0x21')](handleEntityNotFound(_0x55e40c,null))[_0xc225('0x21')](saveUpdates(_0xa6359[_0xc225('0x47')],null))[_0xc225('0x21')](respondWithResult(_0x55e40c,null))[_0xc225('0x41')](handleError(_0x55e40c,null));}; \ No newline at end of file +var _0x4b81=['catch','show','params','find','create','body','describe','uniqueid','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','CmHopperHistory','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','rows'];(function(_0x4bb593,_0x272ed0){var _0x2da2d8=function(_0x4b25e9){while(--_0x4b25e9){_0x4bb593['push'](_0x4bb593['shift']());}};_0x2da2d8(++_0x272ed0);}(_0x4b81,0x9e));var _0x14b8=function(_0x7d3039,_0x63151b){_0x7d3039=_0x7d3039-0x0;var _0x24031e=_0x4b81[_0x7d3039];return _0x24031e;};'use strict';var pdf=require(_0x14b8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x14b8('0x1'));var zipdir=require(_0x14b8('0x2'));var jsonpatch=require(_0x14b8('0x3'));var rp=require(_0x14b8('0x4'));var moment=require('moment');var BPromise=require(_0x14b8('0x5'));var Mustache=require(_0x14b8('0x6'));var util=require(_0x14b8('0x7'));var path=require(_0x14b8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x14b8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x14b8('0xa'));var crypto=require(_0x14b8('0xb'));var jsforce=require(_0x14b8('0xc'));var deskjs=require(_0x14b8('0xd'));var toCsv=require(_0x14b8('0xe'));var querystring=require(_0x14b8('0xf'));var Papa=require(_0x14b8('0x10'));var authService=require(_0x14b8('0x11'));var hardwareService=require(_0x14b8('0x12'));var Redis=require('ioredis');var qs=require(_0x14b8('0x13'));var logger=require(_0x14b8('0x14'))(_0x14b8('0x15'));var utils=require(_0x14b8('0x16'));var config=require(_0x14b8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11ec47,_0x2b8da3){_0x2b8da3=_0x2b8da3||0xcc;return function(_0x1ef206){if(_0x1ef206){return _0x11ec47[_0x14b8('0x18')](_0x2b8da3);}return _0x11ec47[_0x14b8('0x19')](_0x2b8da3)[_0x14b8('0x1a')]();};}function respondWithResult(_0x5df8ef,_0xd43df7){_0xd43df7=_0xd43df7||0xc8;return function(_0x17de92){if(_0x17de92){return _0x5df8ef['status'](_0xd43df7)[_0x14b8('0x1b')](_0x17de92);}};}function respondWithFilteredResult(_0x10e778,_0x2bb9ab){return function(_0xaa6281){if(_0xaa6281){var _0x85b431=_0xaa6281[_0x14b8('0x1c')],_0x5a6a11=_0x2bb9ab[_0x14b8('0x1d')],_0x1eb9f6=_0x2bb9ab[_0x14b8('0x1d')]+_0x2bb9ab[_0x14b8('0x1e')],_0xe02bb9;if(_0x1eb9f6>=_0x85b431){_0x1eb9f6=_0x85b431;_0xe02bb9=0xc8;}else{_0xe02bb9=0xce;}_0x10e778[_0x14b8('0x19')](_0xe02bb9);return _0x10e778['set'](_0x14b8('0x1f'),_0x5a6a11+'-'+_0x1eb9f6+'/'+_0x85b431)['json'](_0xaa6281);}return null;};}function patchUpdates(_0x76b8bc){return function(_0x1fbfc5){try{jsonpatch[_0x14b8('0x20')](_0x1fbfc5,_0x76b8bc,!![]);}catch(_0x1b72b8){return BPromise[_0x14b8('0x21')](_0x1b72b8);}return _0x1fbfc5[_0x14b8('0x22')]();};}function saveUpdates(_0x174dc8,_0x86fe3e){return function(_0x1aef32){if(_0x1aef32){return _0x1aef32[_0x14b8('0x23')](_0x174dc8)[_0x14b8('0x24')](function(_0x993731){return _0x993731;});}return null;};}function removeEntity(_0x2b49f2,_0x587177){return function(_0xc17b48){if(_0xc17b48){return _0xc17b48[_0x14b8('0x25')]()[_0x14b8('0x24')](function(){_0x2b49f2[_0x14b8('0x19')](0xcc)[_0x14b8('0x1a')]();});}};}function handleEntityNotFound(_0x11418a,_0x535b0b){return function(_0x538864){if(!_0x538864){_0x11418a[_0x14b8('0x18')](0x194);}return _0x538864;};}function handleError(_0x45959b,_0x469bce){_0x469bce=_0x469bce||0x1f4;return function(_0x218a60){logger['error'](_0x218a60[_0x14b8('0x26')]);if(_0x218a60[_0x14b8('0x27')]){delete _0x218a60[_0x14b8('0x27')];}_0x45959b[_0x14b8('0x19')](_0x469bce)[_0x14b8('0x28')](_0x218a60);};}exports[_0x14b8('0x29')]=function(_0x200191,_0x448220){var _0x4241fb={},_0x52f224={},_0x13bb91={'count':0x0,'rows':[]};var _0x5dd77c=db[_0x14b8('0x2a')]['rawAttributes'];_0x52f224['model']=_[_0x14b8('0x2b')](_0x5dd77c);_0x52f224[_0x14b8('0x2c')]=_[_0x14b8('0x2b')](_0x200191['query']);_0x52f224[_0x14b8('0x2d')]=_['intersection'](_0x52f224[_0x14b8('0x2e')],_0x52f224['query']);_0x4241fb['attributes']=_[_0x14b8('0x2f')](_0x52f224[_0x14b8('0x2e')],qs[_0x14b8('0x30')](_0x200191['query'][_0x14b8('0x30')]));_0x4241fb[_0x14b8('0x31')]=_0x4241fb[_0x14b8('0x31')]['length']?_0x4241fb[_0x14b8('0x31')]:_0x52f224['model'];if(!_0x200191[_0x14b8('0x2c')][_0x14b8('0x32')](_0x14b8('0x33'))){_0x4241fb[_0x14b8('0x1e')]=qs[_0x14b8('0x1e')](_0x200191[_0x14b8('0x2c')][_0x14b8('0x1e')]);_0x4241fb['offset']=qs['offset'](_0x200191[_0x14b8('0x2c')]['offset']);}_0x4241fb[_0x14b8('0x34')]=qs[_0x14b8('0x35')](_0x200191[_0x14b8('0x2c')][_0x14b8('0x35')]);_0x4241fb['where']=qs[_0x14b8('0x2d')](_[_0x14b8('0x36')](_0x200191[_0x14b8('0x2c')],_0x52f224[_0x14b8('0x2d')]));if(_0x200191[_0x14b8('0x2c')]['filter']){_0x4241fb[_0x14b8('0x37')]=_[_0x14b8('0x38')](_0x4241fb[_0x14b8('0x37')],{'$or':_['map'](_0x5dd77c,function(_0x4d048b){if(_0x4d048b[_0x14b8('0x39')][_0x14b8('0x3a')]!==_0x14b8('0x3b')){var _0x2f7924={};_0x2f7924[_0x4d048b[_0x14b8('0x3c')]]={'$like':'%'+_0x200191[_0x14b8('0x2c')][_0x14b8('0x3d')]+'%'};return _0x2f7924;}})});}_0x4241fb=_['merge']({},_0x4241fb,_0x200191[_0x14b8('0x3e')]);var _0x129997={'where':_0x4241fb[_0x14b8('0x37')]};return db[_0x14b8('0x2a')][_0x14b8('0x1c')](_0x129997)[_0x14b8('0x24')](function(_0x5c4682){_0x13bb91[_0x14b8('0x1c')]=_0x5c4682;if(_0x200191[_0x14b8('0x2c')][_0x14b8('0x3f')]){_0x4241fb[_0x14b8('0x40')]=[{'all':!![]}];}return db[_0x14b8('0x2a')][_0x14b8('0x41')](_0x4241fb);})['then'](function(_0x1444d1){_0x13bb91[_0x14b8('0x42')]=_0x1444d1;return _0x13bb91;})[_0x14b8('0x24')](respondWithFilteredResult(_0x448220,_0x4241fb))[_0x14b8('0x43')](handleError(_0x448220,null));};exports[_0x14b8('0x44')]=function(_0x469f68,_0x7451cf){var _0x2ed496={'raw':!![],'where':{'id':_0x469f68[_0x14b8('0x45')]['id']}},_0x20c7d8={};_0x20c7d8['model']=_[_0x14b8('0x2b')](db['CmHopperHistory']['rawAttributes']);_0x20c7d8[_0x14b8('0x2c')]=_[_0x14b8('0x2b')](_0x469f68[_0x14b8('0x2c')]);_0x20c7d8[_0x14b8('0x2d')]=_[_0x14b8('0x2f')](_0x20c7d8[_0x14b8('0x2e')],_0x20c7d8['query']);_0x2ed496[_0x14b8('0x31')]=_[_0x14b8('0x2f')](_0x20c7d8[_0x14b8('0x2e')],qs[_0x14b8('0x30')](_0x469f68['query'][_0x14b8('0x30')]));_0x2ed496[_0x14b8('0x31')]=_0x2ed496[_0x14b8('0x31')]['length']?_0x2ed496['attributes']:_0x20c7d8[_0x14b8('0x2e')];if(_0x469f68['query'][_0x14b8('0x3f')]){_0x2ed496[_0x14b8('0x40')]=[{'all':!![]}];}_0x2ed496=_['merge']({},_0x2ed496,_0x469f68[_0x14b8('0x3e')]);return db[_0x14b8('0x2a')][_0x14b8('0x46')](_0x2ed496)[_0x14b8('0x24')](handleEntityNotFound(_0x7451cf,null))[_0x14b8('0x24')](respondWithResult(_0x7451cf,null))['catch'](handleError(_0x7451cf,null));};exports['create']=function(_0x18630f,_0x30a6a3){return db[_0x14b8('0x2a')][_0x14b8('0x47')](_0x18630f[_0x14b8('0x48')],{})[_0x14b8('0x24')](respondWithResult(_0x30a6a3,0xc9))[_0x14b8('0x43')](handleError(_0x30a6a3,null));};exports[_0x14b8('0x49')]=function(_0x7029e1,_0x2d54a1){return db[_0x14b8('0x2a')][_0x14b8('0x49')]()[_0x14b8('0x24')](respondWithResult(_0x2d54a1,null))[_0x14b8('0x43')](handleError(_0x2d54a1,null));};exports[_0x14b8('0x23')]=function(_0x5cd770,_0x4e15db){if(_0x5cd770['body'][_0x14b8('0x4a')]){delete _0x5cd770[_0x14b8('0x48')][_0x14b8('0x4a')];}return db['CmHopperHistory'][_0x14b8('0x46')]({'where':{'uniqueid':_0x5cd770[_0x14b8('0x45')]['id']}})[_0x14b8('0x24')](handleEntityNotFound(_0x4e15db,null))['then'](saveUpdates(_0x5cd770[_0x14b8('0x48')],null))['then'](respondWithResult(_0x4e15db,null))['catch'](handleError(_0x4e15db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 3d34eab..9c55626 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 _0x9662=['define','CmHopperHistory','endtime','lodash','../../config/logger','bluebird','request-promise','./cmHopperHistory.attributes','exports'];(function(_0x1be402,_0x5e7b01){var _0x49411d=function(_0x1ab9e4){while(--_0x1ab9e4){_0x1be402['push'](_0x1be402['shift']());}};_0x49411d(++_0x5e7b01);}(_0x9662,0x1ce));var _0x2966=function(_0x14939e,_0x15caec){_0x14939e=_0x14939e-0x0;var _0x205523=_0x9662[_0x14939e];return _0x205523;};'use strict';var _=require(_0x2966('0x0'));var util=require('util');var logger=require(_0x2966('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2966('0x2'));var rp=require(_0x2966('0x3'));var attributes=require(_0x2966('0x4'));module[_0x2966('0x5')]=function(_0x4c6bc0,_0xc7d6e9){return _0x4c6bc0[_0x2966('0x6')](_0x2966('0x7'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x2966('0x8'),'fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4299=['moment','request-promise','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api'];(function(_0x1c5996,_0x29f34){var _0x494f32=function(_0x4cdeba){while(--_0x4cdeba){_0x1c5996['push'](_0x1c5996['shift']());}};_0x494f32(++_0x29f34);}(_0x4299,0x131));var _0x9429=function(_0x8ef005,_0x2efb81){_0x8ef005=_0x8ef005-0x0;var _0x2726a1=_0x4299[_0x8ef005];return _0x2726a1;};'use strict';var _=require(_0x9429('0x0'));var util=require(_0x9429('0x1'));var logger=require('../../config/logger')(_0x9429('0x2'));var moment=require(_0x9429('0x3'));var BPromise=require('bluebird');var rp=require(_0x9429('0x4'));var attributes=require(_0x9429('0x5'));module[_0x9429('0x6')]=function(_0x40477b,_0x4bf1ca){return _0x40477b['define'](_0x9429('0x7'),attributes,{'tableName':_0x9429('0x8'),'paranoid':![],'indexes':[{'name':_0x9429('0x9'),'fields':[_0x9429('0x9')]},{'name':_0x9429('0xa'),'fields':[_0x9429('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 0cd02c8..7e54088 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 _0xf675=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopperHistory','options','info','CreateCmHopperHistory','debug','AvgHandleTime','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash'];(function(_0x58d190,_0x56f556){var _0xb85bb8=function(_0x2773dd){while(--_0x2773dd){_0x58d190['push'](_0x58d190['shift']());}};_0xb85bb8(++_0x56f556);}(_0xf675,0x15d));var _0x5f67=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xf675[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var moment=require(_0x5f67('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f67('0x3'));var fs=require('fs');var Redis=require(_0x5f67('0x4'));var db=require(_0x5f67('0x5'))['db'];var utils=require(_0x5f67('0x6'));var logger=require(_0x5f67('0x7'))(_0x5f67('0x8'));var config=require(_0x5f67('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5f67('0xa')][_0x5f67('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3657e8,_0x391a90,_0x5135bc){return new BPromise(function(_0x4bea3e,_0x30df1e){return client[_0x5f67('0xc')](_0x3657e8,_0x5135bc)[_0x5f67('0xd')](function(_0xd9c54a){logger['info'](_0x5f67('0xe'),_0x391a90,_0x5f67('0xf'));logger['debug'](_0x5f67('0x10'),_0x391a90,_0x5f67('0xf'),JSON[_0x5f67('0x11')](_0xd9c54a));if(_0xd9c54a[_0x5f67('0x12')]){if(_0xd9c54a[_0x5f67('0x12')]['code']===0x1f4){logger[_0x5f67('0x12')](_0x5f67('0xe'),_0x391a90,_0xd9c54a['error']['message']);return _0x30df1e(_0xd9c54a[_0x5f67('0x12')][_0x5f67('0x13')]);}logger['error'](_0x5f67('0xe'),_0x391a90,_0xd9c54a[_0x5f67('0x12')][_0x5f67('0x13')]);return _0x4bea3e(_0xd9c54a['error']['message']);}else{logger['info'](_0x5f67('0xe'),_0x391a90,_0x5f67('0xf'));_0x4bea3e(_0xd9c54a[_0x5f67('0x14')][_0x5f67('0x13')]);}})[_0x5f67('0x15')](function(_0x52a42f){logger[_0x5f67('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x391a90,_0x52a42f);_0x30df1e(_0x52a42f);});});}exports['CreateCmHopperHistory']=function(_0x33645e){var _0x555977=this;return new Promise(function(_0x199a7f,_0x357263){return db[_0x5f67('0x16')]['create'](_0x33645e['body'],{'raw':_0x33645e['options']?_0x33645e[_0x5f67('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x5f67('0xd')](function(_0x33e1c0){logger[_0x5f67('0x18')](_0x5f67('0x19'),_0x33645e);logger[_0x5f67('0x1a')](_0x5f67('0x19'),_0x33645e,JSON['stringify'](_0x33e1c0));_0x199a7f(_0x33e1c0);})[_0x5f67('0x15')](function(_0xa561f7){logger['error'](_0x5f67('0x19'),_0xa561f7[_0x5f67('0x13')],_0x33645e);_0x357263(_0x555977[_0x5f67('0x12')](0x1f4,_0xa561f7[_0x5f67('0x13')]));});});};exports[_0x5f67('0x1b')]=function(_0x3a3a8d){var _0x30e254=this;return new Promise(function(_0x9ef58b,_0x5a31e7){return db['CmHopperHistory'][_0x5f67('0x1c')]({'raw':_0x3a3a8d['options']?_0x3a3a8d[_0x5f67('0x17')][_0x5f67('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a3a8d[_0x5f67('0x17')]?_0x3a3a8d[_0x5f67('0x17')][_0x5f67('0x1e')]||null:null,'attributes':[[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db['sequelize'][_0x5f67('0x21')]('id')),_0x5f67('0x22')],[db['sequelize']['fn']('COUNT',db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')][_0x5f67('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x5f67('0x24')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db['sequelize'][_0x5f67('0x23')]('`state`\x20=\x2010,\x201,\x20null'))),_0x5f67('0x25')],[db[_0x5f67('0x1f')]['fn']('COUNT',db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')]['literal'](_0x5f67('0x26')))),_0x5f67('0x27')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x28'),db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')][_0x5f67('0x23')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x5f67('0x29')],[db['sequelize']['fn'](_0x5f67('0x28'),db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')][_0x5f67('0x23')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x5f67('0x2a')]]})[_0x5f67('0xd')](function(_0x397c79){logger[_0x5f67('0x18')](_0x5f67('0x1b'),_0x3a3a8d);logger[_0x5f67('0x1a')]('AvgHandleTime',_0x3a3a8d,JSON[_0x5f67('0x11')](_0x397c79));_0x9ef58b(_0x397c79);})[_0x5f67('0x15')](function(_0x1b57fc){logger['error'](_0x5f67('0x1b'),_0x1b57fc[_0x5f67('0x13')],_0x3a3a8d);_0x5a31e7(_0x30e254['error'](0x1f4,_0x1b57fc['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x7e7858){var _0x4c2b19=this;return new Promise(function(_0x377d91,_0x580bb4){return db[_0x5f67('0x16')][_0x5f67('0x1c')]({'raw':_0x7e7858['options']?_0x7e7858[_0x5f67('0x17')][_0x5f67('0x1d')]===undefined?!![]:![]:!![],'where':_0x7e7858['options']?_0x7e7858['options'][_0x5f67('0x1e')]||null:null,'attributes':[['campaign',_0x5f67('0x2b')],[db[_0x5f67('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5f67('0x1f')][_0x5f67('0x23')](_0x5f67('0x2c')))),_0x5f67('0x2d')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db['sequelize'][_0x5f67('0x23')](_0x5f67('0x2e')))),_0x5f67('0x2f')],[db[_0x5f67('0x1f')]['fn']('COUNT',db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')]['literal'](_0x5f67('0x30')))),_0x5f67('0x31')],[db['sequelize']['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')][_0x5f67('0x23')](_0x5f67('0x32')))),_0x5f67('0x33')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db['sequelize']['fn']('IF',db[_0x5f67('0x1f')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x5f67('0x34')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db['sequelize'][_0x5f67('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5f67('0x35')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db['sequelize'][_0x5f67('0x23')](_0x5f67('0x36')))),'outboundDropCallsDayCallersExit'],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')]['literal'](_0x5f67('0x37')))),_0x5f67('0x38')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')][_0x5f67('0x23')](_0x5f67('0x39')))),_0x5f67('0x3a')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')][_0x5f67('0x23')](_0x5f67('0x3b')))),'outboundOriginateFailureCallsDay'],[db[_0x5f67('0x1f')]['fn']('COUNT',db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')][_0x5f67('0x23')](_0x5f67('0x3c')))),_0x5f67('0x3d')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db['sequelize'][_0x5f67('0x23')](_0x5f67('0x3e')))),'outboundAnswerAgiCallsDay'],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')][_0x5f67('0x23')](_0x5f67('0x3f')))),_0x5f67('0x3d')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')][_0x5f67('0x23')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x5f67('0x40')]],'group':[_0x5f67('0x41')]})[_0x5f67('0xd')](function(_0x3fdc0e){logger[_0x5f67('0x18')](_0x5f67('0x42'),_0x7e7858);logger[_0x5f67('0x1a')](_0x5f67('0x42'),_0x7e7858,JSON[_0x5f67('0x11')](_0x3fdc0e));_0x377d91(_0x3fdc0e);})[_0x5f67('0x15')](function(_0xa70309){logger['error'](_0x5f67('0x42'),_0xa70309[_0x5f67('0x13')],_0x7e7858);_0x580bb4(_0x4c2b19[_0x5f67('0x12')](0x1f4,_0xa70309['message']));});});};exports['GetCampaignHopperHistory']=function(_0x472b69){var _0x11cd54=this;return new Promise(function(_0x33b853,_0x1cd07d){return db[_0x5f67('0x16')][_0x5f67('0x1c')]({'raw':_0x472b69[_0x5f67('0x17')]?_0x472b69[_0x5f67('0x17')][_0x5f67('0x1d')]===undefined?!![]:![]:!![],'where':_0x472b69['options']?_0x472b69[_0x5f67('0x17')][_0x5f67('0x1e')]||null:null,'attributes':[[_0x5f67('0x41'),_0x5f67('0x2b')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['col']('id')),_0x5f67('0x43')],[db[_0x5f67('0x1f')]['fn'](_0x5f67('0x20'),db[_0x5f67('0x1f')]['fn']('IF',db[_0x5f67('0x1f')][_0x5f67('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x5f67('0x44')]],'group':[_0x5f67('0x41')]})[_0x5f67('0xd')](function(_0x31f1ea){logger[_0x5f67('0x18')](_0x5f67('0x45'),_0x472b69);logger[_0x5f67('0x1a')](_0x5f67('0x45'),_0x472b69,JSON[_0x5f67('0x11')](_0x31f1ea));_0x33b853(_0x31f1ea);})[_0x5f67('0x15')](function(_0x3e1b3a){logger[_0x5f67('0x12')]('GetCampaignHopperHistory',_0x3e1b3a[_0x5f67('0x13')],_0x472b69);_0x1cd07d(_0x11cd54[_0x5f67('0x12')](0x1f4,_0x3e1b3a[_0x5f67('0x13')]));});});}; \ No newline at end of file +var _0xafc2=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','result','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','AvgHandleTime','where','COUNT','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','stringify','catch','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','bluebird'];(function(_0x5b9418,_0x37e830){var _0x5261bc=function(_0x430c18){while(--_0x430c18){_0x5b9418['push'](_0x5b9418['shift']());}};_0x5261bc(++_0x37e830);}(_0xafc2,0x10e));var _0x2afc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xafc2[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2afc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2afc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2afc('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2afc('0x3'));var logger=require('../../config/logger')(_0x2afc('0x4'));var config=require(_0x2afc('0x5'));var jayson=require(_0x2afc('0x6'));var client=jayson['client'][_0x2afc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x457b52,_0x202425,_0x22b457){return new BPromise(function(_0xe674b1,_0x5940ef){return client[_0x2afc('0x8')](_0x457b52,_0x22b457)[_0x2afc('0x9')](function(_0x2082e8){logger[_0x2afc('0xa')](_0x2afc('0xb'),_0x202425,_0x2afc('0xc'));logger[_0x2afc('0xd')](_0x2afc('0xe'),_0x202425,_0x2afc('0xc'),JSON['stringify'](_0x2082e8));if(_0x2082e8['error']){if(_0x2082e8[_0x2afc('0xf')]['code']===0x1f4){logger[_0x2afc('0xf')](_0x2afc('0xb'),_0x202425,_0x2082e8['error'][_0x2afc('0x10')]);return _0x5940ef(_0x2082e8[_0x2afc('0xf')]['message']);}logger[_0x2afc('0xf')](_0x2afc('0xb'),_0x202425,_0x2082e8['error']['message']);return _0xe674b1(_0x2082e8[_0x2afc('0xf')][_0x2afc('0x10')]);}else{logger[_0x2afc('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x202425,'request\x20sent');_0xe674b1(_0x2082e8[_0x2afc('0x11')][_0x2afc('0x10')]);}})['catch'](function(_0xa3c99a){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x202425,_0xa3c99a);_0x5940ef(_0xa3c99a);});});}exports['CreateCmHopperHistory']=function(_0x2bb0cb){var _0x10157e=this;return new Promise(function(_0x4abd9,_0x1c9828){return db[_0x2afc('0x12')][_0x2afc('0x13')](_0x2bb0cb[_0x2afc('0x14')],{'raw':_0x2bb0cb[_0x2afc('0x15')]?_0x2bb0cb[_0x2afc('0x15')][_0x2afc('0x16')]===undefined?!![]:![]:!![]})[_0x2afc('0x9')](function(_0x4dabbd){logger[_0x2afc('0xa')](_0x2afc('0x17'),_0x2bb0cb);logger['debug'](_0x2afc('0x17'),_0x2bb0cb,JSON['stringify'](_0x4dabbd));_0x4abd9(_0x4dabbd);})['catch'](function(_0x4b0eef){logger[_0x2afc('0xf')](_0x2afc('0x17'),_0x4b0eef[_0x2afc('0x10')],_0x2bb0cb);_0x1c9828(_0x10157e[_0x2afc('0xf')](0x1f4,_0x4b0eef[_0x2afc('0x10')]));});});};exports[_0x2afc('0x18')]=function(_0x2ca709){var _0x85b03e=this;return new Promise(function(_0x2a1cde,_0x300aba){return db[_0x2afc('0x12')]['findAll']({'raw':_0x2ca709[_0x2afc('0x15')]?_0x2ca709[_0x2afc('0x15')][_0x2afc('0x16')]===undefined?!![]:![]:!![],'where':_0x2ca709[_0x2afc('0x15')]?_0x2ca709[_0x2afc('0x15')][_0x2afc('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['col']('id')),_0x2afc('0x1c')],[db[_0x2afc('0x1b')]['fn']('COUNT',db[_0x2afc('0x1b')]['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x1e')))),'predictiveIntervalAnsweredCalls'],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x2afc('0x1f')],[db[_0x2afc('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x20')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x21'),db['sequelize']['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x22')))),_0x2afc('0x23')],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x21'),db['sequelize']['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x24')))),'predictiveIntervalAvgTalktime']]})[_0x2afc('0x9')](function(_0x520385){logger[_0x2afc('0xa')](_0x2afc('0x18'),_0x2ca709);logger[_0x2afc('0xd')](_0x2afc('0x18'),_0x2ca709,JSON[_0x2afc('0x25')](_0x520385));_0x2a1cde(_0x520385);})[_0x2afc('0x26')](function(_0x33f145){logger['error'](_0x2afc('0x18'),_0x33f145[_0x2afc('0x10')],_0x2ca709);_0x300aba(_0x85b03e[_0x2afc('0xf')](0x1f4,_0x33f145[_0x2afc('0x10')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x321cbf){var _0x31abf1=this;return new Promise(function(_0x1e0edb,_0x1d0b44){return db[_0x2afc('0x12')][_0x2afc('0x27')]({'raw':_0x321cbf[_0x2afc('0x15')]?_0x321cbf[_0x2afc('0x15')][_0x2afc('0x16')]===undefined?!![]:![]:!![],'where':_0x321cbf[_0x2afc('0x15')]?_0x321cbf[_0x2afc('0x15')][_0x2afc('0x19')]||null:null,'attributes':[[_0x2afc('0x28'),_0x2afc('0x29')],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db['sequelize'][_0x2afc('0x1d')](_0x2afc('0x2a')))),_0x2afc('0x2b')],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db['sequelize']['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x2c')))),_0x2afc('0x2d')],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x1e')))),_0x2afc('0x2e')],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db[_0x2afc('0x1b')]['literal'](_0x2afc('0x2f')))),_0x2afc('0x30')],[db[_0x2afc('0x1b')]['fn']('COUNT',db[_0x2afc('0x1b')]['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x31')))),_0x2afc('0x32')],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db['sequelize'][_0x2afc('0x1d')](_0x2afc('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x2afc('0x1b')]['fn']('COUNT',db[_0x2afc('0x1b')]['fn']('IF',db[_0x2afc('0x1b')]['literal'](_0x2afc('0x34')))),'outboundDropCallsDayCallersExit'],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x35')))),_0x2afc('0x36')],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x37')))),_0x2afc('0x38')],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x39')))),'outboundOriginateFailureCallsDay'],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x3a')))),_0x2afc('0x3b')],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db[_0x2afc('0x1b')]['literal'](_0x2afc('0x3c')))),_0x2afc('0x3d')],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['fn']('IF',db['sequelize'][_0x2afc('0x1d')](_0x2afc('0x3e')))),_0x2afc('0x3f')]],'group':[_0x2afc('0x28')]})['then'](function(_0x109edb){logger['info'](_0x2afc('0x40'),_0x321cbf);logger[_0x2afc('0xd')](_0x2afc('0x40'),_0x321cbf,JSON[_0x2afc('0x25')](_0x109edb));_0x1e0edb(_0x109edb);})[_0x2afc('0x26')](function(_0x36ae1c){logger['error'](_0x2afc('0x40'),_0x36ae1c['message'],_0x321cbf);_0x1d0b44(_0x31abf1[_0x2afc('0xf')](0x1f4,_0x36ae1c[_0x2afc('0x10')]));});});};exports[_0x2afc('0x41')]=function(_0x841d38){var _0x3a6038=this;return new Promise(function(_0x175017,_0x11a214){return db[_0x2afc('0x12')][_0x2afc('0x27')]({'raw':_0x841d38[_0x2afc('0x15')]?_0x841d38['options'][_0x2afc('0x16')]===undefined?!![]:![]:!![],'where':_0x841d38[_0x2afc('0x15')]?_0x841d38['options'][_0x2afc('0x19')]||null:null,'attributes':[[_0x2afc('0x28'),_0x2afc('0x29')],[db['sequelize']['fn'](_0x2afc('0x1a'),db[_0x2afc('0x1b')]['col']('id')),_0x2afc('0x42')],[db[_0x2afc('0x1b')]['fn'](_0x2afc('0x1a'),db['sequelize']['fn']('IF',db[_0x2afc('0x1b')][_0x2afc('0x1d')](_0x2afc('0x1e')))),_0x2afc('0x43')]],'group':[_0x2afc('0x28')]})[_0x2afc('0x9')](function(_0x7be444){logger[_0x2afc('0xa')](_0x2afc('0x41'),_0x841d38);logger[_0x2afc('0xd')](_0x2afc('0x41'),_0x841d38,JSON[_0x2afc('0x25')](_0x7be444));_0x175017(_0x7be444);})[_0x2afc('0x26')](function(_0x15381d){logger[_0x2afc('0xf')](_0x2afc('0x41'),_0x15381d[_0x2afc('0x10')],_0x841d38);_0x11a214(_0x3a6038[_0x2afc('0xf')](0x1f4,_0x15381d[_0x2afc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 702d3ca..c60dd29 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 _0xe9e8=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','update','exports','multer'];(function(_0x27c9cc,_0x5424c7){var _0x38f1fc=function(_0xc2e743){while(--_0xc2e743){_0x27c9cc['push'](_0x27c9cc['shift']());}};_0x38f1fc(++_0x5424c7);}(_0xe9e8,0x179));var _0x8e9e=function(_0x5781a9,_0x3dd5f2){_0x5781a9=_0x5781a9-0x0;var _0x461c34=_0xe9e8[_0x5781a9];return _0x461c34;};'use strict';var multer=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var path=require(_0x8e9e('0x2'));var timeout=require(_0x8e9e('0x3'));var express=require(_0x8e9e('0x4'));var router=express[_0x8e9e('0x5')]();var auth=require(_0x8e9e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8e9e('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x8e9e('0x8')]('/',auth[_0x8e9e('0x9')](),controller[_0x8e9e('0xa')]);router['get']('/describe',auth[_0x8e9e('0x9')](),controller[_0x8e9e('0xb')]);router[_0x8e9e('0x8')](_0x8e9e('0xc'),auth[_0x8e9e('0x9')](),controller[_0x8e9e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8e9e('0xe')]);router[_0x8e9e('0xf')](_0x8e9e('0xc'),auth[_0x8e9e('0x9')](),controller[_0x8e9e('0x10')]);module[_0x8e9e('0x11')]=router; \ No newline at end of file +var _0xa647=['put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa647,0x81));var _0x7a64=function(_0x1e0043,_0x27e7dc){_0x1e0043=_0x1e0043-0x0;var _0x3bf284=_0xa647[_0x1e0043];return _0x3bf284;};'use strict';var multer=require(_0x7a64('0x0'));var util=require(_0x7a64('0x1'));var path=require(_0x7a64('0x2'));var timeout=require(_0x7a64('0x3'));var express=require(_0x7a64('0x4'));var router=express[_0x7a64('0x5')]();var auth=require(_0x7a64('0x6'));var interaction=require(_0x7a64('0x7'));var config=require(_0x7a64('0x8'));var controller=require(_0x7a64('0x9'));router[_0x7a64('0xa')]('/',auth[_0x7a64('0xb')](),controller['index']);router[_0x7a64('0xa')](_0x7a64('0xc'),auth['isAuthenticated'](),controller[_0x7a64('0xd')]);router[_0x7a64('0xa')](_0x7a64('0xe'),auth[_0x7a64('0xb')](),controller[_0x7a64('0xf')]);router[_0x7a64('0x10')]('/',auth[_0x7a64('0xb')](),controller[_0x7a64('0x11')]);router[_0x7a64('0x12')](_0x7a64('0xe'),auth[_0x7a64('0xb')](),controller[_0x7a64('0x13')]);module[_0x7a64('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index e99ab17..f002994 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 _0xc4aa=['exports','STRING','name','sequelize'];(function(_0x2f1cc4,_0x2d730e){var _0x1dc2f2=function(_0x22a8b7){while(--_0x22a8b7){_0x2f1cc4['push'](_0x2f1cc4['shift']());}};_0x1dc2f2(++_0x2d730e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc4aa[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xac4a('0x2')]},'dialPrefix':{'type':Sequelize[_0xac4a('0x2')]}}; \ No newline at end of file +var _0x6aa7=['name','sequelize','STRING'];(function(_0x296bed,_0x3ff4e5){var _0x13e2f1=function(_0x3b007e){while(--_0x3b007e){_0x296bed['push'](_0x296bed['shift']());}};_0x13e2f1(++_0x3ff4e5);}(_0x6aa7,0x178));var _0x76aa=function(_0x3c1527,_0x5e69e0){_0x3c1527=_0x3c1527-0x0;var _0x3d852b=_0x6aa7[_0x3c1527];return _0x3d852b;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'unique':_0x76aa('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x76aa('0x1')]},'dialPrefix':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index f8e849a..25371e1 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 _0x4cbd=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','index','CmList','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','body','user','get','role','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','length','findAll','removeDispositions','ids','CmContact','tags','join','isArray','ListId','push','each','omit','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','getContactsCsv','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','findOne','sequelize','addCustomFields','Sequelize','text','TEXT','number','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils'];(function(_0x20cb5d,_0x5b6ec7){var _0x33dd23=function(_0x5918a9){while(--_0x5918a9){_0x20cb5d['push'](_0x20cb5d['shift']());}};_0x33dd23(++_0x5b6ec7);}(_0x4cbd,0x79));var _0xd4cb=function(_0x50421d,_0x2abc33){_0x50421d=_0x50421d-0x0;var _0x2f886a=_0x4cbd[_0x50421d];return _0x2f886a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd4cb('0x0'));var zipdir=require(_0xd4cb('0x1'));var jsonpatch=require(_0xd4cb('0x2'));var rp=require(_0xd4cb('0x3'));var moment=require('moment');var BPromise=require(_0xd4cb('0x4'));var Mustache=require(_0xd4cb('0x5'));var util=require(_0xd4cb('0x6'));var path=require(_0xd4cb('0x7'));var sox=require(_0xd4cb('0x8'));var csv=require(_0xd4cb('0x9'));var ejs=require(_0xd4cb('0xa'));var fs=require('fs');var _=require(_0xd4cb('0xb'));var squel=require(_0xd4cb('0xc'));var crypto=require(_0xd4cb('0xd'));var jsforce=require(_0xd4cb('0xe'));var deskjs=require(_0xd4cb('0xf'));var toCsv=require(_0xd4cb('0x9'));var querystring=require(_0xd4cb('0x10'));var Papa=require(_0xd4cb('0x11'));var authService=require(_0xd4cb('0x12'));var hardwareService=require(_0xd4cb('0x13'));var Redis=require(_0xd4cb('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0xd4cb('0x15'))(_0xd4cb('0x16'));var utils=require(_0xd4cb('0x17'));var config=require(_0xd4cb('0x18'));var db=require(_0xd4cb('0x19'))['db'];config[_0xd4cb('0x1a')]=_[_0xd4cb('0x1b')](config[_0xd4cb('0x1a')],{'host':_0xd4cb('0x1c'),'port':0x18eb});var socket=require(_0xd4cb('0x1d'))(new Redis(config[_0xd4cb('0x1a')]));require('./cmList.socket')[_0xd4cb('0x1e')](socket);function respondWithStatusCode(_0x33539f,_0xb04fb9){_0xb04fb9=_0xb04fb9||0xcc;return function(_0xa3d61f){if(_0xa3d61f){return _0x33539f[_0xd4cb('0x1f')](_0xb04fb9);}return _0x33539f[_0xd4cb('0x20')](_0xb04fb9)[_0xd4cb('0x21')]();};}function respondWithResult(_0x5e2b23,_0x237271){_0x237271=_0x237271||0xc8;return function(_0x235efa){if(_0x235efa){return _0x5e2b23[_0xd4cb('0x20')](_0x237271)[_0xd4cb('0x22')](_0x235efa);}};}function respondWithFilteredResult(_0x4a3630,_0x4496e4){return function(_0x2691db){if(_0x2691db){var _0x2f395f=_0x2691db[_0xd4cb('0x23')],_0xaf2160=_0x4496e4[_0xd4cb('0x24')],_0x2a43d1=_0x4496e4['offset']+_0x4496e4[_0xd4cb('0x25')],_0x398f23;if(_0x2a43d1>=_0x2f395f){_0x2a43d1=_0x2f395f;_0x398f23=0xc8;}else{_0x398f23=0xce;}_0x4a3630[_0xd4cb('0x20')](_0x398f23);return _0x4a3630['set'](_0xd4cb('0x26'),_0xaf2160+'-'+_0x2a43d1+'/'+_0x2f395f)[_0xd4cb('0x22')](_0x2691db);}return null;};}function patchUpdates(_0x4e4924){return function(_0x178ebb){try{jsonpatch[_0xd4cb('0x27')](_0x178ebb,_0x4e4924,!![]);}catch(_0x3c9403){return BPromise[_0xd4cb('0x28')](_0x3c9403);}return _0x178ebb[_0xd4cb('0x29')]();};}function saveUpdates(_0x336e89,_0x124007){return function(_0x3ae33c){if(_0x3ae33c){return _0x3ae33c[_0xd4cb('0x2a')](_0x336e89)[_0xd4cb('0x2b')](function(_0x4a1e25){return _0x4a1e25;});}return null;};}function removeEntity(_0x34660e,_0x46ecb1){return function(_0x800ae2){if(_0x800ae2){return _0x800ae2['destroy']()['then'](function(){var _0x35fc86=_0x800ae2['get']({'plain':!![]});var _0x30ffc8='Lists';return db[_0xd4cb('0x2c')][_0xd4cb('0x2d')]({'where':{'type':_0x30ffc8,'resourceId':_0x35fc86['id']}})[_0xd4cb('0x2b')](function(){return _0x800ae2;});})[_0xd4cb('0x2b')](function(){_0x34660e['status'](0xcc)[_0xd4cb('0x21')]();});}};}function handleEntityNotFound(_0x2f873e,_0x2436b1){return function(_0x1e608a){if(!_0x1e608a){_0x2f873e[_0xd4cb('0x1f')](0x194);}return _0x1e608a;};}function handleError(_0x2bb504,_0x1d83da){_0x1d83da=_0x1d83da||0x1f4;return function(_0x50ef27){logger[_0xd4cb('0x2e')](_0x50ef27[_0xd4cb('0x2f')]);if(_0x50ef27[_0xd4cb('0x30')]){delete _0x50ef27[_0xd4cb('0x30')];}_0x2bb504[_0xd4cb('0x20')](_0x1d83da)[_0xd4cb('0x31')](_0x50ef27);};}exports[_0xd4cb('0x32')]=function(_0x2a0fdd,_0x312c30){var _0x2f2fde={},_0x4cc14e={},_0x4220c8={'count':0x0,'rows':[]};var _0x25af26=db[_0xd4cb('0x33')][_0xd4cb('0x34')];_0x4cc14e[_0xd4cb('0x35')]=_[_0xd4cb('0x36')](_0x25af26);_0x4cc14e[_0xd4cb('0x37')]=_[_0xd4cb('0x36')](_0x2a0fdd[_0xd4cb('0x37')]);_0x4cc14e[_0xd4cb('0x38')]=_[_0xd4cb('0x39')](_0x4cc14e[_0xd4cb('0x35')],_0x4cc14e[_0xd4cb('0x37')]);_0x2f2fde['attributes']=_[_0xd4cb('0x39')](_0x4cc14e[_0xd4cb('0x35')],qs[_0xd4cb('0x3a')](_0x2a0fdd[_0xd4cb('0x37')]['fields']));_0x2f2fde[_0xd4cb('0x3b')]=_0x2f2fde[_0xd4cb('0x3b')]['length']?_0x2f2fde[_0xd4cb('0x3b')]:_0x4cc14e[_0xd4cb('0x35')];if(!_0x2a0fdd[_0xd4cb('0x37')][_0xd4cb('0x3c')](_0xd4cb('0x3d'))){_0x2f2fde['limit']=qs['limit'](_0x2a0fdd['query']['limit']);_0x2f2fde[_0xd4cb('0x24')]=qs[_0xd4cb('0x24')](_0x2a0fdd[_0xd4cb('0x37')]['offset']);}_0x2f2fde[_0xd4cb('0x3e')]=qs[_0xd4cb('0x3f')](_0x2a0fdd[_0xd4cb('0x37')][_0xd4cb('0x3f')]);_0x2f2fde['where']=qs[_0xd4cb('0x38')](_[_0xd4cb('0x40')](_0x2a0fdd['query'],_0x4cc14e[_0xd4cb('0x38')]));if(_0x2a0fdd[_0xd4cb('0x37')][_0xd4cb('0x41')]){_0x2f2fde[_0xd4cb('0x42')]=_[_0xd4cb('0x43')](_0x2f2fde[_0xd4cb('0x42')],{'$or':_[_0xd4cb('0x44')](_0x25af26,function(_0x1f2072){if(_0x1f2072[_0xd4cb('0x45')][_0xd4cb('0x46')]!==_0xd4cb('0x47')){var _0x5e3c01={};_0x5e3c01[_0x1f2072['field']]={'$like':'%'+_0x2a0fdd['query']['filter']+'%'};return _0x5e3c01;}})});}_0x2f2fde=_[_0xd4cb('0x43')]({},_0x2f2fde,_0x2a0fdd[_0xd4cb('0x48')]);var _0x3a40df={'where':_0x2f2fde['where']};return db[_0xd4cb('0x33')][_0xd4cb('0x23')](_0x3a40df)[_0xd4cb('0x2b')](function(_0x3d8f18){_0x4220c8[_0xd4cb('0x23')]=_0x3d8f18;if(_0x2a0fdd[_0xd4cb('0x37')][_0xd4cb('0x49')]){_0x2f2fde[_0xd4cb('0x4a')]=[{'all':!![]}];}return db[_0xd4cb('0x33')]['findAll'](_0x2f2fde);})['then'](function(_0x550705){_0x4220c8[_0xd4cb('0x4b')]=_0x550705;return _0x4220c8;})[_0xd4cb('0x2b')](respondWithFilteredResult(_0x312c30,_0x2f2fde))[_0xd4cb('0x4c')](handleError(_0x312c30,null));};exports[_0xd4cb('0x4d')]=function(_0x1e1659,_0x110e59){var _0x592e3f={'raw':![],'where':{'id':_0x1e1659[_0xd4cb('0x4e')]['id']}},_0x53ae4e={};_0x53ae4e[_0xd4cb('0x35')]=_[_0xd4cb('0x36')](db['CmList'][_0xd4cb('0x34')]);_0x53ae4e['query']=_[_0xd4cb('0x36')](_0x1e1659[_0xd4cb('0x37')]);_0x53ae4e['filters']=_[_0xd4cb('0x39')](_0x53ae4e[_0xd4cb('0x35')],_0x53ae4e['query']);_0x592e3f['attributes']=_[_0xd4cb('0x39')](_0x53ae4e[_0xd4cb('0x35')],qs['fields'](_0x1e1659['query']['fields']));_0x592e3f[_0xd4cb('0x3b')]=_0x592e3f[_0xd4cb('0x3b')]['length']?_0x592e3f['attributes']:_0x53ae4e['model'];if(_0x1e1659[_0xd4cb('0x37')][_0xd4cb('0x49')]){_0x592e3f[_0xd4cb('0x4a')]=[{'all':!![]}];}_0x592e3f=_['merge']({},_0x592e3f,_0x1e1659[_0xd4cb('0x48')]);return db[_0xd4cb('0x33')]['find'](_0x592e3f)[_0xd4cb('0x2b')](handleEntityNotFound(_0x110e59,null))['then'](respondWithResult(_0x110e59,null))[_0xd4cb('0x4c')](handleError(_0x110e59,null));};exports['create']=function(_0x280f4a,_0x2b147d){return db[_0xd4cb('0x33')]['create'](_0x280f4a[_0xd4cb('0x4f')],{})[_0xd4cb('0x2b')](function(_0x12b26a){var _0x3c2fa4=_0x280f4a[_0xd4cb('0x50')][_0xd4cb('0x51')]({'plain':!![]});if(!_0x3c2fa4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c2fa4[_0xd4cb('0x52')]===_0xd4cb('0x50')){var _0x4e9492=_0x12b26a['get']({'plain':!![]});var _0x50e5f5='Lists';return db['UserProfileSection'][_0xd4cb('0x53')]({'where':{'name':_0x50e5f5,'userProfileId':_0x3c2fa4[_0xd4cb('0x54')]},'raw':!![]})[_0xd4cb('0x2b')](function(_0x13119f){if(_0x13119f&&_0x13119f[_0xd4cb('0x55')]===0x0){return db['UserProfileResource'][_0xd4cb('0x56')]({'name':_0x4e9492[_0xd4cb('0x30')],'resourceId':_0x4e9492['id'],'type':_0x13119f['name'],'sectionId':_0x13119f['id']},{})[_0xd4cb('0x2b')](function(){return _0x12b26a;});}else{return _0x12b26a;}})['catch'](function(_0x5c7fa1){logger[_0xd4cb('0x2e')](_0xd4cb('0x57'),_0x5c7fa1);throw _0x5c7fa1;});}return _0x12b26a;})[_0xd4cb('0x2b')](respondWithResult(_0x2b147d,0xc9))[_0xd4cb('0x4c')](handleError(_0x2b147d,null));};exports[_0xd4cb('0x2a')]=function(_0x4fbaaa,_0x451e73){if(_0x4fbaaa[_0xd4cb('0x4f')]['id']){delete _0x4fbaaa[_0xd4cb('0x4f')]['id'];}return db[_0xd4cb('0x33')][_0xd4cb('0x53')]({'where':{'id':_0x4fbaaa[_0xd4cb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x451e73,null))[_0xd4cb('0x2b')](saveUpdates(_0x4fbaaa[_0xd4cb('0x4f')],null))[_0xd4cb('0x2b')](respondWithResult(_0x451e73,null))[_0xd4cb('0x4c')](handleError(_0x451e73,null));};exports[_0xd4cb('0x2d')]=function(_0x4b2872,_0x2eed7b){return db[_0xd4cb('0x33')][_0xd4cb('0x53')]({'where':{'id':_0x4b2872[_0xd4cb('0x4e')]['id']}})[_0xd4cb('0x2b')](handleEntityNotFound(_0x2eed7b,null))[_0xd4cb('0x2b')](removeEntity(_0x2eed7b,null))[_0xd4cb('0x4c')](handleError(_0x2eed7b,null));};exports[_0xd4cb('0x58')]=function(_0x3043f4,_0x403be1){return db[_0xd4cb('0x33')]['describe']()['then'](respondWithResult(_0x403be1,null))[_0xd4cb('0x4c')](handleError(_0x403be1,null));};exports[_0xd4cb('0x59')]=function(_0x45a10a,_0x1b04d6,_0x5a24c5){if(_0x45a10a[_0xd4cb('0x4f')]['id']){delete _0x45a10a[_0xd4cb('0x4f')]['id'];}return db[_0xd4cb('0x33')][_0xd4cb('0x53')]({'where':{'id':_0x45a10a['params']['id']}})[_0xd4cb('0x2b')](handleEntityNotFound(_0x1b04d6,null))['then'](function(_0xd7bc5){if(_0xd7bc5){_0x45a10a['body']['ListId']=_0xd7bc5['id'];return db['Disposition']['create'](_0x45a10a[_0xd4cb('0x4f')]);}})[_0xd4cb('0x2b')](respondWithResult(_0x1b04d6,null))[_0xd4cb('0x4c')](handleError(_0x1b04d6,null));};exports['getDispositions']=function(_0x346fe3,_0x3462fd,_0x2b0247){var _0x51e8f7={'raw':![],'where':{}};var _0x535ac5={};var _0x4f905b={'count':0x0,'rows':[]};return db[_0xd4cb('0x33')]['findOne']({'where':{'id':_0x346fe3[_0xd4cb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3462fd,null))[_0xd4cb('0x2b')](function(_0x12da72){if(_0x12da72){_0x535ac5[_0xd4cb('0x35')]=_[_0xd4cb('0x36')](db[_0xd4cb('0x5a')][_0xd4cb('0x34')]);_0x535ac5[_0xd4cb('0x37')]=_[_0xd4cb('0x36')](_0x346fe3[_0xd4cb('0x37')]);_0x535ac5['filters']=_[_0xd4cb('0x39')](_0x535ac5[_0xd4cb('0x35')],_0x535ac5['query']);_0x51e8f7['attributes']=_['intersection'](_0x535ac5['model'],qs['fields'](_0x346fe3[_0xd4cb('0x37')][_0xd4cb('0x3a')]));_0x51e8f7[_0xd4cb('0x3b')]=_0x51e8f7['attributes'][_0xd4cb('0x5b')]?_0x51e8f7[_0xd4cb('0x3b')]:_0x535ac5['model'];if(!_0x346fe3['query']['hasOwnProperty'](_0xd4cb('0x3d'))){_0x51e8f7[_0xd4cb('0x25')]=qs[_0xd4cb('0x25')](_0x346fe3[_0xd4cb('0x37')]['limit']);_0x51e8f7[_0xd4cb('0x24')]=qs[_0xd4cb('0x24')](_0x346fe3[_0xd4cb('0x37')][_0xd4cb('0x24')]);}_0x51e8f7[_0xd4cb('0x3e')]=qs[_0xd4cb('0x3f')](_0x346fe3[_0xd4cb('0x37')][_0xd4cb('0x3f')]);_0x51e8f7[_0xd4cb('0x42')]=qs[_0xd4cb('0x38')](_[_0xd4cb('0x40')](_0x346fe3['query'],_0x535ac5[_0xd4cb('0x38')]));_0x51e8f7[_0xd4cb('0x42')]['ListId']=_0x12da72['id'];if(_0x346fe3['query'][_0xd4cb('0x41')]){_0x51e8f7[_0xd4cb('0x42')]=_['merge'](_0x51e8f7[_0xd4cb('0x42')],{'$or':_[_0xd4cb('0x44')](_0x51e8f7[_0xd4cb('0x3b')],function(_0x9b8525){var _0x11005e={};_0x11005e[_0x9b8525]={'$like':'%'+_0x346fe3[_0xd4cb('0x37')]['filter']+'%'};return _0x11005e;})});}_0x51e8f7=_[_0xd4cb('0x43')]({},_0x51e8f7,_0x346fe3[_0xd4cb('0x48')]);return db['Disposition'][_0xd4cb('0x23')]({'where':_0x51e8f7[_0xd4cb('0x42')]})[_0xd4cb('0x2b')](function(_0x33ec44){_0x4f905b[_0xd4cb('0x23')]=_0x33ec44;if(_0x346fe3['query']['includeAll']){_0x51e8f7['include']=[{'all':!![]}];}return db[_0xd4cb('0x5a')][_0xd4cb('0x5c')](_0x51e8f7);})['then'](function(_0x10b577){_0x4f905b[_0xd4cb('0x4b')]=_0x10b577;return _0x4f905b;});}})['then'](respondWithFilteredResult(_0x3462fd,_0x51e8f7))['catch'](handleError(_0x3462fd,null));};exports[_0xd4cb('0x5d')]=function(_0x3347da,_0x2f321b,_0x5c7ee2){var _0xc2865d;return db[_0xd4cb('0x33')][_0xd4cb('0x53')]({'where':{'id':_0x3347da[_0xd4cb('0x4e')]['id']}})[_0xd4cb('0x2b')](handleEntityNotFound(_0x2f321b,null))[_0xd4cb('0x2b')](function(_0x302b56){if(_0x302b56){return _0x302b56[_0xd4cb('0x5d')](_0x3347da[_0xd4cb('0x37')][_0xd4cb('0x5e')]);}})[_0xd4cb('0x2b')](respondWithStatusCode(_0x2f321b,null))[_0xd4cb('0x4c')](handleError(_0x2f321b,null));};exports['addContacts']=function(_0x118103,_0x483828,_0x25891b){return db[_0xd4cb('0x33')][_0xd4cb('0x53')]({'where':{'id':_0x118103[_0xd4cb('0x4e')]['id']}})[_0xd4cb('0x2b')](handleEntityNotFound(_0x483828,null))['then'](function(_0x113fad){if(_0x113fad){var _0x43e865=[];var _0x208f32={'success':[],'errors':[]};return db[_0xd4cb('0x5f')][_0xd4cb('0x58')]()['then'](function(_0x56f648){if(_0x118103[_0xd4cb('0x4f')][_0xd4cb('0x60')]&&_['isArray'](_0x118103[_0xd4cb('0x4f')]['tags'])){if(_0x118103['body']['tags']['length']){_0x118103[_0xd4cb('0x4f')][_0xd4cb('0x60')]=_0x118103[_0xd4cb('0x4f')][_0xd4cb('0x60')][_0xd4cb('0x61')](';')+';';}else{_0x118103[_0xd4cb('0x4f')][_0xd4cb('0x60')]=null;}}else{_0x118103[_0xd4cb('0x4f')][_0xd4cb('0x60')]=null;}if(_0x118103[_0xd4cb('0x4f')]&&_[_0xd4cb('0x62')](_0x118103[_0xd4cb('0x4f')])){for(var _0x3fd7f3=0x0;_0x3fd7f3<_0x118103[_0xd4cb('0x4f')]['length'];_0x3fd7f3+=0x1){_0x118103[_0xd4cb('0x4f')][_0x3fd7f3][_0xd4cb('0x63')]=_0x118103['params']['id'];_0x43e865[_0xd4cb('0x64')](_0x118103[_0xd4cb('0x4f')][_0x3fd7f3]);}return BPromise[_0xd4cb('0x65')](_0x43e865,function(_0x3e93a8){return db[_0xd4cb('0x5f')][_0xd4cb('0x56')](_[_0xd4cb('0x66')](_0x3e93a8,['ids','id'])||{},{'fields':_[_0xd4cb('0x36')](_0x56f648),'raw':!![]})[_0xd4cb('0x2b')](function(_0xc764ef){_0x208f32['success'][_0xd4cb('0x64')](_0xc764ef[_0xd4cb('0x67')]);})[_0xd4cb('0x4c')](function(_0x1faf67){_0x208f32[_0xd4cb('0x68')][_0xd4cb('0x64')]({'data':_0x3e93a8,'error':_0x1faf67[_0xd4cb('0x69')]});});})[_0xd4cb('0x2b')](function(_0x186e07){return _0x208f32;})['catch'](function(_0x53ceaf){return _0x53ceaf;});}else{_0x483828[_0xd4cb('0x20')](0x190)[_0xd4cb('0x22')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xd4cb('0x2b')](respondWithResult(_0x483828,null))[_0xd4cb('0x4c')](handleError(_0x483828,null));};exports[_0xd4cb('0x6a')]=function(_0x10282a,_0x5bdf6f,_0x410b6e){var _0x3e6069;return db[_0xd4cb('0x33')][_0xd4cb('0x53')]({'where':{'id':_0x10282a[_0xd4cb('0x4e')]['id']},'include':[{'model':db[_0xd4cb('0x6b')],'as':_0xd4cb('0x6c')}]})[_0xd4cb('0x2b')](handleEntityNotFound(_0x5bdf6f,null))[_0xd4cb('0x2b')](function(_0x37901a){if(_0x37901a){_0x3e6069=_0x37901a;return db[_0xd4cb('0x5f')][_0xd4cb('0x34')];}})[_0xd4cb('0x2b')](function(_0x2829a9){if(_0x2829a9){var _0x33631c={};var _0x34476d={};_0x34476d[_0xd4cb('0x35')]=_[_0xd4cb('0x6d')](_[_0xd4cb('0x36')](_0x2829a9),_[_0xd4cb('0x44')](_0x3e6069[_0xd4cb('0x6c')],function(_0x1ee94b){return util[_0xd4cb('0x6e')](_0xd4cb('0x6f'),_0x1ee94b['id']);}));_0x34476d['query']=_['keys'](_0x10282a['query']);_0x34476d['filters']=_[_0xd4cb('0x39')](_0x34476d['model'],_0x34476d[_0xd4cb('0x37')]);_0x33631c[_0xd4cb('0x3b')]=_[_0xd4cb('0x39')](_0x34476d[_0xd4cb('0x35')],qs[_0xd4cb('0x3a')](_0x10282a[_0xd4cb('0x37')][_0xd4cb('0x3a')]));_0x33631c[_0xd4cb('0x3b')]=_0x33631c[_0xd4cb('0x3b')][_0xd4cb('0x5b')]?_0x33631c['attributes']:_0x34476d[_0xd4cb('0x35')];if(!_0x10282a[_0xd4cb('0x37')][_0xd4cb('0x3c')](_0xd4cb('0x3d'))){_0x33631c[_0xd4cb('0x25')]=qs[_0xd4cb('0x25')](_0x10282a[_0xd4cb('0x37')][_0xd4cb('0x25')]);_0x33631c['offset']=qs['offset'](_0x10282a['query'][_0xd4cb('0x24')]);}_0x33631c['order']=qs[_0xd4cb('0x3f')](_0x10282a['query'][_0xd4cb('0x3f')]);_0x33631c[_0xd4cb('0x42')]=qs[_0xd4cb('0x38')](_[_0xd4cb('0x40')](_0x10282a['query'],_0x34476d[_0xd4cb('0x38')]));_0x33631c['raw']=!![];if(_0x10282a[_0xd4cb('0x37')]['filter']){_0x33631c[_0xd4cb('0x42')]=_[_0xd4cb('0x43')](_0x33631c['where'],{'$or':_[_0xd4cb('0x44')](_0x33631c[_0xd4cb('0x3b')],function(_0xc7bbfb){var _0x3a5468={};_0x3a5468[_0xc7bbfb]={'$like':'%'+_0x10282a[_0xd4cb('0x37')]['filter']+'%'};return _0x3a5468;})});}_0x33631c=_[_0xd4cb('0x43')]({},_0x33631c,_0x10282a[_0xd4cb('0x48')]);return _0x3e6069[_0xd4cb('0x6a')](_0x33631c);}})['then'](respondWithResult(_0x5bdf6f,null))[_0xd4cb('0x4c')](handleError(_0x5bdf6f,null));};exports[_0xd4cb('0x70')]=function(_0x5bb879,_0x3b2b62,_0x5bcfd3){var _0x1a6454;return db[_0xd4cb('0x33')]['find']({'where':{'id':_0x5bb879[_0xd4cb('0x4e')]['id']},'include':[{'model':db[_0xd4cb('0x6b')],'as':_0xd4cb('0x6c')}]})[_0xd4cb('0x2b')](handleEntityNotFound(_0x3b2b62,null))[_0xd4cb('0x2b')](function(_0x52fc51){if(_0x52fc51){_0x1a6454=_0x52fc51;return db[_0xd4cb('0x5f')]['rawAttributes'];}})[_0xd4cb('0x2b')](function(_0x1c01b1){if(_0x1c01b1){var _0x1ad645={};var _0x10d040={};_0x10d040[_0xd4cb('0x35')]=_[_0xd4cb('0x6d')](_[_0xd4cb('0x36')](_0x1c01b1),_[_0xd4cb('0x44')](_0x1a6454[_0xd4cb('0x6c')],function(_0x21b1dc){return util['format'](_0xd4cb('0x6f'),_0x21b1dc['id']);}));_0x10d040[_0xd4cb('0x37')]=_[_0xd4cb('0x36')](_0x5bb879[_0xd4cb('0x37')]);_0x10d040[_0xd4cb('0x38')]=_[_0xd4cb('0x39')](_0x10d040[_0xd4cb('0x35')],_0x10d040['query']);_0x1ad645[_0xd4cb('0x3b')]=_['intersection'](_0x10d040[_0xd4cb('0x35')],qs[_0xd4cb('0x3a')](_0x5bb879[_0xd4cb('0x37')][_0xd4cb('0x3a')]));_0x1ad645[_0xd4cb('0x3b')]=_0x1ad645[_0xd4cb('0x3b')][_0xd4cb('0x5b')]?_0x1ad645[_0xd4cb('0x3b')]:_0x10d040[_0xd4cb('0x35')];if(!_0x5bb879[_0xd4cb('0x37')][_0xd4cb('0x3c')]('nolimit')){_0x1ad645[_0xd4cb('0x25')]=qs[_0xd4cb('0x25')](_0x5bb879[_0xd4cb('0x37')]['limit']);_0x1ad645[_0xd4cb('0x24')]=qs[_0xd4cb('0x24')](_0x5bb879[_0xd4cb('0x37')][_0xd4cb('0x24')]);}_0x1ad645[_0xd4cb('0x3e')]=qs[_0xd4cb('0x3f')](_0x5bb879['query']['sort']);_0x1ad645['where']=qs[_0xd4cb('0x38')](_['pick'](_0x5bb879[_0xd4cb('0x37')],_0x10d040['filters']));_0x1ad645[_0xd4cb('0x71')]=!![];if(_0x5bb879[_0xd4cb('0x37')]['filter']){_0x1ad645['where']=_[_0xd4cb('0x43')](_0x1ad645[_0xd4cb('0x42')],{'$or':_[_0xd4cb('0x44')](_0x1ad645[_0xd4cb('0x3b')],function(_0xb7c9b8){var _0x50c4f7={};_0x50c4f7[_0xb7c9b8]={'$like':'%'+_0x5bb879[_0xd4cb('0x37')][_0xd4cb('0x41')]+'%'};return _0x50c4f7;})});}_0x1ad645=_[_0xd4cb('0x43')]({},_0x1ad645,_0x5bb879[_0xd4cb('0x48')]);return _0x1a6454['getContacts'](_0x1ad645);}})[_0xd4cb('0x2b')](function(_0x487ec9){if(!_[_0xd4cb('0x72')](_0x487ec9)){var _0x4c49b0=toCsv(_0x487ec9);var _0x1d964e=Date[_0xd4cb('0x73')]();fs[_0xd4cb('0x74')](util[_0xd4cb('0x6e')](_0xd4cb('0x75'),_0x1a6454['id'],_0x1d964e),_0x4c49b0);_0x3b2b62[_0xd4cb('0x76')](_0xd4cb('0x77'),_0xd4cb('0x78')+util[_0xd4cb('0x6e')](_0xd4cb('0x79'),_0x1a6454['id'],_0x1d964e));_0x3b2b62[_0xd4cb('0x76')](_0xd4cb('0x7a'),_0xd4cb('0x7b'));return _0x3b2b62[_0xd4cb('0x7c')](util['format'](_0xd4cb('0x75'),_0x1a6454['id'],_0x1d964e));}else{return _0x3b2b62[_0xd4cb('0x1f')](0xcc);}})[_0xd4cb('0x4c')](handleError(_0x3b2b62,null));};exports[_0xd4cb('0x7d')]=function(_0x23eaab,_0x49f91f,_0x475b9f){var _0x32d992;delete _0x23eaab[_0xd4cb('0x4f')]['id'];return db[_0xd4cb('0x33')][_0xd4cb('0x7e')]({'where':{'id':_0x23eaab[_0xd4cb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49f91f,null))[_0xd4cb('0x2b')](function(_0x51674f){if(_0x51674f){return db[_0xd4cb('0x7f')]['transaction'](function(_0x1a3500){return db[_0xd4cb('0x6b')][_0xd4cb('0x56')](_0x23eaab[_0xd4cb('0x4f')],{'transaction':_0x1a3500})[_0xd4cb('0x2b')](function(_0x3ec17c){_0x32d992=_0x3ec17c;return _0x51674f[_0xd4cb('0x80')](_0x3ec17c,{'transaction':_0x1a3500});})[_0xd4cb('0x2b')](function(){var _0x2e7496={'type':db[_0xd4cb('0x81')]['TEXT'],'transaction':_0x1a3500};switch(_0x23eaab[_0xd4cb('0x4f')][_0xd4cb('0x45')]){case _0xd4cb('0x82'):_0x2e7496[_0xd4cb('0x45')]=db[_0xd4cb('0x81')][_0xd4cb('0x83')];break;case _0xd4cb('0x84'):_0x2e7496['type']=db[_0xd4cb('0x81')]['INTEGER'];break;case'switch':_0x2e7496[_0xd4cb('0x45')]=db['Sequelize'][_0xd4cb('0x85')];_0x2e7496[_0xd4cb('0x86')]=![];break;default:}return db[_0xd4cb('0x7f')]['queryInterface'][_0xd4cb('0x87')](_0xd4cb('0x88'),util[_0xd4cb('0x6e')](_0xd4cb('0x89'),_0x32d992['id']),_0x2e7496);})['then'](function(){return _0x32d992;});});}})[_0xd4cb('0x2b')](respondWithResult(_0x49f91f,null))['catch'](handleError(_0x49f91f,null));};exports[_0xd4cb('0x8a')]=function(_0x5a4052,_0x28437c,_0x3fe84a){var _0x28c127={};var _0x311564={};var _0x29f127;var _0x4fbc78;return db[_0xd4cb('0x33')]['findOne']({'where':{'id':_0x5a4052[_0xd4cb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x28437c,null))[_0xd4cb('0x2b')](function(_0x5bb546){if(_0x5bb546){_0x29f127=_0x5bb546;_0x311564[_0xd4cb('0x35')]=_[_0xd4cb('0x36')](db[_0xd4cb('0x6b')][_0xd4cb('0x34')]);_0x311564[_0xd4cb('0x37')]=_['keys'](_0x5a4052['query']);_0x311564[_0xd4cb('0x38')]=_[_0xd4cb('0x39')](_0x311564[_0xd4cb('0x35')],_0x311564['query']);_0x28c127[_0xd4cb('0x3b')]=_['intersection'](_0x311564['model'],qs[_0xd4cb('0x3a')](_0x5a4052[_0xd4cb('0x37')][_0xd4cb('0x3a')]));_0x28c127[_0xd4cb('0x3b')]=_0x28c127[_0xd4cb('0x3b')]['length']?_0x28c127[_0xd4cb('0x3b')]:_0x311564[_0xd4cb('0x35')];_0x28c127[_0xd4cb('0x3e')]=qs['sort'](_0x5a4052[_0xd4cb('0x37')]['sort']);_0x28c127['where']=qs[_0xd4cb('0x38')](_[_0xd4cb('0x40')](_0x5a4052[_0xd4cb('0x37')],_0x311564[_0xd4cb('0x38')]));_0x28c127[_0xd4cb('0x42')]=_[_0xd4cb('0x43')](_0x28c127[_0xd4cb('0x42')],{'$or':[{'ListId':_0x5bb546['id']},{'ListId':null}]});if(_0x5a4052['query'][_0xd4cb('0x41')]){_0x28c127[_0xd4cb('0x42')]=_['merge'](_0x28c127[_0xd4cb('0x42')],{'$or':_['map'](_0x28c127[_0xd4cb('0x3b')],function(_0x460f54){var _0x458e43={};_0x458e43[_0x460f54]={'$like':'%'+_0x5a4052['query'][_0xd4cb('0x41')]+'%'};return _0x458e43;})});}_0x28c127=_['merge']({},_0x28c127,_0x5a4052[_0xd4cb('0x48')]);return db[_0xd4cb('0x6b')]['findAndCountAll'](_0x28c127);}})['then'](respondWithResult(_0x28437c,null))[_0xd4cb('0x4c')](handleError(_0x28437c,null));};exports[_0xd4cb('0x8b')]=function(_0x3217f0,_0x1e3509,_0x384b00){return db['CmList'][_0xd4cb('0x53')]({'where':{'id':_0x3217f0[_0xd4cb('0x4e')]['id']}})[_0xd4cb('0x2b')](handleEntityNotFound(_0x1e3509,null))[_0xd4cb('0x2b')](function(_0x4d8d2){if(_0x4d8d2){return _0x4d8d2[_0xd4cb('0x8b')](_0x3217f0[_0xd4cb('0x4f')][_0xd4cb('0x5e')],_[_0xd4cb('0x66')](_0x3217f0[_0xd4cb('0x4f')],['ids','id'])||{})[_0xd4cb('0x8c')](function(_0x17ff0e){for(var _0x338a27=0x0;_0x338a27<_0x3217f0['body'][_0xd4cb('0x5e')]['length'];_0x338a27+=0x1){socket[_0xd4cb('0x8d')]('userCmList:save',{'UserId':_0x3217f0['body'][_0xd4cb('0x5e')][_0x338a27],'CmListId':_0x3217f0[_0xd4cb('0x4e')]['id']});}return _0x17ff0e;});}})[_0xd4cb('0x2b')](respondWithResult(_0x1e3509,null))[_0xd4cb('0x4c')](handleError(_0x1e3509,null));};exports[_0xd4cb('0x8e')]=function(_0x315617,_0x4a3dcb,_0x378e02){var _0x382cea;return db[_0xd4cb('0x33')][_0xd4cb('0x53')]({'where':{'id':_0x315617['params']['id']}})[_0xd4cb('0x2b')](handleEntityNotFound(_0x4a3dcb,null))[_0xd4cb('0x2b')](function(_0x3e596c){if(_0x3e596c){return _0x3e596c[_0xd4cb('0x8e')](_0x315617[_0xd4cb('0x37')][_0xd4cb('0x5e')])['then'](function(_0x5755ed){if(_[_0xd4cb('0x62')](_0x315617[_0xd4cb('0x37')][_0xd4cb('0x5e')])){for(var _0x4b95ed=0x0;_0x4b95ed<_0x315617[_0xd4cb('0x37')][_0xd4cb('0x5e')]['length'];_0x4b95ed+=0x1){socket[_0xd4cb('0x8d')](_0xd4cb('0x8f'),{'UserId':_0x315617['query'][_0xd4cb('0x5e')][_0x4b95ed],'CmListId':_0x315617['params']['id']});}}else{socket[_0xd4cb('0x8d')](_0xd4cb('0x8f'),{'UserId':_0x315617[_0xd4cb('0x37')][_0xd4cb('0x5e')],'CmListId':_0x315617[_0xd4cb('0x4e')]['id']});}});}})[_0xd4cb('0x2b')](respondWithStatusCode(_0x4a3dcb,null))['catch'](handleError(_0x4a3dcb,null));};exports[_0xd4cb('0x90')]=function(_0x1c6c3a,_0x490e97,_0x26a29b){var _0x5e47ea={};var _0x4d74ea={};var _0x433d26;var _0x195fdf;return db[_0xd4cb('0x33')]['findOne']({'where':{'id':_0x1c6c3a[_0xd4cb('0x4e')]['id']}})[_0xd4cb('0x2b')](handleEntityNotFound(_0x490e97,null))['then'](function(_0x4296ee){if(_0x4296ee){_0x433d26=_0x4296ee;_0x4d74ea[_0xd4cb('0x35')]=_[_0xd4cb('0x36')](db['User'][_0xd4cb('0x34')]);_0x4d74ea['query']=_[_0xd4cb('0x36')](_0x1c6c3a['query']);_0x4d74ea[_0xd4cb('0x38')]=_[_0xd4cb('0x39')](_0x4d74ea[_0xd4cb('0x35')],_0x4d74ea['query']);_0x5e47ea[_0xd4cb('0x3b')]=_[_0xd4cb('0x39')](_0x4d74ea[_0xd4cb('0x35')],qs[_0xd4cb('0x3a')](_0x1c6c3a['query'][_0xd4cb('0x3a')]));_0x5e47ea[_0xd4cb('0x3b')]=_0x5e47ea[_0xd4cb('0x3b')][_0xd4cb('0x5b')]?_0x5e47ea[_0xd4cb('0x3b')]:_0x4d74ea['model'];_0x5e47ea['order']=qs[_0xd4cb('0x3f')](_0x1c6c3a[_0xd4cb('0x37')][_0xd4cb('0x3f')]);_0x5e47ea[_0xd4cb('0x42')]=qs[_0xd4cb('0x38')](_['pick'](_0x1c6c3a['query'],_0x4d74ea[_0xd4cb('0x38')]));if(_0x1c6c3a['query']['filter']){_0x5e47ea[_0xd4cb('0x42')]=_['merge'](_0x5e47ea[_0xd4cb('0x42')],{'$or':_['map'](_0x5e47ea[_0xd4cb('0x3b')],function(_0x14473a){var _0x6ed441={};_0x6ed441[_0x14473a]={'$like':'%'+_0x1c6c3a[_0xd4cb('0x37')][_0xd4cb('0x41')]+'%'};return _0x6ed441;})});}_0x5e47ea=_[_0xd4cb('0x43')]({},_0x5e47ea,_0x1c6c3a[_0xd4cb('0x48')]);return _0x433d26[_0xd4cb('0x90')](_0x5e47ea);}})[_0xd4cb('0x2b')](function(_0x5948af){if(_0x5948af){_0x195fdf=_0x5948af[_0xd4cb('0x5b')];if(!_0x1c6c3a[_0xd4cb('0x37')][_0xd4cb('0x3c')]('nolimit')){_0x5e47ea['limit']=qs[_0xd4cb('0x25')](_0x1c6c3a[_0xd4cb('0x37')]['limit']);_0x5e47ea[_0xd4cb('0x24')]=qs[_0xd4cb('0x24')](_0x1c6c3a[_0xd4cb('0x37')][_0xd4cb('0x24')]);}return _0x433d26[_0xd4cb('0x90')](_0x5e47ea);}})[_0xd4cb('0x2b')](function(_0x21cbf9){if(_0x21cbf9){return _0x21cbf9?{'count':_0x195fdf,'rows':_0x21cbf9}:null;}})['then'](respondWithResult(_0x490e97,null))['catch'](handleError(_0x490e97,null));}; \ No newline at end of file +var _0x5a22=['getCustomFields','findOne','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','UserProfileResource','destroy','end','name','CmList','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','order','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','format','cf_%d','nolimit','raw','getContactsCsv','CustomFields','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s'];(function(_0x28ff30,_0x342f9c){var _0x453c8b=function(_0x40e323){while(--_0x40e323){_0x28ff30['push'](_0x28ff30['shift']());}};_0x453c8b(++_0x342f9c);}(_0x5a22,0x9b));var _0x25a2=function(_0x5cfb92,_0x5797e6){_0x5cfb92=_0x5cfb92-0x0;var _0x1cd7c2=_0x5a22[_0x5cfb92];return _0x1cd7c2;};'use strict';var pdf=require(_0x25a2('0x0'));var emlformat=require(_0x25a2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x25a2('0x2'));var jsonpatch=require(_0x25a2('0x3'));var rp=require('request-promise');var moment=require(_0x25a2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x25a2('0x5'));var util=require(_0x25a2('0x6'));var path=require(_0x25a2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x25a2('0x8'));var squel=require(_0x25a2('0x9'));var crypto=require('crypto');var jsforce=require(_0x25a2('0xa'));var deskjs=require(_0x25a2('0xb'));var toCsv=require(_0x25a2('0xc'));var querystring=require(_0x25a2('0xd'));var Papa=require(_0x25a2('0xe'));var authService=require(_0x25a2('0xf'));var hardwareService=require(_0x25a2('0x10'));var Redis=require(_0x25a2('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x25a2('0x12'));var utils=require(_0x25a2('0x13'));var config=require(_0x25a2('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x25a2('0x15')](config[_0x25a2('0x16')],{'host':_0x25a2('0x17'),'port':0x18eb});var socket=require(_0x25a2('0x18'))(new Redis(config[_0x25a2('0x16')]));require(_0x25a2('0x19'))['register'](socket);function respondWithStatusCode(_0x99425e,_0x1fac68){_0x1fac68=_0x1fac68||0xcc;return function(_0x3b5d99){if(_0x3b5d99){return _0x99425e[_0x25a2('0x1a')](_0x1fac68);}return _0x99425e[_0x25a2('0x1b')](_0x1fac68)['end']();};}function respondWithResult(_0x5a49a5,_0x4ed926){_0x4ed926=_0x4ed926||0xc8;return function(_0x19c45b){if(_0x19c45b){return _0x5a49a5['status'](_0x4ed926)[_0x25a2('0x1c')](_0x19c45b);}};}function respondWithFilteredResult(_0x27119c,_0x452bc5){return function(_0x2bdf00){if(_0x2bdf00){var _0x2bf333=_0x2bdf00[_0x25a2('0x1d')],_0xa82b24=_0x452bc5['offset'],_0x547d50=_0x452bc5[_0x25a2('0x1e')]+_0x452bc5[_0x25a2('0x1f')],_0x22ff52;if(_0x547d50>=_0x2bf333){_0x547d50=_0x2bf333;_0x22ff52=0xc8;}else{_0x22ff52=0xce;}_0x27119c[_0x25a2('0x1b')](_0x22ff52);return _0x27119c[_0x25a2('0x20')](_0x25a2('0x21'),_0xa82b24+'-'+_0x547d50+'/'+_0x2bf333)['json'](_0x2bdf00);}return null;};}function patchUpdates(_0x398820){return function(_0xc7e165){try{jsonpatch['apply'](_0xc7e165,_0x398820,!![]);}catch(_0x121453){return BPromise[_0x25a2('0x22')](_0x121453);}return _0xc7e165['save']();};}function saveUpdates(_0x5377d9,_0x17db29){return function(_0x394a4c){if(_0x394a4c){return _0x394a4c[_0x25a2('0x23')](_0x5377d9)['then'](function(_0x48e88b){return _0x48e88b;});}return null;};}function removeEntity(_0x3701a2,_0x127d61){return function(_0x11fb2a){if(_0x11fb2a){return _0x11fb2a['destroy']()[_0x25a2('0x24')](function(){var _0x565767=_0x11fb2a['get']({'plain':!![]});var _0xde0fd7='Lists';return db[_0x25a2('0x25')][_0x25a2('0x26')]({'where':{'type':_0xde0fd7,'resourceId':_0x565767['id']}})[_0x25a2('0x24')](function(){return _0x11fb2a;});})[_0x25a2('0x24')](function(){_0x3701a2[_0x25a2('0x1b')](0xcc)[_0x25a2('0x27')]();});}};}function handleEntityNotFound(_0xc29f34,_0x1984e3){return function(_0x5ca60a){if(!_0x5ca60a){_0xc29f34[_0x25a2('0x1a')](0x194);}return _0x5ca60a;};}function handleError(_0x1ec3cf,_0x3a078f){_0x3a078f=_0x3a078f||0x1f4;return function(_0x41eefa){logger['error'](_0x41eefa['stack']);if(_0x41eefa[_0x25a2('0x28')]){delete _0x41eefa[_0x25a2('0x28')];}_0x1ec3cf[_0x25a2('0x1b')](_0x3a078f)['send'](_0x41eefa);};}exports['index']=function(_0x2ca6b5,_0x50dda1){var _0x5a0d9e={},_0x5e0438={},_0x275c27={'count':0x0,'rows':[]};var _0xa63146=db[_0x25a2('0x29')]['rawAttributes'];_0x5e0438[_0x25a2('0x2a')]=_[_0x25a2('0x2b')](_0xa63146);_0x5e0438[_0x25a2('0x2c')]=_[_0x25a2('0x2b')](_0x2ca6b5[_0x25a2('0x2c')]);_0x5e0438['filters']=_['intersection'](_0x5e0438[_0x25a2('0x2a')],_0x5e0438[_0x25a2('0x2c')]);_0x5a0d9e[_0x25a2('0x2d')]=_[_0x25a2('0x2e')](_0x5e0438[_0x25a2('0x2a')],qs[_0x25a2('0x2f')](_0x2ca6b5[_0x25a2('0x2c')]['fields']));_0x5a0d9e['attributes']=_0x5a0d9e[_0x25a2('0x2d')][_0x25a2('0x30')]?_0x5a0d9e[_0x25a2('0x2d')]:_0x5e0438['model'];if(!_0x2ca6b5[_0x25a2('0x2c')][_0x25a2('0x31')]('nolimit')){_0x5a0d9e['limit']=qs[_0x25a2('0x1f')](_0x2ca6b5[_0x25a2('0x2c')][_0x25a2('0x1f')]);_0x5a0d9e['offset']=qs['offset'](_0x2ca6b5[_0x25a2('0x2c')][_0x25a2('0x1e')]);}_0x5a0d9e['order']=qs[_0x25a2('0x32')](_0x2ca6b5[_0x25a2('0x2c')][_0x25a2('0x32')]);_0x5a0d9e[_0x25a2('0x33')]=qs[_0x25a2('0x34')](_[_0x25a2('0x35')](_0x2ca6b5[_0x25a2('0x2c')],_0x5e0438[_0x25a2('0x34')]));if(_0x2ca6b5['query']['filter']){_0x5a0d9e['where']=_[_0x25a2('0x36')](_0x5a0d9e['where'],{'$or':_[_0x25a2('0x37')](_0xa63146,function(_0x2eb876){if(_0x2eb876[_0x25a2('0x38')][_0x25a2('0x39')]!==_0x25a2('0x3a')){var _0x34e63d={};_0x34e63d[_0x2eb876[_0x25a2('0x3b')]]={'$like':'%'+_0x2ca6b5[_0x25a2('0x2c')][_0x25a2('0x3c')]+'%'};return _0x34e63d;}})});}_0x5a0d9e=_[_0x25a2('0x36')]({},_0x5a0d9e,_0x2ca6b5[_0x25a2('0x3d')]);var _0x44414a={'where':_0x5a0d9e[_0x25a2('0x33')]};return db[_0x25a2('0x29')][_0x25a2('0x1d')](_0x44414a)[_0x25a2('0x24')](function(_0x4a6874){_0x275c27[_0x25a2('0x1d')]=_0x4a6874;if(_0x2ca6b5[_0x25a2('0x2c')][_0x25a2('0x3e')]){_0x5a0d9e[_0x25a2('0x3f')]=[{'all':!![]}];}return db['CmList'][_0x25a2('0x40')](_0x5a0d9e);})[_0x25a2('0x24')](function(_0xef2182){_0x275c27[_0x25a2('0x41')]=_0xef2182;return _0x275c27;})[_0x25a2('0x24')](respondWithFilteredResult(_0x50dda1,_0x5a0d9e))[_0x25a2('0x42')](handleError(_0x50dda1,null));};exports[_0x25a2('0x43')]=function(_0x6e10a,_0x135727){var _0x44f215={'raw':![],'where':{'id':_0x6e10a[_0x25a2('0x44')]['id']}},_0x308650={};_0x308650[_0x25a2('0x2a')]=_[_0x25a2('0x2b')](db[_0x25a2('0x29')][_0x25a2('0x45')]);_0x308650[_0x25a2('0x2c')]=_[_0x25a2('0x2b')](_0x6e10a[_0x25a2('0x2c')]);_0x308650['filters']=_['intersection'](_0x308650[_0x25a2('0x2a')],_0x308650[_0x25a2('0x2c')]);_0x44f215[_0x25a2('0x2d')]=_[_0x25a2('0x2e')](_0x308650[_0x25a2('0x2a')],qs[_0x25a2('0x2f')](_0x6e10a[_0x25a2('0x2c')][_0x25a2('0x2f')]));_0x44f215['attributes']=_0x44f215[_0x25a2('0x2d')][_0x25a2('0x30')]?_0x44f215['attributes']:_0x308650[_0x25a2('0x2a')];if(_0x6e10a[_0x25a2('0x2c')][_0x25a2('0x3e')]){_0x44f215[_0x25a2('0x3f')]=[{'all':!![]}];}_0x44f215=_['merge']({},_0x44f215,_0x6e10a['options']);return db[_0x25a2('0x29')][_0x25a2('0x46')](_0x44f215)['then'](handleEntityNotFound(_0x135727,null))[_0x25a2('0x24')](respondWithResult(_0x135727,null))[_0x25a2('0x42')](handleError(_0x135727,null));};exports[_0x25a2('0x47')]=function(_0x432231,_0x4e125a){return db[_0x25a2('0x29')][_0x25a2('0x47')](_0x432231[_0x25a2('0x48')],{})[_0x25a2('0x24')](function(_0x4c2145){var _0x4c8c76=_0x432231[_0x25a2('0x49')][_0x25a2('0x4a')]({'plain':!![]});if(!_0x4c8c76)throw new Error(_0x25a2('0x4b'));if(_0x4c8c76[_0x25a2('0x4c')]===_0x25a2('0x49')){var _0x41278b=_0x4c2145[_0x25a2('0x4a')]({'plain':!![]});var _0x290e59=_0x25a2('0x4d');return db[_0x25a2('0x4e')][_0x25a2('0x46')]({'where':{'name':_0x290e59,'userProfileId':_0x4c8c76['userProfileId']},'raw':!![]})[_0x25a2('0x24')](function(_0x2e22da){if(_0x2e22da&&_0x2e22da['autoAssociation']===0x0){return db[_0x25a2('0x25')][_0x25a2('0x47')]({'name':_0x41278b['name'],'resourceId':_0x41278b['id'],'type':_0x2e22da['name'],'sectionId':_0x2e22da['id']},{})[_0x25a2('0x24')](function(){return _0x4c2145;});}else{return _0x4c2145;}})[_0x25a2('0x42')](function(_0x9acdb2){logger['error'](_0x25a2('0x4f'),_0x9acdb2);throw _0x9acdb2;});}return _0x4c2145;})[_0x25a2('0x24')](respondWithResult(_0x4e125a,0xc9))[_0x25a2('0x42')](handleError(_0x4e125a,null));};exports[_0x25a2('0x23')]=function(_0x2f777,_0x462264){if(_0x2f777[_0x25a2('0x48')]['id']){delete _0x2f777[_0x25a2('0x48')]['id'];}return db[_0x25a2('0x29')][_0x25a2('0x46')]({'where':{'id':_0x2f777['params']['id']}})[_0x25a2('0x24')](handleEntityNotFound(_0x462264,null))[_0x25a2('0x24')](saveUpdates(_0x2f777[_0x25a2('0x48')],null))[_0x25a2('0x24')](respondWithResult(_0x462264,null))[_0x25a2('0x42')](handleError(_0x462264,null));};exports[_0x25a2('0x26')]=function(_0x288869,_0x3d4a44){return db[_0x25a2('0x29')][_0x25a2('0x46')]({'where':{'id':_0x288869[_0x25a2('0x44')]['id']}})[_0x25a2('0x24')](handleEntityNotFound(_0x3d4a44,null))[_0x25a2('0x24')](removeEntity(_0x3d4a44,null))[_0x25a2('0x42')](handleError(_0x3d4a44,null));};exports['describe']=function(_0x46e670,_0x18f48e){return db['CmList'][_0x25a2('0x50')]()[_0x25a2('0x24')](respondWithResult(_0x18f48e,null))[_0x25a2('0x42')](handleError(_0x18f48e,null));};exports[_0x25a2('0x51')]=function(_0x411d69,_0x16827a,_0x57cf84){if(_0x411d69[_0x25a2('0x48')]['id']){delete _0x411d69[_0x25a2('0x48')]['id'];}return db[_0x25a2('0x29')]['find']({'where':{'id':_0x411d69['params']['id']}})[_0x25a2('0x24')](handleEntityNotFound(_0x16827a,null))[_0x25a2('0x24')](function(_0x14ef7f){if(_0x14ef7f){_0x411d69[_0x25a2('0x48')][_0x25a2('0x52')]=_0x14ef7f['id'];return db[_0x25a2('0x53')][_0x25a2('0x47')](_0x411d69['body']);}})[_0x25a2('0x24')](respondWithResult(_0x16827a,null))['catch'](handleError(_0x16827a,null));};exports[_0x25a2('0x54')]=function(_0xe10798,_0x13021e,_0x2f52ea){var _0x984146={'raw':![],'where':{}};var _0x3ef537={};var _0x3967b8={'count':0x0,'rows':[]};return db[_0x25a2('0x29')]['findOne']({'where':{'id':_0xe10798[_0x25a2('0x44')]['id']}})[_0x25a2('0x24')](handleEntityNotFound(_0x13021e,null))[_0x25a2('0x24')](function(_0x1cd2c1){if(_0x1cd2c1){_0x3ef537['model']=_[_0x25a2('0x2b')](db[_0x25a2('0x53')]['rawAttributes']);_0x3ef537['query']=_[_0x25a2('0x2b')](_0xe10798['query']);_0x3ef537[_0x25a2('0x34')]=_['intersection'](_0x3ef537[_0x25a2('0x2a')],_0x3ef537[_0x25a2('0x2c')]);_0x984146[_0x25a2('0x2d')]=_[_0x25a2('0x2e')](_0x3ef537[_0x25a2('0x2a')],qs[_0x25a2('0x2f')](_0xe10798[_0x25a2('0x2c')]['fields']));_0x984146[_0x25a2('0x2d')]=_0x984146[_0x25a2('0x2d')][_0x25a2('0x30')]?_0x984146[_0x25a2('0x2d')]:_0x3ef537['model'];if(!_0xe10798[_0x25a2('0x2c')][_0x25a2('0x31')]('nolimit')){_0x984146[_0x25a2('0x1f')]=qs[_0x25a2('0x1f')](_0xe10798[_0x25a2('0x2c')][_0x25a2('0x1f')]);_0x984146[_0x25a2('0x1e')]=qs['offset'](_0xe10798['query'][_0x25a2('0x1e')]);}_0x984146[_0x25a2('0x55')]=qs[_0x25a2('0x32')](_0xe10798[_0x25a2('0x2c')][_0x25a2('0x32')]);_0x984146[_0x25a2('0x33')]=qs[_0x25a2('0x34')](_[_0x25a2('0x35')](_0xe10798[_0x25a2('0x2c')],_0x3ef537['filters']));_0x984146['where'][_0x25a2('0x52')]=_0x1cd2c1['id'];if(_0xe10798[_0x25a2('0x2c')][_0x25a2('0x3c')]){_0x984146['where']=_['merge'](_0x984146[_0x25a2('0x33')],{'$or':_[_0x25a2('0x37')](_0x984146[_0x25a2('0x2d')],function(_0x5dd4bb){var _0x547c62={};_0x547c62[_0x5dd4bb]={'$like':'%'+_0xe10798[_0x25a2('0x2c')][_0x25a2('0x3c')]+'%'};return _0x547c62;})});}_0x984146=_[_0x25a2('0x36')]({},_0x984146,_0xe10798[_0x25a2('0x3d')]);return db[_0x25a2('0x53')]['count']({'where':_0x984146[_0x25a2('0x33')]})[_0x25a2('0x24')](function(_0x2055d4){_0x3967b8['count']=_0x2055d4;if(_0xe10798[_0x25a2('0x2c')][_0x25a2('0x3e')]){_0x984146[_0x25a2('0x3f')]=[{'all':!![]}];}return db[_0x25a2('0x53')][_0x25a2('0x40')](_0x984146);})[_0x25a2('0x24')](function(_0x5c3534){_0x3967b8[_0x25a2('0x41')]=_0x5c3534;return _0x3967b8;});}})[_0x25a2('0x24')](respondWithFilteredResult(_0x13021e,_0x984146))['catch'](handleError(_0x13021e,null));};exports[_0x25a2('0x56')]=function(_0x4931ec,_0x224090,_0x2fd708){var _0x254624;return db['CmList'][_0x25a2('0x46')]({'where':{'id':_0x4931ec[_0x25a2('0x44')]['id']}})['then'](handleEntityNotFound(_0x224090,null))[_0x25a2('0x24')](function(_0x5c8631){if(_0x5c8631){return _0x5c8631['removeDispositions'](_0x4931ec['query'][_0x25a2('0x57')]);}})[_0x25a2('0x24')](respondWithStatusCode(_0x224090,null))[_0x25a2('0x42')](handleError(_0x224090,null));};exports[_0x25a2('0x58')]=function(_0x1385d0,_0x4b6b5,_0xb96a4f){return db[_0x25a2('0x29')][_0x25a2('0x46')]({'where':{'id':_0x1385d0['params']['id']}})[_0x25a2('0x24')](handleEntityNotFound(_0x4b6b5,null))[_0x25a2('0x24')](function(_0x258a83){if(_0x258a83){var _0x1e1c41=[];var _0x2c02c2={'success':[],'errors':[]};return db[_0x25a2('0x59')]['describe']()[_0x25a2('0x24')](function(_0x413217){if(_0x1385d0[_0x25a2('0x48')]['tags']&&_[_0x25a2('0x5a')](_0x1385d0[_0x25a2('0x48')]['tags'])){if(_0x1385d0[_0x25a2('0x48')]['tags'][_0x25a2('0x30')]){_0x1385d0['body'][_0x25a2('0x5b')]=_0x1385d0[_0x25a2('0x48')][_0x25a2('0x5b')][_0x25a2('0x5c')](';')+';';}else{_0x1385d0[_0x25a2('0x48')][_0x25a2('0x5b')]=null;}}else{_0x1385d0[_0x25a2('0x48')][_0x25a2('0x5b')]=null;}if(_0x1385d0['body']&&_[_0x25a2('0x5a')](_0x1385d0[_0x25a2('0x48')])){for(var _0x6ba7e3=0x0;_0x6ba7e3<_0x1385d0[_0x25a2('0x48')]['length'];_0x6ba7e3+=0x1){_0x1385d0[_0x25a2('0x48')][_0x6ba7e3][_0x25a2('0x52')]=_0x1385d0[_0x25a2('0x44')]['id'];_0x1e1c41[_0x25a2('0x5d')](_0x1385d0['body'][_0x6ba7e3]);}return BPromise['each'](_0x1e1c41,function(_0x5e4722){return db[_0x25a2('0x59')][_0x25a2('0x47')](_['omit'](_0x5e4722,[_0x25a2('0x57'),'id'])||{},{'fields':_[_0x25a2('0x2b')](_0x413217),'raw':!![]})[_0x25a2('0x24')](function(_0x3be624){_0x2c02c2[_0x25a2('0x5e')][_0x25a2('0x5d')](_0x3be624[_0x25a2('0x5f')]);})[_0x25a2('0x42')](function(_0x21ee22){_0x2c02c2[_0x25a2('0x60')][_0x25a2('0x5d')]({'data':_0x5e4722,'error':_0x21ee22[_0x25a2('0x61')]});});})[_0x25a2('0x24')](function(_0x12a152){return _0x2c02c2;})[_0x25a2('0x42')](function(_0x4203b2){return _0x4203b2;});}else{_0x4b6b5['status'](0x190)[_0x25a2('0x1c')]({'message':_0x25a2('0x62')});}});}})[_0x25a2('0x24')](respondWithResult(_0x4b6b5,null))[_0x25a2('0x42')](handleError(_0x4b6b5,null));};exports[_0x25a2('0x63')]=function(_0x37d69e,_0x266bdd,_0x3ea035){var _0x3accb0;return db[_0x25a2('0x29')][_0x25a2('0x46')]({'where':{'id':_0x37d69e['params']['id']},'include':[{'model':db[_0x25a2('0x64')],'as':'CustomFields'}]})[_0x25a2('0x24')](handleEntityNotFound(_0x266bdd,null))[_0x25a2('0x24')](function(_0xcac4d4){if(_0xcac4d4){_0x3accb0=_0xcac4d4;return db[_0x25a2('0x59')][_0x25a2('0x45')];}})[_0x25a2('0x24')](function(_0x5a9973){if(_0x5a9973){var _0x1c4fb6={};var _0x1b7baa={};_0x1b7baa[_0x25a2('0x2a')]=_[_0x25a2('0x65')](_[_0x25a2('0x2b')](_0x5a9973),_['map'](_0x3accb0['CustomFields'],function(_0x1dcc1b){return util[_0x25a2('0x66')](_0x25a2('0x67'),_0x1dcc1b['id']);}));_0x1b7baa[_0x25a2('0x2c')]=_[_0x25a2('0x2b')](_0x37d69e[_0x25a2('0x2c')]);_0x1b7baa[_0x25a2('0x34')]=_['intersection'](_0x1b7baa['model'],_0x1b7baa[_0x25a2('0x2c')]);_0x1c4fb6['attributes']=_[_0x25a2('0x2e')](_0x1b7baa[_0x25a2('0x2a')],qs[_0x25a2('0x2f')](_0x37d69e[_0x25a2('0x2c')][_0x25a2('0x2f')]));_0x1c4fb6[_0x25a2('0x2d')]=_0x1c4fb6['attributes'][_0x25a2('0x30')]?_0x1c4fb6[_0x25a2('0x2d')]:_0x1b7baa[_0x25a2('0x2a')];if(!_0x37d69e['query'][_0x25a2('0x31')](_0x25a2('0x68'))){_0x1c4fb6[_0x25a2('0x1f')]=qs[_0x25a2('0x1f')](_0x37d69e[_0x25a2('0x2c')][_0x25a2('0x1f')]);_0x1c4fb6['offset']=qs[_0x25a2('0x1e')](_0x37d69e[_0x25a2('0x2c')][_0x25a2('0x1e')]);}_0x1c4fb6['order']=qs['sort'](_0x37d69e[_0x25a2('0x2c')]['sort']);_0x1c4fb6[_0x25a2('0x33')]=qs[_0x25a2('0x34')](_[_0x25a2('0x35')](_0x37d69e[_0x25a2('0x2c')],_0x1b7baa[_0x25a2('0x34')]));_0x1c4fb6[_0x25a2('0x69')]=!![];if(_0x37d69e['query'][_0x25a2('0x3c')]){_0x1c4fb6[_0x25a2('0x33')]=_[_0x25a2('0x36')](_0x1c4fb6['where'],{'$or':_['map'](_0x1c4fb6['attributes'],function(_0x41b2a0){var _0x13ac9e={};_0x13ac9e[_0x41b2a0]={'$like':'%'+_0x37d69e[_0x25a2('0x2c')][_0x25a2('0x3c')]+'%'};return _0x13ac9e;})});}_0x1c4fb6=_['merge']({},_0x1c4fb6,_0x37d69e['options']);return _0x3accb0['getContacts'](_0x1c4fb6);}})[_0x25a2('0x24')](respondWithResult(_0x266bdd,null))['catch'](handleError(_0x266bdd,null));};exports[_0x25a2('0x6a')]=function(_0x29b346,_0x27c589,_0x3954a6){var _0x454325;return db['CmList'][_0x25a2('0x46')]({'where':{'id':_0x29b346[_0x25a2('0x44')]['id']},'include':[{'model':db[_0x25a2('0x64')],'as':'CustomFields'}]})[_0x25a2('0x24')](handleEntityNotFound(_0x27c589,null))[_0x25a2('0x24')](function(_0x2d7803){if(_0x2d7803){_0x454325=_0x2d7803;return db[_0x25a2('0x59')][_0x25a2('0x45')];}})[_0x25a2('0x24')](function(_0x2c6e17){if(_0x2c6e17){var _0x127443={};var _0x11e78b={};_0x11e78b['model']=_[_0x25a2('0x65')](_['keys'](_0x2c6e17),_['map'](_0x454325[_0x25a2('0x6b')],function(_0x11cbbd){return util[_0x25a2('0x66')](_0x25a2('0x67'),_0x11cbbd['id']);}));_0x11e78b[_0x25a2('0x2c')]=_['keys'](_0x29b346[_0x25a2('0x2c')]);_0x11e78b['filters']=_['intersection'](_0x11e78b[_0x25a2('0x2a')],_0x11e78b[_0x25a2('0x2c')]);_0x127443['attributes']=_[_0x25a2('0x2e')](_0x11e78b['model'],qs['fields'](_0x29b346[_0x25a2('0x2c')]['fields']));_0x127443[_0x25a2('0x2d')]=_0x127443[_0x25a2('0x2d')][_0x25a2('0x30')]?_0x127443['attributes']:_0x11e78b['model'];if(!_0x29b346[_0x25a2('0x2c')][_0x25a2('0x31')](_0x25a2('0x68'))){_0x127443[_0x25a2('0x1f')]=qs[_0x25a2('0x1f')](_0x29b346[_0x25a2('0x2c')][_0x25a2('0x1f')]);_0x127443[_0x25a2('0x1e')]=qs['offset'](_0x29b346[_0x25a2('0x2c')][_0x25a2('0x1e')]);}_0x127443[_0x25a2('0x55')]=qs[_0x25a2('0x32')](_0x29b346[_0x25a2('0x2c')][_0x25a2('0x32')]);_0x127443[_0x25a2('0x33')]=qs[_0x25a2('0x34')](_[_0x25a2('0x35')](_0x29b346[_0x25a2('0x2c')],_0x11e78b[_0x25a2('0x34')]));_0x127443[_0x25a2('0x69')]=!![];if(_0x29b346[_0x25a2('0x2c')][_0x25a2('0x3c')]){_0x127443[_0x25a2('0x33')]=_['merge'](_0x127443[_0x25a2('0x33')],{'$or':_[_0x25a2('0x37')](_0x127443[_0x25a2('0x2d')],function(_0x2fd2c3){var _0x4891cc={};_0x4891cc[_0x2fd2c3]={'$like':'%'+_0x29b346['query']['filter']+'%'};return _0x4891cc;})});}_0x127443=_[_0x25a2('0x36')]({},_0x127443,_0x29b346['options']);return _0x454325[_0x25a2('0x63')](_0x127443);}})[_0x25a2('0x24')](function(_0x729f58){if(!_['isEmpty'](_0x729f58)){var _0x19de3a=toCsv(_0x729f58);var _0x2a2db6=Date[_0x25a2('0x6c')]();fs[_0x25a2('0x6d')](util[_0x25a2('0x66')](_0x25a2('0x6e'),_0x454325['id'],_0x2a2db6),_0x19de3a);_0x27c589[_0x25a2('0x6f')](_0x25a2('0x70'),_0x25a2('0x71')+util[_0x25a2('0x66')](_0x25a2('0x72'),_0x454325['id'],_0x2a2db6));_0x27c589[_0x25a2('0x6f')](_0x25a2('0x73'),_0x25a2('0x74'));return _0x27c589[_0x25a2('0x75')](util[_0x25a2('0x66')](_0x25a2('0x6e'),_0x454325['id'],_0x2a2db6));}else{return _0x27c589[_0x25a2('0x1a')](0xcc);}})[_0x25a2('0x42')](handleError(_0x27c589,null));};exports[_0x25a2('0x76')]=function(_0x193314,_0x4bcb95,_0x52a52d){var _0x2fd6d6;delete _0x193314[_0x25a2('0x48')]['id'];return db[_0x25a2('0x29')]['findOne']({'where':{'id':_0x193314['params']['id']}})['then'](handleEntityNotFound(_0x4bcb95,null))['then'](function(_0xd0478d){if(_0xd0478d){return db[_0x25a2('0x77')]['transaction'](function(_0x3605bf){return db['CmCustomField'][_0x25a2('0x47')](_0x193314[_0x25a2('0x48')],{'transaction':_0x3605bf})['then'](function(_0x472d9f){_0x2fd6d6=_0x472d9f;return _0xd0478d[_0x25a2('0x78')](_0x472d9f,{'transaction':_0x3605bf});})[_0x25a2('0x24')](function(){var _0x5daaa6={'type':db[_0x25a2('0x79')]['TEXT'],'transaction':_0x3605bf};switch(_0x193314[_0x25a2('0x48')][_0x25a2('0x38')]){case'text':_0x5daaa6['type']=db[_0x25a2('0x79')][_0x25a2('0x7a')];break;case _0x25a2('0x7b'):_0x5daaa6[_0x25a2('0x38')]=db[_0x25a2('0x79')][_0x25a2('0x7c')];break;case _0x25a2('0x7d'):_0x5daaa6['type']=db['Sequelize'][_0x25a2('0x7e')];_0x5daaa6['defaultValue']=![];break;default:}return db[_0x25a2('0x77')][_0x25a2('0x7f')][_0x25a2('0x80')](_0x25a2('0x81'),util[_0x25a2('0x66')](_0x25a2('0x82'),_0x2fd6d6['id']),_0x5daaa6);})[_0x25a2('0x24')](function(){return _0x2fd6d6;});});}})[_0x25a2('0x24')](respondWithResult(_0x4bcb95,null))[_0x25a2('0x42')](handleError(_0x4bcb95,null));};exports[_0x25a2('0x83')]=function(_0x5adc65,_0x3199a1,_0x588bab){var _0x4f8188={};var _0x1d57e2={};var _0x3f7813;var _0x65bf13;return db['CmList'][_0x25a2('0x84')]({'where':{'id':_0x5adc65[_0x25a2('0x44')]['id']}})[_0x25a2('0x24')](handleEntityNotFound(_0x3199a1,null))[_0x25a2('0x24')](function(_0x105fd3){if(_0x105fd3){_0x3f7813=_0x105fd3;_0x1d57e2[_0x25a2('0x2a')]=_[_0x25a2('0x2b')](db['CmCustomField'][_0x25a2('0x45')]);_0x1d57e2['query']=_['keys'](_0x5adc65[_0x25a2('0x2c')]);_0x1d57e2[_0x25a2('0x34')]=_[_0x25a2('0x2e')](_0x1d57e2[_0x25a2('0x2a')],_0x1d57e2[_0x25a2('0x2c')]);_0x4f8188[_0x25a2('0x2d')]=_[_0x25a2('0x2e')](_0x1d57e2[_0x25a2('0x2a')],qs['fields'](_0x5adc65[_0x25a2('0x2c')][_0x25a2('0x2f')]));_0x4f8188['attributes']=_0x4f8188['attributes'][_0x25a2('0x30')]?_0x4f8188[_0x25a2('0x2d')]:_0x1d57e2[_0x25a2('0x2a')];_0x4f8188['order']=qs[_0x25a2('0x32')](_0x5adc65[_0x25a2('0x2c')][_0x25a2('0x32')]);_0x4f8188[_0x25a2('0x33')]=qs[_0x25a2('0x34')](_[_0x25a2('0x35')](_0x5adc65['query'],_0x1d57e2[_0x25a2('0x34')]));_0x4f8188[_0x25a2('0x33')]=_['merge'](_0x4f8188[_0x25a2('0x33')],{'$or':[{'ListId':_0x105fd3['id']},{'ListId':null}]});if(_0x5adc65['query'][_0x25a2('0x3c')]){_0x4f8188[_0x25a2('0x33')]=_[_0x25a2('0x36')](_0x4f8188[_0x25a2('0x33')],{'$or':_[_0x25a2('0x37')](_0x4f8188['attributes'],function(_0x10614e){var _0x230e55={};_0x230e55[_0x10614e]={'$like':'%'+_0x5adc65['query'][_0x25a2('0x3c')]+'%'};return _0x230e55;})});}_0x4f8188=_[_0x25a2('0x36')]({},_0x4f8188,_0x5adc65['options']);return db[_0x25a2('0x64')][_0x25a2('0x85')](_0x4f8188);}})[_0x25a2('0x24')](respondWithResult(_0x3199a1,null))['catch'](handleError(_0x3199a1,null));};exports[_0x25a2('0x86')]=function(_0x5ab15b,_0x27670d,_0x23af63){return db['CmList'][_0x25a2('0x46')]({'where':{'id':_0x5ab15b[_0x25a2('0x44')]['id']}})['then'](handleEntityNotFound(_0x27670d,null))[_0x25a2('0x24')](function(_0x248f76){if(_0x248f76){return _0x248f76[_0x25a2('0x86')](_0x5ab15b[_0x25a2('0x48')][_0x25a2('0x57')],_[_0x25a2('0x87')](_0x5ab15b[_0x25a2('0x48')],[_0x25a2('0x57'),'id'])||{})[_0x25a2('0x88')](function(_0x377c5a){for(var _0x59d0db=0x0;_0x59d0db<_0x5ab15b[_0x25a2('0x48')][_0x25a2('0x57')][_0x25a2('0x30')];_0x59d0db+=0x1){socket[_0x25a2('0x89')](_0x25a2('0x8a'),{'UserId':_0x5ab15b['body'][_0x25a2('0x57')][_0x59d0db],'CmListId':_0x5ab15b[_0x25a2('0x44')]['id']});}return _0x377c5a;});}})[_0x25a2('0x24')](respondWithResult(_0x27670d,null))['catch'](handleError(_0x27670d,null));};exports[_0x25a2('0x8b')]=function(_0x486138,_0x107445,_0x5f1cbd){var _0x3c6005;return db['CmList'][_0x25a2('0x46')]({'where':{'id':_0x486138['params']['id']}})[_0x25a2('0x24')](handleEntityNotFound(_0x107445,null))[_0x25a2('0x24')](function(_0xf0fb16){if(_0xf0fb16){return _0xf0fb16[_0x25a2('0x8b')](_0x486138[_0x25a2('0x2c')][_0x25a2('0x57')])[_0x25a2('0x24')](function(_0x3ca644){if(_['isArray'](_0x486138[_0x25a2('0x2c')][_0x25a2('0x57')])){for(var _0x65a2a0=0x0;_0x65a2a0<_0x486138[_0x25a2('0x2c')][_0x25a2('0x57')]['length'];_0x65a2a0+=0x1){socket[_0x25a2('0x89')]('userCmList:remove',{'UserId':_0x486138['query'][_0x25a2('0x57')][_0x65a2a0],'CmListId':_0x486138[_0x25a2('0x44')]['id']});}}else{socket[_0x25a2('0x89')](_0x25a2('0x8c'),{'UserId':_0x486138[_0x25a2('0x2c')][_0x25a2('0x57')],'CmListId':_0x486138[_0x25a2('0x44')]['id']});}});}})[_0x25a2('0x24')](respondWithStatusCode(_0x107445,null))[_0x25a2('0x42')](handleError(_0x107445,null));};exports[_0x25a2('0x8d')]=function(_0x4ba6ae,_0x141781,_0x232a7){var _0xc85b18={};var _0x34006b={};var _0x2ece15;var _0x32b819;return db[_0x25a2('0x29')][_0x25a2('0x84')]({'where':{'id':_0x4ba6ae[_0x25a2('0x44')]['id']}})[_0x25a2('0x24')](handleEntityNotFound(_0x141781,null))['then'](function(_0x2cde51){if(_0x2cde51){_0x2ece15=_0x2cde51;_0x34006b[_0x25a2('0x2a')]=_[_0x25a2('0x2b')](db[_0x25a2('0x8e')][_0x25a2('0x45')]);_0x34006b[_0x25a2('0x2c')]=_[_0x25a2('0x2b')](_0x4ba6ae[_0x25a2('0x2c')]);_0x34006b['filters']=_[_0x25a2('0x2e')](_0x34006b[_0x25a2('0x2a')],_0x34006b[_0x25a2('0x2c')]);_0xc85b18[_0x25a2('0x2d')]=_[_0x25a2('0x2e')](_0x34006b[_0x25a2('0x2a')],qs[_0x25a2('0x2f')](_0x4ba6ae[_0x25a2('0x2c')]['fields']));_0xc85b18[_0x25a2('0x2d')]=_0xc85b18[_0x25a2('0x2d')][_0x25a2('0x30')]?_0xc85b18['attributes']:_0x34006b[_0x25a2('0x2a')];_0xc85b18[_0x25a2('0x55')]=qs[_0x25a2('0x32')](_0x4ba6ae['query']['sort']);_0xc85b18[_0x25a2('0x33')]=qs['filters'](_['pick'](_0x4ba6ae[_0x25a2('0x2c')],_0x34006b['filters']));if(_0x4ba6ae[_0x25a2('0x2c')][_0x25a2('0x3c')]){_0xc85b18['where']=_[_0x25a2('0x36')](_0xc85b18['where'],{'$or':_[_0x25a2('0x37')](_0xc85b18[_0x25a2('0x2d')],function(_0x1b3bb9){var _0x4c77e4={};_0x4c77e4[_0x1b3bb9]={'$like':'%'+_0x4ba6ae[_0x25a2('0x2c')][_0x25a2('0x3c')]+'%'};return _0x4c77e4;})});}_0xc85b18=_['merge']({},_0xc85b18,_0x4ba6ae[_0x25a2('0x3d')]);return _0x2ece15['getAgents'](_0xc85b18);}})['then'](function(_0x19b989){if(_0x19b989){_0x32b819=_0x19b989[_0x25a2('0x30')];if(!_0x4ba6ae[_0x25a2('0x2c')]['hasOwnProperty'](_0x25a2('0x68'))){_0xc85b18[_0x25a2('0x1f')]=qs[_0x25a2('0x1f')](_0x4ba6ae[_0x25a2('0x2c')]['limit']);_0xc85b18[_0x25a2('0x1e')]=qs[_0x25a2('0x1e')](_0x4ba6ae[_0x25a2('0x2c')][_0x25a2('0x1e')]);}return _0x2ece15[_0x25a2('0x8d')](_0xc85b18);}})[_0x25a2('0x24')](function(_0x1ffe05){if(_0x1ffe05){return _0x1ffe05?{'count':_0x32b819,'rows':_0x1ffe05}:null;}})['then'](respondWithResult(_0x141781,null))[_0x25a2('0x42')](handleError(_0x141781,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 37fdf70..771840c 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 _0x047d=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x047d,0x197));var _0xd047=function(_0x143d3b,_0xb6be65){_0x143d3b=_0x143d3b-0x0;var _0x23a63c=_0x047d[_0x143d3b];return _0x23a63c;};'use strict';var EventEmitter=require(_0xd047('0x0'));var CmList=require(_0xd047('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xd047('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd047('0x3'),'afterDestroy':_0xd047('0x4')};function emitEvent(_0x522ee9){return function(_0x5ea9e0,_0x4a1703,_0x348dd3){CmListEvents[_0xd047('0x5')](_0x522ee9+':'+_0x5ea9e0['id'],_0x5ea9e0);CmListEvents['emit'](_0x522ee9,_0x5ea9e0);_0x348dd3(null);};}for(var e in events){if(events[_0xd047('0x6')](e)){var event=events[e];CmList[_0xd047('0x7')](e,emitEvent(event));}}module[_0xd047('0x8')]=CmListEvents; \ No newline at end of file +var _0xd63e=['remove','emit','hook','events','CmList','setMaxListeners','save','update'];(function(_0x256d56,_0x24d87e){var _0x4010e3=function(_0x5a70c1){while(--_0x5a70c1){_0x256d56['push'](_0x256d56['shift']());}};_0x4010e3(++_0x24d87e);}(_0xd63e,0x19b));var _0xed63=function(_0x28fa86,_0x303544){_0x28fa86=_0x28fa86-0x0;var _0x33f670=_0xd63e[_0x28fa86];return _0x33f670;};'use strict';var EventEmitter=require(_0xed63('0x0'));var CmList=require('../../mysqldb')['db'][_0xed63('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0xed63('0x2')](0x0);var events={'afterCreate':_0xed63('0x3'),'afterUpdate':_0xed63('0x4'),'afterDestroy':_0xed63('0x5')};function emitEvent(_0x7871d3){return function(_0x13be4b,_0x24929b,_0x2ac712){CmListEvents[_0xed63('0x6')](_0x7871d3+':'+_0x13be4b['id'],_0x13be4b);CmListEvents['emit'](_0x7871d3,_0x13be4b);_0x2ac712(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xed63('0x7')](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 8de869a..494b8a7 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 _0x7b09=['exports','CmList','cm_lists','util','../../config/logger','api','moment','bluebird','./cmList.attributes'];(function(_0x2a0034,_0x1e5779){var _0x11f8e4=function(_0x9b4a4f){while(--_0x9b4a4f){_0x2a0034['push'](_0x2a0034['shift']());}};_0x11f8e4(++_0x1e5779);}(_0x7b09,0x174));var _0x97b0=function(_0x5e7e28,_0x20aee5){_0x5e7e28=_0x5e7e28-0x0;var _0x119c59=_0x7b09[_0x5e7e28];return _0x119c59;};'use strict';var _=require('lodash');var util=require(_0x97b0('0x0'));var logger=require(_0x97b0('0x1'))(_0x97b0('0x2'));var moment=require(_0x97b0('0x3'));var BPromise=require(_0x97b0('0x4'));var rp=require('request-promise');var attributes=require(_0x97b0('0x5'));module[_0x97b0('0x6')]=function(_0x284e6b,_0x1d8b93){return _0x284e6b['define'](_0x97b0('0x7'),attributes,{'tableName':_0x97b0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9c3=['api','moment','bluebird','request-promise','define','CmList','cm_lists','lodash','util','../../config/logger'];(function(_0x103a07,_0x35acb4){var _0x404596=function(_0x5b6cf8){while(--_0x5b6cf8){_0x103a07['push'](_0x103a07['shift']());}};_0x404596(++_0x35acb4);}(_0xc9c3,0x165));var _0x3c9c=function(_0x2f27c8,_0x28aa44){_0x2f27c8=_0x2f27c8-0x0;var _0x2f8b0c=_0xc9c3[_0x2f27c8];return _0x2f8b0c;};'use strict';var _=require(_0x3c9c('0x0'));var util=require(_0x3c9c('0x1'));var logger=require(_0x3c9c('0x2'))(_0x3c9c('0x3'));var moment=require(_0x3c9c('0x4'));var BPromise=require(_0x3c9c('0x5'));var rp=require(_0x3c9c('0x6'));var attributes=require('./cmList.attributes');module['exports']=function(_0x3aace1,_0x118cd7){return _0x3aace1[_0x3c9c('0x7')](_0x3c9c('0x8'),attributes,{'tableName':_0x3c9c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 09a3d89..e1355a9 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 _0x553e=['info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x553e,0xfd));var _0xe553=function(_0x58a091,_0x22abd5){_0x58a091=_0x58a091-0x0;var _0x46c541=_0x553e[_0x58a091];return _0x46c541;};'use strict';var _=require(_0xe553('0x0'));var util=require('util');var moment=require(_0xe553('0x1'));var BPromise=require(_0xe553('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe553('0x3'));var db=require(_0xe553('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe553('0x5'))('rpc');var config=require(_0xe553('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe553('0x7')][_0xe553('0x8')]({'port':0x232a});config[_0xe553('0x9')]=_[_0xe553('0xa')](config[_0xe553('0x9')],{'host':_0xe553('0xb'),'port':0x18eb});var socket=require(_0xe553('0xc'))(new Redis(config[_0xe553('0x9')]));require(_0xe553('0xd'))[_0xe553('0xe')](socket);function respondWithRpcPromise(_0x28abec,_0x420269,_0x28b104){return new BPromise(function(_0x1d7a71,_0x11dee5){return client[_0xe553('0xf')](_0x28abec,_0x28b104)[_0xe553('0x10')](function(_0x312720){logger[_0xe553('0x11')](_0xe553('0x12'),_0x420269,_0xe553('0x13'));logger[_0xe553('0x14')](_0xe553('0x15'),_0x420269,_0xe553('0x13'),JSON[_0xe553('0x16')](_0x312720));if(_0x312720['error']){if(_0x312720[_0xe553('0x17')][_0xe553('0x18')]===0x1f4){logger[_0xe553('0x17')]('CmList,\x20%s,\x20%s',_0x420269,_0x312720[_0xe553('0x17')][_0xe553('0x19')]);return _0x11dee5(_0x312720[_0xe553('0x17')][_0xe553('0x19')]);}logger[_0xe553('0x17')](_0xe553('0x12'),_0x420269,_0x312720[_0xe553('0x17')][_0xe553('0x19')]);return _0x1d7a71(_0x312720[_0xe553('0x17')][_0xe553('0x19')]);}else{logger[_0xe553('0x11')](_0xe553('0x12'),_0x420269,_0xe553('0x13'));_0x1d7a71(_0x312720[_0xe553('0x1a')][_0xe553('0x19')]);}})['catch'](function(_0x1c7787){logger[_0xe553('0x17')]('CmList,\x20%s,\x20%s',_0x420269,_0x1c7787);_0x11dee5(_0x1c7787);});});} \ No newline at end of file +var _0xf337=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf337,0x171));var _0x7f33=function(_0x197246,_0x1ba3fe){_0x197246=_0x197246-0x0;var _0x2dc955=_0xf337[_0x197246];return _0x2dc955;};'use strict';var _=require('lodash');var util=require(_0x7f33('0x0'));var moment=require(_0x7f33('0x1'));var BPromise=require(_0x7f33('0x2'));var rs=require(_0x7f33('0x3'));var fs=require('fs');var Redis=require(_0x7f33('0x4'));var db=require(_0x7f33('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f33('0x6'))('rpc');var config=require(_0x7f33('0x7'));var jayson=require(_0x7f33('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x7f33('0x9')],{'host':_0x7f33('0xa'),'port':0x18eb});var socket=require(_0x7f33('0xb'))(new Redis(config[_0x7f33('0x9')]));require('./cmList.socket')[_0x7f33('0xc')](socket);function respondWithRpcPromise(_0x50effa,_0x187345,_0x476326){return new BPromise(function(_0x146cd8,_0x4148a9){return client[_0x7f33('0xd')](_0x50effa,_0x476326)['then'](function(_0x332be6){logger[_0x7f33('0xe')](_0x7f33('0xf'),_0x187345,_0x7f33('0x10'));logger[_0x7f33('0x11')](_0x7f33('0x12'),_0x187345,_0x7f33('0x10'),JSON[_0x7f33('0x13')](_0x332be6));if(_0x332be6[_0x7f33('0x14')]){if(_0x332be6[_0x7f33('0x14')]['code']===0x1f4){logger['error'](_0x7f33('0xf'),_0x187345,_0x332be6[_0x7f33('0x14')][_0x7f33('0x15')]);return _0x4148a9(_0x332be6[_0x7f33('0x14')][_0x7f33('0x15')]);}logger[_0x7f33('0x14')](_0x7f33('0xf'),_0x187345,_0x332be6['error'][_0x7f33('0x15')]);return _0x146cd8(_0x332be6[_0x7f33('0x14')][_0x7f33('0x15')]);}else{logger[_0x7f33('0xe')](_0x7f33('0xf'),_0x187345,_0x7f33('0x10'));_0x146cd8(_0x332be6['result'][_0x7f33('0x15')]);}})[_0x7f33('0x16')](function(_0x281c1a){logger[_0x7f33('0x14')]('CmList,\x20%s,\x20%s',_0x187345,_0x281c1a);_0x4148a9(_0x281c1a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index ad99d0a..676506e 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 _0x3409=['removeListener','length','cmList:','./cmList.events','save','remove','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3409,0x13e));var _0x9340=function(_0x32db83,_0x903559){_0x32db83=_0x32db83-0x0;var _0xe2384f=_0x3409[_0x32db83];return _0xe2384f;};'use strict';var CmListEvents=require(_0x9340('0x0'));var events=[_0x9340('0x1'),_0x9340('0x2'),_0x9340('0x3')];function createListener(_0x1b56ec,_0x47afec){return function(_0x21376d){_0x47afec['emit'](_0x1b56ec,_0x21376d);};}function removeListener(_0x57fb4a,_0x4049a7){return function(){CmListEvents[_0x9340('0x4')](_0x57fb4a,_0x4049a7);};}exports['register']=function(_0x172d70){for(var _0x224024=0x0,_0x4a76bd=events[_0x9340('0x5')];_0x224024<_0x4a76bd;_0x224024++){var _0x17448f=events[_0x224024];var _0x178bf3=createListener(_0x9340('0x6')+_0x17448f,_0x172d70);CmListEvents['on'](_0x17448f,_0x178bf3);}}; \ No newline at end of file +var _0x3984=['update','emit','removeListener','register','length','./cmList.events','save','remove'];(function(_0x52ebf1,_0x1039f0){var _0x4c7e89=function(_0x2a759e){while(--_0x2a759e){_0x52ebf1['push'](_0x52ebf1['shift']());}};_0x4c7e89(++_0x1039f0);}(_0x3984,0x1ad));var _0x4398=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0x3984[_0x49cb71];return _0x3a50fd;};'use strict';var CmListEvents=require(_0x4398('0x0'));var events=[_0x4398('0x1'),_0x4398('0x2'),_0x4398('0x3')];function createListener(_0x1d7b26,_0x558d15){return function(_0x22d2b6){_0x558d15[_0x4398('0x4')](_0x1d7b26,_0x22d2b6);};}function removeListener(_0x5e02af,_0x1303fd){return function(){CmListEvents[_0x4398('0x5')](_0x5e02af,_0x1303fd);};}exports[_0x4398('0x6')]=function(_0x257a01){for(var _0xcce27f=0x0,_0x25e7f6=events[_0x4398('0x7')];_0xcce27f<_0x25e7f6;_0xcce27f++){var _0x164af=events[_0xcce27f];var _0x3fa011=createListener('cmList:'+_0x164af,_0x257a01);CmListEvents['on'](_0x164af,_0x3fa011);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d711864..88e68a2 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 _0x59b7=['../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getAgents','create','post','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x59b7,0x1e6));var _0x759b=function(_0x179d88,_0x481939){_0x179d88=_0x179d88-0x0;var _0x1b6674=_0x59b7[_0x179d88];return _0x1b6674;};'use strict';var multer=require(_0x759b('0x0'));var util=require(_0x759b('0x1'));var path=require(_0x759b('0x2'));var timeout=require(_0x759b('0x3'));var express=require(_0x759b('0x4'));var router=express[_0x759b('0x5')]();var auth=require(_0x759b('0x6'));var interaction=require(_0x759b('0x7'));var config=require(_0x759b('0x8'));var controller=require(_0x759b('0x9'));router[_0x759b('0xa')]('/',auth['isAuthenticated'](),controller[_0x759b('0xb')]);router[_0x759b('0xa')](_0x759b('0xc'),auth[_0x759b('0xd')](),controller[_0x759b('0xe')]);router[_0x759b('0xa')](_0x759b('0xf'),auth[_0x759b('0xd')](),controller[_0x759b('0x10')]);router['get'](_0x759b('0x11'),auth[_0x759b('0xd')](),controller[_0x759b('0x12')]);router['get'](_0x759b('0x13'),auth['isAuthenticated'](),controller[_0x759b('0x14')]);router[_0x759b('0xa')](_0x759b('0x15'),auth[_0x759b('0xd')](),controller[_0x759b('0x16')]);router[_0x759b('0xa')](_0x759b('0x17'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0x759b('0xa')]('/:id/users',auth[_0x759b('0xd')](),controller[_0x759b('0x18')]);router['post']('/',auth[_0x759b('0xd')](),controller[_0x759b('0x19')]);router[_0x759b('0x1a')]('/:id/dispositions',auth[_0x759b('0xd')](),controller[_0x759b('0x1b')]);router['post']('/:id/contacts',auth[_0x759b('0xd')](),controller[_0x759b('0x1c')]);router[_0x759b('0x1a')](_0x759b('0x17'),auth['isAuthenticated'](),controller[_0x759b('0x1d')]);router['post'](_0x759b('0x1e'),auth[_0x759b('0xd')](),controller[_0x759b('0x1f')]);router[_0x759b('0x20')](_0x759b('0xf'),auth[_0x759b('0xd')](),controller[_0x759b('0x21')]);router[_0x759b('0x22')]('/:id',auth[_0x759b('0xd')](),controller[_0x759b('0x23')]);router[_0x759b('0x22')](_0x759b('0x11'),auth[_0x759b('0xd')](),controller[_0x759b('0x24')]);router['delete']('/:id/users',auth[_0x759b('0xd')](),controller['removeAgents']);module[_0x759b('0x25')]=router; \ No newline at end of file +var _0xd1e1=['destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv','post','create','addDisposition','addContacts','/:id/fields','addCustomField','/:id/users','addAgents','put','update','delete'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xd1e1,0xe3));var _0x1d1e=function(_0xabc23e,_0x3d3662){_0xabc23e=_0xabc23e-0x0;var _0x5991d4=_0xd1e1[_0xabc23e];return _0x5991d4;};'use strict';var multer=require(_0x1d1e('0x0'));var util=require(_0x1d1e('0x1'));var path=require(_0x1d1e('0x2'));var timeout=require(_0x1d1e('0x3'));var express=require(_0x1d1e('0x4'));var router=express[_0x1d1e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1d1e('0x6'));var config=require(_0x1d1e('0x7'));var controller=require('./cmList.controller');router[_0x1d1e('0x8')]('/',auth['isAuthenticated'](),controller[_0x1d1e('0x9')]);router[_0x1d1e('0x8')](_0x1d1e('0xa'),auth[_0x1d1e('0xb')](),controller['describe']);router['get'](_0x1d1e('0xc'),auth[_0x1d1e('0xb')](),controller['show']);router[_0x1d1e('0x8')](_0x1d1e('0xd'),auth['isAuthenticated'](),controller[_0x1d1e('0xe')]);router['get'](_0x1d1e('0xf'),auth[_0x1d1e('0xb')](),controller[_0x1d1e('0x10')]);router[_0x1d1e('0x8')]('/:id/contacts/csv',auth[_0x1d1e('0xb')](),controller[_0x1d1e('0x11')]);router[_0x1d1e('0x8')]('/:id/fields',auth[_0x1d1e('0xb')](),controller['getCustomFields']);router['get']('/:id/users',auth[_0x1d1e('0xb')](),controller['getAgents']);router[_0x1d1e('0x12')]('/',auth[_0x1d1e('0xb')](),controller[_0x1d1e('0x13')]);router[_0x1d1e('0x12')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1d1e('0x14')]);router[_0x1d1e('0x12')](_0x1d1e('0xf'),auth['isAuthenticated'](),controller[_0x1d1e('0x15')]);router[_0x1d1e('0x12')](_0x1d1e('0x16'),auth['isAuthenticated'](),controller[_0x1d1e('0x17')]);router[_0x1d1e('0x12')](_0x1d1e('0x18'),auth[_0x1d1e('0xb')](),controller[_0x1d1e('0x19')]);router[_0x1d1e('0x1a')]('/:id',auth[_0x1d1e('0xb')](),controller[_0x1d1e('0x1b')]);router[_0x1d1e('0x1c')](_0x1d1e('0xc'),auth['isAuthenticated'](),controller[_0x1d1e('0x1d')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1d1e('0x1e')]);router[_0x1d1e('0x1c')](_0x1d1e('0x18'),auth[_0x1d1e('0xb')](),controller[_0x1d1e('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 48b3786..80031de 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 _0x21c1=['sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x21c1,0x1e5));var _0x121c=function(_0x2c9413,_0x3d42db){_0x2c9413=_0x2c9413-0x0;var _0xc74f50=_0x21c1[_0x2c9413];return _0xc74f50;};'use strict';var Sequelize=require(_0x121c('0x0'));module[_0x121c('0x1')]={'name':{'type':Sequelize[_0x121c('0x2')],'get':function(_0x3fc3ed){return this[_0x121c('0x3')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x121c('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x121c('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x31d0=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x50eba0,_0x3f92b4){var _0x21c82b=function(_0x2fb4ec){while(--_0x2fb4ec){_0x50eba0['push'](_0x50eba0['shift']());}};_0x21c82b(++_0x3f92b4);}(_0x31d0,0x121));var _0x031d=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0x31d0[_0x59b439];return _0x521ea3;};'use strict';var Sequelize=require(_0x031d('0x0'));module[_0x031d('0x1')]={'name':{'type':Sequelize[_0x031d('0x2')],'get':function(_0x6586be){return this[_0x031d('0x3')](_0x031d('0x4'));}},'field':{'type':Sequelize[_0x031d('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x031d('0x5')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 833a373..e76a8ce 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 _0xb903=['params','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','body','Condition','find'];(function(_0x30d87a,_0xf3a07f){var _0x48f64b=function(_0x2078b7){while(--_0x2078b7){_0x30d87a['push'](_0x30d87a['shift']());}};_0x48f64b(++_0xf3a07f);}(_0xb903,0x185));var _0x3b90=function(_0x1cb6ef,_0x2f944a){_0x1cb6ef=_0x1cb6ef-0x0;var _0x3fe414=_0xb903[_0x1cb6ef];return _0x3fe414;};'use strict';var pdf=require(_0x3b90('0x0'));var emlformat=require(_0x3b90('0x1'));var rimraf=require(_0x3b90('0x2'));var zipdir=require(_0x3b90('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b90('0x4'));var moment=require(_0x3b90('0x5'));var BPromise=require(_0x3b90('0x6'));var Mustache=require(_0x3b90('0x7'));var util=require(_0x3b90('0x8'));var path=require(_0x3b90('0x9'));var sox=require(_0x3b90('0xa'));var csv=require('to-csv');var ejs=require(_0x3b90('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b90('0xc'));var jsforce=require(_0x3b90('0xd'));var deskjs=require(_0x3b90('0xe'));var toCsv=require(_0x3b90('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x3b90('0x10'))(_0x3b90('0x11'));var utils=require('../../config/utils');var config=require(_0x3b90('0x12'));var db=require(_0x3b90('0x13'))['db'];function respondWithStatusCode(_0x4bb8f4,_0x45b75f){_0x45b75f=_0x45b75f||0xcc;return function(_0x174c0d){if(_0x174c0d){return _0x4bb8f4[_0x3b90('0x14')](_0x45b75f);}return _0x4bb8f4['status'](_0x45b75f)['end']();};}function respondWithResult(_0x58c4d1,_0x542cb3){_0x542cb3=_0x542cb3||0xc8;return function(_0x492d39){if(_0x492d39){return _0x58c4d1[_0x3b90('0x15')](_0x542cb3)[_0x3b90('0x16')](_0x492d39);}};}function respondWithFilteredResult(_0x4824f9,_0x51fb66){return function(_0x3725b9){if(_0x3725b9){var _0x1b6349=_0x3725b9['count'],_0x381a9e=_0x51fb66['offset'],_0x1af265=_0x51fb66[_0x3b90('0x17')]+_0x51fb66[_0x3b90('0x18')],_0x1efe01;if(_0x1af265>=_0x1b6349){_0x1af265=_0x1b6349;_0x1efe01=0xc8;}else{_0x1efe01=0xce;}_0x4824f9['status'](_0x1efe01);return _0x4824f9[_0x3b90('0x19')](_0x3b90('0x1a'),_0x381a9e+'-'+_0x1af265+'/'+_0x1b6349)[_0x3b90('0x16')](_0x3725b9);}return null;};}function patchUpdates(_0x131f3f){return function(_0x4f388b){try{jsonpatch[_0x3b90('0x1b')](_0x4f388b,_0x131f3f,!![]);}catch(_0x5d140f){return BPromise[_0x3b90('0x1c')](_0x5d140f);}return _0x4f388b[_0x3b90('0x1d')]();};}function saveUpdates(_0x535894,_0x39ae7c){return function(_0x12e1cf){if(_0x12e1cf){return _0x12e1cf[_0x3b90('0x1e')](_0x535894)[_0x3b90('0x1f')](function(_0xc74d57){return _0xc74d57;});}return null;};}function removeEntity(_0x43deca,_0x3bc7d5){return function(_0x2f4270){if(_0x2f4270){return _0x2f4270[_0x3b90('0x20')]()[_0x3b90('0x1f')](function(){_0x43deca['status'](0xcc)[_0x3b90('0x21')]();});}};}function handleEntityNotFound(_0x36b93e,_0x175b42){return function(_0x7faee){if(!_0x7faee){_0x36b93e[_0x3b90('0x14')](0x194);}return _0x7faee;};}function handleError(_0x93b8e7,_0x58fa12){_0x58fa12=_0x58fa12||0x1f4;return function(_0x4b308c){logger[_0x3b90('0x22')](_0x4b308c[_0x3b90('0x23')]);if(_0x4b308c[_0x3b90('0x24')]){delete _0x4b308c[_0x3b90('0x24')];}_0x93b8e7['status'](_0x58fa12)[_0x3b90('0x25')](_0x4b308c);};}exports[_0x3b90('0x1e')]=function(_0x1787d1,_0x4caead){if(_0x1787d1[_0x3b90('0x26')]['id']){delete _0x1787d1[_0x3b90('0x26')]['id'];}return db[_0x3b90('0x27')][_0x3b90('0x28')]({'where':{'id':_0x1787d1[_0x3b90('0x29')]['id']}})[_0x3b90('0x1f')](handleEntityNotFound(_0x4caead,null))['then'](saveUpdates(_0x1787d1[_0x3b90('0x26')],null))['then'](respondWithResult(_0x4caead,null))[_0x3b90('0x2a')](handleError(_0x4caead,null));};exports[_0x3b90('0x20')]=function(_0x1a193e,_0x38eed0){return db[_0x3b90('0x27')][_0x3b90('0x28')]({'where':{'id':_0x1a193e[_0x3b90('0x29')]['id']}})[_0x3b90('0x1f')](handleEntityNotFound(_0x38eed0,null))['then'](removeEntity(_0x38eed0,null))['catch'](handleError(_0x38eed0,null));}; \ No newline at end of file +var _0x9f62=['Condition','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','body'];(function(_0x26e14d,_0x1ba410){var _0x5f29c1=function(_0x2af084){while(--_0x2af084){_0x26e14d['push'](_0x26e14d['shift']());}};_0x5f29c1(++_0x1ba410);}(_0x9f62,0x154));var _0x29f6=function(_0x35d5cf,_0xbb1fb5){_0x35d5cf=_0x35d5cf-0x0;var _0x31f9ed=_0x9f62[_0x35d5cf];return _0x31f9ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x29f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29f6('0x1'));var jsonpatch=require(_0x29f6('0x2'));var rp=require(_0x29f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29f6('0x4'));var util=require(_0x29f6('0x5'));var path=require(_0x29f6('0x6'));var sox=require(_0x29f6('0x7'));var csv=require('to-csv');var ejs=require(_0x29f6('0x8'));var fs=require('fs');var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x29f6('0xd'));var hardwareService=require(_0x29f6('0xe'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x29f6('0xf'))(_0x29f6('0x10'));var utils=require('../../config/utils');var config=require(_0x29f6('0x11'));var db=require(_0x29f6('0x12'))['db'];function respondWithStatusCode(_0x5cf872,_0x5b9b6a){_0x5b9b6a=_0x5b9b6a||0xcc;return function(_0x559585){if(_0x559585){return _0x5cf872['sendStatus'](_0x5b9b6a);}return _0x5cf872[_0x29f6('0x13')](_0x5b9b6a)[_0x29f6('0x14')]();};}function respondWithResult(_0x189344,_0x11a1fd){_0x11a1fd=_0x11a1fd||0xc8;return function(_0x17de6e){if(_0x17de6e){return _0x189344[_0x29f6('0x13')](_0x11a1fd)[_0x29f6('0x15')](_0x17de6e);}};}function respondWithFilteredResult(_0x2418ee,_0x1ae582){return function(_0x19331f){if(_0x19331f){var _0x28d314=_0x19331f[_0x29f6('0x16')],_0x370484=_0x1ae582[_0x29f6('0x17')],_0x1dde97=_0x1ae582[_0x29f6('0x17')]+_0x1ae582['limit'],_0x3a75d0;if(_0x1dde97>=_0x28d314){_0x1dde97=_0x28d314;_0x3a75d0=0xc8;}else{_0x3a75d0=0xce;}_0x2418ee['status'](_0x3a75d0);return _0x2418ee[_0x29f6('0x18')](_0x29f6('0x19'),_0x370484+'-'+_0x1dde97+'/'+_0x28d314)[_0x29f6('0x15')](_0x19331f);}return null;};}function patchUpdates(_0x5c8246){return function(_0xcb90){try{jsonpatch[_0x29f6('0x1a')](_0xcb90,_0x5c8246,!![]);}catch(_0x49252f){return BPromise[_0x29f6('0x1b')](_0x49252f);}return _0xcb90[_0x29f6('0x1c')]();};}function saveUpdates(_0x42a8fa,_0x41b9f0){return function(_0xb6e7a9){if(_0xb6e7a9){return _0xb6e7a9[_0x29f6('0x1d')](_0x42a8fa)['then'](function(_0xfb8fd2){return _0xfb8fd2;});}return null;};}function removeEntity(_0x59def4,_0x4acb15){return function(_0x470019){if(_0x470019){return _0x470019[_0x29f6('0x1e')]()[_0x29f6('0x1f')](function(){_0x59def4[_0x29f6('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c672e,_0x49f67d){return function(_0xd4179c){if(!_0xd4179c){_0x2c672e[_0x29f6('0x20')](0x194);}return _0xd4179c;};}function handleError(_0x4200cc,_0x1b80aa){_0x1b80aa=_0x1b80aa||0x1f4;return function(_0x4fc725){logger[_0x29f6('0x21')](_0x4fc725[_0x29f6('0x22')]);if(_0x4fc725['name']){delete _0x4fc725[_0x29f6('0x23')];}_0x4200cc[_0x29f6('0x13')](_0x1b80aa)[_0x29f6('0x24')](_0x4fc725);};}exports[_0x29f6('0x1d')]=function(_0x84ccb7,_0x4333bc){if(_0x84ccb7[_0x29f6('0x25')]['id']){delete _0x84ccb7['body']['id'];}return db[_0x29f6('0x26')][_0x29f6('0x27')]({'where':{'id':_0x84ccb7[_0x29f6('0x28')]['id']}})[_0x29f6('0x1f')](handleEntityNotFound(_0x4333bc,null))[_0x29f6('0x1f')](saveUpdates(_0x84ccb7[_0x29f6('0x25')],null))[_0x29f6('0x1f')](respondWithResult(_0x4333bc,null))[_0x29f6('0x29')](handleError(_0x4333bc,null));};exports[_0x29f6('0x1e')]=function(_0x13a3a2,_0x2915bc){return db[_0x29f6('0x26')][_0x29f6('0x27')]({'where':{'id':_0x13a3a2[_0x29f6('0x28')]['id']}})[_0x29f6('0x1f')](handleEntityNotFound(_0x2915bc,null))[_0x29f6('0x1f')](removeEntity(_0x2915bc,null))[_0x29f6('0x29')](handleError(_0x2915bc,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index d731c5d..24a57c5 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 _0x4fe8=['api','moment','bluebird','request-promise','define','lodash','util','../../config/logger'];(function(_0x52755b,_0x2f936c){var _0x2bb794=function(_0x11ed99){while(--_0x11ed99){_0x52755b['push'](_0x52755b['shift']());}};_0x2bb794(++_0x2f936c);}(_0x4fe8,0x155));var _0x84fe=function(_0x1bf6eb,_0x1d165d){_0x1bf6eb=_0x1bf6eb-0x0;var _0x6da1eb=_0x4fe8[_0x1bf6eb];return _0x6da1eb;};'use strict';var _=require(_0x84fe('0x0'));var util=require(_0x84fe('0x1'));var logger=require(_0x84fe('0x2'))(_0x84fe('0x3'));var moment=require(_0x84fe('0x4'));var BPromise=require(_0x84fe('0x5'));var rp=require(_0x84fe('0x6'));var attributes=require('./condition.attributes');module['exports']=function(_0x2e1365,_0x1eae55){return _0x2e1365[_0x84fe('0x7')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a74=['api','moment','bluebird','request-promise','./condition.attributes','define','Condition','tools_conditions','lodash','../../config/logger'];(function(_0x4aa155,_0x291fb9){var _0x1db59d=function(_0x332572){while(--_0x332572){_0x4aa155['push'](_0x4aa155['shift']());}};_0x1db59d(++_0x291fb9);}(_0x2a74,0xf8));var _0x42a7=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0x2a74[_0x2e6dbf];return _0x2680e5;};'use strict';var _=require(_0x42a7('0x0'));var util=require('util');var logger=require(_0x42a7('0x1'))(_0x42a7('0x2'));var moment=require(_0x42a7('0x3'));var BPromise=require(_0x42a7('0x4'));var rp=require(_0x42a7('0x5'));var attributes=require(_0x42a7('0x6'));module['exports']=function(_0xf7c057,_0x535e96){return _0xf7c057[_0x42a7('0x7')](_0x42a7('0x8'),attributes,{'tableName':_0x42a7('0x9'),'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 4fd1d1a..26f11eb 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 _0x94fb=['info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x43a253,_0x5363fe){var _0x23e31e=function(_0x10b782){while(--_0x10b782){_0x43a253['push'](_0x43a253['shift']());}};_0x23e31e(++_0x5363fe);}(_0x94fb,0x13d));var _0xb94f=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0x94fb[_0x92713a];return _0x1893e1;};'use strict';var _=require(_0xb94f('0x0'));var util=require(_0xb94f('0x1'));var moment=require(_0xb94f('0x2'));var BPromise=require(_0xb94f('0x3'));var rs=require(_0xb94f('0x4'));var fs=require('fs');var Redis=require(_0xb94f('0x5'));var db=require(_0xb94f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb94f('0x7'))(_0xb94f('0x8'));var config=require('../../config/environment');var jayson=require(_0xb94f('0x9'));var client=jayson[_0xb94f('0xa')][_0xb94f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d160,_0x1933e0,_0x335797){return new BPromise(function(_0x49b0aa,_0xb61ac9){return client[_0xb94f('0xc')](_0x37d160,_0x335797)['then'](function(_0x4527e6){logger[_0xb94f('0xd')](_0xb94f('0xe'),_0x1933e0,_0xb94f('0xf'));logger[_0xb94f('0x10')](_0xb94f('0x11'),_0x1933e0,_0xb94f('0xf'),JSON[_0xb94f('0x12')](_0x4527e6));if(_0x4527e6[_0xb94f('0x13')]){if(_0x4527e6[_0xb94f('0x13')]['code']===0x1f4){logger[_0xb94f('0x13')]('Condition,\x20%s,\x20%s',_0x1933e0,_0x4527e6[_0xb94f('0x13')][_0xb94f('0x14')]);return _0xb61ac9(_0x4527e6[_0xb94f('0x13')][_0xb94f('0x14')]);}logger[_0xb94f('0x13')](_0xb94f('0xe'),_0x1933e0,_0x4527e6['error'][_0xb94f('0x14')]);return _0x49b0aa(_0x4527e6[_0xb94f('0x13')][_0xb94f('0x14')]);}else{logger['info'](_0xb94f('0xe'),_0x1933e0,_0xb94f('0xf'));_0x49b0aa(_0x4527e6[_0xb94f('0x15')][_0xb94f('0x14')]);}})['catch'](function(_0x11fc5c){logger[_0xb94f('0x13')](_0xb94f('0xe'),_0x1933e0,_0x11fc5c);_0xb61ac9(_0x11fc5c);});});} \ No newline at end of file +var _0x1804=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4f41a4,_0x2e8ff5){var _0x342ff8=function(_0x5b40d9){while(--_0x5b40d9){_0x4f41a4['push'](_0x4f41a4['shift']());}};_0x342ff8(++_0x2e8ff5);}(_0x1804,0x188));var _0x4180=function(_0x3eb348,_0x10273e){_0x3eb348=_0x3eb348-0x0;var _0x4854fb=_0x1804[_0x3eb348];return _0x4854fb;};'use strict';var _=require(_0x4180('0x0'));var util=require(_0x4180('0x1'));var moment=require(_0x4180('0x2'));var BPromise=require(_0x4180('0x3'));var rs=require(_0x4180('0x4'));var fs=require('fs');var Redis=require(_0x4180('0x5'));var db=require(_0x4180('0x6'))['db'];var utils=require(_0x4180('0x7'));var logger=require(_0x4180('0x8'))(_0x4180('0x9'));var config=require(_0x4180('0xa'));var jayson=require(_0x4180('0xb'));var client=jayson[_0x4180('0xc')][_0x4180('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x15c9d8,_0x3d71a1,_0x1d56a1){return new BPromise(function(_0x153eb6,_0x4ff246){return client[_0x4180('0xe')](_0x15c9d8,_0x1d56a1)['then'](function(_0x4f6144){logger[_0x4180('0xf')](_0x4180('0x10'),_0x3d71a1,_0x4180('0x11'));logger[_0x4180('0x12')](_0x4180('0x13'),_0x3d71a1,_0x4180('0x11'),JSON['stringify'](_0x4f6144));if(_0x4f6144['error']){if(_0x4f6144[_0x4180('0x14')][_0x4180('0x15')]===0x1f4){logger[_0x4180('0x14')]('Condition,\x20%s,\x20%s',_0x3d71a1,_0x4f6144[_0x4180('0x14')]['message']);return _0x4ff246(_0x4f6144[_0x4180('0x14')][_0x4180('0x16')]);}logger[_0x4180('0x14')]('Condition,\x20%s,\x20%s',_0x3d71a1,_0x4f6144['error'][_0x4180('0x16')]);return _0x153eb6(_0x4f6144[_0x4180('0x14')][_0x4180('0x16')]);}else{logger['info'](_0x4180('0x10'),_0x3d71a1,_0x4180('0x11'));_0x153eb6(_0x4f6144[_0x4180('0x17')][_0x4180('0x16')]);}})[_0x4180('0x18')](function(_0x2789e1){logger['error'](_0x4180('0x10'),_0x3d71a1,_0x2789e1);_0x4ff246(_0x2789e1);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index c2d247c..20c552c 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 _0xf108=['put','/:id','isAuthenticated','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x46957b,_0x1dc98c){var _0x554ab9=function(_0x5283f2){while(--_0x5283f2){_0x46957b['push'](_0x46957b['shift']());}};_0x554ab9(++_0x1dc98c);}(_0xf108,0x1c1));var _0x8f10=function(_0x2c085c,_0x2699e3){_0x2c085c=_0x2c085c-0x0;var _0x2e840e=_0xf108[_0x2c085c];return _0x2e840e;};'use strict';var multer=require(_0x8f10('0x0'));var util=require(_0x8f10('0x1'));var path=require(_0x8f10('0x2'));var timeout=require('connect-timeout');var express=require(_0x8f10('0x3'));var router=express[_0x8f10('0x4')]();var auth=require(_0x8f10('0x5'));var interaction=require(_0x8f10('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x8f10('0x7')](_0x8f10('0x8'),auth[_0x8f10('0x9')](),controller[_0x8f10('0xa')]);router['delete'](_0x8f10('0x8'),auth['isAuthenticated'](),controller[_0x8f10('0xb')]);module['exports']=router; \ No newline at end of file +var _0xfa57=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x226c11,_0x14c0a4){var _0x4dc73e=function(_0x17e242){while(--_0x17e242){_0x226c11['push'](_0x226c11['shift']());}};_0x4dc73e(++_0x14c0a4);}(_0xfa57,0x9b));var _0x7fa5=function(_0x1208bf,_0x547f33){_0x1208bf=_0x1208bf-0x0;var _0x5aa0ce=_0xfa57[_0x1208bf];return _0x5aa0ce;};'use strict';var multer=require(_0x7fa5('0x0'));var util=require(_0x7fa5('0x1'));var path=require(_0x7fa5('0x2'));var timeout=require(_0x7fa5('0x3'));var express=require(_0x7fa5('0x4'));var router=express[_0x7fa5('0x5')]();var auth=require(_0x7fa5('0x6'));var interaction=require(_0x7fa5('0x7'));var config=require(_0x7fa5('0x8'));var controller=require(_0x7fa5('0x9'));router['put'](_0x7fa5('0xa'),auth[_0x7fa5('0xb')](),controller[_0x7fa5('0xc')]);router[_0x7fa5('0xd')](_0x7fa5('0xa'),auth[_0x7fa5('0xb')](),controller[_0x7fa5('0xe')]);module[_0x7fa5('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 901d456..d589c7a 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 _0x61e4=['sequelize','exports','STRING','name'];(function(_0x5cf212,_0x2a966d){var _0x56bc2f=function(_0x166c71){while(--_0x166c71){_0x5cf212['push'](_0x5cf212['shift']());}};_0x56bc2f(++_0x2a966d);}(_0x61e4,0x6c));var _0x461e=function(_0x10ed52,_0x4dcad2){_0x10ed52=_0x10ed52-0x0;var _0x2f4623=_0x61e4[_0x10ed52];return _0x2f4623;};'use strict';var Sequelize=require(_0x461e('0x0'));module[_0x461e('0x1')]={'name':{'type':Sequelize[_0x461e('0x2')],'allowNull':![],'unique':_0x461e('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd209=['exports','STRING','name','sequelize'];(function(_0x1fc3e4,_0x1ac06f){var _0x4bde37=function(_0x117023){while(--_0x117023){_0x1fc3e4['push'](_0x1fc3e4['shift']());}};_0x4bde37(++_0x1ac06f);}(_0xd209,0x1a7));var _0x9d20=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xd209[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x9d20('0x0'));module[_0x9d20('0x1')]={'name':{'type':Sequelize[_0x9d20('0x2')],'allowNull':![],'unique':_0x9d20('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 0e794f0..83eb340 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 _0x229d=['0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie3','web-report','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','pick','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','index','Dashboard','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','type','key','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone'];(function(_0x1dddcb,_0x5ebd09){var _0x414203=function(_0x1277ee){while(--_0x1277ee){_0x1dddcb['push'](_0x1dddcb['shift']());}};_0x414203(++_0x5ebd09);}(_0x229d,0x100));var _0xd229=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x229d[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd229('0x0'));var zipdir=require(_0xd229('0x1'));var jsonpatch=require(_0xd229('0x2'));var rp=require('request-promise');var moment=require(_0xd229('0x3'));var BPromise=require(_0xd229('0x4'));var Mustache=require('mustache');var util=require(_0xd229('0x5'));var path=require(_0xd229('0x6'));var sox=require(_0xd229('0x7'));var csv=require(_0xd229('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd229('0x9'));var crypto=require(_0xd229('0xa'));var jsforce=require(_0xd229('0xb'));var deskjs=require(_0xd229('0xc'));var toCsv=require(_0xd229('0x8'));var querystring=require(_0xd229('0xd'));var Papa=require(_0xd229('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0xd229('0xf'));var Redis=require(_0xd229('0x10'));var qs=require(_0xd229('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd229('0x12'))['db'];config['redis']=_[_0xd229('0x13')](config[_0xd229('0x14')],{'host':_0xd229('0x15'),'port':0x18eb});var socket=require(_0xd229('0x16'))(new Redis(config['redis']));require(_0xd229('0x17'))[_0xd229('0x18')](socket);function respondWithStatusCode(_0x1e9813,_0x1ae126){_0x1ae126=_0x1ae126||0xcc;return function(_0x31d1cb){if(_0x31d1cb){return _0x1e9813[_0xd229('0x19')](_0x1ae126);}return _0x1e9813[_0xd229('0x1a')](_0x1ae126)[_0xd229('0x1b')]();};}function respondWithResult(_0x4698c9,_0x1175a4){_0x1175a4=_0x1175a4||0xc8;return function(_0x16ba8c){if(_0x16ba8c){return _0x4698c9[_0xd229('0x1a')](_0x1175a4)['json'](_0x16ba8c);}};}function respondWithFilteredResult(_0x364357,_0x3416b6){return function(_0x122590){if(_0x122590){var _0x169c50=_0x122590[_0xd229('0x1c')],_0x5c77b2=_0x3416b6[_0xd229('0x1d')],_0x27f575=_0x3416b6[_0xd229('0x1d')]+_0x3416b6[_0xd229('0x1e')],_0x504086;if(_0x27f575>=_0x169c50){_0x27f575=_0x169c50;_0x504086=0xc8;}else{_0x504086=0xce;}_0x364357[_0xd229('0x1a')](_0x504086);return _0x364357[_0xd229('0x1f')](_0xd229('0x20'),_0x5c77b2+'-'+_0x27f575+'/'+_0x169c50)[_0xd229('0x21')](_0x122590);}return null;};}function patchUpdates(_0xaa3465){return function(_0x371075){try{jsonpatch[_0xd229('0x22')](_0x371075,_0xaa3465,!![]);}catch(_0x1f42dd){return BPromise['reject'](_0x1f42dd);}return _0x371075[_0xd229('0x23')]();};}function saveUpdates(_0x53b009,_0x5c1c0e){return function(_0x27cb31){if(_0x27cb31){return _0x27cb31['update'](_0x53b009)[_0xd229('0x24')](function(_0x5e5ab7){return _0x5e5ab7;});}return null;};}function removeEntity(_0x41e8a3,_0x2d27d2){return function(_0x4df87e){if(_0x4df87e){return _0x4df87e[_0xd229('0x25')]()['then'](function(){var _0x3c9039=_0x4df87e[_0xd229('0x26')]({'plain':!![]});var _0x1540b9=_0xd229('0x27');return db[_0xd229('0x28')]['destroy']({'where':{'type':_0x1540b9,'resourceId':_0x3c9039['id']}})[_0xd229('0x24')](function(){return _0x4df87e;});})[_0xd229('0x24')](function(){_0x41e8a3[_0xd229('0x1a')](0xcc)[_0xd229('0x1b')]();});}};}function handleEntityNotFound(_0x45ac8c,_0x5b25f5){return function(_0x22465c){if(!_0x22465c){_0x45ac8c[_0xd229('0x19')](0x194);}return _0x22465c;};}function handleError(_0x468a33,_0xafed74){_0xafed74=_0xafed74||0x1f4;return function(_0x53d707){logger[_0xd229('0x29')](_0x53d707[_0xd229('0x2a')]);if(_0x53d707[_0xd229('0x2b')]){delete _0x53d707[_0xd229('0x2b')];}_0x468a33[_0xd229('0x1a')](_0xafed74)['send'](_0x53d707);};}exports[_0xd229('0x2c')]=function(_0x27666a,_0x40c8d1){var _0x37a4b3={},_0x80647c={},_0x12b019={'count':0x0,'rows':[]};var _0x2bc71d=db[_0xd229('0x2d')][_0xd229('0x2e')];_0x80647c[_0xd229('0x2f')]=_[_0xd229('0x30')](_0x2bc71d);_0x80647c['query']=_['keys'](_0x27666a[_0xd229('0x31')]);_0x80647c[_0xd229('0x32')]=_['intersection'](_0x80647c[_0xd229('0x2f')],_0x80647c[_0xd229('0x31')]);_0x37a4b3[_0xd229('0x33')]=_[_0xd229('0x34')](_0x80647c[_0xd229('0x2f')],qs['fields'](_0x27666a[_0xd229('0x31')][_0xd229('0x35')]));_0x37a4b3[_0xd229('0x33')]=_0x37a4b3['attributes'][_0xd229('0x36')]?_0x37a4b3[_0xd229('0x33')]:_0x80647c[_0xd229('0x2f')];if(!_0x27666a[_0xd229('0x31')][_0xd229('0x37')](_0xd229('0x38'))){_0x37a4b3[_0xd229('0x1e')]=qs['limit'](_0x27666a[_0xd229('0x31')][_0xd229('0x1e')]);_0x37a4b3[_0xd229('0x1d')]=qs[_0xd229('0x1d')](_0x27666a[_0xd229('0x31')]['offset']);}_0x37a4b3[_0xd229('0x39')]=qs[_0xd229('0x3a')](_0x27666a[_0xd229('0x31')][_0xd229('0x3a')]);_0x37a4b3[_0xd229('0x3b')]=qs[_0xd229('0x32')](_['pick'](_0x27666a[_0xd229('0x31')],_0x80647c[_0xd229('0x32')]));if(_0x27666a[_0xd229('0x31')][_0xd229('0x3c')]){_0x37a4b3[_0xd229('0x3b')]=_['merge'](_0x37a4b3[_0xd229('0x3b')],{'$or':_[_0xd229('0x3d')](_0x2bc71d,function(_0x5dfc03){if(_0x5dfc03[_0xd229('0x3e')][_0xd229('0x3f')]!==_0xd229('0x40')){var _0x3e4937={};_0x3e4937[_0x5dfc03['field']]={'$like':'%'+_0x27666a[_0xd229('0x31')][_0xd229('0x3c')]+'%'};return _0x3e4937;}})});}_0x37a4b3=_[_0xd229('0x41')]({},_0x37a4b3,_0x27666a[_0xd229('0x42')]);var _0x49541e={'where':_0x37a4b3[_0xd229('0x3b')]};return db[_0xd229('0x2d')][_0xd229('0x1c')](_0x49541e)[_0xd229('0x24')](function(_0x382d75){_0x12b019[_0xd229('0x1c')]=_0x382d75;if(_0x27666a[_0xd229('0x31')][_0xd229('0x43')]){_0x37a4b3['include']=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x37a4b3);})['then'](function(_0x16a93d){_0x12b019[_0xd229('0x44')]=_0x16a93d;return _0x12b019;})[_0xd229('0x24')](respondWithFilteredResult(_0x40c8d1,_0x37a4b3))[_0xd229('0x45')](handleError(_0x40c8d1,null));};exports[_0xd229('0x46')]=function(_0x5e46d8,_0x146039){var _0x3d3355={'raw':![],'where':{'id':_0x5e46d8[_0xd229('0x47')]['id']}},_0x1ac784={};_0x1ac784[_0xd229('0x2f')]=_[_0xd229('0x30')](db[_0xd229('0x2d')]['rawAttributes']);_0x1ac784[_0xd229('0x31')]=_[_0xd229('0x30')](_0x5e46d8[_0xd229('0x31')]);_0x1ac784[_0xd229('0x32')]=_[_0xd229('0x34')](_0x1ac784['model'],_0x1ac784[_0xd229('0x31')]);_0x3d3355[_0xd229('0x33')]=_[_0xd229('0x34')](_0x1ac784[_0xd229('0x2f')],qs[_0xd229('0x35')](_0x5e46d8[_0xd229('0x31')][_0xd229('0x35')]));_0x3d3355[_0xd229('0x33')]=_0x3d3355['attributes'][_0xd229('0x36')]?_0x3d3355['attributes']:_0x1ac784[_0xd229('0x2f')];if(_0x5e46d8['query'][_0xd229('0x43')]){_0x3d3355[_0xd229('0x48')]=[{'all':!![]}];}_0x3d3355=_[_0xd229('0x41')]({},_0x3d3355,_0x5e46d8['options']);return db[_0xd229('0x2d')][_0xd229('0x49')](_0x3d3355)[_0xd229('0x24')](handleEntityNotFound(_0x146039,null))[_0xd229('0x24')](respondWithResult(_0x146039,null))[_0xd229('0x45')](handleError(_0x146039,null));};exports['create']=function(_0x39d3d0,_0x54aec7){return db['Dashboard'][_0xd229('0x4a')](_0x39d3d0[_0xd229('0x4b')],{})[_0xd229('0x24')](function(_0x423707){var _0x30c85f=_0x39d3d0[_0xd229('0x4c')]['get']({'plain':!![]});if(!_0x30c85f)throw new Error(_0xd229('0x4d'));if(_0x30c85f[_0xd229('0x4e')]===_0xd229('0x4c')){var _0xf8ed84=_0x423707[_0xd229('0x26')]({'plain':!![]});var _0x47be1b=_0xd229('0x27');return db[_0xd229('0x4f')][_0xd229('0x49')]({'where':{'name':_0x47be1b,'userProfileId':_0x30c85f[_0xd229('0x50')]},'raw':!![]})[_0xd229('0x24')](function(_0x408e99){if(_0x408e99&&_0x408e99[_0xd229('0x51')]===0x0){return db[_0xd229('0x28')][_0xd229('0x4a')]({'name':_0xf8ed84[_0xd229('0x2b')],'resourceId':_0xf8ed84['id'],'type':_0x408e99[_0xd229('0x2b')],'sectionId':_0x408e99['id']},{})['then'](function(){return _0x423707;});}else{return _0x423707;}})[_0xd229('0x45')](function(_0x461267){logger[_0xd229('0x29')](_0xd229('0x52'),_0x461267);throw _0x461267;});}return _0x423707;})[_0xd229('0x24')](respondWithResult(_0x54aec7,0xc9))[_0xd229('0x45')](handleError(_0x54aec7,null));};exports['clone']=function(_0x5a9bc4,_0x32a992){var _0x46c162={'raw':![],'where':{'id':_0x5a9bc4[_0xd229('0x47')]['id']}},_0x1d59d1={};_0x1d59d1[_0xd229('0x2f')]=_['keys'](db[_0xd229('0x2d')][_0xd229('0x2e')]);_0x46c162['attributes']=_[_0xd229('0x34')](_0x1d59d1[_0xd229('0x2f')],qs[_0xd229('0x35')](_0x5a9bc4[_0xd229('0x31')]['fields']));_0x46c162['attributes']=_0x46c162[_0xd229('0x33')][_0xd229('0x36')]?_0x46c162[_0xd229('0x33')]:_0x1d59d1[_0xd229('0x2f')];if(_0x5a9bc4[_0xd229('0x31')][_0xd229('0x43')]){_0x46c162[_0xd229('0x48')]=[{'all':!![]}];}_0x46c162=_[_0xd229('0x41')]({},_0x46c162,_0x5a9bc4[_0xd229('0x42')]);return db[_0xd229('0x2d')][_0xd229('0x49')](_0x46c162)[_0xd229('0x24')](handleEntityNotFound(_0x32a992,null))[_0xd229('0x24')](function(_0x14d616){if(_0x14d616){var _0x41f7d8=_0x14d616['get']({'plain':!![]});_0x41f7d8=qs[_0xd229('0x53')](_0x41f7d8,['id',_0xd229('0x54'),'updatedAt']);_0x5a9bc4['body']=_[_0xd229('0x53')](_0x5a9bc4[_0xd229('0x4b')],['id',_0xd229('0x54'),_0xd229('0x55')]);return db[_0xd229('0x2d')]['create'](_[_0xd229('0x41')](_0x41f7d8,_0x5a9bc4[_0xd229('0x4b')]),{'include':_0x5a9bc4[_0xd229('0x31')][_0xd229('0x43')]?[{'all':!![]}]:undefined})[_0xd229('0x24')](function(_0x965cd1){var _0x2d2504=_0x5a9bc4[_0xd229('0x4c')][_0xd229('0x26')]({'plain':!![]});if(!_0x2d2504)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d2504[_0xd229('0x4e')]===_0xd229('0x4c')){var _0x2147da=_0x965cd1[_0xd229('0x26')]({'plain':!![]});var _0x17446b='CustomDashboards';return db[_0xd229('0x4f')]['find']({'where':{'name':_0x17446b,'userProfileId':_0x2d2504[_0xd229('0x50')]},'raw':!![]})[_0xd229('0x24')](function(_0xe5cc98){if(_0xe5cc98&&_0xe5cc98[_0xd229('0x51')]===0x0){return db[_0xd229('0x28')]['create']({'name':_0x2147da[_0xd229('0x2b')],'resourceId':_0x2147da['id'],'type':_0xe5cc98['name'],'sectionId':_0xe5cc98['id']},{})[_0xd229('0x24')](function(){return _0x965cd1;});}else{return _0x965cd1;}})[_0xd229('0x45')](function(_0x2dba77){logger['error'](_0xd229('0x52'),_0x2dba77);throw _0x2dba77;});}return _0x965cd1;});}})[_0xd229('0x24')](respondWithResult(_0x32a992,0xc9))[_0xd229('0x45')](handleError(_0x32a992,null));};exports[_0xd229('0x56')]=function(_0x4895ac,_0xee33fa){if(_0x4895ac[_0xd229('0x4b')]['id']){delete _0x4895ac[_0xd229('0x4b')]['id'];}return db[_0xd229('0x2d')][_0xd229('0x49')]({'where':{'id':_0x4895ac[_0xd229('0x47')]['id']}})['then'](handleEntityNotFound(_0xee33fa,null))[_0xd229('0x24')](saveUpdates(_0x4895ac[_0xd229('0x4b')],null))[_0xd229('0x24')](respondWithResult(_0xee33fa,null))[_0xd229('0x45')](handleError(_0xee33fa,null));};exports[_0xd229('0x25')]=function(_0x1d06e4,_0x72891d){return db[_0xd229('0x2d')][_0xd229('0x49')]({'where':{'id':_0x1d06e4[_0xd229('0x47')]['id']}})['then'](handleEntityNotFound(_0x72891d,null))[_0xd229('0x24')](removeEntity(_0x72891d,null))[_0xd229('0x45')](handleError(_0x72891d,null));};function widgetAttributes(_0x269b1f){try{switch(_0x269b1f[_0xd229('0x3e')]){case _0xd229('0x57'):return[{'name':_0xd229('0x58'),'value':_0x269b1f[_0xd229('0x58')]||(_0x269b1f[_0xd229('0x59')]&&_0x269b1f[_0xd229('0x59')][0x0]?_0x269b1f[_0xd229('0x59')][0x0][_0xd229('0x5a')]:undefined)||_0xd229('0x5b')}];case _0xd229('0x5c'):return[{'name':_0xd229('0x5d'),'value':_0x269b1f[_0xd229('0x5d')]||(_0x269b1f[_0xd229('0x59')]&&_0x269b1f['attrs'][0x0]?_0x269b1f[_0xd229('0x59')][0x0][_0xd229('0x5a')]:undefined)||''}];case _0xd229('0x5e'):return[{'name':_0xd229('0x5f'),'value':_0x269b1f['attrHourFormat']||(_0x269b1f[_0xd229('0x59')]&&_0x269b1f[_0xd229('0x59')][0x0]?_0x269b1f['attrs'][0x0][_0xd229('0x5a')]:undefined)||_0xd229('0x60')},{'name':_0xd229('0x61'),'value':_0x269b1f[_0xd229('0x61')]||(_0x269b1f[_0xd229('0x59')]&&_0x269b1f[_0xd229('0x59')][0x1]?_0x269b1f[_0xd229('0x59')][0x1][_0xd229('0x5a')]:undefined)||_0xd229('0x62')},{'name':_0xd229('0x63'),'value':_0x269b1f[_0xd229('0x63')]||(_0x269b1f['attrs']&&_0x269b1f[_0xd229('0x59')][0x2]?_0x269b1f[_0xd229('0x59')][0x2][_0xd229('0x5a')]:undefined)||0xc}];case _0xd229('0x64'):return[{'name':_0xd229('0x65'),'value':_0x269b1f['attrMetric']||(_0x269b1f[_0xd229('0x59')]&&_0x269b1f['attrs'][0x0]?_0x269b1f['attrs'][0x0][_0xd229('0x5a')]:undefined)||'total'},{'name':_0xd229('0x66'),'value':_0x269b1f['attrVoiceQueues']||(_0x269b1f['attrs']&&_0x269b1f[_0xd229('0x59')][0x1]?_0x269b1f[_0xd229('0x59')][0x1]['value']:undefined)||[]},{'name':_0xd229('0x63'),'value':_0x269b1f[_0xd229('0x63')]||(_0x269b1f[_0xd229('0x59')]&&_0x269b1f['attrs'][0x2]?_0x269b1f[_0xd229('0x59')][0x2]['value']:undefined)||0x14}];case _0xd229('0x67'):case _0xd229('0x68'):return[{'name':_0xd229('0x69'),'value':_0x269b1f['attrSerie1']||(_0x269b1f[_0xd229('0x59')]&&_0x269b1f[_0xd229('0x59')][0x0]?_0x269b1f[_0xd229('0x59')][0x0]['value']:undefined)||_0xd229('0x6a')},{'name':'attrSerie2','value':_0x269b1f['attrSerie2']||(_0x269b1f['attrs']&&_0x269b1f[_0xd229('0x59')][0x1]?_0x269b1f[_0xd229('0x59')][0x1][_0xd229('0x5a')]:undefined)||null},{'name':_0xd229('0x6b'),'value':_0x269b1f[_0xd229('0x6b')]||(_0x269b1f[_0xd229('0x59')]&&_0x269b1f[_0xd229('0x59')][0x2]?_0x269b1f[_0xd229('0x59')][0x2][_0xd229('0x5a')]:undefined)||null},{'name':_0xd229('0x66'),'value':_0x269b1f[_0xd229('0x66')]||(_0x269b1f[_0xd229('0x59')]&&_0x269b1f['attrs'][0x3]?_0x269b1f[_0xd229('0x59')][0x3]['value']:undefined)||[]}];case _0xd229('0x6c'):return[{'name':'attrReport','type':_0x269b1f[_0xd229('0x6d')]||(_0x269b1f[_0xd229('0x59')]&&_0x269b1f['attrs'][0x0]?_0x269b1f['attrs'][0x0][_0xd229('0x3e')]:undefined)||null,'value':_0x269b1f['attrReport']||(_0x269b1f['attrs']&&_0x269b1f[_0xd229('0x59')][0x0]?_0x269b1f[_0xd229('0x59')][0x0][_0xd229('0x5a')]:undefined)||null},{'name':'attrRefresh','value':_0x269b1f[_0xd229('0x6e')]||(_0x269b1f[_0xd229('0x59')]&&_0x269b1f['attrs'][0x1]?_0x269b1f[_0xd229('0x59')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x26c0af){logger[_0xd229('0x29')]('widgetAttributes:\x20%s',JSON[_0xd229('0x6f')](_0x26c0af));return[];}}exports[_0xd229('0x70')]=function(_0x53ffd2,_0x58f8df,_0x26013d){if(_0x53ffd2[_0xd229('0x4b')]['id']){delete _0x53ffd2[_0xd229('0x4b')]['id'];}return db['Dashboard'][_0xd229('0x49')]({'where':{'id':_0x53ffd2['params']['id']}})[_0xd229('0x24')](handleEntityNotFound(_0x58f8df,null))[_0xd229('0x24')](function(_0x4717f1){if(_0x4717f1){_0x53ffd2[_0xd229('0x4b')][_0xd229('0x71')]=_0x4717f1['id'];_0x53ffd2[_0xd229('0x4b')][_0xd229('0x59')]=widgetAttributes(_0x53ffd2[_0xd229('0x4b')]);return db[_0xd229('0x72')][_0xd229('0x4a')](_0x53ffd2[_0xd229('0x4b')]);}})[_0xd229('0x24')](respondWithResult(_0x58f8df,null))['catch'](handleError(_0x58f8df,null));};exports[_0xd229('0x73')]=function(_0x221a3a,_0x12487d,_0x36316e){var _0x329695={};var _0x249993={};var _0x55cdc5;var _0x503f9d;return db[_0xd229('0x2d')][_0xd229('0x74')]({'where':{'id':_0x221a3a[_0xd229('0x47')]['id']}})[_0xd229('0x24')](handleEntityNotFound(_0x12487d,null))['then'](function(_0x402091){if(_0x402091){_0x55cdc5=_0x402091;_0x249993[_0xd229('0x2f')]=_[_0xd229('0x30')](db[_0xd229('0x72')]['rawAttributes']);_0x249993[_0xd229('0x31')]=_[_0xd229('0x30')](_0x221a3a[_0xd229('0x31')]);_0x249993[_0xd229('0x32')]=_[_0xd229('0x34')](_0x249993['model'],_0x249993[_0xd229('0x31')]);_0x329695['attributes']=_[_0xd229('0x34')](_0x249993[_0xd229('0x2f')],qs[_0xd229('0x35')](_0x221a3a['query'][_0xd229('0x35')]));_0x329695[_0xd229('0x33')]=_0x329695[_0xd229('0x33')][_0xd229('0x36')]?_0x329695[_0xd229('0x33')]:_0x249993['model'];_0x329695[_0xd229('0x39')]=qs[_0xd229('0x3a')](_0x221a3a[_0xd229('0x31')][_0xd229('0x3a')]);_0x329695[_0xd229('0x3b')]=qs[_0xd229('0x32')](_[_0xd229('0x75')](_0x221a3a[_0xd229('0x31')],_0x249993['filters']));if(_0x221a3a['query'][_0xd229('0x3c')]){_0x329695[_0xd229('0x3b')]=_['merge'](_0x329695['where'],{'$or':_[_0xd229('0x3d')](_0x329695[_0xd229('0x33')],function(_0x76013c){var _0xd4a851={};_0xd4a851[_0x76013c]={'$like':'%'+_0x221a3a[_0xd229('0x31')]['filter']+'%'};return _0xd4a851;})});}_0x329695=_[_0xd229('0x41')]({},_0x329695,_0x221a3a[_0xd229('0x42')]);return _0x55cdc5[_0xd229('0x73')](_0x329695);}})[_0xd229('0x24')](function(_0x1b4169){if(_0x1b4169){_0x503f9d=_0x1b4169[_0xd229('0x36')];if(!_0x221a3a['query']['hasOwnProperty'](_0xd229('0x38'))){_0x329695[_0xd229('0x1e')]=qs[_0xd229('0x1e')](_0x221a3a[_0xd229('0x31')][_0xd229('0x1e')]);_0x329695[_0xd229('0x1d')]=qs['offset'](_0x221a3a[_0xd229('0x31')][_0xd229('0x1d')]);}return _0x55cdc5[_0xd229('0x73')](_0x329695);}})['then'](function(_0x17cf0a){if(_0x17cf0a){return _0x17cf0a?{'count':_0x503f9d,'rows':_0x17cf0a}:null;}})[_0xd229('0x24')](respondWithResult(_0x12487d,null))[_0xd229('0x45')](handleError(_0x12487d,null));}; \ No newline at end of file +var _0x87d3=['stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','count','offset','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','Dashboard','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','field','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','omit','createdAt','updatedAt','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','reportType','attrRefresh','widgetAttributes:\x20%s'];(function(_0xa2507b,_0x2cc5b9){var _0x461469=function(_0xce130c){while(--_0xce130c){_0xa2507b['push'](_0xa2507b['shift']());}};_0x461469(++_0x2cc5b9);}(_0x87d3,0x86));var _0x387d=function(_0x323d3a,_0x325482){_0x323d3a=_0x323d3a-0x0;var _0x24847a=_0x87d3[_0x323d3a];return _0x24847a;};'use strict';var pdf=require(_0x387d('0x0'));var emlformat=require(_0x387d('0x1'));var rimraf=require(_0x387d('0x2'));var zipdir=require(_0x387d('0x3'));var jsonpatch=require(_0x387d('0x4'));var rp=require(_0x387d('0x5'));var moment=require('moment');var BPromise=require(_0x387d('0x6'));var Mustache=require('mustache');var util=require(_0x387d('0x7'));var path=require(_0x387d('0x8'));var sox=require(_0x387d('0x9'));var csv=require('to-csv');var ejs=require(_0x387d('0xa'));var fs=require('fs');var _=require(_0x387d('0xb'));var squel=require(_0x387d('0xc'));var crypto=require(_0x387d('0xd'));var jsforce=require(_0x387d('0xe'));var deskjs=require(_0x387d('0xf'));var toCsv=require(_0x387d('0x10'));var querystring=require(_0x387d('0x11'));var Papa=require(_0x387d('0x12'));var authService=require(_0x387d('0x13'));var hardwareService=require(_0x387d('0x14'));var Redis=require('ioredis');var qs=require(_0x387d('0x15'));var logger=require(_0x387d('0x16'))(_0x387d('0x17'));var utils=require(_0x387d('0x18'));var config=require(_0x387d('0x19'));var db=require(_0x387d('0x1a'))['db'];config[_0x387d('0x1b')]=_[_0x387d('0x1c')](config[_0x387d('0x1b')],{'host':_0x387d('0x1d'),'port':0x18eb});var socket=require(_0x387d('0x1e'))(new Redis(config[_0x387d('0x1b')]));require(_0x387d('0x1f'))[_0x387d('0x20')](socket);function respondWithStatusCode(_0x11c3bd,_0x51000d){_0x51000d=_0x51000d||0xcc;return function(_0x4914a8){if(_0x4914a8){return _0x11c3bd[_0x387d('0x21')](_0x51000d);}return _0x11c3bd['status'](_0x51000d)['end']();};}function respondWithResult(_0x516b42,_0xf6f574){_0xf6f574=_0xf6f574||0xc8;return function(_0x316368){if(_0x316368){return _0x516b42[_0x387d('0x22')](_0xf6f574)[_0x387d('0x23')](_0x316368);}};}function respondWithFilteredResult(_0x3cd7ce,_0x396328){return function(_0x3bbf9f){if(_0x3bbf9f){var _0x1caada=_0x3bbf9f[_0x387d('0x24')],_0x560b1c=_0x396328['offset'],_0xf8ae7b=_0x396328[_0x387d('0x25')]+_0x396328['limit'],_0xa50585;if(_0xf8ae7b>=_0x1caada){_0xf8ae7b=_0x1caada;_0xa50585=0xc8;}else{_0xa50585=0xce;}_0x3cd7ce[_0x387d('0x22')](_0xa50585);return _0x3cd7ce['set'](_0x387d('0x26'),_0x560b1c+'-'+_0xf8ae7b+'/'+_0x1caada)[_0x387d('0x23')](_0x3bbf9f);}return null;};}function patchUpdates(_0x2abd07){return function(_0x37b84b){try{jsonpatch[_0x387d('0x27')](_0x37b84b,_0x2abd07,!![]);}catch(_0x5c733b){return BPromise['reject'](_0x5c733b);}return _0x37b84b[_0x387d('0x28')]();};}function saveUpdates(_0x7799a7,_0x2f2827){return function(_0x580a6e){if(_0x580a6e){return _0x580a6e[_0x387d('0x29')](_0x7799a7)[_0x387d('0x2a')](function(_0x3e5620){return _0x3e5620;});}return null;};}function removeEntity(_0x2be266,_0x36ee8b){return function(_0x5569db){if(_0x5569db){return _0x5569db['destroy']()['then'](function(){var _0x463121=_0x5569db['get']({'plain':!![]});var _0x5c567b='CustomDashboards';return db['UserProfileResource'][_0x387d('0x2b')]({'where':{'type':_0x5c567b,'resourceId':_0x463121['id']}})[_0x387d('0x2a')](function(){return _0x5569db;});})[_0x387d('0x2a')](function(){_0x2be266[_0x387d('0x22')](0xcc)[_0x387d('0x2c')]();});}};}function handleEntityNotFound(_0xe0982e,_0x1d3f3a){return function(_0x2df701){if(!_0x2df701){_0xe0982e[_0x387d('0x21')](0x194);}return _0x2df701;};}function handleError(_0x270231,_0x25214f){_0x25214f=_0x25214f||0x1f4;return function(_0x22a7a6){logger[_0x387d('0x2d')](_0x22a7a6[_0x387d('0x2e')]);if(_0x22a7a6[_0x387d('0x2f')]){delete _0x22a7a6[_0x387d('0x2f')];}_0x270231['status'](_0x25214f)[_0x387d('0x30')](_0x22a7a6);};}exports[_0x387d('0x31')]=function(_0x4495fb,_0x588feb){var _0x370689={},_0x452a11={},_0x386af6={'count':0x0,'rows':[]};var _0x23a388=db[_0x387d('0x32')]['rawAttributes'];_0x452a11[_0x387d('0x33')]=_[_0x387d('0x34')](_0x23a388);_0x452a11['query']=_['keys'](_0x4495fb[_0x387d('0x35')]);_0x452a11[_0x387d('0x36')]=_[_0x387d('0x37')](_0x452a11[_0x387d('0x33')],_0x452a11[_0x387d('0x35')]);_0x370689[_0x387d('0x38')]=_['intersection'](_0x452a11[_0x387d('0x33')],qs[_0x387d('0x39')](_0x4495fb[_0x387d('0x35')][_0x387d('0x39')]));_0x370689[_0x387d('0x38')]=_0x370689[_0x387d('0x38')][_0x387d('0x3a')]?_0x370689['attributes']:_0x452a11[_0x387d('0x33')];if(!_0x4495fb[_0x387d('0x35')][_0x387d('0x3b')](_0x387d('0x3c'))){_0x370689[_0x387d('0x3d')]=qs[_0x387d('0x3d')](_0x4495fb['query']['limit']);_0x370689['offset']=qs['offset'](_0x4495fb[_0x387d('0x35')][_0x387d('0x25')]);}_0x370689['order']=qs[_0x387d('0x3e')](_0x4495fb[_0x387d('0x35')]['sort']);_0x370689[_0x387d('0x3f')]=qs[_0x387d('0x36')](_[_0x387d('0x40')](_0x4495fb['query'],_0x452a11[_0x387d('0x36')]));if(_0x4495fb['query'][_0x387d('0x41')]){_0x370689[_0x387d('0x3f')]=_[_0x387d('0x42')](_0x370689[_0x387d('0x3f')],{'$or':_['map'](_0x23a388,function(_0xc2c15b){if(_0xc2c15b[_0x387d('0x43')]['key']!==_0x387d('0x44')){var _0x4af689={};_0x4af689[_0xc2c15b[_0x387d('0x45')]]={'$like':'%'+_0x4495fb[_0x387d('0x35')][_0x387d('0x41')]+'%'};return _0x4af689;}})});}_0x370689=_['merge']({},_0x370689,_0x4495fb[_0x387d('0x46')]);var _0x2c0e3b={'where':_0x370689[_0x387d('0x3f')]};return db['Dashboard'][_0x387d('0x24')](_0x2c0e3b)['then'](function(_0x564b18){_0x386af6[_0x387d('0x24')]=_0x564b18;if(_0x4495fb[_0x387d('0x35')][_0x387d('0x47')]){_0x370689[_0x387d('0x48')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x370689);})[_0x387d('0x2a')](function(_0x42d496){_0x386af6[_0x387d('0x49')]=_0x42d496;return _0x386af6;})[_0x387d('0x2a')](respondWithFilteredResult(_0x588feb,_0x370689))[_0x387d('0x4a')](handleError(_0x588feb,null));};exports[_0x387d('0x4b')]=function(_0x4e78c6,_0x510c17){var _0x32bfb6={'raw':![],'where':{'id':_0x4e78c6[_0x387d('0x4c')]['id']}},_0x28feb0={};_0x28feb0['model']=_[_0x387d('0x34')](db['Dashboard'][_0x387d('0x4d')]);_0x28feb0[_0x387d('0x35')]=_[_0x387d('0x34')](_0x4e78c6['query']);_0x28feb0[_0x387d('0x36')]=_[_0x387d('0x37')](_0x28feb0['model'],_0x28feb0[_0x387d('0x35')]);_0x32bfb6[_0x387d('0x38')]=_['intersection'](_0x28feb0[_0x387d('0x33')],qs[_0x387d('0x39')](_0x4e78c6[_0x387d('0x35')][_0x387d('0x39')]));_0x32bfb6['attributes']=_0x32bfb6[_0x387d('0x38')]['length']?_0x32bfb6[_0x387d('0x38')]:_0x28feb0[_0x387d('0x33')];if(_0x4e78c6[_0x387d('0x35')]['includeAll']){_0x32bfb6[_0x387d('0x48')]=[{'all':!![]}];}_0x32bfb6=_[_0x387d('0x42')]({},_0x32bfb6,_0x4e78c6[_0x387d('0x46')]);return db[_0x387d('0x32')][_0x387d('0x4e')](_0x32bfb6)[_0x387d('0x2a')](handleEntityNotFound(_0x510c17,null))[_0x387d('0x2a')](respondWithResult(_0x510c17,null))[_0x387d('0x4a')](handleError(_0x510c17,null));};exports[_0x387d('0x4f')]=function(_0x27fa45,_0x298dd4){return db['Dashboard'][_0x387d('0x4f')](_0x27fa45[_0x387d('0x50')],{})[_0x387d('0x2a')](function(_0x59d681){var _0x58d52b=_0x27fa45['user'][_0x387d('0x51')]({'plain':!![]});if(!_0x58d52b)throw new Error(_0x387d('0x52'));if(_0x58d52b[_0x387d('0x53')]===_0x387d('0x54')){var _0x36c35a=_0x59d681[_0x387d('0x51')]({'plain':!![]});var _0x1eee99=_0x387d('0x55');return db[_0x387d('0x56')][_0x387d('0x4e')]({'where':{'name':_0x1eee99,'userProfileId':_0x58d52b[_0x387d('0x57')]},'raw':!![]})[_0x387d('0x2a')](function(_0x3b3377){if(_0x3b3377&&_0x3b3377[_0x387d('0x58')]===0x0){return db[_0x387d('0x59')][_0x387d('0x4f')]({'name':_0x36c35a[_0x387d('0x2f')],'resourceId':_0x36c35a['id'],'type':_0x3b3377[_0x387d('0x2f')],'sectionId':_0x3b3377['id']},{})[_0x387d('0x2a')](function(){return _0x59d681;});}else{return _0x59d681;}})['catch'](function(_0x2e8d4e){logger[_0x387d('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e8d4e);throw _0x2e8d4e;});}return _0x59d681;})['then'](respondWithResult(_0x298dd4,0xc9))[_0x387d('0x4a')](handleError(_0x298dd4,null));};exports[_0x387d('0x5a')]=function(_0x2bb7e3,_0x5cc418){var _0x2c050c={'raw':![],'where':{'id':_0x2bb7e3[_0x387d('0x4c')]['id']}},_0x1bccb0={};_0x1bccb0[_0x387d('0x33')]=_[_0x387d('0x34')](db[_0x387d('0x32')][_0x387d('0x4d')]);_0x2c050c[_0x387d('0x38')]=_[_0x387d('0x37')](_0x1bccb0[_0x387d('0x33')],qs[_0x387d('0x39')](_0x2bb7e3['query'][_0x387d('0x39')]));_0x2c050c[_0x387d('0x38')]=_0x2c050c[_0x387d('0x38')][_0x387d('0x3a')]?_0x2c050c[_0x387d('0x38')]:_0x1bccb0[_0x387d('0x33')];if(_0x2bb7e3[_0x387d('0x35')][_0x387d('0x47')]){_0x2c050c[_0x387d('0x48')]=[{'all':!![]}];}_0x2c050c=_[_0x387d('0x42')]({},_0x2c050c,_0x2bb7e3[_0x387d('0x46')]);return db['Dashboard'][_0x387d('0x4e')](_0x2c050c)[_0x387d('0x2a')](handleEntityNotFound(_0x5cc418,null))['then'](function(_0x1827bb){if(_0x1827bb){var _0x34f83c=_0x1827bb[_0x387d('0x51')]({'plain':!![]});_0x34f83c=qs[_0x387d('0x5b')](_0x34f83c,['id',_0x387d('0x5c'),'updatedAt']);_0x2bb7e3[_0x387d('0x50')]=_['omit'](_0x2bb7e3[_0x387d('0x50')],['id','createdAt',_0x387d('0x5d')]);return db['Dashboard']['create'](_[_0x387d('0x42')](_0x34f83c,_0x2bb7e3['body']),{'include':_0x2bb7e3['query'][_0x387d('0x47')]?[{'all':!![]}]:undefined})[_0x387d('0x2a')](function(_0x372788){var _0x354cd9=_0x2bb7e3[_0x387d('0x54')]['get']({'plain':!![]});if(!_0x354cd9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x354cd9[_0x387d('0x53')]===_0x387d('0x54')){var _0x5c8d9e=_0x372788[_0x387d('0x51')]({'plain':!![]});var _0x31afc8='CustomDashboards';return db['UserProfileSection'][_0x387d('0x4e')]({'where':{'name':_0x31afc8,'userProfileId':_0x354cd9[_0x387d('0x57')]},'raw':!![]})['then'](function(_0x4a4898){if(_0x4a4898&&_0x4a4898['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5c8d9e[_0x387d('0x2f')],'resourceId':_0x5c8d9e['id'],'type':_0x4a4898[_0x387d('0x2f')],'sectionId':_0x4a4898['id']},{})[_0x387d('0x2a')](function(){return _0x372788;});}else{return _0x372788;}})[_0x387d('0x4a')](function(_0x487e50){logger[_0x387d('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487e50);throw _0x487e50;});}return _0x372788;});}})[_0x387d('0x2a')](respondWithResult(_0x5cc418,0xc9))[_0x387d('0x4a')](handleError(_0x5cc418,null));};exports[_0x387d('0x29')]=function(_0x5f2589,_0xe7b916){if(_0x5f2589['body']['id']){delete _0x5f2589[_0x387d('0x50')]['id'];}return db[_0x387d('0x32')][_0x387d('0x4e')]({'where':{'id':_0x5f2589['params']['id']}})[_0x387d('0x2a')](handleEntityNotFound(_0xe7b916,null))[_0x387d('0x2a')](saveUpdates(_0x5f2589[_0x387d('0x50')],null))['then'](respondWithResult(_0xe7b916,null))[_0x387d('0x4a')](handleError(_0xe7b916,null));};exports[_0x387d('0x2b')]=function(_0x2f8794,_0x4b5bc0){return db[_0x387d('0x32')][_0x387d('0x4e')]({'where':{'id':_0x2f8794[_0x387d('0x4c')]['id']}})[_0x387d('0x2a')](handleEntityNotFound(_0x4b5bc0,null))['then'](removeEntity(_0x4b5bc0,null))[_0x387d('0x4a')](handleError(_0x4b5bc0,null));};function widgetAttributes(_0x4c64c9){try{switch(_0x4c64c9['type']){case'iframe':return[{'name':_0x387d('0x5e'),'value':_0x4c64c9[_0x387d('0x5e')]||(_0x4c64c9[_0x387d('0x5f')]&&_0x4c64c9[_0x387d('0x5f')][0x0]?_0x4c64c9[_0x387d('0x5f')][0x0][_0x387d('0x60')]:undefined)||_0x387d('0x61')}];case _0x387d('0x62'):return[{'name':_0x387d('0x63'),'value':_0x4c64c9[_0x387d('0x63')]||(_0x4c64c9[_0x387d('0x5f')]&&_0x4c64c9[_0x387d('0x5f')][0x0]?_0x4c64c9[_0x387d('0x5f')][0x0]['value']:undefined)||''}];case _0x387d('0x64'):return[{'name':_0x387d('0x65'),'value':_0x4c64c9[_0x387d('0x65')]||(_0x4c64c9[_0x387d('0x5f')]&&_0x4c64c9['attrs'][0x0]?_0x4c64c9[_0x387d('0x5f')][0x0]['value']:undefined)||_0x387d('0x66')},{'name':_0x387d('0x67'),'value':_0x4c64c9[_0x387d('0x67')]||(_0x4c64c9[_0x387d('0x5f')]&&_0x4c64c9[_0x387d('0x5f')][0x1]?_0x4c64c9[_0x387d('0x5f')][0x1][_0x387d('0x60')]:undefined)||_0x387d('0x68')},{'name':_0x387d('0x69'),'value':_0x4c64c9[_0x387d('0x69')]||(_0x4c64c9[_0x387d('0x5f')]&&_0x4c64c9[_0x387d('0x5f')][0x2]?_0x4c64c9[_0x387d('0x5f')][0x2][_0x387d('0x60')]:undefined)||0xc}];case _0x387d('0x6a'):return[{'name':_0x387d('0x6b'),'value':_0x4c64c9['attrMetric']||(_0x4c64c9[_0x387d('0x5f')]&&_0x4c64c9[_0x387d('0x5f')][0x0]?_0x4c64c9[_0x387d('0x5f')][0x0][_0x387d('0x60')]:undefined)||_0x387d('0x6c')},{'name':_0x387d('0x6d'),'value':_0x4c64c9['attrVoiceQueues']||(_0x4c64c9['attrs']&&_0x4c64c9[_0x387d('0x5f')][0x1]?_0x4c64c9[_0x387d('0x5f')][0x1][_0x387d('0x60')]:undefined)||[]},{'name':_0x387d('0x69'),'value':_0x4c64c9[_0x387d('0x69')]||(_0x4c64c9['attrs']&&_0x4c64c9['attrs'][0x2]?_0x4c64c9[_0x387d('0x5f')][0x2][_0x387d('0x60')]:undefined)||0x14}];case _0x387d('0x6e'):case _0x387d('0x6f'):return[{'name':_0x387d('0x70'),'value':_0x4c64c9[_0x387d('0x70')]||(_0x4c64c9[_0x387d('0x5f')]&&_0x4c64c9[_0x387d('0x5f')][0x0]?_0x4c64c9[_0x387d('0x5f')][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x4c64c9['attrSerie2']||(_0x4c64c9['attrs']&&_0x4c64c9[_0x387d('0x5f')][0x1]?_0x4c64c9[_0x387d('0x5f')][0x1][_0x387d('0x60')]:undefined)||null},{'name':'attrSerie3','value':_0x4c64c9[_0x387d('0x71')]||(_0x4c64c9[_0x387d('0x5f')]&&_0x4c64c9[_0x387d('0x5f')][0x2]?_0x4c64c9[_0x387d('0x5f')][0x2][_0x387d('0x60')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4c64c9['attrVoiceQueues']||(_0x4c64c9[_0x387d('0x5f')]&&_0x4c64c9['attrs'][0x3]?_0x4c64c9['attrs'][0x3]['value']:undefined)||[]}];case _0x387d('0x72'):return[{'name':'attrReport','type':_0x4c64c9[_0x387d('0x73')]||(_0x4c64c9[_0x387d('0x5f')]&&_0x4c64c9['attrs'][0x0]?_0x4c64c9[_0x387d('0x5f')][0x0][_0x387d('0x43')]:undefined)||null,'value':_0x4c64c9['attrReport']||(_0x4c64c9[_0x387d('0x5f')]&&_0x4c64c9[_0x387d('0x5f')][0x0]?_0x4c64c9[_0x387d('0x5f')][0x0][_0x387d('0x60')]:undefined)||null},{'name':_0x387d('0x74'),'value':_0x4c64c9[_0x387d('0x74')]||(_0x4c64c9['attrs']&&_0x4c64c9[_0x387d('0x5f')][0x1]?_0x4c64c9[_0x387d('0x5f')][0x1][_0x387d('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x241303){logger['error'](_0x387d('0x75'),JSON[_0x387d('0x76')](_0x241303));return[];}}exports[_0x387d('0x77')]=function(_0x5ab643,_0x5b3a00,_0x39b336){if(_0x5ab643['body']['id']){delete _0x5ab643['body']['id'];}return db[_0x387d('0x32')][_0x387d('0x4e')]({'where':{'id':_0x5ab643[_0x387d('0x4c')]['id']}})[_0x387d('0x2a')](handleEntityNotFound(_0x5b3a00,null))['then'](function(_0xae78b7){if(_0xae78b7){_0x5ab643[_0x387d('0x50')][_0x387d('0x78')]=_0xae78b7['id'];_0x5ab643[_0x387d('0x50')][_0x387d('0x5f')]=widgetAttributes(_0x5ab643[_0x387d('0x50')]);return db[_0x387d('0x79')][_0x387d('0x4f')](_0x5ab643[_0x387d('0x50')]);}})[_0x387d('0x2a')](respondWithResult(_0x5b3a00,null))[_0x387d('0x4a')](handleError(_0x5b3a00,null));};exports[_0x387d('0x7a')]=function(_0x265738,_0x2ed597,_0x3532b9){var _0x35c06d={};var _0x489100={};var _0x7adea9;var _0x5f0827;return db[_0x387d('0x32')][_0x387d('0x7b')]({'where':{'id':_0x265738[_0x387d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2ed597,null))['then'](function(_0x2c87e3){if(_0x2c87e3){_0x7adea9=_0x2c87e3;_0x489100[_0x387d('0x33')]=_[_0x387d('0x34')](db[_0x387d('0x79')]['rawAttributes']);_0x489100[_0x387d('0x35')]=_['keys'](_0x265738[_0x387d('0x35')]);_0x489100[_0x387d('0x36')]=_[_0x387d('0x37')](_0x489100[_0x387d('0x33')],_0x489100[_0x387d('0x35')]);_0x35c06d['attributes']=_[_0x387d('0x37')](_0x489100[_0x387d('0x33')],qs['fields'](_0x265738['query'][_0x387d('0x39')]));_0x35c06d['attributes']=_0x35c06d[_0x387d('0x38')][_0x387d('0x3a')]?_0x35c06d[_0x387d('0x38')]:_0x489100[_0x387d('0x33')];_0x35c06d[_0x387d('0x7c')]=qs[_0x387d('0x3e')](_0x265738[_0x387d('0x35')][_0x387d('0x3e')]);_0x35c06d['where']=qs[_0x387d('0x36')](_['pick'](_0x265738[_0x387d('0x35')],_0x489100[_0x387d('0x36')]));if(_0x265738[_0x387d('0x35')][_0x387d('0x41')]){_0x35c06d[_0x387d('0x3f')]=_['merge'](_0x35c06d[_0x387d('0x3f')],{'$or':_[_0x387d('0x7d')](_0x35c06d[_0x387d('0x38')],function(_0x18ba5d){var _0x13e4f6={};_0x13e4f6[_0x18ba5d]={'$like':'%'+_0x265738[_0x387d('0x35')][_0x387d('0x41')]+'%'};return _0x13e4f6;})});}_0x35c06d=_['merge']({},_0x35c06d,_0x265738[_0x387d('0x46')]);return _0x7adea9[_0x387d('0x7a')](_0x35c06d);}})['then'](function(_0x2b0722){if(_0x2b0722){_0x5f0827=_0x2b0722[_0x387d('0x3a')];if(!_0x265738[_0x387d('0x35')][_0x387d('0x3b')]('nolimit')){_0x35c06d[_0x387d('0x3d')]=qs[_0x387d('0x3d')](_0x265738[_0x387d('0x35')][_0x387d('0x3d')]);_0x35c06d[_0x387d('0x25')]=qs['offset'](_0x265738[_0x387d('0x35')][_0x387d('0x25')]);}return _0x7adea9['getItems'](_0x35c06d);}})['then'](function(_0x1856f4){if(_0x1856f4){return _0x1856f4?{'count':_0x5f0827,'rows':_0x1856f4}:null;}})[_0x387d('0x2a')](respondWithResult(_0x2ed597,null))[_0x387d('0x4a')](handleError(_0x2ed597,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index bfe6857..89ec128 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 _0xcc6d=['hook','events','Dashboard','setMaxListeners','save','update','emit'];(function(_0x14a2e3,_0x371c3a){var _0x259425=function(_0x49d7ef){while(--_0x49d7ef){_0x14a2e3['push'](_0x14a2e3['shift']());}};_0x259425(++_0x371c3a);}(_0xcc6d,0x1c8));var _0xdcc6=function(_0x4e029e,_0x1922df){_0x4e029e=_0x4e029e-0x0;var _0x1d0aeb=_0xcc6d[_0x4e029e];return _0x1d0aeb;};'use strict';var EventEmitter=require(_0xdcc6('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xdcc6('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xdcc6('0x2')](0x0);var events={'afterCreate':_0xdcc6('0x3'),'afterUpdate':_0xdcc6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5737f4){return function(_0x538138,_0x1e763c,_0x3ef519){DashboardEvents[_0xdcc6('0x5')](_0x5737f4+':'+_0x538138['id'],_0x538138);DashboardEvents[_0xdcc6('0x5')](_0x5737f4,_0x538138);_0x3ef519(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xdcc6('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x3a43=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x3817f5,_0x30e46f){var _0x435a81=function(_0x4ca106){while(--_0x4ca106){_0x3817f5['push'](_0x3817f5['shift']());}};_0x435a81(++_0x30e46f);}(_0x3a43,0x197));var _0x33a4=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x3a43[_0x4b1032];return _0x5a1d55;};'use strict';var EventEmitter=require(_0x33a4('0x0'));var Dashboard=require(_0x33a4('0x1'))['db'][_0x33a4('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x33a4('0x3')](0x0);var events={'afterCreate':_0x33a4('0x4'),'afterUpdate':'update','afterDestroy':_0x33a4('0x5')};function emitEvent(_0x14a9cd){return function(_0x5b2fa9,_0x3d2bda,_0x33790b){DashboardEvents[_0x33a4('0x6')](_0x14a9cd+':'+_0x5b2fa9['id'],_0x5b2fa9);DashboardEvents[_0x33a4('0x6')](_0x14a9cd,_0x5b2fa9);_0x33790b(null);};}for(var e in events){if(events[_0x33a4('0x7')](e)){var event=events[e];Dashboard[_0x33a4('0x8')](e,emitEvent(event));}}module[_0x33a4('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 8c24cb3..9a6357b 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 _0xa413=['bluebird','exports','define','Dashboard','dashboards','lodash','../../config/logger','moment'];(function(_0x9914ac,_0x5c60a0){var _0x3fdfcd=function(_0x4acbd8){while(--_0x4acbd8){_0x9914ac['push'](_0x9914ac['shift']());}};_0x3fdfcd(++_0x5c60a0);}(_0xa413,0x1e5));var _0x3a41=function(_0x5c4936,_0x322882){_0x5c4936=_0x5c4936-0x0;var _0x15efea=_0xa413[_0x5c4936];return _0x15efea;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var logger=require(_0x3a41('0x1'))('api');var moment=require(_0x3a41('0x2'));var BPromise=require(_0x3a41('0x3'));var rp=require('request-promise');var attributes=require('./dashboard.attributes');module[_0x3a41('0x4')]=function(_0x212eb6,_0x118b7a){return _0x212eb6[_0x3a41('0x5')](_0x3a41('0x6'),attributes,{'tableName':_0x3a41('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ae0=['./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger','moment','bluebird'];(function(_0x132c8c,_0x4b41bf){var _0x46162f=function(_0x371b3d){while(--_0x371b3d){_0x132c8c['push'](_0x132c8c['shift']());}};_0x46162f(++_0x4b41bf);}(_0x5ae0,0xf8));var _0x05ae=function(_0x84635a,_0x46e1f1){_0x84635a=_0x84635a-0x0;var _0x3729d6=_0x5ae0[_0x84635a];return _0x3729d6;};'use strict';var _=require('lodash');var util=require(_0x05ae('0x0'));var logger=require(_0x05ae('0x1'))('api');var moment=require(_0x05ae('0x2'));var BPromise=require(_0x05ae('0x3'));var rp=require('request-promise');var attributes=require(_0x05ae('0x4'));module[_0x05ae('0x5')]=function(_0x4aac85,_0x554b43){return _0x4aac85[_0x05ae('0x6')](_0x05ae('0x7'),attributes,{'tableName':_0x05ae('0x8'),'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 1a0afe6..f4cd9bb 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 _0xaa91=['localhost','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x525a87,_0x40ebc0){var _0x956743=function(_0x2d04bf){while(--_0x2d04bf){_0x525a87['push'](_0x525a87['shift']());}};_0x956743(++_0x40ebc0);}(_0xaa91,0x1eb));var _0x1aa9=function(_0xaa5746,_0x5f1bc1){_0xaa5746=_0xaa5746-0x0;var _0x6fdf5e=_0xaa91[_0xaa5746];return _0x6fdf5e;};'use strict';var _=require(_0x1aa9('0x0'));var util=require(_0x1aa9('0x1'));var moment=require(_0x1aa9('0x2'));var BPromise=require(_0x1aa9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1aa9('0x4'));var db=require(_0x1aa9('0x5'))['db'];var utils=require(_0x1aa9('0x6'));var logger=require('../../config/logger')(_0x1aa9('0x7'));var config=require(_0x1aa9('0x8'));var jayson=require(_0x1aa9('0x9'));var client=jayson[_0x1aa9('0xa')]['http']({'port':0x232a});config[_0x1aa9('0xb')]=_[_0x1aa9('0xc')](config[_0x1aa9('0xb')],{'host':_0x1aa9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1aa9('0xe'))[_0x1aa9('0xf')](socket);function respondWithRpcPromise(_0x44c60c,_0x211951,_0x360775){return new BPromise(function(_0x5e49b8,_0x3eb703){return client[_0x1aa9('0x10')](_0x44c60c,_0x360775)['then'](function(_0x4e8612){logger['info'](_0x1aa9('0x11'),_0x211951,_0x1aa9('0x12'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x211951,_0x1aa9('0x12'),JSON['stringify'](_0x4e8612));if(_0x4e8612[_0x1aa9('0x13')]){if(_0x4e8612[_0x1aa9('0x13')]['code']===0x1f4){logger[_0x1aa9('0x13')](_0x1aa9('0x11'),_0x211951,_0x4e8612[_0x1aa9('0x13')][_0x1aa9('0x14')]);return _0x3eb703(_0x4e8612[_0x1aa9('0x13')]['message']);}logger[_0x1aa9('0x13')](_0x1aa9('0x11'),_0x211951,_0x4e8612[_0x1aa9('0x13')]['message']);return _0x5e49b8(_0x4e8612[_0x1aa9('0x13')][_0x1aa9('0x14')]);}else{logger[_0x1aa9('0x15')]('Dashboard,\x20%s,\x20%s',_0x211951,_0x1aa9('0x12'));_0x5e49b8(_0x4e8612[_0x1aa9('0x16')]['message']);}})[_0x1aa9('0x17')](function(_0x139240){logger['error'](_0x1aa9('0x11'),_0x211951,_0x139240);_0x3eb703(_0x139240);});});} \ No newline at end of file +var _0xeec6=['debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0xad58a6,_0x29f46f){var _0x5d1424=function(_0x1bde8a){while(--_0x1bde8a){_0xad58a6['push'](_0xad58a6['shift']());}};_0x5d1424(++_0x29f46f);}(_0xeec6,0x1da));var _0x6eec=function(_0x24a737,_0x3ff299){_0x24a737=_0x24a737-0x0;var _0x37b618=_0xeec6[_0x24a737];return _0x37b618;};'use strict';var _=require(_0x6eec('0x0'));var util=require('util');var moment=require(_0x6eec('0x1'));var BPromise=require(_0x6eec('0x2'));var rs=require(_0x6eec('0x3'));var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require(_0x6eec('0xa'));var client=jayson[_0x6eec('0xb')][_0x6eec('0xc')]({'port':0x232a});config[_0x6eec('0xd')]=_[_0x6eec('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6eec('0xf'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x69de7,_0x5cdb8c,_0x305663){return new BPromise(function(_0x39d7d3,_0x446599){return client[_0x6eec('0x10')](_0x69de7,_0x305663)[_0x6eec('0x11')](function(_0x464f4b){logger['info'](_0x6eec('0x12'),_0x5cdb8c,_0x6eec('0x13'));logger[_0x6eec('0x14')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x5cdb8c,_0x6eec('0x13'),JSON[_0x6eec('0x15')](_0x464f4b));if(_0x464f4b[_0x6eec('0x16')]){if(_0x464f4b[_0x6eec('0x16')][_0x6eec('0x17')]===0x1f4){logger[_0x6eec('0x16')](_0x6eec('0x12'),_0x5cdb8c,_0x464f4b[_0x6eec('0x16')][_0x6eec('0x18')]);return _0x446599(_0x464f4b['error'][_0x6eec('0x18')]);}logger[_0x6eec('0x16')](_0x6eec('0x12'),_0x5cdb8c,_0x464f4b[_0x6eec('0x16')][_0x6eec('0x18')]);return _0x39d7d3(_0x464f4b[_0x6eec('0x16')]['message']);}else{logger['info'](_0x6eec('0x12'),_0x5cdb8c,'request\x20sent');_0x39d7d3(_0x464f4b[_0x6eec('0x19')]['message']);}})['catch'](function(_0x4e4ef0){logger['error'](_0x6eec('0x12'),_0x5cdb8c,_0x4e4ef0);_0x446599(_0x4e4ef0);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4ec951f..f5d9b95 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 _0x99bf=['length','./dashboard.events','save','remove','emit','register'];(function(_0x39bb07,_0xa0bf9e){var _0xd173dd=function(_0x2c9d03){while(--_0x2c9d03){_0x39bb07['push'](_0x39bb07['shift']());}};_0xd173dd(++_0xa0bf9e);}(_0x99bf,0x133));var _0xf99b=function(_0x953a55,_0x736d43){_0x953a55=_0x953a55-0x0;var _0x43fa9a=_0x99bf[_0x953a55];return _0x43fa9a;};'use strict';var DashboardEvents=require(_0xf99b('0x0'));var events=[_0xf99b('0x1'),_0xf99b('0x2'),'update'];function createListener(_0x5cbe68,_0x3c3d7a){return function(_0x4dc816){_0x3c3d7a[_0xf99b('0x3')](_0x5cbe68,_0x4dc816);};}function removeListener(_0x71c7ac,_0x55bcd3){return function(){DashboardEvents['removeListener'](_0x71c7ac,_0x55bcd3);};}exports[_0xf99b('0x4')]=function(_0x3316df){for(var _0x1777c2=0x0,_0x141350=events[_0xf99b('0x5')];_0x1777c2<_0x141350;_0x1777c2++){var _0xe454b7=events[_0x1777c2];var _0x40fb07=createListener('dashboard:'+_0xe454b7,_0x3316df);DashboardEvents['on'](_0xe454b7,_0x40fb07);}}; \ No newline at end of file +var _0x1932=['register','length','dashboard:','./dashboard.events','save','remove','update','emit'];(function(_0x56d35c,_0x9bbe48){var _0xfcebce=function(_0x1a5bf8){while(--_0x1a5bf8){_0x56d35c['push'](_0x56d35c['shift']());}};_0xfcebce(++_0x9bbe48);}(_0x1932,0x193));var _0x2193=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x1932[_0x4d613c];return _0x301fe3;};'use strict';var DashboardEvents=require(_0x2193('0x0'));var events=[_0x2193('0x1'),_0x2193('0x2'),_0x2193('0x3')];function createListener(_0x375ba1,_0x5bc403){return function(_0x2373b3){_0x5bc403[_0x2193('0x4')](_0x375ba1,_0x2373b3);};}function removeListener(_0x12f47f,_0x56846a){return function(){DashboardEvents['removeListener'](_0x12f47f,_0x56846a);};}exports[_0x2193('0x5')]=function(_0x2bb1ad){for(var _0x202076=0x0,_0x510563=events[_0x2193('0x6')];_0x202076<_0x510563;_0x202076++){var _0x2e147b=events[_0x202076];var _0x5773b9=createListener(_0x2193('0x7')+_0x2e147b,_0x2bb1ad);DashboardEvents['on'](_0x2e147b,_0x5773b9);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 6366abd..ad67e36 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 _0xb105=['express','Router','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','delete','multer','util','connect-timeout'];(function(_0xc1432,_0x1a391e){var _0x224475=function(_0x4a4420){while(--_0x4a4420){_0xc1432['push'](_0xc1432['shift']());}};_0x224475(++_0x1a391e);}(_0xb105,0xcf));var _0x5b10=function(_0x903dd5,_0x8e8972){_0x903dd5=_0x903dd5-0x0;var _0xf8346a=_0xb105[_0x903dd5];return _0xf8346a;};'use strict';var multer=require(_0x5b10('0x0'));var util=require(_0x5b10('0x1'));var path=require('path');var timeout=require(_0x5b10('0x2'));var express=require(_0x5b10('0x3'));var router=express[_0x5b10('0x4')]();var auth=require(_0x5b10('0x5'));var interaction=require(_0x5b10('0x6'));var config=require('../../config/environment');var controller=require(_0x5b10('0x7'));router[_0x5b10('0x8')]('/',auth[_0x5b10('0x9')](),controller['index']);router['get'](_0x5b10('0xa'),auth['isAuthenticated'](),controller[_0x5b10('0xb')]);router[_0x5b10('0x8')](_0x5b10('0xc'),auth[_0x5b10('0x9')](),controller[_0x5b10('0xd')]);router[_0x5b10('0xe')]('/',auth[_0x5b10('0x9')](),controller[_0x5b10('0xf')]);router[_0x5b10('0xe')](_0x5b10('0x10'),auth['isAuthenticated'](),controller[_0x5b10('0x11')]);router['post'](_0x5b10('0xc'),auth[_0x5b10('0x9')](),controller[_0x5b10('0x12')]);router[_0x5b10('0x13')](_0x5b10('0xa'),auth[_0x5b10('0x9')](),controller['update']);router[_0x5b10('0x14')](_0x5b10('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb8c7=['post','/:id/items','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','index','get','getItems','/:id/clone','clone'];(function(_0x464184,_0x5c3c97){var _0x1115a5=function(_0x407f06){while(--_0x407f06){_0x464184['push'](_0x464184['shift']());}};_0x1115a5(++_0x5c3c97);}(_0xb8c7,0x1aa));var _0x7b8c=function(_0x3179da,_0x180f3f){_0x3179da=_0x3179da-0x0;var _0x2cb916=_0xb8c7[_0x3179da];return _0x2cb916;};'use strict';var multer=require(_0x7b8c('0x0'));var util=require(_0x7b8c('0x1'));var path=require(_0x7b8c('0x2'));var timeout=require(_0x7b8c('0x3'));var express=require(_0x7b8c('0x4'));var router=express[_0x7b8c('0x5')]();var auth=require(_0x7b8c('0x6'));var interaction=require(_0x7b8c('0x7'));var config=require('../../config/environment');var controller=require(_0x7b8c('0x8'));router['get']('/',auth[_0x7b8c('0x9')](),controller[_0x7b8c('0xa')]);router['get']('/:id',auth[_0x7b8c('0x9')](),controller['show']);router[_0x7b8c('0xb')]('/:id/items',auth['isAuthenticated'](),controller[_0x7b8c('0xc')]);router['post']('/',auth[_0x7b8c('0x9')](),controller['create']);router['post'](_0x7b8c('0xd'),auth[_0x7b8c('0x9')](),controller[_0x7b8c('0xe')]);router[_0x7b8c('0xf')](_0x7b8c('0x10'),auth[_0x7b8c('0x9')](),controller['addItem']);router['put'](_0x7b8c('0x11'),auth[_0x7b8c('0x9')](),controller[_0x7b8c('0x12')]);router['delete'](_0x7b8c('0x11'),auth[_0x7b8c('0x9')](),controller[_0x7b8c('0x13')]);module[_0x7b8c('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 653a33a..93ba7c5 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 _0x94a5=['parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','sequelize','squel','STRING','TEXT','long'];(function(_0x115220,_0x4c4e50){var _0x5c2c54=function(_0xa13153){while(--_0xa13153){_0x115220['push'](_0x115220['shift']());}};_0x5c2c54(++_0x4c4e50);}(_0x94a5,0x193));var _0x594a=function(_0x46f80a,_0x375914){_0x46f80a=_0x46f80a-0x0;var _0x46c3ca=_0x94a5[_0x46f80a];return _0x46c3ca;};'use strict';var Sequelize=require(_0x594a('0x0'));var squel=require(_0x594a('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x594a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x594a('0x3')](_0x594a('0x4')),'get':function(){try{return JSON[_0x594a('0x5')](this[_0x594a('0x6')](_0x594a('0x7')));}catch(_0x32d0fc){return[];}},'set':function(_0xba28e3){try{this['setDataValue'](_0x594a('0x7'),JSON[_0x594a('0x8')](_0xba28e3));}catch(_0x1aedb9){this[_0x594a('0x9')](_0x594a('0x7'),JSON[_0x594a('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x594a('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x594a('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x594a('0xa')]},'background':{'type':Sequelize[_0x594a('0x2')],'allowNull':![],'defaultValue':_0x594a('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x594a('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x594a('0x2')]}}; \ No newline at end of file +var _0x03a2=['sequelize','squel','exports','STRING','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x03a2,0x174));var _0x203a=function(_0x52e5fd,_0x53efb7){_0x52e5fd=_0x52e5fd-0x0;var _0x46ae7b=_0x03a2[_0x52e5fd];return _0x46ae7b;};'use strict';var Sequelize=require(_0x203a('0x0'));var squel=require(_0x203a('0x1'));var _=require('lodash');module[_0x203a('0x2')]={'title':{'type':Sequelize[_0x203a('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x203a('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x203a('0x4')](this[_0x203a('0x5')](_0x203a('0x6')));}catch(_0x41704c){return[];}},'set':function(_0x11f179){try{this['setDataValue'](_0x203a('0x6'),JSON[_0x203a('0x7')](_0x11f179));}catch(_0x152cfd){this[_0x203a('0x8')](_0x203a('0x6'),JSON[_0x203a('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x203a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x203a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x203a('0x9')]},'col':{'type':Sequelize[_0x203a('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x203a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x203a('0x3')],'allowNull':![],'defaultValue':_0x203a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x203a('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 1327f1c..23ec295 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 _0x2168=['value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','type','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./dashboardItem.socket','register','sendStatus','json','offset','limit','status','Content-Range','apply','reject','update','then','destroy','error','name','send','show','keys','DashboardItem','rawAttributes','query','filters','model','intersection','fields','attributes','include','merge','options','find','catch','params','iframe','attrUrl','attrs','custom','attrPath'];(function(_0x5928f0,_0x1ae410){var _0x16797b=function(_0x22524f){while(--_0x22524f){_0x5928f0['push'](_0x5928f0['shift']());}};_0x16797b(++_0x1ae410);}(_0x2168,0x6a));var _0x8216=function(_0x5b0c84,_0x52bb22){_0x5b0c84=_0x5b0c84-0x0;var _0x5d40f0=_0x2168[_0x5b0c84];return _0x5d40f0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8216('0x0'));var rimraf=require(_0x8216('0x1'));var zipdir=require(_0x8216('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8216('0x3'));var BPromise=require(_0x8216('0x4'));var Mustache=require('mustache');var util=require(_0x8216('0x5'));var path=require(_0x8216('0x6'));var sox=require(_0x8216('0x7'));var csv=require('to-csv');var ejs=require(_0x8216('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8216('0x9'));var crypto=require(_0x8216('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8216('0xb'));var toCsv=require(_0x8216('0xc'));var querystring=require('querystring');var Papa=require(_0x8216('0xd'));var authService=require(_0x8216('0xe'));var hardwareService=require(_0x8216('0xf'));var Redis=require('ioredis');var qs=require(_0x8216('0x10'));var logger=require(_0x8216('0x11'))(_0x8216('0x12'));var utils=require('../../config/utils');var config=require(_0x8216('0x13'));var db=require(_0x8216('0x14'))['db'];config[_0x8216('0x15')]=_['defaults'](config[_0x8216('0x15')],{'host':_0x8216('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8216('0x15')]));require(_0x8216('0x17'))[_0x8216('0x18')](socket);function respondWithStatusCode(_0x19d368,_0x370327){_0x370327=_0x370327||0xcc;return function(_0x59b569){if(_0x59b569){return _0x19d368[_0x8216('0x19')](_0x370327);}return _0x19d368['status'](_0x370327)['end']();};}function respondWithResult(_0x458598,_0x1e940a){_0x1e940a=_0x1e940a||0xc8;return function(_0x1b543a){if(_0x1b543a){return _0x458598['status'](_0x1e940a)[_0x8216('0x1a')](_0x1b543a);}};}function respondWithFilteredResult(_0x4e96ba,_0xfb3928){return function(_0x420812){if(_0x420812){var _0x5d706c=_0x420812['count'],_0x555d25=_0xfb3928[_0x8216('0x1b')],_0x4069f3=_0xfb3928['offset']+_0xfb3928[_0x8216('0x1c')],_0x662fad;if(_0x4069f3>=_0x5d706c){_0x4069f3=_0x5d706c;_0x662fad=0xc8;}else{_0x662fad=0xce;}_0x4e96ba[_0x8216('0x1d')](_0x662fad);return _0x4e96ba['set'](_0x8216('0x1e'),_0x555d25+'-'+_0x4069f3+'/'+_0x5d706c)[_0x8216('0x1a')](_0x420812);}return null;};}function patchUpdates(_0x557416){return function(_0x2bbf65){try{jsonpatch[_0x8216('0x1f')](_0x2bbf65,_0x557416,!![]);}catch(_0x4e698b){return BPromise[_0x8216('0x20')](_0x4e698b);}return _0x2bbf65['save']();};}function saveUpdates(_0x2ee451,_0x36b571){return function(_0xfc5dde){if(_0xfc5dde){return _0xfc5dde[_0x8216('0x21')](_0x2ee451)[_0x8216('0x22')](function(_0x487c28){return _0x487c28;});}return null;};}function removeEntity(_0xc53c71,_0x2ec73c){return function(_0x19ed02){if(_0x19ed02){return _0x19ed02[_0x8216('0x23')]()[_0x8216('0x22')](function(){_0xc53c71['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aab0b,_0x36ccc8){return function(_0x437ebb){if(!_0x437ebb){_0x2aab0b[_0x8216('0x19')](0x194);}return _0x437ebb;};}function handleError(_0x21d317,_0x4b9810){_0x4b9810=_0x4b9810||0x1f4;return function(_0x24897f){logger[_0x8216('0x24')](_0x24897f['stack']);if(_0x24897f[_0x8216('0x25')]){delete _0x24897f[_0x8216('0x25')];}_0x21d317[_0x8216('0x1d')](_0x4b9810)[_0x8216('0x26')](_0x24897f);};}exports[_0x8216('0x27')]=function(_0x5d8325,_0x4ea217){var _0x853cc1={'raw':![],'where':{'id':_0x5d8325['params']['id']}},_0x20b5d0={};_0x20b5d0['model']=_[_0x8216('0x28')](db[_0x8216('0x29')][_0x8216('0x2a')]);_0x20b5d0[_0x8216('0x2b')]=_[_0x8216('0x28')](_0x5d8325[_0x8216('0x2b')]);_0x20b5d0[_0x8216('0x2c')]=_['intersection'](_0x20b5d0[_0x8216('0x2d')],_0x20b5d0[_0x8216('0x2b')]);_0x853cc1['attributes']=_[_0x8216('0x2e')](_0x20b5d0[_0x8216('0x2d')],qs[_0x8216('0x2f')](_0x5d8325[_0x8216('0x2b')][_0x8216('0x2f')]));_0x853cc1[_0x8216('0x30')]=_0x853cc1[_0x8216('0x30')]['length']?_0x853cc1[_0x8216('0x30')]:_0x20b5d0[_0x8216('0x2d')];if(_0x5d8325[_0x8216('0x2b')]['includeAll']){_0x853cc1[_0x8216('0x31')]=[{'all':!![]}];}_0x853cc1=_[_0x8216('0x32')]({},_0x853cc1,_0x5d8325[_0x8216('0x33')]);return db[_0x8216('0x29')][_0x8216('0x34')](_0x853cc1)[_0x8216('0x22')](handleEntityNotFound(_0x4ea217,null))[_0x8216('0x22')](respondWithResult(_0x4ea217,null))[_0x8216('0x35')](handleError(_0x4ea217,null));};exports[_0x8216('0x23')]=function(_0x2ddf1a,_0x4ea732){return db[_0x8216('0x29')][_0x8216('0x34')]({'where':{'id':_0x2ddf1a[_0x8216('0x36')]['id']}})[_0x8216('0x22')](handleEntityNotFound(_0x4ea732,null))[_0x8216('0x22')](removeEntity(_0x4ea732,null))[_0x8216('0x35')](handleError(_0x4ea732,null));};function widgetAttributes(_0x65afd9){try{switch(_0x65afd9['type']){case _0x8216('0x37'):return[{'name':_0x8216('0x38'),'value':_0x65afd9['attrUrl']||(_0x65afd9[_0x8216('0x39')]&&_0x65afd9[_0x8216('0x39')][0x0]?_0x65afd9['attrs'][0x0]['value']:undefined)||'https://'}];case _0x8216('0x3a'):return[{'name':_0x8216('0x3b'),'value':_0x65afd9[_0x8216('0x3b')]||(_0x65afd9[_0x8216('0x39')]&&_0x65afd9[_0x8216('0x39')][0x0]?_0x65afd9['attrs'][0x0][_0x8216('0x3c')]:undefined)||''}];case _0x8216('0x3d'):return[{'name':'attrHourFormat','value':_0x65afd9[_0x8216('0x3e')]||(_0x65afd9[_0x8216('0x39')]&&_0x65afd9[_0x8216('0x39')][0x0]?_0x65afd9[_0x8216('0x39')][0x0]['value']:undefined)||_0x8216('0x3f')},{'name':_0x8216('0x40'),'value':_0x65afd9['attrTimezone']||(_0x65afd9[_0x8216('0x39')]&&_0x65afd9['attrs'][0x1]?_0x65afd9[_0x8216('0x39')][0x1][_0x8216('0x3c')]:undefined)||_0x8216('0x41')},{'name':_0x8216('0x42'),'value':_0x65afd9[_0x8216('0x42')]||(_0x65afd9[_0x8216('0x39')]&&_0x65afd9[_0x8216('0x39')][0x2]?_0x65afd9[_0x8216('0x39')][0x2][_0x8216('0x3c')]:undefined)||0xc}];case'counter':return[{'name':_0x8216('0x43'),'value':_0x65afd9['attrMetric']||(_0x65afd9[_0x8216('0x39')]&&_0x65afd9['attrs'][0x0]?_0x65afd9[_0x8216('0x39')][0x0][_0x8216('0x3c')]:undefined)||_0x8216('0x44')},{'name':_0x8216('0x45'),'value':_0x65afd9[_0x8216('0x45')]||(_0x65afd9[_0x8216('0x39')]&&_0x65afd9[_0x8216('0x39')][0x1]?_0x65afd9[_0x8216('0x39')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x65afd9[_0x8216('0x42')]||(_0x65afd9['attrs']&&_0x65afd9[_0x8216('0x39')][0x2]?_0x65afd9[_0x8216('0x39')][0x2][_0x8216('0x3c')]:undefined)||0x14}];case _0x8216('0x46'):case _0x8216('0x47'):return[{'name':'attrSerie1','value':_0x65afd9[_0x8216('0x48')]||(_0x65afd9['attrs']&&_0x65afd9[_0x8216('0x39')][0x0]?_0x65afd9[_0x8216('0x39')][0x0][_0x8216('0x3c')]:undefined)||'total'},{'name':'attrSerie2','value':_0x65afd9[_0x8216('0x49')]||(_0x65afd9['attrs']&&_0x65afd9[_0x8216('0x39')][0x1]?_0x65afd9[_0x8216('0x39')][0x1][_0x8216('0x3c')]:undefined)||null},{'name':'attrSerie3','value':_0x65afd9[_0x8216('0x4a')]||(_0x65afd9[_0x8216('0x39')]&&_0x65afd9[_0x8216('0x39')][0x2]?_0x65afd9['attrs'][0x2][_0x8216('0x3c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x65afd9[_0x8216('0x45')]||(_0x65afd9[_0x8216('0x39')]&&_0x65afd9[_0x8216('0x39')][0x3]?_0x65afd9['attrs'][0x3]['value']:undefined)||[]}];case _0x8216('0x4b'):return[{'name':'attrReport','type':_0x65afd9['reportType']||(_0x65afd9['attrs']&&_0x65afd9[_0x8216('0x39')][0x0]?_0x65afd9[_0x8216('0x39')][0x0][_0x8216('0x4c')]:undefined)||null,'value':_0x65afd9[_0x8216('0x4d')]||(_0x65afd9[_0x8216('0x39')]&&_0x65afd9[_0x8216('0x39')][0x0]?_0x65afd9[_0x8216('0x39')][0x0]['value']:undefined)||null},{'name':_0x8216('0x4e'),'value':_0x65afd9[_0x8216('0x4e')]||(_0x65afd9[_0x8216('0x39')]&&_0x65afd9['attrs'][0x1]?_0x65afd9[_0x8216('0x39')][0x1][_0x8216('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x2148ab){logger[_0x8216('0x24')](_0x8216('0x4f'),JSON[_0x8216('0x50')](_0x2148ab));return[];}}exports[_0x8216('0x51')]=function(_0x55d91b,_0x2b9ecc){if(_0x55d91b[_0x8216('0x52')]){_0x55d91b[_0x8216('0x52')][_0x8216('0x39')]=widgetAttributes(_0x55d91b[_0x8216('0x52')]);}return db[_0x8216('0x29')][_0x8216('0x51')](_0x55d91b[_0x8216('0x52')],{})[_0x8216('0x22')](respondWithResult(_0x2b9ecc,0xc9))[_0x8216('0x35')](handleError(_0x2b9ecc,null));};exports[_0x8216('0x21')]=function(_0x5f0954,_0xc0cf43){if(_0x5f0954[_0x8216('0x52')]['id']){delete _0x5f0954['body']['id'];}_0x5f0954['body'][_0x8216('0x39')]=widgetAttributes(_0x5f0954['body']);return db[_0x8216('0x29')][_0x8216('0x34')]({'where':{'id':_0x5f0954[_0x8216('0x36')]['id']}})[_0x8216('0x22')](handleEntityNotFound(_0xc0cf43,null))[_0x8216('0x22')](saveUpdates(_0x5f0954[_0x8216('0x52')],null))['then'](respondWithResult(_0xc0cf43,null))[_0x8216('0x35')](handleError(_0xc0cf43,null));}; \ No newline at end of file +var _0x9576=['count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','merge','options','find','catch','attrUrl','attrs','value','https://','custom','attrPath','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','type','attrRefresh','widgetAttributes:\x20%s','body','create','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','register','status'];(function(_0x92179,_0x20d048){var _0x330fa5=function(_0x283daf){while(--_0x283daf){_0x92179['push'](_0x92179['shift']());}};_0x330fa5(++_0x20d048);}(_0x9576,0x182));var _0x6957=function(_0x555854,_0x329958){_0x555854=_0x555854-0x0;var _0x2dd0c8=_0x9576[_0x555854];return _0x2dd0c8;};'use strict';var pdf=require(_0x6957('0x0'));var emlformat=require(_0x6957('0x1'));var rimraf=require(_0x6957('0x2'));var zipdir=require(_0x6957('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6957('0x4'));var BPromise=require(_0x6957('0x5'));var Mustache=require(_0x6957('0x6'));var util=require(_0x6957('0x7'));var path=require(_0x6957('0x8'));var sox=require(_0x6957('0x9'));var csv=require(_0x6957('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6957('0xb'));var squel=require(_0x6957('0xc'));var crypto=require(_0x6957('0xd'));var jsforce=require(_0x6957('0xe'));var deskjs=require(_0x6957('0xf'));var toCsv=require(_0x6957('0xa'));var querystring=require('querystring');var Papa=require(_0x6957('0x10'));var authService=require(_0x6957('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x6957('0x12'));var logger=require(_0x6957('0x13'))(_0x6957('0x14'));var utils=require(_0x6957('0x15'));var config=require(_0x6957('0x16'));var db=require(_0x6957('0x17'))['db'];config[_0x6957('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6957('0x19'))(new Redis(config[_0x6957('0x18')]));require(_0x6957('0x1a'))[_0x6957('0x1b')](socket);function respondWithStatusCode(_0x345c3e,_0x1fd3d9){_0x1fd3d9=_0x1fd3d9||0xcc;return function(_0x25d32e){if(_0x25d32e){return _0x345c3e['sendStatus'](_0x1fd3d9);}return _0x345c3e['status'](_0x1fd3d9)['end']();};}function respondWithResult(_0x35fffc,_0x256ac7){_0x256ac7=_0x256ac7||0xc8;return function(_0x228f76){if(_0x228f76){return _0x35fffc[_0x6957('0x1c')](_0x256ac7)['json'](_0x228f76);}};}function respondWithFilteredResult(_0x14422d,_0x5a33b4){return function(_0x2a39b5){if(_0x2a39b5){var _0xabd232=_0x2a39b5[_0x6957('0x1d')],_0x49aa31=_0x5a33b4['offset'],_0x2ccd8e=_0x5a33b4[_0x6957('0x1e')]+_0x5a33b4[_0x6957('0x1f')],_0x448ff6;if(_0x2ccd8e>=_0xabd232){_0x2ccd8e=_0xabd232;_0x448ff6=0xc8;}else{_0x448ff6=0xce;}_0x14422d[_0x6957('0x1c')](_0x448ff6);return _0x14422d[_0x6957('0x20')](_0x6957('0x21'),_0x49aa31+'-'+_0x2ccd8e+'/'+_0xabd232)[_0x6957('0x22')](_0x2a39b5);}return null;};}function patchUpdates(_0x35ee5b){return function(_0x3081b2){try{jsonpatch['apply'](_0x3081b2,_0x35ee5b,!![]);}catch(_0x5ee3f8){return BPromise[_0x6957('0x23')](_0x5ee3f8);}return _0x3081b2[_0x6957('0x24')]();};}function saveUpdates(_0x18037f,_0x2569f4){return function(_0x3591fa){if(_0x3591fa){return _0x3591fa[_0x6957('0x25')](_0x18037f)[_0x6957('0x26')](function(_0x310a5e){return _0x310a5e;});}return null;};}function removeEntity(_0x56b0ba,_0x2b2dcd){return function(_0x3c9de7){if(_0x3c9de7){return _0x3c9de7[_0x6957('0x27')]()[_0x6957('0x26')](function(){_0x56b0ba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa1e6af,_0x2a57b6){return function(_0x5c4e49){if(!_0x5c4e49){_0xa1e6af['sendStatus'](0x194);}return _0x5c4e49;};}function handleError(_0x320e7d,_0xa2f92f){_0xa2f92f=_0xa2f92f||0x1f4;return function(_0x3bc22f){logger['error'](_0x3bc22f[_0x6957('0x28')]);if(_0x3bc22f[_0x6957('0x29')]){delete _0x3bc22f[_0x6957('0x29')];}_0x320e7d[_0x6957('0x1c')](_0xa2f92f)[_0x6957('0x2a')](_0x3bc22f);};}exports[_0x6957('0x2b')]=function(_0x2d33ef,_0x320e1a){var _0x595770={'raw':![],'where':{'id':_0x2d33ef[_0x6957('0x2c')]['id']}},_0x2e7fe1={};_0x2e7fe1[_0x6957('0x2d')]=_[_0x6957('0x2e')](db[_0x6957('0x2f')][_0x6957('0x30')]);_0x2e7fe1[_0x6957('0x31')]=_[_0x6957('0x2e')](_0x2d33ef[_0x6957('0x31')]);_0x2e7fe1[_0x6957('0x32')]=_[_0x6957('0x33')](_0x2e7fe1['model'],_0x2e7fe1['query']);_0x595770[_0x6957('0x34')]=_[_0x6957('0x33')](_0x2e7fe1[_0x6957('0x2d')],qs[_0x6957('0x35')](_0x2d33ef['query'][_0x6957('0x35')]));_0x595770[_0x6957('0x34')]=_0x595770[_0x6957('0x34')]['length']?_0x595770['attributes']:_0x2e7fe1[_0x6957('0x2d')];if(_0x2d33ef[_0x6957('0x31')][_0x6957('0x36')]){_0x595770['include']=[{'all':!![]}];}_0x595770=_[_0x6957('0x37')]({},_0x595770,_0x2d33ef[_0x6957('0x38')]);return db[_0x6957('0x2f')][_0x6957('0x39')](_0x595770)[_0x6957('0x26')](handleEntityNotFound(_0x320e1a,null))[_0x6957('0x26')](respondWithResult(_0x320e1a,null))[_0x6957('0x3a')](handleError(_0x320e1a,null));};exports[_0x6957('0x27')]=function(_0x244bee,_0x5744e7){return db[_0x6957('0x2f')][_0x6957('0x39')]({'where':{'id':_0x244bee[_0x6957('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5744e7,null))['then'](removeEntity(_0x5744e7,null))['catch'](handleError(_0x5744e7,null));};function widgetAttributes(_0x9dc614){try{switch(_0x9dc614['type']){case'iframe':return[{'name':_0x6957('0x3b'),'value':_0x9dc614[_0x6957('0x3b')]||(_0x9dc614['attrs']&&_0x9dc614['attrs'][0x0]?_0x9dc614[_0x6957('0x3c')][0x0][_0x6957('0x3d')]:undefined)||_0x6957('0x3e')}];case _0x6957('0x3f'):return[{'name':_0x6957('0x40'),'value':_0x9dc614['attrPath']||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614['attrs'][0x0]?_0x9dc614['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x9dc614['attrHourFormat']||(_0x9dc614['attrs']&&_0x9dc614['attrs'][0x0]?_0x9dc614['attrs'][0x0][_0x6957('0x3d')]:undefined)||_0x6957('0x41')},{'name':_0x6957('0x42'),'value':_0x9dc614[_0x6957('0x42')]||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614[_0x6957('0x3c')][0x1]?_0x9dc614[_0x6957('0x3c')][0x1][_0x6957('0x3d')]:undefined)||'0.00'},{'name':_0x6957('0x43'),'value':_0x9dc614['attrFontSize']||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614[_0x6957('0x3c')][0x2]?_0x9dc614[_0x6957('0x3c')][0x2][_0x6957('0x3d')]:undefined)||0xc}];case _0x6957('0x44'):return[{'name':_0x6957('0x45'),'value':_0x9dc614[_0x6957('0x45')]||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614[_0x6957('0x3c')][0x0]?_0x9dc614[_0x6957('0x3c')][0x0][_0x6957('0x3d')]:undefined)||_0x6957('0x46')},{'name':_0x6957('0x47'),'value':_0x9dc614[_0x6957('0x47')]||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614[_0x6957('0x3c')][0x1]?_0x9dc614['attrs'][0x1][_0x6957('0x3d')]:undefined)||[]},{'name':'attrFontSize','value':_0x9dc614['attrFontSize']||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614['attrs'][0x2]?_0x9dc614['attrs'][0x2][_0x6957('0x3d')]:undefined)||0x14}];case _0x6957('0x48'):case _0x6957('0x49'):return[{'name':_0x6957('0x4a'),'value':_0x9dc614[_0x6957('0x4a')]||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614[_0x6957('0x3c')][0x0]?_0x9dc614[_0x6957('0x3c')][0x0][_0x6957('0x3d')]:undefined)||_0x6957('0x46')},{'name':'attrSerie2','value':_0x9dc614['attrSerie2']||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614['attrs'][0x1]?_0x9dc614[_0x6957('0x3c')][0x1][_0x6957('0x3d')]:undefined)||null},{'name':'attrSerie3','value':_0x9dc614[_0x6957('0x4b')]||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614[_0x6957('0x3c')][0x2]?_0x9dc614[_0x6957('0x3c')][0x2][_0x6957('0x3d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x9dc614[_0x6957('0x47')]||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614[_0x6957('0x3c')][0x3]?_0x9dc614[_0x6957('0x3c')][0x3]['value']:undefined)||[]}];case _0x6957('0x4c'):return[{'name':_0x6957('0x4d'),'type':_0x9dc614['reportType']||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614[_0x6957('0x3c')][0x0]?_0x9dc614[_0x6957('0x3c')][0x0][_0x6957('0x4e')]:undefined)||null,'value':_0x9dc614['attrReport']||(_0x9dc614['attrs']&&_0x9dc614[_0x6957('0x3c')][0x0]?_0x9dc614[_0x6957('0x3c')][0x0][_0x6957('0x3d')]:undefined)||null},{'name':_0x6957('0x4f'),'value':_0x9dc614['attrRefresh']||(_0x9dc614[_0x6957('0x3c')]&&_0x9dc614[_0x6957('0x3c')][0x1]?_0x9dc614[_0x6957('0x3c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1e392c){logger['error'](_0x6957('0x50'),JSON['stringify'](_0x1e392c));return[];}}exports['create']=function(_0x274d40,_0x371e29){if(_0x274d40[_0x6957('0x51')]){_0x274d40[_0x6957('0x51')][_0x6957('0x3c')]=widgetAttributes(_0x274d40[_0x6957('0x51')]);}return db[_0x6957('0x2f')][_0x6957('0x52')](_0x274d40[_0x6957('0x51')],{})[_0x6957('0x26')](respondWithResult(_0x371e29,0xc9))['catch'](handleError(_0x371e29,null));};exports[_0x6957('0x25')]=function(_0x2abd65,_0x12b57e){if(_0x2abd65['body']['id']){delete _0x2abd65[_0x6957('0x51')]['id'];}_0x2abd65['body'][_0x6957('0x3c')]=widgetAttributes(_0x2abd65[_0x6957('0x51')]);return db['DashboardItem'][_0x6957('0x39')]({'where':{'id':_0x2abd65[_0x6957('0x2c')]['id']}})[_0x6957('0x26')](handleEntityNotFound(_0x12b57e,null))[_0x6957('0x26')](saveUpdates(_0x2abd65[_0x6957('0x51')],null))[_0x6957('0x26')](respondWithResult(_0x12b57e,null))[_0x6957('0x3a')](handleError(_0x12b57e,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6506f6c..c08e361 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 _0x6864=['update','remove','emit','hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners','save'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x6864,0x1e6));var _0x4686=function(_0x759702,_0x52a472){_0x759702=_0x759702-0x0;var _0x335192=_0x6864[_0x759702];return _0x335192;};'use strict';var EventEmitter=require(_0x4686('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x4686('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4686('0x2')](0x0);var events={'afterCreate':_0x4686('0x3'),'afterUpdate':_0x4686('0x4'),'afterDestroy':_0x4686('0x5')};function emitEvent(_0x3364b0){return function(_0x4ef1b6,_0x1f6032,_0x322dcb){DashboardItemEvents[_0x4686('0x6')](_0x3364b0+':'+_0x4ef1b6['id'],_0x4ef1b6);DashboardItemEvents['emit'](_0x3364b0,_0x4ef1b6);_0x322dcb(null);};}for(var e in events){if(events[_0x4686('0x7')](e)){var event=events[e];DashboardItem[_0x4686('0x8')](e,emitEvent(event));}}module[_0x4686('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xfbf3=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x3fdbe9,_0x3465de){var _0x2e2512=function(_0x3c8335){while(--_0x3c8335){_0x3fdbe9['push'](_0x3fdbe9['shift']());}};_0x2e2512(++_0x3465de);}(_0xfbf3,0xbd));var _0x3fbf=function(_0x459a66,_0x21f7a7){_0x459a66=_0x459a66-0x0;var _0x2ac1be=_0xfbf3[_0x459a66];return _0x2ac1be;};'use strict';var EventEmitter=require(_0x3fbf('0x0'));var DashboardItem=require(_0x3fbf('0x1'))['db'][_0x3fbf('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x3fbf('0x3')](0x0);var events={'afterCreate':_0x3fbf('0x4'),'afterUpdate':_0x3fbf('0x5'),'afterDestroy':_0x3fbf('0x6')};function emitEvent(_0x44b8a4){return function(_0x8901c3,_0x3a223a,_0x45d33c){DashboardItemEvents['emit'](_0x44b8a4+':'+_0x8901c3['id'],_0x8901c3);DashboardItemEvents['emit'](_0x44b8a4,_0x8901c3);_0x45d33c(null);};}for(var e in events){if(events[_0x3fbf('0x7')](e)){var event=events[e];DashboardItem[_0x3fbf('0x8')](e,emitEvent(event));}}module[_0x3fbf('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e9f5f2f..869ae3d 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 _0x7a54=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','./dashboardItem.attributes','exports','define'];(function(_0x505abd,_0x32d6ea){var _0x25b4de=function(_0x1e4b37){while(--_0x1e4b37){_0x505abd['push'](_0x505abd['shift']());}};_0x25b4de(++_0x32d6ea);}(_0x7a54,0x106));var _0x47a5=function(_0x1f0ed3,_0x5e6d3e){_0x1f0ed3=_0x1f0ed3-0x0;var _0x1b4f58=_0x7a54[_0x1f0ed3];return _0x1b4f58;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('DashboardItem',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','./dashboardItem.attributes','exports','define'];(function(_0x1bc750,_0x23f442){var _0xcd51da=function(_0x323854){while(--_0x323854){_0x1bc750['push'](_0x1bc750['shift']());}};_0xcd51da(++_0x23f442);}(_0x7a54,0x106));var _0x47a5=function(_0x31bf18,_0x4494d6){_0x31bf18=_0x31bf18-0x0;var _0x5a7e06=_0x7a54[_0x31bf18];return _0x5a7e06;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('DashboardItem',attributes,{'tableName':_0x47a5('0x8'),'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 1950f60..45c03a5 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 _0x87e2=['then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','DashboardItem,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./dashboardItem.socket','request'];(function(_0x5df7e6,_0x12d771){var _0xfaba1b=function(_0x487746){while(--_0x487746){_0x5df7e6['push'](_0x5df7e6['shift']());}};_0xfaba1b(++_0x12d771);}(_0x87e2,0x19a));var _0x287e=function(_0x3a7c43,_0x43aca0){_0x3a7c43=_0x3a7c43-0x0;var _0x115645=_0x87e2[_0x3a7c43];return _0x115645;};'use strict';var _=require('lodash');var util=require(_0x287e('0x0'));var moment=require('moment');var BPromise=require(_0x287e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x287e('0x2'));var db=require(_0x287e('0x3'))['db'];var utils=require(_0x287e('0x4'));var logger=require(_0x287e('0x5'))('rpc');var config=require(_0x287e('0x6'));var jayson=require(_0x287e('0x7'));var client=jayson[_0x287e('0x8')][_0x287e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x287e('0xa'),'port':0x18eb});var socket=require(_0x287e('0xb'))(new Redis(config[_0x287e('0xc')]));require(_0x287e('0xd'))['register'](socket);function respondWithRpcPromise(_0x2417dc,_0x130ac9,_0x108072){return new BPromise(function(_0x4223b0,_0x4e4ab1){return client[_0x287e('0xe')](_0x2417dc,_0x108072)[_0x287e('0xf')](function(_0x2f3713){logger[_0x287e('0x10')]('DashboardItem,\x20%s,\x20%s',_0x130ac9,_0x287e('0x11'));logger[_0x287e('0x12')](_0x287e('0x13'),_0x130ac9,_0x287e('0x11'),JSON[_0x287e('0x14')](_0x2f3713));if(_0x2f3713[_0x287e('0x15')]){if(_0x2f3713[_0x287e('0x15')]['code']===0x1f4){logger[_0x287e('0x15')](_0x287e('0x16'),_0x130ac9,_0x2f3713[_0x287e('0x15')]['message']);return _0x4e4ab1(_0x2f3713[_0x287e('0x15')][_0x287e('0x17')]);}logger['error'](_0x287e('0x16'),_0x130ac9,_0x2f3713[_0x287e('0x15')][_0x287e('0x17')]);return _0x4223b0(_0x2f3713[_0x287e('0x15')][_0x287e('0x17')]);}else{logger[_0x287e('0x10')](_0x287e('0x16'),_0x130ac9,_0x287e('0x11'));_0x4223b0(_0x2f3713[_0x287e('0x18')][_0x287e('0x17')]);}})['catch'](function(_0x5555d5){logger[_0x287e('0x15')]('DashboardItem,\x20%s,\x20%s',_0x130ac9,_0x5555d5);_0x4e4ab1(_0x5555d5);});});} \ No newline at end of file +var _0x40c0=['error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','stringify','code'];(function(_0x4b6599,_0x540477){var _0x2ed7cc=function(_0x218d3a){while(--_0x218d3a){_0x4b6599['push'](_0x4b6599['shift']());}};_0x2ed7cc(++_0x540477);}(_0x40c0,0x99));var _0x040c=function(_0x3a9427,_0x27078f){_0x3a9427=_0x3a9427-0x0;var _0x2f8840=_0x40c0[_0x3a9427];return _0x2f8840;};'use strict';var _=require('lodash');var util=require(_0x040c('0x0'));var moment=require(_0x040c('0x1'));var BPromise=require(_0x040c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x040c('0x3'));var db=require(_0x040c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x040c('0x5'))(_0x040c('0x6'));var config=require(_0x040c('0x7'));var jayson=require(_0x040c('0x8'));var client=jayson[_0x040c('0x9')][_0x040c('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x040c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x040c('0xc'))(new Redis(config[_0x040c('0xb')]));require(_0x040c('0xd'))[_0x040c('0xe')](socket);function respondWithRpcPromise(_0xbf7a5a,_0x591b3b,_0x4bddf1){return new BPromise(function(_0xc58e5d,_0x29b9e4){return client['request'](_0xbf7a5a,_0x4bddf1)[_0x040c('0xf')](function(_0x28558f){logger[_0x040c('0x10')](_0x040c('0x11'),_0x591b3b,'request\x20sent');logger[_0x040c('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x591b3b,_0x040c('0x13'),JSON[_0x040c('0x14')](_0x28558f));if(_0x28558f['error']){if(_0x28558f['error'][_0x040c('0x15')]===0x1f4){logger[_0x040c('0x16')](_0x040c('0x11'),_0x591b3b,_0x28558f['error'][_0x040c('0x17')]);return _0x29b9e4(_0x28558f[_0x040c('0x16')][_0x040c('0x17')]);}logger[_0x040c('0x16')](_0x040c('0x11'),_0x591b3b,_0x28558f[_0x040c('0x16')][_0x040c('0x17')]);return _0xc58e5d(_0x28558f[_0x040c('0x16')][_0x040c('0x17')]);}else{logger[_0x040c('0x10')]('DashboardItem,\x20%s,\x20%s',_0x591b3b,'request\x20sent');_0xc58e5d(_0x28558f[_0x040c('0x18')][_0x040c('0x17')]);}})['catch'](function(_0x462f62){logger[_0x040c('0x16')]('DashboardItem,\x20%s,\x20%s',_0x591b3b,_0x462f62);_0x29b9e4(_0x462f62);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b2879a6..5b1188f 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 _0xedd9=['removeListener','register','length','dashboardItem:','save','remove','update','emit'];(function(_0x1a2e66,_0x59aad9){var _0x57162f=function(_0x1ea1b5){while(--_0x1ea1b5){_0x1a2e66['push'](_0x1a2e66['shift']());}};_0x57162f(++_0x59aad9);}(_0xedd9,0xfc));var _0x9edd=function(_0x2f4793,_0x4b3bde){_0x2f4793=_0x2f4793-0x0;var _0x4b040a=_0xedd9[_0x2f4793];return _0x4b040a;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){DashboardItemEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);DashboardItemEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file +var _0x7217=['dashboardItem:','./dashboardItem.events','remove','update','removeListener','register','length'];(function(_0x31ce3d,_0x581047){var _0x203d95=function(_0x9b9243){while(--_0x9b9243){_0x31ce3d['push'](_0x31ce3d['shift']());}};_0x203d95(++_0x581047);}(_0x7217,0x19e));var _0x7721=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x7217[_0x43d11d];return _0x38cd08;};'use strict';var DashboardItemEvents=require(_0x7721('0x0'));var events=['save',_0x7721('0x1'),_0x7721('0x2')];function createListener(_0x1de988,_0x2a78d8){return function(_0x115ab3){_0x2a78d8['emit'](_0x1de988,_0x115ab3);};}function removeListener(_0x5bf160,_0x472a96){return function(){DashboardItemEvents[_0x7721('0x3')](_0x5bf160,_0x472a96);};}exports[_0x7721('0x4')]=function(_0x3fe47c){for(var _0xb239e0=0x0,_0xf7ff37=events[_0x7721('0x5')];_0xb239e0<_0xf7ff37;_0xb239e0++){var _0x21f680=events[_0xb239e0];var _0x225610=createListener(_0x7721('0x6')+_0x21f680,_0x3fe47c);DashboardItemEvents['on'](_0x21f680,_0x225610);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 2222964..74f0f06 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 _0xd5fa=['post','isAuthenticated','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id'];(function(_0xbd2caa,_0x3285d9){var _0x23e2a8=function(_0x17198c){while(--_0x17198c){_0xbd2caa['push'](_0xbd2caa['shift']());}};_0x23e2a8(++_0x3285d9);}(_0xd5fa,0xd7));var _0xad5f=function(_0x346d61,_0x24a9cc){_0x346d61=_0x346d61-0x0;var _0x580496=_0xd5fa[_0x346d61];return _0x580496;};'use strict';var multer=require(_0xad5f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xad5f('0x1'));var express=require(_0xad5f('0x2'));var router=express[_0xad5f('0x3')]();var auth=require(_0xad5f('0x4'));var interaction=require(_0xad5f('0x5'));var config=require('../../config/environment');var controller=require(_0xad5f('0x6'));router[_0xad5f('0x7')](_0xad5f('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xad5f('0x9')]('/',auth[_0xad5f('0xa')](),controller[_0xad5f('0xb')]);router[_0xad5f('0xc')](_0xad5f('0x8'),auth[_0xad5f('0xa')](),controller[_0xad5f('0xd')]);router[_0xad5f('0xe')](_0xad5f('0x8'),auth['isAuthenticated'](),controller[_0xad5f('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe6d7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','show','post','/:id','destroy','exports','util','path','connect-timeout','express'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe6d7,0x1bc));var _0x7e6d=function(_0x3e948f,_0x19484d){_0x3e948f=_0x3e948f-0x0;var _0x4cc3de=_0xe6d7[_0x3e948f];return _0x4cc3de;};'use strict';var multer=require('multer');var util=require(_0x7e6d('0x0'));var path=require(_0x7e6d('0x1'));var timeout=require(_0x7e6d('0x2'));var express=require(_0x7e6d('0x3'));var router=express['Router']();var auth=require(_0x7e6d('0x4'));var interaction=require(_0x7e6d('0x5'));var config=require(_0x7e6d('0x6'));var controller=require(_0x7e6d('0x7'));router['get']('/:id',auth[_0x7e6d('0x8')](),controller[_0x7e6d('0x9')]);router[_0x7e6d('0xa')]('/',auth[_0x7e6d('0x8')](),controller['create']);router['put'](_0x7e6d('0xb'),auth[_0x7e6d('0x8')](),controller['update']);router['delete'](_0x7e6d('0xb'),auth[_0x7e6d('0x8')](),controller[_0x7e6d('0xc')]);module[_0x7e6d('0xd')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index e07f7fd..76d75b4 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 _0xc17e=['exports','STRING','sequelize'];(function(_0x254cc8,_0x2348d8){var _0x1a0527=function(_0x263624){while(--_0x263624){_0x254cc8['push'](_0x254cc8['shift']());}};_0x1a0527(++_0x2348d8);}(_0xc17e,0x152));var _0xec17=function(_0x385d89,_0x2fe099){_0x385d89=_0x385d89-0x0;var _0x1454e8=_0xc17e[_0x385d89];return _0x1454e8;};'use strict';var Sequelize=require(_0xec17('0x0'));module[_0xec17('0x1')]={'name':{'type':Sequelize[_0xec17('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x526b=['STRING','sequelize','exports'];(function(_0x437339,_0x5ef32b){var _0x3b4c70=function(_0x227cab){while(--_0x227cab){_0x437339['push'](_0x437339['shift']());}};_0x3b4c70(++_0x5ef32b);}(_0x526b,0xeb));var _0xb526=function(_0x49316e,_0x25f440){_0x49316e=_0x49316e-0x0;var _0x1a9457=_0x526b[_0x49316e];return _0x1a9457;};'use strict';var Sequelize=require(_0xb526('0x0'));module[_0xb526('0x1')]={'name':{'type':Sequelize[_0xb526('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 e9b1daa..8bc1d44 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 _0x62e9=['../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','sendStatus','stack','name','send','index','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','filter','map','key','field','merge','options','Disposition','findAll','rows','show','rawAttributes','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x62e9,0x1e6));var _0x962e=function(_0x107f20,_0x3079aa){_0x107f20=_0x107f20-0x0;var _0x2e26d0=_0x62e9[_0x107f20];return _0x2e26d0;};'use strict';var pdf=require(_0x962e('0x0'));var emlformat=require(_0x962e('0x1'));var rimraf=require(_0x962e('0x2'));var zipdir=require(_0x962e('0x3'));var jsonpatch=require(_0x962e('0x4'));var rp=require('request-promise');var moment=require(_0x962e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x962e('0x6'));var path=require(_0x962e('0x7'));var sox=require(_0x962e('0x8'));var csv=require(_0x962e('0x9'));var ejs=require(_0x962e('0xa'));var fs=require('fs');var _=require(_0x962e('0xb'));var squel=require(_0x962e('0xc'));var crypto=require(_0x962e('0xd'));var jsforce=require(_0x962e('0xe'));var deskjs=require(_0x962e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x962e('0x10'));var authService=require(_0x962e('0x11'));var hardwareService=require(_0x962e('0x12'));var Redis=require(_0x962e('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x962e('0x14'))(_0x962e('0x15'));var utils=require(_0x962e('0x16'));var config=require(_0x962e('0x17'));var db=require(_0x962e('0x18'))['db'];function respondWithStatusCode(_0x3ffd5d,_0x1bd926){_0x1bd926=_0x1bd926||0xcc;return function(_0x433bb9){if(_0x433bb9){return _0x3ffd5d['sendStatus'](_0x1bd926);}return _0x3ffd5d[_0x962e('0x19')](_0x1bd926)[_0x962e('0x1a')]();};}function respondWithResult(_0x24b92c,_0x1b29cd){_0x1b29cd=_0x1b29cd||0xc8;return function(_0x1204b8){if(_0x1204b8){return _0x24b92c[_0x962e('0x19')](_0x1b29cd)[_0x962e('0x1b')](_0x1204b8);}};}function respondWithFilteredResult(_0x275715,_0x95d00){return function(_0x3549ca){if(_0x3549ca){var _0x3aa693=_0x3549ca[_0x962e('0x1c')],_0x2b87bb=_0x95d00[_0x962e('0x1d')],_0x5cc51b=_0x95d00[_0x962e('0x1d')]+_0x95d00['limit'],_0x25dd36;if(_0x5cc51b>=_0x3aa693){_0x5cc51b=_0x3aa693;_0x25dd36=0xc8;}else{_0x25dd36=0xce;}_0x275715[_0x962e('0x19')](_0x25dd36);return _0x275715[_0x962e('0x1e')](_0x962e('0x1f'),_0x2b87bb+'-'+_0x5cc51b+'/'+_0x3aa693)[_0x962e('0x1b')](_0x3549ca);}return null;};}function patchUpdates(_0x1f6c22){return function(_0x4a41b2){try{jsonpatch[_0x962e('0x20')](_0x4a41b2,_0x1f6c22,!![]);}catch(_0x4c325b){return BPromise[_0x962e('0x21')](_0x4c325b);}return _0x4a41b2[_0x962e('0x22')]();};}function saveUpdates(_0x2b8a5c,_0x5e9195){return function(_0x10f1ed){if(_0x10f1ed){return _0x10f1ed[_0x962e('0x23')](_0x2b8a5c)[_0x962e('0x24')](function(_0xb89c6){return _0xb89c6;});}return null;};}function removeEntity(_0x3ee30a,_0xa4d733){return function(_0xe563ac){if(_0xe563ac){return _0xe563ac[_0x962e('0x25')]()[_0x962e('0x24')](function(){var _0x24da57=_0xe563ac[_0x962e('0x26')]({'plain':!![]});var _0x2d7555=_0x962e('0x27');return db['UserProfileResource'][_0x962e('0x25')]({'where':{'type':_0x2d7555,'resourceId':_0x24da57['id']}})[_0x962e('0x24')](function(){return _0xe563ac;});})[_0x962e('0x24')](function(){_0x3ee30a[_0x962e('0x19')](0xcc)[_0x962e('0x1a')]();});}};}function handleEntityNotFound(_0x3095fe,_0x1aeb78){return function(_0x1098b2){if(!_0x1098b2){_0x3095fe[_0x962e('0x28')](0x194);}return _0x1098b2;};}function handleError(_0x4939f1,_0xf411ae){_0xf411ae=_0xf411ae||0x1f4;return function(_0x202e12){logger['error'](_0x202e12[_0x962e('0x29')]);if(_0x202e12[_0x962e('0x2a')]){delete _0x202e12['name'];}_0x4939f1[_0x962e('0x19')](_0xf411ae)[_0x962e('0x2b')](_0x202e12);};}exports[_0x962e('0x2c')]=function(_0x197698,_0x4e739d){var _0x3933da={},_0x4a669f={},_0x67c136={'count':0x0,'rows':[]};var _0x5eb366=db['Disposition']['rawAttributes'];_0x4a669f[_0x962e('0x2d')]=_[_0x962e('0x2e')](_0x5eb366);_0x4a669f['query']=_[_0x962e('0x2e')](_0x197698[_0x962e('0x2f')]);_0x4a669f[_0x962e('0x30')]=_[_0x962e('0x31')](_0x4a669f[_0x962e('0x2d')],_0x4a669f[_0x962e('0x2f')]);_0x3933da['attributes']=_[_0x962e('0x31')](_0x4a669f[_0x962e('0x2d')],qs[_0x962e('0x32')](_0x197698[_0x962e('0x2f')][_0x962e('0x32')]));_0x3933da['attributes']=_0x3933da[_0x962e('0x33')][_0x962e('0x34')]?_0x3933da[_0x962e('0x33')]:_0x4a669f[_0x962e('0x2d')];if(!_0x197698[_0x962e('0x2f')][_0x962e('0x35')](_0x962e('0x36'))){_0x3933da[_0x962e('0x37')]=qs[_0x962e('0x37')](_0x197698[_0x962e('0x2f')]['limit']);_0x3933da[_0x962e('0x1d')]=qs[_0x962e('0x1d')](_0x197698[_0x962e('0x2f')]['offset']);}_0x3933da[_0x962e('0x38')]=qs['sort'](_0x197698[_0x962e('0x2f')]['sort']);_0x3933da[_0x962e('0x39')]=qs[_0x962e('0x30')](_['pick'](_0x197698['query'],_0x4a669f['filters']));if(_0x197698[_0x962e('0x2f')][_0x962e('0x3a')]){_0x3933da['where']=_['merge'](_0x3933da[_0x962e('0x39')],{'$or':_[_0x962e('0x3b')](_0x5eb366,function(_0xc1e962){if(_0xc1e962['type'][_0x962e('0x3c')]!=='VIRTUAL'){var _0x1d471e={};_0x1d471e[_0xc1e962[_0x962e('0x3d')]]={'$like':'%'+_0x197698['query'][_0x962e('0x3a')]+'%'};return _0x1d471e;}})});}_0x3933da=_[_0x962e('0x3e')]({},_0x3933da,_0x197698[_0x962e('0x3f')]);var _0x450627={'where':_0x3933da[_0x962e('0x39')]};return db[_0x962e('0x40')][_0x962e('0x1c')](_0x450627)[_0x962e('0x24')](function(_0x320042){_0x67c136['count']=_0x320042;if(_0x197698[_0x962e('0x2f')]['includeAll']){_0x3933da['include']=[{'all':!![]}];}return db[_0x962e('0x40')][_0x962e('0x41')](_0x3933da);})[_0x962e('0x24')](function(_0x1e0cdf){_0x67c136[_0x962e('0x42')]=_0x1e0cdf;return _0x67c136;})[_0x962e('0x24')](respondWithFilteredResult(_0x4e739d,_0x3933da))['catch'](handleError(_0x4e739d,null));};exports[_0x962e('0x43')]=function(_0x312967,_0xb5e129){var _0xe3bed0={'raw':!![],'where':{'id':_0x312967['params']['id']}},_0x1bb19b={};_0x1bb19b['model']=_[_0x962e('0x2e')](db[_0x962e('0x40')][_0x962e('0x44')]);_0x1bb19b[_0x962e('0x2f')]=_['keys'](_0x312967[_0x962e('0x2f')]);_0x1bb19b[_0x962e('0x30')]=_[_0x962e('0x31')](_0x1bb19b[_0x962e('0x2d')],_0x1bb19b[_0x962e('0x2f')]);_0xe3bed0['attributes']=_['intersection'](_0x1bb19b['model'],qs[_0x962e('0x32')](_0x312967['query'][_0x962e('0x32')]));_0xe3bed0[_0x962e('0x33')]=_0xe3bed0[_0x962e('0x33')][_0x962e('0x34')]?_0xe3bed0[_0x962e('0x33')]:_0x1bb19b[_0x962e('0x2d')];if(_0x312967[_0x962e('0x2f')][_0x962e('0x45')]){_0xe3bed0[_0x962e('0x46')]=[{'all':!![]}];}_0xe3bed0=_['merge']({},_0xe3bed0,_0x312967[_0x962e('0x3f')]);return db[_0x962e('0x40')]['find'](_0xe3bed0)[_0x962e('0x24')](handleEntityNotFound(_0xb5e129,null))[_0x962e('0x24')](respondWithResult(_0xb5e129,null))[_0x962e('0x47')](handleError(_0xb5e129,null));};exports[_0x962e('0x48')]=function(_0x2890a8,_0x1ea2bb){return db[_0x962e('0x40')][_0x962e('0x48')](_0x2890a8[_0x962e('0x49')],{})[_0x962e('0x24')](function(_0x378f1f){var _0x2c7c41=_0x2890a8[_0x962e('0x4a')][_0x962e('0x26')]({'plain':!![]});if(!_0x2c7c41)throw new Error(_0x962e('0x4b'));if(_0x2c7c41[_0x962e('0x4c')]==='user'){var _0x52a00b=_0x378f1f[_0x962e('0x26')]({'plain':!![]});var _0x308ff7='Dispositions';return db[_0x962e('0x4d')]['find']({'where':{'name':_0x308ff7,'userProfileId':_0x2c7c41[_0x962e('0x4e')]},'raw':!![]})['then'](function(_0x2503bf){if(_0x2503bf&&_0x2503bf[_0x962e('0x4f')]===0x0){return db[_0x962e('0x50')][_0x962e('0x48')]({'name':_0x52a00b[_0x962e('0x2a')],'resourceId':_0x52a00b['id'],'type':_0x2503bf[_0x962e('0x2a')],'sectionId':_0x2503bf['id']},{})[_0x962e('0x24')](function(){return _0x378f1f;});}else{return _0x378f1f;}})['catch'](function(_0xf71065){logger[_0x962e('0x51')](_0x962e('0x52'),_0xf71065);throw _0xf71065;});}return _0x378f1f;})[_0x962e('0x24')](respondWithResult(_0x1ea2bb,0xc9))[_0x962e('0x47')](handleError(_0x1ea2bb,null));};exports[_0x962e('0x23')]=function(_0x5c6dfc,_0x45c0e3){if(_0x5c6dfc[_0x962e('0x49')]['id']){delete _0x5c6dfc[_0x962e('0x49')]['id'];}return db[_0x962e('0x40')][_0x962e('0x53')]({'where':{'id':_0x5c6dfc[_0x962e('0x54')]['id']}})[_0x962e('0x24')](handleEntityNotFound(_0x45c0e3,null))['then'](saveUpdates(_0x5c6dfc[_0x962e('0x49')],null))[_0x962e('0x24')](respondWithResult(_0x45c0e3,null))[_0x962e('0x47')](handleError(_0x45c0e3,null));};exports[_0x962e('0x25')]=function(_0x1b7bdb,_0x16212f){return db['Disposition'][_0x962e('0x53')]({'where':{'id':_0x1b7bdb[_0x962e('0x54')]['id']}})[_0x962e('0x24')](handleEntityNotFound(_0x16212f,null))[_0x962e('0x24')](removeEntity(_0x16212f,null))[_0x962e('0x47')](handleError(_0x16212f,null));}; \ No newline at end of file +var _0xf481=['to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','Disposition','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','options','count','include','findAll','rows','catch','show','params','find','create','body','user','role','Dispositions','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0xf481,0x18a));var _0x1f48=function(_0x3ec0e8,_0x485a9d){_0x3ec0e8=_0x3ec0e8-0x0;var _0x26fd54=_0xf481[_0x3ec0e8];return _0x26fd54;};'use strict';var pdf=require(_0x1f48('0x0'));var emlformat=require(_0x1f48('0x1'));var rimraf=require(_0x1f48('0x2'));var zipdir=require(_0x1f48('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f48('0x4'));var moment=require(_0x1f48('0x5'));var BPromise=require(_0x1f48('0x6'));var Mustache=require(_0x1f48('0x7'));var util=require(_0x1f48('0x8'));var path=require(_0x1f48('0x9'));var sox=require(_0x1f48('0xa'));var csv=require(_0x1f48('0xb'));var ejs=require(_0x1f48('0xc'));var fs=require('fs');var _=require(_0x1f48('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1f48('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1f48('0xb'));var querystring=require(_0x1f48('0xf'));var Papa=require(_0x1f48('0x10'));var authService=require(_0x1f48('0x11'));var hardwareService=require(_0x1f48('0x12'));var Redis=require(_0x1f48('0x13'));var qs=require(_0x1f48('0x14'));var logger=require(_0x1f48('0x15'))(_0x1f48('0x16'));var utils=require(_0x1f48('0x17'));var config=require(_0x1f48('0x18'));var db=require(_0x1f48('0x19'))['db'];function respondWithStatusCode(_0x17f65b,_0x2ce267){_0x2ce267=_0x2ce267||0xcc;return function(_0x413005){if(_0x413005){return _0x17f65b[_0x1f48('0x1a')](_0x2ce267);}return _0x17f65b[_0x1f48('0x1b')](_0x2ce267)['end']();};}function respondWithResult(_0x52a9aa,_0x5d96ab){_0x5d96ab=_0x5d96ab||0xc8;return function(_0x37e328){if(_0x37e328){return _0x52a9aa[_0x1f48('0x1b')](_0x5d96ab)[_0x1f48('0x1c')](_0x37e328);}};}function respondWithFilteredResult(_0xf06634,_0x2be7f8){return function(_0xdb52c8){if(_0xdb52c8){var _0xf9fe1a=_0xdb52c8['count'],_0x5129d2=_0x2be7f8[_0x1f48('0x1d')],_0x496bc4=_0x2be7f8[_0x1f48('0x1d')]+_0x2be7f8[_0x1f48('0x1e')],_0x3f00a9;if(_0x496bc4>=_0xf9fe1a){_0x496bc4=_0xf9fe1a;_0x3f00a9=0xc8;}else{_0x3f00a9=0xce;}_0xf06634['status'](_0x3f00a9);return _0xf06634[_0x1f48('0x1f')]('Content-Range',_0x5129d2+'-'+_0x496bc4+'/'+_0xf9fe1a)[_0x1f48('0x1c')](_0xdb52c8);}return null;};}function patchUpdates(_0x34d58f){return function(_0x32a5a4){try{jsonpatch['apply'](_0x32a5a4,_0x34d58f,!![]);}catch(_0x27c624){return BPromise['reject'](_0x27c624);}return _0x32a5a4[_0x1f48('0x20')]();};}function saveUpdates(_0x32c160,_0x4a07b8){return function(_0x16c8c7){if(_0x16c8c7){return _0x16c8c7[_0x1f48('0x21')](_0x32c160)[_0x1f48('0x22')](function(_0x15c022){return _0x15c022;});}return null;};}function removeEntity(_0x3ab760,_0x57ad32){return function(_0x17660e){if(_0x17660e){return _0x17660e[_0x1f48('0x23')]()[_0x1f48('0x22')](function(){var _0x568945=_0x17660e[_0x1f48('0x24')]({'plain':!![]});var _0x19b142='Dispositions';return db[_0x1f48('0x25')][_0x1f48('0x23')]({'where':{'type':_0x19b142,'resourceId':_0x568945['id']}})[_0x1f48('0x22')](function(){return _0x17660e;});})[_0x1f48('0x22')](function(){_0x3ab760[_0x1f48('0x1b')](0xcc)[_0x1f48('0x26')]();});}};}function handleEntityNotFound(_0x54296c,_0x4cf410){return function(_0x156650){if(!_0x156650){_0x54296c[_0x1f48('0x1a')](0x194);}return _0x156650;};}function handleError(_0x3d6084,_0x2bbca1){_0x2bbca1=_0x2bbca1||0x1f4;return function(_0x47ef10){logger[_0x1f48('0x27')](_0x47ef10[_0x1f48('0x28')]);if(_0x47ef10['name']){delete _0x47ef10[_0x1f48('0x29')];}_0x3d6084[_0x1f48('0x1b')](_0x2bbca1)['send'](_0x47ef10);};}exports[_0x1f48('0x2a')]=function(_0x4862d5,_0x49778c){var _0x53fce3={},_0x5d854c={},_0x5e54fb={'count':0x0,'rows':[]};var _0x40a343=db[_0x1f48('0x2b')][_0x1f48('0x2c')];_0x5d854c['model']=_[_0x1f48('0x2d')](_0x40a343);_0x5d854c[_0x1f48('0x2e')]=_[_0x1f48('0x2d')](_0x4862d5[_0x1f48('0x2e')]);_0x5d854c[_0x1f48('0x2f')]=_[_0x1f48('0x30')](_0x5d854c['model'],_0x5d854c[_0x1f48('0x2e')]);_0x53fce3['attributes']=_[_0x1f48('0x30')](_0x5d854c[_0x1f48('0x31')],qs[_0x1f48('0x32')](_0x4862d5[_0x1f48('0x2e')][_0x1f48('0x32')]));_0x53fce3[_0x1f48('0x33')]=_0x53fce3[_0x1f48('0x33')][_0x1f48('0x34')]?_0x53fce3['attributes']:_0x5d854c[_0x1f48('0x31')];if(!_0x4862d5[_0x1f48('0x2e')][_0x1f48('0x35')]('nolimit')){_0x53fce3['limit']=qs[_0x1f48('0x1e')](_0x4862d5[_0x1f48('0x2e')][_0x1f48('0x1e')]);_0x53fce3[_0x1f48('0x1d')]=qs['offset'](_0x4862d5[_0x1f48('0x2e')][_0x1f48('0x1d')]);}_0x53fce3[_0x1f48('0x36')]=qs[_0x1f48('0x37')](_0x4862d5[_0x1f48('0x2e')][_0x1f48('0x37')]);_0x53fce3[_0x1f48('0x38')]=qs[_0x1f48('0x2f')](_[_0x1f48('0x39')](_0x4862d5[_0x1f48('0x2e')],_0x5d854c[_0x1f48('0x2f')]));if(_0x4862d5[_0x1f48('0x2e')][_0x1f48('0x3a')]){_0x53fce3[_0x1f48('0x38')]=_['merge'](_0x53fce3['where'],{'$or':_[_0x1f48('0x3b')](_0x40a343,function(_0x8701ce){if(_0x8701ce[_0x1f48('0x3c')][_0x1f48('0x3d')]!==_0x1f48('0x3e')){var _0x589c6c={};_0x589c6c[_0x8701ce[_0x1f48('0x3f')]]={'$like':'%'+_0x4862d5['query'][_0x1f48('0x3a')]+'%'};return _0x589c6c;}})});}_0x53fce3=_[_0x1f48('0x40')]({},_0x53fce3,_0x4862d5[_0x1f48('0x41')]);var _0x598d2f={'where':_0x53fce3[_0x1f48('0x38')]};return db[_0x1f48('0x2b')][_0x1f48('0x42')](_0x598d2f)[_0x1f48('0x22')](function(_0x1ba50d){_0x5e54fb[_0x1f48('0x42')]=_0x1ba50d;if(_0x4862d5[_0x1f48('0x2e')]['includeAll']){_0x53fce3[_0x1f48('0x43')]=[{'all':!![]}];}return db[_0x1f48('0x2b')][_0x1f48('0x44')](_0x53fce3);})[_0x1f48('0x22')](function(_0x27e919){_0x5e54fb[_0x1f48('0x45')]=_0x27e919;return _0x5e54fb;})[_0x1f48('0x22')](respondWithFilteredResult(_0x49778c,_0x53fce3))[_0x1f48('0x46')](handleError(_0x49778c,null));};exports[_0x1f48('0x47')]=function(_0x589dd5,_0x2287e2){var _0x89bb8d={'raw':!![],'where':{'id':_0x589dd5[_0x1f48('0x48')]['id']}},_0x4ede17={};_0x4ede17[_0x1f48('0x31')]=_[_0x1f48('0x2d')](db[_0x1f48('0x2b')][_0x1f48('0x2c')]);_0x4ede17['query']=_['keys'](_0x589dd5[_0x1f48('0x2e')]);_0x4ede17[_0x1f48('0x2f')]=_[_0x1f48('0x30')](_0x4ede17[_0x1f48('0x31')],_0x4ede17[_0x1f48('0x2e')]);_0x89bb8d[_0x1f48('0x33')]=_[_0x1f48('0x30')](_0x4ede17[_0x1f48('0x31')],qs[_0x1f48('0x32')](_0x589dd5['query'][_0x1f48('0x32')]));_0x89bb8d[_0x1f48('0x33')]=_0x89bb8d[_0x1f48('0x33')]['length']?_0x89bb8d[_0x1f48('0x33')]:_0x4ede17[_0x1f48('0x31')];if(_0x589dd5[_0x1f48('0x2e')]['includeAll']){_0x89bb8d[_0x1f48('0x43')]=[{'all':!![]}];}_0x89bb8d=_[_0x1f48('0x40')]({},_0x89bb8d,_0x589dd5[_0x1f48('0x41')]);return db[_0x1f48('0x2b')][_0x1f48('0x49')](_0x89bb8d)['then'](handleEntityNotFound(_0x2287e2,null))[_0x1f48('0x22')](respondWithResult(_0x2287e2,null))[_0x1f48('0x46')](handleError(_0x2287e2,null));};exports['create']=function(_0x151ba4,_0x477bbf){return db[_0x1f48('0x2b')][_0x1f48('0x4a')](_0x151ba4[_0x1f48('0x4b')],{})[_0x1f48('0x22')](function(_0xdc98fa){var _0x25ffd1=_0x151ba4[_0x1f48('0x4c')][_0x1f48('0x24')]({'plain':!![]});if(!_0x25ffd1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25ffd1[_0x1f48('0x4d')]===_0x1f48('0x4c')){var _0x41afdd=_0xdc98fa['get']({'plain':!![]});var _0x16db2d=_0x1f48('0x4e');return db['UserProfileSection'][_0x1f48('0x49')]({'where':{'name':_0x16db2d,'userProfileId':_0x25ffd1[_0x1f48('0x4f')]},'raw':!![]})[_0x1f48('0x22')](function(_0xfcd185){if(_0xfcd185&&_0xfcd185['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x41afdd['name'],'resourceId':_0x41afdd['id'],'type':_0xfcd185[_0x1f48('0x29')],'sectionId':_0xfcd185['id']},{})[_0x1f48('0x22')](function(){return _0xdc98fa;});}else{return _0xdc98fa;}})[_0x1f48('0x46')](function(_0x1fd97f){logger[_0x1f48('0x27')](_0x1f48('0x50'),_0x1fd97f);throw _0x1fd97f;});}return _0xdc98fa;})['then'](respondWithResult(_0x477bbf,0xc9))[_0x1f48('0x46')](handleError(_0x477bbf,null));};exports[_0x1f48('0x21')]=function(_0x4ada09,_0x31f69c){if(_0x4ada09['body']['id']){delete _0x4ada09[_0x1f48('0x4b')]['id'];}return db[_0x1f48('0x2b')][_0x1f48('0x49')]({'where':{'id':_0x4ada09[_0x1f48('0x48')]['id']}})[_0x1f48('0x22')](handleEntityNotFound(_0x31f69c,null))[_0x1f48('0x22')](saveUpdates(_0x4ada09['body'],null))[_0x1f48('0x22')](respondWithResult(_0x31f69c,null))[_0x1f48('0x46')](handleError(_0x31f69c,null));};exports[_0x1f48('0x23')]=function(_0x51815f,_0x3b6c67){return db[_0x1f48('0x2b')][_0x1f48('0x49')]({'where':{'id':_0x51815f[_0x1f48('0x48')]['id']}})[_0x1f48('0x22')](handleEntityNotFound(_0x3b6c67,null))[_0x1f48('0x22')](removeEntity(_0x3b6c67,null))[_0x1f48('0x46')](handleError(_0x3b6c67,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 7c5716f..2be2e60 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 _0x1967=['moment','bluebird','request-promise','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','util','../../config/logger','api'];(function(_0x31932d,_0x3a3134){var _0x3d7b76=function(_0x49be4f){while(--_0x49be4f){_0x31932d['push'](_0x31932d['shift']());}};_0x3d7b76(++_0x3a3134);}(_0x1967,0x173));var _0x7196=function(_0x4ffe3d,_0xba8064){_0x4ffe3d=_0x4ffe3d-0x0;var _0x2691ef=_0x1967[_0x4ffe3d];return _0x2691ef;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var attributes=require(_0x7196('0x6'));module[_0x7196('0x7')]=function(_0x458ae8,_0x3ae43f){return _0x458ae8['define'](_0x7196('0x8'),attributes,{'tableName':_0x7196('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7196('0xa'),'fields':[_0x7196('0xb'),_0x7196('0xc')]},{'unique':!![],'name':_0x7196('0xd'),'fields':['name',_0x7196('0xe')]},{'unique':!![],'name':_0x7196('0xf'),'fields':[_0x7196('0xb'),_0x7196('0x10')]},{'unique':!![],'name':_0x7196('0x11'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0x7196('0x12'),'fields':[_0x7196('0xb'),_0x7196('0x13')]},{'unique':!![],'name':_0x7196('0x14'),'fields':[_0x7196('0xb'),_0x7196('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x66fa=['tools_dispositions','name_voice','name','ListId','name_mail','MailAccountId','name_fax','name_openchannel','OpenchannelAccountId','lodash','util','api','moment','bluebird','request-promise','./disposition.attributes','exports','Disposition'];(function(_0x2d14cd,_0x47e7f1){var _0x24119d=function(_0x2097dd){while(--_0x2097dd){_0x2d14cd['push'](_0x2d14cd['shift']());}};_0x24119d(++_0x47e7f1);}(_0x66fa,0x117));var _0xa66f=function(_0xd3a447,_0x38205a){_0xd3a447=_0xd3a447-0x0;var _0x358853=_0x66fa[_0xd3a447];return _0x358853;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require('../../config/logger')(_0xa66f('0x2'));var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var rp=require(_0xa66f('0x5'));var attributes=require(_0xa66f('0x6'));module[_0xa66f('0x7')]=function(_0x3f4904,_0x5ebea5){return _0x3f4904['define'](_0xa66f('0x8'),attributes,{'tableName':_0xa66f('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa66f('0xa'),'fields':[_0xa66f('0xb'),_0xa66f('0xc')]},{'unique':!![],'name':'name_chat','fields':[_0xa66f('0xb'),'ChatWebsiteId']},{'unique':!![],'name':_0xa66f('0xd'),'fields':['name',_0xa66f('0xe')]},{'unique':!![],'name':'name_sms','fields':['name','SmsAccountId']},{'unique':!![],'name':_0xa66f('0xf'),'fields':[_0xa66f('0xb'),'FaxAccountId']},{'unique':!![],'name':_0xa66f('0x10'),'fields':['name',_0xa66f('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a9f2d02..ebaee3a 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 _0xf2ca=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x9e1d73,_0xcf6479){var _0x1ba603=function(_0x689c74){while(--_0x689c74){_0x9e1d73['push'](_0x9e1d73['shift']());}};_0x1ba603(++_0xcf6479);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x6ff984,_0x52fbd1){_0x6ff984=_0x6ff984-0x0;var _0x1b8400=_0xf2ca[_0x6ff984];return _0x1b8400;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){return client[_0xaf2c('0xc')](_0x1f9531,_0x37fedd)['then'](function(_0x439ca3){logger['info'](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x58351f,'request\x20sent',JSON['stringify'](_0x439ca3));if(_0x439ca3[_0xaf2c('0x11')]){if(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x12')]===0x1f4){logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3['error']['message']);return _0x4a7397(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);return _0x3c0421(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}else{logger[_0xaf2c('0x14')](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));_0x3c0421(_0x439ca3[_0xaf2c('0x15')][_0xaf2c('0x13')]);}})[_0xaf2c('0x16')](function(_0x705d09){logger['error'](_0xaf2c('0xd'),_0x58351f,_0x705d09);_0x4a7397(_0x705d09);});});} \ No newline at end of file +var _0x85d0=['../../config/logger','rpc','jayson/promise','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3fcbc5,_0x3bbb20){var _0x305659=function(_0xa92904){while(--_0xa92904){_0x3fcbc5['push'](_0x3fcbc5['shift']());}};_0x305659(++_0x3bbb20);}(_0x85d0,0x164));var _0x085d=function(_0x42633b,_0x44e927){_0x42633b=_0x42633b-0x0;var _0x483bef=_0x85d0[_0x42633b];return _0x483bef;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x085d('0x0'));var fs=require('fs');var Redis=require(_0x085d('0x1'));var db=require(_0x085d('0x2'))['db'];var utils=require(_0x085d('0x3'));var logger=require(_0x085d('0x4'))(_0x085d('0x5'));var config=require('../../config/environment');var jayson=require(_0x085d('0x6'));var client=jayson['client'][_0x085d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9acc97,_0x2a6902,_0x4a12b7){return new BPromise(function(_0xf65d01,_0xa94124){return client[_0x085d('0x8')](_0x9acc97,_0x4a12b7)[_0x085d('0x9')](function(_0x349271){logger[_0x085d('0xa')](_0x085d('0xb'),_0x2a6902,_0x085d('0xc'));logger[_0x085d('0xd')]('Disposition,\x20%s,\x20%s,\x20%s',_0x2a6902,_0x085d('0xc'),JSON[_0x085d('0xe')](_0x349271));if(_0x349271[_0x085d('0xf')]){if(_0x349271[_0x085d('0xf')]['code']===0x1f4){logger[_0x085d('0xf')](_0x085d('0xb'),_0x2a6902,_0x349271['error'][_0x085d('0x10')]);return _0xa94124(_0x349271[_0x085d('0xf')][_0x085d('0x10')]);}logger[_0x085d('0xf')]('Disposition,\x20%s,\x20%s',_0x2a6902,_0x349271[_0x085d('0xf')][_0x085d('0x10')]);return _0xf65d01(_0x349271['error']['message']);}else{logger[_0x085d('0xa')](_0x085d('0xb'),_0x2a6902,_0x085d('0xc'));_0xf65d01(_0x349271[_0x085d('0x11')][_0x085d('0x10')]);}})['catch'](function(_0x2b29be){logger[_0x085d('0xf')](_0x085d('0xb'),_0x2a6902,_0x2b29be);_0xa94124(_0x2b29be);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 47f5169..1966b5e 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 _0xf924=['../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','multer','util','express','Router'];(function(_0x25a4b2,_0x94c0b4){var _0x488e26=function(_0x2fec82){while(--_0x2fec82){_0x25a4b2['push'](_0x25a4b2['shift']());}};_0x488e26(++_0x94c0b4);}(_0xf924,0x194));var _0x4f92=function(_0x3bd4e5,_0x33854f){_0x3bd4e5=_0x3bd4e5-0x0;var _0x2d1522=_0xf924[_0x3bd4e5];return _0x2d1522;};'use strict';var multer=require(_0x4f92('0x0'));var util=require(_0x4f92('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f92('0x2'));var router=express[_0x4f92('0x3')]();var auth=require(_0x4f92('0x4'));var interaction=require(_0x4f92('0x5'));var config=require(_0x4f92('0x6'));var controller=require(_0x4f92('0x7'));router[_0x4f92('0x8')]('/',auth[_0x4f92('0x9')](),controller[_0x4f92('0xa')]);router[_0x4f92('0x8')](_0x4f92('0xb'),auth[_0x4f92('0x9')](),controller[_0x4f92('0xc')]);router['post']('/',auth[_0x4f92('0x9')](),controller[_0x4f92('0xd')]);router['put'](_0x4f92('0xb'),auth['isAuthenticated'](),controller[_0x4f92('0xe')]);router[_0x4f92('0xf')](_0x4f92('0xb'),auth[_0x4f92('0x9')](),controller[_0x4f92('0x10')]);module['exports']=router; \ No newline at end of file +var _0x70ac=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','/:id','post','update','delete','destroy','multer'];(function(_0x54703a,_0x5ad1d9){var _0x304971=function(_0x2a87d3){while(--_0x2a87d3){_0x54703a['push'](_0x54703a['shift']());}};_0x304971(++_0x5ad1d9);}(_0x70ac,0x153));var _0xc70a=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x70ac[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0xc70a('0x0'));var util=require(_0xc70a('0x1'));var path=require(_0xc70a('0x2'));var timeout=require(_0xc70a('0x3'));var express=require(_0xc70a('0x4'));var router=express[_0xc70a('0x5')]();var auth=require(_0xc70a('0x6'));var interaction=require(_0xc70a('0x7'));var config=require(_0xc70a('0x8'));var controller=require(_0xc70a('0x9'));router['get']('/',auth[_0xc70a('0xa')](),controller[_0xc70a('0xb')]);router['get'](_0xc70a('0xc'),auth[_0xc70a('0xa')](),controller['show']);router[_0xc70a('0xd')]('/',auth[_0xc70a('0xa')](),controller['create']);router['put'](_0xc70a('0xc'),auth[_0xc70a('0xa')](),controller[_0xc70a('0xe')]);router[_0xc70a('0xf')](_0xc70a('0xc'),auth[_0xc70a('0xa')](),controller[_0xc70a('0x10')]);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 8276b83..3e7d586 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 _0x670f=['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','mandatoryDisposition','sequelize','exports','STRING','yes','localstationid','ENUM','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT'];(function(_0x85ba09,_0x17098d){var _0x76a59c=function(_0x1257eb){while(--_0x1257eb){_0x85ba09['push'](_0x85ba09['shift']());}};_0x76a59c(++_0x17098d);}(_0x670f,0x119));var _0xf670=function(_0x1e0d9d,_0x51d2be){_0x1e0d9d=_0x1e0d9d-0x0;var _0x2a6b23=_0x670f[_0x1e0d9d];return _0x2a6b23;};'use strict';var Sequelize=require(_0xf670('0x0'));module[_0xf670('0x1')]={'name':{'type':Sequelize[_0xf670('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf670('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xf670('0x3'),'no'),'defaultValue':_0xf670('0x3')},'headerinfo':{'type':Sequelize[_0xf670('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xf670('0x2')],'unique':_0xf670('0x4')},'minrate':{'type':Sequelize[_0xf670('0x5')]('2400',_0xf670('0x6'),_0xf670('0x7'),_0xf670('0x8'),_0xf670('0x9'),_0xf670('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xf670('0x5')](_0xf670('0xb'),_0xf670('0x6'),_0xf670('0x7'),_0xf670('0x8'),_0xf670('0x9'),_0xf670('0xa')),'defaultValue':_0xf670('0xa')},'modem':{'type':Sequelize[_0xf670('0x2')],'defaultValue':_0xf670('0xc')},'gateway':{'type':Sequelize[_0xf670('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf670('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf670('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf670('0x5')](_0xf670('0xe'),_0xf670('0xf'),_0xf670('0x10'),_0xf670('0x11')),'defaultValue':_0xf670('0xe')},'key':{'type':Sequelize[_0xf670('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf670('0x12')],'defaultValue':function(){return _0xf670('0x13');}},'notificationSound':{'type':Sequelize[_0xf670('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf670('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf670('0xd')],'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[_0xf670('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xf670('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xf670('0x14')],'defaultValue':![],'comment':_0xf670('0x16'),'set':function(_0x217fd2){if(!_0x217fd2)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xf670('0x17')](_0xf670('0x18'),_0x217fd2);}}}; \ No newline at end of file +var _0xc9ed=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','14400','2400','INTEGER','SIP','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','exports','STRING'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xc9ed,0x19b));var _0xdc9e=function(_0x29a753,_0x5ce67d){_0x29a753=_0x29a753-0x0;var _0x5d78c7=_0xc9ed[_0x29a753];return _0x5d78c7;};'use strict';var Sequelize=require(_0xdc9e('0x0'));module[_0xdc9e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdc9e('0x2')]},'ecm':{'type':Sequelize[_0xdc9e('0x3')](_0xdc9e('0x4'),'no'),'defaultValue':_0xdc9e('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xdc9e('0x5')},'localstationid':{'type':Sequelize[_0xdc9e('0x2')],'unique':_0xdc9e('0x6')},'minrate':{'type':Sequelize['ENUM']('2400',_0xdc9e('0x7'),_0xdc9e('0x8'),_0xdc9e('0x9'),_0xdc9e('0xa'),_0xdc9e('0xb')),'defaultValue':_0xdc9e('0x7')},'maxrate':{'type':Sequelize[_0xdc9e('0x3')](_0xdc9e('0xc'),_0xdc9e('0x7'),_0xdc9e('0x8'),_0xdc9e('0x9'),_0xdc9e('0xa'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xdc9e('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xdc9e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xdc9e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xdc9e('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xdc9e('0xe'),'IAX',_0xdc9e('0xf'),_0xdc9e('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xdc9e('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdc9e('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdc9e('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdc9e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdc9e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdc9e('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdc9e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc9e('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xdc9e('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xdc9e('0x12')],'defaultValue':![],'comment':_0xdc9e('0x14'),'set':function(_0x4523f1){if(!_0x4523f1)this['setDataValue'](_0xdc9e('0x15'),null);this[_0xdc9e('0x16')]('mandatoryDisposition',_0x4523f1);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index bf0025b..d367449 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 _0x05bc=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','FaxAccounts','stack','name','send','index','Pause','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','map','type','key','includeAll','include','FaxAccount','findAll','show','params','mandatoryDispositionPause','merge','options','find','create','body','get','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','getDispositions','findOne','Disposition','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils'];(function(_0x26cb01,_0x3ab8a7){var _0xe49a17=function(_0x2cd573){while(--_0x2cd573){_0x26cb01['push'](_0x26cb01['shift']());}};_0xe49a17(++_0x3ab8a7);}(_0x05bc,0x172));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc05b('0x0'));var emlformat=require(_0xc05b('0x1'));var rimraf=require(_0xc05b('0x2'));var zipdir=require(_0xc05b('0x3'));var jsonpatch=require(_0xc05b('0x4'));var rp=require(_0xc05b('0x5'));var moment=require(_0xc05b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc05b('0x7'));var util=require(_0xc05b('0x8'));var path=require(_0xc05b('0x9'));var sox=require(_0xc05b('0xa'));var csv=require(_0xc05b('0xb'));var ejs=require(_0xc05b('0xc'));var fs=require('fs');var _=require(_0xc05b('0xd'));var squel=require(_0xc05b('0xe'));var crypto=require(_0xc05b('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc05b('0xb'));var querystring=require(_0xc05b('0x10'));var Papa=require(_0xc05b('0x11'));var authService=require(_0xc05b('0x12'));var hardwareService=require(_0xc05b('0x13'));var Redis=require(_0xc05b('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0xc05b('0x15'))(_0xc05b('0x16'));var utils=require(_0xc05b('0x17'));var config=require(_0xc05b('0x18'));var db=require(_0xc05b('0x19'))['db'];config[_0xc05b('0x1a')]=_[_0xc05b('0x1b')](config['redis'],{'host':_0xc05b('0x1c'),'port':0x18eb});var socket=require(_0xc05b('0x1d'))(new Redis(config[_0xc05b('0x1a')]));require(_0xc05b('0x1e'))[_0xc05b('0x1f')](socket);var jayson=require(_0xc05b('0x20'));var client=jayson['client'][_0xc05b('0x21')]({'port':0x232c});var client9002=jayson[_0xc05b('0x22')][_0xc05b('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5b3aab,_0x173822,_0x4f2bbb,_0x1f7d0e){return new BPromise(function(_0x438a8c,_0x14d158){var _0x2a13d2=_0x1f7d0e||client;return _0x2a13d2[_0xc05b('0x23')](_0x5b3aab,_0x4f2bbb)['then'](function(_0x274b6d){logger[_0xc05b('0x24')](_0xc05b('0x25'),_0x173822,_0xc05b('0x26'));logger['debug'](_0xc05b('0x27'),_0x173822,_0xc05b('0x26'),JSON[_0xc05b('0x28')](_0x274b6d));if(_0x274b6d[_0xc05b('0x29')]){if(_0x274b6d[_0xc05b('0x29')][_0xc05b('0x2a')]===0x1f4){logger[_0xc05b('0x29')](_0xc05b('0x25'),_0x173822,_0x274b6d[_0xc05b('0x29')]['message']);return _0x14d158(_0x274b6d[_0xc05b('0x29')][_0xc05b('0x2b')]);}logger[_0xc05b('0x29')]('FaxAccount,\x20%s,\x20%s',_0x173822,_0x274b6d[_0xc05b('0x29')]['message']);return _0x438a8c(_0x274b6d[_0xc05b('0x29')][_0xc05b('0x2b')]);}else{logger[_0xc05b('0x24')](_0xc05b('0x25'),_0x173822,_0xc05b('0x26'));_0x438a8c(_0x274b6d[_0xc05b('0x2c')][_0xc05b('0x2b')]);}})[_0xc05b('0x2d')](function(_0xbd26dc){logger[_0xc05b('0x29')]('FaxAccount,\x20%s,\x20%s',_0x173822,_0xbd26dc);_0x14d158(_0xbd26dc);});});}function respondWithStatusCode(_0x105cc8,_0x162d74){_0x162d74=_0x162d74||0xcc;return function(_0x2a8d74){if(_0x2a8d74){return _0x105cc8[_0xc05b('0x2e')](_0x162d74);}return _0x105cc8['status'](_0x162d74)[_0xc05b('0x2f')]();};}function respondWithResult(_0x3633e2,_0x2b5425){_0x2b5425=_0x2b5425||0xc8;return function(_0x3da0bb){if(_0x3da0bb){return _0x3633e2['status'](_0x2b5425)[_0xc05b('0x30')](_0x3da0bb);}};}function respondWithFilteredResult(_0x1d7753,_0x53f429){return function(_0xfe5875){if(_0xfe5875){var _0x45a020=_0xfe5875[_0xc05b('0x31')],_0x41c2b8=_0x53f429[_0xc05b('0x32')],_0x331b02=_0x53f429['offset']+_0x53f429[_0xc05b('0x33')],_0x38f16c;if(_0x331b02>=_0x45a020){_0x331b02=_0x45a020;_0x38f16c=0xc8;}else{_0x38f16c=0xce;}_0x1d7753[_0xc05b('0x34')](_0x38f16c);return _0x1d7753[_0xc05b('0x35')](_0xc05b('0x36'),_0x41c2b8+'-'+_0x331b02+'/'+_0x45a020)[_0xc05b('0x30')](_0xfe5875);}return null;};}function patchUpdates(_0x2c3340){return function(_0x805b98){try{jsonpatch[_0xc05b('0x37')](_0x805b98,_0x2c3340,!![]);}catch(_0x59f0d4){return BPromise['reject'](_0x59f0d4);}return _0x805b98[_0xc05b('0x38')]();};}function saveUpdates(_0x431ebd,_0x2e7d12){return function(_0x3790da){if(_0x3790da){return _0x3790da[_0xc05b('0x39')](_0x431ebd)[_0xc05b('0x3a')](function(_0x52d79b){return _0x52d79b;});}return null;};}function removeEntity(_0x1127ce,_0x588cb4){return function(_0x318060){if(_0x318060){return _0x318060[_0xc05b('0x3b')]()[_0xc05b('0x3a')](function(){var _0x3eda51=_0x318060['get']({'plain':!![]});var _0x1b9d97=_0xc05b('0x3c');return db['UserProfileResource'][_0xc05b('0x3b')]({'where':{'type':_0x1b9d97,'resourceId':_0x3eda51['id']}})[_0xc05b('0x3a')](function(){return _0x318060;});})[_0xc05b('0x3a')](function(){_0x1127ce[_0xc05b('0x34')](0xcc)[_0xc05b('0x2f')]();});}};}function handleEntityNotFound(_0x2d7ccb,_0x2472a7){return function(_0x2a767a){if(!_0x2a767a){_0x2d7ccb[_0xc05b('0x2e')](0x194);}return _0x2a767a;};}function handleError(_0x24691a,_0x2bd800){_0x2bd800=_0x2bd800||0x1f4;return function(_0x88d35c){logger['error'](_0x88d35c[_0xc05b('0x3d')]);if(_0x88d35c[_0xc05b('0x3e')]){delete _0x88d35c['name'];}_0x24691a[_0xc05b('0x34')](_0x2bd800)[_0xc05b('0x3f')](_0x88d35c);};}exports[_0xc05b('0x40')]=function(_0x4ba6b6,_0x3f6d9f){var _0x4885b5={'include':[{'model':db[_0xc05b('0x41')],'as':'mandatoryDispositionPause'}]},_0x41c54e={},_0x514a2c={'count':0x0,'rows':[]};var _0x21f562=db['FaxAccount'][_0xc05b('0x42')];_0x41c54e[_0xc05b('0x43')]=_[_0xc05b('0x44')](_0x21f562);_0x41c54e[_0xc05b('0x45')]=_['keys'](_0x4ba6b6[_0xc05b('0x45')]);_0x41c54e['filters']=_[_0xc05b('0x46')](_0x41c54e[_0xc05b('0x43')],_0x41c54e['query']);_0x4885b5[_0xc05b('0x47')]=_[_0xc05b('0x46')](_0x41c54e['model'],qs['fields'](_0x4ba6b6[_0xc05b('0x45')][_0xc05b('0x48')]));_0x4885b5[_0xc05b('0x47')]=_0x4885b5['attributes'][_0xc05b('0x49')]?_0x4885b5['attributes']:_0x41c54e[_0xc05b('0x43')];if(!_0x4ba6b6['query'][_0xc05b('0x4a')](_0xc05b('0x4b'))){_0x4885b5['limit']=qs['limit'](_0x4ba6b6[_0xc05b('0x45')]['limit']);_0x4885b5[_0xc05b('0x32')]=qs[_0xc05b('0x32')](_0x4ba6b6['query'][_0xc05b('0x32')]);}_0x4885b5[_0xc05b('0x4c')]=qs[_0xc05b('0x4d')](_0x4ba6b6[_0xc05b('0x45')]['sort']);_0x4885b5['where']=qs[_0xc05b('0x4e')](_['pick'](_0x4ba6b6[_0xc05b('0x45')],_0x41c54e[_0xc05b('0x4e')]));if(_0x4ba6b6['query'][_0xc05b('0x4f')]){_0x4885b5[_0xc05b('0x50')]=_['merge'](_0x4885b5[_0xc05b('0x50')],{'$or':_[_0xc05b('0x51')](_0x21f562,function(_0x971bdd){if(_0x971bdd[_0xc05b('0x52')][_0xc05b('0x53')]!=='VIRTUAL'){var _0x3a2c64={};_0x3a2c64[_0x971bdd['field']]={'$like':'%'+_0x4ba6b6[_0xc05b('0x45')][_0xc05b('0x4f')]+'%'};return _0x3a2c64;}})});}_0x4885b5=_['merge']({},_0x4885b5,_0x4ba6b6['options']);var _0x311a74={'where':_0x4885b5['where']};return db['FaxAccount'][_0xc05b('0x31')](_0x311a74)[_0xc05b('0x3a')](function(_0xdf2bf6){_0x514a2c['count']=_0xdf2bf6;if(_0x4ba6b6[_0xc05b('0x45')][_0xc05b('0x54')]){_0x4885b5[_0xc05b('0x55')]=[{'all':!![]}];}return db[_0xc05b('0x56')][_0xc05b('0x57')](_0x4885b5);})[_0xc05b('0x3a')](function(_0x59dee0){_0x514a2c['rows']=_0x59dee0;return _0x514a2c;})[_0xc05b('0x3a')](respondWithFilteredResult(_0x3f6d9f,_0x4885b5))[_0xc05b('0x2d')](handleError(_0x3f6d9f,null));};exports[_0xc05b('0x58')]=function(_0x4dd00d,_0x5866b1){var _0x42fb43={'raw':![],'where':{'id':_0x4dd00d[_0xc05b('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xc05b('0x5a')}]},_0x12c2eb={};_0x12c2eb['model']=_[_0xc05b('0x44')](db[_0xc05b('0x56')]['rawAttributes']);_0x12c2eb[_0xc05b('0x45')]=_[_0xc05b('0x44')](_0x4dd00d['query']);_0x12c2eb['filters']=_['intersection'](_0x12c2eb[_0xc05b('0x43')],_0x12c2eb[_0xc05b('0x45')]);_0x42fb43[_0xc05b('0x47')]=_[_0xc05b('0x46')](_0x12c2eb[_0xc05b('0x43')],qs[_0xc05b('0x48')](_0x4dd00d['query'][_0xc05b('0x48')]));_0x42fb43[_0xc05b('0x47')]=_0x42fb43[_0xc05b('0x47')][_0xc05b('0x49')]?_0x42fb43[_0xc05b('0x47')]:_0x12c2eb[_0xc05b('0x43')];if(_0x4dd00d[_0xc05b('0x45')]['includeAll']){_0x42fb43[_0xc05b('0x55')]=[{'all':!![]}];}_0x42fb43=_[_0xc05b('0x5b')]({},_0x42fb43,_0x4dd00d[_0xc05b('0x5c')]);return db['FaxAccount'][_0xc05b('0x5d')](_0x42fb43)[_0xc05b('0x3a')](handleEntityNotFound(_0x5866b1,null))[_0xc05b('0x3a')](respondWithResult(_0x5866b1,null))[_0xc05b('0x2d')](handleError(_0x5866b1,null));};exports[_0xc05b('0x5e')]=function(_0x2a82fb,_0x182f62){return db[_0xc05b('0x56')][_0xc05b('0x5e')](_0x2a82fb[_0xc05b('0x5f')],{})[_0xc05b('0x3a')](function(_0x391464){var _0x107306=_0x2a82fb['user'][_0xc05b('0x60')]({'plain':!![]});if(!_0x107306)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x107306[_0xc05b('0x61')]===_0xc05b('0x62')){var _0x48f802=_0x391464[_0xc05b('0x60')]({'plain':!![]});var _0x41e9a4=_0xc05b('0x3c');return db['UserProfileSection'][_0xc05b('0x5d')]({'where':{'name':_0x41e9a4,'userProfileId':_0x107306[_0xc05b('0x63')]},'raw':!![]})[_0xc05b('0x3a')](function(_0x5de9cf){if(_0x5de9cf&&_0x5de9cf[_0xc05b('0x64')]===0x0){return db[_0xc05b('0x65')][_0xc05b('0x5e')]({'name':_0x48f802[_0xc05b('0x3e')],'resourceId':_0x48f802['id'],'type':_0x5de9cf[_0xc05b('0x3e')],'sectionId':_0x5de9cf['id']},{})[_0xc05b('0x3a')](function(){return _0x391464;});}else{return _0x391464;}})['catch'](function(_0x3c2f8c){logger[_0xc05b('0x29')](_0xc05b('0x66'),_0x3c2f8c);throw _0x3c2f8c;});}return _0x391464;})['then'](respondWithResult(_0x182f62,0xc9))[_0xc05b('0x2d')](handleError(_0x182f62,null));};exports[_0xc05b('0x39')]=function(_0x3c894b,_0x309cda){if(_0x3c894b[_0xc05b('0x5f')]['id']){delete _0x3c894b[_0xc05b('0x5f')]['id'];}return db[_0xc05b('0x56')][_0xc05b('0x5d')]({'where':{'id':_0x3c894b[_0xc05b('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xc05b('0x5a')}]})[_0xc05b('0x3a')](handleEntityNotFound(_0x309cda,null))['then'](saveUpdates(_0x3c894b[_0xc05b('0x5f')],null))[_0xc05b('0x3a')](respondWithResult(_0x309cda,null))[_0xc05b('0x2d')](handleError(_0x309cda,null));};exports[_0xc05b('0x3b')]=function(_0x42ea11,_0x59d48f){return db[_0xc05b('0x56')][_0xc05b('0x5d')]({'where':{'id':_0x42ea11[_0xc05b('0x59')]['id']}})['then'](handleEntityNotFound(_0x59d48f,null))[_0xc05b('0x3a')](removeEntity(_0x59d48f,null))[_0xc05b('0x2d')](handleError(_0x59d48f,null));};exports[_0xc05b('0x67')]=function(_0x111a47,_0x12f58c){return db[_0xc05b('0x56')][_0xc05b('0x67')]()['then'](respondWithResult(_0x12f58c,null))[_0xc05b('0x2d')](handleError(_0x12f58c,null));};exports['addDisposition']=function(_0x280a5f,_0x510f79,_0x5202d8){if(_0x280a5f[_0xc05b('0x5f')]['id']){delete _0x280a5f[_0xc05b('0x5f')]['id'];}return db['FaxAccount'][_0xc05b('0x5d')]({'where':{'id':_0x280a5f[_0xc05b('0x59')]['id']}})[_0xc05b('0x3a')](handleEntityNotFound(_0x510f79,null))[_0xc05b('0x3a')](function(_0x4880c9){if(_0x4880c9){_0x280a5f['body'][_0xc05b('0x68')]=_0x4880c9['id'];return db['Disposition'][_0xc05b('0x5e')](_0x280a5f[_0xc05b('0x5f')]);}})[_0xc05b('0x3a')](respondWithResult(_0x510f79,null))['catch'](handleError(_0x510f79,null));};exports[_0xc05b('0x69')]=function(_0x58f284,_0x824383,_0x419d63){var _0xd20e69={'raw':![],'where':{}};var _0xfcd2f7={};var _0x4f6732={'count':0x0,'rows':[]};return db[_0xc05b('0x56')][_0xc05b('0x6a')]({'where':{'id':_0x58f284['params']['id']}})[_0xc05b('0x3a')](handleEntityNotFound(_0x824383,null))['then'](function(_0x5daecf){if(_0x5daecf){_0xfcd2f7['model']=_['keys'](db[_0xc05b('0x6b')][_0xc05b('0x42')]);_0xfcd2f7['query']=_[_0xc05b('0x44')](_0x58f284[_0xc05b('0x45')]);_0xfcd2f7[_0xc05b('0x4e')]=_[_0xc05b('0x46')](_0xfcd2f7['model'],_0xfcd2f7[_0xc05b('0x45')]);_0xd20e69[_0xc05b('0x47')]=_[_0xc05b('0x46')](_0xfcd2f7[_0xc05b('0x43')],qs['fields'](_0x58f284['query'][_0xc05b('0x48')]));_0xd20e69[_0xc05b('0x47')]=_0xd20e69[_0xc05b('0x47')][_0xc05b('0x49')]?_0xd20e69[_0xc05b('0x47')]:_0xfcd2f7[_0xc05b('0x43')];if(!_0x58f284[_0xc05b('0x45')][_0xc05b('0x4a')](_0xc05b('0x4b'))){_0xd20e69[_0xc05b('0x33')]=qs[_0xc05b('0x33')](_0x58f284['query'][_0xc05b('0x33')]);_0xd20e69[_0xc05b('0x32')]=qs['offset'](_0x58f284['query'][_0xc05b('0x32')]);}_0xd20e69[_0xc05b('0x4c')]=qs[_0xc05b('0x4d')](_0x58f284[_0xc05b('0x45')]['sort']);_0xd20e69['where']=qs[_0xc05b('0x4e')](_[_0xc05b('0x6c')](_0x58f284[_0xc05b('0x45')],_0xfcd2f7[_0xc05b('0x4e')]));_0xd20e69[_0xc05b('0x50')][_0xc05b('0x68')]=_0x5daecf['id'];if(_0x58f284[_0xc05b('0x45')]['filter']){_0xd20e69[_0xc05b('0x50')]=_[_0xc05b('0x5b')](_0xd20e69[_0xc05b('0x50')],{'$or':_[_0xc05b('0x51')](_0xd20e69[_0xc05b('0x47')],function(_0x1a4b73){var _0x294180={};_0x294180[_0x1a4b73]={'$like':'%'+_0x58f284['query']['filter']+'%'};return _0x294180;})});}_0xd20e69=_['merge']({},_0xd20e69,_0x58f284['options']);return db[_0xc05b('0x6b')][_0xc05b('0x31')]({'where':_0xd20e69[_0xc05b('0x50')]})['then'](function(_0x2034a5){_0x4f6732[_0xc05b('0x31')]=_0x2034a5;if(_0x58f284[_0xc05b('0x45')][_0xc05b('0x54')]){_0xd20e69['include']=[{'all':!![]}];}return db[_0xc05b('0x6b')][_0xc05b('0x57')](_0xd20e69);})[_0xc05b('0x3a')](function(_0x4f8fd4){_0x4f6732[_0xc05b('0x6d')]=_0x4f8fd4;return _0x4f6732;});}})[_0xc05b('0x3a')](respondWithFilteredResult(_0x824383,_0xd20e69))[_0xc05b('0x2d')](handleError(_0x824383,null));};exports['removeDispositions']=function(_0x51637e,_0x182e22,_0x2d324e){var _0x5a90e9;return db[_0xc05b('0x56')][_0xc05b('0x5d')]({'where':{'id':_0x51637e['params']['id']}})['then'](handleEntityNotFound(_0x182e22,null))[_0xc05b('0x3a')](function(_0x58fdd8){if(_0x58fdd8){return _0x58fdd8[_0xc05b('0x6e')](_0x51637e[_0xc05b('0x45')][_0xc05b('0x6f')]);}})['then'](respondWithStatusCode(_0x182e22,null))[_0xc05b('0x2d')](handleError(_0x182e22,null));};exports[_0xc05b('0x70')]=function(_0x15ce26,_0x249dc5,_0x530c43){if(_0x15ce26[_0xc05b('0x5f')]['id']){delete _0x15ce26[_0xc05b('0x5f')]['id'];}return db['FaxAccount'][_0xc05b('0x5d')]({'where':{'id':_0x15ce26[_0xc05b('0x59')]['id']}})['then'](handleEntityNotFound(_0x249dc5,null))[_0xc05b('0x3a')](function(_0x420be4){if(_0x420be4){_0x15ce26[_0xc05b('0x5f')][_0xc05b('0x68')]=_0x420be4['id'];return db[_0xc05b('0x71')]['create'](_0x15ce26[_0xc05b('0x5f')]);}})[_0xc05b('0x3a')](respondWithResult(_0x249dc5,null))[_0xc05b('0x2d')](handleError(_0x249dc5,null));};exports['getAnswers']=function(_0x18a556,_0x3f9f2b,_0xdc13f){var _0x4c0e40={'raw':![],'where':{}};var _0x4becc0={};var _0x356fdb={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc05b('0x6a')]({'where':{'id':_0x18a556['params']['id']}})[_0xc05b('0x3a')](handleEntityNotFound(_0x3f9f2b,null))['then'](function(_0x19c422){if(_0x19c422){_0x4becc0[_0xc05b('0x43')]=_[_0xc05b('0x44')](db[_0xc05b('0x71')][_0xc05b('0x42')]);_0x4becc0[_0xc05b('0x45')]=_[_0xc05b('0x44')](_0x18a556[_0xc05b('0x45')]);_0x4becc0[_0xc05b('0x4e')]=_[_0xc05b('0x46')](_0x4becc0[_0xc05b('0x43')],_0x4becc0[_0xc05b('0x45')]);_0x4c0e40[_0xc05b('0x47')]=_[_0xc05b('0x46')](_0x4becc0[_0xc05b('0x43')],qs[_0xc05b('0x48')](_0x18a556[_0xc05b('0x45')]['fields']));_0x4c0e40[_0xc05b('0x47')]=_0x4c0e40[_0xc05b('0x47')][_0xc05b('0x49')]?_0x4c0e40[_0xc05b('0x47')]:_0x4becc0[_0xc05b('0x43')];if(!_0x18a556[_0xc05b('0x45')][_0xc05b('0x4a')]('nolimit')){_0x4c0e40['limit']=qs['limit'](_0x18a556[_0xc05b('0x45')]['limit']);_0x4c0e40[_0xc05b('0x32')]=qs[_0xc05b('0x32')](_0x18a556['query']['offset']);}_0x4c0e40[_0xc05b('0x4c')]=qs['sort'](_0x18a556['query']['sort']);_0x4c0e40[_0xc05b('0x50')]=qs[_0xc05b('0x4e')](_[_0xc05b('0x6c')](_0x18a556[_0xc05b('0x45')],_0x4becc0['filters']));_0x4c0e40[_0xc05b('0x50')]['FaxAccountId']=_0x19c422['id'];if(_0x18a556[_0xc05b('0x45')][_0xc05b('0x4f')]){_0x4c0e40[_0xc05b('0x50')]=_[_0xc05b('0x5b')](_0x4c0e40[_0xc05b('0x50')],{'$or':_[_0xc05b('0x51')](_0x4c0e40[_0xc05b('0x47')],function(_0x2144fe){var _0x1d835c={};_0x1d835c[_0x2144fe]={'$like':'%'+_0x18a556[_0xc05b('0x45')]['filter']+'%'};return _0x1d835c;})});}_0x4c0e40=_['merge']({},_0x4c0e40,_0x18a556[_0xc05b('0x5c')]);return db[_0xc05b('0x71')]['count']({'where':_0x4c0e40[_0xc05b('0x50')]})[_0xc05b('0x3a')](function(_0xe4d2ef){_0x356fdb[_0xc05b('0x31')]=_0xe4d2ef;if(_0x18a556[_0xc05b('0x45')][_0xc05b('0x54')]){_0x4c0e40[_0xc05b('0x55')]=[{'all':!![]}];}return db[_0xc05b('0x71')]['findAll'](_0x4c0e40);})[_0xc05b('0x3a')](function(_0x46a05c){_0x356fdb['rows']=_0x46a05c;return _0x356fdb;});}})[_0xc05b('0x3a')](respondWithFilteredResult(_0x3f9f2b,_0x4c0e40))[_0xc05b('0x2d')](handleError(_0x3f9f2b,null));};exports[_0xc05b('0x72')]=function(_0x27a1cd,_0x180b3f,_0x1b2c6b){var _0x4ea20e;return db['FaxAccount'][_0xc05b('0x5d')]({'where':{'id':_0x27a1cd[_0xc05b('0x59')]['id']}})[_0xc05b('0x3a')](handleEntityNotFound(_0x180b3f,null))[_0xc05b('0x3a')](function(_0x39ad8a){if(_0x39ad8a){return _0x39ad8a[_0xc05b('0x72')](_0x27a1cd[_0xc05b('0x45')][_0xc05b('0x6f')]);}})[_0xc05b('0x3a')](respondWithStatusCode(_0x180b3f,null))[_0xc05b('0x2d')](handleError(_0x180b3f,null));};exports[_0xc05b('0x73')]=function(_0x333c7b,_0x3bb98e,_0x5d335b){return db['FaxInteraction'][_0xc05b('0x5d')]({'where':{'id':_0x333c7b[_0xc05b('0x59')]['id']}})[_0xc05b('0x3a')](handleEntityNotFound(_0x3bb98e,null))[_0xc05b('0x3a')](function(_0x551229){if(_0x551229){return _0x551229[_0xc05b('0x73')](_0x333c7b['body'][_0xc05b('0x6f')],_[_0xc05b('0x74')](_0x333c7b[_0xc05b('0x5f')],[_0xc05b('0x6f'),'id'])||{});}})[_0xc05b('0x3a')](respondWithResult(_0x3bb98e,null))[_0xc05b('0x2d')](handleError(_0x3bb98e,null));};exports[_0xc05b('0x75')]=function(_0x2d8aca,_0x67ada1,_0x4a998f){var _0x25e310={'raw':![],'where':{}};var _0x59026a={};var _0x4ed488={'count':0x0,'rows':[]};return db[_0xc05b('0x56')][_0xc05b('0x6a')]({'where':{'id':_0x2d8aca[_0xc05b('0x59')]['id']}})[_0xc05b('0x3a')](handleEntityNotFound(_0x67ada1,null))[_0xc05b('0x3a')](function(_0x260fdd){if(_0x260fdd){_0x59026a['model']=_[_0xc05b('0x44')](db[_0xc05b('0x76')][_0xc05b('0x42')]);_0x59026a['query']=_[_0xc05b('0x44')](_0x2d8aca[_0xc05b('0x45')]);_0x59026a['filters']=_[_0xc05b('0x46')](_0x59026a[_0xc05b('0x43')],_0x59026a[_0xc05b('0x45')]);_0x25e310[_0xc05b('0x47')]=_[_0xc05b('0x46')](_0x59026a['model'],qs[_0xc05b('0x48')](_0x2d8aca[_0xc05b('0x45')][_0xc05b('0x48')]));_0x25e310[_0xc05b('0x47')]=_0x25e310[_0xc05b('0x47')][_0xc05b('0x49')]?_0x25e310[_0xc05b('0x47')]:_0x59026a[_0xc05b('0x43')];if(!_0x2d8aca[_0xc05b('0x45')][_0xc05b('0x4a')](_0xc05b('0x4b'))){_0x25e310[_0xc05b('0x33')]=qs[_0xc05b('0x33')](_0x2d8aca[_0xc05b('0x45')][_0xc05b('0x33')]);_0x25e310[_0xc05b('0x32')]=qs[_0xc05b('0x32')](_0x2d8aca['query'][_0xc05b('0x32')]);}_0x25e310[_0xc05b('0x4c')]=qs['sort'](_0x2d8aca[_0xc05b('0x45')][_0xc05b('0x4d')]);_0x25e310[_0xc05b('0x50')]=qs[_0xc05b('0x4e')](_[_0xc05b('0x6c')](_0x2d8aca[_0xc05b('0x45')],_0x59026a[_0xc05b('0x4e')]));_0x25e310[_0xc05b('0x50')][_0xc05b('0x68')]=_0x260fdd['id'];if(_0x2d8aca['query'][_0xc05b('0x4f')]){_0x25e310[_0xc05b('0x50')]=_[_0xc05b('0x5b')](_0x25e310[_0xc05b('0x50')],{'$or':_[_0xc05b('0x51')](_0x25e310['attributes'],function(_0xe50f6){var _0x236f54={};_0x236f54[_0xe50f6]={'$like':'%'+_0x2d8aca[_0xc05b('0x45')][_0xc05b('0x4f')]+'%'};return _0x236f54;})});}_0x25e310=_[_0xc05b('0x5b')]({},_0x25e310,_0x2d8aca[_0xc05b('0x5c')]);return db['FaxInteraction']['count']({'where':_0x25e310[_0xc05b('0x50')]})['then'](function(_0x166aa9){_0x4ed488[_0xc05b('0x31')]=_0x166aa9;if(_0x2d8aca[_0xc05b('0x45')][_0xc05b('0x54')]){_0x25e310['include']=[{'model':db[_0xc05b('0x77')],'as':_0xc05b('0x78'),'required':![]},{'model':db[_0xc05b('0x79')],'as':_0xc05b('0x7a'),'attributes':[_0xc05b('0x3e'),_0xc05b('0x7b'),_0xc05b('0x7c')],'required':![]},{'model':db['Tag'],'as':_0xc05b('0x7d'),'attributes':['id',_0xc05b('0x3e'),_0xc05b('0x7e')],'where':_0x2d8aca[_0xc05b('0x45')][_0xc05b('0x7f')]?{'id':_0x2d8aca[_0xc05b('0x45')][_0xc05b('0x7f')]}:undefined,'required':_0x2d8aca[_0xc05b('0x45')][_0xc05b('0x7f')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x25e310);})[_0xc05b('0x3a')](function(_0x198adb){_0x4ed488[_0xc05b('0x6d')]=_0x198adb;return _0x4ed488;});}})[_0xc05b('0x3a')](respondWithFilteredResult(_0x67ada1,_0x25e310))[_0xc05b('0x2d')](handleError(_0x67ada1,null));};exports['addApplications']=function(_0x13333a,_0x552be9,_0x50bcfe){return db[_0xc05b('0x56')][_0xc05b('0x6a')]({'where':{'id':_0x13333a['params']['id']}})[_0xc05b('0x3a')](handleEntityNotFound(_0x552be9,null))[_0xc05b('0x3a')](function(_0x30cbf1){if(_0x30cbf1){return db[_0xc05b('0x80')][_0xc05b('0x81')](function(_0x5bdc61){return db['FaxApplication'][_0xc05b('0x3b')]({'where':{'FaxAccountId':_0x13333a['params']['id']},'transaction':_0x5bdc61})[_0xc05b('0x3a')](function(_0x3e6d88){var _0xac9da1=_['map'](_0x13333a['body'],function(_0x2827ec){_0x2827ec[_0xc05b('0x68')]=_0x13333a[_0xc05b('0x59')]['id'];return _0x2827ec;});return db[_0xc05b('0x82')][_0xc05b('0x83')](_0xac9da1,{'transaction':_0x5bdc61});});})[_0xc05b('0x3a')](function(){return db['FaxApplication'][_0xc05b('0x84')]({'where':{'FaxAccountId':_0x13333a[_0xc05b('0x59')]['id']},'order':_0xc05b('0x85')});});}})[_0xc05b('0x3a')](respondWithResult(_0x552be9,null))[_0xc05b('0x2d')](handleError(_0x552be9,null));};exports[_0xc05b('0x86')]=function(_0x2f2968,_0x444bdb,_0x2fdb6e){var _0x279faf={};var _0x41ddcd={};var _0xd33809;var _0x4cbd59;return db[_0xc05b('0x56')]['findOne']({'where':{'id':_0x2f2968[_0xc05b('0x59')]['id']}})[_0xc05b('0x3a')](handleEntityNotFound(_0x444bdb,null))[_0xc05b('0x3a')](function(_0x340815){if(_0x340815){_0xd33809=_0x340815;_0x41ddcd[_0xc05b('0x43')]=_['keys'](db['FaxApplication'][_0xc05b('0x42')]);_0x41ddcd[_0xc05b('0x45')]=_[_0xc05b('0x44')](_0x2f2968[_0xc05b('0x45')]);_0x41ddcd[_0xc05b('0x4e')]=_[_0xc05b('0x46')](_0x41ddcd[_0xc05b('0x43')],_0x41ddcd[_0xc05b('0x45')]);_0x279faf[_0xc05b('0x47')]=_[_0xc05b('0x46')](_0x41ddcd[_0xc05b('0x43')],qs[_0xc05b('0x48')](_0x2f2968[_0xc05b('0x45')][_0xc05b('0x48')]));_0x279faf['attributes']=_0x279faf['attributes']['length']?_0x279faf[_0xc05b('0x47')]:_0x41ddcd['model'];_0x279faf[_0xc05b('0x4c')]=qs[_0xc05b('0x4d')](_0x2f2968['query'][_0xc05b('0x4d')]);_0x279faf[_0xc05b('0x50')]=qs[_0xc05b('0x4e')](_[_0xc05b('0x6c')](_0x2f2968[_0xc05b('0x45')],_0x41ddcd[_0xc05b('0x4e')]));if(_0x2f2968[_0xc05b('0x45')][_0xc05b('0x4f')]){_0x279faf[_0xc05b('0x50')]=_[_0xc05b('0x5b')](_0x279faf[_0xc05b('0x50')],{'$or':_[_0xc05b('0x51')](_0x279faf[_0xc05b('0x47')],function(_0x5c1503){var _0x2d5c64={};_0x2d5c64[_0x5c1503]={'$like':'%'+_0x2f2968[_0xc05b('0x45')][_0xc05b('0x4f')]+'%'};return _0x2d5c64;})});}_0x279faf=_['merge']({},_0x279faf,_0x2f2968[_0xc05b('0x5c')]);return _0xd33809[_0xc05b('0x86')](_0x279faf);}})[_0xc05b('0x3a')](function(_0x333404){if(_0x333404){_0x4cbd59=_0x333404[_0xc05b('0x49')];if(!_0x2f2968[_0xc05b('0x45')][_0xc05b('0x4a')](_0xc05b('0x4b'))){_0x279faf[_0xc05b('0x33')]=qs[_0xc05b('0x33')](_0x2f2968['query'][_0xc05b('0x33')]);_0x279faf[_0xc05b('0x32')]=qs[_0xc05b('0x32')](_0x2f2968['query'][_0xc05b('0x32')]);}return _0xd33809['getApplications'](_0x279faf);}})[_0xc05b('0x3a')](function(_0x3ba736){if(_0x3ba736){return _0x3ba736?{'count':_0x4cbd59,'rows':_0x3ba736}:null;}})[_0xc05b('0x3a')](respondWithResult(_0x444bdb,null))[_0xc05b('0x2d')](handleError(_0x444bdb,null));};function Extension(_0x27a190,_0x36bc90,_0x4e2804,_0x1f008e){this[_0xc05b('0x87')]='from-voip-provider';this[_0xc05b('0x88')]=_0x27a190[_0xc05b('0x89')];this['app']=_0x1f008e;this[_0xc05b('0x52')]=_0xc05b('0x8a');this[_0xc05b('0x8b')]='Fax\x20Extension';this['FaxAccountId']=_0x27a190['id'];this[_0xc05b('0x85')]=_0x36bc90;this[_0xc05b('0x8c')]=_0x4e2804;}function createExtensionsReciveFax(_0x3d5b95){var _0x21e5b5=0x1;var _0x51c634=[];_0x51c634[_0xc05b('0x8d')](new Extension(_0x3d5b95,_0x21e5b5,'',_0xc05b('0x8e')));_0x21e5b5+=0x1;_0x51c634[_0xc05b('0x8d')](new Extension(_0x3d5b95,_0x21e5b5,_0xc05b('0x8f'),_0xc05b('0x90')));_0x21e5b5+=0x1;for(var _0x20984a in _0x3d5b95){if(_0x3d5b95['hasOwnProperty'](_0x20984a)&&(_0x20984a===_0xc05b('0x91')||_0x20984a===_0xc05b('0x89')||_0x20984a===_0xc05b('0x92')||_0x20984a===_0xc05b('0x93')||_0x20984a===_0xc05b('0x94')||_0x20984a===_0xc05b('0x95')||_0x20984a===_0xc05b('0x96')||_0x20984a==='modem'||_0x20984a===_0xc05b('0x97'))){_0x51c634['push'](new Extension(_0x3d5b95,_0x21e5b5,'FAXOPT('+_0x20984a+')='+_0x3d5b95[_0x20984a],_0xc05b('0x90')));_0x21e5b5+=0x1;}}_0x51c634[_0xc05b('0x8d')](new Extension(_0x3d5b95,_0x21e5b5,'6',_0xc05b('0x98')));_0x21e5b5+=0x1;_0x51c634[_0xc05b('0x8d')](new Extension(_0x3d5b95,_0x21e5b5,_0xc05b('0x99'),_0xc05b('0x9a')));_0x21e5b5=0x0;return _0x51c634;}exports[_0xc05b('0x9b')]=function(_0x31662e,_0x3fbee4,_0xaa1ccb){var _0x369d75;return db[_0xc05b('0x80')][_0xc05b('0x81')](function(_0x398c6d){return db[_0xc05b('0x56')]['create'](_0x31662e[_0xc05b('0x5f')],{'transaction':_0x398c6d})[_0xc05b('0x3a')](function(_0x2f9558){_0x369d75=_0x2f9558[_0xc05b('0x60')]({'plain':!![]});return db['VoiceExtension'][_0xc05b('0x83')](createExtensionsReciveFax(_0x369d75),{'transaction':_0x398c6d});});})[_0xc05b('0x3a')](function(){return _0x369d75;})[_0xc05b('0x3a')](respondWithResult(_0x3fbee4,null))[_0xc05b('0x2d')](handleError(_0x3fbee4,null));};exports[_0xc05b('0x9c')]=function(_0x10703b,_0x39b273,_0x307926){var _0x5c71e5;return db[_0xc05b('0x80')][_0xc05b('0x81')](function(_0x4413ab){return db[_0xc05b('0x56')][_0xc05b('0x39')](_0x10703b['body'],{'where':{'id':_0x10703b['body']['id']},'transaction':_0x4413ab})['then'](function(_0x5a00da){return db['VoiceExtension'][_0xc05b('0x3b')]({'where':{'FaxAccountId':_0x10703b[_0xc05b('0x5f')]['id']},'transaction':_0x4413ab})[_0xc05b('0x3a')](function(_0x4067ba){return db[_0xc05b('0x9d')][_0xc05b('0x83')](createExtensionsReciveFax(_[_0xc05b('0x74')](_0x10703b['body'],[_0xc05b('0x9e'),_0xc05b('0x53'),'createdAt',_0xc05b('0x9f'),_0xc05b('0xa0'),_0xc05b('0xa1')])),{'transaction':_0x4413ab});});});})[_0xc05b('0x3a')](function(){return db['FaxAccount'][_0xc05b('0xa2')](_0x10703b['body']['id']);})[_0xc05b('0x3a')](respondWithResult(_0x39b273,null))[_0xc05b('0x2d')](handleError(_0x39b273,null));};exports[_0xc05b('0xa3')]=function(_0x2bc51d,_0x2e2f08,_0xa7f0d6){var _0x34518f={'raw':!![],'where':{}};var _0x66f659={};var _0x341e36={'count':0x0,'rows':[]};return db[_0xc05b('0x56')]['findOne']({'where':{'id':_0x2bc51d[_0xc05b('0x59')]['id']}})[_0xc05b('0x3a')](handleEntityNotFound(_0x2e2f08,null))['then'](function(_0x2c1e70){if(_0x2c1e70){_0x66f659[_0xc05b('0x43')]=_[_0xc05b('0x44')](db[_0xc05b('0xa4')]['rawAttributes']);_0x66f659[_0xc05b('0x45')]=_[_0xc05b('0x44')](_0x2bc51d[_0xc05b('0x45')]);_0x66f659[_0xc05b('0x4e')]=_[_0xc05b('0x46')](_0x66f659[_0xc05b('0x43')],_0x66f659[_0xc05b('0x45')]);_0x34518f[_0xc05b('0x47')]=_['intersection'](_0x66f659[_0xc05b('0x43')],qs[_0xc05b('0x48')](_0x2bc51d['query']['fields']));_0x34518f[_0xc05b('0x47')]=_0x34518f[_0xc05b('0x47')]['length']?_0x34518f[_0xc05b('0x47')]:_0x66f659[_0xc05b('0x43')];if(!_0x2bc51d[_0xc05b('0x45')][_0xc05b('0x4a')](_0xc05b('0x4b'))){_0x34518f[_0xc05b('0x33')]=qs[_0xc05b('0x33')](_0x2bc51d[_0xc05b('0x45')]['limit']);_0x34518f['offset']=qs['offset'](_0x2bc51d[_0xc05b('0x45')]['offset']);}_0x34518f['order']=qs['sort'](_0x2bc51d[_0xc05b('0x45')][_0xc05b('0x4d')]);_0x34518f[_0xc05b('0x50')]=qs[_0xc05b('0x4e')](_[_0xc05b('0x6c')](_0x2bc51d[_0xc05b('0x45')],_0x66f659['filters']));_0x34518f[_0xc05b('0x50')][_0xc05b('0x68')]=_0x2c1e70['id'];if(_0x2bc51d[_0xc05b('0x45')][_0xc05b('0x4f')]){_0x34518f['where']=_[_0xc05b('0x5b')](_0x34518f[_0xc05b('0x50')],{'$or':_[_0xc05b('0x51')](_0x34518f[_0xc05b('0x47')],function(_0x2fd289){var _0x2d3d67={};_0x2d3d67[_0x2fd289]={'$like':'%'+_0x2bc51d[_0xc05b('0x45')]['filter']+'%'};return _0x2d3d67;})});}if(_0x2bc51d[_0xc05b('0x45')][_0xc05b('0xa5')]){var _0x2b78e5=_0x2bc51d[_0xc05b('0x45')][_0xc05b('0xa5')][_0xc05b('0xa6')](',');var _0x177001={};_0x177001[_0x2b78e5[0x0]]={'$gte':moment(_0x2b78e5[0x1])[_0xc05b('0xa7')](_0xc05b('0xa8'))};_0x34518f[_0xc05b('0x50')]=_[_0xc05b('0x5b')](_0x34518f[_0xc05b('0x50')],_0x177001);}_0x34518f=_['merge']({},_0x34518f,_0x2bc51d[_0xc05b('0x5c')]);return db[_0xc05b('0xa4')][_0xc05b('0x31')]({'where':_0x34518f[_0xc05b('0x50')]})[_0xc05b('0x3a')](function(_0x54845e){_0x341e36[_0xc05b('0x31')]=_0x54845e;if(_0x2bc51d['query'][_0xc05b('0x54')]){_0x34518f['include']=[{'all':!![]}];}return db[_0xc05b('0xa4')][_0xc05b('0x57')](_0x34518f);})[_0xc05b('0x3a')](function(_0x4375f2){_0x341e36[_0xc05b('0x6d')]=_0x4375f2;return _0x341e36;});}})['then'](respondWithFilteredResult(_0x2e2f08,_0x34518f))['catch'](handleError(_0x2e2f08,null));};exports['send']=function(_0x4c1bdb,_0xe8db60,_0x488f88){var _0x29d38f,_0xb4f1f={},_0x84373a;if(_0x4c1bdb[_0xc05b('0x5f')]['to']){_0x84373a=_0x4c1bdb['body']['to'][0x0];}return db['FaxAccount'][_0xc05b('0x5d')]({'where':{'id':_0x4c1bdb[_0xc05b('0x59')]['id']},'include':[{'model':db[_0xc05b('0xa9')],'as':_0xc05b('0xaa'),'include':[{'model':db[_0xc05b('0x77')],'as':_0xc05b('0xab'),'where':{'fax':_0x84373a},'limit':0x1,'order':[[_0xc05b('0x9f'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xe8db60,null))[_0xc05b('0x3a')](function(_0xb2ef19){_0x29d38f=_0xb2ef19;if(_0x4c1bdb[_0xc05b('0x5f')][_0xc05b('0xac')]&&_0x4c1bdb['body']['attachments'][_0xc05b('0x49')]){for(var _0x31b578=0x0;_0x31b578<_0x4c1bdb[_0xc05b('0x5f')]['attachments'][_0xc05b('0x49')];_0x31b578+=0x1){_0x4c1bdb[_0xc05b('0x5f')]['attachments'][_0x31b578]={'filename':_0x4c1bdb['body'][_0xc05b('0xac')][_0x31b578][_0xc05b('0x3e')],'id':_0x4c1bdb[_0xc05b('0x5f')]['attachments'][_0x31b578]['id'],'path':path['join'](config[_0xc05b('0xad')],_0xc05b('0xae'),_0x4c1bdb[_0xc05b('0x5f')][_0xc05b('0xac')][_0x31b578][_0xc05b('0xaf')])};}}return respondWithRpcPromise(_0xc05b('0xb0'),'CheckAfterSend',{'FaxAccountId':_[_0xc05b('0xb1')](_0x4c1bdb[_0xc05b('0x59')]['id'])?undefined:_0x4c1bdb[_0xc05b('0x59')]['id'],'path':_[_0xc05b('0xb1')](_0x4c1bdb[_0xc05b('0x5f')][_0xc05b('0xac')][0x0]['path'])?undefined:_0x4c1bdb[_0xc05b('0x5f')]['attachments'][0x0][_0xc05b('0x9')],'fax':_['isNil'](_0x4c1bdb[_0xc05b('0x5f')]['to'][0x0])?undefined:_0x4c1bdb[_0xc05b('0x5f')]['to'][0x0]},client9002);})['then'](function(){if(_0x29d38f){if(_[_0xc05b('0xb1')](_0x4c1bdb[_0xc05b('0x5f')][_0xc05b('0xb2')])){_0x4c1bdb[_0xc05b('0x5f')][_0xc05b('0xb2')]=util[_0xc05b('0xa7')](_0xc05b('0xb3'),_0x29d38f[_0xc05b('0x3e')],_0x29d38f['fax']);}if(_0x29d38f[_0xc05b('0xaa')]){if(_0x29d38f[_0xc05b('0xaa')]['Contacts'][_0xc05b('0x49')]){return _0x29d38f[_0xc05b('0xaa')]['Contacts'][0x0];}else{return db[_0xc05b('0x77')]['create'](_[_0xc05b('0x1b')](_0x4c1bdb[_0xc05b('0x5f')],{'firstName':_0x4c1bdb[_0xc05b('0x5f')]['to'][0x0],'phone':_0x4c1bdb[_0xc05b('0x5f')]['to'][0x0],'fax':_0x4c1bdb[_0xc05b('0x5f')]['to'][0x0],'ListId':_0x29d38f[_0xc05b('0xa1')]}));}}else{throw new Error(_0xc05b('0xb4'));}}else{throw new Error(_0xc05b('0xb5'));}})[_0xc05b('0x3a')](function(_0x3a4bde){if(_0x3a4bde){return db[_0xc05b('0x76')][_0xc05b('0x5d')]({'where':{'ContactId':_0x3a4bde['id'],'closed':![],'FaxAccountId':_0x29d38f['id']}})[_0xc05b('0x3a')](function(_0x56c3c5){if(_0x56c3c5){return[_0x56c3c5,![]];}return db[_0xc05b('0x76')][_0xc05b('0x5e')]({'UserId':_0x4c1bdb['user']['id'],'ContactId':_0x3a4bde['id'],'FaxAccountId':_0x29d38f['id'],'fax':_0x4c1bdb[_0xc05b('0x5f')]['to'][0x0],'firstMsgDirection':_0xc05b('0xb6'),'Messages':[_[_0xc05b('0x5b')](_0x4c1bdb[_0xc05b('0x5f')],{'read':![],'body':_0x4c1bdb[_0xc05b('0x5f')]['attachments'][0x0][_0xc05b('0xb7')],'FaxAccountId':_0x29d38f['id'],'UserId':_0x4c1bdb[_0xc05b('0x62')]['id'],'ContactId':_0x3a4bde['id'],'AttachmentId':_0x4c1bdb[_0xc05b('0x5f')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xc05b('0xa4')],'as':_0xc05b('0xb8')}]})['then'](function(_0x1568d6){return[_0x1568d6,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc05b('0xb9')](function(_0x294399,_0x5486a8){if(_0x5486a8){return _0x294399;}return db[_0xc05b('0xa4')][_0xc05b('0x5e')]({'direction':_0xc05b('0xb6'),'read':![],'body':_0x4c1bdb['body'][_0xc05b('0xac')][0x0][_0xc05b('0xb7')],'FaxAccountId':_0x29d38f['id'],'FaxInteractionId':_0x294399['id'],'UserId':_0x4c1bdb[_0xc05b('0x62')]['id'],'ContactId':_0x294399[_0xc05b('0xba')],'AttachmentId':_0x4c1bdb[_0xc05b('0x5f')][_0xc05b('0xac')][0x0]['id']})['then'](function(_0x1828d9){_0x294399[_0xc05b('0xbb')]['Messages']=[];_0x294399[_0xc05b('0xbb')]['Messages']['push'](_0x1828d9[_0xc05b('0xbb')]);return _0x294399;});})[_0xc05b('0x3a')](function(_0x2a487c){respondWithRpcPromise('SendFax',_0xc05b('0xbc'),{'FaxAccountId':_[_0xc05b('0xb1')](_0x4c1bdb[_0xc05b('0x59')]['id'])?undefined:_0x4c1bdb[_0xc05b('0x59')]['id'],'path':_[_0xc05b('0xb1')](_0x4c1bdb['body'][_0xc05b('0xac')][0x0][_0xc05b('0x9')])?undefined:_0x4c1bdb[_0xc05b('0x5f')][_0xc05b('0xac')][0x0][_0xc05b('0x9')],'fax':_[_0xc05b('0xb1')](_0x4c1bdb[_0xc05b('0x5f')]['to'][0x0])?undefined:_0x4c1bdb[_0xc05b('0x5f')]['to'][0x0],'AttachmentId':_0x4c1bdb[_0xc05b('0x5f')][_0xc05b('0xac')][0x0]['id']},client9002)[_0xc05b('0x3a')](function(_0xe6361c){logger['info'](_0xc05b('0xbd'),_0xe6361c);})[_0xc05b('0x2d')](function(_0x3fa0f3){logger[_0xc05b('0x24')]('SendFaxRpc,\x20%s',_0x3fa0f3);});return _0x2a487c;})[_0xc05b('0x3a')](respondWithResult(_0xe8db60,null))[_0xc05b('0x2d')](handleError(_0xe8db60,null));};exports[_0xc05b('0xbe')]=function(_0xd930cd,_0x2fec62,_0x19347e){return db[_0xc05b('0x56')][_0xc05b('0x5d')]({'where':{'id':_0xd930cd[_0xc05b('0x59')]['id']}})['then'](handleEntityNotFound(_0x2fec62,null))[_0xc05b('0x3a')](function(_0x34ce73){if(_0x34ce73){return _0x34ce73[_0xc05b('0xbe')](_0xd930cd['body'][_0xc05b('0x6f')],_['omit'](_0xd930cd[_0xc05b('0x5f')],['ids','id'])||{})[_0xc05b('0xb9')](function(_0x166ce0){for(var _0x4d50d3=0x0;_0x4d50d3<_0xd930cd[_0xc05b('0x5f')][_0xc05b('0x6f')][_0xc05b('0x49')];_0x4d50d3+=0x1){socket['emit'](_0xc05b('0xbf'),{'UserId':_0xd930cd['body'][_0xc05b('0x6f')][_0x4d50d3],'FaxAccountId':_0xd930cd[_0xc05b('0x59')]['id']});}return _0x166ce0;});}})['then'](respondWithResult(_0x2fec62,null))[_0xc05b('0x2d')](handleError(_0x2fec62,null));};exports[_0xc05b('0xc0')]=function(_0x55a743,_0x522c77,_0x170843){var _0x5add68;return db['FaxAccount'][_0xc05b('0x5d')]({'where':{'id':_0x55a743['params']['id']}})[_0xc05b('0x3a')](handleEntityNotFound(_0x522c77,null))[_0xc05b('0x3a')](function(_0x277dc8){if(_0x277dc8){return _0x277dc8[_0xc05b('0xc0')](_0x55a743['query'][_0xc05b('0x6f')])['then'](function(_0x265093){if(_[_0xc05b('0xc1')](_0x55a743['query']['ids'])){for(var _0xd2f4b4=0x0;_0xd2f4b4<_0x55a743['query'][_0xc05b('0x6f')][_0xc05b('0x49')];_0xd2f4b4+=0x1){socket[_0xc05b('0xc2')](_0xc05b('0xc3'),{'UserId':_0x55a743[_0xc05b('0x45')][_0xc05b('0x6f')][_0xd2f4b4],'FaxAccountId':_0x55a743[_0xc05b('0x59')]['id']});}}else{socket[_0xc05b('0xc2')](_0xc05b('0xc3'),{'UserId':_0x55a743[_0xc05b('0x45')][_0xc05b('0x6f')],'FaxAccountId':_0x55a743[_0xc05b('0x59')]['id']});}});}})['then'](respondWithStatusCode(_0x522c77,null))[_0xc05b('0x2d')](handleError(_0x522c77,null));};exports['getAgents']=function(_0x5ca339,_0x19003b,_0x238a46){var _0x3f1075={};var _0x46eaf9={};var _0x705180;var _0x51016;return db[_0xc05b('0x56')][_0xc05b('0x6a')]({'where':{'id':_0x5ca339[_0xc05b('0x59')]['id']}})[_0xc05b('0x3a')](handleEntityNotFound(_0x19003b,null))[_0xc05b('0x3a')](function(_0x2a3205){if(_0x2a3205){_0x705180=_0x2a3205;_0x46eaf9[_0xc05b('0x43')]=_[_0xc05b('0x44')](db[_0xc05b('0x79')][_0xc05b('0x42')]);_0x46eaf9[_0xc05b('0x45')]=_[_0xc05b('0x44')](_0x5ca339[_0xc05b('0x45')]);_0x46eaf9[_0xc05b('0x4e')]=_[_0xc05b('0x46')](_0x46eaf9[_0xc05b('0x43')],_0x46eaf9[_0xc05b('0x45')]);_0x3f1075[_0xc05b('0x47')]=_[_0xc05b('0x46')](_0x46eaf9['model'],qs[_0xc05b('0x48')](_0x5ca339[_0xc05b('0x45')][_0xc05b('0x48')]));_0x3f1075[_0xc05b('0x47')]=_0x3f1075['attributes'][_0xc05b('0x49')]?_0x3f1075[_0xc05b('0x47')]:_0x46eaf9[_0xc05b('0x43')];_0x3f1075[_0xc05b('0x4c')]=qs[_0xc05b('0x4d')](_0x5ca339['query'][_0xc05b('0x4d')]);_0x3f1075[_0xc05b('0x50')]=qs[_0xc05b('0x4e')](_[_0xc05b('0x6c')](_0x5ca339['query'],_0x46eaf9['filters']));if(_0x5ca339[_0xc05b('0x45')]['filter']){_0x3f1075['where']=_['merge'](_0x3f1075['where'],{'$or':_[_0xc05b('0x51')](_0x3f1075[_0xc05b('0x47')],function(_0x4582ed){var _0x297e5d={};_0x297e5d[_0x4582ed]={'$like':'%'+_0x5ca339['query'][_0xc05b('0x4f')]+'%'};return _0x297e5d;})});}_0x3f1075=_['merge']({},_0x3f1075,_0x5ca339[_0xc05b('0x5c')]);return _0x705180[_0xc05b('0xc4')](_0x3f1075);}})[_0xc05b('0x3a')](function(_0x5343dd){if(_0x5343dd){_0x51016=_0x5343dd[_0xc05b('0x49')];if(!_0x5ca339[_0xc05b('0x45')][_0xc05b('0x4a')](_0xc05b('0x4b'))){_0x3f1075[_0xc05b('0x33')]=qs[_0xc05b('0x33')](_0x5ca339[_0xc05b('0x45')][_0xc05b('0x33')]);_0x3f1075['offset']=qs[_0xc05b('0x32')](_0x5ca339[_0xc05b('0x45')]['offset']);}return _0x705180[_0xc05b('0xc4')](_0x3f1075);}})['then'](function(_0x3fd409){if(_0x3fd409){return _0x3fd409?{'count':_0x51016,'rows':_0x3fd409}:null;}})[_0xc05b('0x3a')](respondWithResult(_0x19003b,null))['catch'](handleError(_0x19003b,null));}; \ No newline at end of file +var _0x9253=['updateAccountApplications','update','tech','createdAt','updatedAt','ListId','FaxMessage','$gte','split','format','CmList','List','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','defaults','socket.io-emitter','redis','./faxAccount.socket','register','client','http','then','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','reject','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','model','keys','query','filters','intersection','fields','length','nolimit','limit','order','sort','where','filter','merge','type','key','VIRTUAL','field','options','FaxAccount','include','findAll','show','attributes','includeAll','find','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','hasOwnProperty','pick','map','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','ecm','faxdetect','headerinfo','modem','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax'];(function(_0x2aee3b,_0x6ea310){var _0x58c06f=function(_0xf47348){while(--_0xf47348){_0x2aee3b['push'](_0x2aee3b['shift']());}};_0x58c06f(++_0x6ea310);}(_0x9253,0xe0));var _0x3925=function(_0x4f3b4b,_0x590f08){_0x4f3b4b=_0x4f3b4b-0x0;var _0x1249e0=_0x9253[_0x4f3b4b];return _0x1249e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3925('0x0'));var rimraf=require(_0x3925('0x1'));var zipdir=require(_0x3925('0x2'));var jsonpatch=require(_0x3925('0x3'));var rp=require(_0x3925('0x4'));var moment=require(_0x3925('0x5'));var BPromise=require(_0x3925('0x6'));var Mustache=require('mustache');var util=require(_0x3925('0x7'));var path=require(_0x3925('0x8'));var sox=require(_0x3925('0x9'));var csv=require(_0x3925('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3925('0xb'));var squel=require(_0x3925('0xc'));var crypto=require(_0x3925('0xd'));var jsforce=require(_0x3925('0xe'));var deskjs=require(_0x3925('0xf'));var toCsv=require(_0x3925('0xa'));var querystring=require('querystring');var Papa=require(_0x3925('0x10'));var authService=require(_0x3925('0x11'));var hardwareService=require(_0x3925('0x12'));var Redis=require(_0x3925('0x13'));var qs=require(_0x3925('0x14'));var logger=require(_0x3925('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3925('0x16'))['db'];config['redis']=_[_0x3925('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3925('0x18'))(new Redis(config[_0x3925('0x19')]));require(_0x3925('0x1a'))[_0x3925('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3925('0x1c')][_0x3925('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25dc8d,_0x4c0cfb,_0x4a9020,_0x510fa8){return new BPromise(function(_0x46fe70,_0x17d2bf){var _0x30d162=_0x510fa8||client;return _0x30d162['request'](_0x25dc8d,_0x4a9020)[_0x3925('0x1e')](function(_0x56e4a){logger[_0x3925('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x4c0cfb,_0x3925('0x20'));logger[_0x3925('0x21')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4c0cfb,_0x3925('0x20'),JSON[_0x3925('0x22')](_0x56e4a));if(_0x56e4a[_0x3925('0x23')]){if(_0x56e4a['error'][_0x3925('0x24')]===0x1f4){logger[_0x3925('0x23')](_0x3925('0x25'),_0x4c0cfb,_0x56e4a['error'][_0x3925('0x26')]);return _0x17d2bf(_0x56e4a[_0x3925('0x23')]['message']);}logger[_0x3925('0x23')](_0x3925('0x25'),_0x4c0cfb,_0x56e4a['error'][_0x3925('0x26')]);return _0x46fe70(_0x56e4a[_0x3925('0x23')]['message']);}else{logger[_0x3925('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x4c0cfb,_0x3925('0x20'));_0x46fe70(_0x56e4a[_0x3925('0x27')]['message']);}})[_0x3925('0x28')](function(_0x5a3720){logger[_0x3925('0x23')](_0x3925('0x25'),_0x4c0cfb,_0x5a3720);_0x17d2bf(_0x5a3720);});});}function respondWithStatusCode(_0x459b6b,_0x4cd15e){_0x4cd15e=_0x4cd15e||0xcc;return function(_0x5c883d){if(_0x5c883d){return _0x459b6b[_0x3925('0x29')](_0x4cd15e);}return _0x459b6b[_0x3925('0x2a')](_0x4cd15e)[_0x3925('0x2b')]();};}function respondWithResult(_0x3f6609,_0x2e193e){_0x2e193e=_0x2e193e||0xc8;return function(_0x593201){if(_0x593201){return _0x3f6609['status'](_0x2e193e)[_0x3925('0x2c')](_0x593201);}};}function respondWithFilteredResult(_0x521ad8,_0x3d0243){return function(_0x5e4c){if(_0x5e4c){var _0x4312fd=_0x5e4c[_0x3925('0x2d')],_0xefd84e=_0x3d0243[_0x3925('0x2e')],_0x1bcdf2=_0x3d0243[_0x3925('0x2e')]+_0x3d0243['limit'],_0xe7c101;if(_0x1bcdf2>=_0x4312fd){_0x1bcdf2=_0x4312fd;_0xe7c101=0xc8;}else{_0xe7c101=0xce;}_0x521ad8[_0x3925('0x2a')](_0xe7c101);return _0x521ad8[_0x3925('0x2f')]('Content-Range',_0xefd84e+'-'+_0x1bcdf2+'/'+_0x4312fd)['json'](_0x5e4c);}return null;};}function patchUpdates(_0x338748){return function(_0x11153c){try{jsonpatch[_0x3925('0x30')](_0x11153c,_0x338748,!![]);}catch(_0x1e5cc1){return BPromise[_0x3925('0x31')](_0x1e5cc1);}return _0x11153c['save']();};}function saveUpdates(_0x55495f,_0x289b57){return function(_0x404d45){if(_0x404d45){return _0x404d45['update'](_0x55495f)['then'](function(_0x36d755){return _0x36d755;});}return null;};}function removeEntity(_0x44c8f3,_0x3aec80){return function(_0x102033){if(_0x102033){return _0x102033['destroy']()[_0x3925('0x1e')](function(){var _0x4f7ad7=_0x102033[_0x3925('0x32')]({'plain':!![]});var _0x44d498=_0x3925('0x33');return db[_0x3925('0x34')][_0x3925('0x35')]({'where':{'type':_0x44d498,'resourceId':_0x4f7ad7['id']}})[_0x3925('0x1e')](function(){return _0x102033;});})['then'](function(){_0x44c8f3[_0x3925('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dd586,_0x52b4ff){return function(_0xdf54c8){if(!_0xdf54c8){_0x1dd586['sendStatus'](0x194);}return _0xdf54c8;};}function handleError(_0x5b47c2,_0x90a104){_0x90a104=_0x90a104||0x1f4;return function(_0x48b605){logger[_0x3925('0x23')](_0x48b605[_0x3925('0x36')]);if(_0x48b605[_0x3925('0x37')]){delete _0x48b605[_0x3925('0x37')];}_0x5b47c2[_0x3925('0x2a')](_0x90a104)[_0x3925('0x38')](_0x48b605);};}exports[_0x3925('0x39')]=function(_0x1eecb0,_0x2a6873){var _0xa88cf4={'include':[{'model':db[_0x3925('0x3a')],'as':_0x3925('0x3b')}]},_0x1789d6={},_0x5292a1={'count':0x0,'rows':[]};var _0x294c92=db['FaxAccount'][_0x3925('0x3c')];_0x1789d6[_0x3925('0x3d')]=_[_0x3925('0x3e')](_0x294c92);_0x1789d6['query']=_[_0x3925('0x3e')](_0x1eecb0[_0x3925('0x3f')]);_0x1789d6[_0x3925('0x40')]=_[_0x3925('0x41')](_0x1789d6[_0x3925('0x3d')],_0x1789d6['query']);_0xa88cf4['attributes']=_[_0x3925('0x41')](_0x1789d6['model'],qs[_0x3925('0x42')](_0x1eecb0[_0x3925('0x3f')][_0x3925('0x42')]));_0xa88cf4['attributes']=_0xa88cf4['attributes'][_0x3925('0x43')]?_0xa88cf4['attributes']:_0x1789d6[_0x3925('0x3d')];if(!_0x1eecb0[_0x3925('0x3f')]['hasOwnProperty'](_0x3925('0x44'))){_0xa88cf4[_0x3925('0x45')]=qs[_0x3925('0x45')](_0x1eecb0['query'][_0x3925('0x45')]);_0xa88cf4[_0x3925('0x2e')]=qs[_0x3925('0x2e')](_0x1eecb0[_0x3925('0x3f')][_0x3925('0x2e')]);}_0xa88cf4[_0x3925('0x46')]=qs[_0x3925('0x47')](_0x1eecb0[_0x3925('0x3f')]['sort']);_0xa88cf4[_0x3925('0x48')]=qs[_0x3925('0x40')](_['pick'](_0x1eecb0[_0x3925('0x3f')],_0x1789d6[_0x3925('0x40')]));if(_0x1eecb0['query'][_0x3925('0x49')]){_0xa88cf4['where']=_[_0x3925('0x4a')](_0xa88cf4[_0x3925('0x48')],{'$or':_['map'](_0x294c92,function(_0x5932cf){if(_0x5932cf[_0x3925('0x4b')][_0x3925('0x4c')]!==_0x3925('0x4d')){var _0x306ea1={};_0x306ea1[_0x5932cf[_0x3925('0x4e')]]={'$like':'%'+_0x1eecb0[_0x3925('0x3f')][_0x3925('0x49')]+'%'};return _0x306ea1;}})});}_0xa88cf4=_[_0x3925('0x4a')]({},_0xa88cf4,_0x1eecb0[_0x3925('0x4f')]);var _0x163c31={'where':_0xa88cf4[_0x3925('0x48')]};return db[_0x3925('0x50')]['count'](_0x163c31)[_0x3925('0x1e')](function(_0xb82adc){_0x5292a1[_0x3925('0x2d')]=_0xb82adc;if(_0x1eecb0[_0x3925('0x3f')]['includeAll']){_0xa88cf4[_0x3925('0x51')]=[{'all':!![]}];}return db['FaxAccount'][_0x3925('0x52')](_0xa88cf4);})[_0x3925('0x1e')](function(_0x5e1f55){_0x5292a1['rows']=_0x5e1f55;return _0x5292a1;})[_0x3925('0x1e')](respondWithFilteredResult(_0x2a6873,_0xa88cf4))['catch'](handleError(_0x2a6873,null));};exports[_0x3925('0x53')]=function(_0x335d78,_0x262423){var _0x544125={'raw':![],'where':{'id':_0x335d78['params']['id']},'include':[{'model':db['Pause'],'as':_0x3925('0x3b')}]},_0x3ef4aa={};_0x3ef4aa[_0x3925('0x3d')]=_[_0x3925('0x3e')](db[_0x3925('0x50')][_0x3925('0x3c')]);_0x3ef4aa[_0x3925('0x3f')]=_[_0x3925('0x3e')](_0x335d78['query']);_0x3ef4aa[_0x3925('0x40')]=_[_0x3925('0x41')](_0x3ef4aa[_0x3925('0x3d')],_0x3ef4aa[_0x3925('0x3f')]);_0x544125[_0x3925('0x54')]=_[_0x3925('0x41')](_0x3ef4aa[_0x3925('0x3d')],qs['fields'](_0x335d78[_0x3925('0x3f')]['fields']));_0x544125[_0x3925('0x54')]=_0x544125['attributes'][_0x3925('0x43')]?_0x544125[_0x3925('0x54')]:_0x3ef4aa[_0x3925('0x3d')];if(_0x335d78[_0x3925('0x3f')][_0x3925('0x55')]){_0x544125[_0x3925('0x51')]=[{'all':!![]}];}_0x544125=_[_0x3925('0x4a')]({},_0x544125,_0x335d78['options']);return db[_0x3925('0x50')][_0x3925('0x56')](_0x544125)[_0x3925('0x1e')](handleEntityNotFound(_0x262423,null))['then'](respondWithResult(_0x262423,null))['catch'](handleError(_0x262423,null));};exports['create']=function(_0x2c68d,_0x4f7a72){return db[_0x3925('0x50')][_0x3925('0x57')](_0x2c68d[_0x3925('0x58')],{})[_0x3925('0x1e')](function(_0x1b2387){var _0x22f8a2=_0x2c68d[_0x3925('0x59')][_0x3925('0x32')]({'plain':!![]});if(!_0x22f8a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22f8a2[_0x3925('0x5a')]===_0x3925('0x59')){var _0x993631=_0x1b2387['get']({'plain':!![]});var _0x38cea6=_0x3925('0x33');return db[_0x3925('0x5b')]['find']({'where':{'name':_0x38cea6,'userProfileId':_0x22f8a2['userProfileId']},'raw':!![]})['then'](function(_0x298501){if(_0x298501&&_0x298501['autoAssociation']===0x0){return db[_0x3925('0x34')][_0x3925('0x57')]({'name':_0x993631[_0x3925('0x37')],'resourceId':_0x993631['id'],'type':_0x298501[_0x3925('0x37')],'sectionId':_0x298501['id']},{})[_0x3925('0x1e')](function(){return _0x1b2387;});}else{return _0x1b2387;}})[_0x3925('0x28')](function(_0x24ea98){logger[_0x3925('0x23')](_0x3925('0x5c'),_0x24ea98);throw _0x24ea98;});}return _0x1b2387;})['then'](respondWithResult(_0x4f7a72,0xc9))['catch'](handleError(_0x4f7a72,null));};exports['update']=function(_0x49c951,_0x363cce){if(_0x49c951['body']['id']){delete _0x49c951['body']['id'];}return db[_0x3925('0x50')][_0x3925('0x56')]({'where':{'id':_0x49c951['params']['id']},'include':[{'model':db[_0x3925('0x3a')],'as':_0x3925('0x3b')}]})[_0x3925('0x1e')](handleEntityNotFound(_0x363cce,null))[_0x3925('0x1e')](saveUpdates(_0x49c951['body'],null))[_0x3925('0x1e')](respondWithResult(_0x363cce,null))[_0x3925('0x28')](handleError(_0x363cce,null));};exports[_0x3925('0x35')]=function(_0x38ec21,_0x5a89e7){return db[_0x3925('0x50')][_0x3925('0x56')]({'where':{'id':_0x38ec21[_0x3925('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5a89e7,null))[_0x3925('0x1e')](removeEntity(_0x5a89e7,null))[_0x3925('0x28')](handleError(_0x5a89e7,null));};exports['describe']=function(_0x261492,_0x3fffad){return db[_0x3925('0x50')][_0x3925('0x5e')]()[_0x3925('0x1e')](respondWithResult(_0x3fffad,null))[_0x3925('0x28')](handleError(_0x3fffad,null));};exports[_0x3925('0x5f')]=function(_0x1d28f0,_0x8c72ae,_0x20fd62){if(_0x1d28f0[_0x3925('0x58')]['id']){delete _0x1d28f0['body']['id'];}return db[_0x3925('0x50')][_0x3925('0x56')]({'where':{'id':_0x1d28f0['params']['id']}})[_0x3925('0x1e')](handleEntityNotFound(_0x8c72ae,null))[_0x3925('0x1e')](function(_0x2298db){if(_0x2298db){_0x1d28f0[_0x3925('0x58')][_0x3925('0x60')]=_0x2298db['id'];return db[_0x3925('0x61')][_0x3925('0x57')](_0x1d28f0['body']);}})[_0x3925('0x1e')](respondWithResult(_0x8c72ae,null))[_0x3925('0x28')](handleError(_0x8c72ae,null));};exports[_0x3925('0x62')]=function(_0x4921a1,_0xb8c7ae,_0x34c1d3){var _0x491cab={'raw':![],'where':{}};var _0x23e81d={};var _0x56d77d={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4921a1[_0x3925('0x5d')]['id']}})['then'](handleEntityNotFound(_0xb8c7ae,null))[_0x3925('0x1e')](function(_0x3cbf88){if(_0x3cbf88){_0x23e81d['model']=_[_0x3925('0x3e')](db[_0x3925('0x61')][_0x3925('0x3c')]);_0x23e81d[_0x3925('0x3f')]=_[_0x3925('0x3e')](_0x4921a1['query']);_0x23e81d['filters']=_['intersection'](_0x23e81d[_0x3925('0x3d')],_0x23e81d[_0x3925('0x3f')]);_0x491cab[_0x3925('0x54')]=_[_0x3925('0x41')](_0x23e81d['model'],qs['fields'](_0x4921a1[_0x3925('0x3f')][_0x3925('0x42')]));_0x491cab['attributes']=_0x491cab[_0x3925('0x54')][_0x3925('0x43')]?_0x491cab[_0x3925('0x54')]:_0x23e81d[_0x3925('0x3d')];if(!_0x4921a1[_0x3925('0x3f')][_0x3925('0x63')](_0x3925('0x44'))){_0x491cab[_0x3925('0x45')]=qs['limit'](_0x4921a1[_0x3925('0x3f')][_0x3925('0x45')]);_0x491cab[_0x3925('0x2e')]=qs[_0x3925('0x2e')](_0x4921a1[_0x3925('0x3f')][_0x3925('0x2e')]);}_0x491cab[_0x3925('0x46')]=qs[_0x3925('0x47')](_0x4921a1[_0x3925('0x3f')]['sort']);_0x491cab[_0x3925('0x48')]=qs['filters'](_[_0x3925('0x64')](_0x4921a1[_0x3925('0x3f')],_0x23e81d[_0x3925('0x40')]));_0x491cab[_0x3925('0x48')][_0x3925('0x60')]=_0x3cbf88['id'];if(_0x4921a1[_0x3925('0x3f')]['filter']){_0x491cab[_0x3925('0x48')]=_['merge'](_0x491cab[_0x3925('0x48')],{'$or':_[_0x3925('0x65')](_0x491cab[_0x3925('0x54')],function(_0x4b9793){var _0x120dd9={};_0x120dd9[_0x4b9793]={'$like':'%'+_0x4921a1['query'][_0x3925('0x49')]+'%'};return _0x120dd9;})});}_0x491cab=_[_0x3925('0x4a')]({},_0x491cab,_0x4921a1[_0x3925('0x4f')]);return db[_0x3925('0x61')]['count']({'where':_0x491cab[_0x3925('0x48')]})[_0x3925('0x1e')](function(_0x253b73){_0x56d77d['count']=_0x253b73;if(_0x4921a1[_0x3925('0x3f')][_0x3925('0x55')]){_0x491cab[_0x3925('0x51')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x491cab);})[_0x3925('0x1e')](function(_0x180815){_0x56d77d[_0x3925('0x66')]=_0x180815;return _0x56d77d;});}})['then'](respondWithFilteredResult(_0xb8c7ae,_0x491cab))[_0x3925('0x28')](handleError(_0xb8c7ae,null));};exports['removeDispositions']=function(_0x2e5150,_0x1580b4,_0x2eea90){var _0x4e1d73;return db['FaxAccount']['find']({'where':{'id':_0x2e5150[_0x3925('0x5d')]['id']}})[_0x3925('0x1e')](handleEntityNotFound(_0x1580b4,null))[_0x3925('0x1e')](function(_0x38dc8f){if(_0x38dc8f){return _0x38dc8f[_0x3925('0x67')](_0x2e5150['query']['ids']);}})[_0x3925('0x1e')](respondWithStatusCode(_0x1580b4,null))[_0x3925('0x28')](handleError(_0x1580b4,null));};exports[_0x3925('0x68')]=function(_0x36ce7e,_0x26e1dc,_0x58eb84){if(_0x36ce7e[_0x3925('0x58')]['id']){delete _0x36ce7e['body']['id'];}return db[_0x3925('0x50')]['find']({'where':{'id':_0x36ce7e[_0x3925('0x5d')]['id']}})[_0x3925('0x1e')](handleEntityNotFound(_0x26e1dc,null))['then'](function(_0x23e14e){if(_0x23e14e){_0x36ce7e[_0x3925('0x58')][_0x3925('0x60')]=_0x23e14e['id'];return db[_0x3925('0x69')]['create'](_0x36ce7e['body']);}})[_0x3925('0x1e')](respondWithResult(_0x26e1dc,null))[_0x3925('0x28')](handleError(_0x26e1dc,null));};exports[_0x3925('0x6a')]=function(_0x10499a,_0x34d83a,_0x16c55b){var _0x109241={'raw':![],'where':{}};var _0x37df95={};var _0x1d31b5={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3925('0x6b')]({'where':{'id':_0x10499a[_0x3925('0x5d')]['id']}})[_0x3925('0x1e')](handleEntityNotFound(_0x34d83a,null))['then'](function(_0x555d26){if(_0x555d26){_0x37df95[_0x3925('0x3d')]=_[_0x3925('0x3e')](db[_0x3925('0x69')][_0x3925('0x3c')]);_0x37df95['query']=_['keys'](_0x10499a[_0x3925('0x3f')]);_0x37df95[_0x3925('0x40')]=_[_0x3925('0x41')](_0x37df95['model'],_0x37df95['query']);_0x109241[_0x3925('0x54')]=_[_0x3925('0x41')](_0x37df95['model'],qs['fields'](_0x10499a[_0x3925('0x3f')]['fields']));_0x109241[_0x3925('0x54')]=_0x109241['attributes'][_0x3925('0x43')]?_0x109241[_0x3925('0x54')]:_0x37df95[_0x3925('0x3d')];if(!_0x10499a[_0x3925('0x3f')]['hasOwnProperty']('nolimit')){_0x109241[_0x3925('0x45')]=qs[_0x3925('0x45')](_0x10499a[_0x3925('0x3f')]['limit']);_0x109241[_0x3925('0x2e')]=qs[_0x3925('0x2e')](_0x10499a['query'][_0x3925('0x2e')]);}_0x109241[_0x3925('0x46')]=qs[_0x3925('0x47')](_0x10499a[_0x3925('0x3f')]['sort']);_0x109241[_0x3925('0x48')]=qs[_0x3925('0x40')](_[_0x3925('0x64')](_0x10499a[_0x3925('0x3f')],_0x37df95[_0x3925('0x40')]));_0x109241[_0x3925('0x48')][_0x3925('0x60')]=_0x555d26['id'];if(_0x10499a[_0x3925('0x3f')][_0x3925('0x49')]){_0x109241['where']=_[_0x3925('0x4a')](_0x109241['where'],{'$or':_[_0x3925('0x65')](_0x109241[_0x3925('0x54')],function(_0xbf90a3){var _0x1f4c9d={};_0x1f4c9d[_0xbf90a3]={'$like':'%'+_0x10499a[_0x3925('0x3f')][_0x3925('0x49')]+'%'};return _0x1f4c9d;})});}_0x109241=_['merge']({},_0x109241,_0x10499a['options']);return db[_0x3925('0x69')][_0x3925('0x2d')]({'where':_0x109241[_0x3925('0x48')]})[_0x3925('0x1e')](function(_0x591d86){_0x1d31b5['count']=_0x591d86;if(_0x10499a['query'][_0x3925('0x55')]){_0x109241[_0x3925('0x51')]=[{'all':!![]}];}return db[_0x3925('0x69')][_0x3925('0x52')](_0x109241);})['then'](function(_0x3497e9){_0x1d31b5['rows']=_0x3497e9;return _0x1d31b5;});}})[_0x3925('0x1e')](respondWithFilteredResult(_0x34d83a,_0x109241))[_0x3925('0x28')](handleError(_0x34d83a,null));};exports['removeAnswers']=function(_0x32d7f4,_0x1bf594,_0x4692d7){var _0x1bd0c7;return db['FaxAccount'][_0x3925('0x56')]({'where':{'id':_0x32d7f4[_0x3925('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1bf594,null))[_0x3925('0x1e')](function(_0x5139bb){if(_0x5139bb){return _0x5139bb['removeAnswers'](_0x32d7f4[_0x3925('0x3f')][_0x3925('0x6c')]);}})['then'](respondWithStatusCode(_0x1bf594,null))[_0x3925('0x28')](handleError(_0x1bf594,null));};exports[_0x3925('0x6d')]=function(_0x358766,_0x2666a6,_0x412539){return db[_0x3925('0x6e')]['find']({'where':{'id':_0x358766[_0x3925('0x5d')]['id']}})[_0x3925('0x1e')](handleEntityNotFound(_0x2666a6,null))[_0x3925('0x1e')](function(_0x17521a){if(_0x17521a){return _0x17521a[_0x3925('0x6d')](_0x358766[_0x3925('0x58')]['ids'],_[_0x3925('0x6f')](_0x358766[_0x3925('0x58')],[_0x3925('0x6c'),'id'])||{});}})[_0x3925('0x1e')](respondWithResult(_0x2666a6,null))[_0x3925('0x28')](handleError(_0x2666a6,null));};exports[_0x3925('0x70')]=function(_0x22fdb6,_0x10e04e,_0x35d0ed){var _0x4b2fc6={'raw':![],'where':{}};var _0x2eb4c2={};var _0x316a7d={'count':0x0,'rows':[]};return db[_0x3925('0x50')]['findOne']({'where':{'id':_0x22fdb6['params']['id']}})[_0x3925('0x1e')](handleEntityNotFound(_0x10e04e,null))[_0x3925('0x1e')](function(_0x48835e){if(_0x48835e){_0x2eb4c2['model']=_[_0x3925('0x3e')](db[_0x3925('0x6e')][_0x3925('0x3c')]);_0x2eb4c2[_0x3925('0x3f')]=_[_0x3925('0x3e')](_0x22fdb6[_0x3925('0x3f')]);_0x2eb4c2['filters']=_['intersection'](_0x2eb4c2[_0x3925('0x3d')],_0x2eb4c2['query']);_0x4b2fc6['attributes']=_[_0x3925('0x41')](_0x2eb4c2[_0x3925('0x3d')],qs[_0x3925('0x42')](_0x22fdb6[_0x3925('0x3f')][_0x3925('0x42')]));_0x4b2fc6[_0x3925('0x54')]=_0x4b2fc6[_0x3925('0x54')]['length']?_0x4b2fc6['attributes']:_0x2eb4c2[_0x3925('0x3d')];if(!_0x22fdb6['query'][_0x3925('0x63')](_0x3925('0x44'))){_0x4b2fc6[_0x3925('0x45')]=qs[_0x3925('0x45')](_0x22fdb6[_0x3925('0x3f')]['limit']);_0x4b2fc6['offset']=qs[_0x3925('0x2e')](_0x22fdb6['query']['offset']);}_0x4b2fc6['order']=qs[_0x3925('0x47')](_0x22fdb6[_0x3925('0x3f')][_0x3925('0x47')]);_0x4b2fc6[_0x3925('0x48')]=qs[_0x3925('0x40')](_[_0x3925('0x64')](_0x22fdb6['query'],_0x2eb4c2[_0x3925('0x40')]));_0x4b2fc6[_0x3925('0x48')]['FaxAccountId']=_0x48835e['id'];if(_0x22fdb6['query']['filter']){_0x4b2fc6[_0x3925('0x48')]=_['merge'](_0x4b2fc6[_0x3925('0x48')],{'$or':_[_0x3925('0x65')](_0x4b2fc6[_0x3925('0x54')],function(_0x11c0c9){var _0x1ef8aa={};_0x1ef8aa[_0x11c0c9]={'$like':'%'+_0x22fdb6[_0x3925('0x3f')][_0x3925('0x49')]+'%'};return _0x1ef8aa;})});}_0x4b2fc6=_[_0x3925('0x4a')]({},_0x4b2fc6,_0x22fdb6[_0x3925('0x4f')]);return db[_0x3925('0x6e')][_0x3925('0x2d')]({'where':_0x4b2fc6['where']})[_0x3925('0x1e')](function(_0x316bad){_0x316a7d['count']=_0x316bad;if(_0x22fdb6[_0x3925('0x3f')][_0x3925('0x55')]){_0x4b2fc6[_0x3925('0x51')]=[{'model':db[_0x3925('0x71')],'as':_0x3925('0x72'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x3925('0x37'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x3925('0x73'),'attributes':['id',_0x3925('0x37'),'color'],'where':_0x22fdb6['query'][_0x3925('0x74')]?{'id':_0x22fdb6[_0x3925('0x3f')][_0x3925('0x74')]}:undefined,'required':_0x22fdb6[_0x3925('0x3f')]['tag']?!![]:![]}];}return db[_0x3925('0x6e')]['findAll'](_0x4b2fc6);})['then'](function(_0x585ea1){_0x316a7d[_0x3925('0x66')]=_0x585ea1;return _0x316a7d;});}})[_0x3925('0x1e')](respondWithFilteredResult(_0x10e04e,_0x4b2fc6))['catch'](handleError(_0x10e04e,null));};exports[_0x3925('0x75')]=function(_0x32b2d1,_0x265fc6,_0x2d1427){return db['FaxAccount']['findOne']({'where':{'id':_0x32b2d1['params']['id']}})[_0x3925('0x1e')](handleEntityNotFound(_0x265fc6,null))[_0x3925('0x1e')](function(_0x5edb26){if(_0x5edb26){return db[_0x3925('0x76')][_0x3925('0x77')](function(_0x3eaa8c){return db[_0x3925('0x78')]['destroy']({'where':{'FaxAccountId':_0x32b2d1[_0x3925('0x5d')]['id']},'transaction':_0x3eaa8c})[_0x3925('0x1e')](function(_0x2c4471){var _0xfa1c0c=_[_0x3925('0x65')](_0x32b2d1[_0x3925('0x58')],function(_0x1a49ba){_0x1a49ba['FaxAccountId']=_0x32b2d1[_0x3925('0x5d')]['id'];return _0x1a49ba;});return db[_0x3925('0x78')][_0x3925('0x79')](_0xfa1c0c,{'transaction':_0x3eaa8c});});})[_0x3925('0x1e')](function(){return db['FaxApplication'][_0x3925('0x7a')]({'where':{'FaxAccountId':_0x32b2d1['params']['id']},'order':'priority'});});}})[_0x3925('0x1e')](respondWithResult(_0x265fc6,null))['catch'](handleError(_0x265fc6,null));};exports[_0x3925('0x7b')]=function(_0x2c8a66,_0x4b3907,_0x599224){var _0x540e3e={};var _0x2d44ca={};var _0x2738c3;var _0xb776fe;return db[_0x3925('0x50')][_0x3925('0x6b')]({'where':{'id':_0x2c8a66[_0x3925('0x5d')]['id']}})[_0x3925('0x1e')](handleEntityNotFound(_0x4b3907,null))[_0x3925('0x1e')](function(_0x68939){if(_0x68939){_0x2738c3=_0x68939;_0x2d44ca['model']=_[_0x3925('0x3e')](db[_0x3925('0x78')]['rawAttributes']);_0x2d44ca[_0x3925('0x3f')]=_[_0x3925('0x3e')](_0x2c8a66[_0x3925('0x3f')]);_0x2d44ca[_0x3925('0x40')]=_[_0x3925('0x41')](_0x2d44ca[_0x3925('0x3d')],_0x2d44ca[_0x3925('0x3f')]);_0x540e3e[_0x3925('0x54')]=_[_0x3925('0x41')](_0x2d44ca[_0x3925('0x3d')],qs[_0x3925('0x42')](_0x2c8a66[_0x3925('0x3f')][_0x3925('0x42')]));_0x540e3e[_0x3925('0x54')]=_0x540e3e[_0x3925('0x54')][_0x3925('0x43')]?_0x540e3e['attributes']:_0x2d44ca[_0x3925('0x3d')];_0x540e3e[_0x3925('0x46')]=qs[_0x3925('0x47')](_0x2c8a66[_0x3925('0x3f')][_0x3925('0x47')]);_0x540e3e['where']=qs['filters'](_[_0x3925('0x64')](_0x2c8a66[_0x3925('0x3f')],_0x2d44ca[_0x3925('0x40')]));if(_0x2c8a66[_0x3925('0x3f')][_0x3925('0x49')]){_0x540e3e[_0x3925('0x48')]=_[_0x3925('0x4a')](_0x540e3e[_0x3925('0x48')],{'$or':_[_0x3925('0x65')](_0x540e3e['attributes'],function(_0x17ca19){var _0x53eb56={};_0x53eb56[_0x17ca19]={'$like':'%'+_0x2c8a66[_0x3925('0x3f')]['filter']+'%'};return _0x53eb56;})});}_0x540e3e=_[_0x3925('0x4a')]({},_0x540e3e,_0x2c8a66[_0x3925('0x4f')]);return _0x2738c3['getApplications'](_0x540e3e);}})[_0x3925('0x1e')](function(_0x2e8a3e){if(_0x2e8a3e){_0xb776fe=_0x2e8a3e[_0x3925('0x43')];if(!_0x2c8a66[_0x3925('0x3f')][_0x3925('0x63')](_0x3925('0x44'))){_0x540e3e[_0x3925('0x45')]=qs[_0x3925('0x45')](_0x2c8a66[_0x3925('0x3f')]['limit']);_0x540e3e['offset']=qs[_0x3925('0x2e')](_0x2c8a66[_0x3925('0x3f')][_0x3925('0x2e')]);}return _0x2738c3['getApplications'](_0x540e3e);}})[_0x3925('0x1e')](function(_0x346ce2){if(_0x346ce2){return _0x346ce2?{'count':_0xb776fe,'rows':_0x346ce2}:null;}})[_0x3925('0x1e')](respondWithResult(_0x4b3907,null))['catch'](handleError(_0x4b3907,null));};function Extension(_0x235054,_0xe8b47c,_0xc73236,_0x56ff16){this[_0x3925('0x7c')]=_0x3925('0x7d');this['exten']=_0x235054[_0x3925('0x7e')];this[_0x3925('0x7f')]=_0x56ff16;this[_0x3925('0x4b')]=_0x3925('0x80');this[_0x3925('0x81')]=_0x3925('0x82');this[_0x3925('0x60')]=_0x235054['id'];this[_0x3925('0x83')]=_0xe8b47c;this[_0x3925('0x84')]=_0xc73236;}function createExtensionsReciveFax(_0xab6f9e){var _0x116445=0x1;var _0x3e5411=[];_0x3e5411[_0x3925('0x85')](new Extension(_0xab6f9e,_0x116445,'',_0x3925('0x86')));_0x116445+=0x1;_0x3e5411[_0x3925('0x85')](new Extension(_0xab6f9e,_0x116445,'CDR(type)=inbound-fax','Set'));_0x116445+=0x1;for(var _0x2803f4 in _0xab6f9e){if(_0xab6f9e[_0x3925('0x63')](_0x2803f4)&&(_0x2803f4===_0x3925('0x87')||_0x2803f4==='localstationid'||_0x2803f4==='gateway'||_0x2803f4===_0x3925('0x88')||_0x2803f4===_0x3925('0x89')||_0x2803f4==='maxrate'||_0x2803f4==='minrate'||_0x2803f4===_0x3925('0x8a')||_0x2803f4==='t38timeout')){_0x3e5411[_0x3925('0x85')](new Extension(_0xab6f9e,_0x116445,_0x3925('0x8b')+_0x2803f4+')='+_0xab6f9e[_0x2803f4],_0x3925('0x8c')));_0x116445+=0x1;}}_0x3e5411[_0x3925('0x85')](new Extension(_0xab6f9e,_0x116445,'6',_0x3925('0x8d')));_0x116445+=0x1;_0x3e5411[_0x3925('0x85')](new Extension(_0xab6f9e,_0x116445,_0x3925('0x8e'),_0x3925('0x8f')));_0x116445=0x0;return _0x3e5411;}exports['addAccountApplications']=function(_0x299246,_0x111d49,_0x552e0f){var _0x14ee83;return db[_0x3925('0x76')]['transaction'](function(_0x3cd0b8){return db[_0x3925('0x50')][_0x3925('0x57')](_0x299246['body'],{'transaction':_0x3cd0b8})[_0x3925('0x1e')](function(_0x4d770b){_0x14ee83=_0x4d770b['get']({'plain':!![]});return db['VoiceExtension'][_0x3925('0x79')](createExtensionsReciveFax(_0x14ee83),{'transaction':_0x3cd0b8});});})[_0x3925('0x1e')](function(){return _0x14ee83;})['then'](respondWithResult(_0x111d49,null))[_0x3925('0x28')](handleError(_0x111d49,null));};exports[_0x3925('0x90')]=function(_0x169eb3,_0x322d0f,_0x219241){var _0x484776;return db['sequelize'][_0x3925('0x77')](function(_0x481011){return db[_0x3925('0x50')][_0x3925('0x91')](_0x169eb3['body'],{'where':{'id':_0x169eb3[_0x3925('0x58')]['id']},'transaction':_0x481011})['then'](function(_0x232b29){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x169eb3[_0x3925('0x58')]['id']},'transaction':_0x481011})[_0x3925('0x1e')](function(_0x3d92eb){return db['VoiceExtension'][_0x3925('0x79')](createExtensionsReciveFax(_[_0x3925('0x6f')](_0x169eb3[_0x3925('0x58')],[_0x3925('0x92'),_0x3925('0x4c'),_0x3925('0x93'),_0x3925('0x94'),'TrunkId',_0x3925('0x95')])),{'transaction':_0x481011});});});})['then'](function(){return db[_0x3925('0x50')]['findById'](_0x169eb3['body']['id']);})['then'](respondWithResult(_0x322d0f,null))['catch'](handleError(_0x322d0f,null));};exports['getMessages']=function(_0x2f98d6,_0x2f2e84,_0x19f007){var _0x79a5b4={'raw':!![],'where':{}};var _0x1758bd={};var _0x1466ca={'count':0x0,'rows':[]};return db[_0x3925('0x50')][_0x3925('0x6b')]({'where':{'id':_0x2f98d6[_0x3925('0x5d')]['id']}})[_0x3925('0x1e')](handleEntityNotFound(_0x2f2e84,null))[_0x3925('0x1e')](function(_0x3d0ac3){if(_0x3d0ac3){_0x1758bd['model']=_['keys'](db[_0x3925('0x96')][_0x3925('0x3c')]);_0x1758bd[_0x3925('0x3f')]=_[_0x3925('0x3e')](_0x2f98d6['query']);_0x1758bd['filters']=_[_0x3925('0x41')](_0x1758bd[_0x3925('0x3d')],_0x1758bd[_0x3925('0x3f')]);_0x79a5b4[_0x3925('0x54')]=_[_0x3925('0x41')](_0x1758bd[_0x3925('0x3d')],qs[_0x3925('0x42')](_0x2f98d6[_0x3925('0x3f')]['fields']));_0x79a5b4[_0x3925('0x54')]=_0x79a5b4[_0x3925('0x54')][_0x3925('0x43')]?_0x79a5b4[_0x3925('0x54')]:_0x1758bd[_0x3925('0x3d')];if(!_0x2f98d6[_0x3925('0x3f')][_0x3925('0x63')](_0x3925('0x44'))){_0x79a5b4[_0x3925('0x45')]=qs['limit'](_0x2f98d6[_0x3925('0x3f')][_0x3925('0x45')]);_0x79a5b4['offset']=qs['offset'](_0x2f98d6[_0x3925('0x3f')]['offset']);}_0x79a5b4[_0x3925('0x46')]=qs[_0x3925('0x47')](_0x2f98d6[_0x3925('0x3f')][_0x3925('0x47')]);_0x79a5b4[_0x3925('0x48')]=qs['filters'](_[_0x3925('0x64')](_0x2f98d6[_0x3925('0x3f')],_0x1758bd[_0x3925('0x40')]));_0x79a5b4['where'][_0x3925('0x60')]=_0x3d0ac3['id'];if(_0x2f98d6[_0x3925('0x3f')]['filter']){_0x79a5b4['where']=_[_0x3925('0x4a')](_0x79a5b4[_0x3925('0x48')],{'$or':_[_0x3925('0x65')](_0x79a5b4[_0x3925('0x54')],function(_0x4812b6){var _0x238a50={};_0x238a50[_0x4812b6]={'$like':'%'+_0x2f98d6[_0x3925('0x3f')]['filter']+'%'};return _0x238a50;})});}if(_0x2f98d6[_0x3925('0x3f')]['$gte']){var _0x194099=_0x2f98d6['query'][_0x3925('0x97')][_0x3925('0x98')](',');var _0x280386={};_0x280386[_0x194099[0x0]]={'$gte':moment(_0x194099[0x1])[_0x3925('0x99')]('YYYY-MM-DD\x20HH:mm:ss')};_0x79a5b4[_0x3925('0x48')]=_[_0x3925('0x4a')](_0x79a5b4[_0x3925('0x48')],_0x280386);}_0x79a5b4=_[_0x3925('0x4a')]({},_0x79a5b4,_0x2f98d6[_0x3925('0x4f')]);return db[_0x3925('0x96')][_0x3925('0x2d')]({'where':_0x79a5b4['where']})[_0x3925('0x1e')](function(_0x2f0675){_0x1466ca[_0x3925('0x2d')]=_0x2f0675;if(_0x2f98d6[_0x3925('0x3f')][_0x3925('0x55')]){_0x79a5b4[_0x3925('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0x3925('0x52')](_0x79a5b4);})[_0x3925('0x1e')](function(_0x5adc4d){_0x1466ca[_0x3925('0x66')]=_0x5adc4d;return _0x1466ca;});}})[_0x3925('0x1e')](respondWithFilteredResult(_0x2f2e84,_0x79a5b4))[_0x3925('0x28')](handleError(_0x2f2e84,null));};exports[_0x3925('0x38')]=function(_0x39c55b,_0x325568,_0xddcbf7){var _0x3971d1,_0x3a5819={},_0x3869a4;if(_0x39c55b[_0x3925('0x58')]['to']){_0x3869a4=_0x39c55b[_0x3925('0x58')]['to'][0x0];}return db[_0x3925('0x50')][_0x3925('0x56')]({'where':{'id':_0x39c55b[_0x3925('0x5d')]['id']},'include':[{'model':db[_0x3925('0x9a')],'as':_0x3925('0x9b'),'include':[{'model':db[_0x3925('0x71')],'as':'Contacts','where':{'fax':_0x3869a4},'limit':0x1,'order':[['updatedAt',_0x3925('0x9c')]]}]}]})[_0x3925('0x1e')](handleEntityNotFound(_0x325568,null))[_0x3925('0x1e')](function(_0x42972f){_0x3971d1=_0x42972f;if(_0x39c55b[_0x3925('0x58')][_0x3925('0x9d')]&&_0x39c55b[_0x3925('0x58')]['attachments'][_0x3925('0x43')]){for(var _0x2d39ce=0x0;_0x2d39ce<_0x39c55b[_0x3925('0x58')][_0x3925('0x9d')]['length'];_0x2d39ce+=0x1){_0x39c55b[_0x3925('0x58')][_0x3925('0x9d')][_0x2d39ce]={'filename':_0x39c55b[_0x3925('0x58')][_0x3925('0x9d')][_0x2d39ce]['name'],'id':_0x39c55b['body'][_0x3925('0x9d')][_0x2d39ce]['id'],'path':path[_0x3925('0x9e')](config['root'],_0x3925('0x9f'),_0x39c55b['body'][_0x3925('0x9d')][_0x2d39ce]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x3925('0xa0'),{'FaxAccountId':_['isNil'](_0x39c55b[_0x3925('0x5d')]['id'])?undefined:_0x39c55b[_0x3925('0x5d')]['id'],'path':_[_0x3925('0xa1')](_0x39c55b['body'][_0x3925('0x9d')][0x0][_0x3925('0x8')])?undefined:_0x39c55b['body'][_0x3925('0x9d')][0x0][_0x3925('0x8')],'fax':_[_0x3925('0xa1')](_0x39c55b[_0x3925('0x58')]['to'][0x0])?undefined:_0x39c55b['body']['to'][0x0]},client9002);})[_0x3925('0x1e')](function(){if(_0x3971d1){if(_[_0x3925('0xa1')](_0x39c55b[_0x3925('0x58')]['from'])){_0x39c55b[_0x3925('0x58')][_0x3925('0xa2')]=util[_0x3925('0x99')]('\x22%s\x22\x20<%s>',_0x3971d1[_0x3925('0x37')],_0x3971d1[_0x3925('0xa3')]);}if(_0x3971d1[_0x3925('0x9b')]){if(_0x3971d1[_0x3925('0x9b')][_0x3925('0xa4')][_0x3925('0x43')]){return _0x3971d1[_0x3925('0x9b')][_0x3925('0xa4')][0x0];}else{return db[_0x3925('0x71')]['create'](_[_0x3925('0x17')](_0x39c55b[_0x3925('0x58')],{'firstName':_0x39c55b[_0x3925('0x58')]['to'][0x0],'phone':_0x39c55b[_0x3925('0x58')]['to'][0x0],'fax':_0x39c55b[_0x3925('0x58')]['to'][0x0],'ListId':_0x3971d1[_0x3925('0x95')]}));}}else{throw new Error(_0x3925('0xa5'));}}else{throw new Error(_0x3925('0xa6'));}})[_0x3925('0x1e')](function(_0x428ba3){if(_0x428ba3){return db[_0x3925('0x6e')][_0x3925('0x56')]({'where':{'ContactId':_0x428ba3['id'],'closed':![],'FaxAccountId':_0x3971d1['id']}})['then'](function(_0x2d9bea){if(_0x2d9bea){return[_0x2d9bea,![]];}return db[_0x3925('0x6e')][_0x3925('0x57')]({'UserId':_0x39c55b[_0x3925('0x59')]['id'],'ContactId':_0x428ba3['id'],'FaxAccountId':_0x3971d1['id'],'fax':_0x39c55b[_0x3925('0x58')]['to'][0x0],'firstMsgDirection':_0x3925('0xa7'),'Messages':[_[_0x3925('0x4a')](_0x39c55b['body'],{'read':![],'body':_0x39c55b[_0x3925('0x58')][_0x3925('0x9d')][0x0][_0x3925('0xa8')],'FaxAccountId':_0x3971d1['id'],'UserId':_0x39c55b[_0x3925('0x59')]['id'],'ContactId':_0x428ba3['id'],'AttachmentId':_0x39c55b[_0x3925('0x58')][_0x3925('0x9d')][0x0]['id']})]},{'include':[{'model':db[_0x3925('0x96')],'as':'Messages'}]})[_0x3925('0x1e')](function(_0x5994e8){return[_0x5994e8,!![]];});});}else{throw new Error(_0x3925('0xa9'));}})['spread'](function(_0x4de7ae,_0x1092fa){if(_0x1092fa){return _0x4de7ae;}return db[_0x3925('0x96')][_0x3925('0x57')]({'direction':'out','read':![],'body':_0x39c55b[_0x3925('0x58')][_0x3925('0x9d')][0x0][_0x3925('0xa8')],'FaxAccountId':_0x3971d1['id'],'FaxInteractionId':_0x4de7ae['id'],'UserId':_0x39c55b[_0x3925('0x59')]['id'],'ContactId':_0x4de7ae[_0x3925('0xaa')],'AttachmentId':_0x39c55b[_0x3925('0x58')][_0x3925('0x9d')][0x0]['id']})[_0x3925('0x1e')](function(_0xa6db1c){_0x4de7ae[_0x3925('0xab')][_0x3925('0xac')]=[];_0x4de7ae[_0x3925('0xab')][_0x3925('0xac')][_0x3925('0x85')](_0xa6db1c[_0x3925('0xab')]);return _0x4de7ae;});})[_0x3925('0x1e')](function(_0x267f2d){respondWithRpcPromise(_0x3925('0xad'),_0x3925('0xad'),{'FaxAccountId':_[_0x3925('0xa1')](_0x39c55b[_0x3925('0x5d')]['id'])?undefined:_0x39c55b[_0x3925('0x5d')]['id'],'path':_[_0x3925('0xa1')](_0x39c55b['body']['attachments'][0x0][_0x3925('0x8')])?undefined:_0x39c55b[_0x3925('0x58')][_0x3925('0x9d')][0x0][_0x3925('0x8')],'fax':_[_0x3925('0xa1')](_0x39c55b[_0x3925('0x58')]['to'][0x0])?undefined:_0x39c55b[_0x3925('0x58')]['to'][0x0],'AttachmentId':_0x39c55b[_0x3925('0x58')][_0x3925('0x9d')][0x0]['id']},client9002)[_0x3925('0x1e')](function(_0x5f158b){logger[_0x3925('0x1f')](_0x3925('0xae'),_0x5f158b);})[_0x3925('0x28')](function(_0x2a90d6){logger[_0x3925('0x1f')](_0x3925('0xae'),_0x2a90d6);});return _0x267f2d;})['then'](respondWithResult(_0x325568,null))[_0x3925('0x28')](handleError(_0x325568,null));};exports[_0x3925('0xaf')]=function(_0x2fb036,_0x231d4f,_0x215fd4){return db[_0x3925('0x50')][_0x3925('0x56')]({'where':{'id':_0x2fb036[_0x3925('0x5d')]['id']}})['then'](handleEntityNotFound(_0x231d4f,null))[_0x3925('0x1e')](function(_0x47cb05){if(_0x47cb05){return _0x47cb05['addAgents'](_0x2fb036['body'][_0x3925('0x6c')],_[_0x3925('0x6f')](_0x2fb036[_0x3925('0x58')],[_0x3925('0x6c'),'id'])||{})[_0x3925('0xb0')](function(_0xfcef05){for(var _0x576a12=0x0;_0x576a12<_0x2fb036[_0x3925('0x58')]['ids'][_0x3925('0x43')];_0x576a12+=0x1){socket[_0x3925('0xb1')](_0x3925('0xb2'),{'UserId':_0x2fb036['body'][_0x3925('0x6c')][_0x576a12],'FaxAccountId':_0x2fb036[_0x3925('0x5d')]['id']});}return _0xfcef05;});}})['then'](respondWithResult(_0x231d4f,null))[_0x3925('0x28')](handleError(_0x231d4f,null));};exports['removeAgents']=function(_0x2e0e60,_0x3892df,_0xc1fffa){var _0x2a622b;return db['FaxAccount']['find']({'where':{'id':_0x2e0e60['params']['id']}})[_0x3925('0x1e')](handleEntityNotFound(_0x3892df,null))[_0x3925('0x1e')](function(_0x16acea){if(_0x16acea){return _0x16acea[_0x3925('0xb3')](_0x2e0e60[_0x3925('0x3f')][_0x3925('0x6c')])[_0x3925('0x1e')](function(_0x3012cd){if(_[_0x3925('0xb4')](_0x2e0e60[_0x3925('0x3f')][_0x3925('0x6c')])){for(var _0x253d9e=0x0;_0x253d9e<_0x2e0e60[_0x3925('0x3f')]['ids']['length'];_0x253d9e+=0x1){socket[_0x3925('0xb1')](_0x3925('0xb5'),{'UserId':_0x2e0e60[_0x3925('0x3f')][_0x3925('0x6c')][_0x253d9e],'FaxAccountId':_0x2e0e60[_0x3925('0x5d')]['id']});}}else{socket['emit'](_0x3925('0xb5'),{'UserId':_0x2e0e60[_0x3925('0x3f')][_0x3925('0x6c')],'FaxAccountId':_0x2e0e60[_0x3925('0x5d')]['id']});}});}})[_0x3925('0x1e')](respondWithStatusCode(_0x3892df,null))[_0x3925('0x28')](handleError(_0x3892df,null));};exports[_0x3925('0xb6')]=function(_0xf178b4,_0x58dd1f,_0x3256cd){var _0x35b1e1={};var _0x37355b={};var _0x1dc135;var _0x6b0f38;return db[_0x3925('0x50')][_0x3925('0x6b')]({'where':{'id':_0xf178b4[_0x3925('0x5d')]['id']}})[_0x3925('0x1e')](handleEntityNotFound(_0x58dd1f,null))[_0x3925('0x1e')](function(_0x4e6f46){if(_0x4e6f46){_0x1dc135=_0x4e6f46;_0x37355b[_0x3925('0x3d')]=_[_0x3925('0x3e')](db[_0x3925('0xb7')][_0x3925('0x3c')]);_0x37355b[_0x3925('0x3f')]=_['keys'](_0xf178b4[_0x3925('0x3f')]);_0x37355b[_0x3925('0x40')]=_[_0x3925('0x41')](_0x37355b[_0x3925('0x3d')],_0x37355b[_0x3925('0x3f')]);_0x35b1e1['attributes']=_[_0x3925('0x41')](_0x37355b['model'],qs[_0x3925('0x42')](_0xf178b4['query'][_0x3925('0x42')]));_0x35b1e1[_0x3925('0x54')]=_0x35b1e1['attributes'][_0x3925('0x43')]?_0x35b1e1['attributes']:_0x37355b[_0x3925('0x3d')];_0x35b1e1[_0x3925('0x46')]=qs[_0x3925('0x47')](_0xf178b4[_0x3925('0x3f')]['sort']);_0x35b1e1[_0x3925('0x48')]=qs[_0x3925('0x40')](_['pick'](_0xf178b4[_0x3925('0x3f')],_0x37355b[_0x3925('0x40')]));if(_0xf178b4[_0x3925('0x3f')][_0x3925('0x49')]){_0x35b1e1[_0x3925('0x48')]=_[_0x3925('0x4a')](_0x35b1e1[_0x3925('0x48')],{'$or':_[_0x3925('0x65')](_0x35b1e1[_0x3925('0x54')],function(_0x43765d){var _0x310018={};_0x310018[_0x43765d]={'$like':'%'+_0xf178b4[_0x3925('0x3f')][_0x3925('0x49')]+'%'};return _0x310018;})});}_0x35b1e1=_['merge']({},_0x35b1e1,_0xf178b4[_0x3925('0x4f')]);return _0x1dc135[_0x3925('0xb6')](_0x35b1e1);}})['then'](function(_0x20fca1){if(_0x20fca1){_0x6b0f38=_0x20fca1[_0x3925('0x43')];if(!_0xf178b4[_0x3925('0x3f')]['hasOwnProperty'](_0x3925('0x44'))){_0x35b1e1[_0x3925('0x45')]=qs[_0x3925('0x45')](_0xf178b4[_0x3925('0x3f')][_0x3925('0x45')]);_0x35b1e1[_0x3925('0x2e')]=qs[_0x3925('0x2e')](_0xf178b4['query'][_0x3925('0x2e')]);}return _0x1dc135[_0x3925('0xb6')](_0x35b1e1);}})[_0x3925('0x1e')](function(_0x2fea97){if(_0x2fea97){return _0x2fea97?{'count':_0x6b0f38,'rows':_0x2fea97}:null;}})[_0x3925('0x1e')](respondWithResult(_0x58dd1f,null))['catch'](handleError(_0x58dd1f,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 1a65168..68e4b8e 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 _0x643a=['hook','setMaxListeners','save','update','remove','emit'];(function(_0x299f79,_0x4ff681){var _0x518dad=function(_0x53e89c){while(--_0x53e89c){_0x299f79['push'](_0x299f79['shift']());}};_0x518dad(++_0x4ff681);}(_0x643a,0x18d));var _0xa643=function(_0x419bac,_0x847e80){_0x419bac=_0x419bac-0x0;var _0x3373d4=_0x643a[_0x419bac];return _0x3373d4;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa643('0x0')](0x0);var events={'afterCreate':_0xa643('0x1'),'afterUpdate':_0xa643('0x2'),'afterDestroy':_0xa643('0x3')};function emitEvent(_0x1781b5){return function(_0x1fdaaf,_0x2dc6d2,_0x2ca492){FaxAccountEvents[_0xa643('0x4')](_0x1781b5+':'+_0x1fdaaf['id'],_0x1fdaaf);FaxAccountEvents[_0xa643('0x4')](_0x1781b5,_0x1fdaaf);_0x2ca492(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xa643('0x5')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x7bf7=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x199610,_0x53545f){var _0x44250d=function(_0x5e5088){while(--_0x5e5088){_0x199610['push'](_0x199610['shift']());}};_0x44250d(++_0x53545f);}(_0x7bf7,0xae));var _0x77bf=function(_0x30873b,_0x50b478){_0x30873b=_0x30873b-0x0;var _0x1858d3=_0x7bf7[_0x30873b];return _0x1858d3;};'use strict';var EventEmitter=require(_0x77bf('0x0'));var FaxAccount=require(_0x77bf('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x77bf('0x2')](0x0);var events={'afterCreate':_0x77bf('0x3'),'afterUpdate':_0x77bf('0x4'),'afterDestroy':'remove'};function emitEvent(_0xf036ee){return function(_0x50212f,_0x1368da,_0x327763){FaxAccountEvents[_0x77bf('0x5')](_0xf036ee+':'+_0x50212f['id'],_0x50212f);FaxAccountEvents[_0x77bf('0x5')](_0xf036ee,_0x50212f);_0x327763(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x77bf('0x6')](e,emitEvent(event));}}module[_0x77bf('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index d52dc1b..59a85f0 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 _0x7497=['exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./faxAccount.attributes'];(function(_0x3483cb,_0x57e72c){var _0x5a2263=function(_0x58ea85){while(--_0x58ea85){_0x3483cb['push'](_0x3483cb['shift']());}};_0x5a2263(++_0x57e72c);}(_0x7497,0x13c));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var logger=require(_0x7749('0x2'))(_0x7749('0x3'));var moment=require(_0x7749('0x4'));var BPromise=require(_0x7749('0x5'));var rp=require(_0x7749('0x6'));var attributes=require(_0x7749('0x7'));module[_0x7749('0x8')]=function(_0x6e8b14,_0x1ab389){return _0x6e8b14[_0x7749('0x9')](_0x7749('0xa'),attributes,{'tableName':_0x7749('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5554=['moment','bluebird','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0x5554,0x167));var _0x4555=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x5554[_0x424a9a];return _0xa7831c;};'use strict';var _=require('lodash');var util=require(_0x4555('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4555('0x1'));var BPromise=require(_0x4555('0x2'));var rp=require('request-promise');var attributes=require(_0x4555('0x3'));module[_0x4555('0x4')]=function(_0x5ce9fc,_0x5d63d3){return _0x5ce9fc[_0x4555('0x5')](_0x4555('0x6'),attributes,{'tableName':_0x4555('0x7'),'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 cfd653d..7b6aaaa 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 _0x1ae6=['length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','unshift','name','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','FaxAccount','findAll','options','limit','include','model','attributes','map','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','updatedAt','difference','keys','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','Contacts','defaults','ListId','create','FaxInteraction','Contact\x20not\x20found','autoclose','push'];(function(_0x5858a5,_0x56c33f){var _0x2de7f3=function(_0x7619cd){while(--_0x7619cd){_0x5858a5['push'](_0x5858a5['shift']());}};_0x2de7f3(++_0x56c33f);}(_0x1ae6,0x65));var _0x61ae=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x1ae6[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x61ae('0x0'));var util=require(_0x61ae('0x1'));var moment=require(_0x61ae('0x2'));var BPromise=require(_0x61ae('0x3'));var rs=require(_0x61ae('0x4'));var fs=require('fs');var Redis=require(_0x61ae('0x5'));var db=require(_0x61ae('0x6'))['db'];var utils=require(_0x61ae('0x7'));var logger=require(_0x61ae('0x8'))(_0x61ae('0x9'));var config=require(_0x61ae('0xa'));var jayson=require(_0x61ae('0xb'));var client=jayson[_0x61ae('0xc')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x61ae('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61ae('0xd')]));require(_0x61ae('0xe'))['register'](socket);function respondWithRpcPromise(_0x5eea1b,_0x47c1cc,_0x3872ba){return new BPromise(function(_0x480e10,_0x41ffbb){return client[_0x61ae('0xf')](_0x5eea1b,_0x3872ba)[_0x61ae('0x10')](function(_0x469c78){logger[_0x61ae('0x11')](_0x61ae('0x12'),_0x47c1cc,'request\x20sent');logger[_0x61ae('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x47c1cc,_0x61ae('0x14'),JSON[_0x61ae('0x15')](_0x469c78));if(_0x469c78[_0x61ae('0x16')]){if(_0x469c78[_0x61ae('0x16')][_0x61ae('0x17')]===0x1f4){logger[_0x61ae('0x16')](_0x61ae('0x12'),_0x47c1cc,_0x469c78['error']['message']);return _0x41ffbb(_0x469c78[_0x61ae('0x16')][_0x61ae('0x18')]);}logger['error'](_0x61ae('0x12'),_0x47c1cc,_0x469c78[_0x61ae('0x16')]['message']);return _0x480e10(_0x469c78[_0x61ae('0x16')][_0x61ae('0x18')]);}else{logger[_0x61ae('0x11')](_0x61ae('0x12'),_0x47c1cc,_0x61ae('0x14'));_0x480e10(_0x469c78[_0x61ae('0x19')][_0x61ae('0x18')]);}})[_0x61ae('0x1a')](function(_0x5de1c2){logger[_0x61ae('0x16')](_0x61ae('0x12'),_0x47c1cc,_0x5de1c2);_0x41ffbb(_0x5de1c2);});});}exports['GetFaxAccount']=function(_0xd6b7fd){var _0x533cef=this;return new Promise(function(_0x2bd767,_0x516510){return db[_0x61ae('0x1b')][_0x61ae('0x1c')]({'raw':_0xd6b7fd[_0x61ae('0x1d')]?_0xd6b7fd[_0x61ae('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xd6b7fd[_0x61ae('0x1d')]?_0xd6b7fd[_0x61ae('0x1d')]['where']||null:null,'attributes':_0xd6b7fd[_0x61ae('0x1d')]?_0xd6b7fd[_0x61ae('0x1d')]['attributes']||null:null,'limit':_0xd6b7fd[_0x61ae('0x1d')]?_0xd6b7fd['options'][_0x61ae('0x1e')]||null:null,'include':_0xd6b7fd[_0x61ae('0x1d')]?_0xd6b7fd[_0x61ae('0x1d')]['include']?_['map'](_0xd6b7fd[_0x61ae('0x1d')][_0x61ae('0x1f')],function(_0x40022b){return{'model':db[_0x40022b[_0x61ae('0x20')]],'as':_0x40022b['as'],'attributes':_0x40022b[_0x61ae('0x21')],'include':_0x40022b[_0x61ae('0x1f')]?_['map'](_0x40022b[_0x61ae('0x1f')],function(_0x3d8bbb){return{'model':db[_0x3d8bbb[_0x61ae('0x20')]],'as':_0x3d8bbb['as'],'attributes':_0x3d8bbb[_0x61ae('0x21')],'include':_0x3d8bbb[_0x61ae('0x1f')]?_[_0x61ae('0x22')](_0x3d8bbb[_0x61ae('0x1f')],function(_0x365974){return{'model':db[_0x365974[_0x61ae('0x20')]],'as':_0x365974['as'],'attributes':_0x365974['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x306a94){logger[_0x61ae('0x11')](_0x61ae('0x23'),_0xd6b7fd);logger['debug']('GetFaxAccount',_0xd6b7fd,JSON[_0x61ae('0x15')](_0x306a94));_0x2bd767(_0x306a94);})['catch'](function(_0x3fd4b2){logger[_0x61ae('0x16')](_0x61ae('0x23'),_0x3fd4b2['message'],_0xd6b7fd);_0x516510(_0x533cef['error'](0x1f4,_0x3fd4b2[_0x61ae('0x18')]));});});};exports[_0x61ae('0x24')]=function(_0x2dca36,_0x180b2f,_0x53b085){var _0x214b4c=this;return new Promise(function(_0x5ac3aa,_0x4c60b5){var _0x44cf4b={'body':_0x2dca36[_0x61ae('0x25')],'channel':_0x61ae('0x26')};var _0x38499d=[];var _0x470d4c=[];var _0x12042f={};return db[_0x61ae('0x27')][_0x61ae('0x28')]()[_0x61ae('0x10')](function(_0x13e91e){if(!_0x13e91e){throw new db[(_0x61ae('0x29'))][(_0x61ae('0x2a'))]('no\x20available\x20attributes');}_0x38499d=_['difference'](_['keys'](_0x13e91e),['createdAt',_0x61ae('0x2b')]);_0x470d4c=_[_0x61ae('0x2c')](_[_0x61ae('0x2d')](_0x13e91e),['createdAt',_0x61ae('0x2b'),'CompanyId','ListId']);if(_0x2dca36[_0x61ae('0x25')]['id']){delete _0x2dca36['body']['id'];}if(_[_0x61ae('0x2e')](_0x2dca36['body'][_0x61ae('0x2f')])){throw new db[(_0x61ae('0x29'))]['ValidationError'](_0x61ae('0x30'));}if(_['isNil'](_0x2dca36['body'][_0x61ae('0x25')])||_0x2dca36[_0x61ae('0x25')][_0x61ae('0x25')]===''){throw new db[(_0x61ae('0x29'))][(_0x61ae('0x2a'))](_0x61ae('0x31'));}if(_[_0x61ae('0x2e')](_0x2dca36['body']['mapKey'])){throw new db[(_0x61ae('0x29'))][(_0x61ae('0x2a'))](_0x61ae('0x32')+_0x470d4c);}if(!_[_0x61ae('0x33')](_0x470d4c,_0x2dca36[_0x61ae('0x25')][_0x61ae('0x34')])){throw new db['Sequelize'][(_0x61ae('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x470d4c);}_0x12042f[_0x2dca36[_0x61ae('0x25')][_0x61ae('0x34')]]=_0x2dca36[_0x61ae('0x25')][_0x61ae('0x2f')];})[_0x61ae('0x10')](function(){return db[_0x61ae('0x1b')][_0x61ae('0x35')]({'where':{'id':_0x2dca36[_0x61ae('0x36')]['id']},'include':[{'model':db[_0x61ae('0x37')],'as':_0x61ae('0x38'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x12042f,'limit':0x1,'order':[[_0x61ae('0x2b'),_0x61ae('0x39')]]}]},{'model':db[_0x61ae('0x3a')],'as':_0x61ae('0x3b')}]});})[_0x61ae('0x10')](function(_0x4c6251){if(_0x4c6251&&_0x4c6251[_0x61ae('0x38')]){var _0x1f6fb3=_0x4c6251[_0x61ae('0x3c')]({'plain':!![]});_0x44cf4b[_0x61ae('0x36')]=_0x1f6fb3;_0x44cf4b[_0x61ae('0x3d')]=_0x1f6fb3[_0x61ae('0x3b')];_0x44cf4b[_0x61ae('0x3e')]=_0x1f6fb3['List'];_0x44cf4b[_0x61ae('0x3d')]=_[_0x61ae('0x3f')](_0x44cf4b[_0x61ae('0x3d')],['priority'],[_0x61ae('0x40')]);if(_0x44cf4b[_0x61ae('0x36')][_0x61ae('0x3b')]){delete _0x44cf4b[_0x61ae('0x36')][_0x61ae('0x3b')];}if(_0x44cf4b[_0x61ae('0x36')][_0x61ae('0x38')]&&_0x44cf4b[_0x61ae('0x36')][_0x61ae('0x38')][_0x61ae('0x41')]['length']){return _0x44cf4b['account'][_0x61ae('0x38')]['Contacts'][0x0];}var _0x3b4ab4=_[_0x61ae('0x42')](_0x2dca36[_0x61ae('0x25')],{'firstName':_0x2dca36[_0x61ae('0x25')][_0x61ae('0x2f')],'ListId':_0x1f6fb3[_0x61ae('0x43')]});_0x3b4ab4[_0x2dca36['body']['mapKey']]=_0x2dca36[_0x61ae('0x25')][_0x61ae('0x2f')];return db[_0x61ae('0x27')][_0x61ae('0x44')](_0x3b4ab4,{'fields':_0x38499d,'raw':!![]});}})[_0x61ae('0x10')](function(_0x1e37c4){_0x44cf4b['contact']=_0x1e37c4;if(_0x1e37c4){var _0x2ea500={'ContactId':_0x1e37c4['id'],'FaxAccountId':_0x2dca36[_0x61ae('0x36')]['id'],'fax':_0x1e37c4[_0x61ae('0x26')]};return db[_0x61ae('0x45')][_0x61ae('0x35')]({'where':{'ContactId':_0x1e37c4['id'],'closed':![],'FaxAccountId':_0x2dca36[_0x61ae('0x36')]['id']}})[_0x61ae('0x10')](function(_0x4c8162){if(_0x4c8162){return[_0x4c8162,![]];}return db[_0x61ae('0x45')][_0x61ae('0x44')](_0x2ea500)[_0x61ae('0x10')](function(_0x41d91c){return[_0x41d91c,!![]];});});}else{throw new Error(_0x61ae('0x46'));}})['spread'](function(_0x4e9987,_0x384ab3){var _0x321920=_0x4e9987[_0x61ae('0x3c')]({'plain':!![]});if(_0x384ab3){if(_0x44cf4b[_0x61ae('0x36')][_0x61ae('0x47')]){_0x44cf4b[_0x61ae('0x3d')][_0x61ae('0x48')]({'id':0x0,'priority':_0x44cf4b[_0x61ae('0x3d')][_0x61ae('0x49')]+0x1,'app':_0x61ae('0x4a'),'appdata':_0x61ae('0x4b'),'interval':_0x61ae('0x4c')});}_0x321920[_0x61ae('0x4d')]=!![];}else{_0x321920[_0x61ae('0x4d')]=![];}_0x44cf4b[_0x61ae('0x4e')]=_0x321920;return db[_0x61ae('0x4f')][_0x61ae('0x44')]({'body':_0x2dca36[_0x61ae('0x25')][_0x61ae('0x25')],'FaxAccountId':_0x2dca36[_0x61ae('0x36')]['id'],'FaxInteractionId':_0x4e9987['id'],'direction':'in','ContactId':_0x4e9987[_0x61ae('0x50')],'AttachmentId':_0x2dca36[_0x61ae('0x25')][_0x61ae('0x51')]});})['then'](function(_0x5866c3){_0x44cf4b[_0x61ae('0x18')]=_0x5866c3;if(_0x44cf4b[_0x61ae('0x4e')][_0x61ae('0x52')]){return db['User'][_0x61ae('0x35')]({'attributes':['id','name'],'where':{'id':_0x44cf4b[_0x61ae('0x4e')][_0x61ae('0x52')]}})[_0x61ae('0x10')](function(_0x367df8){if(_0x367df8){_0x44cf4b[_0x61ae('0x3d')][_0x61ae('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x367df8[_0x61ae('0x54')]+','+(_0x44cf4b['account']['waitForTheAssignedAgent']||0xa),'interval':_0x61ae('0x4c')});}return respondWithRpcPromise('Start',_0x61ae('0x55'),_0x44cf4b);});}return respondWithRpcPromise(_0x61ae('0x56'),'startRouting',_0x44cf4b);})[_0x61ae('0x10')](function(_0x5df949){_0x5ac3aa(_0x5df949);})['catch'](function(_0x4f6fd8){_0x4c60b5(_0x214b4c[_0x61ae('0x16')](0x1f4,_0x4f6fd8[_0x61ae('0x18')]));});});}; \ No newline at end of file +var _0x1fee=['CmContact','Contacts','DESC','FaxApplication','get','applications','Applications','list','orderBy','asc','length','create','FaxInteraction','Contact\x20not\x20found','spread','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxAccount','FaxAccount','options','where','attributes','limit','include','map','model','then','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','find','account','CmList','List'];(function(_0x16424e,_0x592472){var _0x35d760=function(_0x13ff16){while(--_0x13ff16){_0x16424e['push'](_0x16424e['shift']());}};_0x35d760(++_0x592472);}(_0x1fee,0x1de));var _0xe1fe=function(_0x252a5e,_0x54440a){_0x252a5e=_0x252a5e-0x0;var _0x34c610=_0x1fee[_0x252a5e];return _0x34c610;};'use strict';var _=require(_0xe1fe('0x0'));var util=require(_0xe1fe('0x1'));var moment=require('moment');var BPromise=require(_0xe1fe('0x2'));var rs=require(_0xe1fe('0x3'));var fs=require('fs');var Redis=require(_0xe1fe('0x4'));var db=require(_0xe1fe('0x5'))['db'];var utils=require(_0xe1fe('0x6'));var logger=require(_0xe1fe('0x7'))('rpc');var config=require(_0xe1fe('0x8'));var jayson=require(_0xe1fe('0x9'));var client=jayson[_0xe1fe('0xa')][_0xe1fe('0xb')]({'port':0x232c});config[_0xe1fe('0xc')]=_[_0xe1fe('0xd')](config[_0xe1fe('0xc')],{'host':_0xe1fe('0xe'),'port':0x18eb});var socket=require(_0xe1fe('0xf'))(new Redis(config[_0xe1fe('0xc')]));require(_0xe1fe('0x10'))[_0xe1fe('0x11')](socket);function respondWithRpcPromise(_0x8a5356,_0x44754b,_0x1c71a6){return new BPromise(function(_0x37a9b6,_0x543059){return client[_0xe1fe('0x12')](_0x8a5356,_0x1c71a6)['then'](function(_0xa0b72f){logger[_0xe1fe('0x13')](_0xe1fe('0x14'),_0x44754b,_0xe1fe('0x15'));logger[_0xe1fe('0x16')](_0xe1fe('0x17'),_0x44754b,'request\x20sent',JSON[_0xe1fe('0x18')](_0xa0b72f));if(_0xa0b72f['error']){if(_0xa0b72f[_0xe1fe('0x19')]['code']===0x1f4){logger[_0xe1fe('0x19')](_0xe1fe('0x14'),_0x44754b,_0xa0b72f['error'][_0xe1fe('0x1a')]);return _0x543059(_0xa0b72f['error'][_0xe1fe('0x1a')]);}logger['error'](_0xe1fe('0x14'),_0x44754b,_0xa0b72f[_0xe1fe('0x19')][_0xe1fe('0x1a')]);return _0x37a9b6(_0xa0b72f[_0xe1fe('0x19')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x44754b,_0xe1fe('0x15'));_0x37a9b6(_0xa0b72f[_0xe1fe('0x1b')][_0xe1fe('0x1a')]);}})[_0xe1fe('0x1c')](function(_0x208579){logger[_0xe1fe('0x19')](_0xe1fe('0x14'),_0x44754b,_0x208579);_0x543059(_0x208579);});});}exports[_0xe1fe('0x1d')]=function(_0x2e87e6){var _0x17c746=this;return new Promise(function(_0x3ebd1c,_0x326177){return db[_0xe1fe('0x1e')]['findAll']({'raw':_0x2e87e6['options']?_0x2e87e6[_0xe1fe('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2e87e6[_0xe1fe('0x1f')]?_0x2e87e6[_0xe1fe('0x1f')][_0xe1fe('0x20')]||null:null,'attributes':_0x2e87e6[_0xe1fe('0x1f')]?_0x2e87e6[_0xe1fe('0x1f')][_0xe1fe('0x21')]||null:null,'limit':_0x2e87e6[_0xe1fe('0x1f')]?_0x2e87e6['options'][_0xe1fe('0x22')]||null:null,'include':_0x2e87e6[_0xe1fe('0x1f')]?_0x2e87e6['options'][_0xe1fe('0x23')]?_[_0xe1fe('0x24')](_0x2e87e6[_0xe1fe('0x1f')][_0xe1fe('0x23')],function(_0x159918){return{'model':db[_0x159918[_0xe1fe('0x25')]],'as':_0x159918['as'],'attributes':_0x159918[_0xe1fe('0x21')],'include':_0x159918[_0xe1fe('0x23')]?_['map'](_0x159918[_0xe1fe('0x23')],function(_0xf862bd){return{'model':db[_0xf862bd[_0xe1fe('0x25')]],'as':_0xf862bd['as'],'attributes':_0xf862bd[_0xe1fe('0x21')],'include':_0xf862bd['include']?_['map'](_0xf862bd['include'],function(_0x25f941){return{'model':db[_0x25f941[_0xe1fe('0x25')]],'as':_0x25f941['as'],'attributes':_0x25f941[_0xe1fe('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe1fe('0x26')](function(_0x449e72){logger['info'](_0xe1fe('0x1d'),_0x2e87e6);logger[_0xe1fe('0x16')](_0xe1fe('0x1d'),_0x2e87e6,JSON[_0xe1fe('0x18')](_0x449e72));_0x3ebd1c(_0x449e72);})[_0xe1fe('0x1c')](function(_0x51f25f){logger['error'](_0xe1fe('0x1d'),_0x51f25f[_0xe1fe('0x1a')],_0x2e87e6);_0x326177(_0x17c746[_0xe1fe('0x19')](0x1f4,_0x51f25f['message']));});});};exports[_0xe1fe('0x27')]=function(_0x1ce6d5,_0x4216dc,_0x5b6254){var _0x48b13b=this;return new Promise(function(_0x3714ce,_0x2a182b){var _0x4916dd={'body':_0x1ce6d5[_0xe1fe('0x28')],'channel':_0xe1fe('0x29')};var _0x5409f5=[];var _0x476819=[];var _0x4a326e={};return db['CmContact'][_0xe1fe('0x2a')]()[_0xe1fe('0x26')](function(_0x3f3b78){if(!_0x3f3b78){throw new db[(_0xe1fe('0x2b'))][(_0xe1fe('0x2c'))](_0xe1fe('0x2d'));}_0x5409f5=_[_0xe1fe('0x2e')](_[_0xe1fe('0x2f')](_0x3f3b78),['createdAt',_0xe1fe('0x30')]);_0x476819=_[_0xe1fe('0x2e')](_[_0xe1fe('0x2f')](_0x3f3b78),[_0xe1fe('0x31'),_0xe1fe('0x30'),_0xe1fe('0x32'),_0xe1fe('0x33')]);if(_0x1ce6d5[_0xe1fe('0x28')]['id']){delete _0x1ce6d5[_0xe1fe('0x28')]['id'];}if(_[_0xe1fe('0x34')](_0x1ce6d5[_0xe1fe('0x28')][_0xe1fe('0x35')])){throw new db[(_0xe1fe('0x2b'))][(_0xe1fe('0x2c'))](_0xe1fe('0x36'));}if(_[_0xe1fe('0x34')](_0x1ce6d5[_0xe1fe('0x28')][_0xe1fe('0x28')])||_0x1ce6d5['body']['body']===''){throw new db[(_0xe1fe('0x2b'))][(_0xe1fe('0x2c'))](_0xe1fe('0x37'));}if(_[_0xe1fe('0x34')](_0x1ce6d5[_0xe1fe('0x28')]['mapKey'])){throw new db[(_0xe1fe('0x2b'))][(_0xe1fe('0x2c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x476819);}if(!_[_0xe1fe('0x38')](_0x476819,_0x1ce6d5[_0xe1fe('0x28')][_0xe1fe('0x39')])){throw new db[(_0xe1fe('0x2b'))][(_0xe1fe('0x2c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x476819);}_0x4a326e[_0x1ce6d5[_0xe1fe('0x28')][_0xe1fe('0x39')]]=_0x1ce6d5[_0xe1fe('0x28')][_0xe1fe('0x35')];})[_0xe1fe('0x26')](function(){return db[_0xe1fe('0x1e')][_0xe1fe('0x3a')]({'where':{'id':_0x1ce6d5[_0xe1fe('0x3b')]['id']},'include':[{'model':db[_0xe1fe('0x3c')],'as':_0xe1fe('0x3d'),'include':[{'model':db[_0xe1fe('0x3e')],'as':_0xe1fe('0x3f'),'where':_0x4a326e,'limit':0x1,'order':[[_0xe1fe('0x30'),_0xe1fe('0x40')]]}]},{'model':db[_0xe1fe('0x41')],'as':'Applications'}]});})[_0xe1fe('0x26')](function(_0x1bd018){if(_0x1bd018&&_0x1bd018[_0xe1fe('0x3d')]){var _0x50f4c2=_0x1bd018[_0xe1fe('0x42')]({'plain':!![]});_0x4916dd[_0xe1fe('0x3b')]=_0x50f4c2;_0x4916dd[_0xe1fe('0x43')]=_0x50f4c2[_0xe1fe('0x44')];_0x4916dd[_0xe1fe('0x45')]=_0x50f4c2['List'];_0x4916dd[_0xe1fe('0x43')]=_[_0xe1fe('0x46')](_0x4916dd[_0xe1fe('0x43')],['priority'],[_0xe1fe('0x47')]);if(_0x4916dd[_0xe1fe('0x3b')][_0xe1fe('0x44')]){delete _0x4916dd[_0xe1fe('0x3b')][_0xe1fe('0x44')];}if(_0x4916dd[_0xe1fe('0x3b')]['List']&&_0x4916dd[_0xe1fe('0x3b')][_0xe1fe('0x3d')][_0xe1fe('0x3f')][_0xe1fe('0x48')]){return _0x4916dd['account']['List'][_0xe1fe('0x3f')][0x0];}var _0x156e9f=_['defaults'](_0x1ce6d5[_0xe1fe('0x28')],{'firstName':_0x1ce6d5['body']['from'],'ListId':_0x50f4c2[_0xe1fe('0x33')]});_0x156e9f[_0x1ce6d5[_0xe1fe('0x28')][_0xe1fe('0x39')]]=_0x1ce6d5[_0xe1fe('0x28')][_0xe1fe('0x35')];return db['CmContact'][_0xe1fe('0x49')](_0x156e9f,{'fields':_0x5409f5,'raw':!![]});}})[_0xe1fe('0x26')](function(_0x318908){_0x4916dd['contact']=_0x318908;if(_0x318908){var _0x3a7345={'ContactId':_0x318908['id'],'FaxAccountId':_0x1ce6d5['account']['id'],'fax':_0x318908[_0xe1fe('0x29')]};return db[_0xe1fe('0x4a')][_0xe1fe('0x3a')]({'where':{'ContactId':_0x318908['id'],'closed':![],'FaxAccountId':_0x1ce6d5[_0xe1fe('0x3b')]['id']}})[_0xe1fe('0x26')](function(_0xf77218){if(_0xf77218){return[_0xf77218,![]];}return db['FaxInteraction']['create'](_0x3a7345)[_0xe1fe('0x26')](function(_0x249837){return[_0x249837,!![]];});});}else{throw new Error(_0xe1fe('0x4b'));}})[_0xe1fe('0x4c')](function(_0x82d0db,_0x56bfc8){var _0x2e4b62=_0x82d0db['get']({'plain':!![]});if(_0x56bfc8){if(_0x4916dd[_0xe1fe('0x3b')]['autoclose']){_0x4916dd[_0xe1fe('0x43')]['push']({'id':0x0,'priority':_0x4916dd[_0xe1fe('0x43')][_0xe1fe('0x48')]+0x1,'app':'close','appdata':_0xe1fe('0x4d'),'interval':_0xe1fe('0x4e')});}_0x2e4b62[_0xe1fe('0x4f')]=!![];}else{_0x2e4b62[_0xe1fe('0x4f')]=![];}_0x4916dd[_0xe1fe('0x50')]=_0x2e4b62;return db[_0xe1fe('0x51')]['create']({'body':_0x1ce6d5[_0xe1fe('0x28')][_0xe1fe('0x28')],'FaxAccountId':_0x1ce6d5[_0xe1fe('0x3b')]['id'],'FaxInteractionId':_0x82d0db['id'],'direction':'in','ContactId':_0x82d0db[_0xe1fe('0x52')],'AttachmentId':_0x1ce6d5[_0xe1fe('0x28')][_0xe1fe('0x53')]});})[_0xe1fe('0x26')](function(_0x1143d7){_0x4916dd[_0xe1fe('0x1a')]=_0x1143d7;if(_0x4916dd[_0xe1fe('0x50')][_0xe1fe('0x54')]){return db[_0xe1fe('0x55')][_0xe1fe('0x3a')]({'attributes':['id','name'],'where':{'id':_0x4916dd[_0xe1fe('0x50')]['UserId']}})['then'](function(_0x2a7840){if(_0x2a7840){_0x4916dd[_0xe1fe('0x43')][_0xe1fe('0x56')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2a7840['name']+','+(_0x4916dd[_0xe1fe('0x3b')][_0xe1fe('0x57')]||0xa),'interval':_0xe1fe('0x4e')});}return respondWithRpcPromise(_0xe1fe('0x58'),_0xe1fe('0x59'),_0x4916dd);});}return respondWithRpcPromise(_0xe1fe('0x58'),_0xe1fe('0x59'),_0x4916dd);})[_0xe1fe('0x26')](function(_0x4355fc){_0x3714ce(_0x4355fc);})[_0xe1fe('0x1c')](function(_0x2b5bba){_0x2a182b(_0x48b13b[_0xe1fe('0x19')](0x1f4,_0x2b5bba[_0xe1fe('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 3e094e1..660c01a 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 _0x1b2d=['update','emit','removeListener','register','./faxAccount.events','save'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x1b2d,0xe8));var _0xd1b2=function(_0x3167a2,_0x4f7866){_0x3167a2=_0x3167a2-0x0;var _0x4ce01c=_0x1b2d[_0x3167a2];return _0x4ce01c;};'use strict';var FaxAccountEvents=require(_0xd1b2('0x0'));var events=[_0xd1b2('0x1'),'remove',_0xd1b2('0x2')];function createListener(_0x200f8e,_0x1cb2d5){return function(_0x2a1318){_0x1cb2d5[_0xd1b2('0x3')](_0x200f8e,_0x2a1318);};}function removeListener(_0x5d22a1,_0x1d4436){return function(){FaxAccountEvents[_0xd1b2('0x4')](_0x5d22a1,_0x1d4436);};}exports[_0xd1b2('0x5')]=function(_0x4facab){for(var _0x14b718=0x0,_0x24b2ee=events['length'];_0x14b718<_0x24b2ee;_0x14b718++){var _0x2ebefc=events[_0x14b718];var _0x325cfb=createListener('faxAccount:'+_0x2ebefc,_0x4facab);FaxAccountEvents['on'](_0x2ebefc,_0x325cfb);}}; \ No newline at end of file +var _0x55a5=['save','remove','update','removeListener','length','faxAccount:','./faxAccount.events'];(function(_0x5a15c9,_0x207aef){var _0x6f04c1=function(_0x378b97){while(--_0x378b97){_0x5a15c9['push'](_0x5a15c9['shift']());}};_0x6f04c1(++_0x207aef);}(_0x55a5,0x6f));var _0x555a=function(_0x1ae8ab,_0x6e5c2a){_0x1ae8ab=_0x1ae8ab-0x0;var _0x1ad705=_0x55a5[_0x1ae8ab];return _0x1ad705;};'use strict';var FaxAccountEvents=require(_0x555a('0x0'));var events=[_0x555a('0x1'),_0x555a('0x2'),_0x555a('0x3')];function createListener(_0x178768,_0x110fdc){return function(_0x2c6166){_0x110fdc['emit'](_0x178768,_0x2c6166);};}function removeListener(_0x29b914,_0x51b17b){return function(){FaxAccountEvents[_0x555a('0x4')](_0x29b914,_0x51b17b);};}exports['register']=function(_0xa54e6a){for(var _0x440835=0x0,_0x32d9ba=events[_0x555a('0x5')];_0x440835<_0x32d9ba;_0x440835++){var _0x381786=events[_0x440835];var _0xbc24db=createListener(_0x555a('0x6')+_0x381786,_0xa54e6a);FaxAccountEvents['on'](_0x381786,_0xbc24db);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 8e33e36..bb302a1 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 _0x0c2b=['/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','post','create','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions'];(function(_0x3c88a8,_0xa36b9){var _0x1630e0=function(_0x590bed){while(--_0x590bed){_0x3c88a8['push'](_0x3c88a8['shift']());}};_0x1630e0(++_0xa36b9);}(_0x0c2b,0x182));var _0xb0c2=function(_0x1c1eff,_0xf5b1ee){_0x1c1eff=_0x1c1eff-0x0;var _0x1dfea2=_0x0c2b[_0x1c1eff];return _0x1dfea2;};'use strict';var multer=require(_0xb0c2('0x0'));var util=require('util');var path=require(_0xb0c2('0x1'));var timeout=require(_0xb0c2('0x2'));var express=require(_0xb0c2('0x3'));var router=express[_0xb0c2('0x4')]();var auth=require(_0xb0c2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0xb0c2('0x6')]('/',auth[_0xb0c2('0x7')](),controller[_0xb0c2('0x8')]);router['get'](_0xb0c2('0x9'),auth[_0xb0c2('0x7')](),controller[_0xb0c2('0xa')]);router[_0xb0c2('0x6')]('/:id',auth[_0xb0c2('0x7')](),controller[_0xb0c2('0xb')]);router['get'](_0xb0c2('0xc'),auth['isAuthenticated'](),controller[_0xb0c2('0xd')]);router[_0xb0c2('0x6')](_0xb0c2('0xe'),auth[_0xb0c2('0x7')](),controller[_0xb0c2('0xf')]);router[_0xb0c2('0x6')](_0xb0c2('0x10'),auth[_0xb0c2('0x7')](),controller[_0xb0c2('0x11')]);router[_0xb0c2('0x6')](_0xb0c2('0x12'),auth['isAuthenticated'](),controller[_0xb0c2('0x13')]);router['get'](_0xb0c2('0x14'),auth[_0xb0c2('0x7')](),controller['getMessages']);router[_0xb0c2('0x6')]('/:id/users',auth[_0xb0c2('0x7')](),controller['getAgents']);router[_0xb0c2('0x15')]('/',auth['isAuthenticated'](),controller[_0xb0c2('0x16')]);router[_0xb0c2('0x15')](_0xb0c2('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb0c2('0x15')](_0xb0c2('0xe'),auth[_0xb0c2('0x7')](),controller['addAnswer']);router[_0xb0c2('0x15')](_0xb0c2('0x10'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xb0c2('0x15')](_0xb0c2('0x12'),auth[_0xb0c2('0x7')](),controller[_0xb0c2('0x17')]);router[_0xb0c2('0x15')](_0xb0c2('0x18'),auth[_0xb0c2('0x7')](),controller[_0xb0c2('0x19')]);router[_0xb0c2('0x15')](_0xb0c2('0x1a'),auth[_0xb0c2('0x7')](),controller[_0xb0c2('0x1b')]);router[_0xb0c2('0x15')](_0xb0c2('0x1c'),auth[_0xb0c2('0x7')](),controller[_0xb0c2('0x1d')]);router[_0xb0c2('0x15')](_0xb0c2('0x1e'),auth[_0xb0c2('0x7')](),controller[_0xb0c2('0x1f')]);router[_0xb0c2('0x20')]('/:id',auth[_0xb0c2('0x7')](),controller[_0xb0c2('0x21')]);router[_0xb0c2('0x22')](_0xb0c2('0x23'),auth[_0xb0c2('0x7')](),controller[_0xb0c2('0x24')]);router['delete'](_0xb0c2('0xc'),auth[_0xb0c2('0x7')](),controller[_0xb0c2('0x25')]);router[_0xb0c2('0x22')](_0xb0c2('0xe'),auth[_0xb0c2('0x7')](),controller[_0xb0c2('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb0c2('0x27')]=router; \ No newline at end of file +var _0x9b70=['show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','post','create','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9b70,0x10a));var _0x09b7=function(_0x3db464,_0x53fd4e){_0x3db464=_0x3db464-0x0;var _0x81faa2=_0x9b70[_0x3db464];return _0x81faa2;};'use strict';var multer=require(_0x09b7('0x0'));var util=require(_0x09b7('0x1'));var path=require(_0x09b7('0x2'));var timeout=require(_0x09b7('0x3'));var express=require(_0x09b7('0x4'));var router=express[_0x09b7('0x5')]();var auth=require(_0x09b7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x09b7('0x7'));router[_0x09b7('0x8')]('/',auth[_0x09b7('0x9')](),controller[_0x09b7('0xa')]);router[_0x09b7('0x8')](_0x09b7('0xb'),auth[_0x09b7('0x9')](),controller[_0x09b7('0xc')]);router[_0x09b7('0x8')](_0x09b7('0xd'),auth['isAuthenticated'](),controller[_0x09b7('0xe')]);router['get'](_0x09b7('0xf'),auth[_0x09b7('0x9')](),controller[_0x09b7('0x10')]);router[_0x09b7('0x8')](_0x09b7('0x11'),auth[_0x09b7('0x9')](),controller['getAnswers']);router[_0x09b7('0x8')](_0x09b7('0x12'),auth[_0x09b7('0x9')](),controller[_0x09b7('0x13')]);router['get'](_0x09b7('0x14'),auth[_0x09b7('0x9')](),controller[_0x09b7('0x15')]);router['get'](_0x09b7('0x16'),auth[_0x09b7('0x9')](),controller['getMessages']);router[_0x09b7('0x8')](_0x09b7('0x17'),auth[_0x09b7('0x9')](),controller['getAgents']);router[_0x09b7('0x18')]('/',auth[_0x09b7('0x9')](),controller[_0x09b7('0x19')]);router[_0x09b7('0x18')](_0x09b7('0xf'),auth['isAuthenticated'](),controller[_0x09b7('0x1a')]);router[_0x09b7('0x18')](_0x09b7('0x11'),auth[_0x09b7('0x9')](),controller[_0x09b7('0x1b')]);router[_0x09b7('0x18')]('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0x09b7('0x14'),auth[_0x09b7('0x9')](),controller[_0x09b7('0x1c')]);router[_0x09b7('0x18')](_0x09b7('0x1d'),auth['isAuthenticated'](),controller[_0x09b7('0x1e')]);router[_0x09b7('0x18')]('/updateaccountapplications',auth[_0x09b7('0x9')](),controller[_0x09b7('0x1f')]);router[_0x09b7('0x18')](_0x09b7('0x20'),auth[_0x09b7('0x9')](),controller[_0x09b7('0x21')]);router[_0x09b7('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x09b7('0x22')]);router[_0x09b7('0x23')](_0x09b7('0xd'),auth[_0x09b7('0x9')](),controller[_0x09b7('0x24')]);router[_0x09b7('0x25')](_0x09b7('0xd'),auth[_0x09b7('0x9')](),controller['destroy']);router[_0x09b7('0x25')](_0x09b7('0xf'),auth[_0x09b7('0x9')](),controller['removeDispositions']);router[_0x09b7('0x25')](_0x09b7('0x11'),auth[_0x09b7('0x9')](),controller[_0x09b7('0x26')]);router[_0x09b7('0x25')](_0x09b7('0x17'),auth[_0x09b7('0x9')](),controller['removeAgents']);module[_0x09b7('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 89e8868..f130878 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 _0x7031=['STRING','noop','sequelize','exports'];(function(_0x1c156e,_0x3263a6){var _0x58fc22=function(_0x42f1eb){while(--_0x42f1eb){_0x1c156e['push'](_0x1c156e['shift']());}};_0x58fc22(++_0x3263a6);}(_0x7031,0x19a));var _0x1703=function(_0x255a6e,_0x2be4a8){_0x255a6e=_0x255a6e-0x0;var _0x1338d2=_0x7031[_0x255a6e];return _0x1338d2;};'use strict';var Sequelize=require(_0x1703('0x0'));module[_0x1703('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1703('0x2')],'allowNull':![],'defaultValue':_0x1703('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1703('0x2')]},'interval':{'type':Sequelize[_0x1703('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6075=['INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x3dad57,_0x1dd8b3){var _0x47a6b5=function(_0x6e545d){while(--_0x6e545d){_0x3dad57['push'](_0x3dad57['shift']());}};_0x47a6b5(++_0x1dd8b3);}(_0x6075,0x126));var _0x5607=function(_0x14a038,_0x3d4bcb){_0x14a038=_0x14a038-0x0;var _0x257468=_0x6075[_0x14a038];return _0x257468;};'use strict';var Sequelize=require(_0x5607('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5607('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5607('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5607('0x3')]()},'description':{'type':Sequelize[_0x5607('0x2')]},'interval':{'type':Sequelize[_0x5607('0x2')],'defaultValue':_0x5607('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 02cd2f9..495051a 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 _0x36f3=['query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','FaxApplication','rows','catch','params','keys','rawAttributes','length','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','model'];(function(_0x5eac90,_0x450635){var _0x3467ba=function(_0x15124){while(--_0x15124){_0x5eac90['push'](_0x5eac90['shift']());}};_0x3467ba(++_0x450635);}(_0x36f3,0xf2));var _0x336f=function(_0x835cb7,_0x1e574d){_0x835cb7=_0x835cb7-0x0;var _0x3ef599=_0x36f3[_0x835cb7];return _0x3ef599;};'use strict';var pdf=require(_0x336f('0x0'));var emlformat=require(_0x336f('0x1'));var rimraf=require(_0x336f('0x2'));var zipdir=require(_0x336f('0x3'));var jsonpatch=require(_0x336f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x336f('0x5'));var Mustache=require(_0x336f('0x6'));var util=require('util');var path=require(_0x336f('0x7'));var sox=require(_0x336f('0x8'));var csv=require(_0x336f('0x9'));var ejs=require(_0x336f('0xa'));var fs=require('fs');var _=require(_0x336f('0xb'));var squel=require(_0x336f('0xc'));var crypto=require(_0x336f('0xd'));var jsforce=require(_0x336f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x336f('0x9'));var querystring=require(_0x336f('0xf'));var Papa=require(_0x336f('0x10'));var authService=require(_0x336f('0x11'));var hardwareService=require(_0x336f('0x12'));var Redis=require(_0x336f('0x13'));var qs=require(_0x336f('0x14'));var logger=require(_0x336f('0x15'))(_0x336f('0x16'));var utils=require(_0x336f('0x17'));var config=require(_0x336f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xffe4b9,_0x1f192d){_0x1f192d=_0x1f192d||0xcc;return function(_0x4fa395){if(_0x4fa395){return _0xffe4b9[_0x336f('0x19')](_0x1f192d);}return _0xffe4b9[_0x336f('0x1a')](_0x1f192d)[_0x336f('0x1b')]();};}function respondWithResult(_0x34d9b6,_0x1784f3){_0x1784f3=_0x1784f3||0xc8;return function(_0x278c25){if(_0x278c25){return _0x34d9b6[_0x336f('0x1a')](_0x1784f3)[_0x336f('0x1c')](_0x278c25);}};}function respondWithFilteredResult(_0x4e0620,_0x3d90aa){return function(_0x541e24){if(_0x541e24){var _0x787166=_0x541e24['count'],_0x5207bf=_0x3d90aa[_0x336f('0x1d')],_0x5a3a71=_0x3d90aa['offset']+_0x3d90aa['limit'],_0x3f890b;if(_0x5a3a71>=_0x787166){_0x5a3a71=_0x787166;_0x3f890b=0xc8;}else{_0x3f890b=0xce;}_0x4e0620[_0x336f('0x1a')](_0x3f890b);return _0x4e0620[_0x336f('0x1e')](_0x336f('0x1f'),_0x5207bf+'-'+_0x5a3a71+'/'+_0x787166)[_0x336f('0x1c')](_0x541e24);}return null;};}function patchUpdates(_0x1e0bbc){return function(_0x368f11){try{jsonpatch[_0x336f('0x20')](_0x368f11,_0x1e0bbc,!![]);}catch(_0x5a7afb){return BPromise['reject'](_0x5a7afb);}return _0x368f11[_0x336f('0x21')]();};}function saveUpdates(_0x27e999,_0x2543a2){return function(_0x580031){if(_0x580031){return _0x580031[_0x336f('0x22')](_0x27e999)[_0x336f('0x23')](function(_0x4e4d3d){return _0x4e4d3d;});}return null;};}function removeEntity(_0x233153,_0x103377){return function(_0xd51385){if(_0xd51385){return _0xd51385[_0x336f('0x24')]()[_0x336f('0x23')](function(){_0x233153['status'](0xcc)[_0x336f('0x1b')]();});}};}function handleEntityNotFound(_0x25bc5a,_0x119a83){return function(_0x390ccd){if(!_0x390ccd){_0x25bc5a[_0x336f('0x19')](0x194);}return _0x390ccd;};}function handleError(_0xbba081,_0x5caf6f){_0x5caf6f=_0x5caf6f||0x1f4;return function(_0x4cc081){logger[_0x336f('0x25')](_0x4cc081[_0x336f('0x26')]);if(_0x4cc081['name']){delete _0x4cc081[_0x336f('0x27')];}_0xbba081[_0x336f('0x1a')](_0x5caf6f)['send'](_0x4cc081);};}exports[_0x336f('0x28')]=function(_0x21da97,_0x37307b){var _0x4f8418={},_0x5936da={},_0x54a779={'count':0x0,'rows':[]};var _0x4d4d00=db['FaxApplication']['rawAttributes'];_0x5936da[_0x336f('0x29')]=_['keys'](_0x4d4d00);_0x5936da[_0x336f('0x2a')]=_['keys'](_0x21da97[_0x336f('0x2a')]);_0x5936da['filters']=_[_0x336f('0x2b')](_0x5936da[_0x336f('0x29')],_0x5936da[_0x336f('0x2a')]);_0x4f8418[_0x336f('0x2c')]=_[_0x336f('0x2b')](_0x5936da[_0x336f('0x29')],qs['fields'](_0x21da97[_0x336f('0x2a')][_0x336f('0x2d')]));_0x4f8418['attributes']=_0x4f8418['attributes']['length']?_0x4f8418[_0x336f('0x2c')]:_0x5936da[_0x336f('0x29')];if(!_0x21da97['query'][_0x336f('0x2e')](_0x336f('0x2f'))){_0x4f8418[_0x336f('0x30')]=qs[_0x336f('0x30')](_0x21da97[_0x336f('0x2a')][_0x336f('0x30')]);_0x4f8418[_0x336f('0x1d')]=qs['offset'](_0x21da97[_0x336f('0x2a')][_0x336f('0x1d')]);}_0x4f8418['order']=qs['sort'](_0x21da97[_0x336f('0x2a')][_0x336f('0x31')]);_0x4f8418[_0x336f('0x32')]=qs[_0x336f('0x33')](_[_0x336f('0x34')](_0x21da97[_0x336f('0x2a')],_0x5936da[_0x336f('0x33')]));if(_0x21da97['query'][_0x336f('0x35')]){_0x4f8418['where']=_[_0x336f('0x36')](_0x4f8418[_0x336f('0x32')],{'$or':_[_0x336f('0x37')](_0x4d4d00,function(_0x39fe8d){if(_0x39fe8d[_0x336f('0x38')][_0x336f('0x39')]!==_0x336f('0x3a')){var _0x24e7b1={};_0x24e7b1[_0x39fe8d['field']]={'$like':'%'+_0x21da97[_0x336f('0x2a')][_0x336f('0x35')]+'%'};return _0x24e7b1;}})});}_0x4f8418=_[_0x336f('0x36')]({},_0x4f8418,_0x21da97[_0x336f('0x3b')]);var _0x465c0e={'where':_0x4f8418[_0x336f('0x32')]};return db['FaxApplication']['count'](_0x465c0e)[_0x336f('0x23')](function(_0x4baebf){_0x54a779['count']=_0x4baebf;if(_0x21da97[_0x336f('0x2a')][_0x336f('0x3c')]){_0x4f8418['include']=[{'all':!![]}];}return db[_0x336f('0x3d')]['findAll'](_0x4f8418);})['then'](function(_0x134059){_0x54a779[_0x336f('0x3e')]=_0x134059;return _0x54a779;})[_0x336f('0x23')](respondWithFilteredResult(_0x37307b,_0x4f8418))[_0x336f('0x3f')](handleError(_0x37307b,null));};exports['show']=function(_0x291196,_0x5b01be){var _0x59a6d8={'raw':!![],'where':{'id':_0x291196[_0x336f('0x40')]['id']}},_0x5b12e3={};_0x5b12e3[_0x336f('0x29')]=_[_0x336f('0x41')](db[_0x336f('0x3d')][_0x336f('0x42')]);_0x5b12e3[_0x336f('0x2a')]=_[_0x336f('0x41')](_0x291196[_0x336f('0x2a')]);_0x5b12e3[_0x336f('0x33')]=_[_0x336f('0x2b')](_0x5b12e3['model'],_0x5b12e3[_0x336f('0x2a')]);_0x59a6d8[_0x336f('0x2c')]=_['intersection'](_0x5b12e3[_0x336f('0x29')],qs['fields'](_0x291196[_0x336f('0x2a')][_0x336f('0x2d')]));_0x59a6d8[_0x336f('0x2c')]=_0x59a6d8[_0x336f('0x2c')][_0x336f('0x43')]?_0x59a6d8[_0x336f('0x2c')]:_0x5b12e3[_0x336f('0x29')];if(_0x291196[_0x336f('0x2a')][_0x336f('0x3c')]){_0x59a6d8['include']=[{'all':!![]}];}_0x59a6d8=_['merge']({},_0x59a6d8,_0x291196['options']);return db[_0x336f('0x3d')]['find'](_0x59a6d8)['then'](handleEntityNotFound(_0x5b01be,null))[_0x336f('0x23')](respondWithResult(_0x5b01be,null))[_0x336f('0x3f')](handleError(_0x5b01be,null));};exports[_0x336f('0x44')]=function(_0x93c4da,_0x59c3d1){return db['FaxApplication']['create'](_0x93c4da[_0x336f('0x45')],{})[_0x336f('0x23')](respondWithResult(_0x59c3d1,0xc9))[_0x336f('0x3f')](handleError(_0x59c3d1,null));};exports['update']=function(_0xb98c5d,_0x1d7984){if(_0xb98c5d[_0x336f('0x45')]['id']){delete _0xb98c5d[_0x336f('0x45')]['id'];}return db[_0x336f('0x3d')][_0x336f('0x46')]({'where':{'id':_0xb98c5d[_0x336f('0x40')]['id']}})[_0x336f('0x23')](handleEntityNotFound(_0x1d7984,null))[_0x336f('0x23')](saveUpdates(_0xb98c5d['body'],null))[_0x336f('0x23')](respondWithResult(_0x1d7984,null))['catch'](handleError(_0x1d7984,null));};exports[_0x336f('0x24')]=function(_0x225b81,_0xc8dd8c){return db[_0x336f('0x3d')]['find']({'where':{'id':_0x225b81['params']['id']}})[_0x336f('0x23')](handleEntityNotFound(_0xc8dd8c,null))[_0x336f('0x23')](removeEntity(_0xc8dd8c,null))['catch'](handleError(_0xc8dd8c,null));}; \ No newline at end of file +var _0xa9a2=['count','offset','set','Content-Range','json','apply','save','update','sendStatus','error','stack','name','send','index','FaxApplication','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','map','key','field','options','includeAll','include','findAll','then','rows','show','params','length','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','lodash','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end'];(function(_0x558ea5,_0x28caac){var _0x54469d=function(_0x57adde){while(--_0x57adde){_0x558ea5['push'](_0x558ea5['shift']());}};_0x54469d(++_0x28caac);}(_0xa9a2,0x78));var _0x2a9a=function(_0x546e3b,_0x1d6b2b){_0x546e3b=_0x546e3b-0x0;var _0x331189=_0xa9a2[_0x546e3b];return _0x331189;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2a9a('0x0'));var rimraf=require(_0x2a9a('0x1'));var zipdir=require(_0x2a9a('0x2'));var jsonpatch=require(_0x2a9a('0x3'));var rp=require('request-promise');var moment=require(_0x2a9a('0x4'));var BPromise=require(_0x2a9a('0x5'));var Mustache=require(_0x2a9a('0x6'));var util=require(_0x2a9a('0x7'));var path=require(_0x2a9a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2a9a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2a9a('0xa'));var deskjs=require(_0x2a9a('0xb'));var toCsv=require(_0x2a9a('0xc'));var querystring=require(_0x2a9a('0xd'));var Papa=require('papaparse');var authService=require(_0x2a9a('0xe'));var hardwareService=require(_0x2a9a('0xf'));var Redis=require(_0x2a9a('0x10'));var qs=require(_0x2a9a('0x11'));var logger=require(_0x2a9a('0x12'))(_0x2a9a('0x13'));var utils=require(_0x2a9a('0x14'));var config=require('../../config/environment');var db=require(_0x2a9a('0x15'))['db'];function respondWithStatusCode(_0x35ede9,_0x53f518){_0x53f518=_0x53f518||0xcc;return function(_0x24b8ab){if(_0x24b8ab){return _0x35ede9['sendStatus'](_0x53f518);}return _0x35ede9[_0x2a9a('0x16')](_0x53f518)[_0x2a9a('0x17')]();};}function respondWithResult(_0x486da0,_0x46cb06){_0x46cb06=_0x46cb06||0xc8;return function(_0x3608e9){if(_0x3608e9){return _0x486da0[_0x2a9a('0x16')](_0x46cb06)['json'](_0x3608e9);}};}function respondWithFilteredResult(_0x2b6e6f,_0x235600){return function(_0x29849c){if(_0x29849c){var _0x56aa31=_0x29849c[_0x2a9a('0x18')],_0x29077c=_0x235600['offset'],_0x14d3aa=_0x235600[_0x2a9a('0x19')]+_0x235600['limit'],_0x169a7d;if(_0x14d3aa>=_0x56aa31){_0x14d3aa=_0x56aa31;_0x169a7d=0xc8;}else{_0x169a7d=0xce;}_0x2b6e6f[_0x2a9a('0x16')](_0x169a7d);return _0x2b6e6f[_0x2a9a('0x1a')](_0x2a9a('0x1b'),_0x29077c+'-'+_0x14d3aa+'/'+_0x56aa31)[_0x2a9a('0x1c')](_0x29849c);}return null;};}function patchUpdates(_0x89e541){return function(_0x4bd288){try{jsonpatch[_0x2a9a('0x1d')](_0x4bd288,_0x89e541,!![]);}catch(_0x3533f5){return BPromise['reject'](_0x3533f5);}return _0x4bd288[_0x2a9a('0x1e')]();};}function saveUpdates(_0x578489,_0x48b903){return function(_0x152fd0){if(_0x152fd0){return _0x152fd0[_0x2a9a('0x1f')](_0x578489)['then'](function(_0x1723b9){return _0x1723b9;});}return null;};}function removeEntity(_0x354e19,_0x5f7095){return function(_0xcde1f5){if(_0xcde1f5){return _0xcde1f5['destroy']()['then'](function(){_0x354e19[_0x2a9a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x99e18b,_0x291197){return function(_0x493375){if(!_0x493375){_0x99e18b[_0x2a9a('0x20')](0x194);}return _0x493375;};}function handleError(_0x480201,_0x15edf3){_0x15edf3=_0x15edf3||0x1f4;return function(_0x5891dc){logger[_0x2a9a('0x21')](_0x5891dc[_0x2a9a('0x22')]);if(_0x5891dc['name']){delete _0x5891dc[_0x2a9a('0x23')];}_0x480201[_0x2a9a('0x16')](_0x15edf3)[_0x2a9a('0x24')](_0x5891dc);};}exports[_0x2a9a('0x25')]=function(_0x331de3,_0x313f32){var _0x43d8b0={},_0x53f502={},_0x291230={'count':0x0,'rows':[]};var _0x2f877d=db[_0x2a9a('0x26')][_0x2a9a('0x27')];_0x53f502[_0x2a9a('0x28')]=_[_0x2a9a('0x29')](_0x2f877d);_0x53f502[_0x2a9a('0x2a')]=_['keys'](_0x331de3[_0x2a9a('0x2a')]);_0x53f502['filters']=_[_0x2a9a('0x2b')](_0x53f502['model'],_0x53f502[_0x2a9a('0x2a')]);_0x43d8b0[_0x2a9a('0x2c')]=_[_0x2a9a('0x2b')](_0x53f502[_0x2a9a('0x28')],qs[_0x2a9a('0x2d')](_0x331de3[_0x2a9a('0x2a')][_0x2a9a('0x2d')]));_0x43d8b0['attributes']=_0x43d8b0[_0x2a9a('0x2c')]['length']?_0x43d8b0[_0x2a9a('0x2c')]:_0x53f502[_0x2a9a('0x28')];if(!_0x331de3[_0x2a9a('0x2a')][_0x2a9a('0x2e')](_0x2a9a('0x2f'))){_0x43d8b0['limit']=qs['limit'](_0x331de3[_0x2a9a('0x2a')][_0x2a9a('0x30')]);_0x43d8b0[_0x2a9a('0x19')]=qs[_0x2a9a('0x19')](_0x331de3[_0x2a9a('0x2a')][_0x2a9a('0x19')]);}_0x43d8b0[_0x2a9a('0x31')]=qs[_0x2a9a('0x32')](_0x331de3[_0x2a9a('0x2a')][_0x2a9a('0x32')]);_0x43d8b0[_0x2a9a('0x33')]=qs[_0x2a9a('0x34')](_['pick'](_0x331de3['query'],_0x53f502[_0x2a9a('0x34')]));if(_0x331de3[_0x2a9a('0x2a')][_0x2a9a('0x35')]){_0x43d8b0[_0x2a9a('0x33')]=_[_0x2a9a('0x36')](_0x43d8b0[_0x2a9a('0x33')],{'$or':_[_0x2a9a('0x37')](_0x2f877d,function(_0x233306){if(_0x233306['type'][_0x2a9a('0x38')]!=='VIRTUAL'){var _0xf9180e={};_0xf9180e[_0x233306[_0x2a9a('0x39')]]={'$like':'%'+_0x331de3[_0x2a9a('0x2a')][_0x2a9a('0x35')]+'%'};return _0xf9180e;}})});}_0x43d8b0=_[_0x2a9a('0x36')]({},_0x43d8b0,_0x331de3[_0x2a9a('0x3a')]);var _0x37dd76={'where':_0x43d8b0['where']};return db[_0x2a9a('0x26')][_0x2a9a('0x18')](_0x37dd76)['then'](function(_0x8440be){_0x291230[_0x2a9a('0x18')]=_0x8440be;if(_0x331de3[_0x2a9a('0x2a')][_0x2a9a('0x3b')]){_0x43d8b0[_0x2a9a('0x3c')]=[{'all':!![]}];}return db[_0x2a9a('0x26')][_0x2a9a('0x3d')](_0x43d8b0);})[_0x2a9a('0x3e')](function(_0x30a58e){_0x291230[_0x2a9a('0x3f')]=_0x30a58e;return _0x291230;})[_0x2a9a('0x3e')](respondWithFilteredResult(_0x313f32,_0x43d8b0))['catch'](handleError(_0x313f32,null));};exports[_0x2a9a('0x40')]=function(_0x51ab0f,_0x48e334){var _0x5a0601={'raw':!![],'where':{'id':_0x51ab0f[_0x2a9a('0x41')]['id']}},_0x1d2683={};_0x1d2683[_0x2a9a('0x28')]=_[_0x2a9a('0x29')](db[_0x2a9a('0x26')][_0x2a9a('0x27')]);_0x1d2683[_0x2a9a('0x2a')]=_['keys'](_0x51ab0f['query']);_0x1d2683['filters']=_[_0x2a9a('0x2b')](_0x1d2683[_0x2a9a('0x28')],_0x1d2683[_0x2a9a('0x2a')]);_0x5a0601['attributes']=_[_0x2a9a('0x2b')](_0x1d2683['model'],qs['fields'](_0x51ab0f[_0x2a9a('0x2a')][_0x2a9a('0x2d')]));_0x5a0601[_0x2a9a('0x2c')]=_0x5a0601[_0x2a9a('0x2c')][_0x2a9a('0x42')]?_0x5a0601[_0x2a9a('0x2c')]:_0x1d2683[_0x2a9a('0x28')];if(_0x51ab0f['query']['includeAll']){_0x5a0601[_0x2a9a('0x3c')]=[{'all':!![]}];}_0x5a0601=_[_0x2a9a('0x36')]({},_0x5a0601,_0x51ab0f[_0x2a9a('0x3a')]);return db[_0x2a9a('0x26')][_0x2a9a('0x43')](_0x5a0601)[_0x2a9a('0x3e')](handleEntityNotFound(_0x48e334,null))[_0x2a9a('0x3e')](respondWithResult(_0x48e334,null))[_0x2a9a('0x44')](handleError(_0x48e334,null));};exports['create']=function(_0x64b652,_0x58201b){return db[_0x2a9a('0x26')][_0x2a9a('0x45')](_0x64b652[_0x2a9a('0x46')],{})[_0x2a9a('0x3e')](respondWithResult(_0x58201b,0xc9))[_0x2a9a('0x44')](handleError(_0x58201b,null));};exports['update']=function(_0x192cd3,_0x2258bf){if(_0x192cd3[_0x2a9a('0x46')]['id']){delete _0x192cd3[_0x2a9a('0x46')]['id'];}return db[_0x2a9a('0x26')][_0x2a9a('0x43')]({'where':{'id':_0x192cd3[_0x2a9a('0x41')]['id']}})[_0x2a9a('0x3e')](handleEntityNotFound(_0x2258bf,null))[_0x2a9a('0x3e')](saveUpdates(_0x192cd3['body'],null))[_0x2a9a('0x3e')](respondWithResult(_0x2258bf,null))[_0x2a9a('0x44')](handleError(_0x2258bf,null));};exports[_0x2a9a('0x47')]=function(_0x64368c,_0x33bb28){return db[_0x2a9a('0x26')]['find']({'where':{'id':_0x64368c[_0x2a9a('0x41')]['id']}})[_0x2a9a('0x3e')](handleEntityNotFound(_0x33bb28,null))['then'](removeEntity(_0x33bb28,null))[_0x2a9a('0x44')](handleError(_0x33bb28,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index eb5869e..10a1dc6 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 _0x4c4e=['fax_applications','api','moment','bluebird','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0x4c4e,0x1e9));var _0xe4c4=function(_0x58f160,_0x371817){_0x58f160=_0x58f160-0x0;var _0x265ffb=_0x4c4e[_0x58f160];return _0x265ffb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe4c4('0x0'));var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rp=require('request-promise');var attributes=require(_0xe4c4('0x3'));module[_0xe4c4('0x4')]=function(_0x367898,_0x180a0f){return _0x367898[_0xe4c4('0x5')](_0xe4c4('0x6'),attributes,{'tableName':_0xe4c4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0741=['util','../../config/logger','api','bluebird','request-promise','./faxApplication.attributes','exports','define','FaxApplication','lodash'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x0741,0xbd));var _0x1074=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0741[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x1074('0x0'));var util=require(_0x1074('0x1'));var logger=require(_0x1074('0x2'))(_0x1074('0x3'));var moment=require('moment');var BPromise=require(_0x1074('0x4'));var rp=require(_0x1074('0x5'));var attributes=require(_0x1074('0x6'));module[_0x1074('0x7')]=function(_0x1baad4,_0x51d074){return _0x1baad4[_0x1074('0x8')](_0x1074('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index caeb17c..e2a1ce7 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 _0x8398=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','limit','stringify','lodash','util'];(function(_0xa74549,_0x10ea31){var _0x23b811=function(_0x480ce8){while(--_0x480ce8){_0xa74549['push'](_0xa74549['shift']());}};_0x23b811(++_0x10ea31);}(_0x8398,0xb8));var _0x8839=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x8398[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x8839('0x0'));var util=require(_0x8839('0x1'));var moment=require(_0x8839('0x2'));var BPromise=require(_0x8839('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8839('0x4'));var db=require(_0x8839('0x5'))['db'];var utils=require(_0x8839('0x6'));var logger=require(_0x8839('0x7'))(_0x8839('0x8'));var config=require(_0x8839('0x9'));var jayson=require(_0x8839('0xa'));var client=jayson['client'][_0x8839('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x291074,_0x2d80ee,_0x57b6b4){return new BPromise(function(_0x2b04d3,_0x118d9d){return client[_0x8839('0xc')](_0x291074,_0x57b6b4)[_0x8839('0xd')](function(_0x35c399){logger[_0x8839('0xe')](_0x8839('0xf'),_0x2d80ee,'request\x20sent');logger[_0x8839('0x10')](_0x8839('0x11'),_0x2d80ee,'request\x20sent',JSON['stringify'](_0x35c399));if(_0x35c399['error']){if(_0x35c399['error'][_0x8839('0x12')]===0x1f4){logger[_0x8839('0x13')](_0x8839('0xf'),_0x2d80ee,_0x35c399[_0x8839('0x13')][_0x8839('0x14')]);return _0x118d9d(_0x35c399[_0x8839('0x13')][_0x8839('0x14')]);}logger[_0x8839('0x13')](_0x8839('0xf'),_0x2d80ee,_0x35c399[_0x8839('0x13')][_0x8839('0x14')]);return _0x2b04d3(_0x35c399[_0x8839('0x13')][_0x8839('0x14')]);}else{logger[_0x8839('0xe')]('FaxApplication,\x20%s,\x20%s',_0x2d80ee,_0x8839('0x15'));_0x2b04d3(_0x35c399['result'][_0x8839('0x14')]);}})[_0x8839('0x16')](function(_0x294578){logger[_0x8839('0x13')](_0x8839('0xf'),_0x2d80ee,_0x294578);_0x118d9d(_0x294578);});});}exports[_0x8839('0x17')]=function(_0x7eaeb){var _0x16ac37=this;return new Promise(function(_0x43da83,_0x31fa6f){return db[_0x8839('0x18')][_0x8839('0x19')](_0x7eaeb[_0x8839('0x1a')],{'raw':_0x7eaeb[_0x8839('0x1b')]?_0x7eaeb['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7eaeb[_0x8839('0x1b')]?_0x7eaeb[_0x8839('0x1b')][_0x8839('0x1c')]||null:null,'attributes':_0x7eaeb[_0x8839('0x1b')]?_0x7eaeb[_0x8839('0x1b')]['attributes']||null:null,'limit':_0x7eaeb[_0x8839('0x1b')]?_0x7eaeb[_0x8839('0x1b')][_0x8839('0x1d')]||null:null})[_0x8839('0xd')](function(_0x2aeb6a){logger[_0x8839('0xe')](_0x8839('0x17'),_0x7eaeb);logger[_0x8839('0x10')](_0x8839('0x17'),_0x7eaeb,JSON[_0x8839('0x1e')](_0x2aeb6a));_0x43da83(_0x2aeb6a);})['catch'](function(_0x58ca81){logger['error']('UpdateFaxApplication',_0x58ca81[_0x8839('0x14')],_0x7eaeb);_0x31fa6f(_0x16ac37[_0x8839('0x13')](0x1f4,_0x58ca81[_0x8839('0x14')]));});});}; \ No newline at end of file +var _0xbfe2=['then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xbfe2,0x1e3));var _0x2bfe=function(_0x2a366c,_0x4b7f4c){_0x2a366c=_0x2a366c-0x0;var _0x48008c=_0xbfe2[_0x2a366c];return _0x48008c;};'use strict';var _=require(_0x2bfe('0x0'));var util=require(_0x2bfe('0x1'));var moment=require('moment');var BPromise=require(_0x2bfe('0x2'));var rs=require(_0x2bfe('0x3'));var fs=require('fs');var Redis=require(_0x2bfe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2bfe('0x5'));var logger=require(_0x2bfe('0x6'))(_0x2bfe('0x7'));var config=require(_0x2bfe('0x8'));var jayson=require(_0x2bfe('0x9'));var client=jayson[_0x2bfe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x160b9d,_0x2f08d7,_0x1cd39d){return new BPromise(function(_0x427b64,_0x23771d){return client[_0x2bfe('0xb')](_0x160b9d,_0x1cd39d)[_0x2bfe('0xc')](function(_0x406cd0){logger[_0x2bfe('0xd')](_0x2bfe('0xe'),_0x2f08d7,'request\x20sent');logger[_0x2bfe('0xf')](_0x2bfe('0x10'),_0x2f08d7,'request\x20sent',JSON[_0x2bfe('0x11')](_0x406cd0));if(_0x406cd0[_0x2bfe('0x12')]){if(_0x406cd0[_0x2bfe('0x12')][_0x2bfe('0x13')]===0x1f4){logger[_0x2bfe('0x12')](_0x2bfe('0xe'),_0x2f08d7,_0x406cd0['error'][_0x2bfe('0x14')]);return _0x23771d(_0x406cd0['error'][_0x2bfe('0x14')]);}logger[_0x2bfe('0x12')](_0x2bfe('0xe'),_0x2f08d7,_0x406cd0[_0x2bfe('0x12')]['message']);return _0x427b64(_0x406cd0[_0x2bfe('0x12')][_0x2bfe('0x14')]);}else{logger[_0x2bfe('0xd')]('FaxApplication,\x20%s,\x20%s',_0x2f08d7,_0x2bfe('0x15'));_0x427b64(_0x406cd0[_0x2bfe('0x16')][_0x2bfe('0x14')]);}})[_0x2bfe('0x17')](function(_0x39f983){logger[_0x2bfe('0x12')](_0x2bfe('0xe'),_0x2f08d7,_0x39f983);_0x23771d(_0x39f983);});});}exports[_0x2bfe('0x18')]=function(_0x5bf924){var _0x2928bb=this;return new Promise(function(_0x56be67,_0x206ba7){return db[_0x2bfe('0x19')][_0x2bfe('0x1a')](_0x5bf924[_0x2bfe('0x1b')],{'raw':_0x5bf924[_0x2bfe('0x1c')]?_0x5bf924[_0x2bfe('0x1c')][_0x2bfe('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bf924['options']?_0x5bf924['options'][_0x2bfe('0x1e')]||null:null,'attributes':_0x5bf924[_0x2bfe('0x1c')]?_0x5bf924[_0x2bfe('0x1c')][_0x2bfe('0x1f')]||null:null,'limit':_0x5bf924['options']?_0x5bf924[_0x2bfe('0x1c')][_0x2bfe('0x20')]||null:null})[_0x2bfe('0xc')](function(_0xa44311){logger['info'](_0x2bfe('0x18'),_0x5bf924);logger[_0x2bfe('0xf')](_0x2bfe('0x18'),_0x5bf924,JSON[_0x2bfe('0x11')](_0xa44311));_0x56be67(_0xa44311);})['catch'](function(_0x4a4d2c){logger[_0x2bfe('0x12')](_0x2bfe('0x18'),_0x4a4d2c[_0x2bfe('0x14')],_0x5bf924);_0x206ba7(_0x2928bb[_0x2bfe('0x12')](0x1f4,_0x4a4d2c[_0x2bfe('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e13971d..8d560c2 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 _0xae60=['post','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','/:id','show'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xae60,0x1c7));var _0x0ae6=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xae60[_0x44946b];return _0x249bc4;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var auth=require(_0x0ae6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0ae6('0x6'));var controller=require(_0x0ae6('0x7'));router['get']('/',auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x9')]);router[_0x0ae6('0xa')](_0x0ae6('0xb'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0xd')]('/',auth[_0x0ae6('0x8')](),controller['create']);router[_0x0ae6('0xe')](_0x0ae6('0xb'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0xf')]);router['delete'](_0x0ae6('0xb'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x10')]);module[_0x0ae6('0x11')]=router; \ No newline at end of file +var _0x6e6c=['multer','util','connect-timeout','express','../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports'];(function(_0x4e36e5,_0x1f6f1c){var _0x4d2ac2=function(_0x731cb9){while(--_0x731cb9){_0x4e36e5['push'](_0x4e36e5['shift']());}};_0x4d2ac2(++_0x1f6f1c);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc6e6('0x4'));var config=require('../../config/environment');var controller=require(_0xc6e6('0x5'));router['get']('/',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0x7')]);router['get'](_0xc6e6('0x8'),auth[_0xc6e6('0x6')](),controller['show']);router[_0xc6e6('0x9')]('/',auth[_0xc6e6('0x6')](),controller['create']);router[_0xc6e6('0xa')]('/:id',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0xc')](_0xc6e6('0x8'),auth[_0xc6e6('0x6')](),controller[_0xc6e6('0xd')]);module[_0xc6e6('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b6f7b06..be5b8b3 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 _0xd557=['DATE','ENUM','out','sequelize','BOOLEAN','STRING'];(function(_0xb77a41,_0xd8e1b9){var _0x2711ad=function(_0x494ff4){while(--_0x494ff4){_0xb77a41['push'](_0xb77a41['shift']());}};_0x2711ad(++_0xd8e1b9);}(_0xd557,0x13b));var _0x7d55=function(_0x2d0d93,_0xc916f7){_0x2d0d93=_0x2d0d93-0x0;var _0x7fbf52=_0xd557[_0x2d0d93];return _0x7fbf52;};'use strict';var Sequelize=require(_0x7d55('0x0'));module['exports']={'closed':{'type':Sequelize[_0x7d55('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7d55('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7d55('0x3')]},'fax':{'type':Sequelize[_0x7d55('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7d55('0x4')]('in',_0x7d55('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7d55('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7d55('0x4')]('in',_0x7d55('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7b46=['sequelize','exports','DATE','STRING','out','ENUM'];(function(_0x25a59e,_0xd717c4){var _0x1f6c50=function(_0xfe0a85){while(--_0xfe0a85){_0x25a59e['push'](_0x25a59e['shift']());}};_0x1f6c50(++_0xd717c4);}(_0x7b46,0xb4));var _0x67b4=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x7b46[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require(_0x67b4('0x0'));module[_0x67b4('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x67b4('0x2')]},'disposition':{'type':Sequelize[_0x67b4('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x67b4('0x2')]},'fax':{'type':Sequelize[_0x67b4('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x67b4('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x67b4('0x5')]('in','out'),'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 8a15742..99c7d38 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 _0xdef5=['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','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./faxInteraction.socket','register','end','offset','limit','status','apply','reject','save','destroy','then','stack','name','send','index','FaxInteraction','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','include','push','Tags','tag','distinct','read','count','includeAll','User','Users','fullname','CmContact','FaxAccount','Account','direction','createdAt','Tag','ThroughTags','color','findAll','rows','catch','show','params','find','create','body','update','describe','addMessage','FaxMessage','ids','omit','findOne','FaxInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','server','files','root','tmp','Attachment','mkdirSync','basename','existsSync','createWriteStream','err','unlinkSync','sendStatus'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xdef5,0x183));var _0x5def=function(_0x4623d0,_0x36d4d9){_0x4623d0=_0x4623d0-0x0;var _0x4f9dc1=_0xdef5[_0x4623d0];return _0x4f9dc1;};'use strict';var pdf=require(_0x5def('0x0'));var emlformat=require(_0x5def('0x1'));var rimraf=require(_0x5def('0x2'));var zipdir=require(_0x5def('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5def('0x4'));var moment=require(_0x5def('0x5'));var BPromise=require(_0x5def('0x6'));var Mustache=require(_0x5def('0x7'));var util=require(_0x5def('0x8'));var path=require(_0x5def('0x9'));var sox=require(_0x5def('0xa'));var csv=require(_0x5def('0xb'));var ejs=require(_0x5def('0xc'));var fs=require('fs');var _=require(_0x5def('0xd'));var squel=require(_0x5def('0xe'));var crypto=require(_0x5def('0xf'));var jsforce=require(_0x5def('0x10'));var deskjs=require(_0x5def('0x11'));var toCsv=require(_0x5def('0xb'));var querystring=require(_0x5def('0x12'));var Papa=require(_0x5def('0x13'));var authService=require('../../components/auth/service');var hardwareService=require(_0x5def('0x14'));var Redis=require(_0x5def('0x15'));var qs=require(_0x5def('0x16'));var logger=require(_0x5def('0x17'))(_0x5def('0x18'));var utils=require(_0x5def('0x19'));var config=require(_0x5def('0x1a'));var db=require(_0x5def('0x1b'))['db'];config[_0x5def('0x1c')]=_['defaults'](config[_0x5def('0x1c')],{'host':_0x5def('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5def('0x1e'))[_0x5def('0x1f')](socket);function respondWithStatusCode(_0x433c1d,_0x55b86b){_0x55b86b=_0x55b86b||0xcc;return function(_0x4a3c56){if(_0x4a3c56){return _0x433c1d['sendStatus'](_0x55b86b);}return _0x433c1d['status'](_0x55b86b)[_0x5def('0x20')]();};}function respondWithResult(_0x250d83,_0x4e7659){_0x4e7659=_0x4e7659||0xc8;return function(_0x4c7327){if(_0x4c7327){return _0x250d83['status'](_0x4e7659)['json'](_0x4c7327);}};}function respondWithFilteredResult(_0x27a55e,_0x38d98f){return function(_0x169aef){if(_0x169aef){var _0x1928d8=_0x169aef['count'],_0xde58f7=_0x38d98f[_0x5def('0x21')],_0x3c306a=_0x38d98f[_0x5def('0x21')]+_0x38d98f[_0x5def('0x22')],_0x4f4da2;if(_0x3c306a>=_0x1928d8){_0x3c306a=_0x1928d8;_0x4f4da2=0xc8;}else{_0x4f4da2=0xce;}_0x27a55e[_0x5def('0x23')](_0x4f4da2);return _0x27a55e['set']('Content-Range',_0xde58f7+'-'+_0x3c306a+'/'+_0x1928d8)['json'](_0x169aef);}return null;};}function patchUpdates(_0x4c5f8e){return function(_0x501907){try{jsonpatch[_0x5def('0x24')](_0x501907,_0x4c5f8e,!![]);}catch(_0x233fd0){return BPromise[_0x5def('0x25')](_0x233fd0);}return _0x501907[_0x5def('0x26')]();};}function saveUpdates(_0x2a68f7,_0x849ea2){return function(_0x2b20f3){if(_0x2b20f3){return _0x2b20f3['update'](_0x2a68f7)['then'](function(_0x7a30d2){return _0x7a30d2;});}return null;};}function removeEntity(_0x5ad969,_0x209bb4){return function(_0x3ff7c9){if(_0x3ff7c9){return _0x3ff7c9[_0x5def('0x27')]()[_0x5def('0x28')](function(){_0x5ad969[_0x5def('0x23')](0xcc)[_0x5def('0x20')]();});}};}function handleEntityNotFound(_0x21a384,_0x221283){return function(_0x2ca25a){if(!_0x2ca25a){_0x21a384['sendStatus'](0x194);}return _0x2ca25a;};}function handleError(_0x47e086,_0x1dd84e){_0x1dd84e=_0x1dd84e||0x1f4;return function(_0x24e4b6){logger['error'](_0x24e4b6[_0x5def('0x29')]);if(_0x24e4b6[_0x5def('0x2a')]){delete _0x24e4b6[_0x5def('0x2a')];}_0x47e086['status'](_0x1dd84e)[_0x5def('0x2b')](_0x24e4b6);};}exports[_0x5def('0x2c')]=function(_0x43196f,_0x33c0af){var _0xc6153a={},_0x507e31={},_0x1c810b={'count':0x0,'rows':[]};var _0x5ed156=db[_0x5def('0x2d')][_0x5def('0x2e')];_0x507e31[_0x5def('0x2f')]=_[_0x5def('0x30')](_0x5ed156);_0x507e31[_0x5def('0x31')]=_[_0x5def('0x30')](_0x43196f[_0x5def('0x31')]);_0x507e31[_0x5def('0x32')]=_[_0x5def('0x33')](_0x507e31[_0x5def('0x2f')],_0x507e31['query']);_0xc6153a[_0x5def('0x34')]=_[_0x5def('0x33')](_0x507e31[_0x5def('0x2f')],qs['fields'](_0x43196f[_0x5def('0x31')][_0x5def('0x35')]));_0xc6153a[_0x5def('0x34')]=_0xc6153a[_0x5def('0x34')][_0x5def('0x36')]?_0xc6153a[_0x5def('0x34')]:_0x507e31[_0x5def('0x2f')];if(!_0x43196f[_0x5def('0x31')][_0x5def('0x37')](_0x5def('0x38'))){_0xc6153a[_0x5def('0x22')]=qs[_0x5def('0x22')](_0x43196f['query'][_0x5def('0x22')]);_0xc6153a[_0x5def('0x21')]=qs[_0x5def('0x21')](_0x43196f[_0x5def('0x31')][_0x5def('0x21')]);}_0xc6153a['order']=qs[_0x5def('0x39')](_0x43196f[_0x5def('0x31')][_0x5def('0x39')]);_0xc6153a['where']=qs[_0x5def('0x32')](_[_0x5def('0x3a')](_0x43196f[_0x5def('0x31')],_0x507e31[_0x5def('0x32')]));if(_0x43196f[_0x5def('0x31')][_0x5def('0x3b')]){_0xc6153a[_0x5def('0x3c')]=_[_0x5def('0x3d')](_0xc6153a[_0x5def('0x3c')],{'$or':_[_0x5def('0x3e')](_0x5ed156,function(_0x15896b){if(_0x15896b[_0x5def('0x3f')][_0x5def('0x40')]!==_0x5def('0x41')){var _0x1847d8={};_0x1847d8[_0x15896b[_0x5def('0x42')]]={'$like':'%'+_0x43196f[_0x5def('0x31')][_0x5def('0x3b')]+'%'};return _0x1847d8;}})});}_0xc6153a=_[_0x5def('0x3d')]({},_0xc6153a,_0x43196f[_0x5def('0x43')]);var _0x37fc92={'where':_0xc6153a['where']};_0x37fc92[_0x5def('0x44')]=[];if(_0x43196f['query']['tag']){_0x37fc92[_0x5def('0x44')][_0x5def('0x45')]({'model':db['Tag'],'as':_0x5def('0x46'),'attributes':['id'],'where':{'id':_0x43196f[_0x5def('0x31')][_0x5def('0x47')]},'required':!![]});_0x37fc92[_0x5def('0x48')]=!![];}if(_0x43196f[_0x5def('0x31')]['read']){_0x37fc92[_0x5def('0x44')][_0x5def('0x45')]({'model':db['FaxMessage'],'as':'Messages','attributes':['id','direction','createdAt',_0x5def('0x49')],'where':{'direction':'in','read':_0x43196f[_0x5def('0x31')][_0x5def('0x49')]||![]},'required':!![]});_0x37fc92[_0x5def('0x48')]=!![];}return db[_0x5def('0x2d')][_0x5def('0x4a')](_0x37fc92)[_0x5def('0x28')](function(_0x2ed5e0){_0x1c810b[_0x5def('0x4a')]=_0x2ed5e0;if(_0x43196f[_0x5def('0x31')][_0x5def('0x4b')]){_0xc6153a[_0x5def('0x44')]=[{'model':db[_0x5def('0x4c')],'as':_0x5def('0x4d'),'required':![],'attributes':['id',_0x5def('0x2a'),_0x5def('0x4e')]},{'model':db[_0x5def('0x4f')],'as':'Contact','required':![]},{'model':db[_0x5def('0x4c')],'as':'Owner','attributes':[_0x5def('0x2a'),'fullname','internal'],'required':![]},{'model':db[_0x5def('0x50')],'as':_0x5def('0x51'),'attributes':[_0x5def('0x2a'),_0x5def('0x40')],'required':![]},{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x5def('0x52'),_0x5def('0x53'),_0x5def('0x49')],'where':{'direction':'in','read':_0x43196f['query']['read']||![]},'required':_0x43196f[_0x5def('0x31')][_0x5def('0x49')]||![]},{'model':db[_0x5def('0x54')],'as':_0x5def('0x46'),'attributes':['id',_0x5def('0x2a'),'color'],'required':_0x43196f[_0x5def('0x31')][_0x5def('0x47')]?!![]:![]},{'model':db['Tag'],'as':_0x5def('0x55'),'attributes':['id','name',_0x5def('0x56')],'through':_0x43196f[_0x5def('0x31')][_0x5def('0x47')]?{'attributes':[],'where':{'TagId':_0x43196f[_0x5def('0x31')]['tag']||undefined}}:{},'required':_0x43196f['query']['tag']?!![]:![]}];}return db[_0x5def('0x2d')][_0x5def('0x57')](_0xc6153a);})[_0x5def('0x28')](function(_0x318ce1){_0x1c810b[_0x5def('0x58')]=_0x318ce1;return _0x1c810b;})[_0x5def('0x28')](respondWithFilteredResult(_0x33c0af,_0xc6153a))[_0x5def('0x59')](handleError(_0x33c0af,null));};exports[_0x5def('0x5a')]=function(_0x1a4a5b,_0x1a251a){var _0x4d2ace={'raw':![],'where':{'id':_0x1a4a5b[_0x5def('0x5b')]['id']}},_0x38980d={};_0x38980d[_0x5def('0x2f')]=_[_0x5def('0x30')](db[_0x5def('0x2d')]['rawAttributes']);_0x38980d['query']=_[_0x5def('0x30')](_0x1a4a5b[_0x5def('0x31')]);_0x38980d[_0x5def('0x32')]=_['intersection'](_0x38980d[_0x5def('0x2f')],_0x38980d['query']);_0x4d2ace['attributes']=_[_0x5def('0x33')](_0x38980d[_0x5def('0x2f')],qs[_0x5def('0x35')](_0x1a4a5b[_0x5def('0x31')]['fields']));_0x4d2ace[_0x5def('0x34')]=_0x4d2ace[_0x5def('0x34')]['length']?_0x4d2ace[_0x5def('0x34')]:_0x38980d['model'];if(_0x1a4a5b['query']['includeAll']){_0x4d2ace[_0x5def('0x44')]=[{'all':!![]}];}_0x4d2ace=_[_0x5def('0x3d')]({},_0x4d2ace,_0x1a4a5b['options']);return db['FaxInteraction'][_0x5def('0x5c')](_0x4d2ace)[_0x5def('0x28')](handleEntityNotFound(_0x1a251a,null))[_0x5def('0x28')](respondWithResult(_0x1a251a,null))[_0x5def('0x59')](handleError(_0x1a251a,null));};exports[_0x5def('0x5d')]=function(_0x9d2540,_0x38b1f7){return db[_0x5def('0x2d')][_0x5def('0x5d')](_0x9d2540[_0x5def('0x5e')],{})[_0x5def('0x28')](respondWithResult(_0x38b1f7,0xc9))['catch'](handleError(_0x38b1f7,null));};exports[_0x5def('0x5f')]=function(_0x43a0ab,_0x49f855){if(_0x43a0ab[_0x5def('0x5e')]['id']){delete _0x43a0ab[_0x5def('0x5e')]['id'];}return db['FaxInteraction'][_0x5def('0x5c')]({'where':{'id':_0x43a0ab['params']['id']}})[_0x5def('0x28')](handleEntityNotFound(_0x49f855,null))['then'](saveUpdates(_0x43a0ab[_0x5def('0x5e')],null))[_0x5def('0x28')](respondWithResult(_0x49f855,null))[_0x5def('0x59')](handleError(_0x49f855,null));};exports[_0x5def('0x27')]=function(_0x421921,_0x17d170){return db[_0x5def('0x2d')][_0x5def('0x5c')]({'where':{'id':_0x421921['params']['id']}})[_0x5def('0x28')](handleEntityNotFound(_0x17d170,null))[_0x5def('0x28')](removeEntity(_0x17d170,null))['catch'](handleError(_0x17d170,null));};exports[_0x5def('0x60')]=function(_0x297dea,_0x2f727d){return db[_0x5def('0x2d')][_0x5def('0x60')]()[_0x5def('0x28')](respondWithResult(_0x2f727d,null))[_0x5def('0x59')](handleError(_0x2f727d,null));};exports[_0x5def('0x61')]=function(_0x4bdddf,_0x43e4e9,_0x4a2961){return db[_0x5def('0x62')]['find']({'where':{'id':_0x4bdddf[_0x5def('0x5b')]['id']}})[_0x5def('0x28')](handleEntityNotFound(_0x43e4e9,null))['then'](function(_0x1a9b82){if(_0x1a9b82){return _0x1a9b82[_0x5def('0x61')](_0x4bdddf['body'][_0x5def('0x63')],_[_0x5def('0x64')](_0x4bdddf['body'],[_0x5def('0x63'),'id'])||{});}})['then'](respondWithResult(_0x43e4e9,null))[_0x5def('0x59')](handleError(_0x43e4e9,null));};exports['getMessages']=function(_0x3ac33a,_0xb57ef,_0x12f6f7){var _0x257388={'raw':![],'where':{}};var _0x3b912e={};var _0xc202d3={'count':0x0,'rows':[]};return db[_0x5def('0x2d')][_0x5def('0x65')]({'where':{'id':_0x3ac33a[_0x5def('0x5b')]['id']}})['then'](handleEntityNotFound(_0xb57ef,null))['then'](function(_0x1fc84c){if(_0x1fc84c){_0x3b912e[_0x5def('0x2f')]=_['keys'](db['FaxMessage'][_0x5def('0x2e')]);_0x3b912e['query']=_['keys'](_0x3ac33a['query']);_0x3b912e[_0x5def('0x32')]=_[_0x5def('0x33')](_0x3b912e[_0x5def('0x2f')],_0x3b912e[_0x5def('0x31')]);_0x257388[_0x5def('0x34')]=_[_0x5def('0x33')](_0x3b912e['model'],qs[_0x5def('0x35')](_0x3ac33a[_0x5def('0x31')][_0x5def('0x35')]));_0x257388[_0x5def('0x34')]=_0x257388[_0x5def('0x34')]['length']?_0x257388['attributes']:_0x3b912e['model'];if(!_0x3ac33a[_0x5def('0x31')][_0x5def('0x37')]('nolimit')){_0x257388['limit']=qs['limit'](_0x3ac33a[_0x5def('0x31')][_0x5def('0x22')]);_0x257388[_0x5def('0x21')]=qs[_0x5def('0x21')](_0x3ac33a[_0x5def('0x31')][_0x5def('0x21')]);}_0x257388['order']=qs[_0x5def('0x39')](_0x3ac33a['query'][_0x5def('0x39')]);_0x257388[_0x5def('0x3c')]=qs['filters'](_[_0x5def('0x3a')](_0x3ac33a[_0x5def('0x31')],_0x3b912e['filters']));_0x257388['where'][_0x5def('0x66')]=_0x1fc84c['id'];if(_0x3ac33a['query'][_0x5def('0x3b')]){_0x257388['where']=_[_0x5def('0x3d')](_0x257388[_0x5def('0x3c')],{'$or':_['map'](_0x257388[_0x5def('0x34')],function(_0x579f64){var _0x36c7d2={};_0x36c7d2[_0x579f64]={'$like':'%'+_0x3ac33a[_0x5def('0x31')]['filter']+'%'};return _0x36c7d2;})});}if(_0x3ac33a[_0x5def('0x31')]['$gte']){var _0xd0ed30=_0x3ac33a[_0x5def('0x31')][_0x5def('0x67')][_0x5def('0x68')](',');var _0x13e812={};_0x13e812[_0xd0ed30[0x0]]={'$gte':moment(_0xd0ed30[0x1])[_0x5def('0x69')](_0x5def('0x6a'))};_0x257388['where']=_[_0x5def('0x3d')](_0x257388[_0x5def('0x3c')],_0x13e812);}_0x257388=_['merge']({},_0x257388,_0x3ac33a[_0x5def('0x43')]);return db[_0x5def('0x62')][_0x5def('0x4a')]({'where':_0x257388['where']})['then'](function(_0x3af793){_0xc202d3['count']=_0x3af793;if(_0x3ac33a['query'][_0x5def('0x4b')]){_0x257388[_0x5def('0x44')]=[{'all':!![]}];}return db[_0x5def('0x62')][_0x5def('0x57')](_0x257388);})[_0x5def('0x28')](function(_0x79e391){_0xc202d3[_0x5def('0x58')]=_0x79e391;return _0xc202d3;});}})[_0x5def('0x28')](respondWithFilteredResult(_0xb57ef,_0x257388))[_0x5def('0x59')](handleError(_0xb57ef,null));};exports[_0x5def('0x6b')]=function(_0x44eb33,_0x4d758b,_0x3945a2){return db[_0x5def('0x2d')][_0x5def('0x5c')]({'where':{'id':_0x44eb33[_0x5def('0x5b')]['id']}})[_0x5def('0x28')](handleEntityNotFound(_0x4d758b,null))[_0x5def('0x28')](function(_0x7e7ac6){if(_0x7e7ac6){return _0x7e7ac6[_0x5def('0x6c')](_0x44eb33[_0x5def('0x5e')]['ids'],_[_0x5def('0x64')](_0x44eb33[_0x5def('0x5e')],[_0x5def('0x63'),'id'])||{})[_0x5def('0x6d')](function(){return db['Tag'][_0x5def('0x57')]({'attributes':['id','name',_0x5def('0x56')],'where':{'id':_0x44eb33[_0x5def('0x5e')][_0x5def('0x63')]}});})[_0x5def('0x28')](function(_0x2262d9){socket[_0x5def('0x6e')](_0x5def('0x6f'),{'id':Number(_0x44eb33[_0x5def('0x5b')]['id']),'tags':_0x2262d9||[]});return{'id':Number(_0x44eb33[_0x5def('0x5b')]['id']),'tags':_0x2262d9||[]};});}})['then'](respondWithResult(_0x4d758b,null))[_0x5def('0x59')](handleError(_0x4d758b,null));};exports[_0x5def('0x70')]=function(_0x5d7cde,_0x3b252d,_0x5671f5){var _0x2ccf3b;return db[_0x5def('0x2d')][_0x5def('0x5c')]({'where':{'id':_0x5d7cde[_0x5def('0x5b')]['id']}})[_0x5def('0x28')](handleEntityNotFound(_0x3b252d,null))[_0x5def('0x28')](function(_0x5a5b08){if(_0x5a5b08){return _0x5a5b08[_0x5def('0x70')](_0x5d7cde[_0x5def('0x31')][_0x5def('0x63')]);}})['then'](respondWithStatusCode(_0x3b252d,null))[_0x5def('0x59')](handleError(_0x3b252d,null));};exports[_0x5def('0x71')]=function(_0x26078e,_0x165eb1){var _0x231996=moment()[_0x5def('0x72')]()[_0x5def('0x73')]();var _0x11e52c=path[_0x5def('0x74')](config['root'],_0x5def('0x75'),_0x5def('0x76'),'attachments');var _0xb59a1b=path[_0x5def('0x74')](config[_0x5def('0x77')],_0x5def('0x75'),_0x5def('0x76'),_0x5def('0x78'));var _0x33be31=path[_0x5def('0x74')](_0xb59a1b,_0x231996);var _0x5c2f52=util['format']('interaction-%s.zip',_0x231996);var _0x1f7c22=path[_0x5def('0x74')](_0xb59a1b,_0x5c2f52);var _0x575414=![];return db['FaxInteraction'][_0x5def('0x5c')]({'where':{'id':_0x26078e[_0x5def('0x5b')]['id']}})[_0x5def('0x28')](handleEntityNotFound(_0x165eb1,null))['then'](function(_0x3ee2e3){if(_0x3ee2e3){return _0x3ee2e3['getMessages']({'attributes':['id',_0x5def('0x5e'),_0x5def('0x53')],'include':[{'model':db[_0x5def('0x79')],'as':_0x5def('0x79')}]});}return[];})[_0x5def('0x28')](function(_0x1587e5){_0x575414=_0x1587e5['length'];if(_0x1587e5[_0x5def('0x36')]){fs[_0x5def('0x7a')](_0x33be31);for(var _0x1cb396=0x0;_0x1cb396<_0x1587e5[_0x5def('0x36')];_0x1cb396++){var _0x2915bc=_0x1587e5[_0x1cb396];var _0x2b5611=_0x2915bc[_0x5def('0x79')];if(_0x2b5611){var _0x41f794=path[_0x5def('0x74')](_0x11e52c,_0x2b5611[_0x5def('0x7b')]);if(fs[_0x5def('0x7c')](_0x41f794)){fs['createReadStream'](_0x41f794)['pipe'](fs[_0x5def('0x7d')](path['join'](_0x33be31,_0x2b5611['basename'])));}}}}})[_0x5def('0x28')](function(){if(_0x575414){return new BPromise(function(_0x545e23,_0x2fb06a){zipdir(_0x33be31,{'saveTo':_0x1f7c22},function(_0x3f9256,_0x4ff57f){if(_0x3f9256)return _0x2fb06a(_0x3f9256);return _0x545e23(_0x4ff57f);});});}})[_0x5def('0x28')](function(){if(_0x575414){return new BPromise(function(_0x22cb5d,_0x740f09){rimraf(_0x33be31,function(_0x49d008){if(_0x49d008)_0x740f09(_0x49d008);return _0x22cb5d();});});}})[_0x5def('0x28')](function(){if(_0x575414){return _0x165eb1[_0x5def('0x71')](_0x1f7c22,_0x5c2f52,function(_0x521c22){if(_0x521c22){console['log'](_0x5def('0x7e'),_0x521c22);}else{fs[_0x5def('0x7f')](_0x1f7c22);}});}else{return _0x165eb1[_0x5def('0x80')](0xc8);}})[_0x5def('0x59')](handleError(_0x165eb1,null));}; \ No newline at end of file +var _0x78ad=['register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','key','field','options','include','tag','push','Tag','Tags','distinct','read','FaxMessage','Messages','FaxInteraction','count','includeAll','Users','fullname','CmContact','Contact','User','Owner','internal','FaxAccount','color','ThroughTags','findAll','rows','catch','params','find','create','body','describe','addMessage','omit','getMessages','findOne','FaxInteractionId','$gte','split','format','addTags','setTags','ids','spread','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','createdAt','Attachment','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket'];(function(_0x5b2cf9,_0x45198a){var _0x274fe3=function(_0x5300f2){while(--_0x5300f2){_0x5b2cf9['push'](_0x5b2cf9['shift']());}};_0x274fe3(++_0x45198a);}(_0x78ad,0x64));var _0xd78a=function(_0x36976a,_0xf3a3cd){_0x36976a=_0x36976a-0x0;var _0x2b760d=_0x78ad[_0x36976a];return _0x2b760d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd78a('0x0'));var rimraf=require(_0xd78a('0x1'));var zipdir=require(_0xd78a('0x2'));var jsonpatch=require(_0xd78a('0x3'));var rp=require('request-promise');var moment=require(_0xd78a('0x4'));var BPromise=require(_0xd78a('0x5'));var Mustache=require(_0xd78a('0x6'));var util=require(_0xd78a('0x7'));var path=require(_0xd78a('0x8'));var sox=require(_0xd78a('0x9'));var csv=require(_0xd78a('0xa'));var ejs=require(_0xd78a('0xb'));var fs=require('fs');var _=require(_0xd78a('0xc'));var squel=require('squel');var crypto=require(_0xd78a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd78a('0xa'));var querystring=require('querystring');var Papa=require(_0xd78a('0xe'));var authService=require(_0xd78a('0xf'));var hardwareService=require(_0xd78a('0x10'));var Redis=require(_0xd78a('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd78a('0x12'));var utils=require('../../config/utils');var config=require(_0xd78a('0x13'));var db=require(_0xd78a('0x14'))['db'];config[_0xd78a('0x15')]=_[_0xd78a('0x16')](config[_0xd78a('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xd78a('0x17'))(new Redis(config[_0xd78a('0x15')]));require(_0xd78a('0x18'))[_0xd78a('0x19')](socket);function respondWithStatusCode(_0x7e494f,_0x55463f){_0x55463f=_0x55463f||0xcc;return function(_0x46c418){if(_0x46c418){return _0x7e494f[_0xd78a('0x1a')](_0x55463f);}return _0x7e494f[_0xd78a('0x1b')](_0x55463f)[_0xd78a('0x1c')]();};}function respondWithResult(_0x136ee9,_0x551a38){_0x551a38=_0x551a38||0xc8;return function(_0x113316){if(_0x113316){return _0x136ee9[_0xd78a('0x1b')](_0x551a38)[_0xd78a('0x1d')](_0x113316);}};}function respondWithFilteredResult(_0x4476d3,_0x46543a){return function(_0x3bf6b1){if(_0x3bf6b1){var _0x33383b=_0x3bf6b1['count'],_0x413046=_0x46543a['offset'],_0x562400=_0x46543a[_0xd78a('0x1e')]+_0x46543a[_0xd78a('0x1f')],_0x523db2;if(_0x562400>=_0x33383b){_0x562400=_0x33383b;_0x523db2=0xc8;}else{_0x523db2=0xce;}_0x4476d3['status'](_0x523db2);return _0x4476d3[_0xd78a('0x20')](_0xd78a('0x21'),_0x413046+'-'+_0x562400+'/'+_0x33383b)['json'](_0x3bf6b1);}return null;};}function patchUpdates(_0xba54e2){return function(_0x1a383e){try{jsonpatch[_0xd78a('0x22')](_0x1a383e,_0xba54e2,!![]);}catch(_0x430bca){return BPromise[_0xd78a('0x23')](_0x430bca);}return _0x1a383e[_0xd78a('0x24')]();};}function saveUpdates(_0x25923d,_0x4cb403){return function(_0x3fa80c){if(_0x3fa80c){return _0x3fa80c[_0xd78a('0x25')](_0x25923d)[_0xd78a('0x26')](function(_0x40fb6f){return _0x40fb6f;});}return null;};}function removeEntity(_0x46ea83,_0x523765){return function(_0x429c1f){if(_0x429c1f){return _0x429c1f['destroy']()[_0xd78a('0x26')](function(){_0x46ea83[_0xd78a('0x1b')](0xcc)[_0xd78a('0x1c')]();});}};}function handleEntityNotFound(_0x11617a,_0x2da301){return function(_0xbe47b5){if(!_0xbe47b5){_0x11617a[_0xd78a('0x1a')](0x194);}return _0xbe47b5;};}function handleError(_0x42bbf7,_0x507f7a){_0x507f7a=_0x507f7a||0x1f4;return function(_0x2fa562){logger[_0xd78a('0x27')](_0x2fa562[_0xd78a('0x28')]);if(_0x2fa562[_0xd78a('0x29')]){delete _0x2fa562[_0xd78a('0x29')];}_0x42bbf7[_0xd78a('0x1b')](_0x507f7a)[_0xd78a('0x2a')](_0x2fa562);};}exports[_0xd78a('0x2b')]=function(_0x342655,_0x5585ac){var _0x1839ab={},_0x3bbc4a={},_0x262c06={'count':0x0,'rows':[]};var _0x73d077=db['FaxInteraction'][_0xd78a('0x2c')];_0x3bbc4a['model']=_[_0xd78a('0x2d')](_0x73d077);_0x3bbc4a[_0xd78a('0x2e')]=_[_0xd78a('0x2d')](_0x342655['query']);_0x3bbc4a[_0xd78a('0x2f')]=_[_0xd78a('0x30')](_0x3bbc4a[_0xd78a('0x31')],_0x3bbc4a[_0xd78a('0x2e')]);_0x1839ab[_0xd78a('0x32')]=_[_0xd78a('0x30')](_0x3bbc4a[_0xd78a('0x31')],qs[_0xd78a('0x33')](_0x342655[_0xd78a('0x2e')]['fields']));_0x1839ab[_0xd78a('0x32')]=_0x1839ab['attributes'][_0xd78a('0x34')]?_0x1839ab['attributes']:_0x3bbc4a[_0xd78a('0x31')];if(!_0x342655[_0xd78a('0x2e')][_0xd78a('0x35')](_0xd78a('0x36'))){_0x1839ab['limit']=qs['limit'](_0x342655[_0xd78a('0x2e')][_0xd78a('0x1f')]);_0x1839ab[_0xd78a('0x1e')]=qs[_0xd78a('0x1e')](_0x342655[_0xd78a('0x2e')][_0xd78a('0x1e')]);}_0x1839ab['order']=qs[_0xd78a('0x37')](_0x342655[_0xd78a('0x2e')][_0xd78a('0x37')]);_0x1839ab[_0xd78a('0x38')]=qs[_0xd78a('0x2f')](_['pick'](_0x342655[_0xd78a('0x2e')],_0x3bbc4a[_0xd78a('0x2f')]));if(_0x342655[_0xd78a('0x2e')][_0xd78a('0x39')]){_0x1839ab[_0xd78a('0x38')]=_[_0xd78a('0x3a')](_0x1839ab[_0xd78a('0x38')],{'$or':_[_0xd78a('0x3b')](_0x73d077,function(_0x1cbaa6){if(_0x1cbaa6[_0xd78a('0x3c')][_0xd78a('0x3d')]!=='VIRTUAL'){var _0x732363={};_0x732363[_0x1cbaa6[_0xd78a('0x3e')]]={'$like':'%'+_0x342655[_0xd78a('0x2e')][_0xd78a('0x39')]+'%'};return _0x732363;}})});}_0x1839ab=_[_0xd78a('0x3a')]({},_0x1839ab,_0x342655[_0xd78a('0x3f')]);var _0x539800={'where':_0x1839ab[_0xd78a('0x38')]};_0x539800[_0xd78a('0x40')]=[];if(_0x342655[_0xd78a('0x2e')][_0xd78a('0x41')]){_0x539800[_0xd78a('0x40')][_0xd78a('0x42')]({'model':db[_0xd78a('0x43')],'as':_0xd78a('0x44'),'attributes':['id'],'where':{'id':_0x342655[_0xd78a('0x2e')][_0xd78a('0x41')]},'required':!![]});_0x539800[_0xd78a('0x45')]=!![];}if(_0x342655[_0xd78a('0x2e')][_0xd78a('0x46')]){_0x539800[_0xd78a('0x40')][_0xd78a('0x42')]({'model':db[_0xd78a('0x47')],'as':_0xd78a('0x48'),'attributes':['id','direction','createdAt',_0xd78a('0x46')],'where':{'direction':'in','read':_0x342655[_0xd78a('0x2e')][_0xd78a('0x46')]||![]},'required':!![]});_0x539800['distinct']=!![];}return db[_0xd78a('0x49')][_0xd78a('0x4a')](_0x539800)['then'](function(_0x35a641){_0x262c06[_0xd78a('0x4a')]=_0x35a641;if(_0x342655[_0xd78a('0x2e')][_0xd78a('0x4b')]){_0x1839ab['include']=[{'model':db['User'],'as':_0xd78a('0x4c'),'required':![],'attributes':['id',_0xd78a('0x29'),_0xd78a('0x4d')]},{'model':db[_0xd78a('0x4e')],'as':_0xd78a('0x4f'),'required':![]},{'model':db[_0xd78a('0x50')],'as':_0xd78a('0x51'),'attributes':['name',_0xd78a('0x4d'),_0xd78a('0x52')],'required':![]},{'model':db[_0xd78a('0x53')],'as':'Account','attributes':[_0xd78a('0x29'),_0xd78a('0x3d')],'required':![]},{'model':db[_0xd78a('0x47')],'as':'Messages','attributes':['id','direction','createdAt',_0xd78a('0x46')],'where':{'direction':'in','read':_0x342655['query']['read']||![]},'required':_0x342655['query'][_0xd78a('0x46')]||![]},{'model':db[_0xd78a('0x43')],'as':_0xd78a('0x44'),'attributes':['id','name',_0xd78a('0x54')],'required':_0x342655[_0xd78a('0x2e')][_0xd78a('0x41')]?!![]:![]},{'model':db[_0xd78a('0x43')],'as':_0xd78a('0x55'),'attributes':['id',_0xd78a('0x29'),_0xd78a('0x54')],'through':_0x342655[_0xd78a('0x2e')][_0xd78a('0x41')]?{'attributes':[],'where':{'TagId':_0x342655['query']['tag']||undefined}}:{},'required':_0x342655[_0xd78a('0x2e')]['tag']?!![]:![]}];}return db[_0xd78a('0x49')][_0xd78a('0x56')](_0x1839ab);})[_0xd78a('0x26')](function(_0x3a07fb){_0x262c06[_0xd78a('0x57')]=_0x3a07fb;return _0x262c06;})['then'](respondWithFilteredResult(_0x5585ac,_0x1839ab))[_0xd78a('0x58')](handleError(_0x5585ac,null));};exports['show']=function(_0xd5bdd3,_0xcf93d){var _0x59d797={'raw':![],'where':{'id':_0xd5bdd3[_0xd78a('0x59')]['id']}},_0x1839a8={};_0x1839a8[_0xd78a('0x31')]=_[_0xd78a('0x2d')](db[_0xd78a('0x49')][_0xd78a('0x2c')]);_0x1839a8[_0xd78a('0x2e')]=_[_0xd78a('0x2d')](_0xd5bdd3[_0xd78a('0x2e')]);_0x1839a8['filters']=_[_0xd78a('0x30')](_0x1839a8[_0xd78a('0x31')],_0x1839a8['query']);_0x59d797[_0xd78a('0x32')]=_[_0xd78a('0x30')](_0x1839a8[_0xd78a('0x31')],qs[_0xd78a('0x33')](_0xd5bdd3[_0xd78a('0x2e')][_0xd78a('0x33')]));_0x59d797[_0xd78a('0x32')]=_0x59d797[_0xd78a('0x32')][_0xd78a('0x34')]?_0x59d797[_0xd78a('0x32')]:_0x1839a8[_0xd78a('0x31')];if(_0xd5bdd3[_0xd78a('0x2e')][_0xd78a('0x4b')]){_0x59d797[_0xd78a('0x40')]=[{'all':!![]}];}_0x59d797=_['merge']({},_0x59d797,_0xd5bdd3['options']);return db[_0xd78a('0x49')][_0xd78a('0x5a')](_0x59d797)['then'](handleEntityNotFound(_0xcf93d,null))[_0xd78a('0x26')](respondWithResult(_0xcf93d,null))[_0xd78a('0x58')](handleError(_0xcf93d,null));};exports[_0xd78a('0x5b')]=function(_0x32b843,_0x2dde71){return db[_0xd78a('0x49')][_0xd78a('0x5b')](_0x32b843[_0xd78a('0x5c')],{})[_0xd78a('0x26')](respondWithResult(_0x2dde71,0xc9))[_0xd78a('0x58')](handleError(_0x2dde71,null));};exports['update']=function(_0x3d3e4e,_0x4561e1){if(_0x3d3e4e[_0xd78a('0x5c')]['id']){delete _0x3d3e4e[_0xd78a('0x5c')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x3d3e4e['params']['id']}})[_0xd78a('0x26')](handleEntityNotFound(_0x4561e1,null))[_0xd78a('0x26')](saveUpdates(_0x3d3e4e[_0xd78a('0x5c')],null))[_0xd78a('0x26')](respondWithResult(_0x4561e1,null))[_0xd78a('0x58')](handleError(_0x4561e1,null));};exports['destroy']=function(_0x2a4f07,_0xab3f4a){return db[_0xd78a('0x49')][_0xd78a('0x5a')]({'where':{'id':_0x2a4f07[_0xd78a('0x59')]['id']}})['then'](handleEntityNotFound(_0xab3f4a,null))['then'](removeEntity(_0xab3f4a,null))[_0xd78a('0x58')](handleError(_0xab3f4a,null));};exports[_0xd78a('0x5d')]=function(_0x3cb8fa,_0x6a062e){return db[_0xd78a('0x49')][_0xd78a('0x5d')]()[_0xd78a('0x26')](respondWithResult(_0x6a062e,null))[_0xd78a('0x58')](handleError(_0x6a062e,null));};exports['addMessage']=function(_0x219417,_0x5dee93,_0x10c9e5){return db[_0xd78a('0x47')]['find']({'where':{'id':_0x219417[_0xd78a('0x59')]['id']}})[_0xd78a('0x26')](handleEntityNotFound(_0x5dee93,null))[_0xd78a('0x26')](function(_0x5f201d){if(_0x5f201d){return _0x5f201d[_0xd78a('0x5e')](_0x219417['body']['ids'],_[_0xd78a('0x5f')](_0x219417['body'],['ids','id'])||{});}})[_0xd78a('0x26')](respondWithResult(_0x5dee93,null))[_0xd78a('0x58')](handleError(_0x5dee93,null));};exports[_0xd78a('0x60')]=function(_0x215608,_0x20c55e,_0x49056a){var _0x53cc18={'raw':![],'where':{}};var _0x4e2d3b={};var _0x33bb0a={'count':0x0,'rows':[]};return db[_0xd78a('0x49')][_0xd78a('0x61')]({'where':{'id':_0x215608[_0xd78a('0x59')]['id']}})[_0xd78a('0x26')](handleEntityNotFound(_0x20c55e,null))['then'](function(_0x54c7a0){if(_0x54c7a0){_0x4e2d3b[_0xd78a('0x31')]=_[_0xd78a('0x2d')](db['FaxMessage'][_0xd78a('0x2c')]);_0x4e2d3b[_0xd78a('0x2e')]=_[_0xd78a('0x2d')](_0x215608[_0xd78a('0x2e')]);_0x4e2d3b[_0xd78a('0x2f')]=_['intersection'](_0x4e2d3b[_0xd78a('0x31')],_0x4e2d3b[_0xd78a('0x2e')]);_0x53cc18['attributes']=_[_0xd78a('0x30')](_0x4e2d3b[_0xd78a('0x31')],qs[_0xd78a('0x33')](_0x215608[_0xd78a('0x2e')][_0xd78a('0x33')]));_0x53cc18[_0xd78a('0x32')]=_0x53cc18[_0xd78a('0x32')][_0xd78a('0x34')]?_0x53cc18[_0xd78a('0x32')]:_0x4e2d3b[_0xd78a('0x31')];if(!_0x215608[_0xd78a('0x2e')][_0xd78a('0x35')](_0xd78a('0x36'))){_0x53cc18[_0xd78a('0x1f')]=qs[_0xd78a('0x1f')](_0x215608[_0xd78a('0x2e')][_0xd78a('0x1f')]);_0x53cc18[_0xd78a('0x1e')]=qs[_0xd78a('0x1e')](_0x215608['query'][_0xd78a('0x1e')]);}_0x53cc18['order']=qs[_0xd78a('0x37')](_0x215608[_0xd78a('0x2e')]['sort']);_0x53cc18[_0xd78a('0x38')]=qs[_0xd78a('0x2f')](_['pick'](_0x215608[_0xd78a('0x2e')],_0x4e2d3b[_0xd78a('0x2f')]));_0x53cc18[_0xd78a('0x38')][_0xd78a('0x62')]=_0x54c7a0['id'];if(_0x215608[_0xd78a('0x2e')][_0xd78a('0x39')]){_0x53cc18['where']=_[_0xd78a('0x3a')](_0x53cc18[_0xd78a('0x38')],{'$or':_['map'](_0x53cc18[_0xd78a('0x32')],function(_0x3fe398){var _0x3ed26e={};_0x3ed26e[_0x3fe398]={'$like':'%'+_0x215608['query']['filter']+'%'};return _0x3ed26e;})});}if(_0x215608[_0xd78a('0x2e')][_0xd78a('0x63')]){var _0x59d71a=_0x215608[_0xd78a('0x2e')][_0xd78a('0x63')][_0xd78a('0x64')](',');var _0x4290a3={};_0x4290a3[_0x59d71a[0x0]]={'$gte':moment(_0x59d71a[0x1])[_0xd78a('0x65')]('YYYY-MM-DD\x20HH:mm:ss')};_0x53cc18[_0xd78a('0x38')]=_['merge'](_0x53cc18[_0xd78a('0x38')],_0x4290a3);}_0x53cc18=_['merge']({},_0x53cc18,_0x215608[_0xd78a('0x3f')]);return db[_0xd78a('0x47')][_0xd78a('0x4a')]({'where':_0x53cc18[_0xd78a('0x38')]})[_0xd78a('0x26')](function(_0x168675){_0x33bb0a['count']=_0x168675;if(_0x215608[_0xd78a('0x2e')][_0xd78a('0x4b')]){_0x53cc18[_0xd78a('0x40')]=[{'all':!![]}];}return db['FaxMessage'][_0xd78a('0x56')](_0x53cc18);})[_0xd78a('0x26')](function(_0x123496){_0x33bb0a[_0xd78a('0x57')]=_0x123496;return _0x33bb0a;});}})['then'](respondWithFilteredResult(_0x20c55e,_0x53cc18))[_0xd78a('0x58')](handleError(_0x20c55e,null));};exports[_0xd78a('0x66')]=function(_0x2a1651,_0x3327aa,_0x1380a6){return db['FaxInteraction'][_0xd78a('0x5a')]({'where':{'id':_0x2a1651['params']['id']}})['then'](handleEntityNotFound(_0x3327aa,null))['then'](function(_0x20110c){if(_0x20110c){return _0x20110c[_0xd78a('0x67')](_0x2a1651[_0xd78a('0x5c')][_0xd78a('0x68')],_[_0xd78a('0x5f')](_0x2a1651[_0xd78a('0x5c')],[_0xd78a('0x68'),'id'])||{})[_0xd78a('0x69')](function(){return db[_0xd78a('0x43')]['findAll']({'attributes':['id',_0xd78a('0x29'),_0xd78a('0x54')],'where':{'id':_0x2a1651[_0xd78a('0x5c')][_0xd78a('0x68')]}});})[_0xd78a('0x26')](function(_0x478e5f){socket[_0xd78a('0x6a')](_0xd78a('0x6b'),{'id':Number(_0x2a1651[_0xd78a('0x59')]['id']),'tags':_0x478e5f||[]});return{'id':Number(_0x2a1651[_0xd78a('0x59')]['id']),'tags':_0x478e5f||[]};});}})[_0xd78a('0x26')](respondWithResult(_0x3327aa,null))['catch'](handleError(_0x3327aa,null));};exports['removeTags']=function(_0x10fa06,_0x1fbfa5,_0x4f5e96){var _0x4e218c;return db[_0xd78a('0x49')][_0xd78a('0x5a')]({'where':{'id':_0x10fa06[_0xd78a('0x59')]['id']}})['then'](handleEntityNotFound(_0x1fbfa5,null))[_0xd78a('0x26')](function(_0x348bf3){if(_0x348bf3){return _0x348bf3[_0xd78a('0x6c')](_0x10fa06[_0xd78a('0x2e')][_0xd78a('0x68')]);}})['then'](respondWithStatusCode(_0x1fbfa5,null))[_0xd78a('0x58')](handleError(_0x1fbfa5,null));};exports[_0xd78a('0x6d')]=function(_0x2e39fe,_0x1572ac){var _0x16140d=moment()[_0xd78a('0x6e')]()[_0xd78a('0x6f')]();var _0x174be5=path[_0xd78a('0x70')](config[_0xd78a('0x71')],_0xd78a('0x72'),_0xd78a('0x73'),'attachments');var _0x20216e=path['join'](config['root'],_0xd78a('0x72'),_0xd78a('0x73'),_0xd78a('0x74'));var _0x2cdeb2=path[_0xd78a('0x70')](_0x20216e,_0x16140d);var _0x1f13d3=util[_0xd78a('0x65')]('interaction-%s.zip',_0x16140d);var _0x48f189=path[_0xd78a('0x70')](_0x20216e,_0x1f13d3);var _0x95996f=![];return db[_0xd78a('0x49')][_0xd78a('0x5a')]({'where':{'id':_0x2e39fe[_0xd78a('0x59')]['id']}})[_0xd78a('0x26')](handleEntityNotFound(_0x1572ac,null))[_0xd78a('0x26')](function(_0x2bb55b){if(_0x2bb55b){return _0x2bb55b[_0xd78a('0x60')]({'attributes':['id','body',_0xd78a('0x75')],'include':[{'model':db['Attachment'],'as':_0xd78a('0x76')}]});}return[];})[_0xd78a('0x26')](function(_0x33edcd){_0x95996f=_0x33edcd['length'];if(_0x33edcd[_0xd78a('0x34')]){fs[_0xd78a('0x77')](_0x2cdeb2);for(var _0x377824=0x0;_0x377824<_0x33edcd[_0xd78a('0x34')];_0x377824++){var _0x5b39a1=_0x33edcd[_0x377824];var _0x482c5f=_0x5b39a1[_0xd78a('0x76')];if(_0x482c5f){var _0x2473d2=path[_0xd78a('0x70')](_0x174be5,_0x482c5f['basename']);if(fs[_0xd78a('0x78')](_0x2473d2)){fs[_0xd78a('0x79')](_0x2473d2)[_0xd78a('0x7a')](fs[_0xd78a('0x7b')](path[_0xd78a('0x70')](_0x2cdeb2,_0x482c5f['basename'])));}}}}})[_0xd78a('0x26')](function(){if(_0x95996f){return new BPromise(function(_0x246357,_0x3fb766){zipdir(_0x2cdeb2,{'saveTo':_0x48f189},function(_0x2c4891,_0x408ac2){if(_0x2c4891)return _0x3fb766(_0x2c4891);return _0x246357(_0x408ac2);});});}})[_0xd78a('0x26')](function(){if(_0x95996f){return new BPromise(function(_0x106c29,_0x51384e){rimraf(_0x2cdeb2,function(_0x3f4ad5){if(_0x3f4ad5)_0x51384e(_0x3f4ad5);return _0x106c29();});});}})['then'](function(){if(_0x95996f){return _0x1572ac[_0xd78a('0x6d')](_0x48f189,_0x1f13d3,function(_0x50144a){if(_0x50144a){console['log']('err',_0x50144a);}else{fs[_0xd78a('0x7c')](_0x48f189);}});}else{return _0x1572ac[_0xd78a('0x1a')](0xc8);}})[_0xd78a('0x58')](handleError(_0x1572ac,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 7ce7d3a..fe305aa 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 _0x91a7=['../../mysqldb','FaxInteraction','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x91a7,0xe7));var _0x791a=function(_0x4e884d,_0x1309e1){_0x4e884d=_0x4e884d-0x0;var _0x40d395=_0x91a7[_0x4e884d];return _0x40d395;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x791a('0x0'))['db'][_0x791a('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x791a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x791a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6392){return function(_0x535640,_0x50ab29,_0x32fe2b){FaxInteractionEvents[_0x791a('0x4')](_0x2f6392+':'+_0x535640['id'],_0x535640);FaxInteractionEvents['emit'](_0x2f6392,_0x535640);_0x32fe2b(null);};}for(var e in events){if(events[_0x791a('0x5')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x791a('0x6')]=FaxInteractionEvents; \ No newline at end of file +var _0x1752=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','setMaxListeners','save','update'];(function(_0x9a189f,_0x13e562){var _0x55bc1a=function(_0x5ae6d9){while(--_0x5ae6d9){_0x9a189f['push'](_0x9a189f['shift']());}};_0x55bc1a(++_0x13e562);}(_0x1752,0xa5));var _0x2175=function(_0x910298,_0x46fa29){_0x910298=_0x910298-0x0;var _0x36c81d=_0x1752[_0x910298];return _0x36c81d;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x2175('0x0'))['db'][_0x2175('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2175('0x2')](0x0);var events={'afterCreate':_0x2175('0x3'),'afterUpdate':_0x2175('0x4'),'afterDestroy':_0x2175('0x5')};function emitEvent(_0x56c315){return function(_0x1ee277,_0x22c167,_0x12b8d9){FaxInteractionEvents[_0x2175('0x6')](_0x56c315+':'+_0x1ee277['id'],_0x1ee277);FaxInteractionEvents[_0x2175('0x6')](_0x56c315,_0x1ee277);_0x12b8d9(null);};}for(var e in events){if(events[_0x2175('0x7')](e)){var event=events[e];FaxInteraction[_0x2175('0x8')](e,emitEvent(event));}}module[_0x2175('0x9')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 8fcc052..1e6002f 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 _0xa9e0=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','./faxInteraction.attributes','exports','define','fax_interactions','closed'];(function(_0x4551cc,_0x14a285){var _0x2c31ed=function(_0x476b5e){while(--_0x476b5e){_0x4551cc['push'](_0x4551cc['shift']());}};_0x2c31ed(++_0x14a285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var attributes=require(_0x0a9e('0x4'));module[_0x0a9e('0x5')]=function(_0x2ab90b,_0x991246){return _0x2ab90b[_0x0a9e('0x6')]('FaxInteraction',attributes,{'tableName':_0x0a9e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x441e3a,_0x2cc193,_0x5f41ea){if(_0x441e3a['changed'](_0x0a9e('0x8'))){_0x441e3a['closedAt']=moment()['format'](_0x0a9e('0x9'));}_0x5f41ea(null,_0x441e3a);}}});}; \ No newline at end of file +var _0xa9e0=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','./faxInteraction.attributes','exports','define','fax_interactions','closed'];(function(_0x2d90ff,_0x166b3e){var _0x3b1f82=function(_0xd04cac){while(--_0xd04cac){_0x2d90ff['push'](_0x2d90ff['shift']());}};_0x3b1f82(++_0x166b3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 attributes=require(_0x0a9e('0x4'));module[_0x0a9e('0x5')]=function(_0x2ab90b,_0x991246){return _0x2ab90b[_0x0a9e('0x6')]('FaxInteraction',attributes,{'tableName':_0x0a9e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x441e3a,_0x2cc193,_0x5f41ea){if(_0x441e3a['changed'](_0x0a9e('0x8'))){_0x441e3a['closedAt']=moment()['format'](_0x0a9e('0x9'));}_0x5f41ea(null,_0x441e3a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index efb814b..df215ac 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 _0xbb82=['debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','UpdateFaxInteraction','update','body','options','where','limit','FaxInteraction','find','ids','omit','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','./faxInteraction.socket','register','then','FaxInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x2fba42,_0x2535e2){var _0x203bbf=function(_0x470e3b){while(--_0x470e3b){_0x2fba42['push'](_0x2fba42['shift']());}};_0x203bbf(++_0x2535e2);}(_0xbb82,0x166));var _0x2bb8=function(_0x374954,_0x18dc36){_0x374954=_0x374954-0x0;var _0x42073e=_0xbb82[_0x374954];return _0x42073e;};'use strict';var _=require('lodash');var util=require(_0x2bb8('0x0'));var moment=require(_0x2bb8('0x1'));var BPromise=require(_0x2bb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bb8('0x3'));var db=require(_0x2bb8('0x4'))['db'];var utils=require(_0x2bb8('0x5'));var logger=require('../../config/logger')(_0x2bb8('0x6'));var config=require(_0x2bb8('0x7'));var jayson=require(_0x2bb8('0x8'));var client=jayson['client'][_0x2bb8('0x9')]({'port':0x232a});config[_0x2bb8('0xa')]=_['defaults'](config[_0x2bb8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2bb8('0xa')]));require(_0x2bb8('0xb'))[_0x2bb8('0xc')](socket);function respondWithRpcPromise(_0x4d813f,_0x15e5c2,_0x364671){return new BPromise(function(_0x98d2d5,_0xeb200b){return client['request'](_0x4d813f,_0x364671)[_0x2bb8('0xd')](function(_0x10daf1){logger['info'](_0x2bb8('0xe'),_0x15e5c2,_0x2bb8('0xf'));logger[_0x2bb8('0x10')](_0x2bb8('0x11'),_0x15e5c2,_0x2bb8('0xf'),JSON['stringify'](_0x10daf1));if(_0x10daf1[_0x2bb8('0x12')]){if(_0x10daf1[_0x2bb8('0x12')]['code']===0x1f4){logger['error'](_0x2bb8('0xe'),_0x15e5c2,_0x10daf1[_0x2bb8('0x12')]['message']);return _0xeb200b(_0x10daf1[_0x2bb8('0x12')][_0x2bb8('0x13')]);}logger[_0x2bb8('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x15e5c2,_0x10daf1[_0x2bb8('0x12')][_0x2bb8('0x13')]);return _0x98d2d5(_0x10daf1[_0x2bb8('0x12')]['message']);}else{logger[_0x2bb8('0x14')](_0x2bb8('0xe'),_0x15e5c2,_0x2bb8('0xf'));_0x98d2d5(_0x10daf1[_0x2bb8('0x15')][_0x2bb8('0x13')]);}})[_0x2bb8('0x16')](function(_0x333176){logger['error'](_0x2bb8('0xe'),_0x15e5c2,_0x333176);_0xeb200b(_0x333176);});});}exports[_0x2bb8('0x17')]=function(_0x3f192b){var _0x37d3ea=this;return new Promise(function(_0x4fb523,_0x258e07){return db['FaxInteraction'][_0x2bb8('0x18')](_0x3f192b[_0x2bb8('0x19')],{'raw':_0x3f192b['options']?_0x3f192b[_0x2bb8('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f192b['options']?_0x3f192b[_0x2bb8('0x1a')][_0x2bb8('0x1b')]||null:null,'attributes':_0x3f192b[_0x2bb8('0x1a')]?_0x3f192b['options']['attributes']||null:null,'limit':_0x3f192b[_0x2bb8('0x1a')]?_0x3f192b['options'][_0x2bb8('0x1c')]||null:null})[_0x2bb8('0xd')](function(_0x23d721){logger[_0x2bb8('0x14')](_0x2bb8('0x17'),_0x3f192b);logger[_0x2bb8('0x10')]('UpdateFaxInteraction',_0x3f192b,JSON['stringify'](_0x23d721));_0x4fb523(_0x23d721);})[_0x2bb8('0x16')](function(_0x41c396){logger[_0x2bb8('0x12')]('UpdateFaxInteraction',_0x41c396['message'],_0x3f192b);_0x258e07(_0x37d3ea[_0x2bb8('0x12')](0x1f4,_0x41c396[_0x2bb8('0x13')]));});});};exports['AddTagsToFaxInteraction']=function(_0x112883){return new Promise(function(_0x3ee158,_0x3ac6b1){return db[_0x2bb8('0x1d')][_0x2bb8('0x1e')]({'where':_0x112883[_0x2bb8('0x1a')]?_0x112883[_0x2bb8('0x1a')][_0x2bb8('0x1b')]||null:null})[_0x2bb8('0xd')](function(_0x4ee968){if(_0x4ee968){return _0x4ee968['addTags'](_0x112883[_0x2bb8('0x19')][_0x2bb8('0x1f')],_[_0x2bb8('0x20')](_0x112883[_0x2bb8('0x19')],[_0x2bb8('0x1f'),'id'])||{});}})['spread'](function(_0x12b129){logger['info'](_0x2bb8('0x21'),_0x112883);logger[_0x2bb8('0x10')](_0x2bb8('0x21'),_0x112883,JSON['stringify'](_0x12b129));_0x3ee158(_0x12b129);})[_0x2bb8('0x16')](function(_0x4562db){logger[_0x2bb8('0x12')](_0x2bb8('0x21'),_0x4562db['message'],_0x112883);_0x3ac6b1(_this[_0x2bb8('0x12')](0x1f4,_0x4562db[_0x2bb8('0x13')]));});});}; \ No newline at end of file +var _0x2782=['jayson/promise','client','http','redis','./faxInteraction.socket','request','then','request\x20sent','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','where','limit','debug','stringify','AddTagsToFaxInteraction','find','omit','body','spread','info','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xe8764a,_0x1dc05f){var _0x2838c1=function(_0x1ab0b0){while(--_0x1ab0b0){_0xe8764a['push'](_0xe8764a['shift']());}};_0x2838c1(++_0x1dc05f);}(_0x2782,0x17c));var _0x2278=function(_0x1a809b,_0x4c15e3){_0x1a809b=_0x1a809b-0x0;var _0x5d90e6=_0x2782[_0x1a809b];return _0x5d90e6;};'use strict';var _=require(_0x2278('0x0'));var util=require('util');var moment=require(_0x2278('0x1'));var BPromise=require(_0x2278('0x2'));var rs=require(_0x2278('0x3'));var fs=require('fs');var Redis=require(_0x2278('0x4'));var db=require(_0x2278('0x5'))['db'];var utils=require(_0x2278('0x6'));var logger=require(_0x2278('0x7'))(_0x2278('0x8'));var config=require(_0x2278('0x9'));var jayson=require(_0x2278('0xa'));var client=jayson[_0x2278('0xb')][_0x2278('0xc')]({'port':0x232a});config[_0x2278('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2278('0xd')]));require(_0x2278('0xe'))['register'](socket);function respondWithRpcPromise(_0x5a6be4,_0x248aa4,_0x388e59){return new BPromise(function(_0x56b801,_0x478028){return client[_0x2278('0xf')](_0x5a6be4,_0x388e59)[_0x2278('0x10')](function(_0x1a35ef){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x248aa4,_0x2278('0x11'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x248aa4,_0x2278('0x11'),JSON['stringify'](_0x1a35ef));if(_0x1a35ef[_0x2278('0x12')]){if(_0x1a35ef[_0x2278('0x12')][_0x2278('0x13')]===0x1f4){logger['error'](_0x2278('0x14'),_0x248aa4,_0x1a35ef[_0x2278('0x12')][_0x2278('0x15')]);return _0x478028(_0x1a35ef['error'][_0x2278('0x15')]);}logger[_0x2278('0x12')](_0x2278('0x14'),_0x248aa4,_0x1a35ef[_0x2278('0x12')][_0x2278('0x15')]);return _0x56b801(_0x1a35ef[_0x2278('0x12')][_0x2278('0x15')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x248aa4,'request\x20sent');_0x56b801(_0x1a35ef[_0x2278('0x16')][_0x2278('0x15')]);}})[_0x2278('0x17')](function(_0x21cb32){logger[_0x2278('0x12')](_0x2278('0x14'),_0x248aa4,_0x21cb32);_0x478028(_0x21cb32);});});}exports[_0x2278('0x18')]=function(_0x59cd7e){var _0x4a789a=this;return new Promise(function(_0x59258f,_0x3739d3){return db[_0x2278('0x19')]['update'](_0x59cd7e['body'],{'raw':_0x59cd7e[_0x2278('0x1a')]?_0x59cd7e['options'][_0x2278('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59cd7e[_0x2278('0x1a')]?_0x59cd7e['options'][_0x2278('0x1c')]||null:null,'attributes':_0x59cd7e['options']?_0x59cd7e[_0x2278('0x1a')]['attributes']||null:null,'limit':_0x59cd7e[_0x2278('0x1a')]?_0x59cd7e[_0x2278('0x1a')][_0x2278('0x1d')]||null:null})[_0x2278('0x10')](function(_0x17fef6){logger['info'](_0x2278('0x18'),_0x59cd7e);logger[_0x2278('0x1e')](_0x2278('0x18'),_0x59cd7e,JSON[_0x2278('0x1f')](_0x17fef6));_0x59258f(_0x17fef6);})['catch'](function(_0x320fed){logger[_0x2278('0x12')](_0x2278('0x18'),_0x320fed['message'],_0x59cd7e);_0x3739d3(_0x4a789a[_0x2278('0x12')](0x1f4,_0x320fed[_0x2278('0x15')]));});});};exports[_0x2278('0x20')]=function(_0x1ad6ad){return new Promise(function(_0x5f22c2,_0x4eaa47){return db[_0x2278('0x19')][_0x2278('0x21')]({'where':_0x1ad6ad[_0x2278('0x1a')]?_0x1ad6ad['options']['where']||null:null})[_0x2278('0x10')](function(_0x57c8f7){if(_0x57c8f7){return _0x57c8f7['addTags'](_0x1ad6ad['body']['ids'],_[_0x2278('0x22')](_0x1ad6ad[_0x2278('0x23')],['ids','id'])||{});}})[_0x2278('0x24')](function(_0x2a1465){logger[_0x2278('0x25')](_0x2278('0x26'),_0x1ad6ad);logger[_0x2278('0x1e')]('AddTags',_0x1ad6ad,JSON['stringify'](_0x2a1465));_0x5f22c2(_0x2a1465);})[_0x2278('0x17')](function(_0x47c247){logger[_0x2278('0x12')](_0x2278('0x26'),_0x47c247[_0x2278('0x15')],_0x1ad6ad);_0x4eaa47(_this[_0x2278('0x12')](0x1f4,_0x47c247[_0x2278('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index c231676..a197b79 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 _0x94fb=['length','faxInteraction:','remove','update','emit'];(function(_0x3f9e1b,_0x3913f0){var _0x428756=function(_0x2d8b6e){while(--_0x2d8b6e){_0x3f9e1b['push'](_0x3f9e1b['shift']());}};_0x428756(++_0x3913f0);}(_0x94fb,0x15b));var _0xb94f=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x94fb[_0x52f159];return _0x156799;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0xb94f('0x0'),_0xb94f('0x1')];function createListener(_0x388e71,_0xb4ac2f){return function(_0x4eabbd){_0xb4ac2f[_0xb94f('0x2')](_0x388e71,_0x4eabbd);};}function removeListener(_0x49536c,_0xe9bd9a){return function(){FaxInteractionEvents['removeListener'](_0x49536c,_0xe9bd9a);};}exports['register']=function(_0x2743a0){for(var _0x261438=0x0,_0x1ef732=events[_0xb94f('0x3')];_0x261438<_0x1ef732;_0x261438++){var _0x27b094=events[_0x261438];var _0x2ca4c6=createListener(_0xb94f('0x4')+_0x27b094,_0x2743a0);FaxInteractionEvents['on'](_0x27b094,_0x2ca4c6);}}; \ No newline at end of file +var _0xe565=['save','remove','update','emit','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0xe565,0x1af));var _0x5e56=function(_0x5f16c1,_0x49d8f8){_0x5f16c1=_0x5f16c1-0x0;var _0x2e1ada=_0xe565[_0x5f16c1];return _0x2e1ada;};'use strict';var FaxInteractionEvents=require(_0x5e56('0x0'));var events=[_0x5e56('0x1'),_0x5e56('0x2'),_0x5e56('0x3')];function createListener(_0x2bf921,_0x433522){return function(_0x3059c9){_0x433522[_0x5e56('0x4')](_0x2bf921,_0x3059c9);};}function removeListener(_0x5b4493,_0x5eca3f){return function(){FaxInteractionEvents['removeListener'](_0x5b4493,_0x5eca3f);};}exports[_0x5e56('0x5')]=function(_0x4c5628){for(var _0x3e1fc2=0x0,_0x4a4599=events[_0x5e56('0x6')];_0x3e1fc2<_0x4a4599;_0x3e1fc2++){var _0x44d9e8=events[_0x3e1fc2];var _0x45a29b=createListener(_0x5e56('0x7')+_0x44d9e8,_0x4c5628);FaxInteractionEvents['on'](_0x44d9e8,_0x45a29b);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2732288..caf28f9 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 _0xacfc=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:destroy'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0xacfc,0x124));var _0xcacf=function(_0x16c69d,_0x331ac7){_0x16c69d=_0x16c69d-0x0;var _0xd46d46=_0xacfc[_0x16c69d];return _0xd46d46;};'use strict';var multer=require(_0xcacf('0x0'));var util=require(_0xcacf('0x1'));var path=require(_0xcacf('0x2'));var timeout=require(_0xcacf('0x3'));var express=require('express');var router=express[_0xcacf('0x4')]();var auth=require(_0xcacf('0x5'));var interaction=require(_0xcacf('0x6'));var config=require('../../config/environment');var controller=require(_0xcacf('0x7'));router[_0xcacf('0x8')]('/',auth[_0xcacf('0x9')](),controller[_0xcacf('0xa')]);router['get'](_0xcacf('0xb'),auth[_0xcacf('0x9')](),controller['describe']);router['get'](_0xcacf('0xc'),auth['isAuthenticated'](),controller[_0xcacf('0xd')]);router[_0xcacf('0x8')](_0xcacf('0xe'),auth[_0xcacf('0x9')](),controller[_0xcacf('0xf')]);router[_0xcacf('0x8')](_0xcacf('0x10'),auth[_0xcacf('0x9')](),controller[_0xcacf('0x11')]);router['post']('/',auth[_0xcacf('0x9')](),controller[_0xcacf('0x12')]);router[_0xcacf('0x13')]('/:id/messages',auth[_0xcacf('0x9')](),controller['addMessage']);router[_0xcacf('0x13')](_0xcacf('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0xcacf('0x15'),_0xcacf('0x16')),controller[_0xcacf('0x17')]);router[_0xcacf('0x18')](_0xcacf('0xc'),auth[_0xcacf('0x9')](),interaction['tracked'](_0xcacf('0x15'),'faxinteraction:update'),controller['update']);router['delete'](_0xcacf('0xc'),auth['isAuthenticated'](),interaction[_0xcacf('0x19')](_0xcacf('0x15'),_0xcacf('0x1a')),controller[_0xcacf('0x1b')]);router['delete'](_0xcacf('0x14'),auth[_0xcacf('0x9')](),controller['removeTags']);module[_0xcacf('0x1c')]=router; \ No newline at end of file +var _0xb3a5=['download','post','create','/:id/messages','addMessage','tracked','fax','faxinteraction:update','update','delete','destroy','/:id/tags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','getMessages','/:id/download'];(function(_0x571151,_0x4db943){var _0x49b499=function(_0x286adc){while(--_0x286adc){_0x571151['push'](_0x571151['shift']());}};_0x49b499(++_0x4db943);}(_0xb3a5,0x9e));var _0x5b3a=function(_0x119273,_0x2a1f06){_0x119273=_0x119273-0x0;var _0x488a16=_0xb3a5[_0x119273];return _0x488a16;};'use strict';var multer=require(_0x5b3a('0x0'));var util=require('util');var path=require(_0x5b3a('0x1'));var timeout=require(_0x5b3a('0x2'));var express=require(_0x5b3a('0x3'));var router=express[_0x5b3a('0x4')]();var auth=require(_0x5b3a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5b3a('0x6'));var controller=require(_0x5b3a('0x7'));router['get']('/',auth[_0x5b3a('0x8')](),controller['index']);router[_0x5b3a('0x9')](_0x5b3a('0xa'),auth[_0x5b3a('0x8')](),controller[_0x5b3a('0xb')]);router[_0x5b3a('0x9')](_0x5b3a('0xc'),auth['isAuthenticated'](),controller[_0x5b3a('0xd')]);router[_0x5b3a('0x9')]('/:id/messages',auth[_0x5b3a('0x8')](),controller[_0x5b3a('0xe')]);router[_0x5b3a('0x9')](_0x5b3a('0xf'),auth[_0x5b3a('0x8')](),controller[_0x5b3a('0x10')]);router[_0x5b3a('0x11')]('/',auth[_0x5b3a('0x8')](),controller[_0x5b3a('0x12')]);router['post'](_0x5b3a('0x13'),auth[_0x5b3a('0x8')](),controller[_0x5b3a('0x14')]);router[_0x5b3a('0x11')]('/:id/tags',auth[_0x5b3a('0x8')](),interaction[_0x5b3a('0x15')]('fax','faxinteraction:addtags'),controller['addTags']);router['put'](_0x5b3a('0xc'),auth[_0x5b3a('0x8')](),interaction[_0x5b3a('0x15')](_0x5b3a('0x16'),_0x5b3a('0x17')),controller[_0x5b3a('0x18')]);router[_0x5b3a('0x19')](_0x5b3a('0xc'),auth[_0x5b3a('0x8')](),interaction[_0x5b3a('0x15')](_0x5b3a('0x16'),'faxinteraction:destroy'),controller[_0x5b3a('0x1a')]);router[_0x5b3a('0x19')](_0x5b3a('0x1b'),auth[_0x5b3a('0x8')](),controller['removeTags']);module[_0x5b3a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8fc334b..018eab3 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 _0x4c17=['TEXT','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0x48d6ef,_0x38df9a){var _0x3bded8=function(_0x2213b7){while(--_0x2213b7){_0x48d6ef['push'](_0x48d6ef['shift']());}};_0x3bded8(++_0x38df9a);}(_0x4c17,0x124));var _0x74c1=function(_0xef56b,_0x2f453d){_0xef56b=_0xef56b-0x0;var _0x5daada=_0x4c17[_0xef56b];return _0x5daada;};'use strict';var Sequelize=require(_0x74c1('0x0'));module[_0x74c1('0x1')]={'body':{'type':Sequelize[_0x74c1('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x74c1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x74c1('0x4')]('in',_0x74c1('0x5')),'defaultValue':_0x74c1('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x74c1('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x25d7=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x471e93,_0x2a7085){var _0x289d56=function(_0x14087f){while(--_0x14087f){_0x471e93['push'](_0x471e93['shift']());}};_0x289d56(++_0x2a7085);}(_0x25d7,0x136));var _0x725d=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x25d7[_0x5be795];return _0x4e8a3b;};'use strict';var Sequelize=require(_0x725d('0x0'));module[_0x725d('0x1')]={'body':{'type':Sequelize[_0x725d('0x2')](_0x725d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x725d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x725d('0x5')]('in',_0x725d('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x725d('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x725d('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 0c207a1..a1454fa 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 _0x1316=['set','Content-Range','apply','reject','update','destroy','name','send','index','FaxMessage','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','key','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','merge','find','body','params','describe','fax-interactions','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','get','FaxInteraction','FaxInteractionId','UserId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','null','RejectMessage','rejectMessage','rejectmessage','create','ContactId','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','Attachment','html-pdf','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1316,0xd3));var _0x6131=function(_0x44180d,_0xd2e5be){_0x44180d=_0x44180d-0x0;var _0x495992=_0x1316[_0x44180d];return _0x495992;};'use strict';var pdf=require(_0x6131('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6131('0x1'));var zipdir=require(_0x6131('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6131('0x3'));var BPromise=require(_0x6131('0x4'));var Mustache=require('mustache');var util=require(_0x6131('0x5'));var path=require(_0x6131('0x6'));var sox=require(_0x6131('0x7'));var csv=require(_0x6131('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6131('0x9'));var squel=require(_0x6131('0xa'));var crypto=require(_0x6131('0xb'));var jsforce=require(_0x6131('0xc'));var deskjs=require(_0x6131('0xd'));var toCsv=require(_0x6131('0x8'));var querystring=require(_0x6131('0xe'));var Papa=require(_0x6131('0xf'));var authService=require(_0x6131('0x10'));var hardwareService=require(_0x6131('0x11'));var Redis=require(_0x6131('0x12'));var qs=require(_0x6131('0x13'));var logger=require(_0x6131('0x14'))('api');var utils=require(_0x6131('0x15'));var config=require(_0x6131('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x6131('0x17')],{'host':_0x6131('0x18'),'port':0x18eb});var socket=require(_0x6131('0x19'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x6131('0x1a')](socket);var jayson=require(_0x6131('0x1b'));var client=jayson[_0x6131('0x1c')][_0x6131('0x1d')]({'port':0x232c});var client9002=jayson[_0x6131('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54b2a7,_0x161975,_0xbcbf4f,_0x127d95){return new BPromise(function(_0x16f0ed,_0x3e3e21){var _0x1ee0d1=_0x127d95||client;return _0x1ee0d1[_0x6131('0x1e')](_0x54b2a7,_0xbcbf4f)[_0x6131('0x1f')](function(_0x5d2e97){logger[_0x6131('0x20')](_0x6131('0x21'),_0x161975,_0x6131('0x22'));logger[_0x6131('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x161975,_0x6131('0x22'),JSON[_0x6131('0x24')](_0x5d2e97));if(_0x5d2e97[_0x6131('0x25')]){if(_0x5d2e97['error']['code']===0x1f4){logger[_0x6131('0x25')](_0x6131('0x21'),_0x161975,_0x5d2e97[_0x6131('0x25')][_0x6131('0x26')]);return _0x3e3e21(_0x5d2e97[_0x6131('0x25')][_0x6131('0x26')]);}logger[_0x6131('0x25')](_0x6131('0x21'),_0x161975,_0x5d2e97['error'][_0x6131('0x26')]);return _0x16f0ed(_0x5d2e97[_0x6131('0x25')][_0x6131('0x26')]);}else{logger['info'](_0x6131('0x21'),_0x161975,_0x6131('0x22'));_0x16f0ed(_0x5d2e97[_0x6131('0x27')][_0x6131('0x26')]);}})[_0x6131('0x28')](function(_0x281f5b){logger['error'](_0x6131('0x21'),_0x161975,_0x281f5b);_0x3e3e21(_0x281f5b);});});}function respondWithStatusCode(_0x44f620,_0x1807fd){_0x1807fd=_0x1807fd||0xcc;return function(_0x3db88e){if(_0x3db88e){return _0x44f620[_0x6131('0x29')](_0x1807fd);}return _0x44f620['status'](_0x1807fd)[_0x6131('0x2a')]();};}function respondWithResult(_0x4ba1a5,_0x4fe50c){_0x4fe50c=_0x4fe50c||0xc8;return function(_0x2b9130){if(_0x2b9130){return _0x4ba1a5[_0x6131('0x2b')](_0x4fe50c)[_0x6131('0x2c')](_0x2b9130);}};}function respondWithFilteredResult(_0x1b21bc,_0x5ac3fe){return function(_0x5f40db){if(_0x5f40db){var _0x4d9d25=_0x5f40db[_0x6131('0x2d')],_0x402a93=_0x5ac3fe[_0x6131('0x2e')],_0x1e7a68=_0x5ac3fe['offset']+_0x5ac3fe['limit'],_0xea3a0e;if(_0x1e7a68>=_0x4d9d25){_0x1e7a68=_0x4d9d25;_0xea3a0e=0xc8;}else{_0xea3a0e=0xce;}_0x1b21bc[_0x6131('0x2b')](_0xea3a0e);return _0x1b21bc[_0x6131('0x2f')](_0x6131('0x30'),_0x402a93+'-'+_0x1e7a68+'/'+_0x4d9d25)[_0x6131('0x2c')](_0x5f40db);}return null;};}function patchUpdates(_0x5ea23c){return function(_0x41f373){try{jsonpatch[_0x6131('0x31')](_0x41f373,_0x5ea23c,!![]);}catch(_0x20a21d){return BPromise[_0x6131('0x32')](_0x20a21d);}return _0x41f373['save']();};}function saveUpdates(_0x26a848,_0x11c2a2){return function(_0x4ec24b){if(_0x4ec24b){return _0x4ec24b[_0x6131('0x33')](_0x26a848)[_0x6131('0x1f')](function(_0x2f059e){return _0x2f059e;});}return null;};}function removeEntity(_0x48caa9,_0x4fbb09){return function(_0x1c2cf2){if(_0x1c2cf2){return _0x1c2cf2[_0x6131('0x34')]()['then'](function(){_0x48caa9[_0x6131('0x2b')](0xcc)[_0x6131('0x2a')]();});}};}function handleEntityNotFound(_0x2dc0d6,_0x45de4c){return function(_0x101a15){if(!_0x101a15){_0x2dc0d6[_0x6131('0x29')](0x194);}return _0x101a15;};}function handleError(_0x58576e,_0x369af4){_0x369af4=_0x369af4||0x1f4;return function(_0x9d0a32){logger[_0x6131('0x25')](_0x9d0a32['stack']);if(_0x9d0a32[_0x6131('0x35')]){delete _0x9d0a32['name'];}_0x58576e['status'](_0x369af4)[_0x6131('0x36')](_0x9d0a32);};}exports[_0x6131('0x37')]=function(_0xeb89b8,_0x18cc30){var _0x21276c={},_0x39a34e={},_0x2fef3c={'count':0x0,'rows':[]};var _0x489fe8=db[_0x6131('0x38')][_0x6131('0x39')];_0x39a34e[_0x6131('0x3a')]=_[_0x6131('0x3b')](_0x489fe8);_0x39a34e[_0x6131('0x3c')]=_['keys'](_0xeb89b8[_0x6131('0x3c')]);_0x39a34e[_0x6131('0x3d')]=_['intersection'](_0x39a34e[_0x6131('0x3a')],_0x39a34e[_0x6131('0x3c')]);_0x21276c[_0x6131('0x3e')]=_['intersection'](_0x39a34e['model'],qs[_0x6131('0x3f')](_0xeb89b8[_0x6131('0x3c')][_0x6131('0x3f')]));_0x21276c[_0x6131('0x3e')]=_0x21276c[_0x6131('0x3e')][_0x6131('0x40')]?_0x21276c['attributes']:_0x39a34e['model'];if(!_0xeb89b8[_0x6131('0x3c')][_0x6131('0x41')](_0x6131('0x42'))){_0x21276c['limit']=qs[_0x6131('0x43')](_0xeb89b8[_0x6131('0x3c')][_0x6131('0x43')]);_0x21276c['offset']=qs[_0x6131('0x2e')](_0xeb89b8['query']['offset']);}_0x21276c[_0x6131('0x44')]=qs[_0x6131('0x45')](_0xeb89b8['query'][_0x6131('0x45')]);_0x21276c[_0x6131('0x46')]=qs[_0x6131('0x3d')](_['pick'](_0xeb89b8[_0x6131('0x3c')],_0x39a34e[_0x6131('0x3d')]));if(_0xeb89b8[_0x6131('0x3c')][_0x6131('0x47')]){_0x21276c[_0x6131('0x46')]=_['merge'](_0x21276c[_0x6131('0x46')],{'$or':_['map'](_0x489fe8,function(_0x1f3ea3){if(_0x1f3ea3[_0x6131('0x48')][_0x6131('0x49')]!==_0x6131('0x4a')){var _0x283a5d={};_0x283a5d[_0x1f3ea3['field']]={'$like':'%'+_0xeb89b8['query'][_0x6131('0x47')]+'%'};return _0x283a5d;}})});}_0x21276c=_['merge']({},_0x21276c,_0xeb89b8[_0x6131('0x4b')]);var _0x2bc5b8={'where':_0x21276c[_0x6131('0x46')]};return db[_0x6131('0x38')]['count'](_0x2bc5b8)['then'](function(_0x3b5048){_0x2fef3c[_0x6131('0x2d')]=_0x3b5048;if(_0xeb89b8[_0x6131('0x3c')][_0x6131('0x4c')]){_0x21276c[_0x6131('0x4d')]=[{'all':!![]}];}return db['FaxMessage'][_0x6131('0x4e')](_0x21276c);})['then'](function(_0x507f2f){_0x2fef3c[_0x6131('0x4f')]=_0x507f2f;return _0x2fef3c;})['then'](respondWithFilteredResult(_0x18cc30,_0x21276c))['catch'](handleError(_0x18cc30,null));};exports[_0x6131('0x50')]=function(_0x1490fa,_0x1b33cb){var _0x1bdd75={'raw':!![],'where':{'id':_0x1490fa['params']['id']}},_0x54a367={};_0x54a367[_0x6131('0x3a')]=_[_0x6131('0x3b')](db[_0x6131('0x38')]['rawAttributes']);_0x54a367[_0x6131('0x3c')]=_[_0x6131('0x3b')](_0x1490fa[_0x6131('0x3c')]);_0x54a367[_0x6131('0x3d')]=_[_0x6131('0x51')](_0x54a367[_0x6131('0x3a')],_0x54a367['query']);_0x1bdd75[_0x6131('0x3e')]=_[_0x6131('0x51')](_0x54a367[_0x6131('0x3a')],qs[_0x6131('0x3f')](_0x1490fa[_0x6131('0x3c')]['fields']));_0x1bdd75[_0x6131('0x3e')]=_0x1bdd75[_0x6131('0x3e')][_0x6131('0x40')]?_0x1bdd75['attributes']:_0x54a367['model'];if(_0x1490fa['query'][_0x6131('0x4c')]){_0x1bdd75[_0x6131('0x4d')]=[{'all':!![]}];}_0x1bdd75=_[_0x6131('0x52')]({},_0x1bdd75,_0x1490fa[_0x6131('0x4b')]);return db[_0x6131('0x38')][_0x6131('0x53')](_0x1bdd75)[_0x6131('0x1f')](handleEntityNotFound(_0x1b33cb,null))['then'](respondWithResult(_0x1b33cb,null))[_0x6131('0x28')](handleError(_0x1b33cb,null));};exports[_0x6131('0x33')]=function(_0x4ee2a1,_0x42aba2){if(_0x4ee2a1[_0x6131('0x54')]['id']){delete _0x4ee2a1['body']['id'];}return db['FaxMessage'][_0x6131('0x53')]({'where':{'id':_0x4ee2a1[_0x6131('0x55')]['id']}})[_0x6131('0x1f')](handleEntityNotFound(_0x42aba2,null))[_0x6131('0x1f')](saveUpdates(_0x4ee2a1['body'],null))[_0x6131('0x1f')](respondWithResult(_0x42aba2,null))[_0x6131('0x28')](handleError(_0x42aba2,null));};exports[_0x6131('0x34')]=function(_0x4e39fc,_0x48bf10){return db[_0x6131('0x38')][_0x6131('0x53')]({'where':{'id':_0x4e39fc[_0x6131('0x55')]['id']}})['then'](handleEntityNotFound(_0x48bf10,null))[_0x6131('0x1f')](removeEntity(_0x48bf10,null))[_0x6131('0x28')](handleError(_0x48bf10,null));};exports[_0x6131('0x56')]=function(_0x4ce439,_0x165e91){return db[_0x6131('0x38')][_0x6131('0x56')]()[_0x6131('0x1f')](respondWithResult(_0x165e91,null))['catch'](handleError(_0x165e91,null));};var interaction_log=require(_0x6131('0x14'))(_0x6131('0x57'));exports[_0x6131('0x58')]=function(_0x468d7d,_0x754d15,_0x2cd1a8){var _0x3bc6a2={'channel':_0x6131('0x59')};if(_0x468d7d[_0x6131('0x54')]['id']){delete _0x468d7d[_0x6131('0x54')]['id'];}_0x468d7d[_0x6131('0x54')]['read']=!![];_0x468d7d[_0x6131('0x54')]['readAt']=moment()[_0x6131('0x5a')](_0x6131('0x5b'));_0x468d7d[_0x6131('0x54')]['UserId']=_0x468d7d[_0x6131('0x54')]['UserId']||_0x468d7d['user']['id'];return db[_0x6131('0x38')][_0x6131('0x53')]({'where':{'id':_0x468d7d[_0x6131('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x6131('0x5c')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x754d15,null))[_0x6131('0x1f')](saveUpdates(_0x468d7d[_0x6131('0x54')],null))[_0x6131('0x1f')](function(_0x2c3299){if(_0x2c3299){_0x3bc6a2[_0x6131('0x26')]=_0x2c3299[_0x6131('0x5d')]({'plain':!![]});return db[_0x6131('0x5e')][_0x6131('0x53')]({'where':{'id':_0x2c3299[_0x6131('0x5f')]}});}return null;})[_0x6131('0x1f')](handleEntityNotFound(_0x754d15,null))[_0x6131('0x1f')](function(_0x383c23){if(_0x383c23){return _0x383c23['update']({'UserId':_0x468d7d[_0x6131('0x54')][_0x6131('0x60')],'read1stAt':_[_0x6131('0x61')](_0x383c23['read1stAt'])?moment()[_0x6131('0x5a')](_0x6131('0x5b')):undefined});}return null;})[_0x6131('0x1f')](function(_0x452280){if(_0x452280){_0x3bc6a2[_0x6131('0x62')]=_0x452280[_0x6131('0x5d')]({'plain':!![]});interaction_log[_0x6131('0x20')](_0x6131('0x63'),_0x468d7d[_0x6131('0x64')]['id'],_0x468d7d[_0x6131('0x64')]['name'],_0x468d7d[_0x6131('0x64')][_0x6131('0x65')],_0x3bc6a2[_0x6131('0x62')]['id'],_0x468d7d[_0x6131('0x54')]?JSON['stringify'](_0x468d7d[_0x6131('0x54')]):'null');return respondWithRpcPromise(_0x6131('0x66'),_0x6131('0x67'),_0x3bc6a2);}return null;})[_0x6131('0x1f')](function(_0x2c610a){if(_0x2c610a){if(_0x468d7d[_0x6131('0x54')][_0x6131('0x68')]){_0x3bc6a2[_0x6131('0x26')][_0x6131('0x69')]=util[_0x6131('0x5a')](_0x6131('0x6a'),_0x468d7d[_0x6131('0x64')][_0x6131('0x35')]);_0x3bc6a2[_0x6131('0x26')][_0x6131('0x6b')]=_0x3bc6a2['channel'];_0x3bc6a2[_0x6131('0x26')]['event']=_0x6131('0x58');return respondWithRpcPromise(_0x6131('0x6c'),_0x6131('0x6c'),{'event':_0x6131('0x6d'),'message':_0x3bc6a2[_0x6131('0x26')]},client9002)[_0x6131('0x1f')](function(){return _0x3bc6a2;});}return _0x3bc6a2;}return null;})['then'](respondWithResult(_0x754d15,null))[_0x6131('0x28')](handleError(_0x754d15,null));};var interaction_log=require('../../config/logger')(_0x6131('0x57'));exports['reject']=function(_0xd8a8d9,_0x3512f9,_0x3fab4a){var _0x3d6244={'agent':{},'channel':_0x6131('0x59')};if(_0xd8a8d9[_0x6131('0x54')]['id']){delete _0xd8a8d9[_0x6131('0x54')]['id'];}_0xd8a8d9[_0x6131('0x54')][_0x6131('0x60')]=_0xd8a8d9[_0x6131('0x54')][_0x6131('0x60')]||_0xd8a8d9['user']['id'];_0x3d6244[_0x6131('0x6e')]['id']=_0xd8a8d9[_0x6131('0x54')][_0x6131('0x60')];return db[_0x6131('0x38')]['find']({'where':{'id':_0xd8a8d9[_0x6131('0x55')]['id'],'UserId':null}})[_0x6131('0x1f')](handleEntityNotFound(_0x3512f9,null))['then'](function(_0x478aee){if(_0x478aee){_0x3d6244['message']=_0x478aee['get']({'plain':!![]});return db[_0x6131('0x5e')][_0x6131('0x53')]({'where':{'id':_0x478aee[_0x6131('0x5f')]}});}return null;})[_0x6131('0x1f')](handleEntityNotFound(_0x3512f9,null))[_0x6131('0x1f')](function(_0x34bc12){if(_0x34bc12){_0x3d6244['interaction']=_0x34bc12[_0x6131('0x5d')]({'plain':!![]});interaction_log[_0x6131('0x20')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd8a8d9[_0x6131('0x64')]['id'],_0xd8a8d9[_0x6131('0x64')][_0x6131('0x35')],_0xd8a8d9[_0x6131('0x64')][_0x6131('0x65')],_0x3d6244[_0x6131('0x62')]['id'],_0xd8a8d9['body']?JSON['stringify'](_0xd8a8d9[_0x6131('0x54')]):_0x6131('0x6f'));return respondWithRpcPromise(_0x6131('0x70'),_0x6131('0x71'),_0x3d6244);}return null;})[_0x6131('0x1f')](function(_0x6ab9ce){if(_0x6ab9ce){_0x6ab9ce['message'][_0x6131('0x69')]=util[_0x6131('0x5a')]('SIP/%s',_0xd8a8d9[_0x6131('0x64')]['name']);_0x6ab9ce[_0x6131('0x26')][_0x6131('0x6b')]=_0x3d6244[_0x6131('0x6b')];_0x6ab9ce[_0x6131('0x26')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x6131('0x72'),'message':_0x6ab9ce['message']},client9002);return _0x3d6244;}return null;})[_0x6131('0x1f')](respondWithResult(_0x3512f9,null))['catch'](handleError(_0x3512f9,null));};exports['create']=function(_0x36affa,_0x39fa2a){var _0x2fe8b6;return db['FaxMessage'][_0x6131('0x73')](_0x36affa['body'],{})['then'](function(_0x2f08be){_0x2fe8b6=_0x2f08be;return db[_0x6131('0x5c')]['findOne']({'where':{'id':_0x2fe8b6[_0x6131('0x74')]}});})[_0x6131('0x1f')](function(_0x52c75b){if(_[_0x6131('0x61')](_0x52c75b)){return;}else{_0x2fe8b6[_0x6131('0x59')]=_0x52c75b[_0x6131('0x59')];return db['Attachment'][_0x6131('0x75')]({'where':{'id':_0x2fe8b6[_0x6131('0x76')]}});}})['then'](function(_0x2356f0){return respondWithRpcPromise(_0x6131('0x77'),_0x6131('0x77'),{'FaxAccountId':_[_0x6131('0x61')](_0x36affa['body'])?undefined:_0x36affa[_0x6131('0x54')][_0x6131('0x78')],'path':_[_0x6131('0x61')](_0x2356f0)?undefined:util[_0x6131('0x5a')](_0x6131('0x79'),_0x2356f0[_0x6131('0x7a')]),'fax':_[_0x6131('0x61')](_0x2fe8b6[_0x6131('0x59')])?undefined:_0x2fe8b6[_0x6131('0x59')],'AttachmentId':_0x2fe8b6['AttachmentId']},client9002);})[_0x6131('0x1f')](respondWithResult(_0x39fa2a,0xc9))['catch'](handleError(_0x39fa2a,null));};exports[_0x6131('0x7b')]=function(_0x44dd13,_0x166a76){var _0x3bbb09=path[_0x6131('0x7c')](config['root'],_0x6131('0x7d'),_0x6131('0x7e'),_0x6131('0x7f'));return db['FaxMessage'][_0x6131('0x53')]({'where':{'id':_0x44dd13['params']['id']},'include':[{'model':db['Attachment'],'as':_0x6131('0x80')}]})[_0x6131('0x1f')](handleEntityNotFound(_0x166a76,null))[_0x6131('0x1f')](function(_0x4c5018){if(_0x4c5018){return _0x166a76['download'](path[_0x6131('0x7c')](_0x3bbb09,_0x4c5018[_0x6131('0x80')][_0x6131('0x7a')]));}})[_0x6131('0x28')](handleError(_0x166a76,null));}; \ No newline at end of file +var _0x563f=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','redis','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','name','send','index','FaxMessage','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','field','includeAll','include','findAll','find','body','params','describe','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','interaction','get','role','null','AcceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','../../config/logger','fax-interactions','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','create','findOne','fax','SendFax','FaxAccountId','isNil','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','files','Attachment','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x82471f,_0x45be84){var _0x2b4b9f=function(_0x3ea41a){while(--_0x3ea41a){_0x82471f['push'](_0x82471f['shift']());}};_0x2b4b9f(++_0x45be84);}(_0x563f,0xf6));var _0xf563=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x563f[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf563('0x0'));var rimraf=require(_0xf563('0x1'));var zipdir=require(_0xf563('0x2'));var jsonpatch=require(_0xf563('0x3'));var rp=require(_0xf563('0x4'));var moment=require(_0xf563('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf563('0x6'));var util=require(_0xf563('0x7'));var path=require(_0xf563('0x8'));var sox=require(_0xf563('0x9'));var csv=require(_0xf563('0xa'));var ejs=require(_0xf563('0xb'));var fs=require('fs');var _=require(_0xf563('0xc'));var squel=require(_0xf563('0xd'));var crypto=require(_0xf563('0xe'));var jsforce=require(_0xf563('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf563('0xa'));var querystring=require('querystring');var Papa=require(_0xf563('0x10'));var authService=require(_0xf563('0x11'));var hardwareService=require(_0xf563('0x12'));var Redis=require('ioredis');var qs=require(_0xf563('0x13'));var logger=require('../../config/logger')(_0xf563('0x14'));var utils=require(_0xf563('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf563('0x16')]=_['defaults'](config[_0xf563('0x16')],{'host':_0xf563('0x17'),'port':0x18eb});var socket=require(_0xf563('0x18'))(new Redis(config['redis']));require(_0xf563('0x19'))['register'](socket);var jayson=require(_0xf563('0x1a'));var client=jayson[_0xf563('0x1b')][_0xf563('0x1c')]({'port':0x232c});var client9002=jayson[_0xf563('0x1b')][_0xf563('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x138196,_0xc039f2,_0x26cb61,_0x5979b0){return new BPromise(function(_0x1d6d2a,_0x4d4a67){var _0x2a59c5=_0x5979b0||client;return _0x2a59c5[_0xf563('0x1d')](_0x138196,_0x26cb61)[_0xf563('0x1e')](function(_0x5b779c){logger[_0xf563('0x1f')](_0xf563('0x20'),_0xc039f2,_0xf563('0x21'));logger[_0xf563('0x22')](_0xf563('0x23'),_0xc039f2,_0xf563('0x21'),JSON[_0xf563('0x24')](_0x5b779c));if(_0x5b779c[_0xf563('0x25')]){if(_0x5b779c[_0xf563('0x25')][_0xf563('0x26')]===0x1f4){logger[_0xf563('0x25')](_0xf563('0x20'),_0xc039f2,_0x5b779c[_0xf563('0x25')]['message']);return _0x4d4a67(_0x5b779c['error'][_0xf563('0x27')]);}logger[_0xf563('0x25')]('FaxMessage,\x20%s,\x20%s',_0xc039f2,_0x5b779c['error'][_0xf563('0x27')]);return _0x1d6d2a(_0x5b779c['error'][_0xf563('0x27')]);}else{logger[_0xf563('0x1f')](_0xf563('0x20'),_0xc039f2,'request\x20sent');_0x1d6d2a(_0x5b779c[_0xf563('0x28')][_0xf563('0x27')]);}})[_0xf563('0x29')](function(_0x187e20){logger[_0xf563('0x25')](_0xf563('0x20'),_0xc039f2,_0x187e20);_0x4d4a67(_0x187e20);});});}function respondWithStatusCode(_0xde8340,_0x4e6aee){_0x4e6aee=_0x4e6aee||0xcc;return function(_0x4a6196){if(_0x4a6196){return _0xde8340[_0xf563('0x2a')](_0x4e6aee);}return _0xde8340[_0xf563('0x2b')](_0x4e6aee)[_0xf563('0x2c')]();};}function respondWithResult(_0x8d9b8b,_0x21450b){_0x21450b=_0x21450b||0xc8;return function(_0x2c394c){if(_0x2c394c){return _0x8d9b8b[_0xf563('0x2b')](_0x21450b)[_0xf563('0x2d')](_0x2c394c);}};}function respondWithFilteredResult(_0x3dd8c1,_0x5be964){return function(_0x5bc500){if(_0x5bc500){var _0x3147db=_0x5bc500[_0xf563('0x2e')],_0x436a7e=_0x5be964[_0xf563('0x2f')],_0x234957=_0x5be964[_0xf563('0x2f')]+_0x5be964[_0xf563('0x30')],_0x5baa4f;if(_0x234957>=_0x3147db){_0x234957=_0x3147db;_0x5baa4f=0xc8;}else{_0x5baa4f=0xce;}_0x3dd8c1[_0xf563('0x2b')](_0x5baa4f);return _0x3dd8c1['set'](_0xf563('0x31'),_0x436a7e+'-'+_0x234957+'/'+_0x3147db)[_0xf563('0x2d')](_0x5bc500);}return null;};}function patchUpdates(_0x3d23e7){return function(_0xc54203){try{jsonpatch[_0xf563('0x32')](_0xc54203,_0x3d23e7,!![]);}catch(_0x44e7a2){return BPromise[_0xf563('0x33')](_0x44e7a2);}return _0xc54203[_0xf563('0x34')]();};}function saveUpdates(_0x1018da,_0x479e4b){return function(_0x1d1ba3){if(_0x1d1ba3){return _0x1d1ba3[_0xf563('0x35')](_0x1018da)[_0xf563('0x1e')](function(_0x7112be){return _0x7112be;});}return null;};}function removeEntity(_0x21a1f2,_0x406142){return function(_0x368327){if(_0x368327){return _0x368327[_0xf563('0x36')]()[_0xf563('0x1e')](function(){_0x21a1f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x510c06,_0x319414){return function(_0x227973){if(!_0x227973){_0x510c06[_0xf563('0x2a')](0x194);}return _0x227973;};}function handleError(_0x25c9d2,_0x34fe8a){_0x34fe8a=_0x34fe8a||0x1f4;return function(_0x314913){logger[_0xf563('0x25')](_0x314913['stack']);if(_0x314913[_0xf563('0x37')]){delete _0x314913[_0xf563('0x37')];}_0x25c9d2['status'](_0x34fe8a)[_0xf563('0x38')](_0x314913);};}exports[_0xf563('0x39')]=function(_0xce505,_0xf755a0){var _0x420c76={},_0x582947={},_0x4425ec={'count':0x0,'rows':[]};var _0x37372e=db[_0xf563('0x3a')][_0xf563('0x3b')];_0x582947[_0xf563('0x3c')]=_[_0xf563('0x3d')](_0x37372e);_0x582947[_0xf563('0x3e')]=_[_0xf563('0x3d')](_0xce505[_0xf563('0x3e')]);_0x582947[_0xf563('0x3f')]=_['intersection'](_0x582947[_0xf563('0x3c')],_0x582947[_0xf563('0x3e')]);_0x420c76[_0xf563('0x40')]=_[_0xf563('0x41')](_0x582947[_0xf563('0x3c')],qs[_0xf563('0x42')](_0xce505[_0xf563('0x3e')][_0xf563('0x42')]));_0x420c76[_0xf563('0x40')]=_0x420c76[_0xf563('0x40')][_0xf563('0x43')]?_0x420c76['attributes']:_0x582947[_0xf563('0x3c')];if(!_0xce505['query'][_0xf563('0x44')](_0xf563('0x45'))){_0x420c76[_0xf563('0x30')]=qs[_0xf563('0x30')](_0xce505[_0xf563('0x3e')][_0xf563('0x30')]);_0x420c76[_0xf563('0x2f')]=qs[_0xf563('0x2f')](_0xce505[_0xf563('0x3e')][_0xf563('0x2f')]);}_0x420c76[_0xf563('0x46')]=qs['sort'](_0xce505['query'][_0xf563('0x47')]);_0x420c76[_0xf563('0x48')]=qs[_0xf563('0x3f')](_[_0xf563('0x49')](_0xce505[_0xf563('0x3e')],_0x582947['filters']));if(_0xce505['query'][_0xf563('0x4a')]){_0x420c76['where']=_[_0xf563('0x4b')](_0x420c76['where'],{'$or':_[_0xf563('0x4c')](_0x37372e,function(_0x23b80f){if(_0x23b80f[_0xf563('0x4d')][_0xf563('0x4e')]!=='VIRTUAL'){var _0x5a2da9={};_0x5a2da9[_0x23b80f[_0xf563('0x4f')]]={'$like':'%'+_0xce505['query'][_0xf563('0x4a')]+'%'};return _0x5a2da9;}})});}_0x420c76=_['merge']({},_0x420c76,_0xce505['options']);var _0x5a6ff5={'where':_0x420c76['where']};return db[_0xf563('0x3a')][_0xf563('0x2e')](_0x5a6ff5)[_0xf563('0x1e')](function(_0x56c368){_0x4425ec[_0xf563('0x2e')]=_0x56c368;if(_0xce505[_0xf563('0x3e')][_0xf563('0x50')]){_0x420c76[_0xf563('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0xf563('0x52')](_0x420c76);})['then'](function(_0x2a762e){_0x4425ec['rows']=_0x2a762e;return _0x4425ec;})[_0xf563('0x1e')](respondWithFilteredResult(_0xf755a0,_0x420c76))[_0xf563('0x29')](handleError(_0xf755a0,null));};exports['show']=function(_0x177a75,_0x432633){var _0x4450dd={'raw':!![],'where':{'id':_0x177a75['params']['id']}},_0x2dcae9={};_0x2dcae9[_0xf563('0x3c')]=_[_0xf563('0x3d')](db[_0xf563('0x3a')][_0xf563('0x3b')]);_0x2dcae9[_0xf563('0x3e')]=_[_0xf563('0x3d')](_0x177a75[_0xf563('0x3e')]);_0x2dcae9['filters']=_[_0xf563('0x41')](_0x2dcae9[_0xf563('0x3c')],_0x2dcae9[_0xf563('0x3e')]);_0x4450dd[_0xf563('0x40')]=_[_0xf563('0x41')](_0x2dcae9[_0xf563('0x3c')],qs[_0xf563('0x42')](_0x177a75[_0xf563('0x3e')][_0xf563('0x42')]));_0x4450dd[_0xf563('0x40')]=_0x4450dd[_0xf563('0x40')][_0xf563('0x43')]?_0x4450dd['attributes']:_0x2dcae9['model'];if(_0x177a75[_0xf563('0x3e')]['includeAll']){_0x4450dd[_0xf563('0x51')]=[{'all':!![]}];}_0x4450dd=_[_0xf563('0x4b')]({},_0x4450dd,_0x177a75['options']);return db[_0xf563('0x3a')][_0xf563('0x53')](_0x4450dd)['then'](handleEntityNotFound(_0x432633,null))[_0xf563('0x1e')](respondWithResult(_0x432633,null))['catch'](handleError(_0x432633,null));};exports[_0xf563('0x35')]=function(_0x3bd9e8,_0x563a1a){if(_0x3bd9e8[_0xf563('0x54')]['id']){delete _0x3bd9e8[_0xf563('0x54')]['id'];}return db[_0xf563('0x3a')][_0xf563('0x53')]({'where':{'id':_0x3bd9e8[_0xf563('0x55')]['id']}})[_0xf563('0x1e')](handleEntityNotFound(_0x563a1a,null))[_0xf563('0x1e')](saveUpdates(_0x3bd9e8[_0xf563('0x54')],null))[_0xf563('0x1e')](respondWithResult(_0x563a1a,null))[_0xf563('0x29')](handleError(_0x563a1a,null));};exports[_0xf563('0x36')]=function(_0x235bb4,_0x3240f9){return db['FaxMessage'][_0xf563('0x53')]({'where':{'id':_0x235bb4[_0xf563('0x55')]['id']}})['then'](handleEntityNotFound(_0x3240f9,null))[_0xf563('0x1e')](removeEntity(_0x3240f9,null))[_0xf563('0x29')](handleError(_0x3240f9,null));};exports[_0xf563('0x56')]=function(_0x2bfd7a,_0x208fbb){return db['FaxMessage']['describe']()[_0xf563('0x1e')](respondWithResult(_0x208fbb,null))[_0xf563('0x29')](handleError(_0x208fbb,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['accept']=function(_0x2c917c,_0xe55594,_0x554a0b){var _0x2df15f={'channel':'fax'};if(_0x2c917c['body']['id']){delete _0x2c917c[_0xf563('0x54')]['id'];}_0x2c917c[_0xf563('0x54')]['read']=!![];_0x2c917c[_0xf563('0x54')]['readAt']=moment()[_0xf563('0x57')](_0xf563('0x58'));_0x2c917c[_0xf563('0x54')]['UserId']=_0x2c917c[_0xf563('0x54')][_0xf563('0x59')]||_0x2c917c[_0xf563('0x5a')]['id'];return db[_0xf563('0x3a')][_0xf563('0x53')]({'where':{'id':_0x2c917c[_0xf563('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xf563('0x5b')],'as':_0xf563('0x5c')}]})[_0xf563('0x1e')](handleEntityNotFound(_0xe55594,null))['then'](saveUpdates(_0x2c917c[_0xf563('0x54')],null))[_0xf563('0x1e')](function(_0x163a95){if(_0x163a95){_0x2df15f[_0xf563('0x27')]=_0x163a95['get']({'plain':!![]});return db[_0xf563('0x5d')][_0xf563('0x53')]({'where':{'id':_0x163a95['FaxInteractionId']}});}return null;})[_0xf563('0x1e')](handleEntityNotFound(_0xe55594,null))[_0xf563('0x1e')](function(_0xfecccc){if(_0xfecccc){return _0xfecccc[_0xf563('0x35')]({'UserId':_0x2c917c[_0xf563('0x54')]['UserId'],'read1stAt':_['isNil'](_0xfecccc['read1stAt'])?moment()['format'](_0xf563('0x58')):undefined});}return null;})['then'](function(_0x391d5a){if(_0x391d5a){_0x2df15f[_0xf563('0x5e')]=_0x391d5a[_0xf563('0x5f')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c917c['user']['id'],_0x2c917c[_0xf563('0x5a')][_0xf563('0x37')],_0x2c917c[_0xf563('0x5a')][_0xf563('0x60')],_0x2df15f['interaction']['id'],_0x2c917c[_0xf563('0x54')]?JSON[_0xf563('0x24')](_0x2c917c[_0xf563('0x54')]):_0xf563('0x61'));return respondWithRpcPromise(_0xf563('0x62'),'acceptMessage',_0x2df15f);}return null;})[_0xf563('0x1e')](function(_0x223ff5){if(_0x223ff5){if(_0x2c917c['body'][_0xf563('0x63')]){_0x2df15f['message'][_0xf563('0x64')]=util[_0xf563('0x57')](_0xf563('0x65'),_0x2c917c['user'][_0xf563('0x37')]);_0x2df15f['message'][_0xf563('0x66')]=_0x2df15f[_0xf563('0x66')];_0x2df15f[_0xf563('0x27')]['event']=_0xf563('0x67');return respondWithRpcPromise(_0xf563('0x68'),'EventManager',{'event':'acceptmessage','message':_0x2df15f[_0xf563('0x27')]},client9002)[_0xf563('0x1e')](function(){return _0x2df15f;});}return _0x2df15f;}return null;})[_0xf563('0x1e')](respondWithResult(_0xe55594,null))['catch'](handleError(_0xe55594,null));};var interaction_log=require(_0xf563('0x69'))(_0xf563('0x6a'));exports[_0xf563('0x33')]=function(_0x5296ba,_0x387715,_0x4efc4d){var _0x64d486={'agent':{},'channel':'fax'};if(_0x5296ba[_0xf563('0x54')]['id']){delete _0x5296ba[_0xf563('0x54')]['id'];}_0x5296ba[_0xf563('0x54')][_0xf563('0x59')]=_0x5296ba[_0xf563('0x54')][_0xf563('0x59')]||_0x5296ba[_0xf563('0x5a')]['id'];_0x64d486[_0xf563('0x6b')]['id']=_0x5296ba[_0xf563('0x54')]['UserId'];return db[_0xf563('0x3a')][_0xf563('0x53')]({'where':{'id':_0x5296ba[_0xf563('0x55')]['id'],'UserId':null}})[_0xf563('0x1e')](handleEntityNotFound(_0x387715,null))[_0xf563('0x1e')](function(_0x48e2cd){if(_0x48e2cd){_0x64d486[_0xf563('0x27')]=_0x48e2cd[_0xf563('0x5f')]({'plain':!![]});return db[_0xf563('0x5d')][_0xf563('0x53')]({'where':{'id':_0x48e2cd[_0xf563('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x387715,null))[_0xf563('0x1e')](function(_0x2fdf98){if(_0x2fdf98){_0x64d486[_0xf563('0x5e')]=_0x2fdf98[_0xf563('0x5f')]({'plain':!![]});interaction_log['info'](_0xf563('0x6d'),_0x5296ba[_0xf563('0x5a')]['id'],_0x5296ba[_0xf563('0x5a')][_0xf563('0x37')],_0x5296ba['user'][_0xf563('0x60')],_0x64d486[_0xf563('0x5e')]['id'],_0x5296ba['body']?JSON[_0xf563('0x24')](_0x5296ba[_0xf563('0x54')]):_0xf563('0x61'));return respondWithRpcPromise(_0xf563('0x6e'),'rejectMessage',_0x64d486);}return null;})['then'](function(_0x53f8b4){if(_0x53f8b4){_0x53f8b4[_0xf563('0x27')][_0xf563('0x64')]=util['format'](_0xf563('0x65'),_0x5296ba[_0xf563('0x5a')][_0xf563('0x37')]);_0x53f8b4[_0xf563('0x27')]['channel']=_0x64d486[_0xf563('0x66')];_0x53f8b4[_0xf563('0x27')]['event']=_0xf563('0x33');respondWithRpcPromise(_0xf563('0x68'),_0xf563('0x68'),{'event':_0xf563('0x6f'),'message':_0x53f8b4[_0xf563('0x27')]},client9002);return _0x64d486;}return null;})['then'](respondWithResult(_0x387715,null))[_0xf563('0x29')](handleError(_0x387715,null));};exports['create']=function(_0xa66bc3,_0x10456e){var _0x259a2e;return db[_0xf563('0x3a')][_0xf563('0x70')](_0xa66bc3[_0xf563('0x54')],{})[_0xf563('0x1e')](function(_0x5287f5){_0x259a2e=_0x5287f5;return db[_0xf563('0x5b')][_0xf563('0x71')]({'where':{'id':_0x259a2e['ContactId']}});})[_0xf563('0x1e')](function(_0x352d9b){if(_['isNil'](_0x352d9b)){return;}else{_0x259a2e[_0xf563('0x72')]=_0x352d9b['fax'];return db['Attachment'][_0xf563('0x71')]({'where':{'id':_0x259a2e['AttachmentId']}});}})[_0xf563('0x1e')](function(_0x2f7362){return respondWithRpcPromise(_0xf563('0x73'),_0xf563('0x73'),{'FaxAccountId':_['isNil'](_0xa66bc3[_0xf563('0x54')])?undefined:_0xa66bc3[_0xf563('0x54')][_0xf563('0x74')],'path':_[_0xf563('0x75')](_0x2f7362)?undefined:util[_0xf563('0x57')](_0xf563('0x76'),_0x2f7362[_0xf563('0x77')]),'fax':_['isNil'](_0x259a2e['fax'])?undefined:_0x259a2e[_0xf563('0x72')],'AttachmentId':_0x259a2e[_0xf563('0x78')]},client9002);})[_0xf563('0x1e')](respondWithResult(_0x10456e,0xc9))[_0xf563('0x29')](handleError(_0x10456e,null));};exports[_0xf563('0x79')]=function(_0x25cc12,_0xa9977b){var _0x4fac36=path['join'](config[_0xf563('0x7a')],_0xf563('0x7b'),_0xf563('0x7c'),'attachments');return db['FaxMessage']['find']({'where':{'id':_0x25cc12[_0xf563('0x55')]['id']},'include':[{'model':db[_0xf563('0x7d')],'as':_0xf563('0x7d')}]})['then'](handleEntityNotFound(_0xa9977b,null))[_0xf563('0x1e')](function(_0x5dde86){if(_0x5dde86){return _0xa9977b[_0xf563('0x79')](path[_0xf563('0x7e')](_0x4fac36,_0x5dde86[_0xf563('0x7d')]['basename']));}})['catch'](handleError(_0xa9977b,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 89c5a68..6fbaf09 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 _0x33cf=['../../mysqldb','save','update','emit','hasOwnProperty','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33cf,0xd1));var _0xf33c=function(_0x162a3d,_0x1cf5d0){_0x162a3d=_0x162a3d-0x0;var _0x1a405a=_0x33cf[_0x162a3d];return _0x1a405a;};'use strict';var EventEmitter=require(_0xf33c('0x0'));var FaxMessage=require(_0xf33c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf33c('0x2'),'afterUpdate':_0xf33c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x322a24){return function(_0x354fdb,_0x5865ad,_0x43ceea){FaxMessageEvents[_0xf33c('0x4')](_0x322a24+':'+_0x354fdb['id'],_0x354fdb);FaxMessageEvents[_0xf33c('0x4')](_0x322a24,_0x354fdb);_0x43ceea(null);};}for(var e in events){if(events[_0xf33c('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xf33c('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0xd5d7=['emit','hook','events','FaxMessage','update','remove'];(function(_0x53f384,_0x4f00ec){var _0x2ebfca=function(_0x2cf14c){while(--_0x2cf14c){_0x53f384['push'](_0x53f384['shift']());}};_0x2ebfca(++_0x4f00ec);}(_0xd5d7,0x8c));var _0x7d5d=function(_0x13fab7,_0x16ab88){_0x13fab7=_0x13fab7-0x0;var _0x81eaec=_0xd5d7[_0x13fab7];return _0x81eaec;};'use strict';var EventEmitter=require(_0x7d5d('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7d5d('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7d5d('0x2'),'afterDestroy':_0x7d5d('0x3')};function emitEvent(_0xda133f){return function(_0x1d7b25,_0x523ab2,_0x2a96e0){FaxMessageEvents[_0x7d5d('0x4')](_0xda133f+':'+_0x1d7b25['id'],_0x1d7b25);FaxMessageEvents['emit'](_0xda133f,_0x1d7b25);_0x2a96e0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x7d5d('0x5')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e0a3c95..c887bde 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 _0x288e=['UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','body','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x5ee498,_0x238358){var _0x230e87=function(_0x14957c){while(--_0x14957c){_0x5ee498['push'](_0x5ee498['shift']());}};_0x230e87(++_0x238358);}(_0x288e,0x1bf));var _0xe288=function(_0x530b48,_0x5c502a){_0x530b48=_0x530b48-0x0;var _0x54d048=_0x288e[_0x530b48];return _0x54d048;};'use strict';var _=require('lodash');var util=require(_0xe288('0x0'));var logger=require(_0xe288('0x1'))(_0xe288('0x2'));var moment=require('moment');var BPromise=require(_0xe288('0x3'));var rp=require(_0xe288('0x4'));var attributes=require(_0xe288('0x5'));module[_0xe288('0x6')]=function(_0xb9a572,_0x5c6f38){return _0xb9a572[_0xe288('0x7')](_0xe288('0x8'),attributes,{'tableName':_0xe288('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x41c90b,_0x307761,_0x47ea8a){var _0x50ccf7=_0xb9a572[_0xe288('0xa')];var _0x4017c3=_0x41c90b[_0xe288('0xb')]({'plain':!![]});if(_0x4017c3[_0xe288('0xc')]['toLowerCase']()==='in'||_0x4017c3[_0xe288('0xc')][_0xe288('0xd')]()===_0xe288('0xe')&&!_0x4017c3[_0xe288('0xf')]&&!_[_0xe288('0x10')](_0x4017c3[_0xe288('0x11')])){_0x50ccf7[_0xe288('0x12')][_0xe288('0x13')]({'where':{'id':_0x4017c3[_0xe288('0x14')]}})[_0xe288('0x15')](function(_0x58c281){if(_0x58c281){_0x58c281[_0xe288('0x16')]({'lastMsgAt':_0x4017c3[_0xe288('0x17')],'lastMsgDirection':_0x4017c3['direction'][_0xe288('0xd')](),'lastMsgBody':_0x4017c3[_0xe288('0x18')]});}})[_0xe288('0x19')](function(_0x3608e3){console[_0xe288('0x1a')](_0x3608e3);});}_0x47ea8a();}},'charset':_0xe288('0x1b'),'collate':_0xe288('0x1c')});}; \ No newline at end of file +var _0x4b59=['secret','UserId','findOne','FaxInteractionId','then','update','createdAt','body','utf8mb4','utf8mb4_unicode_ci','api','moment','request-promise','FaxMessage','models','toLowerCase','out'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0x4b59,0x11a));var _0x94b5=function(_0x3d8240,_0x2663d4){_0x3d8240=_0x3d8240-0x0;var _0x3d0372=_0x4b59[_0x3d8240];return _0x3d0372;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x94b5('0x0'));var moment=require(_0x94b5('0x1'));var BPromise=require('bluebird');var rp=require(_0x94b5('0x2'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x36e4e4,_0x588246){return _0x36e4e4['define'](_0x94b5('0x3'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x38e628,_0x952ccf,_0x18cb99){var _0x267840=_0x36e4e4[_0x94b5('0x4')];var _0x4348f4=_0x38e628['get']({'plain':!![]});if(_0x4348f4['direction'][_0x94b5('0x5')]()==='in'||_0x4348f4['direction'][_0x94b5('0x5')]()===_0x94b5('0x6')&&!_0x4348f4[_0x94b5('0x7')]&&!_['isNil'](_0x4348f4[_0x94b5('0x8')])){_0x267840['FaxInteraction'][_0x94b5('0x9')]({'where':{'id':_0x4348f4[_0x94b5('0xa')]}})[_0x94b5('0xb')](function(_0x9d49e5){if(_0x9d49e5){_0x9d49e5[_0x94b5('0xc')]({'lastMsgAt':_0x4348f4[_0x94b5('0xd')],'lastMsgDirection':_0x4348f4['direction'][_0x94b5('0x5')](),'lastMsgBody':_0x4348f4[_0x94b5('0xe')]});}})['catch'](function(_0x57b37b){console['error'](_0x57b37b);});}_0x18cb99();}},'charset':_0x94b5('0xf'),'collate':_0x94b5('0x10')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 8ba7d1c..7f85ead 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 _0xc23a=['raw','then','catch','update','where','UpdateFaxMessage','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','options'];(function(_0x17e432,_0xf122ca){var _0x20b4bd=function(_0xa148c9){while(--_0xa148c9){_0x17e432['push'](_0x17e432['shift']());}};_0x20b4bd(++_0xf122ca);}(_0xc23a,0xd2));var _0xac23=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0xc23a[_0x60286b];return _0x5dff69;};'use strict';var _=require('lodash');var util=require(_0xac23('0x0'));var moment=require(_0xac23('0x1'));var BPromise=require(_0xac23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac23('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xac23('0x4'))('rpc');var config=require(_0xac23('0x5'));var jayson=require(_0xac23('0x6'));var client=jayson[_0xac23('0x7')]['http']({'port':0x232a});config['redis']=_[_0xac23('0x8')](config[_0xac23('0x9')],{'host':_0xac23('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac23('0x9')]));require(_0xac23('0xb'))[_0xac23('0xc')](socket);function respondWithRpcPromise(_0x40a4db,_0x57ff64,_0x591ea4){return new BPromise(function(_0x51ee6e,_0x23fe15){return client[_0xac23('0xd')](_0x40a4db,_0x591ea4)['then'](function(_0x3fe7c6){logger[_0xac23('0xe')](_0xac23('0xf'),_0x57ff64,_0xac23('0x10'));logger[_0xac23('0x11')](_0xac23('0x12'),_0x57ff64,_0xac23('0x10'),JSON[_0xac23('0x13')](_0x3fe7c6));if(_0x3fe7c6[_0xac23('0x14')]){if(_0x3fe7c6[_0xac23('0x14')]['code']===0x1f4){logger[_0xac23('0x14')](_0xac23('0xf'),_0x57ff64,_0x3fe7c6['error']['message']);return _0x23fe15(_0x3fe7c6[_0xac23('0x14')][_0xac23('0x15')]);}logger[_0xac23('0x14')]('FaxMessage,\x20%s,\x20%s',_0x57ff64,_0x3fe7c6[_0xac23('0x14')][_0xac23('0x15')]);return _0x51ee6e(_0x3fe7c6[_0xac23('0x14')][_0xac23('0x15')]);}else{logger['info'](_0xac23('0xf'),_0x57ff64,_0xac23('0x10'));_0x51ee6e(_0x3fe7c6[_0xac23('0x16')]['message']);}})['catch'](function(_0x37c6ee){logger[_0xac23('0x14')](_0xac23('0xf'),_0x57ff64,_0x37c6ee);_0x23fe15(_0x37c6ee);});});}exports[_0xac23('0x17')]=function(_0x52dc23){var _0xfaf60=this;return new Promise(function(_0x44bf6c,_0x34c6b8){return db[_0xac23('0x18')][_0xac23('0x19')](_0x52dc23[_0xac23('0x1a')],{'raw':_0x52dc23['options']?_0x52dc23[_0xac23('0x1b')][_0xac23('0x1c')]===undefined?!![]:![]:!![]})[_0xac23('0x1d')](function(_0x4697ab){logger[_0xac23('0xe')]('CreateFaxMessage',_0x52dc23);logger[_0xac23('0x11')]('CreateFaxMessage',_0x52dc23,JSON[_0xac23('0x13')](_0x4697ab));_0x44bf6c(_0x4697ab);})[_0xac23('0x1e')](function(_0x3cfa4a){logger[_0xac23('0x14')](_0xac23('0x17'),_0x3cfa4a[_0xac23('0x15')],_0x52dc23);_0x34c6b8(_0xfaf60['error'](0x1f4,_0x3cfa4a[_0xac23('0x15')]));});});};exports['UpdateFaxMessage']=function(_0x43440a){var _0x2d552b=this;return new Promise(function(_0x9bb37c,_0x1fdcbd){return db[_0xac23('0x18')][_0xac23('0x1f')](_0x43440a[_0xac23('0x1a')],{'raw':_0x43440a[_0xac23('0x1b')]?_0x43440a[_0xac23('0x1b')][_0xac23('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43440a[_0xac23('0x1b')]?_0x43440a[_0xac23('0x1b')][_0xac23('0x20')]||null:null,'attributes':_0x43440a[_0xac23('0x1b')]?_0x43440a[_0xac23('0x1b')]['attributes']||null:null,'limit':_0x43440a['options']?_0x43440a[_0xac23('0x1b')]['limit']||null:null})['then'](function(_0x4423e4){logger[_0xac23('0xe')]('UpdateFaxMessage',_0x43440a);logger['debug'](_0xac23('0x21'),_0x43440a,JSON['stringify'](_0x4423e4));_0x9bb37c(_0x4423e4);})['catch'](function(_0x28dd39){logger[_0xac23('0x14')]('UpdateFaxMessage',_0x28dd39[_0xac23('0x15')],_0x43440a);_0x1fdcbd(_0x2d552b[_0xac23('0x14')](0x1f4,_0x28dd39['message']));});});}; \ No newline at end of file +var _0x448a=['redis','defaults','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','create','body','options','raw','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x35b2e8,_0x4cd01c){var _0x3d5c54=function(_0x52195d){while(--_0x52195d){_0x35b2e8['push'](_0x35b2e8['shift']());}};_0x3d5c54(++_0x4cd01c);}(_0x448a,0x1ef));var _0xa448=function(_0x5e59f2,_0x4d7f88){_0x5e59f2=_0x5e59f2-0x0;var _0x15de7b=_0x448a[_0x5e59f2];return _0x15de7b;};'use strict';var _=require('lodash');var util=require(_0xa448('0x0'));var moment=require(_0xa448('0x1'));var BPromise=require('bluebird');var rs=require(_0xa448('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa448('0x3'));var logger=require(_0xa448('0x4'))('rpc');var config=require(_0xa448('0x5'));var jayson=require(_0xa448('0x6'));var client=jayson[_0xa448('0x7')][_0xa448('0x8')]({'port':0x232a});config[_0xa448('0x9')]=_[_0xa448('0xa')](config[_0xa448('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa448('0x9')]));require(_0xa448('0xb'))[_0xa448('0xc')](socket);function respondWithRpcPromise(_0x13db02,_0x2e95bf,_0x81f261){return new BPromise(function(_0x1d8a87,_0x54a4c2){return client['request'](_0x13db02,_0x81f261)[_0xa448('0xd')](function(_0x183569){logger['info'](_0xa448('0xe'),_0x2e95bf,_0xa448('0xf'));logger[_0xa448('0x10')](_0xa448('0x11'),_0x2e95bf,_0xa448('0xf'),JSON[_0xa448('0x12')](_0x183569));if(_0x183569[_0xa448('0x13')]){if(_0x183569[_0xa448('0x13')][_0xa448('0x14')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x2e95bf,_0x183569[_0xa448('0x13')][_0xa448('0x15')]);return _0x54a4c2(_0x183569[_0xa448('0x13')][_0xa448('0x15')]);}logger[_0xa448('0x13')](_0xa448('0xe'),_0x2e95bf,_0x183569['error']['message']);return _0x1d8a87(_0x183569['error']['message']);}else{logger[_0xa448('0x16')](_0xa448('0xe'),_0x2e95bf,'request\x20sent');_0x1d8a87(_0x183569[_0xa448('0x17')][_0xa448('0x15')]);}})[_0xa448('0x18')](function(_0x38f0ac){logger[_0xa448('0x13')]('FaxMessage,\x20%s,\x20%s',_0x2e95bf,_0x38f0ac);_0x54a4c2(_0x38f0ac);});});}exports[_0xa448('0x19')]=function(_0x220fd5){var _0x77722=this;return new Promise(function(_0x28a80b,_0x1b6370){return db['FaxMessage'][_0xa448('0x1a')](_0x220fd5[_0xa448('0x1b')],{'raw':_0x220fd5[_0xa448('0x1c')]?_0x220fd5[_0xa448('0x1c')][_0xa448('0x1d')]===undefined?!![]:![]:!![]})[_0xa448('0xd')](function(_0x2afa93){logger[_0xa448('0x16')](_0xa448('0x19'),_0x220fd5);logger[_0xa448('0x10')](_0xa448('0x19'),_0x220fd5,JSON['stringify'](_0x2afa93));_0x28a80b(_0x2afa93);})[_0xa448('0x18')](function(_0x453d88){logger[_0xa448('0x13')](_0xa448('0x19'),_0x453d88['message'],_0x220fd5);_0x1b6370(_0x77722[_0xa448('0x13')](0x1f4,_0x453d88[_0xa448('0x15')]));});});};exports[_0xa448('0x1e')]=function(_0xac9518){var _0x5f3031=this;return new Promise(function(_0x46bcb3,_0x4daa90){return db[_0xa448('0x1f')][_0xa448('0x20')](_0xac9518[_0xa448('0x1b')],{'raw':_0xac9518[_0xa448('0x1c')]?_0xac9518[_0xa448('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xac9518[_0xa448('0x1c')]?_0xac9518[_0xa448('0x1c')][_0xa448('0x21')]||null:null,'attributes':_0xac9518[_0xa448('0x1c')]?_0xac9518[_0xa448('0x1c')][_0xa448('0x22')]||null:null,'limit':_0xac9518[_0xa448('0x1c')]?_0xac9518[_0xa448('0x1c')][_0xa448('0x23')]||null:null})[_0xa448('0xd')](function(_0x32bfa4){logger[_0xa448('0x16')](_0xa448('0x1e'),_0xac9518);logger[_0xa448('0x10')]('UpdateFaxMessage',_0xac9518,JSON[_0xa448('0x12')](_0x32bfa4));_0x46bcb3(_0x32bfa4);})[_0xa448('0x18')](function(_0x215329){logger[_0xa448('0x13')](_0xa448('0x1e'),_0x215329[_0xa448('0x15')],_0xac9518);_0x4daa90(_0x5f3031[_0xa448('0x13')](0x1f4,_0x215329['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b97f07e..8150eaa 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 _0xc978=['remove','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events','save'];(function(_0x492056,_0x50a2d7){var _0x5482d1=function(_0x1d9f5d){while(--_0x1d9f5d){_0x492056['push'](_0x492056['shift']());}};_0x5482d1(++_0x50a2d7);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var FaxMessageEvents=require(_0x8c97('0x0'));var events=[_0x8c97('0x1'),_0x8c97('0x2'),_0x8c97('0x3')];function createListener(_0x371c48,_0x44d4ea){return function(_0x5ef47d){_0x44d4ea[_0x8c97('0x4')](_0x371c48,_0x5ef47d);};}function removeListener(_0x23c28d,_0x3ad972){return function(){FaxMessageEvents[_0x8c97('0x5')](_0x23c28d,_0x3ad972);};}exports[_0x8c97('0x6')]=function(_0x2a9434){for(var _0xabd146=0x0,_0x524196=events[_0x8c97('0x7')];_0xabd146<_0x524196;_0xabd146++){var _0x1b5864=events[_0xabd146];var _0x332cd1=createListener(_0x8c97('0x8')+_0x1b5864,_0x2a9434);FaxMessageEvents['on'](_0x1b5864,_0x332cd1);}}; \ No newline at end of file +var _0x1af3=['emit','register','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x50547e,_0x1cb723){var _0x45606f=function(_0x5b8d92){while(--_0x5b8d92){_0x50547e['push'](_0x50547e['shift']());}};_0x45606f(++_0x1cb723);}(_0x1af3,0x1ca));var _0x31af=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x1af3[_0x2f6f50];return _0x2cf365;};'use strict';var FaxMessageEvents=require(_0x31af('0x0'));var events=[_0x31af('0x1'),_0x31af('0x2'),_0x31af('0x3')];function createListener(_0x450506,_0xf27e22){return function(_0x3d693c){_0xf27e22[_0x31af('0x4')](_0x450506,_0x3d693c);};}function removeListener(_0x3d64ae,_0xc098ee){return function(){FaxMessageEvents['removeListener'](_0x3d64ae,_0xc098ee);};}exports[_0x31af('0x5')]=function(_0x416162){for(var _0x1ac3f6=0x0,_0x21ddc5=events['length'];_0x1ac3f6<_0x21ddc5;_0x1ac3f6++){var _0x6be8e9=events[_0x1ac3f6];var _0x1833de=createListener(_0x31af('0x6')+_0x6be8e9,_0x416162);FaxMessageEvents['on'](_0x6be8e9,_0x1833de);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 874317f..11f671c 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 _0x25e7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','index','isAuthenticated','describe','get','/:id','show','/:id/download','download','post','faxmessage:create','create','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x10d1ab,_0x1e18a5){var _0x46798e=function(_0x4d2c8a){while(--_0x4d2c8a){_0x10d1ab['push'](_0x10d1ab['shift']());}};_0x46798e(++_0x1e18a5);}(_0x25e7,0x1d6));var _0x725e=function(_0x332998,_0x2d99c7){_0x332998=_0x332998-0x0;var _0x460be7=_0x25e7[_0x332998];return _0x460be7;};'use strict';var multer=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var path=require(_0x725e('0x2'));var timeout=require(_0x725e('0x3'));var express=require(_0x725e('0x4'));var router=express[_0x725e('0x5')]();var auth=require(_0x725e('0x6'));var interaction=require(_0x725e('0x7'));var config=require(_0x725e('0x8'));var controller=require(_0x725e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x725e('0xa')]);router['get']('/describe',auth[_0x725e('0xb')](),controller[_0x725e('0xc')]);router[_0x725e('0xd')](_0x725e('0xe'),auth[_0x725e('0xb')](),controller[_0x725e('0xf')]);router[_0x725e('0xd')](_0x725e('0x10'),auth[_0x725e('0xb')](),controller[_0x725e('0x11')]);router[_0x725e('0x12')]('/',auth[_0x725e('0xb')](),interaction['tracked']('fax',_0x725e('0x13')),controller[_0x725e('0x14')]);router['put']('/:id',auth[_0x725e('0xb')](),controller[_0x725e('0x15')]);router['put'](_0x725e('0x16'),auth[_0x725e('0xb')](),controller[_0x725e('0x17')]);router['put'](_0x725e('0x18'),auth[_0x725e('0xb')](),controller[_0x725e('0x19')]);router[_0x725e('0x1a')](_0x725e('0xe'),auth[_0x725e('0xb')](),controller['destroy']);module[_0x725e('0x1b')]=router; \ No newline at end of file +var _0x3e24=['isAuthenticated','index','/describe','/:id','show','download','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get'];(function(_0x14e143,_0x459499){var _0x44364d=function(_0x426602){while(--_0x426602){_0x14e143['push'](_0x14e143['shift']());}};_0x44364d(++_0x459499);}(_0x3e24,0x167));var _0x43e2=function(_0x50d8b2,_0x46f88d){_0x50d8b2=_0x50d8b2-0x0;var _0x2f9972=_0x3e24[_0x50d8b2];return _0x2f9972;};'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/download',auth[_0x43e2('0x9')](),controller[_0x43e2('0xe')]);router['post']('/',auth[_0x43e2('0x9')](),interaction['tracked']('fax','faxmessage:create'),controller[_0x43e2('0xf')]);router[_0x43e2('0x10')](_0x43e2('0xc'),auth[_0x43e2('0x9')](),controller[_0x43e2('0x11')]);router[_0x43e2('0x10')](_0x43e2('0x12'),auth[_0x43e2('0x9')](),controller[_0x43e2('0x13')]);router[_0x43e2('0x10')](_0x43e2('0x14'),auth[_0x43e2('0x9')](),controller['reject']);router[_0x43e2('0x15')](_0x43e2('0xc'),auth[_0x43e2('0x9')](),controller[_0x43e2('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 8484ed5..c61485f 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 _0xd11c=['name','INTEGER','ENUM','beepall','sequelize','STRING'];(function(_0xf03dd0,_0x22e465){var _0x5ef314=function(_0x2745f0){while(--_0x2745f0){_0xf03dd0['push'](_0xf03dd0['shift']());}};_0x5ef314(++_0x22e465);}(_0xd11c,0x1c0));var _0xcd11=function(_0x38176f,_0x52315d){_0x38176f=_0x38176f-0x0;var _0x31b82b=_0xd11c[_0x38176f];return _0x31b82b;};'use strict';var Sequelize=require(_0xcd11('0x0'));module['exports']={'name':{'type':Sequelize[_0xcd11('0x1')],'unique':_0xcd11('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcd11('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcd11('0x4')]('rrmemory',_0xcd11('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xcd11('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa957=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xa957,0xd8));var _0x7a95=function(_0x46f715,_0x25ed97){_0x46f715=_0x46f715-0x0;var _0x1213e3=_0xa957[_0x46f715];return _0x1213e3;};'use strict';var Sequelize=require(_0x7a95('0x0'));module[_0x7a95('0x1')]={'name':{'type':Sequelize[_0x7a95('0x2')],'unique':_0x7a95('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7a95('0x2')]},'timeout':{'type':Sequelize[_0x7a95('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7a95('0x5')]('rrmemory',_0x7a95('0x6'),_0x7a95('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x7a95('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index f45a488..8f5326c 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 _0x64f5=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','get','UserFaxQueue','hasOwnProperty','FaxQueueId','findAll','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','addTeams','ids','User','Agents','union','removeTeams','removeAgents','addAgents','omit','userFaxQueue:save','isArray','emit','userFaxQueue:remove','getAgents','html-pdf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','./faxQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','FaxQueues','UserProfileResource','sendStatus','stack','send','index','FaxQueue','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','field','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name'];(function(_0x9602ab,_0x40ceba){var _0x3dc583=function(_0xad38ba){while(--_0xad38ba){_0x9602ab['push'](_0x9602ab['shift']());}};_0x3dc583(++_0x40ceba);}(_0x64f5,0x17e));var _0x564f=function(_0x17192b,_0x28546e){_0x17192b=_0x17192b-0x0;var _0x20d408=_0x64f5[_0x17192b];return _0x20d408;};'use strict';var pdf=require(_0x564f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x564f('0x1'));var rp=require('request-promise');var moment=require(_0x564f('0x2'));var BPromise=require(_0x564f('0x3'));var Mustache=require('mustache');var util=require(_0x564f('0x4'));var path=require(_0x564f('0x5'));var sox=require(_0x564f('0x6'));var csv=require(_0x564f('0x7'));var ejs=require(_0x564f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x564f('0x9'));var crypto=require(_0x564f('0xa'));var jsforce=require(_0x564f('0xb'));var deskjs=require(_0x564f('0xc'));var toCsv=require(_0x564f('0x7'));var querystring=require(_0x564f('0xd'));var Papa=require(_0x564f('0xe'));var authService=require(_0x564f('0xf'));var hardwareService=require(_0x564f('0x10'));var Redis=require(_0x564f('0x11'));var qs=require(_0x564f('0x12'));var logger=require(_0x564f('0x13'))(_0x564f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x564f('0x15'))['db'];config['redis']=_[_0x564f('0x16')](config[_0x564f('0x17')],{'host':_0x564f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x564f('0x17')]));require(_0x564f('0x19'))[_0x564f('0x1a')](socket);function respondWithStatusCode(_0x11d189,_0x454f0b){_0x454f0b=_0x454f0b||0xcc;return function(_0x518570){if(_0x518570){return _0x11d189['sendStatus'](_0x454f0b);}return _0x11d189[_0x564f('0x1b')](_0x454f0b)[_0x564f('0x1c')]();};}function respondWithResult(_0x2f41bb,_0x38fdd7){_0x38fdd7=_0x38fdd7||0xc8;return function(_0xec5adf){if(_0xec5adf){return _0x2f41bb[_0x564f('0x1b')](_0x38fdd7)[_0x564f('0x1d')](_0xec5adf);}};}function respondWithFilteredResult(_0x15d9d7,_0x3cd90c){return function(_0x41da55){if(_0x41da55){var _0x38764d=_0x41da55[_0x564f('0x1e')],_0x4cbf60=_0x3cd90c[_0x564f('0x1f')],_0x1a5759=_0x3cd90c[_0x564f('0x1f')]+_0x3cd90c[_0x564f('0x20')],_0x445017;if(_0x1a5759>=_0x38764d){_0x1a5759=_0x38764d;_0x445017=0xc8;}else{_0x445017=0xce;}_0x15d9d7[_0x564f('0x1b')](_0x445017);return _0x15d9d7[_0x564f('0x21')](_0x564f('0x22'),_0x4cbf60+'-'+_0x1a5759+'/'+_0x38764d)[_0x564f('0x1d')](_0x41da55);}return null;};}function patchUpdates(_0x2908f3){return function(_0x5a09e8){try{jsonpatch[_0x564f('0x23')](_0x5a09e8,_0x2908f3,!![]);}catch(_0x8a86e2){return BPromise[_0x564f('0x24')](_0x8a86e2);}return _0x5a09e8['save']();};}function saveUpdates(_0x20bb76,_0x2da7eb){return function(_0x303392){if(_0x303392){return _0x303392[_0x564f('0x25')](_0x20bb76)[_0x564f('0x26')](function(_0x51d3e7){return _0x51d3e7;});}return null;};}function removeEntity(_0x19cd7a,_0x558677){return function(_0x27af41){if(_0x27af41){return _0x27af41[_0x564f('0x27')]()[_0x564f('0x26')](function(){var _0x4417e9=_0x27af41['get']({'plain':!![]});var _0xa8471e=_0x564f('0x28');return db[_0x564f('0x29')]['destroy']({'where':{'type':_0xa8471e,'resourceId':_0x4417e9['id']}})[_0x564f('0x26')](function(){return _0x27af41;});})['then'](function(){_0x19cd7a[_0x564f('0x1b')](0xcc)[_0x564f('0x1c')]();});}};}function handleEntityNotFound(_0x49eb3f,_0x1c9889){return function(_0x57a15d){if(!_0x57a15d){_0x49eb3f[_0x564f('0x2a')](0x194);}return _0x57a15d;};}function handleError(_0x5c0a8b,_0xbea943){_0xbea943=_0xbea943||0x1f4;return function(_0x2a58ea){logger['error'](_0x2a58ea[_0x564f('0x2b')]);if(_0x2a58ea['name']){delete _0x2a58ea['name'];}_0x5c0a8b[_0x564f('0x1b')](_0xbea943)[_0x564f('0x2c')](_0x2a58ea);};}exports[_0x564f('0x2d')]=function(_0x51130c,_0x3b87fc){var _0x589918={},_0x1c1794={},_0x16da32={'count':0x0,'rows':[]};var _0x5dfe91=db[_0x564f('0x2e')]['rawAttributes'];_0x1c1794[_0x564f('0x2f')]=_[_0x564f('0x30')](_0x5dfe91);_0x1c1794[_0x564f('0x31')]=_[_0x564f('0x30')](_0x51130c[_0x564f('0x31')]);_0x1c1794[_0x564f('0x32')]=_[_0x564f('0x33')](_0x1c1794[_0x564f('0x2f')],_0x1c1794['query']);_0x589918[_0x564f('0x34')]=_[_0x564f('0x33')](_0x1c1794['model'],qs[_0x564f('0x35')](_0x51130c[_0x564f('0x31')][_0x564f('0x35')]));_0x589918[_0x564f('0x34')]=_0x589918[_0x564f('0x34')][_0x564f('0x36')]?_0x589918[_0x564f('0x34')]:_0x1c1794[_0x564f('0x2f')];if(!_0x51130c[_0x564f('0x31')]['hasOwnProperty'](_0x564f('0x37'))){_0x589918[_0x564f('0x20')]=qs[_0x564f('0x20')](_0x51130c[_0x564f('0x31')]['limit']);_0x589918['offset']=qs['offset'](_0x51130c[_0x564f('0x31')][_0x564f('0x1f')]);}_0x589918[_0x564f('0x38')]=qs[_0x564f('0x39')](_0x51130c['query']['sort']);_0x589918[_0x564f('0x3a')]=qs['filters'](_['pick'](_0x51130c[_0x564f('0x31')],_0x1c1794['filters']));if(_0x51130c[_0x564f('0x31')][_0x564f('0x3b')]){_0x589918[_0x564f('0x3a')]=_[_0x564f('0x3c')](_0x589918['where'],{'$or':_[_0x564f('0x3d')](_0x5dfe91,function(_0x13dd6e){if(_0x13dd6e[_0x564f('0x3e')]['key']!==_0x564f('0x3f')){var _0x1ccc83={};_0x1ccc83[_0x13dd6e[_0x564f('0x40')]]={'$like':'%'+_0x51130c['query'][_0x564f('0x3b')]+'%'};return _0x1ccc83;}})});}_0x589918=_['merge']({},_0x589918,_0x51130c[_0x564f('0x41')]);var _0x1e177b={'where':_0x589918[_0x564f('0x3a')]};return db[_0x564f('0x2e')]['count'](_0x1e177b)[_0x564f('0x26')](function(_0x59f73b){_0x16da32['count']=_0x59f73b;if(_0x51130c[_0x564f('0x31')]['includeAll']){_0x589918[_0x564f('0x42')]=[{'all':!![]}];}return db[_0x564f('0x2e')]['findAll'](_0x589918);})[_0x564f('0x26')](function(_0x39453f){_0x16da32[_0x564f('0x43')]=_0x39453f;return _0x16da32;})[_0x564f('0x26')](respondWithFilteredResult(_0x3b87fc,_0x589918))[_0x564f('0x44')](handleError(_0x3b87fc,null));};exports[_0x564f('0x45')]=function(_0x1fb9df,_0x1e24e9){var _0x28320c={'raw':!![],'where':{'id':_0x1fb9df[_0x564f('0x46')]['id']}},_0x5b122e={};_0x5b122e[_0x564f('0x2f')]=_['keys'](db[_0x564f('0x2e')][_0x564f('0x47')]);_0x5b122e['query']=_['keys'](_0x1fb9df[_0x564f('0x31')]);_0x5b122e[_0x564f('0x32')]=_[_0x564f('0x33')](_0x5b122e[_0x564f('0x2f')],_0x5b122e[_0x564f('0x31')]);_0x28320c[_0x564f('0x34')]=_['intersection'](_0x5b122e['model'],qs[_0x564f('0x35')](_0x1fb9df[_0x564f('0x31')]['fields']));_0x28320c[_0x564f('0x34')]=_0x28320c[_0x564f('0x34')][_0x564f('0x36')]?_0x28320c['attributes']:_0x5b122e['model'];if(_0x1fb9df[_0x564f('0x31')][_0x564f('0x48')]){_0x28320c[_0x564f('0x42')]=[{'all':!![]}];}_0x28320c=_[_0x564f('0x3c')]({},_0x28320c,_0x1fb9df[_0x564f('0x41')]);return db[_0x564f('0x2e')][_0x564f('0x49')](_0x28320c)[_0x564f('0x26')](handleEntityNotFound(_0x1e24e9,null))[_0x564f('0x26')](respondWithResult(_0x1e24e9,null))[_0x564f('0x44')](handleError(_0x1e24e9,null));};exports[_0x564f('0x4a')]=function(_0x2c2270,_0x1d44a7){return db[_0x564f('0x2e')][_0x564f('0x4a')](_0x2c2270[_0x564f('0x4b')],{})[_0x564f('0x26')](function(_0x483520){var _0x27f060=_0x2c2270['user']['get']({'plain':!![]});if(!_0x27f060)throw new Error(_0x564f('0x4c'));if(_0x27f060[_0x564f('0x4d')]==='user'){var _0x1b96b6=_0x483520['get']({'plain':!![]});var _0x12eb50='FaxQueues';return db[_0x564f('0x4e')]['find']({'where':{'name':_0x12eb50,'userProfileId':_0x27f060[_0x564f('0x4f')]},'raw':!![]})[_0x564f('0x26')](function(_0x2cccb1){if(_0x2cccb1&&_0x2cccb1[_0x564f('0x50')]===0x0){return db[_0x564f('0x29')]['create']({'name':_0x1b96b6[_0x564f('0x51')],'resourceId':_0x1b96b6['id'],'type':_0x2cccb1['name'],'sectionId':_0x2cccb1['id']},{})[_0x564f('0x26')](function(){return _0x483520;});}else{return _0x483520;}})[_0x564f('0x44')](function(_0x5d071c){logger[_0x564f('0x52')](_0x564f('0x53'),_0x5d071c);throw _0x5d071c;});}return _0x483520;})[_0x564f('0x26')](respondWithResult(_0x1d44a7,0xc9))[_0x564f('0x44')](handleError(_0x1d44a7,null));};exports[_0x564f('0x25')]=function(_0x37c318,_0x1ae6c1){if(_0x37c318[_0x564f('0x4b')]['id']){delete _0x37c318[_0x564f('0x4b')]['id'];}return db['FaxQueue'][_0x564f('0x49')]({'where':{'id':_0x37c318[_0x564f('0x46')]['id']}})[_0x564f('0x26')](handleEntityNotFound(_0x1ae6c1,null))[_0x564f('0x26')](saveUpdates(_0x37c318[_0x564f('0x4b')],null))[_0x564f('0x26')](respondWithResult(_0x1ae6c1,null))['catch'](handleError(_0x1ae6c1,null));};exports[_0x564f('0x27')]=function(_0x1511d1,_0x1b0d85){return db[_0x564f('0x2e')][_0x564f('0x49')]({'where':{'id':_0x1511d1[_0x564f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b0d85,null))[_0x564f('0x26')](removeEntity(_0x1b0d85,null))[_0x564f('0x44')](handleError(_0x1b0d85,null));};exports[_0x564f('0x54')]=function(_0x1faeaf,_0x54500c){return db['FaxQueue'][_0x564f('0x54')]()[_0x564f('0x26')](respondWithResult(_0x54500c,null))[_0x564f('0x44')](handleError(_0x54500c,null));};exports['getMembers']=function(_0x36a7eb,_0x49941f,_0x33976c){var _0x560250={'raw':!![],'where':{}},_0x34f3fb={},_0x367b34;return db[_0x564f('0x2e')][_0x564f('0x55')]({'where':{'id':_0x36a7eb['params']['id']}})[_0x564f('0x26')](handleEntityNotFound(_0x49941f,null))[_0x564f('0x26')](function(_0x34c55f){if(_0x34c55f){_0x367b34=_0x34c55f[_0x564f('0x56')]({'plain':!![]});_0x34f3fb[_0x564f('0x2f')]=_[_0x564f('0x30')](db[_0x564f('0x57')][_0x564f('0x47')]);_0x34f3fb[_0x564f('0x31')]=_[_0x564f('0x30')](_0x36a7eb[_0x564f('0x31')]);_0x34f3fb[_0x564f('0x32')]=_[_0x564f('0x33')](_0x34f3fb[_0x564f('0x2f')],_0x34f3fb[_0x564f('0x31')]);_0x560250['attributes']=_[_0x564f('0x33')](_0x34f3fb[_0x564f('0x2f')],qs[_0x564f('0x35')](_0x36a7eb[_0x564f('0x31')][_0x564f('0x35')]));_0x560250['attributes']=_0x560250[_0x564f('0x34')]['length']?_0x560250[_0x564f('0x34')]:_0x34f3fb[_0x564f('0x2f')];if(!_0x36a7eb[_0x564f('0x31')][_0x564f('0x58')](_0x564f('0x37'))){_0x560250[_0x564f('0x20')]=qs[_0x564f('0x20')](_0x36a7eb[_0x564f('0x31')][_0x564f('0x20')]);_0x560250[_0x564f('0x1f')]=qs[_0x564f('0x1f')](_0x36a7eb[_0x564f('0x31')]['offset']);}_0x560250['order']=qs[_0x564f('0x39')](_0x36a7eb[_0x564f('0x31')]['sort']);_0x560250[_0x564f('0x3a')]=qs[_0x564f('0x32')](_['pick'](_0x36a7eb[_0x564f('0x31')],_0x34f3fb['filters']));_0x560250[_0x564f('0x3a')][_0x564f('0x59')]=_0x34c55f['id'];if(_0x36a7eb[_0x564f('0x31')][_0x564f('0x3b')]){_0x560250['where']=_[_0x564f('0x3c')](_0x560250[_0x564f('0x3a')],{'$or':_[_0x564f('0x3d')](_0x560250[_0x564f('0x34')],function(_0x56b04e){var _0x2a034f={};_0x2a034f[_0x56b04e]={'$like':'%'+_0x36a7eb['query'][_0x564f('0x3b')]+'%'};return _0x2a034f;})});}_0x560250=_[_0x564f('0x3c')]({},_0x560250,_0x36a7eb[_0x564f('0x41')]);return db[_0x564f('0x57')][_0x564f('0x5a')](_0x560250);}})[_0x564f('0x26')](function(_0x1c001f){if(_0x1c001f){return db['User'][_0x564f('0x5b')]({'where':{'id':_['map'](_0x1c001f,_0x564f('0x5c')),'role':_0x564f('0x5d')},'attributes':['id','name',_0x564f('0x5e'),_0x564f('0x5f'),_0x564f('0x60')]});}})[_0x564f('0x26')](function(_0x1105a0){if(_0x1105a0){return{'count':_0x1105a0[_0x564f('0x1e')],'rows':_[_0x564f('0x3d')](_0x1105a0[_0x564f('0x43')],function(_0x5de3df){return{'membername':_0x5de3df[_0x564f('0x51')],'UserId':_0x5de3df['id'],'queue_name':_0x367b34['name'],'FaxQueueId':_0x367b34['id'],'interface':util[_0x564f('0x61')](_0x564f('0x62'),'SIP',_0x5de3df[_0x564f('0x51')]),'penalty':0x0,'paused':_0x5de3df[_0x564f('0x5e')],'createdAt':_0x5de3df[_0x564f('0x60')],'updatedAt':_0x5de3df[_0x564f('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x564f('0x26')](respondWithFilteredResult(_0x49941f,_0x560250))[_0x564f('0x44')](handleError(_0x49941f,null));};exports[_0x564f('0x63')]=function(_0x40102e,_0x5a2311,_0x2f73e2){var _0x67d930={};var _0x4038b={};var _0x2833fa;var _0x46daf5;return db[_0x564f('0x2e')][_0x564f('0x55')]({'where':{'id':_0x40102e[_0x564f('0x46')]['id']}})[_0x564f('0x26')](handleEntityNotFound(_0x5a2311,null))['then'](function(_0xc8d3b5){if(_0xc8d3b5){_0x2833fa=_0xc8d3b5;_0x4038b[_0x564f('0x2f')]=_[_0x564f('0x30')](db[_0x564f('0x64')]['rawAttributes']);_0x4038b[_0x564f('0x31')]=_['keys'](_0x40102e[_0x564f('0x31')]);_0x4038b[_0x564f('0x32')]=_['intersection'](_0x4038b['model'],_0x4038b[_0x564f('0x31')]);_0x67d930[_0x564f('0x34')]=_[_0x564f('0x33')](_0x4038b['model'],qs[_0x564f('0x35')](_0x40102e[_0x564f('0x31')]['fields']));_0x67d930['attributes']=_0x67d930[_0x564f('0x34')][_0x564f('0x36')]?_0x67d930[_0x564f('0x34')]:_0x4038b[_0x564f('0x2f')];_0x67d930['order']=qs[_0x564f('0x39')](_0x40102e[_0x564f('0x31')][_0x564f('0x39')]);_0x67d930[_0x564f('0x3a')]=qs['filters'](_[_0x564f('0x65')](_0x40102e[_0x564f('0x31')],_0x4038b['filters']));if(_0x40102e['query'][_0x564f('0x3b')]){_0x67d930['where']=_[_0x564f('0x3c')](_0x67d930[_0x564f('0x3a')],{'$or':_[_0x564f('0x3d')](_0x67d930[_0x564f('0x34')],function(_0xee2a5c){var _0x4c8d79={};_0x4c8d79[_0xee2a5c]={'$like':'%'+_0x40102e[_0x564f('0x31')][_0x564f('0x3b')]+'%'};return _0x4c8d79;})});}_0x67d930=_[_0x564f('0x3c')]({},_0x67d930,_0x40102e[_0x564f('0x41')]);return _0x2833fa[_0x564f('0x63')](_0x67d930);}})[_0x564f('0x26')](function(_0x206e7f){if(_0x206e7f){_0x46daf5=_0x206e7f[_0x564f('0x36')];if(!_0x40102e[_0x564f('0x31')][_0x564f('0x58')](_0x564f('0x37'))){_0x67d930[_0x564f('0x20')]=qs[_0x564f('0x20')](_0x40102e[_0x564f('0x31')]['limit']);_0x67d930[_0x564f('0x1f')]=qs[_0x564f('0x1f')](_0x40102e[_0x564f('0x31')][_0x564f('0x1f')]);}return _0x2833fa[_0x564f('0x63')](_0x67d930);}})['then'](function(_0x118107){if(_0x118107){return _0x118107?{'count':_0x46daf5,'rows':_0x118107}:null;}})[_0x564f('0x26')](respondWithResult(_0x5a2311,null))[_0x564f('0x44')](handleError(_0x5a2311,null));};exports[_0x564f('0x66')]=function(_0x342560,_0xf772e0,_0x381b5c){var _0x56e601=[];var _0x5dab05;return db[_0x564f('0x64')][_0x564f('0x5a')]({'where':{'id':_0x342560[_0x564f('0x4b')][_0x564f('0x67')]},'attributes':['id'],'include':[{'model':db[_0x564f('0x68')],'as':_0x564f('0x69'),'attributes':['id'],'raw':!![]}]})[_0x564f('0x26')](function(_0x53525b){if(_0x53525b){for(var _0x4d4cc0=0x0;_0x4d4cc0<_0x53525b[_0x564f('0x36')];_0x4d4cc0+=0x1){for(var _0x23998b=0x0;_0x23998b<_0x53525b[_0x4d4cc0][_0x564f('0x69')]['length'];_0x23998b+=0x1){_0x56e601=_[_0x564f('0x6a')](_0x56e601,[_0x53525b[_0x4d4cc0]['Agents'][_0x23998b]['id']]);}}return _0x56e601;}})['then'](function(_0x2b1334){if(_0x2b1334){return db[_0x564f('0x2e')][_0x564f('0x49')]({'where':{'id':_0x342560['params']['id']}});}})[_0x564f('0x26')](function(_0x5e6a29){if(_0x5e6a29){_0x5dab05=_0x5e6a29;return _0x5dab05['addAgents'](_0x56e601,{'penalty':_0x342560[_0x564f('0x4b')]['penalty']});}})['then'](function(_0x344fe3){if(_0x344fe3){return _0x5dab05[_0x564f('0x66')](_0x342560[_0x564f('0x4b')][_0x564f('0x67')]);}})[_0x564f('0x26')](handleEntityNotFound(_0xf772e0,null))['then'](respondWithStatusCode(_0xf772e0,null))[_0x564f('0x44')](handleError(_0xf772e0,null));};exports[_0x564f('0x6b')]=function(_0x9a2db4,_0x3f1533,_0x536490){var _0x4f2aa9=[];var _0x2dcf7a;return db[_0x564f('0x64')][_0x564f('0x5a')]({'where':{'id':_0x9a2db4['query'][_0x564f('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x564f('0x26')](function(_0x1653b4){if(_0x1653b4){for(var _0x41f00b=0x0;_0x41f00b<_0x1653b4['length'];_0x41f00b+=0x1){for(var _0x4d67de=0x0;_0x4d67de<_0x1653b4[_0x41f00b][_0x564f('0x69')]['length'];_0x4d67de+=0x1){_0x4f2aa9=_[_0x564f('0x6a')](_0x4f2aa9,[_0x1653b4[_0x41f00b][_0x564f('0x69')][_0x4d67de]['id']]);}}return _0x4f2aa9;}})[_0x564f('0x26')](function(_0x238fd8){if(_0x238fd8){return db['FaxQueue'][_0x564f('0x49')]({'where':{'id':_0x9a2db4['params']['id']}});}})[_0x564f('0x26')](function(_0x555b51){if(_0x555b51){_0x2dcf7a=_0x555b51;return _0x2dcf7a[_0x564f('0x6c')](_0x4f2aa9);}})[_0x564f('0x26')](function(_0x121a2c){if(_0x2dcf7a){return _0x2dcf7a[_0x564f('0x6b')](_0x9a2db4[_0x564f('0x31')][_0x564f('0x67')]);}})[_0x564f('0x26')](handleEntityNotFound(_0x3f1533,null))[_0x564f('0x26')](respondWithStatusCode(_0x3f1533,null))[_0x564f('0x44')](handleError(_0x3f1533,null));};exports[_0x564f('0x6d')]=function(_0x5e65ce,_0x1f1e48,_0x398c80){return db['FaxQueue'][_0x564f('0x49')]({'where':{'id':_0x5e65ce[_0x564f('0x46')]['id']}})[_0x564f('0x26')](handleEntityNotFound(_0x1f1e48,null))[_0x564f('0x26')](function(_0x2603c2){if(_0x2603c2){return _0x2603c2['addAgents'](_0x5e65ce[_0x564f('0x4b')]['ids'],_[_0x564f('0x6e')](_0x5e65ce[_0x564f('0x4b')],['ids','id'])||{})['spread'](function(_0x5accb4){for(var _0x5ff101=0x0;_0x5ff101<_0x5e65ce[_0x564f('0x4b')]['ids'][_0x564f('0x36')];_0x5ff101+=0x1){socket['emit'](_0x564f('0x6f'),{'UserId':_0x5e65ce['body'][_0x564f('0x67')][_0x5ff101],'FaxQueueId':_0x5e65ce[_0x564f('0x46')]['id']});}return _0x5accb4;});}})[_0x564f('0x26')](respondWithResult(_0x1f1e48,null))[_0x564f('0x44')](handleError(_0x1f1e48,null));};exports[_0x564f('0x6c')]=function(_0x2b8578,_0x5d406e,_0x561afa){var _0xb0b391;return db[_0x564f('0x2e')][_0x564f('0x49')]({'where':{'id':_0x2b8578[_0x564f('0x46')]['id']}})[_0x564f('0x26')](handleEntityNotFound(_0x5d406e,null))[_0x564f('0x26')](function(_0x5ef73f){if(_0x5ef73f){return _0x5ef73f[_0x564f('0x6c')](_0x2b8578['query'][_0x564f('0x67')])[_0x564f('0x26')](function(_0x4e5e23){if(_[_0x564f('0x70')](_0x2b8578[_0x564f('0x31')][_0x564f('0x67')])){for(var _0x3a8651=0x0;_0x3a8651<_0x2b8578[_0x564f('0x31')][_0x564f('0x67')][_0x564f('0x36')];_0x3a8651+=0x1){socket[_0x564f('0x71')](_0x564f('0x72'),{'UserId':_0x2b8578[_0x564f('0x31')][_0x564f('0x67')][_0x3a8651],'FaxQueueId':_0x2b8578[_0x564f('0x46')]['id']});}}else{socket['emit']('userFaxQueue:remove',{'UserId':_0x2b8578[_0x564f('0x31')]['ids'],'FaxQueueId':_0x2b8578[_0x564f('0x46')]['id']});}});}})[_0x564f('0x26')](respondWithStatusCode(_0x5d406e,null))[_0x564f('0x44')](handleError(_0x5d406e,null));};exports[_0x564f('0x73')]=function(_0x490077,_0x3e9674,_0x5d3be3){var _0x34da42={};var _0x49446={};var _0x11821e;var _0xd2f85d;return db[_0x564f('0x2e')][_0x564f('0x55')]({'where':{'id':_0x490077[_0x564f('0x46')]['id']}})[_0x564f('0x26')](handleEntityNotFound(_0x3e9674,null))['then'](function(_0x50c689){if(_0x50c689){_0x11821e=_0x50c689;_0x49446[_0x564f('0x2f')]=_[_0x564f('0x30')](db[_0x564f('0x68')][_0x564f('0x47')]);_0x49446['query']=_[_0x564f('0x30')](_0x490077[_0x564f('0x31')]);_0x49446['filters']=_[_0x564f('0x33')](_0x49446[_0x564f('0x2f')],_0x49446['query']);_0x34da42['attributes']=_[_0x564f('0x33')](_0x49446[_0x564f('0x2f')],qs[_0x564f('0x35')](_0x490077[_0x564f('0x31')]['fields']));_0x34da42['attributes']=_0x34da42[_0x564f('0x34')][_0x564f('0x36')]?_0x34da42[_0x564f('0x34')]:_0x49446[_0x564f('0x2f')];_0x34da42[_0x564f('0x38')]=qs[_0x564f('0x39')](_0x490077[_0x564f('0x31')][_0x564f('0x39')]);_0x34da42[_0x564f('0x3a')]=qs[_0x564f('0x32')](_[_0x564f('0x65')](_0x490077[_0x564f('0x31')],_0x49446[_0x564f('0x32')]));if(_0x490077['query'][_0x564f('0x3b')]){_0x34da42[_0x564f('0x3a')]=_[_0x564f('0x3c')](_0x34da42[_0x564f('0x3a')],{'$or':_[_0x564f('0x3d')](_0x34da42['attributes'],function(_0x310263){var _0x448a38={};_0x448a38[_0x310263]={'$like':'%'+_0x490077[_0x564f('0x31')][_0x564f('0x3b')]+'%'};return _0x448a38;})});}_0x34da42=_[_0x564f('0x3c')]({},_0x34da42,_0x490077[_0x564f('0x41')]);return _0x11821e[_0x564f('0x73')](_0x34da42);}})['then'](function(_0x4aeeb4){if(_0x4aeeb4){_0xd2f85d=_0x4aeeb4['length'];if(!_0x490077[_0x564f('0x31')][_0x564f('0x58')]('nolimit')){_0x34da42['limit']=qs['limit'](_0x490077[_0x564f('0x31')]['limit']);_0x34da42['offset']=qs['offset'](_0x490077[_0x564f('0x31')][_0x564f('0x1f')]);}return _0x11821e['getAgents'](_0x34da42);}})[_0x564f('0x26')](function(_0x574d00){if(_0x574d00){return _0x574d00?{'count':_0xd2f85d,'rows':_0x574d00}:null;}})[_0x564f('0x26')](respondWithResult(_0x3e9674,null))[_0x564f('0x44')](handleError(_0x3e9674,null));}; \ No newline at end of file +var _0xff19=['userProfileId','autoAssociation','error','params','describe','getMembers','UserFaxQueue','FaxQueueId','User','findAndCountAll','agent','faxPause','createdAt','rows','updatedAt','findOne','Team','getTeams','addTeams','ids','Agents','removeTeams','union','addAgents','omit','spread','emit','userFaxQueue:save','removeAgents','isArray','userFaxQueue:remove','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','sendStatus','status','end','offset','limit','set','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','FaxQueue','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','filter','options','count','include','findAll','catch','show','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection'];(function(_0x45eec6,_0x46ea2f){var _0x21bbe5=function(_0x539a35){while(--_0x539a35){_0x45eec6['push'](_0x45eec6['shift']());}};_0x21bbe5(++_0x46ea2f);}(_0xff19,0x100));var _0x9ff1=function(_0x106bfd,_0x4c1659){_0x106bfd=_0x106bfd-0x0;var _0x2eed19=_0xff19[_0x106bfd];return _0x2eed19;};'use strict';var pdf=require(_0x9ff1('0x0'));var emlformat=require(_0x9ff1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9ff1('0x2'));var rp=require(_0x9ff1('0x3'));var moment=require(_0x9ff1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9ff1('0x5'));var path=require(_0x9ff1('0x6'));var sox=require('sox');var csv=require(_0x9ff1('0x7'));var ejs=require(_0x9ff1('0x8'));var fs=require('fs');var _=require(_0x9ff1('0x9'));var squel=require(_0x9ff1('0xa'));var crypto=require(_0x9ff1('0xb'));var jsforce=require(_0x9ff1('0xc'));var deskjs=require(_0x9ff1('0xd'));var toCsv=require(_0x9ff1('0x7'));var querystring=require('querystring');var Papa=require(_0x9ff1('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x9ff1('0xf'));var Redis=require(_0x9ff1('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x9ff1('0x11'))(_0x9ff1('0x12'));var utils=require(_0x9ff1('0x13'));var config=require(_0x9ff1('0x14'));var db=require(_0x9ff1('0x15'))['db'];config[_0x9ff1('0x16')]=_[_0x9ff1('0x17')](config['redis'],{'host':_0x9ff1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ff1('0x16')]));require(_0x9ff1('0x19'))['register'](socket);function respondWithStatusCode(_0xef9d83,_0x2d8673){_0x2d8673=_0x2d8673||0xcc;return function(_0x1203ba){if(_0x1203ba){return _0xef9d83[_0x9ff1('0x1a')](_0x2d8673);}return _0xef9d83[_0x9ff1('0x1b')](_0x2d8673)[_0x9ff1('0x1c')]();};}function respondWithResult(_0x4c9d58,_0x4cf960){_0x4cf960=_0x4cf960||0xc8;return function(_0x345006){if(_0x345006){return _0x4c9d58[_0x9ff1('0x1b')](_0x4cf960)['json'](_0x345006);}};}function respondWithFilteredResult(_0x3cc81e,_0x173966){return function(_0x1bd1a6){if(_0x1bd1a6){var _0xb6c010=_0x1bd1a6['count'],_0x5bb77e=_0x173966[_0x9ff1('0x1d')],_0x2ad4ee=_0x173966[_0x9ff1('0x1d')]+_0x173966[_0x9ff1('0x1e')],_0x469d1e;if(_0x2ad4ee>=_0xb6c010){_0x2ad4ee=_0xb6c010;_0x469d1e=0xc8;}else{_0x469d1e=0xce;}_0x3cc81e[_0x9ff1('0x1b')](_0x469d1e);return _0x3cc81e[_0x9ff1('0x1f')]('Content-Range',_0x5bb77e+'-'+_0x2ad4ee+'/'+_0xb6c010)['json'](_0x1bd1a6);}return null;};}function patchUpdates(_0x43a5d2){return function(_0x52cb06){try{jsonpatch['apply'](_0x52cb06,_0x43a5d2,!![]);}catch(_0x2ef1d6){return BPromise[_0x9ff1('0x20')](_0x2ef1d6);}return _0x52cb06[_0x9ff1('0x21')]();};}function saveUpdates(_0x1efd33,_0x2894f1){return function(_0x77b89c){if(_0x77b89c){return _0x77b89c[_0x9ff1('0x22')](_0x1efd33)['then'](function(_0x2fff4c){return _0x2fff4c;});}return null;};}function removeEntity(_0x15ac30,_0x15f3d5){return function(_0x166331){if(_0x166331){return _0x166331[_0x9ff1('0x23')]()[_0x9ff1('0x24')](function(){var _0x408c49=_0x166331[_0x9ff1('0x25')]({'plain':!![]});var _0x17c09b='FaxQueues';return db[_0x9ff1('0x26')][_0x9ff1('0x23')]({'where':{'type':_0x17c09b,'resourceId':_0x408c49['id']}})['then'](function(){return _0x166331;});})[_0x9ff1('0x24')](function(){_0x15ac30['status'](0xcc)[_0x9ff1('0x1c')]();});}};}function handleEntityNotFound(_0x1faa76,_0x452c30){return function(_0x4ae757){if(!_0x4ae757){_0x1faa76[_0x9ff1('0x1a')](0x194);}return _0x4ae757;};}function handleError(_0x1c1985,_0x296115){_0x296115=_0x296115||0x1f4;return function(_0xf89f18){logger['error'](_0xf89f18[_0x9ff1('0x27')]);if(_0xf89f18['name']){delete _0xf89f18[_0x9ff1('0x28')];}_0x1c1985[_0x9ff1('0x1b')](_0x296115)[_0x9ff1('0x29')](_0xf89f18);};}exports[_0x9ff1('0x2a')]=function(_0x35fdbb,_0x30723a){var _0x386ace={},_0x49aba5={},_0x1a276a={'count':0x0,'rows':[]};var _0x5ba03b=db[_0x9ff1('0x2b')]['rawAttributes'];_0x49aba5[_0x9ff1('0x2c')]=_[_0x9ff1('0x2d')](_0x5ba03b);_0x49aba5[_0x9ff1('0x2e')]=_[_0x9ff1('0x2d')](_0x35fdbb[_0x9ff1('0x2e')]);_0x49aba5[_0x9ff1('0x2f')]=_[_0x9ff1('0x30')](_0x49aba5[_0x9ff1('0x2c')],_0x49aba5[_0x9ff1('0x2e')]);_0x386ace[_0x9ff1('0x31')]=_[_0x9ff1('0x30')](_0x49aba5[_0x9ff1('0x2c')],qs[_0x9ff1('0x32')](_0x35fdbb['query']['fields']));_0x386ace[_0x9ff1('0x31')]=_0x386ace['attributes'][_0x9ff1('0x33')]?_0x386ace[_0x9ff1('0x31')]:_0x49aba5[_0x9ff1('0x2c')];if(!_0x35fdbb[_0x9ff1('0x2e')][_0x9ff1('0x34')](_0x9ff1('0x35'))){_0x386ace[_0x9ff1('0x1e')]=qs[_0x9ff1('0x1e')](_0x35fdbb[_0x9ff1('0x2e')][_0x9ff1('0x1e')]);_0x386ace[_0x9ff1('0x1d')]=qs[_0x9ff1('0x1d')](_0x35fdbb[_0x9ff1('0x2e')][_0x9ff1('0x1d')]);}_0x386ace[_0x9ff1('0x36')]=qs[_0x9ff1('0x37')](_0x35fdbb[_0x9ff1('0x2e')][_0x9ff1('0x37')]);_0x386ace[_0x9ff1('0x38')]=qs[_0x9ff1('0x2f')](_[_0x9ff1('0x39')](_0x35fdbb['query'],_0x49aba5['filters']));if(_0x35fdbb[_0x9ff1('0x2e')]['filter']){_0x386ace[_0x9ff1('0x38')]=_[_0x9ff1('0x3a')](_0x386ace[_0x9ff1('0x38')],{'$or':_[_0x9ff1('0x3b')](_0x5ba03b,function(_0x5a05e){if(_0x5a05e[_0x9ff1('0x3c')][_0x9ff1('0x3d')]!==_0x9ff1('0x3e')){var _0x174ed7={};_0x174ed7[_0x5a05e['field']]={'$like':'%'+_0x35fdbb['query'][_0x9ff1('0x3f')]+'%'};return _0x174ed7;}})});}_0x386ace=_[_0x9ff1('0x3a')]({},_0x386ace,_0x35fdbb[_0x9ff1('0x40')]);var _0xf6a7ee={'where':_0x386ace[_0x9ff1('0x38')]};return db[_0x9ff1('0x2b')][_0x9ff1('0x41')](_0xf6a7ee)['then'](function(_0x3ac38a){_0x1a276a['count']=_0x3ac38a;if(_0x35fdbb[_0x9ff1('0x2e')]['includeAll']){_0x386ace[_0x9ff1('0x42')]=[{'all':!![]}];}return db[_0x9ff1('0x2b')][_0x9ff1('0x43')](_0x386ace);})[_0x9ff1('0x24')](function(_0x1b8770){_0x1a276a['rows']=_0x1b8770;return _0x1a276a;})[_0x9ff1('0x24')](respondWithFilteredResult(_0x30723a,_0x386ace))[_0x9ff1('0x44')](handleError(_0x30723a,null));};exports[_0x9ff1('0x45')]=function(_0x43e809,_0xddafa2){var _0x1c66b2={'raw':!![],'where':{'id':_0x43e809['params']['id']}},_0x55c7f7={};_0x55c7f7['model']=_[_0x9ff1('0x2d')](db[_0x9ff1('0x2b')][_0x9ff1('0x46')]);_0x55c7f7['query']=_[_0x9ff1('0x2d')](_0x43e809[_0x9ff1('0x2e')]);_0x55c7f7[_0x9ff1('0x2f')]=_[_0x9ff1('0x30')](_0x55c7f7['model'],_0x55c7f7[_0x9ff1('0x2e')]);_0x1c66b2['attributes']=_[_0x9ff1('0x30')](_0x55c7f7[_0x9ff1('0x2c')],qs[_0x9ff1('0x32')](_0x43e809[_0x9ff1('0x2e')][_0x9ff1('0x32')]));_0x1c66b2[_0x9ff1('0x31')]=_0x1c66b2[_0x9ff1('0x31')]['length']?_0x1c66b2[_0x9ff1('0x31')]:_0x55c7f7[_0x9ff1('0x2c')];if(_0x43e809['query'][_0x9ff1('0x47')]){_0x1c66b2[_0x9ff1('0x42')]=[{'all':!![]}];}_0x1c66b2=_[_0x9ff1('0x3a')]({},_0x1c66b2,_0x43e809[_0x9ff1('0x40')]);return db['FaxQueue'][_0x9ff1('0x48')](_0x1c66b2)['then'](handleEntityNotFound(_0xddafa2,null))[_0x9ff1('0x24')](respondWithResult(_0xddafa2,null))[_0x9ff1('0x44')](handleError(_0xddafa2,null));};exports[_0x9ff1('0x49')]=function(_0x5ade73,_0x5d227b){return db[_0x9ff1('0x2b')][_0x9ff1('0x49')](_0x5ade73[_0x9ff1('0x4a')],{})['then'](function(_0x5e46a4){var _0x238406=_0x5ade73[_0x9ff1('0x4b')]['get']({'plain':!![]});if(!_0x238406)throw new Error(_0x9ff1('0x4c'));if(_0x238406[_0x9ff1('0x4d')]===_0x9ff1('0x4b')){var _0x773b28=_0x5e46a4[_0x9ff1('0x25')]({'plain':!![]});var _0x517c4a=_0x9ff1('0x4e');return db[_0x9ff1('0x4f')][_0x9ff1('0x48')]({'where':{'name':_0x517c4a,'userProfileId':_0x238406[_0x9ff1('0x50')]},'raw':!![]})[_0x9ff1('0x24')](function(_0x20b252){if(_0x20b252&&_0x20b252[_0x9ff1('0x51')]===0x0){return db[_0x9ff1('0x26')]['create']({'name':_0x773b28[_0x9ff1('0x28')],'resourceId':_0x773b28['id'],'type':_0x20b252[_0x9ff1('0x28')],'sectionId':_0x20b252['id']},{})[_0x9ff1('0x24')](function(){return _0x5e46a4;});}else{return _0x5e46a4;}})[_0x9ff1('0x44')](function(_0x28c38f){logger[_0x9ff1('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28c38f);throw _0x28c38f;});}return _0x5e46a4;})[_0x9ff1('0x24')](respondWithResult(_0x5d227b,0xc9))['catch'](handleError(_0x5d227b,null));};exports[_0x9ff1('0x22')]=function(_0x57fff8,_0x558123){if(_0x57fff8[_0x9ff1('0x4a')]['id']){delete _0x57fff8[_0x9ff1('0x4a')]['id'];}return db['FaxQueue'][_0x9ff1('0x48')]({'where':{'id':_0x57fff8[_0x9ff1('0x53')]['id']}})[_0x9ff1('0x24')](handleEntityNotFound(_0x558123,null))['then'](saveUpdates(_0x57fff8[_0x9ff1('0x4a')],null))['then'](respondWithResult(_0x558123,null))[_0x9ff1('0x44')](handleError(_0x558123,null));};exports[_0x9ff1('0x23')]=function(_0x20118a,_0x22cefa){return db['FaxQueue'][_0x9ff1('0x48')]({'where':{'id':_0x20118a[_0x9ff1('0x53')]['id']}})[_0x9ff1('0x24')](handleEntityNotFound(_0x22cefa,null))[_0x9ff1('0x24')](removeEntity(_0x22cefa,null))[_0x9ff1('0x44')](handleError(_0x22cefa,null));};exports[_0x9ff1('0x54')]=function(_0x683e55,_0x225532){return db[_0x9ff1('0x2b')][_0x9ff1('0x54')]()['then'](respondWithResult(_0x225532,null))[_0x9ff1('0x44')](handleError(_0x225532,null));};exports[_0x9ff1('0x55')]=function(_0x4cf259,_0x5e1c76,_0x3309ff){var _0x3504a2={'raw':!![],'where':{}},_0x5ad36c={},_0x1e09d2;return db[_0x9ff1('0x2b')]['findOne']({'where':{'id':_0x4cf259[_0x9ff1('0x53')]['id']}})[_0x9ff1('0x24')](handleEntityNotFound(_0x5e1c76,null))['then'](function(_0x184174){if(_0x184174){_0x1e09d2=_0x184174[_0x9ff1('0x25')]({'plain':!![]});_0x5ad36c[_0x9ff1('0x2c')]=_[_0x9ff1('0x2d')](db[_0x9ff1('0x56')][_0x9ff1('0x46')]);_0x5ad36c[_0x9ff1('0x2e')]=_[_0x9ff1('0x2d')](_0x4cf259[_0x9ff1('0x2e')]);_0x5ad36c['filters']=_['intersection'](_0x5ad36c[_0x9ff1('0x2c')],_0x5ad36c[_0x9ff1('0x2e')]);_0x3504a2['attributes']=_[_0x9ff1('0x30')](_0x5ad36c['model'],qs[_0x9ff1('0x32')](_0x4cf259['query'][_0x9ff1('0x32')]));_0x3504a2[_0x9ff1('0x31')]=_0x3504a2[_0x9ff1('0x31')][_0x9ff1('0x33')]?_0x3504a2['attributes']:_0x5ad36c['model'];if(!_0x4cf259[_0x9ff1('0x2e')][_0x9ff1('0x34')]('nolimit')){_0x3504a2[_0x9ff1('0x1e')]=qs['limit'](_0x4cf259['query'][_0x9ff1('0x1e')]);_0x3504a2[_0x9ff1('0x1d')]=qs[_0x9ff1('0x1d')](_0x4cf259[_0x9ff1('0x2e')][_0x9ff1('0x1d')]);}_0x3504a2[_0x9ff1('0x36')]=qs[_0x9ff1('0x37')](_0x4cf259['query'][_0x9ff1('0x37')]);_0x3504a2[_0x9ff1('0x38')]=qs[_0x9ff1('0x2f')](_[_0x9ff1('0x39')](_0x4cf259[_0x9ff1('0x2e')],_0x5ad36c['filters']));_0x3504a2['where'][_0x9ff1('0x57')]=_0x184174['id'];if(_0x4cf259[_0x9ff1('0x2e')][_0x9ff1('0x3f')]){_0x3504a2['where']=_[_0x9ff1('0x3a')](_0x3504a2['where'],{'$or':_[_0x9ff1('0x3b')](_0x3504a2['attributes'],function(_0xa74af3){var _0x156731={};_0x156731[_0xa74af3]={'$like':'%'+_0x4cf259[_0x9ff1('0x2e')][_0x9ff1('0x3f')]+'%'};return _0x156731;})});}_0x3504a2=_['merge']({},_0x3504a2,_0x4cf259[_0x9ff1('0x40')]);return db[_0x9ff1('0x56')]['findAll'](_0x3504a2);}})[_0x9ff1('0x24')](function(_0x55efa5){if(_0x55efa5){return db[_0x9ff1('0x58')][_0x9ff1('0x59')]({'where':{'id':_[_0x9ff1('0x3b')](_0x55efa5,'UserId'),'role':_0x9ff1('0x5a')},'attributes':['id',_0x9ff1('0x28'),_0x9ff1('0x5b'),'updatedAt',_0x9ff1('0x5c')]});}})['then'](function(_0xc86cd7){if(_0xc86cd7){return{'count':_0xc86cd7[_0x9ff1('0x41')],'rows':_['map'](_0xc86cd7[_0x9ff1('0x5d')],function(_0x13072e){return{'membername':_0x13072e[_0x9ff1('0x28')],'UserId':_0x13072e['id'],'queue_name':_0x1e09d2[_0x9ff1('0x28')],'FaxQueueId':_0x1e09d2['id'],'interface':util['format']('%s/%s','SIP',_0x13072e[_0x9ff1('0x28')]),'penalty':0x0,'paused':_0x13072e['faxPause'],'createdAt':_0x13072e[_0x9ff1('0x5c')],'updatedAt':_0x13072e[_0x9ff1('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9ff1('0x24')](respondWithFilteredResult(_0x5e1c76,_0x3504a2))[_0x9ff1('0x44')](handleError(_0x5e1c76,null));};exports['getTeams']=function(_0x22902d,_0x5d8ab5,_0x4c55a){var _0x42b879={};var _0x1ce9f2={};var _0x419c48;var _0xb26b63;return db[_0x9ff1('0x2b')][_0x9ff1('0x5f')]({'where':{'id':_0x22902d[_0x9ff1('0x53')]['id']}})[_0x9ff1('0x24')](handleEntityNotFound(_0x5d8ab5,null))['then'](function(_0x44ca0d){if(_0x44ca0d){_0x419c48=_0x44ca0d;_0x1ce9f2['model']=_[_0x9ff1('0x2d')](db[_0x9ff1('0x60')][_0x9ff1('0x46')]);_0x1ce9f2[_0x9ff1('0x2e')]=_[_0x9ff1('0x2d')](_0x22902d[_0x9ff1('0x2e')]);_0x1ce9f2[_0x9ff1('0x2f')]=_['intersection'](_0x1ce9f2[_0x9ff1('0x2c')],_0x1ce9f2[_0x9ff1('0x2e')]);_0x42b879[_0x9ff1('0x31')]=_[_0x9ff1('0x30')](_0x1ce9f2[_0x9ff1('0x2c')],qs[_0x9ff1('0x32')](_0x22902d[_0x9ff1('0x2e')][_0x9ff1('0x32')]));_0x42b879[_0x9ff1('0x31')]=_0x42b879[_0x9ff1('0x31')][_0x9ff1('0x33')]?_0x42b879[_0x9ff1('0x31')]:_0x1ce9f2[_0x9ff1('0x2c')];_0x42b879[_0x9ff1('0x36')]=qs[_0x9ff1('0x37')](_0x22902d[_0x9ff1('0x2e')][_0x9ff1('0x37')]);_0x42b879['where']=qs[_0x9ff1('0x2f')](_[_0x9ff1('0x39')](_0x22902d['query'],_0x1ce9f2[_0x9ff1('0x2f')]));if(_0x22902d[_0x9ff1('0x2e')][_0x9ff1('0x3f')]){_0x42b879[_0x9ff1('0x38')]=_[_0x9ff1('0x3a')](_0x42b879[_0x9ff1('0x38')],{'$or':_[_0x9ff1('0x3b')](_0x42b879[_0x9ff1('0x31')],function(_0x40b93a){var _0x41e1eb={};_0x41e1eb[_0x40b93a]={'$like':'%'+_0x22902d[_0x9ff1('0x2e')][_0x9ff1('0x3f')]+'%'};return _0x41e1eb;})});}_0x42b879=_[_0x9ff1('0x3a')]({},_0x42b879,_0x22902d[_0x9ff1('0x40')]);return _0x419c48['getTeams'](_0x42b879);}})['then'](function(_0x2bf1a7){if(_0x2bf1a7){_0xb26b63=_0x2bf1a7[_0x9ff1('0x33')];if(!_0x22902d[_0x9ff1('0x2e')][_0x9ff1('0x34')](_0x9ff1('0x35'))){_0x42b879[_0x9ff1('0x1e')]=qs[_0x9ff1('0x1e')](_0x22902d['query'][_0x9ff1('0x1e')]);_0x42b879[_0x9ff1('0x1d')]=qs[_0x9ff1('0x1d')](_0x22902d[_0x9ff1('0x2e')][_0x9ff1('0x1d')]);}return _0x419c48[_0x9ff1('0x61')](_0x42b879);}})[_0x9ff1('0x24')](function(_0x23c35a){if(_0x23c35a){return _0x23c35a?{'count':_0xb26b63,'rows':_0x23c35a}:null;}})[_0x9ff1('0x24')](respondWithResult(_0x5d8ab5,null))['catch'](handleError(_0x5d8ab5,null));};exports[_0x9ff1('0x62')]=function(_0x2aac29,_0x487317,_0x4e8e13){var _0x2b7a25=[];var _0x1e89d3;return db['Team'][_0x9ff1('0x43')]({'where':{'id':_0x2aac29[_0x9ff1('0x4a')][_0x9ff1('0x63')]},'attributes':['id'],'include':[{'model':db[_0x9ff1('0x58')],'as':_0x9ff1('0x64'),'attributes':['id'],'raw':!![]}]})[_0x9ff1('0x24')](function(_0x4392a5){if(_0x4392a5){for(var _0x5542c9=0x0;_0x5542c9<_0x4392a5[_0x9ff1('0x33')];_0x5542c9+=0x1){for(var _0x604dee=0x0;_0x604dee<_0x4392a5[_0x5542c9]['Agents'][_0x9ff1('0x33')];_0x604dee+=0x1){_0x2b7a25=_['union'](_0x2b7a25,[_0x4392a5[_0x5542c9][_0x9ff1('0x64')][_0x604dee]['id']]);}}return _0x2b7a25;}})[_0x9ff1('0x24')](function(_0x3c2090){if(_0x3c2090){return db[_0x9ff1('0x2b')][_0x9ff1('0x48')]({'where':{'id':_0x2aac29[_0x9ff1('0x53')]['id']}});}})[_0x9ff1('0x24')](function(_0x5b3f21){if(_0x5b3f21){_0x1e89d3=_0x5b3f21;return _0x1e89d3['addAgents'](_0x2b7a25,{'penalty':_0x2aac29['body']['penalty']});}})['then'](function(_0xdb65fe){if(_0xdb65fe){return _0x1e89d3['addTeams'](_0x2aac29[_0x9ff1('0x4a')][_0x9ff1('0x63')]);}})[_0x9ff1('0x24')](handleEntityNotFound(_0x487317,null))[_0x9ff1('0x24')](respondWithStatusCode(_0x487317,null))['catch'](handleError(_0x487317,null));};exports[_0x9ff1('0x65')]=function(_0x435c82,_0x50f31d,_0x9b6cdf){var _0x2b68cd=[];var _0x3744e1;return db[_0x9ff1('0x60')][_0x9ff1('0x43')]({'where':{'id':_0x435c82[_0x9ff1('0x2e')][_0x9ff1('0x63')]},'attributes':['id'],'include':[{'model':db[_0x9ff1('0x58')],'as':_0x9ff1('0x64'),'attributes':['id'],'raw':!![]}]})[_0x9ff1('0x24')](function(_0x140e30){if(_0x140e30){for(var _0x13e381=0x0;_0x13e381<_0x140e30['length'];_0x13e381+=0x1){for(var _0x506c9a=0x0;_0x506c9a<_0x140e30[_0x13e381]['Agents']['length'];_0x506c9a+=0x1){_0x2b68cd=_[_0x9ff1('0x66')](_0x2b68cd,[_0x140e30[_0x13e381]['Agents'][_0x506c9a]['id']]);}}return _0x2b68cd;}})[_0x9ff1('0x24')](function(_0x32dcca){if(_0x32dcca){return db[_0x9ff1('0x2b')][_0x9ff1('0x48')]({'where':{'id':_0x435c82[_0x9ff1('0x53')]['id']}});}})['then'](function(_0x5be03a){if(_0x5be03a){_0x3744e1=_0x5be03a;return _0x3744e1['removeAgents'](_0x2b68cd);}})['then'](function(_0x375c4f){if(_0x3744e1){return _0x3744e1[_0x9ff1('0x65')](_0x435c82['query'][_0x9ff1('0x63')]);}})[_0x9ff1('0x24')](handleEntityNotFound(_0x50f31d,null))[_0x9ff1('0x24')](respondWithStatusCode(_0x50f31d,null))[_0x9ff1('0x44')](handleError(_0x50f31d,null));};exports[_0x9ff1('0x67')]=function(_0x288699,_0x4a1bb3,_0x69facd){return db['FaxQueue'][_0x9ff1('0x48')]({'where':{'id':_0x288699[_0x9ff1('0x53')]['id']}})[_0x9ff1('0x24')](handleEntityNotFound(_0x4a1bb3,null))['then'](function(_0x48311e){if(_0x48311e){return _0x48311e[_0x9ff1('0x67')](_0x288699[_0x9ff1('0x4a')][_0x9ff1('0x63')],_[_0x9ff1('0x68')](_0x288699[_0x9ff1('0x4a')],[_0x9ff1('0x63'),'id'])||{})[_0x9ff1('0x69')](function(_0x5a8ca0){for(var _0x22945c=0x0;_0x22945c<_0x288699['body']['ids'][_0x9ff1('0x33')];_0x22945c+=0x1){socket[_0x9ff1('0x6a')](_0x9ff1('0x6b'),{'UserId':_0x288699['body'][_0x9ff1('0x63')][_0x22945c],'FaxQueueId':_0x288699[_0x9ff1('0x53')]['id']});}return _0x5a8ca0;});}})['then'](respondWithResult(_0x4a1bb3,null))['catch'](handleError(_0x4a1bb3,null));};exports[_0x9ff1('0x6c')]=function(_0x3de6ca,_0x2e14c1,_0x33402c){var _0x198eeb;return db['FaxQueue'][_0x9ff1('0x48')]({'where':{'id':_0x3de6ca[_0x9ff1('0x53')]['id']}})[_0x9ff1('0x24')](handleEntityNotFound(_0x2e14c1,null))[_0x9ff1('0x24')](function(_0x9fe43e){if(_0x9fe43e){return _0x9fe43e[_0x9ff1('0x6c')](_0x3de6ca[_0x9ff1('0x2e')][_0x9ff1('0x63')])[_0x9ff1('0x24')](function(_0xc7f6f3){if(_[_0x9ff1('0x6d')](_0x3de6ca['query'][_0x9ff1('0x63')])){for(var _0x963044=0x0;_0x963044<_0x3de6ca['query']['ids']['length'];_0x963044+=0x1){socket[_0x9ff1('0x6a')](_0x9ff1('0x6e'),{'UserId':_0x3de6ca['query'][_0x9ff1('0x63')][_0x963044],'FaxQueueId':_0x3de6ca[_0x9ff1('0x53')]['id']});}}else{socket[_0x9ff1('0x6a')]('userFaxQueue:remove',{'UserId':_0x3de6ca[_0x9ff1('0x2e')]['ids'],'FaxQueueId':_0x3de6ca['params']['id']});}});}})[_0x9ff1('0x24')](respondWithStatusCode(_0x2e14c1,null))[_0x9ff1('0x44')](handleError(_0x2e14c1,null));};exports[_0x9ff1('0x6f')]=function(_0x399d60,_0x452eaf,_0x41b55c){var _0x553740={};var _0x4bbb3b={};var _0x475ac6;var _0x36b2d4;return db['FaxQueue'][_0x9ff1('0x5f')]({'where':{'id':_0x399d60[_0x9ff1('0x53')]['id']}})['then'](handleEntityNotFound(_0x452eaf,null))['then'](function(_0x250735){if(_0x250735){_0x475ac6=_0x250735;_0x4bbb3b[_0x9ff1('0x2c')]=_[_0x9ff1('0x2d')](db[_0x9ff1('0x58')]['rawAttributes']);_0x4bbb3b['query']=_[_0x9ff1('0x2d')](_0x399d60[_0x9ff1('0x2e')]);_0x4bbb3b[_0x9ff1('0x2f')]=_[_0x9ff1('0x30')](_0x4bbb3b[_0x9ff1('0x2c')],_0x4bbb3b[_0x9ff1('0x2e')]);_0x553740['attributes']=_[_0x9ff1('0x30')](_0x4bbb3b[_0x9ff1('0x2c')],qs[_0x9ff1('0x32')](_0x399d60['query'][_0x9ff1('0x32')]));_0x553740[_0x9ff1('0x31')]=_0x553740[_0x9ff1('0x31')][_0x9ff1('0x33')]?_0x553740[_0x9ff1('0x31')]:_0x4bbb3b[_0x9ff1('0x2c')];_0x553740['order']=qs[_0x9ff1('0x37')](_0x399d60[_0x9ff1('0x2e')][_0x9ff1('0x37')]);_0x553740[_0x9ff1('0x38')]=qs['filters'](_[_0x9ff1('0x39')](_0x399d60['query'],_0x4bbb3b[_0x9ff1('0x2f')]));if(_0x399d60[_0x9ff1('0x2e')]['filter']){_0x553740[_0x9ff1('0x38')]=_['merge'](_0x553740[_0x9ff1('0x38')],{'$or':_['map'](_0x553740['attributes'],function(_0x5d0c96){var _0x57430a={};_0x57430a[_0x5d0c96]={'$like':'%'+_0x399d60['query'][_0x9ff1('0x3f')]+'%'};return _0x57430a;})});}_0x553740=_[_0x9ff1('0x3a')]({},_0x553740,_0x399d60['options']);return _0x475ac6[_0x9ff1('0x6f')](_0x553740);}})[_0x9ff1('0x24')](function(_0x12afb5){if(_0x12afb5){_0x36b2d4=_0x12afb5[_0x9ff1('0x33')];if(!_0x399d60[_0x9ff1('0x2e')][_0x9ff1('0x34')](_0x9ff1('0x35'))){_0x553740[_0x9ff1('0x1e')]=qs[_0x9ff1('0x1e')](_0x399d60[_0x9ff1('0x2e')][_0x9ff1('0x1e')]);_0x553740[_0x9ff1('0x1d')]=qs[_0x9ff1('0x1d')](_0x399d60[_0x9ff1('0x2e')][_0x9ff1('0x1d')]);}return _0x475ac6['getAgents'](_0x553740);}})[_0x9ff1('0x24')](function(_0x23ad6d){if(_0x23ad6d){return _0x23ad6d?{'count':_0x36b2d4,'rows':_0x23ad6d}:null;}})[_0x9ff1('0x24')](respondWithResult(_0x452eaf,null))[_0x9ff1('0x44')](handleError(_0x452eaf,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index fbbd893..b9bad64 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 _0x84ab=['../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','exports','events'];(function(_0x3464af,_0x5d24ca){var _0x334742=function(_0x2d65f4){while(--_0x2d65f4){_0x3464af['push'](_0x3464af['shift']());}};_0x334742(++_0x5d24ca);}(_0x84ab,0x12f));var _0xb84a=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x84ab[_0x2eb5bc];return _0x51c7b1;};'use strict';var EventEmitter=require(_0xb84a('0x0'));var FaxQueue=require(_0xb84a('0x1'))['db'][_0xb84a('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb84a('0x3')](0x0);var events={'afterCreate':_0xb84a('0x4'),'afterUpdate':'update','afterDestroy':_0xb84a('0x5')};function emitEvent(_0x18a4a5){return function(_0x47b8e3,_0x9d3a00,_0xe72ccd){FaxQueueEvents[_0xb84a('0x6')](_0x18a4a5+':'+_0x47b8e3['id'],_0x47b8e3);FaxQueueEvents['emit'](_0x18a4a5,_0x47b8e3);_0xe72ccd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xb84a('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xa8a8=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x30c96f,_0xd2e1f2){var _0x93297=function(_0x31792c){while(--_0x31792c){_0x30c96f['push'](_0x30c96f['shift']());}};_0x93297(++_0xd2e1f2);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4c97c9,_0xee74bb){_0x4c97c9=_0x4c97c9-0x0;var _0x2186fd=_0xa8a8[_0x4c97c9];return _0x2186fd;};'use strict';var EventEmitter=require(_0x8a8a('0x0'));var FaxQueue=require(_0x8a8a('0x1'))['db'][_0x8a8a('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8a8a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a8a('0x4'),'afterDestroy':_0x8a8a('0x5')};function emitEvent(_0xf11a08){return function(_0x3ed1de,_0x45515d,_0x1cecd4){FaxQueueEvents[_0x8a8a('0x6')](_0xf11a08+':'+_0x3ed1de['id'],_0x3ed1de);FaxQueueEvents[_0x8a8a('0x6')](_0xf11a08,_0x3ed1de);_0x1cecd4(null);};}for(var e in events){if(events[_0x8a8a('0x7')](e)){var event=events[e];FaxQueue[_0x8a8a('0x8')](e,emitEvent(event));}}module[_0x8a8a('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 c5abae6..f0d4e6d 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 _0xcb46=['FaxQueue','fax_queues','lodash','../../config/logger','api','bluebird','request-promise','./faxQueue.attributes','exports','define'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0xcb46,0x138));var _0x6cb4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb46[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6cb4('0x0'));var util=require('util');var logger=require(_0x6cb4('0x1'))(_0x6cb4('0x2'));var moment=require('moment');var BPromise=require(_0x6cb4('0x3'));var rp=require(_0x6cb4('0x4'));var attributes=require(_0x6cb4('0x5'));module[_0x6cb4('0x6')]=function(_0x430f3d,_0x38a4f7){return _0x430f3d[_0x6cb4('0x7')](_0x6cb4('0x8'),attributes,{'tableName':_0x6cb4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x142c=['define','FaxQueue','fax_queues','lodash','../../config/logger','bluebird','request-promise','./faxQueue.attributes','exports'];(function(_0xa55b1f,_0x2daca1){var _0x5506e2=function(_0x3c3726){while(--_0x3c3726){_0xa55b1f['push'](_0xa55b1f['shift']());}};_0x5506e2(++_0x2daca1);}(_0x142c,0x8a));var _0xc142=function(_0x128f51,_0x93d223){_0x128f51=_0x128f51-0x0;var _0x225a3c=_0x142c[_0x128f51];return _0x225a3c;};'use strict';var _=require(_0xc142('0x0'));var util=require('util');var logger=require(_0xc142('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc142('0x2'));var rp=require(_0xc142('0x3'));var attributes=require(_0xc142('0x4'));module[_0xc142('0x5')]=function(_0x11e083,_0x49455c){return _0x11e083[_0xc142('0x6')](_0xc142('0x7'),attributes,{'tableName':_0xc142('0x8'),'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 fe2b594..d4a718c 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 _0x373e=['message','catch','FaxQueue','options','raw','where','attributes','limit','include','model','map','then','GetFaxQueue','ShowFaxQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','http','redis','defaults','localhost','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x136e74,_0x28e291){var _0x1f45e0=function(_0x13f9de){while(--_0x13f9de){_0x136e74['push'](_0x136e74['shift']());}};_0x1f45e0(++_0x28e291);}(_0x373e,0xe0));var _0xe373=function(_0x3a6651,_0x4260b7){_0x3a6651=_0x3a6651-0x0;var _0x245c3b=_0x373e[_0x3a6651];return _0x245c3b;};'use strict';var _=require(_0xe373('0x0'));var util=require(_0xe373('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe373('0x2'));var fs=require('fs');var Redis=require(_0xe373('0x3'));var db=require(_0xe373('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe373('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe373('0x6')]({'port':0x232a});config[_0xe373('0x7')]=_[_0xe373('0x8')](config[_0xe373('0x7')],{'host':_0xe373('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe373('0x7')]));require(_0xe373('0xa'))[_0xe373('0xb')](socket);function respondWithRpcPromise(_0x48f716,_0x3f065e,_0x4428d9){return new BPromise(function(_0x282a96,_0x1370a1){return client[_0xe373('0xc')](_0x48f716,_0x4428d9)['then'](function(_0x2cef73){logger[_0xe373('0xd')](_0xe373('0xe'),_0x3f065e,_0xe373('0xf'));logger[_0xe373('0x10')](_0xe373('0x11'),_0x3f065e,_0xe373('0xf'),JSON[_0xe373('0x12')](_0x2cef73));if(_0x2cef73['error']){if(_0x2cef73[_0xe373('0x13')][_0xe373('0x14')]===0x1f4){logger[_0xe373('0x13')](_0xe373('0xe'),_0x3f065e,_0x2cef73[_0xe373('0x13')]['message']);return _0x1370a1(_0x2cef73[_0xe373('0x13')][_0xe373('0x15')]);}logger[_0xe373('0x13')](_0xe373('0xe'),_0x3f065e,_0x2cef73[_0xe373('0x13')][_0xe373('0x15')]);return _0x282a96(_0x2cef73['error'][_0xe373('0x15')]);}else{logger[_0xe373('0xd')](_0xe373('0xe'),_0x3f065e,_0xe373('0xf'));_0x282a96(_0x2cef73['result'][_0xe373('0x15')]);}})[_0xe373('0x16')](function(_0x4f7b0b){logger['error']('FaxQueue,\x20%s,\x20%s',_0x3f065e,_0x4f7b0b);_0x1370a1(_0x4f7b0b);});});}exports['GetFaxQueue']=function(_0x40ff3b){var _0x1bd532=this;return new Promise(function(_0x21c353,_0x11e254){return db[_0xe373('0x17')]['findAll']({'raw':_0x40ff3b[_0xe373('0x18')]?_0x40ff3b[_0xe373('0x18')][_0xe373('0x19')]===undefined?!![]:![]:!![],'where':_0x40ff3b[_0xe373('0x18')]?_0x40ff3b[_0xe373('0x18')][_0xe373('0x1a')]||null:null,'attributes':_0x40ff3b[_0xe373('0x18')]?_0x40ff3b[_0xe373('0x18')][_0xe373('0x1b')]||null:null,'limit':_0x40ff3b[_0xe373('0x18')]?_0x40ff3b[_0xe373('0x18')][_0xe373('0x1c')]||null:null,'include':_0x40ff3b['options']?_0x40ff3b['options'][_0xe373('0x1d')]?_['map'](_0x40ff3b[_0xe373('0x18')]['include'],function(_0x5d2661){return{'model':db[_0x5d2661[_0xe373('0x1e')]],'as':_0x5d2661['as'],'attributes':_0x5d2661[_0xe373('0x1b')],'include':_0x5d2661[_0xe373('0x1d')]?_['map'](_0x5d2661['include'],function(_0x1ea6d8){return{'model':db[_0x1ea6d8[_0xe373('0x1e')]],'as':_0x1ea6d8['as'],'attributes':_0x1ea6d8[_0xe373('0x1b')],'include':_0x1ea6d8[_0xe373('0x1d')]?_[_0xe373('0x1f')](_0x1ea6d8['include'],function(_0x4538c1){return{'model':db[_0x4538c1[_0xe373('0x1e')]],'as':_0x4538c1['as'],'attributes':_0x4538c1[_0xe373('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe373('0x20')](function(_0x1a7d2d){logger[_0xe373('0xd')](_0xe373('0x21'),_0x40ff3b);logger['debug'](_0xe373('0x21'),_0x40ff3b,JSON[_0xe373('0x12')](_0x1a7d2d));_0x21c353(_0x1a7d2d);})[_0xe373('0x16')](function(_0x25195d){logger[_0xe373('0x13')](_0xe373('0x21'),_0x25195d[_0xe373('0x15')],_0x40ff3b);_0x11e254(_0x1bd532['error'](0x1f4,_0x25195d[_0xe373('0x15')]));});});};exports[_0xe373('0x22')]=function(_0x5e569f){var _0xaa3bbc=this;return new Promise(function(_0x5c01b4,_0x4c67d2){return db['FaxQueue']['find']({'raw':_0x5e569f[_0xe373('0x18')]?_0x5e569f[_0xe373('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5e569f[_0xe373('0x18')]?_0x5e569f[_0xe373('0x18')][_0xe373('0x1a')]||null:null,'attributes':_0x5e569f[_0xe373('0x18')]?_0x5e569f[_0xe373('0x18')][_0xe373('0x1b')]||null:null,'include':_0x5e569f[_0xe373('0x18')]?_0x5e569f[_0xe373('0x18')]['include']?_[_0xe373('0x1f')](_0x5e569f[_0xe373('0x18')][_0xe373('0x1d')],function(_0x5f47aa){return{'model':db[_0x5f47aa['model']],'as':_0x5f47aa['as'],'attributes':_0x5f47aa[_0xe373('0x1b')],'include':_0x5f47aa[_0xe373('0x1d')]?_[_0xe373('0x1f')](_0x5f47aa[_0xe373('0x1d')],function(_0x1a85a0){return{'model':db[_0x1a85a0[_0xe373('0x1e')]],'as':_0x1a85a0['as'],'attributes':_0x1a85a0[_0xe373('0x1b')],'include':_0x1a85a0[_0xe373('0x1d')]?_[_0xe373('0x1f')](_0x1a85a0[_0xe373('0x1d')],function(_0x10bd56){return{'model':db[_0x10bd56[_0xe373('0x1e')]],'as':_0x10bd56['as'],'attributes':_0x10bd56['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ed4ef){logger[_0xe373('0xd')]('ShowFaxQueue',_0x5e569f);logger['debug'](_0xe373('0x22'),_0x5e569f,JSON[_0xe373('0x12')](_0x2ed4ef));_0x5c01b4(_0x2ed4ef);})['catch'](function(_0xcffe05){logger[_0xe373('0x13')](_0xe373('0x22'),_0xcffe05[_0xe373('0x15')],_0x5e569f);_0x4c67d2(_0xaa3bbc[_0xe373('0x13')](0x1f4,_0xcffe05['message']));});});}; \ No newline at end of file +var _0x812b=['util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','lodash'];(function(_0x28123a,_0x2cb75a){var _0x1aadc1=function(_0x60fd8d){while(--_0x60fd8d){_0x28123a['push'](_0x28123a['shift']());}};_0x1aadc1(++_0x2cb75a);}(_0x812b,0xe9));var _0xb812=function(_0x16b1b8,_0x432d03){_0x16b1b8=_0x16b1b8-0x0;var _0x558b1e=_0x812b[_0x16b1b8];return _0x558b1e;};'use strict';var _=require(_0xb812('0x0'));var util=require(_0xb812('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb812('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb812('0x3'))['db'];var utils=require(_0xb812('0x4'));var logger=require(_0xb812('0x5'))(_0xb812('0x6'));var config=require(_0xb812('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb812('0x8')]({'port':0x232a});config[_0xb812('0x9')]=_[_0xb812('0xa')](config['redis'],{'host':_0xb812('0xb'),'port':0x18eb});var socket=require(_0xb812('0xc'))(new Redis(config[_0xb812('0x9')]));require('./faxQueue.socket')[_0xb812('0xd')](socket);function respondWithRpcPromise(_0x2f61aa,_0x435cbe,_0x416252){return new BPromise(function(_0x104814,_0x1f3a8e){return client[_0xb812('0xe')](_0x2f61aa,_0x416252)[_0xb812('0xf')](function(_0x9b4f4d){logger[_0xb812('0x10')](_0xb812('0x11'),_0x435cbe,'request\x20sent');logger[_0xb812('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x435cbe,_0xb812('0x13'),JSON[_0xb812('0x14')](_0x9b4f4d));if(_0x9b4f4d[_0xb812('0x15')]){if(_0x9b4f4d[_0xb812('0x15')][_0xb812('0x16')]===0x1f4){logger[_0xb812('0x15')](_0xb812('0x11'),_0x435cbe,_0x9b4f4d[_0xb812('0x15')][_0xb812('0x17')]);return _0x1f3a8e(_0x9b4f4d[_0xb812('0x15')]['message']);}logger[_0xb812('0x15')](_0xb812('0x11'),_0x435cbe,_0x9b4f4d[_0xb812('0x15')][_0xb812('0x17')]);return _0x104814(_0x9b4f4d['error'][_0xb812('0x17')]);}else{logger['info'](_0xb812('0x11'),_0x435cbe,_0xb812('0x13'));_0x104814(_0x9b4f4d[_0xb812('0x18')]['message']);}})[_0xb812('0x19')](function(_0x5d2204){logger['error'](_0xb812('0x11'),_0x435cbe,_0x5d2204);_0x1f3a8e(_0x5d2204);});});}exports[_0xb812('0x1a')]=function(_0x3a6281){var _0x17d287=this;return new Promise(function(_0x1ce808,_0x4a3877){return db[_0xb812('0x1b')][_0xb812('0x1c')]({'raw':_0x3a6281[_0xb812('0x1d')]?_0x3a6281[_0xb812('0x1d')][_0xb812('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a6281['options']?_0x3a6281[_0xb812('0x1d')][_0xb812('0x1f')]||null:null,'attributes':_0x3a6281[_0xb812('0x1d')]?_0x3a6281[_0xb812('0x1d')][_0xb812('0x20')]||null:null,'limit':_0x3a6281[_0xb812('0x1d')]?_0x3a6281[_0xb812('0x1d')][_0xb812('0x21')]||null:null,'include':_0x3a6281['options']?_0x3a6281[_0xb812('0x1d')][_0xb812('0x22')]?_[_0xb812('0x23')](_0x3a6281['options'][_0xb812('0x22')],function(_0x4d16fb){return{'model':db[_0x4d16fb[_0xb812('0x24')]],'as':_0x4d16fb['as'],'attributes':_0x4d16fb[_0xb812('0x20')],'include':_0x4d16fb[_0xb812('0x22')]?_[_0xb812('0x23')](_0x4d16fb[_0xb812('0x22')],function(_0x126ba6){return{'model':db[_0x126ba6[_0xb812('0x24')]],'as':_0x126ba6['as'],'attributes':_0x126ba6[_0xb812('0x20')],'include':_0x126ba6['include']?_[_0xb812('0x23')](_0x126ba6[_0xb812('0x22')],function(_0x3ea69c){return{'model':db[_0x3ea69c[_0xb812('0x24')]],'as':_0x3ea69c['as'],'attributes':_0x3ea69c[_0xb812('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb812('0xf')](function(_0x2cc928){logger[_0xb812('0x10')](_0xb812('0x1a'),_0x3a6281);logger['debug'](_0xb812('0x1a'),_0x3a6281,JSON[_0xb812('0x14')](_0x2cc928));_0x1ce808(_0x2cc928);})[_0xb812('0x19')](function(_0x35aa6c){logger[_0xb812('0x15')](_0xb812('0x1a'),_0x35aa6c[_0xb812('0x17')],_0x3a6281);_0x4a3877(_0x17d287[_0xb812('0x15')](0x1f4,_0x35aa6c[_0xb812('0x17')]));});});};exports[_0xb812('0x25')]=function(_0x3f5924){var _0x2cdbb4=this;return new Promise(function(_0x2a0ce5,_0x2366c0){return db['FaxQueue'][_0xb812('0x26')]({'raw':_0x3f5924[_0xb812('0x1d')]?_0x3f5924[_0xb812('0x1d')][_0xb812('0x1e')]===undefined?!![]:![]:!![],'where':_0x3f5924[_0xb812('0x1d')]?_0x3f5924['options'][_0xb812('0x1f')]||null:null,'attributes':_0x3f5924[_0xb812('0x1d')]?_0x3f5924[_0xb812('0x1d')][_0xb812('0x20')]||null:null,'include':_0x3f5924['options']?_0x3f5924['options'][_0xb812('0x22')]?_[_0xb812('0x23')](_0x3f5924[_0xb812('0x1d')]['include'],function(_0xdf0bd7){return{'model':db[_0xdf0bd7[_0xb812('0x24')]],'as':_0xdf0bd7['as'],'attributes':_0xdf0bd7[_0xb812('0x20')],'include':_0xdf0bd7['include']?_['map'](_0xdf0bd7[_0xb812('0x22')],function(_0x22f1d0){return{'model':db[_0x22f1d0['model']],'as':_0x22f1d0['as'],'attributes':_0x22f1d0[_0xb812('0x20')],'include':_0x22f1d0[_0xb812('0x22')]?_[_0xb812('0x23')](_0x22f1d0[_0xb812('0x22')],function(_0x503e35){return{'model':db[_0x503e35[_0xb812('0x24')]],'as':_0x503e35['as'],'attributes':_0x503e35[_0xb812('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18df6e){logger[_0xb812('0x10')]('ShowFaxQueue',_0x3f5924);logger[_0xb812('0x12')](_0xb812('0x25'),_0x3f5924,JSON[_0xb812('0x14')](_0x18df6e));_0x2a0ce5(_0x18df6e);})[_0xb812('0x19')](function(_0x233cac){logger[_0xb812('0x15')](_0xb812('0x25'),_0x233cac['message'],_0x3f5924);_0x2366c0(_0x2cdbb4['error'](0x1f4,_0x233cac['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index fa82d23..e14b7b4 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 _0x2692=['remove','update','removeListener','length','faxQueue:','save'];(function(_0x39edc2,_0x15dbd7){var _0x201c43=function(_0xc1ecfd){while(--_0xc1ecfd){_0x39edc2['push'](_0x39edc2['shift']());}};_0x201c43(++_0x15dbd7);}(_0x2692,0x1b5));var _0x2269=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x2692[_0x4b7895];return _0x264180;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x2269('0x0'),_0x2269('0x1'),_0x2269('0x2')];function createListener(_0x3b73f4,_0x2fd6b4){return function(_0x376360){_0x2fd6b4['emit'](_0x3b73f4,_0x376360);};}function removeListener(_0x450092,_0x1d784b){return function(){FaxQueueEvents[_0x2269('0x3')](_0x450092,_0x1d784b);};}exports['register']=function(_0x4ec970){for(var _0x26241b=0x0,_0x4c4da6=events[_0x2269('0x4')];_0x26241b<_0x4c4da6;_0x26241b++){var _0xacf538=events[_0x26241b];var _0x3cc428=createListener(_0x2269('0x5')+_0xacf538,_0x4ec970);FaxQueueEvents['on'](_0xacf538,_0x3cc428);}}; \ No newline at end of file +var _0x8df6=['length','faxQueue:','./faxQueue.events','remove','update','emit','register'];(function(_0x194ecf,_0x2f04fc){var _0x5341c6=function(_0x400b04){while(--_0x400b04){_0x194ecf['push'](_0x194ecf['shift']());}};_0x5341c6(++_0x2f04fc);}(_0x8df6,0x191));var _0x68df=function(_0xeff6d9,_0x364b67){_0xeff6d9=_0xeff6d9-0x0;var _0x733943=_0x8df6[_0xeff6d9];return _0x733943;};'use strict';var FaxQueueEvents=require(_0x68df('0x0'));var events=['save',_0x68df('0x1'),_0x68df('0x2')];function createListener(_0x508194,_0x3a85e1){return function(_0x5adc52){_0x3a85e1[_0x68df('0x3')](_0x508194,_0x5adc52);};}function removeListener(_0x403d31,_0x56d0b){return function(){FaxQueueEvents['removeListener'](_0x403d31,_0x56d0b);};}exports[_0x68df('0x4')]=function(_0x3bf872){for(var _0x3e08a1=0x0,_0x3830ff=events[_0x68df('0x5')];_0x3e08a1<_0x3830ff;_0x3e08a1++){var _0x3d0a58=events[_0x3e08a1];var _0x2402f9=createListener(_0x68df('0x6')+_0x3d0a58,_0x3bf872);FaxQueueEvents['on'](_0x3d0a58,_0x2402f9);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index b7dd35a..de1632c 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 _0x5731=['../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','/:id','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x404eed,_0x5390c5){var _0xd45887=function(_0x1ee42b){while(--_0x1ee42b){_0x404eed['push'](_0x404eed['shift']());}};_0xd45887(++_0x5390c5);}(_0x5731,0x1c5));var _0x1573=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5731[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x1573('0x0'));var util=require(_0x1573('0x1'));var path=require(_0x1573('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1573('0x3')]();var auth=require(_0x1573('0x4'));var interaction=require(_0x1573('0x5'));var config=require(_0x1573('0x6'));var controller=require(_0x1573('0x7'));router[_0x1573('0x8')]('/',auth[_0x1573('0x9')](),controller[_0x1573('0xa')]);router[_0x1573('0x8')](_0x1573('0xb'),auth[_0x1573('0x9')](),controller[_0x1573('0xc')]);router[_0x1573('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1573('0xd')]);router[_0x1573('0x8')](_0x1573('0xe'),auth[_0x1573('0x9')](),controller[_0x1573('0xf')]);router[_0x1573('0x8')](_0x1573('0x10'),auth[_0x1573('0x9')](),controller['getTeams']);router[_0x1573('0x8')](_0x1573('0x11'),auth[_0x1573('0x9')](),controller[_0x1573('0x12')]);router[_0x1573('0x13')]('/',auth[_0x1573('0x9')](),controller[_0x1573('0x14')]);router[_0x1573('0x13')](_0x1573('0x10'),auth[_0x1573('0x9')](),controller[_0x1573('0x15')]);router[_0x1573('0x13')](_0x1573('0x11'),auth[_0x1573('0x9')](),controller['addAgents']);router[_0x1573('0x16')](_0x1573('0x17'),auth['isAuthenticated'](),controller['update']);router[_0x1573('0x18')](_0x1573('0x17'),auth[_0x1573('0x9')](),controller[_0x1573('0x19')]);router[_0x1573('0x18')](_0x1573('0x10'),auth[_0x1573('0x9')](),controller['removeTeams']);router[_0x1573('0x18')](_0x1573('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1573('0x1a')]=router; \ No newline at end of file +var _0x4f61=['./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','create','/:id/teams','addAgents','put','update','delete','destroy','removeTeams','multer','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x4f61,0x149));var _0x14f6=function(_0x52a7d0,_0x3bb98f){_0x52a7d0=_0x52a7d0-0x0;var _0x3a2f7c=_0x4f61[_0x52a7d0];return _0x3a2f7c;};'use strict';var multer=require(_0x14f6('0x0'));var util=require(_0x14f6('0x1'));var path=require(_0x14f6('0x2'));var timeout=require('connect-timeout');var express=require(_0x14f6('0x3'));var router=express[_0x14f6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x14f6('0x5'));var config=require(_0x14f6('0x6'));var controller=require(_0x14f6('0x7'));router[_0x14f6('0x8')]('/',auth[_0x14f6('0x9')](),controller[_0x14f6('0xa')]);router['get'](_0x14f6('0xb'),auth[_0x14f6('0x9')](),controller[_0x14f6('0xc')]);router[_0x14f6('0x8')](_0x14f6('0xd'),auth['isAuthenticated'](),controller[_0x14f6('0xe')]);router[_0x14f6('0x8')](_0x14f6('0xf'),auth['isAuthenticated'](),controller[_0x14f6('0x10')]);router[_0x14f6('0x8')]('/:id/teams',auth[_0x14f6('0x9')](),controller[_0x14f6('0x11')]);router[_0x14f6('0x8')](_0x14f6('0x12'),auth[_0x14f6('0x9')](),controller['getAgents']);router[_0x14f6('0x13')]('/',auth[_0x14f6('0x9')](),controller[_0x14f6('0x14')]);router[_0x14f6('0x13')](_0x14f6('0x15'),auth[_0x14f6('0x9')](),controller['addTeams']);router[_0x14f6('0x13')](_0x14f6('0x12'),auth['isAuthenticated'](),controller[_0x14f6('0x16')]);router[_0x14f6('0x17')](_0x14f6('0xd'),auth[_0x14f6('0x9')](),controller[_0x14f6('0x18')]);router[_0x14f6('0x19')](_0x14f6('0xd'),auth[_0x14f6('0x9')](),controller[_0x14f6('0x1a')]);router[_0x14f6('0x19')](_0x14f6('0x15'),auth['isAuthenticated'](),controller[_0x14f6('0x1b')]);router[_0x14f6('0x19')](_0x14f6('0x12'),auth[_0x14f6('0x9')](),controller['removeAgents']);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 8f211f9..10d99be 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 _0x7092=['STRING','DATE','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7092,0x182));var _0x2709=function(_0x2224f7,_0x6e495b){_0x2224f7=_0x2224f7-0x0;var _0x446316=_0x7092[_0x2224f7];return _0x446316;};'use strict';var moment=require('moment');var Sequelize=require(_0x2709('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x2709('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x2709('0x1')]},'joinAt':{'type':Sequelize[_0x2709('0x2')]},'leaveAt':{'type':Sequelize[_0x2709('0x2')]},'acceptAt':{'type':Sequelize[_0x2709('0x2')]},'exitAt':{'type':Sequelize[_0x2709('0x2')]},'reason':{'type':Sequelize[_0x2709('0x1')]}}; \ No newline at end of file +var _0x3db7=['STRING','DATE','moment','sequelize','exports'];(function(_0x236cdf,_0x21a3aa){var _0x4b1841=function(_0x490deb){while(--_0x490deb){_0x236cdf['push'](_0x236cdf['shift']());}};_0x4b1841(++_0x21a3aa);}(_0x3db7,0x13d));var _0x73db=function(_0x59b80f,_0xd5b4f1){_0x59b80f=_0x59b80f-0x0;var _0x1652aa=_0x3db7[_0x59b80f];return _0x1652aa;};'use strict';var moment=require(_0x73db('0x0'));var Sequelize=require(_0x73db('0x1'));module[_0x73db('0x2')]={'uniqueid':{'type':Sequelize[_0x73db('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x73db('0x3')]},'joinAt':{'type':Sequelize[_0x73db('0x4')]},'leaveAt':{'type':Sequelize[_0x73db('0x4')]},'acceptAt':{'type':Sequelize[_0x73db('0x4')]},'exitAt':{'type':Sequelize[_0x73db('0x4')]},'reason':{'type':Sequelize[_0x73db('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8cf87c4..8ddd116 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 _0x2bad=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','index','FaxQueueReport','rawAttributes','model','keys','query','intersection'];(function(_0x4af522,_0x4cdd71){var _0xfd2957=function(_0x37d172){while(--_0x37d172){_0x4af522['push'](_0x4af522['shift']());}};_0xfd2957(++_0x4cdd71);}(_0x2bad,0x17a));var _0xd2ba=function(_0x4da3b6,_0x233aff){_0x4da3b6=_0x4da3b6-0x0;var _0x574d38=_0x2bad[_0x4da3b6];return _0x574d38;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd2ba('0x0'));var rimraf=require(_0xd2ba('0x1'));var zipdir=require(_0xd2ba('0x2'));var jsonpatch=require(_0xd2ba('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd2ba('0x4'));var Mustache=require(_0xd2ba('0x5'));var util=require(_0xd2ba('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd2ba('0x7'));var ejs=require(_0xd2ba('0x8'));var fs=require('fs');var _=require(_0xd2ba('0x9'));var squel=require(_0xd2ba('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd2ba('0x7'));var querystring=require(_0xd2ba('0xb'));var Papa=require('papaparse');var authService=require(_0xd2ba('0xc'));var hardwareService=require(_0xd2ba('0xd'));var Redis=require(_0xd2ba('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xd2ba('0xf'))(_0xd2ba('0x10'));var utils=require(_0xd2ba('0x11'));var config=require(_0xd2ba('0x12'));var db=require(_0xd2ba('0x13'))['db'];function respondWithStatusCode(_0x5f1459,_0x6a5c5c){_0x6a5c5c=_0x6a5c5c||0xcc;return function(_0x187c21){if(_0x187c21){return _0x5f1459['sendStatus'](_0x6a5c5c);}return _0x5f1459[_0xd2ba('0x14')](_0x6a5c5c)[_0xd2ba('0x15')]();};}function respondWithResult(_0x850096,_0x449c67){_0x449c67=_0x449c67||0xc8;return function(_0x3b261e){if(_0x3b261e){return _0x850096[_0xd2ba('0x14')](_0x449c67)[_0xd2ba('0x16')](_0x3b261e);}};}function respondWithFilteredResult(_0x19971f,_0x29f71c){return function(_0x45addf){if(_0x45addf){var _0x54727b=_0x45addf[_0xd2ba('0x17')],_0x1b6123=_0x29f71c['offset'],_0x1bd065=_0x29f71c[_0xd2ba('0x18')]+_0x29f71c[_0xd2ba('0x19')],_0x2392f9;if(_0x1bd065>=_0x54727b){_0x1bd065=_0x54727b;_0x2392f9=0xc8;}else{_0x2392f9=0xce;}_0x19971f[_0xd2ba('0x14')](_0x2392f9);return _0x19971f[_0xd2ba('0x1a')](_0xd2ba('0x1b'),_0x1b6123+'-'+_0x1bd065+'/'+_0x54727b)['json'](_0x45addf);}return null;};}function patchUpdates(_0x4b4bca){return function(_0x54d9cc){try{jsonpatch[_0xd2ba('0x1c')](_0x54d9cc,_0x4b4bca,!![]);}catch(_0x4592df){return BPromise['reject'](_0x4592df);}return _0x54d9cc['save']();};}function saveUpdates(_0x2115f3,_0x3b7154){return function(_0x1d14b4){if(_0x1d14b4){return _0x1d14b4[_0xd2ba('0x1d')](_0x2115f3)[_0xd2ba('0x1e')](function(_0x276bea){return _0x276bea;});}return null;};}function removeEntity(_0x2b8d12,_0x19ed85){return function(_0x6dfcf2){if(_0x6dfcf2){return _0x6dfcf2[_0xd2ba('0x1f')]()['then'](function(){_0x2b8d12[_0xd2ba('0x14')](0xcc)[_0xd2ba('0x15')]();});}};}function handleEntityNotFound(_0x266936,_0x560e64){return function(_0x5c5e00){if(!_0x5c5e00){_0x266936[_0xd2ba('0x20')](0x194);}return _0x5c5e00;};}function handleError(_0xff42e7,_0x1f6a03){_0x1f6a03=_0x1f6a03||0x1f4;return function(_0x2a3ab8){logger[_0xd2ba('0x21')](_0x2a3ab8['stack']);if(_0x2a3ab8['name']){delete _0x2a3ab8[_0xd2ba('0x22')];}_0xff42e7[_0xd2ba('0x14')](_0x1f6a03)['send'](_0x2a3ab8);};}exports[_0xd2ba('0x23')]=function(_0x4fee06,_0x325734){var _0x153e23={},_0x29fb6e={},_0x781e3c={'count':0x0,'rows':[]};var _0x215238=db[_0xd2ba('0x24')][_0xd2ba('0x25')];_0x29fb6e[_0xd2ba('0x26')]=_[_0xd2ba('0x27')](_0x215238);_0x29fb6e['query']=_[_0xd2ba('0x27')](_0x4fee06[_0xd2ba('0x28')]);_0x29fb6e['filters']=_[_0xd2ba('0x29')](_0x29fb6e[_0xd2ba('0x26')],_0x29fb6e[_0xd2ba('0x28')]);_0x153e23[_0xd2ba('0x2a')]=_[_0xd2ba('0x29')](_0x29fb6e[_0xd2ba('0x26')],qs['fields'](_0x4fee06['query'][_0xd2ba('0x2b')]));_0x153e23[_0xd2ba('0x2a')]=_0x153e23[_0xd2ba('0x2a')][_0xd2ba('0x2c')]?_0x153e23[_0xd2ba('0x2a')]:_0x29fb6e['model'];if(!_0x4fee06['query'][_0xd2ba('0x2d')](_0xd2ba('0x2e'))){_0x153e23[_0xd2ba('0x19')]=qs[_0xd2ba('0x19')](_0x4fee06['query']['limit']);_0x153e23[_0xd2ba('0x18')]=qs[_0xd2ba('0x18')](_0x4fee06[_0xd2ba('0x28')]['offset']);}_0x153e23['order']=qs['sort'](_0x4fee06[_0xd2ba('0x28')][_0xd2ba('0x2f')]);_0x153e23[_0xd2ba('0x30')]=qs[_0xd2ba('0x31')](_[_0xd2ba('0x32')](_0x4fee06[_0xd2ba('0x28')],_0x29fb6e[_0xd2ba('0x31')]));if(_0x4fee06['query'][_0xd2ba('0x33')]){_0x153e23[_0xd2ba('0x30')]=_[_0xd2ba('0x34')](_0x153e23[_0xd2ba('0x30')],{'$or':_[_0xd2ba('0x35')](_0x215238,function(_0x233e28){if(_0x233e28[_0xd2ba('0x36')][_0xd2ba('0x37')]!==_0xd2ba('0x38')){var _0x503504={};_0x503504[_0x233e28[_0xd2ba('0x39')]]={'$like':'%'+_0x4fee06['query'][_0xd2ba('0x33')]+'%'};return _0x503504;}})});}_0x153e23=_[_0xd2ba('0x34')]({},_0x153e23,_0x4fee06[_0xd2ba('0x3a')]);var _0x1b31b8={'where':_0x153e23[_0xd2ba('0x30')]};return db[_0xd2ba('0x24')][_0xd2ba('0x17')](_0x1b31b8)[_0xd2ba('0x1e')](function(_0x4daf18){_0x781e3c[_0xd2ba('0x17')]=_0x4daf18;if(_0x4fee06[_0xd2ba('0x28')][_0xd2ba('0x3b')]){_0x153e23['include']=[{'all':!![]}];}return db[_0xd2ba('0x24')][_0xd2ba('0x3c')](_0x153e23);})[_0xd2ba('0x1e')](function(_0x4dc50b){_0x781e3c[_0xd2ba('0x3d')]=_0x4dc50b;return _0x781e3c;})[_0xd2ba('0x1e')](respondWithFilteredResult(_0x325734,_0x153e23))[_0xd2ba('0x3e')](handleError(_0x325734,null));};exports[_0xd2ba('0x3f')]=function(_0x57cba5,_0x4e5bd6){var _0x392878={'raw':!![],'where':{'id':_0x57cba5[_0xd2ba('0x40')]['id']}},_0xafa98c={};_0xafa98c[_0xd2ba('0x26')]=_[_0xd2ba('0x27')](db[_0xd2ba('0x24')]['rawAttributes']);_0xafa98c[_0xd2ba('0x28')]=_['keys'](_0x57cba5[_0xd2ba('0x28')]);_0xafa98c[_0xd2ba('0x31')]=_[_0xd2ba('0x29')](_0xafa98c[_0xd2ba('0x26')],_0xafa98c[_0xd2ba('0x28')]);_0x392878[_0xd2ba('0x2a')]=_[_0xd2ba('0x29')](_0xafa98c[_0xd2ba('0x26')],qs['fields'](_0x57cba5[_0xd2ba('0x28')]['fields']));_0x392878[_0xd2ba('0x2a')]=_0x392878[_0xd2ba('0x2a')][_0xd2ba('0x2c')]?_0x392878['attributes']:_0xafa98c[_0xd2ba('0x26')];if(_0x57cba5[_0xd2ba('0x28')][_0xd2ba('0x3b')]){_0x392878[_0xd2ba('0x41')]=[{'all':!![]}];}_0x392878=_[_0xd2ba('0x34')]({},_0x392878,_0x57cba5[_0xd2ba('0x3a')]);return db[_0xd2ba('0x24')]['find'](_0x392878)[_0xd2ba('0x1e')](handleEntityNotFound(_0x4e5bd6,null))[_0xd2ba('0x1e')](respondWithResult(_0x4e5bd6,null))[_0xd2ba('0x3e')](handleError(_0x4e5bd6,null));};exports[_0xd2ba('0x42')]=function(_0x2a0e46,_0x3d8fe9){return db[_0xd2ba('0x24')]['create'](_0x2a0e46[_0xd2ba('0x43')],{})['then'](respondWithResult(_0x3d8fe9,0xc9))[_0xd2ba('0x3e')](handleError(_0x3d8fe9,null));};exports['update']=function(_0x3fd342,_0x538695){if(_0x3fd342[_0xd2ba('0x43')]['id']){delete _0x3fd342[_0xd2ba('0x43')]['id'];}return db[_0xd2ba('0x24')]['find']({'where':{'id':_0x3fd342[_0xd2ba('0x40')]['id']}})[_0xd2ba('0x1e')](handleEntityNotFound(_0x538695,null))[_0xd2ba('0x1e')](saveUpdates(_0x3fd342[_0xd2ba('0x43')],null))[_0xd2ba('0x1e')](respondWithResult(_0x538695,null))[_0xd2ba('0x3e')](handleError(_0x538695,null));};exports[_0xd2ba('0x1f')]=function(_0x50a1fb,_0x1c1760){return db['FaxQueueReport'][_0xd2ba('0x44')]({'where':{'id':_0x50a1fb[_0xd2ba('0x40')]['id']}})[_0xd2ba('0x1e')](handleEntityNotFound(_0x1c1760,null))[_0xd2ba('0x1e')](removeEntity(_0x1c1760,null))['catch'](handleError(_0x1c1760,null));};exports['describe']=function(_0x2bafcc,_0x54995a){return db['FaxQueueReport'][_0xd2ba('0x45')]()['then'](respondWithResult(_0x54995a,null))['catch'](handleError(_0x54995a,null));}; \ No newline at end of file +var _0xf0a2=['save','update','then','error','stack','name','send','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','FaxQueueReport','count','findAll','rows','show','params','rawAttributes','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','apply','reject'];(function(_0x3a6e34,_0x1e0341){var _0x5094f6=function(_0x35b5bb){while(--_0x35b5bb){_0x3a6e34['push'](_0x3a6e34['shift']());}};_0x5094f6(++_0x1e0341);}(_0xf0a2,0x74));var _0x2f0a=function(_0x4a50c3,_0x4a3157){_0x4a50c3=_0x4a50c3-0x0;var _0x514985=_0xf0a2[_0x4a50c3];return _0x514985;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2f0a('0x0'));var rimraf=require(_0x2f0a('0x1'));var zipdir=require(_0x2f0a('0x2'));var jsonpatch=require(_0x2f0a('0x3'));var rp=require(_0x2f0a('0x4'));var moment=require(_0x2f0a('0x5'));var BPromise=require(_0x2f0a('0x6'));var Mustache=require(_0x2f0a('0x7'));var util=require(_0x2f0a('0x8'));var path=require(_0x2f0a('0x9'));var sox=require(_0x2f0a('0xa'));var csv=require(_0x2f0a('0xb'));var ejs=require(_0x2f0a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2f0a('0xd'));var crypto=require(_0x2f0a('0xe'));var jsforce=require(_0x2f0a('0xf'));var deskjs=require(_0x2f0a('0x10'));var toCsv=require(_0x2f0a('0xb'));var querystring=require('querystring');var Papa=require(_0x2f0a('0x11'));var authService=require(_0x2f0a('0x12'));var hardwareService=require(_0x2f0a('0x13'));var Redis=require('ioredis');var qs=require(_0x2f0a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2f0a('0x15'));var config=require(_0x2f0a('0x16'));var db=require(_0x2f0a('0x17'))['db'];function respondWithStatusCode(_0x15aae9,_0x22b4cf){_0x22b4cf=_0x22b4cf||0xcc;return function(_0x290207){if(_0x290207){return _0x15aae9[_0x2f0a('0x18')](_0x22b4cf);}return _0x15aae9['status'](_0x22b4cf)[_0x2f0a('0x19')]();};}function respondWithResult(_0x187a6c,_0x39c73d){_0x39c73d=_0x39c73d||0xc8;return function(_0x109689){if(_0x109689){return _0x187a6c[_0x2f0a('0x1a')](_0x39c73d)[_0x2f0a('0x1b')](_0x109689);}};}function respondWithFilteredResult(_0xfc0cf0,_0x40effc){return function(_0x2a418b){if(_0x2a418b){var _0x1a7607=_0x2a418b['count'],_0x193e81=_0x40effc[_0x2f0a('0x1c')],_0x1a0ac0=_0x40effc[_0x2f0a('0x1c')]+_0x40effc[_0x2f0a('0x1d')],_0x9cfd72;if(_0x1a0ac0>=_0x1a7607){_0x1a0ac0=_0x1a7607;_0x9cfd72=0xc8;}else{_0x9cfd72=0xce;}_0xfc0cf0[_0x2f0a('0x1a')](_0x9cfd72);return _0xfc0cf0['set']('Content-Range',_0x193e81+'-'+_0x1a0ac0+'/'+_0x1a7607)[_0x2f0a('0x1b')](_0x2a418b);}return null;};}function patchUpdates(_0x4a114b){return function(_0x60f1ee){try{jsonpatch[_0x2f0a('0x1e')](_0x60f1ee,_0x4a114b,!![]);}catch(_0x16618b){return BPromise[_0x2f0a('0x1f')](_0x16618b);}return _0x60f1ee[_0x2f0a('0x20')]();};}function saveUpdates(_0x19966f,_0x3426ed){return function(_0x508c80){if(_0x508c80){return _0x508c80[_0x2f0a('0x21')](_0x19966f)['then'](function(_0x4662fa){return _0x4662fa;});}return null;};}function removeEntity(_0x35f414,_0x1c6fb1){return function(_0x5cdf2b){if(_0x5cdf2b){return _0x5cdf2b['destroy']()[_0x2f0a('0x22')](function(){_0x35f414[_0x2f0a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27857f,_0x4513eb){return function(_0x520e53){if(!_0x520e53){_0x27857f[_0x2f0a('0x18')](0x194);}return _0x520e53;};}function handleError(_0x4890f3,_0x1a9120){_0x1a9120=_0x1a9120||0x1f4;return function(_0xdb0921){logger[_0x2f0a('0x23')](_0xdb0921[_0x2f0a('0x24')]);if(_0xdb0921[_0x2f0a('0x25')]){delete _0xdb0921[_0x2f0a('0x25')];}_0x4890f3[_0x2f0a('0x1a')](_0x1a9120)[_0x2f0a('0x26')](_0xdb0921);};}exports['index']=function(_0x4faf82,_0xe17b36){var _0x12d2ec={},_0x42ce5a={},_0x5e6014={'count':0x0,'rows':[]};var _0x10a2c3=db['FaxQueueReport']['rawAttributes'];_0x42ce5a[_0x2f0a('0x27')]=_[_0x2f0a('0x28')](_0x10a2c3);_0x42ce5a[_0x2f0a('0x29')]=_['keys'](_0x4faf82['query']);_0x42ce5a['filters']=_[_0x2f0a('0x2a')](_0x42ce5a['model'],_0x42ce5a[_0x2f0a('0x29')]);_0x12d2ec[_0x2f0a('0x2b')]=_[_0x2f0a('0x2a')](_0x42ce5a['model'],qs[_0x2f0a('0x2c')](_0x4faf82[_0x2f0a('0x29')][_0x2f0a('0x2c')]));_0x12d2ec[_0x2f0a('0x2b')]=_0x12d2ec[_0x2f0a('0x2b')][_0x2f0a('0x2d')]?_0x12d2ec[_0x2f0a('0x2b')]:_0x42ce5a[_0x2f0a('0x27')];if(!_0x4faf82[_0x2f0a('0x29')][_0x2f0a('0x2e')](_0x2f0a('0x2f'))){_0x12d2ec[_0x2f0a('0x1d')]=qs[_0x2f0a('0x1d')](_0x4faf82['query'][_0x2f0a('0x1d')]);_0x12d2ec[_0x2f0a('0x1c')]=qs['offset'](_0x4faf82[_0x2f0a('0x29')][_0x2f0a('0x1c')]);}_0x12d2ec[_0x2f0a('0x30')]=qs[_0x2f0a('0x31')](_0x4faf82[_0x2f0a('0x29')]['sort']);_0x12d2ec['where']=qs[_0x2f0a('0x32')](_[_0x2f0a('0x33')](_0x4faf82[_0x2f0a('0x29')],_0x42ce5a[_0x2f0a('0x32')]));if(_0x4faf82[_0x2f0a('0x29')][_0x2f0a('0x34')]){_0x12d2ec[_0x2f0a('0x35')]=_[_0x2f0a('0x36')](_0x12d2ec[_0x2f0a('0x35')],{'$or':_[_0x2f0a('0x37')](_0x10a2c3,function(_0x343400){if(_0x343400[_0x2f0a('0x38')][_0x2f0a('0x39')]!==_0x2f0a('0x3a')){var _0xd6e65d={};_0xd6e65d[_0x343400[_0x2f0a('0x3b')]]={'$like':'%'+_0x4faf82[_0x2f0a('0x29')][_0x2f0a('0x34')]+'%'};return _0xd6e65d;}})});}_0x12d2ec=_[_0x2f0a('0x36')]({},_0x12d2ec,_0x4faf82[_0x2f0a('0x3c')]);var _0x521562={'where':_0x12d2ec['where']};return db[_0x2f0a('0x3d')][_0x2f0a('0x3e')](_0x521562)[_0x2f0a('0x22')](function(_0x406f4a){_0x5e6014[_0x2f0a('0x3e')]=_0x406f4a;if(_0x4faf82[_0x2f0a('0x29')]['includeAll']){_0x12d2ec['include']=[{'all':!![]}];}return db[_0x2f0a('0x3d')][_0x2f0a('0x3f')](_0x12d2ec);})[_0x2f0a('0x22')](function(_0x18f259){_0x5e6014[_0x2f0a('0x40')]=_0x18f259;return _0x5e6014;})[_0x2f0a('0x22')](respondWithFilteredResult(_0xe17b36,_0x12d2ec))['catch'](handleError(_0xe17b36,null));};exports[_0x2f0a('0x41')]=function(_0x27c1cd,_0x168b61){var _0x53d650={'raw':!![],'where':{'id':_0x27c1cd[_0x2f0a('0x42')]['id']}},_0xc7ec15={};_0xc7ec15[_0x2f0a('0x27')]=_[_0x2f0a('0x28')](db[_0x2f0a('0x3d')][_0x2f0a('0x43')]);_0xc7ec15[_0x2f0a('0x29')]=_[_0x2f0a('0x28')](_0x27c1cd[_0x2f0a('0x29')]);_0xc7ec15[_0x2f0a('0x32')]=_[_0x2f0a('0x2a')](_0xc7ec15[_0x2f0a('0x27')],_0xc7ec15['query']);_0x53d650[_0x2f0a('0x2b')]=_[_0x2f0a('0x2a')](_0xc7ec15[_0x2f0a('0x27')],qs['fields'](_0x27c1cd[_0x2f0a('0x29')][_0x2f0a('0x2c')]));_0x53d650[_0x2f0a('0x2b')]=_0x53d650[_0x2f0a('0x2b')][_0x2f0a('0x2d')]?_0x53d650['attributes']:_0xc7ec15[_0x2f0a('0x27')];if(_0x27c1cd[_0x2f0a('0x29')]['includeAll']){_0x53d650['include']=[{'all':!![]}];}_0x53d650=_[_0x2f0a('0x36')]({},_0x53d650,_0x27c1cd['options']);return db[_0x2f0a('0x3d')]['find'](_0x53d650)[_0x2f0a('0x22')](handleEntityNotFound(_0x168b61,null))[_0x2f0a('0x22')](respondWithResult(_0x168b61,null))[_0x2f0a('0x44')](handleError(_0x168b61,null));};exports[_0x2f0a('0x45')]=function(_0x21c2d0,_0x4fb866){return db[_0x2f0a('0x3d')][_0x2f0a('0x45')](_0x21c2d0[_0x2f0a('0x46')],{})[_0x2f0a('0x22')](respondWithResult(_0x4fb866,0xc9))[_0x2f0a('0x44')](handleError(_0x4fb866,null));};exports['update']=function(_0x5eb062,_0xdaa6be){if(_0x5eb062[_0x2f0a('0x46')]['id']){delete _0x5eb062[_0x2f0a('0x46')]['id'];}return db[_0x2f0a('0x3d')][_0x2f0a('0x47')]({'where':{'id':_0x5eb062[_0x2f0a('0x42')]['id']}})[_0x2f0a('0x22')](handleEntityNotFound(_0xdaa6be,null))[_0x2f0a('0x22')](saveUpdates(_0x5eb062[_0x2f0a('0x46')],null))[_0x2f0a('0x22')](respondWithResult(_0xdaa6be,null))['catch'](handleError(_0xdaa6be,null));};exports[_0x2f0a('0x48')]=function(_0x113efb,_0xd36db9){return db['FaxQueueReport'][_0x2f0a('0x47')]({'where':{'id':_0x113efb[_0x2f0a('0x42')]['id']}})[_0x2f0a('0x22')](handleEntityNotFound(_0xd36db9,null))[_0x2f0a('0x22')](removeEntity(_0xd36db9,null))[_0x2f0a('0x44')](handleError(_0xd36db9,null));};exports[_0x2f0a('0x49')]=function(_0x530c0e,_0x295506){return db['FaxQueueReport'][_0x2f0a('0x49')]()[_0x2f0a('0x22')](respondWithResult(_0x295506,null))[_0x2f0a('0x44')](handleError(_0x295506,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a66da71..5771a0d 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 _0xde59=['api','bluebird','exports','FaxQueueReport','report_fax_queue','uniqueid','util'];(function(_0x2e8c50,_0x4c2514){var _0x33099c=function(_0x5a6cb3){while(--_0x5a6cb3){_0x2e8c50['push'](_0x2e8c50['shift']());}};_0x33099c(++_0x4c2514);}(_0xde59,0x1e9));var _0x9de5=function(_0x323b6e,_0x2befbe){_0x323b6e=_0x323b6e-0x0;var _0x1a7461=_0xde59[_0x323b6e];return _0x1a7461;};'use strict';var _=require('lodash');var util=require(_0x9de5('0x0'));var logger=require('../../config/logger')(_0x9de5('0x1'));var moment=require('moment');var BPromise=require(_0x9de5('0x2'));var rp=require('request-promise');var attributes=require('./faxQueueReport.attributes');module[_0x9de5('0x3')]=function(_0x154386,_0x468ab4){return _0x154386['define'](_0x9de5('0x4'),attributes,{'tableName':_0x9de5('0x5'),'paranoid':![],'indexes':[{'name':_0x9de5('0x6'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xee62=['FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','./faxQueueReport.attributes','exports','define'];(function(_0xc0ed67,_0xbd4503){var _0x55369d=function(_0x6025d2){while(--_0x6025d2){_0xc0ed67['push'](_0xc0ed67['shift']());}};_0x55369d(++_0xbd4503);}(_0xee62,0x93));var _0x2ee6=function(_0x3706af,_0x3aac8b){_0x3706af=_0x3706af-0x0;var _0x12b893=_0xee62[_0x3706af];return _0x12b893;};'use strict';var _=require(_0x2ee6('0x0'));var util=require('util');var logger=require(_0x2ee6('0x1'))(_0x2ee6('0x2'));var moment=require(_0x2ee6('0x3'));var BPromise=require(_0x2ee6('0x4'));var rp=require(_0x2ee6('0x5'));var attributes=require(_0x2ee6('0x6'));module[_0x2ee6('0x7')]=function(_0x4dc7ef,_0x562d6c){return _0x4dc7ef[_0x2ee6('0x8')](_0x2ee6('0x9'),attributes,{'tableName':_0x2ee6('0xa'),'paranoid':![],'indexes':[{'name':_0x2ee6('0xb'),'fields':[_0x2ee6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index e9c5d7b..60df41e 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 _0x56bd=['limit','info','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','where'];(function(_0x37a3e4,_0x278475){var _0x3f1d62=function(_0x62645e){while(--_0x62645e){_0x37a3e4['push'](_0x37a3e4['shift']());}};_0x3f1d62(++_0x278475);}(_0x56bd,0xe9));var _0xd56b=function(_0x384e7c,_0x384a28){_0x384e7c=_0x384e7c-0x0;var _0x3c3292=_0x56bd[_0x384e7c];return _0x3c3292;};'use strict';var _=require('lodash');var util=require(_0xd56b('0x0'));var moment=require(_0xd56b('0x1'));var BPromise=require(_0xd56b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd56b('0x3'));var db=require(_0xd56b('0x4'))['db'];var utils=require(_0xd56b('0x5'));var logger=require(_0xd56b('0x6'))('rpc');var config=require(_0xd56b('0x7'));var jayson=require(_0xd56b('0x8'));var client=jayson[_0xd56b('0x9')][_0xd56b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17864e,_0x442791,_0x20d1b1){return new BPromise(function(_0x50ad75,_0x670d9b){return client[_0xd56b('0xb')](_0x17864e,_0x20d1b1)[_0xd56b('0xc')](function(_0x13447e){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x442791,_0xd56b('0xd'));logger[_0xd56b('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x442791,_0xd56b('0xd'),JSON[_0xd56b('0xf')](_0x13447e));if(_0x13447e[_0xd56b('0x10')]){if(_0x13447e[_0xd56b('0x10')][_0xd56b('0x11')]===0x1f4){logger[_0xd56b('0x10')](_0xd56b('0x12'),_0x442791,_0x13447e[_0xd56b('0x10')][_0xd56b('0x13')]);return _0x670d9b(_0x13447e[_0xd56b('0x10')][_0xd56b('0x13')]);}logger[_0xd56b('0x10')](_0xd56b('0x12'),_0x442791,_0x13447e[_0xd56b('0x10')][_0xd56b('0x13')]);return _0x50ad75(_0x13447e['error'][_0xd56b('0x13')]);}else{logger['info'](_0xd56b('0x12'),_0x442791,_0xd56b('0xd'));_0x50ad75(_0x13447e[_0xd56b('0x14')][_0xd56b('0x13')]);}})[_0xd56b('0x15')](function(_0x472e7e){logger[_0xd56b('0x10')](_0xd56b('0x12'),_0x442791,_0x472e7e);_0x670d9b(_0x472e7e);});});}exports[_0xd56b('0x16')]=function(_0x180a1d){var _0x147e48=this;return new Promise(function(_0x5f3ea8,_0x5370df){return db['FaxQueueReport'][_0xd56b('0x17')](_0x180a1d[_0xd56b('0x18')],{'raw':_0x180a1d[_0xd56b('0x19')]?_0x180a1d[_0xd56b('0x19')][_0xd56b('0x1a')]===undefined?!![]:![]:!![]})[_0xd56b('0xc')](function(_0x477212){logger['info'](_0xd56b('0x16'),_0x180a1d);logger[_0xd56b('0xe')](_0xd56b('0x16'),_0x180a1d,JSON[_0xd56b('0xf')](_0x477212));_0x5f3ea8(_0x477212);})[_0xd56b('0x15')](function(_0x32160b){logger['error']('CreateFaxQueueReport',_0x32160b[_0xd56b('0x13')],_0x180a1d);_0x5370df(_0x147e48[_0xd56b('0x10')](0x1f4,_0x32160b['message']));});});};exports[_0xd56b('0x1b')]=function(_0x5c9cfe){var _0xdaf42a=this;return new Promise(function(_0x543aaf,_0xc9027d){return db[_0xd56b('0x1c')][_0xd56b('0x1d')](_0x5c9cfe['body'],{'raw':_0x5c9cfe[_0xd56b('0x19')]?_0x5c9cfe[_0xd56b('0x19')][_0xd56b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c9cfe[_0xd56b('0x19')]?_0x5c9cfe[_0xd56b('0x19')][_0xd56b('0x1e')]||null:null,'attributes':_0x5c9cfe[_0xd56b('0x19')]?_0x5c9cfe['options']['attributes']||null:null,'limit':_0x5c9cfe[_0xd56b('0x19')]?_0x5c9cfe[_0xd56b('0x19')][_0xd56b('0x1f')]||null:null})[_0xd56b('0xc')](function(_0x45a45d){logger[_0xd56b('0x20')](_0xd56b('0x1b'),_0x5c9cfe);logger[_0xd56b('0xe')](_0xd56b('0x1b'),_0x5c9cfe,JSON[_0xd56b('0xf')](_0x45a45d));_0x543aaf(_0x45a45d);})[_0xd56b('0x15')](function(_0x8737b4){logger['error']('UpdateFaxQueueReport',_0x8737b4[_0xd56b('0x13')],_0x5c9cfe);_0xc9027d(_0xdaf42a['error'](0x1f4,_0x8737b4['message']));});});}; \ No newline at end of file +var _0x84a0=['FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch'];(function(_0x1b8f52,_0x111226){var _0x17c536=function(_0x3cbea5){while(--_0x3cbea5){_0x1b8f52['push'](_0x1b8f52['shift']());}};_0x17c536(++_0x111226);}(_0x84a0,0x66));var _0x084a=function(_0xdb50de,_0x3d968b){_0xdb50de=_0xdb50de-0x0;var _0x2747e5=_0x84a0[_0xdb50de];return _0x2747e5;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e6810,_0x373d2,_0x2b30bc){return new BPromise(function(_0x58d419,_0x1051a9){return client[_0x084a('0xa')](_0x2e6810,_0x2b30bc)[_0x084a('0xb')](function(_0x2888e3){logger[_0x084a('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x373d2,'request\x20sent');logger[_0x084a('0xd')](_0x084a('0xe'),_0x373d2,_0x084a('0xf'),JSON[_0x084a('0x10')](_0x2888e3));if(_0x2888e3[_0x084a('0x11')]){if(_0x2888e3['error']['code']===0x1f4){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);return _0x1051a9(_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);}logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3['error'][_0x084a('0x13')]);return _0x58d419(_0x2888e3['error'][_0x084a('0x13')]);}else{logger[_0x084a('0xc')](_0x084a('0x12'),_0x373d2,_0x084a('0xf'));_0x58d419(_0x2888e3[_0x084a('0x14')]['message']);}})[_0x084a('0x15')](function(_0x4abd81){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x4abd81);_0x1051a9(_0x4abd81);});});}exports['CreateFaxQueueReport']=function(_0xf2c333){var _0x32c729=this;return new Promise(function(_0x4134b9,_0x14bb19){return db[_0x084a('0x16')][_0x084a('0x17')](_0xf2c333[_0x084a('0x18')],{'raw':_0xf2c333[_0x084a('0x19')]?_0xf2c333[_0x084a('0x19')][_0x084a('0x1a')]===undefined?!![]:![]:!![]})[_0x084a('0xb')](function(_0x279e25){logger[_0x084a('0xc')](_0x084a('0x1b'),_0xf2c333);logger[_0x084a('0xd')]('CreateFaxQueueReport',_0xf2c333,JSON[_0x084a('0x10')](_0x279e25));_0x4134b9(_0x279e25);})[_0x084a('0x15')](function(_0x41a90f){logger[_0x084a('0x11')](_0x084a('0x1b'),_0x41a90f['message'],_0xf2c333);_0x14bb19(_0x32c729[_0x084a('0x11')](0x1f4,_0x41a90f[_0x084a('0x13')]));});});};exports[_0x084a('0x1c')]=function(_0x1f2c9f){var _0x18b43d=this;return new Promise(function(_0x3cdc1e,_0x5be167){return db[_0x084a('0x16')][_0x084a('0x1d')](_0x1f2c9f[_0x084a('0x18')],{'raw':_0x1f2c9f['options']?_0x1f2c9f[_0x084a('0x19')][_0x084a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f2c9f[_0x084a('0x19')]?_0x1f2c9f['options']['where']||null:null,'attributes':_0x1f2c9f['options']?_0x1f2c9f['options'][_0x084a('0x1e')]||null:null,'limit':_0x1f2c9f['options']?_0x1f2c9f['options']['limit']||null:null})[_0x084a('0xb')](function(_0x4651e6){logger[_0x084a('0xc')](_0x084a('0x1c'),_0x1f2c9f);logger[_0x084a('0xd')](_0x084a('0x1c'),_0x1f2c9f,JSON[_0x084a('0x10')](_0x4651e6));_0x3cdc1e(_0x4651e6);})[_0x084a('0x15')](function(_0x5e6ea8){logger[_0x084a('0x11')](_0x084a('0x1c'),_0x5e6ea8['message'],_0x1f2c9f);_0x5be167(_0x18b43d[_0x084a('0x11')](0x1f4,_0x5e6ea8[_0x084a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 7dd2805..5039d4c 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 _0x3615=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3615,0x1dd));var _0x5361=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x3615[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x5361('0x0'));var util=require('util');var path=require(_0x5361('0x1'));var timeout=require(_0x5361('0x2'));var express=require('express');var router=express[_0x5361('0x3')]();var auth=require(_0x5361('0x4'));var interaction=require(_0x5361('0x5'));var config=require(_0x5361('0x6'));var controller=require(_0x5361('0x7'));router['get']('/',auth[_0x5361('0x8')](),controller['index']);router[_0x5361('0x9')](_0x5361('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x5361('0x9')](_0x5361('0xb'),auth[_0x5361('0x8')](),controller[_0x5361('0xc')]);router[_0x5361('0xd')]('/',auth[_0x5361('0x8')](),controller[_0x5361('0xe')]);router[_0x5361('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5361('0x10')]);router[_0x5361('0x11')]('/:id',auth[_0x5361('0x8')](),controller[_0x5361('0x12')]);module[_0x5361('0x13')]=router; \ No newline at end of file +var _0x7684=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0x7684,0xed));var _0x4768=function(_0x128f3a,_0x929550){_0x128f3a=_0x128f3a-0x0;var _0x523696=_0x7684[_0x128f3a];return _0x523696;};'use strict';var multer=require(_0x4768('0x0'));var util=require('util');var path=require(_0x4768('0x1'));var timeout=require(_0x4768('0x2'));var express=require('express');var router=express[_0x4768('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4768('0x4'));var config=require(_0x4768('0x5'));var controller=require(_0x4768('0x6'));router[_0x4768('0x7')]('/',auth['isAuthenticated'](),controller[_0x4768('0x8')]);router[_0x4768('0x7')](_0x4768('0x9'),auth[_0x4768('0xa')](),controller[_0x4768('0xb')]);router[_0x4768('0x7')]('/:id',auth[_0x4768('0xa')](),controller[_0x4768('0xc')]);router[_0x4768('0xd')]('/',auth['isAuthenticated'](),controller[_0x4768('0xe')]);router[_0x4768('0xf')](_0x4768('0x10'),auth[_0x4768('0xa')](),controller[_0x4768('0x11')]);router[_0x4768('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4768('0x13')]);module[_0x4768('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 3910a19..41b9026 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 _0xfd24=['DATE','NOW','moment','exports','STRING','ENUM','agent','queue'];(function(_0x440da2,_0x12c541){var _0x1fc6a9=function(_0x22cf14){while(--_0x22cf14){_0x440da2['push'](_0x440da2['shift']());}};_0x1fc6a9(++_0x12c541);}(_0xfd24,0x14a));var _0x4fd2=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xfd24[_0x36ed3c];return _0x52a2e0;};'use strict';var moment=require(_0x4fd2('0x0'));var Sequelize=require('sequelize');module[_0x4fd2('0x1')]={'uniqueid':{'type':Sequelize[_0x4fd2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4fd2('0x3')]('account',_0x4fd2('0x4'),_0x4fd2('0x5')),'allowNull':![],'defaultValue':_0x4fd2('0x5')},'transferredAt':{'type':Sequelize[_0x4fd2('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x4fd2('0x7')]}}; \ No newline at end of file +var _0x4f2b=['queue','DATE','NOW','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x424c74,_0x2169c3){var _0x472aa1=function(_0x3dfdc4){while(--_0x3dfdc4){_0x424c74['push'](_0x424c74['shift']());}};_0x472aa1(++_0x2169c3);}(_0x4f2b,0x147));var _0xb4f2=function(_0x37046f,_0x425f7d){_0x37046f=_0x37046f-0x0;var _0x5c8e77=_0x4f2b[_0x37046f];return _0x5c8e77;};'use strict';var moment=require('moment');var Sequelize=require(_0xb4f2('0x0'));module[_0xb4f2('0x1')]={'uniqueid':{'type':Sequelize[_0xb4f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb4f2('0x3')](_0xb4f2('0x4'),_0xb4f2('0x5'),'queue'),'allowNull':![],'defaultValue':_0xb4f2('0x6')},'transferredAt':{'type':Sequelize[_0xb4f2('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xb4f2('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index d8e66cd..1eece03 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 _0xa631=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','type','field','filter','options','count','includeAll','rows','params','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','FaxTransferReport','rawAttributes','model','keys','filters','intersection','query'];(function(_0x58f5e7,_0x43d9e6){var _0x33ee9d=function(_0xa67cb1){while(--_0xa67cb1){_0x58f5e7['push'](_0x58f5e7['shift']());}};_0x33ee9d(++_0x43d9e6);}(_0xa631,0xe4));var _0x1a63=function(_0x2779dc,_0x5a9d47){_0x2779dc=_0x2779dc-0x0;var _0x2b4685=_0xa631[_0x2779dc];return _0x2b4685;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1a63('0x0'));var rimraf=require(_0x1a63('0x1'));var zipdir=require(_0x1a63('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a63('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a63('0x4'));var util=require(_0x1a63('0x5'));var path=require(_0x1a63('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1a63('0x7'));var crypto=require(_0x1a63('0x8'));var jsforce=require(_0x1a63('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1a63('0xa'));var Papa=require(_0x1a63('0xb'));var authService=require(_0x1a63('0xc'));var hardwareService=require(_0x1a63('0xd'));var Redis=require(_0x1a63('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x1a63('0xf'))(_0x1a63('0x10'));var utils=require(_0x1a63('0x11'));var config=require(_0x1a63('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c7e4f,_0x199c92){_0x199c92=_0x199c92||0xcc;return function(_0x32269d){if(_0x32269d){return _0x1c7e4f['sendStatus'](_0x199c92);}return _0x1c7e4f[_0x1a63('0x13')](_0x199c92)['end']();};}function respondWithResult(_0x169244,_0x4485ea){_0x4485ea=_0x4485ea||0xc8;return function(_0x44bf20){if(_0x44bf20){return _0x169244['status'](_0x4485ea)['json'](_0x44bf20);}};}function respondWithFilteredResult(_0x2bf124,_0x1cd772){return function(_0x436623){if(_0x436623){var _0x3756e2=_0x436623['count'],_0x1c1e8c=_0x1cd772[_0x1a63('0x14')],_0x4d66d4=_0x1cd772[_0x1a63('0x14')]+_0x1cd772[_0x1a63('0x15')],_0x3bf64a;if(_0x4d66d4>=_0x3756e2){_0x4d66d4=_0x3756e2;_0x3bf64a=0xc8;}else{_0x3bf64a=0xce;}_0x2bf124[_0x1a63('0x13')](_0x3bf64a);return _0x2bf124[_0x1a63('0x16')](_0x1a63('0x17'),_0x1c1e8c+'-'+_0x4d66d4+'/'+_0x3756e2)[_0x1a63('0x18')](_0x436623);}return null;};}function patchUpdates(_0x41c13e){return function(_0x3feaa5){try{jsonpatch[_0x1a63('0x19')](_0x3feaa5,_0x41c13e,!![]);}catch(_0x491c8a){return BPromise[_0x1a63('0x1a')](_0x491c8a);}return _0x3feaa5[_0x1a63('0x1b')]();};}function saveUpdates(_0x5d9c00,_0x3d6668){return function(_0x444406){if(_0x444406){return _0x444406[_0x1a63('0x1c')](_0x5d9c00)[_0x1a63('0x1d')](function(_0x24646d){return _0x24646d;});}return null;};}function removeEntity(_0x2a0a4,_0x4f8af5){return function(_0x547d78){if(_0x547d78){return _0x547d78[_0x1a63('0x1e')]()['then'](function(){_0x2a0a4[_0x1a63('0x13')](0xcc)[_0x1a63('0x1f')]();});}};}function handleEntityNotFound(_0x529be7,_0x564f9a){return function(_0x58ff2){if(!_0x58ff2){_0x529be7[_0x1a63('0x20')](0x194);}return _0x58ff2;};}function handleError(_0x6b097c,_0x1827ff){_0x1827ff=_0x1827ff||0x1f4;return function(_0x1a5a18){logger['error'](_0x1a5a18[_0x1a63('0x21')]);if(_0x1a5a18[_0x1a63('0x22')]){delete _0x1a5a18[_0x1a63('0x22')];}_0x6b097c['status'](_0x1827ff)[_0x1a63('0x23')](_0x1a5a18);};}exports[_0x1a63('0x24')]=function(_0x81548f,_0x306dd4){var _0x53867d={},_0x4a7ffc={},_0x339f0d={'count':0x0,'rows':[]};var _0x358dc8=db[_0x1a63('0x25')][_0x1a63('0x26')];_0x4a7ffc[_0x1a63('0x27')]=_[_0x1a63('0x28')](_0x358dc8);_0x4a7ffc['query']=_[_0x1a63('0x28')](_0x81548f['query']);_0x4a7ffc[_0x1a63('0x29')]=_[_0x1a63('0x2a')](_0x4a7ffc['model'],_0x4a7ffc[_0x1a63('0x2b')]);_0x53867d[_0x1a63('0x2c')]=_[_0x1a63('0x2a')](_0x4a7ffc[_0x1a63('0x27')],qs['fields'](_0x81548f['query'][_0x1a63('0x2d')]));_0x53867d[_0x1a63('0x2c')]=_0x53867d['attributes'][_0x1a63('0x2e')]?_0x53867d[_0x1a63('0x2c')]:_0x4a7ffc[_0x1a63('0x27')];if(!_0x81548f[_0x1a63('0x2b')][_0x1a63('0x2f')](_0x1a63('0x30'))){_0x53867d['limit']=qs[_0x1a63('0x15')](_0x81548f[_0x1a63('0x2b')][_0x1a63('0x15')]);_0x53867d[_0x1a63('0x14')]=qs['offset'](_0x81548f['query'][_0x1a63('0x14')]);}_0x53867d['order']=qs[_0x1a63('0x31')](_0x81548f['query'][_0x1a63('0x31')]);_0x53867d[_0x1a63('0x32')]=qs['filters'](_[_0x1a63('0x33')](_0x81548f[_0x1a63('0x2b')],_0x4a7ffc[_0x1a63('0x29')]));if(_0x81548f[_0x1a63('0x2b')]['filter']){_0x53867d[_0x1a63('0x32')]=_[_0x1a63('0x34')](_0x53867d[_0x1a63('0x32')],{'$or':_[_0x1a63('0x35')](_0x358dc8,function(_0x3954a6){if(_0x3954a6[_0x1a63('0x36')]['key']!=='VIRTUAL'){var _0x3fbafe={};_0x3fbafe[_0x3954a6[_0x1a63('0x37')]]={'$like':'%'+_0x81548f[_0x1a63('0x2b')][_0x1a63('0x38')]+'%'};return _0x3fbafe;}})});}_0x53867d=_[_0x1a63('0x34')]({},_0x53867d,_0x81548f[_0x1a63('0x39')]);var _0x5b6b56={'where':_0x53867d[_0x1a63('0x32')]};return db['FaxTransferReport']['count'](_0x5b6b56)['then'](function(_0x49232e){_0x339f0d[_0x1a63('0x3a')]=_0x49232e;if(_0x81548f['query'][_0x1a63('0x3b')]){_0x53867d['include']=[{'all':!![]}];}return db[_0x1a63('0x25')]['findAll'](_0x53867d);})[_0x1a63('0x1d')](function(_0xe9c655){_0x339f0d[_0x1a63('0x3c')]=_0xe9c655;return _0x339f0d;})['then'](respondWithFilteredResult(_0x306dd4,_0x53867d))['catch'](handleError(_0x306dd4,null));};exports['show']=function(_0x51c72f,_0x580573){var _0x361208={'raw':!![],'where':{'id':_0x51c72f[_0x1a63('0x3d')]['id']}},_0x3ac0d9={};_0x3ac0d9['model']=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x3ac0d9['query']=_[_0x1a63('0x28')](_0x51c72f[_0x1a63('0x2b')]);_0x3ac0d9['filters']=_[_0x1a63('0x2a')](_0x3ac0d9['model'],_0x3ac0d9['query']);_0x361208[_0x1a63('0x2c')]=_[_0x1a63('0x2a')](_0x3ac0d9[_0x1a63('0x27')],qs[_0x1a63('0x2d')](_0x51c72f['query'][_0x1a63('0x2d')]));_0x361208[_0x1a63('0x2c')]=_0x361208[_0x1a63('0x2c')][_0x1a63('0x2e')]?_0x361208[_0x1a63('0x2c')]:_0x3ac0d9[_0x1a63('0x27')];if(_0x51c72f[_0x1a63('0x2b')][_0x1a63('0x3b')]){_0x361208[_0x1a63('0x3e')]=[{'all':!![]}];}_0x361208=_[_0x1a63('0x34')]({},_0x361208,_0x51c72f['options']);return db[_0x1a63('0x25')][_0x1a63('0x3f')](_0x361208)[_0x1a63('0x1d')](handleEntityNotFound(_0x580573,null))[_0x1a63('0x1d')](respondWithResult(_0x580573,null))[_0x1a63('0x40')](handleError(_0x580573,null));};exports[_0x1a63('0x41')]=function(_0x32132c,_0x47bbc5){return db[_0x1a63('0x25')][_0x1a63('0x41')](_0x32132c[_0x1a63('0x42')],{})[_0x1a63('0x1d')](respondWithResult(_0x47bbc5,0xc9))[_0x1a63('0x40')](handleError(_0x47bbc5,null));};exports[_0x1a63('0x1c')]=function(_0x1e3620,_0x39b61f){if(_0x1e3620[_0x1a63('0x42')]['id']){delete _0x1e3620[_0x1a63('0x42')]['id'];}return db[_0x1a63('0x25')][_0x1a63('0x3f')]({'where':{'id':_0x1e3620[_0x1a63('0x3d')]['id']}})[_0x1a63('0x1d')](handleEntityNotFound(_0x39b61f,null))[_0x1a63('0x1d')](saveUpdates(_0x1e3620[_0x1a63('0x42')],null))['then'](respondWithResult(_0x39b61f,null))['catch'](handleError(_0x39b61f,null));};exports['destroy']=function(_0x28dd93,_0x1d37ee){return db['FaxTransferReport'][_0x1a63('0x3f')]({'where':{'id':_0x28dd93[_0x1a63('0x3d')]['id']}})[_0x1a63('0x1d')](handleEntityNotFound(_0x1d37ee,null))['then'](removeEntity(_0x1d37ee,null))[_0x1a63('0x40')](handleError(_0x1d37ee,null));};exports[_0x1a63('0x43')]=function(_0x1fece0,_0xee5c27){return db['FaxTransferReport'][_0x1a63('0x43')]()[_0x1a63('0x1d')](respondWithResult(_0xee5c27,null))[_0x1a63('0x40')](handleError(_0xee5c27,null));}; \ No newline at end of file +var _0xd8b1=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','send','index','rawAttributes','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','field','includeAll','include','FaxTransferReport','findAll','show','params','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x22e3c0,_0x4b4936){var _0x4b4bfb=function(_0x47fbfb){while(--_0x47fbfb){_0x22e3c0['push'](_0x22e3c0['shift']());}};_0x4b4bfb(++_0x4b4936);}(_0xd8b1,0x105));var _0x1d8b=function(_0x1383a3,_0x58e9af){_0x1383a3=_0x1383a3-0x0;var _0x1e6855=_0xd8b1[_0x1383a3];return _0x1e6855;};'use strict';var pdf=require(_0x1d8b('0x0'));var emlformat=require(_0x1d8b('0x1'));var rimraf=require(_0x1d8b('0x2'));var zipdir=require(_0x1d8b('0x3'));var jsonpatch=require(_0x1d8b('0x4'));var rp=require('request-promise');var moment=require(_0x1d8b('0x5'));var BPromise=require(_0x1d8b('0x6'));var Mustache=require('mustache');var util=require(_0x1d8b('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1d8b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1d8b('0x9'));var crypto=require(_0x1d8b('0xa'));var jsforce=require(_0x1d8b('0xb'));var deskjs=require(_0x1d8b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d8b('0xd'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x1d8b('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x1d8b('0xf'))('api');var utils=require(_0x1d8b('0x10'));var config=require(_0x1d8b('0x11'));var db=require(_0x1d8b('0x12'))['db'];function respondWithStatusCode(_0x3c9ae1,_0x30de33){_0x30de33=_0x30de33||0xcc;return function(_0xfd985b){if(_0xfd985b){return _0x3c9ae1['sendStatus'](_0x30de33);}return _0x3c9ae1[_0x1d8b('0x13')](_0x30de33)[_0x1d8b('0x14')]();};}function respondWithResult(_0x2761df,_0x1bf879){_0x1bf879=_0x1bf879||0xc8;return function(_0x4486a8){if(_0x4486a8){return _0x2761df[_0x1d8b('0x13')](_0x1bf879)[_0x1d8b('0x15')](_0x4486a8);}};}function respondWithFilteredResult(_0x3f9c95,_0x4fa6d8){return function(_0x50c75f){if(_0x50c75f){var _0x3d54d3=_0x50c75f[_0x1d8b('0x16')],_0x3f31a4=_0x4fa6d8[_0x1d8b('0x17')],_0x44ebbe=_0x4fa6d8['offset']+_0x4fa6d8['limit'],_0x3bebce;if(_0x44ebbe>=_0x3d54d3){_0x44ebbe=_0x3d54d3;_0x3bebce=0xc8;}else{_0x3bebce=0xce;}_0x3f9c95[_0x1d8b('0x13')](_0x3bebce);return _0x3f9c95[_0x1d8b('0x18')](_0x1d8b('0x19'),_0x3f31a4+'-'+_0x44ebbe+'/'+_0x3d54d3)[_0x1d8b('0x15')](_0x50c75f);}return null;};}function patchUpdates(_0x41b6fe){return function(_0x5d52c0){try{jsonpatch[_0x1d8b('0x1a')](_0x5d52c0,_0x41b6fe,!![]);}catch(_0x57c63a){return BPromise['reject'](_0x57c63a);}return _0x5d52c0[_0x1d8b('0x1b')]();};}function saveUpdates(_0x1b9549,_0x37c3e2){return function(_0x4f3342){if(_0x4f3342){return _0x4f3342[_0x1d8b('0x1c')](_0x1b9549)[_0x1d8b('0x1d')](function(_0x3cdf3b){return _0x3cdf3b;});}return null;};}function removeEntity(_0x82e608,_0x2f9f64){return function(_0x130c00){if(_0x130c00){return _0x130c00[_0x1d8b('0x1e')]()['then'](function(){_0x82e608[_0x1d8b('0x13')](0xcc)[_0x1d8b('0x14')]();});}};}function handleEntityNotFound(_0x3d8fcb,_0x308b89){return function(_0x5235b6){if(!_0x5235b6){_0x3d8fcb['sendStatus'](0x194);}return _0x5235b6;};}function handleError(_0x41ddd6,_0x338146){_0x338146=_0x338146||0x1f4;return function(_0x49cc58){logger[_0x1d8b('0x1f')](_0x49cc58[_0x1d8b('0x20')]);if(_0x49cc58['name']){delete _0x49cc58['name'];}_0x41ddd6[_0x1d8b('0x13')](_0x338146)[_0x1d8b('0x21')](_0x49cc58);};}exports[_0x1d8b('0x22')]=function(_0xe76d45,_0x45d9a4){var _0x2e6249={},_0x1d525f={},_0x59d3bf={'count':0x0,'rows':[]};var _0x27371d=db['FaxTransferReport'][_0x1d8b('0x23')];_0x1d525f['model']=_[_0x1d8b('0x24')](_0x27371d);_0x1d525f[_0x1d8b('0x25')]=_[_0x1d8b('0x24')](_0xe76d45[_0x1d8b('0x25')]);_0x1d525f['filters']=_['intersection'](_0x1d525f[_0x1d8b('0x26')],_0x1d525f[_0x1d8b('0x25')]);_0x2e6249[_0x1d8b('0x27')]=_[_0x1d8b('0x28')](_0x1d525f[_0x1d8b('0x26')],qs[_0x1d8b('0x29')](_0xe76d45['query'][_0x1d8b('0x29')]));_0x2e6249[_0x1d8b('0x27')]=_0x2e6249[_0x1d8b('0x27')][_0x1d8b('0x2a')]?_0x2e6249[_0x1d8b('0x27')]:_0x1d525f[_0x1d8b('0x26')];if(!_0xe76d45[_0x1d8b('0x25')][_0x1d8b('0x2b')](_0x1d8b('0x2c'))){_0x2e6249['limit']=qs[_0x1d8b('0x2d')](_0xe76d45['query']['limit']);_0x2e6249['offset']=qs[_0x1d8b('0x17')](_0xe76d45[_0x1d8b('0x25')][_0x1d8b('0x17')]);}_0x2e6249[_0x1d8b('0x2e')]=qs[_0x1d8b('0x2f')](_0xe76d45['query'][_0x1d8b('0x2f')]);_0x2e6249[_0x1d8b('0x30')]=qs[_0x1d8b('0x31')](_[_0x1d8b('0x32')](_0xe76d45[_0x1d8b('0x25')],_0x1d525f[_0x1d8b('0x31')]));if(_0xe76d45[_0x1d8b('0x25')][_0x1d8b('0x33')]){_0x2e6249['where']=_[_0x1d8b('0x34')](_0x2e6249['where'],{'$or':_[_0x1d8b('0x35')](_0x27371d,function(_0x493ebe){if(_0x493ebe[_0x1d8b('0x36')][_0x1d8b('0x37')]!==_0x1d8b('0x38')){var _0x487e65={};_0x487e65[_0x493ebe[_0x1d8b('0x39')]]={'$like':'%'+_0xe76d45[_0x1d8b('0x25')][_0x1d8b('0x33')]+'%'};return _0x487e65;}})});}_0x2e6249=_[_0x1d8b('0x34')]({},_0x2e6249,_0xe76d45['options']);var _0x465f32={'where':_0x2e6249[_0x1d8b('0x30')]};return db['FaxTransferReport'][_0x1d8b('0x16')](_0x465f32)['then'](function(_0x55a77b){_0x59d3bf['count']=_0x55a77b;if(_0xe76d45[_0x1d8b('0x25')][_0x1d8b('0x3a')]){_0x2e6249[_0x1d8b('0x3b')]=[{'all':!![]}];}return db[_0x1d8b('0x3c')][_0x1d8b('0x3d')](_0x2e6249);})[_0x1d8b('0x1d')](function(_0xaee456){_0x59d3bf['rows']=_0xaee456;return _0x59d3bf;})[_0x1d8b('0x1d')](respondWithFilteredResult(_0x45d9a4,_0x2e6249))['catch'](handleError(_0x45d9a4,null));};exports[_0x1d8b('0x3e')]=function(_0x5da0e7,_0x390544){var _0x3f51f4={'raw':!![],'where':{'id':_0x5da0e7[_0x1d8b('0x3f')]['id']}},_0x474a57={};_0x474a57[_0x1d8b('0x26')]=_[_0x1d8b('0x24')](db[_0x1d8b('0x3c')]['rawAttributes']);_0x474a57['query']=_[_0x1d8b('0x24')](_0x5da0e7[_0x1d8b('0x25')]);_0x474a57[_0x1d8b('0x31')]=_[_0x1d8b('0x28')](_0x474a57[_0x1d8b('0x26')],_0x474a57['query']);_0x3f51f4[_0x1d8b('0x27')]=_[_0x1d8b('0x28')](_0x474a57['model'],qs['fields'](_0x5da0e7['query'][_0x1d8b('0x29')]));_0x3f51f4['attributes']=_0x3f51f4[_0x1d8b('0x27')][_0x1d8b('0x2a')]?_0x3f51f4['attributes']:_0x474a57[_0x1d8b('0x26')];if(_0x5da0e7[_0x1d8b('0x25')][_0x1d8b('0x3a')]){_0x3f51f4[_0x1d8b('0x3b')]=[{'all':!![]}];}_0x3f51f4=_[_0x1d8b('0x34')]({},_0x3f51f4,_0x5da0e7['options']);return db['FaxTransferReport'][_0x1d8b('0x40')](_0x3f51f4)[_0x1d8b('0x1d')](handleEntityNotFound(_0x390544,null))[_0x1d8b('0x1d')](respondWithResult(_0x390544,null))['catch'](handleError(_0x390544,null));};exports[_0x1d8b('0x41')]=function(_0x23f055,_0x143d7c){return db[_0x1d8b('0x3c')][_0x1d8b('0x41')](_0x23f055[_0x1d8b('0x42')],{})[_0x1d8b('0x1d')](respondWithResult(_0x143d7c,0xc9))[_0x1d8b('0x43')](handleError(_0x143d7c,null));};exports['update']=function(_0x29a2c7,_0x2cff83){if(_0x29a2c7[_0x1d8b('0x42')]['id']){delete _0x29a2c7[_0x1d8b('0x42')]['id'];}return db[_0x1d8b('0x3c')][_0x1d8b('0x40')]({'where':{'id':_0x29a2c7[_0x1d8b('0x3f')]['id']}})[_0x1d8b('0x1d')](handleEntityNotFound(_0x2cff83,null))['then'](saveUpdates(_0x29a2c7[_0x1d8b('0x42')],null))[_0x1d8b('0x1d')](respondWithResult(_0x2cff83,null))['catch'](handleError(_0x2cff83,null));};exports['destroy']=function(_0x33d7cd,_0x51584d){return db[_0x1d8b('0x3c')][_0x1d8b('0x40')]({'where':{'id':_0x33d7cd[_0x1d8b('0x3f')]['id']}})[_0x1d8b('0x1d')](handleEntityNotFound(_0x51584d,null))[_0x1d8b('0x1d')](removeEntity(_0x51584d,null))[_0x1d8b('0x43')](handleError(_0x51584d,null));};exports[_0x1d8b('0x44')]=function(_0x1e8504,_0x280c02){return db[_0x1d8b('0x3c')][_0x1d8b('0x44')]()[_0x1d8b('0x1d')](respondWithResult(_0x280c02,null))[_0x1d8b('0x43')](handleError(_0x280c02,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index fb147b1..be63ae9 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 _0x8f5d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x409f75,_0x5bfa17){var _0x53b645=function(_0x50221d){while(--_0x50221d){_0x409f75['push'](_0x409f75['shift']());}};_0x53b645(++_0x5bfa17);}(_0x8f5d,0x134));var _0xd8f5=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x8f5d[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0xd8f5('0x0'));var util=require(_0xd8f5('0x1'));var logger=require(_0xd8f5('0x2'))(_0xd8f5('0x3'));var moment=require(_0xd8f5('0x4'));var BPromise=require(_0xd8f5('0x5'));var rp=require(_0xd8f5('0x6'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x453a3d,_0x58fe09){return _0x453a3d[_0xd8f5('0x7')](_0xd8f5('0x8'),attributes,{'tableName':_0xd8f5('0x9'),'paranoid':![],'indexes':[{'name':_0xd8f5('0xa'),'fields':[_0xd8f5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e1e=['bluebird','request-promise','./faxTransferReport.attributes','exports','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x545c34,_0x1699d3){var _0xf5d9a6=function(_0x57af68){while(--_0x57af68){_0x545c34['push'](_0x545c34['shift']());}};_0xf5d9a6(++_0x1699d3);}(_0x5e1e,0x119));var _0xe5e1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5e1e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xe5e1('0x0'));var util=require(_0xe5e1('0x1'));var logger=require(_0xe5e1('0x2'))(_0xe5e1('0x3'));var moment=require(_0xe5e1('0x4'));var BPromise=require(_0xe5e1('0x5'));var rp=require(_0xe5e1('0x6'));var attributes=require(_0xe5e1('0x7'));module[_0xe5e1('0x8')]=function(_0x501839,_0x5045f3){return _0x501839['define']('FaxTransferReport',attributes,{'tableName':_0xe5e1('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe5e1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index b3cd3cb..1268ae0 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 _0x1535=['error','code','message','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x148cdf,_0x1c28d8){var _0xffdf51=function(_0x176911){while(--_0x176911){_0x148cdf['push'](_0x148cdf['shift']());}};_0xffdf51(++_0x1c28d8);}(_0x1535,0xb7));var _0x5153=function(_0x207bd0,_0x45caa7){_0x207bd0=_0x207bd0-0x0;var _0x42a9f3=_0x1535[_0x207bd0];return _0x42a9f3;};'use strict';var _=require('lodash');var util=require(_0x5153('0x0'));var moment=require(_0x5153('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5153('0x2'));var db=require(_0x5153('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5153('0x4'))(_0x5153('0x5'));var config=require(_0x5153('0x6'));var jayson=require(_0x5153('0x7'));var client=jayson[_0x5153('0x8')][_0x5153('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31e2b0,_0x5a77f8,_0x5cc9f1){return new BPromise(function(_0x2b1edd,_0x4bb6cc){return client[_0x5153('0xa')](_0x31e2b0,_0x5cc9f1)['then'](function(_0x4c6003){logger[_0x5153('0xb')](_0x5153('0xc'),_0x5a77f8,_0x5153('0xd'));logger[_0x5153('0xe')](_0x5153('0xf'),_0x5a77f8,_0x5153('0xd'),JSON[_0x5153('0x10')](_0x4c6003));if(_0x4c6003[_0x5153('0x11')]){if(_0x4c6003[_0x5153('0x11')][_0x5153('0x12')]===0x1f4){logger[_0x5153('0x11')](_0x5153('0xc'),_0x5a77f8,_0x4c6003['error'][_0x5153('0x13')]);return _0x4bb6cc(_0x4c6003[_0x5153('0x11')]['message']);}logger[_0x5153('0x11')](_0x5153('0xc'),_0x5a77f8,_0x4c6003['error'][_0x5153('0x13')]);return _0x2b1edd(_0x4c6003[_0x5153('0x11')][_0x5153('0x13')]);}else{logger[_0x5153('0xb')](_0x5153('0xc'),_0x5a77f8,_0x5153('0xd'));_0x2b1edd(_0x4c6003['result']['message']);}})['catch'](function(_0x1ffd9a){logger[_0x5153('0x11')](_0x5153('0xc'),_0x5a77f8,_0x1ffd9a);_0x4bb6cc(_0x1ffd9a);});});} \ No newline at end of file +var _0x38db=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird'];(function(_0xdf3db6,_0x2a1952){var _0x4b7a65=function(_0x2953be){while(--_0x2953be){_0xdf3db6['push'](_0xdf3db6['shift']());}};_0x4b7a65(++_0x2a1952);}(_0x38db,0xad));var _0xb38d=function(_0x2342c9,_0x78ba07){_0x2342c9=_0x2342c9-0x0;var _0x1e6d8d=_0x38db[_0x2342c9];return _0x1e6d8d;};'use strict';var _=require(_0xb38d('0x0'));var util=require(_0xb38d('0x1'));var moment=require('moment');var BPromise=require(_0xb38d('0x2'));var rs=require(_0xb38d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb38d('0x4'));var logger=require(_0xb38d('0x5'))(_0xb38d('0x6'));var config=require(_0xb38d('0x7'));var jayson=require(_0xb38d('0x8'));var client=jayson['client'][_0xb38d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ae3f5,_0x2076ba,_0xac264c){return new BPromise(function(_0x2d1b71,_0x592b70){return client[_0xb38d('0xa')](_0x2ae3f5,_0xac264c)[_0xb38d('0xb')](function(_0x201517){logger[_0xb38d('0xc')](_0xb38d('0xd'),_0x2076ba,'request\x20sent');logger[_0xb38d('0xe')](_0xb38d('0xf'),_0x2076ba,_0xb38d('0x10'),JSON[_0xb38d('0x11')](_0x201517));if(_0x201517[_0xb38d('0x12')]){if(_0x201517[_0xb38d('0x12')][_0xb38d('0x13')]===0x1f4){logger['error'](_0xb38d('0xd'),_0x2076ba,_0x201517[_0xb38d('0x12')][_0xb38d('0x14')]);return _0x592b70(_0x201517[_0xb38d('0x12')][_0xb38d('0x14')]);}logger[_0xb38d('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x2076ba,_0x201517['error'][_0xb38d('0x14')]);return _0x2d1b71(_0x201517[_0xb38d('0x12')][_0xb38d('0x14')]);}else{logger[_0xb38d('0xc')](_0xb38d('0xd'),_0x2076ba,'request\x20sent');_0x2d1b71(_0x201517[_0xb38d('0x15')][_0xb38d('0x14')]);}})['catch'](function(_0xa80497){logger[_0xb38d('0x12')](_0xb38d('0xd'),_0x2076ba,_0xa80497);_0x592b70(_0xa80497);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 782731d..4f79b28 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 _0xb821=['../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','Router'];(function(_0x1ce79a,_0x55b388){var _0x3e3328=function(_0x41cf9b){while(--_0x41cf9b){_0x1ce79a['push'](_0x1ce79a['shift']());}};_0x3e3328(++_0x55b388);}(_0xb821,0xa7));var _0x1b82=function(_0x43b285,_0x2acd61){_0x43b285=_0x43b285-0x0;var _0x33e5c7=_0xb821[_0x43b285];return _0x33e5c7;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b82('0x3'));var controller=require(_0x1b82('0x4'));router[_0x1b82('0x5')]('/',auth[_0x1b82('0x6')](),controller['index']);router[_0x1b82('0x5')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller[_0x1b82('0x8')]);router[_0x1b82('0x5')](_0x1b82('0x9'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xa')]);router[_0x1b82('0xb')]('/',auth['isAuthenticated'](),controller[_0x1b82('0xc')]);router[_0x1b82('0xd')](_0x1b82('0x9'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xe')]);router[_0x1b82('0xf')](_0x1b82('0x9'),auth[_0x1b82('0x6')](),controller['destroy']);module[_0x1b82('0x10')]=router; \ No newline at end of file +var _0x8ef6=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x2deaaf,_0x26e35d){var _0x478271=function(_0x3f997b){while(--_0x3f997b){_0x2deaaf['push'](_0x2deaaf['shift']());}};_0x478271(++_0x26e35d);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4554ba,_0x1c97c8){_0x4554ba=_0x4554ba-0x0;var _0x1fcf10=_0x8ef6[_0x4554ba];return _0x1fcf10;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['get'](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xf')]('/',auth[_0x68ef('0xa')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x13')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x14')]);module[_0x68ef('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e47a261..4e340b4 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 _0xf488=['update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create','put'];(function(_0x48e259,_0x288a40){var _0x342d9a=function(_0x268e27){while(--_0x268e27){_0x48e259['push'](_0x48e259['shift']());}};_0x342d9a(++_0x288a40);}(_0xf488,0x1a7));var _0x8f48=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0xf488[_0x2ca2d0];return _0x521c23;};'use strict';var multer=require(_0x8f48('0x0'));var util=require(_0x8f48('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8f48('0x2'));var router=express[_0x8f48('0x3')]();var auth=require(_0x8f48('0x4'));var interaction=require(_0x8f48('0x5'));var config=require(_0x8f48('0x6'));var controller=require('./intDeskAccount.controller');router[_0x8f48('0x7')]('/',auth[_0x8f48('0x8')](),controller[_0x8f48('0x9')]);router[_0x8f48('0x7')](_0x8f48('0xa'),auth[_0x8f48('0x8')](),controller[_0x8f48('0xb')]);router[_0x8f48('0x7')](_0x8f48('0xc'),auth[_0x8f48('0x8')](),controller['getConfigurations']);router[_0x8f48('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8f48('0xd')]);router[_0x8f48('0xe')]('/',auth[_0x8f48('0x8')](),controller[_0x8f48('0xf')]);router[_0x8f48('0xe')](_0x8f48('0xc'),auth[_0x8f48('0x8')](),controller['addConfiguration']);router[_0x8f48('0x10')](_0x8f48('0xa'),auth['isAuthenticated'](),controller[_0x8f48('0x11')]);router[_0x8f48('0x12')](_0x8f48('0xa'),auth[_0x8f48('0x8')](),controller[_0x8f48('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0ae1=['../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x0ae1,0x1f4));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x10ae('0x0'));var path=require('path');var timeout=require(_0x10ae('0x1'));var express=require(_0x10ae('0x2'));var router=express[_0x10ae('0x3')]();var auth=require(_0x10ae('0x4'));var interaction=require(_0x10ae('0x5'));var config=require(_0x10ae('0x6'));var controller=require(_0x10ae('0x7'));router[_0x10ae('0x8')]('/',auth['isAuthenticated'](),controller[_0x10ae('0x9')]);router['get'](_0x10ae('0xa'),auth[_0x10ae('0xb')](),controller[_0x10ae('0xc')]);router['get'](_0x10ae('0xd'),auth[_0x10ae('0xb')](),controller[_0x10ae('0xe')]);router[_0x10ae('0x8')](_0x10ae('0xf'),auth[_0x10ae('0xb')](),controller[_0x10ae('0x10')]);router[_0x10ae('0x11')]('/',auth[_0x10ae('0xb')](),controller['create']);router[_0x10ae('0x11')](_0x10ae('0xd'),auth[_0x10ae('0xb')](),controller[_0x10ae('0x12')]);router[_0x10ae('0x13')](_0x10ae('0xa'),auth['isAuthenticated'](),controller[_0x10ae('0x14')]);router[_0x10ae('0x15')](_0x10ae('0xa'),auth[_0x10ae('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 120aa97..e59c069 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 _0x483c=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x158451,_0x41a456){var _0x5e25f3=function(_0x4ce39b){while(--_0x4ce39b){_0x158451['push'](_0x158451['shift']());}};_0x5e25f3(++_0x41a456);}(_0x483c,0x197));var _0xc483=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x483c[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0xc483('0x0'));module[_0xc483('0x1')]={'name':{'type':Sequelize[_0xc483('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc483('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xc483('0x3')](_0xc483('0x4')),'defaultValue':_0xc483('0x4')},'password':{'type':Sequelize[_0xc483('0x2')]},'consumerKey':{'type':Sequelize[_0xc483('0x2')]},'consumerSecret':{'type':Sequelize[_0xc483('0x2')]},'token':{'type':Sequelize[_0xc483('0x2')]},'tokenSecret':{'type':Sequelize[_0xc483('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc483('0x3')](_0xc483('0x5'),_0xc483('0x6')),'defaultValue':_0xc483('0x5')}}; \ No newline at end of file +var _0xd906=['STRING','ENUM','basic','integrationTab'];(function(_0x59881a,_0x5ef668){var _0x33a221=function(_0x396188){while(--_0x396188){_0x59881a['push'](_0x59881a['shift']());}};_0x33a221(++_0x5ef668);}(_0xd906,0x1a4));var _0x6d90=function(_0x498953,_0x82d4af){_0x498953=_0x498953-0x0;var _0x4b2237=_0xd906[_0x498953];return _0x4b2237;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6d90('0x0')]},'authType':{'type':Sequelize[_0x6d90('0x1')](_0x6d90('0x2')),'defaultValue':_0x6d90('0x2')},'password':{'type':Sequelize[_0x6d90('0x0')]},'consumerKey':{'type':Sequelize[_0x6d90('0x0')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6d90('0x0')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6d90('0x0')]},'type':{'type':Sequelize[_0x6d90('0x1')](_0x6d90('0x3'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 6c1b296..8f40e7d 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 _0xcffe=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','type','key','field','options','includeAll','findAll','rows','params','include','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','DeskField','Descriptions','remoteUri','username','password','consumerKey','consumerSecret','token','lastIndexOf','format','application/json','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','Content-Range','reject','save','update','destroy','stack','name','DeskAccount','rawAttributes','keys','query'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xcffe,0x1a1));var _0xecff=function(_0x293866,_0x33ab3e){_0x293866=_0x293866-0x0;var _0x4b33c8=_0xcffe[_0x293866];return _0x4b33c8;};'use strict';var pdf=require(_0xecff('0x0'));var emlformat=require(_0xecff('0x1'));var rimraf=require(_0xecff('0x2'));var zipdir=require(_0xecff('0x3'));var jsonpatch=require(_0xecff('0x4'));var rp=require(_0xecff('0x5'));var moment=require(_0xecff('0x6'));var BPromise=require(_0xecff('0x7'));var Mustache=require(_0xecff('0x8'));var util=require(_0xecff('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xecff('0xa'));var ejs=require(_0xecff('0xb'));var fs=require('fs');var _=require(_0xecff('0xc'));var squel=require(_0xecff('0xd'));var crypto=require(_0xecff('0xe'));var jsforce=require(_0xecff('0xf'));var deskjs=require(_0xecff('0x10'));var toCsv=require('to-csv');var querystring=require(_0xecff('0x11'));var Papa=require(_0xecff('0x12'));var authService=require(_0xecff('0x13'));var hardwareService=require(_0xecff('0x14'));var Redis=require(_0xecff('0x15'));var qs=require('../../components/parsers/qs');var logger=require(_0xecff('0x16'))(_0xecff('0x17'));var utils=require(_0xecff('0x18'));var config=require(_0xecff('0x19'));var db=require(_0xecff('0x1a'))['db'];var integrations=require(_0xecff('0x1b'));var jayson=require(_0xecff('0x1c'));var client=jayson[_0xecff('0x1d')][_0xecff('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x151a79,_0x1f67d2,_0x2b0507,_0x1e5973){return new BPromise(function(_0xb8745f,_0x5495f9){var _0x4b1893=_0x1e5973||client;return _0x4b1893[_0xecff('0x1f')](_0x151a79,_0x2b0507)[_0xecff('0x20')](function(_0x558ecd){logger[_0xecff('0x21')](_0xecff('0x22'),_0x1f67d2,_0xecff('0x23'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1f67d2,_0xecff('0x23'),JSON[_0xecff('0x24')](_0x558ecd));if(_0x558ecd['error']){if(_0x558ecd[_0xecff('0x25')][_0xecff('0x26')]===0x1f4){logger[_0xecff('0x25')](_0xecff('0x22'),_0x1f67d2,_0x558ecd[_0xecff('0x25')][_0xecff('0x27')]);return _0x5495f9(_0x558ecd['error'][_0xecff('0x27')]);}logger[_0xecff('0x25')](_0xecff('0x22'),_0x1f67d2,_0x558ecd[_0xecff('0x25')]['message']);return _0xb8745f(_0x558ecd[_0xecff('0x25')][_0xecff('0x27')]);}else{logger[_0xecff('0x21')](_0xecff('0x22'),_0x1f67d2,_0xecff('0x23'));_0xb8745f(_0x558ecd[_0xecff('0x28')]['message']);}})[_0xecff('0x29')](function(_0x520d6d){logger['error'](_0xecff('0x22'),_0x1f67d2,_0x520d6d);_0x5495f9(_0x520d6d);});});}function respondWithStatusCode(_0x4fdc8e,_0x2447da){_0x2447da=_0x2447da||0xcc;return function(_0x49c0cd){if(_0x49c0cd){return _0x4fdc8e[_0xecff('0x2a')](_0x2447da);}return _0x4fdc8e['status'](_0x2447da)[_0xecff('0x2b')]();};}function respondWithResult(_0x44f5f7,_0x505e20){_0x505e20=_0x505e20||0xc8;return function(_0x9f173d){if(_0x9f173d){return _0x44f5f7[_0xecff('0x2c')](_0x505e20)[_0xecff('0x2d')](_0x9f173d);}};}function respondWithFilteredResult(_0x3cadb9,_0x19202e){return function(_0x493465){if(_0x493465){var _0x4f987b=_0x493465[_0xecff('0x2e')],_0x25effe=_0x19202e[_0xecff('0x2f')],_0x484415=_0x19202e[_0xecff('0x2f')]+_0x19202e['limit'],_0x1281d8;if(_0x484415>=_0x4f987b){_0x484415=_0x4f987b;_0x1281d8=0xc8;}else{_0x1281d8=0xce;}_0x3cadb9['status'](_0x1281d8);return _0x3cadb9['set'](_0xecff('0x30'),_0x25effe+'-'+_0x484415+'/'+_0x4f987b)[_0xecff('0x2d')](_0x493465);}return null;};}function patchUpdates(_0x230d04){return function(_0x1e3175){try{jsonpatch['apply'](_0x1e3175,_0x230d04,!![]);}catch(_0x26ddb3){return BPromise[_0xecff('0x31')](_0x26ddb3);}return _0x1e3175[_0xecff('0x32')]();};}function saveUpdates(_0x5f3c5c,_0x1c9757){return function(_0x2c80a7){if(_0x2c80a7){return _0x2c80a7[_0xecff('0x33')](_0x5f3c5c)[_0xecff('0x20')](function(_0x58c569){return _0x58c569;});}return null;};}function removeEntity(_0x7e7a6c,_0x350297){return function(_0x4ab731){if(_0x4ab731){return _0x4ab731[_0xecff('0x34')]()[_0xecff('0x20')](function(){_0x7e7a6c[_0xecff('0x2c')](0xcc)[_0xecff('0x2b')]();});}};}function handleEntityNotFound(_0x589339,_0x120eb3){return function(_0x298c34){if(!_0x298c34){_0x589339[_0xecff('0x2a')](0x194);}return _0x298c34;};}function handleError(_0x55c232,_0x46f42a){_0x46f42a=_0x46f42a||0x1f4;return function(_0x154d7a){logger[_0xecff('0x25')](_0x154d7a[_0xecff('0x35')]);if(_0x154d7a[_0xecff('0x36')]){delete _0x154d7a[_0xecff('0x36')];}_0x55c232['status'](_0x46f42a)['send'](_0x154d7a);};}exports['index']=function(_0x2d2f8b,_0x5bbec5){var _0x3fda93={},_0x21411b={},_0x5768f6={'count':0x0,'rows':[]};var _0x2a92a8=db[_0xecff('0x37')][_0xecff('0x38')];_0x21411b['model']=_[_0xecff('0x39')](_0x2a92a8);_0x21411b[_0xecff('0x3a')]=_[_0xecff('0x39')](_0x2d2f8b['query']);_0x21411b[_0xecff('0x3b')]=_[_0xecff('0x3c')](_0x21411b[_0xecff('0x3d')],_0x21411b[_0xecff('0x3a')]);_0x3fda93[_0xecff('0x3e')]=_[_0xecff('0x3c')](_0x21411b[_0xecff('0x3d')],qs[_0xecff('0x3f')](_0x2d2f8b[_0xecff('0x3a')][_0xecff('0x3f')]));_0x3fda93[_0xecff('0x3e')]=_0x3fda93['attributes'][_0xecff('0x40')]?_0x3fda93[_0xecff('0x3e')]:_0x21411b[_0xecff('0x3d')];if(!_0x2d2f8b[_0xecff('0x3a')][_0xecff('0x41')](_0xecff('0x42'))){_0x3fda93[_0xecff('0x43')]=qs[_0xecff('0x43')](_0x2d2f8b['query'][_0xecff('0x43')]);_0x3fda93['offset']=qs[_0xecff('0x2f')](_0x2d2f8b[_0xecff('0x3a')][_0xecff('0x2f')]);}_0x3fda93[_0xecff('0x44')]=qs[_0xecff('0x45')](_0x2d2f8b[_0xecff('0x3a')][_0xecff('0x45')]);_0x3fda93['where']=qs[_0xecff('0x3b')](_[_0xecff('0x46')](_0x2d2f8b['query'],_0x21411b['filters']));if(_0x2d2f8b[_0xecff('0x3a')][_0xecff('0x47')]){_0x3fda93[_0xecff('0x48')]=_[_0xecff('0x49')](_0x3fda93[_0xecff('0x48')],{'$or':_[_0xecff('0x4a')](_0x2a92a8,function(_0x556faa){if(_0x556faa[_0xecff('0x4b')][_0xecff('0x4c')]!=='VIRTUAL'){var _0x8b0f59={};_0x8b0f59[_0x556faa[_0xecff('0x4d')]]={'$like':'%'+_0x2d2f8b[_0xecff('0x3a')][_0xecff('0x47')]+'%'};return _0x8b0f59;}})});}_0x3fda93=_[_0xecff('0x49')]({},_0x3fda93,_0x2d2f8b[_0xecff('0x4e')]);var _0x5c20f1={'where':_0x3fda93[_0xecff('0x48')]};return db[_0xecff('0x37')][_0xecff('0x2e')](_0x5c20f1)['then'](function(_0x133715){_0x5768f6[_0xecff('0x2e')]=_0x133715;if(_0x2d2f8b[_0xecff('0x3a')][_0xecff('0x4f')]){_0x3fda93['include']=[{'all':!![]}];}return db[_0xecff('0x37')][_0xecff('0x50')](_0x3fda93);})['then'](function(_0x22869d){_0x5768f6[_0xecff('0x51')]=_0x22869d;return _0x5768f6;})['then'](respondWithFilteredResult(_0x5bbec5,_0x3fda93))[_0xecff('0x29')](handleError(_0x5bbec5,null));};exports['show']=function(_0x3a6b26,_0x3692c9){var _0x27256f={'raw':![],'where':{'id':_0x3a6b26[_0xecff('0x52')]['id']}},_0x3cc94e={};_0x3cc94e[_0xecff('0x3d')]=_['keys'](db['DeskAccount'][_0xecff('0x38')]);_0x3cc94e[_0xecff('0x3a')]=_[_0xecff('0x39')](_0x3a6b26[_0xecff('0x3a')]);_0x3cc94e[_0xecff('0x3b')]=_[_0xecff('0x3c')](_0x3cc94e[_0xecff('0x3d')],_0x3cc94e[_0xecff('0x3a')]);_0x27256f['attributes']=_[_0xecff('0x3c')](_0x3cc94e[_0xecff('0x3d')],qs['fields'](_0x3a6b26[_0xecff('0x3a')]['fields']));_0x27256f[_0xecff('0x3e')]=_0x27256f[_0xecff('0x3e')]['length']?_0x27256f[_0xecff('0x3e')]:_0x3cc94e[_0xecff('0x3d')];if(_0x3a6b26[_0xecff('0x3a')][_0xecff('0x4f')]){_0x27256f[_0xecff('0x53')]=[{'all':!![]}];}_0x27256f=_['merge']({},_0x27256f,_0x3a6b26['options']);return db[_0xecff('0x37')][_0xecff('0x54')](_0x27256f)[_0xecff('0x20')](handleEntityNotFound(_0x3692c9,null))[_0xecff('0x20')](respondWithResult(_0x3692c9,null))[_0xecff('0x29')](handleError(_0x3692c9,null));};exports[_0xecff('0x55')]=function(_0x339d3d,_0x328cbf){return db[_0xecff('0x37')]['create'](_0x339d3d[_0xecff('0x56')],{})['then'](respondWithResult(_0x328cbf,0xc9))[_0xecff('0x29')](handleError(_0x328cbf,null));};exports[_0xecff('0x33')]=function(_0x1f8598,_0x503002){if(_0x1f8598[_0xecff('0x56')]['id']){delete _0x1f8598['body']['id'];}return db[_0xecff('0x37')]['find']({'where':{'id':_0x1f8598['params']['id']}})[_0xecff('0x20')](handleEntityNotFound(_0x503002,null))['then'](saveUpdates(_0x1f8598[_0xecff('0x56')],null))[_0xecff('0x20')](respondWithResult(_0x503002,null))['catch'](handleError(_0x503002,null));};exports[_0xecff('0x34')]=function(_0x3bdf47,_0xe301){return db[_0xecff('0x37')][_0xecff('0x54')]({'where':{'id':_0x3bdf47[_0xecff('0x52')]['id']}})[_0xecff('0x20')](handleEntityNotFound(_0xe301,null))[_0xecff('0x20')](removeEntity(_0xe301,null))['catch'](handleError(_0xe301,null));};exports[_0xecff('0x57')]=function(_0x36525d,_0x18ead4,_0x268861){var _0x1dfd8e={};var _0x12d549={};var _0x29d4d5;var _0x33bcb1;return db[_0xecff('0x37')][_0xecff('0x58')]({'where':{'id':_0x36525d[_0xecff('0x52')]['id']}})[_0xecff('0x20')](handleEntityNotFound(_0x18ead4,null))[_0xecff('0x20')](function(_0x88882b){if(_0x88882b){_0x29d4d5=_0x88882b;_0x12d549['model']=_['keys'](db[_0xecff('0x59')]['rawAttributes']);_0x12d549['query']=_[_0xecff('0x39')](_0x36525d[_0xecff('0x3a')]);_0x12d549[_0xecff('0x3b')]=_['intersection'](_0x12d549[_0xecff('0x3d')],_0x12d549[_0xecff('0x3a')]);_0x1dfd8e[_0xecff('0x3e')]=_['intersection'](_0x12d549[_0xecff('0x3d')],qs['fields'](_0x36525d['query'][_0xecff('0x3f')]));_0x1dfd8e[_0xecff('0x3e')]=_0x1dfd8e[_0xecff('0x3e')][_0xecff('0x40')]?_0x1dfd8e[_0xecff('0x3e')]:_0x12d549[_0xecff('0x3d')];_0x1dfd8e[_0xecff('0x44')]=qs[_0xecff('0x45')](_0x36525d[_0xecff('0x3a')][_0xecff('0x45')]);_0x1dfd8e[_0xecff('0x48')]=qs[_0xecff('0x3b')](_[_0xecff('0x46')](_0x36525d[_0xecff('0x3a')],_0x12d549['filters']));if(_0x36525d['query'][_0xecff('0x47')]){_0x1dfd8e[_0xecff('0x48')]=_['merge'](_0x1dfd8e[_0xecff('0x48')],{'$or':_[_0xecff('0x4a')](_0x1dfd8e['attributes'],function(_0x148c69){var _0x204a1c={};_0x204a1c[_0x148c69]={'$like':'%'+_0x36525d[_0xecff('0x3a')][_0xecff('0x47')]+'%'};return _0x204a1c;})});}_0x1dfd8e=_[_0xecff('0x49')]({},_0x1dfd8e,_0x36525d[_0xecff('0x4e')]);return _0x29d4d5['getConfigurations'](_0x1dfd8e);}})[_0xecff('0x20')](function(_0x385954){if(_0x385954){_0x33bcb1=_0x385954[_0xecff('0x40')];if(!_0x36525d[_0xecff('0x3a')][_0xecff('0x41')]('nolimit')){_0x1dfd8e[_0xecff('0x43')]=qs[_0xecff('0x43')](_0x36525d[_0xecff('0x3a')][_0xecff('0x43')]);_0x1dfd8e['offset']=qs['offset'](_0x36525d['query'][_0xecff('0x2f')]);}return _0x29d4d5[_0xecff('0x57')](_0x1dfd8e);}})[_0xecff('0x20')](function(_0x51aaba){if(_0x51aaba){return _0x51aaba?{'count':_0x33bcb1,'rows':_0x51aaba}:null;}})[_0xecff('0x20')](respondWithResult(_0x18ead4,null))['catch'](handleError(_0x18ead4,null));};exports[_0xecff('0x5a')]=function(_0x3e3197,_0x17dd7c,_0x2d271d){if(_0x3e3197['body']['id']){delete _0x3e3197[_0xecff('0x56')]['id'];}return db[_0xecff('0x37')][_0xecff('0x58')]({'where':{'id':_0x3e3197['params']['id']}})['then'](handleEntityNotFound(_0x17dd7c,null))[_0xecff('0x20')](function(_0x220449){if(_0x220449){_0x3e3197['body'][_0xecff('0x5b')]=_0x220449['id'];_0x3e3197[_0xecff('0x56')][_0xecff('0x5c')]=integrations[_0xecff('0x5d')](_0x3e3197[_0xecff('0x56')]['channel'],_0x3e3197['body'][_0xecff('0x4b')]);_0x3e3197[_0xecff('0x56')]['Descriptions']=integrations['getDescriptions'](_0x3e3197[_0xecff('0x56')]['channel'],_0x3e3197[_0xecff('0x56')][_0xecff('0x4b')]);return db['DeskConfiguration'][_0xecff('0x55')](_0x3e3197[_0xecff('0x56')],{'include':[{'model':db[_0xecff('0x5e')],'as':_0xecff('0x5c')},{'model':db[_0xecff('0x5e')],'as':_0xecff('0x5f')}]});}return null;})[_0xecff('0x20')](respondWithResult(_0x17dd7c,null))[_0xecff('0x29')](handleError(_0x17dd7c,null));};exports['getFields']=function(_0x290a43,_0x579dd1,_0x4b34e0){var _0x2ffdc4=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3769ff='';return db[_0xecff('0x37')][_0xecff('0x58')]({'where':{'id':_0x290a43[_0xecff('0x52')]['id']},'attributes':['id',_0xecff('0x60'),'authType',_0xecff('0x61'),_0xecff('0x62'),_0xecff('0x63'),_0xecff('0x64'),_0xecff('0x65'),'tokenSecret']})[_0xecff('0x20')](handleEntityNotFound(_0x579dd1,null))[_0xecff('0x20')](function(_0x4156df){if(_0x4156df){_0x3769ff=_0x4156df[_0xecff('0x60')];var _0x46ba08=_0x3769ff['slice'](-0x1);if(_0x46ba08==='/'){_0x3769ff=_0x3769ff['substring'](0x0,_0x3769ff[_0xecff('0x66')](_0x46ba08));}var _0x5b6054={'method':'GET','uri':util[_0xecff('0x67')]('%s/custom_fields',_0x3769ff),'headers':{'Content-Type':_0xecff('0x68'),'Accept':'application/json'},'json':!![]};if(_0x4156df['authType']==='basic'){_0x5b6054['headers'][_0xecff('0x69')]=util[_0xecff('0x67')](_0xecff('0x6a'),new Buffer(util[_0xecff('0x67')](_0xecff('0x6b'),_0x4156df[_0xecff('0x61')],_0x4156df[_0xecff('0x62')]))[_0xecff('0x6c')](_0xecff('0x6d')));}return rp(_0x5b6054)[_0xecff('0x20')](function(_0x5bf8ea){return _0x2ffdc4[_0xecff('0x6e')](_[_0xecff('0x4a')](_0x5bf8ea[_0xecff('0x6f')][_0xecff('0x70')],function(_0x2c07fb){return{'id':_0x2c07fb['name'],'name':_0x2c07fb[_0xecff('0x36')],'type':_0x2c07fb[_0xecff('0x4b')],'active':_0x2c07fb[_0xecff('0x71')],'label':_0x2c07fb['label'],'custom':!![]};}));});}})[_0xecff('0x20')](function(_0x4f2af6){return{'count':_0x4f2af6[_0xecff('0x40')],'rows':_0x4f2af6};})['then'](respondWithResult(_0x579dd1,null))[_0xecff('0x29')](function(_0x1fd6df){var _0x2d934a=_0x290a43[_0xecff('0x3a')][_0xecff('0x72')]?0x1f4:_0x1fd6df['statusCode']||0x1f4;logger[_0xecff('0x25')](_0xecff('0x73'),'getFields',_0x2d934a,JSON['stringify'](_0x1fd6df));delete _0x1fd6df[_0xecff('0x36')];if(_0x2d934a===0x191){_0x2d934a=0x190;}_0x579dd1[_0xecff('0x2c')](_0x2d934a)[_0xecff('0x74')](_0x290a43[_0xecff('0x3a')]['test']?{'message':_0xecff('0x75'),'statusCode':_0x1fd6df[_0xecff('0x76')]}:_0x1fd6df);});}; \ No newline at end of file +var _0xde2c=['getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','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','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','end','name','send','DeskAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','field','include','show','includeAll','options','find','create','body','params','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskConfiguration','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','active','label','test','statusCode'];(function(_0x1b5a3a,_0x2a706b){var _0x3b6a4e=function(_0x422587){while(--_0x422587){_0x1b5a3a['push'](_0x1b5a3a['shift']());}};_0x3b6a4e(++_0x2a706b);}(_0xde2c,0x7f));var _0xcde2=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0xde2c[_0x16aaef];return _0x1c82ef;};'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 authService=require('../../components/auth/service');var hardwareService=require(_0xcde2('0x12'));var Redis=require(_0xcde2('0x13'));var qs=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'];var integrations=require(_0xcde2('0x18'));var jayson=require(_0xcde2('0x19'));var client=jayson[_0xcde2('0x1a')][_0xcde2('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x599294,_0x211215,_0x577062,_0x31c3ba){return new BPromise(function(_0x4f0ac9,_0x4b0e0e){var _0x34e079=_0x31c3ba||client;return _0x34e079[_0xcde2('0x1c')](_0x599294,_0x577062)[_0xcde2('0x1d')](function(_0x19b54b){logger[_0xcde2('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x211215,_0xcde2('0x1f'));logger['debug'](_0xcde2('0x20'),_0x211215,_0xcde2('0x1f'),JSON[_0xcde2('0x21')](_0x19b54b));if(_0x19b54b[_0xcde2('0x22')]){if(_0x19b54b['error']['code']===0x1f4){logger['error'](_0xcde2('0x23'),_0x211215,_0x19b54b['error'][_0xcde2('0x24')]);return _0x4b0e0e(_0x19b54b[_0xcde2('0x22')][_0xcde2('0x24')]);}logger['error'](_0xcde2('0x23'),_0x211215,_0x19b54b[_0xcde2('0x22')][_0xcde2('0x24')]);return _0x4f0ac9(_0x19b54b[_0xcde2('0x22')][_0xcde2('0x24')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x211215,'request\x20sent');_0x4f0ac9(_0x19b54b[_0xcde2('0x25')][_0xcde2('0x24')]);}})[_0xcde2('0x26')](function(_0x4063d4){logger[_0xcde2('0x22')]('DeskAccount,\x20%s,\x20%s',_0x211215,_0x4063d4);_0x4b0e0e(_0x4063d4);});});}function respondWithStatusCode(_0x1104b8,_0x52368b){_0x52368b=_0x52368b||0xcc;return function(_0x280d8c){if(_0x280d8c){return _0x1104b8[_0xcde2('0x27')](_0x52368b);}return _0x1104b8[_0xcde2('0x28')](_0x52368b)['end']();};}function respondWithResult(_0x593aa4,_0x44a222){_0x44a222=_0x44a222||0xc8;return function(_0x207a12){if(_0x207a12){return _0x593aa4[_0xcde2('0x28')](_0x44a222)[_0xcde2('0x29')](_0x207a12);}};}function respondWithFilteredResult(_0xcadb2,_0x5a5b92){return function(_0x2d1d17){if(_0x2d1d17){var _0x45275a=_0x2d1d17[_0xcde2('0x2a')],_0x1dce65=_0x5a5b92[_0xcde2('0x2b')],_0x513965=_0x5a5b92[_0xcde2('0x2b')]+_0x5a5b92[_0xcde2('0x2c')],_0x2487eb;if(_0x513965>=_0x45275a){_0x513965=_0x45275a;_0x2487eb=0xc8;}else{_0x2487eb=0xce;}_0xcadb2[_0xcde2('0x28')](_0x2487eb);return _0xcadb2[_0xcde2('0x2d')](_0xcde2('0x2e'),_0x1dce65+'-'+_0x513965+'/'+_0x45275a)['json'](_0x2d1d17);}return null;};}function patchUpdates(_0x3c3c01){return function(_0x4a0826){try{jsonpatch[_0xcde2('0x2f')](_0x4a0826,_0x3c3c01,!![]);}catch(_0xb87851){return BPromise[_0xcde2('0x30')](_0xb87851);}return _0x4a0826['save']();};}function saveUpdates(_0xae46dc,_0x28fedd){return function(_0x58afb1){if(_0x58afb1){return _0x58afb1[_0xcde2('0x31')](_0xae46dc)[_0xcde2('0x1d')](function(_0x11471e){return _0x11471e;});}return null;};}function removeEntity(_0x2b2ea1,_0x14f784){return function(_0xb689cd){if(_0xb689cd){return _0xb689cd[_0xcde2('0x32')]()[_0xcde2('0x1d')](function(){_0x2b2ea1['status'](0xcc)[_0xcde2('0x33')]();});}};}function handleEntityNotFound(_0x6fda22,_0x21b7bd){return function(_0x15bd3e){if(!_0x15bd3e){_0x6fda22['sendStatus'](0x194);}return _0x15bd3e;};}function handleError(_0x2ae8e0,_0x42a21b){_0x42a21b=_0x42a21b||0x1f4;return function(_0x2e14f8){logger[_0xcde2('0x22')](_0x2e14f8['stack']);if(_0x2e14f8[_0xcde2('0x34')]){delete _0x2e14f8[_0xcde2('0x34')];}_0x2ae8e0[_0xcde2('0x28')](_0x42a21b)[_0xcde2('0x35')](_0x2e14f8);};}exports['index']=function(_0xb9c8d2,_0x5ab40f){var _0xbde4f4={},_0x3090b6={},_0x1646a6={'count':0x0,'rows':[]};var _0x49d8d7=db[_0xcde2('0x36')][_0xcde2('0x37')];_0x3090b6[_0xcde2('0x38')]=_[_0xcde2('0x39')](_0x49d8d7);_0x3090b6['query']=_['keys'](_0xb9c8d2[_0xcde2('0x3a')]);_0x3090b6[_0xcde2('0x3b')]=_[_0xcde2('0x3c')](_0x3090b6[_0xcde2('0x38')],_0x3090b6[_0xcde2('0x3a')]);_0xbde4f4[_0xcde2('0x3d')]=_[_0xcde2('0x3c')](_0x3090b6[_0xcde2('0x38')],qs[_0xcde2('0x3e')](_0xb9c8d2['query'][_0xcde2('0x3e')]));_0xbde4f4[_0xcde2('0x3d')]=_0xbde4f4[_0xcde2('0x3d')][_0xcde2('0x3f')]?_0xbde4f4[_0xcde2('0x3d')]:_0x3090b6['model'];if(!_0xb9c8d2['query'][_0xcde2('0x40')](_0xcde2('0x41'))){_0xbde4f4[_0xcde2('0x2c')]=qs[_0xcde2('0x2c')](_0xb9c8d2[_0xcde2('0x3a')][_0xcde2('0x2c')]);_0xbde4f4['offset']=qs['offset'](_0xb9c8d2['query'][_0xcde2('0x2b')]);}_0xbde4f4[_0xcde2('0x42')]=qs[_0xcde2('0x43')](_0xb9c8d2[_0xcde2('0x3a')][_0xcde2('0x43')]);_0xbde4f4[_0xcde2('0x44')]=qs[_0xcde2('0x3b')](_['pick'](_0xb9c8d2['query'],_0x3090b6[_0xcde2('0x3b')]));if(_0xb9c8d2['query'][_0xcde2('0x45')]){_0xbde4f4['where']=_[_0xcde2('0x46')](_0xbde4f4[_0xcde2('0x44')],{'$or':_[_0xcde2('0x47')](_0x49d8d7,function(_0x5ea9a9){if(_0x5ea9a9[_0xcde2('0x48')]['key']!==_0xcde2('0x49')){var _0x24a46a={};_0x24a46a[_0x5ea9a9[_0xcde2('0x4a')]]={'$like':'%'+_0xb9c8d2[_0xcde2('0x3a')][_0xcde2('0x45')]+'%'};return _0x24a46a;}})});}_0xbde4f4=_[_0xcde2('0x46')]({},_0xbde4f4,_0xb9c8d2['options']);var _0x4adc78={'where':_0xbde4f4[_0xcde2('0x44')]};return db['DeskAccount']['count'](_0x4adc78)[_0xcde2('0x1d')](function(_0x57b689){_0x1646a6[_0xcde2('0x2a')]=_0x57b689;if(_0xb9c8d2[_0xcde2('0x3a')]['includeAll']){_0xbde4f4[_0xcde2('0x4b')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0xbde4f4);})[_0xcde2('0x1d')](function(_0x289936){_0x1646a6['rows']=_0x289936;return _0x1646a6;})[_0xcde2('0x1d')](respondWithFilteredResult(_0x5ab40f,_0xbde4f4))['catch'](handleError(_0x5ab40f,null));};exports[_0xcde2('0x4c')]=function(_0x59129,_0x2d7b55){var _0x411103={'raw':![],'where':{'id':_0x59129['params']['id']}},_0x181b81={};_0x181b81[_0xcde2('0x38')]=_[_0xcde2('0x39')](db[_0xcde2('0x36')][_0xcde2('0x37')]);_0x181b81['query']=_['keys'](_0x59129[_0xcde2('0x3a')]);_0x181b81['filters']=_[_0xcde2('0x3c')](_0x181b81[_0xcde2('0x38')],_0x181b81[_0xcde2('0x3a')]);_0x411103[_0xcde2('0x3d')]=_[_0xcde2('0x3c')](_0x181b81[_0xcde2('0x38')],qs['fields'](_0x59129[_0xcde2('0x3a')]['fields']));_0x411103[_0xcde2('0x3d')]=_0x411103['attributes'][_0xcde2('0x3f')]?_0x411103[_0xcde2('0x3d')]:_0x181b81[_0xcde2('0x38')];if(_0x59129[_0xcde2('0x3a')][_0xcde2('0x4d')]){_0x411103[_0xcde2('0x4b')]=[{'all':!![]}];}_0x411103=_['merge']({},_0x411103,_0x59129[_0xcde2('0x4e')]);return db['DeskAccount'][_0xcde2('0x4f')](_0x411103)[_0xcde2('0x1d')](handleEntityNotFound(_0x2d7b55,null))[_0xcde2('0x1d')](respondWithResult(_0x2d7b55,null))[_0xcde2('0x26')](handleError(_0x2d7b55,null));};exports[_0xcde2('0x50')]=function(_0x9067c8,_0x3a0760){return db[_0xcde2('0x36')][_0xcde2('0x50')](_0x9067c8[_0xcde2('0x51')],{})[_0xcde2('0x1d')](respondWithResult(_0x3a0760,0xc9))[_0xcde2('0x26')](handleError(_0x3a0760,null));};exports['update']=function(_0x53bd70,_0x487565){if(_0x53bd70[_0xcde2('0x51')]['id']){delete _0x53bd70['body']['id'];}return db[_0xcde2('0x36')][_0xcde2('0x4f')]({'where':{'id':_0x53bd70[_0xcde2('0x52')]['id']}})['then'](handleEntityNotFound(_0x487565,null))[_0xcde2('0x1d')](saveUpdates(_0x53bd70['body'],null))[_0xcde2('0x1d')](respondWithResult(_0x487565,null))['catch'](handleError(_0x487565,null));};exports[_0xcde2('0x32')]=function(_0x10d6ab,_0x50d2bf){return db[_0xcde2('0x36')]['find']({'where':{'id':_0x10d6ab['params']['id']}})[_0xcde2('0x1d')](handleEntityNotFound(_0x50d2bf,null))[_0xcde2('0x1d')](removeEntity(_0x50d2bf,null))[_0xcde2('0x26')](handleError(_0x50d2bf,null));};exports[_0xcde2('0x53')]=function(_0x149e83,_0x3787b5,_0x522c37){var _0x47329f={};var _0x44b3fb={};var _0x21b4e6;var _0x145b4a;return db[_0xcde2('0x36')][_0xcde2('0x54')]({'where':{'id':_0x149e83['params']['id']}})['then'](handleEntityNotFound(_0x3787b5,null))[_0xcde2('0x1d')](function(_0x35c6e5){if(_0x35c6e5){_0x21b4e6=_0x35c6e5;_0x44b3fb[_0xcde2('0x38')]=_[_0xcde2('0x39')](db['DeskConfiguration'][_0xcde2('0x37')]);_0x44b3fb[_0xcde2('0x3a')]=_[_0xcde2('0x39')](_0x149e83[_0xcde2('0x3a')]);_0x44b3fb[_0xcde2('0x3b')]=_[_0xcde2('0x3c')](_0x44b3fb['model'],_0x44b3fb[_0xcde2('0x3a')]);_0x47329f[_0xcde2('0x3d')]=_['intersection'](_0x44b3fb[_0xcde2('0x38')],qs[_0xcde2('0x3e')](_0x149e83[_0xcde2('0x3a')][_0xcde2('0x3e')]));_0x47329f[_0xcde2('0x3d')]=_0x47329f[_0xcde2('0x3d')][_0xcde2('0x3f')]?_0x47329f[_0xcde2('0x3d')]:_0x44b3fb[_0xcde2('0x38')];_0x47329f[_0xcde2('0x42')]=qs['sort'](_0x149e83[_0xcde2('0x3a')][_0xcde2('0x43')]);_0x47329f['where']=qs[_0xcde2('0x3b')](_[_0xcde2('0x55')](_0x149e83[_0xcde2('0x3a')],_0x44b3fb['filters']));if(_0x149e83[_0xcde2('0x3a')][_0xcde2('0x45')]){_0x47329f[_0xcde2('0x44')]=_[_0xcde2('0x46')](_0x47329f[_0xcde2('0x44')],{'$or':_[_0xcde2('0x47')](_0x47329f[_0xcde2('0x3d')],function(_0x45bd76){var _0x857e85={};_0x857e85[_0x45bd76]={'$like':'%'+_0x149e83[_0xcde2('0x3a')][_0xcde2('0x45')]+'%'};return _0x857e85;})});}_0x47329f=_['merge']({},_0x47329f,_0x149e83['options']);return _0x21b4e6[_0xcde2('0x53')](_0x47329f);}})[_0xcde2('0x1d')](function(_0x1c9fbb){if(_0x1c9fbb){_0x145b4a=_0x1c9fbb['length'];if(!_0x149e83['query']['hasOwnProperty'](_0xcde2('0x41'))){_0x47329f[_0xcde2('0x2c')]=qs[_0xcde2('0x2c')](_0x149e83[_0xcde2('0x3a')][_0xcde2('0x2c')]);_0x47329f[_0xcde2('0x2b')]=qs['offset'](_0x149e83['query'][_0xcde2('0x2b')]);}return _0x21b4e6[_0xcde2('0x53')](_0x47329f);}})[_0xcde2('0x1d')](function(_0x289cd1){if(_0x289cd1){return _0x289cd1?{'count':_0x145b4a,'rows':_0x289cd1}:null;}})[_0xcde2('0x1d')](respondWithResult(_0x3787b5,null))[_0xcde2('0x26')](handleError(_0x3787b5,null));};exports[_0xcde2('0x56')]=function(_0x31234a,_0x3f0b7c,_0x2017c7){if(_0x31234a[_0xcde2('0x51')]['id']){delete _0x31234a[_0xcde2('0x51')]['id'];}return db[_0xcde2('0x36')][_0xcde2('0x54')]({'where':{'id':_0x31234a[_0xcde2('0x52')]['id']}})[_0xcde2('0x1d')](handleEntityNotFound(_0x3f0b7c,null))[_0xcde2('0x1d')](function(_0x97db81){if(_0x97db81){_0x31234a[_0xcde2('0x51')][_0xcde2('0x57')]=_0x97db81['id'];_0x31234a['body'][_0xcde2('0x58')]=integrations[_0xcde2('0x59')](_0x31234a[_0xcde2('0x51')][_0xcde2('0x5a')],_0x31234a[_0xcde2('0x51')]['type']);_0x31234a[_0xcde2('0x51')]['Descriptions']=integrations[_0xcde2('0x5b')](_0x31234a[_0xcde2('0x51')][_0xcde2('0x5a')],_0x31234a[_0xcde2('0x51')][_0xcde2('0x48')]);return db[_0xcde2('0x5c')][_0xcde2('0x50')](_0x31234a['body'],{'include':[{'model':db['DeskField'],'as':_0xcde2('0x58')},{'model':db['DeskField'],'as':_0xcde2('0x5d')}]});}return null;})[_0xcde2('0x1d')](respondWithResult(_0x3f0b7c,null))[_0xcde2('0x26')](handleError(_0x3f0b7c,null));};exports[_0xcde2('0x5e')]=function(_0x3ce6ec,_0x2ac7f1,_0x257950){var _0x4a4755=[{'name':_0xcde2('0x5f'),'label':_0xcde2('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 _0x25ee3e='';return db[_0xcde2('0x36')]['findOne']({'where':{'id':_0x3ce6ec[_0xcde2('0x52')]['id']},'attributes':['id',_0xcde2('0x60'),_0xcde2('0x61'),_0xcde2('0x62'),_0xcde2('0x63'),_0xcde2('0x64'),_0xcde2('0x65'),_0xcde2('0x66'),_0xcde2('0x67')]})[_0xcde2('0x1d')](handleEntityNotFound(_0x2ac7f1,null))[_0xcde2('0x1d')](function(_0x225ddd){if(_0x225ddd){_0x25ee3e=_0x225ddd[_0xcde2('0x60')];var _0x505e84=_0x25ee3e[_0xcde2('0x68')](-0x1);if(_0x505e84==='/'){_0x25ee3e=_0x25ee3e[_0xcde2('0x69')](0x0,_0x25ee3e[_0xcde2('0x6a')](_0x505e84));}var _0x332f32={'method':_0xcde2('0x6b'),'uri':util[_0xcde2('0x6c')](_0xcde2('0x6d'),_0x25ee3e),'headers':{'Content-Type':_0xcde2('0x6e'),'Accept':_0xcde2('0x6e')},'json':!![]};if(_0x225ddd[_0xcde2('0x61')]===_0xcde2('0x6f')){_0x332f32[_0xcde2('0x70')][_0xcde2('0x71')]=util[_0xcde2('0x6c')](_0xcde2('0x72'),new Buffer(util[_0xcde2('0x6c')]('%s:%s',_0x225ddd['username'],_0x225ddd[_0xcde2('0x63')]))[_0xcde2('0x73')](_0xcde2('0x74')));}return rp(_0x332f32)[_0xcde2('0x1d')](function(_0x4ffd32){return _0x4a4755[_0xcde2('0x75')](_['map'](_0x4ffd32[_0xcde2('0x76')]['entries'],function(_0x476e2f){return{'id':_0x476e2f[_0xcde2('0x34')],'name':_0x476e2f['name'],'type':_0x476e2f[_0xcde2('0x48')],'active':_0x476e2f[_0xcde2('0x77')],'label':_0x476e2f[_0xcde2('0x78')],'custom':!![]};}));});}})['then'](function(_0x1bbc7e){return{'count':_0x1bbc7e[_0xcde2('0x3f')],'rows':_0x1bbc7e};})[_0xcde2('0x1d')](respondWithResult(_0x2ac7f1,null))[_0xcde2('0x26')](function(_0x4b7e5f){var _0x4a1a7d=_0x3ce6ec[_0xcde2('0x3a')][_0xcde2('0x79')]?0x1f4:_0x4b7e5f[_0xcde2('0x7a')]||0x1f4;logger[_0xcde2('0x22')](_0xcde2('0x7b'),_0xcde2('0x5e'),_0x4a1a7d,JSON['stringify'](_0x4b7e5f));delete _0x4b7e5f[_0xcde2('0x34')];if(_0x4a1a7d===0x191){_0x4a1a7d=0x190;}_0x2ac7f1[_0xcde2('0x28')](_0x4a1a7d)[_0xcde2('0x35')](_0x3ce6ec[_0xcde2('0x3a')][_0xcde2('0x79')]?{'message':_0xcde2('0x7c'),'statusCode':_0x4b7e5f[_0xcde2('0x7a')]}:_0x4b7e5f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 424f0f9..ea60f76 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 _0xd98a=['DeskAccount','int_desk_accounts','lodash','api','moment','bluebird','request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x3b9182,_0x24a6d4){var _0x3113a5=function(_0x427ec1){while(--_0x427ec1){_0x3b9182['push'](_0x3b9182['shift']());}};_0x3113a5(++_0x24a6d4);}(_0xd98a,0xfc));var _0xad98=function(_0x3983fd,_0x5d142e){_0x3983fd=_0x3983fd-0x0;var _0x19c99f=_0xd98a[_0x3983fd];return _0x19c99f;};'use strict';var _=require(_0xad98('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xad98('0x1'));var moment=require(_0xad98('0x2'));var BPromise=require(_0xad98('0x3'));var rp=require(_0xad98('0x4'));var attributes=require(_0xad98('0x5'));var integrations=require(_0xad98('0x6'));module['exports']=function(_0x4bd4cf,_0x1f165f){return _0x4bd4cf[_0xad98('0x7')](_0xad98('0x8'),attributes,{'tableName':_0xad98('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2f3=['int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../components/integrations/configuration','exports','define','DeskAccount'];(function(_0x109751,_0x1c8c21){var _0x44fd3d=function(_0x77f5cb){while(--_0x77f5cb){_0x109751['push'](_0x109751['shift']());}};_0x44fd3d(++_0x1c8c21);}(_0xb2f3,0xfd));var _0x3b2f=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xb2f3[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x3b2f('0x0'));var util=require(_0x3b2f('0x1'));var logger=require(_0x3b2f('0x2'))(_0x3b2f('0x3'));var moment=require(_0x3b2f('0x4'));var BPromise=require(_0x3b2f('0x5'));var rp=require(_0x3b2f('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x3b2f('0x7'));module[_0x3b2f('0x8')]=function(_0x198dcc,_0x47559b){return _0x198dcc[_0x3b2f('0x9')](_0x3b2f('0xa'),attributes,{'tableName':_0x3b2f('0xb'),'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 d120635..a792464 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 _0xc17d=['result','catch','GetDeskAccount','findAll','options','raw','limit','map','model','include','attributes','ShowDeskAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x55074e,_0x5dd302){var _0x238b50=function(_0x496b14){while(--_0x496b14){_0x55074e['push'](_0x55074e['shift']());}};_0x238b50(++_0x5dd302);}(_0xc17d,0x96));var _0xdc17=function(_0x108989,_0x26214e){_0x108989=_0x108989-0x0;var _0x5cc5f3=_0xc17d[_0x108989];return _0x5cc5f3;};'use strict';var _=require(_0xdc17('0x0'));var util=require(_0xdc17('0x1'));var moment=require(_0xdc17('0x2'));var BPromise=require(_0xdc17('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc17('0x4'));var db=require(_0xdc17('0x5'))['db'];var utils=require(_0xdc17('0x6'));var logger=require(_0xdc17('0x7'))('rpc');var config=require(_0xdc17('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdc17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52a11b,_0x16ac50,_0x373463){return new BPromise(function(_0x53143d,_0x5ccdc5){return client[_0xdc17('0xa')](_0x52a11b,_0x373463)[_0xdc17('0xb')](function(_0x17c626){logger[_0xdc17('0xc')](_0xdc17('0xd'),_0x16ac50,_0xdc17('0xe'));logger[_0xdc17('0xf')](_0xdc17('0x10'),_0x16ac50,'request\x20sent',JSON[_0xdc17('0x11')](_0x17c626));if(_0x17c626[_0xdc17('0x12')]){if(_0x17c626[_0xdc17('0x12')]['code']===0x1f4){logger[_0xdc17('0x12')]('DeskAccount,\x20%s,\x20%s',_0x16ac50,_0x17c626[_0xdc17('0x12')][_0xdc17('0x13')]);return _0x5ccdc5(_0x17c626['error'][_0xdc17('0x13')]);}logger[_0xdc17('0x12')]('DeskAccount,\x20%s,\x20%s',_0x16ac50,_0x17c626[_0xdc17('0x12')]['message']);return _0x53143d(_0x17c626[_0xdc17('0x12')][_0xdc17('0x13')]);}else{logger['info'](_0xdc17('0xd'),_0x16ac50,_0xdc17('0xe'));_0x53143d(_0x17c626[_0xdc17('0x14')][_0xdc17('0x13')]);}})[_0xdc17('0x15')](function(_0x3adc90){logger['error'](_0xdc17('0xd'),_0x16ac50,_0x3adc90);_0x5ccdc5(_0x3adc90);});});}exports[_0xdc17('0x16')]=function(_0x1ac85b){var _0x3f578b=this;return new Promise(function(_0x172a20,_0x2dee2f){return db['DeskAccount'][_0xdc17('0x17')]({'raw':_0x1ac85b[_0xdc17('0x18')]?_0x1ac85b[_0xdc17('0x18')][_0xdc17('0x19')]===undefined?!![]:![]:!![],'where':_0x1ac85b[_0xdc17('0x18')]?_0x1ac85b[_0xdc17('0x18')]['where']||null:null,'attributes':_0x1ac85b[_0xdc17('0x18')]?_0x1ac85b[_0xdc17('0x18')]['attributes']||null:null,'limit':_0x1ac85b[_0xdc17('0x18')]?_0x1ac85b[_0xdc17('0x18')][_0xdc17('0x1a')]||null:null,'include':_0x1ac85b[_0xdc17('0x18')]?_0x1ac85b[_0xdc17('0x18')]['include']?_[_0xdc17('0x1b')](_0x1ac85b[_0xdc17('0x18')]['include'],function(_0x5c01aa){return{'model':db[_0x5c01aa[_0xdc17('0x1c')]],'as':_0x5c01aa['as'],'attributes':_0x5c01aa['attributes'],'include':_0x5c01aa[_0xdc17('0x1d')]?_['map'](_0x5c01aa[_0xdc17('0x1d')],function(_0x519795){return{'model':db[_0x519795['model']],'as':_0x519795['as'],'attributes':_0x519795[_0xdc17('0x1e')],'include':_0x519795[_0xdc17('0x1d')]?_[_0xdc17('0x1b')](_0x519795[_0xdc17('0x1d')],function(_0x3a9fc9){return{'model':db[_0x3a9fc9[_0xdc17('0x1c')]],'as':_0x3a9fc9['as'],'attributes':_0x3a9fc9[_0xdc17('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdc17('0xb')](function(_0x20f45b){logger['info'](_0xdc17('0x16'),_0x1ac85b);logger['debug'](_0xdc17('0x16'),_0x1ac85b,JSON[_0xdc17('0x11')](_0x20f45b));_0x172a20(_0x20f45b);})[_0xdc17('0x15')](function(_0x49fd56){logger[_0xdc17('0x12')](_0xdc17('0x16'),_0x49fd56['message'],_0x1ac85b);_0x2dee2f(_0x3f578b[_0xdc17('0x12')](0x1f4,_0x49fd56['message']));});});};exports[_0xdc17('0x1f')]=function(_0x593265){var _0x4ca89b=this;return new Promise(function(_0x1863da,_0x4eec9c){return db['DeskAccount'][_0xdc17('0x20')]({'raw':_0x593265[_0xdc17('0x18')]?_0x593265['options']['raw']===undefined?!![]:![]:!![],'where':_0x593265['options']?_0x593265['options'][_0xdc17('0x21')]||null:null,'attributes':_0x593265['options']?_0x593265['options']['attributes']||null:null,'include':_0x593265[_0xdc17('0x18')]?_0x593265['options'][_0xdc17('0x1d')]?_[_0xdc17('0x1b')](_0x593265[_0xdc17('0x18')]['include'],function(_0x3b00b9){return{'model':db[_0x3b00b9['model']],'as':_0x3b00b9['as'],'attributes':_0x3b00b9[_0xdc17('0x1e')],'include':_0x3b00b9[_0xdc17('0x1d')]?_[_0xdc17('0x1b')](_0x3b00b9[_0xdc17('0x1d')],function(_0x23db10){return{'model':db[_0x23db10[_0xdc17('0x1c')]],'as':_0x23db10['as'],'attributes':_0x23db10[_0xdc17('0x1e')],'include':_0x23db10[_0xdc17('0x1d')]?_[_0xdc17('0x1b')](_0x23db10[_0xdc17('0x1d')],function(_0x4a8b51){return{'model':db[_0x4a8b51[_0xdc17('0x1c')]],'as':_0x4a8b51['as'],'attributes':_0x4a8b51[_0xdc17('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdc17('0xb')](function(_0x58a564){logger[_0xdc17('0xc')](_0xdc17('0x1f'),_0x593265);logger[_0xdc17('0xf')](_0xdc17('0x1f'),_0x593265,JSON[_0xdc17('0x11')](_0x58a564));_0x1863da(_0x58a564);})[_0xdc17('0x15')](function(_0x1b34a8){logger[_0xdc17('0x12')](_0xdc17('0x1f'),_0x1b34a8[_0xdc17('0x13')],_0x593265);_0x4eec9c(_0x4ca89b[_0xdc17('0x12')](0x1f4,_0x1b34a8[_0xdc17('0x13')]));});});}; \ No newline at end of file +var _0x8cce=['raw','where','include','model','attributes','map','then','GetDeskAccount','ShowDeskAccount','find','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options'];(function(_0x53e974,_0x136aae){var _0x134a33=function(_0xc60a0b){while(--_0xc60a0b){_0x53e974['push'](_0x53e974['shift']());}};_0x134a33(++_0x136aae);}(_0x8cce,0xd6));var _0xe8cc=function(_0x387b33,_0x1cb999){_0x387b33=_0x387b33-0x0;var _0x53d1b2=_0x8cce[_0x387b33];return _0x53d1b2;};'use strict';var _=require('lodash');var util=require(_0xe8cc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe8cc('0x1'));var fs=require('fs');var Redis=require(_0xe8cc('0x2'));var db=require(_0xe8cc('0x3'))['db'];var utils=require(_0xe8cc('0x4'));var logger=require(_0xe8cc('0x5'))(_0xe8cc('0x6'));var config=require(_0xe8cc('0x7'));var jayson=require(_0xe8cc('0x8'));var client=jayson[_0xe8cc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bec94,_0x53bdb0,_0x57c54c){return new BPromise(function(_0x4ef8ab,_0x9a03a5){return client[_0xe8cc('0xa')](_0x1bec94,_0x57c54c)['then'](function(_0x1a6a2b){logger['info'](_0xe8cc('0xb'),_0x53bdb0,_0xe8cc('0xc'));logger[_0xe8cc('0xd')](_0xe8cc('0xe'),_0x53bdb0,_0xe8cc('0xc'),JSON[_0xe8cc('0xf')](_0x1a6a2b));if(_0x1a6a2b['error']){if(_0x1a6a2b[_0xe8cc('0x10')][_0xe8cc('0x11')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x53bdb0,_0x1a6a2b[_0xe8cc('0x10')]['message']);return _0x9a03a5(_0x1a6a2b['error'][_0xe8cc('0x12')]);}logger['error'](_0xe8cc('0xb'),_0x53bdb0,_0x1a6a2b[_0xe8cc('0x10')][_0xe8cc('0x12')]);return _0x4ef8ab(_0x1a6a2b['error'][_0xe8cc('0x12')]);}else{logger[_0xe8cc('0x13')](_0xe8cc('0xb'),_0x53bdb0,_0xe8cc('0xc'));_0x4ef8ab(_0x1a6a2b[_0xe8cc('0x14')][_0xe8cc('0x12')]);}})[_0xe8cc('0x15')](function(_0x3678d5){logger[_0xe8cc('0x10')](_0xe8cc('0xb'),_0x53bdb0,_0x3678d5);_0x9a03a5(_0x3678d5);});});}exports['GetDeskAccount']=function(_0x53656f){var _0x3a087a=this;return new Promise(function(_0xb703cc,_0x515e87){return db['DeskAccount'][_0xe8cc('0x16')]({'raw':_0x53656f[_0xe8cc('0x17')]?_0x53656f[_0xe8cc('0x17')][_0xe8cc('0x18')]===undefined?!![]:![]:!![],'where':_0x53656f[_0xe8cc('0x17')]?_0x53656f[_0xe8cc('0x17')][_0xe8cc('0x19')]||null:null,'attributes':_0x53656f[_0xe8cc('0x17')]?_0x53656f['options']['attributes']||null:null,'limit':_0x53656f[_0xe8cc('0x17')]?_0x53656f['options']['limit']||null:null,'include':_0x53656f[_0xe8cc('0x17')]?_0x53656f[_0xe8cc('0x17')][_0xe8cc('0x1a')]?_['map'](_0x53656f[_0xe8cc('0x17')][_0xe8cc('0x1a')],function(_0x2360ce){return{'model':db[_0x2360ce[_0xe8cc('0x1b')]],'as':_0x2360ce['as'],'attributes':_0x2360ce[_0xe8cc('0x1c')],'include':_0x2360ce[_0xe8cc('0x1a')]?_[_0xe8cc('0x1d')](_0x2360ce[_0xe8cc('0x1a')],function(_0x58cd29){return{'model':db[_0x58cd29[_0xe8cc('0x1b')]],'as':_0x58cd29['as'],'attributes':_0x58cd29[_0xe8cc('0x1c')],'include':_0x58cd29[_0xe8cc('0x1a')]?_[_0xe8cc('0x1d')](_0x58cd29[_0xe8cc('0x1a')],function(_0x2709b4){return{'model':db[_0x2709b4[_0xe8cc('0x1b')]],'as':_0x2709b4['as'],'attributes':_0x2709b4[_0xe8cc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe8cc('0x1e')](function(_0x3a69fe){logger[_0xe8cc('0x13')](_0xe8cc('0x1f'),_0x53656f);logger[_0xe8cc('0xd')](_0xe8cc('0x1f'),_0x53656f,JSON['stringify'](_0x3a69fe));_0xb703cc(_0x3a69fe);})[_0xe8cc('0x15')](function(_0x278b5a){logger['error'](_0xe8cc('0x1f'),_0x278b5a[_0xe8cc('0x12')],_0x53656f);_0x515e87(_0x3a087a[_0xe8cc('0x10')](0x1f4,_0x278b5a[_0xe8cc('0x12')]));});});};exports[_0xe8cc('0x20')]=function(_0x45a0a2){var _0xdc9b1b=this;return new Promise(function(_0x407137,_0x2bab8d){return db['DeskAccount'][_0xe8cc('0x21')]({'raw':_0x45a0a2[_0xe8cc('0x17')]?_0x45a0a2[_0xe8cc('0x17')][_0xe8cc('0x18')]===undefined?!![]:![]:!![],'where':_0x45a0a2[_0xe8cc('0x17')]?_0x45a0a2[_0xe8cc('0x17')][_0xe8cc('0x19')]||null:null,'attributes':_0x45a0a2[_0xe8cc('0x17')]?_0x45a0a2[_0xe8cc('0x17')][_0xe8cc('0x1c')]||null:null,'include':_0x45a0a2[_0xe8cc('0x17')]?_0x45a0a2[_0xe8cc('0x17')]['include']?_['map'](_0x45a0a2['options']['include'],function(_0x7a468e){return{'model':db[_0x7a468e[_0xe8cc('0x1b')]],'as':_0x7a468e['as'],'attributes':_0x7a468e[_0xe8cc('0x1c')],'include':_0x7a468e['include']?_[_0xe8cc('0x1d')](_0x7a468e[_0xe8cc('0x1a')],function(_0x1d1fb9){return{'model':db[_0x1d1fb9[_0xe8cc('0x1b')]],'as':_0x1d1fb9['as'],'attributes':_0x1d1fb9['attributes'],'include':_0x1d1fb9[_0xe8cc('0x1a')]?_['map'](_0x1d1fb9[_0xe8cc('0x1a')],function(_0x17a9e8){return{'model':db[_0x17a9e8['model']],'as':_0x17a9e8['as'],'attributes':_0x17a9e8[_0xe8cc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe8cc('0x1e')](function(_0x3595b7){logger['info'](_0xe8cc('0x20'),_0x45a0a2);logger[_0xe8cc('0xd')]('ShowDeskAccount',_0x45a0a2,JSON[_0xe8cc('0xf')](_0x3595b7));_0x407137(_0x3595b7);})[_0xe8cc('0x15')](function(_0x3f3093){logger[_0xe8cc('0x10')](_0xe8cc('0x20'),_0x3f3093[_0xe8cc('0x12')],_0x45a0a2);_0x2bab8d(_0xdc9b1b[_0xe8cc('0x10')](0x1f4,_0x3f3093[_0xe8cc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index fca94d8..d3343fc 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 _0x2168=['../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','post','put','delete','destroy','exports','util','path','express','Router','../../components/auth/service'];(function(_0x4d20c0,_0x33210c){var _0x1afcc3=function(_0x1fcc87){while(--_0x1fcc87){_0x4d20c0['push'](_0x4d20c0['shift']());}};_0x1afcc3(++_0x33210c);}(_0x2168,0x187));var _0x8216=function(_0x392c8f,_0x7e7b00){_0x392c8f=_0x392c8f-0x0;var _0x4507d2=_0x2168[_0x392c8f];return _0x4507d2;};'use strict';var multer=require('multer');var util=require(_0x8216('0x0'));var path=require(_0x8216('0x1'));var timeout=require('connect-timeout');var express=require(_0x8216('0x2'));var router=express[_0x8216('0x3')]();var auth=require(_0x8216('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8216('0x5'));var controller=require(_0x8216('0x6'));router['get']('/',auth[_0x8216('0x7')](),controller[_0x8216('0x8')]);router[_0x8216('0x9')](_0x8216('0xa'),auth['isAuthenticated'](),controller[_0x8216('0xb')]);router[_0x8216('0x9')](_0x8216('0xc'),auth[_0x8216('0x7')](),controller[_0x8216('0xd')]);router[_0x8216('0x9')](_0x8216('0xe'),auth[_0x8216('0x7')](),controller[_0x8216('0xf')]);router[_0x8216('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x8216('0x9')](_0x8216('0x10'),auth[_0x8216('0x7')](),controller['getTags']);router[_0x8216('0x11')]('/',auth[_0x8216('0x7')](),controller['create']);router[_0x8216('0x11')](_0x8216('0x10'),auth['isAuthenticated'](),controller['setTags']);router[_0x8216('0x12')](_0x8216('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x8216('0x13')]('/:id',auth[_0x8216('0x7')](),controller[_0x8216('0x14')]);module[_0x8216('0x15')]=router; \ No newline at end of file +var _0xad7a=['../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','delete','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x13ae66,_0x2f8ada){var _0x2688b8=function(_0x8152dc){while(--_0x8152dc){_0x13ae66['push'](_0x13ae66['shift']());}};_0x2688b8(++_0x2f8ada);}(_0xad7a,0xa3));var _0xaad7=function(_0x4eb960,_0x2e59c0){_0x4eb960=_0x4eb960-0x0;var _0x43b3d5=_0xad7a[_0x4eb960];return _0x43b3d5;};'use strict';var multer=require('multer');var util=require(_0xaad7('0x0'));var path=require(_0xaad7('0x1'));var timeout=require('connect-timeout');var express=require(_0xaad7('0x2'));var router=express['Router']();var auth=require(_0xaad7('0x3'));var interaction=require(_0xaad7('0x4'));var config=require(_0xaad7('0x5'));var controller=require(_0xaad7('0x6'));router['get']('/',auth[_0xaad7('0x7')](),controller[_0xaad7('0x8')]);router['get'](_0xaad7('0x9'),auth[_0xaad7('0x7')](),controller[_0xaad7('0xa')]);router[_0xaad7('0xb')](_0xaad7('0xc'),auth[_0xaad7('0x7')](),controller['getFields']);router[_0xaad7('0xb')](_0xaad7('0xd'),auth[_0xaad7('0x7')](),controller['getSubjects']);router[_0xaad7('0xb')](_0xaad7('0xe'),auth[_0xaad7('0x7')](),controller[_0xaad7('0xf')]);router[_0xaad7('0xb')](_0xaad7('0x10'),auth[_0xaad7('0x7')](),controller['getTags']);router[_0xaad7('0x11')]('/',auth[_0xaad7('0x7')](),controller[_0xaad7('0x12')]);router['post'](_0xaad7('0x10'),auth[_0xaad7('0x7')](),controller['setTags']);router[_0xaad7('0x13')](_0xaad7('0x9'),auth[_0xaad7('0x7')](),controller['update']);router[_0xaad7('0x14')](_0xaad7('0x9'),auth['isAuthenticated'](),controller['destroy']);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 d68b69c..5fed34c 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 _0x4996=['STRING','sequelize','exports'];(function(_0x2c8aac,_0x5b3d24){var _0x5b13e9=function(_0x3cd535){while(--_0x3cd535){_0x2c8aac['push'](_0x2c8aac['shift']());}};_0x5b13e9(++_0x5b3d24);}(_0x4996,0x106));var _0x6499=function(_0x1cbecb,_0x505e33){_0x1cbecb=_0x1cbecb-0x0;var _0x4112c4=_0x4996[_0x1cbecb];return _0x4112c4;};'use strict';var Sequelize=require(_0x6499('0x0'));module[_0x6499('0x1')]={'name':{'type':Sequelize[_0x6499('0x2')]},'description':{'type':Sequelize[_0x6499('0x2')]}}; \ No newline at end of file +var _0xb5c3=['sequelize','STRING'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0xb5c3,0x16a));var _0x3b5c=function(_0x20433c,_0x10f2b7){_0x20433c=_0x20433c-0x0;var _0x488c4f=_0xb5c3[_0x20433c];return _0x488c4f;};'use strict';var Sequelize=require(_0x3b5c('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b5c('0x1')]},'description':{'type':Sequelize[_0x3b5c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f90bf9f..babe0b2 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 _0xca66=['destroy','stack','name','index','DeskConfiguration','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filters','filter','merge','where','type','key','VIRTUAL','field','findAll','rows','params','rawAttributes','includeAll','include','options','find','create','body','getFields','DeskField','nolimit','getSubjects','map','getDescriptions','getTags','findOne','Tag','setTags','ids','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update'];(function(_0x946a1b,_0x17725a){var _0x2d6986=function(_0x43612a){while(--_0x43612a){_0x946a1b['push'](_0x946a1b['shift']());}};_0x2d6986(++_0x17725a);}(_0xca66,0x8b));var _0x6ca6=function(_0x3ccfda,_0x2271ec){_0x3ccfda=_0x3ccfda-0x0;var _0x53bc42=_0xca66[_0x3ccfda];return _0x53bc42;};'use strict';var pdf=require(_0x6ca6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ca6('0x1'));var jsonpatch=require(_0x6ca6('0x2'));var rp=require(_0x6ca6('0x3'));var moment=require('moment');var BPromise=require(_0x6ca6('0x4'));var Mustache=require('mustache');var util=require(_0x6ca6('0x5'));var path=require('path');var sox=require(_0x6ca6('0x6'));var csv=require(_0x6ca6('0x7'));var ejs=require(_0x6ca6('0x8'));var fs=require('fs');var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x7'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var authService=require(_0x6ca6('0xf'));var hardwareService=require(_0x6ca6('0x10'));var Redis=require(_0x6ca6('0x11'));var qs=require(_0x6ca6('0x12'));var logger=require('../../config/logger')(_0x6ca6('0x13'));var utils=require(_0x6ca6('0x14'));var config=require(_0x6ca6('0x15'));var db=require(_0x6ca6('0x16'))['db'];var jayson=require(_0x6ca6('0x17'));var client=jayson[_0x6ca6('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x152e63,_0x38de67,_0x55238b,_0x412986){return new BPromise(function(_0x29c7d3,_0x3f417f){var _0x3570f1=_0x412986||client;return _0x3570f1[_0x6ca6('0x19')](_0x152e63,_0x55238b)[_0x6ca6('0x1a')](function(_0x4c053a){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x38de67,_0x6ca6('0x1b'));logger[_0x6ca6('0x1c')](_0x6ca6('0x1d'),_0x38de67,_0x6ca6('0x1b'),JSON[_0x6ca6('0x1e')](_0x4c053a));if(_0x4c053a[_0x6ca6('0x1f')]){if(_0x4c053a[_0x6ca6('0x1f')]['code']===0x1f4){logger[_0x6ca6('0x1f')](_0x6ca6('0x20'),_0x38de67,_0x4c053a[_0x6ca6('0x1f')][_0x6ca6('0x21')]);return _0x3f417f(_0x4c053a[_0x6ca6('0x1f')][_0x6ca6('0x21')]);}logger[_0x6ca6('0x1f')](_0x6ca6('0x20'),_0x38de67,_0x4c053a[_0x6ca6('0x1f')][_0x6ca6('0x21')]);return _0x29c7d3(_0x4c053a[_0x6ca6('0x1f')]['message']);}else{logger[_0x6ca6('0x22')](_0x6ca6('0x20'),_0x38de67,_0x6ca6('0x1b'));_0x29c7d3(_0x4c053a[_0x6ca6('0x23')][_0x6ca6('0x21')]);}})[_0x6ca6('0x24')](function(_0x593f15){logger[_0x6ca6('0x1f')](_0x6ca6('0x20'),_0x38de67,_0x593f15);_0x3f417f(_0x593f15);});});}function respondWithStatusCode(_0x4bbe69,_0x4927c1){_0x4927c1=_0x4927c1||0xcc;return function(_0xfbf496){if(_0xfbf496){return _0x4bbe69[_0x6ca6('0x25')](_0x4927c1);}return _0x4bbe69[_0x6ca6('0x26')](_0x4927c1)[_0x6ca6('0x27')]();};}function respondWithResult(_0xf9c138,_0x541122){_0x541122=_0x541122||0xc8;return function(_0x222373){if(_0x222373){return _0xf9c138[_0x6ca6('0x26')](_0x541122)[_0x6ca6('0x28')](_0x222373);}};}function respondWithFilteredResult(_0x2d8c64,_0x3971a2){return function(_0x29f37e){if(_0x29f37e){var _0x3c32ae=_0x29f37e[_0x6ca6('0x29')],_0x2a1e2d=_0x3971a2[_0x6ca6('0x2a')],_0x516daf=_0x3971a2[_0x6ca6('0x2a')]+_0x3971a2[_0x6ca6('0x2b')],_0x55b07f;if(_0x516daf>=_0x3c32ae){_0x516daf=_0x3c32ae;_0x55b07f=0xc8;}else{_0x55b07f=0xce;}_0x2d8c64['status'](_0x55b07f);return _0x2d8c64['set'](_0x6ca6('0x2c'),_0x2a1e2d+'-'+_0x516daf+'/'+_0x3c32ae)['json'](_0x29f37e);}return null;};}function patchUpdates(_0x4ab84c){return function(_0x141e78){try{jsonpatch[_0x6ca6('0x2d')](_0x141e78,_0x4ab84c,!![]);}catch(_0x4a15cb){return BPromise[_0x6ca6('0x2e')](_0x4a15cb);}return _0x141e78[_0x6ca6('0x2f')]();};}function saveUpdates(_0xac50e8,_0x566543){return function(_0x484411){if(_0x484411){return _0x484411[_0x6ca6('0x30')](_0xac50e8)[_0x6ca6('0x1a')](function(_0x35fbb5){return _0x35fbb5;});}return null;};}function removeEntity(_0x18ec16,_0x480264){return function(_0x467a89){if(_0x467a89){return _0x467a89[_0x6ca6('0x31')]()[_0x6ca6('0x1a')](function(){_0x18ec16[_0x6ca6('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ca7bc,_0x4bb0cd){return function(_0x56dd6a){if(!_0x56dd6a){_0x5ca7bc['sendStatus'](0x194);}return _0x56dd6a;};}function handleError(_0x1c3505,_0x3389c2){_0x3389c2=_0x3389c2||0x1f4;return function(_0x138cce){logger['error'](_0x138cce[_0x6ca6('0x32')]);if(_0x138cce[_0x6ca6('0x33')]){delete _0x138cce[_0x6ca6('0x33')];}_0x1c3505[_0x6ca6('0x26')](_0x3389c2)['send'](_0x138cce);};}exports[_0x6ca6('0x34')]=function(_0x40de00,_0x437396){var _0x3fac33={},_0x4da670={},_0x1e28b4={'count':0x0,'rows':[]};var _0x5ed76a=db[_0x6ca6('0x35')]['rawAttributes'];_0x4da670['model']=_[_0x6ca6('0x36')](_0x5ed76a);_0x4da670[_0x6ca6('0x37')]=_[_0x6ca6('0x36')](_0x40de00[_0x6ca6('0x37')]);_0x4da670['filters']=_['intersection'](_0x4da670[_0x6ca6('0x38')],_0x4da670[_0x6ca6('0x37')]);_0x3fac33['attributes']=_[_0x6ca6('0x39')](_0x4da670['model'],qs[_0x6ca6('0x3a')](_0x40de00['query'][_0x6ca6('0x3a')]));_0x3fac33[_0x6ca6('0x3b')]=_0x3fac33[_0x6ca6('0x3b')][_0x6ca6('0x3c')]?_0x3fac33[_0x6ca6('0x3b')]:_0x4da670[_0x6ca6('0x38')];if(!_0x40de00[_0x6ca6('0x37')][_0x6ca6('0x3d')]('nolimit')){_0x3fac33[_0x6ca6('0x2b')]=qs['limit'](_0x40de00['query'][_0x6ca6('0x2b')]);_0x3fac33[_0x6ca6('0x2a')]=qs['offset'](_0x40de00[_0x6ca6('0x37')]['offset']);}_0x3fac33[_0x6ca6('0x3e')]=qs[_0x6ca6('0x3f')](_0x40de00[_0x6ca6('0x37')][_0x6ca6('0x3f')]);_0x3fac33['where']=qs['filters'](_[_0x6ca6('0x40')](_0x40de00[_0x6ca6('0x37')],_0x4da670[_0x6ca6('0x41')]));if(_0x40de00[_0x6ca6('0x37')][_0x6ca6('0x42')]){_0x3fac33['where']=_[_0x6ca6('0x43')](_0x3fac33[_0x6ca6('0x44')],{'$or':_['map'](_0x5ed76a,function(_0x317b5e){if(_0x317b5e[_0x6ca6('0x45')][_0x6ca6('0x46')]!==_0x6ca6('0x47')){var _0x1c516e={};_0x1c516e[_0x317b5e[_0x6ca6('0x48')]]={'$like':'%'+_0x40de00[_0x6ca6('0x37')][_0x6ca6('0x42')]+'%'};return _0x1c516e;}})});}_0x3fac33=_[_0x6ca6('0x43')]({},_0x3fac33,_0x40de00['options']);var _0x193aaf={'where':_0x3fac33[_0x6ca6('0x44')]};return db[_0x6ca6('0x35')][_0x6ca6('0x29')](_0x193aaf)[_0x6ca6('0x1a')](function(_0x7bd90e){_0x1e28b4[_0x6ca6('0x29')]=_0x7bd90e;if(_0x40de00[_0x6ca6('0x37')]['includeAll']){_0x3fac33['include']=[{'all':!![]}];}return db[_0x6ca6('0x35')][_0x6ca6('0x49')](_0x3fac33);})[_0x6ca6('0x1a')](function(_0x31edd4){_0x1e28b4[_0x6ca6('0x4a')]=_0x31edd4;return _0x1e28b4;})[_0x6ca6('0x1a')](respondWithFilteredResult(_0x437396,_0x3fac33))[_0x6ca6('0x24')](handleError(_0x437396,null));};exports['show']=function(_0x4b0188,_0x309ed1){var _0x42b263={'raw':![],'where':{'id':_0x4b0188[_0x6ca6('0x4b')]['id']}},_0x4bb86a={};_0x4bb86a[_0x6ca6('0x38')]=_[_0x6ca6('0x36')](db[_0x6ca6('0x35')][_0x6ca6('0x4c')]);_0x4bb86a[_0x6ca6('0x37')]=_[_0x6ca6('0x36')](_0x4b0188['query']);_0x4bb86a[_0x6ca6('0x41')]=_[_0x6ca6('0x39')](_0x4bb86a[_0x6ca6('0x38')],_0x4bb86a['query']);_0x42b263[_0x6ca6('0x3b')]=_['intersection'](_0x4bb86a[_0x6ca6('0x38')],qs['fields'](_0x4b0188['query']['fields']));_0x42b263[_0x6ca6('0x3b')]=_0x42b263[_0x6ca6('0x3b')][_0x6ca6('0x3c')]?_0x42b263['attributes']:_0x4bb86a[_0x6ca6('0x38')];if(_0x4b0188['query'][_0x6ca6('0x4d')]){_0x42b263[_0x6ca6('0x4e')]=[{'all':!![]}];}_0x42b263=_[_0x6ca6('0x43')]({},_0x42b263,_0x4b0188[_0x6ca6('0x4f')]);return db[_0x6ca6('0x35')][_0x6ca6('0x50')](_0x42b263)[_0x6ca6('0x1a')](handleEntityNotFound(_0x309ed1,null))[_0x6ca6('0x1a')](respondWithResult(_0x309ed1,null))[_0x6ca6('0x24')](handleError(_0x309ed1,null));};exports[_0x6ca6('0x51')]=function(_0x321f41,_0x5578fb){return db[_0x6ca6('0x35')][_0x6ca6('0x51')](_0x321f41[_0x6ca6('0x52')],{})[_0x6ca6('0x1a')](respondWithResult(_0x5578fb,0xc9))[_0x6ca6('0x24')](handleError(_0x5578fb,null));};exports['update']=function(_0x14d87a,_0x3fc861){if(_0x14d87a[_0x6ca6('0x52')]['id']){delete _0x14d87a['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x14d87a['params']['id']}})[_0x6ca6('0x1a')](handleEntityNotFound(_0x3fc861,null))[_0x6ca6('0x1a')](saveUpdates(_0x14d87a[_0x6ca6('0x52')],null))['then'](respondWithResult(_0x3fc861,null))['catch'](handleError(_0x3fc861,null));};exports[_0x6ca6('0x31')]=function(_0x2cbf30,_0x2591de){return db['DeskConfiguration'][_0x6ca6('0x50')]({'where':{'id':_0x2cbf30['params']['id']}})[_0x6ca6('0x1a')](handleEntityNotFound(_0x2591de,null))[_0x6ca6('0x1a')](removeEntity(_0x2591de,null))[_0x6ca6('0x24')](handleError(_0x2591de,null));};exports[_0x6ca6('0x53')]=function(_0x511eb1,_0x106f63,_0x4874d8){var _0x521dda={};var _0x2b1022={};var _0x11538e;var _0x1b9da5;return db[_0x6ca6('0x35')]['findOne']({'where':{'id':_0x511eb1[_0x6ca6('0x4b')]['id']}})[_0x6ca6('0x1a')](handleEntityNotFound(_0x106f63,null))[_0x6ca6('0x1a')](function(_0x13d3ea){if(_0x13d3ea){_0x11538e=_0x13d3ea;_0x2b1022[_0x6ca6('0x38')]=_[_0x6ca6('0x36')](db[_0x6ca6('0x54')][_0x6ca6('0x4c')]);_0x2b1022[_0x6ca6('0x37')]=_[_0x6ca6('0x36')](_0x511eb1[_0x6ca6('0x37')]);_0x2b1022[_0x6ca6('0x41')]=_[_0x6ca6('0x39')](_0x2b1022[_0x6ca6('0x38')],_0x2b1022[_0x6ca6('0x37')]);_0x521dda[_0x6ca6('0x3b')]=_['intersection'](_0x2b1022[_0x6ca6('0x38')],qs[_0x6ca6('0x3a')](_0x511eb1[_0x6ca6('0x37')][_0x6ca6('0x3a')]));_0x521dda[_0x6ca6('0x3b')]=_0x521dda[_0x6ca6('0x3b')][_0x6ca6('0x3c')]?_0x521dda[_0x6ca6('0x3b')]:_0x2b1022[_0x6ca6('0x38')];_0x521dda[_0x6ca6('0x3e')]=qs[_0x6ca6('0x3f')](_0x511eb1[_0x6ca6('0x37')][_0x6ca6('0x3f')]);_0x521dda[_0x6ca6('0x44')]=qs[_0x6ca6('0x41')](_[_0x6ca6('0x40')](_0x511eb1['query'],_0x2b1022[_0x6ca6('0x41')]));if(_0x511eb1[_0x6ca6('0x37')][_0x6ca6('0x42')]){_0x521dda[_0x6ca6('0x44')]=_[_0x6ca6('0x43')](_0x521dda[_0x6ca6('0x44')],{'$or':_['map'](_0x521dda['attributes'],function(_0x509fe3){var _0x21f786={};_0x21f786[_0x509fe3]={'$like':'%'+_0x511eb1[_0x6ca6('0x37')]['filter']+'%'};return _0x21f786;})});}_0x521dda=_[_0x6ca6('0x43')]({},_0x521dda,_0x511eb1[_0x6ca6('0x4f')]);return _0x11538e[_0x6ca6('0x53')](_0x521dda);}})['then'](function(_0x4250a1){if(_0x4250a1){_0x1b9da5=_0x4250a1[_0x6ca6('0x3c')];if(!_0x511eb1[_0x6ca6('0x37')][_0x6ca6('0x3d')](_0x6ca6('0x55'))){_0x521dda['limit']=qs['limit'](_0x511eb1[_0x6ca6('0x37')][_0x6ca6('0x2b')]);_0x521dda['offset']=qs[_0x6ca6('0x2a')](_0x511eb1[_0x6ca6('0x37')][_0x6ca6('0x2a')]);}return _0x11538e[_0x6ca6('0x53')](_0x521dda);}})[_0x6ca6('0x1a')](function(_0x3f5a53){if(_0x3f5a53){return _0x3f5a53?{'count':_0x1b9da5,'rows':_0x3f5a53}:null;}})[_0x6ca6('0x1a')](respondWithResult(_0x106f63,null))[_0x6ca6('0x24')](handleError(_0x106f63,null));};exports[_0x6ca6('0x56')]=function(_0x498c32,_0x4d6098,_0x9d788f){var _0x30bed2={};var _0x3f22b3={};var _0x3124f8;var _0x3c5f6e;return db[_0x6ca6('0x35')]['findOne']({'where':{'id':_0x498c32[_0x6ca6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d6098,null))[_0x6ca6('0x1a')](function(_0x44bbe6){if(_0x44bbe6){_0x3124f8=_0x44bbe6;_0x3f22b3[_0x6ca6('0x38')]=_[_0x6ca6('0x36')](db[_0x6ca6('0x54')]['rawAttributes']);_0x3f22b3['query']=_[_0x6ca6('0x36')](_0x498c32[_0x6ca6('0x37')]);_0x3f22b3[_0x6ca6('0x41')]=_['intersection'](_0x3f22b3[_0x6ca6('0x38')],_0x3f22b3[_0x6ca6('0x37')]);_0x30bed2[_0x6ca6('0x3b')]=_[_0x6ca6('0x39')](_0x3f22b3['model'],qs[_0x6ca6('0x3a')](_0x498c32[_0x6ca6('0x37')][_0x6ca6('0x3a')]));_0x30bed2['attributes']=_0x30bed2[_0x6ca6('0x3b')]['length']?_0x30bed2[_0x6ca6('0x3b')]:_0x3f22b3[_0x6ca6('0x38')];_0x30bed2[_0x6ca6('0x3e')]=qs[_0x6ca6('0x3f')](_0x498c32[_0x6ca6('0x37')][_0x6ca6('0x3f')]);_0x30bed2[_0x6ca6('0x44')]=qs['filters'](_['pick'](_0x498c32[_0x6ca6('0x37')],_0x3f22b3[_0x6ca6('0x41')]));if(_0x498c32[_0x6ca6('0x37')]['filter']){_0x30bed2[_0x6ca6('0x44')]=_[_0x6ca6('0x43')](_0x30bed2[_0x6ca6('0x44')],{'$or':_[_0x6ca6('0x57')](_0x30bed2[_0x6ca6('0x3b')],function(_0x299b87){var _0x5ceb48={};_0x5ceb48[_0x299b87]={'$like':'%'+_0x498c32['query'][_0x6ca6('0x42')]+'%'};return _0x5ceb48;})});}_0x30bed2=_['merge']({},_0x30bed2,_0x498c32[_0x6ca6('0x4f')]);return _0x3124f8[_0x6ca6('0x56')](_0x30bed2);}})[_0x6ca6('0x1a')](function(_0x40fa47){if(_0x40fa47){_0x3c5f6e=_0x40fa47[_0x6ca6('0x3c')];if(!_0x498c32[_0x6ca6('0x37')][_0x6ca6('0x3d')]('nolimit')){_0x30bed2[_0x6ca6('0x2b')]=qs[_0x6ca6('0x2b')](_0x498c32[_0x6ca6('0x37')][_0x6ca6('0x2b')]);_0x30bed2['offset']=qs['offset'](_0x498c32['query'][_0x6ca6('0x2a')]);}return _0x3124f8[_0x6ca6('0x56')](_0x30bed2);}})[_0x6ca6('0x1a')](function(_0x150c18){if(_0x150c18){return _0x150c18?{'count':_0x3c5f6e,'rows':_0x150c18}:null;}})[_0x6ca6('0x1a')](respondWithResult(_0x4d6098,null))['catch'](handleError(_0x4d6098,null));};exports[_0x6ca6('0x58')]=function(_0x52e2c7,_0x5b3a9d,_0x233193){var _0x33791f={};var _0x44fe6a={};var _0x527a99;var _0x4269a9;return db[_0x6ca6('0x35')]['findOne']({'where':{'id':_0x52e2c7[_0x6ca6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b3a9d,null))[_0x6ca6('0x1a')](function(_0x2c9dc7){if(_0x2c9dc7){_0x527a99=_0x2c9dc7;_0x44fe6a[_0x6ca6('0x38')]=_[_0x6ca6('0x36')](db[_0x6ca6('0x54')]['rawAttributes']);_0x44fe6a[_0x6ca6('0x37')]=_['keys'](_0x52e2c7[_0x6ca6('0x37')]);_0x44fe6a[_0x6ca6('0x41')]=_[_0x6ca6('0x39')](_0x44fe6a['model'],_0x44fe6a['query']);_0x33791f[_0x6ca6('0x3b')]=_[_0x6ca6('0x39')](_0x44fe6a[_0x6ca6('0x38')],qs[_0x6ca6('0x3a')](_0x52e2c7[_0x6ca6('0x37')][_0x6ca6('0x3a')]));_0x33791f[_0x6ca6('0x3b')]=_0x33791f[_0x6ca6('0x3b')]['length']?_0x33791f[_0x6ca6('0x3b')]:_0x44fe6a[_0x6ca6('0x38')];_0x33791f[_0x6ca6('0x3e')]=qs[_0x6ca6('0x3f')](_0x52e2c7[_0x6ca6('0x37')][_0x6ca6('0x3f')]);_0x33791f[_0x6ca6('0x44')]=qs[_0x6ca6('0x41')](_[_0x6ca6('0x40')](_0x52e2c7[_0x6ca6('0x37')],_0x44fe6a['filters']));if(_0x52e2c7[_0x6ca6('0x37')][_0x6ca6('0x42')]){_0x33791f[_0x6ca6('0x44')]=_[_0x6ca6('0x43')](_0x33791f[_0x6ca6('0x44')],{'$or':_[_0x6ca6('0x57')](_0x33791f['attributes'],function(_0x365982){var _0x440e29={};_0x440e29[_0x365982]={'$like':'%'+_0x52e2c7[_0x6ca6('0x37')]['filter']+'%'};return _0x440e29;})});}_0x33791f=_[_0x6ca6('0x43')]({},_0x33791f,_0x52e2c7['options']);return _0x527a99[_0x6ca6('0x58')](_0x33791f);}})[_0x6ca6('0x1a')](function(_0x435e0d){if(_0x435e0d){_0x4269a9=_0x435e0d['length'];if(!_0x52e2c7[_0x6ca6('0x37')]['hasOwnProperty'](_0x6ca6('0x55'))){_0x33791f['limit']=qs['limit'](_0x52e2c7[_0x6ca6('0x37')][_0x6ca6('0x2b')]);_0x33791f[_0x6ca6('0x2a')]=qs[_0x6ca6('0x2a')](_0x52e2c7[_0x6ca6('0x37')]['offset']);}return _0x527a99[_0x6ca6('0x58')](_0x33791f);}})[_0x6ca6('0x1a')](function(_0x1d61a1){if(_0x1d61a1){return _0x1d61a1?{'count':_0x4269a9,'rows':_0x1d61a1}:null;}})[_0x6ca6('0x1a')](respondWithResult(_0x5b3a9d,null))[_0x6ca6('0x24')](handleError(_0x5b3a9d,null));};exports[_0x6ca6('0x59')]=function(_0x5e6f79,_0x18cb5a,_0x63b513){var _0x2ff069={};var _0x17c63e={};var _0x57d4e0;var _0x11f4e4;return db['DeskConfiguration'][_0x6ca6('0x5a')]({'where':{'id':_0x5e6f79['params']['id']}})[_0x6ca6('0x1a')](handleEntityNotFound(_0x18cb5a,null))[_0x6ca6('0x1a')](function(_0x239cf5){if(_0x239cf5){_0x57d4e0=_0x239cf5;_0x17c63e['model']=_[_0x6ca6('0x36')](db[_0x6ca6('0x5b')]['rawAttributes']);_0x17c63e[_0x6ca6('0x37')]=_['keys'](_0x5e6f79[_0x6ca6('0x37')]);_0x17c63e[_0x6ca6('0x41')]=_[_0x6ca6('0x39')](_0x17c63e['model'],_0x17c63e[_0x6ca6('0x37')]);_0x2ff069['attributes']=_[_0x6ca6('0x39')](_0x17c63e['model'],qs[_0x6ca6('0x3a')](_0x5e6f79[_0x6ca6('0x37')]['fields']));_0x2ff069[_0x6ca6('0x3b')]=_0x2ff069[_0x6ca6('0x3b')]['length']?_0x2ff069[_0x6ca6('0x3b')]:_0x17c63e[_0x6ca6('0x38')];_0x2ff069[_0x6ca6('0x3e')]=qs[_0x6ca6('0x3f')](_0x5e6f79[_0x6ca6('0x37')][_0x6ca6('0x3f')]);_0x2ff069[_0x6ca6('0x44')]=qs[_0x6ca6('0x41')](_['pick'](_0x5e6f79[_0x6ca6('0x37')],_0x17c63e['filters']));if(_0x5e6f79[_0x6ca6('0x37')]['filter']){_0x2ff069['where']=_[_0x6ca6('0x43')](_0x2ff069[_0x6ca6('0x44')],{'$or':_['map'](_0x2ff069[_0x6ca6('0x3b')],function(_0x480962){var _0x575777={};_0x575777[_0x480962]={'$like':'%'+_0x5e6f79[_0x6ca6('0x37')][_0x6ca6('0x42')]+'%'};return _0x575777;})});}_0x2ff069=_[_0x6ca6('0x43')]({},_0x2ff069,_0x5e6f79[_0x6ca6('0x4f')]);return _0x57d4e0[_0x6ca6('0x59')](_0x2ff069);}})[_0x6ca6('0x1a')](function(_0x1043d8){if(_0x1043d8){_0x11f4e4=_0x1043d8[_0x6ca6('0x3c')];if(!_0x5e6f79[_0x6ca6('0x37')]['hasOwnProperty'](_0x6ca6('0x55'))){_0x2ff069['limit']=qs['limit'](_0x5e6f79['query'][_0x6ca6('0x2b')]);_0x2ff069[_0x6ca6('0x2a')]=qs[_0x6ca6('0x2a')](_0x5e6f79[_0x6ca6('0x37')][_0x6ca6('0x2a')]);}return _0x57d4e0[_0x6ca6('0x59')](_0x2ff069);}})[_0x6ca6('0x1a')](function(_0x3b4fe4){if(_0x3b4fe4){return _0x3b4fe4?{'count':_0x11f4e4,'rows':_0x3b4fe4}:null;}})[_0x6ca6('0x1a')](respondWithResult(_0x18cb5a,null))[_0x6ca6('0x24')](handleError(_0x18cb5a,null));};exports[_0x6ca6('0x5c')]=function(_0x2b30f5,_0x98d53c,_0x305e8e){if(_0x2b30f5[_0x6ca6('0x52')]['id']){delete _0x2b30f5[_0x6ca6('0x52')]['id'];}return db[_0x6ca6('0x35')]['findOne']({'where':{'id':_0x2b30f5['params']['id']}})[_0x6ca6('0x1a')](handleEntityNotFound(_0x98d53c,null))[_0x6ca6('0x1a')](function(_0x5634df){if(_0x5634df){return _0x5634df['setTags'](_0x2b30f5[_0x6ca6('0x52')][_0x6ca6('0x5d')]||[]);}return null;})[_0x6ca6('0x1a')](respondWithResult(_0x98d53c,null))[_0x6ca6('0x24')](handleError(_0x98d53c,null));}; \ No newline at end of file +var _0x2f68=['catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','DeskConfiguration','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','intersection','create','body','find','params','findOne','getFields','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','squel','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x33f411,_0x1533d6){var _0x5e319e=function(_0x37f6ac){while(--_0x37f6ac){_0x33f411['push'](_0x33f411['shift']());}};_0x5e319e(++_0x1533d6);}(_0x2f68,0x9a));var _0x82f6=function(_0x2f178d,_0x1658e7){_0x2f178d=_0x2f178d-0x0;var _0x2291b0=_0x2f68[_0x2f178d];return _0x2291b0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x82f6('0x0'));var rimraf=require(_0x82f6('0x1'));var zipdir=require(_0x82f6('0x2'));var jsonpatch=require(_0x82f6('0x3'));var rp=require('request-promise');var moment=require(_0x82f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x82f6('0x5'));var util=require(_0x82f6('0x6'));var path=require('path');var sox=require(_0x82f6('0x7'));var csv=require(_0x82f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x82f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82f6('0xa'));var toCsv=require(_0x82f6('0x8'));var querystring=require(_0x82f6('0xb'));var Papa=require('papaparse');var authService=require(_0x82f6('0xc'));var hardwareService=require(_0x82f6('0xd'));var Redis=require('ioredis');var qs=require(_0x82f6('0xe'));var logger=require(_0x82f6('0xf'))(_0x82f6('0x10'));var utils=require(_0x82f6('0x11'));var config=require(_0x82f6('0x12'));var db=require(_0x82f6('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x82f6('0x14')][_0x82f6('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x4cc967,_0x194da7,_0x1f8bf5,_0x397527){return new BPromise(function(_0x465e5d,_0x371481){var _0xa00275=_0x397527||client;return _0xa00275[_0x82f6('0x16')](_0x4cc967,_0x1f8bf5)[_0x82f6('0x17')](function(_0x1e7cbc){logger['info'](_0x82f6('0x18'),_0x194da7,'request\x20sent');logger[_0x82f6('0x19')](_0x82f6('0x1a'),_0x194da7,_0x82f6('0x1b'),JSON[_0x82f6('0x1c')](_0x1e7cbc));if(_0x1e7cbc[_0x82f6('0x1d')]){if(_0x1e7cbc[_0x82f6('0x1d')][_0x82f6('0x1e')]===0x1f4){logger[_0x82f6('0x1d')](_0x82f6('0x18'),_0x194da7,_0x1e7cbc[_0x82f6('0x1d')][_0x82f6('0x1f')]);return _0x371481(_0x1e7cbc[_0x82f6('0x1d')][_0x82f6('0x1f')]);}logger[_0x82f6('0x1d')](_0x82f6('0x18'),_0x194da7,_0x1e7cbc['error'][_0x82f6('0x1f')]);return _0x465e5d(_0x1e7cbc[_0x82f6('0x1d')]['message']);}else{logger[_0x82f6('0x20')](_0x82f6('0x18'),_0x194da7,_0x82f6('0x1b'));_0x465e5d(_0x1e7cbc[_0x82f6('0x21')]['message']);}})[_0x82f6('0x22')](function(_0x4beccf){logger[_0x82f6('0x1d')](_0x82f6('0x18'),_0x194da7,_0x4beccf);_0x371481(_0x4beccf);});});}function respondWithStatusCode(_0x573a46,_0x516deb){_0x516deb=_0x516deb||0xcc;return function(_0x3af5f7){if(_0x3af5f7){return _0x573a46[_0x82f6('0x23')](_0x516deb);}return _0x573a46['status'](_0x516deb)['end']();};}function respondWithResult(_0x9f2272,_0x31face){_0x31face=_0x31face||0xc8;return function(_0x4fbd92){if(_0x4fbd92){return _0x9f2272[_0x82f6('0x24')](_0x31face)[_0x82f6('0x25')](_0x4fbd92);}};}function respondWithFilteredResult(_0x5037f8,_0x57ac0d){return function(_0x1c165b){if(_0x1c165b){var _0x5187d0=_0x1c165b[_0x82f6('0x26')],_0x469b6b=_0x57ac0d[_0x82f6('0x27')],_0x5a6d69=_0x57ac0d[_0x82f6('0x27')]+_0x57ac0d[_0x82f6('0x28')],_0x54ce11;if(_0x5a6d69>=_0x5187d0){_0x5a6d69=_0x5187d0;_0x54ce11=0xc8;}else{_0x54ce11=0xce;}_0x5037f8['status'](_0x54ce11);return _0x5037f8[_0x82f6('0x29')](_0x82f6('0x2a'),_0x469b6b+'-'+_0x5a6d69+'/'+_0x5187d0)[_0x82f6('0x25')](_0x1c165b);}return null;};}function patchUpdates(_0x400137){return function(_0x271c28){try{jsonpatch[_0x82f6('0x2b')](_0x271c28,_0x400137,!![]);}catch(_0x27e473){return BPromise[_0x82f6('0x2c')](_0x27e473);}return _0x271c28[_0x82f6('0x2d')]();};}function saveUpdates(_0x402449,_0x3c9419){return function(_0x20d1c5){if(_0x20d1c5){return _0x20d1c5[_0x82f6('0x2e')](_0x402449)[_0x82f6('0x17')](function(_0x51e080){return _0x51e080;});}return null;};}function removeEntity(_0x3bbf5c,_0x2c764f){return function(_0x418f34){if(_0x418f34){return _0x418f34['destroy']()[_0x82f6('0x17')](function(){_0x3bbf5c[_0x82f6('0x24')](0xcc)[_0x82f6('0x2f')]();});}};}function handleEntityNotFound(_0x3da5a9,_0x41cd65){return function(_0x457f09){if(!_0x457f09){_0x3da5a9[_0x82f6('0x23')](0x194);}return _0x457f09;};}function handleError(_0x299c36,_0x4756ee){_0x4756ee=_0x4756ee||0x1f4;return function(_0x2958fe){logger[_0x82f6('0x1d')](_0x2958fe[_0x82f6('0x30')]);if(_0x2958fe[_0x82f6('0x31')]){delete _0x2958fe[_0x82f6('0x31')];}_0x299c36['status'](_0x4756ee)[_0x82f6('0x32')](_0x2958fe);};}exports[_0x82f6('0x33')]=function(_0x1c6ce4,_0x276451){var _0xa9bd0={},_0x4390a9={},_0x34c2f1={'count':0x0,'rows':[]};var _0x383987=db[_0x82f6('0x34')][_0x82f6('0x35')];_0x4390a9[_0x82f6('0x36')]=_[_0x82f6('0x37')](_0x383987);_0x4390a9[_0x82f6('0x38')]=_[_0x82f6('0x37')](_0x1c6ce4['query']);_0x4390a9[_0x82f6('0x39')]=_['intersection'](_0x4390a9['model'],_0x4390a9[_0x82f6('0x38')]);_0xa9bd0[_0x82f6('0x3a')]=_['intersection'](_0x4390a9[_0x82f6('0x36')],qs[_0x82f6('0x3b')](_0x1c6ce4[_0x82f6('0x38')]['fields']));_0xa9bd0[_0x82f6('0x3a')]=_0xa9bd0['attributes'][_0x82f6('0x3c')]?_0xa9bd0['attributes']:_0x4390a9[_0x82f6('0x36')];if(!_0x1c6ce4['query'][_0x82f6('0x3d')](_0x82f6('0x3e'))){_0xa9bd0['limit']=qs[_0x82f6('0x28')](_0x1c6ce4[_0x82f6('0x38')][_0x82f6('0x28')]);_0xa9bd0[_0x82f6('0x27')]=qs['offset'](_0x1c6ce4[_0x82f6('0x38')][_0x82f6('0x27')]);}_0xa9bd0[_0x82f6('0x3f')]=qs[_0x82f6('0x40')](_0x1c6ce4['query'][_0x82f6('0x40')]);_0xa9bd0[_0x82f6('0x41')]=qs['filters'](_[_0x82f6('0x42')](_0x1c6ce4[_0x82f6('0x38')],_0x4390a9[_0x82f6('0x39')]));if(_0x1c6ce4[_0x82f6('0x38')][_0x82f6('0x43')]){_0xa9bd0['where']=_[_0x82f6('0x44')](_0xa9bd0['where'],{'$or':_[_0x82f6('0x45')](_0x383987,function(_0x38e82d){if(_0x38e82d[_0x82f6('0x46')][_0x82f6('0x47')]!==_0x82f6('0x48')){var _0x293002={};_0x293002[_0x38e82d[_0x82f6('0x49')]]={'$like':'%'+_0x1c6ce4['query'][_0x82f6('0x43')]+'%'};return _0x293002;}})});}_0xa9bd0=_[_0x82f6('0x44')]({},_0xa9bd0,_0x1c6ce4[_0x82f6('0x4a')]);var _0x1dc2a8={'where':_0xa9bd0['where']};return db[_0x82f6('0x34')]['count'](_0x1dc2a8)[_0x82f6('0x17')](function(_0x186f5d){_0x34c2f1[_0x82f6('0x26')]=_0x186f5d;if(_0x1c6ce4[_0x82f6('0x38')][_0x82f6('0x4b')]){_0xa9bd0[_0x82f6('0x4c')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x82f6('0x4d')](_0xa9bd0);})[_0x82f6('0x17')](function(_0x14a3c4){_0x34c2f1[_0x82f6('0x4e')]=_0x14a3c4;return _0x34c2f1;})[_0x82f6('0x17')](respondWithFilteredResult(_0x276451,_0xa9bd0))[_0x82f6('0x22')](handleError(_0x276451,null));};exports[_0x82f6('0x4f')]=function(_0x33e630,_0x529780){var _0x43b92e={'raw':![],'where':{'id':_0x33e630['params']['id']}},_0x26131b={};_0x26131b[_0x82f6('0x36')]=_['keys'](db[_0x82f6('0x34')]['rawAttributes']);_0x26131b[_0x82f6('0x38')]=_[_0x82f6('0x37')](_0x33e630[_0x82f6('0x38')]);_0x26131b[_0x82f6('0x39')]=_[_0x82f6('0x50')](_0x26131b[_0x82f6('0x36')],_0x26131b['query']);_0x43b92e[_0x82f6('0x3a')]=_[_0x82f6('0x50')](_0x26131b['model'],qs['fields'](_0x33e630[_0x82f6('0x38')][_0x82f6('0x3b')]));_0x43b92e[_0x82f6('0x3a')]=_0x43b92e['attributes'][_0x82f6('0x3c')]?_0x43b92e[_0x82f6('0x3a')]:_0x26131b[_0x82f6('0x36')];if(_0x33e630[_0x82f6('0x38')]['includeAll']){_0x43b92e['include']=[{'all':!![]}];}_0x43b92e=_[_0x82f6('0x44')]({},_0x43b92e,_0x33e630[_0x82f6('0x4a')]);return db[_0x82f6('0x34')]['find'](_0x43b92e)[_0x82f6('0x17')](handleEntityNotFound(_0x529780,null))[_0x82f6('0x17')](respondWithResult(_0x529780,null))['catch'](handleError(_0x529780,null));};exports['create']=function(_0x4fa2ca,_0x2e6b03){return db['DeskConfiguration'][_0x82f6('0x51')](_0x4fa2ca['body'],{})[_0x82f6('0x17')](respondWithResult(_0x2e6b03,0xc9))['catch'](handleError(_0x2e6b03,null));};exports[_0x82f6('0x2e')]=function(_0x58f89b,_0x4d28a9){if(_0x58f89b[_0x82f6('0x52')]['id']){delete _0x58f89b[_0x82f6('0x52')]['id'];}return db[_0x82f6('0x34')][_0x82f6('0x53')]({'where':{'id':_0x58f89b[_0x82f6('0x54')]['id']}})['then'](handleEntityNotFound(_0x4d28a9,null))[_0x82f6('0x17')](saveUpdates(_0x58f89b[_0x82f6('0x52')],null))[_0x82f6('0x17')](respondWithResult(_0x4d28a9,null))['catch'](handleError(_0x4d28a9,null));};exports['destroy']=function(_0x13406f,_0x81e595){return db[_0x82f6('0x34')][_0x82f6('0x53')]({'where':{'id':_0x13406f['params']['id']}})[_0x82f6('0x17')](handleEntityNotFound(_0x81e595,null))[_0x82f6('0x17')](removeEntity(_0x81e595,null))[_0x82f6('0x22')](handleError(_0x81e595,null));};exports['getFields']=function(_0x5435bc,_0x5f0801,_0x44218c){var _0x310c9b={};var _0x221cfc={};var _0x59176d;var _0x4013f0;return db[_0x82f6('0x34')][_0x82f6('0x55')]({'where':{'id':_0x5435bc[_0x82f6('0x54')]['id']}})['then'](handleEntityNotFound(_0x5f0801,null))[_0x82f6('0x17')](function(_0x94aed4){if(_0x94aed4){_0x59176d=_0x94aed4;_0x221cfc[_0x82f6('0x36')]=_[_0x82f6('0x37')](db['DeskField']['rawAttributes']);_0x221cfc[_0x82f6('0x38')]=_[_0x82f6('0x37')](_0x5435bc['query']);_0x221cfc[_0x82f6('0x39')]=_[_0x82f6('0x50')](_0x221cfc[_0x82f6('0x36')],_0x221cfc['query']);_0x310c9b[_0x82f6('0x3a')]=_[_0x82f6('0x50')](_0x221cfc[_0x82f6('0x36')],qs[_0x82f6('0x3b')](_0x5435bc[_0x82f6('0x38')][_0x82f6('0x3b')]));_0x310c9b['attributes']=_0x310c9b[_0x82f6('0x3a')][_0x82f6('0x3c')]?_0x310c9b[_0x82f6('0x3a')]:_0x221cfc[_0x82f6('0x36')];_0x310c9b[_0x82f6('0x3f')]=qs['sort'](_0x5435bc[_0x82f6('0x38')][_0x82f6('0x40')]);_0x310c9b[_0x82f6('0x41')]=qs[_0x82f6('0x39')](_[_0x82f6('0x42')](_0x5435bc[_0x82f6('0x38')],_0x221cfc[_0x82f6('0x39')]));if(_0x5435bc[_0x82f6('0x38')]['filter']){_0x310c9b[_0x82f6('0x41')]=_['merge'](_0x310c9b[_0x82f6('0x41')],{'$or':_[_0x82f6('0x45')](_0x310c9b['attributes'],function(_0x843458){var _0x32e43d={};_0x32e43d[_0x843458]={'$like':'%'+_0x5435bc[_0x82f6('0x38')]['filter']+'%'};return _0x32e43d;})});}_0x310c9b=_['merge']({},_0x310c9b,_0x5435bc[_0x82f6('0x4a')]);return _0x59176d[_0x82f6('0x56')](_0x310c9b);}})['then'](function(_0x4fdbdf){if(_0x4fdbdf){_0x4013f0=_0x4fdbdf[_0x82f6('0x3c')];if(!_0x5435bc[_0x82f6('0x38')][_0x82f6('0x3d')](_0x82f6('0x3e'))){_0x310c9b[_0x82f6('0x28')]=qs[_0x82f6('0x28')](_0x5435bc[_0x82f6('0x38')][_0x82f6('0x28')]);_0x310c9b[_0x82f6('0x27')]=qs[_0x82f6('0x27')](_0x5435bc[_0x82f6('0x38')][_0x82f6('0x27')]);}return _0x59176d['getFields'](_0x310c9b);}})[_0x82f6('0x17')](function(_0x16776e){if(_0x16776e){return _0x16776e?{'count':_0x4013f0,'rows':_0x16776e}:null;}})[_0x82f6('0x17')](respondWithResult(_0x5f0801,null))[_0x82f6('0x22')](handleError(_0x5f0801,null));};exports[_0x82f6('0x57')]=function(_0x4ef838,_0x1135a6,_0x46d5af){var _0x337050={};var _0x566192={};var _0x9b60c8;var _0x192dc7;return db[_0x82f6('0x34')][_0x82f6('0x55')]({'where':{'id':_0x4ef838[_0x82f6('0x54')]['id']}})[_0x82f6('0x17')](handleEntityNotFound(_0x1135a6,null))[_0x82f6('0x17')](function(_0x579a2c){if(_0x579a2c){_0x9b60c8=_0x579a2c;_0x566192[_0x82f6('0x36')]=_['keys'](db[_0x82f6('0x58')][_0x82f6('0x35')]);_0x566192[_0x82f6('0x38')]=_[_0x82f6('0x37')](_0x4ef838[_0x82f6('0x38')]);_0x566192[_0x82f6('0x39')]=_[_0x82f6('0x50')](_0x566192[_0x82f6('0x36')],_0x566192[_0x82f6('0x38')]);_0x337050['attributes']=_[_0x82f6('0x50')](_0x566192[_0x82f6('0x36')],qs[_0x82f6('0x3b')](_0x4ef838[_0x82f6('0x38')][_0x82f6('0x3b')]));_0x337050[_0x82f6('0x3a')]=_0x337050['attributes'][_0x82f6('0x3c')]?_0x337050[_0x82f6('0x3a')]:_0x566192['model'];_0x337050['order']=qs[_0x82f6('0x40')](_0x4ef838[_0x82f6('0x38')][_0x82f6('0x40')]);_0x337050[_0x82f6('0x41')]=qs[_0x82f6('0x39')](_[_0x82f6('0x42')](_0x4ef838['query'],_0x566192[_0x82f6('0x39')]));if(_0x4ef838['query'][_0x82f6('0x43')]){_0x337050['where']=_[_0x82f6('0x44')](_0x337050['where'],{'$or':_[_0x82f6('0x45')](_0x337050[_0x82f6('0x3a')],function(_0x203168){var _0x584f76={};_0x584f76[_0x203168]={'$like':'%'+_0x4ef838[_0x82f6('0x38')]['filter']+'%'};return _0x584f76;})});}_0x337050=_[_0x82f6('0x44')]({},_0x337050,_0x4ef838[_0x82f6('0x4a')]);return _0x9b60c8[_0x82f6('0x57')](_0x337050);}})['then'](function(_0x2646b2){if(_0x2646b2){_0x192dc7=_0x2646b2[_0x82f6('0x3c')];if(!_0x4ef838[_0x82f6('0x38')]['hasOwnProperty']('nolimit')){_0x337050[_0x82f6('0x28')]=qs[_0x82f6('0x28')](_0x4ef838[_0x82f6('0x38')][_0x82f6('0x28')]);_0x337050[_0x82f6('0x27')]=qs[_0x82f6('0x27')](_0x4ef838[_0x82f6('0x38')][_0x82f6('0x27')]);}return _0x9b60c8['getSubjects'](_0x337050);}})[_0x82f6('0x17')](function(_0x34de40){if(_0x34de40){return _0x34de40?{'count':_0x192dc7,'rows':_0x34de40}:null;}})['then'](respondWithResult(_0x1135a6,null))[_0x82f6('0x22')](handleError(_0x1135a6,null));};exports[_0x82f6('0x59')]=function(_0x1c1901,_0x47a7f1,_0x30632b){var _0x1d3f1b={};var _0x4ede38={};var _0x2cc906;var _0x50ab5c;return db[_0x82f6('0x34')][_0x82f6('0x55')]({'where':{'id':_0x1c1901[_0x82f6('0x54')]['id']}})[_0x82f6('0x17')](handleEntityNotFound(_0x47a7f1,null))[_0x82f6('0x17')](function(_0x4fbce1){if(_0x4fbce1){_0x2cc906=_0x4fbce1;_0x4ede38['model']=_[_0x82f6('0x37')](db[_0x82f6('0x58')][_0x82f6('0x35')]);_0x4ede38[_0x82f6('0x38')]=_[_0x82f6('0x37')](_0x1c1901['query']);_0x4ede38[_0x82f6('0x39')]=_['intersection'](_0x4ede38[_0x82f6('0x36')],_0x4ede38[_0x82f6('0x38')]);_0x1d3f1b[_0x82f6('0x3a')]=_[_0x82f6('0x50')](_0x4ede38[_0x82f6('0x36')],qs[_0x82f6('0x3b')](_0x1c1901[_0x82f6('0x38')]['fields']));_0x1d3f1b[_0x82f6('0x3a')]=_0x1d3f1b[_0x82f6('0x3a')]['length']?_0x1d3f1b[_0x82f6('0x3a')]:_0x4ede38[_0x82f6('0x36')];_0x1d3f1b[_0x82f6('0x3f')]=qs['sort'](_0x1c1901[_0x82f6('0x38')]['sort']);_0x1d3f1b[_0x82f6('0x41')]=qs[_0x82f6('0x39')](_['pick'](_0x1c1901[_0x82f6('0x38')],_0x4ede38[_0x82f6('0x39')]));if(_0x1c1901[_0x82f6('0x38')][_0x82f6('0x43')]){_0x1d3f1b['where']=_[_0x82f6('0x44')](_0x1d3f1b['where'],{'$or':_['map'](_0x1d3f1b[_0x82f6('0x3a')],function(_0x37a80f){var _0x426c85={};_0x426c85[_0x37a80f]={'$like':'%'+_0x1c1901[_0x82f6('0x38')][_0x82f6('0x43')]+'%'};return _0x426c85;})});}_0x1d3f1b=_['merge']({},_0x1d3f1b,_0x1c1901['options']);return _0x2cc906[_0x82f6('0x59')](_0x1d3f1b);}})['then'](function(_0x376b1b){if(_0x376b1b){_0x50ab5c=_0x376b1b[_0x82f6('0x3c')];if(!_0x1c1901[_0x82f6('0x38')]['hasOwnProperty'](_0x82f6('0x3e'))){_0x1d3f1b[_0x82f6('0x28')]=qs[_0x82f6('0x28')](_0x1c1901[_0x82f6('0x38')]['limit']);_0x1d3f1b[_0x82f6('0x27')]=qs[_0x82f6('0x27')](_0x1c1901[_0x82f6('0x38')][_0x82f6('0x27')]);}return _0x2cc906['getDescriptions'](_0x1d3f1b);}})['then'](function(_0x469665){if(_0x469665){return _0x469665?{'count':_0x50ab5c,'rows':_0x469665}:null;}})[_0x82f6('0x17')](respondWithResult(_0x47a7f1,null))[_0x82f6('0x22')](handleError(_0x47a7f1,null));};exports[_0x82f6('0x5a')]=function(_0x5df106,_0x147841,_0x2d2522){var _0x1bfc05={};var _0x1a4b8d={};var _0x31ff74;var _0x55fec2;return db['DeskConfiguration'][_0x82f6('0x55')]({'where':{'id':_0x5df106[_0x82f6('0x54')]['id']}})[_0x82f6('0x17')](handleEntityNotFound(_0x147841,null))[_0x82f6('0x17')](function(_0x90c55c){if(_0x90c55c){_0x31ff74=_0x90c55c;_0x1a4b8d['model']=_[_0x82f6('0x37')](db[_0x82f6('0x5b')][_0x82f6('0x35')]);_0x1a4b8d[_0x82f6('0x38')]=_[_0x82f6('0x37')](_0x5df106['query']);_0x1a4b8d['filters']=_[_0x82f6('0x50')](_0x1a4b8d['model'],_0x1a4b8d[_0x82f6('0x38')]);_0x1bfc05[_0x82f6('0x3a')]=_[_0x82f6('0x50')](_0x1a4b8d[_0x82f6('0x36')],qs[_0x82f6('0x3b')](_0x5df106['query'][_0x82f6('0x3b')]));_0x1bfc05[_0x82f6('0x3a')]=_0x1bfc05[_0x82f6('0x3a')]['length']?_0x1bfc05[_0x82f6('0x3a')]:_0x1a4b8d[_0x82f6('0x36')];_0x1bfc05['order']=qs[_0x82f6('0x40')](_0x5df106[_0x82f6('0x38')][_0x82f6('0x40')]);_0x1bfc05[_0x82f6('0x41')]=qs['filters'](_[_0x82f6('0x42')](_0x5df106[_0x82f6('0x38')],_0x1a4b8d['filters']));if(_0x5df106[_0x82f6('0x38')][_0x82f6('0x43')]){_0x1bfc05[_0x82f6('0x41')]=_[_0x82f6('0x44')](_0x1bfc05[_0x82f6('0x41')],{'$or':_[_0x82f6('0x45')](_0x1bfc05[_0x82f6('0x3a')],function(_0x4659af){var _0x5c2650={};_0x5c2650[_0x4659af]={'$like':'%'+_0x5df106[_0x82f6('0x38')]['filter']+'%'};return _0x5c2650;})});}_0x1bfc05=_[_0x82f6('0x44')]({},_0x1bfc05,_0x5df106['options']);return _0x31ff74['getTags'](_0x1bfc05);}})[_0x82f6('0x17')](function(_0x5da5c7){if(_0x5da5c7){_0x55fec2=_0x5da5c7[_0x82f6('0x3c')];if(!_0x5df106[_0x82f6('0x38')][_0x82f6('0x3d')](_0x82f6('0x3e'))){_0x1bfc05['limit']=qs[_0x82f6('0x28')](_0x5df106[_0x82f6('0x38')][_0x82f6('0x28')]);_0x1bfc05[_0x82f6('0x27')]=qs[_0x82f6('0x27')](_0x5df106[_0x82f6('0x38')]['offset']);}return _0x31ff74['getTags'](_0x1bfc05);}})[_0x82f6('0x17')](function(_0x2cde2f){if(_0x2cde2f){return _0x2cde2f?{'count':_0x55fec2,'rows':_0x2cde2f}:null;}})[_0x82f6('0x17')](respondWithResult(_0x147841,null))['catch'](handleError(_0x147841,null));};exports[_0x82f6('0x5c')]=function(_0x2169b4,_0x745ca3,_0xd71074){if(_0x2169b4[_0x82f6('0x52')]['id']){delete _0x2169b4[_0x82f6('0x52')]['id'];}return db[_0x82f6('0x34')]['findOne']({'where':{'id':_0x2169b4[_0x82f6('0x54')]['id']}})[_0x82f6('0x17')](handleEntityNotFound(_0x745ca3,null))[_0x82f6('0x17')](function(_0x38b54b){if(_0x38b54b){return _0x38b54b[_0x82f6('0x5c')](_0x2169b4['body'][_0x82f6('0x5d')]||[]);}return null;})[_0x82f6('0x17')](respondWithResult(_0x745ca3,null))[_0x82f6('0x22')](handleError(_0x745ca3,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3c0d711..c87cefb 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 _0x087b=['define','DeskConfiguration','int_desk_configurations','lodash','util','moment','request-promise','./intDeskConfiguration.attributes','exports'];(function(_0x236ed6,_0x562e24){var _0x2507e4=function(_0x1fdd4b){while(--_0x1fdd4b){_0x236ed6['push'](_0x236ed6['shift']());}};_0x2507e4(++_0x562e24);}(_0x087b,0x11a));var _0xb087=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x087b[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb087('0x2'));var BPromise=require('bluebird');var rp=require(_0xb087('0x3'));var attributes=require(_0xb087('0x4'));module[_0xb087('0x5')]=function(_0xf1cf84,_0x183efd){return _0xf1cf84[_0xb087('0x6')](_0xb087('0x7'),attributes,{'tableName':_0xb087('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea28=['request-promise','./intDeskConfiguration.attributes','define','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ba697,_0x186781){var _0x433b23=function(_0xe5df67){while(--_0xe5df67){_0x1ba697['push'](_0x1ba697['shift']());}};_0x433b23(++_0x186781);}(_0xea28,0x13a));var _0x8ea2=function(_0x397981,_0x329393){_0x397981=_0x397981-0x0;var _0x27a2ae=_0xea28[_0x397981];return _0x27a2ae;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var attributes=require(_0x8ea2('0x7'));module['exports']=function(_0x9b45ab,_0x23aaf1){return _0x9b45ab[_0x8ea2('0x8')]('DeskConfiguration',attributes,{'tableName':_0x8ea2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index e2b862f..8aaf8bf 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 _0xe2fe=['then','info','DeskConfiguration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x198ccc,_0x538804){var _0x79f72a=function(_0x5dd9cc){while(--_0x5dd9cc){_0x198ccc['push'](_0x198ccc['shift']());}};_0x79f72a(++_0x538804);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0x814b=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x814b,0x1a2));var _0xb814=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x814b[_0x2300f2];return _0x6bd508;};'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});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index dcc6517..22b6292 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 _0x54ce=['/:id','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','create','put','update','delete'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x54ce,0x92));var _0xe54c=function(_0x173a94,_0x31a6f9){_0x173a94=_0x173a94-0x0;var _0x2e798a=_0x54ce[_0x173a94];return _0x2e798a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe54c('0x0'));var router=express[_0xe54c('0x1')]();var auth=require(_0xe54c('0x2'));var interaction=require(_0xe54c('0x3'));var config=require(_0xe54c('0x4'));var controller=require(_0xe54c('0x5'));router[_0xe54c('0x6')]('/',auth[_0xe54c('0x7')](),controller[_0xe54c('0x8')]);router[_0xe54c('0x6')]('/:id',auth[_0xe54c('0x7')](),controller[_0xe54c('0x9')]);router['post']('/',auth[_0xe54c('0x7')](),controller[_0xe54c('0xa')]);router[_0xe54c('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe54c('0xc')]);router[_0xe54c('0xd')](_0xe54c('0xe'),auth[_0xe54c('0x7')](),controller['destroy']);module[_0xe54c('0xf')]=router; \ No newline at end of file +var _0xf18a=['./intDeskField.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5266dc,_0x1ca0f8){var _0x1680a3=function(_0x4fb6ac){while(--_0x4fb6ac){_0x5266dc['push'](_0x5266dc['shift']());}};_0x1680a3(++_0x1ca0f8);}(_0xf18a,0x90));var _0xaf18=function(_0x33ee71,_0x503775){_0x33ee71=_0x33ee71-0x0;var _0x3be51c=_0xf18a[_0x33ee71];return _0x3be51c;};'use strict';var multer=require(_0xaf18('0x0'));var util=require(_0xaf18('0x1'));var path=require(_0xaf18('0x2'));var timeout=require(_0xaf18('0x3'));var express=require('express');var router=express[_0xaf18('0x4')]();var auth=require(_0xaf18('0x5'));var interaction=require(_0xaf18('0x6'));var config=require(_0xaf18('0x7'));var controller=require(_0xaf18('0x8'));router['get']('/',auth[_0xaf18('0x9')](),controller[_0xaf18('0xa')]);router[_0xaf18('0xb')]('/:id',auth[_0xaf18('0x9')](),controller[_0xaf18('0xc')]);router[_0xaf18('0xd')]('/',auth[_0xaf18('0x9')](),controller[_0xaf18('0xe')]);router[_0xaf18('0xf')](_0xaf18('0x10'),auth[_0xaf18('0x9')](),controller['update']);router[_0xaf18('0x11')]('/:id',auth[_0xaf18('0x9')](),controller[_0xaf18('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 64edca4..2d26a78 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 _0xee5b=['keyValue','STRING','variable','sequelize','ENUM','string','customVariable'];(function(_0x59c584,_0x46e37d){var _0x20dfe9=function(_0x4f8ed6){while(--_0x4f8ed6){_0x59c584['push'](_0x59c584['shift']());}};_0x20dfe9(++_0x46e37d);}(_0xee5b,0x1f4));var _0xbee5=function(_0x2baad5,_0x208095){_0x2baad5=_0x2baad5-0x0;var _0x9d70b3=_0xee5b[_0x2baad5];return _0x9d70b3;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'type':{'type':Sequelize[_0xbee5('0x1')](_0xbee5('0x2'),'variable',_0xbee5('0x3'),_0xbee5('0x4')),'defaultValue':_0xbee5('0x2')},'content':{'type':Sequelize[_0xbee5('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xbee5('0x2'),_0xbee5('0x6'),_0xbee5('0x3'))},'keyContent':{'type':Sequelize[_0xbee5('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b02=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','STRING','variable'];(function(_0x1f6dd1,_0x2e5594){var _0x58fec6=function(_0x2e41ca){while(--_0x2e41ca){_0x1f6dd1['push'](_0x1f6dd1['shift']());}};_0x58fec6(++_0x2e5594);}(_0x5b02,0xe9));var _0x25b0=function(_0x1ca91d,_0x5363bb){_0x1ca91d=_0x1ca91d-0x0;var _0x43ed13=_0x5b02[_0x1ca91d];return _0x43ed13;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'type':{'type':Sequelize[_0x25b0('0x2')](_0x25b0('0x3'),'variable','customVariable',_0x25b0('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x25b0('0x5')]},'key':{'type':Sequelize[_0x25b0('0x5')]},'keyType':{'type':Sequelize[_0x25b0('0x2')](_0x25b0('0x3'),_0x25b0('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x25b0('0x5')]},'idField':{'type':Sequelize[_0x25b0('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x25b0('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 414ad49..3f49462 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 _0xedd9=['limit','set','apply','save','then','destroy','error','stack','name','send','index','DeskField','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x350ac3,_0x333064){var _0x5997ba=function(_0xcb7441){while(--_0xcb7441){_0x350ac3['push'](_0x350ac3['shift']());}};_0x5997ba(++_0x333064);}(_0xedd9,0xfc));var _0x9edd=function(_0x9d9e9d,_0x2347d3){_0x9d9e9d=_0x9d9e9d-0x0;var _0x12997e=_0xedd9[_0x9d9e9d];return _0x12997e;};'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 authService=require(_0x9edd('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x9edd('0x11'));var qs=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['DeskField'][_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['DeskField']['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));}; \ No newline at end of file +var _0x9c44=['ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','sendStatus','status','json','count','offset','limit','save','update','then','error','stack','name','send','index','DeskField','rawAttributes','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','key','field','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv'];(function(_0x20afe7,_0x215467){var _0x40c7fe=function(_0x41d974){while(--_0x41d974){_0x20afe7['push'](_0x20afe7['shift']());}};_0x40c7fe(++_0x215467);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'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 authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x49c4('0xf'));var qs=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(){_0x46e475[_0x49c4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x592bb8,_0x2263ae){return function(_0x15581b){if(!_0x15581b){_0x592bb8[_0x49c4('0x13')](0x194);}return _0x15581b;};}function handleError(_0xd335e4,_0x4811c4){_0x4811c4=_0x4811c4||0x1f4;return function(_0x5850f2){logger[_0x49c4('0x1c')](_0x5850f2[_0x49c4('0x1d')]);if(_0x5850f2['name']){delete _0x5850f2[_0x49c4('0x1e')];}_0xd335e4[_0x49c4('0x14')](_0x4811c4)[_0x49c4('0x1f')](_0x5850f2);};}exports[_0x49c4('0x20')]=function(_0x531d92,_0x543ea2){var _0x449960={},_0x53c199={},_0x3800b7={'count':0x0,'rows':[]};var _0x3852b2=db[_0x49c4('0x21')][_0x49c4('0x22')];_0x53c199['model']=_[_0x49c4('0x23')](_0x3852b2);_0x53c199[_0x49c4('0x24')]=_[_0x49c4('0x23')](_0x531d92[_0x49c4('0x24')]);_0x53c199[_0x49c4('0x25')]=_[_0x49c4('0x26')](_0x53c199[_0x49c4('0x27')],_0x53c199[_0x49c4('0x24')]);_0x449960[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x53c199[_0x49c4('0x27')],qs['fields'](_0x531d92['query']['fields']));_0x449960[_0x49c4('0x28')]=_0x449960[_0x49c4('0x28')][_0x49c4('0x29')]?_0x449960[_0x49c4('0x28')]:_0x53c199[_0x49c4('0x27')];if(!_0x531d92['query'][_0x49c4('0x2a')](_0x49c4('0x2b'))){_0x449960[_0x49c4('0x18')]=qs[_0x49c4('0x18')](_0x531d92['query']['limit']);_0x449960[_0x49c4('0x17')]=qs[_0x49c4('0x17')](_0x531d92[_0x49c4('0x24')][_0x49c4('0x17')]);}_0x449960[_0x49c4('0x2c')]=qs['sort'](_0x531d92[_0x49c4('0x24')][_0x49c4('0x2d')]);_0x449960[_0x49c4('0x2e')]=qs['filters'](_['pick'](_0x531d92[_0x49c4('0x24')],_0x53c199[_0x49c4('0x25')]));if(_0x531d92[_0x49c4('0x24')][_0x49c4('0x2f')]){_0x449960[_0x49c4('0x2e')]=_[_0x49c4('0x30')](_0x449960[_0x49c4('0x2e')],{'$or':_[_0x49c4('0x31')](_0x3852b2,function(_0x3209cd){if(_0x3209cd['type'][_0x49c4('0x32')]!=='VIRTUAL'){var _0xdda586={};_0xdda586[_0x3209cd[_0x49c4('0x33')]]={'$like':'%'+_0x531d92[_0x49c4('0x24')][_0x49c4('0x2f')]+'%'};return _0xdda586;}})});}_0x449960=_['merge']({},_0x449960,_0x531d92[_0x49c4('0x34')]);var _0x31f3ff={'where':_0x449960[_0x49c4('0x2e')]};return db['DeskField'][_0x49c4('0x16')](_0x31f3ff)[_0x49c4('0x1b')](function(_0x178987){_0x3800b7[_0x49c4('0x16')]=_0x178987;if(_0x531d92[_0x49c4('0x24')][_0x49c4('0x35')]){_0x449960[_0x49c4('0x36')]=[{'all':!![]}];}return db[_0x49c4('0x21')][_0x49c4('0x37')](_0x449960);})[_0x49c4('0x1b')](function(_0x1e506a){_0x3800b7['rows']=_0x1e506a;return _0x3800b7;})[_0x49c4('0x1b')](respondWithFilteredResult(_0x543ea2,_0x449960))[_0x49c4('0x38')](handleError(_0x543ea2,null));};exports[_0x49c4('0x39')]=function(_0x23aa32,_0x41ad28){var _0x29dd5d={'raw':!![],'where':{'id':_0x23aa32[_0x49c4('0x3a')]['id']}},_0x1be62d={};_0x1be62d[_0x49c4('0x27')]=_[_0x49c4('0x23')](db[_0x49c4('0x21')][_0x49c4('0x22')]);_0x1be62d[_0x49c4('0x24')]=_['keys'](_0x23aa32[_0x49c4('0x24')]);_0x1be62d['filters']=_[_0x49c4('0x26')](_0x1be62d[_0x49c4('0x27')],_0x1be62d[_0x49c4('0x24')]);_0x29dd5d[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x1be62d[_0x49c4('0x27')],qs['fields'](_0x23aa32['query'][_0x49c4('0x3b')]));_0x29dd5d[_0x49c4('0x28')]=_0x29dd5d[_0x49c4('0x28')][_0x49c4('0x29')]?_0x29dd5d['attributes']:_0x1be62d[_0x49c4('0x27')];if(_0x23aa32[_0x49c4('0x24')][_0x49c4('0x35')]){_0x29dd5d[_0x49c4('0x36')]=[{'all':!![]}];}_0x29dd5d=_[_0x49c4('0x30')]({},_0x29dd5d,_0x23aa32[_0x49c4('0x34')]);return db[_0x49c4('0x21')][_0x49c4('0x3c')](_0x29dd5d)[_0x49c4('0x1b')](handleEntityNotFound(_0x41ad28,null))['then'](respondWithResult(_0x41ad28,null))[_0x49c4('0x38')](handleError(_0x41ad28,null));};exports['create']=function(_0x33696e,_0x628423){return db[_0x49c4('0x21')][_0x49c4('0x3d')](_0x33696e[_0x49c4('0x3e')],{})['then'](respondWithResult(_0x628423,0xc9))[_0x49c4('0x38')](handleError(_0x628423,null));};exports[_0x49c4('0x1a')]=function(_0x384862,_0x254d07){if(_0x384862[_0x49c4('0x3e')]['id']){delete _0x384862[_0x49c4('0x3e')]['id'];}return db[_0x49c4('0x21')]['find']({'where':{'id':_0x384862[_0x49c4('0x3a')]['id']}})['then'](handleEntityNotFound(_0x254d07,null))[_0x49c4('0x1b')](saveUpdates(_0x384862[_0x49c4('0x3e')],null))[_0x49c4('0x1b')](respondWithResult(_0x254d07,null))[_0x49c4('0x38')](handleError(_0x254d07,null));};exports[_0x49c4('0x3f')]=function(_0x30bea5,_0x2c6be1){return db['DeskField'][_0x49c4('0x3c')]({'where':{'id':_0x30bea5[_0x49c4('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x1b')](removeEntity(_0x2c6be1,null))[_0x49c4('0x38')](handleError(_0x2c6be1,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 0c4244e..6c7631c 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 _0xd229=['int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','./intDeskField.attributes','exports','DeskField'];(function(_0x7dc7a8,_0x56a053){var _0x37f727=function(_0x2ad3cf){while(--_0x2ad3cf){_0x7dc7a8['push'](_0x7dc7a8['shift']());}};_0x37f727(++_0x56a053);}(_0xd229,0x93));var _0x9d22=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xd229[_0x245afe];return _0x4eefde;};'use strict';var _=require(_0x9d22('0x0'));var util=require(_0x9d22('0x1'));var logger=require(_0x9d22('0x2'))(_0x9d22('0x3'));var moment=require(_0x9d22('0x4'));var BPromise=require(_0x9d22('0x5'));var rp=require('request-promise');var attributes=require(_0x9d22('0x6'));module[_0x9d22('0x7')]=function(_0x390df6,_0x2c8e60){return _0x390df6['define'](_0x9d22('0x8'),attributes,{'tableName':_0x9d22('0x9'),'paranoid':![],'indexes':[{'name':_0x9d22('0xa'),'fields':[_0x9d22('0xb'),_0x9d22('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67ab=['DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','api','moment','bluebird','exports'];(function(_0x7b2c71,_0x18f8fc){var _0x24d447=function(_0x316b37){while(--_0x316b37){_0x7b2c71['push'](_0x7b2c71['shift']());}};_0x24d447(++_0x18f8fc);}(_0x67ab,0x176));var _0xb67a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x67ab[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb67a('0x0'));var util=require(_0xb67a('0x1'));var logger=require('../../config/logger')(_0xb67a('0x2'));var moment=require(_0xb67a('0x3'));var BPromise=require(_0xb67a('0x4'));var rp=require('request-promise');var attributes=require('./intDeskField.attributes');module[_0xb67a('0x5')]=function(_0x54e6a2,_0x3f2212){return _0x54e6a2['define'](_0xb67a('0x6'),attributes,{'tableName':_0xb67a('0x7'),'paranoid':![],'indexes':[{'name':_0xb67a('0x8'),'fields':[_0xb67a('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 4df5f92..796fa1e 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 _0xbec5=['info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','DeskField,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2d7226,_0x35edb1){var _0x59b03f=function(_0x45c59a){while(--_0x45c59a){_0x2d7226['push'](_0x2d7226['shift']());}};_0x59b03f(++_0x35edb1);}(_0xbec5,0xe5));var _0x5bec=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0xbec5[_0x2c0be1];return _0x3d4bd2;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a427,_0x38456e,_0x406e65){return new BPromise(function(_0x43d96e,_0x302aae){return client[_0x5bec('0xb')](_0x28a427,_0x406e65)[_0x5bec('0xc')](function(_0x4d0d29){logger[_0x5bec('0xd')]('DeskField,\x20%s,\x20%s',_0x38456e,_0x5bec('0xe'));logger[_0x5bec('0xf')](_0x5bec('0x10'),_0x38456e,'request\x20sent',JSON[_0x5bec('0x11')](_0x4d0d29));if(_0x4d0d29[_0x5bec('0x12')]){if(_0x4d0d29[_0x5bec('0x12')]['code']===0x1f4){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29['error'][_0x5bec('0x14')]);return _0x302aae(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);return _0x43d96e(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}else{logger[_0x5bec('0xd')](_0x5bec('0x13'),_0x38456e,_0x5bec('0xe'));_0x43d96e(_0x4d0d29[_0x5bec('0x15')]['message']);}})['catch'](function(_0x15af9b){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x15af9b);_0x302aae(_0x15af9b);});});} \ No newline at end of file +var _0x0a9a=['DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x0a9a,0x183));var _0xa0a9=function(_0x16b99e,_0x14dbe8){_0x16b99e=_0x16b99e-0x0;var _0x5f100b=_0x0a9a[_0x16b99e];return _0x5f100b;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('DeskField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('DeskField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 13a9e82..6bb8014 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 _0x697c=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','addConfiguration','update','exports'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x697c,0xd1));var _0xc697=function(_0x1f35af,_0x9b8029){_0x1f35af=_0x1f35af-0x0;var _0x4ee3b5=_0x697c[_0x1f35af];return _0x4ee3b5;};'use strict';var multer=require('multer');var util=require(_0xc697('0x0'));var path=require('path');var timeout=require(_0xc697('0x1'));var express=require(_0xc697('0x2'));var router=express[_0xc697('0x3')]();var auth=require(_0xc697('0x4'));var interaction=require(_0xc697('0x5'));var config=require(_0xc697('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xc697('0x7')]('/',auth[_0xc697('0x8')](),controller[_0xc697('0x9')]);router[_0xc697('0x7')](_0xc697('0xa'),auth[_0xc697('0x8')](),controller[_0xc697('0xb')]);router[_0xc697('0x7')](_0xc697('0xc'),auth[_0xc697('0x8')](),controller['getConfigurations']);router['get'](_0xc697('0xd'),auth[_0xc697('0x8')](),controller[_0xc697('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc697('0xf')]);router['post'](_0xc697('0xc'),auth[_0xc697('0x8')](),controller[_0xc697('0x10')]);router['put'](_0xc697('0xa'),auth['isAuthenticated'](),controller[_0xc697('0x11')]);router['delete'](_0xc697('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc697('0x12')]=router; \ No newline at end of file +var _0xf3c3=['/:id','show','getConfigurations','getFields','post','/:id/configurations','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index'];(function(_0x179a0c,_0x2ca073){var _0x1c8b9a=function(_0xfa6124){while(--_0xfa6124){_0x179a0c['push'](_0x179a0c['shift']());}};_0x1c8b9a(++_0x2ca073);}(_0xf3c3,0x154));var _0x3f3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3c3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3f3c('0x0'));var util=require('util');var path=require(_0x3f3c('0x1'));var timeout=require(_0x3f3c('0x2'));var express=require(_0x3f3c('0x3'));var router=express[_0x3f3c('0x4')]();var auth=require(_0x3f3c('0x5'));var interaction=require(_0x3f3c('0x6'));var config=require(_0x3f3c('0x7'));var controller=require(_0x3f3c('0x8'));router[_0x3f3c('0x9')]('/',auth[_0x3f3c('0xa')](),controller[_0x3f3c('0xb')]);router[_0x3f3c('0x9')](_0x3f3c('0xc'),auth[_0x3f3c('0xa')](),controller[_0x3f3c('0xd')]);router[_0x3f3c('0x9')]('/:id/configurations',auth[_0x3f3c('0xa')](),controller[_0x3f3c('0xe')]);router[_0x3f3c('0x9')]('/:id/fields',auth[_0x3f3c('0xa')](),controller[_0x3f3c('0xf')]);router[_0x3f3c('0x10')]('/',auth[_0x3f3c('0xa')](),controller['create']);router[_0x3f3c('0x10')](_0x3f3c('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x3f3c('0x12')](_0x3f3c('0xc'),auth['isAuthenticated'](),controller[_0x3f3c('0x13')]);router['delete']('/:id',auth[_0x3f3c('0xa')](),controller[_0x3f3c('0x14')]);module[_0x3f3c('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 bd42d42..c5b8b1c 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 _0xb99b=['exports','STRING','sequelize'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xb99b,0x1a9));var _0xbb99=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb99b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xbb99('0x0'));module[_0xbb99('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbb99('0x2')]},'password':{'type':Sequelize[_0xbb99('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xbb99('0x2')]},'clientId':{'type':Sequelize[_0xbb99('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x52a7=['sequelize','STRING'];(function(_0x17f891,_0x34c577){var _0x5bf2d4=function(_0x208a07){while(--_0x208a07){_0x17f891['push'](_0x17f891['shift']());}};_0x5bf2d4(++_0x34c577);}(_0x52a7,0x19c));var _0x752a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x52a7[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x752a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x752a('0x1')]},'remoteUri':{'type':Sequelize[_0x752a('0x1')]},'tenantId':{'type':Sequelize[_0x752a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x752a('0x1')]},'serverUrl':{'type':Sequelize[_0x752a('0x1')]},'description':{'type':Sequelize[_0x752a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1eefb4a..bdcacc1 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 _0x5458=['resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','slice','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','username','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','substring','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','all','log','test','send','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','stack','name','index','Dynamics365Account','rawAttributes','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','findAll','then','rows','show','includeAll','include','find','create','update','body','params','getConfigurations','findOne','addConfiguration','Subjects','Descriptions','channel','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname'];(function(_0x1373ff,_0x5bd8bf){var _0x377325=function(_0x1765a9){while(--_0x1765a9){_0x1373ff['push'](_0x1373ff['shift']());}};_0x377325(++_0x5bd8bf);}(_0x5458,0x11b));var _0x8545=function(_0x3e901c,_0x32126e){_0x3e901c=_0x3e901c-0x0;var _0x1e5c89=_0x5458[_0x3e901c];return _0x1e5c89;};'use strict';var pdf=require(_0x8545('0x0'));var emlformat=require(_0x8545('0x1'));var rimraf=require(_0x8545('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8545('0x3'));var moment=require('moment');var BPromise=require(_0x8545('0x4'));var Mustache=require(_0x8545('0x5'));var util=require(_0x8545('0x6'));var path=require(_0x8545('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8545('0x8'));var fs=require('fs');var _=require(_0x8545('0x9'));var squel=require('squel');var crypto=require(_0x8545('0xa'));var jsforce=require(_0x8545('0xb'));var deskjs=require(_0x8545('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8545('0xd'));var Papa=require(_0x8545('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x8545('0xf'));var Redis=require('ioredis');var qs=require(_0x8545('0x10'));var logger=require(_0x8545('0x11'))(_0x8545('0x12'));var utils=require('../../config/utils');var config=require(_0x8545('0x13'));var db=require(_0x8545('0x14'))['db'];var integrations=require(_0x8545('0x15'));var jayson=require(_0x8545('0x16'));var client=jayson[_0x8545('0x17')][_0x8545('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x171b34,_0x531e0a,_0x5bbd34,_0x1370af){return new BPromise(function(_0x4bf294,_0xf76361){var _0x1f30cd=_0x1370af||client;return _0x1f30cd[_0x8545('0x19')](_0x171b34,_0x5bbd34)['then'](function(_0x1fc367){logger['info'](_0x8545('0x1a'),_0x531e0a,'request\x20sent');logger[_0x8545('0x1b')](_0x8545('0x1c'),_0x531e0a,_0x8545('0x1d'),JSON['stringify'](_0x1fc367));if(_0x1fc367[_0x8545('0x1e')]){if(_0x1fc367[_0x8545('0x1e')][_0x8545('0x1f')]===0x1f4){logger[_0x8545('0x1e')](_0x8545('0x1a'),_0x531e0a,_0x1fc367[_0x8545('0x1e')][_0x8545('0x20')]);return _0xf76361(_0x1fc367[_0x8545('0x1e')][_0x8545('0x20')]);}logger['error'](_0x8545('0x1a'),_0x531e0a,_0x1fc367['error'][_0x8545('0x20')]);return _0x4bf294(_0x1fc367['error'][_0x8545('0x20')]);}else{logger[_0x8545('0x21')](_0x8545('0x1a'),_0x531e0a,_0x8545('0x1d'));_0x4bf294(_0x1fc367[_0x8545('0x22')][_0x8545('0x20')]);}})[_0x8545('0x23')](function(_0x56fa51){logger[_0x8545('0x1e')](_0x8545('0x1a'),_0x531e0a,_0x56fa51);_0xf76361(_0x56fa51);});});}function respondWithStatusCode(_0x52494c,_0x4e5fb8){_0x4e5fb8=_0x4e5fb8||0xcc;return function(_0x43ce31){if(_0x43ce31){return _0x52494c[_0x8545('0x24')](_0x4e5fb8);}return _0x52494c[_0x8545('0x25')](_0x4e5fb8)[_0x8545('0x26')]();};}function respondWithResult(_0x52a421,_0x19d50a){_0x19d50a=_0x19d50a||0xc8;return function(_0x34c691){if(_0x34c691){return _0x52a421[_0x8545('0x25')](_0x19d50a)[_0x8545('0x27')](_0x34c691);}};}function respondWithFilteredResult(_0x430074,_0x54940e){return function(_0x4cc14c){if(_0x4cc14c){var _0x1ab418=_0x4cc14c[_0x8545('0x28')],_0x2da223=_0x54940e[_0x8545('0x29')],_0x372872=_0x54940e[_0x8545('0x29')]+_0x54940e[_0x8545('0x2a')],_0x417b07;if(_0x372872>=_0x1ab418){_0x372872=_0x1ab418;_0x417b07=0xc8;}else{_0x417b07=0xce;}_0x430074[_0x8545('0x25')](_0x417b07);return _0x430074[_0x8545('0x2b')](_0x8545('0x2c'),_0x2da223+'-'+_0x372872+'/'+_0x1ab418)[_0x8545('0x27')](_0x4cc14c);}return null;};}function patchUpdates(_0x72fc4a){return function(_0x58264d){try{jsonpatch[_0x8545('0x2d')](_0x58264d,_0x72fc4a,!![]);}catch(_0x58ea91){return BPromise['reject'](_0x58ea91);}return _0x58264d[_0x8545('0x2e')]();};}function saveUpdates(_0x540e7b,_0x29dad1){return function(_0x3900f1){if(_0x3900f1){return _0x3900f1['update'](_0x540e7b)['then'](function(_0x277bc0){return _0x277bc0;});}return null;};}function removeEntity(_0x377337,_0x301582){return function(_0x282524){if(_0x282524){return _0x282524[_0x8545('0x2f')]()['then'](function(){_0x377337['status'](0xcc)[_0x8545('0x26')]();});}};}function handleEntityNotFound(_0x5c55d9,_0x5de7cc){return function(_0x1319c4){if(!_0x1319c4){_0x5c55d9[_0x8545('0x24')](0x194);}return _0x1319c4;};}function handleError(_0x55f495,_0x378f79){_0x378f79=_0x378f79||0x1f4;return function(_0x25358a){logger[_0x8545('0x1e')](_0x25358a[_0x8545('0x30')]);if(_0x25358a[_0x8545('0x31')]){delete _0x25358a[_0x8545('0x31')];}_0x55f495[_0x8545('0x25')](_0x378f79)['send'](_0x25358a);};}exports[_0x8545('0x32')]=function(_0xc6cb65,_0x2ca1e5){var _0x365d78={},_0x4f3d12={},_0x253f3d={'count':0x0,'rows':[]};var _0x4f1a08=db[_0x8545('0x33')][_0x8545('0x34')];_0x4f3d12[_0x8545('0x35')]=_[_0x8545('0x36')](_0x4f1a08);_0x4f3d12['query']=_[_0x8545('0x36')](_0xc6cb65['query']);_0x4f3d12[_0x8545('0x37')]=_[_0x8545('0x38')](_0x4f3d12['model'],_0x4f3d12[_0x8545('0x39')]);_0x365d78[_0x8545('0x3a')]=_[_0x8545('0x38')](_0x4f3d12[_0x8545('0x35')],qs[_0x8545('0x3b')](_0xc6cb65['query']['fields']));_0x365d78[_0x8545('0x3a')]=_0x365d78[_0x8545('0x3a')][_0x8545('0x3c')]?_0x365d78[_0x8545('0x3a')]:_0x4f3d12['model'];if(!_0xc6cb65[_0x8545('0x39')][_0x8545('0x3d')](_0x8545('0x3e'))){_0x365d78[_0x8545('0x2a')]=qs[_0x8545('0x2a')](_0xc6cb65[_0x8545('0x39')][_0x8545('0x2a')]);_0x365d78['offset']=qs['offset'](_0xc6cb65['query']['offset']);}_0x365d78[_0x8545('0x3f')]=qs[_0x8545('0x40')](_0xc6cb65[_0x8545('0x39')][_0x8545('0x40')]);_0x365d78[_0x8545('0x41')]=qs['filters'](_[_0x8545('0x42')](_0xc6cb65[_0x8545('0x39')],_0x4f3d12[_0x8545('0x37')]));if(_0xc6cb65[_0x8545('0x39')][_0x8545('0x43')]){_0x365d78[_0x8545('0x41')]=_[_0x8545('0x44')](_0x365d78[_0x8545('0x41')],{'$or':_[_0x8545('0x45')](_0x4f1a08,function(_0x500582){if(_0x500582[_0x8545('0x46')][_0x8545('0x47')]!==_0x8545('0x48')){var _0x361258={};_0x361258[_0x500582['field']]={'$like':'%'+_0xc6cb65['query'][_0x8545('0x43')]+'%'};return _0x361258;}})});}_0x365d78=_['merge']({},_0x365d78,_0xc6cb65[_0x8545('0x49')]);var _0x565489={'where':_0x365d78[_0x8545('0x41')]};return db[_0x8545('0x33')][_0x8545('0x28')](_0x565489)['then'](function(_0x4b6e01){_0x253f3d[_0x8545('0x28')]=_0x4b6e01;if(_0xc6cb65[_0x8545('0x39')]['includeAll']){_0x365d78['include']=[{'all':!![]}];}return db[_0x8545('0x33')][_0x8545('0x4a')](_0x365d78);})[_0x8545('0x4b')](function(_0x29604f){_0x253f3d[_0x8545('0x4c')]=_0x29604f;return _0x253f3d;})[_0x8545('0x4b')](respondWithFilteredResult(_0x2ca1e5,_0x365d78))[_0x8545('0x23')](handleError(_0x2ca1e5,null));};exports[_0x8545('0x4d')]=function(_0x384387,_0xf30d10){var _0x3f4e89={'raw':![],'where':{'id':_0x384387['params']['id']}},_0x273265={};_0x273265[_0x8545('0x35')]=_[_0x8545('0x36')](db['Dynamics365Account'][_0x8545('0x34')]);_0x273265[_0x8545('0x39')]=_['keys'](_0x384387['query']);_0x273265[_0x8545('0x37')]=_['intersection'](_0x273265[_0x8545('0x35')],_0x273265[_0x8545('0x39')]);_0x3f4e89[_0x8545('0x3a')]=_['intersection'](_0x273265[_0x8545('0x35')],qs[_0x8545('0x3b')](_0x384387[_0x8545('0x39')][_0x8545('0x3b')]));_0x3f4e89[_0x8545('0x3a')]=_0x3f4e89['attributes']['length']?_0x3f4e89['attributes']:_0x273265[_0x8545('0x35')];if(_0x384387[_0x8545('0x39')][_0x8545('0x4e')]){_0x3f4e89[_0x8545('0x4f')]=[{'all':!![]}];}_0x3f4e89=_[_0x8545('0x44')]({},_0x3f4e89,_0x384387[_0x8545('0x49')]);return db[_0x8545('0x33')][_0x8545('0x50')](_0x3f4e89)[_0x8545('0x4b')](handleEntityNotFound(_0xf30d10,null))[_0x8545('0x4b')](respondWithResult(_0xf30d10,null))['catch'](handleError(_0xf30d10,null));};exports[_0x8545('0x51')]=function(_0x5d2426,_0x5f5cd6){return db['Dynamics365Account']['create'](_0x5d2426['body'],{})[_0x8545('0x4b')](respondWithResult(_0x5f5cd6,0xc9))[_0x8545('0x23')](handleError(_0x5f5cd6,null));};exports[_0x8545('0x52')]=function(_0x29d72e,_0x49ab13){if(_0x29d72e[_0x8545('0x53')]['id']){delete _0x29d72e[_0x8545('0x53')]['id'];}return db[_0x8545('0x33')]['find']({'where':{'id':_0x29d72e[_0x8545('0x54')]['id']}})[_0x8545('0x4b')](handleEntityNotFound(_0x49ab13,null))[_0x8545('0x4b')](saveUpdates(_0x29d72e[_0x8545('0x53')],null))['then'](respondWithResult(_0x49ab13,null))[_0x8545('0x23')](handleError(_0x49ab13,null));};exports[_0x8545('0x2f')]=function(_0x2deb34,_0x4110c1){return db[_0x8545('0x33')]['find']({'where':{'id':_0x2deb34[_0x8545('0x54')]['id']}})[_0x8545('0x4b')](handleEntityNotFound(_0x4110c1,null))[_0x8545('0x4b')](removeEntity(_0x4110c1,null))['catch'](handleError(_0x4110c1,null));};exports[_0x8545('0x55')]=function(_0x28b68f,_0xf5537f,_0x43e0c9){var _0x499f74={};var _0x48e7e1={};var _0x198d09;var _0x3e8c36;return db[_0x8545('0x33')][_0x8545('0x56')]({'where':{'id':_0x28b68f[_0x8545('0x54')]['id']}})[_0x8545('0x4b')](handleEntityNotFound(_0xf5537f,null))[_0x8545('0x4b')](function(_0x4d5777){if(_0x4d5777){_0x198d09=_0x4d5777;_0x48e7e1['model']=_['keys'](db['Dynamics365Configuration'][_0x8545('0x34')]);_0x48e7e1[_0x8545('0x39')]=_[_0x8545('0x36')](_0x28b68f[_0x8545('0x39')]);_0x48e7e1[_0x8545('0x37')]=_[_0x8545('0x38')](_0x48e7e1[_0x8545('0x35')],_0x48e7e1['query']);_0x499f74[_0x8545('0x3a')]=_[_0x8545('0x38')](_0x48e7e1[_0x8545('0x35')],qs[_0x8545('0x3b')](_0x28b68f[_0x8545('0x39')][_0x8545('0x3b')]));_0x499f74[_0x8545('0x3a')]=_0x499f74[_0x8545('0x3a')][_0x8545('0x3c')]?_0x499f74['attributes']:_0x48e7e1[_0x8545('0x35')];_0x499f74[_0x8545('0x3f')]=qs[_0x8545('0x40')](_0x28b68f['query']['sort']);_0x499f74['where']=qs['filters'](_[_0x8545('0x42')](_0x28b68f[_0x8545('0x39')],_0x48e7e1[_0x8545('0x37')]));if(_0x28b68f[_0x8545('0x39')][_0x8545('0x43')]){_0x499f74[_0x8545('0x41')]=_[_0x8545('0x44')](_0x499f74['where'],{'$or':_[_0x8545('0x45')](_0x499f74[_0x8545('0x3a')],function(_0x1ca66e){var _0xaa5ef3={};_0xaa5ef3[_0x1ca66e]={'$like':'%'+_0x28b68f[_0x8545('0x39')][_0x8545('0x43')]+'%'};return _0xaa5ef3;})});}_0x499f74=_['merge']({},_0x499f74,_0x28b68f['options']);return _0x198d09[_0x8545('0x55')](_0x499f74);}})[_0x8545('0x4b')](function(_0x429c43){if(_0x429c43){_0x3e8c36=_0x429c43[_0x8545('0x3c')];if(!_0x28b68f[_0x8545('0x39')][_0x8545('0x3d')]('nolimit')){_0x499f74[_0x8545('0x2a')]=qs[_0x8545('0x2a')](_0x28b68f[_0x8545('0x39')][_0x8545('0x2a')]);_0x499f74[_0x8545('0x29')]=qs[_0x8545('0x29')](_0x28b68f['query'][_0x8545('0x29')]);}return _0x198d09[_0x8545('0x55')](_0x499f74);}})[_0x8545('0x4b')](function(_0x47f8dd){if(_0x47f8dd){return _0x47f8dd?{'count':_0x3e8c36,'rows':_0x47f8dd}:null;}})[_0x8545('0x4b')](respondWithResult(_0xf5537f,null))[_0x8545('0x23')](handleError(_0xf5537f,null));};exports[_0x8545('0x57')]=function(_0x1f6554,_0x5ef91b,_0x44c656){if(_0x1f6554['body']['id']){delete _0x1f6554[_0x8545('0x53')]['id'];}return db[_0x8545('0x33')]['findOne']({'where':{'id':_0x1f6554[_0x8545('0x54')]['id']}})['then'](handleEntityNotFound(_0x5ef91b,null))[_0x8545('0x4b')](function(_0x6d4cd6){if(_0x6d4cd6){_0x1f6554[_0x8545('0x53')]['AccountId']=_0x6d4cd6['id'];_0x1f6554[_0x8545('0x53')][_0x8545('0x58')]=integrations['getSubjects'](_0x1f6554['body']['channel'],_0x1f6554[_0x8545('0x53')]['type']);_0x1f6554['body'][_0x8545('0x59')]=integrations['getDescriptions'](_0x1f6554['body'][_0x8545('0x5a')],_0x1f6554[_0x8545('0x53')]['type']);return db[_0x8545('0x5b')][_0x8545('0x51')](_0x1f6554[_0x8545('0x53')],{'include':[{'model':db[_0x8545('0x5c')],'as':_0x8545('0x58')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x8545('0x4b')](respondWithResult(_0x5ef91b,null))[_0x8545('0x23')](handleError(_0x5ef91b,null));};exports[_0x8545('0x5d')]=function(_0x4f7330,_0x39a310,_0x3975aa){var _0x83e574=_0x4f7330[_0x8545('0x39')][_0x8545('0x5e')];var _0x155859=_0x83e574===_0x8545('0x5f')?_0x8545('0x60'):'PhoneCall';var _0x5255e4='';var _0x52d24f='';var _0x147721='';var _0x5e24d4='';var _0x9e2dbf='';var _0x168396='';var _0x215a44='';var _0x5c27e6='';var _0x16d1ad=['title','description','customerid',_0x8545('0x61'),_0x8545('0x62'),_0x8545('0x63'),_0x8545('0x64'),_0x8545('0x65'),_0x8545('0x66'),_0x8545('0x67')];var _0x3464b1=[_0x8545('0x68'),'accountidyominame',_0x8545('0x69'),_0x8545('0x6a'),'contactidname','contactidyominame','contractdetailidname',_0x8545('0x6b'),_0x8545('0x6c'),_0x8545('0x6d'),_0x8545('0x6e'),_0x8545('0x6f'),_0x8545('0x70'),_0x8545('0x71'),_0x8545('0x72'),_0x8545('0x73'),_0x8545('0x74'),_0x8545('0x75'),_0x8545('0x76'),_0x8545('0x77'),'entityimage_timestamp','entityimage_url',_0x8545('0x78'),'exchangerate','firstresponsebykpiidname',_0x8545('0x79'),_0x8545('0x7a'),_0x8545('0x7b'),_0x8545('0x7c'),_0x8545('0x7d'),_0x8545('0x7e'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname',_0x8545('0x7f'),_0x8545('0x80'),_0x8545('0x81'),_0x8545('0x82'),_0x8545('0x83'),_0x8545('0x84'),_0x8545('0x85'),_0x8545('0x86'),_0x8545('0x87'),_0x8545('0x88'),_0x8545('0x89'),'owneridyominame',_0x8545('0x8a'),_0x8545('0x8b'),_0x8545('0x8c'),_0x8545('0x8d'),_0x8545('0x8e'),'productserialnumber',_0x8545('0x8f'),_0x8545('0x90'),_0x8545('0x91'),'responsiblecontactidname',_0x8545('0x92'),_0x8545('0x93'),_0x8545('0x94'),_0x8545('0x95'),_0x8545('0x96'),_0x8545('0x97'),'statuscode',_0x8545('0x98'),_0x8545('0x99'),'timezoneruleversionnumber',_0x8545('0x9a'),_0x8545('0x9b'),_0x8545('0x9c'),_0x8545('0x9d')];var _0x3dc9b2=_0x16d1ad[_0x8545('0x9e')](_0x3464b1);return db[_0x8545('0x33')][_0x8545('0x56')]({'where':{'id':_0x4f7330[_0x8545('0x54')]['id']},'attributes':['id','username',_0x8545('0x9f'),_0x8545('0xa0'),_0x8545('0xa1'),_0x8545('0xa2'),_0x8545('0xa3')]})[_0x8545('0x4b')](handleEntityNotFound(_0x39a310,null))['then'](function(_0x51ffb3){if(_0x51ffb3){_0x5c27e6=_0x51ffb3[_0x8545('0xa0')];var _0x3ea039=_0x5c27e6[_0x8545('0xa4')](-0x1);if(_0x3ea039==='/'){_0x5c27e6=_0x5c27e6['substring'](0x0,_0x5c27e6['lastIndexOf'](_0x3ea039));}_0x215a44=util['format'](_0x8545('0xa5'),_0x5c27e6);var _0x584199={'method':_0x8545('0xa6'),'uri':_0x8545('0xa7')+_0x51ffb3[_0x8545('0xa1')]+_0x8545('0xa8'),'form':{'client_id':_0x51ffb3[_0x8545('0xa2')],'resource':_0x5c27e6,'username':_0x51ffb3[_0x8545('0xa9')],'password':_0x51ffb3['password'],'grant_type':_0x8545('0x9f'),'client_secret':_0x51ffb3[_0x8545('0xa3')]},'json':!![]};return rp(_0x584199);}})[_0x8545('0x4b')](function(_0x3c8c95){_0x168396=_0x3c8c95[_0x8545('0xaa')];var _0x417267={'method':_0x8545('0xab'),'uri':encodeURI(_0x215a44+_0x8545('0xac')+_0x155859+'\x27'),'headers':{'Authorization':_0x8545('0xad')+_0x168396,'If-None-Match':null,'OData-Version':_0x8545('0xae')},'json':!![]};return rp(_0x417267);})['then'](function(_0x2e60c2){var _0x3164aa=_0x2e60c2['value'][0x0];var _0xc05fa3=_0x3164aa[_0x8545('0xaf')];var _0x42701b={'method':_0x8545('0xab'),'uri':_0x215a44+_0x8545('0xb0')+_0xc05fa3+_0x8545('0xb1'),'headers':{'Authorization':'Bearer\x20'+_0x168396,'If-None-Match':null,'OData-Version':_0x8545('0xae')},'json':!![]};return rp(_0x42701b);})[_0x8545('0x4b')](function(_0x3bf542){_0x5255e4=_0x3bf542;_0x52d24f=_0x5255e4['Attributes'];_0x52d24f=_[_0x8545('0xb2')](_0x52d24f,function(_0x583235){return!_0x3dc9b2[_0x8545('0xb3')](_0x583235[_0x8545('0xb4')]);});var _0x3fec36=[];var _0xbf2df6=[];_0x52d24f[_0x8545('0xb5')](function(_0x2df145){if(_0x2df145[_0x8545('0xb6')]){var _0x529f8c=_0x2df145[_0x8545('0xb6')]['substring'](_0x2df145[_0x8545('0xb6')][_0x8545('0xb7')]('.')+0x1);if(_0x529f8c===_0x8545('0xb8')){_0x3fec36[_0x8545('0xb9')](getSelectList(_0x215a44,_0x83e574,_0xbf2df6,_0x5255e4['MetadataId'],_0x2df145[_0x8545('0xaf')],_0x168396));}}});return Promise['all'](_0x3fec36);})['then'](function(_0x52069b){_0x147721=_0x52069b[0x0];var _0xe61dfd=[];var _0x2ecc48=[];_0x52d24f['forEach'](function(_0x4e0e35){if(!_['isNil'](_0x4e0e35[_0x8545('0xb6')])){var _0x1731fb=_0x4e0e35[_0x8545('0xb6')][_0x8545('0xba')](_0x4e0e35['@odata.type']['lastIndexOf']('.')+0x1);if(_0x1731fb==='BooleanAttributeMetadata'){_0xe61dfd[_0x8545('0xb9')](getBooleanList(_0x215a44,_0x83e574,_0x2ecc48,_0x5255e4['MetadataId'],_0x4e0e35['MetadataId'],_0x168396));}}});return Promise['all'](_0xe61dfd);})['then'](function(_0x1cfa7e){_0x5e24d4=_0x1cfa7e[0x0];var _0x4306a8=[];var _0x55143d=[];_0x52d24f[_0x8545('0xb5')](function(_0x576535){if(_0x576535['@odata.type']){var _0x17e662=_0x576535[_0x8545('0xb6')][_0x8545('0xba')](_0x576535['@odata.type'][_0x8545('0xb7')]('.')+0x1);if(_0x17e662===_0x8545('0xbb')||_0x17e662===_0x8545('0xbc')||_0x17e662==='BigIntAttributeMetadata'||_0x17e662===_0x8545('0xbd')||_0x17e662===_0x8545('0xbe')||_0x17e662===_0x8545('0xbf')||_0x17e662===_0x8545('0xc0')||_0x17e662==='EntityNameAttributeMetadata'||_0x17e662===_0x8545('0xc1')||_0x17e662==='DecimalAttributeMetadata'){_0x4306a8[_0x8545('0xb9')](getInputList(_0x215a44,_0x83e574,_0x17e662,_0x55143d,_0x5255e4[_0x8545('0xaf')],_0x576535['MetadataId'],_0x168396));}}});return Promise[_0x8545('0xc2')](_0x4306a8);})[_0x8545('0x4b')](function(_0xb345a8){_0x9e2dbf=_0xb345a8[0x0];var _0x1e7298=_0x147721[_0x8545('0x9e')](_0x5e24d4)[_0x8545('0x9e')](_0x9e2dbf);var _0x37647d={'count':_0x1e7298[_0x8545('0x3c')],'rows':_0x1e7298};return _0x37647d;})[_0x8545('0x4b')](respondWithResult(_0x39a310,null))[_0x8545('0x23')](function(_0xec7381){console[_0x8545('0xc3')]('Dynamics365\x20error:\x20'+_0xec7381);var _0x359c7b=_0x4f7330[_0x8545('0x39')][_0x8545('0xc4')]?0x1f4:_0xec7381['statusCode']||0x1f4;logger[_0x8545('0x1e')](_0xec7381['stack']);delete _0xec7381[_0x8545('0x31')];if(_0x359c7b===0x191){_0x359c7b=0x190;}_0x39a310[_0x8545('0x25')](_0x359c7b)[_0x8545('0xc5')](_0x4f7330['query'][_0x8545('0xc4')]?{'message':_0x8545('0xc6'),'statusCode':_0xec7381[_0x8545('0xc7')]}:_0xec7381);});};function getSelectList(_0x2a7a39,_0x2f3c67,_0x27bd31,_0x238143,_0x58abc3,_0x57a8bb){var _0x1bd3d2={'method':'GET','uri':_0x2a7a39+_0x8545('0xb0')+_0x238143+_0x8545('0xc8')+_0x58abc3+_0x8545('0xc9')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x8545('0xad')+_0x57a8bb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1bd3d2)[_0x8545('0x4b')](function(_0x4331e5){var _0x1a6e01=[];var _0xa6a452=_0x4331e5[_0x8545('0xca')][_0x8545('0xcb')];_0xa6a452['forEach'](function(_0x491bf1){_0x1a6e01[_0x8545('0xb9')]({'name':_0x491bf1['Label']['UserLocalizedLabel'][_0x8545('0xcc')],'value':String(_0x491bf1['Value'])});});var _0x20417f={'id':_0x2f3c67+'_'+_0x4331e5[_0x8545('0xb4')],'name':_0x4331e5['DisplayName'][_0x8545('0xcd')][_0x8545('0xcc')],'custom':![],'options':_0x1a6e01};_0x27bd31[_0x8545('0xb9')](_0x20417f);return _0x27bd31;});}function getBooleanList(_0x252194,_0xc10bcd,_0x2f15f9,_0x411e0b,_0x4e1e91,_0x7432fb){var _0x2e203f={'method':'GET','uri':_0x252194+_0x8545('0xb0')+_0x411e0b+')/Attributes('+_0x4e1e91+_0x8545('0xce'),'headers':{'Authorization':'Bearer\x20'+_0x7432fb,'If-None-Match':null,'OData-Version':_0x8545('0xae')},'json':!![]};return rp(_0x2e203f)['then'](function(_0x187966){var _0x1da662=[];_0x1da662[_0x8545('0xb9')]({'name':_0x187966['OptionSet']['TrueOption']['Label'][_0x8545('0xcd')][_0x8545('0xcc')],'value':_0x8545('0xcf')},{'name':_0x187966[_0x8545('0xca')][_0x8545('0xd0')]['Label']['UserLocalizedLabel'][_0x8545('0xcc')],'value':_0x8545('0xd1')});var _0x43565e={'id':_0xc10bcd+'_'+_0x187966[_0x8545('0xb4')],'name':_0x187966['DisplayName']['UserLocalizedLabel'][_0x8545('0xcc')],'custom':![],'options':_0x1da662};_0x2f15f9[_0x8545('0xb9')](_0x43565e);return _0x2f15f9;});}function getInputList(_0x4aeac7,_0x34e9b7,_0x2c60a8,_0x2efbb4,_0xb2491d,_0x356cfa,_0x43a713){var _0x290158={'method':_0x8545('0xab'),'uri':_0x4aeac7+'EntityDefinitions('+_0xb2491d+_0x8545('0xc8')+_0x356cfa+_0x8545('0xd2')+_0x2c60a8+_0x8545('0xd3'),'headers':{'Authorization':'Bearer\x20'+_0x43a713,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x290158)[_0x8545('0x4b')](function(_0x1d6cfe){var _0x317045={'id':_0x34e9b7+'_'+_0x1d6cfe[_0x8545('0xb4')],'name':_0x1d6cfe[_0x8545('0xd4')][_0x8545('0xcd')]?_0x1d6cfe[_0x8545('0xd4')][_0x8545('0xcd')][_0x8545('0xcc')]:_0x1d6cfe[_0x8545('0xb4')],'custom':![],'options':[]};_0x2efbb4[_0x8545('0xb9')](_0x317045);return _0x2efbb4;});} \ No newline at end of file +var _0x2b5d=['channel','Descriptions','Dynamics365Field','getFields','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','@odata.type','push','all','forEach','isNil','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','log','Dynamics365\x20error:\x20','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','UserLocalizedLabel','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','OptionSet','DisplayName','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','status','json','count','offset','limit','set','reject','save','update','destroy','stack','name','send','index','Dynamics365Account','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','map','type','key','VIRTUAL','field','options','includeAll','include','rows','catch','show','length','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','pick','merge','AccountId','Subjects','getSubjects'];(function(_0x26421c,_0x20a7b9){var _0x56ada2=function(_0x5a8a48){while(--_0x5a8a48){_0x26421c['push'](_0x26421c['shift']());}};_0x56ada2(++_0x20a7b9);}(_0x2b5d,0x155));var _0xd2b5=function(_0x4b635d,_0x3e4634){_0x4b635d=_0x4b635d-0x0;var _0x59a98e=_0x2b5d[_0x4b635d];return _0x59a98e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd2b5('0x0'));var rimraf=require(_0xd2b5('0x1'));var zipdir=require(_0xd2b5('0x2'));var jsonpatch=require(_0xd2b5('0x3'));var rp=require(_0xd2b5('0x4'));var moment=require(_0xd2b5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd2b5('0x6'));var util=require('util');var path=require(_0xd2b5('0x7'));var sox=require('sox');var csv=require(_0xd2b5('0x8'));var ejs=require(_0xd2b5('0x9'));var fs=require('fs');var _=require(_0xd2b5('0xa'));var squel=require('squel');var crypto=require(_0xd2b5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd2b5('0xc'));var toCsv=require(_0xd2b5('0x8'));var querystring=require('querystring');var Papa=require(_0xd2b5('0xd'));var authService=require(_0xd2b5('0xe'));var hardwareService=require(_0xd2b5('0xf'));var Redis=require(_0xd2b5('0x10'));var qs=require(_0xd2b5('0x11'));var logger=require(_0xd2b5('0x12'))(_0xd2b5('0x13'));var utils=require(_0xd2b5('0x14'));var config=require(_0xd2b5('0x15'));var db=require(_0xd2b5('0x16'))['db'];var integrations=require(_0xd2b5('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xd2b5('0x18')][_0xd2b5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2029f2,_0x2da1ff,_0x312929,_0x20d274){return new BPromise(function(_0x3b13f7,_0x1f6850){var _0x323ff4=_0x20d274||client;return _0x323ff4[_0xd2b5('0x1a')](_0x2029f2,_0x312929)[_0xd2b5('0x1b')](function(_0x234865){logger[_0xd2b5('0x1c')](_0xd2b5('0x1d'),_0x2da1ff,'request\x20sent');logger[_0xd2b5('0x1e')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x2da1ff,_0xd2b5('0x1f'),JSON[_0xd2b5('0x20')](_0x234865));if(_0x234865[_0xd2b5('0x21')]){if(_0x234865[_0xd2b5('0x21')][_0xd2b5('0x22')]===0x1f4){logger[_0xd2b5('0x21')](_0xd2b5('0x1d'),_0x2da1ff,_0x234865[_0xd2b5('0x21')]['message']);return _0x1f6850(_0x234865[_0xd2b5('0x21')][_0xd2b5('0x23')]);}logger[_0xd2b5('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x2da1ff,_0x234865[_0xd2b5('0x21')][_0xd2b5('0x23')]);return _0x3b13f7(_0x234865['error'][_0xd2b5('0x23')]);}else{logger[_0xd2b5('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0x2da1ff,_0xd2b5('0x1f'));_0x3b13f7(_0x234865[_0xd2b5('0x24')][_0xd2b5('0x23')]);}})['catch'](function(_0x449910){logger[_0xd2b5('0x21')](_0xd2b5('0x1d'),_0x2da1ff,_0x449910);_0x1f6850(_0x449910);});});}function respondWithStatusCode(_0x3f877f,_0x74ab66){_0x74ab66=_0x74ab66||0xcc;return function(_0x1d912b){if(_0x1d912b){return _0x3f877f['sendStatus'](_0x74ab66);}return _0x3f877f[_0xd2b5('0x25')](_0x74ab66)['end']();};}function respondWithResult(_0x2fc724,_0x22ce58){_0x22ce58=_0x22ce58||0xc8;return function(_0x420593){if(_0x420593){return _0x2fc724[_0xd2b5('0x25')](_0x22ce58)[_0xd2b5('0x26')](_0x420593);}};}function respondWithFilteredResult(_0x269366,_0x1f1e0f){return function(_0x3e0db1){if(_0x3e0db1){var _0x24f7b7=_0x3e0db1[_0xd2b5('0x27')],_0x27f803=_0x1f1e0f[_0xd2b5('0x28')],_0x3277af=_0x1f1e0f[_0xd2b5('0x28')]+_0x1f1e0f[_0xd2b5('0x29')],_0x3315cf;if(_0x3277af>=_0x24f7b7){_0x3277af=_0x24f7b7;_0x3315cf=0xc8;}else{_0x3315cf=0xce;}_0x269366[_0xd2b5('0x25')](_0x3315cf);return _0x269366[_0xd2b5('0x2a')]('Content-Range',_0x27f803+'-'+_0x3277af+'/'+_0x24f7b7)[_0xd2b5('0x26')](_0x3e0db1);}return null;};}function patchUpdates(_0x47ed4c){return function(_0x531dab){try{jsonpatch['apply'](_0x531dab,_0x47ed4c,!![]);}catch(_0x299c93){return BPromise[_0xd2b5('0x2b')](_0x299c93);}return _0x531dab[_0xd2b5('0x2c')]();};}function saveUpdates(_0x10ce5e,_0x579aeb){return function(_0x2e93c6){if(_0x2e93c6){return _0x2e93c6[_0xd2b5('0x2d')](_0x10ce5e)[_0xd2b5('0x1b')](function(_0x1216cd){return _0x1216cd;});}return null;};}function removeEntity(_0xfa42c,_0x520fa5){return function(_0x55b447){if(_0x55b447){return _0x55b447[_0xd2b5('0x2e')]()[_0xd2b5('0x1b')](function(){_0xfa42c[_0xd2b5('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xff2745,_0xa54513){return function(_0x7d7771){if(!_0x7d7771){_0xff2745['sendStatus'](0x194);}return _0x7d7771;};}function handleError(_0x1789de,_0x5c94fd){_0x5c94fd=_0x5c94fd||0x1f4;return function(_0x5a783a){logger[_0xd2b5('0x21')](_0x5a783a[_0xd2b5('0x2f')]);if(_0x5a783a[_0xd2b5('0x30')]){delete _0x5a783a[_0xd2b5('0x30')];}_0x1789de[_0xd2b5('0x25')](_0x5c94fd)[_0xd2b5('0x31')](_0x5a783a);};}exports[_0xd2b5('0x32')]=function(_0x4c873f,_0x46b8ff){var _0x17d820={},_0x2c88fa={},_0x318384={'count':0x0,'rows':[]};var _0x5614e2=db[_0xd2b5('0x33')][_0xd2b5('0x34')];_0x2c88fa[_0xd2b5('0x35')]=_[_0xd2b5('0x36')](_0x5614e2);_0x2c88fa[_0xd2b5('0x37')]=_[_0xd2b5('0x36')](_0x4c873f[_0xd2b5('0x37')]);_0x2c88fa[_0xd2b5('0x38')]=_[_0xd2b5('0x39')](_0x2c88fa[_0xd2b5('0x35')],_0x2c88fa[_0xd2b5('0x37')]);_0x17d820[_0xd2b5('0x3a')]=_[_0xd2b5('0x39')](_0x2c88fa[_0xd2b5('0x35')],qs[_0xd2b5('0x3b')](_0x4c873f['query']['fields']));_0x17d820[_0xd2b5('0x3a')]=_0x17d820[_0xd2b5('0x3a')]['length']?_0x17d820[_0xd2b5('0x3a')]:_0x2c88fa[_0xd2b5('0x35')];if(!_0x4c873f['query']['hasOwnProperty'](_0xd2b5('0x3c'))){_0x17d820[_0xd2b5('0x29')]=qs['limit'](_0x4c873f[_0xd2b5('0x37')]['limit']);_0x17d820[_0xd2b5('0x28')]=qs[_0xd2b5('0x28')](_0x4c873f[_0xd2b5('0x37')][_0xd2b5('0x28')]);}_0x17d820[_0xd2b5('0x3d')]=qs[_0xd2b5('0x3e')](_0x4c873f[_0xd2b5('0x37')]['sort']);_0x17d820[_0xd2b5('0x3f')]=qs[_0xd2b5('0x38')](_['pick'](_0x4c873f[_0xd2b5('0x37')],_0x2c88fa[_0xd2b5('0x38')]));if(_0x4c873f[_0xd2b5('0x37')][_0xd2b5('0x40')]){_0x17d820[_0xd2b5('0x3f')]=_['merge'](_0x17d820[_0xd2b5('0x3f')],{'$or':_[_0xd2b5('0x41')](_0x5614e2,function(_0x5a3e00){if(_0x5a3e00[_0xd2b5('0x42')][_0xd2b5('0x43')]!==_0xd2b5('0x44')){var _0x53db41={};_0x53db41[_0x5a3e00[_0xd2b5('0x45')]]={'$like':'%'+_0x4c873f[_0xd2b5('0x37')][_0xd2b5('0x40')]+'%'};return _0x53db41;}})});}_0x17d820=_['merge']({},_0x17d820,_0x4c873f[_0xd2b5('0x46')]);var _0x3fd158={'where':_0x17d820[_0xd2b5('0x3f')]};return db['Dynamics365Account'][_0xd2b5('0x27')](_0x3fd158)[_0xd2b5('0x1b')](function(_0x7e6219){_0x318384[_0xd2b5('0x27')]=_0x7e6219;if(_0x4c873f[_0xd2b5('0x37')][_0xd2b5('0x47')]){_0x17d820[_0xd2b5('0x48')]=[{'all':!![]}];}return db[_0xd2b5('0x33')]['findAll'](_0x17d820);})[_0xd2b5('0x1b')](function(_0x204327){_0x318384[_0xd2b5('0x49')]=_0x204327;return _0x318384;})[_0xd2b5('0x1b')](respondWithFilteredResult(_0x46b8ff,_0x17d820))[_0xd2b5('0x4a')](handleError(_0x46b8ff,null));};exports[_0xd2b5('0x4b')]=function(_0x1df126,_0x1a5cbd){var _0x334288={'raw':![],'where':{'id':_0x1df126['params']['id']}},_0x946d96={};_0x946d96[_0xd2b5('0x35')]=_[_0xd2b5('0x36')](db[_0xd2b5('0x33')][_0xd2b5('0x34')]);_0x946d96['query']=_[_0xd2b5('0x36')](_0x1df126['query']);_0x946d96[_0xd2b5('0x38')]=_[_0xd2b5('0x39')](_0x946d96['model'],_0x946d96[_0xd2b5('0x37')]);_0x334288[_0xd2b5('0x3a')]=_[_0xd2b5('0x39')](_0x946d96[_0xd2b5('0x35')],qs[_0xd2b5('0x3b')](_0x1df126[_0xd2b5('0x37')]['fields']));_0x334288[_0xd2b5('0x3a')]=_0x334288[_0xd2b5('0x3a')][_0xd2b5('0x4c')]?_0x334288[_0xd2b5('0x3a')]:_0x946d96[_0xd2b5('0x35')];if(_0x1df126[_0xd2b5('0x37')]['includeAll']){_0x334288['include']=[{'all':!![]}];}_0x334288=_['merge']({},_0x334288,_0x1df126[_0xd2b5('0x46')]);return db[_0xd2b5('0x33')][_0xd2b5('0x4d')](_0x334288)[_0xd2b5('0x1b')](handleEntityNotFound(_0x1a5cbd,null))['then'](respondWithResult(_0x1a5cbd,null))[_0xd2b5('0x4a')](handleError(_0x1a5cbd,null));};exports['create']=function(_0x1ea30e,_0x120bb3){return db['Dynamics365Account'][_0xd2b5('0x4e')](_0x1ea30e[_0xd2b5('0x4f')],{})[_0xd2b5('0x1b')](respondWithResult(_0x120bb3,0xc9))['catch'](handleError(_0x120bb3,null));};exports['update']=function(_0x416782,_0x32bd99){if(_0x416782['body']['id']){delete _0x416782[_0xd2b5('0x4f')]['id'];}return db['Dynamics365Account'][_0xd2b5('0x4d')]({'where':{'id':_0x416782[_0xd2b5('0x50')]['id']}})[_0xd2b5('0x1b')](handleEntityNotFound(_0x32bd99,null))[_0xd2b5('0x1b')](saveUpdates(_0x416782[_0xd2b5('0x4f')],null))[_0xd2b5('0x1b')](respondWithResult(_0x32bd99,null))[_0xd2b5('0x4a')](handleError(_0x32bd99,null));};exports[_0xd2b5('0x2e')]=function(_0x180950,_0x3633b8){return db[_0xd2b5('0x33')][_0xd2b5('0x4d')]({'where':{'id':_0x180950['params']['id']}})['then'](handleEntityNotFound(_0x3633b8,null))['then'](removeEntity(_0x3633b8,null))[_0xd2b5('0x4a')](handleError(_0x3633b8,null));};exports[_0xd2b5('0x51')]=function(_0x3bee45,_0x1bab45,_0x5440b6){var _0x20d0ab={};var _0x5eca70={};var _0x53e2a1;var _0x428445;return db[_0xd2b5('0x33')][_0xd2b5('0x52')]({'where':{'id':_0x3bee45[_0xd2b5('0x50')]['id']}})[_0xd2b5('0x1b')](handleEntityNotFound(_0x1bab45,null))[_0xd2b5('0x1b')](function(_0x19d3de){if(_0x19d3de){_0x53e2a1=_0x19d3de;_0x5eca70[_0xd2b5('0x35')]=_['keys'](db[_0xd2b5('0x53')]['rawAttributes']);_0x5eca70[_0xd2b5('0x37')]=_[_0xd2b5('0x36')](_0x3bee45['query']);_0x5eca70[_0xd2b5('0x38')]=_[_0xd2b5('0x39')](_0x5eca70[_0xd2b5('0x35')],_0x5eca70[_0xd2b5('0x37')]);_0x20d0ab[_0xd2b5('0x3a')]=_['intersection'](_0x5eca70[_0xd2b5('0x35')],qs[_0xd2b5('0x3b')](_0x3bee45[_0xd2b5('0x37')]['fields']));_0x20d0ab[_0xd2b5('0x3a')]=_0x20d0ab['attributes']['length']?_0x20d0ab[_0xd2b5('0x3a')]:_0x5eca70['model'];_0x20d0ab[_0xd2b5('0x3d')]=qs[_0xd2b5('0x3e')](_0x3bee45[_0xd2b5('0x37')]['sort']);_0x20d0ab[_0xd2b5('0x3f')]=qs[_0xd2b5('0x38')](_[_0xd2b5('0x54')](_0x3bee45[_0xd2b5('0x37')],_0x5eca70[_0xd2b5('0x38')]));if(_0x3bee45['query'][_0xd2b5('0x40')]){_0x20d0ab['where']=_[_0xd2b5('0x55')](_0x20d0ab['where'],{'$or':_[_0xd2b5('0x41')](_0x20d0ab['attributes'],function(_0x149f9f){var _0xbdb212={};_0xbdb212[_0x149f9f]={'$like':'%'+_0x3bee45[_0xd2b5('0x37')][_0xd2b5('0x40')]+'%'};return _0xbdb212;})});}_0x20d0ab=_[_0xd2b5('0x55')]({},_0x20d0ab,_0x3bee45['options']);return _0x53e2a1['getConfigurations'](_0x20d0ab);}})['then'](function(_0x229e3e){if(_0x229e3e){_0x428445=_0x229e3e[_0xd2b5('0x4c')];if(!_0x3bee45[_0xd2b5('0x37')]['hasOwnProperty'](_0xd2b5('0x3c'))){_0x20d0ab[_0xd2b5('0x29')]=qs[_0xd2b5('0x29')](_0x3bee45[_0xd2b5('0x37')][_0xd2b5('0x29')]);_0x20d0ab['offset']=qs[_0xd2b5('0x28')](_0x3bee45[_0xd2b5('0x37')][_0xd2b5('0x28')]);}return _0x53e2a1[_0xd2b5('0x51')](_0x20d0ab);}})[_0xd2b5('0x1b')](function(_0x31fb1a){if(_0x31fb1a){return _0x31fb1a?{'count':_0x428445,'rows':_0x31fb1a}:null;}})['then'](respondWithResult(_0x1bab45,null))[_0xd2b5('0x4a')](handleError(_0x1bab45,null));};exports['addConfiguration']=function(_0x39a518,_0x5663c4,_0x18cd89){if(_0x39a518[_0xd2b5('0x4f')]['id']){delete _0x39a518[_0xd2b5('0x4f')]['id'];}return db[_0xd2b5('0x33')][_0xd2b5('0x52')]({'where':{'id':_0x39a518['params']['id']}})[_0xd2b5('0x1b')](handleEntityNotFound(_0x5663c4,null))[_0xd2b5('0x1b')](function(_0x16c1fa){if(_0x16c1fa){_0x39a518[_0xd2b5('0x4f')][_0xd2b5('0x56')]=_0x16c1fa['id'];_0x39a518[_0xd2b5('0x4f')][_0xd2b5('0x57')]=integrations[_0xd2b5('0x58')](_0x39a518[_0xd2b5('0x4f')][_0xd2b5('0x59')],_0x39a518[_0xd2b5('0x4f')][_0xd2b5('0x42')]);_0x39a518[_0xd2b5('0x4f')][_0xd2b5('0x5a')]=integrations['getDescriptions'](_0x39a518[_0xd2b5('0x4f')][_0xd2b5('0x59')],_0x39a518['body'][_0xd2b5('0x42')]);return db[_0xd2b5('0x53')]['create'](_0x39a518['body'],{'include':[{'model':db[_0xd2b5('0x5b')],'as':'Subjects'},{'model':db[_0xd2b5('0x5b')],'as':_0xd2b5('0x5a')}]});}return null;})[_0xd2b5('0x1b')](respondWithResult(_0x5663c4,null))[_0xd2b5('0x4a')](handleError(_0x5663c4,null));};exports[_0xd2b5('0x5c')]=function(_0x8927e7,_0x39a7dd,_0x5e8589){var _0x1b680d=_0x8927e7[_0xd2b5('0x37')]['ticketType'];var _0x34f77e=_0x1b680d==='incident'?_0xd2b5('0x5d'):_0xd2b5('0x5e');var _0x335e97='';var _0xe4b975='';var _0x31ba22='';var _0x319aa3='';var _0xeca27a='';var _0x38e094='';var _0x237389='';var _0x5e8e81='';var _0x1c1b74=[_0xd2b5('0x5f'),'description',_0xd2b5('0x60'),_0xd2b5('0x61'),_0xd2b5('0x62'),_0xd2b5('0x63'),_0xd2b5('0x64'),_0xd2b5('0x65'),_0xd2b5('0x66'),_0xd2b5('0x67')];var _0x430154=[_0xd2b5('0x68'),_0xd2b5('0x69'),_0xd2b5('0x6a'),_0xd2b5('0x6b'),'contactidname',_0xd2b5('0x6c'),_0xd2b5('0x6d'),_0xd2b5('0x6e'),_0xd2b5('0x6f'),_0xd2b5('0x70'),_0xd2b5('0x71'),'createdbyyominame',_0xd2b5('0x72'),_0xd2b5('0x73'),_0xd2b5('0x74'),_0xd2b5('0x75'),_0xd2b5('0x76'),_0xd2b5('0x77'),_0xd2b5('0x78'),_0xd2b5('0x79'),_0xd2b5('0x7a'),_0xd2b5('0x7b'),'escalatedon',_0xd2b5('0x7c'),_0xd2b5('0x7d'),_0xd2b5('0x7e'),_0xd2b5('0x7f'),'influencescore',_0xd2b5('0x80'),_0xd2b5('0x81'),'masteridname','modifiedbyexternalpartyname',_0xd2b5('0x82'),_0xd2b5('0x83'),_0xd2b5('0x84'),'modifiedon',_0xd2b5('0x85'),_0xd2b5('0x86'),_0xd2b5('0x87'),_0xd2b5('0x88'),_0xd2b5('0x89'),_0xd2b5('0x8a'),_0xd2b5('0x8b'),_0xd2b5('0x8c'),'owneridtype','owneridyominame',_0xd2b5('0x8d'),_0xd2b5('0x8e'),'primarycontactidyominame',_0xd2b5('0x8f'),'productidname',_0xd2b5('0x90'),_0xd2b5('0x91'),_0xd2b5('0x92'),_0xd2b5('0x93'),_0xd2b5('0x94'),_0xd2b5('0x95'),_0xd2b5('0x96'),'slainvokedidname',_0xd2b5('0x97'),_0xd2b5('0x98'),_0xd2b5('0x99'),'statuscode',_0xd2b5('0x9a'),'ticketnumber',_0xd2b5('0x9b'),_0xd2b5('0x9c'),_0xd2b5('0x9d'),_0xd2b5('0x9e'),_0xd2b5('0x9f')];var _0x15c66c=_0x1c1b74[_0xd2b5('0xa0')](_0x430154);return db[_0xd2b5('0x33')][_0xd2b5('0x52')]({'where':{'id':_0x8927e7[_0xd2b5('0x50')]['id']},'attributes':['id',_0xd2b5('0xa1'),_0xd2b5('0xa2'),_0xd2b5('0xa3'),_0xd2b5('0xa4'),_0xd2b5('0xa5'),_0xd2b5('0xa6')]})['then'](handleEntityNotFound(_0x39a7dd,null))[_0xd2b5('0x1b')](function(_0x5c7310){if(_0x5c7310){_0x5e8e81=_0x5c7310[_0xd2b5('0xa3')];var _0x13db90=_0x5e8e81[_0xd2b5('0xa7')](-0x1);if(_0x13db90==='/'){_0x5e8e81=_0x5e8e81[_0xd2b5('0xa8')](0x0,_0x5e8e81[_0xd2b5('0xa9')](_0x13db90));}_0x237389=util[_0xd2b5('0xaa')](_0xd2b5('0xab'),_0x5e8e81);var _0xadc359={'method':'POST','uri':_0xd2b5('0xac')+_0x5c7310[_0xd2b5('0xa4')]+'/oauth2/token','form':{'client_id':_0x5c7310[_0xd2b5('0xa5')],'resource':_0x5e8e81,'username':_0x5c7310[_0xd2b5('0xa1')],'password':_0x5c7310[_0xd2b5('0xa2')],'grant_type':_0xd2b5('0xa2'),'client_secret':_0x5c7310[_0xd2b5('0xa6')]},'json':!![]};return rp(_0xadc359);}})[_0xd2b5('0x1b')](function(_0x386fc2){_0x38e094=_0x386fc2['access_token'];var _0xef897d={'method':'GET','uri':encodeURI(_0x237389+_0xd2b5('0xad')+_0x34f77e+'\x27'),'headers':{'Authorization':_0xd2b5('0xae')+_0x38e094,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xef897d);})[_0xd2b5('0x1b')](function(_0x47d10d){var _0x3b845d=_0x47d10d[_0xd2b5('0xaf')][0x0];var _0x1997ab=_0x3b845d[_0xd2b5('0xb0')];var _0x106048={'method':_0xd2b5('0xb1'),'uri':_0x237389+_0xd2b5('0xb2')+_0x1997ab+_0xd2b5('0xb3'),'headers':{'Authorization':_0xd2b5('0xae')+_0x38e094,'If-None-Match':null,'OData-Version':_0xd2b5('0xb4')},'json':!![]};return rp(_0x106048);})[_0xd2b5('0x1b')](function(_0x1f39ed){_0x335e97=_0x1f39ed;_0xe4b975=_0x335e97[_0xd2b5('0xb5')];_0xe4b975=_[_0xd2b5('0xb6')](_0xe4b975,function(_0x22ed33){return!_0x15c66c[_0xd2b5('0xb7')](_0x22ed33['LogicalName']);});var _0xe11c8=[];var _0x38d9de=[];_0xe4b975['forEach'](function(_0x2367e7){if(_0x2367e7['@odata.type']){var _0x50c74c=_0x2367e7[_0xd2b5('0xb8')][_0xd2b5('0xa8')](_0x2367e7[_0xd2b5('0xb8')][_0xd2b5('0xa9')]('.')+0x1);if(_0x50c74c==='PicklistAttributeMetadata'){_0xe11c8[_0xd2b5('0xb9')](getSelectList(_0x237389,_0x1b680d,_0x38d9de,_0x335e97[_0xd2b5('0xb0')],_0x2367e7['MetadataId'],_0x38e094));}}});return Promise[_0xd2b5('0xba')](_0xe11c8);})[_0xd2b5('0x1b')](function(_0x3ea9df){_0x31ba22=_0x3ea9df[0x0];var _0xd95bbb=[];var _0xc35d9f=[];_0xe4b975[_0xd2b5('0xbb')](function(_0x226a22){if(!_[_0xd2b5('0xbc')](_0x226a22[_0xd2b5('0xb8')])){var _0x18497b=_0x226a22[_0xd2b5('0xb8')][_0xd2b5('0xa8')](_0x226a22[_0xd2b5('0xb8')][_0xd2b5('0xa9')]('.')+0x1);if(_0x18497b==='BooleanAttributeMetadata'){_0xd95bbb[_0xd2b5('0xb9')](getBooleanList(_0x237389,_0x1b680d,_0xc35d9f,_0x335e97['MetadataId'],_0x226a22[_0xd2b5('0xb0')],_0x38e094));}}});return Promise[_0xd2b5('0xba')](_0xd95bbb);})[_0xd2b5('0x1b')](function(_0x10728c){_0x319aa3=_0x10728c[0x0];var _0x29f1e4=[];var _0x2e1750=[];_0xe4b975['forEach'](function(_0xc106ab){if(_0xc106ab[_0xd2b5('0xb8')]){var _0x150f7b=_0xc106ab[_0xd2b5('0xb8')]['substring'](_0xc106ab[_0xd2b5('0xb8')][_0xd2b5('0xa9')]('.')+0x1);if(_0x150f7b===_0xd2b5('0xbd')||_0x150f7b===_0xd2b5('0xbe')||_0x150f7b==='BigIntAttributeMetadata'||_0x150f7b===_0xd2b5('0xbf')||_0x150f7b===_0xd2b5('0xc0')||_0x150f7b===_0xd2b5('0xc1')||_0x150f7b==='StatusAttributeMetadata'||_0x150f7b===_0xd2b5('0xc2')||_0x150f7b===_0xd2b5('0xc3')||_0x150f7b===_0xd2b5('0xc4')){_0x29f1e4['push'](getInputList(_0x237389,_0x1b680d,_0x150f7b,_0x2e1750,_0x335e97[_0xd2b5('0xb0')],_0xc106ab['MetadataId'],_0x38e094));}}});return Promise[_0xd2b5('0xba')](_0x29f1e4);})[_0xd2b5('0x1b')](function(_0x453b0e){_0xeca27a=_0x453b0e[0x0];var _0x5b8b5a=_0x31ba22[_0xd2b5('0xa0')](_0x319aa3)[_0xd2b5('0xa0')](_0xeca27a);var _0x231afc={'count':_0x5b8b5a['length'],'rows':_0x5b8b5a};return _0x231afc;})['then'](respondWithResult(_0x39a7dd,null))[_0xd2b5('0x4a')](function(_0x4f5b18){console[_0xd2b5('0xc5')](_0xd2b5('0xc6')+_0x4f5b18);var _0x480d63=_0x8927e7[_0xd2b5('0x37')][_0xd2b5('0xc7')]?0x1f4:_0x4f5b18[_0xd2b5('0xc8')]||0x1f4;logger[_0xd2b5('0x21')](_0x4f5b18[_0xd2b5('0x2f')]);delete _0x4f5b18[_0xd2b5('0x30')];if(_0x480d63===0x191){_0x480d63=0x190;}_0x39a7dd[_0xd2b5('0x25')](_0x480d63)['send'](_0x8927e7[_0xd2b5('0x37')][_0xd2b5('0xc7')]?{'message':_0xd2b5('0xc9'),'statusCode':_0x4f5b18[_0xd2b5('0xc8')]}:_0x4f5b18);});};function getSelectList(_0x1d1b0e,_0x3330cd,_0x473987,_0xe86b4e,_0x306309,_0x1d8e92){var _0x5ee0ca={'method':_0xd2b5('0xb1'),'uri':_0x1d1b0e+_0xd2b5('0xb2')+_0xe86b4e+_0xd2b5('0xca')+_0x306309+_0xd2b5('0xcb')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xd2b5('0xae')+_0x1d8e92,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5ee0ca)[_0xd2b5('0x1b')](function(_0x323605){var _0x2d2d97=[];var _0x279f8c=_0x323605['OptionSet'][_0xd2b5('0xcc')];_0x279f8c[_0xd2b5('0xbb')](function(_0xf24d65){_0x2d2d97[_0xd2b5('0xb9')]({'name':_0xf24d65[_0xd2b5('0xcd')][_0xd2b5('0xce')]['Label'],'value':String(_0xf24d65[_0xd2b5('0xcf')])});});var _0x696bee={'id':_0x3330cd+'_'+_0x323605[_0xd2b5('0xd0')],'name':_0x323605['DisplayName'][_0xd2b5('0xce')][_0xd2b5('0xcd')],'custom':![],'options':_0x2d2d97};_0x473987[_0xd2b5('0xb9')](_0x696bee);return _0x473987;});}function getBooleanList(_0x333f74,_0x41558e,_0x9c2303,_0x5df962,_0x1ee1b6,_0x3c9470){var _0x52f185={'method':_0xd2b5('0xb1'),'uri':_0x333f74+_0xd2b5('0xb2')+_0x5df962+_0xd2b5('0xca')+_0x1ee1b6+_0xd2b5('0xd1'),'headers':{'Authorization':_0xd2b5('0xae')+_0x3c9470,'If-None-Match':null,'OData-Version':_0xd2b5('0xb4')},'json':!![]};return rp(_0x52f185)[_0xd2b5('0x1b')](function(_0x252d3c){var _0x22b281=[];_0x22b281['push']({'name':_0x252d3c['OptionSet'][_0xd2b5('0xd2')][_0xd2b5('0xcd')]['UserLocalizedLabel'][_0xd2b5('0xcd')],'value':_0xd2b5('0xd3')},{'name':_0x252d3c[_0xd2b5('0xd4')]['FalseOption'][_0xd2b5('0xcd')][_0xd2b5('0xce')][_0xd2b5('0xcd')],'value':'false'});var _0x349d55={'id':_0x41558e+'_'+_0x252d3c[_0xd2b5('0xd0')],'name':_0x252d3c[_0xd2b5('0xd5')][_0xd2b5('0xce')][_0xd2b5('0xcd')],'custom':![],'options':_0x22b281};_0x9c2303[_0xd2b5('0xb9')](_0x349d55);return _0x9c2303;});}function getInputList(_0xef51cf,_0x4be8d2,_0x37c1ae,_0x1863b7,_0xef38cc,_0x2b2c76,_0xacd330){var _0x162230={'method':_0xd2b5('0xb1'),'uri':_0xef51cf+'EntityDefinitions('+_0xef38cc+')/Attributes('+_0x2b2c76+')/Microsoft.Dynamics.CRM.'+_0x37c1ae+_0xd2b5('0xd6'),'headers':{'Authorization':'Bearer\x20'+_0xacd330,'If-None-Match':null,'OData-Version':_0xd2b5('0xb4')},'json':!![]};return rp(_0x162230)[_0xd2b5('0x1b')](function(_0x126bfa){var _0x1a58fd={'id':_0x4be8d2+'_'+_0x126bfa[_0xd2b5('0xd0')],'name':_0x126bfa[_0xd2b5('0xd5')]['UserLocalizedLabel']?_0x126bfa[_0xd2b5('0xd5')][_0xd2b5('0xce')]['Label']:_0x126bfa[_0xd2b5('0xd0')],'custom':![],'options':[]};_0x1863b7[_0xd2b5('0xb9')](_0x1a58fd);return _0x1863b7;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 9dea944..2082ef6 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 _0xb86c=['../../components/integrations/configuration','exports','define','Dynamics365Account','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4c111d,_0x291a56){var _0x516366=function(_0x3eb5aa){while(--_0x3eb5aa){_0x4c111d['push'](_0x4c111d['shift']());}};_0x516366(++_0x291a56);}(_0xb86c,0x158));var _0xcb86=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb86c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xcb86('0x0'));var util=require(_0xcb86('0x1'));var logger=require(_0xcb86('0x2'))(_0xcb86('0x3'));var moment=require('moment');var BPromise=require(_0xcb86('0x4'));var rp=require(_0xcb86('0x5'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xcb86('0x6'));module[_0xcb86('0x7')]=function(_0x52b64d,_0x33e668){return _0x52b64d[_0xcb86('0x8')](_0xcb86('0x9'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00dc=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','./intDynamics365Account.attributes','../../components/integrations/configuration','define','Dynamics365Account'];(function(_0xfcee03,_0x53e5e5){var _0x381cfb=function(_0x45106a){while(--_0x45106a){_0xfcee03['push'](_0xfcee03['shift']());}};_0x381cfb(++_0x53e5e5);}(_0x00dc,0xd9));var _0xc00d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x00dc[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xc00d('0x0'));var util=require('util');var logger=require(_0xc00d('0x1'))('api');var moment=require(_0xc00d('0x2'));var BPromise=require('bluebird');var rp=require(_0xc00d('0x3'));var attributes=require(_0xc00d('0x4'));var integrations=require(_0xc00d('0x5'));module['exports']=function(_0x9440d1,_0x1fd755){return _0x9440d1[_0xc00d('0x6')](_0xc00d('0x7'),attributes,{'tableName':_0xc00d('0x8'),'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 ee661cf..f38266c 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 _0x7981=['findAll','options','raw','where','attributes','limit','include','map','model','then','GetDynamics365Account','debug','ShowDynamics365Account','find','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','Dynamics365Account'];(function(_0x38b2d6,_0x45b152){var _0x4921a9=function(_0x290fb2){while(--_0x290fb2){_0x38b2d6['push'](_0x38b2d6['shift']());}};_0x4921a9(++_0x45b152);}(_0x7981,0x1ae));var _0x1798=function(_0xe52e27,_0x15a6a3){_0xe52e27=_0xe52e27-0x0;var _0x315e42=_0x7981[_0xe52e27];return _0x315e42;};'use strict';var _=require('lodash');var util=require(_0x1798('0x0'));var moment=require('moment');var BPromise=require(_0x1798('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1798('0x2'));var db=require(_0x1798('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1798('0x4'));var config=require(_0x1798('0x5'));var jayson=require(_0x1798('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x116033,_0x2fa9c7,_0x4782f0){return new BPromise(function(_0x5399bb,_0x3d4f6f){return client['request'](_0x116033,_0x4782f0)['then'](function(_0x318003){logger[_0x1798('0x7')]('Dynamics365Account,\x20%s,\x20%s',_0x2fa9c7,_0x1798('0x8'));logger['debug'](_0x1798('0x9'),_0x2fa9c7,_0x1798('0x8'),JSON[_0x1798('0xa')](_0x318003));if(_0x318003[_0x1798('0xb')]){if(_0x318003[_0x1798('0xb')][_0x1798('0xc')]===0x1f4){logger[_0x1798('0xb')](_0x1798('0xd'),_0x2fa9c7,_0x318003[_0x1798('0xb')][_0x1798('0xe')]);return _0x3d4f6f(_0x318003['error'][_0x1798('0xe')]);}logger['error'](_0x1798('0xd'),_0x2fa9c7,_0x318003[_0x1798('0xb')][_0x1798('0xe')]);return _0x5399bb(_0x318003['error'][_0x1798('0xe')]);}else{logger[_0x1798('0x7')](_0x1798('0xd'),_0x2fa9c7,_0x1798('0x8'));_0x5399bb(_0x318003[_0x1798('0xf')][_0x1798('0xe')]);}})[_0x1798('0x10')](function(_0x4b1ced){logger[_0x1798('0xb')](_0x1798('0xd'),_0x2fa9c7,_0x4b1ced);_0x3d4f6f(_0x4b1ced);});});}exports['GetDynamics365Account']=function(_0x36a826){var _0x50f26c=this;return new Promise(function(_0x1a12b5,_0x4be1c6){return db[_0x1798('0x11')][_0x1798('0x12')]({'raw':_0x36a826[_0x1798('0x13')]?_0x36a826[_0x1798('0x13')][_0x1798('0x14')]===undefined?!![]:![]:!![],'where':_0x36a826[_0x1798('0x13')]?_0x36a826['options'][_0x1798('0x15')]||null:null,'attributes':_0x36a826[_0x1798('0x13')]?_0x36a826[_0x1798('0x13')][_0x1798('0x16')]||null:null,'limit':_0x36a826['options']?_0x36a826[_0x1798('0x13')][_0x1798('0x17')]||null:null,'include':_0x36a826[_0x1798('0x13')]?_0x36a826[_0x1798('0x13')][_0x1798('0x18')]?_[_0x1798('0x19')](_0x36a826[_0x1798('0x13')][_0x1798('0x18')],function(_0x2532fc){return{'model':db[_0x2532fc[_0x1798('0x1a')]],'as':_0x2532fc['as'],'attributes':_0x2532fc[_0x1798('0x16')],'include':_0x2532fc[_0x1798('0x18')]?_[_0x1798('0x19')](_0x2532fc[_0x1798('0x18')],function(_0x31ef6a){return{'model':db[_0x31ef6a[_0x1798('0x1a')]],'as':_0x31ef6a['as'],'attributes':_0x31ef6a['attributes'],'include':_0x31ef6a[_0x1798('0x18')]?_['map'](_0x31ef6a['include'],function(_0xadeddc){return{'model':db[_0xadeddc[_0x1798('0x1a')]],'as':_0xadeddc['as'],'attributes':_0xadeddc[_0x1798('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1798('0x1b')](function(_0x416958){logger['info'](_0x1798('0x1c'),_0x36a826);logger[_0x1798('0x1d')](_0x1798('0x1c'),_0x36a826,JSON['stringify'](_0x416958));_0x1a12b5(_0x416958);})['catch'](function(_0x3ee61d){logger[_0x1798('0xb')](_0x1798('0x1c'),_0x3ee61d[_0x1798('0xe')],_0x36a826);_0x4be1c6(_0x50f26c[_0x1798('0xb')](0x1f4,_0x3ee61d['message']));});});};exports[_0x1798('0x1e')]=function(_0xd853f5){var _0x3b2dd8=this;return new Promise(function(_0x2da41f,_0x22da4d){return db[_0x1798('0x11')][_0x1798('0x1f')]({'raw':_0xd853f5['options']?_0xd853f5[_0x1798('0x13')][_0x1798('0x14')]===undefined?!![]:![]:!![],'where':_0xd853f5[_0x1798('0x13')]?_0xd853f5[_0x1798('0x13')]['where']||null:null,'attributes':_0xd853f5[_0x1798('0x13')]?_0xd853f5[_0x1798('0x13')]['attributes']||null:null,'include':_0xd853f5[_0x1798('0x13')]?_0xd853f5[_0x1798('0x13')][_0x1798('0x18')]?_[_0x1798('0x19')](_0xd853f5[_0x1798('0x13')]['include'],function(_0x178fcb){return{'model':db[_0x178fcb[_0x1798('0x1a')]],'as':_0x178fcb['as'],'attributes':_0x178fcb[_0x1798('0x16')],'include':_0x178fcb[_0x1798('0x18')]?_[_0x1798('0x19')](_0x178fcb[_0x1798('0x18')],function(_0x5369a8){return{'model':db[_0x5369a8[_0x1798('0x1a')]],'as':_0x5369a8['as'],'attributes':_0x5369a8['attributes'],'include':_0x5369a8[_0x1798('0x18')]?_[_0x1798('0x19')](_0x5369a8['include'],function(_0x592a3a){return{'model':db[_0x592a3a['model']],'as':_0x592a3a['as'],'attributes':_0x592a3a[_0x1798('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1798('0x1b')](function(_0x433868){logger[_0x1798('0x7')]('ShowDynamics365Account',_0xd853f5);logger[_0x1798('0x1d')](_0x1798('0x1e'),_0xd853f5,JSON[_0x1798('0xa')](_0x433868));_0x2da41f(_0x433868);})['catch'](function(_0x1a6487){logger['error'](_0x1798('0x1e'),_0x1a6487[_0x1798('0xe')],_0xd853f5);_0x22da4d(_0x3b2dd8[_0x1798('0xb')](0x1f4,_0x1a6487[_0x1798('0xe')]));});});}; \ No newline at end of file +var _0xd6a4=['message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowDynamics365Account','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x40d022,_0x4489a2){var _0x4720f6=function(_0x11593c){while(--_0x11593c){_0x40d022['push'](_0x40d022['shift']());}};_0x4720f6(++_0x4489a2);}(_0xd6a4,0x190));var _0x4d6a=function(_0x17fa0f,_0x4e1549){_0x17fa0f=_0x17fa0f-0x0;var _0x148de3=_0xd6a4[_0x17fa0f];return _0x148de3;};'use strict';var _=require(_0x4d6a('0x0'));var util=require(_0x4d6a('0x1'));var moment=require(_0x4d6a('0x2'));var BPromise=require(_0x4d6a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d6a('0x4'))['db'];var utils=require(_0x4d6a('0x5'));var logger=require(_0x4d6a('0x6'))('rpc');var config=require(_0x4d6a('0x7'));var jayson=require(_0x4d6a('0x8'));var client=jayson[_0x4d6a('0x9')][_0x4d6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28fb2a,_0x397e82,_0x86e3){return new BPromise(function(_0x57ee33,_0x3efba2){return client[_0x4d6a('0xb')](_0x28fb2a,_0x86e3)[_0x4d6a('0xc')](function(_0x4cc7e1){logger[_0x4d6a('0xd')](_0x4d6a('0xe'),_0x397e82,_0x4d6a('0xf'));logger['debug'](_0x4d6a('0x10'),_0x397e82,_0x4d6a('0xf'),JSON[_0x4d6a('0x11')](_0x4cc7e1));if(_0x4cc7e1['error']){if(_0x4cc7e1[_0x4d6a('0x12')][_0x4d6a('0x13')]===0x1f4){logger[_0x4d6a('0x12')](_0x4d6a('0xe'),_0x397e82,_0x4cc7e1['error']['message']);return _0x3efba2(_0x4cc7e1[_0x4d6a('0x12')][_0x4d6a('0x14')]);}logger[_0x4d6a('0x12')](_0x4d6a('0xe'),_0x397e82,_0x4cc7e1[_0x4d6a('0x12')][_0x4d6a('0x14')]);return _0x57ee33(_0x4cc7e1[_0x4d6a('0x12')][_0x4d6a('0x14')]);}else{logger[_0x4d6a('0xd')](_0x4d6a('0xe'),_0x397e82,'request\x20sent');_0x57ee33(_0x4cc7e1['result'][_0x4d6a('0x14')]);}})[_0x4d6a('0x15')](function(_0x59f5b9){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x397e82,_0x59f5b9);_0x3efba2(_0x59f5b9);});});}exports[_0x4d6a('0x16')]=function(_0xc36b06){var _0xb42566=this;return new Promise(function(_0x27a698,_0x1b3adb){return db[_0x4d6a('0x17')][_0x4d6a('0x18')]({'raw':_0xc36b06[_0x4d6a('0x19')]?_0xc36b06[_0x4d6a('0x19')][_0x4d6a('0x1a')]===undefined?!![]:![]:!![],'where':_0xc36b06[_0x4d6a('0x19')]?_0xc36b06[_0x4d6a('0x19')][_0x4d6a('0x1b')]||null:null,'attributes':_0xc36b06[_0x4d6a('0x19')]?_0xc36b06[_0x4d6a('0x19')][_0x4d6a('0x1c')]||null:null,'limit':_0xc36b06[_0x4d6a('0x19')]?_0xc36b06[_0x4d6a('0x19')][_0x4d6a('0x1d')]||null:null,'include':_0xc36b06['options']?_0xc36b06['options'][_0x4d6a('0x1e')]?_['map'](_0xc36b06['options'][_0x4d6a('0x1e')],function(_0x5bd7c5){return{'model':db[_0x5bd7c5[_0x4d6a('0x1f')]],'as':_0x5bd7c5['as'],'attributes':_0x5bd7c5[_0x4d6a('0x1c')],'include':_0x5bd7c5[_0x4d6a('0x1e')]?_['map'](_0x5bd7c5['include'],function(_0x214f85){return{'model':db[_0x214f85[_0x4d6a('0x1f')]],'as':_0x214f85['as'],'attributes':_0x214f85[_0x4d6a('0x1c')],'include':_0x214f85[_0x4d6a('0x1e')]?_[_0x4d6a('0x20')](_0x214f85[_0x4d6a('0x1e')],function(_0x4c5ece){return{'model':db[_0x4c5ece[_0x4d6a('0x1f')]],'as':_0x4c5ece['as'],'attributes':_0x4c5ece[_0x4d6a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4d6a('0xc')](function(_0x297973){logger[_0x4d6a('0xd')](_0x4d6a('0x16'),_0xc36b06);logger[_0x4d6a('0x21')]('GetDynamics365Account',_0xc36b06,JSON['stringify'](_0x297973));_0x27a698(_0x297973);})[_0x4d6a('0x15')](function(_0x3f2c1f){logger[_0x4d6a('0x12')]('GetDynamics365Account',_0x3f2c1f['message'],_0xc36b06);_0x1b3adb(_0xb42566['error'](0x1f4,_0x3f2c1f['message']));});});};exports[_0x4d6a('0x22')]=function(_0x3f1f2a){var _0x281065=this;return new Promise(function(_0x3e0b65,_0x385c64){return db[_0x4d6a('0x17')]['find']({'raw':_0x3f1f2a[_0x4d6a('0x19')]?_0x3f1f2a[_0x4d6a('0x19')][_0x4d6a('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f1f2a[_0x4d6a('0x19')]?_0x3f1f2a[_0x4d6a('0x19')][_0x4d6a('0x1b')]||null:null,'attributes':_0x3f1f2a[_0x4d6a('0x19')]?_0x3f1f2a[_0x4d6a('0x19')][_0x4d6a('0x1c')]||null:null,'include':_0x3f1f2a['options']?_0x3f1f2a['options'][_0x4d6a('0x1e')]?_[_0x4d6a('0x20')](_0x3f1f2a[_0x4d6a('0x19')]['include'],function(_0x469f8c){return{'model':db[_0x469f8c['model']],'as':_0x469f8c['as'],'attributes':_0x469f8c[_0x4d6a('0x1c')],'include':_0x469f8c['include']?_[_0x4d6a('0x20')](_0x469f8c[_0x4d6a('0x1e')],function(_0x3ee42e){return{'model':db[_0x3ee42e[_0x4d6a('0x1f')]],'as':_0x3ee42e['as'],'attributes':_0x3ee42e[_0x4d6a('0x1c')],'include':_0x3ee42e[_0x4d6a('0x1e')]?_[_0x4d6a('0x20')](_0x3ee42e[_0x4d6a('0x1e')],function(_0x45aa24){return{'model':db[_0x45aa24['model']],'as':_0x45aa24['as'],'attributes':_0x45aa24['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d6a('0xc')](function(_0x1d0f57){logger[_0x4d6a('0xd')]('ShowDynamics365Account',_0x3f1f2a);logger[_0x4d6a('0x21')](_0x4d6a('0x22'),_0x3f1f2a,JSON[_0x4d6a('0x11')](_0x1d0f57));_0x3e0b65(_0x1d0f57);})[_0x4d6a('0x15')](function(_0x21fd92){logger[_0x4d6a('0x12')]('ShowDynamics365Account',_0x21fd92[_0x4d6a('0x14')],_0x3f1f2a);_0x385c64(_0x281065[_0x4d6a('0x12')](0x1f4,_0x21fd92[_0x4d6a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0e2fa38..fb824ad 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 _0x87ba=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','exports','multer','util','path'];(function(_0x1ff603,_0x13edc2){var _0x3edd65=function(_0x1a65ef){while(--_0x1a65ef){_0x1ff603['push'](_0x1ff603['shift']());}};_0x3edd65(++_0x13edc2);}(_0x87ba,0x1c5));var _0xa87b=function(_0xa69733,_0x2aa122){_0xa69733=_0xa69733-0x0;var _0xca5645=_0x87ba[_0xa69733];return _0xca5645;};'use strict';var multer=require(_0xa87b('0x0'));var util=require(_0xa87b('0x1'));var path=require(_0xa87b('0x2'));var timeout=require(_0xa87b('0x3'));var express=require(_0xa87b('0x4'));var router=express[_0xa87b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa87b('0x6'));var config=require(_0xa87b('0x7'));var controller=require(_0xa87b('0x8'));router['get']('/',auth[_0xa87b('0x9')](),controller[_0xa87b('0xa')]);router[_0xa87b('0xb')](_0xa87b('0xc'),auth[_0xa87b('0x9')](),controller[_0xa87b('0xd')]);router[_0xa87b('0xb')](_0xa87b('0xe'),auth['isAuthenticated'](),controller[_0xa87b('0xf')]);router['get']('/:id/subjects',auth[_0xa87b('0x9')](),controller[_0xa87b('0x10')]);router[_0xa87b('0xb')](_0xa87b('0x11'),auth['isAuthenticated'](),controller[_0xa87b('0x12')]);router[_0xa87b('0x13')]('/',auth[_0xa87b('0x9')](),controller[_0xa87b('0x14')]);router[_0xa87b('0x15')]('/:id',auth[_0xa87b('0x9')](),controller[_0xa87b('0x16')]);router['delete'](_0xa87b('0xc'),auth[_0xa87b('0x9')](),controller['destroy']);module[_0xa87b('0x17')]=router; \ No newline at end of file +var _0x1ae6=['get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getDescriptions','post','put','/:id','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3765ff,_0x16916e){var _0x333f28=function(_0x208816){while(--_0x208816){_0x3765ff['push'](_0x3765ff['shift']());}};_0x333f28(++_0x16916e);}(_0x1ae6,0x1b1));var _0x61ae=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x1ae6[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require(_0x61ae('0x0'));var path=require(_0x61ae('0x1'));var timeout=require('connect-timeout');var express=require(_0x61ae('0x2'));var router=express[_0x61ae('0x3')]();var auth=require(_0x61ae('0x4'));var interaction=require(_0x61ae('0x5'));var config=require(_0x61ae('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0x61ae('0x7')]('/',auth[_0x61ae('0x8')](),controller[_0x61ae('0x9')]);router[_0x61ae('0x7')]('/:id',auth[_0x61ae('0x8')](),controller['show']);router[_0x61ae('0x7')](_0x61ae('0xa'),auth['isAuthenticated'](),controller[_0x61ae('0xb')]);router[_0x61ae('0x7')](_0x61ae('0xc'),auth[_0x61ae('0x8')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x61ae('0x8')](),controller[_0x61ae('0xd')]);router[_0x61ae('0xe')]('/',auth[_0x61ae('0x8')](),controller['create']);router[_0x61ae('0xf')](_0x61ae('0x10'),auth[_0x61ae('0x8')](),controller['update']);router[_0x61ae('0x11')](_0x61ae('0x10'),auth[_0x61ae('0x8')](),controller[_0x61ae('0x12')]);module[_0x61ae('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 9beb754..5d0821a 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 _0xec40=['sequelize','exports','STRING','incident','phonecall'];(function(_0x3a26e2,_0x473bd3){var _0x42594c=function(_0x3d53a8){while(--_0x3d53a8){_0x3a26e2['push'](_0x3a26e2['shift']());}};_0x42594c(++_0x473bd3);}(_0xec40,0x109));var _0x0ec4=function(_0x192cff,_0x361327){_0x192cff=_0x192cff-0x0;var _0x20d2f6=_0xec40[_0x192cff];return _0x20d2f6;};'use strict';var Sequelize=require(_0x0ec4('0x0'));module[_0x0ec4('0x1')]={'name':{'type':Sequelize[_0x0ec4('0x2')]},'description':{'type':Sequelize[_0x0ec4('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x0ec4('0x3'),_0x0ec4('0x4')),'defaultValue':'incident'}}; \ No newline at end of file +var _0x4d81=['exports','STRING','ENUM','phonecall','incident','sequelize'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x4d81,0x71));var _0x14d8=function(_0x3b1f9d,_0x45b691){_0x3b1f9d=_0x3b1f9d-0x0;var _0x1c6626=_0x4d81[_0x3b1f9d];return _0x1c6626;};'use strict';var Sequelize=require(_0x14d8('0x0'));module[_0x14d8('0x1')]={'name':{'type':Sequelize[_0x14d8('0x2')]},'description':{'type':Sequelize[_0x14d8('0x2')]},'ticketType':{'type':Sequelize[_0x14d8('0x3')]('incident',_0x14d8('0x4')),'defaultValue':_0x14d8('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e40f551..ab03ffc 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 _0x1c3d=['mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','apply','save','destroy','stack','name','send','index','rawAttributes','keys','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','Dynamics365Configuration','include','findAll','rows','show','find','create','body','update','params','getFields','findOne','nolimit','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3d8a9d,_0x31569b){var _0x2f96e3=function(_0x2064b1){while(--_0x2064b1){_0x3d8a9d['push'](_0x3d8a9d['shift']());}};_0x2f96e3(++_0x31569b);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x8ea2d1,_0x373583){_0x8ea2d1=_0x8ea2d1-0x0;var _0x4cb6db=_0x1c3d[_0x8ea2d1];return _0x4cb6db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd1c3('0x0'));var rimraf=require(_0xd1c3('0x1'));var zipdir=require(_0xd1c3('0x2'));var jsonpatch=require(_0xd1c3('0x3'));var rp=require(_0xd1c3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd1c3('0x5'));var util=require(_0xd1c3('0x6'));var path=require(_0xd1c3('0x7'));var sox=require(_0xd1c3('0x8'));var csv=require(_0xd1c3('0x9'));var ejs=require(_0xd1c3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd1c3('0xb'));var crypto=require(_0xd1c3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd1c3('0xd'));var toCsv=require(_0xd1c3('0x9'));var querystring=require(_0xd1c3('0xe'));var Papa=require(_0xd1c3('0xf'));var authService=require(_0xd1c3('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0xd1c3('0x11'));var logger=require(_0xd1c3('0x12'))(_0xd1c3('0x13'));var utils=require(_0xd1c3('0x14'));var config=require(_0xd1c3('0x15'));var db=require(_0xd1c3('0x16'))['db'];var jayson=require(_0xd1c3('0x17'));var client=jayson[_0xd1c3('0x18')][_0xd1c3('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x489c34,_0x2c78b6,_0x4f2d0b,_0x5eb3c1){return new BPromise(function(_0x11d1f3,_0x57a55e){var _0x2403c8=_0x5eb3c1||client;return _0x2403c8[_0xd1c3('0x1a')](_0x489c34,_0x4f2d0b)[_0xd1c3('0x1b')](function(_0x52e7bc){logger[_0xd1c3('0x1c')](_0xd1c3('0x1d'),_0x2c78b6,_0xd1c3('0x1e'));logger[_0xd1c3('0x1f')](_0xd1c3('0x20'),_0x2c78b6,_0xd1c3('0x1e'),JSON[_0xd1c3('0x21')](_0x52e7bc));if(_0x52e7bc[_0xd1c3('0x22')]){if(_0x52e7bc[_0xd1c3('0x22')][_0xd1c3('0x23')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x2c78b6,_0x52e7bc[_0xd1c3('0x22')][_0xd1c3('0x24')]);return _0x57a55e(_0x52e7bc[_0xd1c3('0x22')][_0xd1c3('0x24')]);}logger[_0xd1c3('0x22')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2c78b6,_0x52e7bc[_0xd1c3('0x22')][_0xd1c3('0x24')]);return _0x11d1f3(_0x52e7bc[_0xd1c3('0x22')]['message']);}else{logger['info'](_0xd1c3('0x1d'),_0x2c78b6,_0xd1c3('0x1e'));_0x11d1f3(_0x52e7bc['result']['message']);}})[_0xd1c3('0x25')](function(_0xc45d5d){logger[_0xd1c3('0x22')](_0xd1c3('0x1d'),_0x2c78b6,_0xc45d5d);_0x57a55e(_0xc45d5d);});});}function respondWithStatusCode(_0x3d396c,_0x46ed40){_0x46ed40=_0x46ed40||0xcc;return function(_0x137fd5){if(_0x137fd5){return _0x3d396c[_0xd1c3('0x26')](_0x46ed40);}return _0x3d396c[_0xd1c3('0x27')](_0x46ed40)[_0xd1c3('0x28')]();};}function respondWithResult(_0x5a9d5d,_0x56091a){_0x56091a=_0x56091a||0xc8;return function(_0x28f039){if(_0x28f039){return _0x5a9d5d[_0xd1c3('0x27')](_0x56091a)[_0xd1c3('0x29')](_0x28f039);}};}function respondWithFilteredResult(_0x227f24,_0x5d1988){return function(_0x3dc860){if(_0x3dc860){var _0x3a0bbf=_0x3dc860[_0xd1c3('0x2a')],_0x54fd33=_0x5d1988[_0xd1c3('0x2b')],_0xcb5283=_0x5d1988[_0xd1c3('0x2b')]+_0x5d1988[_0xd1c3('0x2c')],_0x3f5206;if(_0xcb5283>=_0x3a0bbf){_0xcb5283=_0x3a0bbf;_0x3f5206=0xc8;}else{_0x3f5206=0xce;}_0x227f24[_0xd1c3('0x27')](_0x3f5206);return _0x227f24['set']('Content-Range',_0x54fd33+'-'+_0xcb5283+'/'+_0x3a0bbf)[_0xd1c3('0x29')](_0x3dc860);}return null;};}function patchUpdates(_0x3eabca){return function(_0x1a4448){try{jsonpatch[_0xd1c3('0x2d')](_0x1a4448,_0x3eabca,!![]);}catch(_0x287952){return BPromise['reject'](_0x287952);}return _0x1a4448[_0xd1c3('0x2e')]();};}function saveUpdates(_0xb778ce,_0x5ce257){return function(_0x102e34){if(_0x102e34){return _0x102e34['update'](_0xb778ce)[_0xd1c3('0x1b')](function(_0x229351){return _0x229351;});}return null;};}function removeEntity(_0x32439a,_0xdf49e1){return function(_0x2c4449){if(_0x2c4449){return _0x2c4449[_0xd1c3('0x2f')]()[_0xd1c3('0x1b')](function(){_0x32439a[_0xd1c3('0x27')](0xcc)[_0xd1c3('0x28')]();});}};}function handleEntityNotFound(_0x514fed,_0x3a3323){return function(_0x143902){if(!_0x143902){_0x514fed['sendStatus'](0x194);}return _0x143902;};}function handleError(_0x349906,_0x5c9a8e){_0x5c9a8e=_0x5c9a8e||0x1f4;return function(_0x16ddc5){logger[_0xd1c3('0x22')](_0x16ddc5[_0xd1c3('0x30')]);if(_0x16ddc5['name']){delete _0x16ddc5[_0xd1c3('0x31')];}_0x349906[_0xd1c3('0x27')](_0x5c9a8e)[_0xd1c3('0x32')](_0x16ddc5);};}exports[_0xd1c3('0x33')]=function(_0x25a7a8,_0x1da9bf){var _0xfbaa06={},_0x4a8a3a={},_0x11617a={'count':0x0,'rows':[]};var _0x54145e=db['Dynamics365Configuration'][_0xd1c3('0x34')];_0x4a8a3a['model']=_[_0xd1c3('0x35')](_0x54145e);_0x4a8a3a[_0xd1c3('0x36')]=_[_0xd1c3('0x35')](_0x25a7a8[_0xd1c3('0x36')]);_0x4a8a3a[_0xd1c3('0x37')]=_[_0xd1c3('0x38')](_0x4a8a3a['model'],_0x4a8a3a[_0xd1c3('0x36')]);_0xfbaa06['attributes']=_[_0xd1c3('0x38')](_0x4a8a3a['model'],qs[_0xd1c3('0x39')](_0x25a7a8['query']['fields']));_0xfbaa06[_0xd1c3('0x3a')]=_0xfbaa06[_0xd1c3('0x3a')][_0xd1c3('0x3b')]?_0xfbaa06['attributes']:_0x4a8a3a[_0xd1c3('0x3c')];if(!_0x25a7a8[_0xd1c3('0x36')][_0xd1c3('0x3d')]('nolimit')){_0xfbaa06[_0xd1c3('0x2c')]=qs[_0xd1c3('0x2c')](_0x25a7a8[_0xd1c3('0x36')][_0xd1c3('0x2c')]);_0xfbaa06[_0xd1c3('0x2b')]=qs[_0xd1c3('0x2b')](_0x25a7a8[_0xd1c3('0x36')]['offset']);}_0xfbaa06[_0xd1c3('0x3e')]=qs[_0xd1c3('0x3f')](_0x25a7a8['query']['sort']);_0xfbaa06[_0xd1c3('0x40')]=qs[_0xd1c3('0x37')](_[_0xd1c3('0x41')](_0x25a7a8[_0xd1c3('0x36')],_0x4a8a3a[_0xd1c3('0x37')]));if(_0x25a7a8['query'][_0xd1c3('0x42')]){_0xfbaa06[_0xd1c3('0x40')]=_[_0xd1c3('0x43')](_0xfbaa06[_0xd1c3('0x40')],{'$or':_[_0xd1c3('0x44')](_0x54145e,function(_0x439f3){if(_0x439f3[_0xd1c3('0x45')][_0xd1c3('0x46')]!==_0xd1c3('0x47')){var _0x365ae1={};_0x365ae1[_0x439f3['field']]={'$like':'%'+_0x25a7a8[_0xd1c3('0x36')]['filter']+'%'};return _0x365ae1;}})});}_0xfbaa06=_[_0xd1c3('0x43')]({},_0xfbaa06,_0x25a7a8[_0xd1c3('0x48')]);var _0x13237c={'where':_0xfbaa06['where']};return db[_0xd1c3('0x49')][_0xd1c3('0x2a')](_0x13237c)[_0xd1c3('0x1b')](function(_0x1bbdcd){_0x11617a[_0xd1c3('0x2a')]=_0x1bbdcd;if(_0x25a7a8['query']['includeAll']){_0xfbaa06[_0xd1c3('0x4a')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xd1c3('0x4b')](_0xfbaa06);})[_0xd1c3('0x1b')](function(_0x426a31){_0x11617a[_0xd1c3('0x4c')]=_0x426a31;return _0x11617a;})['then'](respondWithFilteredResult(_0x1da9bf,_0xfbaa06))['catch'](handleError(_0x1da9bf,null));};exports[_0xd1c3('0x4d')]=function(_0x227078,_0x375bd5){var _0x5df790={'raw':![],'where':{'id':_0x227078['params']['id']}},_0xc860d5={};_0xc860d5[_0xd1c3('0x3c')]=_[_0xd1c3('0x35')](db[_0xd1c3('0x49')][_0xd1c3('0x34')]);_0xc860d5['query']=_['keys'](_0x227078[_0xd1c3('0x36')]);_0xc860d5[_0xd1c3('0x37')]=_[_0xd1c3('0x38')](_0xc860d5[_0xd1c3('0x3c')],_0xc860d5[_0xd1c3('0x36')]);_0x5df790[_0xd1c3('0x3a')]=_[_0xd1c3('0x38')](_0xc860d5[_0xd1c3('0x3c')],qs['fields'](_0x227078[_0xd1c3('0x36')][_0xd1c3('0x39')]));_0x5df790[_0xd1c3('0x3a')]=_0x5df790[_0xd1c3('0x3a')][_0xd1c3('0x3b')]?_0x5df790['attributes']:_0xc860d5['model'];if(_0x227078[_0xd1c3('0x36')]['includeAll']){_0x5df790[_0xd1c3('0x4a')]=[{'all':!![]}];}_0x5df790=_[_0xd1c3('0x43')]({},_0x5df790,_0x227078[_0xd1c3('0x48')]);return db['Dynamics365Configuration'][_0xd1c3('0x4e')](_0x5df790)[_0xd1c3('0x1b')](handleEntityNotFound(_0x375bd5,null))[_0xd1c3('0x1b')](respondWithResult(_0x375bd5,null))[_0xd1c3('0x25')](handleError(_0x375bd5,null));};exports[_0xd1c3('0x4f')]=function(_0x208fc8,_0x3b00ca){return db[_0xd1c3('0x49')][_0xd1c3('0x4f')](_0x208fc8[_0xd1c3('0x50')],{})[_0xd1c3('0x1b')](respondWithResult(_0x3b00ca,0xc9))[_0xd1c3('0x25')](handleError(_0x3b00ca,null));};exports[_0xd1c3('0x51')]=function(_0x18be0a,_0x59b12e){if(_0x18be0a['body']['id']){delete _0x18be0a[_0xd1c3('0x50')]['id'];}return db['Dynamics365Configuration'][_0xd1c3('0x4e')]({'where':{'id':_0x18be0a[_0xd1c3('0x52')]['id']}})[_0xd1c3('0x1b')](handleEntityNotFound(_0x59b12e,null))[_0xd1c3('0x1b')](saveUpdates(_0x18be0a[_0xd1c3('0x50')],null))[_0xd1c3('0x1b')](respondWithResult(_0x59b12e,null))[_0xd1c3('0x25')](handleError(_0x59b12e,null));};exports[_0xd1c3('0x2f')]=function(_0x2052e4,_0x204581){return db[_0xd1c3('0x49')]['find']({'where':{'id':_0x2052e4[_0xd1c3('0x52')]['id']}})[_0xd1c3('0x1b')](handleEntityNotFound(_0x204581,null))[_0xd1c3('0x1b')](removeEntity(_0x204581,null))['catch'](handleError(_0x204581,null));};exports[_0xd1c3('0x53')]=function(_0x28310f,_0x3ba3fd,_0x29d776){var _0x3ed92f={};var _0x48aae1={};var _0x1d794a;var _0xab964f;return db[_0xd1c3('0x49')][_0xd1c3('0x54')]({'where':{'id':_0x28310f[_0xd1c3('0x52')]['id']}})['then'](handleEntityNotFound(_0x3ba3fd,null))['then'](function(_0x2d3731){if(_0x2d3731){_0x1d794a=_0x2d3731;_0x48aae1['model']=_['keys'](db['Dynamics365Field'][_0xd1c3('0x34')]);_0x48aae1['query']=_[_0xd1c3('0x35')](_0x28310f[_0xd1c3('0x36')]);_0x48aae1[_0xd1c3('0x37')]=_['intersection'](_0x48aae1['model'],_0x48aae1['query']);_0x3ed92f[_0xd1c3('0x3a')]=_[_0xd1c3('0x38')](_0x48aae1[_0xd1c3('0x3c')],qs[_0xd1c3('0x39')](_0x28310f[_0xd1c3('0x36')][_0xd1c3('0x39')]));_0x3ed92f[_0xd1c3('0x3a')]=_0x3ed92f[_0xd1c3('0x3a')]['length']?_0x3ed92f['attributes']:_0x48aae1[_0xd1c3('0x3c')];_0x3ed92f[_0xd1c3('0x3e')]=qs[_0xd1c3('0x3f')](_0x28310f['query'][_0xd1c3('0x3f')]);_0x3ed92f[_0xd1c3('0x40')]=qs[_0xd1c3('0x37')](_[_0xd1c3('0x41')](_0x28310f[_0xd1c3('0x36')],_0x48aae1[_0xd1c3('0x37')]));if(_0x28310f['query'][_0xd1c3('0x42')]){_0x3ed92f[_0xd1c3('0x40')]=_[_0xd1c3('0x43')](_0x3ed92f[_0xd1c3('0x40')],{'$or':_[_0xd1c3('0x44')](_0x3ed92f[_0xd1c3('0x3a')],function(_0x253d09){var _0xd24091={};_0xd24091[_0x253d09]={'$like':'%'+_0x28310f[_0xd1c3('0x36')][_0xd1c3('0x42')]+'%'};return _0xd24091;})});}_0x3ed92f=_['merge']({},_0x3ed92f,_0x28310f['options']);return _0x1d794a[_0xd1c3('0x53')](_0x3ed92f);}})[_0xd1c3('0x1b')](function(_0x37564d){if(_0x37564d){_0xab964f=_0x37564d['length'];if(!_0x28310f[_0xd1c3('0x36')][_0xd1c3('0x3d')](_0xd1c3('0x55'))){_0x3ed92f[_0xd1c3('0x2c')]=qs[_0xd1c3('0x2c')](_0x28310f[_0xd1c3('0x36')][_0xd1c3('0x2c')]);_0x3ed92f[_0xd1c3('0x2b')]=qs['offset'](_0x28310f['query'][_0xd1c3('0x2b')]);}return _0x1d794a[_0xd1c3('0x53')](_0x3ed92f);}})[_0xd1c3('0x1b')](function(_0x25334b){if(_0x25334b){return _0x25334b?{'count':_0xab964f,'rows':_0x25334b}:null;}})[_0xd1c3('0x1b')](respondWithResult(_0x3ba3fd,null))['catch'](handleError(_0x3ba3fd,null));};exports[_0xd1c3('0x56')]=function(_0x5b4092,_0x3b42ae,_0x463b33){var _0x2c722e={};var _0x5378bc={};var _0x16b9fd;var _0xcc7d9f;return db[_0xd1c3('0x49')]['findOne']({'where':{'id':_0x5b4092[_0xd1c3('0x52')]['id']}})[_0xd1c3('0x1b')](handleEntityNotFound(_0x3b42ae,null))[_0xd1c3('0x1b')](function(_0x52b24b){if(_0x52b24b){_0x16b9fd=_0x52b24b;_0x5378bc[_0xd1c3('0x3c')]=_[_0xd1c3('0x35')](db[_0xd1c3('0x57')]['rawAttributes']);_0x5378bc['query']=_[_0xd1c3('0x35')](_0x5b4092['query']);_0x5378bc[_0xd1c3('0x37')]=_['intersection'](_0x5378bc[_0xd1c3('0x3c')],_0x5378bc[_0xd1c3('0x36')]);_0x2c722e[_0xd1c3('0x3a')]=_[_0xd1c3('0x38')](_0x5378bc[_0xd1c3('0x3c')],qs[_0xd1c3('0x39')](_0x5b4092[_0xd1c3('0x36')][_0xd1c3('0x39')]));_0x2c722e[_0xd1c3('0x3a')]=_0x2c722e[_0xd1c3('0x3a')]['length']?_0x2c722e['attributes']:_0x5378bc[_0xd1c3('0x3c')];_0x2c722e[_0xd1c3('0x3e')]=qs[_0xd1c3('0x3f')](_0x5b4092[_0xd1c3('0x36')]['sort']);_0x2c722e['where']=qs[_0xd1c3('0x37')](_['pick'](_0x5b4092[_0xd1c3('0x36')],_0x5378bc[_0xd1c3('0x37')]));if(_0x5b4092['query'][_0xd1c3('0x42')]){_0x2c722e[_0xd1c3('0x40')]=_[_0xd1c3('0x43')](_0x2c722e[_0xd1c3('0x40')],{'$or':_[_0xd1c3('0x44')](_0x2c722e[_0xd1c3('0x3a')],function(_0x1b5d4c){var _0x3b12d1={};_0x3b12d1[_0x1b5d4c]={'$like':'%'+_0x5b4092[_0xd1c3('0x36')]['filter']+'%'};return _0x3b12d1;})});}_0x2c722e=_['merge']({},_0x2c722e,_0x5b4092[_0xd1c3('0x48')]);return _0x16b9fd[_0xd1c3('0x56')](_0x2c722e);}})['then'](function(_0x38ea9d){if(_0x38ea9d){_0xcc7d9f=_0x38ea9d['length'];if(!_0x5b4092[_0xd1c3('0x36')][_0xd1c3('0x3d')](_0xd1c3('0x55'))){_0x2c722e[_0xd1c3('0x2c')]=qs['limit'](_0x5b4092[_0xd1c3('0x36')][_0xd1c3('0x2c')]);_0x2c722e['offset']=qs[_0xd1c3('0x2b')](_0x5b4092[_0xd1c3('0x36')]['offset']);}return _0x16b9fd[_0xd1c3('0x56')](_0x2c722e);}})[_0xd1c3('0x1b')](function(_0x2b2554){if(_0x2b2554){return _0x2b2554?{'count':_0xcc7d9f,'rows':_0x2b2554}:null;}})[_0xd1c3('0x1b')](respondWithResult(_0x3b42ae,null))[_0xd1c3('0x25')](handleError(_0x3b42ae,null));};exports[_0xd1c3('0x58')]=function(_0xb9c6d0,_0x4de52d,_0x19834d){var _0xdbc451={};var _0x34476a={};var _0x43ce73;var _0x322478;return db[_0xd1c3('0x49')]['findOne']({'where':{'id':_0xb9c6d0[_0xd1c3('0x52')]['id']}})['then'](handleEntityNotFound(_0x4de52d,null))[_0xd1c3('0x1b')](function(_0x5c3814){if(_0x5c3814){_0x43ce73=_0x5c3814;_0x34476a[_0xd1c3('0x3c')]=_[_0xd1c3('0x35')](db['Dynamics365Field'][_0xd1c3('0x34')]);_0x34476a[_0xd1c3('0x36')]=_[_0xd1c3('0x35')](_0xb9c6d0[_0xd1c3('0x36')]);_0x34476a[_0xd1c3('0x37')]=_[_0xd1c3('0x38')](_0x34476a[_0xd1c3('0x3c')],_0x34476a[_0xd1c3('0x36')]);_0xdbc451[_0xd1c3('0x3a')]=_[_0xd1c3('0x38')](_0x34476a['model'],qs['fields'](_0xb9c6d0[_0xd1c3('0x36')][_0xd1c3('0x39')]));_0xdbc451[_0xd1c3('0x3a')]=_0xdbc451[_0xd1c3('0x3a')]['length']?_0xdbc451[_0xd1c3('0x3a')]:_0x34476a[_0xd1c3('0x3c')];_0xdbc451['order']=qs[_0xd1c3('0x3f')](_0xb9c6d0[_0xd1c3('0x36')][_0xd1c3('0x3f')]);_0xdbc451[_0xd1c3('0x40')]=qs['filters'](_[_0xd1c3('0x41')](_0xb9c6d0[_0xd1c3('0x36')],_0x34476a[_0xd1c3('0x37')]));if(_0xb9c6d0[_0xd1c3('0x36')]['filter']){_0xdbc451[_0xd1c3('0x40')]=_[_0xd1c3('0x43')](_0xdbc451[_0xd1c3('0x40')],{'$or':_[_0xd1c3('0x44')](_0xdbc451[_0xd1c3('0x3a')],function(_0x4dbcf4){var _0x5a93ba={};_0x5a93ba[_0x4dbcf4]={'$like':'%'+_0xb9c6d0['query']['filter']+'%'};return _0x5a93ba;})});}_0xdbc451=_['merge']({},_0xdbc451,_0xb9c6d0[_0xd1c3('0x48')]);return _0x43ce73[_0xd1c3('0x58')](_0xdbc451);}})[_0xd1c3('0x1b')](function(_0x59e9cb){if(_0x59e9cb){_0x322478=_0x59e9cb[_0xd1c3('0x3b')];if(!_0xb9c6d0[_0xd1c3('0x36')][_0xd1c3('0x3d')](_0xd1c3('0x55'))){_0xdbc451[_0xd1c3('0x2c')]=qs[_0xd1c3('0x2c')](_0xb9c6d0[_0xd1c3('0x36')][_0xd1c3('0x2c')]);_0xdbc451[_0xd1c3('0x2b')]=qs[_0xd1c3('0x2b')](_0xb9c6d0[_0xd1c3('0x36')]['offset']);}return _0x43ce73[_0xd1c3('0x58')](_0xdbc451);}})[_0xd1c3('0x1b')](function(_0x144b87){if(_0x144b87){return _0x144b87?{'count':_0x322478,'rows':_0x144b87}:null;}})[_0xd1c3('0x1b')](respondWithResult(_0x4de52d,null))['catch'](handleError(_0x4de52d,null));}; \ No newline at end of file +var _0x84a0=['count','includeAll','include','findAll','rows','show','find','create','body','params','getFields','findOne','Dynamics365Field','map','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','field','options','Dynamics365Configuration'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x84a0,0x66));var _0x084a=function(_0x13e2b9,_0x1b04d6){_0x13e2b9=_0x13e2b9-0x0;var _0x400822=_0x84a0[_0x13e2b9];return _0x400822;};'use strict';var pdf=require(_0x084a('0x0'));var emlformat=require(_0x084a('0x1'));var rimraf=require(_0x084a('0x2'));var zipdir=require(_0x084a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x084a('0x4'));var moment=require(_0x084a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x084a('0x6'));var path=require(_0x084a('0x7'));var sox=require('sox');var csv=require(_0x084a('0x8'));var ejs=require(_0x084a('0x9'));var fs=require('fs');var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0x8'));var querystring=require(_0x084a('0xe'));var Papa=require(_0x084a('0xf'));var authService=require(_0x084a('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x084a('0x11'));var logger=require(_0x084a('0x12'))(_0x084a('0x13'));var utils=require(_0x084a('0x14'));var config=require(_0x084a('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x084a('0x16')][_0x084a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xec90a5,_0x9245b1,_0x1bdfb8,_0x414b05){return new BPromise(function(_0x3ff351,_0x3a76d1){var _0x5aef40=_0x414b05||client;return _0x5aef40[_0x084a('0x18')](_0xec90a5,_0x1bdfb8)['then'](function(_0x225de0){logger[_0x084a('0x19')](_0x084a('0x1a'),_0x9245b1,_0x084a('0x1b'));logger[_0x084a('0x1c')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x9245b1,_0x084a('0x1b'),JSON['stringify'](_0x225de0));if(_0x225de0[_0x084a('0x1d')]){if(_0x225de0[_0x084a('0x1d')]['code']===0x1f4){logger[_0x084a('0x1d')](_0x084a('0x1a'),_0x9245b1,_0x225de0[_0x084a('0x1d')][_0x084a('0x1e')]);return _0x3a76d1(_0x225de0[_0x084a('0x1d')][_0x084a('0x1e')]);}logger[_0x084a('0x1d')](_0x084a('0x1a'),_0x9245b1,_0x225de0[_0x084a('0x1d')][_0x084a('0x1e')]);return _0x3ff351(_0x225de0[_0x084a('0x1d')][_0x084a('0x1e')]);}else{logger[_0x084a('0x19')](_0x084a('0x1a'),_0x9245b1,_0x084a('0x1b'));_0x3ff351(_0x225de0['result'][_0x084a('0x1e')]);}})[_0x084a('0x1f')](function(_0x41a90f){logger[_0x084a('0x1d')](_0x084a('0x1a'),_0x9245b1,_0x41a90f);_0x3a76d1(_0x41a90f);});});}function respondWithStatusCode(_0x4865c8,_0x755c24){_0x755c24=_0x755c24||0xcc;return function(_0x288e9e){if(_0x288e9e){return _0x4865c8[_0x084a('0x20')](_0x755c24);}return _0x4865c8[_0x084a('0x21')](_0x755c24)[_0x084a('0x22')]();};}function respondWithResult(_0x3cdc1e,_0x5be167){_0x5be167=_0x5be167||0xc8;return function(_0x297e5b){if(_0x297e5b){return _0x3cdc1e[_0x084a('0x21')](_0x5be167)[_0x084a('0x23')](_0x297e5b);}};}function respondWithFilteredResult(_0x5b1474,_0x8806d5){return function(_0x3dd8b9){if(_0x3dd8b9){var _0xfc9b8c=_0x3dd8b9['count'],_0x4c5658=_0x8806d5[_0x084a('0x24')],_0x5596ac=_0x8806d5['offset']+_0x8806d5['limit'],_0x4874fe;if(_0x5596ac>=_0xfc9b8c){_0x5596ac=_0xfc9b8c;_0x4874fe=0xc8;}else{_0x4874fe=0xce;}_0x5b1474['status'](_0x4874fe);return _0x5b1474[_0x084a('0x25')](_0x084a('0x26'),_0x4c5658+'-'+_0x5596ac+'/'+_0xfc9b8c)[_0x084a('0x23')](_0x3dd8b9);}return null;};}function patchUpdates(_0x2c4149){return function(_0x3be7a6){try{jsonpatch[_0x084a('0x27')](_0x3be7a6,_0x2c4149,!![]);}catch(_0x378de6){return BPromise[_0x084a('0x28')](_0x378de6);}return _0x3be7a6['save']();};}function saveUpdates(_0x2ed3cd,_0x3b2b38){return function(_0x501a16){if(_0x501a16){return _0x501a16[_0x084a('0x29')](_0x2ed3cd)[_0x084a('0x2a')](function(_0x225000){return _0x225000;});}return null;};}function removeEntity(_0x19937c,_0x448ae9){return function(_0x202602){if(_0x202602){return _0x202602[_0x084a('0x2b')]()[_0x084a('0x2a')](function(){_0x19937c[_0x084a('0x21')](0xcc)[_0x084a('0x22')]();});}};}function handleEntityNotFound(_0x42af5f,_0x31bb9e){return function(_0x365f8c){if(!_0x365f8c){_0x42af5f['sendStatus'](0x194);}return _0x365f8c;};}function handleError(_0x54ff9b,_0x1ecc73){_0x1ecc73=_0x1ecc73||0x1f4;return function(_0x282fcc){logger[_0x084a('0x1d')](_0x282fcc[_0x084a('0x2c')]);if(_0x282fcc[_0x084a('0x2d')]){delete _0x282fcc['name'];}_0x54ff9b[_0x084a('0x21')](_0x1ecc73)[_0x084a('0x2e')](_0x282fcc);};}exports[_0x084a('0x2f')]=function(_0x53fc69,_0x109593){var _0x2fe5c5={},_0x2e1d11={},_0x4c4c90={'count':0x0,'rows':[]};var _0x5bd9ca=db['Dynamics365Configuration'][_0x084a('0x30')];_0x2e1d11[_0x084a('0x31')]=_[_0x084a('0x32')](_0x5bd9ca);_0x2e1d11['query']=_[_0x084a('0x32')](_0x53fc69[_0x084a('0x33')]);_0x2e1d11[_0x084a('0x34')]=_[_0x084a('0x35')](_0x2e1d11[_0x084a('0x31')],_0x2e1d11[_0x084a('0x33')]);_0x2fe5c5[_0x084a('0x36')]=_[_0x084a('0x35')](_0x2e1d11[_0x084a('0x31')],qs[_0x084a('0x37')](_0x53fc69[_0x084a('0x33')][_0x084a('0x37')]));_0x2fe5c5[_0x084a('0x36')]=_0x2fe5c5[_0x084a('0x36')][_0x084a('0x38')]?_0x2fe5c5['attributes']:_0x2e1d11[_0x084a('0x31')];if(!_0x53fc69[_0x084a('0x33')][_0x084a('0x39')](_0x084a('0x3a'))){_0x2fe5c5[_0x084a('0x3b')]=qs[_0x084a('0x3b')](_0x53fc69[_0x084a('0x33')][_0x084a('0x3b')]);_0x2fe5c5[_0x084a('0x24')]=qs['offset'](_0x53fc69[_0x084a('0x33')][_0x084a('0x24')]);}_0x2fe5c5[_0x084a('0x3c')]=qs[_0x084a('0x3d')](_0x53fc69[_0x084a('0x33')][_0x084a('0x3d')]);_0x2fe5c5['where']=qs[_0x084a('0x34')](_[_0x084a('0x3e')](_0x53fc69['query'],_0x2e1d11[_0x084a('0x34')]));if(_0x53fc69[_0x084a('0x33')][_0x084a('0x3f')]){_0x2fe5c5['where']=_[_0x084a('0x40')](_0x2fe5c5[_0x084a('0x41')],{'$or':_['map'](_0x5bd9ca,function(_0x3e2b92){if(_0x3e2b92[_0x084a('0x42')]['key']!=='VIRTUAL'){var _0x3288d4={};_0x3288d4[_0x3e2b92[_0x084a('0x43')]]={'$like':'%'+_0x53fc69[_0x084a('0x33')][_0x084a('0x3f')]+'%'};return _0x3288d4;}})});}_0x2fe5c5=_[_0x084a('0x40')]({},_0x2fe5c5,_0x53fc69[_0x084a('0x44')]);var _0x2be41a={'where':_0x2fe5c5[_0x084a('0x41')]};return db[_0x084a('0x45')][_0x084a('0x46')](_0x2be41a)[_0x084a('0x2a')](function(_0x593cc8){_0x4c4c90['count']=_0x593cc8;if(_0x53fc69[_0x084a('0x33')][_0x084a('0x47')]){_0x2fe5c5[_0x084a('0x48')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x084a('0x49')](_0x2fe5c5);})[_0x084a('0x2a')](function(_0x3092ea){_0x4c4c90[_0x084a('0x4a')]=_0x3092ea;return _0x4c4c90;})[_0x084a('0x2a')](respondWithFilteredResult(_0x109593,_0x2fe5c5))['catch'](handleError(_0x109593,null));};exports[_0x084a('0x4b')]=function(_0x51b29d,_0x259424){var _0x4f98c6={'raw':![],'where':{'id':_0x51b29d['params']['id']}},_0x1ffd20={};_0x1ffd20['model']=_[_0x084a('0x32')](db[_0x084a('0x45')]['rawAttributes']);_0x1ffd20[_0x084a('0x33')]=_[_0x084a('0x32')](_0x51b29d[_0x084a('0x33')]);_0x1ffd20[_0x084a('0x34')]=_['intersection'](_0x1ffd20[_0x084a('0x31')],_0x1ffd20[_0x084a('0x33')]);_0x4f98c6[_0x084a('0x36')]=_[_0x084a('0x35')](_0x1ffd20['model'],qs[_0x084a('0x37')](_0x51b29d[_0x084a('0x33')][_0x084a('0x37')]));_0x4f98c6[_0x084a('0x36')]=_0x4f98c6['attributes']['length']?_0x4f98c6[_0x084a('0x36')]:_0x1ffd20[_0x084a('0x31')];if(_0x51b29d[_0x084a('0x33')][_0x084a('0x47')]){_0x4f98c6[_0x084a('0x48')]=[{'all':!![]}];}_0x4f98c6=_[_0x084a('0x40')]({},_0x4f98c6,_0x51b29d[_0x084a('0x44')]);return db[_0x084a('0x45')][_0x084a('0x4c')](_0x4f98c6)[_0x084a('0x2a')](handleEntityNotFound(_0x259424,null))[_0x084a('0x2a')](respondWithResult(_0x259424,null))[_0x084a('0x1f')](handleError(_0x259424,null));};exports['create']=function(_0xcdd5b,_0x37fce4){return db[_0x084a('0x45')][_0x084a('0x4d')](_0xcdd5b[_0x084a('0x4e')],{})[_0x084a('0x2a')](respondWithResult(_0x37fce4,0xc9))[_0x084a('0x1f')](handleError(_0x37fce4,null));};exports['update']=function(_0x1a2a3c,_0x40dc39){if(_0x1a2a3c[_0x084a('0x4e')]['id']){delete _0x1a2a3c['body']['id'];}return db['Dynamics365Configuration'][_0x084a('0x4c')]({'where':{'id':_0x1a2a3c['params']['id']}})[_0x084a('0x2a')](handleEntityNotFound(_0x40dc39,null))[_0x084a('0x2a')](saveUpdates(_0x1a2a3c['body'],null))[_0x084a('0x2a')](respondWithResult(_0x40dc39,null))['catch'](handleError(_0x40dc39,null));};exports['destroy']=function(_0x420aba,_0x1a7260){return db[_0x084a('0x45')][_0x084a('0x4c')]({'where':{'id':_0x420aba[_0x084a('0x4f')]['id']}})[_0x084a('0x2a')](handleEntityNotFound(_0x1a7260,null))[_0x084a('0x2a')](removeEntity(_0x1a7260,null))['catch'](handleError(_0x1a7260,null));};exports[_0x084a('0x50')]=function(_0x4389b3,_0x3d7f0a,_0x4c651a){var _0x10e8ab={};var _0x339088={};var _0x12db87;var _0x9246dd;return db['Dynamics365Configuration'][_0x084a('0x51')]({'where':{'id':_0x4389b3['params']['id']}})[_0x084a('0x2a')](handleEntityNotFound(_0x3d7f0a,null))[_0x084a('0x2a')](function(_0x21a18a){if(_0x21a18a){_0x12db87=_0x21a18a;_0x339088['model']=_['keys'](db[_0x084a('0x52')][_0x084a('0x30')]);_0x339088['query']=_[_0x084a('0x32')](_0x4389b3['query']);_0x339088['filters']=_[_0x084a('0x35')](_0x339088[_0x084a('0x31')],_0x339088[_0x084a('0x33')]);_0x10e8ab[_0x084a('0x36')]=_[_0x084a('0x35')](_0x339088[_0x084a('0x31')],qs[_0x084a('0x37')](_0x4389b3[_0x084a('0x33')][_0x084a('0x37')]));_0x10e8ab['attributes']=_0x10e8ab[_0x084a('0x36')][_0x084a('0x38')]?_0x10e8ab[_0x084a('0x36')]:_0x339088['model'];_0x10e8ab[_0x084a('0x3c')]=qs[_0x084a('0x3d')](_0x4389b3['query'][_0x084a('0x3d')]);_0x10e8ab['where']=qs['filters'](_[_0x084a('0x3e')](_0x4389b3['query'],_0x339088['filters']));if(_0x4389b3[_0x084a('0x33')][_0x084a('0x3f')]){_0x10e8ab[_0x084a('0x41')]=_['merge'](_0x10e8ab[_0x084a('0x41')],{'$or':_[_0x084a('0x53')](_0x10e8ab[_0x084a('0x36')],function(_0x2cad52){var _0x45e2d3={};_0x45e2d3[_0x2cad52]={'$like':'%'+_0x4389b3[_0x084a('0x33')][_0x084a('0x3f')]+'%'};return _0x45e2d3;})});}_0x10e8ab=_['merge']({},_0x10e8ab,_0x4389b3['options']);return _0x12db87[_0x084a('0x50')](_0x10e8ab);}})[_0x084a('0x2a')](function(_0x5c77a3){if(_0x5c77a3){_0x9246dd=_0x5c77a3[_0x084a('0x38')];if(!_0x4389b3[_0x084a('0x33')][_0x084a('0x39')](_0x084a('0x3a'))){_0x10e8ab['limit']=qs[_0x084a('0x3b')](_0x4389b3[_0x084a('0x33')][_0x084a('0x3b')]);_0x10e8ab['offset']=qs['offset'](_0x4389b3[_0x084a('0x33')][_0x084a('0x24')]);}return _0x12db87[_0x084a('0x50')](_0x10e8ab);}})[_0x084a('0x2a')](function(_0x7adab6){if(_0x7adab6){return _0x7adab6?{'count':_0x9246dd,'rows':_0x7adab6}:null;}})[_0x084a('0x2a')](respondWithResult(_0x3d7f0a,null))[_0x084a('0x1f')](handleError(_0x3d7f0a,null));};exports['getSubjects']=function(_0x22efb6,_0x51a066,_0x4e713c){var _0x24a553={};var _0x3acf1b={};var _0x2c35ce;var _0x4a2745;return db[_0x084a('0x45')]['findOne']({'where':{'id':_0x22efb6[_0x084a('0x4f')]['id']}})[_0x084a('0x2a')](handleEntityNotFound(_0x51a066,null))[_0x084a('0x2a')](function(_0x12cef4){if(_0x12cef4){_0x2c35ce=_0x12cef4;_0x3acf1b[_0x084a('0x31')]=_[_0x084a('0x32')](db['Dynamics365Field']['rawAttributes']);_0x3acf1b[_0x084a('0x33')]=_[_0x084a('0x32')](_0x22efb6[_0x084a('0x33')]);_0x3acf1b[_0x084a('0x34')]=_[_0x084a('0x35')](_0x3acf1b[_0x084a('0x31')],_0x3acf1b['query']);_0x24a553[_0x084a('0x36')]=_[_0x084a('0x35')](_0x3acf1b[_0x084a('0x31')],qs[_0x084a('0x37')](_0x22efb6[_0x084a('0x33')][_0x084a('0x37')]));_0x24a553[_0x084a('0x36')]=_0x24a553['attributes'][_0x084a('0x38')]?_0x24a553[_0x084a('0x36')]:_0x3acf1b[_0x084a('0x31')];_0x24a553[_0x084a('0x3c')]=qs[_0x084a('0x3d')](_0x22efb6[_0x084a('0x33')][_0x084a('0x3d')]);_0x24a553[_0x084a('0x41')]=qs[_0x084a('0x34')](_[_0x084a('0x3e')](_0x22efb6['query'],_0x3acf1b['filters']));if(_0x22efb6['query'][_0x084a('0x3f')]){_0x24a553[_0x084a('0x41')]=_['merge'](_0x24a553[_0x084a('0x41')],{'$or':_[_0x084a('0x53')](_0x24a553[_0x084a('0x36')],function(_0x252021){var _0x57c249={};_0x57c249[_0x252021]={'$like':'%'+_0x22efb6['query'][_0x084a('0x3f')]+'%'};return _0x57c249;})});}_0x24a553=_[_0x084a('0x40')]({},_0x24a553,_0x22efb6[_0x084a('0x44')]);return _0x2c35ce[_0x084a('0x54')](_0x24a553);}})[_0x084a('0x2a')](function(_0x372563){if(_0x372563){_0x4a2745=_0x372563[_0x084a('0x38')];if(!_0x22efb6['query'][_0x084a('0x39')](_0x084a('0x3a'))){_0x24a553[_0x084a('0x3b')]=qs[_0x084a('0x3b')](_0x22efb6[_0x084a('0x33')][_0x084a('0x3b')]);_0x24a553[_0x084a('0x24')]=qs['offset'](_0x22efb6[_0x084a('0x33')][_0x084a('0x24')]);}return _0x2c35ce[_0x084a('0x54')](_0x24a553);}})[_0x084a('0x2a')](function(_0x417048){if(_0x417048){return _0x417048?{'count':_0x4a2745,'rows':_0x417048}:null;}})[_0x084a('0x2a')](respondWithResult(_0x51a066,null))[_0x084a('0x1f')](handleError(_0x51a066,null));};exports[_0x084a('0x55')]=function(_0x3da502,_0xd75c49,_0x219d38){var _0x57cc66={};var _0x2932b6={};var _0x29916a;var _0x4b8f1f;return db[_0x084a('0x45')]['findOne']({'where':{'id':_0x3da502['params']['id']}})[_0x084a('0x2a')](handleEntityNotFound(_0xd75c49,null))[_0x084a('0x2a')](function(_0x55297a){if(_0x55297a){_0x29916a=_0x55297a;_0x2932b6[_0x084a('0x31')]=_[_0x084a('0x32')](db[_0x084a('0x52')][_0x084a('0x30')]);_0x2932b6[_0x084a('0x33')]=_[_0x084a('0x32')](_0x3da502[_0x084a('0x33')]);_0x2932b6[_0x084a('0x34')]=_[_0x084a('0x35')](_0x2932b6[_0x084a('0x31')],_0x2932b6[_0x084a('0x33')]);_0x57cc66[_0x084a('0x36')]=_[_0x084a('0x35')](_0x2932b6[_0x084a('0x31')],qs[_0x084a('0x37')](_0x3da502['query'][_0x084a('0x37')]));_0x57cc66[_0x084a('0x36')]=_0x57cc66[_0x084a('0x36')][_0x084a('0x38')]?_0x57cc66[_0x084a('0x36')]:_0x2932b6[_0x084a('0x31')];_0x57cc66[_0x084a('0x3c')]=qs[_0x084a('0x3d')](_0x3da502['query']['sort']);_0x57cc66[_0x084a('0x41')]=qs[_0x084a('0x34')](_['pick'](_0x3da502['query'],_0x2932b6[_0x084a('0x34')]));if(_0x3da502['query'][_0x084a('0x3f')]){_0x57cc66['where']=_[_0x084a('0x40')](_0x57cc66[_0x084a('0x41')],{'$or':_[_0x084a('0x53')](_0x57cc66[_0x084a('0x36')],function(_0x5af718){var _0x5ebbe8={};_0x5ebbe8[_0x5af718]={'$like':'%'+_0x3da502['query'][_0x084a('0x3f')]+'%'};return _0x5ebbe8;})});}_0x57cc66=_[_0x084a('0x40')]({},_0x57cc66,_0x3da502[_0x084a('0x44')]);return _0x29916a['getDescriptions'](_0x57cc66);}})[_0x084a('0x2a')](function(_0x3aef7d){if(_0x3aef7d){_0x4b8f1f=_0x3aef7d['length'];if(!_0x3da502[_0x084a('0x33')][_0x084a('0x39')]('nolimit')){_0x57cc66[_0x084a('0x3b')]=qs[_0x084a('0x3b')](_0x3da502[_0x084a('0x33')]['limit']);_0x57cc66['offset']=qs[_0x084a('0x24')](_0x3da502['query'][_0x084a('0x24')]);}return _0x29916a[_0x084a('0x55')](_0x57cc66);}})[_0x084a('0x2a')](function(_0xd9b1d8){if(_0xd9b1d8){return _0xd9b1d8?{'count':_0x4b8f1f,'rows':_0xd9b1d8}:null;}})[_0x084a('0x2a')](respondWithResult(_0xd75c49,null))[_0x084a('0x1f')](handleError(_0xd75c49,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e6eda8d..9e78ae1 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 _0x30d1=['bluebird','request-promise','define','Dynamics365Configuration','lodash','../../config/logger','moment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x30d1,0x1ee));var _0x130d=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x30d1[_0x3c04ef];return _0x6a3a69;};'use strict';var _=require(_0x130d('0x0'));var util=require('util');var logger=require(_0x130d('0x1'))('api');var moment=require(_0x130d('0x2'));var BPromise=require(_0x130d('0x3'));var rp=require(_0x130d('0x4'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0xd277f2,_0x149f0f){return _0xd277f2[_0x130d('0x5')](_0x130d('0x6'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a55=['bluebird','request-promise','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment'];(function(_0x25e5b0,_0x473d2f){var _0x17c3f7=function(_0x13f2af){while(--_0x13f2af){_0x25e5b0['push'](_0x25e5b0['shift']());}};_0x17c3f7(++_0x473d2f);}(_0x3a55,0x102));var _0x53a5=function(_0x1f50d7,_0x3855b0){_0x1f50d7=_0x1f50d7-0x0;var _0x586344=_0x3a55[_0x1f50d7];return _0x586344;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x53a5('0x0'))(_0x53a5('0x1'));var moment=require(_0x53a5('0x2'));var BPromise=require(_0x53a5('0x3'));var rp=require(_0x53a5('0x4'));var attributes=require(_0x53a5('0x5'));module['exports']=function(_0x2af2f4,_0x5ddeaf){return _0x2af2f4[_0x53a5('0x6')](_0x53a5('0x7'),attributes,{'tableName':_0x53a5('0x8'),'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 c461ef5..a4c3670 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 _0xb0ba=['code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3b2b04,_0x1f5d09){var _0x264b66=function(_0x42d8bc){while(--_0x42d8bc){_0x3b2b04['push'](_0x3b2b04['shift']());}};_0x264b66(++_0x1f5d09);}(_0xb0ba,0x192));var _0xab0b=function(_0x318c33,_0x2749c2){_0x318c33=_0x318c33-0x0;var _0xbeee52=_0xb0ba[_0x318c33];return _0xbeee52;};'use strict';var _=require(_0xab0b('0x0'));var util=require(_0xab0b('0x1'));var moment=require(_0xab0b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab0b('0x3'));var db=require(_0xab0b('0x4'))['db'];var utils=require(_0xab0b('0x5'));var logger=require('../../config/logger')(_0xab0b('0x6'));var config=require(_0xab0b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xab0b('0x8')][_0xab0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54d624,_0x34635e,_0x4502bc){return new BPromise(function(_0x9d44cd,_0x1f75f9){return client['request'](_0x54d624,_0x4502bc)[_0xab0b('0xa')](function(_0x1e2282){logger[_0xab0b('0xb')](_0xab0b('0xc'),_0x34635e,_0xab0b('0xd'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x34635e,_0xab0b('0xd'),JSON[_0xab0b('0xe')](_0x1e2282));if(_0x1e2282[_0xab0b('0xf')]){if(_0x1e2282[_0xab0b('0xf')][_0xab0b('0x10')]===0x1f4){logger[_0xab0b('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x34635e,_0x1e2282[_0xab0b('0xf')][_0xab0b('0x11')]);return _0x1f75f9(_0x1e2282[_0xab0b('0xf')]['message']);}logger[_0xab0b('0xf')](_0xab0b('0xc'),_0x34635e,_0x1e2282[_0xab0b('0xf')][_0xab0b('0x11')]);return _0x9d44cd(_0x1e2282[_0xab0b('0xf')]['message']);}else{logger[_0xab0b('0xb')](_0xab0b('0xc'),_0x34635e,_0xab0b('0xd'));_0x9d44cd(_0x1e2282[_0xab0b('0x12')]['message']);}})['catch'](function(_0x412b14){logger[_0xab0b('0xf')](_0xab0b('0xc'),_0x34635e,_0x412b14);_0x1f75f9(_0x412b14);});});} \ No newline at end of file +var _0x6d0c=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x51f2cf,_0x3bbfbc){var _0x571db8=function(_0x1abba0){while(--_0x1abba0){_0x51f2cf['push'](_0x51f2cf['shift']());}};_0x571db8(++_0x3bbfbc);}(_0x6d0c,0x1c1));var _0xc6d0=function(_0x2cbbce,_0x45bf6f){_0x2cbbce=_0x2cbbce-0x0;var _0x4edb59=_0x6d0c[_0x2cbbce];return _0x4edb59;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc6d0('0x0'));var BPromise=require(_0xc6d0('0x1'));var rs=require(_0xc6d0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6d0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6d0('0x4'))(_0xc6d0('0x5'));var config=require(_0xc6d0('0x6'));var jayson=require(_0xc6d0('0x7'));var client=jayson[_0xc6d0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e7727,_0x32f033,_0x169e61){return new BPromise(function(_0x128173,_0x4dda3f){return client['request'](_0x4e7727,_0x169e61)[_0xc6d0('0x9')](function(_0x24fd24){logger[_0xc6d0('0xa')](_0xc6d0('0xb'),_0x32f033,_0xc6d0('0xc'));logger[_0xc6d0('0xd')](_0xc6d0('0xe'),_0x32f033,'request\x20sent',JSON[_0xc6d0('0xf')](_0x24fd24));if(_0x24fd24[_0xc6d0('0x10')]){if(_0x24fd24[_0xc6d0('0x10')][_0xc6d0('0x11')]===0x1f4){logger['error'](_0xc6d0('0xb'),_0x32f033,_0x24fd24[_0xc6d0('0x10')]['message']);return _0x4dda3f(_0x24fd24[_0xc6d0('0x10')]['message']);}logger[_0xc6d0('0x10')](_0xc6d0('0xb'),_0x32f033,_0x24fd24['error'][_0xc6d0('0x12')]);return _0x128173(_0x24fd24[_0xc6d0('0x10')]['message']);}else{logger[_0xc6d0('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x32f033,_0xc6d0('0xc'));_0x128173(_0x24fd24[_0xc6d0('0x13')][_0xc6d0('0x12')]);}})[_0xc6d0('0x14')](function(_0xc124b1){logger[_0xc6d0('0x10')](_0xc6d0('0xb'),_0x32f033,_0xc124b1);_0x4dda3f(_0xc124b1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 2dc0fcb..3202fa1 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 _0x322e=['./intDynamics365Field.controller','isAuthenticated','index','get','show','post','create','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf6821,_0x145833){var _0x925750=function(_0x4a0316){while(--_0x4a0316){_0xf6821['push'](_0xf6821['shift']());}};_0x925750(++_0x145833);}(_0x322e,0x1f0));var _0xe322=function(_0x51769e,_0x35322e){_0x51769e=_0x51769e-0x0;var _0x4f9748=_0x322e[_0x51769e];return _0x4f9748;};'use strict';var multer=require(_0xe322('0x0'));var util=require(_0xe322('0x1'));var path=require(_0xe322('0x2'));var timeout=require(_0xe322('0x3'));var express=require('express');var router=express[_0xe322('0x4')]();var auth=require(_0xe322('0x5'));var interaction=require(_0xe322('0x6'));var config=require(_0xe322('0x7'));var controller=require(_0xe322('0x8'));router['get']('/',auth[_0xe322('0x9')](),controller[_0xe322('0xa')]);router[_0xe322('0xb')]('/:id',auth[_0xe322('0x9')](),controller[_0xe322('0xc')]);router[_0xe322('0xd')]('/',auth[_0xe322('0x9')](),controller[_0xe322('0xe')]);router['put'](_0xe322('0xf'),auth[_0xe322('0x9')](),controller['update']);router['delete'](_0xe322('0xf'),auth[_0xe322('0x9')](),controller[_0xe322('0x10')]);module[_0xe322('0x11')]=router; \ No newline at end of file +var _0xa521=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','multer'];(function(_0xdcfe14,_0x1caac0){var _0x317232=function(_0xbd8d6b){while(--_0xbd8d6b){_0xdcfe14['push'](_0xdcfe14['shift']());}};_0x317232(++_0x1caac0);}(_0xa521,0x109));var _0x1a52=function(_0xe4c1e4,_0x2e28cf){_0xe4c1e4=_0xe4c1e4-0x0;var _0x616214=_0xa521[_0xe4c1e4];return _0x616214;};'use strict';var multer=require(_0x1a52('0x0'));var util=require(_0x1a52('0x1'));var path=require(_0x1a52('0x2'));var timeout=require(_0x1a52('0x3'));var express=require(_0x1a52('0x4'));var router=express[_0x1a52('0x5')]();var auth=require(_0x1a52('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1a52('0x7'));var controller=require(_0x1a52('0x8'));router[_0x1a52('0x9')]('/',auth[_0x1a52('0xa')](),controller[_0x1a52('0xb')]);router[_0x1a52('0x9')]('/:id',auth[_0x1a52('0xa')](),controller[_0x1a52('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1a52('0xd')]);router[_0x1a52('0xe')](_0x1a52('0xf'),auth[_0x1a52('0xa')](),controller[_0x1a52('0x10')]);router[_0x1a52('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1a52('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 1edc82a..1901749 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 _0xb43b=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','STRING'];(function(_0x4b6a01,_0x386039){var _0xc374a3=function(_0x49791b){while(--_0x49791b){_0x4b6a01['push'](_0x4b6a01['shift']());}};_0xc374a3(++_0x386039);}(_0xb43b,0x1b2));var _0xbb43=function(_0x6cb668,_0x162b92){_0x6cb668=_0x6cb668-0x0;var _0x51e85e=_0xb43b[_0x6cb668];return _0x51e85e;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbb43('0x2'),_0xbb43('0x3'),_0xbb43('0x4'),'keyValue'),'defaultValue':_0xbb43('0x2')},'content':{'type':Sequelize[_0xbb43('0x5')]},'key':{'type':Sequelize[_0xbb43('0x5')]},'keyType':{'type':Sequelize[_0xbb43('0x6')]('string','variable',_0xbb43('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbb43('0x5')]},'nameField':{'type':Sequelize[_0xbb43('0x5')]},'customField':{'type':Sequelize[_0xbb43('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb43('0x5')]}}; \ No newline at end of file +var _0xee5b=['keyValue','STRING','variable','sequelize','ENUM','string','customVariable'];(function(_0xd94f10,_0x3dadfd){var _0x263983=function(_0x2470a8){while(--_0x2470a8){_0xd94f10['push'](_0xd94f10['shift']());}};_0x263983(++_0x3dadfd);}(_0xee5b,0x1f4));var _0xbee5=function(_0x29f20b,_0x59b4d3){_0x29f20b=_0x29f20b-0x0;var _0x150d47=_0xee5b[_0x29f20b];return _0x150d47;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'type':{'type':Sequelize[_0xbee5('0x1')](_0xbee5('0x2'),'variable',_0xbee5('0x3'),_0xbee5('0x4')),'defaultValue':_0xbee5('0x2')},'content':{'type':Sequelize[_0xbee5('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xbee5('0x2'),_0xbee5('0x6'),_0xbee5('0x3'))},'keyContent':{'type':Sequelize[_0xbee5('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'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 3d28c56..12f8571 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 _0xe0d6=['pick','filter','map','type','key','VIRTUAL','field','merge','Dynamics365Field','include','findAll','rows','show','params','rawAttributes','includeAll','options','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2601de,_0x54a967){var _0x1dd819=function(_0x5a7bc4){while(--_0x5a7bc4){_0x2601de['push'](_0x2601de['shift']());}};_0x1dd819(++_0x54a967);}(_0xe0d6,0x13f));var _0x6e0d=function(_0x5167b1,_0x97bca3){_0x5167b1=_0x5167b1-0x0;var _0x9900dc=_0xe0d6[_0x5167b1];return _0x9900dc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6e0d('0x0'));var rimraf=require(_0x6e0d('0x1'));var zipdir=require(_0x6e0d('0x2'));var jsonpatch=require(_0x6e0d('0x3'));var rp=require(_0x6e0d('0x4'));var moment=require(_0x6e0d('0x5'));var BPromise=require(_0x6e0d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6e0d('0x7'));var sox=require(_0x6e0d('0x8'));var csv=require(_0x6e0d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6e0d('0xa'));var crypto=require(_0x6e0d('0xb'));var jsforce=require(_0x6e0d('0xc'));var deskjs=require(_0x6e0d('0xd'));var toCsv=require(_0x6e0d('0x9'));var querystring=require(_0x6e0d('0xe'));var Papa=require(_0x6e0d('0xf'));var authService=require(_0x6e0d('0x10'));var hardwareService=require(_0x6e0d('0x11'));var Redis=require(_0x6e0d('0x12'));var qs=require(_0x6e0d('0x13'));var logger=require('../../config/logger')(_0x6e0d('0x14'));var utils=require(_0x6e0d('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28bb68,_0x490be7){_0x490be7=_0x490be7||0xcc;return function(_0x441a74){if(_0x441a74){return _0x28bb68[_0x6e0d('0x16')](_0x490be7);}return _0x28bb68['status'](_0x490be7)['end']();};}function respondWithResult(_0x12f528,_0x121d40){_0x121d40=_0x121d40||0xc8;return function(_0x4f1c7c){if(_0x4f1c7c){return _0x12f528[_0x6e0d('0x17')](_0x121d40)[_0x6e0d('0x18')](_0x4f1c7c);}};}function respondWithFilteredResult(_0x45f453,_0xc5c63){return function(_0x1c6e08){if(_0x1c6e08){var _0x51630b=_0x1c6e08[_0x6e0d('0x19')],_0x192359=_0xc5c63['offset'],_0x44df2d=_0xc5c63[_0x6e0d('0x1a')]+_0xc5c63[_0x6e0d('0x1b')],_0x31dc79;if(_0x44df2d>=_0x51630b){_0x44df2d=_0x51630b;_0x31dc79=0xc8;}else{_0x31dc79=0xce;}_0x45f453['status'](_0x31dc79);return _0x45f453['set'](_0x6e0d('0x1c'),_0x192359+'-'+_0x44df2d+'/'+_0x51630b)[_0x6e0d('0x18')](_0x1c6e08);}return null;};}function patchUpdates(_0x24a416){return function(_0x23d38c){try{jsonpatch[_0x6e0d('0x1d')](_0x23d38c,_0x24a416,!![]);}catch(_0x45e58e){return BPromise[_0x6e0d('0x1e')](_0x45e58e);}return _0x23d38c[_0x6e0d('0x1f')]();};}function saveUpdates(_0xdc630b,_0xec26f0){return function(_0x4d36f5){if(_0x4d36f5){return _0x4d36f5['update'](_0xdc630b)[_0x6e0d('0x20')](function(_0x28857f){return _0x28857f;});}return null;};}function removeEntity(_0x1190a3,_0x4256fc){return function(_0x546f84){if(_0x546f84){return _0x546f84['destroy']()[_0x6e0d('0x20')](function(){_0x1190a3[_0x6e0d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ab23b,_0x5f0806){return function(_0x592c27){if(!_0x592c27){_0x3ab23b[_0x6e0d('0x16')](0x194);}return _0x592c27;};}function handleError(_0x41f127,_0x2e613b){_0x2e613b=_0x2e613b||0x1f4;return function(_0x3d3754){logger[_0x6e0d('0x21')](_0x3d3754[_0x6e0d('0x22')]);if(_0x3d3754[_0x6e0d('0x23')]){delete _0x3d3754['name'];}_0x41f127['status'](_0x2e613b)[_0x6e0d('0x24')](_0x3d3754);};}exports[_0x6e0d('0x25')]=function(_0x40a3ce,_0x57b677){var _0x2beb08={},_0x577c2e={},_0x7bd64e={'count':0x0,'rows':[]};var _0x2e03a1=db['Dynamics365Field']['rawAttributes'];_0x577c2e[_0x6e0d('0x26')]=_[_0x6e0d('0x27')](_0x2e03a1);_0x577c2e[_0x6e0d('0x28')]=_[_0x6e0d('0x27')](_0x40a3ce[_0x6e0d('0x28')]);_0x577c2e[_0x6e0d('0x29')]=_[_0x6e0d('0x2a')](_0x577c2e[_0x6e0d('0x26')],_0x577c2e[_0x6e0d('0x28')]);_0x2beb08[_0x6e0d('0x2b')]=_[_0x6e0d('0x2a')](_0x577c2e[_0x6e0d('0x26')],qs['fields'](_0x40a3ce[_0x6e0d('0x28')][_0x6e0d('0x2c')]));_0x2beb08[_0x6e0d('0x2b')]=_0x2beb08['attributes'][_0x6e0d('0x2d')]?_0x2beb08[_0x6e0d('0x2b')]:_0x577c2e[_0x6e0d('0x26')];if(!_0x40a3ce[_0x6e0d('0x28')][_0x6e0d('0x2e')](_0x6e0d('0x2f'))){_0x2beb08[_0x6e0d('0x1b')]=qs[_0x6e0d('0x1b')](_0x40a3ce['query'][_0x6e0d('0x1b')]);_0x2beb08[_0x6e0d('0x1a')]=qs[_0x6e0d('0x1a')](_0x40a3ce[_0x6e0d('0x28')][_0x6e0d('0x1a')]);}_0x2beb08[_0x6e0d('0x30')]=qs[_0x6e0d('0x31')](_0x40a3ce['query'][_0x6e0d('0x31')]);_0x2beb08[_0x6e0d('0x32')]=qs['filters'](_[_0x6e0d('0x33')](_0x40a3ce[_0x6e0d('0x28')],_0x577c2e[_0x6e0d('0x29')]));if(_0x40a3ce[_0x6e0d('0x28')][_0x6e0d('0x34')]){_0x2beb08['where']=_['merge'](_0x2beb08[_0x6e0d('0x32')],{'$or':_[_0x6e0d('0x35')](_0x2e03a1,function(_0x34cf50){if(_0x34cf50[_0x6e0d('0x36')][_0x6e0d('0x37')]!==_0x6e0d('0x38')){var _0x1be84e={};_0x1be84e[_0x34cf50[_0x6e0d('0x39')]]={'$like':'%'+_0x40a3ce[_0x6e0d('0x28')]['filter']+'%'};return _0x1be84e;}})});}_0x2beb08=_[_0x6e0d('0x3a')]({},_0x2beb08,_0x40a3ce['options']);var _0x3aa29d={'where':_0x2beb08['where']};return db[_0x6e0d('0x3b')]['count'](_0x3aa29d)[_0x6e0d('0x20')](function(_0x55d1e8){_0x7bd64e['count']=_0x55d1e8;if(_0x40a3ce['query']['includeAll']){_0x2beb08[_0x6e0d('0x3c')]=[{'all':!![]}];}return db[_0x6e0d('0x3b')][_0x6e0d('0x3d')](_0x2beb08);})[_0x6e0d('0x20')](function(_0x389c3e){_0x7bd64e[_0x6e0d('0x3e')]=_0x389c3e;return _0x7bd64e;})['then'](respondWithFilteredResult(_0x57b677,_0x2beb08))['catch'](handleError(_0x57b677,null));};exports[_0x6e0d('0x3f')]=function(_0x155ea4,_0x3e469c){var _0x56b74d={'raw':!![],'where':{'id':_0x155ea4[_0x6e0d('0x40')]['id']}},_0x2ebc57={};_0x2ebc57[_0x6e0d('0x26')]=_[_0x6e0d('0x27')](db[_0x6e0d('0x3b')][_0x6e0d('0x41')]);_0x2ebc57[_0x6e0d('0x28')]=_['keys'](_0x155ea4[_0x6e0d('0x28')]);_0x2ebc57['filters']=_[_0x6e0d('0x2a')](_0x2ebc57[_0x6e0d('0x26')],_0x2ebc57[_0x6e0d('0x28')]);_0x56b74d['attributes']=_[_0x6e0d('0x2a')](_0x2ebc57['model'],qs[_0x6e0d('0x2c')](_0x155ea4[_0x6e0d('0x28')][_0x6e0d('0x2c')]));_0x56b74d[_0x6e0d('0x2b')]=_0x56b74d[_0x6e0d('0x2b')]['length']?_0x56b74d[_0x6e0d('0x2b')]:_0x2ebc57[_0x6e0d('0x26')];if(_0x155ea4['query'][_0x6e0d('0x42')]){_0x56b74d['include']=[{'all':!![]}];}_0x56b74d=_[_0x6e0d('0x3a')]({},_0x56b74d,_0x155ea4[_0x6e0d('0x43')]);return db['Dynamics365Field'][_0x6e0d('0x44')](_0x56b74d)[_0x6e0d('0x20')](handleEntityNotFound(_0x3e469c,null))[_0x6e0d('0x20')](respondWithResult(_0x3e469c,null))[_0x6e0d('0x45')](handleError(_0x3e469c,null));};exports['create']=function(_0xaea4be,_0x3379c5){return db[_0x6e0d('0x3b')][_0x6e0d('0x46')](_0xaea4be[_0x6e0d('0x47')],{})[_0x6e0d('0x20')](respondWithResult(_0x3379c5,0xc9))[_0x6e0d('0x45')](handleError(_0x3379c5,null));};exports[_0x6e0d('0x48')]=function(_0x3f0f26,_0x251541){if(_0x3f0f26[_0x6e0d('0x47')]['id']){delete _0x3f0f26[_0x6e0d('0x47')]['id'];}return db[_0x6e0d('0x3b')]['find']({'where':{'id':_0x3f0f26[_0x6e0d('0x40')]['id']}})['then'](handleEntityNotFound(_0x251541,null))[_0x6e0d('0x20')](saveUpdates(_0x3f0f26[_0x6e0d('0x47')],null))['then'](respondWithResult(_0x251541,null))['catch'](handleError(_0x251541,null));};exports[_0x6e0d('0x49')]=function(_0x2c1f96,_0x2cc787){return db[_0x6e0d('0x3b')][_0x6e0d('0x44')]({'where':{'id':_0x2c1f96['params']['id']}})[_0x6e0d('0x20')](handleEntityNotFound(_0x2cc787,null))['then'](removeEntity(_0x2cc787,null))[_0x6e0d('0x45')](handleError(_0x2cc787,null));}; \ No newline at end of file +var _0x1d1e=['end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','Dynamics365Field','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','type','key','field','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x1d1e,0x1e5));var _0xe1d1=function(_0x1a5a53,_0x598a8c){_0x1a5a53=_0x1a5a53-0x0;var _0xf75355=_0x1d1e[_0x1a5a53];return _0xf75355;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe1d1('0x0'));var rimraf=require(_0xe1d1('0x1'));var zipdir=require(_0xe1d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1d1('0x3'));var moment=require(_0xe1d1('0x4'));var BPromise=require(_0xe1d1('0x5'));var Mustache=require(_0xe1d1('0x6'));var util=require(_0xe1d1('0x7'));var path=require(_0xe1d1('0x8'));var sox=require(_0xe1d1('0x9'));var csv=require(_0xe1d1('0xa'));var ejs=require(_0xe1d1('0xb'));var fs=require('fs');var _=require(_0xe1d1('0xc'));var squel=require(_0xe1d1('0xd'));var crypto=require(_0xe1d1('0xe'));var jsforce=require(_0xe1d1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe1d1('0xa'));var querystring=require('querystring');var Papa=require(_0xe1d1('0x10'));var authService=require(_0xe1d1('0x11'));var hardwareService=require(_0xe1d1('0x12'));var Redis=require(_0xe1d1('0x13'));var qs=require(_0xe1d1('0x14'));var logger=require('../../config/logger')(_0xe1d1('0x15'));var utils=require(_0xe1d1('0x16'));var config=require(_0xe1d1('0x17'));var db=require(_0xe1d1('0x18'))['db'];function respondWithStatusCode(_0x1a1114,_0x59d9e6){_0x59d9e6=_0x59d9e6||0xcc;return function(_0x35b5f9){if(_0x35b5f9){return _0x1a1114['sendStatus'](_0x59d9e6);}return _0x1a1114[_0xe1d1('0x19')](_0x59d9e6)[_0xe1d1('0x1a')]();};}function respondWithResult(_0x357902,_0x555127){_0x555127=_0x555127||0xc8;return function(_0x3073aa){if(_0x3073aa){return _0x357902[_0xe1d1('0x19')](_0x555127)[_0xe1d1('0x1b')](_0x3073aa);}};}function respondWithFilteredResult(_0x180e59,_0xfa35ab){return function(_0x14aada){if(_0x14aada){var _0x22dfab=_0x14aada['count'],_0xb6da15=_0xfa35ab[_0xe1d1('0x1c')],_0x57616d=_0xfa35ab['offset']+_0xfa35ab[_0xe1d1('0x1d')],_0xbc4f72;if(_0x57616d>=_0x22dfab){_0x57616d=_0x22dfab;_0xbc4f72=0xc8;}else{_0xbc4f72=0xce;}_0x180e59[_0xe1d1('0x19')](_0xbc4f72);return _0x180e59[_0xe1d1('0x1e')](_0xe1d1('0x1f'),_0xb6da15+'-'+_0x57616d+'/'+_0x22dfab)[_0xe1d1('0x1b')](_0x14aada);}return null;};}function patchUpdates(_0x5d5bef){return function(_0x53d17a){try{jsonpatch[_0xe1d1('0x20')](_0x53d17a,_0x5d5bef,!![]);}catch(_0x2e84c9){return BPromise[_0xe1d1('0x21')](_0x2e84c9);}return _0x53d17a['save']();};}function saveUpdates(_0x25731c,_0x1a6237){return function(_0x571a3b){if(_0x571a3b){return _0x571a3b[_0xe1d1('0x22')](_0x25731c)[_0xe1d1('0x23')](function(_0x1e8200){return _0x1e8200;});}return null;};}function removeEntity(_0x42df9b,_0x2c23cb){return function(_0x2352ce){if(_0x2352ce){return _0x2352ce[_0xe1d1('0x24')]()[_0xe1d1('0x23')](function(){_0x42df9b[_0xe1d1('0x19')](0xcc)[_0xe1d1('0x1a')]();});}};}function handleEntityNotFound(_0x579750,_0x4f627c){return function(_0x18e623){if(!_0x18e623){_0x579750[_0xe1d1('0x25')](0x194);}return _0x18e623;};}function handleError(_0x198619,_0x13960f){_0x13960f=_0x13960f||0x1f4;return function(_0x5b0edb){logger['error'](_0x5b0edb[_0xe1d1('0x26')]);if(_0x5b0edb[_0xe1d1('0x27')]){delete _0x5b0edb[_0xe1d1('0x27')];}_0x198619[_0xe1d1('0x19')](_0x13960f)[_0xe1d1('0x28')](_0x5b0edb);};}exports[_0xe1d1('0x29')]=function(_0xea3d38,_0xd4118c){var _0xbd603d={},_0x5a0b53={},_0x54b635={'count':0x0,'rows':[]};var _0x498a4d=db[_0xe1d1('0x2a')][_0xe1d1('0x2b')];_0x5a0b53[_0xe1d1('0x2c')]=_['keys'](_0x498a4d);_0x5a0b53[_0xe1d1('0x2d')]=_[_0xe1d1('0x2e')](_0xea3d38[_0xe1d1('0x2d')]);_0x5a0b53[_0xe1d1('0x2f')]=_[_0xe1d1('0x30')](_0x5a0b53[_0xe1d1('0x2c')],_0x5a0b53[_0xe1d1('0x2d')]);_0xbd603d[_0xe1d1('0x31')]=_[_0xe1d1('0x30')](_0x5a0b53[_0xe1d1('0x2c')],qs[_0xe1d1('0x32')](_0xea3d38['query']['fields']));_0xbd603d[_0xe1d1('0x31')]=_0xbd603d[_0xe1d1('0x31')]['length']?_0xbd603d[_0xe1d1('0x31')]:_0x5a0b53[_0xe1d1('0x2c')];if(!_0xea3d38[_0xe1d1('0x2d')][_0xe1d1('0x33')](_0xe1d1('0x34'))){_0xbd603d['limit']=qs['limit'](_0xea3d38[_0xe1d1('0x2d')][_0xe1d1('0x1d')]);_0xbd603d['offset']=qs[_0xe1d1('0x1c')](_0xea3d38[_0xe1d1('0x2d')]['offset']);}_0xbd603d[_0xe1d1('0x35')]=qs['sort'](_0xea3d38[_0xe1d1('0x2d')]['sort']);_0xbd603d['where']=qs[_0xe1d1('0x2f')](_[_0xe1d1('0x36')](_0xea3d38[_0xe1d1('0x2d')],_0x5a0b53[_0xe1d1('0x2f')]));if(_0xea3d38[_0xe1d1('0x2d')][_0xe1d1('0x37')]){_0xbd603d[_0xe1d1('0x38')]=_['merge'](_0xbd603d[_0xe1d1('0x38')],{'$or':_['map'](_0x498a4d,function(_0x568a48){if(_0x568a48[_0xe1d1('0x39')][_0xe1d1('0x3a')]!=='VIRTUAL'){var _0x69001c={};_0x69001c[_0x568a48[_0xe1d1('0x3b')]]={'$like':'%'+_0xea3d38['query'][_0xe1d1('0x37')]+'%'};return _0x69001c;}})});}_0xbd603d=_[_0xe1d1('0x3c')]({},_0xbd603d,_0xea3d38['options']);var _0x3d1077={'where':_0xbd603d[_0xe1d1('0x38')]};return db[_0xe1d1('0x2a')]['count'](_0x3d1077)[_0xe1d1('0x23')](function(_0x2ac3eb){_0x54b635['count']=_0x2ac3eb;if(_0xea3d38[_0xe1d1('0x2d')][_0xe1d1('0x3d')]){_0xbd603d[_0xe1d1('0x3e')]=[{'all':!![]}];}return db[_0xe1d1('0x2a')][_0xe1d1('0x3f')](_0xbd603d);})[_0xe1d1('0x23')](function(_0x2885b2){_0x54b635[_0xe1d1('0x40')]=_0x2885b2;return _0x54b635;})[_0xe1d1('0x23')](respondWithFilteredResult(_0xd4118c,_0xbd603d))[_0xe1d1('0x41')](handleError(_0xd4118c,null));};exports[_0xe1d1('0x42')]=function(_0xd78468,_0x74bf0d){var _0x1babaf={'raw':!![],'where':{'id':_0xd78468[_0xe1d1('0x43')]['id']}},_0x5d5947={};_0x5d5947[_0xe1d1('0x2c')]=_[_0xe1d1('0x2e')](db[_0xe1d1('0x2a')][_0xe1d1('0x2b')]);_0x5d5947[_0xe1d1('0x2d')]=_[_0xe1d1('0x2e')](_0xd78468[_0xe1d1('0x2d')]);_0x5d5947[_0xe1d1('0x2f')]=_[_0xe1d1('0x30')](_0x5d5947['model'],_0x5d5947[_0xe1d1('0x2d')]);_0x1babaf[_0xe1d1('0x31')]=_[_0xe1d1('0x30')](_0x5d5947[_0xe1d1('0x2c')],qs[_0xe1d1('0x32')](_0xd78468[_0xe1d1('0x2d')][_0xe1d1('0x32')]));_0x1babaf['attributes']=_0x1babaf[_0xe1d1('0x31')][_0xe1d1('0x44')]?_0x1babaf[_0xe1d1('0x31')]:_0x5d5947['model'];if(_0xd78468['query'][_0xe1d1('0x3d')]){_0x1babaf[_0xe1d1('0x3e')]=[{'all':!![]}];}_0x1babaf=_[_0xe1d1('0x3c')]({},_0x1babaf,_0xd78468[_0xe1d1('0x45')]);return db[_0xe1d1('0x2a')][_0xe1d1('0x46')](_0x1babaf)[_0xe1d1('0x23')](handleEntityNotFound(_0x74bf0d,null))['then'](respondWithResult(_0x74bf0d,null))['catch'](handleError(_0x74bf0d,null));};exports[_0xe1d1('0x47')]=function(_0x1f0d2b,_0x2993d2){return db['Dynamics365Field'][_0xe1d1('0x47')](_0x1f0d2b[_0xe1d1('0x48')],{})[_0xe1d1('0x23')](respondWithResult(_0x2993d2,0xc9))[_0xe1d1('0x41')](handleError(_0x2993d2,null));};exports[_0xe1d1('0x22')]=function(_0x595b82,_0x517eab){if(_0x595b82[_0xe1d1('0x48')]['id']){delete _0x595b82[_0xe1d1('0x48')]['id'];}return db[_0xe1d1('0x2a')]['find']({'where':{'id':_0x595b82[_0xe1d1('0x43')]['id']}})['then'](handleEntityNotFound(_0x517eab,null))[_0xe1d1('0x23')](saveUpdates(_0x595b82['body'],null))['then'](respondWithResult(_0x517eab,null))[_0xe1d1('0x41')](handleError(_0x517eab,null));};exports[_0xe1d1('0x24')]=function(_0x4cfc3c,_0x175f3b){return db[_0xe1d1('0x2a')][_0xe1d1('0x46')]({'where':{'id':_0x4cfc3c['params']['id']}})['then'](handleEntityNotFound(_0x175f3b,null))['then'](removeEntity(_0x175f3b,null))[_0xe1d1('0x41')](handleError(_0x175f3b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f433e87..8a524b2 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 _0x8c8f=['lodash','../../config/logger','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x398b37,_0x23f5cd){var _0x554a1a=function(_0x3e7678){while(--_0x3e7678){_0x398b37['push'](_0x398b37['shift']());}};_0x554a1a(++_0x23f5cd);}(_0x8c8f,0x1e6));var _0xf8c8=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x8c8f[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xf8c8('0x0'));var util=require('util');var logger=require(_0xf8c8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x22f13f,_0x5f1880){return _0x22f13f['define']('Dynamics365Field',attributes,{'tableName':_0xf8c8('0x2'),'paranoid':![],'indexes':[{'name':_0xf8c8('0x3'),'fields':[_0xf8c8('0x4'),_0xf8c8('0x5')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e52=['int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','./intDynamics365Field.attributes','define'];(function(_0x1ba0a3,_0x35822e){var _0x43b37b=function(_0x1bc6e2){while(--_0x1bc6e2){_0x1ba0a3['push'](_0x1ba0a3['shift']());}};_0x43b37b(++_0x35822e);}(_0x0e52,0x117));var _0x20e5=function(_0x29e076,_0x5b1cce){_0x29e076=_0x29e076-0x0;var _0x3569f0=_0x0e52[_0x29e076];return _0x3569f0;};'use strict';var _=require(_0x20e5('0x0'));var util=require(_0x20e5('0x1'));var logger=require(_0x20e5('0x2'))(_0x20e5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x20e5('0x4'));var attributes=require(_0x20e5('0x5'));module['exports']=function(_0x233436,_0x1ab6bc){return _0x233436[_0x20e5('0x6')]('Dynamics365Field',attributes,{'tableName':_0x20e5('0x7'),'paranoid':![],'indexes':[{'name':_0x20e5('0x8'),'fields':[_0x20e5('0x9'),_0x20e5('0xa')],'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 de52f35..80cb243 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 _0x5ea2=['client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xc28702,_0x145b87){var _0x3b6e9e=function(_0xfac0c1){while(--_0xfac0c1){_0xc28702['push'](_0xc28702['shift']());}};_0x3b6e9e(++_0x145b87);}(_0x5ea2,0x99));var _0x25ea=function(_0x11e37e,_0xd10aa7){_0x11e37e=_0x11e37e-0x0;var _0x5681cf=_0x5ea2[_0x11e37e];return _0x5681cf;};'use strict';var _=require(_0x25ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x25ea('0x1'));var rs=require(_0x25ea('0x2'));var fs=require('fs');var Redis=require(_0x25ea('0x3'));var db=require(_0x25ea('0x4'))['db'];var utils=require(_0x25ea('0x5'));var logger=require('../../config/logger')(_0x25ea('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25ea('0x7')][_0x25ea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ca48f,_0x214ed8,_0x274f48){return new BPromise(function(_0x254d54,_0x1c5b5d){return client[_0x25ea('0x9')](_0x3ca48f,_0x274f48)[_0x25ea('0xa')](function(_0x52b281){logger[_0x25ea('0xb')](_0x25ea('0xc'),_0x214ed8,_0x25ea('0xd'));logger[_0x25ea('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x214ed8,_0x25ea('0xd'),JSON[_0x25ea('0xf')](_0x52b281));if(_0x52b281[_0x25ea('0x10')]){if(_0x52b281[_0x25ea('0x10')][_0x25ea('0x11')]===0x1f4){logger[_0x25ea('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x214ed8,_0x52b281['error'][_0x25ea('0x12')]);return _0x1c5b5d(_0x52b281[_0x25ea('0x10')]['message']);}logger[_0x25ea('0x10')](_0x25ea('0xc'),_0x214ed8,_0x52b281[_0x25ea('0x10')][_0x25ea('0x12')]);return _0x254d54(_0x52b281[_0x25ea('0x10')][_0x25ea('0x12')]);}else{logger['info'](_0x25ea('0xc'),_0x214ed8,_0x25ea('0xd'));_0x254d54(_0x52b281['result'][_0x25ea('0x12')]);}})[_0x25ea('0x13')](function(_0x111c5b){logger[_0x25ea('0x10')](_0x25ea('0xc'),_0x214ed8,_0x111c5b);_0x1c5b5d(_0x111c5b);});});} \ No newline at end of file +var _0xf496=['rpc','../../config/environment','jayson/promise','client','request','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Dynamics365Field,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x44799d,_0x26c23a){var _0x4f4a20=function(_0x298a71){while(--_0x298a71){_0x44799d['push'](_0x44799d['shift']());}};_0x4f4a20(++_0x26c23a);}(_0xf496,0x1c7));var _0x6f49=function(_0x4a53bd,_0x4186ac){_0x4a53bd=_0x4a53bd-0x0;var _0x1bfbd8=_0xf496[_0x4a53bd];return _0x1bfbd8;};'use strict';var _=require(_0x6f49('0x0'));var util=require(_0x6f49('0x1'));var moment=require(_0x6f49('0x2'));var BPromise=require(_0x6f49('0x3'));var rs=require(_0x6f49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f49('0x5'))['db'];var utils=require(_0x6f49('0x6'));var logger=require('../../config/logger')(_0x6f49('0x7'));var config=require(_0x6f49('0x8'));var jayson=require(_0x6f49('0x9'));var client=jayson[_0x6f49('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1185c8,_0x23d8d7,_0x426d37){return new BPromise(function(_0x4792ec,_0x587bb5){return client[_0x6f49('0xb')](_0x1185c8,_0x426d37)['then'](function(_0x41fe1e){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x23d8d7,'request\x20sent');logger['debug'](_0x6f49('0xc'),_0x23d8d7,_0x6f49('0xd'),JSON['stringify'](_0x41fe1e));if(_0x41fe1e[_0x6f49('0xe')]){if(_0x41fe1e[_0x6f49('0xe')][_0x6f49('0xf')]===0x1f4){logger[_0x6f49('0xe')](_0x6f49('0x10'),_0x23d8d7,_0x41fe1e[_0x6f49('0xe')][_0x6f49('0x11')]);return _0x587bb5(_0x41fe1e[_0x6f49('0xe')][_0x6f49('0x11')]);}logger['error'](_0x6f49('0x10'),_0x23d8d7,_0x41fe1e[_0x6f49('0xe')][_0x6f49('0x11')]);return _0x4792ec(_0x41fe1e['error'][_0x6f49('0x11')]);}else{logger[_0x6f49('0x12')](_0x6f49('0x10'),_0x23d8d7,_0x6f49('0xd'));_0x4792ec(_0x41fe1e[_0x6f49('0x13')][_0x6f49('0x11')]);}})[_0x6f49('0x14')](function(_0x515dc6){logger[_0x6f49('0xe')](_0x6f49('0x10'),_0x23d8d7,_0x515dc6);_0x587bb5(_0x515dc6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 0d38ff4..68b4181 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 _0x545c=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x545c,0x1d9));var _0xc545=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x545c[_0x178856];return _0x3c7fe7;};'use strict';var multer=require(_0xc545('0x0'));var util=require(_0xc545('0x1'));var path=require(_0xc545('0x2'));var timeout=require(_0xc545('0x3'));var express=require(_0xc545('0x4'));var router=express[_0xc545('0x5')]();var auth=require(_0xc545('0x6'));var interaction=require(_0xc545('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xc545('0x8')]('/',auth[_0xc545('0x9')](),controller[_0xc545('0xa')]);router['get'](_0xc545('0xb'),auth[_0xc545('0x9')](),controller['show']);router[_0xc545('0x8')](_0xc545('0xc'),auth[_0xc545('0x9')](),controller[_0xc545('0xd')]);router[_0xc545('0x8')](_0xc545('0xe'),auth['isAuthenticated'](),controller[_0xc545('0xf')]);router[_0xc545('0x10')]('/',auth[_0xc545('0x9')](),controller['create']);router['post'](_0xc545('0xc'),auth[_0xc545('0x9')](),controller[_0xc545('0x11')]);router['put'](_0xc545('0xb'),auth[_0xc545('0x9')](),controller[_0xc545('0x12')]);router[_0xc545('0x13')](_0xc545('0xb'),auth[_0xc545('0x9')](),controller[_0xc545('0x14')]);module[_0xc545('0x15')]=router; \ No newline at end of file +var _0x9f38=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','util','path','connect-timeout'];(function(_0x559eb8,_0x3e338b){var _0x4c2f59=function(_0x6a3ff5){while(--_0x6a3ff5){_0x559eb8['push'](_0x559eb8['shift']());}};_0x4c2f59(++_0x3e338b);}(_0x9f38,0xd9));var _0x89f3=function(_0x3fa2b2,_0x313fe2){_0x3fa2b2=_0x3fa2b2-0x0;var _0x40c516=_0x9f38[_0x3fa2b2];return _0x40c516;};'use strict';var multer=require('multer');var util=require(_0x89f3('0x0'));var path=require(_0x89f3('0x1'));var timeout=require(_0x89f3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x89f3('0x3'));var interaction=require(_0x89f3('0x4'));var config=require(_0x89f3('0x5'));var controller=require(_0x89f3('0x6'));router[_0x89f3('0x7')]('/',auth[_0x89f3('0x8')](),controller[_0x89f3('0x9')]);router[_0x89f3('0x7')](_0x89f3('0xa'),auth[_0x89f3('0x8')](),controller[_0x89f3('0xb')]);router['get'](_0x89f3('0xc'),auth['isAuthenticated'](),controller[_0x89f3('0xd')]);router[_0x89f3('0x7')](_0x89f3('0xe'),auth[_0x89f3('0x8')](),controller[_0x89f3('0xf')]);router[_0x89f3('0x10')]('/',auth[_0x89f3('0x8')](),controller[_0x89f3('0x11')]);router[_0x89f3('0x10')](_0x89f3('0xc'),auth[_0x89f3('0x8')](),controller[_0x89f3('0x12')]);router['put']('/:id',auth[_0x89f3('0x8')](),controller[_0x89f3('0x13')]);router[_0x89f3('0x14')]('/:id',auth[_0x89f3('0x8')](),controller['destroy']);module[_0x89f3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 1986a30..2b10a1c 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 _0xf588=['STRING','username','remoteUri'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xf588,0x1ad));var _0x8f58=function(_0x4a7622,_0x1e35c9){_0x4a7622=_0x4a7622-0x0;var _0x9bd1b1=_0xf588[_0x4a7622];return _0x9bd1b1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8f58('0x0')]},'description':{'type':Sequelize[_0x8f58('0x0')]},'username':{'type':Sequelize[_0x8f58('0x0')],'unique':_0x8f58('0x1')},'apiKey':{'type':Sequelize[_0x8f58('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8f58('0x2')},'serverUrl':{'type':Sequelize[_0x8f58('0x0')]}}; \ No newline at end of file +var _0xe3cd=['sequelize','STRING','username'];(function(_0x2b420b,_0x23f0c8){var _0x4727c8=function(_0x2e9907){while(--_0x2e9907){_0x2b420b['push'](_0x2b420b['shift']());}};_0x4727c8(++_0x23f0c8);}(_0xe3cd,0x16b));var _0xde3c=function(_0x52e715,_0x146427){_0x52e715=_0x52e715-0x0;var _0x29a465=_0xe3cd[_0x52e715];return _0x29a465;};'use strict';var Sequelize=require(_0xde3c('0x0'));module['exports']={'name':{'type':Sequelize[_0xde3c('0x1')]},'description':{'type':Sequelize[_0xde3c('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xde3c('0x2')},'apiKey':{'type':Sequelize[_0xde3c('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xde3c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index e81a9d1..5739a33 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 _0xeaab=['sendStatus','status','end','json','offset','limit','set','apply','save','update','destroy','stack','name','send','index','FreshdeskAccount','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','findAll','rows','show','rawAttributes','include','find','catch','create','body','params','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','remoteUri','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','agent','priority','group','ticket_type','company','remove','includes','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xeaab,0xd9));var _0xbeaa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeaab[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0xbeaa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbeaa('0x1'));var zipdir=require(_0xbeaa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbeaa('0x3'));var BPromise=require(_0xbeaa('0x4'));var Mustache=require(_0xbeaa('0x5'));var util=require(_0xbeaa('0x6'));var path=require(_0xbeaa('0x7'));var sox=require(_0xbeaa('0x8'));var csv=require(_0xbeaa('0x9'));var ejs=require(_0xbeaa('0xa'));var fs=require('fs');var _=require(_0xbeaa('0xb'));var squel=require(_0xbeaa('0xc'));var crypto=require(_0xbeaa('0xd'));var jsforce=require(_0xbeaa('0xe'));var deskjs=require(_0xbeaa('0xf'));var toCsv=require(_0xbeaa('0x9'));var querystring=require('querystring');var Papa=require(_0xbeaa('0x10'));var authService=require(_0xbeaa('0x11'));var hardwareService=require(_0xbeaa('0x12'));var Redis=require(_0xbeaa('0x13'));var qs=require(_0xbeaa('0x14'));var logger=require(_0xbeaa('0x15'))(_0xbeaa('0x16'));var utils=require('../../config/utils');var config=require(_0xbeaa('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbeaa('0x18'));var jayson=require(_0xbeaa('0x19'));var client=jayson['client'][_0xbeaa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5931b0,_0x16f7aa,_0x17d717,_0x5457e5){return new BPromise(function(_0x3f2f3d,_0x1249fe){var _0x3db288=_0x5457e5||client;return _0x3db288[_0xbeaa('0x1b')](_0x5931b0,_0x17d717)[_0xbeaa('0x1c')](function(_0x41cbd0){logger[_0xbeaa('0x1d')](_0xbeaa('0x1e'),_0x16f7aa,_0xbeaa('0x1f'));logger[_0xbeaa('0x20')](_0xbeaa('0x21'),_0x16f7aa,_0xbeaa('0x1f'),JSON[_0xbeaa('0x22')](_0x41cbd0));if(_0x41cbd0[_0xbeaa('0x23')]){if(_0x41cbd0[_0xbeaa('0x23')][_0xbeaa('0x24')]===0x1f4){logger[_0xbeaa('0x23')](_0xbeaa('0x1e'),_0x16f7aa,_0x41cbd0[_0xbeaa('0x23')][_0xbeaa('0x25')]);return _0x1249fe(_0x41cbd0[_0xbeaa('0x23')]['message']);}logger[_0xbeaa('0x23')](_0xbeaa('0x1e'),_0x16f7aa,_0x41cbd0[_0xbeaa('0x23')]['message']);return _0x3f2f3d(_0x41cbd0[_0xbeaa('0x23')][_0xbeaa('0x25')]);}else{logger[_0xbeaa('0x1d')](_0xbeaa('0x1e'),_0x16f7aa,_0xbeaa('0x1f'));_0x3f2f3d(_0x41cbd0[_0xbeaa('0x26')][_0xbeaa('0x25')]);}})['catch'](function(_0x1bfb47){logger[_0xbeaa('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x16f7aa,_0x1bfb47);_0x1249fe(_0x1bfb47);});});}function respondWithStatusCode(_0x5f1ac0,_0x59eaeb){_0x59eaeb=_0x59eaeb||0xcc;return function(_0x477bf6){if(_0x477bf6){return _0x5f1ac0[_0xbeaa('0x27')](_0x59eaeb);}return _0x5f1ac0[_0xbeaa('0x28')](_0x59eaeb)[_0xbeaa('0x29')]();};}function respondWithResult(_0x5345b9,_0x5a2540){_0x5a2540=_0x5a2540||0xc8;return function(_0x53b066){if(_0x53b066){return _0x5345b9[_0xbeaa('0x28')](_0x5a2540)[_0xbeaa('0x2a')](_0x53b066);}};}function respondWithFilteredResult(_0x63d68b,_0xa9a88e){return function(_0x41661b){if(_0x41661b){var _0x4d0df4=_0x41661b['count'],_0x119e0d=_0xa9a88e[_0xbeaa('0x2b')],_0x3a4386=_0xa9a88e[_0xbeaa('0x2b')]+_0xa9a88e[_0xbeaa('0x2c')],_0x2ee10e;if(_0x3a4386>=_0x4d0df4){_0x3a4386=_0x4d0df4;_0x2ee10e=0xc8;}else{_0x2ee10e=0xce;}_0x63d68b['status'](_0x2ee10e);return _0x63d68b[_0xbeaa('0x2d')]('Content-Range',_0x119e0d+'-'+_0x3a4386+'/'+_0x4d0df4)[_0xbeaa('0x2a')](_0x41661b);}return null;};}function patchUpdates(_0x28221c){return function(_0x13ed94){try{jsonpatch[_0xbeaa('0x2e')](_0x13ed94,_0x28221c,!![]);}catch(_0xc85fd0){return BPromise['reject'](_0xc85fd0);}return _0x13ed94[_0xbeaa('0x2f')]();};}function saveUpdates(_0x1126b3,_0x52be24){return function(_0x31afc9){if(_0x31afc9){return _0x31afc9[_0xbeaa('0x30')](_0x1126b3)['then'](function(_0x33e1d4){return _0x33e1d4;});}return null;};}function removeEntity(_0x5af042,_0x521a23){return function(_0x5ee452){if(_0x5ee452){return _0x5ee452[_0xbeaa('0x31')]()[_0xbeaa('0x1c')](function(){_0x5af042[_0xbeaa('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fad7f,_0xc76552){return function(_0x453632){if(!_0x453632){_0x1fad7f[_0xbeaa('0x27')](0x194);}return _0x453632;};}function handleError(_0x5d064e,_0x208a38){_0x208a38=_0x208a38||0x1f4;return function(_0x40b2eb){logger[_0xbeaa('0x23')](_0x40b2eb[_0xbeaa('0x32')]);if(_0x40b2eb[_0xbeaa('0x33')]){delete _0x40b2eb[_0xbeaa('0x33')];}_0x5d064e[_0xbeaa('0x28')](_0x208a38)[_0xbeaa('0x34')](_0x40b2eb);};}exports[_0xbeaa('0x35')]=function(_0x5e9474,_0x9c97e8){var _0x197d0d={},_0x5c7734={},_0x586bf4={'count':0x0,'rows':[]};var _0x460a83=db[_0xbeaa('0x36')]['rawAttributes'];_0x5c7734[_0xbeaa('0x37')]=_[_0xbeaa('0x38')](_0x460a83);_0x5c7734[_0xbeaa('0x39')]=_['keys'](_0x5e9474[_0xbeaa('0x39')]);_0x5c7734[_0xbeaa('0x3a')]=_[_0xbeaa('0x3b')](_0x5c7734[_0xbeaa('0x37')],_0x5c7734['query']);_0x197d0d['attributes']=_['intersection'](_0x5c7734['model'],qs[_0xbeaa('0x3c')](_0x5e9474[_0xbeaa('0x39')][_0xbeaa('0x3c')]));_0x197d0d[_0xbeaa('0x3d')]=_0x197d0d['attributes'][_0xbeaa('0x3e')]?_0x197d0d[_0xbeaa('0x3d')]:_0x5c7734['model'];if(!_0x5e9474[_0xbeaa('0x39')]['hasOwnProperty'](_0xbeaa('0x3f'))){_0x197d0d[_0xbeaa('0x2c')]=qs[_0xbeaa('0x2c')](_0x5e9474[_0xbeaa('0x39')][_0xbeaa('0x2c')]);_0x197d0d[_0xbeaa('0x2b')]=qs['offset'](_0x5e9474[_0xbeaa('0x39')][_0xbeaa('0x2b')]);}_0x197d0d[_0xbeaa('0x40')]=qs[_0xbeaa('0x41')](_0x5e9474[_0xbeaa('0x39')]['sort']);_0x197d0d[_0xbeaa('0x42')]=qs[_0xbeaa('0x3a')](_[_0xbeaa('0x43')](_0x5e9474['query'],_0x5c7734['filters']));if(_0x5e9474[_0xbeaa('0x39')][_0xbeaa('0x44')]){_0x197d0d[_0xbeaa('0x42')]=_[_0xbeaa('0x45')](_0x197d0d[_0xbeaa('0x42')],{'$or':_[_0xbeaa('0x46')](_0x460a83,function(_0x532491){if(_0x532491[_0xbeaa('0x47')][_0xbeaa('0x48')]!==_0xbeaa('0x49')){var _0x5493fe={};_0x5493fe[_0x532491[_0xbeaa('0x4a')]]={'$like':'%'+_0x5e9474[_0xbeaa('0x39')][_0xbeaa('0x44')]+'%'};return _0x5493fe;}})});}_0x197d0d=_['merge']({},_0x197d0d,_0x5e9474[_0xbeaa('0x4b')]);var _0x49c6b8={'where':_0x197d0d[_0xbeaa('0x42')]};return db[_0xbeaa('0x36')][_0xbeaa('0x4c')](_0x49c6b8)[_0xbeaa('0x1c')](function(_0x20c840){_0x586bf4[_0xbeaa('0x4c')]=_0x20c840;if(_0x5e9474['query'][_0xbeaa('0x4d')]){_0x197d0d['include']=[{'all':!![]}];}return db[_0xbeaa('0x36')][_0xbeaa('0x4e')](_0x197d0d);})[_0xbeaa('0x1c')](function(_0x5000b1){_0x586bf4[_0xbeaa('0x4f')]=_0x5000b1;return _0x586bf4;})[_0xbeaa('0x1c')](respondWithFilteredResult(_0x9c97e8,_0x197d0d))['catch'](handleError(_0x9c97e8,null));};exports[_0xbeaa('0x50')]=function(_0x101e4a,_0x47a81a){var _0x68da63={'raw':![],'where':{'id':_0x101e4a['params']['id']}},_0x36bfc3={};_0x36bfc3['model']=_['keys'](db[_0xbeaa('0x36')][_0xbeaa('0x51')]);_0x36bfc3[_0xbeaa('0x39')]=_[_0xbeaa('0x38')](_0x101e4a[_0xbeaa('0x39')]);_0x36bfc3[_0xbeaa('0x3a')]=_[_0xbeaa('0x3b')](_0x36bfc3[_0xbeaa('0x37')],_0x36bfc3[_0xbeaa('0x39')]);_0x68da63[_0xbeaa('0x3d')]=_[_0xbeaa('0x3b')](_0x36bfc3[_0xbeaa('0x37')],qs[_0xbeaa('0x3c')](_0x101e4a[_0xbeaa('0x39')][_0xbeaa('0x3c')]));_0x68da63['attributes']=_0x68da63[_0xbeaa('0x3d')]['length']?_0x68da63[_0xbeaa('0x3d')]:_0x36bfc3['model'];if(_0x101e4a['query'][_0xbeaa('0x4d')]){_0x68da63[_0xbeaa('0x52')]=[{'all':!![]}];}_0x68da63=_[_0xbeaa('0x45')]({},_0x68da63,_0x101e4a[_0xbeaa('0x4b')]);return db['FreshdeskAccount'][_0xbeaa('0x53')](_0x68da63)[_0xbeaa('0x1c')](handleEntityNotFound(_0x47a81a,null))[_0xbeaa('0x1c')](respondWithResult(_0x47a81a,null))[_0xbeaa('0x54')](handleError(_0x47a81a,null));};exports['create']=function(_0x2a2b48,_0x48b4af){return db[_0xbeaa('0x36')][_0xbeaa('0x55')](_0x2a2b48[_0xbeaa('0x56')],{})[_0xbeaa('0x1c')](respondWithResult(_0x48b4af,0xc9))['catch'](handleError(_0x48b4af,null));};exports['update']=function(_0x5d69d8,_0x4af575){if(_0x5d69d8[_0xbeaa('0x56')]['id']){delete _0x5d69d8[_0xbeaa('0x56')]['id'];}return db[_0xbeaa('0x36')][_0xbeaa('0x53')]({'where':{'id':_0x5d69d8[_0xbeaa('0x57')]['id']}})[_0xbeaa('0x1c')](handleEntityNotFound(_0x4af575,null))[_0xbeaa('0x1c')](saveUpdates(_0x5d69d8[_0xbeaa('0x56')],null))[_0xbeaa('0x1c')](respondWithResult(_0x4af575,null))[_0xbeaa('0x54')](handleError(_0x4af575,null));};exports[_0xbeaa('0x31')]=function(_0x40a1a2,_0x4187b5){return db[_0xbeaa('0x36')][_0xbeaa('0x53')]({'where':{'id':_0x40a1a2['params']['id']}})['then'](handleEntityNotFound(_0x4187b5,null))['then'](removeEntity(_0x4187b5,null))[_0xbeaa('0x54')](handleError(_0x4187b5,null));};exports[_0xbeaa('0x58')]=function(_0x5f0582,_0x96862e,_0x56eb56){var _0x37b4b7={};var _0x3fe4ba={};var _0x97b35;var _0x590e6c;return db['FreshdeskAccount'][_0xbeaa('0x59')]({'where':{'id':_0x5f0582[_0xbeaa('0x57')]['id']}})[_0xbeaa('0x1c')](handleEntityNotFound(_0x96862e,null))[_0xbeaa('0x1c')](function(_0x5ac702){if(_0x5ac702){_0x97b35=_0x5ac702;_0x3fe4ba[_0xbeaa('0x37')]=_[_0xbeaa('0x38')](db['FreshdeskConfiguration'][_0xbeaa('0x51')]);_0x3fe4ba[_0xbeaa('0x39')]=_[_0xbeaa('0x38')](_0x5f0582['query']);_0x3fe4ba['filters']=_[_0xbeaa('0x3b')](_0x3fe4ba['model'],_0x3fe4ba[_0xbeaa('0x39')]);_0x37b4b7[_0xbeaa('0x3d')]=_['intersection'](_0x3fe4ba[_0xbeaa('0x37')],qs[_0xbeaa('0x3c')](_0x5f0582[_0xbeaa('0x39')][_0xbeaa('0x3c')]));_0x37b4b7[_0xbeaa('0x3d')]=_0x37b4b7[_0xbeaa('0x3d')]['length']?_0x37b4b7['attributes']:_0x3fe4ba[_0xbeaa('0x37')];_0x37b4b7[_0xbeaa('0x40')]=qs[_0xbeaa('0x41')](_0x5f0582[_0xbeaa('0x39')][_0xbeaa('0x41')]);_0x37b4b7[_0xbeaa('0x42')]=qs[_0xbeaa('0x3a')](_[_0xbeaa('0x43')](_0x5f0582[_0xbeaa('0x39')],_0x3fe4ba['filters']));if(_0x5f0582[_0xbeaa('0x39')][_0xbeaa('0x44')]){_0x37b4b7[_0xbeaa('0x42')]=_[_0xbeaa('0x45')](_0x37b4b7[_0xbeaa('0x42')],{'$or':_[_0xbeaa('0x46')](_0x37b4b7[_0xbeaa('0x3d')],function(_0x162140){var _0x280ba6={};_0x280ba6[_0x162140]={'$like':'%'+_0x5f0582[_0xbeaa('0x39')][_0xbeaa('0x44')]+'%'};return _0x280ba6;})});}_0x37b4b7=_[_0xbeaa('0x45')]({},_0x37b4b7,_0x5f0582[_0xbeaa('0x4b')]);return _0x97b35[_0xbeaa('0x58')](_0x37b4b7);}})[_0xbeaa('0x1c')](function(_0x4a92b7){if(_0x4a92b7){_0x590e6c=_0x4a92b7[_0xbeaa('0x3e')];if(!_0x5f0582[_0xbeaa('0x39')][_0xbeaa('0x5a')](_0xbeaa('0x3f'))){_0x37b4b7['limit']=qs[_0xbeaa('0x2c')](_0x5f0582[_0xbeaa('0x39')][_0xbeaa('0x2c')]);_0x37b4b7['offset']=qs['offset'](_0x5f0582[_0xbeaa('0x39')]['offset']);}return _0x97b35[_0xbeaa('0x58')](_0x37b4b7);}})[_0xbeaa('0x1c')](function(_0x54467c){if(_0x54467c){return _0x54467c?{'count':_0x590e6c,'rows':_0x54467c}:null;}})[_0xbeaa('0x1c')](respondWithResult(_0x96862e,null))[_0xbeaa('0x54')](handleError(_0x96862e,null));};exports[_0xbeaa('0x5b')]=function(_0x27677a,_0x2b4c87,_0x308324){if(_0x27677a['body']['id']){delete _0x27677a[_0xbeaa('0x56')]['id'];}return db[_0xbeaa('0x36')][_0xbeaa('0x59')]({'where':{'id':_0x27677a['params']['id']}})[_0xbeaa('0x1c')](handleEntityNotFound(_0x2b4c87,null))[_0xbeaa('0x1c')](function(_0x1f5998){if(_0x1f5998){_0x27677a[_0xbeaa('0x56')][_0xbeaa('0x5c')]=_0x1f5998['id'];_0x27677a['body'][_0xbeaa('0x5d')]=integrations[_0xbeaa('0x5e')](_0x27677a[_0xbeaa('0x56')][_0xbeaa('0x5f')],_0x27677a[_0xbeaa('0x56')][_0xbeaa('0x47')]);_0x27677a[_0xbeaa('0x56')][_0xbeaa('0x60')]=integrations[_0xbeaa('0x61')](_0x27677a[_0xbeaa('0x56')][_0xbeaa('0x5f')],_0x27677a[_0xbeaa('0x56')]['type']);return db['FreshdeskConfiguration'][_0xbeaa('0x55')](_0x27677a[_0xbeaa('0x56')],{'include':[{'model':db['FreshdeskField'],'as':_0xbeaa('0x5d')},{'model':db[_0xbeaa('0x62')],'as':_0xbeaa('0x60')}]});}return null;})['then'](respondWithResult(_0x2b4c87,null))[_0xbeaa('0x54')](handleError(_0x2b4c87,null));};exports[_0xbeaa('0x63')]=function(_0x398f06,_0x6c824f,_0x3ca763){var _0x420360='';return db[_0xbeaa('0x36')]['findOne']({'where':{'id':_0x398f06[_0xbeaa('0x57')]['id']},'attributes':['id','remoteUri',_0xbeaa('0x64')]})[_0xbeaa('0x1c')](handleEntityNotFound(_0x6c824f,null))[_0xbeaa('0x1c')](function(_0x555a29){if(_0x555a29){_0x420360=_0x555a29[_0xbeaa('0x65')];var _0x26adfb=_0x420360['slice'](-0x1);if(_0x26adfb==='/'){_0x420360=_0x420360['substring'](0x0,_0x420360['lastIndexOf'](_0x26adfb));}return rp({'method':_0xbeaa('0x66'),'uri':util[_0xbeaa('0x67')](_0xbeaa('0x68'),_0x420360,_0xbeaa('0x69')),'headers':{'Authorization':util[_0xbeaa('0x67')](_0xbeaa('0x6a'),new Buffer(util[_0xbeaa('0x67')](_0xbeaa('0x6b'),_0x555a29['apiKey']))[_0xbeaa('0x6c')](_0xbeaa('0x6d')))},'json':!![]});}})[_0xbeaa('0x1c')](function(_0x476bd6){if(_0x476bd6){var _0x3f2c43=[_0xbeaa('0x6e'),'subject',_0xbeaa('0x6f'),'description','status',_0xbeaa('0x70'),_0xbeaa('0x71'),'source',_0xbeaa('0x72'),_0xbeaa('0x71'),_0xbeaa('0x73')];_[_0xbeaa('0x74')](_0x476bd6,function(_0x301496){return _0x3f2c43[_0xbeaa('0x75')](_0x301496[_0xbeaa('0x33')])||!_0x301496['default']&&_0x301496['type']!==_0xbeaa('0x76')&&_0x301496[_0xbeaa('0x47')]!==_0xbeaa('0x77');});return{'count':_0x476bd6[_0xbeaa('0x3e')],'rows':_[_0xbeaa('0x46')](_0x476bd6,function(_0x3ebf5d){return{'id':_0x3ebf5d[_0xbeaa('0x33')],'name':_0x3ebf5d[_0xbeaa('0x78')],'custom':!_0x3ebf5d[_0xbeaa('0x79')],'options':_0x3ebf5d['choices']?_[_0xbeaa('0x46')](_0x3ebf5d[_0xbeaa('0x7a')],function(_0x192970){return{'name':_[_0xbeaa('0x7b')](_0x192970),'value':_0x192970};}):[]};})};}})[_0xbeaa('0x1c')](respondWithResult(_0x6c824f,null))[_0xbeaa('0x54')](function(_0x58c3f2){var _0x1d7993=_0x398f06['query'][_0xbeaa('0x7c')]?0x1f4:_0x58c3f2[_0xbeaa('0x7d')]||0x1f4;logger[_0xbeaa('0x23')](_0xbeaa('0x7e'),'getFields',_0x1d7993,JSON[_0xbeaa('0x22')](_0x58c3f2));delete _0x58c3f2[_0xbeaa('0x33')];if(_0x1d7993===0x191){_0x1d7993=0x190;}_0x6c824f[_0xbeaa('0x28')](_0x1d7993)[_0xbeaa('0x34')](_0x398f06['query']['test']?{'message':_0xbeaa('0x7f'),'statusCode':_0x58c3f2[_0xbeaa('0x7d')]}:_0x58c3f2);});}; \ No newline at end of file +var _0xa9fc=['show','params','includeAll','options','create','body','find','destroy','findOne','FreshdeskConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','source','ticket_type','group','company','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request\x20sent','debug','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','Content-Range','reject','update','then','stack','name','send','index','FreshdeskAccount','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','map','type','VIRTUAL','field','include','rows'];(function(_0x26a818,_0x40708a){var _0x5d8ca0=function(_0x3cc7ed){while(--_0x3cc7ed){_0x26a818['push'](_0x26a818['shift']());}};_0x5d8ca0(++_0x40708a);}(_0xa9fc,0x19f));var _0xca9f=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0xa9fc[_0x450689];return _0x46ffb0;};'use strict';var pdf=require(_0xca9f('0x0'));var emlformat=require(_0xca9f('0x1'));var rimraf=require(_0xca9f('0x2'));var zipdir=require(_0xca9f('0x3'));var jsonpatch=require(_0xca9f('0x4'));var rp=require('request-promise');var moment=require(_0xca9f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xca9f('0x6'));var util=require(_0xca9f('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xca9f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xca9f('0x9'));var crypto=require(_0xca9f('0xa'));var jsforce=require(_0xca9f('0xb'));var deskjs=require(_0xca9f('0xc'));var toCsv=require(_0xca9f('0xd'));var querystring=require(_0xca9f('0xe'));var Papa=require(_0xca9f('0xf'));var authService=require(_0xca9f('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xca9f('0x11'));var qs=require(_0xca9f('0x12'));var logger=require(_0xca9f('0x13'))(_0xca9f('0x14'));var utils=require('../../config/utils');var config=require(_0xca9f('0x15'));var db=require(_0xca9f('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xca9f('0x17'));var client=jayson[_0xca9f('0x18')][_0xca9f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2aefea,_0x14cf3a,_0x13c082,_0x109ec0){return new BPromise(function(_0x2cb6f4,_0x33f8c7){var _0x864d21=_0x109ec0||client;return _0x864d21['request'](_0x2aefea,_0x13c082)['then'](function(_0x300c62){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x14cf3a,_0xca9f('0x1a'));logger[_0xca9f('0x1b')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x14cf3a,_0xca9f('0x1a'),JSON['stringify'](_0x300c62));if(_0x300c62[_0xca9f('0x1c')]){if(_0x300c62['error'][_0xca9f('0x1d')]===0x1f4){logger[_0xca9f('0x1c')](_0xca9f('0x1e'),_0x14cf3a,_0x300c62[_0xca9f('0x1c')][_0xca9f('0x1f')]);return _0x33f8c7(_0x300c62['error'][_0xca9f('0x1f')]);}logger['error'](_0xca9f('0x1e'),_0x14cf3a,_0x300c62[_0xca9f('0x1c')][_0xca9f('0x1f')]);return _0x2cb6f4(_0x300c62[_0xca9f('0x1c')][_0xca9f('0x1f')]);}else{logger['info'](_0xca9f('0x1e'),_0x14cf3a,_0xca9f('0x1a'));_0x2cb6f4(_0x300c62[_0xca9f('0x20')][_0xca9f('0x1f')]);}})[_0xca9f('0x21')](function(_0x4f9e9c){logger['error'](_0xca9f('0x1e'),_0x14cf3a,_0x4f9e9c);_0x33f8c7(_0x4f9e9c);});});}function respondWithStatusCode(_0x96b3ec,_0x162328){_0x162328=_0x162328||0xcc;return function(_0x1066bc){if(_0x1066bc){return _0x96b3ec[_0xca9f('0x22')](_0x162328);}return _0x96b3ec['status'](_0x162328)[_0xca9f('0x23')]();};}function respondWithResult(_0x1f7939,_0x46a0e8){_0x46a0e8=_0x46a0e8||0xc8;return function(_0x4d64eb){if(_0x4d64eb){return _0x1f7939[_0xca9f('0x24')](_0x46a0e8)[_0xca9f('0x25')](_0x4d64eb);}};}function respondWithFilteredResult(_0x428825,_0x133222){return function(_0x88025b){if(_0x88025b){var _0x4c4558=_0x88025b[_0xca9f('0x26')],_0xa5f9bc=_0x133222[_0xca9f('0x27')],_0x33efe0=_0x133222['offset']+_0x133222['limit'],_0x4297c8;if(_0x33efe0>=_0x4c4558){_0x33efe0=_0x4c4558;_0x4297c8=0xc8;}else{_0x4297c8=0xce;}_0x428825[_0xca9f('0x24')](_0x4297c8);return _0x428825['set'](_0xca9f('0x28'),_0xa5f9bc+'-'+_0x33efe0+'/'+_0x4c4558)[_0xca9f('0x25')](_0x88025b);}return null;};}function patchUpdates(_0x17d202){return function(_0x1360d1){try{jsonpatch['apply'](_0x1360d1,_0x17d202,!![]);}catch(_0x596703){return BPromise[_0xca9f('0x29')](_0x596703);}return _0x1360d1['save']();};}function saveUpdates(_0x26b33d,_0x54beae){return function(_0x2fa5e1){if(_0x2fa5e1){return _0x2fa5e1[_0xca9f('0x2a')](_0x26b33d)[_0xca9f('0x2b')](function(_0x300aa2){return _0x300aa2;});}return null;};}function removeEntity(_0x282dc4,_0x1c9138){return function(_0x4f9368){if(_0x4f9368){return _0x4f9368['destroy']()[_0xca9f('0x2b')](function(){_0x282dc4['status'](0xcc)[_0xca9f('0x23')]();});}};}function handleEntityNotFound(_0x33a9d5,_0x2c2d98){return function(_0x4bb01e){if(!_0x4bb01e){_0x33a9d5['sendStatus'](0x194);}return _0x4bb01e;};}function handleError(_0x42b113,_0x359026){_0x359026=_0x359026||0x1f4;return function(_0xe5d738){logger['error'](_0xe5d738[_0xca9f('0x2c')]);if(_0xe5d738[_0xca9f('0x2d')]){delete _0xe5d738['name'];}_0x42b113['status'](_0x359026)[_0xca9f('0x2e')](_0xe5d738);};}exports[_0xca9f('0x2f')]=function(_0x33e1dc,_0x4363fd){var _0x48205e={},_0x34538e={},_0x3c44ea={'count':0x0,'rows':[]};var _0x28b5f9=db[_0xca9f('0x30')][_0xca9f('0x31')];_0x34538e[_0xca9f('0x32')]=_[_0xca9f('0x33')](_0x28b5f9);_0x34538e[_0xca9f('0x34')]=_['keys'](_0x33e1dc[_0xca9f('0x34')]);_0x34538e['filters']=_[_0xca9f('0x35')](_0x34538e[_0xca9f('0x32')],_0x34538e['query']);_0x48205e[_0xca9f('0x36')]=_[_0xca9f('0x35')](_0x34538e[_0xca9f('0x32')],qs[_0xca9f('0x37')](_0x33e1dc[_0xca9f('0x34')]['fields']));_0x48205e['attributes']=_0x48205e['attributes'][_0xca9f('0x38')]?_0x48205e[_0xca9f('0x36')]:_0x34538e[_0xca9f('0x32')];if(!_0x33e1dc['query'][_0xca9f('0x39')](_0xca9f('0x3a'))){_0x48205e['limit']=qs[_0xca9f('0x3b')](_0x33e1dc[_0xca9f('0x34')]['limit']);_0x48205e[_0xca9f('0x27')]=qs[_0xca9f('0x27')](_0x33e1dc[_0xca9f('0x34')][_0xca9f('0x27')]);}_0x48205e[_0xca9f('0x3c')]=qs['sort'](_0x33e1dc[_0xca9f('0x34')][_0xca9f('0x3d')]);_0x48205e['where']=qs[_0xca9f('0x3e')](_[_0xca9f('0x3f')](_0x33e1dc[_0xca9f('0x34')],_0x34538e[_0xca9f('0x3e')]));if(_0x33e1dc[_0xca9f('0x34')][_0xca9f('0x40')]){_0x48205e[_0xca9f('0x41')]=_[_0xca9f('0x42')](_0x48205e[_0xca9f('0x41')],{'$or':_[_0xca9f('0x43')](_0x28b5f9,function(_0x2bc911){if(_0x2bc911[_0xca9f('0x44')]['key']!==_0xca9f('0x45')){var _0x874947={};_0x874947[_0x2bc911[_0xca9f('0x46')]]={'$like':'%'+_0x33e1dc[_0xca9f('0x34')][_0xca9f('0x40')]+'%'};return _0x874947;}})});}_0x48205e=_['merge']({},_0x48205e,_0x33e1dc['options']);var _0x470ad6={'where':_0x48205e['where']};return db[_0xca9f('0x30')][_0xca9f('0x26')](_0x470ad6)[_0xca9f('0x2b')](function(_0x33cba8){_0x3c44ea[_0xca9f('0x26')]=_0x33cba8;if(_0x33e1dc[_0xca9f('0x34')]['includeAll']){_0x48205e[_0xca9f('0x47')]=[{'all':!![]}];}return db[_0xca9f('0x30')]['findAll'](_0x48205e);})[_0xca9f('0x2b')](function(_0x3e61c6){_0x3c44ea[_0xca9f('0x48')]=_0x3e61c6;return _0x3c44ea;})[_0xca9f('0x2b')](respondWithFilteredResult(_0x4363fd,_0x48205e))['catch'](handleError(_0x4363fd,null));};exports[_0xca9f('0x49')]=function(_0x543b3c,_0x405728){var _0xd89e45={'raw':![],'where':{'id':_0x543b3c[_0xca9f('0x4a')]['id']}},_0x1147bd={};_0x1147bd['model']=_['keys'](db['FreshdeskAccount'][_0xca9f('0x31')]);_0x1147bd[_0xca9f('0x34')]=_[_0xca9f('0x33')](_0x543b3c[_0xca9f('0x34')]);_0x1147bd[_0xca9f('0x3e')]=_[_0xca9f('0x35')](_0x1147bd[_0xca9f('0x32')],_0x1147bd[_0xca9f('0x34')]);_0xd89e45[_0xca9f('0x36')]=_[_0xca9f('0x35')](_0x1147bd['model'],qs[_0xca9f('0x37')](_0x543b3c['query'][_0xca9f('0x37')]));_0xd89e45[_0xca9f('0x36')]=_0xd89e45['attributes'][_0xca9f('0x38')]?_0xd89e45[_0xca9f('0x36')]:_0x1147bd[_0xca9f('0x32')];if(_0x543b3c[_0xca9f('0x34')][_0xca9f('0x4b')]){_0xd89e45[_0xca9f('0x47')]=[{'all':!![]}];}_0xd89e45=_[_0xca9f('0x42')]({},_0xd89e45,_0x543b3c[_0xca9f('0x4c')]);return db['FreshdeskAccount']['find'](_0xd89e45)[_0xca9f('0x2b')](handleEntityNotFound(_0x405728,null))[_0xca9f('0x2b')](respondWithResult(_0x405728,null))[_0xca9f('0x21')](handleError(_0x405728,null));};exports[_0xca9f('0x4d')]=function(_0x18acdc,_0x14ba2c){return db['FreshdeskAccount'][_0xca9f('0x4d')](_0x18acdc[_0xca9f('0x4e')],{})[_0xca9f('0x2b')](respondWithResult(_0x14ba2c,0xc9))['catch'](handleError(_0x14ba2c,null));};exports[_0xca9f('0x2a')]=function(_0x4772dc,_0x595ba2){if(_0x4772dc['body']['id']){delete _0x4772dc[_0xca9f('0x4e')]['id'];}return db[_0xca9f('0x30')][_0xca9f('0x4f')]({'where':{'id':_0x4772dc[_0xca9f('0x4a')]['id']}})[_0xca9f('0x2b')](handleEntityNotFound(_0x595ba2,null))[_0xca9f('0x2b')](saveUpdates(_0x4772dc[_0xca9f('0x4e')],null))[_0xca9f('0x2b')](respondWithResult(_0x595ba2,null))[_0xca9f('0x21')](handleError(_0x595ba2,null));};exports[_0xca9f('0x50')]=function(_0x1db533,_0x41f4de){return db[_0xca9f('0x30')][_0xca9f('0x4f')]({'where':{'id':_0x1db533[_0xca9f('0x4a')]['id']}})[_0xca9f('0x2b')](handleEntityNotFound(_0x41f4de,null))[_0xca9f('0x2b')](removeEntity(_0x41f4de,null))[_0xca9f('0x21')](handleError(_0x41f4de,null));};exports['getConfigurations']=function(_0x3ad946,_0xbe329b,_0x505ce6){var _0x5c8119={};var _0x5ac9ed={};var _0x36512d;var _0xca2173;return db[_0xca9f('0x30')][_0xca9f('0x51')]({'where':{'id':_0x3ad946[_0xca9f('0x4a')]['id']}})[_0xca9f('0x2b')](handleEntityNotFound(_0xbe329b,null))[_0xca9f('0x2b')](function(_0xf769a8){if(_0xf769a8){_0x36512d=_0xf769a8;_0x5ac9ed[_0xca9f('0x32')]=_['keys'](db[_0xca9f('0x52')]['rawAttributes']);_0x5ac9ed['query']=_['keys'](_0x3ad946[_0xca9f('0x34')]);_0x5ac9ed[_0xca9f('0x3e')]=_[_0xca9f('0x35')](_0x5ac9ed['model'],_0x5ac9ed['query']);_0x5c8119[_0xca9f('0x36')]=_[_0xca9f('0x35')](_0x5ac9ed['model'],qs['fields'](_0x3ad946[_0xca9f('0x34')][_0xca9f('0x37')]));_0x5c8119['attributes']=_0x5c8119[_0xca9f('0x36')][_0xca9f('0x38')]?_0x5c8119['attributes']:_0x5ac9ed['model'];_0x5c8119[_0xca9f('0x3c')]=qs[_0xca9f('0x3d')](_0x3ad946['query'][_0xca9f('0x3d')]);_0x5c8119['where']=qs['filters'](_[_0xca9f('0x3f')](_0x3ad946['query'],_0x5ac9ed['filters']));if(_0x3ad946[_0xca9f('0x34')][_0xca9f('0x40')]){_0x5c8119[_0xca9f('0x41')]=_[_0xca9f('0x42')](_0x5c8119['where'],{'$or':_[_0xca9f('0x43')](_0x5c8119[_0xca9f('0x36')],function(_0x5b105f){var _0xd292fd={};_0xd292fd[_0x5b105f]={'$like':'%'+_0x3ad946[_0xca9f('0x34')][_0xca9f('0x40')]+'%'};return _0xd292fd;})});}_0x5c8119=_['merge']({},_0x5c8119,_0x3ad946[_0xca9f('0x4c')]);return _0x36512d[_0xca9f('0x53')](_0x5c8119);}})[_0xca9f('0x2b')](function(_0x5080cd){if(_0x5080cd){_0xca2173=_0x5080cd[_0xca9f('0x38')];if(!_0x3ad946[_0xca9f('0x34')][_0xca9f('0x39')](_0xca9f('0x3a'))){_0x5c8119[_0xca9f('0x3b')]=qs[_0xca9f('0x3b')](_0x3ad946[_0xca9f('0x34')]['limit']);_0x5c8119[_0xca9f('0x27')]=qs['offset'](_0x3ad946['query']['offset']);}return _0x36512d['getConfigurations'](_0x5c8119);}})['then'](function(_0x23e815){if(_0x23e815){return _0x23e815?{'count':_0xca2173,'rows':_0x23e815}:null;}})['then'](respondWithResult(_0xbe329b,null))['catch'](handleError(_0xbe329b,null));};exports['addConfiguration']=function(_0x2d9d23,_0x5e960a,_0xfaf6af){if(_0x2d9d23['body']['id']){delete _0x2d9d23['body']['id'];}return db[_0xca9f('0x30')]['findOne']({'where':{'id':_0x2d9d23[_0xca9f('0x4a')]['id']}})[_0xca9f('0x2b')](handleEntityNotFound(_0x5e960a,null))[_0xca9f('0x2b')](function(_0x2f5368){if(_0x2f5368){_0x2d9d23[_0xca9f('0x4e')][_0xca9f('0x54')]=_0x2f5368['id'];_0x2d9d23[_0xca9f('0x4e')][_0xca9f('0x55')]=integrations[_0xca9f('0x56')](_0x2d9d23[_0xca9f('0x4e')][_0xca9f('0x57')],_0x2d9d23[_0xca9f('0x4e')][_0xca9f('0x44')]);_0x2d9d23[_0xca9f('0x4e')][_0xca9f('0x58')]=integrations['getDescriptions'](_0x2d9d23[_0xca9f('0x4e')]['channel'],_0x2d9d23[_0xca9f('0x4e')][_0xca9f('0x44')]);return db[_0xca9f('0x52')]['create'](_0x2d9d23[_0xca9f('0x4e')],{'include':[{'model':db[_0xca9f('0x59')],'as':_0xca9f('0x55')},{'model':db[_0xca9f('0x59')],'as':_0xca9f('0x58')}]});}return null;})['then'](respondWithResult(_0x5e960a,null))[_0xca9f('0x21')](handleError(_0x5e960a,null));};exports[_0xca9f('0x5a')]=function(_0xc84c0b,_0x25db8c,_0x3158dc){var _0x55c421='';return db[_0xca9f('0x30')][_0xca9f('0x51')]({'where':{'id':_0xc84c0b[_0xca9f('0x4a')]['id']},'attributes':['id',_0xca9f('0x5b'),_0xca9f('0x5c')]})[_0xca9f('0x2b')](handleEntityNotFound(_0x25db8c,null))[_0xca9f('0x2b')](function(_0x2d2d9a){if(_0x2d2d9a){_0x55c421=_0x2d2d9a[_0xca9f('0x5b')];var _0x18a19d=_0x55c421[_0xca9f('0x5d')](-0x1);if(_0x18a19d==='/'){_0x55c421=_0x55c421['substring'](0x0,_0x55c421[_0xca9f('0x5e')](_0x18a19d));}return rp({'method':'GET','uri':util[_0xca9f('0x5f')](_0xca9f('0x60'),_0x55c421,_0xca9f('0x61')),'headers':{'Authorization':util[_0xca9f('0x5f')](_0xca9f('0x62'),new Buffer(util[_0xca9f('0x5f')](_0xca9f('0x63'),_0x2d2d9a[_0xca9f('0x5c')]))[_0xca9f('0x64')](_0xca9f('0x65')))},'json':!![]});}})[_0xca9f('0x2b')](function(_0x4db1cd){if(_0x4db1cd){var _0x46372c=[_0xca9f('0x66'),_0xca9f('0x67'),_0xca9f('0x68'),_0xca9f('0x69'),_0xca9f('0x24'),_0xca9f('0x6a'),'group',_0xca9f('0x6b'),_0xca9f('0x6c'),_0xca9f('0x6d'),_0xca9f('0x6e')];_['remove'](_0x4db1cd,function(_0xfe941f){return _0x46372c[_0xca9f('0x6f')](_0xfe941f['name'])||!_0xfe941f[_0xca9f('0x70')]&&_0xfe941f['type']!==_0xca9f('0x71')&&_0xfe941f['type']!==_0xca9f('0x72');});return{'count':_0x4db1cd[_0xca9f('0x38')],'rows':_['map'](_0x4db1cd,function(_0x47fdcc){return{'id':_0x47fdcc['name'],'name':_0x47fdcc[_0xca9f('0x73')],'custom':!_0x47fdcc[_0xca9f('0x70')],'options':_0x47fdcc[_0xca9f('0x74')]?_[_0xca9f('0x43')](_0x47fdcc[_0xca9f('0x74')],function(_0xe936f1){return{'name':_['capitalize'](_0xe936f1),'value':_0xe936f1};}):[]};})};}})[_0xca9f('0x2b')](respondWithResult(_0x25db8c,null))['catch'](function(_0x1d3441){var _0x21e8ba=_0xc84c0b[_0xca9f('0x34')][_0xca9f('0x75')]?0x1f4:_0x1d3441[_0xca9f('0x76')]||0x1f4;logger['error'](_0xca9f('0x77'),_0xca9f('0x5a'),_0x21e8ba,JSON[_0xca9f('0x78')](_0x1d3441));delete _0x1d3441[_0xca9f('0x2d')];if(_0x21e8ba===0x191){_0x21e8ba=0x190;}_0x25db8c[_0xca9f('0x24')](_0x21e8ba)[_0xca9f('0x2e')](_0xc84c0b[_0xca9f('0x34')][_0xca9f('0x75')]?{'message':_0xca9f('0x79'),'statusCode':_0x1d3441[_0xca9f('0x76')]}:_0x1d3441);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 78a78c6..69968b9 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 _0x24e9=['int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x11c4b0,_0x5ebeb3){var _0x242ce2=function(_0x2951ae){while(--_0x2951ae){_0x11c4b0['push'](_0x11c4b0['shift']());}};_0x242ce2(++_0x5ebeb3);}(_0x24e9,0x85));var _0x924e=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x24e9[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require(_0x924e('0x0'));var util=require('util');var logger=require(_0x924e('0x1'))(_0x924e('0x2'));var moment=require(_0x924e('0x3'));var BPromise=require(_0x924e('0x4'));var rp=require(_0x924e('0x5'));var attributes=require(_0x924e('0x6'));var integrations=require(_0x924e('0x7'));module[_0x924e('0x8')]=function(_0x4ecdb9,_0x18346f){return _0x4ecdb9[_0x924e('0x9')](_0x924e('0xa'),attributes,{'tableName':_0x924e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f19=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','moment','request-promise','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x130523,_0x299f4f){var _0x319a73=function(_0x53bc5f){while(--_0x53bc5f){_0x130523['push'](_0x130523['shift']());}};_0x319a73(++_0x299f4f);}(_0x3f19,0xc0));var _0x93f1=function(_0xf2ee56,_0x565642){_0xf2ee56=_0xf2ee56-0x0;var _0x2b9bc9=_0x3f19[_0xf2ee56];return _0x2b9bc9;};'use strict';var _=require(_0x93f1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x93f1('0x1'));var BPromise=require('bluebird');var rp=require(_0x93f1('0x2'));var attributes=require(_0x93f1('0x3'));var integrations=require(_0x93f1('0x4'));module[_0x93f1('0x5')]=function(_0x5dbfbc,_0x1ca333){return _0x5dbfbc[_0x93f1('0x6')](_0x93f1('0x7'),attributes,{'tableName':_0x93f1('0x8'),'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 fd18be2..e7ed504 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 _0x2fa1=['util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','info','ShowFreshdeskAccount','stringify','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2fa1,0x107));var _0x12fa=function(_0x18b2de,_0x4137e8){_0x18b2de=_0x18b2de-0x0;var _0x2bbe33=_0x2fa1[_0x18b2de];return _0x2bbe33;};'use strict';var _=require(_0x12fa('0x0'));var util=require(_0x12fa('0x1'));var moment=require(_0x12fa('0x2'));var BPromise=require(_0x12fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x12fa('0x5'))('rpc');var config=require(_0x12fa('0x6'));var jayson=require(_0x12fa('0x7'));var client=jayson['client'][_0x12fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x166d21,_0x32bac9,_0x1a11b6){return new BPromise(function(_0x4b27d4,_0x3b2fac){return client[_0x12fa('0x9')](_0x166d21,_0x1a11b6)[_0x12fa('0xa')](function(_0x2a2818){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x32bac9,_0x12fa('0xb'));logger[_0x12fa('0xc')](_0x12fa('0xd'),_0x32bac9,'request\x20sent',JSON['stringify'](_0x2a2818));if(_0x2a2818[_0x12fa('0xe')]){if(_0x2a2818[_0x12fa('0xe')][_0x12fa('0xf')]===0x1f4){logger[_0x12fa('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x32bac9,_0x2a2818[_0x12fa('0xe')][_0x12fa('0x10')]);return _0x3b2fac(_0x2a2818[_0x12fa('0xe')][_0x12fa('0x10')]);}logger['error'](_0x12fa('0x11'),_0x32bac9,_0x2a2818[_0x12fa('0xe')]['message']);return _0x4b27d4(_0x2a2818['error'][_0x12fa('0x10')]);}else{logger['info'](_0x12fa('0x11'),_0x32bac9,'request\x20sent');_0x4b27d4(_0x2a2818[_0x12fa('0x12')][_0x12fa('0x10')]);}})[_0x12fa('0x13')](function(_0x2c720a){logger[_0x12fa('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x32bac9,_0x2c720a);_0x3b2fac(_0x2c720a);});});}exports[_0x12fa('0x14')]=function(_0x27c1b4){var _0x5c203a=this;return new Promise(function(_0x4ffe87,_0x33efc3){return db[_0x12fa('0x15')][_0x12fa('0x16')]({'raw':_0x27c1b4[_0x12fa('0x17')]?_0x27c1b4['options'][_0x12fa('0x18')]===undefined?!![]:![]:!![],'where':_0x27c1b4[_0x12fa('0x17')]?_0x27c1b4[_0x12fa('0x17')][_0x12fa('0x19')]||null:null,'attributes':_0x27c1b4['options']?_0x27c1b4['options'][_0x12fa('0x1a')]||null:null,'limit':_0x27c1b4[_0x12fa('0x17')]?_0x27c1b4[_0x12fa('0x17')]['limit']||null:null,'include':_0x27c1b4['options']?_0x27c1b4[_0x12fa('0x17')][_0x12fa('0x1b')]?_[_0x12fa('0x1c')](_0x27c1b4['options'][_0x12fa('0x1b')],function(_0x29a91f){return{'model':db[_0x29a91f[_0x12fa('0x1d')]],'as':_0x29a91f['as'],'attributes':_0x29a91f[_0x12fa('0x1a')],'include':_0x29a91f[_0x12fa('0x1b')]?_[_0x12fa('0x1c')](_0x29a91f[_0x12fa('0x1b')],function(_0x20e209){return{'model':db[_0x20e209[_0x12fa('0x1d')]],'as':_0x20e209['as'],'attributes':_0x20e209[_0x12fa('0x1a')],'include':_0x20e209[_0x12fa('0x1b')]?_[_0x12fa('0x1c')](_0x20e209[_0x12fa('0x1b')],function(_0xff676a){return{'model':db[_0xff676a[_0x12fa('0x1d')]],'as':_0xff676a['as'],'attributes':_0xff676a[_0x12fa('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x12fa('0xa')](function(_0x4e26d2){logger[_0x12fa('0x1e')](_0x12fa('0x14'),_0x27c1b4);logger[_0x12fa('0xc')](_0x12fa('0x14'),_0x27c1b4,JSON['stringify'](_0x4e26d2));_0x4ffe87(_0x4e26d2);})[_0x12fa('0x13')](function(_0xe07681){logger['error'](_0x12fa('0x14'),_0xe07681[_0x12fa('0x10')],_0x27c1b4);_0x33efc3(_0x5c203a[_0x12fa('0xe')](0x1f4,_0xe07681['message']));});});};exports['ShowFreshdeskAccount']=function(_0x183ce0){var _0x2a6d28=this;return new Promise(function(_0x17e004,_0x42347f){return db[_0x12fa('0x15')]['find']({'raw':_0x183ce0['options']?_0x183ce0[_0x12fa('0x17')][_0x12fa('0x18')]===undefined?!![]:![]:!![],'where':_0x183ce0['options']?_0x183ce0[_0x12fa('0x17')]['where']||null:null,'attributes':_0x183ce0[_0x12fa('0x17')]?_0x183ce0[_0x12fa('0x17')][_0x12fa('0x1a')]||null:null,'include':_0x183ce0[_0x12fa('0x17')]?_0x183ce0['options']['include']?_['map'](_0x183ce0[_0x12fa('0x17')]['include'],function(_0x11cc2a){return{'model':db[_0x11cc2a[_0x12fa('0x1d')]],'as':_0x11cc2a['as'],'attributes':_0x11cc2a[_0x12fa('0x1a')],'include':_0x11cc2a[_0x12fa('0x1b')]?_[_0x12fa('0x1c')](_0x11cc2a[_0x12fa('0x1b')],function(_0x197389){return{'model':db[_0x197389[_0x12fa('0x1d')]],'as':_0x197389['as'],'attributes':_0x197389[_0x12fa('0x1a')],'include':_0x197389['include']?_[_0x12fa('0x1c')](_0x197389[_0x12fa('0x1b')],function(_0x8af15){return{'model':db[_0x8af15[_0x12fa('0x1d')]],'as':_0x8af15['as'],'attributes':_0x8af15[_0x12fa('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x12fa('0xa')](function(_0x3008d5){logger[_0x12fa('0x1e')](_0x12fa('0x1f'),_0x183ce0);logger['debug'](_0x12fa('0x1f'),_0x183ce0,JSON[_0x12fa('0x20')](_0x3008d5));_0x17e004(_0x3008d5);})['catch'](function(_0x1ff9a3){logger[_0x12fa('0xe')](_0x12fa('0x1f'),_0x1ff9a3[_0x12fa('0x10')],_0x183ce0);_0x42347f(_0x2a6d28[_0x12fa('0xe')](0x1f4,_0x1ff9a3[_0x12fa('0x10')]));});});}; \ No newline at end of file +var _0x51dc=['map','include','model','attributes','GetFreshdeskAccount','ShowFreshdeskAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','FreshdeskAccount','findAll','options','raw','where','limit'];(function(_0x14d6be,_0xcc7140){var _0x193f73=function(_0x1e4301){while(--_0x1e4301){_0x14d6be['push'](_0x14d6be['shift']());}};_0x193f73(++_0xcc7140);}(_0x51dc,0x8e));var _0xc51d=function(_0x1cf60e,_0x4fb33d){_0x1cf60e=_0x1cf60e-0x0;var _0x342a1e=_0x51dc[_0x1cf60e];return _0x342a1e;};'use strict';var _=require(_0xc51d('0x0'));var util=require('util');var moment=require(_0xc51d('0x1'));var BPromise=require('bluebird');var rs=require(_0xc51d('0x2'));var fs=require('fs');var Redis=require(_0xc51d('0x3'));var db=require(_0xc51d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc51d('0x5'))(_0xc51d('0x6'));var config=require(_0xc51d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc51d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40416,_0x57af9c,_0x3da542){return new BPromise(function(_0x3fcfb1,_0x54baf7){return client[_0xc51d('0x9')](_0x40416,_0x3da542)[_0xc51d('0xa')](function(_0x50ad28){logger['info'](_0xc51d('0xb'),_0x57af9c,_0xc51d('0xc'));logger[_0xc51d('0xd')](_0xc51d('0xe'),_0x57af9c,_0xc51d('0xc'),JSON[_0xc51d('0xf')](_0x50ad28));if(_0x50ad28['error']){if(_0x50ad28['error'][_0xc51d('0x10')]===0x1f4){logger['error'](_0xc51d('0xb'),_0x57af9c,_0x50ad28[_0xc51d('0x11')][_0xc51d('0x12')]);return _0x54baf7(_0x50ad28[_0xc51d('0x11')][_0xc51d('0x12')]);}logger[_0xc51d('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x57af9c,_0x50ad28[_0xc51d('0x11')][_0xc51d('0x12')]);return _0x3fcfb1(_0x50ad28['error']['message']);}else{logger[_0xc51d('0x13')](_0xc51d('0xb'),_0x57af9c,'request\x20sent');_0x3fcfb1(_0x50ad28[_0xc51d('0x14')]['message']);}})[_0xc51d('0x15')](function(_0x320e8e){logger[_0xc51d('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x57af9c,_0x320e8e);_0x54baf7(_0x320e8e);});});}exports['GetFreshdeskAccount']=function(_0x47ab96){var _0xd61112=this;return new Promise(function(_0x8f47b4,_0x32733b){return db[_0xc51d('0x16')][_0xc51d('0x17')]({'raw':_0x47ab96[_0xc51d('0x18')]?_0x47ab96['options'][_0xc51d('0x19')]===undefined?!![]:![]:!![],'where':_0x47ab96[_0xc51d('0x18')]?_0x47ab96[_0xc51d('0x18')][_0xc51d('0x1a')]||null:null,'attributes':_0x47ab96['options']?_0x47ab96[_0xc51d('0x18')]['attributes']||null:null,'limit':_0x47ab96[_0xc51d('0x18')]?_0x47ab96['options'][_0xc51d('0x1b')]||null:null,'include':_0x47ab96['options']?_0x47ab96[_0xc51d('0x18')]['include']?_[_0xc51d('0x1c')](_0x47ab96[_0xc51d('0x18')][_0xc51d('0x1d')],function(_0x8d02a2){return{'model':db[_0x8d02a2[_0xc51d('0x1e')]],'as':_0x8d02a2['as'],'attributes':_0x8d02a2[_0xc51d('0x1f')],'include':_0x8d02a2[_0xc51d('0x1d')]?_[_0xc51d('0x1c')](_0x8d02a2[_0xc51d('0x1d')],function(_0x7895e6){return{'model':db[_0x7895e6[_0xc51d('0x1e')]],'as':_0x7895e6['as'],'attributes':_0x7895e6[_0xc51d('0x1f')],'include':_0x7895e6[_0xc51d('0x1d')]?_[_0xc51d('0x1c')](_0x7895e6[_0xc51d('0x1d')],function(_0x4138e1){return{'model':db[_0x4138e1[_0xc51d('0x1e')]],'as':_0x4138e1['as'],'attributes':_0x4138e1[_0xc51d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc51d('0xa')](function(_0xa3d984){logger[_0xc51d('0x13')]('GetFreshdeskAccount',_0x47ab96);logger[_0xc51d('0xd')](_0xc51d('0x20'),_0x47ab96,JSON['stringify'](_0xa3d984));_0x8f47b4(_0xa3d984);})[_0xc51d('0x15')](function(_0xc62cfc){logger[_0xc51d('0x11')](_0xc51d('0x20'),_0xc62cfc[_0xc51d('0x12')],_0x47ab96);_0x32733b(_0xd61112[_0xc51d('0x11')](0x1f4,_0xc62cfc[_0xc51d('0x12')]));});});};exports[_0xc51d('0x21')]=function(_0x559618){var _0x173e31=this;return new Promise(function(_0x1da450,_0xf6df5f){return db[_0xc51d('0x16')]['find']({'raw':_0x559618[_0xc51d('0x18')]?_0x559618[_0xc51d('0x18')][_0xc51d('0x19')]===undefined?!![]:![]:!![],'where':_0x559618[_0xc51d('0x18')]?_0x559618['options'][_0xc51d('0x1a')]||null:null,'attributes':_0x559618['options']?_0x559618[_0xc51d('0x18')][_0xc51d('0x1f')]||null:null,'include':_0x559618['options']?_0x559618['options']['include']?_[_0xc51d('0x1c')](_0x559618[_0xc51d('0x18')][_0xc51d('0x1d')],function(_0x5b72ca){return{'model':db[_0x5b72ca[_0xc51d('0x1e')]],'as':_0x5b72ca['as'],'attributes':_0x5b72ca[_0xc51d('0x1f')],'include':_0x5b72ca['include']?_[_0xc51d('0x1c')](_0x5b72ca[_0xc51d('0x1d')],function(_0x15f193){return{'model':db[_0x15f193[_0xc51d('0x1e')]],'as':_0x15f193['as'],'attributes':_0x15f193[_0xc51d('0x1f')],'include':_0x15f193['include']?_[_0xc51d('0x1c')](_0x15f193['include'],function(_0xa1c7f8){return{'model':db[_0xa1c7f8[_0xc51d('0x1e')]],'as':_0xa1c7f8['as'],'attributes':_0xa1c7f8[_0xc51d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc51d('0xa')](function(_0x6961b2){logger[_0xc51d('0x13')](_0xc51d('0x21'),_0x559618);logger[_0xc51d('0xd')](_0xc51d('0x21'),_0x559618,JSON[_0xc51d('0xf')](_0x6961b2));_0x1da450(_0x6961b2);})[_0xc51d('0x15')](function(_0x47b444){logger['error'](_0xc51d('0x21'),_0x47b444['message'],_0x559618);_0xf6df5f(_0x173e31[_0xc51d('0x11')](0x1f4,_0x47b444[_0xc51d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 0bca970..5d3f439 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 _0x5075=['getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','/:id','show','/:id/fields','/:id/subjects','isAuthenticated'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x5075,0x73));var _0x5507=function(_0x924c29,_0x309120){_0x924c29=_0x924c29-0x0;var _0x24ddd6=_0x5075[_0x924c29];return _0x24ddd6;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var auth=require(_0x5507('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5507('0x7'));var controller=require(_0x5507('0x8'));router[_0x5507('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5507('0x9')](_0x5507('0xa'),auth['isAuthenticated'](),controller[_0x5507('0xb')]);router[_0x5507('0x9')](_0x5507('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x5507('0x9')](_0x5507('0xd'),auth[_0x5507('0xe')](),controller[_0x5507('0xf')]);router['get'](_0x5507('0x10'),auth[_0x5507('0xe')](),controller['getDescriptions']);router[_0x5507('0x9')](_0x5507('0x11'),auth['isAuthenticated'](),controller[_0x5507('0x12')]);router[_0x5507('0x13')]('/',auth[_0x5507('0xe')](),controller[_0x5507('0x14')]);router[_0x5507('0x13')](_0x5507('0x11'),auth['isAuthenticated'](),controller[_0x5507('0x15')]);router[_0x5507('0x16')](_0x5507('0xa'),auth[_0x5507('0xe')](),controller['update']);router[_0x5507('0x17')](_0x5507('0xa'),auth[_0x5507('0xe')](),controller[_0x5507('0x18')]);module[_0x5507('0x19')]=router; \ No newline at end of file +var _0x8ef6=['isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x756348,_0x38d7e2){var _0x505558=function(_0x2f8663){while(--_0x2f8663){_0x756348['push'](_0x756348['shift']());}};_0x505558(++_0x38d7e2);}(_0x8ef6,0xf2));var _0x68ef=function(_0x468df0,_0x3e472d){_0x468df0=_0x468df0-0x0;var _0x408328=_0x8ef6[_0x468df0];return _0x408328;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['get'](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xe')]);router[_0x68ef('0x9')](_0x68ef('0xf'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x9')](_0x68ef('0x11'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x9')]('/:id/tags',auth[_0x68ef('0xa')](),controller[_0x68ef('0x13')]);router[_0x68ef('0x14')]('/',auth[_0x68ef('0xa')](),controller[_0x68ef('0x15')]);router[_0x68ef('0x14')]('/:id/tags',auth[_0x68ef('0xa')](),controller[_0x68ef('0x16')]);router[_0x68ef('0x17')]('/:id',auth[_0x68ef('0xa')](),controller[_0x68ef('0x18')]);router[_0x68ef('0x19')]('/:id',auth[_0x68ef('0xa')](),controller[_0x68ef('0x1a')]);module[_0x68ef('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index c105ccb..7fa317e 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 _0x56b6=['STRING','sequelize'];(function(_0x4b2df3,_0x579fc3){var _0x15b41d=function(_0x49210f){while(--_0x49210f){_0x4b2df3['push'](_0x4b2df3['shift']());}};_0x15b41d(++_0x579fc3);}(_0x56b6,0x197));var _0x656b=function(_0x44c879,_0x1a3746){_0x44c879=_0x44c879-0x0;var _0x518df0=_0x56b6[_0x44c879];return _0x518df0;};'use strict';var Sequelize=require(_0x656b('0x0'));module['exports']={'name':{'type':Sequelize[_0x656b('0x1')]},'description':{'type':Sequelize[_0x656b('0x1')]}}; \ No newline at end of file +var _0x8fb6=['STRING','exports'];(function(_0x1288db,_0x211057){var _0x1df750=function(_0x2caccc){while(--_0x2caccc){_0x1288db['push'](_0x1288db['shift']());}};_0x1df750(++_0x211057);}(_0x8fb6,0x1b9));var _0x68fb=function(_0x280771,_0x4c944b){_0x280771=_0x280771-0x0;var _0x289982=_0x8fb6[_0x280771];return _0x289982;};'use strict';var Sequelize=require('sequelize');module[_0x68fb('0x0')]={'name':{'type':Sequelize[_0x68fb('0x1')]},'description':{'type':Sequelize[_0x68fb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 70e2bdd..9e3a5bb 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 _0xf6f1=['VIRTUAL','field','options','findAll','show','params','rawAttributes','includeAll','include','find','create','body','getFields','findOne','map','nolimit','getSubjects','FreshdeskField','order','getDescriptions','length','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','FreshdeskConfiguration','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type'];(function(_0x28c37d,_0x55566b){var _0x554a56=function(_0x52b2f2){while(--_0x52b2f2){_0x28c37d['push'](_0x28c37d['shift']());}};_0x554a56(++_0x55566b);}(_0xf6f1,0xd3));var _0x1f6f=function(_0x1cd22d,_0x2835c1){_0x1cd22d=_0x1cd22d-0x0;var _0x2924e9=_0xf6f1[_0x1cd22d];return _0x2924e9;};'use strict';var pdf=require(_0x1f6f('0x0'));var emlformat=require(_0x1f6f('0x1'));var rimraf=require(_0x1f6f('0x2'));var zipdir=require(_0x1f6f('0x3'));var jsonpatch=require(_0x1f6f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f6f('0x5'));var Mustache=require(_0x1f6f('0x6'));var util=require(_0x1f6f('0x7'));var path=require(_0x1f6f('0x8'));var sox=require(_0x1f6f('0x9'));var csv=require(_0x1f6f('0xa'));var ejs=require(_0x1f6f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f6f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1f6f('0xa'));var querystring=require(_0x1f6f('0xd'));var Papa=require(_0x1f6f('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x1f6f('0xf'));var Redis=require(_0x1f6f('0x10'));var qs=require(_0x1f6f('0x11'));var logger=require(_0x1f6f('0x12'))(_0x1f6f('0x13'));var utils=require(_0x1f6f('0x14'));var config=require(_0x1f6f('0x15'));var db=require(_0x1f6f('0x16'))['db'];var jayson=require(_0x1f6f('0x17'));var client=jayson[_0x1f6f('0x18')][_0x1f6f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x513572,_0x278cf2,_0x3a7ceb,_0x5534d8){return new BPromise(function(_0x4a9b0d,_0x4e0f6d){var _0x3a6ce7=_0x5534d8||client;return _0x3a6ce7[_0x1f6f('0x1a')](_0x513572,_0x3a7ceb)[_0x1f6f('0x1b')](function(_0x1df9ef){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x278cf2,_0x1f6f('0x1c'));logger['debug'](_0x1f6f('0x1d'),_0x278cf2,'request\x20sent',JSON[_0x1f6f('0x1e')](_0x1df9ef));if(_0x1df9ef[_0x1f6f('0x1f')]){if(_0x1df9ef['error'][_0x1f6f('0x20')]===0x1f4){logger[_0x1f6f('0x1f')](_0x1f6f('0x21'),_0x278cf2,_0x1df9ef['error']['message']);return _0x4e0f6d(_0x1df9ef[_0x1f6f('0x1f')][_0x1f6f('0x22')]);}logger['error'](_0x1f6f('0x21'),_0x278cf2,_0x1df9ef[_0x1f6f('0x1f')]['message']);return _0x4a9b0d(_0x1df9ef[_0x1f6f('0x1f')][_0x1f6f('0x22')]);}else{logger['info'](_0x1f6f('0x21'),_0x278cf2,'request\x20sent');_0x4a9b0d(_0x1df9ef[_0x1f6f('0x23')][_0x1f6f('0x22')]);}})[_0x1f6f('0x24')](function(_0x2ce7e8){logger[_0x1f6f('0x1f')](_0x1f6f('0x21'),_0x278cf2,_0x2ce7e8);_0x4e0f6d(_0x2ce7e8);});});}function respondWithStatusCode(_0x54da8d,_0x53052d){_0x53052d=_0x53052d||0xcc;return function(_0x3d112b){if(_0x3d112b){return _0x54da8d[_0x1f6f('0x25')](_0x53052d);}return _0x54da8d[_0x1f6f('0x26')](_0x53052d)[_0x1f6f('0x27')]();};}function respondWithResult(_0x5cd2ba,_0x4a8c68){_0x4a8c68=_0x4a8c68||0xc8;return function(_0x4cf4e2){if(_0x4cf4e2){return _0x5cd2ba[_0x1f6f('0x26')](_0x4a8c68)['json'](_0x4cf4e2);}};}function respondWithFilteredResult(_0x44f3e8,_0x3ec5e2){return function(_0x5301c5){if(_0x5301c5){var _0x41ad2c=_0x5301c5[_0x1f6f('0x28')],_0x5abe36=_0x3ec5e2[_0x1f6f('0x29')],_0x51df37=_0x3ec5e2['offset']+_0x3ec5e2[_0x1f6f('0x2a')],_0x562ab4;if(_0x51df37>=_0x41ad2c){_0x51df37=_0x41ad2c;_0x562ab4=0xc8;}else{_0x562ab4=0xce;}_0x44f3e8[_0x1f6f('0x26')](_0x562ab4);return _0x44f3e8[_0x1f6f('0x2b')](_0x1f6f('0x2c'),_0x5abe36+'-'+_0x51df37+'/'+_0x41ad2c)['json'](_0x5301c5);}return null;};}function patchUpdates(_0x190308){return function(_0x3239a0){try{jsonpatch[_0x1f6f('0x2d')](_0x3239a0,_0x190308,!![]);}catch(_0x3882c3){return BPromise[_0x1f6f('0x2e')](_0x3882c3);}return _0x3239a0[_0x1f6f('0x2f')]();};}function saveUpdates(_0x26c2e,_0x30e573){return function(_0x1ecc87){if(_0x1ecc87){return _0x1ecc87['update'](_0x26c2e)[_0x1f6f('0x1b')](function(_0x55c4d4){return _0x55c4d4;});}return null;};}function removeEntity(_0x44aa39,_0x18b39){return function(_0x5c280e){if(_0x5c280e){return _0x5c280e[_0x1f6f('0x30')]()[_0x1f6f('0x1b')](function(){_0x44aa39[_0x1f6f('0x26')](0xcc)[_0x1f6f('0x27')]();});}};}function handleEntityNotFound(_0x3afe08,_0x7e545c){return function(_0x55c7c3){if(!_0x55c7c3){_0x3afe08[_0x1f6f('0x25')](0x194);}return _0x55c7c3;};}function handleError(_0x48e236,_0x30dd03){_0x30dd03=_0x30dd03||0x1f4;return function(_0x54720b){logger[_0x1f6f('0x1f')](_0x54720b[_0x1f6f('0x31')]);if(_0x54720b[_0x1f6f('0x32')]){delete _0x54720b[_0x1f6f('0x32')];}_0x48e236[_0x1f6f('0x26')](_0x30dd03)[_0x1f6f('0x33')](_0x54720b);};}exports[_0x1f6f('0x34')]=function(_0x5e0cfc,_0x25cd41){var _0x22d68e={},_0x544625={},_0x7ee051={'count':0x0,'rows':[]};var _0x8b4cf8=db[_0x1f6f('0x35')]['rawAttributes'];_0x544625[_0x1f6f('0x36')]=_[_0x1f6f('0x37')](_0x8b4cf8);_0x544625[_0x1f6f('0x38')]=_[_0x1f6f('0x37')](_0x5e0cfc[_0x1f6f('0x38')]);_0x544625[_0x1f6f('0x39')]=_[_0x1f6f('0x3a')](_0x544625[_0x1f6f('0x36')],_0x544625['query']);_0x22d68e[_0x1f6f('0x3b')]=_[_0x1f6f('0x3a')](_0x544625[_0x1f6f('0x36')],qs['fields'](_0x5e0cfc[_0x1f6f('0x38')][_0x1f6f('0x3c')]));_0x22d68e[_0x1f6f('0x3b')]=_0x22d68e[_0x1f6f('0x3b')]['length']?_0x22d68e[_0x1f6f('0x3b')]:_0x544625[_0x1f6f('0x36')];if(!_0x5e0cfc['query'][_0x1f6f('0x3d')]('nolimit')){_0x22d68e[_0x1f6f('0x2a')]=qs[_0x1f6f('0x2a')](_0x5e0cfc[_0x1f6f('0x38')]['limit']);_0x22d68e[_0x1f6f('0x29')]=qs[_0x1f6f('0x29')](_0x5e0cfc[_0x1f6f('0x38')][_0x1f6f('0x29')]);}_0x22d68e['order']=qs[_0x1f6f('0x3e')](_0x5e0cfc[_0x1f6f('0x38')]['sort']);_0x22d68e[_0x1f6f('0x3f')]=qs[_0x1f6f('0x39')](_[_0x1f6f('0x40')](_0x5e0cfc[_0x1f6f('0x38')],_0x544625[_0x1f6f('0x39')]));if(_0x5e0cfc['query'][_0x1f6f('0x41')]){_0x22d68e[_0x1f6f('0x3f')]=_[_0x1f6f('0x42')](_0x22d68e[_0x1f6f('0x3f')],{'$or':_['map'](_0x8b4cf8,function(_0x4c8091){if(_0x4c8091[_0x1f6f('0x43')]['key']!==_0x1f6f('0x44')){var _0x392cbc={};_0x392cbc[_0x4c8091[_0x1f6f('0x45')]]={'$like':'%'+_0x5e0cfc[_0x1f6f('0x38')][_0x1f6f('0x41')]+'%'};return _0x392cbc;}})});}_0x22d68e=_[_0x1f6f('0x42')]({},_0x22d68e,_0x5e0cfc[_0x1f6f('0x46')]);var _0x4083a8={'where':_0x22d68e[_0x1f6f('0x3f')]};return db[_0x1f6f('0x35')][_0x1f6f('0x28')](_0x4083a8)[_0x1f6f('0x1b')](function(_0xbd7875){_0x7ee051['count']=_0xbd7875;if(_0x5e0cfc[_0x1f6f('0x38')]['includeAll']){_0x22d68e['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x1f6f('0x47')](_0x22d68e);})[_0x1f6f('0x1b')](function(_0x4bf4d1){_0x7ee051['rows']=_0x4bf4d1;return _0x7ee051;})[_0x1f6f('0x1b')](respondWithFilteredResult(_0x25cd41,_0x22d68e))['catch'](handleError(_0x25cd41,null));};exports[_0x1f6f('0x48')]=function(_0x563139,_0xb3572d){var _0x411baa={'raw':![],'where':{'id':_0x563139[_0x1f6f('0x49')]['id']}},_0x2225dc={};_0x2225dc[_0x1f6f('0x36')]=_[_0x1f6f('0x37')](db[_0x1f6f('0x35')][_0x1f6f('0x4a')]);_0x2225dc[_0x1f6f('0x38')]=_[_0x1f6f('0x37')](_0x563139[_0x1f6f('0x38')]);_0x2225dc[_0x1f6f('0x39')]=_['intersection'](_0x2225dc[_0x1f6f('0x36')],_0x2225dc[_0x1f6f('0x38')]);_0x411baa[_0x1f6f('0x3b')]=_[_0x1f6f('0x3a')](_0x2225dc[_0x1f6f('0x36')],qs[_0x1f6f('0x3c')](_0x563139[_0x1f6f('0x38')]['fields']));_0x411baa[_0x1f6f('0x3b')]=_0x411baa[_0x1f6f('0x3b')]['length']?_0x411baa[_0x1f6f('0x3b')]:_0x2225dc['model'];if(_0x563139[_0x1f6f('0x38')][_0x1f6f('0x4b')]){_0x411baa[_0x1f6f('0x4c')]=[{'all':!![]}];}_0x411baa=_[_0x1f6f('0x42')]({},_0x411baa,_0x563139[_0x1f6f('0x46')]);return db['FreshdeskConfiguration'][_0x1f6f('0x4d')](_0x411baa)[_0x1f6f('0x1b')](handleEntityNotFound(_0xb3572d,null))[_0x1f6f('0x1b')](respondWithResult(_0xb3572d,null))['catch'](handleError(_0xb3572d,null));};exports[_0x1f6f('0x4e')]=function(_0x15317b,_0x4e0fbc){return db[_0x1f6f('0x35')]['create'](_0x15317b[_0x1f6f('0x4f')],{})[_0x1f6f('0x1b')](respondWithResult(_0x4e0fbc,0xc9))[_0x1f6f('0x24')](handleError(_0x4e0fbc,null));};exports['update']=function(_0x28837a,_0x3264e7){if(_0x28837a[_0x1f6f('0x4f')]['id']){delete _0x28837a[_0x1f6f('0x4f')]['id'];}return db[_0x1f6f('0x35')]['find']({'where':{'id':_0x28837a[_0x1f6f('0x49')]['id']}})[_0x1f6f('0x1b')](handleEntityNotFound(_0x3264e7,null))['then'](saveUpdates(_0x28837a[_0x1f6f('0x4f')],null))['then'](respondWithResult(_0x3264e7,null))[_0x1f6f('0x24')](handleError(_0x3264e7,null));};exports[_0x1f6f('0x30')]=function(_0x433326,_0x1215bd){return db['FreshdeskConfiguration'][_0x1f6f('0x4d')]({'where':{'id':_0x433326[_0x1f6f('0x49')]['id']}})[_0x1f6f('0x1b')](handleEntityNotFound(_0x1215bd,null))[_0x1f6f('0x1b')](removeEntity(_0x1215bd,null))['catch'](handleError(_0x1215bd,null));};exports[_0x1f6f('0x50')]=function(_0x52f6ab,_0x1e2628,_0x41e6cd){var _0x3c4743={};var _0x28801d={};var _0xa67bf2;var _0x1c45e4;return db[_0x1f6f('0x35')][_0x1f6f('0x51')]({'where':{'id':_0x52f6ab[_0x1f6f('0x49')]['id']}})[_0x1f6f('0x1b')](handleEntityNotFound(_0x1e2628,null))[_0x1f6f('0x1b')](function(_0x3252b9){if(_0x3252b9){_0xa67bf2=_0x3252b9;_0x28801d[_0x1f6f('0x36')]=_[_0x1f6f('0x37')](db['FreshdeskField'][_0x1f6f('0x4a')]);_0x28801d[_0x1f6f('0x38')]=_[_0x1f6f('0x37')](_0x52f6ab['query']);_0x28801d[_0x1f6f('0x39')]=_[_0x1f6f('0x3a')](_0x28801d[_0x1f6f('0x36')],_0x28801d[_0x1f6f('0x38')]);_0x3c4743[_0x1f6f('0x3b')]=_['intersection'](_0x28801d['model'],qs[_0x1f6f('0x3c')](_0x52f6ab[_0x1f6f('0x38')][_0x1f6f('0x3c')]));_0x3c4743['attributes']=_0x3c4743['attributes']['length']?_0x3c4743['attributes']:_0x28801d[_0x1f6f('0x36')];_0x3c4743['order']=qs[_0x1f6f('0x3e')](_0x52f6ab[_0x1f6f('0x38')][_0x1f6f('0x3e')]);_0x3c4743[_0x1f6f('0x3f')]=qs[_0x1f6f('0x39')](_['pick'](_0x52f6ab['query'],_0x28801d[_0x1f6f('0x39')]));if(_0x52f6ab[_0x1f6f('0x38')]['filter']){_0x3c4743['where']=_[_0x1f6f('0x42')](_0x3c4743['where'],{'$or':_[_0x1f6f('0x52')](_0x3c4743['attributes'],function(_0x5a6161){var _0x3b274a={};_0x3b274a[_0x5a6161]={'$like':'%'+_0x52f6ab[_0x1f6f('0x38')][_0x1f6f('0x41')]+'%'};return _0x3b274a;})});}_0x3c4743=_[_0x1f6f('0x42')]({},_0x3c4743,_0x52f6ab[_0x1f6f('0x46')]);return _0xa67bf2['getFields'](_0x3c4743);}})[_0x1f6f('0x1b')](function(_0x277efd){if(_0x277efd){_0x1c45e4=_0x277efd['length'];if(!_0x52f6ab[_0x1f6f('0x38')][_0x1f6f('0x3d')](_0x1f6f('0x53'))){_0x3c4743[_0x1f6f('0x2a')]=qs['limit'](_0x52f6ab['query'][_0x1f6f('0x2a')]);_0x3c4743[_0x1f6f('0x29')]=qs[_0x1f6f('0x29')](_0x52f6ab[_0x1f6f('0x38')][_0x1f6f('0x29')]);}return _0xa67bf2['getFields'](_0x3c4743);}})[_0x1f6f('0x1b')](function(_0x576035){if(_0x576035){return _0x576035?{'count':_0x1c45e4,'rows':_0x576035}:null;}})[_0x1f6f('0x1b')](respondWithResult(_0x1e2628,null))[_0x1f6f('0x24')](handleError(_0x1e2628,null));};exports[_0x1f6f('0x54')]=function(_0x460d68,_0x4bac48,_0x1d57b){var _0x1427f1={};var _0x2b104d={};var _0x1f66c2;var _0x56cc7f;return db[_0x1f6f('0x35')]['findOne']({'where':{'id':_0x460d68[_0x1f6f('0x49')]['id']}})[_0x1f6f('0x1b')](handleEntityNotFound(_0x4bac48,null))[_0x1f6f('0x1b')](function(_0x50803f){if(_0x50803f){_0x1f66c2=_0x50803f;_0x2b104d[_0x1f6f('0x36')]=_['keys'](db[_0x1f6f('0x55')]['rawAttributes']);_0x2b104d[_0x1f6f('0x38')]=_[_0x1f6f('0x37')](_0x460d68[_0x1f6f('0x38')]);_0x2b104d['filters']=_['intersection'](_0x2b104d[_0x1f6f('0x36')],_0x2b104d[_0x1f6f('0x38')]);_0x1427f1['attributes']=_[_0x1f6f('0x3a')](_0x2b104d[_0x1f6f('0x36')],qs['fields'](_0x460d68['query']['fields']));_0x1427f1['attributes']=_0x1427f1[_0x1f6f('0x3b')]['length']?_0x1427f1[_0x1f6f('0x3b')]:_0x2b104d[_0x1f6f('0x36')];_0x1427f1[_0x1f6f('0x56')]=qs['sort'](_0x460d68[_0x1f6f('0x38')][_0x1f6f('0x3e')]);_0x1427f1[_0x1f6f('0x3f')]=qs['filters'](_[_0x1f6f('0x40')](_0x460d68[_0x1f6f('0x38')],_0x2b104d[_0x1f6f('0x39')]));if(_0x460d68[_0x1f6f('0x38')][_0x1f6f('0x41')]){_0x1427f1[_0x1f6f('0x3f')]=_['merge'](_0x1427f1['where'],{'$or':_[_0x1f6f('0x52')](_0x1427f1[_0x1f6f('0x3b')],function(_0x22bf92){var _0x3d5b3f={};_0x3d5b3f[_0x22bf92]={'$like':'%'+_0x460d68[_0x1f6f('0x38')][_0x1f6f('0x41')]+'%'};return _0x3d5b3f;})});}_0x1427f1=_['merge']({},_0x1427f1,_0x460d68[_0x1f6f('0x46')]);return _0x1f66c2[_0x1f6f('0x54')](_0x1427f1);}})['then'](function(_0x4d647c){if(_0x4d647c){_0x56cc7f=_0x4d647c['length'];if(!_0x460d68['query']['hasOwnProperty']('nolimit')){_0x1427f1[_0x1f6f('0x2a')]=qs['limit'](_0x460d68['query'][_0x1f6f('0x2a')]);_0x1427f1[_0x1f6f('0x29')]=qs[_0x1f6f('0x29')](_0x460d68[_0x1f6f('0x38')]['offset']);}return _0x1f66c2[_0x1f6f('0x54')](_0x1427f1);}})['then'](function(_0x276520){if(_0x276520){return _0x276520?{'count':_0x56cc7f,'rows':_0x276520}:null;}})['then'](respondWithResult(_0x4bac48,null))[_0x1f6f('0x24')](handleError(_0x4bac48,null));};exports[_0x1f6f('0x57')]=function(_0x331850,_0x3e8b52,_0x536afd){var _0x4e1300={};var _0x3c88e2={};var _0x3e33dd;var _0x2e8187;return db[_0x1f6f('0x35')][_0x1f6f('0x51')]({'where':{'id':_0x331850[_0x1f6f('0x49')]['id']}})[_0x1f6f('0x1b')](handleEntityNotFound(_0x3e8b52,null))[_0x1f6f('0x1b')](function(_0x84ea2b){if(_0x84ea2b){_0x3e33dd=_0x84ea2b;_0x3c88e2['model']=_[_0x1f6f('0x37')](db[_0x1f6f('0x55')]['rawAttributes']);_0x3c88e2[_0x1f6f('0x38')]=_[_0x1f6f('0x37')](_0x331850[_0x1f6f('0x38')]);_0x3c88e2['filters']=_['intersection'](_0x3c88e2['model'],_0x3c88e2['query']);_0x4e1300[_0x1f6f('0x3b')]=_[_0x1f6f('0x3a')](_0x3c88e2['model'],qs[_0x1f6f('0x3c')](_0x331850['query']['fields']));_0x4e1300[_0x1f6f('0x3b')]=_0x4e1300['attributes']['length']?_0x4e1300[_0x1f6f('0x3b')]:_0x3c88e2[_0x1f6f('0x36')];_0x4e1300['order']=qs[_0x1f6f('0x3e')](_0x331850[_0x1f6f('0x38')][_0x1f6f('0x3e')]);_0x4e1300[_0x1f6f('0x3f')]=qs[_0x1f6f('0x39')](_[_0x1f6f('0x40')](_0x331850[_0x1f6f('0x38')],_0x3c88e2['filters']));if(_0x331850['query'][_0x1f6f('0x41')]){_0x4e1300[_0x1f6f('0x3f')]=_[_0x1f6f('0x42')](_0x4e1300[_0x1f6f('0x3f')],{'$or':_[_0x1f6f('0x52')](_0x4e1300[_0x1f6f('0x3b')],function(_0x4989f1){var _0x38e154={};_0x38e154[_0x4989f1]={'$like':'%'+_0x331850[_0x1f6f('0x38')]['filter']+'%'};return _0x38e154;})});}_0x4e1300=_[_0x1f6f('0x42')]({},_0x4e1300,_0x331850['options']);return _0x3e33dd[_0x1f6f('0x57')](_0x4e1300);}})[_0x1f6f('0x1b')](function(_0x8ef45b){if(_0x8ef45b){_0x2e8187=_0x8ef45b[_0x1f6f('0x58')];if(!_0x331850[_0x1f6f('0x38')]['hasOwnProperty'](_0x1f6f('0x53'))){_0x4e1300['limit']=qs['limit'](_0x331850[_0x1f6f('0x38')][_0x1f6f('0x2a')]);_0x4e1300[_0x1f6f('0x29')]=qs[_0x1f6f('0x29')](_0x331850[_0x1f6f('0x38')][_0x1f6f('0x29')]);}return _0x3e33dd[_0x1f6f('0x57')](_0x4e1300);}})[_0x1f6f('0x1b')](function(_0x231e4a){if(_0x231e4a){return _0x231e4a?{'count':_0x2e8187,'rows':_0x231e4a}:null;}})[_0x1f6f('0x1b')](respondWithResult(_0x3e8b52,null))[_0x1f6f('0x24')](handleError(_0x3e8b52,null));};exports[_0x1f6f('0x59')]=function(_0xb4e49d,_0x558823,_0x3c0fd4){var _0x2fb851={};var _0xb8b5e={};var _0x59feb7;var _0x1bba2e;return db[_0x1f6f('0x35')][_0x1f6f('0x51')]({'where':{'id':_0xb4e49d[_0x1f6f('0x49')]['id']}})['then'](handleEntityNotFound(_0x558823,null))['then'](function(_0x324f2e){if(_0x324f2e){_0x59feb7=_0x324f2e;_0xb8b5e['model']=_['keys'](db[_0x1f6f('0x5a')][_0x1f6f('0x4a')]);_0xb8b5e[_0x1f6f('0x38')]=_[_0x1f6f('0x37')](_0xb4e49d[_0x1f6f('0x38')]);_0xb8b5e[_0x1f6f('0x39')]=_[_0x1f6f('0x3a')](_0xb8b5e[_0x1f6f('0x36')],_0xb8b5e[_0x1f6f('0x38')]);_0x2fb851[_0x1f6f('0x3b')]=_[_0x1f6f('0x3a')](_0xb8b5e[_0x1f6f('0x36')],qs[_0x1f6f('0x3c')](_0xb4e49d[_0x1f6f('0x38')][_0x1f6f('0x3c')]));_0x2fb851[_0x1f6f('0x3b')]=_0x2fb851['attributes'][_0x1f6f('0x58')]?_0x2fb851['attributes']:_0xb8b5e[_0x1f6f('0x36')];_0x2fb851[_0x1f6f('0x56')]=qs['sort'](_0xb4e49d[_0x1f6f('0x38')][_0x1f6f('0x3e')]);_0x2fb851[_0x1f6f('0x3f')]=qs['filters'](_[_0x1f6f('0x40')](_0xb4e49d['query'],_0xb8b5e[_0x1f6f('0x39')]));if(_0xb4e49d[_0x1f6f('0x38')]['filter']){_0x2fb851[_0x1f6f('0x3f')]=_[_0x1f6f('0x42')](_0x2fb851['where'],{'$or':_['map'](_0x2fb851[_0x1f6f('0x3b')],function(_0x19324d){var _0x9786f2={};_0x9786f2[_0x19324d]={'$like':'%'+_0xb4e49d[_0x1f6f('0x38')][_0x1f6f('0x41')]+'%'};return _0x9786f2;})});}_0x2fb851=_[_0x1f6f('0x42')]({},_0x2fb851,_0xb4e49d[_0x1f6f('0x46')]);return _0x59feb7['getTags'](_0x2fb851);}})[_0x1f6f('0x1b')](function(_0x10cd7e){if(_0x10cd7e){_0x1bba2e=_0x10cd7e[_0x1f6f('0x58')];if(!_0xb4e49d[_0x1f6f('0x38')][_0x1f6f('0x3d')]('nolimit')){_0x2fb851[_0x1f6f('0x2a')]=qs[_0x1f6f('0x2a')](_0xb4e49d[_0x1f6f('0x38')][_0x1f6f('0x2a')]);_0x2fb851[_0x1f6f('0x29')]=qs[_0x1f6f('0x29')](_0xb4e49d[_0x1f6f('0x38')][_0x1f6f('0x29')]);}return _0x59feb7[_0x1f6f('0x59')](_0x2fb851);}})['then'](function(_0x34840e){if(_0x34840e){return _0x34840e?{'count':_0x1bba2e,'rows':_0x34840e}:null;}})['then'](respondWithResult(_0x558823,null))['catch'](handleError(_0x558823,null));};exports[_0x1f6f('0x5b')]=function(_0x1f5246,_0xad3f6,_0x2974c6){if(_0x1f5246[_0x1f6f('0x4f')]['id']){delete _0x1f5246[_0x1f6f('0x4f')]['id'];}return db[_0x1f6f('0x35')][_0x1f6f('0x51')]({'where':{'id':_0x1f5246[_0x1f6f('0x49')]['id']}})['then'](handleEntityNotFound(_0xad3f6,null))[_0x1f6f('0x1b')](function(_0x3935df){if(_0x3935df){return _0x3935df[_0x1f6f('0x5b')](_0x1f5246[_0x1f6f('0x4f')][_0x1f6f('0x5c')]||[]);}return null;})[_0x1f6f('0x1b')](respondWithResult(_0xad3f6,null))[_0x1f6f('0x24')](handleError(_0xad3f6,null));}; \ No newline at end of file +var _0x2e53=['status','end','json','count','limit','Content-Range','apply','reject','update','then','name','index','FreshdeskConfiguration','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','offset','order','sort','pick','merge','type','key','VIRTUAL','field','filter','options','where','include','findAll','rows','params','includeAll','find','create','body','destroy','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','map','nolimit','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','lodash','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','client','request','info','debug','request\x20sent','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus'];(function(_0x27df4c,_0x2715f4){var _0x71f61f=function(_0x44e228){while(--_0x44e228){_0x27df4c['push'](_0x27df4c['shift']());}};_0x71f61f(++_0x2715f4);}(_0x2e53,0xda));var _0x32e5=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0x2e53[_0x28fbe3];return _0x45db6a;};'use strict';var pdf=require(_0x32e5('0x0'));var emlformat=require(_0x32e5('0x1'));var rimraf=require(_0x32e5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x32e5('0x3'));var moment=require('moment');var BPromise=require(_0x32e5('0x4'));var Mustache=require(_0x32e5('0x5'));var util=require(_0x32e5('0x6'));var path=require('path');var sox=require(_0x32e5('0x7'));var csv=require(_0x32e5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x32e5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32e5('0xa'));var toCsv=require(_0x32e5('0x8'));var querystring=require(_0x32e5('0xb'));var Papa=require('papaparse');var authService=require(_0x32e5('0xc'));var hardwareService=require(_0x32e5('0xd'));var Redis=require(_0x32e5('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x32e5('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x32e5('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x416905,_0x222a9f,_0x2444c5,_0x3f5920){return new BPromise(function(_0x23fc7d,_0x4b9763){var _0x41c044=_0x3f5920||client;return _0x41c044[_0x32e5('0x11')](_0x416905,_0x2444c5)['then'](function(_0x154aa2){logger[_0x32e5('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x222a9f,'request\x20sent');logger[_0x32e5('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x222a9f,_0x32e5('0x14'),JSON[_0x32e5('0x15')](_0x154aa2));if(_0x154aa2[_0x32e5('0x16')]){if(_0x154aa2[_0x32e5('0x16')][_0x32e5('0x17')]===0x1f4){logger[_0x32e5('0x16')](_0x32e5('0x18'),_0x222a9f,_0x154aa2['error'][_0x32e5('0x19')]);return _0x4b9763(_0x154aa2[_0x32e5('0x16')]['message']);}logger[_0x32e5('0x16')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x222a9f,_0x154aa2[_0x32e5('0x16')][_0x32e5('0x19')]);return _0x23fc7d(_0x154aa2[_0x32e5('0x16')]['message']);}else{logger['info'](_0x32e5('0x18'),_0x222a9f,_0x32e5('0x14'));_0x23fc7d(_0x154aa2['result'][_0x32e5('0x19')]);}})[_0x32e5('0x1a')](function(_0x4879da){logger[_0x32e5('0x16')](_0x32e5('0x18'),_0x222a9f,_0x4879da);_0x4b9763(_0x4879da);});});}function respondWithStatusCode(_0x27e7d3,_0x441f73){_0x441f73=_0x441f73||0xcc;return function(_0x3978b9){if(_0x3978b9){return _0x27e7d3[_0x32e5('0x1b')](_0x441f73);}return _0x27e7d3[_0x32e5('0x1c')](_0x441f73)[_0x32e5('0x1d')]();};}function respondWithResult(_0x145439,_0x3749b4){_0x3749b4=_0x3749b4||0xc8;return function(_0x339fdb){if(_0x339fdb){return _0x145439['status'](_0x3749b4)[_0x32e5('0x1e')](_0x339fdb);}};}function respondWithFilteredResult(_0x2eb243,_0x491dc2){return function(_0x4e95c7){if(_0x4e95c7){var _0x58b712=_0x4e95c7[_0x32e5('0x1f')],_0x100971=_0x491dc2['offset'],_0x39fbd0=_0x491dc2['offset']+_0x491dc2[_0x32e5('0x20')],_0xd20414;if(_0x39fbd0>=_0x58b712){_0x39fbd0=_0x58b712;_0xd20414=0xc8;}else{_0xd20414=0xce;}_0x2eb243['status'](_0xd20414);return _0x2eb243['set'](_0x32e5('0x21'),_0x100971+'-'+_0x39fbd0+'/'+_0x58b712)[_0x32e5('0x1e')](_0x4e95c7);}return null;};}function patchUpdates(_0x2429f1){return function(_0x507e42){try{jsonpatch[_0x32e5('0x22')](_0x507e42,_0x2429f1,!![]);}catch(_0x1818db){return BPromise[_0x32e5('0x23')](_0x1818db);}return _0x507e42['save']();};}function saveUpdates(_0x449864,_0x43ebb7){return function(_0x4b2cad){if(_0x4b2cad){return _0x4b2cad[_0x32e5('0x24')](_0x449864)[_0x32e5('0x25')](function(_0x204271){return _0x204271;});}return null;};}function removeEntity(_0x341d9a,_0x52cbaf){return function(_0x445e81){if(_0x445e81){return _0x445e81['destroy']()[_0x32e5('0x25')](function(){_0x341d9a['status'](0xcc)[_0x32e5('0x1d')]();});}};}function handleEntityNotFound(_0x172f8c,_0x141c96){return function(_0x34f1e6){if(!_0x34f1e6){_0x172f8c[_0x32e5('0x1b')](0x194);}return _0x34f1e6;};}function handleError(_0x2c4796,_0x227ee5){_0x227ee5=_0x227ee5||0x1f4;return function(_0x50c8d4){logger[_0x32e5('0x16')](_0x50c8d4['stack']);if(_0x50c8d4[_0x32e5('0x26')]){delete _0x50c8d4[_0x32e5('0x26')];}_0x2c4796['status'](_0x227ee5)['send'](_0x50c8d4);};}exports[_0x32e5('0x27')]=function(_0x539cb7,_0x27207b){var _0x536efb={},_0x540757={},_0x12597c={'count':0x0,'rows':[]};var _0x3e3d67=db[_0x32e5('0x28')][_0x32e5('0x29')];_0x540757[_0x32e5('0x2a')]=_['keys'](_0x3e3d67);_0x540757[_0x32e5('0x2b')]=_[_0x32e5('0x2c')](_0x539cb7['query']);_0x540757[_0x32e5('0x2d')]=_['intersection'](_0x540757[_0x32e5('0x2a')],_0x540757[_0x32e5('0x2b')]);_0x536efb['attributes']=_[_0x32e5('0x2e')](_0x540757[_0x32e5('0x2a')],qs[_0x32e5('0x2f')](_0x539cb7['query'][_0x32e5('0x2f')]));_0x536efb[_0x32e5('0x30')]=_0x536efb[_0x32e5('0x30')][_0x32e5('0x31')]?_0x536efb['attributes']:_0x540757[_0x32e5('0x2a')];if(!_0x539cb7[_0x32e5('0x2b')]['hasOwnProperty']('nolimit')){_0x536efb[_0x32e5('0x20')]=qs['limit'](_0x539cb7[_0x32e5('0x2b')][_0x32e5('0x20')]);_0x536efb[_0x32e5('0x32')]=qs['offset'](_0x539cb7[_0x32e5('0x2b')][_0x32e5('0x32')]);}_0x536efb[_0x32e5('0x33')]=qs[_0x32e5('0x34')](_0x539cb7[_0x32e5('0x2b')][_0x32e5('0x34')]);_0x536efb['where']=qs[_0x32e5('0x2d')](_[_0x32e5('0x35')](_0x539cb7[_0x32e5('0x2b')],_0x540757[_0x32e5('0x2d')]));if(_0x539cb7['query']['filter']){_0x536efb['where']=_[_0x32e5('0x36')](_0x536efb['where'],{'$or':_['map'](_0x3e3d67,function(_0xf7b1f3){if(_0xf7b1f3[_0x32e5('0x37')][_0x32e5('0x38')]!==_0x32e5('0x39')){var _0x3af55a={};_0x3af55a[_0xf7b1f3[_0x32e5('0x3a')]]={'$like':'%'+_0x539cb7['query'][_0x32e5('0x3b')]+'%'};return _0x3af55a;}})});}_0x536efb=_['merge']({},_0x536efb,_0x539cb7[_0x32e5('0x3c')]);var _0xc55d0f={'where':_0x536efb[_0x32e5('0x3d')]};return db[_0x32e5('0x28')][_0x32e5('0x1f')](_0xc55d0f)[_0x32e5('0x25')](function(_0x356a14){_0x12597c['count']=_0x356a14;if(_0x539cb7[_0x32e5('0x2b')]['includeAll']){_0x536efb[_0x32e5('0x3e')]=[{'all':!![]}];}return db[_0x32e5('0x28')][_0x32e5('0x3f')](_0x536efb);})[_0x32e5('0x25')](function(_0x72fae4){_0x12597c[_0x32e5('0x40')]=_0x72fae4;return _0x12597c;})['then'](respondWithFilteredResult(_0x27207b,_0x536efb))[_0x32e5('0x1a')](handleError(_0x27207b,null));};exports['show']=function(_0x27a02e,_0x11da9a){var _0x3d1bc5={'raw':![],'where':{'id':_0x27a02e[_0x32e5('0x41')]['id']}},_0x21c67d={};_0x21c67d['model']=_['keys'](db[_0x32e5('0x28')]['rawAttributes']);_0x21c67d['query']=_[_0x32e5('0x2c')](_0x27a02e[_0x32e5('0x2b')]);_0x21c67d[_0x32e5('0x2d')]=_[_0x32e5('0x2e')](_0x21c67d[_0x32e5('0x2a')],_0x21c67d[_0x32e5('0x2b')]);_0x3d1bc5[_0x32e5('0x30')]=_[_0x32e5('0x2e')](_0x21c67d[_0x32e5('0x2a')],qs[_0x32e5('0x2f')](_0x27a02e[_0x32e5('0x2b')][_0x32e5('0x2f')]));_0x3d1bc5[_0x32e5('0x30')]=_0x3d1bc5[_0x32e5('0x30')][_0x32e5('0x31')]?_0x3d1bc5[_0x32e5('0x30')]:_0x21c67d[_0x32e5('0x2a')];if(_0x27a02e[_0x32e5('0x2b')][_0x32e5('0x42')]){_0x3d1bc5[_0x32e5('0x3e')]=[{'all':!![]}];}_0x3d1bc5=_[_0x32e5('0x36')]({},_0x3d1bc5,_0x27a02e['options']);return db[_0x32e5('0x28')][_0x32e5('0x43')](_0x3d1bc5)['then'](handleEntityNotFound(_0x11da9a,null))[_0x32e5('0x25')](respondWithResult(_0x11da9a,null))[_0x32e5('0x1a')](handleError(_0x11da9a,null));};exports['create']=function(_0x32bc5c,_0x5c4ba4){return db['FreshdeskConfiguration'][_0x32e5('0x44')](_0x32bc5c['body'],{})['then'](respondWithResult(_0x5c4ba4,0xc9))[_0x32e5('0x1a')](handleError(_0x5c4ba4,null));};exports[_0x32e5('0x24')]=function(_0x419394,_0xff5eda){if(_0x419394[_0x32e5('0x45')]['id']){delete _0x419394[_0x32e5('0x45')]['id'];}return db[_0x32e5('0x28')]['find']({'where':{'id':_0x419394[_0x32e5('0x41')]['id']}})[_0x32e5('0x25')](handleEntityNotFound(_0xff5eda,null))[_0x32e5('0x25')](saveUpdates(_0x419394[_0x32e5('0x45')],null))[_0x32e5('0x25')](respondWithResult(_0xff5eda,null))[_0x32e5('0x1a')](handleError(_0xff5eda,null));};exports[_0x32e5('0x46')]=function(_0x260a99,_0x1bcb4e){return db[_0x32e5('0x28')][_0x32e5('0x43')]({'where':{'id':_0x260a99[_0x32e5('0x41')]['id']}})['then'](handleEntityNotFound(_0x1bcb4e,null))[_0x32e5('0x25')](removeEntity(_0x1bcb4e,null))['catch'](handleError(_0x1bcb4e,null));};exports[_0x32e5('0x47')]=function(_0x122480,_0x3019e5,_0x1370ce){var _0x53094b={};var _0x218803={};var _0x303c14;var _0x5b695d;return db[_0x32e5('0x28')][_0x32e5('0x48')]({'where':{'id':_0x122480[_0x32e5('0x41')]['id']}})[_0x32e5('0x25')](handleEntityNotFound(_0x3019e5,null))['then'](function(_0x661ec1){if(_0x661ec1){_0x303c14=_0x661ec1;_0x218803[_0x32e5('0x2a')]=_[_0x32e5('0x2c')](db[_0x32e5('0x49')][_0x32e5('0x29')]);_0x218803[_0x32e5('0x2b')]=_[_0x32e5('0x2c')](_0x122480['query']);_0x218803[_0x32e5('0x2d')]=_['intersection'](_0x218803[_0x32e5('0x2a')],_0x218803[_0x32e5('0x2b')]);_0x53094b['attributes']=_['intersection'](_0x218803[_0x32e5('0x2a')],qs[_0x32e5('0x2f')](_0x122480[_0x32e5('0x2b')][_0x32e5('0x2f')]));_0x53094b[_0x32e5('0x30')]=_0x53094b[_0x32e5('0x30')][_0x32e5('0x31')]?_0x53094b[_0x32e5('0x30')]:_0x218803[_0x32e5('0x2a')];_0x53094b[_0x32e5('0x33')]=qs[_0x32e5('0x34')](_0x122480['query'][_0x32e5('0x34')]);_0x53094b['where']=qs[_0x32e5('0x2d')](_['pick'](_0x122480[_0x32e5('0x2b')],_0x218803[_0x32e5('0x2d')]));if(_0x122480[_0x32e5('0x2b')][_0x32e5('0x3b')]){_0x53094b[_0x32e5('0x3d')]=_[_0x32e5('0x36')](_0x53094b[_0x32e5('0x3d')],{'$or':_['map'](_0x53094b[_0x32e5('0x30')],function(_0x4902b9){var _0x2c87b0={};_0x2c87b0[_0x4902b9]={'$like':'%'+_0x122480[_0x32e5('0x2b')]['filter']+'%'};return _0x2c87b0;})});}_0x53094b=_[_0x32e5('0x36')]({},_0x53094b,_0x122480[_0x32e5('0x3c')]);return _0x303c14['getFields'](_0x53094b);}})['then'](function(_0x15a463){if(_0x15a463){_0x5b695d=_0x15a463['length'];if(!_0x122480[_0x32e5('0x2b')][_0x32e5('0x4a')]('nolimit')){_0x53094b[_0x32e5('0x20')]=qs[_0x32e5('0x20')](_0x122480['query'][_0x32e5('0x20')]);_0x53094b['offset']=qs[_0x32e5('0x32')](_0x122480[_0x32e5('0x2b')]['offset']);}return _0x303c14['getFields'](_0x53094b);}})[_0x32e5('0x25')](function(_0x18bf30){if(_0x18bf30){return _0x18bf30?{'count':_0x5b695d,'rows':_0x18bf30}:null;}})[_0x32e5('0x25')](respondWithResult(_0x3019e5,null))[_0x32e5('0x1a')](handleError(_0x3019e5,null));};exports[_0x32e5('0x4b')]=function(_0x11f321,_0x24d9e4,_0x31f6c0){var _0x333495={};var _0x3c789d={};var _0x26594a;var _0x109690;return db[_0x32e5('0x28')][_0x32e5('0x48')]({'where':{'id':_0x11f321[_0x32e5('0x41')]['id']}})[_0x32e5('0x25')](handleEntityNotFound(_0x24d9e4,null))[_0x32e5('0x25')](function(_0x51815d){if(_0x51815d){_0x26594a=_0x51815d;_0x3c789d[_0x32e5('0x2a')]=_['keys'](db[_0x32e5('0x49')][_0x32e5('0x29')]);_0x3c789d[_0x32e5('0x2b')]=_['keys'](_0x11f321[_0x32e5('0x2b')]);_0x3c789d[_0x32e5('0x2d')]=_[_0x32e5('0x2e')](_0x3c789d[_0x32e5('0x2a')],_0x3c789d[_0x32e5('0x2b')]);_0x333495[_0x32e5('0x30')]=_['intersection'](_0x3c789d[_0x32e5('0x2a')],qs[_0x32e5('0x2f')](_0x11f321['query']['fields']));_0x333495[_0x32e5('0x30')]=_0x333495[_0x32e5('0x30')][_0x32e5('0x31')]?_0x333495[_0x32e5('0x30')]:_0x3c789d['model'];_0x333495[_0x32e5('0x33')]=qs[_0x32e5('0x34')](_0x11f321[_0x32e5('0x2b')][_0x32e5('0x34')]);_0x333495[_0x32e5('0x3d')]=qs['filters'](_[_0x32e5('0x35')](_0x11f321[_0x32e5('0x2b')],_0x3c789d[_0x32e5('0x2d')]));if(_0x11f321[_0x32e5('0x2b')][_0x32e5('0x3b')]){_0x333495[_0x32e5('0x3d')]=_[_0x32e5('0x36')](_0x333495[_0x32e5('0x3d')],{'$or':_[_0x32e5('0x4c')](_0x333495['attributes'],function(_0x440787){var _0x655f18={};_0x655f18[_0x440787]={'$like':'%'+_0x11f321[_0x32e5('0x2b')]['filter']+'%'};return _0x655f18;})});}_0x333495=_[_0x32e5('0x36')]({},_0x333495,_0x11f321[_0x32e5('0x3c')]);return _0x26594a[_0x32e5('0x4b')](_0x333495);}})[_0x32e5('0x25')](function(_0x4ffc08){if(_0x4ffc08){_0x109690=_0x4ffc08[_0x32e5('0x31')];if(!_0x11f321['query'][_0x32e5('0x4a')](_0x32e5('0x4d'))){_0x333495[_0x32e5('0x20')]=qs['limit'](_0x11f321['query'][_0x32e5('0x20')]);_0x333495['offset']=qs['offset'](_0x11f321[_0x32e5('0x2b')][_0x32e5('0x32')]);}return _0x26594a[_0x32e5('0x4b')](_0x333495);}})[_0x32e5('0x25')](function(_0x4e3435){if(_0x4e3435){return _0x4e3435?{'count':_0x109690,'rows':_0x4e3435}:null;}})[_0x32e5('0x25')](respondWithResult(_0x24d9e4,null))['catch'](handleError(_0x24d9e4,null));};exports[_0x32e5('0x4e')]=function(_0xf345c2,_0x4c1f7d,_0x192925){var _0x2482dd={};var _0x5486b8={};var _0x31543a;var _0x4aac56;return db[_0x32e5('0x28')][_0x32e5('0x48')]({'where':{'id':_0xf345c2[_0x32e5('0x41')]['id']}})[_0x32e5('0x25')](handleEntityNotFound(_0x4c1f7d,null))['then'](function(_0x2ef619){if(_0x2ef619){_0x31543a=_0x2ef619;_0x5486b8[_0x32e5('0x2a')]=_[_0x32e5('0x2c')](db[_0x32e5('0x49')][_0x32e5('0x29')]);_0x5486b8[_0x32e5('0x2b')]=_[_0x32e5('0x2c')](_0xf345c2['query']);_0x5486b8[_0x32e5('0x2d')]=_[_0x32e5('0x2e')](_0x5486b8[_0x32e5('0x2a')],_0x5486b8[_0x32e5('0x2b')]);_0x2482dd['attributes']=_['intersection'](_0x5486b8[_0x32e5('0x2a')],qs[_0x32e5('0x2f')](_0xf345c2[_0x32e5('0x2b')][_0x32e5('0x2f')]));_0x2482dd[_0x32e5('0x30')]=_0x2482dd[_0x32e5('0x30')]['length']?_0x2482dd[_0x32e5('0x30')]:_0x5486b8[_0x32e5('0x2a')];_0x2482dd['order']=qs[_0x32e5('0x34')](_0xf345c2[_0x32e5('0x2b')][_0x32e5('0x34')]);_0x2482dd[_0x32e5('0x3d')]=qs['filters'](_[_0x32e5('0x35')](_0xf345c2[_0x32e5('0x2b')],_0x5486b8[_0x32e5('0x2d')]));if(_0xf345c2[_0x32e5('0x2b')][_0x32e5('0x3b')]){_0x2482dd[_0x32e5('0x3d')]=_[_0x32e5('0x36')](_0x2482dd[_0x32e5('0x3d')],{'$or':_['map'](_0x2482dd['attributes'],function(_0x515888){var _0x24a094={};_0x24a094[_0x515888]={'$like':'%'+_0xf345c2[_0x32e5('0x2b')][_0x32e5('0x3b')]+'%'};return _0x24a094;})});}_0x2482dd=_[_0x32e5('0x36')]({},_0x2482dd,_0xf345c2['options']);return _0x31543a[_0x32e5('0x4e')](_0x2482dd);}})[_0x32e5('0x25')](function(_0x1dcf78){if(_0x1dcf78){_0x4aac56=_0x1dcf78[_0x32e5('0x31')];if(!_0xf345c2[_0x32e5('0x2b')][_0x32e5('0x4a')](_0x32e5('0x4d'))){_0x2482dd[_0x32e5('0x20')]=qs[_0x32e5('0x20')](_0xf345c2[_0x32e5('0x2b')][_0x32e5('0x20')]);_0x2482dd['offset']=qs['offset'](_0xf345c2[_0x32e5('0x2b')]['offset']);}return _0x31543a['getDescriptions'](_0x2482dd);}})[_0x32e5('0x25')](function(_0x5edfc5){if(_0x5edfc5){return _0x5edfc5?{'count':_0x4aac56,'rows':_0x5edfc5}:null;}})['then'](respondWithResult(_0x4c1f7d,null))['catch'](handleError(_0x4c1f7d,null));};exports[_0x32e5('0x4f')]=function(_0x328362,_0x809e6e,_0x2868d7){var _0x1e790f={};var _0x56a2c9={};var _0x411bcc;var _0x37481e;return db['FreshdeskConfiguration'][_0x32e5('0x48')]({'where':{'id':_0x328362[_0x32e5('0x41')]['id']}})[_0x32e5('0x25')](handleEntityNotFound(_0x809e6e,null))['then'](function(_0x400767){if(_0x400767){_0x411bcc=_0x400767;_0x56a2c9[_0x32e5('0x2a')]=_[_0x32e5('0x2c')](db['Tag'][_0x32e5('0x29')]);_0x56a2c9[_0x32e5('0x2b')]=_[_0x32e5('0x2c')](_0x328362['query']);_0x56a2c9[_0x32e5('0x2d')]=_[_0x32e5('0x2e')](_0x56a2c9[_0x32e5('0x2a')],_0x56a2c9[_0x32e5('0x2b')]);_0x1e790f[_0x32e5('0x30')]=_[_0x32e5('0x2e')](_0x56a2c9[_0x32e5('0x2a')],qs['fields'](_0x328362['query']['fields']));_0x1e790f['attributes']=_0x1e790f['attributes'][_0x32e5('0x31')]?_0x1e790f[_0x32e5('0x30')]:_0x56a2c9['model'];_0x1e790f[_0x32e5('0x33')]=qs[_0x32e5('0x34')](_0x328362[_0x32e5('0x2b')][_0x32e5('0x34')]);_0x1e790f[_0x32e5('0x3d')]=qs[_0x32e5('0x2d')](_[_0x32e5('0x35')](_0x328362[_0x32e5('0x2b')],_0x56a2c9[_0x32e5('0x2d')]));if(_0x328362[_0x32e5('0x2b')]['filter']){_0x1e790f['where']=_[_0x32e5('0x36')](_0x1e790f[_0x32e5('0x3d')],{'$or':_['map'](_0x1e790f['attributes'],function(_0x411c41){var _0x2a4990={};_0x2a4990[_0x411c41]={'$like':'%'+_0x328362['query'][_0x32e5('0x3b')]+'%'};return _0x2a4990;})});}_0x1e790f=_[_0x32e5('0x36')]({},_0x1e790f,_0x328362[_0x32e5('0x3c')]);return _0x411bcc[_0x32e5('0x4f')](_0x1e790f);}})['then'](function(_0x4c6308){if(_0x4c6308){_0x37481e=_0x4c6308[_0x32e5('0x31')];if(!_0x328362[_0x32e5('0x2b')]['hasOwnProperty'](_0x32e5('0x4d'))){_0x1e790f[_0x32e5('0x20')]=qs[_0x32e5('0x20')](_0x328362['query'][_0x32e5('0x20')]);_0x1e790f[_0x32e5('0x32')]=qs['offset'](_0x328362[_0x32e5('0x2b')]['offset']);}return _0x411bcc[_0x32e5('0x4f')](_0x1e790f);}})[_0x32e5('0x25')](function(_0x56d846){if(_0x56d846){return _0x56d846?{'count':_0x37481e,'rows':_0x56d846}:null;}})[_0x32e5('0x25')](respondWithResult(_0x809e6e,null))['catch'](handleError(_0x809e6e,null));};exports[_0x32e5('0x50')]=function(_0x5e2721,_0x260bdb,_0x3c9198){if(_0x5e2721['body']['id']){delete _0x5e2721[_0x32e5('0x45')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x5e2721['params']['id']}})[_0x32e5('0x25')](handleEntityNotFound(_0x260bdb,null))['then'](function(_0x205bfb){if(_0x205bfb){return _0x205bfb[_0x32e5('0x50')](_0x5e2721[_0x32e5('0x45')][_0x32e5('0x51')]||[]);}return null;})['then'](respondWithResult(_0x260bdb,null))['catch'](handleError(_0x260bdb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index ed34b35..2515dbb 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 _0x87cb=['lodash','util','../../config/logger','api','moment','bluebird','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x2af77d,_0x370de6){var _0x439fb9=function(_0x941919){while(--_0x941919){_0x2af77d['push'](_0x2af77d['shift']());}};_0x439fb9(++_0x370de6);}(_0x87cb,0xaa));var _0xb87c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x87cb[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xb87c('0x0'));var util=require(_0xb87c('0x1'));var logger=require(_0xb87c('0x2'))(_0xb87c('0x3'));var moment=require(_0xb87c('0x4'));var BPromise=require(_0xb87c('0x5'));var rp=require('request-promise');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xb87c('0x6')]=function(_0x33bfc1,_0x1c3be5){return _0x33bfc1[_0xb87c('0x7')](_0xb87c('0x8'),attributes,{'tableName':_0xb87c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e81=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3b58f0,_0x23a901){var _0x14e427=function(_0x4d4b5b){while(--_0x4d4b5b){_0x3b58f0['push'](_0x3b58f0['shift']());}};_0x14e427(++_0x23a901);}(_0x7e81,0xc5));var _0x17e8=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x7e81[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x17e8('0x0'));var util=require(_0x17e8('0x1'));var logger=require(_0x17e8('0x2'))(_0x17e8('0x3'));var moment=require(_0x17e8('0x4'));var BPromise=require(_0x17e8('0x5'));var rp=require(_0x17e8('0x6'));var attributes=require(_0x17e8('0x7'));module[_0x17e8('0x8')]=function(_0x364a73,_0x4a2d30){return _0x364a73[_0x17e8('0x9')](_0x17e8('0xa'),attributes,{'tableName':_0x17e8('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 89c52f6..19126ed 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 _0x5eff=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug'];(function(_0x34df4a,_0x209d10){var _0x145c69=function(_0xb9bcbd){while(--_0xb9bcbd){_0x34df4a['push'](_0x34df4a['shift']());}};_0x145c69(++_0x209d10);}(_0x5eff,0xc8));var _0xf5ef=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x5eff[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xf5ef('0x0'));var util=require(_0xf5ef('0x1'));var moment=require(_0xf5ef('0x2'));var BPromise=require(_0xf5ef('0x3'));var rs=require(_0xf5ef('0x4'));var fs=require('fs');var Redis=require(_0xf5ef('0x5'));var db=require(_0xf5ef('0x6'))['db'];var utils=require(_0xf5ef('0x7'));var logger=require(_0xf5ef('0x8'))(_0xf5ef('0x9'));var config=require(_0xf5ef('0xa'));var jayson=require(_0xf5ef('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39f0ad,_0x4b655a,_0x29de37){return new BPromise(function(_0x544036,_0x44aac0){return client[_0xf5ef('0xc')](_0x39f0ad,_0x29de37)[_0xf5ef('0xd')](function(_0x4a5662){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4b655a,_0xf5ef('0xe'));logger[_0xf5ef('0xf')](_0xf5ef('0x10'),_0x4b655a,_0xf5ef('0xe'),JSON[_0xf5ef('0x11')](_0x4a5662));if(_0x4a5662[_0xf5ef('0x12')]){if(_0x4a5662[_0xf5ef('0x12')][_0xf5ef('0x13')]===0x1f4){logger[_0xf5ef('0x12')](_0xf5ef('0x14'),_0x4b655a,_0x4a5662[_0xf5ef('0x12')][_0xf5ef('0x15')]);return _0x44aac0(_0x4a5662[_0xf5ef('0x12')][_0xf5ef('0x15')]);}logger[_0xf5ef('0x12')](_0xf5ef('0x14'),_0x4b655a,_0x4a5662['error'][_0xf5ef('0x15')]);return _0x544036(_0x4a5662[_0xf5ef('0x12')]['message']);}else{logger[_0xf5ef('0x16')](_0xf5ef('0x14'),_0x4b655a,_0xf5ef('0xe'));_0x544036(_0x4a5662['result'][_0xf5ef('0x15')]);}})[_0xf5ef('0x17')](function(_0x22b78f){logger[_0xf5ef('0x12')](_0xf5ef('0x14'),_0x4b655a,_0x22b78f);_0x44aac0(_0x22b78f);});});} \ No newline at end of file +var _0xade0=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x6d786a,_0x461651){var _0x50a9f3=function(_0x3cd238){while(--_0x3cd238){_0x6d786a['push'](_0x6d786a['shift']());}};_0x50a9f3(++_0x461651);}(_0xade0,0x1f4));var _0x0ade=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xade0[_0x209fcd];return _0x501d5e;};'use strict';var _=require(_0x0ade('0x0'));var util=require(_0x0ade('0x1'));var moment=require(_0x0ade('0x2'));var BPromise=require(_0x0ade('0x3'));var rs=require(_0x0ade('0x4'));var fs=require('fs');var Redis=require(_0x0ade('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0ade('0x6'))(_0x0ade('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ade('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d7078,_0x5084cc,_0x28df23){return new BPromise(function(_0x15bc42,_0x3e132a){return client['request'](_0x5d7078,_0x28df23)[_0x0ade('0x9')](function(_0x1bb8fb){logger[_0x0ade('0xa')](_0x0ade('0xb'),_0x5084cc,_0x0ade('0xc'));logger[_0x0ade('0xd')](_0x0ade('0xe'),_0x5084cc,'request\x20sent',JSON[_0x0ade('0xf')](_0x1bb8fb));if(_0x1bb8fb[_0x0ade('0x10')]){if(_0x1bb8fb['error']['code']===0x1f4){logger[_0x0ade('0x10')](_0x0ade('0xb'),_0x5084cc,_0x1bb8fb[_0x0ade('0x10')][_0x0ade('0x11')]);return _0x3e132a(_0x1bb8fb[_0x0ade('0x10')][_0x0ade('0x11')]);}logger[_0x0ade('0x10')](_0x0ade('0xb'),_0x5084cc,_0x1bb8fb[_0x0ade('0x10')]['message']);return _0x15bc42(_0x1bb8fb[_0x0ade('0x10')]['message']);}else{logger[_0x0ade('0xa')](_0x0ade('0xb'),_0x5084cc,_0x0ade('0xc'));_0x15bc42(_0x1bb8fb[_0x0ade('0x12')][_0x0ade('0x11')]);}})['catch'](function(_0x1833af){logger[_0x0ade('0x10')](_0x0ade('0xb'),_0x5084cc,_0x1833af);_0x3e132a(_0x1833af);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f2b8890..3ca4f57 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 _0x3d7f=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','create','put','update','delete','destroy'];(function(_0xd5246e,_0x90d9d2){var _0x57397d=function(_0x3268f3){while(--_0x3268f3){_0xd5246e['push'](_0xd5246e['shift']());}};_0x57397d(++_0x90d9d2);}(_0x3d7f,0x1a1));var _0xf3d7=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3d7f[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xf3d7('0x0'));var util=require('util');var path=require(_0xf3d7('0x1'));var timeout=require('connect-timeout');var express=require(_0xf3d7('0x2'));var router=express[_0xf3d7('0x3')]();var auth=require(_0xf3d7('0x4'));var interaction=require(_0xf3d7('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xf3d7('0x6')]('/',auth[_0xf3d7('0x7')](),controller['index']);router['get'](_0xf3d7('0x8'),auth[_0xf3d7('0x7')](),controller[_0xf3d7('0x9')]);router['post']('/',auth[_0xf3d7('0x7')](),controller[_0xf3d7('0xa')]);router[_0xf3d7('0xb')](_0xf3d7('0x8'),auth[_0xf3d7('0x7')](),controller[_0xf3d7('0xc')]);router[_0xf3d7('0xd')](_0xf3d7('0x8'),auth[_0xf3d7('0x7')](),controller[_0xf3d7('0xe')]);module[_0xf3d7('0xf')]=router; \ No newline at end of file +var _0xf77d=['isAuthenticated','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x26890b,_0x3df154){var _0x9becd0=function(_0x2f8be6){while(--_0x2f8be6){_0x26890b['push'](_0x26890b['shift']());}};_0x9becd0(++_0x3df154);}(_0xf77d,0x15c));var _0xdf77=function(_0x31dd7e,_0x72d5da){_0x31dd7e=_0x31dd7e-0x0;var _0x2a6bfd=_0xf77d[_0x31dd7e];return _0x2a6bfd;};'use strict';var multer=require(_0xdf77('0x0'));var util=require(_0xdf77('0x1'));var path=require(_0xdf77('0x2'));var timeout=require(_0xdf77('0x3'));var express=require(_0xdf77('0x4'));var router=express[_0xdf77('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf77('0x6'));var config=require(_0xdf77('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xdf77('0x8')]('/',auth[_0xdf77('0x9')](),controller['index']);router[_0xdf77('0x8')](_0xdf77('0xa'),auth['isAuthenticated'](),controller[_0xdf77('0xb')]);router[_0xdf77('0xc')]('/',auth[_0xdf77('0x9')](),controller[_0xdf77('0xd')]);router['put'](_0xdf77('0xa'),auth[_0xdf77('0x9')](),controller['update']);router[_0xdf77('0xe')](_0xdf77('0xa'),auth[_0xdf77('0x9')](),controller[_0xdf77('0xf')]);module[_0xdf77('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 8fed0d2..0a7f848 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 _0xb688=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','exports'];(function(_0x216fa0,_0x4da5d7){var _0x130d53=function(_0x2f2c53){while(--_0x2f2c53){_0x216fa0['push'](_0x216fa0['shift']());}};_0x130d53(++_0x4da5d7);}(_0xb688,0xcf));var _0x8b68=function(_0x1f7978,_0xc0dfe4){_0x1f7978=_0x1f7978-0x0;var _0x3212fb=_0xb688[_0x1f7978];return _0x3212fb;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'type':{'type':Sequelize[_0x8b68('0x1')](_0x8b68('0x2'),_0x8b68('0x3'),_0x8b68('0x4'),_0x8b68('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8b68('0x6')]},'key':{'type':Sequelize[_0x8b68('0x6')]},'keyType':{'type':Sequelize[_0x8b68('0x1')](_0x8b68('0x2'),'variable',_0x8b68('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8b68('0x6')]},'nameField':{'type':Sequelize[_0x8b68('0x6')]},'customField':{'type':Sequelize[_0x8b68('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b68('0x6')]}}; \ No newline at end of file +var _0x9c00=['sequelize','exports','variable','customVariable','string','STRING','ENUM','BOOLEAN'];(function(_0x472d1a,_0x32a816){var _0x2cad59=function(_0x2297ef){while(--_0x2297ef){_0x472d1a['push'](_0x472d1a['shift']());}};_0x2cad59(++_0x32a816);}(_0x9c00,0x1a0));var _0x09c0=function(_0x3f4bc1,_0x15ace5){_0x3f4bc1=_0x3f4bc1-0x0;var _0x46fcf6=_0x9c00[_0x3f4bc1];return _0x46fcf6;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x09c0('0x2'),_0x09c0('0x3'),'keyValue'),'defaultValue':_0x09c0('0x4')},'content':{'type':Sequelize[_0x09c0('0x5')]},'key':{'type':Sequelize[_0x09c0('0x5')]},'keyType':{'type':Sequelize[_0x09c0('0x6')](_0x09c0('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x09c0('0x5')]},'idField':{'type':Sequelize[_0x09c0('0x5')]},'nameField':{'type':Sequelize[_0x09c0('0x5')]},'customField':{'type':Sequelize[_0x09c0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x09c0('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index ba0f155..8f0b7a2 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 _0x2c4a=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','FreshdeskField','rawAttributes','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','type','key','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','zip-dir'];(function(_0x39879a,_0x528479){var _0x2d7096=function(_0x3c1f3c){while(--_0x3c1f3c){_0x39879a['push'](_0x39879a['shift']());}};_0x2d7096(++_0x528479);}(_0x2c4a,0x8b));var _0xa2c4=function(_0xfc368c,_0x54f5d5){_0xfc368c=_0xfc368c-0x0;var _0x20c808=_0x2c4a[_0xfc368c];return _0x20c808;};'use strict';var pdf=require(_0xa2c4('0x0'));var emlformat=require(_0xa2c4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa2c4('0x2'));var jsonpatch=require(_0xa2c4('0x3'));var rp=require(_0xa2c4('0x4'));var moment=require(_0xa2c4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa2c4('0x6'));var util=require(_0xa2c4('0x7'));var path=require(_0xa2c4('0x8'));var sox=require(_0xa2c4('0x9'));var csv=require(_0xa2c4('0xa'));var ejs=require(_0xa2c4('0xb'));var fs=require('fs');var _=require(_0xa2c4('0xc'));var squel=require(_0xa2c4('0xd'));var crypto=require(_0xa2c4('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa2c4('0xf'));var Papa=require('papaparse');var authService=require(_0xa2c4('0x10'));var hardwareService=require(_0xa2c4('0x11'));var Redis=require(_0xa2c4('0x12'));var qs=require(_0xa2c4('0x13'));var logger=require('../../config/logger')(_0xa2c4('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa2c4('0x15'))['db'];function respondWithStatusCode(_0x2efb17,_0x5e02ae){_0x5e02ae=_0x5e02ae||0xcc;return function(_0x506b41){if(_0x506b41){return _0x2efb17[_0xa2c4('0x16')](_0x5e02ae);}return _0x2efb17[_0xa2c4('0x17')](_0x5e02ae)[_0xa2c4('0x18')]();};}function respondWithResult(_0xe3d44b,_0x12faea){_0x12faea=_0x12faea||0xc8;return function(_0x312577){if(_0x312577){return _0xe3d44b[_0xa2c4('0x17')](_0x12faea)[_0xa2c4('0x19')](_0x312577);}};}function respondWithFilteredResult(_0x20086b,_0x56b4c0){return function(_0x5ed030){if(_0x5ed030){var _0x183741=_0x5ed030[_0xa2c4('0x1a')],_0x5929c5=_0x56b4c0[_0xa2c4('0x1b')],_0x1b5349=_0x56b4c0[_0xa2c4('0x1b')]+_0x56b4c0[_0xa2c4('0x1c')],_0x4037e2;if(_0x1b5349>=_0x183741){_0x1b5349=_0x183741;_0x4037e2=0xc8;}else{_0x4037e2=0xce;}_0x20086b[_0xa2c4('0x17')](_0x4037e2);return _0x20086b[_0xa2c4('0x1d')](_0xa2c4('0x1e'),_0x5929c5+'-'+_0x1b5349+'/'+_0x183741)[_0xa2c4('0x19')](_0x5ed030);}return null;};}function patchUpdates(_0x4e1c85){return function(_0x54f442){try{jsonpatch['apply'](_0x54f442,_0x4e1c85,!![]);}catch(_0x5bc22f){return BPromise[_0xa2c4('0x1f')](_0x5bc22f);}return _0x54f442[_0xa2c4('0x20')]();};}function saveUpdates(_0x4ea164,_0x166b9d){return function(_0x42c7d2){if(_0x42c7d2){return _0x42c7d2[_0xa2c4('0x21')](_0x4ea164)[_0xa2c4('0x22')](function(_0x12ba7e){return _0x12ba7e;});}return null;};}function removeEntity(_0x4c65bc,_0x1c911c){return function(_0x2e8815){if(_0x2e8815){return _0x2e8815['destroy']()[_0xa2c4('0x22')](function(){_0x4c65bc[_0xa2c4('0x17')](0xcc)[_0xa2c4('0x18')]();});}};}function handleEntityNotFound(_0x1360b1,_0x2a30bd){return function(_0x3cfaa1){if(!_0x3cfaa1){_0x1360b1['sendStatus'](0x194);}return _0x3cfaa1;};}function handleError(_0x1e6a1d,_0x3d48a8){_0x3d48a8=_0x3d48a8||0x1f4;return function(_0x4f72a4){logger[_0xa2c4('0x23')](_0x4f72a4[_0xa2c4('0x24')]);if(_0x4f72a4[_0xa2c4('0x25')]){delete _0x4f72a4[_0xa2c4('0x25')];}_0x1e6a1d['status'](_0x3d48a8)[_0xa2c4('0x26')](_0x4f72a4);};}exports[_0xa2c4('0x27')]=function(_0x1737cf,_0x2b95eb){var _0x16da8f={},_0x251dbc={},_0x3d33d5={'count':0x0,'rows':[]};var _0x57e523=db[_0xa2c4('0x28')][_0xa2c4('0x29')];_0x251dbc['model']=_[_0xa2c4('0x2a')](_0x57e523);_0x251dbc[_0xa2c4('0x2b')]=_[_0xa2c4('0x2a')](_0x1737cf[_0xa2c4('0x2b')]);_0x251dbc['filters']=_[_0xa2c4('0x2c')](_0x251dbc['model'],_0x251dbc[_0xa2c4('0x2b')]);_0x16da8f[_0xa2c4('0x2d')]=_[_0xa2c4('0x2c')](_0x251dbc[_0xa2c4('0x2e')],qs[_0xa2c4('0x2f')](_0x1737cf['query']['fields']));_0x16da8f[_0xa2c4('0x2d')]=_0x16da8f[_0xa2c4('0x2d')][_0xa2c4('0x30')]?_0x16da8f[_0xa2c4('0x2d')]:_0x251dbc[_0xa2c4('0x2e')];if(!_0x1737cf['query'][_0xa2c4('0x31')](_0xa2c4('0x32'))){_0x16da8f['limit']=qs[_0xa2c4('0x1c')](_0x1737cf[_0xa2c4('0x2b')][_0xa2c4('0x1c')]);_0x16da8f[_0xa2c4('0x1b')]=qs[_0xa2c4('0x1b')](_0x1737cf[_0xa2c4('0x2b')][_0xa2c4('0x1b')]);}_0x16da8f[_0xa2c4('0x33')]=qs[_0xa2c4('0x34')](_0x1737cf[_0xa2c4('0x2b')]['sort']);_0x16da8f[_0xa2c4('0x35')]=qs[_0xa2c4('0x36')](_['pick'](_0x1737cf['query'],_0x251dbc['filters']));if(_0x1737cf[_0xa2c4('0x2b')][_0xa2c4('0x37')]){_0x16da8f[_0xa2c4('0x35')]=_[_0xa2c4('0x38')](_0x16da8f['where'],{'$or':_[_0xa2c4('0x39')](_0x57e523,function(_0x27bbc3){if(_0x27bbc3[_0xa2c4('0x3a')][_0xa2c4('0x3b')]!=='VIRTUAL'){var _0x5dbdec={};_0x5dbdec[_0x27bbc3['field']]={'$like':'%'+_0x1737cf[_0xa2c4('0x2b')][_0xa2c4('0x37')]+'%'};return _0x5dbdec;}})});}_0x16da8f=_['merge']({},_0x16da8f,_0x1737cf[_0xa2c4('0x3c')]);var _0xa921af={'where':_0x16da8f[_0xa2c4('0x35')]};return db[_0xa2c4('0x28')][_0xa2c4('0x1a')](_0xa921af)['then'](function(_0x3618c7){_0x3d33d5[_0xa2c4('0x1a')]=_0x3618c7;if(_0x1737cf[_0xa2c4('0x2b')][_0xa2c4('0x3d')]){_0x16da8f[_0xa2c4('0x3e')]=[{'all':!![]}];}return db[_0xa2c4('0x28')][_0xa2c4('0x3f')](_0x16da8f);})[_0xa2c4('0x22')](function(_0x441f9b){_0x3d33d5[_0xa2c4('0x40')]=_0x441f9b;return _0x3d33d5;})[_0xa2c4('0x22')](respondWithFilteredResult(_0x2b95eb,_0x16da8f))[_0xa2c4('0x41')](handleError(_0x2b95eb,null));};exports[_0xa2c4('0x42')]=function(_0x352398,_0x38f824){var _0x2cf8da={'raw':!![],'where':{'id':_0x352398[_0xa2c4('0x43')]['id']}},_0x1d18da={};_0x1d18da['model']=_[_0xa2c4('0x2a')](db[_0xa2c4('0x28')][_0xa2c4('0x29')]);_0x1d18da['query']=_['keys'](_0x352398['query']);_0x1d18da[_0xa2c4('0x36')]=_[_0xa2c4('0x2c')](_0x1d18da[_0xa2c4('0x2e')],_0x1d18da['query']);_0x2cf8da[_0xa2c4('0x2d')]=_['intersection'](_0x1d18da['model'],qs[_0xa2c4('0x2f')](_0x352398[_0xa2c4('0x2b')][_0xa2c4('0x2f')]));_0x2cf8da[_0xa2c4('0x2d')]=_0x2cf8da['attributes'][_0xa2c4('0x30')]?_0x2cf8da['attributes']:_0x1d18da[_0xa2c4('0x2e')];if(_0x352398['query'][_0xa2c4('0x3d')]){_0x2cf8da[_0xa2c4('0x3e')]=[{'all':!![]}];}_0x2cf8da=_[_0xa2c4('0x38')]({},_0x2cf8da,_0x352398[_0xa2c4('0x3c')]);return db[_0xa2c4('0x28')]['find'](_0x2cf8da)[_0xa2c4('0x22')](handleEntityNotFound(_0x38f824,null))[_0xa2c4('0x22')](respondWithResult(_0x38f824,null))['catch'](handleError(_0x38f824,null));};exports[_0xa2c4('0x44')]=function(_0x4d3a0b,_0x10fa3){return db[_0xa2c4('0x28')]['create'](_0x4d3a0b['body'],{})[_0xa2c4('0x22')](respondWithResult(_0x10fa3,0xc9))['catch'](handleError(_0x10fa3,null));};exports[_0xa2c4('0x21')]=function(_0x2d443b,_0x2020f6){if(_0x2d443b['body']['id']){delete _0x2d443b[_0xa2c4('0x45')]['id'];}return db[_0xa2c4('0x28')][_0xa2c4('0x46')]({'where':{'id':_0x2d443b[_0xa2c4('0x43')]['id']}})[_0xa2c4('0x22')](handleEntityNotFound(_0x2020f6,null))[_0xa2c4('0x22')](saveUpdates(_0x2d443b[_0xa2c4('0x45')],null))[_0xa2c4('0x22')](respondWithResult(_0x2020f6,null))['catch'](handleError(_0x2020f6,null));};exports['destroy']=function(_0x46674d,_0x1003f2){return db[_0xa2c4('0x28')][_0xa2c4('0x46')]({'where':{'id':_0x46674d[_0xa2c4('0x43')]['id']}})[_0xa2c4('0x22')](handleEntityNotFound(_0x1003f2,null))[_0xa2c4('0x22')](removeEntity(_0x1003f2,null))[_0xa2c4('0x41')](handleError(_0x1003f2,null));}; \ No newline at end of file +var _0xb4c1=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','FreshdeskField','rawAttributes','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs'];(function(_0xbf3f74,_0x1ae4bf){var _0xd26ead=function(_0x558853){while(--_0x558853){_0xbf3f74['push'](_0xbf3f74['shift']());}};_0xd26ead(++_0x1ae4bf);}(_0xb4c1,0x18d));var _0x1b4c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb4c1[_0x199572];return _0x13cfa3;};'use strict';var pdf=require(_0x1b4c('0x0'));var emlformat=require(_0x1b4c('0x1'));var rimraf=require(_0x1b4c('0x2'));var zipdir=require(_0x1b4c('0x3'));var jsonpatch=require(_0x1b4c('0x4'));var rp=require(_0x1b4c('0x5'));var moment=require(_0x1b4c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1b4c('0x7'));var util=require(_0x1b4c('0x8'));var path=require(_0x1b4c('0x9'));var sox=require('sox');var csv=require(_0x1b4c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b4c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1b4c('0xa'));var querystring=require(_0x1b4c('0xc'));var Papa=require('papaparse');var authService=require(_0x1b4c('0xd'));var hardwareService=require(_0x1b4c('0xe'));var Redis=require(_0x1b4c('0xf'));var qs=require(_0x1b4c('0x10'));var logger=require('../../config/logger')(_0x1b4c('0x11'));var utils=require(_0x1b4c('0x12'));var config=require(_0x1b4c('0x13'));var db=require(_0x1b4c('0x14'))['db'];function respondWithStatusCode(_0x7e5208,_0x144662){_0x144662=_0x144662||0xcc;return function(_0x50dd88){if(_0x50dd88){return _0x7e5208[_0x1b4c('0x15')](_0x144662);}return _0x7e5208[_0x1b4c('0x16')](_0x144662)[_0x1b4c('0x17')]();};}function respondWithResult(_0xbcb19b,_0x12677e){_0x12677e=_0x12677e||0xc8;return function(_0x1de5aa){if(_0x1de5aa){return _0xbcb19b[_0x1b4c('0x16')](_0x12677e)[_0x1b4c('0x18')](_0x1de5aa);}};}function respondWithFilteredResult(_0x17940b,_0x260818){return function(_0x51c0fe){if(_0x51c0fe){var _0x454977=_0x51c0fe[_0x1b4c('0x19')],_0x57c795=_0x260818[_0x1b4c('0x1a')],_0x3fb9ef=_0x260818[_0x1b4c('0x1a')]+_0x260818[_0x1b4c('0x1b')],_0x36cbdf;if(_0x3fb9ef>=_0x454977){_0x3fb9ef=_0x454977;_0x36cbdf=0xc8;}else{_0x36cbdf=0xce;}_0x17940b[_0x1b4c('0x16')](_0x36cbdf);return _0x17940b[_0x1b4c('0x1c')](_0x1b4c('0x1d'),_0x57c795+'-'+_0x3fb9ef+'/'+_0x454977)[_0x1b4c('0x18')](_0x51c0fe);}return null;};}function patchUpdates(_0x4f45bd){return function(_0x40d010){try{jsonpatch[_0x1b4c('0x1e')](_0x40d010,_0x4f45bd,!![]);}catch(_0x59c02c){return BPromise['reject'](_0x59c02c);}return _0x40d010[_0x1b4c('0x1f')]();};}function saveUpdates(_0x3fb509,_0xcc08fe){return function(_0x518d78){if(_0x518d78){return _0x518d78['update'](_0x3fb509)[_0x1b4c('0x20')](function(_0x11bcca){return _0x11bcca;});}return null;};}function removeEntity(_0x50a8f4,_0x57ca8f){return function(_0x2a4e42){if(_0x2a4e42){return _0x2a4e42[_0x1b4c('0x21')]()[_0x1b4c('0x20')](function(){_0x50a8f4[_0x1b4c('0x16')](0xcc)[_0x1b4c('0x17')]();});}};}function handleEntityNotFound(_0x253096,_0x1d456e){return function(_0x155f0b){if(!_0x155f0b){_0x253096['sendStatus'](0x194);}return _0x155f0b;};}function handleError(_0x1833e2,_0x4623ed){_0x4623ed=_0x4623ed||0x1f4;return function(_0x14ab1b){logger[_0x1b4c('0x22')](_0x14ab1b[_0x1b4c('0x23')]);if(_0x14ab1b[_0x1b4c('0x24')]){delete _0x14ab1b['name'];}_0x1833e2['status'](_0x4623ed)[_0x1b4c('0x25')](_0x14ab1b);};}exports[_0x1b4c('0x26')]=function(_0x28fc5f,_0x5eb4d6){var _0x3c737d={},_0xbfccf4={},_0x1227f8={'count':0x0,'rows':[]};var _0x355fc0=db[_0x1b4c('0x27')][_0x1b4c('0x28')];_0xbfccf4[_0x1b4c('0x29')]=_[_0x1b4c('0x2a')](_0x355fc0);_0xbfccf4[_0x1b4c('0x2b')]=_['keys'](_0x28fc5f[_0x1b4c('0x2b')]);_0xbfccf4['filters']=_['intersection'](_0xbfccf4[_0x1b4c('0x29')],_0xbfccf4['query']);_0x3c737d[_0x1b4c('0x2c')]=_[_0x1b4c('0x2d')](_0xbfccf4[_0x1b4c('0x29')],qs[_0x1b4c('0x2e')](_0x28fc5f[_0x1b4c('0x2b')][_0x1b4c('0x2e')]));_0x3c737d['attributes']=_0x3c737d['attributes'][_0x1b4c('0x2f')]?_0x3c737d[_0x1b4c('0x2c')]:_0xbfccf4[_0x1b4c('0x29')];if(!_0x28fc5f[_0x1b4c('0x2b')][_0x1b4c('0x30')]('nolimit')){_0x3c737d[_0x1b4c('0x1b')]=qs['limit'](_0x28fc5f[_0x1b4c('0x2b')]['limit']);_0x3c737d[_0x1b4c('0x1a')]=qs[_0x1b4c('0x1a')](_0x28fc5f[_0x1b4c('0x2b')][_0x1b4c('0x1a')]);}_0x3c737d[_0x1b4c('0x31')]=qs[_0x1b4c('0x32')](_0x28fc5f['query'][_0x1b4c('0x32')]);_0x3c737d[_0x1b4c('0x33')]=qs[_0x1b4c('0x34')](_['pick'](_0x28fc5f[_0x1b4c('0x2b')],_0xbfccf4[_0x1b4c('0x34')]));if(_0x28fc5f[_0x1b4c('0x2b')][_0x1b4c('0x35')]){_0x3c737d[_0x1b4c('0x33')]=_['merge'](_0x3c737d[_0x1b4c('0x33')],{'$or':_[_0x1b4c('0x36')](_0x355fc0,function(_0x40cd63){if(_0x40cd63[_0x1b4c('0x37')]['key']!==_0x1b4c('0x38')){var _0x2baa7c={};_0x2baa7c[_0x40cd63['field']]={'$like':'%'+_0x28fc5f[_0x1b4c('0x2b')][_0x1b4c('0x35')]+'%'};return _0x2baa7c;}})});}_0x3c737d=_[_0x1b4c('0x39')]({},_0x3c737d,_0x28fc5f[_0x1b4c('0x3a')]);var _0x35605b={'where':_0x3c737d[_0x1b4c('0x33')]};return db['FreshdeskField']['count'](_0x35605b)[_0x1b4c('0x20')](function(_0x4cf02b){_0x1227f8[_0x1b4c('0x19')]=_0x4cf02b;if(_0x28fc5f[_0x1b4c('0x2b')][_0x1b4c('0x3b')]){_0x3c737d[_0x1b4c('0x3c')]=[{'all':!![]}];}return db['FreshdeskField'][_0x1b4c('0x3d')](_0x3c737d);})['then'](function(_0x1b9144){_0x1227f8[_0x1b4c('0x3e')]=_0x1b9144;return _0x1227f8;})[_0x1b4c('0x20')](respondWithFilteredResult(_0x5eb4d6,_0x3c737d))[_0x1b4c('0x3f')](handleError(_0x5eb4d6,null));};exports['show']=function(_0xd24bd0,_0x57299c){var _0x3f30c0={'raw':!![],'where':{'id':_0xd24bd0[_0x1b4c('0x40')]['id']}},_0x28446a={};_0x28446a['model']=_['keys'](db[_0x1b4c('0x27')][_0x1b4c('0x28')]);_0x28446a[_0x1b4c('0x2b')]=_[_0x1b4c('0x2a')](_0xd24bd0['query']);_0x28446a[_0x1b4c('0x34')]=_[_0x1b4c('0x2d')](_0x28446a['model'],_0x28446a[_0x1b4c('0x2b')]);_0x3f30c0['attributes']=_['intersection'](_0x28446a[_0x1b4c('0x29')],qs[_0x1b4c('0x2e')](_0xd24bd0['query'][_0x1b4c('0x2e')]));_0x3f30c0['attributes']=_0x3f30c0[_0x1b4c('0x2c')][_0x1b4c('0x2f')]?_0x3f30c0[_0x1b4c('0x2c')]:_0x28446a['model'];if(_0xd24bd0[_0x1b4c('0x2b')]['includeAll']){_0x3f30c0[_0x1b4c('0x3c')]=[{'all':!![]}];}_0x3f30c0=_[_0x1b4c('0x39')]({},_0x3f30c0,_0xd24bd0['options']);return db[_0x1b4c('0x27')][_0x1b4c('0x41')](_0x3f30c0)[_0x1b4c('0x20')](handleEntityNotFound(_0x57299c,null))[_0x1b4c('0x20')](respondWithResult(_0x57299c,null))[_0x1b4c('0x3f')](handleError(_0x57299c,null));};exports[_0x1b4c('0x42')]=function(_0x2e38af,_0x27ad92){return db[_0x1b4c('0x27')][_0x1b4c('0x42')](_0x2e38af['body'],{})[_0x1b4c('0x20')](respondWithResult(_0x27ad92,0xc9))[_0x1b4c('0x3f')](handleError(_0x27ad92,null));};exports[_0x1b4c('0x43')]=function(_0x2cd7ad,_0x2a9ad8){if(_0x2cd7ad[_0x1b4c('0x44')]['id']){delete _0x2cd7ad[_0x1b4c('0x44')]['id'];}return db[_0x1b4c('0x27')]['find']({'where':{'id':_0x2cd7ad['params']['id']}})[_0x1b4c('0x20')](handleEntityNotFound(_0x2a9ad8,null))[_0x1b4c('0x20')](saveUpdates(_0x2cd7ad[_0x1b4c('0x44')],null))['then'](respondWithResult(_0x2a9ad8,null))[_0x1b4c('0x3f')](handleError(_0x2a9ad8,null));};exports[_0x1b4c('0x21')]=function(_0x455f5d,_0x4fa963){return db[_0x1b4c('0x27')][_0x1b4c('0x41')]({'where':{'id':_0x455f5d[_0x1b4c('0x40')]['id']}})[_0x1b4c('0x20')](handleEntityNotFound(_0x4fa963,null))[_0x1b4c('0x20')](removeEntity(_0x4fa963,null))[_0x1b4c('0x3f')](handleError(_0x4fa963,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0d10899..6b6571b 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 _0x9f89=['../../config/logger','api','moment','bluebird','request-promise','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash'];(function(_0x20d916,_0x4bfa65){var _0x366417=function(_0xb3c76c){while(--_0xb3c76c){_0x20d916['push'](_0x20d916['shift']());}};_0x366417(++_0x4bfa65);}(_0x9f89,0x12a));var _0x99f8=function(_0x2fdc25,_0x7c1103){_0x2fdc25=_0x2fdc25-0x0;var _0x10666c=_0x9f89[_0x2fdc25];return _0x10666c;};'use strict';var _=require(_0x99f8('0x0'));var util=require('util');var logger=require(_0x99f8('0x1'))(_0x99f8('0x2'));var moment=require(_0x99f8('0x3'));var BPromise=require(_0x99f8('0x4'));var rp=require(_0x99f8('0x5'));var attributes=require(_0x99f8('0x6'));module[_0x99f8('0x7')]=function(_0x524374,_0x517665){return _0x524374[_0x99f8('0x8')](_0x99f8('0x9'),attributes,{'tableName':_0x99f8('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x99f8('0xb'),_0x99f8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd54=['exports','define','FreshdeskField','freshdesk_unique_index','lodash','util','../../config/logger','bluebird','request-promise','./intFreshdeskField.attributes'];(function(_0x335ca6,_0xad68eb){var _0x1f93c9=function(_0x57081f){while(--_0x57081f){_0x335ca6['push'](_0x335ca6['shift']());}};_0x1f93c9(++_0xad68eb);}(_0xcd54,0x162));var _0x4cd5=function(_0x60d287,_0x26eef4){_0x60d287=_0x60d287-0x0;var _0x380216=_0xcd54[_0x60d287];return _0x380216;};'use strict';var _=require(_0x4cd5('0x0'));var util=require(_0x4cd5('0x1'));var logger=require(_0x4cd5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4cd5('0x3'));var rp=require(_0x4cd5('0x4'));var attributes=require(_0x4cd5('0x5'));module[_0x4cd5('0x6')]=function(_0x261333,_0xf920c0){return _0x261333[_0x4cd5('0x7')](_0x4cd5('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x4cd5('0x9'),'fields':['idField','FieldId'],'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 456c90c..d06eb3c 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 _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x4f67f1,_0x3d02bf){var _0x52c611=function(_0x2ff881){while(--_0x2ff881){_0x4f67f1['push'](_0x4f67f1['shift']());}};_0x52c611(++_0x3d02bf);}(_0xb821,0xa7));var _0x1b82=function(_0xeccb2d,_0x1a16b8){_0xeccb2d=_0xeccb2d-0x0;var _0x597e9b=_0xb821[_0xeccb2d];return _0x597e9b;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file +var _0x4fdb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x54872d,_0x4ab02c){_0x54872d=_0x54872d-0x0;var _0x55b784=_0x4fdb[_0x54872d];return _0x55b784;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var moment=require(_0xb4fd('0x2'));var BPromise=require(_0xb4fd('0x3'));var rs=require(_0xb4fd('0x4'));var fs=require('fs');var Redis=require(_0xb4fd('0x5'));var db=require(_0xb4fd('0x6'))['db'];var utils=require(_0xb4fd('0x7'));var logger=require(_0xb4fd('0x8'))('rpc');var config=require(_0xb4fd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb4fd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53273f,_0x299bff,_0x3af8e3){return new BPromise(function(_0x1151b5,_0x52dca2){return client['request'](_0x53273f,_0x3af8e3)[_0xb4fd('0xb')](function(_0x4f9d18){logger[_0xb4fd('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x299bff,_0xb4fd('0xd'));logger[_0xb4fd('0xe')](_0xb4fd('0xf'),_0x299bff,_0xb4fd('0xd'),JSON[_0xb4fd('0x10')](_0x4f9d18));if(_0x4f9d18['error']){if(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x12')]===0x1f4){logger[_0xb4fd('0x11')](_0xb4fd('0x13'),_0x299bff,_0x4f9d18['error'][_0xb4fd('0x14')]);return _0x52dca2(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);}logger['error'](_0xb4fd('0x13'),_0x299bff,_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);return _0x1151b5(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);}else{logger[_0xb4fd('0xc')](_0xb4fd('0x13'),_0x299bff,'request\x20sent');_0x1151b5(_0x4f9d18[_0xb4fd('0x15')][_0xb4fd('0x14')]);}})[_0xb4fd('0x16')](function(_0x2d4701){logger[_0xb4fd('0x11')](_0xb4fd('0x13'),_0x299bff,_0x2d4701);_0x52dca2(_0x2d4701);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 50250b7..50caea7 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 _0xc1cd=['update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','post','create','addConfiguration','put'];(function(_0x3269af,_0xffc8f3){var _0x190c9c=function(_0x5021ea){while(--_0x5021ea){_0x3269af['push'](_0x3269af['shift']());}};_0x190c9c(++_0xffc8f3);}(_0xc1cd,0x1e6));var _0xdc1c=function(_0x4a0022,_0x3b0ae4){_0x4a0022=_0x4a0022-0x0;var _0x12afa6=_0xc1cd[_0x4a0022];return _0x12afa6;};'use strict';var multer=require(_0xdc1c('0x0'));var util=require(_0xdc1c('0x1'));var path=require(_0xdc1c('0x2'));var timeout=require(_0xdc1c('0x3'));var express=require('express');var router=express[_0xdc1c('0x4')]();var auth=require(_0xdc1c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdc1c('0x6'));var controller=require(_0xdc1c('0x7'));router['get']('/',auth[_0xdc1c('0x8')](),controller[_0xdc1c('0x9')]);router[_0xdc1c('0xa')](_0xdc1c('0xb'),auth[_0xdc1c('0x8')](),controller['show']);router[_0xdc1c('0xa')](_0xdc1c('0xc'),auth['isAuthenticated'](),controller[_0xdc1c('0xd')]);router[_0xdc1c('0xa')]('/:id/fields',auth[_0xdc1c('0x8')](),controller['getFields']);router[_0xdc1c('0xe')]('/',auth[_0xdc1c('0x8')](),controller[_0xdc1c('0xf')]);router[_0xdc1c('0xe')]('/:id/configurations',auth[_0xdc1c('0x8')](),controller[_0xdc1c('0x10')]);router[_0xdc1c('0x11')](_0xdc1c('0xb'),auth[_0xdc1c('0x8')](),controller[_0xdc1c('0x12')]);router[_0xdc1c('0x13')](_0xdc1c('0xb'),auth[_0xdc1c('0x8')](),controller['destroy']);module[_0xdc1c('0x14')]=router; \ No newline at end of file +var _0xe9b4=['get','isAuthenticated','index','show','/:id/configurations','getFields','post','create','addConfiguration','put','/:id','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller'];(function(_0x6aabd8,_0x3374bd){var _0x3ec1ca=function(_0x57fd10){while(--_0x57fd10){_0x6aabd8['push'](_0x6aabd8['shift']());}};_0x3ec1ca(++_0x3374bd);}(_0xe9b4,0x1f1));var _0x4e9b=function(_0x2dde43,_0xd2f816){_0x2dde43=_0x2dde43-0x0;var _0x68c45c=_0xe9b4[_0x2dde43];return _0x68c45c;};'use strict';var multer=require('multer');var util=require(_0x4e9b('0x0'));var path=require(_0x4e9b('0x1'));var timeout=require(_0x4e9b('0x2'));var express=require(_0x4e9b('0x3'));var router=express[_0x4e9b('0x4')]();var auth=require(_0x4e9b('0x5'));var interaction=require(_0x4e9b('0x6'));var config=require(_0x4e9b('0x7'));var controller=require(_0x4e9b('0x8'));router[_0x4e9b('0x9')]('/',auth[_0x4e9b('0xa')](),controller[_0x4e9b('0xb')]);router['get']('/:id',auth[_0x4e9b('0xa')](),controller[_0x4e9b('0xc')]);router['get'](_0x4e9b('0xd'),auth[_0x4e9b('0xa')](),controller['getConfigurations']);router[_0x4e9b('0x9')]('/:id/fields',auth[_0x4e9b('0xa')](),controller[_0x4e9b('0xe')]);router[_0x4e9b('0xf')]('/',auth[_0x4e9b('0xa')](),controller[_0x4e9b('0x10')]);router[_0x4e9b('0xf')](_0x4e9b('0xd'),auth[_0x4e9b('0xa')](),controller[_0x4e9b('0x11')]);router[_0x4e9b('0x12')](_0x4e9b('0x13'),auth[_0x4e9b('0xa')](),controller[_0x4e9b('0x14')]);router['delete']('/:id',auth[_0x4e9b('0xa')](),controller['destroy']);module[_0x4e9b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index fac4f45..c1b9c80 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 _0xd836=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x3da943,_0x352b56){var _0x2bc3d9=function(_0x510f71){while(--_0x510f71){_0x3da943['push'](_0x3da943['shift']());}};_0x2bc3d9(++_0x352b56);}(_0xd836,0x155));var _0x6d83=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd836[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x6d83('0x0'));module[_0x6d83('0x1')]={'name':{'type':Sequelize[_0x6d83('0x2')]},'description':{'type':Sequelize[_0x6d83('0x2')]},'username':{'type':Sequelize[_0x6d83('0x2')],'unique':_0x6d83('0x3')},'remoteUri':{'type':Sequelize[_0x6d83('0x2')]},'password':{'type':Sequelize[_0x6d83('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x6d83('0x2')]},'securityToken':{'type':Sequelize[_0x6d83('0x2')]},'serverUrl':{'type':Sequelize[_0x6d83('0x2')]},'type':{'type':Sequelize[_0x6d83('0x4')](_0x6d83('0x5'),_0x6d83('0x6')),'defaultValue':_0x6d83('0x5')}}; \ No newline at end of file +var _0xa100=['integrationTab','STRING','ENUM'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa100,0x1de));var _0x0a10=function(_0x18b580,_0x5eb613){_0x18b580=_0x18b580-0x0;var _0x2a073f=_0xa100[_0x18b580];return _0x2a073f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0a10('0x0')]},'description':{'type':Sequelize[_0x0a10('0x0')]},'username':{'type':Sequelize[_0x0a10('0x0')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x0a10('0x0')]},'password':{'type':Sequelize[_0x0a10('0x0')]},'clientId':{'type':Sequelize[_0x0a10('0x0')]},'clientSecret':{'type':Sequelize[_0x0a10('0x0')]},'securityToken':{'type':Sequelize[_0x0a10('0x0')]},'serverUrl':{'type':Sequelize[_0x0a10('0x0')]},'type':{'type':Sequelize[_0x0a10('0x1')](_0x0a10('0x2'),'newTab'),'defaultValue':_0x0a10('0x2')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 1125ea4..4e5f2cf 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 _0x2287=['http','info','request\x20sent','stringify','error','message','SalesforceAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','then','name','send','index','SalesforceAccount','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','map','key','includeAll','include','findAll','rows','show','params','rawAttributes','filters','options','create','body','find','getConfigurations','filter','addConfiguration','findOne','Subjects','type','Descriptions','getDescriptions','channel','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','login','isNil','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','Priority','Status','Type','Origin','Reason','IsEscalated','SuppliedName','remove','custom','includes','label','picklistValues','value','boolean','True','False','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client'];(function(_0x4886fe,_0x1d3377){var _0x1630aa=function(_0x13c419){while(--_0x13c419){_0x4886fe['push'](_0x4886fe['shift']());}};_0x1630aa(++_0x1d3377);}(_0x2287,0xe3));var _0x7228=function(_0x386392,_0x2a2dff){_0x386392=_0x386392-0x0;var _0x21d0c4=_0x2287[_0x386392];return _0x21d0c4;};'use strict';var pdf=require(_0x7228('0x0'));var emlformat=require(_0x7228('0x1'));var rimraf=require(_0x7228('0x2'));var zipdir=require(_0x7228('0x3'));var jsonpatch=require(_0x7228('0x4'));var rp=require('request-promise');var moment=require(_0x7228('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7228('0x6'));var util=require(_0x7228('0x7'));var path=require(_0x7228('0x8'));var sox=require(_0x7228('0x9'));var csv=require(_0x7228('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7228('0xb'));var squel=require('squel');var crypto=require(_0x7228('0xc'));var jsforce=require(_0x7228('0xd'));var deskjs=require(_0x7228('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7228('0xf'));var Papa=require('papaparse');var authService=require(_0x7228('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x7228('0x11'));var qs=require(_0x7228('0x12'));var logger=require(_0x7228('0x13'))('api');var utils=require(_0x7228('0x14'));var config=require(_0x7228('0x15'));var db=require(_0x7228('0x16'))['db'];var integrations=require(_0x7228('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x7228('0x18')][_0x7228('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1f9833,_0x445850,_0x4174cd,_0x308620){return new BPromise(function(_0x1ab4ba,_0x3b60ca){var _0x16115a=_0x308620||client;return _0x16115a['request'](_0x1f9833,_0x4174cd)['then'](function(_0x5d6227){logger[_0x7228('0x1a')]('SalesforceAccount,\x20%s,\x20%s',_0x445850,_0x7228('0x1b'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x445850,_0x7228('0x1b'),JSON[_0x7228('0x1c')](_0x5d6227));if(_0x5d6227[_0x7228('0x1d')]){if(_0x5d6227[_0x7228('0x1d')]['code']===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x445850,_0x5d6227['error'][_0x7228('0x1e')]);return _0x3b60ca(_0x5d6227[_0x7228('0x1d')]['message']);}logger[_0x7228('0x1d')](_0x7228('0x1f'),_0x445850,_0x5d6227[_0x7228('0x1d')][_0x7228('0x1e')]);return _0x1ab4ba(_0x5d6227['error'][_0x7228('0x1e')]);}else{logger[_0x7228('0x1a')](_0x7228('0x1f'),_0x445850,_0x7228('0x1b'));_0x1ab4ba(_0x5d6227[_0x7228('0x20')][_0x7228('0x1e')]);}})[_0x7228('0x21')](function(_0xde8923){logger[_0x7228('0x1d')](_0x7228('0x1f'),_0x445850,_0xde8923);_0x3b60ca(_0xde8923);});});}function respondWithStatusCode(_0x3b7b52,_0x56f184){_0x56f184=_0x56f184||0xcc;return function(_0x492397){if(_0x492397){return _0x3b7b52[_0x7228('0x22')](_0x56f184);}return _0x3b7b52[_0x7228('0x23')](_0x56f184)[_0x7228('0x24')]();};}function respondWithResult(_0x63b022,_0x179e35){_0x179e35=_0x179e35||0xc8;return function(_0x590cd3){if(_0x590cd3){return _0x63b022[_0x7228('0x23')](_0x179e35)[_0x7228('0x25')](_0x590cd3);}};}function respondWithFilteredResult(_0x48fabc,_0x1ed1f6){return function(_0x7e5b3){if(_0x7e5b3){var _0x7b995b=_0x7e5b3[_0x7228('0x26')],_0x3b7b09=_0x1ed1f6[_0x7228('0x27')],_0x17ad16=_0x1ed1f6[_0x7228('0x27')]+_0x1ed1f6['limit'],_0x40ad91;if(_0x17ad16>=_0x7b995b){_0x17ad16=_0x7b995b;_0x40ad91=0xc8;}else{_0x40ad91=0xce;}_0x48fabc['status'](_0x40ad91);return _0x48fabc['set'](_0x7228('0x28'),_0x3b7b09+'-'+_0x17ad16+'/'+_0x7b995b)[_0x7228('0x25')](_0x7e5b3);}return null;};}function patchUpdates(_0x392059){return function(_0x37a043){try{jsonpatch[_0x7228('0x29')](_0x37a043,_0x392059,!![]);}catch(_0x19a6e7){return BPromise[_0x7228('0x2a')](_0x19a6e7);}return _0x37a043[_0x7228('0x2b')]();};}function saveUpdates(_0x2b87ef,_0x2da52e){return function(_0x2344a8){if(_0x2344a8){return _0x2344a8[_0x7228('0x2c')](_0x2b87ef)['then'](function(_0x43fc50){return _0x43fc50;});}return null;};}function removeEntity(_0x3d2eea,_0x1dd597){return function(_0x1d5646){if(_0x1d5646){return _0x1d5646[_0x7228('0x2d')]()[_0x7228('0x2e')](function(){_0x3d2eea['status'](0xcc)[_0x7228('0x24')]();});}};}function handleEntityNotFound(_0x5d4996,_0x1b355e){return function(_0x4e8eee){if(!_0x4e8eee){_0x5d4996[_0x7228('0x22')](0x194);}return _0x4e8eee;};}function handleError(_0x258adc,_0x34e85a){_0x34e85a=_0x34e85a||0x1f4;return function(_0x5b45a4){logger[_0x7228('0x1d')](_0x5b45a4['stack']);if(_0x5b45a4['name']){delete _0x5b45a4[_0x7228('0x2f')];}_0x258adc[_0x7228('0x23')](_0x34e85a)[_0x7228('0x30')](_0x5b45a4);};}exports[_0x7228('0x31')]=function(_0x1ceb5b,_0x415dc4){var _0x25ecaa={},_0x536799={},_0xdd3aaa={'count':0x0,'rows':[]};var _0x3beaa6=db[_0x7228('0x32')]['rawAttributes'];_0x536799[_0x7228('0x33')]=_['keys'](_0x3beaa6);_0x536799[_0x7228('0x34')]=_[_0x7228('0x35')](_0x1ceb5b[_0x7228('0x34')]);_0x536799['filters']=_[_0x7228('0x36')](_0x536799['model'],_0x536799[_0x7228('0x34')]);_0x25ecaa[_0x7228('0x37')]=_[_0x7228('0x36')](_0x536799[_0x7228('0x33')],qs[_0x7228('0x38')](_0x1ceb5b['query'][_0x7228('0x38')]));_0x25ecaa[_0x7228('0x37')]=_0x25ecaa['attributes'][_0x7228('0x39')]?_0x25ecaa[_0x7228('0x37')]:_0x536799[_0x7228('0x33')];if(!_0x1ceb5b[_0x7228('0x34')]['hasOwnProperty'](_0x7228('0x3a'))){_0x25ecaa[_0x7228('0x3b')]=qs[_0x7228('0x3b')](_0x1ceb5b[_0x7228('0x34')][_0x7228('0x3b')]);_0x25ecaa[_0x7228('0x27')]=qs[_0x7228('0x27')](_0x1ceb5b['query'][_0x7228('0x27')]);}_0x25ecaa[_0x7228('0x3c')]=qs['sort'](_0x1ceb5b[_0x7228('0x34')][_0x7228('0x3d')]);_0x25ecaa[_0x7228('0x3e')]=qs['filters'](_[_0x7228('0x3f')](_0x1ceb5b[_0x7228('0x34')],_0x536799['filters']));if(_0x1ceb5b[_0x7228('0x34')]['filter']){_0x25ecaa[_0x7228('0x3e')]=_[_0x7228('0x40')](_0x25ecaa[_0x7228('0x3e')],{'$or':_[_0x7228('0x41')](_0x3beaa6,function(_0x28b306){if(_0x28b306['type'][_0x7228('0x42')]!=='VIRTUAL'){var _0x50979e={};_0x50979e[_0x28b306['field']]={'$like':'%'+_0x1ceb5b[_0x7228('0x34')]['filter']+'%'};return _0x50979e;}})});}_0x25ecaa=_[_0x7228('0x40')]({},_0x25ecaa,_0x1ceb5b['options']);var _0x593af6={'where':_0x25ecaa['where']};return db[_0x7228('0x32')]['count'](_0x593af6)[_0x7228('0x2e')](function(_0x27fd88){_0xdd3aaa[_0x7228('0x26')]=_0x27fd88;if(_0x1ceb5b[_0x7228('0x34')][_0x7228('0x43')]){_0x25ecaa[_0x7228('0x44')]=[{'all':!![]}];}return db[_0x7228('0x32')][_0x7228('0x45')](_0x25ecaa);})['then'](function(_0x2b4759){_0xdd3aaa[_0x7228('0x46')]=_0x2b4759;return _0xdd3aaa;})[_0x7228('0x2e')](respondWithFilteredResult(_0x415dc4,_0x25ecaa))['catch'](handleError(_0x415dc4,null));};exports[_0x7228('0x47')]=function(_0xd51a92,_0x1cf586){var _0x454c11={'raw':![],'where':{'id':_0xd51a92[_0x7228('0x48')]['id']}},_0x395abf={};_0x395abf['model']=_[_0x7228('0x35')](db[_0x7228('0x32')][_0x7228('0x49')]);_0x395abf[_0x7228('0x34')]=_[_0x7228('0x35')](_0xd51a92[_0x7228('0x34')]);_0x395abf[_0x7228('0x4a')]=_[_0x7228('0x36')](_0x395abf['model'],_0x395abf[_0x7228('0x34')]);_0x454c11[_0x7228('0x37')]=_[_0x7228('0x36')](_0x395abf[_0x7228('0x33')],qs['fields'](_0xd51a92[_0x7228('0x34')][_0x7228('0x38')]));_0x454c11[_0x7228('0x37')]=_0x454c11[_0x7228('0x37')]['length']?_0x454c11[_0x7228('0x37')]:_0x395abf[_0x7228('0x33')];if(_0xd51a92[_0x7228('0x34')]['includeAll']){_0x454c11[_0x7228('0x44')]=[{'all':!![]}];}_0x454c11=_[_0x7228('0x40')]({},_0x454c11,_0xd51a92[_0x7228('0x4b')]);return db[_0x7228('0x32')]['find'](_0x454c11)[_0x7228('0x2e')](handleEntityNotFound(_0x1cf586,null))[_0x7228('0x2e')](respondWithResult(_0x1cf586,null))[_0x7228('0x21')](handleError(_0x1cf586,null));};exports['create']=function(_0x5703f6,_0x229263){return db[_0x7228('0x32')][_0x7228('0x4c')](_0x5703f6[_0x7228('0x4d')],{})['then'](respondWithResult(_0x229263,0xc9))[_0x7228('0x21')](handleError(_0x229263,null));};exports[_0x7228('0x2c')]=function(_0x5700d7,_0x5b1852){if(_0x5700d7[_0x7228('0x4d')]['id']){delete _0x5700d7[_0x7228('0x4d')]['id'];}return db[_0x7228('0x32')]['find']({'where':{'id':_0x5700d7[_0x7228('0x48')]['id']}})[_0x7228('0x2e')](handleEntityNotFound(_0x5b1852,null))[_0x7228('0x2e')](saveUpdates(_0x5700d7[_0x7228('0x4d')],null))[_0x7228('0x2e')](respondWithResult(_0x5b1852,null))[_0x7228('0x21')](handleError(_0x5b1852,null));};exports['destroy']=function(_0x1a4beb,_0x31b029){return db[_0x7228('0x32')][_0x7228('0x4e')]({'where':{'id':_0x1a4beb['params']['id']}})['then'](handleEntityNotFound(_0x31b029,null))[_0x7228('0x2e')](removeEntity(_0x31b029,null))[_0x7228('0x21')](handleError(_0x31b029,null));};exports[_0x7228('0x4f')]=function(_0x1183ba,_0x2fcde6,_0x486d5a){var _0x31104d={};var _0x307cd7={};var _0x1abac6;var _0x5397c5;return db[_0x7228('0x32')]['findOne']({'where':{'id':_0x1183ba[_0x7228('0x48')]['id']}})[_0x7228('0x2e')](handleEntityNotFound(_0x2fcde6,null))[_0x7228('0x2e')](function(_0xb0ba87){if(_0xb0ba87){_0x1abac6=_0xb0ba87;_0x307cd7[_0x7228('0x33')]=_['keys'](db['SalesforceConfiguration'][_0x7228('0x49')]);_0x307cd7[_0x7228('0x34')]=_[_0x7228('0x35')](_0x1183ba[_0x7228('0x34')]);_0x307cd7['filters']=_[_0x7228('0x36')](_0x307cd7[_0x7228('0x33')],_0x307cd7[_0x7228('0x34')]);_0x31104d[_0x7228('0x37')]=_['intersection'](_0x307cd7[_0x7228('0x33')],qs['fields'](_0x1183ba[_0x7228('0x34')][_0x7228('0x38')]));_0x31104d[_0x7228('0x37')]=_0x31104d[_0x7228('0x37')][_0x7228('0x39')]?_0x31104d['attributes']:_0x307cd7[_0x7228('0x33')];_0x31104d[_0x7228('0x3c')]=qs[_0x7228('0x3d')](_0x1183ba[_0x7228('0x34')][_0x7228('0x3d')]);_0x31104d[_0x7228('0x3e')]=qs['filters'](_[_0x7228('0x3f')](_0x1183ba[_0x7228('0x34')],_0x307cd7[_0x7228('0x4a')]));if(_0x1183ba['query'][_0x7228('0x50')]){_0x31104d[_0x7228('0x3e')]=_[_0x7228('0x40')](_0x31104d[_0x7228('0x3e')],{'$or':_[_0x7228('0x41')](_0x31104d[_0x7228('0x37')],function(_0x1a8b5d){var _0x1fa711={};_0x1fa711[_0x1a8b5d]={'$like':'%'+_0x1183ba[_0x7228('0x34')][_0x7228('0x50')]+'%'};return _0x1fa711;})});}_0x31104d=_['merge']({},_0x31104d,_0x1183ba['options']);return _0x1abac6['getConfigurations'](_0x31104d);}})['then'](function(_0x1d1043){if(_0x1d1043){_0x5397c5=_0x1d1043[_0x7228('0x39')];if(!_0x1183ba[_0x7228('0x34')]['hasOwnProperty']('nolimit')){_0x31104d['limit']=qs[_0x7228('0x3b')](_0x1183ba[_0x7228('0x34')][_0x7228('0x3b')]);_0x31104d['offset']=qs[_0x7228('0x27')](_0x1183ba[_0x7228('0x34')][_0x7228('0x27')]);}return _0x1abac6[_0x7228('0x4f')](_0x31104d);}})[_0x7228('0x2e')](function(_0x51440c){if(_0x51440c){return _0x51440c?{'count':_0x5397c5,'rows':_0x51440c}:null;}})[_0x7228('0x2e')](respondWithResult(_0x2fcde6,null))[_0x7228('0x21')](handleError(_0x2fcde6,null));};exports[_0x7228('0x51')]=function(_0x42f0e4,_0x28a411,_0x226f5d){if(_0x42f0e4[_0x7228('0x4d')]['id']){delete _0x42f0e4[_0x7228('0x4d')]['id'];}return db[_0x7228('0x32')][_0x7228('0x52')]({'where':{'id':_0x42f0e4['params']['id']}})[_0x7228('0x2e')](handleEntityNotFound(_0x28a411,null))[_0x7228('0x2e')](function(_0x492146){if(_0x492146){_0x42f0e4[_0x7228('0x4d')]['AccountId']=_0x492146['id'];_0x42f0e4[_0x7228('0x4d')][_0x7228('0x53')]=integrations['getSubjects'](_0x42f0e4['body']['channel'],_0x42f0e4[_0x7228('0x4d')][_0x7228('0x54')]);_0x42f0e4['body'][_0x7228('0x55')]=integrations[_0x7228('0x56')](_0x42f0e4['body'][_0x7228('0x57')],_0x42f0e4[_0x7228('0x4d')]['type']);return db['SalesforceConfiguration'][_0x7228('0x4c')](_0x42f0e4[_0x7228('0x4d')],{'include':[{'model':db[_0x7228('0x58')],'as':_0x7228('0x53')},{'model':db[_0x7228('0x58')],'as':'Descriptions'}]});}return null;})[_0x7228('0x2e')](respondWithResult(_0x28a411,null))[_0x7228('0x21')](handleError(_0x28a411,null));};exports[_0x7228('0x59')]=function(_0x56b006,_0x4d013b,_0x17d146){var _0x341cf4;var _0x50898c='';var _0x9b3cb3='Task';return db[_0x7228('0x32')]['findOne']({'where':{'id':_0x56b006[_0x7228('0x48')]['id']},'attributes':['id',_0x7228('0x5a'),_0x7228('0x5b'),_0x7228('0x5c'),_0x7228('0x5d'),_0x7228('0x5e'),_0x7228('0x5f')]})[_0x7228('0x2e')](handleEntityNotFound(_0x4d013b,null))[_0x7228('0x2e')](function(_0x4d9498){if(_0x4d9498){_0x50898c=_0x4d9498[_0x7228('0x5a')];var _0x221937=_0x50898c[_0x7228('0x60')](-0x1);if(_0x221937==='/'){_0x50898c=_0x50898c['substring'](0x0,_0x50898c[_0x7228('0x61')](_0x221937));}_0x341cf4=new jsforce['Connection']({'oauth2':{'loginUrl':_0x50898c,'clientId':_0x4d9498['clientId'],'clientSecret':_0x4d9498[_0x7228('0x5c')]}});return _0x341cf4[_0x7228('0x62')](_0x4d9498[_0x7228('0x5d')],_0x4d9498[_0x7228('0x5e')]['concat'](_0x4d9498[_0x7228('0x5f')]));}})['then'](function(_0x16eb43){if(_0x16eb43){if(!_[_0x7228('0x63')](_0x56b006[_0x7228('0x34')][_0x7228('0x64')])){_0x9b3cb3=_0x56b006['query'][_0x7228('0x64')];}return _0x341cf4[_0x7228('0x65')](_0x9b3cb3)[_0x7228('0x66')]();}})[_0x7228('0x2e')](function(_0x1bea42){var _0x48d233=['CallDisposition',_0x7228('0x67'),_0x7228('0x68'),_0x7228('0x69'),'IsArchived',_0x7228('0x6a'),_0x7228('0x6b'),_0x7228('0x6c')];if(!_['isNil'](_0x56b006[_0x7228('0x34')][_0x7228('0x64')])&&_0x56b006[_0x7228('0x34')]['ticketType']==='Case'){_0x48d233=['Type',_0x7228('0x6d'),_0x7228('0x6e'),_0x7228('0x6b'),_0x7228('0x6a'),_0x7228('0x6f'),_0x7228('0x70'),'SuppliedCompany'];}if(_0x1bea42){_[_0x7228('0x71')](_0x1bea42[_0x7228('0x38')],function(_0x1d5470){return _0x1d5470[_0x7228('0x72')]===![]&&!_0x48d233[_0x7228('0x73')](_0x1d5470['name']);});return{'count':_0x1bea42[_0x7228('0x38')][_0x7228('0x39')],'rows':_[_0x7228('0x41')](_0x1bea42[_0x7228('0x38')],function(_0x4f765f){return{'id':_0x4f765f['name'],'name':_0x4f765f[_0x7228('0x74')],'custom':_0x4f765f[_0x7228('0x72')],'options':_0x4f765f[_0x7228('0x75')][_0x7228('0x39')]>0x0?_[_0x7228('0x41')](_0x4f765f[_0x7228('0x75')],function(_0x1df805){return{'name':_0x1df805['label'],'value':_0x1df805[_0x7228('0x76')]};}):_0x4f765f[_0x7228('0x54')]==_0x7228('0x77')?[{'name':_0x7228('0x78'),'value':'true'},{'name':_0x7228('0x79'),'value':'false'}]:[]};})};}})[_0x7228('0x2e')](respondWithResult(_0x4d013b,null))['catch'](function(_0x1661fe){var _0x330480=_0x56b006[_0x7228('0x34')][_0x7228('0x7a')]?0x1f4:_0x1661fe['statusCode']||0x1f4;logger[_0x7228('0x1d')](_0x7228('0x7b'),'getFields',_0x330480,JSON[_0x7228('0x1c')](_0x1661fe));delete _0x1661fe[_0x7228('0x2f')];if(_0x330480===0x191){_0x330480=0x190;}_0x4d013b['status'](_0x330480)[_0x7228('0x30')](_0x56b006[_0x7228('0x34')][_0x7228('0x7a')]?{'message':_0x7228('0x7c'),'statusCode':_0x1661fe[_0x7228('0x7d')]}:_0x1661fe);});}; \ No newline at end of file +var _0xa47f=['fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','stack','name','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','key','field','includeAll','include','SalesforceAccount','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','SalesforceConfiguration','order','addConfiguration','AccountId','Subjects','channel','SalesforceField','Descriptions','Task','clientId','clientSecret','username','securityToken','remoteUri','lastIndexOf','login','password','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','IsArchived','Priority','Status','Type','Case','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','value','True','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','html-pdf','eml-format'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa47f,0x18a));var _0xfa47=function(_0x5f4886,_0x4f9c93){_0x5f4886=_0x5f4886-0x0;var _0x4fbe78=_0xa47f[_0x5f4886];return _0x4fbe78;};'use strict';var pdf=require(_0xfa47('0x0'));var emlformat=require(_0xfa47('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfa47('0x2'));var rp=require('request-promise');var moment=require(_0xfa47('0x3'));var BPromise=require(_0xfa47('0x4'));var Mustache=require(_0xfa47('0x5'));var util=require(_0xfa47('0x6'));var path=require(_0xfa47('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfa47('0x8'));var fs=require('fs');var _=require(_0xfa47('0x9'));var squel=require(_0xfa47('0xa'));var crypto=require(_0xfa47('0xb'));var jsforce=require(_0xfa47('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfa47('0xd'));var querystring=require(_0xfa47('0xe'));var Papa=require(_0xfa47('0xf'));var authService=require(_0xfa47('0x10'));var hardwareService=require(_0xfa47('0x11'));var Redis=require(_0xfa47('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0xfa47('0x13'))(_0xfa47('0x14'));var utils=require(_0xfa47('0x15'));var config=require(_0xfa47('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfa47('0x17'));var jayson=require(_0xfa47('0x18'));var client=jayson[_0xfa47('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x279cc3,_0x26c97b,_0x58553d,_0x4e72c9){return new BPromise(function(_0x3a50cd,_0x23fb2f){var _0x18d3d5=_0x4e72c9||client;return _0x18d3d5[_0xfa47('0x1a')](_0x279cc3,_0x58553d)[_0xfa47('0x1b')](function(_0x185b5e){logger[_0xfa47('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0x26c97b,_0xfa47('0x1d'));logger[_0xfa47('0x1e')](_0xfa47('0x1f'),_0x26c97b,_0xfa47('0x1d'),JSON[_0xfa47('0x20')](_0x185b5e));if(_0x185b5e[_0xfa47('0x21')]){if(_0x185b5e[_0xfa47('0x21')][_0xfa47('0x22')]===0x1f4){logger[_0xfa47('0x21')](_0xfa47('0x23'),_0x26c97b,_0x185b5e[_0xfa47('0x21')][_0xfa47('0x24')]);return _0x23fb2f(_0x185b5e[_0xfa47('0x21')][_0xfa47('0x24')]);}logger[_0xfa47('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0x26c97b,_0x185b5e[_0xfa47('0x21')][_0xfa47('0x24')]);return _0x3a50cd(_0x185b5e[_0xfa47('0x21')][_0xfa47('0x24')]);}else{logger[_0xfa47('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0x26c97b,_0xfa47('0x1d'));_0x3a50cd(_0x185b5e[_0xfa47('0x25')]['message']);}})['catch'](function(_0x37cc50){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x26c97b,_0x37cc50);_0x23fb2f(_0x37cc50);});});}function respondWithStatusCode(_0x1fac16,_0x326ffc){_0x326ffc=_0x326ffc||0xcc;return function(_0x42e29d){if(_0x42e29d){return _0x1fac16[_0xfa47('0x26')](_0x326ffc);}return _0x1fac16[_0xfa47('0x27')](_0x326ffc)[_0xfa47('0x28')]();};}function respondWithResult(_0x27e1c8,_0x4ab6c0){_0x4ab6c0=_0x4ab6c0||0xc8;return function(_0x149468){if(_0x149468){return _0x27e1c8[_0xfa47('0x27')](_0x4ab6c0)[_0xfa47('0x29')](_0x149468);}};}function respondWithFilteredResult(_0x2a4623,_0x550b40){return function(_0x543473){if(_0x543473){var _0xce95a6=_0x543473[_0xfa47('0x2a')],_0x107fec=_0x550b40[_0xfa47('0x2b')],_0x1aa9af=_0x550b40[_0xfa47('0x2b')]+_0x550b40[_0xfa47('0x2c')],_0x5ee318;if(_0x1aa9af>=_0xce95a6){_0x1aa9af=_0xce95a6;_0x5ee318=0xc8;}else{_0x5ee318=0xce;}_0x2a4623['status'](_0x5ee318);return _0x2a4623[_0xfa47('0x2d')]('Content-Range',_0x107fec+'-'+_0x1aa9af+'/'+_0xce95a6)[_0xfa47('0x29')](_0x543473);}return null;};}function patchUpdates(_0x26ceb2){return function(_0x3ba571){try{jsonpatch[_0xfa47('0x2e')](_0x3ba571,_0x26ceb2,!![]);}catch(_0x3b851f){return BPromise['reject'](_0x3b851f);}return _0x3ba571[_0xfa47('0x2f')]();};}function saveUpdates(_0x3927f1,_0x202843){return function(_0x340f4a){if(_0x340f4a){return _0x340f4a[_0xfa47('0x30')](_0x3927f1)[_0xfa47('0x1b')](function(_0x3997cd){return _0x3997cd;});}return null;};}function removeEntity(_0x19991e,_0x72381){return function(_0x5267a6){if(_0x5267a6){return _0x5267a6['destroy']()[_0xfa47('0x1b')](function(){_0x19991e[_0xfa47('0x27')](0xcc)[_0xfa47('0x28')]();});}};}function handleEntityNotFound(_0x4f70ae,_0x482e06){return function(_0x1f212f){if(!_0x1f212f){_0x4f70ae[_0xfa47('0x26')](0x194);}return _0x1f212f;};}function handleError(_0x58c27b,_0x45496d){_0x45496d=_0x45496d||0x1f4;return function(_0x55ce6f){logger['error'](_0x55ce6f[_0xfa47('0x31')]);if(_0x55ce6f[_0xfa47('0x32')]){delete _0x55ce6f['name'];}_0x58c27b[_0xfa47('0x27')](_0x45496d)['send'](_0x55ce6f);};}exports[_0xfa47('0x33')]=function(_0x895c3e,_0x13a0c8){var _0x39dd29={},_0x1f8a1e={},_0x45a875={'count':0x0,'rows':[]};var _0x3adbf3=db['SalesforceAccount'][_0xfa47('0x34')];_0x1f8a1e[_0xfa47('0x35')]=_['keys'](_0x3adbf3);_0x1f8a1e[_0xfa47('0x36')]=_[_0xfa47('0x37')](_0x895c3e[_0xfa47('0x36')]);_0x1f8a1e[_0xfa47('0x38')]=_[_0xfa47('0x39')](_0x1f8a1e[_0xfa47('0x35')],_0x1f8a1e[_0xfa47('0x36')]);_0x39dd29[_0xfa47('0x3a')]=_[_0xfa47('0x39')](_0x1f8a1e[_0xfa47('0x35')],qs[_0xfa47('0x3b')](_0x895c3e[_0xfa47('0x36')][_0xfa47('0x3b')]));_0x39dd29[_0xfa47('0x3a')]=_0x39dd29[_0xfa47('0x3a')][_0xfa47('0x3c')]?_0x39dd29[_0xfa47('0x3a')]:_0x1f8a1e[_0xfa47('0x35')];if(!_0x895c3e[_0xfa47('0x36')][_0xfa47('0x3d')](_0xfa47('0x3e'))){_0x39dd29[_0xfa47('0x2c')]=qs['limit'](_0x895c3e[_0xfa47('0x36')][_0xfa47('0x2c')]);_0x39dd29['offset']=qs[_0xfa47('0x2b')](_0x895c3e['query'][_0xfa47('0x2b')]);}_0x39dd29['order']=qs[_0xfa47('0x3f')](_0x895c3e[_0xfa47('0x36')][_0xfa47('0x3f')]);_0x39dd29['where']=qs['filters'](_[_0xfa47('0x40')](_0x895c3e['query'],_0x1f8a1e[_0xfa47('0x38')]));if(_0x895c3e[_0xfa47('0x36')][_0xfa47('0x41')]){_0x39dd29[_0xfa47('0x42')]=_[_0xfa47('0x43')](_0x39dd29[_0xfa47('0x42')],{'$or':_[_0xfa47('0x44')](_0x3adbf3,function(_0x993a08){if(_0x993a08[_0xfa47('0x45')][_0xfa47('0x46')]!=='VIRTUAL'){var _0x5630be={};_0x5630be[_0x993a08[_0xfa47('0x47')]]={'$like':'%'+_0x895c3e[_0xfa47('0x36')][_0xfa47('0x41')]+'%'};return _0x5630be;}})});}_0x39dd29=_[_0xfa47('0x43')]({},_0x39dd29,_0x895c3e['options']);var _0xf8bd0c={'where':_0x39dd29[_0xfa47('0x42')]};return db['SalesforceAccount']['count'](_0xf8bd0c)['then'](function(_0x1e0736){_0x45a875[_0xfa47('0x2a')]=_0x1e0736;if(_0x895c3e[_0xfa47('0x36')][_0xfa47('0x48')]){_0x39dd29[_0xfa47('0x49')]=[{'all':!![]}];}return db[_0xfa47('0x4a')][_0xfa47('0x4b')](_0x39dd29);})[_0xfa47('0x1b')](function(_0x2d2862){_0x45a875[_0xfa47('0x4c')]=_0x2d2862;return _0x45a875;})[_0xfa47('0x1b')](respondWithFilteredResult(_0x13a0c8,_0x39dd29))[_0xfa47('0x4d')](handleError(_0x13a0c8,null));};exports[_0xfa47('0x4e')]=function(_0x1a7f50,_0x3d4ddc){var _0x5777fb={'raw':![],'where':{'id':_0x1a7f50[_0xfa47('0x4f')]['id']}},_0x54b932={};_0x54b932[_0xfa47('0x35')]=_['keys'](db[_0xfa47('0x4a')][_0xfa47('0x34')]);_0x54b932[_0xfa47('0x36')]=_[_0xfa47('0x37')](_0x1a7f50[_0xfa47('0x36')]);_0x54b932['filters']=_['intersection'](_0x54b932[_0xfa47('0x35')],_0x54b932[_0xfa47('0x36')]);_0x5777fb[_0xfa47('0x3a')]=_['intersection'](_0x54b932['model'],qs['fields'](_0x1a7f50[_0xfa47('0x36')][_0xfa47('0x3b')]));_0x5777fb[_0xfa47('0x3a')]=_0x5777fb[_0xfa47('0x3a')][_0xfa47('0x3c')]?_0x5777fb[_0xfa47('0x3a')]:_0x54b932['model'];if(_0x1a7f50['query']['includeAll']){_0x5777fb[_0xfa47('0x49')]=[{'all':!![]}];}_0x5777fb=_[_0xfa47('0x43')]({},_0x5777fb,_0x1a7f50[_0xfa47('0x50')]);return db[_0xfa47('0x4a')][_0xfa47('0x51')](_0x5777fb)[_0xfa47('0x1b')](handleEntityNotFound(_0x3d4ddc,null))[_0xfa47('0x1b')](respondWithResult(_0x3d4ddc,null))[_0xfa47('0x4d')](handleError(_0x3d4ddc,null));};exports['create']=function(_0x14de9d,_0x564d32){return db[_0xfa47('0x4a')][_0xfa47('0x52')](_0x14de9d[_0xfa47('0x53')],{})['then'](respondWithResult(_0x564d32,0xc9))[_0xfa47('0x4d')](handleError(_0x564d32,null));};exports[_0xfa47('0x30')]=function(_0xfade5,_0x3eac5d){if(_0xfade5[_0xfa47('0x53')]['id']){delete _0xfade5[_0xfa47('0x53')]['id'];}return db[_0xfa47('0x4a')][_0xfa47('0x51')]({'where':{'id':_0xfade5[_0xfa47('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3eac5d,null))[_0xfa47('0x1b')](saveUpdates(_0xfade5[_0xfa47('0x53')],null))[_0xfa47('0x1b')](respondWithResult(_0x3eac5d,null))[_0xfa47('0x4d')](handleError(_0x3eac5d,null));};exports['destroy']=function(_0x48f7f8,_0x490573){return db['SalesforceAccount'][_0xfa47('0x51')]({'where':{'id':_0x48f7f8[_0xfa47('0x4f')]['id']}})[_0xfa47('0x1b')](handleEntityNotFound(_0x490573,null))[_0xfa47('0x1b')](removeEntity(_0x490573,null))[_0xfa47('0x4d')](handleError(_0x490573,null));};exports[_0xfa47('0x54')]=function(_0x2f4c09,_0x20fe28,_0x264a74){var _0xc404cf={};var _0x3eb17b={};var _0x1916ab;var _0x32886f;return db[_0xfa47('0x4a')][_0xfa47('0x55')]({'where':{'id':_0x2f4c09['params']['id']}})['then'](handleEntityNotFound(_0x20fe28,null))[_0xfa47('0x1b')](function(_0x3b8b70){if(_0x3b8b70){_0x1916ab=_0x3b8b70;_0x3eb17b[_0xfa47('0x35')]=_[_0xfa47('0x37')](db[_0xfa47('0x56')][_0xfa47('0x34')]);_0x3eb17b[_0xfa47('0x36')]=_[_0xfa47('0x37')](_0x2f4c09[_0xfa47('0x36')]);_0x3eb17b[_0xfa47('0x38')]=_[_0xfa47('0x39')](_0x3eb17b[_0xfa47('0x35')],_0x3eb17b[_0xfa47('0x36')]);_0xc404cf['attributes']=_['intersection'](_0x3eb17b[_0xfa47('0x35')],qs[_0xfa47('0x3b')](_0x2f4c09[_0xfa47('0x36')]['fields']));_0xc404cf[_0xfa47('0x3a')]=_0xc404cf['attributes'][_0xfa47('0x3c')]?_0xc404cf[_0xfa47('0x3a')]:_0x3eb17b['model'];_0xc404cf[_0xfa47('0x57')]=qs[_0xfa47('0x3f')](_0x2f4c09['query']['sort']);_0xc404cf[_0xfa47('0x42')]=qs[_0xfa47('0x38')](_['pick'](_0x2f4c09[_0xfa47('0x36')],_0x3eb17b[_0xfa47('0x38')]));if(_0x2f4c09[_0xfa47('0x36')][_0xfa47('0x41')]){_0xc404cf['where']=_[_0xfa47('0x43')](_0xc404cf[_0xfa47('0x42')],{'$or':_[_0xfa47('0x44')](_0xc404cf[_0xfa47('0x3a')],function(_0xed663c){var _0x29c1bb={};_0x29c1bb[_0xed663c]={'$like':'%'+_0x2f4c09['query'][_0xfa47('0x41')]+'%'};return _0x29c1bb;})});}_0xc404cf=_['merge']({},_0xc404cf,_0x2f4c09[_0xfa47('0x50')]);return _0x1916ab['getConfigurations'](_0xc404cf);}})[_0xfa47('0x1b')](function(_0x3d4a9d){if(_0x3d4a9d){_0x32886f=_0x3d4a9d[_0xfa47('0x3c')];if(!_0x2f4c09['query'][_0xfa47('0x3d')](_0xfa47('0x3e'))){_0xc404cf['limit']=qs[_0xfa47('0x2c')](_0x2f4c09[_0xfa47('0x36')]['limit']);_0xc404cf[_0xfa47('0x2b')]=qs['offset'](_0x2f4c09[_0xfa47('0x36')][_0xfa47('0x2b')]);}return _0x1916ab[_0xfa47('0x54')](_0xc404cf);}})['then'](function(_0x11ce83){if(_0x11ce83){return _0x11ce83?{'count':_0x32886f,'rows':_0x11ce83}:null;}})[_0xfa47('0x1b')](respondWithResult(_0x20fe28,null))[_0xfa47('0x4d')](handleError(_0x20fe28,null));};exports[_0xfa47('0x58')]=function(_0x1d1b70,_0x12b706,_0x2ed1d3){if(_0x1d1b70['body']['id']){delete _0x1d1b70[_0xfa47('0x53')]['id'];}return db[_0xfa47('0x4a')][_0xfa47('0x55')]({'where':{'id':_0x1d1b70[_0xfa47('0x4f')]['id']}})['then'](handleEntityNotFound(_0x12b706,null))['then'](function(_0x48b353){if(_0x48b353){_0x1d1b70['body'][_0xfa47('0x59')]=_0x48b353['id'];_0x1d1b70[_0xfa47('0x53')][_0xfa47('0x5a')]=integrations['getSubjects'](_0x1d1b70[_0xfa47('0x53')][_0xfa47('0x5b')],_0x1d1b70[_0xfa47('0x53')][_0xfa47('0x45')]);_0x1d1b70['body']['Descriptions']=integrations['getDescriptions'](_0x1d1b70['body'][_0xfa47('0x5b')],_0x1d1b70[_0xfa47('0x53')][_0xfa47('0x45')]);return db[_0xfa47('0x56')][_0xfa47('0x52')](_0x1d1b70[_0xfa47('0x53')],{'include':[{'model':db[_0xfa47('0x5c')],'as':_0xfa47('0x5a')},{'model':db[_0xfa47('0x5c')],'as':_0xfa47('0x5d')}]});}return null;})['then'](respondWithResult(_0x12b706,null))[_0xfa47('0x4d')](handleError(_0x12b706,null));};exports['getFields']=function(_0x5bba1d,_0x29e47a,_0x3ba722){var _0x5a4a6c;var _0x6284e7='';var _0x3eb5c1=_0xfa47('0x5e');return db[_0xfa47('0x4a')][_0xfa47('0x55')]({'where':{'id':_0x5bba1d[_0xfa47('0x4f')]['id']},'attributes':['id','remoteUri',_0xfa47('0x5f'),_0xfa47('0x60'),_0xfa47('0x61'),'password',_0xfa47('0x62')]})['then'](handleEntityNotFound(_0x29e47a,null))[_0xfa47('0x1b')](function(_0xc1aae1){if(_0xc1aae1){_0x6284e7=_0xc1aae1[_0xfa47('0x63')];var _0x75083f=_0x6284e7['slice'](-0x1);if(_0x75083f==='/'){_0x6284e7=_0x6284e7['substring'](0x0,_0x6284e7[_0xfa47('0x64')](_0x75083f));}_0x5a4a6c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x6284e7,'clientId':_0xc1aae1[_0xfa47('0x5f')],'clientSecret':_0xc1aae1['clientSecret']}});return _0x5a4a6c[_0xfa47('0x65')](_0xc1aae1['username'],_0xc1aae1[_0xfa47('0x66')][_0xfa47('0x67')](_0xc1aae1[_0xfa47('0x62')]));}})['then'](function(_0x177763){if(_0x177763){if(!_[_0xfa47('0x68')](_0x5bba1d[_0xfa47('0x36')][_0xfa47('0x69')])){_0x3eb5c1=_0x5bba1d[_0xfa47('0x36')][_0xfa47('0x69')];}return _0x5a4a6c[_0xfa47('0x6a')](_0x3eb5c1)[_0xfa47('0x6b')]();}})[_0xfa47('0x1b')](function(_0x52cf49){var _0x2efb77=[_0xfa47('0x6c'),_0xfa47('0x6d'),'CallObject','CallType',_0xfa47('0x6e'),_0xfa47('0x6f'),_0xfa47('0x70'),_0xfa47('0x71')];if(!_[_0xfa47('0x68')](_0x5bba1d[_0xfa47('0x36')][_0xfa47('0x69')])&&_0x5bba1d[_0xfa47('0x36')][_0xfa47('0x69')]===_0xfa47('0x72')){_0x2efb77=[_0xfa47('0x71'),'Origin','Reason',_0xfa47('0x70'),_0xfa47('0x6f'),'IsEscalated',_0xfa47('0x73'),_0xfa47('0x74')];}if(_0x52cf49){_[_0xfa47('0x75')](_0x52cf49[_0xfa47('0x3b')],function(_0x248fb2){return _0x248fb2[_0xfa47('0x76')]===![]&&!_0x2efb77[_0xfa47('0x77')](_0x248fb2[_0xfa47('0x32')]);});return{'count':_0x52cf49[_0xfa47('0x3b')][_0xfa47('0x3c')],'rows':_[_0xfa47('0x44')](_0x52cf49['fields'],function(_0x1ac2da){return{'id':_0x1ac2da['name'],'name':_0x1ac2da[_0xfa47('0x78')],'custom':_0x1ac2da['custom'],'options':_0x1ac2da[_0xfa47('0x79')]['length']>0x0?_[_0xfa47('0x44')](_0x1ac2da['picklistValues'],function(_0xa3bcd9){return{'name':_0xa3bcd9['label'],'value':_0xa3bcd9[_0xfa47('0x7a')]};}):_0x1ac2da['type']=='boolean'?[{'name':_0xfa47('0x7b'),'value':_0xfa47('0x7c')},{'name':_0xfa47('0x7d'),'value':_0xfa47('0x7e')}]:[]};})};}})[_0xfa47('0x1b')](respondWithResult(_0x29e47a,null))['catch'](function(_0x30141d){var _0x46f162=_0x5bba1d[_0xfa47('0x36')][_0xfa47('0x7f')]?0x1f4:_0x30141d['statusCode']||0x1f4;logger['error'](_0xfa47('0x80'),'getFields',_0x46f162,JSON[_0xfa47('0x20')](_0x30141d));delete _0x30141d[_0xfa47('0x32')];if(_0x46f162===0x191){_0x46f162=0x190;}_0x29e47a['status'](_0x46f162)[_0xfa47('0x81')](_0x5bba1d[_0xfa47('0x36')]['test']?{'message':_0xfa47('0x82'),'statusCode':_0x30141d[_0xfa47('0x83')]}:_0x30141d);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 8774da3..363420b 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 _0x9dc5=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','request-promise','./intSalesforceAccount.attributes'];(function(_0x9c41f5,_0x5d2f69){var _0x4f14f4=function(_0x8f5d8){while(--_0x8f5d8){_0x9c41f5['push'](_0x9c41f5['shift']());}};_0x4f14f4(++_0x5d2f69);}(_0x9dc5,0x14f));var _0x59dc=function(_0x11cd69,_0x5540d4){_0x11cd69=_0x11cd69-0x0;var _0x21b3ac=_0x9dc5[_0x11cd69];return _0x21b3ac;};'use strict';var _=require(_0x59dc('0x0'));var util=require(_0x59dc('0x1'));var logger=require(_0x59dc('0x2'))('api');var moment=require(_0x59dc('0x3'));var BPromise=require('bluebird');var rp=require(_0x59dc('0x4'));var attributes=require(_0x59dc('0x5'));var integrations=require(_0x59dc('0x6'));module[_0x59dc('0x7')]=function(_0x212888,_0x425289){return _0x212888[_0x59dc('0x8')](_0x59dc('0x9'),attributes,{'tableName':_0x59dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaa8=['request-promise','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','bluebird'];(function(_0x1bc2f1,_0x5e4052){var _0xd2e460=function(_0x4d818c){while(--_0x4d818c){_0x1bc2f1['push'](_0x1bc2f1['shift']());}};_0xd2e460(++_0x5e4052);}(_0xfaa8,0xec));var _0x8faa=function(_0xa5becf,_0x269d78){_0xa5becf=_0xa5becf-0x0;var _0x237525=_0xfaa8[_0xa5becf];return _0x237525;};'use strict';var _=require(_0x8faa('0x0'));var util=require('util');var logger=require(_0x8faa('0x1'))(_0x8faa('0x2'));var moment=require('moment');var BPromise=require(_0x8faa('0x3'));var rp=require(_0x8faa('0x4'));var attributes=require(_0x8faa('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x8faa('0x6')]=function(_0x313c8c,_0x3284e7){return _0x313c8c[_0x8faa('0x7')](_0x8faa('0x8'),attributes,{'tableName':_0x8faa('0x9'),'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 c08ec80..5f1d5a8 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 _0x7e7c=['raw','where','attributes','limit','include','model','map','then','GetSalesforceAccount','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','options'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0x7e7c,0x16a));var _0xc7e7=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x7e7c[_0x1e2080];return _0x260111;};'use strict';var _=require(_0xc7e7('0x0'));var util=require(_0xc7e7('0x1'));var moment=require(_0xc7e7('0x2'));var BPromise=require(_0xc7e7('0x3'));var rs=require(_0xc7e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7e7('0x5'))['db'];var utils=require(_0xc7e7('0x6'));var logger=require(_0xc7e7('0x7'))('rpc');var config=require(_0xc7e7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc7e7('0x9')][_0xc7e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bdec6,_0x3d9476,_0x1e2239){return new BPromise(function(_0x8ae4bb,_0x1ec2aa){return client['request'](_0x5bdec6,_0x1e2239)['then'](function(_0xfb84e7){logger['info'](_0xc7e7('0xb'),_0x3d9476,_0xc7e7('0xc'));logger[_0xc7e7('0xd')](_0xc7e7('0xe'),_0x3d9476,_0xc7e7('0xc'),JSON[_0xc7e7('0xf')](_0xfb84e7));if(_0xfb84e7[_0xc7e7('0x10')]){if(_0xfb84e7['error'][_0xc7e7('0x11')]===0x1f4){logger[_0xc7e7('0x10')](_0xc7e7('0xb'),_0x3d9476,_0xfb84e7[_0xc7e7('0x10')]['message']);return _0x1ec2aa(_0xfb84e7['error'][_0xc7e7('0x12')]);}logger[_0xc7e7('0x10')](_0xc7e7('0xb'),_0x3d9476,_0xfb84e7[_0xc7e7('0x10')][_0xc7e7('0x12')]);return _0x8ae4bb(_0xfb84e7[_0xc7e7('0x10')]['message']);}else{logger[_0xc7e7('0x13')](_0xc7e7('0xb'),_0x3d9476,_0xc7e7('0xc'));_0x8ae4bb(_0xfb84e7[_0xc7e7('0x14')][_0xc7e7('0x12')]);}})[_0xc7e7('0x15')](function(_0x229208){logger['error'](_0xc7e7('0xb'),_0x3d9476,_0x229208);_0x1ec2aa(_0x229208);});});}exports['GetSalesforceAccount']=function(_0x490f69){var _0x4c023a=this;return new Promise(function(_0x1c01ef,_0x42713a){return db['SalesforceAccount']['findAll']({'raw':_0x490f69[_0xc7e7('0x16')]?_0x490f69[_0xc7e7('0x16')][_0xc7e7('0x17')]===undefined?!![]:![]:!![],'where':_0x490f69[_0xc7e7('0x16')]?_0x490f69[_0xc7e7('0x16')][_0xc7e7('0x18')]||null:null,'attributes':_0x490f69[_0xc7e7('0x16')]?_0x490f69[_0xc7e7('0x16')][_0xc7e7('0x19')]||null:null,'limit':_0x490f69[_0xc7e7('0x16')]?_0x490f69[_0xc7e7('0x16')][_0xc7e7('0x1a')]||null:null,'include':_0x490f69['options']?_0x490f69[_0xc7e7('0x16')][_0xc7e7('0x1b')]?_['map'](_0x490f69[_0xc7e7('0x16')]['include'],function(_0x171de0){return{'model':db[_0x171de0[_0xc7e7('0x1c')]],'as':_0x171de0['as'],'attributes':_0x171de0[_0xc7e7('0x19')],'include':_0x171de0[_0xc7e7('0x1b')]?_[_0xc7e7('0x1d')](_0x171de0[_0xc7e7('0x1b')],function(_0x598255){return{'model':db[_0x598255[_0xc7e7('0x1c')]],'as':_0x598255['as'],'attributes':_0x598255[_0xc7e7('0x19')],'include':_0x598255['include']?_[_0xc7e7('0x1d')](_0x598255['include'],function(_0x42e83a){return{'model':db[_0x42e83a[_0xc7e7('0x1c')]],'as':_0x42e83a['as'],'attributes':_0x42e83a['attributes']};}):[]};}):[]};}):[]:[]})[_0xc7e7('0x1e')](function(_0x28343c){logger[_0xc7e7('0x13')](_0xc7e7('0x1f'),_0x490f69);logger[_0xc7e7('0xd')](_0xc7e7('0x1f'),_0x490f69,JSON[_0xc7e7('0xf')](_0x28343c));_0x1c01ef(_0x28343c);})[_0xc7e7('0x15')](function(_0x3f0c68){logger[_0xc7e7('0x10')](_0xc7e7('0x1f'),_0x3f0c68[_0xc7e7('0x12')],_0x490f69);_0x42713a(_0x4c023a['error'](0x1f4,_0x3f0c68['message']));});});};exports[_0xc7e7('0x20')]=function(_0x49ed8b){var _0x1b6387=this;return new Promise(function(_0x22bd09,_0x528b67){return db[_0xc7e7('0x21')][_0xc7e7('0x22')]({'raw':_0x49ed8b[_0xc7e7('0x16')]?_0x49ed8b[_0xc7e7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x49ed8b['options']?_0x49ed8b[_0xc7e7('0x16')][_0xc7e7('0x18')]||null:null,'attributes':_0x49ed8b[_0xc7e7('0x16')]?_0x49ed8b['options'][_0xc7e7('0x19')]||null:null,'include':_0x49ed8b[_0xc7e7('0x16')]?_0x49ed8b[_0xc7e7('0x16')]['include']?_[_0xc7e7('0x1d')](_0x49ed8b[_0xc7e7('0x16')][_0xc7e7('0x1b')],function(_0x279af1){return{'model':db[_0x279af1[_0xc7e7('0x1c')]],'as':_0x279af1['as'],'attributes':_0x279af1[_0xc7e7('0x19')],'include':_0x279af1[_0xc7e7('0x1b')]?_['map'](_0x279af1[_0xc7e7('0x1b')],function(_0x7e21e2){return{'model':db[_0x7e21e2[_0xc7e7('0x1c')]],'as':_0x7e21e2['as'],'attributes':_0x7e21e2[_0xc7e7('0x19')],'include':_0x7e21e2['include']?_[_0xc7e7('0x1d')](_0x7e21e2[_0xc7e7('0x1b')],function(_0x362435){return{'model':db[_0x362435[_0xc7e7('0x1c')]],'as':_0x362435['as'],'attributes':_0x362435[_0xc7e7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc7e7('0x1e')](function(_0x12b1d1){logger['info'](_0xc7e7('0x20'),_0x49ed8b);logger[_0xc7e7('0xd')](_0xc7e7('0x20'),_0x49ed8b,JSON[_0xc7e7('0xf')](_0x12b1d1));_0x22bd09(_0x12b1d1);})['catch'](function(_0x2115e2){logger[_0xc7e7('0x10')](_0xc7e7('0x20'),_0x2115e2[_0xc7e7('0x12')],_0x49ed8b);_0x528b67(_0x1b6387[_0xc7e7('0x10')](0x1f4,_0x2115e2[_0xc7e7('0x12')]));});});}; \ No newline at end of file +var _0xf682=['options','raw','where','attributes','limit','include','map','model','catch','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','SalesforceAccount'];(function(_0x591ef1,_0x275512){var _0x1d382c=function(_0x568252){while(--_0x568252){_0x591ef1['push'](_0x591ef1['shift']());}};_0x1d382c(++_0x275512);}(_0xf682,0x156));var _0x2f68=function(_0x4204ef,_0x5973f5){_0x4204ef=_0x4204ef-0x0;var _0x55823d=_0xf682[_0x4204ef];return _0x55823d;};'use strict';var _=require(_0x2f68('0x0'));var util=require(_0x2f68('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2f68('0x2'));var fs=require('fs');var Redis=require(_0x2f68('0x3'));var db=require(_0x2f68('0x4'))['db'];var utils=require(_0x2f68('0x5'));var logger=require(_0x2f68('0x6'))(_0x2f68('0x7'));var config=require(_0x2f68('0x8'));var jayson=require(_0x2f68('0x9'));var client=jayson['client'][_0x2f68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x155ab2,_0x1f52f0,_0x5d72e5){return new BPromise(function(_0x55146d,_0xabc11b){return client['request'](_0x155ab2,_0x5d72e5)[_0x2f68('0xb')](function(_0x90a379){logger['info'](_0x2f68('0xc'),_0x1f52f0,_0x2f68('0xd'));logger[_0x2f68('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1f52f0,'request\x20sent',JSON[_0x2f68('0xf')](_0x90a379));if(_0x90a379[_0x2f68('0x10')]){if(_0x90a379['error'][_0x2f68('0x11')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x1f52f0,_0x90a379[_0x2f68('0x10')][_0x2f68('0x12')]);return _0xabc11b(_0x90a379[_0x2f68('0x10')]['message']);}logger[_0x2f68('0x10')](_0x2f68('0xc'),_0x1f52f0,_0x90a379[_0x2f68('0x10')][_0x2f68('0x12')]);return _0x55146d(_0x90a379['error'][_0x2f68('0x12')]);}else{logger[_0x2f68('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x1f52f0,_0x2f68('0xd'));_0x55146d(_0x90a379['result'][_0x2f68('0x12')]);}})['catch'](function(_0x343938){logger['error'](_0x2f68('0xc'),_0x1f52f0,_0x343938);_0xabc11b(_0x343938);});});}exports['GetSalesforceAccount']=function(_0x5ab732){var _0x2d2e77=this;return new Promise(function(_0xbf9236,_0x18da08){return db[_0x2f68('0x14')]['findAll']({'raw':_0x5ab732[_0x2f68('0x15')]?_0x5ab732[_0x2f68('0x15')][_0x2f68('0x16')]===undefined?!![]:![]:!![],'where':_0x5ab732[_0x2f68('0x15')]?_0x5ab732[_0x2f68('0x15')][_0x2f68('0x17')]||null:null,'attributes':_0x5ab732['options']?_0x5ab732[_0x2f68('0x15')][_0x2f68('0x18')]||null:null,'limit':_0x5ab732[_0x2f68('0x15')]?_0x5ab732[_0x2f68('0x15')][_0x2f68('0x19')]||null:null,'include':_0x5ab732[_0x2f68('0x15')]?_0x5ab732[_0x2f68('0x15')][_0x2f68('0x1a')]?_[_0x2f68('0x1b')](_0x5ab732[_0x2f68('0x15')]['include'],function(_0x46977b){return{'model':db[_0x46977b[_0x2f68('0x1c')]],'as':_0x46977b['as'],'attributes':_0x46977b['attributes'],'include':_0x46977b['include']?_['map'](_0x46977b[_0x2f68('0x1a')],function(_0x35c7f9){return{'model':db[_0x35c7f9[_0x2f68('0x1c')]],'as':_0x35c7f9['as'],'attributes':_0x35c7f9[_0x2f68('0x18')],'include':_0x35c7f9['include']?_[_0x2f68('0x1b')](_0x35c7f9[_0x2f68('0x1a')],function(_0x448fa4){return{'model':db[_0x448fa4['model']],'as':_0x448fa4['as'],'attributes':_0x448fa4['attributes']};}):[]};}):[]};}):[]:[]})[_0x2f68('0xb')](function(_0xabd613){logger['info']('GetSalesforceAccount',_0x5ab732);logger[_0x2f68('0xe')]('GetSalesforceAccount',_0x5ab732,JSON[_0x2f68('0xf')](_0xabd613));_0xbf9236(_0xabd613);})[_0x2f68('0x1d')](function(_0x3b04e7){logger[_0x2f68('0x10')](_0x2f68('0x1e'),_0x3b04e7[_0x2f68('0x12')],_0x5ab732);_0x18da08(_0x2d2e77[_0x2f68('0x10')](0x1f4,_0x3b04e7[_0x2f68('0x12')]));});});};exports[_0x2f68('0x1f')]=function(_0x2f9bd1){var _0x5cbdd8=this;return new Promise(function(_0x1da0e1,_0x4e1418){return db[_0x2f68('0x14')][_0x2f68('0x20')]({'raw':_0x2f9bd1[_0x2f68('0x15')]?_0x2f9bd1[_0x2f68('0x15')][_0x2f68('0x16')]===undefined?!![]:![]:!![],'where':_0x2f9bd1[_0x2f68('0x15')]?_0x2f9bd1[_0x2f68('0x15')][_0x2f68('0x17')]||null:null,'attributes':_0x2f9bd1[_0x2f68('0x15')]?_0x2f9bd1[_0x2f68('0x15')][_0x2f68('0x18')]||null:null,'include':_0x2f9bd1['options']?_0x2f9bd1['options'][_0x2f68('0x1a')]?_[_0x2f68('0x1b')](_0x2f9bd1[_0x2f68('0x15')][_0x2f68('0x1a')],function(_0x536609){return{'model':db[_0x536609[_0x2f68('0x1c')]],'as':_0x536609['as'],'attributes':_0x536609[_0x2f68('0x18')],'include':_0x536609[_0x2f68('0x1a')]?_[_0x2f68('0x1b')](_0x536609[_0x2f68('0x1a')],function(_0x73c478){return{'model':db[_0x73c478[_0x2f68('0x1c')]],'as':_0x73c478['as'],'attributes':_0x73c478[_0x2f68('0x18')],'include':_0x73c478['include']?_[_0x2f68('0x1b')](_0x73c478['include'],function(_0x4a1291){return{'model':db[_0x4a1291['model']],'as':_0x4a1291['as'],'attributes':_0x4a1291[_0x2f68('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2f68('0xb')](function(_0x115056){logger[_0x2f68('0x13')](_0x2f68('0x1f'),_0x2f9bd1);logger[_0x2f68('0xe')](_0x2f68('0x1f'),_0x2f9bd1,JSON['stringify'](_0x115056));_0x1da0e1(_0x115056);})[_0x2f68('0x1d')](function(_0x1189a5){logger[_0x2f68('0x10')](_0x2f68('0x1f'),_0x1189a5[_0x2f68('0x12')],_0x2f9bd1);_0x4e1418(_0x5cbdd8[_0x2f68('0x10')](0x1f4,_0x1189a5['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 609c6f0..97f1cbd 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 _0xf0f9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4a0c33,_0x5686bb){var _0x6488f9=function(_0x3bbd97){while(--_0x3bbd97){_0x4a0c33['push'](_0x4a0c33['shift']());}};_0x6488f9(++_0x5686bb);}(_0xf0f9,0x14a));var _0x9f0f=function(_0xd33edd,_0x24d299){_0xd33edd=_0xd33edd-0x0;var _0x4edc2e=_0xf0f9[_0xd33edd];return _0x4edc2e;};'use strict';var multer=require(_0x9f0f('0x0'));var util=require(_0x9f0f('0x1'));var path=require(_0x9f0f('0x2'));var timeout=require(_0x9f0f('0x3'));var express=require(_0x9f0f('0x4'));var router=express[_0x9f0f('0x5')]();var auth=require(_0x9f0f('0x6'));var interaction=require(_0x9f0f('0x7'));var config=require(_0x9f0f('0x8'));var controller=require(_0x9f0f('0x9'));router['get']('/',auth[_0x9f0f('0xa')](),controller['index']);router[_0x9f0f('0xb')](_0x9f0f('0xc'),auth['isAuthenticated'](),controller[_0x9f0f('0xd')]);router[_0x9f0f('0xb')](_0x9f0f('0xe'),auth[_0x9f0f('0xa')](),controller[_0x9f0f('0xf')]);router[_0x9f0f('0xb')](_0x9f0f('0x10'),auth['isAuthenticated'](),controller[_0x9f0f('0x11')]);router[_0x9f0f('0xb')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9f0f('0x12')]);router[_0x9f0f('0x13')]('/',auth[_0x9f0f('0xa')](),controller['create']);router[_0x9f0f('0x14')](_0x9f0f('0xc'),auth[_0x9f0f('0xa')](),controller['update']);router[_0x9f0f('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x9f0f('0x16')]);module[_0x9f0f('0x17')]=router; \ No newline at end of file +var _0xa039=['/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show'];(function(_0x54c9cc,_0x2e6a60){var _0x3a9d80=function(_0x3d14b8){while(--_0x3d14b8){_0x54c9cc['push'](_0x54c9cc['shift']());}};_0x3a9d80(++_0x2e6a60);}(_0xa039,0x1c4));var _0x9a03=function(_0xdc66ce,_0x58300f){_0xdc66ce=_0xdc66ce-0x0;var _0x33d344=_0xa039[_0xdc66ce];return _0x33d344;};'use strict';var multer=require('multer');var util=require(_0x9a03('0x0'));var path=require('path');var timeout=require(_0x9a03('0x1'));var express=require(_0x9a03('0x2'));var router=express[_0x9a03('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9a03('0x4'));var config=require(_0x9a03('0x5'));var controller=require('./intSalesforceConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9a03('0x6')]);router[_0x9a03('0x7')]('/:id',auth[_0x9a03('0x8')](),controller[_0x9a03('0x9')]);router[_0x9a03('0x7')](_0x9a03('0xa'),auth[_0x9a03('0x8')](),controller[_0x9a03('0xb')]);router[_0x9a03('0x7')](_0x9a03('0xc'),auth[_0x9a03('0x8')](),controller['getSubjects']);router['get'](_0x9a03('0xd'),auth[_0x9a03('0x8')](),controller[_0x9a03('0xe')]);router[_0x9a03('0xf')]('/',auth['isAuthenticated'](),controller[_0x9a03('0x10')]);router['put'](_0x9a03('0x11'),auth[_0x9a03('0x8')](),controller[_0x9a03('0x12')]);router[_0x9a03('0x13')](_0x9a03('0x11'),auth[_0x9a03('0x8')](),controller[_0x9a03('0x14')]);module[_0x9a03('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b730a09..7338f89 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 _0xe9d1=['contact_lead','contact','lead','nothing','sequelize','exports','STRING','Case','Task','ENUM'];(function(_0x3068c8,_0x1f5504){var _0x40c6e4=function(_0x4e1f11){while(--_0x4e1f11){_0x3068c8['push'](_0x3068c8['shift']());}};_0x40c6e4(++_0x1f5504);}(_0xe9d1,0x1bc));var _0x1e9d=function(_0x1df831,_0x406ce9){_0x1df831=_0x1df831-0x0;var _0x4c68c6=_0xe9d1[_0x1df831];return _0x4c68c6;};'use strict';var Sequelize=require(_0x1e9d('0x0'));module[_0x1e9d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1e9d('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x1e9d('0x3')),'defaultValue':_0x1e9d('0x4')},'moduleSearch':{'type':Sequelize[_0x1e9d('0x5')](_0x1e9d('0x6'),_0x1e9d('0x7'),_0x1e9d('0x8')),'defaultValue':_0x1e9d('0x6')},'moduleCreate':{'type':Sequelize[_0x1e9d('0x5')](_0x1e9d('0x9'),_0x1e9d('0x7'),'lead'),'defaultValue':_0x1e9d('0x8')}}; \ No newline at end of file +var _0xe945=['Task','contact_lead','contact','lead','sequelize','exports','STRING','ENUM'];(function(_0x5ace17,_0x4cddc1){var _0x1b1b18=function(_0x30aecb){while(--_0x30aecb){_0x5ace17['push'](_0x5ace17['shift']());}};_0x1b1b18(++_0x4cddc1);}(_0xe945,0x174));var _0x5e94=function(_0x174d3e,_0x1507bc){_0x174d3e=_0x174d3e-0x0;var _0x43f2bc=_0xe945[_0x174d3e];return _0x43f2bc;};'use strict';var Sequelize=require(_0x5e94('0x0'));module[_0x5e94('0x1')]={'name':{'type':Sequelize[_0x5e94('0x2')]},'description':{'type':Sequelize[_0x5e94('0x2')]},'ticketType':{'type':Sequelize[_0x5e94('0x3')](_0x5e94('0x4'),'Case'),'defaultValue':_0x5e94('0x4')},'moduleSearch':{'type':Sequelize[_0x5e94('0x3')](_0x5e94('0x5'),_0x5e94('0x6'),_0x5e94('0x7')),'defaultValue':_0x5e94('0x5')},'moduleCreate':{'type':Sequelize[_0x5e94('0x3')]('nothing','contact',_0x5e94('0x7')),'defaultValue':_0x5e94('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 84455f0..2a53136 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 _0xe14b=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','field','SalesforceConfiguration','findAll','rows','show','params','rawAttributes','includeAll','include','options','find','catch','create','body','getFields','findOne','SalesforceField','filter','map','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info'];(function(_0x4cd9b6,_0x216d40){var _0x291645=function(_0x3b2720){while(--_0x3b2720){_0x4cd9b6['push'](_0x4cd9b6['shift']());}};_0x291645(++_0x216d40);}(_0xe14b,0x93));var _0xbe14=function(_0x2f68b3,_0x304342){_0x2f68b3=_0x2f68b3-0x0;var _0x4f93dc=_0xe14b[_0x2f68b3];return _0x4f93dc;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var authService=require(_0xbe14('0xe'));var hardwareService=require(_0xbe14('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x10'))(_0xbe14('0x11'));var utils=require('../../config/utils');var config=require(_0xbe14('0x12'));var db=require(_0xbe14('0x13'))['db'];var jayson=require(_0xbe14('0x14'));var client=jayson[_0xbe14('0x15')][_0xbe14('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3b898d,_0x23a730,_0x2850cb,_0x16893f){return new BPromise(function(_0xa2cf72,_0x1e4826){var _0x33fd54=_0x16893f||client;return _0x33fd54[_0xbe14('0x17')](_0x3b898d,_0x2850cb)['then'](function(_0x55b3a7){logger[_0xbe14('0x18')](_0xbe14('0x19'),_0x23a730,_0xbe14('0x1a'));logger[_0xbe14('0x1b')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x23a730,_0xbe14('0x1a'),JSON[_0xbe14('0x1c')](_0x55b3a7));if(_0x55b3a7[_0xbe14('0x1d')]){if(_0x55b3a7[_0xbe14('0x1d')][_0xbe14('0x1e')]===0x1f4){logger[_0xbe14('0x1d')](_0xbe14('0x19'),_0x23a730,_0x55b3a7['error'][_0xbe14('0x1f')]);return _0x1e4826(_0x55b3a7[_0xbe14('0x1d')][_0xbe14('0x1f')]);}logger[_0xbe14('0x1d')](_0xbe14('0x19'),_0x23a730,_0x55b3a7[_0xbe14('0x1d')]['message']);return _0xa2cf72(_0x55b3a7[_0xbe14('0x1d')][_0xbe14('0x1f')]);}else{logger[_0xbe14('0x18')](_0xbe14('0x19'),_0x23a730,_0xbe14('0x1a'));_0xa2cf72(_0x55b3a7['result'][_0xbe14('0x1f')]);}})['catch'](function(_0x3c1c85){logger['error'](_0xbe14('0x19'),_0x23a730,_0x3c1c85);_0x1e4826(_0x3c1c85);});});}function respondWithStatusCode(_0x4a25fa,_0x274018){_0x274018=_0x274018||0xcc;return function(_0x3d3608){if(_0x3d3608){return _0x4a25fa['sendStatus'](_0x274018);}return _0x4a25fa[_0xbe14('0x20')](_0x274018)['end']();};}function respondWithResult(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0xc8;return function(_0x36a21e){if(_0x36a21e){return _0x4587a8[_0xbe14('0x20')](_0x4851f8)[_0xbe14('0x21')](_0x36a21e);}};}function respondWithFilteredResult(_0x39cc81,_0x15ef02){return function(_0x2703f5){if(_0x2703f5){var _0x55d001=_0x2703f5[_0xbe14('0x22')],_0x1822e0=_0x15ef02['offset'],_0x1ba46a=_0x15ef02[_0xbe14('0x23')]+_0x15ef02[_0xbe14('0x24')],_0x391556;if(_0x1ba46a>=_0x55d001){_0x1ba46a=_0x55d001;_0x391556=0xc8;}else{_0x391556=0xce;}_0x39cc81['status'](_0x391556);return _0x39cc81[_0xbe14('0x25')](_0xbe14('0x26'),_0x1822e0+'-'+_0x1ba46a+'/'+_0x55d001)[_0xbe14('0x21')](_0x2703f5);}return null;};}function patchUpdates(_0x19252f){return function(_0x34d648){try{jsonpatch[_0xbe14('0x27')](_0x34d648,_0x19252f,!![]);}catch(_0x31a664){return BPromise[_0xbe14('0x28')](_0x31a664);}return _0x34d648[_0xbe14('0x29')]();};}function saveUpdates(_0x16a159,_0x40538f){return function(_0x3bf43c){if(_0x3bf43c){return _0x3bf43c[_0xbe14('0x2a')](_0x16a159)[_0xbe14('0x2b')](function(_0x223f7a){return _0x223f7a;});}return null;};}function removeEntity(_0xe6feb2,_0x6ba36c){return function(_0x2ff48e){if(_0x2ff48e){return _0x2ff48e[_0xbe14('0x2c')]()[_0xbe14('0x2b')](function(){_0xe6feb2['status'](0xcc)[_0xbe14('0x2d')]();});}};}function handleEntityNotFound(_0x499793,_0x58f8de){return function(_0x46c2d1){if(!_0x46c2d1){_0x499793['sendStatus'](0x194);}return _0x46c2d1;};}function handleError(_0x243524,_0x345b0){_0x345b0=_0x345b0||0x1f4;return function(_0x52a25c){logger['error'](_0x52a25c['stack']);if(_0x52a25c[_0xbe14('0x2e')]){delete _0x52a25c[_0xbe14('0x2e')];}_0x243524['status'](_0x345b0)[_0xbe14('0x2f')](_0x52a25c);};}exports[_0xbe14('0x30')]=function(_0x452635,_0x1aa849){var _0x29c23e={},_0x5ef1e5={},_0x591a36={'count':0x0,'rows':[]};var _0x15a997=db['SalesforceConfiguration']['rawAttributes'];_0x5ef1e5['model']=_[_0xbe14('0x31')](_0x15a997);_0x5ef1e5[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x452635[_0xbe14('0x32')]);_0x5ef1e5[_0xbe14('0x33')]=_[_0xbe14('0x34')](_0x5ef1e5[_0xbe14('0x35')],_0x5ef1e5[_0xbe14('0x32')]);_0x29c23e[_0xbe14('0x36')]=_[_0xbe14('0x34')](_0x5ef1e5[_0xbe14('0x35')],qs[_0xbe14('0x37')](_0x452635['query']['fields']));_0x29c23e[_0xbe14('0x36')]=_0x29c23e[_0xbe14('0x36')][_0xbe14('0x38')]?_0x29c23e['attributes']:_0x5ef1e5[_0xbe14('0x35')];if(!_0x452635[_0xbe14('0x32')][_0xbe14('0x39')](_0xbe14('0x3a'))){_0x29c23e[_0xbe14('0x24')]=qs[_0xbe14('0x24')](_0x452635[_0xbe14('0x32')][_0xbe14('0x24')]);_0x29c23e[_0xbe14('0x23')]=qs['offset'](_0x452635[_0xbe14('0x32')][_0xbe14('0x23')]);}_0x29c23e[_0xbe14('0x3b')]=qs[_0xbe14('0x3c')](_0x452635[_0xbe14('0x32')][_0xbe14('0x3c')]);_0x29c23e['where']=qs[_0xbe14('0x33')](_[_0xbe14('0x3d')](_0x452635[_0xbe14('0x32')],_0x5ef1e5[_0xbe14('0x33')]));if(_0x452635['query']['filter']){_0x29c23e[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x29c23e[_0xbe14('0x3e')],{'$or':_['map'](_0x15a997,function(_0x5d5318){if(_0x5d5318[_0xbe14('0x40')]['key']!=='VIRTUAL'){var _0x3593f8={};_0x3593f8[_0x5d5318[_0xbe14('0x41')]]={'$like':'%'+_0x452635[_0xbe14('0x32')]['filter']+'%'};return _0x3593f8;}})});}_0x29c23e=_['merge']({},_0x29c23e,_0x452635['options']);var _0x46fee8={'where':_0x29c23e[_0xbe14('0x3e')]};return db[_0xbe14('0x42')]['count'](_0x46fee8)[_0xbe14('0x2b')](function(_0xcb0680){_0x591a36[_0xbe14('0x22')]=_0xcb0680;if(_0x452635[_0xbe14('0x32')]['includeAll']){_0x29c23e['include']=[{'all':!![]}];}return db[_0xbe14('0x42')][_0xbe14('0x43')](_0x29c23e);})[_0xbe14('0x2b')](function(_0xb2b285){_0x591a36[_0xbe14('0x44')]=_0xb2b285;return _0x591a36;})['then'](respondWithFilteredResult(_0x1aa849,_0x29c23e))['catch'](handleError(_0x1aa849,null));};exports[_0xbe14('0x45')]=function(_0x2a3623,_0x238c60){var _0x2a3b35={'raw':![],'where':{'id':_0x2a3623[_0xbe14('0x46')]['id']}},_0x4e65d2={};_0x4e65d2[_0xbe14('0x35')]=_['keys'](db[_0xbe14('0x42')][_0xbe14('0x47')]);_0x4e65d2[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x2a3623['query']);_0x4e65d2['filters']=_[_0xbe14('0x34')](_0x4e65d2[_0xbe14('0x35')],_0x4e65d2['query']);_0x2a3b35['attributes']=_[_0xbe14('0x34')](_0x4e65d2[_0xbe14('0x35')],qs[_0xbe14('0x37')](_0x2a3623[_0xbe14('0x32')][_0xbe14('0x37')]));_0x2a3b35[_0xbe14('0x36')]=_0x2a3b35[_0xbe14('0x36')]['length']?_0x2a3b35[_0xbe14('0x36')]:_0x4e65d2[_0xbe14('0x35')];if(_0x2a3623[_0xbe14('0x32')][_0xbe14('0x48')]){_0x2a3b35[_0xbe14('0x49')]=[{'all':!![]}];}_0x2a3b35=_['merge']({},_0x2a3b35,_0x2a3623[_0xbe14('0x4a')]);return db[_0xbe14('0x42')][_0xbe14('0x4b')](_0x2a3b35)[_0xbe14('0x2b')](handleEntityNotFound(_0x238c60,null))[_0xbe14('0x2b')](respondWithResult(_0x238c60,null))[_0xbe14('0x4c')](handleError(_0x238c60,null));};exports['create']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x42')][_0xbe14('0x4d')](_0x5aeea9['body'],{})['then'](respondWithResult(_0x3a49f7,0xc9))[_0xbe14('0x4c')](handleError(_0x3a49f7,null));};exports[_0xbe14('0x2a')]=function(_0x50d78f,_0x339a86){if(_0x50d78f[_0xbe14('0x4e')]['id']){delete _0x50d78f['body']['id'];}return db[_0xbe14('0x42')]['find']({'where':{'id':_0x50d78f[_0xbe14('0x46')]['id']}})[_0xbe14('0x2b')](handleEntityNotFound(_0x339a86,null))[_0xbe14('0x2b')](saveUpdates(_0x50d78f['body'],null))[_0xbe14('0x2b')](respondWithResult(_0x339a86,null))[_0xbe14('0x4c')](handleError(_0x339a86,null));};exports['destroy']=function(_0x27f24b,_0x42ca15){return db[_0xbe14('0x42')][_0xbe14('0x4b')]({'where':{'id':_0x27f24b[_0xbe14('0x46')]['id']}})['then'](handleEntityNotFound(_0x42ca15,null))[_0xbe14('0x2b')](removeEntity(_0x42ca15,null))[_0xbe14('0x4c')](handleError(_0x42ca15,null));};exports[_0xbe14('0x4f')]=function(_0x243b9e,_0x32968f,_0x44084c){var _0x1dd6c7={};var _0x56ab61={};var _0x72c875;var _0x1b47a4;return db[_0xbe14('0x42')][_0xbe14('0x50')]({'where':{'id':_0x243b9e[_0xbe14('0x46')]['id']}})[_0xbe14('0x2b')](handleEntityNotFound(_0x32968f,null))[_0xbe14('0x2b')](function(_0x32df3c){if(_0x32df3c){_0x72c875=_0x32df3c;_0x56ab61[_0xbe14('0x35')]=_[_0xbe14('0x31')](db[_0xbe14('0x51')]['rawAttributes']);_0x56ab61['query']=_['keys'](_0x243b9e[_0xbe14('0x32')]);_0x56ab61[_0xbe14('0x33')]=_[_0xbe14('0x34')](_0x56ab61[_0xbe14('0x35')],_0x56ab61[_0xbe14('0x32')]);_0x1dd6c7[_0xbe14('0x36')]=_[_0xbe14('0x34')](_0x56ab61[_0xbe14('0x35')],qs[_0xbe14('0x37')](_0x243b9e[_0xbe14('0x32')][_0xbe14('0x37')]));_0x1dd6c7[_0xbe14('0x36')]=_0x1dd6c7[_0xbe14('0x36')][_0xbe14('0x38')]?_0x1dd6c7[_0xbe14('0x36')]:_0x56ab61[_0xbe14('0x35')];_0x1dd6c7[_0xbe14('0x3b')]=qs[_0xbe14('0x3c')](_0x243b9e[_0xbe14('0x32')][_0xbe14('0x3c')]);_0x1dd6c7['where']=qs[_0xbe14('0x33')](_[_0xbe14('0x3d')](_0x243b9e[_0xbe14('0x32')],_0x56ab61[_0xbe14('0x33')]));if(_0x243b9e[_0xbe14('0x32')][_0xbe14('0x52')]){_0x1dd6c7[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x1dd6c7[_0xbe14('0x3e')],{'$or':_[_0xbe14('0x53')](_0x1dd6c7['attributes'],function(_0x18be56){var _0x442ec4={};_0x442ec4[_0x18be56]={'$like':'%'+_0x243b9e[_0xbe14('0x32')][_0xbe14('0x52')]+'%'};return _0x442ec4;})});}_0x1dd6c7=_[_0xbe14('0x3f')]({},_0x1dd6c7,_0x243b9e['options']);return _0x72c875[_0xbe14('0x4f')](_0x1dd6c7);}})[_0xbe14('0x2b')](function(_0x3d186b){if(_0x3d186b){_0x1b47a4=_0x3d186b[_0xbe14('0x38')];if(!_0x243b9e[_0xbe14('0x32')]['hasOwnProperty'](_0xbe14('0x3a'))){_0x1dd6c7[_0xbe14('0x24')]=qs[_0xbe14('0x24')](_0x243b9e[_0xbe14('0x32')][_0xbe14('0x24')]);_0x1dd6c7[_0xbe14('0x23')]=qs[_0xbe14('0x23')](_0x243b9e[_0xbe14('0x32')]['offset']);}return _0x72c875[_0xbe14('0x4f')](_0x1dd6c7);}})[_0xbe14('0x2b')](function(_0x2fdf5d){if(_0x2fdf5d){return _0x2fdf5d?{'count':_0x1b47a4,'rows':_0x2fdf5d}:null;}})[_0xbe14('0x2b')](respondWithResult(_0x32968f,null))[_0xbe14('0x4c')](handleError(_0x32968f,null));};exports[_0xbe14('0x54')]=function(_0x445302,_0x566096,_0x4eedd2){var _0x12941d={};var _0x3c2b58={};var _0x2d2643;var _0x2510a0;return db[_0xbe14('0x42')][_0xbe14('0x50')]({'where':{'id':_0x445302[_0xbe14('0x46')]['id']}})[_0xbe14('0x2b')](handleEntityNotFound(_0x566096,null))['then'](function(_0x5ca835){if(_0x5ca835){_0x2d2643=_0x5ca835;_0x3c2b58[_0xbe14('0x35')]=_[_0xbe14('0x31')](db[_0xbe14('0x51')]['rawAttributes']);_0x3c2b58[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x445302[_0xbe14('0x32')]);_0x3c2b58[_0xbe14('0x33')]=_[_0xbe14('0x34')](_0x3c2b58[_0xbe14('0x35')],_0x3c2b58[_0xbe14('0x32')]);_0x12941d['attributes']=_[_0xbe14('0x34')](_0x3c2b58[_0xbe14('0x35')],qs[_0xbe14('0x37')](_0x445302[_0xbe14('0x32')][_0xbe14('0x37')]));_0x12941d[_0xbe14('0x36')]=_0x12941d[_0xbe14('0x36')]['length']?_0x12941d[_0xbe14('0x36')]:_0x3c2b58[_0xbe14('0x35')];_0x12941d[_0xbe14('0x3b')]=qs[_0xbe14('0x3c')](_0x445302[_0xbe14('0x32')][_0xbe14('0x3c')]);_0x12941d[_0xbe14('0x3e')]=qs[_0xbe14('0x33')](_['pick'](_0x445302[_0xbe14('0x32')],_0x3c2b58[_0xbe14('0x33')]));if(_0x445302[_0xbe14('0x32')][_0xbe14('0x52')]){_0x12941d[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x12941d['where'],{'$or':_[_0xbe14('0x53')](_0x12941d[_0xbe14('0x36')],function(_0x1edc66){var _0x1b23a1={};_0x1b23a1[_0x1edc66]={'$like':'%'+_0x445302['query'][_0xbe14('0x52')]+'%'};return _0x1b23a1;})});}_0x12941d=_[_0xbe14('0x3f')]({},_0x12941d,_0x445302[_0xbe14('0x4a')]);return _0x2d2643[_0xbe14('0x54')](_0x12941d);}})[_0xbe14('0x2b')](function(_0x3d54e4){if(_0x3d54e4){_0x2510a0=_0x3d54e4[_0xbe14('0x38')];if(!_0x445302['query'][_0xbe14('0x39')]('nolimit')){_0x12941d[_0xbe14('0x24')]=qs['limit'](_0x445302[_0xbe14('0x32')][_0xbe14('0x24')]);_0x12941d[_0xbe14('0x23')]=qs['offset'](_0x445302[_0xbe14('0x32')][_0xbe14('0x23')]);}return _0x2d2643[_0xbe14('0x54')](_0x12941d);}})['then'](function(_0x41a896){if(_0x41a896){return _0x41a896?{'count':_0x2510a0,'rows':_0x41a896}:null;}})[_0xbe14('0x2b')](respondWithResult(_0x566096,null))[_0xbe14('0x4c')](handleError(_0x566096,null));};exports[_0xbe14('0x55')]=function(_0x568177,_0x3c0294,_0x39bc54){var _0x34f90b={};var _0x2b2e0e={};var _0x1dd5c0;var _0x2b9732;return db[_0xbe14('0x42')]['findOne']({'where':{'id':_0x568177[_0xbe14('0x46')]['id']}})[_0xbe14('0x2b')](handleEntityNotFound(_0x3c0294,null))[_0xbe14('0x2b')](function(_0x5c89a0){if(_0x5c89a0){_0x1dd5c0=_0x5c89a0;_0x2b2e0e[_0xbe14('0x35')]=_[_0xbe14('0x31')](db[_0xbe14('0x51')]['rawAttributes']);_0x2b2e0e[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x568177['query']);_0x2b2e0e[_0xbe14('0x33')]=_['intersection'](_0x2b2e0e[_0xbe14('0x35')],_0x2b2e0e[_0xbe14('0x32')]);_0x34f90b['attributes']=_['intersection'](_0x2b2e0e[_0xbe14('0x35')],qs[_0xbe14('0x37')](_0x568177[_0xbe14('0x32')]['fields']));_0x34f90b[_0xbe14('0x36')]=_0x34f90b[_0xbe14('0x36')][_0xbe14('0x38')]?_0x34f90b[_0xbe14('0x36')]:_0x2b2e0e['model'];_0x34f90b['order']=qs[_0xbe14('0x3c')](_0x568177[_0xbe14('0x32')][_0xbe14('0x3c')]);_0x34f90b[_0xbe14('0x3e')]=qs[_0xbe14('0x33')](_[_0xbe14('0x3d')](_0x568177[_0xbe14('0x32')],_0x2b2e0e['filters']));if(_0x568177[_0xbe14('0x32')]['filter']){_0x34f90b[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x34f90b[_0xbe14('0x3e')],{'$or':_[_0xbe14('0x53')](_0x34f90b['attributes'],function(_0x1e160b){var _0xa8dd0c={};_0xa8dd0c[_0x1e160b]={'$like':'%'+_0x568177[_0xbe14('0x32')]['filter']+'%'};return _0xa8dd0c;})});}_0x34f90b=_[_0xbe14('0x3f')]({},_0x34f90b,_0x568177[_0xbe14('0x4a')]);return _0x1dd5c0[_0xbe14('0x55')](_0x34f90b);}})[_0xbe14('0x2b')](function(_0x26d3ae){if(_0x26d3ae){_0x2b9732=_0x26d3ae[_0xbe14('0x38')];if(!_0x568177[_0xbe14('0x32')][_0xbe14('0x39')](_0xbe14('0x3a'))){_0x34f90b[_0xbe14('0x24')]=qs[_0xbe14('0x24')](_0x568177[_0xbe14('0x32')][_0xbe14('0x24')]);_0x34f90b[_0xbe14('0x23')]=qs[_0xbe14('0x23')](_0x568177[_0xbe14('0x32')][_0xbe14('0x23')]);}return _0x1dd5c0[_0xbe14('0x55')](_0x34f90b);}})[_0xbe14('0x2b')](function(_0x2ca6e6){if(_0x2ca6e6){return _0x2ca6e6?{'count':_0x2b9732,'rows':_0x2ca6e6}:null;}})['then'](respondWithResult(_0x3c0294,null))[_0xbe14('0x4c')](handleError(_0x3c0294,null));}; \ No newline at end of file +var _0x7217=['offset','limit','set','Content-Range','reject','destroy','stack','name','send','index','SalesforceConfiguration','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','getFields','hasOwnProperty','getSubjects','findOne','SalesforceField','getDescriptions','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','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SalesforceConfiguration,\x20%s,\x20%s','result','sendStatus','status','end','json'];(function(_0x2d655b,_0x59f843){var _0x3831ce=function(_0x389011){while(--_0x389011){_0x2d655b['push'](_0x2d655b['shift']());}};_0x3831ce(++_0x59f843);}(_0x7217,0x19e));var _0x7721=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7217[_0x110c3d];return _0x226d67;};'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 authService=require(_0x7721('0x12'));var hardwareService=require(_0x7721('0x13'));var Redis=require('ioredis');var qs=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'];var jayson=require(_0x7721('0x1a'));var client=jayson[_0x7721('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2911ec,_0x199930,_0x57ff6d,_0x109900){return new BPromise(function(_0x30da54,_0x3f01c5){var _0x2e9752=_0x109900||client;return _0x2e9752['request'](_0x2911ec,_0x57ff6d)[_0x7721('0x1c')](function(_0x25b1c0){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x199930,'request\x20sent');logger[_0x7721('0x1d')](_0x7721('0x1e'),_0x199930,_0x7721('0x1f'),JSON[_0x7721('0x20')](_0x25b1c0));if(_0x25b1c0['error']){if(_0x25b1c0[_0x7721('0x21')]['code']===0x1f4){logger[_0x7721('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x199930,_0x25b1c0[_0x7721('0x21')][_0x7721('0x22')]);return _0x3f01c5(_0x25b1c0[_0x7721('0x21')][_0x7721('0x22')]);}logger[_0x7721('0x21')](_0x7721('0x23'),_0x199930,_0x25b1c0[_0x7721('0x21')][_0x7721('0x22')]);return _0x30da54(_0x25b1c0[_0x7721('0x21')][_0x7721('0x22')]);}else{logger['info'](_0x7721('0x23'),_0x199930,_0x7721('0x1f'));_0x30da54(_0x25b1c0[_0x7721('0x24')][_0x7721('0x22')]);}})['catch'](function(_0x28f5a6){logger['error'](_0x7721('0x23'),_0x199930,_0x28f5a6);_0x3f01c5(_0x28f5a6);});});}function respondWithStatusCode(_0x288e3a,_0x3e8a4e){_0x3e8a4e=_0x3e8a4e||0xcc;return function(_0x1caad8){if(_0x1caad8){return _0x288e3a[_0x7721('0x25')](_0x3e8a4e);}return _0x288e3a[_0x7721('0x26')](_0x3e8a4e)[_0x7721('0x27')]();};}function respondWithResult(_0x5b4d74,_0x216f20){_0x216f20=_0x216f20||0xc8;return function(_0x1abedb){if(_0x1abedb){return _0x5b4d74[_0x7721('0x26')](_0x216f20)[_0x7721('0x28')](_0x1abedb);}};}function respondWithFilteredResult(_0x40d550,_0x16355a){return function(_0x424e05){if(_0x424e05){var _0xf753f1=_0x424e05['count'],_0x40f367=_0x16355a['offset'],_0x52316e=_0x16355a[_0x7721('0x29')]+_0x16355a[_0x7721('0x2a')],_0x258ddf;if(_0x52316e>=_0xf753f1){_0x52316e=_0xf753f1;_0x258ddf=0xc8;}else{_0x258ddf=0xce;}_0x40d550[_0x7721('0x26')](_0x258ddf);return _0x40d550[_0x7721('0x2b')](_0x7721('0x2c'),_0x40f367+'-'+_0x52316e+'/'+_0xf753f1)[_0x7721('0x28')](_0x424e05);}return null;};}function patchUpdates(_0xd7d703){return function(_0x1da2d8){try{jsonpatch['apply'](_0x1da2d8,_0xd7d703,!![]);}catch(_0x471651){return BPromise[_0x7721('0x2d')](_0x471651);}return _0x1da2d8['save']();};}function saveUpdates(_0x4a25c9,_0xfde9ec){return function(_0x220bbf){if(_0x220bbf){return _0x220bbf['update'](_0x4a25c9)[_0x7721('0x1c')](function(_0x4651b5){return _0x4651b5;});}return null;};}function removeEntity(_0x382821,_0x58d54b){return function(_0x3d9a32){if(_0x3d9a32){return _0x3d9a32[_0x7721('0x2e')]()[_0x7721('0x1c')](function(){_0x382821[_0x7721('0x26')](0xcc)[_0x7721('0x27')]();});}};}function handleEntityNotFound(_0x508202,_0x195ffb){return function(_0x3e4e56){if(!_0x3e4e56){_0x508202[_0x7721('0x25')](0x194);}return _0x3e4e56;};}function handleError(_0x5c5b33,_0x35de7a){_0x35de7a=_0x35de7a||0x1f4;return function(_0x213a2e){logger['error'](_0x213a2e[_0x7721('0x2f')]);if(_0x213a2e['name']){delete _0x213a2e[_0x7721('0x30')];}_0x5c5b33[_0x7721('0x26')](_0x35de7a)[_0x7721('0x31')](_0x213a2e);};}exports[_0x7721('0x32')]=function(_0x1c84c0,_0x13c635){var _0x2f1fe0={},_0x15545a={},_0x25bdd9={'count':0x0,'rows':[]};var _0x3a2eb7=db[_0x7721('0x33')]['rawAttributes'];_0x15545a[_0x7721('0x34')]=_['keys'](_0x3a2eb7);_0x15545a[_0x7721('0x35')]=_[_0x7721('0x36')](_0x1c84c0[_0x7721('0x35')]);_0x15545a[_0x7721('0x37')]=_[_0x7721('0x38')](_0x15545a[_0x7721('0x34')],_0x15545a['query']);_0x2f1fe0['attributes']=_['intersection'](_0x15545a['model'],qs[_0x7721('0x39')](_0x1c84c0[_0x7721('0x35')][_0x7721('0x39')]));_0x2f1fe0[_0x7721('0x3a')]=_0x2f1fe0['attributes'][_0x7721('0x3b')]?_0x2f1fe0['attributes']:_0x15545a[_0x7721('0x34')];if(!_0x1c84c0[_0x7721('0x35')]['hasOwnProperty'](_0x7721('0x3c'))){_0x2f1fe0[_0x7721('0x2a')]=qs['limit'](_0x1c84c0['query'][_0x7721('0x2a')]);_0x2f1fe0[_0x7721('0x29')]=qs[_0x7721('0x29')](_0x1c84c0[_0x7721('0x35')]['offset']);}_0x2f1fe0[_0x7721('0x3d')]=qs[_0x7721('0x3e')](_0x1c84c0[_0x7721('0x35')][_0x7721('0x3e')]);_0x2f1fe0[_0x7721('0x3f')]=qs['filters'](_[_0x7721('0x40')](_0x1c84c0['query'],_0x15545a[_0x7721('0x37')]));if(_0x1c84c0['query'][_0x7721('0x41')]){_0x2f1fe0[_0x7721('0x3f')]=_[_0x7721('0x42')](_0x2f1fe0['where'],{'$or':_[_0x7721('0x43')](_0x3a2eb7,function(_0x11d853){if(_0x11d853[_0x7721('0x44')]['key']!==_0x7721('0x45')){var _0x754071={};_0x754071[_0x11d853[_0x7721('0x46')]]={'$like':'%'+_0x1c84c0[_0x7721('0x35')][_0x7721('0x41')]+'%'};return _0x754071;}})});}_0x2f1fe0=_[_0x7721('0x42')]({},_0x2f1fe0,_0x1c84c0[_0x7721('0x47')]);var _0x4c76c3={'where':_0x2f1fe0['where']};return db[_0x7721('0x33')][_0x7721('0x48')](_0x4c76c3)[_0x7721('0x1c')](function(_0x39a3ad){_0x25bdd9[_0x7721('0x48')]=_0x39a3ad;if(_0x1c84c0[_0x7721('0x35')][_0x7721('0x49')]){_0x2f1fe0[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x33')][_0x7721('0x4b')](_0x2f1fe0);})['then'](function(_0x578867){_0x25bdd9[_0x7721('0x4c')]=_0x578867;return _0x25bdd9;})[_0x7721('0x1c')](respondWithFilteredResult(_0x13c635,_0x2f1fe0))[_0x7721('0x4d')](handleError(_0x13c635,null));};exports[_0x7721('0x4e')]=function(_0x589e95,_0x30107e){var _0x2d5a88={'raw':![],'where':{'id':_0x589e95[_0x7721('0x4f')]['id']}},_0x56c3d9={};_0x56c3d9['model']=_[_0x7721('0x36')](db['SalesforceConfiguration'][_0x7721('0x50')]);_0x56c3d9[_0x7721('0x35')]=_[_0x7721('0x36')](_0x589e95['query']);_0x56c3d9[_0x7721('0x37')]=_[_0x7721('0x38')](_0x56c3d9['model'],_0x56c3d9[_0x7721('0x35')]);_0x2d5a88[_0x7721('0x3a')]=_[_0x7721('0x38')](_0x56c3d9['model'],qs[_0x7721('0x39')](_0x589e95['query'][_0x7721('0x39')]));_0x2d5a88[_0x7721('0x3a')]=_0x2d5a88[_0x7721('0x3a')][_0x7721('0x3b')]?_0x2d5a88[_0x7721('0x3a')]:_0x56c3d9[_0x7721('0x34')];if(_0x589e95[_0x7721('0x35')][_0x7721('0x49')]){_0x2d5a88[_0x7721('0x4a')]=[{'all':!![]}];}_0x2d5a88=_[_0x7721('0x42')]({},_0x2d5a88,_0x589e95[_0x7721('0x47')]);return db[_0x7721('0x33')][_0x7721('0x51')](_0x2d5a88)[_0x7721('0x1c')](handleEntityNotFound(_0x30107e,null))[_0x7721('0x1c')](respondWithResult(_0x30107e,null))['catch'](handleError(_0x30107e,null));};exports[_0x7721('0x52')]=function(_0x2f6f30,_0x8e1214){return db[_0x7721('0x33')][_0x7721('0x52')](_0x2f6f30[_0x7721('0x53')],{})[_0x7721('0x1c')](respondWithResult(_0x8e1214,0xc9))['catch'](handleError(_0x8e1214,null));};exports[_0x7721('0x54')]=function(_0x17036e,_0x134908){if(_0x17036e[_0x7721('0x53')]['id']){delete _0x17036e[_0x7721('0x53')]['id'];}return db[_0x7721('0x33')][_0x7721('0x51')]({'where':{'id':_0x17036e[_0x7721('0x4f')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x134908,null))[_0x7721('0x1c')](saveUpdates(_0x17036e[_0x7721('0x53')],null))['then'](respondWithResult(_0x134908,null))[_0x7721('0x4d')](handleError(_0x134908,null));};exports[_0x7721('0x2e')]=function(_0x1234bc,_0x2ee3c0){return db[_0x7721('0x33')][_0x7721('0x51')]({'where':{'id':_0x1234bc[_0x7721('0x4f')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x2ee3c0,null))[_0x7721('0x1c')](removeEntity(_0x2ee3c0,null))[_0x7721('0x4d')](handleError(_0x2ee3c0,null));};exports[_0x7721('0x55')]=function(_0x2e5c28,_0x106664,_0x18f7f6){var _0x300ea4={};var _0x577f47={};var _0x50e9e9;var _0x4e112e;return db[_0x7721('0x33')]['findOne']({'where':{'id':_0x2e5c28['params']['id']}})['then'](handleEntityNotFound(_0x106664,null))['then'](function(_0x47925a){if(_0x47925a){_0x50e9e9=_0x47925a;_0x577f47[_0x7721('0x34')]=_[_0x7721('0x36')](db['SalesforceField'][_0x7721('0x50')]);_0x577f47['query']=_['keys'](_0x2e5c28['query']);_0x577f47[_0x7721('0x37')]=_['intersection'](_0x577f47['model'],_0x577f47['query']);_0x300ea4[_0x7721('0x3a')]=_[_0x7721('0x38')](_0x577f47[_0x7721('0x34')],qs['fields'](_0x2e5c28[_0x7721('0x35')][_0x7721('0x39')]));_0x300ea4[_0x7721('0x3a')]=_0x300ea4[_0x7721('0x3a')][_0x7721('0x3b')]?_0x300ea4[_0x7721('0x3a')]:_0x577f47[_0x7721('0x34')];_0x300ea4[_0x7721('0x3d')]=qs[_0x7721('0x3e')](_0x2e5c28[_0x7721('0x35')][_0x7721('0x3e')]);_0x300ea4[_0x7721('0x3f')]=qs[_0x7721('0x37')](_[_0x7721('0x40')](_0x2e5c28[_0x7721('0x35')],_0x577f47['filters']));if(_0x2e5c28[_0x7721('0x35')][_0x7721('0x41')]){_0x300ea4[_0x7721('0x3f')]=_[_0x7721('0x42')](_0x300ea4['where'],{'$or':_[_0x7721('0x43')](_0x300ea4[_0x7721('0x3a')],function(_0x4c8284){var _0x3e7df3={};_0x3e7df3[_0x4c8284]={'$like':'%'+_0x2e5c28['query'][_0x7721('0x41')]+'%'};return _0x3e7df3;})});}_0x300ea4=_[_0x7721('0x42')]({},_0x300ea4,_0x2e5c28[_0x7721('0x47')]);return _0x50e9e9[_0x7721('0x55')](_0x300ea4);}})[_0x7721('0x1c')](function(_0x158aae){if(_0x158aae){_0x4e112e=_0x158aae[_0x7721('0x3b')];if(!_0x2e5c28[_0x7721('0x35')][_0x7721('0x56')]('nolimit')){_0x300ea4[_0x7721('0x2a')]=qs[_0x7721('0x2a')](_0x2e5c28[_0x7721('0x35')][_0x7721('0x2a')]);_0x300ea4[_0x7721('0x29')]=qs[_0x7721('0x29')](_0x2e5c28[_0x7721('0x35')]['offset']);}return _0x50e9e9[_0x7721('0x55')](_0x300ea4);}})[_0x7721('0x1c')](function(_0x53c918){if(_0x53c918){return _0x53c918?{'count':_0x4e112e,'rows':_0x53c918}:null;}})[_0x7721('0x1c')](respondWithResult(_0x106664,null))['catch'](handleError(_0x106664,null));};exports[_0x7721('0x57')]=function(_0x382800,_0x4282ba,_0x3b64ec){var _0x1e2436={};var _0x2bab14={};var _0x258c57;var _0x5dca04;return db[_0x7721('0x33')][_0x7721('0x58')]({'where':{'id':_0x382800[_0x7721('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4282ba,null))['then'](function(_0x515fb9){if(_0x515fb9){_0x258c57=_0x515fb9;_0x2bab14['model']=_['keys'](db[_0x7721('0x59')][_0x7721('0x50')]);_0x2bab14['query']=_[_0x7721('0x36')](_0x382800[_0x7721('0x35')]);_0x2bab14[_0x7721('0x37')]=_[_0x7721('0x38')](_0x2bab14['model'],_0x2bab14[_0x7721('0x35')]);_0x1e2436[_0x7721('0x3a')]=_[_0x7721('0x38')](_0x2bab14[_0x7721('0x34')],qs[_0x7721('0x39')](_0x382800['query'][_0x7721('0x39')]));_0x1e2436[_0x7721('0x3a')]=_0x1e2436[_0x7721('0x3a')]['length']?_0x1e2436['attributes']:_0x2bab14[_0x7721('0x34')];_0x1e2436[_0x7721('0x3d')]=qs[_0x7721('0x3e')](_0x382800[_0x7721('0x35')][_0x7721('0x3e')]);_0x1e2436['where']=qs['filters'](_[_0x7721('0x40')](_0x382800[_0x7721('0x35')],_0x2bab14[_0x7721('0x37')]));if(_0x382800[_0x7721('0x35')][_0x7721('0x41')]){_0x1e2436[_0x7721('0x3f')]=_[_0x7721('0x42')](_0x1e2436['where'],{'$or':_[_0x7721('0x43')](_0x1e2436[_0x7721('0x3a')],function(_0x27d7f1){var _0x5e85d9={};_0x5e85d9[_0x27d7f1]={'$like':'%'+_0x382800[_0x7721('0x35')][_0x7721('0x41')]+'%'};return _0x5e85d9;})});}_0x1e2436=_[_0x7721('0x42')]({},_0x1e2436,_0x382800[_0x7721('0x47')]);return _0x258c57['getSubjects'](_0x1e2436);}})['then'](function(_0x37f8f8){if(_0x37f8f8){_0x5dca04=_0x37f8f8[_0x7721('0x3b')];if(!_0x382800[_0x7721('0x35')][_0x7721('0x56')](_0x7721('0x3c'))){_0x1e2436[_0x7721('0x2a')]=qs['limit'](_0x382800[_0x7721('0x35')][_0x7721('0x2a')]);_0x1e2436[_0x7721('0x29')]=qs['offset'](_0x382800[_0x7721('0x35')][_0x7721('0x29')]);}return _0x258c57[_0x7721('0x57')](_0x1e2436);}})[_0x7721('0x1c')](function(_0x457d7f){if(_0x457d7f){return _0x457d7f?{'count':_0x5dca04,'rows':_0x457d7f}:null;}})['then'](respondWithResult(_0x4282ba,null))[_0x7721('0x4d')](handleError(_0x4282ba,null));};exports['getDescriptions']=function(_0x12a3f7,_0x47764b,_0x2d5433){var _0x7f0598={};var _0x963dbe={};var _0x438b9f;var _0x24fe2a;return db[_0x7721('0x33')][_0x7721('0x58')]({'where':{'id':_0x12a3f7[_0x7721('0x4f')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x47764b,null))['then'](function(_0x19fad6){if(_0x19fad6){_0x438b9f=_0x19fad6;_0x963dbe[_0x7721('0x34')]=_[_0x7721('0x36')](db['SalesforceField'][_0x7721('0x50')]);_0x963dbe[_0x7721('0x35')]=_[_0x7721('0x36')](_0x12a3f7[_0x7721('0x35')]);_0x963dbe[_0x7721('0x37')]=_['intersection'](_0x963dbe[_0x7721('0x34')],_0x963dbe[_0x7721('0x35')]);_0x7f0598[_0x7721('0x3a')]=_[_0x7721('0x38')](_0x963dbe[_0x7721('0x34')],qs[_0x7721('0x39')](_0x12a3f7['query'][_0x7721('0x39')]));_0x7f0598[_0x7721('0x3a')]=_0x7f0598['attributes'][_0x7721('0x3b')]?_0x7f0598['attributes']:_0x963dbe[_0x7721('0x34')];_0x7f0598[_0x7721('0x3d')]=qs['sort'](_0x12a3f7[_0x7721('0x35')]['sort']);_0x7f0598['where']=qs['filters'](_[_0x7721('0x40')](_0x12a3f7[_0x7721('0x35')],_0x963dbe[_0x7721('0x37')]));if(_0x12a3f7['query']['filter']){_0x7f0598['where']=_[_0x7721('0x42')](_0x7f0598[_0x7721('0x3f')],{'$or':_[_0x7721('0x43')](_0x7f0598[_0x7721('0x3a')],function(_0x3b02d7){var _0x259ee8={};_0x259ee8[_0x3b02d7]={'$like':'%'+_0x12a3f7['query'][_0x7721('0x41')]+'%'};return _0x259ee8;})});}_0x7f0598=_[_0x7721('0x42')]({},_0x7f0598,_0x12a3f7[_0x7721('0x47')]);return _0x438b9f[_0x7721('0x5a')](_0x7f0598);}})[_0x7721('0x1c')](function(_0x1a0232){if(_0x1a0232){_0x24fe2a=_0x1a0232[_0x7721('0x3b')];if(!_0x12a3f7[_0x7721('0x35')][_0x7721('0x56')](_0x7721('0x3c'))){_0x7f0598[_0x7721('0x2a')]=qs[_0x7721('0x2a')](_0x12a3f7['query']['limit']);_0x7f0598[_0x7721('0x29')]=qs[_0x7721('0x29')](_0x12a3f7['query'][_0x7721('0x29')]);}return _0x438b9f['getDescriptions'](_0x7f0598);}})['then'](function(_0x154b4b){if(_0x154b4b){return _0x154b4b?{'count':_0x24fe2a,'rows':_0x154b4b}:null;}})['then'](respondWithResult(_0x47764b,null))['catch'](handleError(_0x47764b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ccf65fb..41a80c6 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 _0xa0b2=['util','bluebird','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x33f206,_0x3cd386){var _0x50d29d=function(_0x58afb2){while(--_0x58afb2){_0x33f206['push'](_0x33f206['shift']());}};_0x50d29d(++_0x3cd386);}(_0xa0b2,0x14f));var _0x2a0b=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0xa0b2[_0x4d35f3];return _0x382fea;};'use strict';var _=require(_0x2a0b('0x0'));var util=require(_0x2a0b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2a0b('0x2'));var rp=require('request-promise');var attributes=require(_0x2a0b('0x3'));module[_0x2a0b('0x4')]=function(_0x21a8ab,_0x3aeb24){return _0x21a8ab[_0x2a0b('0x5')](_0x2a0b('0x6'),attributes,{'tableName':_0x2a0b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ae0=['exports','define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','./intSalesforceConfiguration.attributes'];(function(_0xf34d07,_0x31abc0){var _0x552c0d=function(_0x409e4f){while(--_0x409e4f){_0xf34d07['push'](_0xf34d07['shift']());}};_0x552c0d(++_0x31abc0);}(_0x1ae0,0xb8));var _0x01ae=function(_0x358fd3,_0x4a9c44){_0x358fd3=_0x358fd3-0x0;var _0x1ad0f3=_0x1ae0[_0x358fd3];return _0x1ad0f3;};'use strict';var _=require('lodash');var util=require(_0x01ae('0x0'));var logger=require(_0x01ae('0x1'))(_0x01ae('0x2'));var moment=require(_0x01ae('0x3'));var BPromise=require(_0x01ae('0x4'));var rp=require('request-promise');var attributes=require(_0x01ae('0x5'));module[_0x01ae('0x6')]=function(_0x3d8540,_0x2d6369){return _0x3d8540[_0x01ae('0x7')](_0x01ae('0x8'),attributes,{'tableName':_0x01ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index bd2baa9..e45ed85 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 _0x814b=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x814b,0x1a2));var _0xb814=function(_0x4fcb07,_0x4a77a4){_0x4fcb07=_0x4fcb07-0x0;var _0xf2eeb=_0x814b[_0x4fcb07];return _0xf2eeb;};'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});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x586154,_0x43695c){var _0x31bf02=function(_0x150074){while(--_0x150074){_0x586154['push'](_0x586154['shift']());}};_0x31bf02(++_0x43695c);}(_0xe14b,0x93));var _0xbe14=function(_0x11631c,_0x30f8f8){_0x11631c=_0x11631c-0x0;var _0x30d93d=_0xe14b[_0x11631c];return _0x30d93d;};'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);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 0e1d4b8..8c6672e 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 _0x649d=['put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','isAuthenticated','show','post','create'];(function(_0x88a831,_0x8b21e1){var _0x465814=function(_0x49377c){while(--_0x49377c){_0x88a831['push'](_0x88a831['shift']());}};_0x465814(++_0x8b21e1);}(_0x649d,0x9d));var _0xd649=function(_0x5a9597,_0x29d8aa){_0x5a9597=_0x5a9597-0x0;var _0x40ff60=_0x649d[_0x5a9597];return _0x40ff60;};'use strict';var multer=require(_0xd649('0x0'));var util=require(_0xd649('0x1'));var path=require(_0xd649('0x2'));var timeout=require(_0xd649('0x3'));var express=require('express');var router=express[_0xd649('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd649('0x5'));var config=require(_0xd649('0x6'));var controller=require(_0xd649('0x7'));router[_0xd649('0x8')]('/',auth['isAuthenticated'](),controller[_0xd649('0x9')]);router['get']('/:id',auth[_0xd649('0xa')](),controller[_0xd649('0xb')]);router[_0xd649('0xc')]('/',auth[_0xd649('0xa')](),controller[_0xd649('0xd')]);router[_0xd649('0xe')](_0xd649('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xd649('0x10')](_0xd649('0xf'),auth[_0xd649('0xa')](),controller[_0xd649('0x11')]);module[_0xd649('0x12')]=router; \ No newline at end of file +var _0xb478=['show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x48a1e7,_0x56dd65){var _0x224150=function(_0x2c30d4){while(--_0x2c30d4){_0x48a1e7['push'](_0x48a1e7['shift']());}};_0x224150(++_0x56dd65);}(_0xb478,0xce));var _0x8b47=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xb478[_0x269ee8];return _0x4d98bd;};'use strict';var multer=require(_0x8b47('0x0'));var util=require('util');var path=require(_0x8b47('0x1'));var timeout=require('connect-timeout');var express=require(_0x8b47('0x2'));var router=express[_0x8b47('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8b47('0x4'));var config=require(_0x8b47('0x5'));var controller=require('./intSalesforceField.controller');router[_0x8b47('0x6')]('/',auth[_0x8b47('0x7')](),controller[_0x8b47('0x8')]);router[_0x8b47('0x6')](_0x8b47('0x9'),auth[_0x8b47('0x7')](),controller[_0x8b47('0xa')]);router[_0x8b47('0xb')]('/',auth[_0x8b47('0x7')](),controller[_0x8b47('0xc')]);router[_0x8b47('0xd')](_0x8b47('0x9'),auth[_0x8b47('0x7')](),controller[_0x8b47('0xe')]);router[_0x8b47('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8b47('0x10')]);module[_0x8b47('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 51a6b3b..56b2e65 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 _0x0df8=['string','STRING','customVariable','sequelize','exports','ENUM','variable','keyValue'];(function(_0x421d92,_0x1b8c8f){var _0x9c0b2b=function(_0x4b5ff1){while(--_0x4b5ff1){_0x421d92['push'](_0x421d92['shift']());}};_0x9c0b2b(++_0x1b8c8f);}(_0x0df8,0xeb));var _0x80df=function(_0x40ba94,_0x16102d){_0x40ba94=_0x40ba94-0x0;var _0x3d632c=_0x0df8[_0x40ba94];return _0x3d632c;};'use strict';var Sequelize=require(_0x80df('0x0'));module[_0x80df('0x1')]={'type':{'type':Sequelize[_0x80df('0x2')]('string',_0x80df('0x3'),'customVariable',_0x80df('0x4')),'defaultValue':_0x80df('0x5')},'content':{'type':Sequelize[_0x80df('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x80df('0x2')]('string',_0x80df('0x3'),_0x80df('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x80df('0x6')]},'variableName':{'type':Sequelize[_0x80df('0x6')]}}; \ No newline at end of file +var _0xf1d0=['string','variable','customVariable','STRING','sequelize','ENUM'];(function(_0x3c4c9e,_0xc18dff){var _0x197cf3=function(_0x2290c4){while(--_0x2290c4){_0x3c4c9e['push'](_0x3c4c9e['shift']());}};_0x197cf3(++_0xc18dff);}(_0xf1d0,0x9a));var _0x0f1d=function(_0x5d7661,_0x206fa2){_0x5d7661=_0x5d7661-0x0;var _0x17c054=_0xf1d0[_0x5d7661];return _0x17c054;};'use strict';var Sequelize=require(_0x0f1d('0x0'));module['exports']={'type':{'type':Sequelize[_0x0f1d('0x1')](_0x0f1d('0x2'),_0x0f1d('0x3'),_0x0f1d('0x4'),'keyValue'),'defaultValue':_0x0f1d('0x2')},'content':{'type':Sequelize[_0x0f1d('0x5')]},'key':{'type':Sequelize[_0x0f1d('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x0f1d('0x2'),'variable',_0x0f1d('0x4'))},'keyContent':{'type':Sequelize[_0x0f1d('0x5')]},'idField':{'type':Sequelize[_0x0f1d('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 44fe0a3..5873c55 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 _0xcde0=['update','then','destroy','sendStatus','error','stack','name','SalesforceField','rawAttributes','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','field','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0xcde0,0x14a));var _0x0cde=function(_0x4f55b6,_0x30f14d){_0x4f55b6=_0x4f55b6-0x0;var _0x4c566e=_0xcde0[_0x4f55b6];return _0x4c566e;};'use strict';var pdf=require(_0x0cde('0x0'));var emlformat=require(_0x0cde('0x1'));var rimraf=require(_0x0cde('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0cde('0x3'));var rp=require(_0x0cde('0x4'));var moment=require(_0x0cde('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0cde('0x6'));var util=require(_0x0cde('0x7'));var path=require(_0x0cde('0x8'));var sox=require(_0x0cde('0x9'));var csv=require(_0x0cde('0xa'));var ejs=require(_0x0cde('0xb'));var fs=require('fs');var _=require(_0x0cde('0xc'));var squel=require(_0x0cde('0xd'));var crypto=require(_0x0cde('0xe'));var jsforce=require(_0x0cde('0xf'));var deskjs=require(_0x0cde('0x10'));var toCsv=require(_0x0cde('0xa'));var querystring=require('querystring');var Papa=require(_0x0cde('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0x0cde('0x12'));var Redis=require(_0x0cde('0x13'));var qs=require(_0x0cde('0x14'));var logger=require('../../config/logger')(_0x0cde('0x15'));var utils=require(_0x0cde('0x16'));var config=require('../../config/environment');var db=require(_0x0cde('0x17'))['db'];function respondWithStatusCode(_0x36243e,_0x24e155){_0x24e155=_0x24e155||0xcc;return function(_0x945dd){if(_0x945dd){return _0x36243e['sendStatus'](_0x24e155);}return _0x36243e[_0x0cde('0x18')](_0x24e155)[_0x0cde('0x19')]();};}function respondWithResult(_0x2b2d7b,_0x42bc9e){_0x42bc9e=_0x42bc9e||0xc8;return function(_0x3bc925){if(_0x3bc925){return _0x2b2d7b[_0x0cde('0x18')](_0x42bc9e)[_0x0cde('0x1a')](_0x3bc925);}};}function respondWithFilteredResult(_0x27e995,_0x10a325){return function(_0x1f099e){if(_0x1f099e){var _0x10da51=_0x1f099e[_0x0cde('0x1b')],_0x103b96=_0x10a325[_0x0cde('0x1c')],_0x3a6191=_0x10a325[_0x0cde('0x1c')]+_0x10a325[_0x0cde('0x1d')],_0x336beb;if(_0x3a6191>=_0x10da51){_0x3a6191=_0x10da51;_0x336beb=0xc8;}else{_0x336beb=0xce;}_0x27e995[_0x0cde('0x18')](_0x336beb);return _0x27e995[_0x0cde('0x1e')](_0x0cde('0x1f'),_0x103b96+'-'+_0x3a6191+'/'+_0x10da51)[_0x0cde('0x1a')](_0x1f099e);}return null;};}function patchUpdates(_0xf03bd4){return function(_0x573fad){try{jsonpatch[_0x0cde('0x20')](_0x573fad,_0xf03bd4,!![]);}catch(_0x5b0e2c){return BPromise[_0x0cde('0x21')](_0x5b0e2c);}return _0x573fad[_0x0cde('0x22')]();};}function saveUpdates(_0x31f176,_0x2a1e67){return function(_0xad710f){if(_0xad710f){return _0xad710f[_0x0cde('0x23')](_0x31f176)[_0x0cde('0x24')](function(_0x1613ef){return _0x1613ef;});}return null;};}function removeEntity(_0x54a29b,_0x3cfebd){return function(_0x3e3147){if(_0x3e3147){return _0x3e3147[_0x0cde('0x25')]()[_0x0cde('0x24')](function(){_0x54a29b[_0x0cde('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x150832,_0x2af658){return function(_0x526e95){if(!_0x526e95){_0x150832[_0x0cde('0x26')](0x194);}return _0x526e95;};}function handleError(_0x3460c2,_0x44430a){_0x44430a=_0x44430a||0x1f4;return function(_0x108f6b){logger[_0x0cde('0x27')](_0x108f6b[_0x0cde('0x28')]);if(_0x108f6b[_0x0cde('0x29')]){delete _0x108f6b[_0x0cde('0x29')];}_0x3460c2['status'](_0x44430a)['send'](_0x108f6b);};}exports['index']=function(_0x2509e8,_0x40ffd5){var _0xc4f38b={},_0x350e8c={},_0x154bb1={'count':0x0,'rows':[]};var _0x2889ae=db[_0x0cde('0x2a')][_0x0cde('0x2b')];_0x350e8c[_0x0cde('0x2c')]=_[_0x0cde('0x2d')](_0x2889ae);_0x350e8c['query']=_[_0x0cde('0x2d')](_0x2509e8['query']);_0x350e8c[_0x0cde('0x2e')]=_[_0x0cde('0x2f')](_0x350e8c[_0x0cde('0x2c')],_0x350e8c[_0x0cde('0x30')]);_0xc4f38b[_0x0cde('0x31')]=_[_0x0cde('0x2f')](_0x350e8c[_0x0cde('0x2c')],qs[_0x0cde('0x32')](_0x2509e8[_0x0cde('0x30')]['fields']));_0xc4f38b[_0x0cde('0x31')]=_0xc4f38b[_0x0cde('0x31')][_0x0cde('0x33')]?_0xc4f38b[_0x0cde('0x31')]:_0x350e8c[_0x0cde('0x2c')];if(!_0x2509e8[_0x0cde('0x30')][_0x0cde('0x34')](_0x0cde('0x35'))){_0xc4f38b[_0x0cde('0x1d')]=qs['limit'](_0x2509e8['query'][_0x0cde('0x1d')]);_0xc4f38b[_0x0cde('0x1c')]=qs['offset'](_0x2509e8[_0x0cde('0x30')][_0x0cde('0x1c')]);}_0xc4f38b[_0x0cde('0x36')]=qs[_0x0cde('0x37')](_0x2509e8[_0x0cde('0x30')][_0x0cde('0x37')]);_0xc4f38b[_0x0cde('0x38')]=qs[_0x0cde('0x2e')](_['pick'](_0x2509e8[_0x0cde('0x30')],_0x350e8c[_0x0cde('0x2e')]));if(_0x2509e8['query'][_0x0cde('0x39')]){_0xc4f38b[_0x0cde('0x38')]=_[_0x0cde('0x3a')](_0xc4f38b[_0x0cde('0x38')],{'$or':_['map'](_0x2889ae,function(_0x5e3730){if(_0x5e3730[_0x0cde('0x3b')][_0x0cde('0x3c')]!=='VIRTUAL'){var _0x5258d5={};_0x5258d5[_0x5e3730[_0x0cde('0x3d')]]={'$like':'%'+_0x2509e8[_0x0cde('0x30')][_0x0cde('0x39')]+'%'};return _0x5258d5;}})});}_0xc4f38b=_[_0x0cde('0x3a')]({},_0xc4f38b,_0x2509e8[_0x0cde('0x3e')]);var _0x53bd13={'where':_0xc4f38b[_0x0cde('0x38')]};return db[_0x0cde('0x2a')][_0x0cde('0x1b')](_0x53bd13)[_0x0cde('0x24')](function(_0x56c93f){_0x154bb1[_0x0cde('0x1b')]=_0x56c93f;if(_0x2509e8[_0x0cde('0x30')][_0x0cde('0x3f')]){_0xc4f38b[_0x0cde('0x40')]=[{'all':!![]}];}return db[_0x0cde('0x2a')][_0x0cde('0x41')](_0xc4f38b);})[_0x0cde('0x24')](function(_0x3cc529){_0x154bb1[_0x0cde('0x42')]=_0x3cc529;return _0x154bb1;})[_0x0cde('0x24')](respondWithFilteredResult(_0x40ffd5,_0xc4f38b))[_0x0cde('0x43')](handleError(_0x40ffd5,null));};exports[_0x0cde('0x44')]=function(_0x28e893,_0x564179){var _0x88e164={'raw':!![],'where':{'id':_0x28e893[_0x0cde('0x45')]['id']}},_0x4c6580={};_0x4c6580[_0x0cde('0x2c')]=_['keys'](db[_0x0cde('0x2a')]['rawAttributes']);_0x4c6580[_0x0cde('0x30')]=_['keys'](_0x28e893['query']);_0x4c6580[_0x0cde('0x2e')]=_[_0x0cde('0x2f')](_0x4c6580[_0x0cde('0x2c')],_0x4c6580[_0x0cde('0x30')]);_0x88e164[_0x0cde('0x31')]=_[_0x0cde('0x2f')](_0x4c6580[_0x0cde('0x2c')],qs[_0x0cde('0x32')](_0x28e893[_0x0cde('0x30')][_0x0cde('0x32')]));_0x88e164[_0x0cde('0x31')]=_0x88e164[_0x0cde('0x31')][_0x0cde('0x33')]?_0x88e164[_0x0cde('0x31')]:_0x4c6580[_0x0cde('0x2c')];if(_0x28e893[_0x0cde('0x30')]['includeAll']){_0x88e164['include']=[{'all':!![]}];}_0x88e164=_[_0x0cde('0x3a')]({},_0x88e164,_0x28e893[_0x0cde('0x3e')]);return db[_0x0cde('0x2a')]['find'](_0x88e164)[_0x0cde('0x24')](handleEntityNotFound(_0x564179,null))[_0x0cde('0x24')](respondWithResult(_0x564179,null))[_0x0cde('0x43')](handleError(_0x564179,null));};exports[_0x0cde('0x46')]=function(_0x12a5e7,_0x102efe){return db[_0x0cde('0x2a')][_0x0cde('0x46')](_0x12a5e7[_0x0cde('0x47')],{})['then'](respondWithResult(_0x102efe,0xc9))[_0x0cde('0x43')](handleError(_0x102efe,null));};exports[_0x0cde('0x23')]=function(_0xc1d129,_0x49e0fe){if(_0xc1d129[_0x0cde('0x47')]['id']){delete _0xc1d129[_0x0cde('0x47')]['id'];}return db[_0x0cde('0x2a')]['find']({'where':{'id':_0xc1d129['params']['id']}})[_0x0cde('0x24')](handleEntityNotFound(_0x49e0fe,null))[_0x0cde('0x24')](saveUpdates(_0xc1d129[_0x0cde('0x47')],null))['then'](respondWithResult(_0x49e0fe,null))['catch'](handleError(_0x49e0fe,null));};exports[_0x0cde('0x25')]=function(_0x443840,_0x395484){return db[_0x0cde('0x2a')][_0x0cde('0x48')]({'where':{'id':_0x443840['params']['id']}})[_0x0cde('0x24')](handleEntityNotFound(_0x395484,null))['then'](removeEntity(_0x395484,null))[_0x0cde('0x43')](handleError(_0x395484,null));}; \ No newline at end of file +var _0x2f7a=['findAll','catch','params','length','create','body','find','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','reject','then','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','SalesforceField','includeAll','include'];(function(_0x1f0454,_0x41fd2f){var _0x4a3b81=function(_0x286622){while(--_0x286622){_0x1f0454['push'](_0x1f0454['shift']());}};_0x4a3b81(++_0x41fd2f);}(_0x2f7a,0x151));var _0xa2f7=function(_0x4a27cb,_0x587c30){_0x4a27cb=_0x4a27cb-0x0;var _0x55e026=_0x2f7a[_0x4a27cb];return _0x55e026;};'use strict';var pdf=require(_0xa2f7('0x0'));var emlformat=require(_0xa2f7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa2f7('0x2'));var rp=require(_0xa2f7('0x3'));var moment=require(_0xa2f7('0x4'));var BPromise=require(_0xa2f7('0x5'));var Mustache=require(_0xa2f7('0x6'));var util=require(_0xa2f7('0x7'));var path=require(_0xa2f7('0x8'));var sox=require(_0xa2f7('0x9'));var csv=require(_0xa2f7('0xa'));var ejs=require(_0xa2f7('0xb'));var fs=require('fs');var _=require(_0xa2f7('0xc'));var squel=require(_0xa2f7('0xd'));var crypto=require(_0xa2f7('0xe'));var jsforce=require(_0xa2f7('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa2f7('0x10'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xa2f7('0x11'));var Redis=require(_0xa2f7('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0xa2f7('0x13'))(_0xa2f7('0x14'));var utils=require(_0xa2f7('0x15'));var config=require(_0xa2f7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x252770,_0x282049){_0x282049=_0x282049||0xcc;return function(_0x2669a9){if(_0x2669a9){return _0x252770[_0xa2f7('0x17')](_0x282049);}return _0x252770[_0xa2f7('0x18')](_0x282049)[_0xa2f7('0x19')]();};}function respondWithResult(_0x3ce029,_0xa0754){_0xa0754=_0xa0754||0xc8;return function(_0x4cb00f){if(_0x4cb00f){return _0x3ce029['status'](_0xa0754)[_0xa2f7('0x1a')](_0x4cb00f);}};}function respondWithFilteredResult(_0x22e2a9,_0x398842){return function(_0x4fa1b5){if(_0x4fa1b5){var _0x2898f9=_0x4fa1b5[_0xa2f7('0x1b')],_0x363bc8=_0x398842['offset'],_0x1636f7=_0x398842[_0xa2f7('0x1c')]+_0x398842[_0xa2f7('0x1d')],_0x53014c;if(_0x1636f7>=_0x2898f9){_0x1636f7=_0x2898f9;_0x53014c=0xc8;}else{_0x53014c=0xce;}_0x22e2a9['status'](_0x53014c);return _0x22e2a9[_0xa2f7('0x1e')]('Content-Range',_0x363bc8+'-'+_0x1636f7+'/'+_0x2898f9)[_0xa2f7('0x1a')](_0x4fa1b5);}return null;};}function patchUpdates(_0x4b81ad){return function(_0x514ad6){try{jsonpatch['apply'](_0x514ad6,_0x4b81ad,!![]);}catch(_0x4251a7){return BPromise[_0xa2f7('0x1f')](_0x4251a7);}return _0x514ad6['save']();};}function saveUpdates(_0x4016b4,_0x4d3242){return function(_0x25709b){if(_0x25709b){return _0x25709b['update'](_0x4016b4)[_0xa2f7('0x20')](function(_0x269594){return _0x269594;});}return null;};}function removeEntity(_0x50d083,_0x245a7b){return function(_0x3b5ceb){if(_0x3b5ceb){return _0x3b5ceb[_0xa2f7('0x21')]()[_0xa2f7('0x20')](function(){_0x50d083[_0xa2f7('0x18')](0xcc)[_0xa2f7('0x19')]();});}};}function handleEntityNotFound(_0x531461,_0x50709e){return function(_0x3c9054){if(!_0x3c9054){_0x531461[_0xa2f7('0x17')](0x194);}return _0x3c9054;};}function handleError(_0x5cc418,_0x2b44e0){_0x2b44e0=_0x2b44e0||0x1f4;return function(_0x2891c1){logger['error'](_0x2891c1[_0xa2f7('0x22')]);if(_0x2891c1[_0xa2f7('0x23')]){delete _0x2891c1[_0xa2f7('0x23')];}_0x5cc418[_0xa2f7('0x18')](_0x2b44e0)[_0xa2f7('0x24')](_0x2891c1);};}exports[_0xa2f7('0x25')]=function(_0x4db4ff,_0x123622){var _0x5c05c4={},_0x32f28e={},_0x60fab5={'count':0x0,'rows':[]};var _0x265e31=db['SalesforceField'][_0xa2f7('0x26')];_0x32f28e[_0xa2f7('0x27')]=_[_0xa2f7('0x28')](_0x265e31);_0x32f28e['query']=_['keys'](_0x4db4ff[_0xa2f7('0x29')]);_0x32f28e[_0xa2f7('0x2a')]=_[_0xa2f7('0x2b')](_0x32f28e[_0xa2f7('0x27')],_0x32f28e[_0xa2f7('0x29')]);_0x5c05c4['attributes']=_[_0xa2f7('0x2b')](_0x32f28e[_0xa2f7('0x27')],qs['fields'](_0x4db4ff[_0xa2f7('0x29')][_0xa2f7('0x2c')]));_0x5c05c4[_0xa2f7('0x2d')]=_0x5c05c4[_0xa2f7('0x2d')]['length']?_0x5c05c4['attributes']:_0x32f28e[_0xa2f7('0x27')];if(!_0x4db4ff[_0xa2f7('0x29')][_0xa2f7('0x2e')](_0xa2f7('0x2f'))){_0x5c05c4[_0xa2f7('0x1d')]=qs['limit'](_0x4db4ff[_0xa2f7('0x29')][_0xa2f7('0x1d')]);_0x5c05c4[_0xa2f7('0x1c')]=qs[_0xa2f7('0x1c')](_0x4db4ff[_0xa2f7('0x29')][_0xa2f7('0x1c')]);}_0x5c05c4[_0xa2f7('0x30')]=qs[_0xa2f7('0x31')](_0x4db4ff['query'][_0xa2f7('0x31')]);_0x5c05c4[_0xa2f7('0x32')]=qs[_0xa2f7('0x2a')](_[_0xa2f7('0x33')](_0x4db4ff[_0xa2f7('0x29')],_0x32f28e['filters']));if(_0x4db4ff['query'][_0xa2f7('0x34')]){_0x5c05c4['where']=_[_0xa2f7('0x35')](_0x5c05c4[_0xa2f7('0x32')],{'$or':_[_0xa2f7('0x36')](_0x265e31,function(_0x11369c){if(_0x11369c[_0xa2f7('0x37')]['key']!=='VIRTUAL'){var _0x24e13b={};_0x24e13b[_0x11369c['field']]={'$like':'%'+_0x4db4ff[_0xa2f7('0x29')]['filter']+'%'};return _0x24e13b;}})});}_0x5c05c4=_[_0xa2f7('0x35')]({},_0x5c05c4,_0x4db4ff['options']);var _0xecce3a={'where':_0x5c05c4[_0xa2f7('0x32')]};return db[_0xa2f7('0x38')][_0xa2f7('0x1b')](_0xecce3a)['then'](function(_0x1bf827){_0x60fab5['count']=_0x1bf827;if(_0x4db4ff[_0xa2f7('0x29')][_0xa2f7('0x39')]){_0x5c05c4[_0xa2f7('0x3a')]=[{'all':!![]}];}return db[_0xa2f7('0x38')][_0xa2f7('0x3b')](_0x5c05c4);})[_0xa2f7('0x20')](function(_0x13dae0){_0x60fab5['rows']=_0x13dae0;return _0x60fab5;})[_0xa2f7('0x20')](respondWithFilteredResult(_0x123622,_0x5c05c4))[_0xa2f7('0x3c')](handleError(_0x123622,null));};exports['show']=function(_0x58d472,_0x49af80){var _0x586b73={'raw':!![],'where':{'id':_0x58d472[_0xa2f7('0x3d')]['id']}},_0x35f6e1={};_0x35f6e1[_0xa2f7('0x27')]=_['keys'](db[_0xa2f7('0x38')]['rawAttributes']);_0x35f6e1['query']=_[_0xa2f7('0x28')](_0x58d472[_0xa2f7('0x29')]);_0x35f6e1['filters']=_[_0xa2f7('0x2b')](_0x35f6e1[_0xa2f7('0x27')],_0x35f6e1[_0xa2f7('0x29')]);_0x586b73[_0xa2f7('0x2d')]=_[_0xa2f7('0x2b')](_0x35f6e1[_0xa2f7('0x27')],qs['fields'](_0x58d472['query'][_0xa2f7('0x2c')]));_0x586b73['attributes']=_0x586b73[_0xa2f7('0x2d')][_0xa2f7('0x3e')]?_0x586b73['attributes']:_0x35f6e1['model'];if(_0x58d472['query'][_0xa2f7('0x39')]){_0x586b73[_0xa2f7('0x3a')]=[{'all':!![]}];}_0x586b73=_[_0xa2f7('0x35')]({},_0x586b73,_0x58d472['options']);return db['SalesforceField']['find'](_0x586b73)[_0xa2f7('0x20')](handleEntityNotFound(_0x49af80,null))['then'](respondWithResult(_0x49af80,null))[_0xa2f7('0x3c')](handleError(_0x49af80,null));};exports[_0xa2f7('0x3f')]=function(_0x3ee940,_0x57fd64){return db[_0xa2f7('0x38')][_0xa2f7('0x3f')](_0x3ee940['body'],{})[_0xa2f7('0x20')](respondWithResult(_0x57fd64,0xc9))['catch'](handleError(_0x57fd64,null));};exports['update']=function(_0x19a008,_0x50eb90){if(_0x19a008[_0xa2f7('0x40')]['id']){delete _0x19a008[_0xa2f7('0x40')]['id'];}return db[_0xa2f7('0x38')][_0xa2f7('0x41')]({'where':{'id':_0x19a008['params']['id']}})['then'](handleEntityNotFound(_0x50eb90,null))[_0xa2f7('0x20')](saveUpdates(_0x19a008[_0xa2f7('0x40')],null))[_0xa2f7('0x20')](respondWithResult(_0x50eb90,null))[_0xa2f7('0x3c')](handleError(_0x50eb90,null));};exports[_0xa2f7('0x21')]=function(_0x2e4b6a,_0x52ca05){return db[_0xa2f7('0x38')]['find']({'where':{'id':_0x2e4b6a[_0xa2f7('0x3d')]['id']}})[_0xa2f7('0x20')](handleEntityNotFound(_0x52ca05,null))[_0xa2f7('0x20')](removeEntity(_0x52ca05,null))['catch'](handleError(_0x52ca05,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 01fde6a..6cd6a3f 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 _0xbd3b=['./intSalesforceField.attributes','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x298920,_0x243efb){var _0x3a2027=function(_0x5791b9){while(--_0x5791b9){_0x298920['push'](_0x298920['shift']());}};_0x3a2027(++_0x243efb);}(_0xbd3b,0x68));var _0xbbd3=function(_0x1fdff9,_0x4c4bf4){_0x1fdff9=_0x1fdff9-0x0;var _0x3d1b6e=_0xbd3b[_0x1fdff9];return _0x3d1b6e;};'use strict';var _=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var logger=require('../../config/logger')(_0xbbd3('0x2'));var moment=require(_0xbbd3('0x3'));var BPromise=require(_0xbbd3('0x4'));var rp=require(_0xbbd3('0x5'));var attributes=require(_0xbbd3('0x6'));module['exports']=function(_0x135f7e,_0x4474d5){return _0x135f7e['define']('SalesforceField',attributes,{'tableName':_0xbbd3('0x7'),'paranoid':![],'indexes':[{'name':_0xbbd3('0x8'),'fields':[_0xbbd3('0x9'),_0xbbd3('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb3d=['../../config/logger','api','moment','bluebird','request-promise','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField','lodash','util'];(function(_0x1ece0a,_0x38e36a){var _0x10b8a7=function(_0xf5721d){while(--_0xf5721d){_0x1ece0a['push'](_0x1ece0a['shift']());}};_0x10b8a7(++_0x38e36a);}(_0xcb3d,0x191));var _0xdcb3=function(_0x29d32b,_0x1bc829){_0x29d32b=_0x29d32b-0x0;var _0x27e2e1=_0xcb3d[_0x29d32b];return _0x27e2e1;};'use strict';var _=require(_0xdcb3('0x0'));var util=require(_0xdcb3('0x1'));var logger=require(_0xdcb3('0x2'))(_0xdcb3('0x3'));var moment=require(_0xdcb3('0x4'));var BPromise=require(_0xdcb3('0x5'));var rp=require(_0xdcb3('0x6'));var attributes=require(_0xdcb3('0x7'));module[_0xdcb3('0x8')]=function(_0x184625,_0x104b88){return _0x184625[_0xdcb3('0x9')](_0xdcb3('0xa'),attributes,{'tableName':_0xdcb3('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xdcb3('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index cb45160..f8531de 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 _0x1c17=['SalesforceField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x1c17,0xac));var _0x71c1=function(_0x6ea6d7,_0x34faf9){_0x6ea6d7=_0x6ea6d7-0x0;var _0xf81bfc=_0x1c17[_0x6ea6d7];return _0xf81bfc;};'use strict';var _=require('lodash');var util=require(_0x71c1('0x0'));var moment=require('moment');var BPromise=require(_0x71c1('0x1'));var rs=require(_0x71c1('0x2'));var fs=require('fs');var Redis=require(_0x71c1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x71c1('0x4'));var logger=require(_0x71c1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x71c1('0x6'));var client=jayson[_0x71c1('0x7')][_0x71c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59a958,_0x30c4fc,_0x446125){return new BPromise(function(_0x2f5cdc,_0x327801){return client[_0x71c1('0x9')](_0x59a958,_0x446125)[_0x71c1('0xa')](function(_0x2744d1){logger[_0x71c1('0xb')]('SalesforceField,\x20%s,\x20%s',_0x30c4fc,_0x71c1('0xc'));logger['debug'](_0x71c1('0xd'),_0x30c4fc,'request\x20sent',JSON[_0x71c1('0xe')](_0x2744d1));if(_0x2744d1[_0x71c1('0xf')]){if(_0x2744d1[_0x71c1('0xf')][_0x71c1('0x10')]===0x1f4){logger[_0x71c1('0xf')](_0x71c1('0x11'),_0x30c4fc,_0x2744d1[_0x71c1('0xf')]['message']);return _0x327801(_0x2744d1[_0x71c1('0xf')][_0x71c1('0x12')]);}logger['error'](_0x71c1('0x11'),_0x30c4fc,_0x2744d1[_0x71c1('0xf')][_0x71c1('0x12')]);return _0x2f5cdc(_0x2744d1['error']['message']);}else{logger[_0x71c1('0xb')](_0x71c1('0x11'),_0x30c4fc,_0x71c1('0xc'));_0x2f5cdc(_0x2744d1[_0x71c1('0x13')][_0x71c1('0x12')]);}})[_0x71c1('0x14')](function(_0x13d2e4){logger[_0x71c1('0xf')](_0x71c1('0x11'),_0x30c4fc,_0x13d2e4);_0x327801(_0x13d2e4);});});} \ No newline at end of file +var _0xe037=['info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xe037,0x14b));var _0x7e03=function(_0xcbe787,_0x401e4c){_0xcbe787=_0xcbe787-0x0;var _0x4c78fa=_0xe037[_0xcbe787];return _0x4c78fa;};'use strict';var _=require(_0x7e03('0x0'));var util=require(_0x7e03('0x1'));var moment=require(_0x7e03('0x2'));var BPromise=require(_0x7e03('0x3'));var rs=require(_0x7e03('0x4'));var fs=require('fs');var Redis=require(_0x7e03('0x5'));var db=require(_0x7e03('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e03('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e03('0x8')][_0x7e03('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x143cb0,_0x2ec5ba,_0x2256f0){return new BPromise(function(_0x45c4ff,_0x21e0a3){return client[_0x7e03('0xa')](_0x143cb0,_0x2256f0)['then'](function(_0x4f7fa9){logger[_0x7e03('0xb')](_0x7e03('0xc'),_0x2ec5ba,_0x7e03('0xd'));logger[_0x7e03('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2ec5ba,_0x7e03('0xd'),JSON['stringify'](_0x4f7fa9));if(_0x4f7fa9[_0x7e03('0xf')]){if(_0x4f7fa9[_0x7e03('0xf')][_0x7e03('0x10')]===0x1f4){logger[_0x7e03('0xf')](_0x7e03('0xc'),_0x2ec5ba,_0x4f7fa9[_0x7e03('0xf')][_0x7e03('0x11')]);return _0x21e0a3(_0x4f7fa9[_0x7e03('0xf')]['message']);}logger[_0x7e03('0xf')]('SalesforceField,\x20%s,\x20%s',_0x2ec5ba,_0x4f7fa9['error'][_0x7e03('0x11')]);return _0x45c4ff(_0x4f7fa9[_0x7e03('0xf')][_0x7e03('0x11')]);}else{logger[_0x7e03('0xb')](_0x7e03('0xc'),_0x2ec5ba,'request\x20sent');_0x45c4ff(_0x4f7fa9['result'][_0x7e03('0x11')]);}})[_0x7e03('0x12')](function(_0x205042){logger[_0x7e03('0xf')]('SalesforceField,\x20%s,\x20%s',_0x2ec5ba,_0x205042);_0x21e0a3(_0x205042);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index f62a245..ecccccf 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 _0x3b5b=['util','express','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x3238fb,_0x161c56){var _0x631cf4=function(_0x413b5d){while(--_0x413b5d){_0x3238fb['push'](_0x3238fb['shift']());}};_0x631cf4(++_0x161c56);}(_0x3b5b,0x149));var _0xb3b5=function(_0x170cbb,_0x9093e){_0x170cbb=_0x170cbb-0x0;var _0x39fae4=_0x3b5b[_0x170cbb];return _0x39fae4;};'use strict';var multer=require(_0xb3b5('0x0'));var util=require(_0xb3b5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb3b5('0x2'));var router=express['Router']();var auth=require(_0xb3b5('0x3'));var interaction=require(_0xb3b5('0x4'));var config=require('../../config/environment');var controller=require(_0xb3b5('0x5'));router[_0xb3b5('0x6')]('/',auth[_0xb3b5('0x7')](),controller[_0xb3b5('0x8')]);router[_0xb3b5('0x6')](_0xb3b5('0x9'),auth[_0xb3b5('0x7')](),controller[_0xb3b5('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb3b5('0x6')](_0xb3b5('0xb'),auth[_0xb3b5('0x7')](),controller[_0xb3b5('0xc')]);router[_0xb3b5('0xd')]('/',auth[_0xb3b5('0x7')](),controller[_0xb3b5('0xe')]);router['post'](_0xb3b5('0xf'),auth['isAuthenticated'](),controller[_0xb3b5('0x10')]);router[_0xb3b5('0x11')](_0xb3b5('0x9'),auth['isAuthenticated'](),controller[_0xb3b5('0x12')]);router[_0xb3b5('0x13')](_0xb3b5('0x9'),auth[_0xb3b5('0x7')](),controller[_0xb3b5('0x14')]);module[_0xb3b5('0x15')]=router; \ No newline at end of file +var _0x7a35=['./intServicenowAccount.controller','isAuthenticated','index','/:id','show','getConfigurations','get','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x10c552,_0x4bca08){var _0x58572b=function(_0x2df4c8){while(--_0x2df4c8){_0x10c552['push'](_0x10c552['shift']());}};_0x58572b(++_0x4bca08);}(_0x7a35,0x88));var _0x57a3=function(_0x40baf1,_0x39a1e3){_0x40baf1=_0x40baf1-0x0;var _0x293477=_0x7a35[_0x40baf1];return _0x293477;};'use strict';var multer=require('multer');var util=require(_0x57a3('0x0'));var path=require(_0x57a3('0x1'));var timeout=require(_0x57a3('0x2'));var express=require(_0x57a3('0x3'));var router=express[_0x57a3('0x4')]();var auth=require(_0x57a3('0x5'));var interaction=require(_0x57a3('0x6'));var config=require(_0x57a3('0x7'));var controller=require(_0x57a3('0x8'));router['get']('/',auth[_0x57a3('0x9')](),controller[_0x57a3('0xa')]);router['get'](_0x57a3('0xb'),auth['isAuthenticated'](),controller[_0x57a3('0xc')]);router['get']('/:id/configurations',auth[_0x57a3('0x9')](),controller[_0x57a3('0xd')]);router[_0x57a3('0xe')](_0x57a3('0xf'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x10')]);router[_0x57a3('0x11')]('/',auth[_0x57a3('0x9')](),controller[_0x57a3('0x12')]);router[_0x57a3('0x11')]('/:id/configurations',auth[_0x57a3('0x9')](),controller[_0x57a3('0x13')]);router[_0x57a3('0x14')](_0x57a3('0xb'),auth[_0x57a3('0x9')](),controller['update']);router[_0x57a3('0x15')](_0x57a3('0xb'),auth[_0x57a3('0x9')](),controller[_0x57a3('0x16')]);module[_0x57a3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 46c7027..9eea2e2 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 _0x1339=['remoteUri','STRING','username'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1339,0x1ed));var _0x9133=function(_0x4be4d8,_0x4411f1){_0x4be4d8=_0x4be4d8-0x0;var _0x4f9dcd=_0x1339[_0x4be4d8];return _0x4f9dcd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9133('0x0')]},'description':{'type':Sequelize[_0x9133('0x0')]},'username':{'type':Sequelize[_0x9133('0x0')],'unique':_0x9133('0x1')},'password':{'type':Sequelize[_0x9133('0x0')]},'email':{'type':Sequelize[_0x9133('0x0')]},'remoteUri':{'type':Sequelize[_0x9133('0x0')],'unique':_0x9133('0x2')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1d2d=['sequelize','exports','STRING','remoteUri'];(function(_0x21f83c,_0x309e0c){var _0x4a15f2=function(_0x3ef5c6){while(--_0x3ef5c6){_0x21f83c['push'](_0x21f83c['shift']());}};_0x4a15f2(++_0x309e0c);}(_0x1d2d,0xf0));var _0xd1d2=function(_0xb05127,_0x204f6b){_0xb05127=_0xb05127-0x0;var _0x3eed33=_0x1d2d[_0xb05127];return _0x3eed33;};'use strict';var Sequelize=require(_0xd1d2('0x0'));module[_0xd1d2('0x1')]={'name':{'type':Sequelize[_0xd1d2('0x2')]},'description':{'type':Sequelize[_0xd1d2('0x2')]},'username':{'type':Sequelize[_0xd1d2('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xd1d2('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd1d2('0x3')},'serverUrl':{'type':Sequelize[_0xd1d2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index d396999..1a9430c 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 _0x5fab=['value','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','send','index','ServicenowAccount','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','Descriptions','ServicenowField','made_sla','hold_reason','knowledge','notify','incident_state','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','opened_at','business_duration','group_list','work_end','caller_id','subcategory','work_notes','short_description','close_code','delivery_task','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','activity_due','severity','comments','approval','comments_and_work_notes','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','username','password','email','serverUrl','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','assign','remove','includes','name','forEach','label','TCL:\x20_object','internalType','push','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x5fab,0x177));var _0xb5fa=function(_0x4d554d,_0x4e7503){_0x4d554d=_0x4d554d-0x0;var _0x3cf518=_0x5fab[_0x4d554d];return _0x3cf518;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0xb5fa('0x11'));var qs=require(_0xb5fa('0x12'));var logger=require(_0xb5fa('0x13'))(_0xb5fa('0x14'));var utils=require(_0xb5fa('0x15'));var config=require(_0xb5fa('0x16'));var db=require(_0xb5fa('0x17'))['db'];var integrations=require(_0xb5fa('0x18'));var jayson=require(_0xb5fa('0x19'));var client=jayson['client'][_0xb5fa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3dad4d,_0x56e8b0,_0x116849,_0x577af0){return new BPromise(function(_0x265992,_0x3fc372){var _0x40c914=_0x577af0||client;return _0x40c914[_0xb5fa('0x1b')](_0x3dad4d,_0x116849)[_0xb5fa('0x1c')](function(_0x5371cf){logger['info'](_0xb5fa('0x1d'),_0x56e8b0,_0xb5fa('0x1e'));logger[_0xb5fa('0x1f')](_0xb5fa('0x20'),_0x56e8b0,'request\x20sent',JSON['stringify'](_0x5371cf));if(_0x5371cf[_0xb5fa('0x21')]){if(_0x5371cf[_0xb5fa('0x21')][_0xb5fa('0x22')]===0x1f4){logger[_0xb5fa('0x21')](_0xb5fa('0x1d'),_0x56e8b0,_0x5371cf[_0xb5fa('0x21')][_0xb5fa('0x23')]);return _0x3fc372(_0x5371cf[_0xb5fa('0x21')][_0xb5fa('0x23')]);}logger[_0xb5fa('0x21')](_0xb5fa('0x1d'),_0x56e8b0,_0x5371cf[_0xb5fa('0x21')]['message']);return _0x265992(_0x5371cf[_0xb5fa('0x21')]['message']);}else{logger[_0xb5fa('0x24')]('ServicenowAccount,\x20%s,\x20%s',_0x56e8b0,_0xb5fa('0x1e'));_0x265992(_0x5371cf[_0xb5fa('0x25')]['message']);}})[_0xb5fa('0x26')](function(_0x3a2ab9){logger[_0xb5fa('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0x56e8b0,_0x3a2ab9);_0x3fc372(_0x3a2ab9);});});}function respondWithStatusCode(_0x32a85c,_0xec108f){_0xec108f=_0xec108f||0xcc;return function(_0x444237){if(_0x444237){return _0x32a85c['sendStatus'](_0xec108f);}return _0x32a85c[_0xb5fa('0x27')](_0xec108f)['end']();};}function respondWithResult(_0x106c4b,_0x264591){_0x264591=_0x264591||0xc8;return function(_0x11053a){if(_0x11053a){return _0x106c4b[_0xb5fa('0x27')](_0x264591)[_0xb5fa('0x28')](_0x11053a);}};}function respondWithFilteredResult(_0x3f61cd,_0x6a455c){return function(_0x20d649){if(_0x20d649){var _0x568870=_0x20d649[_0xb5fa('0x29')],_0x4ec294=_0x6a455c[_0xb5fa('0x2a')],_0x5bdf11=_0x6a455c[_0xb5fa('0x2a')]+_0x6a455c[_0xb5fa('0x2b')],_0x5a1c39;if(_0x5bdf11>=_0x568870){_0x5bdf11=_0x568870;_0x5a1c39=0xc8;}else{_0x5a1c39=0xce;}_0x3f61cd[_0xb5fa('0x27')](_0x5a1c39);return _0x3f61cd[_0xb5fa('0x2c')](_0xb5fa('0x2d'),_0x4ec294+'-'+_0x5bdf11+'/'+_0x568870)[_0xb5fa('0x28')](_0x20d649);}return null;};}function patchUpdates(_0x409af9){return function(_0x2a5690){try{jsonpatch[_0xb5fa('0x2e')](_0x2a5690,_0x409af9,!![]);}catch(_0x259d21){return BPromise[_0xb5fa('0x2f')](_0x259d21);}return _0x2a5690[_0xb5fa('0x30')]();};}function saveUpdates(_0xed02e,_0x116773){return function(_0x5a0152){if(_0x5a0152){return _0x5a0152[_0xb5fa('0x31')](_0xed02e)[_0xb5fa('0x1c')](function(_0x319c48){return _0x319c48;});}return null;};}function removeEntity(_0x291938,_0x370d95){return function(_0x10fb43){if(_0x10fb43){return _0x10fb43[_0xb5fa('0x32')]()['then'](function(){_0x291938[_0xb5fa('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c7fdd,_0x558708){return function(_0x1e6ba0){if(!_0x1e6ba0){_0x5c7fdd['sendStatus'](0x194);}return _0x1e6ba0;};}function handleError(_0x3bb4de,_0x5876f1){_0x5876f1=_0x5876f1||0x1f4;return function(_0x5518b1){logger[_0xb5fa('0x21')](_0x5518b1[_0xb5fa('0x33')]);if(_0x5518b1['name']){delete _0x5518b1['name'];}_0x3bb4de[_0xb5fa('0x27')](_0x5876f1)[_0xb5fa('0x34')](_0x5518b1);};}exports[_0xb5fa('0x35')]=function(_0x560b53,_0xc9adee){var _0xc28a80={},_0x4a7137={},_0x18398f={'count':0x0,'rows':[]};var _0x2056de=db[_0xb5fa('0x36')]['rawAttributes'];_0x4a7137[_0xb5fa('0x37')]=_[_0xb5fa('0x38')](_0x2056de);_0x4a7137[_0xb5fa('0x39')]=_['keys'](_0x560b53[_0xb5fa('0x39')]);_0x4a7137[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x4a7137[_0xb5fa('0x37')],_0x4a7137['query']);_0xc28a80['attributes']=_['intersection'](_0x4a7137['model'],qs['fields'](_0x560b53['query'][_0xb5fa('0x3c')]));_0xc28a80['attributes']=_0xc28a80[_0xb5fa('0x3d')][_0xb5fa('0x3e')]?_0xc28a80[_0xb5fa('0x3d')]:_0x4a7137[_0xb5fa('0x37')];if(!_0x560b53[_0xb5fa('0x39')][_0xb5fa('0x3f')]('nolimit')){_0xc28a80['limit']=qs['limit'](_0x560b53[_0xb5fa('0x39')]['limit']);_0xc28a80[_0xb5fa('0x2a')]=qs['offset'](_0x560b53['query'][_0xb5fa('0x2a')]);}_0xc28a80[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0x560b53[_0xb5fa('0x39')][_0xb5fa('0x41')]);_0xc28a80[_0xb5fa('0x42')]=qs[_0xb5fa('0x3a')](_[_0xb5fa('0x43')](_0x560b53[_0xb5fa('0x39')],_0x4a7137[_0xb5fa('0x3a')]));if(_0x560b53['query'][_0xb5fa('0x44')]){_0xc28a80['where']=_[_0xb5fa('0x45')](_0xc28a80[_0xb5fa('0x42')],{'$or':_[_0xb5fa('0x46')](_0x2056de,function(_0x2ef359){if(_0x2ef359[_0xb5fa('0x47')][_0xb5fa('0x48')]!==_0xb5fa('0x49')){var _0x10c381={};_0x10c381[_0x2ef359['field']]={'$like':'%'+_0x560b53[_0xb5fa('0x39')][_0xb5fa('0x44')]+'%'};return _0x10c381;}})});}_0xc28a80=_['merge']({},_0xc28a80,_0x560b53[_0xb5fa('0x4a')]);var _0x5a6ae3={'where':_0xc28a80[_0xb5fa('0x42')]};return db[_0xb5fa('0x36')]['count'](_0x5a6ae3)['then'](function(_0x2db269){_0x18398f[_0xb5fa('0x29')]=_0x2db269;if(_0x560b53[_0xb5fa('0x39')][_0xb5fa('0x4b')]){_0xc28a80[_0xb5fa('0x4c')]=[{'all':!![]}];}return db[_0xb5fa('0x36')][_0xb5fa('0x4d')](_0xc28a80);})[_0xb5fa('0x1c')](function(_0x499d36){_0x18398f[_0xb5fa('0x4e')]=_0x499d36;return _0x18398f;})[_0xb5fa('0x1c')](respondWithFilteredResult(_0xc9adee,_0xc28a80))['catch'](handleError(_0xc9adee,null));};exports[_0xb5fa('0x4f')]=function(_0x2c378a,_0x247999){var _0x43b056={'raw':![],'where':{'id':_0x2c378a[_0xb5fa('0x50')]['id']}},_0x30d0d4={};_0x30d0d4[_0xb5fa('0x37')]=_[_0xb5fa('0x38')](db[_0xb5fa('0x36')][_0xb5fa('0x51')]);_0x30d0d4[_0xb5fa('0x39')]=_[_0xb5fa('0x38')](_0x2c378a[_0xb5fa('0x39')]);_0x30d0d4[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x30d0d4[_0xb5fa('0x37')],_0x30d0d4['query']);_0x43b056['attributes']=_[_0xb5fa('0x3b')](_0x30d0d4['model'],qs[_0xb5fa('0x3c')](_0x2c378a[_0xb5fa('0x39')]['fields']));_0x43b056[_0xb5fa('0x3d')]=_0x43b056[_0xb5fa('0x3d')][_0xb5fa('0x3e')]?_0x43b056[_0xb5fa('0x3d')]:_0x30d0d4[_0xb5fa('0x37')];if(_0x2c378a[_0xb5fa('0x39')]['includeAll']){_0x43b056[_0xb5fa('0x4c')]=[{'all':!![]}];}_0x43b056=_['merge']({},_0x43b056,_0x2c378a[_0xb5fa('0x4a')]);return db[_0xb5fa('0x36')][_0xb5fa('0x52')](_0x43b056)['then'](handleEntityNotFound(_0x247999,null))[_0xb5fa('0x1c')](respondWithResult(_0x247999,null))[_0xb5fa('0x26')](handleError(_0x247999,null));};exports['create']=function(_0x4f6ffa,_0x3f19ee){return db[_0xb5fa('0x36')][_0xb5fa('0x53')](_0x4f6ffa[_0xb5fa('0x54')],{})[_0xb5fa('0x1c')](respondWithResult(_0x3f19ee,0xc9))[_0xb5fa('0x26')](handleError(_0x3f19ee,null));};exports[_0xb5fa('0x31')]=function(_0x3b092a,_0x1c1f1b){if(_0x3b092a[_0xb5fa('0x54')]['id']){delete _0x3b092a[_0xb5fa('0x54')]['id'];}return db[_0xb5fa('0x36')][_0xb5fa('0x52')]({'where':{'id':_0x3b092a[_0xb5fa('0x50')]['id']}})[_0xb5fa('0x1c')](handleEntityNotFound(_0x1c1f1b,null))[_0xb5fa('0x1c')](saveUpdates(_0x3b092a[_0xb5fa('0x54')],null))[_0xb5fa('0x1c')](respondWithResult(_0x1c1f1b,null))['catch'](handleError(_0x1c1f1b,null));};exports[_0xb5fa('0x32')]=function(_0x347791,_0x222016){return db[_0xb5fa('0x36')][_0xb5fa('0x52')]({'where':{'id':_0x347791[_0xb5fa('0x50')]['id']}})[_0xb5fa('0x1c')](handleEntityNotFound(_0x222016,null))[_0xb5fa('0x1c')](removeEntity(_0x222016,null))[_0xb5fa('0x26')](handleError(_0x222016,null));};exports[_0xb5fa('0x55')]=function(_0x4ea97d,_0x5750d0,_0x311aa3){var _0x264732={};var _0x1e78cb={};var _0x5caf84;var _0x441c41;return db[_0xb5fa('0x36')][_0xb5fa('0x56')]({'where':{'id':_0x4ea97d[_0xb5fa('0x50')]['id']}})[_0xb5fa('0x1c')](handleEntityNotFound(_0x5750d0,null))[_0xb5fa('0x1c')](function(_0x2e7286){if(_0x2e7286){_0x5caf84=_0x2e7286;_0x1e78cb['model']=_[_0xb5fa('0x38')](db[_0xb5fa('0x57')]['rawAttributes']);_0x1e78cb[_0xb5fa('0x39')]=_[_0xb5fa('0x38')](_0x4ea97d['query']);_0x1e78cb[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x1e78cb[_0xb5fa('0x37')],_0x1e78cb[_0xb5fa('0x39')]);_0x264732[_0xb5fa('0x3d')]=_[_0xb5fa('0x3b')](_0x1e78cb[_0xb5fa('0x37')],qs[_0xb5fa('0x3c')](_0x4ea97d[_0xb5fa('0x39')][_0xb5fa('0x3c')]));_0x264732[_0xb5fa('0x3d')]=_0x264732[_0xb5fa('0x3d')][_0xb5fa('0x3e')]?_0x264732[_0xb5fa('0x3d')]:_0x1e78cb[_0xb5fa('0x37')];_0x264732[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0x4ea97d[_0xb5fa('0x39')][_0xb5fa('0x41')]);_0x264732[_0xb5fa('0x42')]=qs[_0xb5fa('0x3a')](_[_0xb5fa('0x43')](_0x4ea97d['query'],_0x1e78cb[_0xb5fa('0x3a')]));if(_0x4ea97d[_0xb5fa('0x39')][_0xb5fa('0x44')]){_0x264732['where']=_[_0xb5fa('0x45')](_0x264732[_0xb5fa('0x42')],{'$or':_['map'](_0x264732[_0xb5fa('0x3d')],function(_0xb535c3){var _0x5c25f6={};_0x5c25f6[_0xb535c3]={'$like':'%'+_0x4ea97d['query']['filter']+'%'};return _0x5c25f6;})});}_0x264732=_[_0xb5fa('0x45')]({},_0x264732,_0x4ea97d[_0xb5fa('0x4a')]);return _0x5caf84[_0xb5fa('0x55')](_0x264732);}})['then'](function(_0x597206){if(_0x597206){_0x441c41=_0x597206[_0xb5fa('0x3e')];if(!_0x4ea97d[_0xb5fa('0x39')][_0xb5fa('0x3f')]('nolimit')){_0x264732['limit']=qs['limit'](_0x4ea97d[_0xb5fa('0x39')][_0xb5fa('0x2b')]);_0x264732[_0xb5fa('0x2a')]=qs['offset'](_0x4ea97d[_0xb5fa('0x39')][_0xb5fa('0x2a')]);}return _0x5caf84[_0xb5fa('0x55')](_0x264732);}})[_0xb5fa('0x1c')](function(_0x2a1872){if(_0x2a1872){return _0x2a1872?{'count':_0x441c41,'rows':_0x2a1872}:null;}})[_0xb5fa('0x1c')](respondWithResult(_0x5750d0,null))[_0xb5fa('0x26')](handleError(_0x5750d0,null));};exports[_0xb5fa('0x58')]=function(_0x35eeb9,_0x371d23,_0x3a1db9){if(_0x35eeb9[_0xb5fa('0x54')]['id']){delete _0x35eeb9[_0xb5fa('0x54')]['id'];}return db[_0xb5fa('0x36')][_0xb5fa('0x56')]({'where':{'id':_0x35eeb9['params']['id']}})[_0xb5fa('0x1c')](handleEntityNotFound(_0x371d23,null))['then'](function(_0x47193c){if(_0x47193c){_0x35eeb9[_0xb5fa('0x54')][_0xb5fa('0x59')]=_0x47193c['id'];_0x35eeb9[_0xb5fa('0x54')][_0xb5fa('0x5a')]=integrations['getSubjects'](_0x35eeb9[_0xb5fa('0x54')]['channel'],_0x35eeb9[_0xb5fa('0x54')][_0xb5fa('0x47')]);_0x35eeb9[_0xb5fa('0x54')][_0xb5fa('0x5b')]=integrations['getDescriptions'](_0x35eeb9['body']['channel'],_0x35eeb9[_0xb5fa('0x54')][_0xb5fa('0x47')]);return db[_0xb5fa('0x57')][_0xb5fa('0x53')](_0x35eeb9[_0xb5fa('0x54')],{'include':[{'model':db[_0xb5fa('0x5c')],'as':'Subjects'},{'model':db[_0xb5fa('0x5c')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x371d23,null))[_0xb5fa('0x26')](handleError(_0x371d23,null));};exports['getFields']=function(_0x5d11bb,_0x4e2253,_0x193e63){var _0x5cbd84=[_0xb5fa('0x5d'),_0xb5fa('0x5e'),_0xb5fa('0x5f'),'subcategory','close_code',_0xb5fa('0x60'),_0xb5fa('0x61'),'severity',_0xb5fa('0x62')];var _0x3c7cb4=[_0xb5fa('0x63'),_0xb5fa('0x5d'),'caused_by',_0xb5fa('0x64'),_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x5e'),_0xb5fa('0x68'),_0xb5fa('0x69'),'resolved_by',_0xb5fa('0x6a'),'opened_by',_0xb5fa('0x6b'),_0xb5fa('0x6c'),'sys_domain',_0xb5fa('0x6d'),_0xb5fa('0x6e'),_0xb5fa('0x5f'),_0xb5fa('0x40'),_0xb5fa('0x6f'),_0xb5fa('0x70'),_0xb5fa('0x71'),_0xb5fa('0x72'),'impact',_0xb5fa('0x73'),_0xb5fa('0x74'),_0xb5fa('0x75'),_0xb5fa('0x76'),'sys_domain_path','rfc','time_worked','expected_start',_0xb5fa('0x77'),_0xb5fa('0x78'),_0xb5fa('0x79'),_0xb5fa('0x7a'),'reopened_time','resolved_at',_0xb5fa('0x7b'),'approval_set',_0xb5fa('0x7c'),_0xb5fa('0x7d'),_0xb5fa('0x7e'),_0xb5fa('0x7f'),'correlation_display',_0xb5fa('0x80'),'work_start',_0xb5fa('0x81'),_0xb5fa('0x82'),'additional_assignee_list','description',_0xb5fa('0x83'),_0xb5fa('0x60'),_0xb5fa('0x84'),_0xb5fa('0x85'),_0xb5fa('0x86'),_0xb5fa('0x87'),_0xb5fa('0x88'),_0xb5fa('0x89'),_0xb5fa('0x8a'),_0xb5fa('0x8b'),_0xb5fa('0x61'),_0xb5fa('0x8c'),_0xb5fa('0x8d'),'company','reassignment_count',_0xb5fa('0x8e'),'assigned_to',_0xb5fa('0x8f'),_0xb5fa('0x90'),'sla_due',_0xb5fa('0x91'),_0xb5fa('0x92'),'due_date',_0xb5fa('0x93'),_0xb5fa('0x94'),'sys_tags',_0xb5fa('0x95'),_0xb5fa('0x96'),_0xb5fa('0x97'),'location','category'];var _0x9dca71='';var _0x1a24a2='';var _0x3b5e1d=[];var _0x3d18a9='';var _0x397830='';var _0x234d9d=[];var _0x10222c='';var _0x1eec65='';var _0xe0f5a0={};var _0x1a4465='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x5d11bb[_0xb5fa('0x50')]['id']},'attributes':['id',_0xb5fa('0x98'),_0xb5fa('0x99'),_0xb5fa('0x9a'),'remoteUri',_0xb5fa('0x9b')]})[_0xb5fa('0x1c')](handleEntityNotFound(_0x4e2253,null))[_0xb5fa('0x1c')](function(_0x525fe3){if(_0x525fe3){_0x1a4465=_0x525fe3[_0xb5fa('0x9c')];var _0xea65=_0x1a4465[_0xb5fa('0x9d')](-0x1);if(_0xea65==='/'){_0x1a4465=_0x1a4465[_0xb5fa('0x9e')](0x0,_0x1a4465['lastIndexOf'](_0xea65));}_0x1eec65=util[_0xb5fa('0x9f')](_0xb5fa('0xa0'),_0x1a4465);_0x10222c=util[_0xb5fa('0x9f')](_0xb5fa('0xa1'),_0x1a4465);_0xe0f5a0={'user':_0x525fe3[_0xb5fa('0x98')],'pass':_0x525fe3[_0xb5fa('0x99')]};var _0x36014a={'method':_0xb5fa('0xa2'),'uri':_0x1eec65+_0xb5fa('0xa3'),'auth':_0xe0f5a0,'json':!![]};return rp(_0x36014a);}})[_0xb5fa('0x1c')](function(_0x10b092){if(_0x10b092[_0xb5fa('0x25')][_0xb5fa('0x3e')]>0x0){_0x9dca71=_0x10b092[_0xb5fa('0x25')];}console[_0xb5fa('0xa4')]('incident\x20table\x20objects',_0x9dca71);_0x234d9d=[];_0x1a24a2=Object[_0xb5fa('0xa5')]([],_0x9dca71);_[_0xb5fa('0xa6')](_0x1a24a2,function(_0x2930bd){return!_0x5cbd84[_0xb5fa('0xa7')](_0x2930bd[_0xb5fa('0xa8')]);});_0x1a24a2[_0xb5fa('0xa9')](function(_0x15874c){var _0x440669=createFieldObject(_0x10222c,_0xe0f5a0,_0x15874c['internalType'],_0x15874c['name'],_0x15874c[_0xb5fa('0xaa')],![]);_0x234d9d['push'](_0x440669);});return Promise['all'](_0x234d9d);})[_0xb5fa('0x1c')](function(_0x27dbe8){_0x3b5e1d=_0x27dbe8;_0x3d18a9=Object[_0xb5fa('0xa5')]([],_0x9dca71);console['log'](_0xb5fa('0xab'),_0x9dca71);_[_0xb5fa('0xa6')](_0x3d18a9,function(_0x3ad445){return _0x3c7cb4['includes'](_0x3ad445[_0xb5fa('0xa8')]);});console[_0xb5fa('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3d18a9);_0x234d9d=[];_0x3d18a9[_0xb5fa('0xa9')](function(_0x3217b0){var _0x3791e7=createFieldObject(_0x10222c,_0xe0f5a0,_0x3217b0[_0xb5fa('0xac')],_0x3217b0[_0xb5fa('0xa8')],_0x3217b0[_0xb5fa('0xaa')],!![]);_0x234d9d[_0xb5fa('0xad')](_0x3791e7);});return Promise['all'](_0x234d9d);})[_0xb5fa('0x1c')](function(_0xafde6d){_0x397830=_0xafde6d;var _0x1f2a81=_0x3b5e1d[_0xb5fa('0xae')](_0x397830);return{'count':_0x1f2a81['length'],'rows':_0x1f2a81};})['then'](respondWithResult(_0x4e2253,null))[_0xb5fa('0x26')](function(_0x21fa37){console[_0xb5fa('0xa4')](_0xb5fa('0xaf')+_0x21fa37);var _0x4eb5a0=_0x5d11bb['query']['test']?0x1f4:_0x21fa37['statusCode']||0x1f4;logger[_0xb5fa('0x21')](_0x21fa37[_0xb5fa('0x33')]);delete _0x21fa37[_0xb5fa('0xa8')];if(_0x4eb5a0===0x191){_0x4eb5a0=0x190;}_0x4e2253[_0xb5fa('0x27')](_0x4eb5a0)[_0xb5fa('0x34')](_0x5d11bb[_0xb5fa('0x39')][_0xb5fa('0xb0')]?{'message':_0xb5fa('0xb1'),'statusCode':_0x21fa37[_0xb5fa('0xb2')]}:_0x21fa37);});};function createFieldObject(_0x312bbb,_0x4581ed,_0x5ce5d7,_0x427d61,_0x2a6f66,_0x517d9c){return new Promise(function(_0x2a74a0,_0x2e01be){var _0x5b7d7e={'id':_0x427d61,'name':_0x2a6f66,'custom':_0x517d9c};if(_0x5ce5d7===_0xb5fa('0xb3')){_0x5b7d7e[_0xb5fa('0x4a')]=[{'name':_0xb5fa('0xb4'),'value':_0xb5fa('0xb5')},{'name':_0xb5fa('0xb6'),'value':_0xb5fa('0xb7')}];_0x2a74a0(_0x5b7d7e);}else{var _0x39dc99={'method':_0xb5fa('0xa2'),'uri':_0x312bbb+_0xb5fa('0xb8')+_0x427d61,'auth':_0x4581ed,'json':!![]};return rp(_0x39dc99)['then'](function(_0x463f20){var _0x1f6516=[];if(_0x463f20[_0xb5fa('0x25')][_0xb5fa('0x3e')]>0x0){_0x463f20[_0xb5fa('0x25')][_0xb5fa('0xa9')](function(_0x569b68){if(_0x569b68[_0xb5fa('0xb9')]==='false'){var _0x36a75d={'name':_0x569b68['label'],'value':_0x569b68[_0xb5fa('0xba')]};_0x1f6516[_0xb5fa('0xad')](_0x36a75d);}});}_0x5b7d7e[_0xb5fa('0x4a')]=_0x1f6516;if(_0x5b7d7e[_0xb5fa('0x4a')][_0xb5fa('0x3e')]>0x0){_0x2a74a0(_0x5b7d7e);}else{if(_0x517d9c==![]){_0x2a74a0();}else{_0x2a74a0(_0x5b7d7e);}}});}});} \ No newline at end of file +var _0x57ca=['Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','notify','incident_state','severity','category','made_sla','caused_by','watch_list','sys_updated_on','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','rfc','time_worked','opened_at','business_duration','work_end','resolved_at','caller_id','approval_set','subcategory','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','sys_mod_count','reopen_count','upon_approval','location','password','serverUrl','remoteUri','slice','format','%s/api/now/table/','log','assign','remove','forEach','label','all','push','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','false','GET','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','ioredis','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','stack','name','send','rawAttributes','model','keys','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','map','type','field','filter','merge','options','ServicenowAccount','include','findAll','show','params','intersection','includeAll','create','body','find','getConfigurations','ServicenowConfiguration','length','order','addConfiguration','findOne','AccountId','Subjects','channel'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x57ca,0x108));var _0xa57c=function(_0x40ca6e,_0x59b87d){_0x40ca6e=_0x40ca6e-0x0;var _0x4b1273=_0x57ca[_0x40ca6e];return _0x4b1273;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa57c('0x0'));var rimraf=require(_0xa57c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa57c('0x2'));var rp=require(_0xa57c('0x3'));var moment=require(_0xa57c('0x4'));var BPromise=require(_0xa57c('0x5'));var Mustache=require(_0xa57c('0x6'));var util=require('util');var path=require(_0xa57c('0x7'));var sox=require(_0xa57c('0x8'));var csv=require(_0xa57c('0x9'));var ejs=require(_0xa57c('0xa'));var fs=require('fs');var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x9'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var authService=require(_0xa57c('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xa57c('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0xa57c('0x12'))(_0xa57c('0x13'));var utils=require('../../config/utils');var config=require(_0xa57c('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa57c('0x15'));var jayson=require(_0xa57c('0x16'));var client=jayson[_0xa57c('0x17')][_0xa57c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x205e72,_0x57a546,_0x2644a1,_0x546cde){return new BPromise(function(_0x30d23d,_0x3d5995){var _0x30940d=_0x546cde||client;return _0x30940d[_0xa57c('0x19')](_0x205e72,_0x2644a1)[_0xa57c('0x1a')](function(_0x37a323){logger[_0xa57c('0x1b')]('ServicenowAccount,\x20%s,\x20%s',_0x57a546,_0xa57c('0x1c'));logger[_0xa57c('0x1d')](_0xa57c('0x1e'),_0x57a546,'request\x20sent',JSON[_0xa57c('0x1f')](_0x37a323));if(_0x37a323['error']){if(_0x37a323[_0xa57c('0x20')][_0xa57c('0x21')]===0x1f4){logger[_0xa57c('0x20')](_0xa57c('0x22'),_0x57a546,_0x37a323[_0xa57c('0x20')][_0xa57c('0x23')]);return _0x3d5995(_0x37a323[_0xa57c('0x20')][_0xa57c('0x23')]);}logger['error'](_0xa57c('0x22'),_0x57a546,_0x37a323['error']['message']);return _0x30d23d(_0x37a323[_0xa57c('0x20')][_0xa57c('0x23')]);}else{logger[_0xa57c('0x1b')](_0xa57c('0x22'),_0x57a546,'request\x20sent');_0x30d23d(_0x37a323[_0xa57c('0x24')][_0xa57c('0x23')]);}})[_0xa57c('0x25')](function(_0x2213b2){logger[_0xa57c('0x20')](_0xa57c('0x22'),_0x57a546,_0x2213b2);_0x3d5995(_0x2213b2);});});}function respondWithStatusCode(_0x1e0192,_0x42038e){_0x42038e=_0x42038e||0xcc;return function(_0x2e99ed){if(_0x2e99ed){return _0x1e0192[_0xa57c('0x26')](_0x42038e);}return _0x1e0192[_0xa57c('0x27')](_0x42038e)[_0xa57c('0x28')]();};}function respondWithResult(_0x241dcc,_0x10a33d){_0x10a33d=_0x10a33d||0xc8;return function(_0x431bec){if(_0x431bec){return _0x241dcc['status'](_0x10a33d)[_0xa57c('0x29')](_0x431bec);}};}function respondWithFilteredResult(_0x5226d0,_0x27884d){return function(_0x5228b9){if(_0x5228b9){var _0x315ad7=_0x5228b9[_0xa57c('0x2a')],_0x1e8e45=_0x27884d[_0xa57c('0x2b')],_0x8ee1c0=_0x27884d['offset']+_0x27884d[_0xa57c('0x2c')],_0xe50fb8;if(_0x8ee1c0>=_0x315ad7){_0x8ee1c0=_0x315ad7;_0xe50fb8=0xc8;}else{_0xe50fb8=0xce;}_0x5226d0['status'](_0xe50fb8);return _0x5226d0['set'](_0xa57c('0x2d'),_0x1e8e45+'-'+_0x8ee1c0+'/'+_0x315ad7)[_0xa57c('0x29')](_0x5228b9);}return null;};}function patchUpdates(_0x5a3e03){return function(_0x12898b){try{jsonpatch[_0xa57c('0x2e')](_0x12898b,_0x5a3e03,!![]);}catch(_0x3eb9e9){return BPromise['reject'](_0x3eb9e9);}return _0x12898b[_0xa57c('0x2f')]();};}function saveUpdates(_0x58d46f,_0xf5f70c){return function(_0x5464f2){if(_0x5464f2){return _0x5464f2[_0xa57c('0x30')](_0x58d46f)['then'](function(_0xd4c5d4){return _0xd4c5d4;});}return null;};}function removeEntity(_0x532164,_0x9e02bb){return function(_0x1d82d9){if(_0x1d82d9){return _0x1d82d9[_0xa57c('0x31')]()[_0xa57c('0x1a')](function(){_0x532164[_0xa57c('0x27')](0xcc)[_0xa57c('0x28')]();});}};}function handleEntityNotFound(_0x4f45c7,_0x5aa91e){return function(_0x10cc39){if(!_0x10cc39){_0x4f45c7['sendStatus'](0x194);}return _0x10cc39;};}function handleError(_0xbece0a,_0x315787){_0x315787=_0x315787||0x1f4;return function(_0x27ada0){logger['error'](_0x27ada0[_0xa57c('0x32')]);if(_0x27ada0['name']){delete _0x27ada0[_0xa57c('0x33')];}_0xbece0a['status'](_0x315787)[_0xa57c('0x34')](_0x27ada0);};}exports['index']=function(_0x433116,_0x46f03d){var _0x4903ae={},_0x3b8d17={},_0x47b65c={'count':0x0,'rows':[]};var _0x1eeeb8=db['ServicenowAccount'][_0xa57c('0x35')];_0x3b8d17[_0xa57c('0x36')]=_[_0xa57c('0x37')](_0x1eeeb8);_0x3b8d17[_0xa57c('0x38')]=_[_0xa57c('0x37')](_0x433116[_0xa57c('0x38')]);_0x3b8d17['filters']=_['intersection'](_0x3b8d17[_0xa57c('0x36')],_0x3b8d17[_0xa57c('0x38')]);_0x4903ae[_0xa57c('0x39')]=_['intersection'](_0x3b8d17[_0xa57c('0x36')],qs['fields'](_0x433116[_0xa57c('0x38')][_0xa57c('0x3a')]));_0x4903ae['attributes']=_0x4903ae['attributes']['length']?_0x4903ae[_0xa57c('0x39')]:_0x3b8d17[_0xa57c('0x36')];if(!_0x433116[_0xa57c('0x38')][_0xa57c('0x3b')](_0xa57c('0x3c'))){_0x4903ae[_0xa57c('0x2c')]=qs['limit'](_0x433116[_0xa57c('0x38')][_0xa57c('0x2c')]);_0x4903ae['offset']=qs['offset'](_0x433116[_0xa57c('0x38')][_0xa57c('0x2b')]);}_0x4903ae['order']=qs[_0xa57c('0x3d')](_0x433116[_0xa57c('0x38')][_0xa57c('0x3d')]);_0x4903ae[_0xa57c('0x3e')]=qs[_0xa57c('0x3f')](_[_0xa57c('0x40')](_0x433116['query'],_0x3b8d17[_0xa57c('0x3f')]));if(_0x433116['query']['filter']){_0x4903ae['where']=_['merge'](_0x4903ae['where'],{'$or':_[_0xa57c('0x41')](_0x1eeeb8,function(_0x32ed25){if(_0x32ed25[_0xa57c('0x42')]['key']!=='VIRTUAL'){var _0x49e072={};_0x49e072[_0x32ed25[_0xa57c('0x43')]]={'$like':'%'+_0x433116[_0xa57c('0x38')][_0xa57c('0x44')]+'%'};return _0x49e072;}})});}_0x4903ae=_[_0xa57c('0x45')]({},_0x4903ae,_0x433116[_0xa57c('0x46')]);var _0x17c5dd={'where':_0x4903ae['where']};return db[_0xa57c('0x47')][_0xa57c('0x2a')](_0x17c5dd)[_0xa57c('0x1a')](function(_0x3a3a4a){_0x47b65c[_0xa57c('0x2a')]=_0x3a3a4a;if(_0x433116[_0xa57c('0x38')]['includeAll']){_0x4903ae[_0xa57c('0x48')]=[{'all':!![]}];}return db[_0xa57c('0x47')][_0xa57c('0x49')](_0x4903ae);})[_0xa57c('0x1a')](function(_0x269dfd){_0x47b65c['rows']=_0x269dfd;return _0x47b65c;})[_0xa57c('0x1a')](respondWithFilteredResult(_0x46f03d,_0x4903ae))[_0xa57c('0x25')](handleError(_0x46f03d,null));};exports[_0xa57c('0x4a')]=function(_0x17aae4,_0x7ba8ab){var _0x11fccc={'raw':![],'where':{'id':_0x17aae4[_0xa57c('0x4b')]['id']}},_0x5e155a={};_0x5e155a[_0xa57c('0x36')]=_[_0xa57c('0x37')](db[_0xa57c('0x47')][_0xa57c('0x35')]);_0x5e155a[_0xa57c('0x38')]=_['keys'](_0x17aae4['query']);_0x5e155a['filters']=_['intersection'](_0x5e155a[_0xa57c('0x36')],_0x5e155a['query']);_0x11fccc[_0xa57c('0x39')]=_[_0xa57c('0x4c')](_0x5e155a['model'],qs[_0xa57c('0x3a')](_0x17aae4[_0xa57c('0x38')][_0xa57c('0x3a')]));_0x11fccc[_0xa57c('0x39')]=_0x11fccc[_0xa57c('0x39')]['length']?_0x11fccc[_0xa57c('0x39')]:_0x5e155a[_0xa57c('0x36')];if(_0x17aae4[_0xa57c('0x38')][_0xa57c('0x4d')]){_0x11fccc[_0xa57c('0x48')]=[{'all':!![]}];}_0x11fccc=_['merge']({},_0x11fccc,_0x17aae4[_0xa57c('0x46')]);return db['ServicenowAccount']['find'](_0x11fccc)[_0xa57c('0x1a')](handleEntityNotFound(_0x7ba8ab,null))[_0xa57c('0x1a')](respondWithResult(_0x7ba8ab,null))[_0xa57c('0x25')](handleError(_0x7ba8ab,null));};exports['create']=function(_0x56d36c,_0x10c281){return db[_0xa57c('0x47')][_0xa57c('0x4e')](_0x56d36c[_0xa57c('0x4f')],{})['then'](respondWithResult(_0x10c281,0xc9))[_0xa57c('0x25')](handleError(_0x10c281,null));};exports[_0xa57c('0x30')]=function(_0xe8c63e,_0x59eadc){if(_0xe8c63e['body']['id']){delete _0xe8c63e[_0xa57c('0x4f')]['id'];}return db[_0xa57c('0x47')]['find']({'where':{'id':_0xe8c63e[_0xa57c('0x4b')]['id']}})[_0xa57c('0x1a')](handleEntityNotFound(_0x59eadc,null))[_0xa57c('0x1a')](saveUpdates(_0xe8c63e[_0xa57c('0x4f')],null))[_0xa57c('0x1a')](respondWithResult(_0x59eadc,null))[_0xa57c('0x25')](handleError(_0x59eadc,null));};exports[_0xa57c('0x31')]=function(_0x4ee02a,_0x523a79){return db[_0xa57c('0x47')][_0xa57c('0x50')]({'where':{'id':_0x4ee02a[_0xa57c('0x4b')]['id']}})[_0xa57c('0x1a')](handleEntityNotFound(_0x523a79,null))[_0xa57c('0x1a')](removeEntity(_0x523a79,null))[_0xa57c('0x25')](handleError(_0x523a79,null));};exports[_0xa57c('0x51')]=function(_0x4519a0,_0x522d0e,_0x4da028){var _0x28997e={};var _0x4e18ad={};var _0x1880e6;var _0x1da3ef;return db[_0xa57c('0x47')]['findOne']({'where':{'id':_0x4519a0[_0xa57c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x522d0e,null))[_0xa57c('0x1a')](function(_0x4b3416){if(_0x4b3416){_0x1880e6=_0x4b3416;_0x4e18ad[_0xa57c('0x36')]=_[_0xa57c('0x37')](db[_0xa57c('0x52')][_0xa57c('0x35')]);_0x4e18ad['query']=_[_0xa57c('0x37')](_0x4519a0[_0xa57c('0x38')]);_0x4e18ad[_0xa57c('0x3f')]=_[_0xa57c('0x4c')](_0x4e18ad[_0xa57c('0x36')],_0x4e18ad['query']);_0x28997e[_0xa57c('0x39')]=_[_0xa57c('0x4c')](_0x4e18ad[_0xa57c('0x36')],qs[_0xa57c('0x3a')](_0x4519a0[_0xa57c('0x38')][_0xa57c('0x3a')]));_0x28997e[_0xa57c('0x39')]=_0x28997e[_0xa57c('0x39')][_0xa57c('0x53')]?_0x28997e[_0xa57c('0x39')]:_0x4e18ad['model'];_0x28997e[_0xa57c('0x54')]=qs[_0xa57c('0x3d')](_0x4519a0[_0xa57c('0x38')][_0xa57c('0x3d')]);_0x28997e[_0xa57c('0x3e')]=qs[_0xa57c('0x3f')](_['pick'](_0x4519a0[_0xa57c('0x38')],_0x4e18ad[_0xa57c('0x3f')]));if(_0x4519a0['query'][_0xa57c('0x44')]){_0x28997e[_0xa57c('0x3e')]=_[_0xa57c('0x45')](_0x28997e[_0xa57c('0x3e')],{'$or':_[_0xa57c('0x41')](_0x28997e[_0xa57c('0x39')],function(_0x24efa0){var _0x5e1103={};_0x5e1103[_0x24efa0]={'$like':'%'+_0x4519a0[_0xa57c('0x38')]['filter']+'%'};return _0x5e1103;})});}_0x28997e=_[_0xa57c('0x45')]({},_0x28997e,_0x4519a0['options']);return _0x1880e6[_0xa57c('0x51')](_0x28997e);}})['then'](function(_0x3ef1f1){if(_0x3ef1f1){_0x1da3ef=_0x3ef1f1[_0xa57c('0x53')];if(!_0x4519a0['query'][_0xa57c('0x3b')](_0xa57c('0x3c'))){_0x28997e[_0xa57c('0x2c')]=qs[_0xa57c('0x2c')](_0x4519a0['query'][_0xa57c('0x2c')]);_0x28997e[_0xa57c('0x2b')]=qs[_0xa57c('0x2b')](_0x4519a0[_0xa57c('0x38')][_0xa57c('0x2b')]);}return _0x1880e6[_0xa57c('0x51')](_0x28997e);}})[_0xa57c('0x1a')](function(_0x2a5983){if(_0x2a5983){return _0x2a5983?{'count':_0x1da3ef,'rows':_0x2a5983}:null;}})[_0xa57c('0x1a')](respondWithResult(_0x522d0e,null))[_0xa57c('0x25')](handleError(_0x522d0e,null));};exports[_0xa57c('0x55')]=function(_0x399968,_0x27ab1b,_0x83e9c7){if(_0x399968[_0xa57c('0x4f')]['id']){delete _0x399968[_0xa57c('0x4f')]['id'];}return db['ServicenowAccount'][_0xa57c('0x56')]({'where':{'id':_0x399968['params']['id']}})[_0xa57c('0x1a')](handleEntityNotFound(_0x27ab1b,null))[_0xa57c('0x1a')](function(_0x245238){if(_0x245238){_0x399968['body'][_0xa57c('0x57')]=_0x245238['id'];_0x399968[_0xa57c('0x4f')][_0xa57c('0x58')]=integrations['getSubjects'](_0x399968['body'][_0xa57c('0x59')],_0x399968[_0xa57c('0x4f')][_0xa57c('0x42')]);_0x399968[_0xa57c('0x4f')][_0xa57c('0x5a')]=integrations[_0xa57c('0x5b')](_0x399968[_0xa57c('0x4f')][_0xa57c('0x59')],_0x399968[_0xa57c('0x4f')]['type']);return db[_0xa57c('0x52')][_0xa57c('0x4e')](_0x399968['body'],{'include':[{'model':db[_0xa57c('0x5c')],'as':_0xa57c('0x58')},{'model':db[_0xa57c('0x5c')],'as':_0xa57c('0x5a')}]});}return null;})[_0xa57c('0x1a')](respondWithResult(_0x27ab1b,null))[_0xa57c('0x25')](handleError(_0x27ab1b,null));};exports[_0xa57c('0x5d')]=function(_0x10616e,_0x5a457d,_0x2960fd){var _0x29bf7f=['made_sla',_0xa57c('0x5e'),_0xa57c('0x5f'),'subcategory','close_code',_0xa57c('0x60'),_0xa57c('0x61'),_0xa57c('0x62'),_0xa57c('0x63')];var _0x45b211=['parent',_0xa57c('0x64'),_0xa57c('0x65'),_0xa57c('0x66'),'upon_reject',_0xa57c('0x67'),'child_incidents',_0xa57c('0x5e'),_0xa57c('0x68'),_0xa57c('0x69'),_0xa57c('0x6a'),'sys_updated_by',_0xa57c('0x6b'),_0xa57c('0x6c'),_0xa57c('0x6d'),_0xa57c('0x6e'),'state',_0xa57c('0x6f'),_0xa57c('0x5f'),_0xa57c('0x54'),'calendar_stc',_0xa57c('0x70'),_0xa57c('0x71'),_0xa57c('0x72'),'impact',_0xa57c('0x73'),_0xa57c('0x74'),_0xa57c('0x75'),_0xa57c('0x76'),'sys_domain_path',_0xa57c('0x77'),_0xa57c('0x78'),'expected_start',_0xa57c('0x79'),_0xa57c('0x7a'),'group_list',_0xa57c('0x7b'),'reopened_time',_0xa57c('0x7c'),_0xa57c('0x7d'),_0xa57c('0x7e'),_0xa57c('0x7f'),'work_notes',_0xa57c('0x80'),_0xa57c('0x81'),_0xa57c('0x82'),_0xa57c('0x83'),_0xa57c('0x84'),_0xa57c('0x85'),_0xa57c('0x86'),_0xa57c('0x87'),_0xa57c('0x88'),_0xa57c('0x89'),_0xa57c('0x60'),'sys_class_name','close_notes','closed_by',_0xa57c('0x8a'),'parent_incident',_0xa57c('0x8b'),_0xa57c('0x8c'),_0xa57c('0x8d'),'incident_state',_0xa57c('0x8e'),_0xa57c('0x8f'),_0xa57c('0x90'),_0xa57c('0x91'),_0xa57c('0x92'),_0xa57c('0x93'),_0xa57c('0x62'),'comments',_0xa57c('0x94'),_0xa57c('0x95'),'comments_and_work_notes','due_date',_0xa57c('0x96'),_0xa57c('0x97'),'sys_tags','escalation',_0xa57c('0x98'),'correlation_id',_0xa57c('0x99'),_0xa57c('0x63')];var _0x4962c9='';var _0x1cda66='';var _0x1706f1=[];var _0x44558f='';var _0x3df8f5='';var _0x562e79=[];var _0x4dd551='';var _0x17fc78='';var _0x4f7260={};var _0x30838d='';return db[_0xa57c('0x47')]['findOne']({'where':{'id':_0x10616e['params']['id']},'attributes':['id','username',_0xa57c('0x9a'),'email','remoteUri',_0xa57c('0x9b')]})[_0xa57c('0x1a')](handleEntityNotFound(_0x5a457d,null))[_0xa57c('0x1a')](function(_0x49d03b){if(_0x49d03b){_0x30838d=_0x49d03b[_0xa57c('0x9c')];var _0x1f28e9=_0x30838d[_0xa57c('0x9d')](-0x1);if(_0x1f28e9==='/'){_0x30838d=_0x30838d['substring'](0x0,_0x30838d['lastIndexOf'](_0x1f28e9));}_0x17fc78=util[_0xa57c('0x9e')]('%s/api/now/doc/table/schema/',_0x30838d);_0x4dd551=util[_0xa57c('0x9e')](_0xa57c('0x9f'),_0x30838d);_0x4f7260={'user':_0x49d03b['username'],'pass':_0x49d03b[_0xa57c('0x9a')]};var _0x55261e={'method':'GET','uri':_0x17fc78+'incident?sysparm_display_value=all','auth':_0x4f7260,'json':!![]};return rp(_0x55261e);}})[_0xa57c('0x1a')](function(_0x4985bb){if(_0x4985bb['result']['length']>0x0){_0x4962c9=_0x4985bb[_0xa57c('0x24')];}console[_0xa57c('0xa0')]('incident\x20table\x20objects',_0x4962c9);_0x562e79=[];_0x1cda66=Object[_0xa57c('0xa1')]([],_0x4962c9);_[_0xa57c('0xa2')](_0x1cda66,function(_0x25298c){return!_0x29bf7f['includes'](_0x25298c[_0xa57c('0x33')]);});_0x1cda66[_0xa57c('0xa3')](function(_0x997b84){var _0x16b727=createFieldObject(_0x4dd551,_0x4f7260,_0x997b84['internalType'],_0x997b84['name'],_0x997b84[_0xa57c('0xa4')],![]);_0x562e79['push'](_0x16b727);});return Promise[_0xa57c('0xa5')](_0x562e79);})[_0xa57c('0x1a')](function(_0x2cc12b){_0x1706f1=_0x2cc12b;_0x44558f=Object['assign']([],_0x4962c9);console[_0xa57c('0xa0')]('TCL:\x20_object',_0x4962c9);_['remove'](_0x44558f,function(_0x193e63){return _0x45b211['includes'](_0x193e63[_0xa57c('0x33')]);});console[_0xa57c('0xa0')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x44558f);_0x562e79=[];_0x44558f['forEach'](function(_0x46fbea){var _0x3142d1=createFieldObject(_0x4dd551,_0x4f7260,_0x46fbea['internalType'],_0x46fbea['name'],_0x46fbea[_0xa57c('0xa4')],!![]);_0x562e79[_0xa57c('0xa6')](_0x3142d1);});return Promise[_0xa57c('0xa5')](_0x562e79);})['then'](function(_0xa179c7){_0x3df8f5=_0xa179c7;var _0x10f8b4=_0x1706f1[_0xa57c('0xa7')](_0x3df8f5);return{'count':_0x10f8b4[_0xa57c('0x53')],'rows':_0x10f8b4};})[_0xa57c('0x1a')](respondWithResult(_0x5a457d,null))[_0xa57c('0x25')](function(_0x10f1b5){console[_0xa57c('0xa0')](_0xa57c('0xa8')+_0x10f1b5);var _0x75888e=_0x10616e[_0xa57c('0x38')][_0xa57c('0xa9')]?0x1f4:_0x10f1b5[_0xa57c('0xaa')]||0x1f4;logger['error'](_0x10f1b5[_0xa57c('0x32')]);delete _0x10f1b5[_0xa57c('0x33')];if(_0x75888e===0x191){_0x75888e=0x190;}_0x5a457d[_0xa57c('0x27')](_0x75888e)[_0xa57c('0x34')](_0x10616e[_0xa57c('0x38')][_0xa57c('0xa9')]?{'message':'Wrong\x20credentials','statusCode':_0x10f1b5['statusCode']}:_0x10f1b5);});};function createFieldObject(_0x35efab,_0x58e922,_0x5e6ac5,_0x68c843,_0x138edd,_0x122522){return new Promise(function(_0x4baf82,_0x305ed0){var _0x15d761={'id':_0x68c843,'name':_0x138edd,'custom':_0x122522};if(_0x5e6ac5===_0xa57c('0xab')){_0x15d761[_0xa57c('0x46')]=[{'name':_0xa57c('0xac'),'value':'true'},{'name':'False','value':_0xa57c('0xad')}];_0x4baf82(_0x15d761);}else{var _0x113ced={'method':_0xa57c('0xae'),'uri':_0x35efab+'sys_choice?sysparm_query=name=incident^element='+_0x68c843,'auth':_0x58e922,'json':!![]};return rp(_0x113ced)[_0xa57c('0x1a')](function(_0x4e98c8){var _0x10add5=[];if(_0x4e98c8[_0xa57c('0x24')][_0xa57c('0x53')]>0x0){_0x4e98c8[_0xa57c('0x24')][_0xa57c('0xa3')](function(_0x80dfcb){if(_0x80dfcb[_0xa57c('0xaf')]==='false'){var _0x5649c8={'name':_0x80dfcb[_0xa57c('0xa4')],'value':_0x80dfcb[_0xa57c('0xb0')]};_0x10add5[_0xa57c('0xa6')](_0x5649c8);}});}_0x15d761['options']=_0x10add5;if(_0x15d761['options'][_0xa57c('0x53')]>0x0){_0x4baf82(_0x15d761);}else{if(_0x122522==![]){_0x4baf82();}else{_0x4baf82(_0x15d761);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index d557bd8..7b2a8ad 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 _0xdfb9=['../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0xdfb9,0x1b4));var _0x9dfb=function(_0x2d4783,_0x32097a){_0x2d4783=_0x2d4783-0x0;var _0x3747bc=_0xdfb9[_0x2d4783];return _0x3747bc;};'use strict';var _=require(_0x9dfb('0x0'));var util=require(_0x9dfb('0x1'));var logger=require('../../config/logger')(_0x9dfb('0x2'));var moment=require(_0x9dfb('0x3'));var BPromise=require(_0x9dfb('0x4'));var rp=require('request-promise');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x9dfb('0x5'));module[_0x9dfb('0x6')]=function(_0x2fbe81,_0x3d8c27){return _0x2fbe81[_0x9dfb('0x7')]('ServicenowAccount',attributes,{'tableName':_0x9dfb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76f7=['request-promise','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','moment'];(function(_0x45e647,_0x2c482c){var _0x2deace=function(_0x12e383){while(--_0x12e383){_0x45e647['push'](_0x45e647['shift']());}};_0x2deace(++_0x2c482c);}(_0x76f7,0xd9));var _0x776f=function(_0x3387bf,_0x399fc0){_0x3387bf=_0x3387bf-0x0;var _0x50405b=_0x76f7[_0x3387bf];return _0x50405b;};'use strict';var _=require(_0x776f('0x0'));var util=require(_0x776f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x776f('0x2'));var BPromise=require('bluebird');var rp=require(_0x776f('0x3'));var attributes=require(_0x776f('0x4'));var integrations=require(_0x776f('0x5'));module[_0x776f('0x6')]=function(_0x4ff3d2,_0x254822){return _0x4ff3d2[_0x776f('0x7')](_0x776f('0x8'),attributes,{'tableName':_0x776f('0x9'),'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 984890d..eb17507 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 _0x6af5=['stringify','error','message','result','ServicenowAccount','findAll','options','raw','attributes','include','map','model','GetServicenowAccount','catch','ShowServicenowAccount','find','where','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x489537,_0x16b8b5){var _0xca4d5c=function(_0x1c259f){while(--_0x1c259f){_0x489537['push'](_0x489537['shift']());}};_0xca4d5c(++_0x16b8b5);}(_0x6af5,0xd7));var _0x56af=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x6af5[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0x56af('0x0'));var util=require(_0x56af('0x1'));var moment=require('moment');var BPromise=require(_0x56af('0x2'));var rs=require(_0x56af('0x3'));var fs=require('fs');var Redis=require(_0x56af('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56af('0x5'));var config=require(_0x56af('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x56af('0x7')][_0x56af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21294b,_0x3ee1c9,_0x508478){return new BPromise(function(_0x35b828,_0x231025){return client[_0x56af('0x9')](_0x21294b,_0x508478)[_0x56af('0xa')](function(_0x5c276c){logger[_0x56af('0xb')](_0x56af('0xc'),_0x3ee1c9,'request\x20sent');logger[_0x56af('0xd')](_0x56af('0xe'),_0x3ee1c9,_0x56af('0xf'),JSON[_0x56af('0x10')](_0x5c276c));if(_0x5c276c[_0x56af('0x11')]){if(_0x5c276c[_0x56af('0x11')]['code']===0x1f4){logger[_0x56af('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x3ee1c9,_0x5c276c[_0x56af('0x11')][_0x56af('0x12')]);return _0x231025(_0x5c276c['error'][_0x56af('0x12')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3ee1c9,_0x5c276c[_0x56af('0x11')][_0x56af('0x12')]);return _0x35b828(_0x5c276c[_0x56af('0x11')][_0x56af('0x12')]);}else{logger[_0x56af('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x3ee1c9,_0x56af('0xf'));_0x35b828(_0x5c276c[_0x56af('0x13')]['message']);}})['catch'](function(_0x540ff4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3ee1c9,_0x540ff4);_0x231025(_0x540ff4);});});}exports['GetServicenowAccount']=function(_0x12bca9){var _0x4b3924=this;return new Promise(function(_0x3e5317,_0x1ae2c9){return db[_0x56af('0x14')][_0x56af('0x15')]({'raw':_0x12bca9[_0x56af('0x16')]?_0x12bca9[_0x56af('0x16')][_0x56af('0x17')]===undefined?!![]:![]:!![],'where':_0x12bca9[_0x56af('0x16')]?_0x12bca9[_0x56af('0x16')]['where']||null:null,'attributes':_0x12bca9[_0x56af('0x16')]?_0x12bca9['options'][_0x56af('0x18')]||null:null,'limit':_0x12bca9[_0x56af('0x16')]?_0x12bca9[_0x56af('0x16')]['limit']||null:null,'include':_0x12bca9[_0x56af('0x16')]?_0x12bca9['options'][_0x56af('0x19')]?_[_0x56af('0x1a')](_0x12bca9[_0x56af('0x16')][_0x56af('0x19')],function(_0x288721){return{'model':db[_0x288721[_0x56af('0x1b')]],'as':_0x288721['as'],'attributes':_0x288721[_0x56af('0x18')],'include':_0x288721[_0x56af('0x19')]?_[_0x56af('0x1a')](_0x288721[_0x56af('0x19')],function(_0x242aaa){return{'model':db[_0x242aaa[_0x56af('0x1b')]],'as':_0x242aaa['as'],'attributes':_0x242aaa[_0x56af('0x18')],'include':_0x242aaa[_0x56af('0x19')]?_[_0x56af('0x1a')](_0x242aaa[_0x56af('0x19')],function(_0x619990){return{'model':db[_0x619990[_0x56af('0x1b')]],'as':_0x619990['as'],'attributes':_0x619990[_0x56af('0x18')]};}):[]};}):[]};}):[]:[]})[_0x56af('0xa')](function(_0x167006){logger['info']('GetServicenowAccount',_0x12bca9);logger[_0x56af('0xd')](_0x56af('0x1c'),_0x12bca9,JSON[_0x56af('0x10')](_0x167006));_0x3e5317(_0x167006);})[_0x56af('0x1d')](function(_0x36ad69){logger[_0x56af('0x11')](_0x56af('0x1c'),_0x36ad69[_0x56af('0x12')],_0x12bca9);_0x1ae2c9(_0x4b3924['error'](0x1f4,_0x36ad69[_0x56af('0x12')]));});});};exports[_0x56af('0x1e')]=function(_0x481c7d){var _0x198a81=this;return new Promise(function(_0x3d634e,_0x408cc9){return db[_0x56af('0x14')][_0x56af('0x1f')]({'raw':_0x481c7d[_0x56af('0x16')]?_0x481c7d['options'][_0x56af('0x17')]===undefined?!![]:![]:!![],'where':_0x481c7d[_0x56af('0x16')]?_0x481c7d[_0x56af('0x16')][_0x56af('0x20')]||null:null,'attributes':_0x481c7d['options']?_0x481c7d[_0x56af('0x16')][_0x56af('0x18')]||null:null,'include':_0x481c7d[_0x56af('0x16')]?_0x481c7d[_0x56af('0x16')][_0x56af('0x19')]?_[_0x56af('0x1a')](_0x481c7d[_0x56af('0x16')][_0x56af('0x19')],function(_0x51f037){return{'model':db[_0x51f037[_0x56af('0x1b')]],'as':_0x51f037['as'],'attributes':_0x51f037[_0x56af('0x18')],'include':_0x51f037[_0x56af('0x19')]?_[_0x56af('0x1a')](_0x51f037[_0x56af('0x19')],function(_0x8dcff4){return{'model':db[_0x8dcff4[_0x56af('0x1b')]],'as':_0x8dcff4['as'],'attributes':_0x8dcff4[_0x56af('0x18')],'include':_0x8dcff4['include']?_[_0x56af('0x1a')](_0x8dcff4[_0x56af('0x19')],function(_0x31946e){return{'model':db[_0x31946e[_0x56af('0x1b')]],'as':_0x31946e['as'],'attributes':_0x31946e[_0x56af('0x18')]};}):[]};}):[]};}):[]:[]})[_0x56af('0xa')](function(_0x2e9b57){logger['info'](_0x56af('0x1e'),_0x481c7d);logger[_0x56af('0xd')](_0x56af('0x1e'),_0x481c7d,JSON[_0x56af('0x10')](_0x2e9b57));_0x3d634e(_0x2e9b57);})[_0x56af('0x1d')](function(_0x27fdc2){logger[_0x56af('0x11')](_0x56af('0x1e'),_0x27fdc2[_0x56af('0x12')],_0x481c7d);_0x408cc9(_0x198a81[_0x56af('0x11')](0x1f4,_0x27fdc2[_0x56af('0x12')]));});});}; \ No newline at end of file +var _0xaafb=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','include','map','model','ShowServicenowAccount'];(function(_0x19ba99,_0x44a14e){var _0x103179=function(_0x6e0456){while(--_0x6e0456){_0x19ba99['push'](_0x19ba99['shift']());}};_0x103179(++_0x44a14e);}(_0xaafb,0x176));var _0xbaaf=function(_0x3fde68,_0xad35d8){_0x3fde68=_0x3fde68-0x0;var _0x150236=_0xaafb[_0x3fde68];return _0x150236;};'use strict';var _=require('lodash');var util=require(_0xbaaf('0x0'));var moment=require(_0xbaaf('0x1'));var BPromise=require(_0xbaaf('0x2'));var rs=require(_0xbaaf('0x3'));var fs=require('fs');var Redis=require(_0xbaaf('0x4'));var db=require(_0xbaaf('0x5'))['db'];var utils=require(_0xbaaf('0x6'));var logger=require('../../config/logger')(_0xbaaf('0x7'));var config=require(_0xbaaf('0x8'));var jayson=require(_0xbaaf('0x9'));var client=jayson[_0xbaaf('0xa')][_0xbaaf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9fdfeb,_0x375d94,_0x45f8a3){return new BPromise(function(_0x2aa8c0,_0x409062){return client['request'](_0x9fdfeb,_0x45f8a3)[_0xbaaf('0xc')](function(_0xf29032){logger[_0xbaaf('0xd')](_0xbaaf('0xe'),_0x375d94,_0xbaaf('0xf'));logger[_0xbaaf('0x10')](_0xbaaf('0x11'),_0x375d94,_0xbaaf('0xf'),JSON[_0xbaaf('0x12')](_0xf29032));if(_0xf29032[_0xbaaf('0x13')]){if(_0xf29032[_0xbaaf('0x13')][_0xbaaf('0x14')]===0x1f4){logger['error'](_0xbaaf('0xe'),_0x375d94,_0xf29032[_0xbaaf('0x13')][_0xbaaf('0x15')]);return _0x409062(_0xf29032[_0xbaaf('0x13')][_0xbaaf('0x15')]);}logger[_0xbaaf('0x13')](_0xbaaf('0xe'),_0x375d94,_0xf29032['error'][_0xbaaf('0x15')]);return _0x2aa8c0(_0xf29032[_0xbaaf('0x13')][_0xbaaf('0x15')]);}else{logger[_0xbaaf('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x375d94,'request\x20sent');_0x2aa8c0(_0xf29032[_0xbaaf('0x16')][_0xbaaf('0x15')]);}})[_0xbaaf('0x17')](function(_0x1d3798){logger['error'](_0xbaaf('0xe'),_0x375d94,_0x1d3798);_0x409062(_0x1d3798);});});}exports[_0xbaaf('0x18')]=function(_0x1b534c){var _0x57d969=this;return new Promise(function(_0x1c879c,_0x16ee0f){return db[_0xbaaf('0x19')]['findAll']({'raw':_0x1b534c[_0xbaaf('0x1a')]?_0x1b534c[_0xbaaf('0x1a')][_0xbaaf('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b534c[_0xbaaf('0x1a')]?_0x1b534c[_0xbaaf('0x1a')][_0xbaaf('0x1c')]||null:null,'attributes':_0x1b534c['options']?_0x1b534c['options'][_0xbaaf('0x1d')]||null:null,'limit':_0x1b534c[_0xbaaf('0x1a')]?_0x1b534c[_0xbaaf('0x1a')]['limit']||null:null,'include':_0x1b534c['options']?_0x1b534c[_0xbaaf('0x1a')][_0xbaaf('0x1e')]?_[_0xbaaf('0x1f')](_0x1b534c[_0xbaaf('0x1a')][_0xbaaf('0x1e')],function(_0xafe12b){return{'model':db[_0xafe12b[_0xbaaf('0x20')]],'as':_0xafe12b['as'],'attributes':_0xafe12b[_0xbaaf('0x1d')],'include':_0xafe12b[_0xbaaf('0x1e')]?_[_0xbaaf('0x1f')](_0xafe12b[_0xbaaf('0x1e')],function(_0x365734){return{'model':db[_0x365734[_0xbaaf('0x20')]],'as':_0x365734['as'],'attributes':_0x365734[_0xbaaf('0x1d')],'include':_0x365734['include']?_[_0xbaaf('0x1f')](_0x365734[_0xbaaf('0x1e')],function(_0x32208f){return{'model':db[_0x32208f[_0xbaaf('0x20')]],'as':_0x32208f['as'],'attributes':_0x32208f[_0xbaaf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbaaf('0xc')](function(_0x4b128d){logger[_0xbaaf('0xd')]('GetServicenowAccount',_0x1b534c);logger[_0xbaaf('0x10')](_0xbaaf('0x18'),_0x1b534c,JSON[_0xbaaf('0x12')](_0x4b128d));_0x1c879c(_0x4b128d);})['catch'](function(_0xf7697){logger[_0xbaaf('0x13')]('GetServicenowAccount',_0xf7697['message'],_0x1b534c);_0x16ee0f(_0x57d969[_0xbaaf('0x13')](0x1f4,_0xf7697[_0xbaaf('0x15')]));});});};exports[_0xbaaf('0x21')]=function(_0x3b1e47){var _0x551a17=this;return new Promise(function(_0x573aa0,_0x4b056c){return db[_0xbaaf('0x19')]['find']({'raw':_0x3b1e47['options']?_0x3b1e47['options'][_0xbaaf('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b1e47[_0xbaaf('0x1a')]?_0x3b1e47[_0xbaaf('0x1a')][_0xbaaf('0x1c')]||null:null,'attributes':_0x3b1e47['options']?_0x3b1e47[_0xbaaf('0x1a')]['attributes']||null:null,'include':_0x3b1e47[_0xbaaf('0x1a')]?_0x3b1e47[_0xbaaf('0x1a')]['include']?_[_0xbaaf('0x1f')](_0x3b1e47[_0xbaaf('0x1a')][_0xbaaf('0x1e')],function(_0x7436b2){return{'model':db[_0x7436b2[_0xbaaf('0x20')]],'as':_0x7436b2['as'],'attributes':_0x7436b2[_0xbaaf('0x1d')],'include':_0x7436b2[_0xbaaf('0x1e')]?_[_0xbaaf('0x1f')](_0x7436b2[_0xbaaf('0x1e')],function(_0x48730f){return{'model':db[_0x48730f['model']],'as':_0x48730f['as'],'attributes':_0x48730f['attributes'],'include':_0x48730f[_0xbaaf('0x1e')]?_[_0xbaaf('0x1f')](_0x48730f[_0xbaaf('0x1e')],function(_0x59eb6c){return{'model':db[_0x59eb6c[_0xbaaf('0x20')]],'as':_0x59eb6c['as'],'attributes':_0x59eb6c['attributes']};}):[]};}):[]};}):[]:[]})[_0xbaaf('0xc')](function(_0x26de45){logger['info'](_0xbaaf('0x21'),_0x3b1e47);logger[_0xbaaf('0x10')]('ShowServicenowAccount',_0x3b1e47,JSON[_0xbaaf('0x12')](_0x26de45));_0x573aa0(_0x26de45);})['catch'](function(_0x1eb09c){logger[_0xbaaf('0x13')]('ShowServicenowAccount',_0x1eb09c[_0xbaaf('0x15')],_0x3b1e47);_0x4b056c(_0x551a17[_0xbaaf('0x13')](0x1f4,_0x1eb09c['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 36e68fe..8842dfe 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 _0x0b56=['show','get','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','multer','util','path','connect-timeout','Router','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','/:id'];(function(_0x57524e,_0x236f11){var _0x4a0867=function(_0x472b27){while(--_0x472b27){_0x57524e['push'](_0x57524e['shift']());}};_0x4a0867(++_0x236f11);}(_0x0b56,0x11c));var _0x60b5=function(_0x300c30,_0x4d0f4c){_0x300c30=_0x300c30-0x0;var _0x4b421e=_0x0b56[_0x300c30];return _0x4b421e;};'use strict';var multer=require(_0x60b5('0x0'));var util=require(_0x60b5('0x1'));var path=require(_0x60b5('0x2'));var timeout=require(_0x60b5('0x3'));var express=require('express');var router=express[_0x60b5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x60b5('0x5'));var controller=require(_0x60b5('0x6'));router['get']('/',auth[_0x60b5('0x7')](),controller[_0x60b5('0x8')]);router['get'](_0x60b5('0x9'),auth['isAuthenticated'](),controller[_0x60b5('0xa')]);router[_0x60b5('0xb')](_0x60b5('0xc'),auth[_0x60b5('0x7')](),controller[_0x60b5('0xd')]);router[_0x60b5('0xb')]('/:id/subjects',auth[_0x60b5('0x7')](),controller[_0x60b5('0xe')]);router[_0x60b5('0xb')](_0x60b5('0xf'),auth['isAuthenticated'](),controller[_0x60b5('0x10')]);router['post']('/',auth[_0x60b5('0x7')](),controller[_0x60b5('0x11')]);router[_0x60b5('0x12')]('/:id',auth[_0x60b5('0x7')](),controller[_0x60b5('0x13')]);router[_0x60b5('0x14')]('/:id',auth[_0x60b5('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x30cd=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy'];(function(_0x2e045d,_0x44c5c4){var _0x27680f=function(_0x3ac30d){while(--_0x3ac30d){_0x2e045d['push'](_0x2e045d['shift']());}};_0x27680f(++_0x44c5c4);}(_0x30cd,0x1ba));var _0xd30c=function(_0x233578,_0xfd4f8c){_0x233578=_0x233578-0x0;var _0x5b0187=_0x30cd[_0x233578];return _0x5b0187;};'use strict';var multer=require(_0xd30c('0x0'));var util=require(_0xd30c('0x1'));var path=require(_0xd30c('0x2'));var timeout=require(_0xd30c('0x3'));var express=require(_0xd30c('0x4'));var router=express[_0xd30c('0x5')]();var auth=require(_0xd30c('0x6'));var interaction=require(_0xd30c('0x7'));var config=require('../../config/environment');var controller=require(_0xd30c('0x8'));router[_0xd30c('0x9')]('/',auth[_0xd30c('0xa')](),controller[_0xd30c('0xb')]);router[_0xd30c('0x9')](_0xd30c('0xc'),auth[_0xd30c('0xa')](),controller[_0xd30c('0xd')]);router[_0xd30c('0x9')](_0xd30c('0xe'),auth[_0xd30c('0xa')](),controller[_0xd30c('0xf')]);router['get'](_0xd30c('0x10'),auth[_0xd30c('0xa')](),controller[_0xd30c('0x11')]);router[_0xd30c('0x9')](_0xd30c('0x12'),auth[_0xd30c('0xa')](),controller[_0xd30c('0x13')]);router[_0xd30c('0x14')]('/',auth[_0xd30c('0xa')](),controller[_0xd30c('0x15')]);router[_0xd30c('0x16')]('/:id',auth[_0xd30c('0xa')](),controller[_0xd30c('0x17')]);router[_0xd30c('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xd30c('0x19')]);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 ceeecb9..e8a715a 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 _0xe5ec=['sequelize','STRING'];(function(_0xb5a0fb,_0x25751b){var _0x3866ee=function(_0x473d13){while(--_0x473d13){_0xb5a0fb['push'](_0xb5a0fb['shift']());}};_0x3866ee(++_0x25751b);}(_0xe5ec,0x144));var _0xce5e=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0xe5ec[_0x580b15];return _0x1adb1b;};'use strict';var Sequelize=require(_0xce5e('0x0'));module['exports']={'name':{'type':Sequelize[_0xce5e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdd89=['STRING','sequelize','exports'];(function(_0x169e89,_0x2fde3b){var _0x1c4212=function(_0x401f67){while(--_0x401f67){_0x169e89['push'](_0x169e89['shift']());}};_0x1c4212(++_0x2fde3b);}(_0xdd89,0x169));var _0x9dd8=function(_0x2ad008,_0x45c253){_0x2ad008=_0x2ad008-0x0;var _0x4538cf=_0xdd89[_0x2ad008];return _0x4538cf;};'use strict';var Sequelize=require(_0x9dd8('0x0'));module[_0x9dd8('0x1')]={'name':{'type':Sequelize[_0x9dd8('0x2')]},'description':{'type':Sequelize[_0x9dd8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index bbfaf46..c52c964 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 _0xda55=['VIRTUAL','field','options','count','includeAll','include','findAll','rows','show','params','length','body','find','getFields','getSubjects','findOne','ServicenowField','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','ServicenowConfiguration','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','merge','map','type','key'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xda55,0x6d));var _0x5da5=function(_0x67f65f,_0x541c1a){_0x67f65f=_0x67f65f-0x0;var _0x124a3e=_0xda55[_0x67f65f];return _0x124a3e;};'use strict';var pdf=require(_0x5da5('0x0'));var emlformat=require(_0x5da5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5da5('0x2'));var rp=require(_0x5da5('0x3'));var moment=require(_0x5da5('0x4'));var BPromise=require(_0x5da5('0x5'));var Mustache=require(_0x5da5('0x6'));var util=require('util');var path=require(_0x5da5('0x7'));var sox=require('sox');var csv=require(_0x5da5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5da5('0x9'));var squel=require(_0x5da5('0xa'));var crypto=require(_0x5da5('0xb'));var jsforce=require(_0x5da5('0xc'));var deskjs=require(_0x5da5('0xd'));var toCsv=require(_0x5da5('0x8'));var querystring=require(_0x5da5('0xe'));var Papa=require(_0x5da5('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x5da5('0x10'));var Redis=require(_0x5da5('0x11'));var qs=require(_0x5da5('0x12'));var logger=require(_0x5da5('0x13'))(_0x5da5('0x14'));var utils=require(_0x5da5('0x15'));var config=require(_0x5da5('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5da5('0x17'));var client=jayson[_0x5da5('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37aeb0,_0x31366e,_0x3ced00,_0x43d526){return new BPromise(function(_0x1877d4,_0x440b8f){var _0x481562=_0x43d526||client;return _0x481562['request'](_0x37aeb0,_0x3ced00)['then'](function(_0x4267cd){logger[_0x5da5('0x19')](_0x5da5('0x1a'),_0x31366e,_0x5da5('0x1b'));logger[_0x5da5('0x1c')](_0x5da5('0x1d'),_0x31366e,_0x5da5('0x1b'),JSON['stringify'](_0x4267cd));if(_0x4267cd[_0x5da5('0x1e')]){if(_0x4267cd[_0x5da5('0x1e')][_0x5da5('0x1f')]===0x1f4){logger[_0x5da5('0x1e')](_0x5da5('0x1a'),_0x31366e,_0x4267cd[_0x5da5('0x1e')]['message']);return _0x440b8f(_0x4267cd[_0x5da5('0x1e')][_0x5da5('0x20')]);}logger[_0x5da5('0x1e')](_0x5da5('0x1a'),_0x31366e,_0x4267cd[_0x5da5('0x1e')]['message']);return _0x1877d4(_0x4267cd[_0x5da5('0x1e')][_0x5da5('0x20')]);}else{logger[_0x5da5('0x19')]('ServicenowConfiguration,\x20%s,\x20%s',_0x31366e,_0x5da5('0x1b'));_0x1877d4(_0x4267cd[_0x5da5('0x21')][_0x5da5('0x20')]);}})[_0x5da5('0x22')](function(_0xec69f2){logger[_0x5da5('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x31366e,_0xec69f2);_0x440b8f(_0xec69f2);});});}function respondWithStatusCode(_0x1a6bd7,_0x568ddf){_0x568ddf=_0x568ddf||0xcc;return function(_0x1b67c4){if(_0x1b67c4){return _0x1a6bd7[_0x5da5('0x23')](_0x568ddf);}return _0x1a6bd7[_0x5da5('0x24')](_0x568ddf)['end']();};}function respondWithResult(_0x31c6ed,_0x236bf3){_0x236bf3=_0x236bf3||0xc8;return function(_0x39dd93){if(_0x39dd93){return _0x31c6ed[_0x5da5('0x24')](_0x236bf3)['json'](_0x39dd93);}};}function respondWithFilteredResult(_0x5b0b43,_0x50aadc){return function(_0x3526cf){if(_0x3526cf){var _0x56d509=_0x3526cf['count'],_0x4e8890=_0x50aadc[_0x5da5('0x25')],_0x1f75f3=_0x50aadc[_0x5da5('0x25')]+_0x50aadc['limit'],_0x3974d8;if(_0x1f75f3>=_0x56d509){_0x1f75f3=_0x56d509;_0x3974d8=0xc8;}else{_0x3974d8=0xce;}_0x5b0b43[_0x5da5('0x24')](_0x3974d8);return _0x5b0b43[_0x5da5('0x26')](_0x5da5('0x27'),_0x4e8890+'-'+_0x1f75f3+'/'+_0x56d509)[_0x5da5('0x28')](_0x3526cf);}return null;};}function patchUpdates(_0x766ed9){return function(_0x5734ce){try{jsonpatch[_0x5da5('0x29')](_0x5734ce,_0x766ed9,!![]);}catch(_0x2e3c5d){return BPromise[_0x5da5('0x2a')](_0x2e3c5d);}return _0x5734ce[_0x5da5('0x2b')]();};}function saveUpdates(_0x55e2bf,_0x5ee7f2){return function(_0x4cb022){if(_0x4cb022){return _0x4cb022[_0x5da5('0x2c')](_0x55e2bf)[_0x5da5('0x2d')](function(_0x15344b){return _0x15344b;});}return null;};}function removeEntity(_0x338de0,_0x51b712){return function(_0x585298){if(_0x585298){return _0x585298[_0x5da5('0x2e')]()['then'](function(){_0x338de0['status'](0xcc)[_0x5da5('0x2f')]();});}};}function handleEntityNotFound(_0x4c6cce,_0x42dc92){return function(_0x59fba9){if(!_0x59fba9){_0x4c6cce[_0x5da5('0x23')](0x194);}return _0x59fba9;};}function handleError(_0x20475c,_0x6c556d){_0x6c556d=_0x6c556d||0x1f4;return function(_0x29d715){logger[_0x5da5('0x1e')](_0x29d715[_0x5da5('0x30')]);if(_0x29d715['name']){delete _0x29d715[_0x5da5('0x31')];}_0x20475c['status'](_0x6c556d)[_0x5da5('0x32')](_0x29d715);};}exports[_0x5da5('0x33')]=function(_0x28c5eb,_0x464623){var _0x1185c1={},_0x9aba42={},_0x325ccd={'count':0x0,'rows':[]};var _0x117610=db[_0x5da5('0x34')][_0x5da5('0x35')];_0x9aba42[_0x5da5('0x36')]=_[_0x5da5('0x37')](_0x117610);_0x9aba42[_0x5da5('0x38')]=_['keys'](_0x28c5eb[_0x5da5('0x38')]);_0x9aba42['filters']=_[_0x5da5('0x39')](_0x9aba42[_0x5da5('0x36')],_0x9aba42[_0x5da5('0x38')]);_0x1185c1[_0x5da5('0x3a')]=_['intersection'](_0x9aba42[_0x5da5('0x36')],qs[_0x5da5('0x3b')](_0x28c5eb[_0x5da5('0x38')]['fields']));_0x1185c1[_0x5da5('0x3a')]=_0x1185c1[_0x5da5('0x3a')]['length']?_0x1185c1[_0x5da5('0x3a')]:_0x9aba42[_0x5da5('0x36')];if(!_0x28c5eb[_0x5da5('0x38')][_0x5da5('0x3c')](_0x5da5('0x3d'))){_0x1185c1[_0x5da5('0x3e')]=qs['limit'](_0x28c5eb[_0x5da5('0x38')][_0x5da5('0x3e')]);_0x1185c1[_0x5da5('0x25')]=qs[_0x5da5('0x25')](_0x28c5eb[_0x5da5('0x38')]['offset']);}_0x1185c1[_0x5da5('0x3f')]=qs[_0x5da5('0x40')](_0x28c5eb['query'][_0x5da5('0x40')]);_0x1185c1['where']=qs['filters'](_[_0x5da5('0x41')](_0x28c5eb[_0x5da5('0x38')],_0x9aba42[_0x5da5('0x42')]));if(_0x28c5eb[_0x5da5('0x38')][_0x5da5('0x43')]){_0x1185c1[_0x5da5('0x44')]=_[_0x5da5('0x45')](_0x1185c1[_0x5da5('0x44')],{'$or':_[_0x5da5('0x46')](_0x117610,function(_0x2a2814){if(_0x2a2814[_0x5da5('0x47')][_0x5da5('0x48')]!==_0x5da5('0x49')){var _0xc6d127={};_0xc6d127[_0x2a2814[_0x5da5('0x4a')]]={'$like':'%'+_0x28c5eb[_0x5da5('0x38')][_0x5da5('0x43')]+'%'};return _0xc6d127;}})});}_0x1185c1=_[_0x5da5('0x45')]({},_0x1185c1,_0x28c5eb[_0x5da5('0x4b')]);var _0x458041={'where':_0x1185c1['where']};return db['ServicenowConfiguration'][_0x5da5('0x4c')](_0x458041)[_0x5da5('0x2d')](function(_0x55a445){_0x325ccd[_0x5da5('0x4c')]=_0x55a445;if(_0x28c5eb[_0x5da5('0x38')][_0x5da5('0x4d')]){_0x1185c1[_0x5da5('0x4e')]=[{'all':!![]}];}return db[_0x5da5('0x34')][_0x5da5('0x4f')](_0x1185c1);})[_0x5da5('0x2d')](function(_0x362028){_0x325ccd[_0x5da5('0x50')]=_0x362028;return _0x325ccd;})[_0x5da5('0x2d')](respondWithFilteredResult(_0x464623,_0x1185c1))['catch'](handleError(_0x464623,null));};exports[_0x5da5('0x51')]=function(_0x556027,_0x4c6bbf){var _0x2a0fb6={'raw':![],'where':{'id':_0x556027[_0x5da5('0x52')]['id']}},_0x167bde={};_0x167bde[_0x5da5('0x36')]=_[_0x5da5('0x37')](db[_0x5da5('0x34')]['rawAttributes']);_0x167bde[_0x5da5('0x38')]=_['keys'](_0x556027['query']);_0x167bde[_0x5da5('0x42')]=_[_0x5da5('0x39')](_0x167bde['model'],_0x167bde[_0x5da5('0x38')]);_0x2a0fb6[_0x5da5('0x3a')]=_[_0x5da5('0x39')](_0x167bde[_0x5da5('0x36')],qs[_0x5da5('0x3b')](_0x556027['query'][_0x5da5('0x3b')]));_0x2a0fb6['attributes']=_0x2a0fb6['attributes'][_0x5da5('0x53')]?_0x2a0fb6['attributes']:_0x167bde[_0x5da5('0x36')];if(_0x556027[_0x5da5('0x38')][_0x5da5('0x4d')]){_0x2a0fb6[_0x5da5('0x4e')]=[{'all':!![]}];}_0x2a0fb6=_[_0x5da5('0x45')]({},_0x2a0fb6,_0x556027[_0x5da5('0x4b')]);return db['ServicenowConfiguration']['find'](_0x2a0fb6)[_0x5da5('0x2d')](handleEntityNotFound(_0x4c6bbf,null))[_0x5da5('0x2d')](respondWithResult(_0x4c6bbf,null))['catch'](handleError(_0x4c6bbf,null));};exports['create']=function(_0x13edde,_0x4c1321){return db[_0x5da5('0x34')]['create'](_0x13edde['body'],{})[_0x5da5('0x2d')](respondWithResult(_0x4c1321,0xc9))[_0x5da5('0x22')](handleError(_0x4c1321,null));};exports[_0x5da5('0x2c')]=function(_0x39d428,_0x4c654c){if(_0x39d428[_0x5da5('0x54')]['id']){delete _0x39d428[_0x5da5('0x54')]['id'];}return db[_0x5da5('0x34')]['find']({'where':{'id':_0x39d428[_0x5da5('0x52')]['id']}})[_0x5da5('0x2d')](handleEntityNotFound(_0x4c654c,null))[_0x5da5('0x2d')](saveUpdates(_0x39d428[_0x5da5('0x54')],null))[_0x5da5('0x2d')](respondWithResult(_0x4c654c,null))[_0x5da5('0x22')](handleError(_0x4c654c,null));};exports[_0x5da5('0x2e')]=function(_0x53c7dd,_0x3d1a54){return db[_0x5da5('0x34')][_0x5da5('0x55')]({'where':{'id':_0x53c7dd[_0x5da5('0x52')]['id']}})[_0x5da5('0x2d')](handleEntityNotFound(_0x3d1a54,null))[_0x5da5('0x2d')](removeEntity(_0x3d1a54,null))[_0x5da5('0x22')](handleError(_0x3d1a54,null));};exports[_0x5da5('0x56')]=function(_0x285ce2,_0x42be18,_0x191691){var _0x303ab4={};var _0x2c5360={};var _0x4cc539;var _0x1d3625;return db[_0x5da5('0x34')]['findOne']({'where':{'id':_0x285ce2['params']['id']}})['then'](handleEntityNotFound(_0x42be18,null))[_0x5da5('0x2d')](function(_0x469907){if(_0x469907){_0x4cc539=_0x469907;_0x2c5360[_0x5da5('0x36')]=_['keys'](db['ServicenowField'][_0x5da5('0x35')]);_0x2c5360[_0x5da5('0x38')]=_[_0x5da5('0x37')](_0x285ce2[_0x5da5('0x38')]);_0x2c5360['filters']=_[_0x5da5('0x39')](_0x2c5360[_0x5da5('0x36')],_0x2c5360[_0x5da5('0x38')]);_0x303ab4['attributes']=_[_0x5da5('0x39')](_0x2c5360['model'],qs[_0x5da5('0x3b')](_0x285ce2[_0x5da5('0x38')][_0x5da5('0x3b')]));_0x303ab4[_0x5da5('0x3a')]=_0x303ab4[_0x5da5('0x3a')][_0x5da5('0x53')]?_0x303ab4[_0x5da5('0x3a')]:_0x2c5360[_0x5da5('0x36')];_0x303ab4[_0x5da5('0x3f')]=qs[_0x5da5('0x40')](_0x285ce2[_0x5da5('0x38')][_0x5da5('0x40')]);_0x303ab4[_0x5da5('0x44')]=qs[_0x5da5('0x42')](_[_0x5da5('0x41')](_0x285ce2[_0x5da5('0x38')],_0x2c5360[_0x5da5('0x42')]));if(_0x285ce2[_0x5da5('0x38')][_0x5da5('0x43')]){_0x303ab4[_0x5da5('0x44')]=_[_0x5da5('0x45')](_0x303ab4['where'],{'$or':_['map'](_0x303ab4[_0x5da5('0x3a')],function(_0x35cca1){var _0x4041e8={};_0x4041e8[_0x35cca1]={'$like':'%'+_0x285ce2['query'][_0x5da5('0x43')]+'%'};return _0x4041e8;})});}_0x303ab4=_[_0x5da5('0x45')]({},_0x303ab4,_0x285ce2[_0x5da5('0x4b')]);return _0x4cc539[_0x5da5('0x56')](_0x303ab4);}})['then'](function(_0x2c6689){if(_0x2c6689){_0x1d3625=_0x2c6689['length'];if(!_0x285ce2[_0x5da5('0x38')][_0x5da5('0x3c')](_0x5da5('0x3d'))){_0x303ab4[_0x5da5('0x3e')]=qs[_0x5da5('0x3e')](_0x285ce2[_0x5da5('0x38')][_0x5da5('0x3e')]);_0x303ab4['offset']=qs['offset'](_0x285ce2['query'][_0x5da5('0x25')]);}return _0x4cc539[_0x5da5('0x56')](_0x303ab4);}})[_0x5da5('0x2d')](function(_0x152b61){if(_0x152b61){return _0x152b61?{'count':_0x1d3625,'rows':_0x152b61}:null;}})[_0x5da5('0x2d')](respondWithResult(_0x42be18,null))[_0x5da5('0x22')](handleError(_0x42be18,null));};exports[_0x5da5('0x57')]=function(_0xb2f3be,_0x5f4529,_0x7101b2){var _0x444b99={};var _0x592866={};var _0x4dc0ab;var _0x161821;return db['ServicenowConfiguration'][_0x5da5('0x58')]({'where':{'id':_0xb2f3be['params']['id']}})[_0x5da5('0x2d')](handleEntityNotFound(_0x5f4529,null))[_0x5da5('0x2d')](function(_0xa24917){if(_0xa24917){_0x4dc0ab=_0xa24917;_0x592866[_0x5da5('0x36')]=_[_0x5da5('0x37')](db[_0x5da5('0x59')][_0x5da5('0x35')]);_0x592866[_0x5da5('0x38')]=_[_0x5da5('0x37')](_0xb2f3be[_0x5da5('0x38')]);_0x592866[_0x5da5('0x42')]=_[_0x5da5('0x39')](_0x592866['model'],_0x592866['query']);_0x444b99[_0x5da5('0x3a')]=_[_0x5da5('0x39')](_0x592866[_0x5da5('0x36')],qs[_0x5da5('0x3b')](_0xb2f3be['query']['fields']));_0x444b99['attributes']=_0x444b99[_0x5da5('0x3a')][_0x5da5('0x53')]?_0x444b99[_0x5da5('0x3a')]:_0x592866[_0x5da5('0x36')];_0x444b99[_0x5da5('0x3f')]=qs[_0x5da5('0x40')](_0xb2f3be[_0x5da5('0x38')][_0x5da5('0x40')]);_0x444b99[_0x5da5('0x44')]=qs[_0x5da5('0x42')](_[_0x5da5('0x41')](_0xb2f3be[_0x5da5('0x38')],_0x592866[_0x5da5('0x42')]));if(_0xb2f3be[_0x5da5('0x38')][_0x5da5('0x43')]){_0x444b99[_0x5da5('0x44')]=_[_0x5da5('0x45')](_0x444b99[_0x5da5('0x44')],{'$or':_[_0x5da5('0x46')](_0x444b99[_0x5da5('0x3a')],function(_0x207581){var _0x5a7f21={};_0x5a7f21[_0x207581]={'$like':'%'+_0xb2f3be[_0x5da5('0x38')][_0x5da5('0x43')]+'%'};return _0x5a7f21;})});}_0x444b99=_[_0x5da5('0x45')]({},_0x444b99,_0xb2f3be[_0x5da5('0x4b')]);return _0x4dc0ab['getSubjects'](_0x444b99);}})['then'](function(_0x2b14ca){if(_0x2b14ca){_0x161821=_0x2b14ca['length'];if(!_0xb2f3be[_0x5da5('0x38')][_0x5da5('0x3c')](_0x5da5('0x3d'))){_0x444b99[_0x5da5('0x3e')]=qs[_0x5da5('0x3e')](_0xb2f3be[_0x5da5('0x38')][_0x5da5('0x3e')]);_0x444b99[_0x5da5('0x25')]=qs[_0x5da5('0x25')](_0xb2f3be['query'][_0x5da5('0x25')]);}return _0x4dc0ab['getSubjects'](_0x444b99);}})[_0x5da5('0x2d')](function(_0x206842){if(_0x206842){return _0x206842?{'count':_0x161821,'rows':_0x206842}:null;}})['then'](respondWithResult(_0x5f4529,null))[_0x5da5('0x22')](handleError(_0x5f4529,null));};exports['getDescriptions']=function(_0x3a5a4b,_0x4fbfe8,_0x193dde){var _0x3a4ec8={};var _0x2c2815={};var _0x358f8d;var _0x4df458;return db[_0x5da5('0x34')][_0x5da5('0x58')]({'where':{'id':_0x3a5a4b[_0x5da5('0x52')]['id']}})[_0x5da5('0x2d')](handleEntityNotFound(_0x4fbfe8,null))['then'](function(_0x19060e){if(_0x19060e){_0x358f8d=_0x19060e;_0x2c2815[_0x5da5('0x36')]=_['keys'](db['ServicenowField'][_0x5da5('0x35')]);_0x2c2815[_0x5da5('0x38')]=_[_0x5da5('0x37')](_0x3a5a4b[_0x5da5('0x38')]);_0x2c2815['filters']=_[_0x5da5('0x39')](_0x2c2815['model'],_0x2c2815[_0x5da5('0x38')]);_0x3a4ec8['attributes']=_['intersection'](_0x2c2815[_0x5da5('0x36')],qs['fields'](_0x3a5a4b['query'][_0x5da5('0x3b')]));_0x3a4ec8[_0x5da5('0x3a')]=_0x3a4ec8[_0x5da5('0x3a')][_0x5da5('0x53')]?_0x3a4ec8[_0x5da5('0x3a')]:_0x2c2815[_0x5da5('0x36')];_0x3a4ec8[_0x5da5('0x3f')]=qs[_0x5da5('0x40')](_0x3a5a4b['query'][_0x5da5('0x40')]);_0x3a4ec8[_0x5da5('0x44')]=qs[_0x5da5('0x42')](_[_0x5da5('0x41')](_0x3a5a4b[_0x5da5('0x38')],_0x2c2815[_0x5da5('0x42')]));if(_0x3a5a4b[_0x5da5('0x38')][_0x5da5('0x43')]){_0x3a4ec8[_0x5da5('0x44')]=_[_0x5da5('0x45')](_0x3a4ec8[_0x5da5('0x44')],{'$or':_[_0x5da5('0x46')](_0x3a4ec8[_0x5da5('0x3a')],function(_0xed45a1){var _0x300b3a={};_0x300b3a[_0xed45a1]={'$like':'%'+_0x3a5a4b[_0x5da5('0x38')][_0x5da5('0x43')]+'%'};return _0x300b3a;})});}_0x3a4ec8=_[_0x5da5('0x45')]({},_0x3a4ec8,_0x3a5a4b[_0x5da5('0x4b')]);return _0x358f8d[_0x5da5('0x5a')](_0x3a4ec8);}})[_0x5da5('0x2d')](function(_0x392c6d){if(_0x392c6d){_0x4df458=_0x392c6d[_0x5da5('0x53')];if(!_0x3a5a4b[_0x5da5('0x38')]['hasOwnProperty'](_0x5da5('0x3d'))){_0x3a4ec8[_0x5da5('0x3e')]=qs['limit'](_0x3a5a4b[_0x5da5('0x38')]['limit']);_0x3a4ec8[_0x5da5('0x25')]=qs[_0x5da5('0x25')](_0x3a5a4b[_0x5da5('0x38')][_0x5da5('0x25')]);}return _0x358f8d[_0x5da5('0x5a')](_0x3a4ec8);}})[_0x5da5('0x2d')](function(_0x569e27){if(_0x569e27){return _0x569e27?{'count':_0x4df458,'rows':_0x569e27}:null;}})[_0x5da5('0x2d')](respondWithResult(_0x4fbfe8,null))[_0x5da5('0x22')](handleError(_0x4fbfe8,null));}; \ No newline at end of file +var _0xa8a8=['then','info','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','Content-Range','reject','save','update','destroy','end','stack','name','send','index','ServicenowConfiguration','rawAttributes','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','map','VIRTUAL','field','count','includeAll','include','rows','show','params','length','options','find','body','getFields','findOne','ServicenowField','filter','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x2f2dd0,_0x242127){var _0x3c48d1=function(_0x4516b1){while(--_0x4516b1){_0x2f2dd0['push'](_0x2f2dd0['shift']());}};_0x3c48d1(++_0x242127);}(_0xa8a8,0xec));var _0x8a8a=function(_0x199070,_0x59fcde){_0x199070=_0x199070-0x0;var _0x4b358a=_0xa8a8[_0x199070];return _0x4b358a;};'use strict';var pdf=require(_0x8a8a('0x0'));var emlformat=require(_0x8a8a('0x1'));var rimraf=require(_0x8a8a('0x2'));var zipdir=require(_0x8a8a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a8a('0x4'));var moment=require(_0x8a8a('0x5'));var BPromise=require(_0x8a8a('0x6'));var Mustache=require(_0x8a8a('0x7'));var util=require(_0x8a8a('0x8'));var path=require(_0x8a8a('0x9'));var sox=require(_0x8a8a('0xa'));var csv=require(_0x8a8a('0xb'));var ejs=require(_0x8a8a('0xc'));var fs=require('fs');var _=require(_0x8a8a('0xd'));var squel=require(_0x8a8a('0xe'));var crypto=require(_0x8a8a('0xf'));var jsforce=require(_0x8a8a('0x10'));var deskjs=require(_0x8a8a('0x11'));var toCsv=require(_0x8a8a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x8a8a('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x8a8a('0x13'));var qs=require(_0x8a8a('0x14'));var logger=require('../../config/logger')(_0x8a8a('0x15'));var utils=require(_0x8a8a('0x16'));var config=require(_0x8a8a('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8a8a('0x18'));var client=jayson[_0x8a8a('0x19')][_0x8a8a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x234481,_0x4a1b91,_0x23febf,_0x4e5d74){return new BPromise(function(_0x25e1d5,_0xb2a3bc){var _0x787eec=_0x4e5d74||client;return _0x787eec[_0x8a8a('0x1b')](_0x234481,_0x23febf)[_0x8a8a('0x1c')](function(_0x78b0f0){logger[_0x8a8a('0x1d')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4a1b91,_0x8a8a('0x1e'));logger['debug'](_0x8a8a('0x1f'),_0x4a1b91,_0x8a8a('0x1e'),JSON[_0x8a8a('0x20')](_0x78b0f0));if(_0x78b0f0[_0x8a8a('0x21')]){if(_0x78b0f0[_0x8a8a('0x21')]['code']===0x1f4){logger[_0x8a8a('0x21')](_0x8a8a('0x22'),_0x4a1b91,_0x78b0f0[_0x8a8a('0x21')][_0x8a8a('0x23')]);return _0xb2a3bc(_0x78b0f0[_0x8a8a('0x21')][_0x8a8a('0x23')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4a1b91,_0x78b0f0['error']['message']);return _0x25e1d5(_0x78b0f0['error'][_0x8a8a('0x23')]);}else{logger[_0x8a8a('0x1d')](_0x8a8a('0x22'),_0x4a1b91,_0x8a8a('0x1e'));_0x25e1d5(_0x78b0f0[_0x8a8a('0x24')][_0x8a8a('0x23')]);}})[_0x8a8a('0x25')](function(_0xe0321c){logger[_0x8a8a('0x21')](_0x8a8a('0x22'),_0x4a1b91,_0xe0321c);_0xb2a3bc(_0xe0321c);});});}function respondWithStatusCode(_0xb9db78,_0x3aa2bb){_0x3aa2bb=_0x3aa2bb||0xcc;return function(_0x3b4ece){if(_0x3b4ece){return _0xb9db78[_0x8a8a('0x26')](_0x3aa2bb);}return _0xb9db78[_0x8a8a('0x27')](_0x3aa2bb)['end']();};}function respondWithResult(_0x3c096f,_0x16c55b){_0x16c55b=_0x16c55b||0xc8;return function(_0x268b2f){if(_0x268b2f){return _0x3c096f[_0x8a8a('0x27')](_0x16c55b)[_0x8a8a('0x28')](_0x268b2f);}};}function respondWithFilteredResult(_0x251315,_0x3aa46d){return function(_0x5f4dcc){if(_0x5f4dcc){var _0x31d21a=_0x5f4dcc['count'],_0x38c1e0=_0x3aa46d[_0x8a8a('0x29')],_0x2e217a=_0x3aa46d[_0x8a8a('0x29')]+_0x3aa46d['limit'],_0x54ff7e;if(_0x2e217a>=_0x31d21a){_0x2e217a=_0x31d21a;_0x54ff7e=0xc8;}else{_0x54ff7e=0xce;}_0x251315['status'](_0x54ff7e);return _0x251315['set'](_0x8a8a('0x2a'),_0x38c1e0+'-'+_0x2e217a+'/'+_0x31d21a)['json'](_0x5f4dcc);}return null;};}function patchUpdates(_0x10b916){return function(_0xdd6221){try{jsonpatch['apply'](_0xdd6221,_0x10b916,!![]);}catch(_0x36c7f8){return BPromise[_0x8a8a('0x2b')](_0x36c7f8);}return _0xdd6221[_0x8a8a('0x2c')]();};}function saveUpdates(_0x8df0cb,_0x41802e){return function(_0x3d6594){if(_0x3d6594){return _0x3d6594[_0x8a8a('0x2d')](_0x8df0cb)[_0x8a8a('0x1c')](function(_0x5768a6){return _0x5768a6;});}return null;};}function removeEntity(_0x4ca706,_0x56e79e){return function(_0x2a00a7){if(_0x2a00a7){return _0x2a00a7[_0x8a8a('0x2e')]()['then'](function(){_0x4ca706[_0x8a8a('0x27')](0xcc)[_0x8a8a('0x2f')]();});}};}function handleEntityNotFound(_0x481e92,_0x3abab2){return function(_0x431b3a){if(!_0x431b3a){_0x481e92[_0x8a8a('0x26')](0x194);}return _0x431b3a;};}function handleError(_0x49e287,_0x5bee53){_0x5bee53=_0x5bee53||0x1f4;return function(_0x8457a0){logger['error'](_0x8457a0[_0x8a8a('0x30')]);if(_0x8457a0[_0x8a8a('0x31')]){delete _0x8457a0[_0x8a8a('0x31')];}_0x49e287[_0x8a8a('0x27')](_0x5bee53)[_0x8a8a('0x32')](_0x8457a0);};}exports[_0x8a8a('0x33')]=function(_0x37ce45,_0x389ad1){var _0x320398={},_0xf7d4d7={},_0x27de26={'count':0x0,'rows':[]};var _0x45ddb4=db[_0x8a8a('0x34')][_0x8a8a('0x35')];_0xf7d4d7[_0x8a8a('0x36')]=_[_0x8a8a('0x37')](_0x45ddb4);_0xf7d4d7[_0x8a8a('0x38')]=_[_0x8a8a('0x37')](_0x37ce45['query']);_0xf7d4d7['filters']=_['intersection'](_0xf7d4d7[_0x8a8a('0x36')],_0xf7d4d7[_0x8a8a('0x38')]);_0x320398[_0x8a8a('0x39')]=_[_0x8a8a('0x3a')](_0xf7d4d7[_0x8a8a('0x36')],qs['fields'](_0x37ce45['query'][_0x8a8a('0x3b')]));_0x320398['attributes']=_0x320398[_0x8a8a('0x39')]['length']?_0x320398['attributes']:_0xf7d4d7[_0x8a8a('0x36')];if(!_0x37ce45[_0x8a8a('0x38')][_0x8a8a('0x3c')](_0x8a8a('0x3d'))){_0x320398[_0x8a8a('0x3e')]=qs[_0x8a8a('0x3e')](_0x37ce45[_0x8a8a('0x38')]['limit']);_0x320398[_0x8a8a('0x29')]=qs[_0x8a8a('0x29')](_0x37ce45[_0x8a8a('0x38')]['offset']);}_0x320398[_0x8a8a('0x3f')]=qs[_0x8a8a('0x40')](_0x37ce45[_0x8a8a('0x38')]['sort']);_0x320398[_0x8a8a('0x41')]=qs[_0x8a8a('0x42')](_[_0x8a8a('0x43')](_0x37ce45[_0x8a8a('0x38')],_0xf7d4d7[_0x8a8a('0x42')]));if(_0x37ce45[_0x8a8a('0x38')]['filter']){_0x320398['where']=_[_0x8a8a('0x44')](_0x320398['where'],{'$or':_[_0x8a8a('0x45')](_0x45ddb4,function(_0x1aa8b5){if(_0x1aa8b5['type']['key']!==_0x8a8a('0x46')){var _0x1ea8f7={};_0x1ea8f7[_0x1aa8b5[_0x8a8a('0x47')]]={'$like':'%'+_0x37ce45[_0x8a8a('0x38')]['filter']+'%'};return _0x1ea8f7;}})});}_0x320398=_[_0x8a8a('0x44')]({},_0x320398,_0x37ce45['options']);var _0x2fbd23={'where':_0x320398[_0x8a8a('0x41')]};return db['ServicenowConfiguration'][_0x8a8a('0x48')](_0x2fbd23)[_0x8a8a('0x1c')](function(_0x2836de){_0x27de26['count']=_0x2836de;if(_0x37ce45[_0x8a8a('0x38')][_0x8a8a('0x49')]){_0x320398[_0x8a8a('0x4a')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x320398);})[_0x8a8a('0x1c')](function(_0x1eb8bf){_0x27de26[_0x8a8a('0x4b')]=_0x1eb8bf;return _0x27de26;})['then'](respondWithFilteredResult(_0x389ad1,_0x320398))[_0x8a8a('0x25')](handleError(_0x389ad1,null));};exports[_0x8a8a('0x4c')]=function(_0x86588c,_0xcf230e){var _0x2d4c11={'raw':![],'where':{'id':_0x86588c[_0x8a8a('0x4d')]['id']}},_0x504104={};_0x504104[_0x8a8a('0x36')]=_[_0x8a8a('0x37')](db[_0x8a8a('0x34')][_0x8a8a('0x35')]);_0x504104['query']=_[_0x8a8a('0x37')](_0x86588c[_0x8a8a('0x38')]);_0x504104[_0x8a8a('0x42')]=_[_0x8a8a('0x3a')](_0x504104[_0x8a8a('0x36')],_0x504104[_0x8a8a('0x38')]);_0x2d4c11['attributes']=_[_0x8a8a('0x3a')](_0x504104[_0x8a8a('0x36')],qs[_0x8a8a('0x3b')](_0x86588c[_0x8a8a('0x38')]['fields']));_0x2d4c11[_0x8a8a('0x39')]=_0x2d4c11[_0x8a8a('0x39')][_0x8a8a('0x4e')]?_0x2d4c11['attributes']:_0x504104['model'];if(_0x86588c[_0x8a8a('0x38')][_0x8a8a('0x49')]){_0x2d4c11[_0x8a8a('0x4a')]=[{'all':!![]}];}_0x2d4c11=_[_0x8a8a('0x44')]({},_0x2d4c11,_0x86588c[_0x8a8a('0x4f')]);return db[_0x8a8a('0x34')][_0x8a8a('0x50')](_0x2d4c11)[_0x8a8a('0x1c')](handleEntityNotFound(_0xcf230e,null))[_0x8a8a('0x1c')](respondWithResult(_0xcf230e,null))['catch'](handleError(_0xcf230e,null));};exports['create']=function(_0x17ffeb,_0x10f689){return db['ServicenowConfiguration']['create'](_0x17ffeb[_0x8a8a('0x51')],{})['then'](respondWithResult(_0x10f689,0xc9))[_0x8a8a('0x25')](handleError(_0x10f689,null));};exports['update']=function(_0x4642d5,_0xa2b8a1){if(_0x4642d5[_0x8a8a('0x51')]['id']){delete _0x4642d5[_0x8a8a('0x51')]['id'];}return db[_0x8a8a('0x34')][_0x8a8a('0x50')]({'where':{'id':_0x4642d5[_0x8a8a('0x4d')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0xa2b8a1,null))[_0x8a8a('0x1c')](saveUpdates(_0x4642d5[_0x8a8a('0x51')],null))['then'](respondWithResult(_0xa2b8a1,null))[_0x8a8a('0x25')](handleError(_0xa2b8a1,null));};exports[_0x8a8a('0x2e')]=function(_0x32a4ed,_0x1e3bf5){return db[_0x8a8a('0x34')]['find']({'where':{'id':_0x32a4ed[_0x8a8a('0x4d')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x1e3bf5,null))['then'](removeEntity(_0x1e3bf5,null))['catch'](handleError(_0x1e3bf5,null));};exports[_0x8a8a('0x52')]=function(_0x3c3f3d,_0x322b4c,_0x2ba3bf){var _0x265e98={};var _0x2dc4e8={};var _0x5ed59c;var _0x481d02;return db['ServicenowConfiguration'][_0x8a8a('0x53')]({'where':{'id':_0x3c3f3d['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x322b4c,null))[_0x8a8a('0x1c')](function(_0x4e1ca8){if(_0x4e1ca8){_0x5ed59c=_0x4e1ca8;_0x2dc4e8[_0x8a8a('0x36')]=_[_0x8a8a('0x37')](db[_0x8a8a('0x54')][_0x8a8a('0x35')]);_0x2dc4e8['query']=_[_0x8a8a('0x37')](_0x3c3f3d['query']);_0x2dc4e8[_0x8a8a('0x42')]=_[_0x8a8a('0x3a')](_0x2dc4e8['model'],_0x2dc4e8[_0x8a8a('0x38')]);_0x265e98[_0x8a8a('0x39')]=_[_0x8a8a('0x3a')](_0x2dc4e8[_0x8a8a('0x36')],qs['fields'](_0x3c3f3d[_0x8a8a('0x38')][_0x8a8a('0x3b')]));_0x265e98[_0x8a8a('0x39')]=_0x265e98['attributes']['length']?_0x265e98[_0x8a8a('0x39')]:_0x2dc4e8['model'];_0x265e98['order']=qs['sort'](_0x3c3f3d[_0x8a8a('0x38')][_0x8a8a('0x40')]);_0x265e98['where']=qs[_0x8a8a('0x42')](_['pick'](_0x3c3f3d['query'],_0x2dc4e8[_0x8a8a('0x42')]));if(_0x3c3f3d[_0x8a8a('0x38')]['filter']){_0x265e98[_0x8a8a('0x41')]=_[_0x8a8a('0x44')](_0x265e98[_0x8a8a('0x41')],{'$or':_[_0x8a8a('0x45')](_0x265e98[_0x8a8a('0x39')],function(_0x126dba){var _0x4c8272={};_0x4c8272[_0x126dba]={'$like':'%'+_0x3c3f3d[_0x8a8a('0x38')][_0x8a8a('0x55')]+'%'};return _0x4c8272;})});}_0x265e98=_['merge']({},_0x265e98,_0x3c3f3d[_0x8a8a('0x4f')]);return _0x5ed59c[_0x8a8a('0x52')](_0x265e98);}})[_0x8a8a('0x1c')](function(_0x190c45){if(_0x190c45){_0x481d02=_0x190c45[_0x8a8a('0x4e')];if(!_0x3c3f3d[_0x8a8a('0x38')][_0x8a8a('0x3c')](_0x8a8a('0x3d'))){_0x265e98[_0x8a8a('0x3e')]=qs[_0x8a8a('0x3e')](_0x3c3f3d['query'][_0x8a8a('0x3e')]);_0x265e98[_0x8a8a('0x29')]=qs['offset'](_0x3c3f3d[_0x8a8a('0x38')][_0x8a8a('0x29')]);}return _0x5ed59c[_0x8a8a('0x52')](_0x265e98);}})[_0x8a8a('0x1c')](function(_0x3e0af2){if(_0x3e0af2){return _0x3e0af2?{'count':_0x481d02,'rows':_0x3e0af2}:null;}})['then'](respondWithResult(_0x322b4c,null))[_0x8a8a('0x25')](handleError(_0x322b4c,null));};exports[_0x8a8a('0x56')]=function(_0x3edc54,_0x2984eb,_0x3fc483){var _0x224ec2={};var _0x1a6f51={};var _0x4fc5c8;var _0x2a221b;return db[_0x8a8a('0x34')][_0x8a8a('0x53')]({'where':{'id':_0x3edc54['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x2984eb,null))['then'](function(_0x15b2e7){if(_0x15b2e7){_0x4fc5c8=_0x15b2e7;_0x1a6f51[_0x8a8a('0x36')]=_['keys'](db[_0x8a8a('0x54')][_0x8a8a('0x35')]);_0x1a6f51[_0x8a8a('0x38')]=_[_0x8a8a('0x37')](_0x3edc54[_0x8a8a('0x38')]);_0x1a6f51[_0x8a8a('0x42')]=_[_0x8a8a('0x3a')](_0x1a6f51[_0x8a8a('0x36')],_0x1a6f51[_0x8a8a('0x38')]);_0x224ec2[_0x8a8a('0x39')]=_[_0x8a8a('0x3a')](_0x1a6f51[_0x8a8a('0x36')],qs[_0x8a8a('0x3b')](_0x3edc54[_0x8a8a('0x38')][_0x8a8a('0x3b')]));_0x224ec2[_0x8a8a('0x39')]=_0x224ec2[_0x8a8a('0x39')][_0x8a8a('0x4e')]?_0x224ec2['attributes']:_0x1a6f51[_0x8a8a('0x36')];_0x224ec2['order']=qs[_0x8a8a('0x40')](_0x3edc54[_0x8a8a('0x38')][_0x8a8a('0x40')]);_0x224ec2['where']=qs['filters'](_[_0x8a8a('0x43')](_0x3edc54[_0x8a8a('0x38')],_0x1a6f51[_0x8a8a('0x42')]));if(_0x3edc54['query']['filter']){_0x224ec2[_0x8a8a('0x41')]=_[_0x8a8a('0x44')](_0x224ec2[_0x8a8a('0x41')],{'$or':_[_0x8a8a('0x45')](_0x224ec2[_0x8a8a('0x39')],function(_0x3c1ecf){var _0x1f0970={};_0x1f0970[_0x3c1ecf]={'$like':'%'+_0x3edc54[_0x8a8a('0x38')]['filter']+'%'};return _0x1f0970;})});}_0x224ec2=_[_0x8a8a('0x44')]({},_0x224ec2,_0x3edc54[_0x8a8a('0x4f')]);return _0x4fc5c8['getSubjects'](_0x224ec2);}})[_0x8a8a('0x1c')](function(_0x316d7b){if(_0x316d7b){_0x2a221b=_0x316d7b[_0x8a8a('0x4e')];if(!_0x3edc54[_0x8a8a('0x38')][_0x8a8a('0x3c')](_0x8a8a('0x3d'))){_0x224ec2['limit']=qs[_0x8a8a('0x3e')](_0x3edc54[_0x8a8a('0x38')][_0x8a8a('0x3e')]);_0x224ec2[_0x8a8a('0x29')]=qs[_0x8a8a('0x29')](_0x3edc54['query'][_0x8a8a('0x29')]);}return _0x4fc5c8[_0x8a8a('0x56')](_0x224ec2);}})[_0x8a8a('0x1c')](function(_0x3d9511){if(_0x3d9511){return _0x3d9511?{'count':_0x2a221b,'rows':_0x3d9511}:null;}})[_0x8a8a('0x1c')](respondWithResult(_0x2984eb,null))[_0x8a8a('0x25')](handleError(_0x2984eb,null));};exports[_0x8a8a('0x57')]=function(_0x106df7,_0x351f25,_0x268343){var _0x491b2e={};var _0x306a50={};var _0x20b40e;var _0x3bb8d7;return db[_0x8a8a('0x34')][_0x8a8a('0x53')]({'where':{'id':_0x106df7['params']['id']}})['then'](handleEntityNotFound(_0x351f25,null))[_0x8a8a('0x1c')](function(_0x46c4f6){if(_0x46c4f6){_0x20b40e=_0x46c4f6;_0x306a50[_0x8a8a('0x36')]=_['keys'](db[_0x8a8a('0x54')][_0x8a8a('0x35')]);_0x306a50[_0x8a8a('0x38')]=_[_0x8a8a('0x37')](_0x106df7['query']);_0x306a50[_0x8a8a('0x42')]=_[_0x8a8a('0x3a')](_0x306a50[_0x8a8a('0x36')],_0x306a50['query']);_0x491b2e['attributes']=_['intersection'](_0x306a50[_0x8a8a('0x36')],qs['fields'](_0x106df7[_0x8a8a('0x38')]['fields']));_0x491b2e['attributes']=_0x491b2e[_0x8a8a('0x39')]['length']?_0x491b2e['attributes']:_0x306a50['model'];_0x491b2e[_0x8a8a('0x3f')]=qs['sort'](_0x106df7['query'][_0x8a8a('0x40')]);_0x491b2e['where']=qs[_0x8a8a('0x42')](_['pick'](_0x106df7[_0x8a8a('0x38')],_0x306a50[_0x8a8a('0x42')]));if(_0x106df7[_0x8a8a('0x38')][_0x8a8a('0x55')]){_0x491b2e['where']=_[_0x8a8a('0x44')](_0x491b2e[_0x8a8a('0x41')],{'$or':_['map'](_0x491b2e[_0x8a8a('0x39')],function(_0xf3cf32){var _0x913e4c={};_0x913e4c[_0xf3cf32]={'$like':'%'+_0x106df7[_0x8a8a('0x38')]['filter']+'%'};return _0x913e4c;})});}_0x491b2e=_['merge']({},_0x491b2e,_0x106df7[_0x8a8a('0x4f')]);return _0x20b40e[_0x8a8a('0x57')](_0x491b2e);}})[_0x8a8a('0x1c')](function(_0x5bd333){if(_0x5bd333){_0x3bb8d7=_0x5bd333[_0x8a8a('0x4e')];if(!_0x106df7[_0x8a8a('0x38')][_0x8a8a('0x3c')]('nolimit')){_0x491b2e[_0x8a8a('0x3e')]=qs[_0x8a8a('0x3e')](_0x106df7[_0x8a8a('0x38')][_0x8a8a('0x3e')]);_0x491b2e[_0x8a8a('0x29')]=qs['offset'](_0x106df7[_0x8a8a('0x38')][_0x8a8a('0x29')]);}return _0x20b40e[_0x8a8a('0x57')](_0x491b2e);}})[_0x8a8a('0x1c')](function(_0xa58962){if(_0xa58962){return _0xa58962?{'count':_0x3bb8d7,'rows':_0xa58962}:null;}})[_0x8a8a('0x1c')](respondWithResult(_0x351f25,null))[_0x8a8a('0x25')](handleError(_0x351f25,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 27d7c90..e0117f6 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 _0xe685=['exports','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','request-promise','./intServicenowConfiguration.attributes'];(function(_0x5d21c6,_0x483e6f){var _0x43dff7=function(_0x208937){while(--_0x208937){_0x5d21c6['push'](_0x5d21c6['shift']());}};_0x43dff7(++_0x483e6f);}(_0xe685,0xe0));var _0x5e68=function(_0x12ffc9,_0x503a67){_0x12ffc9=_0x12ffc9-0x0;var _0x4a196a=_0xe685[_0x12ffc9];return _0x4a196a;};'use strict';var _=require('lodash');var util=require(_0x5e68('0x0'));var logger=require(_0x5e68('0x1'))(_0x5e68('0x2'));var moment=require(_0x5e68('0x3'));var BPromise=require(_0x5e68('0x4'));var rp=require(_0x5e68('0x5'));var attributes=require(_0x5e68('0x6'));module[_0x5e68('0x7')]=function(_0x36653c,_0x478f3a){return _0x36653c[_0x5e68('0x8')](_0x5e68('0x9'),attributes,{'tableName':_0x5e68('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9143=['util','api','request-promise','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x9143,0x107));var _0x3914=function(_0x12ecec,_0x1f1c7e){_0x12ecec=_0x12ecec-0x0;var _0x7446a0=_0x9143[_0x12ecec];return _0x7446a0;};'use strict';var _=require(_0x3914('0x0'));var util=require(_0x3914('0x1'));var logger=require('../../config/logger')(_0x3914('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3914('0x3'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x3914('0x4')]=function(_0x59492f,_0x378c6a){return _0x59492f[_0x3914('0x5')](_0x3914('0x6'),attributes,{'tableName':_0x3914('0x7'),'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 6104c18..38bc843 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 _0xb422=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','result'];(function(_0x46b10f,_0x10a5a5){var _0x145625=function(_0xfc1725){while(--_0xfc1725){_0x46b10f['push'](_0x46b10f['shift']());}};_0x145625(++_0x10a5a5);}(_0xb422,0xc1));var _0x2b42=function(_0x405385,_0x56f573){_0x405385=_0x405385-0x0;var _0x43837b=_0xb422[_0x405385];return _0x43837b;};'use strict';var _=require(_0x2b42('0x0'));var util=require(_0x2b42('0x1'));var moment=require(_0x2b42('0x2'));var BPromise=require(_0x2b42('0x3'));var rs=require(_0x2b42('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b42('0x5'))['db'];var utils=require(_0x2b42('0x6'));var logger=require(_0x2b42('0x7'))(_0x2b42('0x8'));var config=require(_0x2b42('0x9'));var jayson=require(_0x2b42('0xa'));var client=jayson[_0x2b42('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ad9f1,_0x52e865,_0x569723){return new BPromise(function(_0x79ecb0,_0x416de0){return client[_0x2b42('0xc')](_0x2ad9f1,_0x569723)[_0x2b42('0xd')](function(_0x96668){logger[_0x2b42('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x52e865,_0x2b42('0xf'));logger[_0x2b42('0x10')](_0x2b42('0x11'),_0x52e865,_0x2b42('0xf'),JSON[_0x2b42('0x12')](_0x96668));if(_0x96668[_0x2b42('0x13')]){if(_0x96668[_0x2b42('0x13')][_0x2b42('0x14')]===0x1f4){logger[_0x2b42('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x52e865,_0x96668[_0x2b42('0x13')]['message']);return _0x416de0(_0x96668[_0x2b42('0x13')]['message']);}logger[_0x2b42('0x13')](_0x2b42('0x15'),_0x52e865,_0x96668[_0x2b42('0x13')]['message']);return _0x79ecb0(_0x96668['error']['message']);}else{logger[_0x2b42('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x52e865,_0x2b42('0xf'));_0x79ecb0(_0x96668[_0x2b42('0x16')]['message']);}})[_0x2b42('0x17')](function(_0x2582c3){logger[_0x2b42('0x13')](_0x2b42('0x15'),_0x52e865,_0x2582c3);_0x416de0(_0x2582c3);});});} \ No newline at end of file +var _0xde20=['result','catch','lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x1eb18f,_0x5097a7){var _0x4c5fb6=function(_0x579786){while(--_0x579786){_0x1eb18f['push'](_0x1eb18f['shift']());}};_0x4c5fb6(++_0x5097a7);}(_0xde20,0xe6));var _0x0de2=function(_0x3ab681,_0x53c521){_0x3ab681=_0x3ab681-0x0;var _0x1efc8a=_0xde20[_0x3ab681];return _0x1efc8a;};'use strict';var _=require(_0x0de2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0de2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0de2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0de2('0x3'))(_0x0de2('0x4'));var config=require(_0x0de2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0de2('0x6')][_0x0de2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x246b45,_0x4024bf,_0xf93f46){return new BPromise(function(_0x433acb,_0x4b4041){return client['request'](_0x246b45,_0xf93f46)[_0x0de2('0x8')](function(_0x3f7476){logger[_0x0de2('0x9')](_0x0de2('0xa'),_0x4024bf,'request\x20sent');logger[_0x0de2('0xb')](_0x0de2('0xc'),_0x4024bf,_0x0de2('0xd'),JSON['stringify'](_0x3f7476));if(_0x3f7476[_0x0de2('0xe')]){if(_0x3f7476[_0x0de2('0xe')][_0x0de2('0xf')]===0x1f4){logger[_0x0de2('0xe')](_0x0de2('0xa'),_0x4024bf,_0x3f7476[_0x0de2('0xe')][_0x0de2('0x10')]);return _0x4b4041(_0x3f7476[_0x0de2('0xe')]['message']);}logger[_0x0de2('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4024bf,_0x3f7476[_0x0de2('0xe')][_0x0de2('0x10')]);return _0x433acb(_0x3f7476[_0x0de2('0xe')][_0x0de2('0x10')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x4024bf,'request\x20sent');_0x433acb(_0x3f7476[_0x0de2('0x11')][_0x0de2('0x10')]);}})[_0x0de2('0x12')](function(_0x369ae1){logger[_0x0de2('0xe')](_0x0de2('0xa'),_0x4024bf,_0x369ae1);_0x4b4041(_0x369ae1);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index af0b25c..215b6b6 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 _0xe35d=['./intServicenowField.controller','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x4c6666,_0x43f164){var _0x431f39=function(_0x4a5d9d){while(--_0x4a5d9d){_0x4c6666['push'](_0x4c6666['shift']());}};_0x431f39(++_0x43f164);}(_0xe35d,0x1eb));var _0xde35=function(_0x32f250,_0x1fbca3){_0x32f250=_0x32f250-0x0;var _0x39ead3=_0xe35d[_0x32f250];return _0x39ead3;};'use strict';var multer=require(_0xde35('0x0'));var util=require('util');var path=require(_0xde35('0x1'));var timeout=require('connect-timeout');var express=require(_0xde35('0x2'));var router=express[_0xde35('0x3')]();var auth=require(_0xde35('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xde35('0x5'));router[_0xde35('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xde35('0x7'),auth[_0xde35('0x8')](),controller[_0xde35('0x9')]);router[_0xde35('0xa')]('/',auth['isAuthenticated'](),controller[_0xde35('0xb')]);router[_0xde35('0xc')](_0xde35('0x7'),auth[_0xde35('0x8')](),controller[_0xde35('0xd')]);router['delete'](_0xde35('0x7'),auth[_0xde35('0x8')](),controller[_0xde35('0xe')]);module[_0xde35('0xf')]=router; \ No newline at end of file +var _0x820e=['create','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x1444e5,_0x2bb1aa){var _0x3f9318=function(_0x1e79f5){while(--_0x1e79f5){_0x1444e5['push'](_0x1444e5['shift']());}};_0x3f9318(++_0x2bb1aa);}(_0x820e,0x17c));var _0xe820=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x820e[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xe820('0x0'));var path=require('path');var timeout=require(_0xe820('0x1'));var express=require(_0xe820('0x2'));var router=express['Router']();var auth=require(_0xe820('0x3'));var interaction=require(_0xe820('0x4'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0xe820('0x5')]('/',auth[_0xe820('0x6')](),controller[_0xe820('0x7')]);router['get'](_0xe820('0x8'),auth[_0xe820('0x6')](),controller[_0xe820('0x9')]);router[_0xe820('0xa')]('/',auth[_0xe820('0x6')](),controller[_0xe820('0xb')]);router[_0xe820('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xe820('0xd')]);router[_0xe820('0xe')](_0xe820('0x8'),auth[_0xe820('0x6')](),controller[_0xe820('0xf')]);module[_0xe820('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e44f29e..32a74b9 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 _0x96cc=['keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable'];(function(_0x5a6b65,_0x591f4c){var _0x238da0=function(_0x381055){while(--_0x381055){_0x5a6b65['push'](_0x5a6b65['shift']());}};_0x238da0(++_0x591f4c);}(_0x96cc,0x16c));var _0xc96c=function(_0x5ea710,_0x40a4f8){_0x5ea710=_0x5ea710-0x0;var _0x5397e2=_0x96cc[_0x5ea710];return _0x5397e2;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'type':{'type':Sequelize[_0xc96c('0x1')]('string',_0xc96c('0x2'),_0xc96c('0x3'),_0xc96c('0x4')),'defaultValue':_0xc96c('0x5')},'content':{'type':Sequelize[_0xc96c('0x6')]},'key':{'type':Sequelize[_0xc96c('0x6')]},'keyType':{'type':Sequelize[_0xc96c('0x1')](_0xc96c('0x5'),_0xc96c('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xc96c('0x6')]},'idField':{'type':Sequelize[_0xc96c('0x6')]},'nameField':{'type':Sequelize[_0xc96c('0x6')]},'customField':{'type':Sequelize[_0xc96c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc96c('0x6')]}}; \ No newline at end of file +var _0x2750=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x3fb560,_0x1e301f){var _0x4999b3=function(_0x4ad22e){while(--_0x4ad22e){_0x3fb560['push'](_0x3fb560['shift']());}};_0x4999b3(++_0x1e301f);}(_0x2750,0x13b));var _0x0275=function(_0x4348bd,_0x59ecc7){_0x4348bd=_0x4348bd-0x0;var _0x43dd2f=_0x2750[_0x4348bd];return _0x43dd2f;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'type':{'type':Sequelize[_0x0275('0x1')](_0x0275('0x2'),_0x0275('0x3'),_0x0275('0x4'),_0x0275('0x5')),'defaultValue':_0x0275('0x2')},'content':{'type':Sequelize[_0x0275('0x6')]},'key':{'type':Sequelize[_0x0275('0x6')]},'keyType':{'type':Sequelize[_0x0275('0x1')](_0x0275('0x2'),'variable',_0x0275('0x4'))},'keyContent':{'type':Sequelize[_0x0275('0x6')]},'idField':{'type':Sequelize[_0x0275('0x6')]},'nameField':{'type':Sequelize[_0x0275('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0275('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 5fb07c1..5542d3d 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 _0x913c=['find','create','body','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','status','count','offset','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','map','type','key','VIRTUAL','options','ServicenowField','includeAll','include','rows','catch','show','params','keys'];(function(_0x3f8282,_0x11b607){var _0x50f918=function(_0x3a37de){while(--_0x3a37de){_0x3f8282['push'](_0x3f8282['shift']());}};_0x50f918(++_0x11b607);}(_0x913c,0x195));var _0xc913=function(_0x19bbb0,_0x1776f2){_0x19bbb0=_0x19bbb0-0x0;var _0x56d3dd=_0x913c[_0x19bbb0];return _0x56d3dd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc913('0x0'));var rimraf=require(_0xc913('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc913('0x2'));var moment=require(_0xc913('0x3'));var BPromise=require(_0xc913('0x4'));var Mustache=require('mustache');var util=require(_0xc913('0x5'));var path=require(_0xc913('0x6'));var sox=require('sox');var csv=require(_0xc913('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc913('0x8'));var squel=require(_0xc913('0x9'));var crypto=require(_0xc913('0xa'));var jsforce=require(_0xc913('0xb'));var deskjs=require(_0xc913('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc913('0xd'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0xc913('0xe'));var qs=require(_0xc913('0xf'));var logger=require('../../config/logger')(_0xc913('0x10'));var utils=require('../../config/utils');var config=require(_0xc913('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf32c29,_0x1ffc42){_0x1ffc42=_0x1ffc42||0xcc;return function(_0x4f8abe){if(_0x4f8abe){return _0xf32c29['sendStatus'](_0x1ffc42);}return _0xf32c29[_0xc913('0x12')](_0x1ffc42)['end']();};}function respondWithResult(_0x326a60,_0x3b6ddb){_0x3b6ddb=_0x3b6ddb||0xc8;return function(_0xe571a0){if(_0xe571a0){return _0x326a60[_0xc913('0x12')](_0x3b6ddb)['json'](_0xe571a0);}};}function respondWithFilteredResult(_0x771057,_0x25feab){return function(_0x2bc97c){if(_0x2bc97c){var _0x159b32=_0x2bc97c[_0xc913('0x13')],_0x1f96ad=_0x25feab['offset'],_0x317685=_0x25feab[_0xc913('0x14')]+_0x25feab['limit'],_0x1e6db2;if(_0x317685>=_0x159b32){_0x317685=_0x159b32;_0x1e6db2=0xc8;}else{_0x1e6db2=0xce;}_0x771057[_0xc913('0x12')](_0x1e6db2);return _0x771057[_0xc913('0x15')](_0xc913('0x16'),_0x1f96ad+'-'+_0x317685+'/'+_0x159b32)['json'](_0x2bc97c);}return null;};}function patchUpdates(_0x333415){return function(_0x28f696){try{jsonpatch[_0xc913('0x17')](_0x28f696,_0x333415,!![]);}catch(_0x4248e9){return BPromise['reject'](_0x4248e9);}return _0x28f696[_0xc913('0x18')]();};}function saveUpdates(_0x299df7,_0x3e97e8){return function(_0x2caf05){if(_0x2caf05){return _0x2caf05[_0xc913('0x19')](_0x299df7)[_0xc913('0x1a')](function(_0x349ddf){return _0x349ddf;});}return null;};}function removeEntity(_0x26ac83,_0x230435){return function(_0x552701){if(_0x552701){return _0x552701[_0xc913('0x1b')]()['then'](function(){_0x26ac83[_0xc913('0x12')](0xcc)[_0xc913('0x1c')]();});}};}function handleEntityNotFound(_0x37576f,_0x3db3c4){return function(_0x2ed17a){if(!_0x2ed17a){_0x37576f[_0xc913('0x1d')](0x194);}return _0x2ed17a;};}function handleError(_0x468c27,_0x5a49bf){_0x5a49bf=_0x5a49bf||0x1f4;return function(_0x2d0214){logger[_0xc913('0x1e')](_0x2d0214[_0xc913('0x1f')]);if(_0x2d0214[_0xc913('0x20')]){delete _0x2d0214['name'];}_0x468c27['status'](_0x5a49bf)[_0xc913('0x21')](_0x2d0214);};}exports[_0xc913('0x22')]=function(_0x2ccb81,_0x4fdd37){var _0x3208f5={},_0x2d5591={},_0x3e9871={'count':0x0,'rows':[]};var _0x11af93=db['ServicenowField'][_0xc913('0x23')];_0x2d5591[_0xc913('0x24')]=_['keys'](_0x11af93);_0x2d5591[_0xc913('0x25')]=_['keys'](_0x2ccb81[_0xc913('0x25')]);_0x2d5591['filters']=_[_0xc913('0x26')](_0x2d5591[_0xc913('0x24')],_0x2d5591['query']);_0x3208f5[_0xc913('0x27')]=_[_0xc913('0x26')](_0x2d5591[_0xc913('0x24')],qs[_0xc913('0x28')](_0x2ccb81[_0xc913('0x25')][_0xc913('0x28')]));_0x3208f5[_0xc913('0x27')]=_0x3208f5[_0xc913('0x27')][_0xc913('0x29')]?_0x3208f5['attributes']:_0x2d5591[_0xc913('0x24')];if(!_0x2ccb81[_0xc913('0x25')][_0xc913('0x2a')](_0xc913('0x2b'))){_0x3208f5[_0xc913('0x2c')]=qs[_0xc913('0x2c')](_0x2ccb81[_0xc913('0x25')][_0xc913('0x2c')]);_0x3208f5[_0xc913('0x14')]=qs[_0xc913('0x14')](_0x2ccb81[_0xc913('0x25')][_0xc913('0x14')]);}_0x3208f5[_0xc913('0x2d')]=qs[_0xc913('0x2e')](_0x2ccb81[_0xc913('0x25')][_0xc913('0x2e')]);_0x3208f5[_0xc913('0x2f')]=qs[_0xc913('0x30')](_['pick'](_0x2ccb81[_0xc913('0x25')],_0x2d5591[_0xc913('0x30')]));if(_0x2ccb81[_0xc913('0x25')][_0xc913('0x31')]){_0x3208f5[_0xc913('0x2f')]=_[_0xc913('0x32')](_0x3208f5[_0xc913('0x2f')],{'$or':_[_0xc913('0x33')](_0x11af93,function(_0x3f24ca){if(_0x3f24ca[_0xc913('0x34')][_0xc913('0x35')]!==_0xc913('0x36')){var _0x16ea48={};_0x16ea48[_0x3f24ca['field']]={'$like':'%'+_0x2ccb81[_0xc913('0x25')][_0xc913('0x31')]+'%'};return _0x16ea48;}})});}_0x3208f5=_[_0xc913('0x32')]({},_0x3208f5,_0x2ccb81[_0xc913('0x37')]);var _0x4b72e2={'where':_0x3208f5['where']};return db[_0xc913('0x38')][_0xc913('0x13')](_0x4b72e2)[_0xc913('0x1a')](function(_0x517fa9){_0x3e9871[_0xc913('0x13')]=_0x517fa9;if(_0x2ccb81[_0xc913('0x25')][_0xc913('0x39')]){_0x3208f5[_0xc913('0x3a')]=[{'all':!![]}];}return db[_0xc913('0x38')]['findAll'](_0x3208f5);})['then'](function(_0x43f91e){_0x3e9871[_0xc913('0x3b')]=_0x43f91e;return _0x3e9871;})[_0xc913('0x1a')](respondWithFilteredResult(_0x4fdd37,_0x3208f5))[_0xc913('0x3c')](handleError(_0x4fdd37,null));};exports[_0xc913('0x3d')]=function(_0xe7d7a5,_0x42e611){var _0x27ee3b={'raw':!![],'where':{'id':_0xe7d7a5[_0xc913('0x3e')]['id']}},_0x4067cb={};_0x4067cb[_0xc913('0x24')]=_[_0xc913('0x3f')](db[_0xc913('0x38')][_0xc913('0x23')]);_0x4067cb[_0xc913('0x25')]=_[_0xc913('0x3f')](_0xe7d7a5[_0xc913('0x25')]);_0x4067cb[_0xc913('0x30')]=_[_0xc913('0x26')](_0x4067cb[_0xc913('0x24')],_0x4067cb[_0xc913('0x25')]);_0x27ee3b[_0xc913('0x27')]=_[_0xc913('0x26')](_0x4067cb[_0xc913('0x24')],qs[_0xc913('0x28')](_0xe7d7a5['query'][_0xc913('0x28')]));_0x27ee3b[_0xc913('0x27')]=_0x27ee3b[_0xc913('0x27')]['length']?_0x27ee3b['attributes']:_0x4067cb[_0xc913('0x24')];if(_0xe7d7a5[_0xc913('0x25')][_0xc913('0x39')]){_0x27ee3b['include']=[{'all':!![]}];}_0x27ee3b=_[_0xc913('0x32')]({},_0x27ee3b,_0xe7d7a5[_0xc913('0x37')]);return db[_0xc913('0x38')][_0xc913('0x40')](_0x27ee3b)[_0xc913('0x1a')](handleEntityNotFound(_0x42e611,null))[_0xc913('0x1a')](respondWithResult(_0x42e611,null))['catch'](handleError(_0x42e611,null));};exports[_0xc913('0x41')]=function(_0x41cadd,_0x33e1de){return db[_0xc913('0x38')][_0xc913('0x41')](_0x41cadd['body'],{})[_0xc913('0x1a')](respondWithResult(_0x33e1de,0xc9))['catch'](handleError(_0x33e1de,null));};exports[_0xc913('0x19')]=function(_0x342c2d,_0x1002df){if(_0x342c2d[_0xc913('0x42')]['id']){delete _0x342c2d[_0xc913('0x42')]['id'];}return db['ServicenowField'][_0xc913('0x40')]({'where':{'id':_0x342c2d[_0xc913('0x3e')]['id']}})[_0xc913('0x1a')](handleEntityNotFound(_0x1002df,null))[_0xc913('0x1a')](saveUpdates(_0x342c2d['body'],null))['then'](respondWithResult(_0x1002df,null))[_0xc913('0x3c')](handleError(_0x1002df,null));};exports[_0xc913('0x1b')]=function(_0x189f14,_0x4fe41e){return db[_0xc913('0x38')][_0xc913('0x40')]({'where':{'id':_0x189f14['params']['id']}})[_0xc913('0x1a')](handleEntityNotFound(_0x4fe41e,null))[_0xc913('0x1a')](removeEntity(_0x4fe41e,null))[_0xc913('0x3c')](handleError(_0x4fe41e,null));}; \ No newline at end of file +var _0xe666=['papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','then','error','stack','name','ServicenowField','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','map','key','field','options','includeAll','findAll','show','params','include','find','catch','create','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5d734a,_0x18782b){var _0x281fda=function(_0x4d938d){while(--_0x4d938d){_0x5d734a['push'](_0x5d734a['shift']());}};_0x281fda(++_0x18782b);}(_0xe666,0x1ee));var _0x6e66=function(_0x325975,_0x3d4364){_0x325975=_0x325975-0x0;var _0x1f12dc=_0xe666[_0x325975];return _0x1f12dc;};'use strict';var pdf=require(_0x6e66('0x0'));var emlformat=require(_0x6e66('0x1'));var rimraf=require(_0x6e66('0x2'));var zipdir=require(_0x6e66('0x3'));var jsonpatch=require(_0x6e66('0x4'));var rp=require(_0x6e66('0x5'));var moment=require(_0x6e66('0x6'));var BPromise=require(_0x6e66('0x7'));var Mustache=require(_0x6e66('0x8'));var util=require('util');var path=require('path');var sox=require(_0x6e66('0x9'));var csv=require(_0x6e66('0xa'));var ejs=require(_0x6e66('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6e66('0xc'));var crypto=require(_0x6e66('0xd'));var jsforce=require(_0x6e66('0xe'));var deskjs=require(_0x6e66('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6e66('0x10'));var Papa=require(_0x6e66('0x11'));var authService=require(_0x6e66('0x12'));var hardwareService=require(_0x6e66('0x13'));var Redis=require('ioredis');var qs=require(_0x6e66('0x14'));var logger=require(_0x6e66('0x15'))(_0x6e66('0x16'));var utils=require(_0x6e66('0x17'));var config=require(_0x6e66('0x18'));var db=require(_0x6e66('0x19'))['db'];function respondWithStatusCode(_0x1d3de5,_0x288a87){_0x288a87=_0x288a87||0xcc;return function(_0x2d1341){if(_0x2d1341){return _0x1d3de5[_0x6e66('0x1a')](_0x288a87);}return _0x1d3de5[_0x6e66('0x1b')](_0x288a87)[_0x6e66('0x1c')]();};}function respondWithResult(_0x10a5c3,_0x5549a9){_0x5549a9=_0x5549a9||0xc8;return function(_0xe7710a){if(_0xe7710a){return _0x10a5c3[_0x6e66('0x1b')](_0x5549a9)['json'](_0xe7710a);}};}function respondWithFilteredResult(_0x2ed5a6,_0x1c885f){return function(_0x12af3c){if(_0x12af3c){var _0x511a84=_0x12af3c[_0x6e66('0x1d')],_0x5637ae=_0x1c885f[_0x6e66('0x1e')],_0x907edd=_0x1c885f[_0x6e66('0x1e')]+_0x1c885f['limit'],_0x343857;if(_0x907edd>=_0x511a84){_0x907edd=_0x511a84;_0x343857=0xc8;}else{_0x343857=0xce;}_0x2ed5a6['status'](_0x343857);return _0x2ed5a6['set'](_0x6e66('0x1f'),_0x5637ae+'-'+_0x907edd+'/'+_0x511a84)[_0x6e66('0x20')](_0x12af3c);}return null;};}function patchUpdates(_0x303731){return function(_0x4bed8d){try{jsonpatch[_0x6e66('0x21')](_0x4bed8d,_0x303731,!![]);}catch(_0x15774e){return BPromise[_0x6e66('0x22')](_0x15774e);}return _0x4bed8d[_0x6e66('0x23')]();};}function saveUpdates(_0x5eda82,_0x44f030){return function(_0x4b2927){if(_0x4b2927){return _0x4b2927['update'](_0x5eda82)[_0x6e66('0x24')](function(_0x262a64){return _0x262a64;});}return null;};}function removeEntity(_0x28f726,_0x5eb82d){return function(_0x5ce271){if(_0x5ce271){return _0x5ce271['destroy']()[_0x6e66('0x24')](function(){_0x28f726[_0x6e66('0x1b')](0xcc)[_0x6e66('0x1c')]();});}};}function handleEntityNotFound(_0x321fd8,_0x127159){return function(_0x46356c){if(!_0x46356c){_0x321fd8['sendStatus'](0x194);}return _0x46356c;};}function handleError(_0x209e2b,_0x5a2cee){_0x5a2cee=_0x5a2cee||0x1f4;return function(_0x4e392d){logger[_0x6e66('0x25')](_0x4e392d[_0x6e66('0x26')]);if(_0x4e392d[_0x6e66('0x27')]){delete _0x4e392d['name'];}_0x209e2b[_0x6e66('0x1b')](_0x5a2cee)['send'](_0x4e392d);};}exports['index']=function(_0x2dff74,_0x2b05f9){var _0x599c95={},_0x9f49b9={},_0x492dd3={'count':0x0,'rows':[]};var _0x2b577d=db[_0x6e66('0x28')][_0x6e66('0x29')];_0x9f49b9[_0x6e66('0x2a')]=_[_0x6e66('0x2b')](_0x2b577d);_0x9f49b9[_0x6e66('0x2c')]=_[_0x6e66('0x2b')](_0x2dff74[_0x6e66('0x2c')]);_0x9f49b9[_0x6e66('0x2d')]=_['intersection'](_0x9f49b9['model'],_0x9f49b9[_0x6e66('0x2c')]);_0x599c95[_0x6e66('0x2e')]=_[_0x6e66('0x2f')](_0x9f49b9[_0x6e66('0x2a')],qs[_0x6e66('0x30')](_0x2dff74['query']['fields']));_0x599c95['attributes']=_0x599c95[_0x6e66('0x2e')][_0x6e66('0x31')]?_0x599c95['attributes']:_0x9f49b9['model'];if(!_0x2dff74[_0x6e66('0x2c')][_0x6e66('0x32')](_0x6e66('0x33'))){_0x599c95[_0x6e66('0x34')]=qs[_0x6e66('0x34')](_0x2dff74[_0x6e66('0x2c')]['limit']);_0x599c95[_0x6e66('0x1e')]=qs[_0x6e66('0x1e')](_0x2dff74[_0x6e66('0x2c')]['offset']);}_0x599c95[_0x6e66('0x35')]=qs[_0x6e66('0x36')](_0x2dff74[_0x6e66('0x2c')][_0x6e66('0x36')]);_0x599c95[_0x6e66('0x37')]=qs['filters'](_['pick'](_0x2dff74[_0x6e66('0x2c')],_0x9f49b9[_0x6e66('0x2d')]));if(_0x2dff74[_0x6e66('0x2c')][_0x6e66('0x38')]){_0x599c95[_0x6e66('0x37')]=_[_0x6e66('0x39')](_0x599c95[_0x6e66('0x37')],{'$or':_[_0x6e66('0x3a')](_0x2b577d,function(_0x1647fe){if(_0x1647fe['type'][_0x6e66('0x3b')]!=='VIRTUAL'){var _0x276841={};_0x276841[_0x1647fe[_0x6e66('0x3c')]]={'$like':'%'+_0x2dff74[_0x6e66('0x2c')][_0x6e66('0x38')]+'%'};return _0x276841;}})});}_0x599c95=_['merge']({},_0x599c95,_0x2dff74[_0x6e66('0x3d')]);var _0x1016d9={'where':_0x599c95[_0x6e66('0x37')]};return db['ServicenowField'][_0x6e66('0x1d')](_0x1016d9)[_0x6e66('0x24')](function(_0x174135){_0x492dd3[_0x6e66('0x1d')]=_0x174135;if(_0x2dff74['query'][_0x6e66('0x3e')]){_0x599c95['include']=[{'all':!![]}];}return db[_0x6e66('0x28')][_0x6e66('0x3f')](_0x599c95);})['then'](function(_0xb0f99e){_0x492dd3['rows']=_0xb0f99e;return _0x492dd3;})[_0x6e66('0x24')](respondWithFilteredResult(_0x2b05f9,_0x599c95))['catch'](handleError(_0x2b05f9,null));};exports[_0x6e66('0x40')]=function(_0x4d96c3,_0x30f832){var _0x22a5a7={'raw':!![],'where':{'id':_0x4d96c3[_0x6e66('0x41')]['id']}},_0x53235f={};_0x53235f[_0x6e66('0x2a')]=_['keys'](db[_0x6e66('0x28')]['rawAttributes']);_0x53235f[_0x6e66('0x2c')]=_[_0x6e66('0x2b')](_0x4d96c3[_0x6e66('0x2c')]);_0x53235f[_0x6e66('0x2d')]=_['intersection'](_0x53235f[_0x6e66('0x2a')],_0x53235f[_0x6e66('0x2c')]);_0x22a5a7[_0x6e66('0x2e')]=_[_0x6e66('0x2f')](_0x53235f[_0x6e66('0x2a')],qs[_0x6e66('0x30')](_0x4d96c3[_0x6e66('0x2c')][_0x6e66('0x30')]));_0x22a5a7['attributes']=_0x22a5a7['attributes']['length']?_0x22a5a7[_0x6e66('0x2e')]:_0x53235f[_0x6e66('0x2a')];if(_0x4d96c3[_0x6e66('0x2c')][_0x6e66('0x3e')]){_0x22a5a7[_0x6e66('0x42')]=[{'all':!![]}];}_0x22a5a7=_['merge']({},_0x22a5a7,_0x4d96c3['options']);return db[_0x6e66('0x28')][_0x6e66('0x43')](_0x22a5a7)[_0x6e66('0x24')](handleEntityNotFound(_0x30f832,null))[_0x6e66('0x24')](respondWithResult(_0x30f832,null))[_0x6e66('0x44')](handleError(_0x30f832,null));};exports[_0x6e66('0x45')]=function(_0x31f0bd,_0x1b552e){return db[_0x6e66('0x28')][_0x6e66('0x45')](_0x31f0bd[_0x6e66('0x46')],{})[_0x6e66('0x24')](respondWithResult(_0x1b552e,0xc9))['catch'](handleError(_0x1b552e,null));};exports[_0x6e66('0x47')]=function(_0x1a92b0,_0x354a4c){if(_0x1a92b0[_0x6e66('0x46')]['id']){delete _0x1a92b0[_0x6e66('0x46')]['id'];}return db[_0x6e66('0x28')]['find']({'where':{'id':_0x1a92b0[_0x6e66('0x41')]['id']}})[_0x6e66('0x24')](handleEntityNotFound(_0x354a4c,null))[_0x6e66('0x24')](saveUpdates(_0x1a92b0[_0x6e66('0x46')],null))['then'](respondWithResult(_0x354a4c,null))[_0x6e66('0x44')](handleError(_0x354a4c,null));};exports[_0x6e66('0x48')]=function(_0xeeffff,_0x37ae5c){return db[_0x6e66('0x28')][_0x6e66('0x43')]({'where':{'id':_0xeeffff[_0x6e66('0x41')]['id']}})['then'](handleEntityNotFound(_0x37ae5c,null))['then'](removeEntity(_0x37ae5c,null))['catch'](handleError(_0x37ae5c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 6407e1f..de87dfc 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 _0xdc8c=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x3e0257,_0x2f4666){var _0x5a2e30=function(_0x47a62f){while(--_0x47a62f){_0x3e0257['push'](_0x3e0257['shift']());}};_0x5a2e30(++_0x2f4666);}(_0xdc8c,0x1c4));var _0xcdc8=function(_0x12d6dd,_0x48ceb6){_0x12d6dd=_0x12d6dd-0x0;var _0x36344a=_0xdc8c[_0x12d6dd];return _0x36344a;};'use strict';var _=require(_0xcdc8('0x0'));var util=require(_0xcdc8('0x1'));var logger=require(_0xcdc8('0x2'))('api');var moment=require(_0xcdc8('0x3'));var BPromise=require(_0xcdc8('0x4'));var rp=require(_0xcdc8('0x5'));var attributes=require(_0xcdc8('0x6'));module[_0xcdc8('0x7')]=function(_0x4abfc5,_0x1ab684){return _0x4abfc5[_0xcdc8('0x8')](_0xcdc8('0x9'),attributes,{'tableName':_0xcdc8('0xa'),'paranoid':![],'indexes':[{'name':_0xcdc8('0xb'),'fields':[_0xcdc8('0xc'),_0xcdc8('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f9e=['bluebird','request-promise','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x1067df,_0x2051e2){var _0x11415d=function(_0x306f45){while(--_0x306f45){_0x1067df['push'](_0x1067df['shift']());}};_0x11415d(++_0x2051e2);}(_0x1f9e,0x14d));var _0xe1f9=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x1f9e[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0xe1f9('0x0'));var util=require('util');var logger=require(_0xe1f9('0x1'))('api');var moment=require(_0xe1f9('0x2'));var BPromise=require(_0xe1f9('0x3'));var rp=require(_0xe1f9('0x4'));var attributes=require(_0xe1f9('0x5'));module[_0xe1f9('0x6')]=function(_0x4b3c32,_0x81c1c6){return _0x4b3c32[_0xe1f9('0x7')](_0xe1f9('0x8'),attributes,{'tableName':_0xe1f9('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xe1f9('0xa'),_0xe1f9('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 271b56f..a2cf464 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 _0xaebd=['ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','ServicenowField,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x3ac59a,_0x457ccf){var _0xb15869=function(_0x474840){while(--_0x474840){_0x3ac59a['push'](_0x3ac59a['shift']());}};_0xb15869(++_0x457ccf);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x1cb396,_0x387d87){_0x1cb396=_0x1cb396-0x0;var _0x406a14=_0xaebd[_0x1cb396];return _0x406a14;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('ServicenowField,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('ServicenowField,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});} \ No newline at end of file +var _0x8e3f=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x962edb,_0x5dd356){var _0x359dcf=function(_0x978f40){while(--_0x978f40){_0x962edb['push'](_0x962edb['shift']());}};_0x359dcf(++_0x5dd356);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8e3f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee9f3,_0x4e9e57,_0x4504dd){return new BPromise(function(_0x2e39b7,_0x17f56c){return client[_0xf8e3('0xb')](_0x1ee9f3,_0x4504dd)[_0xf8e3('0xc')](function(_0x4055e2){logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));logger[_0xf8e3('0x10')](_0xf8e3('0x11'),_0x4e9e57,_0xf8e3('0xf'),JSON['stringify'](_0x4055e2));if(_0x4055e2[_0xf8e3('0x12')]){if(_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x13')]===0x1f4){logger['error'](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x14')]);return _0x17f56c(_0x4055e2[_0xf8e3('0x12')]['message']);}logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')]['message']);return _0x2e39b7(_0x4055e2[_0xf8e3('0x12')]['message']);}else{logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));_0x2e39b7(_0x4055e2['result']['message']);}})[_0xf8e3('0x15')](function(_0x385dde){logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x385dde);_0x17f56c(_0x385dde);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ecc2200..c01b8ff 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 _0x956c=['getFields','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x4498ac,_0x30e301){var _0x4bf1b6=function(_0x117f33){while(--_0x117f33){_0x4498ac['push'](_0x4498ac['shift']());}};_0x4bf1b6(++_0x30e301);}(_0x956c,0xe4));var _0xc956=function(_0x4dbbc1,_0x551cd9){_0x4dbbc1=_0x4dbbc1-0x0;var _0x536cc9=_0x956c[_0x4dbbc1];return _0x536cc9;};'use strict';var multer=require(_0xc956('0x0'));var util=require('util');var path=require(_0xc956('0x1'));var timeout=require(_0xc956('0x2'));var express=require('express');var router=express[_0xc956('0x3')]();var auth=require(_0xc956('0x4'));var interaction=require(_0xc956('0x5'));var config=require(_0xc956('0x6'));var controller=require('./intSugarcrmAccount.controller');router[_0xc956('0x7')]('/',auth[_0xc956('0x8')](),controller[_0xc956('0x9')]);router[_0xc956('0x7')](_0xc956('0xa'),auth[_0xc956('0x8')](),controller[_0xc956('0xb')]);router[_0xc956('0x7')](_0xc956('0xc'),auth[_0xc956('0x8')](),controller[_0xc956('0xd')]);router[_0xc956('0x7')]('/:id/fields',auth[_0xc956('0x8')](),controller[_0xc956('0xe')]);router[_0xc956('0xf')]('/',auth[_0xc956('0x8')](),controller[_0xc956('0x10')]);router['post']('/:id/configurations',auth[_0xc956('0x8')](),controller['addConfiguration']);router[_0xc956('0x11')](_0xc956('0xa'),auth['isAuthenticated'](),controller[_0xc956('0x12')]);router[_0xc956('0x13')]('/:id',auth[_0xc956('0x8')](),controller[_0xc956('0x14')]);module[_0xc956('0x15')]=router; \ No newline at end of file +var _0xc155=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','/:id/fields','post','addConfiguration','update','delete','destroy','multer','util','path'];(function(_0x310c20,_0x71b3ad){var _0x1b2a54=function(_0x530552){while(--_0x530552){_0x310c20['push'](_0x310c20['shift']());}};_0x1b2a54(++_0x71b3ad);}(_0xc155,0x90));var _0x5c15=function(_0xc325fe,_0x399d8f){_0xc325fe=_0xc325fe-0x0;var _0x2b2114=_0xc155[_0xc325fe];return _0x2b2114;};'use strict';var multer=require(_0x5c15('0x0'));var util=require(_0x5c15('0x1'));var path=require(_0x5c15('0x2'));var timeout=require(_0x5c15('0x3'));var express=require(_0x5c15('0x4'));var router=express[_0x5c15('0x5')]();var auth=require(_0x5c15('0x6'));var interaction=require(_0x5c15('0x7'));var config=require('../../config/environment');var controller=require(_0x5c15('0x8'));router[_0x5c15('0x9')]('/',auth['isAuthenticated'](),controller[_0x5c15('0xa')]);router[_0x5c15('0x9')](_0x5c15('0xb'),auth['isAuthenticated'](),controller[_0x5c15('0xc')]);router[_0x5c15('0x9')](_0x5c15('0xd'),auth[_0x5c15('0xe')](),controller['getConfigurations']);router['get'](_0x5c15('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x5c15('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5c15('0x10')](_0x5c15('0xd'),auth['isAuthenticated'](),controller[_0x5c15('0x11')]);router['put']('/:id',auth[_0x5c15('0xe')](),controller[_0x5c15('0x12')]);router[_0x5c15('0x13')]('/:id',auth[_0x5c15('0xe')](),controller[_0x5c15('0x14')]);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 5bdc381..c457789 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 _0xe10d=['username','remoteUri','exports','STRING'];(function(_0x11bde5,_0x1ea9d6){var _0x3f8723=function(_0x554284){while(--_0x554284){_0x11bde5['push'](_0x11bde5['shift']());}};_0x3f8723(++_0x1ea9d6);}(_0xe10d,0x102));var _0xde10=function(_0x9f9816,_0x579b0e){_0x9f9816=_0x9f9816-0x0;var _0x40a913=_0xe10d[_0x9f9816];return _0x40a913;};'use strict';var Sequelize=require('sequelize');module[_0xde10('0x0')]={'name':{'type':Sequelize[_0xde10('0x1')]},'description':{'type':Sequelize[_0xde10('0x1')]},'username':{'type':Sequelize[_0xde10('0x1')],'unique':_0xde10('0x2')},'password':{'type':Sequelize[_0xde10('0x1')]},'remoteUri':{'type':Sequelize[_0xde10('0x1')],'unique':_0xde10('0x3')},'serverUrl':{'type':Sequelize[_0xde10('0x1')]}}; \ No newline at end of file +var _0x4373=['exports','STRING','remoteUri','sequelize'];(function(_0x1474ec,_0x1a4304){var _0x4dd06c=function(_0x2ecc44){while(--_0x2ecc44){_0x1474ec['push'](_0x1474ec['shift']());}};_0x4dd06c(++_0x1a4304);}(_0x4373,0x1ab));var _0x3437=function(_0x24ef60,_0x563ae0){_0x24ef60=_0x24ef60-0x0;var _0x309a1d=_0x4373[_0x24ef60];return _0x309a1d;};'use strict';var Sequelize=require(_0x3437('0x0'));module[_0x3437('0x1')]={'name':{'type':Sequelize[_0x3437('0x2')]},'description':{'type':Sequelize[_0x3437('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3437('0x2')],'unique':_0x3437('0x3')},'serverUrl':{'type':Sequelize[_0x3437('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 3ba89c7..878c4c6 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 _0x35f4=['Descriptions','channel','SugarcrmField','Subjects','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','values','module_fields','remove','label','endsWith','value','statusCode','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','sendStatus','name','send','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','type','key','VIRTUAL','filter','SugarcrmAccount','count','includeAll','include','findAll','show','options','find','create','body','params','destroy','getConfigurations','findOne','SugarcrmConfiguration','AccountId'];(function(_0x27c876,_0x9986ff){var _0x50dfe0=function(_0x273fdb){while(--_0x273fdb){_0x27c876['push'](_0x27c876['shift']());}};_0x50dfe0(++_0x9986ff);}(_0x35f4,0x19e));var _0x435f=function(_0x143565,_0x54d887){_0x143565=_0x143565-0x0;var _0x4dc1d9=_0x35f4[_0x143565];return _0x4dc1d9;};'use strict';var pdf=require(_0x435f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x435f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x435f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x435f('0x3'));var Mustache=require(_0x435f('0x4'));var util=require(_0x435f('0x5'));var path=require('path');var sox=require(_0x435f('0x6'));var csv=require(_0x435f('0x7'));var ejs=require(_0x435f('0x8'));var fs=require('fs');var _=require(_0x435f('0x9'));var squel=require(_0x435f('0xa'));var crypto=require('crypto');var jsforce=require(_0x435f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x435f('0xc'));var authService=require(_0x435f('0xd'));var hardwareService=require(_0x435f('0xe'));var Redis=require(_0x435f('0xf'));var qs=require(_0x435f('0x10'));var logger=require(_0x435f('0x11'))(_0x435f('0x12'));var utils=require(_0x435f('0x13'));var config=require(_0x435f('0x14'));var db=require(_0x435f('0x15'))['db'];var integrations=require(_0x435f('0x16'));var jayson=require(_0x435f('0x17'));var client=jayson[_0x435f('0x18')][_0x435f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3e34e7,_0x20493a,_0x50be70,_0x4bbc38){return new BPromise(function(_0x5e19ea,_0x549ee4){var _0x5848d6=_0x4bbc38||client;return _0x5848d6['request'](_0x3e34e7,_0x50be70)[_0x435f('0x1a')](function(_0x21e1d9){logger[_0x435f('0x1b')](_0x435f('0x1c'),_0x20493a,_0x435f('0x1d'));logger[_0x435f('0x1e')](_0x435f('0x1f'),_0x20493a,_0x435f('0x1d'),JSON['stringify'](_0x21e1d9));if(_0x21e1d9['error']){if(_0x21e1d9[_0x435f('0x20')][_0x435f('0x21')]===0x1f4){logger[_0x435f('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0x20493a,_0x21e1d9['error']['message']);return _0x549ee4(_0x21e1d9[_0x435f('0x20')]['message']);}logger[_0x435f('0x20')](_0x435f('0x1c'),_0x20493a,_0x21e1d9['error'][_0x435f('0x22')]);return _0x5e19ea(_0x21e1d9[_0x435f('0x20')][_0x435f('0x22')]);}else{logger['info'](_0x435f('0x1c'),_0x20493a,_0x435f('0x1d'));_0x5e19ea(_0x21e1d9['result'][_0x435f('0x22')]);}})[_0x435f('0x23')](function(_0x44546c){logger[_0x435f('0x20')](_0x435f('0x1c'),_0x20493a,_0x44546c);_0x549ee4(_0x44546c);});});}function respondWithStatusCode(_0x12099f,_0x4d04a4){_0x4d04a4=_0x4d04a4||0xcc;return function(_0x4b960e){if(_0x4b960e){return _0x12099f['sendStatus'](_0x4d04a4);}return _0x12099f[_0x435f('0x24')](_0x4d04a4)[_0x435f('0x25')]();};}function respondWithResult(_0x3c5d3a,_0x109e61){_0x109e61=_0x109e61||0xc8;return function(_0x5ca031){if(_0x5ca031){return _0x3c5d3a[_0x435f('0x24')](_0x109e61)[_0x435f('0x26')](_0x5ca031);}};}function respondWithFilteredResult(_0x2820ea,_0xf14485){return function(_0x21501c){if(_0x21501c){var _0x247486=_0x21501c['count'],_0x184828=_0xf14485[_0x435f('0x27')],_0x509352=_0xf14485['offset']+_0xf14485[_0x435f('0x28')],_0x9fe7e;if(_0x509352>=_0x247486){_0x509352=_0x247486;_0x9fe7e=0xc8;}else{_0x9fe7e=0xce;}_0x2820ea[_0x435f('0x24')](_0x9fe7e);return _0x2820ea[_0x435f('0x29')](_0x435f('0x2a'),_0x184828+'-'+_0x509352+'/'+_0x247486)[_0x435f('0x26')](_0x21501c);}return null;};}function patchUpdates(_0x41879b){return function(_0xfb63e3){try{jsonpatch[_0x435f('0x2b')](_0xfb63e3,_0x41879b,!![]);}catch(_0x113ea8){return BPromise[_0x435f('0x2c')](_0x113ea8);}return _0xfb63e3[_0x435f('0x2d')]();};}function saveUpdates(_0x53e695,_0x552d2e){return function(_0x25fe42){if(_0x25fe42){return _0x25fe42[_0x435f('0x2e')](_0x53e695)[_0x435f('0x1a')](function(_0x33d5ab){return _0x33d5ab;});}return null;};}function removeEntity(_0x11f55e,_0x4c9b4c){return function(_0x26f038){if(_0x26f038){return _0x26f038['destroy']()[_0x435f('0x1a')](function(){_0x11f55e[_0x435f('0x24')](0xcc)[_0x435f('0x25')]();});}};}function handleEntityNotFound(_0x3d7b40,_0x40de09){return function(_0x53ef11){if(!_0x53ef11){_0x3d7b40[_0x435f('0x2f')](0x194);}return _0x53ef11;};}function handleError(_0x5ccb29,_0x4f1d9a){_0x4f1d9a=_0x4f1d9a||0x1f4;return function(_0x4f3a76){logger['error'](_0x4f3a76['stack']);if(_0x4f3a76[_0x435f('0x30')]){delete _0x4f3a76['name'];}_0x5ccb29[_0x435f('0x24')](_0x4f1d9a)[_0x435f('0x31')](_0x4f3a76);};}exports['index']=function(_0x2ef5b9,_0x3ad445){var _0x1c8b1e={},_0x32e609={},_0x1b7eaf={'count':0x0,'rows':[]};var _0x1ce103=db['SugarcrmAccount'][_0x435f('0x32')];_0x32e609['model']=_['keys'](_0x1ce103);_0x32e609[_0x435f('0x33')]=_[_0x435f('0x34')](_0x2ef5b9[_0x435f('0x33')]);_0x32e609[_0x435f('0x35')]=_[_0x435f('0x36')](_0x32e609[_0x435f('0x37')],_0x32e609['query']);_0x1c8b1e['attributes']=_[_0x435f('0x36')](_0x32e609[_0x435f('0x37')],qs[_0x435f('0x38')](_0x2ef5b9[_0x435f('0x33')][_0x435f('0x38')]));_0x1c8b1e[_0x435f('0x39')]=_0x1c8b1e['attributes'][_0x435f('0x3a')]?_0x1c8b1e['attributes']:_0x32e609[_0x435f('0x37')];if(!_0x2ef5b9['query'][_0x435f('0x3b')](_0x435f('0x3c'))){_0x1c8b1e[_0x435f('0x28')]=qs[_0x435f('0x28')](_0x2ef5b9[_0x435f('0x33')]['limit']);_0x1c8b1e[_0x435f('0x27')]=qs['offset'](_0x2ef5b9[_0x435f('0x33')][_0x435f('0x27')]);}_0x1c8b1e['order']=qs[_0x435f('0x3d')](_0x2ef5b9[_0x435f('0x33')][_0x435f('0x3d')]);_0x1c8b1e[_0x435f('0x3e')]=qs[_0x435f('0x35')](_[_0x435f('0x3f')](_0x2ef5b9[_0x435f('0x33')],_0x32e609[_0x435f('0x35')]));if(_0x2ef5b9[_0x435f('0x33')]['filter']){_0x1c8b1e[_0x435f('0x3e')]=_[_0x435f('0x40')](_0x1c8b1e['where'],{'$or':_[_0x435f('0x41')](_0x1ce103,function(_0x2b5e58){if(_0x2b5e58[_0x435f('0x42')][_0x435f('0x43')]!==_0x435f('0x44')){var _0x5808ad={};_0x5808ad[_0x2b5e58['field']]={'$like':'%'+_0x2ef5b9[_0x435f('0x33')][_0x435f('0x45')]+'%'};return _0x5808ad;}})});}_0x1c8b1e=_['merge']({},_0x1c8b1e,_0x2ef5b9['options']);var _0x5943d6={'where':_0x1c8b1e[_0x435f('0x3e')]};return db[_0x435f('0x46')][_0x435f('0x47')](_0x5943d6)[_0x435f('0x1a')](function(_0x5b1a7e){_0x1b7eaf[_0x435f('0x47')]=_0x5b1a7e;if(_0x2ef5b9[_0x435f('0x33')][_0x435f('0x48')]){_0x1c8b1e[_0x435f('0x49')]=[{'all':!![]}];}return db[_0x435f('0x46')][_0x435f('0x4a')](_0x1c8b1e);})[_0x435f('0x1a')](function(_0x10db1f){_0x1b7eaf['rows']=_0x10db1f;return _0x1b7eaf;})[_0x435f('0x1a')](respondWithFilteredResult(_0x3ad445,_0x1c8b1e))['catch'](handleError(_0x3ad445,null));};exports[_0x435f('0x4b')]=function(_0x34453d,_0x2ae7d8){var _0x2a0a8c={'raw':![],'where':{'id':_0x34453d['params']['id']}},_0x1b44d7={};_0x1b44d7['model']=_[_0x435f('0x34')](db[_0x435f('0x46')]['rawAttributes']);_0x1b44d7['query']=_[_0x435f('0x34')](_0x34453d['query']);_0x1b44d7[_0x435f('0x35')]=_[_0x435f('0x36')](_0x1b44d7['model'],_0x1b44d7[_0x435f('0x33')]);_0x2a0a8c[_0x435f('0x39')]=_[_0x435f('0x36')](_0x1b44d7[_0x435f('0x37')],qs[_0x435f('0x38')](_0x34453d[_0x435f('0x33')]['fields']));_0x2a0a8c[_0x435f('0x39')]=_0x2a0a8c[_0x435f('0x39')][_0x435f('0x3a')]?_0x2a0a8c[_0x435f('0x39')]:_0x1b44d7['model'];if(_0x34453d[_0x435f('0x33')]['includeAll']){_0x2a0a8c[_0x435f('0x49')]=[{'all':!![]}];}_0x2a0a8c=_[_0x435f('0x40')]({},_0x2a0a8c,_0x34453d[_0x435f('0x4c')]);return db['SugarcrmAccount'][_0x435f('0x4d')](_0x2a0a8c)['then'](handleEntityNotFound(_0x2ae7d8,null))['then'](respondWithResult(_0x2ae7d8,null))[_0x435f('0x23')](handleError(_0x2ae7d8,null));};exports[_0x435f('0x4e')]=function(_0x12a229,_0x562ff0){return db[_0x435f('0x46')][_0x435f('0x4e')](_0x12a229['body'],{})['then'](respondWithResult(_0x562ff0,0xc9))[_0x435f('0x23')](handleError(_0x562ff0,null));};exports[_0x435f('0x2e')]=function(_0x3acc76,_0x581f4f){if(_0x3acc76[_0x435f('0x4f')]['id']){delete _0x3acc76[_0x435f('0x4f')]['id'];}return db[_0x435f('0x46')][_0x435f('0x4d')]({'where':{'id':_0x3acc76[_0x435f('0x50')]['id']}})['then'](handleEntityNotFound(_0x581f4f,null))[_0x435f('0x1a')](saveUpdates(_0x3acc76[_0x435f('0x4f')],null))[_0x435f('0x1a')](respondWithResult(_0x581f4f,null))[_0x435f('0x23')](handleError(_0x581f4f,null));};exports[_0x435f('0x51')]=function(_0x3cede4,_0x33f88c){return db['SugarcrmAccount'][_0x435f('0x4d')]({'where':{'id':_0x3cede4[_0x435f('0x50')]['id']}})[_0x435f('0x1a')](handleEntityNotFound(_0x33f88c,null))['then'](removeEntity(_0x33f88c,null))[_0x435f('0x23')](handleError(_0x33f88c,null));};exports[_0x435f('0x52')]=function(_0x45c2ae,_0x24d6b2,_0x233af7){var _0x2694d5={};var _0x4ccd65={};var _0x227750;var _0x9a036a;return db[_0x435f('0x46')][_0x435f('0x53')]({'where':{'id':_0x45c2ae['params']['id']}})[_0x435f('0x1a')](handleEntityNotFound(_0x24d6b2,null))[_0x435f('0x1a')](function(_0x77aa54){if(_0x77aa54){_0x227750=_0x77aa54;_0x4ccd65['model']=_[_0x435f('0x34')](db[_0x435f('0x54')][_0x435f('0x32')]);_0x4ccd65[_0x435f('0x33')]=_[_0x435f('0x34')](_0x45c2ae[_0x435f('0x33')]);_0x4ccd65['filters']=_[_0x435f('0x36')](_0x4ccd65[_0x435f('0x37')],_0x4ccd65[_0x435f('0x33')]);_0x2694d5[_0x435f('0x39')]=_[_0x435f('0x36')](_0x4ccd65['model'],qs['fields'](_0x45c2ae[_0x435f('0x33')][_0x435f('0x38')]));_0x2694d5[_0x435f('0x39')]=_0x2694d5['attributes'][_0x435f('0x3a')]?_0x2694d5[_0x435f('0x39')]:_0x4ccd65[_0x435f('0x37')];_0x2694d5['order']=qs[_0x435f('0x3d')](_0x45c2ae[_0x435f('0x33')][_0x435f('0x3d')]);_0x2694d5['where']=qs[_0x435f('0x35')](_[_0x435f('0x3f')](_0x45c2ae[_0x435f('0x33')],_0x4ccd65[_0x435f('0x35')]));if(_0x45c2ae['query'][_0x435f('0x45')]){_0x2694d5[_0x435f('0x3e')]=_[_0x435f('0x40')](_0x2694d5[_0x435f('0x3e')],{'$or':_['map'](_0x2694d5['attributes'],function(_0x4b2685){var _0x10ea1b={};_0x10ea1b[_0x4b2685]={'$like':'%'+_0x45c2ae[_0x435f('0x33')][_0x435f('0x45')]+'%'};return _0x10ea1b;})});}_0x2694d5=_[_0x435f('0x40')]({},_0x2694d5,_0x45c2ae['options']);return _0x227750[_0x435f('0x52')](_0x2694d5);}})[_0x435f('0x1a')](function(_0x256495){if(_0x256495){_0x9a036a=_0x256495[_0x435f('0x3a')];if(!_0x45c2ae[_0x435f('0x33')][_0x435f('0x3b')](_0x435f('0x3c'))){_0x2694d5['limit']=qs[_0x435f('0x28')](_0x45c2ae['query'][_0x435f('0x28')]);_0x2694d5[_0x435f('0x27')]=qs[_0x435f('0x27')](_0x45c2ae['query'][_0x435f('0x27')]);}return _0x227750['getConfigurations'](_0x2694d5);}})[_0x435f('0x1a')](function(_0xc98ca9){if(_0xc98ca9){return _0xc98ca9?{'count':_0x9a036a,'rows':_0xc98ca9}:null;}})['then'](respondWithResult(_0x24d6b2,null))[_0x435f('0x23')](handleError(_0x24d6b2,null));};exports['addConfiguration']=function(_0x921d67,_0x3365,_0x38fe6f){if(_0x921d67[_0x435f('0x4f')]['id']){delete _0x921d67[_0x435f('0x4f')]['id'];}return db[_0x435f('0x46')]['findOne']({'where':{'id':_0x921d67[_0x435f('0x50')]['id']}})['then'](handleEntityNotFound(_0x3365,null))[_0x435f('0x1a')](function(_0x169f53){if(_0x169f53){_0x921d67[_0x435f('0x4f')][_0x435f('0x55')]=_0x169f53['id'];_0x921d67['body']['Subjects']=integrations['getSubjects'](_0x921d67[_0x435f('0x4f')]['channel'],_0x921d67[_0x435f('0x4f')][_0x435f('0x42')]);_0x921d67[_0x435f('0x4f')][_0x435f('0x56')]=integrations['getDescriptions'](_0x921d67[_0x435f('0x4f')][_0x435f('0x57')],_0x921d67['body'][_0x435f('0x42')]);return db[_0x435f('0x54')]['create'](_0x921d67[_0x435f('0x4f')],{'include':[{'model':db[_0x435f('0x58')],'as':_0x435f('0x59')},{'model':db['SugarcrmField'],'as':_0x435f('0x56')}]});}return null;})[_0x435f('0x1a')](respondWithResult(_0x3365,null))[_0x435f('0x23')](handleError(_0x3365,null));};exports[_0x435f('0x5a')]=function(_0x22f509,_0x4a7b2a,_0x348911){var _0x59f6f0='';var _0x356e28=['id',_0x435f('0x30'),_0x435f('0x5b'),'created_by',_0x435f('0x5c'),_0x435f('0x5d'),_0x435f('0x5e'),_0x435f('0x5f'),_0x435f('0x60'),_0x435f('0x61'),_0x435f('0x62'),_0x435f('0x63')];return db[_0x435f('0x46')][_0x435f('0x53')]({'where':{'id':_0x22f509['params']['id']},'attributes':['id',_0x435f('0x64'),_0x435f('0x65'),'remoteUri']})[_0x435f('0x1a')](handleEntityNotFound(_0x4a7b2a,null))['then'](function(_0x3e8b23){if(_0x3e8b23){_0x59f6f0=_0x3e8b23[_0x435f('0x66')];var _0x11f20c=_0x59f6f0[_0x435f('0x67')](-0x1);if(_0x11f20c==='/'){_0x59f6f0=_0x59f6f0[_0x435f('0x68')](0x0,_0x59f6f0[_0x435f('0x69')](_0x11f20c));}return rp({'method':_0x435f('0x6a'),'uri':util[_0x435f('0x6b')](_0x435f('0x6c'),_0x59f6f0,_0x435f('0x6d')),'json':!![],'form':{'method':_0x435f('0x6e'),'input_type':_0x435f('0x6f'),'response_type':_0x435f('0x6f'),'rest_data':JSON[_0x435f('0x70')]({'user_auth':{'user_name':_0x3e8b23[_0x435f('0x64')],'password':_0x3e8b23['password'],'encryption':'PLAIN'},'application':_0x435f('0x71')})}});}})[_0x435f('0x1a')](function(_0x48e148){if(_0x48e148&&_0x48e148['name']!==_0x435f('0x72')&&_0x48e148['name']!==_0x435f('0x73')){return rp({'method':_0x435f('0x6a'),'uri':util['format'](_0x435f('0x6c'),_0x59f6f0,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x435f('0x74'),'input_type':_0x435f('0x6f'),'response_type':_0x435f('0x6f'),'rest_data':JSON[_0x435f('0x70')]({'session':_0x48e148['id'],'module_name':'Calls'})}})[_0x435f('0x1a')](function(_0x9542ec){if(_0x9542ec){var _0x591d01=_[_0x435f('0x75')](_0x9542ec[_0x435f('0x76')]);_[_0x435f('0x77')](_0x591d01,function(_0x5de66b){return _0x356e28['includes'](_0x5de66b[_0x435f('0x30')]);});return{'count':_0x591d01[_0x435f('0x3a')],'rows':_[_0x435f('0x41')](_0x591d01,function(_0x4cf0d0){return{'id':_0x4cf0d0[_0x435f('0x30')],'name':_0x4cf0d0[_0x435f('0x78')],'custom':_[_0x435f('0x79')](_0x4cf0d0[_0x435f('0x30')],'_c')?!![]:![],'options':_0x4cf0d0[_0x435f('0x4c')]?_['map'](_[_0x435f('0x75')](_0x4cf0d0['options']),function(_0x2ab9f3){return{'name':_0x2ab9f3[_0x435f('0x7a')],'value':_0x2ab9f3['name']};}):[]};})};}})[_0x435f('0x1a')](respondWithResult(_0x4a7b2a,null))[_0x435f('0x23')](function(_0x2978cf){var _0x48c46b=_0x22f509[_0x435f('0x33')]['test']?0x1f4:_0x2978cf[_0x435f('0x7b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x48c46b,JSON[_0x435f('0x70')](_0x2978cf));delete _0x2978cf['name'];if(_0x48c46b===0x191){_0x48c46b=0x190;}_0x4a7b2a[_0x435f('0x24')](_0x48c46b)[_0x435f('0x31')](_0x22f509[_0x435f('0x33')]['test']?{'message':_0x435f('0x7c'),'statusCode':_0x2978cf[_0x435f('0x7b')]}:_0x2978cf);});}else{var _0x502c08=0x1f4;_0x4a7b2a[_0x435f('0x24')](_0x502c08)[_0x435f('0x31')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xcf1e=['includes','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','http','request','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','name','send','index','SugarcrmAccount','rawAttributes','model','query','keys','attributes','intersection','fields','nolimit','limit','sort','where','filters','pick','filter','merge','type','key','VIRTUAL','field','options','then','include','findAll','rows','show','params','length','includeAll','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','order','map','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','password','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','username','PLAIN','Invalid\x20Login','values','module_fields'];(function(_0x5109c1,_0x37195b){var _0x47c577=function(_0x573ed4){while(--_0x573ed4){_0x5109c1['push'](_0x5109c1['shift']());}};_0x47c577(++_0x37195b);}(_0xcf1e,0x88));var _0xecf1=function(_0x2278de,_0x25cc69){_0x2278de=_0x2278de-0x0;var _0x3ed51f=_0xcf1e[_0x2278de];return _0x3ed51f;};'use strict';var pdf=require(_0xecf1('0x0'));var emlformat=require(_0xecf1('0x1'));var rimraf=require(_0xecf1('0x2'));var zipdir=require(_0xecf1('0x3'));var jsonpatch=require(_0xecf1('0x4'));var rp=require(_0xecf1('0x5'));var moment=require(_0xecf1('0x6'));var BPromise=require(_0xecf1('0x7'));var Mustache=require(_0xecf1('0x8'));var util=require(_0xecf1('0x9'));var path=require('path');var sox=require(_0xecf1('0xa'));var csv=require(_0xecf1('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xecf1('0xc'));var crypto=require(_0xecf1('0xd'));var jsforce=require(_0xecf1('0xe'));var deskjs=require(_0xecf1('0xf'));var toCsv=require(_0xecf1('0xb'));var querystring=require(_0xecf1('0x10'));var Papa=require(_0xecf1('0x11'));var authService=require(_0xecf1('0x12'));var hardwareService=require(_0xecf1('0x13'));var Redis=require(_0xecf1('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0xecf1('0x15'))('api');var utils=require(_0xecf1('0x16'));var config=require(_0xecf1('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xecf1('0x18'));var jayson=require('jayson/promise');var client=jayson['client'][_0xecf1('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3d3908,_0x1e4b10,_0x51949f,_0x342d99){return new BPromise(function(_0x493c0a,_0x174a1e){var _0x2f03b9=_0x342d99||client;return _0x2f03b9[_0xecf1('0x1a')](_0x3d3908,_0x51949f)['then'](function(_0x132d96){logger[_0xecf1('0x1b')]('SugarcrmAccount,\x20%s,\x20%s',_0x1e4b10,_0xecf1('0x1c'));logger[_0xecf1('0x1d')](_0xecf1('0x1e'),_0x1e4b10,'request\x20sent',JSON[_0xecf1('0x1f')](_0x132d96));if(_0x132d96[_0xecf1('0x20')]){if(_0x132d96['error'][_0xecf1('0x21')]===0x1f4){logger['error'](_0xecf1('0x22'),_0x1e4b10,_0x132d96['error'][_0xecf1('0x23')]);return _0x174a1e(_0x132d96[_0xecf1('0x20')][_0xecf1('0x23')]);}logger[_0xecf1('0x20')](_0xecf1('0x22'),_0x1e4b10,_0x132d96['error'][_0xecf1('0x23')]);return _0x493c0a(_0x132d96[_0xecf1('0x20')][_0xecf1('0x23')]);}else{logger['info'](_0xecf1('0x22'),_0x1e4b10,_0xecf1('0x1c'));_0x493c0a(_0x132d96['result'][_0xecf1('0x23')]);}})[_0xecf1('0x24')](function(_0x1e2167){logger['error'](_0xecf1('0x22'),_0x1e4b10,_0x1e2167);_0x174a1e(_0x1e2167);});});}function respondWithStatusCode(_0x2a9c40,_0x5d41bd){_0x5d41bd=_0x5d41bd||0xcc;return function(_0x250b34){if(_0x250b34){return _0x2a9c40[_0xecf1('0x25')](_0x5d41bd);}return _0x2a9c40[_0xecf1('0x26')](_0x5d41bd)[_0xecf1('0x27')]();};}function respondWithResult(_0x3c1e2c,_0x69bf0d){_0x69bf0d=_0x69bf0d||0xc8;return function(_0x38cc17){if(_0x38cc17){return _0x3c1e2c['status'](_0x69bf0d)['json'](_0x38cc17);}};}function respondWithFilteredResult(_0x50562,_0x322589){return function(_0xbe031e){if(_0xbe031e){var _0x1e8b2f=_0xbe031e[_0xecf1('0x28')],_0x28aca1=_0x322589[_0xecf1('0x29')],_0x35b1f5=_0x322589[_0xecf1('0x29')]+_0x322589['limit'],_0x3c9a80;if(_0x35b1f5>=_0x1e8b2f){_0x35b1f5=_0x1e8b2f;_0x3c9a80=0xc8;}else{_0x3c9a80=0xce;}_0x50562[_0xecf1('0x26')](_0x3c9a80);return _0x50562[_0xecf1('0x2a')](_0xecf1('0x2b'),_0x28aca1+'-'+_0x35b1f5+'/'+_0x1e8b2f)[_0xecf1('0x2c')](_0xbe031e);}return null;};}function patchUpdates(_0x5977b3){return function(_0x43c984){try{jsonpatch[_0xecf1('0x2d')](_0x43c984,_0x5977b3,!![]);}catch(_0x3e0986){return BPromise['reject'](_0x3e0986);}return _0x43c984[_0xecf1('0x2e')]();};}function saveUpdates(_0x382ac1,_0x3b3e6e){return function(_0x5f160d){if(_0x5f160d){return _0x5f160d[_0xecf1('0x2f')](_0x382ac1)['then'](function(_0x37f9b4){return _0x37f9b4;});}return null;};}function removeEntity(_0x506782,_0x5437e7){return function(_0x2d9b56){if(_0x2d9b56){return _0x2d9b56['destroy']()['then'](function(){_0x506782[_0xecf1('0x26')](0xcc)[_0xecf1('0x27')]();});}};}function handleEntityNotFound(_0x35420d,_0x2b9277){return function(_0x49908c){if(!_0x49908c){_0x35420d[_0xecf1('0x25')](0x194);}return _0x49908c;};}function handleError(_0x263b36,_0x589b5a){_0x589b5a=_0x589b5a||0x1f4;return function(_0x44755e){logger[_0xecf1('0x20')](_0x44755e['stack']);if(_0x44755e[_0xecf1('0x30')]){delete _0x44755e[_0xecf1('0x30')];}_0x263b36[_0xecf1('0x26')](_0x589b5a)[_0xecf1('0x31')](_0x44755e);};}exports[_0xecf1('0x32')]=function(_0xfb7118,_0x3ef2e1){var _0x2c066a={},_0x452f62={},_0x187b0c={'count':0x0,'rows':[]};var _0x51a0ca=db[_0xecf1('0x33')][_0xecf1('0x34')];_0x452f62[_0xecf1('0x35')]=_['keys'](_0x51a0ca);_0x452f62[_0xecf1('0x36')]=_[_0xecf1('0x37')](_0xfb7118[_0xecf1('0x36')]);_0x452f62['filters']=_['intersection'](_0x452f62['model'],_0x452f62[_0xecf1('0x36')]);_0x2c066a[_0xecf1('0x38')]=_[_0xecf1('0x39')](_0x452f62['model'],qs[_0xecf1('0x3a')](_0xfb7118[_0xecf1('0x36')][_0xecf1('0x3a')]));_0x2c066a[_0xecf1('0x38')]=_0x2c066a[_0xecf1('0x38')]['length']?_0x2c066a[_0xecf1('0x38')]:_0x452f62['model'];if(!_0xfb7118['query']['hasOwnProperty'](_0xecf1('0x3b'))){_0x2c066a[_0xecf1('0x3c')]=qs[_0xecf1('0x3c')](_0xfb7118[_0xecf1('0x36')][_0xecf1('0x3c')]);_0x2c066a[_0xecf1('0x29')]=qs[_0xecf1('0x29')](_0xfb7118[_0xecf1('0x36')][_0xecf1('0x29')]);}_0x2c066a['order']=qs[_0xecf1('0x3d')](_0xfb7118[_0xecf1('0x36')][_0xecf1('0x3d')]);_0x2c066a[_0xecf1('0x3e')]=qs[_0xecf1('0x3f')](_[_0xecf1('0x40')](_0xfb7118['query'],_0x452f62[_0xecf1('0x3f')]));if(_0xfb7118[_0xecf1('0x36')][_0xecf1('0x41')]){_0x2c066a[_0xecf1('0x3e')]=_[_0xecf1('0x42')](_0x2c066a[_0xecf1('0x3e')],{'$or':_['map'](_0x51a0ca,function(_0x2e2158){if(_0x2e2158[_0xecf1('0x43')][_0xecf1('0x44')]!==_0xecf1('0x45')){var _0x2382bd={};_0x2382bd[_0x2e2158[_0xecf1('0x46')]]={'$like':'%'+_0xfb7118[_0xecf1('0x36')][_0xecf1('0x41')]+'%'};return _0x2382bd;}})});}_0x2c066a=_['merge']({},_0x2c066a,_0xfb7118[_0xecf1('0x47')]);var _0x2f0997={'where':_0x2c066a[_0xecf1('0x3e')]};return db['SugarcrmAccount'][_0xecf1('0x28')](_0x2f0997)[_0xecf1('0x48')](function(_0x1cdd17){_0x187b0c['count']=_0x1cdd17;if(_0xfb7118[_0xecf1('0x36')]['includeAll']){_0x2c066a[_0xecf1('0x49')]=[{'all':!![]}];}return db[_0xecf1('0x33')][_0xecf1('0x4a')](_0x2c066a);})[_0xecf1('0x48')](function(_0x36940c){_0x187b0c[_0xecf1('0x4b')]=_0x36940c;return _0x187b0c;})[_0xecf1('0x48')](respondWithFilteredResult(_0x3ef2e1,_0x2c066a))[_0xecf1('0x24')](handleError(_0x3ef2e1,null));};exports[_0xecf1('0x4c')]=function(_0x49b865,_0x2aa110){var _0x8bd99e={'raw':![],'where':{'id':_0x49b865[_0xecf1('0x4d')]['id']}},_0x1b3fb8={};_0x1b3fb8[_0xecf1('0x35')]=_[_0xecf1('0x37')](db[_0xecf1('0x33')]['rawAttributes']);_0x1b3fb8[_0xecf1('0x36')]=_[_0xecf1('0x37')](_0x49b865[_0xecf1('0x36')]);_0x1b3fb8[_0xecf1('0x3f')]=_[_0xecf1('0x39')](_0x1b3fb8['model'],_0x1b3fb8['query']);_0x8bd99e[_0xecf1('0x38')]=_[_0xecf1('0x39')](_0x1b3fb8['model'],qs['fields'](_0x49b865[_0xecf1('0x36')][_0xecf1('0x3a')]));_0x8bd99e['attributes']=_0x8bd99e[_0xecf1('0x38')][_0xecf1('0x4e')]?_0x8bd99e[_0xecf1('0x38')]:_0x1b3fb8[_0xecf1('0x35')];if(_0x49b865[_0xecf1('0x36')][_0xecf1('0x4f')]){_0x8bd99e[_0xecf1('0x49')]=[{'all':!![]}];}_0x8bd99e=_[_0xecf1('0x42')]({},_0x8bd99e,_0x49b865[_0xecf1('0x47')]);return db['SugarcrmAccount'][_0xecf1('0x50')](_0x8bd99e)[_0xecf1('0x48')](handleEntityNotFound(_0x2aa110,null))['then'](respondWithResult(_0x2aa110,null))[_0xecf1('0x24')](handleError(_0x2aa110,null));};exports[_0xecf1('0x51')]=function(_0x35a681,_0x5e97ec){return db['SugarcrmAccount'][_0xecf1('0x51')](_0x35a681[_0xecf1('0x52')],{})[_0xecf1('0x48')](respondWithResult(_0x5e97ec,0xc9))['catch'](handleError(_0x5e97ec,null));};exports[_0xecf1('0x2f')]=function(_0x39724d,_0x2cf1e4){if(_0x39724d[_0xecf1('0x52')]['id']){delete _0x39724d[_0xecf1('0x52')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x39724d[_0xecf1('0x4d')]['id']}})[_0xecf1('0x48')](handleEntityNotFound(_0x2cf1e4,null))[_0xecf1('0x48')](saveUpdates(_0x39724d['body'],null))['then'](respondWithResult(_0x2cf1e4,null))['catch'](handleError(_0x2cf1e4,null));};exports[_0xecf1('0x53')]=function(_0x1fc87f,_0x5cd9c6){return db['SugarcrmAccount'][_0xecf1('0x50')]({'where':{'id':_0x1fc87f[_0xecf1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5cd9c6,null))['then'](removeEntity(_0x5cd9c6,null))['catch'](handleError(_0x5cd9c6,null));};exports[_0xecf1('0x54')]=function(_0x2210f6,_0x487c77,_0x5d2cf3){var _0x411225={};var _0x475169={};var _0x5af0ac;var _0x2dc673;return db[_0xecf1('0x33')][_0xecf1('0x55')]({'where':{'id':_0x2210f6[_0xecf1('0x4d')]['id']}})[_0xecf1('0x48')](handleEntityNotFound(_0x487c77,null))[_0xecf1('0x48')](function(_0x5409bf){if(_0x5409bf){_0x5af0ac=_0x5409bf;_0x475169[_0xecf1('0x35')]=_[_0xecf1('0x37')](db[_0xecf1('0x56')][_0xecf1('0x34')]);_0x475169[_0xecf1('0x36')]=_[_0xecf1('0x37')](_0x2210f6[_0xecf1('0x36')]);_0x475169['filters']=_[_0xecf1('0x39')](_0x475169[_0xecf1('0x35')],_0x475169[_0xecf1('0x36')]);_0x411225[_0xecf1('0x38')]=_['intersection'](_0x475169['model'],qs[_0xecf1('0x3a')](_0x2210f6[_0xecf1('0x36')][_0xecf1('0x3a')]));_0x411225['attributes']=_0x411225[_0xecf1('0x38')][_0xecf1('0x4e')]?_0x411225[_0xecf1('0x38')]:_0x475169[_0xecf1('0x35')];_0x411225[_0xecf1('0x57')]=qs[_0xecf1('0x3d')](_0x2210f6[_0xecf1('0x36')][_0xecf1('0x3d')]);_0x411225[_0xecf1('0x3e')]=qs[_0xecf1('0x3f')](_[_0xecf1('0x40')](_0x2210f6[_0xecf1('0x36')],_0x475169['filters']));if(_0x2210f6['query']['filter']){_0x411225[_0xecf1('0x3e')]=_['merge'](_0x411225[_0xecf1('0x3e')],{'$or':_[_0xecf1('0x58')](_0x411225[_0xecf1('0x38')],function(_0x3d1c94){var _0x419308={};_0x419308[_0x3d1c94]={'$like':'%'+_0x2210f6[_0xecf1('0x36')]['filter']+'%'};return _0x419308;})});}_0x411225=_['merge']({},_0x411225,_0x2210f6[_0xecf1('0x47')]);return _0x5af0ac['getConfigurations'](_0x411225);}})[_0xecf1('0x48')](function(_0x975de2){if(_0x975de2){_0x2dc673=_0x975de2[_0xecf1('0x4e')];if(!_0x2210f6[_0xecf1('0x36')][_0xecf1('0x59')](_0xecf1('0x3b'))){_0x411225['limit']=qs['limit'](_0x2210f6['query']['limit']);_0x411225[_0xecf1('0x29')]=qs[_0xecf1('0x29')](_0x2210f6[_0xecf1('0x36')][_0xecf1('0x29')]);}return _0x5af0ac['getConfigurations'](_0x411225);}})[_0xecf1('0x48')](function(_0xad787a){if(_0xad787a){return _0xad787a?{'count':_0x2dc673,'rows':_0xad787a}:null;}})[_0xecf1('0x48')](respondWithResult(_0x487c77,null))[_0xecf1('0x24')](handleError(_0x487c77,null));};exports['addConfiguration']=function(_0x24ea8e,_0x5defc8,_0x4cf826){if(_0x24ea8e[_0xecf1('0x52')]['id']){delete _0x24ea8e['body']['id'];}return db[_0xecf1('0x33')][_0xecf1('0x55')]({'where':{'id':_0x24ea8e[_0xecf1('0x4d')]['id']}})[_0xecf1('0x48')](handleEntityNotFound(_0x5defc8,null))[_0xecf1('0x48')](function(_0x138bea){if(_0x138bea){_0x24ea8e[_0xecf1('0x52')][_0xecf1('0x5a')]=_0x138bea['id'];_0x24ea8e['body'][_0xecf1('0x5b')]=integrations[_0xecf1('0x5c')](_0x24ea8e[_0xecf1('0x52')]['channel'],_0x24ea8e[_0xecf1('0x52')][_0xecf1('0x43')]);_0x24ea8e[_0xecf1('0x52')][_0xecf1('0x5d')]=integrations[_0xecf1('0x5e')](_0x24ea8e[_0xecf1('0x52')][_0xecf1('0x5f')],_0x24ea8e[_0xecf1('0x52')][_0xecf1('0x43')]);return db[_0xecf1('0x56')][_0xecf1('0x51')](_0x24ea8e[_0xecf1('0x52')],{'include':[{'model':db['SugarcrmField'],'as':_0xecf1('0x5b')},{'model':db[_0xecf1('0x60')],'as':_0xecf1('0x5d')}]});}return null;})[_0xecf1('0x48')](respondWithResult(_0x5defc8,null))['catch'](handleError(_0x5defc8,null));};exports['getFields']=function(_0x2ed1e1,_0x2d7213,_0x61f513){var _0x577049='';var _0x3b82b5=['id','name',_0xecf1('0x61'),_0xecf1('0x62'),_0xecf1('0x63'),_0xecf1('0x64'),'duration_hours',_0xecf1('0x65'),_0xecf1('0x66'),_0xecf1('0x67'),_0xecf1('0x68'),_0xecf1('0x69')];return db[_0xecf1('0x33')][_0xecf1('0x55')]({'where':{'id':_0x2ed1e1[_0xecf1('0x4d')]['id']},'attributes':['id','username',_0xecf1('0x6a'),'remoteUri']})['then'](handleEntityNotFound(_0x2d7213,null))['then'](function(_0x4e8cb7){if(_0x4e8cb7){_0x577049=_0x4e8cb7['remoteUri'];var _0x2e669d=_0x577049[_0xecf1('0x6b')](-0x1);if(_0x2e669d==='/'){_0x577049=_0x577049[_0xecf1('0x6c')](0x0,_0x577049[_0xecf1('0x6d')](_0x2e669d));}return rp({'method':_0xecf1('0x6e'),'uri':util[_0xecf1('0x6f')](_0xecf1('0x70'),_0x577049,_0xecf1('0x71')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xecf1('0x72'),'rest_data':JSON[_0xecf1('0x1f')]({'user_auth':{'user_name':_0x4e8cb7[_0xecf1('0x73')],'password':_0x4e8cb7['password'],'encryption':_0xecf1('0x74')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xecf1('0x48')](function(_0x31bef9){if(_0x31bef9&&_0x31bef9[_0xecf1('0x30')]!==_0xecf1('0x75')&&_0x31bef9[_0xecf1('0x30')]!=='Password\x20Expired'){return rp({'method':_0xecf1('0x6e'),'uri':util['format'](_0xecf1('0x70'),_0x577049,_0xecf1('0x71')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xecf1('0x72'),'response_type':_0xecf1('0x72'),'rest_data':JSON[_0xecf1('0x1f')]({'session':_0x31bef9['id'],'module_name':'Calls'})}})[_0xecf1('0x48')](function(_0x140bc1){if(_0x140bc1){var _0x36abe6=_[_0xecf1('0x76')](_0x140bc1[_0xecf1('0x77')]);_['remove'](_0x36abe6,function(_0x4b9ff2){return _0x3b82b5[_0xecf1('0x78')](_0x4b9ff2['name']);});return{'count':_0x36abe6['length'],'rows':_['map'](_0x36abe6,function(_0x25f613){return{'id':_0x25f613[_0xecf1('0x30')],'name':_0x25f613[_0xecf1('0x79')],'custom':_['endsWith'](_0x25f613[_0xecf1('0x30')],'_c')?!![]:![],'options':_0x25f613['options']?_[_0xecf1('0x58')](_[_0xecf1('0x76')](_0x25f613[_0xecf1('0x47')]),function(_0x4cc3e8){return{'name':_0x4cc3e8[_0xecf1('0x7a')],'value':_0x4cc3e8[_0xecf1('0x30')]};}):[]};})};}})[_0xecf1('0x48')](respondWithResult(_0x2d7213,null))['catch'](function(_0x384fde){var _0x312704=_0x2ed1e1['query'][_0xecf1('0x7b')]?0x1f4:_0x384fde[_0xecf1('0x7c')]||0x1f4;logger[_0xecf1('0x20')](_0xecf1('0x7d'),_0xecf1('0x7e'),_0x312704,JSON[_0xecf1('0x1f')](_0x384fde));delete _0x384fde[_0xecf1('0x30')];if(_0x312704===0x191){_0x312704=0x190;}_0x2d7213[_0xecf1('0x26')](_0x312704)[_0xecf1('0x31')](_0x2ed1e1['query'][_0xecf1('0x7b')]?{'message':_0xecf1('0x7f'),'statusCode':_0x384fde['statusCode']}:_0x384fde);});}else{var _0x386e04=0x1f4;_0x2d7213[_0xecf1('0x26')](_0x386e04)[_0xecf1('0x31')]({'message':_0xecf1('0x7f'),'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 b93a8e1..dbbdd66 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 _0x89d8=['SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','bluebird','request-promise','../../components/integrations/configuration','exports','define'];(function(_0x23f42c,_0x890a7b){var _0x2e1fa5=function(_0x2e0c8a){while(--_0x2e0c8a){_0x23f42c['push'](_0x23f42c['shift']());}};_0x2e1fa5(++_0x890a7b);}(_0x89d8,0x12b));var _0x889d=function(_0x59f0ff,_0x2b9d67){_0x59f0ff=_0x59f0ff-0x0;var _0x28e782=_0x89d8[_0x59f0ff];return _0x28e782;};'use strict';var _=require(_0x889d('0x0'));var util=require('util');var logger=require(_0x889d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x889d('0x2'));var rp=require(_0x889d('0x3'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x889d('0x4'));module[_0x889d('0x5')]=function(_0x507a9b,_0x27d46b){return _0x507a9b[_0x889d('0x6')](_0x889d('0x7'),attributes,{'tableName':_0x889d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0327=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x34be87,_0x54afc3){var _0x411683=function(_0x2b5030){while(--_0x2b5030){_0x34be87['push'](_0x34be87['shift']());}};_0x411683(++_0x54afc3);}(_0x0327,0x1e7));var _0x7032=function(_0x114a2e,_0x430f9d){_0x114a2e=_0x114a2e-0x0;var _0x3aad57=_0x0327[_0x114a2e];return _0x3aad57;};'use strict';var _=require(_0x7032('0x0'));var util=require(_0x7032('0x1'));var logger=require(_0x7032('0x2'))(_0x7032('0x3'));var moment=require(_0x7032('0x4'));var BPromise=require(_0x7032('0x5'));var rp=require(_0x7032('0x6'));var attributes=require(_0x7032('0x7'));var integrations=require(_0x7032('0x8'));module[_0x7032('0x9')]=function(_0x248587,_0x492e66){return _0x248587[_0x7032('0xa')](_0x7032('0xb'),attributes,{'tableName':_0x7032('0xc'),'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 289f0fd..8af6ca9 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 _0x63e5=['findAll','options','raw','where','attributes','map','model','include','info','stringify','catch','ShowSugarcrmAccount','find','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetSugarcrmAccount','SugarcrmAccount'];(function(_0x44408d,_0x9bc95f){var _0x3bd7bf=function(_0x449863){while(--_0x449863){_0x44408d['push'](_0x44408d['shift']());}};_0x3bd7bf(++_0x9bc95f);}(_0x63e5,0xd3));var _0x563e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x63e5[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x563e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x563e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563e('0x2'))['db'];var utils=require(_0x563e('0x3'));var logger=require(_0x563e('0x4'))(_0x563e('0x5'));var config=require(_0x563e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x563e('0x7')][_0x563e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bfd3c,_0x5815ed,_0x60c6d){return new BPromise(function(_0xed22f,_0x235db9){return client[_0x563e('0x9')](_0x3bfd3c,_0x60c6d)[_0x563e('0xa')](function(_0x20f1b5){logger['info'](_0x563e('0xb'),_0x5815ed,_0x563e('0xc'));logger[_0x563e('0xd')](_0x563e('0xe'),_0x5815ed,_0x563e('0xc'),JSON['stringify'](_0x20f1b5));if(_0x20f1b5[_0x563e('0xf')]){if(_0x20f1b5[_0x563e('0xf')]['code']===0x1f4){logger[_0x563e('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x5815ed,_0x20f1b5[_0x563e('0xf')][_0x563e('0x10')]);return _0x235db9(_0x20f1b5['error']['message']);}logger[_0x563e('0xf')](_0x563e('0xb'),_0x5815ed,_0x20f1b5['error'][_0x563e('0x10')]);return _0xed22f(_0x20f1b5[_0x563e('0xf')][_0x563e('0x10')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5815ed,_0x563e('0xc'));_0xed22f(_0x20f1b5[_0x563e('0x11')][_0x563e('0x10')]);}})['catch'](function(_0xfd1812){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5815ed,_0xfd1812);_0x235db9(_0xfd1812);});});}exports[_0x563e('0x12')]=function(_0x262bef){var _0x313dfe=this;return new Promise(function(_0x43405b,_0x183530){return db[_0x563e('0x13')][_0x563e('0x14')]({'raw':_0x262bef[_0x563e('0x15')]?_0x262bef[_0x563e('0x15')][_0x563e('0x16')]===undefined?!![]:![]:!![],'where':_0x262bef['options']?_0x262bef[_0x563e('0x15')][_0x563e('0x17')]||null:null,'attributes':_0x262bef[_0x563e('0x15')]?_0x262bef[_0x563e('0x15')][_0x563e('0x18')]||null:null,'limit':_0x262bef['options']?_0x262bef[_0x563e('0x15')]['limit']||null:null,'include':_0x262bef[_0x563e('0x15')]?_0x262bef['options']['include']?_[_0x563e('0x19')](_0x262bef[_0x563e('0x15')]['include'],function(_0x3fa92a){return{'model':db[_0x3fa92a[_0x563e('0x1a')]],'as':_0x3fa92a['as'],'attributes':_0x3fa92a['attributes'],'include':_0x3fa92a['include']?_['map'](_0x3fa92a[_0x563e('0x1b')],function(_0x4f94e4){return{'model':db[_0x4f94e4[_0x563e('0x1a')]],'as':_0x4f94e4['as'],'attributes':_0x4f94e4[_0x563e('0x18')],'include':_0x4f94e4[_0x563e('0x1b')]?_[_0x563e('0x19')](_0x4f94e4['include'],function(_0x4fcb90){return{'model':db[_0x4fcb90[_0x563e('0x1a')]],'as':_0x4fcb90['as'],'attributes':_0x4fcb90['attributes']};}):[]};}):[]};}):[]:[]})[_0x563e('0xa')](function(_0x492ba7){logger[_0x563e('0x1c')](_0x563e('0x12'),_0x262bef);logger['debug'](_0x563e('0x12'),_0x262bef,JSON[_0x563e('0x1d')](_0x492ba7));_0x43405b(_0x492ba7);})[_0x563e('0x1e')](function(_0x3f05be){logger[_0x563e('0xf')]('GetSugarcrmAccount',_0x3f05be[_0x563e('0x10')],_0x262bef);_0x183530(_0x313dfe[_0x563e('0xf')](0x1f4,_0x3f05be['message']));});});};exports[_0x563e('0x1f')]=function(_0x2f3ba4){var _0x3d9c6b=this;return new Promise(function(_0x284f94,_0x1f7d63){return db[_0x563e('0x13')][_0x563e('0x20')]({'raw':_0x2f3ba4[_0x563e('0x15')]?_0x2f3ba4[_0x563e('0x15')][_0x563e('0x16')]===undefined?!![]:![]:!![],'where':_0x2f3ba4[_0x563e('0x15')]?_0x2f3ba4['options'][_0x563e('0x17')]||null:null,'attributes':_0x2f3ba4[_0x563e('0x15')]?_0x2f3ba4[_0x563e('0x15')][_0x563e('0x18')]||null:null,'include':_0x2f3ba4[_0x563e('0x15')]?_0x2f3ba4[_0x563e('0x15')][_0x563e('0x1b')]?_[_0x563e('0x19')](_0x2f3ba4[_0x563e('0x15')][_0x563e('0x1b')],function(_0x3b8bc6){return{'model':db[_0x3b8bc6[_0x563e('0x1a')]],'as':_0x3b8bc6['as'],'attributes':_0x3b8bc6[_0x563e('0x18')],'include':_0x3b8bc6[_0x563e('0x1b')]?_[_0x563e('0x19')](_0x3b8bc6[_0x563e('0x1b')],function(_0x4e1eb9){return{'model':db[_0x4e1eb9['model']],'as':_0x4e1eb9['as'],'attributes':_0x4e1eb9[_0x563e('0x18')],'include':_0x4e1eb9[_0x563e('0x1b')]?_[_0x563e('0x19')](_0x4e1eb9['include'],function(_0x369e46){return{'model':db[_0x369e46['model']],'as':_0x369e46['as'],'attributes':_0x369e46['attributes']};}):[]};}):[]};}):[]:[]})[_0x563e('0xa')](function(_0x5cf82e){logger[_0x563e('0x1c')]('ShowSugarcrmAccount',_0x2f3ba4);logger[_0x563e('0xd')]('ShowSugarcrmAccount',_0x2f3ba4,JSON[_0x563e('0x1d')](_0x5cf82e));_0x284f94(_0x5cf82e);})[_0x563e('0x1e')](function(_0x220411){logger['error'](_0x563e('0x1f'),_0x220411[_0x563e('0x10')],_0x2f3ba4);_0x1f7d63(_0x3d9c6b[_0x563e('0xf')](0x1f4,_0x220411[_0x563e('0x10')]));});});}; \ No newline at end of file +var _0x8852=['GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowSugarcrmAccount','SugarcrmAccount','find','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','info','catch'];(function(_0x413896,_0xb6ba58){var _0x1b04aa=function(_0x4aff09){while(--_0x4aff09){_0x413896['push'](_0x413896['shift']());}};_0x1b04aa(++_0xb6ba58);}(_0x8852,0x16e));var _0x2885=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x8852[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x2885('0x0'));var util=require(_0x2885('0x1'));var moment=require(_0x2885('0x2'));var BPromise=require('bluebird');var rs=require(_0x2885('0x3'));var fs=require('fs');var Redis=require(_0x2885('0x4'));var db=require(_0x2885('0x5'))['db'];var utils=require(_0x2885('0x6'));var logger=require(_0x2885('0x7'))(_0x2885('0x8'));var config=require('../../config/environment');var jayson=require(_0x2885('0x9'));var client=jayson['client'][_0x2885('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f441d,_0x32db9b,_0x12531e){return new BPromise(function(_0x141301,_0x165ce1){return client[_0x2885('0xb')](_0x5f441d,_0x12531e)['then'](function(_0x225d41){logger['info'](_0x2885('0xc'),_0x32db9b,_0x2885('0xd'));logger['debug'](_0x2885('0xe'),_0x32db9b,_0x2885('0xd'),JSON['stringify'](_0x225d41));if(_0x225d41[_0x2885('0xf')]){if(_0x225d41[_0x2885('0xf')]['code']===0x1f4){logger[_0x2885('0xf')](_0x2885('0xc'),_0x32db9b,_0x225d41['error'][_0x2885('0x10')]);return _0x165ce1(_0x225d41[_0x2885('0xf')][_0x2885('0x10')]);}logger[_0x2885('0xf')](_0x2885('0xc'),_0x32db9b,_0x225d41[_0x2885('0xf')]['message']);return _0x141301(_0x225d41[_0x2885('0xf')][_0x2885('0x10')]);}else{logger[_0x2885('0x11')](_0x2885('0xc'),_0x32db9b,_0x2885('0xd'));_0x141301(_0x225d41['result'][_0x2885('0x10')]);}})[_0x2885('0x12')](function(_0x11e0a8){logger['error'](_0x2885('0xc'),_0x32db9b,_0x11e0a8);_0x165ce1(_0x11e0a8);});});}exports[_0x2885('0x13')]=function(_0x22c519){var _0x589638=this;return new Promise(function(_0xa85824,_0x3a862c){return db['SugarcrmAccount'][_0x2885('0x14')]({'raw':_0x22c519['options']?_0x22c519[_0x2885('0x15')][_0x2885('0x16')]===undefined?!![]:![]:!![],'where':_0x22c519[_0x2885('0x15')]?_0x22c519[_0x2885('0x15')][_0x2885('0x17')]||null:null,'attributes':_0x22c519['options']?_0x22c519[_0x2885('0x15')][_0x2885('0x18')]||null:null,'limit':_0x22c519['options']?_0x22c519[_0x2885('0x15')][_0x2885('0x19')]||null:null,'include':_0x22c519['options']?_0x22c519[_0x2885('0x15')][_0x2885('0x1a')]?_['map'](_0x22c519[_0x2885('0x15')][_0x2885('0x1a')],function(_0x206969){return{'model':db[_0x206969['model']],'as':_0x206969['as'],'attributes':_0x206969['attributes'],'include':_0x206969[_0x2885('0x1a')]?_[_0x2885('0x1b')](_0x206969[_0x2885('0x1a')],function(_0x2cd291){return{'model':db[_0x2cd291[_0x2885('0x1c')]],'as':_0x2cd291['as'],'attributes':_0x2cd291[_0x2885('0x18')],'include':_0x2cd291[_0x2885('0x1a')]?_[_0x2885('0x1b')](_0x2cd291[_0x2885('0x1a')],function(_0xa41c83){return{'model':db[_0xa41c83[_0x2885('0x1c')]],'as':_0xa41c83['as'],'attributes':_0xa41c83[_0x2885('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3eb92e){logger[_0x2885('0x11')](_0x2885('0x13'),_0x22c519);logger[_0x2885('0x1d')](_0x2885('0x13'),_0x22c519,JSON[_0x2885('0x1e')](_0x3eb92e));_0xa85824(_0x3eb92e);})[_0x2885('0x12')](function(_0x51d90b){logger[_0x2885('0xf')](_0x2885('0x13'),_0x51d90b[_0x2885('0x10')],_0x22c519);_0x3a862c(_0x589638[_0x2885('0xf')](0x1f4,_0x51d90b[_0x2885('0x10')]));});});};exports[_0x2885('0x1f')]=function(_0x43ad30){var _0x555042=this;return new Promise(function(_0x1b5001,_0x7a6e3c){return db[_0x2885('0x20')][_0x2885('0x21')]({'raw':_0x43ad30[_0x2885('0x15')]?_0x43ad30[_0x2885('0x15')][_0x2885('0x16')]===undefined?!![]:![]:!![],'where':_0x43ad30[_0x2885('0x15')]?_0x43ad30[_0x2885('0x15')]['where']||null:null,'attributes':_0x43ad30[_0x2885('0x15')]?_0x43ad30[_0x2885('0x15')][_0x2885('0x18')]||null:null,'include':_0x43ad30[_0x2885('0x15')]?_0x43ad30['options'][_0x2885('0x1a')]?_['map'](_0x43ad30[_0x2885('0x15')][_0x2885('0x1a')],function(_0xdb62ee){return{'model':db[_0xdb62ee['model']],'as':_0xdb62ee['as'],'attributes':_0xdb62ee[_0x2885('0x18')],'include':_0xdb62ee[_0x2885('0x1a')]?_['map'](_0xdb62ee[_0x2885('0x1a')],function(_0xeb9b99){return{'model':db[_0xeb9b99[_0x2885('0x1c')]],'as':_0xeb9b99['as'],'attributes':_0xeb9b99[_0x2885('0x18')],'include':_0xeb9b99[_0x2885('0x1a')]?_['map'](_0xeb9b99[_0x2885('0x1a')],function(_0x3f527c){return{'model':db[_0x3f527c[_0x2885('0x1c')]],'as':_0x3f527c['as'],'attributes':_0x3f527c[_0x2885('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2885('0x22')](function(_0x21ff7a){logger[_0x2885('0x11')](_0x2885('0x1f'),_0x43ad30);logger[_0x2885('0x1d')](_0x2885('0x1f'),_0x43ad30,JSON['stringify'](_0x21ff7a));_0x1b5001(_0x21ff7a);})[_0x2885('0x12')](function(_0x50557a){logger[_0x2885('0xf')](_0x2885('0x1f'),_0x50557a['message'],_0x43ad30);_0x7a6e3c(_0x555042['error'](0x1f4,_0x50557a[_0x2885('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 3da9bcb..795f65a 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 _0x9038=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','show','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id','delete'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x9038,0x1b9));var _0x8903=function(_0x273071,_0x3470a7){_0x273071=_0x273071-0x0;var _0x2bf84e=_0x9038[_0x273071];return _0x2bf84e;};'use strict';var multer=require(_0x8903('0x0'));var util=require(_0x8903('0x1'));var path=require(_0x8903('0x2'));var timeout=require(_0x8903('0x3'));var express=require(_0x8903('0x4'));var router=express[_0x8903('0x5')]();var auth=require(_0x8903('0x6'));var interaction=require(_0x8903('0x7'));var config=require('../../config/environment');var controller=require(_0x8903('0x8'));router[_0x8903('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8903('0x9')]('/:id',auth[_0x8903('0xa')](),controller[_0x8903('0xb')]);router[_0x8903('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x8903('0x9')](_0x8903('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x8903('0xd'),auth[_0x8903('0xa')](),controller[_0x8903('0xe')]);router[_0x8903('0xf')]('/',auth['isAuthenticated'](),controller[_0x8903('0x10')]);router['put'](_0x8903('0x11'),auth[_0x8903('0xa')](),controller['update']);router[_0x8903('0x12')](_0x8903('0x11'),auth[_0x8903('0xa')](),controller[_0x8903('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0422=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x6415a4,_0x574dfb){var _0x40ceed=function(_0x5b057a){while(--_0x5b057a){_0x6415a4['push'](_0x6415a4['shift']());}};_0x40ceed(++_0x574dfb);}(_0x0422,0x1b3));var _0x2042=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0x0422[_0x187d80];return _0x498a77;};'use strict';var multer=require(_0x2042('0x0'));var util=require(_0x2042('0x1'));var path=require(_0x2042('0x2'));var timeout=require(_0x2042('0x3'));var express=require(_0x2042('0x4'));var router=express[_0x2042('0x5')]();var auth=require(_0x2042('0x6'));var interaction=require(_0x2042('0x7'));var config=require(_0x2042('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x2042('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2042('0xa'),auth[_0x2042('0xb')](),controller[_0x2042('0xc')]);router[_0x2042('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2042('0xd')]);router['get'](_0x2042('0xe'),auth[_0x2042('0xb')](),controller[_0x2042('0xf')]);router[_0x2042('0x9')](_0x2042('0x10'),auth[_0x2042('0xb')](),controller[_0x2042('0x11')]);router[_0x2042('0x12')]('/',auth['isAuthenticated'](),controller[_0x2042('0x13')]);router[_0x2042('0x14')](_0x2042('0xa'),auth[_0x2042('0xb')](),controller['update']);router[_0x2042('0x15')](_0x2042('0xa'),auth[_0x2042('0xb')](),controller[_0x2042('0x16')]);module[_0x2042('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 77b5515..bd975c0 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 _0x8829=['sequelize','exports','STRING'];(function(_0x1af000,_0x1ba0cc){var _0x57d555=function(_0xf4cd21){while(--_0xf4cd21){_0x1af000['push'](_0x1af000['shift']());}};_0x57d555(++_0x1ba0cc);}(_0x8829,0x1c2));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9882('0x0'));module[_0x9882('0x1')]={'name':{'type':Sequelize[_0x9882('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeac5=['exports'];(function(_0x42cca0,_0x593120){var _0x588fba=function(_0x100868){while(--_0x100868){_0x42cca0['push'](_0x42cca0['shift']());}};_0x588fba(++_0x593120);}(_0xeac5,0x1c1));var _0x5eac=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xeac5[_0x2ec2bf];return _0x2c279c;};'use strict';var Sequelize=require('sequelize');module[_0x5eac('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 3aab0aa..f49f8d6 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 _0x0fe9=['sort','where','filters','filter','merge','type','key','VIRTUAL','field','count','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','getFields','SugarcrmField','pick','map','hasOwnProperty','getSubjects','getDescriptions','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','SugarcrmConfiguration','rawAttributes','model','query','keys','intersection','attributes','fields','length','nolimit','order'];(function(_0x47b104,_0x3a9a73){var _0x52fced=function(_0x41d3f1){while(--_0x41d3f1){_0x47b104['push'](_0x47b104['shift']());}};_0x52fced(++_0x3a9a73);}(_0x0fe9,0xd1));var _0x90fe=function(_0x95f7dc,_0x55cd98){_0x95f7dc=_0x95f7dc-0x0;var _0x2bca10=_0x0fe9[_0x95f7dc];return _0x2bca10;};'use strict';var pdf=require(_0x90fe('0x0'));var emlformat=require(_0x90fe('0x1'));var rimraf=require(_0x90fe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90fe('0x3'));var rp=require(_0x90fe('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x90fe('0x5'));var path=require(_0x90fe('0x6'));var sox=require(_0x90fe('0x7'));var csv=require(_0x90fe('0x8'));var ejs=require(_0x90fe('0x9'));var fs=require('fs');var _=require(_0x90fe('0xa'));var squel=require('squel');var crypto=require(_0x90fe('0xb'));var jsforce=require(_0x90fe('0xc'));var deskjs=require(_0x90fe('0xd'));var toCsv=require(_0x90fe('0x8'));var querystring=require(_0x90fe('0xe'));var Papa=require(_0x90fe('0xf'));var authService=require(_0x90fe('0x10'));var hardwareService=require(_0x90fe('0x11'));var Redis=require(_0x90fe('0x12'));var qs=require(_0x90fe('0x13'));var logger=require(_0x90fe('0x14'))(_0x90fe('0x15'));var utils=require(_0x90fe('0x16'));var config=require('../../config/environment');var db=require(_0x90fe('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x90fe('0x18')][_0x90fe('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4236d8,_0x3e5cce,_0x3cde33,_0x5b13e5){return new BPromise(function(_0x1f9c79,_0x5e48bb){var _0x5185fb=_0x5b13e5||client;return _0x5185fb['request'](_0x4236d8,_0x3cde33)[_0x90fe('0x1a')](function(_0x16b965){logger['info'](_0x90fe('0x1b'),_0x3e5cce,_0x90fe('0x1c'));logger[_0x90fe('0x1d')](_0x90fe('0x1e'),_0x3e5cce,'request\x20sent',JSON[_0x90fe('0x1f')](_0x16b965));if(_0x16b965[_0x90fe('0x20')]){if(_0x16b965[_0x90fe('0x20')]['code']===0x1f4){logger[_0x90fe('0x20')](_0x90fe('0x1b'),_0x3e5cce,_0x16b965['error']['message']);return _0x5e48bb(_0x16b965[_0x90fe('0x20')][_0x90fe('0x21')]);}logger['error'](_0x90fe('0x1b'),_0x3e5cce,_0x16b965[_0x90fe('0x20')][_0x90fe('0x21')]);return _0x1f9c79(_0x16b965['error'][_0x90fe('0x21')]);}else{logger['info'](_0x90fe('0x1b'),_0x3e5cce,'request\x20sent');_0x1f9c79(_0x16b965[_0x90fe('0x22')][_0x90fe('0x21')]);}})['catch'](function(_0x29b9af){logger['error'](_0x90fe('0x1b'),_0x3e5cce,_0x29b9af);_0x5e48bb(_0x29b9af);});});}function respondWithStatusCode(_0x1b8501,_0x3249bb){_0x3249bb=_0x3249bb||0xcc;return function(_0x9e51a6){if(_0x9e51a6){return _0x1b8501['sendStatus'](_0x3249bb);}return _0x1b8501[_0x90fe('0x23')](_0x3249bb)[_0x90fe('0x24')]();};}function respondWithResult(_0x372791,_0x378ae7){_0x378ae7=_0x378ae7||0xc8;return function(_0x2247a3){if(_0x2247a3){return _0x372791[_0x90fe('0x23')](_0x378ae7)[_0x90fe('0x25')](_0x2247a3);}};}function respondWithFilteredResult(_0x5c4fd2,_0x50db93){return function(_0x543653){if(_0x543653){var _0xfe094e=_0x543653['count'],_0x4d6001=_0x50db93[_0x90fe('0x26')],_0x3815f8=_0x50db93['offset']+_0x50db93[_0x90fe('0x27')],_0x26a022;if(_0x3815f8>=_0xfe094e){_0x3815f8=_0xfe094e;_0x26a022=0xc8;}else{_0x26a022=0xce;}_0x5c4fd2[_0x90fe('0x23')](_0x26a022);return _0x5c4fd2[_0x90fe('0x28')](_0x90fe('0x29'),_0x4d6001+'-'+_0x3815f8+'/'+_0xfe094e)[_0x90fe('0x25')](_0x543653);}return null;};}function patchUpdates(_0x3c7999){return function(_0x2749b9){try{jsonpatch[_0x90fe('0x2a')](_0x2749b9,_0x3c7999,!![]);}catch(_0x32d0de){return BPromise[_0x90fe('0x2b')](_0x32d0de);}return _0x2749b9[_0x90fe('0x2c')]();};}function saveUpdates(_0x12f883,_0x3f0337){return function(_0x1812d3){if(_0x1812d3){return _0x1812d3[_0x90fe('0x2d')](_0x12f883)[_0x90fe('0x1a')](function(_0x4c1738){return _0x4c1738;});}return null;};}function removeEntity(_0x5f1bc5,_0x5c540d){return function(_0x59c001){if(_0x59c001){return _0x59c001[_0x90fe('0x2e')]()[_0x90fe('0x1a')](function(){_0x5f1bc5[_0x90fe('0x23')](0xcc)[_0x90fe('0x24')]();});}};}function handleEntityNotFound(_0x3c7aee,_0x222ecb){return function(_0x2093a8){if(!_0x2093a8){_0x3c7aee[_0x90fe('0x2f')](0x194);}return _0x2093a8;};}function handleError(_0x19ef3b,_0x3bbb64){_0x3bbb64=_0x3bbb64||0x1f4;return function(_0x13d1d8){logger['error'](_0x13d1d8['stack']);if(_0x13d1d8[_0x90fe('0x30')]){delete _0x13d1d8[_0x90fe('0x30')];}_0x19ef3b['status'](_0x3bbb64)[_0x90fe('0x31')](_0x13d1d8);};}exports['index']=function(_0x31cded,_0x2f7223){var _0x6899df={},_0x4c3c77={},_0x4fcf7b={'count':0x0,'rows':[]};var _0x24c490=db[_0x90fe('0x32')][_0x90fe('0x33')];_0x4c3c77[_0x90fe('0x34')]=_['keys'](_0x24c490);_0x4c3c77[_0x90fe('0x35')]=_[_0x90fe('0x36')](_0x31cded[_0x90fe('0x35')]);_0x4c3c77['filters']=_[_0x90fe('0x37')](_0x4c3c77['model'],_0x4c3c77[_0x90fe('0x35')]);_0x6899df[_0x90fe('0x38')]=_[_0x90fe('0x37')](_0x4c3c77[_0x90fe('0x34')],qs[_0x90fe('0x39')](_0x31cded[_0x90fe('0x35')][_0x90fe('0x39')]));_0x6899df[_0x90fe('0x38')]=_0x6899df['attributes'][_0x90fe('0x3a')]?_0x6899df[_0x90fe('0x38')]:_0x4c3c77[_0x90fe('0x34')];if(!_0x31cded['query']['hasOwnProperty'](_0x90fe('0x3b'))){_0x6899df[_0x90fe('0x27')]=qs[_0x90fe('0x27')](_0x31cded[_0x90fe('0x35')]['limit']);_0x6899df[_0x90fe('0x26')]=qs['offset'](_0x31cded[_0x90fe('0x35')][_0x90fe('0x26')]);}_0x6899df[_0x90fe('0x3c')]=qs[_0x90fe('0x3d')](_0x31cded[_0x90fe('0x35')][_0x90fe('0x3d')]);_0x6899df[_0x90fe('0x3e')]=qs[_0x90fe('0x3f')](_['pick'](_0x31cded[_0x90fe('0x35')],_0x4c3c77[_0x90fe('0x3f')]));if(_0x31cded['query'][_0x90fe('0x40')]){_0x6899df[_0x90fe('0x3e')]=_[_0x90fe('0x41')](_0x6899df['where'],{'$or':_['map'](_0x24c490,function(_0x4423b0){if(_0x4423b0[_0x90fe('0x42')][_0x90fe('0x43')]!==_0x90fe('0x44')){var _0x2a0dcf={};_0x2a0dcf[_0x4423b0[_0x90fe('0x45')]]={'$like':'%'+_0x31cded[_0x90fe('0x35')][_0x90fe('0x40')]+'%'};return _0x2a0dcf;}})});}_0x6899df=_['merge']({},_0x6899df,_0x31cded['options']);var _0x1f3a8b={'where':_0x6899df[_0x90fe('0x3e')]};return db['SugarcrmConfiguration'][_0x90fe('0x46')](_0x1f3a8b)[_0x90fe('0x1a')](function(_0xd66d06){_0x4fcf7b[_0x90fe('0x46')]=_0xd66d06;if(_0x31cded['query'][_0x90fe('0x47')]){_0x6899df[_0x90fe('0x48')]=[{'all':!![]}];}return db[_0x90fe('0x32')][_0x90fe('0x49')](_0x6899df);})[_0x90fe('0x1a')](function(_0x277e5a){_0x4fcf7b[_0x90fe('0x4a')]=_0x277e5a;return _0x4fcf7b;})['then'](respondWithFilteredResult(_0x2f7223,_0x6899df))[_0x90fe('0x4b')](handleError(_0x2f7223,null));};exports[_0x90fe('0x4c')]=function(_0xbe9d17,_0x1a5047){var _0x1083cf={'raw':![],'where':{'id':_0xbe9d17[_0x90fe('0x4d')]['id']}},_0x56aaba={};_0x56aaba['model']=_['keys'](db[_0x90fe('0x32')]['rawAttributes']);_0x56aaba[_0x90fe('0x35')]=_[_0x90fe('0x36')](_0xbe9d17[_0x90fe('0x35')]);_0x56aaba[_0x90fe('0x3f')]=_[_0x90fe('0x37')](_0x56aaba[_0x90fe('0x34')],_0x56aaba[_0x90fe('0x35')]);_0x1083cf[_0x90fe('0x38')]=_['intersection'](_0x56aaba[_0x90fe('0x34')],qs['fields'](_0xbe9d17['query'][_0x90fe('0x39')]));_0x1083cf[_0x90fe('0x38')]=_0x1083cf[_0x90fe('0x38')][_0x90fe('0x3a')]?_0x1083cf[_0x90fe('0x38')]:_0x56aaba['model'];if(_0xbe9d17[_0x90fe('0x35')]['includeAll']){_0x1083cf['include']=[{'all':!![]}];}_0x1083cf=_['merge']({},_0x1083cf,_0xbe9d17[_0x90fe('0x4e')]);return db[_0x90fe('0x32')]['find'](_0x1083cf)[_0x90fe('0x1a')](handleEntityNotFound(_0x1a5047,null))[_0x90fe('0x1a')](respondWithResult(_0x1a5047,null))[_0x90fe('0x4b')](handleError(_0x1a5047,null));};exports[_0x90fe('0x4f')]=function(_0x29fb46,_0x42695a){return db[_0x90fe('0x32')]['create'](_0x29fb46[_0x90fe('0x50')],{})[_0x90fe('0x1a')](respondWithResult(_0x42695a,0xc9))['catch'](handleError(_0x42695a,null));};exports['update']=function(_0x179c70,_0x2712eb){if(_0x179c70[_0x90fe('0x50')]['id']){delete _0x179c70[_0x90fe('0x50')]['id'];}return db[_0x90fe('0x32')]['find']({'where':{'id':_0x179c70[_0x90fe('0x4d')]['id']}})[_0x90fe('0x1a')](handleEntityNotFound(_0x2712eb,null))[_0x90fe('0x1a')](saveUpdates(_0x179c70[_0x90fe('0x50')],null))[_0x90fe('0x1a')](respondWithResult(_0x2712eb,null))[_0x90fe('0x4b')](handleError(_0x2712eb,null));};exports[_0x90fe('0x2e')]=function(_0x3b1813,_0x264779){return db[_0x90fe('0x32')][_0x90fe('0x51')]({'where':{'id':_0x3b1813['params']['id']}})[_0x90fe('0x1a')](handleEntityNotFound(_0x264779,null))[_0x90fe('0x1a')](removeEntity(_0x264779,null))[_0x90fe('0x4b')](handleError(_0x264779,null));};exports[_0x90fe('0x52')]=function(_0x562d18,_0x375e6d,_0x4dd7dc){var _0x46be03={};var _0xfb1ec8={};var _0x2534d6;var _0x2145e5;return db[_0x90fe('0x32')]['findOne']({'where':{'id':_0x562d18[_0x90fe('0x4d')]['id']}})['then'](handleEntityNotFound(_0x375e6d,null))['then'](function(_0x2fd1de){if(_0x2fd1de){_0x2534d6=_0x2fd1de;_0xfb1ec8[_0x90fe('0x34')]=_[_0x90fe('0x36')](db[_0x90fe('0x53')][_0x90fe('0x33')]);_0xfb1ec8['query']=_[_0x90fe('0x36')](_0x562d18['query']);_0xfb1ec8['filters']=_[_0x90fe('0x37')](_0xfb1ec8['model'],_0xfb1ec8[_0x90fe('0x35')]);_0x46be03[_0x90fe('0x38')]=_[_0x90fe('0x37')](_0xfb1ec8[_0x90fe('0x34')],qs['fields'](_0x562d18[_0x90fe('0x35')]['fields']));_0x46be03[_0x90fe('0x38')]=_0x46be03[_0x90fe('0x38')]['length']?_0x46be03[_0x90fe('0x38')]:_0xfb1ec8[_0x90fe('0x34')];_0x46be03[_0x90fe('0x3c')]=qs[_0x90fe('0x3d')](_0x562d18[_0x90fe('0x35')][_0x90fe('0x3d')]);_0x46be03[_0x90fe('0x3e')]=qs[_0x90fe('0x3f')](_[_0x90fe('0x54')](_0x562d18[_0x90fe('0x35')],_0xfb1ec8[_0x90fe('0x3f')]));if(_0x562d18[_0x90fe('0x35')]['filter']){_0x46be03[_0x90fe('0x3e')]=_[_0x90fe('0x41')](_0x46be03[_0x90fe('0x3e')],{'$or':_[_0x90fe('0x55')](_0x46be03[_0x90fe('0x38')],function(_0x4042ad){var _0x178121={};_0x178121[_0x4042ad]={'$like':'%'+_0x562d18['query'][_0x90fe('0x40')]+'%'};return _0x178121;})});}_0x46be03=_[_0x90fe('0x41')]({},_0x46be03,_0x562d18[_0x90fe('0x4e')]);return _0x2534d6['getFields'](_0x46be03);}})[_0x90fe('0x1a')](function(_0x5160f8){if(_0x5160f8){_0x2145e5=_0x5160f8['length'];if(!_0x562d18['query'][_0x90fe('0x56')]('nolimit')){_0x46be03[_0x90fe('0x27')]=qs['limit'](_0x562d18['query'][_0x90fe('0x27')]);_0x46be03['offset']=qs[_0x90fe('0x26')](_0x562d18['query'][_0x90fe('0x26')]);}return _0x2534d6[_0x90fe('0x52')](_0x46be03);}})[_0x90fe('0x1a')](function(_0x1a619c){if(_0x1a619c){return _0x1a619c?{'count':_0x2145e5,'rows':_0x1a619c}:null;}})[_0x90fe('0x1a')](respondWithResult(_0x375e6d,null))[_0x90fe('0x4b')](handleError(_0x375e6d,null));};exports[_0x90fe('0x57')]=function(_0x4ffd5e,_0x1aacae,_0x51e8de){var _0x436bef={};var _0x198a0e={};var _0x3395b7;var _0x31759e;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x4ffd5e['params']['id']}})[_0x90fe('0x1a')](handleEntityNotFound(_0x1aacae,null))[_0x90fe('0x1a')](function(_0x570bd8){if(_0x570bd8){_0x3395b7=_0x570bd8;_0x198a0e[_0x90fe('0x34')]=_[_0x90fe('0x36')](db[_0x90fe('0x53')][_0x90fe('0x33')]);_0x198a0e[_0x90fe('0x35')]=_[_0x90fe('0x36')](_0x4ffd5e[_0x90fe('0x35')]);_0x198a0e[_0x90fe('0x3f')]=_[_0x90fe('0x37')](_0x198a0e[_0x90fe('0x34')],_0x198a0e[_0x90fe('0x35')]);_0x436bef[_0x90fe('0x38')]=_[_0x90fe('0x37')](_0x198a0e[_0x90fe('0x34')],qs['fields'](_0x4ffd5e[_0x90fe('0x35')][_0x90fe('0x39')]));_0x436bef[_0x90fe('0x38')]=_0x436bef[_0x90fe('0x38')][_0x90fe('0x3a')]?_0x436bef[_0x90fe('0x38')]:_0x198a0e['model'];_0x436bef[_0x90fe('0x3c')]=qs['sort'](_0x4ffd5e[_0x90fe('0x35')][_0x90fe('0x3d')]);_0x436bef[_0x90fe('0x3e')]=qs[_0x90fe('0x3f')](_[_0x90fe('0x54')](_0x4ffd5e[_0x90fe('0x35')],_0x198a0e[_0x90fe('0x3f')]));if(_0x4ffd5e[_0x90fe('0x35')][_0x90fe('0x40')]){_0x436bef[_0x90fe('0x3e')]=_[_0x90fe('0x41')](_0x436bef[_0x90fe('0x3e')],{'$or':_[_0x90fe('0x55')](_0x436bef['attributes'],function(_0x41712a){var _0x39b23a={};_0x39b23a[_0x41712a]={'$like':'%'+_0x4ffd5e[_0x90fe('0x35')][_0x90fe('0x40')]+'%'};return _0x39b23a;})});}_0x436bef=_['merge']({},_0x436bef,_0x4ffd5e[_0x90fe('0x4e')]);return _0x3395b7['getSubjects'](_0x436bef);}})[_0x90fe('0x1a')](function(_0x208623){if(_0x208623){_0x31759e=_0x208623['length'];if(!_0x4ffd5e['query'][_0x90fe('0x56')](_0x90fe('0x3b'))){_0x436bef[_0x90fe('0x27')]=qs[_0x90fe('0x27')](_0x4ffd5e[_0x90fe('0x35')][_0x90fe('0x27')]);_0x436bef['offset']=qs[_0x90fe('0x26')](_0x4ffd5e[_0x90fe('0x35')][_0x90fe('0x26')]);}return _0x3395b7['getSubjects'](_0x436bef);}})['then'](function(_0x1b4e04){if(_0x1b4e04){return _0x1b4e04?{'count':_0x31759e,'rows':_0x1b4e04}:null;}})[_0x90fe('0x1a')](respondWithResult(_0x1aacae,null))[_0x90fe('0x4b')](handleError(_0x1aacae,null));};exports[_0x90fe('0x58')]=function(_0x5e70fd,_0x2549a7,_0x32bdde){var _0x3c5b65={};var _0x2890e6={};var _0x3d78ce;var _0x1c9c9d;return db[_0x90fe('0x32')][_0x90fe('0x59')]({'where':{'id':_0x5e70fd[_0x90fe('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2549a7,null))['then'](function(_0x45c0ca){if(_0x45c0ca){_0x3d78ce=_0x45c0ca;_0x2890e6[_0x90fe('0x34')]=_[_0x90fe('0x36')](db[_0x90fe('0x53')]['rawAttributes']);_0x2890e6['query']=_[_0x90fe('0x36')](_0x5e70fd[_0x90fe('0x35')]);_0x2890e6[_0x90fe('0x3f')]=_[_0x90fe('0x37')](_0x2890e6[_0x90fe('0x34')],_0x2890e6['query']);_0x3c5b65[_0x90fe('0x38')]=_['intersection'](_0x2890e6[_0x90fe('0x34')],qs[_0x90fe('0x39')](_0x5e70fd[_0x90fe('0x35')][_0x90fe('0x39')]));_0x3c5b65['attributes']=_0x3c5b65[_0x90fe('0x38')][_0x90fe('0x3a')]?_0x3c5b65[_0x90fe('0x38')]:_0x2890e6['model'];_0x3c5b65[_0x90fe('0x3c')]=qs[_0x90fe('0x3d')](_0x5e70fd[_0x90fe('0x35')][_0x90fe('0x3d')]);_0x3c5b65[_0x90fe('0x3e')]=qs[_0x90fe('0x3f')](_[_0x90fe('0x54')](_0x5e70fd[_0x90fe('0x35')],_0x2890e6['filters']));if(_0x5e70fd[_0x90fe('0x35')][_0x90fe('0x40')]){_0x3c5b65[_0x90fe('0x3e')]=_[_0x90fe('0x41')](_0x3c5b65['where'],{'$or':_[_0x90fe('0x55')](_0x3c5b65[_0x90fe('0x38')],function(_0x366590){var _0x58f209={};_0x58f209[_0x366590]={'$like':'%'+_0x5e70fd[_0x90fe('0x35')][_0x90fe('0x40')]+'%'};return _0x58f209;})});}_0x3c5b65=_[_0x90fe('0x41')]({},_0x3c5b65,_0x5e70fd['options']);return _0x3d78ce[_0x90fe('0x58')](_0x3c5b65);}})[_0x90fe('0x1a')](function(_0x402edf){if(_0x402edf){_0x1c9c9d=_0x402edf['length'];if(!_0x5e70fd[_0x90fe('0x35')]['hasOwnProperty'](_0x90fe('0x3b'))){_0x3c5b65[_0x90fe('0x27')]=qs[_0x90fe('0x27')](_0x5e70fd['query']['limit']);_0x3c5b65['offset']=qs[_0x90fe('0x26')](_0x5e70fd[_0x90fe('0x35')][_0x90fe('0x26')]);}return _0x3d78ce[_0x90fe('0x58')](_0x3c5b65);}})[_0x90fe('0x1a')](function(_0x340885){if(_0x340885){return _0x340885?{'count':_0x1c9c9d,'rows':_0x340885}:null;}})[_0x90fe('0x1a')](respondWithResult(_0x2549a7,null))['catch'](handleError(_0x2549a7,null));}; \ No newline at end of file +var _0x15d5=['SugarcrmConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','getFields','SugarcrmField','sort','getSubjects','findOne','nolimit','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','count','offset','limit','set','apply','save','destroy','end','stack','name','send','index'];(function(_0x59a0a5,_0x3ed09b){var _0xd6a124=function(_0x351c1c){while(--_0x351c1c){_0x59a0a5['push'](_0x59a0a5['shift']());}};_0xd6a124(++_0x3ed09b);}(_0x15d5,0x1e1));var _0x515d=function(_0x1547e1,_0x5d6b55){_0x1547e1=_0x1547e1-0x0;var _0x42c6e7=_0x15d5[_0x1547e1];return _0x42c6e7;};'use strict';var pdf=require(_0x515d('0x0'));var emlformat=require(_0x515d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x515d('0x2'));var jsonpatch=require(_0x515d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x515d('0x4'));var Mustache=require(_0x515d('0x5'));var util=require(_0x515d('0x6'));var path=require(_0x515d('0x7'));var sox=require(_0x515d('0x8'));var csv=require(_0x515d('0x9'));var ejs=require(_0x515d('0xa'));var fs=require('fs');var _=require(_0x515d('0xb'));var squel=require(_0x515d('0xc'));var crypto=require(_0x515d('0xd'));var jsforce=require(_0x515d('0xe'));var deskjs=require(_0x515d('0xf'));var toCsv=require(_0x515d('0x9'));var querystring=require(_0x515d('0x10'));var Papa=require(_0x515d('0x11'));var authService=require(_0x515d('0x12'));var hardwareService=require(_0x515d('0x13'));var Redis=require(_0x515d('0x14'));var qs=require(_0x515d('0x15'));var logger=require('../../config/logger')(_0x515d('0x16'));var utils=require(_0x515d('0x17'));var config=require(_0x515d('0x18'));var db=require(_0x515d('0x19'))['db'];var jayson=require(_0x515d('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54f5dd,_0x11bb33,_0x1609c1,_0xdb91d4){return new BPromise(function(_0x210f53,_0x4d79a5){var _0x4c94e7=_0xdb91d4||client;return _0x4c94e7[_0x515d('0x1b')](_0x54f5dd,_0x1609c1)[_0x515d('0x1c')](function(_0xb3c24a){logger[_0x515d('0x1d')](_0x515d('0x1e'),_0x11bb33,_0x515d('0x1f'));logger[_0x515d('0x20')](_0x515d('0x21'),_0x11bb33,_0x515d('0x1f'),JSON[_0x515d('0x22')](_0xb3c24a));if(_0xb3c24a[_0x515d('0x23')]){if(_0xb3c24a[_0x515d('0x23')]['code']===0x1f4){logger['error'](_0x515d('0x1e'),_0x11bb33,_0xb3c24a[_0x515d('0x23')]['message']);return _0x4d79a5(_0xb3c24a[_0x515d('0x23')][_0x515d('0x24')]);}logger['error'](_0x515d('0x1e'),_0x11bb33,_0xb3c24a['error'][_0x515d('0x24')]);return _0x210f53(_0xb3c24a[_0x515d('0x23')][_0x515d('0x24')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x11bb33,_0x515d('0x1f'));_0x210f53(_0xb3c24a['result'][_0x515d('0x24')]);}})[_0x515d('0x25')](function(_0x50f3bd){logger[_0x515d('0x23')](_0x515d('0x1e'),_0x11bb33,_0x50f3bd);_0x4d79a5(_0x50f3bd);});});}function respondWithStatusCode(_0x4be961,_0x3d45a9){_0x3d45a9=_0x3d45a9||0xcc;return function(_0x3fd6b1){if(_0x3fd6b1){return _0x4be961[_0x515d('0x26')](_0x3d45a9);}return _0x4be961[_0x515d('0x27')](_0x3d45a9)['end']();};}function respondWithResult(_0x1b01a7,_0x2512f7){_0x2512f7=_0x2512f7||0xc8;return function(_0x2aa513){if(_0x2aa513){return _0x1b01a7[_0x515d('0x27')](_0x2512f7)[_0x515d('0x28')](_0x2aa513);}};}function respondWithFilteredResult(_0x36a63c,_0x3ce0cf){return function(_0x95038b){if(_0x95038b){var _0x5c04f4=_0x95038b[_0x515d('0x29')],_0x2c7dcf=_0x3ce0cf[_0x515d('0x2a')],_0x3edd9d=_0x3ce0cf[_0x515d('0x2a')]+_0x3ce0cf[_0x515d('0x2b')],_0x35cc30;if(_0x3edd9d>=_0x5c04f4){_0x3edd9d=_0x5c04f4;_0x35cc30=0xc8;}else{_0x35cc30=0xce;}_0x36a63c['status'](_0x35cc30);return _0x36a63c[_0x515d('0x2c')]('Content-Range',_0x2c7dcf+'-'+_0x3edd9d+'/'+_0x5c04f4)[_0x515d('0x28')](_0x95038b);}return null;};}function patchUpdates(_0x2a0d91){return function(_0x556288){try{jsonpatch[_0x515d('0x2d')](_0x556288,_0x2a0d91,!![]);}catch(_0x542796){return BPromise['reject'](_0x542796);}return _0x556288[_0x515d('0x2e')]();};}function saveUpdates(_0x5557aa,_0x470d24){return function(_0x32404b){if(_0x32404b){return _0x32404b['update'](_0x5557aa)[_0x515d('0x1c')](function(_0x250622){return _0x250622;});}return null;};}function removeEntity(_0x566edf,_0x28f2fa){return function(_0x4cc9d6){if(_0x4cc9d6){return _0x4cc9d6[_0x515d('0x2f')]()[_0x515d('0x1c')](function(){_0x566edf[_0x515d('0x27')](0xcc)[_0x515d('0x30')]();});}};}function handleEntityNotFound(_0x1148a8,_0x3cdb99){return function(_0x70b5c){if(!_0x70b5c){_0x1148a8[_0x515d('0x26')](0x194);}return _0x70b5c;};}function handleError(_0x3395bb,_0x329688){_0x329688=_0x329688||0x1f4;return function(_0x4d694c){logger[_0x515d('0x23')](_0x4d694c[_0x515d('0x31')]);if(_0x4d694c[_0x515d('0x32')]){delete _0x4d694c[_0x515d('0x32')];}_0x3395bb[_0x515d('0x27')](_0x329688)[_0x515d('0x33')](_0x4d694c);};}exports[_0x515d('0x34')]=function(_0x136afa,_0x4556a1){var _0x257cc2={},_0x1ac9de={},_0x4b54e5={'count':0x0,'rows':[]};var _0x1aeba1=db[_0x515d('0x35')][_0x515d('0x36')];_0x1ac9de[_0x515d('0x37')]=_[_0x515d('0x38')](_0x1aeba1);_0x1ac9de[_0x515d('0x39')]=_['keys'](_0x136afa[_0x515d('0x39')]);_0x1ac9de[_0x515d('0x3a')]=_[_0x515d('0x3b')](_0x1ac9de['model'],_0x1ac9de['query']);_0x257cc2[_0x515d('0x3c')]=_[_0x515d('0x3b')](_0x1ac9de[_0x515d('0x37')],qs[_0x515d('0x3d')](_0x136afa[_0x515d('0x39')][_0x515d('0x3d')]));_0x257cc2[_0x515d('0x3c')]=_0x257cc2[_0x515d('0x3c')][_0x515d('0x3e')]?_0x257cc2[_0x515d('0x3c')]:_0x1ac9de['model'];if(!_0x136afa[_0x515d('0x39')][_0x515d('0x3f')]('nolimit')){_0x257cc2[_0x515d('0x2b')]=qs[_0x515d('0x2b')](_0x136afa['query'][_0x515d('0x2b')]);_0x257cc2['offset']=qs[_0x515d('0x2a')](_0x136afa['query'][_0x515d('0x2a')]);}_0x257cc2[_0x515d('0x40')]=qs['sort'](_0x136afa[_0x515d('0x39')]['sort']);_0x257cc2[_0x515d('0x41')]=qs[_0x515d('0x3a')](_[_0x515d('0x42')](_0x136afa[_0x515d('0x39')],_0x1ac9de[_0x515d('0x3a')]));if(_0x136afa[_0x515d('0x39')][_0x515d('0x43')]){_0x257cc2[_0x515d('0x41')]=_[_0x515d('0x44')](_0x257cc2['where'],{'$or':_[_0x515d('0x45')](_0x1aeba1,function(_0x1dba40){if(_0x1dba40[_0x515d('0x46')][_0x515d('0x47')]!==_0x515d('0x48')){var _0x2bc542={};_0x2bc542[_0x1dba40['field']]={'$like':'%'+_0x136afa['query'][_0x515d('0x43')]+'%'};return _0x2bc542;}})});}_0x257cc2=_[_0x515d('0x44')]({},_0x257cc2,_0x136afa[_0x515d('0x49')]);var _0x21ec01={'where':_0x257cc2['where']};return db[_0x515d('0x35')]['count'](_0x21ec01)[_0x515d('0x1c')](function(_0x40ab9f){_0x4b54e5[_0x515d('0x29')]=_0x40ab9f;if(_0x136afa[_0x515d('0x39')][_0x515d('0x4a')]){_0x257cc2[_0x515d('0x4b')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x515d('0x4c')](_0x257cc2);})[_0x515d('0x1c')](function(_0x2e872a){_0x4b54e5[_0x515d('0x4d')]=_0x2e872a;return _0x4b54e5;})[_0x515d('0x1c')](respondWithFilteredResult(_0x4556a1,_0x257cc2))['catch'](handleError(_0x4556a1,null));};exports['show']=function(_0x5ccb54,_0x161484){var _0x58dcd1={'raw':![],'where':{'id':_0x5ccb54[_0x515d('0x4e')]['id']}},_0x322515={};_0x322515[_0x515d('0x37')]=_[_0x515d('0x38')](db['SugarcrmConfiguration'][_0x515d('0x36')]);_0x322515[_0x515d('0x39')]=_[_0x515d('0x38')](_0x5ccb54[_0x515d('0x39')]);_0x322515[_0x515d('0x3a')]=_['intersection'](_0x322515[_0x515d('0x37')],_0x322515[_0x515d('0x39')]);_0x58dcd1['attributes']=_[_0x515d('0x3b')](_0x322515['model'],qs[_0x515d('0x3d')](_0x5ccb54[_0x515d('0x39')][_0x515d('0x3d')]));_0x58dcd1[_0x515d('0x3c')]=_0x58dcd1[_0x515d('0x3c')][_0x515d('0x3e')]?_0x58dcd1[_0x515d('0x3c')]:_0x322515['model'];if(_0x5ccb54['query']['includeAll']){_0x58dcd1[_0x515d('0x4b')]=[{'all':!![]}];}_0x58dcd1=_[_0x515d('0x44')]({},_0x58dcd1,_0x5ccb54[_0x515d('0x49')]);return db['SugarcrmConfiguration'][_0x515d('0x4f')](_0x58dcd1)[_0x515d('0x1c')](handleEntityNotFound(_0x161484,null))['then'](respondWithResult(_0x161484,null))[_0x515d('0x25')](handleError(_0x161484,null));};exports['create']=function(_0x4a80c9,_0x261842){return db['SugarcrmConfiguration'][_0x515d('0x50')](_0x4a80c9[_0x515d('0x51')],{})[_0x515d('0x1c')](respondWithResult(_0x261842,0xc9))['catch'](handleError(_0x261842,null));};exports['update']=function(_0x1fc9de,_0x289d58){if(_0x1fc9de[_0x515d('0x51')]['id']){delete _0x1fc9de[_0x515d('0x51')]['id'];}return db['SugarcrmConfiguration'][_0x515d('0x4f')]({'where':{'id':_0x1fc9de[_0x515d('0x4e')]['id']}})[_0x515d('0x1c')](handleEntityNotFound(_0x289d58,null))['then'](saveUpdates(_0x1fc9de[_0x515d('0x51')],null))['then'](respondWithResult(_0x289d58,null))['catch'](handleError(_0x289d58,null));};exports[_0x515d('0x2f')]=function(_0x3d9d70,_0x8e361){return db['SugarcrmConfiguration'][_0x515d('0x4f')]({'where':{'id':_0x3d9d70[_0x515d('0x4e')]['id']}})[_0x515d('0x1c')](handleEntityNotFound(_0x8e361,null))[_0x515d('0x1c')](removeEntity(_0x8e361,null))[_0x515d('0x25')](handleError(_0x8e361,null));};exports[_0x515d('0x52')]=function(_0x6cee8a,_0x34978c,_0x775e9){var _0x393ae5={};var _0x248c9e={};var _0x299b96;var _0x307b27;return db[_0x515d('0x35')]['findOne']({'where':{'id':_0x6cee8a[_0x515d('0x4e')]['id']}})[_0x515d('0x1c')](handleEntityNotFound(_0x34978c,null))[_0x515d('0x1c')](function(_0x36cfdc){if(_0x36cfdc){_0x299b96=_0x36cfdc;_0x248c9e[_0x515d('0x37')]=_['keys'](db[_0x515d('0x53')]['rawAttributes']);_0x248c9e[_0x515d('0x39')]=_[_0x515d('0x38')](_0x6cee8a['query']);_0x248c9e[_0x515d('0x3a')]=_['intersection'](_0x248c9e[_0x515d('0x37')],_0x248c9e[_0x515d('0x39')]);_0x393ae5['attributes']=_[_0x515d('0x3b')](_0x248c9e[_0x515d('0x37')],qs['fields'](_0x6cee8a[_0x515d('0x39')]['fields']));_0x393ae5['attributes']=_0x393ae5[_0x515d('0x3c')][_0x515d('0x3e')]?_0x393ae5['attributes']:_0x248c9e[_0x515d('0x37')];_0x393ae5[_0x515d('0x40')]=qs[_0x515d('0x54')](_0x6cee8a[_0x515d('0x39')][_0x515d('0x54')]);_0x393ae5[_0x515d('0x41')]=qs[_0x515d('0x3a')](_[_0x515d('0x42')](_0x6cee8a[_0x515d('0x39')],_0x248c9e[_0x515d('0x3a')]));if(_0x6cee8a[_0x515d('0x39')][_0x515d('0x43')]){_0x393ae5[_0x515d('0x41')]=_[_0x515d('0x44')](_0x393ae5[_0x515d('0x41')],{'$or':_[_0x515d('0x45')](_0x393ae5['attributes'],function(_0x1683cc){var _0x571ce2={};_0x571ce2[_0x1683cc]={'$like':'%'+_0x6cee8a['query'][_0x515d('0x43')]+'%'};return _0x571ce2;})});}_0x393ae5=_[_0x515d('0x44')]({},_0x393ae5,_0x6cee8a['options']);return _0x299b96[_0x515d('0x52')](_0x393ae5);}})['then'](function(_0x18c1ab){if(_0x18c1ab){_0x307b27=_0x18c1ab[_0x515d('0x3e')];if(!_0x6cee8a[_0x515d('0x39')][_0x515d('0x3f')]('nolimit')){_0x393ae5[_0x515d('0x2b')]=qs[_0x515d('0x2b')](_0x6cee8a[_0x515d('0x39')][_0x515d('0x2b')]);_0x393ae5[_0x515d('0x2a')]=qs[_0x515d('0x2a')](_0x6cee8a[_0x515d('0x39')][_0x515d('0x2a')]);}return _0x299b96['getFields'](_0x393ae5);}})[_0x515d('0x1c')](function(_0x566175){if(_0x566175){return _0x566175?{'count':_0x307b27,'rows':_0x566175}:null;}})[_0x515d('0x1c')](respondWithResult(_0x34978c,null))['catch'](handleError(_0x34978c,null));};exports[_0x515d('0x55')]=function(_0x554898,_0x32bfb3,_0x54adcf){var _0x58b672={};var _0x19ef26={};var _0x4a7571;var _0x2f6177;return db['SugarcrmConfiguration'][_0x515d('0x56')]({'where':{'id':_0x554898[_0x515d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x32bfb3,null))[_0x515d('0x1c')](function(_0x2dfcc1){if(_0x2dfcc1){_0x4a7571=_0x2dfcc1;_0x19ef26[_0x515d('0x37')]=_[_0x515d('0x38')](db['SugarcrmField'][_0x515d('0x36')]);_0x19ef26[_0x515d('0x39')]=_['keys'](_0x554898[_0x515d('0x39')]);_0x19ef26[_0x515d('0x3a')]=_[_0x515d('0x3b')](_0x19ef26[_0x515d('0x37')],_0x19ef26['query']);_0x58b672[_0x515d('0x3c')]=_[_0x515d('0x3b')](_0x19ef26[_0x515d('0x37')],qs[_0x515d('0x3d')](_0x554898['query'][_0x515d('0x3d')]));_0x58b672['attributes']=_0x58b672[_0x515d('0x3c')][_0x515d('0x3e')]?_0x58b672[_0x515d('0x3c')]:_0x19ef26[_0x515d('0x37')];_0x58b672[_0x515d('0x40')]=qs['sort'](_0x554898[_0x515d('0x39')][_0x515d('0x54')]);_0x58b672[_0x515d('0x41')]=qs['filters'](_[_0x515d('0x42')](_0x554898[_0x515d('0x39')],_0x19ef26[_0x515d('0x3a')]));if(_0x554898[_0x515d('0x39')][_0x515d('0x43')]){_0x58b672[_0x515d('0x41')]=_[_0x515d('0x44')](_0x58b672['where'],{'$or':_['map'](_0x58b672['attributes'],function(_0x4d2554){var _0x163107={};_0x163107[_0x4d2554]={'$like':'%'+_0x554898[_0x515d('0x39')][_0x515d('0x43')]+'%'};return _0x163107;})});}_0x58b672=_[_0x515d('0x44')]({},_0x58b672,_0x554898['options']);return _0x4a7571[_0x515d('0x55')](_0x58b672);}})[_0x515d('0x1c')](function(_0x59e1aa){if(_0x59e1aa){_0x2f6177=_0x59e1aa[_0x515d('0x3e')];if(!_0x554898[_0x515d('0x39')][_0x515d('0x3f')](_0x515d('0x57'))){_0x58b672[_0x515d('0x2b')]=qs['limit'](_0x554898[_0x515d('0x39')][_0x515d('0x2b')]);_0x58b672['offset']=qs['offset'](_0x554898[_0x515d('0x39')]['offset']);}return _0x4a7571['getSubjects'](_0x58b672);}})[_0x515d('0x1c')](function(_0x2e796b){if(_0x2e796b){return _0x2e796b?{'count':_0x2f6177,'rows':_0x2e796b}:null;}})[_0x515d('0x1c')](respondWithResult(_0x32bfb3,null))['catch'](handleError(_0x32bfb3,null));};exports[_0x515d('0x58')]=function(_0x54d330,_0x12ee62,_0x37a4c3){var _0x1122a9={};var _0x24bb92={};var _0x4ace7c;var _0x21df8d;return db[_0x515d('0x35')]['findOne']({'where':{'id':_0x54d330[_0x515d('0x4e')]['id']}})[_0x515d('0x1c')](handleEntityNotFound(_0x12ee62,null))[_0x515d('0x1c')](function(_0x595154){if(_0x595154){_0x4ace7c=_0x595154;_0x24bb92['model']=_[_0x515d('0x38')](db[_0x515d('0x53')]['rawAttributes']);_0x24bb92['query']=_[_0x515d('0x38')](_0x54d330[_0x515d('0x39')]);_0x24bb92[_0x515d('0x3a')]=_[_0x515d('0x3b')](_0x24bb92[_0x515d('0x37')],_0x24bb92[_0x515d('0x39')]);_0x1122a9['attributes']=_[_0x515d('0x3b')](_0x24bb92[_0x515d('0x37')],qs[_0x515d('0x3d')](_0x54d330[_0x515d('0x39')][_0x515d('0x3d')]));_0x1122a9[_0x515d('0x3c')]=_0x1122a9['attributes'][_0x515d('0x3e')]?_0x1122a9[_0x515d('0x3c')]:_0x24bb92[_0x515d('0x37')];_0x1122a9[_0x515d('0x40')]=qs['sort'](_0x54d330[_0x515d('0x39')][_0x515d('0x54')]);_0x1122a9[_0x515d('0x41')]=qs[_0x515d('0x3a')](_[_0x515d('0x42')](_0x54d330[_0x515d('0x39')],_0x24bb92['filters']));if(_0x54d330[_0x515d('0x39')]['filter']){_0x1122a9[_0x515d('0x41')]=_[_0x515d('0x44')](_0x1122a9[_0x515d('0x41')],{'$or':_[_0x515d('0x45')](_0x1122a9[_0x515d('0x3c')],function(_0xe40e36){var _0x1f96e7={};_0x1f96e7[_0xe40e36]={'$like':'%'+_0x54d330[_0x515d('0x39')][_0x515d('0x43')]+'%'};return _0x1f96e7;})});}_0x1122a9=_['merge']({},_0x1122a9,_0x54d330[_0x515d('0x49')]);return _0x4ace7c[_0x515d('0x58')](_0x1122a9);}})[_0x515d('0x1c')](function(_0x3425ce){if(_0x3425ce){_0x21df8d=_0x3425ce[_0x515d('0x3e')];if(!_0x54d330[_0x515d('0x39')][_0x515d('0x3f')](_0x515d('0x57'))){_0x1122a9[_0x515d('0x2b')]=qs['limit'](_0x54d330[_0x515d('0x39')]['limit']);_0x1122a9[_0x515d('0x2a')]=qs[_0x515d('0x2a')](_0x54d330['query'][_0x515d('0x2a')]);}return _0x4ace7c[_0x515d('0x58')](_0x1122a9);}})[_0x515d('0x1c')](function(_0x1675f8){if(_0x1675f8){return _0x1675f8?{'count':_0x21df8d,'rows':_0x1675f8}:null;}})[_0x515d('0x1c')](respondWithResult(_0x12ee62,null))[_0x515d('0x25')](handleError(_0x12ee62,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index e56d171..afb25a2 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 _0xa012=['api','moment','bluebird','request-promise','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa012,0x134));var _0x2a01=function(_0x4f8411,_0x358960){_0x4f8411=_0x4f8411-0x0;var _0xc75a44=_0xa012[_0x4f8411];return _0xc75a44;};'use strict';var _=require('lodash');var util=require(_0x2a01('0x0'));var logger=require(_0x2a01('0x1'))(_0x2a01('0x2'));var moment=require(_0x2a01('0x3'));var BPromise=require(_0x2a01('0x4'));var rp=require(_0x2a01('0x5'));var attributes=require(_0x2a01('0x6'));module[_0x2a01('0x7')]=function(_0xf3f71f,_0x1f2731){return _0xf3f71f['define'](_0x2a01('0x8'),attributes,{'tableName':_0x2a01('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc260=['SugarcrmConfiguration','util','../../config/logger','api','bluebird','request-promise','./intSugarcrmConfiguration.attributes','define'];(function(_0x251783,_0x5c681e){var _0x29fcc8=function(_0x542042){while(--_0x542042){_0x251783['push'](_0x251783['shift']());}};_0x29fcc8(++_0x5c681e);}(_0xc260,0x151));var _0x0c26=function(_0x130bee,_0xe59f08){_0x130bee=_0x130bee-0x0;var _0x413e04=_0xc260[_0x130bee];return _0x413e04;};'use strict';var _=require('lodash');var util=require(_0x0c26('0x0'));var logger=require(_0x0c26('0x1'))(_0x0c26('0x2'));var moment=require('moment');var BPromise=require(_0x0c26('0x3'));var rp=require(_0x0c26('0x4'));var attributes=require(_0x0c26('0x5'));module['exports']=function(_0x232152,_0x995644){return _0x232152[_0x0c26('0x6')](_0x0c26('0x7'),attributes,{'tableName':'int_sugarcrm_configurations','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 97020b7..4553b96 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 _0xf3f9=['request\x20sent','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x2bb2c0,_0x35b48d){var _0x101b46=function(_0xfb836){while(--_0xfb836){_0x2bb2c0['push'](_0x2bb2c0['shift']());}};_0x101b46(++_0x35b48d);}(_0xf3f9,0x132));var _0x9f3f=function(_0x276bdb,_0x38c3fc){_0x276bdb=_0x276bdb-0x0;var _0x435eb9=_0xf3f9[_0x276bdb];return _0x435eb9;};'use strict';var _=require('lodash');var util=require(_0x9f3f('0x0'));var moment=require(_0x9f3f('0x1'));var BPromise=require(_0x9f3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f3f('0x3'))['db'];var utils=require(_0x9f3f('0x4'));var logger=require(_0x9f3f('0x5'))(_0x9f3f('0x6'));var config=require(_0x9f3f('0x7'));var jayson=require(_0x9f3f('0x8'));var client=jayson[_0x9f3f('0x9')][_0x9f3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1aa19b,_0x5e137b,_0x5ba407){return new BPromise(function(_0x35e9c1,_0x387193){return client[_0x9f3f('0xb')](_0x1aa19b,_0x5ba407)['then'](function(_0x389274){logger[_0x9f3f('0xc')](_0x9f3f('0xd'),_0x5e137b,_0x9f3f('0xe'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x5e137b,'request\x20sent',JSON['stringify'](_0x389274));if(_0x389274['error']){if(_0x389274[_0x9f3f('0xf')][_0x9f3f('0x10')]===0x1f4){logger['error'](_0x9f3f('0xd'),_0x5e137b,_0x389274[_0x9f3f('0xf')][_0x9f3f('0x11')]);return _0x387193(_0x389274[_0x9f3f('0xf')][_0x9f3f('0x11')]);}logger['error'](_0x9f3f('0xd'),_0x5e137b,_0x389274['error'][_0x9f3f('0x11')]);return _0x35e9c1(_0x389274['error'][_0x9f3f('0x11')]);}else{logger[_0x9f3f('0xc')](_0x9f3f('0xd'),_0x5e137b,_0x9f3f('0xe'));_0x35e9c1(_0x389274[_0x9f3f('0x12')][_0x9f3f('0x11')]);}})[_0x9f3f('0x13')](function(_0x44406c){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5e137b,_0x44406c);_0x387193(_0x44406c);});});} \ No newline at end of file +var _0xbc13=['SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x44b005,_0x51199e){var _0x304f0b=function(_0x5a810e){while(--_0x5a810e){_0x44b005['push'](_0x44b005['shift']());}};_0x304f0b(++_0x51199e);}(_0xbc13,0xca));var _0x3bc1=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xbc13[_0x29e3b6];return _0x55d4b0;};'use strict';var _=require('lodash');var util=require(_0x3bc1('0x0'));var moment=require(_0x3bc1('0x1'));var BPromise=require(_0x3bc1('0x2'));var rs=require(_0x3bc1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bc1('0x4'))['db'];var utils=require(_0x3bc1('0x5'));var logger=require('../../config/logger')(_0x3bc1('0x6'));var config=require(_0x3bc1('0x7'));var jayson=require(_0x3bc1('0x8'));var client=jayson['client'][_0x3bc1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4df5f4,_0x2246e0,_0x48071a){return new BPromise(function(_0xc4601f,_0x43634d){return client['request'](_0x4df5f4,_0x48071a)[_0x3bc1('0xa')](function(_0x416df0){logger[_0x3bc1('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2246e0,_0x3bc1('0xc'));logger[_0x3bc1('0xd')](_0x3bc1('0xe'),_0x2246e0,_0x3bc1('0xc'),JSON[_0x3bc1('0xf')](_0x416df0));if(_0x416df0[_0x3bc1('0x10')]){if(_0x416df0[_0x3bc1('0x10')][_0x3bc1('0x11')]===0x1f4){logger['error'](_0x3bc1('0x12'),_0x2246e0,_0x416df0['error']['message']);return _0x43634d(_0x416df0[_0x3bc1('0x10')][_0x3bc1('0x13')]);}logger[_0x3bc1('0x10')](_0x3bc1('0x12'),_0x2246e0,_0x416df0[_0x3bc1('0x10')][_0x3bc1('0x13')]);return _0xc4601f(_0x416df0[_0x3bc1('0x10')][_0x3bc1('0x13')]);}else{logger[_0x3bc1('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2246e0,'request\x20sent');_0xc4601f(_0x416df0[_0x3bc1('0x14')]['message']);}})[_0x3bc1('0x15')](function(_0x5162d0){logger[_0x3bc1('0x10')](_0x3bc1('0x12'),_0x2246e0,_0x5162d0);_0x43634d(_0x5162d0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 860ad44..cfcbb02 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 _0xed94=['../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','Router'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xed94,0x1cc));var _0x4ed9=function(_0x369534,_0x5557c4){_0x369534=_0x369534-0x0;var _0x524bf9=_0xed94[_0x369534];return _0x524bf9;};'use strict';var multer=require(_0x4ed9('0x0'));var util=require(_0x4ed9('0x1'));var path=require('path');var timeout=require(_0x4ed9('0x2'));var express=require('express');var router=express[_0x4ed9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4ed9('0x4'));var config=require('../../config/environment');var controller=require(_0x4ed9('0x5'));router[_0x4ed9('0x6')]('/',auth[_0x4ed9('0x7')](),controller['index']);router[_0x4ed9('0x6')](_0x4ed9('0x8'),auth['isAuthenticated'](),controller[_0x4ed9('0x9')]);router[_0x4ed9('0xa')]('/',auth[_0x4ed9('0x7')](),controller[_0x4ed9('0xb')]);router[_0x4ed9('0xc')](_0x4ed9('0x8'),auth['isAuthenticated'](),controller[_0x4ed9('0xd')]);router[_0x4ed9('0xe')]('/:id',auth[_0x4ed9('0x7')](),controller[_0x4ed9('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7c59=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x1e2613,_0x42debb){var _0x5643d4=function(_0x3b6cbc){while(--_0x3b6cbc){_0x1e2613['push'](_0x1e2613['shift']());}};_0x5643d4(++_0x42debb);}(_0x7c59,0xb1));var _0x97c5=function(_0x5a1a2b,_0x24ce53){_0x5a1a2b=_0x5a1a2b-0x0;var _0xaea1cb=_0x7c59[_0x5a1a2b];return _0xaea1cb;};'use strict';var multer=require(_0x97c5('0x0'));var util=require(_0x97c5('0x1'));var path=require(_0x97c5('0x2'));var timeout=require('connect-timeout');var express=require(_0x97c5('0x3'));var router=express[_0x97c5('0x4')]();var auth=require(_0x97c5('0x5'));var interaction=require(_0x97c5('0x6'));var config=require(_0x97c5('0x7'));var controller=require(_0x97c5('0x8'));router[_0x97c5('0x9')]('/',auth['isAuthenticated'](),controller[_0x97c5('0xa')]);router[_0x97c5('0x9')](_0x97c5('0xb'),auth[_0x97c5('0xc')](),controller[_0x97c5('0xd')]);router[_0x97c5('0xe')]('/',auth[_0x97c5('0xc')](),controller[_0x97c5('0xf')]);router[_0x97c5('0x10')](_0x97c5('0xb'),auth[_0x97c5('0xc')](),controller[_0x97c5('0x11')]);router[_0x97c5('0x12')](_0x97c5('0xb'),auth[_0x97c5('0xc')](),controller[_0x97c5('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5d8633d..b4df94a 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 _0x5c00=['string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0x30597f,_0x46463b){var _0x246c8f=function(_0x4f2c68){while(--_0x4f2c68){_0x30597f['push'](_0x30597f['shift']());}};_0x246c8f(++_0x46463b);}(_0x5c00,0x17e));var _0x05c0=function(_0x18fd0b,_0xe0f9ed){_0x18fd0b=_0x18fd0b-0x0;var _0x3b19a3=_0x5c00[_0x18fd0b];return _0x3b19a3;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'type':{'type':Sequelize[_0x05c0('0x2')]('string',_0x05c0('0x3'),'customVariable',_0x05c0('0x4')),'defaultValue':_0x05c0('0x5')},'content':{'type':Sequelize[_0x05c0('0x6')]},'key':{'type':Sequelize[_0x05c0('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x05c0('0x5'),_0x05c0('0x3'),_0x05c0('0x7'))},'keyContent':{'type':Sequelize[_0x05c0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x05c0('0x6')]},'customField':{'type':Sequelize[_0x05c0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x05c0('0x6')]}}; \ No newline at end of file +var _0xd64b=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x5f347d,_0x26795e){var _0x1a69f6=function(_0x45f72b){while(--_0x45f72b){_0x5f347d['push'](_0x5f347d['shift']());}};_0x1a69f6(++_0x26795e);}(_0xd64b,0xc1));var _0xbd64=function(_0x5c42bd,_0x45b22b){_0x5c42bd=_0x5c42bd-0x0;var _0x5b3ea2=_0xd64b[_0x5c42bd];return _0x5b3ea2;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'type':{'type':Sequelize[_0xbd64('0x1')]('string',_0xbd64('0x2'),_0xbd64('0x3'),_0xbd64('0x4')),'defaultValue':_0xbd64('0x5')},'content':{'type':Sequelize[_0xbd64('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xbd64('0x3'))},'keyContent':{'type':Sequelize[_0xbd64('0x6')]},'idField':{'type':Sequelize[_0xbd64('0x6')]},'nameField':{'type':Sequelize[_0xbd64('0x6')]},'customField':{'type':Sequelize[_0xbd64('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd64('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index a50ed63..8da6f79 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 _0xa93c=['field','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','update','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','error','stack','name','send','index','SugarcrmField','model','keys','query','intersection','fields','attributes','hasOwnProperty','sort','where','filters','merge','map','type','key','VIRTUAL'];(function(_0x29a41e,_0x253dec){var _0x452f84=function(_0x57ce56){while(--_0x57ce56){_0x29a41e['push'](_0x29a41e['shift']());}};_0x452f84(++_0x253dec);}(_0xa93c,0x1f2));var _0xca93=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xa93c[_0x2d89ce];return _0x3fad10;};'use strict';var pdf=require(_0xca93('0x0'));var emlformat=require(_0xca93('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xca93('0x2'));var jsonpatch=require(_0xca93('0x3'));var rp=require('request-promise');var moment=require(_0xca93('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xca93('0x5'));var path=require(_0xca93('0x6'));var sox=require(_0xca93('0x7'));var csv=require(_0xca93('0x8'));var ejs=require(_0xca93('0x9'));var fs=require('fs');var _=require(_0xca93('0xa'));var squel=require(_0xca93('0xb'));var crypto=require(_0xca93('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xca93('0x8'));var querystring=require(_0xca93('0xd'));var Papa=require(_0xca93('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0xca93('0xf'));var Redis=require(_0xca93('0x10'));var qs=require(_0xca93('0x11'));var logger=require(_0xca93('0x12'))(_0xca93('0x13'));var utils=require(_0xca93('0x14'));var config=require('../../config/environment');var db=require(_0xca93('0x15'))['db'];function respondWithStatusCode(_0x5c963f,_0x526ba6){_0x526ba6=_0x526ba6||0xcc;return function(_0x1fef58){if(_0x1fef58){return _0x5c963f[_0xca93('0x16')](_0x526ba6);}return _0x5c963f[_0xca93('0x17')](_0x526ba6)[_0xca93('0x18')]();};}function respondWithResult(_0x8a4f06,_0x544edb){_0x544edb=_0x544edb||0xc8;return function(_0x51e893){if(_0x51e893){return _0x8a4f06[_0xca93('0x17')](_0x544edb)[_0xca93('0x19')](_0x51e893);}};}function respondWithFilteredResult(_0x51d623,_0x3a608a){return function(_0x404b56){if(_0x404b56){var _0x183174=_0x404b56[_0xca93('0x1a')],_0xcc5d0a=_0x3a608a['offset'],_0x3f9417=_0x3a608a[_0xca93('0x1b')]+_0x3a608a[_0xca93('0x1c')],_0x75b386;if(_0x3f9417>=_0x183174){_0x3f9417=_0x183174;_0x75b386=0xc8;}else{_0x75b386=0xce;}_0x51d623['status'](_0x75b386);return _0x51d623[_0xca93('0x1d')]('Content-Range',_0xcc5d0a+'-'+_0x3f9417+'/'+_0x183174)[_0xca93('0x19')](_0x404b56);}return null;};}function patchUpdates(_0x2a63e8){return function(_0x4299f0){try{jsonpatch['apply'](_0x4299f0,_0x2a63e8,!![]);}catch(_0x102c2d){return BPromise[_0xca93('0x1e')](_0x102c2d);}return _0x4299f0[_0xca93('0x1f')]();};}function saveUpdates(_0x4cd70d,_0x3fba71){return function(_0x2e48a4){if(_0x2e48a4){return _0x2e48a4['update'](_0x4cd70d)['then'](function(_0x3ade12){return _0x3ade12;});}return null;};}function removeEntity(_0x5d27d6,_0x12f6d7){return function(_0x25d2d4){if(_0x25d2d4){return _0x25d2d4['destroy']()[_0xca93('0x20')](function(){_0x5d27d6[_0xca93('0x17')](0xcc)[_0xca93('0x18')]();});}};}function handleEntityNotFound(_0x589117,_0x3fd1c9){return function(_0x227e68){if(!_0x227e68){_0x589117[_0xca93('0x16')](0x194);}return _0x227e68;};}function handleError(_0x2189b9,_0x524197){_0x524197=_0x524197||0x1f4;return function(_0xab7025){logger[_0xca93('0x21')](_0xab7025[_0xca93('0x22')]);if(_0xab7025[_0xca93('0x23')]){delete _0xab7025['name'];}_0x2189b9['status'](_0x524197)[_0xca93('0x24')](_0xab7025);};}exports[_0xca93('0x25')]=function(_0x178764,_0x409dbd){var _0x1afcb7={},_0x29edd0={},_0x396547={'count':0x0,'rows':[]};var _0x3de67d=db[_0xca93('0x26')]['rawAttributes'];_0x29edd0[_0xca93('0x27')]=_[_0xca93('0x28')](_0x3de67d);_0x29edd0['query']=_[_0xca93('0x28')](_0x178764[_0xca93('0x29')]);_0x29edd0['filters']=_['intersection'](_0x29edd0['model'],_0x29edd0[_0xca93('0x29')]);_0x1afcb7['attributes']=_[_0xca93('0x2a')](_0x29edd0[_0xca93('0x27')],qs[_0xca93('0x2b')](_0x178764[_0xca93('0x29')][_0xca93('0x2b')]));_0x1afcb7[_0xca93('0x2c')]=_0x1afcb7['attributes']['length']?_0x1afcb7['attributes']:_0x29edd0[_0xca93('0x27')];if(!_0x178764[_0xca93('0x29')][_0xca93('0x2d')]('nolimit')){_0x1afcb7[_0xca93('0x1c')]=qs[_0xca93('0x1c')](_0x178764['query'][_0xca93('0x1c')]);_0x1afcb7[_0xca93('0x1b')]=qs[_0xca93('0x1b')](_0x178764[_0xca93('0x29')][_0xca93('0x1b')]);}_0x1afcb7['order']=qs[_0xca93('0x2e')](_0x178764[_0xca93('0x29')]['sort']);_0x1afcb7[_0xca93('0x2f')]=qs[_0xca93('0x30')](_['pick'](_0x178764[_0xca93('0x29')],_0x29edd0[_0xca93('0x30')]));if(_0x178764['query']['filter']){_0x1afcb7[_0xca93('0x2f')]=_[_0xca93('0x31')](_0x1afcb7[_0xca93('0x2f')],{'$or':_[_0xca93('0x32')](_0x3de67d,function(_0xd7b397){if(_0xd7b397[_0xca93('0x33')][_0xca93('0x34')]!==_0xca93('0x35')){var _0x5cf739={};_0x5cf739[_0xd7b397[_0xca93('0x36')]]={'$like':'%'+_0x178764[_0xca93('0x29')]['filter']+'%'};return _0x5cf739;}})});}_0x1afcb7=_[_0xca93('0x31')]({},_0x1afcb7,_0x178764[_0xca93('0x37')]);var _0x54ff85={'where':_0x1afcb7[_0xca93('0x2f')]};return db['SugarcrmField'][_0xca93('0x1a')](_0x54ff85)['then'](function(_0xdfc598){_0x396547['count']=_0xdfc598;if(_0x178764[_0xca93('0x29')][_0xca93('0x38')]){_0x1afcb7['include']=[{'all':!![]}];}return db[_0xca93('0x26')][_0xca93('0x39')](_0x1afcb7);})[_0xca93('0x20')](function(_0x706ce){_0x396547[_0xca93('0x3a')]=_0x706ce;return _0x396547;})['then'](respondWithFilteredResult(_0x409dbd,_0x1afcb7))[_0xca93('0x3b')](handleError(_0x409dbd,null));};exports[_0xca93('0x3c')]=function(_0x4e8951,_0x3add55){var _0x17936c={'raw':!![],'where':{'id':_0x4e8951[_0xca93('0x3d')]['id']}},_0x44ea6d={};_0x44ea6d['model']=_['keys'](db['SugarcrmField']['rawAttributes']);_0x44ea6d[_0xca93('0x29')]=_[_0xca93('0x28')](_0x4e8951[_0xca93('0x29')]);_0x44ea6d['filters']=_[_0xca93('0x2a')](_0x44ea6d['model'],_0x44ea6d[_0xca93('0x29')]);_0x17936c['attributes']=_[_0xca93('0x2a')](_0x44ea6d[_0xca93('0x27')],qs[_0xca93('0x2b')](_0x4e8951[_0xca93('0x29')][_0xca93('0x2b')]));_0x17936c[_0xca93('0x2c')]=_0x17936c['attributes'][_0xca93('0x3e')]?_0x17936c[_0xca93('0x2c')]:_0x44ea6d[_0xca93('0x27')];if(_0x4e8951[_0xca93('0x29')][_0xca93('0x38')]){_0x17936c[_0xca93('0x3f')]=[{'all':!![]}];}_0x17936c=_['merge']({},_0x17936c,_0x4e8951[_0xca93('0x37')]);return db[_0xca93('0x26')][_0xca93('0x40')](_0x17936c)[_0xca93('0x20')](handleEntityNotFound(_0x3add55,null))[_0xca93('0x20')](respondWithResult(_0x3add55,null))[_0xca93('0x3b')](handleError(_0x3add55,null));};exports['create']=function(_0x1b5e0f,_0x462e97){return db[_0xca93('0x26')][_0xca93('0x41')](_0x1b5e0f[_0xca93('0x42')],{})[_0xca93('0x20')](respondWithResult(_0x462e97,0xc9))[_0xca93('0x3b')](handleError(_0x462e97,null));};exports[_0xca93('0x43')]=function(_0x344926,_0x19c13a){if(_0x344926['body']['id']){delete _0x344926[_0xca93('0x42')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x344926[_0xca93('0x3d')]['id']}})[_0xca93('0x20')](handleEntityNotFound(_0x19c13a,null))[_0xca93('0x20')](saveUpdates(_0x344926['body'],null))[_0xca93('0x20')](respondWithResult(_0x19c13a,null))['catch'](handleError(_0x19c13a,null));};exports[_0xca93('0x44')]=function(_0x6c36ae,_0x4ea410){return db[_0xca93('0x26')][_0xca93('0x40')]({'where':{'id':_0x6c36ae[_0xca93('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4ea410,null))[_0xca93('0x20')](removeEntity(_0x4ea410,null))[_0xca93('0x3b')](handleError(_0x4ea410,null));}; \ No newline at end of file +var _0xa8ec=['papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','stack','name','send','index','SugarcrmField','rawAttributes','model','keys','query','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','type','key','VIRTUAL','field','filter','merge','options','includeAll','findAll','rows','show','params','attributes','find','catch','create','update','body','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xa8ec,0x1ad));var _0xca8e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xa8ec[_0x5f0089];return _0x193892;};'use strict';var pdf=require(_0xca8e('0x0'));var emlformat=require(_0xca8e('0x1'));var rimraf=require(_0xca8e('0x2'));var zipdir=require(_0xca8e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xca8e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xca8e('0x5'));var path=require(_0xca8e('0x6'));var sox=require(_0xca8e('0x7'));var csv=require('to-csv');var ejs=require(_0xca8e('0x8'));var fs=require('fs');var _=require(_0xca8e('0x9'));var squel=require(_0xca8e('0xa'));var crypto=require(_0xca8e('0xb'));var jsforce=require(_0xca8e('0xc'));var deskjs=require(_0xca8e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xca8e('0xe'));var Papa=require(_0xca8e('0xf'));var authService=require(_0xca8e('0x10'));var hardwareService=require(_0xca8e('0x11'));var Redis=require('ioredis');var qs=require(_0xca8e('0x12'));var logger=require(_0xca8e('0x13'))('api');var utils=require(_0xca8e('0x14'));var config=require(_0xca8e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13cdcf,_0x5ed1e1){_0x5ed1e1=_0x5ed1e1||0xcc;return function(_0x20ec00){if(_0x20ec00){return _0x13cdcf[_0xca8e('0x16')](_0x5ed1e1);}return _0x13cdcf[_0xca8e('0x17')](_0x5ed1e1)['end']();};}function respondWithResult(_0x4696bb,_0x9230b1){_0x9230b1=_0x9230b1||0xc8;return function(_0x23a57f){if(_0x23a57f){return _0x4696bb[_0xca8e('0x17')](_0x9230b1)[_0xca8e('0x18')](_0x23a57f);}};}function respondWithFilteredResult(_0x1daa19,_0x1bb7ec){return function(_0x1b4d33){if(_0x1b4d33){var _0x24fa35=_0x1b4d33[_0xca8e('0x19')],_0x35c24e=_0x1bb7ec[_0xca8e('0x1a')],_0x3fbc10=_0x1bb7ec[_0xca8e('0x1a')]+_0x1bb7ec[_0xca8e('0x1b')],_0x7f3320;if(_0x3fbc10>=_0x24fa35){_0x3fbc10=_0x24fa35;_0x7f3320=0xc8;}else{_0x7f3320=0xce;}_0x1daa19['status'](_0x7f3320);return _0x1daa19[_0xca8e('0x1c')](_0xca8e('0x1d'),_0x35c24e+'-'+_0x3fbc10+'/'+_0x24fa35)['json'](_0x1b4d33);}return null;};}function patchUpdates(_0xc6ed7e){return function(_0xadbd){try{jsonpatch[_0xca8e('0x1e')](_0xadbd,_0xc6ed7e,!![]);}catch(_0x1f0ebc){return BPromise[_0xca8e('0x1f')](_0x1f0ebc);}return _0xadbd[_0xca8e('0x20')]();};}function saveUpdates(_0x3f1301,_0x3b3ab6){return function(_0x45df4a){if(_0x45df4a){return _0x45df4a['update'](_0x3f1301)['then'](function(_0x5ef70f){return _0x5ef70f;});}return null;};}function removeEntity(_0x1d1206,_0xdf2d94){return function(_0x1cbd6e){if(_0x1cbd6e){return _0x1cbd6e[_0xca8e('0x21')]()[_0xca8e('0x22')](function(){_0x1d1206[_0xca8e('0x17')](0xcc)[_0xca8e('0x23')]();});}};}function handleEntityNotFound(_0x2b3cb6,_0x265324){return function(_0x538718){if(!_0x538718){_0x2b3cb6[_0xca8e('0x16')](0x194);}return _0x538718;};}function handleError(_0x6acb20,_0xdf4971){_0xdf4971=_0xdf4971||0x1f4;return function(_0x435681){logger['error'](_0x435681[_0xca8e('0x24')]);if(_0x435681[_0xca8e('0x25')]){delete _0x435681[_0xca8e('0x25')];}_0x6acb20[_0xca8e('0x17')](_0xdf4971)[_0xca8e('0x26')](_0x435681);};}exports[_0xca8e('0x27')]=function(_0xf2daf2,_0x37cce5){var _0x4f11a9={},_0x529ada={},_0x4460cb={'count':0x0,'rows':[]};var _0x5add2a=db[_0xca8e('0x28')][_0xca8e('0x29')];_0x529ada[_0xca8e('0x2a')]=_[_0xca8e('0x2b')](_0x5add2a);_0x529ada[_0xca8e('0x2c')]=_[_0xca8e('0x2b')](_0xf2daf2[_0xca8e('0x2c')]);_0x529ada['filters']=_[_0xca8e('0x2d')](_0x529ada[_0xca8e('0x2a')],_0x529ada['query']);_0x4f11a9['attributes']=_[_0xca8e('0x2d')](_0x529ada['model'],qs[_0xca8e('0x2e')](_0xf2daf2[_0xca8e('0x2c')][_0xca8e('0x2e')]));_0x4f11a9['attributes']=_0x4f11a9['attributes'][_0xca8e('0x2f')]?_0x4f11a9['attributes']:_0x529ada[_0xca8e('0x2a')];if(!_0xf2daf2[_0xca8e('0x2c')][_0xca8e('0x30')](_0xca8e('0x31'))){_0x4f11a9[_0xca8e('0x1b')]=qs['limit'](_0xf2daf2['query'][_0xca8e('0x1b')]);_0x4f11a9[_0xca8e('0x1a')]=qs[_0xca8e('0x1a')](_0xf2daf2['query'][_0xca8e('0x1a')]);}_0x4f11a9[_0xca8e('0x32')]=qs[_0xca8e('0x33')](_0xf2daf2['query'][_0xca8e('0x33')]);_0x4f11a9[_0xca8e('0x34')]=qs[_0xca8e('0x35')](_[_0xca8e('0x36')](_0xf2daf2[_0xca8e('0x2c')],_0x529ada['filters']));if(_0xf2daf2[_0xca8e('0x2c')]['filter']){_0x4f11a9[_0xca8e('0x34')]=_['merge'](_0x4f11a9['where'],{'$or':_[_0xca8e('0x37')](_0x5add2a,function(_0x150881){if(_0x150881[_0xca8e('0x38')][_0xca8e('0x39')]!==_0xca8e('0x3a')){var _0x451dd7={};_0x451dd7[_0x150881[_0xca8e('0x3b')]]={'$like':'%'+_0xf2daf2[_0xca8e('0x2c')][_0xca8e('0x3c')]+'%'};return _0x451dd7;}})});}_0x4f11a9=_[_0xca8e('0x3d')]({},_0x4f11a9,_0xf2daf2[_0xca8e('0x3e')]);var _0x56884d={'where':_0x4f11a9[_0xca8e('0x34')]};return db['SugarcrmField'][_0xca8e('0x19')](_0x56884d)[_0xca8e('0x22')](function(_0x37abcc){_0x4460cb['count']=_0x37abcc;if(_0xf2daf2['query'][_0xca8e('0x3f')]){_0x4f11a9['include']=[{'all':!![]}];}return db[_0xca8e('0x28')][_0xca8e('0x40')](_0x4f11a9);})[_0xca8e('0x22')](function(_0x13a304){_0x4460cb[_0xca8e('0x41')]=_0x13a304;return _0x4460cb;})['then'](respondWithFilteredResult(_0x37cce5,_0x4f11a9))['catch'](handleError(_0x37cce5,null));};exports[_0xca8e('0x42')]=function(_0x2258d1,_0x5de053){var _0x4f3afc={'raw':!![],'where':{'id':_0x2258d1[_0xca8e('0x43')]['id']}},_0x478f3a={};_0x478f3a[_0xca8e('0x2a')]=_[_0xca8e('0x2b')](db[_0xca8e('0x28')][_0xca8e('0x29')]);_0x478f3a[_0xca8e('0x2c')]=_['keys'](_0x2258d1[_0xca8e('0x2c')]);_0x478f3a['filters']=_[_0xca8e('0x2d')](_0x478f3a['model'],_0x478f3a[_0xca8e('0x2c')]);_0x4f3afc[_0xca8e('0x44')]=_['intersection'](_0x478f3a[_0xca8e('0x2a')],qs[_0xca8e('0x2e')](_0x2258d1[_0xca8e('0x2c')][_0xca8e('0x2e')]));_0x4f3afc[_0xca8e('0x44')]=_0x4f3afc[_0xca8e('0x44')][_0xca8e('0x2f')]?_0x4f3afc[_0xca8e('0x44')]:_0x478f3a[_0xca8e('0x2a')];if(_0x2258d1[_0xca8e('0x2c')]['includeAll']){_0x4f3afc['include']=[{'all':!![]}];}_0x4f3afc=_['merge']({},_0x4f3afc,_0x2258d1['options']);return db['SugarcrmField'][_0xca8e('0x45')](_0x4f3afc)[_0xca8e('0x22')](handleEntityNotFound(_0x5de053,null))[_0xca8e('0x22')](respondWithResult(_0x5de053,null))[_0xca8e('0x46')](handleError(_0x5de053,null));};exports[_0xca8e('0x47')]=function(_0x404f8b,_0x55dd97){return db[_0xca8e('0x28')]['create'](_0x404f8b['body'],{})['then'](respondWithResult(_0x55dd97,0xc9))['catch'](handleError(_0x55dd97,null));};exports[_0xca8e('0x48')]=function(_0xf143fb,_0x319c4e){if(_0xf143fb['body']['id']){delete _0xf143fb[_0xca8e('0x49')]['id'];}return db[_0xca8e('0x28')][_0xca8e('0x45')]({'where':{'id':_0xf143fb['params']['id']}})[_0xca8e('0x22')](handleEntityNotFound(_0x319c4e,null))[_0xca8e('0x22')](saveUpdates(_0xf143fb['body'],null))[_0xca8e('0x22')](respondWithResult(_0x319c4e,null))[_0xca8e('0x46')](handleError(_0x319c4e,null));};exports['destroy']=function(_0x35195a,_0x34237c){return db[_0xca8e('0x28')][_0xca8e('0x45')]({'where':{'id':_0x35195a['params']['id']}})[_0xca8e('0x22')](handleEntityNotFound(_0x34237c,null))[_0xca8e('0x22')](removeEntity(_0x34237c,null))[_0xca8e('0x46')](handleError(_0x34237c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index fb3638c..c6636f6 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 _0x3c14=['util','api','moment','request-promise','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash'];(function(_0x35ecbe,_0x44459a){var _0x47df11=function(_0x543db9){while(--_0x543db9){_0x35ecbe['push'](_0x35ecbe['shift']());}};_0x47df11(++_0x44459a);}(_0x3c14,0x15b));var _0x43c1=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x3c14[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0x43c1('0x0'));var util=require(_0x43c1('0x1'));var logger=require('../../config/logger')(_0x43c1('0x2'));var moment=require(_0x43c1('0x3'));var BPromise=require('bluebird');var rp=require(_0x43c1('0x4'));var attributes=require(_0x43c1('0x5'));module[_0x43c1('0x6')]=function(_0x53d444,_0x426784){return _0x53d444[_0x43c1('0x7')](_0x43c1('0x8'),attributes,{'tableName':_0x43c1('0x9'),'paranoid':![],'indexes':[{'name':_0x43c1('0xa'),'fields':['idField',_0x43c1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9045=['lodash','util','api','moment','bluebird','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x9045,0x142));var _0x5904=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x9045[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x5904('0x0'));var util=require(_0x5904('0x1'));var logger=require('../../config/logger')(_0x5904('0x2'));var moment=require(_0x5904('0x3'));var BPromise=require(_0x5904('0x4'));var rp=require('request-promise');var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x23e750,_0x241ea4){return _0x23e750['define']('SugarcrmField',attributes,{'tableName':_0x5904('0x5'),'paranoid':![],'indexes':[{'name':_0x5904('0x6'),'fields':['idField','FieldId'],'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 9cbb617..e76e2c6 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 _0xaac2=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaac2,0x1eb));var _0x2aac=function(_0x249437,_0x5df4ee){_0x249437=_0x249437-0x0;var _0x4d4617=_0xaac2[_0x249437];return _0x4d4617;};'use strict';var _=require(_0x2aac('0x0'));var util=require('util');var moment=require(_0x2aac('0x1'));var BPromise=require(_0x2aac('0x2'));var rs=require(_0x2aac('0x3'));var fs=require('fs');var Redis=require(_0x2aac('0x4'));var db=require(_0x2aac('0x5'))['db'];var utils=require(_0x2aac('0x6'));var logger=require(_0x2aac('0x7'))(_0x2aac('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2aac('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53e009,_0x479797,_0x10e0b3){return new BPromise(function(_0x4c999d,_0x1ec4f2){return client[_0x2aac('0xa')](_0x53e009,_0x10e0b3)[_0x2aac('0xb')](function(_0x3c3a7e){logger['info'](_0x2aac('0xc'),_0x479797,_0x2aac('0xd'));logger['debug'](_0x2aac('0xe'),_0x479797,_0x2aac('0xd'),JSON[_0x2aac('0xf')](_0x3c3a7e));if(_0x3c3a7e[_0x2aac('0x10')]){if(_0x3c3a7e[_0x2aac('0x10')][_0x2aac('0x11')]===0x1f4){logger[_0x2aac('0x10')](_0x2aac('0xc'),_0x479797,_0x3c3a7e['error'][_0x2aac('0x12')]);return _0x1ec4f2(_0x3c3a7e['error'][_0x2aac('0x12')]);}logger[_0x2aac('0x10')](_0x2aac('0xc'),_0x479797,_0x3c3a7e['error'][_0x2aac('0x12')]);return _0x4c999d(_0x3c3a7e[_0x2aac('0x10')][_0x2aac('0x12')]);}else{logger[_0x2aac('0x13')](_0x2aac('0xc'),_0x479797,_0x2aac('0xd'));_0x4c999d(_0x3c3a7e[_0x2aac('0x14')]['message']);}})[_0x2aac('0x15')](function(_0x35b326){logger[_0x2aac('0x10')](_0x2aac('0xc'),_0x479797,_0x35b326);_0x1ec4f2(_0x35b326);});});} \ No newline at end of file +var _0xc064=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x298c7e,_0x570c94){var _0x3d9c67=function(_0x27df29){while(--_0x27df29){_0x298c7e['push'](_0x298c7e['shift']());}};_0x3d9c67(++_0x570c94);}(_0xc064,0xb7));var _0x4c06=function(_0x15ec65,_0x2ad2ed){_0x15ec65=_0x15ec65-0x0;var _0x4fc398=_0xc064[_0x15ec65];return _0x4fc398;};'use strict';var _=require(_0x4c06('0x0'));var util=require(_0x4c06('0x1'));var moment=require('moment');var BPromise=require(_0x4c06('0x2'));var rs=require(_0x4c06('0x3'));var fs=require('fs');var Redis=require(_0x4c06('0x4'));var db=require(_0x4c06('0x5'))['db'];var utils=require(_0x4c06('0x6'));var logger=require(_0x4c06('0x7'))(_0x4c06('0x8'));var config=require(_0x4c06('0x9'));var jayson=require(_0x4c06('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2cb9b4,_0x2612c6,_0x5733f0){return new BPromise(function(_0x954f11,_0x20e04b){return client['request'](_0x2cb9b4,_0x5733f0)[_0x4c06('0xb')](function(_0x41769c){logger[_0x4c06('0xc')](_0x4c06('0xd'),_0x2612c6,_0x4c06('0xe'));logger[_0x4c06('0xf')](_0x4c06('0x10'),_0x2612c6,_0x4c06('0xe'),JSON['stringify'](_0x41769c));if(_0x41769c[_0x4c06('0x11')]){if(_0x41769c['error'][_0x4c06('0x12')]===0x1f4){logger['error'](_0x4c06('0xd'),_0x2612c6,_0x41769c[_0x4c06('0x11')]['message']);return _0x20e04b(_0x41769c[_0x4c06('0x11')][_0x4c06('0x13')]);}logger[_0x4c06('0x11')](_0x4c06('0xd'),_0x2612c6,_0x41769c[_0x4c06('0x11')][_0x4c06('0x13')]);return _0x954f11(_0x41769c['error'][_0x4c06('0x13')]);}else{logger['info'](_0x4c06('0xd'),_0x2612c6,_0x4c06('0xe'));_0x954f11(_0x41769c[_0x4c06('0x14')][_0x4c06('0x13')]);}})[_0x4c06('0x15')](function(_0x37e458){logger[_0x4c06('0x11')](_0x4c06('0xd'),_0x2612c6,_0x37e458);_0x20e04b(_0x37e458);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index bc5eaf0..893e7b2 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 _0x3fb5=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','destroy','exports','multer','util'];(function(_0x19eed5,_0x1c5d6a){var _0x5c7ba1=function(_0x1d0a02){while(--_0x1d0a02){_0x19eed5['push'](_0x19eed5['shift']());}};_0x5c7ba1(++_0x1c5d6a);}(_0x3fb5,0x76));var _0x53fb=function(_0x34a74e,_0x5be66a){_0x34a74e=_0x34a74e-0x0;var _0x24a2b2=_0x3fb5[_0x34a74e];return _0x24a2b2;};'use strict';var multer=require(_0x53fb('0x0'));var util=require(_0x53fb('0x1'));var path=require('path');var timeout=require(_0x53fb('0x2'));var express=require('express');var router=express[_0x53fb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x53fb('0x4'));var config=require(_0x53fb('0x5'));var controller=require(_0x53fb('0x6'));router[_0x53fb('0x7')]('/',auth['isAuthenticated'](),controller[_0x53fb('0x8')]);router['get']('/:id',auth[_0x53fb('0x9')](),controller['show']);router[_0x53fb('0x7')](_0x53fb('0xa'),auth[_0x53fb('0x9')](),controller[_0x53fb('0xb')]);router[_0x53fb('0x7')](_0x53fb('0xc'),auth[_0x53fb('0x9')](),controller['getFields']);router[_0x53fb('0xd')]('/',auth[_0x53fb('0x9')](),controller[_0x53fb('0xe')]);router[_0x53fb('0xd')](_0x53fb('0xa'),auth[_0x53fb('0x9')](),controller[_0x53fb('0xf')]);router[_0x53fb('0x10')](_0x53fb('0x11'),auth[_0x53fb('0x9')](),controller['update']);router['delete'](_0x53fb('0x11'),auth[_0x53fb('0x9')](),controller[_0x53fb('0x12')]);module[_0x53fb('0x13')]=router; \ No newline at end of file +var _0xd5ed=['addConfiguration','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post'];(function(_0x430b10,_0x45a31e){var _0x412122=function(_0x4f3da1){while(--_0x4f3da1){_0x430b10['push'](_0x430b10['shift']());}};_0x412122(++_0x45a31e);}(_0xd5ed,0x1a3));var _0xdd5e=function(_0x34cc33,_0x3c6503){_0x34cc33=_0x34cc33-0x0;var _0x4ccf27=_0xd5ed[_0x34cc33];return _0x4ccf27;};'use strict';var multer=require(_0xdd5e('0x0'));var util=require('util');var path=require(_0xdd5e('0x1'));var timeout=require(_0xdd5e('0x2'));var express=require(_0xdd5e('0x3'));var router=express[_0xdd5e('0x4')]();var auth=require(_0xdd5e('0x5'));var interaction=require(_0xdd5e('0x6'));var config=require(_0xdd5e('0x7'));var controller=require('./intVtigerAccount.controller');router[_0xdd5e('0x8')]('/',auth[_0xdd5e('0x9')](),controller[_0xdd5e('0xa')]);router[_0xdd5e('0x8')](_0xdd5e('0xb'),auth[_0xdd5e('0x9')](),controller[_0xdd5e('0xc')]);router[_0xdd5e('0x8')](_0xdd5e('0xd'),auth['isAuthenticated'](),controller[_0xdd5e('0xe')]);router[_0xdd5e('0x8')](_0xdd5e('0xf'),auth[_0xdd5e('0x9')](),controller['getFields']);router['post']('/',auth[_0xdd5e('0x9')](),controller[_0xdd5e('0x10')]);router[_0xdd5e('0x11')](_0xdd5e('0xd'),auth['isAuthenticated'](),controller[_0xdd5e('0x12')]);router[_0xdd5e('0x13')](_0xdd5e('0xb'),auth[_0xdd5e('0x9')](),controller[_0xdd5e('0x14')]);router[_0xdd5e('0x15')](_0xdd5e('0xb'),auth[_0xdd5e('0x9')](),controller['destroy']);module[_0xdd5e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a08e874..e728ab2 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 _0x8f00=['HelpDesk','sequelize','exports','STRING'];(function(_0x13a9b6,_0x1a65d6){var _0x4d9f1c=function(_0xedc1b2){while(--_0xedc1b2){_0x13a9b6['push'](_0x13a9b6['shift']());}};_0x4d9f1c(++_0x1a65d6);}(_0x8f00,0x1dd));var _0x08f0=function(_0x5d5a3e,_0x3089db){_0x5d5a3e=_0x5d5a3e-0x0;var _0x33b762=_0x8f00[_0x5d5a3e];return _0x33b762;};'use strict';var Sequelize=require(_0x08f0('0x0'));module[_0x08f0('0x1')]={'name':{'type':Sequelize[_0x08f0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x08f0('0x2')]},'username':{'type':Sequelize[_0x08f0('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x08f0('0x3')},'remoteUri':{'type':Sequelize[_0x08f0('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x08f0('0x2')]},'accessKey':{'type':Sequelize[_0x08f0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x84d9=['sequelize','exports','STRING','HelpDesk'];(function(_0x315b67,_0x4fca93){var _0x6ed6=function(_0x1f3b63){while(--_0x1f3b63){_0x315b67['push'](_0x315b67['shift']());}};_0x6ed6(++_0x4fca93);}(_0x84d9,0x1e4));var _0x984d=function(_0x2a1aab,_0x5ef2f8){_0x2a1aab=_0x2a1aab-0x0;var _0x506e57=_0x84d9[_0x2a1aab];return _0x506e57;};'use strict';var Sequelize=require(_0x984d('0x0'));module[_0x984d('0x1')]={'name':{'type':Sequelize[_0x984d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x984d('0x2')]},'username':{'type':Sequelize[_0x984d('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x984d('0x2')],'allowNull':![],'defaultValue':_0x984d('0x3')},'remoteUri':{'type':Sequelize[_0x984d('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x984d('0x2')]},'accessKey':{'type':Sequelize[_0x984d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 56207e9..8383317 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 _0x131e=['success','describe','reference','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','request','then','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','VtigerAccount,\x20%s,\x20%s','message','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','destroy','end','stack','name','send','rawAttributes','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','VtigerAccount','count','findAll','rows','show','params','model','includeAll','include','create','body','catch','update','find','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerConfiguration','VtigerField','md5','username','description','moduleName','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','result'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x131e,0x1ec));var _0xe131=function(_0x2687c3,_0x4b0e5c){_0x2687c3=_0x2687c3-0x0;var _0x3e916d=_0x131e[_0x2687c3];return _0x3e916d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe131('0x0'));var jsonpatch=require(_0xe131('0x1'));var rp=require(_0xe131('0x2'));var moment=require(_0xe131('0x3'));var BPromise=require(_0xe131('0x4'));var Mustache=require(_0xe131('0x5'));var util=require('util');var path=require(_0xe131('0x6'));var sox=require(_0xe131('0x7'));var csv=require(_0xe131('0x8'));var ejs=require(_0xe131('0x9'));var fs=require('fs');var _=require(_0xe131('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe131('0x8'));var querystring=require(_0xe131('0xb'));var Papa=require('papaparse');var authService=require(_0xe131('0xc'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xe131('0xd'));var qs=require(_0xe131('0xe'));var logger=require(_0xe131('0xf'))(_0xe131('0x10'));var utils=require(_0xe131('0x11'));var config=require(_0xe131('0x12'));var db=require(_0xe131('0x13'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14ed9a,_0x1714db,_0x33938d,_0xe1d86b){return new BPromise(function(_0x34289c,_0x420cc2){var _0x436549=_0xe1d86b||client;return _0x436549[_0xe131('0x14')](_0x14ed9a,_0x33938d)[_0xe131('0x15')](function(_0x5f2291){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x1714db,'request\x20sent');logger['debug'](_0xe131('0x16'),_0x1714db,_0xe131('0x17'),JSON[_0xe131('0x18')](_0x5f2291));if(_0x5f2291['error']){if(_0x5f2291['error'][_0xe131('0x19')]===0x1f4){logger[_0xe131('0x1a')](_0xe131('0x1b'),_0x1714db,_0x5f2291[_0xe131('0x1a')][_0xe131('0x1c')]);return _0x420cc2(_0x5f2291[_0xe131('0x1a')]['message']);}logger[_0xe131('0x1a')](_0xe131('0x1b'),_0x1714db,_0x5f2291[_0xe131('0x1a')][_0xe131('0x1c')]);return _0x34289c(_0x5f2291[_0xe131('0x1a')]['message']);}else{logger['info'](_0xe131('0x1b'),_0x1714db,_0xe131('0x17'));_0x34289c(_0x5f2291['result'][_0xe131('0x1c')]);}})['catch'](function(_0x49f304){logger[_0xe131('0x1a')](_0xe131('0x1b'),_0x1714db,_0x49f304);_0x420cc2(_0x49f304);});});}function respondWithStatusCode(_0x473bb4,_0xecb533){_0xecb533=_0xecb533||0xcc;return function(_0x166409){if(_0x166409){return _0x473bb4[_0xe131('0x1d')](_0xecb533);}return _0x473bb4[_0xe131('0x1e')](_0xecb533)['end']();};}function respondWithResult(_0x2be2df,_0x3a6982){_0x3a6982=_0x3a6982||0xc8;return function(_0x5ec305){if(_0x5ec305){return _0x2be2df['status'](_0x3a6982)[_0xe131('0x1f')](_0x5ec305);}};}function respondWithFilteredResult(_0x5b2f47,_0x41c386){return function(_0x3b95bf){if(_0x3b95bf){var _0x51e109=_0x3b95bf['count'],_0x44935b=_0x41c386[_0xe131('0x20')],_0x3959ac=_0x41c386[_0xe131('0x20')]+_0x41c386[_0xe131('0x21')],_0x41a3e9;if(_0x3959ac>=_0x51e109){_0x3959ac=_0x51e109;_0x41a3e9=0xc8;}else{_0x41a3e9=0xce;}_0x5b2f47[_0xe131('0x1e')](_0x41a3e9);return _0x5b2f47[_0xe131('0x22')](_0xe131('0x23'),_0x44935b+'-'+_0x3959ac+'/'+_0x51e109)[_0xe131('0x1f')](_0x3b95bf);}return null;};}function patchUpdates(_0x3414f1){return function(_0x9f8c66){try{jsonpatch[_0xe131('0x24')](_0x9f8c66,_0x3414f1,!![]);}catch(_0x58e75a){return BPromise[_0xe131('0x25')](_0x58e75a);}return _0x9f8c66['save']();};}function saveUpdates(_0x155c67,_0x57f7ba){return function(_0x35d2a2){if(_0x35d2a2){return _0x35d2a2['update'](_0x155c67)[_0xe131('0x15')](function(_0x2243f9){return _0x2243f9;});}return null;};}function removeEntity(_0x306082,_0x481e50){return function(_0x53c81a){if(_0x53c81a){return _0x53c81a[_0xe131('0x26')]()[_0xe131('0x15')](function(){_0x306082[_0xe131('0x1e')](0xcc)[_0xe131('0x27')]();});}};}function handleEntityNotFound(_0x1317eb,_0x531799){return function(_0x19f02e){if(!_0x19f02e){_0x1317eb[_0xe131('0x1d')](0x194);}return _0x19f02e;};}function handleError(_0x5347ee,_0x5f3170){_0x5f3170=_0x5f3170||0x1f4;return function(_0x2996fd){logger[_0xe131('0x1a')](_0x2996fd[_0xe131('0x28')]);if(_0x2996fd[_0xe131('0x29')]){delete _0x2996fd[_0xe131('0x29')];}_0x5347ee[_0xe131('0x1e')](_0x5f3170)[_0xe131('0x2a')](_0x2996fd);};}exports['index']=function(_0x54d331,_0x1c9e34){var _0x53f7bd={},_0x26bf39={},_0x584cc9={'count':0x0,'rows':[]};var _0x37057b=db['VtigerAccount'][_0xe131('0x2b')];_0x26bf39['model']=_[_0xe131('0x2c')](_0x37057b);_0x26bf39[_0xe131('0x2d')]=_[_0xe131('0x2c')](_0x54d331[_0xe131('0x2d')]);_0x26bf39[_0xe131('0x2e')]=_[_0xe131('0x2f')](_0x26bf39['model'],_0x26bf39[_0xe131('0x2d')]);_0x53f7bd['attributes']=_[_0xe131('0x2f')](_0x26bf39['model'],qs[_0xe131('0x30')](_0x54d331[_0xe131('0x2d')][_0xe131('0x30')]));_0x53f7bd[_0xe131('0x31')]=_0x53f7bd[_0xe131('0x31')][_0xe131('0x32')]?_0x53f7bd[_0xe131('0x31')]:_0x26bf39['model'];if(!_0x54d331[_0xe131('0x2d')]['hasOwnProperty'](_0xe131('0x33'))){_0x53f7bd[_0xe131('0x21')]=qs['limit'](_0x54d331['query'][_0xe131('0x21')]);_0x53f7bd['offset']=qs['offset'](_0x54d331[_0xe131('0x2d')]['offset']);}_0x53f7bd[_0xe131('0x34')]=qs[_0xe131('0x35')](_0x54d331['query'][_0xe131('0x35')]);_0x53f7bd[_0xe131('0x36')]=qs[_0xe131('0x2e')](_[_0xe131('0x37')](_0x54d331[_0xe131('0x2d')],_0x26bf39['filters']));if(_0x54d331['query'][_0xe131('0x38')]){_0x53f7bd[_0xe131('0x36')]=_[_0xe131('0x39')](_0x53f7bd['where'],{'$or':_[_0xe131('0x3a')](_0x37057b,function(_0x112e78){if(_0x112e78[_0xe131('0x3b')]['key']!==_0xe131('0x3c')){var _0x1c9c6d={};_0x1c9c6d[_0x112e78[_0xe131('0x3d')]]={'$like':'%'+_0x54d331['query'][_0xe131('0x38')]+'%'};return _0x1c9c6d;}})});}_0x53f7bd=_[_0xe131('0x39')]({},_0x53f7bd,_0x54d331[_0xe131('0x3e')]);var _0x4a77d1={'where':_0x53f7bd[_0xe131('0x36')]};return db[_0xe131('0x3f')][_0xe131('0x40')](_0x4a77d1)[_0xe131('0x15')](function(_0x353bb0){_0x584cc9[_0xe131('0x40')]=_0x353bb0;if(_0x54d331[_0xe131('0x2d')]['includeAll']){_0x53f7bd['include']=[{'all':!![]}];}return db[_0xe131('0x3f')][_0xe131('0x41')](_0x53f7bd);})[_0xe131('0x15')](function(_0x23586a){_0x584cc9[_0xe131('0x42')]=_0x23586a;return _0x584cc9;})[_0xe131('0x15')](respondWithFilteredResult(_0x1c9e34,_0x53f7bd))['catch'](handleError(_0x1c9e34,null));};exports[_0xe131('0x43')]=function(_0x3e4d48,_0x268cc6){var _0x89a914={'raw':![],'where':{'id':_0x3e4d48[_0xe131('0x44')]['id']}},_0x46906c={};_0x46906c['model']=_[_0xe131('0x2c')](db[_0xe131('0x3f')][_0xe131('0x2b')]);_0x46906c[_0xe131('0x2d')]=_[_0xe131('0x2c')](_0x3e4d48[_0xe131('0x2d')]);_0x46906c[_0xe131('0x2e')]=_[_0xe131('0x2f')](_0x46906c[_0xe131('0x45')],_0x46906c[_0xe131('0x2d')]);_0x89a914[_0xe131('0x31')]=_['intersection'](_0x46906c[_0xe131('0x45')],qs['fields'](_0x3e4d48['query'][_0xe131('0x30')]));_0x89a914[_0xe131('0x31')]=_0x89a914[_0xe131('0x31')][_0xe131('0x32')]?_0x89a914[_0xe131('0x31')]:_0x46906c[_0xe131('0x45')];if(_0x3e4d48[_0xe131('0x2d')][_0xe131('0x46')]){_0x89a914[_0xe131('0x47')]=[{'all':!![]}];}_0x89a914=_[_0xe131('0x39')]({},_0x89a914,_0x3e4d48[_0xe131('0x3e')]);return db['VtigerAccount']['find'](_0x89a914)[_0xe131('0x15')](handleEntityNotFound(_0x268cc6,null))[_0xe131('0x15')](respondWithResult(_0x268cc6,null))['catch'](handleError(_0x268cc6,null));};exports['create']=function(_0x2b934b,_0x564a29){return db['VtigerAccount'][_0xe131('0x48')](_0x2b934b[_0xe131('0x49')],{})[_0xe131('0x15')](respondWithResult(_0x564a29,0xc9))[_0xe131('0x4a')](handleError(_0x564a29,null));};exports[_0xe131('0x4b')]=function(_0x32bdca,_0x5eff76){if(_0x32bdca['body']['id']){delete _0x32bdca[_0xe131('0x49')]['id'];}return db[_0xe131('0x3f')]['find']({'where':{'id':_0x32bdca[_0xe131('0x44')]['id']}})[_0xe131('0x15')](handleEntityNotFound(_0x5eff76,null))[_0xe131('0x15')](saveUpdates(_0x32bdca[_0xe131('0x49')],null))[_0xe131('0x15')](respondWithResult(_0x5eff76,null))[_0xe131('0x4a')](handleError(_0x5eff76,null));};exports['destroy']=function(_0x23d880,_0x544b14){return db['VtigerAccount'][_0xe131('0x4c')]({'where':{'id':_0x23d880[_0xe131('0x44')]['id']}})['then'](handleEntityNotFound(_0x544b14,null))['then'](removeEntity(_0x544b14,null))[_0xe131('0x4a')](handleError(_0x544b14,null));};exports[_0xe131('0x4d')]=function(_0x356d49,_0x51628f,_0x167d85){var _0x1ea7d9={};var _0x45d00d={};var _0x1f0126;var _0x2a65fd;return db['VtigerAccount'][_0xe131('0x4e')]({'where':{'id':_0x356d49['params']['id']}})[_0xe131('0x15')](handleEntityNotFound(_0x51628f,null))[_0xe131('0x15')](function(_0xc398e5){if(_0xc398e5){_0x1f0126=_0xc398e5;_0x45d00d[_0xe131('0x45')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x45d00d[_0xe131('0x2d')]=_['keys'](_0x356d49[_0xe131('0x2d')]);_0x45d00d[_0xe131('0x2e')]=_[_0xe131('0x2f')](_0x45d00d[_0xe131('0x45')],_0x45d00d[_0xe131('0x2d')]);_0x1ea7d9[_0xe131('0x31')]=_[_0xe131('0x2f')](_0x45d00d[_0xe131('0x45')],qs[_0xe131('0x30')](_0x356d49[_0xe131('0x2d')]['fields']));_0x1ea7d9['attributes']=_0x1ea7d9['attributes'][_0xe131('0x32')]?_0x1ea7d9[_0xe131('0x31')]:_0x45d00d[_0xe131('0x45')];_0x1ea7d9[_0xe131('0x34')]=qs['sort'](_0x356d49[_0xe131('0x2d')][_0xe131('0x35')]);_0x1ea7d9[_0xe131('0x36')]=qs[_0xe131('0x2e')](_[_0xe131('0x37')](_0x356d49[_0xe131('0x2d')],_0x45d00d['filters']));if(_0x356d49['query'][_0xe131('0x38')]){_0x1ea7d9['where']=_['merge'](_0x1ea7d9['where'],{'$or':_[_0xe131('0x3a')](_0x1ea7d9['attributes'],function(_0x2e6f99){var _0x564e65={};_0x564e65[_0x2e6f99]={'$like':'%'+_0x356d49[_0xe131('0x2d')][_0xe131('0x38')]+'%'};return _0x564e65;})});}_0x1ea7d9=_[_0xe131('0x39')]({},_0x1ea7d9,_0x356d49[_0xe131('0x3e')]);return _0x1f0126['getConfigurations'](_0x1ea7d9);}})[_0xe131('0x15')](function(_0x3fe0f9){if(_0x3fe0f9){_0x2a65fd=_0x3fe0f9[_0xe131('0x32')];if(!_0x356d49[_0xe131('0x2d')][_0xe131('0x4f')](_0xe131('0x33'))){_0x1ea7d9['limit']=qs[_0xe131('0x21')](_0x356d49[_0xe131('0x2d')]['limit']);_0x1ea7d9[_0xe131('0x20')]=qs['offset'](_0x356d49['query'][_0xe131('0x20')]);}return _0x1f0126['getConfigurations'](_0x1ea7d9);}})[_0xe131('0x15')](function(_0x366f8c){if(_0x366f8c){return _0x366f8c?{'count':_0x2a65fd,'rows':_0x366f8c}:null;}})[_0xe131('0x15')](respondWithResult(_0x51628f,null))['catch'](handleError(_0x51628f,null));};exports[_0xe131('0x50')]=function(_0x307cc6,_0x240c33,_0xd4528f){if(_0x307cc6[_0xe131('0x49')]['id']){delete _0x307cc6[_0xe131('0x49')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x307cc6[_0xe131('0x44')]['id']}})['then'](handleEntityNotFound(_0x240c33,null))[_0xe131('0x15')](function(_0x57bd5a){if(_0x57bd5a){_0x307cc6[_0xe131('0x49')][_0xe131('0x51')]=_0x57bd5a['id'];_0x307cc6[_0xe131('0x49')][_0xe131('0x52')]=integrations[_0xe131('0x53')](_0x307cc6[_0xe131('0x49')]['channel'],_0x307cc6[_0xe131('0x49')][_0xe131('0x3b')]);_0x307cc6[_0xe131('0x49')][_0xe131('0x54')]=integrations[_0xe131('0x55')](_0x307cc6[_0xe131('0x49')][_0xe131('0x56')],_0x307cc6[_0xe131('0x49')][_0xe131('0x3b')]);return db[_0xe131('0x57')][_0xe131('0x48')](_0x307cc6[_0xe131('0x49')],{'include':[{'model':db['VtigerField'],'as':_0xe131('0x52')},{'model':db[_0xe131('0x58')],'as':'Descriptions'}]});}return null;})[_0xe131('0x15')](respondWithResult(_0x240c33,null))[_0xe131('0x4a')](handleError(_0x240c33,null));};var md5=require(_0xe131('0x59'));exports['getFields']=function(_0x1e2c5b,_0x374fca,_0x192de4){var _0x2368ac=null;var _0xc2e591=null;var _0x3f4dc7=null;var _0x453f4f=null;var _0x10a10a='';return db[_0xe131('0x3f')][_0xe131('0x4e')]({'where':{'id':_0x1e2c5b[_0xe131('0x44')]['id']},'attributes':['id',_0xe131('0x29'),_0xe131('0x5a'),_0xe131('0x5b'),_0xe131('0x5c'),'remoteUri','serverUrl',_0xe131('0x5d')]})['then'](handleEntityNotFound(_0x374fca,null))[_0xe131('0x15')](function(_0x3331fc){if(_0x3331fc){_0x2368ac=_0x3331fc[_0xe131('0x5a')];_0xc2e591=_0x3331fc[_0xe131('0x5d')];_0x3f4dc7=_0x3331fc[_0xe131('0x5c')];_0x10a10a=_0x3331fc['remoteUri'];var _0x12819e=_0x10a10a['slice'](-0x1);if(_0x12819e==='/'){_0x10a10a=_0x10a10a[_0xe131('0x5e')](0x0,_0x10a10a[_0xe131('0x5f')](_0x12819e));}_0x453f4f=util[_0xe131('0x60')](_0xe131('0x61'),_0x10a10a);var _0x47dad6={'method':_0xe131('0x62'),'uri':_0x453f4f,'qs':{'operation':_0xe131('0x63'),'username':_0x3331fc[_0xe131('0x5a')]},'json':!![]};return rp(_0x47dad6);}})[_0xe131('0x15')](function(_0x4686e5){if(_0x4686e5['success']){var _0x4a3000={'method':_0xe131('0x64'),'uri':_0x453f4f,'form':{'operation':_0xe131('0x65'),'username':_0x2368ac,'accessKey':md5(_0x4686e5[_0xe131('0x66')]['token']+_0xc2e591)},'json':!![]};return rp(_0x4a3000);}})['then'](function(_0x3d3f81){if(_0x3d3f81[_0xe131('0x67')]){var _0x2e7536={'method':_0xe131('0x62'),'uri':_0x453f4f,'qs':{'operation':_0xe131('0x68'),'username':_0x2368ac,'sessionName':_0x3d3f81[_0xe131('0x66')]['sessionName'],'elementType':_0x3f4dc7},'json':!![]};return rp(_0x2e7536);}})[_0xe131('0x15')](function(_0x3c9025){if(_0x3c9025[_0xe131('0x67')]){var _0x89138e=['autogenerated',_0xe131('0x69'),'owner'];_[_0xe131('0x6a')](_0x3c9025[_0xe131('0x66')][_0xe131('0x30')],function(_0x5e79c3){return _0x89138e['includes'](_0x5e79c3[_0xe131('0x3b')][_0xe131('0x29')]);});_[_0xe131('0x6a')](_0x3c9025[_0xe131('0x66')][_0xe131('0x30')],function(_0x3a50ae){return _0x3a50ae[_0xe131('0x6b')]===_0xe131('0x6c');});return{'count':_0x3c9025[_0xe131('0x66')][_0xe131('0x30')][_0xe131('0x32')],'rows':_[_0xe131('0x3a')](_0x3c9025[_0xe131('0x66')]['fields'],function(_0x19acea){return{'id':_0x19acea[_0xe131('0x29')],'name':_0x19acea[_0xe131('0x6d')],'custom':_[_0xe131('0x6e')](_0x19acea['name'],_0xe131('0x6f'))?!![]:![],'options':_0x19acea[_0xe131('0x3b')][_0xe131('0x29')]===_0xe131('0x70')&&_0x19acea['type'][_0xe131('0x71')][_0xe131('0x32')]>0x0?_[_0xe131('0x3a')](_0x19acea['type'][_0xe131('0x71')],function(_0x5ad03e){return{'name':_0x5ad03e[_0xe131('0x6d')],'value':_0x5ad03e['value']};}):[]};})};}})['then'](respondWithResult(_0x374fca,null))[_0xe131('0x4a')](function(_0x221684){console['log'](_0xe131('0x72')+_0x221684);var _0x2072ee=_0x1e2c5b['query'][_0xe131('0x73')]?0x1f4:_0x221684[_0xe131('0x74')]||0x1f4;logger[_0xe131('0x1a')](_0xe131('0x75'),_0xe131('0x76'),_0x2072ee,JSON[_0xe131('0x18')](_0x221684));delete _0x221684[_0xe131('0x29')];if(_0x2072ee===0x191){_0x2072ee=0x190;}_0x374fca['status'](_0x2072ee)[_0xe131('0x2a')](_0x1e2c5b[_0xe131('0x2d')][_0xe131('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x221684[_0xe131('0x74')]}:_0x221684);});}; \ No newline at end of file +var _0xcf66=['ioredis','../../config/logger','api','../../config/utils','../../config/environment','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','set','Content-Range','save','update','destroy','sendStatus','stack','name','send','index','VtigerAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','key','VIRTUAL','field','include','findAll','rows','show','params','includeAll','find','create','body','getConfigurations','findOne','map','options','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','format','%s/webservice.php','getchallenge','success','POST','token','GET','describe','sessionName','autogenerated','reference','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0xcf66,0x71));var _0x6cf6=function(_0x19442d,_0x5d8f7f){_0x19442d=_0x19442d-0x0;var _0x5a4ba0=_0xcf66[_0x19442d];return _0x5a4ba0;};'use strict';var pdf=require(_0x6cf6('0x0'));var emlformat=require(_0x6cf6('0x1'));var rimraf=require(_0x6cf6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6cf6('0x3'));var rp=require(_0x6cf6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6cf6('0x5'));var util=require(_0x6cf6('0x6'));var path=require('path');var sox=require(_0x6cf6('0x7'));var csv=require(_0x6cf6('0x8'));var ejs=require(_0x6cf6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6cf6('0xa'));var crypto=require(_0x6cf6('0xb'));var jsforce=require(_0x6cf6('0xc'));var deskjs=require(_0x6cf6('0xd'));var toCsv=require(_0x6cf6('0x8'));var querystring=require(_0x6cf6('0xe'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x6cf6('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x6cf6('0x10'))(_0x6cf6('0x11'));var utils=require(_0x6cf6('0x12'));var config=require(_0x6cf6('0x13'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x6cf6('0x14')][_0x6cf6('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x372d12,_0x39e8c3,_0x3e62a7,_0x114c2c){return new BPromise(function(_0x57909f,_0x32fe64){var _0x494ece=_0x114c2c||client;return _0x494ece[_0x6cf6('0x16')](_0x372d12,_0x3e62a7)[_0x6cf6('0x17')](function(_0x4b073f){logger[_0x6cf6('0x18')](_0x6cf6('0x19'),_0x39e8c3,_0x6cf6('0x1a'));logger[_0x6cf6('0x1b')](_0x6cf6('0x1c'),_0x39e8c3,_0x6cf6('0x1a'),JSON[_0x6cf6('0x1d')](_0x4b073f));if(_0x4b073f[_0x6cf6('0x1e')]){if(_0x4b073f[_0x6cf6('0x1e')][_0x6cf6('0x1f')]===0x1f4){logger['error'](_0x6cf6('0x19'),_0x39e8c3,_0x4b073f[_0x6cf6('0x1e')][_0x6cf6('0x20')]);return _0x32fe64(_0x4b073f['error'][_0x6cf6('0x20')]);}logger[_0x6cf6('0x1e')](_0x6cf6('0x19'),_0x39e8c3,_0x4b073f[_0x6cf6('0x1e')][_0x6cf6('0x20')]);return _0x57909f(_0x4b073f[_0x6cf6('0x1e')][_0x6cf6('0x20')]);}else{logger['info'](_0x6cf6('0x19'),_0x39e8c3,_0x6cf6('0x1a'));_0x57909f(_0x4b073f[_0x6cf6('0x21')][_0x6cf6('0x20')]);}})[_0x6cf6('0x22')](function(_0x470ea4){logger[_0x6cf6('0x1e')](_0x6cf6('0x19'),_0x39e8c3,_0x470ea4);_0x32fe64(_0x470ea4);});});}function respondWithStatusCode(_0x5b2767,_0x5b30e0){_0x5b30e0=_0x5b30e0||0xcc;return function(_0x276225){if(_0x276225){return _0x5b2767['sendStatus'](_0x5b30e0);}return _0x5b2767[_0x6cf6('0x23')](_0x5b30e0)[_0x6cf6('0x24')]();};}function respondWithResult(_0x14ae3e,_0x448f26){_0x448f26=_0x448f26||0xc8;return function(_0x3f9871){if(_0x3f9871){return _0x14ae3e[_0x6cf6('0x23')](_0x448f26)[_0x6cf6('0x25')](_0x3f9871);}};}function respondWithFilteredResult(_0x4e0e85,_0x2779b7){return function(_0xc7b489){if(_0xc7b489){var _0x3eaa31=_0xc7b489[_0x6cf6('0x26')],_0x558405=_0x2779b7[_0x6cf6('0x27')],_0xf4eec5=_0x2779b7['offset']+_0x2779b7['limit'],_0x2e56ca;if(_0xf4eec5>=_0x3eaa31){_0xf4eec5=_0x3eaa31;_0x2e56ca=0xc8;}else{_0x2e56ca=0xce;}_0x4e0e85[_0x6cf6('0x23')](_0x2e56ca);return _0x4e0e85[_0x6cf6('0x28')](_0x6cf6('0x29'),_0x558405+'-'+_0xf4eec5+'/'+_0x3eaa31)[_0x6cf6('0x25')](_0xc7b489);}return null;};}function patchUpdates(_0x5ccc8f){return function(_0x2afc06){try{jsonpatch['apply'](_0x2afc06,_0x5ccc8f,!![]);}catch(_0x4ceeb9){return BPromise['reject'](_0x4ceeb9);}return _0x2afc06[_0x6cf6('0x2a')]();};}function saveUpdates(_0x65433,_0x33d308){return function(_0x42f488){if(_0x42f488){return _0x42f488[_0x6cf6('0x2b')](_0x65433)['then'](function(_0x348d9e){return _0x348d9e;});}return null;};}function removeEntity(_0x2ae422,_0x356340){return function(_0x535b28){if(_0x535b28){return _0x535b28[_0x6cf6('0x2c')]()[_0x6cf6('0x17')](function(){_0x2ae422[_0x6cf6('0x23')](0xcc)[_0x6cf6('0x24')]();});}};}function handleEntityNotFound(_0x197c7e,_0x1339a2){return function(_0x11f66d){if(!_0x11f66d){_0x197c7e[_0x6cf6('0x2d')](0x194);}return _0x11f66d;};}function handleError(_0x22f23b,_0x3d0b22){_0x3d0b22=_0x3d0b22||0x1f4;return function(_0x16d34f){logger[_0x6cf6('0x1e')](_0x16d34f[_0x6cf6('0x2e')]);if(_0x16d34f[_0x6cf6('0x2f')]){delete _0x16d34f[_0x6cf6('0x2f')];}_0x22f23b[_0x6cf6('0x23')](_0x3d0b22)[_0x6cf6('0x30')](_0x16d34f);};}exports[_0x6cf6('0x31')]=function(_0x5cc6cd,_0xa18a04){var _0x3314a3={},_0x19e94d={},_0xa1f482={'count':0x0,'rows':[]};var _0x10f3c4=db[_0x6cf6('0x32')][_0x6cf6('0x33')];_0x19e94d[_0x6cf6('0x34')]=_[_0x6cf6('0x35')](_0x10f3c4);_0x19e94d[_0x6cf6('0x36')]=_[_0x6cf6('0x35')](_0x5cc6cd['query']);_0x19e94d[_0x6cf6('0x37')]=_[_0x6cf6('0x38')](_0x19e94d[_0x6cf6('0x34')],_0x19e94d[_0x6cf6('0x36')]);_0x3314a3[_0x6cf6('0x39')]=_[_0x6cf6('0x38')](_0x19e94d[_0x6cf6('0x34')],qs[_0x6cf6('0x3a')](_0x5cc6cd[_0x6cf6('0x36')]['fields']));_0x3314a3[_0x6cf6('0x39')]=_0x3314a3[_0x6cf6('0x39')][_0x6cf6('0x3b')]?_0x3314a3[_0x6cf6('0x39')]:_0x19e94d[_0x6cf6('0x34')];if(!_0x5cc6cd[_0x6cf6('0x36')][_0x6cf6('0x3c')](_0x6cf6('0x3d'))){_0x3314a3[_0x6cf6('0x3e')]=qs['limit'](_0x5cc6cd[_0x6cf6('0x36')]['limit']);_0x3314a3[_0x6cf6('0x27')]=qs[_0x6cf6('0x27')](_0x5cc6cd[_0x6cf6('0x36')][_0x6cf6('0x27')]);}_0x3314a3[_0x6cf6('0x3f')]=qs[_0x6cf6('0x40')](_0x5cc6cd[_0x6cf6('0x36')][_0x6cf6('0x40')]);_0x3314a3['where']=qs[_0x6cf6('0x37')](_[_0x6cf6('0x41')](_0x5cc6cd['query'],_0x19e94d[_0x6cf6('0x37')]));if(_0x5cc6cd[_0x6cf6('0x36')][_0x6cf6('0x42')]){_0x3314a3['where']=_[_0x6cf6('0x43')](_0x3314a3[_0x6cf6('0x44')],{'$or':_['map'](_0x10f3c4,function(_0x3f1084){if(_0x3f1084[_0x6cf6('0x45')][_0x6cf6('0x46')]!==_0x6cf6('0x47')){var _0x41195e={};_0x41195e[_0x3f1084[_0x6cf6('0x48')]]={'$like':'%'+_0x5cc6cd[_0x6cf6('0x36')]['filter']+'%'};return _0x41195e;}})});}_0x3314a3=_[_0x6cf6('0x43')]({},_0x3314a3,_0x5cc6cd['options']);var _0x114a4a={'where':_0x3314a3[_0x6cf6('0x44')]};return db['VtigerAccount'][_0x6cf6('0x26')](_0x114a4a)[_0x6cf6('0x17')](function(_0x235f37){_0xa1f482[_0x6cf6('0x26')]=_0x235f37;if(_0x5cc6cd[_0x6cf6('0x36')]['includeAll']){_0x3314a3[_0x6cf6('0x49')]=[{'all':!![]}];}return db[_0x6cf6('0x32')][_0x6cf6('0x4a')](_0x3314a3);})['then'](function(_0x10168f){_0xa1f482[_0x6cf6('0x4b')]=_0x10168f;return _0xa1f482;})[_0x6cf6('0x17')](respondWithFilteredResult(_0xa18a04,_0x3314a3))['catch'](handleError(_0xa18a04,null));};exports[_0x6cf6('0x4c')]=function(_0x5c08b3,_0x586e8d){var _0x31a7c9={'raw':![],'where':{'id':_0x5c08b3[_0x6cf6('0x4d')]['id']}},_0x37edba={};_0x37edba[_0x6cf6('0x34')]=_[_0x6cf6('0x35')](db[_0x6cf6('0x32')][_0x6cf6('0x33')]);_0x37edba[_0x6cf6('0x36')]=_[_0x6cf6('0x35')](_0x5c08b3[_0x6cf6('0x36')]);_0x37edba[_0x6cf6('0x37')]=_[_0x6cf6('0x38')](_0x37edba[_0x6cf6('0x34')],_0x37edba['query']);_0x31a7c9[_0x6cf6('0x39')]=_[_0x6cf6('0x38')](_0x37edba['model'],qs['fields'](_0x5c08b3[_0x6cf6('0x36')][_0x6cf6('0x3a')]));_0x31a7c9[_0x6cf6('0x39')]=_0x31a7c9[_0x6cf6('0x39')][_0x6cf6('0x3b')]?_0x31a7c9[_0x6cf6('0x39')]:_0x37edba['model'];if(_0x5c08b3[_0x6cf6('0x36')][_0x6cf6('0x4e')]){_0x31a7c9[_0x6cf6('0x49')]=[{'all':!![]}];}_0x31a7c9=_['merge']({},_0x31a7c9,_0x5c08b3['options']);return db[_0x6cf6('0x32')][_0x6cf6('0x4f')](_0x31a7c9)[_0x6cf6('0x17')](handleEntityNotFound(_0x586e8d,null))[_0x6cf6('0x17')](respondWithResult(_0x586e8d,null))[_0x6cf6('0x22')](handleError(_0x586e8d,null));};exports[_0x6cf6('0x50')]=function(_0x2cb470,_0x3e8aee){return db[_0x6cf6('0x32')][_0x6cf6('0x50')](_0x2cb470['body'],{})[_0x6cf6('0x17')](respondWithResult(_0x3e8aee,0xc9))[_0x6cf6('0x22')](handleError(_0x3e8aee,null));};exports[_0x6cf6('0x2b')]=function(_0x131ea6,_0x2fdf83){if(_0x131ea6[_0x6cf6('0x51')]['id']){delete _0x131ea6[_0x6cf6('0x51')]['id'];}return db[_0x6cf6('0x32')][_0x6cf6('0x4f')]({'where':{'id':_0x131ea6[_0x6cf6('0x4d')]['id']}})[_0x6cf6('0x17')](handleEntityNotFound(_0x2fdf83,null))['then'](saveUpdates(_0x131ea6[_0x6cf6('0x51')],null))['then'](respondWithResult(_0x2fdf83,null))[_0x6cf6('0x22')](handleError(_0x2fdf83,null));};exports[_0x6cf6('0x2c')]=function(_0x498539,_0x1fa5b0){return db[_0x6cf6('0x32')][_0x6cf6('0x4f')]({'where':{'id':_0x498539[_0x6cf6('0x4d')]['id']}})[_0x6cf6('0x17')](handleEntityNotFound(_0x1fa5b0,null))[_0x6cf6('0x17')](removeEntity(_0x1fa5b0,null))['catch'](handleError(_0x1fa5b0,null));};exports[_0x6cf6('0x52')]=function(_0x167356,_0x160c7f,_0x511655){var _0x4f1de3={};var _0x2c8736={};var _0x140ed2;var _0x5daf8e;return db[_0x6cf6('0x32')][_0x6cf6('0x53')]({'where':{'id':_0x167356[_0x6cf6('0x4d')]['id']}})[_0x6cf6('0x17')](handleEntityNotFound(_0x160c7f,null))[_0x6cf6('0x17')](function(_0x58ec7e){if(_0x58ec7e){_0x140ed2=_0x58ec7e;_0x2c8736[_0x6cf6('0x34')]=_[_0x6cf6('0x35')](db['VtigerConfiguration']['rawAttributes']);_0x2c8736[_0x6cf6('0x36')]=_[_0x6cf6('0x35')](_0x167356[_0x6cf6('0x36')]);_0x2c8736[_0x6cf6('0x37')]=_[_0x6cf6('0x38')](_0x2c8736['model'],_0x2c8736['query']);_0x4f1de3[_0x6cf6('0x39')]=_[_0x6cf6('0x38')](_0x2c8736[_0x6cf6('0x34')],qs[_0x6cf6('0x3a')](_0x167356[_0x6cf6('0x36')]['fields']));_0x4f1de3['attributes']=_0x4f1de3['attributes'][_0x6cf6('0x3b')]?_0x4f1de3[_0x6cf6('0x39')]:_0x2c8736[_0x6cf6('0x34')];_0x4f1de3[_0x6cf6('0x3f')]=qs['sort'](_0x167356[_0x6cf6('0x36')]['sort']);_0x4f1de3[_0x6cf6('0x44')]=qs['filters'](_[_0x6cf6('0x41')](_0x167356[_0x6cf6('0x36')],_0x2c8736[_0x6cf6('0x37')]));if(_0x167356[_0x6cf6('0x36')][_0x6cf6('0x42')]){_0x4f1de3['where']=_[_0x6cf6('0x43')](_0x4f1de3['where'],{'$or':_[_0x6cf6('0x54')](_0x4f1de3['attributes'],function(_0x4363f7){var _0x549c0b={};_0x549c0b[_0x4363f7]={'$like':'%'+_0x167356[_0x6cf6('0x36')][_0x6cf6('0x42')]+'%'};return _0x549c0b;})});}_0x4f1de3=_['merge']({},_0x4f1de3,_0x167356[_0x6cf6('0x55')]);return _0x140ed2[_0x6cf6('0x52')](_0x4f1de3);}})[_0x6cf6('0x17')](function(_0x24c701){if(_0x24c701){_0x5daf8e=_0x24c701[_0x6cf6('0x3b')];if(!_0x167356[_0x6cf6('0x36')][_0x6cf6('0x3c')]('nolimit')){_0x4f1de3['limit']=qs[_0x6cf6('0x3e')](_0x167356[_0x6cf6('0x36')]['limit']);_0x4f1de3[_0x6cf6('0x27')]=qs['offset'](_0x167356['query'][_0x6cf6('0x27')]);}return _0x140ed2['getConfigurations'](_0x4f1de3);}})['then'](function(_0x454f20){if(_0x454f20){return _0x454f20?{'count':_0x5daf8e,'rows':_0x454f20}:null;}})[_0x6cf6('0x17')](respondWithResult(_0x160c7f,null))[_0x6cf6('0x22')](handleError(_0x160c7f,null));};exports['addConfiguration']=function(_0x18b60c,_0x4a2451,_0x2dedba){if(_0x18b60c[_0x6cf6('0x51')]['id']){delete _0x18b60c['body']['id'];}return db[_0x6cf6('0x32')][_0x6cf6('0x53')]({'where':{'id':_0x18b60c[_0x6cf6('0x4d')]['id']}})[_0x6cf6('0x17')](handleEntityNotFound(_0x4a2451,null))[_0x6cf6('0x17')](function(_0x40ea5e){if(_0x40ea5e){_0x18b60c['body'][_0x6cf6('0x56')]=_0x40ea5e['id'];_0x18b60c[_0x6cf6('0x51')][_0x6cf6('0x57')]=integrations[_0x6cf6('0x58')](_0x18b60c[_0x6cf6('0x51')][_0x6cf6('0x59')],_0x18b60c['body']['type']);_0x18b60c['body'][_0x6cf6('0x5a')]=integrations['getDescriptions'](_0x18b60c[_0x6cf6('0x51')]['channel'],_0x18b60c[_0x6cf6('0x51')][_0x6cf6('0x45')]);return db['VtigerConfiguration'][_0x6cf6('0x50')](_0x18b60c[_0x6cf6('0x51')],{'include':[{'model':db[_0x6cf6('0x5b')],'as':'Subjects'},{'model':db[_0x6cf6('0x5b')],'as':'Descriptions'}]});}return null;})[_0x6cf6('0x17')](respondWithResult(_0x4a2451,null))[_0x6cf6('0x22')](handleError(_0x4a2451,null));};var md5=require(_0x6cf6('0x5c'));exports[_0x6cf6('0x5d')]=function(_0x33b436,_0x3336f9,_0x187ef2){var _0x4df5a8=null;var _0x317e1a=null;var _0x5d7d29=null;var _0x3f3d67=null;var _0xdb7124='';return db[_0x6cf6('0x32')][_0x6cf6('0x53')]({'where':{'id':_0x33b436['params']['id']},'attributes':['id','name',_0x6cf6('0x5e'),_0x6cf6('0x5f'),_0x6cf6('0x60'),_0x6cf6('0x61'),_0x6cf6('0x62'),_0x6cf6('0x63')]})['then'](handleEntityNotFound(_0x3336f9,null))['then'](function(_0x1c73bf){if(_0x1c73bf){_0x4df5a8=_0x1c73bf['username'];_0x317e1a=_0x1c73bf[_0x6cf6('0x63')];_0x5d7d29=_0x1c73bf[_0x6cf6('0x60')];_0xdb7124=_0x1c73bf[_0x6cf6('0x61')];var _0x1e5df1=_0xdb7124['slice'](-0x1);if(_0x1e5df1==='/'){_0xdb7124=_0xdb7124[_0x6cf6('0x64')](0x0,_0xdb7124['lastIndexOf'](_0x1e5df1));}_0x3f3d67=util[_0x6cf6('0x65')](_0x6cf6('0x66'),_0xdb7124);var _0x6e0794={'method':'GET','uri':_0x3f3d67,'qs':{'operation':_0x6cf6('0x67'),'username':_0x1c73bf[_0x6cf6('0x5e')]},'json':!![]};return rp(_0x6e0794);}})[_0x6cf6('0x17')](function(_0x4c4c6c){if(_0x4c4c6c[_0x6cf6('0x68')]){var _0x4572={'method':_0x6cf6('0x69'),'uri':_0x3f3d67,'form':{'operation':'login','username':_0x4df5a8,'accessKey':md5(_0x4c4c6c['result'][_0x6cf6('0x6a')]+_0x317e1a)},'json':!![]};return rp(_0x4572);}})['then'](function(_0x4c3136){if(_0x4c3136[_0x6cf6('0x68')]){var _0x4244a4={'method':_0x6cf6('0x6b'),'uri':_0x3f3d67,'qs':{'operation':_0x6cf6('0x6c'),'username':_0x4df5a8,'sessionName':_0x4c3136[_0x6cf6('0x21')][_0x6cf6('0x6d')],'elementType':_0x5d7d29},'json':!![]};return rp(_0x4244a4);}})[_0x6cf6('0x17')](function(_0x36492d){if(_0x36492d[_0x6cf6('0x68')]){var _0x4eb614=[_0x6cf6('0x6e'),_0x6cf6('0x6f'),_0x6cf6('0x70')];_['remove'](_0x36492d['result'][_0x6cf6('0x3a')],function(_0x169a33){return _0x4eb614[_0x6cf6('0x71')](_0x169a33[_0x6cf6('0x45')][_0x6cf6('0x2f')]);});_[_0x6cf6('0x72')](_0x36492d['result'][_0x6cf6('0x3a')],function(_0x17f730){return _0x17f730[_0x6cf6('0x73')]===_0x6cf6('0x74');});return{'count':_0x36492d[_0x6cf6('0x21')][_0x6cf6('0x3a')][_0x6cf6('0x3b')],'rows':_['map'](_0x36492d[_0x6cf6('0x21')][_0x6cf6('0x3a')],function(_0x4ed983){return{'id':_0x4ed983[_0x6cf6('0x2f')],'name':_0x4ed983[_0x6cf6('0x75')],'custom':_[_0x6cf6('0x76')](_0x4ed983['name'],_0x6cf6('0x77'))?!![]:![],'options':_0x4ed983[_0x6cf6('0x45')][_0x6cf6('0x2f')]===_0x6cf6('0x78')&&_0x4ed983[_0x6cf6('0x45')][_0x6cf6('0x79')]['length']>0x0?_['map'](_0x4ed983['type'][_0x6cf6('0x79')],function(_0x542d76){return{'name':_0x542d76[_0x6cf6('0x75')],'value':_0x542d76[_0x6cf6('0x7a')]};}):[]};})};}})['then'](respondWithResult(_0x3336f9,null))[_0x6cf6('0x22')](function(_0x121249){console[_0x6cf6('0x7b')](_0x6cf6('0x7c')+_0x121249);var _0x100306=_0x33b436['query'][_0x6cf6('0x7d')]?0x1f4:_0x121249[_0x6cf6('0x7e')]||0x1f4;logger[_0x6cf6('0x1e')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x100306,JSON[_0x6cf6('0x1d')](_0x121249));delete _0x121249[_0x6cf6('0x2f')];if(_0x100306===0x191){_0x100306=0x190;}_0x3336f9[_0x6cf6('0x23')](_0x100306)[_0x6cf6('0x30')](_0x33b436[_0x6cf6('0x36')][_0x6cf6('0x7d')]?{'message':_0x6cf6('0x7f'),'statusCode':_0x121249['statusCode']}:_0x121249);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index a488606..f4df019 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 _0x2524=['moment','bluebird','request-promise','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','../../config/logger','api'];(function(_0x31b9ac,_0x44ec7d){var _0x407574=function(_0x578f25){while(--_0x578f25){_0x31b9ac['push'](_0x31b9ac['shift']());}};_0x407574(++_0x44ec7d);}(_0x2524,0x14c));var _0x4252=function(_0x5df78f,_0x287bd7){_0x5df78f=_0x5df78f-0x0;var _0x4a49a5=_0x2524[_0x5df78f];return _0x4a49a5;};'use strict';var _=require(_0x4252('0x0'));var util=require(_0x4252('0x1'));var logger=require(_0x4252('0x2'))(_0x4252('0x3'));var moment=require(_0x4252('0x4'));var BPromise=require(_0x4252('0x5'));var rp=require(_0x4252('0x6'));var attributes=require(_0x4252('0x7'));var integrations=require(_0x4252('0x8'));module[_0x4252('0x9')]=function(_0x1332cd,_0x28e8f2){return _0x1332cd[_0x4252('0xa')]('VtigerAccount',attributes,{'tableName':_0x4252('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf780=['./intVtigerAccount.attributes','exports','define','lodash','util','api','moment','request-promise'];(function(_0x46cb56,_0x361ed6){var _0x32f490=function(_0x2911c6){while(--_0x2911c6){_0x46cb56['push'](_0x46cb56['shift']());}};_0x32f490(++_0x361ed6);}(_0xf780,0xf3));var _0x0f78=function(_0x9058db,_0x235f2a){_0x9058db=_0x9058db-0x0;var _0x506b86=_0xf780[_0x9058db];return _0x506b86;};'use strict';var _=require(_0x0f78('0x0'));var util=require(_0x0f78('0x1'));var logger=require('../../config/logger')(_0x0f78('0x2'));var moment=require(_0x0f78('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f78('0x4'));var attributes=require(_0x0f78('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x0f78('0x6')]=function(_0x2a233f,_0x9f32f2){return _0x2a233f[_0x0f78('0x7')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 537b686..a0c69d8 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 _0x5375=['stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','options','where','limit','include','map','model','attributes','ShowVtigerAccount','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3c274c,_0x1732b0){var _0x40f4b0=function(_0xd0df4d){while(--_0xd0df4d){_0x3c274c['push'](_0x3c274c['shift']());}};_0x40f4b0(++_0x1732b0);}(_0x5375,0xba));var _0x5537=function(_0x1820fa,_0x2ff9b7){_0x1820fa=_0x1820fa-0x0;var _0xf0f60c=_0x5375[_0x1820fa];return _0xf0f60c;};'use strict';var _=require(_0x5537('0x0'));var util=require('util');var moment=require(_0x5537('0x1'));var BPromise=require(_0x5537('0x2'));var rs=require(_0x5537('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5537('0x4'))['db'];var utils=require(_0x5537('0x5'));var logger=require(_0x5537('0x6'))(_0x5537('0x7'));var config=require(_0x5537('0x8'));var jayson=require(_0x5537('0x9'));var client=jayson[_0x5537('0xa')][_0x5537('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc7bf45,_0x56abbf,_0x58aa36){return new BPromise(function(_0x1df150,_0x38cb23){return client[_0x5537('0xc')](_0xc7bf45,_0x58aa36)[_0x5537('0xd')](function(_0x4b49f4){logger[_0x5537('0xe')](_0x5537('0xf'),_0x56abbf,_0x5537('0x10'));logger['debug'](_0x5537('0x11'),_0x56abbf,'request\x20sent',JSON[_0x5537('0x12')](_0x4b49f4));if(_0x4b49f4[_0x5537('0x13')]){if(_0x4b49f4[_0x5537('0x13')]['code']===0x1f4){logger[_0x5537('0x13')](_0x5537('0xf'),_0x56abbf,_0x4b49f4['error']['message']);return _0x38cb23(_0x4b49f4[_0x5537('0x13')][_0x5537('0x14')]);}logger[_0x5537('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x56abbf,_0x4b49f4[_0x5537('0x13')][_0x5537('0x14')]);return _0x1df150(_0x4b49f4[_0x5537('0x13')][_0x5537('0x14')]);}else{logger[_0x5537('0xe')](_0x5537('0xf'),_0x56abbf,_0x5537('0x10'));_0x1df150(_0x4b49f4[_0x5537('0x15')]['message']);}})[_0x5537('0x16')](function(_0x40f108){logger[_0x5537('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x56abbf,_0x40f108);_0x38cb23(_0x40f108);});});}exports[_0x5537('0x17')]=function(_0x56c89f){var _0x3f2feb=this;return new Promise(function(_0xa10c83,_0x16b74b){return db[_0x5537('0x18')]['findAll']({'raw':_0x56c89f[_0x5537('0x19')]?_0x56c89f[_0x5537('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x56c89f[_0x5537('0x19')]?_0x56c89f[_0x5537('0x19')][_0x5537('0x1a')]||null:null,'attributes':_0x56c89f[_0x5537('0x19')]?_0x56c89f[_0x5537('0x19')]['attributes']||null:null,'limit':_0x56c89f[_0x5537('0x19')]?_0x56c89f[_0x5537('0x19')][_0x5537('0x1b')]||null:null,'include':_0x56c89f['options']?_0x56c89f['options'][_0x5537('0x1c')]?_[_0x5537('0x1d')](_0x56c89f[_0x5537('0x19')][_0x5537('0x1c')],function(_0x11ea36){return{'model':db[_0x11ea36[_0x5537('0x1e')]],'as':_0x11ea36['as'],'attributes':_0x11ea36['attributes'],'include':_0x11ea36[_0x5537('0x1c')]?_[_0x5537('0x1d')](_0x11ea36['include'],function(_0x17dcdd){return{'model':db[_0x17dcdd['model']],'as':_0x17dcdd['as'],'attributes':_0x17dcdd['attributes'],'include':_0x17dcdd['include']?_[_0x5537('0x1d')](_0x17dcdd[_0x5537('0x1c')],function(_0x737b21){return{'model':db[_0x737b21[_0x5537('0x1e')]],'as':_0x737b21['as'],'attributes':_0x737b21[_0x5537('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x947e89){logger[_0x5537('0xe')](_0x5537('0x17'),_0x56c89f);logger['debug']('GetVtigerAccount',_0x56c89f,JSON['stringify'](_0x947e89));_0xa10c83(_0x947e89);})[_0x5537('0x16')](function(_0x47932e){logger[_0x5537('0x13')](_0x5537('0x17'),_0x47932e['message'],_0x56c89f);_0x16b74b(_0x3f2feb[_0x5537('0x13')](0x1f4,_0x47932e[_0x5537('0x14')]));});});};exports[_0x5537('0x20')]=function(_0x43ae93){var _0x404030=this;return new Promise(function(_0x4f67b2,_0x20932d){return db[_0x5537('0x18')]['find']({'raw':_0x43ae93[_0x5537('0x19')]?_0x43ae93[_0x5537('0x19')][_0x5537('0x21')]===undefined?!![]:![]:!![],'where':_0x43ae93['options']?_0x43ae93[_0x5537('0x19')][_0x5537('0x1a')]||null:null,'attributes':_0x43ae93[_0x5537('0x19')]?_0x43ae93['options'][_0x5537('0x1f')]||null:null,'include':_0x43ae93['options']?_0x43ae93[_0x5537('0x19')][_0x5537('0x1c')]?_[_0x5537('0x1d')](_0x43ae93[_0x5537('0x19')][_0x5537('0x1c')],function(_0x55b5ea){return{'model':db[_0x55b5ea[_0x5537('0x1e')]],'as':_0x55b5ea['as'],'attributes':_0x55b5ea[_0x5537('0x1f')],'include':_0x55b5ea['include']?_[_0x5537('0x1d')](_0x55b5ea[_0x5537('0x1c')],function(_0x557767){return{'model':db[_0x557767['model']],'as':_0x557767['as'],'attributes':_0x557767['attributes'],'include':_0x557767[_0x5537('0x1c')]?_['map'](_0x557767[_0x5537('0x1c')],function(_0x35b8fd){return{'model':db[_0x35b8fd[_0x5537('0x1e')]],'as':_0x35b8fd['as'],'attributes':_0x35b8fd[_0x5537('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5537('0xd')](function(_0x150f3f){logger[_0x5537('0xe')](_0x5537('0x20'),_0x43ae93);logger['debug']('ShowVtigerAccount',_0x43ae93,JSON[_0x5537('0x12')](_0x150f3f));_0x4f67b2(_0x150f3f);})['catch'](function(_0x55e089){logger['error'](_0x5537('0x20'),_0x55e089[_0x5537('0x14')],_0x43ae93);_0x20932d(_0x404030['error'](0x1f4,_0x55e089[_0x5537('0x14')]));});});}; \ No newline at end of file +var _0x8959=['limit','include','map','model','catch','ShowVtigerAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x8959,0x1e2));var _0x9895=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x8959[_0x673722];return _0x21249c;};'use strict';var _=require(_0x9895('0x0'));var util=require(_0x9895('0x1'));var moment=require(_0x9895('0x2'));var BPromise=require('bluebird');var rs=require(_0x9895('0x3'));var fs=require('fs');var Redis=require(_0x9895('0x4'));var db=require(_0x9895('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9895('0x6'));var client=jayson[_0x9895('0x7')][_0x9895('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1efb20,_0x15d42f,_0xbd373a){return new BPromise(function(_0x32d727,_0x5ddd76){return client[_0x9895('0x9')](_0x1efb20,_0xbd373a)[_0x9895('0xa')](function(_0x36cfba){logger[_0x9895('0xb')](_0x9895('0xc'),_0x15d42f,_0x9895('0xd'));logger[_0x9895('0xe')](_0x9895('0xf'),_0x15d42f,'request\x20sent',JSON[_0x9895('0x10')](_0x36cfba));if(_0x36cfba[_0x9895('0x11')]){if(_0x36cfba[_0x9895('0x11')][_0x9895('0x12')]===0x1f4){logger[_0x9895('0x11')](_0x9895('0xc'),_0x15d42f,_0x36cfba[_0x9895('0x11')][_0x9895('0x13')]);return _0x5ddd76(_0x36cfba[_0x9895('0x11')][_0x9895('0x13')]);}logger[_0x9895('0x11')](_0x9895('0xc'),_0x15d42f,_0x36cfba[_0x9895('0x11')]['message']);return _0x32d727(_0x36cfba[_0x9895('0x11')][_0x9895('0x13')]);}else{logger[_0x9895('0xb')](_0x9895('0xc'),_0x15d42f,_0x9895('0xd'));_0x32d727(_0x36cfba[_0x9895('0x14')]['message']);}})['catch'](function(_0x38fe50){logger[_0x9895('0x11')](_0x9895('0xc'),_0x15d42f,_0x38fe50);_0x5ddd76(_0x38fe50);});});}exports[_0x9895('0x15')]=function(_0x11b818){var _0x6d47db=this;return new Promise(function(_0x47e37e,_0x42cd02){return db[_0x9895('0x16')][_0x9895('0x17')]({'raw':_0x11b818[_0x9895('0x18')]?_0x11b818[_0x9895('0x18')][_0x9895('0x19')]===undefined?!![]:![]:!![],'where':_0x11b818[_0x9895('0x18')]?_0x11b818['options'][_0x9895('0x1a')]||null:null,'attributes':_0x11b818[_0x9895('0x18')]?_0x11b818[_0x9895('0x18')][_0x9895('0x1b')]||null:null,'limit':_0x11b818[_0x9895('0x18')]?_0x11b818[_0x9895('0x18')][_0x9895('0x1c')]||null:null,'include':_0x11b818['options']?_0x11b818[_0x9895('0x18')][_0x9895('0x1d')]?_[_0x9895('0x1e')](_0x11b818[_0x9895('0x18')][_0x9895('0x1d')],function(_0x2fe594){return{'model':db[_0x2fe594[_0x9895('0x1f')]],'as':_0x2fe594['as'],'attributes':_0x2fe594['attributes'],'include':_0x2fe594['include']?_[_0x9895('0x1e')](_0x2fe594[_0x9895('0x1d')],function(_0xee0588){return{'model':db[_0xee0588['model']],'as':_0xee0588['as'],'attributes':_0xee0588[_0x9895('0x1b')],'include':_0xee0588['include']?_[_0x9895('0x1e')](_0xee0588[_0x9895('0x1d')],function(_0x151268){return{'model':db[_0x151268[_0x9895('0x1f')]],'as':_0x151268['as'],'attributes':_0x151268[_0x9895('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9895('0xa')](function(_0x373628){logger[_0x9895('0xb')]('GetVtigerAccount',_0x11b818);logger[_0x9895('0xe')](_0x9895('0x15'),_0x11b818,JSON[_0x9895('0x10')](_0x373628));_0x47e37e(_0x373628);})[_0x9895('0x20')](function(_0x2a485e){logger['error'](_0x9895('0x15'),_0x2a485e[_0x9895('0x13')],_0x11b818);_0x42cd02(_0x6d47db['error'](0x1f4,_0x2a485e['message']));});});};exports[_0x9895('0x21')]=function(_0x5d0c03){var _0x19b4b5=this;return new Promise(function(_0x7ba00b,_0x21f68d){return db[_0x9895('0x16')]['find']({'raw':_0x5d0c03[_0x9895('0x18')]?_0x5d0c03[_0x9895('0x18')][_0x9895('0x19')]===undefined?!![]:![]:!![],'where':_0x5d0c03[_0x9895('0x18')]?_0x5d0c03[_0x9895('0x18')][_0x9895('0x1a')]||null:null,'attributes':_0x5d0c03[_0x9895('0x18')]?_0x5d0c03[_0x9895('0x18')][_0x9895('0x1b')]||null:null,'include':_0x5d0c03[_0x9895('0x18')]?_0x5d0c03[_0x9895('0x18')][_0x9895('0x1d')]?_[_0x9895('0x1e')](_0x5d0c03[_0x9895('0x18')]['include'],function(_0x1d8469){return{'model':db[_0x1d8469[_0x9895('0x1f')]],'as':_0x1d8469['as'],'attributes':_0x1d8469[_0x9895('0x1b')],'include':_0x1d8469[_0x9895('0x1d')]?_[_0x9895('0x1e')](_0x1d8469[_0x9895('0x1d')],function(_0x447c15){return{'model':db[_0x447c15[_0x9895('0x1f')]],'as':_0x447c15['as'],'attributes':_0x447c15[_0x9895('0x1b')],'include':_0x447c15[_0x9895('0x1d')]?_[_0x9895('0x1e')](_0x447c15[_0x9895('0x1d')],function(_0x92a0db){return{'model':db[_0x92a0db[_0x9895('0x1f')]],'as':_0x92a0db['as'],'attributes':_0x92a0db['attributes']};}):[]};}):[]};}):[]:[]})[_0x9895('0xa')](function(_0x44883a){logger[_0x9895('0xb')](_0x9895('0x21'),_0x5d0c03);logger[_0x9895('0xe')](_0x9895('0x21'),_0x5d0c03,JSON[_0x9895('0x10')](_0x44883a));_0x7ba00b(_0x44883a);})['catch'](function(_0x6784a7){logger[_0x9895('0x11')](_0x9895('0x21'),_0x6784a7['message'],_0x5d0c03);_0x21f68d(_0x19b4b5[_0x9895('0x11')](0x1f4,_0x6784a7['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 62ab532..4eff439 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_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/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file +var _0xb7e7=['create','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb7e7[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['getSubjects']);router[_0x7b7e('0x6')](_0x7b7e('0xc'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index f902717..3ee7542 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 _0xdb8d=['sequelize','STRING'];(function(_0x21ba20,_0x38f89b){var _0x5bb012=function(_0x33bf10){while(--_0x33bf10){_0x21ba20['push'](_0x21ba20['shift']());}};_0x5bb012(++_0x38f89b);}(_0xdb8d,0x114));var _0xddb8=function(_0x57862e,_0x2c787f){_0x57862e=_0x57862e-0x0;var _0x1f44ba=_0xdb8d[_0x57862e];return _0x1f44ba;};'use strict';var Sequelize=require(_0xddb8('0x0'));module['exports']={'name':{'type':Sequelize[_0xddb8('0x1')]},'description':{'type':Sequelize[_0xddb8('0x1')]}}; \ No newline at end of file +var _0xccff=['STRING','sequelize','exports'];(function(_0x12f283,_0x1c2efb){var _0x29db43=function(_0x515c6a){while(--_0x515c6a){_0x12f283['push'](_0x12f283['shift']());}};_0x29db43(++_0x1c2efb);}(_0xccff,0xd0));var _0xfccf=function(_0x509dad,_0x1f995f){_0x509dad=_0x509dad-0x0;var _0x21e122=_0xccff[_0x509dad];return _0x21e122;};'use strict';var Sequelize=require(_0xfccf('0x0'));module[_0xfccf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfccf('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 5b116e5..b6ee9fa 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 _0xd4ad=['create','body','getFields','map','getSubjects','findOne','VtigerField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/environment','../../mysqldb','client','http','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','sendStatus','status','end','count','offset','limit','Content-Range','apply','save','update','destroy','stack','name','send','index','VtigerConfiguration','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find'];(function(_0xacef72,_0x4e26a9){var _0x5cdf06=function(_0x6a24){while(--_0x6a24){_0xacef72['push'](_0xacef72['shift']());}};_0x5cdf06(++_0x4e26a9);}(_0xd4ad,0x158));var _0xdd4a=function(_0xded658,_0x52bfb4){_0xded658=_0xded658-0x0;var _0x4c02f7=_0xd4ad[_0xded658];return _0x4c02f7;};'use strict';var pdf=require(_0xdd4a('0x0'));var emlformat=require(_0xdd4a('0x1'));var rimraf=require(_0xdd4a('0x2'));var zipdir=require(_0xdd4a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd4a('0x4'));var moment=require(_0xdd4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdd4a('0x6'));var path=require(_0xdd4a('0x7'));var sox=require('sox');var csv=require(_0xdd4a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd4a('0x9'));var squel=require(_0xdd4a('0xa'));var crypto=require('crypto');var jsforce=require(_0xdd4a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd4a('0x8'));var querystring=require(_0xdd4a('0xc'));var Papa=require(_0xdd4a('0xd'));var authService=require(_0xdd4a('0xe'));var hardwareService=require(_0xdd4a('0xf'));var Redis=require(_0xdd4a('0x10'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xdd4a('0x11'));var utils=require('../../config/utils');var config=require(_0xdd4a('0x12'));var db=require(_0xdd4a('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xdd4a('0x14')][_0xdd4a('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x5dbd15,_0x470d57,_0x5490c0,_0x2a24de){return new BPromise(function(_0x55a374,_0xdf80d0){var _0x5bdf76=_0x2a24de||client;return _0x5bdf76['request'](_0x5dbd15,_0x5490c0)[_0xdd4a('0x16')](function(_0x52d623){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x470d57,_0xdd4a('0x17'));logger[_0xdd4a('0x18')](_0xdd4a('0x19'),_0x470d57,_0xdd4a('0x17'),JSON[_0xdd4a('0x1a')](_0x52d623));if(_0x52d623[_0xdd4a('0x1b')]){if(_0x52d623[_0xdd4a('0x1b')][_0xdd4a('0x1c')]===0x1f4){logger['error'](_0xdd4a('0x1d'),_0x470d57,_0x52d623[_0xdd4a('0x1b')]['message']);return _0xdf80d0(_0x52d623[_0xdd4a('0x1b')][_0xdd4a('0x1e')]);}logger['error'](_0xdd4a('0x1d'),_0x470d57,_0x52d623[_0xdd4a('0x1b')][_0xdd4a('0x1e')]);return _0x55a374(_0x52d623[_0xdd4a('0x1b')][_0xdd4a('0x1e')]);}else{logger[_0xdd4a('0x1f')](_0xdd4a('0x1d'),_0x470d57,'request\x20sent');_0x55a374(_0x52d623['result']['message']);}})['catch'](function(_0x3585b7){logger[_0xdd4a('0x1b')](_0xdd4a('0x1d'),_0x470d57,_0x3585b7);_0xdf80d0(_0x3585b7);});});}function respondWithStatusCode(_0x32c9f0,_0x3a71f5){_0x3a71f5=_0x3a71f5||0xcc;return function(_0x4f1a8d){if(_0x4f1a8d){return _0x32c9f0[_0xdd4a('0x20')](_0x3a71f5);}return _0x32c9f0[_0xdd4a('0x21')](_0x3a71f5)[_0xdd4a('0x22')]();};}function respondWithResult(_0xe348a5,_0x574050){_0x574050=_0x574050||0xc8;return function(_0x57ad5d){if(_0x57ad5d){return _0xe348a5['status'](_0x574050)['json'](_0x57ad5d);}};}function respondWithFilteredResult(_0x3f80e3,_0x516667){return function(_0x537099){if(_0x537099){var _0x26846d=_0x537099[_0xdd4a('0x23')],_0x160ac1=_0x516667[_0xdd4a('0x24')],_0xf1b39c=_0x516667['offset']+_0x516667[_0xdd4a('0x25')],_0xc29ce4;if(_0xf1b39c>=_0x26846d){_0xf1b39c=_0x26846d;_0xc29ce4=0xc8;}else{_0xc29ce4=0xce;}_0x3f80e3[_0xdd4a('0x21')](_0xc29ce4);return _0x3f80e3['set'](_0xdd4a('0x26'),_0x160ac1+'-'+_0xf1b39c+'/'+_0x26846d)['json'](_0x537099);}return null;};}function patchUpdates(_0x5f1a9e){return function(_0x5b290f){try{jsonpatch[_0xdd4a('0x27')](_0x5b290f,_0x5f1a9e,!![]);}catch(_0x1d347c){return BPromise['reject'](_0x1d347c);}return _0x5b290f[_0xdd4a('0x28')]();};}function saveUpdates(_0x10e531,_0x292d67){return function(_0x4d02fd){if(_0x4d02fd){return _0x4d02fd[_0xdd4a('0x29')](_0x10e531)['then'](function(_0x3521b3){return _0x3521b3;});}return null;};}function removeEntity(_0x36ee4e,_0x87a9a7){return function(_0x5395a3){if(_0x5395a3){return _0x5395a3[_0xdd4a('0x2a')]()[_0xdd4a('0x16')](function(){_0x36ee4e['status'](0xcc)[_0xdd4a('0x22')]();});}};}function handleEntityNotFound(_0x456627,_0x47a3e1){return function(_0x17f253){if(!_0x17f253){_0x456627['sendStatus'](0x194);}return _0x17f253;};}function handleError(_0x3d21fb,_0x20c9d5){_0x20c9d5=_0x20c9d5||0x1f4;return function(_0x122d4a){logger[_0xdd4a('0x1b')](_0x122d4a[_0xdd4a('0x2b')]);if(_0x122d4a['name']){delete _0x122d4a[_0xdd4a('0x2c')];}_0x3d21fb[_0xdd4a('0x21')](_0x20c9d5)[_0xdd4a('0x2d')](_0x122d4a);};}exports[_0xdd4a('0x2e')]=function(_0x1dd879,_0x5ecde8){var _0x5ea70c={},_0x23156f={},_0x19b9df={'count':0x0,'rows':[]};var _0x50c38d=db[_0xdd4a('0x2f')]['rawAttributes'];_0x23156f[_0xdd4a('0x30')]=_[_0xdd4a('0x31')](_0x50c38d);_0x23156f['query']=_[_0xdd4a('0x31')](_0x1dd879[_0xdd4a('0x32')]);_0x23156f['filters']=_[_0xdd4a('0x33')](_0x23156f['model'],_0x23156f['query']);_0x5ea70c[_0xdd4a('0x34')]=_[_0xdd4a('0x33')](_0x23156f[_0xdd4a('0x30')],qs[_0xdd4a('0x35')](_0x1dd879[_0xdd4a('0x32')][_0xdd4a('0x35')]));_0x5ea70c[_0xdd4a('0x34')]=_0x5ea70c['attributes']['length']?_0x5ea70c[_0xdd4a('0x34')]:_0x23156f[_0xdd4a('0x30')];if(!_0x1dd879['query'][_0xdd4a('0x36')](_0xdd4a('0x37'))){_0x5ea70c[_0xdd4a('0x25')]=qs[_0xdd4a('0x25')](_0x1dd879['query']['limit']);_0x5ea70c[_0xdd4a('0x24')]=qs[_0xdd4a('0x24')](_0x1dd879[_0xdd4a('0x32')]['offset']);}_0x5ea70c[_0xdd4a('0x38')]=qs[_0xdd4a('0x39')](_0x1dd879[_0xdd4a('0x32')][_0xdd4a('0x39')]);_0x5ea70c[_0xdd4a('0x3a')]=qs['filters'](_[_0xdd4a('0x3b')](_0x1dd879[_0xdd4a('0x32')],_0x23156f[_0xdd4a('0x3c')]));if(_0x1dd879[_0xdd4a('0x32')][_0xdd4a('0x3d')]){_0x5ea70c['where']=_[_0xdd4a('0x3e')](_0x5ea70c[_0xdd4a('0x3a')],{'$or':_['map'](_0x50c38d,function(_0x2f5e5b){if(_0x2f5e5b[_0xdd4a('0x3f')][_0xdd4a('0x40')]!==_0xdd4a('0x41')){var _0x51fc98={};_0x51fc98[_0x2f5e5b['field']]={'$like':'%'+_0x1dd879[_0xdd4a('0x32')]['filter']+'%'};return _0x51fc98;}})});}_0x5ea70c=_[_0xdd4a('0x3e')]({},_0x5ea70c,_0x1dd879[_0xdd4a('0x42')]);var _0x19d29d={'where':_0x5ea70c[_0xdd4a('0x3a')]};return db[_0xdd4a('0x2f')][_0xdd4a('0x23')](_0x19d29d)[_0xdd4a('0x16')](function(_0x51dae3){_0x19b9df[_0xdd4a('0x23')]=_0x51dae3;if(_0x1dd879[_0xdd4a('0x32')][_0xdd4a('0x43')]){_0x5ea70c[_0xdd4a('0x44')]=[{'all':!![]}];}return db[_0xdd4a('0x2f')]['findAll'](_0x5ea70c);})[_0xdd4a('0x16')](function(_0x1dc325){_0x19b9df[_0xdd4a('0x45')]=_0x1dc325;return _0x19b9df;})[_0xdd4a('0x16')](respondWithFilteredResult(_0x5ecde8,_0x5ea70c))[_0xdd4a('0x46')](handleError(_0x5ecde8,null));};exports[_0xdd4a('0x47')]=function(_0x453e25,_0x19264b){var _0x23f844={'raw':![],'where':{'id':_0x453e25[_0xdd4a('0x48')]['id']}},_0x1c5aff={};_0x1c5aff[_0xdd4a('0x30')]=_[_0xdd4a('0x31')](db[_0xdd4a('0x2f')][_0xdd4a('0x49')]);_0x1c5aff[_0xdd4a('0x32')]=_['keys'](_0x453e25[_0xdd4a('0x32')]);_0x1c5aff['filters']=_[_0xdd4a('0x33')](_0x1c5aff[_0xdd4a('0x30')],_0x1c5aff[_0xdd4a('0x32')]);_0x23f844[_0xdd4a('0x34')]=_[_0xdd4a('0x33')](_0x1c5aff['model'],qs[_0xdd4a('0x35')](_0x453e25['query']['fields']));_0x23f844[_0xdd4a('0x34')]=_0x23f844[_0xdd4a('0x34')][_0xdd4a('0x4a')]?_0x23f844[_0xdd4a('0x34')]:_0x1c5aff[_0xdd4a('0x30')];if(_0x453e25[_0xdd4a('0x32')]['includeAll']){_0x23f844[_0xdd4a('0x44')]=[{'all':!![]}];}_0x23f844=_[_0xdd4a('0x3e')]({},_0x23f844,_0x453e25['options']);return db[_0xdd4a('0x2f')][_0xdd4a('0x4b')](_0x23f844)['then'](handleEntityNotFound(_0x19264b,null))[_0xdd4a('0x16')](respondWithResult(_0x19264b,null))[_0xdd4a('0x46')](handleError(_0x19264b,null));};exports['create']=function(_0xb34e28,_0x73afd6){return db[_0xdd4a('0x2f')][_0xdd4a('0x4c')](_0xb34e28[_0xdd4a('0x4d')],{})['then'](respondWithResult(_0x73afd6,0xc9))['catch'](handleError(_0x73afd6,null));};exports[_0xdd4a('0x29')]=function(_0x3ca210,_0x161e10){if(_0x3ca210[_0xdd4a('0x4d')]['id']){delete _0x3ca210[_0xdd4a('0x4d')]['id'];}return db['VtigerConfiguration'][_0xdd4a('0x4b')]({'where':{'id':_0x3ca210[_0xdd4a('0x48')]['id']}})[_0xdd4a('0x16')](handleEntityNotFound(_0x161e10,null))[_0xdd4a('0x16')](saveUpdates(_0x3ca210[_0xdd4a('0x4d')],null))['then'](respondWithResult(_0x161e10,null))['catch'](handleError(_0x161e10,null));};exports[_0xdd4a('0x2a')]=function(_0x5e5786,_0x36cbd4){return db[_0xdd4a('0x2f')][_0xdd4a('0x4b')]({'where':{'id':_0x5e5786[_0xdd4a('0x48')]['id']}})[_0xdd4a('0x16')](handleEntityNotFound(_0x36cbd4,null))[_0xdd4a('0x16')](removeEntity(_0x36cbd4,null))['catch'](handleError(_0x36cbd4,null));};exports[_0xdd4a('0x4e')]=function(_0x3aebe6,_0xa71a66,_0x5f097e){var _0x2ead54={};var _0x5c36ee={};var _0x331a95;var _0x3a9be7;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x3aebe6[_0xdd4a('0x48')]['id']}})[_0xdd4a('0x16')](handleEntityNotFound(_0xa71a66,null))[_0xdd4a('0x16')](function(_0x53b933){if(_0x53b933){_0x331a95=_0x53b933;_0x5c36ee[_0xdd4a('0x30')]=_[_0xdd4a('0x31')](db['VtigerField'][_0xdd4a('0x49')]);_0x5c36ee[_0xdd4a('0x32')]=_[_0xdd4a('0x31')](_0x3aebe6['query']);_0x5c36ee['filters']=_[_0xdd4a('0x33')](_0x5c36ee[_0xdd4a('0x30')],_0x5c36ee[_0xdd4a('0x32')]);_0x2ead54[_0xdd4a('0x34')]=_[_0xdd4a('0x33')](_0x5c36ee[_0xdd4a('0x30')],qs['fields'](_0x3aebe6[_0xdd4a('0x32')][_0xdd4a('0x35')]));_0x2ead54['attributes']=_0x2ead54[_0xdd4a('0x34')]['length']?_0x2ead54[_0xdd4a('0x34')]:_0x5c36ee[_0xdd4a('0x30')];_0x2ead54[_0xdd4a('0x38')]=qs[_0xdd4a('0x39')](_0x3aebe6[_0xdd4a('0x32')][_0xdd4a('0x39')]);_0x2ead54[_0xdd4a('0x3a')]=qs[_0xdd4a('0x3c')](_[_0xdd4a('0x3b')](_0x3aebe6[_0xdd4a('0x32')],_0x5c36ee[_0xdd4a('0x3c')]));if(_0x3aebe6[_0xdd4a('0x32')][_0xdd4a('0x3d')]){_0x2ead54[_0xdd4a('0x3a')]=_['merge'](_0x2ead54[_0xdd4a('0x3a')],{'$or':_[_0xdd4a('0x4f')](_0x2ead54[_0xdd4a('0x34')],function(_0x1623cd){var _0x17a6d2={};_0x17a6d2[_0x1623cd]={'$like':'%'+_0x3aebe6[_0xdd4a('0x32')][_0xdd4a('0x3d')]+'%'};return _0x17a6d2;})});}_0x2ead54=_[_0xdd4a('0x3e')]({},_0x2ead54,_0x3aebe6[_0xdd4a('0x42')]);return _0x331a95[_0xdd4a('0x4e')](_0x2ead54);}})[_0xdd4a('0x16')](function(_0x5c0821){if(_0x5c0821){_0x3a9be7=_0x5c0821[_0xdd4a('0x4a')];if(!_0x3aebe6[_0xdd4a('0x32')][_0xdd4a('0x36')]('nolimit')){_0x2ead54[_0xdd4a('0x25')]=qs['limit'](_0x3aebe6[_0xdd4a('0x32')]['limit']);_0x2ead54['offset']=qs[_0xdd4a('0x24')](_0x3aebe6[_0xdd4a('0x32')]['offset']);}return _0x331a95[_0xdd4a('0x4e')](_0x2ead54);}})[_0xdd4a('0x16')](function(_0x2330b2){if(_0x2330b2){return _0x2330b2?{'count':_0x3a9be7,'rows':_0x2330b2}:null;}})[_0xdd4a('0x16')](respondWithResult(_0xa71a66,null))[_0xdd4a('0x46')](handleError(_0xa71a66,null));};exports[_0xdd4a('0x50')]=function(_0x5d497c,_0x1caf80,_0x1f450b){var _0x3dbc43={};var _0xb0057d={};var _0x386608;var _0x503e14;return db[_0xdd4a('0x2f')][_0xdd4a('0x51')]({'where':{'id':_0x5d497c[_0xdd4a('0x48')]['id']}})[_0xdd4a('0x16')](handleEntityNotFound(_0x1caf80,null))[_0xdd4a('0x16')](function(_0x4c1099){if(_0x4c1099){_0x386608=_0x4c1099;_0xb0057d[_0xdd4a('0x30')]=_[_0xdd4a('0x31')](db[_0xdd4a('0x52')][_0xdd4a('0x49')]);_0xb0057d[_0xdd4a('0x32')]=_[_0xdd4a('0x31')](_0x5d497c['query']);_0xb0057d[_0xdd4a('0x3c')]=_['intersection'](_0xb0057d[_0xdd4a('0x30')],_0xb0057d[_0xdd4a('0x32')]);_0x3dbc43['attributes']=_[_0xdd4a('0x33')](_0xb0057d[_0xdd4a('0x30')],qs[_0xdd4a('0x35')](_0x5d497c['query'][_0xdd4a('0x35')]));_0x3dbc43[_0xdd4a('0x34')]=_0x3dbc43[_0xdd4a('0x34')][_0xdd4a('0x4a')]?_0x3dbc43['attributes']:_0xb0057d[_0xdd4a('0x30')];_0x3dbc43[_0xdd4a('0x38')]=qs['sort'](_0x5d497c[_0xdd4a('0x32')][_0xdd4a('0x39')]);_0x3dbc43['where']=qs[_0xdd4a('0x3c')](_['pick'](_0x5d497c[_0xdd4a('0x32')],_0xb0057d[_0xdd4a('0x3c')]));if(_0x5d497c[_0xdd4a('0x32')][_0xdd4a('0x3d')]){_0x3dbc43[_0xdd4a('0x3a')]=_[_0xdd4a('0x3e')](_0x3dbc43[_0xdd4a('0x3a')],{'$or':_[_0xdd4a('0x4f')](_0x3dbc43['attributes'],function(_0x92a603){var _0x138c79={};_0x138c79[_0x92a603]={'$like':'%'+_0x5d497c[_0xdd4a('0x32')]['filter']+'%'};return _0x138c79;})});}_0x3dbc43=_['merge']({},_0x3dbc43,_0x5d497c[_0xdd4a('0x42')]);return _0x386608[_0xdd4a('0x50')](_0x3dbc43);}})[_0xdd4a('0x16')](function(_0x4fb9c1){if(_0x4fb9c1){_0x503e14=_0x4fb9c1['length'];if(!_0x5d497c[_0xdd4a('0x32')]['hasOwnProperty'](_0xdd4a('0x37'))){_0x3dbc43[_0xdd4a('0x25')]=qs[_0xdd4a('0x25')](_0x5d497c[_0xdd4a('0x32')][_0xdd4a('0x25')]);_0x3dbc43['offset']=qs[_0xdd4a('0x24')](_0x5d497c[_0xdd4a('0x32')]['offset']);}return _0x386608['getSubjects'](_0x3dbc43);}})['then'](function(_0xb355b5){if(_0xb355b5){return _0xb355b5?{'count':_0x503e14,'rows':_0xb355b5}:null;}})[_0xdd4a('0x16')](respondWithResult(_0x1caf80,null))[_0xdd4a('0x46')](handleError(_0x1caf80,null));};exports['getDescriptions']=function(_0x2715e0,_0x1a1e12,_0x23ffe7){var _0x5b7e92={};var _0x1e6800={};var _0x12cd6c;var _0x376d1b;return db[_0xdd4a('0x2f')][_0xdd4a('0x51')]({'where':{'id':_0x2715e0[_0xdd4a('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a1e12,null))['then'](function(_0x3a8ef6){if(_0x3a8ef6){_0x12cd6c=_0x3a8ef6;_0x1e6800[_0xdd4a('0x30')]=_[_0xdd4a('0x31')](db[_0xdd4a('0x52')][_0xdd4a('0x49')]);_0x1e6800['query']=_[_0xdd4a('0x31')](_0x2715e0[_0xdd4a('0x32')]);_0x1e6800[_0xdd4a('0x3c')]=_[_0xdd4a('0x33')](_0x1e6800[_0xdd4a('0x30')],_0x1e6800[_0xdd4a('0x32')]);_0x5b7e92[_0xdd4a('0x34')]=_[_0xdd4a('0x33')](_0x1e6800[_0xdd4a('0x30')],qs[_0xdd4a('0x35')](_0x2715e0[_0xdd4a('0x32')][_0xdd4a('0x35')]));_0x5b7e92['attributes']=_0x5b7e92[_0xdd4a('0x34')][_0xdd4a('0x4a')]?_0x5b7e92[_0xdd4a('0x34')]:_0x1e6800[_0xdd4a('0x30')];_0x5b7e92[_0xdd4a('0x38')]=qs[_0xdd4a('0x39')](_0x2715e0[_0xdd4a('0x32')][_0xdd4a('0x39')]);_0x5b7e92['where']=qs['filters'](_[_0xdd4a('0x3b')](_0x2715e0[_0xdd4a('0x32')],_0x1e6800[_0xdd4a('0x3c')]));if(_0x2715e0[_0xdd4a('0x32')][_0xdd4a('0x3d')]){_0x5b7e92[_0xdd4a('0x3a')]=_[_0xdd4a('0x3e')](_0x5b7e92['where'],{'$or':_[_0xdd4a('0x4f')](_0x5b7e92[_0xdd4a('0x34')],function(_0xd7c3ab){var _0x14b6a3={};_0x14b6a3[_0xd7c3ab]={'$like':'%'+_0x2715e0[_0xdd4a('0x32')]['filter']+'%'};return _0x14b6a3;})});}_0x5b7e92=_[_0xdd4a('0x3e')]({},_0x5b7e92,_0x2715e0['options']);return _0x12cd6c[_0xdd4a('0x53')](_0x5b7e92);}})[_0xdd4a('0x16')](function(_0x307a58){if(_0x307a58){_0x376d1b=_0x307a58['length'];if(!_0x2715e0['query']['hasOwnProperty'](_0xdd4a('0x37'))){_0x5b7e92[_0xdd4a('0x25')]=qs[_0xdd4a('0x25')](_0x2715e0['query'][_0xdd4a('0x25')]);_0x5b7e92['offset']=qs[_0xdd4a('0x24')](_0x2715e0['query'][_0xdd4a('0x24')]);}return _0x12cd6c[_0xdd4a('0x53')](_0x5b7e92);}})[_0xdd4a('0x16')](function(_0x46ac74){if(_0x46ac74){return _0x46ac74?{'count':_0x376d1b,'rows':_0x46ac74}:null;}})[_0xdd4a('0x16')](respondWithResult(_0x1a1e12,null))[_0xdd4a('0x46')](handleError(_0x1a1e12,null));}; \ No newline at end of file +var _0x2ffe=['findAll','show','params','find','create','body','findOne','VtigerField','map','getFields','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','set','Content-Range','json','apply','reject','update','destroy','end','sendStatus','name','send','index','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','key','VIRTUAL','field','filter','options','VtigerConfiguration','count','includeAll','include'];(function(_0x4c5eb9,_0x5545f){var _0x25e2c6=function(_0x1f8a03){while(--_0x1f8a03){_0x4c5eb9['push'](_0x4c5eb9['shift']());}};_0x25e2c6(++_0x5545f);}(_0x2ffe,0x6a));var _0xe2ff=function(_0x2e6359,_0x854d95){_0x2e6359=_0x2e6359-0x0;var _0x26aa67=_0x2ffe[_0x2e6359];return _0x26aa67;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe2ff('0x0'));var rimraf=require(_0xe2ff('0x1'));var zipdir=require(_0xe2ff('0x2'));var jsonpatch=require(_0xe2ff('0x3'));var rp=require(_0xe2ff('0x4'));var moment=require('moment');var BPromise=require(_0xe2ff('0x5'));var Mustache=require(_0xe2ff('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe2ff('0x7'));var csv=require(_0xe2ff('0x8'));var ejs=require(_0xe2ff('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe2ff('0xa'));var crypto=require(_0xe2ff('0xb'));var jsforce=require(_0xe2ff('0xc'));var deskjs=require(_0xe2ff('0xd'));var toCsv=require(_0xe2ff('0x8'));var querystring=require(_0xe2ff('0xe'));var Papa=require(_0xe2ff('0xf'));var authService=require(_0xe2ff('0x10'));var hardwareService=require(_0xe2ff('0x11'));var Redis=require(_0xe2ff('0x12'));var qs=require(_0xe2ff('0x13'));var logger=require(_0xe2ff('0x14'))(_0xe2ff('0x15'));var utils=require(_0xe2ff('0x16'));var config=require(_0xe2ff('0x17'));var db=require(_0xe2ff('0x18'))['db'];var jayson=require(_0xe2ff('0x19'));var client=jayson['client'][_0xe2ff('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1e4519,_0x47f1c4,_0x1b2a6a,_0x3061e2){return new BPromise(function(_0x1c60ab,_0x300b70){var _0x19cee9=_0x3061e2||client;return _0x19cee9[_0xe2ff('0x1b')](_0x1e4519,_0x1b2a6a)[_0xe2ff('0x1c')](function(_0x96907c){logger[_0xe2ff('0x1d')](_0xe2ff('0x1e'),_0x47f1c4,_0xe2ff('0x1f'));logger[_0xe2ff('0x20')](_0xe2ff('0x21'),_0x47f1c4,_0xe2ff('0x1f'),JSON[_0xe2ff('0x22')](_0x96907c));if(_0x96907c[_0xe2ff('0x23')]){if(_0x96907c['error'][_0xe2ff('0x24')]===0x1f4){logger[_0xe2ff('0x23')](_0xe2ff('0x1e'),_0x47f1c4,_0x96907c[_0xe2ff('0x23')]['message']);return _0x300b70(_0x96907c[_0xe2ff('0x23')][_0xe2ff('0x25')]);}logger[_0xe2ff('0x23')](_0xe2ff('0x1e'),_0x47f1c4,_0x96907c[_0xe2ff('0x23')][_0xe2ff('0x25')]);return _0x1c60ab(_0x96907c[_0xe2ff('0x23')]['message']);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x47f1c4,'request\x20sent');_0x1c60ab(_0x96907c[_0xe2ff('0x26')][_0xe2ff('0x25')]);}})[_0xe2ff('0x27')](function(_0x2b4d38){logger[_0xe2ff('0x23')](_0xe2ff('0x1e'),_0x47f1c4,_0x2b4d38);_0x300b70(_0x2b4d38);});});}function respondWithStatusCode(_0x335d9c,_0x1d0aa8){_0x1d0aa8=_0x1d0aa8||0xcc;return function(_0x12dc09){if(_0x12dc09){return _0x335d9c['sendStatus'](_0x1d0aa8);}return _0x335d9c[_0xe2ff('0x28')](_0x1d0aa8)['end']();};}function respondWithResult(_0xa6ad9,_0xf16952){_0xf16952=_0xf16952||0xc8;return function(_0x495bb2){if(_0x495bb2){return _0xa6ad9[_0xe2ff('0x28')](_0xf16952)['json'](_0x495bb2);}};}function respondWithFilteredResult(_0x5265b5,_0x497890){return function(_0x373529){if(_0x373529){var _0x4a2954=_0x373529['count'],_0x5582ef=_0x497890['offset'],_0x1a6fcd=_0x497890[_0xe2ff('0x29')]+_0x497890[_0xe2ff('0x2a')],_0x143ed9;if(_0x1a6fcd>=_0x4a2954){_0x1a6fcd=_0x4a2954;_0x143ed9=0xc8;}else{_0x143ed9=0xce;}_0x5265b5[_0xe2ff('0x28')](_0x143ed9);return _0x5265b5[_0xe2ff('0x2b')](_0xe2ff('0x2c'),_0x5582ef+'-'+_0x1a6fcd+'/'+_0x4a2954)[_0xe2ff('0x2d')](_0x373529);}return null;};}function patchUpdates(_0x5baeab){return function(_0xac598b){try{jsonpatch[_0xe2ff('0x2e')](_0xac598b,_0x5baeab,!![]);}catch(_0x42cae4){return BPromise[_0xe2ff('0x2f')](_0x42cae4);}return _0xac598b['save']();};}function saveUpdates(_0xb4ca2a,_0x1da1c8){return function(_0x5e14d9){if(_0x5e14d9){return _0x5e14d9[_0xe2ff('0x30')](_0xb4ca2a)[_0xe2ff('0x1c')](function(_0x32a533){return _0x32a533;});}return null;};}function removeEntity(_0x4c5570,_0x21a601){return function(_0x1034f8){if(_0x1034f8){return _0x1034f8[_0xe2ff('0x31')]()[_0xe2ff('0x1c')](function(){_0x4c5570[_0xe2ff('0x28')](0xcc)[_0xe2ff('0x32')]();});}};}function handleEntityNotFound(_0x4184f3,_0x14fafe){return function(_0x49a4f1){if(!_0x49a4f1){_0x4184f3[_0xe2ff('0x33')](0x194);}return _0x49a4f1;};}function handleError(_0xa8139b,_0x136508){_0x136508=_0x136508||0x1f4;return function(_0x5481ca){logger['error'](_0x5481ca['stack']);if(_0x5481ca['name']){delete _0x5481ca[_0xe2ff('0x34')];}_0xa8139b[_0xe2ff('0x28')](_0x136508)[_0xe2ff('0x35')](_0x5481ca);};}exports[_0xe2ff('0x36')]=function(_0x20403c,_0x41aed6){var _0x7b6050={},_0x519bc2={},_0x3c38be={'count':0x0,'rows':[]};var _0x2fbb29=db['VtigerConfiguration'][_0xe2ff('0x37')];_0x519bc2['model']=_[_0xe2ff('0x38')](_0x2fbb29);_0x519bc2[_0xe2ff('0x39')]=_['keys'](_0x20403c[_0xe2ff('0x39')]);_0x519bc2[_0xe2ff('0x3a')]=_[_0xe2ff('0x3b')](_0x519bc2[_0xe2ff('0x3c')],_0x519bc2['query']);_0x7b6050['attributes']=_[_0xe2ff('0x3b')](_0x519bc2[_0xe2ff('0x3c')],qs[_0xe2ff('0x3d')](_0x20403c['query'][_0xe2ff('0x3d')]));_0x7b6050[_0xe2ff('0x3e')]=_0x7b6050[_0xe2ff('0x3e')][_0xe2ff('0x3f')]?_0x7b6050[_0xe2ff('0x3e')]:_0x519bc2[_0xe2ff('0x3c')];if(!_0x20403c['query'][_0xe2ff('0x40')](_0xe2ff('0x41'))){_0x7b6050[_0xe2ff('0x2a')]=qs[_0xe2ff('0x2a')](_0x20403c[_0xe2ff('0x39')][_0xe2ff('0x2a')]);_0x7b6050[_0xe2ff('0x29')]=qs[_0xe2ff('0x29')](_0x20403c['query'][_0xe2ff('0x29')]);}_0x7b6050[_0xe2ff('0x42')]=qs[_0xe2ff('0x43')](_0x20403c[_0xe2ff('0x39')][_0xe2ff('0x43')]);_0x7b6050[_0xe2ff('0x44')]=qs[_0xe2ff('0x3a')](_['pick'](_0x20403c[_0xe2ff('0x39')],_0x519bc2['filters']));if(_0x20403c['query']['filter']){_0x7b6050[_0xe2ff('0x44')]=_[_0xe2ff('0x45')](_0x7b6050[_0xe2ff('0x44')],{'$or':_['map'](_0x2fbb29,function(_0x3f4572){if(_0x3f4572[_0xe2ff('0x46')][_0xe2ff('0x47')]!==_0xe2ff('0x48')){var _0x3961aa={};_0x3961aa[_0x3f4572[_0xe2ff('0x49')]]={'$like':'%'+_0x20403c[_0xe2ff('0x39')][_0xe2ff('0x4a')]+'%'};return _0x3961aa;}})});}_0x7b6050=_[_0xe2ff('0x45')]({},_0x7b6050,_0x20403c[_0xe2ff('0x4b')]);var _0x1e4c4d={'where':_0x7b6050[_0xe2ff('0x44')]};return db[_0xe2ff('0x4c')][_0xe2ff('0x4d')](_0x1e4c4d)[_0xe2ff('0x1c')](function(_0xa3d34){_0x3c38be[_0xe2ff('0x4d')]=_0xa3d34;if(_0x20403c[_0xe2ff('0x39')][_0xe2ff('0x4e')]){_0x7b6050[_0xe2ff('0x4f')]=[{'all':!![]}];}return db[_0xe2ff('0x4c')][_0xe2ff('0x50')](_0x7b6050);})[_0xe2ff('0x1c')](function(_0xa15a79){_0x3c38be['rows']=_0xa15a79;return _0x3c38be;})[_0xe2ff('0x1c')](respondWithFilteredResult(_0x41aed6,_0x7b6050))['catch'](handleError(_0x41aed6,null));};exports[_0xe2ff('0x51')]=function(_0x27ecaa,_0x12c5dd){var _0x9ddb96={'raw':![],'where':{'id':_0x27ecaa[_0xe2ff('0x52')]['id']}},_0x4acdcb={};_0x4acdcb[_0xe2ff('0x3c')]=_['keys'](db[_0xe2ff('0x4c')]['rawAttributes']);_0x4acdcb[_0xe2ff('0x39')]=_[_0xe2ff('0x38')](_0x27ecaa['query']);_0x4acdcb[_0xe2ff('0x3a')]=_[_0xe2ff('0x3b')](_0x4acdcb['model'],_0x4acdcb['query']);_0x9ddb96[_0xe2ff('0x3e')]=_['intersection'](_0x4acdcb[_0xe2ff('0x3c')],qs[_0xe2ff('0x3d')](_0x27ecaa[_0xe2ff('0x39')][_0xe2ff('0x3d')]));_0x9ddb96[_0xe2ff('0x3e')]=_0x9ddb96[_0xe2ff('0x3e')][_0xe2ff('0x3f')]?_0x9ddb96['attributes']:_0x4acdcb[_0xe2ff('0x3c')];if(_0x27ecaa[_0xe2ff('0x39')][_0xe2ff('0x4e')]){_0x9ddb96[_0xe2ff('0x4f')]=[{'all':!![]}];}_0x9ddb96=_['merge']({},_0x9ddb96,_0x27ecaa[_0xe2ff('0x4b')]);return db[_0xe2ff('0x4c')][_0xe2ff('0x53')](_0x9ddb96)['then'](handleEntityNotFound(_0x12c5dd,null))['then'](respondWithResult(_0x12c5dd,null))[_0xe2ff('0x27')](handleError(_0x12c5dd,null));};exports[_0xe2ff('0x54')]=function(_0x53939a,_0x9934c0){return db[_0xe2ff('0x4c')]['create'](_0x53939a['body'],{})['then'](respondWithResult(_0x9934c0,0xc9))['catch'](handleError(_0x9934c0,null));};exports[_0xe2ff('0x30')]=function(_0x323acf,_0x218044){if(_0x323acf[_0xe2ff('0x55')]['id']){delete _0x323acf['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x323acf[_0xe2ff('0x52')]['id']}})['then'](handleEntityNotFound(_0x218044,null))['then'](saveUpdates(_0x323acf[_0xe2ff('0x55')],null))['then'](respondWithResult(_0x218044,null))[_0xe2ff('0x27')](handleError(_0x218044,null));};exports[_0xe2ff('0x31')]=function(_0x3ae1a7,_0x576d06){return db[_0xe2ff('0x4c')]['find']({'where':{'id':_0x3ae1a7['params']['id']}})['then'](handleEntityNotFound(_0x576d06,null))['then'](removeEntity(_0x576d06,null))[_0xe2ff('0x27')](handleError(_0x576d06,null));};exports['getFields']=function(_0x5b641f,_0x595331,_0x5a2ae2){var _0x21b874={};var _0x3a4ec2={};var _0x19b1c2;var _0xa60f1c;return db[_0xe2ff('0x4c')][_0xe2ff('0x56')]({'where':{'id':_0x5b641f[_0xe2ff('0x52')]['id']}})['then'](handleEntityNotFound(_0x595331,null))[_0xe2ff('0x1c')](function(_0x3eb46e){if(_0x3eb46e){_0x19b1c2=_0x3eb46e;_0x3a4ec2[_0xe2ff('0x3c')]=_[_0xe2ff('0x38')](db[_0xe2ff('0x57')]['rawAttributes']);_0x3a4ec2[_0xe2ff('0x39')]=_[_0xe2ff('0x38')](_0x5b641f[_0xe2ff('0x39')]);_0x3a4ec2[_0xe2ff('0x3a')]=_[_0xe2ff('0x3b')](_0x3a4ec2[_0xe2ff('0x3c')],_0x3a4ec2[_0xe2ff('0x39')]);_0x21b874[_0xe2ff('0x3e')]=_[_0xe2ff('0x3b')](_0x3a4ec2[_0xe2ff('0x3c')],qs['fields'](_0x5b641f[_0xe2ff('0x39')][_0xe2ff('0x3d')]));_0x21b874[_0xe2ff('0x3e')]=_0x21b874[_0xe2ff('0x3e')][_0xe2ff('0x3f')]?_0x21b874[_0xe2ff('0x3e')]:_0x3a4ec2[_0xe2ff('0x3c')];_0x21b874['order']=qs[_0xe2ff('0x43')](_0x5b641f['query']['sort']);_0x21b874[_0xe2ff('0x44')]=qs[_0xe2ff('0x3a')](_['pick'](_0x5b641f[_0xe2ff('0x39')],_0x3a4ec2[_0xe2ff('0x3a')]));if(_0x5b641f[_0xe2ff('0x39')][_0xe2ff('0x4a')]){_0x21b874[_0xe2ff('0x44')]=_['merge'](_0x21b874[_0xe2ff('0x44')],{'$or':_[_0xe2ff('0x58')](_0x21b874[_0xe2ff('0x3e')],function(_0x5d6e0e){var _0x157d3c={};_0x157d3c[_0x5d6e0e]={'$like':'%'+_0x5b641f[_0xe2ff('0x39')][_0xe2ff('0x4a')]+'%'};return _0x157d3c;})});}_0x21b874=_[_0xe2ff('0x45')]({},_0x21b874,_0x5b641f[_0xe2ff('0x4b')]);return _0x19b1c2[_0xe2ff('0x59')](_0x21b874);}})[_0xe2ff('0x1c')](function(_0x42e731){if(_0x42e731){_0xa60f1c=_0x42e731['length'];if(!_0x5b641f[_0xe2ff('0x39')]['hasOwnProperty']('nolimit')){_0x21b874[_0xe2ff('0x2a')]=qs[_0xe2ff('0x2a')](_0x5b641f[_0xe2ff('0x39')]['limit']);_0x21b874[_0xe2ff('0x29')]=qs['offset'](_0x5b641f[_0xe2ff('0x39')][_0xe2ff('0x29')]);}return _0x19b1c2[_0xe2ff('0x59')](_0x21b874);}})[_0xe2ff('0x1c')](function(_0x2fb229){if(_0x2fb229){return _0x2fb229?{'count':_0xa60f1c,'rows':_0x2fb229}:null;}})[_0xe2ff('0x1c')](respondWithResult(_0x595331,null))[_0xe2ff('0x27')](handleError(_0x595331,null));};exports['getSubjects']=function(_0x2936e9,_0x13a6c1,_0x2c03b7){var _0x208e48={};var _0x55071b={};var _0x52fb2f;var _0x119acc;return db[_0xe2ff('0x4c')][_0xe2ff('0x56')]({'where':{'id':_0x2936e9[_0xe2ff('0x52')]['id']}})[_0xe2ff('0x1c')](handleEntityNotFound(_0x13a6c1,null))['then'](function(_0x33ca34){if(_0x33ca34){_0x52fb2f=_0x33ca34;_0x55071b['model']=_[_0xe2ff('0x38')](db[_0xe2ff('0x57')]['rawAttributes']);_0x55071b[_0xe2ff('0x39')]=_[_0xe2ff('0x38')](_0x2936e9[_0xe2ff('0x39')]);_0x55071b['filters']=_[_0xe2ff('0x3b')](_0x55071b[_0xe2ff('0x3c')],_0x55071b['query']);_0x208e48[_0xe2ff('0x3e')]=_[_0xe2ff('0x3b')](_0x55071b['model'],qs[_0xe2ff('0x3d')](_0x2936e9[_0xe2ff('0x39')][_0xe2ff('0x3d')]));_0x208e48['attributes']=_0x208e48[_0xe2ff('0x3e')][_0xe2ff('0x3f')]?_0x208e48[_0xe2ff('0x3e')]:_0x55071b[_0xe2ff('0x3c')];_0x208e48[_0xe2ff('0x42')]=qs['sort'](_0x2936e9['query'][_0xe2ff('0x43')]);_0x208e48['where']=qs['filters'](_[_0xe2ff('0x5a')](_0x2936e9['query'],_0x55071b[_0xe2ff('0x3a')]));if(_0x2936e9[_0xe2ff('0x39')][_0xe2ff('0x4a')]){_0x208e48[_0xe2ff('0x44')]=_['merge'](_0x208e48[_0xe2ff('0x44')],{'$or':_[_0xe2ff('0x58')](_0x208e48[_0xe2ff('0x3e')],function(_0x58435a){var _0x28ee94={};_0x28ee94[_0x58435a]={'$like':'%'+_0x2936e9[_0xe2ff('0x39')][_0xe2ff('0x4a')]+'%'};return _0x28ee94;})});}_0x208e48=_[_0xe2ff('0x45')]({},_0x208e48,_0x2936e9[_0xe2ff('0x4b')]);return _0x52fb2f['getSubjects'](_0x208e48);}})['then'](function(_0x1f214f){if(_0x1f214f){_0x119acc=_0x1f214f[_0xe2ff('0x3f')];if(!_0x2936e9[_0xe2ff('0x39')]['hasOwnProperty'](_0xe2ff('0x41'))){_0x208e48[_0xe2ff('0x2a')]=qs[_0xe2ff('0x2a')](_0x2936e9[_0xe2ff('0x39')][_0xe2ff('0x2a')]);_0x208e48[_0xe2ff('0x29')]=qs['offset'](_0x2936e9[_0xe2ff('0x39')][_0xe2ff('0x29')]);}return _0x52fb2f[_0xe2ff('0x5b')](_0x208e48);}})['then'](function(_0x2c7ac5){if(_0x2c7ac5){return _0x2c7ac5?{'count':_0x119acc,'rows':_0x2c7ac5}:null;}})[_0xe2ff('0x1c')](respondWithResult(_0x13a6c1,null))[_0xe2ff('0x27')](handleError(_0x13a6c1,null));};exports[_0xe2ff('0x5c')]=function(_0x3f16a7,_0x2d5a79,_0x545a8e){var _0x14ba6c={};var _0xe1827c={};var _0x583d01;var _0x42cd72;return db[_0xe2ff('0x4c')][_0xe2ff('0x56')]({'where':{'id':_0x3f16a7[_0xe2ff('0x52')]['id']}})[_0xe2ff('0x1c')](handleEntityNotFound(_0x2d5a79,null))[_0xe2ff('0x1c')](function(_0x4364fe){if(_0x4364fe){_0x583d01=_0x4364fe;_0xe1827c[_0xe2ff('0x3c')]=_[_0xe2ff('0x38')](db[_0xe2ff('0x57')][_0xe2ff('0x37')]);_0xe1827c[_0xe2ff('0x39')]=_['keys'](_0x3f16a7['query']);_0xe1827c[_0xe2ff('0x3a')]=_[_0xe2ff('0x3b')](_0xe1827c[_0xe2ff('0x3c')],_0xe1827c[_0xe2ff('0x39')]);_0x14ba6c[_0xe2ff('0x3e')]=_[_0xe2ff('0x3b')](_0xe1827c['model'],qs['fields'](_0x3f16a7['query'][_0xe2ff('0x3d')]));_0x14ba6c['attributes']=_0x14ba6c[_0xe2ff('0x3e')][_0xe2ff('0x3f')]?_0x14ba6c[_0xe2ff('0x3e')]:_0xe1827c[_0xe2ff('0x3c')];_0x14ba6c[_0xe2ff('0x42')]=qs['sort'](_0x3f16a7[_0xe2ff('0x39')][_0xe2ff('0x43')]);_0x14ba6c['where']=qs[_0xe2ff('0x3a')](_[_0xe2ff('0x5a')](_0x3f16a7[_0xe2ff('0x39')],_0xe1827c[_0xe2ff('0x3a')]));if(_0x3f16a7[_0xe2ff('0x39')][_0xe2ff('0x4a')]){_0x14ba6c['where']=_[_0xe2ff('0x45')](_0x14ba6c[_0xe2ff('0x44')],{'$or':_['map'](_0x14ba6c[_0xe2ff('0x3e')],function(_0x4bb982){var _0x2f5550={};_0x2f5550[_0x4bb982]={'$like':'%'+_0x3f16a7[_0xe2ff('0x39')][_0xe2ff('0x4a')]+'%'};return _0x2f5550;})});}_0x14ba6c=_[_0xe2ff('0x45')]({},_0x14ba6c,_0x3f16a7[_0xe2ff('0x4b')]);return _0x583d01['getDescriptions'](_0x14ba6c);}})['then'](function(_0x2e7f6d){if(_0x2e7f6d){_0x42cd72=_0x2e7f6d[_0xe2ff('0x3f')];if(!_0x3f16a7[_0xe2ff('0x39')]['hasOwnProperty']('nolimit')){_0x14ba6c[_0xe2ff('0x2a')]=qs['limit'](_0x3f16a7[_0xe2ff('0x39')][_0xe2ff('0x2a')]);_0x14ba6c[_0xe2ff('0x29')]=qs[_0xe2ff('0x29')](_0x3f16a7['query']['offset']);}return _0x583d01['getDescriptions'](_0x14ba6c);}})['then'](function(_0x411288){if(_0x411288){return _0x411288?{'count':_0x42cd72,'rows':_0x411288}:null;}})[_0xe2ff('0x1c')](respondWithResult(_0x2d5a79,null))[_0xe2ff('0x27')](handleError(_0x2d5a79,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 37591eb..0716483 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 _0x42c7=['moment','request-promise','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x503ea8,_0x22e391){var _0x427e5d=function(_0x1484e8){while(--_0x1484e8){_0x503ea8['push'](_0x503ea8['shift']());}};_0x427e5d(++_0x22e391);}(_0x42c7,0x188));var _0x742c=function(_0x5e7c0c,_0x11c6c3){_0x5e7c0c=_0x5e7c0c-0x0;var _0x291695=_0x42c7[_0x5e7c0c];return _0x291695;};'use strict';var _=require(_0x742c('0x0'));var util=require(_0x742c('0x1'));var logger=require(_0x742c('0x2'))(_0x742c('0x3'));var moment=require(_0x742c('0x4'));var BPromise=require('bluebird');var rp=require(_0x742c('0x5'));var attributes=require(_0x742c('0x6'));module[_0x742c('0x7')]=function(_0x19fbbd,_0x5abcfa){return _0x19fbbd[_0x742c('0x8')](_0x742c('0x9'),attributes,{'tableName':_0x742c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39b5=['api','moment','bluebird','request-promise','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','../../config/logger'];(function(_0x306da8,_0x469206){var _0x14a94b=function(_0x4764c8){while(--_0x4764c8){_0x306da8['push'](_0x306da8['shift']());}};_0x14a94b(++_0x469206);}(_0x39b5,0x1b5));var _0x539b=function(_0x58b3d5,_0x5584f8){_0x58b3d5=_0x58b3d5-0x0;var _0x2f6de9=_0x39b5[_0x58b3d5];return _0x2f6de9;};'use strict';var _=require(_0x539b('0x0'));var util=require(_0x539b('0x1'));var logger=require(_0x539b('0x2'))(_0x539b('0x3'));var moment=require(_0x539b('0x4'));var BPromise=require(_0x539b('0x5'));var rp=require(_0x539b('0x6'));var attributes=require(_0x539b('0x7'));module[_0x539b('0x8')]=function(_0x1dbaa0,_0x41e2e1){return _0x1dbaa0[_0x539b('0x9')](_0x539b('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 92209f3..2ca8a85 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 _0x74eb=['catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x74eb,0x18d));var _0xb74e=function(_0x4a2f5b,_0x29d942){_0x4a2f5b=_0x4a2f5b-0x0;var _0x1dec09=_0x74eb[_0x4a2f5b];return _0x1dec09;};'use strict';var _=require('lodash');var util=require(_0xb74e('0x0'));var moment=require(_0xb74e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb74e('0x2'));var db=require(_0xb74e('0x3'))['db'];var utils=require(_0xb74e('0x4'));var logger=require(_0xb74e('0x5'))(_0xb74e('0x6'));var config=require(_0xb74e('0x7'));var jayson=require(_0xb74e('0x8'));var client=jayson[_0xb74e('0x9')][_0xb74e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2753b5,_0x1b8c99,_0x33fa49){return new BPromise(function(_0x1b6689,_0x560336){return client['request'](_0x2753b5,_0x33fa49)[_0xb74e('0xb')](function(_0x9c6736){logger[_0xb74e('0xc')](_0xb74e('0xd'),_0x1b8c99,_0xb74e('0xe'));logger[_0xb74e('0xf')](_0xb74e('0x10'),_0x1b8c99,_0xb74e('0xe'),JSON['stringify'](_0x9c6736));if(_0x9c6736[_0xb74e('0x11')]){if(_0x9c6736[_0xb74e('0x11')][_0xb74e('0x12')]===0x1f4){logger[_0xb74e('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x1b8c99,_0x9c6736[_0xb74e('0x11')]['message']);return _0x560336(_0x9c6736[_0xb74e('0x11')][_0xb74e('0x13')]);}logger[_0xb74e('0x11')](_0xb74e('0xd'),_0x1b8c99,_0x9c6736[_0xb74e('0x11')][_0xb74e('0x13')]);return _0x1b6689(_0x9c6736[_0xb74e('0x11')][_0xb74e('0x13')]);}else{logger[_0xb74e('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x1b8c99,'request\x20sent');_0x1b6689(_0x9c6736[_0xb74e('0x14')]['message']);}})[_0xb74e('0x15')](function(_0x24e709){logger[_0xb74e('0x11')](_0xb74e('0xd'),_0x1b8c99,_0x24e709);_0x560336(_0x24e709);});});} \ No newline at end of file +var _0x6bb1=['jayson/promise','client','http','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5e5f6a,_0x1ddbc2){var _0x17f378=function(_0x279232){while(--_0x279232){_0x5e5f6a['push'](_0x5e5f6a['shift']());}};_0x17f378(++_0x1ddbc2);}(_0x6bb1,0xae));var _0x16bb=function(_0x3ffa8f,_0x12aa87){_0x3ffa8f=_0x3ffa8f-0x0;var _0x5c2fcb=_0x6bb1[_0x3ffa8f];return _0x5c2fcb;};'use strict';var _=require(_0x16bb('0x0'));var util=require(_0x16bb('0x1'));var moment=require('moment');var BPromise=require(_0x16bb('0x2'));var rs=require(_0x16bb('0x3'));var fs=require('fs');var Redis=require(_0x16bb('0x4'));var db=require(_0x16bb('0x5'))['db'];var utils=require(_0x16bb('0x6'));var logger=require(_0x16bb('0x7'))(_0x16bb('0x8'));var config=require(_0x16bb('0x9'));var jayson=require(_0x16bb('0xa'));var client=jayson[_0x16bb('0xb')][_0x16bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e4a8b,_0x2ec317,_0x317121){return new BPromise(function(_0x3f2dca,_0x3a4c57){return client['request'](_0x3e4a8b,_0x317121)['then'](function(_0x405219){logger[_0x16bb('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x2ec317,_0x16bb('0xe'));logger['debug'](_0x16bb('0xf'),_0x2ec317,_0x16bb('0xe'),JSON[_0x16bb('0x10')](_0x405219));if(_0x405219[_0x16bb('0x11')]){if(_0x405219[_0x16bb('0x11')][_0x16bb('0x12')]===0x1f4){logger[_0x16bb('0x11')](_0x16bb('0x13'),_0x2ec317,_0x405219[_0x16bb('0x11')][_0x16bb('0x14')]);return _0x3a4c57(_0x405219['error'][_0x16bb('0x14')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2ec317,_0x405219[_0x16bb('0x11')][_0x16bb('0x14')]);return _0x3f2dca(_0x405219['error'][_0x16bb('0x14')]);}else{logger[_0x16bb('0xd')](_0x16bb('0x13'),_0x2ec317,'request\x20sent');_0x3f2dca(_0x405219[_0x16bb('0x15')]['message']);}})[_0x16bb('0x16')](function(_0x61aff0){logger[_0x16bb('0x11')](_0x16bb('0x13'),_0x2ec317,_0x61aff0);_0x3a4c57(_0x61aff0);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 74d1234..d1eb51f 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 _0xa844=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','show','put','update','delete','/:id','exports'];(function(_0x49dd91,_0x2dc35d){var _0x222e02=function(_0x59ccdf){while(--_0x59ccdf){_0x49dd91['push'](_0x49dd91['shift']());}};_0x222e02(++_0x2dc35d);}(_0xa844,0x187));var _0x4a84=function(_0x17271e,_0x37faea){_0x17271e=_0x17271e-0x0;var _0x22415d=_0xa844[_0x17271e];return _0x22415d;};'use strict';var multer=require(_0x4a84('0x0'));var util=require(_0x4a84('0x1'));var path=require(_0x4a84('0x2'));var timeout=require(_0x4a84('0x3'));var express=require('express');var router=express[_0x4a84('0x4')]();var auth=require(_0x4a84('0x5'));var interaction=require(_0x4a84('0x6'));var config=require('../../config/environment');var controller=require(_0x4a84('0x7'));router[_0x4a84('0x8')]('/',auth[_0x4a84('0x9')](),controller[_0x4a84('0xa')]);router[_0x4a84('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4a84('0xb')]);router['post']('/',auth[_0x4a84('0x9')](),controller['create']);router[_0x4a84('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x4a84('0xd')]);router[_0x4a84('0xe')](_0x4a84('0xf'),auth[_0x4a84('0x9')](),controller['destroy']);module[_0x4a84('0x10')]=router; \ No newline at end of file +var _0xddec=['multer','util','path','express','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xddec,0xcc));var _0xcdde=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xddec[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xcdde('0x0'));var util=require(_0xcdde('0x1'));var path=require(_0xcdde('0x2'));var timeout=require('connect-timeout');var express=require(_0xcdde('0x3'));var router=express['Router']();var auth=require(_0xcdde('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcdde('0x5'));var controller=require(_0xcdde('0x6'));router[_0xcdde('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcdde('0x8'),auth[_0xcdde('0x9')](),controller[_0xcdde('0xa')]);router['post']('/',auth[_0xcdde('0x9')](),controller[_0xcdde('0xb')]);router[_0xcdde('0xc')]('/:id',auth[_0xcdde('0x9')](),controller[_0xcdde('0xd')]);router[_0xcdde('0xe')](_0xcdde('0x8'),auth['isAuthenticated'](),controller[_0xcdde('0xf')]);module[_0xcdde('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 e0cd5dd..db7b61c 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 _0xec56=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','string','variable'];(function(_0x5d7d6c,_0x7eefd0){var _0x3c195c=function(_0x497b7e){while(--_0x497b7e){_0x5d7d6c['push'](_0x5d7d6c['shift']());}};_0x3c195c(++_0x7eefd0);}(_0xec56,0x1bd));var _0x6ec5=function(_0x1af880,_0x41eb06){_0x1af880=_0x1af880-0x0;var _0x273b5e=_0xec56[_0x1af880];return _0x273b5e;};'use strict';var Sequelize=require(_0x6ec5('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x6ec5('0x1'),_0x6ec5('0x2'),_0x6ec5('0x3'),_0x6ec5('0x4')),'defaultValue':_0x6ec5('0x1')},'content':{'type':Sequelize[_0x6ec5('0x5')]},'key':{'type':Sequelize[_0x6ec5('0x5')]},'keyType':{'type':Sequelize[_0x6ec5('0x6')](_0x6ec5('0x1'),_0x6ec5('0x2'),_0x6ec5('0x3'))},'keyContent':{'type':Sequelize[_0x6ec5('0x5')]},'idField':{'type':Sequelize[_0x6ec5('0x5')]},'nameField':{'type':Sequelize[_0x6ec5('0x5')]},'customField':{'type':Sequelize[_0x6ec5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6ec5('0x5')]}}; \ No newline at end of file +var _0xb7e7=['customVariable','BOOLEAN','sequelize','ENUM','variable','keyValue','STRING'];(function(_0x2da6a7,_0x5182c5){var _0x273e3a=function(_0x2143bf){while(--_0x2143bf){_0x2da6a7['push'](_0x2da6a7['shift']());}};_0x273e3a(++_0x5182c5);}(_0xb7e7,0x121));var _0x7b7e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb7e7[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'type':{'type':Sequelize[_0x7b7e('0x1')]('string',_0x7b7e('0x2'),'customVariable',_0x7b7e('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7b7e('0x4')]},'key':{'type':Sequelize[_0x7b7e('0x4')]},'keyType':{'type':Sequelize[_0x7b7e('0x1')]('string','variable',_0x7b7e('0x5'))},'keyContent':{'type':Sequelize[_0x7b7e('0x4')]},'idField':{'type':Sequelize[_0x7b7e('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7b7e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7b7e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index a04d088..dcd2e2b 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 _0x5aa1=['find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','rawAttributes','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','VtigerField','count','then','includeAll','include','findAll','rows','params','length','catch','create','body'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x5aa1,0x99));var _0x15aa=function(_0x52774a,_0x3742d7){_0x52774a=_0x52774a-0x0;var _0x4e0b67=_0x5aa1[_0x52774a];return _0x4e0b67;};'use strict';var pdf=require(_0x15aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15aa('0x1'));var zipdir=require(_0x15aa('0x2'));var jsonpatch=require(_0x15aa('0x3'));var rp=require(_0x15aa('0x4'));var moment=require(_0x15aa('0x5'));var BPromise=require(_0x15aa('0x6'));var Mustache=require(_0x15aa('0x7'));var util=require(_0x15aa('0x8'));var path=require('path');var sox=require(_0x15aa('0x9'));var csv=require(_0x15aa('0xa'));var ejs=require(_0x15aa('0xb'));var fs=require('fs');var _=require(_0x15aa('0xc'));var squel=require(_0x15aa('0xd'));var crypto=require(_0x15aa('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x15aa('0xa'));var querystring=require(_0x15aa('0xf'));var Papa=require(_0x15aa('0x10'));var authService=require(_0x15aa('0x11'));var hardwareService=require(_0x15aa('0x12'));var Redis=require(_0x15aa('0x13'));var qs=require(_0x15aa('0x14'));var logger=require(_0x15aa('0x15'))(_0x15aa('0x16'));var utils=require(_0x15aa('0x17'));var config=require(_0x15aa('0x18'));var db=require(_0x15aa('0x19'))['db'];function respondWithStatusCode(_0x226514,_0x3563d2){_0x3563d2=_0x3563d2||0xcc;return function(_0x163474){if(_0x163474){return _0x226514[_0x15aa('0x1a')](_0x3563d2);}return _0x226514[_0x15aa('0x1b')](_0x3563d2)[_0x15aa('0x1c')]();};}function respondWithResult(_0x213529,_0x5d4305){_0x5d4305=_0x5d4305||0xc8;return function(_0x4d14a2){if(_0x4d14a2){return _0x213529[_0x15aa('0x1b')](_0x5d4305)[_0x15aa('0x1d')](_0x4d14a2);}};}function respondWithFilteredResult(_0x2b5532,_0x8670d4){return function(_0x9e6050){if(_0x9e6050){var _0x2e1ff2=_0x9e6050['count'],_0xe59f54=_0x8670d4[_0x15aa('0x1e')],_0x85d18b=_0x8670d4[_0x15aa('0x1e')]+_0x8670d4['limit'],_0x37ac4b;if(_0x85d18b>=_0x2e1ff2){_0x85d18b=_0x2e1ff2;_0x37ac4b=0xc8;}else{_0x37ac4b=0xce;}_0x2b5532[_0x15aa('0x1b')](_0x37ac4b);return _0x2b5532[_0x15aa('0x1f')](_0x15aa('0x20'),_0xe59f54+'-'+_0x85d18b+'/'+_0x2e1ff2)['json'](_0x9e6050);}return null;};}function patchUpdates(_0x2ba9c6){return function(_0x2e7307){try{jsonpatch[_0x15aa('0x21')](_0x2e7307,_0x2ba9c6,!![]);}catch(_0x219c6b){return BPromise[_0x15aa('0x22')](_0x219c6b);}return _0x2e7307['save']();};}function saveUpdates(_0x27895b,_0x5d677a){return function(_0x45d902){if(_0x45d902){return _0x45d902[_0x15aa('0x23')](_0x27895b)['then'](function(_0x54ba40){return _0x54ba40;});}return null;};}function removeEntity(_0x82bc5f,_0x1d55fd){return function(_0x2ab740){if(_0x2ab740){return _0x2ab740[_0x15aa('0x24')]()['then'](function(){_0x82bc5f['status'](0xcc)[_0x15aa('0x1c')]();});}};}function handleEntityNotFound(_0x36a429,_0x5d0670){return function(_0x41cfcf){if(!_0x41cfcf){_0x36a429[_0x15aa('0x1a')](0x194);}return _0x41cfcf;};}function handleError(_0x5d241c,_0x39f4de){_0x39f4de=_0x39f4de||0x1f4;return function(_0x22964a){logger[_0x15aa('0x25')](_0x22964a[_0x15aa('0x26')]);if(_0x22964a[_0x15aa('0x27')]){delete _0x22964a[_0x15aa('0x27')];}_0x5d241c[_0x15aa('0x1b')](_0x39f4de)[_0x15aa('0x28')](_0x22964a);};}exports[_0x15aa('0x29')]=function(_0x2d1e4b,_0x4a3892){var _0x59e9d7={},_0x58a48f={},_0x108cae={'count':0x0,'rows':[]};var _0x3ddbcd=db['VtigerField'][_0x15aa('0x2a')];_0x58a48f[_0x15aa('0x2b')]=_['keys'](_0x3ddbcd);_0x58a48f[_0x15aa('0x2c')]=_[_0x15aa('0x2d')](_0x2d1e4b['query']);_0x58a48f[_0x15aa('0x2e')]=_['intersection'](_0x58a48f[_0x15aa('0x2b')],_0x58a48f['query']);_0x59e9d7[_0x15aa('0x2f')]=_[_0x15aa('0x30')](_0x58a48f[_0x15aa('0x2b')],qs[_0x15aa('0x31')](_0x2d1e4b[_0x15aa('0x2c')][_0x15aa('0x31')]));_0x59e9d7['attributes']=_0x59e9d7[_0x15aa('0x2f')]['length']?_0x59e9d7[_0x15aa('0x2f')]:_0x58a48f['model'];if(!_0x2d1e4b[_0x15aa('0x2c')][_0x15aa('0x32')](_0x15aa('0x33'))){_0x59e9d7[_0x15aa('0x34')]=qs[_0x15aa('0x34')](_0x2d1e4b[_0x15aa('0x2c')][_0x15aa('0x34')]);_0x59e9d7[_0x15aa('0x1e')]=qs['offset'](_0x2d1e4b[_0x15aa('0x2c')][_0x15aa('0x1e')]);}_0x59e9d7['order']=qs[_0x15aa('0x35')](_0x2d1e4b[_0x15aa('0x2c')]['sort']);_0x59e9d7[_0x15aa('0x36')]=qs[_0x15aa('0x2e')](_[_0x15aa('0x37')](_0x2d1e4b['query'],_0x58a48f[_0x15aa('0x2e')]));if(_0x2d1e4b[_0x15aa('0x2c')][_0x15aa('0x38')]){_0x59e9d7['where']=_[_0x15aa('0x39')](_0x59e9d7[_0x15aa('0x36')],{'$or':_[_0x15aa('0x3a')](_0x3ddbcd,function(_0x1de186){if(_0x1de186['type'][_0x15aa('0x3b')]!==_0x15aa('0x3c')){var _0x33e63e={};_0x33e63e[_0x1de186[_0x15aa('0x3d')]]={'$like':'%'+_0x2d1e4b[_0x15aa('0x2c')][_0x15aa('0x38')]+'%'};return _0x33e63e;}})});}_0x59e9d7=_[_0x15aa('0x39')]({},_0x59e9d7,_0x2d1e4b[_0x15aa('0x3e')]);var _0x66b756={'where':_0x59e9d7['where']};return db[_0x15aa('0x3f')][_0x15aa('0x40')](_0x66b756)[_0x15aa('0x41')](function(_0x2dc3af){_0x108cae[_0x15aa('0x40')]=_0x2dc3af;if(_0x2d1e4b['query'][_0x15aa('0x42')]){_0x59e9d7[_0x15aa('0x43')]=[{'all':!![]}];}return db[_0x15aa('0x3f')][_0x15aa('0x44')](_0x59e9d7);})[_0x15aa('0x41')](function(_0x36737f){_0x108cae[_0x15aa('0x45')]=_0x36737f;return _0x108cae;})[_0x15aa('0x41')](respondWithFilteredResult(_0x4a3892,_0x59e9d7))['catch'](handleError(_0x4a3892,null));};exports['show']=function(_0x302792,_0x33b3dd){var _0x164292={'raw':!![],'where':{'id':_0x302792[_0x15aa('0x46')]['id']}},_0xac2577={};_0xac2577[_0x15aa('0x2b')]=_[_0x15aa('0x2d')](db[_0x15aa('0x3f')][_0x15aa('0x2a')]);_0xac2577[_0x15aa('0x2c')]=_['keys'](_0x302792[_0x15aa('0x2c')]);_0xac2577[_0x15aa('0x2e')]=_['intersection'](_0xac2577['model'],_0xac2577['query']);_0x164292['attributes']=_[_0x15aa('0x30')](_0xac2577['model'],qs[_0x15aa('0x31')](_0x302792['query'][_0x15aa('0x31')]));_0x164292[_0x15aa('0x2f')]=_0x164292[_0x15aa('0x2f')][_0x15aa('0x47')]?_0x164292[_0x15aa('0x2f')]:_0xac2577['model'];if(_0x302792['query'][_0x15aa('0x42')]){_0x164292[_0x15aa('0x43')]=[{'all':!![]}];}_0x164292=_[_0x15aa('0x39')]({},_0x164292,_0x302792[_0x15aa('0x3e')]);return db['VtigerField']['find'](_0x164292)[_0x15aa('0x41')](handleEntityNotFound(_0x33b3dd,null))[_0x15aa('0x41')](respondWithResult(_0x33b3dd,null))[_0x15aa('0x48')](handleError(_0x33b3dd,null));};exports[_0x15aa('0x49')]=function(_0x5816c5,_0x416b52){return db[_0x15aa('0x3f')][_0x15aa('0x49')](_0x5816c5[_0x15aa('0x4a')],{})['then'](respondWithResult(_0x416b52,0xc9))['catch'](handleError(_0x416b52,null));};exports[_0x15aa('0x23')]=function(_0x1f939f,_0x5de7d7){if(_0x1f939f['body']['id']){delete _0x1f939f['body']['id'];}return db[_0x15aa('0x3f')][_0x15aa('0x4b')]({'where':{'id':_0x1f939f[_0x15aa('0x46')]['id']}})[_0x15aa('0x41')](handleEntityNotFound(_0x5de7d7,null))[_0x15aa('0x41')](saveUpdates(_0x1f939f['body'],null))[_0x15aa('0x41')](respondWithResult(_0x5de7d7,null))[_0x15aa('0x48')](handleError(_0x5de7d7,null));};exports[_0x15aa('0x24')]=function(_0x40f649,_0x4289ac){return db[_0x15aa('0x3f')][_0x15aa('0x4b')]({'where':{'id':_0x40f649[_0x15aa('0x46')]['id']}})[_0x15aa('0x41')](handleEntityNotFound(_0x4289ac,null))[_0x15aa('0x41')](removeEntity(_0x4289ac,null))[_0x15aa('0x48')](handleError(_0x4289ac,null));}; \ No newline at end of file +var _0x3a95=['length','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','findAll','catch','include','create','body','update','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/utils','status','end','count','offset','limit','set','Content-Range','json','reject','then','destroy','sendStatus','name','send','index','VtigerField','rawAttributes','keys','query','filters','intersection','model','fields','attributes'];(function(_0x2fb573,_0x1a13b4){var _0x46dde5=function(_0x38d914){while(--_0x38d914){_0x2fb573['push'](_0x2fb573['shift']());}};_0x46dde5(++_0x1a13b4);}(_0x3a95,0x12b));var _0x53a9=function(_0x5c402d,_0x1dda4e){_0x5c402d=_0x5c402d-0x0;var _0x3dcc91=_0x3a95[_0x5c402d];return _0x3dcc91;};'use strict';var pdf=require(_0x53a9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x53a9('0x1'));var zipdir=require(_0x53a9('0x2'));var jsonpatch=require(_0x53a9('0x3'));var rp=require('request-promise');var moment=require(_0x53a9('0x4'));var BPromise=require(_0x53a9('0x5'));var Mustache=require(_0x53a9('0x6'));var util=require(_0x53a9('0x7'));var path=require(_0x53a9('0x8'));var sox=require(_0x53a9('0x9'));var csv=require(_0x53a9('0xa'));var ejs=require(_0x53a9('0xb'));var fs=require('fs');var _=require(_0x53a9('0xc'));var squel=require(_0x53a9('0xd'));var crypto=require(_0x53a9('0xe'));var jsforce=require(_0x53a9('0xf'));var deskjs=require(_0x53a9('0x10'));var toCsv=require(_0x53a9('0xa'));var querystring=require('querystring');var Papa=require(_0x53a9('0x11'));var authService=require(_0x53a9('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x53a9('0x13'));var qs=require(_0x53a9('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x53a9('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29f06f,_0x10b516){_0x10b516=_0x10b516||0xcc;return function(_0x34f160){if(_0x34f160){return _0x29f06f['sendStatus'](_0x10b516);}return _0x29f06f[_0x53a9('0x16')](_0x10b516)[_0x53a9('0x17')]();};}function respondWithResult(_0x201c80,_0x486b76){_0x486b76=_0x486b76||0xc8;return function(_0x20181a){if(_0x20181a){return _0x201c80[_0x53a9('0x16')](_0x486b76)['json'](_0x20181a);}};}function respondWithFilteredResult(_0x2cadc1,_0xa7a7f6){return function(_0x219611){if(_0x219611){var _0x2326d4=_0x219611[_0x53a9('0x18')],_0x3c5495=_0xa7a7f6[_0x53a9('0x19')],_0x4746f7=_0xa7a7f6['offset']+_0xa7a7f6[_0x53a9('0x1a')],_0x47c8b7;if(_0x4746f7>=_0x2326d4){_0x4746f7=_0x2326d4;_0x47c8b7=0xc8;}else{_0x47c8b7=0xce;}_0x2cadc1['status'](_0x47c8b7);return _0x2cadc1[_0x53a9('0x1b')](_0x53a9('0x1c'),_0x3c5495+'-'+_0x4746f7+'/'+_0x2326d4)[_0x53a9('0x1d')](_0x219611);}return null;};}function patchUpdates(_0x38e20d){return function(_0x2d9ba9){try{jsonpatch['apply'](_0x2d9ba9,_0x38e20d,!![]);}catch(_0x2ad76a){return BPromise[_0x53a9('0x1e')](_0x2ad76a);}return _0x2d9ba9['save']();};}function saveUpdates(_0x355deb,_0x531f79){return function(_0x200713){if(_0x200713){return _0x200713['update'](_0x355deb)[_0x53a9('0x1f')](function(_0x6710cc){return _0x6710cc;});}return null;};}function removeEntity(_0xbb05c4,_0x344980){return function(_0x22b1c7){if(_0x22b1c7){return _0x22b1c7[_0x53a9('0x20')]()[_0x53a9('0x1f')](function(){_0xbb05c4[_0x53a9('0x16')](0xcc)[_0x53a9('0x17')]();});}};}function handleEntityNotFound(_0x6327c8,_0x5d8355){return function(_0x36c190){if(!_0x36c190){_0x6327c8[_0x53a9('0x21')](0x194);}return _0x36c190;};}function handleError(_0x40ba85,_0x25865c){_0x25865c=_0x25865c||0x1f4;return function(_0x4660d8){logger['error'](_0x4660d8['stack']);if(_0x4660d8[_0x53a9('0x22')]){delete _0x4660d8[_0x53a9('0x22')];}_0x40ba85['status'](_0x25865c)[_0x53a9('0x23')](_0x4660d8);};}exports[_0x53a9('0x24')]=function(_0xbe5dc,_0x2f4093){var _0x25c378={},_0x21d3f6={},_0x16d54a={'count':0x0,'rows':[]};var _0x3fdae9=db[_0x53a9('0x25')][_0x53a9('0x26')];_0x21d3f6['model']=_[_0x53a9('0x27')](_0x3fdae9);_0x21d3f6[_0x53a9('0x28')]=_['keys'](_0xbe5dc[_0x53a9('0x28')]);_0x21d3f6[_0x53a9('0x29')]=_[_0x53a9('0x2a')](_0x21d3f6['model'],_0x21d3f6[_0x53a9('0x28')]);_0x25c378['attributes']=_[_0x53a9('0x2a')](_0x21d3f6[_0x53a9('0x2b')],qs['fields'](_0xbe5dc[_0x53a9('0x28')][_0x53a9('0x2c')]));_0x25c378[_0x53a9('0x2d')]=_0x25c378['attributes'][_0x53a9('0x2e')]?_0x25c378[_0x53a9('0x2d')]:_0x21d3f6['model'];if(!_0xbe5dc['query']['hasOwnProperty'](_0x53a9('0x2f'))){_0x25c378['limit']=qs[_0x53a9('0x1a')](_0xbe5dc['query'][_0x53a9('0x1a')]);_0x25c378['offset']=qs[_0x53a9('0x19')](_0xbe5dc[_0x53a9('0x28')][_0x53a9('0x19')]);}_0x25c378[_0x53a9('0x30')]=qs[_0x53a9('0x31')](_0xbe5dc['query']['sort']);_0x25c378[_0x53a9('0x32')]=qs[_0x53a9('0x29')](_[_0x53a9('0x33')](_0xbe5dc[_0x53a9('0x28')],_0x21d3f6[_0x53a9('0x29')]));if(_0xbe5dc[_0x53a9('0x28')]['filter']){_0x25c378[_0x53a9('0x32')]=_[_0x53a9('0x34')](_0x25c378[_0x53a9('0x32')],{'$or':_[_0x53a9('0x35')](_0x3fdae9,function(_0x1e998a){if(_0x1e998a[_0x53a9('0x36')][_0x53a9('0x37')]!==_0x53a9('0x38')){var _0x57c0f1={};_0x57c0f1[_0x1e998a[_0x53a9('0x39')]]={'$like':'%'+_0xbe5dc[_0x53a9('0x28')][_0x53a9('0x3a')]+'%'};return _0x57c0f1;}})});}_0x25c378=_[_0x53a9('0x34')]({},_0x25c378,_0xbe5dc[_0x53a9('0x3b')]);var _0x154209={'where':_0x25c378[_0x53a9('0x32')]};return db[_0x53a9('0x25')]['count'](_0x154209)[_0x53a9('0x1f')](function(_0x22eda4){_0x16d54a['count']=_0x22eda4;if(_0xbe5dc[_0x53a9('0x28')][_0x53a9('0x3c')]){_0x25c378['include']=[{'all':!![]}];}return db[_0x53a9('0x25')][_0x53a9('0x3d')](_0x25c378);})[_0x53a9('0x1f')](function(_0x28a8d0){_0x16d54a['rows']=_0x28a8d0;return _0x16d54a;})[_0x53a9('0x1f')](respondWithFilteredResult(_0x2f4093,_0x25c378))[_0x53a9('0x3e')](handleError(_0x2f4093,null));};exports['show']=function(_0xf088be,_0x5dab5f){var _0x1f5d77={'raw':!![],'where':{'id':_0xf088be['params']['id']}},_0x37d72={};_0x37d72[_0x53a9('0x2b')]=_[_0x53a9('0x27')](db[_0x53a9('0x25')][_0x53a9('0x26')]);_0x37d72[_0x53a9('0x28')]=_[_0x53a9('0x27')](_0xf088be[_0x53a9('0x28')]);_0x37d72[_0x53a9('0x29')]=_['intersection'](_0x37d72[_0x53a9('0x2b')],_0x37d72[_0x53a9('0x28')]);_0x1f5d77[_0x53a9('0x2d')]=_[_0x53a9('0x2a')](_0x37d72[_0x53a9('0x2b')],qs[_0x53a9('0x2c')](_0xf088be['query'][_0x53a9('0x2c')]));_0x1f5d77[_0x53a9('0x2d')]=_0x1f5d77[_0x53a9('0x2d')]['length']?_0x1f5d77['attributes']:_0x37d72[_0x53a9('0x2b')];if(_0xf088be[_0x53a9('0x28')][_0x53a9('0x3c')]){_0x1f5d77[_0x53a9('0x3f')]=[{'all':!![]}];}_0x1f5d77=_[_0x53a9('0x34')]({},_0x1f5d77,_0xf088be['options']);return db[_0x53a9('0x25')]['find'](_0x1f5d77)[_0x53a9('0x1f')](handleEntityNotFound(_0x5dab5f,null))['then'](respondWithResult(_0x5dab5f,null))[_0x53a9('0x3e')](handleError(_0x5dab5f,null));};exports[_0x53a9('0x40')]=function(_0x4dcbe0,_0x33a23a){return db[_0x53a9('0x25')][_0x53a9('0x40')](_0x4dcbe0[_0x53a9('0x41')],{})[_0x53a9('0x1f')](respondWithResult(_0x33a23a,0xc9))['catch'](handleError(_0x33a23a,null));};exports[_0x53a9('0x42')]=function(_0x1affd8,_0x1c9f77){if(_0x1affd8[_0x53a9('0x41')]['id']){delete _0x1affd8[_0x53a9('0x41')]['id'];}return db[_0x53a9('0x25')][_0x53a9('0x43')]({'where':{'id':_0x1affd8['params']['id']}})['then'](handleEntityNotFound(_0x1c9f77,null))[_0x53a9('0x1f')](saveUpdates(_0x1affd8[_0x53a9('0x41')],null))['then'](respondWithResult(_0x1c9f77,null))[_0x53a9('0x3e')](handleError(_0x1c9f77,null));};exports[_0x53a9('0x20')]=function(_0x31ef6c,_0x408966){return db[_0x53a9('0x25')][_0x53a9('0x43')]({'where':{'id':_0x31ef6c[_0x53a9('0x44')]['id']}})[_0x53a9('0x1f')](handleEntityNotFound(_0x408966,null))[_0x53a9('0x1f')](removeEntity(_0x408966,null))[_0x53a9('0x3e')](handleError(_0x408966,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c80ba7e..950d245 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 _0xbfa8=['api','moment','bluebird','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xbfa8,0x111));var _0x8bfa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbfa8[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x8bfa('0x0'));var util=require(_0x8bfa('0x1'));var logger=require(_0x8bfa('0x2'))(_0x8bfa('0x3'));var moment=require(_0x8bfa('0x4'));var BPromise=require(_0x8bfa('0x5'));var rp=require('request-promise');var attributes=require(_0x8bfa('0x6'));module[_0x8bfa('0x7')]=function(_0x1d960c,_0x80cae9){return _0x1d960c[_0x8bfa('0x8')](_0x8bfa('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x8bfa('0xa'),'fields':['idField',_0x8bfa('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44e9=['moment','bluebird','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x188b3c,_0x4fb09a){var _0x4b9182=function(_0x25e4c3){while(--_0x25e4c3){_0x188b3c['push'](_0x188b3c['shift']());}};_0x4b9182(++_0x4fb09a);}(_0x44e9,0x168));var _0x944e=function(_0x5385e8,_0x3b8daf){_0x5385e8=_0x5385e8-0x0;var _0x49f94b=_0x44e9[_0x5385e8];return _0x49f94b;};'use strict';var _=require(_0x944e('0x0'));var util=require(_0x944e('0x1'));var logger=require(_0x944e('0x2'))(_0x944e('0x3'));var moment=require(_0x944e('0x4'));var BPromise=require(_0x944e('0x5'));var rp=require('request-promise');var attributes=require(_0x944e('0x6'));module[_0x944e('0x7')]=function(_0x1c09be,_0xe18076){return _0x1c09be[_0x944e('0x8')]('VtigerField',attributes,{'tableName':_0x944e('0x9'),'paranoid':![],'indexes':[{'name':_0x944e('0xa'),'fields':[_0x944e('0xb'),_0x944e('0xc')],'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 c3839b4..7c895a7 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 _0x3116=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3116,0x165));var _0x6311=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3116[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require(_0x6311('0x0'));var moment=require(_0x6311('0x1'));var BPromise=require('bluebird');var rs=require(_0x6311('0x2'));var fs=require('fs');var Redis=require(_0x6311('0x3'));var db=require(_0x6311('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6311('0x5'));var config=require(_0x6311('0x6'));var jayson=require(_0x6311('0x7'));var client=jayson['client'][_0x6311('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38f69a,_0x56bc0a,_0x543749){return new BPromise(function(_0x39340d,_0x249375){return client[_0x6311('0x9')](_0x38f69a,_0x543749)[_0x6311('0xa')](function(_0x4fa064){logger[_0x6311('0xb')](_0x6311('0xc'),_0x56bc0a,_0x6311('0xd'));logger[_0x6311('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x56bc0a,_0x6311('0xd'),JSON[_0x6311('0xf')](_0x4fa064));if(_0x4fa064[_0x6311('0x10')]){if(_0x4fa064[_0x6311('0x10')]['code']===0x1f4){logger[_0x6311('0x10')](_0x6311('0xc'),_0x56bc0a,_0x4fa064[_0x6311('0x10')][_0x6311('0x11')]);return _0x249375(_0x4fa064['error'][_0x6311('0x11')]);}logger['error'](_0x6311('0xc'),_0x56bc0a,_0x4fa064['error'][_0x6311('0x11')]);return _0x39340d(_0x4fa064[_0x6311('0x10')][_0x6311('0x11')]);}else{logger[_0x6311('0xb')](_0x6311('0xc'),_0x56bc0a,_0x6311('0xd'));_0x39340d(_0x4fa064[_0x6311('0x12')][_0x6311('0x11')]);}})[_0x6311('0x13')](function(_0x20a0ad){logger[_0x6311('0x10')]('VtigerField,\x20%s,\x20%s',_0x56bc0a,_0x20a0ad);_0x249375(_0x20a0ad);});});} \ No newline at end of file +var _0xe73f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','bluebird','randomstring'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0xe73f,0xbc));var _0xfe73=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xe73f[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0xfe73('0x0'));var util=require('util');var moment=require(_0xfe73('0x1'));var BPromise=require(_0xfe73('0x2'));var rs=require(_0xfe73('0x3'));var fs=require('fs');var Redis=require(_0xfe73('0x4'));var db=require(_0xfe73('0x5'))['db'];var utils=require(_0xfe73('0x6'));var logger=require(_0xfe73('0x7'))(_0xfe73('0x8'));var config=require(_0xfe73('0x9'));var jayson=require(_0xfe73('0xa'));var client=jayson[_0xfe73('0xb')][_0xfe73('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x189e40,_0x9b0402,_0xf9b076){return new BPromise(function(_0x243591,_0x556dd3){return client[_0xfe73('0xd')](_0x189e40,_0xf9b076)[_0xfe73('0xe')](function(_0x16842d){logger['info'](_0xfe73('0xf'),_0x9b0402,_0xfe73('0x10'));logger[_0xfe73('0x11')](_0xfe73('0x12'),_0x9b0402,_0xfe73('0x10'),JSON[_0xfe73('0x13')](_0x16842d));if(_0x16842d[_0xfe73('0x14')]){if(_0x16842d['error']['code']===0x1f4){logger[_0xfe73('0x14')](_0xfe73('0xf'),_0x9b0402,_0x16842d['error']['message']);return _0x556dd3(_0x16842d[_0xfe73('0x14')][_0xfe73('0x15')]);}logger['error'](_0xfe73('0xf'),_0x9b0402,_0x16842d[_0xfe73('0x14')][_0xfe73('0x15')]);return _0x243591(_0x16842d[_0xfe73('0x14')][_0xfe73('0x15')]);}else{logger[_0xfe73('0x16')](_0xfe73('0xf'),_0x9b0402,_0xfe73('0x10'));_0x243591(_0x16842d[_0xfe73('0x17')][_0xfe73('0x15')]);}})['catch'](function(_0x18408b){logger[_0xfe73('0x14')](_0xfe73('0xf'),_0x9b0402,_0x18408b);_0x556dd3(_0x18408b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index d4eaf56..bc0299c 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 _0x1985=['index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated'];(function(_0x5a38ee,_0x1bad30){var _0x4a7102=function(_0x56b2e8){while(--_0x56b2e8){_0x5a38ee['push'](_0x5a38ee['shift']());}};_0x4a7102(++_0x1bad30);}(_0x1985,0xd3));var _0x5198=function(_0x21f2cf,_0x1417ea){_0x21f2cf=_0x21f2cf-0x0;var _0x50d69c=_0x1985[_0x21f2cf];return _0x50d69c;};'use strict';var multer=require('multer');var util=require(_0x5198('0x0'));var path=require('path');var timeout=require(_0x5198('0x1'));var express=require(_0x5198('0x2'));var router=express[_0x5198('0x3')]();var auth=require(_0x5198('0x4'));var interaction=require(_0x5198('0x5'));var config=require(_0x5198('0x6'));var controller=require(_0x5198('0x7'));router['get']('/',auth[_0x5198('0x8')](),controller[_0x5198('0x9')]);router['get'](_0x5198('0xa'),auth[_0x5198('0x8')](),controller[_0x5198('0xb')]);router[_0x5198('0xc')](_0x5198('0xd'),auth['isAuthenticated'](),controller[_0x5198('0xe')]);router['get'](_0x5198('0xf'),auth[_0x5198('0x8')](),controller[_0x5198('0x10')]);router[_0x5198('0x11')]('/',auth[_0x5198('0x8')](),controller[_0x5198('0x12')]);router[_0x5198('0x11')](_0x5198('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0x5198('0x8')](),controller[_0x5198('0x13')]);router[_0x5198('0x14')](_0x5198('0xa'),auth[_0x5198('0x8')](),controller['destroy']);module[_0x5198('0x15')]=router; \ No newline at end of file +var _0xfac6=['getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields'];(function(_0x198303,_0x572645){var _0x42e2df=function(_0x47614d){while(--_0x47614d){_0x198303['push'](_0x198303['shift']());}};_0x42e2df(++_0x572645);}(_0xfac6,0x1d1));var _0x6fac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfac6[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6fac('0x0'));var util=require(_0x6fac('0x1'));var path=require(_0x6fac('0x2'));var timeout=require('connect-timeout');var express=require(_0x6fac('0x3'));var router=express[_0x6fac('0x4')]();var auth=require(_0x6fac('0x5'));var interaction=require(_0x6fac('0x6'));var config=require(_0x6fac('0x7'));var controller=require(_0x6fac('0x8'));router[_0x6fac('0x9')]('/',auth[_0x6fac('0xa')](),controller['index']);router['get'](_0x6fac('0xb'),auth[_0x6fac('0xa')](),controller[_0x6fac('0xc')]);router[_0x6fac('0x9')](_0x6fac('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x6fac('0x9')](_0x6fac('0xe'),auth[_0x6fac('0xa')](),controller[_0x6fac('0xf')]);router[_0x6fac('0x10')]('/',auth[_0x6fac('0xa')](),controller[_0x6fac('0x11')]);router[_0x6fac('0x10')](_0x6fac('0xd'),auth[_0x6fac('0xa')](),controller[_0x6fac('0x12')]);router[_0x6fac('0x13')](_0x6fac('0xb'),auth['isAuthenticated'](),controller[_0x6fac('0x14')]);router[_0x6fac('0x15')]('/:id',auth[_0x6fac('0xa')](),controller[_0x6fac('0x16')]);module[_0x6fac('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index cb757ad..7ccd62e 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 _0x0411=['ENUM','newTab','integrationTab','sequelize','exports','STRING','remoteUri','password'];(function(_0x482601,_0x1d478d){var _0x5e22b7=function(_0x328ef8){while(--_0x328ef8){_0x482601['push'](_0x482601['shift']());}};_0x5e22b7(++_0x1d478d);}(_0x0411,0xc3));var _0x1041=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x0411[_0x265aa2];return _0x447a3a;};'use strict';var Sequelize=require(_0x1041('0x0'));module[_0x1041('0x1')]={'name':{'type':Sequelize[_0x1041('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1041('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x1041('0x2')]},'token':{'type':Sequelize[_0x1041('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1041('0x3')},'authType':{'type':Sequelize['ENUM']('password','token'),'defaultValue':_0x1041('0x4')},'serverUrl':{'type':Sequelize[_0x1041('0x2')]},'type':{'type':Sequelize[_0x1041('0x5')]('integrationTab',_0x1041('0x6')),'defaultValue':_0x1041('0x7')}}; \ No newline at end of file +var _0xf5cd=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab'];(function(_0xb47b2a,_0xc898e9){var _0x3c9992=function(_0x21e5cc){while(--_0x21e5cc){_0xb47b2a['push'](_0xb47b2a['shift']());}};_0x3c9992(++_0xc898e9);}(_0xf5cd,0xea));var _0xdf5c=function(_0x43dfd4,_0x2d6fdc){_0x43dfd4=_0x43dfd4-0x0;var _0x27cd19=_0xf5cd[_0x43dfd4];return _0x27cd19;};'use strict';var Sequelize=require(_0xdf5c('0x0'));module[_0xdf5c('0x1')]={'name':{'type':Sequelize[_0xdf5c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdf5c('0x2')],'unique':_0xdf5c('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xdf5c('0x2')]},'remoteUri':{'type':Sequelize[_0xdf5c('0x2')],'unique':_0xdf5c('0x4')},'authType':{'type':Sequelize[_0xdf5c('0x5')](_0xdf5c('0x6'),_0xdf5c('0x7')),'defaultValue':_0xdf5c('0x6')},'serverUrl':{'type':Sequelize[_0xdf5c('0x2')]},'type':{'type':Sequelize[_0xdf5c('0x5')](_0xdf5c('0x8'),'newTab'),'defaultValue':_0xdf5c('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index d296da5..957f7b1 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 _0x7dab=['api','../../config/environment','../../mysqldb','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','type','key','VIRTUAL','options','ZendeskAccount','findAll','rows','params','includeAll','find','create','body','getConfigurations','findOne','ZendeskConfiguration','length','addConfiguration','AccountId','Subjects','getSubjects','channel','ZendeskField','Descriptions','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x406e2c,_0x51b99d){var _0x3c666e=function(_0x3ac04b){while(--_0x3ac04b){_0x406e2c['push'](_0x406e2c['shift']());}};_0x3c666e(++_0x51b99d);}(_0x7dab,0xe5));var _0xb7da=function(_0x2c7cbd,_0x27eeaf){_0x2c7cbd=_0x2c7cbd-0x0;var _0x4afb5a=_0x7dab[_0x2c7cbd];return _0x4afb5a;};'use strict';var pdf=require(_0xb7da('0x0'));var emlformat=require(_0xb7da('0x1'));var rimraf=require(_0xb7da('0x2'));var zipdir=require(_0xb7da('0x3'));var jsonpatch=require(_0xb7da('0x4'));var rp=require('request-promise');var moment=require(_0xb7da('0x5'));var BPromise=require(_0xb7da('0x6'));var Mustache=require(_0xb7da('0x7'));var util=require(_0xb7da('0x8'));var path=require(_0xb7da('0x9'));var sox=require(_0xb7da('0xa'));var csv=require(_0xb7da('0xb'));var ejs=require(_0xb7da('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb7da('0xd'));var crypto=require(_0xb7da('0xe'));var jsforce=require(_0xb7da('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb7da('0x10'));var Papa=require(_0xb7da('0x11'));var authService=require(_0xb7da('0x12'));var hardwareService=require(_0xb7da('0x13'));var Redis=require(_0xb7da('0x14'));var qs=require(_0xb7da('0x15'));var logger=require(_0xb7da('0x16'))(_0xb7da('0x17'));var utils=require('../../config/utils');var config=require(_0xb7da('0x18'));var db=require(_0xb7da('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xb7da('0x1a'));var client=jayson['client'][_0xb7da('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3a1df3,_0x2d59be,_0x40d3c6,_0x58f020){return new BPromise(function(_0x5ae9bb,_0xe4cb50){var _0x3b6f32=_0x58f020||client;return _0x3b6f32[_0xb7da('0x1c')](_0x3a1df3,_0x40d3c6)['then'](function(_0x3ac23e){logger[_0xb7da('0x1d')](_0xb7da('0x1e'),_0x2d59be,_0xb7da('0x1f'));logger['debug'](_0xb7da('0x20'),_0x2d59be,_0xb7da('0x1f'),JSON[_0xb7da('0x21')](_0x3ac23e));if(_0x3ac23e['error']){if(_0x3ac23e[_0xb7da('0x22')][_0xb7da('0x23')]===0x1f4){logger[_0xb7da('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x2d59be,_0x3ac23e[_0xb7da('0x22')]['message']);return _0xe4cb50(_0x3ac23e[_0xb7da('0x22')][_0xb7da('0x24')]);}logger[_0xb7da('0x22')](_0xb7da('0x1e'),_0x2d59be,_0x3ac23e[_0xb7da('0x22')][_0xb7da('0x24')]);return _0x5ae9bb(_0x3ac23e[_0xb7da('0x22')][_0xb7da('0x24')]);}else{logger[_0xb7da('0x1d')](_0xb7da('0x1e'),_0x2d59be,_0xb7da('0x1f'));_0x5ae9bb(_0x3ac23e[_0xb7da('0x25')][_0xb7da('0x24')]);}})[_0xb7da('0x26')](function(_0x20750c){logger[_0xb7da('0x22')](_0xb7da('0x1e'),_0x2d59be,_0x20750c);_0xe4cb50(_0x20750c);});});}function respondWithStatusCode(_0x44eb3a,_0x2d6a9e){_0x2d6a9e=_0x2d6a9e||0xcc;return function(_0x5d0fe8){if(_0x5d0fe8){return _0x44eb3a[_0xb7da('0x27')](_0x2d6a9e);}return _0x44eb3a[_0xb7da('0x28')](_0x2d6a9e)[_0xb7da('0x29')]();};}function respondWithResult(_0x50e668,_0x1a0d3c){_0x1a0d3c=_0x1a0d3c||0xc8;return function(_0x5839d4){if(_0x5839d4){return _0x50e668[_0xb7da('0x28')](_0x1a0d3c)[_0xb7da('0x2a')](_0x5839d4);}};}function respondWithFilteredResult(_0x21d2e6,_0x2545bb){return function(_0x2876ce){if(_0x2876ce){var _0x565b24=_0x2876ce[_0xb7da('0x2b')],_0x20f410=_0x2545bb['offset'],_0x1e564d=_0x2545bb[_0xb7da('0x2c')]+_0x2545bb[_0xb7da('0x2d')],_0x412e08;if(_0x1e564d>=_0x565b24){_0x1e564d=_0x565b24;_0x412e08=0xc8;}else{_0x412e08=0xce;}_0x21d2e6[_0xb7da('0x28')](_0x412e08);return _0x21d2e6['set'](_0xb7da('0x2e'),_0x20f410+'-'+_0x1e564d+'/'+_0x565b24)['json'](_0x2876ce);}return null;};}function patchUpdates(_0x36f907){return function(_0x36916b){try{jsonpatch['apply'](_0x36916b,_0x36f907,!![]);}catch(_0x5d55bb){return BPromise[_0xb7da('0x2f')](_0x5d55bb);}return _0x36916b[_0xb7da('0x30')]();};}function saveUpdates(_0x3e8ba6,_0x37634f){return function(_0x21b7f1){if(_0x21b7f1){return _0x21b7f1[_0xb7da('0x31')](_0x3e8ba6)[_0xb7da('0x32')](function(_0x32eb77){return _0x32eb77;});}return null;};}function removeEntity(_0x1ad26a,_0x45e250){return function(_0x39fa7){if(_0x39fa7){return _0x39fa7[_0xb7da('0x33')]()[_0xb7da('0x32')](function(){_0x1ad26a['status'](0xcc)[_0xb7da('0x29')]();});}};}function handleEntityNotFound(_0x13d229,_0x20a004){return function(_0x2d09a5){if(!_0x2d09a5){_0x13d229[_0xb7da('0x27')](0x194);}return _0x2d09a5;};}function handleError(_0x561215,_0x3b327f){_0x3b327f=_0x3b327f||0x1f4;return function(_0x5291b9){logger['error'](_0x5291b9[_0xb7da('0x34')]);if(_0x5291b9[_0xb7da('0x35')]){delete _0x5291b9['name'];}_0x561215[_0xb7da('0x28')](_0x3b327f)[_0xb7da('0x36')](_0x5291b9);};}exports[_0xb7da('0x37')]=function(_0x594105,_0x3e76e5){var _0x2f6f9f={},_0x1fb6a2={},_0x360a06={'count':0x0,'rows':[]};var _0x3026a8=db['ZendeskAccount'][_0xb7da('0x38')];_0x1fb6a2[_0xb7da('0x39')]=_['keys'](_0x3026a8);_0x1fb6a2[_0xb7da('0x3a')]=_[_0xb7da('0x3b')](_0x594105['query']);_0x1fb6a2['filters']=_['intersection'](_0x1fb6a2[_0xb7da('0x39')],_0x1fb6a2[_0xb7da('0x3a')]);_0x2f6f9f[_0xb7da('0x3c')]=_[_0xb7da('0x3d')](_0x1fb6a2[_0xb7da('0x39')],qs[_0xb7da('0x3e')](_0x594105[_0xb7da('0x3a')]['fields']));_0x2f6f9f['attributes']=_0x2f6f9f[_0xb7da('0x3c')]['length']?_0x2f6f9f[_0xb7da('0x3c')]:_0x1fb6a2['model'];if(!_0x594105[_0xb7da('0x3a')][_0xb7da('0x3f')](_0xb7da('0x40'))){_0x2f6f9f[_0xb7da('0x2d')]=qs[_0xb7da('0x2d')](_0x594105['query'][_0xb7da('0x2d')]);_0x2f6f9f[_0xb7da('0x2c')]=qs[_0xb7da('0x2c')](_0x594105['query']['offset']);}_0x2f6f9f[_0xb7da('0x41')]=qs[_0xb7da('0x42')](_0x594105[_0xb7da('0x3a')][_0xb7da('0x42')]);_0x2f6f9f['where']=qs[_0xb7da('0x43')](_[_0xb7da('0x44')](_0x594105[_0xb7da('0x3a')],_0x1fb6a2['filters']));if(_0x594105['query'][_0xb7da('0x45')]){_0x2f6f9f[_0xb7da('0x46')]=_[_0xb7da('0x47')](_0x2f6f9f[_0xb7da('0x46')],{'$or':_[_0xb7da('0x48')](_0x3026a8,function(_0x2acd4f){if(_0x2acd4f[_0xb7da('0x49')][_0xb7da('0x4a')]!==_0xb7da('0x4b')){var _0x5364b3={};_0x5364b3[_0x2acd4f['field']]={'$like':'%'+_0x594105['query'][_0xb7da('0x45')]+'%'};return _0x5364b3;}})});}_0x2f6f9f=_[_0xb7da('0x47')]({},_0x2f6f9f,_0x594105[_0xb7da('0x4c')]);var _0x26df5a={'where':_0x2f6f9f[_0xb7da('0x46')]};return db[_0xb7da('0x4d')][_0xb7da('0x2b')](_0x26df5a)[_0xb7da('0x32')](function(_0x52ebc1){_0x360a06[_0xb7da('0x2b')]=_0x52ebc1;if(_0x594105[_0xb7da('0x3a')]['includeAll']){_0x2f6f9f['include']=[{'all':!![]}];}return db[_0xb7da('0x4d')][_0xb7da('0x4e')](_0x2f6f9f);})[_0xb7da('0x32')](function(_0x957d9f){_0x360a06[_0xb7da('0x4f')]=_0x957d9f;return _0x360a06;})[_0xb7da('0x32')](respondWithFilteredResult(_0x3e76e5,_0x2f6f9f))[_0xb7da('0x26')](handleError(_0x3e76e5,null));};exports['show']=function(_0x4d91b1,_0x313a40){var _0x1053d6={'raw':![],'where':{'id':_0x4d91b1[_0xb7da('0x50')]['id']}},_0x18c8ee={};_0x18c8ee[_0xb7da('0x39')]=_['keys'](db[_0xb7da('0x4d')]['rawAttributes']);_0x18c8ee[_0xb7da('0x3a')]=_[_0xb7da('0x3b')](_0x4d91b1[_0xb7da('0x3a')]);_0x18c8ee[_0xb7da('0x43')]=_[_0xb7da('0x3d')](_0x18c8ee[_0xb7da('0x39')],_0x18c8ee['query']);_0x1053d6['attributes']=_[_0xb7da('0x3d')](_0x18c8ee[_0xb7da('0x39')],qs[_0xb7da('0x3e')](_0x4d91b1[_0xb7da('0x3a')][_0xb7da('0x3e')]));_0x1053d6['attributes']=_0x1053d6['attributes']['length']?_0x1053d6['attributes']:_0x18c8ee[_0xb7da('0x39')];if(_0x4d91b1['query'][_0xb7da('0x51')]){_0x1053d6['include']=[{'all':!![]}];}_0x1053d6=_[_0xb7da('0x47')]({},_0x1053d6,_0x4d91b1[_0xb7da('0x4c')]);return db['ZendeskAccount'][_0xb7da('0x52')](_0x1053d6)[_0xb7da('0x32')](handleEntityNotFound(_0x313a40,null))[_0xb7da('0x32')](respondWithResult(_0x313a40,null))['catch'](handleError(_0x313a40,null));};exports[_0xb7da('0x53')]=function(_0x28b22b,_0x1a71a9){return db[_0xb7da('0x4d')][_0xb7da('0x53')](_0x28b22b[_0xb7da('0x54')],{})[_0xb7da('0x32')](respondWithResult(_0x1a71a9,0xc9))[_0xb7da('0x26')](handleError(_0x1a71a9,null));};exports['update']=function(_0x4316cc,_0x5d4aac){if(_0x4316cc[_0xb7da('0x54')]['id']){delete _0x4316cc[_0xb7da('0x54')]['id'];}return db[_0xb7da('0x4d')][_0xb7da('0x52')]({'where':{'id':_0x4316cc['params']['id']}})[_0xb7da('0x32')](handleEntityNotFound(_0x5d4aac,null))[_0xb7da('0x32')](saveUpdates(_0x4316cc[_0xb7da('0x54')],null))['then'](respondWithResult(_0x5d4aac,null))[_0xb7da('0x26')](handleError(_0x5d4aac,null));};exports[_0xb7da('0x33')]=function(_0x5bd39a,_0x3f9f22){return db['ZendeskAccount'][_0xb7da('0x52')]({'where':{'id':_0x5bd39a[_0xb7da('0x50')]['id']}})['then'](handleEntityNotFound(_0x3f9f22,null))['then'](removeEntity(_0x3f9f22,null))[_0xb7da('0x26')](handleError(_0x3f9f22,null));};exports[_0xb7da('0x55')]=function(_0x32e565,_0x7dbb1,_0x4d31cf){var _0x4133cb={};var _0x3ebd56={};var _0x5e9bdd;var _0x13b2de;return db['ZendeskAccount'][_0xb7da('0x56')]({'where':{'id':_0x32e565[_0xb7da('0x50')]['id']}})[_0xb7da('0x32')](handleEntityNotFound(_0x7dbb1,null))[_0xb7da('0x32')](function(_0x4d772c){if(_0x4d772c){_0x5e9bdd=_0x4d772c;_0x3ebd56[_0xb7da('0x39')]=_[_0xb7da('0x3b')](db[_0xb7da('0x57')][_0xb7da('0x38')]);_0x3ebd56[_0xb7da('0x3a')]=_[_0xb7da('0x3b')](_0x32e565[_0xb7da('0x3a')]);_0x3ebd56[_0xb7da('0x43')]=_[_0xb7da('0x3d')](_0x3ebd56[_0xb7da('0x39')],_0x3ebd56[_0xb7da('0x3a')]);_0x4133cb[_0xb7da('0x3c')]=_[_0xb7da('0x3d')](_0x3ebd56[_0xb7da('0x39')],qs[_0xb7da('0x3e')](_0x32e565[_0xb7da('0x3a')]['fields']));_0x4133cb['attributes']=_0x4133cb[_0xb7da('0x3c')][_0xb7da('0x58')]?_0x4133cb['attributes']:_0x3ebd56[_0xb7da('0x39')];_0x4133cb[_0xb7da('0x41')]=qs[_0xb7da('0x42')](_0x32e565[_0xb7da('0x3a')][_0xb7da('0x42')]);_0x4133cb[_0xb7da('0x46')]=qs['filters'](_[_0xb7da('0x44')](_0x32e565[_0xb7da('0x3a')],_0x3ebd56['filters']));if(_0x32e565[_0xb7da('0x3a')][_0xb7da('0x45')]){_0x4133cb[_0xb7da('0x46')]=_[_0xb7da('0x47')](_0x4133cb[_0xb7da('0x46')],{'$or':_[_0xb7da('0x48')](_0x4133cb[_0xb7da('0x3c')],function(_0x357691){var _0x13665d={};_0x13665d[_0x357691]={'$like':'%'+_0x32e565[_0xb7da('0x3a')][_0xb7da('0x45')]+'%'};return _0x13665d;})});}_0x4133cb=_['merge']({},_0x4133cb,_0x32e565[_0xb7da('0x4c')]);return _0x5e9bdd[_0xb7da('0x55')](_0x4133cb);}})['then'](function(_0x4eef13){if(_0x4eef13){_0x13b2de=_0x4eef13['length'];if(!_0x32e565[_0xb7da('0x3a')][_0xb7da('0x3f')]('nolimit')){_0x4133cb[_0xb7da('0x2d')]=qs[_0xb7da('0x2d')](_0x32e565[_0xb7da('0x3a')]['limit']);_0x4133cb[_0xb7da('0x2c')]=qs['offset'](_0x32e565['query']['offset']);}return _0x5e9bdd[_0xb7da('0x55')](_0x4133cb);}})[_0xb7da('0x32')](function(_0x14310c){if(_0x14310c){return _0x14310c?{'count':_0x13b2de,'rows':_0x14310c}:null;}})[_0xb7da('0x32')](respondWithResult(_0x7dbb1,null))[_0xb7da('0x26')](handleError(_0x7dbb1,null));};exports[_0xb7da('0x59')]=function(_0x349276,_0x53c5a2,_0x1a2bad){if(_0x349276['body']['id']){delete _0x349276['body']['id'];}return db[_0xb7da('0x4d')]['findOne']({'where':{'id':_0x349276[_0xb7da('0x50')]['id']}})[_0xb7da('0x32')](handleEntityNotFound(_0x53c5a2,null))[_0xb7da('0x32')](function(_0x946be7){if(_0x946be7){_0x349276[_0xb7da('0x54')][_0xb7da('0x5a')]=_0x946be7['id'];_0x349276[_0xb7da('0x54')][_0xb7da('0x5b')]=integrations[_0xb7da('0x5c')](_0x349276[_0xb7da('0x54')][_0xb7da('0x5d')],_0x349276['body']['type']);_0x349276['body']['Descriptions']=integrations['getDescriptions'](_0x349276['body'][_0xb7da('0x5d')],_0x349276[_0xb7da('0x54')][_0xb7da('0x49')]);return db[_0xb7da('0x57')][_0xb7da('0x53')](_0x349276[_0xb7da('0x54')],{'include':[{'model':db[_0xb7da('0x5e')],'as':_0xb7da('0x5b')},{'model':db[_0xb7da('0x5e')],'as':_0xb7da('0x5f')}]});}return null;})[_0xb7da('0x32')](respondWithResult(_0x53c5a2,null))[_0xb7da('0x26')](handleError(_0x53c5a2,null));};exports[_0xb7da('0x60')]=function(_0x427d84,_0x4993ff,_0x781ca3){var _0xce38e3='';return db[_0xb7da('0x4d')][_0xb7da('0x56')]({'where':{'id':_0x427d84[_0xb7da('0x50')]['id']},'attributes':['id',_0xb7da('0x61'),_0xb7da('0x62'),_0xb7da('0x63'),_0xb7da('0x64'),_0xb7da('0x65')]})[_0xb7da('0x32')](handleEntityNotFound(_0x4993ff,null))[_0xb7da('0x32')](function(_0x4ee13d){if(_0x4ee13d){_0xce38e3=_0x4ee13d[_0xb7da('0x65')];var _0x5b91bb=_0xce38e3[_0xb7da('0x66')](-0x1);if(_0x5b91bb==='/'){_0xce38e3=_0xce38e3['substring'](0x0,_0xce38e3[_0xb7da('0x67')](_0x5b91bb));}var _0x213723={'method':_0xb7da('0x68'),'uri':util[_0xb7da('0x69')]('%s/%s',_0xce38e3,_0xb7da('0x6a')),'json':!![]};switch(_0x4ee13d[_0xb7da('0x64')]){case'password':_0x213723[_0xb7da('0x6b')]={'Authorization':util[_0xb7da('0x69')](_0xb7da('0x6c'),new Buffer(util[_0xb7da('0x69')](_0xb7da('0x6d'),_0x4ee13d['username'],_0x4ee13d[_0xb7da('0x62')]))[_0xb7da('0x6e')](_0xb7da('0x6f')))};break;case _0xb7da('0x63'):_0x213723[_0xb7da('0x6b')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xb7da('0x69')](_0xb7da('0x70'),_0x4ee13d[_0xb7da('0x61')],_0x4ee13d[_0xb7da('0x63')]))['toString'](_0xb7da('0x6f')))};break;default:throw new db[(_0xb7da('0x71'))][(_0xb7da('0x72'))]('Unknown\x20authentication\x20type');}return rp(_0x213723);}})[_0xb7da('0x32')](function(_0x5db16e){if(_0x5db16e){var _0x2fc504=['subject',_0xb7da('0x73'),'group',_0xb7da('0x74')];_[_0xb7da('0x75')](_0x5db16e[_0xb7da('0x6a')],function(_0xadf8cf){return _0x2fc504[_0xb7da('0x76')](_0xadf8cf[_0xb7da('0x49')]);});return{'count':_0x5db16e['ticket_fields'][_0xb7da('0x58')],'rows':_[_0xb7da('0x48')](_0x5db16e[_0xb7da('0x6a')],function(_0x2cc90d){return{'id':_0x2cc90d['id'],'name':_0x2cc90d[_0xb7da('0x77')]>0x7?_0x2cc90d[_0xb7da('0x78')]:_0x2cc90d[_0xb7da('0x49')],'custom':_0x2cc90d['position']>0x7?!![]:![],'options':_0x2cc90d[_0xb7da('0x79')]?_0x2cc90d[_0xb7da('0x79')]:_0x2cc90d['custom_field_options']?_0x2cc90d[_0xb7da('0x7a')]:[]};})};}})[_0xb7da('0x32')](respondWithResult(_0x4993ff,null))[_0xb7da('0x26')](function(_0x16f4d5){var _0x1a7aa6=_0x427d84[_0xb7da('0x3a')][_0xb7da('0x7b')]?0x1f4:_0x16f4d5[_0xb7da('0x7c')]||0x1f4;logger[_0xb7da('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0xb7da('0x60'),_0x1a7aa6,JSON[_0xb7da('0x21')](_0x16f4d5));delete _0x16f4d5[_0xb7da('0x35')];if(_0x1a7aa6===0x191){_0x1a7aa6=0x190;}_0x4993ff[_0xb7da('0x28')](_0x1a7aa6)[_0xb7da('0x36')](_0x427d84[_0xb7da('0x3a')][_0xb7da('0x7b')]?{'message':_0xb7da('0x7d'),'statusCode':_0x16f4d5[_0xb7da('0x7c')]}:_0x16f4d5);});}; \ No newline at end of file +var _0x0cde=['message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','stack','name','send','index','ZendeskAccount','rawAttributes','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','ZendeskConfiguration','length','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','type','Descriptions','getFields','username','password','token','remoteUri','slice','substring','GET','%s/%s','ticket_fields','authType','headers','format','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','stringify','error'];(function(_0x5232f0,_0x38e509){var _0x526a40=function(_0x5483f2){while(--_0x5483f2){_0x5232f0['push'](_0x5232f0['shift']());}};_0x526a40(++_0x38e509);}(_0x0cde,0x1d0));var _0xe0cd=function(_0x5ebba4,_0x54e215){_0x5ebba4=_0x5ebba4-0x0;var _0x4a510b=_0x0cde[_0x5ebba4];return _0x4a510b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe0cd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe0cd('0x1'));var rp=require(_0xe0cd('0x2'));var moment=require(_0xe0cd('0x3'));var BPromise=require(_0xe0cd('0x4'));var Mustache=require(_0xe0cd('0x5'));var util=require(_0xe0cd('0x6'));var path=require(_0xe0cd('0x7'));var sox=require(_0xe0cd('0x8'));var csv=require(_0xe0cd('0x9'));var ejs=require(_0xe0cd('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe0cd('0xb'));var crypto=require(_0xe0cd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe0cd('0x9'));var querystring=require(_0xe0cd('0xd'));var Papa=require(_0xe0cd('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0xe0cd('0xf'));var Redis=require(_0xe0cd('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xe0cd('0x11'))(_0xe0cd('0x12'));var utils=require(_0xe0cd('0x13'));var config=require(_0xe0cd('0x14'));var db=require(_0xe0cd('0x15'))['db'];var integrations=require(_0xe0cd('0x16'));var jayson=require(_0xe0cd('0x17'));var client=jayson['client'][_0xe0cd('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x113ecd,_0x479c7a,_0xcf239d,_0x3cf9ec){return new BPromise(function(_0x24fbc8,_0x1b3a15){var _0x1c9ea2=_0x3cf9ec||client;return _0x1c9ea2[_0xe0cd('0x19')](_0x113ecd,_0xcf239d)[_0xe0cd('0x1a')](function(_0x3da23d){logger[_0xe0cd('0x1b')](_0xe0cd('0x1c'),_0x479c7a,'request\x20sent');logger[_0xe0cd('0x1d')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x479c7a,'request\x20sent',JSON[_0xe0cd('0x1e')](_0x3da23d));if(_0x3da23d['error']){if(_0x3da23d[_0xe0cd('0x1f')]['code']===0x1f4){logger[_0xe0cd('0x1f')](_0xe0cd('0x1c'),_0x479c7a,_0x3da23d[_0xe0cd('0x1f')][_0xe0cd('0x20')]);return _0x1b3a15(_0x3da23d[_0xe0cd('0x1f')]['message']);}logger[_0xe0cd('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x479c7a,_0x3da23d[_0xe0cd('0x1f')][_0xe0cd('0x20')]);return _0x24fbc8(_0x3da23d[_0xe0cd('0x1f')]['message']);}else{logger[_0xe0cd('0x1b')]('ZendeskAccount,\x20%s,\x20%s',_0x479c7a,_0xe0cd('0x21'));_0x24fbc8(_0x3da23d[_0xe0cd('0x22')]['message']);}})[_0xe0cd('0x23')](function(_0x3c3141){logger['error'](_0xe0cd('0x1c'),_0x479c7a,_0x3c3141);_0x1b3a15(_0x3c3141);});});}function respondWithStatusCode(_0x3222cf,_0x35611d){_0x35611d=_0x35611d||0xcc;return function(_0x1a7618){if(_0x1a7618){return _0x3222cf[_0xe0cd('0x24')](_0x35611d);}return _0x3222cf[_0xe0cd('0x25')](_0x35611d)[_0xe0cd('0x26')]();};}function respondWithResult(_0x3f039e,_0x4a8008){_0x4a8008=_0x4a8008||0xc8;return function(_0x4684c8){if(_0x4684c8){return _0x3f039e['status'](_0x4a8008)[_0xe0cd('0x27')](_0x4684c8);}};}function respondWithFilteredResult(_0x5b4a95,_0x50139b){return function(_0x3a2dc4){if(_0x3a2dc4){var _0x20c898=_0x3a2dc4[_0xe0cd('0x28')],_0xac431f=_0x50139b[_0xe0cd('0x29')],_0x19a9ee=_0x50139b['offset']+_0x50139b[_0xe0cd('0x2a')],_0x5ba2b8;if(_0x19a9ee>=_0x20c898){_0x19a9ee=_0x20c898;_0x5ba2b8=0xc8;}else{_0x5ba2b8=0xce;}_0x5b4a95[_0xe0cd('0x25')](_0x5ba2b8);return _0x5b4a95[_0xe0cd('0x2b')](_0xe0cd('0x2c'),_0xac431f+'-'+_0x19a9ee+'/'+_0x20c898)[_0xe0cd('0x27')](_0x3a2dc4);}return null;};}function patchUpdates(_0x2e4cba){return function(_0x41bc00){try{jsonpatch['apply'](_0x41bc00,_0x2e4cba,!![]);}catch(_0x4d6120){return BPromise['reject'](_0x4d6120);}return _0x41bc00[_0xe0cd('0x2d')]();};}function saveUpdates(_0x39aed9,_0x5808a8){return function(_0x5ddb0a){if(_0x5ddb0a){return _0x5ddb0a[_0xe0cd('0x2e')](_0x39aed9)['then'](function(_0x28d65e){return _0x28d65e;});}return null;};}function removeEntity(_0x3a40c7,_0x9146fe){return function(_0x1484eb){if(_0x1484eb){return _0x1484eb[_0xe0cd('0x2f')]()[_0xe0cd('0x1a')](function(){_0x3a40c7[_0xe0cd('0x25')](0xcc)[_0xe0cd('0x26')]();});}};}function handleEntityNotFound(_0x19d3bb,_0x40126e){return function(_0xf1c83e){if(!_0xf1c83e){_0x19d3bb[_0xe0cd('0x24')](0x194);}return _0xf1c83e;};}function handleError(_0x4596a3,_0x101d60){_0x101d60=_0x101d60||0x1f4;return function(_0x2234af){logger['error'](_0x2234af[_0xe0cd('0x30')]);if(_0x2234af['name']){delete _0x2234af[_0xe0cd('0x31')];}_0x4596a3['status'](_0x101d60)[_0xe0cd('0x32')](_0x2234af);};}exports[_0xe0cd('0x33')]=function(_0x54bbf9,_0x45e547){var _0x42f809={},_0x29b9da={},_0x4f5ab6={'count':0x0,'rows':[]};var _0x51392c=db[_0xe0cd('0x34')][_0xe0cd('0x35')];_0x29b9da['model']=_[_0xe0cd('0x36')](_0x51392c);_0x29b9da[_0xe0cd('0x37')]=_[_0xe0cd('0x36')](_0x54bbf9[_0xe0cd('0x37')]);_0x29b9da[_0xe0cd('0x38')]=_[_0xe0cd('0x39')](_0x29b9da[_0xe0cd('0x3a')],_0x29b9da[_0xe0cd('0x37')]);_0x42f809[_0xe0cd('0x3b')]=_['intersection'](_0x29b9da[_0xe0cd('0x3a')],qs[_0xe0cd('0x3c')](_0x54bbf9[_0xe0cd('0x37')][_0xe0cd('0x3c')]));_0x42f809[_0xe0cd('0x3b')]=_0x42f809[_0xe0cd('0x3b')]['length']?_0x42f809[_0xe0cd('0x3b')]:_0x29b9da[_0xe0cd('0x3a')];if(!_0x54bbf9['query']['hasOwnProperty'](_0xe0cd('0x3d'))){_0x42f809[_0xe0cd('0x2a')]=qs['limit'](_0x54bbf9[_0xe0cd('0x37')][_0xe0cd('0x2a')]);_0x42f809[_0xe0cd('0x29')]=qs[_0xe0cd('0x29')](_0x54bbf9[_0xe0cd('0x37')][_0xe0cd('0x29')]);}_0x42f809[_0xe0cd('0x3e')]=qs[_0xe0cd('0x3f')](_0x54bbf9[_0xe0cd('0x37')]['sort']);_0x42f809[_0xe0cd('0x40')]=qs[_0xe0cd('0x38')](_[_0xe0cd('0x41')](_0x54bbf9[_0xe0cd('0x37')],_0x29b9da[_0xe0cd('0x38')]));if(_0x54bbf9[_0xe0cd('0x37')][_0xe0cd('0x42')]){_0x42f809[_0xe0cd('0x40')]=_[_0xe0cd('0x43')](_0x42f809[_0xe0cd('0x40')],{'$or':_[_0xe0cd('0x44')](_0x51392c,function(_0x3d115d){if(_0x3d115d['type']['key']!==_0xe0cd('0x45')){var _0x99a40f={};_0x99a40f[_0x3d115d['field']]={'$like':'%'+_0x54bbf9[_0xe0cd('0x37')][_0xe0cd('0x42')]+'%'};return _0x99a40f;}})});}_0x42f809=_[_0xe0cd('0x43')]({},_0x42f809,_0x54bbf9[_0xe0cd('0x46')]);var _0x587cd4={'where':_0x42f809[_0xe0cd('0x40')]};return db[_0xe0cd('0x34')][_0xe0cd('0x28')](_0x587cd4)['then'](function(_0x58fd8a){_0x4f5ab6[_0xe0cd('0x28')]=_0x58fd8a;if(_0x54bbf9[_0xe0cd('0x37')][_0xe0cd('0x47')]){_0x42f809[_0xe0cd('0x48')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xe0cd('0x49')](_0x42f809);})[_0xe0cd('0x1a')](function(_0xe75aca){_0x4f5ab6[_0xe0cd('0x4a')]=_0xe75aca;return _0x4f5ab6;})[_0xe0cd('0x1a')](respondWithFilteredResult(_0x45e547,_0x42f809))[_0xe0cd('0x23')](handleError(_0x45e547,null));};exports[_0xe0cd('0x4b')]=function(_0x3fb764,_0x25dbb7){var _0x2c8eb8={'raw':![],'where':{'id':_0x3fb764[_0xe0cd('0x4c')]['id']}},_0x173f47={};_0x173f47[_0xe0cd('0x3a')]=_[_0xe0cd('0x36')](db['ZendeskAccount'][_0xe0cd('0x35')]);_0x173f47[_0xe0cd('0x37')]=_[_0xe0cd('0x36')](_0x3fb764[_0xe0cd('0x37')]);_0x173f47['filters']=_['intersection'](_0x173f47[_0xe0cd('0x3a')],_0x173f47[_0xe0cd('0x37')]);_0x2c8eb8[_0xe0cd('0x3b')]=_[_0xe0cd('0x39')](_0x173f47['model'],qs[_0xe0cd('0x3c')](_0x3fb764[_0xe0cd('0x37')][_0xe0cd('0x3c')]));_0x2c8eb8[_0xe0cd('0x3b')]=_0x2c8eb8['attributes']['length']?_0x2c8eb8[_0xe0cd('0x3b')]:_0x173f47[_0xe0cd('0x3a')];if(_0x3fb764['query'][_0xe0cd('0x47')]){_0x2c8eb8[_0xe0cd('0x48')]=[{'all':!![]}];}_0x2c8eb8=_['merge']({},_0x2c8eb8,_0x3fb764[_0xe0cd('0x46')]);return db[_0xe0cd('0x34')][_0xe0cd('0x4d')](_0x2c8eb8)[_0xe0cd('0x1a')](handleEntityNotFound(_0x25dbb7,null))[_0xe0cd('0x1a')](respondWithResult(_0x25dbb7,null))[_0xe0cd('0x23')](handleError(_0x25dbb7,null));};exports[_0xe0cd('0x4e')]=function(_0x5c2967,_0xf1258a){return db[_0xe0cd('0x34')]['create'](_0x5c2967[_0xe0cd('0x4f')],{})[_0xe0cd('0x1a')](respondWithResult(_0xf1258a,0xc9))[_0xe0cd('0x23')](handleError(_0xf1258a,null));};exports[_0xe0cd('0x2e')]=function(_0x44e0b9,_0xf73960){if(_0x44e0b9[_0xe0cd('0x4f')]['id']){delete _0x44e0b9[_0xe0cd('0x4f')]['id'];}return db[_0xe0cd('0x34')][_0xe0cd('0x4d')]({'where':{'id':_0x44e0b9['params']['id']}})[_0xe0cd('0x1a')](handleEntityNotFound(_0xf73960,null))[_0xe0cd('0x1a')](saveUpdates(_0x44e0b9[_0xe0cd('0x4f')],null))[_0xe0cd('0x1a')](respondWithResult(_0xf73960,null))[_0xe0cd('0x23')](handleError(_0xf73960,null));};exports['destroy']=function(_0xd4baeb,_0x5918be){return db[_0xe0cd('0x34')][_0xe0cd('0x4d')]({'where':{'id':_0xd4baeb[_0xe0cd('0x4c')]['id']}})[_0xe0cd('0x1a')](handleEntityNotFound(_0x5918be,null))[_0xe0cd('0x1a')](removeEntity(_0x5918be,null))[_0xe0cd('0x23')](handleError(_0x5918be,null));};exports['getConfigurations']=function(_0x1e5118,_0x799924,_0x2e3476){var _0x1459be={};var _0x82f246={};var _0x5813f2;var _0x2c5205;return db[_0xe0cd('0x34')]['findOne']({'where':{'id':_0x1e5118['params']['id']}})[_0xe0cd('0x1a')](handleEntityNotFound(_0x799924,null))[_0xe0cd('0x1a')](function(_0xc8da7b){if(_0xc8da7b){_0x5813f2=_0xc8da7b;_0x82f246[_0xe0cd('0x3a')]=_[_0xe0cd('0x36')](db[_0xe0cd('0x50')]['rawAttributes']);_0x82f246['query']=_['keys'](_0x1e5118[_0xe0cd('0x37')]);_0x82f246[_0xe0cd('0x38')]=_[_0xe0cd('0x39')](_0x82f246[_0xe0cd('0x3a')],_0x82f246['query']);_0x1459be[_0xe0cd('0x3b')]=_[_0xe0cd('0x39')](_0x82f246[_0xe0cd('0x3a')],qs[_0xe0cd('0x3c')](_0x1e5118[_0xe0cd('0x37')][_0xe0cd('0x3c')]));_0x1459be[_0xe0cd('0x3b')]=_0x1459be[_0xe0cd('0x3b')][_0xe0cd('0x51')]?_0x1459be[_0xe0cd('0x3b')]:_0x82f246[_0xe0cd('0x3a')];_0x1459be['order']=qs[_0xe0cd('0x3f')](_0x1e5118[_0xe0cd('0x37')][_0xe0cd('0x3f')]);_0x1459be[_0xe0cd('0x40')]=qs[_0xe0cd('0x38')](_[_0xe0cd('0x41')](_0x1e5118[_0xe0cd('0x37')],_0x82f246[_0xe0cd('0x38')]));if(_0x1e5118[_0xe0cd('0x37')]['filter']){_0x1459be[_0xe0cd('0x40')]=_[_0xe0cd('0x43')](_0x1459be['where'],{'$or':_['map'](_0x1459be[_0xe0cd('0x3b')],function(_0x517bad){var _0x1b2bf0={};_0x1b2bf0[_0x517bad]={'$like':'%'+_0x1e5118['query'][_0xe0cd('0x42')]+'%'};return _0x1b2bf0;})});}_0x1459be=_[_0xe0cd('0x43')]({},_0x1459be,_0x1e5118[_0xe0cd('0x46')]);return _0x5813f2[_0xe0cd('0x52')](_0x1459be);}})['then'](function(_0x48eae5){if(_0x48eae5){_0x2c5205=_0x48eae5['length'];if(!_0x1e5118['query']['hasOwnProperty'](_0xe0cd('0x3d'))){_0x1459be['limit']=qs['limit'](_0x1e5118[_0xe0cd('0x37')][_0xe0cd('0x2a')]);_0x1459be[_0xe0cd('0x29')]=qs[_0xe0cd('0x29')](_0x1e5118['query'][_0xe0cd('0x29')]);}return _0x5813f2[_0xe0cd('0x52')](_0x1459be);}})[_0xe0cd('0x1a')](function(_0x2f07e9){if(_0x2f07e9){return _0x2f07e9?{'count':_0x2c5205,'rows':_0x2f07e9}:null;}})[_0xe0cd('0x1a')](respondWithResult(_0x799924,null))['catch'](handleError(_0x799924,null));};exports['addConfiguration']=function(_0x534296,_0x5f55e9,_0x5ee304){if(_0x534296[_0xe0cd('0x4f')]['id']){delete _0x534296[_0xe0cd('0x4f')]['id'];}return db['ZendeskAccount'][_0xe0cd('0x53')]({'where':{'id':_0x534296[_0xe0cd('0x4c')]['id']}})[_0xe0cd('0x1a')](handleEntityNotFound(_0x5f55e9,null))['then'](function(_0x3239cd){if(_0x3239cd){_0x534296[_0xe0cd('0x4f')][_0xe0cd('0x54')]=_0x3239cd['id'];_0x534296[_0xe0cd('0x4f')][_0xe0cd('0x55')]=integrations[_0xe0cd('0x56')](_0x534296[_0xe0cd('0x4f')][_0xe0cd('0x57')],_0x534296[_0xe0cd('0x4f')]['type']);_0x534296['body']['Descriptions']=integrations[_0xe0cd('0x58')](_0x534296['body']['channel'],_0x534296[_0xe0cd('0x4f')][_0xe0cd('0x59')]);return db['ZendeskConfiguration']['create'](_0x534296[_0xe0cd('0x4f')],{'include':[{'model':db['ZendeskField'],'as':_0xe0cd('0x55')},{'model':db['ZendeskField'],'as':_0xe0cd('0x5a')}]});}return null;})[_0xe0cd('0x1a')](respondWithResult(_0x5f55e9,null))['catch'](handleError(_0x5f55e9,null));};exports[_0xe0cd('0x5b')]=function(_0x39a56d,_0x42b21a,_0xd1d3d5){var _0x1b8fd5='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x39a56d['params']['id']},'attributes':['id',_0xe0cd('0x5c'),_0xe0cd('0x5d'),_0xe0cd('0x5e'),'authType',_0xe0cd('0x5f')]})['then'](handleEntityNotFound(_0x42b21a,null))[_0xe0cd('0x1a')](function(_0x2f8686){if(_0x2f8686){_0x1b8fd5=_0x2f8686[_0xe0cd('0x5f')];var _0x1934b4=_0x1b8fd5[_0xe0cd('0x60')](-0x1);if(_0x1934b4==='/'){_0x1b8fd5=_0x1b8fd5[_0xe0cd('0x61')](0x0,_0x1b8fd5['lastIndexOf'](_0x1934b4));}var _0x11bd28={'method':_0xe0cd('0x62'),'uri':util['format'](_0xe0cd('0x63'),_0x1b8fd5,_0xe0cd('0x64')),'json':!![]};switch(_0x2f8686[_0xe0cd('0x65')]){case _0xe0cd('0x5d'):_0x11bd28[_0xe0cd('0x66')]={'Authorization':util[_0xe0cd('0x67')](_0xe0cd('0x68'),new Buffer(util['format'](_0xe0cd('0x69'),_0x2f8686[_0xe0cd('0x5c')],_0x2f8686['password']))[_0xe0cd('0x6a')](_0xe0cd('0x6b')))};break;case _0xe0cd('0x5e'):_0x11bd28[_0xe0cd('0x66')]={'Authorization':util[_0xe0cd('0x67')](_0xe0cd('0x68'),new Buffer(util['format'](_0xe0cd('0x6c'),_0x2f8686['username'],_0x2f8686[_0xe0cd('0x5e')]))[_0xe0cd('0x6a')](_0xe0cd('0x6b')))};break;default:throw new db[(_0xe0cd('0x6d'))][(_0xe0cd('0x6e'))](_0xe0cd('0x6f'));}return rp(_0x11bd28);}})[_0xe0cd('0x1a')](function(_0x571485){if(_0x571485){var _0x434bc9=[_0xe0cd('0x70'),_0xe0cd('0x71'),'group',_0xe0cd('0x72')];_[_0xe0cd('0x73')](_0x571485[_0xe0cd('0x64')],function(_0x53db77){return _0x434bc9[_0xe0cd('0x74')](_0x53db77['type']);});return{'count':_0x571485[_0xe0cd('0x64')][_0xe0cd('0x51')],'rows':_[_0xe0cd('0x44')](_0x571485[_0xe0cd('0x64')],function(_0x202d0d){return{'id':_0x202d0d['id'],'name':_0x202d0d[_0xe0cd('0x75')]>0x7?_0x202d0d['title']:_0x202d0d[_0xe0cd('0x59')],'custom':_0x202d0d[_0xe0cd('0x75')]>0x7?!![]:![],'options':_0x202d0d['system_field_options']?_0x202d0d[_0xe0cd('0x76')]:_0x202d0d[_0xe0cd('0x77')]?_0x202d0d[_0xe0cd('0x77')]:[]};})};}})[_0xe0cd('0x1a')](respondWithResult(_0x42b21a,null))[_0xe0cd('0x23')](function(_0x1a1272){var _0x5b1b4e=_0x39a56d[_0xe0cd('0x37')][_0xe0cd('0x78')]?0x1f4:_0x1a1272['statusCode']||0x1f4;logger[_0xe0cd('0x1f')](_0xe0cd('0x79'),_0xe0cd('0x5b'),_0x5b1b4e,JSON[_0xe0cd('0x1e')](_0x1a1272));delete _0x1a1272[_0xe0cd('0x31')];if(_0x5b1b4e===0x191){_0x5b1b4e=0x190;}_0x42b21a[_0xe0cd('0x25')](_0x5b1b4e)[_0xe0cd('0x32')](_0x39a56d['query']['test']?{'message':_0xe0cd('0x7a'),'statusCode':_0x1a1272[_0xe0cd('0x7b')]}:_0x1a1272);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index db7fcfa..0b400bb 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 _0xc161=['exports','define','ZendeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../components/integrations/configuration'];(function(_0x64237e,_0x1dcfd5){var _0x263199=function(_0x32cdc0){while(--_0x32cdc0){_0x64237e['push'](_0x64237e['shift']());}};_0x263199(++_0x1dcfd5);}(_0xc161,0x116));var _0x1c16=function(_0x461c39,_0x2ffc4e){_0x461c39=_0x461c39-0x0;var _0x149a9b=_0xc161[_0x461c39];return _0x149a9b;};'use strict';var _=require(_0x1c16('0x0'));var util=require(_0x1c16('0x1'));var logger=require(_0x1c16('0x2'))(_0x1c16('0x3'));var moment=require(_0x1c16('0x4'));var BPromise=require(_0x1c16('0x5'));var rp=require(_0x1c16('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x1c16('0x7'));module[_0x1c16('0x8')]=function(_0x1fd096,_0x34b0ff){return _0x1fd096[_0x1c16('0x9')](_0x1c16('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6db=['moment','bluebird','request-promise','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','util','../../config/logger','api'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0xb6db,0xef));var _0xbb6d=function(_0x33b9d2,_0x290cef){_0x33b9d2=_0x33b9d2-0x0;var _0x4384e8=_0xb6db[_0x33b9d2];return _0x4384e8;};'use strict';var _=require('lodash');var util=require(_0xbb6d('0x0'));var logger=require(_0xbb6d('0x1'))(_0xbb6d('0x2'));var moment=require(_0xbb6d('0x3'));var BPromise=require(_0xbb6d('0x4'));var rp=require(_0xbb6d('0x5'));var attributes=require(_0xbb6d('0x6'));var integrations=require(_0xbb6d('0x7'));module[_0xbb6d('0x8')]=function(_0x3e13b7,_0x493568){return _0x3e13b7[_0xbb6d('0x9')]('ZendeskAccount',attributes,{'tableName':_0xbb6d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index e5c0bc6..c6fa825 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 _0x237b=['jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','findAll','options','raw','where','attributes','include','model','map','debug','ShowZendeskAccount','ZendeskAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x237b,0x1a7));var _0xb237=function(_0x3d7896,_0x1ff5f3){_0x3d7896=_0x3d7896-0x0;var _0x24cab7=_0x237b[_0x3d7896];return _0x24cab7;};'use strict';var _=require(_0xb237('0x0'));var util=require(_0xb237('0x1'));var moment=require(_0xb237('0x2'));var BPromise=require(_0xb237('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb237('0x4'));var db=require(_0xb237('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb237('0x6'))(_0xb237('0x7'));var config=require(_0xb237('0x8'));var jayson=require(_0xb237('0x9'));var client=jayson['client'][_0xb237('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28d218,_0x547910,_0x1b1184){return new BPromise(function(_0x4a3065,_0x1b4922){return client[_0xb237('0xb')](_0x28d218,_0x1b1184)[_0xb237('0xc')](function(_0x43dfc6){logger[_0xb237('0xd')](_0xb237('0xe'),_0x547910,_0xb237('0xf'));logger['debug'](_0xb237('0x10'),_0x547910,_0xb237('0xf'),JSON[_0xb237('0x11')](_0x43dfc6));if(_0x43dfc6[_0xb237('0x12')]){if(_0x43dfc6[_0xb237('0x12')][_0xb237('0x13')]===0x1f4){logger[_0xb237('0x12')](_0xb237('0xe'),_0x547910,_0x43dfc6[_0xb237('0x12')][_0xb237('0x14')]);return _0x1b4922(_0x43dfc6[_0xb237('0x12')][_0xb237('0x14')]);}logger['error'](_0xb237('0xe'),_0x547910,_0x43dfc6[_0xb237('0x12')][_0xb237('0x14')]);return _0x4a3065(_0x43dfc6[_0xb237('0x12')]['message']);}else{logger[_0xb237('0xd')](_0xb237('0xe'),_0x547910,_0xb237('0xf'));_0x4a3065(_0x43dfc6[_0xb237('0x15')][_0xb237('0x14')]);}})[_0xb237('0x16')](function(_0xba21ad){logger[_0xb237('0x12')](_0xb237('0xe'),_0x547910,_0xba21ad);_0x1b4922(_0xba21ad);});});}exports[_0xb237('0x17')]=function(_0xe098cf){var _0x52916a=this;return new Promise(function(_0x408e91,_0x33afdf){return db['ZendeskAccount'][_0xb237('0x18')]({'raw':_0xe098cf['options']?_0xe098cf[_0xb237('0x19')][_0xb237('0x1a')]===undefined?!![]:![]:!![],'where':_0xe098cf[_0xb237('0x19')]?_0xe098cf[_0xb237('0x19')][_0xb237('0x1b')]||null:null,'attributes':_0xe098cf[_0xb237('0x19')]?_0xe098cf[_0xb237('0x19')][_0xb237('0x1c')]||null:null,'limit':_0xe098cf[_0xb237('0x19')]?_0xe098cf['options']['limit']||null:null,'include':_0xe098cf[_0xb237('0x19')]?_0xe098cf['options']['include']?_['map'](_0xe098cf[_0xb237('0x19')][_0xb237('0x1d')],function(_0x40d798){return{'model':db[_0x40d798[_0xb237('0x1e')]],'as':_0x40d798['as'],'attributes':_0x40d798['attributes'],'include':_0x40d798[_0xb237('0x1d')]?_['map'](_0x40d798[_0xb237('0x1d')],function(_0x4ae99b){return{'model':db[_0x4ae99b[_0xb237('0x1e')]],'as':_0x4ae99b['as'],'attributes':_0x4ae99b[_0xb237('0x1c')],'include':_0x4ae99b['include']?_[_0xb237('0x1f')](_0x4ae99b[_0xb237('0x1d')],function(_0x2df6a6){return{'model':db[_0x2df6a6[_0xb237('0x1e')]],'as':_0x2df6a6['as'],'attributes':_0x2df6a6[_0xb237('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb237('0xc')](function(_0x2fecfd){logger['info'](_0xb237('0x17'),_0xe098cf);logger[_0xb237('0x20')]('GetZendeskAccount',_0xe098cf,JSON[_0xb237('0x11')](_0x2fecfd));_0x408e91(_0x2fecfd);})['catch'](function(_0x5d5227){logger['error'](_0xb237('0x17'),_0x5d5227['message'],_0xe098cf);_0x33afdf(_0x52916a[_0xb237('0x12')](0x1f4,_0x5d5227[_0xb237('0x14')]));});});};exports[_0xb237('0x21')]=function(_0x58e35d){var _0x4262a6=this;return new Promise(function(_0xb09c32,_0x28c95b){return db[_0xb237('0x22')][_0xb237('0x23')]({'raw':_0x58e35d[_0xb237('0x19')]?_0x58e35d[_0xb237('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x58e35d[_0xb237('0x19')]?_0x58e35d[_0xb237('0x19')]['where']||null:null,'attributes':_0x58e35d[_0xb237('0x19')]?_0x58e35d[_0xb237('0x19')][_0xb237('0x1c')]||null:null,'include':_0x58e35d[_0xb237('0x19')]?_0x58e35d['options']['include']?_['map'](_0x58e35d[_0xb237('0x19')][_0xb237('0x1d')],function(_0x153c01){return{'model':db[_0x153c01[_0xb237('0x1e')]],'as':_0x153c01['as'],'attributes':_0x153c01[_0xb237('0x1c')],'include':_0x153c01[_0xb237('0x1d')]?_[_0xb237('0x1f')](_0x153c01['include'],function(_0x177db6){return{'model':db[_0x177db6[_0xb237('0x1e')]],'as':_0x177db6['as'],'attributes':_0x177db6[_0xb237('0x1c')],'include':_0x177db6[_0xb237('0x1d')]?_[_0xb237('0x1f')](_0x177db6[_0xb237('0x1d')],function(_0x293488){return{'model':db[_0x293488[_0xb237('0x1e')]],'as':_0x293488['as'],'attributes':_0x293488[_0xb237('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x119f8a){logger[_0xb237('0xd')](_0xb237('0x21'),_0x58e35d);logger[_0xb237('0x20')](_0xb237('0x21'),_0x58e35d,JSON[_0xb237('0x11')](_0x119f8a));_0xb09c32(_0x119f8a);})[_0xb237('0x16')](function(_0x19fec9){logger[_0xb237('0x12')](_0xb237('0x21'),_0x19fec9[_0xb237('0x14')],_0x58e35d);_0x28c95b(_0x4262a6[_0xb237('0x12')](0x1f4,_0x19fec9[_0xb237('0x14')]));});});}; \ No newline at end of file +var _0x2c8f=['include','map','model','attributes','ShowZendeskAccount','find','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit'];(function(_0x381cd7,_0x5cd931){var _0x42fb4d=function(_0x2ee505){while(--_0x2ee505){_0x381cd7['push'](_0x381cd7['shift']());}};_0x42fb4d(++_0x5cd931);}(_0x2c8f,0x192));var _0xf2c8=function(_0x4f9e74,_0x5a5b40){_0x4f9e74=_0x4f9e74-0x0;var _0x36f2e1=_0x2c8f[_0x4f9e74];return _0x36f2e1;};'use strict';var _=require('lodash');var util=require(_0xf2c8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2c8('0x1'));var db=require(_0xf2c8('0x2'))['db'];var utils=require(_0xf2c8('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf2c8('0x4'));var jayson=require(_0xf2c8('0x5'));var client=jayson[_0xf2c8('0x6')][_0xf2c8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2785ee,_0x4eae22,_0x475616){return new BPromise(function(_0x28cc0d,_0x4e3109){return client[_0xf2c8('0x8')](_0x2785ee,_0x475616)[_0xf2c8('0x9')](function(_0x2112fc){logger['info'](_0xf2c8('0xa'),_0x4eae22,_0xf2c8('0xb'));logger[_0xf2c8('0xc')](_0xf2c8('0xd'),_0x4eae22,_0xf2c8('0xb'),JSON[_0xf2c8('0xe')](_0x2112fc));if(_0x2112fc[_0xf2c8('0xf')]){if(_0x2112fc[_0xf2c8('0xf')]['code']===0x1f4){logger[_0xf2c8('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x4eae22,_0x2112fc[_0xf2c8('0xf')][_0xf2c8('0x10')]);return _0x4e3109(_0x2112fc[_0xf2c8('0xf')][_0xf2c8('0x10')]);}logger[_0xf2c8('0xf')](_0xf2c8('0xa'),_0x4eae22,_0x2112fc['error'][_0xf2c8('0x10')]);return _0x28cc0d(_0x2112fc[_0xf2c8('0xf')][_0xf2c8('0x10')]);}else{logger[_0xf2c8('0x11')](_0xf2c8('0xa'),_0x4eae22,_0xf2c8('0xb'));_0x28cc0d(_0x2112fc[_0xf2c8('0x12')]['message']);}})[_0xf2c8('0x13')](function(_0x3cbc33){logger[_0xf2c8('0xf')](_0xf2c8('0xa'),_0x4eae22,_0x3cbc33);_0x4e3109(_0x3cbc33);});});}exports[_0xf2c8('0x14')]=function(_0x52e9d0){var _0x49a07c=this;return new Promise(function(_0x104d9d,_0x290953){return db[_0xf2c8('0x15')][_0xf2c8('0x16')]({'raw':_0x52e9d0['options']?_0x52e9d0[_0xf2c8('0x17')][_0xf2c8('0x18')]===undefined?!![]:![]:!![],'where':_0x52e9d0[_0xf2c8('0x17')]?_0x52e9d0['options'][_0xf2c8('0x19')]||null:null,'attributes':_0x52e9d0[_0xf2c8('0x17')]?_0x52e9d0['options']['attributes']||null:null,'limit':_0x52e9d0[_0xf2c8('0x17')]?_0x52e9d0[_0xf2c8('0x17')][_0xf2c8('0x1a')]||null:null,'include':_0x52e9d0['options']?_0x52e9d0[_0xf2c8('0x17')][_0xf2c8('0x1b')]?_[_0xf2c8('0x1c')](_0x52e9d0[_0xf2c8('0x17')]['include'],function(_0x17956f){return{'model':db[_0x17956f[_0xf2c8('0x1d')]],'as':_0x17956f['as'],'attributes':_0x17956f[_0xf2c8('0x1e')],'include':_0x17956f[_0xf2c8('0x1b')]?_[_0xf2c8('0x1c')](_0x17956f['include'],function(_0x93707c){return{'model':db[_0x93707c['model']],'as':_0x93707c['as'],'attributes':_0x93707c[_0xf2c8('0x1e')],'include':_0x93707c[_0xf2c8('0x1b')]?_[_0xf2c8('0x1c')](_0x93707c[_0xf2c8('0x1b')],function(_0x1d2e74){return{'model':db[_0x1d2e74[_0xf2c8('0x1d')]],'as':_0x1d2e74['as'],'attributes':_0x1d2e74[_0xf2c8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf2c8('0x9')](function(_0x33f1b0){logger[_0xf2c8('0x11')](_0xf2c8('0x14'),_0x52e9d0);logger[_0xf2c8('0xc')](_0xf2c8('0x14'),_0x52e9d0,JSON['stringify'](_0x33f1b0));_0x104d9d(_0x33f1b0);})[_0xf2c8('0x13')](function(_0x5146e4){logger['error'](_0xf2c8('0x14'),_0x5146e4['message'],_0x52e9d0);_0x290953(_0x49a07c[_0xf2c8('0xf')](0x1f4,_0x5146e4[_0xf2c8('0x10')]));});});};exports[_0xf2c8('0x1f')]=function(_0x10c825){var _0x123b45=this;return new Promise(function(_0x12a547,_0x27a7dc){return db['ZendeskAccount'][_0xf2c8('0x20')]({'raw':_0x10c825[_0xf2c8('0x17')]?_0x10c825[_0xf2c8('0x17')][_0xf2c8('0x18')]===undefined?!![]:![]:!![],'where':_0x10c825[_0xf2c8('0x17')]?_0x10c825[_0xf2c8('0x17')]['where']||null:null,'attributes':_0x10c825[_0xf2c8('0x17')]?_0x10c825['options'][_0xf2c8('0x1e')]||null:null,'include':_0x10c825['options']?_0x10c825[_0xf2c8('0x17')][_0xf2c8('0x1b')]?_[_0xf2c8('0x1c')](_0x10c825[_0xf2c8('0x17')][_0xf2c8('0x1b')],function(_0x5b6e0b){return{'model':db[_0x5b6e0b[_0xf2c8('0x1d')]],'as':_0x5b6e0b['as'],'attributes':_0x5b6e0b[_0xf2c8('0x1e')],'include':_0x5b6e0b['include']?_[_0xf2c8('0x1c')](_0x5b6e0b[_0xf2c8('0x1b')],function(_0x4a24e8){return{'model':db[_0x4a24e8[_0xf2c8('0x1d')]],'as':_0x4a24e8['as'],'attributes':_0x4a24e8[_0xf2c8('0x1e')],'include':_0x4a24e8[_0xf2c8('0x1b')]?_[_0xf2c8('0x1c')](_0x4a24e8[_0xf2c8('0x1b')],function(_0x54e851){return{'model':db[_0x54e851['model']],'as':_0x54e851['as'],'attributes':_0x54e851[_0xf2c8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf2c8('0x9')](function(_0xb48f51){logger[_0xf2c8('0x11')](_0xf2c8('0x1f'),_0x10c825);logger[_0xf2c8('0xc')](_0xf2c8('0x1f'),_0x10c825,JSON[_0xf2c8('0xe')](_0xb48f51));_0x12a547(_0xb48f51);})['catch'](function(_0x2e7c54){logger[_0xf2c8('0xf')](_0xf2c8('0x1f'),_0x2e7c54['message'],_0x10c825);_0x27a7dc(_0x123b45['error'](0x1f4,_0x2e7c54['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8d4d7e2..1706075 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 _0xad5b=['update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags'];(function(_0x52a8e1,_0xb94572){var _0x57e90c=function(_0xceb72a){while(--_0xceb72a){_0x52a8e1['push'](_0x52a8e1['shift']());}};_0x57e90c(++_0xb94572);}(_0xad5b,0xc1));var _0xbad5=function(_0x39758d,_0x346423){_0x39758d=_0x39758d-0x0;var _0x44ac11=_0xad5b[_0x39758d];return _0x44ac11;};'use strict';var multer=require(_0xbad5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbad5('0x1'));var express=require(_0xbad5('0x2'));var router=express['Router']();var auth=require(_0xbad5('0x3'));var interaction=require(_0xbad5('0x4'));var config=require(_0xbad5('0x5'));var controller=require(_0xbad5('0x6'));router[_0xbad5('0x7')]('/',auth[_0xbad5('0x8')](),controller[_0xbad5('0x9')]);router['get'](_0xbad5('0xa'),auth[_0xbad5('0x8')](),controller[_0xbad5('0xb')]);router['get'](_0xbad5('0xc'),auth[_0xbad5('0x8')](),controller[_0xbad5('0xd')]);router[_0xbad5('0x7')](_0xbad5('0xe'),auth[_0xbad5('0x8')](),controller[_0xbad5('0xf')]);router[_0xbad5('0x7')](_0xbad5('0x10'),auth[_0xbad5('0x8')](),controller[_0xbad5('0x11')]);router[_0xbad5('0x7')](_0xbad5('0x12'),auth[_0xbad5('0x8')](),controller[_0xbad5('0x13')]);router[_0xbad5('0x14')]('/',auth[_0xbad5('0x8')](),controller[_0xbad5('0x15')]);router[_0xbad5('0x14')]('/:id/tags',auth[_0xbad5('0x8')](),controller[_0xbad5('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbad5('0x17')]);router[_0xbad5('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xbad5('0x19')]);module[_0xbad5('0x1a')]=router; \ No newline at end of file +var _0x7e03=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','setTags','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x44e811,_0x59df8a){var _0x4b3fc4=function(_0x475cdf){while(--_0x475cdf){_0x44e811['push'](_0x44e811['shift']());}};_0x4b3fc4(++_0x59df8a);}(_0x7e03,0x152));var _0x37e0=function(_0x2f70e6,_0x23aa34){_0x2f70e6=_0x2f70e6-0x0;var _0x18175a=_0x7e03[_0x2f70e6];return _0x18175a;};'use strict';var multer=require('multer');var util=require(_0x37e0('0x0'));var path=require(_0x37e0('0x1'));var timeout=require(_0x37e0('0x2'));var express=require('express');var router=express[_0x37e0('0x3')]();var auth=require(_0x37e0('0x4'));var interaction=require(_0x37e0('0x5'));var config=require(_0x37e0('0x6'));var controller=require(_0x37e0('0x7'));router[_0x37e0('0x8')]('/',auth[_0x37e0('0x9')](),controller[_0x37e0('0xa')]);router['get']('/:id',auth[_0x37e0('0x9')](),controller[_0x37e0('0xb')]);router[_0x37e0('0x8')](_0x37e0('0xc'),auth['isAuthenticated'](),controller[_0x37e0('0xd')]);router[_0x37e0('0x8')](_0x37e0('0xe'),auth[_0x37e0('0x9')](),controller[_0x37e0('0xf')]);router[_0x37e0('0x8')](_0x37e0('0x10'),auth[_0x37e0('0x9')](),controller[_0x37e0('0x11')]);router[_0x37e0('0x8')]('/:id/tags',auth['isAuthenticated'](),controller[_0x37e0('0x12')]);router['post']('/',auth[_0x37e0('0x9')](),controller['create']);router[_0x37e0('0x13')]('/:id/tags',auth[_0x37e0('0x9')](),controller[_0x37e0('0x14')]);router[_0x37e0('0x15')](_0x37e0('0x16'),auth['isAuthenticated'](),controller[_0x37e0('0x17')]);router[_0x37e0('0x18')](_0x37e0('0x16'),auth[_0x37e0('0x9')](),controller[_0x37e0('0x19')]);module[_0x37e0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 296e81a..5527f8e 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 _0xaeb3=['sequelize','exports','STRING'];(function(_0x463073,_0x2b85d1){var _0x10b73b=function(_0x17663a){while(--_0x17663a){_0x463073['push'](_0x463073['shift']());}};_0x10b73b(++_0x2b85d1);}(_0xaeb3,0x1e3));var _0x3aeb=function(_0xf405ad,_0x1afcdf){_0xf405ad=_0xf405ad-0x0;var _0x45c5a7=_0xaeb3[_0xf405ad];return _0x45c5a7;};'use strict';var Sequelize=require(_0x3aeb('0x0'));module[_0x3aeb('0x1')]={'name':{'type':Sequelize[_0x3aeb('0x2')]},'description':{'type':Sequelize[_0x3aeb('0x2')]}}; \ No newline at end of file +var _0xf2e8=['sequelize','exports','STRING'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xf2e8,0x108));var _0x8f2e=function(_0x86f499,_0x5eb3e2){_0x86f499=_0x86f499-0x0;var _0x4be36b=_0xf2e8[_0x86f499];return _0x4be36b;};'use strict';var Sequelize=require(_0x8f2e('0x0'));module[_0x8f2e('0x1')]={'name':{'type':Sequelize[_0x8f2e('0x2')]},'description':{'type':Sequelize[_0x8f2e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 8f9c362..fdb3d14 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 _0xc6a0=['limit','status','Content-Range','apply','save','update','destroy','stack','name','send','index','ZendeskConfiguration','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','model','rawAttributes','create','body','find','findOne','ZendeskField','nolimit','getFields','order','getSubjects','getDescriptions','Tag','getTags','setTags','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','../../config/license/hardware','ioredis','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','json','count','offset'];(function(_0x31b0ef,_0x3909f2){var _0x878cbd=function(_0x153069){while(--_0x153069){_0x31b0ef['push'](_0x31b0ef['shift']());}};_0x878cbd(++_0x3909f2);}(_0xc6a0,0x1b9));var _0x0c6a=function(_0x3a6c51,_0x405121){_0x3a6c51=_0x3a6c51-0x0;var _0x1097bb=_0xc6a0[_0x3a6c51];return _0x1097bb;};'use strict';var pdf=require(_0x0c6a('0x0'));var emlformat=require(_0x0c6a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0c6a('0x2'));var jsonpatch=require(_0x0c6a('0x3'));var rp=require(_0x0c6a('0x4'));var moment=require(_0x0c6a('0x5'));var BPromise=require(_0x0c6a('0x6'));var Mustache=require(_0x0c6a('0x7'));var util=require(_0x0c6a('0x8'));var path=require(_0x0c6a('0x9'));var sox=require(_0x0c6a('0xa'));var csv=require(_0x0c6a('0xb'));var ejs=require(_0x0c6a('0xc'));var fs=require('fs');var _=require(_0x0c6a('0xd'));var squel=require(_0x0c6a('0xe'));var crypto=require(_0x0c6a('0xf'));var jsforce=require(_0x0c6a('0x10'));var deskjs=require(_0x0c6a('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0c6a('0x12'));var Papa=require(_0x0c6a('0x13'));var authService=require(_0x0c6a('0x14'));var hardwareService=require(_0x0c6a('0x15'));var Redis=require(_0x0c6a('0x16'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x0c6a('0x17'));var config=require('../../config/environment');var db=require(_0x0c6a('0x18'))['db'];var jayson=require(_0x0c6a('0x19'));var client=jayson[_0x0c6a('0x1a')][_0x0c6a('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5e66fe,_0x3db800,_0x5e4f68,_0x48f47f){return new BPromise(function(_0x173ec0,_0x3c859b){var _0x3dc588=_0x48f47f||client;return _0x3dc588[_0x0c6a('0x1c')](_0x5e66fe,_0x5e4f68)[_0x0c6a('0x1d')](function(_0xd5669e){logger[_0x0c6a('0x1e')](_0x0c6a('0x1f'),_0x3db800,_0x0c6a('0x20'));logger[_0x0c6a('0x21')](_0x0c6a('0x22'),_0x3db800,_0x0c6a('0x20'),JSON[_0x0c6a('0x23')](_0xd5669e));if(_0xd5669e[_0x0c6a('0x24')]){if(_0xd5669e[_0x0c6a('0x24')][_0x0c6a('0x25')]===0x1f4){logger[_0x0c6a('0x24')](_0x0c6a('0x1f'),_0x3db800,_0xd5669e[_0x0c6a('0x24')][_0x0c6a('0x26')]);return _0x3c859b(_0xd5669e[_0x0c6a('0x24')][_0x0c6a('0x26')]);}logger[_0x0c6a('0x24')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3db800,_0xd5669e[_0x0c6a('0x24')]['message']);return _0x173ec0(_0xd5669e[_0x0c6a('0x24')][_0x0c6a('0x26')]);}else{logger[_0x0c6a('0x1e')](_0x0c6a('0x1f'),_0x3db800,_0x0c6a('0x20'));_0x173ec0(_0xd5669e['result']['message']);}})['catch'](function(_0x2cd7f9){logger[_0x0c6a('0x24')](_0x0c6a('0x1f'),_0x3db800,_0x2cd7f9);_0x3c859b(_0x2cd7f9);});});}function respondWithStatusCode(_0x3f55f1,_0x530456){_0x530456=_0x530456||0xcc;return function(_0x41b40b){if(_0x41b40b){return _0x3f55f1[_0x0c6a('0x27')](_0x530456);}return _0x3f55f1['status'](_0x530456)[_0x0c6a('0x28')]();};}function respondWithResult(_0x4b09aa,_0x1c5509){_0x1c5509=_0x1c5509||0xc8;return function(_0x1dbb7b){if(_0x1dbb7b){return _0x4b09aa['status'](_0x1c5509)[_0x0c6a('0x29')](_0x1dbb7b);}};}function respondWithFilteredResult(_0x1a4d42,_0x2bc6ce){return function(_0x1c0001){if(_0x1c0001){var _0x3cb522=_0x1c0001[_0x0c6a('0x2a')],_0x24103b=_0x2bc6ce[_0x0c6a('0x2b')],_0x58f741=_0x2bc6ce[_0x0c6a('0x2b')]+_0x2bc6ce[_0x0c6a('0x2c')],_0x3942f0;if(_0x58f741>=_0x3cb522){_0x58f741=_0x3cb522;_0x3942f0=0xc8;}else{_0x3942f0=0xce;}_0x1a4d42[_0x0c6a('0x2d')](_0x3942f0);return _0x1a4d42['set'](_0x0c6a('0x2e'),_0x24103b+'-'+_0x58f741+'/'+_0x3cb522)[_0x0c6a('0x29')](_0x1c0001);}return null;};}function patchUpdates(_0x2bf6d7){return function(_0x5e2018){try{jsonpatch[_0x0c6a('0x2f')](_0x5e2018,_0x2bf6d7,!![]);}catch(_0x2e74a4){return BPromise['reject'](_0x2e74a4);}return _0x5e2018[_0x0c6a('0x30')]();};}function saveUpdates(_0x4a0476,_0x142988){return function(_0x27aea3){if(_0x27aea3){return _0x27aea3[_0x0c6a('0x31')](_0x4a0476)['then'](function(_0x37360c){return _0x37360c;});}return null;};}function removeEntity(_0x2fc056,_0x2edb92){return function(_0x533087){if(_0x533087){return _0x533087[_0x0c6a('0x32')]()[_0x0c6a('0x1d')](function(){_0x2fc056[_0x0c6a('0x2d')](0xcc)[_0x0c6a('0x28')]();});}};}function handleEntityNotFound(_0x46b3e9,_0xe37f2e){return function(_0x4d9d99){if(!_0x4d9d99){_0x46b3e9[_0x0c6a('0x27')](0x194);}return _0x4d9d99;};}function handleError(_0x16f038,_0x540d49){_0x540d49=_0x540d49||0x1f4;return function(_0x18cc2b){logger['error'](_0x18cc2b[_0x0c6a('0x33')]);if(_0x18cc2b[_0x0c6a('0x34')]){delete _0x18cc2b[_0x0c6a('0x34')];}_0x16f038[_0x0c6a('0x2d')](_0x540d49)[_0x0c6a('0x35')](_0x18cc2b);};}exports[_0x0c6a('0x36')]=function(_0x177e2a,_0x4e9fad){var _0x304206={},_0x226d2b={},_0x173908={'count':0x0,'rows':[]};var _0x1bf2d2=db[_0x0c6a('0x37')]['rawAttributes'];_0x226d2b['model']=_['keys'](_0x1bf2d2);_0x226d2b[_0x0c6a('0x38')]=_[_0x0c6a('0x39')](_0x177e2a[_0x0c6a('0x38')]);_0x226d2b[_0x0c6a('0x3a')]=_[_0x0c6a('0x3b')](_0x226d2b['model'],_0x226d2b[_0x0c6a('0x38')]);_0x304206[_0x0c6a('0x3c')]=_['intersection'](_0x226d2b['model'],qs[_0x0c6a('0x3d')](_0x177e2a['query'][_0x0c6a('0x3d')]));_0x304206[_0x0c6a('0x3c')]=_0x304206['attributes'][_0x0c6a('0x3e')]?_0x304206[_0x0c6a('0x3c')]:_0x226d2b['model'];if(!_0x177e2a[_0x0c6a('0x38')][_0x0c6a('0x3f')]('nolimit')){_0x304206['limit']=qs['limit'](_0x177e2a[_0x0c6a('0x38')]['limit']);_0x304206['offset']=qs['offset'](_0x177e2a[_0x0c6a('0x38')][_0x0c6a('0x2b')]);}_0x304206['order']=qs[_0x0c6a('0x40')](_0x177e2a[_0x0c6a('0x38')][_0x0c6a('0x40')]);_0x304206['where']=qs['filters'](_[_0x0c6a('0x41')](_0x177e2a['query'],_0x226d2b[_0x0c6a('0x3a')]));if(_0x177e2a[_0x0c6a('0x38')][_0x0c6a('0x42')]){_0x304206[_0x0c6a('0x43')]=_[_0x0c6a('0x44')](_0x304206['where'],{'$or':_[_0x0c6a('0x45')](_0x1bf2d2,function(_0x5c5528){if(_0x5c5528[_0x0c6a('0x46')][_0x0c6a('0x47')]!==_0x0c6a('0x48')){var _0x147b68={};_0x147b68[_0x5c5528[_0x0c6a('0x49')]]={'$like':'%'+_0x177e2a['query']['filter']+'%'};return _0x147b68;}})});}_0x304206=_[_0x0c6a('0x44')]({},_0x304206,_0x177e2a[_0x0c6a('0x4a')]);var _0x3f3535={'where':_0x304206[_0x0c6a('0x43')]};return db['ZendeskConfiguration'][_0x0c6a('0x2a')](_0x3f3535)[_0x0c6a('0x1d')](function(_0x16604c){_0x173908[_0x0c6a('0x2a')]=_0x16604c;if(_0x177e2a[_0x0c6a('0x38')][_0x0c6a('0x4b')]){_0x304206[_0x0c6a('0x4c')]=[{'all':!![]}];}return db[_0x0c6a('0x37')][_0x0c6a('0x4d')](_0x304206);})['then'](function(_0x15e46f){_0x173908[_0x0c6a('0x4e')]=_0x15e46f;return _0x173908;})[_0x0c6a('0x1d')](respondWithFilteredResult(_0x4e9fad,_0x304206))[_0x0c6a('0x4f')](handleError(_0x4e9fad,null));};exports[_0x0c6a('0x50')]=function(_0x48544c,_0x4aa809){var _0x1e15d1={'raw':![],'where':{'id':_0x48544c[_0x0c6a('0x51')]['id']}},_0x129fe9={};_0x129fe9[_0x0c6a('0x52')]=_['keys'](db[_0x0c6a('0x37')][_0x0c6a('0x53')]);_0x129fe9[_0x0c6a('0x38')]=_[_0x0c6a('0x39')](_0x48544c[_0x0c6a('0x38')]);_0x129fe9[_0x0c6a('0x3a')]=_[_0x0c6a('0x3b')](_0x129fe9[_0x0c6a('0x52')],_0x129fe9[_0x0c6a('0x38')]);_0x1e15d1[_0x0c6a('0x3c')]=_[_0x0c6a('0x3b')](_0x129fe9[_0x0c6a('0x52')],qs[_0x0c6a('0x3d')](_0x48544c[_0x0c6a('0x38')]['fields']));_0x1e15d1[_0x0c6a('0x3c')]=_0x1e15d1[_0x0c6a('0x3c')]['length']?_0x1e15d1['attributes']:_0x129fe9[_0x0c6a('0x52')];if(_0x48544c[_0x0c6a('0x38')][_0x0c6a('0x4b')]){_0x1e15d1[_0x0c6a('0x4c')]=[{'all':!![]}];}_0x1e15d1=_[_0x0c6a('0x44')]({},_0x1e15d1,_0x48544c['options']);return db['ZendeskConfiguration']['find'](_0x1e15d1)[_0x0c6a('0x1d')](handleEntityNotFound(_0x4aa809,null))[_0x0c6a('0x1d')](respondWithResult(_0x4aa809,null))[_0x0c6a('0x4f')](handleError(_0x4aa809,null));};exports[_0x0c6a('0x54')]=function(_0x2cd129,_0x665dea){return db[_0x0c6a('0x37')][_0x0c6a('0x54')](_0x2cd129[_0x0c6a('0x55')],{})['then'](respondWithResult(_0x665dea,0xc9))[_0x0c6a('0x4f')](handleError(_0x665dea,null));};exports[_0x0c6a('0x31')]=function(_0x19a0e5,_0x49dfb8){if(_0x19a0e5[_0x0c6a('0x55')]['id']){delete _0x19a0e5['body']['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x19a0e5[_0x0c6a('0x51')]['id']}})['then'](handleEntityNotFound(_0x49dfb8,null))[_0x0c6a('0x1d')](saveUpdates(_0x19a0e5[_0x0c6a('0x55')],null))[_0x0c6a('0x1d')](respondWithResult(_0x49dfb8,null))[_0x0c6a('0x4f')](handleError(_0x49dfb8,null));};exports[_0x0c6a('0x32')]=function(_0x2b9d20,_0x23858b){return db['ZendeskConfiguration'][_0x0c6a('0x56')]({'where':{'id':_0x2b9d20[_0x0c6a('0x51')]['id']}})[_0x0c6a('0x1d')](handleEntityNotFound(_0x23858b,null))[_0x0c6a('0x1d')](removeEntity(_0x23858b,null))['catch'](handleError(_0x23858b,null));};exports['getFields']=function(_0x55729e,_0x4c5dcd,_0x4310d1){var _0x5a59da={};var _0x8ae7f3={};var _0x2f14ce;var _0x47be9f;return db[_0x0c6a('0x37')][_0x0c6a('0x57')]({'where':{'id':_0x55729e[_0x0c6a('0x51')]['id']}})[_0x0c6a('0x1d')](handleEntityNotFound(_0x4c5dcd,null))[_0x0c6a('0x1d')](function(_0x43d850){if(_0x43d850){_0x2f14ce=_0x43d850;_0x8ae7f3['model']=_[_0x0c6a('0x39')](db[_0x0c6a('0x58')][_0x0c6a('0x53')]);_0x8ae7f3[_0x0c6a('0x38')]=_[_0x0c6a('0x39')](_0x55729e[_0x0c6a('0x38')]);_0x8ae7f3[_0x0c6a('0x3a')]=_['intersection'](_0x8ae7f3[_0x0c6a('0x52')],_0x8ae7f3['query']);_0x5a59da['attributes']=_['intersection'](_0x8ae7f3[_0x0c6a('0x52')],qs[_0x0c6a('0x3d')](_0x55729e[_0x0c6a('0x38')][_0x0c6a('0x3d')]));_0x5a59da[_0x0c6a('0x3c')]=_0x5a59da[_0x0c6a('0x3c')]['length']?_0x5a59da[_0x0c6a('0x3c')]:_0x8ae7f3[_0x0c6a('0x52')];_0x5a59da['order']=qs[_0x0c6a('0x40')](_0x55729e['query']['sort']);_0x5a59da[_0x0c6a('0x43')]=qs['filters'](_[_0x0c6a('0x41')](_0x55729e[_0x0c6a('0x38')],_0x8ae7f3[_0x0c6a('0x3a')]));if(_0x55729e[_0x0c6a('0x38')]['filter']){_0x5a59da['where']=_['merge'](_0x5a59da[_0x0c6a('0x43')],{'$or':_['map'](_0x5a59da[_0x0c6a('0x3c')],function(_0x3bb890){var _0x58265e={};_0x58265e[_0x3bb890]={'$like':'%'+_0x55729e['query'][_0x0c6a('0x42')]+'%'};return _0x58265e;})});}_0x5a59da=_['merge']({},_0x5a59da,_0x55729e[_0x0c6a('0x4a')]);return _0x2f14ce['getFields'](_0x5a59da);}})['then'](function(_0x4abe9a){if(_0x4abe9a){_0x47be9f=_0x4abe9a[_0x0c6a('0x3e')];if(!_0x55729e[_0x0c6a('0x38')][_0x0c6a('0x3f')](_0x0c6a('0x59'))){_0x5a59da['limit']=qs[_0x0c6a('0x2c')](_0x55729e[_0x0c6a('0x38')][_0x0c6a('0x2c')]);_0x5a59da[_0x0c6a('0x2b')]=qs[_0x0c6a('0x2b')](_0x55729e[_0x0c6a('0x38')]['offset']);}return _0x2f14ce[_0x0c6a('0x5a')](_0x5a59da);}})[_0x0c6a('0x1d')](function(_0x2836a7){if(_0x2836a7){return _0x2836a7?{'count':_0x47be9f,'rows':_0x2836a7}:null;}})['then'](respondWithResult(_0x4c5dcd,null))[_0x0c6a('0x4f')](handleError(_0x4c5dcd,null));};exports['getSubjects']=function(_0x355e55,_0x56ebd4,_0x43426e){var _0x357e0b={};var _0x3318cc={};var _0x488cc0;var _0x178e6d;return db['ZendeskConfiguration'][_0x0c6a('0x57')]({'where':{'id':_0x355e55[_0x0c6a('0x51')]['id']}})['then'](handleEntityNotFound(_0x56ebd4,null))[_0x0c6a('0x1d')](function(_0x9d6b3){if(_0x9d6b3){_0x488cc0=_0x9d6b3;_0x3318cc['model']=_[_0x0c6a('0x39')](db[_0x0c6a('0x58')][_0x0c6a('0x53')]);_0x3318cc[_0x0c6a('0x38')]=_[_0x0c6a('0x39')](_0x355e55[_0x0c6a('0x38')]);_0x3318cc['filters']=_['intersection'](_0x3318cc[_0x0c6a('0x52')],_0x3318cc[_0x0c6a('0x38')]);_0x357e0b['attributes']=_[_0x0c6a('0x3b')](_0x3318cc[_0x0c6a('0x52')],qs['fields'](_0x355e55[_0x0c6a('0x38')]['fields']));_0x357e0b[_0x0c6a('0x3c')]=_0x357e0b[_0x0c6a('0x3c')][_0x0c6a('0x3e')]?_0x357e0b[_0x0c6a('0x3c')]:_0x3318cc[_0x0c6a('0x52')];_0x357e0b[_0x0c6a('0x5b')]=qs['sort'](_0x355e55[_0x0c6a('0x38')]['sort']);_0x357e0b['where']=qs[_0x0c6a('0x3a')](_[_0x0c6a('0x41')](_0x355e55[_0x0c6a('0x38')],_0x3318cc['filters']));if(_0x355e55[_0x0c6a('0x38')][_0x0c6a('0x42')]){_0x357e0b[_0x0c6a('0x43')]=_['merge'](_0x357e0b[_0x0c6a('0x43')],{'$or':_[_0x0c6a('0x45')](_0x357e0b[_0x0c6a('0x3c')],function(_0x1c23ad){var _0x2566ef={};_0x2566ef[_0x1c23ad]={'$like':'%'+_0x355e55[_0x0c6a('0x38')][_0x0c6a('0x42')]+'%'};return _0x2566ef;})});}_0x357e0b=_[_0x0c6a('0x44')]({},_0x357e0b,_0x355e55['options']);return _0x488cc0[_0x0c6a('0x5c')](_0x357e0b);}})['then'](function(_0x347c9e){if(_0x347c9e){_0x178e6d=_0x347c9e[_0x0c6a('0x3e')];if(!_0x355e55[_0x0c6a('0x38')][_0x0c6a('0x3f')](_0x0c6a('0x59'))){_0x357e0b['limit']=qs[_0x0c6a('0x2c')](_0x355e55[_0x0c6a('0x38')][_0x0c6a('0x2c')]);_0x357e0b['offset']=qs[_0x0c6a('0x2b')](_0x355e55['query'][_0x0c6a('0x2b')]);}return _0x488cc0[_0x0c6a('0x5c')](_0x357e0b);}})['then'](function(_0x12b84b){if(_0x12b84b){return _0x12b84b?{'count':_0x178e6d,'rows':_0x12b84b}:null;}})['then'](respondWithResult(_0x56ebd4,null))[_0x0c6a('0x4f')](handleError(_0x56ebd4,null));};exports[_0x0c6a('0x5d')]=function(_0x396dbb,_0x26fd0d,_0x57fc1b){var _0x8d35bf={};var _0x55a159={};var _0x4a1dc4;var _0x586bfb;return db[_0x0c6a('0x37')][_0x0c6a('0x57')]({'where':{'id':_0x396dbb[_0x0c6a('0x51')]['id']}})[_0x0c6a('0x1d')](handleEntityNotFound(_0x26fd0d,null))[_0x0c6a('0x1d')](function(_0x4acf9a){if(_0x4acf9a){_0x4a1dc4=_0x4acf9a;_0x55a159[_0x0c6a('0x52')]=_[_0x0c6a('0x39')](db[_0x0c6a('0x58')]['rawAttributes']);_0x55a159[_0x0c6a('0x38')]=_['keys'](_0x396dbb[_0x0c6a('0x38')]);_0x55a159[_0x0c6a('0x3a')]=_[_0x0c6a('0x3b')](_0x55a159['model'],_0x55a159[_0x0c6a('0x38')]);_0x8d35bf[_0x0c6a('0x3c')]=_['intersection'](_0x55a159['model'],qs[_0x0c6a('0x3d')](_0x396dbb[_0x0c6a('0x38')][_0x0c6a('0x3d')]));_0x8d35bf['attributes']=_0x8d35bf['attributes'][_0x0c6a('0x3e')]?_0x8d35bf[_0x0c6a('0x3c')]:_0x55a159[_0x0c6a('0x52')];_0x8d35bf[_0x0c6a('0x5b')]=qs['sort'](_0x396dbb[_0x0c6a('0x38')][_0x0c6a('0x40')]);_0x8d35bf['where']=qs[_0x0c6a('0x3a')](_[_0x0c6a('0x41')](_0x396dbb['query'],_0x55a159['filters']));if(_0x396dbb[_0x0c6a('0x38')][_0x0c6a('0x42')]){_0x8d35bf[_0x0c6a('0x43')]=_[_0x0c6a('0x44')](_0x8d35bf[_0x0c6a('0x43')],{'$or':_['map'](_0x8d35bf[_0x0c6a('0x3c')],function(_0x252b05){var _0x4a1117={};_0x4a1117[_0x252b05]={'$like':'%'+_0x396dbb[_0x0c6a('0x38')][_0x0c6a('0x42')]+'%'};return _0x4a1117;})});}_0x8d35bf=_[_0x0c6a('0x44')]({},_0x8d35bf,_0x396dbb['options']);return _0x4a1dc4[_0x0c6a('0x5d')](_0x8d35bf);}})[_0x0c6a('0x1d')](function(_0x1b7a7d){if(_0x1b7a7d){_0x586bfb=_0x1b7a7d[_0x0c6a('0x3e')];if(!_0x396dbb[_0x0c6a('0x38')]['hasOwnProperty'](_0x0c6a('0x59'))){_0x8d35bf['limit']=qs['limit'](_0x396dbb[_0x0c6a('0x38')][_0x0c6a('0x2c')]);_0x8d35bf[_0x0c6a('0x2b')]=qs[_0x0c6a('0x2b')](_0x396dbb['query']['offset']);}return _0x4a1dc4[_0x0c6a('0x5d')](_0x8d35bf);}})[_0x0c6a('0x1d')](function(_0xf6eb99){if(_0xf6eb99){return _0xf6eb99?{'count':_0x586bfb,'rows':_0xf6eb99}:null;}})['then'](respondWithResult(_0x26fd0d,null))[_0x0c6a('0x4f')](handleError(_0x26fd0d,null));};exports['getTags']=function(_0x5230f5,_0x25de62,_0x566f92){var _0x113022={};var _0x34c4f7={};var _0xe0c447;var _0x494550;return db[_0x0c6a('0x37')]['findOne']({'where':{'id':_0x5230f5[_0x0c6a('0x51')]['id']}})[_0x0c6a('0x1d')](handleEntityNotFound(_0x25de62,null))[_0x0c6a('0x1d')](function(_0xae90c7){if(_0xae90c7){_0xe0c447=_0xae90c7;_0x34c4f7[_0x0c6a('0x52')]=_[_0x0c6a('0x39')](db[_0x0c6a('0x5e')]['rawAttributes']);_0x34c4f7[_0x0c6a('0x38')]=_[_0x0c6a('0x39')](_0x5230f5[_0x0c6a('0x38')]);_0x34c4f7[_0x0c6a('0x3a')]=_['intersection'](_0x34c4f7['model'],_0x34c4f7[_0x0c6a('0x38')]);_0x113022[_0x0c6a('0x3c')]=_[_0x0c6a('0x3b')](_0x34c4f7[_0x0c6a('0x52')],qs[_0x0c6a('0x3d')](_0x5230f5[_0x0c6a('0x38')]['fields']));_0x113022[_0x0c6a('0x3c')]=_0x113022[_0x0c6a('0x3c')]['length']?_0x113022[_0x0c6a('0x3c')]:_0x34c4f7[_0x0c6a('0x52')];_0x113022[_0x0c6a('0x5b')]=qs[_0x0c6a('0x40')](_0x5230f5['query'][_0x0c6a('0x40')]);_0x113022[_0x0c6a('0x43')]=qs[_0x0c6a('0x3a')](_[_0x0c6a('0x41')](_0x5230f5['query'],_0x34c4f7[_0x0c6a('0x3a')]));if(_0x5230f5[_0x0c6a('0x38')][_0x0c6a('0x42')]){_0x113022[_0x0c6a('0x43')]=_['merge'](_0x113022[_0x0c6a('0x43')],{'$or':_[_0x0c6a('0x45')](_0x113022[_0x0c6a('0x3c')],function(_0x9558cd){var _0x3985c7={};_0x3985c7[_0x9558cd]={'$like':'%'+_0x5230f5[_0x0c6a('0x38')][_0x0c6a('0x42')]+'%'};return _0x3985c7;})});}_0x113022=_[_0x0c6a('0x44')]({},_0x113022,_0x5230f5[_0x0c6a('0x4a')]);return _0xe0c447['getTags'](_0x113022);}})['then'](function(_0x3fd3ee){if(_0x3fd3ee){_0x494550=_0x3fd3ee[_0x0c6a('0x3e')];if(!_0x5230f5[_0x0c6a('0x38')][_0x0c6a('0x3f')]('nolimit')){_0x113022['limit']=qs['limit'](_0x5230f5[_0x0c6a('0x38')][_0x0c6a('0x2c')]);_0x113022[_0x0c6a('0x2b')]=qs['offset'](_0x5230f5['query'][_0x0c6a('0x2b')]);}return _0xe0c447[_0x0c6a('0x5f')](_0x113022);}})['then'](function(_0x1d9766){if(_0x1d9766){return _0x1d9766?{'count':_0x494550,'rows':_0x1d9766}:null;}})[_0x0c6a('0x1d')](respondWithResult(_0x25de62,null))[_0x0c6a('0x4f')](handleError(_0x25de62,null));};exports[_0x0c6a('0x60')]=function(_0x1f4d33,_0x54e6ee,_0x21eaf5){if(_0x1f4d33['body']['id']){delete _0x1f4d33['body']['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1f4d33['params']['id']}})[_0x0c6a('0x1d')](handleEntityNotFound(_0x54e6ee,null))[_0x0c6a('0x1d')](function(_0x1b8944){if(_0x1b8944){return _0x1b8944[_0x0c6a('0x60')](_0x1f4d33[_0x0c6a('0x55')]['ids']||[]);}return null;})['then'](respondWithResult(_0x54e6ee,null))[_0x0c6a('0x4f')](handleError(_0x54e6ee,null));}; \ No newline at end of file +var _0xc52c=['findOne','order','map','filter','getSubjects','ZendeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','destroy','name','send','index','ZendeskConfiguration','rawAttributes','keys','query','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','findAll','rows','show','params','fields','include','options','find','create','body','getFields'];(function(_0x1c0f3d,_0x55a9e2){var _0x4d71a8=function(_0xeff131){while(--_0xeff131){_0x1c0f3d['push'](_0x1c0f3d['shift']());}};_0x4d71a8(++_0x55a9e2);}(_0xc52c,0x1d6));var _0xcc52=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc52c[_0x56482c];return _0x5aae7a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcc52('0x0'));var rimraf=require(_0xcc52('0x1'));var zipdir=require(_0xcc52('0x2'));var jsonpatch=require(_0xcc52('0x3'));var rp=require(_0xcc52('0x4'));var moment=require(_0xcc52('0x5'));var BPromise=require(_0xcc52('0x6'));var Mustache=require(_0xcc52('0x7'));var util=require(_0xcc52('0x8'));var path=require('path');var sox=require(_0xcc52('0x9'));var csv=require(_0xcc52('0xa'));var ejs=require(_0xcc52('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcc52('0xc'));var crypto=require(_0xcc52('0xd'));var jsforce=require(_0xcc52('0xe'));var deskjs=require(_0xcc52('0xf'));var toCsv=require(_0xcc52('0xa'));var querystring=require(_0xcc52('0x10'));var Papa=require(_0xcc52('0x11'));var authService=require(_0xcc52('0x12'));var hardwareService=require(_0xcc52('0x13'));var Redis=require(_0xcc52('0x14'));var qs=require(_0xcc52('0x15'));var logger=require(_0xcc52('0x16'))(_0xcc52('0x17'));var utils=require(_0xcc52('0x18'));var config=require(_0xcc52('0x19'));var db=require(_0xcc52('0x1a'))['db'];var jayson=require(_0xcc52('0x1b'));var client=jayson[_0xcc52('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34c69d,_0x57467e,_0x4280d9,_0x3cecff){return new BPromise(function(_0x1b4101,_0x133930){var _0x14da9c=_0x3cecff||client;return _0x14da9c[_0xcc52('0x1d')](_0x34c69d,_0x4280d9)[_0xcc52('0x1e')](function(_0x2e3215){logger[_0xcc52('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x57467e,_0xcc52('0x20'));logger['debug'](_0xcc52('0x21'),_0x57467e,'request\x20sent',JSON['stringify'](_0x2e3215));if(_0x2e3215[_0xcc52('0x22')]){if(_0x2e3215['error']['code']===0x1f4){logger[_0xcc52('0x22')]('ZendeskConfiguration,\x20%s,\x20%s',_0x57467e,_0x2e3215[_0xcc52('0x22')][_0xcc52('0x23')]);return _0x133930(_0x2e3215['error'][_0xcc52('0x23')]);}logger['error'](_0xcc52('0x24'),_0x57467e,_0x2e3215[_0xcc52('0x22')][_0xcc52('0x23')]);return _0x1b4101(_0x2e3215[_0xcc52('0x22')][_0xcc52('0x23')]);}else{logger[_0xcc52('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x57467e,'request\x20sent');_0x1b4101(_0x2e3215[_0xcc52('0x25')][_0xcc52('0x23')]);}})[_0xcc52('0x26')](function(_0x319439){logger['error'](_0xcc52('0x24'),_0x57467e,_0x319439);_0x133930(_0x319439);});});}function respondWithStatusCode(_0xf613a4,_0x39a842){_0x39a842=_0x39a842||0xcc;return function(_0x55904b){if(_0x55904b){return _0xf613a4[_0xcc52('0x27')](_0x39a842);}return _0xf613a4[_0xcc52('0x28')](_0x39a842)[_0xcc52('0x29')]();};}function respondWithResult(_0x3b1c64,_0x2602ec){_0x2602ec=_0x2602ec||0xc8;return function(_0x32e048){if(_0x32e048){return _0x3b1c64[_0xcc52('0x28')](_0x2602ec)['json'](_0x32e048);}};}function respondWithFilteredResult(_0x131872,_0x3c0957){return function(_0x21d71d){if(_0x21d71d){var _0x1cab24=_0x21d71d[_0xcc52('0x2a')],_0x48525a=_0x3c0957[_0xcc52('0x2b')],_0x57f4f7=_0x3c0957[_0xcc52('0x2b')]+_0x3c0957[_0xcc52('0x2c')],_0x386818;if(_0x57f4f7>=_0x1cab24){_0x57f4f7=_0x1cab24;_0x386818=0xc8;}else{_0x386818=0xce;}_0x131872[_0xcc52('0x28')](_0x386818);return _0x131872[_0xcc52('0x2d')](_0xcc52('0x2e'),_0x48525a+'-'+_0x57f4f7+'/'+_0x1cab24)[_0xcc52('0x2f')](_0x21d71d);}return null;};}function patchUpdates(_0x18c0a8){return function(_0x1492c3){try{jsonpatch[_0xcc52('0x30')](_0x1492c3,_0x18c0a8,!![]);}catch(_0x59268d){return BPromise['reject'](_0x59268d);}return _0x1492c3['save']();};}function saveUpdates(_0x1650d7,_0x1e9c88){return function(_0x439cce){if(_0x439cce){return _0x439cce[_0xcc52('0x31')](_0x1650d7)[_0xcc52('0x1e')](function(_0x443f16){return _0x443f16;});}return null;};}function removeEntity(_0x536ba9,_0x14f00a){return function(_0x99dbc5){if(_0x99dbc5){return _0x99dbc5[_0xcc52('0x32')]()[_0xcc52('0x1e')](function(){_0x536ba9[_0xcc52('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a0faa,_0x203095){return function(_0x3b34a8){if(!_0x3b34a8){_0x4a0faa[_0xcc52('0x27')](0x194);}return _0x3b34a8;};}function handleError(_0x10d903,_0xa387d6){_0xa387d6=_0xa387d6||0x1f4;return function(_0x4bcd0a){logger['error'](_0x4bcd0a['stack']);if(_0x4bcd0a[_0xcc52('0x33')]){delete _0x4bcd0a['name'];}_0x10d903[_0xcc52('0x28')](_0xa387d6)[_0xcc52('0x34')](_0x4bcd0a);};}exports[_0xcc52('0x35')]=function(_0x592576,_0x331e6c){var _0x1af714={},_0x174698={},_0x3ed471={'count':0x0,'rows':[]};var _0x4a7869=db[_0xcc52('0x36')][_0xcc52('0x37')];_0x174698['model']=_[_0xcc52('0x38')](_0x4a7869);_0x174698[_0xcc52('0x39')]=_[_0xcc52('0x38')](_0x592576['query']);_0x174698['filters']=_[_0xcc52('0x3a')](_0x174698[_0xcc52('0x3b')],_0x174698[_0xcc52('0x39')]);_0x1af714[_0xcc52('0x3c')]=_[_0xcc52('0x3a')](_0x174698['model'],qs['fields'](_0x592576[_0xcc52('0x39')]['fields']));_0x1af714[_0xcc52('0x3c')]=_0x1af714['attributes'][_0xcc52('0x3d')]?_0x1af714[_0xcc52('0x3c')]:_0x174698[_0xcc52('0x3b')];if(!_0x592576['query'][_0xcc52('0x3e')](_0xcc52('0x3f'))){_0x1af714['limit']=qs[_0xcc52('0x2c')](_0x592576[_0xcc52('0x39')][_0xcc52('0x2c')]);_0x1af714[_0xcc52('0x2b')]=qs['offset'](_0x592576[_0xcc52('0x39')]['offset']);}_0x1af714['order']=qs[_0xcc52('0x40')](_0x592576[_0xcc52('0x39')][_0xcc52('0x40')]);_0x1af714[_0xcc52('0x41')]=qs[_0xcc52('0x42')](_[_0xcc52('0x43')](_0x592576[_0xcc52('0x39')],_0x174698[_0xcc52('0x42')]));if(_0x592576[_0xcc52('0x39')]['filter']){_0x1af714[_0xcc52('0x41')]=_[_0xcc52('0x44')](_0x1af714['where'],{'$or':_['map'](_0x4a7869,function(_0x1f768a){if(_0x1f768a[_0xcc52('0x45')]['key']!==_0xcc52('0x46')){var _0x49863f={};_0x49863f[_0x1f768a['field']]={'$like':'%'+_0x592576[_0xcc52('0x39')]['filter']+'%'};return _0x49863f;}})});}_0x1af714=_[_0xcc52('0x44')]({},_0x1af714,_0x592576['options']);var _0x589984={'where':_0x1af714[_0xcc52('0x41')]};return db[_0xcc52('0x36')][_0xcc52('0x2a')](_0x589984)['then'](function(_0x407cfe){_0x3ed471[_0xcc52('0x2a')]=_0x407cfe;if(_0x592576[_0xcc52('0x39')]['includeAll']){_0x1af714['include']=[{'all':!![]}];}return db[_0xcc52('0x36')][_0xcc52('0x47')](_0x1af714);})[_0xcc52('0x1e')](function(_0x4c8bc7){_0x3ed471[_0xcc52('0x48')]=_0x4c8bc7;return _0x3ed471;})[_0xcc52('0x1e')](respondWithFilteredResult(_0x331e6c,_0x1af714))[_0xcc52('0x26')](handleError(_0x331e6c,null));};exports[_0xcc52('0x49')]=function(_0x222007,_0x48e4d2){var _0x1e8d43={'raw':![],'where':{'id':_0x222007[_0xcc52('0x4a')]['id']}},_0x1ce2af={};_0x1ce2af['model']=_[_0xcc52('0x38')](db[_0xcc52('0x36')][_0xcc52('0x37')]);_0x1ce2af[_0xcc52('0x39')]=_[_0xcc52('0x38')](_0x222007['query']);_0x1ce2af[_0xcc52('0x42')]=_[_0xcc52('0x3a')](_0x1ce2af[_0xcc52('0x3b')],_0x1ce2af[_0xcc52('0x39')]);_0x1e8d43[_0xcc52('0x3c')]=_['intersection'](_0x1ce2af[_0xcc52('0x3b')],qs['fields'](_0x222007[_0xcc52('0x39')][_0xcc52('0x4b')]));_0x1e8d43[_0xcc52('0x3c')]=_0x1e8d43['attributes']['length']?_0x1e8d43['attributes']:_0x1ce2af[_0xcc52('0x3b')];if(_0x222007[_0xcc52('0x39')]['includeAll']){_0x1e8d43[_0xcc52('0x4c')]=[{'all':!![]}];}_0x1e8d43=_['merge']({},_0x1e8d43,_0x222007[_0xcc52('0x4d')]);return db[_0xcc52('0x36')][_0xcc52('0x4e')](_0x1e8d43)[_0xcc52('0x1e')](handleEntityNotFound(_0x48e4d2,null))[_0xcc52('0x1e')](respondWithResult(_0x48e4d2,null))['catch'](handleError(_0x48e4d2,null));};exports[_0xcc52('0x4f')]=function(_0x1f1e52,_0x52dd57){return db[_0xcc52('0x36')]['create'](_0x1f1e52[_0xcc52('0x50')],{})[_0xcc52('0x1e')](respondWithResult(_0x52dd57,0xc9))[_0xcc52('0x26')](handleError(_0x52dd57,null));};exports[_0xcc52('0x31')]=function(_0x4c0aac,_0x40221b){if(_0x4c0aac[_0xcc52('0x50')]['id']){delete _0x4c0aac['body']['id'];}return db[_0xcc52('0x36')][_0xcc52('0x4e')]({'where':{'id':_0x4c0aac[_0xcc52('0x4a')]['id']}})['then'](handleEntityNotFound(_0x40221b,null))['then'](saveUpdates(_0x4c0aac[_0xcc52('0x50')],null))[_0xcc52('0x1e')](respondWithResult(_0x40221b,null))['catch'](handleError(_0x40221b,null));};exports[_0xcc52('0x32')]=function(_0x2f4466,_0x53ae44){return db['ZendeskConfiguration'][_0xcc52('0x4e')]({'where':{'id':_0x2f4466[_0xcc52('0x4a')]['id']}})[_0xcc52('0x1e')](handleEntityNotFound(_0x53ae44,null))[_0xcc52('0x1e')](removeEntity(_0x53ae44,null))[_0xcc52('0x26')](handleError(_0x53ae44,null));};exports[_0xcc52('0x51')]=function(_0x49e5f0,_0x3fbb83,_0x45290a){var _0x455525={};var _0x53d65a={};var _0x5e251c;var _0x515e56;return db[_0xcc52('0x36')][_0xcc52('0x52')]({'where':{'id':_0x49e5f0[_0xcc52('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3fbb83,null))[_0xcc52('0x1e')](function(_0x416274){if(_0x416274){_0x5e251c=_0x416274;_0x53d65a['model']=_[_0xcc52('0x38')](db['ZendeskField']['rawAttributes']);_0x53d65a['query']=_['keys'](_0x49e5f0[_0xcc52('0x39')]);_0x53d65a[_0xcc52('0x42')]=_['intersection'](_0x53d65a[_0xcc52('0x3b')],_0x53d65a[_0xcc52('0x39')]);_0x455525[_0xcc52('0x3c')]=_['intersection'](_0x53d65a[_0xcc52('0x3b')],qs['fields'](_0x49e5f0[_0xcc52('0x39')][_0xcc52('0x4b')]));_0x455525[_0xcc52('0x3c')]=_0x455525[_0xcc52('0x3c')][_0xcc52('0x3d')]?_0x455525[_0xcc52('0x3c')]:_0x53d65a[_0xcc52('0x3b')];_0x455525[_0xcc52('0x53')]=qs[_0xcc52('0x40')](_0x49e5f0[_0xcc52('0x39')][_0xcc52('0x40')]);_0x455525[_0xcc52('0x41')]=qs[_0xcc52('0x42')](_['pick'](_0x49e5f0['query'],_0x53d65a[_0xcc52('0x42')]));if(_0x49e5f0[_0xcc52('0x39')]['filter']){_0x455525['where']=_[_0xcc52('0x44')](_0x455525['where'],{'$or':_[_0xcc52('0x54')](_0x455525[_0xcc52('0x3c')],function(_0x4f6070){var _0x362066={};_0x362066[_0x4f6070]={'$like':'%'+_0x49e5f0[_0xcc52('0x39')][_0xcc52('0x55')]+'%'};return _0x362066;})});}_0x455525=_['merge']({},_0x455525,_0x49e5f0['options']);return _0x5e251c[_0xcc52('0x51')](_0x455525);}})[_0xcc52('0x1e')](function(_0x56827c){if(_0x56827c){_0x515e56=_0x56827c[_0xcc52('0x3d')];if(!_0x49e5f0[_0xcc52('0x39')][_0xcc52('0x3e')](_0xcc52('0x3f'))){_0x455525[_0xcc52('0x2c')]=qs['limit'](_0x49e5f0[_0xcc52('0x39')][_0xcc52('0x2c')]);_0x455525[_0xcc52('0x2b')]=qs[_0xcc52('0x2b')](_0x49e5f0[_0xcc52('0x39')]['offset']);}return _0x5e251c[_0xcc52('0x51')](_0x455525);}})['then'](function(_0x3db194){if(_0x3db194){return _0x3db194?{'count':_0x515e56,'rows':_0x3db194}:null;}})['then'](respondWithResult(_0x3fbb83,null))[_0xcc52('0x26')](handleError(_0x3fbb83,null));};exports['getSubjects']=function(_0xbf09d2,_0x346f0a,_0x1a2c3e){var _0x4750d5={};var _0x190e2f={};var _0x27c1f7;var _0x252027;return db[_0xcc52('0x36')]['findOne']({'where':{'id':_0xbf09d2[_0xcc52('0x4a')]['id']}})[_0xcc52('0x1e')](handleEntityNotFound(_0x346f0a,null))[_0xcc52('0x1e')](function(_0x609289){if(_0x609289){_0x27c1f7=_0x609289;_0x190e2f[_0xcc52('0x3b')]=_[_0xcc52('0x38')](db['ZendeskField'][_0xcc52('0x37')]);_0x190e2f[_0xcc52('0x39')]=_[_0xcc52('0x38')](_0xbf09d2[_0xcc52('0x39')]);_0x190e2f[_0xcc52('0x42')]=_['intersection'](_0x190e2f[_0xcc52('0x3b')],_0x190e2f['query']);_0x4750d5[_0xcc52('0x3c')]=_[_0xcc52('0x3a')](_0x190e2f[_0xcc52('0x3b')],qs[_0xcc52('0x4b')](_0xbf09d2[_0xcc52('0x39')][_0xcc52('0x4b')]));_0x4750d5['attributes']=_0x4750d5[_0xcc52('0x3c')]['length']?_0x4750d5[_0xcc52('0x3c')]:_0x190e2f[_0xcc52('0x3b')];_0x4750d5['order']=qs[_0xcc52('0x40')](_0xbf09d2[_0xcc52('0x39')][_0xcc52('0x40')]);_0x4750d5[_0xcc52('0x41')]=qs[_0xcc52('0x42')](_[_0xcc52('0x43')](_0xbf09d2['query'],_0x190e2f[_0xcc52('0x42')]));if(_0xbf09d2[_0xcc52('0x39')][_0xcc52('0x55')]){_0x4750d5[_0xcc52('0x41')]=_[_0xcc52('0x44')](_0x4750d5['where'],{'$or':_['map'](_0x4750d5[_0xcc52('0x3c')],function(_0x4d2c66){var _0x1c1cda={};_0x1c1cda[_0x4d2c66]={'$like':'%'+_0xbf09d2['query'][_0xcc52('0x55')]+'%'};return _0x1c1cda;})});}_0x4750d5=_[_0xcc52('0x44')]({},_0x4750d5,_0xbf09d2[_0xcc52('0x4d')]);return _0x27c1f7[_0xcc52('0x56')](_0x4750d5);}})['then'](function(_0x2f4f58){if(_0x2f4f58){_0x252027=_0x2f4f58[_0xcc52('0x3d')];if(!_0xbf09d2['query'][_0xcc52('0x3e')](_0xcc52('0x3f'))){_0x4750d5[_0xcc52('0x2c')]=qs['limit'](_0xbf09d2[_0xcc52('0x39')][_0xcc52('0x2c')]);_0x4750d5[_0xcc52('0x2b')]=qs['offset'](_0xbf09d2['query'][_0xcc52('0x2b')]);}return _0x27c1f7[_0xcc52('0x56')](_0x4750d5);}})[_0xcc52('0x1e')](function(_0x3e68e4){if(_0x3e68e4){return _0x3e68e4?{'count':_0x252027,'rows':_0x3e68e4}:null;}})[_0xcc52('0x1e')](respondWithResult(_0x346f0a,null))[_0xcc52('0x26')](handleError(_0x346f0a,null));};exports['getDescriptions']=function(_0x413045,_0x16ddeb,_0x5421f3){var _0x5ce08f={};var _0xa4b399={};var _0x3fe1ce;var _0x55e612;return db[_0xcc52('0x36')][_0xcc52('0x52')]({'where':{'id':_0x413045[_0xcc52('0x4a')]['id']}})[_0xcc52('0x1e')](handleEntityNotFound(_0x16ddeb,null))['then'](function(_0x3524b1){if(_0x3524b1){_0x3fe1ce=_0x3524b1;_0xa4b399[_0xcc52('0x3b')]=_[_0xcc52('0x38')](db[_0xcc52('0x57')][_0xcc52('0x37')]);_0xa4b399[_0xcc52('0x39')]=_[_0xcc52('0x38')](_0x413045[_0xcc52('0x39')]);_0xa4b399[_0xcc52('0x42')]=_[_0xcc52('0x3a')](_0xa4b399[_0xcc52('0x3b')],_0xa4b399[_0xcc52('0x39')]);_0x5ce08f[_0xcc52('0x3c')]=_['intersection'](_0xa4b399[_0xcc52('0x3b')],qs[_0xcc52('0x4b')](_0x413045['query']['fields']));_0x5ce08f['attributes']=_0x5ce08f[_0xcc52('0x3c')][_0xcc52('0x3d')]?_0x5ce08f[_0xcc52('0x3c')]:_0xa4b399[_0xcc52('0x3b')];_0x5ce08f[_0xcc52('0x53')]=qs['sort'](_0x413045[_0xcc52('0x39')][_0xcc52('0x40')]);_0x5ce08f[_0xcc52('0x41')]=qs['filters'](_['pick'](_0x413045[_0xcc52('0x39')],_0xa4b399[_0xcc52('0x42')]));if(_0x413045[_0xcc52('0x39')][_0xcc52('0x55')]){_0x5ce08f['where']=_[_0xcc52('0x44')](_0x5ce08f['where'],{'$or':_[_0xcc52('0x54')](_0x5ce08f[_0xcc52('0x3c')],function(_0x3630e3){var _0x258c0a={};_0x258c0a[_0x3630e3]={'$like':'%'+_0x413045[_0xcc52('0x39')]['filter']+'%'};return _0x258c0a;})});}_0x5ce08f=_[_0xcc52('0x44')]({},_0x5ce08f,_0x413045[_0xcc52('0x4d')]);return _0x3fe1ce[_0xcc52('0x58')](_0x5ce08f);}})[_0xcc52('0x1e')](function(_0x610f8b){if(_0x610f8b){_0x55e612=_0x610f8b['length'];if(!_0x413045['query'][_0xcc52('0x3e')]('nolimit')){_0x5ce08f[_0xcc52('0x2c')]=qs[_0xcc52('0x2c')](_0x413045[_0xcc52('0x39')][_0xcc52('0x2c')]);_0x5ce08f['offset']=qs[_0xcc52('0x2b')](_0x413045['query'][_0xcc52('0x2b')]);}return _0x3fe1ce[_0xcc52('0x58')](_0x5ce08f);}})[_0xcc52('0x1e')](function(_0x3eaf95){if(_0x3eaf95){return _0x3eaf95?{'count':_0x55e612,'rows':_0x3eaf95}:null;}})[_0xcc52('0x1e')](respondWithResult(_0x16ddeb,null))[_0xcc52('0x26')](handleError(_0x16ddeb,null));};exports[_0xcc52('0x59')]=function(_0x37e118,_0x5b1380,_0x4d02ae){var _0x4f00a2={};var _0x53c8d1={};var _0x5ccf82;var _0x8d270e;return db[_0xcc52('0x36')][_0xcc52('0x52')]({'where':{'id':_0x37e118['params']['id']}})['then'](handleEntityNotFound(_0x5b1380,null))[_0xcc52('0x1e')](function(_0x3ac9cb){if(_0x3ac9cb){_0x5ccf82=_0x3ac9cb;_0x53c8d1[_0xcc52('0x3b')]=_[_0xcc52('0x38')](db['Tag'][_0xcc52('0x37')]);_0x53c8d1[_0xcc52('0x39')]=_['keys'](_0x37e118[_0xcc52('0x39')]);_0x53c8d1['filters']=_[_0xcc52('0x3a')](_0x53c8d1[_0xcc52('0x3b')],_0x53c8d1['query']);_0x4f00a2[_0xcc52('0x3c')]=_[_0xcc52('0x3a')](_0x53c8d1[_0xcc52('0x3b')],qs[_0xcc52('0x4b')](_0x37e118[_0xcc52('0x39')]['fields']));_0x4f00a2[_0xcc52('0x3c')]=_0x4f00a2['attributes']['length']?_0x4f00a2[_0xcc52('0x3c')]:_0x53c8d1[_0xcc52('0x3b')];_0x4f00a2['order']=qs[_0xcc52('0x40')](_0x37e118[_0xcc52('0x39')][_0xcc52('0x40')]);_0x4f00a2[_0xcc52('0x41')]=qs[_0xcc52('0x42')](_[_0xcc52('0x43')](_0x37e118['query'],_0x53c8d1[_0xcc52('0x42')]));if(_0x37e118[_0xcc52('0x39')]['filter']){_0x4f00a2[_0xcc52('0x41')]=_['merge'](_0x4f00a2[_0xcc52('0x41')],{'$or':_[_0xcc52('0x54')](_0x4f00a2[_0xcc52('0x3c')],function(_0x1801c4){var _0x222be0={};_0x222be0[_0x1801c4]={'$like':'%'+_0x37e118[_0xcc52('0x39')][_0xcc52('0x55')]+'%'};return _0x222be0;})});}_0x4f00a2=_['merge']({},_0x4f00a2,_0x37e118['options']);return _0x5ccf82[_0xcc52('0x59')](_0x4f00a2);}})['then'](function(_0x2cc808){if(_0x2cc808){_0x8d270e=_0x2cc808[_0xcc52('0x3d')];if(!_0x37e118['query']['hasOwnProperty'](_0xcc52('0x3f'))){_0x4f00a2[_0xcc52('0x2c')]=qs[_0xcc52('0x2c')](_0x37e118[_0xcc52('0x39')][_0xcc52('0x2c')]);_0x4f00a2['offset']=qs[_0xcc52('0x2b')](_0x37e118[_0xcc52('0x39')][_0xcc52('0x2b')]);}return _0x5ccf82[_0xcc52('0x59')](_0x4f00a2);}})[_0xcc52('0x1e')](function(_0x44420a){if(_0x44420a){return _0x44420a?{'count':_0x8d270e,'rows':_0x44420a}:null;}})[_0xcc52('0x1e')](respondWithResult(_0x5b1380,null))[_0xcc52('0x26')](handleError(_0x5b1380,null));};exports[_0xcc52('0x5a')]=function(_0xfc68a2,_0x3b8e4e,_0x32c308){if(_0xfc68a2['body']['id']){delete _0xfc68a2[_0xcc52('0x50')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0xfc68a2[_0xcc52('0x4a')]['id']}})[_0xcc52('0x1e')](handleEntityNotFound(_0x3b8e4e,null))[_0xcc52('0x1e')](function(_0x4a89b3){if(_0x4a89b3){return _0x4a89b3[_0xcc52('0x5a')](_0xfc68a2['body'][_0xcc52('0x5b')]||[]);}return null;})[_0xcc52('0x1e')](respondWithResult(_0x3b8e4e,null))[_0xcc52('0x26')](handleError(_0x3b8e4e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 823a1d3..5855e7e 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 _0xa2fc=['api','moment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger'];(function(_0x1033b3,_0x2278c2){var _0x4deb09=function(_0x3c24f9){while(--_0x3c24f9){_0x1033b3['push'](_0x1033b3['shift']());}};_0x4deb09(++_0x2278c2);}(_0xa2fc,0x166));var _0xca2f=function(_0x1af0e5,_0x152990){_0x1af0e5=_0x1af0e5-0x0;var _0x3c444a=_0xa2fc[_0x1af0e5];return _0x3c444a;};'use strict';var _=require('lodash');var util=require(_0xca2f('0x0'));var logger=require(_0xca2f('0x1'))(_0xca2f('0x2'));var moment=require(_0xca2f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xca2f('0x4'));module[_0xca2f('0x5')]=function(_0x5afc7d,_0x58eea1){return _0x5afc7d[_0xca2f('0x6')](_0xca2f('0x7'),attributes,{'tableName':_0xca2f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c46=['./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x0c46,0x111));var _0x60c4=function(_0x558c61,_0x11c751){_0x558c61=_0x558c61-0x0;var _0x4203d7=_0x0c46[_0x558c61];return _0x4203d7;};'use strict';var _=require(_0x60c4('0x0'));var util=require(_0x60c4('0x1'));var logger=require(_0x60c4('0x2'))(_0x60c4('0x3'));var moment=require(_0x60c4('0x4'));var BPromise=require(_0x60c4('0x5'));var rp=require(_0x60c4('0x6'));var attributes=require(_0x60c4('0x7'));module['exports']=function(_0x321dc5,_0x519484){return _0x321dc5[_0x60c4('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x60c4('0x9'),'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 282e04e..5aeac1e 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 _0x521c=['ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x521c,0x136));var _0xc521=function(_0x1af9b3,_0x4282f2){_0x1af9b3=_0x1af9b3-0x0;var _0x3f2e60=_0x521c[_0x1af9b3];return _0x3f2e60;};'use strict';var _=require(_0xc521('0x0'));var util=require(_0xc521('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc521('0x2'));var fs=require('fs');var Redis=require(_0xc521('0x3'));var db=require(_0xc521('0x4'))['db'];var utils=require(_0xc521('0x5'));var logger=require(_0xc521('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc521('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x541f19,_0xe9b22e,_0x2515b6){return new BPromise(function(_0x2c568a,_0x21428e){return client[_0xc521('0x8')](_0x541f19,_0x2515b6)['then'](function(_0x572ac1){logger[_0xc521('0x9')](_0xc521('0xa'),_0xe9b22e,_0xc521('0xb'));logger[_0xc521('0xc')](_0xc521('0xd'),_0xe9b22e,'request\x20sent',JSON[_0xc521('0xe')](_0x572ac1));if(_0x572ac1[_0xc521('0xf')]){if(_0x572ac1[_0xc521('0xf')][_0xc521('0x10')]===0x1f4){logger[_0xc521('0xf')](_0xc521('0xa'),_0xe9b22e,_0x572ac1['error'][_0xc521('0x11')]);return _0x21428e(_0x572ac1[_0xc521('0xf')][_0xc521('0x11')]);}logger[_0xc521('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0xe9b22e,_0x572ac1['error'][_0xc521('0x11')]);return _0x2c568a(_0x572ac1[_0xc521('0xf')][_0xc521('0x11')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0xe9b22e,'request\x20sent');_0x2c568a(_0x572ac1['result'][_0xc521('0x11')]);}})[_0xc521('0x12')](function(_0x1a9ebb){logger[_0xc521('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0xe9b22e,_0x1a9ebb);_0x21428e(_0x1a9ebb);});});} \ No newline at end of file +var _0x5e5b=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x521e33,_0x55f926){var _0x407fdc=function(_0x23105e){while(--_0x23105e){_0x521e33['push'](_0x521e33['shift']());}};_0x407fdc(++_0x55f926);}(_0x5e5b,0x87));var _0xb5e5=function(_0x3607b2,_0x18fa72){_0x3607b2=_0x3607b2-0x0;var _0x33dbc8=_0x5e5b[_0x3607b2];return _0x33dbc8;};'use strict';var _=require(_0xb5e5('0x0'));var util=require(_0xb5e5('0x1'));var moment=require(_0xb5e5('0x2'));var BPromise=require('bluebird');var rs=require(_0xb5e5('0x3'));var fs=require('fs');var Redis=require(_0xb5e5('0x4'));var db=require(_0xb5e5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5e5('0x6'))(_0xb5e5('0x7'));var config=require(_0xb5e5('0x8'));var jayson=require(_0xb5e5('0x9'));var client=jayson['client'][_0xb5e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d6a06,_0x2e178a,_0x289101){return new BPromise(function(_0x197e20,_0x1a84d9){return client[_0xb5e5('0xb')](_0x5d6a06,_0x289101)['then'](function(_0x3893aa){logger[_0xb5e5('0xc')](_0xb5e5('0xd'),_0x2e178a,'request\x20sent');logger[_0xb5e5('0xe')](_0xb5e5('0xf'),_0x2e178a,'request\x20sent',JSON[_0xb5e5('0x10')](_0x3893aa));if(_0x3893aa['error']){if(_0x3893aa[_0xb5e5('0x11')][_0xb5e5('0x12')]===0x1f4){logger[_0xb5e5('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2e178a,_0x3893aa[_0xb5e5('0x11')][_0xb5e5('0x13')]);return _0x1a84d9(_0x3893aa[_0xb5e5('0x11')]['message']);}logger['error'](_0xb5e5('0xd'),_0x2e178a,_0x3893aa[_0xb5e5('0x11')]['message']);return _0x197e20(_0x3893aa['error'][_0xb5e5('0x13')]);}else{logger[_0xb5e5('0xc')](_0xb5e5('0xd'),_0x2e178a,'request\x20sent');_0x197e20(_0x3893aa[_0xb5e5('0x14')][_0xb5e5('0x13')]);}})[_0xb5e5('0x15')](function(_0x25f2d0){logger[_0xb5e5('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2e178a,_0x25f2d0);_0x1a84d9(_0x25f2d0);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index e8fadc5..d03f1b5 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 _0x9957=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1e46d9,_0x1d9c7e){var _0x22bf78=function(_0x4a920b){while(--_0x4a920b){_0x1e46d9['push'](_0x1e46d9['shift']());}};_0x22bf78(++_0x1d9c7e);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./intZendeskField.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xd')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['destroy']);module[_0x7995('0x10')]=router; \ No newline at end of file +var _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x14b36e,_0x8dd826){var _0x616e7=function(_0x14e594){while(--_0x14e594){_0x14b36e['push'](_0x14b36e['shift']());}};_0x616e7(++_0x8dd826);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 4dbfd87..2f998a2 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 _0x41bb=['exports','string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x301487,_0x501f46){var _0x736bfa=function(_0x4b83aa){while(--_0x4b83aa){_0x301487['push'](_0x301487['shift']());}};_0x736bfa(++_0x501f46);}(_0x41bb,0xc5));var _0xb41b=function(_0x34faba,_0xe6bc7){_0x34faba=_0x34faba-0x0;var _0x8e41d7=_0x41bb[_0x34faba];return _0x8e41d7;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb41b('0x2'),'variable',_0xb41b('0x3'),_0xb41b('0x4')),'defaultValue':_0xb41b('0x2')},'content':{'type':Sequelize[_0xb41b('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb41b('0x6')](_0xb41b('0x2'),_0xb41b('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb41b('0x5')]},'customField':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x91a7=['STRING','exports','ENUM','string','customVariable'];(function(_0x3806a6,_0x2f6881){var _0x2f150e=function(_0x55cce0){while(--_0x55cce0){_0x3806a6['push'](_0x3806a6['shift']());}};_0x2f150e(++_0x2f6881);}(_0x91a7,0xe7));var _0x791a=function(_0x548961,_0x5a13d0){_0x548961=_0x548961-0x0;var _0x31593d=_0x91a7[_0x548961];return _0x31593d;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'type':{'type':Sequelize[_0x791a('0x1')](_0x791a('0x2'),'variable',_0x791a('0x3'),'keyValue'),'defaultValue':_0x791a('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x791a('0x1')](_0x791a('0x2'),'variable',_0x791a('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x791a('0x4')]},'nameField':{'type':Sequelize[_0x791a('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x791a('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 62c3a5d..1079b01 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 _0x3f0c=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','type','key','VIRTUAL','field','filter','includeAll','ZendeskField','rows','catch','show','rawAttributes','include','options','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x3f0c,0xd0));var _0xc3f0=function(_0x1578ad,_0x5cdd6c){_0x1578ad=_0x1578ad-0x0;var _0x5b84c2=_0x3f0c[_0x1578ad];return _0x5b84c2;};'use strict';var pdf=require(_0xc3f0('0x0'));var emlformat=require(_0xc3f0('0x1'));var rimraf=require(_0xc3f0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc3f0('0x3'));var rp=require(_0xc3f0('0x4'));var moment=require('moment');var BPromise=require(_0xc3f0('0x5'));var Mustache=require(_0xc3f0('0x6'));var util=require(_0xc3f0('0x7'));var path=require(_0xc3f0('0x8'));var sox=require(_0xc3f0('0x9'));var csv=require(_0xc3f0('0xa'));var ejs=require(_0xc3f0('0xb'));var fs=require('fs');var _=require(_0xc3f0('0xc'));var squel=require(_0xc3f0('0xd'));var crypto=require(_0xc3f0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3f0('0xf'));var toCsv=require(_0xc3f0('0xa'));var querystring=require(_0xc3f0('0x10'));var Papa=require('papaparse');var authService=require(_0xc3f0('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc3f0('0x12'));var utils=require(_0xc3f0('0x13'));var config=require('../../config/environment');var db=require(_0xc3f0('0x14'))['db'];function respondWithStatusCode(_0x5d95ac,_0x2bd7ee){_0x2bd7ee=_0x2bd7ee||0xcc;return function(_0x232249){if(_0x232249){return _0x5d95ac[_0xc3f0('0x15')](_0x2bd7ee);}return _0x5d95ac['status'](_0x2bd7ee)[_0xc3f0('0x16')]();};}function respondWithResult(_0x1e7728,_0xb17be5){_0xb17be5=_0xb17be5||0xc8;return function(_0x21be72){if(_0x21be72){return _0x1e7728[_0xc3f0('0x17')](_0xb17be5)[_0xc3f0('0x18')](_0x21be72);}};}function respondWithFilteredResult(_0x488a7d,_0x1208c8){return function(_0x3e2d9d){if(_0x3e2d9d){var _0x27b723=_0x3e2d9d[_0xc3f0('0x19')],_0x171a9c=_0x1208c8[_0xc3f0('0x1a')],_0x3de718=_0x1208c8['offset']+_0x1208c8[_0xc3f0('0x1b')],_0x2079a1;if(_0x3de718>=_0x27b723){_0x3de718=_0x27b723;_0x2079a1=0xc8;}else{_0x2079a1=0xce;}_0x488a7d['status'](_0x2079a1);return _0x488a7d[_0xc3f0('0x1c')](_0xc3f0('0x1d'),_0x171a9c+'-'+_0x3de718+'/'+_0x27b723)[_0xc3f0('0x18')](_0x3e2d9d);}return null;};}function patchUpdates(_0xa4029){return function(_0x3fde9c){try{jsonpatch[_0xc3f0('0x1e')](_0x3fde9c,_0xa4029,!![]);}catch(_0x464fd8){return BPromise[_0xc3f0('0x1f')](_0x464fd8);}return _0x3fde9c[_0xc3f0('0x20')]();};}function saveUpdates(_0x46df2a,_0x1e44c4){return function(_0x2964be){if(_0x2964be){return _0x2964be[_0xc3f0('0x21')](_0x46df2a)[_0xc3f0('0x22')](function(_0x23c322){return _0x23c322;});}return null;};}function removeEntity(_0x885a58,_0x1f6ef1){return function(_0x448548){if(_0x448548){return _0x448548[_0xc3f0('0x23')]()[_0xc3f0('0x22')](function(){_0x885a58[_0xc3f0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f39a,_0x4544a7){return function(_0x591cd6){if(!_0x591cd6){_0x30f39a[_0xc3f0('0x15')](0x194);}return _0x591cd6;};}function handleError(_0x327ba2,_0x1628d0){_0x1628d0=_0x1628d0||0x1f4;return function(_0x58deb4){logger[_0xc3f0('0x24')](_0x58deb4['stack']);if(_0x58deb4[_0xc3f0('0x25')]){delete _0x58deb4[_0xc3f0('0x25')];}_0x327ba2[_0xc3f0('0x17')](_0x1628d0)[_0xc3f0('0x26')](_0x58deb4);};}exports[_0xc3f0('0x27')]=function(_0x1ee848,_0x1e569e){var _0x27988d={},_0x5e759a={},_0x379c14={'count':0x0,'rows':[]};var _0x359aa5=db['ZendeskField']['rawAttributes'];_0x5e759a[_0xc3f0('0x28')]=_[_0xc3f0('0x29')](_0x359aa5);_0x5e759a[_0xc3f0('0x2a')]=_[_0xc3f0('0x29')](_0x1ee848[_0xc3f0('0x2a')]);_0x5e759a['filters']=_[_0xc3f0('0x2b')](_0x5e759a[_0xc3f0('0x28')],_0x5e759a[_0xc3f0('0x2a')]);_0x27988d[_0xc3f0('0x2c')]=_[_0xc3f0('0x2b')](_0x5e759a['model'],qs[_0xc3f0('0x2d')](_0x1ee848[_0xc3f0('0x2a')][_0xc3f0('0x2d')]));_0x27988d[_0xc3f0('0x2c')]=_0x27988d[_0xc3f0('0x2c')][_0xc3f0('0x2e')]?_0x27988d[_0xc3f0('0x2c')]:_0x5e759a['model'];if(!_0x1ee848[_0xc3f0('0x2a')]['hasOwnProperty'](_0xc3f0('0x2f'))){_0x27988d[_0xc3f0('0x1b')]=qs['limit'](_0x1ee848[_0xc3f0('0x2a')]['limit']);_0x27988d[_0xc3f0('0x1a')]=qs[_0xc3f0('0x1a')](_0x1ee848[_0xc3f0('0x2a')][_0xc3f0('0x1a')]);}_0x27988d[_0xc3f0('0x30')]=qs[_0xc3f0('0x31')](_0x1ee848['query'][_0xc3f0('0x31')]);_0x27988d[_0xc3f0('0x32')]=qs[_0xc3f0('0x33')](_[_0xc3f0('0x34')](_0x1ee848[_0xc3f0('0x2a')],_0x5e759a[_0xc3f0('0x33')]));if(_0x1ee848['query']['filter']){_0x27988d[_0xc3f0('0x32')]=_[_0xc3f0('0x35')](_0x27988d[_0xc3f0('0x32')],{'$or':_['map'](_0x359aa5,function(_0x4e1248){if(_0x4e1248[_0xc3f0('0x36')][_0xc3f0('0x37')]!==_0xc3f0('0x38')){var _0x2920f7={};_0x2920f7[_0x4e1248[_0xc3f0('0x39')]]={'$like':'%'+_0x1ee848[_0xc3f0('0x2a')][_0xc3f0('0x3a')]+'%'};return _0x2920f7;}})});}_0x27988d=_[_0xc3f0('0x35')]({},_0x27988d,_0x1ee848['options']);var _0xc87f2b={'where':_0x27988d[_0xc3f0('0x32')]};return db['ZendeskField'][_0xc3f0('0x19')](_0xc87f2b)[_0xc3f0('0x22')](function(_0x5bd20b){_0x379c14[_0xc3f0('0x19')]=_0x5bd20b;if(_0x1ee848[_0xc3f0('0x2a')][_0xc3f0('0x3b')]){_0x27988d['include']=[{'all':!![]}];}return db[_0xc3f0('0x3c')]['findAll'](_0x27988d);})[_0xc3f0('0x22')](function(_0x1536b5){_0x379c14[_0xc3f0('0x3d')]=_0x1536b5;return _0x379c14;})[_0xc3f0('0x22')](respondWithFilteredResult(_0x1e569e,_0x27988d))[_0xc3f0('0x3e')](handleError(_0x1e569e,null));};exports[_0xc3f0('0x3f')]=function(_0xf38f83,_0x2e4e1f){var _0x1a242d={'raw':!![],'where':{'id':_0xf38f83['params']['id']}},_0x51cb63={};_0x51cb63[_0xc3f0('0x28')]=_[_0xc3f0('0x29')](db['ZendeskField'][_0xc3f0('0x40')]);_0x51cb63[_0xc3f0('0x2a')]=_[_0xc3f0('0x29')](_0xf38f83[_0xc3f0('0x2a')]);_0x51cb63[_0xc3f0('0x33')]=_[_0xc3f0('0x2b')](_0x51cb63[_0xc3f0('0x28')],_0x51cb63[_0xc3f0('0x2a')]);_0x1a242d[_0xc3f0('0x2c')]=_[_0xc3f0('0x2b')](_0x51cb63[_0xc3f0('0x28')],qs['fields'](_0xf38f83[_0xc3f0('0x2a')][_0xc3f0('0x2d')]));_0x1a242d['attributes']=_0x1a242d[_0xc3f0('0x2c')]['length']?_0x1a242d[_0xc3f0('0x2c')]:_0x51cb63['model'];if(_0xf38f83['query']['includeAll']){_0x1a242d[_0xc3f0('0x41')]=[{'all':!![]}];}_0x1a242d=_[_0xc3f0('0x35')]({},_0x1a242d,_0xf38f83[_0xc3f0('0x42')]);return db['ZendeskField'][_0xc3f0('0x43')](_0x1a242d)[_0xc3f0('0x22')](handleEntityNotFound(_0x2e4e1f,null))[_0xc3f0('0x22')](respondWithResult(_0x2e4e1f,null))[_0xc3f0('0x3e')](handleError(_0x2e4e1f,null));};exports[_0xc3f0('0x44')]=function(_0x18c523,_0x4363a2){return db[_0xc3f0('0x3c')][_0xc3f0('0x44')](_0x18c523[_0xc3f0('0x45')],{})[_0xc3f0('0x22')](respondWithResult(_0x4363a2,0xc9))['catch'](handleError(_0x4363a2,null));};exports[_0xc3f0('0x21')]=function(_0x31358d,_0x5c6c2b){if(_0x31358d[_0xc3f0('0x45')]['id']){delete _0x31358d[_0xc3f0('0x45')]['id'];}return db[_0xc3f0('0x3c')][_0xc3f0('0x43')]({'where':{'id':_0x31358d[_0xc3f0('0x46')]['id']}})[_0xc3f0('0x22')](handleEntityNotFound(_0x5c6c2b,null))['then'](saveUpdates(_0x31358d[_0xc3f0('0x45')],null))[_0xc3f0('0x22')](respondWithResult(_0x5c6c2b,null))[_0xc3f0('0x3e')](handleError(_0x5c6c2b,null));};exports[_0xc3f0('0x23')]=function(_0x51c560,_0x5c3663){return db['ZendeskField']['find']({'where':{'id':_0x51c560[_0xc3f0('0x46')]['id']}})[_0xc3f0('0x22')](handleEntityNotFound(_0x5c3663,null))[_0xc3f0('0x22')](removeEntity(_0x5c3663,null))[_0xc3f0('0x3e')](handleError(_0x5c3663,null));}; \ No newline at end of file +var _0x4ac1=['fields','length','nolimit','limit','order','sort','filters','filter','where','merge','map','type','key','options','count','include','findAll','catch','show','params','includeAll','find','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','stack','name','send','ZendeskField','rawAttributes','model','keys','query','attributes','intersection'];(function(_0x3a037b,_0x25ec24){var _0x11b964=function(_0x267d89){while(--_0x267d89){_0x3a037b['push'](_0x3a037b['shift']());}};_0x11b964(++_0x25ec24);}(_0x4ac1,0xf1));var _0x14ac=function(_0x3ebc9b,_0x19f15d){_0x3ebc9b=_0x3ebc9b-0x0;var _0x1a255d=_0x4ac1[_0x3ebc9b];return _0x1a255d;};'use strict';var pdf=require(_0x14ac('0x0'));var emlformat=require(_0x14ac('0x1'));var rimraf=require(_0x14ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14ac('0x3'));var rp=require(_0x14ac('0x4'));var moment=require(_0x14ac('0x5'));var BPromise=require(_0x14ac('0x6'));var Mustache=require(_0x14ac('0x7'));var util=require(_0x14ac('0x8'));var path=require(_0x14ac('0x9'));var sox=require(_0x14ac('0xa'));var csv=require(_0x14ac('0xb'));var ejs=require(_0x14ac('0xc'));var fs=require('fs');var _=require(_0x14ac('0xd'));var squel=require(_0x14ac('0xe'));var crypto=require('crypto');var jsforce=require(_0x14ac('0xf'));var deskjs=require(_0x14ac('0x10'));var toCsv=require('to-csv');var querystring=require(_0x14ac('0x11'));var Papa=require(_0x14ac('0x12'));var authService=require(_0x14ac('0x13'));var hardwareService=require(_0x14ac('0x14'));var Redis=require('ioredis');var qs=require(_0x14ac('0x15'));var logger=require(_0x14ac('0x16'))(_0x14ac('0x17'));var utils=require(_0x14ac('0x18'));var config=require('../../config/environment');var db=require(_0x14ac('0x19'))['db'];function respondWithStatusCode(_0x2354ce,_0x45d64b){_0x45d64b=_0x45d64b||0xcc;return function(_0x575510){if(_0x575510){return _0x2354ce[_0x14ac('0x1a')](_0x45d64b);}return _0x2354ce[_0x14ac('0x1b')](_0x45d64b)[_0x14ac('0x1c')]();};}function respondWithResult(_0x4c7b05,_0x52f38b){_0x52f38b=_0x52f38b||0xc8;return function(_0x1ca6da){if(_0x1ca6da){return _0x4c7b05[_0x14ac('0x1b')](_0x52f38b)[_0x14ac('0x1d')](_0x1ca6da);}};}function respondWithFilteredResult(_0x321510,_0x3de956){return function(_0x34b965){if(_0x34b965){var _0x4ebfda=_0x34b965['count'],_0x4c4217=_0x3de956[_0x14ac('0x1e')],_0x32b801=_0x3de956[_0x14ac('0x1e')]+_0x3de956['limit'],_0x5ce1be;if(_0x32b801>=_0x4ebfda){_0x32b801=_0x4ebfda;_0x5ce1be=0xc8;}else{_0x5ce1be=0xce;}_0x321510[_0x14ac('0x1b')](_0x5ce1be);return _0x321510[_0x14ac('0x1f')]('Content-Range',_0x4c4217+'-'+_0x32b801+'/'+_0x4ebfda)['json'](_0x34b965);}return null;};}function patchUpdates(_0x1768ff){return function(_0x2d5da9){try{jsonpatch[_0x14ac('0x20')](_0x2d5da9,_0x1768ff,!![]);}catch(_0x5020b7){return BPromise[_0x14ac('0x21')](_0x5020b7);}return _0x2d5da9[_0x14ac('0x22')]();};}function saveUpdates(_0x552e57,_0x41024d){return function(_0x4d89d7){if(_0x4d89d7){return _0x4d89d7[_0x14ac('0x23')](_0x552e57)[_0x14ac('0x24')](function(_0x3be91b){return _0x3be91b;});}return null;};}function removeEntity(_0x105e91,_0x876a09){return function(_0x5b8737){if(_0x5b8737){return _0x5b8737['destroy']()[_0x14ac('0x24')](function(){_0x105e91[_0x14ac('0x1b')](0xcc)[_0x14ac('0x1c')]();});}};}function handleEntityNotFound(_0x4bf123,_0x28071b){return function(_0x2d11e0){if(!_0x2d11e0){_0x4bf123[_0x14ac('0x1a')](0x194);}return _0x2d11e0;};}function handleError(_0x431251,_0x16178b){_0x16178b=_0x16178b||0x1f4;return function(_0x290a6a){logger['error'](_0x290a6a[_0x14ac('0x25')]);if(_0x290a6a['name']){delete _0x290a6a[_0x14ac('0x26')];}_0x431251[_0x14ac('0x1b')](_0x16178b)[_0x14ac('0x27')](_0x290a6a);};}exports['index']=function(_0x1b9080,_0x250513){var _0x412e25={},_0x59de39={},_0x479675={'count':0x0,'rows':[]};var _0x125052=db[_0x14ac('0x28')][_0x14ac('0x29')];_0x59de39[_0x14ac('0x2a')]=_[_0x14ac('0x2b')](_0x125052);_0x59de39[_0x14ac('0x2c')]=_[_0x14ac('0x2b')](_0x1b9080['query']);_0x59de39['filters']=_['intersection'](_0x59de39[_0x14ac('0x2a')],_0x59de39[_0x14ac('0x2c')]);_0x412e25[_0x14ac('0x2d')]=_[_0x14ac('0x2e')](_0x59de39[_0x14ac('0x2a')],qs[_0x14ac('0x2f')](_0x1b9080[_0x14ac('0x2c')][_0x14ac('0x2f')]));_0x412e25['attributes']=_0x412e25[_0x14ac('0x2d')][_0x14ac('0x30')]?_0x412e25[_0x14ac('0x2d')]:_0x59de39['model'];if(!_0x1b9080[_0x14ac('0x2c')]['hasOwnProperty'](_0x14ac('0x31'))){_0x412e25[_0x14ac('0x32')]=qs[_0x14ac('0x32')](_0x1b9080[_0x14ac('0x2c')][_0x14ac('0x32')]);_0x412e25[_0x14ac('0x1e')]=qs[_0x14ac('0x1e')](_0x1b9080[_0x14ac('0x2c')]['offset']);}_0x412e25[_0x14ac('0x33')]=qs['sort'](_0x1b9080[_0x14ac('0x2c')][_0x14ac('0x34')]);_0x412e25['where']=qs['filters'](_['pick'](_0x1b9080[_0x14ac('0x2c')],_0x59de39[_0x14ac('0x35')]));if(_0x1b9080[_0x14ac('0x2c')][_0x14ac('0x36')]){_0x412e25[_0x14ac('0x37')]=_[_0x14ac('0x38')](_0x412e25[_0x14ac('0x37')],{'$or':_[_0x14ac('0x39')](_0x125052,function(_0xc35102){if(_0xc35102[_0x14ac('0x3a')][_0x14ac('0x3b')]!=='VIRTUAL'){var _0x1fd1a2={};_0x1fd1a2[_0xc35102['field']]={'$like':'%'+_0x1b9080[_0x14ac('0x2c')][_0x14ac('0x36')]+'%'};return _0x1fd1a2;}})});}_0x412e25=_['merge']({},_0x412e25,_0x1b9080[_0x14ac('0x3c')]);var _0x2ea41d={'where':_0x412e25['where']};return db['ZendeskField'][_0x14ac('0x3d')](_0x2ea41d)['then'](function(_0x78c0e7){_0x479675['count']=_0x78c0e7;if(_0x1b9080[_0x14ac('0x2c')]['includeAll']){_0x412e25[_0x14ac('0x3e')]=[{'all':!![]}];}return db['ZendeskField'][_0x14ac('0x3f')](_0x412e25);})[_0x14ac('0x24')](function(_0x2e4acf){_0x479675['rows']=_0x2e4acf;return _0x479675;})[_0x14ac('0x24')](respondWithFilteredResult(_0x250513,_0x412e25))[_0x14ac('0x40')](handleError(_0x250513,null));};exports[_0x14ac('0x41')]=function(_0x470cc3,_0xfb843a){var _0x33d112={'raw':!![],'where':{'id':_0x470cc3[_0x14ac('0x42')]['id']}},_0x39eee7={};_0x39eee7[_0x14ac('0x2a')]=_[_0x14ac('0x2b')](db[_0x14ac('0x28')][_0x14ac('0x29')]);_0x39eee7[_0x14ac('0x2c')]=_[_0x14ac('0x2b')](_0x470cc3[_0x14ac('0x2c')]);_0x39eee7[_0x14ac('0x35')]=_[_0x14ac('0x2e')](_0x39eee7[_0x14ac('0x2a')],_0x39eee7[_0x14ac('0x2c')]);_0x33d112[_0x14ac('0x2d')]=_[_0x14ac('0x2e')](_0x39eee7[_0x14ac('0x2a')],qs[_0x14ac('0x2f')](_0x470cc3[_0x14ac('0x2c')][_0x14ac('0x2f')]));_0x33d112[_0x14ac('0x2d')]=_0x33d112[_0x14ac('0x2d')][_0x14ac('0x30')]?_0x33d112[_0x14ac('0x2d')]:_0x39eee7[_0x14ac('0x2a')];if(_0x470cc3[_0x14ac('0x2c')][_0x14ac('0x43')]){_0x33d112[_0x14ac('0x3e')]=[{'all':!![]}];}_0x33d112=_['merge']({},_0x33d112,_0x470cc3[_0x14ac('0x3c')]);return db[_0x14ac('0x28')][_0x14ac('0x44')](_0x33d112)['then'](handleEntityNotFound(_0xfb843a,null))[_0x14ac('0x24')](respondWithResult(_0xfb843a,null))[_0x14ac('0x40')](handleError(_0xfb843a,null));};exports[_0x14ac('0x45')]=function(_0x24f062,_0x1719e5){return db[_0x14ac('0x28')]['create'](_0x24f062[_0x14ac('0x46')],{})['then'](respondWithResult(_0x1719e5,0xc9))[_0x14ac('0x40')](handleError(_0x1719e5,null));};exports[_0x14ac('0x23')]=function(_0x382fd1,_0xb59f6){if(_0x382fd1[_0x14ac('0x46')]['id']){delete _0x382fd1[_0x14ac('0x46')]['id'];}return db[_0x14ac('0x28')][_0x14ac('0x44')]({'where':{'id':_0x382fd1[_0x14ac('0x42')]['id']}})[_0x14ac('0x24')](handleEntityNotFound(_0xb59f6,null))[_0x14ac('0x24')](saveUpdates(_0x382fd1['body'],null))[_0x14ac('0x24')](respondWithResult(_0xb59f6,null))[_0x14ac('0x40')](handleError(_0xb59f6,null));};exports[_0x14ac('0x47')]=function(_0x20893f,_0x55bc9d){return db[_0x14ac('0x28')][_0x14ac('0x44')]({'where':{'id':_0x20893f[_0x14ac('0x42')]['id']}})[_0x14ac('0x24')](handleEntityNotFound(_0x55bc9d,null))['then'](removeEntity(_0x55bc9d,null))[_0x14ac('0x40')](handleError(_0x55bc9d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 2dc9381..5aa7098 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 _0xa571=['util','../../config/logger','api','bluebird','request-promise','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x3f3d61,_0xec0c48){var _0x4b5616=function(_0x3c2328){while(--_0x3c2328){_0x3f3d61['push'](_0x3f3d61['shift']());}};_0x4b5616(++_0xec0c48);}(_0xa571,0x107));var _0x1a57=function(_0x66acb3,_0x2f6440){_0x66acb3=_0x66acb3-0x0;var _0x289d45=_0xa571[_0x66acb3];return _0x289d45;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));var moment=require('moment');var BPromise=require(_0x1a57('0x4'));var rp=require(_0x1a57('0x5'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x1f2c44,_0x5067fa){return _0x1f2c44[_0x1a57('0x6')](_0x1a57('0x7'),attributes,{'tableName':_0x1a57('0x8'),'paranoid':![],'indexes':[{'name':_0x1a57('0x9'),'fields':[_0x1a57('0xa'),_0x1a57('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['idField','lodash','../../config/logger','moment','request-promise','exports','int_zendesk_fields','zendesk_unique_index'];(function(_0x2105b7,_0x121ec8){var _0x4239e7=function(_0x1d1758){while(--_0x1d1758){_0x2105b7['push'](_0x2105b7['shift']());}};_0x4239e7(++_0x121ec8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xb7e7[_0x9aada2];return _0x196dff;};'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 attributes=require('./intZendeskField.attributes');module[_0x7b7e('0x4')]=function(_0x118577,_0x1d9384){return _0x118577['define']('ZendeskField',attributes,{'tableName':_0x7b7e('0x5'),'paranoid':![],'indexes':[{'name':_0x7b7e('0x6'),'fields':[_0x7b7e('0x7'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 8c0eab7..b81d57a 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 _0x4227=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4d7a50,_0x16d041){var _0x10341d=function(_0x955d42){while(--_0x955d42){_0x4d7a50['push'](_0x4d7a50['shift']());}};_0x10341d(++_0x16d041);}(_0x4227,0x89));var _0x7422=function(_0x420c48,_0x4dc08c){_0x420c48=_0x420c48-0x0;var _0x301764=_0x4227[_0x420c48];return _0x301764;};'use strict';var _=require(_0x7422('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7422('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7422('0x2'));var db=require(_0x7422('0x3'))['db'];var utils=require(_0x7422('0x4'));var logger=require('../../config/logger')(_0x7422('0x5'));var config=require(_0x7422('0x6'));var jayson=require(_0x7422('0x7'));var client=jayson[_0x7422('0x8')][_0x7422('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3432,_0xe99299,_0x45ca1a){return new BPromise(function(_0x12965e,_0x599d78){return client[_0x7422('0xa')](_0x2b3432,_0x45ca1a)[_0x7422('0xb')](function(_0x25de34){logger['info'](_0x7422('0xc'),_0xe99299,'request\x20sent');logger[_0x7422('0xd')](_0x7422('0xe'),_0xe99299,_0x7422('0xf'),JSON[_0x7422('0x10')](_0x25de34));if(_0x25de34[_0x7422('0x11')]){if(_0x25de34['error'][_0x7422('0x12')]===0x1f4){logger[_0x7422('0x11')]('ZendeskField,\x20%s,\x20%s',_0xe99299,_0x25de34[_0x7422('0x11')][_0x7422('0x13')]);return _0x599d78(_0x25de34['error'][_0x7422('0x13')]);}logger[_0x7422('0x11')]('ZendeskField,\x20%s,\x20%s',_0xe99299,_0x25de34['error'][_0x7422('0x13')]);return _0x12965e(_0x25de34['error'][_0x7422('0x13')]);}else{logger[_0x7422('0x14')]('ZendeskField,\x20%s,\x20%s',_0xe99299,_0x7422('0xf'));_0x12965e(_0x25de34[_0x7422('0x15')][_0x7422('0x13')]);}})[_0x7422('0x16')](function(_0x2946ca){logger[_0x7422('0x11')]('ZendeskField,\x20%s,\x20%s',_0xe99299,_0x2946ca);_0x599d78(_0x2946ca);});});} \ No newline at end of file +var _0x9c00=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis'];(function(_0x462bc3,_0x20667f){var _0x1861dc=function(_0x4fbc5e){while(--_0x4fbc5e){_0x462bc3['push'](_0x462bc3['shift']());}};_0x1861dc(++_0x20667f);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5aabcb,_0x219fbd){_0x5aabcb=_0x5aabcb-0x0;var _0x4b6e71=_0x9c00[_0x5aabcb];return _0x4b6e71;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09c0('0x2'));var fs=require('fs');var Redis=require(_0x09c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var jayson=require(_0x09c0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3d7e,_0x17d11f,_0x1b633b){return new BPromise(function(_0x3187aa,_0x17cd9d){return client['request'](_0x1f3d7e,_0x1b633b)[_0x09c0('0x9')](function(_0x1c1246){logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,_0x09c0('0xc'));logger[_0x09c0('0xd')](_0x09c0('0xe'),_0x17d11f,_0x09c0('0xc'),JSON[_0x09c0('0xf')](_0x1c1246));if(_0x1c1246[_0x09c0('0x10')]){if(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x11')]===0x1f4){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x17cd9d(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x3187aa(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}else{logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,'request\x20sent');_0x3187aa(_0x1c1246['result']['message']);}})[_0x09c0('0x13')](function(_0x11f4b2){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x11f4b2);_0x17cd9d(_0x11f4b2);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index e1e2909..1dac321 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 _0x14a0=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','getConfigurations','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14a0,0x8e));var _0x014a=function(_0x422eca,_0x980b01){_0x422eca=_0x422eca-0x0;var _0x2cd355=_0x14a0[_0x422eca];return _0x2cd355;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var auth=require(_0x014a('0x5'));var interaction=require(_0x014a('0x6'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x014a('0x7')]('/',auth[_0x014a('0x8')](),controller[_0x014a('0x9')]);router['get']('/:id',auth[_0x014a('0x8')](),controller[_0x014a('0xa')]);router[_0x014a('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x014a('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x014a('0xc')]('/',auth['isAuthenticated'](),controller[_0x014a('0xd')]);router[_0x014a('0xc')]('/:id/configurations',auth[_0x014a('0x8')](),controller[_0x014a('0xe')]);router[_0x014a('0xf')](_0x014a('0x10'),auth[_0x014a('0x8')](),controller[_0x014a('0x11')]);router[_0x014a('0x12')](_0x014a('0x10'),auth[_0x014a('0x8')](),controller[_0x014a('0x13')]);module[_0x014a('0x14')]=router; \ No newline at end of file +var _0x4fc2=['getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x3b6335,_0x32f96a){var _0x353cb1=function(_0x117a73){while(--_0x117a73){_0x3b6335['push'](_0x3b6335['shift']());}};_0x353cb1(++_0x32f96a);}(_0x4fc2,0x111));var _0x24fc=function(_0x154276,_0xdced12){_0x154276=_0x154276-0x0;var _0xff137e=_0x4fc2[_0x154276];return _0xff137e;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['get'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')]('/',auth[_0x24fc('0xa')](),controller[_0x24fc('0x11')]);router[_0x24fc('0x10')](_0x24fc('0xc'),auth['isAuthenticated'](),controller[_0x24fc('0x12')]);router[_0x24fc('0x13')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index c8787b2..c6e1d8c 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 _0x6955=['sequelize','STRING'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x6955,0x128));var _0x5695=function(_0x5de273,_0x14def3){_0x5de273=_0x5de273-0x0;var _0x2a1f06=_0x6955[_0x5de273];return _0x2a1f06;};'use strict';var Sequelize=require(_0x5695('0x0'));module['exports']={'name':{'type':Sequelize[_0x5695('0x1')]},'description':{'type':Sequelize[_0x5695('0x1')]},'authToken':{'type':Sequelize[_0x5695('0x1')]},'host':{'type':Sequelize[_0x5695('0x1')]},'serverUrl':{'type':Sequelize[_0x5695('0x1')]}}; \ No newline at end of file +var _0xae07=['STRING','sequelize','exports'];(function(_0x2c21a1,_0x338adb){var _0x4e8a3e=function(_0x247397){while(--_0x247397){_0x2c21a1['push'](_0x2c21a1['shift']());}};_0x4e8a3e(++_0x338adb);}(_0xae07,0xbe));var _0x7ae0=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xae07[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x7ae0('0x0'));module[_0x7ae0('0x1')]={'name':{'type':Sequelize[_0x7ae0('0x2')]},'description':{'type':Sequelize[_0x7ae0('0x2')]},'authToken':{'type':Sequelize[_0x7ae0('0x2')]},'host':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7ae0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a3df0f5..3020788 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 _0x5577=['count','offset','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','ZohoAccount','rawAttributes','model','query','keys','filters','intersection','attributes','length','nolimit','limit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','field','options','includeAll','rows','catch','show','params','fields','include','find','create','body','findOne','ZohoConfiguration','getConfigurations','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','ZohoField','Descriptions','getFields','host','authToken','slice','lastIndexOf','GET','format','https://crm.%s/crm/private/json/Calls/getFields','crmapi','response','Calls','section','Call\x20Purpose','includes','push','label','customfield','true','val','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end'];(function(_0x3841c9,_0x43aaad){var _0x448fe7=function(_0x2c91f8){while(--_0x2c91f8){_0x3841c9['push'](_0x3841c9['shift']());}};_0x448fe7(++_0x43aaad);}(_0x5577,0x1b4));var _0x7557=function(_0x11894c,_0x351b81){_0x11894c=_0x11894c-0x0;var _0x625439=_0x5577[_0x11894c];return _0x625439;};'use strict';var pdf=require(_0x7557('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7557('0x1'));var zipdir=require(_0x7557('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7557('0x3'));var moment=require(_0x7557('0x4'));var BPromise=require(_0x7557('0x5'));var Mustache=require(_0x7557('0x6'));var util=require(_0x7557('0x7'));var path=require(_0x7557('0x8'));var sox=require('sox');var csv=require(_0x7557('0x9'));var ejs=require(_0x7557('0xa'));var fs=require('fs');var _=require(_0x7557('0xb'));var squel=require(_0x7557('0xc'));var crypto=require(_0x7557('0xd'));var jsforce=require(_0x7557('0xe'));var deskjs=require(_0x7557('0xf'));var toCsv=require(_0x7557('0x9'));var querystring=require(_0x7557('0x10'));var Papa=require(_0x7557('0x11'));var authService=require(_0x7557('0x12'));var hardwareService=require(_0x7557('0x13'));var Redis=require(_0x7557('0x14'));var qs=require(_0x7557('0x15'));var logger=require(_0x7557('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7557('0x17'));var db=require(_0x7557('0x18'))['db'];var integrations=require(_0x7557('0x19'));var jayson=require(_0x7557('0x1a'));var client=jayson[_0x7557('0x1b')][_0x7557('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x156ac1,_0x26abc8,_0x43848a,_0x926138){return new BPromise(function(_0x5468df,_0x276031){var _0x3fb7a6=_0x926138||client;return _0x3fb7a6[_0x7557('0x1d')](_0x156ac1,_0x43848a)['then'](function(_0x3ad3a1){logger[_0x7557('0x1e')](_0x7557('0x1f'),_0x26abc8,_0x7557('0x20'));logger['debug'](_0x7557('0x21'),_0x26abc8,_0x7557('0x20'),JSON['stringify'](_0x3ad3a1));if(_0x3ad3a1['error']){if(_0x3ad3a1[_0x7557('0x22')][_0x7557('0x23')]===0x1f4){logger[_0x7557('0x22')](_0x7557('0x1f'),_0x26abc8,_0x3ad3a1['error'][_0x7557('0x24')]);return _0x276031(_0x3ad3a1['error'][_0x7557('0x24')]);}logger[_0x7557('0x22')](_0x7557('0x1f'),_0x26abc8,_0x3ad3a1[_0x7557('0x22')]['message']);return _0x5468df(_0x3ad3a1[_0x7557('0x22')][_0x7557('0x24')]);}else{logger[_0x7557('0x1e')](_0x7557('0x1f'),_0x26abc8,_0x7557('0x20'));_0x5468df(_0x3ad3a1['result']['message']);}})['catch'](function(_0x211fbe){logger['error'](_0x7557('0x1f'),_0x26abc8,_0x211fbe);_0x276031(_0x211fbe);});});}function respondWithStatusCode(_0x352b63,_0x1e97d3){_0x1e97d3=_0x1e97d3||0xcc;return function(_0x9bbcf6){if(_0x9bbcf6){return _0x352b63[_0x7557('0x25')](_0x1e97d3);}return _0x352b63[_0x7557('0x26')](_0x1e97d3)[_0x7557('0x27')]();};}function respondWithResult(_0x49a5ba,_0x3c8a33){_0x3c8a33=_0x3c8a33||0xc8;return function(_0x5bc953){if(_0x5bc953){return _0x49a5ba[_0x7557('0x26')](_0x3c8a33)['json'](_0x5bc953);}};}function respondWithFilteredResult(_0x45d1bf,_0x3aa642){return function(_0x4758b9){if(_0x4758b9){var _0x42ae94=_0x4758b9[_0x7557('0x28')],_0x54e79c=_0x3aa642[_0x7557('0x29')],_0x2aed02=_0x3aa642[_0x7557('0x29')]+_0x3aa642['limit'],_0x4e69de;if(_0x2aed02>=_0x42ae94){_0x2aed02=_0x42ae94;_0x4e69de=0xc8;}else{_0x4e69de=0xce;}_0x45d1bf[_0x7557('0x26')](_0x4e69de);return _0x45d1bf[_0x7557('0x2a')](_0x7557('0x2b'),_0x54e79c+'-'+_0x2aed02+'/'+_0x42ae94)[_0x7557('0x2c')](_0x4758b9);}return null;};}function patchUpdates(_0x19095d){return function(_0x414eec){try{jsonpatch['apply'](_0x414eec,_0x19095d,!![]);}catch(_0x154c31){return BPromise[_0x7557('0x2d')](_0x154c31);}return _0x414eec[_0x7557('0x2e')]();};}function saveUpdates(_0x37f398,_0x5b562e){return function(_0x3e7dae){if(_0x3e7dae){return _0x3e7dae[_0x7557('0x2f')](_0x37f398)[_0x7557('0x30')](function(_0xeced76){return _0xeced76;});}return null;};}function removeEntity(_0x4745de,_0x2f3fd3){return function(_0x20a3ab){if(_0x20a3ab){return _0x20a3ab[_0x7557('0x31')]()[_0x7557('0x30')](function(){_0x4745de[_0x7557('0x26')](0xcc)[_0x7557('0x27')]();});}};}function handleEntityNotFound(_0xa06c56,_0x11aaff){return function(_0x23bc9c){if(!_0x23bc9c){_0xa06c56[_0x7557('0x25')](0x194);}return _0x23bc9c;};}function handleError(_0x2f903e,_0x31f0e0){_0x31f0e0=_0x31f0e0||0x1f4;return function(_0x881d1){logger[_0x7557('0x22')](_0x881d1[_0x7557('0x32')]);if(_0x881d1[_0x7557('0x33')]){delete _0x881d1[_0x7557('0x33')];}_0x2f903e['status'](_0x31f0e0)[_0x7557('0x34')](_0x881d1);};}exports['index']=function(_0x5a8b5d,_0x363457){var _0x5d3ef6={},_0x24dd31={},_0x5862b8={'count':0x0,'rows':[]};var _0x5e566d=db[_0x7557('0x35')][_0x7557('0x36')];_0x24dd31[_0x7557('0x37')]=_['keys'](_0x5e566d);_0x24dd31[_0x7557('0x38')]=_[_0x7557('0x39')](_0x5a8b5d[_0x7557('0x38')]);_0x24dd31[_0x7557('0x3a')]=_[_0x7557('0x3b')](_0x24dd31[_0x7557('0x37')],_0x24dd31[_0x7557('0x38')]);_0x5d3ef6[_0x7557('0x3c')]=_['intersection'](_0x24dd31['model'],qs['fields'](_0x5a8b5d['query']['fields']));_0x5d3ef6['attributes']=_0x5d3ef6[_0x7557('0x3c')][_0x7557('0x3d')]?_0x5d3ef6[_0x7557('0x3c')]:_0x24dd31[_0x7557('0x37')];if(!_0x5a8b5d['query']['hasOwnProperty'](_0x7557('0x3e'))){_0x5d3ef6[_0x7557('0x3f')]=qs[_0x7557('0x3f')](_0x5a8b5d[_0x7557('0x38')][_0x7557('0x3f')]);_0x5d3ef6['offset']=qs[_0x7557('0x29')](_0x5a8b5d[_0x7557('0x38')][_0x7557('0x29')]);}_0x5d3ef6[_0x7557('0x40')]=qs[_0x7557('0x41')](_0x5a8b5d[_0x7557('0x38')][_0x7557('0x41')]);_0x5d3ef6['where']=qs[_0x7557('0x3a')](_[_0x7557('0x42')](_0x5a8b5d[_0x7557('0x38')],_0x24dd31[_0x7557('0x3a')]));if(_0x5a8b5d['query'][_0x7557('0x43')]){_0x5d3ef6[_0x7557('0x44')]=_[_0x7557('0x45')](_0x5d3ef6['where'],{'$or':_[_0x7557('0x46')](_0x5e566d,function(_0x544a01){if(_0x544a01[_0x7557('0x47')]['key']!==_0x7557('0x48')){var _0x4be1af={};_0x4be1af[_0x544a01[_0x7557('0x49')]]={'$like':'%'+_0x5a8b5d[_0x7557('0x38')][_0x7557('0x43')]+'%'};return _0x4be1af;}})});}_0x5d3ef6=_[_0x7557('0x45')]({},_0x5d3ef6,_0x5a8b5d[_0x7557('0x4a')]);var _0x26bdec={'where':_0x5d3ef6['where']};return db['ZohoAccount']['count'](_0x26bdec)[_0x7557('0x30')](function(_0x3dee0c){_0x5862b8[_0x7557('0x28')]=_0x3dee0c;if(_0x5a8b5d[_0x7557('0x38')][_0x7557('0x4b')]){_0x5d3ef6['include']=[{'all':!![]}];}return db[_0x7557('0x35')]['findAll'](_0x5d3ef6);})[_0x7557('0x30')](function(_0x321d62){_0x5862b8[_0x7557('0x4c')]=_0x321d62;return _0x5862b8;})[_0x7557('0x30')](respondWithFilteredResult(_0x363457,_0x5d3ef6))[_0x7557('0x4d')](handleError(_0x363457,null));};exports[_0x7557('0x4e')]=function(_0x1a980b,_0x1a5bfd){var _0x4bc91a={'raw':![],'where':{'id':_0x1a980b[_0x7557('0x4f')]['id']}},_0x36b360={};_0x36b360[_0x7557('0x37')]=_['keys'](db[_0x7557('0x35')]['rawAttributes']);_0x36b360['query']=_[_0x7557('0x39')](_0x1a980b[_0x7557('0x38')]);_0x36b360[_0x7557('0x3a')]=_[_0x7557('0x3b')](_0x36b360[_0x7557('0x37')],_0x36b360['query']);_0x4bc91a[_0x7557('0x3c')]=_[_0x7557('0x3b')](_0x36b360[_0x7557('0x37')],qs[_0x7557('0x50')](_0x1a980b[_0x7557('0x38')][_0x7557('0x50')]));_0x4bc91a[_0x7557('0x3c')]=_0x4bc91a['attributes']['length']?_0x4bc91a['attributes']:_0x36b360['model'];if(_0x1a980b[_0x7557('0x38')][_0x7557('0x4b')]){_0x4bc91a[_0x7557('0x51')]=[{'all':!![]}];}_0x4bc91a=_[_0x7557('0x45')]({},_0x4bc91a,_0x1a980b[_0x7557('0x4a')]);return db[_0x7557('0x35')][_0x7557('0x52')](_0x4bc91a)[_0x7557('0x30')](handleEntityNotFound(_0x1a5bfd,null))['then'](respondWithResult(_0x1a5bfd,null))[_0x7557('0x4d')](handleError(_0x1a5bfd,null));};exports[_0x7557('0x53')]=function(_0x56c6c5,_0x154f4b){return db['ZohoAccount'][_0x7557('0x53')](_0x56c6c5['body'],{})[_0x7557('0x30')](respondWithResult(_0x154f4b,0xc9))[_0x7557('0x4d')](handleError(_0x154f4b,null));};exports['update']=function(_0xf9551f,_0x34bc73){if(_0xf9551f[_0x7557('0x54')]['id']){delete _0xf9551f[_0x7557('0x54')]['id'];}return db[_0x7557('0x35')]['find']({'where':{'id':_0xf9551f[_0x7557('0x4f')]['id']}})[_0x7557('0x30')](handleEntityNotFound(_0x34bc73,null))[_0x7557('0x30')](saveUpdates(_0xf9551f[_0x7557('0x54')],null))['then'](respondWithResult(_0x34bc73,null))['catch'](handleError(_0x34bc73,null));};exports[_0x7557('0x31')]=function(_0x4f6477,_0xd513d3){return db[_0x7557('0x35')][_0x7557('0x52')]({'where':{'id':_0x4f6477[_0x7557('0x4f')]['id']}})['then'](handleEntityNotFound(_0xd513d3,null))[_0x7557('0x30')](removeEntity(_0xd513d3,null))['catch'](handleError(_0xd513d3,null));};exports['getConfigurations']=function(_0x3aed04,_0x414396,_0x4ce823){var _0x583b5a={};var _0xadb74a={};var _0x119dcb;var _0x2109f7;return db[_0x7557('0x35')][_0x7557('0x55')]({'where':{'id':_0x3aed04[_0x7557('0x4f')]['id']}})['then'](handleEntityNotFound(_0x414396,null))['then'](function(_0x490966){if(_0x490966){_0x119dcb=_0x490966;_0xadb74a[_0x7557('0x37')]=_[_0x7557('0x39')](db[_0x7557('0x56')][_0x7557('0x36')]);_0xadb74a[_0x7557('0x38')]=_[_0x7557('0x39')](_0x3aed04['query']);_0xadb74a[_0x7557('0x3a')]=_[_0x7557('0x3b')](_0xadb74a[_0x7557('0x37')],_0xadb74a[_0x7557('0x38')]);_0x583b5a[_0x7557('0x3c')]=_[_0x7557('0x3b')](_0xadb74a[_0x7557('0x37')],qs[_0x7557('0x50')](_0x3aed04['query']['fields']));_0x583b5a[_0x7557('0x3c')]=_0x583b5a['attributes'][_0x7557('0x3d')]?_0x583b5a[_0x7557('0x3c')]:_0xadb74a['model'];_0x583b5a['order']=qs['sort'](_0x3aed04[_0x7557('0x38')][_0x7557('0x41')]);_0x583b5a[_0x7557('0x44')]=qs['filters'](_[_0x7557('0x42')](_0x3aed04[_0x7557('0x38')],_0xadb74a['filters']));if(_0x3aed04[_0x7557('0x38')][_0x7557('0x43')]){_0x583b5a[_0x7557('0x44')]=_[_0x7557('0x45')](_0x583b5a['where'],{'$or':_[_0x7557('0x46')](_0x583b5a[_0x7557('0x3c')],function(_0x320b15){var _0x56d34c={};_0x56d34c[_0x320b15]={'$like':'%'+_0x3aed04['query']['filter']+'%'};return _0x56d34c;})});}_0x583b5a=_[_0x7557('0x45')]({},_0x583b5a,_0x3aed04[_0x7557('0x4a')]);return _0x119dcb[_0x7557('0x57')](_0x583b5a);}})[_0x7557('0x30')](function(_0x5e333c){if(_0x5e333c){_0x2109f7=_0x5e333c[_0x7557('0x3d')];if(!_0x3aed04[_0x7557('0x38')][_0x7557('0x58')](_0x7557('0x3e'))){_0x583b5a[_0x7557('0x3f')]=qs['limit'](_0x3aed04[_0x7557('0x38')][_0x7557('0x3f')]);_0x583b5a['offset']=qs[_0x7557('0x29')](_0x3aed04[_0x7557('0x38')][_0x7557('0x29')]);}return _0x119dcb[_0x7557('0x57')](_0x583b5a);}})[_0x7557('0x30')](function(_0x482488){if(_0x482488){return _0x482488?{'count':_0x2109f7,'rows':_0x482488}:null;}})[_0x7557('0x30')](respondWithResult(_0x414396,null))[_0x7557('0x4d')](handleError(_0x414396,null));};exports[_0x7557('0x59')]=function(_0xdc14b6,_0x555203,_0x61e559){if(_0xdc14b6[_0x7557('0x54')]['id']){delete _0xdc14b6[_0x7557('0x54')]['id'];}return db[_0x7557('0x35')]['findOne']({'where':{'id':_0xdc14b6[_0x7557('0x4f')]['id']}})[_0x7557('0x30')](handleEntityNotFound(_0x555203,null))[_0x7557('0x30')](function(_0x5025c6){if(_0x5025c6){_0xdc14b6[_0x7557('0x54')]['AccountId']=_0x5025c6['id'];_0xdc14b6[_0x7557('0x54')][_0x7557('0x5a')]=integrations[_0x7557('0x5b')](_0xdc14b6[_0x7557('0x54')][_0x7557('0x5c')],_0xdc14b6[_0x7557('0x54')][_0x7557('0x47')]);_0xdc14b6['body']['Descriptions']=integrations['getDescriptions'](_0xdc14b6[_0x7557('0x54')][_0x7557('0x5c')],_0xdc14b6['body'][_0x7557('0x47')]);return db[_0x7557('0x56')][_0x7557('0x53')](_0xdc14b6['body'],{'include':[{'model':db[_0x7557('0x5d')],'as':'Subjects'},{'model':db[_0x7557('0x5d')],'as':_0x7557('0x5e')}]});}return null;})[_0x7557('0x30')](respondWithResult(_0x555203,null))[_0x7557('0x4d')](handleError(_0x555203,null));};exports[_0x7557('0x5f')]=function(_0x359dbe,_0x5adcea,_0x5e12d0){var _0x33682a='';return db[_0x7557('0x35')][_0x7557('0x55')]({'where':{'id':_0x359dbe['params']['id']},'attributes':['id',_0x7557('0x60'),_0x7557('0x61')]})['then'](handleEntityNotFound(_0x5adcea,null))['then'](function(_0x400767){if(_0x400767){_0x33682a=_0x400767[_0x7557('0x60')];var _0x490667=_0x33682a[_0x7557('0x62')](-0x1);if(_0x490667==='/'){_0x33682a=_0x33682a['substring'](0x0,_0x33682a[_0x7557('0x63')](_0x490667));}return rp({'method':_0x7557('0x64'),'uri':util[_0x7557('0x65')](_0x7557('0x66'),_0x33682a),'qs':{'authtoken':_0x400767[_0x7557('0x61')],'scope':_0x7557('0x67')},'json':!![]});}})[_0x7557('0x30')](function(_0x4c018e){if(_0x4c018e){if(_0x4c018e['response']&&_0x4c018e[_0x7557('0x68')]['error']){throw new Error(_0x4c018e['response'][_0x7557('0x22')][_0x7557('0x24')]);}var _0x289222=[];if(_0x4c018e[_0x7557('0x69')]&&_0x4c018e[_0x7557('0x69')][_0x7557('0x6a')]){if(_0x4c018e[_0x7557('0x69')]['section']['FL']){var _0x1e5668=[_0x7557('0x6b')];for(var _0x1a5386=0x0,_0x5a05e5=_0x4c018e['Calls'][_0x7557('0x6a')]['FL'][_0x7557('0x3d')];_0x1a5386<_0x5a05e5;_0x1a5386++){if(_[_0x7557('0x6c')](_0x1e5668,_0x4c018e[_0x7557('0x69')][_0x7557('0x6a')]['FL'][_0x1a5386]['dv'])){_0x289222[_0x7557('0x6d')]({'id':_0x4c018e['Calls']['section']['FL'][_0x1a5386]['dv'],'name':_0x4c018e[_0x7557('0x69')][_0x7557('0x6a')]['FL'][_0x1a5386][_0x7557('0x6e')],'custom':_0x4c018e['Calls']['section']['FL'][_0x1a5386][_0x7557('0x6f')]===_0x7557('0x70')?!![]:![],'options':_0x4c018e[_0x7557('0x69')][_0x7557('0x6a')]['FL'][_0x1a5386][_0x7557('0x47')]==='Pick\x20List'&&_0x4c018e[_0x7557('0x69')][_0x7557('0x6a')]['FL'][_0x1a5386]['val']?_[_0x7557('0x46')](_0x4c018e['Calls']['section']['FL'][_0x1a5386][_0x7557('0x71')],function(_0x4da350){return{'name':_0x4da350,'value':_0x4da350};}):[]});}}}}return{'count':_0x289222['length'],'rows':_0x289222};}})['then'](respondWithResult(_0x5adcea,null))[_0x7557('0x4d')](function(_0x24057d){var _0x51870b=_0x359dbe[_0x7557('0x38')]['test']?0x1f4:_0x24057d[_0x7557('0x72')]||0x1f4;logger[_0x7557('0x22')](_0x7557('0x73'),_0x7557('0x5f'),_0x51870b,JSON[_0x7557('0x74')](_0x24057d));delete _0x24057d['name'];if(_0x51870b===0x191){_0x51870b=0x190;}_0x5adcea[_0x7557('0x26')](_0x51870b)[_0x7557('0x34')](_0x359dbe[_0x7557('0x38')][_0x7557('0x75')]?{'message':_0x7557('0x76'),'statusCode':_0x24057d[_0x7557('0x72')]}:_0x24057d);});}; \ No newline at end of file +var _0xc95e=['papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','then','end','stack','name','send','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','ZohoAccount','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','destroy','ZohoConfiguration','filters','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ZohoField','getFields','findOne','host','authToken','slice','substring','format','crmapi','response','Calls','section','Call\x20Purpose','includes','customfield','true','Pick\x20List','val','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x52540f,_0x3365a6){var _0x34a565=function(_0x2ef804){while(--_0x2ef804){_0x52540f['push'](_0x52540f['shift']());}};_0x34a565(++_0x3365a6);}(_0xc95e,0x14d));var _0xec95=function(_0x51353e,_0x2cc903){_0x51353e=_0x51353e-0x0;var _0x3b5f4e=_0xc95e[_0x51353e];return _0x3b5f4e;};'use strict';var pdf=require(_0xec95('0x0'));var emlformat=require(_0xec95('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xec95('0x2'));var jsonpatch=require(_0xec95('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xec95('0x4'));var util=require('util');var path=require(_0xec95('0x5'));var sox=require('sox');var csv=require(_0xec95('0x6'));var ejs=require(_0xec95('0x7'));var fs=require('fs');var _=require(_0xec95('0x8'));var squel=require(_0xec95('0x9'));var crypto=require('crypto');var jsforce=require(_0xec95('0xa'));var deskjs=require(_0xec95('0xb'));var toCsv=require(_0xec95('0x6'));var querystring=require('querystring');var Papa=require(_0xec95('0xc'));var authService=require('../../components/auth/service');var hardwareService=require(_0xec95('0xd'));var Redis=require(_0xec95('0xe'));var qs=require(_0xec95('0xf'));var logger=require(_0xec95('0x10'))('api');var utils=require(_0xec95('0x11'));var config=require(_0xec95('0x12'));var db=require('../../mysqldb')['db'];var integrations=require(_0xec95('0x13'));var jayson=require(_0xec95('0x14'));var client=jayson[_0xec95('0x15')][_0xec95('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x121c5b,_0x5ed48b,_0x209aa9,_0x46a6a2){return new BPromise(function(_0x2b80fe,_0x1d5b6c){var _0x3df470=_0x46a6a2||client;return _0x3df470[_0xec95('0x17')](_0x121c5b,_0x209aa9)['then'](function(_0x1fc690){logger[_0xec95('0x18')]('ZohoAccount,\x20%s,\x20%s',_0x5ed48b,'request\x20sent');logger[_0xec95('0x19')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5ed48b,_0xec95('0x1a'),JSON[_0xec95('0x1b')](_0x1fc690));if(_0x1fc690[_0xec95('0x1c')]){if(_0x1fc690[_0xec95('0x1c')][_0xec95('0x1d')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5ed48b,_0x1fc690[_0xec95('0x1c')][_0xec95('0x1e')]);return _0x1d5b6c(_0x1fc690[_0xec95('0x1c')][_0xec95('0x1e')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5ed48b,_0x1fc690[_0xec95('0x1c')][_0xec95('0x1e')]);return _0x2b80fe(_0x1fc690['error']['message']);}else{logger[_0xec95('0x18')](_0xec95('0x1f'),_0x5ed48b,_0xec95('0x1a'));_0x2b80fe(_0x1fc690[_0xec95('0x20')][_0xec95('0x1e')]);}})['catch'](function(_0x328ae6){logger[_0xec95('0x1c')](_0xec95('0x1f'),_0x5ed48b,_0x328ae6);_0x1d5b6c(_0x328ae6);});});}function respondWithStatusCode(_0x4fdfd2,_0x7a1029){_0x7a1029=_0x7a1029||0xcc;return function(_0xfda1b4){if(_0xfda1b4){return _0x4fdfd2[_0xec95('0x21')](_0x7a1029);}return _0x4fdfd2[_0xec95('0x22')](_0x7a1029)['end']();};}function respondWithResult(_0x9065fd,_0x5478f7){_0x5478f7=_0x5478f7||0xc8;return function(_0x548be2){if(_0x548be2){return _0x9065fd[_0xec95('0x22')](_0x5478f7)[_0xec95('0x23')](_0x548be2);}};}function respondWithFilteredResult(_0x3381a1,_0x41a7bb){return function(_0x15c570){if(_0x15c570){var _0x381e34=_0x15c570[_0xec95('0x24')],_0x297f4e=_0x41a7bb['offset'],_0x446d9d=_0x41a7bb['offset']+_0x41a7bb[_0xec95('0x25')],_0x2a5b14;if(_0x446d9d>=_0x381e34){_0x446d9d=_0x381e34;_0x2a5b14=0xc8;}else{_0x2a5b14=0xce;}_0x3381a1[_0xec95('0x22')](_0x2a5b14);return _0x3381a1[_0xec95('0x26')](_0xec95('0x27'),_0x297f4e+'-'+_0x446d9d+'/'+_0x381e34)[_0xec95('0x23')](_0x15c570);}return null;};}function patchUpdates(_0x5dca01){return function(_0x3b7b7d){try{jsonpatch[_0xec95('0x28')](_0x3b7b7d,_0x5dca01,!![]);}catch(_0x17c909){return BPromise[_0xec95('0x29')](_0x17c909);}return _0x3b7b7d[_0xec95('0x2a')]();};}function saveUpdates(_0x1465f1,_0x57670d){return function(_0xf869c7){if(_0xf869c7){return _0xf869c7['update'](_0x1465f1)[_0xec95('0x2b')](function(_0x4ca7d5){return _0x4ca7d5;});}return null;};}function removeEntity(_0x4408cb,_0x526b2b){return function(_0x3fdaca){if(_0x3fdaca){return _0x3fdaca['destroy']()[_0xec95('0x2b')](function(){_0x4408cb['status'](0xcc)[_0xec95('0x2c')]();});}};}function handleEntityNotFound(_0x19cda5,_0x5bfea5){return function(_0x35b91b){if(!_0x35b91b){_0x19cda5[_0xec95('0x21')](0x194);}return _0x35b91b;};}function handleError(_0x19895c,_0x308dec){_0x308dec=_0x308dec||0x1f4;return function(_0x463cc5){logger[_0xec95('0x1c')](_0x463cc5[_0xec95('0x2d')]);if(_0x463cc5[_0xec95('0x2e')]){delete _0x463cc5['name'];}_0x19895c[_0xec95('0x22')](_0x308dec)[_0xec95('0x2f')](_0x463cc5);};}exports['index']=function(_0xe574d,_0x4498b5){var _0x480f62={},_0x175518={},_0x12e35e={'count':0x0,'rows':[]};var _0xc9681b=db['ZohoAccount'][_0xec95('0x30')];_0x175518[_0xec95('0x31')]=_[_0xec95('0x32')](_0xc9681b);_0x175518[_0xec95('0x33')]=_[_0xec95('0x32')](_0xe574d['query']);_0x175518['filters']=_[_0xec95('0x34')](_0x175518[_0xec95('0x31')],_0x175518[_0xec95('0x33')]);_0x480f62[_0xec95('0x35')]=_[_0xec95('0x34')](_0x175518[_0xec95('0x31')],qs[_0xec95('0x36')](_0xe574d[_0xec95('0x33')]['fields']));_0x480f62[_0xec95('0x35')]=_0x480f62[_0xec95('0x35')][_0xec95('0x37')]?_0x480f62[_0xec95('0x35')]:_0x175518[_0xec95('0x31')];if(!_0xe574d[_0xec95('0x33')][_0xec95('0x38')]('nolimit')){_0x480f62[_0xec95('0x25')]=qs[_0xec95('0x25')](_0xe574d[_0xec95('0x33')][_0xec95('0x25')]);_0x480f62[_0xec95('0x39')]=qs[_0xec95('0x39')](_0xe574d['query'][_0xec95('0x39')]);}_0x480f62[_0xec95('0x3a')]=qs[_0xec95('0x3b')](_0xe574d['query']['sort']);_0x480f62[_0xec95('0x3c')]=qs['filters'](_[_0xec95('0x3d')](_0xe574d[_0xec95('0x33')],_0x175518['filters']));if(_0xe574d['query'][_0xec95('0x3e')]){_0x480f62[_0xec95('0x3c')]=_[_0xec95('0x3f')](_0x480f62['where'],{'$or':_[_0xec95('0x40')](_0xc9681b,function(_0x539c63){if(_0x539c63[_0xec95('0x41')][_0xec95('0x42')]!==_0xec95('0x43')){var _0x16a005={};_0x16a005[_0x539c63[_0xec95('0x44')]]={'$like':'%'+_0xe574d[_0xec95('0x33')][_0xec95('0x3e')]+'%'};return _0x16a005;}})});}_0x480f62=_['merge']({},_0x480f62,_0xe574d[_0xec95('0x45')]);var _0x224a75={'where':_0x480f62[_0xec95('0x3c')]};return db[_0xec95('0x46')][_0xec95('0x24')](_0x224a75)[_0xec95('0x2b')](function(_0x4ccffc){_0x12e35e[_0xec95('0x24')]=_0x4ccffc;if(_0xe574d['query']['includeAll']){_0x480f62[_0xec95('0x47')]=[{'all':!![]}];}return db['ZohoAccount'][_0xec95('0x48')](_0x480f62);})[_0xec95('0x2b')](function(_0x593c4a){_0x12e35e[_0xec95('0x49')]=_0x593c4a;return _0x12e35e;})['then'](respondWithFilteredResult(_0x4498b5,_0x480f62))[_0xec95('0x4a')](handleError(_0x4498b5,null));};exports[_0xec95('0x4b')]=function(_0xf3310f,_0x347eec){var _0x4a051d={'raw':![],'where':{'id':_0xf3310f['params']['id']}},_0xdb8840={};_0xdb8840['model']=_[_0xec95('0x32')](db[_0xec95('0x46')][_0xec95('0x30')]);_0xdb8840['query']=_['keys'](_0xf3310f[_0xec95('0x33')]);_0xdb8840['filters']=_[_0xec95('0x34')](_0xdb8840['model'],_0xdb8840[_0xec95('0x33')]);_0x4a051d[_0xec95('0x35')]=_[_0xec95('0x34')](_0xdb8840[_0xec95('0x31')],qs[_0xec95('0x36')](_0xf3310f[_0xec95('0x33')][_0xec95('0x36')]));_0x4a051d['attributes']=_0x4a051d[_0xec95('0x35')][_0xec95('0x37')]?_0x4a051d[_0xec95('0x35')]:_0xdb8840[_0xec95('0x31')];if(_0xf3310f[_0xec95('0x33')][_0xec95('0x4c')]){_0x4a051d[_0xec95('0x47')]=[{'all':!![]}];}_0x4a051d=_[_0xec95('0x3f')]({},_0x4a051d,_0xf3310f[_0xec95('0x45')]);return db[_0xec95('0x46')][_0xec95('0x4d')](_0x4a051d)[_0xec95('0x2b')](handleEntityNotFound(_0x347eec,null))['then'](respondWithResult(_0x347eec,null))[_0xec95('0x4a')](handleError(_0x347eec,null));};exports[_0xec95('0x4e')]=function(_0x1f0916,_0x4519a7){return db[_0xec95('0x46')][_0xec95('0x4e')](_0x1f0916['body'],{})[_0xec95('0x2b')](respondWithResult(_0x4519a7,0xc9))['catch'](handleError(_0x4519a7,null));};exports[_0xec95('0x4f')]=function(_0x2a4007,_0x5105d7){if(_0x2a4007[_0xec95('0x50')]['id']){delete _0x2a4007[_0xec95('0x50')]['id'];}return db[_0xec95('0x46')][_0xec95('0x4d')]({'where':{'id':_0x2a4007[_0xec95('0x51')]['id']}})['then'](handleEntityNotFound(_0x5105d7,null))[_0xec95('0x2b')](saveUpdates(_0x2a4007[_0xec95('0x50')],null))[_0xec95('0x2b')](respondWithResult(_0x5105d7,null))[_0xec95('0x4a')](handleError(_0x5105d7,null));};exports[_0xec95('0x52')]=function(_0x338b93,_0x2c5b4b){return db[_0xec95('0x46')][_0xec95('0x4d')]({'where':{'id':_0x338b93[_0xec95('0x51')]['id']}})['then'](handleEntityNotFound(_0x2c5b4b,null))[_0xec95('0x2b')](removeEntity(_0x2c5b4b,null))[_0xec95('0x4a')](handleError(_0x2c5b4b,null));};exports['getConfigurations']=function(_0x5590a3,_0x14e9d8,_0x5e137b){var _0x5ea086={};var _0x2a6ebd={};var _0x35b25d;var _0x3d4089;return db[_0xec95('0x46')]['findOne']({'where':{'id':_0x5590a3['params']['id']}})[_0xec95('0x2b')](handleEntityNotFound(_0x14e9d8,null))[_0xec95('0x2b')](function(_0x2e7f00){if(_0x2e7f00){_0x35b25d=_0x2e7f00;_0x2a6ebd[_0xec95('0x31')]=_[_0xec95('0x32')](db[_0xec95('0x53')][_0xec95('0x30')]);_0x2a6ebd[_0xec95('0x33')]=_[_0xec95('0x32')](_0x5590a3[_0xec95('0x33')]);_0x2a6ebd[_0xec95('0x54')]=_['intersection'](_0x2a6ebd['model'],_0x2a6ebd[_0xec95('0x33')]);_0x5ea086[_0xec95('0x35')]=_['intersection'](_0x2a6ebd['model'],qs['fields'](_0x5590a3[_0xec95('0x33')][_0xec95('0x36')]));_0x5ea086[_0xec95('0x35')]=_0x5ea086['attributes']['length']?_0x5ea086[_0xec95('0x35')]:_0x2a6ebd[_0xec95('0x31')];_0x5ea086[_0xec95('0x3a')]=qs[_0xec95('0x3b')](_0x5590a3[_0xec95('0x33')][_0xec95('0x3b')]);_0x5ea086[_0xec95('0x3c')]=qs[_0xec95('0x54')](_[_0xec95('0x3d')](_0x5590a3[_0xec95('0x33')],_0x2a6ebd[_0xec95('0x54')]));if(_0x5590a3[_0xec95('0x33')][_0xec95('0x3e')]){_0x5ea086[_0xec95('0x3c')]=_[_0xec95('0x3f')](_0x5ea086[_0xec95('0x3c')],{'$or':_[_0xec95('0x40')](_0x5ea086[_0xec95('0x35')],function(_0x20954b){var _0x25b44c={};_0x25b44c[_0x20954b]={'$like':'%'+_0x5590a3[_0xec95('0x33')]['filter']+'%'};return _0x25b44c;})});}_0x5ea086=_[_0xec95('0x3f')]({},_0x5ea086,_0x5590a3[_0xec95('0x45')]);return _0x35b25d['getConfigurations'](_0x5ea086);}})[_0xec95('0x2b')](function(_0x2995b3){if(_0x2995b3){_0x3d4089=_0x2995b3[_0xec95('0x37')];if(!_0x5590a3[_0xec95('0x33')][_0xec95('0x38')](_0xec95('0x55'))){_0x5ea086[_0xec95('0x25')]=qs['limit'](_0x5590a3[_0xec95('0x33')][_0xec95('0x25')]);_0x5ea086['offset']=qs['offset'](_0x5590a3['query']['offset']);}return _0x35b25d[_0xec95('0x56')](_0x5ea086);}})[_0xec95('0x2b')](function(_0x13dd9a){if(_0x13dd9a){return _0x13dd9a?{'count':_0x3d4089,'rows':_0x13dd9a}:null;}})['then'](respondWithResult(_0x14e9d8,null))['catch'](handleError(_0x14e9d8,null));};exports[_0xec95('0x57')]=function(_0x2ac1ec,_0x371373,_0x2eb060){if(_0x2ac1ec[_0xec95('0x50')]['id']){delete _0x2ac1ec[_0xec95('0x50')]['id'];}return db[_0xec95('0x46')]['findOne']({'where':{'id':_0x2ac1ec[_0xec95('0x51')]['id']}})[_0xec95('0x2b')](handleEntityNotFound(_0x371373,null))['then'](function(_0x63b4ee){if(_0x63b4ee){_0x2ac1ec[_0xec95('0x50')][_0xec95('0x58')]=_0x63b4ee['id'];_0x2ac1ec[_0xec95('0x50')][_0xec95('0x59')]=integrations['getSubjects'](_0x2ac1ec[_0xec95('0x50')]['channel'],_0x2ac1ec[_0xec95('0x50')][_0xec95('0x41')]);_0x2ac1ec[_0xec95('0x50')][_0xec95('0x5a')]=integrations[_0xec95('0x5b')](_0x2ac1ec[_0xec95('0x50')][_0xec95('0x5c')],_0x2ac1ec[_0xec95('0x50')]['type']);return db['ZohoConfiguration']['create'](_0x2ac1ec['body'],{'include':[{'model':db[_0xec95('0x5d')],'as':_0xec95('0x59')},{'model':db[_0xec95('0x5d')],'as':_0xec95('0x5a')}]});}return null;})['then'](respondWithResult(_0x371373,null))[_0xec95('0x4a')](handleError(_0x371373,null));};exports[_0xec95('0x5e')]=function(_0x4cea11,_0x17a620,_0x5d74fc){var _0x1f9697='';return db[_0xec95('0x46')][_0xec95('0x5f')]({'where':{'id':_0x4cea11[_0xec95('0x51')]['id']},'attributes':['id',_0xec95('0x60'),_0xec95('0x61')]})[_0xec95('0x2b')](handleEntityNotFound(_0x17a620,null))['then'](function(_0x596aeb){if(_0x596aeb){_0x1f9697=_0x596aeb['host'];var _0x1d2643=_0x1f9697[_0xec95('0x62')](-0x1);if(_0x1d2643==='/'){_0x1f9697=_0x1f9697[_0xec95('0x63')](0x0,_0x1f9697['lastIndexOf'](_0x1d2643));}return rp({'method':'GET','uri':util[_0xec95('0x64')]('https://crm.%s/crm/private/json/Calls/getFields',_0x1f9697),'qs':{'authtoken':_0x596aeb['authToken'],'scope':_0xec95('0x65')},'json':!![]});}})[_0xec95('0x2b')](function(_0x58bed6){if(_0x58bed6){if(_0x58bed6[_0xec95('0x66')]&&_0x58bed6[_0xec95('0x66')][_0xec95('0x1c')]){throw new Error(_0x58bed6[_0xec95('0x66')][_0xec95('0x1c')][_0xec95('0x1e')]);}var _0x56825e=[];if(_0x58bed6[_0xec95('0x67')]&&_0x58bed6[_0xec95('0x67')]['section']){if(_0x58bed6['Calls'][_0xec95('0x68')]['FL']){var _0x4fca94=[_0xec95('0x69')];for(var _0x1f5e6b=0x0,_0x39140f=_0x58bed6[_0xec95('0x67')][_0xec95('0x68')]['FL'][_0xec95('0x37')];_0x1f5e6b<_0x39140f;_0x1f5e6b++){if(_[_0xec95('0x6a')](_0x4fca94,_0x58bed6[_0xec95('0x67')][_0xec95('0x68')]['FL'][_0x1f5e6b]['dv'])){_0x56825e['push']({'id':_0x58bed6[_0xec95('0x67')][_0xec95('0x68')]['FL'][_0x1f5e6b]['dv'],'name':_0x58bed6[_0xec95('0x67')][_0xec95('0x68')]['FL'][_0x1f5e6b]['label'],'custom':_0x58bed6[_0xec95('0x67')]['section']['FL'][_0x1f5e6b][_0xec95('0x6b')]===_0xec95('0x6c')?!![]:![],'options':_0x58bed6[_0xec95('0x67')][_0xec95('0x68')]['FL'][_0x1f5e6b][_0xec95('0x41')]===_0xec95('0x6d')&&_0x58bed6[_0xec95('0x67')][_0xec95('0x68')]['FL'][_0x1f5e6b][_0xec95('0x6e')]?_[_0xec95('0x40')](_0x58bed6[_0xec95('0x67')][_0xec95('0x68')]['FL'][_0x1f5e6b][_0xec95('0x6e')],function(_0x1c9f03){return{'name':_0x1c9f03,'value':_0x1c9f03};}):[]});}}}}return{'count':_0x56825e[_0xec95('0x37')],'rows':_0x56825e};}})[_0xec95('0x2b')](respondWithResult(_0x17a620,null))[_0xec95('0x4a')](function(_0x1952b7){var _0x2897cc=_0x4cea11['query'][_0xec95('0x6f')]?0x1f4:_0x1952b7['statusCode']||0x1f4;logger[_0xec95('0x1c')](_0xec95('0x70'),_0xec95('0x5e'),_0x2897cc,JSON['stringify'](_0x1952b7));delete _0x1952b7[_0xec95('0x2e')];if(_0x2897cc===0x191){_0x2897cc=0x190;}_0x17a620['status'](_0x2897cc)['send'](_0x4cea11[_0xec95('0x33')][_0xec95('0x6f')]?{'message':_0xec95('0x71'),'statusCode':_0x1952b7[_0xec95('0x72')]}:_0x1952b7);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 5f6afea..835828c 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 _0x96f1=['ZohoAccount','int_zoho_accounts','../../config/logger','api','moment','request-promise','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x96f1,0x1c4));var _0x196f=function(_0x3184a0,_0x3de9bb){_0x3184a0=_0x3184a0-0x0;var _0x30f781=_0x96f1[_0x3184a0];return _0x30f781;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x196f('0x0'))(_0x196f('0x1'));var moment=require(_0x196f('0x2'));var BPromise=require('bluebird');var rp=require(_0x196f('0x3'));var attributes=require(_0x196f('0x4'));var integrations=require(_0x196f('0x5'));module[_0x196f('0x6')]=function(_0x4c871f,_0x325138){return _0x4c871f[_0x196f('0x7')](_0x196f('0x8'),attributes,{'tableName':_0x196f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4fb=['lodash','../../config/logger','api','moment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts'];(function(_0x1357ec,_0x5da608){var _0x5e17e3=function(_0x39beba){while(--_0x39beba){_0x1357ec['push'](_0x1357ec['shift']());}};_0x5e17e3(++_0x5da608);}(_0xc4fb,0x15e));var _0xbc4f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc4fb[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbc4f('0x0'));var util=require('util');var logger=require(_0xbc4f('0x1'))(_0xbc4f('0x2'));var moment=require(_0xbc4f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xbc4f('0x4'));var integrations=require(_0xbc4f('0x5'));module[_0xbc4f('0x6')]=function(_0x13f0ee,_0x11284a){return _0x13f0ee[_0xbc4f('0x7')](_0xbc4f('0x8'),attributes,{'tableName':_0xbc4f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 1c128df..aafee3f 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 _0xb995=['debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetZohoAccount','findAll','options','attributes','limit','include','map','model','stringify','ShowZohoAccount','ZohoAccount','find','where','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x37909b,_0xbd548c){var _0x1a949b=function(_0x1bceb8){while(--_0x1bceb8){_0x37909b['push'](_0x37909b['shift']());}};_0x1a949b(++_0xbd548c);}(_0xb995,0xe4));var _0x5b99=function(_0x313ae2,_0x593465){_0x313ae2=_0x313ae2-0x0;var _0x31c9f4=_0xb995[_0x313ae2];return _0x31c9f4;};'use strict';var _=require('lodash');var util=require(_0x5b99('0x0'));var moment=require(_0x5b99('0x1'));var BPromise=require(_0x5b99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b99('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5b99('0x4'));var config=require(_0x5b99('0x5'));var jayson=require(_0x5b99('0x6'));var client=jayson[_0x5b99('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x495115,_0x2bb9cf,_0x25ef62){return new BPromise(function(_0x430dad,_0x5f1ba6){return client['request'](_0x495115,_0x25ef62)[_0x5b99('0x8')](function(_0x51439f){logger[_0x5b99('0x9')](_0x5b99('0xa'),_0x2bb9cf,_0x5b99('0xb'));logger[_0x5b99('0xc')](_0x5b99('0xd'),_0x2bb9cf,_0x5b99('0xb'),JSON['stringify'](_0x51439f));if(_0x51439f['error']){if(_0x51439f[_0x5b99('0xe')]['code']===0x1f4){logger['error'](_0x5b99('0xa'),_0x2bb9cf,_0x51439f[_0x5b99('0xe')][_0x5b99('0xf')]);return _0x5f1ba6(_0x51439f[_0x5b99('0xe')][_0x5b99('0xf')]);}logger[_0x5b99('0xe')](_0x5b99('0xa'),_0x2bb9cf,_0x51439f[_0x5b99('0xe')][_0x5b99('0xf')]);return _0x430dad(_0x51439f[_0x5b99('0xe')]['message']);}else{logger[_0x5b99('0x9')]('ZohoAccount,\x20%s,\x20%s',_0x2bb9cf,_0x5b99('0xb'));_0x430dad(_0x51439f['result'][_0x5b99('0xf')]);}})[_0x5b99('0x10')](function(_0x16e128){logger['error'](_0x5b99('0xa'),_0x2bb9cf,_0x16e128);_0x5f1ba6(_0x16e128);});});}exports[_0x5b99('0x11')]=function(_0x4b29c9){var _0x47938f=this;return new Promise(function(_0x5c0c22,_0x476554){return db['ZohoAccount'][_0x5b99('0x12')]({'raw':_0x4b29c9[_0x5b99('0x13')]?_0x4b29c9[_0x5b99('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x4b29c9[_0x5b99('0x13')]?_0x4b29c9['options']['where']||null:null,'attributes':_0x4b29c9[_0x5b99('0x13')]?_0x4b29c9['options'][_0x5b99('0x14')]||null:null,'limit':_0x4b29c9[_0x5b99('0x13')]?_0x4b29c9['options'][_0x5b99('0x15')]||null:null,'include':_0x4b29c9[_0x5b99('0x13')]?_0x4b29c9['options'][_0x5b99('0x16')]?_[_0x5b99('0x17')](_0x4b29c9[_0x5b99('0x13')]['include'],function(_0x514a05){return{'model':db[_0x514a05[_0x5b99('0x18')]],'as':_0x514a05['as'],'attributes':_0x514a05[_0x5b99('0x14')],'include':_0x514a05[_0x5b99('0x16')]?_[_0x5b99('0x17')](_0x514a05['include'],function(_0xb5ce76){return{'model':db[_0xb5ce76[_0x5b99('0x18')]],'as':_0xb5ce76['as'],'attributes':_0xb5ce76['attributes'],'include':_0xb5ce76[_0x5b99('0x16')]?_['map'](_0xb5ce76[_0x5b99('0x16')],function(_0x1d783b){return{'model':db[_0x1d783b['model']],'as':_0x1d783b['as'],'attributes':_0x1d783b[_0x5b99('0x14')]};}):[]};}):[]};}):[]:[]})[_0x5b99('0x8')](function(_0x2e221b){logger[_0x5b99('0x9')](_0x5b99('0x11'),_0x4b29c9);logger[_0x5b99('0xc')]('GetZohoAccount',_0x4b29c9,JSON[_0x5b99('0x19')](_0x2e221b));_0x5c0c22(_0x2e221b);})[_0x5b99('0x10')](function(_0x1c198b){logger['error'](_0x5b99('0x11'),_0x1c198b[_0x5b99('0xf')],_0x4b29c9);_0x476554(_0x47938f[_0x5b99('0xe')](0x1f4,_0x1c198b[_0x5b99('0xf')]));});});};exports[_0x5b99('0x1a')]=function(_0x536451){var _0x5efc92=this;return new Promise(function(_0x42f3ff,_0x476802){return db[_0x5b99('0x1b')][_0x5b99('0x1c')]({'raw':_0x536451['options']?_0x536451['options']['raw']===undefined?!![]:![]:!![],'where':_0x536451[_0x5b99('0x13')]?_0x536451[_0x5b99('0x13')][_0x5b99('0x1d')]||null:null,'attributes':_0x536451['options']?_0x536451[_0x5b99('0x13')][_0x5b99('0x14')]||null:null,'include':_0x536451['options']?_0x536451['options'][_0x5b99('0x16')]?_[_0x5b99('0x17')](_0x536451['options'][_0x5b99('0x16')],function(_0x413c86){return{'model':db[_0x413c86[_0x5b99('0x18')]],'as':_0x413c86['as'],'attributes':_0x413c86[_0x5b99('0x14')],'include':_0x413c86[_0x5b99('0x16')]?_[_0x5b99('0x17')](_0x413c86[_0x5b99('0x16')],function(_0x114516){return{'model':db[_0x114516['model']],'as':_0x114516['as'],'attributes':_0x114516[_0x5b99('0x14')],'include':_0x114516['include']?_[_0x5b99('0x17')](_0x114516[_0x5b99('0x16')],function(_0x4bf0bc){return{'model':db[_0x4bf0bc[_0x5b99('0x18')]],'as':_0x4bf0bc['as'],'attributes':_0x4bf0bc['attributes']};}):[]};}):[]};}):[]:[]})[_0x5b99('0x8')](function(_0xbe0dbe){logger[_0x5b99('0x9')]('ShowZohoAccount',_0x536451);logger['debug']('ShowZohoAccount',_0x536451,JSON['stringify'](_0xbe0dbe));_0x42f3ff(_0xbe0dbe);})[_0x5b99('0x10')](function(_0x27be2c){logger[_0x5b99('0xe')](_0x5b99('0x1a'),_0x27be2c[_0x5b99('0xf')],_0x536451);_0x476802(_0x5efc92[_0x5b99('0xe')](0x1f4,_0x27be2c['message']));});});}; \ No newline at end of file +var _0x5a1b=['debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetZohoAccount','ZohoAccount','findAll','options','raw','limit','include','map','model','attributes','then','catch','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x322652,_0x5a85c0){var _0x5d5e88=function(_0x5ce853){while(--_0x5ce853){_0x322652['push'](_0x322652['shift']());}};_0x5d5e88(++_0x5a85c0);}(_0x5a1b,0xe6));var _0xb5a1=function(_0x4241e6,_0xce5237){_0x4241e6=_0x4241e6-0x0;var _0x1ff2cb=_0x5a1b[_0x4241e6];return _0x1ff2cb;};'use strict';var _=require(_0xb5a1('0x0'));var util=require(_0xb5a1('0x1'));var moment=require(_0xb5a1('0x2'));var BPromise=require(_0xb5a1('0x3'));var rs=require(_0xb5a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5a1('0x5'))['db'];var utils=require(_0xb5a1('0x6'));var logger=require(_0xb5a1('0x7'))('rpc');var config=require(_0xb5a1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb5a1('0x9')][_0xb5a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46833b,_0x51e738,_0x23e426){return new BPromise(function(_0x2c59a5,_0x1c64d0){return client[_0xb5a1('0xb')](_0x46833b,_0x23e426)['then'](function(_0xb680b7){logger[_0xb5a1('0xc')](_0xb5a1('0xd'),_0x51e738,_0xb5a1('0xe'));logger[_0xb5a1('0xf')](_0xb5a1('0x10'),_0x51e738,_0xb5a1('0xe'),JSON[_0xb5a1('0x11')](_0xb680b7));if(_0xb680b7[_0xb5a1('0x12')]){if(_0xb680b7[_0xb5a1('0x12')][_0xb5a1('0x13')]===0x1f4){logger[_0xb5a1('0x12')](_0xb5a1('0xd'),_0x51e738,_0xb680b7['error'][_0xb5a1('0x14')]);return _0x1c64d0(_0xb680b7['error'][_0xb5a1('0x14')]);}logger[_0xb5a1('0x12')](_0xb5a1('0xd'),_0x51e738,_0xb680b7[_0xb5a1('0x12')][_0xb5a1('0x14')]);return _0x2c59a5(_0xb680b7[_0xb5a1('0x12')][_0xb5a1('0x14')]);}else{logger[_0xb5a1('0xc')](_0xb5a1('0xd'),_0x51e738,'request\x20sent');_0x2c59a5(_0xb680b7['result'][_0xb5a1('0x14')]);}})['catch'](function(_0x5522e1){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x51e738,_0x5522e1);_0x1c64d0(_0x5522e1);});});}exports[_0xb5a1('0x15')]=function(_0x377251){var _0x3efdfc=this;return new Promise(function(_0x30adb7,_0x5525d5){return db[_0xb5a1('0x16')][_0xb5a1('0x17')]({'raw':_0x377251['options']?_0x377251[_0xb5a1('0x18')][_0xb5a1('0x19')]===undefined?!![]:![]:!![],'where':_0x377251[_0xb5a1('0x18')]?_0x377251[_0xb5a1('0x18')]['where']||null:null,'attributes':_0x377251['options']?_0x377251[_0xb5a1('0x18')]['attributes']||null:null,'limit':_0x377251[_0xb5a1('0x18')]?_0x377251[_0xb5a1('0x18')][_0xb5a1('0x1a')]||null:null,'include':_0x377251[_0xb5a1('0x18')]?_0x377251['options'][_0xb5a1('0x1b')]?_[_0xb5a1('0x1c')](_0x377251[_0xb5a1('0x18')][_0xb5a1('0x1b')],function(_0xa425f6){return{'model':db[_0xa425f6[_0xb5a1('0x1d')]],'as':_0xa425f6['as'],'attributes':_0xa425f6['attributes'],'include':_0xa425f6[_0xb5a1('0x1b')]?_[_0xb5a1('0x1c')](_0xa425f6[_0xb5a1('0x1b')],function(_0x32e439){return{'model':db[_0x32e439[_0xb5a1('0x1d')]],'as':_0x32e439['as'],'attributes':_0x32e439[_0xb5a1('0x1e')],'include':_0x32e439[_0xb5a1('0x1b')]?_['map'](_0x32e439[_0xb5a1('0x1b')],function(_0x540e79){return{'model':db[_0x540e79['model']],'as':_0x540e79['as'],'attributes':_0x540e79[_0xb5a1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5a1('0x1f')](function(_0x4d93aa){logger[_0xb5a1('0xc')](_0xb5a1('0x15'),_0x377251);logger[_0xb5a1('0xf')](_0xb5a1('0x15'),_0x377251,JSON[_0xb5a1('0x11')](_0x4d93aa));_0x30adb7(_0x4d93aa);})[_0xb5a1('0x20')](function(_0x1117d7){logger[_0xb5a1('0x12')](_0xb5a1('0x15'),_0x1117d7[_0xb5a1('0x14')],_0x377251);_0x5525d5(_0x3efdfc[_0xb5a1('0x12')](0x1f4,_0x1117d7[_0xb5a1('0x14')]));});});};exports[_0xb5a1('0x21')]=function(_0x317752){var _0x284340=this;return new Promise(function(_0x46273b,_0x4267ce){return db['ZohoAccount'][_0xb5a1('0x22')]({'raw':_0x317752[_0xb5a1('0x18')]?_0x317752[_0xb5a1('0x18')][_0xb5a1('0x19')]===undefined?!![]:![]:!![],'where':_0x317752[_0xb5a1('0x18')]?_0x317752['options']['where']||null:null,'attributes':_0x317752[_0xb5a1('0x18')]?_0x317752[_0xb5a1('0x18')][_0xb5a1('0x1e')]||null:null,'include':_0x317752[_0xb5a1('0x18')]?_0x317752['options'][_0xb5a1('0x1b')]?_[_0xb5a1('0x1c')](_0x317752[_0xb5a1('0x18')][_0xb5a1('0x1b')],function(_0x27e2c7){return{'model':db[_0x27e2c7[_0xb5a1('0x1d')]],'as':_0x27e2c7['as'],'attributes':_0x27e2c7['attributes'],'include':_0x27e2c7[_0xb5a1('0x1b')]?_[_0xb5a1('0x1c')](_0x27e2c7['include'],function(_0x3b3155){return{'model':db[_0x3b3155[_0xb5a1('0x1d')]],'as':_0x3b3155['as'],'attributes':_0x3b3155[_0xb5a1('0x1e')],'include':_0x3b3155[_0xb5a1('0x1b')]?_['map'](_0x3b3155[_0xb5a1('0x1b')],function(_0x557c4b){return{'model':db[_0x557c4b['model']],'as':_0x557c4b['as'],'attributes':_0x557c4b[_0xb5a1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5a1('0x1f')](function(_0x4f07f1){logger[_0xb5a1('0xc')](_0xb5a1('0x21'),_0x317752);logger[_0xb5a1('0xf')]('ShowZohoAccount',_0x317752,JSON[_0xb5a1('0x11')](_0x4f07f1));_0x46273b(_0x4f07f1);})[_0xb5a1('0x20')](function(_0x450833){logger[_0xb5a1('0x12')](_0xb5a1('0x21'),_0x450833[_0xb5a1('0x14')],_0x317752);_0x4267ce(_0x284340['error'](0x1f4,_0x450833[_0xb5a1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 78113d2..d979f0d 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 _0x7be1=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create'];(function(_0x4eff10,_0x15847f){var _0x29aa02=function(_0x1ba7c7){while(--_0x1ba7c7){_0x4eff10['push'](_0x4eff10['shift']());}};_0x29aa02(++_0x15847f);}(_0x7be1,0x98));var _0x17be=function(_0x1c1577,_0x1d4d6d){_0x1c1577=_0x1c1577-0x0;var _0x566d1f=_0x7be1[_0x1c1577];return _0x566d1f;};'use strict';var multer=require('multer');var util=require(_0x17be('0x0'));var path=require(_0x17be('0x1'));var timeout=require(_0x17be('0x2'));var express=require(_0x17be('0x3'));var router=express[_0x17be('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x17be('0x5'));var config=require('../../config/environment');var controller=require(_0x17be('0x6'));router[_0x17be('0x7')]('/',auth[_0x17be('0x8')](),controller[_0x17be('0x9')]);router['get'](_0x17be('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x17be('0x7')](_0x17be('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x17be('0x7')](_0x17be('0xc'),auth[_0x17be('0x8')](),controller[_0x17be('0xd')]);router[_0x17be('0x7')](_0x17be('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x17be('0x8')](),controller[_0x17be('0xf')]);router[_0x17be('0x10')]('/:id',auth[_0x17be('0x8')](),controller[_0x17be('0x11')]);router[_0x17be('0x12')](_0x17be('0xa'),auth[_0x17be('0x8')](),controller[_0x17be('0x13')]);module[_0x17be('0x14')]=router; \ No newline at end of file +var _0xa87e=['index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','create','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated'];(function(_0xe1bdfa,_0x5371ce){var _0x28daee=function(_0x3d0cbb){while(--_0x3d0cbb){_0xe1bdfa['push'](_0xe1bdfa['shift']());}};_0x28daee(++_0x5371ce);}(_0xa87e,0x185));var _0xea87=function(_0x396d74,_0x22736a){_0x396d74=_0x396d74-0x0;var _0x693fcc=_0xa87e[_0x396d74];return _0x693fcc;};'use strict';var multer=require(_0xea87('0x0'));var util=require(_0xea87('0x1'));var path=require(_0xea87('0x2'));var timeout=require('connect-timeout');var express=require(_0xea87('0x3'));var router=express[_0xea87('0x4')]();var auth=require(_0xea87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea87('0x6'));var controller=require(_0xea87('0x7'));router[_0xea87('0x8')]('/',auth[_0xea87('0x9')](),controller[_0xea87('0xa')]);router['get'](_0xea87('0xb'),auth[_0xea87('0x9')](),controller[_0xea87('0xc')]);router[_0xea87('0x8')]('/:id/fields',auth[_0xea87('0x9')](),controller[_0xea87('0xd')]);router['get'](_0xea87('0xe'),auth['isAuthenticated'](),controller[_0xea87('0xf')]);router[_0xea87('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xea87('0x10')]);router['post']('/',auth[_0xea87('0x9')](),controller[_0xea87('0x11')]);router['put'](_0xea87('0xb'),auth[_0xea87('0x9')](),controller[_0xea87('0x12')]);router['delete'](_0xea87('0xb'),auth[_0xea87('0x9')](),controller[_0xea87('0x13')]);module[_0xea87('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index f422821..5c64362 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 _0x04b0=['exports','STRING','sequelize'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x04b0,0x182));var _0x004b=function(_0x2de035,_0x3ab36e){_0x2de035=_0x2de035-0x0;var _0x3c8a25=_0x04b0[_0x2de035];return _0x3c8a25;};'use strict';var Sequelize=require(_0x004b('0x0'));module[_0x004b('0x1')]={'name':{'type':Sequelize[_0x004b('0x2')]},'description':{'type':Sequelize[_0x004b('0x2')]}}; \ No newline at end of file +var _0xc684=['exports','STRING'];(function(_0x4754e7,_0x241f5d){var _0x3b8578=function(_0x41b9de){while(--_0x41b9de){_0x4754e7['push'](_0x4754e7['shift']());}};_0x3b8578(++_0x241f5d);}(_0xc684,0x13a));var _0x4c68=function(_0x3dab4d,_0x145310){_0x3dab4d=_0x3dab4d-0x0;var _0x19155f=_0xc684[_0x3dab4d];return _0x19155f;};'use strict';var Sequelize=require('sequelize');module[_0x4c68('0x0')]={'name':{'type':Sequelize[_0x4c68('0x1')]},'description':{'type':Sequelize[_0x4c68('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 35bcaed..3270890 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 _0x5664=['name','send','index','ZohoConfiguration','rawAttributes','keys','query','filters','model','attributes','intersection','length','nolimit','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','field','includeAll','params','include','options','find','catch','create','body','update','getFields','findOne','ZohoField','fields','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','result','end','status','json','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x26b223,_0x5388f5){var _0x30c21f=function(_0x3974a5){while(--_0x3974a5){_0x26b223['push'](_0x26b223['shift']());}};_0x30c21f(++_0x5388f5);}(_0x5664,0x7d));var _0x4566=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0x5664[_0x5d9867];return _0x7d2118;};'use strict';var pdf=require(_0x4566('0x0'));var emlformat=require(_0x4566('0x1'));var rimraf=require(_0x4566('0x2'));var zipdir=require(_0x4566('0x3'));var jsonpatch=require(_0x4566('0x4'));var rp=require(_0x4566('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4566('0x6'));var util=require('util');var path=require(_0x4566('0x7'));var sox=require(_0x4566('0x8'));var csv=require(_0x4566('0x9'));var ejs=require(_0x4566('0xa'));var fs=require('fs');var _=require(_0x4566('0xb'));var squel=require('squel');var crypto=require(_0x4566('0xc'));var jsforce=require(_0x4566('0xd'));var deskjs=require(_0x4566('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4566('0xf'));var Papa=require('papaparse');var authService=require(_0x4566('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x4566('0x11'));var qs=require(_0x4566('0x12'));var logger=require(_0x4566('0x13'))(_0x4566('0x14'));var utils=require(_0x4566('0x15'));var config=require(_0x4566('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4566('0x17'));var client=jayson['client'][_0x4566('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x240dd8,_0x1aa38f,_0x207c17,_0x454013){return new BPromise(function(_0x31a1d9,_0x38ecf1){var _0xd6608e=_0x454013||client;return _0xd6608e[_0x4566('0x19')](_0x240dd8,_0x207c17)[_0x4566('0x1a')](function(_0x262328){logger[_0x4566('0x1b')]('ZohoConfiguration,\x20%s,\x20%s',_0x1aa38f,_0x4566('0x1c'));logger[_0x4566('0x1d')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1aa38f,_0x4566('0x1c'),JSON[_0x4566('0x1e')](_0x262328));if(_0x262328[_0x4566('0x1f')]){if(_0x262328['error']['code']===0x1f4){logger[_0x4566('0x1f')](_0x4566('0x20'),_0x1aa38f,_0x262328[_0x4566('0x1f')][_0x4566('0x21')]);return _0x38ecf1(_0x262328[_0x4566('0x1f')][_0x4566('0x21')]);}logger[_0x4566('0x1f')](_0x4566('0x20'),_0x1aa38f,_0x262328[_0x4566('0x1f')][_0x4566('0x21')]);return _0x31a1d9(_0x262328[_0x4566('0x1f')]['message']);}else{logger[_0x4566('0x1b')](_0x4566('0x20'),_0x1aa38f,_0x4566('0x1c'));_0x31a1d9(_0x262328[_0x4566('0x22')][_0x4566('0x21')]);}})['catch'](function(_0x1939cf){logger[_0x4566('0x1f')](_0x4566('0x20'),_0x1aa38f,_0x1939cf);_0x38ecf1(_0x1939cf);});});}function respondWithStatusCode(_0x90153,_0x594ec3){_0x594ec3=_0x594ec3||0xcc;return function(_0x23be74){if(_0x23be74){return _0x90153['sendStatus'](_0x594ec3);}return _0x90153['status'](_0x594ec3)[_0x4566('0x23')]();};}function respondWithResult(_0x58914b,_0x28bb64){_0x28bb64=_0x28bb64||0xc8;return function(_0x1f97fe){if(_0x1f97fe){return _0x58914b[_0x4566('0x24')](_0x28bb64)[_0x4566('0x25')](_0x1f97fe);}};}function respondWithFilteredResult(_0x2deb60,_0x547c66){return function(_0x471b86){if(_0x471b86){var _0x1b816d=_0x471b86[_0x4566('0x26')],_0x5e8ef0=_0x547c66['offset'],_0x31b1cf=_0x547c66[_0x4566('0x27')]+_0x547c66[_0x4566('0x28')],_0x565b5a;if(_0x31b1cf>=_0x1b816d){_0x31b1cf=_0x1b816d;_0x565b5a=0xc8;}else{_0x565b5a=0xce;}_0x2deb60[_0x4566('0x24')](_0x565b5a);return _0x2deb60['set'](_0x4566('0x29'),_0x5e8ef0+'-'+_0x31b1cf+'/'+_0x1b816d)[_0x4566('0x25')](_0x471b86);}return null;};}function patchUpdates(_0x55c26a){return function(_0x5868f5){try{jsonpatch[_0x4566('0x2a')](_0x5868f5,_0x55c26a,!![]);}catch(_0x55b862){return BPromise[_0x4566('0x2b')](_0x55b862);}return _0x5868f5[_0x4566('0x2c')]();};}function saveUpdates(_0x3c9b3c,_0x2f8147){return function(_0x29ea8e){if(_0x29ea8e){return _0x29ea8e['update'](_0x3c9b3c)['then'](function(_0x465975){return _0x465975;});}return null;};}function removeEntity(_0x295259,_0x28b646){return function(_0x4cedbd){if(_0x4cedbd){return _0x4cedbd['destroy']()['then'](function(){_0x295259[_0x4566('0x24')](0xcc)[_0x4566('0x23')]();});}};}function handleEntityNotFound(_0x6abf40,_0x1d0cdc){return function(_0x2ba4c9){if(!_0x2ba4c9){_0x6abf40['sendStatus'](0x194);}return _0x2ba4c9;};}function handleError(_0x1003d9,_0xdb4b88){_0xdb4b88=_0xdb4b88||0x1f4;return function(_0x1a1fa6){logger['error'](_0x1a1fa6['stack']);if(_0x1a1fa6[_0x4566('0x2d')]){delete _0x1a1fa6[_0x4566('0x2d')];}_0x1003d9['status'](_0xdb4b88)[_0x4566('0x2e')](_0x1a1fa6);};}exports[_0x4566('0x2f')]=function(_0x10a217,_0x4118af){var _0x311223={},_0x3aa453={},_0x3b971f={'count':0x0,'rows':[]};var _0xc13825=db[_0x4566('0x30')][_0x4566('0x31')];_0x3aa453['model']=_[_0x4566('0x32')](_0xc13825);_0x3aa453[_0x4566('0x33')]=_[_0x4566('0x32')](_0x10a217[_0x4566('0x33')]);_0x3aa453[_0x4566('0x34')]=_['intersection'](_0x3aa453[_0x4566('0x35')],_0x3aa453['query']);_0x311223[_0x4566('0x36')]=_[_0x4566('0x37')](_0x3aa453['model'],qs['fields'](_0x10a217['query']['fields']));_0x311223[_0x4566('0x36')]=_0x311223['attributes'][_0x4566('0x38')]?_0x311223[_0x4566('0x36')]:_0x3aa453[_0x4566('0x35')];if(!_0x10a217[_0x4566('0x33')]['hasOwnProperty'](_0x4566('0x39'))){_0x311223[_0x4566('0x28')]=qs[_0x4566('0x28')](_0x10a217[_0x4566('0x33')][_0x4566('0x28')]);_0x311223['offset']=qs[_0x4566('0x27')](_0x10a217[_0x4566('0x33')][_0x4566('0x27')]);}_0x311223[_0x4566('0x3a')]=qs[_0x4566('0x3b')](_0x10a217[_0x4566('0x33')][_0x4566('0x3b')]);_0x311223['where']=qs[_0x4566('0x34')](_[_0x4566('0x3c')](_0x10a217[_0x4566('0x33')],_0x3aa453[_0x4566('0x34')]));if(_0x10a217[_0x4566('0x33')][_0x4566('0x3d')]){_0x311223[_0x4566('0x3e')]=_[_0x4566('0x3f')](_0x311223[_0x4566('0x3e')],{'$or':_[_0x4566('0x40')](_0xc13825,function(_0x29436d){if(_0x29436d[_0x4566('0x41')][_0x4566('0x42')]!==_0x4566('0x43')){var _0x578b2e={};_0x578b2e[_0x29436d[_0x4566('0x44')]]={'$like':'%'+_0x10a217[_0x4566('0x33')][_0x4566('0x3d')]+'%'};return _0x578b2e;}})});}_0x311223=_[_0x4566('0x3f')]({},_0x311223,_0x10a217['options']);var _0x41edc3={'where':_0x311223[_0x4566('0x3e')]};return db[_0x4566('0x30')]['count'](_0x41edc3)[_0x4566('0x1a')](function(_0x7a90a4){_0x3b971f['count']=_0x7a90a4;if(_0x10a217[_0x4566('0x33')][_0x4566('0x45')]){_0x311223['include']=[{'all':!![]}];}return db[_0x4566('0x30')]['findAll'](_0x311223);})[_0x4566('0x1a')](function(_0x5e475f){_0x3b971f['rows']=_0x5e475f;return _0x3b971f;})[_0x4566('0x1a')](respondWithFilteredResult(_0x4118af,_0x311223))['catch'](handleError(_0x4118af,null));};exports['show']=function(_0x5748d8,_0x26aa21){var _0x326157={'raw':![],'where':{'id':_0x5748d8[_0x4566('0x46')]['id']}},_0x530caf={};_0x530caf['model']=_[_0x4566('0x32')](db['ZohoConfiguration'][_0x4566('0x31')]);_0x530caf[_0x4566('0x33')]=_[_0x4566('0x32')](_0x5748d8[_0x4566('0x33')]);_0x530caf[_0x4566('0x34')]=_[_0x4566('0x37')](_0x530caf[_0x4566('0x35')],_0x530caf[_0x4566('0x33')]);_0x326157[_0x4566('0x36')]=_['intersection'](_0x530caf[_0x4566('0x35')],qs['fields'](_0x5748d8[_0x4566('0x33')]['fields']));_0x326157['attributes']=_0x326157[_0x4566('0x36')]['length']?_0x326157['attributes']:_0x530caf['model'];if(_0x5748d8[_0x4566('0x33')][_0x4566('0x45')]){_0x326157[_0x4566('0x47')]=[{'all':!![]}];}_0x326157=_[_0x4566('0x3f')]({},_0x326157,_0x5748d8[_0x4566('0x48')]);return db[_0x4566('0x30')][_0x4566('0x49')](_0x326157)['then'](handleEntityNotFound(_0x26aa21,null))[_0x4566('0x1a')](respondWithResult(_0x26aa21,null))[_0x4566('0x4a')](handleError(_0x26aa21,null));};exports[_0x4566('0x4b')]=function(_0x2c808d,_0x34244e){return db[_0x4566('0x30')][_0x4566('0x4b')](_0x2c808d[_0x4566('0x4c')],{})[_0x4566('0x1a')](respondWithResult(_0x34244e,0xc9))[_0x4566('0x4a')](handleError(_0x34244e,null));};exports[_0x4566('0x4d')]=function(_0x2eda18,_0x3156ef){if(_0x2eda18[_0x4566('0x4c')]['id']){delete _0x2eda18[_0x4566('0x4c')]['id'];}return db[_0x4566('0x30')][_0x4566('0x49')]({'where':{'id':_0x2eda18[_0x4566('0x46')]['id']}})[_0x4566('0x1a')](handleEntityNotFound(_0x3156ef,null))[_0x4566('0x1a')](saveUpdates(_0x2eda18[_0x4566('0x4c')],null))[_0x4566('0x1a')](respondWithResult(_0x3156ef,null))[_0x4566('0x4a')](handleError(_0x3156ef,null));};exports['destroy']=function(_0x3b084b,_0x322910){return db[_0x4566('0x30')][_0x4566('0x49')]({'where':{'id':_0x3b084b['params']['id']}})[_0x4566('0x1a')](handleEntityNotFound(_0x322910,null))[_0x4566('0x1a')](removeEntity(_0x322910,null))[_0x4566('0x4a')](handleError(_0x322910,null));};exports[_0x4566('0x4e')]=function(_0x1e49b0,_0x35b31b,_0xfb0a95){var _0x3f1a99={};var _0x491654={};var _0x40782a;var _0x4c79c2;return db[_0x4566('0x30')][_0x4566('0x4f')]({'where':{'id':_0x1e49b0['params']['id']}})[_0x4566('0x1a')](handleEntityNotFound(_0x35b31b,null))[_0x4566('0x1a')](function(_0x3eb1bc){if(_0x3eb1bc){_0x40782a=_0x3eb1bc;_0x491654[_0x4566('0x35')]=_['keys'](db[_0x4566('0x50')][_0x4566('0x31')]);_0x491654[_0x4566('0x33')]=_['keys'](_0x1e49b0['query']);_0x491654[_0x4566('0x34')]=_[_0x4566('0x37')](_0x491654[_0x4566('0x35')],_0x491654[_0x4566('0x33')]);_0x3f1a99[_0x4566('0x36')]=_[_0x4566('0x37')](_0x491654[_0x4566('0x35')],qs[_0x4566('0x51')](_0x1e49b0[_0x4566('0x33')][_0x4566('0x51')]));_0x3f1a99[_0x4566('0x36')]=_0x3f1a99[_0x4566('0x36')][_0x4566('0x38')]?_0x3f1a99[_0x4566('0x36')]:_0x491654[_0x4566('0x35')];_0x3f1a99['order']=qs[_0x4566('0x3b')](_0x1e49b0[_0x4566('0x33')][_0x4566('0x3b')]);_0x3f1a99[_0x4566('0x3e')]=qs[_0x4566('0x34')](_[_0x4566('0x3c')](_0x1e49b0[_0x4566('0x33')],_0x491654[_0x4566('0x34')]));if(_0x1e49b0[_0x4566('0x33')][_0x4566('0x3d')]){_0x3f1a99[_0x4566('0x3e')]=_[_0x4566('0x3f')](_0x3f1a99['where'],{'$or':_[_0x4566('0x40')](_0x3f1a99[_0x4566('0x36')],function(_0x2623ae){var _0x3dcdbc={};_0x3dcdbc[_0x2623ae]={'$like':'%'+_0x1e49b0[_0x4566('0x33')]['filter']+'%'};return _0x3dcdbc;})});}_0x3f1a99=_[_0x4566('0x3f')]({},_0x3f1a99,_0x1e49b0[_0x4566('0x48')]);return _0x40782a['getFields'](_0x3f1a99);}})[_0x4566('0x1a')](function(_0x4907d2){if(_0x4907d2){_0x4c79c2=_0x4907d2[_0x4566('0x38')];if(!_0x1e49b0[_0x4566('0x33')][_0x4566('0x52')](_0x4566('0x39'))){_0x3f1a99[_0x4566('0x28')]=qs[_0x4566('0x28')](_0x1e49b0[_0x4566('0x33')][_0x4566('0x28')]);_0x3f1a99[_0x4566('0x27')]=qs[_0x4566('0x27')](_0x1e49b0['query'][_0x4566('0x27')]);}return _0x40782a[_0x4566('0x4e')](_0x3f1a99);}})[_0x4566('0x1a')](function(_0x376267){if(_0x376267){return _0x376267?{'count':_0x4c79c2,'rows':_0x376267}:null;}})[_0x4566('0x1a')](respondWithResult(_0x35b31b,null))[_0x4566('0x4a')](handleError(_0x35b31b,null));};exports['getSubjects']=function(_0x445ccf,_0x617382,_0x4e9355){var _0x2d313d={};var _0x446988={};var _0x1562ef;var _0x588fd8;return db[_0x4566('0x30')]['findOne']({'where':{'id':_0x445ccf[_0x4566('0x46')]['id']}})[_0x4566('0x1a')](handleEntityNotFound(_0x617382,null))[_0x4566('0x1a')](function(_0x397748){if(_0x397748){_0x1562ef=_0x397748;_0x446988[_0x4566('0x35')]=_[_0x4566('0x32')](db[_0x4566('0x50')][_0x4566('0x31')]);_0x446988[_0x4566('0x33')]=_['keys'](_0x445ccf['query']);_0x446988[_0x4566('0x34')]=_['intersection'](_0x446988[_0x4566('0x35')],_0x446988[_0x4566('0x33')]);_0x2d313d['attributes']=_[_0x4566('0x37')](_0x446988[_0x4566('0x35')],qs[_0x4566('0x51')](_0x445ccf['query'][_0x4566('0x51')]));_0x2d313d['attributes']=_0x2d313d['attributes'][_0x4566('0x38')]?_0x2d313d[_0x4566('0x36')]:_0x446988['model'];_0x2d313d[_0x4566('0x3a')]=qs[_0x4566('0x3b')](_0x445ccf[_0x4566('0x33')]['sort']);_0x2d313d['where']=qs[_0x4566('0x34')](_[_0x4566('0x3c')](_0x445ccf[_0x4566('0x33')],_0x446988[_0x4566('0x34')]));if(_0x445ccf[_0x4566('0x33')][_0x4566('0x3d')]){_0x2d313d[_0x4566('0x3e')]=_['merge'](_0x2d313d['where'],{'$or':_[_0x4566('0x40')](_0x2d313d[_0x4566('0x36')],function(_0x312d9c){var _0x1a3f3f={};_0x1a3f3f[_0x312d9c]={'$like':'%'+_0x445ccf[_0x4566('0x33')][_0x4566('0x3d')]+'%'};return _0x1a3f3f;})});}_0x2d313d=_[_0x4566('0x3f')]({},_0x2d313d,_0x445ccf['options']);return _0x1562ef[_0x4566('0x53')](_0x2d313d);}})[_0x4566('0x1a')](function(_0x18fc08){if(_0x18fc08){_0x588fd8=_0x18fc08[_0x4566('0x38')];if(!_0x445ccf[_0x4566('0x33')][_0x4566('0x52')]('nolimit')){_0x2d313d['limit']=qs[_0x4566('0x28')](_0x445ccf[_0x4566('0x33')][_0x4566('0x28')]);_0x2d313d[_0x4566('0x27')]=qs[_0x4566('0x27')](_0x445ccf[_0x4566('0x33')]['offset']);}return _0x1562ef[_0x4566('0x53')](_0x2d313d);}})['then'](function(_0x27d8f2){if(_0x27d8f2){return _0x27d8f2?{'count':_0x588fd8,'rows':_0x27d8f2}:null;}})[_0x4566('0x1a')](respondWithResult(_0x617382,null))[_0x4566('0x4a')](handleError(_0x617382,null));};exports[_0x4566('0x54')]=function(_0x2c739d,_0x4e97f5,_0x55e3b7){var _0x4388cc={};var _0x45b754={};var _0x36e485;var _0x2ac30d;return db[_0x4566('0x30')][_0x4566('0x4f')]({'where':{'id':_0x2c739d[_0x4566('0x46')]['id']}})[_0x4566('0x1a')](handleEntityNotFound(_0x4e97f5,null))[_0x4566('0x1a')](function(_0x2c7c48){if(_0x2c7c48){_0x36e485=_0x2c7c48;_0x45b754[_0x4566('0x35')]=_[_0x4566('0x32')](db[_0x4566('0x50')]['rawAttributes']);_0x45b754[_0x4566('0x33')]=_[_0x4566('0x32')](_0x2c739d[_0x4566('0x33')]);_0x45b754[_0x4566('0x34')]=_['intersection'](_0x45b754[_0x4566('0x35')],_0x45b754[_0x4566('0x33')]);_0x4388cc[_0x4566('0x36')]=_[_0x4566('0x37')](_0x45b754[_0x4566('0x35')],qs['fields'](_0x2c739d['query'][_0x4566('0x51')]));_0x4388cc['attributes']=_0x4388cc[_0x4566('0x36')][_0x4566('0x38')]?_0x4388cc[_0x4566('0x36')]:_0x45b754[_0x4566('0x35')];_0x4388cc[_0x4566('0x3a')]=qs[_0x4566('0x3b')](_0x2c739d[_0x4566('0x33')][_0x4566('0x3b')]);_0x4388cc['where']=qs[_0x4566('0x34')](_[_0x4566('0x3c')](_0x2c739d['query'],_0x45b754['filters']));if(_0x2c739d[_0x4566('0x33')][_0x4566('0x3d')]){_0x4388cc[_0x4566('0x3e')]=_[_0x4566('0x3f')](_0x4388cc['where'],{'$or':_[_0x4566('0x40')](_0x4388cc[_0x4566('0x36')],function(_0x1bb6c8){var _0x32aa05={};_0x32aa05[_0x1bb6c8]={'$like':'%'+_0x2c739d['query'][_0x4566('0x3d')]+'%'};return _0x32aa05;})});}_0x4388cc=_[_0x4566('0x3f')]({},_0x4388cc,_0x2c739d[_0x4566('0x48')]);return _0x36e485[_0x4566('0x54')](_0x4388cc);}})[_0x4566('0x1a')](function(_0x13449a){if(_0x13449a){_0x2ac30d=_0x13449a['length'];if(!_0x2c739d[_0x4566('0x33')][_0x4566('0x52')](_0x4566('0x39'))){_0x4388cc['limit']=qs['limit'](_0x2c739d[_0x4566('0x33')]['limit']);_0x4388cc[_0x4566('0x27')]=qs[_0x4566('0x27')](_0x2c739d[_0x4566('0x33')][_0x4566('0x27')]);}return _0x36e485['getDescriptions'](_0x4388cc);}})['then'](function(_0x2612e5){if(_0x2612e5){return _0x2612e5?{'count':_0x2ac30d,'rows':_0x2612e5}:null;}})[_0x4566('0x1a')](respondWithResult(_0x4e97f5,null))[_0x4566('0x4a')](handleError(_0x4e97f5,null));}; \ No newline at end of file +var _0x4158=['jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../mysqldb','jayson/promise','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','stack','name','send','ZohoConfiguration','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','map','type','key','VIRTUAL','merge','options','includeAll','include','findAll','params','create','body','find','destroy','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x8e7f52,_0x59b28d){var _0x5d31dd=function(_0x2c469a){while(--_0x2c469a){_0x8e7f52['push'](_0x8e7f52['shift']());}};_0x5d31dd(++_0x59b28d);}(_0x4158,0xf2));var _0x8415=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4158[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8415('0x0'));var rimraf=require(_0x8415('0x1'));var zipdir=require(_0x8415('0x2'));var jsonpatch=require(_0x8415('0x3'));var rp=require(_0x8415('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8415('0x5'));var path=require(_0x8415('0x6'));var sox=require(_0x8415('0x7'));var csv=require(_0x8415('0x8'));var ejs=require(_0x8415('0x9'));var fs=require('fs');var _=require(_0x8415('0xa'));var squel=require(_0x8415('0xb'));var crypto=require(_0x8415('0xc'));var jsforce=require(_0x8415('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8415('0xe'));var Papa=require(_0x8415('0xf'));var authService=require(_0x8415('0x10'));var hardwareService=require(_0x8415('0x11'));var Redis=require(_0x8415('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x8415('0x13'))(_0x8415('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8415('0x15'))['db'];var jayson=require(_0x8415('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b0fc0,_0x35d190,_0x100d5a,_0x351344){return new BPromise(function(_0x3bfac7,_0x5f3c01){var _0x17a15c=_0x351344||client;return _0x17a15c['request'](_0x2b0fc0,_0x100d5a)[_0x8415('0x17')](function(_0x51442e){logger[_0x8415('0x18')](_0x8415('0x19'),_0x35d190,_0x8415('0x1a'));logger[_0x8415('0x1b')](_0x8415('0x1c'),_0x35d190,_0x8415('0x1a'),JSON[_0x8415('0x1d')](_0x51442e));if(_0x51442e['error']){if(_0x51442e[_0x8415('0x1e')][_0x8415('0x1f')]===0x1f4){logger[_0x8415('0x1e')](_0x8415('0x19'),_0x35d190,_0x51442e['error'][_0x8415('0x20')]);return _0x5f3c01(_0x51442e[_0x8415('0x1e')][_0x8415('0x20')]);}logger[_0x8415('0x1e')](_0x8415('0x19'),_0x35d190,_0x51442e[_0x8415('0x1e')][_0x8415('0x20')]);return _0x3bfac7(_0x51442e['error']['message']);}else{logger['info'](_0x8415('0x19'),_0x35d190,'request\x20sent');_0x3bfac7(_0x51442e[_0x8415('0x21')][_0x8415('0x20')]);}})[_0x8415('0x22')](function(_0x114f38){logger[_0x8415('0x1e')](_0x8415('0x19'),_0x35d190,_0x114f38);_0x5f3c01(_0x114f38);});});}function respondWithStatusCode(_0x2b9b66,_0x46c67d){_0x46c67d=_0x46c67d||0xcc;return function(_0x14da8b){if(_0x14da8b){return _0x2b9b66[_0x8415('0x23')](_0x46c67d);}return _0x2b9b66[_0x8415('0x24')](_0x46c67d)[_0x8415('0x25')]();};}function respondWithResult(_0x599fc3,_0x1d16aa){_0x1d16aa=_0x1d16aa||0xc8;return function(_0x2c8d21){if(_0x2c8d21){return _0x599fc3[_0x8415('0x24')](_0x1d16aa)[_0x8415('0x26')](_0x2c8d21);}};}function respondWithFilteredResult(_0x36eb02,_0x996cb6){return function(_0x2cf8cb){if(_0x2cf8cb){var _0x37256f=_0x2cf8cb[_0x8415('0x27')],_0x13800c=_0x996cb6['offset'],_0x23e59c=_0x996cb6['offset']+_0x996cb6[_0x8415('0x28')],_0x3d3b7d;if(_0x23e59c>=_0x37256f){_0x23e59c=_0x37256f;_0x3d3b7d=0xc8;}else{_0x3d3b7d=0xce;}_0x36eb02[_0x8415('0x24')](_0x3d3b7d);return _0x36eb02['set'](_0x8415('0x29'),_0x13800c+'-'+_0x23e59c+'/'+_0x37256f)[_0x8415('0x26')](_0x2cf8cb);}return null;};}function patchUpdates(_0x371f4e){return function(_0x39e8f6){try{jsonpatch[_0x8415('0x2a')](_0x39e8f6,_0x371f4e,!![]);}catch(_0x5aa700){return BPromise[_0x8415('0x2b')](_0x5aa700);}return _0x39e8f6[_0x8415('0x2c')]();};}function saveUpdates(_0x1488bb,_0x326863){return function(_0x4ceb99){if(_0x4ceb99){return _0x4ceb99[_0x8415('0x2d')](_0x1488bb)[_0x8415('0x17')](function(_0x1f1670){return _0x1f1670;});}return null;};}function removeEntity(_0xc3d098,_0xd53039){return function(_0x20d91e){if(_0x20d91e){return _0x20d91e['destroy']()[_0x8415('0x17')](function(){_0xc3d098[_0x8415('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57744e,_0x15ebe6){return function(_0x2edf85){if(!_0x2edf85){_0x57744e[_0x8415('0x23')](0x194);}return _0x2edf85;};}function handleError(_0x2bedf8,_0x5674a9){_0x5674a9=_0x5674a9||0x1f4;return function(_0x2ced30){logger['error'](_0x2ced30[_0x8415('0x2e')]);if(_0x2ced30['name']){delete _0x2ced30[_0x8415('0x2f')];}_0x2bedf8['status'](_0x5674a9)[_0x8415('0x30')](_0x2ced30);};}exports['index']=function(_0x51daa3,_0xf20070){var _0x3bf659={},_0x449380={},_0x3a6df7={'count':0x0,'rows':[]};var _0x16c8ea=db[_0x8415('0x31')][_0x8415('0x32')];_0x449380['model']=_[_0x8415('0x33')](_0x16c8ea);_0x449380[_0x8415('0x34')]=_[_0x8415('0x33')](_0x51daa3[_0x8415('0x34')]);_0x449380[_0x8415('0x35')]=_[_0x8415('0x36')](_0x449380[_0x8415('0x37')],_0x449380['query']);_0x3bf659[_0x8415('0x38')]=_[_0x8415('0x36')](_0x449380['model'],qs[_0x8415('0x39')](_0x51daa3['query'][_0x8415('0x39')]));_0x3bf659['attributes']=_0x3bf659[_0x8415('0x38')][_0x8415('0x3a')]?_0x3bf659['attributes']:_0x449380[_0x8415('0x37')];if(!_0x51daa3[_0x8415('0x34')][_0x8415('0x3b')](_0x8415('0x3c'))){_0x3bf659[_0x8415('0x28')]=qs[_0x8415('0x28')](_0x51daa3[_0x8415('0x34')]['limit']);_0x3bf659['offset']=qs[_0x8415('0x3d')](_0x51daa3['query'][_0x8415('0x3d')]);}_0x3bf659[_0x8415('0x3e')]=qs[_0x8415('0x3f')](_0x51daa3['query'][_0x8415('0x3f')]);_0x3bf659[_0x8415('0x40')]=qs[_0x8415('0x35')](_[_0x8415('0x41')](_0x51daa3['query'],_0x449380[_0x8415('0x35')]));if(_0x51daa3[_0x8415('0x34')][_0x8415('0x42')]){_0x3bf659['where']=_['merge'](_0x3bf659['where'],{'$or':_[_0x8415('0x43')](_0x16c8ea,function(_0x246097){if(_0x246097[_0x8415('0x44')][_0x8415('0x45')]!==_0x8415('0x46')){var _0x4278bf={};_0x4278bf[_0x246097['field']]={'$like':'%'+_0x51daa3['query'][_0x8415('0x42')]+'%'};return _0x4278bf;}})});}_0x3bf659=_[_0x8415('0x47')]({},_0x3bf659,_0x51daa3[_0x8415('0x48')]);var _0x478dac={'where':_0x3bf659[_0x8415('0x40')]};return db[_0x8415('0x31')][_0x8415('0x27')](_0x478dac)[_0x8415('0x17')](function(_0x333def){_0x3a6df7[_0x8415('0x27')]=_0x333def;if(_0x51daa3[_0x8415('0x34')][_0x8415('0x49')]){_0x3bf659[_0x8415('0x4a')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x8415('0x4b')](_0x3bf659);})[_0x8415('0x17')](function(_0x2a672c){_0x3a6df7['rows']=_0x2a672c;return _0x3a6df7;})['then'](respondWithFilteredResult(_0xf20070,_0x3bf659))[_0x8415('0x22')](handleError(_0xf20070,null));};exports['show']=function(_0x13104a,_0x49e27c){var _0x5e1208={'raw':![],'where':{'id':_0x13104a[_0x8415('0x4c')]['id']}},_0x2e9fd1={};_0x2e9fd1[_0x8415('0x37')]=_[_0x8415('0x33')](db[_0x8415('0x31')][_0x8415('0x32')]);_0x2e9fd1[_0x8415('0x34')]=_['keys'](_0x13104a[_0x8415('0x34')]);_0x2e9fd1[_0x8415('0x35')]=_[_0x8415('0x36')](_0x2e9fd1[_0x8415('0x37')],_0x2e9fd1[_0x8415('0x34')]);_0x5e1208[_0x8415('0x38')]=_[_0x8415('0x36')](_0x2e9fd1[_0x8415('0x37')],qs[_0x8415('0x39')](_0x13104a['query']['fields']));_0x5e1208['attributes']=_0x5e1208[_0x8415('0x38')]['length']?_0x5e1208['attributes']:_0x2e9fd1[_0x8415('0x37')];if(_0x13104a['query'][_0x8415('0x49')]){_0x5e1208['include']=[{'all':!![]}];}_0x5e1208=_['merge']({},_0x5e1208,_0x13104a[_0x8415('0x48')]);return db[_0x8415('0x31')]['find'](_0x5e1208)[_0x8415('0x17')](handleEntityNotFound(_0x49e27c,null))[_0x8415('0x17')](respondWithResult(_0x49e27c,null))[_0x8415('0x22')](handleError(_0x49e27c,null));};exports[_0x8415('0x4d')]=function(_0x32fe8f,_0x1339bd){return db['ZohoConfiguration'][_0x8415('0x4d')](_0x32fe8f['body'],{})[_0x8415('0x17')](respondWithResult(_0x1339bd,0xc9))[_0x8415('0x22')](handleError(_0x1339bd,null));};exports[_0x8415('0x2d')]=function(_0x11539a,_0x39442a){if(_0x11539a[_0x8415('0x4e')]['id']){delete _0x11539a['body']['id'];}return db['ZohoConfiguration'][_0x8415('0x4f')]({'where':{'id':_0x11539a['params']['id']}})['then'](handleEntityNotFound(_0x39442a,null))[_0x8415('0x17')](saveUpdates(_0x11539a[_0x8415('0x4e')],null))[_0x8415('0x17')](respondWithResult(_0x39442a,null))['catch'](handleError(_0x39442a,null));};exports[_0x8415('0x50')]=function(_0x3ae4ad,_0x15ab64){return db[_0x8415('0x31')][_0x8415('0x4f')]({'where':{'id':_0x3ae4ad['params']['id']}})[_0x8415('0x17')](handleEntityNotFound(_0x15ab64,null))[_0x8415('0x17')](removeEntity(_0x15ab64,null))[_0x8415('0x22')](handleError(_0x15ab64,null));};exports[_0x8415('0x51')]=function(_0x1421dd,_0x11d297,_0x3c64de){var _0xc07f37={};var _0x479ddf={};var _0x1f0a82;var _0x2868a0;return db[_0x8415('0x31')]['findOne']({'where':{'id':_0x1421dd[_0x8415('0x4c')]['id']}})[_0x8415('0x17')](handleEntityNotFound(_0x11d297,null))['then'](function(_0x21f136){if(_0x21f136){_0x1f0a82=_0x21f136;_0x479ddf[_0x8415('0x37')]=_[_0x8415('0x33')](db['ZohoField'][_0x8415('0x32')]);_0x479ddf[_0x8415('0x34')]=_[_0x8415('0x33')](_0x1421dd['query']);_0x479ddf['filters']=_[_0x8415('0x36')](_0x479ddf[_0x8415('0x37')],_0x479ddf[_0x8415('0x34')]);_0xc07f37[_0x8415('0x38')]=_[_0x8415('0x36')](_0x479ddf[_0x8415('0x37')],qs['fields'](_0x1421dd[_0x8415('0x34')]['fields']));_0xc07f37[_0x8415('0x38')]=_0xc07f37['attributes'][_0x8415('0x3a')]?_0xc07f37[_0x8415('0x38')]:_0x479ddf[_0x8415('0x37')];_0xc07f37[_0x8415('0x3e')]=qs[_0x8415('0x3f')](_0x1421dd[_0x8415('0x34')]['sort']);_0xc07f37[_0x8415('0x40')]=qs[_0x8415('0x35')](_[_0x8415('0x41')](_0x1421dd[_0x8415('0x34')],_0x479ddf['filters']));if(_0x1421dd[_0x8415('0x34')][_0x8415('0x42')]){_0xc07f37[_0x8415('0x40')]=_[_0x8415('0x47')](_0xc07f37[_0x8415('0x40')],{'$or':_[_0x8415('0x43')](_0xc07f37[_0x8415('0x38')],function(_0x1526de){var _0x2d5f11={};_0x2d5f11[_0x1526de]={'$like':'%'+_0x1421dd[_0x8415('0x34')][_0x8415('0x42')]+'%'};return _0x2d5f11;})});}_0xc07f37=_['merge']({},_0xc07f37,_0x1421dd[_0x8415('0x48')]);return _0x1f0a82['getFields'](_0xc07f37);}})[_0x8415('0x17')](function(_0x7ec80d){if(_0x7ec80d){_0x2868a0=_0x7ec80d['length'];if(!_0x1421dd[_0x8415('0x34')][_0x8415('0x3b')]('nolimit')){_0xc07f37[_0x8415('0x28')]=qs[_0x8415('0x28')](_0x1421dd[_0x8415('0x34')]['limit']);_0xc07f37[_0x8415('0x3d')]=qs[_0x8415('0x3d')](_0x1421dd[_0x8415('0x34')]['offset']);}return _0x1f0a82[_0x8415('0x51')](_0xc07f37);}})[_0x8415('0x17')](function(_0x565d3c){if(_0x565d3c){return _0x565d3c?{'count':_0x2868a0,'rows':_0x565d3c}:null;}})['then'](respondWithResult(_0x11d297,null))['catch'](handleError(_0x11d297,null));};exports[_0x8415('0x52')]=function(_0x162a70,_0x2c490a,_0x21d304){var _0x28b383={};var _0x37f36e={};var _0x5279eb;var _0x2f179d;return db['ZohoConfiguration'][_0x8415('0x53')]({'where':{'id':_0x162a70['params']['id']}})[_0x8415('0x17')](handleEntityNotFound(_0x2c490a,null))[_0x8415('0x17')](function(_0x2d1219){if(_0x2d1219){_0x5279eb=_0x2d1219;_0x37f36e['model']=_['keys'](db['ZohoField'][_0x8415('0x32')]);_0x37f36e[_0x8415('0x34')]=_['keys'](_0x162a70[_0x8415('0x34')]);_0x37f36e[_0x8415('0x35')]=_[_0x8415('0x36')](_0x37f36e[_0x8415('0x37')],_0x37f36e[_0x8415('0x34')]);_0x28b383[_0x8415('0x38')]=_[_0x8415('0x36')](_0x37f36e['model'],qs[_0x8415('0x39')](_0x162a70[_0x8415('0x34')][_0x8415('0x39')]));_0x28b383[_0x8415('0x38')]=_0x28b383['attributes'][_0x8415('0x3a')]?_0x28b383[_0x8415('0x38')]:_0x37f36e[_0x8415('0x37')];_0x28b383[_0x8415('0x3e')]=qs[_0x8415('0x3f')](_0x162a70['query'][_0x8415('0x3f')]);_0x28b383[_0x8415('0x40')]=qs[_0x8415('0x35')](_[_0x8415('0x41')](_0x162a70['query'],_0x37f36e[_0x8415('0x35')]));if(_0x162a70['query'][_0x8415('0x42')]){_0x28b383[_0x8415('0x40')]=_[_0x8415('0x47')](_0x28b383[_0x8415('0x40')],{'$or':_[_0x8415('0x43')](_0x28b383['attributes'],function(_0x5b46f6){var _0x44ba50={};_0x44ba50[_0x5b46f6]={'$like':'%'+_0x162a70[_0x8415('0x34')][_0x8415('0x42')]+'%'};return _0x44ba50;})});}_0x28b383=_['merge']({},_0x28b383,_0x162a70[_0x8415('0x48')]);return _0x5279eb['getSubjects'](_0x28b383);}})[_0x8415('0x17')](function(_0x180bd5){if(_0x180bd5){_0x2f179d=_0x180bd5[_0x8415('0x3a')];if(!_0x162a70[_0x8415('0x34')]['hasOwnProperty']('nolimit')){_0x28b383[_0x8415('0x28')]=qs[_0x8415('0x28')](_0x162a70[_0x8415('0x34')][_0x8415('0x28')]);_0x28b383[_0x8415('0x3d')]=qs['offset'](_0x162a70[_0x8415('0x34')]['offset']);}return _0x5279eb[_0x8415('0x52')](_0x28b383);}})['then'](function(_0x1a9d92){if(_0x1a9d92){return _0x1a9d92?{'count':_0x2f179d,'rows':_0x1a9d92}:null;}})[_0x8415('0x17')](respondWithResult(_0x2c490a,null))[_0x8415('0x22')](handleError(_0x2c490a,null));};exports['getDescriptions']=function(_0x26c6a0,_0x18687d,_0x3916a5){var _0x17ebc1={};var _0x3fdeba={};var _0x2e7ac3;var _0xce14a4;return db[_0x8415('0x31')][_0x8415('0x53')]({'where':{'id':_0x26c6a0[_0x8415('0x4c')]['id']}})['then'](handleEntityNotFound(_0x18687d,null))[_0x8415('0x17')](function(_0x20dd3b){if(_0x20dd3b){_0x2e7ac3=_0x20dd3b;_0x3fdeba[_0x8415('0x37')]=_['keys'](db['ZohoField'][_0x8415('0x32')]);_0x3fdeba[_0x8415('0x34')]=_[_0x8415('0x33')](_0x26c6a0[_0x8415('0x34')]);_0x3fdeba[_0x8415('0x35')]=_[_0x8415('0x36')](_0x3fdeba[_0x8415('0x37')],_0x3fdeba['query']);_0x17ebc1[_0x8415('0x38')]=_[_0x8415('0x36')](_0x3fdeba[_0x8415('0x37')],qs['fields'](_0x26c6a0[_0x8415('0x34')][_0x8415('0x39')]));_0x17ebc1[_0x8415('0x38')]=_0x17ebc1[_0x8415('0x38')][_0x8415('0x3a')]?_0x17ebc1[_0x8415('0x38')]:_0x3fdeba[_0x8415('0x37')];_0x17ebc1['order']=qs['sort'](_0x26c6a0[_0x8415('0x34')]['sort']);_0x17ebc1[_0x8415('0x40')]=qs[_0x8415('0x35')](_['pick'](_0x26c6a0[_0x8415('0x34')],_0x3fdeba[_0x8415('0x35')]));if(_0x26c6a0[_0x8415('0x34')][_0x8415('0x42')]){_0x17ebc1[_0x8415('0x40')]=_[_0x8415('0x47')](_0x17ebc1['where'],{'$or':_[_0x8415('0x43')](_0x17ebc1[_0x8415('0x38')],function(_0x222422){var _0x30b204={};_0x30b204[_0x222422]={'$like':'%'+_0x26c6a0[_0x8415('0x34')][_0x8415('0x42')]+'%'};return _0x30b204;})});}_0x17ebc1=_[_0x8415('0x47')]({},_0x17ebc1,_0x26c6a0[_0x8415('0x48')]);return _0x2e7ac3['getDescriptions'](_0x17ebc1);}})['then'](function(_0x986ed7){if(_0x986ed7){_0xce14a4=_0x986ed7['length'];if(!_0x26c6a0[_0x8415('0x34')][_0x8415('0x3b')](_0x8415('0x3c'))){_0x17ebc1['limit']=qs['limit'](_0x26c6a0[_0x8415('0x34')]['limit']);_0x17ebc1['offset']=qs[_0x8415('0x3d')](_0x26c6a0[_0x8415('0x34')]['offset']);}return _0x2e7ac3[_0x8415('0x54')](_0x17ebc1);}})['then'](function(_0x407239){if(_0x407239){return _0x407239?{'count':_0xce14a4,'rows':_0x407239}:null;}})[_0x8415('0x17')](respondWithResult(_0x18687d,null))[_0x8415('0x22')](handleError(_0x18687d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 6e8af9a..c72598f 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 _0x8a62=['api','bluebird','./intZohoConfiguration.attributes','exports','define','util','../../config/logger'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0x8a62,0x98));var _0x28a6=function(_0x4206cb,_0x16591c){_0x4206cb=_0x4206cb-0x0;var _0x5c21c6=_0x8a62[_0x4206cb];return _0x5c21c6;};'use strict';var _=require('lodash');var util=require(_0x28a6('0x0'));var logger=require(_0x28a6('0x1'))(_0x28a6('0x2'));var moment=require('moment');var BPromise=require(_0x28a6('0x3'));var rp=require('request-promise');var attributes=require(_0x28a6('0x4'));module[_0x28a6('0x5')]=function(_0x29094e,_0x1e798e){return _0x29094e[_0x28a6('0x6')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d02=['moment','request-promise','./intZohoConfiguration.attributes','define','lodash','../../config/logger'];(function(_0x31a5ac,_0x37f1af){var _0x47497a=function(_0x5f2a78){while(--_0x5f2a78){_0x31a5ac['push'](_0x31a5ac['shift']());}};_0x47497a(++_0x37f1af);}(_0x9d02,0x118));var _0x29d0=function(_0x3910f8,_0x434d0c){_0x3910f8=_0x3910f8-0x0;var _0x5065d8=_0x9d02[_0x3910f8];return _0x5065d8;};'use strict';var _=require(_0x29d0('0x0'));var util=require('util');var logger=require(_0x29d0('0x1'))('api');var moment=require(_0x29d0('0x2'));var BPromise=require('bluebird');var rp=require(_0x29d0('0x3'));var attributes=require(_0x29d0('0x4'));module['exports']=function(_0x33c00f,_0x2e9e8a){return _0x33c00f[_0x29d0('0x5')]('ZohoConfiguration',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 22115be..df71673 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 _0x6fb3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ZohoConfiguration,\x20%s,\x20%s','catch','lodash','moment','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6fb3,0xbd));var _0x36fb=function(_0x13a095,_0x64d8c2){_0x13a095=_0x13a095-0x0;var _0x2977e9=_0x6fb3[_0x13a095];return _0x2977e9;};'use strict';var _=require(_0x36fb('0x0'));var util=require('util');var moment=require(_0x36fb('0x1'));var BPromise=require(_0x36fb('0x2'));var rs=require(_0x36fb('0x3'));var fs=require('fs');var Redis=require(_0x36fb('0x4'));var db=require(_0x36fb('0x5'))['db'];var utils=require(_0x36fb('0x6'));var logger=require(_0x36fb('0x7'))(_0x36fb('0x8'));var config=require(_0x36fb('0x9'));var jayson=require(_0x36fb('0xa'));var client=jayson[_0x36fb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49f85c,_0x55b23b,_0x2da29b){return new BPromise(function(_0x3ba3af,_0x521aa0){return client[_0x36fb('0xc')](_0x49f85c,_0x2da29b)[_0x36fb('0xd')](function(_0x60ccf4){logger[_0x36fb('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x55b23b,'request\x20sent');logger[_0x36fb('0xf')](_0x36fb('0x10'),_0x55b23b,_0x36fb('0x11'),JSON[_0x36fb('0x12')](_0x60ccf4));if(_0x60ccf4[_0x36fb('0x13')]){if(_0x60ccf4[_0x36fb('0x13')][_0x36fb('0x14')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x55b23b,_0x60ccf4[_0x36fb('0x13')]['message']);return _0x521aa0(_0x60ccf4[_0x36fb('0x13')][_0x36fb('0x15')]);}logger[_0x36fb('0x13')](_0x36fb('0x16'),_0x55b23b,_0x60ccf4['error'][_0x36fb('0x15')]);return _0x3ba3af(_0x60ccf4[_0x36fb('0x13')][_0x36fb('0x15')]);}else{logger[_0x36fb('0xe')](_0x36fb('0x16'),_0x55b23b,'request\x20sent');_0x3ba3af(_0x60ccf4['result'][_0x36fb('0x15')]);}})[_0x36fb('0x17')](function(_0x112014){logger[_0x36fb('0x13')](_0x36fb('0x16'),_0x55b23b,_0x112014);_0x521aa0(_0x112014);});});} \ No newline at end of file +var _0x4947=['ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring'];(function(_0xbc9917,_0x479324){var _0x20ab5a=function(_0x43951d){while(--_0x43951d){_0xbc9917['push'](_0xbc9917['shift']());}};_0x20ab5a(++_0x479324);}(_0x4947,0xb9));var _0x7494=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x4947[_0x21353c];return _0xa99120;};'use strict';var _=require('lodash');var util=require(_0x7494('0x0'));var moment=require(_0x7494('0x1'));var BPromise=require(_0x7494('0x2'));var rs=require(_0x7494('0x3'));var fs=require('fs');var Redis=require(_0x7494('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7494('0x5'))(_0x7494('0x6'));var config=require('../../config/environment');var jayson=require(_0x7494('0x7'));var client=jayson[_0x7494('0x8')][_0x7494('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d8dd7,_0x440329,_0x1cb77a){return new BPromise(function(_0x5483d6,_0x4aa56d){return client[_0x7494('0xa')](_0x3d8dd7,_0x1cb77a)['then'](function(_0x2b8f3c){logger[_0x7494('0xb')](_0x7494('0xc'),_0x440329,_0x7494('0xd'));logger[_0x7494('0xe')](_0x7494('0xf'),_0x440329,_0x7494('0xd'),JSON[_0x7494('0x10')](_0x2b8f3c));if(_0x2b8f3c[_0x7494('0x11')]){if(_0x2b8f3c[_0x7494('0x11')][_0x7494('0x12')]===0x1f4){logger[_0x7494('0x11')](_0x7494('0xc'),_0x440329,_0x2b8f3c[_0x7494('0x11')]['message']);return _0x4aa56d(_0x2b8f3c['error'][_0x7494('0x13')]);}logger['error'](_0x7494('0xc'),_0x440329,_0x2b8f3c[_0x7494('0x11')]['message']);return _0x5483d6(_0x2b8f3c[_0x7494('0x11')][_0x7494('0x13')]);}else{logger[_0x7494('0xb')](_0x7494('0xc'),_0x440329,'request\x20sent');_0x5483d6(_0x2b8f3c[_0x7494('0x14')][_0x7494('0x13')]);}})['catch'](function(_0x2457fb){logger[_0x7494('0x11')](_0x7494('0xc'),_0x440329,_0x2457fb);_0x4aa56d(_0x2457fb);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c380f58..d84b98b 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 _0xc624=['destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','show','post','create','put','isAuthenticated','update'];(function(_0x44d365,_0x3f28bd){var _0x261ec6=function(_0x3ee9d6){while(--_0x3ee9d6){_0x44d365['push'](_0x44d365['shift']());}};_0x261ec6(++_0x3f28bd);}(_0xc624,0x11f));var _0x4c62=function(_0x51f20d,_0x5b8f88){_0x51f20d=_0x51f20d-0x0;var _0x2e2dba=_0xc624[_0x51f20d];return _0x2e2dba;};'use strict';var multer=require(_0x4c62('0x0'));var util=require(_0x4c62('0x1'));var path=require(_0x4c62('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c62('0x3'));var router=express['Router']();var auth=require(_0x4c62('0x4'));var interaction=require(_0x4c62('0x5'));var config=require(_0x4c62('0x6'));var controller=require(_0x4c62('0x7'));router[_0x4c62('0x8')]('/',auth['isAuthenticated'](),controller[_0x4c62('0x9')]);router[_0x4c62('0x8')](_0x4c62('0xa'),auth['isAuthenticated'](),controller[_0x4c62('0xb')]);router[_0x4c62('0xc')]('/',auth['isAuthenticated'](),controller[_0x4c62('0xd')]);router[_0x4c62('0xe')]('/:id',auth[_0x4c62('0xf')](),controller[_0x4c62('0x10')]);router['delete'](_0x4c62('0xa'),auth[_0x4c62('0xf')](),controller[_0x4c62('0x11')]);module[_0x4c62('0x12')]=router; \ No newline at end of file +var _0x43f8=['show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x4a63fc,_0x167a02){var _0x30d4c3=function(_0x3eecb2){while(--_0x3eecb2){_0x4a63fc['push'](_0x4a63fc['shift']());}};_0x30d4c3(++_0x167a02);}(_0x43f8,0x195));var _0x843f=function(_0x2e3d56,_0x4fb6ed){_0x2e3d56=_0x2e3d56-0x0;var _0x1815c1=_0x43f8[_0x2e3d56];return _0x1815c1;};'use strict';var multer=require(_0x843f('0x0'));var util=require(_0x843f('0x1'));var path=require(_0x843f('0x2'));var timeout=require(_0x843f('0x3'));var express=require(_0x843f('0x4'));var router=express['Router']();var auth=require(_0x843f('0x5'));var interaction=require(_0x843f('0x6'));var config=require(_0x843f('0x7'));var controller=require(_0x843f('0x8'));router[_0x843f('0x9')]('/',auth[_0x843f('0xa')](),controller[_0x843f('0xb')]);router[_0x843f('0x9')](_0x843f('0xc'),auth[_0x843f('0xa')](),controller[_0x843f('0xd')]);router[_0x843f('0xe')]('/',auth['isAuthenticated'](),controller[_0x843f('0xf')]);router[_0x843f('0x10')]('/:id',auth[_0x843f('0xa')](),controller['update']);router[_0x843f('0x11')](_0x843f('0xc'),auth[_0x843f('0xa')](),controller['destroy']);module[_0x843f('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 d9a45c4..5d91bb6 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 _0xb7e7=['customVariable','BOOLEAN','sequelize','ENUM','variable','keyValue','STRING'];(function(_0x603cfd,_0x1ae68d){var _0x2919f6=function(_0x45d0e7){while(--_0x45d0e7){_0x603cfd['push'](_0x603cfd['shift']());}};_0x2919f6(++_0x1ae68d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'type':{'type':Sequelize[_0x7b7e('0x1')]('string',_0x7b7e('0x2'),'customVariable',_0x7b7e('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7b7e('0x4')]},'key':{'type':Sequelize[_0x7b7e('0x4')]},'keyType':{'type':Sequelize[_0x7b7e('0x1')]('string','variable',_0x7b7e('0x5'))},'keyContent':{'type':Sequelize[_0x7b7e('0x4')]},'idField':{'type':Sequelize[_0x7b7e('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7b7e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7b7e('0x4')]}}; \ No newline at end of file +var _0x5ff3=['STRING','ENUM','variable','exports','string','customVariable','keyValue'];(function(_0x4eec46,_0x513505){var _0x125ca7=function(_0x6cdfb6){while(--_0x6cdfb6){_0x4eec46['push'](_0x4eec46['shift']());}};_0x125ca7(++_0x513505);}(_0x5ff3,0x17d));var _0x35ff=function(_0x4a1903,_0x4b813a){_0x4a1903=_0x4a1903-0x0;var _0x21a686=_0x5ff3[_0x4a1903];return _0x21a686;};'use strict';var Sequelize=require('sequelize');module[_0x35ff('0x0')]={'type':{'type':Sequelize['ENUM'](_0x35ff('0x1'),'variable',_0x35ff('0x2'),_0x35ff('0x3')),'defaultValue':_0x35ff('0x1')},'content':{'type':Sequelize[_0x35ff('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x35ff('0x5')](_0x35ff('0x1'),_0x35ff('0x6'),_0x35ff('0x2'))},'keyContent':{'type':Sequelize[_0x35ff('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x35ff('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x35ff('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a43d7b7..a2bbf25 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 _0xa971=['util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','then','error','stack','name','index','ZohoField','model','query','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','type','key','options','count','includeAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa971,0xc4));var _0x1a97=function(_0x11933d,_0x5ca42f){_0x11933d=_0x11933d-0x0;var _0x1158a1=_0xa971[_0x11933d];return _0x1158a1;};'use strict';var pdf=require(_0x1a97('0x0'));var emlformat=require(_0x1a97('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1a97('0x2'));var jsonpatch=require(_0x1a97('0x3'));var rp=require(_0x1a97('0x4'));var moment=require(_0x1a97('0x5'));var BPromise=require(_0x1a97('0x6'));var Mustache=require(_0x1a97('0x7'));var util=require(_0x1a97('0x8'));var path=require(_0x1a97('0x9'));var sox=require(_0x1a97('0xa'));var csv=require(_0x1a97('0xb'));var ejs=require(_0x1a97('0xc'));var fs=require('fs');var _=require(_0x1a97('0xd'));var squel=require(_0x1a97('0xe'));var crypto=require('crypto');var jsforce=require(_0x1a97('0xf'));var deskjs=require(_0x1a97('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a97('0x11'));var authService=require(_0x1a97('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x1a97('0x13'));var qs=require(_0x1a97('0x14'));var logger=require('../../config/logger')(_0x1a97('0x15'));var utils=require(_0x1a97('0x16'));var config=require('../../config/environment');var db=require(_0x1a97('0x17'))['db'];function respondWithStatusCode(_0x5f1b02,_0x440cc3){_0x440cc3=_0x440cc3||0xcc;return function(_0xd34d8a){if(_0xd34d8a){return _0x5f1b02[_0x1a97('0x18')](_0x440cc3);}return _0x5f1b02[_0x1a97('0x19')](_0x440cc3)[_0x1a97('0x1a')]();};}function respondWithResult(_0x58d139,_0x3d3484){_0x3d3484=_0x3d3484||0xc8;return function(_0x3e4209){if(_0x3e4209){return _0x58d139[_0x1a97('0x19')](_0x3d3484)['json'](_0x3e4209);}};}function respondWithFilteredResult(_0x21c3c6,_0x3dcf9a){return function(_0x4f49fe){if(_0x4f49fe){var _0x371816=_0x4f49fe['count'],_0x3ecbd5=_0x3dcf9a['offset'],_0x1354e1=_0x3dcf9a[_0x1a97('0x1b')]+_0x3dcf9a[_0x1a97('0x1c')],_0x9679a8;if(_0x1354e1>=_0x371816){_0x1354e1=_0x371816;_0x9679a8=0xc8;}else{_0x9679a8=0xce;}_0x21c3c6[_0x1a97('0x19')](_0x9679a8);return _0x21c3c6[_0x1a97('0x1d')]('Content-Range',_0x3ecbd5+'-'+_0x1354e1+'/'+_0x371816)[_0x1a97('0x1e')](_0x4f49fe);}return null;};}function patchUpdates(_0x2dd52c){return function(_0x481cd0){try{jsonpatch[_0x1a97('0x1f')](_0x481cd0,_0x2dd52c,!![]);}catch(_0x3c4a7d){return BPromise[_0x1a97('0x20')](_0x3c4a7d);}return _0x481cd0[_0x1a97('0x21')]();};}function saveUpdates(_0x4b5485,_0x52ff77){return function(_0x15a047){if(_0x15a047){return _0x15a047[_0x1a97('0x22')](_0x4b5485)['then'](function(_0x3e9fdb){return _0x3e9fdb;});}return null;};}function removeEntity(_0xba465e,_0x529912){return function(_0x457119){if(_0x457119){return _0x457119['destroy']()[_0x1a97('0x23')](function(){_0xba465e[_0x1a97('0x19')](0xcc)[_0x1a97('0x1a')]();});}};}function handleEntityNotFound(_0x465ee9,_0x44ca85){return function(_0x160c40){if(!_0x160c40){_0x465ee9[_0x1a97('0x18')](0x194);}return _0x160c40;};}function handleError(_0xb7fb89,_0x1f1361){_0x1f1361=_0x1f1361||0x1f4;return function(_0x5b6dd7){logger[_0x1a97('0x24')](_0x5b6dd7[_0x1a97('0x25')]);if(_0x5b6dd7[_0x1a97('0x26')]){delete _0x5b6dd7[_0x1a97('0x26')];}_0xb7fb89['status'](_0x1f1361)['send'](_0x5b6dd7);};}exports[_0x1a97('0x27')]=function(_0x2c50e0,_0x490957){var _0x59deb5={},_0x52206d={},_0x109e8b={'count':0x0,'rows':[]};var _0x152d2c=db[_0x1a97('0x28')]['rawAttributes'];_0x52206d[_0x1a97('0x29')]=_['keys'](_0x152d2c);_0x52206d[_0x1a97('0x2a')]=_['keys'](_0x2c50e0[_0x1a97('0x2a')]);_0x52206d[_0x1a97('0x2b')]=_['intersection'](_0x52206d['model'],_0x52206d['query']);_0x59deb5[_0x1a97('0x2c')]=_[_0x1a97('0x2d')](_0x52206d[_0x1a97('0x29')],qs['fields'](_0x2c50e0['query'][_0x1a97('0x2e')]));_0x59deb5[_0x1a97('0x2c')]=_0x59deb5[_0x1a97('0x2c')][_0x1a97('0x2f')]?_0x59deb5[_0x1a97('0x2c')]:_0x52206d['model'];if(!_0x2c50e0['query']['hasOwnProperty']('nolimit')){_0x59deb5[_0x1a97('0x1c')]=qs[_0x1a97('0x1c')](_0x2c50e0[_0x1a97('0x2a')][_0x1a97('0x1c')]);_0x59deb5['offset']=qs[_0x1a97('0x1b')](_0x2c50e0[_0x1a97('0x2a')]['offset']);}_0x59deb5['order']=qs[_0x1a97('0x30')](_0x2c50e0[_0x1a97('0x2a')][_0x1a97('0x30')]);_0x59deb5[_0x1a97('0x31')]=qs[_0x1a97('0x2b')](_[_0x1a97('0x32')](_0x2c50e0['query'],_0x52206d[_0x1a97('0x2b')]));if(_0x2c50e0[_0x1a97('0x2a')][_0x1a97('0x33')]){_0x59deb5[_0x1a97('0x31')]=_[_0x1a97('0x34')](_0x59deb5[_0x1a97('0x31')],{'$or':_['map'](_0x152d2c,function(_0x593349){if(_0x593349[_0x1a97('0x35')][_0x1a97('0x36')]!=='VIRTUAL'){var _0xfa8a0={};_0xfa8a0[_0x593349['field']]={'$like':'%'+_0x2c50e0['query'][_0x1a97('0x33')]+'%'};return _0xfa8a0;}})});}_0x59deb5=_[_0x1a97('0x34')]({},_0x59deb5,_0x2c50e0[_0x1a97('0x37')]);var _0x3914ef={'where':_0x59deb5[_0x1a97('0x31')]};return db[_0x1a97('0x28')][_0x1a97('0x38')](_0x3914ef)[_0x1a97('0x23')](function(_0x103a39){_0x109e8b[_0x1a97('0x38')]=_0x103a39;if(_0x2c50e0[_0x1a97('0x2a')][_0x1a97('0x39')]){_0x59deb5['include']=[{'all':!![]}];}return db[_0x1a97('0x28')]['findAll'](_0x59deb5);})[_0x1a97('0x23')](function(_0x168bf6){_0x109e8b[_0x1a97('0x3a')]=_0x168bf6;return _0x109e8b;})['then'](respondWithFilteredResult(_0x490957,_0x59deb5))[_0x1a97('0x3b')](handleError(_0x490957,null));};exports[_0x1a97('0x3c')]=function(_0x58b132,_0x36facd){var _0x2cd672={'raw':!![],'where':{'id':_0x58b132[_0x1a97('0x3d')]['id']}},_0x34c523={};_0x34c523[_0x1a97('0x29')]=_[_0x1a97('0x3e')](db[_0x1a97('0x28')][_0x1a97('0x3f')]);_0x34c523[_0x1a97('0x2a')]=_['keys'](_0x58b132['query']);_0x34c523[_0x1a97('0x2b')]=_[_0x1a97('0x2d')](_0x34c523['model'],_0x34c523[_0x1a97('0x2a')]);_0x2cd672[_0x1a97('0x2c')]=_[_0x1a97('0x2d')](_0x34c523[_0x1a97('0x29')],qs[_0x1a97('0x2e')](_0x58b132[_0x1a97('0x2a')][_0x1a97('0x2e')]));_0x2cd672[_0x1a97('0x2c')]=_0x2cd672[_0x1a97('0x2c')]['length']?_0x2cd672[_0x1a97('0x2c')]:_0x34c523[_0x1a97('0x29')];if(_0x58b132[_0x1a97('0x2a')][_0x1a97('0x39')]){_0x2cd672[_0x1a97('0x40')]=[{'all':!![]}];}_0x2cd672=_[_0x1a97('0x34')]({},_0x2cd672,_0x58b132['options']);return db[_0x1a97('0x28')][_0x1a97('0x41')](_0x2cd672)[_0x1a97('0x23')](handleEntityNotFound(_0x36facd,null))[_0x1a97('0x23')](respondWithResult(_0x36facd,null))[_0x1a97('0x3b')](handleError(_0x36facd,null));};exports['create']=function(_0x245dd2,_0x21eba4){return db[_0x1a97('0x28')][_0x1a97('0x42')](_0x245dd2[_0x1a97('0x43')],{})[_0x1a97('0x23')](respondWithResult(_0x21eba4,0xc9))[_0x1a97('0x3b')](handleError(_0x21eba4,null));};exports[_0x1a97('0x22')]=function(_0x16367b,_0x3d1205){if(_0x16367b['body']['id']){delete _0x16367b[_0x1a97('0x43')]['id'];}return db[_0x1a97('0x28')]['find']({'where':{'id':_0x16367b[_0x1a97('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3d1205,null))[_0x1a97('0x23')](saveUpdates(_0x16367b[_0x1a97('0x43')],null))['then'](respondWithResult(_0x3d1205,null))['catch'](handleError(_0x3d1205,null));};exports['destroy']=function(_0x2d58e4,_0x316ac6){return db[_0x1a97('0x28')]['find']({'where':{'id':_0x2d58e4[_0x1a97('0x3d')]['id']}})['then'](handleEntityNotFound(_0x316ac6,null))[_0x1a97('0x23')](removeEntity(_0x316ac6,null))[_0x1a97('0x3b')](handleError(_0x316ac6,null));}; \ No newline at end of file +var _0x2a58=['reject','save','destroy','then','stack','name','send','index','ZohoField','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','map','type','key','field','filter','options','includeAll','findAll','rows','catch','params','length','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x36b146,_0x1f38b6){var _0x1b3bca=function(_0x237521){while(--_0x237521){_0x36b146['push'](_0x36b146['shift']());}};_0x1b3bca(++_0x1f38b6);}(_0x2a58,0x1d0));var _0x82a5=function(_0x32302b,_0x4bd8c4){_0x32302b=_0x32302b-0x0;var _0x41a2d8=_0x2a58[_0x32302b];return _0x41a2d8;};'use strict';var pdf=require(_0x82a5('0x0'));var emlformat=require(_0x82a5('0x1'));var rimraf=require(_0x82a5('0x2'));var zipdir=require(_0x82a5('0x3'));var jsonpatch=require(_0x82a5('0x4'));var rp=require(_0x82a5('0x5'));var moment=require(_0x82a5('0x6'));var BPromise=require(_0x82a5('0x7'));var Mustache=require('mustache');var util=require(_0x82a5('0x8'));var path=require(_0x82a5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x82a5('0xa'));var fs=require('fs');var _=require(_0x82a5('0xb'));var squel=require(_0x82a5('0xc'));var crypto=require(_0x82a5('0xd'));var jsforce=require(_0x82a5('0xe'));var deskjs=require(_0x82a5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x82a5('0x10'));var Papa=require(_0x82a5('0x11'));var authService=require(_0x82a5('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x82a5('0x13'));var qs=require(_0x82a5('0x14'));var logger=require('../../config/logger')(_0x82a5('0x15'));var utils=require(_0x82a5('0x16'));var config=require(_0x82a5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x323e4f,_0x3eef12){_0x3eef12=_0x3eef12||0xcc;return function(_0x127fea){if(_0x127fea){return _0x323e4f[_0x82a5('0x18')](_0x3eef12);}return _0x323e4f[_0x82a5('0x19')](_0x3eef12)[_0x82a5('0x1a')]();};}function respondWithResult(_0x31fb35,_0x566669){_0x566669=_0x566669||0xc8;return function(_0x3d8ff2){if(_0x3d8ff2){return _0x31fb35[_0x82a5('0x19')](_0x566669)[_0x82a5('0x1b')](_0x3d8ff2);}};}function respondWithFilteredResult(_0x26784e,_0x5231c1){return function(_0x407f31){if(_0x407f31){var _0x15257a=_0x407f31[_0x82a5('0x1c')],_0x4e103a=_0x5231c1[_0x82a5('0x1d')],_0xaafbe6=_0x5231c1[_0x82a5('0x1d')]+_0x5231c1[_0x82a5('0x1e')],_0xd147e8;if(_0xaafbe6>=_0x15257a){_0xaafbe6=_0x15257a;_0xd147e8=0xc8;}else{_0xd147e8=0xce;}_0x26784e[_0x82a5('0x19')](_0xd147e8);return _0x26784e[_0x82a5('0x1f')](_0x82a5('0x20'),_0x4e103a+'-'+_0xaafbe6+'/'+_0x15257a)[_0x82a5('0x1b')](_0x407f31);}return null;};}function patchUpdates(_0x4bb339){return function(_0x1cbdf2){try{jsonpatch['apply'](_0x1cbdf2,_0x4bb339,!![]);}catch(_0x1285aa){return BPromise[_0x82a5('0x21')](_0x1285aa);}return _0x1cbdf2[_0x82a5('0x22')]();};}function saveUpdates(_0x54d7a6,_0x5bbaba){return function(_0x53fceb){if(_0x53fceb){return _0x53fceb['update'](_0x54d7a6)['then'](function(_0x479afb){return _0x479afb;});}return null;};}function removeEntity(_0x4821d4,_0x2b7e56){return function(_0x1481fa){if(_0x1481fa){return _0x1481fa[_0x82a5('0x23')]()[_0x82a5('0x24')](function(){_0x4821d4[_0x82a5('0x19')](0xcc)[_0x82a5('0x1a')]();});}};}function handleEntityNotFound(_0x3ccf0b,_0x3fcfa2){return function(_0x36b8f1){if(!_0x36b8f1){_0x3ccf0b[_0x82a5('0x18')](0x194);}return _0x36b8f1;};}function handleError(_0x506183,_0xc51dd6){_0xc51dd6=_0xc51dd6||0x1f4;return function(_0x342d75){logger['error'](_0x342d75[_0x82a5('0x25')]);if(_0x342d75[_0x82a5('0x26')]){delete _0x342d75[_0x82a5('0x26')];}_0x506183['status'](_0xc51dd6)[_0x82a5('0x27')](_0x342d75);};}exports[_0x82a5('0x28')]=function(_0x119be0,_0x3bb13a){var _0x28a130={},_0x5aad24={},_0x2ff206={'count':0x0,'rows':[]};var _0x2ea2ef=db[_0x82a5('0x29')]['rawAttributes'];_0x5aad24[_0x82a5('0x2a')]=_[_0x82a5('0x2b')](_0x2ea2ef);_0x5aad24[_0x82a5('0x2c')]=_[_0x82a5('0x2b')](_0x119be0[_0x82a5('0x2c')]);_0x5aad24[_0x82a5('0x2d')]=_[_0x82a5('0x2e')](_0x5aad24[_0x82a5('0x2a')],_0x5aad24['query']);_0x28a130[_0x82a5('0x2f')]=_[_0x82a5('0x2e')](_0x5aad24[_0x82a5('0x2a')],qs['fields'](_0x119be0[_0x82a5('0x2c')][_0x82a5('0x30')]));_0x28a130[_0x82a5('0x2f')]=_0x28a130[_0x82a5('0x2f')]['length']?_0x28a130[_0x82a5('0x2f')]:_0x5aad24[_0x82a5('0x2a')];if(!_0x119be0[_0x82a5('0x2c')][_0x82a5('0x31')](_0x82a5('0x32'))){_0x28a130['limit']=qs[_0x82a5('0x1e')](_0x119be0[_0x82a5('0x2c')][_0x82a5('0x1e')]);_0x28a130[_0x82a5('0x1d')]=qs[_0x82a5('0x1d')](_0x119be0[_0x82a5('0x2c')][_0x82a5('0x1d')]);}_0x28a130[_0x82a5('0x33')]=qs['sort'](_0x119be0['query']['sort']);_0x28a130[_0x82a5('0x34')]=qs[_0x82a5('0x2d')](_[_0x82a5('0x35')](_0x119be0[_0x82a5('0x2c')],_0x5aad24['filters']));if(_0x119be0[_0x82a5('0x2c')]['filter']){_0x28a130[_0x82a5('0x34')]=_[_0x82a5('0x36')](_0x28a130[_0x82a5('0x34')],{'$or':_[_0x82a5('0x37')](_0x2ea2ef,function(_0x2531d2){if(_0x2531d2[_0x82a5('0x38')][_0x82a5('0x39')]!=='VIRTUAL'){var _0xf688b4={};_0xf688b4[_0x2531d2[_0x82a5('0x3a')]]={'$like':'%'+_0x119be0['query'][_0x82a5('0x3b')]+'%'};return _0xf688b4;}})});}_0x28a130=_['merge']({},_0x28a130,_0x119be0[_0x82a5('0x3c')]);var _0x2ade4b={'where':_0x28a130[_0x82a5('0x34')]};return db[_0x82a5('0x29')][_0x82a5('0x1c')](_0x2ade4b)['then'](function(_0x4a66e6){_0x2ff206[_0x82a5('0x1c')]=_0x4a66e6;if(_0x119be0[_0x82a5('0x2c')][_0x82a5('0x3d')]){_0x28a130['include']=[{'all':!![]}];}return db[_0x82a5('0x29')][_0x82a5('0x3e')](_0x28a130);})[_0x82a5('0x24')](function(_0x233ccb){_0x2ff206[_0x82a5('0x3f')]=_0x233ccb;return _0x2ff206;})['then'](respondWithFilteredResult(_0x3bb13a,_0x28a130))[_0x82a5('0x40')](handleError(_0x3bb13a,null));};exports['show']=function(_0x3d0b60,_0x3a7bc7){var _0x2abbc1={'raw':!![],'where':{'id':_0x3d0b60[_0x82a5('0x41')]['id']}},_0x12193d={};_0x12193d[_0x82a5('0x2a')]=_[_0x82a5('0x2b')](db[_0x82a5('0x29')]['rawAttributes']);_0x12193d[_0x82a5('0x2c')]=_[_0x82a5('0x2b')](_0x3d0b60[_0x82a5('0x2c')]);_0x12193d[_0x82a5('0x2d')]=_[_0x82a5('0x2e')](_0x12193d[_0x82a5('0x2a')],_0x12193d[_0x82a5('0x2c')]);_0x2abbc1[_0x82a5('0x2f')]=_[_0x82a5('0x2e')](_0x12193d['model'],qs[_0x82a5('0x30')](_0x3d0b60[_0x82a5('0x2c')]['fields']));_0x2abbc1['attributes']=_0x2abbc1[_0x82a5('0x2f')][_0x82a5('0x42')]?_0x2abbc1[_0x82a5('0x2f')]:_0x12193d['model'];if(_0x3d0b60[_0x82a5('0x2c')]['includeAll']){_0x2abbc1['include']=[{'all':!![]}];}_0x2abbc1=_[_0x82a5('0x36')]({},_0x2abbc1,_0x3d0b60['options']);return db['ZohoField'][_0x82a5('0x43')](_0x2abbc1)['then'](handleEntityNotFound(_0x3a7bc7,null))[_0x82a5('0x24')](respondWithResult(_0x3a7bc7,null))[_0x82a5('0x40')](handleError(_0x3a7bc7,null));};exports['create']=function(_0xca8c8,_0x21409c){return db[_0x82a5('0x29')][_0x82a5('0x44')](_0xca8c8[_0x82a5('0x45')],{})[_0x82a5('0x24')](respondWithResult(_0x21409c,0xc9))['catch'](handleError(_0x21409c,null));};exports[_0x82a5('0x46')]=function(_0x19a560,_0x17dae2){if(_0x19a560[_0x82a5('0x45')]['id']){delete _0x19a560['body']['id'];}return db['ZohoField']['find']({'where':{'id':_0x19a560[_0x82a5('0x41')]['id']}})[_0x82a5('0x24')](handleEntityNotFound(_0x17dae2,null))[_0x82a5('0x24')](saveUpdates(_0x19a560[_0x82a5('0x45')],null))['then'](respondWithResult(_0x17dae2,null))[_0x82a5('0x40')](handleError(_0x17dae2,null));};exports[_0x82a5('0x23')]=function(_0x173f41,_0x5dab63){return db[_0x82a5('0x29')][_0x82a5('0x43')]({'where':{'id':_0x173f41['params']['id']}})['then'](handleEntityNotFound(_0x5dab63,null))['then'](removeEntity(_0x5dab63,null))[_0x82a5('0x40')](handleError(_0x5dab63,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b4d83d1..98066f9 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 _0x5b6e=['idField','FieldId','lodash','util','api','bluebird','request-promise','./intZohoField.attributes','define','ZohoField','int_zoho_fields'];(function(_0x42b1df,_0x52acba){var _0x3e9a27=function(_0x44f501){while(--_0x44f501){_0x42b1df['push'](_0x42b1df['shift']());}};_0x3e9a27(++_0x52acba);}(_0x5b6e,0x14c));var _0xe5b6=function(_0x3adb47,_0x15c02d){_0x3adb47=_0x3adb47-0x0;var _0x1ced86=_0x5b6e[_0x3adb47];return _0x1ced86;};'use strict';var _=require(_0xe5b6('0x0'));var util=require(_0xe5b6('0x1'));var logger=require('../../config/logger')(_0xe5b6('0x2'));var moment=require('moment');var BPromise=require(_0xe5b6('0x3'));var rp=require(_0xe5b6('0x4'));var attributes=require(_0xe5b6('0x5'));module['exports']=function(_0x54b438,_0x3f1947){return _0x54b438[_0xe5b6('0x6')](_0xe5b6('0x7'),attributes,{'tableName':_0xe5b6('0x8'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0xe5b6('0x9'),_0xe5b6('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d59=['util','../../config/logger','api','moment','bluebird','request-promise','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash'];(function(_0x44a4f9,_0x2fad3e){var _0x4136bf=function(_0x98ab3){while(--_0x98ab3){_0x44a4f9['push'](_0x44a4f9['shift']());}};_0x4136bf(++_0x2fad3e);}(_0x8d59,0x109));var _0x98d5=function(_0x234bf7,_0x41c898){_0x234bf7=_0x234bf7-0x0;var _0x4d232a=_0x8d59[_0x234bf7];return _0x4d232a;};'use strict';var _=require(_0x98d5('0x0'));var util=require(_0x98d5('0x1'));var logger=require(_0x98d5('0x2'))(_0x98d5('0x3'));var moment=require(_0x98d5('0x4'));var BPromise=require(_0x98d5('0x5'));var rp=require(_0x98d5('0x6'));var attributes=require(_0x98d5('0x7'));module[_0x98d5('0x8')]=function(_0x115abf,_0x336e5b){return _0x115abf[_0x98d5('0x9')](_0x98d5('0xa'),attributes,{'tableName':_0x98d5('0xb'),'paranoid':![],'indexes':[{'name':_0x98d5('0xc'),'fields':[_0x98d5('0xd'),'FieldId'],'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 3b22b30..dc1ee98 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 _0xa40b=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa40b,0x12d));var _0xba40=function(_0x4e1ed6,_0x128fe8){_0x4e1ed6=_0x4e1ed6-0x0;var _0x16d523=_0xa40b[_0x4e1ed6];return _0x16d523;};'use strict';var _=require(_0xba40('0x0'));var util=require(_0xba40('0x1'));var moment=require(_0xba40('0x2'));var BPromise=require(_0xba40('0x3'));var rs=require(_0xba40('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba40('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xba40('0x6'))(_0xba40('0x7'));var config=require('../../config/environment');var jayson=require(_0xba40('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3da89a,_0x339110,_0x150fba){return new BPromise(function(_0x1dc680,_0x6df366){return client[_0xba40('0x9')](_0x3da89a,_0x150fba)['then'](function(_0x23e731){logger[_0xba40('0xa')](_0xba40('0xb'),_0x339110,_0xba40('0xc'));logger[_0xba40('0xd')](_0xba40('0xe'),_0x339110,'request\x20sent',JSON[_0xba40('0xf')](_0x23e731));if(_0x23e731['error']){if(_0x23e731[_0xba40('0x10')][_0xba40('0x11')]===0x1f4){logger[_0xba40('0x10')](_0xba40('0xb'),_0x339110,_0x23e731[_0xba40('0x10')][_0xba40('0x12')]);return _0x6df366(_0x23e731[_0xba40('0x10')][_0xba40('0x12')]);}logger[_0xba40('0x10')](_0xba40('0xb'),_0x339110,_0x23e731[_0xba40('0x10')][_0xba40('0x12')]);return _0x1dc680(_0x23e731[_0xba40('0x10')][_0xba40('0x12')]);}else{logger[_0xba40('0xa')](_0xba40('0xb'),_0x339110,_0xba40('0xc'));_0x1dc680(_0x23e731['result'][_0xba40('0x12')]);}})[_0xba40('0x13')](function(_0x10ae81){logger[_0xba40('0x10')](_0xba40('0xb'),_0x339110,_0x10ae81);_0x6df366(_0x10ae81);});});} \ No newline at end of file +var _0xdc33=['../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3397f8,_0x1020d2){var _0x955006=function(_0x203892){while(--_0x203892){_0x3397f8['push'](_0x3397f8['shift']());}};_0x955006(++_0x1020d2);}(_0xdc33,0x78));var _0x3dc3=function(_0xa39674,_0x531422){_0xa39674=_0xa39674-0x0;var _0x21730d=_0xdc33[_0xa39674];return _0x21730d;};'use strict';var _=require(_0x3dc3('0x0'));var util=require('util');var moment=require(_0x3dc3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dc3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3dc3('0x3'));var logger=require(_0x3dc3('0x4'))(_0x3dc3('0x5'));var config=require(_0x3dc3('0x6'));var jayson=require(_0x3dc3('0x7'));var client=jayson[_0x3dc3('0x8')][_0x3dc3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x499fe0,_0x1da375,_0x5be8f3){return new BPromise(function(_0x223533,_0x34f161){return client[_0x3dc3('0xa')](_0x499fe0,_0x5be8f3)['then'](function(_0x203bd5){logger[_0x3dc3('0xb')](_0x3dc3('0xc'),_0x1da375,_0x3dc3('0xd'));logger[_0x3dc3('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x1da375,_0x3dc3('0xd'),JSON[_0x3dc3('0xf')](_0x203bd5));if(_0x203bd5[_0x3dc3('0x10')]){if(_0x203bd5['error'][_0x3dc3('0x11')]===0x1f4){logger[_0x3dc3('0x10')](_0x3dc3('0xc'),_0x1da375,_0x203bd5[_0x3dc3('0x10')][_0x3dc3('0x12')]);return _0x34f161(_0x203bd5[_0x3dc3('0x10')][_0x3dc3('0x12')]);}logger[_0x3dc3('0x10')](_0x3dc3('0xc'),_0x1da375,_0x203bd5[_0x3dc3('0x10')][_0x3dc3('0x12')]);return _0x223533(_0x203bd5['error'][_0x3dc3('0x12')]);}else{logger[_0x3dc3('0xb')](_0x3dc3('0xc'),_0x1da375,_0x3dc3('0xd'));_0x223533(_0x203bd5[_0x3dc3('0x13')][_0x3dc3('0x12')]);}})[_0x3dc3('0x14')](function(_0x21a604){logger['error'](_0x3dc3('0xc'),_0x1da375,_0x21a604);_0x34f161(_0x21a604);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 643ce7b..9f503d3 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 _0x6333=['Router','../../components/auth/service','../../config/environment','connect-timeout'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x6333,0x83));var _0x3633=function(_0x5549e3,_0x44233a){_0x5549e3=_0x5549e3-0x0;var _0x5aaf8d=_0x6333[_0x5549e3];return _0x5aaf8d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3633('0x0'));var express=require('express');var router=express[_0x3633('0x1')]();var auth=require(_0x3633('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x3633('0x3'));module['exports']=router; \ No newline at end of file +var _0xed1c=['../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4b1984,_0x547455){var _0x1328ce=function(_0x5b4c70){while(--_0x5b4c70){_0x4b1984['push'](_0x4b1984['shift']());}};_0x1328ce(++_0x547455);}(_0xed1c,0xe4));var _0xced1=function(_0x505218,_0x5b1436){_0x505218=_0x505218-0x0;var _0x24b683=_0xed1c[_0x505218];return _0x24b683;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xced1('0x2'));var interaction=require(_0xced1('0x3'));var config=require(_0xced1('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 231bbf4..49b8afe 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 _0x9e65=['STRING','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x9e65,0x8a));var _0x59e6=function(_0x18c44d,_0x33976d){_0x18c44d=_0x18c44d-0x0;var _0x71abcf=_0x9e65[_0x18c44d];return _0x71abcf;};'use strict';var Sequelize=require(_0x59e6('0x0'));module[_0x59e6('0x1')]={'name':{'type':Sequelize[_0x59e6('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x59e6('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x59e6('0x3')},'filename':{'type':Sequelize[_0x59e6('0x2')]},'path':{'type':Sequelize[_0x59e6('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x59e6('0x4')]},'active':{'type':Sequelize[_0x59e6('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x59e6('0x2')]},'logo':{'type':Sequelize[_0x59e6('0x2')]},'state':{'type':Sequelize[_0x59e6('0x2')],'unique':_0x59e6('0x6')},'description':{'type':Sequelize[_0x59e6('0x2')]},'title':{'type':Sequelize[_0x59e6('0x2')]},'remoteUri':{'type':Sequelize[_0x59e6('0x2')]},'link':{'type':Sequelize[_0x59e6('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x668a=['sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x23785c,_0x1c6e72){var _0x2dc080=function(_0x353f41){while(--_0x353f41){_0x23785c['push'](_0x23785c['shift']());}};_0x2dc080(++_0x1c6e72);}(_0x668a,0x1a4));var _0xa668=function(_0x24bdd4,_0x49bcee){_0x24bdd4=_0x24bdd4-0x0;var _0x557b68=_0x668a[_0x24bdd4];return _0x557b68;};'use strict';var Sequelize=require(_0xa668('0x0'));module['exports']={'name':{'type':Sequelize[_0xa668('0x1')],'allowNull':![],'unique':_0xa668('0x2')},'version':{'type':Sequelize[_0xa668('0x1')],'allowNull':![],'unique':_0xa668('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xa668('0x3')},'filename':{'type':Sequelize[_0xa668('0x1')]},'path':{'type':Sequelize[_0xa668('0x1')]},'type':{'type':Sequelize[_0xa668('0x1')]},'size':{'type':Sequelize[_0xa668('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xa668('0x1')]},'logo':{'type':Sequelize[_0xa668('0x1')]},'state':{'type':Sequelize[_0xa668('0x1')],'unique':'state'},'description':{'type':Sequelize[_0xa668('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xa668('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 4739b7f..86c34f0 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 _0x4b74=['end','json','count','offset','limit','status','set','Content-Range','apply','save','update','then','error','stack','index','Integration','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','key','field','options','includeAll','show','rawAttributes','intersection','include','catch','create','body','find','destroy','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x4b74,0x103));var _0x44b7=function(_0x1dd8e2,_0x35a48e){_0x1dd8e2=_0x1dd8e2-0x0;var _0x3a9741=_0x4b74[_0x1dd8e2];return _0x3a9741;};'use strict';var pdf=require(_0x44b7('0x0'));var emlformat=require(_0x44b7('0x1'));var rimraf=require(_0x44b7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x44b7('0x3'));var rp=require(_0x44b7('0x4'));var moment=require(_0x44b7('0x5'));var BPromise=require(_0x44b7('0x6'));var Mustache=require(_0x44b7('0x7'));var util=require(_0x44b7('0x8'));var path=require(_0x44b7('0x9'));var sox=require(_0x44b7('0xa'));var csv=require('to-csv');var ejs=require(_0x44b7('0xb'));var fs=require('fs');var _=require(_0x44b7('0xc'));var squel=require(_0x44b7('0xd'));var crypto=require('crypto');var jsforce=require(_0x44b7('0xe'));var deskjs=require(_0x44b7('0xf'));var toCsv=require(_0x44b7('0x10'));var querystring=require('querystring');var Papa=require(_0x44b7('0x11'));var authService=require(_0x44b7('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x44b7('0x13'));var qs=require(_0x44b7('0x14'));var logger=require('../../config/logger')(_0x44b7('0x15'));var utils=require(_0x44b7('0x16'));var config=require(_0x44b7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfb9a6d,_0x270ec3){_0x270ec3=_0x270ec3||0xcc;return function(_0x47e9f2){if(_0x47e9f2){return _0xfb9a6d[_0x44b7('0x18')](_0x270ec3);}return _0xfb9a6d['status'](_0x270ec3)[_0x44b7('0x19')]();};}function respondWithResult(_0x1c8a9b,_0x40de5b){_0x40de5b=_0x40de5b||0xc8;return function(_0x4a5bcf){if(_0x4a5bcf){return _0x1c8a9b['status'](_0x40de5b)[_0x44b7('0x1a')](_0x4a5bcf);}};}function respondWithFilteredResult(_0x49c0d3,_0x5ebac8){return function(_0x52419d){if(_0x52419d){var _0x188777=_0x52419d[_0x44b7('0x1b')],_0x58f805=_0x5ebac8[_0x44b7('0x1c')],_0x4bae25=_0x5ebac8[_0x44b7('0x1c')]+_0x5ebac8[_0x44b7('0x1d')],_0x304807;if(_0x4bae25>=_0x188777){_0x4bae25=_0x188777;_0x304807=0xc8;}else{_0x304807=0xce;}_0x49c0d3[_0x44b7('0x1e')](_0x304807);return _0x49c0d3[_0x44b7('0x1f')](_0x44b7('0x20'),_0x58f805+'-'+_0x4bae25+'/'+_0x188777)[_0x44b7('0x1a')](_0x52419d);}return null;};}function patchUpdates(_0x252e87){return function(_0xc5652b){try{jsonpatch[_0x44b7('0x21')](_0xc5652b,_0x252e87,!![]);}catch(_0xee568b){return BPromise['reject'](_0xee568b);}return _0xc5652b[_0x44b7('0x22')]();};}function saveUpdates(_0x1952a1,_0x58f438){return function(_0x361fdc){if(_0x361fdc){return _0x361fdc[_0x44b7('0x23')](_0x1952a1)[_0x44b7('0x24')](function(_0x300eea){return _0x300eea;});}return null;};}function removeEntity(_0x3bad3b,_0x450a59){return function(_0x11a2f1){if(_0x11a2f1){return _0x11a2f1['destroy']()[_0x44b7('0x24')](function(){_0x3bad3b['status'](0xcc)[_0x44b7('0x19')]();});}};}function handleEntityNotFound(_0x24b8d,_0x5f09b4){return function(_0x37a205){if(!_0x37a205){_0x24b8d[_0x44b7('0x18')](0x194);}return _0x37a205;};}function handleError(_0x2eb268,_0x1e0b8d){_0x1e0b8d=_0x1e0b8d||0x1f4;return function(_0x27d96c){logger[_0x44b7('0x25')](_0x27d96c[_0x44b7('0x26')]);if(_0x27d96c['name']){delete _0x27d96c['name'];}_0x2eb268[_0x44b7('0x1e')](_0x1e0b8d)['send'](_0x27d96c);};}exports[_0x44b7('0x27')]=function(_0x5e5f58,_0x568966){var _0x39de72={},_0x1128b1={},_0x15d176={'count':0x0,'rows':[]};var _0xfd9449=db[_0x44b7('0x28')]['rawAttributes'];_0x1128b1[_0x44b7('0x29')]=_[_0x44b7('0x2a')](_0xfd9449);_0x1128b1[_0x44b7('0x2b')]=_[_0x44b7('0x2a')](_0x5e5f58[_0x44b7('0x2b')]);_0x1128b1['filters']=_['intersection'](_0x1128b1['model'],_0x1128b1[_0x44b7('0x2b')]);_0x39de72[_0x44b7('0x2c')]=_['intersection'](_0x1128b1['model'],qs[_0x44b7('0x2d')](_0x5e5f58[_0x44b7('0x2b')][_0x44b7('0x2d')]));_0x39de72[_0x44b7('0x2c')]=_0x39de72[_0x44b7('0x2c')][_0x44b7('0x2e')]?_0x39de72[_0x44b7('0x2c')]:_0x1128b1['model'];if(!_0x5e5f58['query'][_0x44b7('0x2f')](_0x44b7('0x30'))){_0x39de72[_0x44b7('0x1d')]=qs[_0x44b7('0x1d')](_0x5e5f58[_0x44b7('0x2b')][_0x44b7('0x1d')]);_0x39de72['offset']=qs[_0x44b7('0x1c')](_0x5e5f58[_0x44b7('0x2b')][_0x44b7('0x1c')]);}_0x39de72[_0x44b7('0x31')]=qs[_0x44b7('0x32')](_0x5e5f58[_0x44b7('0x2b')][_0x44b7('0x32')]);_0x39de72[_0x44b7('0x33')]=qs[_0x44b7('0x34')](_[_0x44b7('0x35')](_0x5e5f58[_0x44b7('0x2b')],_0x1128b1['filters']));if(_0x5e5f58[_0x44b7('0x2b')][_0x44b7('0x36')]){_0x39de72['where']=_[_0x44b7('0x37')](_0x39de72[_0x44b7('0x33')],{'$or':_[_0x44b7('0x38')](_0xfd9449,function(_0x204578){if(_0x204578['type'][_0x44b7('0x39')]!=='VIRTUAL'){var _0x24db66={};_0x24db66[_0x204578[_0x44b7('0x3a')]]={'$like':'%'+_0x5e5f58[_0x44b7('0x2b')][_0x44b7('0x36')]+'%'};return _0x24db66;}})});}_0x39de72=_['merge']({},_0x39de72,_0x5e5f58[_0x44b7('0x3b')]);var _0x3982d4={'where':_0x39de72[_0x44b7('0x33')]};return db['Integration'][_0x44b7('0x1b')](_0x3982d4)[_0x44b7('0x24')](function(_0x31f304){_0x15d176[_0x44b7('0x1b')]=_0x31f304;if(_0x5e5f58['query'][_0x44b7('0x3c')]){_0x39de72['include']=[{'all':!![]}];}return db[_0x44b7('0x28')]['findAll'](_0x39de72);})[_0x44b7('0x24')](function(_0x3d392f){_0x15d176['rows']=_0x3d392f;return _0x15d176;})['then'](respondWithFilteredResult(_0x568966,_0x39de72))['catch'](handleError(_0x568966,null));};exports[_0x44b7('0x3d')]=function(_0x1b5cee,_0x42c0a7){var _0x23f8ec={'raw':![],'where':{'id':_0x1b5cee['params']['id']}},_0x3549e1={};_0x3549e1[_0x44b7('0x29')]=_['keys'](db[_0x44b7('0x28')][_0x44b7('0x3e')]);_0x3549e1[_0x44b7('0x2b')]=_['keys'](_0x1b5cee[_0x44b7('0x2b')]);_0x3549e1[_0x44b7('0x34')]=_[_0x44b7('0x3f')](_0x3549e1[_0x44b7('0x29')],_0x3549e1[_0x44b7('0x2b')]);_0x23f8ec[_0x44b7('0x2c')]=_[_0x44b7('0x3f')](_0x3549e1['model'],qs['fields'](_0x1b5cee[_0x44b7('0x2b')][_0x44b7('0x2d')]));_0x23f8ec[_0x44b7('0x2c')]=_0x23f8ec[_0x44b7('0x2c')][_0x44b7('0x2e')]?_0x23f8ec[_0x44b7('0x2c')]:_0x3549e1[_0x44b7('0x29')];if(_0x1b5cee[_0x44b7('0x2b')][_0x44b7('0x3c')]){_0x23f8ec[_0x44b7('0x40')]=[{'all':!![]}];}_0x23f8ec=_['merge']({},_0x23f8ec,_0x1b5cee['options']);return db['Integration']['find'](_0x23f8ec)[_0x44b7('0x24')](handleEntityNotFound(_0x42c0a7,null))[_0x44b7('0x24')](respondWithResult(_0x42c0a7,null))[_0x44b7('0x41')](handleError(_0x42c0a7,null));};exports[_0x44b7('0x42')]=function(_0x38e09a,_0x1a3c3e){return db[_0x44b7('0x28')]['create'](_0x38e09a[_0x44b7('0x43')],{})[_0x44b7('0x24')](respondWithResult(_0x1a3c3e,0xc9))[_0x44b7('0x41')](handleError(_0x1a3c3e,null));};exports['update']=function(_0x12d2d1,_0x16531f){if(_0x12d2d1[_0x44b7('0x43')]['id']){delete _0x12d2d1['body']['id'];}return db[_0x44b7('0x28')][_0x44b7('0x44')]({'where':{'id':_0x12d2d1['params']['id']}})[_0x44b7('0x24')](handleEntityNotFound(_0x16531f,null))[_0x44b7('0x24')](saveUpdates(_0x12d2d1[_0x44b7('0x43')],null))[_0x44b7('0x24')](respondWithResult(_0x16531f,null))[_0x44b7('0x41')](handleError(_0x16531f,null));};exports[_0x44b7('0x45')]=function(_0x13f70e,_0x5a88d0){return db[_0x44b7('0x28')][_0x44b7('0x44')]({'where':{'id':_0x13f70e[_0x44b7('0x46')]['id']}})[_0x44b7('0x24')](handleEntityNotFound(_0x5a88d0,null))['then'](removeEntity(_0x5a88d0,null))[_0x44b7('0x41')](handleError(_0x5a88d0,null));}; \ No newline at end of file +var _0xac35=['nolimit','limit','order','sort','pick','where','type','key','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','Integration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xac35,0x141));var _0x5ac3=function(_0x584667,_0x494c5f){_0x584667=_0x584667-0x0;var _0x1393ed=_0xac35[_0x584667];return _0x1393ed;};'use strict';var pdf=require(_0x5ac3('0x0'));var emlformat=require(_0x5ac3('0x1'));var rimraf=require(_0x5ac3('0x2'));var zipdir=require(_0x5ac3('0x3'));var jsonpatch=require(_0x5ac3('0x4'));var rp=require(_0x5ac3('0x5'));var moment=require(_0x5ac3('0x6'));var BPromise=require(_0x5ac3('0x7'));var Mustache=require(_0x5ac3('0x8'));var util=require(_0x5ac3('0x9'));var path=require(_0x5ac3('0xa'));var sox=require(_0x5ac3('0xb'));var csv=require(_0x5ac3('0xc'));var ejs=require(_0x5ac3('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5ac3('0xe'));var crypto=require('crypto');var jsforce=require(_0x5ac3('0xf'));var deskjs=require(_0x5ac3('0x10'));var toCsv=require(_0x5ac3('0xc'));var querystring=require(_0x5ac3('0x11'));var Papa=require(_0x5ac3('0x12'));var authService=require(_0x5ac3('0x13'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x5ac3('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0x5ac3('0x15'))(_0x5ac3('0x16'));var utils=require(_0x5ac3('0x17'));var config=require(_0x5ac3('0x18'));var db=require(_0x5ac3('0x19'))['db'];function respondWithStatusCode(_0x43e407,_0x963aa5){_0x963aa5=_0x963aa5||0xcc;return function(_0x5921c6){if(_0x5921c6){return _0x43e407[_0x5ac3('0x1a')](_0x963aa5);}return _0x43e407[_0x5ac3('0x1b')](_0x963aa5)[_0x5ac3('0x1c')]();};}function respondWithResult(_0x1192d6,_0x297c33){_0x297c33=_0x297c33||0xc8;return function(_0x24ed02){if(_0x24ed02){return _0x1192d6[_0x5ac3('0x1b')](_0x297c33)[_0x5ac3('0x1d')](_0x24ed02);}};}function respondWithFilteredResult(_0x5b64a8,_0x585770){return function(_0x3926d0){if(_0x3926d0){var _0x388da8=_0x3926d0[_0x5ac3('0x1e')],_0x516c97=_0x585770[_0x5ac3('0x1f')],_0x2eec4a=_0x585770[_0x5ac3('0x1f')]+_0x585770['limit'],_0x4b718a;if(_0x2eec4a>=_0x388da8){_0x2eec4a=_0x388da8;_0x4b718a=0xc8;}else{_0x4b718a=0xce;}_0x5b64a8[_0x5ac3('0x1b')](_0x4b718a);return _0x5b64a8[_0x5ac3('0x20')](_0x5ac3('0x21'),_0x516c97+'-'+_0x2eec4a+'/'+_0x388da8)[_0x5ac3('0x1d')](_0x3926d0);}return null;};}function patchUpdates(_0x5aab00){return function(_0x22907d){try{jsonpatch[_0x5ac3('0x22')](_0x22907d,_0x5aab00,!![]);}catch(_0x16ca9a){return BPromise[_0x5ac3('0x23')](_0x16ca9a);}return _0x22907d[_0x5ac3('0x24')]();};}function saveUpdates(_0xeb7dea,_0x2039b1){return function(_0x2fcc26){if(_0x2fcc26){return _0x2fcc26[_0x5ac3('0x25')](_0xeb7dea)[_0x5ac3('0x26')](function(_0xe65817){return _0xe65817;});}return null;};}function removeEntity(_0x38486d,_0x579d76){return function(_0x462b1d){if(_0x462b1d){return _0x462b1d[_0x5ac3('0x27')]()[_0x5ac3('0x26')](function(){_0x38486d[_0x5ac3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11915f,_0x1e28f6){return function(_0x2aa7c9){if(!_0x2aa7c9){_0x11915f[_0x5ac3('0x1a')](0x194);}return _0x2aa7c9;};}function handleError(_0x5ec3fc,_0x1eb39c){_0x1eb39c=_0x1eb39c||0x1f4;return function(_0x567807){logger[_0x5ac3('0x28')](_0x567807['stack']);if(_0x567807['name']){delete _0x567807[_0x5ac3('0x29')];}_0x5ec3fc[_0x5ac3('0x1b')](_0x1eb39c)['send'](_0x567807);};}exports[_0x5ac3('0x2a')]=function(_0x3912f6,_0x2fd301){var _0x1f563e={},_0x4af783={},_0x452519={'count':0x0,'rows':[]};var _0x228deb=db[_0x5ac3('0x2b')][_0x5ac3('0x2c')];_0x4af783[_0x5ac3('0x2d')]=_[_0x5ac3('0x2e')](_0x228deb);_0x4af783[_0x5ac3('0x2f')]=_['keys'](_0x3912f6[_0x5ac3('0x2f')]);_0x4af783[_0x5ac3('0x30')]=_[_0x5ac3('0x31')](_0x4af783['model'],_0x4af783[_0x5ac3('0x2f')]);_0x1f563e[_0x5ac3('0x32')]=_[_0x5ac3('0x31')](_0x4af783['model'],qs[_0x5ac3('0x33')](_0x3912f6['query'][_0x5ac3('0x33')]));_0x1f563e['attributes']=_0x1f563e[_0x5ac3('0x32')][_0x5ac3('0x34')]?_0x1f563e['attributes']:_0x4af783['model'];if(!_0x3912f6['query'][_0x5ac3('0x35')](_0x5ac3('0x36'))){_0x1f563e['limit']=qs[_0x5ac3('0x37')](_0x3912f6[_0x5ac3('0x2f')][_0x5ac3('0x37')]);_0x1f563e[_0x5ac3('0x1f')]=qs[_0x5ac3('0x1f')](_0x3912f6[_0x5ac3('0x2f')]['offset']);}_0x1f563e[_0x5ac3('0x38')]=qs[_0x5ac3('0x39')](_0x3912f6[_0x5ac3('0x2f')][_0x5ac3('0x39')]);_0x1f563e['where']=qs['filters'](_[_0x5ac3('0x3a')](_0x3912f6['query'],_0x4af783[_0x5ac3('0x30')]));if(_0x3912f6[_0x5ac3('0x2f')]['filter']){_0x1f563e[_0x5ac3('0x3b')]=_['merge'](_0x1f563e[_0x5ac3('0x3b')],{'$or':_['map'](_0x228deb,function(_0x4fe034){if(_0x4fe034[_0x5ac3('0x3c')][_0x5ac3('0x3d')]!==_0x5ac3('0x3e')){var _0x301cf6={};_0x301cf6[_0x4fe034['field']]={'$like':'%'+_0x3912f6[_0x5ac3('0x2f')]['filter']+'%'};return _0x301cf6;}})});}_0x1f563e=_[_0x5ac3('0x3f')]({},_0x1f563e,_0x3912f6[_0x5ac3('0x40')]);var _0x264c12={'where':_0x1f563e[_0x5ac3('0x3b')]};return db[_0x5ac3('0x2b')]['count'](_0x264c12)[_0x5ac3('0x26')](function(_0x101fd3){_0x452519[_0x5ac3('0x1e')]=_0x101fd3;if(_0x3912f6[_0x5ac3('0x2f')][_0x5ac3('0x41')]){_0x1f563e[_0x5ac3('0x42')]=[{'all':!![]}];}return db[_0x5ac3('0x2b')][_0x5ac3('0x43')](_0x1f563e);})[_0x5ac3('0x26')](function(_0x5cba25){_0x452519[_0x5ac3('0x44')]=_0x5cba25;return _0x452519;})[_0x5ac3('0x26')](respondWithFilteredResult(_0x2fd301,_0x1f563e))[_0x5ac3('0x45')](handleError(_0x2fd301,null));};exports[_0x5ac3('0x46')]=function(_0x5bd8e6,_0x20c16c){var _0x35155b={'raw':![],'where':{'id':_0x5bd8e6['params']['id']}},_0x4fddb2={};_0x4fddb2[_0x5ac3('0x2d')]=_[_0x5ac3('0x2e')](db[_0x5ac3('0x2b')]['rawAttributes']);_0x4fddb2[_0x5ac3('0x2f')]=_[_0x5ac3('0x2e')](_0x5bd8e6[_0x5ac3('0x2f')]);_0x4fddb2[_0x5ac3('0x30')]=_[_0x5ac3('0x31')](_0x4fddb2[_0x5ac3('0x2d')],_0x4fddb2[_0x5ac3('0x2f')]);_0x35155b[_0x5ac3('0x32')]=_[_0x5ac3('0x31')](_0x4fddb2[_0x5ac3('0x2d')],qs[_0x5ac3('0x33')](_0x5bd8e6[_0x5ac3('0x2f')][_0x5ac3('0x33')]));_0x35155b['attributes']=_0x35155b['attributes']['length']?_0x35155b['attributes']:_0x4fddb2['model'];if(_0x5bd8e6['query'][_0x5ac3('0x41')]){_0x35155b[_0x5ac3('0x42')]=[{'all':!![]}];}_0x35155b=_[_0x5ac3('0x3f')]({},_0x35155b,_0x5bd8e6['options']);return db[_0x5ac3('0x2b')][_0x5ac3('0x47')](_0x35155b)[_0x5ac3('0x26')](handleEntityNotFound(_0x20c16c,null))[_0x5ac3('0x26')](respondWithResult(_0x20c16c,null))[_0x5ac3('0x45')](handleError(_0x20c16c,null));};exports['create']=function(_0x310d9c,_0x402d38){return db[_0x5ac3('0x2b')][_0x5ac3('0x48')](_0x310d9c[_0x5ac3('0x49')],{})['then'](respondWithResult(_0x402d38,0xc9))[_0x5ac3('0x45')](handleError(_0x402d38,null));};exports[_0x5ac3('0x25')]=function(_0x2a1c1b,_0x20c46d){if(_0x2a1c1b['body']['id']){delete _0x2a1c1b[_0x5ac3('0x49')]['id'];}return db[_0x5ac3('0x2b')][_0x5ac3('0x47')]({'where':{'id':_0x2a1c1b[_0x5ac3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x20c46d,null))[_0x5ac3('0x26')](saveUpdates(_0x2a1c1b[_0x5ac3('0x49')],null))[_0x5ac3('0x26')](respondWithResult(_0x20c46d,null))[_0x5ac3('0x45')](handleError(_0x20c46d,null));};exports[_0x5ac3('0x27')]=function(_0x3a421f,_0x6293c3){return db['Integration']['find']({'where':{'id':_0x3a421f[_0x5ac3('0x4a')]['id']}})[_0x5ac3('0x26')](handleEntityNotFound(_0x6293c3,null))[_0x5ac3('0x26')](removeEntity(_0x6293c3,null))[_0x5ac3('0x45')](handleError(_0x6293c3,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index eaf3397..b7b631f 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 _0xadb5=['Integration','integrations','util','api','moment','bluebird','./integration.attributes','exports','define'];(function(_0x59578b,_0x1f3530){var _0xdc473b=function(_0x8a35ef){while(--_0x8a35ef){_0x59578b['push'](_0x59578b['shift']());}};_0xdc473b(++_0x1f3530);}(_0xadb5,0xad));var _0x5adb=function(_0x333e0c,_0x33237a){_0x333e0c=_0x333e0c-0x0;var _0x25ef73=_0xadb5[_0x333e0c];return _0x25ef73;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var attributes=require(_0x5adb('0x4'));module[_0x5adb('0x5')]=function(_0x2e3ef4,_0x4cb1d1){return _0x2e3ef4[_0x5adb('0x6')](_0x5adb('0x7'),attributes,{'tableName':_0x5adb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['util','../../config/logger','api','moment','bluebird','request-promise','./integration.attributes','exports','define','Integration','integrations','lodash'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4b110b,_0x3f153f){_0x4b110b=_0x4b110b-0x0;var _0xfef83=_0xc6ac[_0x4b110b];return _0xfef83;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var attributes=require(_0xcc6a('0x7'));module[_0xcc6a('0x8')]=function(_0x22ee99,_0x2f26ab){return _0x22ee99[_0xcc6a('0x9')](_0xcc6a('0xa'),attributes,{'tableName':_0xcc6a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 7f38340..266cc81 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 _0xc3d5=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x30c306,_0x39eba9){var _0x3e6173=function(_0x50fc9e){while(--_0x50fc9e){_0x30c306['push'](_0x30c306['shift']());}};_0x3e6173(++_0x39eba9);}(_0xc3d5,0xf3));var _0x5c3d=function(_0x1a4dd7,_0x5487e5){_0x1a4dd7=_0x1a4dd7-0x0;var _0x48c2af=_0xc3d5[_0x1a4dd7];return _0x48c2af;};'use strict';var _=require('lodash');var util=require(_0x5c3d('0x0'));var moment=require(_0x5c3d('0x1'));var BPromise=require(_0x5c3d('0x2'));var rs=require(_0x5c3d('0x3'));var fs=require('fs');var Redis=require(_0x5c3d('0x4'));var db=require(_0x5c3d('0x5'))['db'];var utils=require(_0x5c3d('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5c3d('0x7'));var client=jayson[_0x5c3d('0x8')][_0x5c3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f1654,_0x2a0ea4,_0x2b6078){return new BPromise(function(_0x41aacc,_0x17bfe1){return client[_0x5c3d('0xa')](_0x1f1654,_0x2b6078)[_0x5c3d('0xb')](function(_0x37d225){logger[_0x5c3d('0xc')](_0x5c3d('0xd'),_0x2a0ea4,'request\x20sent');logger[_0x5c3d('0xe')](_0x5c3d('0xf'),_0x2a0ea4,'request\x20sent',JSON['stringify'](_0x37d225));if(_0x37d225[_0x5c3d('0x10')]){if(_0x37d225[_0x5c3d('0x10')][_0x5c3d('0x11')]===0x1f4){logger[_0x5c3d('0x10')]('Integration,\x20%s,\x20%s',_0x2a0ea4,_0x37d225[_0x5c3d('0x10')]['message']);return _0x17bfe1(_0x37d225[_0x5c3d('0x10')][_0x5c3d('0x12')]);}logger['error']('Integration,\x20%s,\x20%s',_0x2a0ea4,_0x37d225['error']['message']);return _0x41aacc(_0x37d225[_0x5c3d('0x10')][_0x5c3d('0x12')]);}else{logger[_0x5c3d('0xc')](_0x5c3d('0xd'),_0x2a0ea4,'request\x20sent');_0x41aacc(_0x37d225[_0x5c3d('0x13')]['message']);}})[_0x5c3d('0x14')](function(_0x266d74){logger[_0x5c3d('0x10')]('Integration,\x20%s,\x20%s',_0x2a0ea4,_0x266d74);_0x17bfe1(_0x266d74);});});} \ No newline at end of file +var _0x360b=['Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x392be3,_0xf1d603){var _0x1453b2=function(_0x5bdce8){while(--_0x5bdce8){_0x392be3['push'](_0x392be3['shift']());}};_0x1453b2(++_0xf1d603);}(_0x360b,0x15e));var _0xb360=function(_0x45e64b,_0x12a3c5){_0x45e64b=_0x45e64b-0x0;var _0x6f59e=_0x360b[_0x45e64b];return _0x6f59e;};'use strict';var _=require('lodash');var util=require(_0xb360('0x0'));var moment=require(_0xb360('0x1'));var BPromise=require(_0xb360('0x2'));var rs=require(_0xb360('0x3'));var fs=require('fs');var Redis=require(_0xb360('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb360('0x5'));var config=require(_0xb360('0x6'));var jayson=require(_0xb360('0x7'));var client=jayson[_0xb360('0x8')][_0xb360('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bdd74,_0x23ae09,_0x1dd1fa){return new BPromise(function(_0x29af3d,_0x236618){return client['request'](_0x5bdd74,_0x1dd1fa)['then'](function(_0x387620){logger[_0xb360('0xa')]('Integration,\x20%s,\x20%s',_0x23ae09,'request\x20sent');logger['debug'](_0xb360('0xb'),_0x23ae09,_0xb360('0xc'),JSON[_0xb360('0xd')](_0x387620));if(_0x387620[_0xb360('0xe')]){if(_0x387620[_0xb360('0xe')]['code']===0x1f4){logger[_0xb360('0xe')](_0xb360('0xf'),_0x23ae09,_0x387620[_0xb360('0xe')]['message']);return _0x236618(_0x387620[_0xb360('0xe')]['message']);}logger[_0xb360('0xe')](_0xb360('0xf'),_0x23ae09,_0x387620['error'][_0xb360('0x10')]);return _0x29af3d(_0x387620['error'][_0xb360('0x10')]);}else{logger[_0xb360('0xa')](_0xb360('0xf'),_0x23ae09,_0xb360('0xc'));_0x29af3d(_0x387620[_0xb360('0x11')][_0xb360('0x10')]);}})[_0xb360('0x12')](function(_0x1656f9){logger[_0xb360('0xe')](_0xb360('0xf'),_0x23ae09,_0x1656f9);_0x236618(_0x1656f9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 33d8c4e..f89fb16 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 _0xe802=['../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','util','connect-timeout','express','Router'];(function(_0x5764c8,_0x297ec8){var _0x4ea1a9=function(_0x1d5394){while(--_0x1d5394){_0x5764c8['push'](_0x5764c8['shift']());}};_0x4ea1a9(++_0x297ec8);}(_0xe802,0xc2));var _0x2e80=function(_0x3227cb,_0x20876c){_0x3227cb=_0x3227cb-0x0;var _0x4625c5=_0xe802[_0x3227cb];return _0x4625c5;};'use strict';var multer=require('multer');var util=require(_0x2e80('0x0'));var path=require('path');var timeout=require(_0x2e80('0x1'));var express=require(_0x2e80('0x2'));var router=express[_0x2e80('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2e80('0x4'));var config=require('../../config/environment');var controller=require(_0x2e80('0x5'));router[_0x2e80('0x6')]('/',auth[_0x2e80('0x7')](),controller[_0x2e80('0x8')]);router[_0x2e80('0x6')](_0x2e80('0x9'),auth[_0x2e80('0x7')](),controller[_0x2e80('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2e80('0xb')]);router[_0x2e80('0xc')]('/',auth[_0x2e80('0x7')](),controller[_0x2e80('0xd')]);router[_0x2e80('0xe')](_0x2e80('0xf'),auth[_0x2e80('0x7')](),controller[_0x2e80('0x10')]);router['delete'](_0x2e80('0xf'),auth[_0x2e80('0x7')](),controller[_0x2e80('0x11')]);module['exports']=router; \ No newline at end of file +var _0xefbb=['/describe','/:id','show','post','create','put','update','exports','multer','connect-timeout','Router','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index'];(function(_0x2d33ca,_0x2b7361){var _0x5e61fb=function(_0xc91342){while(--_0xc91342){_0x2d33ca['push'](_0x2d33ca['shift']());}};_0x5e61fb(++_0x2b7361);}(_0xefbb,0x198));var _0xbefb=function(_0x391bf8,_0x4316a8){_0x391bf8=_0x391bf8-0x0;var _0x4f694d=_0xefbb[_0x391bf8];return _0x4f694d;};'use strict';var multer=require(_0xbefb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbefb('0x1'));var express=require('express');var router=express[_0xbefb('0x2')]();var auth=require(_0xbefb('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbefb('0x4'));router[_0xbefb('0x5')]('/',auth[_0xbefb('0x6')](),controller[_0xbefb('0x7')]);router['get'](_0xbefb('0x8'),auth[_0xbefb('0x6')](),controller['describe']);router[_0xbefb('0x5')](_0xbefb('0x9'),auth[_0xbefb('0x6')](),controller[_0xbefb('0xa')]);router[_0xbefb('0xb')]('/',auth['isAuthenticated'](),controller[_0xbefb('0xc')]);router[_0xbefb('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xbefb('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xbefb('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7eb66bc..42b53de 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 _0xb408=['SENDING','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x56cd77,_0x26ea2b){var _0x3426d6=function(_0x4bdb67){while(--_0x4bdb67){_0x56cd77['push'](_0x56cd77['shift']());}};_0x3426d6(++_0x26ea2b);}(_0xb408,0x155));var _0x8b40=function(_0x434f82,_0x47d21a){_0x434f82=_0x434f82-0x0;var _0x439855=_0xb408[_0x434f82];return _0x439855;};'use strict';var Sequelize=require(_0x8b40('0x0'));module[_0x8b40('0x1')]={'integration':{'type':Sequelize[_0x8b40('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x8b40('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x8b40('0x3')]},'contacts':{'type':Sequelize[_0x8b40('0x2')]},'uniqueid':{'type':Sequelize[_0x8b40('0x2')]},'calleridnum':{'type':Sequelize[_0x8b40('0x2')]},'calleridname':{'type':Sequelize[_0x8b40('0x2')]},'queue':{'type':Sequelize[_0x8b40('0x2')]},'interface':{'type':Sequelize[_0x8b40('0x2')]},'membername':{'type':Sequelize[_0x8b40('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8b40('0x4')]},'agentconnectAt':{'type':Sequelize[_0x8b40('0x4')]},'holdtime':{'type':Sequelize[_0x8b40('0x3')]},'agentcomplete':{'type':Sequelize[_0x8b40('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8b40('0x4')]},'talktime':{'type':Sequelize[_0x8b40('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8b40('0x3')]},'reason':{'type':Sequelize[_0x8b40('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x8b40('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8b40('0x4')]},'agentdump':{'type':Sequelize[_0x8b40('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8b40('0x4')]},'lastevent':{'type':Sequelize[_0x8b40('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x8b40('0x3')]},'channelstatedesc':{'type':Sequelize[_0x8b40('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8b40('0x2')]},'connectedlinename':{'type':Sequelize[_0x8b40('0x2')]},'language':{'type':Sequelize[_0x8b40('0x2')]},'accountcode':{'type':Sequelize[_0x8b40('0x2')]},'context':{'type':Sequelize[_0x8b40('0x2')]},'exten':{'type':Sequelize[_0x8b40('0x2')]},'priority':{'type':Sequelize[_0x8b40('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8b40('0x2')]},'destcalleridname':{'type':Sequelize[_0x8b40('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8b40('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x8b40('0x2')]},'destlanguage':{'type':Sequelize[_0x8b40('0x2')]},'destaccountcode':{'type':Sequelize[_0x8b40('0x2')]},'destcontext':{'type':Sequelize[_0x8b40('0x2')]},'destexten':{'type':Sequelize[_0x8b40('0x2')]},'destpriority':{'type':Sequelize[_0x8b40('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x8b40('0x2')]},'inReplyTo':{'type':Sequelize[_0x8b40('0x2')]},'subject':{'type':Sequelize[_0x8b40('0x2')]},'from':{'type':Sequelize[_0x8b40('0x2')]},'to':{'type':Sequelize[_0x8b40('0x2')]},'cc':{'type':Sequelize[_0x8b40('0x2')]},'attachment':{'type':Sequelize[_0x8b40('0x6')]},'html':{'type':Sequelize[_0x8b40('0x6')]},'text':{'type':Sequelize[_0x8b40('0x6')]},'status':{'type':Sequelize[_0x8b40('0x7')](_0x8b40('0x8'),_0x8b40('0x9'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x8b40('0x2')]},'app':{'type':Sequelize[_0x8b40('0x2')]},'appdata':{'type':Sequelize[_0x8b40('0x2')]},'projectId':{'type':Sequelize[_0x8b40('0x3')]}}; \ No newline at end of file +var _0x7e98=['STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','sequelize'];(function(_0x5d0d11,_0x2e08aa){var _0x3da643=function(_0x113956){while(--_0x113956){_0x5d0d11['push'](_0x5d0d11['shift']());}};_0x3da643(++_0x2e08aa);}(_0x7e98,0x8f));var _0x87e9=function(_0x544f8b,_0x5a5223){_0x544f8b=_0x544f8b-0x0;var _0x7601c6=_0x7e98[_0x544f8b];return _0x7601c6;};'use strict';var Sequelize=require(_0x87e9('0x0'));module['exports']={'integration':{'type':Sequelize[_0x87e9('0x1')]},'eventChannel':{'type':Sequelize[_0x87e9('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x87e9('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x87e9('0x1')]},'uniqueid':{'type':Sequelize[_0x87e9('0x1')]},'calleridnum':{'type':Sequelize[_0x87e9('0x1')]},'calleridname':{'type':Sequelize[_0x87e9('0x1')]},'queue':{'type':Sequelize[_0x87e9('0x1')]},'interface':{'type':Sequelize[_0x87e9('0x1')]},'membername':{'type':Sequelize[_0x87e9('0x1')]},'agentcalledAt':{'type':Sequelize[_0x87e9('0x2')]},'agentconnectAt':{'type':Sequelize[_0x87e9('0x2')]},'holdtime':{'type':Sequelize[_0x87e9('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x87e9('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x87e9('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x87e9('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x87e9('0x2')]},'agentdump':{'type':Sequelize[_0x87e9('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x87e9('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x87e9('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x87e9('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x87e9('0x1')]},'exten':{'type':Sequelize[_0x87e9('0x1')]},'priority':{'type':Sequelize[_0x87e9('0x1')]},'destchannel':{'type':Sequelize[_0x87e9('0x1')]},'destchannelstate':{'type':Sequelize[_0x87e9('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x87e9('0x1')]},'destcalleridnum':{'type':Sequelize[_0x87e9('0x1')]},'destcalleridname':{'type':Sequelize[_0x87e9('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x87e9('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x87e9('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x87e9('0x1')]},'destcontext':{'type':Sequelize[_0x87e9('0x1')]},'destexten':{'type':Sequelize[_0x87e9('0x1')]},'destpriority':{'type':Sequelize[_0x87e9('0x1')]},'destuniqueid':{'type':Sequelize[_0x87e9('0x1')]},'messageId':{'type':Sequelize[_0x87e9('0x1')]},'inReplyTo':{'type':Sequelize[_0x87e9('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x87e9('0x1')]},'to':{'type':Sequelize[_0x87e9('0x1')]},'cc':{'type':Sequelize[_0x87e9('0x1')]},'attachment':{'type':Sequelize[_0x87e9('0x5')]},'html':{'type':Sequelize[_0x87e9('0x5')]},'text':{'type':Sequelize[_0x87e9('0x5')]},'status':{'type':Sequelize[_0x87e9('0x6')](_0x87e9('0x7'),'SENDING',_0x87e9('0x8'),'FAILED')},'url':{'type':Sequelize[_0x87e9('0x1')]},'app':{'type':Sequelize[_0x87e9('0x1')]},'appdata':{'type':Sequelize[_0x87e9('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index de02bbe..66f1f41 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 _0x675e=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','index','IntegrationReport','rawAttributes','model','keys','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','field','options','then','includeAll','include','catch','show','params','find','create','update','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs'];(function(_0x52fd8e,_0x19909e){var _0x600ce1=function(_0x53c4c6){while(--_0x53c4c6){_0x52fd8e['push'](_0x52fd8e['shift']());}};_0x600ce1(++_0x19909e);}(_0x675e,0xbd));var _0xe675=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x675e[_0x2dd390];return _0x3afe47;};'use strict';var pdf=require(_0xe675('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe675('0x1'));var zipdir=require(_0xe675('0x2'));var jsonpatch=require(_0xe675('0x3'));var rp=require('request-promise');var moment=require(_0xe675('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe675('0x5'));var path=require(_0xe675('0x6'));var sox=require(_0xe675('0x7'));var csv=require(_0xe675('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe675('0x9'));var squel=require(_0xe675('0xa'));var crypto=require('crypto');var jsforce=require(_0xe675('0xb'));var deskjs=require(_0xe675('0xc'));var toCsv=require(_0xe675('0x8'));var querystring=require('querystring');var Papa=require(_0xe675('0xd'));var authService=require(_0xe675('0xe'));var hardwareService=require(_0xe675('0xf'));var Redis=require(_0xe675('0x10'));var qs=require(_0xe675('0x11'));var logger=require(_0xe675('0x12'))(_0xe675('0x13'));var utils=require('../../config/utils');var config=require(_0xe675('0x14'));var db=require(_0xe675('0x15'))['db'];function respondWithStatusCode(_0x4ae721,_0xa51590){_0xa51590=_0xa51590||0xcc;return function(_0x57a939){if(_0x57a939){return _0x4ae721[_0xe675('0x16')](_0xa51590);}return _0x4ae721[_0xe675('0x17')](_0xa51590)[_0xe675('0x18')]();};}function respondWithResult(_0x886d40,_0x58cc6d){_0x58cc6d=_0x58cc6d||0xc8;return function(_0x4dddbf){if(_0x4dddbf){return _0x886d40[_0xe675('0x17')](_0x58cc6d)[_0xe675('0x19')](_0x4dddbf);}};}function respondWithFilteredResult(_0x2b9c22,_0x49425b){return function(_0x96e952){if(_0x96e952){var _0x2f1719=_0x96e952[_0xe675('0x1a')],_0x1ecb87=_0x49425b[_0xe675('0x1b')],_0x5dd62b=_0x49425b[_0xe675('0x1b')]+_0x49425b[_0xe675('0x1c')],_0xab5f96;if(_0x5dd62b>=_0x2f1719){_0x5dd62b=_0x2f1719;_0xab5f96=0xc8;}else{_0xab5f96=0xce;}_0x2b9c22[_0xe675('0x17')](_0xab5f96);return _0x2b9c22[_0xe675('0x1d')](_0xe675('0x1e'),_0x1ecb87+'-'+_0x5dd62b+'/'+_0x2f1719)[_0xe675('0x19')](_0x96e952);}return null;};}function patchUpdates(_0x33dcec){return function(_0x2aa2f3){try{jsonpatch['apply'](_0x2aa2f3,_0x33dcec,!![]);}catch(_0x3b0f4a){return BPromise[_0xe675('0x1f')](_0x3b0f4a);}return _0x2aa2f3[_0xe675('0x20')]();};}function saveUpdates(_0x37dac2,_0x188160){return function(_0x561b88){if(_0x561b88){return _0x561b88['update'](_0x37dac2)['then'](function(_0x325b82){return _0x325b82;});}return null;};}function removeEntity(_0x1104e8,_0x52d1b8){return function(_0x2e4bc3){if(_0x2e4bc3){return _0x2e4bc3[_0xe675('0x21')]()['then'](function(){_0x1104e8['status'](0xcc)[_0xe675('0x18')]();});}};}function handleEntityNotFound(_0xd73197,_0x2b92a9){return function(_0x5e4d99){if(!_0x5e4d99){_0xd73197[_0xe675('0x16')](0x194);}return _0x5e4d99;};}function handleError(_0x52df22,_0x5280b1){_0x5280b1=_0x5280b1||0x1f4;return function(_0x8f8344){logger['error'](_0x8f8344[_0xe675('0x22')]);if(_0x8f8344[_0xe675('0x23')]){delete _0x8f8344[_0xe675('0x23')];}_0x52df22[_0xe675('0x17')](_0x5280b1)[_0xe675('0x24')](_0x8f8344);};}exports[_0xe675('0x25')]=function(_0x4de842,_0x3f346a){var _0x2b838c={},_0x3d0fdc={},_0x49645e={'count':0x0,'rows':[]};var _0x299874=db[_0xe675('0x26')][_0xe675('0x27')];_0x3d0fdc[_0xe675('0x28')]=_[_0xe675('0x29')](_0x299874);_0x3d0fdc['query']=_['keys'](_0x4de842['query']);_0x3d0fdc['filters']=_[_0xe675('0x2a')](_0x3d0fdc[_0xe675('0x28')],_0x3d0fdc['query']);_0x2b838c[_0xe675('0x2b')]=_['intersection'](_0x3d0fdc['model'],qs[_0xe675('0x2c')](_0x4de842['query']['fields']));_0x2b838c['attributes']=_0x2b838c[_0xe675('0x2b')]['length']?_0x2b838c[_0xe675('0x2b')]:_0x3d0fdc[_0xe675('0x28')];if(!_0x4de842[_0xe675('0x2d')][_0xe675('0x2e')](_0xe675('0x2f'))){_0x2b838c[_0xe675('0x1c')]=qs[_0xe675('0x1c')](_0x4de842[_0xe675('0x2d')][_0xe675('0x1c')]);_0x2b838c[_0xe675('0x1b')]=qs[_0xe675('0x1b')](_0x4de842['query'][_0xe675('0x1b')]);}_0x2b838c['order']=qs['sort'](_0x4de842[_0xe675('0x2d')][_0xe675('0x30')]);_0x2b838c[_0xe675('0x31')]=qs[_0xe675('0x32')](_[_0xe675('0x33')](_0x4de842['query'],_0x3d0fdc[_0xe675('0x32')]));if(_0x4de842[_0xe675('0x2d')][_0xe675('0x34')]){_0x2b838c[_0xe675('0x31')]=_[_0xe675('0x35')](_0x2b838c[_0xe675('0x31')],{'$or':_[_0xe675('0x36')](_0x299874,function(_0x19e9f3){if(_0x19e9f3[_0xe675('0x37')]['key']!==_0xe675('0x38')){var _0x4bff53={};_0x4bff53[_0x19e9f3[_0xe675('0x39')]]={'$like':'%'+_0x4de842[_0xe675('0x2d')][_0xe675('0x34')]+'%'};return _0x4bff53;}})});}_0x2b838c=_[_0xe675('0x35')]({},_0x2b838c,_0x4de842[_0xe675('0x3a')]);var _0x2ed208={'where':_0x2b838c['where']};return db['IntegrationReport'][_0xe675('0x1a')](_0x2ed208)[_0xe675('0x3b')](function(_0x355dfa){_0x49645e['count']=_0x355dfa;if(_0x4de842[_0xe675('0x2d')][_0xe675('0x3c')]){_0x2b838c[_0xe675('0x3d')]=[{'all':!![]}];}return db[_0xe675('0x26')]['findAll'](_0x2b838c);})['then'](function(_0x553a24){_0x49645e['rows']=_0x553a24;return _0x49645e;})['then'](respondWithFilteredResult(_0x3f346a,_0x2b838c))[_0xe675('0x3e')](handleError(_0x3f346a,null));};exports[_0xe675('0x3f')]=function(_0x2653c5,_0x3949e1){var _0x571783={'raw':![],'where':{'id':_0x2653c5[_0xe675('0x40')]['id']}},_0x226c20={};_0x226c20[_0xe675('0x28')]=_[_0xe675('0x29')](db[_0xe675('0x26')][_0xe675('0x27')]);_0x226c20[_0xe675('0x2d')]=_['keys'](_0x2653c5[_0xe675('0x2d')]);_0x226c20[_0xe675('0x32')]=_['intersection'](_0x226c20[_0xe675('0x28')],_0x226c20[_0xe675('0x2d')]);_0x571783['attributes']=_['intersection'](_0x226c20[_0xe675('0x28')],qs[_0xe675('0x2c')](_0x2653c5['query'][_0xe675('0x2c')]));_0x571783['attributes']=_0x571783[_0xe675('0x2b')]['length']?_0x571783[_0xe675('0x2b')]:_0x226c20['model'];if(_0x2653c5[_0xe675('0x2d')][_0xe675('0x3c')]){_0x571783[_0xe675('0x3d')]=[{'all':!![]}];}_0x571783=_[_0xe675('0x35')]({},_0x571783,_0x2653c5[_0xe675('0x3a')]);return db[_0xe675('0x26')][_0xe675('0x41')](_0x571783)[_0xe675('0x3b')](handleEntityNotFound(_0x3949e1,null))[_0xe675('0x3b')](respondWithResult(_0x3949e1,null))['catch'](handleError(_0x3949e1,null));};exports[_0xe675('0x42')]=function(_0x25d385,_0x17b1c3){return db['IntegrationReport']['create'](_0x25d385['body'],{})['then'](respondWithResult(_0x17b1c3,0xc9))['catch'](handleError(_0x17b1c3,null));};exports[_0xe675('0x43')]=function(_0x454c78,_0x5c1488){if(_0x454c78['body']['id']){delete _0x454c78['body']['id'];}return db[_0xe675('0x26')][_0xe675('0x41')]({'where':{'id':_0x454c78[_0xe675('0x40')]['id']}})[_0xe675('0x3b')](handleEntityNotFound(_0x5c1488,null))[_0xe675('0x3b')](saveUpdates(_0x454c78[_0xe675('0x44')],null))[_0xe675('0x3b')](respondWithResult(_0x5c1488,null))[_0xe675('0x3e')](handleError(_0x5c1488,null));};exports['destroy']=function(_0x4acb21,_0x160338){return db['IntegrationReport'][_0xe675('0x41')]({'where':{'id':_0x4acb21['params']['id']}})['then'](handleEntityNotFound(_0x160338,null))[_0xe675('0x3b')](removeEntity(_0x160338,null))[_0xe675('0x3e')](handleError(_0x160338,null));};exports['describe']=function(_0x34a5d1,_0x6096aa){return db[_0xe675('0x26')]['describe']()['then'](respondWithResult(_0x6096aa,null))['catch'](handleError(_0x6096aa,null));}; \ No newline at end of file +var _0x6aab=['ioredis','../../components/parsers/qs','../../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','send','index','IntegrationReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','key','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware'];(function(_0x513ba6,_0x3384b9){var _0x22419e=function(_0x5b431b){while(--_0x5b431b){_0x513ba6['push'](_0x513ba6['shift']());}};_0x22419e(++_0x3384b9);}(_0x6aab,0x173));var _0xb6aa=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x6aab[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require(_0xb6aa('0x0'));var emlformat=require(_0xb6aa('0x1'));var rimraf=require(_0xb6aa('0x2'));var zipdir=require(_0xb6aa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6aa('0x4'));var moment=require(_0xb6aa('0x5'));var BPromise=require(_0xb6aa('0x6'));var Mustache=require('mustache');var util=require(_0xb6aa('0x7'));var path=require(_0xb6aa('0x8'));var sox=require(_0xb6aa('0x9'));var csv=require(_0xb6aa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb6aa('0xb'));var crypto=require(_0xb6aa('0xc'));var jsforce=require(_0xb6aa('0xd'));var deskjs=require(_0xb6aa('0xe'));var toCsv=require(_0xb6aa('0xa'));var querystring=require(_0xb6aa('0xf'));var Papa=require(_0xb6aa('0x10'));var authService=require(_0xb6aa('0x11'));var hardwareService=require(_0xb6aa('0x12'));var Redis=require(_0xb6aa('0x13'));var qs=require(_0xb6aa('0x14'));var logger=require(_0xb6aa('0x15'))(_0xb6aa('0x16'));var utils=require(_0xb6aa('0x17'));var config=require(_0xb6aa('0x18'));var db=require(_0xb6aa('0x19'))['db'];function respondWithStatusCode(_0x25ef68,_0xc8f518){_0xc8f518=_0xc8f518||0xcc;return function(_0x2e70c6){if(_0x2e70c6){return _0x25ef68[_0xb6aa('0x1a')](_0xc8f518);}return _0x25ef68['status'](_0xc8f518)[_0xb6aa('0x1b')]();};}function respondWithResult(_0xf5a8eb,_0x17c427){_0x17c427=_0x17c427||0xc8;return function(_0x49cab7){if(_0x49cab7){return _0xf5a8eb[_0xb6aa('0x1c')](_0x17c427)[_0xb6aa('0x1d')](_0x49cab7);}};}function respondWithFilteredResult(_0x18bfdd,_0x388bf2){return function(_0x3cfa00){if(_0x3cfa00){var _0x458af7=_0x3cfa00[_0xb6aa('0x1e')],_0x55038d=_0x388bf2['offset'],_0x2d8102=_0x388bf2[_0xb6aa('0x1f')]+_0x388bf2[_0xb6aa('0x20')],_0xa88f4e;if(_0x2d8102>=_0x458af7){_0x2d8102=_0x458af7;_0xa88f4e=0xc8;}else{_0xa88f4e=0xce;}_0x18bfdd[_0xb6aa('0x1c')](_0xa88f4e);return _0x18bfdd[_0xb6aa('0x21')](_0xb6aa('0x22'),_0x55038d+'-'+_0x2d8102+'/'+_0x458af7)['json'](_0x3cfa00);}return null;};}function patchUpdates(_0x173cea){return function(_0x1dd9c8){try{jsonpatch[_0xb6aa('0x23')](_0x1dd9c8,_0x173cea,!![]);}catch(_0x2b4579){return BPromise[_0xb6aa('0x24')](_0x2b4579);}return _0x1dd9c8['save']();};}function saveUpdates(_0x80bf9c,_0x372a1c){return function(_0x2d5d67){if(_0x2d5d67){return _0x2d5d67[_0xb6aa('0x25')](_0x80bf9c)[_0xb6aa('0x26')](function(_0x317150){return _0x317150;});}return null;};}function removeEntity(_0xf1c444,_0x320eaf){return function(_0x3f97b9){if(_0x3f97b9){return _0x3f97b9[_0xb6aa('0x27')]()[_0xb6aa('0x26')](function(){_0xf1c444[_0xb6aa('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1031d0,_0x490102){return function(_0x382bd1){if(!_0x382bd1){_0x1031d0[_0xb6aa('0x1a')](0x194);}return _0x382bd1;};}function handleError(_0x5cda26,_0x17e9ef){_0x17e9ef=_0x17e9ef||0x1f4;return function(_0x5781ad){logger[_0xb6aa('0x28')](_0x5781ad[_0xb6aa('0x29')]);if(_0x5781ad[_0xb6aa('0x2a')]){delete _0x5781ad[_0xb6aa('0x2a')];}_0x5cda26[_0xb6aa('0x1c')](_0x17e9ef)[_0xb6aa('0x2b')](_0x5781ad);};}exports[_0xb6aa('0x2c')]=function(_0x27ef7d,_0x18709d){var _0x44a27f={},_0x41f973={},_0x5ba45e={'count':0x0,'rows':[]};var _0xf50f8=db[_0xb6aa('0x2d')][_0xb6aa('0x2e')];_0x41f973[_0xb6aa('0x2f')]=_[_0xb6aa('0x30')](_0xf50f8);_0x41f973[_0xb6aa('0x31')]=_[_0xb6aa('0x30')](_0x27ef7d[_0xb6aa('0x31')]);_0x41f973[_0xb6aa('0x32')]=_[_0xb6aa('0x33')](_0x41f973['model'],_0x41f973['query']);_0x44a27f[_0xb6aa('0x34')]=_[_0xb6aa('0x33')](_0x41f973[_0xb6aa('0x2f')],qs[_0xb6aa('0x35')](_0x27ef7d[_0xb6aa('0x31')][_0xb6aa('0x35')]));_0x44a27f[_0xb6aa('0x34')]=_0x44a27f['attributes']['length']?_0x44a27f[_0xb6aa('0x34')]:_0x41f973[_0xb6aa('0x2f')];if(!_0x27ef7d[_0xb6aa('0x31')][_0xb6aa('0x36')](_0xb6aa('0x37'))){_0x44a27f['limit']=qs['limit'](_0x27ef7d[_0xb6aa('0x31')][_0xb6aa('0x20')]);_0x44a27f[_0xb6aa('0x1f')]=qs[_0xb6aa('0x1f')](_0x27ef7d['query'][_0xb6aa('0x1f')]);}_0x44a27f[_0xb6aa('0x38')]=qs['sort'](_0x27ef7d[_0xb6aa('0x31')][_0xb6aa('0x39')]);_0x44a27f[_0xb6aa('0x3a')]=qs[_0xb6aa('0x32')](_[_0xb6aa('0x3b')](_0x27ef7d[_0xb6aa('0x31')],_0x41f973[_0xb6aa('0x32')]));if(_0x27ef7d['query'][_0xb6aa('0x3c')]){_0x44a27f[_0xb6aa('0x3a')]=_['merge'](_0x44a27f[_0xb6aa('0x3a')],{'$or':_['map'](_0xf50f8,function(_0x507e82){if(_0x507e82[_0xb6aa('0x3d')][_0xb6aa('0x3e')]!==_0xb6aa('0x3f')){var _0x1f3359={};_0x1f3359[_0x507e82['field']]={'$like':'%'+_0x27ef7d[_0xb6aa('0x31')]['filter']+'%'};return _0x1f3359;}})});}_0x44a27f=_[_0xb6aa('0x40')]({},_0x44a27f,_0x27ef7d[_0xb6aa('0x41')]);var _0x34ddbd={'where':_0x44a27f[_0xb6aa('0x3a')]};return db[_0xb6aa('0x2d')][_0xb6aa('0x1e')](_0x34ddbd)[_0xb6aa('0x26')](function(_0x24cc3c){_0x5ba45e['count']=_0x24cc3c;if(_0x27ef7d[_0xb6aa('0x31')][_0xb6aa('0x42')]){_0x44a27f['include']=[{'all':!![]}];}return db['IntegrationReport'][_0xb6aa('0x43')](_0x44a27f);})[_0xb6aa('0x26')](function(_0x3f60e0){_0x5ba45e[_0xb6aa('0x44')]=_0x3f60e0;return _0x5ba45e;})['then'](respondWithFilteredResult(_0x18709d,_0x44a27f))[_0xb6aa('0x45')](handleError(_0x18709d,null));};exports[_0xb6aa('0x46')]=function(_0x3c8ead,_0x33c550){var _0x51c115={'raw':![],'where':{'id':_0x3c8ead['params']['id']}},_0x4eacc4={};_0x4eacc4[_0xb6aa('0x2f')]=_[_0xb6aa('0x30')](db['IntegrationReport']['rawAttributes']);_0x4eacc4['query']=_[_0xb6aa('0x30')](_0x3c8ead[_0xb6aa('0x31')]);_0x4eacc4[_0xb6aa('0x32')]=_[_0xb6aa('0x33')](_0x4eacc4[_0xb6aa('0x2f')],_0x4eacc4['query']);_0x51c115[_0xb6aa('0x34')]=_['intersection'](_0x4eacc4[_0xb6aa('0x2f')],qs['fields'](_0x3c8ead[_0xb6aa('0x31')]['fields']));_0x51c115['attributes']=_0x51c115[_0xb6aa('0x34')][_0xb6aa('0x47')]?_0x51c115[_0xb6aa('0x34')]:_0x4eacc4[_0xb6aa('0x2f')];if(_0x3c8ead[_0xb6aa('0x31')][_0xb6aa('0x42')]){_0x51c115[_0xb6aa('0x48')]=[{'all':!![]}];}_0x51c115=_['merge']({},_0x51c115,_0x3c8ead[_0xb6aa('0x41')]);return db[_0xb6aa('0x2d')][_0xb6aa('0x49')](_0x51c115)[_0xb6aa('0x26')](handleEntityNotFound(_0x33c550,null))[_0xb6aa('0x26')](respondWithResult(_0x33c550,null))['catch'](handleError(_0x33c550,null));};exports[_0xb6aa('0x4a')]=function(_0x3203a5,_0x26f2c4){return db[_0xb6aa('0x2d')][_0xb6aa('0x4a')](_0x3203a5[_0xb6aa('0x4b')],{})[_0xb6aa('0x26')](respondWithResult(_0x26f2c4,0xc9))[_0xb6aa('0x45')](handleError(_0x26f2c4,null));};exports[_0xb6aa('0x25')]=function(_0x210c9a,_0x2cccf2){if(_0x210c9a[_0xb6aa('0x4b')]['id']){delete _0x210c9a[_0xb6aa('0x4b')]['id'];}return db[_0xb6aa('0x2d')][_0xb6aa('0x49')]({'where':{'id':_0x210c9a[_0xb6aa('0x4c')]['id']}})[_0xb6aa('0x26')](handleEntityNotFound(_0x2cccf2,null))[_0xb6aa('0x26')](saveUpdates(_0x210c9a[_0xb6aa('0x4b')],null))[_0xb6aa('0x26')](respondWithResult(_0x2cccf2,null))[_0xb6aa('0x45')](handleError(_0x2cccf2,null));};exports[_0xb6aa('0x27')]=function(_0x52ef2e,_0x148c4b){return db[_0xb6aa('0x2d')][_0xb6aa('0x49')]({'where':{'id':_0x52ef2e[_0xb6aa('0x4c')]['id']}})[_0xb6aa('0x26')](handleEntityNotFound(_0x148c4b,null))[_0xb6aa('0x26')](removeEntity(_0x148c4b,null))[_0xb6aa('0x45')](handleError(_0x148c4b,null));};exports[_0xb6aa('0x4d')]=function(_0x733f64,_0x446c29){return db[_0xb6aa('0x2d')]['describe']()[_0xb6aa('0x26')](respondWithResult(_0x446c29,null))[_0xb6aa('0x45')](handleError(_0x446c29,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 00d86d9..d0a9591 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 _0x6c7b=['define','IntegrationReport','report_integration','lodash','moment','request-promise','./integrationReport.attributes','exports'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x44801f,_0xfaf6a8){_0x44801f=_0x44801f-0x0;var _0x12c8d9=_0x6c7b[_0x44801f];return _0x12c8d9;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var attributes=require(_0xb6c7('0x3'));module[_0xb6c7('0x4')]=function(_0x5857e0,_0x294dc9){return _0x5857e0[_0xb6c7('0x5')](_0xb6c7('0x6'),attributes,{'tableName':_0xb6c7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcca7=['define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','request-promise','exports'];(function(_0x5ecca5,_0x2bb5ff){var _0x424150=function(_0x325d35){while(--_0x325d35){_0x5ecca5['push'](_0x5ecca5['shift']());}};_0x424150(++_0x2bb5ff);}(_0xcca7,0x1aa));var _0x7cca=function(_0x1d2eec,_0x5f0a2c){_0x1d2eec=_0x1d2eec-0x0;var _0x2df149=_0xcca7[_0x1d2eec];return _0x2df149;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var logger=require(_0x7cca('0x2'))(_0x7cca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7cca('0x4'));var attributes=require('./integrationReport.attributes');module[_0x7cca('0x5')]=function(_0x9523f7,_0x2126f7){return _0x9523f7[_0x7cca('0x6')](_0x7cca('0x7'),attributes,{'tableName':_0x7cca('0x8'),'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 97cb113..5ab16fb 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 _0x64f0=['info','result','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x564674,_0x462e46){var _0x5a8b9e=function(_0x131d6f){while(--_0x131d6f){_0x564674['push'](_0x564674['shift']());}};_0x5a8b9e(++_0x462e46);}(_0x64f0,0x192));var _0x064f=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x64f0[_0x11e30d];return _0x2d4e29;};'use strict';var _=require('lodash');var util=require(_0x064f('0x0'));var moment=require(_0x064f('0x1'));var BPromise=require(_0x064f('0x2'));var rs=require(_0x064f('0x3'));var fs=require('fs');var Redis=require(_0x064f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x064f('0x5'))(_0x064f('0x6'));var config=require(_0x064f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x064f('0x8')][_0x064f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191707,_0x2ab853,_0x4989b9){return new BPromise(function(_0x2054f8,_0x20bd48){return client[_0x064f('0xa')](_0x191707,_0x4989b9)[_0x064f('0xb')](function(_0x5e59a9){logger['info'](_0x064f('0xc'),_0x2ab853,_0x064f('0xd'));logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2ab853,_0x064f('0xd'),JSON[_0x064f('0xe')](_0x5e59a9));if(_0x5e59a9[_0x064f('0xf')]){if(_0x5e59a9['error'][_0x064f('0x10')]===0x1f4){logger[_0x064f('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2ab853,_0x5e59a9[_0x064f('0xf')][_0x064f('0x11')]);return _0x20bd48(_0x5e59a9[_0x064f('0xf')][_0x064f('0x11')]);}logger[_0x064f('0xf')](_0x064f('0xc'),_0x2ab853,_0x5e59a9['error'][_0x064f('0x11')]);return _0x2054f8(_0x5e59a9['error'][_0x064f('0x11')]);}else{logger[_0x064f('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2ab853,_0x064f('0xd'));_0x2054f8(_0x5e59a9[_0x064f('0x13')]['message']);}})['catch'](function(_0x441311){logger[_0x064f('0xf')](_0x064f('0xc'),_0x2ab853,_0x441311);_0x20bd48(_0x441311);});});} \ No newline at end of file +var _0x8e2c=['jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5a5bcf,_0x43c7c8){var _0x2dbae3=function(_0x5b400a){while(--_0x5b400a){_0x5a5bcf['push'](_0x5a5bcf['shift']());}};_0x2dbae3(++_0x43c7c8);}(_0x8e2c,0x157));var _0xc8e2=function(_0x3b6364,_0x7b2228){_0x3b6364=_0x3b6364-0x0;var _0x9a1aeb=_0x8e2c[_0x3b6364];return _0x9a1aeb;};'use strict';var _=require(_0xc8e2('0x0'));var util=require(_0xc8e2('0x1'));var moment=require('moment');var BPromise=require(_0xc8e2('0x2'));var rs=require(_0xc8e2('0x3'));var fs=require('fs');var Redis=require(_0xc8e2('0x4'));var db=require(_0xc8e2('0x5'))['db'];var utils=require(_0xc8e2('0x6'));var logger=require(_0xc8e2('0x7'))('rpc');var config=require(_0xc8e2('0x8'));var jayson=require(_0xc8e2('0x9'));var client=jayson[_0xc8e2('0xa')][_0xc8e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x208039,_0x385663,_0x27f2e1){return new BPromise(function(_0x264aaf,_0x1c7924){return client['request'](_0x208039,_0x27f2e1)[_0xc8e2('0xc')](function(_0x4a1991){logger[_0xc8e2('0xd')](_0xc8e2('0xe'),_0x385663,_0xc8e2('0xf'));logger['debug'](_0xc8e2('0x10'),_0x385663,_0xc8e2('0xf'),JSON[_0xc8e2('0x11')](_0x4a1991));if(_0x4a1991[_0xc8e2('0x12')]){if(_0x4a1991['error'][_0xc8e2('0x13')]===0x1f4){logger[_0xc8e2('0x12')](_0xc8e2('0xe'),_0x385663,_0x4a1991[_0xc8e2('0x12')][_0xc8e2('0x14')]);return _0x1c7924(_0x4a1991[_0xc8e2('0x12')]['message']);}logger['error'](_0xc8e2('0xe'),_0x385663,_0x4a1991[_0xc8e2('0x12')][_0xc8e2('0x14')]);return _0x264aaf(_0x4a1991['error']['message']);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x385663,_0xc8e2('0xf'));_0x264aaf(_0x4a1991[_0xc8e2('0x15')][_0xc8e2('0x14')]);}})['catch'](function(_0x4d8756){logger[_0xc8e2('0x12')](_0xc8e2('0xe'),_0x385663,_0x4d8756);_0x1c7924(_0x4d8756);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index a15d6ab..b88dc63 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 _0xa046=['../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create','addInterval','post','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','express','../../components/interaction/service'];(function(_0x386eaa,_0x140163){var _0x3b805a=function(_0x5698c9){while(--_0x5698c9){_0x386eaa['push'](_0x386eaa['shift']());}};_0x3b805a(++_0x140163);}(_0xa046,0xab));var _0x6a04=function(_0x25c2fd,_0x1605ec){_0x25c2fd=_0x25c2fd-0x0;var _0x544525=_0xa046[_0x25c2fd];return _0x544525;};'use strict';var multer=require(_0x6a04('0x0'));var util=require(_0x6a04('0x1'));var path=require(_0x6a04('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a04('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6a04('0x4'));var config=require(_0x6a04('0x5'));var controller=require(_0x6a04('0x6'));router[_0x6a04('0x7')]('/',auth[_0x6a04('0x8')](),controller[_0x6a04('0x9')]);router[_0x6a04('0x7')](_0x6a04('0xa'),auth[_0x6a04('0x8')](),controller[_0x6a04('0xb')]);router['get'](_0x6a04('0xc'),auth[_0x6a04('0x8')](),controller[_0x6a04('0xd')]);router['post']('/',auth[_0x6a04('0x8')](),controller[_0x6a04('0xe')]);router['post'](_0x6a04('0xc'),auth[_0x6a04('0x8')](),controller[_0x6a04('0xf')]);router[_0x6a04('0x10')](_0x6a04('0x11'),auth[_0x6a04('0x8')](),controller[_0x6a04('0x12')]);router[_0x6a04('0x13')](_0x6a04('0xa'),auth['isAuthenticated'](),controller[_0x6a04('0x14')]);router['delete']('/:id',auth[_0x6a04('0x8')](),controller['destroy']);module[_0x6a04('0x15')]=router; \ No newline at end of file +var _0x08e2=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create'];(function(_0x4ac60a,_0x503a99){var _0x4b22e8=function(_0x145c47){while(--_0x145c47){_0x4ac60a['push'](_0x4ac60a['shift']());}};_0x4b22e8(++_0x503a99);}(_0x08e2,0xe0));var _0x208e=function(_0xb62ac4,_0x2d72fa){_0xb62ac4=_0xb62ac4-0x0;var _0xf2c8f4=_0x08e2[_0xb62ac4];return _0xf2c8f4;};'use strict';var multer=require(_0x208e('0x0'));var util=require(_0x208e('0x1'));var path=require(_0x208e('0x2'));var timeout=require(_0x208e('0x3'));var express=require(_0x208e('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x208e('0x5'));var config=require(_0x208e('0x6'));var controller=require(_0x208e('0x7'));router[_0x208e('0x8')]('/',auth[_0x208e('0x9')](),controller[_0x208e('0xa')]);router[_0x208e('0x8')](_0x208e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x208e('0x8')](_0x208e('0xc'),auth[_0x208e('0x9')](),controller[_0x208e('0xd')]);router[_0x208e('0xe')]('/',auth['isAuthenticated'](),controller[_0x208e('0xf')]);router[_0x208e('0xe')](_0x208e('0xc'),auth[_0x208e('0x9')](),controller[_0x208e('0x10')]);router[_0x208e('0xe')](_0x208e('0x11'),auth[_0x208e('0x9')](),controller[_0x208e('0x12')]);router[_0x208e('0x13')](_0x208e('0xb'),auth[_0x208e('0x9')](),controller[_0x208e('0x14')]);router[_0x208e('0x15')](_0x208e('0xb'),auth[_0x208e('0x9')](),controller[_0x208e('0x16')]);module[_0x208e('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 9424b58..ed7f3cf 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 _0x139e=['STRING','sequelize'];(function(_0x173cd4,_0x335e89){var _0x1da53d=function(_0x23f4b6){while(--_0x23f4b6){_0x173cd4['push'](_0x173cd4['shift']());}};_0x1da53d(++_0x335e89);}(_0x139e,0xe7));var _0xe139=function(_0x501808,_0x4d521f){_0x501808=_0x501808-0x0;var _0xff5a9c=_0x139e[_0x501808];return _0xff5a9c;};'use strict';var Sequelize=require(_0xe139('0x0'));module['exports']={'name':{'type':Sequelize[_0xe139('0x1')]},'description':{'type':Sequelize[_0xe139('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x5419=['STRING','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5419,0x175));var _0x9541=function(_0x302e01,_0x3fb113){_0x302e01=_0x302e01-0x0;var _0xa17411=_0x5419[_0x302e01];return _0xa17411;};'use strict';var Sequelize=require(_0x9541('0x0'));module[_0x9541('0x1')]={'name':{'type':Sequelize[_0x9541('0x2')]},'description':{'type':Sequelize[_0x9541('0x2')]},'interval':{'type':Sequelize[_0x9541('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 63626cf..9ab2235 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 _0xf922=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','addInterval','IntervalId','getIntervals','findOne','order','pick','nolimit','sequelize','transaction','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','sendStatus','error','stack','name','index','Interval','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','map','key','field','options','includeAll','rows','catch','params','include','find','create','body'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0xf922,0x1b8));var _0x2f92=function(_0x58716c,_0x412971){_0x58716c=_0x58716c-0x0;var _0xe9692b=_0xf922[_0x58716c];return _0xe9692b;};'use strict';var pdf=require(_0x2f92('0x0'));var emlformat=require(_0x2f92('0x1'));var rimraf=require(_0x2f92('0x2'));var zipdir=require(_0x2f92('0x3'));var jsonpatch=require(_0x2f92('0x4'));var rp=require(_0x2f92('0x5'));var moment=require(_0x2f92('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x2f92('0x7'));var util=require(_0x2f92('0x8'));var path=require(_0x2f92('0x9'));var sox=require('sox');var csv=require(_0x2f92('0xa'));var ejs=require(_0x2f92('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2f92('0xc'));var jsforce=require(_0x2f92('0xd'));var deskjs=require(_0x2f92('0xe'));var toCsv=require(_0x2f92('0xa'));var querystring=require(_0x2f92('0xf'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x2f92('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x2f92('0x11'))(_0x2f92('0x12'));var utils=require(_0x2f92('0x13'));var config=require('../../config/environment');var db=require(_0x2f92('0x14'))['db'];var extensions=require(_0x2f92('0x15'));function respondWithStatusCode(_0x3ab3b2,_0x30f07c){_0x30f07c=_0x30f07c||0xcc;return function(_0x59d631){if(_0x59d631){return _0x3ab3b2['sendStatus'](_0x30f07c);}return _0x3ab3b2['status'](_0x30f07c)[_0x2f92('0x16')]();};}function respondWithResult(_0x1d0908,_0x3e4db9){_0x3e4db9=_0x3e4db9||0xc8;return function(_0x406dc2){if(_0x406dc2){return _0x1d0908[_0x2f92('0x17')](_0x3e4db9)[_0x2f92('0x18')](_0x406dc2);}};}function respondWithFilteredResult(_0x4e4f70,_0xa9f0d9){return function(_0x525f7c){if(_0x525f7c){var _0x97e12=_0x525f7c[_0x2f92('0x19')],_0x53fe71=_0xa9f0d9[_0x2f92('0x1a')],_0x2d42d1=_0xa9f0d9[_0x2f92('0x1a')]+_0xa9f0d9[_0x2f92('0x1b')],_0x4486bb;if(_0x2d42d1>=_0x97e12){_0x2d42d1=_0x97e12;_0x4486bb=0xc8;}else{_0x4486bb=0xce;}_0x4e4f70[_0x2f92('0x17')](_0x4486bb);return _0x4e4f70['set'](_0x2f92('0x1c'),_0x53fe71+'-'+_0x2d42d1+'/'+_0x97e12)[_0x2f92('0x18')](_0x525f7c);}return null;};}function patchUpdates(_0x300cfc){return function(_0x51e697){try{jsonpatch[_0x2f92('0x1d')](_0x51e697,_0x300cfc,!![]);}catch(_0x2ba58f){return BPromise[_0x2f92('0x1e')](_0x2ba58f);}return _0x51e697[_0x2f92('0x1f')]();};}function saveUpdates(_0x2bcc20,_0x495b36){return function(_0xf998a9){if(_0xf998a9){return _0xf998a9[_0x2f92('0x20')](_0x2bcc20)[_0x2f92('0x21')](function(_0x23f4f0){return _0x23f4f0;});}return null;};}function removeEntity(_0x4297a4,_0x471685){return function(_0x1c72e8){if(_0x1c72e8){return _0x1c72e8['destroy']()[_0x2f92('0x21')](function(){var _0x3509ec=_0x1c72e8[_0x2f92('0x22')]({'plain':!![]});var _0x28c824=_0x2f92('0x23');return db[_0x2f92('0x24')][_0x2f92('0x25')]({'where':{'type':_0x28c824,'resourceId':_0x3509ec['id']}})[_0x2f92('0x21')](function(){return _0x1c72e8;});})[_0x2f92('0x21')](function(){_0x4297a4[_0x2f92('0x17')](0xcc)[_0x2f92('0x16')]();});}};}function handleEntityNotFound(_0xc45784,_0x2ea6de){return function(_0x36c927){if(!_0x36c927){_0xc45784[_0x2f92('0x26')](0x194);}return _0x36c927;};}function handleError(_0xf24013,_0xa959e2){_0xa959e2=_0xa959e2||0x1f4;return function(_0x215916){logger[_0x2f92('0x27')](_0x215916[_0x2f92('0x28')]);if(_0x215916[_0x2f92('0x29')]){delete _0x215916[_0x2f92('0x29')];}_0xf24013[_0x2f92('0x17')](_0xa959e2)['send'](_0x215916);};}exports[_0x2f92('0x2a')]=function(_0x162b99,_0x29919d){var _0x4e865c={},_0x33bcf1={},_0x5aa591={'count':0x0,'rows':[]};var _0x55720b=db[_0x2f92('0x2b')][_0x2f92('0x2c')];_0x33bcf1[_0x2f92('0x2d')]=_[_0x2f92('0x2e')](_0x55720b);_0x33bcf1[_0x2f92('0x2f')]=_[_0x2f92('0x2e')](_0x162b99[_0x2f92('0x2f')]);_0x33bcf1[_0x2f92('0x30')]=_[_0x2f92('0x31')](_0x33bcf1[_0x2f92('0x2d')],_0x33bcf1[_0x2f92('0x2f')]);_0x4e865c['attributes']=_[_0x2f92('0x31')](_0x33bcf1['model'],qs[_0x2f92('0x32')](_0x162b99[_0x2f92('0x2f')][_0x2f92('0x32')]));_0x4e865c['attributes']=_0x4e865c[_0x2f92('0x33')][_0x2f92('0x34')]?_0x4e865c[_0x2f92('0x33')]:_0x33bcf1[_0x2f92('0x2d')];if(!_0x162b99[_0x2f92('0x2f')][_0x2f92('0x35')]('nolimit')){_0x4e865c[_0x2f92('0x1b')]=qs[_0x2f92('0x1b')](_0x162b99[_0x2f92('0x2f')]['limit']);_0x4e865c[_0x2f92('0x1a')]=qs[_0x2f92('0x1a')](_0x162b99[_0x2f92('0x2f')][_0x2f92('0x1a')]);}_0x4e865c['order']=qs[_0x2f92('0x36')](_0x162b99['query'][_0x2f92('0x36')]);_0x4e865c[_0x2f92('0x37')]=qs[_0x2f92('0x30')](_['pick'](_0x162b99['query'],_0x33bcf1[_0x2f92('0x30')]));if(_0x162b99[_0x2f92('0x2f')][_0x2f92('0x38')]){_0x4e865c['where']=_[_0x2f92('0x39')](_0x4e865c[_0x2f92('0x37')],{'$or':_[_0x2f92('0x3a')](_0x55720b,function(_0x2f4ebd){if(_0x2f4ebd['type'][_0x2f92('0x3b')]!=='VIRTUAL'){var _0x166468={};_0x166468[_0x2f4ebd[_0x2f92('0x3c')]]={'$like':'%'+_0x162b99[_0x2f92('0x2f')][_0x2f92('0x38')]+'%'};return _0x166468;}})});}_0x4e865c=_[_0x2f92('0x39')]({},_0x4e865c,_0x162b99[_0x2f92('0x3d')]);var _0x5cb81f={'where':_0x4e865c[_0x2f92('0x37')]};return db[_0x2f92('0x2b')][_0x2f92('0x19')](_0x5cb81f)[_0x2f92('0x21')](function(_0x4976bc){_0x5aa591[_0x2f92('0x19')]=_0x4976bc;if(_0x162b99[_0x2f92('0x2f')][_0x2f92('0x3e')]){_0x4e865c['include']=[{'all':!![]}];}return db[_0x2f92('0x2b')]['findAll'](_0x4e865c);})[_0x2f92('0x21')](function(_0x528d13){_0x5aa591[_0x2f92('0x3f')]=_0x528d13;return _0x5aa591;})['then'](respondWithFilteredResult(_0x29919d,_0x4e865c))[_0x2f92('0x40')](handleError(_0x29919d,null));};exports['show']=function(_0x48e82f,_0x123f3d){var _0x193695={'raw':!![],'where':{'id':_0x48e82f[_0x2f92('0x41')]['id']}},_0x3a0459={};_0x3a0459[_0x2f92('0x2d')]=_[_0x2f92('0x2e')](db['Interval'][_0x2f92('0x2c')]);_0x3a0459[_0x2f92('0x2f')]=_['keys'](_0x48e82f[_0x2f92('0x2f')]);_0x3a0459[_0x2f92('0x30')]=_[_0x2f92('0x31')](_0x3a0459[_0x2f92('0x2d')],_0x3a0459[_0x2f92('0x2f')]);_0x193695[_0x2f92('0x33')]=_[_0x2f92('0x31')](_0x3a0459['model'],qs[_0x2f92('0x32')](_0x48e82f['query'][_0x2f92('0x32')]));_0x193695['attributes']=_0x193695[_0x2f92('0x33')][_0x2f92('0x34')]?_0x193695[_0x2f92('0x33')]:_0x3a0459[_0x2f92('0x2d')];if(_0x48e82f[_0x2f92('0x2f')][_0x2f92('0x3e')]){_0x193695[_0x2f92('0x42')]=[{'all':!![]}];}_0x193695=_[_0x2f92('0x39')]({},_0x193695,_0x48e82f[_0x2f92('0x3d')]);return db['Interval'][_0x2f92('0x43')](_0x193695)[_0x2f92('0x21')](handleEntityNotFound(_0x123f3d,null))[_0x2f92('0x21')](respondWithResult(_0x123f3d,null))['catch'](handleError(_0x123f3d,null));};exports[_0x2f92('0x44')]=function(_0x4662b8,_0x2840d8){return db[_0x2f92('0x2b')][_0x2f92('0x44')](_0x4662b8[_0x2f92('0x45')],{})[_0x2f92('0x21')](function(_0x1cf13c){var _0x1fe3e1=_0x4662b8['user'][_0x2f92('0x22')]({'plain':!![]});if(!_0x1fe3e1)throw new Error(_0x2f92('0x46'));if(_0x1fe3e1[_0x2f92('0x47')]===_0x2f92('0x48')){var _0x3b7a0f=_0x1cf13c[_0x2f92('0x22')]({'plain':!![]});var _0x43ea54='Intervals';return db[_0x2f92('0x49')]['find']({'where':{'name':_0x43ea54,'userProfileId':_0x1fe3e1[_0x2f92('0x4a')]},'raw':!![]})[_0x2f92('0x21')](function(_0x471cb4){if(_0x471cb4&&_0x471cb4[_0x2f92('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x3b7a0f[_0x2f92('0x29')],'resourceId':_0x3b7a0f['id'],'type':_0x471cb4['name'],'sectionId':_0x471cb4['id']},{})[_0x2f92('0x21')](function(){return _0x1cf13c;});}else{return _0x1cf13c;}})[_0x2f92('0x40')](function(_0x43f47e){logger[_0x2f92('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43f47e);throw _0x43f47e;});}return _0x1cf13c;})[_0x2f92('0x21')](respondWithResult(_0x2840d8,0xc9))[_0x2f92('0x40')](handleError(_0x2840d8,null));};exports['update']=function(_0xc4a66b,_0xfcc593){if(_0xc4a66b[_0x2f92('0x45')]['id']){delete _0xc4a66b[_0x2f92('0x45')]['id'];}return db['Interval'][_0x2f92('0x43')]({'where':{'id':_0xc4a66b[_0x2f92('0x41')]['id']}})[_0x2f92('0x21')](handleEntityNotFound(_0xfcc593,null))[_0x2f92('0x21')](saveUpdates(_0xc4a66b[_0x2f92('0x45')],null))[_0x2f92('0x21')](respondWithResult(_0xfcc593,null))['catch'](handleError(_0xfcc593,null));};exports[_0x2f92('0x25')]=function(_0x187a23,_0x5e070d){return db['Interval'][_0x2f92('0x43')]({'where':{'id':_0x187a23['params']['id']}})[_0x2f92('0x21')](handleEntityNotFound(_0x5e070d,null))[_0x2f92('0x21')](removeEntity(_0x5e070d,null))[_0x2f92('0x40')](handleError(_0x5e070d,null));};exports[_0x2f92('0x4c')]=function(_0x2e7781,_0x100c89,_0x3c39f4){if(_0x2e7781[_0x2f92('0x45')]['id']){delete _0x2e7781['body']['id'];}return db[_0x2f92('0x2b')][_0x2f92('0x43')]({'where':{'id':_0x2e7781[_0x2f92('0x41')]['id']}})['then'](handleEntityNotFound(_0x100c89,null))[_0x2f92('0x21')](function(_0x128654){if(_0x128654){_0x2e7781['body'][_0x2f92('0x4d')]=_0x128654['id'];return db[_0x2f92('0x2b')][_0x2f92('0x44')](_0x2e7781[_0x2f92('0x45')]);}})['then'](respondWithResult(_0x100c89,null))[_0x2f92('0x40')](handleError(_0x100c89,null));};exports[_0x2f92('0x4e')]=function(_0x51569e,_0x5e6bc2,_0xda348){var _0x526009={};var _0x19bad8={};var _0x206ba9;var _0x4db598;return db[_0x2f92('0x2b')][_0x2f92('0x4f')]({'where':{'id':_0x51569e['params']['id']}})[_0x2f92('0x21')](handleEntityNotFound(_0x5e6bc2,null))[_0x2f92('0x21')](function(_0x2d10d3){if(_0x2d10d3){_0x206ba9=_0x2d10d3;_0x19bad8[_0x2f92('0x2d')]=_[_0x2f92('0x2e')](db[_0x2f92('0x2b')]['rawAttributes']);_0x19bad8['query']=_['keys'](_0x51569e[_0x2f92('0x2f')]);_0x19bad8[_0x2f92('0x30')]=_[_0x2f92('0x31')](_0x19bad8[_0x2f92('0x2d')],_0x19bad8[_0x2f92('0x2f')]);_0x526009[_0x2f92('0x33')]=_['intersection'](_0x19bad8[_0x2f92('0x2d')],qs[_0x2f92('0x32')](_0x51569e[_0x2f92('0x2f')]['fields']));_0x526009[_0x2f92('0x33')]=_0x526009['attributes'][_0x2f92('0x34')]?_0x526009[_0x2f92('0x33')]:_0x19bad8[_0x2f92('0x2d')];_0x526009[_0x2f92('0x50')]=qs['sort'](_0x51569e[_0x2f92('0x2f')][_0x2f92('0x36')]);_0x526009[_0x2f92('0x37')]=qs[_0x2f92('0x30')](_[_0x2f92('0x51')](_0x51569e[_0x2f92('0x2f')],_0x19bad8[_0x2f92('0x30')]));if(_0x51569e['query'][_0x2f92('0x38')]){_0x526009[_0x2f92('0x37')]=_[_0x2f92('0x39')](_0x526009[_0x2f92('0x37')],{'$or':_[_0x2f92('0x3a')](_0x526009[_0x2f92('0x33')],function(_0x11e196){var _0x47f131={};_0x47f131[_0x11e196]={'$like':'%'+_0x51569e['query'][_0x2f92('0x38')]+'%'};return _0x47f131;})});}_0x526009=_[_0x2f92('0x39')]({},_0x526009,_0x51569e[_0x2f92('0x3d')]);return _0x206ba9['getIntervals'](_0x526009);}})[_0x2f92('0x21')](function(_0x2766fd){if(_0x2766fd){_0x4db598=_0x2766fd[_0x2f92('0x34')];if(!_0x51569e[_0x2f92('0x2f')]['hasOwnProperty'](_0x2f92('0x52'))){_0x526009[_0x2f92('0x1b')]=qs['limit'](_0x51569e[_0x2f92('0x2f')][_0x2f92('0x1b')]);_0x526009[_0x2f92('0x1a')]=qs[_0x2f92('0x1a')](_0x51569e[_0x2f92('0x2f')][_0x2f92('0x1a')]);}return _0x206ba9[_0x2f92('0x4e')](_0x526009);}})[_0x2f92('0x21')](function(_0x520a72){if(_0x520a72){return _0x520a72?{'count':_0x4db598,'rows':_0x520a72}:null;}})[_0x2f92('0x21')](respondWithResult(_0x5e6bc2,null))[_0x2f92('0x40')](handleError(_0x5e6bc2,null));};exports['addIntervals']=function(_0x186baa,_0x21118a,_0x18fc9b){return db[_0x2f92('0x2b')]['findOne']({'where':{'id':_0x186baa[_0x2f92('0x41')]['id']}})[_0x2f92('0x21')](handleEntityNotFound(_0x21118a,null))[_0x2f92('0x21')](function(_0x39b825){if(_0x39b825){return db[_0x2f92('0x53')][_0x2f92('0x54')](function(_0x3ae388){return db[_0x2f92('0x2b')][_0x2f92('0x25')]({'where':{'IntervalId':_0x186baa[_0x2f92('0x41')]['id']},'transaction':_0x3ae388})[_0x2f92('0x21')](function(_0x21e738){var _0x24c316=_[_0x2f92('0x3a')](_0x186baa[_0x2f92('0x45')],function(_0x574622){delete _0x574622['id'];_0x574622[_0x2f92('0x4d')]=_0x186baa[_0x2f92('0x41')]['id'];return _0x574622;});return db[_0x2f92('0x2b')]['bulkCreate'](_0x24c316,{'transaction':_0x3ae388});});})[_0x2f92('0x21')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x186baa['params']['id']}});});}})[_0x2f92('0x21')](respondWithResult(_0x21118a,null))[_0x2f92('0x40')](handleError(_0x21118a,null));}; \ No newline at end of file +var _0x9d8a=['ejs','crypto','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','then','destroy','get','error','name','send','index','Interval','rawAttributes','model','keys','query','intersection','fields','attributes','length','limit','order','sort','filters','pick','where','merge','map','type','key','VIRTUAL','field','options','count','includeAll','findAll','rows','catch','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','IntervalId','getIntervals','filter','addIntervals','findOne','sequelize','bulkCreate','html-pdf','eml-format','rimraf','request-promise','util','path','sox'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9d8a,0x19d));var _0xa9d8=function(_0x4a734d,_0x5f1dec){_0x4a734d=_0x4a734d-0x0;var _0xdac9c2=_0x9d8a[_0x4a734d];return _0xdac9c2;};'use strict';var pdf=require(_0xa9d8('0x0'));var emlformat=require(_0xa9d8('0x1'));var rimraf=require(_0xa9d8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa9d8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa9d8('0x4'));var path=require(_0xa9d8('0x5'));var sox=require(_0xa9d8('0x6'));var csv=require('to-csv');var ejs=require(_0xa9d8('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa9d8('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xa9d8('0x9'));var toCsv=require('to-csv');var querystring=require(_0xa9d8('0xa'));var Papa=require(_0xa9d8('0xb'));var authService=require('../../components/auth/service');var hardwareService=require(_0xa9d8('0xc'));var Redis=require(_0xa9d8('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xa9d8('0xe'))(_0xa9d8('0xf'));var utils=require(_0xa9d8('0x10'));var config=require(_0xa9d8('0x11'));var db=require(_0xa9d8('0x12'))['db'];var extensions=require(_0xa9d8('0x13'));function respondWithStatusCode(_0x2d5c6c,_0x462c68){_0x462c68=_0x462c68||0xcc;return function(_0x1709c2){if(_0x1709c2){return _0x2d5c6c[_0xa9d8('0x14')](_0x462c68);}return _0x2d5c6c[_0xa9d8('0x15')](_0x462c68)[_0xa9d8('0x16')]();};}function respondWithResult(_0xe17e92,_0x4e1db6){_0x4e1db6=_0x4e1db6||0xc8;return function(_0x2e22d0){if(_0x2e22d0){return _0xe17e92['status'](_0x4e1db6)[_0xa9d8('0x17')](_0x2e22d0);}};}function respondWithFilteredResult(_0x46d863,_0x3aa4f0){return function(_0x98caeb){if(_0x98caeb){var _0x135aed=_0x98caeb['count'],_0x188651=_0x3aa4f0[_0xa9d8('0x18')],_0x3a07f2=_0x3aa4f0['offset']+_0x3aa4f0['limit'],_0x3e1194;if(_0x3a07f2>=_0x135aed){_0x3a07f2=_0x135aed;_0x3e1194=0xc8;}else{_0x3e1194=0xce;}_0x46d863['status'](_0x3e1194);return _0x46d863[_0xa9d8('0x19')](_0xa9d8('0x1a'),_0x188651+'-'+_0x3a07f2+'/'+_0x135aed)[_0xa9d8('0x17')](_0x98caeb);}return null;};}function patchUpdates(_0x5b7ff8){return function(_0x765a6a){try{jsonpatch[_0xa9d8('0x1b')](_0x765a6a,_0x5b7ff8,!![]);}catch(_0x5b1489){return BPromise[_0xa9d8('0x1c')](_0x5b1489);}return _0x765a6a['save']();};}function saveUpdates(_0x39a59b,_0x2ce703){return function(_0x32f653){if(_0x32f653){return _0x32f653['update'](_0x39a59b)[_0xa9d8('0x1d')](function(_0xbb73b7){return _0xbb73b7;});}return null;};}function removeEntity(_0x27cccb,_0x509c5b){return function(_0x138545){if(_0x138545){return _0x138545[_0xa9d8('0x1e')]()['then'](function(){var _0x18af65=_0x138545[_0xa9d8('0x1f')]({'plain':!![]});var _0x835502='Intervals';return db['UserProfileResource'][_0xa9d8('0x1e')]({'where':{'type':_0x835502,'resourceId':_0x18af65['id']}})[_0xa9d8('0x1d')](function(){return _0x138545;});})[_0xa9d8('0x1d')](function(){_0x27cccb[_0xa9d8('0x15')](0xcc)[_0xa9d8('0x16')]();});}};}function handleEntityNotFound(_0x144c1a,_0x1b7463){return function(_0x309d02){if(!_0x309d02){_0x144c1a[_0xa9d8('0x14')](0x194);}return _0x309d02;};}function handleError(_0x4131ea,_0x3e70f8){_0x3e70f8=_0x3e70f8||0x1f4;return function(_0x51f2ee){logger[_0xa9d8('0x20')](_0x51f2ee['stack']);if(_0x51f2ee[_0xa9d8('0x21')]){delete _0x51f2ee[_0xa9d8('0x21')];}_0x4131ea['status'](_0x3e70f8)[_0xa9d8('0x22')](_0x51f2ee);};}exports[_0xa9d8('0x23')]=function(_0x911e39,_0x4c37f1){var _0x179e42={},_0x2805bd={},_0x5346b5={'count':0x0,'rows':[]};var _0x32f229=db[_0xa9d8('0x24')][_0xa9d8('0x25')];_0x2805bd[_0xa9d8('0x26')]=_[_0xa9d8('0x27')](_0x32f229);_0x2805bd[_0xa9d8('0x28')]=_['keys'](_0x911e39[_0xa9d8('0x28')]);_0x2805bd['filters']=_[_0xa9d8('0x29')](_0x2805bd[_0xa9d8('0x26')],_0x2805bd[_0xa9d8('0x28')]);_0x179e42['attributes']=_[_0xa9d8('0x29')](_0x2805bd[_0xa9d8('0x26')],qs['fields'](_0x911e39['query'][_0xa9d8('0x2a')]));_0x179e42[_0xa9d8('0x2b')]=_0x179e42['attributes'][_0xa9d8('0x2c')]?_0x179e42['attributes']:_0x2805bd[_0xa9d8('0x26')];if(!_0x911e39[_0xa9d8('0x28')]['hasOwnProperty']('nolimit')){_0x179e42['limit']=qs[_0xa9d8('0x2d')](_0x911e39[_0xa9d8('0x28')]['limit']);_0x179e42['offset']=qs['offset'](_0x911e39[_0xa9d8('0x28')][_0xa9d8('0x18')]);}_0x179e42[_0xa9d8('0x2e')]=qs[_0xa9d8('0x2f')](_0x911e39[_0xa9d8('0x28')][_0xa9d8('0x2f')]);_0x179e42['where']=qs[_0xa9d8('0x30')](_[_0xa9d8('0x31')](_0x911e39[_0xa9d8('0x28')],_0x2805bd[_0xa9d8('0x30')]));if(_0x911e39[_0xa9d8('0x28')]['filter']){_0x179e42[_0xa9d8('0x32')]=_[_0xa9d8('0x33')](_0x179e42[_0xa9d8('0x32')],{'$or':_[_0xa9d8('0x34')](_0x32f229,function(_0x30ad7f){if(_0x30ad7f[_0xa9d8('0x35')][_0xa9d8('0x36')]!==_0xa9d8('0x37')){var _0x203f84={};_0x203f84[_0x30ad7f[_0xa9d8('0x38')]]={'$like':'%'+_0x911e39['query']['filter']+'%'};return _0x203f84;}})});}_0x179e42=_[_0xa9d8('0x33')]({},_0x179e42,_0x911e39[_0xa9d8('0x39')]);var _0x37a607={'where':_0x179e42[_0xa9d8('0x32')]};return db['Interval']['count'](_0x37a607)[_0xa9d8('0x1d')](function(_0x47aa2e){_0x5346b5[_0xa9d8('0x3a')]=_0x47aa2e;if(_0x911e39[_0xa9d8('0x28')][_0xa9d8('0x3b')]){_0x179e42['include']=[{'all':!![]}];}return db[_0xa9d8('0x24')][_0xa9d8('0x3c')](_0x179e42);})[_0xa9d8('0x1d')](function(_0x221d30){_0x5346b5[_0xa9d8('0x3d')]=_0x221d30;return _0x5346b5;})[_0xa9d8('0x1d')](respondWithFilteredResult(_0x4c37f1,_0x179e42))[_0xa9d8('0x3e')](handleError(_0x4c37f1,null));};exports['show']=function(_0xe9629,_0x1337f9){var _0x113ad3={'raw':!![],'where':{'id':_0xe9629['params']['id']}},_0xea5a03={};_0xea5a03[_0xa9d8('0x26')]=_[_0xa9d8('0x27')](db[_0xa9d8('0x24')][_0xa9d8('0x25')]);_0xea5a03[_0xa9d8('0x28')]=_[_0xa9d8('0x27')](_0xe9629[_0xa9d8('0x28')]);_0xea5a03[_0xa9d8('0x30')]=_[_0xa9d8('0x29')](_0xea5a03[_0xa9d8('0x26')],_0xea5a03[_0xa9d8('0x28')]);_0x113ad3[_0xa9d8('0x2b')]=_[_0xa9d8('0x29')](_0xea5a03[_0xa9d8('0x26')],qs[_0xa9d8('0x2a')](_0xe9629[_0xa9d8('0x28')][_0xa9d8('0x2a')]));_0x113ad3[_0xa9d8('0x2b')]=_0x113ad3['attributes'][_0xa9d8('0x2c')]?_0x113ad3[_0xa9d8('0x2b')]:_0xea5a03[_0xa9d8('0x26')];if(_0xe9629[_0xa9d8('0x28')][_0xa9d8('0x3b')]){_0x113ad3[_0xa9d8('0x3f')]=[{'all':!![]}];}_0x113ad3=_[_0xa9d8('0x33')]({},_0x113ad3,_0xe9629['options']);return db[_0xa9d8('0x24')][_0xa9d8('0x40')](_0x113ad3)[_0xa9d8('0x1d')](handleEntityNotFound(_0x1337f9,null))['then'](respondWithResult(_0x1337f9,null))[_0xa9d8('0x3e')](handleError(_0x1337f9,null));};exports[_0xa9d8('0x41')]=function(_0x2644d6,_0x81eadc){return db[_0xa9d8('0x24')][_0xa9d8('0x41')](_0x2644d6[_0xa9d8('0x42')],{})[_0xa9d8('0x1d')](function(_0x4c9975){var _0x5a7c43=_0x2644d6['user'][_0xa9d8('0x1f')]({'plain':!![]});if(!_0x5a7c43)throw new Error(_0xa9d8('0x43'));if(_0x5a7c43[_0xa9d8('0x44')]===_0xa9d8('0x45')){var _0x56ea0d=_0x4c9975[_0xa9d8('0x1f')]({'plain':!![]});var _0x43e990=_0xa9d8('0x46');return db[_0xa9d8('0x47')]['find']({'where':{'name':_0x43e990,'userProfileId':_0x5a7c43[_0xa9d8('0x48')]},'raw':!![]})[_0xa9d8('0x1d')](function(_0x245935){if(_0x245935&&_0x245935[_0xa9d8('0x49')]===0x0){return db['UserProfileResource'][_0xa9d8('0x41')]({'name':_0x56ea0d[_0xa9d8('0x21')],'resourceId':_0x56ea0d['id'],'type':_0x245935[_0xa9d8('0x21')],'sectionId':_0x245935['id']},{})[_0xa9d8('0x1d')](function(){return _0x4c9975;});}else{return _0x4c9975;}})[_0xa9d8('0x3e')](function(_0x134a61){logger[_0xa9d8('0x20')](_0xa9d8('0x4a'),_0x134a61);throw _0x134a61;});}return _0x4c9975;})[_0xa9d8('0x1d')](respondWithResult(_0x81eadc,0xc9))[_0xa9d8('0x3e')](handleError(_0x81eadc,null));};exports[_0xa9d8('0x4b')]=function(_0x35c819,_0x4986fe){if(_0x35c819[_0xa9d8('0x42')]['id']){delete _0x35c819['body']['id'];}return db['Interval'][_0xa9d8('0x40')]({'where':{'id':_0x35c819[_0xa9d8('0x4c')]['id']}})[_0xa9d8('0x1d')](handleEntityNotFound(_0x4986fe,null))['then'](saveUpdates(_0x35c819['body'],null))['then'](respondWithResult(_0x4986fe,null))[_0xa9d8('0x3e')](handleError(_0x4986fe,null));};exports[_0xa9d8('0x1e')]=function(_0x298254,_0x5bfa88){return db[_0xa9d8('0x24')][_0xa9d8('0x40')]({'where':{'id':_0x298254['params']['id']}})[_0xa9d8('0x1d')](handleEntityNotFound(_0x5bfa88,null))['then'](removeEntity(_0x5bfa88,null))[_0xa9d8('0x3e')](handleError(_0x5bfa88,null));};exports['addInterval']=function(_0x169f3b,_0x275d61,_0x4a7cc9){if(_0x169f3b[_0xa9d8('0x42')]['id']){delete _0x169f3b['body']['id'];}return db[_0xa9d8('0x24')][_0xa9d8('0x40')]({'where':{'id':_0x169f3b[_0xa9d8('0x4c')]['id']}})[_0xa9d8('0x1d')](handleEntityNotFound(_0x275d61,null))[_0xa9d8('0x1d')](function(_0x49fec0){if(_0x49fec0){_0x169f3b[_0xa9d8('0x42')][_0xa9d8('0x4d')]=_0x49fec0['id'];return db[_0xa9d8('0x24')][_0xa9d8('0x41')](_0x169f3b[_0xa9d8('0x42')]);}})[_0xa9d8('0x1d')](respondWithResult(_0x275d61,null))[_0xa9d8('0x3e')](handleError(_0x275d61,null));};exports[_0xa9d8('0x4e')]=function(_0x50c86a,_0x1219b0,_0x3b8679){var _0x4d41c0={};var _0x40cb7b={};var _0x8d0ee0;var _0x5b6c67;return db[_0xa9d8('0x24')]['findOne']({'where':{'id':_0x50c86a['params']['id']}})[_0xa9d8('0x1d')](handleEntityNotFound(_0x1219b0,null))[_0xa9d8('0x1d')](function(_0x367f61){if(_0x367f61){_0x8d0ee0=_0x367f61;_0x40cb7b[_0xa9d8('0x26')]=_['keys'](db['Interval'][_0xa9d8('0x25')]);_0x40cb7b[_0xa9d8('0x28')]=_[_0xa9d8('0x27')](_0x50c86a[_0xa9d8('0x28')]);_0x40cb7b[_0xa9d8('0x30')]=_[_0xa9d8('0x29')](_0x40cb7b[_0xa9d8('0x26')],_0x40cb7b[_0xa9d8('0x28')]);_0x4d41c0[_0xa9d8('0x2b')]=_[_0xa9d8('0x29')](_0x40cb7b[_0xa9d8('0x26')],qs[_0xa9d8('0x2a')](_0x50c86a[_0xa9d8('0x28')][_0xa9d8('0x2a')]));_0x4d41c0[_0xa9d8('0x2b')]=_0x4d41c0[_0xa9d8('0x2b')][_0xa9d8('0x2c')]?_0x4d41c0[_0xa9d8('0x2b')]:_0x40cb7b[_0xa9d8('0x26')];_0x4d41c0['order']=qs[_0xa9d8('0x2f')](_0x50c86a[_0xa9d8('0x28')][_0xa9d8('0x2f')]);_0x4d41c0[_0xa9d8('0x32')]=qs[_0xa9d8('0x30')](_['pick'](_0x50c86a[_0xa9d8('0x28')],_0x40cb7b[_0xa9d8('0x30')]));if(_0x50c86a[_0xa9d8('0x28')][_0xa9d8('0x4f')]){_0x4d41c0['where']=_[_0xa9d8('0x33')](_0x4d41c0[_0xa9d8('0x32')],{'$or':_[_0xa9d8('0x34')](_0x4d41c0[_0xa9d8('0x2b')],function(_0x4659e9){var _0x1e6f39={};_0x1e6f39[_0x4659e9]={'$like':'%'+_0x50c86a[_0xa9d8('0x28')]['filter']+'%'};return _0x1e6f39;})});}_0x4d41c0=_['merge']({},_0x4d41c0,_0x50c86a[_0xa9d8('0x39')]);return _0x8d0ee0[_0xa9d8('0x4e')](_0x4d41c0);}})[_0xa9d8('0x1d')](function(_0x487b2f){if(_0x487b2f){_0x5b6c67=_0x487b2f[_0xa9d8('0x2c')];if(!_0x50c86a[_0xa9d8('0x28')]['hasOwnProperty']('nolimit')){_0x4d41c0[_0xa9d8('0x2d')]=qs['limit'](_0x50c86a[_0xa9d8('0x28')]['limit']);_0x4d41c0[_0xa9d8('0x18')]=qs[_0xa9d8('0x18')](_0x50c86a[_0xa9d8('0x28')][_0xa9d8('0x18')]);}return _0x8d0ee0[_0xa9d8('0x4e')](_0x4d41c0);}})[_0xa9d8('0x1d')](function(_0x3c9385){if(_0x3c9385){return _0x3c9385?{'count':_0x5b6c67,'rows':_0x3c9385}:null;}})['then'](respondWithResult(_0x1219b0,null))[_0xa9d8('0x3e')](handleError(_0x1219b0,null));};exports[_0xa9d8('0x50')]=function(_0x144d9f,_0x268ae9,_0x5f3314){return db['Interval'][_0xa9d8('0x51')]({'where':{'id':_0x144d9f[_0xa9d8('0x4c')]['id']}})[_0xa9d8('0x1d')](handleEntityNotFound(_0x268ae9,null))['then'](function(_0x4bd9c9){if(_0x4bd9c9){return db[_0xa9d8('0x52')]['transaction'](function(_0xa6a5ab){return db['Interval'][_0xa9d8('0x1e')]({'where':{'IntervalId':_0x144d9f[_0xa9d8('0x4c')]['id']},'transaction':_0xa6a5ab})[_0xa9d8('0x1d')](function(_0x343579){var _0x322ccb=_[_0xa9d8('0x34')](_0x144d9f['body'],function(_0x2d1489){delete _0x2d1489['id'];_0x2d1489[_0xa9d8('0x4d')]=_0x144d9f['params']['id'];return _0x2d1489;});return db[_0xa9d8('0x24')][_0xa9d8('0x53')](_0x322ccb,{'transaction':_0xa6a5ab});});})[_0xa9d8('0x1d')](function(){return db[_0xa9d8('0x24')]['findAll']({'where':{'IntervalId':_0x144d9f[_0xa9d8('0x4c')]['id']}});});}})['then'](respondWithResult(_0x268ae9,null))[_0xa9d8('0x3e')](handleError(_0x268ae9,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 9dcadd0..aba4e9c 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 _0x9ec3=['bluebird','request-promise','./interval.attributes','../../components/extensions/rewrite','rewrite','lodash','../../config/logger','api','moment'];(function(_0x1a89ec,_0x50ea99){var _0x8c9db=function(_0x6e0a8c){while(--_0x6e0a8c){_0x1a89ec['push'](_0x1a89ec['shift']());}};_0x8c9db(++_0x50ea99);}(_0x9ec3,0x9e));var _0x39ec=function(_0x5608df,_0xff2326){_0x5608df=_0x5608df-0x0;var _0x4c2e63=_0x9ec3[_0x5608df];return _0x4c2e63;};'use strict';var _=require(_0x39ec('0x0'));var util=require('util');var logger=require(_0x39ec('0x1'))(_0x39ec('0x2'));var moment=require(_0x39ec('0x3'));var BPromise=require(_0x39ec('0x4'));var rp=require(_0x39ec('0x5'));var attributes=require(_0x39ec('0x6'));var extensions=require(_0x39ec('0x7'));module['exports']=function(_0x3e7b16,_0x41e80e){return _0x3e7b16['define']('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x116480,_0x42d60e){extensions['rewrite'](_0x3e7b16,_0x116480);},'afterBulkCreate':function(_0x198537,_0x4adf78,_0x40a472){_0x40a472();extensions[_0x39ec('0x8')](_0x3e7b16,_0x198537[0x0]);},'afterUpdate':function(_0x395f6a,_0x5506ee){extensions[_0x39ec('0x8')](_0x3e7b16,_0x395f6a);},'afterDestroy':function(_0x586212,_0x15c10b){extensions[_0x39ec('0x8')](_0x3e7b16,_0x586212);}}});}; \ No newline at end of file +var _0x1259=['exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./interval.attributes','../../components/extensions/rewrite'];(function(_0x1c575c,_0x397b48){var _0x2f77fb=function(_0x3737dd){while(--_0x3737dd){_0x1c575c['push'](_0x1c575c['shift']());}};_0x2f77fb(++_0x397b48);}(_0x1259,0xe5));var _0x9125=function(_0x5e4219,_0x2342a0){_0x5e4219=_0x5e4219-0x0;var _0x395815=_0x1259[_0x5e4219];return _0x395815;};'use strict';var _=require(_0x9125('0x0'));var util=require(_0x9125('0x1'));var logger=require(_0x9125('0x2'))(_0x9125('0x3'));var moment=require(_0x9125('0x4'));var BPromise=require(_0x9125('0x5'));var rp=require(_0x9125('0x6'));var attributes=require(_0x9125('0x7'));var extensions=require(_0x9125('0x8'));module[_0x9125('0x9')]=function(_0x319beb,_0xbe14b4){return _0x319beb[_0x9125('0xa')](_0x9125('0xb'),attributes,{'tableName':_0x9125('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x370747,_0x4920b0){extensions['rewrite'](_0x319beb,_0x370747);},'afterBulkCreate':function(_0x4925b1,_0x3fe43,_0x4051d7){_0x4051d7();extensions[_0x9125('0xd')](_0x319beb,_0x4925b1[0x0]);},'afterUpdate':function(_0x1bde53,_0x33bd11){extensions[_0x9125('0xd')](_0x319beb,_0x1bde53);},'afterDestroy':function(_0x5ed4f5,_0x3ec26b){extensions['rewrite'](_0x319beb,_0x5ed4f5);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index d28a3c2..f0b180f 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 _0xed1f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','GetInterval','Interval','options','attributes','limit','include','map','model','ShowInterval','find','raw','where','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x187408,_0x5f063c){var _0x476605=function(_0x18f367){while(--_0x18f367){_0x187408['push'](_0x187408['shift']());}};_0x476605(++_0x5f063c);}(_0xed1f,0x6a));var _0xfed1=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xed1f[_0x307d86];return _0x361745;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('Interval,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('Interval,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('Interval,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('Interval,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});}exports[_0xfed1('0x18')]=function(_0xa72a20){var _0x5c0d9f=this;return new Promise(function(_0x59509b,_0x586ea6){return db[_0xfed1('0x19')]['findAll']({'raw':_0xa72a20[_0xfed1('0x1a')]?_0xa72a20[_0xfed1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xa72a20[_0xfed1('0x1a')]?_0xa72a20[_0xfed1('0x1a')]['where']||null:null,'attributes':_0xa72a20[_0xfed1('0x1a')]?_0xa72a20[_0xfed1('0x1a')][_0xfed1('0x1b')]||null:null,'limit':_0xa72a20[_0xfed1('0x1a')]?_0xa72a20['options'][_0xfed1('0x1c')]||null:null,'include':_0xa72a20['options']?_0xa72a20[_0xfed1('0x1a')][_0xfed1('0x1d')]?_[_0xfed1('0x1e')](_0xa72a20['options'][_0xfed1('0x1d')],function(_0x594917){return{'model':db[_0x594917[_0xfed1('0x1f')]],'as':_0x594917['as'],'attributes':_0x594917[_0xfed1('0x1b')],'include':_0x594917[_0xfed1('0x1d')]?_[_0xfed1('0x1e')](_0x594917[_0xfed1('0x1d')],function(_0x1199b7){return{'model':db[_0x1199b7['model']],'as':_0x1199b7['as'],'attributes':_0x1199b7[_0xfed1('0x1b')],'include':_0x1199b7[_0xfed1('0x1d')]?_['map'](_0x1199b7[_0xfed1('0x1d')],function(_0x2b9dd2){return{'model':db[_0x2b9dd2[_0xfed1('0x1f')]],'as':_0x2b9dd2['as'],'attributes':_0x2b9dd2[_0xfed1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfed1('0xf')](function(_0x1761d1){logger['info'](_0xfed1('0x18'),_0xa72a20);logger['debug'](_0xfed1('0x18'),_0xa72a20,JSON['stringify'](_0x1761d1));_0x59509b(_0x1761d1);})['catch'](function(_0x1cec64){logger[_0xfed1('0x16')](_0xfed1('0x18'),_0x1cec64['message'],_0xa72a20);_0x586ea6(_0x5c0d9f[_0xfed1('0x16')](0x1f4,_0x1cec64[_0xfed1('0x17')]));});});};exports[_0xfed1('0x20')]=function(_0x383955){var _0x12399f=this;return new Promise(function(_0x30272b,_0x5ccc3a){return db[_0xfed1('0x19')][_0xfed1('0x21')]({'raw':_0x383955['options']?_0x383955['options'][_0xfed1('0x22')]===undefined?!![]:![]:!![],'where':_0x383955[_0xfed1('0x1a')]?_0x383955[_0xfed1('0x1a')][_0xfed1('0x23')]||null:null,'attributes':_0x383955[_0xfed1('0x1a')]?_0x383955['options'][_0xfed1('0x1b')]||null:null,'include':_0x383955[_0xfed1('0x1a')]?_0x383955[_0xfed1('0x1a')][_0xfed1('0x1d')]?_[_0xfed1('0x1e')](_0x383955['options'][_0xfed1('0x1d')],function(_0x4a81be){return{'model':db[_0x4a81be[_0xfed1('0x1f')]],'as':_0x4a81be['as'],'attributes':_0x4a81be[_0xfed1('0x1b')],'include':_0x4a81be[_0xfed1('0x1d')]?_[_0xfed1('0x1e')](_0x4a81be[_0xfed1('0x1d')],function(_0x1f5dcf){return{'model':db[_0x1f5dcf[_0xfed1('0x1f')]],'as':_0x1f5dcf['as'],'attributes':_0x1f5dcf[_0xfed1('0x1b')],'include':_0x1f5dcf['include']?_[_0xfed1('0x1e')](_0x1f5dcf[_0xfed1('0x1d')],function(_0x45f106){return{'model':db[_0x45f106[_0xfed1('0x1f')]],'as':_0x45f106['as'],'attributes':_0x45f106['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x42d5df){logger[_0xfed1('0x10')](_0xfed1('0x20'),_0x383955);logger[_0xfed1('0x12')](_0xfed1('0x20'),_0x383955,JSON[_0xfed1('0x14')](_0x42d5df));_0x30272b(_0x42d5df);})[_0xfed1('0x24')](function(_0x2f183c){logger['error']('ShowInterval',_0x2f183c[_0xfed1('0x17')],_0x383955);_0x5ccc3a(_0x12399f[_0xfed1('0x16')](0x1f4,_0x2f183c['message']));});});}; \ No newline at end of file +var _0xe14b=['catch','GetInterval','Interval','findAll','options','raw','where','attributes','include','model','map','stringify','ShowInterval','find','debug','lodash','util','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Interval,\x20%s,\x20%s','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x451999,_0x1b3908){var _0x1b696e=function(_0x259ab1){while(--_0x259ab1){_0x451999['push'](_0x451999['shift']());}};_0x1b696e(++_0x1b3908);}(_0xe14b,0x93));var _0xbe14=function(_0x384bdb,_0x54c114){_0x384bdb=_0x384bdb-0x0;var _0x595bcd=_0xe14b[_0x384bdb];return _0x595bcd;};'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,'limit':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['limit']||null:null,'include':_0x29ab73[_0xbe14('0x16')]?_0x29ab73['options'][_0xbe14('0x1a')]?_['map'](_0x29ab73[_0xbe14('0x16')][_0xbe14('0x1a')],function(_0x505dbd){return{'model':db[_0x505dbd[_0xbe14('0x1b')]],'as':_0x505dbd['as'],'attributes':_0x505dbd['attributes'],'include':_0x505dbd[_0xbe14('0x1a')]?_['map'](_0x505dbd[_0xbe14('0x1a')],function(_0x5fa043){return{'model':db[_0x5fa043[_0xbe14('0x1b')]],'as':_0x5fa043['as'],'attributes':_0x5fa043[_0xbe14('0x19')],'include':_0x5fa043[_0xbe14('0x1a')]?_[_0xbe14('0x1c')](_0x5fa043['include'],function(_0x1822e0){return{'model':db[_0x1822e0[_0xbe14('0x1b')]],'as':_0x1822e0['as'],'attributes':_0x1822e0[_0xbe14('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x5dd475){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x5dd475));_0x5ea1f8(_0x5dd475);})[_0xbe14('0x12')](function(_0x19252f){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x19252f[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x19252f[_0xbe14('0x10')]));});});};exports[_0xbe14('0x1e')]=function(_0x40538f){var _0x3bf43c=this;return new Promise(function(_0x39dc0a,_0x10ae36){return db[_0xbe14('0x14')][_0xbe14('0x1f')]({'raw':_0x40538f[_0xbe14('0x16')]?_0x40538f[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x40538f[_0xbe14('0x16')]?_0x40538f['options'][_0xbe14('0x18')]||null:null,'attributes':_0x40538f['options']?_0x40538f['options'][_0xbe14('0x19')]||null:null,'include':_0x40538f['options']?_0x40538f[_0xbe14('0x16')][_0xbe14('0x1a')]?_['map'](_0x40538f['options']['include'],function(_0x412ad5){return{'model':db[_0x412ad5[_0xbe14('0x1b')]],'as':_0x412ad5['as'],'attributes':_0x412ad5['attributes'],'include':_0x412ad5[_0xbe14('0x1a')]?_[_0xbe14('0x1c')](_0x412ad5[_0xbe14('0x1a')],function(_0x1aa849){return{'model':db[_0x1aa849[_0xbe14('0x1b')]],'as':_0x1aa849['as'],'attributes':_0x1aa849['attributes'],'include':_0x1aa849['include']?_[_0xbe14('0x1c')](_0x1aa849['include'],function(_0x5dd7aa){return{'model':db[_0x5dd7aa['model']],'as':_0x5dd7aa['as'],'attributes':_0x5dd7aa[_0xbe14('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x2bb45){logger[_0xbe14('0xa')](_0xbe14('0x1e'),_0x40538f);logger[_0xbe14('0x20')](_0xbe14('0x1e'),_0x40538f,JSON[_0xbe14('0x1d')](_0x2bb45));_0x39dc0a(_0x2bb45);})[_0xbe14('0x12')](function(_0x2dfd5a){logger[_0xbe14('0xe')](_0xbe14('0x1e'),_0x2dfd5a['message'],_0x40538f);_0x10ae36(_0x3bf43c['error'](0x1f4,_0x2dfd5a[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 2ff8583..d4c9385 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('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 3b538ef..6ea7c81 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 _0xbaf0=['description','stringify','issuetype','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','POST','Basic\x20','toString','base64','setEncoding','utf8','data','end','statusCode','json','parse','error','status','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20'];(function(_0x50cdf3,_0x6f825d){var _0x4f0ee7=function(_0x53a7a8){while(--_0x53a7a8){_0x50cdf3['push'](_0x50cdf3['shift']());}};_0x4f0ee7(++_0x6f825d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require('bluebird');var https=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var USERNAME=_0x0baf('0x3');var PASSWORD=_0x0baf('0x4');function openIssue(_0x4d2e72,_0x5a3e42){var _0x232cc7={'fields':{'project':{'key':_0x4d2e72[_0x0baf('0x5')]||_0x0baf('0x6')},'summary':(_0x4d2e72[_0x0baf('0x7')]||_0x0baf('0x8'))+_0x0baf('0x9')+_0x4d2e72['ip'],'description':_0x4d2e72[_0x0baf('0xa')]||JSON[_0x0baf('0xb')](_0x4d2e72),'issuetype':{'name':_0x4d2e72[_0x0baf('0xc')]||'Bug'}}};_0x232cc7[_0x0baf('0xd')]['customfield_11500']=_0x4d2e72[_0x0baf('0xe')];_0x232cc7[_0x0baf('0xd')][_0x0baf('0xf')]=_0x4d2e72[_0x0baf('0x10')];_0x232cc7[_0x0baf('0xd')][_0x0baf('0x11')]=_0x4d2e72[_0x0baf('0x12')];_0x232cc7[_0x0baf('0xd')][_0x0baf('0x13')]=_0x4d2e72[_0x0baf('0x14')];_0x232cc7[_0x0baf('0xd')]['customfield_11504']=_0x4d2e72['reason'];_0x232cc7[_0x0baf('0xd')][_0x0baf('0x15')]=_0x4d2e72['ip'];var _0x5db689={'host':_0x0baf('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0baf('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x0baf('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x0baf('0x19')](_0x0baf('0x1a'))}};var _0x2bc381=JSON[_0x0baf('0xb')](_0x232cc7);var _0x469599=https['request'](_0x5db689,function(_0x4cd79d){_0x4cd79d[_0x0baf('0x1b')](_0x0baf('0x1c'));var _0x283408='';_0x4cd79d['on'](_0x0baf('0x1d'),function(_0x2cf7da){_0x283408+=_0x2cf7da;});_0x4cd79d['on'](_0x0baf('0x1e'),function(){if(_0x5a3e42){return _0x5a3e42['status'](_0x4cd79d[_0x0baf('0x1f')])[_0x0baf('0x20')](JSON[_0x0baf('0x21')](_0x283408));}});});_0x469599['on'](_0x0baf('0x22'),function(_0x47070d){if(_0x5a3e42){return _0x5a3e42[_0x0baf('0x23')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x0baf('0x24')}]});}});_0x469599[_0x0baf('0x25')](_0x2bc381);_0x469599[_0x0baf('0x1e')]();}exports[_0x0baf('0x26')]=openIssue;exports[_0x0baf('0x27')]=function(_0x3e3e20,_0x210cd8){_0x3e3e20[_0x0baf('0x28')]['ip']=_0x3e3e20[_0x0baf('0x29')][_0x0baf('0x2a')]||_0x3e3e20['connection'][_0x0baf('0x2b')]||_0x3e3e20['socket'][_0x0baf('0x2b')]||_0x3e3e20['connection']['socket'][_0x0baf('0x2b')];return openIssue(_0x3e3e20['body'],_0x210cd8);}; \ No newline at end of file +var _0x70e0=['error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','3eAmWpBVP0','MOTGUI','Report','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','POST','base64','request','setEncoding','utf8','end','status','statusCode','json'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x70e0,0x17b));var _0x070e=function(_0x1281f1,_0x72eb40){_0x1281f1=_0x1281f1-0x0;var _0x5cb459=_0x70e0[_0x1281f1];return _0x5cb459;};'use strict';var BPromise=require(_0x070e('0x0'));var https=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var USERNAME='support';var PASSWORD=_0x070e('0x3');function openIssue(_0xee173,_0x277d32){var _0x2593e5={'fields':{'project':{'key':_0xee173['key']||_0x070e('0x4')},'summary':(_0xee173['summary']||_0x070e('0x5'))+'\x20from\x20'+_0xee173['ip'],'description':_0xee173['description']||JSON['stringify'](_0xee173),'issuetype':{'name':_0xee173[_0x070e('0x6')]||_0x070e('0x7')}}};_0x2593e5[_0x070e('0x8')][_0x070e('0x9')]=_0xee173[_0x070e('0xa')];_0x2593e5[_0x070e('0x8')][_0x070e('0xb')]=_0xee173['oldToken'];_0x2593e5['fields'][_0x070e('0xc')]=_0xee173[_0x070e('0xd')];_0x2593e5[_0x070e('0x8')][_0x070e('0xe')]=_0xee173[_0x070e('0xf')];_0x2593e5[_0x070e('0x8')][_0x070e('0x10')]=_0xee173[_0x070e('0x11')];_0x2593e5[_0x070e('0x8')][_0x070e('0x12')]=_0xee173['ip'];var _0x2930b8={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x070e('0x13'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x070e('0x14'))}};var _0x14c3fd=JSON['stringify'](_0x2593e5);var _0x5d3a38=https[_0x070e('0x15')](_0x2930b8,function(_0xeae1a5){_0xeae1a5[_0x070e('0x16')](_0x070e('0x17'));var _0x5bc71e='';_0xeae1a5['on']('data',function(_0x17e2e4){_0x5bc71e+=_0x17e2e4;});_0xeae1a5['on'](_0x070e('0x18'),function(){if(_0x277d32){return _0x277d32[_0x070e('0x19')](_0xeae1a5[_0x070e('0x1a')])[_0x070e('0x1b')](JSON['parse'](_0x5bc71e));}});});_0x5d3a38['on'](_0x070e('0x1c'),function(_0x168dc6){if(_0x277d32){return _0x277d32[_0x070e('0x19')](0x1f4)[_0x070e('0x1b')]({'errors':[{'message':_0x070e('0x1d'),'type':'api.jira'}]});}});_0x5d3a38['write'](_0x14c3fd);_0x5d3a38['end']();}exports[_0x070e('0x1e')]=openIssue;exports[_0x070e('0x1f')]=function(_0x20dc60,_0x4be0d7){_0x20dc60[_0x070e('0x20')]['ip']=_0x20dc60['headers'][_0x070e('0x21')]||_0x20dc60[_0x070e('0x22')][_0x070e('0x23')]||_0x20dc60[_0x070e('0x24')][_0x070e('0x23')]||_0x20dc60[_0x070e('0x22')][_0x070e('0x24')][_0x070e('0x23')];return openIssue(_0x20dc60['body'],_0x4be0d7);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e1bb3f8..43b2a44 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 _0xce01=['post','put','update','destroy','exports','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x2af0cd,_0x4c968d){var _0x1ddf5a=function(_0x1f5108){while(--_0x1f5108){_0x2af0cd['push'](_0x2af0cd['shift']());}};_0x1ddf5a(++_0x4c968d);}(_0xce01,0x8d));var _0x1ce0=function(_0x30a8c0,_0x4bf96e){_0x30a8c0=_0x30a8c0-0x0;var _0x2aa721=_0xce01[_0x30a8c0];return _0x2aa721;};'use strict';var multer=require(_0x1ce0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1ce0('0x1'));var router=express['Router']();var auth=require(_0x1ce0('0x2'));var interaction=require(_0x1ce0('0x3'));var config=require(_0x1ce0('0x4'));var controller=require(_0x1ce0('0x5'));router[_0x1ce0('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1ce0('0x6')](_0x1ce0('0x7'),auth[_0x1ce0('0x8')](),controller[_0x1ce0('0x9')]);router['get'](_0x1ce0('0xa'),auth['isAuthenticated'](),controller[_0x1ce0('0xb')]);router[_0x1ce0('0xc')]('/',auth[_0x1ce0('0x8')](),controller['create']);router[_0x1ce0('0xd')](_0x1ce0('0xa'),auth['isAuthenticated'](),controller[_0x1ce0('0xe')]);router['delete'](_0x1ce0('0xa'),auth[_0x1ce0('0x8')](),controller[_0x1ce0('0xf')]);module[_0x1ce0('0x10')]=router; \ No newline at end of file +var _0xcc85=['index','/describe','isAuthenticated','describe','/:id','show','post','create','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x2bcb4d,_0x1b1d96){var _0x423940=function(_0x28e92e){while(--_0x28e92e){_0x2bcb4d['push'](_0x2bcb4d['shift']());}};_0x423940(++_0x1b1d96);}(_0xcc85,0x6e));var _0x5cc8=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0xcc85[_0x39d39d];return _0x577ac3;};'use strict';var multer=require(_0x5cc8('0x0'));var util=require('util');var path=require(_0x5cc8('0x1'));var timeout=require(_0x5cc8('0x2'));var express=require(_0x5cc8('0x3'));var router=express[_0x5cc8('0x4')]();var auth=require(_0x5cc8('0x5'));var interaction=require(_0x5cc8('0x6'));var config=require(_0x5cc8('0x7'));var controller=require(_0x5cc8('0x8'));router[_0x5cc8('0x9')]('/',auth['isAuthenticated'](),controller[_0x5cc8('0xa')]);router[_0x5cc8('0x9')](_0x5cc8('0xb'),auth[_0x5cc8('0xc')](),controller[_0x5cc8('0xd')]);router[_0x5cc8('0x9')](_0x5cc8('0xe'),auth[_0x5cc8('0xc')](),controller[_0x5cc8('0xf')]);router[_0x5cc8('0x10')]('/',auth[_0x5cc8('0xc')](),controller[_0x5cc8('0x11')]);router['put'](_0x5cc8('0xe'),auth['isAuthenticated'](),controller[_0x5cc8('0x12')]);router['delete'](_0x5cc8('0xe'),auth[_0x5cc8('0xc')](),controller[_0x5cc8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index e8f9c00..be03813 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 _0x6f2f=['STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6f2f,0xbe));var _0xf6f2=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x6f2f[_0xa8883];return _0x479426;};'use strict';var Sequelize=require(_0xf6f2('0x0'));module[_0xf6f2('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0xf6f2('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf6f2('0x2')]},'calleridname':{'type':Sequelize[_0xf6f2('0x2')]},'calleridnum':{'type':Sequelize[_0xf6f2('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcaa3=['STRING','TEXT','long','sequelize','exports'];(function(_0x36b535,_0x2fb432){var _0xd347ec=function(_0x2d797a){while(--_0x2d797a){_0x36b535['push'](_0x36b535['shift']());}};_0xd347ec(++_0x2fb432);}(_0xcaa3,0xcb));var _0x3caa=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xcaa3[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0x3caa('0x0'));module[_0x3caa('0x1')]={'question':{'type':Sequelize[_0x3caa('0x2')]},'answer':{'type':Sequelize[_0x3caa('0x3')](_0x3caa('0x4'))},'membername':{'type':Sequelize[_0x3caa('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3caa('0x2')]},'calleridname':{'type':Sequelize[_0x3caa('0x2')]},'calleridnum':{'type':Sequelize[_0x3caa('0x2')]},'questionId':{'type':Sequelize[_0x3caa('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 69090a9..0fe4dcf 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 _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','then','stack','name','send','index','JscriptyAnswerReport','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(_0x44a59b,_0x18f8a5){var _0x5382c5=function(_0x453223){while(--_0x453223){_0x44a59b['push'](_0x44a59b['shift']());}};_0x5382c5(++_0x18f8a5);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var authService=require(_0x7995('0x12'));var hardwareService=require(_0x7995('0x13'));var Redis=require(_0x7995('0x14'));var qs=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['JscriptyAnswerReport']['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['JscriptyAnswerReport'][_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 _0x7a54=['mustache','util','path','sox','ejs','squel','crypto','desk.js','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','index','JscriptyAnswerReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','offset','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','include','rows','catch','show','params','length','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird'];(function(_0x2f19d8,_0x2ada94){var _0x46099c=function(_0x32813e){while(--_0x32813e){_0x2f19d8['push'](_0x2f19d8['shift']());}};_0x46099c(++_0x2ada94);}(_0x7a54,0x106));var _0x47a5=function(_0x1bd2c5,_0x4ee814){_0x1bd2c5=_0x1bd2c5-0x0;var _0x1ccf6e=_0x7a54[_0x1bd2c5];return _0x1ccf6e;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x47a5('0xe'));var hardwareService=require(_0x47a5('0xf'));var Redis=require('ioredis');var qs=require(_0x47a5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x47a5('0x11'));var config=require(_0x47a5('0x12'));var db=require(_0x47a5('0x13'))['db'];function respondWithStatusCode(_0x250fad,_0xd612dd){_0xd612dd=_0xd612dd||0xcc;return function(_0xd308b8){if(_0xd308b8){return _0x250fad[_0x47a5('0x14')](_0xd612dd);}return _0x250fad['status'](_0xd612dd)[_0x47a5('0x15')]();};}function respondWithResult(_0x221b54,_0x1cf309){_0x1cf309=_0x1cf309||0xc8;return function(_0x711793){if(_0x711793){return _0x221b54[_0x47a5('0x16')](_0x1cf309)[_0x47a5('0x17')](_0x711793);}};}function respondWithFilteredResult(_0x3c6c46,_0x190faa){return function(_0x4e99a8){if(_0x4e99a8){var _0x362359=_0x4e99a8[_0x47a5('0x18')],_0x11faf5=_0x190faa['offset'],_0x3b001e=_0x190faa['offset']+_0x190faa[_0x47a5('0x19')],_0x2a2cbb;if(_0x3b001e>=_0x362359){_0x3b001e=_0x362359;_0x2a2cbb=0xc8;}else{_0x2a2cbb=0xce;}_0x3c6c46['status'](_0x2a2cbb);return _0x3c6c46['set'](_0x47a5('0x1a'),_0x11faf5+'-'+_0x3b001e+'/'+_0x362359)[_0x47a5('0x17')](_0x4e99a8);}return null;};}function patchUpdates(_0x2ce454){return function(_0x1ef371){try{jsonpatch[_0x47a5('0x1b')](_0x1ef371,_0x2ce454,!![]);}catch(_0x12b98e){return BPromise[_0x47a5('0x1c')](_0x12b98e);}return _0x1ef371[_0x47a5('0x1d')]();};}function saveUpdates(_0x3aed38,_0x4a9fcb){return function(_0x1570bc){if(_0x1570bc){return _0x1570bc[_0x47a5('0x1e')](_0x3aed38)['then'](function(_0x2b0360){return _0x2b0360;});}return null;};}function removeEntity(_0x1f03f7,_0x36874d){return function(_0x4c5910){if(_0x4c5910){return _0x4c5910[_0x47a5('0x1f')]()[_0x47a5('0x20')](function(){_0x1f03f7[_0x47a5('0x16')](0xcc)[_0x47a5('0x15')]();});}};}function handleEntityNotFound(_0x5ef1b1,_0xe2dea9){return function(_0x385687){if(!_0x385687){_0x5ef1b1['sendStatus'](0x194);}return _0x385687;};}function handleError(_0x28747d,_0xc4cd63){_0xc4cd63=_0xc4cd63||0x1f4;return function(_0x4437f1){logger[_0x47a5('0x21')](_0x4437f1[_0x47a5('0x22')]);if(_0x4437f1['name']){delete _0x4437f1['name'];}_0x28747d[_0x47a5('0x16')](_0xc4cd63)['send'](_0x4437f1);};}exports[_0x47a5('0x23')]=function(_0x5b6c4e,_0x23cb77){var _0x378208={},_0x36ad34={},_0x1dac65={'count':0x0,'rows':[]};var _0x21f296=db[_0x47a5('0x24')][_0x47a5('0x25')];_0x36ad34[_0x47a5('0x26')]=_[_0x47a5('0x27')](_0x21f296);_0x36ad34[_0x47a5('0x28')]=_[_0x47a5('0x27')](_0x5b6c4e[_0x47a5('0x28')]);_0x36ad34[_0x47a5('0x29')]=_['intersection'](_0x36ad34[_0x47a5('0x26')],_0x36ad34['query']);_0x378208[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x36ad34[_0x47a5('0x26')],qs['fields'](_0x5b6c4e[_0x47a5('0x28')][_0x47a5('0x2c')]));_0x378208[_0x47a5('0x2a')]=_0x378208[_0x47a5('0x2a')]['length']?_0x378208['attributes']:_0x36ad34[_0x47a5('0x26')];if(!_0x5b6c4e[_0x47a5('0x28')]['hasOwnProperty']('nolimit')){_0x378208[_0x47a5('0x19')]=qs[_0x47a5('0x19')](_0x5b6c4e['query'][_0x47a5('0x19')]);_0x378208['offset']=qs[_0x47a5('0x2d')](_0x5b6c4e[_0x47a5('0x28')]['offset']);}_0x378208['order']=qs[_0x47a5('0x2e')](_0x5b6c4e['query'][_0x47a5('0x2e')]);_0x378208[_0x47a5('0x2f')]=qs[_0x47a5('0x29')](_['pick'](_0x5b6c4e[_0x47a5('0x28')],_0x36ad34['filters']));if(_0x5b6c4e['query'][_0x47a5('0x30')]){_0x378208['where']=_[_0x47a5('0x31')](_0x378208['where'],{'$or':_[_0x47a5('0x32')](_0x21f296,function(_0x3534cb){if(_0x3534cb[_0x47a5('0x33')][_0x47a5('0x34')]!==_0x47a5('0x35')){var _0xed6320={};_0xed6320[_0x3534cb[_0x47a5('0x36')]]={'$like':'%'+_0x5b6c4e[_0x47a5('0x28')][_0x47a5('0x30')]+'%'};return _0xed6320;}})});}_0x378208=_['merge']({},_0x378208,_0x5b6c4e[_0x47a5('0x37')]);var _0x10f136={'where':_0x378208['where']};return db[_0x47a5('0x24')][_0x47a5('0x18')](_0x10f136)[_0x47a5('0x20')](function(_0x49c4b5){_0x1dac65[_0x47a5('0x18')]=_0x49c4b5;if(_0x5b6c4e[_0x47a5('0x28')]['includeAll']){_0x378208[_0x47a5('0x38')]=[{'all':!![]}];}return db[_0x47a5('0x24')]['findAll'](_0x378208);})['then'](function(_0x5ebd8c){_0x1dac65[_0x47a5('0x39')]=_0x5ebd8c;return _0x1dac65;})['then'](respondWithFilteredResult(_0x23cb77,_0x378208))[_0x47a5('0x3a')](handleError(_0x23cb77,null));};exports[_0x47a5('0x3b')]=function(_0x301a85,_0x111f0d){var _0x1b2c80={'raw':!![],'where':{'id':_0x301a85[_0x47a5('0x3c')]['id']}},_0xcb5243={};_0xcb5243[_0x47a5('0x26')]=_[_0x47a5('0x27')](db[_0x47a5('0x24')][_0x47a5('0x25')]);_0xcb5243[_0x47a5('0x28')]=_[_0x47a5('0x27')](_0x301a85['query']);_0xcb5243[_0x47a5('0x29')]=_[_0x47a5('0x2b')](_0xcb5243[_0x47a5('0x26')],_0xcb5243[_0x47a5('0x28')]);_0x1b2c80['attributes']=_[_0x47a5('0x2b')](_0xcb5243['model'],qs['fields'](_0x301a85['query']['fields']));_0x1b2c80[_0x47a5('0x2a')]=_0x1b2c80['attributes'][_0x47a5('0x3d')]?_0x1b2c80[_0x47a5('0x2a')]:_0xcb5243[_0x47a5('0x26')];if(_0x301a85['query'][_0x47a5('0x3e')]){_0x1b2c80[_0x47a5('0x38')]=[{'all':!![]}];}_0x1b2c80=_['merge']({},_0x1b2c80,_0x301a85['options']);return db[_0x47a5('0x24')]['find'](_0x1b2c80)[_0x47a5('0x20')](handleEntityNotFound(_0x111f0d,null))[_0x47a5('0x20')](respondWithResult(_0x111f0d,null))[_0x47a5('0x3a')](handleError(_0x111f0d,null));};exports[_0x47a5('0x3f')]=function(_0x34a9ae,_0xf0edbb){return db[_0x47a5('0x24')][_0x47a5('0x3f')](_0x34a9ae[_0x47a5('0x40')],{})[_0x47a5('0x20')](respondWithResult(_0xf0edbb,0xc9))[_0x47a5('0x3a')](handleError(_0xf0edbb,null));};exports[_0x47a5('0x1e')]=function(_0xe28d76,_0x3574d4){if(_0xe28d76[_0x47a5('0x40')]['id']){delete _0xe28d76[_0x47a5('0x40')]['id'];}return db['JscriptyAnswerReport'][_0x47a5('0x41')]({'where':{'id':_0xe28d76[_0x47a5('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3574d4,null))['then'](saveUpdates(_0xe28d76[_0x47a5('0x40')],null))['then'](respondWithResult(_0x3574d4,null))[_0x47a5('0x3a')](handleError(_0x3574d4,null));};exports[_0x47a5('0x1f')]=function(_0x54c35f,_0x4f62d3){return db[_0x47a5('0x24')]['find']({'where':{'id':_0x54c35f[_0x47a5('0x3c')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x20')](removeEntity(_0x4f62d3,null))[_0x47a5('0x3a')](handleError(_0x4f62d3,null));};exports[_0x47a5('0x42')]=function(_0x26acd2,_0x238ebb){return db['JscriptyAnswerReport']['describe']()[_0x47a5('0x20')](respondWithResult(_0x238ebb,null))[_0x47a5('0x3a')](handleError(_0x238ebb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1600507..853d92d 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 _0xe81c=['util','../../config/logger','api','moment','bluebird','request-promise','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x4c3849,_0x5631b7){var _0xb06626=function(_0x11eed4){while(--_0x11eed4){_0x4c3849['push'](_0x4c3849['shift']());}};_0xb06626(++_0x5631b7);}(_0xe81c,0x154));var _0xce81=function(_0x11e03f,_0x20b967){_0x11e03f=_0x11e03f-0x0;var _0x5666fe=_0xe81c[_0x11e03f];return _0x5666fe;};'use strict';var _=require(_0xce81('0x0'));var util=require(_0xce81('0x1'));var logger=require(_0xce81('0x2'))(_0xce81('0x3'));var moment=require(_0xce81('0x4'));var BPromise=require(_0xce81('0x5'));var rp=require(_0xce81('0x6'));var attributes=require(_0xce81('0x7'));module['exports']=function(_0x41a2ad,_0x13f8e0){return _0x41a2ad[_0xce81('0x8')](_0xce81('0x9'),attributes,{'tableName':_0xce81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf62=['report_jscripty_answers','util','../../config/logger','api','moment','bluebird','request-promise','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x338a15,_0x24be35){var _0x29619a=function(_0x5360a7){while(--_0x5360a7){_0x338a15['push'](_0x338a15['shift']());}};_0x29619a(++_0x24be35);}(_0xcf62,0x1f0));var _0x2cf6=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xcf62[_0x5a776b];return _0xbbef59;};'use strict';var _=require('lodash');var util=require(_0x2cf6('0x0'));var logger=require(_0x2cf6('0x1'))(_0x2cf6('0x2'));var moment=require(_0x2cf6('0x3'));var BPromise=require(_0x2cf6('0x4'));var rp=require(_0x2cf6('0x5'));var attributes=require(_0x2cf6('0x6'));module[_0x2cf6('0x7')]=function(_0x4c243e,_0x26f8c9){return _0x4c243e[_0x2cf6('0x8')](_0x2cf6('0x9'),attributes,{'tableName':_0x2cf6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 0299e75..a215a26 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 _0xb5d7=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0xb5d7,0x1da));var _0x7b5d=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb5d7[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x7b5d('0x0'));var util=require(_0x7b5d('0x1'));var moment=require(_0x7b5d('0x2'));var BPromise=require(_0x7b5d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b5d('0x4'));var db=require(_0x7b5d('0x5'))['db'];var utils=require(_0x7b5d('0x6'));var logger=require(_0x7b5d('0x7'))(_0x7b5d('0x8'));var config=require(_0x7b5d('0x9'));var jayson=require(_0x7b5d('0xa'));var client=jayson[_0x7b5d('0xb')][_0x7b5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a4d12,_0x6aff4a,_0x4cf448){return new BPromise(function(_0x3c83b4,_0x523821){return client[_0x7b5d('0xd')](_0x5a4d12,_0x4cf448)[_0x7b5d('0xe')](function(_0x5dd54f){logger[_0x7b5d('0xf')](_0x7b5d('0x10'),_0x6aff4a,_0x7b5d('0x11'));logger['debug'](_0x7b5d('0x12'),_0x6aff4a,_0x7b5d('0x11'),JSON[_0x7b5d('0x13')](_0x5dd54f));if(_0x5dd54f[_0x7b5d('0x14')]){if(_0x5dd54f[_0x7b5d('0x14')][_0x7b5d('0x15')]===0x1f4){logger[_0x7b5d('0x14')](_0x7b5d('0x10'),_0x6aff4a,_0x5dd54f[_0x7b5d('0x14')][_0x7b5d('0x16')]);return _0x523821(_0x5dd54f['error']['message']);}logger[_0x7b5d('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x6aff4a,_0x5dd54f['error']['message']);return _0x3c83b4(_0x5dd54f[_0x7b5d('0x14')][_0x7b5d('0x16')]);}else{logger[_0x7b5d('0xf')](_0x7b5d('0x10'),_0x6aff4a,_0x7b5d('0x11'));_0x3c83b4(_0x5dd54f[_0x7b5d('0x17')]['message']);}})[_0x7b5d('0x18')](function(_0x14fa04){logger[_0x7b5d('0x14')](_0x7b5d('0x10'),_0x6aff4a,_0x14fa04);_0x523821(_0x14fa04);});});} \ No newline at end of file +var _0xdc32=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0xdc32,0xef));var _0x2dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dc3('0x0'));var util=require(_0x2dc3('0x1'));var moment=require(_0x2dc3('0x2'));var BPromise=require('bluebird');var rs=require(_0x2dc3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2dc3('0x4'));var logger=require('../../config/logger')(_0x2dc3('0x5'));var config=require(_0x2dc3('0x6'));var jayson=require(_0x2dc3('0x7'));var client=jayson[_0x2dc3('0x8')][_0x2dc3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x278a18,_0x105839,_0x36915d){return new BPromise(function(_0x2ad6ed,_0x4fa525){return client[_0x2dc3('0xa')](_0x278a18,_0x36915d)[_0x2dc3('0xb')](function(_0x373dc9){logger[_0x2dc3('0xc')](_0x2dc3('0xd'),_0x105839,_0x2dc3('0xe'));logger[_0x2dc3('0xf')](_0x2dc3('0x10'),_0x105839,_0x2dc3('0xe'),JSON[_0x2dc3('0x11')](_0x373dc9));if(_0x373dc9[_0x2dc3('0x12')]){if(_0x373dc9[_0x2dc3('0x12')]['code']===0x1f4){logger[_0x2dc3('0x12')](_0x2dc3('0xd'),_0x105839,_0x373dc9[_0x2dc3('0x12')][_0x2dc3('0x13')]);return _0x4fa525(_0x373dc9[_0x2dc3('0x12')][_0x2dc3('0x13')]);}logger['error'](_0x2dc3('0xd'),_0x105839,_0x373dc9[_0x2dc3('0x12')][_0x2dc3('0x13')]);return _0x2ad6ed(_0x373dc9[_0x2dc3('0x12')][_0x2dc3('0x13')]);}else{logger[_0x2dc3('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x105839,'request\x20sent');_0x2ad6ed(_0x373dc9['result'][_0x2dc3('0x13')]);}})[_0x2dc3('0x14')](function(_0x121310){logger[_0x2dc3('0x12')](_0x2dc3('0xd'),_0x105839,_0x121310);_0x4fa525(_0x121310);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1d50e4b..1894edb 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 _0x4809=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','isAuthenticated','index','show','get','/:id/sessions','getSessions','/:id/summary','30s','getSummary','post','create','/:id/clone','clone'];(function(_0x3bba4c,_0x1554b5){var _0xb90a9a=function(_0x271abe){while(--_0x271abe){_0x3bba4c['push'](_0x3bba4c['shift']());}};_0xb90a9a(++_0x1554b5);}(_0x4809,0x1e0));var _0x9480=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x4809[_0x35da42];return _0x370035;};'use strict';var multer=require(_0x9480('0x0'));var util=require(_0x9480('0x1'));var path=require(_0x9480('0x2'));var timeout=require(_0x9480('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9480('0x4'));var interaction=require(_0x9480('0x5'));var config=require('../../config/environment');var controller=require(_0x9480('0x6'));router['get']('/',auth[_0x9480('0x7')](),controller[_0x9480('0x8')]);router['get']('/:id',auth[_0x9480('0x7')](),controller[_0x9480('0x9')]);router[_0x9480('0xa')](_0x9480('0xb'),auth[_0x9480('0x7')](),controller[_0x9480('0xc')]);router[_0x9480('0xa')]('/:id/answers',auth[_0x9480('0x7')](),controller['getAnswers']);router['get'](_0x9480('0xd'),auth[_0x9480('0x7')](),timeout(_0x9480('0xe')),controller[_0x9480('0xf')]);router[_0x9480('0x10')]('/',auth['isAuthenticated'](),controller[_0x9480('0x11')]);router['post'](_0x9480('0x12'),auth[_0x9480('0x7')](),controller[_0x9480('0x13')]);router['put'](_0x9480('0x14'),auth[_0x9480('0x7')](),controller[_0x9480('0x15')]);router[_0x9480('0x16')](_0x9480('0x14'),auth[_0x9480('0x7')](),controller[_0x9480('0x17')]);module[_0x9480('0x18')]=router; \ No newline at end of file +var _0xe2dc=['Router','../../components/auth/service','../../config/environment','isAuthenticated','index','show','/:id/sessions','getSessions','get','getAnswers','/:id/summary','30s','create','post','/:id/clone','clone','put','update','delete','/:id','destroy','exports','multer','connect-timeout','express'];(function(_0x158d27,_0x3fafef){var _0x200219=function(_0x168f46){while(--_0x168f46){_0x158d27['push'](_0x158d27['shift']());}};_0x200219(++_0x3fafef);}(_0xe2dc,0xde));var _0xce2d=function(_0x50430d,_0x46a9ad){_0x50430d=_0x50430d-0x0;var _0xbf0108=_0xe2dc[_0x50430d];return _0xbf0108;};'use strict';var multer=require(_0xce2d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xce2d('0x1'));var express=require(_0xce2d('0x2'));var router=express[_0xce2d('0x3')]();var auth=require(_0xce2d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce2d('0x5'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0xce2d('0x6')](),controller[_0xce2d('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xce2d('0x8')]);router['get'](_0xce2d('0x9'),auth[_0xce2d('0x6')](),controller[_0xce2d('0xa')]);router[_0xce2d('0xb')]('/:id/answers',auth[_0xce2d('0x6')](),controller[_0xce2d('0xc')]);router[_0xce2d('0xb')](_0xce2d('0xd'),auth[_0xce2d('0x6')](),timeout(_0xce2d('0xe')),controller['getSummary']);router['post']('/',auth[_0xce2d('0x6')](),controller[_0xce2d('0xf')]);router[_0xce2d('0x10')](_0xce2d('0x11'),auth[_0xce2d('0x6')](),controller[_0xce2d('0x12')]);router[_0xce2d('0x13')]('/:id',auth[_0xce2d('0x6')](),controller[_0xce2d('0x14')]);router[_0xce2d('0x15')](_0xce2d('0x16'),auth['isAuthenticated'](),controller[_0xce2d('0x17')]);module[_0xce2d('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 467b527..76363c4 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 _0x0e79=['setDataValue','stringify','isString','formData','format','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike'];(function(_0x360ddc,_0x3e16fb){var _0x13bcf2=function(_0x68c30f){while(--_0x68c30f){_0x360ddc['push'](_0x360ddc['shift']());}};_0x13bcf2(++_0x3e16fb);}(_0x0e79,0x7f));var _0x90e7=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x0e79[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x90e7('0x0'));var _=require(_0x90e7('0x1'));var util=require(_0x90e7('0x2'));module[_0x90e7('0x3')]={'name':{'type':Sequelize[_0x90e7('0x4')],'unique':_0x90e7('0x5')},'description':{'type':Sequelize[_0x90e7('0x4')]},'formData':{'type':Sequelize[_0x90e7('0x6')](_0x90e7('0x7')),'set':function(_0x4c0d0a){if(_[_0x90e7('0x8')](_0x4c0d0a)){this[_0x90e7('0x9')]('formData',JSON[_0x90e7('0xa')](_0x4c0d0a));}else if(_[_0x90e7('0xb')](_0x4c0d0a)){this['setDataValue'](_0x90e7('0xc'),_0x4c0d0a);}else{this[_0x90e7('0x9')]('formData',util[_0x90e7('0xd')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x90e7('0xe')](_0x90e7('0x5'))||'',this[_0x90e7('0xe')](_0x90e7('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x90e7('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0x34c5=['long','isObjectLike','formData','stringify','isString','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','STRING','name'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x34c5,0x87));var _0x534c=function(_0x570571,_0x2bff10){_0x570571=_0x570571-0x0;var _0x302694=_0x34c5[_0x570571];return _0x302694;};'use strict';var Sequelize=require(_0x534c('0x0'));var _=require(_0x534c('0x1'));var util=require(_0x534c('0x2'));module['exports']={'name':{'type':Sequelize[_0x534c('0x3')],'unique':_0x534c('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x534c('0x5')),'set':function(_0x55807c){if(_[_0x534c('0x6')](_0x55807c)){this['setDataValue'](_0x534c('0x7'),JSON[_0x534c('0x8')](_0x55807c));}else if(_[_0x534c('0x9')](_0x55807c)){this[_0x534c('0xa')]('formData',_0x55807c);}else{this[_0x534c('0xa')](_0x534c('0x7'),util['format'](_0x534c('0xb'),this[_0x534c('0xc')](_0x534c('0x4'))||'',this[_0x534c('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x534c('0xd')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index cfc9bbd..9dbc8be 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 _0x9c21=['fromCharCode','toString','indexOf','getSummary','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','apply','reject','save','update','then','Projects','UserProfileResource','destroy','stack','name','send','index','JscriptyProject','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','field','options','count','includeAll','include','findAll','rows','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','omit','createdAt','updatedAt','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','JscriptySessionReport','nolimit','getAnswers','findOne','JscriptyAnswerReport'];(function(_0x2880d8,_0x284ded){var _0x51f5a9=function(_0xafd747){while(--_0xafd747){_0x2880d8['push'](_0x2880d8['shift']());}};_0x51f5a9(++_0x284ded);}(_0x9c21,0x1c1));var _0x19c2=function(_0x46d34a,_0x22be89){_0x46d34a=_0x46d34a-0x0;var _0x50620b=_0x9c21[_0x46d34a];return _0x50620b;};'use strict';var pdf=require(_0x19c2('0x0'));var emlformat=require(_0x19c2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x19c2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19c2('0x3'));var moment=require(_0x19c2('0x4'));var BPromise=require(_0x19c2('0x5'));var Mustache=require(_0x19c2('0x6'));var util=require(_0x19c2('0x7'));var path=require(_0x19c2('0x8'));var sox=require(_0x19c2('0x9'));var csv=require(_0x19c2('0xa'));var ejs=require(_0x19c2('0xb'));var fs=require('fs');var _=require(_0x19c2('0xc'));var squel=require('squel');var crypto=require(_0x19c2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x19c2('0xe'));var toCsv=require(_0x19c2('0xa'));var querystring=require(_0x19c2('0xf'));var Papa=require(_0x19c2('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x19c2('0x11'));var Redis=require('ioredis');var qs=require(_0x19c2('0x12'));var logger=require(_0x19c2('0x13'))('api');var utils=require(_0x19c2('0x14'));var config=require('../../config/environment');var db=require(_0x19c2('0x15'))['db'];function respondWithStatusCode(_0x140e4e,_0x85f66e){_0x85f66e=_0x85f66e||0xcc;return function(_0x398058){if(_0x398058){return _0x140e4e[_0x19c2('0x16')](_0x85f66e);}return _0x140e4e[_0x19c2('0x17')](_0x85f66e)[_0x19c2('0x18')]();};}function respondWithResult(_0xe04905,_0xfa830e){_0xfa830e=_0xfa830e||0xc8;return function(_0x421d30){if(_0x421d30){return _0xe04905['status'](_0xfa830e)['json'](_0x421d30);}};}function respondWithFilteredResult(_0x324974,_0x1e9701){return function(_0x49c57e){if(_0x49c57e){var _0x56751e=_0x49c57e['count'],_0x50caa7=_0x1e9701[_0x19c2('0x19')],_0x39dd9a=_0x1e9701[_0x19c2('0x19')]+_0x1e9701['limit'],_0x1b4057;if(_0x39dd9a>=_0x56751e){_0x39dd9a=_0x56751e;_0x1b4057=0xc8;}else{_0x1b4057=0xce;}_0x324974[_0x19c2('0x17')](_0x1b4057);return _0x324974[_0x19c2('0x1a')](_0x19c2('0x1b'),_0x50caa7+'-'+_0x39dd9a+'/'+_0x56751e)['json'](_0x49c57e);}return null;};}function patchUpdates(_0x3921bb){return function(_0x102b72){try{jsonpatch[_0x19c2('0x1c')](_0x102b72,_0x3921bb,!![]);}catch(_0x64a322){return BPromise[_0x19c2('0x1d')](_0x64a322);}return _0x102b72[_0x19c2('0x1e')]();};}function saveUpdates(_0x4ca9a0,_0x27eef2){return function(_0x2482c4){if(_0x2482c4){return _0x2482c4[_0x19c2('0x1f')](_0x4ca9a0)[_0x19c2('0x20')](function(_0xaa3bfb){return _0xaa3bfb;});}return null;};}function removeEntity(_0xf8ee2a,_0x12327b){return function(_0x265e0a){if(_0x265e0a){return _0x265e0a['destroy']()[_0x19c2('0x20')](function(){var _0x49e907=_0x265e0a['get']({'plain':!![]});var _0x4f9617=_0x19c2('0x21');return db[_0x19c2('0x22')][_0x19c2('0x23')]({'where':{'type':_0x4f9617,'resourceId':_0x49e907['id']}})[_0x19c2('0x20')](function(){return _0x265e0a;});})[_0x19c2('0x20')](function(){_0xf8ee2a[_0x19c2('0x17')](0xcc)[_0x19c2('0x18')]();});}};}function handleEntityNotFound(_0x38563b,_0x4306e4){return function(_0x2f94c4){if(!_0x2f94c4){_0x38563b['sendStatus'](0x194);}return _0x2f94c4;};}function handleError(_0x14dd1,_0x381b32){_0x381b32=_0x381b32||0x1f4;return function(_0x260486){logger['error'](_0x260486[_0x19c2('0x24')]);if(_0x260486[_0x19c2('0x25')]){delete _0x260486[_0x19c2('0x25')];}_0x14dd1[_0x19c2('0x17')](_0x381b32)[_0x19c2('0x26')](_0x260486);};}exports[_0x19c2('0x27')]=function(_0x37969a,_0x509f1e){var _0x11918c={},_0x3d293c={},_0x22c590={'count':0x0,'rows':[]};var _0x44e4f0=db[_0x19c2('0x28')][_0x19c2('0x29')];_0x3d293c[_0x19c2('0x2a')]=_[_0x19c2('0x2b')](_0x44e4f0);_0x3d293c[_0x19c2('0x2c')]=_[_0x19c2('0x2b')](_0x37969a[_0x19c2('0x2c')]);_0x3d293c[_0x19c2('0x2d')]=_[_0x19c2('0x2e')](_0x3d293c['model'],_0x3d293c[_0x19c2('0x2c')]);_0x11918c[_0x19c2('0x2f')]=_[_0x19c2('0x2e')](_0x3d293c[_0x19c2('0x2a')],qs[_0x19c2('0x30')](_0x37969a['query'][_0x19c2('0x30')]));_0x11918c[_0x19c2('0x2f')]=_0x11918c[_0x19c2('0x2f')][_0x19c2('0x31')]?_0x11918c[_0x19c2('0x2f')]:_0x3d293c[_0x19c2('0x2a')];if(!_0x37969a[_0x19c2('0x2c')][_0x19c2('0x32')]('nolimit')){_0x11918c[_0x19c2('0x33')]=qs['limit'](_0x37969a[_0x19c2('0x2c')][_0x19c2('0x33')]);_0x11918c[_0x19c2('0x19')]=qs[_0x19c2('0x19')](_0x37969a['query'][_0x19c2('0x19')]);}_0x11918c[_0x19c2('0x34')]=qs[_0x19c2('0x35')](_0x37969a[_0x19c2('0x2c')][_0x19c2('0x35')]);_0x11918c['where']=qs[_0x19c2('0x2d')](_[_0x19c2('0x36')](_0x37969a[_0x19c2('0x2c')],_0x3d293c[_0x19c2('0x2d')]));if(_0x37969a[_0x19c2('0x2c')][_0x19c2('0x37')]){_0x11918c[_0x19c2('0x38')]=_[_0x19c2('0x39')](_0x11918c[_0x19c2('0x38')],{'$or':_[_0x19c2('0x3a')](_0x44e4f0,function(_0x14f269){if(_0x14f269[_0x19c2('0x3b')]['key']!==_0x19c2('0x3c')){var _0x3a995f={};_0x3a995f[_0x14f269[_0x19c2('0x3d')]]={'$like':'%'+_0x37969a[_0x19c2('0x2c')][_0x19c2('0x37')]+'%'};return _0x3a995f;}})});}_0x11918c=_[_0x19c2('0x39')]({},_0x11918c,_0x37969a[_0x19c2('0x3e')]);var _0x5b04f5={'where':_0x11918c[_0x19c2('0x38')]};return db[_0x19c2('0x28')]['count'](_0x5b04f5)[_0x19c2('0x20')](function(_0x212aeb){_0x22c590[_0x19c2('0x3f')]=_0x212aeb;if(_0x37969a[_0x19c2('0x2c')][_0x19c2('0x40')]){_0x11918c[_0x19c2('0x41')]=[{'all':!![]}];}return db[_0x19c2('0x28')][_0x19c2('0x42')](_0x11918c);})['then'](function(_0x49263b){_0x22c590[_0x19c2('0x43')]=_0x49263b;return _0x22c590;})[_0x19c2('0x20')](respondWithFilteredResult(_0x509f1e,_0x11918c))['catch'](handleError(_0x509f1e,null));};exports['show']=function(_0x4e8462,_0x475e1b){var _0x357d38={'raw':![],'where':{'id':_0x4e8462[_0x19c2('0x44')]['id']}},_0x5a3b19={};_0x5a3b19['model']=_['keys'](db[_0x19c2('0x28')][_0x19c2('0x29')]);_0x5a3b19[_0x19c2('0x2c')]=_[_0x19c2('0x2b')](_0x4e8462[_0x19c2('0x2c')]);_0x5a3b19['filters']=_[_0x19c2('0x2e')](_0x5a3b19['model'],_0x5a3b19['query']);_0x357d38[_0x19c2('0x2f')]=_[_0x19c2('0x2e')](_0x5a3b19['model'],qs['fields'](_0x4e8462[_0x19c2('0x2c')][_0x19c2('0x30')]));_0x357d38[_0x19c2('0x2f')]=_0x357d38['attributes'][_0x19c2('0x31')]?_0x357d38[_0x19c2('0x2f')]:_0x5a3b19[_0x19c2('0x2a')];if(_0x4e8462[_0x19c2('0x2c')][_0x19c2('0x40')]){_0x357d38[_0x19c2('0x41')]=[{'all':!![]}];}_0x357d38=_[_0x19c2('0x39')]({},_0x357d38,_0x4e8462['options']);return db['JscriptyProject'][_0x19c2('0x45')](_0x357d38)['then'](handleEntityNotFound(_0x475e1b,null))[_0x19c2('0x20')](respondWithResult(_0x475e1b,null))[_0x19c2('0x46')](handleError(_0x475e1b,null));};exports[_0x19c2('0x47')]=function(_0x57ef2b,_0xc763a1){return db['JscriptyProject'][_0x19c2('0x47')](_0x57ef2b[_0x19c2('0x48')],{})[_0x19c2('0x20')](function(_0x352d8f){var _0x5085e5=_0x57ef2b[_0x19c2('0x49')][_0x19c2('0x4a')]({'plain':!![]});if(!_0x5085e5)throw new Error(_0x19c2('0x4b'));if(_0x5085e5[_0x19c2('0x4c')]===_0x19c2('0x49')){var _0xbab581=_0x352d8f[_0x19c2('0x4a')]({'plain':!![]});var _0x2226e8=_0x19c2('0x21');return db[_0x19c2('0x4d')]['find']({'where':{'name':_0x2226e8,'userProfileId':_0x5085e5['userProfileId']},'raw':!![]})['then'](function(_0x41f4e9){if(_0x41f4e9&&_0x41f4e9[_0x19c2('0x4e')]===0x0){return db[_0x19c2('0x22')][_0x19c2('0x47')]({'name':_0xbab581['name'],'resourceId':_0xbab581['id'],'type':_0x41f4e9[_0x19c2('0x25')],'sectionId':_0x41f4e9['id']},{})['then'](function(){return _0x352d8f;});}else{return _0x352d8f;}})['catch'](function(_0x52c643){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52c643);throw _0x52c643;});}return _0x352d8f;})[_0x19c2('0x20')](respondWithResult(_0xc763a1,0xc9))[_0x19c2('0x46')](handleError(_0xc763a1,null));};exports['clone']=function(_0x58ca52,_0x257600){var _0x3c1b8f={'raw':![],'where':{'id':_0x58ca52[_0x19c2('0x44')]['id']}},_0x26163f={};_0x26163f[_0x19c2('0x2a')]=_['keys'](db['JscriptyProject']['rawAttributes']);_0x3c1b8f['attributes']=_[_0x19c2('0x2e')](_0x26163f[_0x19c2('0x2a')],qs[_0x19c2('0x30')](_0x58ca52[_0x19c2('0x2c')][_0x19c2('0x30')]));_0x3c1b8f[_0x19c2('0x2f')]=_0x3c1b8f[_0x19c2('0x2f')][_0x19c2('0x31')]?_0x3c1b8f[_0x19c2('0x2f')]:_0x26163f[_0x19c2('0x2a')];if(_0x58ca52[_0x19c2('0x2c')][_0x19c2('0x40')]){_0x3c1b8f[_0x19c2('0x41')]=[{'all':!![]}];}_0x3c1b8f=_[_0x19c2('0x39')]({},_0x3c1b8f,_0x58ca52[_0x19c2('0x3e')]);return db[_0x19c2('0x28')]['find'](_0x3c1b8f)['then'](handleEntityNotFound(_0x257600,null))[_0x19c2('0x20')](function(_0x5b5270){if(_0x5b5270){var _0x5a2e57=_0x5b5270[_0x19c2('0x4a')]({'plain':!![]});_0x5a2e57=qs[_0x19c2('0x4f')](_0x5a2e57,['id',_0x19c2('0x50'),_0x19c2('0x51')]);_0x58ca52['body']=_[_0x19c2('0x4f')](_0x58ca52[_0x19c2('0x48')],['id',_0x19c2('0x50'),'updatedAt']);return db[_0x19c2('0x28')][_0x19c2('0x47')](_[_0x19c2('0x39')](_0x5a2e57,_0x58ca52[_0x19c2('0x48')]),{'include':_0x58ca52[_0x19c2('0x2c')]['includeAll']?[{'all':!![]}]:undefined})[_0x19c2('0x20')](function(_0x3b2490){var _0x2baed0=_0x58ca52[_0x19c2('0x49')][_0x19c2('0x4a')]({'plain':!![]});if(!_0x2baed0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2baed0['role']===_0x19c2('0x49')){var _0xc9f1cf=_0x3b2490[_0x19c2('0x4a')]({'plain':!![]});var _0xc1cd70=_0x19c2('0x21');return db[_0x19c2('0x4d')][_0x19c2('0x45')]({'where':{'name':_0xc1cd70,'userProfileId':_0x2baed0[_0x19c2('0x52')]},'raw':!![]})[_0x19c2('0x20')](function(_0x97bb26){if(_0x97bb26&&_0x97bb26[_0x19c2('0x4e')]===0x0){return db[_0x19c2('0x22')][_0x19c2('0x47')]({'name':_0xc9f1cf[_0x19c2('0x25')],'resourceId':_0xc9f1cf['id'],'type':_0x97bb26[_0x19c2('0x25')],'sectionId':_0x97bb26['id']},{})[_0x19c2('0x20')](function(){return _0x3b2490;});}else{return _0x3b2490;}})[_0x19c2('0x46')](function(_0x4457d7){logger[_0x19c2('0x53')](_0x19c2('0x54'),_0x4457d7);throw _0x4457d7;});}return _0x3b2490;});}})['then'](respondWithResult(_0x257600,0xc9))[_0x19c2('0x46')](handleError(_0x257600,null));};exports[_0x19c2('0x1f')]=function(_0x4829d0,_0x628173){if(_0x4829d0[_0x19c2('0x48')]['id']){delete _0x4829d0['body']['id'];}return db[_0x19c2('0x28')][_0x19c2('0x45')]({'where':{'id':_0x4829d0[_0x19c2('0x44')]['id']}})['then'](handleEntityNotFound(_0x628173,null))[_0x19c2('0x20')](saveUpdates(_0x4829d0[_0x19c2('0x48')],null))[_0x19c2('0x20')](respondWithResult(_0x628173,null))['catch'](handleError(_0x628173,null));};exports[_0x19c2('0x23')]=function(_0x294e2e,_0xf53a50){return db['JscriptyProject']['find']({'where':{'id':_0x294e2e[_0x19c2('0x44')]['id']}})[_0x19c2('0x20')](handleEntityNotFound(_0xf53a50,null))['then'](removeEntity(_0xf53a50,null))[_0x19c2('0x46')](handleError(_0xf53a50,null));};exports[_0x19c2('0x55')]=function(_0x5a61cf,_0x25cf63,_0xee82f8){var _0x3d8003={'raw':!![],'where':{}};var _0x3a122e={};var _0x2e6c55={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x5a61cf[_0x19c2('0x44')]['id']}})[_0x19c2('0x20')](handleEntityNotFound(_0x25cf63,null))['then'](function(_0xebf9d9){if(_0xebf9d9){_0x3a122e[_0x19c2('0x2a')]=_[_0x19c2('0x2b')](db[_0x19c2('0x56')][_0x19c2('0x29')]);_0x3a122e[_0x19c2('0x2c')]=_[_0x19c2('0x2b')](_0x5a61cf['query']);_0x3a122e[_0x19c2('0x2d')]=_[_0x19c2('0x2e')](_0x3a122e[_0x19c2('0x2a')],_0x3a122e['query']);_0x3d8003[_0x19c2('0x2f')]=_['intersection'](_0x3a122e[_0x19c2('0x2a')],qs[_0x19c2('0x30')](_0x5a61cf[_0x19c2('0x2c')][_0x19c2('0x30')]));_0x3d8003[_0x19c2('0x2f')]=_0x3d8003[_0x19c2('0x2f')][_0x19c2('0x31')]?_0x3d8003['attributes']:_0x3a122e['model'];if(!_0x5a61cf[_0x19c2('0x2c')][_0x19c2('0x32')](_0x19c2('0x57'))){_0x3d8003[_0x19c2('0x33')]=qs[_0x19c2('0x33')](_0x5a61cf[_0x19c2('0x2c')][_0x19c2('0x33')]);_0x3d8003[_0x19c2('0x19')]=qs[_0x19c2('0x19')](_0x5a61cf[_0x19c2('0x2c')]['offset']);}_0x3d8003[_0x19c2('0x34')]=qs['sort'](_0x5a61cf[_0x19c2('0x2c')][_0x19c2('0x35')]);_0x3d8003[_0x19c2('0x38')]=qs[_0x19c2('0x2d')](_['pick'](_0x5a61cf[_0x19c2('0x2c')],_0x3a122e[_0x19c2('0x2d')]));_0x3d8003[_0x19c2('0x38')]['ProjectId']=_0xebf9d9['id'];if(_0x5a61cf[_0x19c2('0x2c')][_0x19c2('0x37')]){_0x3d8003['where']=_[_0x19c2('0x39')](_0x3d8003['where'],{'$or':_[_0x19c2('0x3a')](_0x3d8003[_0x19c2('0x2f')],function(_0x25aeee){var _0x438d34={};_0x438d34[_0x25aeee]={'$like':'%'+_0x5a61cf['query'][_0x19c2('0x37')]+'%'};return _0x438d34;})});}_0x3d8003=_[_0x19c2('0x39')]({},_0x3d8003,_0x5a61cf[_0x19c2('0x3e')]);return db['JscriptySessionReport'][_0x19c2('0x3f')]({'where':_0x3d8003[_0x19c2('0x38')]})[_0x19c2('0x20')](function(_0x533afc){_0x2e6c55['count']=_0x533afc;if(_0x5a61cf[_0x19c2('0x2c')]['includeAll']){_0x3d8003[_0x19c2('0x41')]=[{'all':!![]}];}return db[_0x19c2('0x56')]['findAll'](_0x3d8003);})[_0x19c2('0x20')](function(_0x3dc206){_0x2e6c55[_0x19c2('0x43')]=_0x3dc206;return _0x2e6c55;});}})[_0x19c2('0x20')](respondWithFilteredResult(_0x25cf63,_0x3d8003))['catch'](handleError(_0x25cf63,null));};exports[_0x19c2('0x58')]=function(_0x50a3e4,_0x1d1788,_0x321c95){var _0x3df950={'raw':!![],'where':{}};var _0x3ca7d2={};var _0x358f3d={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x19c2('0x59')]({'where':{'id':_0x50a3e4['params']['id']}})[_0x19c2('0x20')](handleEntityNotFound(_0x1d1788,null))[_0x19c2('0x20')](function(_0x338cb4){if(_0x338cb4){_0x3ca7d2[_0x19c2('0x2a')]=_[_0x19c2('0x2b')](db['JscriptyAnswerReport']['rawAttributes']);_0x3ca7d2[_0x19c2('0x2c')]=_[_0x19c2('0x2b')](_0x50a3e4['query']);_0x3ca7d2[_0x19c2('0x2d')]=_['intersection'](_0x3ca7d2[_0x19c2('0x2a')],_0x3ca7d2[_0x19c2('0x2c')]);_0x3df950[_0x19c2('0x2f')]=_[_0x19c2('0x2e')](_0x3ca7d2[_0x19c2('0x2a')],qs[_0x19c2('0x30')](_0x50a3e4[_0x19c2('0x2c')]['fields']));_0x3df950[_0x19c2('0x2f')]=_0x3df950[_0x19c2('0x2f')][_0x19c2('0x31')]?_0x3df950[_0x19c2('0x2f')]:_0x3ca7d2[_0x19c2('0x2a')];if(!_0x50a3e4[_0x19c2('0x2c')][_0x19c2('0x32')](_0x19c2('0x57'))){_0x3df950[_0x19c2('0x33')]=qs[_0x19c2('0x33')](_0x50a3e4[_0x19c2('0x2c')]['limit']);_0x3df950[_0x19c2('0x19')]=qs['offset'](_0x50a3e4['query'][_0x19c2('0x19')]);}_0x3df950[_0x19c2('0x34')]=qs[_0x19c2('0x35')](_0x50a3e4['query']['sort']);_0x3df950['where']=qs[_0x19c2('0x2d')](_['pick'](_0x50a3e4['query'],_0x3ca7d2[_0x19c2('0x2d')]));_0x3df950[_0x19c2('0x38')]['ProjectId']=_0x338cb4['id'];if(_0x50a3e4['query'][_0x19c2('0x37')]){_0x3df950['where']=_[_0x19c2('0x39')](_0x3df950['where'],{'$or':_['map'](_0x3df950[_0x19c2('0x2f')],function(_0xbbcb1b){var _0xdaacc4={};_0xdaacc4[_0xbbcb1b]={'$like':'%'+_0x50a3e4[_0x19c2('0x2c')]['filter']+'%'};return _0xdaacc4;})});}_0x3df950=_[_0x19c2('0x39')]({},_0x3df950,_0x50a3e4[_0x19c2('0x3e')]);return db['JscriptyAnswerReport'][_0x19c2('0x3f')]({'where':_0x3df950[_0x19c2('0x38')]})['then'](function(_0x176dbc){_0x358f3d[_0x19c2('0x3f')]=_0x176dbc;if(_0x50a3e4[_0x19c2('0x2c')][_0x19c2('0x40')]){_0x3df950[_0x19c2('0x41')]=[{'all':!![]}];}return db[_0x19c2('0x5a')][_0x19c2('0x42')](_0x3df950);})[_0x19c2('0x20')](function(_0x3ef05c){_0x358f3d[_0x19c2('0x43')]=_0x3ef05c;return _0x358f3d;});}})[_0x19c2('0x20')](respondWithFilteredResult(_0x1d1788,_0x3df950))[_0x19c2('0x46')](handleError(_0x1d1788,null));};function char(_0x152164){return'number'===typeof _0x152164?String[_0x19c2('0x5b')][_0x19c2('0x1c')](null,arguments):_0x152164;}function needsEncapsulation(_0xa24fcc){return!!_0xa24fcc&&(_0xa24fcc[_0x19c2('0x5c')]()[_0x19c2('0x5d')](char(0xd))>=0x0||_0xa24fcc[_0x19c2('0x5c')]()[_0x19c2('0x5d')](char(0xa))>=0x0||_0xa24fcc[_0x19c2('0x5c')]()['indexOf'](char(0x2c))>=0x0||_0xa24fcc[_0x19c2('0x5c')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x203eb1){var _0x55598e=char(0x22),_0x26c8c5='\x5c'+char(0x22),_0x152b37=_0x203eb1[_0x19c2('0x5c')]()['replace'](new RegExp(_0x55598e,'g'),_0x26c8c5);return _0x55598e+_0x152b37+_0x55598e;}exports[_0x19c2('0x5e')]=function(_0x5cc995,_0x21d643,_0x1645b5){var _0x3c9e17,_0x17e06a;var _0x2e199f={'where':{'ProjectId':_0x5cc995[_0x19c2('0x44')]['id']}};if(_0x5cc995['query']['startTime']){_0x2e199f[_0x19c2('0x38')]['starttime']=JSON[_0x19c2('0x5f')](_0x5cc995[_0x19c2('0x2c')]['startTime']);}return db['JscriptySessionReport'][_0x19c2('0x42')](_0x2e199f)[_0x19c2('0x20')](handleEntityNotFound(_0x21d643,null))[_0x19c2('0x20')](function(_0x2a2cb4){if(_0x2a2cb4){_0x3c9e17=_0x2a2cb4;return db[_0x19c2('0x60')][_0x19c2('0x42')]({'where':{'SessionId':{'$in':_['map'](_0x3c9e17,'id')},'ProjectId':_0x5cc995[_0x19c2('0x44')]['id']},'order':_0x19c2('0x61')});}})[_0x19c2('0x20')](handleEntityNotFound(_0x21d643,null))[_0x19c2('0x20')](function(_0x2a029a){if(_0x2a029a){_0x17e06a=_0x2a029a;var _0x64f3e3={};for(var _0x5a3f33=0x0,_0x5a95a8=_0x17e06a[_0x19c2('0x31')];_0x5a3f33<_0x5a95a8;_0x5a3f33++){if(!_0x64f3e3[_0x19c2('0x32')](_0x17e06a[_0x5a3f33][_0x19c2('0x62')])){_0x64f3e3[_0x17e06a[_0x5a3f33][_0x19c2('0x62')]]=needsEncapsulation(_0x17e06a[_0x5a3f33][_0x19c2('0x63')])?encapsulate(_0x17e06a[_0x5a3f33]['question']):_0x17e06a[_0x5a3f33][_0x19c2('0x63')];}}var _0x2703ce=[],_0x1d5525={};for(var _0x17817d=0x0,_0x115c01=_0x3c9e17[_0x19c2('0x31')];_0x17817d<_0x115c01;_0x17817d++){_0x1d5525={'ProjectId':_0x5cc995['params']['id'],'SessionId':_0x3c9e17[_0x17817d]['id'],'StartTime':moment(_0x3c9e17[_0x17817d]['starttime'])[_0x19c2('0x64')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4a93bd=0x0,_0x5aabaa=_0x17e06a['length'];_0x4a93bd<_0x5aabaa;_0x4a93bd++){if(_0x17e06a[_0x4a93bd]['SessionId']==_0x3c9e17[_0x17817d]['id']&&_0x64f3e3[_0x19c2('0x32')](_0x17e06a[_0x4a93bd]['questionId'])){_0x1d5525[_0x64f3e3[_0x17e06a[_0x4a93bd]['questionId']]]=_0x17e06a[_0x4a93bd][_0x19c2('0x65')];}}for(var _0x4da57d in _0x64f3e3){if(!_0x1d5525[_0x19c2('0x32')](_0x64f3e3[_0x4da57d])){_0x1d5525[_0x64f3e3[_0x4da57d]]=null;}}_0x2703ce['push'](_0x1d5525);}return _0x2703ce;}})[_0x19c2('0x20')](function(_0x939c07){if(!_[_0x19c2('0x66')](_0x939c07)){var _0x3d4cc5=toCsv(_0x939c07);var _0x2b2144=Date[_0x19c2('0x67')]();fs[_0x19c2('0x68')](util[_0x19c2('0x64')](_0x19c2('0x69'),_0x5cc995[_0x19c2('0x44')]['id'],_0x2b2144),_0x3d4cc5);_0x21d643[_0x19c2('0x6a')]('Content-disposition','attachment;\x20filename='+util[_0x19c2('0x64')](_0x19c2('0x6b'),_0x5cc995[_0x19c2('0x44')]['id'],_0x2b2144));_0x21d643[_0x19c2('0x6a')]('Content-type','text/csv');return _0x21d643['download'](util[_0x19c2('0x64')](_0x19c2('0x69'),_0x5cc995[_0x19c2('0x44')]['id'],_0x2b2144));}else{return _0x21d643['sendStatus'](0xcc);}})[_0x19c2('0x46')](handleError(_0x21d643,null));}; \ No newline at end of file +var _0x288c=['status','end','count','offset','limit','Content-Range','json','apply','reject','then','destroy','Projects','UserProfileResource','sendStatus','error','name','send','index','JscriptyProject','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','map','type','key','includeAll','include','rows','catch','params','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','update','getSessions','findOne','JscriptySessionReport','order','pick','ProjectId','findAll','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/license/hardware','ioredis','api','../../mysqldb'];(function(_0x2ff115,_0x5864a8){var _0x3c5c72=function(_0x2f5b80){while(--_0x2f5b80){_0x2ff115['push'](_0x2ff115['shift']());}};_0x3c5c72(++_0x5864a8);}(_0x288c,0x1a4));var _0xc288=function(_0xd4d369,_0x4f6ad2){_0xd4d369=_0xd4d369-0x0;var _0x293e5d=_0x288c[_0xd4d369];return _0x293e5d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc288('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc288('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc288('0x2'));var BPromise=require(_0xc288('0x3'));var Mustache=require(_0xc288('0x4'));var util=require(_0xc288('0x5'));var path=require(_0xc288('0x6'));var sox=require(_0xc288('0x7'));var csv=require(_0xc288('0x8'));var ejs=require(_0xc288('0x9'));var fs=require('fs');var _=require(_0xc288('0xa'));var squel=require(_0xc288('0xb'));var crypto=require(_0xc288('0xc'));var jsforce=require(_0xc288('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc288('0x8'));var querystring=require(_0xc288('0xe'));var Papa=require(_0xc288('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0xc288('0x10'));var Redis=require(_0xc288('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc288('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc288('0x13'))['db'];function respondWithStatusCode(_0x3ff44d,_0xadb632){_0xadb632=_0xadb632||0xcc;return function(_0x2e62a0){if(_0x2e62a0){return _0x3ff44d['sendStatus'](_0xadb632);}return _0x3ff44d[_0xc288('0x14')](_0xadb632)[_0xc288('0x15')]();};}function respondWithResult(_0x3de165,_0x96f6b0){_0x96f6b0=_0x96f6b0||0xc8;return function(_0x1cf9e8){if(_0x1cf9e8){return _0x3de165['status'](_0x96f6b0)['json'](_0x1cf9e8);}};}function respondWithFilteredResult(_0x3a9474,_0x59ed2b){return function(_0xd7f66b){if(_0xd7f66b){var _0x4d3f99=_0xd7f66b[_0xc288('0x16')],_0x12d0b8=_0x59ed2b[_0xc288('0x17')],_0x1208bc=_0x59ed2b[_0xc288('0x17')]+_0x59ed2b[_0xc288('0x18')],_0x12ff87;if(_0x1208bc>=_0x4d3f99){_0x1208bc=_0x4d3f99;_0x12ff87=0xc8;}else{_0x12ff87=0xce;}_0x3a9474[_0xc288('0x14')](_0x12ff87);return _0x3a9474['set'](_0xc288('0x19'),_0x12d0b8+'-'+_0x1208bc+'/'+_0x4d3f99)[_0xc288('0x1a')](_0xd7f66b);}return null;};}function patchUpdates(_0x9154c1){return function(_0x54012c){try{jsonpatch[_0xc288('0x1b')](_0x54012c,_0x9154c1,!![]);}catch(_0x214680){return BPromise[_0xc288('0x1c')](_0x214680);}return _0x54012c['save']();};}function saveUpdates(_0x560683,_0x1b26d8){return function(_0x58b9e3){if(_0x58b9e3){return _0x58b9e3['update'](_0x560683)[_0xc288('0x1d')](function(_0x5d50ea){return _0x5d50ea;});}return null;};}function removeEntity(_0x3ef2a3,_0x3d031b){return function(_0x438328){if(_0x438328){return _0x438328[_0xc288('0x1e')]()[_0xc288('0x1d')](function(){var _0x49b247=_0x438328['get']({'plain':!![]});var _0x9493a9=_0xc288('0x1f');return db[_0xc288('0x20')][_0xc288('0x1e')]({'where':{'type':_0x9493a9,'resourceId':_0x49b247['id']}})[_0xc288('0x1d')](function(){return _0x438328;});})[_0xc288('0x1d')](function(){_0x3ef2a3[_0xc288('0x14')](0xcc)[_0xc288('0x15')]();});}};}function handleEntityNotFound(_0x5d250d,_0x2981f7){return function(_0x1be2f3){if(!_0x1be2f3){_0x5d250d[_0xc288('0x21')](0x194);}return _0x1be2f3;};}function handleError(_0x200879,_0x269182){_0x269182=_0x269182||0x1f4;return function(_0x36e1e3){logger[_0xc288('0x22')](_0x36e1e3['stack']);if(_0x36e1e3[_0xc288('0x23')]){delete _0x36e1e3[_0xc288('0x23')];}_0x200879[_0xc288('0x14')](_0x269182)[_0xc288('0x24')](_0x36e1e3);};}exports[_0xc288('0x25')]=function(_0x45bfad,_0x1d64d5){var _0x5c07a6={},_0x4f45b0={},_0x430b49={'count':0x0,'rows':[]};var _0x23bc2a=db[_0xc288('0x26')][_0xc288('0x27')];_0x4f45b0[_0xc288('0x28')]=_[_0xc288('0x29')](_0x23bc2a);_0x4f45b0[_0xc288('0x2a')]=_[_0xc288('0x29')](_0x45bfad[_0xc288('0x2a')]);_0x4f45b0['filters']=_[_0xc288('0x2b')](_0x4f45b0[_0xc288('0x28')],_0x4f45b0[_0xc288('0x2a')]);_0x5c07a6[_0xc288('0x2c')]=_[_0xc288('0x2b')](_0x4f45b0[_0xc288('0x28')],qs[_0xc288('0x2d')](_0x45bfad[_0xc288('0x2a')]['fields']));_0x5c07a6[_0xc288('0x2c')]=_0x5c07a6[_0xc288('0x2c')][_0xc288('0x2e')]?_0x5c07a6[_0xc288('0x2c')]:_0x4f45b0[_0xc288('0x28')];if(!_0x45bfad['query'][_0xc288('0x2f')](_0xc288('0x30'))){_0x5c07a6[_0xc288('0x18')]=qs[_0xc288('0x18')](_0x45bfad[_0xc288('0x2a')][_0xc288('0x18')]);_0x5c07a6[_0xc288('0x17')]=qs[_0xc288('0x17')](_0x45bfad[_0xc288('0x2a')][_0xc288('0x17')]);}_0x5c07a6['order']=qs[_0xc288('0x31')](_0x45bfad[_0xc288('0x2a')][_0xc288('0x31')]);_0x5c07a6['where']=qs['filters'](_['pick'](_0x45bfad[_0xc288('0x2a')],_0x4f45b0[_0xc288('0x32')]));if(_0x45bfad['query'][_0xc288('0x33')]){_0x5c07a6[_0xc288('0x34')]=_[_0xc288('0x35')](_0x5c07a6[_0xc288('0x34')],{'$or':_[_0xc288('0x36')](_0x23bc2a,function(_0x3c30c7){if(_0x3c30c7[_0xc288('0x37')][_0xc288('0x38')]!=='VIRTUAL'){var _0x3e99df={};_0x3e99df[_0x3c30c7['field']]={'$like':'%'+_0x45bfad[_0xc288('0x2a')]['filter']+'%'};return _0x3e99df;}})});}_0x5c07a6=_[_0xc288('0x35')]({},_0x5c07a6,_0x45bfad['options']);var _0xf15279={'where':_0x5c07a6['where']};return db[_0xc288('0x26')][_0xc288('0x16')](_0xf15279)[_0xc288('0x1d')](function(_0x606d71){_0x430b49[_0xc288('0x16')]=_0x606d71;if(_0x45bfad[_0xc288('0x2a')][_0xc288('0x39')]){_0x5c07a6[_0xc288('0x3a')]=[{'all':!![]}];}return db[_0xc288('0x26')]['findAll'](_0x5c07a6);})[_0xc288('0x1d')](function(_0x5d4fa5){_0x430b49[_0xc288('0x3b')]=_0x5d4fa5;return _0x430b49;})[_0xc288('0x1d')](respondWithFilteredResult(_0x1d64d5,_0x5c07a6))[_0xc288('0x3c')](handleError(_0x1d64d5,null));};exports['show']=function(_0x536784,_0x417366){var _0x38e24f={'raw':![],'where':{'id':_0x536784[_0xc288('0x3d')]['id']}},_0x26fd39={};_0x26fd39[_0xc288('0x28')]=_[_0xc288('0x29')](db[_0xc288('0x26')][_0xc288('0x27')]);_0x26fd39['query']=_[_0xc288('0x29')](_0x536784['query']);_0x26fd39[_0xc288('0x32')]=_['intersection'](_0x26fd39[_0xc288('0x28')],_0x26fd39[_0xc288('0x2a')]);_0x38e24f['attributes']=_[_0xc288('0x2b')](_0x26fd39['model'],qs[_0xc288('0x2d')](_0x536784[_0xc288('0x2a')]['fields']));_0x38e24f[_0xc288('0x2c')]=_0x38e24f['attributes'][_0xc288('0x2e')]?_0x38e24f[_0xc288('0x2c')]:_0x26fd39['model'];if(_0x536784[_0xc288('0x2a')]['includeAll']){_0x38e24f[_0xc288('0x3a')]=[{'all':!![]}];}_0x38e24f=_[_0xc288('0x35')]({},_0x38e24f,_0x536784[_0xc288('0x3e')]);return db[_0xc288('0x26')][_0xc288('0x3f')](_0x38e24f)[_0xc288('0x1d')](handleEntityNotFound(_0x417366,null))[_0xc288('0x1d')](respondWithResult(_0x417366,null))[_0xc288('0x3c')](handleError(_0x417366,null));};exports['create']=function(_0x19e94c,_0x2f1aa6){return db[_0xc288('0x26')][_0xc288('0x40')](_0x19e94c[_0xc288('0x41')],{})[_0xc288('0x1d')](function(_0x2468ab){var _0x2621cc=_0x19e94c['user'][_0xc288('0x42')]({'plain':!![]});if(!_0x2621cc)throw new Error(_0xc288('0x43'));if(_0x2621cc[_0xc288('0x44')]===_0xc288('0x45')){var _0x2519b1=_0x2468ab[_0xc288('0x42')]({'plain':!![]});var _0x5196bd=_0xc288('0x1f');return db[_0xc288('0x46')][_0xc288('0x3f')]({'where':{'name':_0x5196bd,'userProfileId':_0x2621cc[_0xc288('0x47')]},'raw':!![]})[_0xc288('0x1d')](function(_0xbd4494){if(_0xbd4494&&_0xbd4494[_0xc288('0x48')]===0x0){return db[_0xc288('0x20')][_0xc288('0x40')]({'name':_0x2519b1[_0xc288('0x23')],'resourceId':_0x2519b1['id'],'type':_0xbd4494[_0xc288('0x23')],'sectionId':_0xbd4494['id']},{})['then'](function(){return _0x2468ab;});}else{return _0x2468ab;}})[_0xc288('0x3c')](function(_0x50f1f2){logger[_0xc288('0x22')](_0xc288('0x49'),_0x50f1f2);throw _0x50f1f2;});}return _0x2468ab;})[_0xc288('0x1d')](respondWithResult(_0x2f1aa6,0xc9))[_0xc288('0x3c')](handleError(_0x2f1aa6,null));};exports['clone']=function(_0x311167,_0x64f4f9){var _0xb27624={'raw':![],'where':{'id':_0x311167[_0xc288('0x3d')]['id']}},_0x57afc1={};_0x57afc1[_0xc288('0x28')]=_['keys'](db['JscriptyProject'][_0xc288('0x27')]);_0xb27624['attributes']=_[_0xc288('0x2b')](_0x57afc1['model'],qs[_0xc288('0x2d')](_0x311167[_0xc288('0x2a')][_0xc288('0x2d')]));_0xb27624[_0xc288('0x2c')]=_0xb27624[_0xc288('0x2c')][_0xc288('0x2e')]?_0xb27624[_0xc288('0x2c')]:_0x57afc1[_0xc288('0x28')];if(_0x311167[_0xc288('0x2a')][_0xc288('0x39')]){_0xb27624[_0xc288('0x3a')]=[{'all':!![]}];}_0xb27624=_[_0xc288('0x35')]({},_0xb27624,_0x311167[_0xc288('0x3e')]);return db[_0xc288('0x26')]['find'](_0xb27624)[_0xc288('0x1d')](handleEntityNotFound(_0x64f4f9,null))[_0xc288('0x1d')](function(_0xe29059){if(_0xe29059){var _0x12c3fb=_0xe29059['get']({'plain':!![]});_0x12c3fb=qs['omit'](_0x12c3fb,['id',_0xc288('0x4a'),_0xc288('0x4b')]);_0x311167[_0xc288('0x41')]=_[_0xc288('0x4c')](_0x311167[_0xc288('0x41')],['id',_0xc288('0x4a'),_0xc288('0x4b')]);return db['JscriptyProject'][_0xc288('0x40')](_[_0xc288('0x35')](_0x12c3fb,_0x311167[_0xc288('0x41')]),{'include':_0x311167[_0xc288('0x2a')][_0xc288('0x39')]?[{'all':!![]}]:undefined})[_0xc288('0x1d')](function(_0x5a9f17){var _0x5d4ff1=_0x311167[_0xc288('0x45')][_0xc288('0x42')]({'plain':!![]});if(!_0x5d4ff1)throw new Error(_0xc288('0x43'));if(_0x5d4ff1[_0xc288('0x44')]===_0xc288('0x45')){var _0x52161e=_0x5a9f17[_0xc288('0x42')]({'plain':!![]});var _0x7285ac=_0xc288('0x1f');return db['UserProfileSection'][_0xc288('0x3f')]({'where':{'name':_0x7285ac,'userProfileId':_0x5d4ff1[_0xc288('0x47')]},'raw':!![]})[_0xc288('0x1d')](function(_0x1947ec){if(_0x1947ec&&_0x1947ec[_0xc288('0x48')]===0x0){return db[_0xc288('0x20')][_0xc288('0x40')]({'name':_0x52161e['name'],'resourceId':_0x52161e['id'],'type':_0x1947ec['name'],'sectionId':_0x1947ec['id']},{})[_0xc288('0x1d')](function(){return _0x5a9f17;});}else{return _0x5a9f17;}})[_0xc288('0x3c')](function(_0x1798aa){logger['error'](_0xc288('0x49'),_0x1798aa);throw _0x1798aa;});}return _0x5a9f17;});}})[_0xc288('0x1d')](respondWithResult(_0x64f4f9,0xc9))[_0xc288('0x3c')](handleError(_0x64f4f9,null));};exports[_0xc288('0x4d')]=function(_0x58512f,_0x39036d){if(_0x58512f[_0xc288('0x41')]['id']){delete _0x58512f[_0xc288('0x41')]['id'];}return db[_0xc288('0x26')][_0xc288('0x3f')]({'where':{'id':_0x58512f['params']['id']}})[_0xc288('0x1d')](handleEntityNotFound(_0x39036d,null))[_0xc288('0x1d')](saveUpdates(_0x58512f[_0xc288('0x41')],null))['then'](respondWithResult(_0x39036d,null))[_0xc288('0x3c')](handleError(_0x39036d,null));};exports[_0xc288('0x1e')]=function(_0x99f106,_0x267cd6){return db[_0xc288('0x26')][_0xc288('0x3f')]({'where':{'id':_0x99f106[_0xc288('0x3d')]['id']}})[_0xc288('0x1d')](handleEntityNotFound(_0x267cd6,null))['then'](removeEntity(_0x267cd6,null))[_0xc288('0x3c')](handleError(_0x267cd6,null));};exports[_0xc288('0x4e')]=function(_0x185cd1,_0x38c6aa,_0x498b8b){var _0x27eccf={'raw':!![],'where':{}};var _0x3f9989={};var _0x2fdb53={'count':0x0,'rows':[]};return db[_0xc288('0x26')][_0xc288('0x4f')]({'where':{'id':_0x185cd1[_0xc288('0x3d')]['id']}})[_0xc288('0x1d')](handleEntityNotFound(_0x38c6aa,null))[_0xc288('0x1d')](function(_0x4fdf04){if(_0x4fdf04){_0x3f9989[_0xc288('0x28')]=_[_0xc288('0x29')](db[_0xc288('0x50')][_0xc288('0x27')]);_0x3f9989[_0xc288('0x2a')]=_[_0xc288('0x29')](_0x185cd1[_0xc288('0x2a')]);_0x3f9989[_0xc288('0x32')]=_[_0xc288('0x2b')](_0x3f9989[_0xc288('0x28')],_0x3f9989[_0xc288('0x2a')]);_0x27eccf[_0xc288('0x2c')]=_[_0xc288('0x2b')](_0x3f9989['model'],qs['fields'](_0x185cd1[_0xc288('0x2a')]['fields']));_0x27eccf[_0xc288('0x2c')]=_0x27eccf[_0xc288('0x2c')][_0xc288('0x2e')]?_0x27eccf[_0xc288('0x2c')]:_0x3f9989[_0xc288('0x28')];if(!_0x185cd1[_0xc288('0x2a')]['hasOwnProperty'](_0xc288('0x30'))){_0x27eccf[_0xc288('0x18')]=qs['limit'](_0x185cd1[_0xc288('0x2a')][_0xc288('0x18')]);_0x27eccf[_0xc288('0x17')]=qs[_0xc288('0x17')](_0x185cd1[_0xc288('0x2a')][_0xc288('0x17')]);}_0x27eccf[_0xc288('0x51')]=qs[_0xc288('0x31')](_0x185cd1['query']['sort']);_0x27eccf[_0xc288('0x34')]=qs[_0xc288('0x32')](_[_0xc288('0x52')](_0x185cd1[_0xc288('0x2a')],_0x3f9989[_0xc288('0x32')]));_0x27eccf[_0xc288('0x34')][_0xc288('0x53')]=_0x4fdf04['id'];if(_0x185cd1[_0xc288('0x2a')]['filter']){_0x27eccf[_0xc288('0x34')]=_[_0xc288('0x35')](_0x27eccf[_0xc288('0x34')],{'$or':_[_0xc288('0x36')](_0x27eccf[_0xc288('0x2c')],function(_0x26120e){var _0x1fbdb0={};_0x1fbdb0[_0x26120e]={'$like':'%'+_0x185cd1[_0xc288('0x2a')][_0xc288('0x33')]+'%'};return _0x1fbdb0;})});}_0x27eccf=_[_0xc288('0x35')]({},_0x27eccf,_0x185cd1['options']);return db[_0xc288('0x50')][_0xc288('0x16')]({'where':_0x27eccf[_0xc288('0x34')]})['then'](function(_0x34059e){_0x2fdb53[_0xc288('0x16')]=_0x34059e;if(_0x185cd1[_0xc288('0x2a')]['includeAll']){_0x27eccf[_0xc288('0x3a')]=[{'all':!![]}];}return db[_0xc288('0x50')][_0xc288('0x54')](_0x27eccf);})[_0xc288('0x1d')](function(_0x181f70){_0x2fdb53[_0xc288('0x3b')]=_0x181f70;return _0x2fdb53;});}})[_0xc288('0x1d')](respondWithFilteredResult(_0x38c6aa,_0x27eccf))[_0xc288('0x3c')](handleError(_0x38c6aa,null));};exports['getAnswers']=function(_0x1b1801,_0xd919d2,_0x46dd1d){var _0x5ed10a={'raw':!![],'where':{}};var _0x46443e={};var _0x1bd6f9={'count':0x0,'rows':[]};return db[_0xc288('0x26')][_0xc288('0x4f')]({'where':{'id':_0x1b1801[_0xc288('0x3d')]['id']}})['then'](handleEntityNotFound(_0xd919d2,null))[_0xc288('0x1d')](function(_0x229744){if(_0x229744){_0x46443e[_0xc288('0x28')]=_[_0xc288('0x29')](db['JscriptyAnswerReport'][_0xc288('0x27')]);_0x46443e[_0xc288('0x2a')]=_[_0xc288('0x29')](_0x1b1801['query']);_0x46443e[_0xc288('0x32')]=_[_0xc288('0x2b')](_0x46443e[_0xc288('0x28')],_0x46443e[_0xc288('0x2a')]);_0x5ed10a[_0xc288('0x2c')]=_[_0xc288('0x2b')](_0x46443e[_0xc288('0x28')],qs['fields'](_0x1b1801[_0xc288('0x2a')][_0xc288('0x2d')]));_0x5ed10a[_0xc288('0x2c')]=_0x5ed10a['attributes'][_0xc288('0x2e')]?_0x5ed10a[_0xc288('0x2c')]:_0x46443e[_0xc288('0x28')];if(!_0x1b1801[_0xc288('0x2a')][_0xc288('0x2f')]('nolimit')){_0x5ed10a[_0xc288('0x18')]=qs['limit'](_0x1b1801['query'][_0xc288('0x18')]);_0x5ed10a[_0xc288('0x17')]=qs[_0xc288('0x17')](_0x1b1801[_0xc288('0x2a')][_0xc288('0x17')]);}_0x5ed10a[_0xc288('0x51')]=qs[_0xc288('0x31')](_0x1b1801[_0xc288('0x2a')]['sort']);_0x5ed10a[_0xc288('0x34')]=qs['filters'](_[_0xc288('0x52')](_0x1b1801[_0xc288('0x2a')],_0x46443e[_0xc288('0x32')]));_0x5ed10a[_0xc288('0x34')][_0xc288('0x53')]=_0x229744['id'];if(_0x1b1801[_0xc288('0x2a')][_0xc288('0x33')]){_0x5ed10a[_0xc288('0x34')]=_[_0xc288('0x35')](_0x5ed10a[_0xc288('0x34')],{'$or':_['map'](_0x5ed10a[_0xc288('0x2c')],function(_0x1bd0ee){var _0x43fd11={};_0x43fd11[_0x1bd0ee]={'$like':'%'+_0x1b1801['query'][_0xc288('0x33')]+'%'};return _0x43fd11;})});}_0x5ed10a=_[_0xc288('0x35')]({},_0x5ed10a,_0x1b1801[_0xc288('0x3e')]);return db[_0xc288('0x55')][_0xc288('0x16')]({'where':_0x5ed10a[_0xc288('0x34')]})['then'](function(_0x47b520){_0x1bd6f9[_0xc288('0x16')]=_0x47b520;if(_0x1b1801[_0xc288('0x2a')][_0xc288('0x39')]){_0x5ed10a[_0xc288('0x3a')]=[{'all':!![]}];}return db[_0xc288('0x55')]['findAll'](_0x5ed10a);})[_0xc288('0x1d')](function(_0x19cf7f){_0x1bd6f9[_0xc288('0x3b')]=_0x19cf7f;return _0x1bd6f9;});}})[_0xc288('0x1d')](respondWithFilteredResult(_0xd919d2,_0x5ed10a))[_0xc288('0x3c')](handleError(_0xd919d2,null));};function char(_0x48b595){return _0xc288('0x56')===typeof _0x48b595?String[_0xc288('0x57')][_0xc288('0x1b')](null,arguments):_0x48b595;}function needsEncapsulation(_0x7a5ddd){return!!_0x7a5ddd&&(_0x7a5ddd[_0xc288('0x58')]()[_0xc288('0x59')](char(0xd))>=0x0||_0x7a5ddd['toString']()[_0xc288('0x59')](char(0xa))>=0x0||_0x7a5ddd[_0xc288('0x58')]()['indexOf'](char(0x2c))>=0x0||_0x7a5ddd['toString']()[_0xc288('0x59')](char(0x22))>=0x0);}function encapsulate(_0x354a37){var _0x56ea74=char(0x22),_0x3ee42b='\x5c'+char(0x22),_0xd6e945=_0x354a37['toString']()[_0xc288('0x5a')](new RegExp(_0x56ea74,'g'),_0x3ee42b);return _0x56ea74+_0xd6e945+_0x56ea74;}exports[_0xc288('0x5b')]=function(_0x5f17d4,_0x4dafe2,_0x246c52){var _0x4f2adf,_0xad8cd0;var _0x28c0f4={'where':{'ProjectId':_0x5f17d4[_0xc288('0x3d')]['id']}};if(_0x5f17d4[_0xc288('0x2a')]['startTime']){_0x28c0f4[_0xc288('0x34')][_0xc288('0x5c')]=JSON[_0xc288('0x5d')](_0x5f17d4[_0xc288('0x2a')][_0xc288('0x5e')]);}return db[_0xc288('0x50')]['findAll'](_0x28c0f4)[_0xc288('0x1d')](handleEntityNotFound(_0x4dafe2,null))[_0xc288('0x1d')](function(_0x3cddd4){if(_0x3cddd4){_0x4f2adf=_0x3cddd4;return db[_0xc288('0x5f')][_0xc288('0x54')]({'where':{'SessionId':{'$in':_[_0xc288('0x36')](_0x4f2adf,'id')},'ProjectId':_0x5f17d4['params']['id']},'order':'-createdAt'});}})[_0xc288('0x1d')](handleEntityNotFound(_0x4dafe2,null))[_0xc288('0x1d')](function(_0x5c0f89){if(_0x5c0f89){_0xad8cd0=_0x5c0f89;var _0x57ad1c={};for(var _0x24bf40=0x0,_0x1ca095=_0xad8cd0[_0xc288('0x2e')];_0x24bf40<_0x1ca095;_0x24bf40++){if(!_0x57ad1c[_0xc288('0x2f')](_0xad8cd0[_0x24bf40][_0xc288('0x60')])){_0x57ad1c[_0xad8cd0[_0x24bf40][_0xc288('0x60')]]=needsEncapsulation(_0xad8cd0[_0x24bf40]['question'])?encapsulate(_0xad8cd0[_0x24bf40][_0xc288('0x61')]):_0xad8cd0[_0x24bf40][_0xc288('0x61')];}}var _0x47d8c7=[],_0xb1011f={};for(var _0x15e731=0x0,_0x12cfd3=_0x4f2adf['length'];_0x15e731<_0x12cfd3;_0x15e731++){_0xb1011f={'ProjectId':_0x5f17d4[_0xc288('0x3d')]['id'],'SessionId':_0x4f2adf[_0x15e731]['id'],'StartTime':moment(_0x4f2adf[_0x15e731]['starttime'])['format'](_0xc288('0x62'))};for(var _0x518d5d=0x0,_0x16c911=_0xad8cd0['length'];_0x518d5d<_0x16c911;_0x518d5d++){if(_0xad8cd0[_0x518d5d][_0xc288('0x63')]==_0x4f2adf[_0x15e731]['id']&&_0x57ad1c['hasOwnProperty'](_0xad8cd0[_0x518d5d][_0xc288('0x60')])){_0xb1011f[_0x57ad1c[_0xad8cd0[_0x518d5d][_0xc288('0x60')]]]=_0xad8cd0[_0x518d5d][_0xc288('0x64')];}}for(var _0x2b71c3 in _0x57ad1c){if(!_0xb1011f[_0xc288('0x2f')](_0x57ad1c[_0x2b71c3])){_0xb1011f[_0x57ad1c[_0x2b71c3]]=null;}}_0x47d8c7[_0xc288('0x65')](_0xb1011f);}return _0x47d8c7;}})[_0xc288('0x1d')](function(_0x19927e){if(!_['isEmpty'](_0x19927e)){var _0x4ddf6c=toCsv(_0x19927e);var _0x1c7d9e=Date[_0xc288('0x66')]();fs[_0xc288('0x67')](util[_0xc288('0x68')](_0xc288('0x69'),_0x5f17d4[_0xc288('0x3d')]['id'],_0x1c7d9e),_0x4ddf6c);_0x4dafe2[_0xc288('0x6a')](_0xc288('0x6b'),_0xc288('0x6c')+util[_0xc288('0x68')](_0xc288('0x6d'),_0x5f17d4['params']['id'],_0x1c7d9e));_0x4dafe2[_0xc288('0x6a')]('Content-type','text/csv');return _0x4dafe2['download'](util['format'](_0xc288('0x69'),_0x5f17d4[_0xc288('0x3d')]['id'],_0x1c7d9e));}else{return _0x4dafe2[_0xc288('0x21')](0xcc);}})[_0xc288('0x3c')](handleError(_0x4dafe2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index db863b2..87eecc6 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 _0x21c1=['request-promise','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','../../config/logger','api','moment','bluebird'];(function(_0x1302ab,_0x16794a){var _0x593350=function(_0xcf89c4){while(--_0xcf89c4){_0x1302ab['push'](_0x1302ab['shift']());}};_0x593350(++_0x16794a);}(_0x21c1,0xef));var _0x121c=function(_0x50e374,_0x308472){_0x50e374=_0x50e374-0x0;var _0x304cb8=_0x21c1[_0x50e374];return _0x304cb8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x121c('0x0'))(_0x121c('0x1'));var moment=require(_0x121c('0x2'));var BPromise=require(_0x121c('0x3'));var rp=require(_0x121c('0x4'));var attributes=require(_0x121c('0x5'));module['exports']=function(_0x261a9d,_0x154e66){return _0x261a9d[_0x121c('0x6')](_0x121c('0x7'),attributes,{'tableName':_0x121c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26f9=['util','api','request-promise','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x26f9,0x16f));var _0x926f=function(_0x550a09,_0x54b8dc){_0x550a09=_0x550a09-0x0;var _0x4ca9cd=_0x26f9[_0x550a09];return _0x4ca9cd;};'use strict';var _=require(_0x926f('0x0'));var util=require(_0x926f('0x1'));var logger=require('../../config/logger')(_0x926f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x926f('0x3'));var attributes=require(_0x926f('0x4'));module['exports']=function(_0x38dd25,_0x40adf5){return _0x38dd25[_0x926f('0x5')](_0x926f('0x6'),attributes,{'tableName':_0x926f('0x7'),'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 0eb3f53..99e68c5 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 _0x6f8f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyProject,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x2f4ac2,_0x28ee0a){var _0x1345ae=function(_0x267cae){while(--_0x267cae){_0x2f4ac2['push'](_0x2f4ac2['shift']());}};_0x1345ae(++_0x28ee0a);}(_0x6f8f,0x192));var _0xf6f8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f8f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6f8('0x0'));var util=require(_0xf6f8('0x1'));var moment=require(_0xf6f8('0x2'));var BPromise=require(_0xf6f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6f8('0x4'))['db'];var utils=require(_0xf6f8('0x5'));var logger=require(_0xf6f8('0x6'))(_0xf6f8('0x7'));var config=require(_0xf6f8('0x8'));var jayson=require(_0xf6f8('0x9'));var client=jayson[_0xf6f8('0xa')][_0xf6f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc53535,_0x25882c,_0x3c29a1){return new BPromise(function(_0x5a441b,_0x35d497){return client[_0xf6f8('0xc')](_0xc53535,_0x3c29a1)[_0xf6f8('0xd')](function(_0x3e98cb){logger[_0xf6f8('0xe')]('JscriptyProject,\x20%s,\x20%s',_0x25882c,_0xf6f8('0xf'));logger[_0xf6f8('0x10')](_0xf6f8('0x11'),_0x25882c,_0xf6f8('0xf'),JSON[_0xf6f8('0x12')](_0x3e98cb));if(_0x3e98cb[_0xf6f8('0x13')]){if(_0x3e98cb['error'][_0xf6f8('0x14')]===0x1f4){logger[_0xf6f8('0x13')](_0xf6f8('0x15'),_0x25882c,_0x3e98cb[_0xf6f8('0x13')][_0xf6f8('0x16')]);return _0x35d497(_0x3e98cb[_0xf6f8('0x13')][_0xf6f8('0x16')]);}logger[_0xf6f8('0x13')](_0xf6f8('0x15'),_0x25882c,_0x3e98cb[_0xf6f8('0x13')][_0xf6f8('0x16')]);return _0x5a441b(_0x3e98cb[_0xf6f8('0x13')]['message']);}else{logger['info'](_0xf6f8('0x15'),_0x25882c,_0xf6f8('0xf'));_0x5a441b(_0x3e98cb['result'][_0xf6f8('0x16')]);}})[_0xf6f8('0x17')](function(_0x4871d7){logger[_0xf6f8('0x13')](_0xf6f8('0x15'),_0x25882c,_0x4871d7);_0x35d497(_0x4871d7);});});} \ No newline at end of file +var _0xc50e=['stringify','error','code','JscriptyProject,\x20%s,\x20%s','message','result','lodash','util','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xc50e,0x16b));var _0xec50=function(_0x1a7fb2,_0x35f58c){_0x1a7fb2=_0x1a7fb2-0x0;var _0x3031b2=_0xc50e[_0x1a7fb2];return _0x3031b2;};'use strict';var _=require(_0xec50('0x0'));var util=require(_0xec50('0x1'));var moment=require('moment');var BPromise=require(_0xec50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec50('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xec50('0x4'));var config=require(_0xec50('0x5'));var jayson=require(_0xec50('0x6'));var client=jayson[_0xec50('0x7')][_0xec50('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15ae14,_0x5b3357,_0x2835c9){return new BPromise(function(_0x59ff6d,_0x1adc60){return client[_0xec50('0x9')](_0x15ae14,_0x2835c9)[_0xec50('0xa')](function(_0x131b32){logger[_0xec50('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5b3357,_0xec50('0xc'));logger[_0xec50('0xd')](_0xec50('0xe'),_0x5b3357,_0xec50('0xc'),JSON[_0xec50('0xf')](_0x131b32));if(_0x131b32['error']){if(_0x131b32[_0xec50('0x10')][_0xec50('0x11')]===0x1f4){logger[_0xec50('0x10')](_0xec50('0x12'),_0x5b3357,_0x131b32['error']['message']);return _0x1adc60(_0x131b32[_0xec50('0x10')][_0xec50('0x13')]);}logger[_0xec50('0x10')](_0xec50('0x12'),_0x5b3357,_0x131b32[_0xec50('0x10')][_0xec50('0x13')]);return _0x59ff6d(_0x131b32[_0xec50('0x10')]['message']);}else{logger[_0xec50('0xb')](_0xec50('0x12'),_0x5b3357,_0xec50('0xc'));_0x59ff6d(_0x131b32[_0xec50('0x14')]['message']);}})['catch'](function(_0x14b726){logger[_0xec50('0x10')](_0xec50('0x12'),_0x5b3357,_0x14b726);_0x1adc60(_0x14b726);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index feb4148..f64ddbe 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 _0x1874=['../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','/describe','get','/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x1874,0x92));var _0x4187=function(_0x412a76,_0x3c37c1){_0x412a76=_0x412a76-0x0;var _0x2e59d7=_0x1874[_0x412a76];return _0x2e59d7;};'use strict';var multer=require('multer');var util=require(_0x4187('0x0'));var path=require(_0x4187('0x1'));var timeout=require(_0x4187('0x2'));var express=require('express');var router=express[_0x4187('0x3')]();var auth=require(_0x4187('0x4'));var interaction=require(_0x4187('0x5'));var config=require(_0x4187('0x6'));var controller=require(_0x4187('0x7'));router['get']('/',auth[_0x4187('0x8')](),controller[_0x4187('0x9')]);router['get'](_0x4187('0xa'),auth[_0x4187('0x8')](),controller['describe']);router[_0x4187('0xb')](_0x4187('0xc'),auth[_0x4187('0x8')](),controller[_0x4187('0xd')]);router['post']('/',auth[_0x4187('0x8')](),controller[_0x4187('0xe')]);router['put'](_0x4187('0xc'),auth[_0x4187('0x8')](),controller[_0x4187('0xf')]);router[_0x4187('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4187('0x11')]);module[_0x4187('0x12')]=router; \ No newline at end of file +var _0xd8e5=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','describe','isAuthenticated','post','delete','/:id','destroy'];(function(_0x59e02a,_0xf4ce9e){var _0x1466e4=function(_0x18a7fd){while(--_0x18a7fd){_0x59e02a['push'](_0x59e02a['shift']());}};_0x1466e4(++_0xf4ce9e);}(_0xd8e5,0x17b));var _0x5d8e=function(_0x54a011,_0x518bc8){_0x54a011=_0x54a011-0x0;var _0x2dea7d=_0xd8e5[_0x54a011];return _0x2dea7d;};'use strict';var multer=require(_0x5d8e('0x0'));var util=require(_0x5d8e('0x1'));var path=require(_0x5d8e('0x2'));var timeout=require(_0x5d8e('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5d8e('0x4'));var interaction=require(_0x5d8e('0x5'));var config=require(_0x5d8e('0x6'));var controller=require(_0x5d8e('0x7'));router[_0x5d8e('0x8')]('/',auth['isAuthenticated'](),controller[_0x5d8e('0x9')]);router[_0x5d8e('0x8')](_0x5d8e('0xa'),auth['isAuthenticated'](),controller[_0x5d8e('0xb')]);router['get']('/:id',auth[_0x5d8e('0xc')](),controller['show']);router[_0x5d8e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x5d8e('0xc')](),controller['update']);router[_0x5d8e('0xe')](_0x5d8e('0xf'),auth[_0x5d8e('0xc')](),controller[_0x5d8e('0x10')]);module[_0x5d8e('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 0d10ac9..8f2ca84 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 _0xc874=['TEXT','sequelize','STRING'];(function(_0x13460d,_0x21c870){var _0x5252b5=function(_0x4b31ef){while(--_0x4b31ef){_0x13460d['push'](_0x13460d['shift']());}};_0x5252b5(++_0x21c870);}(_0xc874,0x154));var _0x4c87=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc874[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x4c87('0x0'));module['exports']={'question':{'type':Sequelize[_0x4c87('0x1')]},'answer':{'type':Sequelize[_0x4c87('0x2')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x4c87('0x1')]},'queue':{'type':Sequelize[_0x4c87('0x1')]},'uniqueid':{'type':Sequelize[_0x4c87('0x1')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4c87('0x1')]},'questionId':{'type':Sequelize[_0x4c87('0x1')]}}; \ No newline at end of file +var _0x4a3c=['sequelize','STRING','TEXT','long'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x4a3c,0x13c));var _0xc4a3=function(_0x16ef93,_0x2cb895){_0x16ef93=_0x16ef93-0x0;var _0x47ed85=_0x4a3c[_0x16ef93];return _0x47ed85;};'use strict';var Sequelize=require(_0xc4a3('0x0'));module['exports']={'question':{'type':Sequelize[_0xc4a3('0x1')]},'answer':{'type':Sequelize[_0xc4a3('0x2')](_0xc4a3('0x3'))},'membername':{'type':Sequelize[_0xc4a3('0x1')]},'projectname':{'type':Sequelize[_0xc4a3('0x1')]},'queue':{'type':Sequelize[_0xc4a3('0x1')]},'uniqueid':{'type':Sequelize[_0xc4a3('0x1')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc4a3('0x1')]},'questionId':{'type':Sequelize[_0xc4a3('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 501c04c..7b360c9 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 _0x7be1=['include','create','body','update','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','save','then','destroy','error','name','send','JscriptyQuestionReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','field','options','findAll','rows','catch','includeAll'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7be1,0x165));var _0x17be=function(_0x42540c,_0x27ca3b){_0x42540c=_0x42540c-0x0;var _0x1a27dc=_0x7be1[_0x42540c];return _0x1a27dc;};'use strict';var pdf=require(_0x17be('0x0'));var emlformat=require(_0x17be('0x1'));var rimraf=require(_0x17be('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x17be('0x3'));var rp=require(_0x17be('0x4'));var moment=require(_0x17be('0x5'));var BPromise=require(_0x17be('0x6'));var Mustache=require(_0x17be('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x17be('0x8'));var ejs=require(_0x17be('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x17be('0xa'));var crypto=require(_0x17be('0xb'));var jsforce=require(_0x17be('0xc'));var deskjs=require(_0x17be('0xd'));var toCsv=require(_0x17be('0x8'));var querystring=require(_0x17be('0xe'));var Papa=require('papaparse');var authService=require(_0x17be('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x17be('0x10'));var qs=require(_0x17be('0x11'));var logger=require('../../config/logger')(_0x17be('0x12'));var utils=require(_0x17be('0x13'));var config=require(_0x17be('0x14'));var db=require(_0x17be('0x15'))['db'];function respondWithStatusCode(_0x4ddc25,_0x431142){_0x431142=_0x431142||0xcc;return function(_0x52a62c){if(_0x52a62c){return _0x4ddc25[_0x17be('0x16')](_0x431142);}return _0x4ddc25['status'](_0x431142)[_0x17be('0x17')]();};}function respondWithResult(_0x1dff9e,_0x3ced9f){_0x3ced9f=_0x3ced9f||0xc8;return function(_0xf99f77){if(_0xf99f77){return _0x1dff9e[_0x17be('0x18')](_0x3ced9f)['json'](_0xf99f77);}};}function respondWithFilteredResult(_0x127e5a,_0x497a95){return function(_0x53c86d){if(_0x53c86d){var _0x123909=_0x53c86d[_0x17be('0x19')],_0x514c45=_0x497a95[_0x17be('0x1a')],_0x2a37ec=_0x497a95['offset']+_0x497a95[_0x17be('0x1b')],_0x4abdbc;if(_0x2a37ec>=_0x123909){_0x2a37ec=_0x123909;_0x4abdbc=0xc8;}else{_0x4abdbc=0xce;}_0x127e5a['status'](_0x4abdbc);return _0x127e5a[_0x17be('0x1c')]('Content-Range',_0x514c45+'-'+_0x2a37ec+'/'+_0x123909)[_0x17be('0x1d')](_0x53c86d);}return null;};}function patchUpdates(_0x165dfb){return function(_0x416f81){try{jsonpatch[_0x17be('0x1e')](_0x416f81,_0x165dfb,!![]);}catch(_0x445e9b){return BPromise['reject'](_0x445e9b);}return _0x416f81[_0x17be('0x1f')]();};}function saveUpdates(_0x2d96b4,_0x138b97){return function(_0x19678b){if(_0x19678b){return _0x19678b['update'](_0x2d96b4)[_0x17be('0x20')](function(_0x5310a3){return _0x5310a3;});}return null;};}function removeEntity(_0x5c77a0,_0x4391db){return function(_0x3ffd1e){if(_0x3ffd1e){return _0x3ffd1e[_0x17be('0x21')]()[_0x17be('0x20')](function(){_0x5c77a0['status'](0xcc)[_0x17be('0x17')]();});}};}function handleEntityNotFound(_0x1aa54f,_0x4d0c6e){return function(_0x151b8a){if(!_0x151b8a){_0x1aa54f['sendStatus'](0x194);}return _0x151b8a;};}function handleError(_0x1389a9,_0x47839d){_0x47839d=_0x47839d||0x1f4;return function(_0x47f00d){logger[_0x17be('0x22')](_0x47f00d['stack']);if(_0x47f00d[_0x17be('0x23')]){delete _0x47f00d['name'];}_0x1389a9['status'](_0x47839d)[_0x17be('0x24')](_0x47f00d);};}exports['index']=function(_0x39f237,_0x559784){var _0x16a3ad={},_0x1efef0={},_0x165046={'count':0x0,'rows':[]};var _0x27c672=db[_0x17be('0x25')][_0x17be('0x26')];_0x1efef0[_0x17be('0x27')]=_[_0x17be('0x28')](_0x27c672);_0x1efef0['query']=_[_0x17be('0x28')](_0x39f237[_0x17be('0x29')]);_0x1efef0[_0x17be('0x2a')]=_[_0x17be('0x2b')](_0x1efef0[_0x17be('0x27')],_0x1efef0['query']);_0x16a3ad[_0x17be('0x2c')]=_[_0x17be('0x2b')](_0x1efef0[_0x17be('0x27')],qs['fields'](_0x39f237['query'][_0x17be('0x2d')]));_0x16a3ad[_0x17be('0x2c')]=_0x16a3ad['attributes'][_0x17be('0x2e')]?_0x16a3ad['attributes']:_0x1efef0[_0x17be('0x27')];if(!_0x39f237[_0x17be('0x29')][_0x17be('0x2f')](_0x17be('0x30'))){_0x16a3ad[_0x17be('0x1b')]=qs[_0x17be('0x1b')](_0x39f237[_0x17be('0x29')][_0x17be('0x1b')]);_0x16a3ad['offset']=qs[_0x17be('0x1a')](_0x39f237[_0x17be('0x29')]['offset']);}_0x16a3ad[_0x17be('0x31')]=qs[_0x17be('0x32')](_0x39f237['query'][_0x17be('0x32')]);_0x16a3ad['where']=qs[_0x17be('0x2a')](_[_0x17be('0x33')](_0x39f237['query'],_0x1efef0[_0x17be('0x2a')]));if(_0x39f237[_0x17be('0x29')][_0x17be('0x34')]){_0x16a3ad[_0x17be('0x35')]=_[_0x17be('0x36')](_0x16a3ad[_0x17be('0x35')],{'$or':_['map'](_0x27c672,function(_0x420ffd){if(_0x420ffd[_0x17be('0x37')]['key']!==_0x17be('0x38')){var _0x583000={};_0x583000[_0x420ffd[_0x17be('0x39')]]={'$like':'%'+_0x39f237[_0x17be('0x29')][_0x17be('0x34')]+'%'};return _0x583000;}})});}_0x16a3ad=_['merge']({},_0x16a3ad,_0x39f237[_0x17be('0x3a')]);var _0x22b7ab={'where':_0x16a3ad[_0x17be('0x35')]};return db[_0x17be('0x25')][_0x17be('0x19')](_0x22b7ab)[_0x17be('0x20')](function(_0x2cafa7){_0x165046[_0x17be('0x19')]=_0x2cafa7;if(_0x39f237[_0x17be('0x29')]['includeAll']){_0x16a3ad['include']=[{'all':!![]}];}return db[_0x17be('0x25')][_0x17be('0x3b')](_0x16a3ad);})[_0x17be('0x20')](function(_0x5208ad){_0x165046[_0x17be('0x3c')]=_0x5208ad;return _0x165046;})[_0x17be('0x20')](respondWithFilteredResult(_0x559784,_0x16a3ad))[_0x17be('0x3d')](handleError(_0x559784,null));};exports['show']=function(_0x24b1f7,_0x3d4121){var _0x25cfd5={'raw':!![],'where':{'id':_0x24b1f7['params']['id']}},_0x39d5a7={};_0x39d5a7[_0x17be('0x27')]=_['keys'](db[_0x17be('0x25')][_0x17be('0x26')]);_0x39d5a7[_0x17be('0x29')]=_[_0x17be('0x28')](_0x24b1f7[_0x17be('0x29')]);_0x39d5a7[_0x17be('0x2a')]=_['intersection'](_0x39d5a7[_0x17be('0x27')],_0x39d5a7[_0x17be('0x29')]);_0x25cfd5[_0x17be('0x2c')]=_[_0x17be('0x2b')](_0x39d5a7[_0x17be('0x27')],qs[_0x17be('0x2d')](_0x24b1f7[_0x17be('0x29')][_0x17be('0x2d')]));_0x25cfd5[_0x17be('0x2c')]=_0x25cfd5[_0x17be('0x2c')][_0x17be('0x2e')]?_0x25cfd5[_0x17be('0x2c')]:_0x39d5a7['model'];if(_0x24b1f7[_0x17be('0x29')][_0x17be('0x3e')]){_0x25cfd5[_0x17be('0x3f')]=[{'all':!![]}];}_0x25cfd5=_[_0x17be('0x36')]({},_0x25cfd5,_0x24b1f7[_0x17be('0x3a')]);return db[_0x17be('0x25')]['find'](_0x25cfd5)[_0x17be('0x20')](handleEntityNotFound(_0x3d4121,null))[_0x17be('0x20')](respondWithResult(_0x3d4121,null))[_0x17be('0x3d')](handleError(_0x3d4121,null));};exports[_0x17be('0x40')]=function(_0x450edd,_0x1a1a8b){return db[_0x17be('0x25')][_0x17be('0x40')](_0x450edd[_0x17be('0x41')],{})['then'](respondWithResult(_0x1a1a8b,0xc9))['catch'](handleError(_0x1a1a8b,null));};exports[_0x17be('0x42')]=function(_0x2786c2,_0xce51f5){if(_0x2786c2[_0x17be('0x41')]['id']){delete _0x2786c2[_0x17be('0x41')]['id'];}return db[_0x17be('0x25')][_0x17be('0x43')]({'where':{'id':_0x2786c2[_0x17be('0x44')]['id']}})['then'](handleEntityNotFound(_0xce51f5,null))[_0x17be('0x20')](saveUpdates(_0x2786c2[_0x17be('0x41')],null))[_0x17be('0x20')](respondWithResult(_0xce51f5,null))[_0x17be('0x3d')](handleError(_0xce51f5,null));};exports[_0x17be('0x21')]=function(_0x1619d3,_0x4cad37){return db['JscriptyQuestionReport'][_0x17be('0x43')]({'where':{'id':_0x1619d3[_0x17be('0x44')]['id']}})[_0x17be('0x20')](handleEntityNotFound(_0x4cad37,null))['then'](removeEntity(_0x4cad37,null))[_0x17be('0x3d')](handleError(_0x4cad37,null));};exports['describe']=function(_0x4e73ba,_0x39d230){return db[_0x17be('0x25')][_0x17be('0x45')]()[_0x17be('0x20')](respondWithResult(_0x39d230,null))[_0x17be('0x3d')](handleError(_0x39d230,null));}; \ No newline at end of file +var _0xe1e3=['Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','index','rawAttributes','keys','query','filters','intersection','fields','attributes','length','model','order','sort','pick','where','merge','map','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','params','JscriptyQuestionReport','create','body','find','describe','html-pdf','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','offset','limit','set'];(function(_0x3c25d7,_0x50ebd0){var _0xd8d3a6=function(_0xfa4124){while(--_0xfa4124){_0x3c25d7['push'](_0x3c25d7['shift']());}};_0xd8d3a6(++_0x50ebd0);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0xd65ef0,_0x5881e8){_0xd65ef0=_0xd65ef0-0x0;var _0x1a9ed9=_0xe1e3[_0xd65ef0];return _0x1a9ed9;};'use strict';var pdf=require(_0x3e1e('0x0'));var emlformat=require(_0x3e1e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3e1e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3e1e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3e1e('0x4'));var util=require(_0x3e1e('0x5'));var path=require(_0x3e1e('0x6'));var sox=require(_0x3e1e('0x7'));var csv=require(_0x3e1e('0x8'));var ejs=require(_0x3e1e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x8'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x3e1e('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x3e1e('0x10'))(_0x3e1e('0x11'));var utils=require(_0x3e1e('0x12'));var config=require('../../config/environment');var db=require(_0x3e1e('0x13'))['db'];function respondWithStatusCode(_0x4e6eee,_0x4fcd4f){_0x4fcd4f=_0x4fcd4f||0xcc;return function(_0x4e47b9){if(_0x4e47b9){return _0x4e6eee['sendStatus'](_0x4fcd4f);}return _0x4e6eee['status'](_0x4fcd4f)[_0x3e1e('0x14')]();};}function respondWithResult(_0x595660,_0x4d1e78){_0x4d1e78=_0x4d1e78||0xc8;return function(_0x3a9375){if(_0x3a9375){return _0x595660[_0x3e1e('0x15')](_0x4d1e78)[_0x3e1e('0x16')](_0x3a9375);}};}function respondWithFilteredResult(_0x50f221,_0x5b34ec){return function(_0x4131a1){if(_0x4131a1){var _0x1b62e6=_0x4131a1['count'],_0x4dca60=_0x5b34ec[_0x3e1e('0x17')],_0x26cb35=_0x5b34ec['offset']+_0x5b34ec[_0x3e1e('0x18')],_0x1f0af9;if(_0x26cb35>=_0x1b62e6){_0x26cb35=_0x1b62e6;_0x1f0af9=0xc8;}else{_0x1f0af9=0xce;}_0x50f221[_0x3e1e('0x15')](_0x1f0af9);return _0x50f221[_0x3e1e('0x19')](_0x3e1e('0x1a'),_0x4dca60+'-'+_0x26cb35+'/'+_0x1b62e6)[_0x3e1e('0x16')](_0x4131a1);}return null;};}function patchUpdates(_0x1c181b){return function(_0x569f49){try{jsonpatch['apply'](_0x569f49,_0x1c181b,!![]);}catch(_0x4a9497){return BPromise[_0x3e1e('0x1b')](_0x4a9497);}return _0x569f49[_0x3e1e('0x1c')]();};}function saveUpdates(_0xa3e99c,_0x57c660){return function(_0x1c5acd){if(_0x1c5acd){return _0x1c5acd['update'](_0xa3e99c)[_0x3e1e('0x1d')](function(_0x33ec1d){return _0x33ec1d;});}return null;};}function removeEntity(_0x474085,_0x5f4e29){return function(_0x53e051){if(_0x53e051){return _0x53e051[_0x3e1e('0x1e')]()[_0x3e1e('0x1d')](function(){_0x474085['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d7ac,_0x1b5097){return function(_0x488f9f){if(!_0x488f9f){_0x13d7ac[_0x3e1e('0x1f')](0x194);}return _0x488f9f;};}function handleError(_0x56ae51,_0x164b15){_0x164b15=_0x164b15||0x1f4;return function(_0x33bf0f){logger[_0x3e1e('0x20')](_0x33bf0f[_0x3e1e('0x21')]);if(_0x33bf0f[_0x3e1e('0x22')]){delete _0x33bf0f[_0x3e1e('0x22')];}_0x56ae51['status'](_0x164b15)['send'](_0x33bf0f);};}exports[_0x3e1e('0x23')]=function(_0x541ef1,_0x55db8f){var _0x4be84e={},_0x56b9a8={},_0x1a33bb={'count':0x0,'rows':[]};var _0x43ec88=db['JscriptyQuestionReport'][_0x3e1e('0x24')];_0x56b9a8['model']=_[_0x3e1e('0x25')](_0x43ec88);_0x56b9a8[_0x3e1e('0x26')]=_['keys'](_0x541ef1[_0x3e1e('0x26')]);_0x56b9a8[_0x3e1e('0x27')]=_[_0x3e1e('0x28')](_0x56b9a8['model'],_0x56b9a8[_0x3e1e('0x26')]);_0x4be84e['attributes']=_['intersection'](_0x56b9a8['model'],qs[_0x3e1e('0x29')](_0x541ef1['query']['fields']));_0x4be84e[_0x3e1e('0x2a')]=_0x4be84e[_0x3e1e('0x2a')][_0x3e1e('0x2b')]?_0x4be84e[_0x3e1e('0x2a')]:_0x56b9a8[_0x3e1e('0x2c')];if(!_0x541ef1['query']['hasOwnProperty']('nolimit')){_0x4be84e['limit']=qs[_0x3e1e('0x18')](_0x541ef1[_0x3e1e('0x26')][_0x3e1e('0x18')]);_0x4be84e[_0x3e1e('0x17')]=qs[_0x3e1e('0x17')](_0x541ef1[_0x3e1e('0x26')][_0x3e1e('0x17')]);}_0x4be84e[_0x3e1e('0x2d')]=qs['sort'](_0x541ef1[_0x3e1e('0x26')][_0x3e1e('0x2e')]);_0x4be84e['where']=qs[_0x3e1e('0x27')](_[_0x3e1e('0x2f')](_0x541ef1[_0x3e1e('0x26')],_0x56b9a8[_0x3e1e('0x27')]));if(_0x541ef1['query']['filter']){_0x4be84e[_0x3e1e('0x30')]=_[_0x3e1e('0x31')](_0x4be84e['where'],{'$or':_[_0x3e1e('0x32')](_0x43ec88,function(_0x290fa2){if(_0x290fa2['type'][_0x3e1e('0x33')]!==_0x3e1e('0x34')){var _0x31b10e={};_0x31b10e[_0x290fa2[_0x3e1e('0x35')]]={'$like':'%'+_0x541ef1[_0x3e1e('0x26')]['filter']+'%'};return _0x31b10e;}})});}_0x4be84e=_[_0x3e1e('0x31')]({},_0x4be84e,_0x541ef1[_0x3e1e('0x36')]);var _0x1c622e={'where':_0x4be84e[_0x3e1e('0x30')]};return db['JscriptyQuestionReport'][_0x3e1e('0x37')](_0x1c622e)[_0x3e1e('0x1d')](function(_0x111da4){_0x1a33bb[_0x3e1e('0x37')]=_0x111da4;if(_0x541ef1[_0x3e1e('0x26')][_0x3e1e('0x38')]){_0x4be84e[_0x3e1e('0x39')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3e1e('0x3a')](_0x4be84e);})['then'](function(_0x53bdf5){_0x1a33bb[_0x3e1e('0x3b')]=_0x53bdf5;return _0x1a33bb;})[_0x3e1e('0x1d')](respondWithFilteredResult(_0x55db8f,_0x4be84e))[_0x3e1e('0x3c')](handleError(_0x55db8f,null));};exports['show']=function(_0x3dbd2a,_0xb030eb){var _0x4d372a={'raw':!![],'where':{'id':_0x3dbd2a[_0x3e1e('0x3d')]['id']}},_0x16d03f={};_0x16d03f['model']=_['keys'](db[_0x3e1e('0x3e')]['rawAttributes']);_0x16d03f['query']=_[_0x3e1e('0x25')](_0x3dbd2a[_0x3e1e('0x26')]);_0x16d03f[_0x3e1e('0x27')]=_[_0x3e1e('0x28')](_0x16d03f[_0x3e1e('0x2c')],_0x16d03f['query']);_0x4d372a['attributes']=_[_0x3e1e('0x28')](_0x16d03f[_0x3e1e('0x2c')],qs[_0x3e1e('0x29')](_0x3dbd2a['query'][_0x3e1e('0x29')]));_0x4d372a[_0x3e1e('0x2a')]=_0x4d372a[_0x3e1e('0x2a')]['length']?_0x4d372a[_0x3e1e('0x2a')]:_0x16d03f['model'];if(_0x3dbd2a['query'][_0x3e1e('0x38')]){_0x4d372a[_0x3e1e('0x39')]=[{'all':!![]}];}_0x4d372a=_[_0x3e1e('0x31')]({},_0x4d372a,_0x3dbd2a[_0x3e1e('0x36')]);return db['JscriptyQuestionReport']['find'](_0x4d372a)['then'](handleEntityNotFound(_0xb030eb,null))['then'](respondWithResult(_0xb030eb,null))[_0x3e1e('0x3c')](handleError(_0xb030eb,null));};exports[_0x3e1e('0x3f')]=function(_0x480e20,_0x5c380d){return db[_0x3e1e('0x3e')][_0x3e1e('0x3f')](_0x480e20[_0x3e1e('0x40')],{})['then'](respondWithResult(_0x5c380d,0xc9))[_0x3e1e('0x3c')](handleError(_0x5c380d,null));};exports['update']=function(_0xd34c28,_0x4713bd){if(_0xd34c28[_0x3e1e('0x40')]['id']){delete _0xd34c28[_0x3e1e('0x40')]['id'];}return db[_0x3e1e('0x3e')][_0x3e1e('0x41')]({'where':{'id':_0xd34c28['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x4713bd,null))[_0x3e1e('0x1d')](saveUpdates(_0xd34c28['body'],null))[_0x3e1e('0x1d')](respondWithResult(_0x4713bd,null))[_0x3e1e('0x3c')](handleError(_0x4713bd,null));};exports['destroy']=function(_0x1cc820,_0x347b3f){return db[_0x3e1e('0x3e')][_0x3e1e('0x41')]({'where':{'id':_0x1cc820['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x347b3f,null))[_0x3e1e('0x1d')](removeEntity(_0x347b3f,null))[_0x3e1e('0x3c')](handleError(_0x347b3f,null));};exports[_0x3e1e('0x42')]=function(_0x4bce83,_0xbeaf39){return db[_0x3e1e('0x3e')][_0x3e1e('0x42')]()[_0x3e1e('0x1d')](respondWithResult(_0xbeaf39,null))[_0x3e1e('0x3c')](handleError(_0xbeaf39,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index b047ab9..0c8eb86 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 _0xbd38=['../../config/logger','moment','bluebird','report_jscripty_questions','lodash','util'];(function(_0x4d827b,_0x5bbb7f){var _0x52d5fe=function(_0x36b559){while(--_0x36b559){_0x4d827b['push'](_0x4d827b['shift']());}};_0x52d5fe(++_0x5bbb7f);}(_0xbd38,0xe2));var _0x8bd3=function(_0x24c38e,_0x187e23){_0x24c38e=_0x24c38e-0x0;var _0x3a7475=_0xbd38[_0x24c38e];return _0x3a7475;};'use strict';var _=require(_0x8bd3('0x0'));var util=require(_0x8bd3('0x1'));var logger=require(_0x8bd3('0x2'))('api');var moment=require(_0x8bd3('0x3'));var BPromise=require(_0x8bd3('0x4'));var rp=require('request-promise');var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x2b523a,_0x5be964){return _0x2b523a['define']('JscriptyQuestionReport',attributes,{'tableName':_0x8bd3('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26c6=['util','moment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x602335,_0x3e6ec1){var _0x1022ff=function(_0x1d41f8){while(--_0x1d41f8){_0x602335['push'](_0x602335['shift']());}};_0x1022ff(++_0x3e6ec1);}(_0x26c6,0x84));var _0x626c=function(_0x4a1602,_0x4774ab){_0x4a1602=_0x4a1602-0x0;var _0x1474c2=_0x26c6[_0x4a1602];return _0x1474c2;};'use strict';var _=require(_0x626c('0x0'));var util=require(_0x626c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x626c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x626c('0x3'));module['exports']=function(_0x4e51ce,_0x3f291e){return _0x4e51ce[_0x626c('0x4')](_0x626c('0x5'),attributes,{'tableName':_0x626c('0x6'),'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 2285182..78849d9 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 _0x08e0=['../../config/utils','rpc','jayson/promise','client','request','then','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','result','moment','randomstring','ioredis','../../mysqldb'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0x08e0,0x12c));var _0x008e=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x08e0[_0x580b15];return _0x1adb1b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x008e('0x0'));var BPromise=require('bluebird');var rs=require(_0x008e('0x1'));var fs=require('fs');var Redis=require(_0x008e('0x2'));var db=require(_0x008e('0x3'))['db'];var utils=require(_0x008e('0x4'));var logger=require('../../config/logger')(_0x008e('0x5'));var config=require('../../config/environment');var jayson=require(_0x008e('0x6'));var client=jayson[_0x008e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51d83f,_0x47bd7c,_0x51a316){return new BPromise(function(_0x9da593,_0x1bd4d4){return client[_0x008e('0x8')](_0x51d83f,_0x51a316)[_0x008e('0x9')](function(_0x34e8b9){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x47bd7c,'request\x20sent');logger[_0x008e('0xa')](_0x008e('0xb'),_0x47bd7c,_0x008e('0xc'),JSON[_0x008e('0xd')](_0x34e8b9));if(_0x34e8b9[_0x008e('0xe')]){if(_0x34e8b9[_0x008e('0xe')][_0x008e('0xf')]===0x1f4){logger[_0x008e('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x47bd7c,_0x34e8b9['error']['message']);return _0x1bd4d4(_0x34e8b9[_0x008e('0xe')][_0x008e('0x10')]);}logger['error'](_0x008e('0x11'),_0x47bd7c,_0x34e8b9['error'][_0x008e('0x10')]);return _0x9da593(_0x34e8b9[_0x008e('0xe')][_0x008e('0x10')]);}else{logger['info'](_0x008e('0x11'),_0x47bd7c,_0x008e('0xc'));_0x9da593(_0x34e8b9[_0x008e('0x12')][_0x008e('0x10')]);}})['catch'](function(_0x16f654){logger[_0x008e('0xe')](_0x008e('0x11'),_0x47bd7c,_0x16f654);_0x1bd4d4(_0x16f654);});});} \ No newline at end of file +var _0x9167=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','lodash'];(function(_0x41e05c,_0x348678){var _0x6d48cd=function(_0x3f2a9c){while(--_0x3f2a9c){_0x41e05c['push'](_0x41e05c['shift']());}};_0x6d48cd(++_0x348678);}(_0x9167,0x16f));var _0x7916=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9167[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7916('0x0'));var util=require(_0x7916('0x1'));var moment=require(_0x7916('0x2'));var BPromise=require(_0x7916('0x3'));var rs=require(_0x7916('0x4'));var fs=require('fs');var Redis=require(_0x7916('0x5'));var db=require(_0x7916('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7916('0x7'))(_0x7916('0x8'));var config=require(_0x7916('0x9'));var jayson=require(_0x7916('0xa'));var client=jayson[_0x7916('0xb')][_0x7916('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xaf310d,_0x2410e3,_0x1e3fc4){return new BPromise(function(_0x46b881,_0x28bfde){return client[_0x7916('0xd')](_0xaf310d,_0x1e3fc4)[_0x7916('0xe')](function(_0xe900a0){logger[_0x7916('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2410e3,_0x7916('0x10'));logger['debug'](_0x7916('0x11'),_0x2410e3,'request\x20sent',JSON[_0x7916('0x12')](_0xe900a0));if(_0xe900a0[_0x7916('0x13')]){if(_0xe900a0['error'][_0x7916('0x14')]===0x1f4){logger['error'](_0x7916('0x15'),_0x2410e3,_0xe900a0[_0x7916('0x13')][_0x7916('0x16')]);return _0x28bfde(_0xe900a0[_0x7916('0x13')]['message']);}logger[_0x7916('0x13')](_0x7916('0x15'),_0x2410e3,_0xe900a0['error'][_0x7916('0x16')]);return _0x46b881(_0xe900a0[_0x7916('0x13')][_0x7916('0x16')]);}else{logger[_0x7916('0xf')](_0x7916('0x15'),_0x2410e3,_0x7916('0x10'));_0x46b881(_0xe900a0['result'][_0x7916('0x16')]);}})['catch'](function(_0x1fb78d){logger[_0x7916('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2410e3,_0x1fb78d);_0x28bfde(_0x1fb78d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index d3675b9..f0db294 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 _0xb7c6=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x90501b,_0x412dfb){var _0x7c5e26=function(_0x58363c){while(--_0x58363c){_0x90501b['push'](_0x90501b['shift']());}};_0x7c5e26(++_0x412dfb);}(_0xb7c6,0xf0));var _0x6b7c=function(_0x2df60e,_0x6a3cf6){_0x2df60e=_0x2df60e-0x0;var _0x46b146=_0xb7c6[_0x2df60e];return _0x46b146;};'use strict';var multer=require(_0x6b7c('0x0'));var util=require(_0x6b7c('0x1'));var path=require(_0x6b7c('0x2'));var timeout=require(_0x6b7c('0x3'));var express=require('express');var router=express[_0x6b7c('0x4')]();var auth=require(_0x6b7c('0x5'));var interaction=require(_0x6b7c('0x6'));var config=require('../../config/environment');var controller=require(_0x6b7c('0x7'));router[_0x6b7c('0x8')]('/',auth[_0x6b7c('0x9')](),controller[_0x6b7c('0xa')]);router['get']('/describe',auth[_0x6b7c('0x9')](),controller['describe']);router[_0x6b7c('0x8')](_0x6b7c('0xb'),auth[_0x6b7c('0x9')](),controller[_0x6b7c('0xc')]);router[_0x6b7c('0x8')](_0x6b7c('0xd'),auth['isAuthenticated'](),controller[_0x6b7c('0xe')]);router[_0x6b7c('0xf')]('/',auth[_0x6b7c('0x9')](),controller[_0x6b7c('0x10')]);router[_0x6b7c('0x11')](_0x6b7c('0xb'),auth[_0x6b7c('0x9')](),controller[_0x6b7c('0x12')]);router[_0x6b7c('0x13')](_0x6b7c('0xb'),auth[_0x6b7c('0x9')](),controller[_0x6b7c('0x14')]);module[_0x6b7c('0x15')]=router; \ No newline at end of file +var _0xc115=['put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','/:id/questions','getQuestions','post'];(function(_0x260073,_0xbe6af9){var _0x4ff033=function(_0x4a7c64){while(--_0x4a7c64){_0x260073['push'](_0x260073['shift']());}};_0x4ff033(++_0xbe6af9);}(_0xc115,0x12f));var _0x5c11=function(_0x56a22e,_0x4f9e9a){_0x56a22e=_0x56a22e-0x0;var _0x4daef0=_0xc115[_0x56a22e];return _0x4daef0;};'use strict';var multer=require(_0x5c11('0x0'));var util=require(_0x5c11('0x1'));var path=require(_0x5c11('0x2'));var timeout=require(_0x5c11('0x3'));var express=require('express');var router=express[_0x5c11('0x4')]();var auth=require(_0x5c11('0x5'));var interaction=require(_0x5c11('0x6'));var config=require(_0x5c11('0x7'));var controller=require(_0x5c11('0x8'));router[_0x5c11('0x9')]('/',auth[_0x5c11('0xa')](),controller[_0x5c11('0xb')]);router[_0x5c11('0x9')]('/describe',auth[_0x5c11('0xa')](),controller[_0x5c11('0xc')]);router['get'](_0x5c11('0xd'),auth[_0x5c11('0xa')](),controller['show']);router['get'](_0x5c11('0xe'),auth['isAuthenticated'](),controller[_0x5c11('0xf')]);router[_0x5c11('0x10')]('/',auth[_0x5c11('0xa')](),controller['create']);router[_0x5c11('0x11')](_0x5c11('0xd'),auth[_0x5c11('0xa')](),controller[_0x5c11('0x12')]);router['delete'](_0x5c11('0xd'),auth[_0x5c11('0xa')](),controller['destroy']);module[_0x5c11('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f58c56a..a6d9195 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 _0xa815=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','sequelize','exports','starttime'];(function(_0x39346a,_0x5c3ed1){var _0x335564=function(_0x24b5c4){while(--_0x24b5c4){_0x39346a['push'](_0x39346a['shift']());}};_0x335564(++_0x5c3ed1);}(_0xa815,0x17d));var _0x5a81=function(_0x14b34e,_0x161613){_0x14b34e=_0x14b34e-0x0;var _0x173536=_0xa815[_0x14b34e];return _0x173536;};'use strict';var moment=require(_0x5a81('0x0'));var Sequelize=require(_0x5a81('0x1'));module[_0x5a81('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x4614eb){this['setDataValue'](_0x5a81('0x3'),_0x4614eb);this[_0x5a81('0x4')](_0x5a81('0x5'),moment()[_0x5a81('0x6')](_0x5a81('0x7')));}},'endtime':{'type':Sequelize[_0x5a81('0x8')]},'membername':{'type':Sequelize[_0x5a81('0x9')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5a81('0x9')]},'uniqueid':{'type':Sequelize[_0x5a81('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x5a81('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x95a9=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','exports','DATE','setDataValue','endtime','format'];(function(_0x5714f6,_0x43c386){var _0x5756ba=function(_0x2e728e){while(--_0x2e728e){_0x5714f6['push'](_0x5714f6['shift']());}};_0x5756ba(++_0x43c386);}(_0x95a9,0x10b));var _0x995a=function(_0xe5442a,_0x2bc5d6){_0xe5442a=_0xe5442a-0x0;var _0x25688b=_0x95a9[_0xe5442a];return _0x25688b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x995a('0x0')]={'starttime':{'type':Sequelize[_0x995a('0x1')],'set':function(_0x325187){this['setDataValue']('starttime',_0x325187);this[_0x995a('0x2')](_0x995a('0x3'),moment()[_0x995a('0x4')](_0x995a('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x995a('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x995a('0x6')]},'calleridname':{'type':Sequelize[_0x995a('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x995a('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 0a70e38..f1869db 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 _0x9073=['papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','end','json','offset','limit','set','Content-Range','then','sendStatus','error','stack','name','send','index','JscriptySessionReport','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','map','type','key','VIRTUAL','field','filter','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','getQuestions','findOne','JscriptyQuestionReport','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring'];(function(_0x9b4ee0,_0x22f9fa){var _0x16695d=function(_0x549bf2){while(--_0x549bf2){_0x9b4ee0['push'](_0x9b4ee0['shift']());}};_0x16695d(++_0x22f9fa);}(_0x9073,0x1cd));var _0x3907=function(_0x56260c,_0x3594bc){_0x56260c=_0x56260c-0x0;var _0x3293b9=_0x9073[_0x56260c];return _0x3293b9;};'use strict';var pdf=require(_0x3907('0x0'));var emlformat=require(_0x3907('0x1'));var rimraf=require(_0x3907('0x2'));var zipdir=require(_0x3907('0x3'));var jsonpatch=require(_0x3907('0x4'));var rp=require(_0x3907('0x5'));var moment=require(_0x3907('0x6'));var BPromise=require(_0x3907('0x7'));var Mustache=require(_0x3907('0x8'));var util=require(_0x3907('0x9'));var path=require(_0x3907('0xa'));var sox=require(_0x3907('0xb'));var csv=require(_0x3907('0xc'));var ejs=require(_0x3907('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3907('0xe'));var crypto=require(_0x3907('0xf'));var jsforce=require(_0x3907('0x10'));var deskjs=require(_0x3907('0x11'));var toCsv=require(_0x3907('0xc'));var querystring=require(_0x3907('0x12'));var Papa=require(_0x3907('0x13'));var authService=require(_0x3907('0x14'));var hardwareService=require(_0x3907('0x15'));var Redis=require('ioredis');var qs=require(_0x3907('0x16'));var logger=require(_0x3907('0x17'))(_0x3907('0x18'));var utils=require('../../config/utils');var config=require(_0x3907('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c91bb,_0x155f81){_0x155f81=_0x155f81||0xcc;return function(_0x4f1602){if(_0x4f1602){return _0x4c91bb['sendStatus'](_0x155f81);}return _0x4c91bb[_0x3907('0x1a')](_0x155f81)[_0x3907('0x1b')]();};}function respondWithResult(_0x4d46f7,_0x1dc64){_0x1dc64=_0x1dc64||0xc8;return function(_0x2df665){if(_0x2df665){return _0x4d46f7['status'](_0x1dc64)[_0x3907('0x1c')](_0x2df665);}};}function respondWithFilteredResult(_0x45b2ba,_0x1648e5){return function(_0xa83bb7){if(_0xa83bb7){var _0x56d8f0=_0xa83bb7['count'],_0x4ff223=_0x1648e5[_0x3907('0x1d')],_0x60a58a=_0x1648e5[_0x3907('0x1d')]+_0x1648e5[_0x3907('0x1e')],_0x40ba70;if(_0x60a58a>=_0x56d8f0){_0x60a58a=_0x56d8f0;_0x40ba70=0xc8;}else{_0x40ba70=0xce;}_0x45b2ba[_0x3907('0x1a')](_0x40ba70);return _0x45b2ba[_0x3907('0x1f')](_0x3907('0x20'),_0x4ff223+'-'+_0x60a58a+'/'+_0x56d8f0)[_0x3907('0x1c')](_0xa83bb7);}return null;};}function patchUpdates(_0x4607f7){return function(_0x4a8afd){try{jsonpatch['apply'](_0x4a8afd,_0x4607f7,!![]);}catch(_0x2205fd){return BPromise['reject'](_0x2205fd);}return _0x4a8afd['save']();};}function saveUpdates(_0x391824,_0x3ed35d){return function(_0x375ec7){if(_0x375ec7){return _0x375ec7['update'](_0x391824)['then'](function(_0x38f4f7){return _0x38f4f7;});}return null;};}function removeEntity(_0x1cf029,_0x1323ab){return function(_0x3a20ff){if(_0x3a20ff){return _0x3a20ff['destroy']()[_0x3907('0x21')](function(){_0x1cf029['status'](0xcc)[_0x3907('0x1b')]();});}};}function handleEntityNotFound(_0x3629e9,_0x49acdd){return function(_0x3fea01){if(!_0x3fea01){_0x3629e9[_0x3907('0x22')](0x194);}return _0x3fea01;};}function handleError(_0x216003,_0x3f373d){_0x3f373d=_0x3f373d||0x1f4;return function(_0x584eb0){logger[_0x3907('0x23')](_0x584eb0[_0x3907('0x24')]);if(_0x584eb0[_0x3907('0x25')]){delete _0x584eb0[_0x3907('0x25')];}_0x216003[_0x3907('0x1a')](_0x3f373d)[_0x3907('0x26')](_0x584eb0);};}exports[_0x3907('0x27')]=function(_0x301919,_0x3e73e0){var _0x3fddbb={},_0x2a1c9e={},_0x1cd080={'count':0x0,'rows':[]};var _0x483409=db[_0x3907('0x28')][_0x3907('0x29')];_0x2a1c9e[_0x3907('0x2a')]=_[_0x3907('0x2b')](_0x483409);_0x2a1c9e[_0x3907('0x2c')]=_[_0x3907('0x2b')](_0x301919[_0x3907('0x2c')]);_0x2a1c9e['filters']=_[_0x3907('0x2d')](_0x2a1c9e[_0x3907('0x2a')],_0x2a1c9e['query']);_0x3fddbb[_0x3907('0x2e')]=_['intersection'](_0x2a1c9e[_0x3907('0x2a')],qs[_0x3907('0x2f')](_0x301919[_0x3907('0x2c')][_0x3907('0x2f')]));_0x3fddbb[_0x3907('0x2e')]=_0x3fddbb[_0x3907('0x2e')][_0x3907('0x30')]?_0x3fddbb['attributes']:_0x2a1c9e[_0x3907('0x2a')];if(!_0x301919[_0x3907('0x2c')][_0x3907('0x31')](_0x3907('0x32'))){_0x3fddbb[_0x3907('0x1e')]=qs[_0x3907('0x1e')](_0x301919['query'][_0x3907('0x1e')]);_0x3fddbb[_0x3907('0x1d')]=qs[_0x3907('0x1d')](_0x301919[_0x3907('0x2c')][_0x3907('0x1d')]);}_0x3fddbb[_0x3907('0x33')]=qs[_0x3907('0x34')](_0x301919[_0x3907('0x2c')]['sort']);_0x3fddbb['where']=qs[_0x3907('0x35')](_['pick'](_0x301919[_0x3907('0x2c')],_0x2a1c9e[_0x3907('0x35')]));if(_0x301919[_0x3907('0x2c')]['filter']){_0x3fddbb[_0x3907('0x36')]=_[_0x3907('0x37')](_0x3fddbb[_0x3907('0x36')],{'$or':_[_0x3907('0x38')](_0x483409,function(_0x4a1ec6){if(_0x4a1ec6[_0x3907('0x39')][_0x3907('0x3a')]!==_0x3907('0x3b')){var _0x394bbd={};_0x394bbd[_0x4a1ec6[_0x3907('0x3c')]]={'$like':'%'+_0x301919[_0x3907('0x2c')][_0x3907('0x3d')]+'%'};return _0x394bbd;}})});}_0x3fddbb=_[_0x3907('0x37')]({},_0x3fddbb,_0x301919[_0x3907('0x3e')]);var _0x2bc20e={'where':_0x3fddbb['where']};return db[_0x3907('0x28')][_0x3907('0x3f')](_0x2bc20e)[_0x3907('0x21')](function(_0x2f424f){_0x1cd080[_0x3907('0x3f')]=_0x2f424f;if(_0x301919[_0x3907('0x2c')][_0x3907('0x40')]){_0x3fddbb[_0x3907('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3907('0x42')](_0x3fddbb);})[_0x3907('0x21')](function(_0x12f043){_0x1cd080[_0x3907('0x43')]=_0x12f043;return _0x1cd080;})['then'](respondWithFilteredResult(_0x3e73e0,_0x3fddbb))[_0x3907('0x44')](handleError(_0x3e73e0,null));};exports[_0x3907('0x45')]=function(_0x42e01a,_0xb460e1){var _0x593ad6={'raw':!![],'where':{'id':_0x42e01a[_0x3907('0x46')]['id']}},_0x1db77a={};_0x1db77a[_0x3907('0x2a')]=_[_0x3907('0x2b')](db[_0x3907('0x28')][_0x3907('0x29')]);_0x1db77a[_0x3907('0x2c')]=_[_0x3907('0x2b')](_0x42e01a['query']);_0x1db77a['filters']=_[_0x3907('0x2d')](_0x1db77a['model'],_0x1db77a['query']);_0x593ad6[_0x3907('0x2e')]=_[_0x3907('0x2d')](_0x1db77a[_0x3907('0x2a')],qs['fields'](_0x42e01a[_0x3907('0x2c')]['fields']));_0x593ad6[_0x3907('0x2e')]=_0x593ad6[_0x3907('0x2e')][_0x3907('0x30')]?_0x593ad6['attributes']:_0x1db77a[_0x3907('0x2a')];if(_0x42e01a[_0x3907('0x2c')][_0x3907('0x40')]){_0x593ad6['include']=[{'all':!![]}];}_0x593ad6=_[_0x3907('0x37')]({},_0x593ad6,_0x42e01a[_0x3907('0x3e')]);return db[_0x3907('0x28')]['find'](_0x593ad6)[_0x3907('0x21')](handleEntityNotFound(_0xb460e1,null))[_0x3907('0x21')](respondWithResult(_0xb460e1,null))[_0x3907('0x44')](handleError(_0xb460e1,null));};exports[_0x3907('0x47')]=function(_0x8c11d7,_0x3d8699){return db['JscriptySessionReport'][_0x3907('0x47')](_0x8c11d7[_0x3907('0x48')],{})[_0x3907('0x21')](respondWithResult(_0x3d8699,0xc9))['catch'](handleError(_0x3d8699,null));};exports[_0x3907('0x49')]=function(_0x536423,_0x5997fe){if(_0x536423[_0x3907('0x48')]['id']){delete _0x536423[_0x3907('0x48')]['id'];}return db['JscriptySessionReport'][_0x3907('0x4a')]({'where':{'id':_0x536423[_0x3907('0x46')]['id']}})[_0x3907('0x21')](handleEntityNotFound(_0x5997fe,null))[_0x3907('0x21')](saveUpdates(_0x536423[_0x3907('0x48')],null))[_0x3907('0x21')](respondWithResult(_0x5997fe,null))[_0x3907('0x44')](handleError(_0x5997fe,null));};exports['destroy']=function(_0x2aaa59,_0x26e6f2){return db[_0x3907('0x28')]['find']({'where':{'id':_0x2aaa59[_0x3907('0x46')]['id']}})[_0x3907('0x21')](handleEntityNotFound(_0x26e6f2,null))[_0x3907('0x21')](removeEntity(_0x26e6f2,null))[_0x3907('0x44')](handleError(_0x26e6f2,null));};exports[_0x3907('0x4b')]=function(_0x4a0b2c,_0x3e4e34){return db[_0x3907('0x28')][_0x3907('0x4b')]()[_0x3907('0x21')](respondWithResult(_0x3e4e34,null))[_0x3907('0x44')](handleError(_0x3e4e34,null));};exports[_0x3907('0x4c')]=function(_0x461808,_0x2bcf00,_0x43e1ac){var _0x5189a6={'raw':!![],'where':{}};var _0x3002ad={};var _0x5e570c={'count':0x0,'rows':[]};return db[_0x3907('0x28')][_0x3907('0x4d')]({'where':{'id':_0x461808[_0x3907('0x46')]['id']}})[_0x3907('0x21')](handleEntityNotFound(_0x2bcf00,null))['then'](function(_0x54404b){if(_0x54404b){_0x3002ad[_0x3907('0x2a')]=_[_0x3907('0x2b')](db[_0x3907('0x4e')]['rawAttributes']);_0x3002ad[_0x3907('0x2c')]=_[_0x3907('0x2b')](_0x461808[_0x3907('0x2c')]);_0x3002ad[_0x3907('0x35')]=_[_0x3907('0x2d')](_0x3002ad['model'],_0x3002ad[_0x3907('0x2c')]);_0x5189a6['attributes']=_[_0x3907('0x2d')](_0x3002ad[_0x3907('0x2a')],qs[_0x3907('0x2f')](_0x461808[_0x3907('0x2c')]['fields']));_0x5189a6[_0x3907('0x2e')]=_0x5189a6[_0x3907('0x2e')][_0x3907('0x30')]?_0x5189a6[_0x3907('0x2e')]:_0x3002ad['model'];if(!_0x461808[_0x3907('0x2c')][_0x3907('0x31')](_0x3907('0x32'))){_0x5189a6[_0x3907('0x1e')]=qs['limit'](_0x461808[_0x3907('0x2c')][_0x3907('0x1e')]);_0x5189a6[_0x3907('0x1d')]=qs[_0x3907('0x1d')](_0x461808[_0x3907('0x2c')][_0x3907('0x1d')]);}_0x5189a6[_0x3907('0x33')]=qs['sort'](_0x461808[_0x3907('0x2c')][_0x3907('0x34')]);_0x5189a6[_0x3907('0x36')]=qs[_0x3907('0x35')](_[_0x3907('0x4f')](_0x461808['query'],_0x3002ad[_0x3907('0x35')]));_0x5189a6[_0x3907('0x36')]['SessionId']=_0x54404b['id'];if(_0x461808[_0x3907('0x2c')]['filter']){_0x5189a6[_0x3907('0x36')]=_[_0x3907('0x37')](_0x5189a6[_0x3907('0x36')],{'$or':_[_0x3907('0x38')](_0x5189a6['attributes'],function(_0x3ee244){var _0x263c6f={};_0x263c6f[_0x3ee244]={'$like':'%'+_0x461808['query'][_0x3907('0x3d')]+'%'};return _0x263c6f;})});}_0x5189a6=_[_0x3907('0x37')]({},_0x5189a6,_0x461808[_0x3907('0x3e')]);return db[_0x3907('0x4e')][_0x3907('0x3f')]({'where':_0x5189a6[_0x3907('0x36')]})[_0x3907('0x21')](function(_0x3f62d2){_0x5e570c[_0x3907('0x3f')]=_0x3f62d2;if(_0x461808[_0x3907('0x2c')][_0x3907('0x40')]){_0x5189a6['include']=[{'all':!![]}];}return db[_0x3907('0x4e')]['findAll'](_0x5189a6);})[_0x3907('0x21')](function(_0x12a405){_0x5e570c['rows']=_0x12a405;return _0x5e570c;});}})[_0x3907('0x21')](respondWithFilteredResult(_0x2bcf00,_0x5189a6))['catch'](handleError(_0x2bcf00,null));}; \ No newline at end of file +var _0x8eb1=['sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','JscriptySessionReport','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','getQuestions','findOne','keys','SessionId','JscriptyQuestionReport','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x5e326a,_0x429584){var _0x5b1c1f=function(_0x13a7ff){while(--_0x13a7ff){_0x5e326a['push'](_0x5e326a['shift']());}};_0x5b1c1f(++_0x429584);}(_0x8eb1,0x103));var _0x18eb=function(_0x5a2aab,_0x290b04){_0x5a2aab=_0x5a2aab-0x0;var _0x4a0b09=_0x8eb1[_0x5a2aab];return _0x4a0b09;};'use strict';var pdf=require(_0x18eb('0x0'));var emlformat=require(_0x18eb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x18eb('0x2'));var jsonpatch=require(_0x18eb('0x3'));var rp=require(_0x18eb('0x4'));var moment=require(_0x18eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x18eb('0x6'));var util=require(_0x18eb('0x7'));var path=require(_0x18eb('0x8'));var sox=require('sox');var csv=require(_0x18eb('0x9'));var ejs=require(_0x18eb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x18eb('0xb'));var crypto=require(_0x18eb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x18eb('0x9'));var querystring=require('querystring');var Papa=require(_0x18eb('0xd'));var authService=require(_0x18eb('0xe'));var hardwareService=require(_0x18eb('0xf'));var Redis=require(_0x18eb('0x10'));var qs=require(_0x18eb('0x11'));var logger=require(_0x18eb('0x12'))(_0x18eb('0x13'));var utils=require(_0x18eb('0x14'));var config=require('../../config/environment');var db=require(_0x18eb('0x15'))['db'];function respondWithStatusCode(_0x3a0892,_0x367640){_0x367640=_0x367640||0xcc;return function(_0x2bc37d){if(_0x2bc37d){return _0x3a0892[_0x18eb('0x16')](_0x367640);}return _0x3a0892[_0x18eb('0x17')](_0x367640)[_0x18eb('0x18')]();};}function respondWithResult(_0xc13ad1,_0x42ab2d){_0x42ab2d=_0x42ab2d||0xc8;return function(_0x2a1d87){if(_0x2a1d87){return _0xc13ad1[_0x18eb('0x17')](_0x42ab2d)['json'](_0x2a1d87);}};}function respondWithFilteredResult(_0x568187,_0x3f2dca){return function(_0x1d918f){if(_0x1d918f){var _0x55bbef=_0x1d918f['count'],_0x155169=_0x3f2dca['offset'],_0x394786=_0x3f2dca[_0x18eb('0x19')]+_0x3f2dca[_0x18eb('0x1a')],_0x4ea234;if(_0x394786>=_0x55bbef){_0x394786=_0x55bbef;_0x4ea234=0xc8;}else{_0x4ea234=0xce;}_0x568187[_0x18eb('0x17')](_0x4ea234);return _0x568187[_0x18eb('0x1b')](_0x18eb('0x1c'),_0x155169+'-'+_0x394786+'/'+_0x55bbef)[_0x18eb('0x1d')](_0x1d918f);}return null;};}function patchUpdates(_0x53eaef){return function(_0x1373c0){try{jsonpatch[_0x18eb('0x1e')](_0x1373c0,_0x53eaef,!![]);}catch(_0x1ade6c){return BPromise[_0x18eb('0x1f')](_0x1ade6c);}return _0x1373c0[_0x18eb('0x20')]();};}function saveUpdates(_0x3eba82,_0x1fd877){return function(_0x45b15f){if(_0x45b15f){return _0x45b15f[_0x18eb('0x21')](_0x3eba82)[_0x18eb('0x22')](function(_0x38ff67){return _0x38ff67;});}return null;};}function removeEntity(_0x50d750,_0x60c712){return function(_0x2d0f86){if(_0x2d0f86){return _0x2d0f86[_0x18eb('0x23')]()['then'](function(){_0x50d750[_0x18eb('0x17')](0xcc)[_0x18eb('0x18')]();});}};}function handleEntityNotFound(_0x32a969,_0x11f116){return function(_0x2d2737){if(!_0x2d2737){_0x32a969[_0x18eb('0x16')](0x194);}return _0x2d2737;};}function handleError(_0x7afb72,_0x5e29d6){_0x5e29d6=_0x5e29d6||0x1f4;return function(_0xe893da){logger['error'](_0xe893da[_0x18eb('0x24')]);if(_0xe893da[_0x18eb('0x25')]){delete _0xe893da[_0x18eb('0x25')];}_0x7afb72[_0x18eb('0x17')](_0x5e29d6)[_0x18eb('0x26')](_0xe893da);};}exports['index']=function(_0x338d45,_0x260f84){var _0x2f2eee={},_0x3eb7c9={},_0x23eee6={'count':0x0,'rows':[]};var _0x2aeaa1=db['JscriptySessionReport'][_0x18eb('0x27')];_0x3eb7c9[_0x18eb('0x28')]=_['keys'](_0x2aeaa1);_0x3eb7c9[_0x18eb('0x29')]=_['keys'](_0x338d45[_0x18eb('0x29')]);_0x3eb7c9[_0x18eb('0x2a')]=_[_0x18eb('0x2b')](_0x3eb7c9[_0x18eb('0x28')],_0x3eb7c9[_0x18eb('0x29')]);_0x2f2eee[_0x18eb('0x2c')]=_[_0x18eb('0x2b')](_0x3eb7c9[_0x18eb('0x28')],qs['fields'](_0x338d45[_0x18eb('0x29')][_0x18eb('0x2d')]));_0x2f2eee['attributes']=_0x2f2eee[_0x18eb('0x2c')][_0x18eb('0x2e')]?_0x2f2eee[_0x18eb('0x2c')]:_0x3eb7c9[_0x18eb('0x28')];if(!_0x338d45[_0x18eb('0x29')]['hasOwnProperty'](_0x18eb('0x2f'))){_0x2f2eee[_0x18eb('0x1a')]=qs[_0x18eb('0x1a')](_0x338d45[_0x18eb('0x29')]['limit']);_0x2f2eee[_0x18eb('0x19')]=qs[_0x18eb('0x19')](_0x338d45[_0x18eb('0x29')][_0x18eb('0x19')]);}_0x2f2eee[_0x18eb('0x30')]=qs[_0x18eb('0x31')](_0x338d45[_0x18eb('0x29')][_0x18eb('0x31')]);_0x2f2eee[_0x18eb('0x32')]=qs['filters'](_[_0x18eb('0x33')](_0x338d45[_0x18eb('0x29')],_0x3eb7c9[_0x18eb('0x2a')]));if(_0x338d45[_0x18eb('0x29')][_0x18eb('0x34')]){_0x2f2eee[_0x18eb('0x32')]=_[_0x18eb('0x35')](_0x2f2eee[_0x18eb('0x32')],{'$or':_[_0x18eb('0x36')](_0x2aeaa1,function(_0x39480d){if(_0x39480d[_0x18eb('0x37')][_0x18eb('0x38')]!==_0x18eb('0x39')){var _0x164204={};_0x164204[_0x39480d['field']]={'$like':'%'+_0x338d45['query'][_0x18eb('0x34')]+'%'};return _0x164204;}})});}_0x2f2eee=_[_0x18eb('0x35')]({},_0x2f2eee,_0x338d45[_0x18eb('0x3a')]);var _0x6562df={'where':_0x2f2eee[_0x18eb('0x32')]};return db[_0x18eb('0x3b')][_0x18eb('0x3c')](_0x6562df)[_0x18eb('0x22')](function(_0xa4181f){_0x23eee6[_0x18eb('0x3c')]=_0xa4181f;if(_0x338d45[_0x18eb('0x29')][_0x18eb('0x3d')]){_0x2f2eee[_0x18eb('0x3e')]=[{'all':!![]}];}return db[_0x18eb('0x3b')][_0x18eb('0x3f')](_0x2f2eee);})[_0x18eb('0x22')](function(_0x5507cb){_0x23eee6[_0x18eb('0x40')]=_0x5507cb;return _0x23eee6;})[_0x18eb('0x22')](respondWithFilteredResult(_0x260f84,_0x2f2eee))[_0x18eb('0x41')](handleError(_0x260f84,null));};exports[_0x18eb('0x42')]=function(_0x39d8c0,_0x5225c3){var _0x3fe4c9={'raw':!![],'where':{'id':_0x39d8c0[_0x18eb('0x43')]['id']}},_0x5aefe3={};_0x5aefe3['model']=_['keys'](db[_0x18eb('0x3b')][_0x18eb('0x27')]);_0x5aefe3['query']=_['keys'](_0x39d8c0['query']);_0x5aefe3[_0x18eb('0x2a')]=_[_0x18eb('0x2b')](_0x5aefe3['model'],_0x5aefe3[_0x18eb('0x29')]);_0x3fe4c9[_0x18eb('0x2c')]=_['intersection'](_0x5aefe3['model'],qs[_0x18eb('0x2d')](_0x39d8c0[_0x18eb('0x29')]['fields']));_0x3fe4c9['attributes']=_0x3fe4c9[_0x18eb('0x2c')][_0x18eb('0x2e')]?_0x3fe4c9[_0x18eb('0x2c')]:_0x5aefe3[_0x18eb('0x28')];if(_0x39d8c0['query']['includeAll']){_0x3fe4c9[_0x18eb('0x3e')]=[{'all':!![]}];}_0x3fe4c9=_[_0x18eb('0x35')]({},_0x3fe4c9,_0x39d8c0[_0x18eb('0x3a')]);return db['JscriptySessionReport']['find'](_0x3fe4c9)[_0x18eb('0x22')](handleEntityNotFound(_0x5225c3,null))['then'](respondWithResult(_0x5225c3,null))[_0x18eb('0x41')](handleError(_0x5225c3,null));};exports[_0x18eb('0x44')]=function(_0x1e8fdf,_0x5459df){return db[_0x18eb('0x3b')][_0x18eb('0x44')](_0x1e8fdf[_0x18eb('0x45')],{})['then'](respondWithResult(_0x5459df,0xc9))[_0x18eb('0x41')](handleError(_0x5459df,null));};exports[_0x18eb('0x21')]=function(_0x9f09be,_0x434e5b){if(_0x9f09be['body']['id']){delete _0x9f09be[_0x18eb('0x45')]['id'];}return db['JscriptySessionReport'][_0x18eb('0x46')]({'where':{'id':_0x9f09be['params']['id']}})['then'](handleEntityNotFound(_0x434e5b,null))['then'](saveUpdates(_0x9f09be[_0x18eb('0x45')],null))[_0x18eb('0x22')](respondWithResult(_0x434e5b,null))[_0x18eb('0x41')](handleError(_0x434e5b,null));};exports[_0x18eb('0x23')]=function(_0xbe4e2a,_0x1688f3){return db[_0x18eb('0x3b')][_0x18eb('0x46')]({'where':{'id':_0xbe4e2a[_0x18eb('0x43')]['id']}})[_0x18eb('0x22')](handleEntityNotFound(_0x1688f3,null))[_0x18eb('0x22')](removeEntity(_0x1688f3,null))[_0x18eb('0x41')](handleError(_0x1688f3,null));};exports[_0x18eb('0x47')]=function(_0x92d9cf,_0x1acc93){return db['JscriptySessionReport'][_0x18eb('0x47')]()[_0x18eb('0x22')](respondWithResult(_0x1acc93,null))[_0x18eb('0x41')](handleError(_0x1acc93,null));};exports[_0x18eb('0x48')]=function(_0x2da002,_0x2456cb,_0x115a61){var _0x57c5bc={'raw':!![],'where':{}};var _0x2e10b6={};var _0x1220d2={'count':0x0,'rows':[]};return db[_0x18eb('0x3b')][_0x18eb('0x49')]({'where':{'id':_0x2da002['params']['id']}})['then'](handleEntityNotFound(_0x2456cb,null))[_0x18eb('0x22')](function(_0x2a091b){if(_0x2a091b){_0x2e10b6['model']=_[_0x18eb('0x4a')](db['JscriptyQuestionReport'][_0x18eb('0x27')]);_0x2e10b6[_0x18eb('0x29')]=_[_0x18eb('0x4a')](_0x2da002[_0x18eb('0x29')]);_0x2e10b6[_0x18eb('0x2a')]=_[_0x18eb('0x2b')](_0x2e10b6[_0x18eb('0x28')],_0x2e10b6[_0x18eb('0x29')]);_0x57c5bc[_0x18eb('0x2c')]=_[_0x18eb('0x2b')](_0x2e10b6[_0x18eb('0x28')],qs[_0x18eb('0x2d')](_0x2da002[_0x18eb('0x29')][_0x18eb('0x2d')]));_0x57c5bc[_0x18eb('0x2c')]=_0x57c5bc[_0x18eb('0x2c')][_0x18eb('0x2e')]?_0x57c5bc[_0x18eb('0x2c')]:_0x2e10b6['model'];if(!_0x2da002['query']['hasOwnProperty'](_0x18eb('0x2f'))){_0x57c5bc[_0x18eb('0x1a')]=qs[_0x18eb('0x1a')](_0x2da002[_0x18eb('0x29')][_0x18eb('0x1a')]);_0x57c5bc[_0x18eb('0x19')]=qs[_0x18eb('0x19')](_0x2da002[_0x18eb('0x29')][_0x18eb('0x19')]);}_0x57c5bc[_0x18eb('0x30')]=qs[_0x18eb('0x31')](_0x2da002['query'][_0x18eb('0x31')]);_0x57c5bc['where']=qs[_0x18eb('0x2a')](_[_0x18eb('0x33')](_0x2da002[_0x18eb('0x29')],_0x2e10b6['filters']));_0x57c5bc[_0x18eb('0x32')][_0x18eb('0x4b')]=_0x2a091b['id'];if(_0x2da002[_0x18eb('0x29')][_0x18eb('0x34')]){_0x57c5bc[_0x18eb('0x32')]=_['merge'](_0x57c5bc[_0x18eb('0x32')],{'$or':_[_0x18eb('0x36')](_0x57c5bc[_0x18eb('0x2c')],function(_0x245fa0){var _0x5a0dfd={};_0x5a0dfd[_0x245fa0]={'$like':'%'+_0x2da002[_0x18eb('0x29')][_0x18eb('0x34')]+'%'};return _0x5a0dfd;})});}_0x57c5bc=_['merge']({},_0x57c5bc,_0x2da002[_0x18eb('0x3a')]);return db[_0x18eb('0x4c')][_0x18eb('0x3c')]({'where':_0x57c5bc[_0x18eb('0x32')]})[_0x18eb('0x22')](function(_0x1ee080){_0x1220d2[_0x18eb('0x3c')]=_0x1ee080;if(_0x2da002['query'][_0x18eb('0x3d')]){_0x57c5bc['include']=[{'all':!![]}];}return db[_0x18eb('0x4c')][_0x18eb('0x3f')](_0x57c5bc);})[_0x18eb('0x22')](function(_0x85f346){_0x1220d2[_0x18eb('0x40')]=_0x85f346;return _0x1220d2;});}})['then'](respondWithFilteredResult(_0x2456cb,_0x57c5bc))[_0x18eb('0x41')](handleError(_0x2456cb,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index bfbbeca..e96bffb 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 _0x39af=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','api','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x39af,0x69));var _0xf39a=function(_0x4cd8d6,_0x470804){_0x4cd8d6=_0x4cd8d6-0x0;var _0x49d02a=_0x39af[_0x4cd8d6];return _0x49d02a;};'use strict';var _=require('lodash');var util=require(_0xf39a('0x0'));var logger=require(_0xf39a('0x1'))(_0xf39a('0x2'));var moment=require('moment');var BPromise=require(_0xf39a('0x3'));var rp=require(_0xf39a('0x4'));var attributes=require(_0xf39a('0x5'));module[_0xf39a('0x6')]=function(_0x4596af,_0x551f28){return _0x4596af[_0xf39a('0x7')](_0xf39a('0x8'),attributes,{'tableName':_0xf39a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dcd=['request-promise','exports','define','util','bluebird'];(function(_0x3ab687,_0x2f3a18){var _0x512596=function(_0x981ef2){while(--_0x981ef2){_0x3ab687['push'](_0x3ab687['shift']());}};_0x512596(++_0x2f3a18);}(_0x6dcd,0x13e));var _0xd6dc=function(_0x87778b,_0x508f14){_0x87778b=_0x87778b-0x0;var _0x2eb1c3=_0x6dcd[_0x87778b];return _0x2eb1c3;};'use strict';var _=require('lodash');var util=require(_0xd6dc('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd6dc('0x1'));var rp=require(_0xd6dc('0x2'));var attributes=require('./jscriptySessionReport.attributes');module[_0xd6dc('0x3')]=function(_0x1c5bdc,_0x2da93e){return _0x1c5bdc[_0xd6dc('0x4')]('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 ea7a761..e38dcfe 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 _0xe558=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x1a09d2,_0x4db49c){var _0x4c5433=function(_0x336940){while(--_0x336940){_0x1a09d2['push'](_0x1a09d2['shift']());}};_0x4c5433(++_0x4db49c);}(_0xe558,0x70));var _0x8e55=function(_0x948fc6,_0x240052){_0x948fc6=_0x948fc6-0x0;var _0x41a750=_0xe558[_0x948fc6];return _0x41a750;};'use strict';var _=require(_0x8e55('0x0'));var util=require(_0x8e55('0x1'));var moment=require(_0x8e55('0x2'));var BPromise=require(_0x8e55('0x3'));var rs=require(_0x8e55('0x4'));var fs=require('fs');var Redis=require(_0x8e55('0x5'));var db=require(_0x8e55('0x6'))['db'];var utils=require(_0x8e55('0x7'));var logger=require(_0x8e55('0x8'))('rpc');var config=require(_0x8e55('0x9'));var jayson=require(_0x8e55('0xa'));var client=jayson[_0x8e55('0xb')][_0x8e55('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cef42,_0x13c5db,_0x493307){return new BPromise(function(_0xe27f09,_0x429679){return client['request'](_0x3cef42,_0x493307)[_0x8e55('0xd')](function(_0x578110){logger['info'](_0x8e55('0xe'),_0x13c5db,'request\x20sent');logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x13c5db,_0x8e55('0xf'),JSON[_0x8e55('0x10')](_0x578110));if(_0x578110[_0x8e55('0x11')]){if(_0x578110[_0x8e55('0x11')]['code']===0x1f4){logger[_0x8e55('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x13c5db,_0x578110['error']['message']);return _0x429679(_0x578110[_0x8e55('0x11')]['message']);}logger[_0x8e55('0x11')](_0x8e55('0xe'),_0x13c5db,_0x578110[_0x8e55('0x11')][_0x8e55('0x12')]);return _0xe27f09(_0x578110[_0x8e55('0x11')][_0x8e55('0x12')]);}else{logger[_0x8e55('0x13')](_0x8e55('0xe'),_0x13c5db,_0x8e55('0xf'));_0xe27f09(_0x578110[_0x8e55('0x14')][_0x8e55('0x12')]);}})[_0x8e55('0x15')](function(_0x202bc4){logger[_0x8e55('0x11')](_0x8e55('0xe'),_0x13c5db,_0x202bc4);_0x429679(_0x202bc4);});});} \ No newline at end of file +var _0x9300=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','lodash','bluebird','randomstring'];(function(_0x190a13,_0x5315a3){var _0x3f9b79=function(_0x25dc6f){while(--_0x25dc6f){_0x190a13['push'](_0x190a13['shift']());}};_0x3f9b79(++_0x5315a3);}(_0x9300,0x153));var _0x0930=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x9300[_0x4c184d];return _0x23d997;};'use strict';var _=require(_0x0930('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0930('0x1'));var rs=require(_0x0930('0x2'));var fs=require('fs');var Redis=require(_0x0930('0x3'));var db=require(_0x0930('0x4'))['db'];var utils=require(_0x0930('0x5'));var logger=require('../../config/logger')(_0x0930('0x6'));var config=require(_0x0930('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0930('0x8')][_0x0930('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45705a,_0x34c693,_0x2c0f94){return new BPromise(function(_0x1ec24f,_0x5bc3df){return client['request'](_0x45705a,_0x2c0f94)[_0x0930('0xa')](function(_0x4b1994){logger[_0x0930('0xb')](_0x0930('0xc'),_0x34c693,'request\x20sent');logger[_0x0930('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x34c693,'request\x20sent',JSON[_0x0930('0xe')](_0x4b1994));if(_0x4b1994[_0x0930('0xf')]){if(_0x4b1994['error']['code']===0x1f4){logger[_0x0930('0xf')](_0x0930('0xc'),_0x34c693,_0x4b1994[_0x0930('0xf')][_0x0930('0x10')]);return _0x5bc3df(_0x4b1994[_0x0930('0xf')][_0x0930('0x10')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x34c693,_0x4b1994['error'][_0x0930('0x10')]);return _0x1ec24f(_0x4b1994['error'][_0x0930('0x10')]);}else{logger[_0x0930('0xb')](_0x0930('0xc'),_0x34c693,_0x0930('0x11'));_0x1ec24f(_0x4b1994[_0x0930('0x12')][_0x0930('0x10')]);}})['catch'](function(_0x3ec27b){logger[_0x0930('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x34c693,_0x3ec27b);_0x5bc3df(_0x3ec27b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7171551..0186007 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 _0xbc3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put','/:id','exports','util','path','connect-timeout','express'];(function(_0x159c49,_0xed8c51){var _0x4a56b2=function(_0x449cfc){while(--_0x449cfc){_0x159c49['push'](_0x159c49['shift']());}};_0x4a56b2(++_0xed8c51);}(_0xbc3c,0x1d0));var _0xcbc3=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xbc3c[_0x16d10f];return _0x50c823;};'use strict';var multer=require('multer');var util=require(_0xcbc3('0x0'));var path=require(_0xcbc3('0x1'));var timeout=require(_0xcbc3('0x2'));var express=require(_0xcbc3('0x3'));var router=express['Router']();var auth=require(_0xcbc3('0x4'));var interaction=require(_0xcbc3('0x5'));var config=require(_0xcbc3('0x6'));var controller=require(_0xcbc3('0x7'));router['get']('/',controller[_0xcbc3('0x8')]);router[_0xcbc3('0x9')](_0xcbc3('0xa'),auth['isAuthenticated'](),controller['update']);module[_0xcbc3('0xb')]=router; \ No newline at end of file +var _0x03d4=['isAuthenticated','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','get'];(function(_0xcf2356,_0x5f21d1){var _0x5a3ef6=function(_0x13f8e9){while(--_0x13f8e9){_0xcf2356['push'](_0xcf2356['shift']());}};_0x5a3ef6(++_0x5f21d1);}(_0x03d4,0xdf));var _0x403d=function(_0x1bb994,_0x1325e1){_0x1bb994=_0x1bb994-0x0;var _0x3fdca6=_0x03d4[_0x1bb994];return _0x3fdca6;};'use strict';var multer=require(_0x403d('0x0'));var util=require(_0x403d('0x1'));var path=require(_0x403d('0x2'));var timeout=require(_0x403d('0x3'));var express=require('express');var router=express[_0x403d('0x4')]();var auth=require(_0x403d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router[_0x403d('0x6')]('/',controller['index']);router['put']('/:id',auth[_0x403d('0x7')](),controller[_0x403d('0x8')]);module[_0x403d('0x9')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 06ea254..d66060c 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 _0x2347=['INTEGER','sequelize','TEXT'];(function(_0x4ce69f,_0x3a05cb){var _0x5c5bab=function(_0x28a704){while(--_0x28a704){_0x4ce69f['push'](_0x4ce69f['shift']());}};_0x5c5bab(++_0x3a05cb);}(_0x2347,0x1d5));var _0x7234=function(_0x388d32,_0x592e89){_0x388d32=_0x388d32-0x0;var _0xf0cf12=_0x2347[_0x388d32];return _0xf0cf12;};'use strict';var Sequelize=require(_0x7234('0x0'));module['exports']={'license':{'type':Sequelize[_0x7234('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x7234('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe412=['sequelize','STRING','INTEGER'];(function(_0x2b5853,_0x2607d6){var _0x404b31=function(_0x149f5e){while(--_0x149f5e){_0x2b5853['push'](_0x2b5853['shift']());}};_0x404b31(++_0x2607d6);}(_0xe412,0x1e6));var _0x2e41=function(_0x2ebba1,_0x4f1832){_0x2ebba1=_0x2ebba1-0x0;var _0x2a046d=_0xe412[_0x2ebba1];return _0x2a046d;};'use strict';var Sequelize=require(_0x2e41('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x2e41('0x1')]},'data2':{'type':Sequelize[_0x2e41('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x2e41('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index d76bdab..bf7db13 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 _0xd82b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','model','License','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','find','params','get','body','key','demo','html-pdf'];(function(_0x32d96f,_0x2c3ad9){var _0x4330c6=function(_0xe6ebf3){while(--_0xe6ebf3){_0x32d96f['push'](_0x32d96f['shift']());}};_0x4330c6(++_0x2c3ad9);}(_0xd82b,0x7b));var _0xbd82=function(_0x514919,_0x16c33d){_0x514919=_0x514919-0x0;var _0x343a77=_0xd82b[_0x514919];return _0x343a77;};'use strict';var pdf=require(_0xbd82('0x0'));var emlformat=require(_0xbd82('0x1'));var rimraf=require(_0xbd82('0x2'));var zipdir=require(_0xbd82('0x3'));var jsonpatch=require(_0xbd82('0x4'));var rp=require(_0xbd82('0x5'));var moment=require('moment');var BPromise=require(_0xbd82('0x6'));var Mustache=require(_0xbd82('0x7'));var util=require('util');var path=require(_0xbd82('0x8'));var sox=require(_0xbd82('0x9'));var csv=require(_0xbd82('0xa'));var ejs=require(_0xbd82('0xb'));var fs=require('fs');var _=require(_0xbd82('0xc'));var squel=require(_0xbd82('0xd'));var crypto=require(_0xbd82('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbd82('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbd82('0x10'));var Papa=require('papaparse');var authService=require(_0xbd82('0x11'));var hardwareService=require(_0xbd82('0x12'));var Redis=require(_0xbd82('0x13'));var qs=require(_0xbd82('0x14'));var logger=require('../../config/logger')(_0xbd82('0x15'));var utils=require(_0xbd82('0x16'));var config=require(_0xbd82('0x17'));var db=require(_0xbd82('0x18'))['db'];function respondWithStatusCode(_0x136c21,_0x45dfe1){_0x45dfe1=_0x45dfe1||0xcc;return function(_0x35f46f){if(_0x35f46f){return _0x136c21[_0xbd82('0x19')](_0x45dfe1);}return _0x136c21['status'](_0x45dfe1)[_0xbd82('0x1a')]();};}function respondWithResult(_0x39365d,_0x23f52e){_0x23f52e=_0x23f52e||0xc8;return function(_0x4316bc){if(_0x4316bc){return _0x39365d[_0xbd82('0x1b')](_0x23f52e)[_0xbd82('0x1c')](_0x4316bc);}};}function respondWithFilteredResult(_0x44e837,_0x1f6bb9){return function(_0x467b3f){if(_0x467b3f){var _0x2ad693=_0x467b3f['count'],_0x12291=_0x1f6bb9[_0xbd82('0x1d')],_0x3c738a=_0x1f6bb9['offset']+_0x1f6bb9[_0xbd82('0x1e')],_0x2c2a0c;if(_0x3c738a>=_0x2ad693){_0x3c738a=_0x2ad693;_0x2c2a0c=0xc8;}else{_0x2c2a0c=0xce;}_0x44e837['status'](_0x2c2a0c);return _0x44e837[_0xbd82('0x1f')](_0xbd82('0x20'),_0x12291+'-'+_0x3c738a+'/'+_0x2ad693)[_0xbd82('0x1c')](_0x467b3f);}return null;};}function patchUpdates(_0x3f4ada){return function(_0x267149){try{jsonpatch['apply'](_0x267149,_0x3f4ada,!![]);}catch(_0x26f153){return BPromise['reject'](_0x26f153);}return _0x267149[_0xbd82('0x21')]();};}function saveUpdates(_0x10d45a,_0x33cd5b){return function(_0x599089){if(_0x599089){return _0x599089[_0xbd82('0x22')](_0x10d45a)[_0xbd82('0x23')](function(_0x4834db){return _0x4834db;});}return null;};}function removeEntity(_0x593cb5,_0x20d1b3){return function(_0x3d70bc){if(_0x3d70bc){return _0x3d70bc[_0xbd82('0x24')]()['then'](function(){_0x593cb5[_0xbd82('0x1b')](0xcc)[_0xbd82('0x1a')]();});}};}function handleEntityNotFound(_0x2cf215,_0x4fcbc7){return function(_0x466317){if(!_0x466317){_0x2cf215[_0xbd82('0x19')](0x194);}return _0x466317;};}function handleError(_0x8f4dc1,_0x3273be){_0x3273be=_0x3273be||0x1f4;return function(_0x1a5c10){logger[_0xbd82('0x25')](_0x1a5c10[_0xbd82('0x26')]);if(_0x1a5c10[_0xbd82('0x27')]){delete _0x1a5c10[_0xbd82('0x27')];}_0x8f4dc1[_0xbd82('0x1b')](_0x3273be)[_0xbd82('0x28')](_0x1a5c10);};}var utilLicense=require('../../config/license/util');exports[_0xbd82('0x29')]=function(_0x57237f,_0x41c10b){var _0x48d149={'raw':!![],'where':{'id':0x1}},_0x3ea2fd={};_0x3ea2fd[_0xbd82('0x2a')]=_['keys'](db[_0xbd82('0x2b')][_0xbd82('0x2c')]);_0x3ea2fd[_0xbd82('0x2d')]=_[_0xbd82('0x2e')](_0x57237f[_0xbd82('0x2d')]);_0x3ea2fd[_0xbd82('0x2f')]=_[_0xbd82('0x30')](_0x3ea2fd[_0xbd82('0x2a')],_0x3ea2fd[_0xbd82('0x2d')]);_0x48d149[_0xbd82('0x31')]=_[_0xbd82('0x30')](_0x3ea2fd[_0xbd82('0x2a')],qs[_0xbd82('0x32')](_0x57237f[_0xbd82('0x2d')][_0xbd82('0x32')]));_0x48d149[_0xbd82('0x31')]=_0x48d149[_0xbd82('0x31')][_0xbd82('0x33')]?_0x48d149[_0xbd82('0x31')]:_0x3ea2fd['model'];_0x48d149=_[_0xbd82('0x34')]({},_0x48d149,_0x57237f[_0xbd82('0x35')]);return utilLicense[_0xbd82('0x36')](_0x48d149)[_0xbd82('0x23')](respondWithResult(_0x41c10b,null))[_0xbd82('0x37')](handleError(_0x41c10b,null));};exports[_0xbd82('0x22')]=function(_0x485074,_0x406b82){if(_0x485074['body']['id']){delete _0x485074['body']['id'];}return db[_0xbd82('0x2b')][_0xbd82('0x38')]({'where':{'id':_0x485074[_0xbd82('0x39')]['id']}})[_0xbd82('0x23')](handleEntityNotFound(_0x406b82,null))['then'](function(_0x52c451){var _0x4bdbb6=_0x52c451[_0xbd82('0x3a')]({'plain':!![]});return utilLicense['checkLicense'](_0x4bdbb6,_0x485074[_0xbd82('0x3b')][_0xbd82('0x3c')]);})[_0xbd82('0x23')](function(_0x4cb0b1){if(!_0x4cb0b1[_0xbd82('0x3d')]){return saveUpdates(_0x485074[_0xbd82('0x3b')],null);}return _0x4cb0b1;})['then'](respondWithResult(_0x406b82,null))[_0xbd82('0x37')](handleError(_0x406b82,null));}; \ No newline at end of file +var _0x4b78=['filters','intersection','attributes','fields','length','merge','options','catch','update','body','find','params','get','checkLicense','key','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','model','keys','License','rawAttributes','query'];(function(_0x57cf42,_0x5daea0){var _0x477180=function(_0x65cbea){while(--_0x65cbea){_0x57cf42['push'](_0x57cf42['shift']());}};_0x477180(++_0x5daea0);}(_0x4b78,0x11d));var _0x84b7=function(_0x4748df,_0x246c02){_0x4748df=_0x4748df-0x0;var _0x499ef7=_0x4b78[_0x4748df];return _0x499ef7;};'use strict';var pdf=require(_0x84b7('0x0'));var emlformat=require(_0x84b7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x84b7('0x2'));var moment=require(_0x84b7('0x3'));var BPromise=require(_0x84b7('0x4'));var Mustache=require(_0x84b7('0x5'));var util=require(_0x84b7('0x6'));var path=require('path');var sox=require(_0x84b7('0x7'));var csv=require(_0x84b7('0x8'));var ejs=require(_0x84b7('0x9'));var fs=require('fs');var _=require(_0x84b7('0xa'));var squel=require('squel');var crypto=require(_0x84b7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x84b7('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x84b7('0xd'));var qs=require(_0x84b7('0xe'));var logger=require(_0x84b7('0xf'))('api');var utils=require(_0x84b7('0x10'));var config=require(_0x84b7('0x11'));var db=require(_0x84b7('0x12'))['db'];function respondWithStatusCode(_0xe2c8c2,_0x545875){_0x545875=_0x545875||0xcc;return function(_0xf10793){if(_0xf10793){return _0xe2c8c2[_0x84b7('0x13')](_0x545875);}return _0xe2c8c2[_0x84b7('0x14')](_0x545875)[_0x84b7('0x15')]();};}function respondWithResult(_0x457ed2,_0x4901fc){_0x4901fc=_0x4901fc||0xc8;return function(_0x4f6818){if(_0x4f6818){return _0x457ed2['status'](_0x4901fc)[_0x84b7('0x16')](_0x4f6818);}};}function respondWithFilteredResult(_0x60824c,_0x16b8b8){return function(_0x4fe0a3){if(_0x4fe0a3){var _0x30c096=_0x4fe0a3[_0x84b7('0x17')],_0x3a65e7=_0x16b8b8['offset'],_0x165155=_0x16b8b8['offset']+_0x16b8b8['limit'],_0x81c29;if(_0x165155>=_0x30c096){_0x165155=_0x30c096;_0x81c29=0xc8;}else{_0x81c29=0xce;}_0x60824c[_0x84b7('0x14')](_0x81c29);return _0x60824c[_0x84b7('0x18')](_0x84b7('0x19'),_0x3a65e7+'-'+_0x165155+'/'+_0x30c096)['json'](_0x4fe0a3);}return null;};}function patchUpdates(_0x509884){return function(_0x4ed5e6){try{jsonpatch[_0x84b7('0x1a')](_0x4ed5e6,_0x509884,!![]);}catch(_0xe41531){return BPromise[_0x84b7('0x1b')](_0xe41531);}return _0x4ed5e6[_0x84b7('0x1c')]();};}function saveUpdates(_0x4f9c34,_0x2c8fbf){return function(_0x4e8c21){if(_0x4e8c21){return _0x4e8c21['update'](_0x4f9c34)[_0x84b7('0x1d')](function(_0x50dfa3){return _0x50dfa3;});}return null;};}function removeEntity(_0x59cc08,_0x183f9b){return function(_0x115c50){if(_0x115c50){return _0x115c50[_0x84b7('0x1e')]()[_0x84b7('0x1d')](function(){_0x59cc08['status'](0xcc)[_0x84b7('0x15')]();});}};}function handleEntityNotFound(_0x2dd65e,_0x306939){return function(_0xa2cc76){if(!_0xa2cc76){_0x2dd65e[_0x84b7('0x13')](0x194);}return _0xa2cc76;};}function handleError(_0x3d25b0,_0x4df551){_0x4df551=_0x4df551||0x1f4;return function(_0x138847){logger[_0x84b7('0x1f')](_0x138847[_0x84b7('0x20')]);if(_0x138847[_0x84b7('0x21')]){delete _0x138847[_0x84b7('0x21')];}_0x3d25b0[_0x84b7('0x14')](_0x4df551)['send'](_0x138847);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x1207b7,_0x149a8f){var _0xa1f329={'raw':!![],'where':{'id':0x1}},_0x1822d2={};_0x1822d2[_0x84b7('0x22')]=_[_0x84b7('0x23')](db[_0x84b7('0x24')][_0x84b7('0x25')]);_0x1822d2[_0x84b7('0x26')]=_[_0x84b7('0x23')](_0x1207b7['query']);_0x1822d2[_0x84b7('0x27')]=_[_0x84b7('0x28')](_0x1822d2['model'],_0x1822d2['query']);_0xa1f329[_0x84b7('0x29')]=_[_0x84b7('0x28')](_0x1822d2[_0x84b7('0x22')],qs[_0x84b7('0x2a')](_0x1207b7[_0x84b7('0x26')][_0x84b7('0x2a')]));_0xa1f329[_0x84b7('0x29')]=_0xa1f329[_0x84b7('0x29')][_0x84b7('0x2b')]?_0xa1f329[_0x84b7('0x29')]:_0x1822d2[_0x84b7('0x22')];_0xa1f329=_[_0x84b7('0x2c')]({},_0xa1f329,_0x1207b7[_0x84b7('0x2d')]);return utilLicense['getLicense'](_0xa1f329)['then'](respondWithResult(_0x149a8f,null))[_0x84b7('0x2e')](handleError(_0x149a8f,null));};exports[_0x84b7('0x2f')]=function(_0x3c4584,_0xe39f9d){if(_0x3c4584['body']['id']){delete _0x3c4584[_0x84b7('0x30')]['id'];}return db[_0x84b7('0x24')][_0x84b7('0x31')]({'where':{'id':_0x3c4584[_0x84b7('0x32')]['id']}})[_0x84b7('0x1d')](handleEntityNotFound(_0xe39f9d,null))[_0x84b7('0x1d')](function(_0x4dc86f){var _0x642346=_0x4dc86f[_0x84b7('0x33')]({'plain':!![]});return utilLicense[_0x84b7('0x34')](_0x642346,_0x3c4584[_0x84b7('0x30')][_0x84b7('0x35')]);})[_0x84b7('0x1d')](function(_0x1b4df1){if(!_0x1b4df1['demo']){return saveUpdates(_0x3c4584[_0x84b7('0x30')],null);}return _0x1b4df1;})[_0x84b7('0x1d')](respondWithResult(_0xe39f9d,null))[_0x84b7('0x2e')](handleError(_0xe39f9d,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index faa737b..c00de33 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 _0xb2ef=['moment','bluebird','request-promise','exports','define','License','license','lodash','util','../../config/logger'];(function(_0x87239,_0x38c793){var _0x53af1e=function(_0x11eb5f){while(--_0x11eb5f){_0x87239['push'](_0x87239['shift']());}};_0x53af1e(++_0x38c793);}(_0xb2ef,0xa7));var _0xfb2e=function(_0x463b47,_0x1b8a3c){_0x463b47=_0x463b47-0x0;var _0x2f9caa=_0xb2ef[_0x463b47];return _0x2f9caa;};'use strict';var _=require(_0xfb2e('0x0'));var util=require(_0xfb2e('0x1'));var logger=require(_0xfb2e('0x2'))('api');var moment=require(_0xfb2e('0x3'));var BPromise=require(_0xfb2e('0x4'));var rp=require(_0xfb2e('0x5'));var attributes=require('./license.attributes');module[_0xfb2e('0x6')]=function(_0x1716cd,_0x1b795e){return _0x1716cd[_0xfb2e('0x7')](_0xfb2e('0x8'),attributes,{'tableName':_0xfb2e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x946e=['define','license','lodash','../../config/logger','moment','./license.attributes','exports'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x946e,0x1d0));var _0xe946=function(_0x28fec5,_0x1467f0){_0x28fec5=_0x28fec5-0x0;var _0x2194bf=_0x946e[_0x28fec5];return _0x2194bf;};'use strict';var _=require(_0xe946('0x0'));var util=require('util');var logger=require(_0xe946('0x1'))('api');var moment=require(_0xe946('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xe946('0x3'));module[_0xe946('0x4')]=function(_0x2b42cd,_0x145058){return _0x2b42cd[_0xe946('0x5')]('License',attributes,{'tableName':_0xe946('0x6'),'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 ef995ad..ab91922 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 _0x01f8=['then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request'];(function(_0x986e23,_0xf825e5){var _0xaf809c=function(_0x3faf5c){while(--_0x3faf5c){_0x986e23['push'](_0x986e23['shift']());}};_0xaf809c(++_0xf825e5);}(_0x01f8,0x109));var _0x801f=function(_0x532673,_0x2d06f3){_0x532673=_0x532673-0x0;var _0x2bdee3=_0x01f8[_0x532673];return _0x2bdee3;};'use strict';var _=require(_0x801f('0x0'));var util=require(_0x801f('0x1'));var moment=require(_0x801f('0x2'));var BPromise=require(_0x801f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x801f('0x4'));var db=require(_0x801f('0x5'))['db'];var utils=require(_0x801f('0x6'));var logger=require(_0x801f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x801f('0x8')][_0x801f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ee07a,_0x4a10ec,_0x1309a6){return new BPromise(function(_0x274316,_0x3d6037){return client[_0x801f('0xa')](_0x1ee07a,_0x1309a6)[_0x801f('0xb')](function(_0x5e9b2a){logger[_0x801f('0xc')]('License,\x20%s,\x20%s',_0x4a10ec,_0x801f('0xd'));logger[_0x801f('0xe')](_0x801f('0xf'),_0x4a10ec,_0x801f('0xd'),JSON[_0x801f('0x10')](_0x5e9b2a));if(_0x5e9b2a[_0x801f('0x11')]){if(_0x5e9b2a[_0x801f('0x11')][_0x801f('0x12')]===0x1f4){logger[_0x801f('0x11')](_0x801f('0x13'),_0x4a10ec,_0x5e9b2a[_0x801f('0x11')][_0x801f('0x14')]);return _0x3d6037(_0x5e9b2a[_0x801f('0x11')][_0x801f('0x14')]);}logger[_0x801f('0x11')](_0x801f('0x13'),_0x4a10ec,_0x5e9b2a['error']['message']);return _0x274316(_0x5e9b2a[_0x801f('0x11')][_0x801f('0x14')]);}else{logger[_0x801f('0xc')](_0x801f('0x13'),_0x4a10ec,'request\x20sent');_0x274316(_0x5e9b2a[_0x801f('0x15')][_0x801f('0x14')]);}})[_0x801f('0x16')](function(_0x548adf){logger[_0x801f('0x11')](_0x801f('0x13'),_0x4a10ec,_0x548adf);_0x3d6037(_0x548adf);});});} \ No newline at end of file +var _0x1208=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','License,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2f51be,_0x134bcb){var _0x50b117=function(_0x24b7b9){while(--_0x24b7b9){_0x2f51be['push'](_0x2f51be['shift']());}};_0x50b117(++_0x134bcb);}(_0x1208,0x144));var _0x8120=function(_0x483c4b,_0x5c2d21){_0x483c4b=_0x483c4b-0x0;var _0x445a78=_0x1208[_0x483c4b];return _0x445a78;};'use strict';var _=require(_0x8120('0x0'));var util=require(_0x8120('0x1'));var moment=require(_0x8120('0x2'));var BPromise=require(_0x8120('0x3'));var rs=require(_0x8120('0x4'));var fs=require('fs');var Redis=require(_0x8120('0x5'));var db=require(_0x8120('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8120('0x7'));var config=require(_0x8120('0x8'));var jayson=require(_0x8120('0x9'));var client=jayson[_0x8120('0xa')][_0x8120('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11b913,_0x12b0b5,_0x47ba4f){return new BPromise(function(_0x577da0,_0x302e40){return client[_0x8120('0xc')](_0x11b913,_0x47ba4f)[_0x8120('0xd')](function(_0x4fab81){logger[_0x8120('0xe')]('License,\x20%s,\x20%s',_0x12b0b5,'request\x20sent');logger[_0x8120('0xf')](_0x8120('0x10'),_0x12b0b5,_0x8120('0x11'),JSON['stringify'](_0x4fab81));if(_0x4fab81[_0x8120('0x12')]){if(_0x4fab81[_0x8120('0x12')]['code']===0x1f4){logger[_0x8120('0x12')](_0x8120('0x13'),_0x12b0b5,_0x4fab81[_0x8120('0x12')][_0x8120('0x14')]);return _0x302e40(_0x4fab81[_0x8120('0x12')][_0x8120('0x14')]);}logger[_0x8120('0x12')](_0x8120('0x13'),_0x12b0b5,_0x4fab81[_0x8120('0x12')][_0x8120('0x14')]);return _0x577da0(_0x4fab81[_0x8120('0x12')][_0x8120('0x14')]);}else{logger[_0x8120('0xe')](_0x8120('0x13'),_0x12b0b5,_0x8120('0x11'));_0x577da0(_0x4fab81[_0x8120('0x15')][_0x8120('0x14')]);}})['catch'](function(_0x1c3f59){logger[_0x8120('0x12')](_0x8120('0x13'),_0x12b0b5,_0x1c3f59);_0x302e40(_0x1c3f59);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ebb8599..0d8302f 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 _0xccf0=['removeSmtp','destroy','removeAgents','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','addDisposition','addAnswer','post','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap'];(function(_0x43e885,_0x5700f1){var _0x18df65=function(_0x258935){while(--_0x258935){_0x43e885['push'](_0x43e885['shift']());}};_0x18df65(++_0x5700f1);}(_0xccf0,0x1bc));var _0x0ccf=function(_0x5e1e65,_0x234dea){_0x5e1e65=_0x5e1e65-0x0;var _0x9fd826=_0xccf0[_0x5e1e65];return _0x9fd826;};'use strict';var multer=require(_0x0ccf('0x0'));var util=require(_0x0ccf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ccf('0x2'));var router=express['Router']();var auth=require(_0x0ccf('0x3'));var interaction=require(_0x0ccf('0x4'));var config=require(_0x0ccf('0x5'));var controller=require('./mailAccount.controller');router[_0x0ccf('0x6')]('/',auth[_0x0ccf('0x7')](),controller['index']);router[_0x0ccf('0x6')](_0x0ccf('0x8'),auth[_0x0ccf('0x7')](),controller['describe']);router[_0x0ccf('0x6')](_0x0ccf('0x9'),auth[_0x0ccf('0x7')](),controller['show']);router['get'](_0x0ccf('0xa'),auth[_0x0ccf('0x7')](),controller['getDispositions']);router[_0x0ccf('0x6')](_0x0ccf('0xb'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0xc')]);router['get'](_0x0ccf('0xd'),auth['isAuthenticated'](),controller[_0x0ccf('0xe')]);router[_0x0ccf('0x6')](_0x0ccf('0xf'),auth[_0x0ccf('0x7')](),controller['getSmtp']);router[_0x0ccf('0x6')](_0x0ccf('0x10'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x11')]);router[_0x0ccf('0x6')](_0x0ccf('0x12'),auth[_0x0ccf('0x7')](),controller['getApplications']);router[_0x0ccf('0x6')](_0x0ccf('0x13'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x14')]);router[_0x0ccf('0x6')]('/:id/verify',auth[_0x0ccf('0x7')](),controller['verifySmtp']);router[_0x0ccf('0x6')](_0x0ccf('0x15'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x16')]);router['post'](_0x0ccf('0xa'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x17')]);router['post'](_0x0ccf('0xb'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x18')]);router[_0x0ccf('0x19')]('/',auth['isAuthenticated'](),controller[_0x0ccf('0x1a')]);router[_0x0ccf('0x19')](_0x0ccf('0xd'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x1b')]);router[_0x0ccf('0x19')]('/:id/out_servers',auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x1c')]);router[_0x0ccf('0x19')](_0x0ccf('0x10'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x1d')]);router['post']('/:id/applications',auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x1e')]);router['post'](_0x0ccf('0x1f'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x20')]);router[_0x0ccf('0x19')](_0x0ccf('0x15'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x21')]);router[_0x0ccf('0x22')]('/:id',auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x23')]);router[_0x0ccf('0x24')](_0x0ccf('0xa'),auth['isAuthenticated'](),controller[_0x0ccf('0x25')]);router['delete'](_0x0ccf('0xb'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x26')]);router[_0x0ccf('0x24')](_0x0ccf('0xd'),auth['isAuthenticated'](),controller[_0x0ccf('0x27')]);router[_0x0ccf('0x24')](_0x0ccf('0xf'),auth['isAuthenticated'](),controller[_0x0ccf('0x28')]);router[_0x0ccf('0x24')](_0x0ccf('0x9'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x29')]);router[_0x0ccf('0x24')](_0x0ccf('0x15'),auth[_0x0ccf('0x7')](),controller[_0x0ccf('0x2a')]);module[_0x0ccf('0x2b')]=router; \ No newline at end of file +var _0xeb8e=['/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeImap','destroy','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getSmtp'];(function(_0x4859ff,_0x1b0362){var _0x446603=function(_0x4d81a8){while(--_0x4d81a8){_0x4859ff['push'](_0x4859ff['shift']());}};_0x446603(++_0x1b0362);}(_0xeb8e,0x17a));var _0xeeb8=function(_0x5705dd,_0xbcafd2){_0x5705dd=_0x5705dd-0x0;var _0x3b492e=_0xeb8e[_0x5705dd];return _0x3b492e;};'use strict';var multer=require(_0xeeb8('0x0'));var util=require('util');var path=require(_0xeeb8('0x1'));var timeout=require(_0xeeb8('0x2'));var express=require(_0xeeb8('0x3'));var router=express['Router']();var auth=require(_0xeeb8('0x4'));var interaction=require(_0xeeb8('0x5'));var config=require(_0xeeb8('0x6'));var controller=require(_0xeeb8('0x7'));router[_0xeeb8('0x8')]('/',auth[_0xeeb8('0x9')](),controller[_0xeeb8('0xa')]);router['get']('/describe',auth[_0xeeb8('0x9')](),controller['describe']);router[_0xeeb8('0x8')](_0xeeb8('0xb'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0xc')]);router['get'](_0xeeb8('0xd'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0xe')]);router[_0xeeb8('0x8')](_0xeeb8('0xf'),auth[_0xeeb8('0x9')](),controller['getAnswers']);router[_0xeeb8('0x8')](_0xeeb8('0x10'),auth[_0xeeb8('0x9')](),controller['getImap']);router[_0xeeb8('0x8')]('/:id/out_servers',auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x11')]);router[_0xeeb8('0x8')](_0xeeb8('0x12'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x13')]);router[_0xeeb8('0x8')](_0xeeb8('0x14'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x15')]);router[_0xeeb8('0x8')](_0xeeb8('0x16'),auth['isAuthenticated'](),controller[_0xeeb8('0x17')]);router[_0xeeb8('0x8')](_0xeeb8('0x18'),auth[_0xeeb8('0x9')](),controller['verifySmtp']);router['get'](_0xeeb8('0x19'),auth[_0xeeb8('0x9')](),controller['getAgents']);router[_0xeeb8('0x1a')](_0xeeb8('0xd'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x1b')]);router[_0xeeb8('0x1a')](_0xeeb8('0xf'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x1c')]);router[_0xeeb8('0x1a')]('/',auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x1d')]);router[_0xeeb8('0x1a')](_0xeeb8('0x10'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x1e')]);router[_0xeeb8('0x1a')](_0xeeb8('0x1f'),auth[_0xeeb8('0x9')](),controller['addSmtp']);router[_0xeeb8('0x1a')](_0xeeb8('0x12'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x20')]);router[_0xeeb8('0x1a')](_0xeeb8('0x14'),auth['isAuthenticated'](),controller[_0xeeb8('0x21')]);router['post'](_0xeeb8('0x22'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x23')]);router[_0xeeb8('0x1a')](_0xeeb8('0x19'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x24')]);router[_0xeeb8('0x25')](_0xeeb8('0xb'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x26')]);router[_0xeeb8('0x27')](_0xeeb8('0xd'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x28')]);router[_0xeeb8('0x27')](_0xeeb8('0xf'),auth[_0xeeb8('0x9')](),controller['removeAnswers']);router[_0xeeb8('0x27')](_0xeeb8('0x10'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x29')]);router[_0xeeb8('0x27')](_0xeeb8('0x1f'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0xeeb8('0x27')](_0xeeb8('0xb'),auth['isAuthenticated'](),controller[_0xeeb8('0x2a')]);router['delete'](_0xeeb8('0x19'),auth[_0xeeb8('0x9')](),controller[_0xeeb8('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 7919f7d..d3ef954 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 _0x6851=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x571b40,_0x5cdaef){var _0xa370f8=function(_0x1aa09a){while(--_0x1aa09a){_0x571b40['push'](_0x571b40['shift']());}};_0xa370f8(++_0x5cdaef);}(_0x6851,0x138));var _0x1685=function(_0x57faba,_0x4b9d70){_0x57faba=_0x57faba-0x0;var _0x18236f=_0x6851[_0x57faba];return _0x18236f;};'use strict';var Sequelize=require(_0x1685('0x0'));module[_0x1685('0x1')]={'description':{'type':Sequelize[_0x1685('0x2')]},'name':{'type':Sequelize[_0x1685('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x1685('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1685('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1685('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x1685('0x4')]},'markAsUnread':{'type':Sequelize[_0x1685('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1685('0x2')],'allowNull':![],'defaultValue':_0x1685('0x5')},'fontSize':{'type':Sequelize[_0x1685('0x6')](0x2)[_0x1685('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1685('0x4')],'defaultValue':function(){return _0x1685('0x8');}},'notificationSound':{'type':Sequelize[_0x1685('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1685('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1685('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1685('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1685('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1685('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x1685('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x511e5){if(!_0x511e5)this['setDataValue'](_0x1685('0xa'),null);this[_0x1685('0xb')](_0x1685('0xc'),_0x511e5);}}}; \ No newline at end of file +var _0xc06a=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED'];(function(_0x4b9dc9,_0x14b3a2){var _0x57b302=function(_0x4f99ff){while(--_0x4f99ff){_0x4b9dc9['push'](_0x4b9dc9['shift']());}};_0x57b302(++_0x14b3a2);}(_0xc06a,0x193));var _0xac06=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc06a[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0xac06('0x0'));module[_0xac06('0x1')]={'description':{'type':Sequelize[_0xac06('0x2')]},'name':{'type':Sequelize[_0xac06('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xac06('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xac06('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xac06('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xac06('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xac06('0x4')]},'markAsUnread':{'type':Sequelize[_0xac06('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xac06('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xac06('0x5')](0x2)[_0xac06('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xac06('0x4')],'defaultValue':function(){return _0xac06('0x7');}},'notificationSound':{'type':Sequelize[_0xac06('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xac06('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xac06('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xac06('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xac06('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xac06('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xac06('0x3')],'defaultValue':![],'comment':_0xac06('0x8'),'set':function(_0x1d71d2){if(!_0x1d71d2)this['setDataValue'](_0xac06('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x1d71d2);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4445111..b48f5a5 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 _0x47c7=['User','fullname','internal','Tags','color','tag','addApplications','MailApplication','findAndCountAll','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','auth','secure','SendMail','sendMail','List\x20not\x20found','defaults','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','get','MailAccounts','UserProfileResource','end','stack','name','send','index','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','params','Smtp','length','find','update','body','describe','MailAccountId','create','getDispositions','findOne','Disposition','nolimit','filter','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','email','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','port','host','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','getImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x47c7,0x1ab));var _0x747c=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x47c7[_0x34ad72];return _0x5c9aa8;};'use strict';var pdf=require(_0x747c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x747c('0x1'));var zipdir=require(_0x747c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x747c('0x3'));var moment=require(_0x747c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x747c('0x5'));var util=require(_0x747c('0x6'));var path=require(_0x747c('0x7'));var sox=require(_0x747c('0x8'));var csv=require('to-csv');var ejs=require(_0x747c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x747c('0xa'));var crypto=require(_0x747c('0xb'));var jsforce=require(_0x747c('0xc'));var deskjs=require(_0x747c('0xd'));var toCsv=require(_0x747c('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x747c('0xf'));var hardwareService=require(_0x747c('0x10'));var Redis=require(_0x747c('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x747c('0x12'))(_0x747c('0x13'));var utils=require(_0x747c('0x14'));var config=require('../../config/environment');var db=require(_0x747c('0x15'))['db'];config['redis']=_['defaults'](config[_0x747c('0x16')],{'host':_0x747c('0x17'),'port':0x18eb});var socket=require(_0x747c('0x18'))(new Redis(config[_0x747c('0x16')]));require(_0x747c('0x19'))[_0x747c('0x1a')](socket);var jayson=require(_0x747c('0x1b'));var client=jayson[_0x747c('0x1c')][_0x747c('0x1d')]({'port':0x232b});function respondWithRpcPromise(_0x428660,_0x4f98ac,_0x54a895,_0x2575f7){return new BPromise(function(_0x34ffd3,_0x6f79a1){var _0x5caaad=_0x2575f7||client;return _0x5caaad[_0x747c('0x1e')](_0x428660,_0x54a895)[_0x747c('0x1f')](function(_0x456ca0){logger[_0x747c('0x20')](_0x747c('0x21'),_0x4f98ac,_0x747c('0x22'));logger['debug'](_0x747c('0x23'),_0x4f98ac,'request\x20sent',JSON[_0x747c('0x24')](_0x456ca0));if(_0x456ca0[_0x747c('0x25')]){if(_0x456ca0[_0x747c('0x25')]['code']===0x1f4){logger[_0x747c('0x25')](_0x747c('0x21'),_0x4f98ac,_0x456ca0[_0x747c('0x25')][_0x747c('0x26')]);return _0x6f79a1(_0x456ca0[_0x747c('0x25')][_0x747c('0x26')]);}logger[_0x747c('0x25')](_0x747c('0x21'),_0x4f98ac,_0x456ca0[_0x747c('0x25')][_0x747c('0x26')]);return _0x34ffd3(_0x456ca0[_0x747c('0x25')][_0x747c('0x26')]);}else{logger['info'](_0x747c('0x21'),_0x4f98ac,'request\x20sent');_0x34ffd3(_0x456ca0[_0x747c('0x27')][_0x747c('0x26')]);}})[_0x747c('0x28')](function(_0x23a458){logger['error']('MailAccount,\x20%s,\x20%s',_0x4f98ac,_0x23a458);_0x6f79a1(_0x23a458);});});}function respondWithStatusCode(_0xb20a10,_0x3e4df7){_0x3e4df7=_0x3e4df7||0xcc;return function(_0x20588d){if(_0x20588d){return _0xb20a10[_0x747c('0x29')](_0x3e4df7);}return _0xb20a10[_0x747c('0x2a')](_0x3e4df7)['end']();};}function respondWithResult(_0x235691,_0x29cb6f){_0x29cb6f=_0x29cb6f||0xc8;return function(_0x849be3){if(_0x849be3){return _0x235691['status'](_0x29cb6f)[_0x747c('0x2b')](_0x849be3);}};}function respondWithFilteredResult(_0x5c16cb,_0x12fb80){return function(_0xefedcd){if(_0xefedcd){var _0x12d799=_0xefedcd[_0x747c('0x2c')],_0xec4098=_0x12fb80[_0x747c('0x2d')],_0x188682=_0x12fb80[_0x747c('0x2d')]+_0x12fb80['limit'],_0x4161f0;if(_0x188682>=_0x12d799){_0x188682=_0x12d799;_0x4161f0=0xc8;}else{_0x4161f0=0xce;}_0x5c16cb[_0x747c('0x2a')](_0x4161f0);return _0x5c16cb[_0x747c('0x2e')](_0x747c('0x2f'),_0xec4098+'-'+_0x188682+'/'+_0x12d799)[_0x747c('0x2b')](_0xefedcd);}return null;};}function patchUpdates(_0xe78dca){return function(_0x3e0c6f){try{jsonpatch[_0x747c('0x30')](_0x3e0c6f,_0xe78dca,!![]);}catch(_0x4091bd){return BPromise[_0x747c('0x31')](_0x4091bd);}return _0x3e0c6f[_0x747c('0x32')]();};}function saveUpdates(_0x4a2682,_0x58e566){return function(_0x461dfa){if(_0x461dfa){return _0x461dfa['update'](_0x4a2682)['then'](function(_0x596246){return _0x596246;});}return null;};}function removeEntity(_0x5af2f0,_0x26abf1){return function(_0x3ee75f){if(_0x3ee75f){return _0x3ee75f[_0x747c('0x33')]()[_0x747c('0x1f')](function(){var _0x50f60d=_0x3ee75f[_0x747c('0x34')]({'plain':!![]});var _0x22a86e=_0x747c('0x35');return db[_0x747c('0x36')][_0x747c('0x33')]({'where':{'type':_0x22a86e,'resourceId':_0x50f60d['id']}})['then'](function(){return _0x3ee75f;});})[_0x747c('0x1f')](function(){_0x5af2f0[_0x747c('0x2a')](0xcc)[_0x747c('0x37')]();});}};}function handleEntityNotFound(_0x3d2101,_0x2e112a){return function(_0x3be54a){if(!_0x3be54a){_0x3d2101[_0x747c('0x29')](0x194);}return _0x3be54a;};}function handleError(_0xfe5e14,_0x4c84c4){_0x4c84c4=_0x4c84c4||0x1f4;return function(_0x4f0439){logger[_0x747c('0x25')](_0x4f0439[_0x747c('0x38')]);if(_0x4f0439[_0x747c('0x39')]){delete _0x4f0439['name'];}_0xfe5e14['status'](_0x4c84c4)[_0x747c('0x3a')](_0x4f0439);};}exports[_0x747c('0x3b')]=function(_0x578980,_0x5e540a){var _0x3b2f62={'include':[{'model':db[_0x747c('0x3c')],'as':_0x747c('0x3d')},{'model':db[_0x747c('0x3e')],'as':'Smtp'},{'model':db[_0x747c('0x3f')],'as':_0x747c('0x40')}]},_0x3c571b={},_0x10db96={'count':0x0,'rows':[]};var _0x45edba=db[_0x747c('0x41')][_0x747c('0x42')];_0x3c571b[_0x747c('0x43')]=_[_0x747c('0x44')](_0x45edba);_0x3c571b[_0x747c('0x45')]=_[_0x747c('0x44')](_0x578980[_0x747c('0x45')]);_0x3c571b[_0x747c('0x46')]=_['intersection'](_0x3c571b[_0x747c('0x43')],_0x3c571b[_0x747c('0x45')]);_0x3b2f62['attributes']=_[_0x747c('0x47')](_0x3c571b[_0x747c('0x43')],qs[_0x747c('0x48')](_0x578980[_0x747c('0x45')][_0x747c('0x48')]));_0x3b2f62['attributes']=_0x3b2f62[_0x747c('0x49')]['length']?_0x3b2f62[_0x747c('0x49')]:_0x3c571b['model'];if(!_0x578980['query'][_0x747c('0x4a')]('nolimit')){_0x3b2f62[_0x747c('0x4b')]=qs[_0x747c('0x4b')](_0x578980['query']['limit']);_0x3b2f62[_0x747c('0x2d')]=qs[_0x747c('0x2d')](_0x578980[_0x747c('0x45')][_0x747c('0x2d')]);}_0x3b2f62[_0x747c('0x4c')]=qs[_0x747c('0x4d')](_0x578980[_0x747c('0x45')][_0x747c('0x4d')]);_0x3b2f62[_0x747c('0x4e')]=qs[_0x747c('0x46')](_[_0x747c('0x4f')](_0x578980[_0x747c('0x45')],_0x3c571b['filters']));if(_0x578980[_0x747c('0x45')]['filter']){_0x3b2f62[_0x747c('0x4e')]=_[_0x747c('0x50')](_0x3b2f62['where'],{'$or':_[_0x747c('0x51')](_0x45edba,function(_0x4f9578){if(_0x4f9578['type'][_0x747c('0x52')]!==_0x747c('0x53')){var _0x4adf9f={};_0x4adf9f[_0x4f9578[_0x747c('0x54')]]={'$like':'%'+_0x578980[_0x747c('0x45')]['filter']+'%'};return _0x4adf9f;}})});}_0x3b2f62=_[_0x747c('0x50')]({},_0x3b2f62,_0x578980[_0x747c('0x55')]);var _0x39df61={'where':_0x3b2f62[_0x747c('0x4e')]};return db[_0x747c('0x41')][_0x747c('0x2c')](_0x39df61)[_0x747c('0x1f')](function(_0x5db425){_0x10db96[_0x747c('0x2c')]=_0x5db425;if(_0x578980['query'][_0x747c('0x56')]){_0x3b2f62[_0x747c('0x57')]=[{'all':!![]}];}return db[_0x747c('0x41')][_0x747c('0x58')](_0x3b2f62);})[_0x747c('0x1f')](function(_0x53914d){_0x10db96[_0x747c('0x59')]=_0x53914d;return _0x10db96;})[_0x747c('0x1f')](respondWithFilteredResult(_0x5e540a,_0x3b2f62))[_0x747c('0x28')](handleError(_0x5e540a,null));};exports['show']=function(_0x2418d3,_0x3f5093){var _0x4523a9={'raw':![],'where':{'id':_0x2418d3[_0x747c('0x5a')]['id']},'include':[{'model':db[_0x747c('0x3c')],'as':_0x747c('0x3d')},{'model':db[_0x747c('0x3e')],'as':_0x747c('0x5b')},{'model':db['Pause'],'as':_0x747c('0x40')}]},_0x2c598c={};_0x2c598c[_0x747c('0x43')]=_[_0x747c('0x44')](db[_0x747c('0x41')][_0x747c('0x42')]);_0x2c598c['query']=_[_0x747c('0x44')](_0x2418d3['query']);_0x2c598c[_0x747c('0x46')]=_[_0x747c('0x47')](_0x2c598c[_0x747c('0x43')],_0x2c598c[_0x747c('0x45')]);_0x4523a9[_0x747c('0x49')]=_[_0x747c('0x47')](_0x2c598c['model'],qs['fields'](_0x2418d3[_0x747c('0x45')][_0x747c('0x48')]));_0x4523a9[_0x747c('0x49')]=_0x4523a9[_0x747c('0x49')][_0x747c('0x5c')]?_0x4523a9['attributes']:_0x2c598c[_0x747c('0x43')];if(_0x2418d3[_0x747c('0x45')][_0x747c('0x56')]){_0x4523a9[_0x747c('0x57')]=[{'all':!![]}];}_0x4523a9=_['merge']({},_0x4523a9,_0x2418d3['options']);return db[_0x747c('0x41')][_0x747c('0x5d')](_0x4523a9)[_0x747c('0x1f')](handleEntityNotFound(_0x3f5093,null))['then'](respondWithResult(_0x3f5093,null))[_0x747c('0x28')](handleError(_0x3f5093,null));};exports[_0x747c('0x5e')]=function(_0x502965,_0x19ee24){if(_0x502965[_0x747c('0x5f')]['id']){delete _0x502965[_0x747c('0x5f')]['id'];}return db[_0x747c('0x41')][_0x747c('0x5d')]({'where':{'id':_0x502965[_0x747c('0x5a')]['id']},'include':[{'model':db[_0x747c('0x3c')],'as':_0x747c('0x3d')},{'model':db[_0x747c('0x3e')],'as':_0x747c('0x5b')},{'model':db[_0x747c('0x3f')],'as':_0x747c('0x40')}]})[_0x747c('0x1f')](handleEntityNotFound(_0x19ee24,null))[_0x747c('0x1f')](saveUpdates(_0x502965['body'],null))[_0x747c('0x1f')](function(_0x1d7447){if(_0x1d7447&&_0x502965[_0x747c('0x5f')][_0x747c('0x3d')]){return db[_0x747c('0x3c')][_0x747c('0x5e')](_0x502965[_0x747c('0x5f')][_0x747c('0x3d')],{'where':{'MailAccountId':_0x1d7447['id']}})[_0x747c('0x1f')](function(){return _0x1d7447;});}return _0x1d7447;})[_0x747c('0x1f')](function(_0x485506){if(_0x485506&&_0x502965[_0x747c('0x5f')][_0x747c('0x5b')]){return db[_0x747c('0x3e')][_0x747c('0x5e')](_0x502965[_0x747c('0x5f')][_0x747c('0x5b')],{'where':{'MailAccountId':_0x485506['id']}})[_0x747c('0x1f')](function(){return _0x485506;});}return _0x485506;})[_0x747c('0x1f')](respondWithResult(_0x19ee24,null))[_0x747c('0x28')](handleError(_0x19ee24,null));};exports[_0x747c('0x60')]=function(_0xb9cee5,_0x54c11b){return db[_0x747c('0x41')][_0x747c('0x60')]()[_0x747c('0x1f')](respondWithResult(_0x54c11b,null))[_0x747c('0x28')](handleError(_0x54c11b,null));};exports['addDisposition']=function(_0x14c1ef,_0x4b105f,_0x5be420){if(_0x14c1ef[_0x747c('0x5f')]['id']){delete _0x14c1ef[_0x747c('0x5f')]['id'];}return db[_0x747c('0x41')][_0x747c('0x5d')]({'where':{'id':_0x14c1ef[_0x747c('0x5a')]['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x4b105f,null))[_0x747c('0x1f')](function(_0x242844){if(_0x242844){_0x14c1ef['body'][_0x747c('0x61')]=_0x242844['id'];return db['Disposition'][_0x747c('0x62')](_0x14c1ef[_0x747c('0x5f')]);}})[_0x747c('0x1f')](respondWithResult(_0x4b105f,null))[_0x747c('0x28')](handleError(_0x4b105f,null));};exports[_0x747c('0x63')]=function(_0x33cb78,_0x5cb6ac,_0x176f2b){var _0x4eda07={'raw':![],'where':{}};var _0x62f5a1={};var _0x3c4b34={'count':0x0,'rows':[]};return db[_0x747c('0x41')][_0x747c('0x64')]({'where':{'id':_0x33cb78['params']['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x5cb6ac,null))[_0x747c('0x1f')](function(_0x2cf749){if(_0x2cf749){_0x62f5a1[_0x747c('0x43')]=_['keys'](db[_0x747c('0x65')][_0x747c('0x42')]);_0x62f5a1[_0x747c('0x45')]=_[_0x747c('0x44')](_0x33cb78[_0x747c('0x45')]);_0x62f5a1[_0x747c('0x46')]=_[_0x747c('0x47')](_0x62f5a1[_0x747c('0x43')],_0x62f5a1['query']);_0x4eda07[_0x747c('0x49')]=_[_0x747c('0x47')](_0x62f5a1[_0x747c('0x43')],qs['fields'](_0x33cb78['query'][_0x747c('0x48')]));_0x4eda07[_0x747c('0x49')]=_0x4eda07[_0x747c('0x49')][_0x747c('0x5c')]?_0x4eda07['attributes']:_0x62f5a1[_0x747c('0x43')];if(!_0x33cb78[_0x747c('0x45')][_0x747c('0x4a')](_0x747c('0x66'))){_0x4eda07['limit']=qs[_0x747c('0x4b')](_0x33cb78[_0x747c('0x45')][_0x747c('0x4b')]);_0x4eda07[_0x747c('0x2d')]=qs['offset'](_0x33cb78['query']['offset']);}_0x4eda07['order']=qs[_0x747c('0x4d')](_0x33cb78[_0x747c('0x45')][_0x747c('0x4d')]);_0x4eda07['where']=qs[_0x747c('0x46')](_[_0x747c('0x4f')](_0x33cb78[_0x747c('0x45')],_0x62f5a1[_0x747c('0x46')]));_0x4eda07[_0x747c('0x4e')][_0x747c('0x61')]=_0x2cf749['id'];if(_0x33cb78[_0x747c('0x45')][_0x747c('0x67')]){_0x4eda07['where']=_[_0x747c('0x50')](_0x4eda07[_0x747c('0x4e')],{'$or':_[_0x747c('0x51')](_0x4eda07[_0x747c('0x49')],function(_0x166f3f){var _0x46b9f7={};_0x46b9f7[_0x166f3f]={'$like':'%'+_0x33cb78[_0x747c('0x45')]['filter']+'%'};return _0x46b9f7;})});}_0x4eda07=_[_0x747c('0x50')]({},_0x4eda07,_0x33cb78[_0x747c('0x55')]);return db[_0x747c('0x65')][_0x747c('0x2c')]({'where':_0x4eda07['where']})['then'](function(_0x25bf4c){_0x3c4b34[_0x747c('0x2c')]=_0x25bf4c;if(_0x33cb78[_0x747c('0x45')][_0x747c('0x56')]){_0x4eda07[_0x747c('0x57')]=[{'all':!![]}];}return db[_0x747c('0x65')][_0x747c('0x58')](_0x4eda07);})[_0x747c('0x1f')](function(_0x2deb5f){_0x3c4b34[_0x747c('0x59')]=_0x2deb5f;return _0x3c4b34;});}})[_0x747c('0x1f')](respondWithFilteredResult(_0x5cb6ac,_0x4eda07))[_0x747c('0x28')](handleError(_0x5cb6ac,null));};exports[_0x747c('0x68')]=function(_0x11b45d,_0x31c015,_0x17cf52){var _0xdf308d;return db[_0x747c('0x41')]['find']({'where':{'id':_0x11b45d[_0x747c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x31c015,null))[_0x747c('0x1f')](function(_0xed8ebc){if(_0xed8ebc){return _0xed8ebc[_0x747c('0x68')](_0x11b45d[_0x747c('0x45')]['ids']);}})[_0x747c('0x1f')](respondWithStatusCode(_0x31c015,null))[_0x747c('0x28')](handleError(_0x31c015,null));};exports[_0x747c('0x69')]=function(_0x506ea6,_0x25b1a7,_0x1ce7c0){if(_0x506ea6[_0x747c('0x5f')]['id']){delete _0x506ea6[_0x747c('0x5f')]['id'];}return db['MailAccount'][_0x747c('0x5d')]({'where':{'id':_0x506ea6['params']['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x25b1a7,null))['then'](function(_0x3827f0){if(_0x3827f0){_0x506ea6[_0x747c('0x5f')]['MailAccountId']=_0x3827f0['id'];return db[_0x747c('0x6a')][_0x747c('0x62')](_0x506ea6[_0x747c('0x5f')]);}})[_0x747c('0x1f')](respondWithResult(_0x25b1a7,null))['catch'](handleError(_0x25b1a7,null));};exports[_0x747c('0x6b')]=function(_0xbb2bae,_0x1b7364,_0x5c5023){var _0x2706b2={'raw':![],'where':{}};var _0x227c3c={};var _0x1f26a2={'count':0x0,'rows':[]};return db[_0x747c('0x41')][_0x747c('0x64')]({'where':{'id':_0xbb2bae[_0x747c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1b7364,null))[_0x747c('0x1f')](function(_0x285b90){if(_0x285b90){_0x227c3c['model']=_['keys'](db[_0x747c('0x6a')][_0x747c('0x42')]);_0x227c3c['query']=_[_0x747c('0x44')](_0xbb2bae[_0x747c('0x45')]);_0x227c3c[_0x747c('0x46')]=_[_0x747c('0x47')](_0x227c3c[_0x747c('0x43')],_0x227c3c[_0x747c('0x45')]);_0x2706b2[_0x747c('0x49')]=_[_0x747c('0x47')](_0x227c3c[_0x747c('0x43')],qs[_0x747c('0x48')](_0xbb2bae[_0x747c('0x45')][_0x747c('0x48')]));_0x2706b2[_0x747c('0x49')]=_0x2706b2[_0x747c('0x49')][_0x747c('0x5c')]?_0x2706b2[_0x747c('0x49')]:_0x227c3c[_0x747c('0x43')];if(!_0xbb2bae[_0x747c('0x45')][_0x747c('0x4a')](_0x747c('0x66'))){_0x2706b2[_0x747c('0x4b')]=qs[_0x747c('0x4b')](_0xbb2bae[_0x747c('0x45')][_0x747c('0x4b')]);_0x2706b2[_0x747c('0x2d')]=qs[_0x747c('0x2d')](_0xbb2bae[_0x747c('0x45')][_0x747c('0x2d')]);}_0x2706b2[_0x747c('0x4c')]=qs['sort'](_0xbb2bae['query']['sort']);_0x2706b2[_0x747c('0x4e')]=qs['filters'](_[_0x747c('0x4f')](_0xbb2bae['query'],_0x227c3c[_0x747c('0x46')]));_0x2706b2[_0x747c('0x4e')][_0x747c('0x61')]=_0x285b90['id'];if(_0xbb2bae[_0x747c('0x45')]['filter']){_0x2706b2[_0x747c('0x4e')]=_[_0x747c('0x50')](_0x2706b2[_0x747c('0x4e')],{'$or':_[_0x747c('0x51')](_0x2706b2[_0x747c('0x49')],function(_0x5e3e0a){var _0x5432d6={};_0x5432d6[_0x5e3e0a]={'$like':'%'+_0xbb2bae[_0x747c('0x45')][_0x747c('0x67')]+'%'};return _0x5432d6;})});}_0x2706b2=_[_0x747c('0x50')]({},_0x2706b2,_0xbb2bae[_0x747c('0x55')]);return db['CannedAnswer'][_0x747c('0x2c')]({'where':_0x2706b2[_0x747c('0x4e')]})[_0x747c('0x1f')](function(_0x59e35e){_0x1f26a2[_0x747c('0x2c')]=_0x59e35e;if(_0xbb2bae[_0x747c('0x45')][_0x747c('0x56')]){_0x2706b2['include']=[{'all':!![]}];}return db[_0x747c('0x6a')][_0x747c('0x58')](_0x2706b2);})[_0x747c('0x1f')](function(_0xcec3ec){_0x1f26a2[_0x747c('0x59')]=_0xcec3ec;return _0x1f26a2;});}})[_0x747c('0x1f')](respondWithFilteredResult(_0x1b7364,_0x2706b2))['catch'](handleError(_0x1b7364,null));};exports[_0x747c('0x6c')]=function(_0x2c49f8,_0x173dd6,_0x569ebf){var _0x271ddd;return db['MailAccount'][_0x747c('0x5d')]({'where':{'id':_0x2c49f8['params']['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x173dd6,null))[_0x747c('0x1f')](function(_0x460c35){if(_0x460c35){return _0x460c35['removeAnswers'](_0x2c49f8[_0x747c('0x45')][_0x747c('0x6d')]);}})[_0x747c('0x1f')](respondWithStatusCode(_0x173dd6,null))[_0x747c('0x28')](handleError(_0x173dd6,null));};exports[_0x747c('0x62')]=function(_0x15c0a5,_0x42249e){var _0x135372={'name':_0x15c0a5['body'][_0x747c('0x39')],'key':_0x15c0a5['body'][_0x747c('0x52')],'email':_0x15c0a5[_0x747c('0x5f')][_0x747c('0x6e')],'ListId':_0x15c0a5[_0x747c('0x5f')]['ListId'],'active':!_[_0x747c('0x6f')](_0x15c0a5[_0x747c('0x5f')][_0x747c('0x70')])?_0x15c0a5[_0x747c('0x5f')][_0x747c('0x70')]:!![],'description':_0x15c0a5['body'][_0x747c('0x71')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x15c0a5[_0x747c('0x5f')][_0x747c('0x72')])){if(_0x15c0a5[_0x747c('0x5f')][_0x747c('0x73')]){_0x135372[_0x747c('0x3d')][_0x747c('0x74')]=_0x135372[_0x747c('0x5b')][_0x747c('0x74')]=_0x15c0a5[_0x747c('0x5f')][_0x747c('0x75')];_0x135372[_0x747c('0x3d')][_0x747c('0x76')]=_0x135372[_0x747c('0x5b')][_0x747c('0x77')]=_0x15c0a5[_0x747c('0x5f')][_0x747c('0x78')];}else{_0x135372[_0x747c('0x3d')][_0x747c('0x79')]=_0x135372[_0x747c('0x5b')][_0x747c('0x79')]=![];}_0x135372[_0x747c('0x3d')]['host']=_0x15c0a5[_0x747c('0x5f')]['Imap']['host'];_0x135372[_0x747c('0x3d')]['port']=_0x15c0a5[_0x747c('0x5f')]['Imap'][_0x747c('0x7a')];_0x135372[_0x747c('0x5b')][_0x747c('0x7b')]=_0x15c0a5['body'][_0x747c('0x5b')][_0x747c('0x7b')];_0x135372['Smtp']['port']=_0x15c0a5['body'][_0x747c('0x5b')][_0x747c('0x7a')];}else{_0x135372[_0x747c('0x3d')][_0x747c('0x7c')]=_0x135372[_0x747c('0x5b')][_0x747c('0x7c')]=_0x15c0a5[_0x747c('0x5f')][_0x747c('0x72')];_0x135372[_0x747c('0x3d')]['user']=_0x135372['Smtp'][_0x747c('0x74')]=_0x15c0a5[_0x747c('0x5f')]['cuser'];_0x135372[_0x747c('0x3d')][_0x747c('0x76')]=_0x135372['Smtp']['pass']=_0x15c0a5[_0x747c('0x5f')]['cpassword'];}return db[_0x747c('0x41')]['create'](_0x135372,{'include':[{'model':db['MailServerOut'],'as':_0x747c('0x5b')},{'model':db[_0x747c('0x3c')],'as':_0x747c('0x3d')}]})[_0x747c('0x1f')](function(_0x331cc2){var _0x2ced4c=_0x15c0a5[_0x747c('0x74')][_0x747c('0x34')]({'plain':!![]});if(!_0x2ced4c)throw new Error(_0x747c('0x7d'));if(_0x2ced4c[_0x747c('0x7e')]===_0x747c('0x74')){var _0x345ac4=_0x331cc2[_0x747c('0x34')]({'plain':!![]});return db['UserProfileSection'][_0x747c('0x5d')]({'where':{'name':'MailAccounts','userProfileId':_0x2ced4c[_0x747c('0x7f')]},'raw':!![]})[_0x747c('0x1f')](function(_0x181680){if(_0x181680&&_0x181680[_0x747c('0x80')]===0x0){return db[_0x747c('0x36')][_0x747c('0x62')]({'name':_0x345ac4['name'],'resourceId':_0x345ac4['id'],'type':_0x181680['name'],'sectionId':_0x181680['id']},{})[_0x747c('0x1f')](function(){return _0x331cc2;});}else{return _0x331cc2;}})['catch'](function(_0x1c134a){logger[_0x747c('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c134a);throw _0x1c134a;});}return _0x331cc2;})[_0x747c('0x1f')](respondWithResult(_0x42249e,0xc9))[_0x747c('0x28')](handleError(_0x42249e,null));};exports[_0x747c('0x81')]=function(_0x2bbc91,_0x52b981,_0x473113){return db[_0x747c('0x41')][_0x747c('0x64')]({'where':{'id':_0x2bbc91['params']['id']}})['then'](handleEntityNotFound(_0x52b981,null))['then'](function(_0xafbf78){if(_0xafbf78){return _0xafbf78[_0x747c('0x81')]();}return null;})[_0x747c('0x1f')](respondWithResult(_0x52b981,null))[_0x747c('0x28')](handleError(_0x52b981,null));};exports['addImap']=function(_0x3ba038,_0x17899e,_0xe4199e){if(_0x3ba038[_0x747c('0x5f')]['id']){delete _0x3ba038['body']['id'];}return db[_0x747c('0x41')][_0x747c('0x5d')]({'where':{'id':_0x3ba038[_0x747c('0x5a')]['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x17899e,null))[_0x747c('0x1f')](function(_0x56790a){if(_0x56790a){_0x3ba038[_0x747c('0x5f')][_0x747c('0x61')]=_0x56790a['id'];return db[_0x747c('0x3c')]['create'](_0x3ba038[_0x747c('0x5f')]);}})[_0x747c('0x1f')](respondWithResult(_0x17899e,null))[_0x747c('0x28')](handleError(_0x17899e,null));};exports[_0x747c('0x82')]=function(_0x297776,_0x1c5e10,_0xc78be7){return db[_0x747c('0x41')]['findOne']({'where':{'id':_0x297776[_0x747c('0x5a')]['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x1c5e10,null))[_0x747c('0x1f')](function(_0x5c179b){if(_0x5c179b){return _0x5c179b['setImap'](null);}return null;})[_0x747c('0x1f')](respondWithStatusCode(_0x1c5e10,null))[_0x747c('0x28')](handleError(_0x1c5e10,null));};exports['getSmtp']=function(_0x15b4a1,_0x59fdeb,_0x21dd0f){return db[_0x747c('0x41')]['findOne']({'where':{'id':_0x15b4a1['params']['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x59fdeb,null))[_0x747c('0x1f')](function(_0x543ea3){if(_0x543ea3){return _0x543ea3[_0x747c('0x83')]();}return null;})[_0x747c('0x1f')](respondWithResult(_0x59fdeb,null))[_0x747c('0x28')](handleError(_0x59fdeb,null));};exports[_0x747c('0x84')]=function(_0x280d49,_0x11e63f,_0x17ead8){if(_0x280d49[_0x747c('0x5f')]['id']){delete _0x280d49[_0x747c('0x5f')]['id'];}return db['MailAccount'][_0x747c('0x5d')]({'where':{'id':_0x280d49[_0x747c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x11e63f,null))[_0x747c('0x1f')](function(_0x5cea20){if(_0x5cea20){_0x280d49[_0x747c('0x5f')][_0x747c('0x61')]=_0x5cea20['id'];return db['MailServerOut'][_0x747c('0x62')](_0x280d49[_0x747c('0x5f')]);}})[_0x747c('0x1f')](respondWithResult(_0x11e63f,null))[_0x747c('0x28')](handleError(_0x11e63f,null));};exports['removeSmtp']=function(_0x36c443,_0x1cd2b8,_0x9a1af9){return db['MailAccount'][_0x747c('0x64')]({'where':{'id':_0x36c443[_0x747c('0x5a')]['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x1cd2b8,null))[_0x747c('0x1f')](function(_0x31b84d){if(_0x31b84d){return _0x31b84d[_0x747c('0x85')](null);}return null;})[_0x747c('0x1f')](respondWithStatusCode(_0x1cd2b8,null))[_0x747c('0x28')](handleError(_0x1cd2b8,null));};exports[_0x747c('0x86')]=function(_0x5ede94,_0x359423,_0x4b030c){return db[_0x747c('0x87')][_0x747c('0x5d')]({'where':{'id':_0x5ede94[_0x747c('0x5a')]['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x359423,null))[_0x747c('0x1f')](function(_0x1c10d9){if(_0x1c10d9){return _0x1c10d9['addInteraction'](_0x5ede94[_0x747c('0x5f')][_0x747c('0x6d')],_[_0x747c('0x88')](_0x5ede94[_0x747c('0x5f')],[_0x747c('0x6d'),'id'])||{});}})[_0x747c('0x1f')](respondWithResult(_0x359423,null))[_0x747c('0x28')](handleError(_0x359423,null));};exports[_0x747c('0x89')]=function(_0x3c52bf,_0x435c64,_0x3db810){var _0x595102={'raw':![],'where':{}};var _0x19a01e={};var _0x19c0b1={'count':0x0,'rows':[]};return db[_0x747c('0x41')][_0x747c('0x64')]({'where':{'id':_0x3c52bf['params']['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x435c64,null))[_0x747c('0x1f')](function(_0x5ac215){if(_0x5ac215){_0x19a01e[_0x747c('0x43')]=_['keys'](db[_0x747c('0x87')][_0x747c('0x42')]);_0x19a01e[_0x747c('0x45')]=_['keys'](_0x3c52bf[_0x747c('0x45')]);_0x19a01e['filters']=_[_0x747c('0x47')](_0x19a01e[_0x747c('0x43')],_0x19a01e[_0x747c('0x45')]);_0x595102[_0x747c('0x49')]=_['intersection'](_0x19a01e[_0x747c('0x43')],qs[_0x747c('0x48')](_0x3c52bf['query'][_0x747c('0x48')]));_0x595102['attributes']=_0x595102['attributes'][_0x747c('0x5c')]?_0x595102['attributes']:_0x19a01e[_0x747c('0x43')];if(!_0x3c52bf[_0x747c('0x45')][_0x747c('0x4a')](_0x747c('0x66'))){_0x595102[_0x747c('0x4b')]=qs['limit'](_0x3c52bf[_0x747c('0x45')][_0x747c('0x4b')]);_0x595102['offset']=qs[_0x747c('0x2d')](_0x3c52bf[_0x747c('0x45')][_0x747c('0x2d')]);}_0x595102[_0x747c('0x4c')]=qs[_0x747c('0x4d')](_0x3c52bf['query']['sort']);_0x595102[_0x747c('0x4e')]=qs[_0x747c('0x46')](_[_0x747c('0x4f')](_0x3c52bf[_0x747c('0x45')],_0x19a01e['filters']));_0x595102[_0x747c('0x4e')][_0x747c('0x61')]=_0x5ac215['id'];if(_0x3c52bf[_0x747c('0x45')][_0x747c('0x67')]){_0x595102[_0x747c('0x4e')]=_[_0x747c('0x50')](_0x595102[_0x747c('0x4e')],{'$or':_[_0x747c('0x51')](_0x595102[_0x747c('0x49')],function(_0x34f238){var _0x3522f2={};_0x3522f2[_0x34f238]={'$like':'%'+_0x3c52bf[_0x747c('0x45')][_0x747c('0x67')]+'%'};return _0x3522f2;})});}_0x595102=_['merge']({},_0x595102,_0x3c52bf[_0x747c('0x55')]);return db['MailInteraction'][_0x747c('0x2c')]({'where':_0x595102['where']})['then'](function(_0x1e77ce){_0x19c0b1[_0x747c('0x2c')]=_0x1e77ce;if(_0x3c52bf['query'][_0x747c('0x56')]){_0x595102['include']=[{'model':db[_0x747c('0x8a')],'as':_0x747c('0x8b'),'required':![]},{'model':db[_0x747c('0x8c')],'as':'Owner','attributes':[_0x747c('0x39'),_0x747c('0x8d'),_0x747c('0x8e')],'required':![]},{'model':db['Tag'],'as':_0x747c('0x8f'),'attributes':['id','name',_0x747c('0x90')],'where':_0x3c52bf['query'][_0x747c('0x91')]?{'id':_0x3c52bf[_0x747c('0x45')][_0x747c('0x91')]}:undefined,'required':_0x3c52bf['query']['tag']?!![]:![]}];}return db[_0x747c('0x87')][_0x747c('0x58')](_0x595102);})[_0x747c('0x1f')](function(_0x40e93f){_0x19c0b1[_0x747c('0x59')]=_0x40e93f;return _0x19c0b1;});}})[_0x747c('0x1f')](respondWithFilteredResult(_0x435c64,_0x595102))[_0x747c('0x28')](handleError(_0x435c64,null));};exports[_0x747c('0x92')]=function(_0x5cfb8c,_0x29203c,_0x91037f){return db[_0x747c('0x41')][_0x747c('0x64')]({'where':{'id':_0x5cfb8c[_0x747c('0x5a')]['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x29203c,null))[_0x747c('0x1f')](function(_0x37eeaf){if(_0x37eeaf){return db['sequelize']['transaction'](function(_0x1c0b0c){return db['MailApplication'][_0x747c('0x33')]({'where':{'MailAccountId':_0x5cfb8c[_0x747c('0x5a')]['id']},'transaction':_0x1c0b0c})[_0x747c('0x1f')](function(_0x56b701){var _0x141bd2=_[_0x747c('0x51')](_0x5cfb8c['body'],function(_0x1da93d){_0x1da93d[_0x747c('0x61')]=_0x5cfb8c[_0x747c('0x5a')]['id'];return _0x1da93d;});return db[_0x747c('0x93')]['bulkCreate'](_0x141bd2,{'transaction':_0x1c0b0c});});})[_0x747c('0x1f')](function(){return db['MailApplication'][_0x747c('0x94')]({'where':{'MailAccountId':_0x5cfb8c['params']['id']},'order':'priority'});});}})[_0x747c('0x1f')](respondWithResult(_0x29203c,null))[_0x747c('0x28')](handleError(_0x29203c,null));};exports['getApplications']=function(_0x416d84,_0x398f82,_0x59c9ab){var _0x2d46aa={};var _0x40c4b4={};var _0x192d6f;var _0xa2a5de;return db['MailAccount'][_0x747c('0x64')]({'where':{'id':_0x416d84['params']['id']}})['then'](handleEntityNotFound(_0x398f82,null))[_0x747c('0x1f')](function(_0x444ae5){if(_0x444ae5){_0x192d6f=_0x444ae5;_0x40c4b4[_0x747c('0x43')]=_['keys'](db[_0x747c('0x93')][_0x747c('0x42')]);_0x40c4b4['query']=_[_0x747c('0x44')](_0x416d84[_0x747c('0x45')]);_0x40c4b4[_0x747c('0x46')]=_[_0x747c('0x47')](_0x40c4b4['model'],_0x40c4b4[_0x747c('0x45')]);_0x2d46aa['attributes']=_[_0x747c('0x47')](_0x40c4b4[_0x747c('0x43')],qs[_0x747c('0x48')](_0x416d84['query'][_0x747c('0x48')]));_0x2d46aa[_0x747c('0x49')]=_0x2d46aa[_0x747c('0x49')][_0x747c('0x5c')]?_0x2d46aa[_0x747c('0x49')]:_0x40c4b4[_0x747c('0x43')];_0x2d46aa[_0x747c('0x4c')]=qs[_0x747c('0x4d')](_0x416d84[_0x747c('0x45')][_0x747c('0x4d')]);_0x2d46aa[_0x747c('0x4e')]=qs['filters'](_[_0x747c('0x4f')](_0x416d84[_0x747c('0x45')],_0x40c4b4[_0x747c('0x46')]));if(_0x416d84[_0x747c('0x45')][_0x747c('0x67')]){_0x2d46aa[_0x747c('0x4e')]=_[_0x747c('0x50')](_0x2d46aa[_0x747c('0x4e')],{'$or':_['map'](_0x2d46aa[_0x747c('0x49')],function(_0x4ed9b6){var _0x5a8ead={};_0x5a8ead[_0x4ed9b6]={'$like':'%'+_0x416d84['query']['filter']+'%'};return _0x5a8ead;})});}_0x2d46aa=_[_0x747c('0x50')]({},_0x2d46aa,_0x416d84[_0x747c('0x55')]);return _0x192d6f[_0x747c('0x95')](_0x2d46aa);}})[_0x747c('0x1f')](function(_0x5599d0){if(_0x5599d0){_0xa2a5de=_0x5599d0[_0x747c('0x5c')];if(!_0x416d84[_0x747c('0x45')][_0x747c('0x4a')](_0x747c('0x66'))){_0x2d46aa['limit']=qs[_0x747c('0x4b')](_0x416d84['query'][_0x747c('0x4b')]);_0x2d46aa[_0x747c('0x2d')]=qs['offset'](_0x416d84[_0x747c('0x45')]['offset']);}return _0x192d6f[_0x747c('0x95')](_0x2d46aa);}})[_0x747c('0x1f')](function(_0x574d69){if(_0x574d69){return _0x574d69?{'count':_0xa2a5de,'rows':_0x574d69}:null;}})[_0x747c('0x1f')](respondWithResult(_0x398f82,null))[_0x747c('0x28')](handleError(_0x398f82,null));};exports[_0x747c('0x96')]=function(_0x59fbc6,_0x1c9dcd,_0x18251a){var _0x3fc6c5={'raw':!![],'where':{}};var _0x14f09c={};var _0x570f73={'count':0x0,'rows':[]};return db[_0x747c('0x41')]['findOne']({'where':{'id':_0x59fbc6[_0x747c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1c9dcd,null))['then'](function(_0x4dea43){if(_0x4dea43){_0x14f09c[_0x747c('0x43')]=_[_0x747c('0x44')](db[_0x747c('0x97')][_0x747c('0x42')]);_0x14f09c[_0x747c('0x45')]=_['keys'](_0x59fbc6['query']);_0x14f09c[_0x747c('0x46')]=_[_0x747c('0x47')](_0x14f09c[_0x747c('0x43')],_0x14f09c['query']);_0x3fc6c5[_0x747c('0x49')]=_[_0x747c('0x47')](_0x14f09c[_0x747c('0x43')],qs[_0x747c('0x48')](_0x59fbc6[_0x747c('0x45')][_0x747c('0x48')]));_0x3fc6c5[_0x747c('0x49')]=_0x3fc6c5[_0x747c('0x49')]['length']?_0x3fc6c5['attributes']:_0x14f09c[_0x747c('0x43')];if(!_0x59fbc6['query'][_0x747c('0x4a')](_0x747c('0x66'))){_0x3fc6c5[_0x747c('0x4b')]=qs['limit'](_0x59fbc6[_0x747c('0x45')][_0x747c('0x4b')]);_0x3fc6c5[_0x747c('0x2d')]=qs[_0x747c('0x2d')](_0x59fbc6[_0x747c('0x45')][_0x747c('0x2d')]);}_0x3fc6c5['order']=qs['sort'](_0x59fbc6[_0x747c('0x45')][_0x747c('0x4d')]);_0x3fc6c5['where']=qs['filters'](_[_0x747c('0x4f')](_0x59fbc6[_0x747c('0x45')],_0x14f09c[_0x747c('0x46')]));_0x3fc6c5[_0x747c('0x4e')][_0x747c('0x61')]=_0x4dea43['id'];if(_0x59fbc6[_0x747c('0x45')][_0x747c('0x67')]){_0x3fc6c5[_0x747c('0x4e')]=_[_0x747c('0x50')](_0x3fc6c5[_0x747c('0x4e')],{'$or':_[_0x747c('0x51')](_0x3fc6c5[_0x747c('0x49')],function(_0x39862b){var _0x276e6a={};_0x276e6a[_0x39862b]={'$like':'%'+_0x59fbc6[_0x747c('0x45')][_0x747c('0x67')]+'%'};return _0x276e6a;})});}if(_0x59fbc6['query'][_0x747c('0x98')]){var _0x153248=_0x59fbc6[_0x747c('0x45')][_0x747c('0x98')][_0x747c('0x99')](',');var _0x46bd6b={};_0x46bd6b[_0x153248[0x0]]={'$gte':moment(_0x153248[0x1])[_0x747c('0x9a')](_0x747c('0x9b'))};_0x3fc6c5[_0x747c('0x4e')]=_[_0x747c('0x50')](_0x3fc6c5[_0x747c('0x4e')],_0x46bd6b);}_0x3fc6c5=_[_0x747c('0x50')]({},_0x3fc6c5,_0x59fbc6[_0x747c('0x55')]);return db[_0x747c('0x97')][_0x747c('0x2c')]({'where':_0x3fc6c5[_0x747c('0x4e')]})[_0x747c('0x1f')](function(_0x531602){_0x570f73[_0x747c('0x2c')]=_0x531602;if(_0x59fbc6[_0x747c('0x45')]['includeAll']){_0x3fc6c5[_0x747c('0x57')]=[{'all':!![]}];}return db[_0x747c('0x97')][_0x747c('0x58')](_0x3fc6c5);})['then'](function(_0x914790){_0x570f73['rows']=_0x914790;return _0x570f73;});}})[_0x747c('0x1f')](respondWithFilteredResult(_0x1c9dcd,_0x3fc6c5))['catch'](handleError(_0x1c9dcd,null));};exports[_0x747c('0x3a')]=function(_0x284923,_0x330edb,_0x51b6c5){var _0x3ddfc4,_0x2b85e2={},_0x2fb8f1;if(_0x284923[_0x747c('0x5f')]['to']){_0x2fb8f1=_0x284923[_0x747c('0x5f')]['to'][_0x747c('0x99')](',')[0x0];}return db[_0x747c('0x41')]['find']({'where':{'id':_0x284923[_0x747c('0x5a')]['id']},'include':[{'model':db[_0x747c('0x9c')],'as':_0x747c('0x9d'),'include':[{'model':db[_0x747c('0x8a')],'as':_0x747c('0x9e'),'where':{'email':_0x2fb8f1},'limit':0x1,'order':[['updatedAt',_0x747c('0x9f')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x747c('0x1f')](handleEntityNotFound(_0x330edb,null))['then'](function(_0x97bb75){if(_0x97bb75){_0x3ddfc4=_0x97bb75;if(_0x97bb75[_0x747c('0x5b')]){if(_['isNil'](_0x284923[_0x747c('0x5f')][_0x747c('0xa0')])){_0x284923[_0x747c('0x5f')]['from']=util[_0x747c('0x9a')](_0x747c('0xa1'),_0x97bb75['name'],_0x97bb75[_0x747c('0x6e')]||_0x97bb75[_0x747c('0x5b')][_0x747c('0x74')]);}if(_0x284923[_0x747c('0x5f')][_0x747c('0xa2')]&&_0x284923['body']['attachments']['length']){for(var _0x6bf0a7=0x0;_0x6bf0a7<_0x284923['body'][_0x747c('0xa2')]['length'];_0x6bf0a7+=0x1){_0x284923[_0x747c('0x5f')][_0x747c('0xa2')][_0x6bf0a7]={'filename':_0x284923[_0x747c('0x5f')][_0x747c('0xa2')][_0x6bf0a7][_0x747c('0x39')],'path':path[_0x747c('0xa3')](config[_0x747c('0xa4')],_0x747c('0xa5'),_0x284923['body'][_0x747c('0xa2')][_0x6bf0a7]['basename'])};}}var _0x23f8af={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x97bb75[_0x747c('0x5b')][_0x747c('0x7c')])){if(_0x97bb75[_0x747c('0x5b')][_0x747c('0x79')]){_0x23f8af[_0x747c('0xa6')]={'user':_0x97bb75['Smtp']['user'],'pass':_0x97bb75['Smtp'][_0x747c('0x77')]};}_0x23f8af[_0x747c('0x7b')]=_0x97bb75[_0x747c('0x5b')][_0x747c('0x7b')];_0x23f8af[_0x747c('0x7a')]=_0x97bb75[_0x747c('0x5b')][_0x747c('0x7a')];_0x23f8af[_0x747c('0xa7')]=_0x97bb75['Smtp'][_0x747c('0xa7')];}else{_0x23f8af[_0x747c('0x7c')]=_0x97bb75[_0x747c('0x5b')][_0x747c('0x7c')];_0x23f8af[_0x747c('0xa6')]={'user':_0x97bb75[_0x747c('0x5b')][_0x747c('0x74')],'pass':_0x97bb75[_0x747c('0x5b')][_0x747c('0x77')]};}return respondWithRpcPromise(_0x747c('0xa8'),_0x747c('0xa9'),{'account':_0x23f8af,'message':_0x284923['body']});}else{throw new Error(_0x747c('0xaa'));}}})[_0x747c('0x1f')](function(_0x17c417){if(_0x17c417){_0x2b85e2=_0x17c417;if(_0x3ddfc4[_0x747c('0x9d')]){if(_0x3ddfc4[_0x747c('0x9d')][_0x747c('0x9e')][_0x747c('0x5c')]){return _0x3ddfc4[_0x747c('0x9d')]['Contacts'][0x0];}else{return db[_0x747c('0x8a')][_0x747c('0x62')](_[_0x747c('0xab')](_0x284923[_0x747c('0x5f')],{'firstName':_0x284923[_0x747c('0x5f')]['to'],'email':_0x284923[_0x747c('0x5f')]['to'],'phone':_0x284923['body']['to'],'ListId':_0x3ddfc4['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})[_0x747c('0x1f')](function(_0x118c41){if(_0x118c41){var _0x4a1c5a={'UserId':_0x284923[_0x747c('0x74')]['id'],'ContactId':_0x118c41['id'],'MailAccountId':_0x3ddfc4['id'],'inReplyTo':_0x2b85e2['messageId'],'to':_0x284923[_0x747c('0x5f')]['from'],'cc':_0x284923[_0x747c('0x5f')]['cc'],'subject':_0x284923[_0x747c('0x5f')][_0x747c('0xac')],'attach':_0x284923[_0x747c('0x5f')][_0x747c('0xad')],'firstMsgDirection':_0x747c('0xae'),'lastMsgAt':moment()[_0x747c('0x9a')](_0x747c('0x9b')),'lastMsgDirection':_0x747c('0xae'),'lastMsgBody':_0x284923[_0x747c('0x5f')][_0x747c('0x5f')],'Messages':[_['merge'](_0x284923['body'],{'messageId':_0x2b85e2['messageId'],'sentAt':moment()[_0x747c('0x9a')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3ddfc4['id'],'UserId':_0x284923[_0x747c('0x74')]['id'],'ContactId':_0x118c41['id']})]};if(_0x284923[_0x747c('0x5f')][_0x747c('0xaf')]){_0x4a1c5a=_[_0x747c('0x50')](_0x4a1c5a,_0x284923[_0x747c('0x5f')][_0x747c('0xaf')]);}return db[_0x747c('0x87')]['create'](_0x4a1c5a,{'include':[{'model':db['MailMessage'],'as':_0x747c('0xb0')}]});}})['then'](respondWithResult(_0x330edb,null))['catch'](handleError(_0x330edb,null));};exports[_0x747c('0xb1')]=function(_0x46f055,_0x4875d5,_0x3ca92e){return db['MailAccount'][_0x747c('0x5d')]({'where':{'id':_0x46f055['params']['id']},'include':[{'model':db[_0x747c('0x3e')],'as':_0x747c('0x5b'),'raw':!![]}]})[_0x747c('0x1f')](handleEntityNotFound(_0x4875d5,null))['then'](function(_0x3fa466){if(_0x3fa466&&_0x3fa466[_0x747c('0x5b')]){var _0xea2057={'id':_0x3fa466['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3fa466[_0x747c('0x5b')][_0x747c('0x7c')]){_0xea2057[_0x747c('0x7c')]=_0x3fa466['Smtp']['service'];}else{_0xea2057[_0x747c('0x7b')]=_0x3fa466[_0x747c('0x5b')]['host'];_0xea2057['port']=_0x3fa466[_0x747c('0x5b')][_0x747c('0x7a')];_0xea2057['secure']=_0x3fa466[_0x747c('0x5b')][_0x747c('0xa7')];}if(_0x3fa466[_0x747c('0x5b')][_0x747c('0x79')]){_0xea2057[_0x747c('0xa6')]={'user':_0x3fa466['Smtp'][_0x747c('0x74')],'pass':_0x3fa466[_0x747c('0x5b')][_0x747c('0x77')]};}return respondWithRpcPromise(_0x747c('0xb2'),'verifySmtp',{'account':_0xea2057});}})[_0x747c('0x1f')](respondWithResult(_0x4875d5,null))['catch'](handleError(_0x4875d5,null));};exports[_0x747c('0x33')]=function(_0x9e1ceb,_0x251177){return db[_0x747c('0x41')][_0x747c('0x5d')]({'where':{'id':_0x9e1ceb[_0x747c('0x5a')]['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x251177,null))[_0x747c('0x1f')](function(_0x28b156){if(_0x28b156&&_0x28b156['service']){throw new db[(_0x747c('0xb3'))][(_0x747c('0xb4'))](_0x747c('0xb5'));}return _0x28b156;})[_0x747c('0x1f')](removeEntity(_0x251177,null))[_0x747c('0x28')](handleError(_0x251177,null));};exports[_0x747c('0xb6')]=function(_0x55a888,_0x15dbff,_0x3e8c6c){return db[_0x747c('0x41')][_0x747c('0x5d')]({'where':{'id':_0x55a888[_0x747c('0x5a')]['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x15dbff,null))['then'](function(_0x2e51cf){if(_0x2e51cf){return _0x2e51cf[_0x747c('0xb6')](_0x55a888[_0x747c('0x5f')]['ids'],_['omit'](_0x55a888[_0x747c('0x5f')],['ids','id'])||{})[_0x747c('0xb7')](function(_0x38ec9a){for(var _0x2c5bb6=0x0;_0x2c5bb6<_0x55a888['body'][_0x747c('0x6d')][_0x747c('0x5c')];_0x2c5bb6+=0x1){socket['emit'](_0x747c('0xb8'),{'UserId':_0x55a888['body'][_0x747c('0x6d')][_0x2c5bb6],'MailAccountId':_0x55a888[_0x747c('0x5a')]['id']});}return _0x38ec9a;});}})[_0x747c('0x1f')](respondWithResult(_0x15dbff,null))[_0x747c('0x28')](handleError(_0x15dbff,null));};exports[_0x747c('0xb9')]=function(_0x2ae71d,_0x150bce,_0x4f7fda){var _0x42e3a6;return db[_0x747c('0x41')]['find']({'where':{'id':_0x2ae71d[_0x747c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x150bce,null))[_0x747c('0x1f')](function(_0x301d4f){if(_0x301d4f){return _0x301d4f['removeAgents'](_0x2ae71d['query'][_0x747c('0x6d')])[_0x747c('0x1f')](function(_0x28b179){if(_['isArray'](_0x2ae71d[_0x747c('0x45')][_0x747c('0x6d')])){for(var _0xbbb9da=0x0;_0xbbb9da<_0x2ae71d[_0x747c('0x45')][_0x747c('0x6d')][_0x747c('0x5c')];_0xbbb9da+=0x1){socket[_0x747c('0xba')](_0x747c('0xbb'),{'UserId':_0x2ae71d[_0x747c('0x45')][_0x747c('0x6d')][_0xbbb9da],'MailAccountId':_0x2ae71d['params']['id']});}}else{socket['emit'](_0x747c('0xbb'),{'UserId':_0x2ae71d[_0x747c('0x45')][_0x747c('0x6d')],'MailAccountId':_0x2ae71d[_0x747c('0x5a')]['id']});}});}})[_0x747c('0x1f')](respondWithStatusCode(_0x150bce,null))[_0x747c('0x28')](handleError(_0x150bce,null));};exports[_0x747c('0xbc')]=function(_0x15e7de,_0x3bb390,_0xf65a61){var _0x593cb7={};var _0x539abf={};var _0x1d0953;var _0x2fd249;return db['MailAccount'][_0x747c('0x64')]({'where':{'id':_0x15e7de['params']['id']}})[_0x747c('0x1f')](handleEntityNotFound(_0x3bb390,null))[_0x747c('0x1f')](function(_0x5a1755){if(_0x5a1755){_0x1d0953=_0x5a1755;_0x539abf[_0x747c('0x43')]=_[_0x747c('0x44')](db[_0x747c('0x8c')][_0x747c('0x42')]);_0x539abf[_0x747c('0x45')]=_[_0x747c('0x44')](_0x15e7de[_0x747c('0x45')]);_0x539abf[_0x747c('0x46')]=_[_0x747c('0x47')](_0x539abf[_0x747c('0x43')],_0x539abf['query']);_0x593cb7[_0x747c('0x49')]=_[_0x747c('0x47')](_0x539abf[_0x747c('0x43')],qs[_0x747c('0x48')](_0x15e7de[_0x747c('0x45')][_0x747c('0x48')]));_0x593cb7[_0x747c('0x49')]=_0x593cb7[_0x747c('0x49')][_0x747c('0x5c')]?_0x593cb7[_0x747c('0x49')]:_0x539abf[_0x747c('0x43')];_0x593cb7['order']=qs[_0x747c('0x4d')](_0x15e7de[_0x747c('0x45')][_0x747c('0x4d')]);_0x593cb7[_0x747c('0x4e')]=qs['filters'](_['pick'](_0x15e7de[_0x747c('0x45')],_0x539abf[_0x747c('0x46')]));if(_0x15e7de[_0x747c('0x45')][_0x747c('0x67')]){_0x593cb7[_0x747c('0x4e')]=_[_0x747c('0x50')](_0x593cb7[_0x747c('0x4e')],{'$or':_[_0x747c('0x51')](_0x593cb7['attributes'],function(_0x1e4139){var _0x1e1088={};_0x1e1088[_0x1e4139]={'$like':'%'+_0x15e7de[_0x747c('0x45')][_0x747c('0x67')]+'%'};return _0x1e1088;})});}_0x593cb7=_['merge']({},_0x593cb7,_0x15e7de['options']);return _0x1d0953['getAgents'](_0x593cb7);}})['then'](function(_0x1f7f44){if(_0x1f7f44){_0x2fd249=_0x1f7f44[_0x747c('0x5c')];if(!_0x15e7de[_0x747c('0x45')][_0x747c('0x4a')](_0x747c('0x66'))){_0x593cb7[_0x747c('0x4b')]=qs['limit'](_0x15e7de[_0x747c('0x45')][_0x747c('0x4b')]);_0x593cb7[_0x747c('0x2d')]=qs[_0x747c('0x2d')](_0x15e7de[_0x747c('0x45')]['offset']);}return _0x1d0953[_0x747c('0xbc')](_0x593cb7);}})[_0x747c('0x1f')](function(_0xdaddae){if(_0xdaddae){return _0xdaddae?{'count':_0x2fd249,'rows':_0xdaddae}:null;}})[_0x747c('0x1f')](respondWithResult(_0x3bb390,null))[_0x747c('0x28')](handleError(_0x3bb390,null));}; \ No newline at end of file +var _0x4fef=['merge','findAll','removeDispositions','ids','CannedAnswer','create','getAnswers','findOne','hasOwnProperty','removeAnswers','email','isNil','active','description','cservice','user','password','pass','authentication','host','port','service','cuser','role','MailAccounts','autoAssociation','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','User','fullname','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','format','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','sendMail','ListId','messageId','subject','attach','out','Interaction','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','Imap','MailServerOut','Smtp','mandatoryDispositionPause','MailAccount','rawAttributes','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','map','key','VIRTUAL','field','filter','options','includeAll','include','rows','show','params','MailServerIn','keys','length','body','find','Pause','describe','addDisposition','MailAccountId','Disposition','getDispositions'];(function(_0x3f2056,_0x24206f){var _0x56ec56=function(_0x250e83){while(--_0x250e83){_0x3f2056['push'](_0x3f2056['shift']());}};_0x56ec56(++_0x24206f);}(_0x4fef,0x10f));var _0xf4fe=function(_0x13bc6a,_0x32cc9c){_0x13bc6a=_0x13bc6a-0x0;var _0x4d21d2=_0x4fef[_0x13bc6a];return _0x4d21d2;};'use strict';var pdf=require(_0xf4fe('0x0'));var emlformat=require(_0xf4fe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf4fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4fe('0x3'));var moment=require(_0xf4fe('0x4'));var BPromise=require(_0xf4fe('0x5'));var Mustache=require(_0xf4fe('0x6'));var util=require(_0xf4fe('0x7'));var path=require(_0xf4fe('0x8'));var sox=require(_0xf4fe('0x9'));var csv=require(_0xf4fe('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf4fe('0xb'));var squel=require(_0xf4fe('0xc'));var crypto=require('crypto');var jsforce=require(_0xf4fe('0xd'));var deskjs=require(_0xf4fe('0xe'));var toCsv=require(_0xf4fe('0xa'));var querystring=require(_0xf4fe('0xf'));var Papa=require(_0xf4fe('0x10'));var authService=require(_0xf4fe('0x11'));var hardwareService=require(_0xf4fe('0x12'));var Redis=require(_0xf4fe('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0xf4fe('0x14'))('api');var utils=require(_0xf4fe('0x15'));var config=require(_0xf4fe('0x16'));var db=require(_0xf4fe('0x17'))['db'];config[_0xf4fe('0x18')]=_[_0xf4fe('0x19')](config['redis'],{'host':_0xf4fe('0x1a'),'port':0x18eb});var socket=require(_0xf4fe('0x1b'))(new Redis(config[_0xf4fe('0x18')]));require('./mailAccount.socket')[_0xf4fe('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf4fe('0x1d')][_0xf4fe('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x316685,_0x4eb042,_0x93346e,_0x3442f1){return new BPromise(function(_0x5de99e,_0x2a00ea){var _0x362e4d=_0x3442f1||client;return _0x362e4d[_0xf4fe('0x1f')](_0x316685,_0x93346e)['then'](function(_0x5daee4){logger[_0xf4fe('0x20')](_0xf4fe('0x21'),_0x4eb042,'request\x20sent');logger['debug'](_0xf4fe('0x22'),_0x4eb042,_0xf4fe('0x23'),JSON[_0xf4fe('0x24')](_0x5daee4));if(_0x5daee4[_0xf4fe('0x25')]){if(_0x5daee4[_0xf4fe('0x25')][_0xf4fe('0x26')]===0x1f4){logger[_0xf4fe('0x25')](_0xf4fe('0x21'),_0x4eb042,_0x5daee4[_0xf4fe('0x25')][_0xf4fe('0x27')]);return _0x2a00ea(_0x5daee4[_0xf4fe('0x25')][_0xf4fe('0x27')]);}logger[_0xf4fe('0x25')](_0xf4fe('0x21'),_0x4eb042,_0x5daee4['error'][_0xf4fe('0x27')]);return _0x5de99e(_0x5daee4['error']['message']);}else{logger['info'](_0xf4fe('0x21'),_0x4eb042,'request\x20sent');_0x5de99e(_0x5daee4['result'][_0xf4fe('0x27')]);}})[_0xf4fe('0x28')](function(_0x27cb2a){logger[_0xf4fe('0x25')](_0xf4fe('0x21'),_0x4eb042,_0x27cb2a);_0x2a00ea(_0x27cb2a);});});}function respondWithStatusCode(_0xf9e5d6,_0x51dc14){_0x51dc14=_0x51dc14||0xcc;return function(_0x1f4013){if(_0x1f4013){return _0xf9e5d6[_0xf4fe('0x29')](_0x51dc14);}return _0xf9e5d6[_0xf4fe('0x2a')](_0x51dc14)[_0xf4fe('0x2b')]();};}function respondWithResult(_0x4141ec,_0x477de5){_0x477de5=_0x477de5||0xc8;return function(_0xa38aa1){if(_0xa38aa1){return _0x4141ec['status'](_0x477de5)[_0xf4fe('0x2c')](_0xa38aa1);}};}function respondWithFilteredResult(_0x112b80,_0x1c455a){return function(_0x5c3f68){if(_0x5c3f68){var _0x538a68=_0x5c3f68[_0xf4fe('0x2d')],_0x2c94c9=_0x1c455a[_0xf4fe('0x2e')],_0x47e54c=_0x1c455a[_0xf4fe('0x2e')]+_0x1c455a[_0xf4fe('0x2f')],_0x5b74b9;if(_0x47e54c>=_0x538a68){_0x47e54c=_0x538a68;_0x5b74b9=0xc8;}else{_0x5b74b9=0xce;}_0x112b80['status'](_0x5b74b9);return _0x112b80['set'](_0xf4fe('0x30'),_0x2c94c9+'-'+_0x47e54c+'/'+_0x538a68)[_0xf4fe('0x2c')](_0x5c3f68);}return null;};}function patchUpdates(_0x5990de){return function(_0x89403c){try{jsonpatch[_0xf4fe('0x31')](_0x89403c,_0x5990de,!![]);}catch(_0x394785){return BPromise[_0xf4fe('0x32')](_0x394785);}return _0x89403c[_0xf4fe('0x33')]();};}function saveUpdates(_0x3a0109,_0x16d3f7){return function(_0x638217){if(_0x638217){return _0x638217[_0xf4fe('0x34')](_0x3a0109)[_0xf4fe('0x35')](function(_0x843dc8){return _0x843dc8;});}return null;};}function removeEntity(_0x356b07,_0x4d7535){return function(_0x49a386){if(_0x49a386){return _0x49a386[_0xf4fe('0x36')]()[_0xf4fe('0x35')](function(){var _0x527fae=_0x49a386[_0xf4fe('0x37')]({'plain':!![]});var _0x3019ff='MailAccounts';return db[_0xf4fe('0x38')][_0xf4fe('0x36')]({'where':{'type':_0x3019ff,'resourceId':_0x527fae['id']}})[_0xf4fe('0x35')](function(){return _0x49a386;});})[_0xf4fe('0x35')](function(){_0x356b07[_0xf4fe('0x2a')](0xcc)[_0xf4fe('0x2b')]();});}};}function handleEntityNotFound(_0x52139e,_0x35d03a){return function(_0x10f729){if(!_0x10f729){_0x52139e['sendStatus'](0x194);}return _0x10f729;};}function handleError(_0x21034d,_0x2d97fd){_0x2d97fd=_0x2d97fd||0x1f4;return function(_0x35fed3){logger[_0xf4fe('0x25')](_0x35fed3[_0xf4fe('0x39')]);if(_0x35fed3['name']){delete _0x35fed3[_0xf4fe('0x3a')];}_0x21034d[_0xf4fe('0x2a')](_0x2d97fd)[_0xf4fe('0x3b')](_0x35fed3);};}exports['index']=function(_0x7454ee,_0x19945f){var _0x4ea16a={'include':[{'model':db['MailServerIn'],'as':_0xf4fe('0x3c')},{'model':db[_0xf4fe('0x3d')],'as':_0xf4fe('0x3e')},{'model':db['Pause'],'as':_0xf4fe('0x3f')}]},_0x24345b={},_0x5e2948={'count':0x0,'rows':[]};var _0x3ffbe5=db[_0xf4fe('0x40')][_0xf4fe('0x41')];_0x24345b[_0xf4fe('0x42')]=_['keys'](_0x3ffbe5);_0x24345b[_0xf4fe('0x43')]=_['keys'](_0x7454ee['query']);_0x24345b[_0xf4fe('0x44')]=_[_0xf4fe('0x45')](_0x24345b[_0xf4fe('0x42')],_0x24345b[_0xf4fe('0x43')]);_0x4ea16a['attributes']=_[_0xf4fe('0x45')](_0x24345b[_0xf4fe('0x42')],qs['fields'](_0x7454ee[_0xf4fe('0x43')][_0xf4fe('0x46')]));_0x4ea16a[_0xf4fe('0x47')]=_0x4ea16a[_0xf4fe('0x47')]['length']?_0x4ea16a[_0xf4fe('0x47')]:_0x24345b[_0xf4fe('0x42')];if(!_0x7454ee[_0xf4fe('0x43')]['hasOwnProperty'](_0xf4fe('0x48'))){_0x4ea16a[_0xf4fe('0x2f')]=qs[_0xf4fe('0x2f')](_0x7454ee[_0xf4fe('0x43')]['limit']);_0x4ea16a[_0xf4fe('0x2e')]=qs[_0xf4fe('0x2e')](_0x7454ee[_0xf4fe('0x43')][_0xf4fe('0x2e')]);}_0x4ea16a[_0xf4fe('0x49')]=qs['sort'](_0x7454ee[_0xf4fe('0x43')][_0xf4fe('0x4a')]);_0x4ea16a[_0xf4fe('0x4b')]=qs[_0xf4fe('0x44')](_[_0xf4fe('0x4c')](_0x7454ee[_0xf4fe('0x43')],_0x24345b[_0xf4fe('0x44')]));if(_0x7454ee[_0xf4fe('0x43')]['filter']){_0x4ea16a[_0xf4fe('0x4b')]=_['merge'](_0x4ea16a[_0xf4fe('0x4b')],{'$or':_[_0xf4fe('0x4d')](_0x3ffbe5,function(_0x196563){if(_0x196563['type'][_0xf4fe('0x4e')]!==_0xf4fe('0x4f')){var _0xbcfd5={};_0xbcfd5[_0x196563[_0xf4fe('0x50')]]={'$like':'%'+_0x7454ee['query'][_0xf4fe('0x51')]+'%'};return _0xbcfd5;}})});}_0x4ea16a=_['merge']({},_0x4ea16a,_0x7454ee[_0xf4fe('0x52')]);var _0x1087e2={'where':_0x4ea16a[_0xf4fe('0x4b')]};return db[_0xf4fe('0x40')][_0xf4fe('0x2d')](_0x1087e2)['then'](function(_0x269b69){_0x5e2948['count']=_0x269b69;if(_0x7454ee[_0xf4fe('0x43')][_0xf4fe('0x53')]){_0x4ea16a[_0xf4fe('0x54')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x4ea16a);})['then'](function(_0x31c30c){_0x5e2948[_0xf4fe('0x55')]=_0x31c30c;return _0x5e2948;})[_0xf4fe('0x35')](respondWithFilteredResult(_0x19945f,_0x4ea16a))[_0xf4fe('0x28')](handleError(_0x19945f,null));};exports[_0xf4fe('0x56')]=function(_0x2d8597,_0x2aeb8e){var _0x57acfa={'raw':![],'where':{'id':_0x2d8597[_0xf4fe('0x57')]['id']},'include':[{'model':db[_0xf4fe('0x58')],'as':'Imap'},{'model':db[_0xf4fe('0x3d')],'as':_0xf4fe('0x3e')},{'model':db['Pause'],'as':_0xf4fe('0x3f')}]},_0x2e491a={};_0x2e491a[_0xf4fe('0x42')]=_[_0xf4fe('0x59')](db['MailAccount']['rawAttributes']);_0x2e491a[_0xf4fe('0x43')]=_[_0xf4fe('0x59')](_0x2d8597[_0xf4fe('0x43')]);_0x2e491a[_0xf4fe('0x44')]=_['intersection'](_0x2e491a[_0xf4fe('0x42')],_0x2e491a[_0xf4fe('0x43')]);_0x57acfa[_0xf4fe('0x47')]=_[_0xf4fe('0x45')](_0x2e491a[_0xf4fe('0x42')],qs[_0xf4fe('0x46')](_0x2d8597['query'][_0xf4fe('0x46')]));_0x57acfa[_0xf4fe('0x47')]=_0x57acfa['attributes'][_0xf4fe('0x5a')]?_0x57acfa[_0xf4fe('0x47')]:_0x2e491a[_0xf4fe('0x42')];if(_0x2d8597[_0xf4fe('0x43')]['includeAll']){_0x57acfa['include']=[{'all':!![]}];}_0x57acfa=_['merge']({},_0x57acfa,_0x2d8597[_0xf4fe('0x52')]);return db[_0xf4fe('0x40')]['find'](_0x57acfa)[_0xf4fe('0x35')](handleEntityNotFound(_0x2aeb8e,null))[_0xf4fe('0x35')](respondWithResult(_0x2aeb8e,null))[_0xf4fe('0x28')](handleError(_0x2aeb8e,null));};exports[_0xf4fe('0x34')]=function(_0x3538e9,_0xf8c766){if(_0x3538e9[_0xf4fe('0x5b')]['id']){delete _0x3538e9['body']['id'];}return db[_0xf4fe('0x40')][_0xf4fe('0x5c')]({'where':{'id':_0x3538e9['params']['id']},'include':[{'model':db[_0xf4fe('0x58')],'as':'Imap'},{'model':db[_0xf4fe('0x3d')],'as':'Smtp'},{'model':db[_0xf4fe('0x5d')],'as':_0xf4fe('0x3f')}]})[_0xf4fe('0x35')](handleEntityNotFound(_0xf8c766,null))[_0xf4fe('0x35')](saveUpdates(_0x3538e9[_0xf4fe('0x5b')],null))[_0xf4fe('0x35')](function(_0xc3fb60){if(_0xc3fb60&&_0x3538e9[_0xf4fe('0x5b')][_0xf4fe('0x3c')]){return db['MailServerIn']['update'](_0x3538e9[_0xf4fe('0x5b')][_0xf4fe('0x3c')],{'where':{'MailAccountId':_0xc3fb60['id']}})[_0xf4fe('0x35')](function(){return _0xc3fb60;});}return _0xc3fb60;})['then'](function(_0x21331d){if(_0x21331d&&_0x3538e9[_0xf4fe('0x5b')][_0xf4fe('0x3e')]){return db[_0xf4fe('0x3d')]['update'](_0x3538e9[_0xf4fe('0x5b')][_0xf4fe('0x3e')],{'where':{'MailAccountId':_0x21331d['id']}})[_0xf4fe('0x35')](function(){return _0x21331d;});}return _0x21331d;})['then'](respondWithResult(_0xf8c766,null))['catch'](handleError(_0xf8c766,null));};exports[_0xf4fe('0x5e')]=function(_0x39b51b,_0x46c33f){return db['MailAccount']['describe']()[_0xf4fe('0x35')](respondWithResult(_0x46c33f,null))[_0xf4fe('0x28')](handleError(_0x46c33f,null));};exports[_0xf4fe('0x5f')]=function(_0x1c7124,_0x1bedaa,_0x1771aa){if(_0x1c7124[_0xf4fe('0x5b')]['id']){delete _0x1c7124[_0xf4fe('0x5b')]['id'];}return db['MailAccount'][_0xf4fe('0x5c')]({'where':{'id':_0x1c7124[_0xf4fe('0x57')]['id']}})['then'](handleEntityNotFound(_0x1bedaa,null))['then'](function(_0x366ef1){if(_0x366ef1){_0x1c7124[_0xf4fe('0x5b')][_0xf4fe('0x60')]=_0x366ef1['id'];return db[_0xf4fe('0x61')]['create'](_0x1c7124[_0xf4fe('0x5b')]);}})['then'](respondWithResult(_0x1bedaa,null))[_0xf4fe('0x28')](handleError(_0x1bedaa,null));};exports[_0xf4fe('0x62')]=function(_0xaf548b,_0x4b0f3d,_0x511e24){var _0x54148f={'raw':![],'where':{}};var _0x2e625e={};var _0x39d75a={'count':0x0,'rows':[]};return db[_0xf4fe('0x40')]['findOne']({'where':{'id':_0xaf548b[_0xf4fe('0x57')]['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x4b0f3d,null))[_0xf4fe('0x35')](function(_0x3cb883){if(_0x3cb883){_0x2e625e[_0xf4fe('0x42')]=_[_0xf4fe('0x59')](db['Disposition'][_0xf4fe('0x41')]);_0x2e625e[_0xf4fe('0x43')]=_['keys'](_0xaf548b['query']);_0x2e625e['filters']=_[_0xf4fe('0x45')](_0x2e625e[_0xf4fe('0x42')],_0x2e625e[_0xf4fe('0x43')]);_0x54148f[_0xf4fe('0x47')]=_[_0xf4fe('0x45')](_0x2e625e[_0xf4fe('0x42')],qs[_0xf4fe('0x46')](_0xaf548b['query'][_0xf4fe('0x46')]));_0x54148f[_0xf4fe('0x47')]=_0x54148f[_0xf4fe('0x47')][_0xf4fe('0x5a')]?_0x54148f[_0xf4fe('0x47')]:_0x2e625e[_0xf4fe('0x42')];if(!_0xaf548b[_0xf4fe('0x43')]['hasOwnProperty'](_0xf4fe('0x48'))){_0x54148f['limit']=qs[_0xf4fe('0x2f')](_0xaf548b['query'][_0xf4fe('0x2f')]);_0x54148f[_0xf4fe('0x2e')]=qs[_0xf4fe('0x2e')](_0xaf548b[_0xf4fe('0x43')][_0xf4fe('0x2e')]);}_0x54148f['order']=qs[_0xf4fe('0x4a')](_0xaf548b[_0xf4fe('0x43')]['sort']);_0x54148f[_0xf4fe('0x4b')]=qs['filters'](_['pick'](_0xaf548b[_0xf4fe('0x43')],_0x2e625e[_0xf4fe('0x44')]));_0x54148f[_0xf4fe('0x4b')][_0xf4fe('0x60')]=_0x3cb883['id'];if(_0xaf548b['query'][_0xf4fe('0x51')]){_0x54148f[_0xf4fe('0x4b')]=_[_0xf4fe('0x63')](_0x54148f['where'],{'$or':_[_0xf4fe('0x4d')](_0x54148f[_0xf4fe('0x47')],function(_0x468f14){var _0x23a22a={};_0x23a22a[_0x468f14]={'$like':'%'+_0xaf548b[_0xf4fe('0x43')][_0xf4fe('0x51')]+'%'};return _0x23a22a;})});}_0x54148f=_[_0xf4fe('0x63')]({},_0x54148f,_0xaf548b[_0xf4fe('0x52')]);return db[_0xf4fe('0x61')][_0xf4fe('0x2d')]({'where':_0x54148f[_0xf4fe('0x4b')]})['then'](function(_0x2de252){_0x39d75a[_0xf4fe('0x2d')]=_0x2de252;if(_0xaf548b['query']['includeAll']){_0x54148f[_0xf4fe('0x54')]=[{'all':!![]}];}return db[_0xf4fe('0x61')][_0xf4fe('0x64')](_0x54148f);})['then'](function(_0x39fedd){_0x39d75a['rows']=_0x39fedd;return _0x39d75a;});}})[_0xf4fe('0x35')](respondWithFilteredResult(_0x4b0f3d,_0x54148f))[_0xf4fe('0x28')](handleError(_0x4b0f3d,null));};exports['removeDispositions']=function(_0x7b626f,_0x4b831c,_0x55306f){var _0x154282;return db['MailAccount'][_0xf4fe('0x5c')]({'where':{'id':_0x7b626f['params']['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x4b831c,null))[_0xf4fe('0x35')](function(_0xb922fa){if(_0xb922fa){return _0xb922fa[_0xf4fe('0x65')](_0x7b626f[_0xf4fe('0x43')][_0xf4fe('0x66')]);}})[_0xf4fe('0x35')](respondWithStatusCode(_0x4b831c,null))[_0xf4fe('0x28')](handleError(_0x4b831c,null));};exports['addAnswer']=function(_0x4314cc,_0x5468ce,_0x277ccc){if(_0x4314cc['body']['id']){delete _0x4314cc[_0xf4fe('0x5b')]['id'];}return db[_0xf4fe('0x40')][_0xf4fe('0x5c')]({'where':{'id':_0x4314cc[_0xf4fe('0x57')]['id']}})['then'](handleEntityNotFound(_0x5468ce,null))[_0xf4fe('0x35')](function(_0x21ca88){if(_0x21ca88){_0x4314cc['body'][_0xf4fe('0x60')]=_0x21ca88['id'];return db[_0xf4fe('0x67')][_0xf4fe('0x68')](_0x4314cc['body']);}})[_0xf4fe('0x35')](respondWithResult(_0x5468ce,null))['catch'](handleError(_0x5468ce,null));};exports[_0xf4fe('0x69')]=function(_0x401df3,_0x3dcf0b,_0x110058){var _0x3a8b8b={'raw':![],'where':{}};var _0x23fbaa={};var _0x4f7ab5={'count':0x0,'rows':[]};return db[_0xf4fe('0x40')][_0xf4fe('0x6a')]({'where':{'id':_0x401df3['params']['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x3dcf0b,null))[_0xf4fe('0x35')](function(_0x4310fe){if(_0x4310fe){_0x23fbaa[_0xf4fe('0x42')]=_[_0xf4fe('0x59')](db['CannedAnswer'][_0xf4fe('0x41')]);_0x23fbaa[_0xf4fe('0x43')]=_[_0xf4fe('0x59')](_0x401df3[_0xf4fe('0x43')]);_0x23fbaa[_0xf4fe('0x44')]=_[_0xf4fe('0x45')](_0x23fbaa[_0xf4fe('0x42')],_0x23fbaa[_0xf4fe('0x43')]);_0x3a8b8b[_0xf4fe('0x47')]=_[_0xf4fe('0x45')](_0x23fbaa[_0xf4fe('0x42')],qs['fields'](_0x401df3[_0xf4fe('0x43')][_0xf4fe('0x46')]));_0x3a8b8b[_0xf4fe('0x47')]=_0x3a8b8b[_0xf4fe('0x47')][_0xf4fe('0x5a')]?_0x3a8b8b['attributes']:_0x23fbaa['model'];if(!_0x401df3['query'][_0xf4fe('0x6b')](_0xf4fe('0x48'))){_0x3a8b8b[_0xf4fe('0x2f')]=qs[_0xf4fe('0x2f')](_0x401df3[_0xf4fe('0x43')][_0xf4fe('0x2f')]);_0x3a8b8b['offset']=qs[_0xf4fe('0x2e')](_0x401df3['query'][_0xf4fe('0x2e')]);}_0x3a8b8b[_0xf4fe('0x49')]=qs[_0xf4fe('0x4a')](_0x401df3[_0xf4fe('0x43')][_0xf4fe('0x4a')]);_0x3a8b8b[_0xf4fe('0x4b')]=qs[_0xf4fe('0x44')](_[_0xf4fe('0x4c')](_0x401df3[_0xf4fe('0x43')],_0x23fbaa[_0xf4fe('0x44')]));_0x3a8b8b[_0xf4fe('0x4b')][_0xf4fe('0x60')]=_0x4310fe['id'];if(_0x401df3[_0xf4fe('0x43')]['filter']){_0x3a8b8b['where']=_['merge'](_0x3a8b8b['where'],{'$or':_[_0xf4fe('0x4d')](_0x3a8b8b['attributes'],function(_0x1a93a0){var _0x138865={};_0x138865[_0x1a93a0]={'$like':'%'+_0x401df3[_0xf4fe('0x43')][_0xf4fe('0x51')]+'%'};return _0x138865;})});}_0x3a8b8b=_[_0xf4fe('0x63')]({},_0x3a8b8b,_0x401df3['options']);return db[_0xf4fe('0x67')]['count']({'where':_0x3a8b8b[_0xf4fe('0x4b')]})[_0xf4fe('0x35')](function(_0x2d76b9){_0x4f7ab5['count']=_0x2d76b9;if(_0x401df3['query'][_0xf4fe('0x53')]){_0x3a8b8b[_0xf4fe('0x54')]=[{'all':!![]}];}return db[_0xf4fe('0x67')]['findAll'](_0x3a8b8b);})['then'](function(_0x330e92){_0x4f7ab5[_0xf4fe('0x55')]=_0x330e92;return _0x4f7ab5;});}})['then'](respondWithFilteredResult(_0x3dcf0b,_0x3a8b8b))[_0xf4fe('0x28')](handleError(_0x3dcf0b,null));};exports[_0xf4fe('0x6c')]=function(_0x5de4e5,_0x4dcef3,_0x2e4012){var _0x2486dd;return db[_0xf4fe('0x40')]['find']({'where':{'id':_0x5de4e5['params']['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x4dcef3,null))[_0xf4fe('0x35')](function(_0x6ebda6){if(_0x6ebda6){return _0x6ebda6[_0xf4fe('0x6c')](_0x5de4e5[_0xf4fe('0x43')][_0xf4fe('0x66')]);}})[_0xf4fe('0x35')](respondWithStatusCode(_0x4dcef3,null))[_0xf4fe('0x28')](handleError(_0x4dcef3,null));};exports['create']=function(_0x5ab818,_0x84a129){var _0x8523f2={'name':_0x5ab818[_0xf4fe('0x5b')]['name'],'key':_0x5ab818['body']['key'],'email':_0x5ab818[_0xf4fe('0x5b')][_0xf4fe('0x6d')],'ListId':_0x5ab818['body']['ListId'],'active':!_[_0xf4fe('0x6e')](_0x5ab818[_0xf4fe('0x5b')]['active'])?_0x5ab818[_0xf4fe('0x5b')][_0xf4fe('0x6f')]:!![],'description':_0x5ab818['body'][_0xf4fe('0x70')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x5ab818['body'][_0xf4fe('0x71')])){if(_0x5ab818['body']['cauthentication']){_0x8523f2['Imap'][_0xf4fe('0x72')]=_0x8523f2[_0xf4fe('0x3e')][_0xf4fe('0x72')]=_0x5ab818[_0xf4fe('0x5b')]['cuser'];_0x8523f2[_0xf4fe('0x3c')][_0xf4fe('0x73')]=_0x8523f2['Smtp'][_0xf4fe('0x74')]=_0x5ab818[_0xf4fe('0x5b')]['cpassword'];}else{_0x8523f2[_0xf4fe('0x3c')][_0xf4fe('0x75')]=_0x8523f2[_0xf4fe('0x3e')][_0xf4fe('0x75')]=![];}_0x8523f2[_0xf4fe('0x3c')][_0xf4fe('0x76')]=_0x5ab818[_0xf4fe('0x5b')][_0xf4fe('0x3c')]['host'];_0x8523f2[_0xf4fe('0x3c')][_0xf4fe('0x77')]=_0x5ab818[_0xf4fe('0x5b')][_0xf4fe('0x3c')][_0xf4fe('0x77')];_0x8523f2[_0xf4fe('0x3e')]['host']=_0x5ab818[_0xf4fe('0x5b')][_0xf4fe('0x3e')][_0xf4fe('0x76')];_0x8523f2['Smtp']['port']=_0x5ab818[_0xf4fe('0x5b')][_0xf4fe('0x3e')]['port'];}else{_0x8523f2[_0xf4fe('0x3c')][_0xf4fe('0x78')]=_0x8523f2['Smtp'][_0xf4fe('0x78')]=_0x5ab818[_0xf4fe('0x5b')][_0xf4fe('0x71')];_0x8523f2['Imap']['user']=_0x8523f2[_0xf4fe('0x3e')]['user']=_0x5ab818[_0xf4fe('0x5b')][_0xf4fe('0x79')];_0x8523f2[_0xf4fe('0x3c')]['password']=_0x8523f2[_0xf4fe('0x3e')][_0xf4fe('0x74')]=_0x5ab818['body']['cpassword'];}return db['MailAccount'][_0xf4fe('0x68')](_0x8523f2,{'include':[{'model':db[_0xf4fe('0x3d')],'as':_0xf4fe('0x3e')},{'model':db['MailServerIn'],'as':_0xf4fe('0x3c')}]})[_0xf4fe('0x35')](function(_0x285aa7){var _0x178a5a=_0x5ab818[_0xf4fe('0x72')][_0xf4fe('0x37')]({'plain':!![]});if(!_0x178a5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x178a5a[_0xf4fe('0x7a')]==='user'){var _0x26a514=_0x285aa7[_0xf4fe('0x37')]({'plain':!![]});return db['UserProfileSection'][_0xf4fe('0x5c')]({'where':{'name':_0xf4fe('0x7b'),'userProfileId':_0x178a5a['userProfileId']},'raw':!![]})[_0xf4fe('0x35')](function(_0x2a8f95){if(_0x2a8f95&&_0x2a8f95[_0xf4fe('0x7c')]===0x0){return db[_0xf4fe('0x38')][_0xf4fe('0x68')]({'name':_0x26a514[_0xf4fe('0x3a')],'resourceId':_0x26a514['id'],'type':_0x2a8f95[_0xf4fe('0x3a')],'sectionId':_0x2a8f95['id']},{})[_0xf4fe('0x35')](function(){return _0x285aa7;});}else{return _0x285aa7;}})['catch'](function(_0x117275){logger[_0xf4fe('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x117275);throw _0x117275;});}return _0x285aa7;})[_0xf4fe('0x35')](respondWithResult(_0x84a129,0xc9))[_0xf4fe('0x28')](handleError(_0x84a129,null));};exports[_0xf4fe('0x7d')]=function(_0xbbcb8b,_0x40341e,_0x31c4aa){return db[_0xf4fe('0x40')][_0xf4fe('0x6a')]({'where':{'id':_0xbbcb8b[_0xf4fe('0x57')]['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x40341e,null))[_0xf4fe('0x35')](function(_0x540bd4){if(_0x540bd4){return _0x540bd4['getImap']();}return null;})[_0xf4fe('0x35')](respondWithResult(_0x40341e,null))[_0xf4fe('0x28')](handleError(_0x40341e,null));};exports[_0xf4fe('0x7e')]=function(_0x1f8fe5,_0x5c996c,_0x4701b8){if(_0x1f8fe5[_0xf4fe('0x5b')]['id']){delete _0x1f8fe5[_0xf4fe('0x5b')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x1f8fe5[_0xf4fe('0x57')]['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x5c996c,null))[_0xf4fe('0x35')](function(_0x50f5e9){if(_0x50f5e9){_0x1f8fe5[_0xf4fe('0x5b')][_0xf4fe('0x60')]=_0x50f5e9['id'];return db[_0xf4fe('0x58')][_0xf4fe('0x68')](_0x1f8fe5[_0xf4fe('0x5b')]);}})[_0xf4fe('0x35')](respondWithResult(_0x5c996c,null))[_0xf4fe('0x28')](handleError(_0x5c996c,null));};exports[_0xf4fe('0x7f')]=function(_0x5dc8ea,_0x172f52,_0x5a804a){return db['MailAccount'][_0xf4fe('0x6a')]({'where':{'id':_0x5dc8ea['params']['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x172f52,null))[_0xf4fe('0x35')](function(_0x84b42d){if(_0x84b42d){return _0x84b42d['setImap'](null);}return null;})[_0xf4fe('0x35')](respondWithStatusCode(_0x172f52,null))[_0xf4fe('0x28')](handleError(_0x172f52,null));};exports[_0xf4fe('0x80')]=function(_0xeab409,_0x13dc72,_0x3fe819){return db['MailAccount'][_0xf4fe('0x6a')]({'where':{'id':_0xeab409[_0xf4fe('0x57')]['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x13dc72,null))[_0xf4fe('0x35')](function(_0x5ce114){if(_0x5ce114){return _0x5ce114[_0xf4fe('0x80')]();}return null;})[_0xf4fe('0x35')](respondWithResult(_0x13dc72,null))[_0xf4fe('0x28')](handleError(_0x13dc72,null));};exports[_0xf4fe('0x81')]=function(_0x99b9e6,_0xd76295,_0x54962a){if(_0x99b9e6[_0xf4fe('0x5b')]['id']){delete _0x99b9e6[_0xf4fe('0x5b')]['id'];}return db[_0xf4fe('0x40')][_0xf4fe('0x5c')]({'where':{'id':_0x99b9e6[_0xf4fe('0x57')]['id']}})['then'](handleEntityNotFound(_0xd76295,null))[_0xf4fe('0x35')](function(_0x2a81b3){if(_0x2a81b3){_0x99b9e6[_0xf4fe('0x5b')][_0xf4fe('0x60')]=_0x2a81b3['id'];return db['MailServerOut'][_0xf4fe('0x68')](_0x99b9e6[_0xf4fe('0x5b')]);}})['then'](respondWithResult(_0xd76295,null))[_0xf4fe('0x28')](handleError(_0xd76295,null));};exports[_0xf4fe('0x82')]=function(_0x4c1297,_0x27aa55,_0x507803){return db[_0xf4fe('0x40')][_0xf4fe('0x6a')]({'where':{'id':_0x4c1297[_0xf4fe('0x57')]['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x27aa55,null))['then'](function(_0x7f2e68){if(_0x7f2e68){return _0x7f2e68[_0xf4fe('0x83')](null);}return null;})[_0xf4fe('0x35')](respondWithStatusCode(_0x27aa55,null))[_0xf4fe('0x28')](handleError(_0x27aa55,null));};exports[_0xf4fe('0x84')]=function(_0x5b35e1,_0x121ffa,_0x1ef90d){return db[_0xf4fe('0x85')][_0xf4fe('0x5c')]({'where':{'id':_0x5b35e1['params']['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x121ffa,null))['then'](function(_0x1fcf37){if(_0x1fcf37){return _0x1fcf37[_0xf4fe('0x84')](_0x5b35e1[_0xf4fe('0x5b')][_0xf4fe('0x66')],_[_0xf4fe('0x86')](_0x5b35e1['body'],[_0xf4fe('0x66'),'id'])||{});}})[_0xf4fe('0x35')](respondWithResult(_0x121ffa,null))[_0xf4fe('0x28')](handleError(_0x121ffa,null));};exports['getInteractions']=function(_0x1ef01f,_0x181bb5,_0x21c4b3){var _0x29ee17={'raw':![],'where':{}};var _0x427f12={};var _0x5b8398={'count':0x0,'rows':[]};return db['MailAccount'][_0xf4fe('0x6a')]({'where':{'id':_0x1ef01f['params']['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x181bb5,null))[_0xf4fe('0x35')](function(_0x1dce28){if(_0x1dce28){_0x427f12['model']=_['keys'](db['MailInteraction'][_0xf4fe('0x41')]);_0x427f12['query']=_[_0xf4fe('0x59')](_0x1ef01f[_0xf4fe('0x43')]);_0x427f12['filters']=_[_0xf4fe('0x45')](_0x427f12['model'],_0x427f12[_0xf4fe('0x43')]);_0x29ee17[_0xf4fe('0x47')]=_[_0xf4fe('0x45')](_0x427f12['model'],qs[_0xf4fe('0x46')](_0x1ef01f[_0xf4fe('0x43')]['fields']));_0x29ee17[_0xf4fe('0x47')]=_0x29ee17['attributes'][_0xf4fe('0x5a')]?_0x29ee17[_0xf4fe('0x47')]:_0x427f12['model'];if(!_0x1ef01f['query'][_0xf4fe('0x6b')](_0xf4fe('0x48'))){_0x29ee17[_0xf4fe('0x2f')]=qs[_0xf4fe('0x2f')](_0x1ef01f[_0xf4fe('0x43')][_0xf4fe('0x2f')]);_0x29ee17[_0xf4fe('0x2e')]=qs[_0xf4fe('0x2e')](_0x1ef01f[_0xf4fe('0x43')]['offset']);}_0x29ee17[_0xf4fe('0x49')]=qs[_0xf4fe('0x4a')](_0x1ef01f[_0xf4fe('0x43')][_0xf4fe('0x4a')]);_0x29ee17[_0xf4fe('0x4b')]=qs['filters'](_[_0xf4fe('0x4c')](_0x1ef01f[_0xf4fe('0x43')],_0x427f12[_0xf4fe('0x44')]));_0x29ee17[_0xf4fe('0x4b')]['MailAccountId']=_0x1dce28['id'];if(_0x1ef01f['query'][_0xf4fe('0x51')]){_0x29ee17[_0xf4fe('0x4b')]=_[_0xf4fe('0x63')](_0x29ee17[_0xf4fe('0x4b')],{'$or':_[_0xf4fe('0x4d')](_0x29ee17['attributes'],function(_0x10f67e){var _0x4a75dc={};_0x4a75dc[_0x10f67e]={'$like':'%'+_0x1ef01f[_0xf4fe('0x43')][_0xf4fe('0x51')]+'%'};return _0x4a75dc;})});}_0x29ee17=_[_0xf4fe('0x63')]({},_0x29ee17,_0x1ef01f[_0xf4fe('0x52')]);return db['MailInteraction'][_0xf4fe('0x2d')]({'where':_0x29ee17[_0xf4fe('0x4b')]})[_0xf4fe('0x35')](function(_0xbea8b4){_0x5b8398[_0xf4fe('0x2d')]=_0xbea8b4;if(_0x1ef01f[_0xf4fe('0x43')][_0xf4fe('0x53')]){_0x29ee17[_0xf4fe('0x54')]=[{'model':db[_0xf4fe('0x87')],'as':'Contact','required':![]},{'model':db[_0xf4fe('0x88')],'as':'Owner','attributes':[_0xf4fe('0x3a'),_0xf4fe('0x89'),'internal'],'required':![]},{'model':db[_0xf4fe('0x8a')],'as':_0xf4fe('0x8b'),'attributes':['id',_0xf4fe('0x3a'),'color'],'where':_0x1ef01f[_0xf4fe('0x43')][_0xf4fe('0x8c')]?{'id':_0x1ef01f[_0xf4fe('0x43')]['tag']}:undefined,'required':_0x1ef01f[_0xf4fe('0x43')][_0xf4fe('0x8c')]?!![]:![]}];}return db['MailInteraction'][_0xf4fe('0x64')](_0x29ee17);})[_0xf4fe('0x35')](function(_0x86a1f4){_0x5b8398[_0xf4fe('0x55')]=_0x86a1f4;return _0x5b8398;});}})[_0xf4fe('0x35')](respondWithFilteredResult(_0x181bb5,_0x29ee17))[_0xf4fe('0x28')](handleError(_0x181bb5,null));};exports[_0xf4fe('0x8d')]=function(_0x493e61,_0x4735eb,_0x1ebd76){return db[_0xf4fe('0x40')][_0xf4fe('0x6a')]({'where':{'id':_0x493e61['params']['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x4735eb,null))[_0xf4fe('0x35')](function(_0x5499e7){if(_0x5499e7){return db[_0xf4fe('0x8e')][_0xf4fe('0x8f')](function(_0xe3c778){return db[_0xf4fe('0x90')]['destroy']({'where':{'MailAccountId':_0x493e61[_0xf4fe('0x57')]['id']},'transaction':_0xe3c778})[_0xf4fe('0x35')](function(_0x8484e9){var _0x56b490=_[_0xf4fe('0x4d')](_0x493e61['body'],function(_0x2d17b8){_0x2d17b8[_0xf4fe('0x60')]=_0x493e61[_0xf4fe('0x57')]['id'];return _0x2d17b8;});return db[_0xf4fe('0x90')][_0xf4fe('0x91')](_0x56b490,{'transaction':_0xe3c778});});})['then'](function(){return db[_0xf4fe('0x90')][_0xf4fe('0x92')]({'where':{'MailAccountId':_0x493e61[_0xf4fe('0x57')]['id']},'order':_0xf4fe('0x93')});});}})['then'](respondWithResult(_0x4735eb,null))[_0xf4fe('0x28')](handleError(_0x4735eb,null));};exports[_0xf4fe('0x94')]=function(_0x55d5cc,_0xfb42b6,_0x4fa064){var _0x5ddde3={};var _0x5322f4={};var _0x1b76d5;var _0x4a5486;return db[_0xf4fe('0x40')][_0xf4fe('0x6a')]({'where':{'id':_0x55d5cc['params']['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0xfb42b6,null))['then'](function(_0x3d53d8){if(_0x3d53d8){_0x1b76d5=_0x3d53d8;_0x5322f4[_0xf4fe('0x42')]=_['keys'](db[_0xf4fe('0x90')][_0xf4fe('0x41')]);_0x5322f4['query']=_[_0xf4fe('0x59')](_0x55d5cc[_0xf4fe('0x43')]);_0x5322f4[_0xf4fe('0x44')]=_[_0xf4fe('0x45')](_0x5322f4[_0xf4fe('0x42')],_0x5322f4[_0xf4fe('0x43')]);_0x5ddde3['attributes']=_[_0xf4fe('0x45')](_0x5322f4[_0xf4fe('0x42')],qs[_0xf4fe('0x46')](_0x55d5cc['query'][_0xf4fe('0x46')]));_0x5ddde3['attributes']=_0x5ddde3[_0xf4fe('0x47')]['length']?_0x5ddde3[_0xf4fe('0x47')]:_0x5322f4[_0xf4fe('0x42')];_0x5ddde3['order']=qs[_0xf4fe('0x4a')](_0x55d5cc[_0xf4fe('0x43')][_0xf4fe('0x4a')]);_0x5ddde3[_0xf4fe('0x4b')]=qs[_0xf4fe('0x44')](_['pick'](_0x55d5cc[_0xf4fe('0x43')],_0x5322f4[_0xf4fe('0x44')]));if(_0x55d5cc['query']['filter']){_0x5ddde3[_0xf4fe('0x4b')]=_[_0xf4fe('0x63')](_0x5ddde3[_0xf4fe('0x4b')],{'$or':_[_0xf4fe('0x4d')](_0x5ddde3[_0xf4fe('0x47')],function(_0x5ebfdc){var _0x53d8a8={};_0x53d8a8[_0x5ebfdc]={'$like':'%'+_0x55d5cc[_0xf4fe('0x43')][_0xf4fe('0x51')]+'%'};return _0x53d8a8;})});}_0x5ddde3=_['merge']({},_0x5ddde3,_0x55d5cc[_0xf4fe('0x52')]);return _0x1b76d5['getApplications'](_0x5ddde3);}})[_0xf4fe('0x35')](function(_0x3aa812){if(_0x3aa812){_0x4a5486=_0x3aa812[_0xf4fe('0x5a')];if(!_0x55d5cc[_0xf4fe('0x43')][_0xf4fe('0x6b')](_0xf4fe('0x48'))){_0x5ddde3[_0xf4fe('0x2f')]=qs[_0xf4fe('0x2f')](_0x55d5cc['query'][_0xf4fe('0x2f')]);_0x5ddde3[_0xf4fe('0x2e')]=qs[_0xf4fe('0x2e')](_0x55d5cc[_0xf4fe('0x43')][_0xf4fe('0x2e')]);}return _0x1b76d5[_0xf4fe('0x94')](_0x5ddde3);}})['then'](function(_0x2dbe2e){if(_0x2dbe2e){return _0x2dbe2e?{'count':_0x4a5486,'rows':_0x2dbe2e}:null;}})[_0xf4fe('0x35')](respondWithResult(_0xfb42b6,null))[_0xf4fe('0x28')](handleError(_0xfb42b6,null));};exports[_0xf4fe('0x95')]=function(_0x529211,_0x165171,_0x67e7bb){var _0x1d8802={'raw':!![],'where':{}};var _0x513ae9={};var _0xd22ec3={'count':0x0,'rows':[]};return db[_0xf4fe('0x40')][_0xf4fe('0x6a')]({'where':{'id':_0x529211['params']['id']}})['then'](handleEntityNotFound(_0x165171,null))[_0xf4fe('0x35')](function(_0x4e9467){if(_0x4e9467){_0x513ae9['model']=_[_0xf4fe('0x59')](db[_0xf4fe('0x96')][_0xf4fe('0x41')]);_0x513ae9['query']=_[_0xf4fe('0x59')](_0x529211[_0xf4fe('0x43')]);_0x513ae9['filters']=_['intersection'](_0x513ae9[_0xf4fe('0x42')],_0x513ae9[_0xf4fe('0x43')]);_0x1d8802['attributes']=_[_0xf4fe('0x45')](_0x513ae9['model'],qs['fields'](_0x529211[_0xf4fe('0x43')]['fields']));_0x1d8802['attributes']=_0x1d8802[_0xf4fe('0x47')][_0xf4fe('0x5a')]?_0x1d8802['attributes']:_0x513ae9[_0xf4fe('0x42')];if(!_0x529211[_0xf4fe('0x43')][_0xf4fe('0x6b')](_0xf4fe('0x48'))){_0x1d8802[_0xf4fe('0x2f')]=qs[_0xf4fe('0x2f')](_0x529211[_0xf4fe('0x43')][_0xf4fe('0x2f')]);_0x1d8802[_0xf4fe('0x2e')]=qs[_0xf4fe('0x2e')](_0x529211[_0xf4fe('0x43')][_0xf4fe('0x2e')]);}_0x1d8802[_0xf4fe('0x49')]=qs[_0xf4fe('0x4a')](_0x529211[_0xf4fe('0x43')]['sort']);_0x1d8802[_0xf4fe('0x4b')]=qs['filters'](_[_0xf4fe('0x4c')](_0x529211[_0xf4fe('0x43')],_0x513ae9['filters']));_0x1d8802['where'][_0xf4fe('0x60')]=_0x4e9467['id'];if(_0x529211[_0xf4fe('0x43')]['filter']){_0x1d8802[_0xf4fe('0x4b')]=_[_0xf4fe('0x63')](_0x1d8802[_0xf4fe('0x4b')],{'$or':_[_0xf4fe('0x4d')](_0x1d8802[_0xf4fe('0x47')],function(_0x6e188e){var _0x2a5c6b={};_0x2a5c6b[_0x6e188e]={'$like':'%'+_0x529211[_0xf4fe('0x43')][_0xf4fe('0x51')]+'%'};return _0x2a5c6b;})});}if(_0x529211['query'][_0xf4fe('0x97')]){var _0x510ae6=_0x529211['query'][_0xf4fe('0x97')][_0xf4fe('0x98')](',');var _0x169ba5={};_0x169ba5[_0x510ae6[0x0]]={'$gte':moment(_0x510ae6[0x1])['format'](_0xf4fe('0x99'))};_0x1d8802['where']=_['merge'](_0x1d8802[_0xf4fe('0x4b')],_0x169ba5);}_0x1d8802=_[_0xf4fe('0x63')]({},_0x1d8802,_0x529211['options']);return db['MailMessage'][_0xf4fe('0x2d')]({'where':_0x1d8802['where']})[_0xf4fe('0x35')](function(_0x57781a){_0xd22ec3[_0xf4fe('0x2d')]=_0x57781a;if(_0x529211[_0xf4fe('0x43')][_0xf4fe('0x53')]){_0x1d8802['include']=[{'all':!![]}];}return db[_0xf4fe('0x96')][_0xf4fe('0x64')](_0x1d8802);})[_0xf4fe('0x35')](function(_0x19de69){_0xd22ec3[_0xf4fe('0x55')]=_0x19de69;return _0xd22ec3;});}})[_0xf4fe('0x35')](respondWithFilteredResult(_0x165171,_0x1d8802))[_0xf4fe('0x28')](handleError(_0x165171,null));};exports[_0xf4fe('0x3b')]=function(_0xf60954,_0x40a21d,_0x550de0){var _0x80faf5,_0x546470={},_0x44e8ad;if(_0xf60954[_0xf4fe('0x5b')]['to']){_0x44e8ad=_0xf60954[_0xf4fe('0x5b')]['to'][_0xf4fe('0x98')](',')[0x0];}return db['MailAccount'][_0xf4fe('0x5c')]({'where':{'id':_0xf60954[_0xf4fe('0x57')]['id']},'include':[{'model':db[_0xf4fe('0x9a')],'as':_0xf4fe('0x9b'),'include':[{'model':db[_0xf4fe('0x87')],'as':_0xf4fe('0x9c'),'where':{'email':_0x44e8ad},'limit':0x1,'order':[[_0xf4fe('0x9d'),_0xf4fe('0x9e')]]}]},{'model':db['MailServerOut'],'as':_0xf4fe('0x3e'),'raw':!![]}]})[_0xf4fe('0x35')](handleEntityNotFound(_0x40a21d,null))['then'](function(_0xaa0501){if(_0xaa0501){_0x80faf5=_0xaa0501;if(_0xaa0501[_0xf4fe('0x3e')]){if(_[_0xf4fe('0x6e')](_0xf60954[_0xf4fe('0x5b')][_0xf4fe('0x9f')])){_0xf60954[_0xf4fe('0x5b')][_0xf4fe('0x9f')]=util[_0xf4fe('0xa0')](_0xf4fe('0xa1'),_0xaa0501[_0xf4fe('0x3a')],_0xaa0501[_0xf4fe('0x6d')]||_0xaa0501[_0xf4fe('0x3e')][_0xf4fe('0x72')]);}if(_0xf60954['body'][_0xf4fe('0xa2')]&&_0xf60954[_0xf4fe('0x5b')][_0xf4fe('0xa2')][_0xf4fe('0x5a')]){for(var _0xaab267=0x0;_0xaab267<_0xf60954[_0xf4fe('0x5b')][_0xf4fe('0xa2')][_0xf4fe('0x5a')];_0xaab267+=0x1){_0xf60954[_0xf4fe('0x5b')][_0xf4fe('0xa2')][_0xaab267]={'filename':_0xf60954[_0xf4fe('0x5b')][_0xf4fe('0xa2')][_0xaab267][_0xf4fe('0x3a')],'path':path[_0xf4fe('0xa3')](config[_0xf4fe('0xa4')],'server/files/attachments',_0xf60954[_0xf4fe('0x5b')][_0xf4fe('0xa2')][_0xaab267][_0xf4fe('0xa5')])};}}var _0x305d71={'tls':{'rejectUnauthorized':![]}};if(_[_0xf4fe('0x6e')](_0xaa0501['Smtp'][_0xf4fe('0x78')])){if(_0xaa0501[_0xf4fe('0x3e')][_0xf4fe('0x75')]){_0x305d71[_0xf4fe('0xa6')]={'user':_0xaa0501[_0xf4fe('0x3e')][_0xf4fe('0x72')],'pass':_0xaa0501[_0xf4fe('0x3e')]['pass']};}_0x305d71[_0xf4fe('0x76')]=_0xaa0501[_0xf4fe('0x3e')][_0xf4fe('0x76')];_0x305d71[_0xf4fe('0x77')]=_0xaa0501[_0xf4fe('0x3e')][_0xf4fe('0x77')];_0x305d71[_0xf4fe('0xa7')]=_0xaa0501[_0xf4fe('0x3e')][_0xf4fe('0xa7')];}else{_0x305d71[_0xf4fe('0x78')]=_0xaa0501[_0xf4fe('0x3e')][_0xf4fe('0x78')];_0x305d71[_0xf4fe('0xa6')]={'user':_0xaa0501[_0xf4fe('0x3e')]['user'],'pass':_0xaa0501[_0xf4fe('0x3e')][_0xf4fe('0x74')]};}return respondWithRpcPromise(_0xf4fe('0xa8'),_0xf4fe('0xa9'),{'account':_0x305d71,'message':_0xf60954[_0xf4fe('0x5b')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x512c79){if(_0x512c79){_0x546470=_0x512c79;if(_0x80faf5['List']){if(_0x80faf5[_0xf4fe('0x9b')][_0xf4fe('0x9c')][_0xf4fe('0x5a')]){return _0x80faf5['List']['Contacts'][0x0];}else{return db[_0xf4fe('0x87')][_0xf4fe('0x68')](_[_0xf4fe('0x19')](_0xf60954['body'],{'firstName':_0xf60954[_0xf4fe('0x5b')]['to'],'email':_0xf60954[_0xf4fe('0x5b')]['to'],'phone':_0xf60954[_0xf4fe('0x5b')]['to'],'ListId':_0x80faf5[_0xf4fe('0xaa')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xf4fe('0x35')](function(_0x4c72b0){if(_0x4c72b0){var _0x6b0f89={'UserId':_0xf60954[_0xf4fe('0x72')]['id'],'ContactId':_0x4c72b0['id'],'MailAccountId':_0x80faf5['id'],'inReplyTo':_0x546470[_0xf4fe('0xab')],'to':_0xf60954[_0xf4fe('0x5b')][_0xf4fe('0x9f')],'cc':_0xf60954[_0xf4fe('0x5b')]['cc'],'subject':_0xf60954[_0xf4fe('0x5b')][_0xf4fe('0xac')],'attach':_0xf60954[_0xf4fe('0x5b')][_0xf4fe('0xad')],'firstMsgDirection':_0xf4fe('0xae'),'lastMsgAt':moment()[_0xf4fe('0xa0')](_0xf4fe('0x99')),'lastMsgDirection':_0xf4fe('0xae'),'lastMsgBody':_0xf60954['body'][_0xf4fe('0x5b')],'Messages':[_['merge'](_0xf60954['body'],{'messageId':_0x546470['messageId'],'sentAt':moment()[_0xf4fe('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x80faf5['id'],'UserId':_0xf60954[_0xf4fe('0x72')]['id'],'ContactId':_0x4c72b0['id']})]};if(_0xf60954[_0xf4fe('0x5b')][_0xf4fe('0xaf')]){_0x6b0f89=_[_0xf4fe('0x63')](_0x6b0f89,_0xf60954['body'][_0xf4fe('0xaf')]);}return db['MailInteraction'][_0xf4fe('0x68')](_0x6b0f89,{'include':[{'model':db[_0xf4fe('0x96')],'as':'Messages'}]});}})[_0xf4fe('0x35')](respondWithResult(_0x40a21d,null))[_0xf4fe('0x28')](handleError(_0x40a21d,null));};exports[_0xf4fe('0xb0')]=function(_0x3c139a,_0x817e73,_0x4a120a){return db[_0xf4fe('0x40')]['find']({'where':{'id':_0x3c139a[_0xf4fe('0x57')]['id']},'include':[{'model':db[_0xf4fe('0x3d')],'as':_0xf4fe('0x3e'),'raw':!![]}]})[_0xf4fe('0x35')](handleEntityNotFound(_0x817e73,null))[_0xf4fe('0x35')](function(_0xbde4b1){if(_0xbde4b1&&_0xbde4b1['Smtp']){var _0x1d960a={'id':_0xbde4b1['id'],'tls':{'rejectUnauthorized':![]}};if(_0xbde4b1['Smtp']['service']){_0x1d960a[_0xf4fe('0x78')]=_0xbde4b1[_0xf4fe('0x3e')][_0xf4fe('0x78')];}else{_0x1d960a[_0xf4fe('0x76')]=_0xbde4b1['Smtp'][_0xf4fe('0x76')];_0x1d960a[_0xf4fe('0x77')]=_0xbde4b1['Smtp'][_0xf4fe('0x77')];_0x1d960a['secure']=_0xbde4b1[_0xf4fe('0x3e')]['secure'];}if(_0xbde4b1[_0xf4fe('0x3e')][_0xf4fe('0x75')]){_0x1d960a[_0xf4fe('0xa6')]={'user':_0xbde4b1['Smtp']['user'],'pass':_0xbde4b1[_0xf4fe('0x3e')][_0xf4fe('0x74')]};}return respondWithRpcPromise('VerifySmtp',_0xf4fe('0xb0'),{'account':_0x1d960a});}})[_0xf4fe('0x35')](respondWithResult(_0x817e73,null))[_0xf4fe('0x28')](handleError(_0x817e73,null));};exports['destroy']=function(_0x59c53d,_0x457db2){return db[_0xf4fe('0x40')][_0xf4fe('0x5c')]({'where':{'id':_0x59c53d[_0xf4fe('0x57')]['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x457db2,null))[_0xf4fe('0x35')](function(_0x250466){if(_0x250466&&_0x250466[_0xf4fe('0x78')]){throw new db[(_0xf4fe('0xb1'))][(_0xf4fe('0xb2'))](_0xf4fe('0xb3'));}return _0x250466;})['then'](removeEntity(_0x457db2,null))[_0xf4fe('0x28')](handleError(_0x457db2,null));};exports[_0xf4fe('0xb4')]=function(_0x2c7587,_0x3b1389,_0x558246){return db[_0xf4fe('0x40')][_0xf4fe('0x5c')]({'where':{'id':_0x2c7587[_0xf4fe('0x57')]['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x3b1389,null))['then'](function(_0x487f66){if(_0x487f66){return _0x487f66['addAgents'](_0x2c7587[_0xf4fe('0x5b')][_0xf4fe('0x66')],_['omit'](_0x2c7587[_0xf4fe('0x5b')],[_0xf4fe('0x66'),'id'])||{})['spread'](function(_0x6426e1){for(var _0x2524cf=0x0;_0x2524cf<_0x2c7587[_0xf4fe('0x5b')][_0xf4fe('0x66')]['length'];_0x2524cf+=0x1){socket[_0xf4fe('0xb5')]('userMailAccount:save',{'UserId':_0x2c7587[_0xf4fe('0x5b')][_0xf4fe('0x66')][_0x2524cf],'MailAccountId':_0x2c7587[_0xf4fe('0x57')]['id']});}return _0x6426e1;});}})[_0xf4fe('0x35')](respondWithResult(_0x3b1389,null))['catch'](handleError(_0x3b1389,null));};exports[_0xf4fe('0xb6')]=function(_0x134ec7,_0x178cc1,_0x5e8e60){var _0x5d5df8;return db[_0xf4fe('0x40')][_0xf4fe('0x5c')]({'where':{'id':_0x134ec7[_0xf4fe('0x57')]['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x178cc1,null))[_0xf4fe('0x35')](function(_0xc8d814){if(_0xc8d814){return _0xc8d814[_0xf4fe('0xb6')](_0x134ec7[_0xf4fe('0x43')][_0xf4fe('0x66')])[_0xf4fe('0x35')](function(_0x190124){if(_['isArray'](_0x134ec7[_0xf4fe('0x43')]['ids'])){for(var _0x4d85a5=0x0;_0x4d85a5<_0x134ec7[_0xf4fe('0x43')][_0xf4fe('0x66')][_0xf4fe('0x5a')];_0x4d85a5+=0x1){socket['emit']('userMailAccount:remove',{'UserId':_0x134ec7[_0xf4fe('0x43')][_0xf4fe('0x66')][_0x4d85a5],'MailAccountId':_0x134ec7[_0xf4fe('0x57')]['id']});}}else{socket['emit'](_0xf4fe('0xb7'),{'UserId':_0x134ec7[_0xf4fe('0x43')][_0xf4fe('0x66')],'MailAccountId':_0x134ec7[_0xf4fe('0x57')]['id']});}});}})[_0xf4fe('0x35')](respondWithStatusCode(_0x178cc1,null))[_0xf4fe('0x28')](handleError(_0x178cc1,null));};exports['getAgents']=function(_0x4efc39,_0x5203b5,_0x57c76b){var _0x5a4516={};var _0x1bf43a={};var _0x484e10;var _0x4557d;return db[_0xf4fe('0x40')][_0xf4fe('0x6a')]({'where':{'id':_0x4efc39[_0xf4fe('0x57')]['id']}})[_0xf4fe('0x35')](handleEntityNotFound(_0x5203b5,null))[_0xf4fe('0x35')](function(_0x36ee6e){if(_0x36ee6e){_0x484e10=_0x36ee6e;_0x1bf43a[_0xf4fe('0x42')]=_[_0xf4fe('0x59')](db[_0xf4fe('0x88')]['rawAttributes']);_0x1bf43a[_0xf4fe('0x43')]=_[_0xf4fe('0x59')](_0x4efc39[_0xf4fe('0x43')]);_0x1bf43a[_0xf4fe('0x44')]=_[_0xf4fe('0x45')](_0x1bf43a[_0xf4fe('0x42')],_0x1bf43a[_0xf4fe('0x43')]);_0x5a4516[_0xf4fe('0x47')]=_[_0xf4fe('0x45')](_0x1bf43a['model'],qs['fields'](_0x4efc39['query'][_0xf4fe('0x46')]));_0x5a4516[_0xf4fe('0x47')]=_0x5a4516[_0xf4fe('0x47')][_0xf4fe('0x5a')]?_0x5a4516[_0xf4fe('0x47')]:_0x1bf43a['model'];_0x5a4516[_0xf4fe('0x49')]=qs[_0xf4fe('0x4a')](_0x4efc39[_0xf4fe('0x43')][_0xf4fe('0x4a')]);_0x5a4516[_0xf4fe('0x4b')]=qs['filters'](_[_0xf4fe('0x4c')](_0x4efc39[_0xf4fe('0x43')],_0x1bf43a[_0xf4fe('0x44')]));if(_0x4efc39['query']['filter']){_0x5a4516[_0xf4fe('0x4b')]=_[_0xf4fe('0x63')](_0x5a4516[_0xf4fe('0x4b')],{'$or':_[_0xf4fe('0x4d')](_0x5a4516[_0xf4fe('0x47')],function(_0x687a7b){var _0x5c908f={};_0x5c908f[_0x687a7b]={'$like':'%'+_0x4efc39[_0xf4fe('0x43')]['filter']+'%'};return _0x5c908f;})});}_0x5a4516=_['merge']({},_0x5a4516,_0x4efc39[_0xf4fe('0x52')]);return _0x484e10['getAgents'](_0x5a4516);}})['then'](function(_0x5d9b2c){if(_0x5d9b2c){_0x4557d=_0x5d9b2c[_0xf4fe('0x5a')];if(!_0x4efc39[_0xf4fe('0x43')][_0xf4fe('0x6b')](_0xf4fe('0x48'))){_0x5a4516[_0xf4fe('0x2f')]=qs[_0xf4fe('0x2f')](_0x4efc39['query'][_0xf4fe('0x2f')]);_0x5a4516['offset']=qs[_0xf4fe('0x2e')](_0x4efc39[_0xf4fe('0x43')][_0xf4fe('0x2e')]);}return _0x484e10[_0xf4fe('0xb8')](_0x5a4516);}})[_0xf4fe('0x35')](function(_0x5a731d){if(_0x5a731d){return _0x5a731d?{'count':_0x4557d,'rows':_0x5a731d}:null;}})[_0xf4fe('0x35')](respondWithResult(_0x5203b5,null))[_0xf4fe('0x28')](handleError(_0x5203b5,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 8b90745..5980eab 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 _0x2e2c=['exports','events','../../mysqldb','save','update','emit','hasOwnProperty','hook'];(function(_0x2185dc,_0x35a738){var _0x6440f7=function(_0x2bd7cd){while(--_0x2bd7cd){_0x2185dc['push'](_0x2185dc['shift']());}};_0x6440f7(++_0x35a738);}(_0x2e2c,0x89));var _0xc2e2=function(_0x39758d,_0x346423){_0x39758d=_0x39758d-0x0;var _0x44ac11=_0x2e2c[_0x39758d];return _0x44ac11;};'use strict';var EventEmitter=require(_0xc2e2('0x0'));var MailAccount=require(_0xc2e2('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc2e2('0x2'),'afterUpdate':_0xc2e2('0x3'),'afterDestroy':'remove'};function emitEvent(_0xfe8541){return function(_0x2e837a,_0x3f392b,_0x5f3888){MailAccountEvents[_0xc2e2('0x4')](_0xfe8541+':'+_0x2e837a['id'],_0x2e837a);MailAccountEvents['emit'](_0xfe8541,_0x2e837a);_0x5f3888(null);};}for(var e in events){if(events[_0xc2e2('0x5')](e)){var event=events[e];MailAccount[_0xc2e2('0x6')](e,emitEvent(event));}}module[_0xc2e2('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x8dfb=['emit','hook','events','MailAccount','save','update'];(function(_0xe2991b,_0x3386ce){var _0x4b13ca=function(_0x35bbc8){while(--_0x35bbc8){_0xe2991b['push'](_0xe2991b['shift']());}};_0x4b13ca(++_0x3386ce);}(_0x8dfb,0x74));var _0xb8df=function(_0x1f4f0b,_0xc6db05){_0x1f4f0b=_0x1f4f0b-0x0;var _0x1be5c2=_0x8dfb[_0x1f4f0b];return _0x1be5c2;};'use strict';var EventEmitter=require(_0xb8df('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xb8df('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8df('0x2'),'afterUpdate':_0xb8df('0x3'),'afterDestroy':'remove'};function emitEvent(_0x9270d9){return function(_0x2619b7,_0x41ca92,_0x3ce71f){MailAccountEvents[_0xb8df('0x4')](_0x9270d9+':'+_0x2619b7['id'],_0x2619b7);MailAccountEvents['emit'](_0x9270d9,_0x2619b7);_0x3ce71f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xb8df('0x5')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 6e51720..33f2cf2 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 _0x45d5=['define','MailAccount','lodash','util','../../config/logger','api','request-promise','./mailAccount.attributes','exports'];(function(_0x20ff64,_0x5c3677){var _0x5580db=function(_0x5a3c4b){while(--_0x5a3c4b){_0x20ff64['push'](_0x20ff64['shift']());}};_0x5580db(++_0x5c3677);}(_0x45d5,0x18e));var _0x545d=function(_0x54096a,_0x59495b){_0x54096a=_0x54096a-0x0;var _0x5ba1f9=_0x45d5[_0x54096a];return _0x5ba1f9;};'use strict';var _=require(_0x545d('0x0'));var util=require(_0x545d('0x1'));var logger=require(_0x545d('0x2'))(_0x545d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x545d('0x4'));var attributes=require(_0x545d('0x5'));module[_0x545d('0x6')]=function(_0x1eed63,_0x4f6ab5){return _0x1eed63[_0x545d('0x7')](_0x545d('0x8'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97b9=['lodash','util','api','bluebird','./mailAccount.attributes','exports','MailAccount','mail_accounts'];(function(_0x3caf1f,_0x26d30b){var _0x41cab7=function(_0x4e9580){while(--_0x4e9580){_0x3caf1f['push'](_0x3caf1f['shift']());}};_0x41cab7(++_0x26d30b);}(_0x97b9,0x110));var _0x997b=function(_0x12a843,_0x11ae0f){_0x12a843=_0x12a843-0x0;var _0x50d8e3=_0x97b9[_0x12a843];return _0x50d8e3;};'use strict';var _=require(_0x997b('0x0'));var util=require(_0x997b('0x1'));var logger=require('../../config/logger')(_0x997b('0x2'));var moment=require('moment');var BPromise=require(_0x997b('0x3'));var rp=require('request-promise');var attributes=require(_0x997b('0x4'));module[_0x997b('0x5')]=function(_0x4b90e9,_0xc1fd59){return _0x4b90e9['define'](_0x997b('0x6'),attributes,{'tableName':_0x997b('0x7'),'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 0c0b877..ccc75ab 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 _0x9dfe=['MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','map','include','model','attributes','then','ShowMailAccount','find','debug','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','Contacts','DESC','Applications','MailServerOut','Smtp','List','get','omit','list','applications','push','length','close','autoclose','*,*,*,*','contact','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','create','Contact\x20not\x20found','spread','update','attach','MailMessage','attachments','originTo','originCc','bcc','Attachment','Attachments','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x588376,_0x4720c9){var _0x18850d=function(_0x185387){while(--_0x185387){_0x588376['push'](_0x588376['shift']());}};_0x18850d(++_0x4720c9);}(_0x9dfe,0x180));var _0xe9df=function(_0x4d59f5,_0x559fed){_0x4d59f5=_0x4d59f5-0x0;var _0x5e22c3=_0x9dfe[_0x4d59f5];return _0x5e22c3;};'use strict';var _=require(_0xe9df('0x0'));var util=require(_0xe9df('0x1'));var moment=require(_0xe9df('0x2'));var BPromise=require(_0xe9df('0x3'));var rs=require(_0xe9df('0x4'));var fs=require('fs');var Redis=require(_0xe9df('0x5'));var db=require(_0xe9df('0x6'))['db'];var utils=require(_0xe9df('0x7'));var logger=require(_0xe9df('0x8'))(_0xe9df('0x9'));var config=require(_0xe9df('0xa'));var jayson=require(_0xe9df('0xb'));var client=jayson[_0xe9df('0xc')]['http']({'port':0x232c});config[_0xe9df('0xd')]=_[_0xe9df('0xe')](config[_0xe9df('0xd')],{'host':_0xe9df('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe9df('0xd')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x58d1ab,_0x1c6066,_0x18f186){return new BPromise(function(_0x29cf31,_0x52b2ac){return client['request'](_0x58d1ab,_0x18f186)['then'](function(_0x48b217){logger['info']('MailAccount,\x20%s,\x20%s',_0x1c6066,'request\x20sent');logger['debug'](_0xe9df('0x10'),_0x1c6066,'request\x20sent',JSON[_0xe9df('0x11')](_0x48b217));if(_0x48b217[_0xe9df('0x12')]){if(_0x48b217['error'][_0xe9df('0x13')]===0x1f4){logger[_0xe9df('0x12')](_0xe9df('0x14'),_0x1c6066,_0x48b217['error'][_0xe9df('0x15')]);return _0x52b2ac(_0x48b217['error'][_0xe9df('0x15')]);}logger[_0xe9df('0x12')]('MailAccount,\x20%s,\x20%s',_0x1c6066,_0x48b217[_0xe9df('0x12')][_0xe9df('0x15')]);return _0x29cf31(_0x48b217[_0xe9df('0x12')]['message']);}else{logger[_0xe9df('0x16')](_0xe9df('0x14'),_0x1c6066,'request\x20sent');_0x29cf31(_0x48b217[_0xe9df('0x17')][_0xe9df('0x15')]);}})[_0xe9df('0x18')](function(_0x562294){logger[_0xe9df('0x12')](_0xe9df('0x14'),_0x1c6066,_0x562294);_0x52b2ac(_0x562294);});});}exports[_0xe9df('0x19')]=function(_0x326889){var _0x19d6c3=this;return new Promise(function(_0x2cf3dd,_0x3ac1b3){return db[_0xe9df('0x1a')][_0xe9df('0x1b')]({'raw':_0x326889[_0xe9df('0x1c')]?_0x326889[_0xe9df('0x1c')][_0xe9df('0x1d')]===undefined?!![]:![]:!![],'where':_0x326889[_0xe9df('0x1c')]?_0x326889[_0xe9df('0x1c')][_0xe9df('0x1e')]||null:null,'attributes':_0x326889[_0xe9df('0x1c')]?_0x326889[_0xe9df('0x1c')]['attributes']||null:null,'limit':_0x326889[_0xe9df('0x1c')]?_0x326889[_0xe9df('0x1c')][_0xe9df('0x1f')]||null:null,'include':_0x326889[_0xe9df('0x1c')]?_0x326889[_0xe9df('0x1c')]['include']?_[_0xe9df('0x20')](_0x326889['options'][_0xe9df('0x21')],function(_0x3082d2){return{'model':db[_0x3082d2[_0xe9df('0x22')]],'as':_0x3082d2['as'],'attributes':_0x3082d2[_0xe9df('0x23')],'include':_0x3082d2['include']?_[_0xe9df('0x20')](_0x3082d2[_0xe9df('0x21')],function(_0x1ce8e6){return{'model':db[_0x1ce8e6[_0xe9df('0x22')]],'as':_0x1ce8e6['as'],'attributes':_0x1ce8e6['attributes'],'include':_0x1ce8e6['include']?_[_0xe9df('0x20')](_0x1ce8e6[_0xe9df('0x21')],function(_0x47c9ef){return{'model':db[_0x47c9ef[_0xe9df('0x22')]],'as':_0x47c9ef['as'],'attributes':_0x47c9ef['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9df('0x24')](function(_0x3a2ffd){logger[_0xe9df('0x16')](_0xe9df('0x19'),_0x326889);logger['debug'](_0xe9df('0x19'),_0x326889,JSON[_0xe9df('0x11')](_0x3a2ffd));_0x2cf3dd(_0x3a2ffd);})[_0xe9df('0x18')](function(_0x254c70){logger[_0xe9df('0x12')](_0xe9df('0x19'),_0x254c70[_0xe9df('0x15')],_0x326889);_0x3ac1b3(_0x19d6c3[_0xe9df('0x12')](0x1f4,_0x254c70[_0xe9df('0x15')]));});});};exports[_0xe9df('0x25')]=function(_0x52e963){var _0x3e0f1c=this;return new Promise(function(_0x1cd7ef,_0x221433){return db[_0xe9df('0x1a')][_0xe9df('0x26')]({'raw':_0x52e963[_0xe9df('0x1c')]?_0x52e963[_0xe9df('0x1c')][_0xe9df('0x1d')]===undefined?!![]:![]:!![],'where':_0x52e963[_0xe9df('0x1c')]?_0x52e963[_0xe9df('0x1c')][_0xe9df('0x1e')]||null:null,'attributes':_0x52e963[_0xe9df('0x1c')]?_0x52e963[_0xe9df('0x1c')][_0xe9df('0x23')]||null:null,'include':_0x52e963[_0xe9df('0x1c')]?_0x52e963['options'][_0xe9df('0x21')]?_[_0xe9df('0x20')](_0x52e963['options'][_0xe9df('0x21')],function(_0x35915e){return{'model':db[_0x35915e[_0xe9df('0x22')]],'as':_0x35915e['as'],'attributes':_0x35915e[_0xe9df('0x23')],'include':_0x35915e[_0xe9df('0x21')]?_[_0xe9df('0x20')](_0x35915e[_0xe9df('0x21')],function(_0x54dd46){return{'model':db[_0x54dd46['model']],'as':_0x54dd46['as'],'attributes':_0x54dd46[_0xe9df('0x23')],'include':_0x54dd46[_0xe9df('0x21')]?_[_0xe9df('0x20')](_0x54dd46[_0xe9df('0x21')],function(_0x4dbc73){return{'model':db[_0x4dbc73[_0xe9df('0x22')]],'as':_0x4dbc73['as'],'attributes':_0x4dbc73[_0xe9df('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe9df('0x24')](function(_0x4e3708){logger[_0xe9df('0x16')](_0xe9df('0x25'),_0x52e963);logger[_0xe9df('0x27')](_0xe9df('0x25'),_0x52e963,JSON[_0xe9df('0x11')](_0x4e3708));_0x1cd7ef(_0x4e3708);})[_0xe9df('0x18')](function(_0x405a5b){logger[_0xe9df('0x12')](_0xe9df('0x25'),_0x405a5b[_0xe9df('0x15')],_0x52e963);_0x221433(_0x3e0f1c[_0xe9df('0x12')](0x1f4,_0x405a5b[_0xe9df('0x15')]));});});};exports[_0xe9df('0x28')]=function(_0x82dfc8){var _0x1cc9e2=this;return new Promise(function(_0x4669f9,_0x5489db){var _0x1ae840={'body':_0x82dfc8[_0xe9df('0x29')],'channel':_0xe9df('0x2a')};var _0x46c321=_[_0xe9df('0x2b')](_[_0xe9df('0x2c')](db[_0xe9df('0x2d')][_0xe9df('0x2e')]),[_0xe9df('0x2f'),_0xe9df('0x30'),_0xe9df('0x31'),_0xe9df('0x32')]);var _0x32afc7=![];if(_0x82dfc8['body']['id']){delete _0x82dfc8[_0xe9df('0x29')]['id'];}if(_[_0xe9df('0x33')](_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x34')])){return _0x5489db(_0x1cc9e2['error'](0x1f4,_0xe9df('0x35')));}if(_['isNil'](_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x29')])||_0x82dfc8['body'][_0xe9df('0x29')]===''){return _0x5489db(_0x1cc9e2[_0xe9df('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xe9df('0x33')](_0x82dfc8['body'][_0xe9df('0x36')])){return _0x5489db(_0x1cc9e2[_0xe9df('0x12')](0x1f4,_0xe9df('0x37')+_0x46c321));}if(!_[_0xe9df('0x38')](_0x46c321,_0x82dfc8['body'][_0xe9df('0x36')])){return _0x5489db(_0x1cc9e2[_0xe9df('0x12')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46c321));}var _0x26dcd7={};_0x26dcd7[_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x36')]]=_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x34')];return db[_0xe9df('0x1a')][_0xe9df('0x26')]({'where':{'id':_0x82dfc8[_0xe9df('0x39')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xe9df('0x2d')],'as':_0xe9df('0x3a'),'where':_0x26dcd7,'limit':0x1,'order':[[_0xe9df('0x30'),_0xe9df('0x3b')]]}]},{'model':db['MailApplication'],'as':_0xe9df('0x3c')},{'model':db[_0xe9df('0x3d')],'as':_0xe9df('0x3e')}]})[_0xe9df('0x24')](function(_0xac7735){if(_0xac7735&&_0xac7735[_0xe9df('0x3f')]){var _0xbb31b5=_0xac7735[_0xe9df('0x40')]({'plain':!![]});_0x1ae840['account']=_[_0xe9df('0x41')](_0xbb31b5,['Applications',_0xe9df('0x3f')]);_0x1ae840['applications']=_0xbb31b5[_0xe9df('0x3c')];_0x1ae840[_0xe9df('0x42')]=_0xbb31b5[_0xe9df('0x3f')];_0x1ae840[_0xe9df('0x43')]=_['orderBy'](_0x1ae840[_0xe9df('0x43')],['priority'],['asc']);if(_0x1ae840[_0xe9df('0x39')]&&_0x1ae840[_0xe9df('0x39')]['autoclose']){_0x1ae840[_0xe9df('0x43')][_0xe9df('0x44')]({'id':0x0,'priority':_0x1ae840[_0xe9df('0x43')][_0xe9df('0x45')]+0x1,'app':_0xe9df('0x46'),'appdata':_0xe9df('0x47'),'interval':_0xe9df('0x48')});}if(_0x1ae840[_0xe9df('0x39')][_0xe9df('0x3c')]){delete _0x1ae840[_0xe9df('0x39')][_0xe9df('0x3c')];}if(_0x1ae840[_0xe9df('0x39')][_0xe9df('0x3f')]){delete _0x1ae840[_0xe9df('0x39')][_0xe9df('0x3f')];}if(_0xbb31b5['List'][_0xe9df('0x3a')][_0xe9df('0x45')]){return _0xbb31b5[_0xe9df('0x3f')][_0xe9df('0x3a')][0x0];}var _0x1ea987=_['defaults'](_0x82dfc8[_0xe9df('0x29')],{'firstName':_0x82dfc8[_0xe9df('0x29')]['from'],'ListId':_0xbb31b5['ListId']});_0x1ea987[_0x82dfc8['body'][_0xe9df('0x36')]]=_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x34')];return db[_0xe9df('0x2d')]['create'](_0x1ea987);}else{throw new Error('List\x20not\x20found');}})[_0xe9df('0x24')](function(_0x1c3d26){_0x1ae840[_0xe9df('0x49')]=_0x1c3d26;if(_0x1c3d26){if(!_0x82dfc8[_0xe9df('0x29')]['message'][_0xe9df('0x4a')]){_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')][_0xe9df('0x4a')]=rs['generate']()+'\x20'+_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')][_0xe9df('0x34')];}var _0x85bea9={'ContactId':_0x1c3d26['id'],'MailAccountId':_0x82dfc8[_0xe9df('0x39')]['id'],'inReplyTo':_0x82dfc8['body']['message'][_0xe9df('0x4a')],'to':_0x82dfc8[_0xe9df('0x29')]['message'][_0xe9df('0x34')],'cc':_0x82dfc8[_0xe9df('0x29')]['message']['cc'],'subject':_0x82dfc8[_0xe9df('0x29')]['message'][_0xe9df('0x4b')],'attach':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')]['attach'],'lastMsgAt':moment()[_0xe9df('0x4c')](_0xe9df('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x29')]};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x82dfc8['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0xe9df('0x4a')],'where':{'messageId':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')]['inReplyTo']}}]})[_0xe9df('0x24')](function(_0x1e8561){if(_0x1e8561){return[_0x1e8561,![]];}return db[_0xe9df('0x4e')][_0xe9df('0x4f')](_0x85bea9)[_0xe9df('0x24')](function(_0x12f270){return[_0x12f270,!![]];});});}else{throw new Error(_0xe9df('0x50'));}})[_0xe9df('0x51')](function(_0x1165af,_0x82d381){if(_0x1165af){_0x32afc7=_0x82d381;if(!_0x82d381){return _0x1165af[_0xe9df('0x52')]({'inReplyTo':_0x82dfc8[_0xe9df('0x29')]['message'][_0xe9df('0x4a')],'to':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')][_0xe9df('0x34')],'cc':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')]['cc'],'subject':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')][_0xe9df('0x4b')],'attach':_0x1165af[_0xe9df('0x53')]?_0x1165af['attach']:_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')][_0xe9df('0x53')],'substatus':null,'substatusAt':moment()[_0xe9df('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xe9df('0x4c')](_0xe9df('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x29')]});}else{return _0x1165af;}}})['then'](function(_0x3f5245){_0x1ae840['interaction']=_0x3f5245['get']({'plain':!![]});_0x1ae840['interaction']['created']=_0x32afc7;return db[_0xe9df('0x54')][_0xe9df('0x4f')]({'body':_0x82dfc8['body'][_0xe9df('0x29')],'MailAccountId':_0x82dfc8[_0xe9df('0x39')]['id'],'MailInteractionId':_0x3f5245['id'],'direction':'in','ContactId':_0x1ae840[_0xe9df('0x49')]['id'],'messageId':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')][_0xe9df('0x4a')],'from':_0x82dfc8['body'][_0xe9df('0x15')][_0xe9df('0x34')],'to':_0x82dfc8['body'][_0xe9df('0x15')]['to'],'cc':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')]['cc'],'subject':_0x82dfc8['body'][_0xe9df('0x15')]['subject'],'attach':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')][_0xe9df('0x53')],'Attachments':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')][_0xe9df('0x55')],'originTo':_0x82dfc8['body']['message'][_0xe9df('0x56')],'originCc':_0x82dfc8[_0xe9df('0x29')][_0xe9df('0x15')][_0xe9df('0x57')],'bcc':_0x82dfc8['body']['message'][_0xe9df('0x58')]},{'include':[{'model':db[_0xe9df('0x59')],'as':_0xe9df('0x5a')}]});})[_0xe9df('0x24')](function(_0x360ce6){_0x1ae840[_0xe9df('0x15')]=_0x360ce6;if(_0x1ae840[_0xe9df('0x5b')][_0xe9df('0x5c')]){return db[_0xe9df('0x5d')][_0xe9df('0x26')]({'attributes':['id',_0xe9df('0x5e')],'where':{'id':_0x1ae840[_0xe9df('0x5b')]['UserId']}})[_0xe9df('0x24')](function(_0x271e4e){if(_0x271e4e){_0x1ae840[_0xe9df('0x43')][_0xe9df('0x5f')]({'id':0x0,'priority':0x0,'app':_0xe9df('0x60'),'appdata':_0x271e4e[_0xe9df('0x5e')]+','+(_0x1ae840['account'][_0xe9df('0x61')]||0xa),'interval':_0xe9df('0x48')});}return respondWithRpcPromise(_0xe9df('0x62'),'startRouting',_0x1ae840);});}return respondWithRpcPromise(_0xe9df('0x62'),_0xe9df('0x63'),_0x1ae840);})['then'](function(_0x1eedde){_0x4669f9(_0x1eedde);})[_0xe9df('0x18')](function(_0x500975){_0x5489db(_0x1cc9e2[_0xe9df('0x12')](0x1f4,_0x500975[_0xe9df('0x15')]));});});}; \ No newline at end of file +var _0x4031=['push','close','*,*,*,*','length','defaults','create','List\x20not\x20found','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','created','contact','attachments','originCc','bcc','Attachments','name','UserId','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailAccount','findAll','options','raw','attributes','limit','include','model','map','GetMailAccount','find','where','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','Applications','MailServerOut','List','get','applications','list','orderBy','priority','autoclose'];(function(_0x21bdc8,_0x173f3b){var _0x2b3214=function(_0x2fd19d){while(--_0x2fd19d){_0x21bdc8['push'](_0x21bdc8['shift']());}};_0x2b3214(++_0x173f3b);}(_0x4031,0x1c1));var _0x1403=function(_0x96878d,_0x2de812){_0x96878d=_0x96878d-0x0;var _0x2c6820=_0x4031[_0x96878d];return _0x2c6820;};'use strict';var _=require(_0x1403('0x0'));var util=require(_0x1403('0x1'));var moment=require(_0x1403('0x2'));var BPromise=require(_0x1403('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1403('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1403('0x5'));var logger=require(_0x1403('0x6'))(_0x1403('0x7'));var config=require(_0x1403('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1403('0x9')][_0x1403('0xa')]({'port':0x232c});config[_0x1403('0xb')]=_['defaults'](config['redis'],{'host':_0x1403('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1403('0xb')]));require(_0x1403('0xd'))[_0x1403('0xe')](socket);function respondWithRpcPromise(_0x47a1d1,_0x5f50b4,_0x59f009){return new BPromise(function(_0x5e8f1d,_0x5d428c){return client[_0x1403('0xf')](_0x47a1d1,_0x59f009)[_0x1403('0x10')](function(_0x2696e5){logger[_0x1403('0x11')](_0x1403('0x12'),_0x5f50b4,_0x1403('0x13'));logger[_0x1403('0x14')](_0x1403('0x15'),_0x5f50b4,'request\x20sent',JSON[_0x1403('0x16')](_0x2696e5));if(_0x2696e5[_0x1403('0x17')]){if(_0x2696e5[_0x1403('0x17')]['code']===0x1f4){logger[_0x1403('0x17')](_0x1403('0x12'),_0x5f50b4,_0x2696e5['error'][_0x1403('0x18')]);return _0x5d428c(_0x2696e5[_0x1403('0x17')][_0x1403('0x18')]);}logger[_0x1403('0x17')](_0x1403('0x12'),_0x5f50b4,_0x2696e5[_0x1403('0x17')][_0x1403('0x18')]);return _0x5e8f1d(_0x2696e5[_0x1403('0x17')][_0x1403('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x5f50b4,_0x1403('0x13'));_0x5e8f1d(_0x2696e5[_0x1403('0x19')][_0x1403('0x18')]);}})[_0x1403('0x1a')](function(_0x251021){logger[_0x1403('0x17')](_0x1403('0x12'),_0x5f50b4,_0x251021);_0x5d428c(_0x251021);});});}exports['GetMailAccount']=function(_0xb1cac8){var _0x438003=this;return new Promise(function(_0x144fc6,_0x90acf7){return db[_0x1403('0x1b')][_0x1403('0x1c')]({'raw':_0xb1cac8[_0x1403('0x1d')]?_0xb1cac8[_0x1403('0x1d')][_0x1403('0x1e')]===undefined?!![]:![]:!![],'where':_0xb1cac8['options']?_0xb1cac8[_0x1403('0x1d')]['where']||null:null,'attributes':_0xb1cac8[_0x1403('0x1d')]?_0xb1cac8[_0x1403('0x1d')][_0x1403('0x1f')]||null:null,'limit':_0xb1cac8['options']?_0xb1cac8[_0x1403('0x1d')][_0x1403('0x20')]||null:null,'include':_0xb1cac8[_0x1403('0x1d')]?_0xb1cac8['options'][_0x1403('0x21')]?_['map'](_0xb1cac8[_0x1403('0x1d')][_0x1403('0x21')],function(_0x59e8a6){return{'model':db[_0x59e8a6[_0x1403('0x22')]],'as':_0x59e8a6['as'],'attributes':_0x59e8a6[_0x1403('0x1f')],'include':_0x59e8a6[_0x1403('0x21')]?_[_0x1403('0x23')](_0x59e8a6[_0x1403('0x21')],function(_0x30d6f3){return{'model':db[_0x30d6f3[_0x1403('0x22')]],'as':_0x30d6f3['as'],'attributes':_0x30d6f3[_0x1403('0x1f')],'include':_0x30d6f3[_0x1403('0x21')]?_[_0x1403('0x23')](_0x30d6f3[_0x1403('0x21')],function(_0x369412){return{'model':db[_0x369412['model']],'as':_0x369412['as'],'attributes':_0x369412['attributes']};}):[]};}):[]};}):[]:[]})[_0x1403('0x10')](function(_0x274ed5){logger[_0x1403('0x11')]('GetMailAccount',_0xb1cac8);logger[_0x1403('0x14')](_0x1403('0x24'),_0xb1cac8,JSON['stringify'](_0x274ed5));_0x144fc6(_0x274ed5);})[_0x1403('0x1a')](function(_0x2f27f7){logger['error']('GetMailAccount',_0x2f27f7[_0x1403('0x18')],_0xb1cac8);_0x90acf7(_0x438003['error'](0x1f4,_0x2f27f7[_0x1403('0x18')]));});});};exports['ShowMailAccount']=function(_0x5a73f0){var _0x561228=this;return new Promise(function(_0x39b968,_0x5a3cd0){return db[_0x1403('0x1b')][_0x1403('0x25')]({'raw':_0x5a73f0[_0x1403('0x1d')]?_0x5a73f0[_0x1403('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5a73f0[_0x1403('0x1d')]?_0x5a73f0[_0x1403('0x1d')][_0x1403('0x26')]||null:null,'attributes':_0x5a73f0[_0x1403('0x1d')]?_0x5a73f0['options'][_0x1403('0x1f')]||null:null,'include':_0x5a73f0[_0x1403('0x1d')]?_0x5a73f0[_0x1403('0x1d')]['include']?_['map'](_0x5a73f0[_0x1403('0x1d')]['include'],function(_0x5dd899){return{'model':db[_0x5dd899[_0x1403('0x22')]],'as':_0x5dd899['as'],'attributes':_0x5dd899[_0x1403('0x1f')],'include':_0x5dd899[_0x1403('0x21')]?_['map'](_0x5dd899[_0x1403('0x21')],function(_0x564043){return{'model':db[_0x564043[_0x1403('0x22')]],'as':_0x564043['as'],'attributes':_0x564043['attributes'],'include':_0x564043['include']?_[_0x1403('0x23')](_0x564043['include'],function(_0x1dd283){return{'model':db[_0x1dd283[_0x1403('0x22')]],'as':_0x1dd283['as'],'attributes':_0x1dd283[_0x1403('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1403('0x10')](function(_0x2bc69c){logger[_0x1403('0x11')](_0x1403('0x27'),_0x5a73f0);logger[_0x1403('0x14')](_0x1403('0x27'),_0x5a73f0,JSON[_0x1403('0x16')](_0x2bc69c));_0x39b968(_0x2bc69c);})[_0x1403('0x1a')](function(_0x45e3e1){logger[_0x1403('0x17')]('ShowMailAccount',_0x45e3e1['message'],_0x5a73f0);_0x5a3cd0(_0x561228['error'](0x1f4,_0x45e3e1[_0x1403('0x18')]));});});};exports[_0x1403('0x28')]=function(_0x4d0065){var _0x40b922=this;return new Promise(function(_0x5d27e9,_0x5e4849){var _0x1d391a={'body':_0x4d0065[_0x1403('0x29')],'channel':_0x1403('0x2a')};var _0x2a17c5=_[_0x1403('0x2b')](_[_0x1403('0x2c')](db[_0x1403('0x2d')]['rawAttributes']),[_0x1403('0x2e'),_0x1403('0x2f'),_0x1403('0x30'),_0x1403('0x31')]);var _0x15b156=![];if(_0x4d0065[_0x1403('0x29')]['id']){delete _0x4d0065[_0x1403('0x29')]['id'];}if(_[_0x1403('0x32')](_0x4d0065[_0x1403('0x29')][_0x1403('0x33')])){return _0x5e4849(_0x40b922[_0x1403('0x17')](0x1f4,_0x1403('0x34')));}if(_[_0x1403('0x32')](_0x4d0065[_0x1403('0x29')]['body'])||_0x4d0065[_0x1403('0x29')]['body']===''){return _0x5e4849(_0x40b922[_0x1403('0x17')](0x1f4,_0x1403('0x35')));}if(_[_0x1403('0x32')](_0x4d0065[_0x1403('0x29')]['mapKey'])){return _0x5e4849(_0x40b922['error'](0x1f4,_0x1403('0x36')+_0x2a17c5));}if(!_[_0x1403('0x37')](_0x2a17c5,_0x4d0065[_0x1403('0x29')][_0x1403('0x38')])){return _0x5e4849(_0x40b922[_0x1403('0x17')](0x1f4,_0x1403('0x39')+_0x2a17c5));}var _0x3abeeb={};_0x3abeeb[_0x4d0065[_0x1403('0x29')][_0x1403('0x38')]]=_0x4d0065[_0x1403('0x29')][_0x1403('0x33')];return db['MailAccount'][_0x1403('0x25')]({'where':{'id':_0x4d0065[_0x1403('0x3a')]['id']},'include':[{'model':db[_0x1403('0x3b')],'as':'List','include':[{'model':db['CmContact'],'as':_0x1403('0x3c'),'where':_0x3abeeb,'limit':0x1,'order':[[_0x1403('0x2f'),_0x1403('0x3d')]]}]},{'model':db['MailApplication'],'as':_0x1403('0x3e')},{'model':db[_0x1403('0x3f')],'as':'Smtp'}]})[_0x1403('0x10')](function(_0x4cb483){if(_0x4cb483&&_0x4cb483[_0x1403('0x40')]){var _0x26bcab=_0x4cb483[_0x1403('0x41')]({'plain':!![]});_0x1d391a['account']=_['omit'](_0x26bcab,['Applications','List']);_0x1d391a[_0x1403('0x42')]=_0x26bcab[_0x1403('0x3e')];_0x1d391a[_0x1403('0x43')]=_0x26bcab[_0x1403('0x40')];_0x1d391a[_0x1403('0x42')]=_[_0x1403('0x44')](_0x1d391a['applications'],[_0x1403('0x45')],['asc']);if(_0x1d391a['account']&&_0x1d391a['account'][_0x1403('0x46')]){_0x1d391a[_0x1403('0x42')][_0x1403('0x47')]({'id':0x0,'priority':_0x1d391a[_0x1403('0x42')]['length']+0x1,'app':_0x1403('0x48'),'appdata':_0x1403('0x46'),'interval':_0x1403('0x49')});}if(_0x1d391a[_0x1403('0x3a')][_0x1403('0x3e')]){delete _0x1d391a['account'][_0x1403('0x3e')];}if(_0x1d391a[_0x1403('0x3a')][_0x1403('0x40')]){delete _0x1d391a['account']['List'];}if(_0x26bcab['List'][_0x1403('0x3c')][_0x1403('0x4a')]){return _0x26bcab[_0x1403('0x40')][_0x1403('0x3c')][0x0];}var _0x2a1f43=_[_0x1403('0x4b')](_0x4d0065[_0x1403('0x29')],{'firstName':_0x4d0065[_0x1403('0x29')][_0x1403('0x33')],'ListId':_0x26bcab['ListId']});_0x2a1f43[_0x4d0065[_0x1403('0x29')][_0x1403('0x38')]]=_0x4d0065[_0x1403('0x29')][_0x1403('0x33')];return db[_0x1403('0x2d')][_0x1403('0x4c')](_0x2a1f43);}else{throw new Error(_0x1403('0x4d'));}})[_0x1403('0x10')](function(_0x393f29){_0x1d391a['contact']=_0x393f29;if(_0x393f29){if(!_0x4d0065['body']['message'][_0x1403('0x4e')]){_0x4d0065[_0x1403('0x29')][_0x1403('0x18')]['messageId']=rs[_0x1403('0x4f')]()+'\x20'+_0x4d0065[_0x1403('0x29')][_0x1403('0x18')][_0x1403('0x33')];}var _0x28176c={'ContactId':_0x393f29['id'],'MailAccountId':_0x4d0065[_0x1403('0x3a')]['id'],'inReplyTo':_0x4d0065[_0x1403('0x29')][_0x1403('0x18')][_0x1403('0x4e')],'to':_0x4d0065[_0x1403('0x29')][_0x1403('0x18')][_0x1403('0x33')],'cc':_0x4d0065['body']['message']['cc'],'subject':_0x4d0065['body'][_0x1403('0x18')][_0x1403('0x50')],'attach':_0x4d0065['body']['message'][_0x1403('0x51')],'lastMsgAt':moment()['format'](_0x1403('0x52')),'lastMsgDirection':'in','lastMsgBody':_0x4d0065[_0x1403('0x29')][_0x1403('0x29')]};return db[_0x1403('0x53')][_0x1403('0x25')]({'where':{'closed':![],'MailAccountId':_0x4d0065[_0x1403('0x3a')]['id']},'include':[{'model':db[_0x1403('0x54')],'as':_0x1403('0x55'),'attributes':[_0x1403('0x4e')],'where':{'messageId':_0x4d0065[_0x1403('0x29')][_0x1403('0x18')][_0x1403('0x56')]}}]})['then'](function(_0x4cd97e){if(_0x4cd97e){return[_0x4cd97e,![]];}return db[_0x1403('0x53')][_0x1403('0x4c')](_0x28176c)['then'](function(_0x432821){return[_0x432821,!![]];});});}else{throw new Error(_0x1403('0x57'));}})[_0x1403('0x58')](function(_0x20bf72,_0x36a97e){if(_0x20bf72){_0x15b156=_0x36a97e;if(!_0x36a97e){return _0x20bf72[_0x1403('0x59')]({'inReplyTo':_0x4d0065['body'][_0x1403('0x18')][_0x1403('0x4e')],'to':_0x4d0065[_0x1403('0x29')]['message'][_0x1403('0x33')],'cc':_0x4d0065[_0x1403('0x29')][_0x1403('0x18')]['cc'],'subject':_0x4d0065['body'][_0x1403('0x18')][_0x1403('0x50')],'attach':_0x20bf72[_0x1403('0x51')]?_0x20bf72[_0x1403('0x51')]:_0x4d0065[_0x1403('0x29')][_0x1403('0x18')][_0x1403('0x51')],'substatus':null,'substatusAt':moment()[_0x1403('0x5a')](_0x1403('0x52')),'lastMsgAt':moment()[_0x1403('0x5a')](_0x1403('0x52')),'lastMsgDirection':'in','lastMsgBody':_0x4d0065[_0x1403('0x29')][_0x1403('0x29')]});}else{return _0x20bf72;}}})[_0x1403('0x10')](function(_0x2441b4){_0x1d391a['interaction']=_0x2441b4[_0x1403('0x41')]({'plain':!![]});_0x1d391a[_0x1403('0x5b')][_0x1403('0x5c')]=_0x15b156;return db[_0x1403('0x54')][_0x1403('0x4c')]({'body':_0x4d0065[_0x1403('0x29')][_0x1403('0x29')],'MailAccountId':_0x4d0065[_0x1403('0x3a')]['id'],'MailInteractionId':_0x2441b4['id'],'direction':'in','ContactId':_0x1d391a[_0x1403('0x5d')]['id'],'messageId':_0x4d0065[_0x1403('0x29')][_0x1403('0x18')][_0x1403('0x4e')],'from':_0x4d0065[_0x1403('0x29')][_0x1403('0x18')]['from'],'to':_0x4d0065[_0x1403('0x29')]['message']['to'],'cc':_0x4d0065[_0x1403('0x29')]['message']['cc'],'subject':_0x4d0065['body']['message'][_0x1403('0x50')],'attach':_0x4d0065[_0x1403('0x29')][_0x1403('0x18')][_0x1403('0x51')],'Attachments':_0x4d0065[_0x1403('0x29')]['message'][_0x1403('0x5e')],'originTo':_0x4d0065[_0x1403('0x29')][_0x1403('0x18')]['originTo'],'originCc':_0x4d0065['body'][_0x1403('0x18')][_0x1403('0x5f')],'bcc':_0x4d0065[_0x1403('0x29')]['message'][_0x1403('0x60')]},{'include':[{'model':db['Attachment'],'as':_0x1403('0x61')}]});})[_0x1403('0x10')](function(_0x2c9319){_0x1d391a[_0x1403('0x18')]=_0x2c9319;if(_0x1d391a[_0x1403('0x5b')]['UserId']){return db['User'][_0x1403('0x25')]({'attributes':['id',_0x1403('0x62')],'where':{'id':_0x1d391a[_0x1403('0x5b')][_0x1403('0x63')]}})[_0x1403('0x10')](function(_0x8aa9e8){if(_0x8aa9e8){_0x1d391a[_0x1403('0x42')][_0x1403('0x64')]({'id':0x0,'priority':0x0,'app':_0x1403('0x65'),'appdata':_0x8aa9e8[_0x1403('0x62')]+','+(_0x1d391a[_0x1403('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':_0x1403('0x49')});}return respondWithRpcPromise(_0x1403('0x66'),'startRouting',_0x1d391a);});}return respondWithRpcPromise(_0x1403('0x66'),_0x1403('0x67'),_0x1d391a);})[_0x1403('0x10')](function(_0xda8037){_0x5d27e9(_0xda8037);})[_0x1403('0x1a')](function(_0xe28a97){_0x5e4849(_0x40b922[_0x1403('0x17')](0x1f4,_0xe28a97['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index e57e993..41a6df2 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 _0x9272=['removeListener','length','mailAccount:','./mailAccount.events','save','remove','emit'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9272,0x96));var _0x2927=function(_0x2685cc,_0x59f8d1){_0x2685cc=_0x2685cc-0x0;var _0x142a6a=_0x9272[_0x2685cc];return _0x142a6a;};'use strict';var MailAccountEvents=require(_0x2927('0x0'));var events=[_0x2927('0x1'),_0x2927('0x2'),'update'];function createListener(_0x136646,_0x311f0c){return function(_0xe245a5){_0x311f0c[_0x2927('0x3')](_0x136646,_0xe245a5);};}function removeListener(_0x5a4367,_0x2ea5f9){return function(){MailAccountEvents[_0x2927('0x4')](_0x5a4367,_0x2ea5f9);};}exports['register']=function(_0x582a96){for(var _0x201fe9=0x0,_0x3b3039=events[_0x2927('0x5')];_0x201fe9<_0x3b3039;_0x201fe9++){var _0x3a8e66=events[_0x201fe9];var _0x28d749=createListener(_0x2927('0x6')+_0x3a8e66,_0x582a96);MailAccountEvents['on'](_0x3a8e66,_0x28d749);}}; \ No newline at end of file +var _0x64a6=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0x568363,_0x2e79a7){var _0x47f0ed=function(_0x7d922b){while(--_0x7d922b){_0x568363['push'](_0x568363['shift']());}};_0x47f0ed(++_0x2e79a7);}(_0x64a6,0x76));var _0x664a=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x64a6[_0x413feb];return _0x40ee88;};'use strict';var MailAccountEvents=require(_0x664a('0x0'));var events=['save','remove',_0x664a('0x1')];function createListener(_0x541505,_0x55c40b){return function(_0xf18960){_0x55c40b[_0x664a('0x2')](_0x541505,_0xf18960);};}function removeListener(_0x886063,_0x39d1ca){return function(){MailAccountEvents[_0x664a('0x3')](_0x886063,_0x39d1ca);};}exports[_0x664a('0x4')]=function(_0x40a7c9){for(var _0x2ca027=0x0,_0x49f223=events[_0x664a('0x5')];_0x2ca027<_0x49f223;_0x2ca027++){var _0xff04d5=events[_0x2ca027];var _0x44ed9e=createListener(_0x664a('0x6')+_0xff04d5,_0x40a7c9);MailAccountEvents['on'](_0xff04d5,_0x44ed9e);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index cc81de8..2f92566 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 _0x76dc=['../../config/environment','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x76dc,0x1f2));var _0xc76d=function(_0x243b12,_0x2d29a4){_0x243b12=_0x243b12-0x0;var _0x2e8210=_0x76dc[_0x243b12];return _0x2e8210;};'use strict';var multer=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var path=require(_0xc76d('0x2'));var timeout=require(_0xc76d('0x3'));var express=require('express');var router=express[_0xc76d('0x4')]();var auth=require(_0xc76d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc76d('0x6'));var controller=require('./mailApplication.controller');router['get'](_0xc76d('0x7'),auth[_0xc76d('0x8')](),controller[_0xc76d('0x9')]);router['put']('/:id',auth[_0xc76d('0x8')](),controller[_0xc76d('0xa')]);router[_0xc76d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xc76d('0xc')]);module[_0xc76d('0xd')]=router; \ No newline at end of file +var _0x9aea=['Router','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','update','delete','isAuthenticated','destroy','exports','multer','path','express'];(function(_0x3e5e34,_0xc22f9d){var _0x16999e=function(_0xf0c3be){while(--_0xf0c3be){_0x3e5e34['push'](_0x3e5e34['shift']());}};_0x16999e(++_0xc22f9d);}(_0x9aea,0xdd));var _0xa9ae=function(_0x506569,_0x423fe7){_0x506569=_0x506569-0x0;var _0x50a14c=_0x9aea[_0x506569];return _0x50a14c;};'use strict';var multer=require(_0xa9ae('0x0'));var util=require('util');var path=require(_0xa9ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xa9ae('0x2'));var router=express[_0xa9ae('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa9ae('0x4'));var config=require(_0xa9ae('0x5'));var controller=require(_0xa9ae('0x6'));router[_0xa9ae('0x7')](_0xa9ae('0x8'),auth['isAuthenticated'](),controller[_0xa9ae('0x9')]);router[_0xa9ae('0xa')](_0xa9ae('0x8'),auth['isAuthenticated'](),controller[_0xa9ae('0xb')]);router[_0xa9ae('0xc')](_0xa9ae('0x8'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0xe')]);module[_0xa9ae('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 6aaf603..4259ddd 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 _0x2a82=['TEXT','STRING','*,*,*,*','INTEGER'];(function(_0xcd2266,_0xb5ae46){var _0x299e37=function(_0x3448d8){while(--_0x3448d8){_0xcd2266['push'](_0xcd2266['shift']());}};_0x299e37(++_0xb5ae46);}(_0x2a82,0xb3));var _0x22a8=function(_0x2fdd1a,_0x389cbc){_0x2fdd1a=_0x2fdd1a-0x0;var _0x25827c=_0x2a82[_0x2fdd1a];return _0x25827c;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x22a8('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x22a8('0x1')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x22a8('0x2')],'defaultValue':_0x22a8('0x3')}}; \ No newline at end of file +var _0xf9b7=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x20ecaf,_0x264364){var _0x2cbaf3=function(_0x1793ff){while(--_0x1793ff){_0x20ecaf['push'](_0x20ecaf['shift']());}};_0x2cbaf3(++_0x264364);}(_0xf9b7,0x91));var _0x7f9b=function(_0x367db5,_0x435a3a){_0x367db5=_0x367db5-0x0;var _0x23aee8=_0xf9b7[_0x367db5];return _0x23aee8;};'use strict';var Sequelize=require(_0x7f9b('0x0'));module[_0x7f9b('0x1')]={'priority':{'type':Sequelize[_0x7f9b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7f9b('0x3')],'allowNull':![],'defaultValue':_0x7f9b('0x4')},'appdata':{'type':Sequelize[_0x7f9b('0x5')]()},'description':{'type':Sequelize[_0x7f9b('0x3')]},'interval':{'type':Sequelize[_0x7f9b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 849e37c..cda7352 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 _0xa9e0=['Content-Range','apply','reject','save','then','error','stack','send','show','params','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','merge','find','catch','body','destroy','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x1a8813,_0x286e5a){var _0x2d8353=function(_0x47d195){while(--_0x47d195){_0x1a8813['push'](_0x1a8813['shift']());}};_0x2d8353(++_0x286e5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=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={'raw':!![],'where':{'id':_0x33161b[_0x0a9e('0x24')]['id']}},_0x479bc4={};_0x479bc4['model']=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x479bc4[_0x0a9e('0x28')]=_[_0x0a9e('0x25')](_0x33161b[_0x0a9e('0x28')]);_0x479bc4[_0x0a9e('0x29')]=_[_0x0a9e('0x2a')](_0x479bc4['model'],_0x479bc4[_0x0a9e('0x28')]);_0x384319[_0x0a9e('0x2b')]=_[_0x0a9e('0x2a')](_0x479bc4[_0x0a9e('0x2c')],qs['fields'](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2d')]));_0x384319[_0x0a9e('0x2b')]=_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x2e')]?_0x384319[_0x0a9e('0x2b')]:_0x479bc4[_0x0a9e('0x2c')];if(_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2f')]){_0x384319['include']=[{'all':!![]}];}_0x384319=_[_0x0a9e('0x30')]({},_0x384319,_0x33161b['options']);return db[_0x0a9e('0x26')][_0x0a9e('0x31')](_0x384319)[_0x0a9e('0x1f')](handleEntityNotFound(_0x526cf3,null))[_0x0a9e('0x1f')](respondWithResult(_0x526cf3,null))[_0x0a9e('0x32')](handleError(_0x526cf3,null));};exports['update']=function(_0x66c1d2,_0x46f0a5){if(_0x66c1d2[_0x0a9e('0x33')]['id']){delete _0x66c1d2[_0x0a9e('0x33')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x31')]({'where':{'id':_0x66c1d2[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x46f0a5,null))['then'](saveUpdates(_0x66c1d2[_0x0a9e('0x33')],null))['then'](respondWithResult(_0x46f0a5,null))[_0x0a9e('0x32')](handleError(_0x46f0a5,null));};exports[_0x0a9e('0x34')]=function(_0x2b7e7f,_0x3f3d41){return db['MailApplication'][_0x0a9e('0x31')]({'where':{'id':_0x2b7e7f[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x3f3d41,null))[_0x0a9e('0x1f')](removeEntity(_0x3f3d41,null))['catch'](handleError(_0x3f3d41,null));}; \ No newline at end of file +var _0xa9e0=['Content-Range','apply','reject','save','then','error','stack','send','show','params','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','merge','find','catch','body','destroy','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x227bfd,_0x17045b){var _0xdc1fed=function(_0x226979){while(--_0x226979){_0x227bfd['push'](_0x227bfd['shift']());}};_0xdc1fed(++_0x17045b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=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={'raw':!![],'where':{'id':_0x33161b[_0x0a9e('0x24')]['id']}},_0x479bc4={};_0x479bc4['model']=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x479bc4[_0x0a9e('0x28')]=_[_0x0a9e('0x25')](_0x33161b[_0x0a9e('0x28')]);_0x479bc4[_0x0a9e('0x29')]=_[_0x0a9e('0x2a')](_0x479bc4['model'],_0x479bc4[_0x0a9e('0x28')]);_0x384319[_0x0a9e('0x2b')]=_[_0x0a9e('0x2a')](_0x479bc4[_0x0a9e('0x2c')],qs['fields'](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2d')]));_0x384319[_0x0a9e('0x2b')]=_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x2e')]?_0x384319[_0x0a9e('0x2b')]:_0x479bc4[_0x0a9e('0x2c')];if(_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2f')]){_0x384319['include']=[{'all':!![]}];}_0x384319=_[_0x0a9e('0x30')]({},_0x384319,_0x33161b['options']);return db[_0x0a9e('0x26')][_0x0a9e('0x31')](_0x384319)[_0x0a9e('0x1f')](handleEntityNotFound(_0x526cf3,null))[_0x0a9e('0x1f')](respondWithResult(_0x526cf3,null))[_0x0a9e('0x32')](handleError(_0x526cf3,null));};exports['update']=function(_0x66c1d2,_0x46f0a5){if(_0x66c1d2[_0x0a9e('0x33')]['id']){delete _0x66c1d2[_0x0a9e('0x33')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x31')]({'where':{'id':_0x66c1d2[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x46f0a5,null))['then'](saveUpdates(_0x66c1d2[_0x0a9e('0x33')],null))['then'](respondWithResult(_0x46f0a5,null))[_0x0a9e('0x32')](handleError(_0x46f0a5,null));};exports[_0x0a9e('0x34')]=function(_0x2b7e7f,_0x3f3d41){return db['MailApplication'][_0x0a9e('0x31')]({'where':{'id':_0x2b7e7f[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x3f3d41,null))[_0x0a9e('0x1f')](removeEntity(_0x3f3d41,null))['catch'](handleError(_0x3f3d41,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 888934c..b9bc3d9 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 _0x1120=['moment','bluebird','request-promise','./mailApplication.attributes','exports','MailApplication','lodash','util','api'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x1120,0x11d));var _0x0112=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x1120[_0x1aba25];return _0x47d997;};'use strict';var _=require(_0x0112('0x0'));var util=require(_0x0112('0x1'));var logger=require('../../config/logger')(_0x0112('0x2'));var moment=require(_0x0112('0x3'));var BPromise=require(_0x0112('0x4'));var rp=require(_0x0112('0x5'));var attributes=require(_0x0112('0x6'));module[_0x0112('0x7')]=function(_0x3fa5f8,_0x46515c){return _0x3fa5f8['define'](_0x0112('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6564=['MailApplication','mail_applications','util','../../config/logger','api','bluebird','request-promise','./mailApplication.attributes','exports','define'];(function(_0x2792ea,_0x4970cb){var _0x373e89=function(_0x892cd6){while(--_0x892cd6){_0x2792ea['push'](_0x2792ea['shift']());}};_0x373e89(++_0x4970cb);}(_0x6564,0x1a6));var _0x4656=function(_0x48c30e,_0x1cff95){_0x48c30e=_0x48c30e-0x0;var _0x388ed5=_0x6564[_0x48c30e];return _0x388ed5;};'use strict';var _=require('lodash');var util=require(_0x4656('0x0'));var logger=require(_0x4656('0x1'))(_0x4656('0x2'));var moment=require('moment');var BPromise=require(_0x4656('0x3'));var rp=require(_0x4656('0x4'));var attributes=require(_0x4656('0x5'));module[_0x4656('0x6')]=function(_0x13ee51,_0x5bb4dd){return _0x13ee51[_0x4656('0x7')](_0x4656('0x8'),attributes,{'tableName':_0x4656('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 32fc571..51c9820 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 _0x7a54=['message','request\x20sent','result','catch','MailApplication','update','body','options','raw','where','attributes','limit','then','UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailApplication,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x390996,_0x324169){var _0x4357dd=function(_0x1baac8){while(--_0x1baac8){_0x390996['push'](_0x390996['shift']());}};_0x4357dd(++_0x324169);}(_0x7a54,0x106));var _0x47a5=function(_0xfb63f0,_0x27b2cc){_0xfb63f0=_0xfb63f0-0x0;var _0x4110b4=_0x7a54[_0xfb63f0];return _0x4110b4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['UpdateMailApplication']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1a')]||null:null,'attributes':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1b')]||null:null,'limit':_0x5247fd[_0x47a5('0x18')]?_0x5247fd['options'][_0x47a5('0x1c')]||null:null})[_0x47a5('0x1d')](function(_0x23db32){logger[_0x47a5('0xb')]('UpdateMailApplication',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON['stringify'](_0x23db32));_0xaf70a6(_0x23db32);})[_0x47a5('0x14')](function(_0xc4cd63){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0xc4cd63[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xc4cd63['message']));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','MailApplication','update','body','options','raw','where','attributes','limit','then','UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailApplication,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x3d085e,_0x22770f){var _0x49f193=function(_0x53e14a){while(--_0x53e14a){_0x3d085e['push'](_0x3d085e['shift']());}};_0x49f193(++_0x22770f);}(_0x7a54,0x106));var _0x47a5=function(_0x5320d3,_0x1aa77f){_0x5320d3=_0x5320d3-0x0;var _0x833c1b=_0x7a54[_0x5320d3];return _0x833c1b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['UpdateMailApplication']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1a')]||null:null,'attributes':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1b')]||null:null,'limit':_0x5247fd[_0x47a5('0x18')]?_0x5247fd['options'][_0x47a5('0x1c')]||null:null})[_0x47a5('0x1d')](function(_0x23db32){logger[_0x47a5('0xb')]('UpdateMailApplication',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON['stringify'](_0x23db32));_0xaf70a6(_0x23db32);})[_0x47a5('0x14')](function(_0xc4cd63){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0xc4cd63[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xc4cd63['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 65d310a..1134f42 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 _0x04e1=['tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0xd06063,_0x2d9035){var _0x4dc9dd=function(_0x4e2dd2){while(--_0x4e2dd2){_0xd06063['push'](_0xd06063['shift']());}};_0x4dc9dd(++_0x2d9035);}(_0x04e1,0xeb));var _0x104e=function(_0x4c35c,_0x4e0364){_0x4c35c=_0x4c35c-0x0;var _0x519130=_0x04e1[_0x4c35c];return _0x519130;};'use strict';var multer=require(_0x104e('0x0'));var util=require(_0x104e('0x1'));var path=require(_0x104e('0x2'));var timeout=require(_0x104e('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x104e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x104e('0x5'));var controller=require(_0x104e('0x6'));router[_0x104e('0x7')]('/',auth['isAuthenticated'](),controller[_0x104e('0x8')]);router[_0x104e('0x7')](_0x104e('0x9'),auth[_0x104e('0xa')](),controller[_0x104e('0xb')]);router['get'](_0x104e('0xc'),auth[_0x104e('0xa')](),controller[_0x104e('0xd')]);router[_0x104e('0x7')](_0x104e('0xe'),auth[_0x104e('0xa')](),controller['getMessages']);router[_0x104e('0x7')](_0x104e('0xf'),auth[_0x104e('0xa')](),controller[_0x104e('0x10')]);router[_0x104e('0x11')]('/',auth[_0x104e('0xa')](),controller[_0x104e('0x12')]);router[_0x104e('0x11')](_0x104e('0xe'),auth[_0x104e('0xa')](),controller[_0x104e('0x13')]);router[_0x104e('0x11')](_0x104e('0x14'),auth[_0x104e('0xa')](),interaction[_0x104e('0x15')](_0x104e('0x16'),'mailinteraction:addtags'),controller[_0x104e('0x17')]);router[_0x104e('0x18')](_0x104e('0xc'),auth[_0x104e('0xa')](),interaction['tracked'](_0x104e('0x16'),_0x104e('0x19')),controller[_0x104e('0x1a')]);router[_0x104e('0x1b')]('/:id',auth[_0x104e('0xa')](),interaction[_0x104e('0x15')](_0x104e('0x16'),_0x104e('0x1c')),controller[_0x104e('0x1d')]);router[_0x104e('0x1b')](_0x104e('0x14'),auth[_0x104e('0xa')](),controller[_0x104e('0x1e')]);module[_0x104e('0x1f')]=router; \ No newline at end of file +var _0xc175=['removeTags','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy'];(function(_0x485d2f,_0x45faf6){var _0x2efaa2=function(_0x1848eb){while(--_0x1848eb){_0x485d2f['push'](_0x485d2f['shift']());}};_0x2efaa2(++_0x45faf6);}(_0xc175,0xe9));var _0x5c17=function(_0x3f2d13,_0x4a5982){_0x3f2d13=_0x3f2d13-0x0;var _0x1ca226=_0xc175[_0x3f2d13];return _0x1ca226;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c17('0x0'));var timeout=require(_0x5c17('0x1'));var express=require(_0x5c17('0x2'));var router=express[_0x5c17('0x3')]();var auth=require(_0x5c17('0x4'));var interaction=require(_0x5c17('0x5'));var config=require(_0x5c17('0x6'));var controller=require(_0x5c17('0x7'));router[_0x5c17('0x8')]('/',auth[_0x5c17('0x9')](),controller[_0x5c17('0xa')]);router[_0x5c17('0x8')](_0x5c17('0xb'),auth[_0x5c17('0x9')](),controller[_0x5c17('0xc')]);router['get'](_0x5c17('0xd'),auth[_0x5c17('0x9')](),controller[_0x5c17('0xe')]);router[_0x5c17('0x8')](_0x5c17('0xf'),auth[_0x5c17('0x9')](),controller[_0x5c17('0x10')]);router[_0x5c17('0x8')]('/:id/download',auth[_0x5c17('0x9')](),controller[_0x5c17('0x11')]);router[_0x5c17('0x12')]('/',auth[_0x5c17('0x9')](),controller[_0x5c17('0x13')]);router['post'](_0x5c17('0xf'),auth[_0x5c17('0x9')](),controller['addMessage']);router[_0x5c17('0x12')](_0x5c17('0x14'),auth[_0x5c17('0x9')](),interaction['tracked'](_0x5c17('0x15'),_0x5c17('0x16')),controller[_0x5c17('0x17')]);router[_0x5c17('0x18')](_0x5c17('0xd'),auth[_0x5c17('0x9')](),interaction[_0x5c17('0x19')](_0x5c17('0x15'),_0x5c17('0x1a')),controller[_0x5c17('0x1b')]);router[_0x5c17('0x1c')](_0x5c17('0xd'),auth[_0x5c17('0x9')](),interaction[_0x5c17('0x19')](_0x5c17('0x15'),_0x5c17('0x1d')),controller[_0x5c17('0x1e')]);router[_0x5c17('0x1c')](_0x5c17('0x14'),auth[_0x5c17('0x9')](),controller[_0x5c17('0x1f')]);module[_0x5c17('0x20')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index e065b1d..5f534e3 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 _0xb9a3=['out','lastMsgBody','fromString','getDataValue','split','join','html-to-text','exports','BOOLEAN','STRING','long','TEXT','DATE','ENUM'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0xb9a3,0x68));var _0x3b9a=function(_0x4740bf,_0x22cbcc){_0x4740bf=_0x4740bf-0x0;var _0x4a68c1=_0xb9a3[_0x4740bf];return _0x4a68c1;};'use strict';var Sequelize=require('sequelize');var htmlToText=require(_0x3b9a('0x0'));var iconv=require('iconv');module[_0x3b9a('0x1')]={'closed':{'type':Sequelize[_0x3b9a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3b9a('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x3b9a('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x3b9a('0x4'))},'subject':{'type':Sequelize[_0x3b9a('0x5')]()},'attach':{'type':Sequelize[_0x3b9a('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3b9a('0x6')]},'substatus':{'type':Sequelize[_0x3b9a('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x3b9a('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x3b9a('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3b9a('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x3b9a('0x7')]('in',_0x3b9a('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x3b9a('0x5')](_0x3b9a('0x4')),'get':function(){try{return this['getDataValue'](_0x3b9a('0x9'))?htmlToText[_0x3b9a('0xa')](this[_0x3b9a('0xb')](_0x3b9a('0x9')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0x3b9a('0xc')]('\x0a')['slice'](0x0,0x6)[_0x3b9a('0xd')]('\x0a'):null;}catch(_0x1bbcec){return null;}}}}; \ No newline at end of file +var _0x3e53=['ENUM','getDataValue','lastMsgBody','fromString','split','join','sequelize','html-to-text','iconv','exports','BOOLEAN','STRING','TEXT','long','DATE','out'];(function(_0x476c6c,_0x434db8){var _0xbb94db=function(_0x4be12){while(--_0x4be12){_0x476c6c['push'](_0x476c6c['shift']());}};_0xbb94db(++_0x434db8);}(_0x3e53,0x186));var _0x33e5=function(_0x5c2d7d,_0x5dae84){_0x5c2d7d=_0x5c2d7d-0x0;var _0x853687=_0x3e53[_0x5c2d7d];return _0x853687;};'use strict';var Sequelize=require(_0x33e5('0x0'));var htmlToText=require(_0x33e5('0x1'));var iconv=require(_0x33e5('0x2'));module[_0x33e5('0x3')]={'closed':{'type':Sequelize[_0x33e5('0x4')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x33e5('0x5')]},'note':{'type':Sequelize[_0x33e5('0x5')]},'inReplyTo':{'type':Sequelize[_0x33e5('0x5')](0x1fe)},'to':{'type':Sequelize[_0x33e5('0x5')]},'cc':{'type':Sequelize[_0x33e5('0x6')](_0x33e5('0x7'))},'subject':{'type':Sequelize[_0x33e5('0x6')]()},'attach':{'type':Sequelize[_0x33e5('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x33e5('0x8')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x33e5('0x8')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x33e5('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x33e5('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x33e5('0xa')]('in',_0x33e5('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x33e5('0x6')]('long'),'get':function(){try{return this[_0x33e5('0xb')](_0x33e5('0xc'))?htmlToText[_0x33e5('0xd')](this[_0x33e5('0xb')](_0x33e5('0xc')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0x33e5('0xe')]('\x0a')['slice'](0x0,0x6)[_0x33e5('0xf')]('\x0a'):null;}catch(_0x2c85e9){return null;}}}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 2a842ee..35551da 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 _0x8176=['localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailInteraction','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','include','tag','push','Tag','Tags','distinct','read','MailMessage','Messages','direction','createdAt','includeAll','User','Users','fullname','CmContact','Contact','Owner','MailAccount','Account','email','color','findAll','rows','catch','show','params','find','create','body','describe','addMessage','ids','omit','$gte','split','format','addTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','files','join','root','server','tmp','interaction-%s.zip','getMessages','from','bcc','subject','attachments','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','writeFileSync','message%d.eml','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','defaults'];(function(_0xfeaedf,_0x27f784){var _0x8994d3=function(_0x10855e){while(--_0x10855e){_0xfeaedf['push'](_0xfeaedf['shift']());}};_0x8994d3(++_0x27f784);}(_0x8176,0xfe));var _0x6817=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8176[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x6817('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6817('0x1'));var zipdir=require(_0x6817('0x2'));var jsonpatch=require(_0x6817('0x3'));var rp=require('request-promise');var moment=require(_0x6817('0x4'));var BPromise=require(_0x6817('0x5'));var Mustache=require(_0x6817('0x6'));var util=require('util');var path=require(_0x6817('0x7'));var sox=require(_0x6817('0x8'));var csv=require(_0x6817('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6817('0xa'));var squel=require(_0x6817('0xb'));var crypto=require('crypto');var jsforce=require(_0x6817('0xc'));var deskjs=require(_0x6817('0xd'));var toCsv=require(_0x6817('0x9'));var querystring=require(_0x6817('0xe'));var Papa=require(_0x6817('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x6817('0x10'));var Redis=require(_0x6817('0x11'));var qs=require(_0x6817('0x12'));var logger=require(_0x6817('0x13'))('api');var utils=require(_0x6817('0x14'));var config=require(_0x6817('0x15'));var db=require('../../mysqldb')['db'];config[_0x6817('0x16')]=_[_0x6817('0x17')](config[_0x6817('0x16')],{'host':_0x6817('0x18'),'port':0x18eb});var socket=require(_0x6817('0x19'))(new Redis(config[_0x6817('0x16')]));require(_0x6817('0x1a'))['register'](socket);function respondWithStatusCode(_0x49a529,_0x366320){_0x366320=_0x366320||0xcc;return function(_0x2a6373){if(_0x2a6373){return _0x49a529[_0x6817('0x1b')](_0x366320);}return _0x49a529[_0x6817('0x1c')](_0x366320)[_0x6817('0x1d')]();};}function respondWithResult(_0x1e22f2,_0x39a03d){_0x39a03d=_0x39a03d||0xc8;return function(_0x397202){if(_0x397202){return _0x1e22f2[_0x6817('0x1c')](_0x39a03d)[_0x6817('0x1e')](_0x397202);}};}function respondWithFilteredResult(_0x4ec8c1,_0x4dd7ac){return function(_0x1ee759){if(_0x1ee759){var _0x1ae52f=_0x1ee759[_0x6817('0x1f')],_0x3a5578=_0x4dd7ac[_0x6817('0x20')],_0xf3d25d=_0x4dd7ac[_0x6817('0x20')]+_0x4dd7ac[_0x6817('0x21')],_0x3efc6d;if(_0xf3d25d>=_0x1ae52f){_0xf3d25d=_0x1ae52f;_0x3efc6d=0xc8;}else{_0x3efc6d=0xce;}_0x4ec8c1[_0x6817('0x1c')](_0x3efc6d);return _0x4ec8c1[_0x6817('0x22')](_0x6817('0x23'),_0x3a5578+'-'+_0xf3d25d+'/'+_0x1ae52f)['json'](_0x1ee759);}return null;};}function patchUpdates(_0x3c79b3){return function(_0x1c22b1){try{jsonpatch[_0x6817('0x24')](_0x1c22b1,_0x3c79b3,!![]);}catch(_0x13de06){return BPromise[_0x6817('0x25')](_0x13de06);}return _0x1c22b1[_0x6817('0x26')]();};}function saveUpdates(_0x5a171c,_0x2cb8ac){return function(_0x56382d){if(_0x56382d){return _0x56382d[_0x6817('0x27')](_0x5a171c)[_0x6817('0x28')](function(_0x374570){return _0x374570;});}return null;};}function removeEntity(_0x26a34b,_0x19cc32){return function(_0x45d71f){if(_0x45d71f){return _0x45d71f[_0x6817('0x29')]()[_0x6817('0x28')](function(){_0x26a34b[_0x6817('0x1c')](0xcc)[_0x6817('0x1d')]();});}};}function handleEntityNotFound(_0x4b60d8,_0x50ecc){return function(_0x885957){if(!_0x885957){_0x4b60d8['sendStatus'](0x194);}return _0x885957;};}function handleError(_0x11414,_0x4c61aa){_0x4c61aa=_0x4c61aa||0x1f4;return function(_0x356c7c){logger[_0x6817('0x2a')](_0x356c7c[_0x6817('0x2b')]);if(_0x356c7c[_0x6817('0x2c')]){delete _0x356c7c[_0x6817('0x2c')];}_0x11414[_0x6817('0x1c')](_0x4c61aa)[_0x6817('0x2d')](_0x356c7c);};}exports[_0x6817('0x2e')]=function(_0x50e865,_0x25fb29){var _0x39e223={},_0xb4f19c={},_0x363c95={'count':0x0,'rows':[]};var _0x282852=db[_0x6817('0x2f')][_0x6817('0x30')];_0xb4f19c[_0x6817('0x31')]=_['keys'](_0x282852);_0xb4f19c[_0x6817('0x32')]=_[_0x6817('0x33')](_0x50e865[_0x6817('0x32')]);_0xb4f19c[_0x6817('0x34')]=_[_0x6817('0x35')](_0xb4f19c[_0x6817('0x31')],_0xb4f19c[_0x6817('0x32')]);_0x39e223[_0x6817('0x36')]=_[_0x6817('0x35')](_0xb4f19c[_0x6817('0x31')],qs[_0x6817('0x37')](_0x50e865[_0x6817('0x32')][_0x6817('0x37')]));_0x39e223[_0x6817('0x36')]=_0x39e223[_0x6817('0x36')][_0x6817('0x38')]?_0x39e223[_0x6817('0x36')]:_0xb4f19c[_0x6817('0x31')];if(!_0x50e865[_0x6817('0x32')][_0x6817('0x39')](_0x6817('0x3a'))){_0x39e223[_0x6817('0x21')]=qs[_0x6817('0x21')](_0x50e865['query'][_0x6817('0x21')]);_0x39e223[_0x6817('0x20')]=qs[_0x6817('0x20')](_0x50e865[_0x6817('0x32')][_0x6817('0x20')]);}_0x39e223[_0x6817('0x3b')]=qs[_0x6817('0x3c')](_0x50e865['query'][_0x6817('0x3c')]);_0x39e223[_0x6817('0x3d')]=qs[_0x6817('0x34')](_[_0x6817('0x3e')](_0x50e865[_0x6817('0x32')],_0xb4f19c[_0x6817('0x34')]));if(_0x50e865[_0x6817('0x32')][_0x6817('0x3f')]){_0x39e223[_0x6817('0x3d')]=_[_0x6817('0x40')](_0x39e223[_0x6817('0x3d')],{'$or':_[_0x6817('0x41')](_0x282852,function(_0x235279){if(_0x235279[_0x6817('0x42')][_0x6817('0x43')]!==_0x6817('0x44')){var _0x2f94fd={};_0x2f94fd[_0x235279[_0x6817('0x45')]]={'$like':'%'+_0x50e865['query'][_0x6817('0x3f')]+'%'};return _0x2f94fd;}})});}_0x39e223=_[_0x6817('0x40')]({},_0x39e223,_0x50e865[_0x6817('0x46')]);var _0x47047e={'where':_0x39e223['where']};_0x47047e[_0x6817('0x47')]=[];if(_0x50e865[_0x6817('0x32')][_0x6817('0x48')]){_0x47047e[_0x6817('0x47')][_0x6817('0x49')]({'model':db[_0x6817('0x4a')],'as':_0x6817('0x4b'),'attributes':['id'],'where':{'id':_0x50e865[_0x6817('0x32')][_0x6817('0x48')]},'required':!![]});_0x47047e[_0x6817('0x4c')]=!![];}if(_0x50e865[_0x6817('0x32')][_0x6817('0x4d')]){_0x47047e[_0x6817('0x47')]['push']({'model':db[_0x6817('0x4e')],'as':_0x6817('0x4f'),'attributes':['id',_0x6817('0x50'),_0x6817('0x51'),'read'],'where':{'direction':'in','read':_0x50e865[_0x6817('0x32')][_0x6817('0x4d')]||![]},'required':!![]});_0x47047e['distinct']=!![];}return db[_0x6817('0x2f')]['count'](_0x47047e)[_0x6817('0x28')](function(_0x4da7cf){_0x363c95[_0x6817('0x1f')]=_0x4da7cf;if(_0x50e865[_0x6817('0x32')][_0x6817('0x52')]){_0x39e223['include']=[{'model':db[_0x6817('0x53')],'as':_0x6817('0x54'),'required':![],'attributes':['id','name',_0x6817('0x55')]},{'model':db[_0x6817('0x56')],'as':_0x6817('0x57'),'required':![]},{'model':db[_0x6817('0x53')],'as':_0x6817('0x58'),'attributes':['name',_0x6817('0x55'),'internal'],'required':![]},{'model':db[_0x6817('0x59')],'as':_0x6817('0x5a'),'attributes':[_0x6817('0x2c'),_0x6817('0x43'),_0x6817('0x5b')],'required':![]},{'model':db[_0x6817('0x4e')],'as':_0x6817('0x4f'),'attributes':['id',_0x6817('0x50'),_0x6817('0x51'),_0x6817('0x4d')],'where':{'direction':'in','read':_0x50e865[_0x6817('0x32')][_0x6817('0x4d')]||![]},'required':_0x50e865[_0x6817('0x32')][_0x6817('0x4d')]||![]},{'model':db['Tag'],'as':_0x6817('0x4b'),'attributes':['id',_0x6817('0x2c'),_0x6817('0x5c')],'required':_0x50e865[_0x6817('0x32')][_0x6817('0x48')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0x6817('0x2c'),_0x6817('0x5c')],'through':_0x50e865[_0x6817('0x32')]['tag']?{'attributes':[],'where':{'TagId':_0x50e865[_0x6817('0x32')][_0x6817('0x48')]||undefined}}:{},'required':_0x50e865['query'][_0x6817('0x48')]?!![]:![]}];}return db[_0x6817('0x2f')][_0x6817('0x5d')](_0x39e223);})[_0x6817('0x28')](function(_0x46ed3b){_0x363c95[_0x6817('0x5e')]=_0x46ed3b;return _0x363c95;})[_0x6817('0x28')](respondWithFilteredResult(_0x25fb29,_0x39e223))[_0x6817('0x5f')](handleError(_0x25fb29,null));};exports[_0x6817('0x60')]=function(_0x57e6c5,_0x2c5bb7){var _0x43a879={'raw':![],'where':{'id':_0x57e6c5[_0x6817('0x61')]['id']}},_0x42983c={};_0x42983c['model']=_[_0x6817('0x33')](db[_0x6817('0x2f')][_0x6817('0x30')]);_0x42983c[_0x6817('0x32')]=_[_0x6817('0x33')](_0x57e6c5['query']);_0x42983c[_0x6817('0x34')]=_['intersection'](_0x42983c[_0x6817('0x31')],_0x42983c['query']);_0x43a879[_0x6817('0x36')]=_[_0x6817('0x35')](_0x42983c[_0x6817('0x31')],qs[_0x6817('0x37')](_0x57e6c5[_0x6817('0x32')][_0x6817('0x37')]));_0x43a879[_0x6817('0x36')]=_0x43a879[_0x6817('0x36')][_0x6817('0x38')]?_0x43a879['attributes']:_0x42983c[_0x6817('0x31')];if(_0x57e6c5['query'][_0x6817('0x52')]){_0x43a879[_0x6817('0x47')]=[{'all':!![]}];}_0x43a879=_[_0x6817('0x40')]({},_0x43a879,_0x57e6c5['options']);return db[_0x6817('0x2f')][_0x6817('0x62')](_0x43a879)[_0x6817('0x28')](handleEntityNotFound(_0x2c5bb7,null))['then'](respondWithResult(_0x2c5bb7,null))[_0x6817('0x5f')](handleError(_0x2c5bb7,null));};exports[_0x6817('0x63')]=function(_0x93db3e,_0xd556f2){return db[_0x6817('0x2f')][_0x6817('0x63')](_0x93db3e[_0x6817('0x64')],{})[_0x6817('0x28')](respondWithResult(_0xd556f2,0xc9))['catch'](handleError(_0xd556f2,null));};exports[_0x6817('0x27')]=function(_0xe3c5c5,_0x3971c4){if(_0xe3c5c5[_0x6817('0x64')]['id']){delete _0xe3c5c5[_0x6817('0x64')]['id'];}return db[_0x6817('0x2f')][_0x6817('0x62')]({'where':{'id':_0xe3c5c5[_0x6817('0x61')]['id']}})[_0x6817('0x28')](handleEntityNotFound(_0x3971c4,null))['then'](saveUpdates(_0xe3c5c5[_0x6817('0x64')],null))[_0x6817('0x28')](respondWithResult(_0x3971c4,null))['catch'](handleError(_0x3971c4,null));};exports[_0x6817('0x29')]=function(_0x13d310,_0x2e1d7b){return db[_0x6817('0x2f')][_0x6817('0x62')]({'where':{'id':_0x13d310[_0x6817('0x61')]['id']}})[_0x6817('0x28')](handleEntityNotFound(_0x2e1d7b,null))[_0x6817('0x28')](removeEntity(_0x2e1d7b,null))[_0x6817('0x5f')](handleError(_0x2e1d7b,null));};exports[_0x6817('0x65')]=function(_0x4eb39f,_0x3a84b1){return db[_0x6817('0x2f')][_0x6817('0x65')]()['then'](respondWithResult(_0x3a84b1,null))[_0x6817('0x5f')](handleError(_0x3a84b1,null));};exports[_0x6817('0x66')]=function(_0x75a758,_0x24d464,_0x19a2c0){return db[_0x6817('0x4e')]['find']({'where':{'id':_0x75a758[_0x6817('0x61')]['id']}})[_0x6817('0x28')](handleEntityNotFound(_0x24d464,null))[_0x6817('0x28')](function(_0xb0bac0){if(_0xb0bac0){return _0xb0bac0[_0x6817('0x66')](_0x75a758[_0x6817('0x64')][_0x6817('0x67')],_[_0x6817('0x68')](_0x75a758[_0x6817('0x64')],['ids','id'])||{});}})[_0x6817('0x28')](respondWithResult(_0x24d464,null))[_0x6817('0x5f')](handleError(_0x24d464,null));};exports['getMessages']=function(_0x4bc74c,_0x5732e2,_0x1b0c33){var _0x5f5775={'raw':![],'where':{}};var _0x11a33a={};var _0xa17d6a={'count':0x0,'rows':[]};return db[_0x6817('0x2f')]['findOne']({'where':{'id':_0x4bc74c['params']['id']}})['then'](handleEntityNotFound(_0x5732e2,null))[_0x6817('0x28')](function(_0x1c8a60){if(_0x1c8a60){_0x11a33a[_0x6817('0x31')]=_[_0x6817('0x33')](db[_0x6817('0x4e')][_0x6817('0x30')]);_0x11a33a[_0x6817('0x32')]=_['keys'](_0x4bc74c[_0x6817('0x32')]);_0x11a33a[_0x6817('0x34')]=_[_0x6817('0x35')](_0x11a33a[_0x6817('0x31')],_0x11a33a['query']);_0x5f5775[_0x6817('0x36')]=_['intersection'](_0x11a33a['model'],qs['fields'](_0x4bc74c[_0x6817('0x32')]['fields']));_0x5f5775[_0x6817('0x36')]=_0x5f5775[_0x6817('0x36')]['length']?_0x5f5775[_0x6817('0x36')]:_0x11a33a[_0x6817('0x31')];if(!_0x4bc74c[_0x6817('0x32')][_0x6817('0x39')]('nolimit')){_0x5f5775[_0x6817('0x21')]=qs['limit'](_0x4bc74c[_0x6817('0x32')][_0x6817('0x21')]);_0x5f5775[_0x6817('0x20')]=qs['offset'](_0x4bc74c[_0x6817('0x32')][_0x6817('0x20')]);}_0x5f5775['order']=qs[_0x6817('0x3c')](_0x4bc74c[_0x6817('0x32')]['sort']);_0x5f5775['where']=qs['filters'](_['pick'](_0x4bc74c[_0x6817('0x32')],_0x11a33a['filters']));_0x5f5775[_0x6817('0x3d')]['MailInteractionId']=_0x1c8a60['id'];if(_0x4bc74c[_0x6817('0x32')][_0x6817('0x3f')]){_0x5f5775[_0x6817('0x3d')]=_['merge'](_0x5f5775[_0x6817('0x3d')],{'$or':_[_0x6817('0x41')](_0x5f5775[_0x6817('0x36')],function(_0x1973a0){var _0x9c557a={};_0x9c557a[_0x1973a0]={'$like':'%'+_0x4bc74c[_0x6817('0x32')][_0x6817('0x3f')]+'%'};return _0x9c557a;})});}if(_0x4bc74c[_0x6817('0x32')][_0x6817('0x69')]){var _0x2eb8fa=_0x4bc74c[_0x6817('0x32')][_0x6817('0x69')][_0x6817('0x6a')](',');var _0x5d7288={};_0x5d7288[_0x2eb8fa[0x0]]={'$gte':moment(_0x2eb8fa[0x1])[_0x6817('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5f5775[_0x6817('0x3d')]=_['merge'](_0x5f5775[_0x6817('0x3d')],_0x5d7288);}_0x5f5775=_[_0x6817('0x40')]({},_0x5f5775,_0x4bc74c['options']);return db[_0x6817('0x4e')]['count']({'where':_0x5f5775[_0x6817('0x3d')]})[_0x6817('0x28')](function(_0x42a1b7){_0xa17d6a[_0x6817('0x1f')]=_0x42a1b7;if(_0x4bc74c[_0x6817('0x32')][_0x6817('0x52')]){_0x5f5775[_0x6817('0x47')]=[{'all':!![]}];}return db[_0x6817('0x4e')]['findAll'](_0x5f5775);})[_0x6817('0x28')](function(_0x695210){_0xa17d6a[_0x6817('0x5e')]=_0x695210;return _0xa17d6a;});}})['then'](respondWithFilteredResult(_0x5732e2,_0x5f5775))[_0x6817('0x5f')](handleError(_0x5732e2,null));};exports[_0x6817('0x6c')]=function(_0x1f0c7f,_0x432228,_0x3bc583){return db['MailInteraction'][_0x6817('0x62')]({'where':{'id':_0x1f0c7f['params']['id']}})['then'](handleEntityNotFound(_0x432228,null))['then'](function(_0x1b3671){if(_0x1b3671){return _0x1b3671['setTags'](_0x1f0c7f[_0x6817('0x64')][_0x6817('0x67')],_['omit'](_0x1f0c7f['body'],['ids','id'])||{})[_0x6817('0x6d')](function(){return db['Tag'][_0x6817('0x5d')]({'attributes':['id',_0x6817('0x2c'),'color'],'where':{'id':_0x1f0c7f['body'][_0x6817('0x67')]}});})['then'](function(_0x8b8e77){socket[_0x6817('0x6e')](_0x6817('0x6f'),{'id':Number(_0x1f0c7f[_0x6817('0x61')]['id']),'tags':_0x8b8e77||[]});return{'id':Number(_0x1f0c7f[_0x6817('0x61')]['id']),'tags':_0x8b8e77||[]};});}})[_0x6817('0x28')](respondWithResult(_0x432228,null))['catch'](handleError(_0x432228,null));};exports[_0x6817('0x70')]=function(_0xe5c57d,_0x424a8e,_0xd545fb){var _0x37c133;return db[_0x6817('0x2f')][_0x6817('0x62')]({'where':{'id':_0xe5c57d[_0x6817('0x61')]['id']}})[_0x6817('0x28')](handleEntityNotFound(_0x424a8e,null))[_0x6817('0x28')](function(_0x1a24b8){if(_0x1a24b8){return _0x1a24b8[_0x6817('0x70')](_0xe5c57d['query']['ids']);}})[_0x6817('0x28')](respondWithStatusCode(_0x424a8e,null))[_0x6817('0x5f')](handleError(_0x424a8e,null));};exports[_0x6817('0x71')]=function(_0x407824,_0x202a88){var _0x4a386f=moment()[_0x6817('0x72')]()['toString']();var _0x3d94ed=path['join'](config['root'],'server',_0x6817('0x73'),'attachments');var _0x5dda67=path[_0x6817('0x74')](config[_0x6817('0x75')],_0x6817('0x76'),'files',_0x6817('0x77'));var _0x4a6714=path['join'](_0x5dda67,_0x4a386f);var _0x223342=util[_0x6817('0x6b')](_0x6817('0x78'),_0x4a386f);var _0x52fb75=path[_0x6817('0x74')](_0x5dda67,_0x223342);var _0x1ae559=![];return db[_0x6817('0x2f')][_0x6817('0x62')]({'where':{'id':_0x407824[_0x6817('0x61')]['id']}})[_0x6817('0x28')](handleEntityNotFound(_0x202a88,null))['then'](function(_0x151e6a){if(_0x151e6a){return _0x151e6a[_0x6817('0x79')]({'attributes':['id','body',_0x6817('0x7a'),'to','cc',_0x6817('0x7b'),_0x6817('0x7c'),_0x6817('0x51')],'where':{'secret':![]},'include':_0x407824[_0x6817('0x32')][_0x6817('0x7d')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined,'order':qs[_0x6817('0x3c')]('id')});}return[];})[_0x6817('0x28')](function(_0x30c937){_0x1ae559=_0x30c937[_0x6817('0x38')];if(_0x30c937[_0x6817('0x38')]){fs[_0x6817('0x7e')](_0x4a6714);return BPromise[_0x6817('0x7f')](_0x30c937,function(_0x54fb4d,_0x26bbf7){var _0x313cc2=_0x54fb4d;var _0xc153c1={'from':_0x313cc2[_0x6817('0x7a')],'to':_0x313cc2['to'],'subject':_0x313cc2['subject'],'html':_0x313cc2[_0x6817('0x64')],'headers':{'Date':moment(_0x313cc2[_0x6817('0x51')])['format'](_0x6817('0x80'))},'attachments':[]};if(_0x54fb4d['cc']){_0xc153c1['headers']['Cc']=_0x54fb4d['cc'];}if(_0x54fb4d[_0x6817('0x7b')]){_0xc153c1[_0x6817('0x81')][_0x6817('0x82')]=_0x54fb4d[_0x6817('0x7b')];}return new BPromise(function(_0x3d83e2,_0x132f1a){if(_0x54fb4d[_0x6817('0x83')]){for(var _0x3eb405=0x0;_0x3eb405<_0x54fb4d[_0x6817('0x83')][_0x6817('0x38')];_0x3eb405++){var _0x456438=_0x54fb4d[_0x6817('0x83')][_0x3eb405];var _0x4ca06b=path[_0x6817('0x74')](_0x3d94ed,_0x456438[_0x6817('0x84')]);if(fs[_0x6817('0x85')](_0x4ca06b)){_0xc153c1[_0x6817('0x7d')][_0x6817('0x49')]({'name':_0x456438[_0x6817('0x2c')],'contentType':_0x456438['type'],'data':fs[_0x6817('0x86')](_0x4ca06b)});}}}emlformat['build'](_0xc153c1,function(_0x180689,_0x3ba4d0){if(_0x180689)return _0x132f1a(_0x180689);fs[_0x6817('0x87')](path[_0x6817('0x74')](_0x4a6714,util[_0x6817('0x6b')](_0x6817('0x88'),_0x26bbf7)),_0x3ba4d0);return _0x3d83e2(_0x3ba4d0);});});});}})[_0x6817('0x28')](function(){if(_0x1ae559){return new BPromise(function(_0x4cf520,_0x4441a4){zipdir(_0x4a6714,{'saveTo':_0x52fb75},function(_0x503a05,_0x510d08){if(_0x503a05)return _0x4441a4(_0x503a05);return _0x4cf520(_0x510d08);});});}})[_0x6817('0x28')](function(){if(_0x1ae559){return new BPromise(function(_0x44aaa8,_0x5c0a28){rimraf(_0x4a6714,function(_0x36cf74){if(_0x36cf74)_0x5c0a28(_0x36cf74);return _0x44aaa8();});});}})['then'](function(){if(_0x1ae559){return _0x202a88[_0x6817('0x71')](_0x52fb75,_0x223342,function(_0x81ba57){if(_0x81ba57){console['log'](_0x6817('0x89'),_0x81ba57);}else{fs[_0x6817('0x8a')](_0x52fb75);}});}else{return _0x202a88[_0x6817('0x1b')](0xc8);}})['catch'](handleError(_0x202a88,null));}; \ No newline at end of file +var _0xd6e1=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','type','key','VIRTUAL','field','options','tag','include','push','Tag','Tags','distinct','read','Messages','direction','includeAll','User','CmContact','Contact','Owner','fullname','internal','MailAccount','Account','email','MailMessage','createdAt','ThroughTags','color','rows','catch','show','params','rawAttributes','merge','find','body','update','describe','addMessage','ids','omit','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','mailInteractionTags:save','removeTags','unix','toString','join','root','server','files','attachments','interaction-%s.zip','getMessages','from','bcc','Attachments','mkdirSync','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','log','err','unlinkSync','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','MailInteraction','model'];(function(_0x7561a8,_0x2f5431){var _0x4edab6=function(_0x2b41e6){while(--_0x2b41e6){_0x7561a8['push'](_0x7561a8['shift']());}};_0x4edab6(++_0x2f5431);}(_0xd6e1,0x17a));var _0x1d6e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd6e1[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x1d6e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1d6e('0x1'));var zipdir=require(_0x1d6e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1d6e('0x3'));var BPromise=require(_0x1d6e('0x4'));var Mustache=require(_0x1d6e('0x5'));var util=require(_0x1d6e('0x6'));var path=require(_0x1d6e('0x7'));var sox=require(_0x1d6e('0x8'));var csv=require('to-csv');var ejs=require(_0x1d6e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1d6e('0xa'));var crypto=require('crypto');var jsforce=require(_0x1d6e('0xb'));var deskjs=require(_0x1d6e('0xc'));var toCsv=require(_0x1d6e('0xd'));var querystring=require(_0x1d6e('0xe'));var Papa=require(_0x1d6e('0xf'));var authService=require(_0x1d6e('0x10'));var hardwareService=require(_0x1d6e('0x11'));var Redis=require('ioredis');var qs=require(_0x1d6e('0x12'));var logger=require(_0x1d6e('0x13'))(_0x1d6e('0x14'));var utils=require(_0x1d6e('0x15'));var config=require(_0x1d6e('0x16'));var db=require(_0x1d6e('0x17'))['db'];config['redis']=_[_0x1d6e('0x18')](config[_0x1d6e('0x19')],{'host':_0x1d6e('0x1a'),'port':0x18eb});var socket=require(_0x1d6e('0x1b'))(new Redis(config[_0x1d6e('0x19')]));require('./mailInteraction.socket')[_0x1d6e('0x1c')](socket);function respondWithStatusCode(_0x332744,_0x2c0405){_0x2c0405=_0x2c0405||0xcc;return function(_0x58dd36){if(_0x58dd36){return _0x332744[_0x1d6e('0x1d')](_0x2c0405);}return _0x332744['status'](_0x2c0405)['end']();};}function respondWithResult(_0x36bc0e,_0x56d46b){_0x56d46b=_0x56d46b||0xc8;return function(_0x38e3ac){if(_0x38e3ac){return _0x36bc0e[_0x1d6e('0x1e')](_0x56d46b)[_0x1d6e('0x1f')](_0x38e3ac);}};}function respondWithFilteredResult(_0x269861,_0x39144b){return function(_0x549540){if(_0x549540){var _0x4e07cf=_0x549540[_0x1d6e('0x20')],_0x1253bd=_0x39144b[_0x1d6e('0x21')],_0x4e8f5d=_0x39144b[_0x1d6e('0x21')]+_0x39144b['limit'],_0x26bdaa;if(_0x4e8f5d>=_0x4e07cf){_0x4e8f5d=_0x4e07cf;_0x26bdaa=0xc8;}else{_0x26bdaa=0xce;}_0x269861[_0x1d6e('0x1e')](_0x26bdaa);return _0x269861[_0x1d6e('0x22')](_0x1d6e('0x23'),_0x1253bd+'-'+_0x4e8f5d+'/'+_0x4e07cf)['json'](_0x549540);}return null;};}function patchUpdates(_0x1a6615){return function(_0xa317fa){try{jsonpatch[_0x1d6e('0x24')](_0xa317fa,_0x1a6615,!![]);}catch(_0x2e7e6e){return BPromise[_0x1d6e('0x25')](_0x2e7e6e);}return _0xa317fa[_0x1d6e('0x26')]();};}function saveUpdates(_0x35dcd8,_0x54b486){return function(_0x390811){if(_0x390811){return _0x390811['update'](_0x35dcd8)[_0x1d6e('0x27')](function(_0x227fe2){return _0x227fe2;});}return null;};}function removeEntity(_0x5110f4,_0x5a1e86){return function(_0x3cd4d3){if(_0x3cd4d3){return _0x3cd4d3[_0x1d6e('0x28')]()[_0x1d6e('0x27')](function(){_0x5110f4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4633e0,_0x26e254){return function(_0x432008){if(!_0x432008){_0x4633e0[_0x1d6e('0x1d')](0x194);}return _0x432008;};}function handleError(_0x2094c0,_0x39fca6){_0x39fca6=_0x39fca6||0x1f4;return function(_0x4ff3f3){logger[_0x1d6e('0x29')](_0x4ff3f3[_0x1d6e('0x2a')]);if(_0x4ff3f3[_0x1d6e('0x2b')]){delete _0x4ff3f3[_0x1d6e('0x2b')];}_0x2094c0[_0x1d6e('0x1e')](_0x39fca6)[_0x1d6e('0x2c')](_0x4ff3f3);};}exports[_0x1d6e('0x2d')]=function(_0xea21d,_0x4d025a){var _0x78848={},_0x287feb={},_0x94980e={'count':0x0,'rows':[]};var _0xe40910=db[_0x1d6e('0x2e')]['rawAttributes'];_0x287feb[_0x1d6e('0x2f')]=_['keys'](_0xe40910);_0x287feb[_0x1d6e('0x30')]=_[_0x1d6e('0x31')](_0xea21d[_0x1d6e('0x30')]);_0x287feb[_0x1d6e('0x32')]=_[_0x1d6e('0x33')](_0x287feb[_0x1d6e('0x2f')],_0x287feb[_0x1d6e('0x30')]);_0x78848[_0x1d6e('0x34')]=_[_0x1d6e('0x33')](_0x287feb[_0x1d6e('0x2f')],qs[_0x1d6e('0x35')](_0xea21d[_0x1d6e('0x30')][_0x1d6e('0x35')]));_0x78848[_0x1d6e('0x34')]=_0x78848[_0x1d6e('0x34')][_0x1d6e('0x36')]?_0x78848[_0x1d6e('0x34')]:_0x287feb['model'];if(!_0xea21d[_0x1d6e('0x30')][_0x1d6e('0x37')](_0x1d6e('0x38'))){_0x78848['limit']=qs[_0x1d6e('0x39')](_0xea21d[_0x1d6e('0x30')]['limit']);_0x78848['offset']=qs['offset'](_0xea21d['query'][_0x1d6e('0x21')]);}_0x78848[_0x1d6e('0x3a')]=qs[_0x1d6e('0x3b')](_0xea21d['query'][_0x1d6e('0x3b')]);_0x78848[_0x1d6e('0x3c')]=qs[_0x1d6e('0x32')](_[_0x1d6e('0x3d')](_0xea21d[_0x1d6e('0x30')],_0x287feb[_0x1d6e('0x32')]));if(_0xea21d[_0x1d6e('0x30')][_0x1d6e('0x3e')]){_0x78848[_0x1d6e('0x3c')]=_['merge'](_0x78848[_0x1d6e('0x3c')],{'$or':_[_0x1d6e('0x3f')](_0xe40910,function(_0x44bfc1){if(_0x44bfc1[_0x1d6e('0x40')][_0x1d6e('0x41')]!==_0x1d6e('0x42')){var _0x1e7246={};_0x1e7246[_0x44bfc1[_0x1d6e('0x43')]]={'$like':'%'+_0xea21d[_0x1d6e('0x30')][_0x1d6e('0x3e')]+'%'};return _0x1e7246;}})});}_0x78848=_['merge']({},_0x78848,_0xea21d[_0x1d6e('0x44')]);var _0x10e4bd={'where':_0x78848[_0x1d6e('0x3c')]};_0x10e4bd['include']=[];if(_0xea21d['query'][_0x1d6e('0x45')]){_0x10e4bd[_0x1d6e('0x46')][_0x1d6e('0x47')]({'model':db[_0x1d6e('0x48')],'as':_0x1d6e('0x49'),'attributes':['id'],'where':{'id':_0xea21d['query'][_0x1d6e('0x45')]},'required':!![]});_0x10e4bd[_0x1d6e('0x4a')]=!![];}if(_0xea21d[_0x1d6e('0x30')][_0x1d6e('0x4b')]){_0x10e4bd[_0x1d6e('0x46')][_0x1d6e('0x47')]({'model':db['MailMessage'],'as':_0x1d6e('0x4c'),'attributes':['id',_0x1d6e('0x4d'),'createdAt',_0x1d6e('0x4b')],'where':{'direction':'in','read':_0xea21d[_0x1d6e('0x30')][_0x1d6e('0x4b')]||![]},'required':!![]});_0x10e4bd[_0x1d6e('0x4a')]=!![];}return db[_0x1d6e('0x2e')][_0x1d6e('0x20')](_0x10e4bd)['then'](function(_0x222158){_0x94980e[_0x1d6e('0x20')]=_0x222158;if(_0xea21d[_0x1d6e('0x30')][_0x1d6e('0x4e')]){_0x78848[_0x1d6e('0x46')]=[{'model':db[_0x1d6e('0x4f')],'as':'Users','required':![],'attributes':['id',_0x1d6e('0x2b'),'fullname']},{'model':db[_0x1d6e('0x50')],'as':_0x1d6e('0x51'),'required':![]},{'model':db[_0x1d6e('0x4f')],'as':_0x1d6e('0x52'),'attributes':[_0x1d6e('0x2b'),_0x1d6e('0x53'),_0x1d6e('0x54')],'required':![]},{'model':db[_0x1d6e('0x55')],'as':_0x1d6e('0x56'),'attributes':[_0x1d6e('0x2b'),_0x1d6e('0x41'),_0x1d6e('0x57')],'required':![]},{'model':db[_0x1d6e('0x58')],'as':'Messages','attributes':['id',_0x1d6e('0x4d'),_0x1d6e('0x59'),_0x1d6e('0x4b')],'where':{'direction':'in','read':_0xea21d[_0x1d6e('0x30')][_0x1d6e('0x4b')]||![]},'required':_0xea21d[_0x1d6e('0x30')][_0x1d6e('0x4b')]||![]},{'model':db[_0x1d6e('0x48')],'as':_0x1d6e('0x49'),'attributes':['id',_0x1d6e('0x2b'),'color'],'required':_0xea21d[_0x1d6e('0x30')][_0x1d6e('0x45')]?!![]:![]},{'model':db[_0x1d6e('0x48')],'as':_0x1d6e('0x5a'),'attributes':['id',_0x1d6e('0x2b'),_0x1d6e('0x5b')],'through':_0xea21d[_0x1d6e('0x30')]['tag']?{'attributes':[],'where':{'TagId':_0xea21d[_0x1d6e('0x30')][_0x1d6e('0x45')]||undefined}}:{},'required':_0xea21d[_0x1d6e('0x30')]['tag']?!![]:![]}];}return db['MailInteraction']['findAll'](_0x78848);})[_0x1d6e('0x27')](function(_0x56e6cd){_0x94980e[_0x1d6e('0x5c')]=_0x56e6cd;return _0x94980e;})[_0x1d6e('0x27')](respondWithFilteredResult(_0x4d025a,_0x78848))[_0x1d6e('0x5d')](handleError(_0x4d025a,null));};exports[_0x1d6e('0x5e')]=function(_0x5a581c,_0x21c583){var _0x26638e={'raw':![],'where':{'id':_0x5a581c[_0x1d6e('0x5f')]['id']}},_0x46c17e={};_0x46c17e['model']=_[_0x1d6e('0x31')](db[_0x1d6e('0x2e')][_0x1d6e('0x60')]);_0x46c17e[_0x1d6e('0x30')]=_[_0x1d6e('0x31')](_0x5a581c[_0x1d6e('0x30')]);_0x46c17e[_0x1d6e('0x32')]=_[_0x1d6e('0x33')](_0x46c17e[_0x1d6e('0x2f')],_0x46c17e[_0x1d6e('0x30')]);_0x26638e[_0x1d6e('0x34')]=_['intersection'](_0x46c17e['model'],qs[_0x1d6e('0x35')](_0x5a581c['query'][_0x1d6e('0x35')]));_0x26638e[_0x1d6e('0x34')]=_0x26638e['attributes']['length']?_0x26638e[_0x1d6e('0x34')]:_0x46c17e[_0x1d6e('0x2f')];if(_0x5a581c[_0x1d6e('0x30')][_0x1d6e('0x4e')]){_0x26638e['include']=[{'all':!![]}];}_0x26638e=_[_0x1d6e('0x61')]({},_0x26638e,_0x5a581c[_0x1d6e('0x44')]);return db[_0x1d6e('0x2e')][_0x1d6e('0x62')](_0x26638e)[_0x1d6e('0x27')](handleEntityNotFound(_0x21c583,null))['then'](respondWithResult(_0x21c583,null))[_0x1d6e('0x5d')](handleError(_0x21c583,null));};exports['create']=function(_0x381a62,_0x21bb6c){return db[_0x1d6e('0x2e')]['create'](_0x381a62[_0x1d6e('0x63')],{})['then'](respondWithResult(_0x21bb6c,0xc9))[_0x1d6e('0x5d')](handleError(_0x21bb6c,null));};exports[_0x1d6e('0x64')]=function(_0x30098d,_0x179511){if(_0x30098d[_0x1d6e('0x63')]['id']){delete _0x30098d[_0x1d6e('0x63')]['id'];}return db[_0x1d6e('0x2e')][_0x1d6e('0x62')]({'where':{'id':_0x30098d[_0x1d6e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x179511,null))[_0x1d6e('0x27')](saveUpdates(_0x30098d[_0x1d6e('0x63')],null))[_0x1d6e('0x27')](respondWithResult(_0x179511,null))[_0x1d6e('0x5d')](handleError(_0x179511,null));};exports[_0x1d6e('0x28')]=function(_0x35420b,_0x5ad24d){return db[_0x1d6e('0x2e')][_0x1d6e('0x62')]({'where':{'id':_0x35420b['params']['id']}})[_0x1d6e('0x27')](handleEntityNotFound(_0x5ad24d,null))[_0x1d6e('0x27')](removeEntity(_0x5ad24d,null))[_0x1d6e('0x5d')](handleError(_0x5ad24d,null));};exports['describe']=function(_0x22a8d5,_0x3816d3){return db[_0x1d6e('0x2e')][_0x1d6e('0x65')]()[_0x1d6e('0x27')](respondWithResult(_0x3816d3,null))[_0x1d6e('0x5d')](handleError(_0x3816d3,null));};exports[_0x1d6e('0x66')]=function(_0x11b95a,_0x2ad9ba,_0x116b1b){return db['MailMessage'][_0x1d6e('0x62')]({'where':{'id':_0x11b95a[_0x1d6e('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2ad9ba,null))[_0x1d6e('0x27')](function(_0xc870fa){if(_0xc870fa){return _0xc870fa[_0x1d6e('0x66')](_0x11b95a[_0x1d6e('0x63')][_0x1d6e('0x67')],_[_0x1d6e('0x68')](_0x11b95a['body'],[_0x1d6e('0x67'),'id'])||{});}})['then'](respondWithResult(_0x2ad9ba,null))['catch'](handleError(_0x2ad9ba,null));};exports['getMessages']=function(_0x106a43,_0x7b02ad,_0x3424b4){var _0x242405={'raw':![],'where':{}};var _0x11a259={};var _0x141e3a={'count':0x0,'rows':[]};return db['MailInteraction'][_0x1d6e('0x69')]({'where':{'id':_0x106a43['params']['id']}})[_0x1d6e('0x27')](handleEntityNotFound(_0x7b02ad,null))[_0x1d6e('0x27')](function(_0x1d3505){if(_0x1d3505){_0x11a259['model']=_['keys'](db[_0x1d6e('0x58')][_0x1d6e('0x60')]);_0x11a259['query']=_[_0x1d6e('0x31')](_0x106a43[_0x1d6e('0x30')]);_0x11a259[_0x1d6e('0x32')]=_[_0x1d6e('0x33')](_0x11a259['model'],_0x11a259[_0x1d6e('0x30')]);_0x242405[_0x1d6e('0x34')]=_[_0x1d6e('0x33')](_0x11a259[_0x1d6e('0x2f')],qs['fields'](_0x106a43[_0x1d6e('0x30')][_0x1d6e('0x35')]));_0x242405[_0x1d6e('0x34')]=_0x242405['attributes'][_0x1d6e('0x36')]?_0x242405[_0x1d6e('0x34')]:_0x11a259[_0x1d6e('0x2f')];if(!_0x106a43[_0x1d6e('0x30')]['hasOwnProperty'](_0x1d6e('0x38'))){_0x242405['limit']=qs[_0x1d6e('0x39')](_0x106a43[_0x1d6e('0x30')][_0x1d6e('0x39')]);_0x242405[_0x1d6e('0x21')]=qs[_0x1d6e('0x21')](_0x106a43[_0x1d6e('0x30')][_0x1d6e('0x21')]);}_0x242405[_0x1d6e('0x3a')]=qs['sort'](_0x106a43['query'][_0x1d6e('0x3b')]);_0x242405[_0x1d6e('0x3c')]=qs[_0x1d6e('0x32')](_[_0x1d6e('0x3d')](_0x106a43[_0x1d6e('0x30')],_0x11a259[_0x1d6e('0x32')]));_0x242405['where']['MailInteractionId']=_0x1d3505['id'];if(_0x106a43[_0x1d6e('0x30')][_0x1d6e('0x3e')]){_0x242405[_0x1d6e('0x3c')]=_['merge'](_0x242405[_0x1d6e('0x3c')],{'$or':_['map'](_0x242405[_0x1d6e('0x34')],function(_0x444a85){var _0x654ce8={};_0x654ce8[_0x444a85]={'$like':'%'+_0x106a43[_0x1d6e('0x30')][_0x1d6e('0x3e')]+'%'};return _0x654ce8;})});}if(_0x106a43[_0x1d6e('0x30')][_0x1d6e('0x6a')]){var _0xf12ff3=_0x106a43['query'][_0x1d6e('0x6a')][_0x1d6e('0x6b')](',');var _0x3e71e8={};_0x3e71e8[_0xf12ff3[0x0]]={'$gte':moment(_0xf12ff3[0x1])[_0x1d6e('0x6c')](_0x1d6e('0x6d'))};_0x242405[_0x1d6e('0x3c')]=_[_0x1d6e('0x61')](_0x242405[_0x1d6e('0x3c')],_0x3e71e8);}_0x242405=_[_0x1d6e('0x61')]({},_0x242405,_0x106a43[_0x1d6e('0x44')]);return db[_0x1d6e('0x58')][_0x1d6e('0x20')]({'where':_0x242405[_0x1d6e('0x3c')]})[_0x1d6e('0x27')](function(_0x2131cd){_0x141e3a['count']=_0x2131cd;if(_0x106a43[_0x1d6e('0x30')][_0x1d6e('0x4e')]){_0x242405[_0x1d6e('0x46')]=[{'all':!![]}];}return db[_0x1d6e('0x58')][_0x1d6e('0x6e')](_0x242405);})[_0x1d6e('0x27')](function(_0x4fb0a4){_0x141e3a[_0x1d6e('0x5c')]=_0x4fb0a4;return _0x141e3a;});}})[_0x1d6e('0x27')](respondWithFilteredResult(_0x7b02ad,_0x242405))[_0x1d6e('0x5d')](handleError(_0x7b02ad,null));};exports[_0x1d6e('0x6f')]=function(_0x54edcd,_0x2c9a0c,_0xbb6957){return db[_0x1d6e('0x2e')][_0x1d6e('0x62')]({'where':{'id':_0x54edcd[_0x1d6e('0x5f')]['id']}})[_0x1d6e('0x27')](handleEntityNotFound(_0x2c9a0c,null))[_0x1d6e('0x27')](function(_0x3c7417){if(_0x3c7417){return _0x3c7417['setTags'](_0x54edcd[_0x1d6e('0x63')][_0x1d6e('0x67')],_[_0x1d6e('0x68')](_0x54edcd[_0x1d6e('0x63')],['ids','id'])||{})[_0x1d6e('0x70')](function(){return db[_0x1d6e('0x48')][_0x1d6e('0x6e')]({'attributes':['id','name','color'],'where':{'id':_0x54edcd[_0x1d6e('0x63')]['ids']}});})[_0x1d6e('0x27')](function(_0x7cae38){socket['emit'](_0x1d6e('0x71'),{'id':Number(_0x54edcd[_0x1d6e('0x5f')]['id']),'tags':_0x7cae38||[]});return{'id':Number(_0x54edcd[_0x1d6e('0x5f')]['id']),'tags':_0x7cae38||[]};});}})[_0x1d6e('0x27')](respondWithResult(_0x2c9a0c,null))[_0x1d6e('0x5d')](handleError(_0x2c9a0c,null));};exports[_0x1d6e('0x72')]=function(_0x1241bc,_0xe06faf,_0x474703){var _0x308d10;return db[_0x1d6e('0x2e')][_0x1d6e('0x62')]({'where':{'id':_0x1241bc[_0x1d6e('0x5f')]['id']}})[_0x1d6e('0x27')](handleEntityNotFound(_0xe06faf,null))[_0x1d6e('0x27')](function(_0x482f8d){if(_0x482f8d){return _0x482f8d[_0x1d6e('0x72')](_0x1241bc[_0x1d6e('0x30')][_0x1d6e('0x67')]);}})['then'](respondWithStatusCode(_0xe06faf,null))[_0x1d6e('0x5d')](handleError(_0xe06faf,null));};exports['download']=function(_0x501c57,_0xcf8efd){var _0x22c789=moment()[_0x1d6e('0x73')]()[_0x1d6e('0x74')]();var _0x48faa4=path[_0x1d6e('0x75')](config[_0x1d6e('0x76')],_0x1d6e('0x77'),_0x1d6e('0x78'),_0x1d6e('0x79'));var _0x510b35=path[_0x1d6e('0x75')](config[_0x1d6e('0x76')],_0x1d6e('0x77'),_0x1d6e('0x78'),'tmp');var _0x4494fc=path[_0x1d6e('0x75')](_0x510b35,_0x22c789);var _0x27489d=util['format'](_0x1d6e('0x7a'),_0x22c789);var _0x1e8544=path[_0x1d6e('0x75')](_0x510b35,_0x27489d);var _0x358326=![];return db['MailInteraction'][_0x1d6e('0x62')]({'where':{'id':_0x501c57[_0x1d6e('0x5f')]['id']}})[_0x1d6e('0x27')](handleEntityNotFound(_0xcf8efd,null))[_0x1d6e('0x27')](function(_0x1e2804){if(_0x1e2804){return _0x1e2804[_0x1d6e('0x7b')]({'attributes':['id','body',_0x1d6e('0x7c'),'to','cc',_0x1d6e('0x7d'),'subject','createdAt'],'where':{'secret':![]},'include':_0x501c57['query'][_0x1d6e('0x79')]?[{'model':db['Attachment'],'as':_0x1d6e('0x7e')}]:undefined,'order':qs[_0x1d6e('0x3b')]('id')});}return[];})[_0x1d6e('0x27')](function(_0x4db9ec){_0x358326=_0x4db9ec[_0x1d6e('0x36')];if(_0x4db9ec['length']){fs[_0x1d6e('0x7f')](_0x4494fc);return BPromise[_0x1d6e('0x80')](_0x4db9ec,function(_0x3877c0,_0x60dbca){var _0x1511ce=_0x3877c0;var _0x9794f1={'from':_0x1511ce[_0x1d6e('0x7c')],'to':_0x1511ce['to'],'subject':_0x1511ce[_0x1d6e('0x81')],'html':_0x1511ce['body'],'headers':{'Date':moment(_0x1511ce[_0x1d6e('0x59')])['format'](_0x1d6e('0x82'))},'attachments':[]};if(_0x3877c0['cc']){_0x9794f1['headers']['Cc']=_0x3877c0['cc'];}if(_0x3877c0[_0x1d6e('0x7d')]){_0x9794f1[_0x1d6e('0x83')][_0x1d6e('0x84')]=_0x3877c0[_0x1d6e('0x7d')];}return new BPromise(function(_0x35e08f,_0x3034c3){if(_0x3877c0['Attachments']){for(var _0x379fb1=0x0;_0x379fb1<_0x3877c0[_0x1d6e('0x7e')][_0x1d6e('0x36')];_0x379fb1++){var _0x537a47=_0x3877c0['Attachments'][_0x379fb1];var _0x491a4e=path['join'](_0x48faa4,_0x537a47['basename']);if(fs[_0x1d6e('0x85')](_0x491a4e)){_0x9794f1[_0x1d6e('0x79')][_0x1d6e('0x47')]({'name':_0x537a47[_0x1d6e('0x2b')],'contentType':_0x537a47[_0x1d6e('0x40')],'data':fs[_0x1d6e('0x86')](_0x491a4e)});}}}emlformat[_0x1d6e('0x87')](_0x9794f1,function(_0x532a05,_0x1143f2){if(_0x532a05)return _0x3034c3(_0x532a05);fs[_0x1d6e('0x88')](path[_0x1d6e('0x75')](_0x4494fc,util[_0x1d6e('0x6c')](_0x1d6e('0x89'),_0x60dbca)),_0x1143f2);return _0x35e08f(_0x1143f2);});});});}})[_0x1d6e('0x27')](function(){if(_0x358326){return new BPromise(function(_0x56f7b5,_0x4527e7){zipdir(_0x4494fc,{'saveTo':_0x1e8544},function(_0x58cd19,_0x1e48d1){if(_0x58cd19)return _0x4527e7(_0x58cd19);return _0x56f7b5(_0x1e48d1);});});}})[_0x1d6e('0x27')](function(){if(_0x358326){return new BPromise(function(_0x3a8ca3,_0x556c49){rimraf(_0x4494fc,function(_0x582482){if(_0x582482)_0x556c49(_0x582482);return _0x3a8ca3();});});}})[_0x1d6e('0x27')](function(){if(_0x358326){return _0xcf8efd[_0x1d6e('0x8a')](_0x1e8544,_0x27489d,function(_0x33b56e){if(_0x33b56e){console[_0x1d6e('0x8b')](_0x1d6e('0x8c'),_0x33b56e);}else{fs[_0x1d6e('0x8d')](_0x1e8544);}});}else{return _0xcf8efd['sendStatus'](0xc8);}})['catch'](handleError(_0xcf8efd,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index df8dc41..fe01ab1 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 _0xa716=['update','remove','emit','hook','exports','events','MailInteraction','setMaxListeners','save'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0xa716,0x68));var _0x6a71=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa716[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x6a71('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x6a71('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6a71('0x2')](0x0);var events={'afterCreate':_0x6a71('0x3'),'afterUpdate':_0x6a71('0x4'),'afterDestroy':_0x6a71('0x5')};function emitEvent(_0x40e03f){return function(_0x36ea12,_0x263506,_0x1688a2){MailInteractionEvents[_0x6a71('0x6')](_0x40e03f+':'+_0x36ea12['id'],_0x36ea12);MailInteractionEvents[_0x6a71('0x6')](_0x40e03f,_0x36ea12);_0x1688a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x6a71('0x7')](e,emitEvent(event));}}module[_0x6a71('0x8')]=MailInteractionEvents; \ No newline at end of file +var _0x3bac=['remove','emit','hook','exports','../../mysqldb','MailInteraction','setMaxListeners','save','update'];(function(_0x496c03,_0x469a38){var _0x5eccc5=function(_0xc0138a){while(--_0xc0138a){_0x496c03['push'](_0x496c03['shift']());}};_0x5eccc5(++_0x469a38);}(_0x3bac,0x109));var _0xc3ba=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0x3bac[_0x421725];return _0x51b322;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xc3ba('0x0'))['db'][_0xc3ba('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc3ba('0x2')](0x0);var events={'afterCreate':_0xc3ba('0x3'),'afterUpdate':_0xc3ba('0x4'),'afterDestroy':_0xc3ba('0x5')};function emitEvent(_0x589840){return function(_0x49435d,_0x589564,_0x170356){MailInteractionEvents[_0xc3ba('0x6')](_0x589840+':'+_0x49435d['id'],_0x49435d);MailInteractionEvents[_0xc3ba('0x6')](_0x589840,_0x49435d);_0x170356(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xc3ba('0x7')](e,emitEvent(event));}}module[_0xc3ba('0x8')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d457a47..f665bb3 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 _0x2019=['lodash','../../config/logger','moment','bluebird','request-promise','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','substatus','substatusAt','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','format','utf8mb4'];(function(_0xf726e6,_0x2ad36d){var _0xb4c39b=function(_0x343d4b){while(--_0x343d4b){_0xf726e6['push'](_0xf726e6['shift']());}};_0xb4c39b(++_0x2ad36d);}(_0x2019,0x1b0));var _0x9201=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x2019[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0x9201('0x0'));var util=require('util');var logger=require(_0x9201('0x1'))('api');var moment=require(_0x9201('0x2'));var BPromise=require(_0x9201('0x3'));var rp=require(_0x9201('0x4'));var attributes=require(_0x9201('0x5'));module[_0x9201('0x6')]=function(_0x4fa11d,_0x53bff2){return _0x4fa11d[_0x9201('0x7')](_0x9201('0x8'),attributes,{'tableName':_0x9201('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x571580,_0x299854,_0x3bc552){if(_0x571580[_0x9201('0xa')]){_0x571580[_0x9201('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x571580[_0x9201('0xc')]){_0x571580[_0x9201('0xd')]=moment()['format'](_0x9201('0xe'));}_0x3bc552(null,_0x299854);},'beforeUpdate':function(_0x47af13,_0x295096,_0x43aba0){if(_0x47af13[_0x9201('0xf')]('substatus')){_0x47af13[_0x9201('0xb')]=moment()[_0x9201('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x47af13[_0x9201('0xf')](_0x9201('0xc'))){_0x47af13[_0x9201('0xd')]=moment()[_0x9201('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x43aba0(null,_0x47af13);}},'charset':_0x9201('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8999=['substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','./mailInteraction.attributes','exports','MailInteraction'];(function(_0x398a23,_0x2dc537){var _0x300040=function(_0x3f7cdf){while(--_0x3f7cdf){_0x398a23['push'](_0x398a23['shift']());}};_0x300040(++_0x2dc537);}(_0x8999,0x117));var _0x9899=function(_0x277212,_0x1d0079){_0x277212=_0x277212-0x0;var _0x3caed0=_0x8999[_0x277212];return _0x3caed0;};'use strict';var _=require(_0x9899('0x0'));var util=require(_0x9899('0x1'));var logger=require(_0x9899('0x2'))(_0x9899('0x3'));var moment=require(_0x9899('0x4'));var BPromise=require(_0x9899('0x5'));var rp=require('request-promise');var attributes=require(_0x9899('0x6'));module[_0x9899('0x7')]=function(_0x513907,_0xdca230){return _0x513907['define'](_0x9899('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x9e0174,_0xc2ea0d,_0x22b404){if(_0x9e0174[_0x9899('0x9')]){_0x9e0174[_0x9899('0xa')]=moment()[_0x9899('0xb')](_0x9899('0xc'));}if(_0x9e0174[_0x9899('0xd')]){_0x9e0174[_0x9899('0xe')]=moment()['format'](_0x9899('0xc'));}_0x22b404(null,_0xc2ea0d);},'beforeUpdate':function(_0x72b17d,_0x33b7d6,_0x525869){if(_0x72b17d[_0x9899('0xf')](_0x9899('0x9'))){_0x72b17d[_0x9899('0xa')]=moment()['format'](_0x9899('0xc'));}if(_0x72b17d[_0x9899('0xf')](_0x9899('0xd'))){_0x72b17d[_0x9899('0xe')]=moment()[_0x9899('0xb')](_0x9899('0xc'));}_0x525869(null,_0x72b17d);}},'charset':_0x9899('0x10'),'collate':_0x9899('0x11')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 13011ec..abc5179 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 _0xd9a8=['AddTagsToMailInteraction','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','then','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','info'];(function(_0x25ff3d,_0x2e1014){var _0x31a379=function(_0x3721e8){while(--_0x3721e8){_0x25ff3d['push'](_0x25ff3d['shift']());}};_0x31a379(++_0x2e1014);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x54044f,_0x287473){_0x54044f=_0x54044f-0x0;var _0x1ad1ef=_0xd9a8[_0x54044f];return _0x1ad1ef;};'use strict';var _=require(_0x8d9a('0x0'));var util=require(_0x8d9a('0x1'));var moment=require(_0x8d9a('0x2'));var BPromise=require('bluebird');var rs=require(_0x8d9a('0x3'));var fs=require('fs');var Redis=require(_0x8d9a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8d9a('0x5'))(_0x8d9a('0x6'));var config=require(_0x8d9a('0x7'));var jayson=require(_0x8d9a('0x8'));var client=jayson[_0x8d9a('0x9')]['http']({'port':0x232a});config[_0x8d9a('0xa')]=_[_0x8d9a('0xb')](config[_0x8d9a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d9a('0xc'))(new Redis(config[_0x8d9a('0xa')]));require(_0x8d9a('0xd'))['register'](socket);function respondWithRpcPromise(_0xecf3f0,_0x2038fc,_0x15658e){return new BPromise(function(_0x5ae57a,_0x5ddc86){return client['request'](_0xecf3f0,_0x15658e)[_0x8d9a('0xe')](function(_0x8c3a9f){logger['info'](_0x8d9a('0xf'),_0x2038fc,_0x8d9a('0x10'));logger['debug'](_0x8d9a('0x11'),_0x2038fc,_0x8d9a('0x10'),JSON[_0x8d9a('0x12')](_0x8c3a9f));if(_0x8c3a9f[_0x8d9a('0x13')]){if(_0x8c3a9f[_0x8d9a('0x13')][_0x8d9a('0x14')]===0x1f4){logger[_0x8d9a('0x13')](_0x8d9a('0xf'),_0x2038fc,_0x8c3a9f['error'][_0x8d9a('0x15')]);return _0x5ddc86(_0x8c3a9f[_0x8d9a('0x13')][_0x8d9a('0x15')]);}logger[_0x8d9a('0x13')](_0x8d9a('0xf'),_0x2038fc,_0x8c3a9f[_0x8d9a('0x13')]['message']);return _0x5ae57a(_0x8c3a9f['error'][_0x8d9a('0x15')]);}else{logger['info'](_0x8d9a('0xf'),_0x2038fc,_0x8d9a('0x10'));_0x5ae57a(_0x8c3a9f['result'][_0x8d9a('0x15')]);}})[_0x8d9a('0x16')](function(_0xaebbad){logger[_0x8d9a('0x13')]('MailInteraction,\x20%s,\x20%s',_0x2038fc,_0xaebbad);_0x5ddc86(_0xaebbad);});});}exports[_0x8d9a('0x17')]=function(_0x2f2afd){var _0x335fb0=this;return new Promise(function(_0xea0c50,_0x4de98e){return db[_0x8d9a('0x18')][_0x8d9a('0x19')](_0x2f2afd[_0x8d9a('0x1a')],{'raw':_0x2f2afd['options']?_0x2f2afd[_0x8d9a('0x1b')][_0x8d9a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f2afd[_0x8d9a('0x1b')]?_0x2f2afd[_0x8d9a('0x1b')][_0x8d9a('0x1d')]||null:null,'attributes':_0x2f2afd[_0x8d9a('0x1b')]?_0x2f2afd[_0x8d9a('0x1b')][_0x8d9a('0x1e')]||null:null,'limit':_0x2f2afd[_0x8d9a('0x1b')]?_0x2f2afd[_0x8d9a('0x1b')][_0x8d9a('0x1f')]||null:null})[_0x8d9a('0xe')](function(_0x2237e5){logger[_0x8d9a('0x20')]('UpdateMailInteraction',_0x2f2afd);logger['debug'](_0x8d9a('0x17'),_0x2f2afd,JSON[_0x8d9a('0x12')](_0x2237e5));_0xea0c50(_0x2237e5);})['catch'](function(_0x26c6f4){logger[_0x8d9a('0x13')](_0x8d9a('0x17'),_0x26c6f4[_0x8d9a('0x15')],_0x2f2afd);_0x4de98e(_0x335fb0['error'](0x1f4,_0x26c6f4[_0x8d9a('0x15')]));});});};exports[_0x8d9a('0x21')]=function(_0x277986){return new Promise(function(_0x41a8e4,_0x3fdd5e){return db[_0x8d9a('0x18')]['find']({'where':_0x277986['options']?_0x277986[_0x8d9a('0x1b')][_0x8d9a('0x1d')]||null:null})[_0x8d9a('0xe')](function(_0x142ca7){if(_0x142ca7){return _0x142ca7[_0x8d9a('0x22')](_0x277986['body'][_0x8d9a('0x23')],_[_0x8d9a('0x24')](_0x277986[_0x8d9a('0x1a')],[_0x8d9a('0x23'),'id'])||{});}})['spread'](function(_0x2c4ab3){logger['info'](_0x8d9a('0x25'),_0x277986);logger['debug'](_0x8d9a('0x25'),_0x277986,JSON[_0x8d9a('0x12')](_0x2c4ab3));_0x41a8e4(_0x2c4ab3);})['catch'](function(_0x37c861){logger[_0x8d9a('0x13')](_0x8d9a('0x25'),_0x37c861[_0x8d9a('0x15')],_0x277986);_0x3fdd5e(_this[_0x8d9a('0x13')](0x1f4,_0x37c861[_0x8d9a('0x15')]));});});}; \ No newline at end of file +var _0xd072=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailInteraction','update','body','options','raw','attributes','UpdateMailInteraction','AddTagsToMailInteraction','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd072,0x132));var _0x2d07=function(_0x48ec40,_0x5ef59d){_0x48ec40=_0x48ec40-0x0;var _0x18398f=_0xd072[_0x48ec40];return _0x18398f;};'use strict';var _=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var moment=require(_0x2d07('0x2'));var BPromise=require(_0x2d07('0x3'));var rs=require(_0x2d07('0x4'));var fs=require('fs');var Redis=require(_0x2d07('0x5'));var db=require(_0x2d07('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d07('0x7'))(_0x2d07('0x8'));var config=require(_0x2d07('0x9'));var jayson=require(_0x2d07('0xa'));var client=jayson[_0x2d07('0xb')]['http']({'port':0x232a});config[_0x2d07('0xc')]=_[_0x2d07('0xd')](config[_0x2d07('0xc')],{'host':_0x2d07('0xe'),'port':0x18eb});var socket=require(_0x2d07('0xf'))(new Redis(config[_0x2d07('0xc')]));require(_0x2d07('0x10'))['register'](socket);function respondWithRpcPromise(_0x12e4b4,_0x3288ea,_0xa67a15){return new BPromise(function(_0x46ddb1,_0x20ce98){return client[_0x2d07('0x11')](_0x12e4b4,_0xa67a15)[_0x2d07('0x12')](function(_0x3a679d){logger[_0x2d07('0x13')](_0x2d07('0x14'),_0x3288ea,_0x2d07('0x15'));logger[_0x2d07('0x16')](_0x2d07('0x17'),_0x3288ea,_0x2d07('0x15'),JSON[_0x2d07('0x18')](_0x3a679d));if(_0x3a679d[_0x2d07('0x19')]){if(_0x3a679d[_0x2d07('0x19')][_0x2d07('0x1a')]===0x1f4){logger[_0x2d07('0x19')](_0x2d07('0x14'),_0x3288ea,_0x3a679d[_0x2d07('0x19')][_0x2d07('0x1b')]);return _0x20ce98(_0x3a679d[_0x2d07('0x19')][_0x2d07('0x1b')]);}logger[_0x2d07('0x19')]('MailInteraction,\x20%s,\x20%s',_0x3288ea,_0x3a679d[_0x2d07('0x19')][_0x2d07('0x1b')]);return _0x46ddb1(_0x3a679d[_0x2d07('0x19')][_0x2d07('0x1b')]);}else{logger[_0x2d07('0x13')](_0x2d07('0x14'),_0x3288ea,_0x2d07('0x15'));_0x46ddb1(_0x3a679d[_0x2d07('0x1c')]['message']);}})[_0x2d07('0x1d')](function(_0x1c6300){logger[_0x2d07('0x19')](_0x2d07('0x14'),_0x3288ea,_0x1c6300);_0x20ce98(_0x1c6300);});});}exports['UpdateMailInteraction']=function(_0x112ac3){var _0x2a419f=this;return new Promise(function(_0xd0c5f8,_0xe56848){return db[_0x2d07('0x1e')][_0x2d07('0x1f')](_0x112ac3[_0x2d07('0x20')],{'raw':_0x112ac3[_0x2d07('0x21')]?_0x112ac3['options'][_0x2d07('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x112ac3[_0x2d07('0x21')]?_0x112ac3[_0x2d07('0x21')]['where']||null:null,'attributes':_0x112ac3[_0x2d07('0x21')]?_0x112ac3['options'][_0x2d07('0x23')]||null:null,'limit':_0x112ac3[_0x2d07('0x21')]?_0x112ac3[_0x2d07('0x21')]['limit']||null:null})[_0x2d07('0x12')](function(_0x16586e){logger['info'](_0x2d07('0x24'),_0x112ac3);logger['debug'](_0x2d07('0x24'),_0x112ac3,JSON[_0x2d07('0x18')](_0x16586e));_0xd0c5f8(_0x16586e);})[_0x2d07('0x1d')](function(_0x41574e){logger['error'](_0x2d07('0x24'),_0x41574e[_0x2d07('0x1b')],_0x112ac3);_0xe56848(_0x2a419f[_0x2d07('0x19')](0x1f4,_0x41574e['message']));});});};exports[_0x2d07('0x25')]=function(_0x550fc5){return new Promise(function(_0x550344,_0x16c5ed){return db[_0x2d07('0x1e')]['find']({'where':_0x550fc5[_0x2d07('0x21')]?_0x550fc5['options']['where']||null:null})[_0x2d07('0x12')](function(_0x15b337){if(_0x15b337){return _0x15b337['addTags'](_0x550fc5[_0x2d07('0x20')]['ids'],_[_0x2d07('0x26')](_0x550fc5[_0x2d07('0x20')],['ids','id'])||{});}})[_0x2d07('0x27')](function(_0x5ed058){logger['info'](_0x2d07('0x28'),_0x550fc5);logger['debug'](_0x2d07('0x28'),_0x550fc5,JSON[_0x2d07('0x18')](_0x5ed058));_0x550344(_0x5ed058);})[_0x2d07('0x1d')](function(_0x5ca32d){logger['error'](_0x2d07('0x28'),_0x5ca32d[_0x2d07('0x1b')],_0x550fc5);_0x16c5ed(_this[_0x2d07('0x19')](0x1f4,_0x5ca32d[_0x2d07('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index e5e03b8..381dc05 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 _0x219e=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','update'];(function(_0x1a070b,_0x46d2c8){var _0x20b48d=function(_0x4e8510){while(--_0x4e8510){_0x1a070b['push'](_0x1a070b['shift']());}};_0x20b48d(++_0x46d2c8);}(_0x219e,0xf9));var _0xe219=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x219e[_0x45d3f0];return _0x314b79;};'use strict';var MailInteractionEvents=require(_0xe219('0x0'));var events=[_0xe219('0x1'),'remove',_0xe219('0x2')];function createListener(_0xdd43ac,_0x5385a5){return function(_0x51ca8f){_0x5385a5['emit'](_0xdd43ac,_0x51ca8f);};}function removeListener(_0x1c77e8,_0x315b50){return function(){MailInteractionEvents[_0xe219('0x3')](_0x1c77e8,_0x315b50);};}exports[_0xe219('0x4')]=function(_0x3da797){for(var _0x592057=0x0,_0x835c0=events[_0xe219('0x5')];_0x592057<_0x835c0;_0x592057++){var _0x4bb334=events[_0x592057];var _0x452eca=createListener(_0xe219('0x6')+_0x4bb334,_0x3da797);MailInteractionEvents['on'](_0x4bb334,_0x452eca);}}; \ No newline at end of file +var _0xb592=['register','length','mailInteraction:','./mailInteraction.events','save','update','emit'];(function(_0x12bc54,_0x179cf9){var _0x1600c2=function(_0x5e11c1){while(--_0x5e11c1){_0x12bc54['push'](_0x12bc54['shift']());}};_0x1600c2(++_0x179cf9);}(_0xb592,0x199));var _0x2b59=function(_0xb27df3,_0x4063cc){_0xb27df3=_0xb27df3-0x0;var _0x3f3c63=_0xb592[_0xb27df3];return _0x3f3c63;};'use strict';var MailInteractionEvents=require(_0x2b59('0x0'));var events=[_0x2b59('0x1'),'remove',_0x2b59('0x2')];function createListener(_0x3d99c1,_0x49f4f5){return function(_0x2a8486){_0x49f4f5[_0x2b59('0x3')](_0x3d99c1,_0x2a8486);};}function removeListener(_0x1b2ac1,_0xecc87e){return function(){MailInteractionEvents['removeListener'](_0x1b2ac1,_0xecc87e);};}exports[_0x2b59('0x4')]=function(_0x42c014){for(var _0x5b92bf=0x0,_0x72db5e=events[_0x2b59('0x5')];_0x5b92bf<_0x72db5e;_0x5b92bf++){var _0x26b46d=events[_0x5b92bf];var _0x28d964=createListener(_0x2b59('0x6')+_0x26b46d,_0x42c014);MailInteractionEvents['on'](_0x26b46d,_0x28d964);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index de6e62f..0cb90c3 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 _0xeec6=['get','index','isAuthenticated','describe','/:id','show','/:id/download','tracked','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller'];(function(_0x4e84f0,_0x5242ca){var _0x47c2fd=function(_0x1d8fd7){while(--_0x1d8fd7){_0x4e84f0['push'](_0x4e84f0['shift']());}};_0x47c2fd(++_0x5242ca);}(_0xeec6,0x1c2));var _0x6eec=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xeec6[_0x382c73];return _0x1dd0bf;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var auth=require(_0x6eec('0x5'));var interaction=require(_0x6eec('0x6'));var config=require(_0x6eec('0x7'));var controller=require(_0x6eec('0x8'));router[_0x6eec('0x9')]('/',auth['isAuthenticated'](),controller[_0x6eec('0xa')]);router[_0x6eec('0x9')]('/describe',auth[_0x6eec('0xb')](),controller[_0x6eec('0xc')]);router[_0x6eec('0x9')](_0x6eec('0xd'),auth['isAuthenticated'](),controller[_0x6eec('0xe')]);router[_0x6eec('0x9')](_0x6eec('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x6eec('0xb')](),interaction[_0x6eec('0x10')]('mail','mailmessage:create'),controller[_0x6eec('0x11')]);router['put'](_0x6eec('0xd'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x12')]);router[_0x6eec('0x13')](_0x6eec('0x14'),auth['isAuthenticated'](),controller[_0x6eec('0x15')]);router[_0x6eec('0x13')](_0x6eec('0x16'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x17')]);router[_0x6eec('0x18')](_0x6eec('0xd'),auth[_0x6eec('0xb')](),controller[_0x6eec('0x19')]);module[_0x6eec('0x1a')]=router; \ No newline at end of file +var _0xafc4=['mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','mail'];(function(_0x5df6d5,_0x3d2297){var _0x651656=function(_0x46faa8){while(--_0x46faa8){_0x5df6d5['push'](_0x5df6d5['shift']());}};_0x651656(++_0x3d2297);}(_0xafc4,0x69));var _0x4afc=function(_0xdf314,_0x445029){_0xdf314=_0xdf314-0x0;var _0xd07445=_0xafc4[_0xdf314];return _0xd07445;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var auth=require(_0x4afc('0x4'));var interaction=require(_0x4afc('0x5'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router['get']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0x7')]);router[_0x4afc('0x8')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xa')]);router['get'](_0x4afc('0xb'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xc')]);router[_0x4afc('0x8')](_0x4afc('0xd'),auth[_0x4afc('0x6')](),controller['download']);router['post']('/',auth[_0x4afc('0x6')](),interaction['tracked'](_0x4afc('0xe'),_0x4afc('0xf')),controller['create']);router[_0x4afc('0x10')](_0x4afc('0xb'),auth[_0x4afc('0x6')](),controller[_0x4afc('0x11')]);router[_0x4afc('0x10')](_0x4afc('0x12'),auth[_0x4afc('0x6')](),controller[_0x4afc('0x13')]);router['put'](_0x4afc('0x14'),auth[_0x4afc('0x6')](),controller[_0x4afc('0x15')]);router[_0x4afc('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x4afc('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index d92efe9..279ff9e 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 _0x2963=['ENUM','out','STRING','TEXT','DATE','INTEGER','sequelize','lodash','long','BOOLEAN'];(function(_0xe91551,_0x2ebf9b){var _0x104a15=function(_0x3b2f91){while(--_0x3b2f91){_0xe91551['push'](_0xe91551['shift']());}};_0x104a15(++_0x2ebf9b);}(_0x2963,0x1be));var _0x3296=function(_0x55bb7d,_0x17446a){_0x55bb7d=_0x55bb7d-0x0;var _0x20ce0f=_0x2963[_0x55bb7d];return _0x20ce0f;};'use strict';var Sequelize=require(_0x3296('0x0'));var _=require(_0x3296('0x1'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x3296('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3296('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3296('0x4')]('in','out'),'defaultValue':_0x3296('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3296('0x6')](0x1fe)},'from':{'type':Sequelize[_0x3296('0x6')]},'to':{'type':Sequelize[_0x3296('0x7')](_0x3296('0x2'))},'cc':{'type':Sequelize[_0x3296('0x7')]('long')},'bcc':{'type':Sequelize[_0x3296('0x7')]('long')},'subject':{'type':Sequelize[_0x3296('0x7')]},'sentAt':{'type':Sequelize[_0x3296('0x8')]},'attach':{'type':Sequelize[_0x3296('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3296('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3296('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0x3296('0x2'))},'originCc':{'type':Sequelize[_0x3296('0x7')]('long')}}; \ No newline at end of file +var _0x22dd=['INTEGER','sequelize','lodash','exports','TEXT','long','BOOLEAN','out','STRING','DATE'];(function(_0x14e083,_0x4f1134){var _0x565a19=function(_0x5d5a0c){while(--_0x5d5a0c){_0x14e083['push'](_0x14e083['shift']());}};_0x565a19(++_0x4f1134);}(_0x22dd,0x6f));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd22d('0x0'));var _=require(_0xd22d('0x1'));module[_0xd22d('0x2')]={'body':{'type':Sequelize[_0xd22d('0x3')](_0xd22d('0x4')),'allowNull':![]},'read':{'type':Sequelize[_0xd22d('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd22d('0x6')),'defaultValue':_0xd22d('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd22d('0x7')](0x1fe)},'from':{'type':Sequelize[_0xd22d('0x7')]},'to':{'type':Sequelize[_0xd22d('0x3')](_0xd22d('0x4'))},'cc':{'type':Sequelize[_0xd22d('0x3')]('long')},'bcc':{'type':Sequelize[_0xd22d('0x3')](_0xd22d('0x4'))},'subject':{'type':Sequelize[_0xd22d('0x3')]},'sentAt':{'type':Sequelize[_0xd22d('0x8')]},'attach':{'type':Sequelize[_0xd22d('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xd22d('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xd22d('0x3')](_0xd22d('0x4'))},'originCc':{'type':Sequelize[_0xd22d('0x3')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 8d6a9b9..6198d93 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 _0x5ebd=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','http','client','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','MailMessage','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','field','include','findAll','rows','show','params','rawAttributes','includeAll','options','find','update','body','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','MailServerOut','Smtp','isNil','host','port','secure','authentication','user','pass','service','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','CmContact','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','unix','toString','server','files','tmp','from','bcc','subject','createdAt','Attachments','headers','Bcc','existsSync','push','type','writeFileSync','download','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x222472,_0x33ea87){var _0x5d601f=function(_0x53fc6f){while(--_0x53fc6f){_0x222472['push'](_0x222472['shift']());}};_0x5d601f(++_0x33ea87);}(_0x5ebd,0x135));var _0xd5eb=function(_0x147fa5,_0x25d300){_0x147fa5=_0x147fa5-0x0;var _0x53bc5d=_0x5ebd[_0x147fa5];return _0x53bc5d;};'use strict';var pdf=require(_0xd5eb('0x0'));var emlformat=require(_0xd5eb('0x1'));var rimraf=require(_0xd5eb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd5eb('0x3'));var moment=require('moment');var BPromise=require(_0xd5eb('0x4'));var Mustache=require(_0xd5eb('0x5'));var util=require(_0xd5eb('0x6'));var path=require(_0xd5eb('0x7'));var sox=require(_0xd5eb('0x8'));var csv=require(_0xd5eb('0x9'));var ejs=require(_0xd5eb('0xa'));var fs=require('fs');var _=require(_0xd5eb('0xb'));var squel=require(_0xd5eb('0xc'));var crypto=require(_0xd5eb('0xd'));var jsforce=require(_0xd5eb('0xe'));var deskjs=require(_0xd5eb('0xf'));var toCsv=require(_0xd5eb('0x9'));var querystring=require(_0xd5eb('0x10'));var Papa=require('papaparse');var authService=require(_0xd5eb('0x11'));var hardwareService=require(_0xd5eb('0x12'));var Redis=require(_0xd5eb('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0xd5eb('0x14'))(_0xd5eb('0x15'));var utils=require(_0xd5eb('0x16'));var config=require(_0xd5eb('0x17'));var db=require(_0xd5eb('0x18'))['db'];config[_0xd5eb('0x19')]=_[_0xd5eb('0x1a')](config[_0xd5eb('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xd5eb('0x1b'))(new Redis(config['redis']));require('./mailMessage.socket')[_0xd5eb('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd5eb('0x1d')]({'port':0x232c});var client9003=jayson[_0xd5eb('0x1e')]['http']({'port':0x232b});var client9002=jayson[_0xd5eb('0x1e')][_0xd5eb('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x36219c,_0xafc42e,_0xf9d6fa,_0x5d4183){return new BPromise(function(_0x1ac397,_0x3d2976){var _0x5ec6be=_0x5d4183||client;return _0x5ec6be['request'](_0x36219c,_0xf9d6fa)['then'](function(_0x480ee2){logger[_0xd5eb('0x1f')](_0xd5eb('0x20'),_0xafc42e,_0xd5eb('0x21'));logger[_0xd5eb('0x22')](_0xd5eb('0x23'),_0xafc42e,_0xd5eb('0x21'),JSON[_0xd5eb('0x24')](_0x480ee2));if(_0x480ee2[_0xd5eb('0x25')]){if(_0x480ee2[_0xd5eb('0x25')]['code']===0x1f4){logger['error'](_0xd5eb('0x20'),_0xafc42e,_0x480ee2[_0xd5eb('0x25')]['message']);return _0x3d2976(_0x480ee2[_0xd5eb('0x25')][_0xd5eb('0x26')]);}logger[_0xd5eb('0x25')](_0xd5eb('0x20'),_0xafc42e,_0x480ee2[_0xd5eb('0x25')][_0xd5eb('0x26')]);return _0x1ac397(_0x480ee2['error'][_0xd5eb('0x26')]);}else{logger[_0xd5eb('0x1f')](_0xd5eb('0x20'),_0xafc42e,'request\x20sent');_0x1ac397(_0x480ee2[_0xd5eb('0x27')][_0xd5eb('0x26')]);}})[_0xd5eb('0x28')](function(_0x3c8327){logger[_0xd5eb('0x25')](_0xd5eb('0x20'),_0xafc42e,_0x3c8327);_0x3d2976(_0x3c8327);});});}function respondWithStatusCode(_0x319db7,_0x80a2b3){_0x80a2b3=_0x80a2b3||0xcc;return function(_0x19ce4b){if(_0x19ce4b){return _0x319db7[_0xd5eb('0x29')](_0x80a2b3);}return _0x319db7[_0xd5eb('0x2a')](_0x80a2b3)[_0xd5eb('0x2b')]();};}function respondWithResult(_0x561403,_0x8cb2fc){_0x8cb2fc=_0x8cb2fc||0xc8;return function(_0x3b0647){if(_0x3b0647){return _0x561403[_0xd5eb('0x2a')](_0x8cb2fc)[_0xd5eb('0x2c')](_0x3b0647);}};}function respondWithFilteredResult(_0x54fab1,_0x5d35e1){return function(_0x4d82ba){if(_0x4d82ba){var _0x5b6f1d=_0x4d82ba[_0xd5eb('0x2d')],_0x561ba0=_0x5d35e1[_0xd5eb('0x2e')],_0x3e98c6=_0x5d35e1[_0xd5eb('0x2e')]+_0x5d35e1[_0xd5eb('0x2f')],_0x1f75d1;if(_0x3e98c6>=_0x5b6f1d){_0x3e98c6=_0x5b6f1d;_0x1f75d1=0xc8;}else{_0x1f75d1=0xce;}_0x54fab1['status'](_0x1f75d1);return _0x54fab1[_0xd5eb('0x30')](_0xd5eb('0x31'),_0x561ba0+'-'+_0x3e98c6+'/'+_0x5b6f1d)[_0xd5eb('0x2c')](_0x4d82ba);}return null;};}function patchUpdates(_0x273bf4){return function(_0x5a7fe8){try{jsonpatch[_0xd5eb('0x32')](_0x5a7fe8,_0x273bf4,!![]);}catch(_0xe20f18){return BPromise[_0xd5eb('0x33')](_0xe20f18);}return _0x5a7fe8[_0xd5eb('0x34')]();};}function saveUpdates(_0x54ebcc,_0x246b85){return function(_0x31aab4){if(_0x31aab4){return _0x31aab4['update'](_0x54ebcc)[_0xd5eb('0x35')](function(_0x4be085){return _0x4be085;});}return null;};}function removeEntity(_0x4b30ce,_0x5c8c11){return function(_0x5dd060){if(_0x5dd060){return _0x5dd060[_0xd5eb('0x36')]()[_0xd5eb('0x35')](function(){_0x4b30ce[_0xd5eb('0x2a')](0xcc)[_0xd5eb('0x2b')]();});}};}function handleEntityNotFound(_0x3f9c95,_0xddc9e9){return function(_0x54c97b){if(!_0x54c97b){_0x3f9c95['sendStatus'](0x194);}return _0x54c97b;};}function handleError(_0x4e9dea,_0x4a3b53){_0x4a3b53=_0x4a3b53||0x1f4;return function(_0x48553e){logger[_0xd5eb('0x25')](_0x48553e[_0xd5eb('0x37')]);if(_0x48553e['name']){delete _0x48553e[_0xd5eb('0x38')];}_0x4e9dea[_0xd5eb('0x2a')](_0x4a3b53)[_0xd5eb('0x39')](_0x48553e);};}exports[_0xd5eb('0x3a')]=function(_0x25bcba,_0x46e78c){var _0x368cde={},_0x23b7ed={},_0x17a706={'count':0x0,'rows':[]};var _0x2846cb=db[_0xd5eb('0x3b')]['rawAttributes'];_0x23b7ed['model']=_[_0xd5eb('0x3c')](_0x2846cb);_0x23b7ed[_0xd5eb('0x3d')]=_[_0xd5eb('0x3c')](_0x25bcba[_0xd5eb('0x3d')]);_0x23b7ed[_0xd5eb('0x3e')]=_[_0xd5eb('0x3f')](_0x23b7ed['model'],_0x23b7ed[_0xd5eb('0x3d')]);_0x368cde[_0xd5eb('0x40')]=_[_0xd5eb('0x3f')](_0x23b7ed[_0xd5eb('0x41')],qs[_0xd5eb('0x42')](_0x25bcba[_0xd5eb('0x3d')][_0xd5eb('0x42')]));_0x368cde[_0xd5eb('0x40')]=_0x368cde[_0xd5eb('0x40')][_0xd5eb('0x43')]?_0x368cde[_0xd5eb('0x40')]:_0x23b7ed['model'];if(!_0x25bcba[_0xd5eb('0x3d')][_0xd5eb('0x44')](_0xd5eb('0x45'))){_0x368cde[_0xd5eb('0x2f')]=qs[_0xd5eb('0x2f')](_0x25bcba['query'][_0xd5eb('0x2f')]);_0x368cde[_0xd5eb('0x2e')]=qs[_0xd5eb('0x2e')](_0x25bcba['query'][_0xd5eb('0x2e')]);}_0x368cde['order']=qs[_0xd5eb('0x46')](_0x25bcba[_0xd5eb('0x3d')]['sort']);_0x368cde[_0xd5eb('0x47')]=qs[_0xd5eb('0x3e')](_[_0xd5eb('0x48')](_0x25bcba[_0xd5eb('0x3d')],_0x23b7ed[_0xd5eb('0x3e')]));if(_0x25bcba[_0xd5eb('0x3d')]['filter']){_0x368cde['where']=_[_0xd5eb('0x49')](_0x368cde[_0xd5eb('0x47')],{'$or':_['map'](_0x2846cb,function(_0x394b89){if(_0x394b89['type']['key']!==_0xd5eb('0x4a')){var _0x3aa4b3={};_0x3aa4b3[_0x394b89[_0xd5eb('0x4b')]]={'$like':'%'+_0x25bcba['query']['filter']+'%'};return _0x3aa4b3;}})});}_0x368cde=_[_0xd5eb('0x49')]({},_0x368cde,_0x25bcba['options']);var _0x5715e1={'where':_0x368cde[_0xd5eb('0x47')]};return db['MailMessage'][_0xd5eb('0x2d')](_0x5715e1)['then'](function(_0xae8ae0){_0x17a706['count']=_0xae8ae0;if(_0x25bcba[_0xd5eb('0x3d')]['includeAll']){_0x368cde[_0xd5eb('0x4c')]=[{'all':!![]}];}return db['MailMessage'][_0xd5eb('0x4d')](_0x368cde);})[_0xd5eb('0x35')](function(_0x597206){_0x17a706[_0xd5eb('0x4e')]=_0x597206;return _0x17a706;})[_0xd5eb('0x35')](respondWithFilteredResult(_0x46e78c,_0x368cde))[_0xd5eb('0x28')](handleError(_0x46e78c,null));};exports[_0xd5eb('0x4f')]=function(_0x3ed826,_0x458ea9){var _0x58e530={'raw':!![],'where':{'id':_0x3ed826[_0xd5eb('0x50')]['id']}},_0x3e0c46={};_0x3e0c46[_0xd5eb('0x41')]=_[_0xd5eb('0x3c')](db[_0xd5eb('0x3b')][_0xd5eb('0x51')]);_0x3e0c46[_0xd5eb('0x3d')]=_[_0xd5eb('0x3c')](_0x3ed826['query']);_0x3e0c46[_0xd5eb('0x3e')]=_[_0xd5eb('0x3f')](_0x3e0c46[_0xd5eb('0x41')],_0x3e0c46['query']);_0x58e530[_0xd5eb('0x40')]=_['intersection'](_0x3e0c46[_0xd5eb('0x41')],qs[_0xd5eb('0x42')](_0x3ed826[_0xd5eb('0x3d')][_0xd5eb('0x42')]));_0x58e530[_0xd5eb('0x40')]=_0x58e530[_0xd5eb('0x40')]['length']?_0x58e530[_0xd5eb('0x40')]:_0x3e0c46['model'];if(_0x3ed826[_0xd5eb('0x3d')][_0xd5eb('0x52')]){_0x58e530['include']=[{'all':!![]}];}_0x58e530=_[_0xd5eb('0x49')]({},_0x58e530,_0x3ed826[_0xd5eb('0x53')]);return db[_0xd5eb('0x3b')][_0xd5eb('0x54')](_0x58e530)['then'](handleEntityNotFound(_0x458ea9,null))[_0xd5eb('0x35')](respondWithResult(_0x458ea9,null))[_0xd5eb('0x28')](handleError(_0x458ea9,null));};exports[_0xd5eb('0x55')]=function(_0x1bb1da,_0x6f309a){if(_0x1bb1da[_0xd5eb('0x56')]['id']){delete _0x1bb1da[_0xd5eb('0x56')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x1bb1da[_0xd5eb('0x50')]['id']}})['then'](handleEntityNotFound(_0x6f309a,null))['then'](saveUpdates(_0x1bb1da['body'],null))['then'](respondWithResult(_0x6f309a,null))[_0xd5eb('0x28')](handleError(_0x6f309a,null));};exports[_0xd5eb('0x36')]=function(_0x486d13,_0x3b3c23){return db[_0xd5eb('0x3b')][_0xd5eb('0x54')]({'where':{'id':_0x486d13[_0xd5eb('0x50')]['id']}})[_0xd5eb('0x35')](handleEntityNotFound(_0x3b3c23,null))[_0xd5eb('0x35')](removeEntity(_0x3b3c23,null))[_0xd5eb('0x28')](handleError(_0x3b3c23,null));};exports[_0xd5eb('0x57')]=function(_0x200699,_0x280f3b){return db[_0xd5eb('0x3b')]['describe']()['then'](respondWithResult(_0x280f3b,null))[_0xd5eb('0x28')](handleError(_0x280f3b,null));};exports[_0xd5eb('0x58')]=function(_0x21fdfc,_0x115db0){return db[_0xd5eb('0x3b')]['create'](_0x21fdfc[_0xd5eb('0x56')])[_0xd5eb('0x35')](function(_0x55b8ab){if(_0x55b8ab){if(_0x55b8ab[_0xd5eb('0x59')]===_0xd5eb('0x5a')&&!_0x55b8ab[_0xd5eb('0x5b')]){return db[_0xd5eb('0x5c')][_0xd5eb('0x5d')]({'where':{'id':_0x55b8ab[_0xd5eb('0x5e')]},'include':[{'model':db[_0xd5eb('0x5f')],'as':_0xd5eb('0x60'),'raw':!![]}]})[_0xd5eb('0x35')](function(_0x4246d5){if(_0x4246d5&&_0x4246d5[_0xd5eb('0x60')]){var _0x2f225e={'tls':{'rejectUnauthorized':![]}};if(_[_0xd5eb('0x61')](_0x4246d5[_0xd5eb('0x60')]['service'])){_0x2f225e['host']=_0x4246d5['Smtp'][_0xd5eb('0x62')];_0x2f225e[_0xd5eb('0x63')]=_0x4246d5[_0xd5eb('0x60')]['port'];_0x2f225e[_0xd5eb('0x64')]=_0x4246d5[_0xd5eb('0x60')][_0xd5eb('0x64')];if(_0x4246d5[_0xd5eb('0x60')][_0xd5eb('0x65')]){_0x2f225e['auth']={'user':_0x4246d5[_0xd5eb('0x60')][_0xd5eb('0x66')],'pass':_0x4246d5['Smtp'][_0xd5eb('0x67')]};}}else{_0x2f225e['service']=_0x4246d5['Smtp'][_0xd5eb('0x68')];_0x2f225e['auth']={'user':_0x4246d5[_0xd5eb('0x60')][_0xd5eb('0x66')],'pass':_0x4246d5[_0xd5eb('0x60')][_0xd5eb('0x67')]};_0x2f225e['secure']=_0x4246d5[_0xd5eb('0x60')][_0xd5eb('0x64')];}if(_0x21fdfc[_0xd5eb('0x56')][_0xd5eb('0x69')]&&_0x21fdfc[_0xd5eb('0x56')]['attachments'][_0xd5eb('0x43')]){for(var _0x1dee9d=0x0;_0x1dee9d<_0x21fdfc[_0xd5eb('0x56')]['attachments'][_0xd5eb('0x43')];_0x1dee9d+=0x1){_0x21fdfc[_0xd5eb('0x56')][_0xd5eb('0x69')][_0x1dee9d]={'filename':_0x21fdfc['body'][_0xd5eb('0x69')][_0x1dee9d]['name'],'path':path[_0xd5eb('0x6a')](config[_0xd5eb('0x6b')],_0xd5eb('0x6c'),_0x21fdfc[_0xd5eb('0x56')][_0xd5eb('0x69')][_0x1dee9d][_0xd5eb('0x6d')])};}}return{'account':_0x2f225e,'message':_0x21fdfc['body']};}})[_0xd5eb('0x35')](function(_0x1e8567){if(_0x1e8567){return respondWithRpcPromise(_0xd5eb('0x6e'),_0xd5eb('0x6f'),_0x1e8567,client9003)['then'](function(_0xf142db){return _0x55b8ab[_0xd5eb('0x55')]({'read':!![],'messageId':_0xf142db[_0xd5eb('0x70')],'sentAt':moment()[_0xd5eb('0x71')](_0xd5eb('0x72'))});})['catch'](function(_0x186591){logger['error']('%s',JSON[_0xd5eb('0x24')](_0x186591));return _0x55b8ab;});}return _0x55b8ab;});}return _0x55b8ab;}})[_0xd5eb('0x35')](respondWithResult(_0x115db0,0xc9))[_0xd5eb('0x28')](handleError(_0x115db0,null));};var interaction_log=require(_0xd5eb('0x14'))(_0xd5eb('0x73'));exports[_0xd5eb('0x74')]=function(_0x17df88,_0x212825,_0x36a267){var _0x20db58={'channel':_0xd5eb('0x75')};if(_0x17df88[_0xd5eb('0x56')]['id']){delete _0x17df88[_0xd5eb('0x56')]['id'];}_0x17df88[_0xd5eb('0x56')][_0xd5eb('0x76')]=!![];_0x17df88[_0xd5eb('0x56')][_0xd5eb('0x77')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x17df88[_0xd5eb('0x56')]['UserId']=_0x17df88[_0xd5eb('0x56')][_0xd5eb('0x78')]||_0x17df88[_0xd5eb('0x66')]['id'];return db['MailMessage'][_0xd5eb('0x54')]({'where':{'id':_0x17df88[_0xd5eb('0x50')]['id'],'UserId':null},'include':[{'model':db[_0xd5eb('0x79')],'as':'Contact'}]})[_0xd5eb('0x35')](handleEntityNotFound(_0x212825,null))[_0xd5eb('0x35')](saveUpdates(_0x17df88['body'],null))['then'](function(_0x39e8c5){if(_0x39e8c5){_0x20db58[_0xd5eb('0x26')]=_0x39e8c5[_0xd5eb('0x7a')]({'plain':!![]});return db['MailInteraction'][_0xd5eb('0x54')]({'where':{'id':_0x39e8c5[_0xd5eb('0x7b')]}});}return null;})['then'](handleEntityNotFound(_0x212825,null))['then'](function(_0x9e53cf){if(_0x9e53cf){return _0x9e53cf[_0xd5eb('0x55')]({'UserId':_0x17df88['body'][_0xd5eb('0x78')],'read1stAt':_['isNil'](_0x9e53cf[_0xd5eb('0x7c')])?moment()[_0xd5eb('0x71')](_0xd5eb('0x72')):undefined});}return null;})[_0xd5eb('0x35')](function(_0x1ee237){if(_0x1ee237){_0x20db58[_0xd5eb('0x7d')]=_0x1ee237[_0xd5eb('0x7a')]({'plain':!![]});interaction_log['info'](_0xd5eb('0x7e'),_0x17df88[_0xd5eb('0x66')]['id'],_0x17df88[_0xd5eb('0x66')][_0xd5eb('0x38')],_0x17df88[_0xd5eb('0x66')][_0xd5eb('0x7f')],_0x20db58[_0xd5eb('0x7d')]['id'],_0x17df88[_0xd5eb('0x56')]?JSON[_0xd5eb('0x24')](_0x17df88[_0xd5eb('0x56')]):'null');return respondWithRpcPromise(_0xd5eb('0x80'),_0xd5eb('0x81'),_0x20db58);}return null;})[_0xd5eb('0x35')](function(_0x4e5a0b){if(_0x4e5a0b){if(_0x17df88['body'][_0xd5eb('0x82')]){_0x20db58[_0xd5eb('0x26')]['interface']=util['format'](_0xd5eb('0x83'),_0x17df88[_0xd5eb('0x66')][_0xd5eb('0x38')]);_0x20db58[_0xd5eb('0x26')][_0xd5eb('0x84')]=_0x20db58[_0xd5eb('0x84')];_0x20db58[_0xd5eb('0x26')][_0xd5eb('0x85')]='accept';return respondWithRpcPromise(_0xd5eb('0x86'),_0xd5eb('0x86'),{'event':_0xd5eb('0x87'),'message':_0x20db58[_0xd5eb('0x26')]},client9002)[_0xd5eb('0x35')](function(){return _0x20db58;});}return _0x20db58;}return null;})[_0xd5eb('0x35')](respondWithResult(_0x212825,null))['catch'](handleError(_0x212825,null));};var interaction_log=require(_0xd5eb('0x14'))('mail-interactions');exports[_0xd5eb('0x33')]=function(_0x41a2e8,_0xeeb13d,_0x29cf21){var _0x43f516={'agent':{},'channel':_0xd5eb('0x75')};if(_0x41a2e8[_0xd5eb('0x56')]['id']){delete _0x41a2e8[_0xd5eb('0x56')]['id'];}_0x41a2e8[_0xd5eb('0x56')][_0xd5eb('0x78')]=_0x41a2e8[_0xd5eb('0x56')][_0xd5eb('0x78')]||_0x41a2e8[_0xd5eb('0x66')]['id'];_0x43f516['agent']['id']=_0x41a2e8['body'][_0xd5eb('0x78')];return db[_0xd5eb('0x3b')][_0xd5eb('0x54')]({'where':{'id':_0x41a2e8[_0xd5eb('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xeeb13d,null))[_0xd5eb('0x35')](function(_0x487af8){if(_0x487af8){_0x43f516[_0xd5eb('0x26')]=_0x487af8[_0xd5eb('0x7a')]({'plain':!![]});return db['MailInteraction'][_0xd5eb('0x54')]({'where':{'id':_0x487af8['MailInteractionId']}});}return null;})[_0xd5eb('0x35')](handleEntityNotFound(_0xeeb13d,null))[_0xd5eb('0x35')](function(_0x2d04d5){if(_0x2d04d5){_0x43f516[_0xd5eb('0x7d')]=_0x2d04d5[_0xd5eb('0x7a')]({'plain':!![]});interaction_log[_0xd5eb('0x1f')](_0xd5eb('0x88'),_0x41a2e8[_0xd5eb('0x66')]['id'],_0x41a2e8[_0xd5eb('0x66')][_0xd5eb('0x38')],_0x41a2e8[_0xd5eb('0x66')][_0xd5eb('0x7f')],_0x43f516[_0xd5eb('0x7d')]['id'],_0x41a2e8[_0xd5eb('0x56')]?JSON['stringify'](_0x41a2e8[_0xd5eb('0x56')]):'null');return respondWithRpcPromise(_0xd5eb('0x89'),_0xd5eb('0x8a'),_0x43f516);}return null;})[_0xd5eb('0x35')](function(_0x10b8b8){if(_0x10b8b8){_0x10b8b8[_0xd5eb('0x26')]['interface']=util[_0xd5eb('0x71')](_0xd5eb('0x83'),_0x41a2e8[_0xd5eb('0x66')]['name']);_0x10b8b8['message'][_0xd5eb('0x84')]=_0x43f516[_0xd5eb('0x84')];_0x10b8b8[_0xd5eb('0x26')][_0xd5eb('0x85')]=_0xd5eb('0x33');respondWithRpcPromise('EventManager',_0xd5eb('0x86'),{'event':_0xd5eb('0x8b'),'message':_0x10b8b8[_0xd5eb('0x26')]},client9002);return _0x43f516;}return null;})[_0xd5eb('0x35')](respondWithResult(_0xeeb13d,null))[_0xd5eb('0x28')](handleError(_0xeeb13d,null));};exports['download']=function(_0xfa7fdf,_0x26b67d){var _0x2b52c8=moment()[_0xd5eb('0x8c')]()[_0xd5eb('0x8d')]();var _0x2599f6=path[_0xd5eb('0x6a')](config['root'],_0xd5eb('0x8e'),_0xd5eb('0x8f'),_0xd5eb('0x90'));var _0x87a6b6=path[_0xd5eb('0x6a')](config[_0xd5eb('0x6b')],'server',_0xd5eb('0x8f'),_0xd5eb('0x69'));var _0x1722a7=util[_0xd5eb('0x71')]('message-%s.eml',_0x2b52c8);return db[_0xd5eb('0x3b')]['find']({'where':{'id':_0xfa7fdf[_0xd5eb('0x50')]['id']},'attributes':['id',_0xd5eb('0x56'),_0xd5eb('0x91'),'to','cc',_0xd5eb('0x92'),_0xd5eb('0x93'),_0xd5eb('0x94')],'include':_0xfa7fdf['query'][_0xd5eb('0x69')]?[{'model':db['Attachment'],'as':_0xd5eb('0x95')}]:undefined})[_0xd5eb('0x35')](handleEntityNotFound(_0x26b67d,null))[_0xd5eb('0x35')](function(_0x1278b1){if(_0x1278b1){var _0x485ebd=_0x1278b1;var _0x24d256={'from':_0x485ebd[_0xd5eb('0x91')],'to':_0x485ebd['to'],'subject':_0x485ebd[_0xd5eb('0x93')],'html':_0x485ebd[_0xd5eb('0x56')],'headers':{'Date':moment(_0x485ebd[_0xd5eb('0x94')])[_0xd5eb('0x71')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1278b1['cc']){_0x24d256[_0xd5eb('0x96')]['Cc']=_0x1278b1['cc'];}if(_0x1278b1[_0xd5eb('0x92')]){_0x24d256[_0xd5eb('0x96')][_0xd5eb('0x97')]=_0x1278b1[_0xd5eb('0x92')];}return new BPromise(function(_0x1f04cc,_0x234d3f){if(_0x1278b1[_0xd5eb('0x95')]){for(var _0x3138e7=0x0;_0x3138e7<_0x1278b1[_0xd5eb('0x95')][_0xd5eb('0x43')];_0x3138e7++){var _0x318cc7=_0x1278b1[_0xd5eb('0x95')][_0x3138e7];var _0x55a5d5=path[_0xd5eb('0x6a')](_0x87a6b6,_0x318cc7[_0xd5eb('0x6d')]);if(fs[_0xd5eb('0x98')](_0x55a5d5)){_0x24d256[_0xd5eb('0x69')][_0xd5eb('0x99')]({'name':_0x318cc7[_0xd5eb('0x38')],'contentType':_0x318cc7[_0xd5eb('0x9a')],'data':fs['readFileSync'](_0x55a5d5)});}}}emlformat['build'](_0x24d256,function(_0x4c7cde,_0x348c53){if(_0x4c7cde)return _0x234d3f(_0x4c7cde);fs[_0xd5eb('0x9b')](path[_0xd5eb('0x6a')](_0x2599f6,_0x1722a7),_0x348c53);return _0x1f04cc(_0x348c53);});});}})['then'](function(_0x5c149e){if(_0x5c149e){return _0x26b67d[_0xd5eb('0x9c')](path[_0xd5eb('0x6a')](_0x2599f6,_0x1722a7),_0x1722a7,function(_0x5f3b04){if(_0x5f3b04){console['log'](_0xd5eb('0x9d'),_0x5f3b04);}else{fs[_0xd5eb('0x9e')](path[_0xd5eb('0x6a')](_0x2599f6,_0x1722a7));}});}})[_0xd5eb('0x28')](handleError(_0x26b67d,null));}; \ No newline at end of file +var _0x9572=['files','server','from','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','basename','push','readFileSync','build','writeFileSync','download','log','err','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','update','stack','name','send','index','MailMessage','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','sort','where','pick','filter','map','type','key','VIRTUAL','merge','options','includeAll','include','findAll','params','find','body','describe','create','direction','out','secret','findOne','MailAccountId','MailServerOut','isNil','Smtp','service','host','port','secure','authentication','auth','attachments','join','root','server/files/attachments','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail-interactions','accept','mail','read','readAt','UserId','user','CmContact','Contact','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','get','MailInteraction','RejectMessage','rejectMessage'];(function(_0x521ec3,_0x274b70){var _0x46cf26=function(_0x326c8d){while(--_0x326c8d){_0x521ec3['push'](_0x521ec3['shift']());}};_0x46cf26(++_0x274b70);}(_0x9572,0x141));var _0x2957=function(_0x4eaa76,_0x99730d){_0x4eaa76=_0x4eaa76-0x0;var _0x7cfdbe=_0x9572[_0x4eaa76];return _0x7cfdbe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2957('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2957('0x1'));var moment=require(_0x2957('0x2'));var BPromise=require(_0x2957('0x3'));var Mustache=require(_0x2957('0x4'));var util=require(_0x2957('0x5'));var path=require(_0x2957('0x6'));var sox=require('sox');var csv=require(_0x2957('0x7'));var ejs=require(_0x2957('0x8'));var fs=require('fs');var _=require(_0x2957('0x9'));var squel=require('squel');var crypto=require(_0x2957('0xa'));var jsforce=require(_0x2957('0xb'));var deskjs=require(_0x2957('0xc'));var toCsv=require(_0x2957('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x2957('0xd'));var hardwareService=require(_0x2957('0xe'));var Redis=require(_0x2957('0xf'));var qs=require(_0x2957('0x10'));var logger=require(_0x2957('0x11'))(_0x2957('0x12'));var utils=require('../../config/utils');var config=require(_0x2957('0x13'));var db=require(_0x2957('0x14'))['db'];config[_0x2957('0x15')]=_[_0x2957('0x16')](config[_0x2957('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x2957('0x17'))(new Redis(config['redis']));require(_0x2957('0x18'))[_0x2957('0x19')](socket);var jayson=require(_0x2957('0x1a'));var client=jayson[_0x2957('0x1b')][_0x2957('0x1c')]({'port':0x232c});var client9003=jayson[_0x2957('0x1b')][_0x2957('0x1c')]({'port':0x232b});var client9002=jayson[_0x2957('0x1b')][_0x2957('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2aeee5,_0x428595,_0x26b1ab,_0x3d67b4){return new BPromise(function(_0x3da7cd,_0x3baf24){var _0x1a2df0=_0x3d67b4||client;return _0x1a2df0['request'](_0x2aeee5,_0x26b1ab)[_0x2957('0x1d')](function(_0x482e42){logger['info'](_0x2957('0x1e'),_0x428595,_0x2957('0x1f'));logger['debug'](_0x2957('0x20'),_0x428595,_0x2957('0x1f'),JSON['stringify'](_0x482e42));if(_0x482e42[_0x2957('0x21')]){if(_0x482e42['error'][_0x2957('0x22')]===0x1f4){logger['error'](_0x2957('0x1e'),_0x428595,_0x482e42[_0x2957('0x21')]['message']);return _0x3baf24(_0x482e42[_0x2957('0x21')][_0x2957('0x23')]);}logger['error'](_0x2957('0x1e'),_0x428595,_0x482e42['error'][_0x2957('0x23')]);return _0x3da7cd(_0x482e42[_0x2957('0x21')][_0x2957('0x23')]);}else{logger[_0x2957('0x24')](_0x2957('0x1e'),_0x428595,_0x2957('0x1f'));_0x3da7cd(_0x482e42[_0x2957('0x25')][_0x2957('0x23')]);}})[_0x2957('0x26')](function(_0x474cfc){logger['error'](_0x2957('0x1e'),_0x428595,_0x474cfc);_0x3baf24(_0x474cfc);});});}function respondWithStatusCode(_0x4de814,_0x32c7a3){_0x32c7a3=_0x32c7a3||0xcc;return function(_0x12d36b){if(_0x12d36b){return _0x4de814[_0x2957('0x27')](_0x32c7a3);}return _0x4de814[_0x2957('0x28')](_0x32c7a3)[_0x2957('0x29')]();};}function respondWithResult(_0x15f5e9,_0x4cca90){_0x4cca90=_0x4cca90||0xc8;return function(_0x33a7bd){if(_0x33a7bd){return _0x15f5e9['status'](_0x4cca90)[_0x2957('0x2a')](_0x33a7bd);}};}function respondWithFilteredResult(_0x5ade53,_0x1d77d4){return function(_0x5cfdf0){if(_0x5cfdf0){var _0x34d241=_0x5cfdf0[_0x2957('0x2b')],_0x59a87e=_0x1d77d4['offset'],_0x401c86=_0x1d77d4['offset']+_0x1d77d4[_0x2957('0x2c')],_0x2578a4;if(_0x401c86>=_0x34d241){_0x401c86=_0x34d241;_0x2578a4=0xc8;}else{_0x2578a4=0xce;}_0x5ade53[_0x2957('0x28')](_0x2578a4);return _0x5ade53[_0x2957('0x2d')](_0x2957('0x2e'),_0x59a87e+'-'+_0x401c86+'/'+_0x34d241)['json'](_0x5cfdf0);}return null;};}function patchUpdates(_0x236c97){return function(_0x1115c3){try{jsonpatch['apply'](_0x1115c3,_0x236c97,!![]);}catch(_0x49231c){return BPromise[_0x2957('0x2f')](_0x49231c);}return _0x1115c3[_0x2957('0x30')]();};}function saveUpdates(_0x136256,_0x596d2d){return function(_0x54dbec){if(_0x54dbec){return _0x54dbec[_0x2957('0x31')](_0x136256)[_0x2957('0x1d')](function(_0x2a98e3){return _0x2a98e3;});}return null;};}function removeEntity(_0x55f8e9,_0x3e312e){return function(_0x3eee74){if(_0x3eee74){return _0x3eee74['destroy']()[_0x2957('0x1d')](function(){_0x55f8e9[_0x2957('0x28')](0xcc)[_0x2957('0x29')]();});}};}function handleEntityNotFound(_0x58abfd,_0x44be94){return function(_0x3b954c){if(!_0x3b954c){_0x58abfd[_0x2957('0x27')](0x194);}return _0x3b954c;};}function handleError(_0x509d5e,_0x2d346e){_0x2d346e=_0x2d346e||0x1f4;return function(_0x28306b){logger['error'](_0x28306b[_0x2957('0x32')]);if(_0x28306b[_0x2957('0x33')]){delete _0x28306b[_0x2957('0x33')];}_0x509d5e[_0x2957('0x28')](_0x2d346e)[_0x2957('0x34')](_0x28306b);};}exports[_0x2957('0x35')]=function(_0x2dba1d,_0x1a2105){var _0x4567aa={},_0x16509b={},_0x21433c={'count':0x0,'rows':[]};var _0x3332e5=db[_0x2957('0x36')][_0x2957('0x37')];_0x16509b[_0x2957('0x38')]=_['keys'](_0x3332e5);_0x16509b[_0x2957('0x39')]=_[_0x2957('0x3a')](_0x2dba1d[_0x2957('0x39')]);_0x16509b[_0x2957('0x3b')]=_[_0x2957('0x3c')](_0x16509b[_0x2957('0x38')],_0x16509b[_0x2957('0x39')]);_0x4567aa['attributes']=_[_0x2957('0x3c')](_0x16509b[_0x2957('0x38')],qs['fields'](_0x2dba1d['query'][_0x2957('0x3d')]));_0x4567aa[_0x2957('0x3e')]=_0x4567aa[_0x2957('0x3e')][_0x2957('0x3f')]?_0x4567aa[_0x2957('0x3e')]:_0x16509b[_0x2957('0x38')];if(!_0x2dba1d[_0x2957('0x39')][_0x2957('0x40')]('nolimit')){_0x4567aa[_0x2957('0x2c')]=qs[_0x2957('0x2c')](_0x2dba1d[_0x2957('0x39')]['limit']);_0x4567aa['offset']=qs['offset'](_0x2dba1d[_0x2957('0x39')][_0x2957('0x41')]);}_0x4567aa['order']=qs[_0x2957('0x42')](_0x2dba1d['query']['sort']);_0x4567aa[_0x2957('0x43')]=qs['filters'](_[_0x2957('0x44')](_0x2dba1d[_0x2957('0x39')],_0x16509b[_0x2957('0x3b')]));if(_0x2dba1d[_0x2957('0x39')][_0x2957('0x45')]){_0x4567aa['where']=_['merge'](_0x4567aa[_0x2957('0x43')],{'$or':_[_0x2957('0x46')](_0x3332e5,function(_0x315993){if(_0x315993[_0x2957('0x47')][_0x2957('0x48')]!==_0x2957('0x49')){var _0x87b548={};_0x87b548[_0x315993['field']]={'$like':'%'+_0x2dba1d['query'][_0x2957('0x45')]+'%'};return _0x87b548;}})});}_0x4567aa=_[_0x2957('0x4a')]({},_0x4567aa,_0x2dba1d[_0x2957('0x4b')]);var _0x4459c0={'where':_0x4567aa[_0x2957('0x43')]};return db[_0x2957('0x36')][_0x2957('0x2b')](_0x4459c0)[_0x2957('0x1d')](function(_0x2fa602){_0x21433c[_0x2957('0x2b')]=_0x2fa602;if(_0x2dba1d['query'][_0x2957('0x4c')]){_0x4567aa[_0x2957('0x4d')]=[{'all':!![]}];}return db[_0x2957('0x36')][_0x2957('0x4e')](_0x4567aa);})[_0x2957('0x1d')](function(_0x4800fa){_0x21433c['rows']=_0x4800fa;return _0x21433c;})[_0x2957('0x1d')](respondWithFilteredResult(_0x1a2105,_0x4567aa))[_0x2957('0x26')](handleError(_0x1a2105,null));};exports['show']=function(_0x5e211a,_0x3c64a8){var _0x14bc1f={'raw':!![],'where':{'id':_0x5e211a[_0x2957('0x4f')]['id']}},_0x2c348b={};_0x2c348b['model']=_[_0x2957('0x3a')](db[_0x2957('0x36')][_0x2957('0x37')]);_0x2c348b[_0x2957('0x39')]=_['keys'](_0x5e211a[_0x2957('0x39')]);_0x2c348b[_0x2957('0x3b')]=_[_0x2957('0x3c')](_0x2c348b[_0x2957('0x38')],_0x2c348b[_0x2957('0x39')]);_0x14bc1f[_0x2957('0x3e')]=_['intersection'](_0x2c348b[_0x2957('0x38')],qs['fields'](_0x5e211a[_0x2957('0x39')][_0x2957('0x3d')]));_0x14bc1f['attributes']=_0x14bc1f[_0x2957('0x3e')][_0x2957('0x3f')]?_0x14bc1f['attributes']:_0x2c348b[_0x2957('0x38')];if(_0x5e211a[_0x2957('0x39')][_0x2957('0x4c')]){_0x14bc1f[_0x2957('0x4d')]=[{'all':!![]}];}_0x14bc1f=_[_0x2957('0x4a')]({},_0x14bc1f,_0x5e211a['options']);return db[_0x2957('0x36')][_0x2957('0x50')](_0x14bc1f)[_0x2957('0x1d')](handleEntityNotFound(_0x3c64a8,null))['then'](respondWithResult(_0x3c64a8,null))[_0x2957('0x26')](handleError(_0x3c64a8,null));};exports['update']=function(_0x81acf8,_0x2a7b51){if(_0x81acf8['body']['id']){delete _0x81acf8[_0x2957('0x51')]['id'];}return db[_0x2957('0x36')][_0x2957('0x50')]({'where':{'id':_0x81acf8[_0x2957('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2a7b51,null))[_0x2957('0x1d')](saveUpdates(_0x81acf8[_0x2957('0x51')],null))['then'](respondWithResult(_0x2a7b51,null))['catch'](handleError(_0x2a7b51,null));};exports['destroy']=function(_0x10d43f,_0xc3e4f4){return db[_0x2957('0x36')][_0x2957('0x50')]({'where':{'id':_0x10d43f[_0x2957('0x4f')]['id']}})[_0x2957('0x1d')](handleEntityNotFound(_0xc3e4f4,null))[_0x2957('0x1d')](removeEntity(_0xc3e4f4,null))[_0x2957('0x26')](handleError(_0xc3e4f4,null));};exports[_0x2957('0x52')]=function(_0x865483,_0xaa7845){return db[_0x2957('0x36')][_0x2957('0x52')]()[_0x2957('0x1d')](respondWithResult(_0xaa7845,null))[_0x2957('0x26')](handleError(_0xaa7845,null));};exports[_0x2957('0x53')]=function(_0x5a981f,_0x5daeee){return db[_0x2957('0x36')][_0x2957('0x53')](_0x5a981f[_0x2957('0x51')])[_0x2957('0x1d')](function(_0x59177a){if(_0x59177a){if(_0x59177a[_0x2957('0x54')]===_0x2957('0x55')&&!_0x59177a[_0x2957('0x56')]){return db['MailAccount'][_0x2957('0x57')]({'where':{'id':_0x59177a[_0x2957('0x58')]},'include':[{'model':db[_0x2957('0x59')],'as':'Smtp','raw':!![]}]})['then'](function(_0x5d2db3){if(_0x5d2db3&&_0x5d2db3['Smtp']){var _0x2c29bf={'tls':{'rejectUnauthorized':![]}};if(_[_0x2957('0x5a')](_0x5d2db3[_0x2957('0x5b')][_0x2957('0x5c')])){_0x2c29bf[_0x2957('0x5d')]=_0x5d2db3[_0x2957('0x5b')][_0x2957('0x5d')];_0x2c29bf['port']=_0x5d2db3[_0x2957('0x5b')][_0x2957('0x5e')];_0x2c29bf[_0x2957('0x5f')]=_0x5d2db3[_0x2957('0x5b')][_0x2957('0x5f')];if(_0x5d2db3[_0x2957('0x5b')][_0x2957('0x60')]){_0x2c29bf['auth']={'user':_0x5d2db3[_0x2957('0x5b')]['user'],'pass':_0x5d2db3[_0x2957('0x5b')]['pass']};}}else{_0x2c29bf['service']=_0x5d2db3['Smtp']['service'];_0x2c29bf[_0x2957('0x61')]={'user':_0x5d2db3[_0x2957('0x5b')]['user'],'pass':_0x5d2db3[_0x2957('0x5b')]['pass']};_0x2c29bf[_0x2957('0x5f')]=_0x5d2db3[_0x2957('0x5b')][_0x2957('0x5f')];}if(_0x5a981f[_0x2957('0x51')][_0x2957('0x62')]&&_0x5a981f[_0x2957('0x51')]['attachments'][_0x2957('0x3f')]){for(var _0x5c3ecd=0x0;_0x5c3ecd<_0x5a981f[_0x2957('0x51')]['attachments'][_0x2957('0x3f')];_0x5c3ecd+=0x1){_0x5a981f[_0x2957('0x51')][_0x2957('0x62')][_0x5c3ecd]={'filename':_0x5a981f[_0x2957('0x51')][_0x2957('0x62')][_0x5c3ecd][_0x2957('0x33')],'path':path[_0x2957('0x63')](config[_0x2957('0x64')],_0x2957('0x65'),_0x5a981f[_0x2957('0x51')]['attachments'][_0x5c3ecd]['basename'])};}}return{'account':_0x2c29bf,'message':_0x5a981f[_0x2957('0x51')]};}})[_0x2957('0x1d')](function(_0xba739e){if(_0xba739e){return respondWithRpcPromise(_0x2957('0x66'),'sendMail',_0xba739e,client9003)[_0x2957('0x1d')](function(_0x167a67){return _0x59177a['update']({'read':!![],'messageId':_0x167a67['messageId'],'sentAt':moment()[_0x2957('0x67')](_0x2957('0x68'))});})[_0x2957('0x26')](function(_0x323261){logger[_0x2957('0x21')]('%s',JSON[_0x2957('0x69')](_0x323261));return _0x59177a;});}return _0x59177a;});}return _0x59177a;}})[_0x2957('0x1d')](respondWithResult(_0x5daeee,0xc9))['catch'](handleError(_0x5daeee,null));};var interaction_log=require(_0x2957('0x11'))(_0x2957('0x6a'));exports[_0x2957('0x6b')]=function(_0x1b20b2,_0x3811ce,_0xcf678b){var _0x984a34={'channel':_0x2957('0x6c')};if(_0x1b20b2[_0x2957('0x51')]['id']){delete _0x1b20b2[_0x2957('0x51')]['id'];}_0x1b20b2[_0x2957('0x51')][_0x2957('0x6d')]=!![];_0x1b20b2[_0x2957('0x51')][_0x2957('0x6e')]=moment()[_0x2957('0x67')](_0x2957('0x68'));_0x1b20b2[_0x2957('0x51')]['UserId']=_0x1b20b2[_0x2957('0x51')][_0x2957('0x6f')]||_0x1b20b2[_0x2957('0x70')]['id'];return db['MailMessage']['find']({'where':{'id':_0x1b20b2[_0x2957('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0x2957('0x71')],'as':_0x2957('0x72')}]})[_0x2957('0x1d')](handleEntityNotFound(_0x3811ce,null))[_0x2957('0x1d')](saveUpdates(_0x1b20b2['body'],null))[_0x2957('0x1d')](function(_0x223a15){if(_0x223a15){_0x984a34[_0x2957('0x23')]=_0x223a15['get']({'plain':!![]});return db['MailInteraction'][_0x2957('0x50')]({'where':{'id':_0x223a15['MailInteractionId']}});}return null;})[_0x2957('0x1d')](handleEntityNotFound(_0x3811ce,null))[_0x2957('0x1d')](function(_0x3a8e4){if(_0x3a8e4){return _0x3a8e4[_0x2957('0x31')]({'UserId':_0x1b20b2[_0x2957('0x51')]['UserId'],'read1stAt':_[_0x2957('0x5a')](_0x3a8e4[_0x2957('0x73')])?moment()[_0x2957('0x67')](_0x2957('0x68')):undefined});}return null;})[_0x2957('0x1d')](function(_0xa238e5){if(_0xa238e5){_0x984a34[_0x2957('0x74')]=_0xa238e5['get']({'plain':!![]});interaction_log['info'](_0x2957('0x75'),_0x1b20b2[_0x2957('0x70')]['id'],_0x1b20b2[_0x2957('0x70')][_0x2957('0x33')],_0x1b20b2[_0x2957('0x70')][_0x2957('0x76')],_0x984a34[_0x2957('0x74')]['id'],_0x1b20b2[_0x2957('0x51')]?JSON['stringify'](_0x1b20b2['body']):_0x2957('0x77'));return respondWithRpcPromise('AcceptMessage',_0x2957('0x78'),_0x984a34);}return null;})[_0x2957('0x1d')](function(_0x1b587b){if(_0x1b587b){if(_0x1b20b2[_0x2957('0x51')][_0x2957('0x79')]){_0x984a34['message'][_0x2957('0x7a')]=util[_0x2957('0x67')](_0x2957('0x7b'),_0x1b20b2['user'][_0x2957('0x33')]);_0x984a34[_0x2957('0x23')][_0x2957('0x7c')]=_0x984a34[_0x2957('0x7c')];_0x984a34[_0x2957('0x23')][_0x2957('0x7d')]=_0x2957('0x6b');return respondWithRpcPromise(_0x2957('0x7e'),_0x2957('0x7e'),{'event':_0x2957('0x7f'),'message':_0x984a34[_0x2957('0x23')]},client9002)['then'](function(){return _0x984a34;});}return _0x984a34;}return null;})[_0x2957('0x1d')](respondWithResult(_0x3811ce,null))[_0x2957('0x26')](handleError(_0x3811ce,null));};var interaction_log=require(_0x2957('0x11'))(_0x2957('0x6a'));exports[_0x2957('0x2f')]=function(_0x9b49bc,_0x10c601,_0x197cc5){var _0x118321={'agent':{},'channel':_0x2957('0x6c')};if(_0x9b49bc['body']['id']){delete _0x9b49bc['body']['id'];}_0x9b49bc[_0x2957('0x51')][_0x2957('0x6f')]=_0x9b49bc[_0x2957('0x51')][_0x2957('0x6f')]||_0x9b49bc[_0x2957('0x70')]['id'];_0x118321['agent']['id']=_0x9b49bc[_0x2957('0x51')]['UserId'];return db[_0x2957('0x36')][_0x2957('0x50')]({'where':{'id':_0x9b49bc[_0x2957('0x4f')]['id'],'UserId':null}})[_0x2957('0x1d')](handleEntityNotFound(_0x10c601,null))[_0x2957('0x1d')](function(_0x1ef2f9){if(_0x1ef2f9){_0x118321[_0x2957('0x23')]=_0x1ef2f9[_0x2957('0x80')]({'plain':!![]});return db[_0x2957('0x81')][_0x2957('0x50')]({'where':{'id':_0x1ef2f9['MailInteractionId']}});}return null;})[_0x2957('0x1d')](handleEntityNotFound(_0x10c601,null))[_0x2957('0x1d')](function(_0x540c49){if(_0x540c49){_0x118321['interaction']=_0x540c49[_0x2957('0x80')]({'plain':!![]});interaction_log[_0x2957('0x24')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x9b49bc['user']['id'],_0x9b49bc[_0x2957('0x70')][_0x2957('0x33')],_0x9b49bc[_0x2957('0x70')][_0x2957('0x76')],_0x118321[_0x2957('0x74')]['id'],_0x9b49bc[_0x2957('0x51')]?JSON[_0x2957('0x69')](_0x9b49bc[_0x2957('0x51')]):_0x2957('0x77'));return respondWithRpcPromise(_0x2957('0x82'),_0x2957('0x83'),_0x118321);}return null;})['then'](function(_0x32624f){if(_0x32624f){_0x32624f[_0x2957('0x23')][_0x2957('0x7a')]=util[_0x2957('0x67')]('SIP/%s',_0x9b49bc[_0x2957('0x70')][_0x2957('0x33')]);_0x32624f[_0x2957('0x23')][_0x2957('0x7c')]=_0x118321[_0x2957('0x7c')];_0x32624f[_0x2957('0x23')][_0x2957('0x7d')]=_0x2957('0x2f');respondWithRpcPromise(_0x2957('0x7e'),_0x2957('0x7e'),{'event':'rejectmessage','message':_0x32624f[_0x2957('0x23')]},client9002);return _0x118321;}return null;})[_0x2957('0x1d')](respondWithResult(_0x10c601,null))[_0x2957('0x26')](handleError(_0x10c601,null));};exports['download']=function(_0x477870,_0x27afa4){var _0x11f858=moment()['unix']()['toString']();var _0x1809c8=path['join'](config[_0x2957('0x64')],'server',_0x2957('0x84'),'tmp');var _0x5a34ec=path[_0x2957('0x63')](config['root'],_0x2957('0x85'),_0x2957('0x84'),_0x2957('0x62'));var _0x1e0040=util[_0x2957('0x67')]('message-%s.eml',_0x11f858);return db[_0x2957('0x36')][_0x2957('0x50')]({'where':{'id':_0x477870[_0x2957('0x4f')]['id']},'attributes':['id',_0x2957('0x51'),_0x2957('0x86'),'to','cc','bcc','subject',_0x2957('0x87')],'include':_0x477870[_0x2957('0x39')][_0x2957('0x62')]?[{'model':db[_0x2957('0x88')],'as':_0x2957('0x89')}]:undefined})['then'](handleEntityNotFound(_0x27afa4,null))[_0x2957('0x1d')](function(_0x17c515){if(_0x17c515){var _0x38ef80=_0x17c515;var _0x308a72={'from':_0x38ef80[_0x2957('0x86')],'to':_0x38ef80['to'],'subject':_0x38ef80[_0x2957('0x8a')],'html':_0x38ef80['body'],'headers':{'Date':moment(_0x38ef80['createdAt'])[_0x2957('0x67')](_0x2957('0x8b'))},'attachments':[]};if(_0x17c515['cc']){_0x308a72[_0x2957('0x8c')]['Cc']=_0x17c515['cc'];}if(_0x17c515['bcc']){_0x308a72['headers'][_0x2957('0x8d')]=_0x17c515[_0x2957('0x8e')];}return new BPromise(function(_0x3da631,_0x2c5fa3){if(_0x17c515['Attachments']){for(var _0x5bdb2f=0x0;_0x5bdb2f<_0x17c515[_0x2957('0x89')][_0x2957('0x3f')];_0x5bdb2f++){var _0x10f8db=_0x17c515[_0x2957('0x89')][_0x5bdb2f];var _0x39168e=path[_0x2957('0x63')](_0x5a34ec,_0x10f8db[_0x2957('0x8f')]);if(fs['existsSync'](_0x39168e)){_0x308a72[_0x2957('0x62')][_0x2957('0x90')]({'name':_0x10f8db[_0x2957('0x33')],'contentType':_0x10f8db[_0x2957('0x47')],'data':fs[_0x2957('0x91')](_0x39168e)});}}}emlformat[_0x2957('0x92')](_0x308a72,function(_0x5b5706,_0xb26864){if(_0x5b5706)return _0x2c5fa3(_0x5b5706);fs[_0x2957('0x93')](path[_0x2957('0x63')](_0x1809c8,_0x1e0040),_0xb26864);return _0x3da631(_0xb26864);});});}})[_0x2957('0x1d')](function(_0x1c2bfb){if(_0x1c2bfb){return _0x27afa4[_0x2957('0x94')](path['join'](_0x1809c8,_0x1e0040),_0x1e0040,function(_0x3b5622){if(_0x3b5622){console[_0x2957('0x95')](_0x2957('0x96'),_0x3b5622);}else{fs['unlinkSync'](path[_0x2957('0x63')](_0x1809c8,_0x1e0040));}});}})['catch'](handleError(_0x27afa4,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 8206d03..93dc786 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe14b,0x93));var _0xbe14=function(_0x156f88,_0x1af3af){_0x156f88=_0x156f88-0x0;var _0x1ad03f=_0xe14b[_0x156f88];return _0x1ad03f;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var MailMessage=require(_0xbe14('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){MailMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);MailMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];MailMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x5e0c=['MailMessage','setMaxListeners','save','update','remove','emit','exports','../../mysqldb'];(function(_0x54a294,_0x3c9615){var _0x458711=function(_0x8f0efb){while(--_0x8f0efb){_0x54a294['push'](_0x54a294['shift']());}};_0x458711(++_0x3c9615);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x437339,_0x5ef32b){_0x437339=_0x437339-0x0;var _0x3b4c70=_0x5e0c[_0x437339];return _0x3b4c70;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xc5e0('0x0'))['db'][_0xc5e0('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc5e0('0x2')](0x0);var events={'afterCreate':_0xc5e0('0x3'),'afterUpdate':_0xc5e0('0x4'),'afterDestroy':_0xc5e0('0x5')};function emitEvent(_0x4adda8){return function(_0x60c6c3,_0x108ea2,_0x43f754){MailMessageEvents[_0xc5e0('0x6')](_0x4adda8+':'+_0x60c6c3['id'],_0x60c6c3);MailMessageEvents[_0xc5e0('0x6')](_0x4adda8,_0x60c6c3);_0x43f754(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xc5e0('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index fb9533a..bb1bf56 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 _0x1c3b=['findOne','MailInteractionId','then','update','createdAt','body','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./mailMessage.attributes','exports','define','MailMessage','messageId','models','get','toLowerCase','direction','out','secret','isNil','UserId','MailInteraction'];(function(_0x5f2a50,_0x4700e0){var _0x7577ca=function(_0x45f47e){while(--_0x45f47e){_0x5f2a50['push'](_0x5f2a50['shift']());}};_0x7577ca(++_0x4700e0);}(_0x1c3b,0x10d));var _0xb1c3=function(_0x1c4da6,_0x61d24d){_0x1c4da6=_0x1c4da6-0x0;var _0x28035e=_0x1c3b[_0x1c4da6];return _0x28035e;};'use strict';var _=require(_0xb1c3('0x0'));var util=require(_0xb1c3('0x1'));var logger=require(_0xb1c3('0x2'))(_0xb1c3('0x3'));var moment=require(_0xb1c3('0x4'));var BPromise=require(_0xb1c3('0x5'));var rp=require(_0xb1c3('0x6'));var attributes=require(_0xb1c3('0x7'));module[_0xb1c3('0x8')]=function(_0x158946,_0x83f932){return _0x158946[_0xb1c3('0x9')](_0xb1c3('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xb1c3('0xb'),'fields':['messageId']}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc3424e,_0xc2e83b,_0x3652f0){var _0x138062=_0x158946[_0xb1c3('0xc')];var _0x21fd19=_0xc3424e[_0xb1c3('0xd')]({'plain':!![]});if(_0x21fd19['direction'][_0xb1c3('0xe')]()==='in'||_0x21fd19[_0xb1c3('0xf')][_0xb1c3('0xe')]()===_0xb1c3('0x10')&&!_0x21fd19[_0xb1c3('0x11')]&&!_[_0xb1c3('0x12')](_0x21fd19[_0xb1c3('0x13')])){_0x138062[_0xb1c3('0x14')][_0xb1c3('0x15')]({'where':{'id':_0x21fd19[_0xb1c3('0x16')]}})[_0xb1c3('0x17')](function(_0x5af584){if(_0x5af584){_0x5af584[_0xb1c3('0x18')]({'lastMsgAt':_0x21fd19[_0xb1c3('0x19')],'lastMsgDirection':_0x21fd19[_0xb1c3('0xf')][_0xb1c3('0xe')](),'lastMsgBody':_0x21fd19[_0xb1c3('0x1a')]});}})[_0xb1c3('0x1b')](function(_0x3a57f5){console['error'](_0x3a57f5);});}_0x3652f0();}},'charset':_0xb1c3('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x65fb=['utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','./mailMessage.attributes','exports','define','messageId','models','get','direction','toLowerCase','out','secret','isNil','findOne','MailInteractionId','then','body','catch','error'];(function(_0x21e76f,_0x4dba56){var _0x336351=function(_0x149429){while(--_0x149429){_0x21e76f['push'](_0x21e76f['shift']());}};_0x336351(++_0x4dba56);}(_0x65fb,0x12c));var _0xb65f=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0x65fb[_0x470e67];return _0x28bbde;};'use strict';var _=require('lodash');var util=require(_0xb65f('0x0'));var logger=require('../../config/logger')(_0xb65f('0x1'));var moment=require(_0xb65f('0x2'));var BPromise=require(_0xb65f('0x3'));var rp=require(_0xb65f('0x4'));var attributes=require(_0xb65f('0x5'));module[_0xb65f('0x6')]=function(_0x381911,_0x57d115){return _0x381911[_0xb65f('0x7')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xb65f('0x8'),'fields':[_0xb65f('0x8')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3032c7,_0x5d44d9,_0x7b3de9){var _0x4e7a2a=_0x381911[_0xb65f('0x9')];var _0x24dc0a=_0x3032c7[_0xb65f('0xa')]({'plain':!![]});if(_0x24dc0a['direction']['toLowerCase']()==='in'||_0x24dc0a[_0xb65f('0xb')][_0xb65f('0xc')]()===_0xb65f('0xd')&&!_0x24dc0a[_0xb65f('0xe')]&&!_[_0xb65f('0xf')](_0x24dc0a['UserId'])){_0x4e7a2a['MailInteraction'][_0xb65f('0x10')]({'where':{'id':_0x24dc0a[_0xb65f('0x11')]}})[_0xb65f('0x12')](function(_0x315160){if(_0x315160){_0x315160['update']({'lastMsgAt':_0x24dc0a['createdAt'],'lastMsgDirection':_0x24dc0a[_0xb65f('0xb')][_0xb65f('0xc')](),'lastMsgBody':_0x24dc0a[_0xb65f('0x13')]});}})[_0xb65f('0x14')](function(_0x2677ab){console[_0xb65f('0x15')](_0x2677ab);});}_0x7b3de9();}},'charset':'utf8mb4','collate':_0xb65f('0x16')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 565a0ee..0570109 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 _0xdb2a=['redis','socket.io-emitter','./mailMessage.socket','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','create','options','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xdb2a,0x16f));var _0xadb2=function(_0x2a0b95,_0x2d6860){_0x2a0b95=_0x2a0b95-0x0;var _0x31b0cc=_0xdb2a[_0x2a0b95];return _0x31b0cc;};'use strict';var _=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var moment=require(_0xadb2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb2('0x3'));var db=require(_0xadb2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xadb2('0x5'))('rpc');var config=require(_0xadb2('0x6'));var jayson=require(_0xadb2('0x7'));var client=jayson[_0xadb2('0x8')][_0xadb2('0x9')]({'port':0x232a});config[_0xadb2('0xa')]=_['defaults'](config[_0xadb2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xadb2('0xb'))(new Redis(config[_0xadb2('0xa')]));require(_0xadb2('0xc'))['register'](socket);function respondWithRpcPromise(_0x407b26,_0xe47423,_0x15f179){return new BPromise(function(_0x49706f,_0x23d553){return client['request'](_0x407b26,_0x15f179)[_0xadb2('0xd')](function(_0x4fac30){logger['info'](_0xadb2('0xe'),_0xe47423,_0xadb2('0xf'));logger[_0xadb2('0x10')](_0xadb2('0x11'),_0xe47423,'request\x20sent',JSON[_0xadb2('0x12')](_0x4fac30));if(_0x4fac30[_0xadb2('0x13')]){if(_0x4fac30[_0xadb2('0x13')][_0xadb2('0x14')]===0x1f4){logger[_0xadb2('0x13')](_0xadb2('0xe'),_0xe47423,_0x4fac30[_0xadb2('0x13')][_0xadb2('0x15')]);return _0x23d553(_0x4fac30[_0xadb2('0x13')]['message']);}logger[_0xadb2('0x13')](_0xadb2('0xe'),_0xe47423,_0x4fac30['error'][_0xadb2('0x15')]);return _0x49706f(_0x4fac30['error'][_0xadb2('0x15')]);}else{logger[_0xadb2('0x16')](_0xadb2('0xe'),_0xe47423,'request\x20sent');_0x49706f(_0x4fac30[_0xadb2('0x17')][_0xadb2('0x15')]);}})[_0xadb2('0x18')](function(_0x58dfa3){logger[_0xadb2('0x13')](_0xadb2('0xe'),_0xe47423,_0x58dfa3);_0x23d553(_0x58dfa3);});});}exports[_0xadb2('0x19')]=function(_0x1eeefb){var _0x2a66a6=this;return new Promise(function(_0x1dd0d0,_0xca90c4){return db[_0xadb2('0x1a')][_0xadb2('0x1b')](_0x1eeefb['body'],{'raw':_0x1eeefb[_0xadb2('0x1c')]?_0x1eeefb[_0xadb2('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xadb2('0xd')](function(_0x3591d0){logger[_0xadb2('0x16')]('CreateMailMessage',_0x1eeefb);logger[_0xadb2('0x10')]('CreateMailMessage',_0x1eeefb,JSON[_0xadb2('0x12')](_0x3591d0));_0x1dd0d0(_0x3591d0);})[_0xadb2('0x18')](function(_0x408f3d){logger[_0xadb2('0x13')](_0xadb2('0x19'),_0x408f3d[_0xadb2('0x15')],_0x1eeefb);_0xca90c4(_0x2a66a6[_0xadb2('0x13')](0x1f4,_0x408f3d[_0xadb2('0x15')]));});});}; \ No newline at end of file +var _0x6753=['result','CreateMailMessage','MailMessage','body','options','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0x6753,0xa1));var _0x3675=function(_0x34cb71,_0xa5cf51){_0x34cb71=_0x34cb71-0x0;var _0x5bae6d=_0x6753[_0x34cb71];return _0x5bae6d;};'use strict';var _=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var moment=require(_0x3675('0x2'));var BPromise=require(_0x3675('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3675('0x4'));var db=require(_0x3675('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3675('0x6'))(_0x3675('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3675('0x8')]({'port':0x232a});config[_0x3675('0x9')]=_[_0x3675('0xa')](config[_0x3675('0x9')],{'host':_0x3675('0xb'),'port':0x18eb});var socket=require(_0x3675('0xc'))(new Redis(config[_0x3675('0x9')]));require(_0x3675('0xd'))[_0x3675('0xe')](socket);function respondWithRpcPromise(_0x1d5d32,_0xa191a5,_0x2a8748){return new BPromise(function(_0x4441b8,_0x420ffa){return client['request'](_0x1d5d32,_0x2a8748)[_0x3675('0xf')](function(_0x173473){logger['info'](_0x3675('0x10'),_0xa191a5,_0x3675('0x11'));logger[_0x3675('0x12')](_0x3675('0x13'),_0xa191a5,_0x3675('0x11'),JSON[_0x3675('0x14')](_0x173473));if(_0x173473[_0x3675('0x15')]){if(_0x173473['error'][_0x3675('0x16')]===0x1f4){logger[_0x3675('0x15')](_0x3675('0x10'),_0xa191a5,_0x173473[_0x3675('0x15')]['message']);return _0x420ffa(_0x173473[_0x3675('0x15')][_0x3675('0x17')]);}logger[_0x3675('0x15')](_0x3675('0x10'),_0xa191a5,_0x173473['error'][_0x3675('0x17')]);return _0x4441b8(_0x173473[_0x3675('0x15')][_0x3675('0x17')]);}else{logger[_0x3675('0x18')](_0x3675('0x10'),_0xa191a5,'request\x20sent');_0x4441b8(_0x173473[_0x3675('0x19')][_0x3675('0x17')]);}})['catch'](function(_0xe9f968){logger['error'](_0x3675('0x10'),_0xa191a5,_0xe9f968);_0x420ffa(_0xe9f968);});});}exports[_0x3675('0x1a')]=function(_0x54d793){var _0x54ec46=this;return new Promise(function(_0x3d1067,_0x2f2faf){return db[_0x3675('0x1b')]['create'](_0x54d793[_0x3675('0x1c')],{'raw':_0x54d793[_0x3675('0x1d')]?_0x54d793['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x129078){logger[_0x3675('0x18')](_0x3675('0x1a'),_0x54d793);logger[_0x3675('0x12')](_0x3675('0x1a'),_0x54d793,JSON[_0x3675('0x14')](_0x129078));_0x3d1067(_0x129078);})[_0x3675('0x1e')](function(_0x5ca335){logger[_0x3675('0x15')](_0x3675('0x1a'),_0x5ca335[_0x3675('0x17')],_0x54d793);_0x2f2faf(_0x54ec46['error'](0x1f4,_0x5ca335['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 8d737a1..440ac5e 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 _0xfaf9=['remove','update','emit','removeListener','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x501e99,_0x49e496){var _0x4f8cf9=function(_0x5776be){while(--_0x5776be){_0x501e99['push'](_0x501e99['shift']());}};_0x4f8cf9(++_0x49e496);}(_0xfaf9,0x16f));var _0x9faf=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xfaf9[_0x25bea7];return _0x175952;};'use strict';var MailMessageEvents=require(_0x9faf('0x0'));var events=[_0x9faf('0x1'),_0x9faf('0x2'),_0x9faf('0x3')];function createListener(_0x5acac8,_0x18b0cf){return function(_0x26f0da){_0x18b0cf[_0x9faf('0x4')](_0x5acac8,_0x26f0da);};}function removeListener(_0x43ddb8,_0xd8d855){return function(){MailMessageEvents[_0x9faf('0x5')](_0x43ddb8,_0xd8d855);};}exports[_0x9faf('0x6')]=function(_0x558636){for(var _0x56422a=0x0,_0x59a7a0=events[_0x9faf('0x7')];_0x56422a<_0x59a7a0;_0x56422a++){var _0x4bb8da=events[_0x56422a];var _0x2feab6=createListener(_0x9faf('0x8')+_0x4bb8da,_0x558636);MailMessageEvents['on'](_0x4bb8da,_0x2feab6);}}; \ No newline at end of file +var _0x0565=['register','length','mailMessage:','./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x5f0ff3,_0xf76a10){var _0x2955e5=function(_0x3e20aa){while(--_0x3e20aa){_0x5f0ff3['push'](_0x5f0ff3['shift']());}};_0x2955e5(++_0xf76a10);}(_0x0565,0xae));var _0x5056=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0565[_0x20a584];return _0x4b41a8;};'use strict';var MailMessageEvents=require(_0x5056('0x0'));var events=[_0x5056('0x1'),_0x5056('0x2'),_0x5056('0x3')];function createListener(_0x1d20d2,_0x4c9a57){return function(_0x193c1d){_0x4c9a57[_0x5056('0x4')](_0x1d20d2,_0x193c1d);};}function removeListener(_0x34553c,_0x31fbca){return function(){MailMessageEvents[_0x5056('0x5')](_0x34553c,_0x31fbca);};}exports[_0x5056('0x6')]=function(_0x4589f0){for(var _0x135cf9=0x0,_0x51636b=events[_0x5056('0x7')];_0x135cf9<_0x51636b;_0x135cf9++){var _0x50754a=events[_0x135cf9];var _0x23eed4=createListener(_0x5056('0x8')+_0x50754a,_0x4589f0);MailMessageEvents['on'](_0x50754a,_0x23eed4);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 4bb5f15..6970d75 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 _0x979c=['destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','isAuthenticated','describe','getMembers','/:id/teams','getTeams','/:id/users','create','addTeams','post','put','/:id','update','delete'];(function(_0x155bbf,_0x1bca34){var _0x1cb0ac=function(_0x101c7c){while(--_0x101c7c){_0x155bbf['push'](_0x155bbf['shift']());}};_0x1cb0ac(++_0x1bca34);}(_0x979c,0xc8));var _0xc979=function(_0x47b5f1,_0x468ef1){_0x47b5f1=_0x47b5f1-0x0;var _0x5dbd1f=_0x979c[_0x47b5f1];return _0x5dbd1f;};'use strict';var multer=require(_0xc979('0x0'));var util=require(_0xc979('0x1'));var path=require(_0xc979('0x2'));var timeout=require('connect-timeout');var express=require(_0xc979('0x3'));var router=express[_0xc979('0x4')]();var auth=require(_0xc979('0x5'));var interaction=require(_0xc979('0x6'));var config=require(_0xc979('0x7'));var controller=require(_0xc979('0x8'));router[_0xc979('0x9')]('/',auth['isAuthenticated'](),controller[_0xc979('0xa')]);router[_0xc979('0x9')]('/describe',auth[_0xc979('0xb')](),controller[_0xc979('0xc')]);router[_0xc979('0x9')]('/:id',auth[_0xc979('0xb')](),controller['show']);router[_0xc979('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xc979('0xd')]);router[_0xc979('0x9')](_0xc979('0xe'),auth[_0xc979('0xb')](),controller[_0xc979('0xf')]);router[_0xc979('0x9')](_0xc979('0x10'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xc979('0xb')](),controller[_0xc979('0x11')]);router['post'](_0xc979('0xe'),auth[_0xc979('0xb')](),controller[_0xc979('0x12')]);router[_0xc979('0x13')]('/:id/users',auth[_0xc979('0xb')](),controller['addAgents']);router[_0xc979('0x14')](_0xc979('0x15'),auth[_0xc979('0xb')](),controller[_0xc979('0x16')]);router[_0xc979('0x17')]('/:id',auth[_0xc979('0xb')](),controller[_0xc979('0x18')]);router[_0xc979('0x17')](_0xc979('0xe'),auth[_0xc979('0xb')](),controller[_0xc979('0x19')]);router['delete'](_0xc979('0x10'),auth[_0xc979('0xb')](),controller[_0xc979('0x1a')]);module[_0xc979('0x1b')]=router; \ No newline at end of file +var _0xec46=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x470300,_0x4ebcbd){var _0x4a950e=function(_0x4aaf7b){while(--_0x4aaf7b){_0x470300['push'](_0x470300['shift']());}};_0x4a950e(++_0x4ebcbd);}(_0xec46,0x1c5));var _0x6ec4=function(_0x3ce76a,_0x465d60){_0x3ce76a=_0x3ce76a-0x0;var _0x3b3bef=_0xec46[_0x3ce76a];return _0x3b3bef;};'use strict';var multer=require(_0x6ec4('0x0'));var util=require(_0x6ec4('0x1'));var path=require(_0x6ec4('0x2'));var timeout=require(_0x6ec4('0x3'));var express=require(_0x6ec4('0x4'));var router=express[_0x6ec4('0x5')]();var auth=require(_0x6ec4('0x6'));var interaction=require(_0x6ec4('0x7'));var config=require(_0x6ec4('0x8'));var controller=require('./mailQueue.controller');router[_0x6ec4('0x9')]('/',auth['isAuthenticated'](),controller[_0x6ec4('0xa')]);router[_0x6ec4('0x9')](_0x6ec4('0xb'),auth[_0x6ec4('0xc')](),controller[_0x6ec4('0xd')]);router[_0x6ec4('0x9')]('/:id',auth[_0x6ec4('0xc')](),controller[_0x6ec4('0xe')]);router[_0x6ec4('0x9')](_0x6ec4('0xf'),auth[_0x6ec4('0xc')](),controller[_0x6ec4('0x10')]);router[_0x6ec4('0x9')](_0x6ec4('0x11'),auth['isAuthenticated'](),controller[_0x6ec4('0x12')]);router[_0x6ec4('0x9')](_0x6ec4('0x13'),auth['isAuthenticated'](),controller[_0x6ec4('0x14')]);router[_0x6ec4('0x15')]('/',auth[_0x6ec4('0xc')](),controller['create']);router[_0x6ec4('0x15')]('/:id/teams',auth[_0x6ec4('0xc')](),controller[_0x6ec4('0x16')]);router['post'](_0x6ec4('0x13'),auth[_0x6ec4('0xc')](),controller[_0x6ec4('0x17')]);router[_0x6ec4('0x18')]('/:id',auth[_0x6ec4('0xc')](),controller[_0x6ec4('0x19')]);router[_0x6ec4('0x1a')]('/:id',auth[_0x6ec4('0xc')](),controller['destroy']);router[_0x6ec4('0x1a')](_0x6ec4('0x11'),auth[_0x6ec4('0xc')](),controller['removeTeams']);router['delete'](_0x6ec4('0x13'),auth[_0x6ec4('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index ccca33b..003ed0a 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 _0x9373=['rrmemory','beepall','roundrobin','sequelize','STRING','INTEGER'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9373,0x177));var _0x3937=function(_0x1860df,_0x399d5c){_0x1860df=_0x1860df-0x0;var _0x5cd5b4=_0x9373[_0x1860df];return _0x5cd5b4;};'use strict';var Sequelize=require(_0x3937('0x0'));module['exports']={'name':{'type':Sequelize[_0x3937('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3937('0x1')]},'timeout':{'type':Sequelize[_0x3937('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3937('0x3'),_0x3937('0x4'),_0x3937('0x5'))}}; \ No newline at end of file +var _0x714b=['roundrobin','sequelize','exports','name','STRING','ENUM','beepall'];(function(_0x58df01,_0x30e266){var _0x353616=function(_0x26c56b){while(--_0x26c56b){_0x58df01['push'](_0x58df01['shift']());}};_0x353616(++_0x30e266);}(_0x714b,0x1c8));var _0xb714=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x714b[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xb714('0x0'));module[_0xb714('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb714('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb714('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb714('0x4')]('rrmemory',_0xb714('0x5'),_0xb714('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 194bf29..a42b0f1 100644 --- a/server/api/mailQueue/mailQueue.controller.js +++ b/server/api/mailQueue/mailQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['stack','name','index','MailQueue','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','pick','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','union','addAgents','penalty','ids','removeTeams','omit','emit','removeAgents','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error'];(function(_0x37bcd4,_0x2dafb5){var _0x5e2bd4=function(_0x2ea4b7){while(--_0x2ea4b7){_0x37bcd4['push'](_0x37bcd4['shift']());}};_0x5e2bd4(++_0x2dafb5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./mailQueue.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='MailQueues';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':!![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['MailQueue'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['MailQueue'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931){return db['MailQueue'][_0x0a9e('0x4f')]()['then'](respondWithResult(_0x145931,null))[_0x0a9e('0x42')](handleError(_0x145931,null));};exports['getMembers']=function(_0x5da27d,_0x5df0ad,_0x2da03c){var _0x47de4c={'raw':!![],'where':{}},_0x2f7092={},_0x65432;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x5da27d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5df0ad,null))[_0x0a9e('0x23')](function(_0x28d814){if(_0x28d814){_0x65432=_0x28d814['get']({'plain':!![]});_0x2f7092[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x51')][_0x0a9e('0x2b')]);_0x2f7092[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5da27d['query']);_0x2f7092[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2f7092['model'],_0x2f7092[_0x0a9e('0x2e')]);_0x47de4c['attributes']=_[_0x0a9e('0x2f')](_0x2f7092['model'],qs['fields'](_0x5da27d['query'][_0x0a9e('0x31')]));_0x47de4c['attributes']=_0x47de4c[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x47de4c[_0x0a9e('0x30')]:_0x2f7092[_0x0a9e('0x2c')];if(!_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x47de4c[_0x0a9e('0x1d')]=qs['limit'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x47de4c[_0x0a9e('0x1c')]=qs['offset'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}_0x47de4c[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x5da27d['query'][_0x0a9e('0x35')]);_0x47de4c[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x52')](_0x5da27d[_0x0a9e('0x2e')],_0x2f7092[_0x0a9e('0x36')]));_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x53')]=_0x28d814['id'];if(_0x5da27d['query'][_0x0a9e('0x37')]){_0x47de4c[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x47de4c['where'],{'$or':_[_0x0a9e('0x3a')](_0x47de4c['attributes'],function(_0x5211e3){var _0x242745={};_0x242745[_0x5211e3]={'$like':'%'+_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x242745;})});}_0x47de4c=_[_0x0a9e('0x38')]({},_0x47de4c,_0x5da27d[_0x0a9e('0x3e')]);return db[_0x0a9e('0x51')][_0x0a9e('0x54')](_0x47de4c);}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){return db[_0x0a9e('0x55')][_0x0a9e('0x56')]({'where':{'id':_[_0x0a9e('0x3a')](_0x2d7205,_0x0a9e('0x57')),'role':_0x0a9e('0x58')},'attributes':['id',_0x0a9e('0x28'),_0x0a9e('0x59'),_0x0a9e('0x5a'),_0x0a9e('0x5b')]});}})['then'](function(_0x1b0b98){if(_0x1b0b98){return{'count':_0x1b0b98[_0x0a9e('0x1b')],'rows':_[_0x0a9e('0x3a')](_0x1b0b98['rows'],function(_0x1148a1){return{'membername':_0x1148a1[_0x0a9e('0x28')],'UserId':_0x1148a1['id'],'queue_name':_0x65432['name'],'MailQueueId':_0x65432['id'],'interface':util[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x0a9e('0x5e'),_0x1148a1[_0x0a9e('0x28')]),'penalty':0x0,'paused':_0x1148a1[_0x0a9e('0x59')],'createdAt':_0x1148a1['createdAt'],'updatedAt':_0x1148a1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5df0ad,_0x47de4c))[_0x0a9e('0x42')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x5f')]=function(_0x1104ad,_0x23a7d3,_0x6abd03){var _0x380ab3={};var _0xeef20={};var _0x1a0677;var _0x5512d1;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x1104ad[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x23a7d3,null))[_0x0a9e('0x23')](function(_0x583b2e){if(_0x583b2e){_0x1a0677=_0x583b2e;_0xeef20[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db['Team'][_0x0a9e('0x2b')]);_0xeef20[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1104ad[_0x0a9e('0x2e')]);_0xeef20['filters']=_[_0x0a9e('0x2f')](_0xeef20[_0x0a9e('0x2c')],_0xeef20[_0x0a9e('0x2e')]);_0x380ab3[_0x0a9e('0x30')]=_['intersection'](_0xeef20[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x380ab3['attributes']=_0x380ab3[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x380ab3[_0x0a9e('0x30')]:_0xeef20[_0x0a9e('0x2c')];_0x380ab3[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x380ab3[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x1104ad[_0x0a9e('0x2e')],_0xeef20[_0x0a9e('0x36')]));if(_0x1104ad[_0x0a9e('0x2e')]['filter']){_0x380ab3[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x380ab3[_0x0a9e('0x39')],{'$or':_['map'](_0x380ab3[_0x0a9e('0x30')],function(_0x33dda0){var _0x8cea96={};_0x8cea96[_0x33dda0]={'$like':'%'+_0x1104ad[_0x0a9e('0x2e')]['filter']+'%'};return _0x8cea96;})});}_0x380ab3=_['merge']({},_0x380ab3,_0x1104ad[_0x0a9e('0x3e')]);return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})['then'](function(_0x45108c){if(_0x45108c){_0x5512d1=_0x45108c['length'];if(!_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x380ab3[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x380ab3[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x1104ad[_0x0a9e('0x2e')]['offset']);}return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})[_0x0a9e('0x23')](function(_0x45c109){if(_0x45c109){return _0x45c109?{'count':_0x5512d1,'rows':_0x45c109}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x23a7d3,null))['catch'](handleError(_0x23a7d3,null));};exports[_0x0a9e('0x60')]=function(_0xf0db1,_0x4bf3a5,_0x1d6834){var _0x5b7940=[];var _0x163710;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0xf0db1[_0x0a9e('0x47')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x94dcf5){if(_0x94dcf5){for(var _0x5ac73d=0x0;_0x5ac73d<_0x94dcf5[_0x0a9e('0x32')];_0x5ac73d+=0x1){for(var _0x36e975=0x0;_0x36e975<_0x94dcf5[_0x5ac73d]['Agents']['length'];_0x36e975+=0x1){_0x5b7940=_[_0x0a9e('0x63')](_0x5b7940,[_0x94dcf5[_0x5ac73d]['Agents'][_0x36e975]['id']]);}}return _0x5b7940;}})['then'](function(_0x4dc6b3){if(_0x4dc6b3){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0xf0db1[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3c6dd6){if(_0x3c6dd6){_0x163710=_0x3c6dd6;return _0x163710[_0x0a9e('0x64')](_0x5b7940,{'penalty':_0xf0db1['body'][_0x0a9e('0x65')]});}})['then'](function(_0x2871c1){if(_0x2871c1){return _0x163710[_0x0a9e('0x60')](_0xf0db1[_0x0a9e('0x47')][_0x0a9e('0x66')]);}})['then'](handleEntityNotFound(_0x4bf3a5,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x4bf3a5,null))[_0x0a9e('0x42')](handleError(_0x4bf3a5,null));};exports[_0x0a9e('0x67')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d=[];var _0x22063c;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x589ff3){if(_0x589ff3){for(var _0x40e0f0=0x0;_0x40e0f0<_0x589ff3[_0x0a9e('0x32')];_0x40e0f0+=0x1){for(var _0x3a1974=0x0;_0x3a1974<_0x589ff3[_0x40e0f0]['Agents'][_0x0a9e('0x32')];_0x3a1974+=0x1){_0x2a563d=_['union'](_0x2a563d,[_0x589ff3[_0x40e0f0][_0x0a9e('0x62')][_0x3a1974]['id']]);}}return _0x2a563d;}})[_0x0a9e('0x23')](function(_0x558a87){if(_0x558a87){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x5b74c3[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3a9a85){if(_0x3a9a85){_0x22063c=_0x3a9a85;return _0x22063c['removeAgents'](_0x2a563d);}})[_0x0a9e('0x23')](function(_0x31d25a){if(_0x22063c){return _0x22063c[_0x0a9e('0x67')](_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]);}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x23')](respondWithStatusCode(_0xb6e411,null))[_0x0a9e('0x42')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x64')]=function(_0x31af8c,_0x151956,_0x3754e2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x31af8c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x151956,null))[_0x0a9e('0x23')](function(_0x2ed526){if(_0x2ed526){return _0x2ed526[_0x0a9e('0x64')](_0x31af8c['body'][_0x0a9e('0x66')],_[_0x0a9e('0x68')](_0x31af8c['body'],[_0x0a9e('0x66'),'id'])||{})['spread'](function(_0x45d113){for(var _0x27041d=0x0;_0x27041d<_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')]['length'];_0x27041d+=0x1){socket[_0x0a9e('0x69')]('userMailQueue:save',{'UserId':_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')][_0x27041d],'MailQueueId':_0x31af8c['params']['id']});}return _0x45d113;});}})[_0x0a9e('0x23')](respondWithResult(_0x151956,null))[_0x0a9e('0x42')](handleError(_0x151956,null));};exports[_0x0a9e('0x6a')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4ab276[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x23')](function(_0x3c75b9){if(_0x3c75b9){return _0x3c75b9[_0x0a9e('0x6a')](_0x4ab276['query'][_0x0a9e('0x66')])['then'](function(_0x287324){if(_[_0x0a9e('0x6b')](_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')])){for(var _0x1b61d5=0x0;_0x1b61d5<_0x4ab276['query'][_0x0a9e('0x66')][_0x0a9e('0x32')];_0x1b61d5+=0x1){socket[_0x0a9e('0x69')](_0x0a9e('0x6c'),{'UserId':_0x4ab276[_0x0a9e('0x2e')]['ids'][_0x1b61d5],'MailQueueId':_0x4ab276['params']['id']});}}else{socket[_0x0a9e('0x69')]('userMailQueue:remove',{'UserId':_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')],'MailQueueId':_0x4ab276[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x4c788f,null))[_0x0a9e('0x42')](handleError(_0x4c788f,null));};exports[_0x0a9e('0x6d')]=function(_0x596312,_0x4db918,_0x1889ed){var _0x5dfbe2={};var _0x2469d1={};var _0x5c689c;var _0x427ccc;return db['MailQueue']['findOne']({'where':{'id':_0x596312[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4db918,null))['then'](function(_0x170af6){if(_0x170af6){_0x5c689c=_0x170af6;_0x2469d1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x55')][_0x0a9e('0x2b')]);_0x2469d1['query']=_['keys'](_0x596312[_0x0a9e('0x2e')]);_0x2469d1[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],_0x2469d1[_0x0a9e('0x2e')]);_0x5dfbe2['attributes']=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],qs['fields'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x5dfbe2[_0x0a9e('0x30')]=_0x5dfbe2[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x5dfbe2[_0x0a9e('0x30')]:_0x2469d1[_0x0a9e('0x2c')];_0x5dfbe2[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x596312[_0x0a9e('0x2e')]['sort']);_0x5dfbe2[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x596312[_0x0a9e('0x2e')],_0x2469d1[_0x0a9e('0x36')]));if(_0x596312['query']['filter']){_0x5dfbe2[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x5dfbe2[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x5dfbe2[_0x0a9e('0x30')],function(_0x59e46f){var _0x1339d0={};_0x1339d0[_0x59e46f]={'$like':'%'+_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x1339d0;})});}_0x5dfbe2=_['merge']({},_0x5dfbe2,_0x596312[_0x0a9e('0x3e')]);return _0x5c689c['getAgents'](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x4799d4){if(_0x4799d4){_0x427ccc=_0x4799d4[_0x0a9e('0x32')];if(!_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x5dfbe2[_0x0a9e('0x1d')]=qs['limit'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x5dfbe2[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x5c689c[_0x0a9e('0x6d')](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x2aaf07){if(_0x2aaf07){return _0x2aaf07?{'count':_0x427ccc,'rows':_0x2aaf07}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x4db918,null))[_0x0a9e('0x42')](handleError(_0x4db918,null));}; \ No newline at end of file +var _0xa9e0=['stack','name','index','MailQueue','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','pick','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','union','addAgents','penalty','ids','removeTeams','omit','emit','removeAgents','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error'];(function(_0x69b5e3,_0x2f39af){var _0x114d3b=function(_0x4bc35d){while(--_0x4bc35d){_0x69b5e3['push'](_0x69b5e3['shift']());}};_0x114d3b(++_0x2f39af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./mailQueue.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='MailQueues';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':!![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['MailQueue'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['MailQueue'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931){return db['MailQueue'][_0x0a9e('0x4f')]()['then'](respondWithResult(_0x145931,null))[_0x0a9e('0x42')](handleError(_0x145931,null));};exports['getMembers']=function(_0x5da27d,_0x5df0ad,_0x2da03c){var _0x47de4c={'raw':!![],'where':{}},_0x2f7092={},_0x65432;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x5da27d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5df0ad,null))[_0x0a9e('0x23')](function(_0x28d814){if(_0x28d814){_0x65432=_0x28d814['get']({'plain':!![]});_0x2f7092[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x51')][_0x0a9e('0x2b')]);_0x2f7092[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5da27d['query']);_0x2f7092[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2f7092['model'],_0x2f7092[_0x0a9e('0x2e')]);_0x47de4c['attributes']=_[_0x0a9e('0x2f')](_0x2f7092['model'],qs['fields'](_0x5da27d['query'][_0x0a9e('0x31')]));_0x47de4c['attributes']=_0x47de4c[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x47de4c[_0x0a9e('0x30')]:_0x2f7092[_0x0a9e('0x2c')];if(!_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x47de4c[_0x0a9e('0x1d')]=qs['limit'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x47de4c[_0x0a9e('0x1c')]=qs['offset'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}_0x47de4c[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x5da27d['query'][_0x0a9e('0x35')]);_0x47de4c[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x52')](_0x5da27d[_0x0a9e('0x2e')],_0x2f7092[_0x0a9e('0x36')]));_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x53')]=_0x28d814['id'];if(_0x5da27d['query'][_0x0a9e('0x37')]){_0x47de4c[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x47de4c['where'],{'$or':_[_0x0a9e('0x3a')](_0x47de4c['attributes'],function(_0x5211e3){var _0x242745={};_0x242745[_0x5211e3]={'$like':'%'+_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x242745;})});}_0x47de4c=_[_0x0a9e('0x38')]({},_0x47de4c,_0x5da27d[_0x0a9e('0x3e')]);return db[_0x0a9e('0x51')][_0x0a9e('0x54')](_0x47de4c);}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){return db[_0x0a9e('0x55')][_0x0a9e('0x56')]({'where':{'id':_[_0x0a9e('0x3a')](_0x2d7205,_0x0a9e('0x57')),'role':_0x0a9e('0x58')},'attributes':['id',_0x0a9e('0x28'),_0x0a9e('0x59'),_0x0a9e('0x5a'),_0x0a9e('0x5b')]});}})['then'](function(_0x1b0b98){if(_0x1b0b98){return{'count':_0x1b0b98[_0x0a9e('0x1b')],'rows':_[_0x0a9e('0x3a')](_0x1b0b98['rows'],function(_0x1148a1){return{'membername':_0x1148a1[_0x0a9e('0x28')],'UserId':_0x1148a1['id'],'queue_name':_0x65432['name'],'MailQueueId':_0x65432['id'],'interface':util[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x0a9e('0x5e'),_0x1148a1[_0x0a9e('0x28')]),'penalty':0x0,'paused':_0x1148a1[_0x0a9e('0x59')],'createdAt':_0x1148a1['createdAt'],'updatedAt':_0x1148a1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5df0ad,_0x47de4c))[_0x0a9e('0x42')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x5f')]=function(_0x1104ad,_0x23a7d3,_0x6abd03){var _0x380ab3={};var _0xeef20={};var _0x1a0677;var _0x5512d1;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x1104ad[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x23a7d3,null))[_0x0a9e('0x23')](function(_0x583b2e){if(_0x583b2e){_0x1a0677=_0x583b2e;_0xeef20[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db['Team'][_0x0a9e('0x2b')]);_0xeef20[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1104ad[_0x0a9e('0x2e')]);_0xeef20['filters']=_[_0x0a9e('0x2f')](_0xeef20[_0x0a9e('0x2c')],_0xeef20[_0x0a9e('0x2e')]);_0x380ab3[_0x0a9e('0x30')]=_['intersection'](_0xeef20[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x380ab3['attributes']=_0x380ab3[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x380ab3[_0x0a9e('0x30')]:_0xeef20[_0x0a9e('0x2c')];_0x380ab3[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x380ab3[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x1104ad[_0x0a9e('0x2e')],_0xeef20[_0x0a9e('0x36')]));if(_0x1104ad[_0x0a9e('0x2e')]['filter']){_0x380ab3[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x380ab3[_0x0a9e('0x39')],{'$or':_['map'](_0x380ab3[_0x0a9e('0x30')],function(_0x33dda0){var _0x8cea96={};_0x8cea96[_0x33dda0]={'$like':'%'+_0x1104ad[_0x0a9e('0x2e')]['filter']+'%'};return _0x8cea96;})});}_0x380ab3=_['merge']({},_0x380ab3,_0x1104ad[_0x0a9e('0x3e')]);return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})['then'](function(_0x45108c){if(_0x45108c){_0x5512d1=_0x45108c['length'];if(!_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x380ab3[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x380ab3[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x1104ad[_0x0a9e('0x2e')]['offset']);}return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})[_0x0a9e('0x23')](function(_0x45c109){if(_0x45c109){return _0x45c109?{'count':_0x5512d1,'rows':_0x45c109}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x23a7d3,null))['catch'](handleError(_0x23a7d3,null));};exports[_0x0a9e('0x60')]=function(_0xf0db1,_0x4bf3a5,_0x1d6834){var _0x5b7940=[];var _0x163710;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0xf0db1[_0x0a9e('0x47')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x94dcf5){if(_0x94dcf5){for(var _0x5ac73d=0x0;_0x5ac73d<_0x94dcf5[_0x0a9e('0x32')];_0x5ac73d+=0x1){for(var _0x36e975=0x0;_0x36e975<_0x94dcf5[_0x5ac73d]['Agents']['length'];_0x36e975+=0x1){_0x5b7940=_[_0x0a9e('0x63')](_0x5b7940,[_0x94dcf5[_0x5ac73d]['Agents'][_0x36e975]['id']]);}}return _0x5b7940;}})['then'](function(_0x4dc6b3){if(_0x4dc6b3){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0xf0db1[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3c6dd6){if(_0x3c6dd6){_0x163710=_0x3c6dd6;return _0x163710[_0x0a9e('0x64')](_0x5b7940,{'penalty':_0xf0db1['body'][_0x0a9e('0x65')]});}})['then'](function(_0x2871c1){if(_0x2871c1){return _0x163710[_0x0a9e('0x60')](_0xf0db1[_0x0a9e('0x47')][_0x0a9e('0x66')]);}})['then'](handleEntityNotFound(_0x4bf3a5,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x4bf3a5,null))[_0x0a9e('0x42')](handleError(_0x4bf3a5,null));};exports[_0x0a9e('0x67')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d=[];var _0x22063c;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x589ff3){if(_0x589ff3){for(var _0x40e0f0=0x0;_0x40e0f0<_0x589ff3[_0x0a9e('0x32')];_0x40e0f0+=0x1){for(var _0x3a1974=0x0;_0x3a1974<_0x589ff3[_0x40e0f0]['Agents'][_0x0a9e('0x32')];_0x3a1974+=0x1){_0x2a563d=_['union'](_0x2a563d,[_0x589ff3[_0x40e0f0][_0x0a9e('0x62')][_0x3a1974]['id']]);}}return _0x2a563d;}})[_0x0a9e('0x23')](function(_0x558a87){if(_0x558a87){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x5b74c3[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3a9a85){if(_0x3a9a85){_0x22063c=_0x3a9a85;return _0x22063c['removeAgents'](_0x2a563d);}})[_0x0a9e('0x23')](function(_0x31d25a){if(_0x22063c){return _0x22063c[_0x0a9e('0x67')](_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]);}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x23')](respondWithStatusCode(_0xb6e411,null))[_0x0a9e('0x42')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x64')]=function(_0x31af8c,_0x151956,_0x3754e2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x31af8c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x151956,null))[_0x0a9e('0x23')](function(_0x2ed526){if(_0x2ed526){return _0x2ed526[_0x0a9e('0x64')](_0x31af8c['body'][_0x0a9e('0x66')],_[_0x0a9e('0x68')](_0x31af8c['body'],[_0x0a9e('0x66'),'id'])||{})['spread'](function(_0x45d113){for(var _0x27041d=0x0;_0x27041d<_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')]['length'];_0x27041d+=0x1){socket[_0x0a9e('0x69')]('userMailQueue:save',{'UserId':_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')][_0x27041d],'MailQueueId':_0x31af8c['params']['id']});}return _0x45d113;});}})[_0x0a9e('0x23')](respondWithResult(_0x151956,null))[_0x0a9e('0x42')](handleError(_0x151956,null));};exports[_0x0a9e('0x6a')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4ab276[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x23')](function(_0x3c75b9){if(_0x3c75b9){return _0x3c75b9[_0x0a9e('0x6a')](_0x4ab276['query'][_0x0a9e('0x66')])['then'](function(_0x287324){if(_[_0x0a9e('0x6b')](_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')])){for(var _0x1b61d5=0x0;_0x1b61d5<_0x4ab276['query'][_0x0a9e('0x66')][_0x0a9e('0x32')];_0x1b61d5+=0x1){socket[_0x0a9e('0x69')](_0x0a9e('0x6c'),{'UserId':_0x4ab276[_0x0a9e('0x2e')]['ids'][_0x1b61d5],'MailQueueId':_0x4ab276['params']['id']});}}else{socket[_0x0a9e('0x69')]('userMailQueue:remove',{'UserId':_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')],'MailQueueId':_0x4ab276[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x4c788f,null))[_0x0a9e('0x42')](handleError(_0x4c788f,null));};exports[_0x0a9e('0x6d')]=function(_0x596312,_0x4db918,_0x1889ed){var _0x5dfbe2={};var _0x2469d1={};var _0x5c689c;var _0x427ccc;return db['MailQueue']['findOne']({'where':{'id':_0x596312[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4db918,null))['then'](function(_0x170af6){if(_0x170af6){_0x5c689c=_0x170af6;_0x2469d1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x55')][_0x0a9e('0x2b')]);_0x2469d1['query']=_['keys'](_0x596312[_0x0a9e('0x2e')]);_0x2469d1[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],_0x2469d1[_0x0a9e('0x2e')]);_0x5dfbe2['attributes']=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],qs['fields'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x5dfbe2[_0x0a9e('0x30')]=_0x5dfbe2[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x5dfbe2[_0x0a9e('0x30')]:_0x2469d1[_0x0a9e('0x2c')];_0x5dfbe2[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x596312[_0x0a9e('0x2e')]['sort']);_0x5dfbe2[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x596312[_0x0a9e('0x2e')],_0x2469d1[_0x0a9e('0x36')]));if(_0x596312['query']['filter']){_0x5dfbe2[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x5dfbe2[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x5dfbe2[_0x0a9e('0x30')],function(_0x59e46f){var _0x1339d0={};_0x1339d0[_0x59e46f]={'$like':'%'+_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x1339d0;})});}_0x5dfbe2=_['merge']({},_0x5dfbe2,_0x596312[_0x0a9e('0x3e')]);return _0x5c689c['getAgents'](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x4799d4){if(_0x4799d4){_0x427ccc=_0x4799d4[_0x0a9e('0x32')];if(!_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x5dfbe2[_0x0a9e('0x1d')]=qs['limit'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x5dfbe2[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x5c689c[_0x0a9e('0x6d')](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x2aaf07){if(_0x2aaf07){return _0x2aaf07?{'count':_0x427ccc,'rows':_0x2aaf07}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x4db918,null))[_0x0a9e('0x42')](handleError(_0x4db918,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index efc0f4e..bb8ced8 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 _0xb0bd=['emit','hasOwnProperty','hook','exports','MailQueue','setMaxListeners','save','update','remove'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xb0bd,0x136));var _0xdb0b=function(_0x3f0f82,_0x21723d){_0x3f0f82=_0x3f0f82-0x0;var _0x5e74d0=_0xb0bd[_0x3f0f82];return _0x5e74d0;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0xdb0b('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xdb0b('0x1')](0x0);var events={'afterCreate':_0xdb0b('0x2'),'afterUpdate':_0xdb0b('0x3'),'afterDestroy':_0xdb0b('0x4')};function emitEvent(_0x3cc5b5){return function(_0x440c9d,_0x2532b8,_0x54d251){MailQueueEvents[_0xdb0b('0x5')](_0x3cc5b5+':'+_0x440c9d['id'],_0x440c9d);MailQueueEvents['emit'](_0x3cc5b5,_0x440c9d);_0x54d251(null);};}for(var e in events){if(events[_0xdb0b('0x6')](e)){var event=events[e];MailQueue[_0xdb0b('0x7')](e,emitEvent(event));}}module[_0xdb0b('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xafc7=['events','MailQueue','setMaxListeners','save','update','emit','hook'];(function(_0x4437ae,_0x133fb2){var _0x2a03db=function(_0x587f90){while(--_0x587f90){_0x4437ae['push'](_0x4437ae['shift']());}};_0x2a03db(++_0x133fb2);}(_0xafc7,0xb6));var _0x7afc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xafc7[_0x2bf141];return _0x48277b;};'use strict';var EventEmitter=require(_0x7afc('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x7afc('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7afc('0x2')](0x0);var events={'afterCreate':_0x7afc('0x3'),'afterUpdate':_0x7afc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x28cf60){return function(_0x255a73,_0x3c37dd,_0x268703){MailQueueEvents[_0x7afc('0x5')](_0x28cf60+':'+_0x255a73['id'],_0x255a73);MailQueueEvents[_0x7afc('0x5')](_0x28cf60,_0x255a73);_0x268703(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x7afc('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 751124d..f7f375e 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 _0x3a81=['lodash','util','../../config/logger','api','bluebird','request-promise','./mailQueue.attributes','exports','MailQueue','mail_queues'];(function(_0x3b1128,_0x464335){var _0x4d952d=function(_0x1547f4){while(--_0x1547f4){_0x3b1128['push'](_0x3b1128['shift']());}};_0x4d952d(++_0x464335);}(_0x3a81,0xfa));var _0x13a8=function(_0x722d30,_0x1633a3){_0x722d30=_0x722d30-0x0;var _0x22b826=_0x3a81[_0x722d30];return _0x22b826;};'use strict';var _=require(_0x13a8('0x0'));var util=require(_0x13a8('0x1'));var logger=require(_0x13a8('0x2'))(_0x13a8('0x3'));var moment=require('moment');var BPromise=require(_0x13a8('0x4'));var rp=require(_0x13a8('0x5'));var attributes=require(_0x13a8('0x6'));module[_0x13a8('0x7')]=function(_0x5d373c,_0x3625b5){return _0x5d373c['define'](_0x13a8('0x8'),attributes,{'tableName':_0x13a8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05aa=['../../config/logger','api','moment','bluebird','request-promise','exports','define','MailQueue','mail_queues'];(function(_0x48a07c,_0x596430){var _0x1f6a06=function(_0x44b73f){while(--_0x44b73f){_0x48a07c['push'](_0x48a07c['shift']());}};_0x1f6a06(++_0x596430);}(_0x05aa,0x1dd));var _0xa05a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x05aa[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa05a('0x0'))(_0xa05a('0x1'));var moment=require(_0xa05a('0x2'));var BPromise=require(_0xa05a('0x3'));var rp=require(_0xa05a('0x4'));var attributes=require('./mailQueue.attributes');module[_0xa05a('0x5')]=function(_0x44a5b9,_0x3c408b){return _0x44a5b9[_0xa05a('0x6')](_0xa05a('0x7'),attributes,{'tableName':_0xa05a('0x8'),'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 fd53fbb..c28c3ed 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 _0x9da1=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','map','include','model','find','ShowMailQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1dfa13,_0x2b884e){var _0x10a1b1=function(_0x4d3ad7){while(--_0x4d3ad7){_0x1dfa13['push'](_0x1dfa13['shift']());}};_0x10a1b1(++_0x2b884e);}(_0x9da1,0x1bc));var _0x19da=function(_0x29f0d1,_0x329499){_0x29f0d1=_0x29f0d1-0x0;var _0x4560d3=_0x9da1[_0x29f0d1];return _0x4560d3;};'use strict';var _=require('lodash');var util=require(_0x19da('0x0'));var moment=require(_0x19da('0x1'));var BPromise=require(_0x19da('0x2'));var rs=require(_0x19da('0x3'));var fs=require('fs');var Redis=require(_0x19da('0x4'));var db=require(_0x19da('0x5'))['db'];var utils=require(_0x19da('0x6'));var logger=require('../../config/logger')(_0x19da('0x7'));var config=require(_0x19da('0x8'));var jayson=require(_0x19da('0x9'));var client=jayson['client'][_0x19da('0xa')]({'port':0x232a});config[_0x19da('0xb')]=_[_0x19da('0xc')](config[_0x19da('0xb')],{'host':_0x19da('0xd'),'port':0x18eb});var socket=require(_0x19da('0xe'))(new Redis(config[_0x19da('0xb')]));require(_0x19da('0xf'))[_0x19da('0x10')](socket);function respondWithRpcPromise(_0x55453c,_0x376bbc,_0x1647e9){return new BPromise(function(_0x39de34,_0x41d665){return client[_0x19da('0x11')](_0x55453c,_0x1647e9)[_0x19da('0x12')](function(_0x298719){logger[_0x19da('0x13')](_0x19da('0x14'),_0x376bbc,_0x19da('0x15'));logger[_0x19da('0x16')](_0x19da('0x17'),_0x376bbc,_0x19da('0x15'),JSON[_0x19da('0x18')](_0x298719));if(_0x298719[_0x19da('0x19')]){if(_0x298719[_0x19da('0x19')][_0x19da('0x1a')]===0x1f4){logger['error'](_0x19da('0x14'),_0x376bbc,_0x298719[_0x19da('0x19')]['message']);return _0x41d665(_0x298719['error'][_0x19da('0x1b')]);}logger['error'](_0x19da('0x14'),_0x376bbc,_0x298719['error'][_0x19da('0x1b')]);return _0x39de34(_0x298719[_0x19da('0x19')][_0x19da('0x1b')]);}else{logger['info'](_0x19da('0x14'),_0x376bbc,'request\x20sent');_0x39de34(_0x298719['result'][_0x19da('0x1b')]);}})[_0x19da('0x1c')](function(_0x24c382){logger[_0x19da('0x19')](_0x19da('0x14'),_0x376bbc,_0x24c382);_0x41d665(_0x24c382);});});}exports[_0x19da('0x1d')]=function(_0x5ea8ce){var _0x1294b7=this;return new Promise(function(_0x332b74,_0x122d6f){return db[_0x19da('0x1e')]['findAll']({'raw':_0x5ea8ce[_0x19da('0x1f')]?_0x5ea8ce['options'][_0x19da('0x20')]===undefined?!![]:![]:!![],'where':_0x5ea8ce[_0x19da('0x1f')]?_0x5ea8ce['options'][_0x19da('0x21')]||null:null,'attributes':_0x5ea8ce['options']?_0x5ea8ce['options'][_0x19da('0x22')]||null:null,'limit':_0x5ea8ce[_0x19da('0x1f')]?_0x5ea8ce['options'][_0x19da('0x23')]||null:null,'include':_0x5ea8ce[_0x19da('0x1f')]?_0x5ea8ce[_0x19da('0x1f')]['include']?_[_0x19da('0x24')](_0x5ea8ce['options'][_0x19da('0x25')],function(_0x4633de){return{'model':db[_0x4633de[_0x19da('0x26')]],'as':_0x4633de['as'],'attributes':_0x4633de[_0x19da('0x22')],'include':_0x4633de[_0x19da('0x25')]?_[_0x19da('0x24')](_0x4633de['include'],function(_0x4164c8){return{'model':db[_0x4164c8[_0x19da('0x26')]],'as':_0x4164c8['as'],'attributes':_0x4164c8[_0x19da('0x22')],'include':_0x4164c8[_0x19da('0x25')]?_[_0x19da('0x24')](_0x4164c8[_0x19da('0x25')],function(_0x3d5429){return{'model':db[_0x3d5429['model']],'as':_0x3d5429['as'],'attributes':_0x3d5429[_0x19da('0x22')]};}):[]};}):[]};}):[]:[]})[_0x19da('0x12')](function(_0x1cc6f5){logger[_0x19da('0x13')]('GetMailQueue',_0x5ea8ce);logger[_0x19da('0x16')](_0x19da('0x1d'),_0x5ea8ce,JSON[_0x19da('0x18')](_0x1cc6f5));_0x332b74(_0x1cc6f5);})[_0x19da('0x1c')](function(_0x28b1a0){logger[_0x19da('0x19')]('GetMailQueue',_0x28b1a0[_0x19da('0x1b')],_0x5ea8ce);_0x122d6f(_0x1294b7[_0x19da('0x19')](0x1f4,_0x28b1a0['message']));});});};exports['ShowMailQueue']=function(_0x58f08d){var _0xd9e86f=this;return new Promise(function(_0xeb7c42,_0x3d368b){return db[_0x19da('0x1e')][_0x19da('0x27')]({'raw':_0x58f08d[_0x19da('0x1f')]?_0x58f08d['options'][_0x19da('0x20')]===undefined?!![]:![]:!![],'where':_0x58f08d[_0x19da('0x1f')]?_0x58f08d['options'][_0x19da('0x21')]||null:null,'attributes':_0x58f08d[_0x19da('0x1f')]?_0x58f08d[_0x19da('0x1f')][_0x19da('0x22')]||null:null,'include':_0x58f08d['options']?_0x58f08d[_0x19da('0x1f')]['include']?_[_0x19da('0x24')](_0x58f08d[_0x19da('0x1f')][_0x19da('0x25')],function(_0x1a8908){return{'model':db[_0x1a8908[_0x19da('0x26')]],'as':_0x1a8908['as'],'attributes':_0x1a8908[_0x19da('0x22')],'include':_0x1a8908[_0x19da('0x25')]?_[_0x19da('0x24')](_0x1a8908[_0x19da('0x25')],function(_0x3289b2){return{'model':db[_0x3289b2[_0x19da('0x26')]],'as':_0x3289b2['as'],'attributes':_0x3289b2[_0x19da('0x22')],'include':_0x3289b2['include']?_[_0x19da('0x24')](_0x3289b2['include'],function(_0xa3daf8){return{'model':db[_0xa3daf8[_0x19da('0x26')]],'as':_0xa3daf8['as'],'attributes':_0xa3daf8[_0x19da('0x22')]};}):[]};}):[]};}):[]:[]})[_0x19da('0x12')](function(_0x6b3c19){logger['info'](_0x19da('0x28'),_0x58f08d);logger[_0x19da('0x16')](_0x19da('0x28'),_0x58f08d,JSON[_0x19da('0x18')](_0x6b3c19));_0xeb7c42(_0x6b3c19);})[_0x19da('0x1c')](function(_0x181c4e){logger[_0x19da('0x19')](_0x19da('0x28'),_0x181c4e[_0x19da('0x1b')],_0x58f08d);_0x3d368b(_0xd9e86f['error'](0x1f4,_0x181c4e['message']));});});}; \ No newline at end of file +var _0xb1bd=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes','limit','include','map','model','stringify','where','ShowMailQueue','moment'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xb1bd,0x13a));var _0xdb1b=function(_0x35053d,_0x320bf3){_0x35053d=_0x35053d-0x0;var _0x34f386=_0xb1bd[_0x35053d];return _0x34f386;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdb1b('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb1b('0x1'));var db=require(_0xdb1b('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb1b('0x3'))(_0xdb1b('0x4'));var config=require(_0xdb1b('0x5'));var jayson=require(_0xdb1b('0x6'));var client=jayson['client'][_0xdb1b('0x7')]({'port':0x232a});config[_0xdb1b('0x8')]=_[_0xdb1b('0x9')](config['redis'],{'host':_0xdb1b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdb1b('0xb'))['register'](socket);function respondWithRpcPromise(_0x2148bd,_0xfbf138,_0x301689){return new BPromise(function(_0x2a3d9e,_0xccc412){return client[_0xdb1b('0xc')](_0x2148bd,_0x301689)[_0xdb1b('0xd')](function(_0xd00e9){logger[_0xdb1b('0xe')](_0xdb1b('0xf'),_0xfbf138,'request\x20sent');logger[_0xdb1b('0x10')]('MailQueue,\x20%s,\x20%s,\x20%s',_0xfbf138,_0xdb1b('0x11'),JSON['stringify'](_0xd00e9));if(_0xd00e9[_0xdb1b('0x12')]){if(_0xd00e9[_0xdb1b('0x12')][_0xdb1b('0x13')]===0x1f4){logger[_0xdb1b('0x12')](_0xdb1b('0xf'),_0xfbf138,_0xd00e9[_0xdb1b('0x12')][_0xdb1b('0x14')]);return _0xccc412(_0xd00e9[_0xdb1b('0x12')]['message']);}logger[_0xdb1b('0x12')](_0xdb1b('0xf'),_0xfbf138,_0xd00e9[_0xdb1b('0x12')][_0xdb1b('0x14')]);return _0x2a3d9e(_0xd00e9[_0xdb1b('0x12')][_0xdb1b('0x14')]);}else{logger[_0xdb1b('0xe')](_0xdb1b('0xf'),_0xfbf138,'request\x20sent');_0x2a3d9e(_0xd00e9['result'][_0xdb1b('0x14')]);}})[_0xdb1b('0x15')](function(_0x2f6849){logger[_0xdb1b('0x12')](_0xdb1b('0xf'),_0xfbf138,_0x2f6849);_0xccc412(_0x2f6849);});});}exports[_0xdb1b('0x16')]=function(_0x64afb9){var _0x2f85a1=this;return new Promise(function(_0x5ece9e,_0x3d5c6c){return db[_0xdb1b('0x17')][_0xdb1b('0x18')]({'raw':_0x64afb9['options']?_0x64afb9[_0xdb1b('0x19')][_0xdb1b('0x1a')]===undefined?!![]:![]:!![],'where':_0x64afb9[_0xdb1b('0x19')]?_0x64afb9[_0xdb1b('0x19')]['where']||null:null,'attributes':_0x64afb9[_0xdb1b('0x19')]?_0x64afb9[_0xdb1b('0x19')][_0xdb1b('0x1b')]||null:null,'limit':_0x64afb9[_0xdb1b('0x19')]?_0x64afb9[_0xdb1b('0x19')][_0xdb1b('0x1c')]||null:null,'include':_0x64afb9[_0xdb1b('0x19')]?_0x64afb9[_0xdb1b('0x19')][_0xdb1b('0x1d')]?_['map'](_0x64afb9[_0xdb1b('0x19')][_0xdb1b('0x1d')],function(_0xcb15ff){return{'model':db[_0xcb15ff['model']],'as':_0xcb15ff['as'],'attributes':_0xcb15ff['attributes'],'include':_0xcb15ff[_0xdb1b('0x1d')]?_[_0xdb1b('0x1e')](_0xcb15ff[_0xdb1b('0x1d')],function(_0x190564){return{'model':db[_0x190564[_0xdb1b('0x1f')]],'as':_0x190564['as'],'attributes':_0x190564[_0xdb1b('0x1b')],'include':_0x190564['include']?_[_0xdb1b('0x1e')](_0x190564['include'],function(_0x1105b7){return{'model':db[_0x1105b7[_0xdb1b('0x1f')]],'as':_0x1105b7['as'],'attributes':_0x1105b7[_0xdb1b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdb1b('0xd')](function(_0x5bf78e){logger[_0xdb1b('0xe')](_0xdb1b('0x16'),_0x64afb9);logger[_0xdb1b('0x10')]('GetMailQueue',_0x64afb9,JSON[_0xdb1b('0x20')](_0x5bf78e));_0x5ece9e(_0x5bf78e);})[_0xdb1b('0x15')](function(_0x310a9c){logger[_0xdb1b('0x12')](_0xdb1b('0x16'),_0x310a9c[_0xdb1b('0x14')],_0x64afb9);_0x3d5c6c(_0x2f85a1[_0xdb1b('0x12')](0x1f4,_0x310a9c['message']));});});};exports['ShowMailQueue']=function(_0x436d5f){var _0x52833e=this;return new Promise(function(_0x52034e,_0x11d5e1){return db[_0xdb1b('0x17')]['find']({'raw':_0x436d5f[_0xdb1b('0x19')]?_0x436d5f[_0xdb1b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x436d5f[_0xdb1b('0x19')]?_0x436d5f['options'][_0xdb1b('0x21')]||null:null,'attributes':_0x436d5f[_0xdb1b('0x19')]?_0x436d5f[_0xdb1b('0x19')][_0xdb1b('0x1b')]||null:null,'include':_0x436d5f[_0xdb1b('0x19')]?_0x436d5f[_0xdb1b('0x19')][_0xdb1b('0x1d')]?_[_0xdb1b('0x1e')](_0x436d5f[_0xdb1b('0x19')]['include'],function(_0x251d98){return{'model':db[_0x251d98[_0xdb1b('0x1f')]],'as':_0x251d98['as'],'attributes':_0x251d98['attributes'],'include':_0x251d98[_0xdb1b('0x1d')]?_['map'](_0x251d98[_0xdb1b('0x1d')],function(_0x83db03){return{'model':db[_0x83db03[_0xdb1b('0x1f')]],'as':_0x83db03['as'],'attributes':_0x83db03[_0xdb1b('0x1b')],'include':_0x83db03[_0xdb1b('0x1d')]?_[_0xdb1b('0x1e')](_0x83db03[_0xdb1b('0x1d')],function(_0x29ff6f){return{'model':db[_0x29ff6f[_0xdb1b('0x1f')]],'as':_0x29ff6f['as'],'attributes':_0x29ff6f['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb1b('0xd')](function(_0x2ba527){logger[_0xdb1b('0xe')](_0xdb1b('0x22'),_0x436d5f);logger[_0xdb1b('0x10')](_0xdb1b('0x22'),_0x436d5f,JSON[_0xdb1b('0x20')](_0x2ba527));_0x52034e(_0x2ba527);})[_0xdb1b('0x15')](function(_0x487beb){logger[_0xdb1b('0x12')]('ShowMailQueue',_0x487beb['message'],_0x436d5f);_0x11d5e1(_0x52833e['error'](0x1f4,_0x487beb[_0xdb1b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0ce2206..947aa42 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 _0xdbf3=['./mailQueue.events','emit','removeListener','register','length','mailQueue:'];(function(_0x29f013,_0x2b13f3){var _0x5001bb=function(_0x4ddba5){while(--_0x4ddba5){_0x29f013['push'](_0x29f013['shift']());}};_0x5001bb(++_0x2b13f3);}(_0xdbf3,0x13e));var _0x3dbf=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xdbf3[_0x2aec52];return _0x3b8835;};'use strict';var MailQueueEvents=require(_0x3dbf('0x0'));var events=['save','remove','update'];function createListener(_0x3a2909,_0x3dbb2d){return function(_0x126f25){_0x3dbb2d[_0x3dbf('0x1')](_0x3a2909,_0x126f25);};}function removeListener(_0x43f57f,_0x2180b7){return function(){MailQueueEvents[_0x3dbf('0x2')](_0x43f57f,_0x2180b7);};}exports[_0x3dbf('0x3')]=function(_0x3757e8){for(var _0x390a77=0x0,_0x2b2f8e=events[_0x3dbf('0x4')];_0x390a77<_0x2b2f8e;_0x390a77++){var _0x4c4233=events[_0x390a77];var _0x4ad6ad=createListener(_0x3dbf('0x5')+_0x4c4233,_0x3757e8);MailQueueEvents['on'](_0x4c4233,_0x4ad6ad);}}; \ No newline at end of file +var _0x20b1=['emit','removeListener','length','./mailQueue.events','remove','update'];(function(_0x258509,_0x48a441){var _0x22ec27=function(_0x235914){while(--_0x235914){_0x258509['push'](_0x258509['shift']());}};_0x22ec27(++_0x48a441);}(_0x20b1,0x1bf));var _0x120b=function(_0x46fdfd,_0x3eaa32){_0x46fdfd=_0x46fdfd-0x0;var _0x855be1=_0x20b1[_0x46fdfd];return _0x855be1;};'use strict';var MailQueueEvents=require(_0x120b('0x0'));var events=['save',_0x120b('0x1'),_0x120b('0x2')];function createListener(_0x5d5989,_0x47254d){return function(_0x481347){_0x47254d[_0x120b('0x3')](_0x5d5989,_0x481347);};}function removeListener(_0x4588d1,_0x42a23d){return function(){MailQueueEvents[_0x120b('0x4')](_0x4588d1,_0x42a23d);};}exports['register']=function(_0x461a0d){for(var _0x18bfd6=0x0,_0x1543ba=events[_0x120b('0x5')];_0x18bfd6<_0x1543ba;_0x18bfd6++){var _0x306375=events[_0x18bfd6];var _0x2783cd=createListener('mailQueue:'+_0x306375,_0x461a0d);MailQueueEvents['on'](_0x306375,_0x2783cd);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index aaf5e79..f351660 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 _0xd40c=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x13e96b,_0x43b61b){var _0x4ef61f=function(_0x244f01){while(--_0x244f01){_0x13e96b['push'](_0x13e96b['shift']());}};_0x4ef61f(++_0x43b61b);}(_0xd40c,0x1f4));var _0xcd40=function(_0x1df352,_0x5113ef){_0x1df352=_0x1df352-0x0;var _0x4a0c79=_0xd40c[_0x1df352];return _0x4a0c79;};'use strict';var multer=require(_0xcd40('0x0'));var util=require('util');var path=require(_0xcd40('0x1'));var timeout=require(_0xcd40('0x2'));var express=require(_0xcd40('0x3'));var router=express[_0xcd40('0x4')]();var auth=require(_0xcd40('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcd40('0x6'));var controller=require(_0xcd40('0x7'));router[_0xcd40('0x8')]('/',auth['isAuthenticated'](),controller[_0xcd40('0x9')]);router[_0xcd40('0x8')](_0xcd40('0xa'),auth[_0xcd40('0xb')](),controller[_0xcd40('0xc')]);router[_0xcd40('0x8')]('/:id',auth[_0xcd40('0xb')](),controller['show']);router['post']('/',auth[_0xcd40('0xb')](),controller[_0xcd40('0xd')]);router[_0xcd40('0xe')]('/:id',auth[_0xcd40('0xb')](),controller[_0xcd40('0xf')]);router[_0xcd40('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xcd40('0x11')]);module[_0xcd40('0x12')]=router; \ No newline at end of file +var _0x6cc7=['util','path','connect-timeout','express','Router','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x4e1739,_0xee7c0d){var _0x294110=function(_0x3f9fb6){while(--_0x3f9fb6){_0x4e1739['push'](_0x4e1739['shift']());}};_0x294110(++_0xee7c0d);}(_0x6cc7,0xc8));var _0x76cc=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x6cc7[_0x56138f];return _0x1acaf7;};'use strict';var multer=require('multer');var util=require(_0x76cc('0x0'));var path=require(_0x76cc('0x1'));var timeout=require(_0x76cc('0x2'));var express=require(_0x76cc('0x3'));var router=express[_0x76cc('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x76cc('0x5'));var controller=require(_0x76cc('0x6'));router[_0x76cc('0x7')]('/',auth['isAuthenticated'](),controller[_0x76cc('0x8')]);router['get'](_0x76cc('0x9'),auth[_0x76cc('0xa')](),controller[_0x76cc('0xb')]);router[_0x76cc('0x7')](_0x76cc('0xc'),auth['isAuthenticated'](),controller[_0x76cc('0xd')]);router[_0x76cc('0xe')]('/',auth[_0x76cc('0xa')](),controller[_0x76cc('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x76cc('0x10')]);router[_0x76cc('0x11')]('/:id',auth[_0x76cc('0xa')](),controller[_0x76cc('0x12')]);module[_0x76cc('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index c39b263..f963956 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 _0xf6db=['exports','STRING','DATE','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf6db,0xa7));var _0xbf6d=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0xf6db[_0x49aa7d];return _0xdd0d26;};'use strict';var moment=require('moment');var Sequelize=require(_0xbf6d('0x0'));module[_0xbf6d('0x1')]={'uniqueid':{'type':Sequelize[_0xbf6d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbf6d('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbf6d('0x3')]},'acceptAt':{'type':Sequelize[_0xbf6d('0x3')]},'exitAt':{'type':Sequelize[_0xbf6d('0x3')]},'reason':{'type':Sequelize[_0xbf6d('0x2')]}}; \ No newline at end of file +var _0x5db0=['STRING','moment','DATE'];(function(_0x1c0962,_0x4442c2){var _0x41db7c=function(_0xec9266){while(--_0xec9266){_0x1c0962['push'](_0x1c0962['shift']());}};_0x41db7c(++_0x4442c2);}(_0x5db0,0x15a));var _0x05db=function(_0x1e217c,_0xef5281){_0x1e217c=_0x1e217c-0x0;var _0x1dfa91=_0x5db0[_0x1e217c];return _0x1dfa91;};'use strict';var moment=require(_0x05db('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x05db('0x1')]},'leaveAt':{'type':Sequelize[_0x05db('0x1')]},'acceptAt':{'type':Sequelize[_0x05db('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x05db('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 7bd1425..a185988 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 _0xca9a=['catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','apply','save','update','destroy','then','error','stack','name','send','MailQueueReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','where','type','field','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xca9a,0x165));var _0xaca9=function(_0x3ac690,_0x2d1c0d){_0x3ac690=_0x3ac690-0x0;var _0x137ce9=_0xca9a[_0x3ac690];return _0x137ce9;};'use strict';var pdf=require(_0xaca9('0x0'));var emlformat=require(_0xaca9('0x1'));var rimraf=require(_0xaca9('0x2'));var zipdir=require(_0xaca9('0x3'));var jsonpatch=require(_0xaca9('0x4'));var rp=require(_0xaca9('0x5'));var moment=require('moment');var BPromise=require(_0xaca9('0x6'));var Mustache=require(_0xaca9('0x7'));var util=require(_0xaca9('0x8'));var path=require(_0xaca9('0x9'));var sox=require(_0xaca9('0xa'));var csv=require('to-csv');var ejs=require(_0xaca9('0xb'));var fs=require('fs');var _=require(_0xaca9('0xc'));var squel=require(_0xaca9('0xd'));var crypto=require(_0xaca9('0xe'));var jsforce=require(_0xaca9('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaca9('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0xaca9('0x11'));var qs=require(_0xaca9('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xaca9('0x13'));var config=require(_0xaca9('0x14'));var db=require(_0xaca9('0x15'))['db'];function respondWithStatusCode(_0x1ead90,_0x79594f){_0x79594f=_0x79594f||0xcc;return function(_0x1fce48){if(_0x1fce48){return _0x1ead90[_0xaca9('0x16')](_0x79594f);}return _0x1ead90[_0xaca9('0x17')](_0x79594f)[_0xaca9('0x18')]();};}function respondWithResult(_0x339924,_0x2b5eae){_0x2b5eae=_0x2b5eae||0xc8;return function(_0xc63c28){if(_0xc63c28){return _0x339924[_0xaca9('0x17')](_0x2b5eae)[_0xaca9('0x19')](_0xc63c28);}};}function respondWithFilteredResult(_0x2973bd,_0x4e3a59){return function(_0x3a0c24){if(_0x3a0c24){var _0x1d789f=_0x3a0c24[_0xaca9('0x1a')],_0x279d16=_0x4e3a59['offset'],_0x4700f6=_0x4e3a59['offset']+_0x4e3a59['limit'],_0x371d8c;if(_0x4700f6>=_0x1d789f){_0x4700f6=_0x1d789f;_0x371d8c=0xc8;}else{_0x371d8c=0xce;}_0x2973bd[_0xaca9('0x17')](_0x371d8c);return _0x2973bd['set']('Content-Range',_0x279d16+'-'+_0x4700f6+'/'+_0x1d789f)['json'](_0x3a0c24);}return null;};}function patchUpdates(_0x1ea330){return function(_0x183dc7){try{jsonpatch[_0xaca9('0x1b')](_0x183dc7,_0x1ea330,!![]);}catch(_0x1a18cb){return BPromise['reject'](_0x1a18cb);}return _0x183dc7[_0xaca9('0x1c')]();};}function saveUpdates(_0x5c747c,_0x23f368){return function(_0x62b896){if(_0x62b896){return _0x62b896[_0xaca9('0x1d')](_0x5c747c)['then'](function(_0x1c1829){return _0x1c1829;});}return null;};}function removeEntity(_0x16f95a,_0xfa8600){return function(_0x17ba65){if(_0x17ba65){return _0x17ba65[_0xaca9('0x1e')]()[_0xaca9('0x1f')](function(){_0x16f95a[_0xaca9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58b027,_0x2b3f1b){return function(_0x3c971b){if(!_0x3c971b){_0x58b027['sendStatus'](0x194);}return _0x3c971b;};}function handleError(_0x56a432,_0x441044){_0x441044=_0x441044||0x1f4;return function(_0x41f426){logger[_0xaca9('0x20')](_0x41f426[_0xaca9('0x21')]);if(_0x41f426[_0xaca9('0x22')]){delete _0x41f426[_0xaca9('0x22')];}_0x56a432[_0xaca9('0x17')](_0x441044)[_0xaca9('0x23')](_0x41f426);};}exports['index']=function(_0x39b9ff,_0x29f7ed){var _0x3a4d6a={},_0x2ba66c={},_0x2f24df={'count':0x0,'rows':[]};var _0x5d4f47=db[_0xaca9('0x24')][_0xaca9('0x25')];_0x2ba66c['model']=_[_0xaca9('0x26')](_0x5d4f47);_0x2ba66c[_0xaca9('0x27')]=_[_0xaca9('0x26')](_0x39b9ff['query']);_0x2ba66c[_0xaca9('0x28')]=_[_0xaca9('0x29')](_0x2ba66c[_0xaca9('0x2a')],_0x2ba66c['query']);_0x3a4d6a[_0xaca9('0x2b')]=_['intersection'](_0x2ba66c[_0xaca9('0x2a')],qs[_0xaca9('0x2c')](_0x39b9ff[_0xaca9('0x27')][_0xaca9('0x2c')]));_0x3a4d6a[_0xaca9('0x2b')]=_0x3a4d6a[_0xaca9('0x2b')][_0xaca9('0x2d')]?_0x3a4d6a[_0xaca9('0x2b')]:_0x2ba66c['model'];if(!_0x39b9ff[_0xaca9('0x27')][_0xaca9('0x2e')](_0xaca9('0x2f'))){_0x3a4d6a[_0xaca9('0x30')]=qs[_0xaca9('0x30')](_0x39b9ff[_0xaca9('0x27')][_0xaca9('0x30')]);_0x3a4d6a['offset']=qs[_0xaca9('0x31')](_0x39b9ff[_0xaca9('0x27')]['offset']);}_0x3a4d6a[_0xaca9('0x32')]=qs[_0xaca9('0x33')](_0x39b9ff[_0xaca9('0x27')][_0xaca9('0x33')]);_0x3a4d6a['where']=qs[_0xaca9('0x28')](_[_0xaca9('0x34')](_0x39b9ff[_0xaca9('0x27')],_0x2ba66c[_0xaca9('0x28')]));if(_0x39b9ff[_0xaca9('0x27')]['filter']){_0x3a4d6a['where']=_['merge'](_0x3a4d6a[_0xaca9('0x35')],{'$or':_['map'](_0x5d4f47,function(_0xfc4d66){if(_0xfc4d66[_0xaca9('0x36')]['key']!=='VIRTUAL'){var _0x443fcc={};_0x443fcc[_0xfc4d66[_0xaca9('0x37')]]={'$like':'%'+_0x39b9ff[_0xaca9('0x27')][_0xaca9('0x38')]+'%'};return _0x443fcc;}})});}_0x3a4d6a=_[_0xaca9('0x39')]({},_0x3a4d6a,_0x39b9ff[_0xaca9('0x3a')]);var _0x2b74ac={'where':_0x3a4d6a[_0xaca9('0x35')]};return db[_0xaca9('0x24')][_0xaca9('0x1a')](_0x2b74ac)['then'](function(_0x46494c){_0x2f24df['count']=_0x46494c;if(_0x39b9ff[_0xaca9('0x27')][_0xaca9('0x3b')]){_0x3a4d6a[_0xaca9('0x3c')]=[{'all':!![]}];}return db[_0xaca9('0x24')][_0xaca9('0x3d')](_0x3a4d6a);})[_0xaca9('0x1f')](function(_0x5ca73c){_0x2f24df[_0xaca9('0x3e')]=_0x5ca73c;return _0x2f24df;})['then'](respondWithFilteredResult(_0x29f7ed,_0x3a4d6a))[_0xaca9('0x3f')](handleError(_0x29f7ed,null));};exports[_0xaca9('0x40')]=function(_0x10e171,_0x2cd430){var _0x1ff4ea={'raw':!![],'where':{'id':_0x10e171[_0xaca9('0x41')]['id']}},_0x3f9902={};_0x3f9902['model']=_[_0xaca9('0x26')](db[_0xaca9('0x24')][_0xaca9('0x25')]);_0x3f9902['query']=_[_0xaca9('0x26')](_0x10e171[_0xaca9('0x27')]);_0x3f9902[_0xaca9('0x28')]=_[_0xaca9('0x29')](_0x3f9902['model'],_0x3f9902[_0xaca9('0x27')]);_0x1ff4ea['attributes']=_[_0xaca9('0x29')](_0x3f9902[_0xaca9('0x2a')],qs[_0xaca9('0x2c')](_0x10e171[_0xaca9('0x27')][_0xaca9('0x2c')]));_0x1ff4ea[_0xaca9('0x2b')]=_0x1ff4ea[_0xaca9('0x2b')][_0xaca9('0x2d')]?_0x1ff4ea[_0xaca9('0x2b')]:_0x3f9902[_0xaca9('0x2a')];if(_0x10e171['query'][_0xaca9('0x3b')]){_0x1ff4ea['include']=[{'all':!![]}];}_0x1ff4ea=_['merge']({},_0x1ff4ea,_0x10e171['options']);return db[_0xaca9('0x24')][_0xaca9('0x42')](_0x1ff4ea)[_0xaca9('0x1f')](handleEntityNotFound(_0x2cd430,null))[_0xaca9('0x1f')](respondWithResult(_0x2cd430,null))[_0xaca9('0x3f')](handleError(_0x2cd430,null));};exports[_0xaca9('0x43')]=function(_0x37a79e,_0x6587a3){return db[_0xaca9('0x24')][_0xaca9('0x43')](_0x37a79e[_0xaca9('0x44')],{})[_0xaca9('0x1f')](respondWithResult(_0x6587a3,0xc9))[_0xaca9('0x3f')](handleError(_0x6587a3,null));};exports['update']=function(_0x3ea57c,_0x352b0a){if(_0x3ea57c[_0xaca9('0x44')]['id']){delete _0x3ea57c['body']['id'];}return db[_0xaca9('0x24')]['find']({'where':{'id':_0x3ea57c['params']['id']}})[_0xaca9('0x1f')](handleEntityNotFound(_0x352b0a,null))[_0xaca9('0x1f')](saveUpdates(_0x3ea57c[_0xaca9('0x44')],null))[_0xaca9('0x1f')](respondWithResult(_0x352b0a,null))[_0xaca9('0x3f')](handleError(_0x352b0a,null));};exports['destroy']=function(_0x5cac4d,_0x4b63ea){return db[_0xaca9('0x24')]['find']({'where':{'id':_0x5cac4d[_0xaca9('0x41')]['id']}})[_0xaca9('0x1f')](handleEntityNotFound(_0x4b63ea,null))[_0xaca9('0x1f')](removeEntity(_0x4b63ea,null))[_0xaca9('0x3f')](handleError(_0x4b63ea,null));};exports[_0xaca9('0x45')]=function(_0x38d684,_0x913043){return db[_0xaca9('0x24')][_0xaca9('0x45')]()[_0xaca9('0x1f')](respondWithResult(_0x913043,null))[_0xaca9('0x3f')](handleError(_0x913043,null));}; \ No newline at end of file +var _0x6507=['body','update','params','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','then','destroy','error','stack','send','index','rawAttributes','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','type','key','VIRTUAL','field','options','count','includeAll','include','MailQueueReport','findAll','show','find','create'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0x6507,0x125));var _0x7650=function(_0xbbac6f,_0x11c270){_0xbbac6f=_0xbbac6f-0x0;var _0x2047d3=_0x6507[_0xbbac6f];return _0x2047d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7650('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7650('0x1'));var jsonpatch=require(_0x7650('0x2'));var rp=require(_0x7650('0x3'));var moment=require(_0x7650('0x4'));var BPromise=require(_0x7650('0x5'));var Mustache=require('mustache');var util=require(_0x7650('0x6'));var path=require(_0x7650('0x7'));var sox=require(_0x7650('0x8'));var csv=require('to-csv');var ejs=require(_0x7650('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7650('0xa'));var crypto=require(_0x7650('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7650('0xc'));var toCsv=require(_0x7650('0xd'));var querystring=require(_0x7650('0xe'));var Papa=require('papaparse');var authService=require(_0x7650('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x7650('0x10'));var qs=require(_0x7650('0x11'));var logger=require(_0x7650('0x12'))(_0x7650('0x13'));var utils=require(_0x7650('0x14'));var config=require(_0x7650('0x15'));var db=require(_0x7650('0x16'))['db'];function respondWithStatusCode(_0x554156,_0x53bc33){_0x53bc33=_0x53bc33||0xcc;return function(_0x24cc5c){if(_0x24cc5c){return _0x554156[_0x7650('0x17')](_0x53bc33);}return _0x554156[_0x7650('0x18')](_0x53bc33)[_0x7650('0x19')]();};}function respondWithResult(_0x3ea6e7,_0x3a7f46){_0x3a7f46=_0x3a7f46||0xc8;return function(_0x57e0e5){if(_0x57e0e5){return _0x3ea6e7[_0x7650('0x18')](_0x3a7f46)[_0x7650('0x1a')](_0x57e0e5);}};}function respondWithFilteredResult(_0x4d0a7a,_0x3c5f65){return function(_0x2b855f){if(_0x2b855f){var _0x4b6a0e=_0x2b855f['count'],_0x3d9fad=_0x3c5f65[_0x7650('0x1b')],_0x2a972d=_0x3c5f65['offset']+_0x3c5f65[_0x7650('0x1c')],_0x2876c5;if(_0x2a972d>=_0x4b6a0e){_0x2a972d=_0x4b6a0e;_0x2876c5=0xc8;}else{_0x2876c5=0xce;}_0x4d0a7a[_0x7650('0x18')](_0x2876c5);return _0x4d0a7a[_0x7650('0x1d')](_0x7650('0x1e'),_0x3d9fad+'-'+_0x2a972d+'/'+_0x4b6a0e)[_0x7650('0x1a')](_0x2b855f);}return null;};}function patchUpdates(_0x84380a){return function(_0x1007ba){try{jsonpatch[_0x7650('0x1f')](_0x1007ba,_0x84380a,!![]);}catch(_0x36c9bf){return BPromise['reject'](_0x36c9bf);}return _0x1007ba['save']();};}function saveUpdates(_0x4369c8,_0x4dfa97){return function(_0x55b3f6){if(_0x55b3f6){return _0x55b3f6['update'](_0x4369c8)[_0x7650('0x20')](function(_0x3d32b7){return _0x3d32b7;});}return null;};}function removeEntity(_0x4cfc3b,_0x423b92){return function(_0x154bcd){if(_0x154bcd){return _0x154bcd[_0x7650('0x21')]()[_0x7650('0x20')](function(){_0x4cfc3b[_0x7650('0x18')](0xcc)[_0x7650('0x19')]();});}};}function handleEntityNotFound(_0x3e9bfb,_0x5296c7){return function(_0x2b3828){if(!_0x2b3828){_0x3e9bfb[_0x7650('0x17')](0x194);}return _0x2b3828;};}function handleError(_0x3724c9,_0x13502d){_0x13502d=_0x13502d||0x1f4;return function(_0x22f90d){logger[_0x7650('0x22')](_0x22f90d[_0x7650('0x23')]);if(_0x22f90d['name']){delete _0x22f90d['name'];}_0x3724c9[_0x7650('0x18')](_0x13502d)[_0x7650('0x24')](_0x22f90d);};}exports[_0x7650('0x25')]=function(_0x2f454a,_0x37fdf6){var _0x4176ff={},_0x5348c1={},_0x9c36c9={'count':0x0,'rows':[]};var _0x46aad7=db['MailQueueReport'][_0x7650('0x26')];_0x5348c1['model']=_[_0x7650('0x27')](_0x46aad7);_0x5348c1[_0x7650('0x28')]=_[_0x7650('0x27')](_0x2f454a[_0x7650('0x28')]);_0x5348c1['filters']=_[_0x7650('0x29')](_0x5348c1['model'],_0x5348c1[_0x7650('0x28')]);_0x4176ff['attributes']=_[_0x7650('0x29')](_0x5348c1[_0x7650('0x2a')],qs[_0x7650('0x2b')](_0x2f454a['query']['fields']));_0x4176ff['attributes']=_0x4176ff[_0x7650('0x2c')][_0x7650('0x2d')]?_0x4176ff[_0x7650('0x2c')]:_0x5348c1['model'];if(!_0x2f454a[_0x7650('0x28')]['hasOwnProperty'](_0x7650('0x2e'))){_0x4176ff[_0x7650('0x1c')]=qs['limit'](_0x2f454a[_0x7650('0x28')]['limit']);_0x4176ff[_0x7650('0x1b')]=qs['offset'](_0x2f454a[_0x7650('0x28')]['offset']);}_0x4176ff[_0x7650('0x2f')]=qs[_0x7650('0x30')](_0x2f454a[_0x7650('0x28')][_0x7650('0x30')]);_0x4176ff[_0x7650('0x31')]=qs[_0x7650('0x32')](_[_0x7650('0x33')](_0x2f454a['query'],_0x5348c1[_0x7650('0x32')]));if(_0x2f454a[_0x7650('0x28')][_0x7650('0x34')]){_0x4176ff['where']=_[_0x7650('0x35')](_0x4176ff[_0x7650('0x31')],{'$or':_['map'](_0x46aad7,function(_0x6b3f4c){if(_0x6b3f4c[_0x7650('0x36')][_0x7650('0x37')]!==_0x7650('0x38')){var _0x35ffd8={};_0x35ffd8[_0x6b3f4c[_0x7650('0x39')]]={'$like':'%'+_0x2f454a['query'][_0x7650('0x34')]+'%'};return _0x35ffd8;}})});}_0x4176ff=_[_0x7650('0x35')]({},_0x4176ff,_0x2f454a[_0x7650('0x3a')]);var _0x76dda1={'where':_0x4176ff[_0x7650('0x31')]};return db['MailQueueReport'][_0x7650('0x3b')](_0x76dda1)[_0x7650('0x20')](function(_0x856f9){_0x9c36c9[_0x7650('0x3b')]=_0x856f9;if(_0x2f454a['query'][_0x7650('0x3c')]){_0x4176ff[_0x7650('0x3d')]=[{'all':!![]}];}return db[_0x7650('0x3e')][_0x7650('0x3f')](_0x4176ff);})[_0x7650('0x20')](function(_0x1a478e){_0x9c36c9['rows']=_0x1a478e;return _0x9c36c9;})[_0x7650('0x20')](respondWithFilteredResult(_0x37fdf6,_0x4176ff))['catch'](handleError(_0x37fdf6,null));};exports[_0x7650('0x40')]=function(_0xda2a27,_0x478451){var _0x5b0756={'raw':!![],'where':{'id':_0xda2a27['params']['id']}},_0x2904f9={};_0x2904f9['model']=_['keys'](db['MailQueueReport']['rawAttributes']);_0x2904f9[_0x7650('0x28')]=_['keys'](_0xda2a27['query']);_0x2904f9[_0x7650('0x32')]=_['intersection'](_0x2904f9[_0x7650('0x2a')],_0x2904f9['query']);_0x5b0756[_0x7650('0x2c')]=_[_0x7650('0x29')](_0x2904f9['model'],qs['fields'](_0xda2a27[_0x7650('0x28')][_0x7650('0x2b')]));_0x5b0756[_0x7650('0x2c')]=_0x5b0756[_0x7650('0x2c')]['length']?_0x5b0756[_0x7650('0x2c')]:_0x2904f9[_0x7650('0x2a')];if(_0xda2a27[_0x7650('0x28')]['includeAll']){_0x5b0756['include']=[{'all':!![]}];}_0x5b0756=_['merge']({},_0x5b0756,_0xda2a27['options']);return db[_0x7650('0x3e')][_0x7650('0x41')](_0x5b0756)[_0x7650('0x20')](handleEntityNotFound(_0x478451,null))[_0x7650('0x20')](respondWithResult(_0x478451,null))['catch'](handleError(_0x478451,null));};exports[_0x7650('0x42')]=function(_0x1fa66a,_0x6aba06){return db[_0x7650('0x3e')][_0x7650('0x42')](_0x1fa66a[_0x7650('0x43')],{})[_0x7650('0x20')](respondWithResult(_0x6aba06,0xc9))['catch'](handleError(_0x6aba06,null));};exports[_0x7650('0x44')]=function(_0x1a7501,_0x29f171){if(_0x1a7501['body']['id']){delete _0x1a7501[_0x7650('0x43')]['id'];}return db[_0x7650('0x3e')][_0x7650('0x41')]({'where':{'id':_0x1a7501[_0x7650('0x45')]['id']}})[_0x7650('0x20')](handleEntityNotFound(_0x29f171,null))['then'](saveUpdates(_0x1a7501[_0x7650('0x43')],null))[_0x7650('0x20')](respondWithResult(_0x29f171,null))[_0x7650('0x46')](handleError(_0x29f171,null));};exports[_0x7650('0x21')]=function(_0x5bedfd,_0x4abaaf){return db[_0x7650('0x3e')]['find']({'where':{'id':_0x5bedfd['params']['id']}})[_0x7650('0x20')](handleEntityNotFound(_0x4abaaf,null))[_0x7650('0x20')](removeEntity(_0x4abaaf,null))[_0x7650('0x46')](handleError(_0x4abaaf,null));};exports[_0x7650('0x47')]=function(_0x51ebbf,_0x1cc1c1){return db['MailQueueReport'][_0x7650('0x47')]()[_0x7650('0x20')](respondWithResult(_0x1cc1c1,null))[_0x7650('0x46')](handleError(_0x1cc1c1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 7788f79..f7a7946 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 _0x693b=['api','moment','bluebird','request-promise','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x27a9c4,_0x3700e9){var _0x59be65=function(_0x5eedd7){while(--_0x5eedd7){_0x27a9c4['push'](_0x27a9c4['shift']());}};_0x59be65(++_0x3700e9);}(_0x693b,0x183));var _0xb693=function(_0x2c68f2,_0x19eba6){_0x2c68f2=_0x2c68f2-0x0;var _0x9689c8=_0x693b[_0x2c68f2];return _0x9689c8;};'use strict';var _=require(_0xb693('0x0'));var util=require(_0xb693('0x1'));var logger=require(_0xb693('0x2'))(_0xb693('0x3'));var moment=require(_0xb693('0x4'));var BPromise=require(_0xb693('0x5'));var rp=require(_0xb693('0x6'));var attributes=require(_0xb693('0x7'));module[_0xb693('0x8')]=function(_0x510489,_0xb687f3){return _0x510489[_0xb693('0x9')](_0xb693('0xa'),attributes,{'tableName':_0xb693('0xb'),'paranoid':![],'indexes':[{'name':_0xb693('0xc'),'fields':[_0xb693('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d62=['report_mail_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','./mailQueueReport.attributes','exports'];(function(_0x549b05,_0x50782b){var _0x2c69e4=function(_0x24a523){while(--_0x24a523){_0x549b05['push'](_0x549b05['shift']());}};_0x2c69e4(++_0x50782b);}(_0x6d62,0x1ce));var _0x26d6=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0x6d62[_0x4b4638];return _0x59e92b;};'use strict';var _=require(_0x26d6('0x0'));var util=require(_0x26d6('0x1'));var logger=require('../../config/logger')(_0x26d6('0x2'));var moment=require(_0x26d6('0x3'));var BPromise=require(_0x26d6('0x4'));var rp=require(_0x26d6('0x5'));var attributes=require(_0x26d6('0x6'));module[_0x26d6('0x7')]=function(_0x4585c8,_0x57aeb3){return _0x4585c8['define']('MailQueueReport',attributes,{'tableName':_0x26d6('0x8'),'paranoid':![],'indexes':[{'name':_0x26d6('0x9'),'fields':[_0x26d6('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 44f6294..9f508ef 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 _0xeaa8=['jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','update','where','attributes','UpdateMailQueueReport','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xeaa8,0x199));var _0x8eaa=function(_0xfba70d,_0x62239a){_0xfba70d=_0xfba70d-0x0;var _0x5850f4=_0xeaa8[_0xfba70d];return _0x5850f4;};'use strict';var _=require(_0x8eaa('0x0'));var util=require(_0x8eaa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8eaa('0x2'));var fs=require('fs');var Redis=require(_0x8eaa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eaa('0x4'));var logger=require(_0x8eaa('0x5'))(_0x8eaa('0x6'));var config=require('../../config/environment');var jayson=require(_0x8eaa('0x7'));var client=jayson[_0x8eaa('0x8')][_0x8eaa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e064e,_0x150e8b,_0x5b4dc0){return new BPromise(function(_0x3f0b64,_0x456aae){return client[_0x8eaa('0xa')](_0x3e064e,_0x5b4dc0)[_0x8eaa('0xb')](function(_0x490f46){logger[_0x8eaa('0xc')](_0x8eaa('0xd'),_0x150e8b,_0x8eaa('0xe'));logger[_0x8eaa('0xf')](_0x8eaa('0x10'),_0x150e8b,_0x8eaa('0xe'),JSON[_0x8eaa('0x11')](_0x490f46));if(_0x490f46[_0x8eaa('0x12')]){if(_0x490f46['error'][_0x8eaa('0x13')]===0x1f4){logger[_0x8eaa('0x12')](_0x8eaa('0xd'),_0x150e8b,_0x490f46[_0x8eaa('0x12')][_0x8eaa('0x14')]);return _0x456aae(_0x490f46[_0x8eaa('0x12')]['message']);}logger[_0x8eaa('0x12')](_0x8eaa('0xd'),_0x150e8b,_0x490f46['error'][_0x8eaa('0x14')]);return _0x3f0b64(_0x490f46[_0x8eaa('0x12')][_0x8eaa('0x14')]);}else{logger['info'](_0x8eaa('0xd'),_0x150e8b,_0x8eaa('0xe'));_0x3f0b64(_0x490f46['result'][_0x8eaa('0x14')]);}})[_0x8eaa('0x15')](function(_0x1f0065){logger[_0x8eaa('0x12')](_0x8eaa('0xd'),_0x150e8b,_0x1f0065);_0x456aae(_0x1f0065);});});}exports[_0x8eaa('0x16')]=function(_0x176dfc){var _0x14dbcc=this;return new Promise(function(_0x46dc9c,_0x5d3aab){return db[_0x8eaa('0x17')][_0x8eaa('0x18')](_0x176dfc[_0x8eaa('0x19')],{'raw':_0x176dfc[_0x8eaa('0x1a')]?_0x176dfc['options'][_0x8eaa('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x11206b){logger['info'](_0x8eaa('0x16'),_0x176dfc);logger[_0x8eaa('0xf')](_0x8eaa('0x16'),_0x176dfc,JSON[_0x8eaa('0x11')](_0x11206b));_0x46dc9c(_0x11206b);})[_0x8eaa('0x15')](function(_0x2349c3){logger[_0x8eaa('0x12')](_0x8eaa('0x16'),_0x2349c3[_0x8eaa('0x14')],_0x176dfc);_0x5d3aab(_0x14dbcc['error'](0x1f4,_0x2349c3['message']));});});};exports['UpdateMailQueueReport']=function(_0x4c242b){var _0x3a52ac=this;return new Promise(function(_0x360803,_0x4d58e8){return db['MailQueueReport'][_0x8eaa('0x1c')](_0x4c242b[_0x8eaa('0x19')],{'raw':_0x4c242b['options']?_0x4c242b[_0x8eaa('0x1a')][_0x8eaa('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c242b['options']?_0x4c242b['options'][_0x8eaa('0x1d')]||null:null,'attributes':_0x4c242b[_0x8eaa('0x1a')]?_0x4c242b[_0x8eaa('0x1a')][_0x8eaa('0x1e')]||null:null,'limit':_0x4c242b[_0x8eaa('0x1a')]?_0x4c242b[_0x8eaa('0x1a')]['limit']||null:null})['then'](function(_0x3a0a03){logger['info'](_0x8eaa('0x1f'),_0x4c242b);logger[_0x8eaa('0xf')](_0x8eaa('0x1f'),_0x4c242b,JSON[_0x8eaa('0x11')](_0x3a0a03));_0x360803(_0x3a0a03);})[_0x8eaa('0x15')](function(_0x5b0b32){logger[_0x8eaa('0x12')]('UpdateMailQueueReport',_0x5b0b32['message'],_0x4c242b);_0x4d58e8(_0x3a52ac[_0x8eaa('0x12')](0x1f4,_0x5b0b32['message']));});});}; \ No newline at end of file +var _0x145f=['error','code','MailQueueReport,\x20%s,\x20%s','message','result','catch','CreateMailQueueReport','create','body','options','raw','stringify','UpdateMailQueueReport','MailQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x49a9e6,_0x7ce597){var _0x1fd2f5=function(_0x1a7f47){while(--_0x1a7f47){_0x49a9e6['push'](_0x49a9e6['shift']());}};_0x1fd2f5(++_0x7ce597);}(_0x145f,0x9e));var _0xf145=function(_0x40cd40,_0x288624){_0x40cd40=_0x40cd40-0x0;var _0x1daf66=_0x145f[_0x40cd40];return _0x1daf66;};'use strict';var _=require(_0xf145('0x0'));var util=require('util');var moment=require(_0xf145('0x1'));var BPromise=require(_0xf145('0x2'));var rs=require(_0xf145('0x3'));var fs=require('fs');var Redis=require(_0xf145('0x4'));var db=require(_0xf145('0x5'))['db'];var utils=require(_0xf145('0x6'));var logger=require(_0xf145('0x7'))(_0xf145('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf145('0x9')][_0xf145('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x80e620,_0x2d5408,_0x558a37){return new BPromise(function(_0x25097c,_0x55a664){return client[_0xf145('0xb')](_0x80e620,_0x558a37)[_0xf145('0xc')](function(_0x8bbfbe){logger[_0xf145('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x2d5408,_0xf145('0xe'));logger[_0xf145('0xf')](_0xf145('0x10'),_0x2d5408,_0xf145('0xe'),JSON['stringify'](_0x8bbfbe));if(_0x8bbfbe[_0xf145('0x11')]){if(_0x8bbfbe[_0xf145('0x11')][_0xf145('0x12')]===0x1f4){logger['error'](_0xf145('0x13'),_0x2d5408,_0x8bbfbe['error'][_0xf145('0x14')]);return _0x55a664(_0x8bbfbe[_0xf145('0x11')][_0xf145('0x14')]);}logger[_0xf145('0x11')](_0xf145('0x13'),_0x2d5408,_0x8bbfbe[_0xf145('0x11')][_0xf145('0x14')]);return _0x25097c(_0x8bbfbe[_0xf145('0x11')][_0xf145('0x14')]);}else{logger[_0xf145('0xd')](_0xf145('0x13'),_0x2d5408,_0xf145('0xe'));_0x25097c(_0x8bbfbe[_0xf145('0x15')][_0xf145('0x14')]);}})[_0xf145('0x16')](function(_0xe52f59){logger[_0xf145('0x11')](_0xf145('0x13'),_0x2d5408,_0xe52f59);_0x55a664(_0xe52f59);});});}exports[_0xf145('0x17')]=function(_0x1cc52a){var _0x31fec2=this;return new Promise(function(_0x5896f3,_0x1dd5aa){return db['MailQueueReport'][_0xf145('0x18')](_0x1cc52a[_0xf145('0x19')],{'raw':_0x1cc52a[_0xf145('0x1a')]?_0x1cc52a[_0xf145('0x1a')][_0xf145('0x1b')]===undefined?!![]:![]:!![]})[_0xf145('0xc')](function(_0x5d340a){logger[_0xf145('0xd')](_0xf145('0x17'),_0x1cc52a);logger['debug'](_0xf145('0x17'),_0x1cc52a,JSON[_0xf145('0x1c')](_0x5d340a));_0x5896f3(_0x5d340a);})[_0xf145('0x16')](function(_0x3a95c2){logger[_0xf145('0x11')]('CreateMailQueueReport',_0x3a95c2[_0xf145('0x14')],_0x1cc52a);_0x1dd5aa(_0x31fec2[_0xf145('0x11')](0x1f4,_0x3a95c2['message']));});});};exports[_0xf145('0x1d')]=function(_0x17e0e9){var _0x18f498=this;return new Promise(function(_0x277f55,_0x1204ef){return db[_0xf145('0x1e')][_0xf145('0x1f')](_0x17e0e9[_0xf145('0x19')],{'raw':_0x17e0e9[_0xf145('0x1a')]?_0x17e0e9['options'][_0xf145('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17e0e9['options']?_0x17e0e9[_0xf145('0x1a')][_0xf145('0x20')]||null:null,'attributes':_0x17e0e9['options']?_0x17e0e9['options'][_0xf145('0x21')]||null:null,'limit':_0x17e0e9[_0xf145('0x1a')]?_0x17e0e9['options'][_0xf145('0x22')]||null:null})[_0xf145('0xc')](function(_0x1d16ca){logger['info'](_0xf145('0x1d'),_0x17e0e9);logger[_0xf145('0xf')](_0xf145('0x1d'),_0x17e0e9,JSON[_0xf145('0x1c')](_0x1d16ca));_0x277f55(_0x1d16ca);})[_0xf145('0x16')](function(_0xe66b60){logger[_0xf145('0x11')]('UpdateMailQueueReport',_0xe66b60['message'],_0x17e0e9);_0x1204ef(_0x18f498[_0xf145('0x11')](0x1f4,_0xe66b60[_0xf145('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 0957002..ee5355a 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 _0x7b84=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x7b84,0x17c));var _0x47b8=function(_0x1e6bef,_0x322661){_0x1e6bef=_0x1e6bef-0x0;var _0x179334=_0x7b84[_0x1e6bef];return _0x179334;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var auth=require(_0x47b8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x47b8('0x7'));module[_0x47b8('0x8')]=router; \ No newline at end of file +var _0xae30=['../../components/interaction/service','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xae30,0x10a));var _0x0ae3=function(_0x337651,_0x2af690){_0x337651=_0x337651-0x0;var _0x20893c=_0xae30[_0x337651];return _0x20893c;};'use strict';var multer=require(_0x0ae3('0x0'));var util=require(_0x0ae3('0x1'));var path=require(_0x0ae3('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae3('0x3'));var router=express[_0x0ae3('0x4')]();var auth=require(_0x0ae3('0x5'));var interaction=require(_0x0ae3('0x6'));var config=require('../../config/environment');module[_0x0ae3('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 52bc6df..7835232 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 _0x87ae=['INBOX','STRING','username','BOOLEAN'];(function(_0x2f89ea,_0x370cff){var _0x88aab8=function(_0xd9a82b){while(--_0xd9a82b){_0x2f89ea['push'](_0x2f89ea['shift']());}};_0x88aab8(++_0x370cff);}(_0x87ae,0xf5));var _0xe87a=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x87ae[_0x6a0266];return _0x309e00;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xe87a('0x0')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xe87a('0x0')],'unique':_0xe87a('0x1')},'password':{'type':Sequelize[_0xe87a('0x0')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xe87a('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe87a('0x0')],'defaultValue':_0xe87a('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xe87a('0x0')]}}; \ No newline at end of file +var _0x96cc=['BOOLEAN','username','INTEGER','INBOX','sequelize','STRING'];(function(_0x26ce56,_0x20c231){var _0x1e9f60=function(_0x2a469d){while(--_0x2a469d){_0x26ce56['push'](_0x26ce56['shift']());}};_0x1e9f60(++_0x20c231);}(_0x96cc,0x16c));var _0xc96c=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0x96cc[_0x34b87f];return _0x449805;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'description':{'type':Sequelize[_0xc96c('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xc96c('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xc96c('0x1')],'unique':_0xc96c('0x3')},'password':{'type':Sequelize[_0xc96c('0x1')]},'port':{'type':Sequelize[_0xc96c('0x4')]},'tls':{'type':Sequelize[_0xc96c('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc96c('0x1')],'defaultValue':_0xc96c('0x5')},'connTimeout':{'type':Sequelize[_0xc96c('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xc96c('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index b04cbdb..dae43d7 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 _0x9d02=['moment','request-promise','./mailServerIn.attributes','define','lodash','../../config/logger'];(function(_0xec4df2,_0x58a568){var _0x38e4a2=function(_0x1db177){while(--_0x1db177){_0xec4df2['push'](_0xec4df2['shift']());}};_0x38e4a2(++_0x58a568);}(_0x9d02,0x118));var _0x29d0=function(_0x1a754f,_0x5e19d1){_0x1a754f=_0x1a754f-0x0;var _0x2bf1de=_0x9d02[_0x1a754f];return _0x2bf1de;};'use strict';var _=require(_0x29d0('0x0'));var util=require('util');var logger=require(_0x29d0('0x1'))('api');var moment=require(_0x29d0('0x2'));var BPromise=require('bluebird');var rp=require(_0x29d0('0x3'));var attributes=require(_0x29d0('0x4'));module['exports']=function(_0x33c00f,_0x2e9e8a){return _0x33c00f[_0x29d0('0x5')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9dc=['moment','bluebird','request-promise','exports','define','MailServerIn','util','../../config/logger'];(function(_0x24a1f6,_0x14b093){var _0x82df9b=function(_0x5b9827){while(--_0x5b9827){_0x24a1f6['push'](_0x24a1f6['shift']());}};_0x82df9b(++_0x14b093);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x11c510,_0x37ecc3){_0x11c510=_0x11c510-0x0;var _0x2f23a8=_0xd9dc[_0x11c510];return _0x2f23a8;};'use strict';var _=require('lodash');var util=require(_0xcd9d('0x0'));var logger=require(_0xcd9d('0x1'))('api');var moment=require(_0xcd9d('0x2'));var BPromise=require(_0xcd9d('0x3'));var rp=require(_0xcd9d('0x4'));var attributes=require('./mailServerIn.attributes');module[_0xcd9d('0x5')]=function(_0x12aae1,_0x2c0be0){return _0x12aae1[_0xcd9d('0x6')](_0xcd9d('0x7'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index c373fca..00d2a4f 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 _0xc77d=['map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include'];(function(_0x84437e,_0x1c9eb9){var _0x872c28=function(_0x163628){while(--_0x163628){_0x84437e['push'](_0x84437e['shift']());}};_0x872c28(++_0x1c9eb9);}(_0xc77d,0x156));var _0xdc77=function(_0x101176,_0x1ad975){_0x101176=_0x101176-0x0;var _0x4ec27c=_0xc77d[_0x101176];return _0x4ec27c;};'use strict';var _=require(_0xdc77('0x0'));var util=require(_0xdc77('0x1'));var moment=require(_0xdc77('0x2'));var BPromise=require(_0xdc77('0x3'));var rs=require(_0xdc77('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc77('0x5'))['db'];var utils=require(_0xdc77('0x6'));var logger=require(_0xdc77('0x7'))('rpc');var config=require(_0xdc77('0x8'));var jayson=require(_0xdc77('0x9'));var client=jayson[_0xdc77('0xa')][_0xdc77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x228c51,_0x3b9897,_0x1ef269){return new BPromise(function(_0x4e5ee2,_0x1bf0b2){return client['request'](_0x228c51,_0x1ef269)[_0xdc77('0xc')](function(_0x184824){logger[_0xdc77('0xd')](_0xdc77('0xe'),_0x3b9897,_0xdc77('0xf'));logger[_0xdc77('0x10')](_0xdc77('0x11'),_0x3b9897,_0xdc77('0xf'),JSON[_0xdc77('0x12')](_0x184824));if(_0x184824[_0xdc77('0x13')]){if(_0x184824[_0xdc77('0x13')][_0xdc77('0x14')]===0x1f4){logger[_0xdc77('0x13')](_0xdc77('0xe'),_0x3b9897,_0x184824['error'][_0xdc77('0x15')]);return _0x1bf0b2(_0x184824[_0xdc77('0x13')][_0xdc77('0x15')]);}logger['error'](_0xdc77('0xe'),_0x3b9897,_0x184824['error']['message']);return _0x4e5ee2(_0x184824[_0xdc77('0x13')][_0xdc77('0x15')]);}else{logger[_0xdc77('0xd')](_0xdc77('0xe'),_0x3b9897,_0xdc77('0xf'));_0x4e5ee2(_0x184824[_0xdc77('0x16')][_0xdc77('0x15')]);}})[_0xdc77('0x17')](function(_0x1bfd69){logger[_0xdc77('0x13')]('MailServerIn,\x20%s,\x20%s',_0x3b9897,_0x1bfd69);_0x1bf0b2(_0x1bfd69);});});}exports[_0xdc77('0x18')]=function(_0x337461){var _0x30faf1=this;return new Promise(function(_0x3a26d8,_0x1a7323){return db[_0xdc77('0x19')][_0xdc77('0x1a')]({'raw':_0x337461[_0xdc77('0x1b')]?_0x337461['options'][_0xdc77('0x1c')]===undefined?!![]:![]:!![],'where':_0x337461[_0xdc77('0x1b')]?_0x337461['options'][_0xdc77('0x1d')]||null:null,'attributes':_0x337461[_0xdc77('0x1b')]?_0x337461[_0xdc77('0x1b')][_0xdc77('0x1e')]||null:null,'limit':_0x337461['options']?_0x337461[_0xdc77('0x1b')]['limit']||null:null,'include':_0x337461['options']?_0x337461[_0xdc77('0x1b')][_0xdc77('0x1f')]?_[_0xdc77('0x20')](_0x337461['options'][_0xdc77('0x1f')],function(_0x25fecf){return{'model':db[_0x25fecf['model']],'as':_0x25fecf['as'],'attributes':_0x25fecf[_0xdc77('0x1e')],'include':_0x25fecf[_0xdc77('0x1f')]?_['map'](_0x25fecf[_0xdc77('0x1f')],function(_0x3f0675){return{'model':db[_0x3f0675[_0xdc77('0x21')]],'as':_0x3f0675['as'],'attributes':_0x3f0675[_0xdc77('0x1e')],'include':_0x3f0675['include']?_[_0xdc77('0x20')](_0x3f0675[_0xdc77('0x1f')],function(_0x3f0703){return{'model':db[_0x3f0703[_0xdc77('0x21')]],'as':_0x3f0703['as'],'attributes':_0x3f0703['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c3f55){logger[_0xdc77('0xd')](_0xdc77('0x18'),_0x337461);logger[_0xdc77('0x10')](_0xdc77('0x18'),_0x337461,JSON[_0xdc77('0x12')](_0x4c3f55));_0x3a26d8(_0x4c3f55);})[_0xdc77('0x17')](function(_0x8c34bb){logger[_0xdc77('0x13')](_0xdc77('0x18'),_0x8c34bb[_0xdc77('0x15')],_0x337461);_0x1a7323(_0x30faf1[_0xdc77('0x13')](0x1f4,_0x8c34bb['message']));});});}; \ No newline at end of file +var _0xea32=['../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','attributes','limit','include','map','model','GetMailServerIn','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x393700,_0x603c8c){var _0x2e4c3d=function(_0x2bfa0c){while(--_0x2bfa0c){_0x393700['push'](_0x393700['shift']());}};_0x2e4c3d(++_0x603c8c);}(_0xea32,0xf8));var _0x2ea3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2ea3('0x0'));var util=require('util');var moment=require(_0x2ea3('0x1'));var BPromise=require(_0x2ea3('0x2'));var rs=require(_0x2ea3('0x3'));var fs=require('fs');var Redis=require(_0x2ea3('0x4'));var db=require(_0x2ea3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ea3('0x6'))(_0x2ea3('0x7'));var config=require(_0x2ea3('0x8'));var jayson=require(_0x2ea3('0x9'));var client=jayson[_0x2ea3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x594b03,_0x7198ac,_0x53249d){return new BPromise(function(_0x11edeb,_0x558c09){return client[_0x2ea3('0xb')](_0x594b03,_0x53249d)[_0x2ea3('0xc')](function(_0x7bd7fb){logger[_0x2ea3('0xd')](_0x2ea3('0xe'),_0x7198ac,_0x2ea3('0xf'));logger[_0x2ea3('0x10')](_0x2ea3('0x11'),_0x7198ac,'request\x20sent',JSON[_0x2ea3('0x12')](_0x7bd7fb));if(_0x7bd7fb['error']){if(_0x7bd7fb[_0x2ea3('0x13')][_0x2ea3('0x14')]===0x1f4){logger[_0x2ea3('0x13')]('MailServerIn,\x20%s,\x20%s',_0x7198ac,_0x7bd7fb[_0x2ea3('0x13')][_0x2ea3('0x15')]);return _0x558c09(_0x7bd7fb[_0x2ea3('0x13')][_0x2ea3('0x15')]);}logger[_0x2ea3('0x13')]('MailServerIn,\x20%s,\x20%s',_0x7198ac,_0x7bd7fb['error']['message']);return _0x11edeb(_0x7bd7fb[_0x2ea3('0x13')]['message']);}else{logger[_0x2ea3('0xd')]('MailServerIn,\x20%s,\x20%s',_0x7198ac,_0x2ea3('0xf'));_0x11edeb(_0x7bd7fb[_0x2ea3('0x16')][_0x2ea3('0x15')]);}})['catch'](function(_0x25f1b8){logger[_0x2ea3('0x13')](_0x2ea3('0xe'),_0x7198ac,_0x25f1b8);_0x558c09(_0x25f1b8);});});}exports['GetMailServerIn']=function(_0x499852){var _0x24b0eb=this;return new Promise(function(_0x2a3d10,_0x1de717){return db['MailServerIn'][_0x2ea3('0x17')]({'raw':_0x499852[_0x2ea3('0x18')]?_0x499852[_0x2ea3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x499852[_0x2ea3('0x18')]?_0x499852[_0x2ea3('0x18')]['where']||null:null,'attributes':_0x499852[_0x2ea3('0x18')]?_0x499852[_0x2ea3('0x18')][_0x2ea3('0x19')]||null:null,'limit':_0x499852[_0x2ea3('0x18')]?_0x499852[_0x2ea3('0x18')][_0x2ea3('0x1a')]||null:null,'include':_0x499852[_0x2ea3('0x18')]?_0x499852[_0x2ea3('0x18')][_0x2ea3('0x1b')]?_[_0x2ea3('0x1c')](_0x499852[_0x2ea3('0x18')][_0x2ea3('0x1b')],function(_0x7b7950){return{'model':db[_0x7b7950['model']],'as':_0x7b7950['as'],'attributes':_0x7b7950[_0x2ea3('0x19')],'include':_0x7b7950[_0x2ea3('0x1b')]?_[_0x2ea3('0x1c')](_0x7b7950[_0x2ea3('0x1b')],function(_0x311af5){return{'model':db[_0x311af5[_0x2ea3('0x1d')]],'as':_0x311af5['as'],'attributes':_0x311af5[_0x2ea3('0x19')],'include':_0x311af5[_0x2ea3('0x1b')]?_[_0x2ea3('0x1c')](_0x311af5['include'],function(_0xd602){return{'model':db[_0xd602[_0x2ea3('0x1d')]],'as':_0xd602['as'],'attributes':_0xd602['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x405599){logger[_0x2ea3('0xd')](_0x2ea3('0x1e'),_0x499852);logger['debug'](_0x2ea3('0x1e'),_0x499852,JSON[_0x2ea3('0x12')](_0x405599));_0x2a3d10(_0x405599);})[_0x2ea3('0x1f')](function(_0x46c823){logger[_0x2ea3('0x13')](_0x2ea3('0x1e'),_0x46c823[_0x2ea3('0x15')],_0x499852);_0x1de717(_0x24b0eb['error'](0x1f4,_0x46c823[_0x2ea3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3492d9e..c925e56 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 _0xc44b=['show','post','create','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','/:id'];(function(_0x2145f9,_0x29a8ac){var _0x495dc5=function(_0x37ea4d){while(--_0x37ea4d){_0x2145f9['push'](_0x2145f9['shift']());}};_0x495dc5(++_0x29a8ac);}(_0xc44b,0xab));var _0xbc44=function(_0xe51964,_0x433b90){_0xe51964=_0xe51964-0x0;var _0x2c2366=_0xc44b[_0xe51964];return _0x2c2366;};'use strict';var multer=require(_0xbc44('0x0'));var util=require(_0xbc44('0x1'));var path=require(_0xbc44('0x2'));var timeout=require(_0xbc44('0x3'));var express=require('express');var router=express[_0xbc44('0x4')]();var auth=require(_0xbc44('0x5'));var interaction=require(_0xbc44('0x6'));var config=require('../../config/environment');var controller=require(_0xbc44('0x7'));router[_0xbc44('0x8')]('/',auth[_0xbc44('0x9')](),controller['index']);router[_0xbc44('0x8')](_0xbc44('0xa'),auth['isAuthenticated'](),controller[_0xbc44('0xb')]);router[_0xbc44('0xc')]('/',auth[_0xbc44('0x9')](),controller[_0xbc44('0xd')]);router['put'](_0xbc44('0xa'),auth[_0xbc44('0x9')](),controller['update']);router['delete'](_0xbc44('0xa'),auth[_0xbc44('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf4b6=['isAuthenticated','create','put','/:id','update','delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index'];(function(_0x4adf06,_0x23beb5){var _0x42d1eb=function(_0x371bb6){while(--_0x371bb6){_0x4adf06['push'](_0x4adf06['shift']());}};_0x42d1eb(++_0x23beb5);}(_0xf4b6,0x197));var _0x6f4b=function(_0x3dc04d,_0x3ba51c){_0x3dc04d=_0x3dc04d-0x0;var _0x55fef3=_0xf4b6[_0x3dc04d];return _0x55fef3;};'use strict';var multer=require('multer');var util=require(_0x6f4b('0x0'));var path=require(_0x6f4b('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f4b('0x2'));var router=express['Router']();var auth=require(_0x6f4b('0x3'));var interaction=require(_0x6f4b('0x4'));var config=require(_0x6f4b('0x5'));var controller=require(_0x6f4b('0x6'));router[_0x6f4b('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f4b('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6f4b('0x9')](),controller[_0x6f4b('0xa')]);router[_0x6f4b('0xb')](_0x6f4b('0xc'),auth[_0x6f4b('0x9')](),controller[_0x6f4b('0xd')]);router[_0x6f4b('0xe')](_0x6f4b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x6f4b('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index ef82e6a..23eb3cb 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 _0xc5f7=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x1d6561,_0x1603ca){var _0xfa84a4=function(_0x34e396){while(--_0x34e396){_0x1d6561['push'](_0x1d6561['shift']());}};_0xfa84a4(++_0x1603ca);}(_0xc5f7,0x1df));var _0x7c5f=function(_0x440ce4,_0x387bab){_0x440ce4=_0x440ce4-0x0;var _0x3b5c04=_0xc5f7[_0x440ce4];return _0x3b5c04;};'use strict';var Sequelize=require(_0x7c5f('0x0'));module[_0x7c5f('0x1')]={'description':{'type':Sequelize[_0x7c5f('0x2')]},'host':{'type':Sequelize[_0x7c5f('0x2')]},'user':{'type':Sequelize[_0x7c5f('0x2')]},'pass':{'type':Sequelize[_0x7c5f('0x2')]},'port':{'type':Sequelize[_0x7c5f('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x7c5f('0x2')]},'authentication':{'type':Sequelize[_0x7c5f('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8103=['STRING','INTEGER','sequelize'];(function(_0x1ce6c,_0x432755){var _0x890d94=function(_0xa36694){while(--_0xa36694){_0x1ce6c['push'](_0x1ce6c['shift']());}};_0x890d94(++_0x432755);}(_0x8103,0x74));var _0x3810=function(_0x323c1a,_0x3da6dd){_0x323c1a=_0x323c1a-0x0;var _0x499252=_0x8103[_0x323c1a];return _0x499252;};'use strict';var Sequelize=require(_0x3810('0x0'));module['exports']={'description':{'type':Sequelize[_0x3810('0x1')]},'host':{'type':Sequelize[_0x3810('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x3810('0x1')]},'port':{'type':Sequelize[_0x3810('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 1957aef..7630147 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 _0xcb91=['options','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','MailServerOut','rawAttributes','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','map','type','key','VIRTUAL','filter','includeAll','include','rows','catch','show','fields'];(function(_0x254635,_0x472b4c){var _0x35293c=function(_0x731a6d){while(--_0x731a6d){_0x254635['push'](_0x254635['shift']());}};_0x35293c(++_0x472b4c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0xcb91[_0x2525f1];return _0x13c1b5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x1cb9('0xd'));var hardwareService=require(_0x1cb9('0xe'));var Redis=require(_0x1cb9('0xf'));var qs=require(_0x1cb9('0x10'));var logger=require(_0x1cb9('0x11'))('api');var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var db=require(_0x1cb9('0x14'))['db'];function respondWithStatusCode(_0x3fdd83,_0x46af58){_0x46af58=_0x46af58||0xcc;return function(_0x5445e1){if(_0x5445e1){return _0x3fdd83['sendStatus'](_0x46af58);}return _0x3fdd83['status'](_0x46af58)[_0x1cb9('0x15')]();};}function respondWithResult(_0x282bc6,_0x384496){_0x384496=_0x384496||0xc8;return function(_0x1c714f){if(_0x1c714f){return _0x282bc6['status'](_0x384496)[_0x1cb9('0x16')](_0x1c714f);}};}function respondWithFilteredResult(_0x6ef389,_0x1b3cd7){return function(_0x8dfa55){if(_0x8dfa55){var _0x3e2d11=_0x8dfa55[_0x1cb9('0x17')],_0x5806d8=_0x1b3cd7[_0x1cb9('0x18')],_0x5572cb=_0x1b3cd7[_0x1cb9('0x18')]+_0x1b3cd7[_0x1cb9('0x19')],_0xd446a3;if(_0x5572cb>=_0x3e2d11){_0x5572cb=_0x3e2d11;_0xd446a3=0xc8;}else{_0xd446a3=0xce;}_0x6ef389[_0x1cb9('0x1a')](_0xd446a3);return _0x6ef389[_0x1cb9('0x1b')]('Content-Range',_0x5806d8+'-'+_0x5572cb+'/'+_0x3e2d11)['json'](_0x8dfa55);}return null;};}function patchUpdates(_0x1b2fa6){return function(_0x41ac41){try{jsonpatch[_0x1cb9('0x1c')](_0x41ac41,_0x1b2fa6,!![]);}catch(_0x31481a){return BPromise[_0x1cb9('0x1d')](_0x31481a);}return _0x41ac41[_0x1cb9('0x1e')]();};}function saveUpdates(_0x24fa1f,_0x4ac422){return function(_0x559bcc){if(_0x559bcc){return _0x559bcc[_0x1cb9('0x1f')](_0x24fa1f)['then'](function(_0x4750b1){return _0x4750b1;});}return null;};}function removeEntity(_0x2265ea,_0x523b26){return function(_0x599275){if(_0x599275){return _0x599275[_0x1cb9('0x20')]()[_0x1cb9('0x21')](function(){_0x2265ea[_0x1cb9('0x1a')](0xcc)[_0x1cb9('0x15')]();});}};}function handleEntityNotFound(_0x45b8d3,_0x27db16){return function(_0x59ebea){if(!_0x59ebea){_0x45b8d3['sendStatus'](0x194);}return _0x59ebea;};}function handleError(_0x6c6f61,_0x557199){_0x557199=_0x557199||0x1f4;return function(_0x10a419){logger[_0x1cb9('0x22')](_0x10a419[_0x1cb9('0x23')]);if(_0x10a419[_0x1cb9('0x24')]){delete _0x10a419[_0x1cb9('0x24')];}_0x6c6f61['status'](_0x557199)[_0x1cb9('0x25')](_0x10a419);};}exports[_0x1cb9('0x26')]=function(_0x4c8d76,_0xd6891c){var _0x21effa={},_0x41a9a0={},_0x1804fd={'count':0x0,'rows':[]};var _0x406821=db[_0x1cb9('0x27')][_0x1cb9('0x28')];_0x41a9a0[_0x1cb9('0x29')]=_[_0x1cb9('0x2a')](_0x406821);_0x41a9a0[_0x1cb9('0x2b')]=_['keys'](_0x4c8d76[_0x1cb9('0x2b')]);_0x41a9a0['filters']=_[_0x1cb9('0x2c')](_0x41a9a0['model'],_0x41a9a0[_0x1cb9('0x2b')]);_0x21effa[_0x1cb9('0x2d')]=_[_0x1cb9('0x2c')](_0x41a9a0[_0x1cb9('0x29')],qs['fields'](_0x4c8d76[_0x1cb9('0x2b')]['fields']));_0x21effa[_0x1cb9('0x2d')]=_0x21effa[_0x1cb9('0x2d')][_0x1cb9('0x2e')]?_0x21effa['attributes']:_0x41a9a0[_0x1cb9('0x29')];if(!_0x4c8d76['query'][_0x1cb9('0x2f')]('nolimit')){_0x21effa[_0x1cb9('0x19')]=qs[_0x1cb9('0x19')](_0x4c8d76[_0x1cb9('0x2b')][_0x1cb9('0x19')]);_0x21effa['offset']=qs[_0x1cb9('0x18')](_0x4c8d76[_0x1cb9('0x2b')][_0x1cb9('0x18')]);}_0x21effa[_0x1cb9('0x30')]=qs[_0x1cb9('0x31')](_0x4c8d76[_0x1cb9('0x2b')][_0x1cb9('0x31')]);_0x21effa[_0x1cb9('0x32')]=qs[_0x1cb9('0x33')](_[_0x1cb9('0x34')](_0x4c8d76[_0x1cb9('0x2b')],_0x41a9a0[_0x1cb9('0x33')]));if(_0x4c8d76[_0x1cb9('0x2b')]['filter']){_0x21effa['where']=_[_0x1cb9('0x35')](_0x21effa[_0x1cb9('0x32')],{'$or':_[_0x1cb9('0x36')](_0x406821,function(_0x29f451){if(_0x29f451[_0x1cb9('0x37')][_0x1cb9('0x38')]!==_0x1cb9('0x39')){var _0x3f5637={};_0x3f5637[_0x29f451['field']]={'$like':'%'+_0x4c8d76[_0x1cb9('0x2b')][_0x1cb9('0x3a')]+'%'};return _0x3f5637;}})});}_0x21effa=_[_0x1cb9('0x35')]({},_0x21effa,_0x4c8d76['options']);var _0x2a5aac={'where':_0x21effa['where']};return db[_0x1cb9('0x27')]['count'](_0x2a5aac)[_0x1cb9('0x21')](function(_0x13d4fd){_0x1804fd[_0x1cb9('0x17')]=_0x13d4fd;if(_0x4c8d76[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x21effa[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')]['findAll'](_0x21effa);})['then'](function(_0x4111b8){_0x1804fd[_0x1cb9('0x3d')]=_0x4111b8;return _0x1804fd;})[_0x1cb9('0x21')](respondWithFilteredResult(_0xd6891c,_0x21effa))[_0x1cb9('0x3e')](handleError(_0xd6891c,null));};exports[_0x1cb9('0x3f')]=function(_0x1d7304,_0x32130b){var _0x4a670c={'raw':!![],'where':{'id':_0x1d7304['params']['id']}},_0xbcaa32={};_0xbcaa32['model']=_['keys'](db[_0x1cb9('0x27')][_0x1cb9('0x28')]);_0xbcaa32[_0x1cb9('0x2b')]=_[_0x1cb9('0x2a')](_0x1d7304[_0x1cb9('0x2b')]);_0xbcaa32['filters']=_[_0x1cb9('0x2c')](_0xbcaa32['model'],_0xbcaa32[_0x1cb9('0x2b')]);_0x4a670c[_0x1cb9('0x2d')]=_[_0x1cb9('0x2c')](_0xbcaa32['model'],qs[_0x1cb9('0x40')](_0x1d7304['query'][_0x1cb9('0x40')]));_0x4a670c[_0x1cb9('0x2d')]=_0x4a670c['attributes']['length']?_0x4a670c[_0x1cb9('0x2d')]:_0xbcaa32[_0x1cb9('0x29')];if(_0x1d7304[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x4a670c[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x4a670c=_['merge']({},_0x4a670c,_0x1d7304[_0x1cb9('0x41')]);return db['MailServerOut']['find'](_0x4a670c)['then'](handleEntityNotFound(_0x32130b,null))[_0x1cb9('0x21')](respondWithResult(_0x32130b,null))[_0x1cb9('0x3e')](handleError(_0x32130b,null));};exports[_0x1cb9('0x42')]=function(_0x11cea5,_0x116c05){return db[_0x1cb9('0x27')][_0x1cb9('0x42')](_0x11cea5[_0x1cb9('0x43')],{})[_0x1cb9('0x21')](respondWithResult(_0x116c05,0xc9))[_0x1cb9('0x3e')](handleError(_0x116c05,null));};exports[_0x1cb9('0x1f')]=function(_0x4ce899,_0x9d08cb){if(_0x4ce899[_0x1cb9('0x43')]['id']){delete _0x4ce899[_0x1cb9('0x43')]['id'];}return db['MailServerOut'][_0x1cb9('0x44')]({'where':{'id':_0x4ce899[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x9d08cb,null))[_0x1cb9('0x21')](saveUpdates(_0x4ce899[_0x1cb9('0x43')],null))['then'](respondWithResult(_0x9d08cb,null))[_0x1cb9('0x3e')](handleError(_0x9d08cb,null));};exports['destroy']=function(_0x2eaa11,_0x4ac483){return db[_0x1cb9('0x27')][_0x1cb9('0x44')]({'where':{'id':_0x2eaa11[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x4ac483,null))['then'](removeEntity(_0x4ac483,null))[_0x1cb9('0x3e')](handleError(_0x4ac483,null));}; \ No newline at end of file +var _0x70e0=['error','name','send','index','MailServerOut','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','offset','sort','where','filter','merge','map','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x70e0,0x17b));var _0x070e=function(_0x3ffd26,_0x1e8003){_0x3ffd26=_0x3ffd26-0x0;var _0x35e393=_0x70e0[_0x3ffd26];return _0x35e393;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var authService=require(_0x070e('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x070e('0xf'));var logger=require(_0x070e('0x10'))(_0x070e('0x11'));var utils=require(_0x070e('0x12'));var config=require(_0x070e('0x13'));var db=require(_0x070e('0x14'))['db'];function respondWithStatusCode(_0x25cfe1,_0x1baa12){_0x1baa12=_0x1baa12||0xcc;return function(_0x39d2b9){if(_0x39d2b9){return _0x25cfe1[_0x070e('0x15')](_0x1baa12);}return _0x25cfe1[_0x070e('0x16')](_0x1baa12)['end']();};}function respondWithResult(_0x5dca0f,_0x24baba){_0x24baba=_0x24baba||0xc8;return function(_0x56c7ba){if(_0x56c7ba){return _0x5dca0f['status'](_0x24baba)['json'](_0x56c7ba);}};}function respondWithFilteredResult(_0x11d2ce,_0x14c3fd){return function(_0x51d14d){if(_0x51d14d){var _0x5d3a38=_0x51d14d[_0x070e('0x17')],_0x373d86=_0x14c3fd['offset'],_0xeae1a5=_0x14c3fd['offset']+_0x14c3fd[_0x070e('0x18')],_0x180897;if(_0xeae1a5>=_0x5d3a38){_0xeae1a5=_0x5d3a38;_0x180897=0xc8;}else{_0x180897=0xce;}_0x11d2ce[_0x070e('0x16')](_0x180897);return _0x11d2ce[_0x070e('0x19')](_0x070e('0x1a'),_0x373d86+'-'+_0xeae1a5+'/'+_0x5d3a38)[_0x070e('0x1b')](_0x51d14d);}return null;};}function patchUpdates(_0x5037eb){return function(_0x3938b5){try{jsonpatch[_0x070e('0x1c')](_0x3938b5,_0x5037eb,!![]);}catch(_0x1ad3de){return BPromise[_0x070e('0x1d')](_0x1ad3de);}return _0x3938b5[_0x070e('0x1e')]();};}function saveUpdates(_0x5c16fd,_0x5b2f48){return function(_0x4e958f){if(_0x4e958f){return _0x4e958f[_0x070e('0x1f')](_0x5c16fd)[_0x070e('0x20')](function(_0x20dc60){return _0x20dc60;});}return null;};}function removeEntity(_0x4be0d7,_0x5b184){return function(_0x5dc5d2){if(_0x5dc5d2){return _0x5dc5d2[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x4be0d7[_0x070e('0x16')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0x28a1c3,_0xa86797){return function(_0xe405e){if(!_0xe405e){_0x28a1c3[_0x070e('0x15')](0x194);}return _0xe405e;};}function handleError(_0x595c7e,_0x2f8055){_0x2f8055=_0x2f8055||0x1f4;return function(_0x270061){logger[_0x070e('0x23')](_0x270061['stack']);if(_0x270061[_0x070e('0x24')]){delete _0x270061['name'];}_0x595c7e['status'](_0x2f8055)[_0x070e('0x25')](_0x270061);};}exports[_0x070e('0x26')]=function(_0x41deb1,_0x1743cc){var _0x4763c6={},_0x497f58={},_0x374c54={'count':0x0,'rows':[]};var _0x219e48=db[_0x070e('0x27')][_0x070e('0x28')];_0x497f58[_0x070e('0x29')]=_[_0x070e('0x2a')](_0x219e48);_0x497f58[_0x070e('0x2b')]=_[_0x070e('0x2a')](_0x41deb1['query']);_0x497f58[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x497f58[_0x070e('0x29')],_0x497f58['query']);_0x4763c6['attributes']=_[_0x070e('0x2d')](_0x497f58[_0x070e('0x29')],qs[_0x070e('0x2e')](_0x41deb1['query'][_0x070e('0x2e')]));_0x4763c6[_0x070e('0x2f')]=_0x4763c6[_0x070e('0x2f')][_0x070e('0x30')]?_0x4763c6['attributes']:_0x497f58['model'];if(!_0x41deb1['query']['hasOwnProperty'](_0x070e('0x31'))){_0x4763c6['limit']=qs[_0x070e('0x18')](_0x41deb1[_0x070e('0x2b')]['limit']);_0x4763c6['offset']=qs[_0x070e('0x32')](_0x41deb1[_0x070e('0x2b')]['offset']);}_0x4763c6['order']=qs[_0x070e('0x33')](_0x41deb1[_0x070e('0x2b')][_0x070e('0x33')]);_0x4763c6[_0x070e('0x34')]=qs[_0x070e('0x2c')](_['pick'](_0x41deb1['query'],_0x497f58[_0x070e('0x2c')]));if(_0x41deb1[_0x070e('0x2b')][_0x070e('0x35')]){_0x4763c6[_0x070e('0x34')]=_[_0x070e('0x36')](_0x4763c6['where'],{'$or':_[_0x070e('0x37')](_0x219e48,function(_0x1927f4){if(_0x1927f4['type'][_0x070e('0x38')]!==_0x070e('0x39')){var _0x4ba6f0={};_0x4ba6f0[_0x1927f4['field']]={'$like':'%'+_0x41deb1['query'][_0x070e('0x35')]+'%'};return _0x4ba6f0;}})});}_0x4763c6=_[_0x070e('0x36')]({},_0x4763c6,_0x41deb1[_0x070e('0x3a')]);var _0x334733={'where':_0x4763c6[_0x070e('0x34')]};return db['MailServerOut'][_0x070e('0x17')](_0x334733)[_0x070e('0x20')](function(_0xb53332){_0x374c54['count']=_0xb53332;if(_0x41deb1[_0x070e('0x2b')][_0x070e('0x3b')]){_0x4763c6[_0x070e('0x3c')]=[{'all':!![]}];}return db['MailServerOut'][_0x070e('0x3d')](_0x4763c6);})[_0x070e('0x20')](function(_0x4800a9){_0x374c54[_0x070e('0x3e')]=_0x4800a9;return _0x374c54;})['then'](respondWithFilteredResult(_0x1743cc,_0x4763c6))[_0x070e('0x3f')](handleError(_0x1743cc,null));};exports[_0x070e('0x40')]=function(_0x3462d3,_0x30319c){var _0xd03404={'raw':!![],'where':{'id':_0x3462d3[_0x070e('0x41')]['id']}},_0x47b929={};_0x47b929['model']=_['keys'](db[_0x070e('0x27')][_0x070e('0x28')]);_0x47b929[_0x070e('0x2b')]=_['keys'](_0x3462d3[_0x070e('0x2b')]);_0x47b929[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x47b929[_0x070e('0x29')],_0x47b929['query']);_0xd03404[_0x070e('0x2f')]=_['intersection'](_0x47b929['model'],qs['fields'](_0x3462d3[_0x070e('0x2b')][_0x070e('0x2e')]));_0xd03404[_0x070e('0x2f')]=_0xd03404[_0x070e('0x2f')][_0x070e('0x30')]?_0xd03404['attributes']:_0x47b929[_0x070e('0x29')];if(_0x3462d3['query'][_0x070e('0x3b')]){_0xd03404[_0x070e('0x3c')]=[{'all':!![]}];}_0xd03404=_[_0x070e('0x36')]({},_0xd03404,_0x3462d3['options']);return db['MailServerOut'][_0x070e('0x42')](_0xd03404)['then'](handleEntityNotFound(_0x30319c,null))[_0x070e('0x20')](respondWithResult(_0x30319c,null))[_0x070e('0x3f')](handleError(_0x30319c,null));};exports[_0x070e('0x43')]=function(_0x5f5675,_0x7c15f9){return db[_0x070e('0x27')]['create'](_0x5f5675['body'],{})[_0x070e('0x20')](respondWithResult(_0x7c15f9,0xc9))[_0x070e('0x3f')](handleError(_0x7c15f9,null));};exports[_0x070e('0x1f')]=function(_0x1fc7c4,_0x253e11){if(_0x1fc7c4['body']['id']){delete _0x1fc7c4[_0x070e('0x44')]['id'];}return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x1fc7c4[_0x070e('0x41')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x253e11,null))[_0x070e('0x20')](saveUpdates(_0x1fc7c4[_0x070e('0x44')],null))[_0x070e('0x20')](respondWithResult(_0x253e11,null))[_0x070e('0x3f')](handleError(_0x253e11,null));};exports[_0x070e('0x21')]=function(_0x210c4d,_0x3be553){return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x210c4d[_0x070e('0x41')]['id']}})['then'](handleEntityNotFound(_0x3be553,null))[_0x070e('0x20')](removeEntity(_0x3be553,null))[_0x070e('0x3f')](handleError(_0x3be553,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index b0b9f7a..6cc7984 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 _0x81c6=['MailServerOut','util','bluebird','request-promise','./mailServerOut.attributes','define'];(function(_0x1b9c27,_0x126fd0){var _0x34d9c3=function(_0x4c1697){while(--_0x4c1697){_0x1b9c27['push'](_0x1b9c27['shift']());}};_0x34d9c3(++_0x126fd0);}(_0x81c6,0x1d5));var _0x681c=function(_0x63de62,_0xe5cc89){_0x63de62=_0x63de62-0x0;var _0x3daddf=_0x81c6[_0x63de62];return _0x3daddf;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var attributes=require(_0x681c('0x3'));module['exports']=function(_0x44c18e,_0x2aff9d){return _0x44c18e[_0x681c('0x4')](_0x681c('0x5'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27a0=['../../config/logger','api','moment','bluebird','define','MailServerOut','mail_servers_out','util'];(function(_0x5948ce,_0x339ee0){var _0x365f8f=function(_0x1f24ea){while(--_0x1f24ea){_0x5948ce['push'](_0x5948ce['shift']());}};_0x365f8f(++_0x339ee0);}(_0x27a0,0xbf));var _0x027a=function(_0x2cffa2,_0x582a51){_0x2cffa2=_0x2cffa2-0x0;var _0x5c64b7=_0x27a0[_0x2cffa2];return _0x5c64b7;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('0x4'));var rp=require('request-promise');var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x47cd65,_0x30a54d){return _0x47cd65[_0x027a('0x5')](_0x027a('0x6'),attributes,{'tableName':_0x027a('0x7'),'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 21bd5d9..91bed12 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 _0xb48e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4be338,_0x390655){var _0x568f6a=function(_0x128636){while(--_0x128636){_0x4be338['push'](_0x4be338['shift']());}};_0x568f6a(++_0x390655);}(_0xb48e,0xb3));var _0xeb48=function(_0x285f06,_0x143fd3){_0x285f06=_0x285f06-0x0;var _0x528412=_0xb48e[_0x285f06];return _0x528412;};'use strict';var _=require('lodash');var util=require(_0xeb48('0x0'));var moment=require('moment');var BPromise=require(_0xeb48('0x1'));var rs=require(_0xeb48('0x2'));var fs=require('fs');var Redis=require(_0xeb48('0x3'));var db=require(_0xeb48('0x4'))['db'];var utils=require(_0xeb48('0x5'));var logger=require(_0xeb48('0x6'))(_0xeb48('0x7'));var config=require(_0xeb48('0x8'));var jayson=require(_0xeb48('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cab29,_0x316289,_0x428689){return new BPromise(function(_0x2fa39b,_0x1d2251){return client[_0xeb48('0xa')](_0x5cab29,_0x428689)[_0xeb48('0xb')](function(_0x13e467){logger[_0xeb48('0xc')](_0xeb48('0xd'),_0x316289,_0xeb48('0xe'));logger[_0xeb48('0xf')](_0xeb48('0x10'),_0x316289,_0xeb48('0xe'),JSON[_0xeb48('0x11')](_0x13e467));if(_0x13e467['error']){if(_0x13e467[_0xeb48('0x12')][_0xeb48('0x13')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x316289,_0x13e467[_0xeb48('0x12')][_0xeb48('0x14')]);return _0x1d2251(_0x13e467['error'][_0xeb48('0x14')]);}logger[_0xeb48('0x12')](_0xeb48('0xd'),_0x316289,_0x13e467[_0xeb48('0x12')][_0xeb48('0x14')]);return _0x2fa39b(_0x13e467['error'][_0xeb48('0x14')]);}else{logger[_0xeb48('0xc')](_0xeb48('0xd'),_0x316289,_0xeb48('0xe'));_0x2fa39b(_0x13e467[_0xeb48('0x15')]['message']);}})[_0xeb48('0x16')](function(_0x1eaf73){logger['error'](_0xeb48('0xd'),_0x316289,_0x1eaf73);_0x1d2251(_0x1eaf73);});});} \ No newline at end of file +var _0x71ee=['message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x18f051,_0x54da43){var _0x813a75=function(_0x312bf0){while(--_0x312bf0){_0x18f051['push'](_0x18f051['shift']());}};_0x813a75(++_0x54da43);}(_0x71ee,0x12f));var _0xe71e=function(_0x3d9cfa,_0x596edc){_0x3d9cfa=_0x3d9cfa-0x0;var _0x21d89d=_0x71ee[_0x3d9cfa];return _0x21d89d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe71e('0x0'));var rs=require(_0xe71e('0x1'));var fs=require('fs');var Redis=require(_0xe71e('0x2'));var db=require(_0xe71e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe71e('0x4'))(_0xe71e('0x5'));var config=require(_0xe71e('0x6'));var jayson=require(_0xe71e('0x7'));var client=jayson[_0xe71e('0x8')][_0xe71e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x255e12,_0x4ff698,_0x52968a){return new BPromise(function(_0x3459e8,_0x7ee051){return client['request'](_0x255e12,_0x52968a)[_0xe71e('0xa')](function(_0x3faba7){logger[_0xe71e('0xb')](_0xe71e('0xc'),_0x4ff698,_0xe71e('0xd'));logger[_0xe71e('0xe')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x4ff698,_0xe71e('0xd'),JSON[_0xe71e('0xf')](_0x3faba7));if(_0x3faba7['error']){if(_0x3faba7[_0xe71e('0x10')]['code']===0x1f4){logger[_0xe71e('0x10')]('MailServerOut,\x20%s,\x20%s',_0x4ff698,_0x3faba7[_0xe71e('0x10')]['message']);return _0x7ee051(_0x3faba7['error']['message']);}logger[_0xe71e('0x10')](_0xe71e('0xc'),_0x4ff698,_0x3faba7[_0xe71e('0x10')][_0xe71e('0x11')]);return _0x3459e8(_0x3faba7[_0xe71e('0x10')]['message']);}else{logger['info'](_0xe71e('0xc'),_0x4ff698,'request\x20sent');_0x3459e8(_0x3faba7[_0xe71e('0x12')][_0xe71e('0x11')]);}})[_0xe71e('0x13')](function(_0x154d2c){logger['error'](_0xe71e('0xc'),_0x4ff698,_0x154d2c);_0x7ee051(_0x154d2c);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 0326ad4..d14770f 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 _0x05b2=['../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x46b579,_0x566d72){var _0x373a12=function(_0xe47070){while(--_0xe47070){_0x46b579['push'](_0x46b579['shift']());}};_0x373a12(++_0x566d72);}(_0x05b2,0x1c4));var _0x205b=function(_0x87c234,_0x1d22b4){_0x87c234=_0x87c234-0x0;var _0x324095=_0x05b2[_0x87c234];return _0x324095;};'use strict';var multer=require(_0x205b('0x0'));var util=require(_0x205b('0x1'));var path=require(_0x205b('0x2'));var timeout=require(_0x205b('0x3'));var express=require(_0x205b('0x4'));var router=express[_0x205b('0x5')]();var auth=require(_0x205b('0x6'));var interaction=require(_0x205b('0x7'));var config=require(_0x205b('0x8'));var controller=require(_0x205b('0x9'));router[_0x205b('0xa')]('/',auth[_0x205b('0xb')](),controller[_0x205b('0xc')]);router[_0x205b('0xa')](_0x205b('0xd'),auth[_0x205b('0xb')](),controller[_0x205b('0xe')]);router[_0x205b('0xa')]('/:id',auth[_0x205b('0xb')](),controller[_0x205b('0xf')]);router[_0x205b('0x10')]('/',auth['isAuthenticated'](),controller[_0x205b('0x11')]);router[_0x205b('0x12')](_0x205b('0x13'),auth[_0x205b('0xb')](),controller[_0x205b('0x14')]);router['delete'](_0x205b('0x13'),auth[_0x205b('0xb')](),controller[_0x205b('0x15')]);module[_0x205b('0x16')]=router; \ No newline at end of file +var _0xd7a6=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x508516,_0x4dcd85){var _0x49fcc9=function(_0x29bfa0){while(--_0x29bfa0){_0x508516['push'](_0x508516['shift']());}};_0x49fcc9(++_0x4dcd85);}(_0xd7a6,0x1de));var _0x6d7a=function(_0xb4cfe3,_0xe84344){_0xb4cfe3=_0xb4cfe3-0x0;var _0x2200e2=_0xd7a6[_0xb4cfe3];return _0x2200e2;};'use strict';var multer=require(_0x6d7a('0x0'));var util=require(_0x6d7a('0x1'));var path=require(_0x6d7a('0x2'));var timeout=require(_0x6d7a('0x3'));var express=require(_0x6d7a('0x4'));var router=express[_0x6d7a('0x5')]();var auth=require(_0x6d7a('0x6'));var interaction=require(_0x6d7a('0x7'));var config=require(_0x6d7a('0x8'));var controller=require(_0x6d7a('0x9'));router[_0x6d7a('0xa')]('/',auth[_0x6d7a('0xb')](),controller[_0x6d7a('0xc')]);router[_0x6d7a('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x6d7a('0xd')]);router[_0x6d7a('0xa')](_0x6d7a('0xe'),auth[_0x6d7a('0xb')](),controller[_0x6d7a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6d7a('0x10')]);router[_0x6d7a('0x11')](_0x6d7a('0xe'),auth['isAuthenticated'](),controller[_0x6d7a('0x12')]);router['delete']('/:id',auth[_0x6d7a('0xb')](),controller[_0x6d7a('0x13')]);module[_0x6d7a('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index c8dae97..0e5da55 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 _0x351d=['sequelize','STRING','name'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x351d,0x90));var _0xd351=function(_0x59e005,_0x7dea26){_0x59e005=_0x59e005-0x0;var _0x55a5b5=_0x351d[_0x59e005];return _0x55a5b5;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'name':{'type':Sequelize[_0xd351('0x1')],'unique':_0xd351('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd351('0x1')]}}; \ No newline at end of file +var _0xb2af=['STRING','name','sequelize','exports'];(function(_0x1126df,_0x5984a4){var _0x40b8e9=function(_0x17579b){while(--_0x17579b){_0x1126df['push'](_0x1126df['shift']());}};_0x40b8e9(++_0x5984a4);}(_0xb2af,0xd2));var _0xfb2a=function(_0x2d42b5,_0x3cd880){_0x2d42b5=_0x2d42b5-0x0;var _0x38aec2=_0xb2af[_0x2d42b5];return _0x38aec2;};'use strict';var Sequelize=require(_0xfb2a('0x0'));module[_0xfb2a('0x1')]={'name':{'type':Sequelize[_0xfb2a('0x2')],'unique':_0xfb2a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index a3a9b8c..d7d601d 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 _0xe5e0=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','save','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','type','VIRTUAL','field','options','includeAll','include','MailSubstatus','findAll','rows','catch','show','params','length','merge','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x4fb575,_0x227fac){var _0x19c538=function(_0x57aecf){while(--_0x57aecf){_0x4fb575['push'](_0x4fb575['shift']());}};_0x19c538(++_0x227fac);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x2a0f16,_0x2d0b9b){_0x2a0f16=_0x2a0f16-0x0;var _0x4f8338=_0xe5e0[_0x2a0f16];return _0x4f8338;};'use strict';var pdf=require(_0x0e5e('0x0'));var emlformat=require(_0x0e5e('0x1'));var rimraf=require(_0x0e5e('0x2'));var zipdir=require(_0x0e5e('0x3'));var jsonpatch=require(_0x0e5e('0x4'));var rp=require(_0x0e5e('0x5'));var moment=require(_0x0e5e('0x6'));var BPromise=require(_0x0e5e('0x7'));var Mustache=require(_0x0e5e('0x8'));var util=require('util');var path=require(_0x0e5e('0x9'));var sox=require(_0x0e5e('0xa'));var csv=require(_0x0e5e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e5e('0xc'));var squel=require(_0x0e5e('0xd'));var crypto=require(_0x0e5e('0xe'));var jsforce=require(_0x0e5e('0xf'));var deskjs=require(_0x0e5e('0x10'));var toCsv=require(_0x0e5e('0xb'));var querystring=require(_0x0e5e('0x11'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x0e5e('0x12'));var qs=require(_0x0e5e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0e5e('0x14'));var config=require(_0x0e5e('0x15'));var db=require(_0x0e5e('0x16'))['db'];function respondWithStatusCode(_0x379ce5,_0x56e099){_0x56e099=_0x56e099||0xcc;return function(_0x275cd5){if(_0x275cd5){return _0x379ce5[_0x0e5e('0x17')](_0x56e099);}return _0x379ce5['status'](_0x56e099)[_0x0e5e('0x18')]();};}function respondWithResult(_0x1e73e9,_0x1219ae){_0x1219ae=_0x1219ae||0xc8;return function(_0x50c0a3){if(_0x50c0a3){return _0x1e73e9[_0x0e5e('0x19')](_0x1219ae)[_0x0e5e('0x1a')](_0x50c0a3);}};}function respondWithFilteredResult(_0x187d39,_0x3d13a0){return function(_0x19d3a1){if(_0x19d3a1){var _0x1ef0be=_0x19d3a1[_0x0e5e('0x1b')],_0x5dedc5=_0x3d13a0[_0x0e5e('0x1c')],_0x20a35f=_0x3d13a0[_0x0e5e('0x1c')]+_0x3d13a0['limit'],_0x3e5104;if(_0x20a35f>=_0x1ef0be){_0x20a35f=_0x1ef0be;_0x3e5104=0xc8;}else{_0x3e5104=0xce;}_0x187d39[_0x0e5e('0x19')](_0x3e5104);return _0x187d39[_0x0e5e('0x1d')]('Content-Range',_0x5dedc5+'-'+_0x20a35f+'/'+_0x1ef0be)[_0x0e5e('0x1a')](_0x19d3a1);}return null;};}function patchUpdates(_0x3fd280){return function(_0x56cc12){try{jsonpatch[_0x0e5e('0x1e')](_0x56cc12,_0x3fd280,!![]);}catch(_0x3b80f8){return BPromise['reject'](_0x3b80f8);}return _0x56cc12[_0x0e5e('0x1f')]();};}function saveUpdates(_0x485b97,_0x3659d9){return function(_0x56dcc9){if(_0x56dcc9){return _0x56dcc9['update'](_0x485b97)[_0x0e5e('0x20')](function(_0x1b0588){return _0x1b0588;});}return null;};}function removeEntity(_0xb2930e,_0x1c4a7d){return function(_0x2c3c01){if(_0x2c3c01){return _0x2c3c01[_0x0e5e('0x21')]()[_0x0e5e('0x20')](function(){_0xb2930e[_0x0e5e('0x19')](0xcc)[_0x0e5e('0x18')]();});}};}function handleEntityNotFound(_0x33b27e,_0x523c30){return function(_0x742ee8){if(!_0x742ee8){_0x33b27e[_0x0e5e('0x17')](0x194);}return _0x742ee8;};}function handleError(_0xfff15b,_0xcab633){_0xcab633=_0xcab633||0x1f4;return function(_0x553208){logger[_0x0e5e('0x22')](_0x553208[_0x0e5e('0x23')]);if(_0x553208['name']){delete _0x553208[_0x0e5e('0x24')];}_0xfff15b['status'](_0xcab633)[_0x0e5e('0x25')](_0x553208);};}exports[_0x0e5e('0x26')]=function(_0x5e3a60,_0x1ceb31){var _0x471834={},_0x952141={},_0x563870={'count':0x0,'rows':[]};var _0x2b7fc6=db['MailSubstatus'][_0x0e5e('0x27')];_0x952141[_0x0e5e('0x28')]=_[_0x0e5e('0x29')](_0x2b7fc6);_0x952141['query']=_[_0x0e5e('0x29')](_0x5e3a60[_0x0e5e('0x2a')]);_0x952141[_0x0e5e('0x2b')]=_[_0x0e5e('0x2c')](_0x952141[_0x0e5e('0x28')],_0x952141[_0x0e5e('0x2a')]);_0x471834[_0x0e5e('0x2d')]=_['intersection'](_0x952141[_0x0e5e('0x28')],qs[_0x0e5e('0x2e')](_0x5e3a60[_0x0e5e('0x2a')][_0x0e5e('0x2e')]));_0x471834['attributes']=_0x471834['attributes']['length']?_0x471834['attributes']:_0x952141[_0x0e5e('0x28')];if(!_0x5e3a60['query'][_0x0e5e('0x2f')](_0x0e5e('0x30'))){_0x471834[_0x0e5e('0x31')]=qs['limit'](_0x5e3a60[_0x0e5e('0x2a')]['limit']);_0x471834['offset']=qs[_0x0e5e('0x1c')](_0x5e3a60[_0x0e5e('0x2a')][_0x0e5e('0x1c')]);}_0x471834[_0x0e5e('0x32')]=qs[_0x0e5e('0x33')](_0x5e3a60['query'][_0x0e5e('0x33')]);_0x471834[_0x0e5e('0x34')]=qs[_0x0e5e('0x2b')](_[_0x0e5e('0x35')](_0x5e3a60[_0x0e5e('0x2a')],_0x952141[_0x0e5e('0x2b')]));if(_0x5e3a60[_0x0e5e('0x2a')][_0x0e5e('0x36')]){_0x471834[_0x0e5e('0x34')]=_['merge'](_0x471834[_0x0e5e('0x34')],{'$or':_[_0x0e5e('0x37')](_0x2b7fc6,function(_0x3f7067){if(_0x3f7067[_0x0e5e('0x38')]['key']!==_0x0e5e('0x39')){var _0x4842c5={};_0x4842c5[_0x3f7067[_0x0e5e('0x3a')]]={'$like':'%'+_0x5e3a60[_0x0e5e('0x2a')][_0x0e5e('0x36')]+'%'};return _0x4842c5;}})});}_0x471834=_['merge']({},_0x471834,_0x5e3a60[_0x0e5e('0x3b')]);var _0x1e8127={'where':_0x471834[_0x0e5e('0x34')]};return db['MailSubstatus']['count'](_0x1e8127)[_0x0e5e('0x20')](function(_0x194e0b){_0x563870[_0x0e5e('0x1b')]=_0x194e0b;if(_0x5e3a60['query'][_0x0e5e('0x3c')]){_0x471834[_0x0e5e('0x3d')]=[{'all':!![]}];}return db[_0x0e5e('0x3e')][_0x0e5e('0x3f')](_0x471834);})[_0x0e5e('0x20')](function(_0x5d25f6){_0x563870[_0x0e5e('0x40')]=_0x5d25f6;return _0x563870;})[_0x0e5e('0x20')](respondWithFilteredResult(_0x1ceb31,_0x471834))[_0x0e5e('0x41')](handleError(_0x1ceb31,null));};exports[_0x0e5e('0x42')]=function(_0xb0953f,_0x293df2){var _0x587d27={'raw':!![],'where':{'id':_0xb0953f[_0x0e5e('0x43')]['id']}},_0xc73250={};_0xc73250['model']=_[_0x0e5e('0x29')](db[_0x0e5e('0x3e')]['rawAttributes']);_0xc73250[_0x0e5e('0x2a')]=_[_0x0e5e('0x29')](_0xb0953f['query']);_0xc73250[_0x0e5e('0x2b')]=_['intersection'](_0xc73250[_0x0e5e('0x28')],_0xc73250[_0x0e5e('0x2a')]);_0x587d27[_0x0e5e('0x2d')]=_[_0x0e5e('0x2c')](_0xc73250[_0x0e5e('0x28')],qs[_0x0e5e('0x2e')](_0xb0953f[_0x0e5e('0x2a')][_0x0e5e('0x2e')]));_0x587d27[_0x0e5e('0x2d')]=_0x587d27[_0x0e5e('0x2d')][_0x0e5e('0x44')]?_0x587d27['attributes']:_0xc73250[_0x0e5e('0x28')];if(_0xb0953f['query']['includeAll']){_0x587d27[_0x0e5e('0x3d')]=[{'all':!![]}];}_0x587d27=_[_0x0e5e('0x45')]({},_0x587d27,_0xb0953f[_0x0e5e('0x3b')]);return db[_0x0e5e('0x3e')][_0x0e5e('0x46')](_0x587d27)[_0x0e5e('0x20')](handleEntityNotFound(_0x293df2,null))[_0x0e5e('0x20')](respondWithResult(_0x293df2,null))['catch'](handleError(_0x293df2,null));};exports[_0x0e5e('0x47')]=function(_0xf6c59,_0x4271e9){return db[_0x0e5e('0x3e')]['create'](_0xf6c59[_0x0e5e('0x48')],{})[_0x0e5e('0x20')](respondWithResult(_0x4271e9,0xc9))[_0x0e5e('0x41')](handleError(_0x4271e9,null));};exports[_0x0e5e('0x49')]=function(_0x5bace4,_0x552e21){if(_0x5bace4['body']['id']){delete _0x5bace4[_0x0e5e('0x48')]['id'];}return db['MailSubstatus'][_0x0e5e('0x46')]({'where':{'id':_0x5bace4[_0x0e5e('0x43')]['id']}})['then'](handleEntityNotFound(_0x552e21,null))[_0x0e5e('0x20')](saveUpdates(_0x5bace4[_0x0e5e('0x48')],null))[_0x0e5e('0x20')](respondWithResult(_0x552e21,null))[_0x0e5e('0x41')](handleError(_0x552e21,null));};exports[_0x0e5e('0x21')]=function(_0x2eb6d9,_0x13098a){return db[_0x0e5e('0x3e')][_0x0e5e('0x46')]({'where':{'id':_0x2eb6d9['params']['id']}})['then'](handleEntityNotFound(_0x13098a,null))[_0x0e5e('0x20')](removeEntity(_0x13098a,null))[_0x0e5e('0x41')](handleError(_0x13098a,null));};exports[_0x0e5e('0x4a')]=function(_0x11ca64,_0x50274b){return db[_0x0e5e('0x3e')][_0x0e5e('0x4a')]()['then'](respondWithResult(_0x50274b,null))[_0x0e5e('0x41')](handleError(_0x50274b,null));}; \ No newline at end of file +var _0x5a9e=['json','offset','limit','set','Content-Range','reject','save','destroy','then','end','error','stack','name','send','index','MailSubstatus','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','options','count','include','findAll','rows','catch','params','includeAll','create','update','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x388169,_0x32241b){var _0x27ae4a=function(_0xad17a1){while(--_0xad17a1){_0x388169['push'](_0x388169['shift']());}};_0x27ae4a(++_0x32241b);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x5a9e[_0x49052b];return _0x48c045;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe5a9('0x0'));var rimraf=require(_0xe5a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe5a9('0x2'));var moment=require(_0xe5a9('0x3'));var BPromise=require(_0xe5a9('0x4'));var Mustache=require(_0xe5a9('0x5'));var util=require(_0xe5a9('0x6'));var path=require('path');var sox=require(_0xe5a9('0x7'));var csv=require('to-csv');var ejs=require(_0xe5a9('0x8'));var fs=require('fs');var _=require(_0xe5a9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe5a9('0xa'));var deskjs=require(_0xe5a9('0xb'));var toCsv=require(_0xe5a9('0xc'));var querystring=require(_0xe5a9('0xd'));var Papa=require(_0xe5a9('0xe'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0xe5a9('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0xe5a9('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xe5a9('0x11'));var db=require(_0xe5a9('0x12'))['db'];function respondWithStatusCode(_0x40e8c1,_0x1c4dda){_0x1c4dda=_0x1c4dda||0xcc;return function(_0x2e36e6){if(_0x2e36e6){return _0x40e8c1[_0xe5a9('0x13')](_0x1c4dda);}return _0x40e8c1[_0xe5a9('0x14')](_0x1c4dda)['end']();};}function respondWithResult(_0x6b00bd,_0xc38407){_0xc38407=_0xc38407||0xc8;return function(_0x1e5577){if(_0x1e5577){return _0x6b00bd[_0xe5a9('0x14')](_0xc38407)[_0xe5a9('0x15')](_0x1e5577);}};}function respondWithFilteredResult(_0x3f0f69,_0x32a98d){return function(_0x56a2ba){if(_0x56a2ba){var _0x3aac0b=_0x56a2ba['count'],_0x3fe6f0=_0x32a98d[_0xe5a9('0x16')],_0x1e313e=_0x32a98d[_0xe5a9('0x16')]+_0x32a98d[_0xe5a9('0x17')],_0x59dd4e;if(_0x1e313e>=_0x3aac0b){_0x1e313e=_0x3aac0b;_0x59dd4e=0xc8;}else{_0x59dd4e=0xce;}_0x3f0f69[_0xe5a9('0x14')](_0x59dd4e);return _0x3f0f69[_0xe5a9('0x18')](_0xe5a9('0x19'),_0x3fe6f0+'-'+_0x1e313e+'/'+_0x3aac0b)['json'](_0x56a2ba);}return null;};}function patchUpdates(_0x2ca0f3){return function(_0x4bff6e){try{jsonpatch['apply'](_0x4bff6e,_0x2ca0f3,!![]);}catch(_0x9e77e0){return BPromise[_0xe5a9('0x1a')](_0x9e77e0);}return _0x4bff6e[_0xe5a9('0x1b')]();};}function saveUpdates(_0x1142d2,_0x2fc629){return function(_0x17479d){if(_0x17479d){return _0x17479d['update'](_0x1142d2)['then'](function(_0x3c417b){return _0x3c417b;});}return null;};}function removeEntity(_0x1b412f,_0x37947b){return function(_0x374879){if(_0x374879){return _0x374879[_0xe5a9('0x1c')]()[_0xe5a9('0x1d')](function(){_0x1b412f['status'](0xcc)[_0xe5a9('0x1e')]();});}};}function handleEntityNotFound(_0xdc93eb,_0x5de2dc){return function(_0x1c15d3){if(!_0x1c15d3){_0xdc93eb[_0xe5a9('0x13')](0x194);}return _0x1c15d3;};}function handleError(_0x562331,_0x40108c){_0x40108c=_0x40108c||0x1f4;return function(_0x527c12){logger[_0xe5a9('0x1f')](_0x527c12[_0xe5a9('0x20')]);if(_0x527c12[_0xe5a9('0x21')]){delete _0x527c12[_0xe5a9('0x21')];}_0x562331['status'](_0x40108c)[_0xe5a9('0x22')](_0x527c12);};}exports[_0xe5a9('0x23')]=function(_0x20e1a1,_0x127ca0){var _0x3dd3da={},_0x3ba459={},_0x25355f={'count':0x0,'rows':[]};var _0xfe8914=db[_0xe5a9('0x24')]['rawAttributes'];_0x3ba459[_0xe5a9('0x25')]=_[_0xe5a9('0x26')](_0xfe8914);_0x3ba459['query']=_[_0xe5a9('0x26')](_0x20e1a1['query']);_0x3ba459[_0xe5a9('0x27')]=_[_0xe5a9('0x28')](_0x3ba459[_0xe5a9('0x25')],_0x3ba459[_0xe5a9('0x29')]);_0x3dd3da[_0xe5a9('0x2a')]=_[_0xe5a9('0x28')](_0x3ba459[_0xe5a9('0x25')],qs[_0xe5a9('0x2b')](_0x20e1a1[_0xe5a9('0x29')][_0xe5a9('0x2b')]));_0x3dd3da['attributes']=_0x3dd3da[_0xe5a9('0x2a')][_0xe5a9('0x2c')]?_0x3dd3da[_0xe5a9('0x2a')]:_0x3ba459[_0xe5a9('0x25')];if(!_0x20e1a1[_0xe5a9('0x29')][_0xe5a9('0x2d')]('nolimit')){_0x3dd3da[_0xe5a9('0x17')]=qs['limit'](_0x20e1a1[_0xe5a9('0x29')][_0xe5a9('0x17')]);_0x3dd3da[_0xe5a9('0x16')]=qs[_0xe5a9('0x16')](_0x20e1a1[_0xe5a9('0x29')][_0xe5a9('0x16')]);}_0x3dd3da[_0xe5a9('0x2e')]=qs['sort'](_0x20e1a1[_0xe5a9('0x29')][_0xe5a9('0x2f')]);_0x3dd3da[_0xe5a9('0x30')]=qs[_0xe5a9('0x27')](_[_0xe5a9('0x31')](_0x20e1a1[_0xe5a9('0x29')],_0x3ba459['filters']));if(_0x20e1a1[_0xe5a9('0x29')][_0xe5a9('0x32')]){_0x3dd3da[_0xe5a9('0x30')]=_['merge'](_0x3dd3da[_0xe5a9('0x30')],{'$or':_[_0xe5a9('0x33')](_0xfe8914,function(_0x2e814f){if(_0x2e814f[_0xe5a9('0x34')][_0xe5a9('0x35')]!==_0xe5a9('0x36')){var _0x1b0662={};_0x1b0662[_0x2e814f[_0xe5a9('0x37')]]={'$like':'%'+_0x20e1a1[_0xe5a9('0x29')][_0xe5a9('0x32')]+'%'};return _0x1b0662;}})});}_0x3dd3da=_[_0xe5a9('0x38')]({},_0x3dd3da,_0x20e1a1[_0xe5a9('0x39')]);var _0x2d6263={'where':_0x3dd3da['where']};return db['MailSubstatus'][_0xe5a9('0x3a')](_0x2d6263)[_0xe5a9('0x1d')](function(_0x1d6af7){_0x25355f[_0xe5a9('0x3a')]=_0x1d6af7;if(_0x20e1a1[_0xe5a9('0x29')]['includeAll']){_0x3dd3da[_0xe5a9('0x3b')]=[{'all':!![]}];}return db['MailSubstatus'][_0xe5a9('0x3c')](_0x3dd3da);})[_0xe5a9('0x1d')](function(_0x248c4c){_0x25355f[_0xe5a9('0x3d')]=_0x248c4c;return _0x25355f;})[_0xe5a9('0x1d')](respondWithFilteredResult(_0x127ca0,_0x3dd3da))[_0xe5a9('0x3e')](handleError(_0x127ca0,null));};exports['show']=function(_0x30357b,_0x193ddb){var _0x5d49ed={'raw':!![],'where':{'id':_0x30357b[_0xe5a9('0x3f')]['id']}},_0x24b0ce={};_0x24b0ce[_0xe5a9('0x25')]=_[_0xe5a9('0x26')](db['MailSubstatus']['rawAttributes']);_0x24b0ce[_0xe5a9('0x29')]=_[_0xe5a9('0x26')](_0x30357b[_0xe5a9('0x29')]);_0x24b0ce[_0xe5a9('0x27')]=_['intersection'](_0x24b0ce[_0xe5a9('0x25')],_0x24b0ce[_0xe5a9('0x29')]);_0x5d49ed['attributes']=_[_0xe5a9('0x28')](_0x24b0ce[_0xe5a9('0x25')],qs[_0xe5a9('0x2b')](_0x30357b[_0xe5a9('0x29')][_0xe5a9('0x2b')]));_0x5d49ed[_0xe5a9('0x2a')]=_0x5d49ed['attributes'][_0xe5a9('0x2c')]?_0x5d49ed[_0xe5a9('0x2a')]:_0x24b0ce[_0xe5a9('0x25')];if(_0x30357b[_0xe5a9('0x29')][_0xe5a9('0x40')]){_0x5d49ed[_0xe5a9('0x3b')]=[{'all':!![]}];}_0x5d49ed=_[_0xe5a9('0x38')]({},_0x5d49ed,_0x30357b[_0xe5a9('0x39')]);return db[_0xe5a9('0x24')]['find'](_0x5d49ed)[_0xe5a9('0x1d')](handleEntityNotFound(_0x193ddb,null))[_0xe5a9('0x1d')](respondWithResult(_0x193ddb,null))['catch'](handleError(_0x193ddb,null));};exports[_0xe5a9('0x41')]=function(_0x30ff85,_0x14f585){return db['MailSubstatus'][_0xe5a9('0x41')](_0x30ff85['body'],{})[_0xe5a9('0x1d')](respondWithResult(_0x14f585,0xc9))[_0xe5a9('0x3e')](handleError(_0x14f585,null));};exports[_0xe5a9('0x42')]=function(_0x377e16,_0x4df251){if(_0x377e16[_0xe5a9('0x43')]['id']){delete _0x377e16[_0xe5a9('0x43')]['id'];}return db[_0xe5a9('0x24')][_0xe5a9('0x44')]({'where':{'id':_0x377e16[_0xe5a9('0x3f')]['id']}})[_0xe5a9('0x1d')](handleEntityNotFound(_0x4df251,null))[_0xe5a9('0x1d')](saveUpdates(_0x377e16[_0xe5a9('0x43')],null))[_0xe5a9('0x1d')](respondWithResult(_0x4df251,null))[_0xe5a9('0x3e')](handleError(_0x4df251,null));};exports[_0xe5a9('0x1c')]=function(_0x3637a3,_0x2b9a03){return db[_0xe5a9('0x24')][_0xe5a9('0x44')]({'where':{'id':_0x3637a3[_0xe5a9('0x3f')]['id']}})[_0xe5a9('0x1d')](handleEntityNotFound(_0x2b9a03,null))[_0xe5a9('0x1d')](removeEntity(_0x2b9a03,null))[_0xe5a9('0x3e')](handleError(_0x2b9a03,null));};exports[_0xe5a9('0x45')]=function(_0x4213eb,_0x26b8c4){return db[_0xe5a9('0x24')][_0xe5a9('0x45')]()[_0xe5a9('0x1d')](respondWithResult(_0x26b8c4,null))[_0xe5a9('0x3e')](handleError(_0x26b8c4,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 81acca4..37f236d 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 _0x3301=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./mailSubstatus.attributes','define'];(function(_0x5382fe,_0x9b02a){var _0x2c0146=function(_0x9c63f8){while(--_0x9c63f8){_0x5382fe['push'](_0x5382fe['shift']());}};_0x2c0146(++_0x9b02a);}(_0x3301,0x1d4));var _0x1330=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x3301[_0x29c261];return _0x1a9335;};'use strict';var _=require(_0x1330('0x0'));var util=require(_0x1330('0x1'));var logger=require(_0x1330('0x2'))(_0x1330('0x3'));var moment=require(_0x1330('0x4'));var BPromise=require(_0x1330('0x5'));var rp=require(_0x1330('0x6'));var attributes=require(_0x1330('0x7'));module['exports']=function(_0x5a109a,_0x5c3f72){return _0x5a109a[_0x1330('0x8')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe265=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./mailSubstatus.attributes','exports','MailSubstatus'];(function(_0x38c160,_0x1318fa){var _0x780b56=function(_0x51c44e){while(--_0x51c44e){_0x38c160['push'](_0x38c160['shift']());}};_0x780b56(++_0x1318fa);}(_0xe265,0x6e));var _0x5e26=function(_0x4b939a,_0x2aa0c1){_0x4b939a=_0x4b939a-0x0;var _0x5773f4=_0xe265[_0x4b939a];return _0x5773f4;};'use strict';var _=require(_0x5e26('0x0'));var util=require(_0x5e26('0x1'));var logger=require(_0x5e26('0x2'))(_0x5e26('0x3'));var moment=require(_0x5e26('0x4'));var BPromise=require(_0x5e26('0x5'));var rp=require(_0x5e26('0x6'));var attributes=require(_0x5e26('0x7'));module[_0x5e26('0x8')]=function(_0x457d3a,_0x1c5d84){return _0x457d3a['define'](_0x5e26('0x9'),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 8937f45..9f81b97 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 _0xa8db=['util','moment','bluebird','ioredis','../../config/utils','../../config/environment','client','http','request','then','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x4f288e,_0x31286a){var _0x5087db=function(_0x1cbb9f){while(--_0x1cbb9f){_0x4f288e['push'](_0x4f288e['shift']());}};_0x5087db(++_0x31286a);}(_0xa8db,0x149));var _0xba8d=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0xa8db[_0x547add];return _0x2ed1f3;};'use strict';var _=require(_0xba8d('0x0'));var util=require(_0xba8d('0x1'));var moment=require(_0xba8d('0x2'));var BPromise=require(_0xba8d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba8d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xba8d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xba8d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xba8d('0x7')][_0xba8d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x377c68,_0x465b97,_0x3204de){return new BPromise(function(_0x4a0621,_0x3baea7){return client[_0xba8d('0x9')](_0x377c68,_0x3204de)[_0xba8d('0xa')](function(_0x3183fd){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x465b97,'request\x20sent');logger[_0xba8d('0xb')](_0xba8d('0xc'),_0x465b97,_0xba8d('0xd'),JSON[_0xba8d('0xe')](_0x3183fd));if(_0x3183fd['error']){if(_0x3183fd[_0xba8d('0xf')][_0xba8d('0x10')]===0x1f4){logger[_0xba8d('0xf')](_0xba8d('0x11'),_0x465b97,_0x3183fd['error'][_0xba8d('0x12')]);return _0x3baea7(_0x3183fd[_0xba8d('0xf')][_0xba8d('0x12')]);}logger[_0xba8d('0xf')](_0xba8d('0x11'),_0x465b97,_0x3183fd['error'][_0xba8d('0x12')]);return _0x4a0621(_0x3183fd['error'][_0xba8d('0x12')]);}else{logger[_0xba8d('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x465b97,_0xba8d('0xd'));_0x4a0621(_0x3183fd[_0xba8d('0x14')]['message']);}})[_0xba8d('0x15')](function(_0x3947f5){logger['error'](_0xba8d('0x11'),_0x465b97,_0x3947f5);_0x3baea7(_0x3947f5);});});} \ No newline at end of file +var _0x5b5d=['stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x4ca402,_0x316def){var _0x5926af=function(_0x3a58ea){while(--_0x3a58ea){_0x4ca402['push'](_0x4ca402['shift']());}};_0x5926af(++_0x316def);}(_0x5b5d,0x1a7));var _0xd5b5=function(_0x11066c,_0x3a12ae){_0x11066c=_0x11066c-0x0;var _0x4d3ab9=_0x5b5d[_0x11066c];return _0x4d3ab9;};'use strict';var _=require(_0xd5b5('0x0'));var util=require(_0xd5b5('0x1'));var moment=require('moment');var BPromise=require(_0xd5b5('0x2'));var rs=require(_0xd5b5('0x3'));var fs=require('fs');var Redis=require(_0xd5b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5b5('0x5'));var logger=require('../../config/logger')(_0xd5b5('0x6'));var config=require('../../config/environment');var jayson=require(_0xd5b5('0x7'));var client=jayson['client'][_0xd5b5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x259672,_0x18772d,_0x48b451){return new BPromise(function(_0xb8bfa,_0x2d3c18){return client[_0xd5b5('0x9')](_0x259672,_0x48b451)[_0xd5b5('0xa')](function(_0x378028){logger[_0xd5b5('0xb')](_0xd5b5('0xc'),_0x18772d,'request\x20sent');logger['debug'](_0xd5b5('0xd'),_0x18772d,'request\x20sent',JSON[_0xd5b5('0xe')](_0x378028));if(_0x378028[_0xd5b5('0xf')]){if(_0x378028[_0xd5b5('0xf')]['code']===0x1f4){logger[_0xd5b5('0xf')](_0xd5b5('0xc'),_0x18772d,_0x378028[_0xd5b5('0xf')][_0xd5b5('0x10')]);return _0x2d3c18(_0x378028[_0xd5b5('0xf')]['message']);}logger[_0xd5b5('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x18772d,_0x378028[_0xd5b5('0xf')][_0xd5b5('0x10')]);return _0xb8bfa(_0x378028[_0xd5b5('0xf')][_0xd5b5('0x10')]);}else{logger[_0xd5b5('0xb')](_0xd5b5('0xc'),_0x18772d,'request\x20sent');_0xb8bfa(_0x378028[_0xd5b5('0x11')][_0xd5b5('0x10')]);}})[_0xd5b5('0x12')](function(_0x18814d){logger['error'](_0xd5b5('0xc'),_0x18772d,_0x18814d);_0x2d3c18(_0x18814d);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 015ed46..28389bf 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 _0xcf98=['describe','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express','Router','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x11160d,_0x413adc){var _0x21520a=function(_0x272f3c){while(--_0x272f3c){_0x11160d['push'](_0x11160d['shift']());}};_0x21520a(++_0x413adc);}(_0xcf98,0x8d));var _0x8cf9=function(_0xbc2f6e,_0x57ddcf){_0xbc2f6e=_0xbc2f6e-0x0;var _0x15c66a=_0xcf98[_0xbc2f6e];return _0x15c66a;};'use strict';var multer=require('multer');var util=require(_0x8cf9('0x0'));var path=require(_0x8cf9('0x1'));var timeout=require(_0x8cf9('0x2'));var express=require(_0x8cf9('0x3'));var router=express[_0x8cf9('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8cf9('0x5'));var controller=require(_0x8cf9('0x6'));router[_0x8cf9('0x7')]('/',auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x9')]);router[_0x8cf9('0x7')](_0x8cf9('0xa'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0xb')]);router[_0x8cf9('0x7')](_0x8cf9('0xc'),auth['isAuthenticated'](),controller[_0x8cf9('0xd')]);router[_0x8cf9('0xe')]('/',auth['isAuthenticated'](),controller[_0x8cf9('0xf')]);router['put'](_0x8cf9('0xc'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x10')]);router[_0x8cf9('0x11')](_0x8cf9('0xc'),auth[_0x8cf9('0x8')](),controller[_0x8cf9('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1115=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','util','path'];(function(_0x2378ef,_0x1b182e){var _0x9dc6fb=function(_0x4ce9e0){while(--_0x4ce9e0){_0x2378ef['push'](_0x2378ef['shift']());}};_0x9dc6fb(++_0x1b182e);}(_0x1115,0x1b6));var _0x5111=function(_0x693cc0,_0xff873f){_0x693cc0=_0x693cc0-0x0;var _0xbf8ea=_0x1115[_0x693cc0];return _0xbf8ea;};'use strict';var multer=require('multer');var util=require(_0x5111('0x0'));var path=require(_0x5111('0x1'));var timeout=require(_0x5111('0x2'));var express=require(_0x5111('0x3'));var router=express[_0x5111('0x4')]();var auth=require(_0x5111('0x5'));var interaction=require(_0x5111('0x6'));var config=require(_0x5111('0x7'));var controller=require(_0x5111('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5111('0x9')]);router[_0x5111('0xa')]('/describe',auth[_0x5111('0xb')](),controller[_0x5111('0xc')]);router['get'](_0x5111('0xd'),auth['isAuthenticated'](),controller[_0x5111('0xe')]);router[_0x5111('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5111('0x10')]('/:id',auth[_0x5111('0xb')](),controller['update']);router[_0x5111('0x11')](_0x5111('0xd'),auth[_0x5111('0xb')](),controller[_0x5111('0x12')]);module[_0x5111('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c0f42a6..42a3240 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 _0x1118=['moment','STRING','ENUM','account','DATE','NOW'];(function(_0x55e93c,_0x401292){var _0x26811b=function(_0x5c9cbe){while(--_0x5c9cbe){_0x55e93c['push'](_0x55e93c['shift']());}};_0x26811b(++_0x401292);}(_0x1118,0x9c));var _0x8111=function(_0x3d8810,_0x4127d2){_0x3d8810=_0x3d8810-0x0;var _0x2cb012=_0x1118[_0x3d8810];return _0x2cb012;};'use strict';var moment=require(_0x8111('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x8111('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8111('0x2')](_0x8111('0x3'),'agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x8111('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x8111('0x5')]}}; \ No newline at end of file +var _0x6295=['account','queue','DATE','NOW','exports'];(function(_0x3dd012,_0x5e96ca){var _0x101667=function(_0x1b43bb){while(--_0x1b43bb){_0x3dd012['push'](_0x3dd012['shift']());}};_0x101667(++_0x5e96ca);}(_0x6295,0x1a3));var _0x5629=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6295[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x5629('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5629('0x1'),'agent',_0x5629('0x2')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x5629('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x5629('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 8af6e7e..cd89981 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 _0x9ffd=['sendStatus','stack','name','send','index','MailTransferReport','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','key','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../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'];(function(_0x2af053,_0x4f6d28){var _0x4b4001=function(_0x9200c1){while(--_0x9200c1){_0x2af053['push'](_0x2af053['shift']());}};_0x4b4001(++_0x4f6d28);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x9ba0ca,_0x599099){_0x9ba0ca=_0x9ba0ca-0x0;var _0x23c256=_0x9ffd[_0x9ba0ca];return _0x23c256;};'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 authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=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(){_0x588151[_0xd9ff('0x17')](0xcc)[_0xd9ff('0x18')]();});}};}function handleEntityNotFound(_0x291f52,_0x9f074e){return function(_0x278b66){if(!_0x278b66){_0x291f52[_0xd9ff('0x25')](0x194);}return _0x278b66;};}function handleError(_0x4b058a,_0x4fada1){_0x4fada1=_0x4fada1||0x1f4;return function(_0x1136e9){logger['error'](_0x1136e9[_0xd9ff('0x26')]);if(_0x1136e9['name']){delete _0x1136e9[_0xd9ff('0x27')];}_0x4b058a['status'](_0x4fada1)[_0xd9ff('0x28')](_0x1136e9);};}exports[_0xd9ff('0x29')]=function(_0x2138b4,_0x2970e8){var _0x5d685e={},_0x11a17b={},_0xe11f88={'count':0x0,'rows':[]};var _0x1c78c4=db[_0xd9ff('0x2a')]['rawAttributes'];_0x11a17b[_0xd9ff('0x2b')]=_[_0xd9ff('0x2c')](_0x1c78c4);_0x11a17b[_0xd9ff('0x2d')]=_[_0xd9ff('0x2c')](_0x2138b4[_0xd9ff('0x2d')]);_0x11a17b[_0xd9ff('0x2e')]=_[_0xd9ff('0x2f')](_0x11a17b[_0xd9ff('0x2b')],_0x11a17b[_0xd9ff('0x2d')]);_0x5d685e['attributes']=_[_0xd9ff('0x2f')](_0x11a17b['model'],qs[_0xd9ff('0x30')](_0x2138b4[_0xd9ff('0x2d')][_0xd9ff('0x30')]));_0x5d685e['attributes']=_0x5d685e[_0xd9ff('0x31')][_0xd9ff('0x32')]?_0x5d685e[_0xd9ff('0x31')]:_0x11a17b[_0xd9ff('0x2b')];if(!_0x2138b4['query'][_0xd9ff('0x33')]('nolimit')){_0x5d685e[_0xd9ff('0x1c')]=qs[_0xd9ff('0x1c')](_0x2138b4[_0xd9ff('0x2d')][_0xd9ff('0x1c')]);_0x5d685e[_0xd9ff('0x1b')]=qs[_0xd9ff('0x1b')](_0x2138b4[_0xd9ff('0x2d')][_0xd9ff('0x1b')]);}_0x5d685e[_0xd9ff('0x34')]=qs[_0xd9ff('0x35')](_0x2138b4[_0xd9ff('0x2d')][_0xd9ff('0x35')]);_0x5d685e[_0xd9ff('0x36')]=qs[_0xd9ff('0x2e')](_['pick'](_0x2138b4[_0xd9ff('0x2d')],_0x11a17b[_0xd9ff('0x2e')]));if(_0x2138b4[_0xd9ff('0x2d')]['filter']){_0x5d685e[_0xd9ff('0x36')]=_['merge'](_0x5d685e[_0xd9ff('0x36')],{'$or':_['map'](_0x1c78c4,function(_0x20a021){if(_0x20a021['type'][_0xd9ff('0x37')]!==_0xd9ff('0x38')){var _0x11566b={};_0x11566b[_0x20a021['field']]={'$like':'%'+_0x2138b4['query']['filter']+'%'};return _0x11566b;}})});}_0x5d685e=_[_0xd9ff('0x39')]({},_0x5d685e,_0x2138b4[_0xd9ff('0x3a')]);var _0x405c3b={'where':_0x5d685e[_0xd9ff('0x36')]};return db[_0xd9ff('0x2a')][_0xd9ff('0x1a')](_0x405c3b)['then'](function(_0x4c00c2){_0xe11f88['count']=_0x4c00c2;if(_0x2138b4[_0xd9ff('0x2d')][_0xd9ff('0x3b')]){_0x5d685e[_0xd9ff('0x3c')]=[{'all':!![]}];}return db[_0xd9ff('0x2a')]['findAll'](_0x5d685e);})[_0xd9ff('0x23')](function(_0x5b8e17){_0xe11f88[_0xd9ff('0x3d')]=_0x5b8e17;return _0xe11f88;})[_0xd9ff('0x23')](respondWithFilteredResult(_0x2970e8,_0x5d685e))[_0xd9ff('0x3e')](handleError(_0x2970e8,null));};exports[_0xd9ff('0x3f')]=function(_0x59fc07,_0x1e34da){var _0x2d4d97={'raw':!![],'where':{'id':_0x59fc07[_0xd9ff('0x40')]['id']}},_0x4961a7={};_0x4961a7[_0xd9ff('0x2b')]=_[_0xd9ff('0x2c')](db[_0xd9ff('0x2a')][_0xd9ff('0x41')]);_0x4961a7[_0xd9ff('0x2d')]=_['keys'](_0x59fc07[_0xd9ff('0x2d')]);_0x4961a7[_0xd9ff('0x2e')]=_[_0xd9ff('0x2f')](_0x4961a7[_0xd9ff('0x2b')],_0x4961a7[_0xd9ff('0x2d')]);_0x2d4d97['attributes']=_[_0xd9ff('0x2f')](_0x4961a7[_0xd9ff('0x2b')],qs[_0xd9ff('0x30')](_0x59fc07['query']['fields']));_0x2d4d97[_0xd9ff('0x31')]=_0x2d4d97[_0xd9ff('0x31')][_0xd9ff('0x32')]?_0x2d4d97[_0xd9ff('0x31')]:_0x4961a7[_0xd9ff('0x2b')];if(_0x59fc07[_0xd9ff('0x2d')]['includeAll']){_0x2d4d97[_0xd9ff('0x3c')]=[{'all':!![]}];}_0x2d4d97=_[_0xd9ff('0x39')]({},_0x2d4d97,_0x59fc07['options']);return db[_0xd9ff('0x2a')][_0xd9ff('0x42')](_0x2d4d97)[_0xd9ff('0x23')](handleEntityNotFound(_0x1e34da,null))[_0xd9ff('0x23')](respondWithResult(_0x1e34da,null))[_0xd9ff('0x3e')](handleError(_0x1e34da,null));};exports['create']=function(_0x5cf34e,_0x5718ab){return db[_0xd9ff('0x2a')]['create'](_0x5cf34e[_0xd9ff('0x43')],{})[_0xd9ff('0x23')](respondWithResult(_0x5718ab,0xc9))[_0xd9ff('0x3e')](handleError(_0x5718ab,null));};exports['update']=function(_0x396736,_0x153f09){if(_0x396736['body']['id']){delete _0x396736[_0xd9ff('0x43')]['id'];}return db[_0xd9ff('0x2a')][_0xd9ff('0x42')]({'where':{'id':_0x396736[_0xd9ff('0x40')]['id']}})['then'](handleEntityNotFound(_0x153f09,null))[_0xd9ff('0x23')](saveUpdates(_0x396736['body'],null))[_0xd9ff('0x23')](respondWithResult(_0x153f09,null))['catch'](handleError(_0x153f09,null));};exports[_0xd9ff('0x24')]=function(_0x3d91e6,_0x2bf37a){return db[_0xd9ff('0x2a')][_0xd9ff('0x42')]({'where':{'id':_0x3d91e6['params']['id']}})[_0xd9ff('0x23')](handleEntityNotFound(_0x2bf37a,null))[_0xd9ff('0x23')](removeEntity(_0x2bf37a,null))[_0xd9ff('0x3e')](handleError(_0x2bf37a,null));};exports[_0xd9ff('0x44')]=function(_0x5c3e11,_0x537282){return db['MailTransferReport'][_0xd9ff('0x44')]()[_0xd9ff('0x23')](respondWithResult(_0x537282,null))[_0xd9ff('0x3e')](handleError(_0x537282,null));}; \ No newline at end of file +var _0xe706=['catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','MailTransferReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0xe706,0xa3));var _0x6e70=function(_0x5d08e4,_0x1c1ba6){_0x5d08e4=_0x5d08e4-0x0;var _0x1c7d40=_0xe706[_0x5d08e4];return _0x1c7d40;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var authService=require(_0x6e70('0x14'));var hardwareService=require(_0x6e70('0x15'));var Redis=require(_0x6e70('0x16'));var qs=require(_0x6e70('0x17'));var logger=require(_0x6e70('0x18'))(_0x6e70('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6e70('0x1a'))['db'];function respondWithStatusCode(_0x15a1a5,_0x18cf27){_0x18cf27=_0x18cf27||0xcc;return function(_0x27dd9b){if(_0x27dd9b){return _0x15a1a5[_0x6e70('0x1b')](_0x18cf27);}return _0x15a1a5[_0x6e70('0x1c')](_0x18cf27)[_0x6e70('0x1d')]();};}function respondWithResult(_0x181005,_0x5dfbaa){_0x5dfbaa=_0x5dfbaa||0xc8;return function(_0x52737e){if(_0x52737e){return _0x181005['status'](_0x5dfbaa)[_0x6e70('0x1e')](_0x52737e);}};}function respondWithFilteredResult(_0x5a37a6,_0x53aed0){return function(_0x304716){if(_0x304716){var _0x22c50c=_0x304716[_0x6e70('0x1f')],_0x5d9263=_0x53aed0[_0x6e70('0x20')],_0x24f3ac=_0x53aed0['offset']+_0x53aed0['limit'],_0x5c3fe7;if(_0x24f3ac>=_0x22c50c){_0x24f3ac=_0x22c50c;_0x5c3fe7=0xc8;}else{_0x5c3fe7=0xce;}_0x5a37a6[_0x6e70('0x1c')](_0x5c3fe7);return _0x5a37a6['set'](_0x6e70('0x21'),_0x5d9263+'-'+_0x24f3ac+'/'+_0x22c50c)[_0x6e70('0x1e')](_0x304716);}return null;};}function patchUpdates(_0x53acdc){return function(_0x497d61){try{jsonpatch[_0x6e70('0x22')](_0x497d61,_0x53acdc,!![]);}catch(_0x208e21){return BPromise[_0x6e70('0x23')](_0x208e21);}return _0x497d61[_0x6e70('0x24')]();};}function saveUpdates(_0x3af484,_0xcdf9f2){return function(_0x1b2453){if(_0x1b2453){return _0x1b2453[_0x6e70('0x25')](_0x3af484)[_0x6e70('0x26')](function(_0xb29a2a){return _0xb29a2a;});}return null;};}function removeEntity(_0x4a0cfe,_0x228350){return function(_0x344b65){if(_0x344b65){return _0x344b65[_0x6e70('0x27')]()['then'](function(){_0x4a0cfe[_0x6e70('0x1c')](0xcc)[_0x6e70('0x1d')]();});}};}function handleEntityNotFound(_0x3337a6,_0x50da2c){return function(_0x10fc91){if(!_0x10fc91){_0x3337a6['sendStatus'](0x194);}return _0x10fc91;};}function handleError(_0x50aec2,_0x4e97c7){_0x4e97c7=_0x4e97c7||0x1f4;return function(_0x41e352){logger[_0x6e70('0x28')](_0x41e352['stack']);if(_0x41e352[_0x6e70('0x29')]){delete _0x41e352[_0x6e70('0x29')];}_0x50aec2['status'](_0x4e97c7)[_0x6e70('0x2a')](_0x41e352);};}exports[_0x6e70('0x2b')]=function(_0x2bb231,_0x4a67ac){var _0x54a5fe={},_0x2c4d37={},_0x3af17f={'count':0x0,'rows':[]};var _0x83c836=db[_0x6e70('0x2c')][_0x6e70('0x2d')];_0x2c4d37['model']=_[_0x6e70('0x2e')](_0x83c836);_0x2c4d37[_0x6e70('0x2f')]=_[_0x6e70('0x2e')](_0x2bb231[_0x6e70('0x2f')]);_0x2c4d37[_0x6e70('0x30')]=_[_0x6e70('0x31')](_0x2c4d37[_0x6e70('0x32')],_0x2c4d37[_0x6e70('0x2f')]);_0x54a5fe[_0x6e70('0x33')]=_[_0x6e70('0x31')](_0x2c4d37['model'],qs[_0x6e70('0x34')](_0x2bb231['query'][_0x6e70('0x34')]));_0x54a5fe['attributes']=_0x54a5fe[_0x6e70('0x33')][_0x6e70('0x35')]?_0x54a5fe[_0x6e70('0x33')]:_0x2c4d37['model'];if(!_0x2bb231[_0x6e70('0x2f')][_0x6e70('0x36')]('nolimit')){_0x54a5fe[_0x6e70('0x37')]=qs[_0x6e70('0x37')](_0x2bb231['query'][_0x6e70('0x37')]);_0x54a5fe[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x2bb231[_0x6e70('0x2f')][_0x6e70('0x20')]);}_0x54a5fe[_0x6e70('0x38')]=qs[_0x6e70('0x39')](_0x2bb231[_0x6e70('0x2f')][_0x6e70('0x39')]);_0x54a5fe[_0x6e70('0x3a')]=qs['filters'](_[_0x6e70('0x3b')](_0x2bb231['query'],_0x2c4d37[_0x6e70('0x30')]));if(_0x2bb231[_0x6e70('0x2f')][_0x6e70('0x3c')]){_0x54a5fe[_0x6e70('0x3a')]=_[_0x6e70('0x3d')](_0x54a5fe[_0x6e70('0x3a')],{'$or':_[_0x6e70('0x3e')](_0x83c836,function(_0xdd0bee){if(_0xdd0bee[_0x6e70('0x3f')][_0x6e70('0x40')]!==_0x6e70('0x41')){var _0x23d5e2={};_0x23d5e2[_0xdd0bee[_0x6e70('0x42')]]={'$like':'%'+_0x2bb231['query']['filter']+'%'};return _0x23d5e2;}})});}_0x54a5fe=_['merge']({},_0x54a5fe,_0x2bb231[_0x6e70('0x43')]);var _0x3841a0={'where':_0x54a5fe[_0x6e70('0x3a')]};return db[_0x6e70('0x2c')][_0x6e70('0x1f')](_0x3841a0)[_0x6e70('0x26')](function(_0x572a71){_0x3af17f[_0x6e70('0x1f')]=_0x572a71;if(_0x2bb231[_0x6e70('0x2f')][_0x6e70('0x44')]){_0x54a5fe[_0x6e70('0x45')]=[{'all':!![]}];}return db[_0x6e70('0x2c')][_0x6e70('0x46')](_0x54a5fe);})[_0x6e70('0x26')](function(_0x16fc7d){_0x3af17f['rows']=_0x16fc7d;return _0x3af17f;})[_0x6e70('0x26')](respondWithFilteredResult(_0x4a67ac,_0x54a5fe))[_0x6e70('0x47')](handleError(_0x4a67ac,null));};exports[_0x6e70('0x48')]=function(_0x31cad2,_0x201da9){var _0x1de947={'raw':!![],'where':{'id':_0x31cad2['params']['id']}},_0x21b0e7={};_0x21b0e7['model']=_['keys'](db[_0x6e70('0x2c')][_0x6e70('0x2d')]);_0x21b0e7[_0x6e70('0x2f')]=_[_0x6e70('0x2e')](_0x31cad2[_0x6e70('0x2f')]);_0x21b0e7['filters']=_[_0x6e70('0x31')](_0x21b0e7[_0x6e70('0x32')],_0x21b0e7[_0x6e70('0x2f')]);_0x1de947['attributes']=_['intersection'](_0x21b0e7['model'],qs[_0x6e70('0x34')](_0x31cad2['query'][_0x6e70('0x34')]));_0x1de947[_0x6e70('0x33')]=_0x1de947[_0x6e70('0x33')][_0x6e70('0x35')]?_0x1de947['attributes']:_0x21b0e7[_0x6e70('0x32')];if(_0x31cad2['query'][_0x6e70('0x44')]){_0x1de947[_0x6e70('0x45')]=[{'all':!![]}];}_0x1de947=_[_0x6e70('0x3d')]({},_0x1de947,_0x31cad2[_0x6e70('0x43')]);return db['MailTransferReport'][_0x6e70('0x49')](_0x1de947)[_0x6e70('0x26')](handleEntityNotFound(_0x201da9,null))[_0x6e70('0x26')](respondWithResult(_0x201da9,null))[_0x6e70('0x47')](handleError(_0x201da9,null));};exports[_0x6e70('0x4a')]=function(_0x3fcb2d,_0x3d9c5){return db['MailTransferReport'][_0x6e70('0x4a')](_0x3fcb2d[_0x6e70('0x4b')],{})[_0x6e70('0x26')](respondWithResult(_0x3d9c5,0xc9))[_0x6e70('0x47')](handleError(_0x3d9c5,null));};exports[_0x6e70('0x25')]=function(_0x172e8a,_0x1e2095){if(_0x172e8a['body']['id']){delete _0x172e8a[_0x6e70('0x4b')]['id'];}return db['MailTransferReport'][_0x6e70('0x49')]({'where':{'id':_0x172e8a[_0x6e70('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1e2095,null))['then'](saveUpdates(_0x172e8a[_0x6e70('0x4b')],null))[_0x6e70('0x26')](respondWithResult(_0x1e2095,null))[_0x6e70('0x47')](handleError(_0x1e2095,null));};exports['destroy']=function(_0x4af9b1,_0x238ebb){return db[_0x6e70('0x2c')][_0x6e70('0x49')]({'where':{'id':_0x4af9b1[_0x6e70('0x4c')]['id']}})[_0x6e70('0x26')](handleEntityNotFound(_0x238ebb,null))[_0x6e70('0x26')](removeEntity(_0x238ebb,null))['catch'](handleError(_0x238ebb,null));};exports[_0x6e70('0x4d')]=function(_0x3aa1a6,_0x219f4){return db[_0x6e70('0x2c')][_0x6e70('0x4d')]()['then'](respondWithResult(_0x219f4,null))['catch'](handleError(_0x219f4,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index ba25887..a2a56c5 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 _0xa847=['uniqueid','lodash','util','../../config/logger','bluebird','request-promise','./mailTransferReport.attributes','exports','define','report_mail_transfer'];(function(_0x344ce7,_0x5c0803){var _0x39cc5f=function(_0xae8182){while(--_0xae8182){_0x344ce7['push'](_0x344ce7['shift']());}};_0x39cc5f(++_0x5c0803);}(_0xa847,0x191));var _0x7a84=function(_0x3ad753,_0x3355e1){_0x3ad753=_0x3ad753-0x0;var _0x5be96f=_0xa847[_0x3ad753];return _0x5be96f;};'use strict';var _=require(_0x7a84('0x0'));var util=require(_0x7a84('0x1'));var logger=require(_0x7a84('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7a84('0x3'));var rp=require(_0x7a84('0x4'));var attributes=require(_0x7a84('0x5'));module[_0x7a84('0x6')]=function(_0x35d89f,_0x208ced){return _0x35d89f[_0x7a84('0x7')]('MailTransferReport',attributes,{'tableName':_0x7a84('0x8'),'paranoid':![],'indexes':[{'name':_0x7a84('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x68df=['request-promise','./mailTransferReport.attributes','exports','MailTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x400e0f,_0x3af578){var _0x24ca6f=function(_0x2c909f){while(--_0x2c909f){_0x400e0f['push'](_0x400e0f['shift']());}};_0x24ca6f(++_0x3af578);}(_0x68df,0xcd));var _0xf68d=function(_0xe38e0c,_0x5884ea){_0xe38e0c=_0xe38e0c-0x0;var _0x2c6987=_0x68df[_0xe38e0c];return _0x2c6987;};'use strict';var _=require(_0xf68d('0x0'));var util=require(_0xf68d('0x1'));var logger=require(_0xf68d('0x2'))('api');var moment=require(_0xf68d('0x3'));var BPromise=require(_0xf68d('0x4'));var rp=require(_0xf68d('0x5'));var attributes=require(_0xf68d('0x6'));module[_0xf68d('0x7')]=function(_0x24a70e,_0x2ce506){return _0x24a70e['define'](_0xf68d('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xf68d('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 980f180..e07aabf 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 _0x3b58=['client','request','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x3b58,0xe4));var _0x83b5=function(_0x3ce998,_0x14e7c7){_0x3ce998=_0x3ce998-0x0;var _0x3a66fc=_0x3b58[_0x3ce998];return _0x3a66fc;};'use strict';var _=require('lodash');var util=require(_0x83b5('0x0'));var moment=require('moment');var BPromise=require(_0x83b5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83b5('0x2'))['db'];var utils=require(_0x83b5('0x3'));var logger=require(_0x83b5('0x4'))(_0x83b5('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x83b5('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ec6b7,_0x487c57,_0x557e7d){return new BPromise(function(_0x147f8c,_0x123f82){return client[_0x83b5('0x7')](_0x5ec6b7,_0x557e7d)[_0x83b5('0x8')](function(_0x1d2ea6){logger[_0x83b5('0x9')]('MailTransferReport,\x20%s,\x20%s',_0x487c57,_0x83b5('0xa'));logger['debug'](_0x83b5('0xb'),_0x487c57,_0x83b5('0xa'),JSON[_0x83b5('0xc')](_0x1d2ea6));if(_0x1d2ea6[_0x83b5('0xd')]){if(_0x1d2ea6[_0x83b5('0xd')]['code']===0x1f4){logger[_0x83b5('0xd')](_0x83b5('0xe'),_0x487c57,_0x1d2ea6[_0x83b5('0xd')][_0x83b5('0xf')]);return _0x123f82(_0x1d2ea6['error'][_0x83b5('0xf')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x487c57,_0x1d2ea6['error'][_0x83b5('0xf')]);return _0x147f8c(_0x1d2ea6[_0x83b5('0xd')][_0x83b5('0xf')]);}else{logger[_0x83b5('0x9')](_0x83b5('0xe'),_0x487c57,_0x83b5('0xa'));_0x147f8c(_0x1d2ea6[_0x83b5('0x10')][_0x83b5('0xf')]);}})[_0x83b5('0x11')](function(_0x401a7c){logger[_0x83b5('0xd')](_0x83b5('0xe'),_0x487c57,_0x401a7c);_0x123f82(_0x401a7c);});});} \ No newline at end of file +var _0x36eb=['error','code','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e9a27,_0x571c93){var _0x2eb5ab=function(_0x5859c8){while(--_0x5859c8){_0x1e9a27['push'](_0x1e9a27['shift']());}};_0x2eb5ab(++_0x571c93);}(_0x36eb,0x1e3));var _0xb36e=function(_0x47b1be,_0x3a04cb){_0x47b1be=_0x47b1be-0x0;var _0x457c9e=_0x36eb[_0x47b1be];return _0x457c9e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xb36e('0x1'));var fs=require('fs');var Redis=require(_0xb36e('0x2'));var db=require(_0xb36e('0x3'))['db'];var utils=require(_0xb36e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb36e('0x5'));var jayson=require(_0xb36e('0x6'));var client=jayson[_0xb36e('0x7')][_0xb36e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ea211,_0xfb95fc,_0x821598){return new BPromise(function(_0x12981b,_0x1ee55c){return client[_0xb36e('0x9')](_0x1ea211,_0x821598)[_0xb36e('0xa')](function(_0x409e6a){logger[_0xb36e('0xb')](_0xb36e('0xc'),_0xfb95fc,_0xb36e('0xd'));logger[_0xb36e('0xe')](_0xb36e('0xf'),_0xfb95fc,_0xb36e('0xd'),JSON[_0xb36e('0x10')](_0x409e6a));if(_0x409e6a[_0xb36e('0x11')]){if(_0x409e6a[_0xb36e('0x11')][_0xb36e('0x12')]===0x1f4){logger['error'](_0xb36e('0xc'),_0xfb95fc,_0x409e6a[_0xb36e('0x11')][_0xb36e('0x13')]);return _0x1ee55c(_0x409e6a[_0xb36e('0x11')]['message']);}logger[_0xb36e('0x11')]('MailTransferReport,\x20%s,\x20%s',_0xfb95fc,_0x409e6a[_0xb36e('0x11')]['message']);return _0x12981b(_0x409e6a[_0xb36e('0x11')][_0xb36e('0x13')]);}else{logger[_0xb36e('0xb')](_0xb36e('0xc'),_0xfb95fc,_0xb36e('0xd'));_0x12981b(_0x409e6a['result'][_0xb36e('0x13')]);}})['catch'](function(_0x5c2145){logger[_0xb36e('0x11')](_0xb36e('0xc'),_0xfb95fc,_0x5c2145);_0x1ee55c(_0x5c2145);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 7a006fa..6fd732e 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 _0x30da=['get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./memberReport.controller','index'];(function(_0x4480d2,_0x5cfe58){var _0x29ba4b=function(_0xc5b8f9){while(--_0xc5b8f9){_0x4480d2['push'](_0x4480d2['shift']());}};_0x29ba4b(++_0x5cfe58);}(_0x30da,0xf3));var _0xa30d=function(_0x9e2c25,_0x17ae3b){_0x9e2c25=_0x9e2c25-0x0;var _0x2e20f5=_0x30da[_0x9e2c25];return _0x2e20f5;};'use strict';var multer=require(_0xa30d('0x0'));var util=require(_0xa30d('0x1'));var path=require(_0xa30d('0x2'));var timeout=require(_0xa30d('0x3'));var express=require(_0xa30d('0x4'));var router=express['Router']();var auth=require(_0xa30d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa30d('0x6'));var controller=require(_0xa30d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa30d('0x8')]);router[_0xa30d('0x9')](_0xa30d('0xa'),auth[_0xa30d('0xb')](),controller[_0xa30d('0xc')]);router[_0xa30d('0x9')]('/:id',auth[_0xa30d('0xb')](),controller[_0xa30d('0xd')]);router[_0xa30d('0xe')]('/',auth[_0xa30d('0xb')](),controller[_0xa30d('0xf')]);router[_0xa30d('0x10')](_0xa30d('0x11'),auth[_0xa30d('0xb')](),controller[_0xa30d('0x12')]);router[_0xa30d('0x13')](_0xa30d('0x11'),auth['isAuthenticated'](),controller[_0xa30d('0x14')]);module['exports']=router; \ No newline at end of file +var _0xdb06=['post','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5125a7,_0x3f27ea){var _0x224ffb=function(_0x9a91ad){while(--_0x9a91ad){_0x5125a7['push'](_0x5125a7['shift']());}};_0x224ffb(++_0x3f27ea);}(_0xdb06,0x192));var _0x6db0=function(_0x22fd9e,_0x3f4ca5){_0x22fd9e=_0x22fd9e-0x0;var _0x283e53=_0xdb06[_0x22fd9e];return _0x283e53;};'use strict';var multer=require(_0x6db0('0x0'));var util=require(_0x6db0('0x1'));var path=require('path');var timeout=require(_0x6db0('0x2'));var express=require(_0x6db0('0x3'));var router=express[_0x6db0('0x4')]();var auth=require(_0x6db0('0x5'));var interaction=require(_0x6db0('0x6'));var config=require(_0x6db0('0x7'));var controller=require(_0x6db0('0x8'));router['get']('/',auth[_0x6db0('0x9')](),controller[_0x6db0('0xa')]);router['get'](_0x6db0('0xb'),auth[_0x6db0('0x9')](),controller[_0x6db0('0xc')]);router['get'](_0x6db0('0xd'),auth[_0x6db0('0x9')](),controller['show']);router[_0x6db0('0xe')]('/',auth[_0x6db0('0x9')](),controller['create']);router['put'](_0x6db0('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6db0('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ed099e9..abfe4c6 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 _0xf576=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING'];(function(_0x1d951c,_0x4a025a){var _0x5ceb57=function(_0x56a942){while(--_0x56a942){_0x1d951c['push'](_0x1d951c['shift']());}};_0x5ceb57(++_0x4a025a);}(_0xf576,0x11d));var _0x6f57=function(_0x48b887,_0x2b767c){_0x48b887=_0x48b887-0x0;var _0x29a1f5=_0xf576[_0x48b887];return _0x29a1f5;};'use strict';var Sequelize=require(_0x6f57('0x0'));var moment=require(_0x6f57('0x1'));module[_0x6f57('0x2')]={'channel':{'type':Sequelize[_0x6f57('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x6f57('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x6f57('0x4'),'comment':_0x6f57('0x5')},'duration':{'type':Sequelize[_0x6f57('0x6')]},'enterAt':{'type':Sequelize[_0x6f57('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x1c63f6){var _0x432f67=moment(_0x1c63f6);var _0x437c20=moment(this['getDataValue']('enterAt'));var _0x472f04=_0x432f67[_0x6f57('0x8')](_0x437c20,_0x6f57('0x9'));this[_0x6f57('0xa')](_0x6f57('0xb'),_0x1c63f6);this['setDataValue'](_0x6f57('0xc'),_0x472f04||null);}},'data1':{'type':Sequelize[_0x6f57('0x3')],'comment':_0x6f57('0xd')},'data2':{'type':Sequelize[_0x6f57('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x6f57('0x3')],'comment':_0x6f57('0xe')},'data4':{'type':Sequelize[_0x6f57('0x3')],'comment':_0x6f57('0xf')},'data5':{'type':Sequelize[_0x6f57('0x3')],'comment':_0x6f57('0x10')},'role':{'type':Sequelize[_0x6f57('0x3')]},'internal':{'type':Sequelize[_0x6f57('0x6')]},'uniqueid':{'type':Sequelize[_0x6f57('0x3')]}}; \ No newline at end of file +var _0x1005=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','exitAt'];(function(_0x3ae0b1,_0x4add74){var _0x5a43d0=function(_0x36ea7b){while(--_0x36ea7b){_0x3ae0b1['push'](_0x3ae0b1['shift']());}};_0x5a43d0(++_0x4add74);}(_0x1005,0xc5));var _0x5100=function(_0x43ca6d,_0x931e7f){_0x43ca6d=_0x43ca6d-0x0;var _0x20536c=_0x1005[_0x43ca6d];return _0x20536c;};'use strict';var Sequelize=require(_0x5100('0x0'));var moment=require('moment');module[_0x5100('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5100('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x5100('0x3')},'duration':{'type':Sequelize[_0x5100('0x4')]},'enterAt':{'type':Sequelize[_0x5100('0x5')]},'exitAt':{'type':Sequelize[_0x5100('0x5')],'set':function(_0x4215e4){var _0x547b8d=moment(_0x4215e4);var _0x3dee19=moment(this[_0x5100('0x6')](_0x5100('0x7')));var _0x4d45aa=_0x547b8d[_0x5100('0x8')](_0x3dee19,'seconds');this[_0x5100('0x9')](_0x5100('0xa'),_0x4215e4);this[_0x5100('0x9')](_0x5100('0xb'),_0x4d45aa||null);}},'data1':{'type':Sequelize[_0x5100('0x2')],'comment':_0x5100('0xc')},'data2':{'type':Sequelize[_0x5100('0x2')],'comment':_0x5100('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0x5100('0xe')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x5100('0x2')],'comment':_0x5100('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x5100('0x4')]},'uniqueid':{'type':Sequelize[_0x5100('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 54e277d..46fd0eb 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 _0x4ffa=['nolimit','limit','order','sort','where','pick','filter','merge','type','key','field','options','MemberReport','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','reject','update','then','error','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x2dbf99,_0x372802){var _0xb123=function(_0x96cdab){while(--_0x96cdab){_0x2dbf99['push'](_0x2dbf99['shift']());}};_0xb123(++_0x372802);}(_0x4ffa,0x124));var _0xa4ff=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4ffa[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa4ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4ff('0x1'));var rp=require(_0xa4ff('0x2'));var moment=require(_0xa4ff('0x3'));var BPromise=require(_0xa4ff('0x4'));var Mustache=require(_0xa4ff('0x5'));var util=require(_0xa4ff('0x6'));var path=require('path');var sox=require(_0xa4ff('0x7'));var csv=require(_0xa4ff('0x8'));var ejs=require(_0xa4ff('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa4ff('0xa'));var crypto=require('crypto');var jsforce=require(_0xa4ff('0xb'));var deskjs=require(_0xa4ff('0xc'));var toCsv=require(_0xa4ff('0x8'));var querystring=require('querystring');var Papa=require(_0xa4ff('0xd'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0xa4ff('0xe'));var logger=require(_0xa4ff('0xf'))(_0xa4ff('0x10'));var utils=require(_0xa4ff('0x11'));var config=require('../../config/environment');var db=require(_0xa4ff('0x12'))['db'];function respondWithStatusCode(_0x3e748c,_0x5c8240){_0x5c8240=_0x5c8240||0xcc;return function(_0x3d34d9){if(_0x3d34d9){return _0x3e748c[_0xa4ff('0x13')](_0x5c8240);}return _0x3e748c['status'](_0x5c8240)[_0xa4ff('0x14')]();};}function respondWithResult(_0x45208e,_0x4f6b71){_0x4f6b71=_0x4f6b71||0xc8;return function(_0x168bdc){if(_0x168bdc){return _0x45208e['status'](_0x4f6b71)[_0xa4ff('0x15')](_0x168bdc);}};}function respondWithFilteredResult(_0x5a3869,_0x140819){return function(_0x13d333){if(_0x13d333){var _0x56e4e9=_0x13d333[_0xa4ff('0x16')],_0x308f00=_0x140819[_0xa4ff('0x17')],_0x199d1e=_0x140819[_0xa4ff('0x17')]+_0x140819['limit'],_0x27f8d8;if(_0x199d1e>=_0x56e4e9){_0x199d1e=_0x56e4e9;_0x27f8d8=0xc8;}else{_0x27f8d8=0xce;}_0x5a3869[_0xa4ff('0x18')](_0x27f8d8);return _0x5a3869[_0xa4ff('0x19')](_0xa4ff('0x1a'),_0x308f00+'-'+_0x199d1e+'/'+_0x56e4e9)['json'](_0x13d333);}return null;};}function patchUpdates(_0x377665){return function(_0x502531){try{jsonpatch['apply'](_0x502531,_0x377665,!![]);}catch(_0x54872f){return BPromise[_0xa4ff('0x1b')](_0x54872f);}return _0x502531['save']();};}function saveUpdates(_0x50ba3b,_0x31d0da){return function(_0x20ba0d){if(_0x20ba0d){return _0x20ba0d[_0xa4ff('0x1c')](_0x50ba3b)[_0xa4ff('0x1d')](function(_0x2402dc){return _0x2402dc;});}return null;};}function removeEntity(_0x569a3f,_0x77c629){return function(_0x48a0d5){if(_0x48a0d5){return _0x48a0d5['destroy']()[_0xa4ff('0x1d')](function(){_0x569a3f['status'](0xcc)[_0xa4ff('0x14')]();});}};}function handleEntityNotFound(_0x58a25d,_0x3012fa){return function(_0x4a678e){if(!_0x4a678e){_0x58a25d['sendStatus'](0x194);}return _0x4a678e;};}function handleError(_0x132633,_0xde9489){_0xde9489=_0xde9489||0x1f4;return function(_0x24dce3){logger[_0xa4ff('0x1e')](_0x24dce3['stack']);if(_0x24dce3[_0xa4ff('0x1f')]){delete _0x24dce3[_0xa4ff('0x1f')];}_0x132633[_0xa4ff('0x18')](_0xde9489)[_0xa4ff('0x20')](_0x24dce3);};}exports[_0xa4ff('0x21')]=function(_0x20e611,_0x289525){var _0x5420a2={},_0x1799dc={},_0x241b82={'count':0x0,'rows':[]};var _0x5aed16=db['MemberReport'][_0xa4ff('0x22')];_0x1799dc[_0xa4ff('0x23')]=_[_0xa4ff('0x24')](_0x5aed16);_0x1799dc['query']=_[_0xa4ff('0x24')](_0x20e611[_0xa4ff('0x25')]);_0x1799dc[_0xa4ff('0x26')]=_[_0xa4ff('0x27')](_0x1799dc['model'],_0x1799dc[_0xa4ff('0x25')]);_0x5420a2[_0xa4ff('0x28')]=_['intersection'](_0x1799dc[_0xa4ff('0x23')],qs[_0xa4ff('0x29')](_0x20e611[_0xa4ff('0x25')][_0xa4ff('0x29')]));_0x5420a2[_0xa4ff('0x28')]=_0x5420a2[_0xa4ff('0x28')][_0xa4ff('0x2a')]?_0x5420a2[_0xa4ff('0x28')]:_0x1799dc[_0xa4ff('0x23')];if(!_0x20e611[_0xa4ff('0x25')]['hasOwnProperty'](_0xa4ff('0x2b'))){_0x5420a2[_0xa4ff('0x2c')]=qs['limit'](_0x20e611[_0xa4ff('0x25')][_0xa4ff('0x2c')]);_0x5420a2[_0xa4ff('0x17')]=qs[_0xa4ff('0x17')](_0x20e611['query'][_0xa4ff('0x17')]);}_0x5420a2[_0xa4ff('0x2d')]=qs[_0xa4ff('0x2e')](_0x20e611['query']['sort']);_0x5420a2[_0xa4ff('0x2f')]=qs['filters'](_[_0xa4ff('0x30')](_0x20e611[_0xa4ff('0x25')],_0x1799dc[_0xa4ff('0x26')]));if(_0x20e611['query'][_0xa4ff('0x31')]){_0x5420a2[_0xa4ff('0x2f')]=_[_0xa4ff('0x32')](_0x5420a2[_0xa4ff('0x2f')],{'$or':_['map'](_0x5aed16,function(_0x929509){if(_0x929509[_0xa4ff('0x33')][_0xa4ff('0x34')]!=='VIRTUAL'){var _0x343f26={};_0x343f26[_0x929509[_0xa4ff('0x35')]]={'$like':'%'+_0x20e611['query'][_0xa4ff('0x31')]+'%'};return _0x343f26;}})});}_0x5420a2=_['merge']({},_0x5420a2,_0x20e611[_0xa4ff('0x36')]);var _0x56985c={'where':_0x5420a2['where']};return db[_0xa4ff('0x37')][_0xa4ff('0x16')](_0x56985c)[_0xa4ff('0x1d')](function(_0x4a5f68){_0x241b82[_0xa4ff('0x16')]=_0x4a5f68;if(_0x20e611[_0xa4ff('0x25')]['includeAll']){_0x5420a2[_0xa4ff('0x38')]=[{'all':!![]}];}return db['MemberReport'][_0xa4ff('0x39')](_0x5420a2);})[_0xa4ff('0x1d')](function(_0x346d81){_0x241b82[_0xa4ff('0x3a')]=_0x346d81;return _0x241b82;})[_0xa4ff('0x1d')](respondWithFilteredResult(_0x289525,_0x5420a2))[_0xa4ff('0x3b')](handleError(_0x289525,null));};exports[_0xa4ff('0x3c')]=function(_0x17a080,_0x6148bb){var _0x90ad73={'raw':!![],'where':{'id':_0x17a080[_0xa4ff('0x3d')]['id']}},_0x6d5732={};_0x6d5732[_0xa4ff('0x23')]=_[_0xa4ff('0x24')](db[_0xa4ff('0x37')][_0xa4ff('0x22')]);_0x6d5732['query']=_[_0xa4ff('0x24')](_0x17a080['query']);_0x6d5732[_0xa4ff('0x26')]=_[_0xa4ff('0x27')](_0x6d5732['model'],_0x6d5732[_0xa4ff('0x25')]);_0x90ad73[_0xa4ff('0x28')]=_[_0xa4ff('0x27')](_0x6d5732['model'],qs[_0xa4ff('0x29')](_0x17a080[_0xa4ff('0x25')][_0xa4ff('0x29')]));_0x90ad73[_0xa4ff('0x28')]=_0x90ad73['attributes'][_0xa4ff('0x2a')]?_0x90ad73[_0xa4ff('0x28')]:_0x6d5732['model'];if(_0x17a080['query'][_0xa4ff('0x3e')]){_0x90ad73[_0xa4ff('0x38')]=[{'all':!![]}];}_0x90ad73=_['merge']({},_0x90ad73,_0x17a080['options']);return db[_0xa4ff('0x37')]['find'](_0x90ad73)[_0xa4ff('0x1d')](handleEntityNotFound(_0x6148bb,null))[_0xa4ff('0x1d')](respondWithResult(_0x6148bb,null))[_0xa4ff('0x3b')](handleError(_0x6148bb,null));};exports[_0xa4ff('0x3f')]=function(_0x59655a,_0x41cb33){return db[_0xa4ff('0x37')][_0xa4ff('0x3f')](_0x59655a['body'],{})[_0xa4ff('0x1d')](respondWithResult(_0x41cb33,0xc9))[_0xa4ff('0x3b')](handleError(_0x41cb33,null));};exports['update']=function(_0x3f84f5,_0x3eed2b){if(_0x3f84f5['body']['id']){delete _0x3f84f5[_0xa4ff('0x40')]['id'];}return db[_0xa4ff('0x37')][_0xa4ff('0x41')]({'where':{'id':_0x3f84f5[_0xa4ff('0x3d')]['id']}})[_0xa4ff('0x1d')](handleEntityNotFound(_0x3eed2b,null))[_0xa4ff('0x1d')](saveUpdates(_0x3f84f5['body'],null))[_0xa4ff('0x1d')](respondWithResult(_0x3eed2b,null))[_0xa4ff('0x3b')](handleError(_0x3eed2b,null));};exports[_0xa4ff('0x42')]=function(_0x19d346,_0x5bb625){return db['MemberReport']['find']({'where':{'id':_0x19d346[_0xa4ff('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5bb625,null))['then'](removeEntity(_0x5bb625,null))[_0xa4ff('0x3b')](handleError(_0x5bb625,null));};exports['describe']=function(_0x285560,_0x36ffac){return db[_0xa4ff('0x37')]['describe']()[_0xa4ff('0x1d')](respondWithResult(_0x36ffac,null))['catch'](handleError(_0x36ffac,null));}; \ No newline at end of file +var _0x7887=['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','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','map','type','key','field','options','MemberReport','includeAll','include','rows','catch','show','params','merge','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x393bb8,_0x3dbc0e){var _0x5bcf1c=function(_0x1cee43){while(--_0x1cee43){_0x393bb8['push'](_0x393bb8['shift']());}};_0x5bcf1c(++_0x3dbc0e);}(_0x7887,0x1b3));var _0x7788=function(_0x1b6b80,_0x4ae79e){_0x1b6b80=_0x1b6b80-0x0;var _0xe224e9=_0x7887[_0x1b6b80];return _0xe224e9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7788('0x0'));var zipdir=require(_0x7788('0x1'));var jsonpatch=require(_0x7788('0x2'));var rp=require(_0x7788('0x3'));var moment=require(_0x7788('0x4'));var BPromise=require(_0x7788('0x5'));var Mustache=require('mustache');var util=require(_0x7788('0x6'));var path=require('path');var sox=require(_0x7788('0x7'));var csv=require(_0x7788('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7788('0x9'));var squel=require(_0x7788('0xa'));var crypto=require(_0x7788('0xb'));var jsforce=require(_0x7788('0xc'));var deskjs=require(_0x7788('0xd'));var toCsv=require(_0x7788('0x8'));var querystring=require(_0x7788('0xe'));var Papa=require(_0x7788('0xf'));var authService=require(_0x7788('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x7788('0x11'));var logger=require(_0x7788('0x12'))(_0x7788('0x13'));var utils=require(_0x7788('0x14'));var config=require(_0x7788('0x15'));var db=require(_0x7788('0x16'))['db'];function respondWithStatusCode(_0x55b5dc,_0x1bf1d4){_0x1bf1d4=_0x1bf1d4||0xcc;return function(_0x24a692){if(_0x24a692){return _0x55b5dc[_0x7788('0x17')](_0x1bf1d4);}return _0x55b5dc[_0x7788('0x18')](_0x1bf1d4)[_0x7788('0x19')]();};}function respondWithResult(_0xa56ac8,_0x30daae){_0x30daae=_0x30daae||0xc8;return function(_0x4f5e04){if(_0x4f5e04){return _0xa56ac8[_0x7788('0x18')](_0x30daae)[_0x7788('0x1a')](_0x4f5e04);}};}function respondWithFilteredResult(_0x18b7aa,_0x4e06cb){return function(_0x32fea6){if(_0x32fea6){var _0x4b8dc6=_0x32fea6[_0x7788('0x1b')],_0x317a73=_0x4e06cb[_0x7788('0x1c')],_0x2d5425=_0x4e06cb[_0x7788('0x1c')]+_0x4e06cb[_0x7788('0x1d')],_0x2f2c3f;if(_0x2d5425>=_0x4b8dc6){_0x2d5425=_0x4b8dc6;_0x2f2c3f=0xc8;}else{_0x2f2c3f=0xce;}_0x18b7aa[_0x7788('0x18')](_0x2f2c3f);return _0x18b7aa[_0x7788('0x1e')](_0x7788('0x1f'),_0x317a73+'-'+_0x2d5425+'/'+_0x4b8dc6)[_0x7788('0x1a')](_0x32fea6);}return null;};}function patchUpdates(_0x259436){return function(_0x558052){try{jsonpatch[_0x7788('0x20')](_0x558052,_0x259436,!![]);}catch(_0x4abd68){return BPromise[_0x7788('0x21')](_0x4abd68);}return _0x558052[_0x7788('0x22')]();};}function saveUpdates(_0x2ec029,_0x5ce940){return function(_0x5ea7cc){if(_0x5ea7cc){return _0x5ea7cc[_0x7788('0x23')](_0x2ec029)[_0x7788('0x24')](function(_0x3f3040){return _0x3f3040;});}return null;};}function removeEntity(_0xeed0e9,_0x4c1299){return function(_0x246ba2){if(_0x246ba2){return _0x246ba2[_0x7788('0x25')]()[_0x7788('0x24')](function(){_0xeed0e9[_0x7788('0x18')](0xcc)[_0x7788('0x19')]();});}};}function handleEntityNotFound(_0x1f7076,_0x2443d2){return function(_0x34a046){if(!_0x34a046){_0x1f7076['sendStatus'](0x194);}return _0x34a046;};}function handleError(_0xef21af,_0x4b5a95){_0x4b5a95=_0x4b5a95||0x1f4;return function(_0x4840d6){logger[_0x7788('0x26')](_0x4840d6[_0x7788('0x27')]);if(_0x4840d6['name']){delete _0x4840d6[_0x7788('0x28')];}_0xef21af[_0x7788('0x18')](_0x4b5a95)[_0x7788('0x29')](_0x4840d6);};}exports[_0x7788('0x2a')]=function(_0x4aa7d1,_0x3ec697){var _0x6d97cf={},_0x5eb7e5={},_0x2a4557={'count':0x0,'rows':[]};var _0x9d80f5=db['MemberReport'][_0x7788('0x2b')];_0x5eb7e5[_0x7788('0x2c')]=_[_0x7788('0x2d')](_0x9d80f5);_0x5eb7e5[_0x7788('0x2e')]=_[_0x7788('0x2d')](_0x4aa7d1[_0x7788('0x2e')]);_0x5eb7e5[_0x7788('0x2f')]=_[_0x7788('0x30')](_0x5eb7e5['model'],_0x5eb7e5['query']);_0x6d97cf['attributes']=_[_0x7788('0x30')](_0x5eb7e5[_0x7788('0x2c')],qs[_0x7788('0x31')](_0x4aa7d1[_0x7788('0x2e')]['fields']));_0x6d97cf[_0x7788('0x32')]=_0x6d97cf[_0x7788('0x32')][_0x7788('0x33')]?_0x6d97cf[_0x7788('0x32')]:_0x5eb7e5[_0x7788('0x2c')];if(!_0x4aa7d1[_0x7788('0x2e')]['hasOwnProperty'](_0x7788('0x34'))){_0x6d97cf[_0x7788('0x1d')]=qs[_0x7788('0x1d')](_0x4aa7d1[_0x7788('0x2e')][_0x7788('0x1d')]);_0x6d97cf[_0x7788('0x1c')]=qs[_0x7788('0x1c')](_0x4aa7d1[_0x7788('0x2e')]['offset']);}_0x6d97cf['order']=qs['sort'](_0x4aa7d1[_0x7788('0x2e')][_0x7788('0x35')]);_0x6d97cf[_0x7788('0x36')]=qs['filters'](_[_0x7788('0x37')](_0x4aa7d1[_0x7788('0x2e')],_0x5eb7e5['filters']));if(_0x4aa7d1[_0x7788('0x2e')][_0x7788('0x38')]){_0x6d97cf['where']=_['merge'](_0x6d97cf[_0x7788('0x36')],{'$or':_[_0x7788('0x39')](_0x9d80f5,function(_0x1dcc2e){if(_0x1dcc2e[_0x7788('0x3a')][_0x7788('0x3b')]!=='VIRTUAL'){var _0x574279={};_0x574279[_0x1dcc2e[_0x7788('0x3c')]]={'$like':'%'+_0x4aa7d1['query'][_0x7788('0x38')]+'%'};return _0x574279;}})});}_0x6d97cf=_['merge']({},_0x6d97cf,_0x4aa7d1[_0x7788('0x3d')]);var _0x3d8a97={'where':_0x6d97cf[_0x7788('0x36')]};return db[_0x7788('0x3e')][_0x7788('0x1b')](_0x3d8a97)['then'](function(_0x4cf6a1){_0x2a4557[_0x7788('0x1b')]=_0x4cf6a1;if(_0x4aa7d1[_0x7788('0x2e')][_0x7788('0x3f')]){_0x6d97cf[_0x7788('0x40')]=[{'all':!![]}];}return db[_0x7788('0x3e')]['findAll'](_0x6d97cf);})[_0x7788('0x24')](function(_0x53af85){_0x2a4557[_0x7788('0x41')]=_0x53af85;return _0x2a4557;})['then'](respondWithFilteredResult(_0x3ec697,_0x6d97cf))[_0x7788('0x42')](handleError(_0x3ec697,null));};exports[_0x7788('0x43')]=function(_0x5abff2,_0x91731f){var _0x4a620c={'raw':!![],'where':{'id':_0x5abff2[_0x7788('0x44')]['id']}},_0x1f1af0={};_0x1f1af0[_0x7788('0x2c')]=_[_0x7788('0x2d')](db[_0x7788('0x3e')][_0x7788('0x2b')]);_0x1f1af0[_0x7788('0x2e')]=_[_0x7788('0x2d')](_0x5abff2[_0x7788('0x2e')]);_0x1f1af0['filters']=_[_0x7788('0x30')](_0x1f1af0[_0x7788('0x2c')],_0x1f1af0[_0x7788('0x2e')]);_0x4a620c[_0x7788('0x32')]=_[_0x7788('0x30')](_0x1f1af0[_0x7788('0x2c')],qs['fields'](_0x5abff2[_0x7788('0x2e')][_0x7788('0x31')]));_0x4a620c['attributes']=_0x4a620c[_0x7788('0x32')][_0x7788('0x33')]?_0x4a620c[_0x7788('0x32')]:_0x1f1af0[_0x7788('0x2c')];if(_0x5abff2[_0x7788('0x2e')][_0x7788('0x3f')]){_0x4a620c[_0x7788('0x40')]=[{'all':!![]}];}_0x4a620c=_[_0x7788('0x45')]({},_0x4a620c,_0x5abff2[_0x7788('0x3d')]);return db['MemberReport'][_0x7788('0x46')](_0x4a620c)[_0x7788('0x24')](handleEntityNotFound(_0x91731f,null))['then'](respondWithResult(_0x91731f,null))[_0x7788('0x42')](handleError(_0x91731f,null));};exports['create']=function(_0x261e9b,_0x967faa){return db[_0x7788('0x3e')][_0x7788('0x47')](_0x261e9b[_0x7788('0x48')],{})[_0x7788('0x24')](respondWithResult(_0x967faa,0xc9))[_0x7788('0x42')](handleError(_0x967faa,null));};exports[_0x7788('0x23')]=function(_0x3fcca9,_0x251923){if(_0x3fcca9['body']['id']){delete _0x3fcca9[_0x7788('0x48')]['id'];}return db[_0x7788('0x3e')][_0x7788('0x46')]({'where':{'id':_0x3fcca9[_0x7788('0x44')]['id']}})['then'](handleEntityNotFound(_0x251923,null))['then'](saveUpdates(_0x3fcca9[_0x7788('0x48')],null))['then'](respondWithResult(_0x251923,null))[_0x7788('0x42')](handleError(_0x251923,null));};exports[_0x7788('0x25')]=function(_0x478c23,_0x19b790){return db['MemberReport'][_0x7788('0x46')]({'where':{'id':_0x478c23[_0x7788('0x44')]['id']}})[_0x7788('0x24')](handleEntityNotFound(_0x19b790,null))[_0x7788('0x24')](removeEntity(_0x19b790,null))[_0x7788('0x42')](handleError(_0x19b790,null));};exports[_0x7788('0x49')]=function(_0x11aa3f,_0x1b4ee6){return db[_0x7788('0x3e')][_0x7788('0x49')]()['then'](respondWithResult(_0x1b4ee6,null))[_0x7788('0x42')](handleError(_0x1b4ee6,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 8107af2..2e60cd2 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 _0x6557=['membername','interface','lodash','../../config/logger','api','bluebird','request-promise','exports','membername_interface'];(function(_0x5a2348,_0x1c55e5){var _0x29ff8c=function(_0x503283){while(--_0x503283){_0x5a2348['push'](_0x5a2348['shift']());}};_0x29ff8c(++_0x1c55e5);}(_0x6557,0x6e));var _0x7655=function(_0x12b615,_0x1ffb00){_0x12b615=_0x12b615-0x0;var _0x23c53c=_0x6557[_0x12b615];return _0x23c53c;};'use strict';var _=require(_0x7655('0x0'));var util=require('util');var logger=require(_0x7655('0x1'))(_0x7655('0x2'));var moment=require('moment');var BPromise=require(_0x7655('0x3'));var rp=require(_0x7655('0x4'));var attributes=require('./memberReport.attributes');module[_0x7655('0x5')]=function(_0x334e25,_0x3b3e89){return _0x334e25['define']('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x7655('0x6'),'fields':[_0x7655('0x7'),_0x7655('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8bb=['exports','report_member','membername','interface','lodash','util','api','bluebird','request-promise'];(function(_0xd56eec,_0x29c137){var _0x5c1861=function(_0x5ec334){while(--_0x5ec334){_0xd56eec['push'](_0xd56eec['shift']());}};_0x5c1861(++_0x29c137);}(_0xa8bb,0x1ea));var _0xba8b=function(_0x151cf7,_0x44ec05){_0x151cf7=_0x151cf7-0x0;var _0x2e9b26=_0xa8bb[_0x151cf7];return _0x2e9b26;};'use strict';var _=require(_0xba8b('0x0'));var util=require(_0xba8b('0x1'));var logger=require('../../config/logger')(_0xba8b('0x2'));var moment=require('moment');var BPromise=require(_0xba8b('0x3'));var rp=require(_0xba8b('0x4'));var attributes=require('./memberReport.attributes');module[_0xba8b('0x5')]=function(_0x210564,_0x56ef8c){return _0x210564['define']('MemberReport',attributes,{'tableName':_0xba8b('0x6'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xba8b('0x7'),_0xba8b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b3ffb6a..7aa2833 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 _0x5056=['catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','CreateMemberReport','create','raw','UpdateMemberReport','update','body','lodash','util','ioredis','../../config/logger','rpc','jayson/promise','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3829b8,_0x595bd9){var _0x429881=function(_0x32803c){while(--_0x32803c){_0x3829b8['push'](_0x3829b8['shift']());}};_0x429881(++_0x595bd9);}(_0x5056,0x13a));var _0x6505=function(_0x4ccd63,_0xfe2f66){_0x4ccd63=_0x4ccd63-0x0;var _0x320f6c=_0x5056[_0x4ccd63];return _0x320f6c;};'use strict';var _=require(_0x6505('0x0'));var util=require(_0x6505('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6505('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6505('0x3'))(_0x6505('0x4'));var config=require('../../config/environment');var jayson=require(_0x6505('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x304725,_0x2648ac,_0x37771c){return new BPromise(function(_0x22835d,_0x3919b5){return client['request'](_0x304725,_0x37771c)[_0x6505('0x6')](function(_0x5e4e48){logger[_0x6505('0x7')](_0x6505('0x8'),_0x2648ac,_0x6505('0x9'));logger[_0x6505('0xa')](_0x6505('0xb'),_0x2648ac,'request\x20sent',JSON[_0x6505('0xc')](_0x5e4e48));if(_0x5e4e48[_0x6505('0xd')]){if(_0x5e4e48[_0x6505('0xd')]['code']===0x1f4){logger[_0x6505('0xd')](_0x6505('0x8'),_0x2648ac,_0x5e4e48[_0x6505('0xd')][_0x6505('0xe')]);return _0x3919b5(_0x5e4e48[_0x6505('0xd')][_0x6505('0xe')]);}logger[_0x6505('0xd')]('MemberReport,\x20%s,\x20%s',_0x2648ac,_0x5e4e48[_0x6505('0xd')][_0x6505('0xe')]);return _0x22835d(_0x5e4e48[_0x6505('0xd')][_0x6505('0xe')]);}else{logger[_0x6505('0x7')](_0x6505('0x8'),_0x2648ac,_0x6505('0x9'));_0x22835d(_0x5e4e48[_0x6505('0xf')]['message']);}})[_0x6505('0x10')](function(_0x548269){logger[_0x6505('0xd')](_0x6505('0x8'),_0x2648ac,_0x548269);_0x3919b5(_0x548269);});});}exports[_0x6505('0x11')]=function(_0x211738){var _0x8d0fe=this;return new Promise(function(_0x368c19,_0x1d5486){return db[_0x6505('0x12')][_0x6505('0x13')]({'raw':_0x211738[_0x6505('0x14')]?_0x211738['options']['raw']===undefined?!![]:![]:!![],'where':_0x211738[_0x6505('0x14')]?_0x211738[_0x6505('0x14')][_0x6505('0x15')]||null:null,'attributes':_0x211738[_0x6505('0x14')]?_0x211738[_0x6505('0x14')][_0x6505('0x16')]||null:null,'limit':_0x211738[_0x6505('0x14')]?_0x211738[_0x6505('0x14')][_0x6505('0x17')]||null:null,'include':_0x211738[_0x6505('0x14')]?_0x211738[_0x6505('0x14')][_0x6505('0x18')]?_[_0x6505('0x19')](_0x211738['options'][_0x6505('0x18')],function(_0x150b1a){return{'model':db[_0x150b1a[_0x6505('0x1a')]],'as':_0x150b1a['as'],'attributes':_0x150b1a['attributes'],'include':_0x150b1a[_0x6505('0x18')]?_['map'](_0x150b1a[_0x6505('0x18')],function(_0x3bae82){return{'model':db[_0x3bae82[_0x6505('0x1a')]],'as':_0x3bae82['as'],'attributes':_0x3bae82[_0x6505('0x16')],'include':_0x3bae82[_0x6505('0x18')]?_[_0x6505('0x19')](_0x3bae82['include'],function(_0x3c2e20){return{'model':db[_0x3c2e20[_0x6505('0x1a')]],'as':_0x3c2e20['as'],'attributes':_0x3c2e20['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x583990){logger[_0x6505('0x7')](_0x6505('0x11'),_0x211738);logger[_0x6505('0xa')](_0x6505('0x11'),_0x211738,JSON[_0x6505('0xc')](_0x583990));_0x368c19(_0x583990);})[_0x6505('0x10')](function(_0x3c378f){logger[_0x6505('0xd')](_0x6505('0x11'),_0x3c378f[_0x6505('0xe')],_0x211738);_0x1d5486(_0x8d0fe[_0x6505('0xd')](0x1f4,_0x3c378f[_0x6505('0xe')]));});});};exports[_0x6505('0x1b')]=function(_0x28d22d){var _0x24035b=this;return new Promise(function(_0xf51e0f,_0x2b81da){return db[_0x6505('0x12')][_0x6505('0x1c')](_0x28d22d['body'],{'raw':_0x28d22d[_0x6505('0x14')]?_0x28d22d[_0x6505('0x14')][_0x6505('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x470807){logger[_0x6505('0x7')](_0x6505('0x1b'),_0x28d22d);logger[_0x6505('0xa')]('CreateMemberReport',_0x28d22d,JSON['stringify'](_0x470807));_0xf51e0f(_0x470807);})['catch'](function(_0x583744){logger[_0x6505('0xd')]('CreateMemberReport',_0x583744[_0x6505('0xe')],_0x28d22d);_0x2b81da(_0x24035b['error'](0x1f4,_0x583744['message']));});});};exports[_0x6505('0x1e')]=function(_0x5dc485){var _0x296293=this;return new Promise(function(_0x562592,_0xbadf68){return db[_0x6505('0x12')][_0x6505('0x1f')](_0x5dc485[_0x6505('0x20')],{'raw':_0x5dc485[_0x6505('0x14')]?_0x5dc485[_0x6505('0x14')][_0x6505('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dc485[_0x6505('0x14')]?_0x5dc485[_0x6505('0x14')][_0x6505('0x15')]||null:null,'attributes':_0x5dc485['options']?_0x5dc485[_0x6505('0x14')][_0x6505('0x16')]||null:null,'limit':_0x5dc485[_0x6505('0x14')]?_0x5dc485[_0x6505('0x14')][_0x6505('0x17')]||null:null})[_0x6505('0x6')](function(_0x1a0a99){logger['info']('UpdateMemberReport',_0x5dc485);logger[_0x6505('0xa')](_0x6505('0x1e'),_0x5dc485,JSON[_0x6505('0xc')](_0x1a0a99));_0x562592(_0x1a0a99);})['catch'](function(_0x3473a9){logger[_0x6505('0xd')](_0x6505('0x1e'),_0x3473a9[_0x6505('0xe')],_0x5dc485);_0xbadf68(_0x296293['error'](0x1f4,_0x3473a9[_0x6505('0xe')]));});});}; \ No newline at end of file +var _0xcc8d=['body','then','debug','UpdateMemberReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','MemberReport','findAll','options','raw','where','attributes','map','model','include','GetMemberReport','CreateMemberReport','create'];(function(_0x3c918a,_0x5ef50e){var _0x480bf3=function(_0x8294df){while(--_0x8294df){_0x3c918a['push'](_0x3c918a['shift']());}};_0x480bf3(++_0x5ef50e);}(_0xcc8d,0x1e5));var _0xdcc8=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0xcc8d[_0x571a17];return _0x3ef337;};'use strict';var _=require('lodash');var util=require(_0xdcc8('0x0'));var moment=require(_0xdcc8('0x1'));var BPromise=require(_0xdcc8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcc8('0x3'));var db=require(_0xdcc8('0x4'))['db'];var utils=require(_0xdcc8('0x5'));var logger=require('../../config/logger')(_0xdcc8('0x6'));var config=require(_0xdcc8('0x7'));var jayson=require(_0xdcc8('0x8'));var client=jayson[_0xdcc8('0x9')][_0xdcc8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33405b,_0x58777b,_0x1118b0){return new BPromise(function(_0x3615fa,_0xf06ceb){return client['request'](_0x33405b,_0x1118b0)['then'](function(_0x55cc95){logger[_0xdcc8('0xb')](_0xdcc8('0xc'),_0x58777b,'request\x20sent');logger['debug'](_0xdcc8('0xd'),_0x58777b,_0xdcc8('0xe'),JSON[_0xdcc8('0xf')](_0x55cc95));if(_0x55cc95['error']){if(_0x55cc95['error'][_0xdcc8('0x10')]===0x1f4){logger[_0xdcc8('0x11')]('MemberReport,\x20%s,\x20%s',_0x58777b,_0x55cc95[_0xdcc8('0x11')][_0xdcc8('0x12')]);return _0xf06ceb(_0x55cc95[_0xdcc8('0x11')][_0xdcc8('0x12')]);}logger[_0xdcc8('0x11')](_0xdcc8('0xc'),_0x58777b,_0x55cc95[_0xdcc8('0x11')][_0xdcc8('0x12')]);return _0x3615fa(_0x55cc95[_0xdcc8('0x11')][_0xdcc8('0x12')]);}else{logger['info'](_0xdcc8('0xc'),_0x58777b,_0xdcc8('0xe'));_0x3615fa(_0x55cc95[_0xdcc8('0x13')]['message']);}})[_0xdcc8('0x14')](function(_0x4e1c05){logger[_0xdcc8('0x11')](_0xdcc8('0xc'),_0x58777b,_0x4e1c05);_0xf06ceb(_0x4e1c05);});});}exports['GetMemberReport']=function(_0x5d74ac){var _0x2152f1=this;return new Promise(function(_0xf1fe82,_0x209960){return db[_0xdcc8('0x15')][_0xdcc8('0x16')]({'raw':_0x5d74ac[_0xdcc8('0x17')]?_0x5d74ac[_0xdcc8('0x17')][_0xdcc8('0x18')]===undefined?!![]:![]:!![],'where':_0x5d74ac[_0xdcc8('0x17')]?_0x5d74ac['options'][_0xdcc8('0x19')]||null:null,'attributes':_0x5d74ac[_0xdcc8('0x17')]?_0x5d74ac[_0xdcc8('0x17')][_0xdcc8('0x1a')]||null:null,'limit':_0x5d74ac['options']?_0x5d74ac[_0xdcc8('0x17')]['limit']||null:null,'include':_0x5d74ac[_0xdcc8('0x17')]?_0x5d74ac[_0xdcc8('0x17')]['include']?_[_0xdcc8('0x1b')](_0x5d74ac[_0xdcc8('0x17')]['include'],function(_0x43996c){return{'model':db[_0x43996c[_0xdcc8('0x1c')]],'as':_0x43996c['as'],'attributes':_0x43996c['attributes'],'include':_0x43996c['include']?_[_0xdcc8('0x1b')](_0x43996c['include'],function(_0x558956){return{'model':db[_0x558956[_0xdcc8('0x1c')]],'as':_0x558956['as'],'attributes':_0x558956[_0xdcc8('0x1a')],'include':_0x558956[_0xdcc8('0x1d')]?_[_0xdcc8('0x1b')](_0x558956[_0xdcc8('0x1d')],function(_0xcfa03){return{'model':db[_0xcfa03[_0xdcc8('0x1c')]],'as':_0xcfa03['as'],'attributes':_0xcfa03[_0xdcc8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a3c4e){logger[_0xdcc8('0xb')](_0xdcc8('0x1e'),_0x5d74ac);logger['debug'](_0xdcc8('0x1e'),_0x5d74ac,JSON[_0xdcc8('0xf')](_0x5a3c4e));_0xf1fe82(_0x5a3c4e);})['catch'](function(_0x2a2231){logger[_0xdcc8('0x11')](_0xdcc8('0x1e'),_0x2a2231[_0xdcc8('0x12')],_0x5d74ac);_0x209960(_0x2152f1[_0xdcc8('0x11')](0x1f4,_0x2a2231[_0xdcc8('0x12')]));});});};exports[_0xdcc8('0x1f')]=function(_0x40bbca){var _0x16fec5=this;return new Promise(function(_0x44334f,_0x1484f4){return db['MemberReport'][_0xdcc8('0x20')](_0x40bbca[_0xdcc8('0x21')],{'raw':_0x40bbca['options']?_0x40bbca[_0xdcc8('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xdcc8('0x22')](function(_0x5b0de4){logger[_0xdcc8('0xb')](_0xdcc8('0x1f'),_0x40bbca);logger[_0xdcc8('0x23')](_0xdcc8('0x1f'),_0x40bbca,JSON[_0xdcc8('0xf')](_0x5b0de4));_0x44334f(_0x5b0de4);})[_0xdcc8('0x14')](function(_0x2c6f42){logger['error'](_0xdcc8('0x1f'),_0x2c6f42[_0xdcc8('0x12')],_0x40bbca);_0x1484f4(_0x16fec5['error'](0x1f4,_0x2c6f42[_0xdcc8('0x12')]));});});};exports[_0xdcc8('0x24')]=function(_0xa1b8da){var _0x24836f=this;return new Promise(function(_0x2901c8,_0x7ecbaf){return db[_0xdcc8('0x15')]['update'](_0xa1b8da[_0xdcc8('0x21')],{'raw':_0xa1b8da[_0xdcc8('0x17')]?_0xa1b8da['options'][_0xdcc8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa1b8da[_0xdcc8('0x17')]?_0xa1b8da[_0xdcc8('0x17')]['where']||null:null,'attributes':_0xa1b8da['options']?_0xa1b8da[_0xdcc8('0x17')][_0xdcc8('0x1a')]||null:null,'limit':_0xa1b8da[_0xdcc8('0x17')]?_0xa1b8da['options']['limit']||null:null})[_0xdcc8('0x22')](function(_0xd039ef){logger[_0xdcc8('0xb')](_0xdcc8('0x24'),_0xa1b8da);logger[_0xdcc8('0x23')](_0xdcc8('0x24'),_0xa1b8da,JSON[_0xdcc8('0xf')](_0xd039ef));_0x2901c8(_0xd039ef);})[_0xdcc8('0x14')](function(_0x3f3c7e){logger[_0xdcc8('0x11')](_0xdcc8('0x24'),_0x3f3c7e['message'],_0xa1b8da);_0x7ecbaf(_0x24836f[_0xdcc8('0x11')](0x1f4,_0x3f3c7e[_0xdcc8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 14b3392..21eccba 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 _0x6041=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','exports','multer','util','path','express'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x6041,0x1e6));var _0x1604=function(_0x5a61a5,_0x33d885){_0x5a61a5=_0x5a61a5-0x0;var _0x2e2818=_0x6041[_0x5a61a5];return _0x2e2818;};'use strict';var multer=require(_0x1604('0x0'));var util=require(_0x1604('0x1'));var path=require(_0x1604('0x2'));var timeout=require('connect-timeout');var express=require(_0x1604('0x3'));var router=express[_0x1604('0x4')]();var auth=require(_0x1604('0x5'));var interaction=require(_0x1604('0x6'));var config=require(_0x1604('0x7'));var controller=require(_0x1604('0x8'));router['get']('/',controller['index']);module[_0x1604('0x9')]=router; \ No newline at end of file +var _0x554f=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','exports','multer','util','path'];(function(_0x36d955,_0x2a6d31){var _0x1a9a6b=function(_0x3189d5){while(--_0x3189d5){_0x36d955['push'](_0x36d955['shift']());}};_0x1a9a6b(++_0x2a6d31);}(_0x554f,0x1d3));var _0xf554=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x554f[_0x36ed3c];return _0x52a2e0;};'use strict';var multer=require(_0xf554('0x0'));var util=require(_0xf554('0x1'));var path=require(_0xf554('0x2'));var timeout=require(_0xf554('0x3'));var express=require('express');var router=express[_0xf554('0x4')]();var auth=require(_0xf554('0x5'));var interaction=require(_0xf554('0x6'));var config=require(_0xf554('0x7'));var controller=require('./migration.controller');router[_0xf554('0x8')]('/',controller['index']);module[_0xf554('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 62771c5..bfef877 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 _0x81b7=['exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x81b7,0x1f2));var _0x781b=function(_0x14f30e,_0x2eff30){_0x14f30e=_0x14f30e-0x0;var _0x5c36f4=_0x81b7[_0x14f30e];return _0x5c36f4;};'use strict';var Sequelize=require('sequelize');module[_0x781b('0x0')]={'version':{'type':Sequelize[_0x781b('0x1')],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file +var _0xd9f4=['sequelize','exports','STRING'];(function(_0x1882a5,_0x9b73dc){var _0x3e8c99=function(_0x54690d){while(--_0x54690d){_0x1882a5['push'](_0x1882a5['shift']());}};_0x3e8c99(++_0x9b73dc);}(_0xd9f4,0x7b));var _0x4d9f=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xd9f4[_0x20c9b2];return _0x2c6030;};'use strict';var Sequelize=require(_0x4d9f('0x0'));module[_0x4d9f('0x1')]={'version':{'type':Sequelize[_0x4d9f('0x2')],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index db8fa9a..a982383 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 _0xfb0c=['../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply','save','update','destroy','then','stack','name','send','index','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','key','VIRTUAL','field','options','includeAll','include','Migration','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils'];(function(_0x19f1cc,_0x36b541){var _0x1f38cc=function(_0x5ef995){while(--_0x5ef995){_0x19f1cc['push'](_0x19f1cc['shift']());}};_0x1f38cc(++_0x36b541);}(_0xfb0c,0x142));var _0xcfb0=function(_0x46eb99,_0x372ac6){_0x46eb99=_0x46eb99-0x0;var _0x18352a=_0xfb0c[_0x46eb99];return _0x18352a;};'use strict';var pdf=require(_0xcfb0('0x0'));var emlformat=require(_0xcfb0('0x1'));var rimraf=require(_0xcfb0('0x2'));var zipdir=require(_0xcfb0('0x3'));var jsonpatch=require(_0xcfb0('0x4'));var rp=require(_0xcfb0('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcfb0('0x6'));var util=require(_0xcfb0('0x7'));var path=require(_0xcfb0('0x8'));var sox=require(_0xcfb0('0x9'));var csv=require(_0xcfb0('0xa'));var ejs=require(_0xcfb0('0xb'));var fs=require('fs');var _=require(_0xcfb0('0xc'));var squel=require(_0xcfb0('0xd'));var crypto=require(_0xcfb0('0xe'));var jsforce=require(_0xcfb0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcfb0('0xa'));var querystring=require(_0xcfb0('0x10'));var Papa=require(_0xcfb0('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0xcfb0('0x12'));var Redis=require(_0xcfb0('0x13'));var qs=require(_0xcfb0('0x14'));var logger=require(_0xcfb0('0x15'))('api');var utils=require(_0xcfb0('0x16'));var config=require(_0xcfb0('0x17'));var db=require(_0xcfb0('0x18'))['db'];function respondWithStatusCode(_0x16ff5a,_0x3c61fb){_0x3c61fb=_0x3c61fb||0xcc;return function(_0x23a961){if(_0x23a961){return _0x16ff5a[_0xcfb0('0x19')](_0x3c61fb);}return _0x16ff5a['status'](_0x3c61fb)[_0xcfb0('0x1a')]();};}function respondWithResult(_0x4f161e,_0x15804e){_0x15804e=_0x15804e||0xc8;return function(_0x561371){if(_0x561371){return _0x4f161e[_0xcfb0('0x1b')](_0x15804e)[_0xcfb0('0x1c')](_0x561371);}};}function respondWithFilteredResult(_0x13593f,_0x14083e){return function(_0x3d1814){if(_0x3d1814){var _0x52ad71=_0x3d1814[_0xcfb0('0x1d')],_0x3394ca=_0x14083e[_0xcfb0('0x1e')],_0x95569f=_0x14083e[_0xcfb0('0x1e')]+_0x14083e['limit'],_0x1d3d46;if(_0x95569f>=_0x52ad71){_0x95569f=_0x52ad71;_0x1d3d46=0xc8;}else{_0x1d3d46=0xce;}_0x13593f[_0xcfb0('0x1b')](_0x1d3d46);return _0x13593f['set'](_0xcfb0('0x1f'),_0x3394ca+'-'+_0x95569f+'/'+_0x52ad71)[_0xcfb0('0x1c')](_0x3d1814);}return null;};}function patchUpdates(_0x472f91){return function(_0xcb0f5c){try{jsonpatch[_0xcfb0('0x20')](_0xcb0f5c,_0x472f91,!![]);}catch(_0x1960ea){return BPromise['reject'](_0x1960ea);}return _0xcb0f5c[_0xcfb0('0x21')]();};}function saveUpdates(_0x165280,_0x136293){return function(_0xbf8b55){if(_0xbf8b55){return _0xbf8b55[_0xcfb0('0x22')](_0x165280)['then'](function(_0x462895){return _0x462895;});}return null;};}function removeEntity(_0x3d02c8,_0x502a49){return function(_0x49e84b){if(_0x49e84b){return _0x49e84b[_0xcfb0('0x23')]()[_0xcfb0('0x24')](function(){_0x3d02c8[_0xcfb0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33c783,_0x12f6ab){return function(_0x1d2b80){if(!_0x1d2b80){_0x33c783[_0xcfb0('0x19')](0x194);}return _0x1d2b80;};}function handleError(_0x4398ad,_0x27996d){_0x27996d=_0x27996d||0x1f4;return function(_0x2046a3){logger['error'](_0x2046a3[_0xcfb0('0x25')]);if(_0x2046a3[_0xcfb0('0x26')]){delete _0x2046a3[_0xcfb0('0x26')];}_0x4398ad[_0xcfb0('0x1b')](_0x27996d)[_0xcfb0('0x27')](_0x2046a3);};}exports[_0xcfb0('0x28')]=function(_0x9e5062,_0x379ed1){var _0x428236={},_0x259808={},_0x1650f3={'count':0x0,'rows':[]};var _0xe5564d=db['Migration'][_0xcfb0('0x29')];_0x259808['model']=_[_0xcfb0('0x2a')](_0xe5564d);_0x259808['query']=_[_0xcfb0('0x2a')](_0x9e5062[_0xcfb0('0x2b')]);_0x259808[_0xcfb0('0x2c')]=_[_0xcfb0('0x2d')](_0x259808[_0xcfb0('0x2e')],_0x259808[_0xcfb0('0x2b')]);_0x428236['attributes']=_['intersection'](_0x259808['model'],qs['fields'](_0x9e5062['query'][_0xcfb0('0x2f')]));_0x428236[_0xcfb0('0x30')]=_0x428236[_0xcfb0('0x30')][_0xcfb0('0x31')]?_0x428236[_0xcfb0('0x30')]:_0x259808[_0xcfb0('0x2e')];if(!_0x9e5062[_0xcfb0('0x2b')][_0xcfb0('0x32')](_0xcfb0('0x33'))){_0x428236['limit']=qs[_0xcfb0('0x34')](_0x9e5062[_0xcfb0('0x2b')][_0xcfb0('0x34')]);_0x428236[_0xcfb0('0x1e')]=qs[_0xcfb0('0x1e')](_0x9e5062[_0xcfb0('0x2b')][_0xcfb0('0x1e')]);}_0x428236[_0xcfb0('0x35')]=qs[_0xcfb0('0x36')](_0x9e5062[_0xcfb0('0x2b')]['sort']);_0x428236['where']=qs[_0xcfb0('0x2c')](_[_0xcfb0('0x37')](_0x9e5062[_0xcfb0('0x2b')],_0x259808[_0xcfb0('0x2c')]));if(_0x9e5062[_0xcfb0('0x2b')][_0xcfb0('0x38')]){_0x428236[_0xcfb0('0x39')]=_[_0xcfb0('0x3a')](_0x428236[_0xcfb0('0x39')],{'$or':_['map'](_0xe5564d,function(_0x41e891){if(_0x41e891[_0xcfb0('0x3b')][_0xcfb0('0x3c')]!==_0xcfb0('0x3d')){var _0x299d1c={};_0x299d1c[_0x41e891[_0xcfb0('0x3e')]]={'$like':'%'+_0x9e5062[_0xcfb0('0x2b')]['filter']+'%'};return _0x299d1c;}})});}_0x428236=_[_0xcfb0('0x3a')]({},_0x428236,_0x9e5062[_0xcfb0('0x3f')]);var _0x39ea6f={'where':_0x428236['where']};return db['Migration'][_0xcfb0('0x1d')](_0x39ea6f)[_0xcfb0('0x24')](function(_0x493302){_0x1650f3[_0xcfb0('0x1d')]=_0x493302;if(_0x9e5062[_0xcfb0('0x2b')][_0xcfb0('0x40')]){_0x428236[_0xcfb0('0x41')]=[{'all':!![]}];}return db[_0xcfb0('0x42')]['findAll'](_0x428236);})[_0xcfb0('0x24')](function(_0x1f174e){_0x1650f3[_0xcfb0('0x43')]=_0x1f174e;return _0x1650f3;})[_0xcfb0('0x24')](respondWithFilteredResult(_0x379ed1,_0x428236))[_0xcfb0('0x44')](handleError(_0x379ed1,null));}; \ No newline at end of file +var _0x0866=['count','offset','limit','Content-Range','reject','save','update','then','destroy','end','error','name','model','keys','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','field','Migration','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','json'];(function(_0x8dac63,_0x511c52){var _0x2dd029=function(_0x2cf4f7){while(--_0x2cf4f7){_0x8dac63['push'](_0x8dac63['shift']());}};_0x2dd029(++_0x511c52);}(_0x0866,0xe1));var _0x6086=function(_0x3e58e6,_0x1c5676){_0x3e58e6=_0x3e58e6-0x0;var _0xf68f3a=_0x0866[_0x3e58e6];return _0xf68f3a;};'use strict';var pdf=require(_0x6086('0x0'));var emlformat=require(_0x6086('0x1'));var rimraf=require(_0x6086('0x2'));var zipdir=require(_0x6086('0x3'));var jsonpatch=require(_0x6086('0x4'));var rp=require(_0x6086('0x5'));var moment=require(_0x6086('0x6'));var BPromise=require(_0x6086('0x7'));var Mustache=require(_0x6086('0x8'));var util=require('util');var path=require(_0x6086('0x9'));var sox=require('sox');var csv=require(_0x6086('0xa'));var ejs=require(_0x6086('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6086('0xc'));var crypto=require(_0x6086('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6086('0xe'));var toCsv=require(_0x6086('0xa'));var querystring=require(_0x6086('0xf'));var Papa=require(_0x6086('0x10'));var authService=require(_0x6086('0x11'));var hardwareService=require(_0x6086('0x12'));var Redis=require(_0x6086('0x13'));var qs=require(_0x6086('0x14'));var logger=require(_0x6086('0x15'))(_0x6086('0x16'));var utils=require('../../config/utils');var config=require(_0x6086('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c837e,_0x575106){_0x575106=_0x575106||0xcc;return function(_0x22bdc5){if(_0x22bdc5){return _0x1c837e[_0x6086('0x18')](_0x575106);}return _0x1c837e[_0x6086('0x19')](_0x575106)['end']();};}function respondWithResult(_0x1b7c8e,_0x2941f2){_0x2941f2=_0x2941f2||0xc8;return function(_0x45a0e0){if(_0x45a0e0){return _0x1b7c8e[_0x6086('0x19')](_0x2941f2)[_0x6086('0x1a')](_0x45a0e0);}};}function respondWithFilteredResult(_0x4fdffc,_0x567706){return function(_0x3de91f){if(_0x3de91f){var _0x5d979e=_0x3de91f[_0x6086('0x1b')],_0x5b9360=_0x567706[_0x6086('0x1c')],_0x2e7619=_0x567706[_0x6086('0x1c')]+_0x567706[_0x6086('0x1d')],_0x16e8e7;if(_0x2e7619>=_0x5d979e){_0x2e7619=_0x5d979e;_0x16e8e7=0xc8;}else{_0x16e8e7=0xce;}_0x4fdffc[_0x6086('0x19')](_0x16e8e7);return _0x4fdffc['set'](_0x6086('0x1e'),_0x5b9360+'-'+_0x2e7619+'/'+_0x5d979e)[_0x6086('0x1a')](_0x3de91f);}return null;};}function patchUpdates(_0x191ee1){return function(_0x2148f0){try{jsonpatch['apply'](_0x2148f0,_0x191ee1,!![]);}catch(_0x38a6fa){return BPromise[_0x6086('0x1f')](_0x38a6fa);}return _0x2148f0[_0x6086('0x20')]();};}function saveUpdates(_0x16eb4f,_0x44b869){return function(_0x30ddc2){if(_0x30ddc2){return _0x30ddc2[_0x6086('0x21')](_0x16eb4f)[_0x6086('0x22')](function(_0x11f84d){return _0x11f84d;});}return null;};}function removeEntity(_0x6a922d,_0x1004a0){return function(_0x67ac2f){if(_0x67ac2f){return _0x67ac2f[_0x6086('0x23')]()[_0x6086('0x22')](function(){_0x6a922d[_0x6086('0x19')](0xcc)[_0x6086('0x24')]();});}};}function handleEntityNotFound(_0x404739,_0x2b23d2){return function(_0x926705){if(!_0x926705){_0x404739[_0x6086('0x18')](0x194);}return _0x926705;};}function handleError(_0x274935,_0x5196f9){_0x5196f9=_0x5196f9||0x1f4;return function(_0x244d06){logger[_0x6086('0x25')](_0x244d06['stack']);if(_0x244d06[_0x6086('0x26')]){delete _0x244d06[_0x6086('0x26')];}_0x274935[_0x6086('0x19')](_0x5196f9)['send'](_0x244d06);};}exports['index']=function(_0x5da432,_0x33a3e3){var _0x1816bf={},_0x2852aa={},_0x134527={'count':0x0,'rows':[]};var _0x2d168f=db['Migration']['rawAttributes'];_0x2852aa[_0x6086('0x27')]=_[_0x6086('0x28')](_0x2d168f);_0x2852aa[_0x6086('0x29')]=_['keys'](_0x5da432[_0x6086('0x29')]);_0x2852aa['filters']=_['intersection'](_0x2852aa[_0x6086('0x27')],_0x2852aa['query']);_0x1816bf[_0x6086('0x2a')]=_['intersection'](_0x2852aa['model'],qs[_0x6086('0x2b')](_0x5da432[_0x6086('0x29')][_0x6086('0x2b')]));_0x1816bf[_0x6086('0x2a')]=_0x1816bf[_0x6086('0x2a')][_0x6086('0x2c')]?_0x1816bf['attributes']:_0x2852aa[_0x6086('0x27')];if(!_0x5da432['query'][_0x6086('0x2d')]('nolimit')){_0x1816bf[_0x6086('0x1d')]=qs[_0x6086('0x1d')](_0x5da432[_0x6086('0x29')][_0x6086('0x1d')]);_0x1816bf['offset']=qs[_0x6086('0x1c')](_0x5da432[_0x6086('0x29')][_0x6086('0x1c')]);}_0x1816bf[_0x6086('0x2e')]=qs[_0x6086('0x2f')](_0x5da432['query'][_0x6086('0x2f')]);_0x1816bf['where']=qs['filters'](_[_0x6086('0x30')](_0x5da432[_0x6086('0x29')],_0x2852aa['filters']));if(_0x5da432[_0x6086('0x29')][_0x6086('0x31')]){_0x1816bf[_0x6086('0x32')]=_[_0x6086('0x33')](_0x1816bf[_0x6086('0x32')],{'$or':_[_0x6086('0x34')](_0x2d168f,function(_0x24ba48){if(_0x24ba48[_0x6086('0x35')][_0x6086('0x36')]!==_0x6086('0x37')){var _0xa7e587={};_0xa7e587[_0x24ba48[_0x6086('0x38')]]={'$like':'%'+_0x5da432[_0x6086('0x29')][_0x6086('0x31')]+'%'};return _0xa7e587;}})});}_0x1816bf=_[_0x6086('0x33')]({},_0x1816bf,_0x5da432['options']);var _0x256ffd={'where':_0x1816bf['where']};return db[_0x6086('0x39')][_0x6086('0x1b')](_0x256ffd)[_0x6086('0x22')](function(_0x4d90a4){_0x134527[_0x6086('0x1b')]=_0x4d90a4;if(_0x5da432[_0x6086('0x29')][_0x6086('0x3a')]){_0x1816bf[_0x6086('0x3b')]=[{'all':!![]}];}return db[_0x6086('0x39')][_0x6086('0x3c')](_0x1816bf);})[_0x6086('0x22')](function(_0x1f5bd2){_0x134527[_0x6086('0x3d')]=_0x1f5bd2;return _0x134527;})[_0x6086('0x22')](respondWithFilteredResult(_0x33a3e3,_0x1816bf))[_0x6086('0x3e')](handleError(_0x33a3e3,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 0bf8352..cec2bef 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 _0x073d=['define','Migration','migrations','util','../../config/logger','api','bluebird','./migration.attributes','exports'];(function(_0x4d2876,_0x57a77e){var _0x40ff6d=function(_0x3441fe){while(--_0x3441fe){_0x4d2876['push'](_0x4d2876['shift']());}};_0x40ff6d(++_0x57a77e);}(_0x073d,0xd2));var _0xd073=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x073d[_0x2b91c5];return _0xbd5531;};'use strict';var _=require('lodash');var util=require(_0xd073('0x0'));var logger=require(_0xd073('0x1'))(_0xd073('0x2'));var moment=require('moment');var BPromise=require(_0xd073('0x3'));var rp=require('request-promise');var attributes=require(_0xd073('0x4'));module[_0xd073('0x5')]=function(_0x494f81,_0x11bd94){return _0x494f81[_0xd073('0x6')](_0xd073('0x7'),attributes,{'tableName':_0xd073('0x8'),'paranoid':![],'indexes':[],'timestamps':![]});}; \ No newline at end of file +var _0x110e=['lodash','util','api','moment','bluebird','request-promise','./migration.attributes','Migration'];(function(_0x1757a4,_0x49b813){var _0x4c38c6=function(_0x212537){while(--_0x212537){_0x1757a4['push'](_0x1757a4['shift']());}};_0x4c38c6(++_0x49b813);}(_0x110e,0x68));var _0xe110=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x110e[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));var logger=require('../../config/logger')(_0xe110('0x2'));var moment=require(_0xe110('0x3'));var BPromise=require(_0xe110('0x4'));var rp=require(_0xe110('0x5'));var attributes=require(_0xe110('0x6'));module['exports']=function(_0x563977,_0x5032de){return _0x563977['define'](_0xe110('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 761541d..b41bcd1 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 _0x24ca=['request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','Migration,\x20%s,\x20%s'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x24ca,0x8c));var _0xa24c=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x24ca[_0x135904];return _0x1ce7d5;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa24c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];var utils=require(_0xa24c('0x4'));var logger=require('../../config/logger')(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var jayson=require(_0xa24c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52147a,_0x2288d4,_0x3c10d9){return new BPromise(function(_0x1218ea,_0x3c3959){return client[_0xa24c('0x8')](_0x52147a,_0x3c10d9)[_0xa24c('0x9')](function(_0x5bedc6){logger[_0xa24c('0xa')](_0xa24c('0xb'),_0x2288d4,_0xa24c('0xc'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x2288d4,_0xa24c('0xc'),JSON[_0xa24c('0xd')](_0x5bedc6));if(_0x5bedc6[_0xa24c('0xe')]){if(_0x5bedc6[_0xa24c('0xe')][_0xa24c('0xf')]===0x1f4){logger[_0xa24c('0xe')]('Migration,\x20%s,\x20%s',_0x2288d4,_0x5bedc6['error']['message']);return _0x3c3959(_0x5bedc6[_0xa24c('0xe')][_0xa24c('0x10')]);}logger[_0xa24c('0xe')](_0xa24c('0xb'),_0x2288d4,_0x5bedc6[_0xa24c('0xe')]['message']);return _0x1218ea(_0x5bedc6[_0xa24c('0xe')]['message']);}else{logger['info']('Migration,\x20%s,\x20%s',_0x2288d4,_0xa24c('0xc'));_0x1218ea(_0x5bedc6[_0xa24c('0x11')][_0xa24c('0x10')]);}})[_0xa24c('0x12')](function(_0x204e7a){logger[_0xa24c('0xe')](_0xa24c('0xb'),_0x2288d4,_0x204e7a);_0x3c3959(_0x204e7a);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4abb65,_0xb50d2e){var _0x41b948=function(_0x31c6f6){while(--_0x31c6f6){_0x4abb65['push'](_0x4abb65['shift']());}};_0x41b948(++_0xb50d2e);}(_0x8ef6,0xf2));var _0x68ef=function(_0x22ac22,_0x5d2d46){_0x22ac22=_0x22ac22-0x0;var _0x17e0cf=_0x8ef6[_0x22ac22];return _0x17e0cf;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Migration,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Migration,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index d9d7734..7f27722 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 _0x37cc=['./network.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37cc,0x185));var _0xc37c=function(_0x2cd890,_0x240ab5){_0x2cd890=_0x2cd890-0x0;var _0x2dbb48=_0x37cc[_0x2cd890];return _0x2dbb48;};'use strict';var multer=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var path=require(_0xc37c('0x2'));var timeout=require(_0xc37c('0x3'));var express=require(_0xc37c('0x4'));var router=express[_0xc37c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc37c('0x6'));var controller=require(_0xc37c('0x7'));router[_0xc37c('0x8')]('/',auth[_0xc37c('0x9')](),controller[_0xc37c('0xa')]);router[_0xc37c('0x8')](_0xc37c('0xb'),auth[_0xc37c('0x9')](),controller[_0xc37c('0xc')]);router['post']('/',auth[_0xc37c('0x9')](),controller[_0xc37c('0xd')]);router[_0xc37c('0xe')](_0xc37c('0xb'),auth[_0xc37c('0x9')](),controller['update']);router[_0xc37c('0xf')](_0xc37c('0xb'),auth[_0xc37c('0x9')](),controller[_0xc37c('0x10')]);module[_0xc37c('0x11')]=router; \ No newline at end of file +var _0xe6cd=['multer','util','path','connect-timeout','Router','../../config/environment','./network.controller','get','isAuthenticated','index','show','put','update','/:id','exports'];(function(_0x4ec747,_0x44a0e4){var _0x3deaf1=function(_0x5238db){while(--_0x5238db){_0x4ec747['push'](_0x4ec747['shift']());}};_0x3deaf1(++_0x44a0e4);}(_0xe6cd,0x159));var _0xde6c=function(_0x53d0ab,_0x32774c){_0x53d0ab=_0x53d0ab-0x0;var _0x3eae64=_0xe6cd[_0x53d0ab];return _0x3eae64;};'use strict';var multer=require(_0xde6c('0x0'));var util=require(_0xde6c('0x1'));var path=require(_0xde6c('0x2'));var timeout=require(_0xde6c('0x3'));var express=require('express');var router=express[_0xde6c('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xde6c('0x5'));var controller=require(_0xde6c('0x6'));router[_0xde6c('0x7')]('/',auth[_0xde6c('0x8')](),controller[_0xde6c('0x9')]);router[_0xde6c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xde6c('0xa')]);router['post']('/',auth[_0xde6c('0x8')](),controller['create']);router[_0xde6c('0xb')]('/:id',auth[_0xde6c('0x8')](),controller[_0xde6c('0xc')]);router['delete'](_0xde6c('0xd'),auth[_0xde6c('0x8')](),controller['destroy']);module[_0xde6c('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 9487c20..b520bc9 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 _0x3714=['sequelize','exports','ENUM'];(function(_0x326a32,_0x918aaa){var _0x31ffe6=function(_0x2f3922){while(--_0x2f3922){_0x326a32['push'](_0x326a32['shift']());}};_0x31ffe6(++_0x918aaa);}(_0x3714,0x18c));var _0x4371=function(_0x46d4e5,_0x5da293){_0x46d4e5=_0x46d4e5-0x0;var _0x225fcd=_0x3714[_0x46d4e5];return _0x225fcd;};'use strict';var Sequelize=require(_0x4371('0x0'));module[_0x4371('0x1')]={'type':{'type':Sequelize[_0x4371('0x2')]('localnet','externip')},'value':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd26e=['STRING','sequelize','exports','ENUM','externip'];(function(_0x560184,_0x49cb0a){var _0x595aa1=function(_0x44a3fa){while(--_0x44a3fa){_0x560184['push'](_0x560184['shift']());}};_0x595aa1(++_0x49cb0a);}(_0xd26e,0x74));var _0xed26=function(_0x4d8524,_0x1e8925){_0x4d8524=_0x4d8524-0x0;var _0xbdb413=_0xd26e[_0x4d8524];return _0xbdb413;};'use strict';var Sequelize=require(_0xed26('0x0'));module[_0xed26('0x1')]={'type':{'type':Sequelize[_0xed26('0x2')]('localnet',_0xed26('0x3'))},'value':{'type':Sequelize[_0xed26('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index a354e5f..db6728f 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 _0x6972=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','offset','limit','Content-Range','apply','reject','save','destroy','sendStatus','name','status','index','Network','rawAttributes','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','key','field','options','count','includeAll','include','findAll','rows','show','params','find','create','transaction','body','join','root','utf8','format','/etc/asterisk/sip_xcally_%s.conf','Reload','chan_sip.so','sequelize','readFileSync','server/files/templates/network.ejs','render','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs'];(function(_0x234f17,_0x4f2456){var _0x504f71=function(_0x141cd4){while(--_0x141cd4){_0x234f17['push'](_0x234f17['shift']());}};_0x504f71(++_0x4f2456);}(_0x6972,0xac));var _0x2697=function(_0x2a601b,_0x1a7b07){_0x2a601b=_0x2a601b-0x0;var _0x478806=_0x6972[_0x2a601b];return _0x478806;};'use strict';var pdf=require(_0x2697('0x0'));var emlformat=require(_0x2697('0x1'));var rimraf=require(_0x2697('0x2'));var zipdir=require(_0x2697('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2697('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2697('0x5'));var util=require(_0x2697('0x6'));var path=require(_0x2697('0x7'));var sox=require(_0x2697('0x8'));var csv=require('to-csv');var ejs=require(_0x2697('0x9'));var fs=require('fs');var _=require(_0x2697('0xa'));var squel=require(_0x2697('0xb'));var crypto=require(_0x2697('0xc'));var jsforce=require(_0x2697('0xd'));var deskjs=require(_0x2697('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2697('0xf'));var authService=require(_0x2697('0x10'));var hardwareService=require(_0x2697('0x11'));var Redis=require(_0x2697('0x12'));var qs=require(_0x2697('0x13'));var logger=require(_0x2697('0x14'))(_0x2697('0x15'));var utils=require(_0x2697('0x16'));var config=require(_0x2697('0x17'));var db=require(_0x2697('0x18'))['db'];var jayson=require(_0x2697('0x19'));var client=jayson['client'][_0x2697('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5602aa,_0x29e623,_0x2a2f14,_0x11f289){return new BPromise(function(_0x598146,_0x7c264c){var _0x367d60=_0x11f289||client;return _0x367d60[_0x2697('0x1b')](_0x5602aa,_0x2a2f14)[_0x2697('0x1c')](function(_0x36788b){logger[_0x2697('0x1d')](_0x2697('0x1e'),_0x29e623,_0x2697('0x1f'));logger[_0x2697('0x20')](_0x2697('0x21'),_0x29e623,'request\x20sent',JSON[_0x2697('0x22')](_0x36788b));if(_0x36788b[_0x2697('0x23')]){if(_0x36788b[_0x2697('0x23')][_0x2697('0x24')]===0x1f4){logger[_0x2697('0x23')]('Network,\x20%s,\x20%s',_0x29e623,_0x36788b[_0x2697('0x23')][_0x2697('0x25')]);return _0x7c264c(_0x36788b[_0x2697('0x23')][_0x2697('0x25')]);}logger[_0x2697('0x23')](_0x2697('0x1e'),_0x29e623,_0x36788b[_0x2697('0x23')][_0x2697('0x25')]);return _0x598146(_0x36788b[_0x2697('0x23')][_0x2697('0x25')]);}else{logger[_0x2697('0x1d')](_0x2697('0x1e'),_0x29e623,_0x2697('0x1f'));_0x598146(_0x36788b[_0x2697('0x26')][_0x2697('0x25')]);}})[_0x2697('0x27')](function(_0x229d0f){logger[_0x2697('0x23')](_0x2697('0x1e'),_0x29e623,_0x229d0f);_0x7c264c(_0x229d0f);});});}function respondWithStatusCode(_0x543156,_0x36f3cd){_0x36f3cd=_0x36f3cd||0xcc;return function(_0x4b7a82){if(_0x4b7a82){return _0x543156['sendStatus'](_0x36f3cd);}return _0x543156['status'](_0x36f3cd)[_0x2697('0x28')]();};}function respondWithResult(_0x4c29f7,_0x2bb1ca){_0x2bb1ca=_0x2bb1ca||0xc8;return function(_0x149b7a){if(_0x149b7a){return _0x4c29f7['status'](_0x2bb1ca)['json'](_0x149b7a);}};}function respondWithFilteredResult(_0x3153e7,_0x4fdd17){return function(_0x11d2a0){if(_0x11d2a0){var _0x5af73c=_0x11d2a0['count'],_0x301c85=_0x4fdd17[_0x2697('0x29')],_0x46b8c9=_0x4fdd17[_0x2697('0x29')]+_0x4fdd17[_0x2697('0x2a')],_0x2749ba;if(_0x46b8c9>=_0x5af73c){_0x46b8c9=_0x5af73c;_0x2749ba=0xc8;}else{_0x2749ba=0xce;}_0x3153e7['status'](_0x2749ba);return _0x3153e7['set'](_0x2697('0x2b'),_0x301c85+'-'+_0x46b8c9+'/'+_0x5af73c)['json'](_0x11d2a0);}return null;};}function patchUpdates(_0x1bafe2){return function(_0x1e5662){try{jsonpatch[_0x2697('0x2c')](_0x1e5662,_0x1bafe2,!![]);}catch(_0x56c1b2){return BPromise[_0x2697('0x2d')](_0x56c1b2);}return _0x1e5662[_0x2697('0x2e')]();};}function saveUpdates(_0xa6f6f1,_0x4fb3bf){return function(_0x2afdc5){if(_0x2afdc5){return _0x2afdc5['update'](_0xa6f6f1)[_0x2697('0x1c')](function(_0x54d932){return _0x54d932;});}return null;};}function removeEntity(_0x13d44b,_0x11702a){return function(_0x282077){if(_0x282077){return _0x282077[_0x2697('0x2f')]()[_0x2697('0x1c')](function(){_0x13d44b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x581e8f,_0x19689f){return function(_0x3957f3){if(!_0x3957f3){_0x581e8f[_0x2697('0x30')](0x194);}return _0x3957f3;};}function handleError(_0x5c495f,_0x521cea){_0x521cea=_0x521cea||0x1f4;return function(_0x30904a){logger[_0x2697('0x23')](_0x30904a['stack']);if(_0x30904a[_0x2697('0x31')]){delete _0x30904a[_0x2697('0x31')];}_0x5c495f[_0x2697('0x32')](_0x521cea)['send'](_0x30904a);};}exports[_0x2697('0x33')]=function(_0x2dbd4f,_0x2966c6){var _0x49041e={},_0x4bed72={},_0x37f7c9={'count':0x0,'rows':[]};var _0x16c368=db[_0x2697('0x34')][_0x2697('0x35')];_0x4bed72[_0x2697('0x36')]=_[_0x2697('0x37')](_0x16c368);_0x4bed72['query']=_[_0x2697('0x37')](_0x2dbd4f['query']);_0x4bed72['filters']=_[_0x2697('0x38')](_0x4bed72[_0x2697('0x36')],_0x4bed72[_0x2697('0x39')]);_0x49041e[_0x2697('0x3a')]=_[_0x2697('0x38')](_0x4bed72['model'],qs['fields'](_0x2dbd4f['query'][_0x2697('0x3b')]));_0x49041e[_0x2697('0x3a')]=_0x49041e['attributes'][_0x2697('0x3c')]?_0x49041e[_0x2697('0x3a')]:_0x4bed72[_0x2697('0x36')];if(!_0x2dbd4f[_0x2697('0x39')][_0x2697('0x3d')](_0x2697('0x3e'))){_0x49041e[_0x2697('0x2a')]=qs[_0x2697('0x2a')](_0x2dbd4f[_0x2697('0x39')][_0x2697('0x2a')]);_0x49041e[_0x2697('0x29')]=qs[_0x2697('0x29')](_0x2dbd4f[_0x2697('0x39')][_0x2697('0x29')]);}_0x49041e[_0x2697('0x3f')]=qs[_0x2697('0x40')](_0x2dbd4f['query'][_0x2697('0x40')]);_0x49041e['where']=qs['filters'](_['pick'](_0x2dbd4f['query'],_0x4bed72[_0x2697('0x41')]));if(_0x2dbd4f['query'][_0x2697('0x42')]){_0x49041e[_0x2697('0x43')]=_[_0x2697('0x44')](_0x49041e[_0x2697('0x43')],{'$or':_['map'](_0x16c368,function(_0x524828){if(_0x524828[_0x2697('0x45')][_0x2697('0x46')]!=='VIRTUAL'){var _0x1fc649={};_0x1fc649[_0x524828[_0x2697('0x47')]]={'$like':'%'+_0x2dbd4f['query'][_0x2697('0x42')]+'%'};return _0x1fc649;}})});}_0x49041e=_['merge']({},_0x49041e,_0x2dbd4f[_0x2697('0x48')]);var _0x5c42f5={'where':_0x49041e[_0x2697('0x43')]};return db[_0x2697('0x34')][_0x2697('0x49')](_0x5c42f5)['then'](function(_0x44f7a3){_0x37f7c9['count']=_0x44f7a3;if(_0x2dbd4f[_0x2697('0x39')][_0x2697('0x4a')]){_0x49041e[_0x2697('0x4b')]=[{'all':!![]}];}return db[_0x2697('0x34')][_0x2697('0x4c')](_0x49041e);})[_0x2697('0x1c')](function(_0x1e6590){_0x37f7c9[_0x2697('0x4d')]=_0x1e6590;return _0x37f7c9;})[_0x2697('0x1c')](respondWithFilteredResult(_0x2966c6,_0x49041e))[_0x2697('0x27')](handleError(_0x2966c6,null));};exports[_0x2697('0x4e')]=function(_0x486217,_0x1abb10){var _0x299254={'raw':!![],'where':{'id':_0x486217[_0x2697('0x4f')]['id']}},_0x3f0ac7={};_0x3f0ac7[_0x2697('0x36')]=_[_0x2697('0x37')](db[_0x2697('0x34')][_0x2697('0x35')]);_0x3f0ac7[_0x2697('0x39')]=_['keys'](_0x486217[_0x2697('0x39')]);_0x3f0ac7[_0x2697('0x41')]=_['intersection'](_0x3f0ac7[_0x2697('0x36')],_0x3f0ac7[_0x2697('0x39')]);_0x299254[_0x2697('0x3a')]=_['intersection'](_0x3f0ac7[_0x2697('0x36')],qs[_0x2697('0x3b')](_0x486217['query']['fields']));_0x299254[_0x2697('0x3a')]=_0x299254[_0x2697('0x3a')][_0x2697('0x3c')]?_0x299254[_0x2697('0x3a')]:_0x3f0ac7[_0x2697('0x36')];if(_0x486217[_0x2697('0x39')]['includeAll']){_0x299254[_0x2697('0x4b')]=[{'all':!![]}];}_0x299254=_[_0x2697('0x44')]({},_0x299254,_0x486217[_0x2697('0x48')]);return db[_0x2697('0x34')][_0x2697('0x50')](_0x299254)[_0x2697('0x1c')](handleEntityNotFound(_0x1abb10,null))[_0x2697('0x1c')](respondWithResult(_0x1abb10,null))[_0x2697('0x27')](handleError(_0x1abb10,null));};exports[_0x2697('0x51')]=function(_0x35546a,_0x36b869,_0x10b8c3){var _0x3f8866;return db['sequelize'][_0x2697('0x52')](function(_0x332334){return db['Network'][_0x2697('0x51')](_0x35546a['body'],{'raw':!![]})[_0x2697('0x1c')](function(_0x1265d7){_0x3f8866=_0x1265d7;return db[_0x2697('0x34')][_0x2697('0x4c')]({'where':{'type':_0x35546a[_0x2697('0x53')]['type']},'raw':!![]});})[_0x2697('0x1c')](function(_0x4c69a5){var _0x11f935=fs['readFileSync'](path[_0x2697('0x54')](config[_0x2697('0x55')],'server/files/templates/network.ejs'),_0x2697('0x56'));var _0x23dd55=ejs['render'](_0x11f935,{'networks':_0x4c69a5||[]});fs['writeFileSync'](util[_0x2697('0x57')](_0x2697('0x58'),_0x35546a['body'][_0x2697('0x45')]['toLowerCase']()),_0x23dd55);})[_0x2697('0x1c')](function(){return respondWithRpcPromise(_0x2697('0x59'),'create',{'module':_0x2697('0x5a')});})[_0x2697('0x1c')](function(){return _0x3f8866;});})[_0x2697('0x1c')](respondWithResult(_0x36b869,0xc9))[_0x2697('0x27')](handleError(_0x36b869,null));};exports['update']=function(_0x2c07e9,_0x4027a9,_0x23435b){var _0x347a52;return db[_0x2697('0x5b')][_0x2697('0x52')](function(_0x1bfb89){return db[_0x2697('0x34')]['find']({'where':{'id':_0x2c07e9[_0x2697('0x4f')]['id']}})[_0x2697('0x1c')](handleEntityNotFound(_0x4027a9,null))['then'](saveUpdates(_0x2c07e9[_0x2697('0x53')],null))['then'](function(_0x2e1f76){if(_0x2e1f76){_0x347a52=_0x2e1f76;return db[_0x2697('0x34')][_0x2697('0x4c')]({'where':{'type':_0x347a52[_0x2697('0x45')]},'raw':!![]});}return null;})[_0x2697('0x1c')](function(_0x19a377){if(_0x19a377){var _0x58a827=fs[_0x2697('0x5c')](path['join'](config['root'],_0x2697('0x5d')),_0x2697('0x56'));var _0x225d4c=ejs[_0x2697('0x5e')](_0x58a827,{'networks':_0x19a377||[]});fs['writeFileSync'](util[_0x2697('0x57')](_0x2697('0x58'),_0x347a52['type']['toLowerCase']()),_0x225d4c);return respondWithRpcPromise(_0x2697('0x59'),'update',{'module':_0x2697('0x5a')});}return null;})[_0x2697('0x1c')](function(_0x3250dd){if(_0x3250dd){return _0x347a52;}return null;});})[_0x2697('0x1c')](respondWithResult(_0x4027a9,null))[_0x2697('0x27')](handleError(_0x4027a9,null));};exports[_0x2697('0x2f')]=function(_0x46acb9,_0x5b8fac,_0x4dd08f){var _0x4d7ac5;return db[_0x2697('0x34')][_0x2697('0x50')]({'where':{'id':_0x46acb9[_0x2697('0x4f')]['id']}})['then'](function(_0xf51b9e){_0x4d7ac5=_0xf51b9e;return _0xf51b9e;})[_0x2697('0x1c')](handleEntityNotFound(_0x5b8fac,null))[_0x2697('0x1c')](removeEntity(_0x5b8fac,null))['then'](function(){if(_0x4d7ac5){return db['Network'][_0x2697('0x4c')]({'where':{'type':_0x4d7ac5[_0x2697('0x45')]},'raw':!![]});}})[_0x2697('0x1c')](function(_0x31ae36){if(_0x31ae36){var _0x5a2512=fs[_0x2697('0x5c')](path[_0x2697('0x54')](config[_0x2697('0x55')],_0x2697('0x5d')),_0x2697('0x56'));var _0x5684da=ejs['render'](_0x5a2512,{'networks':_0x31ae36||[]});fs['writeFileSync'](util[_0x2697('0x57')](_0x2697('0x58'),_0x4d7ac5[_0x2697('0x45')][_0x2697('0x5f')]()),_0x5684da);return respondWithRpcPromise(_0x2697('0x59'),_0x2697('0x2f'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x5b8fac,null));}; \ No newline at end of file +var _0xd101=['papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','jayson/promise','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','Network','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','findAll','show','params','includeAll','options','find','catch','create','sequelize','transaction','readFileSync','join','root','server/files/templates/network.ejs','utf8','writeFileSync','format','toLowerCase','chan_sip.so','body','Reload','render','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd101,0x1b8));var _0x1d10=function(_0x32d4f5,_0x2a8a17){_0x32d4f5=_0x32d4f5-0x0;var _0x5c1ab7=_0xd101[_0x32d4f5];return _0x5c1ab7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1d10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1d10('0x1'));var jsonpatch=require(_0x1d10('0x2'));var rp=require(_0x1d10('0x3'));var moment=require('moment');var BPromise=require(_0x1d10('0x4'));var Mustache=require(_0x1d10('0x5'));var util=require(_0x1d10('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1d10('0x7'));var ejs=require(_0x1d10('0x8'));var fs=require('fs');var _=require(_0x1d10('0x9'));var squel=require(_0x1d10('0xa'));var crypto=require(_0x1d10('0xb'));var jsforce=require(_0x1d10('0xc'));var deskjs=require(_0x1d10('0xd'));var toCsv=require(_0x1d10('0x7'));var querystring=require(_0x1d10('0xe'));var Papa=require(_0x1d10('0xf'));var authService=require(_0x1d10('0x10'));var hardwareService=require(_0x1d10('0x11'));var Redis=require(_0x1d10('0x12'));var qs=require(_0x1d10('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1d10('0x14'));var db=require(_0x1d10('0x15'))['db'];var jayson=require(_0x1d10('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d895e,_0x23ded2,_0x1c720e,_0x2077a4){return new BPromise(function(_0x339436,_0x321637){var _0x30c704=_0x2077a4||client;return _0x30c704['request'](_0x1d895e,_0x1c720e)['then'](function(_0xac63e7){logger['info'](_0x1d10('0x17'),_0x23ded2,'request\x20sent');logger[_0x1d10('0x18')](_0x1d10('0x19'),_0x23ded2,_0x1d10('0x1a'),JSON[_0x1d10('0x1b')](_0xac63e7));if(_0xac63e7['error']){if(_0xac63e7[_0x1d10('0x1c')]['code']===0x1f4){logger[_0x1d10('0x1c')](_0x1d10('0x17'),_0x23ded2,_0xac63e7[_0x1d10('0x1c')][_0x1d10('0x1d')]);return _0x321637(_0xac63e7['error'][_0x1d10('0x1d')]);}logger[_0x1d10('0x1c')](_0x1d10('0x17'),_0x23ded2,_0xac63e7['error'][_0x1d10('0x1d')]);return _0x339436(_0xac63e7['error']['message']);}else{logger['info'](_0x1d10('0x17'),_0x23ded2,_0x1d10('0x1a'));_0x339436(_0xac63e7[_0x1d10('0x1e')][_0x1d10('0x1d')]);}})['catch'](function(_0x5a6f61){logger['error']('Network,\x20%s,\x20%s',_0x23ded2,_0x5a6f61);_0x321637(_0x5a6f61);});});}function respondWithStatusCode(_0x4c5723,_0x2d296f){_0x2d296f=_0x2d296f||0xcc;return function(_0x4d12a8){if(_0x4d12a8){return _0x4c5723[_0x1d10('0x1f')](_0x2d296f);}return _0x4c5723[_0x1d10('0x20')](_0x2d296f)[_0x1d10('0x21')]();};}function respondWithResult(_0x23bdac,_0x5df07a){_0x5df07a=_0x5df07a||0xc8;return function(_0x269bc4){if(_0x269bc4){return _0x23bdac['status'](_0x5df07a)[_0x1d10('0x22')](_0x269bc4);}};}function respondWithFilteredResult(_0xeff0fd,_0x13b83b){return function(_0x908be){if(_0x908be){var _0xf2b535=_0x908be[_0x1d10('0x23')],_0x43943b=_0x13b83b[_0x1d10('0x24')],_0x385baa=_0x13b83b[_0x1d10('0x24')]+_0x13b83b[_0x1d10('0x25')],_0x2bae8b;if(_0x385baa>=_0xf2b535){_0x385baa=_0xf2b535;_0x2bae8b=0xc8;}else{_0x2bae8b=0xce;}_0xeff0fd[_0x1d10('0x20')](_0x2bae8b);return _0xeff0fd['set'](_0x1d10('0x26'),_0x43943b+'-'+_0x385baa+'/'+_0xf2b535)['json'](_0x908be);}return null;};}function patchUpdates(_0x1968fa){return function(_0x3f78d7){try{jsonpatch[_0x1d10('0x27')](_0x3f78d7,_0x1968fa,!![]);}catch(_0x178ac1){return BPromise[_0x1d10('0x28')](_0x178ac1);}return _0x3f78d7[_0x1d10('0x29')]();};}function saveUpdates(_0x466cbc,_0xde96e6){return function(_0x28050b){if(_0x28050b){return _0x28050b[_0x1d10('0x2a')](_0x466cbc)[_0x1d10('0x2b')](function(_0x470272){return _0x470272;});}return null;};}function removeEntity(_0x25ae82,_0x43af37){return function(_0x55a142){if(_0x55a142){return _0x55a142[_0x1d10('0x2c')]()[_0x1d10('0x2b')](function(){_0x25ae82[_0x1d10('0x20')](0xcc)[_0x1d10('0x21')]();});}};}function handleEntityNotFound(_0x2f2e30,_0x404160){return function(_0x214f7e){if(!_0x214f7e){_0x2f2e30[_0x1d10('0x1f')](0x194);}return _0x214f7e;};}function handleError(_0x216076,_0x1585c2){_0x1585c2=_0x1585c2||0x1f4;return function(_0x26be74){logger[_0x1d10('0x1c')](_0x26be74[_0x1d10('0x2d')]);if(_0x26be74[_0x1d10('0x2e')]){delete _0x26be74[_0x1d10('0x2e')];}_0x216076['status'](_0x1585c2)['send'](_0x26be74);};}exports[_0x1d10('0x2f')]=function(_0x2c4db6,_0x2a8420){var _0x4eb85d={},_0x2bbbb0={},_0x2bea39={'count':0x0,'rows':[]};var _0x3e5c4a=db[_0x1d10('0x30')][_0x1d10('0x31')];_0x2bbbb0[_0x1d10('0x32')]=_[_0x1d10('0x33')](_0x3e5c4a);_0x2bbbb0[_0x1d10('0x34')]=_['keys'](_0x2c4db6[_0x1d10('0x34')]);_0x2bbbb0[_0x1d10('0x35')]=_[_0x1d10('0x36')](_0x2bbbb0[_0x1d10('0x32')],_0x2bbbb0[_0x1d10('0x34')]);_0x4eb85d[_0x1d10('0x37')]=_[_0x1d10('0x36')](_0x2bbbb0[_0x1d10('0x32')],qs[_0x1d10('0x38')](_0x2c4db6[_0x1d10('0x34')][_0x1d10('0x38')]));_0x4eb85d[_0x1d10('0x37')]=_0x4eb85d[_0x1d10('0x37')][_0x1d10('0x39')]?_0x4eb85d[_0x1d10('0x37')]:_0x2bbbb0[_0x1d10('0x32')];if(!_0x2c4db6[_0x1d10('0x34')]['hasOwnProperty'](_0x1d10('0x3a'))){_0x4eb85d[_0x1d10('0x25')]=qs[_0x1d10('0x25')](_0x2c4db6['query'][_0x1d10('0x25')]);_0x4eb85d[_0x1d10('0x24')]=qs[_0x1d10('0x24')](_0x2c4db6['query'][_0x1d10('0x24')]);}_0x4eb85d[_0x1d10('0x3b')]=qs[_0x1d10('0x3c')](_0x2c4db6[_0x1d10('0x34')][_0x1d10('0x3c')]);_0x4eb85d[_0x1d10('0x3d')]=qs[_0x1d10('0x35')](_['pick'](_0x2c4db6[_0x1d10('0x34')],_0x2bbbb0[_0x1d10('0x35')]));if(_0x2c4db6[_0x1d10('0x34')][_0x1d10('0x3e')]){_0x4eb85d[_0x1d10('0x3d')]=_[_0x1d10('0x3f')](_0x4eb85d[_0x1d10('0x3d')],{'$or':_[_0x1d10('0x40')](_0x3e5c4a,function(_0x42af1e){if(_0x42af1e[_0x1d10('0x41')][_0x1d10('0x42')]!==_0x1d10('0x43')){var _0x1ed319={};_0x1ed319[_0x42af1e[_0x1d10('0x44')]]={'$like':'%'+_0x2c4db6['query'][_0x1d10('0x3e')]+'%'};return _0x1ed319;}})});}_0x4eb85d=_[_0x1d10('0x3f')]({},_0x4eb85d,_0x2c4db6['options']);var _0x2d5b0d={'where':_0x4eb85d[_0x1d10('0x3d')]};return db['Network'][_0x1d10('0x23')](_0x2d5b0d)[_0x1d10('0x2b')](function(_0x45d08b){_0x2bea39[_0x1d10('0x23')]=_0x45d08b;if(_0x2c4db6[_0x1d10('0x34')]['includeAll']){_0x4eb85d['include']=[{'all':!![]}];}return db[_0x1d10('0x30')][_0x1d10('0x45')](_0x4eb85d);})[_0x1d10('0x2b')](function(_0x19a1fe){_0x2bea39['rows']=_0x19a1fe;return _0x2bea39;})['then'](respondWithFilteredResult(_0x2a8420,_0x4eb85d))['catch'](handleError(_0x2a8420,null));};exports[_0x1d10('0x46')]=function(_0x5b91e8,_0x55790e){var _0x1ebf6f={'raw':!![],'where':{'id':_0x5b91e8[_0x1d10('0x47')]['id']}},_0x5a2936={};_0x5a2936[_0x1d10('0x32')]=_[_0x1d10('0x33')](db[_0x1d10('0x30')][_0x1d10('0x31')]);_0x5a2936[_0x1d10('0x34')]=_['keys'](_0x5b91e8[_0x1d10('0x34')]);_0x5a2936[_0x1d10('0x35')]=_['intersection'](_0x5a2936['model'],_0x5a2936[_0x1d10('0x34')]);_0x1ebf6f[_0x1d10('0x37')]=_[_0x1d10('0x36')](_0x5a2936[_0x1d10('0x32')],qs[_0x1d10('0x38')](_0x5b91e8[_0x1d10('0x34')][_0x1d10('0x38')]));_0x1ebf6f['attributes']=_0x1ebf6f['attributes'][_0x1d10('0x39')]?_0x1ebf6f[_0x1d10('0x37')]:_0x5a2936[_0x1d10('0x32')];if(_0x5b91e8[_0x1d10('0x34')][_0x1d10('0x48')]){_0x1ebf6f['include']=[{'all':!![]}];}_0x1ebf6f=_['merge']({},_0x1ebf6f,_0x5b91e8[_0x1d10('0x49')]);return db[_0x1d10('0x30')][_0x1d10('0x4a')](_0x1ebf6f)[_0x1d10('0x2b')](handleEntityNotFound(_0x55790e,null))['then'](respondWithResult(_0x55790e,null))[_0x1d10('0x4b')](handleError(_0x55790e,null));};exports[_0x1d10('0x4c')]=function(_0xc897cb,_0x227d72,_0x29eed8){var _0xefacc6;return db[_0x1d10('0x4d')][_0x1d10('0x4e')](function(_0x2125a7){return db['Network']['create'](_0xc897cb['body'],{'raw':!![]})[_0x1d10('0x2b')](function(_0x29fd68){_0xefacc6=_0x29fd68;return db[_0x1d10('0x30')][_0x1d10('0x45')]({'where':{'type':_0xc897cb['body']['type']},'raw':!![]});})[_0x1d10('0x2b')](function(_0x3b8b5c){var _0x2ee6fa=fs[_0x1d10('0x4f')](path[_0x1d10('0x50')](config[_0x1d10('0x51')],_0x1d10('0x52')),_0x1d10('0x53'));var _0x880865=ejs['render'](_0x2ee6fa,{'networks':_0x3b8b5c||[]});fs[_0x1d10('0x54')](util[_0x1d10('0x55')]('/etc/asterisk/sip_xcally_%s.conf',_0xc897cb['body'][_0x1d10('0x41')][_0x1d10('0x56')]()),_0x880865);})[_0x1d10('0x2b')](function(){return respondWithRpcPromise('Reload',_0x1d10('0x4c'),{'module':_0x1d10('0x57')});})[_0x1d10('0x2b')](function(){return _0xefacc6;});})[_0x1d10('0x2b')](respondWithResult(_0x227d72,0xc9))['catch'](handleError(_0x227d72,null));};exports[_0x1d10('0x2a')]=function(_0x56a6b8,_0x594000,_0x488aae){var _0x567763;return db[_0x1d10('0x4d')][_0x1d10('0x4e')](function(_0x3b5677){return db[_0x1d10('0x30')][_0x1d10('0x4a')]({'where':{'id':_0x56a6b8[_0x1d10('0x47')]['id']}})['then'](handleEntityNotFound(_0x594000,null))[_0x1d10('0x2b')](saveUpdates(_0x56a6b8[_0x1d10('0x58')],null))[_0x1d10('0x2b')](function(_0x5a4144){if(_0x5a4144){_0x567763=_0x5a4144;return db['Network'][_0x1d10('0x45')]({'where':{'type':_0x567763[_0x1d10('0x41')]},'raw':!![]});}return null;})[_0x1d10('0x2b')](function(_0x3634a6){if(_0x3634a6){var _0x6a4a68=fs['readFileSync'](path['join'](config[_0x1d10('0x51')],_0x1d10('0x52')),'utf8');var _0x5426d1=ejs['render'](_0x6a4a68,{'networks':_0x3634a6||[]});fs[_0x1d10('0x54')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x567763[_0x1d10('0x41')][_0x1d10('0x56')]()),_0x5426d1);return respondWithRpcPromise(_0x1d10('0x59'),_0x1d10('0x2a'),{'module':_0x1d10('0x57')});}return null;})[_0x1d10('0x2b')](function(_0x12fdce){if(_0x12fdce){return _0x567763;}return null;});})[_0x1d10('0x2b')](respondWithResult(_0x594000,null))[_0x1d10('0x4b')](handleError(_0x594000,null));};exports[_0x1d10('0x2c')]=function(_0xcb4fea,_0x1ec49e,_0xa1bf82){var _0x1c6fbe;return db[_0x1d10('0x30')][_0x1d10('0x4a')]({'where':{'id':_0xcb4fea[_0x1d10('0x47')]['id']}})['then'](function(_0xc24e80){_0x1c6fbe=_0xc24e80;return _0xc24e80;})['then'](handleEntityNotFound(_0x1ec49e,null))['then'](removeEntity(_0x1ec49e,null))[_0x1d10('0x2b')](function(){if(_0x1c6fbe){return db[_0x1d10('0x30')][_0x1d10('0x45')]({'where':{'type':_0x1c6fbe[_0x1d10('0x41')]},'raw':!![]});}})['then'](function(_0x1fa9e2){if(_0x1fa9e2){var _0xd82b6b=fs[_0x1d10('0x4f')](path['join'](config[_0x1d10('0x51')],_0x1d10('0x52')),'utf8');var _0x58a3bf=ejs[_0x1d10('0x5a')](_0xd82b6b,{'networks':_0x1fa9e2||[]});fs[_0x1d10('0x54')](util[_0x1d10('0x55')]('/etc/asterisk/sip_xcally_%s.conf',_0x1c6fbe[_0x1d10('0x41')]['toLowerCase']()),_0x58a3bf);return respondWithRpcPromise(_0x1d10('0x59'),_0x1d10('0x2c'),{'module':_0x1d10('0x57')});}})['catch'](handleError(_0x1ec49e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index c3a71c7..a9df448 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 _0x8faa=['bluebird','request-promise','./network.attributes','exports','Network','network','lodash','../../config/logger','api','moment'];(function(_0x510984,_0x187ce7){var _0x410dc8=function(_0x4a94bf){while(--_0x4a94bf){_0x510984['push'](_0x510984['shift']());}};_0x410dc8(++_0x187ce7);}(_0x8faa,0x88));var _0xa8fa=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x8faa[_0x35007a];return _0x574f68;};'use strict';var _=require(_0xa8fa('0x0'));var util=require('util');var logger=require(_0xa8fa('0x1'))(_0xa8fa('0x2'));var moment=require(_0xa8fa('0x3'));var BPromise=require(_0xa8fa('0x4'));var rp=require(_0xa8fa('0x5'));var attributes=require(_0xa8fa('0x6'));module[_0xa8fa('0x7')]=function(_0x383068,_0x25fdcb){return _0x383068['define'](_0xa8fa('0x8'),attributes,{'tableName':_0xa8fa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb22=['request-promise','exports','define','Network','network','lodash','../../config/logger','api'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xcb22,0x1bd));var _0x2cb2=function(_0x3ce9be,_0x3b5e77){_0x3ce9be=_0x3ce9be-0x0;var _0x4b7188=_0xcb22[_0x3ce9be];return _0x4b7188;};'use strict';var _=require(_0x2cb2('0x0'));var util=require('util');var logger=require(_0x2cb2('0x1'))(_0x2cb2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2cb2('0x3'));var attributes=require('./network.attributes');module[_0x2cb2('0x4')]=function(_0x3dd145,_0x48a9ae){return _0x3dd145[_0x2cb2('0x5')](_0x2cb2('0x6'),attributes,{'tableName':_0x2cb2('0x7'),'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 6a1c51f..a65d535 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 _0x0f4d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xdce7b2,_0x522730){var _0x19d53b=function(_0x133b53){while(--_0x133b53){_0xdce7b2['push'](_0xdce7b2['shift']());}};_0x19d53b(++_0x522730);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x2fed09,_0x4e80b3){_0x2fed09=_0x2fed09-0x0;var _0x45bff3=_0x0f4d[_0x2fed09];return _0x45bff3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd0f4('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0f4('0x1'));var db=require(_0xd0f4('0x2'))['db'];var utils=require(_0xd0f4('0x3'));var logger=require(_0xd0f4('0x4'))(_0xd0f4('0x5'));var config=require(_0xd0f4('0x6'));var jayson=require(_0xd0f4('0x7'));var client=jayson[_0xd0f4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1164da,_0x27acb8,_0x4d0ab0){return new BPromise(function(_0x3992be,_0x2a0057){return client['request'](_0x1164da,_0x4d0ab0)[_0xd0f4('0x9')](function(_0x2570f0){logger['info'](_0xd0f4('0xa'),_0x27acb8,_0xd0f4('0xb'));logger[_0xd0f4('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x27acb8,'request\x20sent',JSON[_0xd0f4('0xd')](_0x2570f0));if(_0x2570f0[_0xd0f4('0xe')]){if(_0x2570f0[_0xd0f4('0xe')][_0xd0f4('0xf')]===0x1f4){logger[_0xd0f4('0xe')](_0xd0f4('0xa'),_0x27acb8,_0x2570f0[_0xd0f4('0xe')]['message']);return _0x2a0057(_0x2570f0[_0xd0f4('0xe')][_0xd0f4('0x10')]);}logger['error'](_0xd0f4('0xa'),_0x27acb8,_0x2570f0['error'][_0xd0f4('0x10')]);return _0x3992be(_0x2570f0['error'][_0xd0f4('0x10')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x27acb8,'request\x20sent');_0x3992be(_0x2570f0[_0xd0f4('0x11')][_0xd0f4('0x10')]);}})[_0xd0f4('0x12')](function(_0x46c005){logger[_0xd0f4('0xe')](_0xd0f4('0xa'),_0x27acb8,_0x46c005);_0x2a0057(_0x46c005);});});} \ No newline at end of file +var _0x277c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird'];(function(_0x2e22fe,_0x5d5af1){var _0x435335=function(_0x5dc8e1){while(--_0x5dc8e1){_0x2e22fe['push'](_0x2e22fe['shift']());}};_0x435335(++_0x5d5af1);}(_0x277c,0x153));var _0xc277=function(_0x10fd45,_0x1cfde8){_0x10fd45=_0x10fd45-0x0;var _0x4b97a9=_0x277c[_0x10fd45];return _0x4b97a9;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var moment=require(_0xc277('0x1'));var BPromise=require(_0xc277('0x2'));var rs=require(_0xc277('0x3'));var fs=require('fs');var Redis=require(_0xc277('0x4'));var db=require(_0xc277('0x5'))['db'];var utils=require(_0xc277('0x6'));var logger=require(_0xc277('0x7'))(_0xc277('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc277('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x77e168,_0x54d634,_0x378158){return new BPromise(function(_0x17a2fe,_0x55be1f){return client[_0xc277('0xa')](_0x77e168,_0x378158)[_0xc277('0xb')](function(_0xfdf694){logger[_0xc277('0xc')](_0xc277('0xd'),_0x54d634,_0xc277('0xe'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x54d634,_0xc277('0xe'),JSON[_0xc277('0xf')](_0xfdf694));if(_0xfdf694[_0xc277('0x10')]){if(_0xfdf694[_0xc277('0x10')]['code']===0x1f4){logger[_0xc277('0x10')]('Network,\x20%s,\x20%s',_0x54d634,_0xfdf694[_0xc277('0x10')][_0xc277('0x11')]);return _0x55be1f(_0xfdf694[_0xc277('0x10')][_0xc277('0x11')]);}logger['error'](_0xc277('0xd'),_0x54d634,_0xfdf694[_0xc277('0x10')][_0xc277('0x11')]);return _0x17a2fe(_0xfdf694['error']['message']);}else{logger[_0xc277('0xc')]('Network,\x20%s,\x20%s',_0x54d634,_0xc277('0xe'));_0x17a2fe(_0xfdf694['result'][_0xc277('0x11')]);}})[_0xc277('0x12')](function(_0x15f560){logger['error']('Network,\x20%s,\x20%s',_0x54d634,_0x15f560);_0x55be1f(_0x15f560);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 0f3ab93..f8fe8e9 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 _0x52a9=['/:id/notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x52a9,0x1e0));var _0x952a=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x52a9[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0x952a('0x0'));var util=require(_0x952a('0x1'));var path=require('path');var timeout=require(_0x952a('0x2'));var express=require(_0x952a('0x3'));var router=express[_0x952a('0x4')]();var auth=require(_0x952a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x952a('0x6'));var controller=require(_0x952a('0x7'));router[_0x952a('0x8')]('/',auth[_0x952a('0x9')](),controller[_0x952a('0xa')]);router[_0x952a('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x952a('0xb')]);router[_0x952a('0x8')](_0x952a('0xc'),auth[_0x952a('0x9')](),controller[_0x952a('0xd')]);router[_0x952a('0x8')](_0x952a('0xe'),auth[_0x952a('0x9')](),controller[_0x952a('0xf')]);router['get'](_0x952a('0x10'),auth[_0x952a('0x9')](),controller[_0x952a('0x11')]);router['get'](_0x952a('0x12'),auth[_0x952a('0x9')](),controller[_0x952a('0x13')]);router[_0x952a('0x8')](_0x952a('0x14'),auth['isAuthenticated'](),controller[_0x952a('0x15')]);router['get'](_0x952a('0x16'),auth[_0x952a('0x9')](),controller[_0x952a('0x17')]);router[_0x952a('0x18')]('/',auth[_0x952a('0x9')](),controller[_0x952a('0x19')]);router[_0x952a('0x18')](_0x952a('0xe'),auth[_0x952a('0x9')](),controller[_0x952a('0x1a')]);router[_0x952a('0x18')](_0x952a('0x10'),auth[_0x952a('0x9')](),controller['addAnswer']);router[_0x952a('0x18')](_0x952a('0x1b'),controller['notify']);router[_0x952a('0x18')]('/:id/applications',auth[_0x952a('0x9')](),controller[_0x952a('0x1c')]);router[_0x952a('0x18')]('/:id/users',auth[_0x952a('0x9')](),controller[_0x952a('0x1d')]);router['post'](_0x952a('0x1e'),auth[_0x952a('0x9')](),controller[_0x952a('0x1f')]);router[_0x952a('0x20')]('/:id',auth[_0x952a('0x9')](),controller[_0x952a('0x21')]);router[_0x952a('0x22')]('/:id',auth[_0x952a('0x9')](),controller[_0x952a('0x23')]);router[_0x952a('0x22')]('/:id/dispositions',auth[_0x952a('0x9')](),controller['removeDispositions']);router[_0x952a('0x22')](_0x952a('0x10'),auth[_0x952a('0x9')](),controller[_0x952a('0x24')]);router['delete']('/:id/users',auth[_0x952a('0x9')](),controller[_0x952a('0x25')]);module[_0x952a('0x26')]=router; \ No newline at end of file +var _0xe024=['/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','create','/:id/dispositions','addDisposition','post','/:id/notify','addApplications','addAgents','send','put','update','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe024,0x14d));var _0x4e02=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0xe024[_0x154940];return _0x401409;};'use strict';var multer=require(_0x4e02('0x0'));var util=require(_0x4e02('0x1'));var path=require(_0x4e02('0x2'));var timeout=require(_0x4e02('0x3'));var express=require('express');var router=express[_0x4e02('0x4')]();var auth=require(_0x4e02('0x5'));var interaction=require(_0x4e02('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x4e02('0x7')]('/',auth[_0x4e02('0x8')](),controller[_0x4e02('0x9')]);router[_0x4e02('0x7')](_0x4e02('0xa'),auth['isAuthenticated'](),controller[_0x4e02('0xb')]);router[_0x4e02('0x7')](_0x4e02('0xc'),auth[_0x4e02('0x8')](),controller[_0x4e02('0xd')]);router[_0x4e02('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4e02('0xe')]);router[_0x4e02('0x7')](_0x4e02('0xf'),auth['isAuthenticated'](),controller[_0x4e02('0x10')]);router[_0x4e02('0x7')](_0x4e02('0x11'),auth[_0x4e02('0x8')](),controller['getApplications']);router[_0x4e02('0x7')](_0x4e02('0x12'),auth[_0x4e02('0x8')](),controller[_0x4e02('0x13')]);router[_0x4e02('0x7')](_0x4e02('0x14'),auth[_0x4e02('0x8')](),controller[_0x4e02('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4e02('0x16')]);router['post'](_0x4e02('0x17'),auth['isAuthenticated'](),controller[_0x4e02('0x18')]);router[_0x4e02('0x19')]('/:id/canned_answers',auth[_0x4e02('0x8')](),controller['addAnswer']);router[_0x4e02('0x19')](_0x4e02('0x1a'),controller['notify']);router[_0x4e02('0x19')](_0x4e02('0x11'),auth[_0x4e02('0x8')](),controller[_0x4e02('0x1b')]);router[_0x4e02('0x19')](_0x4e02('0x14'),auth[_0x4e02('0x8')](),controller[_0x4e02('0x1c')]);router[_0x4e02('0x19')]('/:id/send',auth[_0x4e02('0x8')](),controller[_0x4e02('0x1d')]);router[_0x4e02('0x1e')](_0x4e02('0xc'),auth[_0x4e02('0x8')](),controller[_0x4e02('0x1f')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x4e02('0x8')](),controller['removeDispositions']);router[_0x4e02('0x20')](_0x4e02('0xf'),auth[_0x4e02('0x8')](),controller[_0x4e02('0x21')]);router['delete'](_0x4e02('0x14'),auth[_0x4e02('0x8')](),controller[_0x4e02('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index f955d2d..97ec7cb 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 _0x21a6=['name','generate','STRING','BOOLEAN','INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports'];(function(_0x386ddd,_0x17ead6){var _0x1aeeb2=function(_0x397bae){while(--_0x397bae){_0x386ddd['push'](_0x386ddd['shift']());}};_0x1aeeb2(++_0x17ead6);}(_0x21a6,0x13a));var _0x621a=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x21a6[_0x1e4f2f];return _0xccea89;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x621a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x621a('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x621a('0x2')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x621a('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x621a('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x621a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x621a('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x621a('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x621a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x621a('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4db62b){if(!_0x4db62b)this['setDataValue'](_0x621a('0x6'),null);this[_0x621a('0x7')](_0x621a('0x8'),_0x4db62b);}}}; \ No newline at end of file +var _0x5d07=['INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x255dc4,_0x46c9cb){var _0x120dba=function(_0x22bf19){while(--_0x22bf19){_0x255dc4['push'](_0x255dc4['shift']());}};_0x120dba(++_0x46c9cb);}(_0x5d07,0x190));var _0x75d0=function(_0x89351e,_0x19d38d){_0x89351e=_0x89351e-0x0;var _0x3d1518=_0x5d07[_0x89351e];return _0x3d1518;};'use strict';var Sequelize=require(_0x75d0('0x0'));var rs=require(_0x75d0('0x1'));module['exports']={'name':{'type':Sequelize[_0x75d0('0x2')],'unique':_0x75d0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x75d0('0x2')]},'token':{'type':Sequelize[_0x75d0('0x2')],'defaultValue':function(){return rs[_0x75d0('0x4')]();}},'replyUri':{'type':Sequelize[_0x75d0('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x75d0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x75d0('0x5')],'defaultValue':function(){return _0x75d0('0x6');}},'notificationSound':{'type':Sequelize[_0x75d0('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x75d0('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x75d0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x75d0('0x2')]},'queueTransfer':{'type':Sequelize[_0x75d0('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x75d0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x75d0('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x75d0('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x75d0('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x75d0('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2d3c72){if(!_0x2d3c72)this['setDataValue'](_0x75d0('0x9'),null);this[_0x75d0('0xa')](_0x75d0('0xb'),_0x2d3c72);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 61bca9f..520379c 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 _0xae79=['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','describe','addDisposition','OpnechannelAccountId','Disposition','findOne','length','nolimit','pick','OpenchannelAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmContact','DESC','account','applications','Applications','list','orderBy','priority','asc','List','Contacts','defaults','contact','firstName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','lastName','messageId','created','interaction','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','sequelize','transaction','OpenchannelApplication','getApplications','getInteractions','Contact','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','Messages','dataValues','push','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','OpenchannelAccount','rawAttributes','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','merge','map','type','VIRTUAL','field','filter','options','includeAll','findAll','show','params','mandatoryDispositionPause','include'];(function(_0x3db549,_0x49b947){var _0x4d9855=function(_0x516523){while(--_0x516523){_0x3db549['push'](_0x3db549['shift']());}};_0x4d9855(++_0x49b947);}(_0xae79,0x1d3));var _0x9ae7=function(_0x39fb92,_0x17cfdd){_0x39fb92=_0x39fb92-0x0;var _0x226158=_0xae79[_0x39fb92];return _0x226158;};'use strict';var pdf=require(_0x9ae7('0x0'));var emlformat=require(_0x9ae7('0x1'));var rimraf=require(_0x9ae7('0x2'));var zipdir=require(_0x9ae7('0x3'));var jsonpatch=require(_0x9ae7('0x4'));var rp=require(_0x9ae7('0x5'));var moment=require(_0x9ae7('0x6'));var BPromise=require(_0x9ae7('0x7'));var Mustache=require(_0x9ae7('0x8'));var util=require(_0x9ae7('0x9'));var path=require(_0x9ae7('0xa'));var sox=require(_0x9ae7('0xb'));var csv=require(_0x9ae7('0xc'));var ejs=require(_0x9ae7('0xd'));var fs=require('fs');var _=require(_0x9ae7('0xe'));var squel=require('squel');var crypto=require(_0x9ae7('0xf'));var jsforce=require(_0x9ae7('0x10'));var deskjs=require(_0x9ae7('0x11'));var toCsv=require(_0x9ae7('0xc'));var querystring=require(_0x9ae7('0x12'));var Papa=require(_0x9ae7('0x13'));var authService=require('../../components/auth/service');var hardwareService=require(_0x9ae7('0x14'));var Redis=require('ioredis');var qs=require(_0x9ae7('0x15'));var logger=require(_0x9ae7('0x16'))(_0x9ae7('0x17'));var utils=require(_0x9ae7('0x18'));var config=require(_0x9ae7('0x19'));var db=require(_0x9ae7('0x1a'))['db'];config[_0x9ae7('0x1b')]=_['defaults'](config[_0x9ae7('0x1b')],{'host':_0x9ae7('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ae7('0x1b')]));require(_0x9ae7('0x1d'))[_0x9ae7('0x1e')](socket);var jayson=require(_0x9ae7('0x1f'));var client=jayson[_0x9ae7('0x20')][_0x9ae7('0x21')]({'port':0x232c});var client9002=jayson[_0x9ae7('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9b21,_0x3f8a2d,_0x1f8008,_0x44c0bc){return new BPromise(function(_0x533481,_0x109526){var _0xe1a2d1=_0x44c0bc||client;return _0xe1a2d1[_0x9ae7('0x22')](_0x1b9b21,_0x1f8008)['then'](function(_0x47c740){logger[_0x9ae7('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x3f8a2d,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3f8a2d,_0x9ae7('0x24'),JSON[_0x9ae7('0x25')](_0x47c740));if(_0x47c740[_0x9ae7('0x26')]){if(_0x47c740[_0x9ae7('0x26')]['code']===0x1f4){logger[_0x9ae7('0x26')](_0x9ae7('0x27'),_0x3f8a2d,_0x47c740['error'][_0x9ae7('0x28')]);return _0x109526(_0x47c740['error'][_0x9ae7('0x28')]);}logger[_0x9ae7('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x3f8a2d,_0x47c740[_0x9ae7('0x26')]['message']);return _0x533481(_0x47c740['error'][_0x9ae7('0x28')]);}else{logger[_0x9ae7('0x23')](_0x9ae7('0x27'),_0x3f8a2d,_0x9ae7('0x24'));_0x533481(_0x47c740['result'][_0x9ae7('0x28')]);}})[_0x9ae7('0x29')](function(_0x30ddfd){logger[_0x9ae7('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x3f8a2d,_0x30ddfd);_0x109526(_0x30ddfd);});});}function respondWithStatusCode(_0x125403,_0x557030){_0x557030=_0x557030||0xcc;return function(_0x2db31b){if(_0x2db31b){return _0x125403[_0x9ae7('0x2a')](_0x557030);}return _0x125403['status'](_0x557030)['end']();};}function respondWithResult(_0x535c02,_0x49123b){_0x49123b=_0x49123b||0xc8;return function(_0x43f2c9){if(_0x43f2c9){return _0x535c02[_0x9ae7('0x2b')](_0x49123b)['json'](_0x43f2c9);}};}function respondWithFilteredResult(_0x23cca8,_0xf3bdcb){return function(_0x41e4a8){if(_0x41e4a8){var _0x3d3c89=_0x41e4a8[_0x9ae7('0x2c')],_0xa2aca1=_0xf3bdcb['offset'],_0x51527d=_0xf3bdcb[_0x9ae7('0x2d')]+_0xf3bdcb[_0x9ae7('0x2e')],_0x543861;if(_0x51527d>=_0x3d3c89){_0x51527d=_0x3d3c89;_0x543861=0xc8;}else{_0x543861=0xce;}_0x23cca8['status'](_0x543861);return _0x23cca8[_0x9ae7('0x2f')](_0x9ae7('0x30'),_0xa2aca1+'-'+_0x51527d+'/'+_0x3d3c89)[_0x9ae7('0x31')](_0x41e4a8);}return null;};}function patchUpdates(_0x5879cf){return function(_0x23b79d){try{jsonpatch[_0x9ae7('0x32')](_0x23b79d,_0x5879cf,!![]);}catch(_0x168409){return BPromise[_0x9ae7('0x33')](_0x168409);}return _0x23b79d['save']();};}function saveUpdates(_0x4f3ab3,_0x20b51e){return function(_0x1cb825){if(_0x1cb825){return _0x1cb825[_0x9ae7('0x34')](_0x4f3ab3)[_0x9ae7('0x35')](function(_0x1ca369){return _0x1ca369;});}return null;};}function removeEntity(_0xea1e79,_0x299c5b){return function(_0x3369d3){if(_0x3369d3){return _0x3369d3[_0x9ae7('0x36')]()['then'](function(){var _0x3e9231=_0x3369d3[_0x9ae7('0x37')]({'plain':!![]});var _0x4bda33=_0x9ae7('0x38');return db[_0x9ae7('0x39')]['destroy']({'where':{'type':_0x4bda33,'resourceId':_0x3e9231['id']}})['then'](function(){return _0x3369d3;});})['then'](function(){_0xea1e79[_0x9ae7('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fa394,_0x21ea6c){return function(_0x7a2c7c){if(!_0x7a2c7c){_0x1fa394[_0x9ae7('0x2a')](0x194);}return _0x7a2c7c;};}function handleError(_0x21abda,_0x3c1c1e){_0x3c1c1e=_0x3c1c1e||0x1f4;return function(_0x2c52d2){logger[_0x9ae7('0x26')](_0x2c52d2[_0x9ae7('0x3a')]);if(_0x2c52d2['name']){delete _0x2c52d2[_0x9ae7('0x3b')];}_0x21abda[_0x9ae7('0x2b')](_0x3c1c1e)['send'](_0x2c52d2);};}exports[_0x9ae7('0x3c')]=function(_0x4a5239,_0xdfeb97){var _0x39a863={'include':[{'model':db[_0x9ae7('0x3d')],'as':'mandatoryDispositionPause'}]},_0x42faec={},_0x177e20={'count':0x0,'rows':[]};var _0x3c8a64=db[_0x9ae7('0x3e')][_0x9ae7('0x3f')];_0x42faec[_0x9ae7('0x40')]=_['keys'](_0x3c8a64);_0x42faec[_0x9ae7('0x41')]=_[_0x9ae7('0x42')](_0x4a5239[_0x9ae7('0x41')]);_0x42faec['filters']=_[_0x9ae7('0x43')](_0x42faec['model'],_0x42faec[_0x9ae7('0x41')]);_0x39a863[_0x9ae7('0x44')]=_[_0x9ae7('0x43')](_0x42faec[_0x9ae7('0x40')],qs[_0x9ae7('0x45')](_0x4a5239[_0x9ae7('0x41')][_0x9ae7('0x45')]));_0x39a863[_0x9ae7('0x44')]=_0x39a863['attributes']['length']?_0x39a863[_0x9ae7('0x44')]:_0x42faec[_0x9ae7('0x40')];if(!_0x4a5239[_0x9ae7('0x41')][_0x9ae7('0x46')]('nolimit')){_0x39a863[_0x9ae7('0x2e')]=qs['limit'](_0x4a5239[_0x9ae7('0x41')][_0x9ae7('0x2e')]);_0x39a863[_0x9ae7('0x2d')]=qs[_0x9ae7('0x2d')](_0x4a5239[_0x9ae7('0x41')][_0x9ae7('0x2d')]);}_0x39a863[_0x9ae7('0x47')]=qs[_0x9ae7('0x48')](_0x4a5239[_0x9ae7('0x41')]['sort']);_0x39a863[_0x9ae7('0x49')]=qs[_0x9ae7('0x4a')](_['pick'](_0x4a5239[_0x9ae7('0x41')],_0x42faec['filters']));if(_0x4a5239[_0x9ae7('0x41')]['filter']){_0x39a863[_0x9ae7('0x49')]=_[_0x9ae7('0x4b')](_0x39a863[_0x9ae7('0x49')],{'$or':_[_0x9ae7('0x4c')](_0x3c8a64,function(_0x2c0897){if(_0x2c0897[_0x9ae7('0x4d')]['key']!==_0x9ae7('0x4e')){var _0x5cf4b9={};_0x5cf4b9[_0x2c0897[_0x9ae7('0x4f')]]={'$like':'%'+_0x4a5239[_0x9ae7('0x41')][_0x9ae7('0x50')]+'%'};return _0x5cf4b9;}})});}_0x39a863=_[_0x9ae7('0x4b')]({},_0x39a863,_0x4a5239[_0x9ae7('0x51')]);var _0x3a196f={'where':_0x39a863['where']};return db[_0x9ae7('0x3e')][_0x9ae7('0x2c')](_0x3a196f)[_0x9ae7('0x35')](function(_0x41dc9b){_0x177e20[_0x9ae7('0x2c')]=_0x41dc9b;if(_0x4a5239[_0x9ae7('0x41')][_0x9ae7('0x52')]){_0x39a863['include']=[{'all':!![]}];}return db[_0x9ae7('0x3e')][_0x9ae7('0x53')](_0x39a863);})['then'](function(_0x59bd8b){_0x177e20['rows']=_0x59bd8b;return _0x177e20;})[_0x9ae7('0x35')](respondWithFilteredResult(_0xdfeb97,_0x39a863))[_0x9ae7('0x29')](handleError(_0xdfeb97,null));};exports[_0x9ae7('0x54')]=function(_0x1c09fe,_0x38c496){var _0x4ac375={'raw':![],'where':{'id':_0x1c09fe[_0x9ae7('0x55')]['id']},'include':[{'model':db[_0x9ae7('0x3d')],'as':_0x9ae7('0x56')}]},_0xd89ebf={};_0xd89ebf['model']=_['keys'](db[_0x9ae7('0x3e')][_0x9ae7('0x3f')]);_0xd89ebf[_0x9ae7('0x41')]=_[_0x9ae7('0x42')](_0x1c09fe[_0x9ae7('0x41')]);_0xd89ebf[_0x9ae7('0x4a')]=_[_0x9ae7('0x43')](_0xd89ebf['model'],_0xd89ebf[_0x9ae7('0x41')]);_0x4ac375[_0x9ae7('0x44')]=_[_0x9ae7('0x43')](_0xd89ebf[_0x9ae7('0x40')],qs[_0x9ae7('0x45')](_0x1c09fe[_0x9ae7('0x41')][_0x9ae7('0x45')]));_0x4ac375['attributes']=_0x4ac375[_0x9ae7('0x44')]['length']?_0x4ac375['attributes']:_0xd89ebf['model'];if(_0x1c09fe[_0x9ae7('0x41')]['includeAll']){_0x4ac375[_0x9ae7('0x57')]=[{'all':!![]}];}_0x4ac375=_[_0x9ae7('0x4b')]({},_0x4ac375,_0x1c09fe[_0x9ae7('0x51')]);return db['OpenchannelAccount']['find'](_0x4ac375)[_0x9ae7('0x35')](handleEntityNotFound(_0x38c496,null))[_0x9ae7('0x35')](respondWithResult(_0x38c496,null))[_0x9ae7('0x29')](handleError(_0x38c496,null));};exports[_0x9ae7('0x58')]=function(_0xdced3b,_0x124e32){return db[_0x9ae7('0x3e')][_0x9ae7('0x58')](_0xdced3b[_0x9ae7('0x59')],{})['then'](function(_0x543db3){var _0x1253b9=_0xdced3b[_0x9ae7('0x5a')][_0x9ae7('0x37')]({'plain':!![]});if(!_0x1253b9)throw new Error(_0x9ae7('0x5b'));if(_0x1253b9[_0x9ae7('0x5c')]===_0x9ae7('0x5a')){var _0x5ae3f6=_0x543db3[_0x9ae7('0x37')]({'plain':!![]});var _0x325f1f='OpenchannelAccounts';return db[_0x9ae7('0x5d')][_0x9ae7('0x5e')]({'where':{'name':_0x325f1f,'userProfileId':_0x1253b9[_0x9ae7('0x5f')]},'raw':!![]})[_0x9ae7('0x35')](function(_0x112475){if(_0x112475&&_0x112475[_0x9ae7('0x60')]===0x0){return db['UserProfileResource'][_0x9ae7('0x58')]({'name':_0x5ae3f6[_0x9ae7('0x3b')],'resourceId':_0x5ae3f6['id'],'type':_0x112475[_0x9ae7('0x3b')],'sectionId':_0x112475['id']},{})['then'](function(){return _0x543db3;});}else{return _0x543db3;}})[_0x9ae7('0x29')](function(_0x413dc2){logger[_0x9ae7('0x26')](_0x9ae7('0x61'),_0x413dc2);throw _0x413dc2;});}return _0x543db3;})[_0x9ae7('0x35')](respondWithResult(_0x124e32,0xc9))[_0x9ae7('0x29')](handleError(_0x124e32,null));};exports[_0x9ae7('0x34')]=function(_0xd17d23,_0x12af95){if(_0xd17d23[_0x9ae7('0x59')]['id']){delete _0xd17d23[_0x9ae7('0x59')]['id'];}return db[_0x9ae7('0x3e')][_0x9ae7('0x5e')]({'where':{'id':_0xd17d23[_0x9ae7('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x9ae7('0x56')}]})[_0x9ae7('0x35')](handleEntityNotFound(_0x12af95,null))[_0x9ae7('0x35')](saveUpdates(_0xd17d23['body'],null))['then'](respondWithResult(_0x12af95,null))[_0x9ae7('0x29')](handleError(_0x12af95,null));};exports['destroy']=function(_0x5e16ae,_0x4f5e5b){return db[_0x9ae7('0x3e')][_0x9ae7('0x5e')]({'where':{'id':_0x5e16ae['params']['id']}})[_0x9ae7('0x35')](handleEntityNotFound(_0x4f5e5b,null))['then'](removeEntity(_0x4f5e5b,null))[_0x9ae7('0x29')](handleError(_0x4f5e5b,null));};exports[_0x9ae7('0x62')]=function(_0x52e099,_0x380424){return db[_0x9ae7('0x3e')][_0x9ae7('0x62')]()['then'](respondWithResult(_0x380424,null))[_0x9ae7('0x29')](handleError(_0x380424,null));};exports[_0x9ae7('0x63')]=function(_0x16709c,_0x38cf4f,_0x566341){if(_0x16709c[_0x9ae7('0x59')]['id']){delete _0x16709c[_0x9ae7('0x59')]['id'];}return db['OpenchannelAccount'][_0x9ae7('0x5e')]({'where':{'id':_0x16709c['params']['id']}})[_0x9ae7('0x35')](handleEntityNotFound(_0x38cf4f,null))[_0x9ae7('0x35')](function(_0x2a518e){if(_0x2a518e){_0x16709c[_0x9ae7('0x59')][_0x9ae7('0x64')]=_0x2a518e['id'];return db[_0x9ae7('0x65')][_0x9ae7('0x58')](_0x16709c[_0x9ae7('0x59')]);}})[_0x9ae7('0x35')](respondWithResult(_0x38cf4f,null))[_0x9ae7('0x29')](handleError(_0x38cf4f,null));};exports['getDispositions']=function(_0x70d446,_0x12ea53,_0x5404af){var _0x2491e2={'raw':![],'where':{}};var _0x14eab5={};var _0x3bdbc2={'count':0x0,'rows':[]};return db[_0x9ae7('0x3e')][_0x9ae7('0x66')]({'where':{'id':_0x70d446[_0x9ae7('0x55')]['id']}})[_0x9ae7('0x35')](handleEntityNotFound(_0x12ea53,null))[_0x9ae7('0x35')](function(_0x48d64f){if(_0x48d64f){_0x14eab5[_0x9ae7('0x40')]=_[_0x9ae7('0x42')](db[_0x9ae7('0x65')][_0x9ae7('0x3f')]);_0x14eab5[_0x9ae7('0x41')]=_[_0x9ae7('0x42')](_0x70d446[_0x9ae7('0x41')]);_0x14eab5['filters']=_[_0x9ae7('0x43')](_0x14eab5[_0x9ae7('0x40')],_0x14eab5['query']);_0x2491e2[_0x9ae7('0x44')]=_[_0x9ae7('0x43')](_0x14eab5['model'],qs[_0x9ae7('0x45')](_0x70d446['query'][_0x9ae7('0x45')]));_0x2491e2[_0x9ae7('0x44')]=_0x2491e2[_0x9ae7('0x44')][_0x9ae7('0x67')]?_0x2491e2['attributes']:_0x14eab5[_0x9ae7('0x40')];if(!_0x70d446[_0x9ae7('0x41')][_0x9ae7('0x46')](_0x9ae7('0x68'))){_0x2491e2['limit']=qs[_0x9ae7('0x2e')](_0x70d446[_0x9ae7('0x41')][_0x9ae7('0x2e')]);_0x2491e2[_0x9ae7('0x2d')]=qs[_0x9ae7('0x2d')](_0x70d446[_0x9ae7('0x41')][_0x9ae7('0x2d')]);}_0x2491e2['order']=qs[_0x9ae7('0x48')](_0x70d446[_0x9ae7('0x41')]['sort']);_0x2491e2[_0x9ae7('0x49')]=qs[_0x9ae7('0x4a')](_[_0x9ae7('0x69')](_0x70d446[_0x9ae7('0x41')],_0x14eab5[_0x9ae7('0x4a')]));_0x2491e2[_0x9ae7('0x49')][_0x9ae7('0x6a')]=_0x48d64f['id'];if(_0x70d446['query'][_0x9ae7('0x50')]){_0x2491e2['where']=_[_0x9ae7('0x4b')](_0x2491e2[_0x9ae7('0x49')],{'$or':_[_0x9ae7('0x4c')](_0x2491e2[_0x9ae7('0x44')],function(_0x4fd05a){var _0x66748d={};_0x66748d[_0x4fd05a]={'$like':'%'+_0x70d446[_0x9ae7('0x41')]['filter']+'%'};return _0x66748d;})});}_0x2491e2=_[_0x9ae7('0x4b')]({},_0x2491e2,_0x70d446[_0x9ae7('0x51')]);return db[_0x9ae7('0x65')][_0x9ae7('0x2c')]({'where':_0x2491e2[_0x9ae7('0x49')]})['then'](function(_0x4de70){_0x3bdbc2['count']=_0x4de70;if(_0x70d446['query'][_0x9ae7('0x52')]){_0x2491e2[_0x9ae7('0x57')]=[{'all':!![]}];}return db[_0x9ae7('0x65')][_0x9ae7('0x53')](_0x2491e2);})[_0x9ae7('0x35')](function(_0x53fd3d){_0x3bdbc2[_0x9ae7('0x6b')]=_0x53fd3d;return _0x3bdbc2;});}})['then'](respondWithFilteredResult(_0x12ea53,_0x2491e2))['catch'](handleError(_0x12ea53,null));};exports['removeDispositions']=function(_0x97dcf7,_0x2b2e97,_0x1de7be){var _0x2d4d19;return db[_0x9ae7('0x3e')]['find']({'where':{'id':_0x97dcf7[_0x9ae7('0x55')]['id']}})[_0x9ae7('0x35')](handleEntityNotFound(_0x2b2e97,null))['then'](function(_0x44bbbf){if(_0x44bbbf){return _0x44bbbf[_0x9ae7('0x6c')](_0x97dcf7['query'][_0x9ae7('0x6d')]);}})['then'](respondWithStatusCode(_0x2b2e97,null))[_0x9ae7('0x29')](handleError(_0x2b2e97,null));};exports[_0x9ae7('0x6e')]=function(_0x4179dc,_0xca5cc5,_0x58d5ed){if(_0x4179dc['body']['id']){delete _0x4179dc[_0x9ae7('0x59')]['id'];}return db[_0x9ae7('0x3e')]['find']({'where':{'id':_0x4179dc[_0x9ae7('0x55')]['id']}})[_0x9ae7('0x35')](handleEntityNotFound(_0xca5cc5,null))[_0x9ae7('0x35')](function(_0x2c491c){if(_0x2c491c){_0x4179dc[_0x9ae7('0x59')][_0x9ae7('0x6a')]=_0x2c491c['id'];return db[_0x9ae7('0x6f')]['create'](_0x4179dc[_0x9ae7('0x59')]);}})[_0x9ae7('0x35')](respondWithResult(_0xca5cc5,null))[_0x9ae7('0x29')](handleError(_0xca5cc5,null));};exports[_0x9ae7('0x70')]=function(_0x19e411,_0x5a727a,_0x177499){var _0x442308={'raw':![],'where':{}};var _0x49f55a={};var _0xd306f0={'count':0x0,'rows':[]};return db[_0x9ae7('0x3e')][_0x9ae7('0x66')]({'where':{'id':_0x19e411[_0x9ae7('0x55')]['id']}})[_0x9ae7('0x35')](handleEntityNotFound(_0x5a727a,null))[_0x9ae7('0x35')](function(_0x34b168){if(_0x34b168){_0x49f55a[_0x9ae7('0x40')]=_[_0x9ae7('0x42')](db[_0x9ae7('0x6f')][_0x9ae7('0x3f')]);_0x49f55a['query']=_['keys'](_0x19e411['query']);_0x49f55a[_0x9ae7('0x4a')]=_[_0x9ae7('0x43')](_0x49f55a['model'],_0x49f55a[_0x9ae7('0x41')]);_0x442308[_0x9ae7('0x44')]=_[_0x9ae7('0x43')](_0x49f55a[_0x9ae7('0x40')],qs[_0x9ae7('0x45')](_0x19e411[_0x9ae7('0x41')][_0x9ae7('0x45')]));_0x442308[_0x9ae7('0x44')]=_0x442308[_0x9ae7('0x44')]['length']?_0x442308[_0x9ae7('0x44')]:_0x49f55a['model'];if(!_0x19e411['query']['hasOwnProperty']('nolimit')){_0x442308[_0x9ae7('0x2e')]=qs[_0x9ae7('0x2e')](_0x19e411[_0x9ae7('0x41')][_0x9ae7('0x2e')]);_0x442308['offset']=qs[_0x9ae7('0x2d')](_0x19e411[_0x9ae7('0x41')][_0x9ae7('0x2d')]);}_0x442308[_0x9ae7('0x47')]=qs[_0x9ae7('0x48')](_0x19e411[_0x9ae7('0x41')][_0x9ae7('0x48')]);_0x442308[_0x9ae7('0x49')]=qs[_0x9ae7('0x4a')](_[_0x9ae7('0x69')](_0x19e411['query'],_0x49f55a[_0x9ae7('0x4a')]));_0x442308[_0x9ae7('0x49')][_0x9ae7('0x6a')]=_0x34b168['id'];if(_0x19e411[_0x9ae7('0x41')][_0x9ae7('0x50')]){_0x442308[_0x9ae7('0x49')]=_[_0x9ae7('0x4b')](_0x442308[_0x9ae7('0x49')],{'$or':_[_0x9ae7('0x4c')](_0x442308[_0x9ae7('0x44')],function(_0x21344b){var _0x264ef4={};_0x264ef4[_0x21344b]={'$like':'%'+_0x19e411[_0x9ae7('0x41')][_0x9ae7('0x50')]+'%'};return _0x264ef4;})});}_0x442308=_[_0x9ae7('0x4b')]({},_0x442308,_0x19e411[_0x9ae7('0x51')]);return db['CannedAnswer'][_0x9ae7('0x2c')]({'where':_0x442308[_0x9ae7('0x49')]})[_0x9ae7('0x35')](function(_0xe88db7){_0xd306f0[_0x9ae7('0x2c')]=_0xe88db7;if(_0x19e411[_0x9ae7('0x41')][_0x9ae7('0x52')]){_0x442308['include']=[{'all':!![]}];}return db[_0x9ae7('0x6f')]['findAll'](_0x442308);})[_0x9ae7('0x35')](function(_0x4c0492){_0xd306f0['rows']=_0x4c0492;return _0xd306f0;});}})[_0x9ae7('0x35')](respondWithFilteredResult(_0x5a727a,_0x442308))[_0x9ae7('0x29')](handleError(_0x5a727a,null));};exports[_0x9ae7('0x71')]=function(_0x2a95e3,_0x36a0cd,_0x11fcef){var _0x27d15e;return db[_0x9ae7('0x3e')]['find']({'where':{'id':_0x2a95e3[_0x9ae7('0x55')]['id']}})['then'](handleEntityNotFound(_0x36a0cd,null))[_0x9ae7('0x35')](function(_0x291576){if(_0x291576){return _0x291576[_0x9ae7('0x71')](_0x2a95e3[_0x9ae7('0x41')][_0x9ae7('0x6d')]);}})[_0x9ae7('0x35')](respondWithStatusCode(_0x36a0cd,null))[_0x9ae7('0x29')](handleError(_0x36a0cd,null));};exports[_0x9ae7('0x72')]=function(_0x4ae32d,_0x2c8a57,_0x1717b8){var _0x2100c7={'body':_0x4ae32d[_0x9ae7('0x59')],'channel':'openchannel'};var _0x599da3=[];var _0x587d34=[];var _0x4b663f={};var _0xf0d4ea=![];return db['CmContact'][_0x9ae7('0x62')]()[_0x9ae7('0x35')](function(_0x49d8d8){if(!_0x49d8d8){throw new db[(_0x9ae7('0x73'))][(_0x9ae7('0x74'))](_0x9ae7('0x75'));}_0x599da3=_[_0x9ae7('0x76')](_[_0x9ae7('0x42')](_0x49d8d8),[_0x9ae7('0x77'),_0x9ae7('0x78')]);_0x587d34=_['difference'](_[_0x9ae7('0x42')](_0x49d8d8),[_0x9ae7('0x77'),'updatedAt','CompanyId',_0x9ae7('0x79')]);if(_0x4ae32d[_0x9ae7('0x59')]['id']){delete _0x4ae32d[_0x9ae7('0x59')]['id'];}if(_[_0x9ae7('0x7a')](_0x4ae32d[_0x9ae7('0x59')]['from'])){throw new db['Sequelize'][(_0x9ae7('0x74'))](_0x9ae7('0x7b'));}if(_[_0x9ae7('0x7a')](_0x4ae32d[_0x9ae7('0x59')]['body'])||_0x4ae32d[_0x9ae7('0x59')][_0x9ae7('0x59')]===''){throw new db[(_0x9ae7('0x73'))][(_0x9ae7('0x74'))](_0x9ae7('0x7c'));}if(_[_0x9ae7('0x7a')](_0x4ae32d['body'][_0x9ae7('0x7d')])){throw new db[(_0x9ae7('0x73'))][(_0x9ae7('0x74'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x587d34);}if(!_[_0x9ae7('0x7e')](_0x587d34,_0x4ae32d[_0x9ae7('0x59')]['mapKey'])){throw new db[(_0x9ae7('0x73'))]['ValidationError'](_0x9ae7('0x7f')+_0x587d34);}_0x4b663f[_0x4ae32d['body'][_0x9ae7('0x7d')]]=_0x4ae32d[_0x9ae7('0x59')][_0x9ae7('0x80')];})['then'](function(){return db[_0x9ae7('0x3e')][_0x9ae7('0x5e')]({'where':{'id':_0x4ae32d['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9ae7('0x81')],'as':'Contacts','where':_0x4b663f,'limit':0x1,'order':[[_0x9ae7('0x78'),_0x9ae7('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x2c8a57,null))[_0x9ae7('0x35')](function(_0x4f1855){if(_0x4f1855&&_0x4f1855['List']){_0x2100c7[_0x9ae7('0x83')]=_0x4f1855;_0x2100c7[_0x9ae7('0x84')]=_0x4f1855[_0x9ae7('0x85')];_0x2100c7[_0x9ae7('0x86')]=_0x4f1855['List'];_0x2100c7[_0x9ae7('0x84')]=_[_0x9ae7('0x87')](_0x2100c7[_0x9ae7('0x84')],[_0x9ae7('0x88')],[_0x9ae7('0x89')]);if(_0x2100c7[_0x9ae7('0x83')][_0x9ae7('0x85')]){delete _0x2100c7[_0x9ae7('0x83')][_0x9ae7('0x85')];}if(_0x2100c7[_0x9ae7('0x83')][_0x9ae7('0x8a')]&&_0x2100c7[_0x9ae7('0x83')][_0x9ae7('0x8a')][_0x9ae7('0x8b')][_0x9ae7('0x67')]){return _0x2100c7[_0x9ae7('0x83')][_0x9ae7('0x8a')][_0x9ae7('0x8b')][0x0];}var _0x4dd22d=_[_0x9ae7('0x8c')](_0x4ae32d[_0x9ae7('0x59')],{'firstName':_0x4ae32d[_0x9ae7('0x59')]['from'],'ListId':_0x4f1855[_0x9ae7('0x79')]});_0x4dd22d[_0x4ae32d['body'][_0x9ae7('0x7d')]]=_0x4ae32d[_0x9ae7('0x59')][_0x9ae7('0x80')];return db['CmContact'][_0x9ae7('0x58')](_0x4dd22d,{'fields':_0x599da3,'raw':!![]});}})[_0x9ae7('0x35')](handleEntityNotFound(_0x2c8a57,null))[_0x9ae7('0x35')](function(_0x55ad7e){_0x2100c7[_0x9ae7('0x8d')]=_0x55ad7e;if(_0x55ad7e){var _0x4649af={'ContactId':_0x55ad7e['id'],'OpenchannelAccountId':_0x4ae32d[_0x9ae7('0x55')]['id'],'from':(_0x55ad7e[_0x9ae7('0x8e')]||'')+'\x20'+(_0x55ad7e['lastName']||'')};var _0x7b857={'OpenchannelAccountId':_0x4ae32d[_0x9ae7('0x55')]['id'],'closed':![]};if(_0x4ae32d[_0x9ae7('0x59')]['threadId']){_0x7b857[_0x9ae7('0x8f')]=_0x4ae32d['body'][_0x9ae7('0x8f')];return db['OpenchannelInteraction']['find']({'where':_0x7b857})['then'](function(_0x33245f){if(_0x33245f){return[_0x33245f,![]];}_0x4649af[_0x9ae7('0x8f')]=_0x4ae32d[_0x9ae7('0x59')]['threadId'];_0x4649af[_0x9ae7('0x90')]=_0x4ae32d[_0x9ae7('0x59')][_0x9ae7('0x90')];return db[_0x9ae7('0x91')][_0x9ae7('0x58')](_0x4649af)[_0x9ae7('0x35')](function(_0x5808ab){return[_0x5808ab,!![]];});});}else{_0x7b857[_0x9ae7('0x8f')]=null;}_0x7b857[_0x9ae7('0x92')]=_0x55ad7e['id'];return db[_0x9ae7('0x91')][_0x9ae7('0x5e')]({'where':_0x7b857})[_0x9ae7('0x35')](function(_0xe2d145){if(_0xe2d145){return[_0xe2d145,![]];}return db['OpenchannelInteraction'][_0x9ae7('0x58')](_0x4649af)[_0x9ae7('0x35')](function(_0x4d1a74){return[_0x4d1a74,!![]];});});}})[_0x9ae7('0x93')](function(_0x49f982,_0x483f96){if(_0x49f982){_0xf0d4ea=_0x483f96;if(!_0x483f96){var _0x4539c1={'from':(_0x2100c7[_0x9ae7('0x8d')][_0x9ae7('0x8e')]||'')+'\x20'+(_0x2100c7[_0x9ae7('0x8d')][_0x9ae7('0x94')]||'')};if(_0x4ae32d[_0x9ae7('0x59')]['threadId']&&_0x4ae32d[_0x9ae7('0x59')][_0x9ae7('0x95')]&&_0x4ae32d['body'][_0x9ae7('0x8f')]!=_0x4ae32d[_0x9ae7('0x59')][_0x9ae7('0x95')]){_0x4539c1[_0x9ae7('0x8f')]=_0x4ae32d[_0x9ae7('0x59')]['messageId'];}return _0x49f982[_0x9ae7('0x34')](_0x4539c1);}else{return _0x49f982;}}})[_0x9ae7('0x35')](function(_0x34d315){_0x2100c7['interaction']=_0x34d315[_0x9ae7('0x37')]({'plain':!![]});_0x2100c7['interaction'][_0x9ae7('0x96')]=_0xf0d4ea;if(_0x2100c7[_0x9ae7('0x97')][_0x9ae7('0x96')]){if(_0x2100c7[_0x9ae7('0x83')]['autoclose']){_0x2100c7[_0x9ae7('0x84')]['push']({'id':0x0,'priority':_0x2100c7[_0x9ae7('0x84')][_0x9ae7('0x67')]+0x1,'app':'close','appdata':_0x9ae7('0x98'),'interval':_0x9ae7('0x99')});}}return db[_0x9ae7('0x9a')][_0x9ae7('0x58')]({'body':_0x4ae32d[_0x9ae7('0x59')][_0x9ae7('0x59')],'OpenchannelAccountId':_0x4ae32d[_0x9ae7('0x55')]['id'],'OpenchannelInteractionId':_0x34d315['id'],'direction':'in','ContactId':_0x2100c7[_0x9ae7('0x8d')]['id'],'AttachmentId':_0x4ae32d['body'][_0x9ae7('0x9b')]});})['then'](function(_0x3dd62a){_0x2100c7[_0x9ae7('0x28')]=_0x3dd62a;if(_0x2100c7[_0x9ae7('0x97')][_0x9ae7('0x9c')]){return db[_0x9ae7('0x9d')][_0x9ae7('0x5e')]({'attributes':['id',_0x9ae7('0x3b')],'where':{'id':_0x2100c7[_0x9ae7('0x97')][_0x9ae7('0x9c')]}})['then'](function(_0x184f34){if(_0x184f34){_0x2100c7[_0x9ae7('0x84')][_0x9ae7('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x184f34['name']+','+(_0x2100c7[_0x9ae7('0x83')][_0x9ae7('0x9f')]||0xa),'interval':'*,*,*,*'});_0x2100c7['forcedOwnership']=![];}return respondWithRpcPromise(_0x9ae7('0xa0'),_0x9ae7('0xa1'),_0x2100c7);});}return respondWithRpcPromise('Start','startRouting',_0x2100c7);})['then'](function(_0x3d191b){respondWithRpcPromise(_0x9ae7('0xa2'),_0x9ae7('0xa2'),{'event':_0x9ae7('0x72'),'message':_0x3d191b},client9002);return _0x3d191b;})[_0x9ae7('0x35')](respondWithResult(_0x2c8a57,null))[_0x9ae7('0x29')](handleError(_0x2c8a57,null));};exports['addApplications']=function(_0x9716f0,_0x3a59a8,_0x3aa74d){return db[_0x9ae7('0x3e')][_0x9ae7('0x66')]({'where':{'id':_0x9716f0[_0x9ae7('0x55')]['id']}})['then'](handleEntityNotFound(_0x3a59a8,null))[_0x9ae7('0x35')](function(_0x58dad4){if(_0x58dad4){return db[_0x9ae7('0xa3')][_0x9ae7('0xa4')](function(_0x31152e){return db[_0x9ae7('0xa5')][_0x9ae7('0x36')]({'where':{'OpenchannelAccountId':_0x9716f0[_0x9ae7('0x55')]['id']},'transaction':_0x31152e})[_0x9ae7('0x35')](function(_0x2907dc){var _0x138263=_['map'](_0x9716f0[_0x9ae7('0x59')],function(_0xe9b8a9){_0xe9b8a9[_0x9ae7('0x6a')]=_0x9716f0['params']['id'];return _0xe9b8a9;});return db['OpenchannelApplication']['bulkCreate'](_0x138263,{'transaction':_0x31152e});});})['then'](function(){return db[_0x9ae7('0xa5')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x9716f0[_0x9ae7('0x55')]['id']},'order':'priority'});});}})[_0x9ae7('0x35')](respondWithResult(_0x3a59a8,null))[_0x9ae7('0x29')](handleError(_0x3a59a8,null));};exports['getApplications']=function(_0x3776b2,_0x301597,_0xb0d1d7){var _0x1b1be8={};var _0x4bd9cf={};var _0x118e81;var _0x9c1c5e;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3776b2['params']['id']}})[_0x9ae7('0x35')](handleEntityNotFound(_0x301597,null))[_0x9ae7('0x35')](function(_0x3fb83e){if(_0x3fb83e){_0x118e81=_0x3fb83e;_0x4bd9cf[_0x9ae7('0x40')]=_[_0x9ae7('0x42')](db['OpenchannelApplication']['rawAttributes']);_0x4bd9cf[_0x9ae7('0x41')]=_[_0x9ae7('0x42')](_0x3776b2[_0x9ae7('0x41')]);_0x4bd9cf['filters']=_[_0x9ae7('0x43')](_0x4bd9cf[_0x9ae7('0x40')],_0x4bd9cf['query']);_0x1b1be8[_0x9ae7('0x44')]=_['intersection'](_0x4bd9cf[_0x9ae7('0x40')],qs[_0x9ae7('0x45')](_0x3776b2[_0x9ae7('0x41')]['fields']));_0x1b1be8[_0x9ae7('0x44')]=_0x1b1be8[_0x9ae7('0x44')][_0x9ae7('0x67')]?_0x1b1be8[_0x9ae7('0x44')]:_0x4bd9cf[_0x9ae7('0x40')];_0x1b1be8[_0x9ae7('0x47')]=qs[_0x9ae7('0x48')](_0x3776b2['query'][_0x9ae7('0x48')]);_0x1b1be8[_0x9ae7('0x49')]=qs[_0x9ae7('0x4a')](_[_0x9ae7('0x69')](_0x3776b2[_0x9ae7('0x41')],_0x4bd9cf[_0x9ae7('0x4a')]));if(_0x3776b2[_0x9ae7('0x41')]['filter']){_0x1b1be8[_0x9ae7('0x49')]=_[_0x9ae7('0x4b')](_0x1b1be8['where'],{'$or':_[_0x9ae7('0x4c')](_0x1b1be8[_0x9ae7('0x44')],function(_0x70a0f9){var _0x11e3ed={};_0x11e3ed[_0x70a0f9]={'$like':'%'+_0x3776b2[_0x9ae7('0x41')]['filter']+'%'};return _0x11e3ed;})});}_0x1b1be8=_['merge']({},_0x1b1be8,_0x3776b2['options']);return _0x118e81[_0x9ae7('0xa6')](_0x1b1be8);}})[_0x9ae7('0x35')](function(_0x1ba916){if(_0x1ba916){_0x9c1c5e=_0x1ba916[_0x9ae7('0x67')];if(!_0x3776b2[_0x9ae7('0x41')][_0x9ae7('0x46')](_0x9ae7('0x68'))){_0x1b1be8[_0x9ae7('0x2e')]=qs[_0x9ae7('0x2e')](_0x3776b2[_0x9ae7('0x41')][_0x9ae7('0x2e')]);_0x1b1be8['offset']=qs[_0x9ae7('0x2d')](_0x3776b2[_0x9ae7('0x41')][_0x9ae7('0x2d')]);}return _0x118e81[_0x9ae7('0xa6')](_0x1b1be8);}})[_0x9ae7('0x35')](function(_0x191b10){if(_0x191b10){return _0x191b10?{'count':_0x9c1c5e,'rows':_0x191b10}:null;}})[_0x9ae7('0x35')](respondWithResult(_0x301597,null))[_0x9ae7('0x29')](handleError(_0x301597,null));};exports[_0x9ae7('0xa7')]=function(_0x551566,_0x1164b9,_0xcc4457){var _0x208634={'raw':![],'where':{}};var _0x115b7d={};var _0x8c5811={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9ae7('0x66')]({'where':{'id':_0x551566['params']['id']}})['then'](handleEntityNotFound(_0x1164b9,null))[_0x9ae7('0x35')](function(_0x17be2c){if(_0x17be2c){_0x115b7d[_0x9ae7('0x40')]=_[_0x9ae7('0x42')](db[_0x9ae7('0x91')]['rawAttributes']);_0x115b7d[_0x9ae7('0x41')]=_[_0x9ae7('0x42')](_0x551566[_0x9ae7('0x41')]);_0x115b7d[_0x9ae7('0x4a')]=_['intersection'](_0x115b7d[_0x9ae7('0x40')],_0x115b7d[_0x9ae7('0x41')]);_0x208634[_0x9ae7('0x44')]=_[_0x9ae7('0x43')](_0x115b7d['model'],qs[_0x9ae7('0x45')](_0x551566[_0x9ae7('0x41')][_0x9ae7('0x45')]));_0x208634['attributes']=_0x208634[_0x9ae7('0x44')]['length']?_0x208634[_0x9ae7('0x44')]:_0x115b7d[_0x9ae7('0x40')];if(!_0x551566[_0x9ae7('0x41')][_0x9ae7('0x46')](_0x9ae7('0x68'))){_0x208634[_0x9ae7('0x2e')]=qs[_0x9ae7('0x2e')](_0x551566[_0x9ae7('0x41')][_0x9ae7('0x2e')]);_0x208634['offset']=qs[_0x9ae7('0x2d')](_0x551566[_0x9ae7('0x41')]['offset']);}_0x208634[_0x9ae7('0x47')]=qs[_0x9ae7('0x48')](_0x551566['query'][_0x9ae7('0x48')]);_0x208634['where']=qs[_0x9ae7('0x4a')](_[_0x9ae7('0x69')](_0x551566[_0x9ae7('0x41')],_0x115b7d[_0x9ae7('0x4a')]));_0x208634[_0x9ae7('0x49')][_0x9ae7('0x6a')]=_0x17be2c['id'];if(_0x551566['query'][_0x9ae7('0x50')]){_0x208634[_0x9ae7('0x49')]=_[_0x9ae7('0x4b')](_0x208634[_0x9ae7('0x49')],{'$or':_[_0x9ae7('0x4c')](_0x208634['attributes'],function(_0x543cf0){var _0x4aac06={};_0x4aac06[_0x543cf0]={'$like':'%'+_0x551566['query']['filter']+'%'};return _0x4aac06;})});}_0x208634=_[_0x9ae7('0x4b')]({},_0x208634,_0x551566['options']);return db[_0x9ae7('0x91')][_0x9ae7('0x2c')]({'where':_0x208634['where']})[_0x9ae7('0x35')](function(_0x164853){_0x8c5811[_0x9ae7('0x2c')]=_0x164853;if(_0x551566[_0x9ae7('0x41')][_0x9ae7('0x52')]){_0x208634['include']=[{'model':db['CmContact'],'as':_0x9ae7('0xa8'),'required':![]},{'model':db[_0x9ae7('0x9d')],'as':'Owner','attributes':[_0x9ae7('0x3b'),'fullname','internal'],'required':![]},{'model':db[_0x9ae7('0xa9')],'as':_0x9ae7('0xaa'),'attributes':['id',_0x9ae7('0x3b'),_0x9ae7('0xab')],'where':_0x551566[_0x9ae7('0x41')][_0x9ae7('0xac')]?{'id':_0x551566[_0x9ae7('0x41')][_0x9ae7('0xac')]}:undefined,'required':_0x551566[_0x9ae7('0x41')][_0x9ae7('0xac')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x9ae7('0x53')](_0x208634);})[_0x9ae7('0x35')](function(_0xabb755){_0x8c5811[_0x9ae7('0x6b')]=_0xabb755;return _0x8c5811;});}})[_0x9ae7('0x35')](respondWithFilteredResult(_0x1164b9,_0x208634))[_0x9ae7('0x29')](handleError(_0x1164b9,null));};exports[_0x9ae7('0xad')]=function(_0x51a91c,_0x5ed2fa,_0x2615ae){return db[_0x9ae7('0x3e')][_0x9ae7('0x5e')]({'where':{'id':_0x51a91c[_0x9ae7('0x55')]['id']}})[_0x9ae7('0x35')](handleEntityNotFound(_0x5ed2fa,null))[_0x9ae7('0x35')](function(_0xde1b81){if(_0xde1b81){return _0xde1b81['addAgents'](_0x51a91c['body']['ids'],_[_0x9ae7('0xae')](_0x51a91c['body'],[_0x9ae7('0x6d'),'id'])||{})[_0x9ae7('0x93')](function(_0x25e62b){for(var _0xf2738b=0x0;_0xf2738b<_0x51a91c['body'][_0x9ae7('0x6d')][_0x9ae7('0x67')];_0xf2738b+=0x1){socket[_0x9ae7('0xaf')](_0x9ae7('0xb0'),{'UserId':_0x51a91c['body'][_0x9ae7('0x6d')][_0xf2738b],'OpenchannelAccountId':_0x51a91c[_0x9ae7('0x55')]['id']});}return _0x25e62b;});}})[_0x9ae7('0x35')](respondWithResult(_0x5ed2fa,null))[_0x9ae7('0x29')](handleError(_0x5ed2fa,null));};exports[_0x9ae7('0xb1')]=function(_0x245234,_0x13bc99,_0x387c70){var _0x28276b;return db[_0x9ae7('0x3e')][_0x9ae7('0x5e')]({'where':{'id':_0x245234[_0x9ae7('0x55')]['id']}})['then'](handleEntityNotFound(_0x13bc99,null))[_0x9ae7('0x35')](function(_0x154615){if(_0x154615){return _0x154615[_0x9ae7('0xb1')](_0x245234[_0x9ae7('0x41')][_0x9ae7('0x6d')])['then'](function(_0x4d5bb5){if(_[_0x9ae7('0xb2')](_0x245234['query'][_0x9ae7('0x6d')])){for(var _0x280e1c=0x0;_0x280e1c<_0x245234[_0x9ae7('0x41')][_0x9ae7('0x6d')][_0x9ae7('0x67')];_0x280e1c+=0x1){socket[_0x9ae7('0xaf')](_0x9ae7('0xb3'),{'UserId':_0x245234['query'][_0x9ae7('0x6d')][_0x280e1c],'OpenchannelAccountId':_0x245234['params']['id']});}}else{socket['emit'](_0x9ae7('0xb3'),{'UserId':_0x245234[_0x9ae7('0x41')]['ids'],'OpenchannelAccountId':_0x245234['params']['id']});}});}})[_0x9ae7('0x35')](respondWithStatusCode(_0x13bc99,null))['catch'](handleError(_0x13bc99,null));};exports[_0x9ae7('0xb4')]=function(_0x35173a,_0x445a64,_0x491429){var _0x1d8eb9={};var _0x3d4a74={};var _0x48393d;var _0x17c56c;return db[_0x9ae7('0x3e')][_0x9ae7('0x66')]({'where':{'id':_0x35173a['params']['id']}})['then'](handleEntityNotFound(_0x445a64,null))[_0x9ae7('0x35')](function(_0x4c41ae){if(_0x4c41ae){_0x48393d=_0x4c41ae;_0x3d4a74[_0x9ae7('0x40')]=_[_0x9ae7('0x42')](db['User'][_0x9ae7('0x3f')]);_0x3d4a74['query']=_['keys'](_0x35173a[_0x9ae7('0x41')]);_0x3d4a74[_0x9ae7('0x4a')]=_[_0x9ae7('0x43')](_0x3d4a74[_0x9ae7('0x40')],_0x3d4a74[_0x9ae7('0x41')]);_0x1d8eb9['attributes']=_[_0x9ae7('0x43')](_0x3d4a74[_0x9ae7('0x40')],qs[_0x9ae7('0x45')](_0x35173a['query']['fields']));_0x1d8eb9[_0x9ae7('0x44')]=_0x1d8eb9[_0x9ae7('0x44')]['length']?_0x1d8eb9[_0x9ae7('0x44')]:_0x3d4a74[_0x9ae7('0x40')];_0x1d8eb9['order']=qs['sort'](_0x35173a[_0x9ae7('0x41')][_0x9ae7('0x48')]);_0x1d8eb9[_0x9ae7('0x49')]=qs[_0x9ae7('0x4a')](_['pick'](_0x35173a[_0x9ae7('0x41')],_0x3d4a74[_0x9ae7('0x4a')]));if(_0x35173a['query'][_0x9ae7('0x50')]){_0x1d8eb9[_0x9ae7('0x49')]=_['merge'](_0x1d8eb9[_0x9ae7('0x49')],{'$or':_[_0x9ae7('0x4c')](_0x1d8eb9['attributes'],function(_0x4169eb){var _0x15cdf2={};_0x15cdf2[_0x4169eb]={'$like':'%'+_0x35173a['query'][_0x9ae7('0x50')]+'%'};return _0x15cdf2;})});}_0x1d8eb9=_[_0x9ae7('0x4b')]({},_0x1d8eb9,_0x35173a[_0x9ae7('0x51')]);return _0x48393d[_0x9ae7('0xb4')](_0x1d8eb9);}})[_0x9ae7('0x35')](function(_0x158c25){if(_0x158c25){_0x17c56c=_0x158c25['length'];if(!_0x35173a['query']['hasOwnProperty']('nolimit')){_0x1d8eb9['limit']=qs['limit'](_0x35173a[_0x9ae7('0x41')][_0x9ae7('0x2e')]);_0x1d8eb9[_0x9ae7('0x2d')]=qs[_0x9ae7('0x2d')](_0x35173a['query'][_0x9ae7('0x2d')]);}return _0x48393d[_0x9ae7('0xb4')](_0x1d8eb9);}})[_0x9ae7('0x35')](function(_0x3df135){if(_0x3df135){return _0x3df135?{'count':_0x17c56c,'rows':_0x3df135}:null;}})[_0x9ae7('0x35')](respondWithResult(_0x445a64,null))[_0x9ae7('0x29')](handleError(_0x445a64,null));};exports[_0x9ae7('0xb5')]=function(_0x1cc9d2,_0x2ef00f,_0x38594f){var _0x4d54d7,_0x2d5cf3,_0x569ccf;if(_[_0x9ae7('0x7a')](_0x1cc9d2[_0x9ae7('0x59')]['body'])||_0x1cc9d2['body'][_0x9ae7('0x59')]===''){throw new db[(_0x9ae7('0x73'))][(_0x9ae7('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1cc9d2[_0x9ae7('0x59')]['to'])){}_0x4d54d7=_0x1cc9d2['body']['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1cc9d2[_0x9ae7('0x55')]['id']}})[_0x9ae7('0x35')](handleEntityNotFound(_0x2ef00f,null))[_0x9ae7('0x35')](function(_0x3487ed){if(_0x3487ed){return db[_0x9ae7('0x3e')]['find']({'where':{'id':_0x3487ed['id']},'include':[{'model':db['CmList'],'as':_0x9ae7('0x8a'),'include':[{'model':db[_0x9ae7('0x81')],'as':_0x9ae7('0x8b'),'where':{[_0x3487ed[_0x9ae7('0x7d')]]:_0x4d54d7},'limit':0x1,'order':[[_0x9ae7('0x78'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2ef00f,null))[_0x9ae7('0x35')](function(_0x5831eb){if(_0x5831eb&&_0x5831eb[_0x9ae7('0x8a')]){_0x2d5cf3=_0x5831eb['get']({'plain':!![]});if(_0x2d5cf3['List']&&_0x2d5cf3[_0x9ae7('0x8a')][_0x9ae7('0x8b')]['length']){return _0x2d5cf3['List'][_0x9ae7('0x8b')][0x0];}return db[_0x9ae7('0x81')][_0x9ae7('0x58')](_['defaults'](_0x1cc9d2[_0x9ae7('0x59')],{'firstName':_0x4d54d7,[_0x5831eb[_0x9ae7('0x7d')]]:_0x4d54d7,'phone':_0x4d54d7,'ListId':_0x2d5cf3[_0x9ae7('0x79')]}));}})['then'](handleEntityNotFound(_0x2ef00f,null))[_0x9ae7('0x35')](function(_0x4042eb){if(_0x4042eb){_0x569ccf=_0x4042eb;return db[_0x9ae7('0x91')][_0x9ae7('0x5e')]({'where':{'ContactId':_0x569ccf['id'],'closed':![],'OpenchannelAccountId':_0x2d5cf3['id']}})[_0x9ae7('0x35')](function(_0x3cb35f){if(_0x3cb35f){return[_0x3cb35f,![]];}return db['OpenchannelInteraction'][_0x9ae7('0x58')]({'UserId':_0x1cc9d2['user']['id'],'ContactId':_0x569ccf['id'],'OpenchannelAccountId':_0x2d5cf3['id'],'lastMsgDirection':'out','Messages':[_[_0x9ae7('0x4b')](_0x1cc9d2['body'],{'read':![],'body':_0x1cc9d2[_0x9ae7('0x59')][_0x9ae7('0x59')],'OpenchannelAccountId':_0x2d5cf3['id'],'UserId':_0x1cc9d2[_0x9ae7('0x5a')]['id'],'ContactId':_0x569ccf['id']})]},{'include':[{'model':db[_0x9ae7('0x9a')],'as':_0x9ae7('0xb6')}]})[_0x9ae7('0x35')](function(_0x5ea981){return[_0x5ea981,!![]];});});}})[_0x9ae7('0x93')](function(_0x571527,_0x470403){if(_0x470403){return _0x571527;}return db[_0x9ae7('0x9a')][_0x9ae7('0x58')](_[_0x9ae7('0x4b')](_0x1cc9d2[_0x9ae7('0x59')],{'read':![],'body':_0x1cc9d2[_0x9ae7('0x59')]['body'],'OpenchannelAccountId':_0x2d5cf3['id'],'OpenchannelInteractionId':_0x571527['id'],'UserId':_0x1cc9d2[_0x9ae7('0x5a')]['id'],'ContactId':_0x569ccf['id']}))[_0x9ae7('0x35')](function(_0x4b23dd){_0x571527[_0x9ae7('0xb7')][_0x9ae7('0xb6')]=[];_0x571527['dataValues'][_0x9ae7('0xb6')][_0x9ae7('0xb8')](_0x4b23dd['dataValues']);return _0x571527;});});}})[_0x9ae7('0x35')](respondWithResult(_0x2ef00f,null))[_0x9ae7('0x29')](handleError(_0x2ef00f,null));}; \ No newline at end of file +var _0x7da7=['intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','addAnswer','CannedAnswer','notify','Sequelize','ValidationError','difference','updatedAt','createdAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','account','applications','Applications','list','orderBy','priority','asc','CmContact','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','push','close','unmanaged','OpenchannelMessage','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','addAgents','ids','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./openchannelAccount.socket','jayson/promise','client','http','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x55043f,_0x2e6e99){var _0x5d810c=function(_0x3e45da){while(--_0x3e45da){_0x55043f['push'](_0x55043f['shift']());}};_0x5d810c(++_0x2e6e99);}(_0x7da7,0x10d));var _0x77da=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x7da7[_0x13f980];return _0x27153c;};'use strict';var pdf=require(_0x77da('0x0'));var emlformat=require(_0x77da('0x1'));var rimraf=require(_0x77da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77da('0x3'));var moment=require(_0x77da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77da('0x5'));var util=require(_0x77da('0x6'));var path=require('path');var sox=require(_0x77da('0x7'));var csv=require(_0x77da('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x8'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var authService=require(_0x77da('0xe'));var hardwareService=require(_0x77da('0xf'));var Redis=require(_0x77da('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x77da('0x11'))(_0x77da('0x12'));var utils=require(_0x77da('0x13'));var config=require(_0x77da('0x14'));var db=require('../../mysqldb')['db'];config[_0x77da('0x15')]=_[_0x77da('0x16')](config[_0x77da('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77da('0x15')]));require(_0x77da('0x17'))['register'](socket);var jayson=require(_0x77da('0x18'));var client=jayson[_0x77da('0x19')][_0x77da('0x1a')]({'port':0x232c});var client9002=jayson[_0x77da('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2172d0,_0x4e130c,_0x29cd7b,_0x366443){return new BPromise(function(_0x1b0e17,_0x4500c4){var _0x4ecd98=_0x366443||client;return _0x4ecd98['request'](_0x2172d0,_0x29cd7b)['then'](function(_0x482b87){logger[_0x77da('0x1b')](_0x77da('0x1c'),_0x4e130c,_0x77da('0x1d'));logger[_0x77da('0x1e')](_0x77da('0x1f'),_0x4e130c,_0x77da('0x1d'),JSON[_0x77da('0x20')](_0x482b87));if(_0x482b87[_0x77da('0x21')]){if(_0x482b87['error']['code']===0x1f4){logger[_0x77da('0x21')](_0x77da('0x1c'),_0x4e130c,_0x482b87['error'][_0x77da('0x22')]);return _0x4500c4(_0x482b87[_0x77da('0x21')][_0x77da('0x22')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4e130c,_0x482b87[_0x77da('0x21')]['message']);return _0x1b0e17(_0x482b87[_0x77da('0x21')][_0x77da('0x22')]);}else{logger[_0x77da('0x1b')](_0x77da('0x1c'),_0x4e130c,_0x77da('0x1d'));_0x1b0e17(_0x482b87[_0x77da('0x23')][_0x77da('0x22')]);}})['catch'](function(_0x4885ec){logger[_0x77da('0x21')](_0x77da('0x1c'),_0x4e130c,_0x4885ec);_0x4500c4(_0x4885ec);});});}function respondWithStatusCode(_0x835167,_0xbd06b7){_0xbd06b7=_0xbd06b7||0xcc;return function(_0x545654){if(_0x545654){return _0x835167[_0x77da('0x24')](_0xbd06b7);}return _0x835167[_0x77da('0x25')](_0xbd06b7)[_0x77da('0x26')]();};}function respondWithResult(_0x36115b,_0x446ae7){_0x446ae7=_0x446ae7||0xc8;return function(_0x5997b6){if(_0x5997b6){return _0x36115b[_0x77da('0x25')](_0x446ae7)[_0x77da('0x27')](_0x5997b6);}};}function respondWithFilteredResult(_0x1f2279,_0x2913f7){return function(_0x496ecd){if(_0x496ecd){var _0x5b4638=_0x496ecd[_0x77da('0x28')],_0x4d395a=_0x2913f7[_0x77da('0x29')],_0x2258e9=_0x2913f7[_0x77da('0x29')]+_0x2913f7['limit'],_0x30456a;if(_0x2258e9>=_0x5b4638){_0x2258e9=_0x5b4638;_0x30456a=0xc8;}else{_0x30456a=0xce;}_0x1f2279[_0x77da('0x25')](_0x30456a);return _0x1f2279[_0x77da('0x2a')](_0x77da('0x2b'),_0x4d395a+'-'+_0x2258e9+'/'+_0x5b4638)[_0x77da('0x27')](_0x496ecd);}return null;};}function patchUpdates(_0x1e7853){return function(_0x46e6b4){try{jsonpatch['apply'](_0x46e6b4,_0x1e7853,!![]);}catch(_0x165a7f){return BPromise[_0x77da('0x2c')](_0x165a7f);}return _0x46e6b4[_0x77da('0x2d')]();};}function saveUpdates(_0x38643a,_0x3c3c64){return function(_0x12ea16){if(_0x12ea16){return _0x12ea16[_0x77da('0x2e')](_0x38643a)[_0x77da('0x2f')](function(_0x5b9b05){return _0x5b9b05;});}return null;};}function removeEntity(_0x5e8d1e,_0x1366b4){return function(_0x8e6181){if(_0x8e6181){return _0x8e6181['destroy']()[_0x77da('0x2f')](function(){var _0x390399=_0x8e6181[_0x77da('0x30')]({'plain':!![]});var _0x10540a=_0x77da('0x31');return db[_0x77da('0x32')][_0x77da('0x33')]({'where':{'type':_0x10540a,'resourceId':_0x390399['id']}})['then'](function(){return _0x8e6181;});})[_0x77da('0x2f')](function(){_0x5e8d1e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x541696,_0x17d236){return function(_0x53543a){if(!_0x53543a){_0x541696[_0x77da('0x24')](0x194);}return _0x53543a;};}function handleError(_0xdac1a4,_0xce9df2){_0xce9df2=_0xce9df2||0x1f4;return function(_0x3cc78b){logger[_0x77da('0x21')](_0x3cc78b[_0x77da('0x34')]);if(_0x3cc78b[_0x77da('0x35')]){delete _0x3cc78b['name'];}_0xdac1a4[_0x77da('0x25')](_0xce9df2)[_0x77da('0x36')](_0x3cc78b);};}exports[_0x77da('0x37')]=function(_0x32785f,_0x166534){var _0x188284={'include':[{'model':db[_0x77da('0x38')],'as':_0x77da('0x39')}]},_0x48fccc={},_0x1e02bd={'count':0x0,'rows':[]};var _0x4d04cd=db[_0x77da('0x3a')]['rawAttributes'];_0x48fccc['model']=_['keys'](_0x4d04cd);_0x48fccc['query']=_[_0x77da('0x3b')](_0x32785f[_0x77da('0x3c')]);_0x48fccc[_0x77da('0x3d')]=_['intersection'](_0x48fccc[_0x77da('0x3e')],_0x48fccc['query']);_0x188284[_0x77da('0x3f')]=_['intersection'](_0x48fccc[_0x77da('0x3e')],qs[_0x77da('0x40')](_0x32785f[_0x77da('0x3c')][_0x77da('0x40')]));_0x188284[_0x77da('0x3f')]=_0x188284['attributes'][_0x77da('0x41')]?_0x188284[_0x77da('0x3f')]:_0x48fccc[_0x77da('0x3e')];if(!_0x32785f[_0x77da('0x3c')][_0x77da('0x42')](_0x77da('0x43'))){_0x188284['limit']=qs[_0x77da('0x44')](_0x32785f[_0x77da('0x3c')][_0x77da('0x44')]);_0x188284[_0x77da('0x29')]=qs[_0x77da('0x29')](_0x32785f[_0x77da('0x3c')]['offset']);}_0x188284[_0x77da('0x45')]=qs['sort'](_0x32785f[_0x77da('0x3c')][_0x77da('0x46')]);_0x188284[_0x77da('0x47')]=qs['filters'](_[_0x77da('0x48')](_0x32785f[_0x77da('0x3c')],_0x48fccc[_0x77da('0x3d')]));if(_0x32785f[_0x77da('0x3c')][_0x77da('0x49')]){_0x188284[_0x77da('0x47')]=_[_0x77da('0x4a')](_0x188284[_0x77da('0x47')],{'$or':_[_0x77da('0x4b')](_0x4d04cd,function(_0x5964da){if(_0x5964da[_0x77da('0x4c')][_0x77da('0x4d')]!==_0x77da('0x4e')){var _0x287cf0={};_0x287cf0[_0x5964da[_0x77da('0x4f')]]={'$like':'%'+_0x32785f[_0x77da('0x3c')]['filter']+'%'};return _0x287cf0;}})});}_0x188284=_['merge']({},_0x188284,_0x32785f[_0x77da('0x50')]);var _0x1597d8={'where':_0x188284[_0x77da('0x47')]};return db[_0x77da('0x3a')][_0x77da('0x28')](_0x1597d8)[_0x77da('0x2f')](function(_0x4e811e){_0x1e02bd[_0x77da('0x28')]=_0x4e811e;if(_0x32785f[_0x77da('0x3c')][_0x77da('0x51')]){_0x188284[_0x77da('0x52')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x77da('0x53')](_0x188284);})['then'](function(_0x518fd5){_0x1e02bd[_0x77da('0x54')]=_0x518fd5;return _0x1e02bd;})[_0x77da('0x2f')](respondWithFilteredResult(_0x166534,_0x188284))[_0x77da('0x55')](handleError(_0x166534,null));};exports[_0x77da('0x56')]=function(_0x57d866,_0x16bf4b){var _0x1e36ee={'raw':![],'where':{'id':_0x57d866[_0x77da('0x57')]['id']},'include':[{'model':db[_0x77da('0x38')],'as':'mandatoryDispositionPause'}]},_0x56a3d9={};_0x56a3d9[_0x77da('0x3e')]=_[_0x77da('0x3b')](db[_0x77da('0x3a')][_0x77da('0x58')]);_0x56a3d9[_0x77da('0x3c')]=_[_0x77da('0x3b')](_0x57d866[_0x77da('0x3c')]);_0x56a3d9[_0x77da('0x3d')]=_[_0x77da('0x59')](_0x56a3d9[_0x77da('0x3e')],_0x56a3d9['query']);_0x1e36ee[_0x77da('0x3f')]=_['intersection'](_0x56a3d9[_0x77da('0x3e')],qs[_0x77da('0x40')](_0x57d866[_0x77da('0x3c')][_0x77da('0x40')]));_0x1e36ee[_0x77da('0x3f')]=_0x1e36ee[_0x77da('0x3f')][_0x77da('0x41')]?_0x1e36ee['attributes']:_0x56a3d9[_0x77da('0x3e')];if(_0x57d866[_0x77da('0x3c')][_0x77da('0x51')]){_0x1e36ee[_0x77da('0x52')]=[{'all':!![]}];}_0x1e36ee=_['merge']({},_0x1e36ee,_0x57d866[_0x77da('0x50')]);return db[_0x77da('0x3a')][_0x77da('0x5a')](_0x1e36ee)['then'](handleEntityNotFound(_0x16bf4b,null))['then'](respondWithResult(_0x16bf4b,null))[_0x77da('0x55')](handleError(_0x16bf4b,null));};exports[_0x77da('0x5b')]=function(_0x42ea9e,_0x1d1ea2){return db[_0x77da('0x3a')]['create'](_0x42ea9e['body'],{})[_0x77da('0x2f')](function(_0x36f161){var _0x52d13d=_0x42ea9e[_0x77da('0x5c')][_0x77da('0x30')]({'plain':!![]});if(!_0x52d13d)throw new Error(_0x77da('0x5d'));if(_0x52d13d['role']===_0x77da('0x5c')){var _0x111260=_0x36f161['get']({'plain':!![]});var _0x3ae855=_0x77da('0x31');return db[_0x77da('0x5e')][_0x77da('0x5a')]({'where':{'name':_0x3ae855,'userProfileId':_0x52d13d[_0x77da('0x5f')]},'raw':!![]})[_0x77da('0x2f')](function(_0x1dc4ab){if(_0x1dc4ab&&_0x1dc4ab[_0x77da('0x60')]===0x0){return db[_0x77da('0x32')]['create']({'name':_0x111260[_0x77da('0x35')],'resourceId':_0x111260['id'],'type':_0x1dc4ab[_0x77da('0x35')],'sectionId':_0x1dc4ab['id']},{})[_0x77da('0x2f')](function(){return _0x36f161;});}else{return _0x36f161;}})[_0x77da('0x55')](function(_0x329c6b){logger[_0x77da('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x329c6b);throw _0x329c6b;});}return _0x36f161;})[_0x77da('0x2f')](respondWithResult(_0x1d1ea2,0xc9))[_0x77da('0x55')](handleError(_0x1d1ea2,null));};exports[_0x77da('0x2e')]=function(_0x5b9cf2,_0x3e5dd9){if(_0x5b9cf2[_0x77da('0x61')]['id']){delete _0x5b9cf2[_0x77da('0x61')]['id'];}return db[_0x77da('0x3a')][_0x77da('0x5a')]({'where':{'id':_0x5b9cf2[_0x77da('0x57')]['id']},'include':[{'model':db[_0x77da('0x38')],'as':'mandatoryDispositionPause'}]})[_0x77da('0x2f')](handleEntityNotFound(_0x3e5dd9,null))['then'](saveUpdates(_0x5b9cf2[_0x77da('0x61')],null))[_0x77da('0x2f')](respondWithResult(_0x3e5dd9,null))[_0x77da('0x55')](handleError(_0x3e5dd9,null));};exports['destroy']=function(_0x30c746,_0x3c4453){return db[_0x77da('0x3a')][_0x77da('0x5a')]({'where':{'id':_0x30c746['params']['id']}})['then'](handleEntityNotFound(_0x3c4453,null))['then'](removeEntity(_0x3c4453,null))[_0x77da('0x55')](handleError(_0x3c4453,null));};exports[_0x77da('0x62')]=function(_0x2c4d7c,_0x2c7c8e){return db[_0x77da('0x3a')][_0x77da('0x62')]()[_0x77da('0x2f')](respondWithResult(_0x2c7c8e,null))[_0x77da('0x55')](handleError(_0x2c7c8e,null));};exports[_0x77da('0x63')]=function(_0x14e067,_0x5afd7a,_0x3028ca){if(_0x14e067[_0x77da('0x61')]['id']){delete _0x14e067['body']['id'];}return db['OpenchannelAccount'][_0x77da('0x5a')]({'where':{'id':_0x14e067['params']['id']}})[_0x77da('0x2f')](handleEntityNotFound(_0x5afd7a,null))[_0x77da('0x2f')](function(_0x1ff554){if(_0x1ff554){_0x14e067['body'][_0x77da('0x64')]=_0x1ff554['id'];return db[_0x77da('0x65')][_0x77da('0x5b')](_0x14e067[_0x77da('0x61')]);}})[_0x77da('0x2f')](respondWithResult(_0x5afd7a,null))['catch'](handleError(_0x5afd7a,null));};exports[_0x77da('0x66')]=function(_0x20a636,_0x5f0938,_0x3fdde1){var _0x2936ac={'raw':![],'where':{}};var _0xd14296={};var _0xf9c7f2={'count':0x0,'rows':[]};return db[_0x77da('0x3a')][_0x77da('0x67')]({'where':{'id':_0x20a636[_0x77da('0x57')]['id']}})['then'](handleEntityNotFound(_0x5f0938,null))[_0x77da('0x2f')](function(_0x51bb29){if(_0x51bb29){_0xd14296[_0x77da('0x3e')]=_[_0x77da('0x3b')](db[_0x77da('0x65')][_0x77da('0x58')]);_0xd14296[_0x77da('0x3c')]=_[_0x77da('0x3b')](_0x20a636[_0x77da('0x3c')]);_0xd14296[_0x77da('0x3d')]=_[_0x77da('0x59')](_0xd14296[_0x77da('0x3e')],_0xd14296[_0x77da('0x3c')]);_0x2936ac[_0x77da('0x3f')]=_['intersection'](_0xd14296[_0x77da('0x3e')],qs[_0x77da('0x40')](_0x20a636[_0x77da('0x3c')][_0x77da('0x40')]));_0x2936ac['attributes']=_0x2936ac[_0x77da('0x3f')][_0x77da('0x41')]?_0x2936ac[_0x77da('0x3f')]:_0xd14296['model'];if(!_0x20a636[_0x77da('0x3c')]['hasOwnProperty']('nolimit')){_0x2936ac[_0x77da('0x44')]=qs[_0x77da('0x44')](_0x20a636[_0x77da('0x3c')][_0x77da('0x44')]);_0x2936ac[_0x77da('0x29')]=qs[_0x77da('0x29')](_0x20a636[_0x77da('0x3c')][_0x77da('0x29')]);}_0x2936ac[_0x77da('0x45')]=qs['sort'](_0x20a636[_0x77da('0x3c')][_0x77da('0x46')]);_0x2936ac[_0x77da('0x47')]=qs[_0x77da('0x3d')](_[_0x77da('0x48')](_0x20a636['query'],_0xd14296[_0x77da('0x3d')]));_0x2936ac[_0x77da('0x47')][_0x77da('0x68')]=_0x51bb29['id'];if(_0x20a636[_0x77da('0x3c')][_0x77da('0x49')]){_0x2936ac[_0x77da('0x47')]=_[_0x77da('0x4a')](_0x2936ac[_0x77da('0x47')],{'$or':_[_0x77da('0x4b')](_0x2936ac[_0x77da('0x3f')],function(_0x4df868){var _0x519e38={};_0x519e38[_0x4df868]={'$like':'%'+_0x20a636['query'][_0x77da('0x49')]+'%'};return _0x519e38;})});}_0x2936ac=_[_0x77da('0x4a')]({},_0x2936ac,_0x20a636[_0x77da('0x50')]);return db['Disposition']['count']({'where':_0x2936ac[_0x77da('0x47')]})[_0x77da('0x2f')](function(_0x17a2e6){_0xf9c7f2[_0x77da('0x28')]=_0x17a2e6;if(_0x20a636[_0x77da('0x3c')][_0x77da('0x51')]){_0x2936ac[_0x77da('0x52')]=[{'all':!![]}];}return db[_0x77da('0x65')][_0x77da('0x53')](_0x2936ac);})[_0x77da('0x2f')](function(_0x27a462){_0xf9c7f2[_0x77da('0x54')]=_0x27a462;return _0xf9c7f2;});}})[_0x77da('0x2f')](respondWithFilteredResult(_0x5f0938,_0x2936ac))['catch'](handleError(_0x5f0938,null));};exports['removeDispositions']=function(_0x1cdd40,_0x5c8859,_0x4f9121){var _0x22de60;return db[_0x77da('0x3a')][_0x77da('0x5a')]({'where':{'id':_0x1cdd40['params']['id']}})['then'](handleEntityNotFound(_0x5c8859,null))[_0x77da('0x2f')](function(_0x4f1ae0){if(_0x4f1ae0){return _0x4f1ae0[_0x77da('0x69')](_0x1cdd40[_0x77da('0x3c')]['ids']);}})[_0x77da('0x2f')](respondWithStatusCode(_0x5c8859,null))['catch'](handleError(_0x5c8859,null));};exports[_0x77da('0x6a')]=function(_0x45b0a5,_0x448ffd,_0x256ca9){if(_0x45b0a5['body']['id']){delete _0x45b0a5[_0x77da('0x61')]['id'];}return db[_0x77da('0x3a')][_0x77da('0x5a')]({'where':{'id':_0x45b0a5[_0x77da('0x57')]['id']}})[_0x77da('0x2f')](handleEntityNotFound(_0x448ffd,null))[_0x77da('0x2f')](function(_0x256855){if(_0x256855){_0x45b0a5['body']['OpenchannelAccountId']=_0x256855['id'];return db[_0x77da('0x6b')][_0x77da('0x5b')](_0x45b0a5[_0x77da('0x61')]);}})['then'](respondWithResult(_0x448ffd,null))['catch'](handleError(_0x448ffd,null));};exports['getAnswers']=function(_0x5aaafb,_0x1c5a86,_0xb5e5f6){var _0x395fb8={'raw':![],'where':{}};var _0x4d459d={};var _0x1636d6={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x77da('0x67')]({'where':{'id':_0x5aaafb['params']['id']}})[_0x77da('0x2f')](handleEntityNotFound(_0x1c5a86,null))['then'](function(_0x2577fb){if(_0x2577fb){_0x4d459d[_0x77da('0x3e')]=_['keys'](db[_0x77da('0x6b')][_0x77da('0x58')]);_0x4d459d[_0x77da('0x3c')]=_[_0x77da('0x3b')](_0x5aaafb[_0x77da('0x3c')]);_0x4d459d[_0x77da('0x3d')]=_[_0x77da('0x59')](_0x4d459d[_0x77da('0x3e')],_0x4d459d[_0x77da('0x3c')]);_0x395fb8['attributes']=_['intersection'](_0x4d459d['model'],qs[_0x77da('0x40')](_0x5aaafb[_0x77da('0x3c')][_0x77da('0x40')]));_0x395fb8['attributes']=_0x395fb8[_0x77da('0x3f')]['length']?_0x395fb8['attributes']:_0x4d459d[_0x77da('0x3e')];if(!_0x5aaafb[_0x77da('0x3c')]['hasOwnProperty']('nolimit')){_0x395fb8[_0x77da('0x44')]=qs[_0x77da('0x44')](_0x5aaafb[_0x77da('0x3c')]['limit']);_0x395fb8[_0x77da('0x29')]=qs['offset'](_0x5aaafb[_0x77da('0x3c')][_0x77da('0x29')]);}_0x395fb8[_0x77da('0x45')]=qs[_0x77da('0x46')](_0x5aaafb[_0x77da('0x3c')][_0x77da('0x46')]);_0x395fb8['where']=qs[_0x77da('0x3d')](_[_0x77da('0x48')](_0x5aaafb[_0x77da('0x3c')],_0x4d459d[_0x77da('0x3d')]));_0x395fb8['where'][_0x77da('0x68')]=_0x2577fb['id'];if(_0x5aaafb['query'][_0x77da('0x49')]){_0x395fb8[_0x77da('0x47')]=_[_0x77da('0x4a')](_0x395fb8[_0x77da('0x47')],{'$or':_[_0x77da('0x4b')](_0x395fb8[_0x77da('0x3f')],function(_0xdbbc0){var _0x3d0583={};_0x3d0583[_0xdbbc0]={'$like':'%'+_0x5aaafb['query'][_0x77da('0x49')]+'%'};return _0x3d0583;})});}_0x395fb8=_[_0x77da('0x4a')]({},_0x395fb8,_0x5aaafb[_0x77da('0x50')]);return db[_0x77da('0x6b')][_0x77da('0x28')]({'where':_0x395fb8[_0x77da('0x47')]})[_0x77da('0x2f')](function(_0x12299f){_0x1636d6['count']=_0x12299f;if(_0x5aaafb['query'][_0x77da('0x51')]){_0x395fb8[_0x77da('0x52')]=[{'all':!![]}];}return db[_0x77da('0x6b')]['findAll'](_0x395fb8);})[_0x77da('0x2f')](function(_0x52b999){_0x1636d6[_0x77da('0x54')]=_0x52b999;return _0x1636d6;});}})[_0x77da('0x2f')](respondWithFilteredResult(_0x1c5a86,_0x395fb8))[_0x77da('0x55')](handleError(_0x1c5a86,null));};exports['removeAnswers']=function(_0x4aff13,_0x20ae0a,_0x48bd19){var _0x517621;return db[_0x77da('0x3a')][_0x77da('0x5a')]({'where':{'id':_0x4aff13[_0x77da('0x57')]['id']}})[_0x77da('0x2f')](handleEntityNotFound(_0x20ae0a,null))['then'](function(_0xa0f53d){if(_0xa0f53d){return _0xa0f53d['removeAnswers'](_0x4aff13['query']['ids']);}})[_0x77da('0x2f')](respondWithStatusCode(_0x20ae0a,null))[_0x77da('0x55')](handleError(_0x20ae0a,null));};exports[_0x77da('0x6c')]=function(_0x36decd,_0x19d036,_0xb1c012){var _0xd8218e={'body':_0x36decd[_0x77da('0x61')],'channel':'openchannel'};var _0x91641b=[];var _0x461d88=[];var _0x5d32c5={};var _0x24029c=![];return db['CmContact'][_0x77da('0x62')]()[_0x77da('0x2f')](function(_0x17a937){if(!_0x17a937){throw new db[(_0x77da('0x6d'))][(_0x77da('0x6e'))]('no\x20available\x20attributes');}_0x91641b=_[_0x77da('0x6f')](_[_0x77da('0x3b')](_0x17a937),['createdAt',_0x77da('0x70')]);_0x461d88=_['difference'](_['keys'](_0x17a937),[_0x77da('0x71'),'updatedAt','CompanyId',_0x77da('0x72')]);if(_0x36decd[_0x77da('0x61')]['id']){delete _0x36decd[_0x77da('0x61')]['id'];}if(_[_0x77da('0x73')](_0x36decd['body'][_0x77da('0x74')])){throw new db['Sequelize'][(_0x77da('0x6e'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x36decd[_0x77da('0x61')]['body'])||_0x36decd[_0x77da('0x61')][_0x77da('0x61')]===''){throw new db['Sequelize'][(_0x77da('0x6e'))](_0x77da('0x75'));}if(_[_0x77da('0x73')](_0x36decd['body'][_0x77da('0x76')])){throw new db[(_0x77da('0x6d'))][(_0x77da('0x6e'))](_0x77da('0x77')+_0x461d88);}if(!_['includes'](_0x461d88,_0x36decd[_0x77da('0x61')]['mapKey'])){throw new db[(_0x77da('0x6d'))][(_0x77da('0x6e'))](_0x77da('0x78')+_0x461d88);}_0x5d32c5[_0x36decd[_0x77da('0x61')][_0x77da('0x76')]]=_0x36decd[_0x77da('0x61')][_0x77da('0x74')];})[_0x77da('0x2f')](function(){return db[_0x77da('0x3a')][_0x77da('0x5a')]({'where':{'id':_0x36decd[_0x77da('0x57')]['id']},'include':[{'model':db[_0x77da('0x79')],'as':_0x77da('0x7a'),'include':[{'model':db['CmContact'],'as':_0x77da('0x7b'),'where':_0x5d32c5,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x77da('0x7c')],'as':'Applications'}]});})[_0x77da('0x2f')](handleEntityNotFound(_0x19d036,null))[_0x77da('0x2f')](function(_0x575613){if(_0x575613&&_0x575613[_0x77da('0x7a')]){_0xd8218e[_0x77da('0x7d')]=_0x575613;_0xd8218e[_0x77da('0x7e')]=_0x575613[_0x77da('0x7f')];_0xd8218e[_0x77da('0x80')]=_0x575613[_0x77da('0x7a')];_0xd8218e[_0x77da('0x7e')]=_[_0x77da('0x81')](_0xd8218e[_0x77da('0x7e')],[_0x77da('0x82')],[_0x77da('0x83')]);if(_0xd8218e[_0x77da('0x7d')][_0x77da('0x7f')]){delete _0xd8218e['account'][_0x77da('0x7f')];}if(_0xd8218e[_0x77da('0x7d')]['List']&&_0xd8218e['account'][_0x77da('0x7a')]['Contacts'][_0x77da('0x41')]){return _0xd8218e['account'][_0x77da('0x7a')]['Contacts'][0x0];}var _0x31a578=_[_0x77da('0x16')](_0x36decd[_0x77da('0x61')],{'firstName':_0x36decd['body']['from'],'ListId':_0x575613[_0x77da('0x72')]});_0x31a578[_0x36decd[_0x77da('0x61')]['mapKey']]=_0x36decd[_0x77da('0x61')][_0x77da('0x74')];return db[_0x77da('0x84')][_0x77da('0x5b')](_0x31a578,{'fields':_0x91641b,'raw':!![]});}})[_0x77da('0x2f')](handleEntityNotFound(_0x19d036,null))[_0x77da('0x2f')](function(_0x1e9dc2){_0xd8218e[_0x77da('0x85')]=_0x1e9dc2;if(_0x1e9dc2){var _0x254fdd={'ContactId':_0x1e9dc2['id'],'OpenchannelAccountId':_0x36decd[_0x77da('0x57')]['id'],'from':(_0x1e9dc2[_0x77da('0x86')]||'')+'\x20'+(_0x1e9dc2[_0x77da('0x87')]||'')};var _0x466cf5={'OpenchannelAccountId':_0x36decd['params']['id'],'closed':![]};if(_0x36decd[_0x77da('0x61')]['threadId']){_0x466cf5['threadId']=_0x36decd[_0x77da('0x61')][_0x77da('0x88')];return db[_0x77da('0x89')][_0x77da('0x5a')]({'where':_0x466cf5})['then'](function(_0x197b48){if(_0x197b48){return[_0x197b48,![]];}_0x254fdd[_0x77da('0x88')]=_0x36decd['body'][_0x77da('0x88')];_0x254fdd[_0x77da('0x8a')]=_0x36decd[_0x77da('0x61')][_0x77da('0x8a')];return db[_0x77da('0x89')][_0x77da('0x5b')](_0x254fdd)['then'](function(_0x17578e){return[_0x17578e,!![]];});});}else{_0x466cf5['threadId']=null;}_0x466cf5[_0x77da('0x8b')]=_0x1e9dc2['id'];return db[_0x77da('0x89')]['find']({'where':_0x466cf5})[_0x77da('0x2f')](function(_0x53ccba){if(_0x53ccba){return[_0x53ccba,![]];}return db['OpenchannelInteraction'][_0x77da('0x5b')](_0x254fdd)[_0x77da('0x2f')](function(_0x15e7bd){return[_0x15e7bd,!![]];});});}})['spread'](function(_0x4c3cbf,_0x54dcec){if(_0x4c3cbf){_0x24029c=_0x54dcec;if(!_0x54dcec){var _0x11d6ae={'from':(_0xd8218e[_0x77da('0x85')][_0x77da('0x86')]||'')+'\x20'+(_0xd8218e[_0x77da('0x85')][_0x77da('0x87')]||'')};if(_0x36decd[_0x77da('0x61')][_0x77da('0x88')]&&_0x36decd['body']['messageId']&&_0x36decd[_0x77da('0x61')][_0x77da('0x88')]!=_0x36decd[_0x77da('0x61')][_0x77da('0x8c')]){_0x11d6ae[_0x77da('0x88')]=_0x36decd[_0x77da('0x61')]['messageId'];}return _0x4c3cbf[_0x77da('0x2e')](_0x11d6ae);}else{return _0x4c3cbf;}}})['then'](function(_0x500150){_0xd8218e[_0x77da('0x8d')]=_0x500150[_0x77da('0x30')]({'plain':!![]});_0xd8218e[_0x77da('0x8d')][_0x77da('0x8e')]=_0x24029c;if(_0xd8218e[_0x77da('0x8d')][_0x77da('0x8e')]){if(_0xd8218e[_0x77da('0x7d')]['autoclose']){_0xd8218e[_0x77da('0x7e')][_0x77da('0x8f')]({'id':0x0,'priority':_0xd8218e[_0x77da('0x7e')][_0x77da('0x41')]+0x1,'app':_0x77da('0x90'),'appdata':_0x77da('0x91'),'interval':'*,*,*,*'});}}return db[_0x77da('0x92')][_0x77da('0x5b')]({'body':_0x36decd[_0x77da('0x61')]['body'],'OpenchannelAccountId':_0x36decd['params']['id'],'OpenchannelInteractionId':_0x500150['id'],'direction':'in','ContactId':_0xd8218e[_0x77da('0x85')]['id'],'AttachmentId':_0x36decd['body']['AttachmentId']});})[_0x77da('0x2f')](function(_0x2d329e){_0xd8218e[_0x77da('0x22')]=_0x2d329e;if(_0xd8218e['interaction']['UserId']){return db[_0x77da('0x93')]['find']({'attributes':['id',_0x77da('0x35')],'where':{'id':_0xd8218e[_0x77da('0x8d')]['UserId']}})['then'](function(_0x58cbae){if(_0x58cbae){_0xd8218e[_0x77da('0x7e')][_0x77da('0x94')]({'id':0x0,'priority':0x0,'app':_0x77da('0x95'),'appdata':_0x58cbae[_0x77da('0x35')]+','+(_0xd8218e[_0x77da('0x7d')]['waitForTheAssignedAgent']||0xa),'interval':_0x77da('0x96')});_0xd8218e[_0x77da('0x97')]=![];}return respondWithRpcPromise('Start','startRouting',_0xd8218e);});}return respondWithRpcPromise(_0x77da('0x98'),_0x77da('0x99'),_0xd8218e);})[_0x77da('0x2f')](function(_0x48fe91){respondWithRpcPromise(_0x77da('0x9a'),'EventManager',{'event':_0x77da('0x6c'),'message':_0x48fe91},client9002);return _0x48fe91;})['then'](respondWithResult(_0x19d036,null))['catch'](handleError(_0x19d036,null));};exports[_0x77da('0x9b')]=function(_0x44b1f7,_0x4590ed,_0x3e6805){return db[_0x77da('0x3a')][_0x77da('0x67')]({'where':{'id':_0x44b1f7[_0x77da('0x57')]['id']}})['then'](handleEntityNotFound(_0x4590ed,null))[_0x77da('0x2f')](function(_0x435861){if(_0x435861){return db[_0x77da('0x9c')]['transaction'](function(_0x15563d){return db[_0x77da('0x7c')][_0x77da('0x33')]({'where':{'OpenchannelAccountId':_0x44b1f7[_0x77da('0x57')]['id']},'transaction':_0x15563d})[_0x77da('0x2f')](function(_0x55df31){var _0x10ab37=_[_0x77da('0x4b')](_0x44b1f7[_0x77da('0x61')],function(_0x3d62a){_0x3d62a[_0x77da('0x68')]=_0x44b1f7['params']['id'];return _0x3d62a;});return db[_0x77da('0x7c')][_0x77da('0x9d')](_0x10ab37,{'transaction':_0x15563d});});})['then'](function(){return db[_0x77da('0x7c')][_0x77da('0x9e')]({'where':{'OpenchannelAccountId':_0x44b1f7[_0x77da('0x57')]['id']},'order':_0x77da('0x82')});});}})[_0x77da('0x2f')](respondWithResult(_0x4590ed,null))['catch'](handleError(_0x4590ed,null));};exports[_0x77da('0x9f')]=function(_0xd95edf,_0x594cd8,_0x1af660){var _0x34e0ee={};var _0x48b3ee={};var _0x59770f;var _0x54b20c;return db[_0x77da('0x3a')][_0x77da('0x67')]({'where':{'id':_0xd95edf[_0x77da('0x57')]['id']}})[_0x77da('0x2f')](handleEntityNotFound(_0x594cd8,null))['then'](function(_0x1bb7f1){if(_0x1bb7f1){_0x59770f=_0x1bb7f1;_0x48b3ee[_0x77da('0x3e')]=_[_0x77da('0x3b')](db[_0x77da('0x7c')][_0x77da('0x58')]);_0x48b3ee[_0x77da('0x3c')]=_[_0x77da('0x3b')](_0xd95edf[_0x77da('0x3c')]);_0x48b3ee[_0x77da('0x3d')]=_[_0x77da('0x59')](_0x48b3ee['model'],_0x48b3ee[_0x77da('0x3c')]);_0x34e0ee['attributes']=_[_0x77da('0x59')](_0x48b3ee[_0x77da('0x3e')],qs[_0x77da('0x40')](_0xd95edf[_0x77da('0x3c')][_0x77da('0x40')]));_0x34e0ee[_0x77da('0x3f')]=_0x34e0ee['attributes'][_0x77da('0x41')]?_0x34e0ee[_0x77da('0x3f')]:_0x48b3ee['model'];_0x34e0ee[_0x77da('0x45')]=qs['sort'](_0xd95edf['query'][_0x77da('0x46')]);_0x34e0ee[_0x77da('0x47')]=qs[_0x77da('0x3d')](_[_0x77da('0x48')](_0xd95edf[_0x77da('0x3c')],_0x48b3ee[_0x77da('0x3d')]));if(_0xd95edf['query']['filter']){_0x34e0ee[_0x77da('0x47')]=_[_0x77da('0x4a')](_0x34e0ee['where'],{'$or':_['map'](_0x34e0ee[_0x77da('0x3f')],function(_0x435ac4){var _0x550c43={};_0x550c43[_0x435ac4]={'$like':'%'+_0xd95edf['query']['filter']+'%'};return _0x550c43;})});}_0x34e0ee=_['merge']({},_0x34e0ee,_0xd95edf[_0x77da('0x50')]);return _0x59770f[_0x77da('0x9f')](_0x34e0ee);}})[_0x77da('0x2f')](function(_0x223ed4){if(_0x223ed4){_0x54b20c=_0x223ed4[_0x77da('0x41')];if(!_0xd95edf[_0x77da('0x3c')][_0x77da('0x42')]('nolimit')){_0x34e0ee[_0x77da('0x44')]=qs[_0x77da('0x44')](_0xd95edf[_0x77da('0x3c')][_0x77da('0x44')]);_0x34e0ee[_0x77da('0x29')]=qs[_0x77da('0x29')](_0xd95edf[_0x77da('0x3c')][_0x77da('0x29')]);}return _0x59770f[_0x77da('0x9f')](_0x34e0ee);}})[_0x77da('0x2f')](function(_0x3a3100){if(_0x3a3100){return _0x3a3100?{'count':_0x54b20c,'rows':_0x3a3100}:null;}})[_0x77da('0x2f')](respondWithResult(_0x594cd8,null))['catch'](handleError(_0x594cd8,null));};exports[_0x77da('0xa0')]=function(_0x299138,_0x1674cf,_0x213756){var _0x2ecb02={'raw':![],'where':{}};var _0x2458b3={};var _0x2d11cc={'count':0x0,'rows':[]};return db[_0x77da('0x3a')]['findOne']({'where':{'id':_0x299138[_0x77da('0x57')]['id']}})['then'](handleEntityNotFound(_0x1674cf,null))[_0x77da('0x2f')](function(_0x476590){if(_0x476590){_0x2458b3[_0x77da('0x3e')]=_[_0x77da('0x3b')](db['OpenchannelInteraction'][_0x77da('0x58')]);_0x2458b3[_0x77da('0x3c')]=_['keys'](_0x299138[_0x77da('0x3c')]);_0x2458b3[_0x77da('0x3d')]=_[_0x77da('0x59')](_0x2458b3[_0x77da('0x3e')],_0x2458b3[_0x77da('0x3c')]);_0x2ecb02[_0x77da('0x3f')]=_[_0x77da('0x59')](_0x2458b3[_0x77da('0x3e')],qs[_0x77da('0x40')](_0x299138[_0x77da('0x3c')][_0x77da('0x40')]));_0x2ecb02['attributes']=_0x2ecb02[_0x77da('0x3f')]['length']?_0x2ecb02[_0x77da('0x3f')]:_0x2458b3['model'];if(!_0x299138['query'][_0x77da('0x42')]('nolimit')){_0x2ecb02[_0x77da('0x44')]=qs[_0x77da('0x44')](_0x299138['query'][_0x77da('0x44')]);_0x2ecb02['offset']=qs[_0x77da('0x29')](_0x299138['query']['offset']);}_0x2ecb02['order']=qs['sort'](_0x299138['query'][_0x77da('0x46')]);_0x2ecb02['where']=qs[_0x77da('0x3d')](_[_0x77da('0x48')](_0x299138[_0x77da('0x3c')],_0x2458b3['filters']));_0x2ecb02[_0x77da('0x47')]['OpenchannelAccountId']=_0x476590['id'];if(_0x299138[_0x77da('0x3c')]['filter']){_0x2ecb02[_0x77da('0x47')]=_['merge'](_0x2ecb02[_0x77da('0x47')],{'$or':_['map'](_0x2ecb02[_0x77da('0x3f')],function(_0x13f25d){var _0x38175f={};_0x38175f[_0x13f25d]={'$like':'%'+_0x299138[_0x77da('0x3c')][_0x77da('0x49')]+'%'};return _0x38175f;})});}_0x2ecb02=_[_0x77da('0x4a')]({},_0x2ecb02,_0x299138[_0x77da('0x50')]);return db[_0x77da('0x89')][_0x77da('0x28')]({'where':_0x2ecb02[_0x77da('0x47')]})[_0x77da('0x2f')](function(_0x35b243){_0x2d11cc[_0x77da('0x28')]=_0x35b243;if(_0x299138[_0x77da('0x3c')]['includeAll']){_0x2ecb02['include']=[{'model':db[_0x77da('0x84')],'as':_0x77da('0xa1'),'required':![]},{'model':db[_0x77da('0x93')],'as':_0x77da('0xa2'),'attributes':[_0x77da('0x35'),_0x77da('0xa3'),'internal'],'required':![]},{'model':db[_0x77da('0xa4')],'as':'Tags','attributes':['id',_0x77da('0x35'),_0x77da('0xa5')],'where':_0x299138['query'][_0x77da('0xa6')]?{'id':_0x299138[_0x77da('0x3c')][_0x77da('0xa6')]}:undefined,'required':_0x299138[_0x77da('0x3c')]['tag']?!![]:![]}];}return db[_0x77da('0x89')][_0x77da('0x53')](_0x2ecb02);})[_0x77da('0x2f')](function(_0x2ac098){_0x2d11cc[_0x77da('0x54')]=_0x2ac098;return _0x2d11cc;});}})[_0x77da('0x2f')](respondWithFilteredResult(_0x1674cf,_0x2ecb02))[_0x77da('0x55')](handleError(_0x1674cf,null));};exports[_0x77da('0xa7')]=function(_0x1bc7b2,_0x267f42,_0x42fa44){return db['OpenchannelAccount'][_0x77da('0x5a')]({'where':{'id':_0x1bc7b2[_0x77da('0x57')]['id']}})[_0x77da('0x2f')](handleEntityNotFound(_0x267f42,null))[_0x77da('0x2f')](function(_0x24e34f){if(_0x24e34f){return _0x24e34f[_0x77da('0xa7')](_0x1bc7b2['body'][_0x77da('0xa8')],_[_0x77da('0xa9')](_0x1bc7b2[_0x77da('0x61')],['ids','id'])||{})['spread'](function(_0x5cbf60){for(var _0x31c916=0x0;_0x31c916<_0x1bc7b2[_0x77da('0x61')][_0x77da('0xa8')]['length'];_0x31c916+=0x1){socket[_0x77da('0xaa')]('userOpenchannelAccount:save',{'UserId':_0x1bc7b2[_0x77da('0x61')]['ids'][_0x31c916],'OpenchannelAccountId':_0x1bc7b2[_0x77da('0x57')]['id']});}return _0x5cbf60;});}})[_0x77da('0x2f')](respondWithResult(_0x267f42,null))[_0x77da('0x55')](handleError(_0x267f42,null));};exports[_0x77da('0xab')]=function(_0x44c92f,_0x1e2c7f,_0x56746a){var _0x439b2a;return db[_0x77da('0x3a')][_0x77da('0x5a')]({'where':{'id':_0x44c92f[_0x77da('0x57')]['id']}})[_0x77da('0x2f')](handleEntityNotFound(_0x1e2c7f,null))['then'](function(_0xd673fd){if(_0xd673fd){return _0xd673fd[_0x77da('0xab')](_0x44c92f[_0x77da('0x3c')][_0x77da('0xa8')])[_0x77da('0x2f')](function(_0x2c60a5){if(_[_0x77da('0xac')](_0x44c92f[_0x77da('0x3c')]['ids'])){for(var _0x1ddaf9=0x0;_0x1ddaf9<_0x44c92f[_0x77da('0x3c')][_0x77da('0xa8')][_0x77da('0x41')];_0x1ddaf9+=0x1){socket[_0x77da('0xaa')](_0x77da('0xad'),{'UserId':_0x44c92f[_0x77da('0x3c')]['ids'][_0x1ddaf9],'OpenchannelAccountId':_0x44c92f['params']['id']});}}else{socket[_0x77da('0xaa')](_0x77da('0xad'),{'UserId':_0x44c92f['query'][_0x77da('0xa8')],'OpenchannelAccountId':_0x44c92f[_0x77da('0x57')]['id']});}});}})[_0x77da('0x2f')](respondWithStatusCode(_0x1e2c7f,null))[_0x77da('0x55')](handleError(_0x1e2c7f,null));};exports[_0x77da('0xae')]=function(_0x50f819,_0x310841,_0x3c5ff9){var _0x195ddd={};var _0x42a46e={};var _0x1b6bda;var _0x548b5f;return db[_0x77da('0x3a')][_0x77da('0x67')]({'where':{'id':_0x50f819[_0x77da('0x57')]['id']}})[_0x77da('0x2f')](handleEntityNotFound(_0x310841,null))[_0x77da('0x2f')](function(_0x5834bc){if(_0x5834bc){_0x1b6bda=_0x5834bc;_0x42a46e['model']=_[_0x77da('0x3b')](db[_0x77da('0x93')]['rawAttributes']);_0x42a46e[_0x77da('0x3c')]=_[_0x77da('0x3b')](_0x50f819[_0x77da('0x3c')]);_0x42a46e[_0x77da('0x3d')]=_[_0x77da('0x59')](_0x42a46e['model'],_0x42a46e[_0x77da('0x3c')]);_0x195ddd['attributes']=_[_0x77da('0x59')](_0x42a46e[_0x77da('0x3e')],qs['fields'](_0x50f819[_0x77da('0x3c')][_0x77da('0x40')]));_0x195ddd[_0x77da('0x3f')]=_0x195ddd[_0x77da('0x3f')][_0x77da('0x41')]?_0x195ddd[_0x77da('0x3f')]:_0x42a46e[_0x77da('0x3e')];_0x195ddd[_0x77da('0x45')]=qs[_0x77da('0x46')](_0x50f819[_0x77da('0x3c')][_0x77da('0x46')]);_0x195ddd['where']=qs['filters'](_[_0x77da('0x48')](_0x50f819[_0x77da('0x3c')],_0x42a46e['filters']));if(_0x50f819[_0x77da('0x3c')][_0x77da('0x49')]){_0x195ddd[_0x77da('0x47')]=_[_0x77da('0x4a')](_0x195ddd[_0x77da('0x47')],{'$or':_[_0x77da('0x4b')](_0x195ddd[_0x77da('0x3f')],function(_0x40c4eb){var _0x20dd15={};_0x20dd15[_0x40c4eb]={'$like':'%'+_0x50f819[_0x77da('0x3c')][_0x77da('0x49')]+'%'};return _0x20dd15;})});}_0x195ddd=_[_0x77da('0x4a')]({},_0x195ddd,_0x50f819['options']);return _0x1b6bda['getAgents'](_0x195ddd);}})[_0x77da('0x2f')](function(_0x2a939a){if(_0x2a939a){_0x548b5f=_0x2a939a[_0x77da('0x41')];if(!_0x50f819[_0x77da('0x3c')][_0x77da('0x42')](_0x77da('0x43'))){_0x195ddd[_0x77da('0x44')]=qs[_0x77da('0x44')](_0x50f819[_0x77da('0x3c')]['limit']);_0x195ddd['offset']=qs[_0x77da('0x29')](_0x50f819[_0x77da('0x3c')][_0x77da('0x29')]);}return _0x1b6bda[_0x77da('0xae')](_0x195ddd);}})[_0x77da('0x2f')](function(_0x500805){if(_0x500805){return _0x500805?{'count':_0x548b5f,'rows':_0x500805}:null;}})['then'](respondWithResult(_0x310841,null))[_0x77da('0x55')](handleError(_0x310841,null));};exports[_0x77da('0x36')]=function(_0x408263,_0x4609aa,_0x45a39b){var _0x1af139,_0x2191f5,_0x21fc08;if(_[_0x77da('0x73')](_0x408263['body']['body'])||_0x408263['body']['body']===''){throw new db['Sequelize'][(_0x77da('0x6e'))](_0x77da('0x75'));}if(_[_0x77da('0x73')](_0x408263[_0x77da('0x61')]['to'])){}_0x1af139=_0x408263[_0x77da('0x61')]['to'];return db[_0x77da('0x3a')]['findOne']({'where':{'id':_0x408263[_0x77da('0x57')]['id']}})[_0x77da('0x2f')](handleEntityNotFound(_0x4609aa,null))[_0x77da('0x2f')](function(_0x4faa34){if(_0x4faa34){return db[_0x77da('0x3a')][_0x77da('0x5a')]({'where':{'id':_0x4faa34['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x77da('0x84')],'as':_0x77da('0x7b'),'where':{[_0x4faa34[_0x77da('0x76')]]:_0x1af139},'limit':0x1,'order':[[_0x77da('0x70'),_0x77da('0xaf')]]}]}]})[_0x77da('0x2f')](handleEntityNotFound(_0x4609aa,null))['then'](function(_0x3930fb){if(_0x3930fb&&_0x3930fb['List']){_0x2191f5=_0x3930fb['get']({'plain':!![]});if(_0x2191f5[_0x77da('0x7a')]&&_0x2191f5[_0x77da('0x7a')][_0x77da('0x7b')][_0x77da('0x41')]){return _0x2191f5[_0x77da('0x7a')][_0x77da('0x7b')][0x0];}return db[_0x77da('0x84')][_0x77da('0x5b')](_[_0x77da('0x16')](_0x408263['body'],{'firstName':_0x1af139,[_0x3930fb[_0x77da('0x76')]]:_0x1af139,'phone':_0x1af139,'ListId':_0x2191f5[_0x77da('0x72')]}));}})[_0x77da('0x2f')](handleEntityNotFound(_0x4609aa,null))[_0x77da('0x2f')](function(_0x36cfff){if(_0x36cfff){_0x21fc08=_0x36cfff;return db[_0x77da('0x89')][_0x77da('0x5a')]({'where':{'ContactId':_0x21fc08['id'],'closed':![],'OpenchannelAccountId':_0x2191f5['id']}})['then'](function(_0xee4b19){if(_0xee4b19){return[_0xee4b19,![]];}return db[_0x77da('0x89')][_0x77da('0x5b')]({'UserId':_0x408263['user']['id'],'ContactId':_0x21fc08['id'],'OpenchannelAccountId':_0x2191f5['id'],'lastMsgDirection':_0x77da('0xb0'),'Messages':[_[_0x77da('0x4a')](_0x408263[_0x77da('0x61')],{'read':![],'body':_0x408263[_0x77da('0x61')]['body'],'OpenchannelAccountId':_0x2191f5['id'],'UserId':_0x408263[_0x77da('0x5c')]['id'],'ContactId':_0x21fc08['id']})]},{'include':[{'model':db[_0x77da('0x92')],'as':_0x77da('0xb1')}]})[_0x77da('0x2f')](function(_0x10569b){return[_0x10569b,!![]];});});}})['spread'](function(_0x5b4905,_0x4dedfb){if(_0x4dedfb){return _0x5b4905;}return db['OpenchannelMessage'][_0x77da('0x5b')](_[_0x77da('0x4a')](_0x408263[_0x77da('0x61')],{'read':![],'body':_0x408263['body']['body'],'OpenchannelAccountId':_0x2191f5['id'],'OpenchannelInteractionId':_0x5b4905['id'],'UserId':_0x408263['user']['id'],'ContactId':_0x21fc08['id']}))[_0x77da('0x2f')](function(_0x41211e){_0x5b4905[_0x77da('0xb2')][_0x77da('0xb1')]=[];_0x5b4905['dataValues']['Messages'][_0x77da('0x8f')](_0x41211e['dataValues']);return _0x5b4905;});});}})[_0x77da('0x2f')](respondWithResult(_0x4609aa,null))['catch'](handleError(_0x4609aa,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 4bc64f6..32659ad 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 _0x62c0=['exports','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x62c0,0x1d9));var _0x062c=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x62c0[_0x4fe19c];return _0x952ac7;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x062c('0x0'))['db'][_0x062c('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x062c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x062c('0x3'),'afterDestroy':_0x062c('0x4')};function emitEvent(_0xaf1c05){return function(_0x57f521,_0x5c41c4,_0x443bf9){OpenchannelAccountEvents[_0x062c('0x5')](_0xaf1c05+':'+_0x57f521['id'],_0x57f521);OpenchannelAccountEvents[_0x062c('0x5')](_0xaf1c05,_0x57f521);_0x443bf9(null);};}for(var e in events){if(events[_0x062c('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x062c('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x3d7e=['save','update','remove','emit','hasOwnProperty','exports','events','OpenchannelAccount'];(function(_0x20236b,_0x4ed824){var _0x54943f=function(_0x5d7dc7){while(--_0x5d7dc7){_0x20236b['push'](_0x20236b['shift']());}};_0x54943f(++_0x4ed824);}(_0x3d7e,0x1ae));var _0xe3d7=function(_0x10e983,_0x2f4eda){_0x10e983=_0x10e983-0x0;var _0x324138=_0x3d7e[_0x10e983];return _0x324138;};'use strict';var EventEmitter=require(_0xe3d7('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xe3d7('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe3d7('0x2'),'afterUpdate':_0xe3d7('0x3'),'afterDestroy':_0xe3d7('0x4')};function emitEvent(_0x3a97bf){return function(_0x492780,_0x2f0638,_0x551b1d){OpenchannelAccountEvents[_0xe3d7('0x5')](_0x3a97bf+':'+_0x492780['id'],_0x492780);OpenchannelAccountEvents[_0xe3d7('0x5')](_0x3a97bf,_0x492780);_0x551b1d(null);};}for(var e in events){if(events[_0xe3d7('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xe3d7('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 5caac4d..661d049 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 _0xb10b=['openchannel_accounts','lodash','../../config/logger','api','moment','request-promise','./openchannelAccount.attributes','exports','define'];(function(_0x54accd,_0x1ea34b){var _0x1d3d06=function(_0x4b5dbb){while(--_0x4b5dbb){_0x54accd['push'](_0x54accd['shift']());}};_0x1d3d06(++_0x1ea34b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2242a1,_0x38f44d){_0x2242a1=_0x2242a1-0x0;var _0x2c298b=_0xb10b[_0x2242a1];return _0x2c298b;};'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 attributes=require(_0xbb10('0x5'));module[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){return _0x22320e[_0xbb10('0x7')]('OpenchannelAccount',attributes,{'tableName':_0xbb10('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda3f=['define','OpenchannelAccount','util','../../config/logger','request-promise','exports'];(function(_0x46b0ba,_0x5a767c){var _0x2e53e0=function(_0x124fb2){while(--_0x124fb2){_0x46b0ba['push'](_0x46b0ba['shift']());}};_0x2e53e0(++_0x5a767c);}(_0xda3f,0xec));var _0xfda3=function(_0x20c673,_0x38cbe2){_0x20c673=_0x20c673-0x0;var _0x338f25=_0xda3f[_0x20c673];return _0x338f25;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var attributes=require('./openchannelAccount.attributes');module[_0xfda3('0x3')]=function(_0x22187d,_0x516500){return _0x22187d[_0xfda3('0x4')](_0xfda3('0x5'),attributes,{'tableName':'openchannel_accounts','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 8242040..81fce9a 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 _0xc4aa=['redis','defaults','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5c9f7f,_0x1c0566){var _0x40a79b=function(_0x39d283){while(--_0x39d283){_0x5c9f7f['push'](_0x5c9f7f['shift']());}};_0x40a79b(++_0x1c0566);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});config[_0xac4a('0xb')]=_[_0xac4a('0xc')](config[_0xac4a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac4a('0xb')]));require(_0xac4a('0xd'))[_0xac4a('0xe')](socket);function respondWithRpcPromise(_0x4f4146,_0x1d182e,_0x3a82de){return new BPromise(function(_0x3e64f5,_0x4d4acc){return client[_0xac4a('0xf')](_0x4f4146,_0x3a82de)['then'](function(_0x2f062c){logger['info'](_0xac4a('0x10'),_0x1d182e,_0xac4a('0x11'));logger[_0xac4a('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1d182e,_0xac4a('0x11'),JSON[_0xac4a('0x13')](_0x2f062c));if(_0x2f062c[_0xac4a('0x14')]){if(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x15')]===0x1f4){logger[_0xac4a('0x14')](_0xac4a('0x10'),_0x1d182e,_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);return _0x4d4acc(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);}logger[_0xac4a('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x1d182e,_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);return _0x3e64f5(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);}else{logger[_0xac4a('0x17')](_0xac4a('0x10'),_0x1d182e,_0xac4a('0x11'));_0x3e64f5(_0x2f062c[_0xac4a('0x18')]['message']);}})['catch'](function(_0x21a729){logger[_0xac4a('0x14')](_0xac4a('0x10'),_0x1d182e,_0x21a729);_0x4d4acc(_0x21a729);});});} \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring'];(function(_0x245578,_0x317768){var _0x2d09d6=function(_0x53630a){while(--_0x53630a){_0x245578['push'](_0x245578['shift']());}};_0x2d09d6(++_0x317768);}(_0xe14b,0x93));var _0xbe14=function(_0x1838cf,_0x31d16a){_0x1838cf=_0x1838cf-0x0;var _0x4862d9=_0xe14b[_0x1838cf];return _0x4862d9;};'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});config[_0xbe14('0x9')]=_[_0xbe14('0xa')](config[_0xbe14('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbe14('0xb'))[_0xbe14('0xc')](socket);function respondWithRpcPromise(_0xd68cd7,_0x90b4f,_0x53c7ea){return new BPromise(function(_0x5b9fc6,_0x113243){return client[_0xbe14('0xd')](_0xd68cd7,_0x53c7ea)['then'](function(_0x254c3b){logger[_0xbe14('0xe')](_0xbe14('0xf'),_0x90b4f,_0xbe14('0x10'));logger[_0xbe14('0x11')](_0xbe14('0x12'),_0x90b4f,_0xbe14('0x10'),JSON[_0xbe14('0x13')](_0x254c3b));if(_0x254c3b[_0xbe14('0x14')]){if(_0x254c3b[_0xbe14('0x14')][_0xbe14('0x15')]===0x1f4){logger[_0xbe14('0x14')](_0xbe14('0xf'),_0x90b4f,_0x254c3b['error']['message']);return _0x113243(_0x254c3b[_0xbe14('0x14')][_0xbe14('0x16')]);}logger[_0xbe14('0x14')](_0xbe14('0xf'),_0x90b4f,_0x254c3b['error'][_0xbe14('0x16')]);return _0x5b9fc6(_0x254c3b[_0xbe14('0x14')][_0xbe14('0x16')]);}else{logger[_0xbe14('0xe')](_0xbe14('0xf'),_0x90b4f,_0xbe14('0x10'));_0x5b9fc6(_0x254c3b[_0xbe14('0x17')]['message']);}})[_0xbe14('0x18')](function(_0x456ca8){logger[_0xbe14('0x14')](_0xbe14('0xf'),_0x90b4f,_0x456ca8);_0x113243(_0x456ca8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index c546ac9..7c6b433 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 _0x1ba4=['save','remove','emit','register','openchannelAccount:'];(function(_0x3cf4eb,_0x27a7ab){var _0x3031d0=function(_0x57913d){while(--_0x57913d){_0x3cf4eb['push'](_0x3cf4eb['shift']());}};_0x3031d0(++_0x27a7ab);}(_0x1ba4,0x1c2));var _0x41ba=function(_0x4afc8c,_0x2037a4){_0x4afc8c=_0x4afc8c-0x0;var _0x62a60=_0x1ba4[_0x4afc8c];return _0x62a60;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x41ba('0x0'),_0x41ba('0x1'),'update'];function createListener(_0x18f643,_0x3de713){return function(_0x220248){_0x3de713[_0x41ba('0x2')](_0x18f643,_0x220248);};}function removeListener(_0x434c65,_0x3ab00c){return function(){OpenchannelAccountEvents['removeListener'](_0x434c65,_0x3ab00c);};}exports[_0x41ba('0x3')]=function(_0x2253fe){for(var _0x1066d1=0x0,_0x46932a=events['length'];_0x1066d1<_0x46932a;_0x1066d1++){var _0x184ccd=events[_0x1066d1];var _0x51063e=createListener(_0x41ba('0x4')+_0x184ccd,_0x2253fe);OpenchannelAccountEvents['on'](_0x184ccd,_0x51063e);}}; \ No newline at end of file +var _0x1985=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit'];(function(_0x46d90a,_0x3b3e62){var _0x143941=function(_0x436098){while(--_0x436098){_0x46d90a['push'](_0x46d90a['shift']());}};_0x143941(++_0x3b3e62);}(_0x1985,0xd4));var _0x5198=function(_0x381cdb,_0x9cd80b){_0x381cdb=_0x381cdb-0x0;var _0x9e4dbd=_0x1985[_0x381cdb];return _0x9e4dbd;};'use strict';var OpenchannelAccountEvents=require(_0x5198('0x0'));var events=[_0x5198('0x1'),'remove',_0x5198('0x2')];function createListener(_0x499149,_0x12e54a){return function(_0xa73dcb){_0x12e54a[_0x5198('0x3')](_0x499149,_0xa73dcb);};}function removeListener(_0x1caa1b,_0x51faf7){return function(){OpenchannelAccountEvents[_0x5198('0x4')](_0x1caa1b,_0x51faf7);};}exports[_0x5198('0x5')]=function(_0x135de2){for(var _0x1b81d1=0x0,_0x5c1cf3=events[_0x5198('0x6')];_0x1b81d1<_0x5c1cf3;_0x1b81d1++){var _0x1b286e=events[_0x1b81d1];var _0x2498e7=createListener(_0x5198('0x7')+_0x1b286e,_0x135de2);OpenchannelAccountEvents['on'](_0x1b286e,_0x2498e7);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index db0e4ab..ec2a6dd 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 _0x268e=['destroy','exports','util','path','connect-timeout','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete'];(function(_0x535143,_0x5ae618){var _0x48a343=function(_0x45c1b5){while(--_0x45c1b5){_0x535143['push'](_0x535143['shift']());}};_0x48a343(++_0x5ae618);}(_0x268e,0xa2));var _0xe268=function(_0x2b6d42,_0x4e4797){_0x2b6d42=_0x2b6d42-0x0;var _0x24d17b=_0x268e[_0x2b6d42];return _0x24d17b;};'use strict';var multer=require('multer');var util=require(_0xe268('0x0'));var path=require(_0xe268('0x1'));var timeout=require(_0xe268('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe268('0x3'));var controller=require(_0xe268('0x4'));router[_0xe268('0x5')]('/',auth[_0xe268('0x6')](),controller[_0xe268('0x7')]);router[_0xe268('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xe268('0x8')]);router[_0xe268('0x9')]('/',auth[_0xe268('0x6')](),controller['create']);router[_0xe268('0xa')](_0xe268('0xb'),auth['isAuthenticated'](),controller[_0xe268('0xc')]);router[_0xe268('0xd')](_0xe268('0xb'),auth['isAuthenticated'](),controller[_0xe268('0xe')]);module[_0xe268('0xf')]=router; \ No newline at end of file +var _0xcb62=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','post','create','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x54a479,_0x1b321d){var _0x2474ab=function(_0x428755){while(--_0x428755){_0x54a479['push'](_0x54a479['shift']());}};_0x2474ab(++_0x1b321d);}(_0xcb62,0x186));var _0x2cb6=function(_0x24df26,_0x21beb2){_0x24df26=_0x24df26-0x0;var _0x4ed362=_0xcb62[_0x24df26];return _0x4ed362;};'use strict';var multer=require(_0x2cb6('0x0'));var util=require(_0x2cb6('0x1'));var path=require(_0x2cb6('0x2'));var timeout=require(_0x2cb6('0x3'));var express=require(_0x2cb6('0x4'));var router=express[_0x2cb6('0x5')]();var auth=require(_0x2cb6('0x6'));var interaction=require(_0x2cb6('0x7'));var config=require(_0x2cb6('0x8'));var controller=require(_0x2cb6('0x9'));router[_0x2cb6('0xa')]('/',auth['isAuthenticated'](),controller[_0x2cb6('0xb')]);router[_0x2cb6('0xa')](_0x2cb6('0xc'),auth[_0x2cb6('0xd')](),controller[_0x2cb6('0xe')]);router[_0x2cb6('0xf')]('/',auth[_0x2cb6('0xd')](),controller[_0x2cb6('0x10')]);router['put'](_0x2cb6('0xc'),auth[_0x2cb6('0xd')](),controller['update']);router[_0x2cb6('0x11')](_0x2cb6('0xc'),auth[_0x2cb6('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 98b2213..a0ba542 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 _0x1a21=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2f62d3,_0x18d5e7){var _0x26adfb=function(_0x4348d3){while(--_0x4348d3){_0x2f62d3['push'](_0x2f62d3['shift']());}};_0x26adfb(++_0x18d5e7);}(_0x1a21,0x1d9));var _0x11a2=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x1a21[_0x1ca4c3];return _0x4426a6;};'use strict';var Sequelize=require(_0x11a2('0x0'));module[_0x11a2('0x1')]={'priority':{'type':Sequelize[_0x11a2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x11a2('0x3')],'allowNull':![],'defaultValue':_0x11a2('0x4')},'appdata':{'type':Sequelize[_0x11a2('0x5')]()},'description':{'type':Sequelize[_0x11a2('0x3')]},'interval':{'type':Sequelize[_0x11a2('0x3')],'defaultValue':_0x11a2('0x6')}}; \ No newline at end of file +var _0x129f=['STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x422a0e,_0x535aca){var _0x1c1e44=function(_0x6d835c){while(--_0x6d835c){_0x422a0e['push'](_0x422a0e['shift']());}};_0x1c1e44(++_0x535aca);}(_0x129f,0x13f));var _0xf129=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x129f[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0xf129('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf129('0x1')],'allowNull':![],'defaultValue':_0xf129('0x2')},'appdata':{'type':Sequelize[_0xf129('0x3')]()},'description':{'type':Sequelize[_0xf129('0x1')]},'interval':{'type':Sequelize[_0xf129('0x1')],'defaultValue':_0xf129('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b20dd3d..2050a13 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 _0x36c6=['sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','destroy','then','error','stack','name','send','index','OpenchannelApplication','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','type','key','VIRTUAL','field','merge','count','include','findAll','show','includeAll','options','catch','create','update','body','params','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x6199f0,_0x49372f){var _0x8c23c4=function(_0x1b970f){while(--_0x1b970f){_0x6199f0['push'](_0x6199f0['shift']());}};_0x8c23c4(++_0x49372f);}(_0x36c6,0x1a5));var _0x636c=function(_0xb90aa5,_0x396d37){_0xb90aa5=_0xb90aa5-0x0;var _0x525c85=_0x36c6[_0xb90aa5];return _0x525c85;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x636c('0x0'));var rimraf=require(_0x636c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x636c('0x2'));var rp=require(_0x636c('0x3'));var moment=require('moment');var BPromise=require(_0x636c('0x4'));var Mustache=require(_0x636c('0x5'));var util=require(_0x636c('0x6'));var path=require('path');var sox=require(_0x636c('0x7'));var csv=require(_0x636c('0x8'));var ejs=require(_0x636c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x636c('0xa'));var crypto=require(_0x636c('0xb'));var jsforce=require(_0x636c('0xc'));var deskjs=require(_0x636c('0xd'));var toCsv=require(_0x636c('0x8'));var querystring=require('querystring');var Papa=require(_0x636c('0xe'));var authService=require(_0x636c('0xf'));var hardwareService=require(_0x636c('0x10'));var Redis=require(_0x636c('0x11'));var qs=require(_0x636c('0x12'));var logger=require(_0x636c('0x13'))('api');var utils=require(_0x636c('0x14'));var config=require(_0x636c('0x15'));var db=require(_0x636c('0x16'))['db'];function respondWithStatusCode(_0x399b3a,_0xafd055){_0xafd055=_0xafd055||0xcc;return function(_0x18a1fa){if(_0x18a1fa){return _0x399b3a[_0x636c('0x17')](_0xafd055);}return _0x399b3a['status'](_0xafd055)[_0x636c('0x18')]();};}function respondWithResult(_0x2dce03,_0x40070b){_0x40070b=_0x40070b||0xc8;return function(_0x3c36b8){if(_0x3c36b8){return _0x2dce03[_0x636c('0x19')](_0x40070b)[_0x636c('0x1a')](_0x3c36b8);}};}function respondWithFilteredResult(_0x52e53d,_0x332c7e){return function(_0x4093ea){if(_0x4093ea){var _0x437efd=_0x4093ea['count'],_0x229bf4=_0x332c7e['offset'],_0x20a86e=_0x332c7e[_0x636c('0x1b')]+_0x332c7e[_0x636c('0x1c')],_0x3f9e03;if(_0x20a86e>=_0x437efd){_0x20a86e=_0x437efd;_0x3f9e03=0xc8;}else{_0x3f9e03=0xce;}_0x52e53d[_0x636c('0x19')](_0x3f9e03);return _0x52e53d[_0x636c('0x1d')](_0x636c('0x1e'),_0x229bf4+'-'+_0x20a86e+'/'+_0x437efd)[_0x636c('0x1a')](_0x4093ea);}return null;};}function patchUpdates(_0x297b17){return function(_0x1a81f9){try{jsonpatch['apply'](_0x1a81f9,_0x297b17,!![]);}catch(_0x6cd3ff){return BPromise[_0x636c('0x1f')](_0x6cd3ff);}return _0x1a81f9[_0x636c('0x20')]();};}function saveUpdates(_0x4da27e,_0x494300){return function(_0x2f4822){if(_0x2f4822){return _0x2f4822['update'](_0x4da27e)['then'](function(_0x30fd20){return _0x30fd20;});}return null;};}function removeEntity(_0x182f41,_0x41123d){return function(_0x3dc28e){if(_0x3dc28e){return _0x3dc28e[_0x636c('0x21')]()[_0x636c('0x22')](function(){_0x182f41[_0x636c('0x19')](0xcc)[_0x636c('0x18')]();});}};}function handleEntityNotFound(_0x1bd5f5,_0x36338a){return function(_0x29fc75){if(!_0x29fc75){_0x1bd5f5[_0x636c('0x17')](0x194);}return _0x29fc75;};}function handleError(_0x278582,_0x2cd554){_0x2cd554=_0x2cd554||0x1f4;return function(_0x12ea52){logger[_0x636c('0x23')](_0x12ea52[_0x636c('0x24')]);if(_0x12ea52[_0x636c('0x25')]){delete _0x12ea52['name'];}_0x278582['status'](_0x2cd554)[_0x636c('0x26')](_0x12ea52);};}exports[_0x636c('0x27')]=function(_0x36cbd9,_0x58c182){var _0x341a67={},_0x375a52={},_0x585b80={'count':0x0,'rows':[]};var _0x172a2f=db[_0x636c('0x28')][_0x636c('0x29')];_0x375a52[_0x636c('0x2a')]=_[_0x636c('0x2b')](_0x172a2f);_0x375a52[_0x636c('0x2c')]=_['keys'](_0x36cbd9[_0x636c('0x2c')]);_0x375a52[_0x636c('0x2d')]=_['intersection'](_0x375a52[_0x636c('0x2a')],_0x375a52[_0x636c('0x2c')]);_0x341a67[_0x636c('0x2e')]=_[_0x636c('0x2f')](_0x375a52['model'],qs['fields'](_0x36cbd9[_0x636c('0x2c')][_0x636c('0x30')]));_0x341a67[_0x636c('0x2e')]=_0x341a67[_0x636c('0x2e')][_0x636c('0x31')]?_0x341a67[_0x636c('0x2e')]:_0x375a52[_0x636c('0x2a')];if(!_0x36cbd9[_0x636c('0x2c')][_0x636c('0x32')](_0x636c('0x33'))){_0x341a67[_0x636c('0x1c')]=qs['limit'](_0x36cbd9[_0x636c('0x2c')]['limit']);_0x341a67[_0x636c('0x1b')]=qs[_0x636c('0x1b')](_0x36cbd9['query'][_0x636c('0x1b')]);}_0x341a67[_0x636c('0x34')]=qs['sort'](_0x36cbd9[_0x636c('0x2c')][_0x636c('0x35')]);_0x341a67[_0x636c('0x36')]=qs[_0x636c('0x2d')](_[_0x636c('0x37')](_0x36cbd9['query'],_0x375a52[_0x636c('0x2d')]));if(_0x36cbd9['query']['filter']){_0x341a67['where']=_['merge'](_0x341a67[_0x636c('0x36')],{'$or':_[_0x636c('0x38')](_0x172a2f,function(_0x2a369c){if(_0x2a369c[_0x636c('0x39')][_0x636c('0x3a')]!==_0x636c('0x3b')){var _0x5b2b57={};_0x5b2b57[_0x2a369c[_0x636c('0x3c')]]={'$like':'%'+_0x36cbd9[_0x636c('0x2c')]['filter']+'%'};return _0x5b2b57;}})});}_0x341a67=_[_0x636c('0x3d')]({},_0x341a67,_0x36cbd9['options']);var _0x519cc0={'where':_0x341a67[_0x636c('0x36')]};return db[_0x636c('0x28')]['count'](_0x519cc0)[_0x636c('0x22')](function(_0x285fe9){_0x585b80[_0x636c('0x3e')]=_0x285fe9;if(_0x36cbd9[_0x636c('0x2c')]['includeAll']){_0x341a67[_0x636c('0x3f')]=[{'all':!![]}];}return db[_0x636c('0x28')][_0x636c('0x40')](_0x341a67);})[_0x636c('0x22')](function(_0x589f92){_0x585b80['rows']=_0x589f92;return _0x585b80;})['then'](respondWithFilteredResult(_0x58c182,_0x341a67))['catch'](handleError(_0x58c182,null));};exports[_0x636c('0x41')]=function(_0x24b4fb,_0x49c913){var _0x535674={'raw':!![],'where':{'id':_0x24b4fb['params']['id']}},_0x242e2f={};_0x242e2f[_0x636c('0x2a')]=_[_0x636c('0x2b')](db[_0x636c('0x28')][_0x636c('0x29')]);_0x242e2f[_0x636c('0x2c')]=_[_0x636c('0x2b')](_0x24b4fb[_0x636c('0x2c')]);_0x242e2f[_0x636c('0x2d')]=_['intersection'](_0x242e2f[_0x636c('0x2a')],_0x242e2f['query']);_0x535674[_0x636c('0x2e')]=_[_0x636c('0x2f')](_0x242e2f[_0x636c('0x2a')],qs[_0x636c('0x30')](_0x24b4fb[_0x636c('0x2c')]['fields']));_0x535674['attributes']=_0x535674[_0x636c('0x2e')][_0x636c('0x31')]?_0x535674[_0x636c('0x2e')]:_0x242e2f[_0x636c('0x2a')];if(_0x24b4fb[_0x636c('0x2c')][_0x636c('0x42')]){_0x535674[_0x636c('0x3f')]=[{'all':!![]}];}_0x535674=_[_0x636c('0x3d')]({},_0x535674,_0x24b4fb[_0x636c('0x43')]);return db[_0x636c('0x28')]['find'](_0x535674)['then'](handleEntityNotFound(_0x49c913,null))[_0x636c('0x22')](respondWithResult(_0x49c913,null))[_0x636c('0x44')](handleError(_0x49c913,null));};exports[_0x636c('0x45')]=function(_0x5dc2e0,_0x4827d5){return db[_0x636c('0x28')]['create'](_0x5dc2e0['body'],{})[_0x636c('0x22')](respondWithResult(_0x4827d5,0xc9))[_0x636c('0x44')](handleError(_0x4827d5,null));};exports[_0x636c('0x46')]=function(_0x5351c8,_0x310a2d){if(_0x5351c8[_0x636c('0x47')]['id']){delete _0x5351c8['body']['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x5351c8[_0x636c('0x48')]['id']}})['then'](handleEntityNotFound(_0x310a2d,null))[_0x636c('0x22')](saveUpdates(_0x5351c8[_0x636c('0x47')],null))['then'](respondWithResult(_0x310a2d,null))[_0x636c('0x44')](handleError(_0x310a2d,null));};exports[_0x636c('0x21')]=function(_0x5853f5,_0x25d4f8){return db[_0x636c('0x28')][_0x636c('0x49')]({'where':{'id':_0x5853f5[_0x636c('0x48')]['id']}})['then'](handleEntityNotFound(_0x25d4f8,null))[_0x636c('0x22')](removeEntity(_0x25d4f8,null))['catch'](handleError(_0x25d4f8,null));}; \ No newline at end of file +var _0x30ec=['type','VIRTUAL','field','count','includeAll','include','params','keys','rawAttributes','options','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','OpenchannelApplication','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge'];(function(_0x5ba8a7,_0x2b90eb){var _0x2f748b=function(_0x1ccba6){while(--_0x1ccba6){_0x5ba8a7['push'](_0x5ba8a7['shift']());}};_0x2f748b(++_0x2b90eb);}(_0x30ec,0x96));var _0xc30e=function(_0x3896ea,_0x489972){_0x3896ea=_0x3896ea-0x0;var _0x3527bf=_0x30ec[_0x3896ea];return _0x3527bf;};'use strict';var pdf=require(_0xc30e('0x0'));var emlformat=require(_0xc30e('0x1'));var rimraf=require(_0xc30e('0x2'));var zipdir=require(_0xc30e('0x3'));var jsonpatch=require(_0xc30e('0x4'));var rp=require('request-promise');var moment=require(_0xc30e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc30e('0x6'));var path=require(_0xc30e('0x7'));var sox=require('sox');var csv=require(_0xc30e('0x8'));var ejs=require(_0xc30e('0x9'));var fs=require('fs');var _=require(_0xc30e('0xa'));var squel=require(_0xc30e('0xb'));var crypto=require(_0xc30e('0xc'));var jsforce=require(_0xc30e('0xd'));var deskjs=require(_0xc30e('0xe'));var toCsv=require(_0xc30e('0x8'));var querystring=require(_0xc30e('0xf'));var Papa=require(_0xc30e('0x10'));var authService=require(_0xc30e('0x11'));var hardwareService=require(_0xc30e('0x12'));var Redis=require(_0xc30e('0x13'));var qs=require(_0xc30e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc30e('0x15'));var config=require(_0xc30e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55f3e2,_0x1ac1a4){_0x1ac1a4=_0x1ac1a4||0xcc;return function(_0x53cd8d){if(_0x53cd8d){return _0x55f3e2[_0xc30e('0x17')](_0x1ac1a4);}return _0x55f3e2[_0xc30e('0x18')](_0x1ac1a4)[_0xc30e('0x19')]();};}function respondWithResult(_0xef3ddf,_0x418276){_0x418276=_0x418276||0xc8;return function(_0x2cf40c){if(_0x2cf40c){return _0xef3ddf[_0xc30e('0x18')](_0x418276)[_0xc30e('0x1a')](_0x2cf40c);}};}function respondWithFilteredResult(_0x4248ad,_0x4dabb9){return function(_0x355e23){if(_0x355e23){var _0x4ea6e9=_0x355e23['count'],_0x10ff8d=_0x4dabb9[_0xc30e('0x1b')],_0x32bcff=_0x4dabb9['offset']+_0x4dabb9['limit'],_0x28a5c8;if(_0x32bcff>=_0x4ea6e9){_0x32bcff=_0x4ea6e9;_0x28a5c8=0xc8;}else{_0x28a5c8=0xce;}_0x4248ad[_0xc30e('0x18')](_0x28a5c8);return _0x4248ad[_0xc30e('0x1c')](_0xc30e('0x1d'),_0x10ff8d+'-'+_0x32bcff+'/'+_0x4ea6e9)[_0xc30e('0x1a')](_0x355e23);}return null;};}function patchUpdates(_0x2723ca){return function(_0x2e8c94){try{jsonpatch[_0xc30e('0x1e')](_0x2e8c94,_0x2723ca,!![]);}catch(_0xbb357b){return BPromise[_0xc30e('0x1f')](_0xbb357b);}return _0x2e8c94[_0xc30e('0x20')]();};}function saveUpdates(_0x1070a5,_0x4f995c){return function(_0x517ca4){if(_0x517ca4){return _0x517ca4['update'](_0x1070a5)[_0xc30e('0x21')](function(_0x1ceba6){return _0x1ceba6;});}return null;};}function removeEntity(_0x455b1d,_0x1289c8){return function(_0x437740){if(_0x437740){return _0x437740[_0xc30e('0x22')]()[_0xc30e('0x21')](function(){_0x455b1d['status'](0xcc)[_0xc30e('0x19')]();});}};}function handleEntityNotFound(_0xe5e13,_0x141143){return function(_0x41d9ad){if(!_0x41d9ad){_0xe5e13[_0xc30e('0x17')](0x194);}return _0x41d9ad;};}function handleError(_0x4c8a09,_0x17d5eb){_0x17d5eb=_0x17d5eb||0x1f4;return function(_0x10b869){logger[_0xc30e('0x23')](_0x10b869[_0xc30e('0x24')]);if(_0x10b869[_0xc30e('0x25')]){delete _0x10b869[_0xc30e('0x25')];}_0x4c8a09[_0xc30e('0x18')](_0x17d5eb)['send'](_0x10b869);};}exports[_0xc30e('0x26')]=function(_0x559ace,_0x386e60){var _0x31c227={},_0x1efe4e={},_0x470bf4={'count':0x0,'rows':[]};var _0x26890e=db[_0xc30e('0x27')]['rawAttributes'];_0x1efe4e[_0xc30e('0x28')]=_['keys'](_0x26890e);_0x1efe4e[_0xc30e('0x29')]=_['keys'](_0x559ace[_0xc30e('0x29')]);_0x1efe4e[_0xc30e('0x2a')]=_[_0xc30e('0x2b')](_0x1efe4e['model'],_0x1efe4e[_0xc30e('0x29')]);_0x31c227[_0xc30e('0x2c')]=_[_0xc30e('0x2b')](_0x1efe4e['model'],qs[_0xc30e('0x2d')](_0x559ace['query'][_0xc30e('0x2d')]));_0x31c227[_0xc30e('0x2c')]=_0x31c227[_0xc30e('0x2c')][_0xc30e('0x2e')]?_0x31c227[_0xc30e('0x2c')]:_0x1efe4e[_0xc30e('0x28')];if(!_0x559ace['query'][_0xc30e('0x2f')](_0xc30e('0x30'))){_0x31c227[_0xc30e('0x31')]=qs[_0xc30e('0x31')](_0x559ace[_0xc30e('0x29')][_0xc30e('0x31')]);_0x31c227['offset']=qs[_0xc30e('0x1b')](_0x559ace[_0xc30e('0x29')][_0xc30e('0x1b')]);}_0x31c227[_0xc30e('0x32')]=qs['sort'](_0x559ace[_0xc30e('0x29')]['sort']);_0x31c227[_0xc30e('0x33')]=qs['filters'](_[_0xc30e('0x34')](_0x559ace[_0xc30e('0x29')],_0x1efe4e[_0xc30e('0x2a')]));if(_0x559ace[_0xc30e('0x29')]['filter']){_0x31c227[_0xc30e('0x33')]=_[_0xc30e('0x35')](_0x31c227['where'],{'$or':_['map'](_0x26890e,function(_0x3abac2){if(_0x3abac2[_0xc30e('0x36')]['key']!==_0xc30e('0x37')){var _0x185075={};_0x185075[_0x3abac2[_0xc30e('0x38')]]={'$like':'%'+_0x559ace['query']['filter']+'%'};return _0x185075;}})});}_0x31c227=_['merge']({},_0x31c227,_0x559ace['options']);var _0x776d4f={'where':_0x31c227['where']};return db[_0xc30e('0x27')][_0xc30e('0x39')](_0x776d4f)['then'](function(_0x516874){_0x470bf4[_0xc30e('0x39')]=_0x516874;if(_0x559ace['query'][_0xc30e('0x3a')]){_0x31c227[_0xc30e('0x3b')]=[{'all':!![]}];}return db[_0xc30e('0x27')]['findAll'](_0x31c227);})[_0xc30e('0x21')](function(_0x2c0773){_0x470bf4['rows']=_0x2c0773;return _0x470bf4;})[_0xc30e('0x21')](respondWithFilteredResult(_0x386e60,_0x31c227))['catch'](handleError(_0x386e60,null));};exports['show']=function(_0x363cc3,_0x19e321){var _0x1c3f12={'raw':!![],'where':{'id':_0x363cc3[_0xc30e('0x3c')]['id']}},_0x3f7a20={};_0x3f7a20[_0xc30e('0x28')]=_[_0xc30e('0x3d')](db['OpenchannelApplication'][_0xc30e('0x3e')]);_0x3f7a20[_0xc30e('0x29')]=_[_0xc30e('0x3d')](_0x363cc3[_0xc30e('0x29')]);_0x3f7a20[_0xc30e('0x2a')]=_[_0xc30e('0x2b')](_0x3f7a20[_0xc30e('0x28')],_0x3f7a20['query']);_0x1c3f12['attributes']=_[_0xc30e('0x2b')](_0x3f7a20[_0xc30e('0x28')],qs[_0xc30e('0x2d')](_0x363cc3[_0xc30e('0x29')][_0xc30e('0x2d')]));_0x1c3f12[_0xc30e('0x2c')]=_0x1c3f12[_0xc30e('0x2c')][_0xc30e('0x2e')]?_0x1c3f12[_0xc30e('0x2c')]:_0x3f7a20[_0xc30e('0x28')];if(_0x363cc3[_0xc30e('0x29')][_0xc30e('0x3a')]){_0x1c3f12[_0xc30e('0x3b')]=[{'all':!![]}];}_0x1c3f12=_[_0xc30e('0x35')]({},_0x1c3f12,_0x363cc3[_0xc30e('0x3f')]);return db[_0xc30e('0x27')]['find'](_0x1c3f12)[_0xc30e('0x21')](handleEntityNotFound(_0x19e321,null))[_0xc30e('0x21')](respondWithResult(_0x19e321,null))[_0xc30e('0x40')](handleError(_0x19e321,null));};exports[_0xc30e('0x41')]=function(_0x4c73b3,_0x20a3d8){return db[_0xc30e('0x27')][_0xc30e('0x41')](_0x4c73b3['body'],{})[_0xc30e('0x21')](respondWithResult(_0x20a3d8,0xc9))[_0xc30e('0x40')](handleError(_0x20a3d8,null));};exports['update']=function(_0x245408,_0x130e74){if(_0x245408['body']['id']){delete _0x245408[_0xc30e('0x42')]['id'];}return db['OpenchannelApplication'][_0xc30e('0x43')]({'where':{'id':_0x245408[_0xc30e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x130e74,null))[_0xc30e('0x21')](saveUpdates(_0x245408[_0xc30e('0x42')],null))[_0xc30e('0x21')](respondWithResult(_0x130e74,null))['catch'](handleError(_0x130e74,null));};exports[_0xc30e('0x22')]=function(_0x4b22fa,_0x4f174d){return db['OpenchannelApplication'][_0xc30e('0x43')]({'where':{'id':_0x4b22fa[_0xc30e('0x3c')]['id']}})[_0xc30e('0x21')](handleEntityNotFound(_0x4f174d,null))[_0xc30e('0x21')](removeEntity(_0x4f174d,null))[_0xc30e('0x40')](handleError(_0x4f174d,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 4209063..9a51078 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 _0xfebf=['request-promise','exports','define','OpenchannelApplication','openchannel_applications','lodash','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfebf,0x101));var _0xffeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xffeb('0x0'));var util=require('util');var logger=require(_0xffeb('0x1'))(_0xffeb('0x2'));var moment=require(_0xffeb('0x3'));var BPromise=require('bluebird');var rp=require(_0xffeb('0x4'));var attributes=require('./openchannelApplication.attributes');module[_0xffeb('0x5')]=function(_0x1b1d7a,_0x2b39c1){return _0x1b1d7a[_0xffeb('0x6')](_0xffeb('0x7'),attributes,{'tableName':_0xffeb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x140f=['request-promise','./openchannelApplication.attributes','openchannel_applications','lodash','util','api'];(function(_0x4195dc,_0x3ec874){var _0x13281d=function(_0x18547f){while(--_0x18547f){_0x4195dc['push'](_0x4195dc['shift']());}};_0x13281d(++_0x3ec874);}(_0x140f,0x195));var _0xf140=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0x140f[_0x56daff];return _0x132c82;};'use strict';var _=require(_0xf140('0x0'));var util=require(_0xf140('0x1'));var logger=require('../../config/logger')(_0xf140('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf140('0x3'));var attributes=require(_0xf140('0x4'));module['exports']=function(_0x4b1309,_0x4c6cb7){return _0x4b1309['define']('OpenchannelApplication',attributes,{'tableName':_0xf140('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index bcaa59d..26b7ae3 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 _0x32f4=['../../config/environment','jayson/promise','client','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4c689d,_0xba2eb9){var _0x56076c=function(_0x23a24c){while(--_0x23a24c){_0x4c689d['push'](_0x4c689d['shift']());}};_0x56076c(++_0xba2eb9);}(_0x32f4,0x154));var _0x432f=function(_0x15829a,_0x56bb69){_0x15829a=_0x15829a-0x0;var _0x31aac9=_0x32f4[_0x15829a];return _0x31aac9;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});}exports[_0x432f('0x16')]=function(_0x243cf){var _0x3cd5da=this;return new Promise(function(_0x129582,_0x5ae24e){return db[_0x432f('0x17')]['update'](_0x243cf[_0x432f('0x18')],{'raw':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')][_0x432f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')][_0x432f('0x1b')]||null:null,'attributes':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')][_0x432f('0x1c')]||null:null,'limit':_0x243cf[_0x432f('0x19')]?_0x243cf[_0x432f('0x19')]['limit']||null:null})['then'](function(_0x343d13){logger['info'](_0x432f('0x16'),_0x243cf);logger['debug'](_0x432f('0x16'),_0x243cf,JSON[_0x432f('0x10')](_0x343d13));_0x129582(_0x343d13);})[_0x432f('0x15')](function(_0x89ea50){logger[_0x432f('0x11')](_0x432f('0x16'),_0x89ea50['message'],_0x243cf);_0x5ae24e(_0x3cd5da[_0x432f('0x11')](0x1f4,_0x89ea50[_0x432f('0x13')]));});});}; \ No newline at end of file +var _0x5328=['where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','raw'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x5328,0x12f));var _0x8532=function(_0x4c5a46,_0xcc68c){_0x4c5a46=_0x4c5a46-0x0;var _0x54da0d=_0x5328[_0x4c5a46];return _0x54da0d;};'use strict';var _=require(_0x8532('0x0'));var util=require(_0x8532('0x1'));var moment=require(_0x8532('0x2'));var BPromise=require(_0x8532('0x3'));var rs=require(_0x8532('0x4'));var fs=require('fs');var Redis=require(_0x8532('0x5'));var db=require(_0x8532('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8532('0x7'))(_0x8532('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8532('0x9')][_0x8532('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea926,_0x98897e,_0x33b1e9){return new BPromise(function(_0x44e328,_0x457bbf){return client[_0x8532('0xb')](_0x4ea926,_0x33b1e9)[_0x8532('0xc')](function(_0x51e25d){logger[_0x8532('0xd')](_0x8532('0xe'),_0x98897e,'request\x20sent');logger[_0x8532('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x98897e,_0x8532('0x10'),JSON[_0x8532('0x11')](_0x51e25d));if(_0x51e25d[_0x8532('0x12')]){if(_0x51e25d[_0x8532('0x12')][_0x8532('0x13')]===0x1f4){logger[_0x8532('0x12')](_0x8532('0xe'),_0x98897e,_0x51e25d['error'][_0x8532('0x14')]);return _0x457bbf(_0x51e25d[_0x8532('0x12')]['message']);}logger['error'](_0x8532('0xe'),_0x98897e,_0x51e25d[_0x8532('0x12')][_0x8532('0x14')]);return _0x44e328(_0x51e25d['error'][_0x8532('0x14')]);}else{logger[_0x8532('0xd')](_0x8532('0xe'),_0x98897e,_0x8532('0x10'));_0x44e328(_0x51e25d[_0x8532('0x15')][_0x8532('0x14')]);}})[_0x8532('0x16')](function(_0x55b429){logger[_0x8532('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x98897e,_0x55b429);_0x457bbf(_0x55b429);});});}exports[_0x8532('0x17')]=function(_0x385631){var _0x3d4a64=this;return new Promise(function(_0x2f3dba,_0x1cdb8e){return db[_0x8532('0x18')]['update'](_0x385631['body'],{'raw':_0x385631[_0x8532('0x19')]?_0x385631[_0x8532('0x19')][_0x8532('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x385631[_0x8532('0x19')]?_0x385631[_0x8532('0x19')][_0x8532('0x1b')]||null:null,'attributes':_0x385631['options']?_0x385631['options'][_0x8532('0x1c')]||null:null,'limit':_0x385631['options']?_0x385631[_0x8532('0x19')][_0x8532('0x1d')]||null:null})['then'](function(_0x457c14){logger['info'](_0x8532('0x17'),_0x385631);logger[_0x8532('0xf')]('UpdateOpenchannelApplication',_0x385631,JSON[_0x8532('0x11')](_0x457c14));_0x2f3dba(_0x457c14);})[_0x8532('0x16')](function(_0x4be0fc){logger[_0x8532('0x12')]('UpdateOpenchannelApplication',_0x4be0fc[_0x8532('0x14')],_0x385631);_0x1cdb8e(_0x3d4a64[_0x8532('0x12')](0x1f4,_0x4be0fc[_0x8532('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 10eeff4..9ccdda3 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 _0x1031=['openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','/:id/tags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','addTags','put','tracked'];(function(_0x1f442c,_0x57e076){var _0xc74cba=function(_0x3c4ce5){while(--_0x3c4ce5){_0x1f442c['push'](_0x1f442c['shift']());}};_0xc74cba(++_0x57e076);}(_0x1031,0x1b9));var _0x1103=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x1031[_0x47a349];return _0x18ab75;};'use strict';var multer=require('multer');var util=require(_0x1103('0x0'));var path=require(_0x1103('0x1'));var timeout=require(_0x1103('0x2'));var express=require(_0x1103('0x3'));var router=express[_0x1103('0x4')]();var auth=require(_0x1103('0x5'));var interaction=require(_0x1103('0x6'));var config=require(_0x1103('0x7'));var controller=require(_0x1103('0x8'));router['get']('/',auth[_0x1103('0x9')](),controller[_0x1103('0xa')]);router[_0x1103('0xb')](_0x1103('0xc'),auth[_0x1103('0x9')](),controller[_0x1103('0xd')]);router[_0x1103('0xb')](_0x1103('0xe'),auth[_0x1103('0x9')](),controller['show']);router[_0x1103('0xb')](_0x1103('0xf'),auth[_0x1103('0x9')](),controller[_0x1103('0x10')]);router[_0x1103('0xb')](_0x1103('0x11'),auth['isAuthenticated'](),controller['download']);router[_0x1103('0x12')]('/',auth[_0x1103('0x9')](),controller[_0x1103('0x13')]);router[_0x1103('0x12')](_0x1103('0xf'),auth[_0x1103('0x9')](),controller[_0x1103('0x14')]);router['post']('/:id/tags',auth[_0x1103('0x9')](),interaction['tracked']('openchannel','openchannelinteraction:addtags'),controller[_0x1103('0x15')]);router[_0x1103('0x16')](_0x1103('0xe'),auth[_0x1103('0x9')](),interaction[_0x1103('0x17')]('openchannel',_0x1103('0x18')),controller[_0x1103('0x19')]);router[_0x1103('0x1a')](_0x1103('0xe'),auth[_0x1103('0x9')](),interaction[_0x1103('0x17')](_0x1103('0x1b'),_0x1103('0x1c')),controller['destroy']);router[_0x1103('0x1a')](_0x1103('0x1d'),auth[_0x1103('0x9')](),controller['removeTags']);module[_0x1103('0x1e')]=router; \ No newline at end of file +var _0xa5d6=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','openchannelinteraction:addtags','addTags','put','/:id','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','path'];(function(_0x561975,_0x1d64fc){var _0x15b7f5=function(_0x43bfc1){while(--_0x43bfc1){_0x561975['push'](_0x561975['shift']());}};_0x15b7f5(++_0x1d64fc);}(_0xa5d6,0x1ee));var _0x6a5d=function(_0x4f173b,_0x33a83e){_0x4f173b=_0x4f173b-0x0;var _0x3782d3=_0xa5d6[_0x4f173b];return _0x3782d3;};'use strict';var multer=require(_0x6a5d('0x0'));var util=require('util');var path=require(_0x6a5d('0x1'));var timeout=require(_0x6a5d('0x2'));var express=require(_0x6a5d('0x3'));var router=express[_0x6a5d('0x4')]();var auth=require(_0x6a5d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6a5d('0x6'));var controller=require(_0x6a5d('0x7'));router[_0x6a5d('0x8')]('/',auth[_0x6a5d('0x9')](),controller['index']);router[_0x6a5d('0x8')](_0x6a5d('0xa'),auth[_0x6a5d('0x9')](),controller['describe']);router[_0x6a5d('0x8')]('/:id',auth[_0x6a5d('0x9')](),controller[_0x6a5d('0xb')]);router[_0x6a5d('0x8')](_0x6a5d('0xc'),auth[_0x6a5d('0x9')](),controller[_0x6a5d('0xd')]);router[_0x6a5d('0x8')](_0x6a5d('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x6a5d('0xf')]('/',auth[_0x6a5d('0x9')](),controller[_0x6a5d('0x10')]);router[_0x6a5d('0xf')]('/:id/messages',auth[_0x6a5d('0x9')](),controller[_0x6a5d('0x11')]);router[_0x6a5d('0xf')](_0x6a5d('0x12'),auth[_0x6a5d('0x9')](),interaction['tracked']('openchannel',_0x6a5d('0x13')),controller[_0x6a5d('0x14')]);router[_0x6a5d('0x15')](_0x6a5d('0x16'),auth['isAuthenticated'](),interaction['tracked'](_0x6a5d('0x17'),_0x6a5d('0x18')),controller[_0x6a5d('0x19')]);router[_0x6a5d('0x1a')](_0x6a5d('0x16'),auth[_0x6a5d('0x9')](),interaction['tracked'](_0x6a5d('0x17'),_0x6a5d('0x1b')),controller[_0x6a5d('0x1c')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x6a5d('0x1d')]);module[_0x6a5d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5551508..e890ff7 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 _0x4b19=['STRING','ENUM','out','sequelize','BOOLEAN','DATE'];(function(_0x3ad6bd,_0x4aef2c){var _0x27f188=function(_0x18a2fa){while(--_0x18a2fa){_0x3ad6bd['push'](_0x3ad6bd['shift']());}};_0x27f188(++_0x4aef2c);}(_0x4b19,0x195));var _0x94b1=function(_0x41c63b,_0x5be343){_0x41c63b=_0x41c63b-0x0;var _0x16ca9f=_0x4b19[_0x41c63b];return _0x16ca9f;};'use strict';var Sequelize=require(_0x94b1('0x0'));module['exports']={'closed':{'type':Sequelize[_0x94b1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x94b1('0x2')]},'disposition':{'type':Sequelize[_0x94b1('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x94b1('0x2')]},'threadId':{'type':Sequelize[_0x94b1('0x3')]},'externalUrl':{'type':Sequelize[_0x94b1('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x94b1('0x4')]('in',_0x94b1('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x394e=['DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x394e,0x88));var _0xe394=function(_0x3a74c2,_0x282fb9){_0x3a74c2=_0x3a74c2-0x0;var _0x19d99c=_0x394e[_0x3a74c2];return _0x19d99c;};'use strict';var Sequelize=require(_0xe394('0x0'));module[_0xe394('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe394('0x2')]},'disposition':{'type':Sequelize[_0xe394('0x3')]},'note':{'type':Sequelize[_0xe394('0x3')]},'read1stAt':{'type':Sequelize[_0xe394('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xe394('0x3')]},'lastMsgAt':{'type':Sequelize[_0xe394('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe394('0x4')]('in',_0xe394('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe394('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d241b99..0765f03 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 _0x8f2d=['sort','where','pick','filter','merge','map','type','key','field','options','include','tag','push','Tag','Tags','distinct','read','OpenchannelMessage','Messages','direction','createdAt','includeAll','User','Users','fullname','CmContact','Contact','internal','OpenchannelAccount','Account','color','ThroughTags','rows','catch','show','length','create','body','find','params','describe','addMessage','omit','getMessages','findOne','rawAttributes','OpenchannelInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','ids','download','unix','toString','join','root','server','files','tmp','attachments','interaction-%s.zip','firstName','Attachment','Letter','

Openchannel\x20Interaction:\x20#%d

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','','createReadStream','pipe','createWriteStream','basename','toFile','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','update','then','destroy','error','name','send','index','OpenchannelInteraction','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit'];(function(_0x13c2cf,_0x568ba5){var _0x237785=function(_0x57095a){while(--_0x57095a){_0x13c2cf['push'](_0x13c2cf['shift']());}};_0x237785(++_0x568ba5);}(_0x8f2d,0xd5));var _0xd8f2=function(_0xb1d5b9,_0x4db6b3){_0xb1d5b9=_0xb1d5b9-0x0;var _0xb0157f=_0x8f2d[_0xb1d5b9];return _0xb0157f;};'use strict';var pdf=require(_0xd8f2('0x0'));var emlformat=require(_0xd8f2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd8f2('0x2'));var jsonpatch=require(_0xd8f2('0x3'));var rp=require(_0xd8f2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd8f2('0x5'));var util=require(_0xd8f2('0x6'));var path=require(_0xd8f2('0x7'));var sox=require(_0xd8f2('0x8'));var csv=require(_0xd8f2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd8f2('0xa'));var squel=require(_0xd8f2('0xb'));var crypto=require(_0xd8f2('0xc'));var jsforce=require(_0xd8f2('0xd'));var deskjs=require(_0xd8f2('0xe'));var toCsv=require(_0xd8f2('0x9'));var querystring=require('querystring');var Papa=require(_0xd8f2('0xf'));var authService=require(_0xd8f2('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xd8f2('0x11'));var qs=require(_0xd8f2('0x12'));var logger=require(_0xd8f2('0x13'))(_0xd8f2('0x14'));var utils=require(_0xd8f2('0x15'));var config=require(_0xd8f2('0x16'));var db=require('../../mysqldb')['db'];config[_0xd8f2('0x17')]=_[_0xd8f2('0x18')](config[_0xd8f2('0x17')],{'host':_0xd8f2('0x19'),'port':0x18eb});var socket=require(_0xd8f2('0x1a'))(new Redis(config[_0xd8f2('0x17')]));require('./openchannelInteraction.socket')[_0xd8f2('0x1b')](socket);function respondWithStatusCode(_0x30d8fd,_0x161e5f){_0x161e5f=_0x161e5f||0xcc;return function(_0x19257f){if(_0x19257f){return _0x30d8fd[_0xd8f2('0x1c')](_0x161e5f);}return _0x30d8fd['status'](_0x161e5f)[_0xd8f2('0x1d')]();};}function respondWithResult(_0x37e347,_0x495feb){_0x495feb=_0x495feb||0xc8;return function(_0x18847c){if(_0x18847c){return _0x37e347[_0xd8f2('0x1e')](_0x495feb)[_0xd8f2('0x1f')](_0x18847c);}};}function respondWithFilteredResult(_0x25b4e2,_0x30d948){return function(_0x47475d){if(_0x47475d){var _0x418902=_0x47475d[_0xd8f2('0x20')],_0x528c42=_0x30d948[_0xd8f2('0x21')],_0x3a1187=_0x30d948[_0xd8f2('0x21')]+_0x30d948['limit'],_0x382e89;if(_0x3a1187>=_0x418902){_0x3a1187=_0x418902;_0x382e89=0xc8;}else{_0x382e89=0xce;}_0x25b4e2['status'](_0x382e89);return _0x25b4e2['set'](_0xd8f2('0x22'),_0x528c42+'-'+_0x3a1187+'/'+_0x418902)[_0xd8f2('0x1f')](_0x47475d);}return null;};}function patchUpdates(_0x584852){return function(_0x49ba82){try{jsonpatch[_0xd8f2('0x23')](_0x49ba82,_0x584852,!![]);}catch(_0x35841f){return BPromise[_0xd8f2('0x24')](_0x35841f);}return _0x49ba82['save']();};}function saveUpdates(_0x56bef4,_0x366a9c){return function(_0xc8dc4f){if(_0xc8dc4f){return _0xc8dc4f[_0xd8f2('0x25')](_0x56bef4)[_0xd8f2('0x26')](function(_0x4873e5){return _0x4873e5;});}return null;};}function removeEntity(_0x5885c8,_0x5f5211){return function(_0x3eeb92){if(_0x3eeb92){return _0x3eeb92[_0xd8f2('0x27')]()['then'](function(){_0x5885c8[_0xd8f2('0x1e')](0xcc)[_0xd8f2('0x1d')]();});}};}function handleEntityNotFound(_0x216cf2,_0x2c562e){return function(_0x39a682){if(!_0x39a682){_0x216cf2[_0xd8f2('0x1c')](0x194);}return _0x39a682;};}function handleError(_0x31a3c6,_0x1c6c7b){_0x1c6c7b=_0x1c6c7b||0x1f4;return function(_0x3a7195){logger[_0xd8f2('0x28')](_0x3a7195['stack']);if(_0x3a7195[_0xd8f2('0x29')]){delete _0x3a7195[_0xd8f2('0x29')];}_0x31a3c6[_0xd8f2('0x1e')](_0x1c6c7b)[_0xd8f2('0x2a')](_0x3a7195);};}exports[_0xd8f2('0x2b')]=function(_0x23cd3c,_0x138766){var _0x4e9090={},_0xf5ac2b={},_0x5c848c={'count':0x0,'rows':[]};var _0x2886d8=db[_0xd8f2('0x2c')]['rawAttributes'];_0xf5ac2b['model']=_[_0xd8f2('0x2d')](_0x2886d8);_0xf5ac2b[_0xd8f2('0x2e')]=_[_0xd8f2('0x2d')](_0x23cd3c[_0xd8f2('0x2e')]);_0xf5ac2b[_0xd8f2('0x2f')]=_['intersection'](_0xf5ac2b[_0xd8f2('0x30')],_0xf5ac2b[_0xd8f2('0x2e')]);_0x4e9090[_0xd8f2('0x31')]=_[_0xd8f2('0x32')](_0xf5ac2b[_0xd8f2('0x30')],qs[_0xd8f2('0x33')](_0x23cd3c[_0xd8f2('0x2e')][_0xd8f2('0x33')]));_0x4e9090[_0xd8f2('0x31')]=_0x4e9090[_0xd8f2('0x31')]['length']?_0x4e9090[_0xd8f2('0x31')]:_0xf5ac2b[_0xd8f2('0x30')];if(!_0x23cd3c['query'][_0xd8f2('0x34')](_0xd8f2('0x35'))){_0x4e9090[_0xd8f2('0x36')]=qs[_0xd8f2('0x36')](_0x23cd3c['query']['limit']);_0x4e9090[_0xd8f2('0x21')]=qs['offset'](_0x23cd3c['query'][_0xd8f2('0x21')]);}_0x4e9090['order']=qs[_0xd8f2('0x37')](_0x23cd3c['query'][_0xd8f2('0x37')]);_0x4e9090[_0xd8f2('0x38')]=qs[_0xd8f2('0x2f')](_[_0xd8f2('0x39')](_0x23cd3c[_0xd8f2('0x2e')],_0xf5ac2b[_0xd8f2('0x2f')]));if(_0x23cd3c['query'][_0xd8f2('0x3a')]){_0x4e9090[_0xd8f2('0x38')]=_[_0xd8f2('0x3b')](_0x4e9090[_0xd8f2('0x38')],{'$or':_[_0xd8f2('0x3c')](_0x2886d8,function(_0x611c40){if(_0x611c40[_0xd8f2('0x3d')][_0xd8f2('0x3e')]!=='VIRTUAL'){var _0xf60a41={};_0xf60a41[_0x611c40[_0xd8f2('0x3f')]]={'$like':'%'+_0x23cd3c['query'][_0xd8f2('0x3a')]+'%'};return _0xf60a41;}})});}_0x4e9090=_[_0xd8f2('0x3b')]({},_0x4e9090,_0x23cd3c[_0xd8f2('0x40')]);var _0x218d7c={'where':_0x4e9090[_0xd8f2('0x38')]};_0x218d7c[_0xd8f2('0x41')]=[];if(_0x23cd3c[_0xd8f2('0x2e')][_0xd8f2('0x42')]){_0x218d7c[_0xd8f2('0x41')][_0xd8f2('0x43')]({'model':db[_0xd8f2('0x44')],'as':_0xd8f2('0x45'),'attributes':['id'],'where':{'id':_0x23cd3c[_0xd8f2('0x2e')][_0xd8f2('0x42')]},'required':!![]});_0x218d7c[_0xd8f2('0x46')]=!![];}if(_0x23cd3c['query'][_0xd8f2('0x47')]){_0x218d7c[_0xd8f2('0x41')][_0xd8f2('0x43')]({'model':db[_0xd8f2('0x48')],'as':_0xd8f2('0x49'),'attributes':['id',_0xd8f2('0x4a'),_0xd8f2('0x4b'),_0xd8f2('0x47')],'where':{'direction':'in','read':_0x23cd3c[_0xd8f2('0x2e')][_0xd8f2('0x47')]||![]},'required':!![]});_0x218d7c[_0xd8f2('0x46')]=!![];}return db[_0xd8f2('0x2c')]['count'](_0x218d7c)[_0xd8f2('0x26')](function(_0x186f13){_0x5c848c[_0xd8f2('0x20')]=_0x186f13;if(_0x23cd3c['query'][_0xd8f2('0x4c')]){_0x4e9090['include']=[{'model':db[_0xd8f2('0x4d')],'as':_0xd8f2('0x4e'),'required':![],'attributes':['id',_0xd8f2('0x29'),_0xd8f2('0x4f')]},{'model':db[_0xd8f2('0x50')],'as':_0xd8f2('0x51'),'required':![]},{'model':db[_0xd8f2('0x4d')],'as':'Owner','attributes':[_0xd8f2('0x29'),'fullname',_0xd8f2('0x52')],'required':![]},{'model':db[_0xd8f2('0x53')],'as':_0xd8f2('0x54'),'attributes':[_0xd8f2('0x29'),_0xd8f2('0x3e')],'required':![]},{'model':db[_0xd8f2('0x48')],'as':_0xd8f2('0x49'),'attributes':['id',_0xd8f2('0x4a'),'createdAt',_0xd8f2('0x47')],'where':{'direction':'in','read':_0x23cd3c[_0xd8f2('0x2e')][_0xd8f2('0x47')]||![]},'required':_0x23cd3c[_0xd8f2('0x2e')][_0xd8f2('0x47')]||![]},{'model':db[_0xd8f2('0x44')],'as':_0xd8f2('0x45'),'attributes':['id',_0xd8f2('0x29'),_0xd8f2('0x55')],'required':_0x23cd3c[_0xd8f2('0x2e')]['tag']?!![]:![]},{'model':db[_0xd8f2('0x44')],'as':_0xd8f2('0x56'),'attributes':['id',_0xd8f2('0x29'),_0xd8f2('0x55')],'through':_0x23cd3c[_0xd8f2('0x2e')]['tag']?{'attributes':[],'where':{'TagId':_0x23cd3c[_0xd8f2('0x2e')][_0xd8f2('0x42')]||undefined}}:{},'required':_0x23cd3c[_0xd8f2('0x2e')][_0xd8f2('0x42')]?!![]:![]}];}return db[_0xd8f2('0x2c')]['findAll'](_0x4e9090);})[_0xd8f2('0x26')](function(_0x188cf2){_0x5c848c[_0xd8f2('0x57')]=_0x188cf2;return _0x5c848c;})[_0xd8f2('0x26')](respondWithFilteredResult(_0x138766,_0x4e9090))[_0xd8f2('0x58')](handleError(_0x138766,null));};exports[_0xd8f2('0x59')]=function(_0x1ef256,_0x264cf7){var _0x3ba976={'raw':![],'where':{'id':_0x1ef256['params']['id']}},_0x24b727={};_0x24b727[_0xd8f2('0x30')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x24b727[_0xd8f2('0x2e')]=_[_0xd8f2('0x2d')](_0x1ef256[_0xd8f2('0x2e')]);_0x24b727[_0xd8f2('0x2f')]=_[_0xd8f2('0x32')](_0x24b727[_0xd8f2('0x30')],_0x24b727[_0xd8f2('0x2e')]);_0x3ba976[_0xd8f2('0x31')]=_[_0xd8f2('0x32')](_0x24b727[_0xd8f2('0x30')],qs[_0xd8f2('0x33')](_0x1ef256[_0xd8f2('0x2e')]['fields']));_0x3ba976[_0xd8f2('0x31')]=_0x3ba976[_0xd8f2('0x31')][_0xd8f2('0x5a')]?_0x3ba976[_0xd8f2('0x31')]:_0x24b727['model'];if(_0x1ef256[_0xd8f2('0x2e')]['includeAll']){_0x3ba976[_0xd8f2('0x41')]=[{'all':!![]}];}_0x3ba976=_['merge']({},_0x3ba976,_0x1ef256[_0xd8f2('0x40')]);return db[_0xd8f2('0x2c')]['find'](_0x3ba976)[_0xd8f2('0x26')](handleEntityNotFound(_0x264cf7,null))[_0xd8f2('0x26')](respondWithResult(_0x264cf7,null))['catch'](handleError(_0x264cf7,null));};exports[_0xd8f2('0x5b')]=function(_0x1323f3,_0x134983){return db[_0xd8f2('0x2c')]['create'](_0x1323f3[_0xd8f2('0x5c')],{})[_0xd8f2('0x26')](respondWithResult(_0x134983,0xc9))[_0xd8f2('0x58')](handleError(_0x134983,null));};exports[_0xd8f2('0x25')]=function(_0x75348b,_0x205ea0){if(_0x75348b[_0xd8f2('0x5c')]['id']){delete _0x75348b['body']['id'];}return db['OpenchannelInteraction'][_0xd8f2('0x5d')]({'where':{'id':_0x75348b[_0xd8f2('0x5e')]['id']}})[_0xd8f2('0x26')](handleEntityNotFound(_0x205ea0,null))['then'](saveUpdates(_0x75348b[_0xd8f2('0x5c')],null))['then'](respondWithResult(_0x205ea0,null))[_0xd8f2('0x58')](handleError(_0x205ea0,null));};exports[_0xd8f2('0x27')]=function(_0x386938,_0x48d923){return db[_0xd8f2('0x2c')]['find']({'where':{'id':_0x386938[_0xd8f2('0x5e')]['id']}})[_0xd8f2('0x26')](handleEntityNotFound(_0x48d923,null))[_0xd8f2('0x26')](removeEntity(_0x48d923,null))[_0xd8f2('0x58')](handleError(_0x48d923,null));};exports[_0xd8f2('0x5f')]=function(_0x27a33f,_0x523408){return db[_0xd8f2('0x2c')][_0xd8f2('0x5f')]()[_0xd8f2('0x26')](respondWithResult(_0x523408,null))[_0xd8f2('0x58')](handleError(_0x523408,null));};exports[_0xd8f2('0x60')]=function(_0x27cf77,_0x5995a3,_0x3449b4){return db[_0xd8f2('0x48')][_0xd8f2('0x5d')]({'where':{'id':_0x27cf77[_0xd8f2('0x5e')]['id']}})[_0xd8f2('0x26')](handleEntityNotFound(_0x5995a3,null))[_0xd8f2('0x26')](function(_0x5dae9e){if(_0x5dae9e){return _0x5dae9e['addMessage'](_0x27cf77[_0xd8f2('0x5c')]['ids'],_[_0xd8f2('0x61')](_0x27cf77[_0xd8f2('0x5c')],['ids','id'])||{});}})[_0xd8f2('0x26')](respondWithResult(_0x5995a3,null))['catch'](handleError(_0x5995a3,null));};exports[_0xd8f2('0x62')]=function(_0x539d79,_0x59a31c,_0xa64d58){var _0x4c3766={'raw':![],'where':{}};var _0x372580={};var _0x177cd9={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xd8f2('0x63')]({'where':{'id':_0x539d79['params']['id']}})[_0xd8f2('0x26')](handleEntityNotFound(_0x59a31c,null))[_0xd8f2('0x26')](function(_0x116146){if(_0x116146){_0x372580['model']=_[_0xd8f2('0x2d')](db[_0xd8f2('0x48')][_0xd8f2('0x64')]);_0x372580[_0xd8f2('0x2e')]=_['keys'](_0x539d79[_0xd8f2('0x2e')]);_0x372580[_0xd8f2('0x2f')]=_[_0xd8f2('0x32')](_0x372580[_0xd8f2('0x30')],_0x372580[_0xd8f2('0x2e')]);_0x4c3766[_0xd8f2('0x31')]=_[_0xd8f2('0x32')](_0x372580[_0xd8f2('0x30')],qs[_0xd8f2('0x33')](_0x539d79[_0xd8f2('0x2e')][_0xd8f2('0x33')]));_0x4c3766['attributes']=_0x4c3766[_0xd8f2('0x31')]['length']?_0x4c3766[_0xd8f2('0x31')]:_0x372580[_0xd8f2('0x30')];if(!_0x539d79[_0xd8f2('0x2e')]['hasOwnProperty']('nolimit')){_0x4c3766[_0xd8f2('0x36')]=qs[_0xd8f2('0x36')](_0x539d79[_0xd8f2('0x2e')]['limit']);_0x4c3766[_0xd8f2('0x21')]=qs[_0xd8f2('0x21')](_0x539d79[_0xd8f2('0x2e')][_0xd8f2('0x21')]);}_0x4c3766['order']=qs[_0xd8f2('0x37')](_0x539d79[_0xd8f2('0x2e')][_0xd8f2('0x37')]);_0x4c3766[_0xd8f2('0x38')]=qs['filters'](_['pick'](_0x539d79[_0xd8f2('0x2e')],_0x372580[_0xd8f2('0x2f')]));_0x4c3766[_0xd8f2('0x38')][_0xd8f2('0x65')]=_0x116146['id'];if(_0x539d79[_0xd8f2('0x2e')]['filter']){_0x4c3766[_0xd8f2('0x38')]=_[_0xd8f2('0x3b')](_0x4c3766[_0xd8f2('0x38')],{'$or':_['map'](_0x4c3766[_0xd8f2('0x31')],function(_0x2d71d6){var _0x241308={};_0x241308[_0x2d71d6]={'$like':'%'+_0x539d79[_0xd8f2('0x2e')]['filter']+'%'};return _0x241308;})});}if(_0x539d79[_0xd8f2('0x2e')][_0xd8f2('0x66')]){var _0x26785d=_0x539d79[_0xd8f2('0x2e')][_0xd8f2('0x66')][_0xd8f2('0x67')](',');var _0x2143f2={};_0x2143f2[_0x26785d[0x0]]={'$gte':moment(_0x26785d[0x1])[_0xd8f2('0x68')](_0xd8f2('0x69'))};_0x4c3766[_0xd8f2('0x38')]=_['merge'](_0x4c3766[_0xd8f2('0x38')],_0x2143f2);}_0x4c3766=_[_0xd8f2('0x3b')]({},_0x4c3766,_0x539d79[_0xd8f2('0x40')]);return db['OpenchannelMessage'][_0xd8f2('0x20')]({'where':_0x4c3766[_0xd8f2('0x38')]})[_0xd8f2('0x26')](function(_0x2fdf2f){_0x177cd9[_0xd8f2('0x20')]=_0x2fdf2f;if(_0x539d79[_0xd8f2('0x2e')]['includeAll']){_0x4c3766[_0xd8f2('0x41')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xd8f2('0x6a')](_0x4c3766);})[_0xd8f2('0x26')](function(_0x1964cb){_0x177cd9['rows']=_0x1964cb;return _0x177cd9;});}})[_0xd8f2('0x26')](respondWithFilteredResult(_0x59a31c,_0x4c3766))[_0xd8f2('0x58')](handleError(_0x59a31c,null));};exports['addTags']=function(_0x5cf2d9,_0x145d36,_0x100b10){return db['OpenchannelInteraction']['find']({'where':{'id':_0x5cf2d9[_0xd8f2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x145d36,null))['then'](function(_0x2c0f2c){if(_0x2c0f2c){return _0x2c0f2c[_0xd8f2('0x6b')](_0x5cf2d9[_0xd8f2('0x5c')][_0xd8f2('0x6c')],_[_0xd8f2('0x61')](_0x5cf2d9[_0xd8f2('0x5c')],['ids','id'])||{})['spread'](function(){return db[_0xd8f2('0x44')][_0xd8f2('0x6a')]({'attributes':['id',_0xd8f2('0x29'),_0xd8f2('0x55')],'where':{'id':_0x5cf2d9[_0xd8f2('0x5c')][_0xd8f2('0x6c')]}});})[_0xd8f2('0x26')](function(_0x22e2e6){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x5cf2d9[_0xd8f2('0x5e')]['id']),'tags':_0x22e2e6||[]});return{'id':Number(_0x5cf2d9[_0xd8f2('0x5e')]['id']),'tags':_0x22e2e6||[]};});}})[_0xd8f2('0x26')](respondWithResult(_0x145d36,null))[_0xd8f2('0x58')](handleError(_0x145d36,null));};exports['removeTags']=function(_0x42f432,_0x3095da,_0x194e58){var _0xe2d287;return db[_0xd8f2('0x2c')][_0xd8f2('0x5d')]({'where':{'id':_0x42f432['params']['id']}})[_0xd8f2('0x26')](handleEntityNotFound(_0x3095da,null))['then'](function(_0x13ed34){if(_0x13ed34){return _0x13ed34['removeTags'](_0x42f432[_0xd8f2('0x2e')][_0xd8f2('0x6c')]);}})[_0xd8f2('0x26')](respondWithStatusCode(_0x3095da,null))['catch'](handleError(_0x3095da,null));};exports[_0xd8f2('0x6d')]=function(_0x488f34,_0x248cbc){var _0x2c6893=moment()[_0xd8f2('0x6e')]()[_0xd8f2('0x6f')]();var _0xdb38ec=path[_0xd8f2('0x70')](config[_0xd8f2('0x71')],_0xd8f2('0x72'),_0xd8f2('0x73'),_0xd8f2('0x74'));var _0x20158c=path[_0xd8f2('0x70')](config[_0xd8f2('0x71')],_0xd8f2('0x72'),_0xd8f2('0x73'),_0xd8f2('0x75'));var _0x57ad72=path[_0xd8f2('0x70')](_0xdb38ec,_0x2c6893);var _0x3a5fef=util['format'](_0xd8f2('0x76'),_0x2c6893);var _0xdd1cd=path[_0xd8f2('0x70')](_0xdb38ec,_0x3a5fef);var _0x3e8a75=![];return db[_0xd8f2('0x2c')][_0xd8f2('0x5d')]({'where':{'id':_0x488f34[_0xd8f2('0x5e')]['id']},'include':[{'model':db[_0xd8f2('0x48')],'as':_0xd8f2('0x49'),'attributes':['id','body'],'include':[{'model':db[_0xd8f2('0x4d')],'as':_0xd8f2('0x4d'),'attributes':['id',_0xd8f2('0x4f')],'raw':!![]},{'model':db[_0xd8f2('0x50')],'as':_0xd8f2('0x51'),'attributes':['id',_0xd8f2('0x77')],'raw':!![]},{'model':db[_0xd8f2('0x78')],'as':'Attachment','raw':!![]}]}]})['then'](handleEntityNotFound(_0x248cbc,null))[_0xd8f2('0x26')](function(_0x4aa4f4){if(_0x4aa4f4){_0x3e8a75=!![];var _0x35ca04='';var _0x8e3ccf={'format':_0xd8f2('0x79'),'border':'1cm'};fs['mkdirSync'](_0x57ad72);_0x35ca04+=util['format'](_0xd8f2('0x7a'),_0x4aa4f4['id']);_0x35ca04+=util[_0xd8f2('0x68')]('

Date:\x20%s

',moment()[_0xd8f2('0x68')](_0xd8f2('0x7b'))[_0xd8f2('0x6f')]());_0x35ca04+='
';for(var _0x589c45=0x0;_0x589c45<_0x4aa4f4[_0xd8f2('0x49')][_0xd8f2('0x5a')];_0x589c45++){var _0x479f94=_0x4aa4f4['Messages'][_0x589c45];_0x35ca04+='';_0x35ca04+=util['format']('%s:\x20%s

',_0x479f94[_0xd8f2('0x4d')]?_0x479f94[_0xd8f2('0x4d')][_0xd8f2('0x4f')]:_0x479f94['Contact'][_0xd8f2('0x77')],_0x479f94[_0xd8f2('0x5c')]);_0x35ca04+=_0xd8f2('0x7c');if(_0x479f94[_0xd8f2('0x78')]){var _0x38539d=_0x479f94[_0xd8f2('0x78')];var _0x46d77d=path[_0xd8f2('0x70')](_0x20158c,_0x38539d['basename']);if(fs['existsSync'](_0x46d77d)){fs[_0xd8f2('0x7d')](_0x46d77d)[_0xd8f2('0x7e')](fs[_0xd8f2('0x7f')](path[_0xd8f2('0x70')](_0x57ad72,_0x38539d[_0xd8f2('0x80')])));}}}return new BPromise(function(_0x1348a5,_0x93657e){pdf[_0xd8f2('0x5b')](_0x35ca04,_0x8e3ccf)[_0xd8f2('0x81')](path[_0xd8f2('0x70')](_0x57ad72,'interaction-'+_0x2c6893+_0xd8f2('0x82')),function(_0x31a729,_0x13d998){if(_0x31a729)return _0x93657e(_0x31a729);_0x1348a5(_0x13d998);});});}})['then'](function(){if(_0x3e8a75){return new BPromise(function(_0x2dae61,_0x4ce58c){zipdir(_0x57ad72,{'saveTo':_0xdd1cd},function(_0x59195a,_0x1fe5a7){if(_0x59195a)return _0x4ce58c(_0x59195a);return _0x2dae61(_0x1fe5a7);});});}})[_0xd8f2('0x26')](function(){if(_0x3e8a75){return new BPromise(function(_0x5787c4,_0x44d923){rimraf(_0x57ad72,function(_0x1fe68f){if(_0x1fe68f)_0x44d923(_0x1fe68f);return _0x5787c4();});});}})[_0xd8f2('0x26')](function(){if(_0x3e8a75){return _0x248cbc[_0xd8f2('0x6d')](_0xdd1cd,_0x3a5fef,function(_0x156338){if(_0x156338){console[_0xd8f2('0x83')](_0xd8f2('0x84'),_0x156338);}else{fs[_0xd8f2('0x85')](_0xdd1cd);}});}else{return _0x248cbc[_0xd8f2('0x1c')](0xc8);}})[_0xd8f2('0x58')](handleError(_0x248cbc,null));}; \ No newline at end of file +var _0x8b2d=['name','index','OpenchannelInteraction','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','map','type','key','VIRTUAL','field','options','include','tag','Tag','distinct','OpenchannelMessage','Messages','direction','read','User','fullname','CmContact','internal','OpenchannelAccount','Account','createdAt','Tags','color','ThroughTags','rows','catch','show','includeAll','find','create','body','params','addMessage','ids','omit','getMessages','findOne','order','pick','OpenchannelInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','format','Contact','Attachment','Letter','

Openchannel\x20Interaction:\x20#%d

','

Date:\x20%s

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','
','%s:\x20%s

','firstName','','basename','createReadStream','pipe','interaction-','.pdf','log','err','unlinkSync','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack'];(function(_0x24eedc,_0x10011b){var _0x44730c=function(_0xa186bf){while(--_0xa186bf){_0x24eedc['push'](_0x24eedc['shift']());}};_0x44730c(++_0x10011b);}(_0x8b2d,0xe5));var _0xd8b2=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0x8b2d[_0x522ae8];return _0x3189b9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd8b2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8b2('0x1'));var rp=require(_0xd8b2('0x2'));var moment=require('moment');var BPromise=require(_0xd8b2('0x3'));var Mustache=require(_0xd8b2('0x4'));var util=require('util');var path=require(_0xd8b2('0x5'));var sox=require(_0xd8b2('0x6'));var csv=require(_0xd8b2('0x7'));var ejs=require(_0xd8b2('0x8'));var fs=require('fs');var _=require(_0xd8b2('0x9'));var squel=require(_0xd8b2('0xa'));var crypto=require(_0xd8b2('0xb'));var jsforce=require(_0xd8b2('0xc'));var deskjs=require(_0xd8b2('0xd'));var toCsv=require(_0xd8b2('0x7'));var querystring=require('querystring');var Papa=require(_0xd8b2('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0xd8b2('0xf'));var Redis=require(_0xd8b2('0x10'));var qs=require(_0xd8b2('0x11'));var logger=require(_0xd8b2('0x12'))(_0xd8b2('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd8b2('0x14')]=_[_0xd8b2('0x15')](config[_0xd8b2('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8b2('0x16'))(new Redis(config[_0xd8b2('0x14')]));require(_0xd8b2('0x17'))[_0xd8b2('0x18')](socket);function respondWithStatusCode(_0x4c7f60,_0x3ecff2){_0x3ecff2=_0x3ecff2||0xcc;return function(_0x4c4d97){if(_0x4c4d97){return _0x4c7f60['sendStatus'](_0x3ecff2);}return _0x4c7f60[_0xd8b2('0x19')](_0x3ecff2)[_0xd8b2('0x1a')]();};}function respondWithResult(_0x227f86,_0x2a0b6){_0x2a0b6=_0x2a0b6||0xc8;return function(_0x35cbed){if(_0x35cbed){return _0x227f86[_0xd8b2('0x19')](_0x2a0b6)[_0xd8b2('0x1b')](_0x35cbed);}};}function respondWithFilteredResult(_0x4bf135,_0x4c4493){return function(_0x573d24){if(_0x573d24){var _0x5b63a1=_0x573d24[_0xd8b2('0x1c')],_0x323c79=_0x4c4493[_0xd8b2('0x1d')],_0x44185b=_0x4c4493['offset']+_0x4c4493[_0xd8b2('0x1e')],_0x3ae3b7;if(_0x44185b>=_0x5b63a1){_0x44185b=_0x5b63a1;_0x3ae3b7=0xc8;}else{_0x3ae3b7=0xce;}_0x4bf135[_0xd8b2('0x19')](_0x3ae3b7);return _0x4bf135[_0xd8b2('0x1f')](_0xd8b2('0x20'),_0x323c79+'-'+_0x44185b+'/'+_0x5b63a1)['json'](_0x573d24);}return null;};}function patchUpdates(_0x449b11){return function(_0x4d355c){try{jsonpatch['apply'](_0x4d355c,_0x449b11,!![]);}catch(_0x23ff29){return BPromise['reject'](_0x23ff29);}return _0x4d355c['save']();};}function saveUpdates(_0x3880cb,_0x42ae8f){return function(_0x4b2992){if(_0x4b2992){return _0x4b2992[_0xd8b2('0x21')](_0x3880cb)[_0xd8b2('0x22')](function(_0x12e44b){return _0x12e44b;});}return null;};}function removeEntity(_0x563c96,_0x16d996){return function(_0x4a92d5){if(_0x4a92d5){return _0x4a92d5[_0xd8b2('0x23')]()[_0xd8b2('0x22')](function(){_0x563c96['status'](0xcc)[_0xd8b2('0x1a')]();});}};}function handleEntityNotFound(_0x1cee26,_0x520143){return function(_0x101e23){if(!_0x101e23){_0x1cee26[_0xd8b2('0x24')](0x194);}return _0x101e23;};}function handleError(_0x542f88,_0x4f6fd5){_0x4f6fd5=_0x4f6fd5||0x1f4;return function(_0x2f1f15){logger[_0xd8b2('0x25')](_0x2f1f15[_0xd8b2('0x26')]);if(_0x2f1f15[_0xd8b2('0x27')]){delete _0x2f1f15[_0xd8b2('0x27')];}_0x542f88['status'](_0x4f6fd5)['send'](_0x2f1f15);};}exports[_0xd8b2('0x28')]=function(_0x4d3141,_0x249565){var _0x22c3cf={},_0x39ef2f={},_0x2ef26c={'count':0x0,'rows':[]};var _0x51a745=db[_0xd8b2('0x29')][_0xd8b2('0x2a')];_0x39ef2f[_0xd8b2('0x2b')]=_[_0xd8b2('0x2c')](_0x51a745);_0x39ef2f[_0xd8b2('0x2d')]=_[_0xd8b2('0x2c')](_0x4d3141[_0xd8b2('0x2d')]);_0x39ef2f[_0xd8b2('0x2e')]=_[_0xd8b2('0x2f')](_0x39ef2f[_0xd8b2('0x2b')],_0x39ef2f[_0xd8b2('0x2d')]);_0x22c3cf['attributes']=_[_0xd8b2('0x2f')](_0x39ef2f['model'],qs[_0xd8b2('0x30')](_0x4d3141[_0xd8b2('0x2d')][_0xd8b2('0x30')]));_0x22c3cf[_0xd8b2('0x31')]=_0x22c3cf[_0xd8b2('0x31')][_0xd8b2('0x32')]?_0x22c3cf[_0xd8b2('0x31')]:_0x39ef2f[_0xd8b2('0x2b')];if(!_0x4d3141['query'][_0xd8b2('0x33')](_0xd8b2('0x34'))){_0x22c3cf[_0xd8b2('0x1e')]=qs[_0xd8b2('0x1e')](_0x4d3141[_0xd8b2('0x2d')][_0xd8b2('0x1e')]);_0x22c3cf[_0xd8b2('0x1d')]=qs[_0xd8b2('0x1d')](_0x4d3141[_0xd8b2('0x2d')][_0xd8b2('0x1d')]);}_0x22c3cf['order']=qs[_0xd8b2('0x35')](_0x4d3141[_0xd8b2('0x2d')]['sort']);_0x22c3cf['where']=qs[_0xd8b2('0x2e')](_['pick'](_0x4d3141[_0xd8b2('0x2d')],_0x39ef2f['filters']));if(_0x4d3141[_0xd8b2('0x2d')][_0xd8b2('0x36')]){_0x22c3cf[_0xd8b2('0x37')]=_[_0xd8b2('0x38')](_0x22c3cf[_0xd8b2('0x37')],{'$or':_[_0xd8b2('0x39')](_0x51a745,function(_0xc508fa){if(_0xc508fa[_0xd8b2('0x3a')][_0xd8b2('0x3b')]!==_0xd8b2('0x3c')){var _0x49b05a={};_0x49b05a[_0xc508fa[_0xd8b2('0x3d')]]={'$like':'%'+_0x4d3141[_0xd8b2('0x2d')][_0xd8b2('0x36')]+'%'};return _0x49b05a;}})});}_0x22c3cf=_[_0xd8b2('0x38')]({},_0x22c3cf,_0x4d3141[_0xd8b2('0x3e')]);var _0x141f11={'where':_0x22c3cf[_0xd8b2('0x37')]};_0x141f11[_0xd8b2('0x3f')]=[];if(_0x4d3141[_0xd8b2('0x2d')][_0xd8b2('0x40')]){_0x141f11[_0xd8b2('0x3f')]['push']({'model':db[_0xd8b2('0x41')],'as':'Tags','attributes':['id'],'where':{'id':_0x4d3141[_0xd8b2('0x2d')][_0xd8b2('0x40')]},'required':!![]});_0x141f11[_0xd8b2('0x42')]=!![];}if(_0x4d3141['query']['read']){_0x141f11['include']['push']({'model':db[_0xd8b2('0x43')],'as':_0xd8b2('0x44'),'attributes':['id',_0xd8b2('0x45'),'createdAt',_0xd8b2('0x46')],'where':{'direction':'in','read':_0x4d3141[_0xd8b2('0x2d')]['read']||![]},'required':!![]});_0x141f11[_0xd8b2('0x42')]=!![];}return db['OpenchannelInteraction']['count'](_0x141f11)[_0xd8b2('0x22')](function(_0x2d29df){_0x2ef26c[_0xd8b2('0x1c')]=_0x2d29df;if(_0x4d3141['query']['includeAll']){_0x22c3cf[_0xd8b2('0x3f')]=[{'model':db[_0xd8b2('0x47')],'as':'Users','required':![],'attributes':['id',_0xd8b2('0x27'),_0xd8b2('0x48')]},{'model':db[_0xd8b2('0x49')],'as':'Contact','required':![]},{'model':db[_0xd8b2('0x47')],'as':'Owner','attributes':[_0xd8b2('0x27'),_0xd8b2('0x48'),_0xd8b2('0x4a')],'required':![]},{'model':db[_0xd8b2('0x4b')],'as':_0xd8b2('0x4c'),'attributes':['name',_0xd8b2('0x3b')],'required':![]},{'model':db[_0xd8b2('0x43')],'as':_0xd8b2('0x44'),'attributes':['id',_0xd8b2('0x45'),_0xd8b2('0x4d'),_0xd8b2('0x46')],'where':{'direction':'in','read':_0x4d3141[_0xd8b2('0x2d')][_0xd8b2('0x46')]||![]},'required':_0x4d3141[_0xd8b2('0x2d')][_0xd8b2('0x46')]||![]},{'model':db['Tag'],'as':_0xd8b2('0x4e'),'attributes':['id','name',_0xd8b2('0x4f')],'required':_0x4d3141[_0xd8b2('0x2d')][_0xd8b2('0x40')]?!![]:![]},{'model':db[_0xd8b2('0x41')],'as':_0xd8b2('0x50'),'attributes':['id',_0xd8b2('0x27'),_0xd8b2('0x4f')],'through':_0x4d3141[_0xd8b2('0x2d')][_0xd8b2('0x40')]?{'attributes':[],'where':{'TagId':_0x4d3141[_0xd8b2('0x2d')]['tag']||undefined}}:{},'required':_0x4d3141['query'][_0xd8b2('0x40')]?!![]:![]}];}return db[_0xd8b2('0x29')]['findAll'](_0x22c3cf);})[_0xd8b2('0x22')](function(_0x2cb826){_0x2ef26c[_0xd8b2('0x51')]=_0x2cb826;return _0x2ef26c;})[_0xd8b2('0x22')](respondWithFilteredResult(_0x249565,_0x22c3cf))[_0xd8b2('0x52')](handleError(_0x249565,null));};exports[_0xd8b2('0x53')]=function(_0x306c52,_0x312249){var _0x3a1758={'raw':![],'where':{'id':_0x306c52['params']['id']}},_0x5cccf4={};_0x5cccf4[_0xd8b2('0x2b')]=_[_0xd8b2('0x2c')](db[_0xd8b2('0x29')][_0xd8b2('0x2a')]);_0x5cccf4['query']=_[_0xd8b2('0x2c')](_0x306c52[_0xd8b2('0x2d')]);_0x5cccf4[_0xd8b2('0x2e')]=_['intersection'](_0x5cccf4[_0xd8b2('0x2b')],_0x5cccf4[_0xd8b2('0x2d')]);_0x3a1758['attributes']=_[_0xd8b2('0x2f')](_0x5cccf4[_0xd8b2('0x2b')],qs[_0xd8b2('0x30')](_0x306c52[_0xd8b2('0x2d')]['fields']));_0x3a1758['attributes']=_0x3a1758[_0xd8b2('0x31')][_0xd8b2('0x32')]?_0x3a1758[_0xd8b2('0x31')]:_0x5cccf4[_0xd8b2('0x2b')];if(_0x306c52['query'][_0xd8b2('0x54')]){_0x3a1758['include']=[{'all':!![]}];}_0x3a1758=_[_0xd8b2('0x38')]({},_0x3a1758,_0x306c52[_0xd8b2('0x3e')]);return db['OpenchannelInteraction'][_0xd8b2('0x55')](_0x3a1758)[_0xd8b2('0x22')](handleEntityNotFound(_0x312249,null))[_0xd8b2('0x22')](respondWithResult(_0x312249,null))['catch'](handleError(_0x312249,null));};exports[_0xd8b2('0x56')]=function(_0x379d7f,_0x416110){return db[_0xd8b2('0x29')][_0xd8b2('0x56')](_0x379d7f['body'],{})[_0xd8b2('0x22')](respondWithResult(_0x416110,0xc9))[_0xd8b2('0x52')](handleError(_0x416110,null));};exports['update']=function(_0xd4d2ea,_0x11dc8d){if(_0xd4d2ea['body']['id']){delete _0xd4d2ea[_0xd8b2('0x57')]['id'];}return db[_0xd8b2('0x29')][_0xd8b2('0x55')]({'where':{'id':_0xd4d2ea[_0xd8b2('0x58')]['id']}})[_0xd8b2('0x22')](handleEntityNotFound(_0x11dc8d,null))[_0xd8b2('0x22')](saveUpdates(_0xd4d2ea[_0xd8b2('0x57')],null))['then'](respondWithResult(_0x11dc8d,null))[_0xd8b2('0x52')](handleError(_0x11dc8d,null));};exports[_0xd8b2('0x23')]=function(_0x439e45,_0x318c20){return db[_0xd8b2('0x29')][_0xd8b2('0x55')]({'where':{'id':_0x439e45[_0xd8b2('0x58')]['id']}})['then'](handleEntityNotFound(_0x318c20,null))[_0xd8b2('0x22')](removeEntity(_0x318c20,null))[_0xd8b2('0x52')](handleError(_0x318c20,null));};exports['describe']=function(_0x497ff9,_0x47ef81){return db[_0xd8b2('0x29')]['describe']()['then'](respondWithResult(_0x47ef81,null))[_0xd8b2('0x52')](handleError(_0x47ef81,null));};exports[_0xd8b2('0x59')]=function(_0x8d690b,_0x5f3802,_0x3f1755){return db['OpenchannelMessage'][_0xd8b2('0x55')]({'where':{'id':_0x8d690b['params']['id']}})['then'](handleEntityNotFound(_0x5f3802,null))[_0xd8b2('0x22')](function(_0x28d2d9){if(_0x28d2d9){return _0x28d2d9[_0xd8b2('0x59')](_0x8d690b['body'][_0xd8b2('0x5a')],_[_0xd8b2('0x5b')](_0x8d690b['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x5f3802,null))[_0xd8b2('0x52')](handleError(_0x5f3802,null));};exports[_0xd8b2('0x5c')]=function(_0x4d3120,_0x4c53e7,_0x1864d7){var _0x2f7ae3={'raw':![],'where':{}};var _0x29e833={};var _0x2844db={'count':0x0,'rows':[]};return db[_0xd8b2('0x29')][_0xd8b2('0x5d')]({'where':{'id':_0x4d3120[_0xd8b2('0x58')]['id']}})[_0xd8b2('0x22')](handleEntityNotFound(_0x4c53e7,null))['then'](function(_0x14a7d0){if(_0x14a7d0){_0x29e833[_0xd8b2('0x2b')]=_[_0xd8b2('0x2c')](db[_0xd8b2('0x43')][_0xd8b2('0x2a')]);_0x29e833[_0xd8b2('0x2d')]=_[_0xd8b2('0x2c')](_0x4d3120['query']);_0x29e833[_0xd8b2('0x2e')]=_['intersection'](_0x29e833['model'],_0x29e833[_0xd8b2('0x2d')]);_0x2f7ae3['attributes']=_[_0xd8b2('0x2f')](_0x29e833[_0xd8b2('0x2b')],qs[_0xd8b2('0x30')](_0x4d3120[_0xd8b2('0x2d')]['fields']));_0x2f7ae3[_0xd8b2('0x31')]=_0x2f7ae3[_0xd8b2('0x31')][_0xd8b2('0x32')]?_0x2f7ae3['attributes']:_0x29e833['model'];if(!_0x4d3120[_0xd8b2('0x2d')]['hasOwnProperty'](_0xd8b2('0x34'))){_0x2f7ae3['limit']=qs[_0xd8b2('0x1e')](_0x4d3120[_0xd8b2('0x2d')][_0xd8b2('0x1e')]);_0x2f7ae3[_0xd8b2('0x1d')]=qs['offset'](_0x4d3120[_0xd8b2('0x2d')][_0xd8b2('0x1d')]);}_0x2f7ae3[_0xd8b2('0x5e')]=qs[_0xd8b2('0x35')](_0x4d3120[_0xd8b2('0x2d')][_0xd8b2('0x35')]);_0x2f7ae3[_0xd8b2('0x37')]=qs[_0xd8b2('0x2e')](_[_0xd8b2('0x5f')](_0x4d3120[_0xd8b2('0x2d')],_0x29e833[_0xd8b2('0x2e')]));_0x2f7ae3['where'][_0xd8b2('0x60')]=_0x14a7d0['id'];if(_0x4d3120['query']['filter']){_0x2f7ae3[_0xd8b2('0x37')]=_[_0xd8b2('0x38')](_0x2f7ae3['where'],{'$or':_[_0xd8b2('0x39')](_0x2f7ae3[_0xd8b2('0x31')],function(_0x410d52){var _0x569d61={};_0x569d61[_0x410d52]={'$like':'%'+_0x4d3120[_0xd8b2('0x2d')][_0xd8b2('0x36')]+'%'};return _0x569d61;})});}if(_0x4d3120[_0xd8b2('0x2d')][_0xd8b2('0x61')]){var _0x1bbdc3=_0x4d3120[_0xd8b2('0x2d')][_0xd8b2('0x61')][_0xd8b2('0x62')](',');var _0x2382ab={};_0x2382ab[_0x1bbdc3[0x0]]={'$gte':moment(_0x1bbdc3[0x1])['format'](_0xd8b2('0x63'))};_0x2f7ae3[_0xd8b2('0x37')]=_[_0xd8b2('0x38')](_0x2f7ae3[_0xd8b2('0x37')],_0x2382ab);}_0x2f7ae3=_[_0xd8b2('0x38')]({},_0x2f7ae3,_0x4d3120[_0xd8b2('0x3e')]);return db['OpenchannelMessage'][_0xd8b2('0x1c')]({'where':_0x2f7ae3[_0xd8b2('0x37')]})[_0xd8b2('0x22')](function(_0x412131){_0x2844db[_0xd8b2('0x1c')]=_0x412131;if(_0x4d3120[_0xd8b2('0x2d')][_0xd8b2('0x54')]){_0x2f7ae3[_0xd8b2('0x3f')]=[{'all':!![]}];}return db[_0xd8b2('0x43')]['findAll'](_0x2f7ae3);})[_0xd8b2('0x22')](function(_0x3022f5){_0x2844db[_0xd8b2('0x51')]=_0x3022f5;return _0x2844db;});}})[_0xd8b2('0x22')](respondWithFilteredResult(_0x4c53e7,_0x2f7ae3))['catch'](handleError(_0x4c53e7,null));};exports[_0xd8b2('0x64')]=function(_0x321ea7,_0x969d08,_0x1f2aae){return db[_0xd8b2('0x29')][_0xd8b2('0x55')]({'where':{'id':_0x321ea7[_0xd8b2('0x58')]['id']}})[_0xd8b2('0x22')](handleEntityNotFound(_0x969d08,null))[_0xd8b2('0x22')](function(_0x577471){if(_0x577471){return _0x577471[_0xd8b2('0x65')](_0x321ea7[_0xd8b2('0x57')]['ids'],_['omit'](_0x321ea7['body'],[_0xd8b2('0x5a'),'id'])||{})[_0xd8b2('0x66')](function(){return db[_0xd8b2('0x41')][_0xd8b2('0x67')]({'attributes':['id',_0xd8b2('0x27'),_0xd8b2('0x4f')],'where':{'id':_0x321ea7[_0xd8b2('0x57')][_0xd8b2('0x5a')]}});})[_0xd8b2('0x22')](function(_0x16135f){socket[_0xd8b2('0x68')](_0xd8b2('0x69'),{'id':Number(_0x321ea7['params']['id']),'tags':_0x16135f||[]});return{'id':Number(_0x321ea7[_0xd8b2('0x58')]['id']),'tags':_0x16135f||[]};});}})[_0xd8b2('0x22')](respondWithResult(_0x969d08,null))[_0xd8b2('0x52')](handleError(_0x969d08,null));};exports[_0xd8b2('0x6a')]=function(_0x192781,_0x5d4960,_0x2bb62a){var _0x277034;return db['OpenchannelInteraction'][_0xd8b2('0x55')]({'where':{'id':_0x192781[_0xd8b2('0x58')]['id']}})['then'](handleEntityNotFound(_0x5d4960,null))[_0xd8b2('0x22')](function(_0x3fae45){if(_0x3fae45){return _0x3fae45[_0xd8b2('0x6a')](_0x192781[_0xd8b2('0x2d')][_0xd8b2('0x5a')]);}})['then'](respondWithStatusCode(_0x5d4960,null))[_0xd8b2('0x52')](handleError(_0x5d4960,null));};exports[_0xd8b2('0x6b')]=function(_0x220eb7,_0x53d7b4){var _0x2ed8f3=moment()[_0xd8b2('0x6c')]()[_0xd8b2('0x6d')]();var _0x1b06da=path[_0xd8b2('0x6e')](config[_0xd8b2('0x6f')],_0xd8b2('0x70'),_0xd8b2('0x71'),_0xd8b2('0x72'));var _0x23a9b4=path[_0xd8b2('0x6e')](config['root'],_0xd8b2('0x70'),_0xd8b2('0x71'),'attachments');var _0x11ce73=path[_0xd8b2('0x6e')](_0x1b06da,_0x2ed8f3);var _0x543bc5=util[_0xd8b2('0x73')]('interaction-%s.zip',_0x2ed8f3);var _0x5b7673=path[_0xd8b2('0x6e')](_0x1b06da,_0x543bc5);var _0x234634=![];return db[_0xd8b2('0x29')]['find']({'where':{'id':_0x220eb7['params']['id']},'include':[{'model':db[_0xd8b2('0x43')],'as':_0xd8b2('0x44'),'attributes':['id',_0xd8b2('0x57')],'include':[{'model':db['User'],'as':'User','attributes':['id',_0xd8b2('0x48')],'raw':!![]},{'model':db[_0xd8b2('0x49')],'as':_0xd8b2('0x74'),'attributes':['id','firstName'],'raw':!![]},{'model':db[_0xd8b2('0x75')],'as':_0xd8b2('0x75'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x53d7b4,null))[_0xd8b2('0x22')](function(_0x2aa007){if(_0x2aa007){_0x234634=!![];var _0x36af82='';var _0x40d054={'format':_0xd8b2('0x76'),'border':'1cm'};fs['mkdirSync'](_0x11ce73);_0x36af82+=util[_0xd8b2('0x73')](_0xd8b2('0x77'),_0x2aa007['id']);_0x36af82+=util[_0xd8b2('0x73')](_0xd8b2('0x78'),moment()[_0xd8b2('0x73')](_0xd8b2('0x79'))['toString']());_0x36af82+=_0xd8b2('0x7a');for(var _0x5394d2=0x0;_0x5394d2<_0x2aa007[_0xd8b2('0x44')]['length'];_0x5394d2++){var _0x22864f=_0x2aa007[_0xd8b2('0x44')][_0x5394d2];_0x36af82+='';_0x36af82+=util['format'](_0xd8b2('0x7b'),_0x22864f[_0xd8b2('0x47')]?_0x22864f[_0xd8b2('0x47')][_0xd8b2('0x48')]:_0x22864f[_0xd8b2('0x74')][_0xd8b2('0x7c')],_0x22864f[_0xd8b2('0x57')]);_0x36af82+=_0xd8b2('0x7d');if(_0x22864f['Attachment']){var _0x4f8de7=_0x22864f[_0xd8b2('0x75')];var _0x22d775=path['join'](_0x23a9b4,_0x4f8de7[_0xd8b2('0x7e')]);if(fs['existsSync'](_0x22d775)){fs[_0xd8b2('0x7f')](_0x22d775)[_0xd8b2('0x80')](fs['createWriteStream'](path[_0xd8b2('0x6e')](_0x11ce73,_0x4f8de7[_0xd8b2('0x7e')])));}}}return new BPromise(function(_0x1d3191,_0x447666){pdf['create'](_0x36af82,_0x40d054)['toFile'](path[_0xd8b2('0x6e')](_0x11ce73,_0xd8b2('0x81')+_0x2ed8f3+_0xd8b2('0x82')),function(_0x330ec0,_0x177226){if(_0x330ec0)return _0x447666(_0x330ec0);_0x1d3191(_0x177226);});});}})[_0xd8b2('0x22')](function(){if(_0x234634){return new BPromise(function(_0x180a3b,_0x10cb78){zipdir(_0x11ce73,{'saveTo':_0x5b7673},function(_0x1229a9,_0x864697){if(_0x1229a9)return _0x10cb78(_0x1229a9);return _0x180a3b(_0x864697);});});}})[_0xd8b2('0x22')](function(){if(_0x234634){return new BPromise(function(_0x2cbf01,_0x1e1800){rimraf(_0x11ce73,function(_0x27eb7e){if(_0x27eb7e)_0x1e1800(_0x27eb7e);return _0x2cbf01();});});}})[_0xd8b2('0x22')](function(){if(_0x234634){return _0x53d7b4[_0xd8b2('0x6b')](_0x5b7673,_0x543bc5,function(_0x44f6b2){if(_0x44f6b2){console[_0xd8b2('0x83')](_0xd8b2('0x84'),_0x44f6b2);}else{fs[_0xd8b2('0x85')](_0x5b7673);}});}else{return _0x53d7b4[_0xd8b2('0x24')](0xc8);}})[_0xd8b2('0x52')](handleError(_0x53d7b4,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c3c0e69..4b9cf36 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 _0xa884=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xd7f314,_0x176c1a){var _0x41c0ca=function(_0x37298f){while(--_0x37298f){_0xd7f314['push'](_0xd7f314['shift']());}};_0x41c0ca(++_0x176c1a);}(_0xa884,0xc6));var _0x4a88=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0xa884[_0x4d45c1];return _0x244478;};'use strict';var EventEmitter=require(_0x4a88('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4a88('0x1')](0x0);var events={'afterCreate':_0x4a88('0x2'),'afterUpdate':_0x4a88('0x3'),'afterDestroy':_0x4a88('0x4')};function emitEvent(_0x35a9c6){return function(_0x182e0f,_0x13141c,_0x16b8e8){OpenchannelInteractionEvents['emit'](_0x35a9c6+':'+_0x182e0f['id'],_0x182e0f);OpenchannelInteractionEvents[_0x4a88('0x5')](_0x35a9c6,_0x182e0f);_0x16b8e8(null);};}for(var e in events){if(events[_0x4a88('0x6')](e)){var event=events[e];OpenchannelInteraction[_0x4a88('0x7')](e,emitEvent(event));}}module[_0x4a88('0x8')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x29ef=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelInteraction','setMaxListeners'];(function(_0x36db31,_0x2ba011){var _0x6e019f=function(_0x3ec851){while(--_0x3ec851){_0x36db31['push'](_0x36db31['shift']());}};_0x6e019f(++_0x2ba011);}(_0x29ef,0x192));var _0xf29e=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x29ef[_0x3b5ad9];return _0x611ae9;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xf29e('0x0'))['db'][_0xf29e('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf29e('0x2')](0x0);var events={'afterCreate':_0xf29e('0x3'),'afterUpdate':_0xf29e('0x4'),'afterDestroy':_0xf29e('0x5')};function emitEvent(_0x2828e4){return function(_0x1bc235,_0x4aac61,_0x1e1f4a){OpenchannelInteractionEvents[_0xf29e('0x6')](_0x2828e4+':'+_0x1bc235['id'],_0x1bc235);OpenchannelInteractionEvents[_0xf29e('0x6')](_0x2828e4,_0x1bc235);_0x1e1f4a(null);};}for(var e in events){if(events[_0xf29e('0x7')](e)){var event=events[e];OpenchannelInteraction[_0xf29e('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 47f7456..88f5889 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 _0xdb05=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','define','OpenchannelInteraction','openchannel_interactions','changed'];(function(_0xe5c665,_0x471b1e){var _0x4e7421=function(_0x462456){while(--_0x462456){_0xe5c665['push'](_0xe5c665['shift']());}};_0x4e7421(++_0x471b1e);}(_0xdb05,0x88));var _0x5db0=function(_0x2a9622,_0x278ca9){_0x2a9622=_0x2a9622-0x0;var _0x3bdcad=_0xdb05[_0x2a9622];return _0x3bdcad;};'use strict';var _=require(_0x5db0('0x0'));var util=require('util');var logger=require(_0x5db0('0x1'))(_0x5db0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x310273,_0x28681b){return _0x310273[_0x5db0('0x3')](_0x5db0('0x4'),attributes,{'tableName':_0x5db0('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb34336,_0x294717,_0x262605){if(_0xb34336[_0x5db0('0x6')](_0x5db0('0x7'))){_0xb34336[_0x5db0('0x8')]=moment()[_0x5db0('0x9')](_0x5db0('0xa'));}_0x262605(null,_0xb34336);}}});}; \ No newline at end of file +var _0x5bef=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','request-promise','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','changed'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x5bef,0x117));var _0xf5be=function(_0x44ebe8,_0x8a366){_0x44ebe8=_0x44ebe8-0x0;var _0x4920f5=_0x5bef[_0x44ebe8];return _0x4920f5;};'use strict';var _=require(_0xf5be('0x0'));var util=require(_0xf5be('0x1'));var logger=require(_0xf5be('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf5be('0x3'));var attributes=require(_0xf5be('0x4'));module['exports']=function(_0x1f9da5,_0x5fef4d){return _0x1f9da5[_0xf5be('0x5')](_0xf5be('0x6'),attributes,{'tableName':_0xf5be('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5bafec,_0x378808,_0x1ac979){if(_0x5bafec[_0xf5be('0x8')]('closed')){_0x5bafec[_0xf5be('0x9')]=moment()[_0xf5be('0xa')](_0xf5be('0xb'));}_0x1ac979(null,_0x5bafec);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index b9e935c..2485414 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 _0x56a4=['limit','debug','catch','AddTagsToOpenchannelInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where'];(function(_0x2343c9,_0x3bd974){var _0x4fee71=function(_0x1cb968){while(--_0x1cb968){_0x2343c9['push'](_0x2343c9['shift']());}};_0x4fee71(++_0x3bd974);}(_0x56a4,0x11b));var _0x456a=function(_0x485038,_0x3e26e8){_0x485038=_0x485038-0x0;var _0xa87ace=_0x56a4[_0x485038];return _0xa87ace;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var moment=require('moment');var BPromise=require(_0x456a('0x2'));var rs=require(_0x456a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson['client'][_0x456a('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x456a('0xa')],{'host':_0x456a('0xb'),'port':0x18eb});var socket=require(_0x456a('0xc'))(new Redis(config['redis']));require(_0x456a('0xd'))['register'](socket);function respondWithRpcPromise(_0xb56df,_0x29073f,_0x3bb712){return new BPromise(function(_0x3b57ac,_0x2706a7){return client[_0x456a('0xe')](_0xb56df,_0x3bb712)[_0x456a('0xf')](function(_0xe60506){logger[_0x456a('0x10')](_0x456a('0x11'),_0x29073f,_0x456a('0x12'));logger['debug'](_0x456a('0x13'),_0x29073f,'request\x20sent',JSON['stringify'](_0xe60506));if(_0xe60506[_0x456a('0x14')]){if(_0xe60506[_0x456a('0x14')][_0x456a('0x15')]===0x1f4){logger[_0x456a('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x29073f,_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);return _0x2706a7(_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);}logger[_0x456a('0x14')](_0x456a('0x11'),_0x29073f,_0xe60506['error'][_0x456a('0x16')]);return _0x3b57ac(_0xe60506[_0x456a('0x14')][_0x456a('0x16')]);}else{logger[_0x456a('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x29073f,_0x456a('0x12'));_0x3b57ac(_0xe60506[_0x456a('0x17')][_0x456a('0x16')]);}})['catch'](function(_0x3d06b4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x29073f,_0x3d06b4);_0x2706a7(_0x3d06b4);});});}exports[_0x456a('0x18')]=function(_0x562cfa){var _0x44d79a=this;return new Promise(function(_0x4b48bf,_0x962b6d){return db[_0x456a('0x19')]['update'](_0x562cfa['body'],{'raw':_0x562cfa['options']?_0x562cfa[_0x456a('0x1a')][_0x456a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x562cfa[_0x456a('0x1a')]?_0x562cfa['options'][_0x456a('0x1c')]||null:null,'attributes':_0x562cfa['options']?_0x562cfa['options']['attributes']||null:null,'limit':_0x562cfa[_0x456a('0x1a')]?_0x562cfa[_0x456a('0x1a')][_0x456a('0x1d')]||null:null})['then'](function(_0x45ea0c){logger[_0x456a('0x10')]('UpdateOpenchannelInteraction',_0x562cfa);logger[_0x456a('0x1e')]('UpdateOpenchannelInteraction',_0x562cfa,JSON['stringify'](_0x45ea0c));_0x4b48bf(_0x45ea0c);})[_0x456a('0x1f')](function(_0x5441d1){logger[_0x456a('0x14')]('UpdateOpenchannelInteraction',_0x5441d1[_0x456a('0x16')],_0x562cfa);_0x962b6d(_0x44d79a[_0x456a('0x14')](0x1f4,_0x5441d1[_0x456a('0x16')]));});});};exports[_0x456a('0x20')]=function(_0xe280fc){return new Promise(function(_0x3036e4,_0x46f3b3){return db[_0x456a('0x19')]['find']({'where':_0xe280fc['options']?_0xe280fc['options'][_0x456a('0x1c')]||null:null})[_0x456a('0xf')](function(_0x564301){if(_0x564301){return _0x564301[_0x456a('0x21')](_0xe280fc[_0x456a('0x22')][_0x456a('0x23')],_[_0x456a('0x24')](_0xe280fc[_0x456a('0x22')],['ids','id'])||{});}})[_0x456a('0x25')](function(_0x3e8ee3){logger[_0x456a('0x10')]('AddTags',_0xe280fc);logger[_0x456a('0x1e')](_0x456a('0x26'),_0xe280fc,JSON['stringify'](_0x3e8ee3));_0x3036e4(_0x3e8ee3);})[_0x456a('0x1f')](function(_0x24efbc){logger[_0x456a('0x14')](_0x456a('0x26'),_0x24efbc[_0x456a('0x16')],_0xe280fc);_0x46f3b3(_this['error'](0x1f4,_0x24efbc[_0x456a('0x16')]));});});}; \ No newline at end of file +var _0x4975=['result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','info','catch','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','register','request','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message'];(function(_0x577c50,_0x28aabd){var _0x33f3f1=function(_0x2452bd){while(--_0x2452bd){_0x577c50['push'](_0x577c50['shift']());}};_0x33f3f1(++_0x28aabd);}(_0x4975,0x86));var _0x5497=function(_0x252b98,_0x25678a){_0x252b98=_0x252b98-0x0;var _0x15ff63=_0x4975[_0x252b98];return _0x15ff63;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});config['redis']=_[_0x5497('0xc')](config[_0x5497('0xd')],{'host':_0x5497('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5497('0xd')]));require('./openchannelInteraction.socket')[_0x5497('0xf')](socket);function respondWithRpcPromise(_0x29c93f,_0x2ec5a4,_0x32a8a2){return new BPromise(function(_0x131627,_0x425288){return client[_0x5497('0x10')](_0x29c93f,_0x32a8a2)[_0x5497('0x11')](function(_0x50d716){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x2ec5a4,_0x5497('0x12'));logger[_0x5497('0x13')](_0x5497('0x14'),_0x2ec5a4,_0x5497('0x12'),JSON[_0x5497('0x15')](_0x50d716));if(_0x50d716[_0x5497('0x16')]){if(_0x50d716[_0x5497('0x16')][_0x5497('0x17')]===0x1f4){logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0x50d716['error'][_0x5497('0x19')]);return _0x425288(_0x50d716['error'][_0x5497('0x19')]);}logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0x50d716[_0x5497('0x16')][_0x5497('0x19')]);return _0x131627(_0x50d716[_0x5497('0x16')][_0x5497('0x19')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x2ec5a4,_0x5497('0x12'));_0x131627(_0x50d716[_0x5497('0x1a')][_0x5497('0x19')]);}})['catch'](function(_0xbf1ba7){logger[_0x5497('0x16')](_0x5497('0x18'),_0x2ec5a4,_0xbf1ba7);_0x425288(_0xbf1ba7);});});}exports[_0x5497('0x1b')]=function(_0x1b1b43){var _0x1f6f18=this;return new Promise(function(_0x16d378,_0x10226f){return db[_0x5497('0x1c')][_0x5497('0x1d')](_0x1b1b43[_0x5497('0x1e')],{'raw':_0x1b1b43['options']?_0x1b1b43[_0x5497('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b1b43[_0x5497('0x1f')]?_0x1b1b43[_0x5497('0x1f')][_0x5497('0x20')]||null:null,'attributes':_0x1b1b43[_0x5497('0x1f')]?_0x1b1b43[_0x5497('0x1f')][_0x5497('0x21')]||null:null,'limit':_0x1b1b43['options']?_0x1b1b43['options'][_0x5497('0x22')]||null:null})[_0x5497('0x11')](function(_0x24482a){logger[_0x5497('0x23')]('UpdateOpenchannelInteraction',_0x1b1b43);logger[_0x5497('0x13')]('UpdateOpenchannelInteraction',_0x1b1b43,JSON[_0x5497('0x15')](_0x24482a));_0x16d378(_0x24482a);})[_0x5497('0x24')](function(_0x429d36){logger[_0x5497('0x16')](_0x5497('0x1b'),_0x429d36[_0x5497('0x19')],_0x1b1b43);_0x10226f(_0x1f6f18['error'](0x1f4,_0x429d36[_0x5497('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x583d06){return new Promise(function(_0x498f15,_0x39a2b7){return db['OpenchannelInteraction']['find']({'where':_0x583d06[_0x5497('0x1f')]?_0x583d06[_0x5497('0x1f')][_0x5497('0x20')]||null:null})['then'](function(_0x59380f){if(_0x59380f){return _0x59380f['addTags'](_0x583d06[_0x5497('0x1e')][_0x5497('0x25')],_[_0x5497('0x26')](_0x583d06['body'],['ids','id'])||{});}})['spread'](function(_0xa28dd8){logger['info'](_0x5497('0x27'),_0x583d06);logger[_0x5497('0x13')](_0x5497('0x27'),_0x583d06,JSON['stringify'](_0xa28dd8));_0x498f15(_0xa28dd8);})[_0x5497('0x24')](function(_0x32aba1){logger['error'](_0x5497('0x27'),_0x32aba1[_0x5497('0x19')],_0x583d06);_0x39a2b7(_this[_0x5497('0x16')](0x1f4,_0x32aba1['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index da0a646..b5b1b53 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 _0x4140=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x4140,0x1d9));var _0x0414=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0x4140[_0x319e2e];return _0x302524;};'use strict';var OpenchannelInteractionEvents=require(_0x0414('0x0'));var events=['save','remove','update'];function createListener(_0x52ca00,_0x45363c){return function(_0x500648){_0x45363c[_0x0414('0x1')](_0x52ca00,_0x500648);};}function removeListener(_0x5c3682,_0x1b973d){return function(){OpenchannelInteractionEvents[_0x0414('0x2')](_0x5c3682,_0x1b973d);};}exports[_0x0414('0x3')]=function(_0x3b99f1){for(var _0x271850=0x0,_0x559fdd=events[_0x0414('0x4')];_0x271850<_0x559fdd;_0x271850++){var _0x3656a4=events[_0x271850];var _0x338549=createListener(_0x0414('0x5')+_0x3656a4,_0x3b99f1);OpenchannelInteractionEvents['on'](_0x3656a4,_0x338549);}}; \ No newline at end of file +var _0xceef=['./openchannelInteraction.events','remove','update','emit','removeListener','register','openchannelInteraction:'];(function(_0x46cb35,_0x2b92ab){var _0x847507=function(_0x29b091){while(--_0x29b091){_0x46cb35['push'](_0x46cb35['shift']());}};_0x847507(++_0x2b92ab);}(_0xceef,0x134));var _0xfcee=function(_0x8b3778,_0x4453db){_0x8b3778=_0x8b3778-0x0;var _0x53bdc8=_0xceef[_0x8b3778];return _0x53bdc8;};'use strict';var OpenchannelInteractionEvents=require(_0xfcee('0x0'));var events=['save',_0xfcee('0x1'),_0xfcee('0x2')];function createListener(_0x427259,_0x258b2f){return function(_0x8b18ec){_0x258b2f[_0xfcee('0x3')](_0x427259,_0x8b18ec);};}function removeListener(_0x5cb513,_0x386140){return function(){OpenchannelInteractionEvents[_0xfcee('0x4')](_0x5cb513,_0x386140);};}exports[_0xfcee('0x5')]=function(_0x15d617){for(var _0x14f8ae=0x0,_0x3fa3e0=events['length'];_0x14f8ae<_0x3fa3e0;_0x14f8ae++){var _0x2aa361=events[_0x14f8ae];var _0x899673=createListener(_0xfcee('0x6')+_0x2aa361,_0x15d617);OpenchannelInteractionEvents['on'](_0x2aa361,_0x899673);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 1db03e9..0260a25 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 _0xea1a=['get','describe','show','post','tracked','openchannel','openchannelmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index'];(function(_0x376c3f,_0x1c7c51){var _0x5e50ab=function(_0x301625){while(--_0x301625){_0x376c3f['push'](_0x376c3f['shift']());}};_0x5e50ab(++_0x1c7c51);}(_0xea1a,0x98));var _0xaea1=function(_0x489fb6,_0x173dd3){_0x489fb6=_0x489fb6-0x0;var _0x1138b1=_0xea1a[_0x489fb6];return _0x1138b1;};'use strict';var multer=require(_0xaea1('0x0'));var util=require(_0xaea1('0x1'));var path=require(_0xaea1('0x2'));var timeout=require(_0xaea1('0x3'));var express=require('express');var router=express[_0xaea1('0x4')]();var auth=require(_0xaea1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaea1('0x6'));var controller=require(_0xaea1('0x7'));router['get']('/',auth[_0xaea1('0x8')](),controller[_0xaea1('0x9')]);router[_0xaea1('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xaea1('0xb')]);router[_0xaea1('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xaea1('0xc')]);router[_0xaea1('0xd')]('/',auth[_0xaea1('0x8')](),interaction[_0xaea1('0xe')](_0xaea1('0xf'),_0xaea1('0x10')),controller[_0xaea1('0x11')]);router[_0xaea1('0x12')](_0xaea1('0x13'),auth['isAuthenticated'](),controller[_0xaea1('0x14')]);router[_0xaea1('0x12')](_0xaea1('0x15'),auth['isAuthenticated'](),controller[_0xaea1('0x16')]);router[_0xaea1('0x12')](_0xaea1('0x17'),auth[_0xaea1('0x8')](),controller[_0xaea1('0x18')]);router[_0xaea1('0x19')](_0xaea1('0x13'),auth[_0xaea1('0x8')](),controller[_0xaea1('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xea7b=['post','tracked','openchannel','create','put','/:id/reject','reject','delete','exports','multer','util','path','express','Router','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x17a74e,_0x4fa575){var _0x1fbe39=function(_0x40eb0d){while(--_0x40eb0d){_0x17a74e['push'](_0x17a74e['shift']());}};_0x1fbe39(++_0x4fa575);}(_0xea7b,0x169));var _0xbea7=function(_0x1a3c7b,_0x1ea75b){_0x1a3c7b=_0x1a3c7b-0x0;var _0x547ba4=_0xea7b[_0x1a3c7b];return _0x547ba4;};'use strict';var multer=require(_0xbea7('0x0'));var util=require(_0xbea7('0x1'));var path=require(_0xbea7('0x2'));var timeout=require('connect-timeout');var express=require(_0xbea7('0x3'));var router=express[_0xbea7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbea7('0x5'));var config=require('../../config/environment');var controller=require(_0xbea7('0x6'));router[_0xbea7('0x7')]('/',auth[_0xbea7('0x8')](),controller[_0xbea7('0x9')]);router[_0xbea7('0x7')]('/describe',auth[_0xbea7('0x8')](),controller[_0xbea7('0xa')]);router[_0xbea7('0x7')](_0xbea7('0xb'),auth[_0xbea7('0x8')](),controller[_0xbea7('0xc')]);router[_0xbea7('0xd')]('/',auth[_0xbea7('0x8')](),interaction[_0xbea7('0xe')](_0xbea7('0xf'),'openchannelmessage:create'),controller[_0xbea7('0x10')]);router[_0xbea7('0x11')](_0xbea7('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xbea7('0x11')]('/:id/accept',auth[_0xbea7('0x8')](),controller['accept']);router['put'](_0xbea7('0x12'),auth[_0xbea7('0x8')](),controller[_0xbea7('0x13')]);router[_0xbea7('0x14')](_0xbea7('0xb'),auth[_0xbea7('0x8')](),controller['destroy']);module[_0xbea7('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index b8983ff..024b94f 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 _0xa9ff=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x281981,_0x302f26){var _0x3730ca=function(_0xef8c3a){while(--_0xef8c3a){_0x281981['push'](_0x281981['shift']());}};_0x3730ca(++_0x302f26);}(_0xa9ff,0xfb));var _0xfa9f=function(_0x515cff,_0x27d4a5){_0x515cff=_0x515cff-0x0;var _0x419c0e=_0xa9ff[_0x515cff];return _0x419c0e;};'use strict';var Sequelize=require(_0xfa9f('0x0'));module[_0xfa9f('0x1')]={'body':{'type':Sequelize[_0xfa9f('0x2')](_0xfa9f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfa9f('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfa9f('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xfa9f('0x6')]}}; \ No newline at end of file +var _0xb556=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x1dbd5c,_0x3b12c3){var _0x253e32=function(_0x9a4027){while(--_0x9a4027){_0x1dbd5c['push'](_0x1dbd5c['shift']());}};_0x253e32(++_0x3b12c3);}(_0xb556,0xcd));var _0x6b55=function(_0x12a7a1,_0x23ecdf){_0x12a7a1=_0x12a7a1-0x0;var _0x25ffb7=_0xb556[_0x12a7a1];return _0x25ffb7;};'use strict';var Sequelize=require(_0x6b55('0x0'));module['exports']={'body':{'type':Sequelize[_0x6b55('0x1')](_0x6b55('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6b55('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6b55('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6b55('0x4')]('in',_0x6b55('0x5')),'defaultValue':_0x6b55('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x6b55('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 29e7352..92b273b 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 _0x5031=['query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','type','key','options','includeAll','rows','params','length','include','find','create','body','update','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','agent','OpenchannelInteraction','stringify','RejectMessage','rejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','count','offset','set','Content-Range','reject','save','destroy','stack','name','index','OpenchannelMessage','rawAttributes','model','keys'];(function(_0x34df56,_0x52a58f){var _0x520f88=function(_0x2f0a82){while(--_0x2f0a82){_0x34df56['push'](_0x34df56['shift']());}};_0x520f88(++_0x52a58f);}(_0x5031,0xb3));var _0x1503=function(_0x5690a4,_0x572d64){_0x5690a4=_0x5690a4-0x0;var _0x170f91=_0x5031[_0x5690a4];return _0x170f91;};'use strict';var pdf=require(_0x1503('0x0'));var emlformat=require(_0x1503('0x1'));var rimraf=require(_0x1503('0x2'));var zipdir=require(_0x1503('0x3'));var jsonpatch=require(_0x1503('0x4'));var rp=require('request-promise');var moment=require(_0x1503('0x5'));var BPromise=require(_0x1503('0x6'));var Mustache=require(_0x1503('0x7'));var util=require(_0x1503('0x8'));var path=require(_0x1503('0x9'));var sox=require(_0x1503('0xa'));var csv=require(_0x1503('0xb'));var ejs=require(_0x1503('0xc'));var fs=require('fs');var _=require(_0x1503('0xd'));var squel=require(_0x1503('0xe'));var crypto=require(_0x1503('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1503('0x10'));var toCsv=require(_0x1503('0xb'));var querystring=require('querystring');var Papa=require(_0x1503('0x11'));var authService=require(_0x1503('0x12'));var hardwareService=require(_0x1503('0x13'));var Redis=require(_0x1503('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0x1503('0x15'))(_0x1503('0x16'));var utils=require(_0x1503('0x17'));var config=require(_0x1503('0x18'));var db=require(_0x1503('0x19'))['db'];config[_0x1503('0x1a')]=_[_0x1503('0x1b')](config[_0x1503('0x1a')],{'host':_0x1503('0x1c'),'port':0x18eb});var socket=require(_0x1503('0x1d'))(new Redis(config[_0x1503('0x1a')]));require(_0x1503('0x1e'))['register'](socket);var jayson=require(_0x1503('0x1f'));var client=jayson['client'][_0x1503('0x20')]({'port':0x232c});var client9002=jayson[_0x1503('0x21')][_0x1503('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x57c72e,_0x47c715,_0x112bf5,_0x441012){return new BPromise(function(_0x45bfb5,_0x57cf35){var _0x170572=_0x441012||client;return _0x170572[_0x1503('0x22')](_0x57c72e,_0x112bf5)[_0x1503('0x23')](function(_0x2147e6){logger[_0x1503('0x24')](_0x1503('0x25'),_0x47c715,_0x1503('0x26'));logger[_0x1503('0x27')](_0x1503('0x28'),_0x47c715,'request\x20sent',JSON['stringify'](_0x2147e6));if(_0x2147e6[_0x1503('0x29')]){if(_0x2147e6[_0x1503('0x29')][_0x1503('0x2a')]===0x1f4){logger['error'](_0x1503('0x25'),_0x47c715,_0x2147e6[_0x1503('0x29')][_0x1503('0x2b')]);return _0x57cf35(_0x2147e6['error']['message']);}logger[_0x1503('0x29')](_0x1503('0x25'),_0x47c715,_0x2147e6[_0x1503('0x29')][_0x1503('0x2b')]);return _0x45bfb5(_0x2147e6[_0x1503('0x29')][_0x1503('0x2b')]);}else{logger[_0x1503('0x24')](_0x1503('0x25'),_0x47c715,'request\x20sent');_0x45bfb5(_0x2147e6[_0x1503('0x2c')][_0x1503('0x2b')]);}})[_0x1503('0x2d')](function(_0x40121f){logger[_0x1503('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x47c715,_0x40121f);_0x57cf35(_0x40121f);});});}function respondWithStatusCode(_0x4225c3,_0x947ee7){_0x947ee7=_0x947ee7||0xcc;return function(_0x234bf1){if(_0x234bf1){return _0x4225c3['sendStatus'](_0x947ee7);}return _0x4225c3[_0x1503('0x2e')](_0x947ee7)[_0x1503('0x2f')]();};}function respondWithResult(_0x21627a,_0x5f7da4){_0x5f7da4=_0x5f7da4||0xc8;return function(_0x186034){if(_0x186034){return _0x21627a[_0x1503('0x2e')](_0x5f7da4)[_0x1503('0x30')](_0x186034);}};}function respondWithFilteredResult(_0x226237,_0x35fb83){return function(_0x51de78){if(_0x51de78){var _0x28773d=_0x51de78[_0x1503('0x31')],_0x4298ab=_0x35fb83[_0x1503('0x32')],_0x4a5c3f=_0x35fb83['offset']+_0x35fb83['limit'],_0x5ef683;if(_0x4a5c3f>=_0x28773d){_0x4a5c3f=_0x28773d;_0x5ef683=0xc8;}else{_0x5ef683=0xce;}_0x226237[_0x1503('0x2e')](_0x5ef683);return _0x226237[_0x1503('0x33')](_0x1503('0x34'),_0x4298ab+'-'+_0x4a5c3f+'/'+_0x28773d)[_0x1503('0x30')](_0x51de78);}return null;};}function patchUpdates(_0x2e6a41){return function(_0x2fcf42){try{jsonpatch['apply'](_0x2fcf42,_0x2e6a41,!![]);}catch(_0x484d2a){return BPromise[_0x1503('0x35')](_0x484d2a);}return _0x2fcf42[_0x1503('0x36')]();};}function saveUpdates(_0x1b1002,_0x15301c){return function(_0x317bfa){if(_0x317bfa){return _0x317bfa['update'](_0x1b1002)[_0x1503('0x23')](function(_0x3f907c){return _0x3f907c;});}return null;};}function removeEntity(_0x2b9581,_0x5d7522){return function(_0x4e288b){if(_0x4e288b){return _0x4e288b[_0x1503('0x37')]()['then'](function(){_0x2b9581[_0x1503('0x2e')](0xcc)[_0x1503('0x2f')]();});}};}function handleEntityNotFound(_0x31085d,_0x2eb670){return function(_0x5d9440){if(!_0x5d9440){_0x31085d['sendStatus'](0x194);}return _0x5d9440;};}function handleError(_0x3e3cba,_0x5a4d01){_0x5a4d01=_0x5a4d01||0x1f4;return function(_0x1d7697){logger[_0x1503('0x29')](_0x1d7697[_0x1503('0x38')]);if(_0x1d7697[_0x1503('0x39')]){delete _0x1d7697[_0x1503('0x39')];}_0x3e3cba[_0x1503('0x2e')](_0x5a4d01)['send'](_0x1d7697);};}exports[_0x1503('0x3a')]=function(_0x430c06,_0x25a117){var _0x38386e={},_0x4808e3={},_0xc5009d={'count':0x0,'rows':[]};var _0x3a7b89=db[_0x1503('0x3b')][_0x1503('0x3c')];_0x4808e3[_0x1503('0x3d')]=_[_0x1503('0x3e')](_0x3a7b89);_0x4808e3['query']=_['keys'](_0x430c06[_0x1503('0x3f')]);_0x4808e3[_0x1503('0x40')]=_[_0x1503('0x41')](_0x4808e3[_0x1503('0x3d')],_0x4808e3[_0x1503('0x3f')]);_0x38386e[_0x1503('0x42')]=_[_0x1503('0x41')](_0x4808e3[_0x1503('0x3d')],qs[_0x1503('0x43')](_0x430c06[_0x1503('0x3f')][_0x1503('0x43')]));_0x38386e[_0x1503('0x42')]=_0x38386e[_0x1503('0x42')]['length']?_0x38386e[_0x1503('0x42')]:_0x4808e3[_0x1503('0x3d')];if(!_0x430c06['query']['hasOwnProperty'](_0x1503('0x44'))){_0x38386e[_0x1503('0x45')]=qs['limit'](_0x430c06[_0x1503('0x3f')][_0x1503('0x45')]);_0x38386e['offset']=qs[_0x1503('0x32')](_0x430c06[_0x1503('0x3f')]['offset']);}_0x38386e[_0x1503('0x46')]=qs[_0x1503('0x47')](_0x430c06[_0x1503('0x3f')][_0x1503('0x47')]);_0x38386e[_0x1503('0x48')]=qs[_0x1503('0x40')](_[_0x1503('0x49')](_0x430c06[_0x1503('0x3f')],_0x4808e3[_0x1503('0x40')]));if(_0x430c06['query'][_0x1503('0x4a')]){_0x38386e[_0x1503('0x48')]=_[_0x1503('0x4b')](_0x38386e[_0x1503('0x48')],{'$or':_['map'](_0x3a7b89,function(_0x5078a2){if(_0x5078a2[_0x1503('0x4c')][_0x1503('0x4d')]!=='VIRTUAL'){var _0x4bdd50={};_0x4bdd50[_0x5078a2['field']]={'$like':'%'+_0x430c06[_0x1503('0x3f')]['filter']+'%'};return _0x4bdd50;}})});}_0x38386e=_[_0x1503('0x4b')]({},_0x38386e,_0x430c06[_0x1503('0x4e')]);var _0x137678={'where':_0x38386e[_0x1503('0x48')]};return db['OpenchannelMessage'][_0x1503('0x31')](_0x137678)[_0x1503('0x23')](function(_0xafc9bf){_0xc5009d[_0x1503('0x31')]=_0xafc9bf;if(_0x430c06[_0x1503('0x3f')][_0x1503('0x4f')]){_0x38386e['include']=[{'all':!![]}];}return db[_0x1503('0x3b')]['findAll'](_0x38386e);})[_0x1503('0x23')](function(_0x337fb8){_0xc5009d[_0x1503('0x50')]=_0x337fb8;return _0xc5009d;})[_0x1503('0x23')](respondWithFilteredResult(_0x25a117,_0x38386e))['catch'](handleError(_0x25a117,null));};exports['show']=function(_0x4c3346,_0x516944){var _0x200875={'raw':!![],'where':{'id':_0x4c3346[_0x1503('0x51')]['id']}},_0x2d786f={};_0x2d786f['model']=_['keys'](db[_0x1503('0x3b')][_0x1503('0x3c')]);_0x2d786f[_0x1503('0x3f')]=_[_0x1503('0x3e')](_0x4c3346['query']);_0x2d786f['filters']=_[_0x1503('0x41')](_0x2d786f[_0x1503('0x3d')],_0x2d786f['query']);_0x200875[_0x1503('0x42')]=_['intersection'](_0x2d786f['model'],qs[_0x1503('0x43')](_0x4c3346[_0x1503('0x3f')][_0x1503('0x43')]));_0x200875[_0x1503('0x42')]=_0x200875[_0x1503('0x42')][_0x1503('0x52')]?_0x200875[_0x1503('0x42')]:_0x2d786f[_0x1503('0x3d')];if(_0x4c3346[_0x1503('0x3f')][_0x1503('0x4f')]){_0x200875[_0x1503('0x53')]=[{'all':!![]}];}_0x200875=_[_0x1503('0x4b')]({},_0x200875,_0x4c3346[_0x1503('0x4e')]);return db[_0x1503('0x3b')][_0x1503('0x54')](_0x200875)[_0x1503('0x23')](handleEntityNotFound(_0x516944,null))[_0x1503('0x23')](respondWithResult(_0x516944,null))[_0x1503('0x2d')](handleError(_0x516944,null));};exports['create']=function(_0x573329,_0x3578f5){return db[_0x1503('0x3b')][_0x1503('0x55')](_0x573329[_0x1503('0x56')],{})[_0x1503('0x23')](respondWithResult(_0x3578f5,0xc9))['catch'](handleError(_0x3578f5,null));};exports[_0x1503('0x57')]=function(_0x3b3f47,_0x55243c){if(_0x3b3f47[_0x1503('0x56')]['id']){delete _0x3b3f47['body']['id'];}return db[_0x1503('0x3b')][_0x1503('0x54')]({'where':{'id':_0x3b3f47[_0x1503('0x51')]['id']}})[_0x1503('0x23')](handleEntityNotFound(_0x55243c,null))[_0x1503('0x23')](saveUpdates(_0x3b3f47[_0x1503('0x56')],null))['then'](respondWithResult(_0x55243c,null))[_0x1503('0x2d')](handleError(_0x55243c,null));};exports[_0x1503('0x37')]=function(_0x29d2cb,_0x405ed6){return db[_0x1503('0x3b')][_0x1503('0x54')]({'where':{'id':_0x29d2cb[_0x1503('0x51')]['id']}})[_0x1503('0x23')](handleEntityNotFound(_0x405ed6,null))[_0x1503('0x23')](removeEntity(_0x405ed6,null))[_0x1503('0x2d')](handleError(_0x405ed6,null));};exports['describe']=function(_0x174e81,_0x4fa6cc){return db[_0x1503('0x3b')][_0x1503('0x58')]()[_0x1503('0x23')](respondWithResult(_0x4fa6cc,null))[_0x1503('0x2d')](handleError(_0x4fa6cc,null));};var interaction_log=require(_0x1503('0x15'))(_0x1503('0x59'));exports[_0x1503('0x5a')]=function(_0x5511d0,_0x936b27,_0x43034d){var _0x2b16d3={'channel':_0x1503('0x5b')};if(_0x5511d0[_0x1503('0x56')]['id']){delete _0x5511d0[_0x1503('0x56')]['id'];}_0x5511d0[_0x1503('0x56')][_0x1503('0x5c')]=!![];_0x5511d0['body'][_0x1503('0x5d')]=moment()[_0x1503('0x5e')](_0x1503('0x5f'));_0x5511d0['body'][_0x1503('0x60')]=_0x5511d0['body'][_0x1503('0x60')]||_0x5511d0[_0x1503('0x61')]['id'];return db[_0x1503('0x3b')][_0x1503('0x54')]({'where':{'id':_0x5511d0[_0x1503('0x51')]['id'],'UserId':null},'include':[{'model':db[_0x1503('0x62')],'as':_0x1503('0x63')}]})[_0x1503('0x23')](handleEntityNotFound(_0x936b27,null))['then'](saveUpdates(_0x5511d0['body'],null))[_0x1503('0x23')](function(_0x3ecbd5){if(_0x3ecbd5){_0x2b16d3['message']=_0x3ecbd5[_0x1503('0x64')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x3ecbd5[_0x1503('0x65')]}});}return null;})[_0x1503('0x23')](handleEntityNotFound(_0x936b27,null))[_0x1503('0x23')](function(_0x3ee540){if(_0x3ee540){return _0x3ee540[_0x1503('0x57')]({'UserId':_0x5511d0['body'][_0x1503('0x60')],'read1stAt':_[_0x1503('0x66')](_0x3ee540['read1stAt'])?moment()['format'](_0x1503('0x5f')):undefined});}return null;})[_0x1503('0x23')](function(_0x51483a){if(_0x51483a){_0x2b16d3['interaction']=_0x51483a[_0x1503('0x64')]({'plain':!![]});interaction_log['info'](_0x1503('0x67'),_0x5511d0[_0x1503('0x61')]['id'],_0x5511d0[_0x1503('0x61')]['name'],_0x5511d0[_0x1503('0x61')][_0x1503('0x68')],_0x2b16d3[_0x1503('0x69')]['id'],_0x5511d0['body']?JSON['stringify'](_0x5511d0['body']):_0x1503('0x6a'));return respondWithRpcPromise(_0x1503('0x6b'),'acceptMessage',_0x2b16d3);}return null;})[_0x1503('0x23')](function(_0x2c7238){if(_0x2c7238){if(_0x5511d0[_0x1503('0x56')][_0x1503('0x6c')]){_0x2b16d3[_0x1503('0x2b')]['interface']=util[_0x1503('0x5e')](_0x1503('0x6d'),_0x5511d0[_0x1503('0x61')][_0x1503('0x39')]);_0x2b16d3[_0x1503('0x2b')][_0x1503('0x6e')]=_0x2b16d3[_0x1503('0x6e')];_0x2b16d3[_0x1503('0x2b')][_0x1503('0x6f')]=_0x1503('0x5a');return respondWithRpcPromise(_0x1503('0x70'),_0x1503('0x70'),{'event':_0x1503('0x71'),'message':_0x2b16d3[_0x1503('0x2b')]},client9002)['then'](function(){return _0x2b16d3;});}return _0x2b16d3;}return null;})['then'](respondWithResult(_0x936b27,null))[_0x1503('0x2d')](handleError(_0x936b27,null));};var interaction_log=require('../../config/logger')(_0x1503('0x59'));exports['reject']=function(_0x4f89f5,_0x3fe95f,_0x51a03d){var _0x48f138={'agent':{},'channel':_0x1503('0x5b')};if(_0x4f89f5[_0x1503('0x56')]['id']){delete _0x4f89f5[_0x1503('0x56')]['id'];}_0x4f89f5[_0x1503('0x56')][_0x1503('0x60')]=_0x4f89f5[_0x1503('0x56')][_0x1503('0x60')]||_0x4f89f5[_0x1503('0x61')]['id'];_0x48f138[_0x1503('0x72')]['id']=_0x4f89f5[_0x1503('0x56')][_0x1503('0x60')];return db[_0x1503('0x3b')][_0x1503('0x54')]({'where':{'id':_0x4f89f5['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3fe95f,null))[_0x1503('0x23')](function(_0xaf767){if(_0xaf767){_0x48f138['message']=_0xaf767[_0x1503('0x64')]({'plain':!![]});return db[_0x1503('0x73')][_0x1503('0x54')]({'where':{'id':_0xaf767[_0x1503('0x65')]}});}return null;})[_0x1503('0x23')](handleEntityNotFound(_0x3fe95f,null))['then'](function(_0x1d9b64){if(_0x1d9b64){_0x48f138['interaction']=_0x1d9b64[_0x1503('0x64')]({'plain':!![]});interaction_log[_0x1503('0x24')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4f89f5[_0x1503('0x61')]['id'],_0x4f89f5[_0x1503('0x61')][_0x1503('0x39')],_0x4f89f5[_0x1503('0x61')]['role'],_0x48f138[_0x1503('0x69')]['id'],_0x4f89f5['body']?JSON[_0x1503('0x74')](_0x4f89f5[_0x1503('0x56')]):_0x1503('0x6a'));return respondWithRpcPromise(_0x1503('0x75'),_0x1503('0x76'),_0x48f138);}return null;})[_0x1503('0x23')](function(_0x27c31e){if(_0x27c31e){_0x27c31e['message'][_0x1503('0x77')]=util[_0x1503('0x5e')]('SIP/%s',_0x4f89f5[_0x1503('0x61')][_0x1503('0x39')]);_0x27c31e['message'][_0x1503('0x6e')]=_0x48f138[_0x1503('0x6e')];_0x27c31e[_0x1503('0x2b')][_0x1503('0x6f')]='reject';respondWithRpcPromise(_0x1503('0x70'),_0x1503('0x70'),{'event':_0x1503('0x78'),'message':_0x27c31e[_0x1503('0x2b')]},client9002);return _0x48f138;}return null;})['then'](respondWithResult(_0x3fe95f,null))['catch'](handleError(_0x3fe95f,null));}; \ No newline at end of file +var _0x1fc9=['querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','OpenchannelMessage','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','key','VIRTUAL','field','merge','options','includeAll','include','findAll','show','rawAttributes','length','find','create','body','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','read1stAt','interaction','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0x1fc9,0x1c5));var _0x91fc=function(_0x1d40ff,_0x2aa09b){_0x1d40ff=_0x1d40ff-0x0;var _0x5b4e88=_0x1fc9[_0x1d40ff];return _0x5b4e88;};'use strict';var pdf=require(_0x91fc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91fc('0x1'));var zipdir=require(_0x91fc('0x2'));var jsonpatch=require(_0x91fc('0x3'));var rp=require('request-promise');var moment=require(_0x91fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91fc('0x5'));var util=require(_0x91fc('0x6'));var path=require(_0x91fc('0x7'));var sox=require(_0x91fc('0x8'));var csv=require(_0x91fc('0x9'));var ejs=require(_0x91fc('0xa'));var fs=require('fs');var _=require(_0x91fc('0xb'));var squel=require(_0x91fc('0xc'));var crypto=require('crypto');var jsforce=require(_0x91fc('0xd'));var deskjs=require(_0x91fc('0xe'));var toCsv=require(_0x91fc('0x9'));var querystring=require(_0x91fc('0xf'));var Papa=require(_0x91fc('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x91fc('0x11'))(_0x91fc('0x12'));var utils=require(_0x91fc('0x13'));var config=require(_0x91fc('0x14'));var db=require(_0x91fc('0x15'))['db'];config[_0x91fc('0x16')]=_['defaults'](config[_0x91fc('0x16')],{'host':_0x91fc('0x17'),'port':0x18eb});var socket=require(_0x91fc('0x18'))(new Redis(config[_0x91fc('0x16')]));require('./openchannelMessage.socket')[_0x91fc('0x19')](socket);var jayson=require(_0x91fc('0x1a'));var client=jayson[_0x91fc('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x91fc('0x1b')][_0x91fc('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x39c937,_0x5f18aa,_0x3548a7,_0x4911b9){return new BPromise(function(_0x3c0147,_0xce833d){var _0x14a4e8=_0x4911b9||client;return _0x14a4e8[_0x91fc('0x1d')](_0x39c937,_0x3548a7)[_0x91fc('0x1e')](function(_0x4000be){logger[_0x91fc('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x5f18aa,_0x91fc('0x20'));logger[_0x91fc('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5f18aa,_0x91fc('0x20'),JSON[_0x91fc('0x22')](_0x4000be));if(_0x4000be[_0x91fc('0x23')]){if(_0x4000be[_0x91fc('0x23')][_0x91fc('0x24')]===0x1f4){logger[_0x91fc('0x23')](_0x91fc('0x25'),_0x5f18aa,_0x4000be[_0x91fc('0x23')][_0x91fc('0x26')]);return _0xce833d(_0x4000be['error'][_0x91fc('0x26')]);}logger['error'](_0x91fc('0x25'),_0x5f18aa,_0x4000be['error'][_0x91fc('0x26')]);return _0x3c0147(_0x4000be['error'][_0x91fc('0x26')]);}else{logger[_0x91fc('0x1f')](_0x91fc('0x25'),_0x5f18aa,'request\x20sent');_0x3c0147(_0x4000be[_0x91fc('0x27')][_0x91fc('0x26')]);}})[_0x91fc('0x28')](function(_0x470405){logger[_0x91fc('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x5f18aa,_0x470405);_0xce833d(_0x470405);});});}function respondWithStatusCode(_0x47a40f,_0x4360aa){_0x4360aa=_0x4360aa||0xcc;return function(_0x19d0e8){if(_0x19d0e8){return _0x47a40f['sendStatus'](_0x4360aa);}return _0x47a40f[_0x91fc('0x29')](_0x4360aa)[_0x91fc('0x2a')]();};}function respondWithResult(_0x2df35c,_0x416af1){_0x416af1=_0x416af1||0xc8;return function(_0x496bd7){if(_0x496bd7){return _0x2df35c['status'](_0x416af1)[_0x91fc('0x2b')](_0x496bd7);}};}function respondWithFilteredResult(_0x37ffd6,_0x198811){return function(_0x17b045){if(_0x17b045){var _0x54a589=_0x17b045[_0x91fc('0x2c')],_0x5a44a7=_0x198811['offset'],_0x50675d=_0x198811[_0x91fc('0x2d')]+_0x198811[_0x91fc('0x2e')],_0x3aa0e0;if(_0x50675d>=_0x54a589){_0x50675d=_0x54a589;_0x3aa0e0=0xc8;}else{_0x3aa0e0=0xce;}_0x37ffd6['status'](_0x3aa0e0);return _0x37ffd6[_0x91fc('0x2f')](_0x91fc('0x30'),_0x5a44a7+'-'+_0x50675d+'/'+_0x54a589)[_0x91fc('0x2b')](_0x17b045);}return null;};}function patchUpdates(_0x80f29b){return function(_0x2f86bd){try{jsonpatch[_0x91fc('0x31')](_0x2f86bd,_0x80f29b,!![]);}catch(_0x3881a1){return BPromise[_0x91fc('0x32')](_0x3881a1);}return _0x2f86bd[_0x91fc('0x33')]();};}function saveUpdates(_0x383e8a,_0xcd3272){return function(_0xf2edb){if(_0xf2edb){return _0xf2edb[_0x91fc('0x34')](_0x383e8a)[_0x91fc('0x1e')](function(_0x14ec59){return _0x14ec59;});}return null;};}function removeEntity(_0x31ee32,_0x26f961){return function(_0x1e4442){if(_0x1e4442){return _0x1e4442[_0x91fc('0x35')]()[_0x91fc('0x1e')](function(){_0x31ee32[_0x91fc('0x29')](0xcc)[_0x91fc('0x2a')]();});}};}function handleEntityNotFound(_0x58dada,_0x562988){return function(_0x550ee4){if(!_0x550ee4){_0x58dada[_0x91fc('0x36')](0x194);}return _0x550ee4;};}function handleError(_0x23e91a,_0x440ca6){_0x440ca6=_0x440ca6||0x1f4;return function(_0x582665){logger[_0x91fc('0x23')](_0x582665[_0x91fc('0x37')]);if(_0x582665['name']){delete _0x582665[_0x91fc('0x38')];}_0x23e91a[_0x91fc('0x29')](_0x440ca6)['send'](_0x582665);};}exports[_0x91fc('0x39')]=function(_0x72fae4,_0x31f405){var _0xbcd31={},_0x204a5a={},_0x21f99e={'count':0x0,'rows':[]};var _0x561c04=db[_0x91fc('0x3a')]['rawAttributes'];_0x204a5a[_0x91fc('0x3b')]=_[_0x91fc('0x3c')](_0x561c04);_0x204a5a[_0x91fc('0x3d')]=_[_0x91fc('0x3c')](_0x72fae4['query']);_0x204a5a[_0x91fc('0x3e')]=_[_0x91fc('0x3f')](_0x204a5a['model'],_0x204a5a[_0x91fc('0x3d')]);_0xbcd31[_0x91fc('0x40')]=_['intersection'](_0x204a5a['model'],qs[_0x91fc('0x41')](_0x72fae4[_0x91fc('0x3d')][_0x91fc('0x41')]));_0xbcd31[_0x91fc('0x40')]=_0xbcd31[_0x91fc('0x40')]['length']?_0xbcd31[_0x91fc('0x40')]:_0x204a5a[_0x91fc('0x3b')];if(!_0x72fae4['query'][_0x91fc('0x42')](_0x91fc('0x43'))){_0xbcd31[_0x91fc('0x2e')]=qs[_0x91fc('0x2e')](_0x72fae4['query'][_0x91fc('0x2e')]);_0xbcd31[_0x91fc('0x2d')]=qs['offset'](_0x72fae4[_0x91fc('0x3d')][_0x91fc('0x2d')]);}_0xbcd31[_0x91fc('0x44')]=qs['sort'](_0x72fae4[_0x91fc('0x3d')][_0x91fc('0x45')]);_0xbcd31[_0x91fc('0x46')]=qs['filters'](_[_0x91fc('0x47')](_0x72fae4[_0x91fc('0x3d')],_0x204a5a[_0x91fc('0x3e')]));if(_0x72fae4[_0x91fc('0x3d')][_0x91fc('0x48')]){_0xbcd31[_0x91fc('0x46')]=_['merge'](_0xbcd31[_0x91fc('0x46')],{'$or':_[_0x91fc('0x49')](_0x561c04,function(_0x3b9fc9){if(_0x3b9fc9['type'][_0x91fc('0x4a')]!==_0x91fc('0x4b')){var _0x1a9961={};_0x1a9961[_0x3b9fc9[_0x91fc('0x4c')]]={'$like':'%'+_0x72fae4[_0x91fc('0x3d')][_0x91fc('0x48')]+'%'};return _0x1a9961;}})});}_0xbcd31=_[_0x91fc('0x4d')]({},_0xbcd31,_0x72fae4[_0x91fc('0x4e')]);var _0x3fb906={'where':_0xbcd31[_0x91fc('0x46')]};return db[_0x91fc('0x3a')][_0x91fc('0x2c')](_0x3fb906)[_0x91fc('0x1e')](function(_0xd81364){_0x21f99e[_0x91fc('0x2c')]=_0xd81364;if(_0x72fae4[_0x91fc('0x3d')][_0x91fc('0x4f')]){_0xbcd31[_0x91fc('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x91fc('0x51')](_0xbcd31);})['then'](function(_0x4c5885){_0x21f99e['rows']=_0x4c5885;return _0x21f99e;})[_0x91fc('0x1e')](respondWithFilteredResult(_0x31f405,_0xbcd31))['catch'](handleError(_0x31f405,null));};exports[_0x91fc('0x52')]=function(_0x8d21e9,_0x1de726){var _0x198437={'raw':!![],'where':{'id':_0x8d21e9['params']['id']}},_0x10d5d0={};_0x10d5d0[_0x91fc('0x3b')]=_[_0x91fc('0x3c')](db[_0x91fc('0x3a')][_0x91fc('0x53')]);_0x10d5d0[_0x91fc('0x3d')]=_[_0x91fc('0x3c')](_0x8d21e9[_0x91fc('0x3d')]);_0x10d5d0[_0x91fc('0x3e')]=_[_0x91fc('0x3f')](_0x10d5d0[_0x91fc('0x3b')],_0x10d5d0[_0x91fc('0x3d')]);_0x198437[_0x91fc('0x40')]=_[_0x91fc('0x3f')](_0x10d5d0[_0x91fc('0x3b')],qs[_0x91fc('0x41')](_0x8d21e9[_0x91fc('0x3d')]['fields']));_0x198437[_0x91fc('0x40')]=_0x198437[_0x91fc('0x40')][_0x91fc('0x54')]?_0x198437[_0x91fc('0x40')]:_0x10d5d0['model'];if(_0x8d21e9[_0x91fc('0x3d')][_0x91fc('0x4f')]){_0x198437[_0x91fc('0x50')]=[{'all':!![]}];}_0x198437=_[_0x91fc('0x4d')]({},_0x198437,_0x8d21e9[_0x91fc('0x4e')]);return db['OpenchannelMessage'][_0x91fc('0x55')](_0x198437)['then'](handleEntityNotFound(_0x1de726,null))['then'](respondWithResult(_0x1de726,null))[_0x91fc('0x28')](handleError(_0x1de726,null));};exports[_0x91fc('0x56')]=function(_0x38e0bd,_0x5adbda){return db[_0x91fc('0x3a')]['create'](_0x38e0bd[_0x91fc('0x57')],{})['then'](respondWithResult(_0x5adbda,0xc9))[_0x91fc('0x28')](handleError(_0x5adbda,null));};exports['update']=function(_0x2f0906,_0x53dca0){if(_0x2f0906[_0x91fc('0x57')]['id']){delete _0x2f0906['body']['id'];}return db[_0x91fc('0x3a')]['find']({'where':{'id':_0x2f0906[_0x91fc('0x58')]['id']}})[_0x91fc('0x1e')](handleEntityNotFound(_0x53dca0,null))[_0x91fc('0x1e')](saveUpdates(_0x2f0906[_0x91fc('0x57')],null))[_0x91fc('0x1e')](respondWithResult(_0x53dca0,null))['catch'](handleError(_0x53dca0,null));};exports[_0x91fc('0x35')]=function(_0x22dbc8,_0x1835c1){return db[_0x91fc('0x3a')][_0x91fc('0x55')]({'where':{'id':_0x22dbc8[_0x91fc('0x58')]['id']}})[_0x91fc('0x1e')](handleEntityNotFound(_0x1835c1,null))[_0x91fc('0x1e')](removeEntity(_0x1835c1,null))[_0x91fc('0x28')](handleError(_0x1835c1,null));};exports[_0x91fc('0x59')]=function(_0x38e979,_0x35161d){return db[_0x91fc('0x3a')][_0x91fc('0x59')]()['then'](respondWithResult(_0x35161d,null))[_0x91fc('0x28')](handleError(_0x35161d,null));};var interaction_log=require(_0x91fc('0x11'))(_0x91fc('0x5a'));exports[_0x91fc('0x5b')]=function(_0x4d07d8,_0x81a7,_0x58218c){var _0x18b735={'channel':_0x91fc('0x5c')};if(_0x4d07d8[_0x91fc('0x57')]['id']){delete _0x4d07d8['body']['id'];}_0x4d07d8[_0x91fc('0x57')][_0x91fc('0x5d')]=!![];_0x4d07d8['body'][_0x91fc('0x5e')]=moment()[_0x91fc('0x5f')](_0x91fc('0x60'));_0x4d07d8[_0x91fc('0x57')][_0x91fc('0x61')]=_0x4d07d8[_0x91fc('0x57')][_0x91fc('0x61')]||_0x4d07d8[_0x91fc('0x62')]['id'];return db['OpenchannelMessage'][_0x91fc('0x55')]({'where':{'id':_0x4d07d8[_0x91fc('0x58')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x91fc('0x63')}]})['then'](handleEntityNotFound(_0x81a7,null))[_0x91fc('0x1e')](saveUpdates(_0x4d07d8[_0x91fc('0x57')],null))[_0x91fc('0x1e')](function(_0xdd1653){if(_0xdd1653){_0x18b735[_0x91fc('0x26')]=_0xdd1653[_0x91fc('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0x91fc('0x55')]({'where':{'id':_0xdd1653['OpenchannelInteractionId']}});}return null;})[_0x91fc('0x1e')](handleEntityNotFound(_0x81a7,null))[_0x91fc('0x1e')](function(_0x159b7b){if(_0x159b7b){return _0x159b7b[_0x91fc('0x34')]({'UserId':_0x4d07d8[_0x91fc('0x57')][_0x91fc('0x61')],'read1stAt':_['isNil'](_0x159b7b[_0x91fc('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x91fc('0x1e')](function(_0x448061){if(_0x448061){_0x18b735[_0x91fc('0x66')]=_0x448061['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d07d8[_0x91fc('0x62')]['id'],_0x4d07d8[_0x91fc('0x62')][_0x91fc('0x38')],_0x4d07d8[_0x91fc('0x62')]['role'],_0x18b735[_0x91fc('0x66')]['id'],_0x4d07d8[_0x91fc('0x57')]?JSON[_0x91fc('0x22')](_0x4d07d8['body']):'null');return respondWithRpcPromise(_0x91fc('0x67'),'acceptMessage',_0x18b735);}return null;})[_0x91fc('0x1e')](function(_0x13aa5a){if(_0x13aa5a){if(_0x4d07d8[_0x91fc('0x57')][_0x91fc('0x68')]){_0x18b735['message'][_0x91fc('0x69')]=util[_0x91fc('0x5f')](_0x91fc('0x6a'),_0x4d07d8['user'][_0x91fc('0x38')]);_0x18b735[_0x91fc('0x26')][_0x91fc('0x6b')]=_0x18b735['channel'];_0x18b735[_0x91fc('0x26')][_0x91fc('0x6c')]=_0x91fc('0x5b');return respondWithRpcPromise('EventManager',_0x91fc('0x6d'),{'event':_0x91fc('0x6e'),'message':_0x18b735[_0x91fc('0x26')]},client9002)[_0x91fc('0x1e')](function(){return _0x18b735;});}return _0x18b735;}return null;})[_0x91fc('0x1e')](respondWithResult(_0x81a7,null))[_0x91fc('0x28')](handleError(_0x81a7,null));};var interaction_log=require(_0x91fc('0x11'))('openchannel-interactions');exports[_0x91fc('0x32')]=function(_0x4304b1,_0x2425d8,_0x3a19b2){var _0x349624={'agent':{},'channel':_0x91fc('0x5c')};if(_0x4304b1[_0x91fc('0x57')]['id']){delete _0x4304b1[_0x91fc('0x57')]['id'];}_0x4304b1[_0x91fc('0x57')][_0x91fc('0x61')]=_0x4304b1['body'][_0x91fc('0x61')]||_0x4304b1['user']['id'];_0x349624['agent']['id']=_0x4304b1[_0x91fc('0x57')][_0x91fc('0x61')];return db[_0x91fc('0x3a')][_0x91fc('0x55')]({'where':{'id':_0x4304b1[_0x91fc('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2425d8,null))[_0x91fc('0x1e')](function(_0x190353){if(_0x190353){_0x349624[_0x91fc('0x26')]=_0x190353[_0x91fc('0x64')]({'plain':!![]});return db[_0x91fc('0x6f')]['find']({'where':{'id':_0x190353[_0x91fc('0x70')]}});}return null;})[_0x91fc('0x1e')](handleEntityNotFound(_0x2425d8,null))[_0x91fc('0x1e')](function(_0x3e1029){if(_0x3e1029){_0x349624[_0x91fc('0x66')]=_0x3e1029[_0x91fc('0x64')]({'plain':!![]});interaction_log['info'](_0x91fc('0x71'),_0x4304b1[_0x91fc('0x62')]['id'],_0x4304b1[_0x91fc('0x62')][_0x91fc('0x38')],_0x4304b1[_0x91fc('0x62')][_0x91fc('0x72')],_0x349624[_0x91fc('0x66')]['id'],_0x4304b1[_0x91fc('0x57')]?JSON[_0x91fc('0x22')](_0x4304b1[_0x91fc('0x57')]):_0x91fc('0x73'));return respondWithRpcPromise(_0x91fc('0x74'),'rejectMessage',_0x349624);}return null;})[_0x91fc('0x1e')](function(_0x23ce9b){if(_0x23ce9b){_0x23ce9b[_0x91fc('0x26')][_0x91fc('0x69')]=util[_0x91fc('0x5f')](_0x91fc('0x6a'),_0x4304b1[_0x91fc('0x62')]['name']);_0x23ce9b['message']['channel']=_0x349624[_0x91fc('0x6b')];_0x23ce9b[_0x91fc('0x26')][_0x91fc('0x6c')]=_0x91fc('0x32');respondWithRpcPromise('EventManager',_0x91fc('0x6d'),{'event':'rejectmessage','message':_0x23ce9b[_0x91fc('0x26')]},client9002);return _0x349624;}return null;})['then'](respondWithResult(_0x2425d8,null))[_0x91fc('0x28')](handleError(_0x2425d8,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b5b9e23..86d8066 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 _0xe845=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x6dac9d,_0x4d3683){var _0x2e503e=function(_0x4b89a7){while(--_0x4b89a7){_0x6dac9d['push'](_0x6dac9d['shift']());}};_0x2e503e(++_0x4d3683);}(_0xe845,0x101));var _0x5e84=function(_0x2bf9b5,_0x5cdb41){_0x2bf9b5=_0x2bf9b5-0x0;var _0x56ad68=_0xe845[_0x2bf9b5];return _0x56ad68;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x5e84('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5e84('0x1')](0x0);var events={'afterCreate':_0x5e84('0x2'),'afterUpdate':_0x5e84('0x3'),'afterDestroy':_0x5e84('0x4')};function emitEvent(_0x2d33c0){return function(_0x5f05c0,_0x22a38f,_0x5e1928){OpenchannelMessageEvents[_0x5e84('0x5')](_0x2d33c0+':'+_0x5f05c0['id'],_0x5f05c0);OpenchannelMessageEvents[_0x5e84('0x5')](_0x2d33c0,_0x5f05c0);_0x5e1928(null);};}for(var e in events){if(events[_0x5e84('0x6')](e)){var event=events[e];OpenchannelMessage[_0x5e84('0x7')](e,emitEvent(event));}}module[_0x5e84('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xfad1=['hook','events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfad1,0x12a));var _0x1fad=function(_0x4b88e0,_0x3b3266){_0x4b88e0=_0x4b88e0-0x0;var _0x1103c0=_0xfad1[_0x4b88e0];return _0x1103c0;};'use strict';var EventEmitter=require(_0x1fad('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x1fad('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x1fad('0x2')](0x0);var events={'afterCreate':_0x1fad('0x3'),'afterUpdate':_0x1fad('0x4'),'afterDestroy':_0x1fad('0x5')};function emitEvent(_0x473159){return function(_0x5d5ba1,_0x1f2d54,_0x4d0d6b){OpenchannelMessageEvents['emit'](_0x473159+':'+_0x5d5ba1['id'],_0x5d5ba1);OpenchannelMessageEvents[_0x1fad('0x6')](_0x473159,_0x5d5ba1);_0x4d0d6b(null);};}for(var e in events){if(events[_0x1fad('0x7')](e)){var event=events[e];OpenchannelMessage[_0x1fad('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index cbd8fc7..5dca0b8 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 _0x948d=['UserId','OpenchannelInteraction','findOne','update','createdAt','catch','CmContact','then','OpenchannelAccount','OpenchannelAccountId','Interactions','OpenchannelInteractionId','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','Contact','POST','method','GET','body','afterCreate','threadId','Interaction','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','exports','define','OpenchannelMessage','openchannel_messages','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x29e58e,_0x175b64){var _0x26b9b4=function(_0x5f56fc){while(--_0x5f56fc){_0x29e58e['push'](_0x29e58e['shift']());}};_0x26b9b4(++_0x175b64);}(_0x948d,0x85));var _0xd948=function(_0x10cd57,_0x438427){_0x10cd57=_0x10cd57-0x0;var _0x1ba26a=_0x948d[_0x10cd57];return _0x1ba26a;};'use strict';var _=require(_0xd948('0x0'));var util=require('util');var logger=require(_0xd948('0x1'))(_0xd948('0x2'));var moment=require(_0xd948('0x3'));var BPromise=require(_0xd948('0x4'));var rp=require(_0xd948('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0xd948('0x6')]=function(_0x34fab3,_0x2437aa){return _0x34fab3[_0xd948('0x7')](_0xd948('0x8'),attributes,{'tableName':_0xd948('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5829fe,_0x2638db,_0x27dd65){var _0xc885cb=_0x34fab3[_0xd948('0xa')];var _0x1a2195=_0x5829fe[_0xd948('0xb')]({'plain':!![]});if(_0x1a2195[_0xd948('0xc')]['toLowerCase']()==='in'||_0x1a2195[_0xd948('0xc')][_0xd948('0xd')]()===_0xd948('0xe')&&!_0x1a2195[_0xd948('0xf')]&&!_[_0xd948('0x10')](_0x1a2195[_0xd948('0x11')])){_0xc885cb[_0xd948('0x12')][_0xd948('0x13')]({'where':{'id':_0x1a2195['OpenchannelInteractionId']}})['then'](function(_0x467592){if(_0x467592){_0x467592[_0xd948('0x14')]({'lastMsgAt':_0x1a2195[_0xd948('0x15')],'lastMsgDirection':_0x1a2195['direction'][_0xd948('0xd')](),'lastMsgBody':_0x1a2195['body']});}})[_0xd948('0x16')](function(_0x38b483){console['error'](_0x38b483);});}if(_0x1a2195[_0xd948('0xc')]==='out'&&!_0x1a2195[_0xd948('0xf')]){var _0x2d4c05;_0xc885cb[_0xd948('0x17')]['describe']()[_0xd948('0x18')](function(_0x5c7e1f){return _0xc885cb[_0xd948('0x19')]['find']({'where':{'id':_0x1a2195[_0xd948('0x1a')]},'include':[{'model':_0xc885cb[_0xd948('0x12')],'as':_0xd948('0x1b'),'where':{'id':_0x1a2195[_0xd948('0x1c')]},'limit':0x1,'include':[{'model':_0xc885cb[_0xd948('0x17')],'as':'Contact','attributes':_[_0xd948('0x1d')](_0x5c7e1f)}]}]});})[_0xd948('0x18')](function(_0x15ac09){_0x2d4c05=_0x15ac09['get']({'plain':!![]});if(_0x2d4c05&&_0x2d4c05[_0xd948('0x1e')]){logger[_0xd948('0x1f')](_0xd948('0x20'),'afterCreate',util[_0xd948('0x21')](_0xd948('0x22'),_0x1a2195['id'],_0x2d4c05['replyUri']));if(_0x2d4c05['Interactions']&&_0x2d4c05[_0xd948('0x1b')][_0xd948('0x23')]){_0x1a2195['Interaction']=_[_0xd948('0x24')](_0x2d4c05[_0xd948('0x1b')][0x0],_0xd948('0x25'));_0x1a2195[_0xd948('0x25')]=_0x2d4c05[_0xd948('0x1b')][0x0]['Contact'];}var _0x2638db={'method':_0xd948('0x26'),'uri':encodeURI(_0x2d4c05[_0xd948('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2638db[_0xd948('0x27')]){case _0xd948('0x28'):_0x2638db['qs']=_0x1a2195;break;case'POST':_0x2638db[_0xd948('0x29')]=_0x1a2195;break;}return rp(_0x2638db)[_0xd948('0x18')](function(_0x56c538){logger[_0xd948('0x1f')](_0xd948('0x20'),_0xd948('0x2a'),util[_0xd948('0x21')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1a2195['id'],_0x2d4c05[_0xd948('0x1e')]));if(_0x56c538[_0xd948('0x29')][_0xd948('0x2b')]&&_0x56c538[_0xd948('0x29')][_0xd948('0x2b')]!=_0x1a2195[_0xd948('0x2c')]['threadId']){return _0xc885cb[_0xd948('0x12')][_0xd948('0x14')]({'threadId':_0x56c538[_0xd948('0x29')]['threadId']},{'logging':!![],'where':{'id':_0x1a2195['Interaction']['id']}});}else{return;}})[_0xd948('0x18')](function(){return _0x5829fe[_0xd948('0x14')]({'read':!![]});})[_0xd948('0x16')](function(_0x510959){logger[_0xd948('0x2d')](_0xd948('0x20'),_0xd948('0x2a'),util[_0xd948('0x2e')](_0x510959,{'showHidden':![],'depth':null}));_0x27dd65();});}else{_0x27dd65();}})[_0xd948('0x2f')](function(){_0x27dd65();});}else{_0x27dd65();}}},'charset':_0xd948('0x30'),'collate':_0xd948('0x31')});}; \ No newline at end of file +var _0x7576=['request-promise','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','models','toLowerCase','direction','out','secret','UserId','OpenchannelInteraction','findOne','update','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','GET','body','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x30cbf0,_0x11a5cf){var _0x1d7003=function(_0x562d6f){while(--_0x562d6f){_0x30cbf0['push'](_0x30cbf0['shift']());}};_0x1d7003(++_0x11a5cf);}(_0x7576,0xc3));var _0x6757=function(_0x2c78ab,_0x6c0273){_0x2c78ab=_0x2c78ab-0x0;var _0x2bce93=_0x7576[_0x2c78ab];return _0x2bce93;};'use strict';var _=require(_0x6757('0x0'));var util=require('util');var logger=require(_0x6757('0x1'))(_0x6757('0x2'));var moment=require(_0x6757('0x3'));var BPromise=require(_0x6757('0x4'));var rp=require(_0x6757('0x5'));var attributes=require(_0x6757('0x6'));module[_0x6757('0x7')]=function(_0x4feb86,_0x5b1811){return _0x4feb86[_0x6757('0x8')](_0x6757('0x9'),attributes,{'tableName':_0x6757('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4527c7,_0x32176e,_0x50b081){var _0x8780f9=_0x4feb86[_0x6757('0xb')];var _0x28c3a5=_0x4527c7['get']({'plain':!![]});if(_0x28c3a5['direction'][_0x6757('0xc')]()==='in'||_0x28c3a5[_0x6757('0xd')]['toLowerCase']()===_0x6757('0xe')&&!_0x28c3a5[_0x6757('0xf')]&&!_['isNil'](_0x28c3a5[_0x6757('0x10')])){_0x8780f9[_0x6757('0x11')][_0x6757('0x12')]({'where':{'id':_0x28c3a5['OpenchannelInteractionId']}})['then'](function(_0x37ca08){if(_0x37ca08){_0x37ca08[_0x6757('0x13')]({'lastMsgAt':_0x28c3a5['createdAt'],'lastMsgDirection':_0x28c3a5[_0x6757('0xd')][_0x6757('0xc')](),'lastMsgBody':_0x28c3a5['body']});}})[_0x6757('0x14')](function(_0x1e47ea){console[_0x6757('0x15')](_0x1e47ea);});}if(_0x28c3a5['direction']===_0x6757('0xe')&&!_0x28c3a5[_0x6757('0xf')]){var _0x4b0779;_0x8780f9[_0x6757('0x16')][_0x6757('0x17')]()[_0x6757('0x18')](function(_0x57a4e0){return _0x8780f9[_0x6757('0x19')][_0x6757('0x1a')]({'where':{'id':_0x28c3a5[_0x6757('0x1b')]},'include':[{'model':_0x8780f9[_0x6757('0x11')],'as':_0x6757('0x1c'),'where':{'id':_0x28c3a5[_0x6757('0x1d')]},'limit':0x1,'include':[{'model':_0x8780f9[_0x6757('0x16')],'as':_0x6757('0x1e'),'attributes':_[_0x6757('0x1f')](_0x57a4e0)}]}]});})[_0x6757('0x18')](function(_0x531073){_0x4b0779=_0x531073['get']({'plain':!![]});if(_0x4b0779&&_0x4b0779['replyUri']){logger[_0x6757('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x6757('0x21'),util['format'](_0x6757('0x22'),_0x28c3a5['id'],_0x4b0779[_0x6757('0x23')]));if(_0x4b0779[_0x6757('0x1c')]&&_0x4b0779[_0x6757('0x1c')][_0x6757('0x24')]){_0x28c3a5[_0x6757('0x25')]=_[_0x6757('0x26')](_0x4b0779[_0x6757('0x1c')][0x0],_0x6757('0x1e'));_0x28c3a5[_0x6757('0x1e')]=_0x4b0779['Interactions'][0x0][_0x6757('0x1e')];}var _0x32176e={'method':_0x6757('0x27'),'uri':encodeURI(_0x4b0779['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x32176e[_0x6757('0x28')]){case _0x6757('0x29'):_0x32176e['qs']=_0x28c3a5;break;case'POST':_0x32176e[_0x6757('0x2a')]=_0x28c3a5;break;}return rp(_0x32176e)[_0x6757('0x18')](function(_0x4ecd7e){logger['info'](_0x6757('0x2b'),_0x6757('0x21'),util[_0x6757('0x2c')](_0x6757('0x2d'),_0x28c3a5['id'],_0x4b0779['replyUri']));if(_0x4ecd7e[_0x6757('0x2a')][_0x6757('0x2e')]&&_0x4ecd7e[_0x6757('0x2a')][_0x6757('0x2e')]!=_0x28c3a5[_0x6757('0x25')][_0x6757('0x2e')]){return _0x8780f9['OpenchannelInteraction']['update']({'threadId':_0x4ecd7e[_0x6757('0x2a')][_0x6757('0x2e')]},{'logging':!![],'where':{'id':_0x28c3a5[_0x6757('0x25')]['id']}});}else{return;}})['then'](function(){return _0x4527c7[_0x6757('0x13')]({'read':!![]});})['catch'](function(_0x2e20e7){logger[_0x6757('0x15')](_0x6757('0x2b'),'afterCreate',util[_0x6757('0x2f')](_0x2e20e7,{'showHidden':![],'depth':null}));_0x50b081();});}else{_0x50b081();}})[_0x6757('0x30')](function(){_0x50b081();});}else{_0x50b081();}}},'charset':'utf8mb4','collate':_0x6757('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f0c08b3..0199850 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 _0x029a=['request\x20sent','create','body','options','raw','CreateOpenchannelMessage','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','register','request','OpenchannelMessage,\x20%s,\x20%s','debug','stringify','error','message','info'];(function(_0x6c8b9b,_0xc36fb5){var _0x3c9b08=function(_0x27b754){while(--_0x27b754){_0x6c8b9b['push'](_0x6c8b9b['shift']());}};_0x3c9b08(++_0xc36fb5);}(_0x029a,0xb5));var _0xa029=function(_0x52a967,_0x1467d5){_0x52a967=_0x52a967-0x0;var _0x3dc843=_0x029a[_0x52a967];return _0x3dc843;};'use strict';var _=require('lodash');var util=require(_0xa029('0x0'));var moment=require(_0xa029('0x1'));var BPromise=require('bluebird');var rs=require(_0xa029('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa029('0x3'))['db'];var utils=require(_0xa029('0x4'));var logger=require('../../config/logger')(_0xa029('0x5'));var config=require('../../config/environment');var jayson=require(_0xa029('0x6'));var client=jayson['client'][_0xa029('0x7')]({'port':0x232a});config[_0xa029('0x8')]=_[_0xa029('0x9')](config[_0xa029('0x8')],{'host':_0xa029('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa029('0x8')]));require('./openchannelMessage.socket')[_0xa029('0xb')](socket);function respondWithRpcPromise(_0x1b389e,_0x2ec357,_0x49edf9){return new BPromise(function(_0x128c70,_0x2d95de){return client[_0xa029('0xc')](_0x1b389e,_0x49edf9)['then'](function(_0x2778c5){logger['info'](_0xa029('0xd'),_0x2ec357,'request\x20sent');logger[_0xa029('0xe')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2ec357,'request\x20sent',JSON[_0xa029('0xf')](_0x2778c5));if(_0x2778c5[_0xa029('0x10')]){if(_0x2778c5[_0xa029('0x10')]['code']===0x1f4){logger['error'](_0xa029('0xd'),_0x2ec357,_0x2778c5[_0xa029('0x10')][_0xa029('0x11')]);return _0x2d95de(_0x2778c5['error']['message']);}logger[_0xa029('0x10')](_0xa029('0xd'),_0x2ec357,_0x2778c5[_0xa029('0x10')][_0xa029('0x11')]);return _0x128c70(_0x2778c5['error'][_0xa029('0x11')]);}else{logger[_0xa029('0x12')](_0xa029('0xd'),_0x2ec357,_0xa029('0x13'));_0x128c70(_0x2778c5['result'][_0xa029('0x11')]);}})['catch'](function(_0x196c0a){logger[_0xa029('0x10')](_0xa029('0xd'),_0x2ec357,_0x196c0a);_0x2d95de(_0x196c0a);});});}exports['CreateOpenchannelMessage']=function(_0x134b91){var _0x2e23e1=this;return new Promise(function(_0x370212,_0xa082c){return db['OpenchannelMessage'][_0xa029('0x14')](_0x134b91[_0xa029('0x15')],{'raw':_0x134b91['options']?_0x134b91[_0xa029('0x16')][_0xa029('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x49eee6){logger['info'](_0xa029('0x18'),_0x134b91);logger[_0xa029('0xe')](_0xa029('0x18'),_0x134b91,JSON[_0xa029('0xf')](_0x49eee6));_0x370212(_0x49eee6);})['catch'](function(_0x2bc2c8){logger[_0xa029('0x10')]('CreateOpenchannelMessage',_0x2bc2c8[_0xa029('0x11')],_0x134b91);_0xa082c(_0x2e23e1[_0xa029('0x10')](0x1f4,_0x2bc2c8[_0xa029('0x11')]));});});}; \ No newline at end of file +var _0x6588=['OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','CreateOpenchannelMessage','create','options','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info'];(function(_0x59475c,_0x434ab7){var _0x44aaf0=function(_0x5aaef7){while(--_0x5aaef7){_0x59475c['push'](_0x59475c['shift']());}};_0x44aaf0(++_0x434ab7);}(_0x6588,0x110));var _0x8658=function(_0x39c084,_0xbc0456){_0x39c084=_0x39c084-0x0;var _0x5e6575=_0x6588[_0x39c084];return _0x5e6575;};'use strict';var _=require(_0x8658('0x0'));var util=require('util');var moment=require(_0x8658('0x1'));var BPromise=require('bluebird');var rs=require(_0x8658('0x2'));var fs=require('fs');var Redis=require(_0x8658('0x3'));var db=require(_0x8658('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8658('0x5'))('rpc');var config=require(_0x8658('0x6'));var jayson=require(_0x8658('0x7'));var client=jayson['client'][_0x8658('0x8')]({'port':0x232a});config['redis']=_[_0x8658('0x9')](config[_0x8658('0xa')],{'host':_0x8658('0xb'),'port':0x18eb});var socket=require(_0x8658('0xc'))(new Redis(config[_0x8658('0xa')]));require(_0x8658('0xd'))[_0x8658('0xe')](socket);function respondWithRpcPromise(_0xfc0410,_0x2fd2d6,_0x29a7dc){return new BPromise(function(_0x311639,_0x5a4cfd){return client[_0x8658('0xf')](_0xfc0410,_0x29a7dc)[_0x8658('0x10')](function(_0x1024ba){logger[_0x8658('0x11')](_0x8658('0x12'),_0x2fd2d6,_0x8658('0x13'));logger[_0x8658('0x14')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2fd2d6,'request\x20sent',JSON[_0x8658('0x15')](_0x1024ba));if(_0x1024ba['error']){if(_0x1024ba['error'][_0x8658('0x16')]===0x1f4){logger[_0x8658('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x2fd2d6,_0x1024ba[_0x8658('0x17')][_0x8658('0x18')]);return _0x5a4cfd(_0x1024ba['error'][_0x8658('0x18')]);}logger[_0x8658('0x17')](_0x8658('0x12'),_0x2fd2d6,_0x1024ba[_0x8658('0x17')][_0x8658('0x18')]);return _0x311639(_0x1024ba[_0x8658('0x17')]['message']);}else{logger[_0x8658('0x11')](_0x8658('0x12'),_0x2fd2d6,'request\x20sent');_0x311639(_0x1024ba['result'][_0x8658('0x18')]);}})['catch'](function(_0x975021){logger[_0x8658('0x17')](_0x8658('0x12'),_0x2fd2d6,_0x975021);_0x5a4cfd(_0x975021);});});}exports[_0x8658('0x19')]=function(_0x5cfaff){var _0x5c7025=this;return new Promise(function(_0x52aafb,_0x1cc64e){return db['OpenchannelMessage'][_0x8658('0x1a')](_0x5cfaff['body'],{'raw':_0x5cfaff[_0x8658('0x1b')]?_0x5cfaff[_0x8658('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8658('0x10')](function(_0x56f78e){logger[_0x8658('0x11')](_0x8658('0x19'),_0x5cfaff);logger[_0x8658('0x14')](_0x8658('0x19'),_0x5cfaff,JSON[_0x8658('0x15')](_0x56f78e));_0x52aafb(_0x56f78e);})[_0x8658('0x1c')](function(_0x54d834){logger['error'](_0x8658('0x19'),_0x54d834[_0x8658('0x18')],_0x5cfaff);_0x1cc64e(_0x5c7025[_0x8658('0x17')](0x1f4,_0x54d834['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 32fd488..f1e0e77 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 _0x8d0e=['save','remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x1f8fe3,_0x3ecd11){var _0x4d7e3a=function(_0x4e90c0){while(--_0x4e90c0){_0x1f8fe3['push'](_0x1f8fe3['shift']());}};_0x4d7e3a(++_0x3ecd11);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x496643,_0x389607){_0x496643=_0x496643-0x0;var _0x2753de=_0x8d0e[_0x496643];return _0x2753de;};'use strict';var OpenchannelMessageEvents=require(_0xe8d0('0x0'));var events=[_0xe8d0('0x1'),_0xe8d0('0x2'),_0xe8d0('0x3')];function createListener(_0x2eae0c,_0x3584ab){return function(_0x15521e){_0x3584ab[_0xe8d0('0x4')](_0x2eae0c,_0x15521e);};}function removeListener(_0x32cee9,_0x579cb9){return function(){OpenchannelMessageEvents[_0xe8d0('0x5')](_0x32cee9,_0x579cb9);};}exports['register']=function(_0x560dab){for(var _0x2e2985=0x0,_0x92483d=events[_0xe8d0('0x6')];_0x2e2985<_0x92483d;_0x2e2985++){var _0xcc03d0=events[_0x2e2985];var _0x2b6dce=createListener(_0xe8d0('0x7')+_0xcc03d0,_0x560dab);OpenchannelMessageEvents['on'](_0xcc03d0,_0x2b6dce);}}; \ No newline at end of file +var _0x5c12=['removeListener','openchannelMessage:','save','remove','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5c12,0x188));var _0x25c1=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x5c12[_0x5f309e];return _0x487b5e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x25c1('0x0'),_0x25c1('0x1'),'update'];function createListener(_0x44bc2e,_0x1991e5){return function(_0x4042fe){_0x1991e5[_0x25c1('0x2')](_0x44bc2e,_0x4042fe);};}function removeListener(_0x2c5df0,_0x21ec20){return function(){OpenchannelMessageEvents[_0x25c1('0x3')](_0x2c5df0,_0x21ec20);};}exports['register']=function(_0x204287){for(var _0x42ac16=0x0,_0x382922=events['length'];_0x42ac16<_0x382922;_0x42ac16++){var _0x5c69b1=events[_0x42ac16];var _0x24981c=createListener(_0x25c1('0x4')+_0x5c69b1,_0x204287);OpenchannelMessageEvents['on'](_0x5c69b1,_0x24981c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 87ce2e4..4d653ab 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 _0x69ef=['removeTeams','/:id/users','removeAgents','multer','path','express','Router','../../components/auth/service','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','put','update','delete','destroy'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x69ef,0x123));var _0xf69e=function(_0xbb76d2,_0x5c290b){_0xbb76d2=_0xbb76d2-0x0;var _0x4ce6cd=_0x69ef[_0xbb76d2];return _0x4ce6cd;};'use strict';var multer=require(_0xf69e('0x0'));var util=require('util');var path=require(_0xf69e('0x1'));var timeout=require('connect-timeout');var express=require(_0xf69e('0x2'));var router=express[_0xf69e('0x3')]();var auth=require(_0xf69e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf69e('0x5'));router[_0xf69e('0x6')]('/',auth[_0xf69e('0x7')](),controller['index']);router['get'](_0xf69e('0x8'),auth['isAuthenticated'](),controller[_0xf69e('0x9')]);router['get'](_0xf69e('0xa'),auth[_0xf69e('0x7')](),controller['show']);router[_0xf69e('0x6')](_0xf69e('0xb'),auth[_0xf69e('0x7')](),controller[_0xf69e('0xc')]);router[_0xf69e('0x6')](_0xf69e('0xd'),auth[_0xf69e('0x7')](),controller[_0xf69e('0xe')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xf69e('0xf')]);router[_0xf69e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf69e('0x10')](_0xf69e('0xd'),auth[_0xf69e('0x7')](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xf69e('0x11')](_0xf69e('0xa'),auth[_0xf69e('0x7')](),controller[_0xf69e('0x12')]);router[_0xf69e('0x13')](_0xf69e('0xa'),auth[_0xf69e('0x7')](),controller[_0xf69e('0x14')]);router[_0xf69e('0x13')](_0xf69e('0xd'),auth[_0xf69e('0x7')](),controller[_0xf69e('0x15')]);router[_0xf69e('0x13')](_0xf69e('0x16'),auth[_0xf69e('0x7')](),controller[_0xf69e('0x17')]);module['exports']=router; \ No newline at end of file +var _0x62cb=['exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','put','delete','destroy'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x62cb,0xc1));var _0xb62c=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x62cb[_0x2c7dc6];return _0x10002b;};'use strict';var multer=require('multer');var util=require(_0xb62c('0x0'));var path=require(_0xb62c('0x1'));var timeout=require(_0xb62c('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb62c('0x3'));var config=require(_0xb62c('0x4'));var controller=require(_0xb62c('0x5'));router[_0xb62c('0x6')]('/',auth[_0xb62c('0x7')](),controller[_0xb62c('0x8')]);router[_0xb62c('0x6')](_0xb62c('0x9'),auth[_0xb62c('0x7')](),controller[_0xb62c('0xa')]);router['get'](_0xb62c('0xb'),auth['isAuthenticated'](),controller[_0xb62c('0xc')]);router[_0xb62c('0x6')]('/:id/members',auth[_0xb62c('0x7')](),controller['getMembers']);router[_0xb62c('0x6')](_0xb62c('0xd'),auth[_0xb62c('0x7')](),controller[_0xb62c('0xe')]);router[_0xb62c('0x6')](_0xb62c('0xf'),auth[_0xb62c('0x7')](),controller['getAgents']);router['post']('/',auth[_0xb62c('0x7')](),controller[_0xb62c('0x10')]);router[_0xb62c('0x11')](_0xb62c('0xd'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x12')]);router[_0xb62c('0x11')](_0xb62c('0xf'),auth[_0xb62c('0x7')](),controller[_0xb62c('0x13')]);router[_0xb62c('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb62c('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb62c('0x16')]);router['delete'](_0xb62c('0xd'),auth[_0xb62c('0x7')](),controller['removeTeams']);router[_0xb62c('0x15')](_0xb62c('0xf'),auth[_0xb62c('0x7')](),controller['removeAgents']);module[_0xb62c('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 7663aa5..b605ba2 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 _0x2587=['ENUM','rrmemory','beepall','sequelize','exports','STRING','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2587,0x199));var _0x7258=function(_0x3995dd,_0x24f96f){_0x3995dd=_0x3995dd-0x0;var _0x410f8a=_0x2587[_0x3995dd];return _0x410f8a;};'use strict';var Sequelize=require(_0x7258('0x0'));module[_0x7258('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7258('0x2')]},'timeout':{'type':Sequelize[_0x7258('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7258('0x4')](_0x7258('0x5'),_0x7258('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x10ad=['beepall','exports','name','INTEGER','ENUM'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x10ad,0xec));var _0xd10a=function(_0x1adc98,_0x572f08){_0x1adc98=_0x1adc98-0x0;var _0x37a14d=_0x10ad[_0x1adc98];return _0x37a14d;};'use strict';var Sequelize=require('sequelize');module[_0xd10a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd10a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd10a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd10a('0x3')]('rrmemory',_0xd10a('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 7ff561f..c2815be 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 _0xb10b=['name','send','OpenchannelQueue','keys','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','type','key','field','filter','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','hasOwnProperty','OpenchannelQueueId','map','UserOpenchannelQueue','UserId','agent','updatedAt','createdAt','format','%s/%s','getTeams','Team','ids','User','Agents','union','addAgents','penalty','addTeams','removeTeams','removeAgents','spread','emit','userOpenchannelQueue:save','userOpenchannelQueue:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','count','offset','set','Content-Range','json','reject','update','then','destroy','get','error','stack'];(function(_0x46f0d3,_0x40b4f3){var _0xb6d3c3=function(_0x290015){while(--_0x290015){_0x46f0d3['push'](_0x46f0d3['shift']());}};_0xb6d3c3(++_0x40b4f3);}(_0xb10b,0x12a));var _0xbb10=function(_0x99d37,_0x4e7974){_0x99d37=_0x99d37-0x0;var _0x2db098=_0xb10b[_0x99d37];return _0x2db098;};'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 authService=require(_0xbb10('0x12'));var hardwareService=require(_0xbb10('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];config['redis']=_[_0xbb10('0x18')](config[_0xbb10('0x19')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config[_0xbb10('0x19')]));require(_0xbb10('0x1c'))['register'](socket);function respondWithStatusCode(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xcc;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x1d')](_0x42d7e4);}return _0x26e021[_0xbb10('0x1e')](_0x42d7e4)[_0xbb10('0x1f')]();};}function respondWithResult(_0x24a57b,_0x36b5e8){_0x36b5e8=_0x36b5e8||0xc8;return function(_0x3e26f4){if(_0x3e26f4){return _0x24a57b[_0xbb10('0x1e')](_0x36b5e8)['json'](_0x3e26f4);}};}function respondWithFilteredResult(_0x2eca0f,_0x1145f1){return function(_0x133ac2){if(_0x133ac2){var _0x42db98=_0x133ac2[_0xbb10('0x20')],_0x378da8=_0x1145f1[_0xbb10('0x21')],_0x1682a4=_0x1145f1[_0xbb10('0x21')]+_0x1145f1['limit'],_0x575cca;if(_0x1682a4>=_0x42db98){_0x1682a4=_0x42db98;_0x575cca=0xc8;}else{_0x575cca=0xce;}_0x2eca0f[_0xbb10('0x1e')](_0x575cca);return _0x2eca0f[_0xbb10('0x22')](_0xbb10('0x23'),_0x378da8+'-'+_0x1682a4+'/'+_0x42db98)[_0xbb10('0x24')](_0x133ac2);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x25')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x26')](_0x4c4b0d)[_0xbb10('0x27')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x28')]()[_0xbb10('0x27')](function(){var _0x3ba6cd=_0x436104[_0xbb10('0x29')]({'plain':!![]});var _0x537898='OpenchannelQueues';return db['UserProfileResource'][_0xbb10('0x28')]({'where':{'type':_0x537898,'resourceId':_0x3ba6cd['id']}})[_0xbb10('0x27')](function(){return _0x436104;});})[_0xbb10('0x27')](function(){_0x1824b7['status'](0xcc)[_0xbb10('0x1f')]();});}};}function handleEntityNotFound(_0x24d586,_0x6ed43b){return function(_0x1d5e95){if(!_0x1d5e95){_0x24d586[_0xbb10('0x1d')](0x194);}return _0x1d5e95;};}function handleError(_0x20d946,_0x2a0e8b){_0x2a0e8b=_0x2a0e8b||0x1f4;return function(_0x4aabb9){logger[_0xbb10('0x2a')](_0x4aabb9[_0xbb10('0x2b')]);if(_0x4aabb9[_0xbb10('0x2c')]){delete _0x4aabb9[_0xbb10('0x2c')];}_0x20d946[_0xbb10('0x1e')](_0x2a0e8b)[_0xbb10('0x2d')](_0x4aabb9);};}exports['index']=function(_0x221624,_0x4ee02e){var _0x448d5c={},_0x56f2da={},_0x16ad2a={'count':0x0,'rows':[]};var _0x1dcc9c=db[_0xbb10('0x2e')]['rawAttributes'];_0x56f2da['model']=_[_0xbb10('0x2f')](_0x1dcc9c);_0x56f2da[_0xbb10('0x30')]=_['keys'](_0x221624[_0xbb10('0x30')]);_0x56f2da[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x56f2da[_0xbb10('0x33')],_0x56f2da[_0xbb10('0x30')]);_0x448d5c[_0xbb10('0x34')]=_[_0xbb10('0x32')](_0x56f2da['model'],qs[_0xbb10('0x35')](_0x221624[_0xbb10('0x30')][_0xbb10('0x35')]));_0x448d5c[_0xbb10('0x34')]=_0x448d5c[_0xbb10('0x34')][_0xbb10('0x36')]?_0x448d5c[_0xbb10('0x34')]:_0x56f2da[_0xbb10('0x33')];if(!_0x221624[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x37'))){_0x448d5c[_0xbb10('0x38')]=qs[_0xbb10('0x38')](_0x221624[_0xbb10('0x30')]['limit']);_0x448d5c[_0xbb10('0x21')]=qs['offset'](_0x221624['query'][_0xbb10('0x21')]);}_0x448d5c[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_0x221624[_0xbb10('0x30')][_0xbb10('0x3a')]);_0x448d5c[_0xbb10('0x3b')]=qs['filters'](_[_0xbb10('0x3c')](_0x221624[_0xbb10('0x30')],_0x56f2da['filters']));if(_0x221624['query']['filter']){_0x448d5c[_0xbb10('0x3b')]=_[_0xbb10('0x3d')](_0x448d5c[_0xbb10('0x3b')],{'$or':_['map'](_0x1dcc9c,function(_0x3c0cd7){if(_0x3c0cd7[_0xbb10('0x3e')][_0xbb10('0x3f')]!=='VIRTUAL'){var _0x17b6c5={};_0x17b6c5[_0x3c0cd7[_0xbb10('0x40')]]={'$like':'%'+_0x221624[_0xbb10('0x30')][_0xbb10('0x41')]+'%'};return _0x17b6c5;}})});}_0x448d5c=_['merge']({},_0x448d5c,_0x221624[_0xbb10('0x42')]);var _0x110eb5={'where':_0x448d5c['where']};return db[_0xbb10('0x2e')][_0xbb10('0x20')](_0x110eb5)[_0xbb10('0x27')](function(_0x3a9934){_0x16ad2a[_0xbb10('0x20')]=_0x3a9934;if(_0x221624[_0xbb10('0x30')]['includeAll']){_0x448d5c[_0xbb10('0x43')]=[{'all':!![]}];}return db[_0xbb10('0x2e')][_0xbb10('0x44')](_0x448d5c);})[_0xbb10('0x27')](function(_0x4943d9){_0x16ad2a[_0xbb10('0x45')]=_0x4943d9;return _0x16ad2a;})[_0xbb10('0x27')](respondWithFilteredResult(_0x4ee02e,_0x448d5c))[_0xbb10('0x46')](handleError(_0x4ee02e,null));};exports[_0xbb10('0x47')]=function(_0x5e2cfa,_0x351484){var _0x202c60={'raw':!![],'where':{'id':_0x5e2cfa['params']['id']}},_0x54ac18={};_0x54ac18[_0xbb10('0x33')]=_['keys'](db[_0xbb10('0x2e')][_0xbb10('0x48')]);_0x54ac18['query']=_[_0xbb10('0x2f')](_0x5e2cfa[_0xbb10('0x30')]);_0x54ac18[_0xbb10('0x31')]=_['intersection'](_0x54ac18[_0xbb10('0x33')],_0x54ac18[_0xbb10('0x30')]);_0x202c60[_0xbb10('0x34')]=_[_0xbb10('0x32')](_0x54ac18[_0xbb10('0x33')],qs[_0xbb10('0x35')](_0x5e2cfa[_0xbb10('0x30')][_0xbb10('0x35')]));_0x202c60[_0xbb10('0x34')]=_0x202c60[_0xbb10('0x34')][_0xbb10('0x36')]?_0x202c60[_0xbb10('0x34')]:_0x54ac18['model'];if(_0x5e2cfa[_0xbb10('0x30')][_0xbb10('0x49')]){_0x202c60['include']=[{'all':!![]}];}_0x202c60=_[_0xbb10('0x3d')]({},_0x202c60,_0x5e2cfa[_0xbb10('0x42')]);return db[_0xbb10('0x2e')][_0xbb10('0x4a')](_0x202c60)[_0xbb10('0x27')](handleEntityNotFound(_0x351484,null))[_0xbb10('0x27')](respondWithResult(_0x351484,null))[_0xbb10('0x46')](handleError(_0x351484,null));};exports['create']=function(_0x4a9793,_0xcb3354){return db[_0xbb10('0x2e')][_0xbb10('0x4b')](_0x4a9793['body'],{})['then'](function(_0x3cd6f3){var _0x34cf4e=_0x4a9793[_0xbb10('0x4c')][_0xbb10('0x29')]({'plain':!![]});if(!_0x34cf4e)throw new Error(_0xbb10('0x4d'));if(_0x34cf4e[_0xbb10('0x4e')]===_0xbb10('0x4c')){var _0x460788=_0x3cd6f3[_0xbb10('0x29')]({'plain':!![]});var _0x3d7e7e='OpenchannelQueues';return db['UserProfileSection'][_0xbb10('0x4a')]({'where':{'name':_0x3d7e7e,'userProfileId':_0x34cf4e[_0xbb10('0x4f')]},'raw':!![]})[_0xbb10('0x27')](function(_0xb014b0){if(_0xb014b0&&_0xb014b0[_0xbb10('0x50')]===0x0){return db[_0xbb10('0x51')][_0xbb10('0x4b')]({'name':_0x460788[_0xbb10('0x2c')],'resourceId':_0x460788['id'],'type':_0xb014b0[_0xbb10('0x2c')],'sectionId':_0xb014b0['id']},{})[_0xbb10('0x27')](function(){return _0x3cd6f3;});}else{return _0x3cd6f3;}})[_0xbb10('0x46')](function(_0x20e18a){logger[_0xbb10('0x2a')](_0xbb10('0x52'),_0x20e18a);throw _0x20e18a;});}return _0x3cd6f3;})[_0xbb10('0x27')](respondWithResult(_0xcb3354,0xc9))['catch'](handleError(_0xcb3354,null));};exports[_0xbb10('0x26')]=function(_0x5bd44d,_0x33d60a){if(_0x5bd44d[_0xbb10('0x53')]['id']){delete _0x5bd44d[_0xbb10('0x53')]['id'];}return db[_0xbb10('0x2e')][_0xbb10('0x4a')]({'where':{'id':_0x5bd44d[_0xbb10('0x54')]['id']}})[_0xbb10('0x27')](handleEntityNotFound(_0x33d60a,null))[_0xbb10('0x27')](saveUpdates(_0x5bd44d[_0xbb10('0x53')],null))[_0xbb10('0x27')](respondWithResult(_0x33d60a,null))[_0xbb10('0x46')](handleError(_0x33d60a,null));};exports[_0xbb10('0x28')]=function(_0x1d49e1,_0x3d7e17){return db[_0xbb10('0x2e')]['find']({'where':{'id':_0x1d49e1[_0xbb10('0x54')]['id']}})[_0xbb10('0x27')](handleEntityNotFound(_0x3d7e17,null))[_0xbb10('0x27')](removeEntity(_0x3d7e17,null))[_0xbb10('0x46')](handleError(_0x3d7e17,null));};exports[_0xbb10('0x55')]=function(_0x379d8c,_0x4bedd0){return db[_0xbb10('0x2e')][_0xbb10('0x55')]()[_0xbb10('0x27')](respondWithResult(_0x4bedd0,null))[_0xbb10('0x46')](handleError(_0x4bedd0,null));};exports[_0xbb10('0x56')]=function(_0x22de7f,_0x175872,_0x12ec18){var _0x205e01={'raw':!![],'where':{}},_0x40c4fb={},_0x2eb05a;return db[_0xbb10('0x2e')][_0xbb10('0x57')]({'where':{'id':_0x22de7f['params']['id']}})['then'](handleEntityNotFound(_0x175872,null))[_0xbb10('0x27')](function(_0x3e6338){if(_0x3e6338){_0x2eb05a=_0x3e6338[_0xbb10('0x29')]({'plain':!![]});_0x40c4fb[_0xbb10('0x33')]=_['keys'](db['UserOpenchannelQueue'][_0xbb10('0x48')]);_0x40c4fb[_0xbb10('0x30')]=_[_0xbb10('0x2f')](_0x22de7f[_0xbb10('0x30')]);_0x40c4fb[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x40c4fb[_0xbb10('0x33')],_0x40c4fb['query']);_0x205e01[_0xbb10('0x34')]=_[_0xbb10('0x32')](_0x40c4fb['model'],qs['fields'](_0x22de7f['query'][_0xbb10('0x35')]));_0x205e01[_0xbb10('0x34')]=_0x205e01[_0xbb10('0x34')]['length']?_0x205e01['attributes']:_0x40c4fb['model'];if(!_0x22de7f[_0xbb10('0x30')][_0xbb10('0x58')](_0xbb10('0x37'))){_0x205e01['limit']=qs[_0xbb10('0x38')](_0x22de7f[_0xbb10('0x30')]['limit']);_0x205e01['offset']=qs[_0xbb10('0x21')](_0x22de7f[_0xbb10('0x30')][_0xbb10('0x21')]);}_0x205e01[_0xbb10('0x39')]=qs['sort'](_0x22de7f[_0xbb10('0x30')][_0xbb10('0x3a')]);_0x205e01[_0xbb10('0x3b')]=qs['filters'](_[_0xbb10('0x3c')](_0x22de7f[_0xbb10('0x30')],_0x40c4fb[_0xbb10('0x31')]));_0x205e01['where'][_0xbb10('0x59')]=_0x3e6338['id'];if(_0x22de7f[_0xbb10('0x30')][_0xbb10('0x41')]){_0x205e01[_0xbb10('0x3b')]=_['merge'](_0x205e01[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x5a')](_0x205e01[_0xbb10('0x34')],function(_0x2d0f4b){var _0x56b3a3={};_0x56b3a3[_0x2d0f4b]={'$like':'%'+_0x22de7f[_0xbb10('0x30')][_0xbb10('0x41')]+'%'};return _0x56b3a3;})});}_0x205e01=_[_0xbb10('0x3d')]({},_0x205e01,_0x22de7f[_0xbb10('0x42')]);return db[_0xbb10('0x5b')][_0xbb10('0x44')](_0x205e01);}})[_0xbb10('0x27')](function(_0x4a30c5){if(_0x4a30c5){return db['User']['findAndCountAll']({'where':{'id':_[_0xbb10('0x5a')](_0x4a30c5,_0xbb10('0x5c')),'role':_0xbb10('0x5d')},'attributes':['id','name','openchannelPause',_0xbb10('0x5e'),_0xbb10('0x5f')]});}})[_0xbb10('0x27')](function(_0x3a9677){if(_0x3a9677){return{'count':_0x3a9677[_0xbb10('0x20')],'rows':_[_0xbb10('0x5a')](_0x3a9677['rows'],function(_0x1a5ca5){return{'membername':_0x1a5ca5[_0xbb10('0x2c')],'UserId':_0x1a5ca5['id'],'queue_name':_0x2eb05a[_0xbb10('0x2c')],'OpenchannelQueueId':_0x2eb05a['id'],'interface':util[_0xbb10('0x60')](_0xbb10('0x61'),'SIP',_0x1a5ca5['name']),'penalty':0x0,'paused':_0x1a5ca5['openchannelPause'],'createdAt':_0x1a5ca5[_0xbb10('0x5f')],'updatedAt':_0x1a5ca5[_0xbb10('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbb10('0x27')](respondWithFilteredResult(_0x175872,_0x205e01))[_0xbb10('0x46')](handleError(_0x175872,null));};exports[_0xbb10('0x62')]=function(_0x1d40b8,_0x5d942d,_0x93f3c4){var _0x4bc316={};var _0x4fe3b5={};var _0x519a54;var _0xdf634f;return db[_0xbb10('0x2e')][_0xbb10('0x57')]({'where':{'id':_0x1d40b8[_0xbb10('0x54')]['id']}})['then'](handleEntityNotFound(_0x5d942d,null))[_0xbb10('0x27')](function(_0x5c583b){if(_0x5c583b){_0x519a54=_0x5c583b;_0x4fe3b5['model']=_[_0xbb10('0x2f')](db[_0xbb10('0x63')][_0xbb10('0x48')]);_0x4fe3b5[_0xbb10('0x30')]=_[_0xbb10('0x2f')](_0x1d40b8['query']);_0x4fe3b5[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x4fe3b5[_0xbb10('0x33')],_0x4fe3b5[_0xbb10('0x30')]);_0x4bc316[_0xbb10('0x34')]=_[_0xbb10('0x32')](_0x4fe3b5[_0xbb10('0x33')],qs['fields'](_0x1d40b8[_0xbb10('0x30')][_0xbb10('0x35')]));_0x4bc316[_0xbb10('0x34')]=_0x4bc316[_0xbb10('0x34')][_0xbb10('0x36')]?_0x4bc316[_0xbb10('0x34')]:_0x4fe3b5[_0xbb10('0x33')];_0x4bc316[_0xbb10('0x39')]=qs['sort'](_0x1d40b8[_0xbb10('0x30')][_0xbb10('0x3a')]);_0x4bc316[_0xbb10('0x3b')]=qs['filters'](_['pick'](_0x1d40b8['query'],_0x4fe3b5[_0xbb10('0x31')]));if(_0x1d40b8['query']['filter']){_0x4bc316[_0xbb10('0x3b')]=_[_0xbb10('0x3d')](_0x4bc316[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x5a')](_0x4bc316[_0xbb10('0x34')],function(_0x24dca6){var _0x33116={};_0x33116[_0x24dca6]={'$like':'%'+_0x1d40b8[_0xbb10('0x30')][_0xbb10('0x41')]+'%'};return _0x33116;})});}_0x4bc316=_['merge']({},_0x4bc316,_0x1d40b8[_0xbb10('0x42')]);return _0x519a54[_0xbb10('0x62')](_0x4bc316);}})[_0xbb10('0x27')](function(_0x35b811){if(_0x35b811){_0xdf634f=_0x35b811['length'];if(!_0x1d40b8['query'][_0xbb10('0x58')](_0xbb10('0x37'))){_0x4bc316[_0xbb10('0x38')]=qs[_0xbb10('0x38')](_0x1d40b8['query'][_0xbb10('0x38')]);_0x4bc316[_0xbb10('0x21')]=qs[_0xbb10('0x21')](_0x1d40b8[_0xbb10('0x30')][_0xbb10('0x21')]);}return _0x519a54['getTeams'](_0x4bc316);}})['then'](function(_0x372636){if(_0x372636){return _0x372636?{'count':_0xdf634f,'rows':_0x372636}:null;}})[_0xbb10('0x27')](respondWithResult(_0x5d942d,null))[_0xbb10('0x46')](handleError(_0x5d942d,null));};exports['addTeams']=function(_0x256b35,_0x13e2ab,_0x50bcc9){var _0x5caa06=[];var _0x2f667f;return db[_0xbb10('0x63')][_0xbb10('0x44')]({'where':{'id':_0x256b35['body'][_0xbb10('0x64')]},'attributes':['id'],'include':[{'model':db[_0xbb10('0x65')],'as':_0xbb10('0x66'),'attributes':['id'],'raw':!![]}]})[_0xbb10('0x27')](function(_0x2ef96f){if(_0x2ef96f){for(var _0x5de006=0x0;_0x5de006<_0x2ef96f[_0xbb10('0x36')];_0x5de006+=0x1){for(var _0x226363=0x0;_0x226363<_0x2ef96f[_0x5de006][_0xbb10('0x66')]['length'];_0x226363+=0x1){_0x5caa06=_[_0xbb10('0x67')](_0x5caa06,[_0x2ef96f[_0x5de006][_0xbb10('0x66')][_0x226363]['id']]);}}return _0x5caa06;}})[_0xbb10('0x27')](function(_0xdb7d3e){if(_0xdb7d3e){return db[_0xbb10('0x2e')][_0xbb10('0x4a')]({'where':{'id':_0x256b35[_0xbb10('0x54')]['id']}});}})[_0xbb10('0x27')](function(_0x17ed20){if(_0x17ed20){_0x2f667f=_0x17ed20;return _0x2f667f[_0xbb10('0x68')](_0x5caa06,{'penalty':_0x256b35[_0xbb10('0x53')][_0xbb10('0x69')]});}})['then'](function(_0x51f106){if(_0x51f106){return _0x2f667f[_0xbb10('0x6a')](_0x256b35[_0xbb10('0x53')][_0xbb10('0x64')]);}})[_0xbb10('0x27')](handleEntityNotFound(_0x13e2ab,null))[_0xbb10('0x27')](respondWithStatusCode(_0x13e2ab,null))['catch'](handleError(_0x13e2ab,null));};exports[_0xbb10('0x6b')]=function(_0x332fbe,_0x3b4d0b,_0x1a51d3){var _0x19694d=[];var _0x379d49;return db['Team'][_0xbb10('0x44')]({'where':{'id':_0x332fbe[_0xbb10('0x30')]['ids']},'attributes':['id'],'include':[{'model':db[_0xbb10('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbb10('0x27')](function(_0x28bd76){if(_0x28bd76){for(var _0x2b473c=0x0;_0x2b473c<_0x28bd76[_0xbb10('0x36')];_0x2b473c+=0x1){for(var _0x3a4a6e=0x0;_0x3a4a6e<_0x28bd76[_0x2b473c]['Agents'][_0xbb10('0x36')];_0x3a4a6e+=0x1){_0x19694d=_['union'](_0x19694d,[_0x28bd76[_0x2b473c][_0xbb10('0x66')][_0x3a4a6e]['id']]);}}return _0x19694d;}})[_0xbb10('0x27')](function(_0x5d767f){if(_0x5d767f){return db['OpenchannelQueue'][_0xbb10('0x4a')]({'where':{'id':_0x332fbe[_0xbb10('0x54')]['id']}});}})[_0xbb10('0x27')](function(_0x283bab){if(_0x283bab){_0x379d49=_0x283bab;return _0x379d49[_0xbb10('0x6c')](_0x19694d);}})[_0xbb10('0x27')](function(_0x1b6ebc){if(_0x379d49){return _0x379d49[_0xbb10('0x6b')](_0x332fbe[_0xbb10('0x30')][_0xbb10('0x64')]);}})[_0xbb10('0x27')](handleEntityNotFound(_0x3b4d0b,null))['then'](respondWithStatusCode(_0x3b4d0b,null))[_0xbb10('0x46')](handleError(_0x3b4d0b,null));};exports[_0xbb10('0x68')]=function(_0x1b0a6c,_0xcd5d35,_0xfe02f5){return db[_0xbb10('0x2e')][_0xbb10('0x4a')]({'where':{'id':_0x1b0a6c[_0xbb10('0x54')]['id']}})[_0xbb10('0x27')](handleEntityNotFound(_0xcd5d35,null))[_0xbb10('0x27')](function(_0x1c4235){if(_0x1c4235){return _0x1c4235[_0xbb10('0x68')](_0x1b0a6c['body'][_0xbb10('0x64')],_['omit'](_0x1b0a6c[_0xbb10('0x53')],[_0xbb10('0x64'),'id'])||{})[_0xbb10('0x6d')](function(_0x40236c){for(var _0x38d369=0x0;_0x38d369<_0x1b0a6c['body'][_0xbb10('0x64')][_0xbb10('0x36')];_0x38d369+=0x1){socket[_0xbb10('0x6e')](_0xbb10('0x6f'),{'UserId':_0x1b0a6c[_0xbb10('0x53')][_0xbb10('0x64')][_0x38d369],'OpenchannelQueueId':_0x1b0a6c['params']['id']});}return _0x40236c;});}})['then'](respondWithResult(_0xcd5d35,null))[_0xbb10('0x46')](handleError(_0xcd5d35,null));};exports[_0xbb10('0x6c')]=function(_0x41d4d0,_0x57d5a1,_0x124b32){var _0x3d6a91;return db['OpenchannelQueue'][_0xbb10('0x4a')]({'where':{'id':_0x41d4d0[_0xbb10('0x54')]['id']}})['then'](handleEntityNotFound(_0x57d5a1,null))[_0xbb10('0x27')](function(_0x4d7bca){if(_0x4d7bca){return _0x4d7bca[_0xbb10('0x6c')](_0x41d4d0[_0xbb10('0x30')]['ids'])[_0xbb10('0x27')](function(_0x28cc74){if(_['isArray'](_0x41d4d0['query'][_0xbb10('0x64')])){for(var _0x13ae83=0x0;_0x13ae83<_0x41d4d0[_0xbb10('0x30')][_0xbb10('0x64')][_0xbb10('0x36')];_0x13ae83+=0x1){socket['emit'](_0xbb10('0x70'),{'UserId':_0x41d4d0[_0xbb10('0x30')][_0xbb10('0x64')][_0x13ae83],'OpenchannelQueueId':_0x41d4d0['params']['id']});}}else{socket[_0xbb10('0x6e')](_0xbb10('0x70'),{'UserId':_0x41d4d0[_0xbb10('0x30')][_0xbb10('0x64')],'OpenchannelQueueId':_0x41d4d0[_0xbb10('0x54')]['id']});}});}})[_0xbb10('0x27')](respondWithStatusCode(_0x57d5a1,null))[_0xbb10('0x46')](handleError(_0x57d5a1,null));};exports[_0xbb10('0x71')]=function(_0x2010d4,_0x5f1fcd,_0x4fc544){var _0x37e40c={};var _0xe7238b={};var _0x293f3f;var _0x44f097;return db[_0xbb10('0x2e')][_0xbb10('0x57')]({'where':{'id':_0x2010d4[_0xbb10('0x54')]['id']}})[_0xbb10('0x27')](handleEntityNotFound(_0x5f1fcd,null))[_0xbb10('0x27')](function(_0x471827){if(_0x471827){_0x293f3f=_0x471827;_0xe7238b[_0xbb10('0x33')]=_[_0xbb10('0x2f')](db[_0xbb10('0x65')]['rawAttributes']);_0xe7238b[_0xbb10('0x30')]=_[_0xbb10('0x2f')](_0x2010d4[_0xbb10('0x30')]);_0xe7238b[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0xe7238b[_0xbb10('0x33')],_0xe7238b[_0xbb10('0x30')]);_0x37e40c[_0xbb10('0x34')]=_[_0xbb10('0x32')](_0xe7238b[_0xbb10('0x33')],qs[_0xbb10('0x35')](_0x2010d4['query'][_0xbb10('0x35')]));_0x37e40c['attributes']=_0x37e40c[_0xbb10('0x34')][_0xbb10('0x36')]?_0x37e40c[_0xbb10('0x34')]:_0xe7238b[_0xbb10('0x33')];_0x37e40c[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_0x2010d4['query'][_0xbb10('0x3a')]);_0x37e40c['where']=qs[_0xbb10('0x31')](_[_0xbb10('0x3c')](_0x2010d4[_0xbb10('0x30')],_0xe7238b[_0xbb10('0x31')]));if(_0x2010d4[_0xbb10('0x30')][_0xbb10('0x41')]){_0x37e40c[_0xbb10('0x3b')]=_[_0xbb10('0x3d')](_0x37e40c[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x5a')](_0x37e40c[_0xbb10('0x34')],function(_0xa09041){var _0x589565={};_0x589565[_0xa09041]={'$like':'%'+_0x2010d4[_0xbb10('0x30')]['filter']+'%'};return _0x589565;})});}_0x37e40c=_[_0xbb10('0x3d')]({},_0x37e40c,_0x2010d4[_0xbb10('0x42')]);return _0x293f3f[_0xbb10('0x71')](_0x37e40c);}})[_0xbb10('0x27')](function(_0x44c229){if(_0x44c229){_0x44f097=_0x44c229[_0xbb10('0x36')];if(!_0x2010d4[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x37'))){_0x37e40c['limit']=qs['limit'](_0x2010d4[_0xbb10('0x30')][_0xbb10('0x38')]);_0x37e40c[_0xbb10('0x21')]=qs[_0xbb10('0x21')](_0x2010d4[_0xbb10('0x30')][_0xbb10('0x21')]);}return _0x293f3f['getAgents'](_0x37e40c);}})[_0xbb10('0x27')](function(_0x2c25ab){if(_0x2c25ab){return _0x2c25ab?{'count':_0x44f097,'rows':_0x2c25ab}:null;}})[_0xbb10('0x27')](respondWithResult(_0x5f1fcd,null))[_0xbb10('0x46')](handleError(_0x5f1fcd,null));}; \ No newline at end of file +var _0xd8b0=['length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','key','VIRTUAL','field','options','includeAll','include','OpenchannelQueue','findAll','rows','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','describe','getMembers','UserOpenchannelQueue','pick','OpenchannelQueueId','map','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','union','addAgents','removeTeams','omit','spread','emit','userOpenchannelQueue:save','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','OpenchannelQueues','end','error','name','index','rawAttributes','keys','query','filters','intersection','model','attributes','fields'];(function(_0x5a7003,_0x544bac){var _0x28bf83=function(_0x2d67fd){while(--_0x2d67fd){_0x5a7003['push'](_0x5a7003['shift']());}};_0x28bf83(++_0x544bac);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var authService=require(_0x0d8b('0xe'));var hardwareService=require(_0x0d8b('0xf'));var Redis=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var logger=require(_0x0d8b('0x12'))('api');var utils=require(_0x0d8b('0x13'));var config=require('../../config/environment');var db=require(_0x0d8b('0x14'))['db'];config[_0x0d8b('0x15')]=_[_0x0d8b('0x16')](config[_0x0d8b('0x15')],{'host':_0x0d8b('0x17'),'port':0x18eb});var socket=require(_0x0d8b('0x18'))(new Redis(config[_0x0d8b('0x15')]));require(_0x0d8b('0x19'))[_0x0d8b('0x1a')](socket);function respondWithStatusCode(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xcc;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x1b')](_0x5ad086);}return _0x2ce75e[_0x0d8b('0x1c')](_0x5ad086)['end']();};}function respondWithResult(_0x23eb7b,_0xa86349){_0xa86349=_0xa86349||0xc8;return function(_0x17f7df){if(_0x17f7df){return _0x23eb7b[_0x0d8b('0x1c')](_0xa86349)[_0x0d8b('0x1d')](_0x17f7df);}};}function respondWithFilteredResult(_0x5cd485,_0x106a01){return function(_0x4586c2){if(_0x4586c2){var _0x2fd0fc=_0x4586c2[_0x0d8b('0x1e')],_0x5fecbd=_0x106a01[_0x0d8b('0x1f')],_0x333674=_0x106a01['offset']+_0x106a01[_0x0d8b('0x20')],_0x18dd2d;if(_0x333674>=_0x2fd0fc){_0x333674=_0x2fd0fc;_0x18dd2d=0xc8;}else{_0x18dd2d=0xce;}_0x5cd485[_0x0d8b('0x1c')](_0x18dd2d);return _0x5cd485[_0x0d8b('0x21')](_0x0d8b('0x22'),_0x5fecbd+'-'+_0x333674+'/'+_0x2fd0fc)[_0x0d8b('0x1d')](_0x4586c2);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x23')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x24')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x25')](_0x54a9a7)[_0x0d8b('0x26')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x27')]()[_0x0d8b('0x26')](function(){var _0x27b695=_0x2c64e2['get']({'plain':!![]});var _0xe8bbee=_0x0d8b('0x28');return db['UserProfileResource'][_0x0d8b('0x27')]({'where':{'type':_0xe8bbee,'resourceId':_0x27b695['id']}})['then'](function(){return _0x2c64e2;});})[_0x0d8b('0x26')](function(){_0x38efc8[_0x0d8b('0x1c')](0xcc)[_0x0d8b('0x29')]();});}};}function handleEntityNotFound(_0x4fe6f9,_0x59a905){return function(_0x28f639){if(!_0x28f639){_0x4fe6f9[_0x0d8b('0x1b')](0x194);}return _0x28f639;};}function handleError(_0x4c05ee,_0xcbc4ac){_0xcbc4ac=_0xcbc4ac||0x1f4;return function(_0x59aa83){logger[_0x0d8b('0x2a')](_0x59aa83['stack']);if(_0x59aa83[_0x0d8b('0x2b')]){delete _0x59aa83['name'];}_0x4c05ee[_0x0d8b('0x1c')](_0xcbc4ac)['send'](_0x59aa83);};}exports[_0x0d8b('0x2c')]=function(_0x544735,_0x3c8887){var _0x106e4c={},_0x2c058d={},_0x56120a={'count':0x0,'rows':[]};var _0x4c80a2=db['OpenchannelQueue'][_0x0d8b('0x2d')];_0x2c058d['model']=_[_0x0d8b('0x2e')](_0x4c80a2);_0x2c058d['query']=_['keys'](_0x544735[_0x0d8b('0x2f')]);_0x2c058d[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0x2c058d[_0x0d8b('0x32')],_0x2c058d[_0x0d8b('0x2f')]);_0x106e4c[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0x2c058d[_0x0d8b('0x32')],qs['fields'](_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x106e4c['attributes']=_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x106e4c[_0x0d8b('0x33')]:_0x2c058d['model'];if(!_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x106e4c[_0x0d8b('0x20')]=qs[_0x0d8b('0x20')](_0x544735['query'][_0x0d8b('0x20')]);_0x106e4c[_0x0d8b('0x1f')]=qs['offset'](_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}_0x106e4c[_0x0d8b('0x38')]=qs[_0x0d8b('0x39')](_0x544735[_0x0d8b('0x2f')]['sort']);_0x106e4c['where']=qs[_0x0d8b('0x30')](_['pick'](_0x544735['query'],_0x2c058d[_0x0d8b('0x30')]));if(_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x106e4c[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x106e4c[_0x0d8b('0x3b')],{'$or':_['map'](_0x4c80a2,function(_0x6e5bab){if(_0x6e5bab[_0x0d8b('0x3d')][_0x0d8b('0x3e')]!==_0x0d8b('0x3f')){var _0x338ed3={};_0x338ed3[_0x6e5bab[_0x0d8b('0x40')]]={'$like':'%'+_0x544735[_0x0d8b('0x2f')]['filter']+'%'};return _0x338ed3;}})});}_0x106e4c=_[_0x0d8b('0x3c')]({},_0x106e4c,_0x544735[_0x0d8b('0x41')]);var _0x3fa955={'where':_0x106e4c[_0x0d8b('0x3b')]};return db['OpenchannelQueue'][_0x0d8b('0x1e')](_0x3fa955)['then'](function(_0x37b26c){_0x56120a[_0x0d8b('0x1e')]=_0x37b26c;if(_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x42')]){_0x106e4c[_0x0d8b('0x43')]=[{'all':!![]}];}return db[_0x0d8b('0x44')][_0x0d8b('0x45')](_0x106e4c);})[_0x0d8b('0x26')](function(_0x89ab0d){_0x56120a[_0x0d8b('0x46')]=_0x89ab0d;return _0x56120a;})['then'](respondWithFilteredResult(_0x3c8887,_0x106e4c))['catch'](handleError(_0x3c8887,null));};exports['show']=function(_0x4d0811,_0x524d79){var _0x1a46f6={'raw':!![],'where':{'id':_0x4d0811[_0x0d8b('0x47')]['id']}},_0x402fe0={};_0x402fe0['model']=_['keys'](db[_0x0d8b('0x44')][_0x0d8b('0x2d')]);_0x402fe0[_0x0d8b('0x2f')]=_['keys'](_0x4d0811[_0x0d8b('0x2f')]);_0x402fe0[_0x0d8b('0x30')]=_['intersection'](_0x402fe0['model'],_0x402fe0[_0x0d8b('0x2f')]);_0x1a46f6['attributes']=_[_0x0d8b('0x31')](_0x402fe0['model'],qs['fields'](_0x4d0811[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x1a46f6['attributes']=_0x1a46f6['attributes']['length']?_0x1a46f6['attributes']:_0x402fe0[_0x0d8b('0x32')];if(_0x4d0811[_0x0d8b('0x2f')][_0x0d8b('0x42')]){_0x1a46f6['include']=[{'all':!![]}];}_0x1a46f6=_[_0x0d8b('0x3c')]({},_0x1a46f6,_0x4d0811[_0x0d8b('0x41')]);return db[_0x0d8b('0x44')][_0x0d8b('0x48')](_0x1a46f6)[_0x0d8b('0x26')](handleEntityNotFound(_0x524d79,null))[_0x0d8b('0x26')](respondWithResult(_0x524d79,null))[_0x0d8b('0x49')](handleError(_0x524d79,null));};exports[_0x0d8b('0x4a')]=function(_0x384a5e,_0x1f2077){return db[_0x0d8b('0x44')][_0x0d8b('0x4a')](_0x384a5e[_0x0d8b('0x4b')],{})[_0x0d8b('0x26')](function(_0x570af8){var _0xdfcf32=_0x384a5e[_0x0d8b('0x4c')][_0x0d8b('0x4d')]({'plain':!![]});if(!_0xdfcf32)throw new Error(_0x0d8b('0x4e'));if(_0xdfcf32['role']===_0x0d8b('0x4c')){var _0x4d8850=_0x570af8['get']({'plain':!![]});var _0x39a31d=_0x0d8b('0x28');return db[_0x0d8b('0x4f')][_0x0d8b('0x48')]({'where':{'name':_0x39a31d,'userProfileId':_0xdfcf32['userProfileId']},'raw':!![]})[_0x0d8b('0x26')](function(_0x1106d6){if(_0x1106d6&&_0x1106d6[_0x0d8b('0x50')]===0x0){return db[_0x0d8b('0x51')][_0x0d8b('0x4a')]({'name':_0x4d8850['name'],'resourceId':_0x4d8850['id'],'type':_0x1106d6['name'],'sectionId':_0x1106d6['id']},{})['then'](function(){return _0x570af8;});}else{return _0x570af8;}})['catch'](function(_0x368ede){logger[_0x0d8b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368ede);throw _0x368ede;});}return _0x570af8;})['then'](respondWithResult(_0x1f2077,0xc9))[_0x0d8b('0x49')](handleError(_0x1f2077,null));};exports[_0x0d8b('0x25')]=function(_0x5c5bd7,_0x5ef6c3){if(_0x5c5bd7[_0x0d8b('0x4b')]['id']){delete _0x5c5bd7[_0x0d8b('0x4b')]['id'];}return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x5c5bd7[_0x0d8b('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ef6c3,null))[_0x0d8b('0x26')](saveUpdates(_0x5c5bd7[_0x0d8b('0x4b')],null))['then'](respondWithResult(_0x5ef6c3,null))['catch'](handleError(_0x5ef6c3,null));};exports[_0x0d8b('0x27')]=function(_0x3f2d95,_0x546fef){return db['OpenchannelQueue'][_0x0d8b('0x48')]({'where':{'id':_0x3f2d95[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x546fef,null))[_0x0d8b('0x26')](removeEntity(_0x546fef,null))['catch'](handleError(_0x546fef,null));};exports[_0x0d8b('0x52')]=function(_0x598e03,_0x5c271c){return db[_0x0d8b('0x44')][_0x0d8b('0x52')]()['then'](respondWithResult(_0x5c271c,null))['catch'](handleError(_0x5c271c,null));};exports[_0x0d8b('0x53')]=function(_0x3d7161,_0xccc2a9,_0x2c1eb0){var _0x3afc3a={'raw':!![],'where':{}},_0xb66e76={},_0x3978e5;return db[_0x0d8b('0x44')]['findOne']({'where':{'id':_0x3d7161[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0xccc2a9,null))[_0x0d8b('0x26')](function(_0x3c7efb){if(_0x3c7efb){_0x3978e5=_0x3c7efb[_0x0d8b('0x4d')]({'plain':!![]});_0xb66e76[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db[_0x0d8b('0x54')][_0x0d8b('0x2d')]);_0xb66e76['query']=_[_0x0d8b('0x2e')](_0x3d7161[_0x0d8b('0x2f')]);_0xb66e76[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0xb66e76[_0x0d8b('0x32')],_0xb66e76['query']);_0x3afc3a[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0xb66e76[_0x0d8b('0x32')],qs[_0x0d8b('0x34')](_0x3d7161[_0x0d8b('0x2f')]['fields']));_0x3afc3a['attributes']=_0x3afc3a[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x3afc3a[_0x0d8b('0x33')]:_0xb66e76[_0x0d8b('0x32')];if(!_0x3d7161['query'][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x3afc3a[_0x0d8b('0x20')]=qs['limit'](_0x3d7161[_0x0d8b('0x2f')]['limit']);_0x3afc3a[_0x0d8b('0x1f')]=qs[_0x0d8b('0x1f')](_0x3d7161[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}_0x3afc3a[_0x0d8b('0x38')]=qs[_0x0d8b('0x39')](_0x3d7161['query'][_0x0d8b('0x39')]);_0x3afc3a['where']=qs[_0x0d8b('0x30')](_[_0x0d8b('0x55')](_0x3d7161[_0x0d8b('0x2f')],_0xb66e76[_0x0d8b('0x30')]));_0x3afc3a['where'][_0x0d8b('0x56')]=_0x3c7efb['id'];if(_0x3d7161[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x3afc3a[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x3afc3a[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x3afc3a[_0x0d8b('0x33')],function(_0x2ce282){var _0x34affb={};_0x34affb[_0x2ce282]={'$like':'%'+_0x3d7161['query']['filter']+'%'};return _0x34affb;})});}_0x3afc3a=_[_0x0d8b('0x3c')]({},_0x3afc3a,_0x3d7161[_0x0d8b('0x41')]);return db['UserOpenchannelQueue'][_0x0d8b('0x45')](_0x3afc3a);}})['then'](function(_0x5cc960){if(_0x5cc960){return db[_0x0d8b('0x58')][_0x0d8b('0x59')]({'where':{'id':_['map'](_0x5cc960,'UserId'),'role':_0x0d8b('0x5a')},'attributes':['id',_0x0d8b('0x2b'),_0x0d8b('0x5b'),_0x0d8b('0x5c'),_0x0d8b('0x5d')]});}})[_0x0d8b('0x26')](function(_0x40d265){if(_0x40d265){return{'count':_0x40d265['count'],'rows':_[_0x0d8b('0x57')](_0x40d265['rows'],function(_0x1a203e){return{'membername':_0x1a203e[_0x0d8b('0x2b')],'UserId':_0x1a203e['id'],'queue_name':_0x3978e5[_0x0d8b('0x2b')],'OpenchannelQueueId':_0x3978e5['id'],'interface':util[_0x0d8b('0x5e')]('%s/%s',_0x0d8b('0x5f'),_0x1a203e['name']),'penalty':0x0,'paused':_0x1a203e[_0x0d8b('0x5b')],'createdAt':_0x1a203e[_0x0d8b('0x5d')],'updatedAt':_0x1a203e[_0x0d8b('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0d8b('0x26')](respondWithFilteredResult(_0xccc2a9,_0x3afc3a))[_0x0d8b('0x49')](handleError(_0xccc2a9,null));};exports[_0x0d8b('0x60')]=function(_0x3e927c,_0x91aa89,_0x266a69){var _0x44aa74={};var _0x4eb07e={};var _0x1436b3;var _0x54c28b;return db[_0x0d8b('0x44')][_0x0d8b('0x61')]({'where':{'id':_0x3e927c['params']['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x91aa89,null))['then'](function(_0x10c318){if(_0x10c318){_0x1436b3=_0x10c318;_0x4eb07e[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db[_0x0d8b('0x62')][_0x0d8b('0x2d')]);_0x4eb07e[_0x0d8b('0x2f')]=_[_0x0d8b('0x2e')](_0x3e927c[_0x0d8b('0x2f')]);_0x4eb07e['filters']=_[_0x0d8b('0x31')](_0x4eb07e[_0x0d8b('0x32')],_0x4eb07e['query']);_0x44aa74[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0x4eb07e[_0x0d8b('0x32')],qs[_0x0d8b('0x34')](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x44aa74[_0x0d8b('0x33')]=_0x44aa74[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x44aa74[_0x0d8b('0x33')]:_0x4eb07e[_0x0d8b('0x32')];_0x44aa74[_0x0d8b('0x38')]=qs['sort'](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x39')]);_0x44aa74[_0x0d8b('0x3b')]=qs['filters'](_['pick'](_0x3e927c[_0x0d8b('0x2f')],_0x4eb07e[_0x0d8b('0x30')]));if(_0x3e927c[_0x0d8b('0x2f')]['filter']){_0x44aa74['where']=_[_0x0d8b('0x3c')](_0x44aa74[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x44aa74[_0x0d8b('0x33')],function(_0x2a2b58){var _0x3f7895={};_0x3f7895[_0x2a2b58]={'$like':'%'+_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x3a')]+'%'};return _0x3f7895;})});}_0x44aa74=_[_0x0d8b('0x3c')]({},_0x44aa74,_0x3e927c[_0x0d8b('0x41')]);return _0x1436b3[_0x0d8b('0x60')](_0x44aa74);}})[_0x0d8b('0x26')](function(_0x3b060e){if(_0x3b060e){_0x54c28b=_0x3b060e['length'];if(!_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x36')]('nolimit')){_0x44aa74['limit']=qs[_0x0d8b('0x20')](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x20')]);_0x44aa74[_0x0d8b('0x1f')]=qs[_0x0d8b('0x1f')](_0x3e927c[_0x0d8b('0x2f')]['offset']);}return _0x1436b3['getTeams'](_0x44aa74);}})['then'](function(_0x1f1eae){if(_0x1f1eae){return _0x1f1eae?{'count':_0x54c28b,'rows':_0x1f1eae}:null;}})[_0x0d8b('0x26')](respondWithResult(_0x91aa89,null))[_0x0d8b('0x49')](handleError(_0x91aa89,null));};exports[_0x0d8b('0x63')]=function(_0x3f1eee,_0x21d620,_0x5ef461){var _0x302426=[];var _0x1d173f;return db['Team'][_0x0d8b('0x45')]({'where':{'id':_0x3f1eee['body'][_0x0d8b('0x64')]},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x58')],'as':_0x0d8b('0x65'),'attributes':['id'],'raw':!![]}]})[_0x0d8b('0x26')](function(_0x10c7ab){if(_0x10c7ab){for(var _0x8fae7f=0x0;_0x8fae7f<_0x10c7ab[_0x0d8b('0x35')];_0x8fae7f+=0x1){for(var _0xb73e32=0x0;_0xb73e32<_0x10c7ab[_0x8fae7f][_0x0d8b('0x65')][_0x0d8b('0x35')];_0xb73e32+=0x1){_0x302426=_[_0x0d8b('0x66')](_0x302426,[_0x10c7ab[_0x8fae7f][_0x0d8b('0x65')][_0xb73e32]['id']]);}}return _0x302426;}})['then'](function(_0x4dd64b){if(_0x4dd64b){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x3f1eee[_0x0d8b('0x47')]['id']}});}})[_0x0d8b('0x26')](function(_0xf91ecd){if(_0xf91ecd){_0x1d173f=_0xf91ecd;return _0x1d173f[_0x0d8b('0x67')](_0x302426,{'penalty':_0x3f1eee[_0x0d8b('0x4b')]['penalty']});}})[_0x0d8b('0x26')](function(_0x4c3948){if(_0x4c3948){return _0x1d173f[_0x0d8b('0x63')](_0x3f1eee['body']['ids']);}})[_0x0d8b('0x26')](handleEntityNotFound(_0x21d620,null))[_0x0d8b('0x26')](respondWithStatusCode(_0x21d620,null))[_0x0d8b('0x49')](handleError(_0x21d620,null));};exports[_0x0d8b('0x68')]=function(_0x2cf02c,_0x2eece2,_0x3c7b9b){var _0x180eda=[];var _0x35267a;return db[_0x0d8b('0x62')][_0x0d8b('0x45')]({'where':{'id':_0x2cf02c[_0x0d8b('0x2f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x58')],'as':_0x0d8b('0x65'),'attributes':['id'],'raw':!![]}]})[_0x0d8b('0x26')](function(_0x5eba19){if(_0x5eba19){for(var _0x4ce443=0x0;_0x4ce443<_0x5eba19[_0x0d8b('0x35')];_0x4ce443+=0x1){for(var _0x671705=0x0;_0x671705<_0x5eba19[_0x4ce443][_0x0d8b('0x65')][_0x0d8b('0x35')];_0x671705+=0x1){_0x180eda=_[_0x0d8b('0x66')](_0x180eda,[_0x5eba19[_0x4ce443][_0x0d8b('0x65')][_0x671705]['id']]);}}return _0x180eda;}})['then'](function(_0x1a96ce){if(_0x1a96ce){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x2cf02c[_0x0d8b('0x47')]['id']}});}})[_0x0d8b('0x26')](function(_0x55ea97){if(_0x55ea97){_0x35267a=_0x55ea97;return _0x35267a['removeAgents'](_0x180eda);}})[_0x0d8b('0x26')](function(_0x41ea29){if(_0x35267a){return _0x35267a[_0x0d8b('0x68')](_0x2cf02c['query'][_0x0d8b('0x64')]);}})[_0x0d8b('0x26')](handleEntityNotFound(_0x2eece2,null))[_0x0d8b('0x26')](respondWithStatusCode(_0x2eece2,null))['catch'](handleError(_0x2eece2,null));};exports[_0x0d8b('0x67')]=function(_0x3bc6d5,_0xeca283,_0x9ec9bc){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x3bc6d5[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0xeca283,null))[_0x0d8b('0x26')](function(_0x4bb4c7){if(_0x4bb4c7){return _0x4bb4c7[_0x0d8b('0x67')](_0x3bc6d5[_0x0d8b('0x4b')][_0x0d8b('0x64')],_[_0x0d8b('0x69')](_0x3bc6d5[_0x0d8b('0x4b')],[_0x0d8b('0x64'),'id'])||{})[_0x0d8b('0x6a')](function(_0x673201){for(var _0x35ebba=0x0;_0x35ebba<_0x3bc6d5['body']['ids'][_0x0d8b('0x35')];_0x35ebba+=0x1){socket[_0x0d8b('0x6b')](_0x0d8b('0x6c'),{'UserId':_0x3bc6d5[_0x0d8b('0x4b')]['ids'][_0x35ebba],'OpenchannelQueueId':_0x3bc6d5[_0x0d8b('0x47')]['id']});}return _0x673201;});}})[_0x0d8b('0x26')](respondWithResult(_0xeca283,null))['catch'](handleError(_0xeca283,null));};exports[_0x0d8b('0x6d')]=function(_0x4e1b5b,_0x4fb226,_0x2e5f7a){var _0x33965a;return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x4e1b5b[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x4fb226,null))[_0x0d8b('0x26')](function(_0x4ceb3a){if(_0x4ceb3a){return _0x4ceb3a[_0x0d8b('0x6d')](_0x4e1b5b['query']['ids'])[_0x0d8b('0x26')](function(_0x5c50f2){if(_[_0x0d8b('0x6e')](_0x4e1b5b[_0x0d8b('0x2f')]['ids'])){for(var _0x12f2bb=0x0;_0x12f2bb<_0x4e1b5b['query']['ids'][_0x0d8b('0x35')];_0x12f2bb+=0x1){socket[_0x0d8b('0x6b')](_0x0d8b('0x6f'),{'UserId':_0x4e1b5b[_0x0d8b('0x2f')][_0x0d8b('0x64')][_0x12f2bb],'OpenchannelQueueId':_0x4e1b5b['params']['id']});}}else{socket['emit'](_0x0d8b('0x6f'),{'UserId':_0x4e1b5b[_0x0d8b('0x2f')][_0x0d8b('0x64')],'OpenchannelQueueId':_0x4e1b5b[_0x0d8b('0x47')]['id']});}});}})[_0x0d8b('0x26')](respondWithStatusCode(_0x4fb226,null))[_0x0d8b('0x49')](handleError(_0x4fb226,null));};exports[_0x0d8b('0x70')]=function(_0x21bfd1,_0x4e3dd1,_0x5ab046){var _0x3582d3={};var _0x2640a6={};var _0x4a453b;var _0x551995;return db['OpenchannelQueue'][_0x0d8b('0x61')]({'where':{'id':_0x21bfd1[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x4e3dd1,null))['then'](function(_0x21643d){if(_0x21643d){_0x4a453b=_0x21643d;_0x2640a6[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db['User'][_0x0d8b('0x2d')]);_0x2640a6['query']=_[_0x0d8b('0x2e')](_0x21bfd1['query']);_0x2640a6[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0x2640a6[_0x0d8b('0x32')],_0x2640a6[_0x0d8b('0x2f')]);_0x3582d3[_0x0d8b('0x33')]=_['intersection'](_0x2640a6[_0x0d8b('0x32')],qs['fields'](_0x21bfd1[_0x0d8b('0x2f')]['fields']));_0x3582d3[_0x0d8b('0x33')]=_0x3582d3['attributes']['length']?_0x3582d3[_0x0d8b('0x33')]:_0x2640a6[_0x0d8b('0x32')];_0x3582d3['order']=qs[_0x0d8b('0x39')](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x39')]);_0x3582d3['where']=qs['filters'](_['pick'](_0x21bfd1[_0x0d8b('0x2f')],_0x2640a6[_0x0d8b('0x30')]));if(_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x3582d3[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x3582d3[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x3582d3[_0x0d8b('0x33')],function(_0xba602f){var _0x4dc5bd={};_0x4dc5bd[_0xba602f]={'$like':'%'+_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x3a')]+'%'};return _0x4dc5bd;})});}_0x3582d3=_[_0x0d8b('0x3c')]({},_0x3582d3,_0x21bfd1['options']);return _0x4a453b[_0x0d8b('0x70')](_0x3582d3);}})[_0x0d8b('0x26')](function(_0x13bce2){if(_0x13bce2){_0x551995=_0x13bce2[_0x0d8b('0x35')];if(!_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x3582d3[_0x0d8b('0x20')]=qs[_0x0d8b('0x20')](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x20')]);_0x3582d3[_0x0d8b('0x1f')]=qs['offset'](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}return _0x4a453b[_0x0d8b('0x70')](_0x3582d3);}})[_0x0d8b('0x26')](function(_0x590889){if(_0x590889){return _0x590889?{'count':_0x551995,'rows':_0x590889}:null;}})['then'](respondWithResult(_0x4e3dd1,null))[_0x0d8b('0x49')](handleError(_0x4e3dd1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 08f4eb7..5d91ff7 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 _0x533a=['../../mysqldb','OpenchannelQueue','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x533a,0x105));var _0xa533=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0x533a[_0x393500];return _0x120d3b;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xa533('0x0'))['db'][_0xa533('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa533('0x2'),'afterUpdate':_0xa533('0x3'),'afterDestroy':_0xa533('0x4')};function emitEvent(_0x5cebd9){return function(_0x4b0c46,_0x27f523,_0x23b6eb){OpenchannelQueueEvents[_0xa533('0x5')](_0x5cebd9+':'+_0x4b0c46['id'],_0x4b0c46);OpenchannelQueueEvents[_0xa533('0x5')](_0x5cebd9,_0x4b0c46);_0x23b6eb(null);};}for(var e in events){if(events[_0xa533('0x6')](e)){var event=events[e];OpenchannelQueue[_0xa533('0x7')](e,emitEvent(event));}}module[_0xa533('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x4a7d=['update','remove','emit','hasOwnProperty','hook','events','save'];(function(_0xd7f265,_0x4b8f3b){var _0x2c5e98=function(_0x113125){while(--_0x113125){_0xd7f265['push'](_0xd7f265['shift']());}};_0x2c5e98(++_0x4b8f3b);}(_0x4a7d,0x116));var _0xd4a7=function(_0x3bf1fe,_0x26b1b7){_0x3bf1fe=_0x3bf1fe-0x0;var _0x33509e=_0x4a7d[_0x3bf1fe];return _0x33509e;};'use strict';var EventEmitter=require(_0xd4a7('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd4a7('0x1'),'afterUpdate':_0xd4a7('0x2'),'afterDestroy':_0xd4a7('0x3')};function emitEvent(_0x28c9af){return function(_0xd06657,_0x39e76b,_0x146f4f){OpenchannelQueueEvents[_0xd4a7('0x4')](_0x28c9af+':'+_0xd06657['id'],_0xd06657);OpenchannelQueueEvents[_0xd4a7('0x4')](_0x28c9af,_0xd06657);_0x146f4f(null);};}for(var e in events){if(events[_0xd4a7('0x5')](e)){var event=events[e];OpenchannelQueue[_0xd4a7('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 1beffd5..3facac8 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 _0xa9e0=['exports','define','openchannel_queues','lodash','util','../../config/logger','bluebird','./openchannelQueue.attributes'];(function(_0x366679,_0x50ba2f){var _0x482897=function(_0x3d23cc){while(--_0x3d23cc){_0x366679['push'](_0x366679['shift']());}};_0x482897(++_0x50ba2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var attributes=require(_0x0a9e('0x4'));module[_0x0a9e('0x5')]=function(_0x2ab90b,_0x991246){return _0x2ab90b[_0x0a9e('0x6')]('OpenchannelQueue',attributes,{'tableName':_0x0a9e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ff3=['define','OpenchannelQueue','openchannel_queues','util','api','bluebird','request-promise','./openchannelQueue.attributes','exports'];(function(_0x52db6e,_0x2aea70){var _0x5be45d=function(_0x31699e){while(--_0x31699e){_0x52db6e['push'](_0x52db6e['shift']());}};_0x5be45d(++_0x2aea70);}(_0x5ff3,0x17d));var _0x35ff=function(_0x5de88a,_0x465f00){_0x5de88a=_0x5de88a-0x0;var _0x226145=_0x5ff3[_0x5de88a];return _0x226145;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var attributes=require(_0x35ff('0x4'));module[_0x35ff('0x5')]=function(_0x551514,_0x2fcb74){return _0x551514[_0x35ff('0x6')](_0x35ff('0x7'),attributes,{'tableName':_0x35ff('0x8'),'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 1ca976f..4a3bdfb 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 _0x1306=['code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','raw','options','where','limit','include','attributes','map','model','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','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','debug','stringify','error'];(function(_0x353de1,_0x9dc362){var _0x1d3120=function(_0x507916){while(--_0x507916){_0x353de1['push'](_0x353de1['shift']());}};_0x1d3120(++_0x9dc362);}(_0x1306,0x17a));var _0x6130=function(_0xf56eaa,_0x483ee9){_0xf56eaa=_0xf56eaa-0x0;var _0xcac603=_0x1306[_0xf56eaa];return _0xcac603;};'use strict';var _=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var moment=require(_0x6130('0x2'));var BPromise=require(_0x6130('0x3'));var rs=require(_0x6130('0x4'));var fs=require('fs');var Redis=require(_0x6130('0x5'));var db=require(_0x6130('0x6'))['db'];var utils=require(_0x6130('0x7'));var logger=require(_0x6130('0x8'))(_0x6130('0x9'));var config=require(_0x6130('0xa'));var jayson=require(_0x6130('0xb'));var client=jayson[_0x6130('0xc')][_0x6130('0xd')]({'port':0x232a});config[_0x6130('0xe')]=_[_0x6130('0xf')](config[_0x6130('0xe')],{'host':_0x6130('0x10'),'port':0x18eb});var socket=require(_0x6130('0x11'))(new Redis(config[_0x6130('0xe')]));require(_0x6130('0x12'))[_0x6130('0x13')](socket);function respondWithRpcPromise(_0xb9c7e6,_0x34d1a6,_0x2d06a5){return new BPromise(function(_0x107d80,_0xcaf732){return client[_0x6130('0x14')](_0xb9c7e6,_0x2d06a5)[_0x6130('0x15')](function(_0x583072){logger[_0x6130('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x34d1a6,_0x6130('0x17'));logger[_0x6130('0x18')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x34d1a6,_0x6130('0x17'),JSON[_0x6130('0x19')](_0x583072));if(_0x583072[_0x6130('0x1a')]){if(_0x583072[_0x6130('0x1a')][_0x6130('0x1b')]===0x1f4){logger[_0x6130('0x1a')](_0x6130('0x1c'),_0x34d1a6,_0x583072[_0x6130('0x1a')][_0x6130('0x1d')]);return _0xcaf732(_0x583072[_0x6130('0x1a')][_0x6130('0x1d')]);}logger[_0x6130('0x1a')](_0x6130('0x1c'),_0x34d1a6,_0x583072[_0x6130('0x1a')][_0x6130('0x1d')]);return _0x107d80(_0x583072[_0x6130('0x1a')]['message']);}else{logger['info'](_0x6130('0x1c'),_0x34d1a6,'request\x20sent');_0x107d80(_0x583072[_0x6130('0x1e')][_0x6130('0x1d')]);}})[_0x6130('0x1f')](function(_0x2c83b0){logger[_0x6130('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0x34d1a6,_0x2c83b0);_0xcaf732(_0x2c83b0);});});}exports[_0x6130('0x20')]=function(_0x4d4b4b){var _0x41fa14=this;return new Promise(function(_0x41f56a,_0x18bb78){return db[_0x6130('0x21')][_0x6130('0x22')]({'raw':_0x4d4b4b['options']?_0x4d4b4b['options'][_0x6130('0x23')]===undefined?!![]:![]:!![],'where':_0x4d4b4b['options']?_0x4d4b4b[_0x6130('0x24')][_0x6130('0x25')]||null:null,'attributes':_0x4d4b4b['options']?_0x4d4b4b['options']['attributes']||null:null,'limit':_0x4d4b4b[_0x6130('0x24')]?_0x4d4b4b['options'][_0x6130('0x26')]||null:null,'include':_0x4d4b4b['options']?_0x4d4b4b['options']['include']?_['map'](_0x4d4b4b['options'][_0x6130('0x27')],function(_0x1ba07d){return{'model':db[_0x1ba07d['model']],'as':_0x1ba07d['as'],'attributes':_0x1ba07d[_0x6130('0x28')],'include':_0x1ba07d['include']?_[_0x6130('0x29')](_0x1ba07d['include'],function(_0x5787a6){return{'model':db[_0x5787a6[_0x6130('0x2a')]],'as':_0x5787a6['as'],'attributes':_0x5787a6[_0x6130('0x28')],'include':_0x5787a6[_0x6130('0x27')]?_[_0x6130('0x29')](_0x5787a6[_0x6130('0x27')],function(_0x392386){return{'model':db[_0x392386[_0x6130('0x2a')]],'as':_0x392386['as'],'attributes':_0x392386[_0x6130('0x28')]};}):[]};}):[]};}):[]:[]})[_0x6130('0x15')](function(_0x5809e4){logger['info'](_0x6130('0x20'),_0x4d4b4b);logger[_0x6130('0x18')](_0x6130('0x20'),_0x4d4b4b,JSON[_0x6130('0x19')](_0x5809e4));_0x41f56a(_0x5809e4);})[_0x6130('0x1f')](function(_0x4e068c){logger[_0x6130('0x1a')](_0x6130('0x20'),_0x4e068c[_0x6130('0x1d')],_0x4d4b4b);_0x18bb78(_0x41fa14[_0x6130('0x1a')](0x1f4,_0x4e068c[_0x6130('0x1d')]));});});};exports['ShowOpenchannelQueue']=function(_0x248324){var _0x600c28=this;return new Promise(function(_0x165407,_0x4b0c9c){return db[_0x6130('0x21')][_0x6130('0x2b')]({'raw':_0x248324[_0x6130('0x24')]?_0x248324[_0x6130('0x24')][_0x6130('0x23')]===undefined?!![]:![]:!![],'where':_0x248324[_0x6130('0x24')]?_0x248324[_0x6130('0x24')][_0x6130('0x25')]||null:null,'attributes':_0x248324[_0x6130('0x24')]?_0x248324['options'][_0x6130('0x28')]||null:null,'include':_0x248324['options']?_0x248324['options']['include']?_[_0x6130('0x29')](_0x248324[_0x6130('0x24')][_0x6130('0x27')],function(_0x3b5270){return{'model':db[_0x3b5270[_0x6130('0x2a')]],'as':_0x3b5270['as'],'attributes':_0x3b5270[_0x6130('0x28')],'include':_0x3b5270[_0x6130('0x27')]?_[_0x6130('0x29')](_0x3b5270['include'],function(_0x36a91e){return{'model':db[_0x36a91e[_0x6130('0x2a')]],'as':_0x36a91e['as'],'attributes':_0x36a91e['attributes'],'include':_0x36a91e[_0x6130('0x27')]?_[_0x6130('0x29')](_0x36a91e[_0x6130('0x27')],function(_0x5874cd){return{'model':db[_0x5874cd[_0x6130('0x2a')]],'as':_0x5874cd['as'],'attributes':_0x5874cd[_0x6130('0x28')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f3798){logger[_0x6130('0x16')](_0x6130('0x2c'),_0x248324);logger[_0x6130('0x18')]('ShowOpenchannelQueue',_0x248324,JSON['stringify'](_0x5f3798));_0x165407(_0x5f3798);})[_0x6130('0x1f')](function(_0x94a76){logger[_0x6130('0x1a')](_0x6130('0x2c'),_0x94a76[_0x6130('0x1d')],_0x248324);_0x4b0c9c(_0x600c28[_0x6130('0x1a')](0x1f4,_0x94a76[_0x6130('0x1d')]));});});}; \ No newline at end of file +var _0xd737=['socket.io-emitter','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelQueue','options','raw','where','limit','include','map','model','attributes','GetOpenchannelQueue','debug','find','ShowOpenchannelQueue','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','client','http','redis','defaults','localhost'];(function(_0x240b4d,_0x3199ee){var _0x595b25=function(_0x3c1597){while(--_0x3c1597){_0x240b4d['push'](_0x240b4d['shift']());}};_0x595b25(++_0x3199ee);}(_0xd737,0x85));var _0x7d73=function(_0x109e39,_0x27f91c){_0x109e39=_0x109e39-0x0;var _0x3b142f=_0xd737[_0x109e39];return _0x3b142f;};'use strict';var _=require(_0x7d73('0x0'));var util=require('util');var moment=require(_0x7d73('0x1'));var BPromise=require('bluebird');var rs=require(_0x7d73('0x2'));var fs=require('fs');var Redis=require(_0x7d73('0x3'));var db=require(_0x7d73('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d73('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d73('0x6')][_0x7d73('0x7')]({'port':0x232a});config[_0x7d73('0x8')]=_[_0x7d73('0x9')](config[_0x7d73('0x8')],{'host':_0x7d73('0xa'),'port':0x18eb});var socket=require(_0x7d73('0xb'))(new Redis(config[_0x7d73('0x8')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x964570,_0x3252fc,_0x5c6f19){return new BPromise(function(_0x1c1d21,_0x589ee7){return client[_0x7d73('0xc')](_0x964570,_0x5c6f19)[_0x7d73('0xd')](function(_0x2c65ba){logger['info'](_0x7d73('0xe'),_0x3252fc,_0x7d73('0xf'));logger['debug'](_0x7d73('0x10'),_0x3252fc,_0x7d73('0xf'),JSON[_0x7d73('0x11')](_0x2c65ba));if(_0x2c65ba[_0x7d73('0x12')]){if(_0x2c65ba['error'][_0x7d73('0x13')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x3252fc,_0x2c65ba[_0x7d73('0x12')][_0x7d73('0x14')]);return _0x589ee7(_0x2c65ba[_0x7d73('0x12')]['message']);}logger[_0x7d73('0x12')](_0x7d73('0xe'),_0x3252fc,_0x2c65ba[_0x7d73('0x12')][_0x7d73('0x14')]);return _0x1c1d21(_0x2c65ba[_0x7d73('0x12')][_0x7d73('0x14')]);}else{logger[_0x7d73('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x3252fc,_0x7d73('0xf'));_0x1c1d21(_0x2c65ba['result']['message']);}})[_0x7d73('0x16')](function(_0xc62766){logger[_0x7d73('0x12')](_0x7d73('0xe'),_0x3252fc,_0xc62766);_0x589ee7(_0xc62766);});});}exports['GetOpenchannelQueue']=function(_0x58d859){var _0x35b3db=this;return new Promise(function(_0x159a94,_0x80cd9c){return db[_0x7d73('0x17')]['findAll']({'raw':_0x58d859[_0x7d73('0x18')]?_0x58d859[_0x7d73('0x18')][_0x7d73('0x19')]===undefined?!![]:![]:!![],'where':_0x58d859[_0x7d73('0x18')]?_0x58d859[_0x7d73('0x18')][_0x7d73('0x1a')]||null:null,'attributes':_0x58d859[_0x7d73('0x18')]?_0x58d859['options']['attributes']||null:null,'limit':_0x58d859[_0x7d73('0x18')]?_0x58d859['options'][_0x7d73('0x1b')]||null:null,'include':_0x58d859[_0x7d73('0x18')]?_0x58d859[_0x7d73('0x18')][_0x7d73('0x1c')]?_[_0x7d73('0x1d')](_0x58d859[_0x7d73('0x18')]['include'],function(_0x3c14bf){return{'model':db[_0x3c14bf['model']],'as':_0x3c14bf['as'],'attributes':_0x3c14bf['attributes'],'include':_0x3c14bf[_0x7d73('0x1c')]?_['map'](_0x3c14bf[_0x7d73('0x1c')],function(_0xe43c38){return{'model':db[_0xe43c38[_0x7d73('0x1e')]],'as':_0xe43c38['as'],'attributes':_0xe43c38[_0x7d73('0x1f')],'include':_0xe43c38['include']?_[_0x7d73('0x1d')](_0xe43c38['include'],function(_0x4e37b2){return{'model':db[_0x4e37b2[_0x7d73('0x1e')]],'as':_0x4e37b2['as'],'attributes':_0x4e37b2[_0x7d73('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7d73('0xd')](function(_0xe233e8){logger[_0x7d73('0x15')](_0x7d73('0x20'),_0x58d859);logger[_0x7d73('0x21')](_0x7d73('0x20'),_0x58d859,JSON[_0x7d73('0x11')](_0xe233e8));_0x159a94(_0xe233e8);})[_0x7d73('0x16')](function(_0x32757a){logger[_0x7d73('0x12')](_0x7d73('0x20'),_0x32757a[_0x7d73('0x14')],_0x58d859);_0x80cd9c(_0x35b3db['error'](0x1f4,_0x32757a[_0x7d73('0x14')]));});});};exports['ShowOpenchannelQueue']=function(_0x141fb5){var _0xa19cca=this;return new Promise(function(_0x43e707,_0x21a8ce){return db[_0x7d73('0x17')][_0x7d73('0x22')]({'raw':_0x141fb5['options']?_0x141fb5[_0x7d73('0x18')][_0x7d73('0x19')]===undefined?!![]:![]:!![],'where':_0x141fb5[_0x7d73('0x18')]?_0x141fb5[_0x7d73('0x18')]['where']||null:null,'attributes':_0x141fb5[_0x7d73('0x18')]?_0x141fb5['options'][_0x7d73('0x1f')]||null:null,'include':_0x141fb5[_0x7d73('0x18')]?_0x141fb5[_0x7d73('0x18')][_0x7d73('0x1c')]?_[_0x7d73('0x1d')](_0x141fb5[_0x7d73('0x18')]['include'],function(_0x32e5a9){return{'model':db[_0x32e5a9[_0x7d73('0x1e')]],'as':_0x32e5a9['as'],'attributes':_0x32e5a9[_0x7d73('0x1f')],'include':_0x32e5a9['include']?_[_0x7d73('0x1d')](_0x32e5a9[_0x7d73('0x1c')],function(_0x1c0364){return{'model':db[_0x1c0364['model']],'as':_0x1c0364['as'],'attributes':_0x1c0364[_0x7d73('0x1f')],'include':_0x1c0364[_0x7d73('0x1c')]?_[_0x7d73('0x1d')](_0x1c0364[_0x7d73('0x1c')],function(_0x5907b6){return{'model':db[_0x5907b6['model']],'as':_0x5907b6['as'],'attributes':_0x5907b6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x324ecd){logger[_0x7d73('0x15')](_0x7d73('0x23'),_0x141fb5);logger[_0x7d73('0x21')](_0x7d73('0x23'),_0x141fb5,JSON[_0x7d73('0x11')](_0x324ecd));_0x43e707(_0x324ecd);})[_0x7d73('0x16')](function(_0x11935e){logger['error'](_0x7d73('0x23'),_0x11935e[_0x7d73('0x14')],_0x141fb5);_0x21a8ce(_0xa19cca[_0x7d73('0x12')](0x1f4,_0x11935e[_0x7d73('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 6c4a0f5..a5ed9cf 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 _0xa9e0=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var OpenchannelQueueEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){OpenchannelQueueEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);OpenchannelQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var OpenchannelQueueEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){OpenchannelQueueEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);OpenchannelQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 932af52..d8e8a8e 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 _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 _0xb10b=['../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2ea174,_0xb3181){var _0x5987c7=function(_0x3f7c44){while(--_0x3f7c44){_0x2ea174['push'](_0x2ea174['shift']());}};_0x5987c7(++_0xb3181);}(_0xb10b,0x12a));var _0xbb10=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0xb10b[_0xf55e73];return _0x116b99;};'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/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ea3824a..db99939 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 _0x9092=['DATE','moment','sequelize','exports','STRING'];(function(_0x5c4045,_0x464862){var _0x76225b=function(_0x16684b){while(--_0x16684b){_0x5c4045['push'](_0x5c4045['shift']());}};_0x76225b(++_0x464862);}(_0x9092,0xe2));var _0x2909=function(_0x56defa,_0x2f6f9b){_0x56defa=_0x56defa-0x0;var _0x4af572=_0x9092[_0x56defa];return _0x4af572;};'use strict';var moment=require(_0x2909('0x0'));var Sequelize=require(_0x2909('0x1'));module[_0x2909('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2909('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2909('0x4')]},'acceptAt':{'type':Sequelize[_0x2909('0x4')]},'exitAt':{'type':Sequelize[_0x2909('0x4')]},'reason':{'type':Sequelize[_0x2909('0x3')]}}; \ No newline at end of file +var _0x299d=['sequelize','exports','STRING','DATE','moment'];(function(_0x4e2c5b,_0x55cb19){var _0x545264=function(_0x550b40){while(--_0x550b40){_0x4e2c5b['push'](_0x4e2c5b['shift']());}};_0x545264(++_0x55cb19);}(_0x299d,0x108));var _0xd299=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x299d[_0x15bc81];return _0x59440e;};'use strict';var moment=require(_0xd299('0x0'));var Sequelize=require(_0xd299('0x1'));module[_0xd299('0x2')]={'uniqueid':{'type':Sequelize[_0xd299('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd299('0x3')]},'joinAt':{'type':Sequelize[_0xd299('0x4')]},'leaveAt':{'type':Sequelize[_0xd299('0x4')]},'acceptAt':{'type':Sequelize[_0xd299('0x4')]},'exitAt':{'type':Sequelize[_0xd299('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 2e4c1b7..720a15c 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 _0xaab3=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','map','VIRTUAL','field','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/environment','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','send','index','OpenchannelQueueReport','model','query','filters'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xaab3,0x12d));var _0x3aab=function(_0x4cea96,_0x2798ff){_0x4cea96=_0x4cea96-0x0;var _0x244c62=_0xaab3[_0x4cea96];return _0x244c62;};'use strict';var pdf=require(_0x3aab('0x0'));var emlformat=require(_0x3aab('0x1'));var rimraf=require(_0x3aab('0x2'));var zipdir=require(_0x3aab('0x3'));var jsonpatch=require(_0x3aab('0x4'));var rp=require('request-promise');var moment=require(_0x3aab('0x5'));var BPromise=require(_0x3aab('0x6'));var Mustache=require(_0x3aab('0x7'));var util=require(_0x3aab('0x8'));var path=require(_0x3aab('0x9'));var sox=require(_0x3aab('0xa'));var csv=require(_0x3aab('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3aab('0xc'));var squel=require('squel');var crypto=require(_0x3aab('0xd'));var jsforce=require(_0x3aab('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3aab('0xb'));var querystring=require(_0x3aab('0xf'));var Papa=require(_0x3aab('0x10'));var authService=require(_0x3aab('0x11'));var hardwareService=require(_0x3aab('0x12'));var Redis=require(_0x3aab('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x3aab('0x14'))(_0x3aab('0x15'));var utils=require('../../config/utils');var config=require(_0x3aab('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28042e,_0x379b93){_0x379b93=_0x379b93||0xcc;return function(_0x19e14d){if(_0x19e14d){return _0x28042e['sendStatus'](_0x379b93);}return _0x28042e['status'](_0x379b93)['end']();};}function respondWithResult(_0x8d648e,_0x18d4cb){_0x18d4cb=_0x18d4cb||0xc8;return function(_0x3d73c3){if(_0x3d73c3){return _0x8d648e[_0x3aab('0x17')](_0x18d4cb)['json'](_0x3d73c3);}};}function respondWithFilteredResult(_0x2ca408,_0x5a0b3b){return function(_0x443e9a){if(_0x443e9a){var _0x385149=_0x443e9a[_0x3aab('0x18')],_0x47e97b=_0x5a0b3b[_0x3aab('0x19')],_0x500eff=_0x5a0b3b[_0x3aab('0x19')]+_0x5a0b3b[_0x3aab('0x1a')],_0x2ea8b8;if(_0x500eff>=_0x385149){_0x500eff=_0x385149;_0x2ea8b8=0xc8;}else{_0x2ea8b8=0xce;}_0x2ca408[_0x3aab('0x17')](_0x2ea8b8);return _0x2ca408[_0x3aab('0x1b')](_0x3aab('0x1c'),_0x47e97b+'-'+_0x500eff+'/'+_0x385149)[_0x3aab('0x1d')](_0x443e9a);}return null;};}function patchUpdates(_0x357767){return function(_0x2e9119){try{jsonpatch[_0x3aab('0x1e')](_0x2e9119,_0x357767,!![]);}catch(_0x3d4106){return BPromise['reject'](_0x3d4106);}return _0x2e9119[_0x3aab('0x1f')]();};}function saveUpdates(_0x50b7e3,_0x10ab0b){return function(_0x4b1d86){if(_0x4b1d86){return _0x4b1d86[_0x3aab('0x20')](_0x50b7e3)[_0x3aab('0x21')](function(_0x3945fc){return _0x3945fc;});}return null;};}function removeEntity(_0x51726b,_0x53c725){return function(_0x384682){if(_0x384682){return _0x384682[_0x3aab('0x22')]()[_0x3aab('0x21')](function(){_0x51726b[_0x3aab('0x17')](0xcc)[_0x3aab('0x23')]();});}};}function handleEntityNotFound(_0x509081,_0x3b6fb5){return function(_0x391837){if(!_0x391837){_0x509081['sendStatus'](0x194);}return _0x391837;};}function handleError(_0x41cc67,_0x50bcd2){_0x50bcd2=_0x50bcd2||0x1f4;return function(_0x146854){logger[_0x3aab('0x24')](_0x146854[_0x3aab('0x25')]);if(_0x146854['name']){delete _0x146854['name'];}_0x41cc67[_0x3aab('0x17')](_0x50bcd2)[_0x3aab('0x26')](_0x146854);};}exports[_0x3aab('0x27')]=function(_0x1c5ed5,_0x250076){var _0x58311c={},_0x3f4fc8={},_0xf741d7={'count':0x0,'rows':[]};var _0x52f2f1=db[_0x3aab('0x28')]['rawAttributes'];_0x3f4fc8[_0x3aab('0x29')]=_['keys'](_0x52f2f1);_0x3f4fc8[_0x3aab('0x2a')]=_['keys'](_0x1c5ed5[_0x3aab('0x2a')]);_0x3f4fc8[_0x3aab('0x2b')]=_[_0x3aab('0x2c')](_0x3f4fc8['model'],_0x3f4fc8[_0x3aab('0x2a')]);_0x58311c[_0x3aab('0x2d')]=_[_0x3aab('0x2c')](_0x3f4fc8[_0x3aab('0x29')],qs['fields'](_0x1c5ed5[_0x3aab('0x2a')][_0x3aab('0x2e')]));_0x58311c[_0x3aab('0x2d')]=_0x58311c['attributes'][_0x3aab('0x2f')]?_0x58311c[_0x3aab('0x2d')]:_0x3f4fc8[_0x3aab('0x29')];if(!_0x1c5ed5[_0x3aab('0x2a')][_0x3aab('0x30')]('nolimit')){_0x58311c[_0x3aab('0x1a')]=qs['limit'](_0x1c5ed5[_0x3aab('0x2a')][_0x3aab('0x1a')]);_0x58311c['offset']=qs[_0x3aab('0x19')](_0x1c5ed5[_0x3aab('0x2a')][_0x3aab('0x19')]);}_0x58311c[_0x3aab('0x31')]=qs[_0x3aab('0x32')](_0x1c5ed5[_0x3aab('0x2a')][_0x3aab('0x32')]);_0x58311c[_0x3aab('0x33')]=qs['filters'](_['pick'](_0x1c5ed5[_0x3aab('0x2a')],_0x3f4fc8[_0x3aab('0x2b')]));if(_0x1c5ed5['query']['filter']){_0x58311c['where']=_['merge'](_0x58311c['where'],{'$or':_[_0x3aab('0x34')](_0x52f2f1,function(_0x1c6a40){if(_0x1c6a40['type']['key']!==_0x3aab('0x35')){var _0x3a4bac={};_0x3a4bac[_0x1c6a40[_0x3aab('0x36')]]={'$like':'%'+_0x1c5ed5['query'][_0x3aab('0x37')]+'%'};return _0x3a4bac;}})});}_0x58311c=_['merge']({},_0x58311c,_0x1c5ed5['options']);var _0x2040ca={'where':_0x58311c[_0x3aab('0x33')]};return db[_0x3aab('0x28')][_0x3aab('0x18')](_0x2040ca)[_0x3aab('0x21')](function(_0x1f3ff6){_0xf741d7[_0x3aab('0x18')]=_0x1f3ff6;if(_0x1c5ed5[_0x3aab('0x2a')][_0x3aab('0x38')]){_0x58311c[_0x3aab('0x39')]=[{'all':!![]}];}return db[_0x3aab('0x28')][_0x3aab('0x3a')](_0x58311c);})['then'](function(_0x768c05){_0xf741d7[_0x3aab('0x3b')]=_0x768c05;return _0xf741d7;})[_0x3aab('0x21')](respondWithFilteredResult(_0x250076,_0x58311c))[_0x3aab('0x3c')](handleError(_0x250076,null));};exports[_0x3aab('0x3d')]=function(_0x118e79,_0x3fab20){var _0x1ded23={'raw':!![],'where':{'id':_0x118e79[_0x3aab('0x3e')]['id']}},_0x343b48={};_0x343b48[_0x3aab('0x29')]=_['keys'](db[_0x3aab('0x28')]['rawAttributes']);_0x343b48[_0x3aab('0x2a')]=_[_0x3aab('0x3f')](_0x118e79[_0x3aab('0x2a')]);_0x343b48[_0x3aab('0x2b')]=_[_0x3aab('0x2c')](_0x343b48[_0x3aab('0x29')],_0x343b48[_0x3aab('0x2a')]);_0x1ded23['attributes']=_[_0x3aab('0x2c')](_0x343b48[_0x3aab('0x29')],qs[_0x3aab('0x2e')](_0x118e79[_0x3aab('0x2a')]['fields']));_0x1ded23['attributes']=_0x1ded23['attributes'][_0x3aab('0x2f')]?_0x1ded23[_0x3aab('0x2d')]:_0x343b48[_0x3aab('0x29')];if(_0x118e79[_0x3aab('0x2a')][_0x3aab('0x38')]){_0x1ded23['include']=[{'all':!![]}];}_0x1ded23=_['merge']({},_0x1ded23,_0x118e79[_0x3aab('0x40')]);return db['OpenchannelQueueReport'][_0x3aab('0x41')](_0x1ded23)[_0x3aab('0x21')](handleEntityNotFound(_0x3fab20,null))['then'](respondWithResult(_0x3fab20,null))[_0x3aab('0x3c')](handleError(_0x3fab20,null));};exports[_0x3aab('0x42')]=function(_0x46ad3e,_0x5ae4d6){return db[_0x3aab('0x28')][_0x3aab('0x42')](_0x46ad3e[_0x3aab('0x43')],{})[_0x3aab('0x21')](respondWithResult(_0x5ae4d6,0xc9))[_0x3aab('0x3c')](handleError(_0x5ae4d6,null));};exports[_0x3aab('0x20')]=function(_0x3f8cf9,_0x32f53f){if(_0x3f8cf9[_0x3aab('0x43')]['id']){delete _0x3f8cf9[_0x3aab('0x43')]['id'];}return db[_0x3aab('0x28')][_0x3aab('0x41')]({'where':{'id':_0x3f8cf9['params']['id']}})[_0x3aab('0x21')](handleEntityNotFound(_0x32f53f,null))[_0x3aab('0x21')](saveUpdates(_0x3f8cf9[_0x3aab('0x43')],null))[_0x3aab('0x21')](respondWithResult(_0x32f53f,null))[_0x3aab('0x3c')](handleError(_0x32f53f,null));};exports[_0x3aab('0x22')]=function(_0x276d2f,_0x3f4459){return db[_0x3aab('0x28')][_0x3aab('0x41')]({'where':{'id':_0x276d2f[_0x3aab('0x3e')]['id']}})[_0x3aab('0x21')](handleEntityNotFound(_0x3f4459,null))[_0x3aab('0x21')](removeEntity(_0x3f4459,null))[_0x3aab('0x3c')](handleError(_0x3f4459,null));};exports['describe']=function(_0x24b8e4,_0x13999d){return db['OpenchannelQueueReport'][_0x3aab('0x44')]()[_0x3aab('0x21')](respondWithResult(_0x13999d,null))[_0x3aab('0x3c')](handleError(_0x13999d,null));}; \ No newline at end of file +var _0x818a=['mustache','util','path','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','OpenchannelQueueReport','rawAttributes','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','field','includeAll','include','findAll','rows','catch','params','keys','options','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x487b37,_0x1c6aa0){var _0x44cdaa=function(_0x34a41b){while(--_0x34a41b){_0x487b37['push'](_0x487b37['shift']());}};_0x44cdaa(++_0x1c6aa0);}(_0x818a,0x15e));var _0xa818=function(_0x53f37f,_0xfb0b18){_0x53f37f=_0x53f37f-0x0;var _0x2fe5f8=_0x818a[_0x53f37f];return _0x2fe5f8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa818('0x0'));var rimraf=require(_0xa818('0x1'));var zipdir=require(_0xa818('0x2'));var jsonpatch=require(_0xa818('0x3'));var rp=require('request-promise');var moment=require(_0xa818('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa818('0x5'));var util=require(_0xa818('0x6'));var path=require(_0xa818('0x7'));var sox=require('sox');var csv=require(_0xa818('0x8'));var ejs=require(_0xa818('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa818('0xa'));var crypto=require(_0xa818('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa818('0xc'));var toCsv=require(_0xa818('0x8'));var querystring=require('querystring');var Papa=require(_0xa818('0xd'));var authService=require(_0xa818('0xe'));var hardwareService=require(_0xa818('0xf'));var Redis=require(_0xa818('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xa818('0x11'))(_0xa818('0x12'));var utils=require('../../config/utils');var config=require(_0xa818('0x13'));var db=require(_0xa818('0x14'))['db'];function respondWithStatusCode(_0x3339f0,_0x57592b){_0x57592b=_0x57592b||0xcc;return function(_0x4c1feb){if(_0x4c1feb){return _0x3339f0[_0xa818('0x15')](_0x57592b);}return _0x3339f0[_0xa818('0x16')](_0x57592b)[_0xa818('0x17')]();};}function respondWithResult(_0x10c513,_0x277c7f){_0x277c7f=_0x277c7f||0xc8;return function(_0x54c794){if(_0x54c794){return _0x10c513[_0xa818('0x16')](_0x277c7f)[_0xa818('0x18')](_0x54c794);}};}function respondWithFilteredResult(_0x23a5d8,_0x595c0d){return function(_0x7bde4b){if(_0x7bde4b){var _0x400a49=_0x7bde4b[_0xa818('0x19')],_0x2a0612=_0x595c0d[_0xa818('0x1a')],_0x25a8ed=_0x595c0d['offset']+_0x595c0d[_0xa818('0x1b')],_0x4f396c;if(_0x25a8ed>=_0x400a49){_0x25a8ed=_0x400a49;_0x4f396c=0xc8;}else{_0x4f396c=0xce;}_0x23a5d8[_0xa818('0x16')](_0x4f396c);return _0x23a5d8[_0xa818('0x1c')](_0xa818('0x1d'),_0x2a0612+'-'+_0x25a8ed+'/'+_0x400a49)[_0xa818('0x18')](_0x7bde4b);}return null;};}function patchUpdates(_0x266149){return function(_0x130009){try{jsonpatch[_0xa818('0x1e')](_0x130009,_0x266149,!![]);}catch(_0x5dce92){return BPromise[_0xa818('0x1f')](_0x5dce92);}return _0x130009[_0xa818('0x20')]();};}function saveUpdates(_0x30dcb6,_0x488bfc){return function(_0x5ed143){if(_0x5ed143){return _0x5ed143[_0xa818('0x21')](_0x30dcb6)[_0xa818('0x22')](function(_0x397259){return _0x397259;});}return null;};}function removeEntity(_0x34b2fa,_0x1ad88a){return function(_0x4a31ec){if(_0x4a31ec){return _0x4a31ec[_0xa818('0x23')]()[_0xa818('0x22')](function(){_0x34b2fa['status'](0xcc)[_0xa818('0x17')]();});}};}function handleEntityNotFound(_0x3df1fb,_0x3b8836){return function(_0x25edae){if(!_0x25edae){_0x3df1fb['sendStatus'](0x194);}return _0x25edae;};}function handleError(_0x4feb00,_0x33ec89){_0x33ec89=_0x33ec89||0x1f4;return function(_0x3d2469){logger[_0xa818('0x24')](_0x3d2469[_0xa818('0x25')]);if(_0x3d2469[_0xa818('0x26')]){delete _0x3d2469[_0xa818('0x26')];}_0x4feb00['status'](_0x33ec89)[_0xa818('0x27')](_0x3d2469);};}exports['index']=function(_0x52d5f0,_0x2fc522){var _0x1f4a6a={},_0x23cd07={},_0x3937bc={'count':0x0,'rows':[]};var _0x40c763=db[_0xa818('0x28')][_0xa818('0x29')];_0x23cd07['model']=_['keys'](_0x40c763);_0x23cd07[_0xa818('0x2a')]=_['keys'](_0x52d5f0[_0xa818('0x2a')]);_0x23cd07['filters']=_[_0xa818('0x2b')](_0x23cd07['model'],_0x23cd07[_0xa818('0x2a')]);_0x1f4a6a['attributes']=_[_0xa818('0x2b')](_0x23cd07[_0xa818('0x2c')],qs[_0xa818('0x2d')](_0x52d5f0[_0xa818('0x2a')][_0xa818('0x2d')]));_0x1f4a6a[_0xa818('0x2e')]=_0x1f4a6a[_0xa818('0x2e')][_0xa818('0x2f')]?_0x1f4a6a['attributes']:_0x23cd07[_0xa818('0x2c')];if(!_0x52d5f0[_0xa818('0x2a')][_0xa818('0x30')]('nolimit')){_0x1f4a6a[_0xa818('0x1b')]=qs[_0xa818('0x1b')](_0x52d5f0[_0xa818('0x2a')]['limit']);_0x1f4a6a[_0xa818('0x1a')]=qs['offset'](_0x52d5f0[_0xa818('0x2a')][_0xa818('0x1a')]);}_0x1f4a6a[_0xa818('0x31')]=qs['sort'](_0x52d5f0[_0xa818('0x2a')][_0xa818('0x32')]);_0x1f4a6a[_0xa818('0x33')]=qs[_0xa818('0x34')](_[_0xa818('0x35')](_0x52d5f0[_0xa818('0x2a')],_0x23cd07[_0xa818('0x34')]));if(_0x52d5f0[_0xa818('0x2a')][_0xa818('0x36')]){_0x1f4a6a[_0xa818('0x33')]=_[_0xa818('0x37')](_0x1f4a6a[_0xa818('0x33')],{'$or':_[_0xa818('0x38')](_0x40c763,function(_0x5375f5){if(_0x5375f5[_0xa818('0x39')]['key']!==_0xa818('0x3a')){var _0xa662b1={};_0xa662b1[_0x5375f5[_0xa818('0x3b')]]={'$like':'%'+_0x52d5f0[_0xa818('0x2a')][_0xa818('0x36')]+'%'};return _0xa662b1;}})});}_0x1f4a6a=_[_0xa818('0x37')]({},_0x1f4a6a,_0x52d5f0['options']);var _0x455d16={'where':_0x1f4a6a[_0xa818('0x33')]};return db[_0xa818('0x28')][_0xa818('0x19')](_0x455d16)['then'](function(_0x18ddc6){_0x3937bc[_0xa818('0x19')]=_0x18ddc6;if(_0x52d5f0[_0xa818('0x2a')][_0xa818('0x3c')]){_0x1f4a6a[_0xa818('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xa818('0x3e')](_0x1f4a6a);})['then'](function(_0x21e635){_0x3937bc[_0xa818('0x3f')]=_0x21e635;return _0x3937bc;})[_0xa818('0x22')](respondWithFilteredResult(_0x2fc522,_0x1f4a6a))[_0xa818('0x40')](handleError(_0x2fc522,null));};exports['show']=function(_0x22f4c5,_0x187144){var _0x45127f={'raw':!![],'where':{'id':_0x22f4c5[_0xa818('0x41')]['id']}},_0x827b14={};_0x827b14[_0xa818('0x2c')]=_['keys'](db[_0xa818('0x28')][_0xa818('0x29')]);_0x827b14[_0xa818('0x2a')]=_[_0xa818('0x42')](_0x22f4c5[_0xa818('0x2a')]);_0x827b14[_0xa818('0x34')]=_[_0xa818('0x2b')](_0x827b14[_0xa818('0x2c')],_0x827b14['query']);_0x45127f[_0xa818('0x2e')]=_[_0xa818('0x2b')](_0x827b14['model'],qs['fields'](_0x22f4c5['query'][_0xa818('0x2d')]));_0x45127f[_0xa818('0x2e')]=_0x45127f[_0xa818('0x2e')][_0xa818('0x2f')]?_0x45127f[_0xa818('0x2e')]:_0x827b14[_0xa818('0x2c')];if(_0x22f4c5[_0xa818('0x2a')][_0xa818('0x3c')]){_0x45127f[_0xa818('0x3d')]=[{'all':!![]}];}_0x45127f=_[_0xa818('0x37')]({},_0x45127f,_0x22f4c5[_0xa818('0x43')]);return db[_0xa818('0x28')]['find'](_0x45127f)[_0xa818('0x22')](handleEntityNotFound(_0x187144,null))[_0xa818('0x22')](respondWithResult(_0x187144,null))[_0xa818('0x40')](handleError(_0x187144,null));};exports[_0xa818('0x44')]=function(_0xc2cd92,_0x18adbb){return db[_0xa818('0x28')][_0xa818('0x44')](_0xc2cd92[_0xa818('0x45')],{})[_0xa818('0x22')](respondWithResult(_0x18adbb,0xc9))['catch'](handleError(_0x18adbb,null));};exports[_0xa818('0x21')]=function(_0x213e85,_0x2a6bc0){if(_0x213e85['body']['id']){delete _0x213e85[_0xa818('0x45')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x213e85[_0xa818('0x41')]['id']}})[_0xa818('0x22')](handleEntityNotFound(_0x2a6bc0,null))[_0xa818('0x22')](saveUpdates(_0x213e85[_0xa818('0x45')],null))[_0xa818('0x22')](respondWithResult(_0x2a6bc0,null))[_0xa818('0x40')](handleError(_0x2a6bc0,null));};exports[_0xa818('0x23')]=function(_0x2fa84e,_0xe6207f){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x2fa84e[_0xa818('0x41')]['id']}})[_0xa818('0x22')](handleEntityNotFound(_0xe6207f,null))[_0xa818('0x22')](removeEntity(_0xe6207f,null))[_0xa818('0x40')](handleError(_0xe6207f,null));};exports[_0xa818('0x46')]=function(_0x5bd747,_0x239938){return db[_0xa818('0x28')]['describe']()['then'](respondWithResult(_0x239938,null))[_0xa818('0x40')](handleError(_0x239938,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 320c86d..e9c382f 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 _0x8ad5=['../../config/logger','api','request-promise','./openchannelQueueReport.attributes','exports','define','uniqueid','lodash','util'];(function(_0x18c52c,_0x4cddb3){var _0x120c09=function(_0x450d1c){while(--_0x450d1c){_0x18c52c['push'](_0x18c52c['shift']());}};_0x120c09(++_0x4cddb3);}(_0x8ad5,0xf1));var _0x58ad=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x8ad5[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x58ad('0x0'));var util=require(_0x58ad('0x1'));var logger=require(_0x58ad('0x2'))(_0x58ad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x58ad('0x4'));var attributes=require(_0x58ad('0x5'));module[_0x58ad('0x6')]=function(_0x22aba9,_0x13711c){return _0x22aba9[_0x58ad('0x7')]('OpenchannelQueueReport',attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x58ad('0x8'),'fields':[_0x58ad('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c12=['report_openchannel_queue','uniqueid','util','../../config/logger','moment','bluebird','request-promise','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x2f485e,_0x1ce4ff){var _0x1ca654=function(_0x1fee68){while(--_0x1fee68){_0x2f485e['push'](_0x2f485e['shift']());}};_0x1ca654(++_0x1ce4ff);}(_0x5c12,0x188));var _0x25c1=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x5c12[_0x502953];return _0x2fa32d;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var logger=require(_0x25c1('0x1'))('api');var moment=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var rp=require(_0x25c1('0x4'));var attributes=require(_0x25c1('0x5'));module[_0x25c1('0x6')]=function(_0x21ec20,_0x3f0f35){return _0x21ec20['define'](_0x25c1('0x7'),attributes,{'tableName':_0x25c1('0x8'),'paranoid':![],'indexes':[{'name':_0x25c1('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 42edb78..0398028 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 _0x1aa3=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateOpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','client','then','info'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0x1aa3,0x1cb));var _0x31aa=function(_0x4fb955,_0x481977){_0x4fb955=_0x4fb955-0x0;var _0x4f9797=_0x1aa3[_0x4fb955];return _0x4f9797;};'use strict';var _=require(_0x31aa('0x0'));var util=require(_0x31aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x31aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x31aa('0x3'));var logger=require(_0x31aa('0x4'))('rpc');var config=require(_0x31aa('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x31aa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38fc76,_0xc1687b,_0x10c7ee){return new BPromise(function(_0x23b783,_0x4d3991){return client['request'](_0x38fc76,_0x10c7ee)[_0x31aa('0x7')](function(_0x254ea4){logger[_0x31aa('0x8')](_0x31aa('0x9'),_0xc1687b,_0x31aa('0xa'));logger[_0x31aa('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xc1687b,'request\x20sent',JSON[_0x31aa('0xc')](_0x254ea4));if(_0x254ea4[_0x31aa('0xd')]){if(_0x254ea4[_0x31aa('0xd')][_0x31aa('0xe')]===0x1f4){logger[_0x31aa('0xd')](_0x31aa('0x9'),_0xc1687b,_0x254ea4[_0x31aa('0xd')][_0x31aa('0xf')]);return _0x4d3991(_0x254ea4[_0x31aa('0xd')][_0x31aa('0xf')]);}logger[_0x31aa('0xd')](_0x31aa('0x9'),_0xc1687b,_0x254ea4[_0x31aa('0xd')]['message']);return _0x23b783(_0x254ea4[_0x31aa('0xd')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0xc1687b,_0x31aa('0xa'));_0x23b783(_0x254ea4['result'][_0x31aa('0xf')]);}})[_0x31aa('0x10')](function(_0x5bfd9a){logger[_0x31aa('0xd')](_0x31aa('0x9'),_0xc1687b,_0x5bfd9a);_0x4d3991(_0x5bfd9a);});});}exports[_0x31aa('0x11')]=function(_0xa2939){var _0x553963=this;return new Promise(function(_0x29fa97,_0x45b6a9){return db['OpenchannelQueueReport']['create'](_0xa2939[_0x31aa('0x12')],{'raw':_0xa2939[_0x31aa('0x13')]?_0xa2939[_0x31aa('0x13')][_0x31aa('0x14')]===undefined?!![]:![]:!![]})[_0x31aa('0x7')](function(_0x3f85c2){logger[_0x31aa('0x8')](_0x31aa('0x11'),_0xa2939);logger[_0x31aa('0xb')]('CreateOpenchannelQueueReport',_0xa2939,JSON[_0x31aa('0xc')](_0x3f85c2));_0x29fa97(_0x3f85c2);})[_0x31aa('0x10')](function(_0x2a6824){logger[_0x31aa('0xd')](_0x31aa('0x11'),_0x2a6824[_0x31aa('0xf')],_0xa2939);_0x45b6a9(_0x553963[_0x31aa('0xd')](0x1f4,_0x2a6824[_0x31aa('0xf')]));});});};exports[_0x31aa('0x15')]=function(_0x14ea12){var _0x744b80=this;return new Promise(function(_0x471396,_0x23d36c){return db[_0x31aa('0x16')][_0x31aa('0x17')](_0x14ea12[_0x31aa('0x12')],{'raw':_0x14ea12[_0x31aa('0x13')]?_0x14ea12['options'][_0x31aa('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14ea12['options']?_0x14ea12['options'][_0x31aa('0x18')]||null:null,'attributes':_0x14ea12[_0x31aa('0x13')]?_0x14ea12[_0x31aa('0x13')][_0x31aa('0x19')]||null:null,'limit':_0x14ea12[_0x31aa('0x13')]?_0x14ea12['options']['limit']||null:null})['then'](function(_0x127ccc){logger[_0x31aa('0x8')](_0x31aa('0x15'),_0x14ea12);logger[_0x31aa('0xb')](_0x31aa('0x15'),_0x14ea12,JSON[_0x31aa('0xc')](_0x127ccc));_0x471396(_0x127ccc);})[_0x31aa('0x10')](function(_0x2de879){logger[_0x31aa('0xd')](_0x31aa('0x15'),_0x2de879[_0x31aa('0xf')],_0x14ea12);_0x23d36c(_0x744b80[_0x31aa('0xd')](0x1f4,_0x2de879[_0x31aa('0xf')]));});});}; \ No newline at end of file +var _0x57ae=['then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','update','attributes','UpdateOpenchannelQueueReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x494e9e,_0x5bf4c9){var _0x5aca28=function(_0x3259bd){while(--_0x3259bd){_0x494e9e['push'](_0x494e9e['shift']());}};_0x5aca28(++_0x5bf4c9);}(_0x57ae,0x90));var _0xe57a=function(_0x53a983,_0x49e57a){_0x53a983=_0x53a983-0x0;var _0x25b457=_0x57ae[_0x53a983];return _0x25b457;};'use strict';var _=require('lodash');var util=require(_0xe57a('0x0'));var moment=require(_0xe57a('0x1'));var BPromise=require(_0xe57a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe57a('0x3'));var db=require(_0xe57a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe57a('0x5'))(_0xe57a('0x6'));var config=require(_0xe57a('0x7'));var jayson=require(_0xe57a('0x8'));var client=jayson['client'][_0xe57a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1aded9,_0x644af2,_0x4d6097){return new BPromise(function(_0x439937,_0x445906){return client[_0xe57a('0xa')](_0x1aded9,_0x4d6097)[_0xe57a('0xb')](function(_0x1b19f4){logger[_0xe57a('0xc')](_0xe57a('0xd'),_0x644af2,_0xe57a('0xe'));logger[_0xe57a('0xf')](_0xe57a('0x10'),_0x644af2,_0xe57a('0xe'),JSON[_0xe57a('0x11')](_0x1b19f4));if(_0x1b19f4[_0xe57a('0x12')]){if(_0x1b19f4[_0xe57a('0x12')]['code']===0x1f4){logger[_0xe57a('0x12')](_0xe57a('0xd'),_0x644af2,_0x1b19f4[_0xe57a('0x12')][_0xe57a('0x13')]);return _0x445906(_0x1b19f4[_0xe57a('0x12')]['message']);}logger[_0xe57a('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x644af2,_0x1b19f4[_0xe57a('0x12')]['message']);return _0x439937(_0x1b19f4[_0xe57a('0x12')][_0xe57a('0x13')]);}else{logger[_0xe57a('0xc')](_0xe57a('0xd'),_0x644af2,'request\x20sent');_0x439937(_0x1b19f4[_0xe57a('0x14')][_0xe57a('0x13')]);}})[_0xe57a('0x15')](function(_0x6d6491){logger[_0xe57a('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x644af2,_0x6d6491);_0x445906(_0x6d6491);});});}exports['CreateOpenchannelQueueReport']=function(_0x166b12){var _0x512c3e=this;return new Promise(function(_0x5d773f,_0x1a5f67){return db[_0xe57a('0x16')][_0xe57a('0x17')](_0x166b12[_0xe57a('0x18')],{'raw':_0x166b12[_0xe57a('0x19')]?_0x166b12[_0xe57a('0x19')][_0xe57a('0x1a')]===undefined?!![]:![]:!![]})[_0xe57a('0xb')](function(_0x5b32d5){logger[_0xe57a('0xc')](_0xe57a('0x1b'),_0x166b12);logger[_0xe57a('0xf')](_0xe57a('0x1b'),_0x166b12,JSON[_0xe57a('0x11')](_0x5b32d5));_0x5d773f(_0x5b32d5);})['catch'](function(_0xc91bb7){logger[_0xe57a('0x12')](_0xe57a('0x1b'),_0xc91bb7[_0xe57a('0x13')],_0x166b12);_0x1a5f67(_0x512c3e[_0xe57a('0x12')](0x1f4,_0xc91bb7[_0xe57a('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x5ce979){var _0x3902a1=this;return new Promise(function(_0x2ffb4a,_0x25f39b){return db[_0xe57a('0x16')][_0xe57a('0x1c')](_0x5ce979[_0xe57a('0x18')],{'raw':_0x5ce979['options']?_0x5ce979['options'][_0xe57a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ce979['options']?_0x5ce979[_0xe57a('0x19')]['where']||null:null,'attributes':_0x5ce979[_0xe57a('0x19')]?_0x5ce979['options'][_0xe57a('0x1d')]||null:null,'limit':_0x5ce979['options']?_0x5ce979['options']['limit']||null:null})[_0xe57a('0xb')](function(_0x38f627){logger[_0xe57a('0xc')]('UpdateOpenchannelQueueReport',_0x5ce979);logger[_0xe57a('0xf')](_0xe57a('0x1e'),_0x5ce979,JSON[_0xe57a('0x11')](_0x38f627));_0x2ffb4a(_0x38f627);})['catch'](function(_0x4694ea){logger[_0xe57a('0x12')](_0xe57a('0x1e'),_0x4694ea[_0xe57a('0x13')],_0x5ce979);_0x25f39b(_0x3902a1[_0xe57a('0x12')](0x1f4,_0x4694ea[_0xe57a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 479623e..150ae7c 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 _0x18d8=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x319d63,_0x4dd9bb){var _0x592c1e=function(_0x14192d){while(--_0x14192d){_0x319d63['push'](_0x319d63['shift']());}};_0x592c1e(++_0x4dd9bb);}(_0x18d8,0xe2));var _0x818d=function(_0x31512f,_0x38e1f2){_0x31512f=_0x31512f-0x0;var _0x1fee7e=_0x18d8[_0x31512f];return _0x1fee7e;};'use strict';var multer=require(_0x818d('0x0'));var util=require(_0x818d('0x1'));var path=require(_0x818d('0x2'));var timeout=require(_0x818d('0x3'));var express=require(_0x818d('0x4'));var router=express[_0x818d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x818d('0x6'));var config=require(_0x818d('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x818d('0x8')]('/',auth[_0x818d('0x9')](),controller[_0x818d('0xa')]);router[_0x818d('0x8')](_0x818d('0xb'),auth[_0x818d('0x9')](),controller['describe']);router[_0x818d('0x8')](_0x818d('0xc'),auth[_0x818d('0x9')](),controller[_0x818d('0xd')]);router[_0x818d('0xe')]('/',auth[_0x818d('0x9')](),controller[_0x818d('0xf')]);router[_0x818d('0x10')](_0x818d('0xc'),auth[_0x818d('0x9')](),controller[_0x818d('0x11')]);router[_0x818d('0x12')](_0x818d('0xc'),auth[_0x818d('0x9')](),controller[_0x818d('0x13')]);module[_0x818d('0x14')]=router; \ No newline at end of file +var _0x5ab2=['../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xec3ae2,_0x51873d){var _0x134fa1=function(_0xef5060){while(--_0xef5060){_0xec3ae2['push'](_0xec3ae2['shift']());}};_0x134fa1(++_0x51873d);}(_0x5ab2,0xc0));var _0x25ab=function(_0x343c91,_0x19a2d9){_0x343c91=_0x343c91-0x0;var _0x10c40e=_0x5ab2[_0x343c91];return _0x10c40e;};'use strict';var multer=require(_0x25ab('0x0'));var util=require(_0x25ab('0x1'));var path=require('path');var timeout=require(_0x25ab('0x2'));var express=require('express');var router=express[_0x25ab('0x3')]();var auth=require(_0x25ab('0x4'));var interaction=require(_0x25ab('0x5'));var config=require(_0x25ab('0x6'));var controller=require(_0x25ab('0x7'));router[_0x25ab('0x8')]('/',auth[_0x25ab('0x9')](),controller[_0x25ab('0xa')]);router[_0x25ab('0x8')]('/describe',auth[_0x25ab('0x9')](),controller['describe']);router[_0x25ab('0x8')](_0x25ab('0xb'),auth[_0x25ab('0x9')](),controller[_0x25ab('0xc')]);router[_0x25ab('0xd')]('/',auth[_0x25ab('0x9')](),controller['create']);router[_0x25ab('0xe')](_0x25ab('0xb'),auth[_0x25ab('0x9')](),controller['update']);router[_0x25ab('0xf')](_0x25ab('0xb'),auth[_0x25ab('0x9')](),controller[_0x25ab('0x10')]);module[_0x25ab('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index a6dda70..8ba8629 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 _0x18c7=['ENUM','queue','NOW','moment','sequelize','exports'];(function(_0x3c3741,_0x5dc6d3){var _0x53b3b5=function(_0x53c919){while(--_0x53c919){_0x3c3741['push'](_0x3c3741['shift']());}};_0x53b3b5(++_0x5dc6d3);}(_0x18c7,0x81));var _0x718c=function(_0x5214cc,_0x115e68){_0x5214cc=_0x5214cc-0x0;var _0x28dfa6=_0x18c7[_0x5214cc];return _0x28dfa6;};'use strict';var moment=require(_0x718c('0x0'));var Sequelize=require(_0x718c('0x1'));module[_0x718c('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x718c('0x3')]('account','agent',_0x718c('0x4')),'allowNull':![],'defaultValue':_0x718c('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x718c('0x5')]}}; \ No newline at end of file +var _0xd634=['exports','ENUM','queue','DATE','NOW','sequelize'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xd634,0x1cd));var _0x4d63=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xd634[_0x547456];return _0xc1fd7b;};'use strict';var moment=require('moment');var Sequelize=require(_0x4d63('0x0'));module[_0x4d63('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4d63('0x2')]('account','agent',_0x4d63('0x3')),'allowNull':![],'defaultValue':_0x4d63('0x3')},'transferredAt':{'type':Sequelize[_0x4d63('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x4d63('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 696dc28..53ab4f8 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 _0x2dae=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','error','stack','name','index','OpenchannelTransferReport','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','key','field','filter','includeAll','include','rows','catch','show','params','length','options','find','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x31af59,_0x3e151c){var _0x2f7f95=function(_0x496884){while(--_0x496884){_0x31af59['push'](_0x31af59['shift']());}};_0x2f7f95(++_0x3e151c);}(_0x2dae,0xc3));var _0xe2da=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0x2dae[_0x9edfd5];return _0x330738;};'use strict';var pdf=require(_0xe2da('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe2da('0x1'));var zipdir=require(_0xe2da('0x2'));var jsonpatch=require(_0xe2da('0x3'));var rp=require(_0xe2da('0x4'));var moment=require(_0xe2da('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe2da('0x6'));var util=require(_0xe2da('0x7'));var path=require(_0xe2da('0x8'));var sox=require(_0xe2da('0x9'));var csv=require('to-csv');var ejs=require(_0xe2da('0xa'));var fs=require('fs');var _=require(_0xe2da('0xb'));var squel=require(_0xe2da('0xc'));var crypto=require(_0xe2da('0xd'));var jsforce=require(_0xe2da('0xe'));var deskjs=require(_0xe2da('0xf'));var toCsv=require(_0xe2da('0x10'));var querystring=require(_0xe2da('0x11'));var Papa=require(_0xe2da('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0xe2da('0x13'));var Redis=require(_0xe2da('0x14'));var qs=require(_0xe2da('0x15'));var logger=require(_0xe2da('0x16'))(_0xe2da('0x17'));var utils=require(_0xe2da('0x18'));var config=require(_0xe2da('0x19'));var db=require(_0xe2da('0x1a'))['db'];function respondWithStatusCode(_0x5aab71,_0xb98909){_0xb98909=_0xb98909||0xcc;return function(_0x5200b1){if(_0x5200b1){return _0x5aab71[_0xe2da('0x1b')](_0xb98909);}return _0x5aab71[_0xe2da('0x1c')](_0xb98909)[_0xe2da('0x1d')]();};}function respondWithResult(_0x411b9f,_0xfab73e){_0xfab73e=_0xfab73e||0xc8;return function(_0x5660b5){if(_0x5660b5){return _0x411b9f[_0xe2da('0x1c')](_0xfab73e)['json'](_0x5660b5);}};}function respondWithFilteredResult(_0x236e7a,_0x5e1702){return function(_0x586b27){if(_0x586b27){var _0x403d1c=_0x586b27[_0xe2da('0x1e')],_0x3dfc52=_0x5e1702[_0xe2da('0x1f')],_0x33f919=_0x5e1702[_0xe2da('0x1f')]+_0x5e1702[_0xe2da('0x20')],_0x4dc58b;if(_0x33f919>=_0x403d1c){_0x33f919=_0x403d1c;_0x4dc58b=0xc8;}else{_0x4dc58b=0xce;}_0x236e7a['status'](_0x4dc58b);return _0x236e7a[_0xe2da('0x21')](_0xe2da('0x22'),_0x3dfc52+'-'+_0x33f919+'/'+_0x403d1c)[_0xe2da('0x23')](_0x586b27);}return null;};}function patchUpdates(_0x2e5730){return function(_0x329ffe){try{jsonpatch['apply'](_0x329ffe,_0x2e5730,!![]);}catch(_0x56eeb1){return BPromise[_0xe2da('0x24')](_0x56eeb1);}return _0x329ffe['save']();};}function saveUpdates(_0x1a9324,_0x254b37){return function(_0x332193){if(_0x332193){return _0x332193[_0xe2da('0x25')](_0x1a9324)[_0xe2da('0x26')](function(_0x3e22de){return _0x3e22de;});}return null;};}function removeEntity(_0x5a9ffe,_0x467cd6){return function(_0x53cc4e){if(_0x53cc4e){return _0x53cc4e[_0xe2da('0x27')]()[_0xe2da('0x26')](function(){_0x5a9ffe[_0xe2da('0x1c')](0xcc)[_0xe2da('0x1d')]();});}};}function handleEntityNotFound(_0x30dea4,_0x1e45e9){return function(_0x38f2c4){if(!_0x38f2c4){_0x30dea4[_0xe2da('0x1b')](0x194);}return _0x38f2c4;};}function handleError(_0x5a08d6,_0x1c901e){_0x1c901e=_0x1c901e||0x1f4;return function(_0x357bff){logger[_0xe2da('0x28')](_0x357bff[_0xe2da('0x29')]);if(_0x357bff[_0xe2da('0x2a')]){delete _0x357bff[_0xe2da('0x2a')];}_0x5a08d6[_0xe2da('0x1c')](_0x1c901e)['send'](_0x357bff);};}exports[_0xe2da('0x2b')]=function(_0x3e23d7,_0x1dc228){var _0x38ee5e={},_0x36ca43={},_0x2b6c9e={'count':0x0,'rows':[]};var _0x1b4aff=db[_0xe2da('0x2c')]['rawAttributes'];_0x36ca43['model']=_['keys'](_0x1b4aff);_0x36ca43[_0xe2da('0x2d')]=_[_0xe2da('0x2e')](_0x3e23d7[_0xe2da('0x2d')]);_0x36ca43[_0xe2da('0x2f')]=_['intersection'](_0x36ca43['model'],_0x36ca43[_0xe2da('0x2d')]);_0x38ee5e[_0xe2da('0x30')]=_[_0xe2da('0x31')](_0x36ca43[_0xe2da('0x32')],qs[_0xe2da('0x33')](_0x3e23d7[_0xe2da('0x2d')][_0xe2da('0x33')]));_0x38ee5e[_0xe2da('0x30')]=_0x38ee5e[_0xe2da('0x30')]['length']?_0x38ee5e['attributes']:_0x36ca43[_0xe2da('0x32')];if(!_0x3e23d7[_0xe2da('0x2d')][_0xe2da('0x34')](_0xe2da('0x35'))){_0x38ee5e[_0xe2da('0x20')]=qs[_0xe2da('0x20')](_0x3e23d7[_0xe2da('0x2d')][_0xe2da('0x20')]);_0x38ee5e[_0xe2da('0x1f')]=qs[_0xe2da('0x1f')](_0x3e23d7[_0xe2da('0x2d')][_0xe2da('0x1f')]);}_0x38ee5e[_0xe2da('0x36')]=qs[_0xe2da('0x37')](_0x3e23d7[_0xe2da('0x2d')][_0xe2da('0x37')]);_0x38ee5e[_0xe2da('0x38')]=qs[_0xe2da('0x2f')](_['pick'](_0x3e23d7[_0xe2da('0x2d')],_0x36ca43[_0xe2da('0x2f')]));if(_0x3e23d7[_0xe2da('0x2d')]['filter']){_0x38ee5e[_0xe2da('0x38')]=_[_0xe2da('0x39')](_0x38ee5e[_0xe2da('0x38')],{'$or':_['map'](_0x1b4aff,function(_0x4d0963){if(_0x4d0963[_0xe2da('0x3a')][_0xe2da('0x3b')]!=='VIRTUAL'){var _0x2e7324={};_0x2e7324[_0x4d0963[_0xe2da('0x3c')]]={'$like':'%'+_0x3e23d7[_0xe2da('0x2d')][_0xe2da('0x3d')]+'%'};return _0x2e7324;}})});}_0x38ee5e=_[_0xe2da('0x39')]({},_0x38ee5e,_0x3e23d7['options']);var _0x413ea7={'where':_0x38ee5e['where']};return db['OpenchannelTransferReport'][_0xe2da('0x1e')](_0x413ea7)['then'](function(_0x2aa22c){_0x2b6c9e[_0xe2da('0x1e')]=_0x2aa22c;if(_0x3e23d7['query'][_0xe2da('0x3e')]){_0x38ee5e[_0xe2da('0x3f')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x38ee5e);})['then'](function(_0x2d9c0a){_0x2b6c9e[_0xe2da('0x40')]=_0x2d9c0a;return _0x2b6c9e;})[_0xe2da('0x26')](respondWithFilteredResult(_0x1dc228,_0x38ee5e))[_0xe2da('0x41')](handleError(_0x1dc228,null));};exports[_0xe2da('0x42')]=function(_0xdf6ea6,_0x14c30f){var _0x4d4e90={'raw':!![],'where':{'id':_0xdf6ea6[_0xe2da('0x43')]['id']}},_0x3d1fd={};_0x3d1fd[_0xe2da('0x32')]=_[_0xe2da('0x2e')](db[_0xe2da('0x2c')]['rawAttributes']);_0x3d1fd[_0xe2da('0x2d')]=_[_0xe2da('0x2e')](_0xdf6ea6[_0xe2da('0x2d')]);_0x3d1fd['filters']=_[_0xe2da('0x31')](_0x3d1fd[_0xe2da('0x32')],_0x3d1fd[_0xe2da('0x2d')]);_0x4d4e90[_0xe2da('0x30')]=_[_0xe2da('0x31')](_0x3d1fd[_0xe2da('0x32')],qs[_0xe2da('0x33')](_0xdf6ea6[_0xe2da('0x2d')]['fields']));_0x4d4e90[_0xe2da('0x30')]=_0x4d4e90[_0xe2da('0x30')][_0xe2da('0x44')]?_0x4d4e90[_0xe2da('0x30')]:_0x3d1fd[_0xe2da('0x32')];if(_0xdf6ea6['query'][_0xe2da('0x3e')]){_0x4d4e90[_0xe2da('0x3f')]=[{'all':!![]}];}_0x4d4e90=_[_0xe2da('0x39')]({},_0x4d4e90,_0xdf6ea6[_0xe2da('0x45')]);return db[_0xe2da('0x2c')][_0xe2da('0x46')](_0x4d4e90)[_0xe2da('0x26')](handleEntityNotFound(_0x14c30f,null))['then'](respondWithResult(_0x14c30f,null))[_0xe2da('0x41')](handleError(_0x14c30f,null));};exports['create']=function(_0x1db1d8,_0x54b3ad){return db[_0xe2da('0x2c')]['create'](_0x1db1d8[_0xe2da('0x47')],{})[_0xe2da('0x26')](respondWithResult(_0x54b3ad,0xc9))['catch'](handleError(_0x54b3ad,null));};exports[_0xe2da('0x25')]=function(_0x369dea,_0x342d22){if(_0x369dea['body']['id']){delete _0x369dea[_0xe2da('0x47')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x369dea[_0xe2da('0x43')]['id']}})['then'](handleEntityNotFound(_0x342d22,null))[_0xe2da('0x26')](saveUpdates(_0x369dea[_0xe2da('0x47')],null))['then'](respondWithResult(_0x342d22,null))[_0xe2da('0x41')](handleError(_0x342d22,null));};exports[_0xe2da('0x27')]=function(_0x482547,_0x4a6d80){return db[_0xe2da('0x2c')]['find']({'where':{'id':_0x482547[_0xe2da('0x43')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x4a6d80,null))[_0xe2da('0x26')](removeEntity(_0x4a6d80,null))[_0xe2da('0x41')](handleError(_0x4a6d80,null));};exports[_0xe2da('0x48')]=function(_0x1f2ae5,_0x421467){return db[_0xe2da('0x2c')][_0xe2da('0x48')]()['then'](respondWithResult(_0x421467,null))[_0xe2da('0x41')](handleError(_0x421467,null));}; \ No newline at end of file +var _0x00bb=['moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','end','count','offset','limit','set','json','reject','update','then','error','stack','name','send','OpenchannelTransferReport','rawAttributes','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','key','field','options','includeAll','include','catch','show','params','keys','length','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x2f441b,_0x22a6b8){var _0x5b1738=function(_0x3722d1){while(--_0x3722d1){_0x2f441b['push'](_0x2f441b['shift']());}};_0x5b1738(++_0x22a6b8);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xb00b('0xe'));var hardwareService=require(_0xb00b('0xf'));var Redis=require(_0xb00b('0x10'));var qs=require(_0xb00b('0x11'));var logger=require(_0xb00b('0x12'))('api');var utils=require(_0xb00b('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x594075,_0x4ff792){_0x4ff792=_0x4ff792||0xcc;return function(_0x2d8ddf){if(_0x2d8ddf){return _0x594075[_0xb00b('0x14')](_0x4ff792);}return _0x594075[_0xb00b('0x15')](_0x4ff792)[_0xb00b('0x16')]();};}function respondWithResult(_0x1f1c1d,_0x4ada81){_0x4ada81=_0x4ada81||0xc8;return function(_0x218de2){if(_0x218de2){return _0x1f1c1d[_0xb00b('0x15')](_0x4ada81)['json'](_0x218de2);}};}function respondWithFilteredResult(_0x88d95e,_0x1084a6){return function(_0x540b79){if(_0x540b79){var _0x5da36b=_0x540b79[_0xb00b('0x17')],_0x9b471e=_0x1084a6[_0xb00b('0x18')],_0x4dcd45=_0x1084a6[_0xb00b('0x18')]+_0x1084a6[_0xb00b('0x19')],_0x51d136;if(_0x4dcd45>=_0x5da36b){_0x4dcd45=_0x5da36b;_0x51d136=0xc8;}else{_0x51d136=0xce;}_0x88d95e['status'](_0x51d136);return _0x88d95e[_0xb00b('0x1a')]('Content-Range',_0x9b471e+'-'+_0x4dcd45+'/'+_0x5da36b)[_0xb00b('0x1b')](_0x540b79);}return null;};}function patchUpdates(_0x5aa9a0){return function(_0x25d7a0){try{jsonpatch['apply'](_0x25d7a0,_0x5aa9a0,!![]);}catch(_0xb26ebb){return BPromise[_0xb00b('0x1c')](_0xb26ebb);}return _0x25d7a0['save']();};}function saveUpdates(_0x55770c,_0x2b0da1){return function(_0x4a334b){if(_0x4a334b){return _0x4a334b[_0xb00b('0x1d')](_0x55770c)[_0xb00b('0x1e')](function(_0x2fe48d){return _0x2fe48d;});}return null;};}function removeEntity(_0x3501af,_0x56c189){return function(_0x362ee0){if(_0x362ee0){return _0x362ee0['destroy']()[_0xb00b('0x1e')](function(){_0x3501af[_0xb00b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x231293,_0x2896d1){return function(_0x520444){if(!_0x520444){_0x231293[_0xb00b('0x14')](0x194);}return _0x520444;};}function handleError(_0x1f04d3,_0x5568bb){_0x5568bb=_0x5568bb||0x1f4;return function(_0x44efe5){logger[_0xb00b('0x1f')](_0x44efe5[_0xb00b('0x20')]);if(_0x44efe5[_0xb00b('0x21')]){delete _0x44efe5['name'];}_0x1f04d3['status'](_0x5568bb)[_0xb00b('0x22')](_0x44efe5);};}exports['index']=function(_0x550587,_0x4a635e){var _0x16ac55={},_0x73b6b0={},_0x2592cf={'count':0x0,'rows':[]};var _0x3825af=db[_0xb00b('0x23')][_0xb00b('0x24')];_0x73b6b0[_0xb00b('0x25')]=_['keys'](_0x3825af);_0x73b6b0[_0xb00b('0x26')]=_['keys'](_0x550587[_0xb00b('0x26')]);_0x73b6b0[_0xb00b('0x27')]=_[_0xb00b('0x28')](_0x73b6b0['model'],_0x73b6b0[_0xb00b('0x26')]);_0x16ac55[_0xb00b('0x29')]=_[_0xb00b('0x28')](_0x73b6b0[_0xb00b('0x25')],qs[_0xb00b('0x2a')](_0x550587[_0xb00b('0x26')][_0xb00b('0x2a')]));_0x16ac55[_0xb00b('0x29')]=_0x16ac55[_0xb00b('0x29')]['length']?_0x16ac55[_0xb00b('0x29')]:_0x73b6b0[_0xb00b('0x25')];if(!_0x550587['query'][_0xb00b('0x2b')](_0xb00b('0x2c'))){_0x16ac55['limit']=qs[_0xb00b('0x19')](_0x550587['query'][_0xb00b('0x19')]);_0x16ac55[_0xb00b('0x18')]=qs[_0xb00b('0x18')](_0x550587[_0xb00b('0x26')][_0xb00b('0x18')]);}_0x16ac55[_0xb00b('0x2d')]=qs[_0xb00b('0x2e')](_0x550587['query']['sort']);_0x16ac55['where']=qs[_0xb00b('0x27')](_[_0xb00b('0x2f')](_0x550587[_0xb00b('0x26')],_0x73b6b0[_0xb00b('0x27')]));if(_0x550587['query'][_0xb00b('0x30')]){_0x16ac55[_0xb00b('0x31')]=_[_0xb00b('0x32')](_0x16ac55[_0xb00b('0x31')],{'$or':_[_0xb00b('0x33')](_0x3825af,function(_0x39da49){if(_0x39da49[_0xb00b('0x34')][_0xb00b('0x35')]!=='VIRTUAL'){var _0x55451e={};_0x55451e[_0x39da49[_0xb00b('0x36')]]={'$like':'%'+_0x550587['query'][_0xb00b('0x30')]+'%'};return _0x55451e;}})});}_0x16ac55=_[_0xb00b('0x32')]({},_0x16ac55,_0x550587[_0xb00b('0x37')]);var _0x45ca74={'where':_0x16ac55[_0xb00b('0x31')]};return db[_0xb00b('0x23')][_0xb00b('0x17')](_0x45ca74)['then'](function(_0x35f1ca){_0x2592cf[_0xb00b('0x17')]=_0x35f1ca;if(_0x550587[_0xb00b('0x26')][_0xb00b('0x38')]){_0x16ac55[_0xb00b('0x39')]=[{'all':!![]}];}return db[_0xb00b('0x23')]['findAll'](_0x16ac55);})[_0xb00b('0x1e')](function(_0x3beb8f){_0x2592cf['rows']=_0x3beb8f;return _0x2592cf;})[_0xb00b('0x1e')](respondWithFilteredResult(_0x4a635e,_0x16ac55))[_0xb00b('0x3a')](handleError(_0x4a635e,null));};exports[_0xb00b('0x3b')]=function(_0x2d8620,_0x2954e8){var _0x5636b1={'raw':!![],'where':{'id':_0x2d8620[_0xb00b('0x3c')]['id']}},_0x14ff6a={};_0x14ff6a[_0xb00b('0x25')]=_[_0xb00b('0x3d')](db['OpenchannelTransferReport']['rawAttributes']);_0x14ff6a[_0xb00b('0x26')]=_[_0xb00b('0x3d')](_0x2d8620[_0xb00b('0x26')]);_0x14ff6a[_0xb00b('0x27')]=_[_0xb00b('0x28')](_0x14ff6a[_0xb00b('0x25')],_0x14ff6a[_0xb00b('0x26')]);_0x5636b1['attributes']=_[_0xb00b('0x28')](_0x14ff6a[_0xb00b('0x25')],qs[_0xb00b('0x2a')](_0x2d8620[_0xb00b('0x26')][_0xb00b('0x2a')]));_0x5636b1[_0xb00b('0x29')]=_0x5636b1[_0xb00b('0x29')][_0xb00b('0x3e')]?_0x5636b1[_0xb00b('0x29')]:_0x14ff6a[_0xb00b('0x25')];if(_0x2d8620[_0xb00b('0x26')][_0xb00b('0x38')]){_0x5636b1['include']=[{'all':!![]}];}_0x5636b1=_[_0xb00b('0x32')]({},_0x5636b1,_0x2d8620[_0xb00b('0x37')]);return db[_0xb00b('0x23')][_0xb00b('0x3f')](_0x5636b1)[_0xb00b('0x1e')](handleEntityNotFound(_0x2954e8,null))[_0xb00b('0x1e')](respondWithResult(_0x2954e8,null))[_0xb00b('0x3a')](handleError(_0x2954e8,null));};exports[_0xb00b('0x40')]=function(_0x10ba60,_0x103320){return db[_0xb00b('0x23')][_0xb00b('0x40')](_0x10ba60['body'],{})['then'](respondWithResult(_0x103320,0xc9))['catch'](handleError(_0x103320,null));};exports[_0xb00b('0x1d')]=function(_0x23d858,_0x481154){if(_0x23d858[_0xb00b('0x41')]['id']){delete _0x23d858[_0xb00b('0x41')]['id'];}return db[_0xb00b('0x23')][_0xb00b('0x3f')]({'where':{'id':_0x23d858['params']['id']}})['then'](handleEntityNotFound(_0x481154,null))[_0xb00b('0x1e')](saveUpdates(_0x23d858[_0xb00b('0x41')],null))['then'](respondWithResult(_0x481154,null))['catch'](handleError(_0x481154,null));};exports[_0xb00b('0x42')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x23')]['find']({'where':{'id':_0x3a205d['params']['id']}})['then'](handleEntityNotFound(_0x4e0be4,null))[_0xb00b('0x1e')](removeEntity(_0x4e0be4,null))['catch'](handleError(_0x4e0be4,null));};exports[_0xb00b('0x43')]=function(_0x3178aa,_0x4b6482){return db[_0xb00b('0x23')][_0xb00b('0x43')]()[_0xb00b('0x1e')](respondWithResult(_0x4b6482,null))['catch'](handleError(_0x4b6482,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index b29c4a9..949814d 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 _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x3c3e7a,_0x266f50){var _0x3e2777=function(_0x28cf0d){while(--_0x28cf0d){_0x3c3e7a['push'](_0x3c3e7a['shift']());}};_0x3e2777(++_0x266f50);}(_0x7a54,0x106));var _0x47a5=function(_0x57a906,_0x75d54a){_0x57a906=_0x57a906-0x0;var _0x38b9f7=_0x7a54[_0x57a906];return _0x38b9f7;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x16c087,_0x42715d){var _0xd56012=function(_0x4df29c){while(--_0x4df29c){_0x16c087['push'](_0x16c087['shift']());}};_0xd56012(++_0x42715d);}(_0x7a54,0x106));var _0x47a5=function(_0x51e06a,_0x4ad058){_0x51e06a=_0x51e06a-0x0;var _0x32056e=_0x7a54[_0x51e06a];return _0x32056e;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 659817a..4beceaf 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 _0x1641=['client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1d56d6,_0x20f7c6){var _0x2c39d9=function(_0x10f12d){while(--_0x10f12d){_0x1d56d6['push'](_0x1d56d6['shift']());}};_0x2c39d9(++_0x20f7c6);}(_0x1641,0x153));var _0x1164=function(_0x220c59,_0xcef123){_0x220c59=_0x220c59-0x0;var _0x16b952=_0x1641[_0x220c59];return _0x16b952;};'use strict';var _=require(_0x1164('0x0'));var util=require(_0x1164('0x1'));var moment=require(_0x1164('0x2'));var BPromise=require('bluebird');var rs=require(_0x1164('0x3'));var fs=require('fs');var Redis=require(_0x1164('0x4'));var db=require(_0x1164('0x5'))['db'];var utils=require(_0x1164('0x6'));var logger=require(_0x1164('0x7'))(_0x1164('0x8'));var config=require(_0x1164('0x9'));var jayson=require(_0x1164('0xa'));var client=jayson[_0x1164('0xb')][_0x1164('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f69d3,_0x4582ec,_0x3ab2b9){return new BPromise(function(_0xe3c4ec,_0x40fc94){return client[_0x1164('0xd')](_0x1f69d3,_0x3ab2b9)[_0x1164('0xe')](function(_0x50c9c1){logger[_0x1164('0xf')](_0x1164('0x10'),_0x4582ec,_0x1164('0x11'));logger['debug'](_0x1164('0x12'),_0x4582ec,_0x1164('0x11'),JSON[_0x1164('0x13')](_0x50c9c1));if(_0x50c9c1[_0x1164('0x14')]){if(_0x50c9c1[_0x1164('0x14')][_0x1164('0x15')]===0x1f4){logger[_0x1164('0x14')](_0x1164('0x10'),_0x4582ec,_0x50c9c1['error'][_0x1164('0x16')]);return _0x40fc94(_0x50c9c1['error'][_0x1164('0x16')]);}logger[_0x1164('0x14')](_0x1164('0x10'),_0x4582ec,_0x50c9c1['error'][_0x1164('0x16')]);return _0xe3c4ec(_0x50c9c1[_0x1164('0x14')]['message']);}else{logger[_0x1164('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4582ec,'request\x20sent');_0xe3c4ec(_0x50c9c1[_0x1164('0x17')]['message']);}})[_0x1164('0x18')](function(_0x1d1a7e){logger['error'](_0x1164('0x10'),_0x4582ec,_0x1d1a7e);_0x40fc94(_0x1d1a7e);});});} \ No newline at end of file +var _0x13bb=['jayson/promise','http','request','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x41bb55,_0x4c3152){var _0x594771=function(_0x29bfe1){while(--_0x29bfe1){_0x41bb55['push'](_0x41bb55['shift']());}};_0x594771(++_0x4c3152);}(_0x13bb,0x19b));var _0xb13b=function(_0x118ab8,_0x37d745){_0x118ab8=_0x118ab8-0x0;var _0x1c73b7=_0x13bb[_0x118ab8];return _0x1c73b7;};'use strict';var _=require('lodash');var util=require(_0xb13b('0x0'));var moment=require(_0xb13b('0x1'));var BPromise=require(_0xb13b('0x2'));var rs=require(_0xb13b('0x3'));var fs=require('fs');var Redis=require(_0xb13b('0x4'));var db=require(_0xb13b('0x5'))['db'];var utils=require(_0xb13b('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb13b('0x7'));var client=jayson['client'][_0xb13b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27eca3,_0x44a830,_0xc4f467){return new BPromise(function(_0x62107d,_0x22d913){return client[_0xb13b('0x9')](_0x27eca3,_0xc4f467)['then'](function(_0x28b114){logger['info'](_0xb13b('0xa'),_0x44a830,'request\x20sent');logger['debug'](_0xb13b('0xb'),_0x44a830,'request\x20sent',JSON[_0xb13b('0xc')](_0x28b114));if(_0x28b114[_0xb13b('0xd')]){if(_0x28b114[_0xb13b('0xd')][_0xb13b('0xe')]===0x1f4){logger[_0xb13b('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x44a830,_0x28b114[_0xb13b('0xd')]['message']);return _0x22d913(_0x28b114[_0xb13b('0xd')]['message']);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x44a830,_0x28b114['error'][_0xb13b('0xf')]);return _0x62107d(_0x28b114['error'][_0xb13b('0xf')]);}else{logger[_0xb13b('0x10')](_0xb13b('0xa'),_0x44a830,'request\x20sent');_0x62107d(_0x28b114[_0xb13b('0x11')][_0xb13b('0xf')]);}})[_0xb13b('0x12')](function(_0x2ada1f){logger['error'](_0xb13b('0xa'),_0x44a830,_0x2ada1f);_0x22d913(_0x2ada1f);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b51214d..2f9ffd9 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 _0x5a8c=['show','post','create','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x326ac6,_0x20e9c8){_0x326ac6=_0x326ac6-0x0;var _0x5378c8=_0x5a8c[_0x326ac6];return _0x5378c8;};'use strict';var multer=require(_0xc5a8('0x0'));var util=require(_0xc5a8('0x1'));var path=require('path');var timeout=require(_0xc5a8('0x2'));var express=require(_0xc5a8('0x3'));var router=express[_0xc5a8('0x4')]();var auth=require(_0xc5a8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc5a8('0x6'));var controller=require(_0xc5a8('0x7'));router['get']('/',auth[_0xc5a8('0x8')](),controller[_0xc5a8('0x9')]);router[_0xc5a8('0xa')](_0xc5a8('0xb'),auth[_0xc5a8('0x8')](),controller[_0xc5a8('0xc')]);router[_0xc5a8('0xd')]('/',auth[_0xc5a8('0x8')](),controller[_0xc5a8('0xe')]);router[_0xc5a8('0xf')](_0xc5a8('0xb'),auth['isAuthenticated'](),controller[_0xc5a8('0x10')]);router['delete'](_0xc5a8('0xb'),auth[_0xc5a8('0x8')](),controller[_0xc5a8('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4b6c=['show','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id'];(function(_0x3ea5b7,_0x3e2a74){var _0x3c6aa6=function(_0x350713){while(--_0x350713){_0x3ea5b7['push'](_0x3ea5b7['shift']());}};_0x3c6aa6(++_0x3e2a74);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc4b6('0x0'));var util=require(_0xc4b6('0x1'));var path=require('path');var timeout=require(_0xc4b6('0x2'));var express=require(_0xc4b6('0x3'));var router=express[_0xc4b6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc4b6('0x5'));var config=require(_0xc4b6('0x6'));var controller=require(_0xc4b6('0x7'));router['get']('/',auth[_0xc4b6('0x8')](),controller[_0xc4b6('0x9')]);router[_0xc4b6('0xa')](_0xc4b6('0xb'),auth['isAuthenticated'](),controller[_0xc4b6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc4b6('0xd')]);router[_0xc4b6('0xe')](_0xc4b6('0xb'),auth[_0xc4b6('0x8')](),controller[_0xc4b6('0xf')]);router[_0xc4b6('0x10')]('/:id',auth[_0xc4b6('0x8')](),controller[_0xc4b6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 5827afd..4254c61 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 _0x629b=['sequelize','STRING','name'];(function(_0xbcb90d,_0xc40789){var _0x1a85e1=function(_0x1dba48){while(--_0x1dba48){_0xbcb90d['push'](_0xbcb90d['shift']());}};_0x1a85e1(++_0xc40789);}(_0x629b,0x1da));var _0xb629=function(_0x17a0bb,_0x3334b4){_0x17a0bb=_0x17a0bb-0x0;var _0x54c5d7=_0x629b[_0x17a0bb];return _0x54c5d7;};'use strict';var Sequelize=require(_0xb629('0x0'));module['exports']={'name':{'type':Sequelize[_0xb629('0x1')],'unique':_0xb629('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe8cf=['STRING','name','exports'];(function(_0x231dda,_0x5b04cc){var _0x3f88cb=function(_0x16eb77){while(--_0x16eb77){_0x231dda['push'](_0x231dda['shift']());}};_0x3f88cb(++_0x5b04cc);}(_0xe8cf,0xa7));var _0xfe8c=function(_0x34edc6,_0x4a0b01){_0x34edc6=_0x34edc6-0x0;var _0x5788b1=_0xe8cf[_0x34edc6];return _0x5788b1;};'use strict';var Sequelize=require('sequelize');module[_0xfe8c('0x0')]={'name':{'type':Sequelize[_0xfe8c('0x1')],'unique':_0xfe8c('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 08f9c28..b27962e 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 _0x79ec=['rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','end','error','name','send','index','rawAttributes','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','key','VIRTUAL','merge','options','Pause','includeAll','include','findAll'];(function(_0x2e324c,_0x2a697a){var _0x52ca4a=function(_0x2f035a){while(--_0x2f035a){_0x2e324c['push'](_0x2e324c['shift']());}};_0x52ca4a(++_0x2a697a);}(_0x79ec,0x1a2));var _0xc79e=function(_0x420516,_0x5ce5ca){_0x420516=_0x420516-0x0;var _0x16484e=_0x79ec[_0x420516];return _0x16484e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc79e('0x0'));var rimraf=require(_0xc79e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc79e('0x2'));var rp=require(_0xc79e('0x3'));var moment=require(_0xc79e('0x4'));var BPromise=require(_0xc79e('0x5'));var Mustache=require(_0xc79e('0x6'));var util=require(_0xc79e('0x7'));var path=require(_0xc79e('0x8'));var sox=require('sox');var csv=require(_0xc79e('0x9'));var ejs=require(_0xc79e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc79e('0xb'));var crypto=require(_0xc79e('0xc'));var jsforce=require(_0xc79e('0xd'));var deskjs=require(_0xc79e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc79e('0xf'));var Papa=require(_0xc79e('0x10'));var authService=require(_0xc79e('0x11'));var hardwareService=require(_0xc79e('0x12'));var Redis=require(_0xc79e('0x13'));var qs=require(_0xc79e('0x14'));var logger=require('../../config/logger')(_0xc79e('0x15'));var utils=require(_0xc79e('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a296c,_0x1d9c4a){_0x1d9c4a=_0x1d9c4a||0xcc;return function(_0x2ee1c7){if(_0x2ee1c7){return _0x4a296c[_0xc79e('0x17')](_0x1d9c4a);}return _0x4a296c[_0xc79e('0x18')](_0x1d9c4a)['end']();};}function respondWithResult(_0x18abf5,_0x3bd600){_0x3bd600=_0x3bd600||0xc8;return function(_0x5bdc22){if(_0x5bdc22){return _0x18abf5['status'](_0x3bd600)[_0xc79e('0x19')](_0x5bdc22);}};}function respondWithFilteredResult(_0x5c3c2d,_0x3f5af3){return function(_0x749305){if(_0x749305){var _0x34e2fc=_0x749305[_0xc79e('0x1a')],_0x35a2dd=_0x3f5af3[_0xc79e('0x1b')],_0x3c0c57=_0x3f5af3[_0xc79e('0x1b')]+_0x3f5af3[_0xc79e('0x1c')],_0x41e871;if(_0x3c0c57>=_0x34e2fc){_0x3c0c57=_0x34e2fc;_0x41e871=0xc8;}else{_0x41e871=0xce;}_0x5c3c2d[_0xc79e('0x18')](_0x41e871);return _0x5c3c2d['set'](_0xc79e('0x1d'),_0x35a2dd+'-'+_0x3c0c57+'/'+_0x34e2fc)['json'](_0x749305);}return null;};}function patchUpdates(_0x1d0192){return function(_0x369696){try{jsonpatch[_0xc79e('0x1e')](_0x369696,_0x1d0192,!![]);}catch(_0x5943d8){return BPromise[_0xc79e('0x1f')](_0x5943d8);}return _0x369696[_0xc79e('0x20')]();};}function saveUpdates(_0x84cc05,_0x5bebbd){return function(_0x12e2af){if(_0x12e2af){return _0x12e2af[_0xc79e('0x21')](_0x84cc05)[_0xc79e('0x22')](function(_0x68cad8){return _0x68cad8;});}return null;};}function removeEntity(_0x17c843,_0x14fc52){return function(_0x301f92){if(_0x301f92){return _0x301f92[_0xc79e('0x23')]()[_0xc79e('0x22')](function(){var _0x55ce1a=_0x301f92[_0xc79e('0x24')]({'plain':!![]});var _0x50514c=_0xc79e('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x50514c,'resourceId':_0x55ce1a['id']}})[_0xc79e('0x22')](function(){return _0x301f92;});})[_0xc79e('0x22')](function(){_0x17c843[_0xc79e('0x18')](0xcc)[_0xc79e('0x26')]();});}};}function handleEntityNotFound(_0xcdba23,_0x117d25){return function(_0x144858){if(!_0x144858){_0xcdba23[_0xc79e('0x17')](0x194);}return _0x144858;};}function handleError(_0x501468,_0x18ed26){_0x18ed26=_0x18ed26||0x1f4;return function(_0x597fa1){logger[_0xc79e('0x27')](_0x597fa1['stack']);if(_0x597fa1[_0xc79e('0x28')]){delete _0x597fa1['name'];}_0x501468['status'](_0x18ed26)[_0xc79e('0x29')](_0x597fa1);};}exports[_0xc79e('0x2a')]=function(_0x27deaf,_0x1d325f){var _0x4fd4c3={},_0x485bd0={},_0x4aee31={'count':0x0,'rows':[]};var _0x17a278=db['Pause'][_0xc79e('0x2b')];_0x485bd0[_0xc79e('0x2c')]=_['keys'](_0x17a278);_0x485bd0[_0xc79e('0x2d')]=_[_0xc79e('0x2e')](_0x27deaf['query']);_0x485bd0[_0xc79e('0x2f')]=_[_0xc79e('0x30')](_0x485bd0[_0xc79e('0x2c')],_0x485bd0[_0xc79e('0x2d')]);_0x4fd4c3['attributes']=_[_0xc79e('0x30')](_0x485bd0[_0xc79e('0x2c')],qs['fields'](_0x27deaf[_0xc79e('0x2d')][_0xc79e('0x31')]));_0x4fd4c3['attributes']=_0x4fd4c3['attributes'][_0xc79e('0x32')]?_0x4fd4c3[_0xc79e('0x33')]:_0x485bd0[_0xc79e('0x2c')];if(!_0x27deaf[_0xc79e('0x2d')][_0xc79e('0x34')](_0xc79e('0x35'))){_0x4fd4c3[_0xc79e('0x1c')]=qs[_0xc79e('0x1c')](_0x27deaf['query']['limit']);_0x4fd4c3[_0xc79e('0x1b')]=qs[_0xc79e('0x1b')](_0x27deaf[_0xc79e('0x2d')][_0xc79e('0x1b')]);}_0x4fd4c3[_0xc79e('0x36')]=qs[_0xc79e('0x37')](_0x27deaf[_0xc79e('0x2d')]['sort']);_0x4fd4c3[_0xc79e('0x38')]=qs['filters'](_[_0xc79e('0x39')](_0x27deaf[_0xc79e('0x2d')],_0x485bd0[_0xc79e('0x2f')]));if(_0x27deaf[_0xc79e('0x2d')][_0xc79e('0x3a')]){_0x4fd4c3[_0xc79e('0x38')]=_['merge'](_0x4fd4c3[_0xc79e('0x38')],{'$or':_['map'](_0x17a278,function(_0x4dcf2b){if(_0x4dcf2b[_0xc79e('0x3b')][_0xc79e('0x3c')]!==_0xc79e('0x3d')){var _0x8b3540={};_0x8b3540[_0x4dcf2b['field']]={'$like':'%'+_0x27deaf[_0xc79e('0x2d')][_0xc79e('0x3a')]+'%'};return _0x8b3540;}})});}_0x4fd4c3=_[_0xc79e('0x3e')]({},_0x4fd4c3,_0x27deaf[_0xc79e('0x3f')]);var _0x7d50d7={'where':_0x4fd4c3['where']};return db[_0xc79e('0x40')][_0xc79e('0x1a')](_0x7d50d7)['then'](function(_0x3435cc){_0x4aee31[_0xc79e('0x1a')]=_0x3435cc;if(_0x27deaf[_0xc79e('0x2d')][_0xc79e('0x41')]){_0x4fd4c3[_0xc79e('0x42')]=[{'all':!![]}];}return db[_0xc79e('0x40')][_0xc79e('0x43')](_0x4fd4c3);})[_0xc79e('0x22')](function(_0x36e626){_0x4aee31[_0xc79e('0x44')]=_0x36e626;return _0x4aee31;})['then'](respondWithFilteredResult(_0x1d325f,_0x4fd4c3))[_0xc79e('0x45')](handleError(_0x1d325f,null));};exports[_0xc79e('0x46')]=function(_0x513fee,_0x42280a){var _0x103d09={'raw':!![],'where':{'id':_0x513fee[_0xc79e('0x47')]['id']}},_0x3aa4f6={};_0x3aa4f6['model']=_['keys'](db[_0xc79e('0x40')][_0xc79e('0x2b')]);_0x3aa4f6[_0xc79e('0x2d')]=_[_0xc79e('0x2e')](_0x513fee[_0xc79e('0x2d')]);_0x3aa4f6[_0xc79e('0x2f')]=_[_0xc79e('0x30')](_0x3aa4f6[_0xc79e('0x2c')],_0x3aa4f6[_0xc79e('0x2d')]);_0x103d09['attributes']=_[_0xc79e('0x30')](_0x3aa4f6[_0xc79e('0x2c')],qs[_0xc79e('0x31')](_0x513fee[_0xc79e('0x2d')][_0xc79e('0x31')]));_0x103d09[_0xc79e('0x33')]=_0x103d09[_0xc79e('0x33')]['length']?_0x103d09['attributes']:_0x3aa4f6[_0xc79e('0x2c')];if(_0x513fee[_0xc79e('0x2d')][_0xc79e('0x41')]){_0x103d09[_0xc79e('0x42')]=[{'all':!![]}];}_0x103d09=_[_0xc79e('0x3e')]({},_0x103d09,_0x513fee[_0xc79e('0x3f')]);return db['Pause'][_0xc79e('0x48')](_0x103d09)['then'](handleEntityNotFound(_0x42280a,null))[_0xc79e('0x22')](respondWithResult(_0x42280a,null))[_0xc79e('0x45')](handleError(_0x42280a,null));};exports['create']=function(_0x73a45f,_0x4c493a){return db[_0xc79e('0x40')][_0xc79e('0x49')](_0x73a45f[_0xc79e('0x4a')],{})[_0xc79e('0x22')](function(_0x21e446){var _0x45be9f=_0x73a45f[_0xc79e('0x4b')][_0xc79e('0x24')]({'plain':!![]});if(!_0x45be9f)throw new Error(_0xc79e('0x4c'));if(_0x45be9f[_0xc79e('0x4d')]===_0xc79e('0x4b')){var _0xa2de24=_0x21e446[_0xc79e('0x24')]({'plain':!![]});var _0x3f389e=_0xc79e('0x25');return db['UserProfileSection'][_0xc79e('0x48')]({'where':{'name':_0x3f389e,'userProfileId':_0x45be9f[_0xc79e('0x4e')]},'raw':!![]})[_0xc79e('0x22')](function(_0x1a4714){if(_0x1a4714&&_0x1a4714[_0xc79e('0x4f')]===0x0){return db['UserProfileResource'][_0xc79e('0x49')]({'name':_0xa2de24[_0xc79e('0x28')],'resourceId':_0xa2de24['id'],'type':_0x1a4714[_0xc79e('0x28')],'sectionId':_0x1a4714['id']},{})[_0xc79e('0x22')](function(){return _0x21e446;});}else{return _0x21e446;}})[_0xc79e('0x45')](function(_0xa1f07e){logger['error'](_0xc79e('0x50'),_0xa1f07e);throw _0xa1f07e;});}return _0x21e446;})['then'](respondWithResult(_0x4c493a,0xc9))[_0xc79e('0x45')](handleError(_0x4c493a,null));};exports[_0xc79e('0x21')]=function(_0x1fdf10,_0x54262e){if(_0x1fdf10['body']['id']){delete _0x1fdf10['body']['id'];}return db[_0xc79e('0x40')][_0xc79e('0x48')]({'where':{'id':_0x1fdf10[_0xc79e('0x47')]['id']}})[_0xc79e('0x22')](handleEntityNotFound(_0x54262e,null))[_0xc79e('0x22')](saveUpdates(_0x1fdf10['body'],null))[_0xc79e('0x22')](respondWithResult(_0x54262e,null))[_0xc79e('0x45')](handleError(_0x54262e,null));};exports['destroy']=function(_0x2d940c,_0x253f0f){return db[_0xc79e('0x40')][_0xc79e('0x48')]({'where':{'id':_0x2d940c[_0xc79e('0x47')]['id']}})[_0xc79e('0x22')](handleEntityNotFound(_0x253f0f,null))[_0xc79e('0x22')](removeEntity(_0x253f0f,null))[_0xc79e('0x45')](handleError(_0x253f0f,null));}; \ No newline at end of file +var _0x5b66=['eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','Pause','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','rows','catch','show','params','rawAttributes','find','role','user','Pauses','UserProfileSection','userProfileId','autoAssociation','html-pdf'];(function(_0x354df6,_0x4fb714){var _0x3b8676=function(_0x5a0296){while(--_0x5a0296){_0x354df6['push'](_0x354df6['shift']());}};_0x3b8676(++_0x4fb714);}(_0x5b66,0x1d3));var _0x65b6=function(_0x30f5b3,_0x47af5b){_0x30f5b3=_0x30f5b3-0x0;var _0x2832e4=_0x5b66[_0x30f5b3];return _0x2832e4;};'use strict';var pdf=require(_0x65b6('0x0'));var emlformat=require(_0x65b6('0x1'));var rimraf=require(_0x65b6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x65b6('0x3'));var moment=require(_0x65b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65b6('0x5'));var util=require(_0x65b6('0x6'));var path=require(_0x65b6('0x7'));var sox=require(_0x65b6('0x8'));var csv=require('to-csv');var ejs=require(_0x65b6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x65b6('0xa'));var jsforce=require(_0x65b6('0xb'));var deskjs=require(_0x65b6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x65b6('0xd'));var Papa=require(_0x65b6('0xe'));var authService=require(_0x65b6('0xf'));var hardwareService=require(_0x65b6('0x10'));var Redis=require('ioredis');var qs=require(_0x65b6('0x11'));var logger=require(_0x65b6('0x12'))(_0x65b6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65b6('0x14'))['db'];function respondWithStatusCode(_0x16a492,_0x571c76){_0x571c76=_0x571c76||0xcc;return function(_0x58a3f9){if(_0x58a3f9){return _0x16a492['sendStatus'](_0x571c76);}return _0x16a492[_0x65b6('0x15')](_0x571c76)[_0x65b6('0x16')]();};}function respondWithResult(_0x4164d8,_0x4c84a8){_0x4c84a8=_0x4c84a8||0xc8;return function(_0x55342e){if(_0x55342e){return _0x4164d8[_0x65b6('0x15')](_0x4c84a8)[_0x65b6('0x17')](_0x55342e);}};}function respondWithFilteredResult(_0x237641,_0xe9eaf7){return function(_0x5f3fd0){if(_0x5f3fd0){var _0x51a9f9=_0x5f3fd0['count'],_0x540360=_0xe9eaf7[_0x65b6('0x18')],_0x20df2b=_0xe9eaf7[_0x65b6('0x18')]+_0xe9eaf7[_0x65b6('0x19')],_0x2fa8dd;if(_0x20df2b>=_0x51a9f9){_0x20df2b=_0x51a9f9;_0x2fa8dd=0xc8;}else{_0x2fa8dd=0xce;}_0x237641[_0x65b6('0x15')](_0x2fa8dd);return _0x237641[_0x65b6('0x1a')](_0x65b6('0x1b'),_0x540360+'-'+_0x20df2b+'/'+_0x51a9f9)[_0x65b6('0x17')](_0x5f3fd0);}return null;};}function patchUpdates(_0x4a611d){return function(_0x5cf5bf){try{jsonpatch['apply'](_0x5cf5bf,_0x4a611d,!![]);}catch(_0x17fea0){return BPromise[_0x65b6('0x1c')](_0x17fea0);}return _0x5cf5bf[_0x65b6('0x1d')]();};}function saveUpdates(_0x19b3df,_0x476cf9){return function(_0x502f1f){if(_0x502f1f){return _0x502f1f[_0x65b6('0x1e')](_0x19b3df)[_0x65b6('0x1f')](function(_0x7c2183){return _0x7c2183;});}return null;};}function removeEntity(_0x3f3c58,_0x521bf2){return function(_0x10e848){if(_0x10e848){return _0x10e848[_0x65b6('0x20')]()[_0x65b6('0x1f')](function(){var _0x282ba2=_0x10e848[_0x65b6('0x21')]({'plain':!![]});var _0x43c6c0='Pauses';return db[_0x65b6('0x22')][_0x65b6('0x20')]({'where':{'type':_0x43c6c0,'resourceId':_0x282ba2['id']}})['then'](function(){return _0x10e848;});})[_0x65b6('0x1f')](function(){_0x3f3c58[_0x65b6('0x15')](0xcc)[_0x65b6('0x16')]();});}};}function handleEntityNotFound(_0x39a845,_0x4a8fbf){return function(_0xf747a){if(!_0xf747a){_0x39a845[_0x65b6('0x23')](0x194);}return _0xf747a;};}function handleError(_0x297f65,_0x41da9f){_0x41da9f=_0x41da9f||0x1f4;return function(_0x6479db){logger[_0x65b6('0x24')](_0x6479db[_0x65b6('0x25')]);if(_0x6479db[_0x65b6('0x26')]){delete _0x6479db[_0x65b6('0x26')];}_0x297f65[_0x65b6('0x15')](_0x41da9f)[_0x65b6('0x27')](_0x6479db);};}exports[_0x65b6('0x28')]=function(_0x55f306,_0x5243cb){var _0x4c439b={},_0x4bcb78={},_0x3b0d4f={'count':0x0,'rows':[]};var _0x51c2f0=db[_0x65b6('0x29')]['rawAttributes'];_0x4bcb78[_0x65b6('0x2a')]=_[_0x65b6('0x2b')](_0x51c2f0);_0x4bcb78[_0x65b6('0x2c')]=_[_0x65b6('0x2b')](_0x55f306[_0x65b6('0x2c')]);_0x4bcb78[_0x65b6('0x2d')]=_['intersection'](_0x4bcb78[_0x65b6('0x2a')],_0x4bcb78[_0x65b6('0x2c')]);_0x4c439b[_0x65b6('0x2e')]=_[_0x65b6('0x2f')](_0x4bcb78[_0x65b6('0x2a')],qs['fields'](_0x55f306[_0x65b6('0x2c')][_0x65b6('0x30')]));_0x4c439b['attributes']=_0x4c439b['attributes'][_0x65b6('0x31')]?_0x4c439b[_0x65b6('0x2e')]:_0x4bcb78['model'];if(!_0x55f306[_0x65b6('0x2c')][_0x65b6('0x32')](_0x65b6('0x33'))){_0x4c439b[_0x65b6('0x19')]=qs[_0x65b6('0x19')](_0x55f306[_0x65b6('0x2c')][_0x65b6('0x19')]);_0x4c439b[_0x65b6('0x18')]=qs[_0x65b6('0x18')](_0x55f306[_0x65b6('0x2c')]['offset']);}_0x4c439b[_0x65b6('0x34')]=qs[_0x65b6('0x35')](_0x55f306[_0x65b6('0x2c')][_0x65b6('0x35')]);_0x4c439b[_0x65b6('0x36')]=qs[_0x65b6('0x2d')](_['pick'](_0x55f306['query'],_0x4bcb78[_0x65b6('0x2d')]));if(_0x55f306['query'][_0x65b6('0x37')]){_0x4c439b[_0x65b6('0x36')]=_[_0x65b6('0x38')](_0x4c439b[_0x65b6('0x36')],{'$or':_[_0x65b6('0x39')](_0x51c2f0,function(_0x547d85){if(_0x547d85[_0x65b6('0x3a')][_0x65b6('0x3b')]!==_0x65b6('0x3c')){var _0x17a59b={};_0x17a59b[_0x547d85[_0x65b6('0x3d')]]={'$like':'%'+_0x55f306['query'][_0x65b6('0x37')]+'%'};return _0x17a59b;}})});}_0x4c439b=_['merge']({},_0x4c439b,_0x55f306[_0x65b6('0x3e')]);var _0x54d153={'where':_0x4c439b[_0x65b6('0x36')]};return db[_0x65b6('0x29')][_0x65b6('0x3f')](_0x54d153)[_0x65b6('0x1f')](function(_0x57746b){_0x3b0d4f['count']=_0x57746b;if(_0x55f306['query'][_0x65b6('0x40')]){_0x4c439b[_0x65b6('0x41')]=[{'all':!![]}];}return db[_0x65b6('0x29')]['findAll'](_0x4c439b);})[_0x65b6('0x1f')](function(_0x1e62fc){_0x3b0d4f[_0x65b6('0x42')]=_0x1e62fc;return _0x3b0d4f;})['then'](respondWithFilteredResult(_0x5243cb,_0x4c439b))[_0x65b6('0x43')](handleError(_0x5243cb,null));};exports[_0x65b6('0x44')]=function(_0x13c96d,_0x4a0aa8){var _0x9ee184={'raw':!![],'where':{'id':_0x13c96d[_0x65b6('0x45')]['id']}},_0x3bdd6e={};_0x3bdd6e[_0x65b6('0x2a')]=_[_0x65b6('0x2b')](db[_0x65b6('0x29')][_0x65b6('0x46')]);_0x3bdd6e['query']=_[_0x65b6('0x2b')](_0x13c96d[_0x65b6('0x2c')]);_0x3bdd6e['filters']=_[_0x65b6('0x2f')](_0x3bdd6e['model'],_0x3bdd6e[_0x65b6('0x2c')]);_0x9ee184['attributes']=_[_0x65b6('0x2f')](_0x3bdd6e[_0x65b6('0x2a')],qs['fields'](_0x13c96d[_0x65b6('0x2c')]['fields']));_0x9ee184['attributes']=_0x9ee184['attributes'][_0x65b6('0x31')]?_0x9ee184[_0x65b6('0x2e')]:_0x3bdd6e[_0x65b6('0x2a')];if(_0x13c96d[_0x65b6('0x2c')]['includeAll']){_0x9ee184[_0x65b6('0x41')]=[{'all':!![]}];}_0x9ee184=_['merge']({},_0x9ee184,_0x13c96d['options']);return db['Pause'][_0x65b6('0x47')](_0x9ee184)[_0x65b6('0x1f')](handleEntityNotFound(_0x4a0aa8,null))['then'](respondWithResult(_0x4a0aa8,null))[_0x65b6('0x43')](handleError(_0x4a0aa8,null));};exports['create']=function(_0x51d295,_0x51f82c){return db['Pause']['create'](_0x51d295['body'],{})[_0x65b6('0x1f')](function(_0x314c63){var _0x5f0330=_0x51d295['user']['get']({'plain':!![]});if(!_0x5f0330)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f0330[_0x65b6('0x48')]===_0x65b6('0x49')){var _0x1865f7=_0x314c63[_0x65b6('0x21')]({'plain':!![]});var _0x4789b8=_0x65b6('0x4a');return db[_0x65b6('0x4b')]['find']({'where':{'name':_0x4789b8,'userProfileId':_0x5f0330[_0x65b6('0x4c')]},'raw':!![]})[_0x65b6('0x1f')](function(_0x3f8c26){if(_0x3f8c26&&_0x3f8c26[_0x65b6('0x4d')]===0x0){return db[_0x65b6('0x22')]['create']({'name':_0x1865f7['name'],'resourceId':_0x1865f7['id'],'type':_0x3f8c26[_0x65b6('0x26')],'sectionId':_0x3f8c26['id']},{})['then'](function(){return _0x314c63;});}else{return _0x314c63;}})[_0x65b6('0x43')](function(_0xc62282){logger[_0x65b6('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc62282);throw _0xc62282;});}return _0x314c63;})[_0x65b6('0x1f')](respondWithResult(_0x51f82c,0xc9))['catch'](handleError(_0x51f82c,null));};exports[_0x65b6('0x1e')]=function(_0x503b09,_0x6cb28a){if(_0x503b09['body']['id']){delete _0x503b09['body']['id'];}return db[_0x65b6('0x29')]['find']({'where':{'id':_0x503b09[_0x65b6('0x45')]['id']}})['then'](handleEntityNotFound(_0x6cb28a,null))['then'](saveUpdates(_0x503b09['body'],null))[_0x65b6('0x1f')](respondWithResult(_0x6cb28a,null))[_0x65b6('0x43')](handleError(_0x6cb28a,null));};exports['destroy']=function(_0x4117e6,_0x3cb769){return db['Pause'][_0x65b6('0x47')]({'where':{'id':_0x4117e6[_0x65b6('0x45')]['id']}})[_0x65b6('0x1f')](handleEntityNotFound(_0x3cb769,null))[_0x65b6('0x1f')](removeEntity(_0x3cb769,null))['catch'](handleError(_0x3cb769,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index a26d84c..a5260d3 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 _0x1f3d=['request-promise','./pause.attributes','exports','Pause','tools_pauses','lodash','util'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x1f3d,0x147));var _0xd1f3=function(_0x334038,_0x2792a4){_0x334038=_0x334038-0x0;var _0x39583c=_0x1f3d[_0x334038];return _0x39583c;};'use strict';var _=require(_0xd1f3('0x0'));var util=require(_0xd1f3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd1f3('0x2'));var attributes=require(_0xd1f3('0x3'));module[_0xd1f3('0x4')]=function(_0x2b3526,_0x561e9f){return _0x2b3526['define'](_0xd1f3('0x5'),attributes,{'tableName':_0xd1f3('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe16b=['Pause','tools_pauses','lodash','api','moment','bluebird','./pause.attributes','exports'];(function(_0x18b615,_0x19d318){var _0x1699e7=function(_0x31794){while(--_0x31794){_0x18b615['push'](_0x18b615['shift']());}};_0x1699e7(++_0x19d318);}(_0xe16b,0x1ca));var _0xbe16=function(_0x3fefc7,_0x20a7dc){_0x3fefc7=_0x3fefc7-0x0;var _0x1fe591=_0xe16b[_0x3fefc7];return _0x1fe591;};'use strict';var _=require(_0xbe16('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe16('0x1'));var moment=require(_0xbe16('0x2'));var BPromise=require(_0xbe16('0x3'));var rp=require('request-promise');var attributes=require(_0xbe16('0x4'));module[_0xbe16('0x5')]=function(_0xa1b417,_0x33b92c){return _0xa1b417['define'](_0xbe16('0x6'),attributes,{'tableName':_0xbe16('0x7'),'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 aa3de7c..1ceb8d0 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 _0x25a8=['error','message','result','ShowPause','find','options','raw','where','attributes','include','map','model','then','stringify','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x671cfa,_0x3a609f){var _0x969564=function(_0x9de452){while(--_0x9de452){_0x671cfa['push'](_0x671cfa['shift']());}};_0x969564(++_0x3a609f);}(_0x25a8,0x126));var _0x825a=function(_0x308fea,_0x2d709e){_0x308fea=_0x308fea-0x0;var _0xc39f21=_0x25a8[_0x308fea];return _0xc39f21;};'use strict';var _=require('lodash');var util=require(_0x825a('0x0'));var moment=require(_0x825a('0x1'));var BPromise=require(_0x825a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x825a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x825a('0x4'));var logger=require(_0x825a('0x5'))(_0x825a('0x6'));var config=require(_0x825a('0x7'));var jayson=require(_0x825a('0x8'));var client=jayson[_0x825a('0x9')][_0x825a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29a13c,_0x31be45,_0x215c51){return new BPromise(function(_0x4edb07,_0x13b61d){return client['request'](_0x29a13c,_0x215c51)['then'](function(_0x48696e){logger[_0x825a('0xb')](_0x825a('0xc'),_0x31be45,'request\x20sent');logger[_0x825a('0xd')](_0x825a('0xe'),_0x31be45,_0x825a('0xf'),JSON['stringify'](_0x48696e));if(_0x48696e[_0x825a('0x10')]){if(_0x48696e[_0x825a('0x10')]['code']===0x1f4){logger['error']('Pause,\x20%s,\x20%s',_0x31be45,_0x48696e[_0x825a('0x10')][_0x825a('0x11')]);return _0x13b61d(_0x48696e[_0x825a('0x10')][_0x825a('0x11')]);}logger[_0x825a('0x10')]('Pause,\x20%s,\x20%s',_0x31be45,_0x48696e[_0x825a('0x10')][_0x825a('0x11')]);return _0x4edb07(_0x48696e[_0x825a('0x10')][_0x825a('0x11')]);}else{logger[_0x825a('0xb')](_0x825a('0xc'),_0x31be45,_0x825a('0xf'));_0x4edb07(_0x48696e[_0x825a('0x12')][_0x825a('0x11')]);}})['catch'](function(_0x77b603){logger['error'](_0x825a('0xc'),_0x31be45,_0x77b603);_0x13b61d(_0x77b603);});});}exports[_0x825a('0x13')]=function(_0x4a65b6){var _0x364bd1=this;return new Promise(function(_0x5ad432,_0x1007e3){return db['Pause'][_0x825a('0x14')]({'raw':_0x4a65b6[_0x825a('0x15')]?_0x4a65b6[_0x825a('0x15')][_0x825a('0x16')]===undefined?!![]:![]:!![],'where':_0x4a65b6[_0x825a('0x15')]?_0x4a65b6[_0x825a('0x15')][_0x825a('0x17')]||null:null,'attributes':_0x4a65b6['options']?_0x4a65b6['options'][_0x825a('0x18')]||null:null,'include':_0x4a65b6[_0x825a('0x15')]?_0x4a65b6['options'][_0x825a('0x19')]?_[_0x825a('0x1a')](_0x4a65b6[_0x825a('0x15')][_0x825a('0x19')],function(_0x105cd7){return{'model':db[_0x105cd7[_0x825a('0x1b')]],'as':_0x105cd7['as'],'attributes':_0x105cd7[_0x825a('0x18')],'include':_0x105cd7[_0x825a('0x19')]?_[_0x825a('0x1a')](_0x105cd7[_0x825a('0x19')],function(_0x44f27c){return{'model':db[_0x44f27c[_0x825a('0x1b')]],'as':_0x44f27c['as'],'attributes':_0x44f27c['attributes'],'include':_0x44f27c[_0x825a('0x19')]?_['map'](_0x44f27c['include'],function(_0xde39a){return{'model':db[_0xde39a[_0x825a('0x1b')]],'as':_0xde39a['as'],'attributes':_0xde39a['attributes']};}):[]};}):[]};}):[]:[]})[_0x825a('0x1c')](function(_0x4aa885){logger[_0x825a('0xb')](_0x825a('0x13'),_0x4a65b6);logger[_0x825a('0xd')](_0x825a('0x13'),_0x4a65b6,JSON[_0x825a('0x1d')](_0x4aa885));_0x5ad432(_0x4aa885);})[_0x825a('0x1e')](function(_0x5494a0){logger[_0x825a('0x10')]('ShowPause',_0x5494a0[_0x825a('0x11')],_0x4a65b6);_0x1007e3(_0x364bd1[_0x825a('0x10')](0x1f4,_0x5494a0['message']));});});}; \ No newline at end of file +var _0x7070=['map','model','attributes','ShowPause','stringify','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','result','Pause','find','options','raw','where','include'];(function(_0x168018,_0x48a279){var _0x4fe004=function(_0x2cf7fd){while(--_0x2cf7fd){_0x168018['push'](_0x168018['shift']());}};_0x4fe004(++_0x48a279);}(_0x7070,0x1d7));var _0x0707=function(_0x22f001,_0x53482b){_0x22f001=_0x22f001-0x0;var _0x58a701=_0x7070[_0x22f001];return _0x58a701;};'use strict';var _=require('lodash');var util=require(_0x0707('0x0'));var moment=require('moment');var BPromise=require(_0x0707('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0707('0x2'))['db'];var utils=require(_0x0707('0x3'));var logger=require(_0x0707('0x4'))(_0x0707('0x5'));var config=require('../../config/environment');var jayson=require(_0x0707('0x6'));var client=jayson[_0x0707('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49c759,_0x2e2dc0,_0x591e4c){return new BPromise(function(_0x5777eb,_0x170332){return client[_0x0707('0x8')](_0x49c759,_0x591e4c)[_0x0707('0x9')](function(_0x36cc62){logger[_0x0707('0xa')](_0x0707('0xb'),_0x2e2dc0,_0x0707('0xc'));logger[_0x0707('0xd')](_0x0707('0xe'),_0x2e2dc0,_0x0707('0xc'),JSON['stringify'](_0x36cc62));if(_0x36cc62[_0x0707('0xf')]){if(_0x36cc62['error'][_0x0707('0x10')]===0x1f4){logger['error'](_0x0707('0xb'),_0x2e2dc0,_0x36cc62[_0x0707('0xf')][_0x0707('0x11')]);return _0x170332(_0x36cc62[_0x0707('0xf')][_0x0707('0x11')]);}logger[_0x0707('0xf')](_0x0707('0xb'),_0x2e2dc0,_0x36cc62[_0x0707('0xf')][_0x0707('0x11')]);return _0x5777eb(_0x36cc62[_0x0707('0xf')]['message']);}else{logger['info'](_0x0707('0xb'),_0x2e2dc0,_0x0707('0xc'));_0x5777eb(_0x36cc62[_0x0707('0x12')][_0x0707('0x11')]);}})['catch'](function(_0x17b571){logger[_0x0707('0xf')](_0x0707('0xb'),_0x2e2dc0,_0x17b571);_0x170332(_0x17b571);});});}exports['ShowPause']=function(_0x13d5de){var _0x5e8489=this;return new Promise(function(_0x471431,_0x529363){return db[_0x0707('0x13')][_0x0707('0x14')]({'raw':_0x13d5de[_0x0707('0x15')]?_0x13d5de[_0x0707('0x15')][_0x0707('0x16')]===undefined?!![]:![]:!![],'where':_0x13d5de['options']?_0x13d5de[_0x0707('0x15')][_0x0707('0x17')]||null:null,'attributes':_0x13d5de[_0x0707('0x15')]?_0x13d5de['options']['attributes']||null:null,'include':_0x13d5de['options']?_0x13d5de[_0x0707('0x15')][_0x0707('0x18')]?_[_0x0707('0x19')](_0x13d5de['options']['include'],function(_0x228c33){return{'model':db[_0x228c33[_0x0707('0x1a')]],'as':_0x228c33['as'],'attributes':_0x228c33[_0x0707('0x1b')],'include':_0x228c33[_0x0707('0x18')]?_[_0x0707('0x19')](_0x228c33[_0x0707('0x18')],function(_0x16f659){return{'model':db[_0x16f659[_0x0707('0x1a')]],'as':_0x16f659['as'],'attributes':_0x16f659[_0x0707('0x1b')],'include':_0x16f659[_0x0707('0x18')]?_[_0x0707('0x19')](_0x16f659[_0x0707('0x18')],function(_0x5d72c7){return{'model':db[_0x5d72c7[_0x0707('0x1a')]],'as':_0x5d72c7['as'],'attributes':_0x5d72c7[_0x0707('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0707('0x9')](function(_0x3c6ee1){logger['info'](_0x0707('0x1c'),_0x13d5de);logger[_0x0707('0xd')](_0x0707('0x1c'),_0x13d5de,JSON[_0x0707('0x1d')](_0x3c6ee1));_0x471431(_0x3c6ee1);})[_0x0707('0x1e')](function(_0x599090){logger[_0x0707('0xf')](_0x0707('0x1c'),_0x599090[_0x0707('0x11')],_0x13d5de);_0x529363(_0x5e8489[_0x0707('0xf')](0x1f4,_0x599090['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d68c3f2..159aca7 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 _0xe2f1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xe2f1,0x8a));var _0x1e2f=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0xe2f1[_0x254b22];return _0x1279db;};'use strict';var multer=require(_0x1e2f('0x0'));var util=require(_0x1e2f('0x1'));var path=require(_0x1e2f('0x2'));var timeout=require(_0x1e2f('0x3'));var express=require(_0x1e2f('0x4'));var router=express[_0x1e2f('0x5')]();var auth=require(_0x1e2f('0x6'));var interaction=require(_0x1e2f('0x7'));var config=require(_0x1e2f('0x8'));var controller=require(_0x1e2f('0x9'));router[_0x1e2f('0xa')]('/',auth[_0x1e2f('0xb')](),controller[_0x1e2f('0xc')]);router[_0x1e2f('0xa')]('/webhook',controller[_0x1e2f('0xd')]);router[_0x1e2f('0xa')](_0x1e2f('0xe'),auth[_0x1e2f('0xb')](),controller[_0x1e2f('0xf')]);router['get'](_0x1e2f('0x10'),auth[_0x1e2f('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x1e2f('0x11')]({'destination':function(_0x1a7a83,_0x298afa,_0x30f9cd){_0x30f9cd(null,path[_0x1e2f('0x12')](config[_0x1e2f('0x13')],_0x1e2f('0x14')));},'filename':function(_0x4d8ce3,_0x2cd9ec,_0x4bffdc){_0x2cd9ec[_0x1e2f('0x15')]=_0x2cd9ec[_0x1e2f('0x15')][_0x1e2f('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bffdc(null,util[_0x1e2f('0x17')](_0x1e2f('0x18'),path[_0x1e2f('0x19')](_0x2cd9ec['originalname'],path[_0x1e2f('0x1a')](_0x2cd9ec[_0x1e2f('0x15')])),Date[_0x1e2f('0x1b')](),path[_0x1e2f('0x1a')](_0x2cd9ec[_0x1e2f('0x15')])));}})});router[_0x1e2f('0x1c')]('/',upload[_0x1e2f('0x1d')](_0x1e2f('0x1e')),controller[_0x1e2f('0x1f')]);router[_0x1e2f('0x1c')]('/webhook',controller[_0x1e2f('0x20')]);router[_0x1e2f('0x21')](_0x1e2f('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1e2f('0x22')]('/:id',auth['isAuthenticated'](),controller[_0x1e2f('0x22')]);module[_0x1e2f('0x23')]=router; \ No newline at end of file +var _0x467f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','webhookGet','/:id','isAuthenticated','show','/:id/download','download','join','root','server/files/plugins','originalname','format','%s-%s%s','now','extname','post','single','file','upload','webhookPost','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x467f,0x11a));var _0xf467=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x467f[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require(_0xf467('0x0'));var util=require(_0xf467('0x1'));var path=require(_0xf467('0x2'));var timeout=require(_0xf467('0x3'));var express=require(_0xf467('0x4'));var router=express[_0xf467('0x5')]();var auth=require(_0xf467('0x6'));var interaction=require(_0xf467('0x7'));var config=require(_0xf467('0x8'));var controller=require('./plugin.controller');router[_0xf467('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf467('0x9')]('/webhook',controller[_0xf467('0xa')]);router[_0xf467('0x9')](_0xf467('0xb'),auth[_0xf467('0xc')](),controller[_0xf467('0xd')]);router[_0xf467('0x9')](_0xf467('0xe'),auth[_0xf467('0xc')](),controller[_0xf467('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2542f2,_0x1a9954,_0x2da913){_0x2da913(null,path[_0xf467('0x10')](config[_0xf467('0x11')],_0xf467('0x12')));},'filename':function(_0x454af0,_0x2ab6d4,_0x431c57){_0x2ab6d4[_0xf467('0x13')]=_0x2ab6d4['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x431c57(null,util[_0xf467('0x14')](_0xf467('0x15'),path['basename'](_0x2ab6d4[_0xf467('0x13')],path['extname'](_0x2ab6d4[_0xf467('0x13')])),Date[_0xf467('0x16')](),path[_0xf467('0x17')](_0x2ab6d4[_0xf467('0x13')])));}})});router[_0xf467('0x18')]('/',upload[_0xf467('0x19')](_0xf467('0x1a')),controller[_0xf467('0x1b')]);router[_0xf467('0x18')]('/webhook',controller[_0xf467('0x1c')]);router[_0xf467('0x1d')]('/:id',auth[_0xf467('0xc')](),controller['update']);router[_0xf467('0x1e')](_0xf467('0xb'),auth[_0xf467('0xc')](),controller['delete']);module[_0xf467('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a735ac5..a066132 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 _0x3c93=['html','script','TEXT','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.','sequelize','exports','STRING','ENUM'];(function(_0x22892f,_0x5338c1){var _0x262da1=function(_0x4bd21e){while(--_0x4bd21e){_0x22892f['push'](_0x22892f['shift']());}};_0x262da1(++_0x5338c1);}(_0x3c93,0x19c));var _0x33c9=function(_0x353d6a,_0x44c397){_0x353d6a=_0x353d6a-0x0;var _0x48f66c=_0x3c93[_0x353d6a];return _0x48f66c;};'use strict';var Sequelize=require(_0x33c9('0x0'));module[_0x33c9('0x1')]={'name':{'type':Sequelize[_0x33c9('0x2')]},'type':{'type':Sequelize[_0x33c9('0x3')](_0x33c9('0x4'),_0x33c9('0x5'))},'description':{'type':Sequelize[_0x33c9('0x6')]},'version':{'type':Sequelize[_0x33c9('0x6')]},'path':{'type':Sequelize[_0x33c9('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x33c9('0x7')},'sidebar':{'type':Sequelize[_0x33c9('0x3')](_0x33c9('0x8'),_0x33c9('0x9'),_0x33c9('0xa'),_0x33c9('0xb')),'defaultValue':'always','comment':_0x33c9('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x33c9('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x33c9('0x2')]},'scriptPath':{'type':Sequelize[_0x33c9('0x2')]}}; \ No newline at end of file +var _0x2137=['STRING','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','never','always','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2137,0x134));var _0x7213=function(_0x5e49de,_0x1d3dd9){_0x5e49de=_0x5e49de-0x0;var _0x328849=_0x2137[_0x5e49de];return _0x328849;};'use strict';var Sequelize=require(_0x7213('0x0'));module[_0x7213('0x1')]={'name':{'type':Sequelize[_0x7213('0x2')]},'type':{'type':Sequelize['ENUM']('html',_0x7213('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x7213('0x4')]},'path':{'type':Sequelize[_0x7213('0x2')],'comment':_0x7213('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x7213('0x6'),_0x7213('0x7'),'always',_0x7213('0x8')),'defaultValue':_0x7213('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x7213('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x7213('0x2')]},'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 f4cd9b6..1c818e7 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 _0x0020=['isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','test','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','extract-zip','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','destroy','get','error','stack','name','send','Plugin','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','type','key','field','options','rows','show','params','length','include','find','catch','join','root','server/files/plugins','format','%s.zip','basename','warning','code','Error','Sequelize','pipe','glob','**/*','dirname','path','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','filename','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync'];(function(_0x49f5bf,_0x555e3b){var _0x175a57=function(_0x364a71){while(--_0x364a71){_0x49f5bf['push'](_0x49f5bf['shift']());}};_0x175a57(++_0x555e3b);}(_0x0020,0xd3));var _0x0002=function(_0x56355a,_0x138baf){_0x56355a=_0x56355a-0x0;var _0x573afa=_0x0020[_0x56355a];return _0x573afa;};'use strict';var pdf=require(_0x0002('0x0'));var emlformat=require(_0x0002('0x1'));var rimraf=require(_0x0002('0x2'));var zipdir=require(_0x0002('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0002('0x4'));var moment=require(_0x0002('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0002('0x6'));var util=require(_0x0002('0x7'));var path=require('path');var sox=require(_0x0002('0x8'));var csv=require(_0x0002('0x9'));var ejs=require(_0x0002('0xa'));var fs=require('fs');var _=require(_0x0002('0xb'));var squel=require(_0x0002('0xc'));var crypto=require(_0x0002('0xd'));var jsforce=require(_0x0002('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0002('0x9'));var querystring=require('querystring');var Papa=require(_0x0002('0xf'));var authService=require(_0x0002('0x10'));var hardwareService=require(_0x0002('0x11'));var Redis=require(_0x0002('0x12'));var extract=require(_0x0002('0x13'));var rimraf=require(_0x0002('0x2'));var archiver=require('archiver');var qs=require('../../components/parsers/qs');var logger=require(_0x0002('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0002('0x15'))['db'];config[_0x0002('0x16')]=_[_0x0002('0x17')](config[_0x0002('0x16')],{'host':_0x0002('0x18'),'port':0x18eb});var socket=require(_0x0002('0x19'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x538bf7,_0x22e939){_0x22e939=_0x22e939||0xcc;return function(_0x155975){if(_0x155975){return _0x538bf7[_0x0002('0x1a')](_0x22e939);}return _0x538bf7[_0x0002('0x1b')](_0x22e939)[_0x0002('0x1c')]();};}function respondWithResult(_0x2d60ca,_0x8c3c6e){_0x8c3c6e=_0x8c3c6e||0xc8;return function(_0x474683){if(_0x474683){return _0x2d60ca[_0x0002('0x1b')](_0x8c3c6e)[_0x0002('0x1d')](_0x474683);}};}function respondWithFilteredResult(_0x5529f4,_0x4c659d){return function(_0xc1be6f){if(_0xc1be6f){var _0x2986e0=_0xc1be6f[_0x0002('0x1e')],_0x31de3d=_0x4c659d[_0x0002('0x1f')],_0x10d1de=_0x4c659d[_0x0002('0x1f')]+_0x4c659d['limit'],_0x297a77;if(_0x10d1de>=_0x2986e0){_0x10d1de=_0x2986e0;_0x297a77=0xc8;}else{_0x297a77=0xce;}_0x5529f4['status'](_0x297a77);return _0x5529f4[_0x0002('0x20')](_0x0002('0x21'),_0x31de3d+'-'+_0x10d1de+'/'+_0x2986e0)[_0x0002('0x1d')](_0xc1be6f);}return null;};}function patchUpdates(_0x1cc758){return function(_0x448b4d){try{jsonpatch['apply'](_0x448b4d,_0x1cc758,!![]);}catch(_0x5f3c45){return BPromise[_0x0002('0x22')](_0x5f3c45);}return _0x448b4d[_0x0002('0x23')]();};}function saveUpdates(_0x47e2c8,_0x14e887){return function(_0x2c7d27){if(_0x2c7d27){return _0x2c7d27['update'](_0x47e2c8)[_0x0002('0x24')](function(_0x1bb281){return _0x1bb281;});}return null;};}function removeEntity(_0x433ca3,_0x2ddb72){return function(_0x3a5215){if(_0x3a5215){return _0x3a5215[_0x0002('0x25')]()[_0x0002('0x24')](function(){var _0x5711c5=_0x3a5215[_0x0002('0x26')]({'plain':!![]});var _0x3c0d3b='Plugins';return db['UserProfileResource']['destroy']({'where':{'type':_0x3c0d3b,'resourceId':_0x5711c5['id']}})['then'](function(){return _0x3a5215;});})['then'](function(){_0x433ca3[_0x0002('0x1b')](0xcc)[_0x0002('0x1c')]();});}};}function handleEntityNotFound(_0x36a524,_0x39ab61){return function(_0x1add0e){if(!_0x1add0e){_0x36a524[_0x0002('0x1a')](0x194);}return _0x1add0e;};}function handleError(_0x40ea27,_0x2cdd8c){_0x2cdd8c=_0x2cdd8c||0x1f4;return function(_0xbc2754){logger[_0x0002('0x27')](_0xbc2754[_0x0002('0x28')]);if(_0xbc2754['name']){delete _0xbc2754[_0x0002('0x29')];}_0x40ea27[_0x0002('0x1b')](_0x2cdd8c)[_0x0002('0x2a')](_0xbc2754);};}exports['index']=function(_0x564024,_0x4cb5b5){var _0x14d2a7={},_0x48d520={},_0x35f581={'count':0x0,'rows':[]};var _0x506734=db[_0x0002('0x2b')][_0x0002('0x2c')];_0x48d520[_0x0002('0x2d')]=_[_0x0002('0x2e')](_0x506734);_0x48d520[_0x0002('0x2f')]=_[_0x0002('0x2e')](_0x564024[_0x0002('0x2f')]);_0x48d520['filters']=_[_0x0002('0x30')](_0x48d520[_0x0002('0x2d')],_0x48d520[_0x0002('0x2f')]);_0x14d2a7[_0x0002('0x31')]=_['intersection'](_0x48d520['model'],qs[_0x0002('0x32')](_0x564024['query'][_0x0002('0x32')]));_0x14d2a7[_0x0002('0x31')]=_0x14d2a7[_0x0002('0x31')]['length']?_0x14d2a7['attributes']:_0x48d520['model'];if(!_0x564024[_0x0002('0x2f')][_0x0002('0x33')](_0x0002('0x34'))){_0x14d2a7['limit']=qs['limit'](_0x564024[_0x0002('0x2f')][_0x0002('0x35')]);_0x14d2a7['offset']=qs[_0x0002('0x1f')](_0x564024[_0x0002('0x2f')][_0x0002('0x1f')]);}_0x14d2a7[_0x0002('0x36')]=qs['sort'](_0x564024[_0x0002('0x2f')][_0x0002('0x37')]);_0x14d2a7[_0x0002('0x38')]=qs[_0x0002('0x39')](_[_0x0002('0x3a')](_0x564024[_0x0002('0x2f')],_0x48d520[_0x0002('0x39')]));if(_0x564024[_0x0002('0x2f')][_0x0002('0x3b')]){_0x14d2a7['where']=_[_0x0002('0x3c')](_0x14d2a7[_0x0002('0x38')],{'$or':_[_0x0002('0x3d')](_0x506734,function(_0x5f28fc){if(_0x5f28fc[_0x0002('0x3e')][_0x0002('0x3f')]!=='VIRTUAL'){var _0x41b605={};_0x41b605[_0x5f28fc[_0x0002('0x40')]]={'$like':'%'+_0x564024[_0x0002('0x2f')][_0x0002('0x3b')]+'%'};return _0x41b605;}})});}_0x14d2a7=_[_0x0002('0x3c')]({},_0x14d2a7,_0x564024[_0x0002('0x41')]);var _0x57300f={'where':_0x14d2a7[_0x0002('0x38')]};return db['Plugin'][_0x0002('0x1e')](_0x57300f)[_0x0002('0x24')](function(_0x3a2788){_0x35f581['count']=_0x3a2788;if(_0x564024['query']['includeAll']){_0x14d2a7['include']=[{'all':!![]}];}return db['Plugin']['findAll'](_0x14d2a7);})['then'](function(_0x441059){_0x35f581[_0x0002('0x42')]=_0x441059;return _0x35f581;})[_0x0002('0x24')](respondWithFilteredResult(_0x4cb5b5,_0x14d2a7))['catch'](handleError(_0x4cb5b5,null));};exports[_0x0002('0x43')]=function(_0x279c44,_0x1863e5){var _0x3a35aa={'raw':!![],'where':{'id':_0x279c44[_0x0002('0x44')]['id']}},_0x4b418e={};_0x4b418e['model']=_[_0x0002('0x2e')](db['Plugin'][_0x0002('0x2c')]);_0x4b418e[_0x0002('0x2f')]=_[_0x0002('0x2e')](_0x279c44[_0x0002('0x2f')]);_0x4b418e[_0x0002('0x39')]=_['intersection'](_0x4b418e[_0x0002('0x2d')],_0x4b418e['query']);_0x3a35aa[_0x0002('0x31')]=_[_0x0002('0x30')](_0x4b418e[_0x0002('0x2d')],qs[_0x0002('0x32')](_0x279c44['query'][_0x0002('0x32')]));_0x3a35aa[_0x0002('0x31')]=_0x3a35aa[_0x0002('0x31')][_0x0002('0x45')]?_0x3a35aa[_0x0002('0x31')]:_0x4b418e[_0x0002('0x2d')];if(_0x279c44['query']['includeAll']){_0x3a35aa[_0x0002('0x46')]=[{'all':!![]}];}_0x3a35aa=_[_0x0002('0x3c')]({},_0x3a35aa,_0x279c44['options']);return db[_0x0002('0x2b')][_0x0002('0x47')](_0x3a35aa)[_0x0002('0x24')](handleEntityNotFound(_0x1863e5,null))[_0x0002('0x24')](respondWithResult(_0x1863e5,null))[_0x0002('0x48')](handleError(_0x1863e5,null));};exports['download']=function(_0x18a421,_0x2b9e02,_0x1d1709){return db[_0x0002('0x2b')]['find']({'where':{'id':_0x18a421[_0x0002('0x44')]['id']},'attributes':[_0x0002('0x29'),'path'],'raw':!![]})[_0x0002('0x24')](handleEntityNotFound(_0x2b9e02,null))[_0x0002('0x24')](function(_0x57fe85){if(_0x57fe85){var _0x32e932=path[_0x0002('0x49')](config[_0x0002('0x4a')],_0x0002('0x4b'),util[_0x0002('0x4c')](_0x0002('0x4d'),path[_0x0002('0x4e')](_0x57fe85['path'])));var _0x1fc2e0=fs['createWriteStream'](_0x32e932);var _0x11ae3d=archiver('zip',{'zlib':{'level':0x9}});_0x11ae3d['on'](_0x0002('0x4f'),function(_0x1c0627){if(_0x1c0627[_0x0002('0x50')]==='ENOENT'){logger[_0x0002('0x27')](_0x1c0627);}else{throw new db['Sequelize'][(_0x0002('0x51'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x11ae3d['on'](_0x0002('0x27'),function(_0x3b9113){throw new db[(_0x0002('0x52'))][(_0x0002('0x51'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x11ae3d[_0x0002('0x53')](_0x1fc2e0);_0x11ae3d[_0x0002('0x54')](_0x0002('0x55'),{'cwd':path['join'](config[_0x0002('0x4a')],_0x0002('0x4b'),path[_0x0002('0x56')](_0x57fe85['path'])),'ignore':[path['join'](path['basename'](_0x57fe85['path']),'node_modules/**/*'),path['join'](path[_0x0002('0x4e')](_0x57fe85[_0x0002('0x57')]),_0x0002('0x58'))],'nodir':!![]})[_0x0002('0x59')]();_0x1fc2e0['on'](_0x0002('0x5a'),function(){if(!fs[_0x0002('0x5b')](_0x32e932)){throw new db[(_0x0002('0x52'))][(_0x0002('0x51'))](_0x0002('0x5c'));}return _0x2b9e02[_0x0002('0x5d')](_0x32e932,util[_0x0002('0x4c')](_0x0002('0x4d'),path[_0x0002('0x4e')](_0x57fe85[_0x0002('0x57')])),function(_0x4b898c){if(_0x4b898c){throw new db['Sequelize'][(_0x0002('0x51'))](_0x0002('0x5e'));}fs['unlinkSync'](_0x32e932);logger[_0x0002('0x5f')](_0x0002('0x60'));logger[_0x0002('0x5f')](_0x0002('0x61'));});});}return null;})['catch'](handleError(_0x2b9e02,null));};exports['upload']=function(_0x4a3d6f,_0x51f5ab,_0x181d6a){var _0x3a44e8=path[_0x0002('0x4e')](_0x4a3d6f['file']['filename'],path['extname'](_0x4a3d6f['file'][_0x0002('0x62')]));var _0x511ceb=path['join'](config[_0x0002('0x4a')],_0x0002('0x4b'),_0x4a3d6f[_0x0002('0x63')][_0x0002('0x62')]);var _0x14715c=path[_0x0002('0x49')](config[_0x0002('0x4a')],'server/files/plugins',_0x3a44e8);logger[_0x0002('0x5f')](_0x0002('0x64'),_0x511ceb);logger[_0x0002('0x5f')](_0x0002('0x65'),_0x14715c);try{fs['chmodSync'](_0x511ceb,parseInt('0777',0x8));extract(_0x511ceb,{'dir':_0x14715c},function(_0x63c707){if(_0x63c707){logger[_0x0002('0x27')](_0x63c707);handleError(_0x63c707,!![]);};var _0x4c6b9b=fs[_0x0002('0x66')](_0x14715c);if(_0x4c6b9b['length']>0x1){removeReferences(_0x511ceb,_0x14715c);logger[_0x0002('0x27')](_0x0002('0x67'));return _0x181d6a(new Error('Invalid\x20plugin\x20structure'));}var _0x2e5523=fs[_0x0002('0x68')](path['join'](_0x14715c,_0x4c6b9b[0x0]));if(_0x2e5523[_0x0002('0x69')]()){removeReferences(_0x511ceb,_0x14715c);logger['error'](_0x0002('0x67'));return _0x181d6a(new Error(_0x0002('0x67')));}if(_0x2e5523[_0x0002('0x6a')]()){var _0x570dea=fs[_0x0002('0x66')](path[_0x0002('0x49')](_0x14715c,_0x4c6b9b[0x0]));if(_0x570dea[_0x0002('0x45')]===0x0){removeReferences(_0x511ceb,_0x14715c);logger[_0x0002('0x27')](_0x0002('0x67'));return _0x181d6a(new Error(_0x0002('0x67')));}var _0x510d5e=_0x570dea['some'](function(_0xb4ca2f){return _0xb4ca2f===_0x0002('0x6b');});if(!_0x510d5e){return _0x181d6a(new Error(_0x0002('0x6c')));}var _0x1a9fdf=fs[_0x0002('0x6d')](path[_0x0002('0x49')](_0x14715c,_0x4c6b9b[0x0],_0x0002('0x6b')));var _0xfb969c=JSON[_0x0002('0x6e')](_0x1a9fdf);if(_0x0002('0x6f')==typeof _0xfb969c[_0x0002('0x29')]){return _0x181d6a(new Error(_0x0002('0x70')));}if(_0x0002('0x6f')==typeof _0xfb969c[_0x0002('0x3e')]){return _0x181d6a(new Error(_0x0002('0x71')));}if('undefined'==typeof _0xfb969c['version']){return _0x181d6a(new Error(_0x0002('0x72')));}if(_0x0002('0x6f')==typeof _0xfb969c[_0x0002('0x73')]){return _0x181d6a(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0xfb969c[_0x0002('0x3e')]===_0x0002('0x74')){if(_0x0002('0x6f')==typeof _0xfb969c[_0x0002('0x73')][_0x0002('0x75')]){return _0x181d6a(new Error(_0x0002('0x76')));}if(_0x0002('0x6f')==typeof _0xfb969c['parameters'][_0x0002('0x75')][_0x0002('0x77')]&&'undefined'==typeof _0xfb969c[_0x0002('0x73')][_0x0002('0x75')][_0x0002('0x78')]){return _0x181d6a(new Error(_0x0002('0x79')));}}else if(_0xfb969c[_0x0002('0x3e')]==='script'){if(_0x0002('0x6f')==typeof _0xfb969c[_0x0002('0x73')][_0x0002('0x7a')]){return _0x181d6a(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0xfb969c['parameters'][_0x0002('0x7b')]){return _0x181d6a(new Error(_0x0002('0x7c')));}}else{return _0x181d6a(new Error(_0x0002('0x7d')));}var _0x587b01=_0xfb969c['name'];var _0x146dc5=_0xfb969c['description'];var _0x3923bf=_0xfb969c[_0x0002('0x3e')];var _0x398213=_0xfb969c[_0x0002('0x7e')]?_0xfb969c[_0x0002('0x7e')]:_0x0002('0x7f');var _0x154139=_0xfb969c[_0x0002('0x80')]?_0xfb969c[_0x0002('0x80')]:_0x0002('0x81');var _0x2a9fdc='';var _0x2e0a42='';var _0x5e870f='';var _0x12497a='';var _0xdb9571=_0xfb969c['version'];if(_0x3923bf==='html'){if(_0x0002('0x6f')!=typeof _0xfb969c[_0x0002('0x73')][_0x0002('0x75')][_0x0002('0x77')]){var _0x150797=_0xfb969c[_0x0002('0x73')][_0x0002('0x75')][_0x0002('0x77')];if(!/^(f|ht)tps?:\/\//i['test'](_0x150797)){_0x2a9fdc=path[_0x0002('0x49')](_0x0002('0x82'),_0x3a44e8,_0x4c6b9b[0x0],_0x150797);}else{_0x2a9fdc=_0x150797;}}else{logger[_0x0002('0x5f')](_0x0002('0x83'));}if(_0x0002('0x6f')!=typeof _0xfb969c['parameters'][_0x0002('0x75')][_0x0002('0x78')]){var _0x3a48c3=_0xfb969c[_0x0002('0x73')][_0x0002('0x75')][_0x0002('0x78')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3a48c3)){_0x2e0a42=path['join']('plugins',_0x3a44e8,_0x4c6b9b[0x0],_0x3a48c3);}else{_0x2e0a42=_0x3a48c3;}}else{logger[_0x0002('0x5f')](_0x0002('0x84'));}}else if(_0x3923bf===_0x0002('0x85')){_0x5e870f=_0xfb969c[_0x0002('0x73')][_0x0002('0x7a')];_0x12497a=_0xfb969c['parameters'][_0x0002('0x7b')];if('undefined'!=typeof _0xfb969c['parameters'][_0x0002('0x75')]){if(_0x0002('0x6f')!=typeof _0xfb969c[_0x0002('0x73')][_0x0002('0x75')][_0x0002('0x77')]){var _0x150797=_0xfb969c[_0x0002('0x73')][_0x0002('0x75')][_0x0002('0x77')];if(!/^(f|ht)tps?:\/\//i[_0x0002('0x86')](_0x150797)){_0x2a9fdc=path['join'](_0x0002('0x82'),_0x3a44e8,_0x4c6b9b[0x0],_0x150797);}else{_0x2a9fdc=_0x150797;}}if(_0x0002('0x6f')!=typeof _0xfb969c[_0x0002('0x73')][_0x0002('0x75')][_0x0002('0x78')]){var _0x3a48c3=_0xfb969c[_0x0002('0x73')][_0x0002('0x75')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x0002('0x86')](_0x3a48c3)){_0x2e0a42=path[_0x0002('0x49')](_0x0002('0x82'),_0x3a44e8,_0x4c6b9b[0x0],_0x3a48c3);}else{_0x2e0a42=_0x3a48c3;}}}}var _0x644419={'name':_0x587b01,'description':_0x146dc5,'path':path[_0x0002('0x49')](_0x3a44e8,_0x4c6b9b[0x0]),'type':_0x3923bf,'sidebar':_0x398213,'icon':_0x154139,'adminUrl':_0x2a9fdc,'agentUrl':_0x2e0a42,'scriptName':_0x5e870f,'scriptPath':_0x12497a,'version':_0xdb9571};removeReferences(_0x511ceb,null);return db[_0x0002('0x2b')][_0x0002('0x87')](_0x644419)[_0x0002('0x24')](function(_0x35b9d4){var _0x196604={'role':_0x4a3d6f['body'][_0x0002('0x88')],'userProfileId':_0x4a3d6f[_0x0002('0x89')][_0x0002('0x8a')]};if(!_0x196604)throw new Error(_0x0002('0x8b'));if(_0x196604['role']==='user'){var _0x148f93=_0x35b9d4[_0x0002('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x0002('0x47')]({'where':{'name':'Plugins','userProfileId':_0x196604[_0x0002('0x8a')]},'raw':!![]})[_0x0002('0x24')](function(_0x573cd8){if(_0x573cd8&&_0x573cd8['autoAssociation']===0x0){return db[_0x0002('0x8c')][_0x0002('0x87')]({'name':_0x148f93[_0x0002('0x29')],'resourceId':_0x148f93['id'],'type':_0x573cd8[_0x0002('0x29')],'sectionId':_0x573cd8['id']},{})[_0x0002('0x24')](function(){return _0x35b9d4;});}else{return _0x35b9d4;}})[_0x0002('0x48')](function(_0x1ddc29){logger[_0x0002('0x27')](_0x0002('0x8d'),_0x1ddc29);throw _0x1ddc29;});}return _0x35b9d4;})[_0x0002('0x24')](respondWithResult(_0x51f5ab,null))[_0x0002('0x48')](handleError(_0x51f5ab,null));}});}catch(_0x219afd){_0x51f5ab['status'](0x1f4)[_0x0002('0x2a')](_0x219afd);}};function removeReferences(_0xbfce76,_0x22cf94){try{if(_0xbfce76){fs[_0x0002('0x8e')](_0xbfce76);logger[_0x0002('0x5f')]('Zip\x20archive\x20removed');}if(_0x22cf94){rimraf(_0x22cf94,function(){});logger[_0x0002('0x5f')](_0x0002('0x8f'));}}catch(_0x3e53a5){logger[_0x0002('0x27')](_0x3e53a5);}}exports['update']=function(_0x283494,_0x36dee1,_0x158bad){return db[_0x0002('0x2b')][_0x0002('0x47')]({'where':{'id':_0x283494[_0x0002('0x44')]['id']}})[_0x0002('0x24')](handleEntityNotFound(_0x36dee1,null))['then'](saveUpdates(_0x283494['body'],null))[_0x0002('0x24')](respondWithResult(_0x36dee1,null))[_0x0002('0x48')](handleError(_0x36dee1,null));};exports[_0x0002('0x90')]=function(_0x126e7a,_0x32d2fc,_0xeae70){return db['Plugin'][_0x0002('0x47')]({'where':{'id':_0x126e7a[_0x0002('0x44')]['id']}})['then'](function(_0x29ca6d){if(_0x29ca6d){return _0x29ca6d[_0x0002('0x25')]();}})[_0x0002('0x24')](function(_0x303851){rimraf(path[_0x0002('0x49')](config[_0x0002('0x4a')],'server/files/plugins',path['dirname'](_0x303851['path'])),function(){});return _0x303851;})[_0x0002('0x24')](handleEntityNotFound(_0x32d2fc,null))['then'](respondWithStatusCode(_0x32d2fc,null))[_0x0002('0x48')](handleError(_0x32d2fc,null));};exports[_0x0002('0x91')]=function(_0x37709f,_0x3515c2,_0x433ab8){return BPromise[_0x0002('0x92')]()[_0x0002('0x24')](function(){if(!_0x37709f[_0x0002('0x2f')]['path']){throw new Error(_0x0002('0x93'));}if(!_0x37709f['query']['port']){throw new Error(_0x0002('0x94'));}var _0x46877d=_0x37709f[_0x0002('0x2f')][_0x0002('0x95')]?_0x37709f['query']['hostname']+':'+_0x37709f[_0x0002('0x2f')][_0x0002('0x96')]:_0x0002('0x97')+_0x37709f['query'][_0x0002('0x96')];var _0x1c4217=_0x37709f['query']['json']?_0x37709f[_0x0002('0x2f')][_0x0002('0x1d')]:!![];var _0x1493dd=_0x37709f[_0x0002('0x2f')][_0x0002('0x98')]?_0x37709f['query']['encoding']:null;var _0x34405a={'method':_0x37709f[_0x0002('0x99')],'uri':util['format'](_0x0002('0x9a'),_0x46877d,_0x37709f[_0x0002('0x2f')][_0x0002('0x57')]),'json':_0x1c4217,'resolveWithFullResponse':!![],'encoding':_0x1493dd,'qs':_0x37709f[_0x0002('0x2f')]};if(_0x37709f[_0x0002('0x9b')]){_0x34405a[_0x0002('0x9b')]=_0x37709f[_0x0002('0x9b')];if(_0x34405a[_0x0002('0x9b')][_0x0002('0x9c')]){delete _0x34405a['headers'][_0x0002('0x9c')];}}return rp(_0x34405a);})[_0x0002('0x24')](function(_0x309eb5){if(_0x309eb5){_0x3515c2[_0x0002('0x20')](_0x309eb5[_0x0002('0x9b')]);logger['info'](_0x309eb5[_0x0002('0x89')]);if(_['endsWith'](_0x37709f[_0x0002('0x2f')][_0x0002('0x57')],_0x0002('0x5d'))&&_0x309eb5[_0x0002('0x9d')]==0x1f4){return _0x3515c2[_0x0002('0x1a')](_0x309eb5[_0x0002('0x9d')]);}else{return _0x3515c2[_0x0002('0x1b')](_0x309eb5[_0x0002('0x9d')])[_0x0002('0x2a')](_0x309eb5['body']);}}else{return _0x3515c2[_0x0002('0x1a')](0xc8);}})[_0x0002('0x48')](handleError(_0x3515c2,null));};exports['webhookPost']=function(_0x1eeea3,_0xf0ee8a,_0x3dc76f){return BPromise[_0x0002('0x92')]()[_0x0002('0x24')](function(){if(!_0x1eeea3[_0x0002('0x2f')][_0x0002('0x57')]){throw new Error(_0x0002('0x93'));}if(!_0x1eeea3[_0x0002('0x2f')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5a957e=_0x1eeea3[_0x0002('0x2f')][_0x0002('0x95')]?_0x1eeea3['query'][_0x0002('0x95')]+':'+_0x1eeea3[_0x0002('0x2f')][_0x0002('0x96')]:_0x0002('0x97')+_0x1eeea3[_0x0002('0x2f')]['port'];var _0x27e636=_0x1eeea3['query']['json']?_0x1eeea3['query'][_0x0002('0x1d')]:!![];var _0xbd6eb2=_0x1eeea3[_0x0002('0x2f')][_0x0002('0x98')]?_0x1eeea3[_0x0002('0x2f')]['encoding']:null;var _0x59284f={'method':_0x1eeea3['method'],'uri':util[_0x0002('0x4c')](_0x0002('0x9a'),_0x5a957e,_0x1eeea3[_0x0002('0x2f')][_0x0002('0x57')]),'json':_0x27e636,'resolveWithFullResponse':!![],'encoding':_0xbd6eb2,'body':_0x1eeea3[_0x0002('0x89')]};if(_0x1eeea3[_0x0002('0x9b')]){_0x59284f[_0x0002('0x9b')]=_0x1eeea3[_0x0002('0x9b')];if(_0x59284f['headers']['content-length']){delete _0x59284f[_0x0002('0x9b')][_0x0002('0x9c')];}}return rp(_0x59284f);})[_0x0002('0x24')](function(_0x27a4c5){if(_0x27a4c5){_0xf0ee8a[_0x0002('0x20')](_0x27a4c5[_0x0002('0x9b')]);logger[_0x0002('0x5f')](_0x27a4c5[_0x0002('0x89')]);return _0xf0ee8a[_0x0002('0x1b')](_0x27a4c5[_0x0002('0x9d')])[_0x0002('0x2a')](_0x27a4c5['body']);}else{return _0xf0ee8a[_0x0002('0x1a')](0xc8);}})[_0x0002('0x48')](handleError(_0xf0ee8a,null));}; \ No newline at end of file +var _0x42cb=['manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\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:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','endsWith','download','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','end','sendStatus','error','stack','name','send','index','Plugin','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','type','key','VIRTUAL','field','options','includeAll','findAll','show','params','length','include','catch','find','join','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','root','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory'];(function(_0x2dac04,_0x408ef4){var _0x45c2ff=function(_0x118a2e){while(--_0x118a2e){_0x2dac04['push'](_0x2dac04['shift']());}};_0x45c2ff(++_0x408ef4);}(_0x42cb,0x17d));var _0xb42c=function(_0x156c8f,_0x25510b){_0x156c8f=_0x156c8f-0x0;var _0x1d9cd2=_0x42cb[_0x156c8f];return _0x1d9cd2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb42c('0x0'));var zipdir=require(_0xb42c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb42c('0x2'));var moment=require('moment');var BPromise=require(_0xb42c('0x3'));var Mustache=require(_0xb42c('0x4'));var util=require(_0xb42c('0x5'));var path=require(_0xb42c('0x6'));var sox=require(_0xb42c('0x7'));var csv=require(_0xb42c('0x8'));var ejs=require(_0xb42c('0x9'));var fs=require('fs');var _=require(_0xb42c('0xa'));var squel=require('squel');var crypto=require(_0xb42c('0xb'));var jsforce=require(_0xb42c('0xc'));var deskjs=require(_0xb42c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb42c('0xe'));var Papa=require(_0xb42c('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0xb42c('0x10'));var Redis=require('ioredis');var extract=require('extract-zip');var rimraf=require(_0xb42c('0x0'));var archiver=require('archiver');var qs=require(_0xb42c('0x11'));var logger=require(_0xb42c('0x12'))(_0xb42c('0x13'));var utils=require('../../config/utils');var config=require(_0xb42c('0x14'));var db=require(_0xb42c('0x15'))['db'];config[_0xb42c('0x16')]=_[_0xb42c('0x17')](config[_0xb42c('0x16')],{'host':_0xb42c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb42c('0x16')]));require('./plugin.socket')[_0xb42c('0x19')](socket);function respondWithStatusCode(_0xdffb1f,_0x70be38){_0x70be38=_0x70be38||0xcc;return function(_0x6df63e){if(_0x6df63e){return _0xdffb1f['sendStatus'](_0x70be38);}return _0xdffb1f[_0xb42c('0x1a')](_0x70be38)['end']();};}function respondWithResult(_0x4fa4e1,_0x153567){_0x153567=_0x153567||0xc8;return function(_0x415a6f){if(_0x415a6f){return _0x4fa4e1[_0xb42c('0x1a')](_0x153567)[_0xb42c('0x1b')](_0x415a6f);}};}function respondWithFilteredResult(_0x5e2686,_0x6e725b){return function(_0xcc1b3c){if(_0xcc1b3c){var _0x2b79e7=_0xcc1b3c[_0xb42c('0x1c')],_0x3769f6=_0x6e725b[_0xb42c('0x1d')],_0x18a401=_0x6e725b[_0xb42c('0x1d')]+_0x6e725b[_0xb42c('0x1e')],_0x363ae8;if(_0x18a401>=_0x2b79e7){_0x18a401=_0x2b79e7;_0x363ae8=0xc8;}else{_0x363ae8=0xce;}_0x5e2686[_0xb42c('0x1a')](_0x363ae8);return _0x5e2686[_0xb42c('0x1f')](_0xb42c('0x20'),_0x3769f6+'-'+_0x18a401+'/'+_0x2b79e7)['json'](_0xcc1b3c);}return null;};}function patchUpdates(_0x2850c7){return function(_0x3e3de3){try{jsonpatch[_0xb42c('0x21')](_0x3e3de3,_0x2850c7,!![]);}catch(_0x4c807c){return BPromise[_0xb42c('0x22')](_0x4c807c);}return _0x3e3de3[_0xb42c('0x23')]();};}function saveUpdates(_0x216c2e,_0x31b219){return function(_0x23bfd6){if(_0x23bfd6){return _0x23bfd6[_0xb42c('0x24')](_0x216c2e)[_0xb42c('0x25')](function(_0x3b8ff3){return _0x3b8ff3;});}return null;};}function removeEntity(_0x12c9c4,_0x458950){return function(_0x3e19ea){if(_0x3e19ea){return _0x3e19ea[_0xb42c('0x26')]()[_0xb42c('0x25')](function(){var _0x3d68a8=_0x3e19ea[_0xb42c('0x27')]({'plain':!![]});var _0x13bfa3=_0xb42c('0x28');return db['UserProfileResource'][_0xb42c('0x26')]({'where':{'type':_0x13bfa3,'resourceId':_0x3d68a8['id']}})[_0xb42c('0x25')](function(){return _0x3e19ea;});})['then'](function(){_0x12c9c4[_0xb42c('0x1a')](0xcc)[_0xb42c('0x29')]();});}};}function handleEntityNotFound(_0x3cb50d,_0xe61f8b){return function(_0x48c168){if(!_0x48c168){_0x3cb50d[_0xb42c('0x2a')](0x194);}return _0x48c168;};}function handleError(_0xb8ee07,_0x668ff5){_0x668ff5=_0x668ff5||0x1f4;return function(_0x14cd1a){logger[_0xb42c('0x2b')](_0x14cd1a[_0xb42c('0x2c')]);if(_0x14cd1a[_0xb42c('0x2d')]){delete _0x14cd1a[_0xb42c('0x2d')];}_0xb8ee07['status'](_0x668ff5)[_0xb42c('0x2e')](_0x14cd1a);};}exports[_0xb42c('0x2f')]=function(_0x57e65f,_0x18fff2){var _0x2742f4={},_0x31c1b3={},_0x1ed395={'count':0x0,'rows':[]};var _0x5051c0=db[_0xb42c('0x30')][_0xb42c('0x31')];_0x31c1b3[_0xb42c('0x32')]=_[_0xb42c('0x33')](_0x5051c0);_0x31c1b3[_0xb42c('0x34')]=_[_0xb42c('0x33')](_0x57e65f[_0xb42c('0x34')]);_0x31c1b3[_0xb42c('0x35')]=_[_0xb42c('0x36')](_0x31c1b3['model'],_0x31c1b3[_0xb42c('0x34')]);_0x2742f4[_0xb42c('0x37')]=_['intersection'](_0x31c1b3[_0xb42c('0x32')],qs['fields'](_0x57e65f['query'][_0xb42c('0x38')]));_0x2742f4[_0xb42c('0x37')]=_0x2742f4[_0xb42c('0x37')]['length']?_0x2742f4[_0xb42c('0x37')]:_0x31c1b3['model'];if(!_0x57e65f['query'][_0xb42c('0x39')](_0xb42c('0x3a'))){_0x2742f4[_0xb42c('0x1e')]=qs[_0xb42c('0x1e')](_0x57e65f[_0xb42c('0x34')][_0xb42c('0x1e')]);_0x2742f4[_0xb42c('0x1d')]=qs[_0xb42c('0x1d')](_0x57e65f[_0xb42c('0x34')][_0xb42c('0x1d')]);}_0x2742f4[_0xb42c('0x3b')]=qs['sort'](_0x57e65f['query']['sort']);_0x2742f4[_0xb42c('0x3c')]=qs[_0xb42c('0x35')](_['pick'](_0x57e65f[_0xb42c('0x34')],_0x31c1b3[_0xb42c('0x35')]));if(_0x57e65f[_0xb42c('0x34')][_0xb42c('0x3d')]){_0x2742f4[_0xb42c('0x3c')]=_[_0xb42c('0x3e')](_0x2742f4[_0xb42c('0x3c')],{'$or':_['map'](_0x5051c0,function(_0x56fd61){if(_0x56fd61[_0xb42c('0x3f')][_0xb42c('0x40')]!==_0xb42c('0x41')){var _0x588a3d={};_0x588a3d[_0x56fd61[_0xb42c('0x42')]]={'$like':'%'+_0x57e65f[_0xb42c('0x34')][_0xb42c('0x3d')]+'%'};return _0x588a3d;}})});}_0x2742f4=_[_0xb42c('0x3e')]({},_0x2742f4,_0x57e65f[_0xb42c('0x43')]);var _0x5449f6={'where':_0x2742f4[_0xb42c('0x3c')]};return db[_0xb42c('0x30')][_0xb42c('0x1c')](_0x5449f6)[_0xb42c('0x25')](function(_0x379e26){_0x1ed395[_0xb42c('0x1c')]=_0x379e26;if(_0x57e65f[_0xb42c('0x34')][_0xb42c('0x44')]){_0x2742f4['include']=[{'all':!![]}];}return db[_0xb42c('0x30')][_0xb42c('0x45')](_0x2742f4);})[_0xb42c('0x25')](function(_0x485702){_0x1ed395['rows']=_0x485702;return _0x1ed395;})[_0xb42c('0x25')](respondWithFilteredResult(_0x18fff2,_0x2742f4))['catch'](handleError(_0x18fff2,null));};exports[_0xb42c('0x46')]=function(_0xb7ec9f,_0x57c690){var _0x5b7042={'raw':!![],'where':{'id':_0xb7ec9f[_0xb42c('0x47')]['id']}},_0xad30f4={};_0xad30f4[_0xb42c('0x32')]=_[_0xb42c('0x33')](db[_0xb42c('0x30')][_0xb42c('0x31')]);_0xad30f4[_0xb42c('0x34')]=_['keys'](_0xb7ec9f[_0xb42c('0x34')]);_0xad30f4['filters']=_[_0xb42c('0x36')](_0xad30f4[_0xb42c('0x32')],_0xad30f4[_0xb42c('0x34')]);_0x5b7042[_0xb42c('0x37')]=_['intersection'](_0xad30f4[_0xb42c('0x32')],qs[_0xb42c('0x38')](_0xb7ec9f['query'][_0xb42c('0x38')]));_0x5b7042['attributes']=_0x5b7042[_0xb42c('0x37')][_0xb42c('0x48')]?_0x5b7042[_0xb42c('0x37')]:_0xad30f4[_0xb42c('0x32')];if(_0xb7ec9f[_0xb42c('0x34')][_0xb42c('0x44')]){_0x5b7042[_0xb42c('0x49')]=[{'all':!![]}];}_0x5b7042=_[_0xb42c('0x3e')]({},_0x5b7042,_0xb7ec9f[_0xb42c('0x43')]);return db[_0xb42c('0x30')]['find'](_0x5b7042)[_0xb42c('0x25')](handleEntityNotFound(_0x57c690,null))[_0xb42c('0x25')](respondWithResult(_0x57c690,null))[_0xb42c('0x4a')](handleError(_0x57c690,null));};exports['download']=function(_0x1d4c40,_0x22fc11,_0x2c50bf){return db[_0xb42c('0x30')][_0xb42c('0x4b')]({'where':{'id':_0x1d4c40['params']['id']},'attributes':[_0xb42c('0x2d'),_0xb42c('0x6')],'raw':!![]})[_0xb42c('0x25')](handleEntityNotFound(_0x22fc11,null))[_0xb42c('0x25')](function(_0x53166d){if(_0x53166d){var _0x5a6503=path[_0xb42c('0x4c')](config['root'],_0xb42c('0x4d'),util[_0xb42c('0x4e')](_0xb42c('0x4f'),path['basename'](_0x53166d[_0xb42c('0x6')])));var _0x404f3e=fs[_0xb42c('0x50')](_0x5a6503);var _0x1a35fd=archiver(_0xb42c('0x51'),{'zlib':{'level':0x9}});_0x1a35fd['on'](_0xb42c('0x52'),function(_0x312a84){if(_0x312a84[_0xb42c('0x53')]===_0xb42c('0x54')){logger[_0xb42c('0x2b')](_0x312a84);}else{throw new db[(_0xb42c('0x55'))]['Error'](_0xb42c('0x56'));}});_0x1a35fd['on'](_0xb42c('0x2b'),function(_0x58e634){throw new db[(_0xb42c('0x55'))][(_0xb42c('0x57'))](_0xb42c('0x56'));});_0x1a35fd['pipe'](_0x404f3e);_0x1a35fd[_0xb42c('0x58')](_0xb42c('0x59'),{'cwd':path['join'](config[_0xb42c('0x5a')],'server/files/plugins',path[_0xb42c('0x5b')](_0x53166d['path'])),'ignore':[path[_0xb42c('0x4c')](path[_0xb42c('0x5c')](_0x53166d[_0xb42c('0x6')]),_0xb42c('0x5d')),path[_0xb42c('0x4c')](path[_0xb42c('0x5c')](_0x53166d['path']),_0xb42c('0x5e'))],'nodir':!![]})[_0xb42c('0x5f')]();_0x404f3e['on'](_0xb42c('0x60'),function(){if(!fs[_0xb42c('0x61')](_0x5a6503)){throw new db[(_0xb42c('0x55'))][(_0xb42c('0x57'))](_0xb42c('0x62'));}return _0x22fc11['download'](_0x5a6503,util['format'](_0xb42c('0x4f'),path[_0xb42c('0x5c')](_0x53166d[_0xb42c('0x6')])),function(_0x3ef5b9){if(_0x3ef5b9){throw new db[(_0xb42c('0x55'))][(_0xb42c('0x57'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb42c('0x63')](_0x5a6503);logger[_0xb42c('0x64')](_0xb42c('0x65'));logger[_0xb42c('0x64')](_0xb42c('0x66'));});});}return null;})[_0xb42c('0x4a')](handleError(_0x22fc11,null));};exports[_0xb42c('0x67')]=function(_0x1936f0,_0x28bfc4,_0x1cf299){var _0x379d20=path[_0xb42c('0x5c')](_0x1936f0[_0xb42c('0x68')]['filename'],path['extname'](_0x1936f0['file'][_0xb42c('0x69')]));var _0x37f09b=path[_0xb42c('0x4c')](config[_0xb42c('0x5a')],_0xb42c('0x4d'),_0x1936f0['file'][_0xb42c('0x69')]);var _0x2fd891=path['join'](config[_0xb42c('0x5a')],_0xb42c('0x4d'),_0x379d20);logger[_0xb42c('0x64')](_0xb42c('0x6a'),_0x37f09b);logger['info'](_0xb42c('0x6b'),_0x2fd891);try{fs[_0xb42c('0x6c')](_0x37f09b,parseInt(_0xb42c('0x6d'),0x8));extract(_0x37f09b,{'dir':_0x2fd891},function(_0x530bd3){if(_0x530bd3){logger[_0xb42c('0x2b')](_0x530bd3);handleError(_0x530bd3,!![]);};var _0x1effc6=fs[_0xb42c('0x6e')](_0x2fd891);if(_0x1effc6[_0xb42c('0x48')]>0x1){removeReferences(_0x37f09b,_0x2fd891);logger['error'](_0xb42c('0x6f'));return _0x1cf299(new Error(_0xb42c('0x6f')));}var _0x2c841a=fs[_0xb42c('0x70')](path[_0xb42c('0x4c')](_0x2fd891,_0x1effc6[0x0]));if(_0x2c841a['isFile']()){removeReferences(_0x37f09b,_0x2fd891);logger[_0xb42c('0x2b')]('Invalid\x20plugin\x20structure');return _0x1cf299(new Error(_0xb42c('0x6f')));}if(_0x2c841a[_0xb42c('0x71')]()){var _0x330d1b=fs[_0xb42c('0x6e')](path['join'](_0x2fd891,_0x1effc6[0x0]));if(_0x330d1b[_0xb42c('0x48')]===0x0){removeReferences(_0x37f09b,_0x2fd891);logger['error'](_0xb42c('0x6f'));return _0x1cf299(new Error('Invalid\x20plugin\x20structure'));}var _0x1d97fe=_0x330d1b['some'](function(_0x85ffb6){return _0x85ffb6===_0xb42c('0x72');});if(!_0x1d97fe){return _0x1cf299(new Error('Plugin\x20manifest\x20missing'));}var _0x5d9385=fs[_0xb42c('0x73')](path['join'](_0x2fd891,_0x1effc6[0x0],_0xb42c('0x72')));var _0x635771=JSON[_0xb42c('0x74')](_0x5d9385);if(_0xb42c('0x75')==typeof _0x635771[_0xb42c('0x2d')]){return _0x1cf299(new Error(_0xb42c('0x76')));}if(_0xb42c('0x75')==typeof _0x635771['type']){return _0x1cf299(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xb42c('0x75')==typeof _0x635771[_0xb42c('0x77')]){return _0x1cf299(new Error(_0xb42c('0x78')));}if(_0xb42c('0x75')==typeof _0x635771[_0xb42c('0x79')]){return _0x1cf299(new Error(_0xb42c('0x7a')));}if(_0x635771[_0xb42c('0x3f')]===_0xb42c('0x7b')){if('undefined'==typeof _0x635771[_0xb42c('0x79')][_0xb42c('0x7c')]){return _0x1cf299(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xb42c('0x75')==typeof _0x635771[_0xb42c('0x79')]['views'][_0xb42c('0x7d')]&&'undefined'==typeof _0x635771['parameters']['views'][_0xb42c('0x7e')]){return _0x1cf299(new Error(_0xb42c('0x7f')));}}else if(_0x635771[_0xb42c('0x3f')]===_0xb42c('0x80')){if(_0xb42c('0x75')==typeof _0x635771[_0xb42c('0x79')][_0xb42c('0x81')]){return _0x1cf299(new Error(_0xb42c('0x82')));}if(_0xb42c('0x75')==typeof _0x635771[_0xb42c('0x79')][_0xb42c('0x83')]){return _0x1cf299(new Error(_0xb42c('0x84')));}}else{return _0x1cf299(new Error(_0xb42c('0x85')));}var _0x346635=_0x635771['name'];var _0x496ebd=_0x635771['description'];var _0x5b7c9c=_0x635771[_0xb42c('0x3f')];var _0x4863f1=_0x635771[_0xb42c('0x86')]?_0x635771[_0xb42c('0x86')]:_0xb42c('0x87');var _0x29e2b7=_0x635771['icon']?_0x635771['icon']:_0xb42c('0x88');var _0x2c9bf8='';var _0x2e9149='';var _0x4e3107='';var _0xdf46f0='';var _0x1130fb=_0x635771['version'];if(_0x5b7c9c==='html'){if(_0xb42c('0x75')!=typeof _0x635771['parameters'][_0xb42c('0x7c')][_0xb42c('0x7d')]){var _0x3a0cbe=_0x635771['parameters'][_0xb42c('0x7c')][_0xb42c('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3a0cbe)){_0x2c9bf8=path[_0xb42c('0x4c')](_0xb42c('0x89'),_0x379d20,_0x1effc6[0x0],_0x3a0cbe);}else{_0x2c9bf8=_0x3a0cbe;}}else{logger[_0xb42c('0x64')](_0xb42c('0x8a'));}if(_0xb42c('0x75')!=typeof _0x635771['parameters'][_0xb42c('0x7c')]['agent']){var _0x115d20=_0x635771['parameters'][_0xb42c('0x7c')][_0xb42c('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xb42c('0x8b')](_0x115d20)){_0x2e9149=path['join'](_0xb42c('0x89'),_0x379d20,_0x1effc6[0x0],_0x115d20);}else{_0x2e9149=_0x115d20;}}else{logger['info'](_0xb42c('0x8c'));}}else if(_0x5b7c9c===_0xb42c('0x80')){_0x4e3107=_0x635771[_0xb42c('0x79')][_0xb42c('0x81')];_0xdf46f0=_0x635771[_0xb42c('0x79')]['scriptPath'];if(_0xb42c('0x75')!=typeof _0x635771['parameters'][_0xb42c('0x7c')]){if(_0xb42c('0x75')!=typeof _0x635771['parameters']['views'][_0xb42c('0x7d')]){var _0x3a0cbe=_0x635771[_0xb42c('0x79')][_0xb42c('0x7c')][_0xb42c('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xb42c('0x8b')](_0x3a0cbe)){_0x2c9bf8=path[_0xb42c('0x4c')]('plugins',_0x379d20,_0x1effc6[0x0],_0x3a0cbe);}else{_0x2c9bf8=_0x3a0cbe;}}if('undefined'!=typeof _0x635771[_0xb42c('0x79')][_0xb42c('0x7c')][_0xb42c('0x7e')]){var _0x115d20=_0x635771[_0xb42c('0x79')][_0xb42c('0x7c')][_0xb42c('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xb42c('0x8b')](_0x115d20)){_0x2e9149=path[_0xb42c('0x4c')](_0xb42c('0x89'),_0x379d20,_0x1effc6[0x0],_0x115d20);}else{_0x2e9149=_0x115d20;}}}}var _0x375cb9={'name':_0x346635,'description':_0x496ebd,'path':path[_0xb42c('0x4c')](_0x379d20,_0x1effc6[0x0]),'type':_0x5b7c9c,'sidebar':_0x4863f1,'icon':_0x29e2b7,'adminUrl':_0x2c9bf8,'agentUrl':_0x2e9149,'scriptName':_0x4e3107,'scriptPath':_0xdf46f0,'version':_0x1130fb};removeReferences(_0x37f09b,null);return db[_0xb42c('0x30')][_0xb42c('0x8d')](_0x375cb9)[_0xb42c('0x25')](function(_0x398e0a){var _0x473cb3={'role':_0x1936f0['body'][_0xb42c('0x8e')],'userProfileId':_0x1936f0[_0xb42c('0x8f')]['userProfileId']};if(!_0x473cb3)throw new Error(_0xb42c('0x90'));if(_0x473cb3[_0xb42c('0x8e')]==='user'){var _0x23ca99=_0x398e0a['get']({'plain':!![]});return db[_0xb42c('0x91')][_0xb42c('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x473cb3['userProfileId']},'raw':!![]})[_0xb42c('0x25')](function(_0x5b6ba5){if(_0x5b6ba5&&_0x5b6ba5[_0xb42c('0x92')]===0x0){return db[_0xb42c('0x93')]['create']({'name':_0x23ca99[_0xb42c('0x2d')],'resourceId':_0x23ca99['id'],'type':_0x5b6ba5[_0xb42c('0x2d')],'sectionId':_0x5b6ba5['id']},{})['then'](function(){return _0x398e0a;});}else{return _0x398e0a;}})[_0xb42c('0x4a')](function(_0x1cd0fc){logger[_0xb42c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cd0fc);throw _0x1cd0fc;});}return _0x398e0a;})[_0xb42c('0x25')](respondWithResult(_0x28bfc4,null))['catch'](handleError(_0x28bfc4,null));}});}catch(_0xee9345){_0x28bfc4[_0xb42c('0x1a')](0x1f4)[_0xb42c('0x2e')](_0xee9345);}};function removeReferences(_0x512108,_0x4d0ec4){try{if(_0x512108){fs['unlinkSync'](_0x512108);logger[_0xb42c('0x64')](_0xb42c('0x94'));}if(_0x4d0ec4){rimraf(_0x4d0ec4,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x53f44f){logger[_0xb42c('0x2b')](_0x53f44f);}}exports[_0xb42c('0x24')]=function(_0x72024b,_0x5ddb72,_0x1b3f22){return db['Plugin'][_0xb42c('0x4b')]({'where':{'id':_0x72024b[_0xb42c('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ddb72,null))[_0xb42c('0x25')](saveUpdates(_0x72024b[_0xb42c('0x8f')],null))[_0xb42c('0x25')](respondWithResult(_0x5ddb72,null))[_0xb42c('0x4a')](handleError(_0x5ddb72,null));};exports[_0xb42c('0x95')]=function(_0x1f674c,_0x461b96,_0x234965){return db[_0xb42c('0x30')]['find']({'where':{'id':_0x1f674c[_0xb42c('0x47')]['id']}})[_0xb42c('0x25')](function(_0x1d4641){if(_0x1d4641){return _0x1d4641['destroy']();}})[_0xb42c('0x25')](function(_0x5f156c){rimraf(path['join'](config['root'],'server/files/plugins',path[_0xb42c('0x5b')](_0x5f156c[_0xb42c('0x6')])),function(){});return _0x5f156c;})['then'](handleEntityNotFound(_0x461b96,null))[_0xb42c('0x25')](respondWithStatusCode(_0x461b96,null))['catch'](handleError(_0x461b96,null));};exports[_0xb42c('0x96')]=function(_0x575192,_0x322c94,_0x4f4d00){return BPromise[_0xb42c('0x97')]()[_0xb42c('0x25')](function(){if(!_0x575192[_0xb42c('0x34')][_0xb42c('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x575192[_0xb42c('0x34')]['port']){throw new Error(_0xb42c('0x98'));}var _0x313a85=_0x575192[_0xb42c('0x34')]['hostname']?_0x575192[_0xb42c('0x34')][_0xb42c('0x99')]+':'+_0x575192['query'][_0xb42c('0x9a')]:_0xb42c('0x9b')+_0x575192[_0xb42c('0x34')][_0xb42c('0x9a')];var _0x436167=_0x575192[_0xb42c('0x34')][_0xb42c('0x1b')]?_0x575192[_0xb42c('0x34')]['json']:!![];var _0x4a2a5d=_0x575192[_0xb42c('0x34')][_0xb42c('0x9c')]?_0x575192['query'][_0xb42c('0x9c')]:null;var _0x1f1a7e={'method':_0x575192[_0xb42c('0x9d')],'uri':util['format'](_0xb42c('0x9e'),_0x313a85,_0x575192[_0xb42c('0x34')][_0xb42c('0x6')]),'json':_0x436167,'resolveWithFullResponse':!![],'encoding':_0x4a2a5d,'qs':_0x575192[_0xb42c('0x34')]};if(_0x575192[_0xb42c('0x9f')]){_0x1f1a7e[_0xb42c('0x9f')]=_0x575192[_0xb42c('0x9f')];if(_0x1f1a7e[_0xb42c('0x9f')][_0xb42c('0xa0')]){delete _0x1f1a7e['headers']['content-length'];}}return rp(_0x1f1a7e);})[_0xb42c('0x25')](function(_0x13a522){if(_0x13a522){_0x322c94[_0xb42c('0x1f')](_0x13a522[_0xb42c('0x9f')]);logger[_0xb42c('0x64')](_0x13a522[_0xb42c('0x8f')]);if(_[_0xb42c('0xa1')](_0x575192['query'][_0xb42c('0x6')],_0xb42c('0xa2'))&&_0x13a522['statusCode']==0x1f4){return _0x322c94[_0xb42c('0x2a')](_0x13a522[_0xb42c('0xa3')]);}else{return _0x322c94[_0xb42c('0x1a')](_0x13a522['statusCode'])[_0xb42c('0x2e')](_0x13a522[_0xb42c('0x8f')]);}}else{return _0x322c94['sendStatus'](0xc8);}})['catch'](handleError(_0x322c94,null));};exports['webhookPost']=function(_0x554d7f,_0x5404a9,_0x247bf7){return BPromise[_0xb42c('0x97')]()['then'](function(){if(!_0x554d7f[_0xb42c('0x34')]['path']){throw new Error(_0xb42c('0xa4'));}if(!_0x554d7f[_0xb42c('0x34')][_0xb42c('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x46f47b=_0x554d7f[_0xb42c('0x34')]['hostname']?_0x554d7f[_0xb42c('0x34')][_0xb42c('0x99')]+':'+_0x554d7f['query'][_0xb42c('0x9a')]:_0xb42c('0x9b')+_0x554d7f['query'][_0xb42c('0x9a')];var _0x1522fa=_0x554d7f[_0xb42c('0x34')]['json']?_0x554d7f[_0xb42c('0x34')][_0xb42c('0x1b')]:!![];var _0xba815d=_0x554d7f[_0xb42c('0x34')]['encoding']?_0x554d7f['query'][_0xb42c('0x9c')]:null;var _0x1f86a8={'method':_0x554d7f['method'],'uri':util['format'](_0xb42c('0x9e'),_0x46f47b,_0x554d7f[_0xb42c('0x34')]['path']),'json':_0x1522fa,'resolveWithFullResponse':!![],'encoding':_0xba815d,'body':_0x554d7f[_0xb42c('0x8f')]};if(_0x554d7f[_0xb42c('0x9f')]){_0x1f86a8[_0xb42c('0x9f')]=_0x554d7f[_0xb42c('0x9f')];if(_0x1f86a8[_0xb42c('0x9f')][_0xb42c('0xa0')]){delete _0x1f86a8['headers'][_0xb42c('0xa0')];}}return rp(_0x1f86a8);})[_0xb42c('0x25')](function(_0x198d8c){if(_0x198d8c){_0x5404a9[_0xb42c('0x1f')](_0x198d8c[_0xb42c('0x9f')]);logger[_0xb42c('0x64')](_0x198d8c[_0xb42c('0x8f')]);return _0x5404a9[_0xb42c('0x1a')](_0x198d8c[_0xb42c('0xa3')])[_0xb42c('0x2e')](_0x198d8c[_0xb42c('0x8f')]);}else{return _0x5404a9[_0xb42c('0x2a')](0xc8);}})['catch'](handleError(_0x5404a9,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 647abe1..0d33285 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 _0x7a54=['Plugin','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xcaaf4,_0x21a1f6){var _0xd492c5=function(_0x57198b){while(--_0x57198b){_0xcaaf4['push'](_0xcaaf4['shift']());}};_0xd492c5(++_0x21a1f6);}(_0x7a54,0x106));var _0x47a5=function(_0x2aa70b,_0x279c7c){_0x2aa70b=_0x2aa70b-0x0;var _0x963f1f=_0x7a54[_0x2aa70b];return _0x963f1f;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Plugin=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){PluginEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);PluginEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=PluginEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','Plugin','setMaxListeners','save','remove','emit'];(function(_0x163ddd,_0x47f051){var _0x146d93=function(_0xe6485a){while(--_0xe6485a){_0x163ddd['push'](_0x163ddd['shift']());}};_0x146d93(++_0x47f051);}(_0xb10b,0x12a));var _0xbb10=function(_0xf65bf8,_0x494a66){_0xf65bf8=_0xf65bf8-0x0;var _0x2e4a66=_0xb10b[_0xf65bf8];return _0x2e4a66;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Plugin=require('../../mysqldb')['db'][_0xbb10('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){PluginEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);PluginEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Plugin[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index c7cad52..89a31a2 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 _0xfcda=['api','moment','bluebird','request-promise','./plugin.attributes','exports','plugins','lodash','util','../../config/logger'];(function(_0x53d7fc,_0x2b70d3){var _0x295a67=function(_0x2e5348){while(--_0x2e5348){_0x53d7fc['push'](_0x53d7fc['shift']());}};_0x295a67(++_0x2b70d3);}(_0xfcda,0x197));var _0xafcd=function(_0x5247f1,_0x16defa){_0x5247f1=_0x5247f1-0x0;var _0x18b6fa=_0xfcda[_0x5247f1];return _0x18b6fa;};'use strict';var _=require(_0xafcd('0x0'));var util=require(_0xafcd('0x1'));var logger=require(_0xafcd('0x2'))(_0xafcd('0x3'));var moment=require(_0xafcd('0x4'));var BPromise=require(_0xafcd('0x5'));var rp=require(_0xafcd('0x6'));var attributes=require(_0xafcd('0x7'));module[_0xafcd('0x8')]=function(_0x3c219b,_0x49cb60){return _0x3c219b['define']('Plugin',attributes,{'tableName':_0xafcd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1782=['Plugin','plugins','../../config/logger','api','moment','exports','define'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1782,0xb1));var _0x2178=function(_0x1fd8a6,_0x31ccb9){_0x1fd8a6=_0x1fd8a6-0x0;var _0x4558f9=_0x1782[_0x1fd8a6];return _0x4558f9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2178('0x0'))(_0x2178('0x1'));var moment=require(_0x2178('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./plugin.attributes');module[_0x2178('0x3')]=function(_0x466ff1,_0x45dc45){return _0x466ff1[_0x2178('0x4')](_0x2178('0x5'),attributes,{'tableName':_0x2178('0x6'),'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 6cbb309..1e36539 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 _0x2863=['raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body'];(function(_0x102c8b,_0x1d5afd){var _0xe09342=function(_0x375881){while(--_0x375881){_0x102c8b['push'](_0x102c8b['shift']());}};_0xe09342(++_0x1d5afd);}(_0x2863,0x15f));var _0x3286=function(_0x17a27b,_0x5b4e05){_0x17a27b=_0x17a27b-0x0;var _0x1e47b6=_0x2863[_0x17a27b];return _0x1e47b6;};'use strict';var _=require(_0x3286('0x0'));var util=require(_0x3286('0x1'));var moment=require(_0x3286('0x2'));var BPromise=require('bluebird');var rs=require(_0x3286('0x3'));var fs=require('fs');var Redis=require(_0x3286('0x4'));var db=require(_0x3286('0x5'))['db'];var utils=require(_0x3286('0x6'));var logger=require(_0x3286('0x7'))(_0x3286('0x8'));var config=require(_0x3286('0x9'));var jayson=require(_0x3286('0xa'));var client=jayson[_0x3286('0xb')]['http']({'port':0x232a});config[_0x3286('0xc')]=_[_0x3286('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3286('0xe'))(new Redis(config[_0x3286('0xc')]));require(_0x3286('0xf'))[_0x3286('0x10')](socket);function respondWithRpcPromise(_0x337f6f,_0x38562c,_0x512296){return new BPromise(function(_0x1354c7,_0x6da6ba){return client[_0x3286('0x11')](_0x337f6f,_0x512296)[_0x3286('0x12')](function(_0x121077){logger[_0x3286('0x13')](_0x3286('0x14'),_0x38562c,_0x3286('0x15'));logger[_0x3286('0x16')](_0x3286('0x17'),_0x38562c,_0x3286('0x15'),JSON[_0x3286('0x18')](_0x121077));if(_0x121077[_0x3286('0x19')]){if(_0x121077[_0x3286('0x19')][_0x3286('0x1a')]===0x1f4){logger['error'](_0x3286('0x14'),_0x38562c,_0x121077['error'][_0x3286('0x1b')]);return _0x6da6ba(_0x121077[_0x3286('0x19')][_0x3286('0x1b')]);}logger[_0x3286('0x19')](_0x3286('0x14'),_0x38562c,_0x121077[_0x3286('0x19')][_0x3286('0x1b')]);return _0x1354c7(_0x121077[_0x3286('0x19')][_0x3286('0x1b')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x38562c,_0x3286('0x15'));_0x1354c7(_0x121077[_0x3286('0x1c')][_0x3286('0x1b')]);}})[_0x3286('0x1d')](function(_0x54d672){logger['error'](_0x3286('0x14'),_0x38562c,_0x54d672);_0x6da6ba(_0x54d672);});});}exports[_0x3286('0x1e')]=function(_0x253fe6){var _0x373f73=this;return new Promise(function(_0x3e7c28,_0x1ac4d6){return db[_0x3286('0x1f')][_0x3286('0x20')](_0x253fe6[_0x3286('0x21')],{'raw':_0x253fe6['options']?_0x253fe6['options'][_0x3286('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x14d648){logger[_0x3286('0x13')]('CreatePlugin',_0x253fe6);logger[_0x3286('0x16')]('CreatePlugin',_0x253fe6,JSON[_0x3286('0x18')](_0x14d648));_0x3e7c28(_0x14d648);})[_0x3286('0x1d')](function(_0x4b695b){logger[_0x3286('0x19')](_0x3286('0x1e'),_0x4b695b['message'],_0x253fe6);_0x1ac4d6(_0x373f73[_0x3286('0x19')](0x1f4,_0x4b695b['message']));});});}; \ No newline at end of file +var _0x3784=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreatePlugin','create','options','lodash'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x3784,0x13f));var _0x4378=function(_0x196071,_0x43112e){_0x196071=_0x196071-0x0;var _0x5be580=_0x3784[_0x196071];return _0x5be580;};'use strict';var _=require(_0x4378('0x0'));var util=require(_0x4378('0x1'));var moment=require(_0x4378('0x2'));var BPromise=require(_0x4378('0x3'));var rs=require(_0x4378('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4378('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4378('0x6'))(_0x4378('0x7'));var config=require(_0x4378('0x8'));var jayson=require(_0x4378('0x9'));var client=jayson[_0x4378('0xa')]['http']({'port':0x232a});config[_0x4378('0xb')]=_['defaults'](config[_0x4378('0xb')],{'host':_0x4378('0xc'),'port':0x18eb});var socket=require(_0x4378('0xd'))(new Redis(config[_0x4378('0xb')]));require(_0x4378('0xe'))[_0x4378('0xf')](socket);function respondWithRpcPromise(_0x8fbd0c,_0x36f24e,_0xb9ba7a){return new BPromise(function(_0x4936c9,_0x2adfd9){return client[_0x4378('0x10')](_0x8fbd0c,_0xb9ba7a)[_0x4378('0x11')](function(_0x3e2d71){logger['info'](_0x4378('0x12'),_0x36f24e,_0x4378('0x13'));logger[_0x4378('0x14')](_0x4378('0x15'),_0x36f24e,_0x4378('0x13'),JSON[_0x4378('0x16')](_0x3e2d71));if(_0x3e2d71['error']){if(_0x3e2d71[_0x4378('0x17')][_0x4378('0x18')]===0x1f4){logger[_0x4378('0x17')](_0x4378('0x12'),_0x36f24e,_0x3e2d71['error'][_0x4378('0x19')]);return _0x2adfd9(_0x3e2d71[_0x4378('0x17')][_0x4378('0x19')]);}logger[_0x4378('0x17')](_0x4378('0x12'),_0x36f24e,_0x3e2d71[_0x4378('0x17')][_0x4378('0x19')]);return _0x4936c9(_0x3e2d71[_0x4378('0x17')][_0x4378('0x19')]);}else{logger[_0x4378('0x1a')]('Plugin,\x20%s,\x20%s',_0x36f24e,_0x4378('0x13'));_0x4936c9(_0x3e2d71[_0x4378('0x1b')][_0x4378('0x19')]);}})[_0x4378('0x1c')](function(_0x48036d){logger[_0x4378('0x17')](_0x4378('0x12'),_0x36f24e,_0x48036d);_0x2adfd9(_0x48036d);});});}exports[_0x4378('0x1d')]=function(_0x5bab3d){var _0x47bb4e=this;return new Promise(function(_0x48074f,_0x52e2eb){return db['Plugin'][_0x4378('0x1e')](_0x5bab3d['body'],{'raw':_0x5bab3d[_0x4378('0x1f')]?_0x5bab3d[_0x4378('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x4378('0x11')](function(_0x57a301){logger[_0x4378('0x1a')](_0x4378('0x1d'),_0x5bab3d);logger[_0x4378('0x14')](_0x4378('0x1d'),_0x5bab3d,JSON[_0x4378('0x16')](_0x57a301));_0x48074f(_0x57a301);})['catch'](function(_0x4e2208){logger[_0x4378('0x17')](_0x4378('0x1d'),_0x4e2208[_0x4378('0x19')],_0x5bab3d);_0x52e2eb(_0x47bb4e[_0x4378('0x17')](0x1f4,_0x4e2208['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 6e45d31..2392fa2 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 _0x99be=['save','remove','update','emit','removeListener','length','plugin:','./plugin.events'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0x99be,0x157));var _0xe99b=function(_0x5d109c,_0x23c7d0){_0x5d109c=_0x5d109c-0x0;var _0x982765=_0x99be[_0x5d109c];return _0x982765;};'use strict';var PluginEvents=require(_0xe99b('0x0'));var events=[_0xe99b('0x1'),_0xe99b('0x2'),_0xe99b('0x3')];function createListener(_0x156ad7,_0x58a9ce){return function(_0x505447){_0x58a9ce[_0xe99b('0x4')](_0x156ad7,_0x505447);};}function removeListener(_0x37c1bd,_0x59d9b8){return function(){PluginEvents[_0xe99b('0x5')](_0x37c1bd,_0x59d9b8);};}exports['register']=function(_0x4cb995){for(var _0x1b1357=0x0,_0xf6f5e1=events[_0xe99b('0x6')];_0x1b1357<_0xf6f5e1;_0x1b1357++){var _0x303aac=events[_0x1b1357];var _0x253361=createListener(_0xe99b('0x7')+_0x303aac,_0x4cb995);PluginEvents['on'](_0x303aac,_0x253361);}}; \ No newline at end of file +var _0x97f1=['plugin:','./plugin.events','remove','register','length'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0x97f1,0x1b4));var _0x197f=function(_0x472ac3,_0x1e0e15){_0x472ac3=_0x472ac3-0x0;var _0x21539c=_0x97f1[_0x472ac3];return _0x21539c;};'use strict';var PluginEvents=require(_0x197f('0x0'));var events=['save',_0x197f('0x1'),'update'];function createListener(_0x1986f6,_0x322062){return function(_0xf3c389){_0x322062['emit'](_0x1986f6,_0xf3c389);};}function removeListener(_0x395937,_0x57094b){return function(){PluginEvents['removeListener'](_0x395937,_0x57094b);};}exports[_0x197f('0x2')]=function(_0x5c37ff){for(var _0x3ee1dc=0x0,_0x2e8faf=events[_0x197f('0x3')];_0x3ee1dc<_0x2e8faf;_0x3ee1dc++){var _0x44628a=events[_0x3ee1dc];var _0x317eee=createListener(_0x197f('0x4')+_0x44628a,_0x5c37ff);PluginEvents['on'](_0x44628a,_0x317eee);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 9865504..9523d18 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 _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x14ab5b,_0x5a2541){var _0x4231da=function(_0x38657a){while(--_0x38657a){_0x14ab5b['push'](_0x14ab5b['shift']());}};_0x4231da(++_0x5a2541);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x57ed94,_0x109a2a){var _0x404ceb=function(_0x32bca0){while(--_0x32bca0){_0x57ed94['push'](_0x57ed94['shift']());}};_0x404ceb(++_0x109a2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 34b7d34..1db8b67 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 _0xb778=['describe','catch','create','body','../../files/plugins','dump','update','restart','stop','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','length','show'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xb778,0x1c8));var _0x8b77=function(_0xe27810,_0x8b3e76){_0xe27810=_0xe27810-0x0;var _0x53dcec=_0xb778[_0xe27810];return _0x53dcec;};'use strict';var _=require(_0x8b77('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x8b77('0x1'))('api');var path=require('path');var exec=require(_0x8b77('0x2'))[_0x8b77('0x3')];var BPromise=require(_0x8b77('0x4'));function handleEntityNotFound(_0x1d9fc7,_0x2a79ef){return function(_0x3f309a){if(!_0x3f309a){_0x1d9fc7['sendStatus'](0x194);;}return _0x3f309a;};}function respondWithResult(_0x361cbc,_0x43012d){_0x43012d=_0x43012d||0xc8;return function(_0x527afa){if(_0x527afa){return _0x361cbc[_0x8b77('0x5')](_0x43012d)[_0x8b77('0x6')](_0x527afa);}return null;};}function handleError(_0x5b9096,_0x1a7405){_0x1a7405=_0x1a7405||0x1f4;return function(_0x4909ef){logger[_0x8b77('0x7')](_0x4909ef[_0x8b77('0x8')]);if(_0x4909ef[_0x8b77('0x9')]){delete _0x4909ef['name'];}_0x5b9096['status'](_0x1a7405)[_0x8b77('0xa')](_0x4909ef);};}function execChildProcess(){return new BPromise(function(_0x52a5e8,_0x1bcdea){exec(_0x8b77('0xb'),function(_0x131fd5,_0x22c145,_0x3bfb26){logger[_0x8b77('0xc')](_0x22c145);logger[_0x8b77('0xc')](_0x3bfb26);if(_0x131fd5){logger[_0x8b77('0x7')](_0x131fd5);return _0x1bcdea(_0x131fd5);}return _0x52a5e8(_0x22c145);});});}exports[_0x8b77('0xd')]=function(_0x11efa6,_0x34f429){return pm2[_0x8b77('0xe')]()[_0x8b77('0xf')](function(_0x63828d){if(_0x63828d){var _0x54b21c=_[_0x8b77('0x10')](_0x63828d,function(_0x1b613d){return _0x1b613d[_0x8b77('0x9')]===_0x8b77('0x11')||_0x1b613d[_0x8b77('0x9')]==='motion2';});return{'rows':_0x54b21c,'count':_0x54b21c[_0x8b77('0x12')]};}return null;})[_0x8b77('0xf')](respondWithResult(_0x34f429,null))['catch'](handleError(_0x34f429,null));};exports[_0x8b77('0x13')]=function(_0x3392de,_0xd2e0e6){return pm2[_0x8b77('0x14')](_0x3392de['params']['id'])['then'](respondWithResult(_0xd2e0e6,null))[_0x8b77('0xf')](handleEntityNotFound(_0xd2e0e6,null))[_0x8b77('0x15')](handleError(_0xd2e0e6,null));};exports[_0x8b77('0x16')]=function(_0x195fee,_0x28a316){if(_0x195fee[_0x8b77('0x17')]['name']&&_0x195fee['body']['script']){var _0x479c05=path['join'](__dirname,_0x8b77('0x18'),_0x195fee[_0x8b77('0x17')]['script']);var _0x459f5d=process['cwd']();process['chdir'](path['dirname'](_0x479c05));return execChildProcess()[_0x8b77('0xf')](function(_0xa881de){process['chdir'](_0x459f5d);return pm2['start']({'name':_0x195fee[_0x8b77('0x17')][_0x8b77('0x9')],'script':_0x479c05});})['then'](function(_0x16d0e1){pm2[_0x8b77('0x19')]();return _0x16d0e1[0x0];})[_0x8b77('0xf')](respondWithResult(_0x28a316,0xc9))[_0x8b77('0x15')](handleError(_0x28a316,null));}else{return _0x28a316[_0x8b77('0x5')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8b77('0x1a')]=function(_0x57a559,_0x5ba4ce){if(_0x57a559[_0x8b77('0x17')]['id']){delete _0x57a559[_0x8b77('0x17')]['id'];}var _0x4e3e00={'online':_0x8b77('0x1b'),'stopped':_0x8b77('0x1c')};if(_0x4e3e00['hasOwnProperty'](_0x57a559[_0x8b77('0x17')][_0x8b77('0x5')])){return pm2[_0x4e3e00[_0x57a559['body'][_0x8b77('0x5')]]](_0x57a559[_0x8b77('0x1d')]['id'])['then'](respondWithResult(_0x5ba4ce,0xc8))['catch'](handleError(_0x5ba4ce,null));}else{return _0x5ba4ce[_0x8b77('0x5')](0x1f4)['send']({'message':_0x8b77('0x1e')});}};exports[_0x8b77('0x1f')]=function(_0x556cdf,_0x8ba8a8){if(_0x556cdf['body']['id']){delete _0x556cdf[_0x8b77('0x17')]['id'];}if(_0x556cdf[_0x8b77('0x1d')]['id']){return pm2[_0x8b77('0x20')](_0x556cdf[_0x8b77('0x1d')]['id'])[_0x8b77('0xf')](function(_0x55d635){pm2[_0x8b77('0x19')]();return _0x55d635[0x0];})[_0x8b77('0xf')](respondWithResult(_0x8ba8a8,null))['catch'](handleError(_0x8ba8a8,null));}else{return _0x8ba8a8[_0x8b77('0x5')](0x1f4)['send']({'message':_0x8b77('0x21')});}}; \ No newline at end of file +var _0xf15b=['cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','lodash','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','error','status','send','npm\x20install','info','index','list','then','reject','name','express','motion2','show','describe','params','catch','create','body','script','join','../../files/plugins'];(function(_0x584e3e,_0x1b0ca1){var _0x5622fd=function(_0x4201d6){while(--_0x4201d6){_0x584e3e['push'](_0x584e3e['shift']());}};_0x5622fd(++_0x1b0ca1);}(_0xf15b,0x7f));var _0xbf15=function(_0x55933f,_0x33712b){_0x55933f=_0x55933f-0x0;var _0x588e8d=_0xf15b[_0x55933f];return _0x588e8d;};'use strict';var _=require(_0xbf15('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xbf15('0x1'))(_0xbf15('0x2'));var path=require(_0xbf15('0x3'));var exec=require(_0xbf15('0x4'))[_0xbf15('0x5')];var BPromise=require(_0xbf15('0x6'));function handleEntityNotFound(_0x2f3542,_0x105221){return function(_0xeb8a3d){if(!_0xeb8a3d){_0x2f3542[_0xbf15('0x7')](0x194);;}return _0xeb8a3d;};}function respondWithResult(_0x501077,_0x4e2643){_0x4e2643=_0x4e2643||0xc8;return function(_0x5b46fa){if(_0x5b46fa){return _0x501077['status'](_0x4e2643)['json'](_0x5b46fa);}return null;};}function handleError(_0x220409,_0x2a54db){_0x2a54db=_0x2a54db||0x1f4;return function(_0x4e7d7f){logger[_0xbf15('0x8')](_0x4e7d7f['stack']);if(_0x4e7d7f['name']){delete _0x4e7d7f['name'];}_0x220409[_0xbf15('0x9')](_0x2a54db)[_0xbf15('0xa')](_0x4e7d7f);};}function execChildProcess(){return new BPromise(function(_0x3fc1db,_0x50c08c){exec(_0xbf15('0xb'),function(_0x54b1ef,_0x5769b9,_0xf1543e){logger[_0xbf15('0xc')](_0x5769b9);logger[_0xbf15('0xc')](_0xf1543e);if(_0x54b1ef){logger['error'](_0x54b1ef);return _0x50c08c(_0x54b1ef);}return _0x3fc1db(_0x5769b9);});});}exports[_0xbf15('0xd')]=function(_0x2bdcbf,_0x1db5f2){return pm2[_0xbf15('0xe')]()[_0xbf15('0xf')](function(_0x41bc6a){if(_0x41bc6a){var _0x412156=_[_0xbf15('0x10')](_0x41bc6a,function(_0x2f90e5){return _0x2f90e5[_0xbf15('0x11')]===_0xbf15('0x12')||_0x2f90e5[_0xbf15('0x11')]===_0xbf15('0x13');});return{'rows':_0x412156,'count':_0x412156['length']};}return null;})[_0xbf15('0xf')](respondWithResult(_0x1db5f2,null))['catch'](handleError(_0x1db5f2,null));};exports[_0xbf15('0x14')]=function(_0x18f862,_0x4fe053){return pm2[_0xbf15('0x15')](_0x18f862[_0xbf15('0x16')]['id'])[_0xbf15('0xf')](respondWithResult(_0x4fe053,null))['then'](handleEntityNotFound(_0x4fe053,null))[_0xbf15('0x17')](handleError(_0x4fe053,null));};exports[_0xbf15('0x18')]=function(_0xf7918e,_0x33b169){if(_0xf7918e[_0xbf15('0x19')][_0xbf15('0x11')]&&_0xf7918e['body'][_0xbf15('0x1a')]){var _0x2319c1=path[_0xbf15('0x1b')](__dirname,_0xbf15('0x1c'),_0xf7918e['body'][_0xbf15('0x1a')]);var _0x57431d=process[_0xbf15('0x1d')]();process[_0xbf15('0x1e')](path[_0xbf15('0x1f')](_0x2319c1));return execChildProcess()['then'](function(_0x471244){process[_0xbf15('0x1e')](_0x57431d);return pm2[_0xbf15('0x20')]({'name':_0xf7918e[_0xbf15('0x19')][_0xbf15('0x11')],'script':_0x2319c1});})['then'](function(_0x8fa2cd){pm2[_0xbf15('0x21')]();return _0x8fa2cd[0x0];})[_0xbf15('0xf')](respondWithResult(_0x33b169,0xc9))[_0xbf15('0x17')](handleError(_0x33b169,null));}else{return _0x33b169[_0xbf15('0x9')](0x1f4)[_0xbf15('0xa')]({'message':_0xbf15('0x22')});}};exports[_0xbf15('0x23')]=function(_0x39318b,_0x4d237e){if(_0x39318b[_0xbf15('0x19')]['id']){delete _0x39318b[_0xbf15('0x19')]['id'];}var _0x2119ad={'online':_0xbf15('0x24'),'stopped':_0xbf15('0x25')};if(_0x2119ad[_0xbf15('0x26')](_0x39318b[_0xbf15('0x19')][_0xbf15('0x9')])){return pm2[_0x2119ad[_0x39318b[_0xbf15('0x19')][_0xbf15('0x9')]]](_0x39318b[_0xbf15('0x16')]['id'])['then'](respondWithResult(_0x4d237e,0xc8))[_0xbf15('0x17')](handleError(_0x4d237e,null));}else{return _0x4d237e[_0xbf15('0x9')](0x1f4)[_0xbf15('0xa')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0xf390e,_0x1a798f){if(_0xf390e[_0xbf15('0x19')]['id']){delete _0xf390e['body']['id'];}if(_0xf390e[_0xbf15('0x16')]['id']){return pm2['delete'](_0xf390e[_0xbf15('0x16')]['id'])[_0xbf15('0xf')](function(_0x1c48a1){pm2[_0xbf15('0x21')]();return _0x1c48a1[0x0];})['then'](respondWithResult(_0x1a798f,null))[_0xbf15('0x17')](handleError(_0x1a798f,null));}else{return _0x1a798f[_0xbf15('0x9')](0x1f4)[_0xbf15('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 318c152..b7d0999 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 _0x7c09=['../../config/environment','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4145ea,_0xabca10){var _0x14dd46=function(_0x39bc5d){while(--_0x39bc5d){_0x4145ea['push'](_0x4145ea['shift']());}};_0x14dd46(++_0xabca10);}(_0x7c09,0x102));var _0x97c0=function(_0x2efb98,_0x15cefb){_0x2efb98=_0x2efb98-0x0;var _0x319530=_0x7c09[_0x2efb98];return _0x319530;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var auth=require(_0x97c0('0x4'));var interaction=require(_0x97c0('0x5'));var config=require(_0x97c0('0x6'));module[_0x97c0('0x7')]=router; \ No newline at end of file +var _0x7676=['path','express','../../components/interaction/service','exports','multer','util'];(function(_0xb9e2bc,_0x1bb304){var _0x5cddae=function(_0x6a282e){while(--_0x6a282e){_0xb9e2bc['push'](_0xb9e2bc['shift']());}};_0x5cddae(++_0x1bb304);}(_0x7676,0xb8));var _0x6767=function(_0x302d2d,_0x539406){_0x302d2d=_0x302d2d-0x0;var _0x4c60c7=_0x7676[_0x302d2d];return _0x4c60c7;};'use strict';var multer=require(_0x6767('0x0'));var util=require(_0x6767('0x1'));var path=require(_0x6767('0x2'));var timeout=require('connect-timeout');var express=require(_0x6767('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6767('0x4'));var config=require('../../config/environment');module[_0x6767('0x5')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 8192b38..94a0882 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 _0xaf97=['INTEGER','STRING','DATE','exports'];(function(_0x1196bd,_0xba4aea){var _0x26014f=function(_0x542a3d){while(--_0x542a3d){_0x1196bd['push'](_0x1196bd['shift']());}};_0x26014f(++_0xba4aea);}(_0xaf97,0x10b));var _0x7af9=function(_0x44164e,_0x4f74e1){_0x44164e=_0x44164e-0x0;var _0x10e92d=_0xaf97[_0x44164e];return _0x10e92d;};'use strict';var Sequelize=require('sequelize');module[_0x7af9('0x0')]={'state':{'type':Sequelize[_0x7af9('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7af9('0x2')]},'scheduledat':{'type':Sequelize[_0x7af9('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x7af9('0x3')]},'ringtime':{'type':Sequelize[_0x7af9('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7af9('0x2')]},'campaigntype':{'type':Sequelize[_0x7af9('0x2')]},'membername':{'type':Sequelize[_0x7af9('0x2')]}}; \ No newline at end of file +var _0x700c=['exports','INTEGER','STRING','DATE'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x700c,0x16c));var _0xc700=function(_0x56b794,_0x50003f){_0x56b794=_0x56b794-0x0;var _0x80c80=_0x700c[_0x56b794];return _0x80c80;};'use strict';var Sequelize=require('sequelize');module[_0xc700('0x0')]={'state':{'type':Sequelize[_0xc700('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc700('0x2')]},'scheduledat':{'type':Sequelize[_0xc700('0x3')]},'uniqueid':{'type':Sequelize[_0xc700('0x2')]},'starttime':{'type':Sequelize[_0xc700('0x3')]},'responsetime':{'type':Sequelize[_0xc700('0x3')]},'ringtime':{'type':Sequelize[_0xc700('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc700('0x2')]},'campaigntype':{'type':Sequelize[_0xc700('0x2')]},'membername':{'type':Sequelize[_0xc700('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 757c459..b55dc6f 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 _0x2fc4=['./reportAgentPreview.attributes','define','ReportAgentPreview','lodash','util','../../config/logger','api','moment'];(function(_0xc9214b,_0x2b3a54){var _0x41577e=function(_0x558b35){while(--_0x558b35){_0xc9214b['push'](_0xc9214b['shift']());}};_0x41577e(++_0x2b3a54);}(_0x2fc4,0x143));var _0x42fc=function(_0x1419f6,_0x4180de){_0x1419f6=_0x1419f6-0x0;var _0x5b07c7=_0x2fc4[_0x1419f6];return _0x5b07c7;};'use strict';var _=require(_0x42fc('0x0'));var util=require(_0x42fc('0x1'));var logger=require(_0x42fc('0x2'))(_0x42fc('0x3'));var moment=require(_0x42fc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x42fc('0x5'));module['exports']=function(_0x427e68,_0x4075d0){return _0x427e68[_0x42fc('0x6')](_0x42fc('0x7'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb064=['lodash','util','../../config/logger','request-promise','exports','define','ReportAgentPreview'];(function(_0x388933,_0x13eee6){var _0x66ef4d=function(_0x365f87){while(--_0x365f87){_0x388933['push'](_0x388933['shift']());}};_0x66ef4d(++_0x13eee6);}(_0xb064,0x69));var _0x4b06=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb064[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x4b06('0x0'));var util=require(_0x4b06('0x1'));var logger=require(_0x4b06('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4b06('0x3'));var attributes=require('./reportAgentPreview.attributes');module[_0x4b06('0x4')]=function(_0x4bc315,_0x26bcaf){return _0x4bc315[_0x4b06('0x5')](_0x4b06('0x6'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 7e33810..6d9f4d6 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 _0x0986=['stringify','error','code','message','result','create','body','options','raw','CreateReportAgentPreview','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ee08f,_0x540649){var _0x38327e=function(_0x3cc415){while(--_0x3cc415){_0x2ee08f['push'](_0x2ee08f['shift']());}};_0x38327e(++_0x540649);}(_0x0986,0xa7));var _0x6098=function(_0x2e9d60,_0x1942f5){_0x2e9d60=_0x2e9d60-0x0;var _0x17eb75=_0x0986[_0x2e9d60];return _0x17eb75;};'use strict';var _=require(_0x6098('0x0'));var util=require('util');var moment=require(_0x6098('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6098('0x2'));var db=require(_0x6098('0x3'))['db'];var utils=require(_0x6098('0x4'));var logger=require(_0x6098('0x5'))(_0x6098('0x6'));var config=require(_0x6098('0x7'));var jayson=require(_0x6098('0x8'));var client=jayson['client'][_0x6098('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b07bd,_0x3e6db6,_0x48c4a0){return new BPromise(function(_0x343019,_0x2e4a72){return client[_0x6098('0xa')](_0x5b07bd,_0x48c4a0)['then'](function(_0x242a7e){logger[_0x6098('0xb')](_0x6098('0xc'),_0x3e6db6,_0x6098('0xd'));logger[_0x6098('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x3e6db6,'request\x20sent',JSON[_0x6098('0xf')](_0x242a7e));if(_0x242a7e['error']){if(_0x242a7e[_0x6098('0x10')][_0x6098('0x11')]===0x1f4){logger[_0x6098('0x10')](_0x6098('0xc'),_0x3e6db6,_0x242a7e['error'][_0x6098('0x12')]);return _0x2e4a72(_0x242a7e['error'][_0x6098('0x12')]);}logger[_0x6098('0x10')](_0x6098('0xc'),_0x3e6db6,_0x242a7e[_0x6098('0x10')][_0x6098('0x12')]);return _0x343019(_0x242a7e[_0x6098('0x10')][_0x6098('0x12')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x3e6db6,_0x6098('0xd'));_0x343019(_0x242a7e[_0x6098('0x13')]['message']);}})['catch'](function(_0x508afd){logger[_0x6098('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x3e6db6,_0x508afd);_0x2e4a72(_0x508afd);});});}exports['CreateReportAgentPreview']=function(_0x100f6f){var _0x4f7d06=this;return new Promise(function(_0x4af8d2,_0x1f78cb){return db['ReportAgentPreview'][_0x6098('0x14')](_0x100f6f[_0x6098('0x15')],{'raw':_0x100f6f[_0x6098('0x16')]?_0x100f6f[_0x6098('0x16')][_0x6098('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xb41bd){logger['info'](_0x6098('0x18'),_0x100f6f);logger[_0x6098('0xe')](_0x6098('0x18'),_0x100f6f,JSON[_0x6098('0xf')](_0xb41bd));_0x4af8d2(_0xb41bd);})[_0x6098('0x19')](function(_0x5591ff){logger['error'](_0x6098('0x18'),_0x5591ff[_0x6098('0x12')],_0x100f6f);_0x1f78cb(_0x4f7d06[_0x6098('0x10')](0x1f4,_0x5591ff[_0x6098('0x12')]));});});}; \ No newline at end of file +var _0x39f5=['code','error','message','info','result','catch','ReportAgentPreview','options','raw','CreateReportAgentPreview','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2fc739,_0x4b81ee){var _0x33e730=function(_0x274f81){while(--_0x274f81){_0x2fc739['push'](_0x2fc739['shift']());}};_0x33e730(++_0x4b81ee);}(_0x39f5,0x6e));var _0x539f=function(_0x3623ad,_0x212b88){_0x3623ad=_0x3623ad-0x0;var _0x270bd5=_0x39f5[_0x3623ad];return _0x270bd5;};'use strict';var _=require(_0x539f('0x0'));var util=require('util');var moment=require(_0x539f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x539f('0x2'));var db=require(_0x539f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x539f('0x4'))(_0x539f('0x5'));var config=require(_0x539f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x539f('0x7')][_0x539f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46a8c2,_0x2e8d29,_0x3815f5){return new BPromise(function(_0x484a02,_0x3ce5a3){return client[_0x539f('0x9')](_0x46a8c2,_0x3815f5)['then'](function(_0x2eb1d1){logger['info'](_0x539f('0xa'),_0x2e8d29,_0x539f('0xb'));logger[_0x539f('0xc')](_0x539f('0xd'),_0x2e8d29,_0x539f('0xb'),JSON[_0x539f('0xe')](_0x2eb1d1));if(_0x2eb1d1['error']){if(_0x2eb1d1['error'][_0x539f('0xf')]===0x1f4){logger[_0x539f('0x10')](_0x539f('0xa'),_0x2e8d29,_0x2eb1d1[_0x539f('0x10')]['message']);return _0x3ce5a3(_0x2eb1d1[_0x539f('0x10')][_0x539f('0x11')]);}logger['error'](_0x539f('0xa'),_0x2e8d29,_0x2eb1d1[_0x539f('0x10')][_0x539f('0x11')]);return _0x484a02(_0x2eb1d1[_0x539f('0x10')][_0x539f('0x11')]);}else{logger[_0x539f('0x12')](_0x539f('0xa'),_0x2e8d29,_0x539f('0xb'));_0x484a02(_0x2eb1d1[_0x539f('0x13')]['message']);}})[_0x539f('0x14')](function(_0x349478){logger[_0x539f('0x10')](_0x539f('0xa'),_0x2e8d29,_0x349478);_0x3ce5a3(_0x349478);});});}exports['CreateReportAgentPreview']=function(_0x2037bc){var _0x54782c=this;return new Promise(function(_0x380062,_0x2a3d3c){return db[_0x539f('0x15')]['create'](_0x2037bc['body'],{'raw':_0x2037bc[_0x539f('0x16')]?_0x2037bc[_0x539f('0x16')][_0x539f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x531ef3){logger['info'](_0x539f('0x18'),_0x2037bc);logger['debug'](_0x539f('0x18'),_0x2037bc,JSON['stringify'](_0x531ef3));_0x380062(_0x531ef3);})['catch'](function(_0x90148c){logger[_0x539f('0x10')](_0x539f('0x18'),_0x90148c['message'],_0x2037bc);_0x2a3d3c(_0x54782c['error'](0x1f4,_0x90148c['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 50fc6ac..82c738b 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 _0x39f7=['/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','post','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor'];(function(_0x343d58,_0x3ec578){var _0x4060bd=function(_0x2f990c){while(--_0x2f990c){_0x343d58['push'](_0x343d58['shift']());}};_0x4060bd(++_0x3ec578);}(_0x39f7,0xcf));var _0x739f=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x39f7[_0x51ac09];return _0x3f827d;};'use strict';var multer=require(_0x739f('0x0'));var util=require(_0x739f('0x1'));var path=require(_0x739f('0x2'));var express=require(_0x739f('0x3'));var router=express[_0x739f('0x4')]();var auth=require(_0x739f('0x5'));var controller=require(_0x739f('0x6'));router[_0x739f('0x7')](_0x739f('0x8'),auth[_0x739f('0x9')](),controller['voiceChannels']);router[_0x739f('0x7')](_0x739f('0xa'),auth[_0x739f('0x9')](),controller[_0x739f('0xb')]);router['get'](_0x739f('0xc'),auth[_0x739f('0x9')](),controller['voiceChannelStopMixMonitor']);router[_0x739f('0x7')](_0x739f('0xd'),auth[_0x739f('0x9')](),controller[_0x739f('0xe')]);router[_0x739f('0x7')](_0x739f('0xf'),auth[_0x739f('0x9')](),controller[_0x739f('0x10')]);router[_0x739f('0x7')]('/mail/queues',auth['isAuthenticated'](),controller[_0x739f('0x11')]);router[_0x739f('0x7')](_0x739f('0x12'),auth[_0x739f('0x9')](),controller['mailAccounts']);router[_0x739f('0x7')](_0x739f('0x13'),auth[_0x739f('0x9')](),controller[_0x739f('0x14')]);router[_0x739f('0x7')](_0x739f('0x15'),auth['isAuthenticated'](),controller[_0x739f('0x16')]);router['get'](_0x739f('0x17'),auth['isAuthenticated'](),controller['faxQueues']);router['get'](_0x739f('0x18'),auth[_0x739f('0x9')](),controller[_0x739f('0x19')]);router[_0x739f('0x7')]('/voice/queues/channels',auth[_0x739f('0x9')](),controller['voiceQueuesChannels']);router[_0x739f('0x7')](_0x739f('0x1a'),auth[_0x739f('0x9')](),controller[_0x739f('0x1b')]);router['get'](_0x739f('0x1c'),auth[_0x739f('0x9')](),controller[_0x739f('0x1d')]);router[_0x739f('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x739f('0x9')](),controller[_0x739f('0x1e')]);router[_0x739f('0x7')]('/voice/queues/:id',auth[_0x739f('0x9')](),controller[_0x739f('0x1f')]);router[_0x739f('0x7')](_0x739f('0x20'),auth[_0x739f('0x9')](),controller[_0x739f('0x21')]);router[_0x739f('0x7')]('/outbound/channels',auth[_0x739f('0x9')](),controller[_0x739f('0x22')]);router[_0x739f('0x7')](_0x739f('0x23'),auth[_0x739f('0x9')](),controller[_0x739f('0x24')]);router[_0x739f('0x25')](_0x739f('0x26'),auth['isAuthenticated'](),controller[_0x739f('0x27')]);router[_0x739f('0x7')](_0x739f('0x28'),auth['isAuthenticated'](),controller[_0x739f('0x29')]);router[_0x739f('0x7')](_0x739f('0x2a'),auth[_0x739f('0x9')](),controller[_0x739f('0x2b')]);router[_0x739f('0x7')](_0x739f('0x2c'),auth[_0x739f('0x9')](),controller['campaigns']);router[_0x739f('0x7')](_0x739f('0x2d'),auth[_0x739f('0x9')](),controller[_0x739f('0x2e')]);router[_0x739f('0x7')](_0x739f('0x2f'),auth[_0x739f('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0x739f('0x7')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x739f('0x30')]);router[_0x739f('0x7')]('/openchannel/queues/waitinginteractions',auth[_0x739f('0x9')](),controller[_0x739f('0x31')]);router[_0x739f('0x7')](_0x739f('0x32'),auth[_0x739f('0x9')](),controller[_0x739f('0x33')]);router[_0x739f('0x7')](_0x739f('0x34'),auth[_0x739f('0x9')](),controller[_0x739f('0x35')]);router['post'](_0x739f('0x36'),auth[_0x739f('0x9')](),controller[_0x739f('0x37')](_0x739f('0x38')));router['get']('/mail/queues/:id',auth[_0x739f('0x9')](),controller[_0x739f('0x39')]);router['post'](_0x739f('0x3a'),auth[_0x739f('0x9')](),controller[_0x739f('0x37')](_0x739f('0x3b')));router['get']('/chat/queues/:id',auth[_0x739f('0x9')](),controller[_0x739f('0x3c')]);router[_0x739f('0x3d')]('/fax/queues/:id/notify',auth[_0x739f('0x9')](),controller[_0x739f('0x37')](_0x739f('0x3e')));router['get'](_0x739f('0x3f'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x739f('0x3d')](_0x739f('0x40'),auth[_0x739f('0x9')](),controller[_0x739f('0x37')](_0x739f('0x41')));router[_0x739f('0x7')](_0x739f('0x42'),auth['isAuthenticated'](),controller[_0x739f('0x43')]);router[_0x739f('0x3d')](_0x739f('0x44'),auth[_0x739f('0x9')](),controller[_0x739f('0x37')](_0x739f('0x45')));router[_0x739f('0x7')](_0x739f('0x46'),auth['isAuthenticated'](),controller[_0x739f('0x47')]);router[_0x739f('0x3d')]('/agents/:id/notify',auth['isAuthenticated'](),controller['agentNotify']);module[_0x739f('0x48')]=router; \ No newline at end of file +var _0x176a=['showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','/agents/:id/notify','exports','multer','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','/outbound/channels','outboundChannels','agents','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/fax/queues/waitinginteractions','post','queueNotify','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id'];(function(_0x36d89e,_0x10798d){var _0x2ec585=function(_0x82bae2){while(--_0x82bae2){_0x36d89e['push'](_0x36d89e['shift']());}};_0x2ec585(++_0x10798d);}(_0x176a,0x8a));var _0xa176=function(_0x117146,_0x125f6b){_0x117146=_0x117146-0x0;var _0x1c74c6=_0x176a[_0x117146];return _0x1c74c6;};'use strict';var multer=require(_0xa176('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express[_0xa176('0x1')]();var auth=require(_0xa176('0x2'));var controller=require('./rpc.controller');router[_0xa176('0x3')](_0xa176('0x4'),auth[_0xa176('0x5')](),controller[_0xa176('0x6')]);router[_0xa176('0x3')](_0xa176('0x7'),auth[_0xa176('0x5')](),controller[_0xa176('0x8')]);router[_0xa176('0x3')](_0xa176('0x9'),auth[_0xa176('0x5')](),controller[_0xa176('0xa')]);router[_0xa176('0x3')](_0xa176('0xb'),auth['isAuthenticated'](),controller[_0xa176('0xc')]);router[_0xa176('0x3')](_0xa176('0xd'),auth[_0xa176('0x5')](),controller['chatQueues']);router[_0xa176('0x3')](_0xa176('0xe'),auth['isAuthenticated'](),controller['mailQueues']);router[_0xa176('0x3')](_0xa176('0xf'),auth[_0xa176('0x5')](),controller[_0xa176('0x10')]);router['get']('/openchannel/queues',auth[_0xa176('0x5')](),controller[_0xa176('0x11')]);router[_0xa176('0x3')](_0xa176('0x12'),auth['isAuthenticated'](),controller['smsQueues']);router[_0xa176('0x3')](_0xa176('0x13'),auth[_0xa176('0x5')](),controller[_0xa176('0x14')]);router['get'](_0xa176('0x15'),auth['isAuthenticated'](),controller[_0xa176('0x16')]);router[_0xa176('0x3')](_0xa176('0x17'),auth[_0xa176('0x5')](),controller[_0xa176('0x18')]);router['get'](_0xa176('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get'](_0xa176('0x1a'),auth[_0xa176('0x5')](),controller[_0xa176('0x1b')]);router['get'](_0xa176('0x1c'),auth[_0xa176('0x5')](),controller[_0xa176('0x1d')]);router[_0xa176('0x3')]('/voice/queues/:id',auth[_0xa176('0x5')](),controller[_0xa176('0x1e')]);router[_0xa176('0x3')](_0xa176('0x1f'),auth[_0xa176('0x5')](),controller['outbound']);router['get'](_0xa176('0x20'),auth['isAuthenticated'](),controller[_0xa176('0x21')]);router[_0xa176('0x3')]('/agents',auth[_0xa176('0x5')](),controller[_0xa176('0x22')]);router['put']('/agents/:id/capacity',auth[_0xa176('0x5')](),controller[_0xa176('0x23')]);router[_0xa176('0x3')]('/telephones',auth[_0xa176('0x5')](),controller[_0xa176('0x24')]);router[_0xa176('0x3')](_0xa176('0x25'),auth['isAuthenticated'](),controller[_0xa176('0x26')]);router[_0xa176('0x3')](_0xa176('0x27'),auth[_0xa176('0x5')](),controller['campaigns']);router['get'](_0xa176('0x28'),auth[_0xa176('0x5')](),controller['faxAccounts']);router[_0xa176('0x3')](_0xa176('0x29'),auth[_0xa176('0x5')](),controller[_0xa176('0x2a')]);router['get'](_0xa176('0x2b'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xa176('0x3')](_0xa176('0x2c'),auth[_0xa176('0x5')](),controller['openchannelQueuesWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth[_0xa176('0x5')](),controller['smsQueuesWaitingInteractions']);router[_0xa176('0x3')](_0xa176('0x2d'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0xa176('0x2e')]('/mail/queues/:id/notify',auth[_0xa176('0x5')](),controller[_0xa176('0x2f')]('mail'));router[_0xa176('0x3')](_0xa176('0x30'),auth['isAuthenticated'](),controller['showMailQueues']);router['post'](_0xa176('0x31'),auth[_0xa176('0x5')](),controller[_0xa176('0x2f')](_0xa176('0x32')));router[_0xa176('0x3')](_0xa176('0x33'),auth[_0xa176('0x5')](),controller[_0xa176('0x34')]);router[_0xa176('0x2e')]('/fax/queues/:id/notify',auth[_0xa176('0x5')](),controller['queueNotify']('fax'));router[_0xa176('0x3')](_0xa176('0x35'),auth['isAuthenticated'](),controller[_0xa176('0x36')]);router[_0xa176('0x2e')](_0xa176('0x37'),auth[_0xa176('0x5')](),controller[_0xa176('0x2f')](_0xa176('0x38')));router[_0xa176('0x3')](_0xa176('0x39'),auth[_0xa176('0x5')](),controller[_0xa176('0x3a')]);router[_0xa176('0x2e')](_0xa176('0x3b'),auth[_0xa176('0x5')](),controller[_0xa176('0x2f')](_0xa176('0x3c')));router[_0xa176('0x3')](_0xa176('0x3d'),auth[_0xa176('0x5')](),controller['showSmsQueues']);router['post'](_0xa176('0x3e'),auth['isAuthenticated'](),controller['agentNotify']);module[_0xa176('0x3f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 21a5247..1fa1171 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 _0xece6=['name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','agentCapacity','body','user','interaction','MemberReport','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Account','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','Website','User','Agent\x20not\x20found','InteractionId','From','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack'];(function(_0x10f3fd,_0x206a70){var _0x10ffed=function(_0x382010){while(--_0x382010){_0x10f3fd['push'](_0x10f3fd['shift']());}};_0x10ffed(++_0x206a70);}(_0xece6,0xd7));var _0x6ece=function(_0x5001b4,_0x362ed5){_0x5001b4=_0x5001b4-0x0;var _0x44ffa7=_0xece6[_0x5001b4];return _0x44ffa7;};'use strict';var BPromise=require(_0x6ece('0x0'));var moment=require(_0x6ece('0x1'));var _=require(_0x6ece('0x2'));var util=require(_0x6ece('0x3'));var db=require(_0x6ece('0x4'))['db'];var logger=require(_0x6ece('0x5'))(_0x6ece('0x6'));var jayson=require(_0x6ece('0x7'));var amiClient=jayson[_0x6ece('0x8')][_0x6ece('0x9')]({'port':0x232a});var mailClient=jayson[_0x6ece('0x8')][_0x6ece('0x9')]({'port':0x232b});var routingClient=jayson[_0x6ece('0x8')]['http']({'port':0x232c});function respondWithRpcPromise(_0xd523ee,_0xaf732a,_0x5f0cc3){return new BPromise(function(_0x53b8a4,_0x1e5f2f){var _0x2e8a31=_0x5f0cc3?_0x5f0cc3:amiClient;return _0x2e8a31[_0x6ece('0xa')](_0xd523ee,_0xaf732a)[_0x6ece('0xb')](function(_0x37c3f6){if(_0x37c3f6[_0x6ece('0xc')]){if(_0x37c3f6['error'][_0x6ece('0xd')]===0x1f4){return _0x1e5f2f(_0x37c3f6[_0x6ece('0xc')][_0x6ece('0xe')]);}return _0x53b8a4(_0x37c3f6[_0x6ece('0xc')]['message']);}else{_0x53b8a4(_0x37c3f6[_0x6ece('0xf')]);}})[_0x6ece('0x10')](function(_0x457752){_0x1e5f2f(_0x457752);});});}function respondWithResult(_0x3ac187,_0x1365df){_0x1365df=_0x1365df||0xc8;return function(_0x119ba1){if(_0x119ba1){return _0x3ac187[_0x6ece('0x11')](_0x1365df)[_0x6ece('0x12')](_0x119ba1);}return _0x3ac187[_0x6ece('0x13')](0x194);};}function handleError(_0x4f43f1,_0x196af0){_0x196af0=_0x196af0||0x1f4;return function(_0x318be0){logger[_0x6ece('0xc')](_0x318be0[_0x6ece('0x14')]);if(_0x318be0[_0x6ece('0x15')]){delete _0x318be0[_0x6ece('0x15')];}_0x4f43f1[_0x6ece('0x11')](_0x196af0)[_0x6ece('0x16')](_0x318be0);};}function findById(_0x54479b){return function(_0x4d880f){if(!_[_0x6ece('0x17')](_0x54479b)&&!_[_0x6ece('0x17')](_0x4d880f)&&!_[_0x6ece('0x17')](_0x4d880f[_0x6ece('0x18')])){return _[_0x6ece('0x19')](_0x4d880f['rows'],function(_0x4d8d63){return _0x4d8d63['id']==_0x54479b;});}return null;};}exports[_0x6ece('0x1a')]=function(_0x26cc12,_0x1e0401){return respondWithRpcPromise(_0x6ece('0x1b'),_0x26cc12[_0x6ece('0x1c')])[_0x6ece('0xb')](respondWithResult(_0x1e0401,null))[_0x6ece('0x10')](handleError(_0x1e0401,null));};exports[_0x6ece('0x1d')]=function(_0x3fe7fd,_0x4cc631){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x6ece('0x1e')](_0x3fe7fd[_0x6ece('0x1c')],_0x3fe7fd[_0x6ece('0x1f')]))[_0x6ece('0xb')](respondWithResult(_0x4cc631,null))['catch'](handleError(_0x4cc631,null));};exports[_0x6ece('0x20')]=function(_0x5d9cf6,_0x3ebd39){return respondWithRpcPromise(_0x6ece('0x21'),_[_0x6ece('0x1e')](_0x5d9cf6['query'],_0x5d9cf6[_0x6ece('0x1f')]))[_0x6ece('0xb')](respondWithResult(_0x3ebd39,null))['catch'](handleError(_0x3ebd39,null));};exports[_0x6ece('0x22')]=function(_0x86977f,_0x5df555){return respondWithRpcPromise(_0x6ece('0x23'),_0x86977f['query'])[_0x6ece('0xb')](respondWithResult(_0x5df555,null))[_0x6ece('0x10')](handleError(_0x5df555,null));};exports['showVoiceQueues']=function(_0x18c805,_0x3cebc8){return respondWithRpcPromise(_0x6ece('0x23'),_0x18c805[_0x6ece('0x1c')])[_0x6ece('0xb')](findById(_0x18c805[_0x6ece('0x1f')]['id']))[_0x6ece('0xb')](respondWithResult(_0x3cebc8,null))[_0x6ece('0x10')](handleError(_0x3cebc8,null));};exports['voiceQueuesPreview']=function(_0x43177b,_0x4270a8){return respondWithRpcPromise(_0x6ece('0x24'),_['merge'](_0x43177b['query'],_0x43177b[_0x6ece('0x1f')]))[_0x6ece('0xb')](respondWithResult(_0x4270a8,null))[_0x6ece('0x10')](handleError(_0x4270a8,null));};exports[_0x6ece('0x25')]=function(_0x47752b,_0x3eb9b9){return respondWithRpcPromise('VoiceQueuesChannels',_0x47752b[_0x6ece('0x1c')])[_0x6ece('0xb')](respondWithResult(_0x3eb9b9,null))[_0x6ece('0x10')](handleError(_0x3eb9b9,null));};exports[_0x6ece('0x26')]=function(_0x2782ca,_0x42a49f){return respondWithRpcPromise(_0x6ece('0x27'),_[_0x6ece('0x1e')](_0x2782ca[_0x6ece('0x1c')],_0x2782ca[_0x6ece('0x1f')]))[_0x6ece('0xb')](respondWithResult(_0x42a49f,null))[_0x6ece('0x10')](handleError(_0x42a49f,null));};exports[_0x6ece('0x28')]=function(_0x12ea15,_0x1de278){return respondWithRpcPromise(_0x6ece('0x29'),_[_0x6ece('0x1e')](_0x12ea15[_0x6ece('0x1c')],_0x12ea15[_0x6ece('0x1f')]))[_0x6ece('0xb')](respondWithResult(_0x1de278,null))[_0x6ece('0x10')](handleError(_0x1de278,null));};exports[_0x6ece('0x2a')]=function(_0x111646,_0xae34f2){return respondWithRpcPromise(_0x6ece('0x2b'),_[_0x6ece('0x1e')](_0x111646[_0x6ece('0x1c')],_0x111646['params']))[_0x6ece('0xb')](respondWithResult(_0xae34f2,null))[_0x6ece('0x10')](handleError(_0xae34f2,null));};exports[_0x6ece('0x2c')]=function(_0x31a758,_0x30b1b2){return respondWithRpcPromise(_0x6ece('0x2d'),_0x31a758['query'])[_0x6ece('0xb')](respondWithResult(_0x30b1b2,null))[_0x6ece('0x10')](handleError(_0x30b1b2,null));};exports[_0x6ece('0x2e')]=function(_0x5709b8,_0x5eacac){return respondWithRpcPromise('OutboundChannels',_0x5709b8['query'])[_0x6ece('0xb')](respondWithResult(_0x5eacac,null))['catch'](handleError(_0x5eacac,null));};exports[_0x6ece('0x2f')]=function(_0x5749b9,_0x583b5e){var _0x2defe6;return respondWithRpcPromise(_0x6ece('0x30'),_0x5749b9[_0x6ece('0x1c')])[_0x6ece('0xb')](function(_0x2573d8){_0x2defe6=_0x2573d8;return respondWithRpcPromise(_0x6ece('0x30'),_0x5749b9[_0x6ece('0x1c')],routingClient);})[_0x6ece('0xb')](function(_0x31f194){return _[_0x6ece('0x1e')]({},_0x31f194,_0x2defe6);})[_0x6ece('0xb')](respondWithResult(_0x583b5e,null))[_0x6ece('0x10')](handleError(_0x583b5e,null));};exports[_0x6ece('0x31')]=function(_0x2115dd,_0xd51f4b){if(_0x2115dd['body']&&_0x2115dd[_0x6ece('0x32')]['interaction']&&_0x2115dd['user']&&_0x2115dd[_0x6ece('0x33')][_0x6ece('0x15')]){for(var _0x435915 in _0x2115dd[_0x6ece('0x32')][_0x6ece('0x34')]){if(_0x2115dd[_0x6ece('0x32')][_0x6ece('0x34')]['hasOwnProperty'](_0x435915)){db[_0x6ece('0x35')][_0x6ece('0x36')]({'where':{'channel':_0x435915,'membername':_0x2115dd['user']['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x2115dd[_0x6ece('0x32')][_0x6ece('0x34')][_0x435915]&&_0x2115dd[_0x6ece('0x32')]['interaction'][_0x435915]['length']?{'$notIn':_0x2115dd['body'][_0x6ece('0x34')][_0x435915]}:{'$ne':null}}})[_0x6ece('0xb')](function(_0x5de0bd){var _0x118274=moment()[_0x6ece('0x37')](_0x6ece('0x38'));for(var _0x540197=0x0,_0x5b3d06=_0x5de0bd[_0x6ece('0x39')];_0x540197<_0x5b3d06;_0x540197+=0x1){_0x5de0bd[_0x540197]['updateAttributes']({'exitAt':_0x118274});}});for(var _0x4c6fa2=0x0;_0x4c6fa2<_0x2115dd[_0x6ece('0x32')][_0x6ece('0x34')][_0x435915][_0x6ece('0x39')];_0x4c6fa2+=0x1){db[_0x6ece('0x35')][_0x6ece('0x3a')]({'where':{'channel':_0x435915,'membername':_0x2115dd['user'][_0x6ece('0x15')],'type':_0x6ece('0x3b'),'uniqueid':_0x2115dd[_0x6ece('0x32')]['interaction'][_0x435915][_0x4c6fa2],'exitAt':null},'defaults':{'channel':_0x435915,'membername':_0x2115dd[_0x6ece('0x33')]['name'],'interface':_[_0x6ece('0x17')](_0x2115dd[_0x6ece('0x33')][_0x6ece('0x3c')])?util[_0x6ece('0x37')](_0x6ece('0x3d'),_0x2115dd['user'][_0x6ece('0x15')]):_0x2115dd[_0x6ece('0x33')][_0x6ece('0x3c')],'type':_0x6ece('0x3b'),'enterAt':moment()[_0x6ece('0x37')](_0x6ece('0x38')),'role':_0x6ece('0x3e'),'internal':_0x2115dd[_0x6ece('0x33')][_0x6ece('0x3f')],'uniqueid':_0x2115dd[_0x6ece('0x32')][_0x6ece('0x34')][_0x435915][_0x4c6fa2]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2115dd[_0x6ece('0x1f')]['id'],'capacity':_0x2115dd['body']['capacity']},routingClient)[_0x6ece('0xb')](respondWithResult(_0xd51f4b,null))[_0x6ece('0x10')](handleError(_0xd51f4b,null));};exports[_0x6ece('0x40')]=function(_0x2a955c,_0x4f6d97){return respondWithRpcPromise(_0x6ece('0x41'),_0x2a955c['query'])[_0x6ece('0xb')](respondWithResult(_0x4f6d97,null))[_0x6ece('0x10')](handleError(_0x4f6d97,null));};exports[_0x6ece('0x42')]=function(_0x141ac8,_0x177694){return respondWithRpcPromise(_0x6ece('0x43'),_0x141ac8[_0x6ece('0x1c')])[_0x6ece('0xb')](respondWithResult(_0x177694,null))[_0x6ece('0x10')](handleError(_0x177694,null));};exports[_0x6ece('0x44')]=function(_0x2e3b1d,_0x33d9cc){return respondWithRpcPromise(_0x6ece('0x45'),_0x2e3b1d['query'])[_0x6ece('0xb')](respondWithResult(_0x33d9cc,null))[_0x6ece('0x10')](handleError(_0x33d9cc,null));};exports['chatQueues']=function(_0x561e9a,_0x22431d){return respondWithRpcPromise('ChatQueues',_0x561e9a['query'],routingClient)[_0x6ece('0xb')](respondWithResult(_0x22431d,null))[_0x6ece('0x10')](handleError(_0x22431d,null));};exports[_0x6ece('0x46')]=function(_0x2c4019,_0x712a04){return respondWithRpcPromise('ChatQueues',_0x2c4019['query'],routingClient)['then'](findById(_0x2c4019[_0x6ece('0x1f')]['id']))[_0x6ece('0xb')](respondWithResult(_0x712a04,null))[_0x6ece('0x10')](handleError(_0x712a04,null));};exports[_0x6ece('0x47')]=function(_0x41bbc8,_0x28e15c){return respondWithRpcPromise('MailQueues',_0x41bbc8[_0x6ece('0x1c')],routingClient)[_0x6ece('0xb')](respondWithResult(_0x28e15c,null))['catch'](handleError(_0x28e15c,null));};exports[_0x6ece('0x48')]=function(_0x257272,_0x2992dc){return respondWithRpcPromise(_0x6ece('0x49'),_0x257272[_0x6ece('0x1c')],routingClient)[_0x6ece('0xb')](findById(_0x257272[_0x6ece('0x1f')]['id']))[_0x6ece('0xb')](respondWithResult(_0x2992dc,null))[_0x6ece('0x10')](handleError(_0x2992dc,null));};exports[_0x6ece('0x4a')]=function(_0xb15679,_0x225658){return respondWithRpcPromise(_0x6ece('0x4b'),_0xb15679['query'],mailClient)[_0x6ece('0xb')](respondWithResult(_0x225658,null))[_0x6ece('0x10')](handleError(_0x225658,null));};exports[_0x6ece('0x4c')]=function(_0x1a90f2,_0x114524){return respondWithRpcPromise(_0x6ece('0x4d'),_0x1a90f2['query'],routingClient)[_0x6ece('0xb')](respondWithResult(_0x114524,null))[_0x6ece('0x10')](handleError(_0x114524,null));};exports['showOpenchannelQueues']=function(_0x2d629d,_0x2d15b1){return respondWithRpcPromise(_0x6ece('0x4d'),_0x2d629d[_0x6ece('0x1c')],routingClient)[_0x6ece('0xb')](findById(_0x2d629d[_0x6ece('0x1f')]['id']))['then'](respondWithResult(_0x2d15b1,null))['catch'](handleError(_0x2d15b1,null));};exports[_0x6ece('0x4e')]=function(_0x2fd475,_0x32448e){return respondWithRpcPromise(_0x6ece('0x4f'),_0x2fd475[_0x6ece('0x1c')],routingClient)[_0x6ece('0xb')](respondWithResult(_0x32448e,null))[_0x6ece('0x10')](handleError(_0x32448e,null));};exports['showSmsQueues']=function(_0x3aa75e,_0x5aa083){return respondWithRpcPromise('SmsQueues',_0x3aa75e[_0x6ece('0x1c')],routingClient)[_0x6ece('0xb')](findById(_0x3aa75e[_0x6ece('0x1f')]['id']))[_0x6ece('0xb')](respondWithResult(_0x5aa083,null))[_0x6ece('0x10')](handleError(_0x5aa083,null));};exports[_0x6ece('0x50')]=function(_0x5058f7,_0xa6824a){return respondWithRpcPromise(_0x6ece('0x51'),_0x5058f7[_0x6ece('0x1c')],routingClient)[_0x6ece('0xb')](respondWithResult(_0xa6824a,null))[_0x6ece('0x10')](handleError(_0xa6824a,null));};exports[_0x6ece('0x52')]=function(_0x5e2581,_0x1c17cf){return respondWithRpcPromise('FaxQueues',_0x5e2581[_0x6ece('0x1c')],routingClient)[_0x6ece('0xb')](findById(_0x5e2581['params']['id']))['then'](respondWithResult(_0x1c17cf,null))[_0x6ece('0x10')](handleError(_0x1c17cf,null));};exports['faxAccounts']=function(_0x409ba5,_0x46d0d9){return respondWithRpcPromise(_0x6ece('0x53'),_0x409ba5[_0x6ece('0x1c')])[_0x6ece('0xb')](respondWithResult(_0x46d0d9,null))['catch'](handleError(_0x46d0d9,null));};exports['chatQueuesWaitingInteractions']=function(_0x363bd9,_0x5a003a){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x363bd9[_0x6ece('0x1c')],routingClient)['then'](respondWithResult(_0x5a003a,null))[_0x6ece('0x10')](handleError(_0x5a003a,null));};exports[_0x6ece('0x54')]=function(_0x5fa6ff,_0x225469){return respondWithRpcPromise(_0x6ece('0x55'),_0x5fa6ff[_0x6ece('0x1c')],routingClient)[_0x6ece('0xb')](respondWithResult(_0x225469,null))[_0x6ece('0x10')](handleError(_0x225469,null));};exports[_0x6ece('0x56')]=function(_0x213922,_0x4e6844){return respondWithRpcPromise(_0x6ece('0x57'),_0x213922[_0x6ece('0x1c')],routingClient)[_0x6ece('0xb')](respondWithResult(_0x4e6844,null))[_0x6ece('0x10')](handleError(_0x4e6844,null));};exports[_0x6ece('0x58')]=function(_0x153368,_0xaef22c){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x153368[_0x6ece('0x1c')],routingClient)[_0x6ece('0xb')](respondWithResult(_0xaef22c,null))['catch'](handleError(_0xaef22c,null));};exports[_0x6ece('0x59')]=function(_0x4e4448,_0x57c2db){return respondWithRpcPromise(_0x6ece('0x5a'),_0x4e4448['query'],routingClient)[_0x6ece('0xb')](respondWithResult(_0x57c2db,null))[_0x6ece('0x10')](handleError(_0x57c2db,null));};exports[_0x6ece('0x5b')]=function(_0x4584d3){return function(_0x162a41,_0x1928d5){var _0x440202,_0x8552ae;var _0x2369f6=_[_0x6ece('0x5c')](_0x4584d3);var _0x3853b7=_0x4584d3==='chat'?'Website':_0x6ece('0x5d');return db[_0x2369f6+'Queue']['findOne']({'raw':!![],'where':{'id':_0x162a41[_0x6ece('0x1f')]['id']}})[_0x6ece('0xb')](function(_0x30a673){if(_['isNil'](_0x30a673)){throw new Error(_0x2369f6+_0x6ece('0x5e'));}_0x440202=_0x30a673;return db[_0x2369f6+_0x6ece('0x5f')][_0x6ece('0x60')]({'where':{'id':_0x162a41[_0x6ece('0x32')][_0x6ece('0x61')]},'include':[{'model':db[_0x2369f6+'Interaction'],'as':_0x6ece('0x62')},{'model':db[_0x2369f6+_0x3853b7],'as':_0x6ece('0x5d')}]});})['then'](function(_0x12f239){if(_['isNil'](_0x12f239)){throw new Error(_0x2369f6+_0x6ece('0x63'));}_0x8552ae=_0x12f239;return _0x12f239[_0x6ece('0x64')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6ece('0xb')](function(){var _0x2055a0={'uniqueid':_0x4584d3+'.'+_0x8552ae['id']+'.'+_0x8552ae[_0x6ece('0x62')]['id'],'FromUserId':_0x162a41['user']['id'],'type':_0x6ece('0x65')};_0x2055a0[_0x2369f6+_0x6ece('0x66')]=_0x8552ae['id'];_0x2055a0[_0x2369f6+'InteractionId']=_0x8552ae[_0x6ece('0x62')]['id'];_0x2055a0['From'+_0x2369f6+_0x3853b7+'Id']=_0x8552ae['Account']['id'];_0x2055a0['To'+_0x2369f6+_0x6ece('0x67')]=_0x440202['id'];return db[_0x2369f6+_0x6ece('0x68')][_0x6ece('0x69')](_0x2055a0);})[_0x6ece('0xb')](function(){return respondWithRpcPromise(_0x6ece('0x6a'),{'channel':_0x4584d3,'interaction':_0x8552ae[_0x6ece('0x62')],'message':_0x8552ae,'account':_0x8552ae[_0x6ece('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6ece('0x65'),'appdata':_0x440202[_0x6ece('0x15')]+','+(_0x8552ae[_0x6ece('0x5d')][_0x6ece('0x6b')]||0x12c),'interval':_0x6ece('0x6c')}]},routingClient);})[_0x6ece('0xb')](respondWithResult(_0x1928d5,null))[_0x6ece('0x10')](handleError(_0x1928d5,null));};};exports[_0x6ece('0x6d')]=function(_0x268232,_0x2e69a8){var _0xbf5955,_0x1c162a;if(_[_0x6ece('0x17')](_0x268232[_0x6ece('0x32')][_0x6ece('0x6e')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x530abd=_0x268232[_0x6ece('0x32')][_0x6ece('0x6e')];var _0x2591d8=_[_0x6ece('0x5c')](_0x530abd);var _0x275ec2=_0x530abd===_0x6ece('0x6f')?_0x6ece('0x70'):_0x6ece('0x5d');return db[_0x6ece('0x71')][_0x6ece('0x60')]({'raw':!![],'where':{'id':_0x268232['params']['id'],'role':_0x6ece('0x3e')}})[_0x6ece('0xb')](function(_0x2fa374){if(_[_0x6ece('0x17')](_0x2fa374)){throw new Error(_0x6ece('0x72'));}_0xbf5955=_0x2fa374;return db[_0x2591d8+_0x6ece('0x5f')][_0x6ece('0x60')]({'where':{'id':_0x268232[_0x6ece('0x32')][_0x6ece('0x61')]},'include':[{'model':db[_0x2591d8+_0x6ece('0x62')],'as':_0x6ece('0x62')},{'model':db[_0x2591d8+_0x275ec2],'as':_0x6ece('0x5d')}]});})[_0x6ece('0xb')](function(_0x11df15){if(_['isNil'](_0x11df15)){throw new Error(_0x2591d8+_0x6ece('0x63'));}_0x1c162a=_0x11df15;return _0x11df15[_0x6ece('0x64')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6ece('0xb')](function(){var _0x7cd3b4={'uniqueid':_0x530abd+'.'+_0x1c162a['id']+'.'+_0x1c162a[_0x6ece('0x62')]['id'],'FromUserId':_0x268232[_0x6ece('0x33')]['id'],'type':_0x6ece('0x65'),'ToUserId':_0xbf5955['id']};_0x7cd3b4[_0x2591d8+'MessageId']=_0x1c162a['id'];_0x7cd3b4[_0x2591d8+_0x6ece('0x73')]=_0x1c162a[_0x6ece('0x62')]['id'];_0x7cd3b4[_0x6ece('0x74')+_0x2591d8+_0x275ec2+'Id']=_0x1c162a['Account']['id'];return db[_0x2591d8+_0x6ece('0x68')][_0x6ece('0x69')](_0x7cd3b4);})[_0x6ece('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x530abd,'interaction':_0x1c162a[_0x6ece('0x62')],'message':_0x1c162a,'account':_0x1c162a['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x6ece('0x3e'),'appdata':_0xbf5955[_0x6ece('0x15')]+','+(_0x1c162a['Account'][_0x6ece('0x75')]||0x12c),'interval':_0x6ece('0x6c')}]},routingClient);})[_0x6ece('0xb')](respondWithResult(_0x2e69a8,null))['catch'](handleError(_0x2e69a8,null));}; \ No newline at end of file +var _0xe008=['create','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','agent','Agent\x20not\x20found','Message','update','From','Start','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','catch','sendStatus','stack','name','status','send','isNil','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','messageId','Interaction','\x20Message\x20not\x20found','queue','InteractionId','QueueId','TransferReport'];(function(_0x3afa1b,_0x57ec8c){var _0x33f1d7=function(_0x9a6190){while(--_0x9a6190){_0x3afa1b['push'](_0x3afa1b['shift']());}};_0x33f1d7(++_0x57ec8c);}(_0xe008,0xe9));var _0x8e00=function(_0xa4040,_0x32119b){_0xa4040=_0xa4040-0x0;var _0x405c12=_0xe008[_0xa4040];return _0x405c12;};'use strict';var BPromise=require(_0x8e00('0x0'));var moment=require(_0x8e00('0x1'));var _=require(_0x8e00('0x2'));var util=require(_0x8e00('0x3'));var db=require(_0x8e00('0x4'))['db'];var logger=require(_0x8e00('0x5'))(_0x8e00('0x6'));var jayson=require(_0x8e00('0x7'));var amiClient=jayson[_0x8e00('0x8')]['http']({'port':0x232a});var mailClient=jayson['client'][_0x8e00('0x9')]({'port':0x232b});var routingClient=jayson[_0x8e00('0x8')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2a8faf,_0x4e3588,_0xe4952d){return new BPromise(function(_0x129979,_0x5a308b){var _0x40a23d=_0xe4952d?_0xe4952d:amiClient;return _0x40a23d[_0x8e00('0xa')](_0x2a8faf,_0x4e3588)[_0x8e00('0xb')](function(_0x5ba207){if(_0x5ba207[_0x8e00('0xc')]){if(_0x5ba207[_0x8e00('0xc')][_0x8e00('0xd')]===0x1f4){return _0x5a308b(_0x5ba207[_0x8e00('0xc')]['message']);}return _0x129979(_0x5ba207[_0x8e00('0xc')]['message']);}else{_0x129979(_0x5ba207['result']);}})[_0x8e00('0xe')](function(_0x1fad24){_0x5a308b(_0x1fad24);});});}function respondWithResult(_0x558001,_0x4fd068){_0x4fd068=_0x4fd068||0xc8;return function(_0x2bee07){if(_0x2bee07){return _0x558001['status'](_0x4fd068)['json'](_0x2bee07);}return _0x558001[_0x8e00('0xf')](0x194);};}function handleError(_0x4704c2,_0x1ec79a){_0x1ec79a=_0x1ec79a||0x1f4;return function(_0x4e5697){logger[_0x8e00('0xc')](_0x4e5697[_0x8e00('0x10')]);if(_0x4e5697[_0x8e00('0x11')]){delete _0x4e5697[_0x8e00('0x11')];}_0x4704c2[_0x8e00('0x12')](_0x1ec79a)[_0x8e00('0x13')](_0x4e5697);};}function findById(_0x13cccb){return function(_0x15c3ed){if(!_[_0x8e00('0x14')](_0x13cccb)&&!_[_0x8e00('0x14')](_0x15c3ed)&&!_[_0x8e00('0x14')](_0x15c3ed['rows'])){return _['find'](_0x15c3ed['rows'],function(_0x4bb39b){return _0x4bb39b['id']==_0x13cccb;});}return null;};}exports['voiceChannels']=function(_0x2f18f6,_0x4f804f){return respondWithRpcPromise('VoiceChannels',_0x2f18f6['query'])[_0x8e00('0xb')](respondWithResult(_0x4f804f,null))[_0x8e00('0xe')](handleError(_0x4f804f,null));};exports[_0x8e00('0x15')]=function(_0x8420b3,_0x5291d3){return respondWithRpcPromise(_0x8e00('0x16'),_[_0x8e00('0x17')](_0x8420b3[_0x8e00('0x18')],_0x8420b3[_0x8e00('0x19')]))[_0x8e00('0xb')](respondWithResult(_0x5291d3,null))[_0x8e00('0xe')](handleError(_0x5291d3,null));};exports['voiceChannelStopMixMonitor']=function(_0xca6e95,_0x292b26){return respondWithRpcPromise(_0x8e00('0x1a'),_['merge'](_0xca6e95[_0x8e00('0x18')],_0xca6e95['params']))[_0x8e00('0xb')](respondWithResult(_0x292b26,null))['catch'](handleError(_0x292b26,null));};exports[_0x8e00('0x1b')]=function(_0x1825dd,_0x4850be){return respondWithRpcPromise(_0x8e00('0x1c'),_0x1825dd[_0x8e00('0x18')])[_0x8e00('0xb')](respondWithResult(_0x4850be,null))[_0x8e00('0xe')](handleError(_0x4850be,null));};exports[_0x8e00('0x1d')]=function(_0x373d0b,_0x10856f){return respondWithRpcPromise(_0x8e00('0x1c'),_0x373d0b[_0x8e00('0x18')])[_0x8e00('0xb')](findById(_0x373d0b[_0x8e00('0x19')]['id']))[_0x8e00('0xb')](respondWithResult(_0x10856f,null))[_0x8e00('0xe')](handleError(_0x10856f,null));};exports[_0x8e00('0x1e')]=function(_0x52ee52,_0x31fbcd){return respondWithRpcPromise(_0x8e00('0x1f'),_[_0x8e00('0x17')](_0x52ee52['query'],_0x52ee52[_0x8e00('0x19')]))[_0x8e00('0xb')](respondWithResult(_0x31fbcd,null))[_0x8e00('0xe')](handleError(_0x31fbcd,null));};exports[_0x8e00('0x20')]=function(_0x2076d0,_0x5c2e5c){return respondWithRpcPromise(_0x8e00('0x21'),_0x2076d0[_0x8e00('0x18')])[_0x8e00('0xb')](respondWithResult(_0x5c2e5c,null))[_0x8e00('0xe')](handleError(_0x5c2e5c,null));};exports[_0x8e00('0x22')]=function(_0x5ae38d,_0x124d56){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x8e00('0x17')](_0x5ae38d['query'],_0x5ae38d['params']))['then'](respondWithResult(_0x124d56,null))[_0x8e00('0xe')](handleError(_0x124d56,null));};exports['voiceQueuesChannelHangup']=function(_0x2426c2,_0x4cd76a){return respondWithRpcPromise(_0x8e00('0x23'),_['merge'](_0x2426c2[_0x8e00('0x18')],_0x2426c2['params']))[_0x8e00('0xb')](respondWithResult(_0x4cd76a,null))[_0x8e00('0xe')](handleError(_0x4cd76a,null));};exports[_0x8e00('0x24')]=function(_0x76f005,_0x1dc6dd){return respondWithRpcPromise(_0x8e00('0x25'),_[_0x8e00('0x17')](_0x76f005[_0x8e00('0x18')],_0x76f005[_0x8e00('0x19')]))['then'](respondWithResult(_0x1dc6dd,null))[_0x8e00('0xe')](handleError(_0x1dc6dd,null));};exports[_0x8e00('0x26')]=function(_0x1009e4,_0xbec57c){return respondWithRpcPromise(_0x8e00('0x27'),_0x1009e4[_0x8e00('0x18')])['then'](respondWithResult(_0xbec57c,null))[_0x8e00('0xe')](handleError(_0xbec57c,null));};exports[_0x8e00('0x28')]=function(_0x359be4,_0x10cd8e){return respondWithRpcPromise(_0x8e00('0x29'),_0x359be4[_0x8e00('0x18')])[_0x8e00('0xb')](respondWithResult(_0x10cd8e,null))[_0x8e00('0xe')](handleError(_0x10cd8e,null));};exports[_0x8e00('0x2a')]=function(_0x290a35,_0x1b15b4){var _0x4f882b;return respondWithRpcPromise(_0x8e00('0x2b'),_0x290a35['query'])[_0x8e00('0xb')](function(_0x36703a){_0x4f882b=_0x36703a;return respondWithRpcPromise('Agents',_0x290a35[_0x8e00('0x18')],routingClient);})['then'](function(_0x3fb3a3){return _['merge']({},_0x3fb3a3,_0x4f882b);})['then'](respondWithResult(_0x1b15b4,null))[_0x8e00('0xe')](handleError(_0x1b15b4,null));};exports[_0x8e00('0x2c')]=function(_0xcec92c,_0x3c29e7){if(_0xcec92c['body']&&_0xcec92c[_0x8e00('0x2d')][_0x8e00('0x2e')]&&_0xcec92c[_0x8e00('0x2f')]&&_0xcec92c[_0x8e00('0x2f')][_0x8e00('0x11')]){for(var _0x251946 in _0xcec92c['body']['interaction']){if(_0xcec92c[_0x8e00('0x2d')][_0x8e00('0x2e')]['hasOwnProperty'](_0x251946)){db[_0x8e00('0x30')][_0x8e00('0x31')]({'where':{'channel':_0x251946,'membername':_0xcec92c[_0x8e00('0x2f')]['name'],'type':_0x8e00('0x32'),'exitAt':null,'uniqueid':_0xcec92c[_0x8e00('0x2d')][_0x8e00('0x2e')][_0x251946]&&_0xcec92c[_0x8e00('0x2d')][_0x8e00('0x2e')][_0x251946][_0x8e00('0x33')]?{'$notIn':_0xcec92c[_0x8e00('0x2d')][_0x8e00('0x2e')][_0x251946]}:{'$ne':null}}})[_0x8e00('0xb')](function(_0x29a139){var _0x3721ac=moment()[_0x8e00('0x34')](_0x8e00('0x35'));for(var _0x6aeeb=0x0,_0x575700=_0x29a139[_0x8e00('0x33')];_0x6aeeb<_0x575700;_0x6aeeb+=0x1){_0x29a139[_0x6aeeb][_0x8e00('0x36')]({'exitAt':_0x3721ac});}});for(var _0x10398f=0x0;_0x10398f<_0xcec92c['body'][_0x8e00('0x2e')][_0x251946][_0x8e00('0x33')];_0x10398f+=0x1){db[_0x8e00('0x30')][_0x8e00('0x37')]({'where':{'channel':_0x251946,'membername':_0xcec92c[_0x8e00('0x2f')]['name'],'type':_0x8e00('0x32'),'uniqueid':_0xcec92c[_0x8e00('0x2d')][_0x8e00('0x2e')][_0x251946][_0x10398f],'exitAt':null},'defaults':{'channel':_0x251946,'membername':_0xcec92c[_0x8e00('0x2f')]['name'],'interface':_[_0x8e00('0x14')](_0xcec92c[_0x8e00('0x2f')][_0x8e00('0x38')])?util['format']('SIP/%s',_0xcec92c[_0x8e00('0x2f')]['name']):_0xcec92c['user'][_0x8e00('0x38')],'type':_0x8e00('0x32'),'enterAt':moment()[_0x8e00('0x34')](_0x8e00('0x35')),'role':'agent','internal':_0xcec92c[_0x8e00('0x2f')][_0x8e00('0x39')],'uniqueid':_0xcec92c[_0x8e00('0x2d')][_0x8e00('0x2e')][_0x251946][_0x10398f]}});}}}}return respondWithRpcPromise(_0x8e00('0x3a'),{'id':_0xcec92c[_0x8e00('0x19')]['id'],'capacity':_0xcec92c[_0x8e00('0x2d')][_0x8e00('0x3b')]},routingClient)[_0x8e00('0xb')](respondWithResult(_0x3c29e7,null))['catch'](handleError(_0x3c29e7,null));};exports[_0x8e00('0x3c')]=function(_0x198115,_0x3ba36e){return respondWithRpcPromise(_0x8e00('0x3d'),_0x198115[_0x8e00('0x18')])['then'](respondWithResult(_0x3ba36e,null))['catch'](handleError(_0x3ba36e,null));};exports[_0x8e00('0x3e')]=function(_0x374cf3,_0x204519){return respondWithRpcPromise(_0x8e00('0x3f'),_0x374cf3[_0x8e00('0x18')])[_0x8e00('0xb')](respondWithResult(_0x204519,null))[_0x8e00('0xe')](handleError(_0x204519,null));};exports[_0x8e00('0x40')]=function(_0x5bd1c0,_0x5e5d0e){return respondWithRpcPromise(_0x8e00('0x41'),_0x5bd1c0[_0x8e00('0x18')])['then'](respondWithResult(_0x5e5d0e,null))[_0x8e00('0xe')](handleError(_0x5e5d0e,null));};exports['chatQueues']=function(_0x2dee53,_0x1c880e){return respondWithRpcPromise(_0x8e00('0x42'),_0x2dee53['query'],routingClient)[_0x8e00('0xb')](respondWithResult(_0x1c880e,null))[_0x8e00('0xe')](handleError(_0x1c880e,null));};exports[_0x8e00('0x43')]=function(_0x5dbea9,_0x5415bb){return respondWithRpcPromise(_0x8e00('0x42'),_0x5dbea9[_0x8e00('0x18')],routingClient)[_0x8e00('0xb')](findById(_0x5dbea9[_0x8e00('0x19')]['id']))[_0x8e00('0xb')](respondWithResult(_0x5415bb,null))[_0x8e00('0xe')](handleError(_0x5415bb,null));};exports[_0x8e00('0x44')]=function(_0x508a73,_0x13e57a){return respondWithRpcPromise('MailQueues',_0x508a73['query'],routingClient)[_0x8e00('0xb')](respondWithResult(_0x13e57a,null))[_0x8e00('0xe')](handleError(_0x13e57a,null));};exports[_0x8e00('0x45')]=function(_0x157fb1,_0x514226){return respondWithRpcPromise(_0x8e00('0x46'),_0x157fb1[_0x8e00('0x18')],routingClient)[_0x8e00('0xb')](findById(_0x157fb1['params']['id']))[_0x8e00('0xb')](respondWithResult(_0x514226,null))['catch'](handleError(_0x514226,null));};exports[_0x8e00('0x47')]=function(_0x51f669,_0x4ec475){return respondWithRpcPromise(_0x8e00('0x48'),_0x51f669[_0x8e00('0x18')],mailClient)['then'](respondWithResult(_0x4ec475,null))[_0x8e00('0xe')](handleError(_0x4ec475,null));};exports['openchannelQueues']=function(_0x1409b5,_0x314dfe){return respondWithRpcPromise(_0x8e00('0x49'),_0x1409b5[_0x8e00('0x18')],routingClient)[_0x8e00('0xb')](respondWithResult(_0x314dfe,null))[_0x8e00('0xe')](handleError(_0x314dfe,null));};exports['showOpenchannelQueues']=function(_0x3aad7d,_0x2f2e55){return respondWithRpcPromise(_0x8e00('0x49'),_0x3aad7d[_0x8e00('0x18')],routingClient)['then'](findById(_0x3aad7d[_0x8e00('0x19')]['id']))[_0x8e00('0xb')](respondWithResult(_0x2f2e55,null))[_0x8e00('0xe')](handleError(_0x2f2e55,null));};exports['smsQueues']=function(_0x46c138,_0x22cda1){return respondWithRpcPromise(_0x8e00('0x4a'),_0x46c138['query'],routingClient)['then'](respondWithResult(_0x22cda1,null))[_0x8e00('0xe')](handleError(_0x22cda1,null));};exports[_0x8e00('0x4b')]=function(_0x112489,_0x3ee2a2){return respondWithRpcPromise('SmsQueues',_0x112489[_0x8e00('0x18')],routingClient)['then'](findById(_0x112489['params']['id']))['then'](respondWithResult(_0x3ee2a2,null))[_0x8e00('0xe')](handleError(_0x3ee2a2,null));};exports[_0x8e00('0x4c')]=function(_0x14a92f,_0xc65719){return respondWithRpcPromise(_0x8e00('0x4d'),_0x14a92f[_0x8e00('0x18')],routingClient)[_0x8e00('0xb')](respondWithResult(_0xc65719,null))['catch'](handleError(_0xc65719,null));};exports[_0x8e00('0x4e')]=function(_0x427183,_0x2cd222){return respondWithRpcPromise(_0x8e00('0x4d'),_0x427183[_0x8e00('0x18')],routingClient)[_0x8e00('0xb')](findById(_0x427183[_0x8e00('0x19')]['id']))[_0x8e00('0xb')](respondWithResult(_0x2cd222,null))[_0x8e00('0xe')](handleError(_0x2cd222,null));};exports[_0x8e00('0x4f')]=function(_0x5e9c0b,_0x2b6315){return respondWithRpcPromise(_0x8e00('0x50'),_0x5e9c0b[_0x8e00('0x18')])[_0x8e00('0xb')](respondWithResult(_0x2b6315,null))['catch'](handleError(_0x2b6315,null));};exports[_0x8e00('0x51')]=function(_0x193388,_0x3c4fa9){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x193388['query'],routingClient)[_0x8e00('0xb')](respondWithResult(_0x3c4fa9,null))['catch'](handleError(_0x3c4fa9,null));};exports[_0x8e00('0x52')]=function(_0x146338,_0x497b4d){return respondWithRpcPromise(_0x8e00('0x53'),_0x146338[_0x8e00('0x18')],routingClient)[_0x8e00('0xb')](respondWithResult(_0x497b4d,null))[_0x8e00('0xe')](handleError(_0x497b4d,null));};exports[_0x8e00('0x54')]=function(_0x272f68,_0x58d9cf){return respondWithRpcPromise(_0x8e00('0x55'),_0x272f68[_0x8e00('0x18')],routingClient)[_0x8e00('0xb')](respondWithResult(_0x58d9cf,null))[_0x8e00('0xe')](handleError(_0x58d9cf,null));};exports[_0x8e00('0x56')]=function(_0xeacd2b,_0x1dfedb){return respondWithRpcPromise(_0x8e00('0x57'),_0xeacd2b['query'],routingClient)[_0x8e00('0xb')](respondWithResult(_0x1dfedb,null))[_0x8e00('0xe')](handleError(_0x1dfedb,null));};exports['faxQueuesWaitingInteractions']=function(_0x5c4a41,_0x4dcb36){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5c4a41['query'],routingClient)[_0x8e00('0xb')](respondWithResult(_0x4dcb36,null))[_0x8e00('0xe')](handleError(_0x4dcb36,null));};exports[_0x8e00('0x58')]=function(_0x3acaef){return function(_0x1ead60,_0x1770f0){var _0x87f1f5,_0x3f74e4;var _0x4c09d6=_[_0x8e00('0x59')](_0x3acaef);var _0xcb0de9=_0x3acaef===_0x8e00('0x5a')?_0x8e00('0x5b'):_0x8e00('0x5c');return db[_0x4c09d6+'Queue']['findOne']({'raw':!![],'where':{'id':_0x1ead60['params']['id']}})[_0x8e00('0xb')](function(_0x5f4961){if(_['isNil'](_0x5f4961)){throw new Error(_0x4c09d6+'\x20Queue\x20not\x20found');}_0x87f1f5=_0x5f4961;return db[_0x4c09d6+'Message']['findOne']({'where':{'id':_0x1ead60[_0x8e00('0x2d')][_0x8e00('0x5d')]},'include':[{'model':db[_0x4c09d6+'Interaction'],'as':_0x8e00('0x5e')},{'model':db[_0x4c09d6+_0xcb0de9],'as':'Account'}]});})[_0x8e00('0xb')](function(_0x4e92e2){if(_[_0x8e00('0x14')](_0x4e92e2)){throw new Error(_0x4c09d6+_0x8e00('0x5f'));}_0x3f74e4=_0x4e92e2;return _0x4e92e2['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x8e00('0xb')](function(){var _0x44cf37={'uniqueid':_0x3acaef+'.'+_0x3f74e4['id']+'.'+_0x3f74e4['Interaction']['id'],'FromUserId':_0x1ead60[_0x8e00('0x2f')]['id'],'type':_0x8e00('0x60')};_0x44cf37[_0x4c09d6+'MessageId']=_0x3f74e4['id'];_0x44cf37[_0x4c09d6+_0x8e00('0x61')]=_0x3f74e4['Interaction']['id'];_0x44cf37['From'+_0x4c09d6+_0xcb0de9+'Id']=_0x3f74e4[_0x8e00('0x5c')]['id'];_0x44cf37['To'+_0x4c09d6+_0x8e00('0x62')]=_0x87f1f5['id'];return db[_0x4c09d6+_0x8e00('0x63')][_0x8e00('0x64')](_0x44cf37);})[_0x8e00('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x3acaef,'interaction':_0x3f74e4[_0x8e00('0x5e')],'message':_0x3f74e4,'account':_0x3f74e4[_0x8e00('0x5c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8e00('0x60'),'appdata':_0x87f1f5[_0x8e00('0x11')]+','+(_0x3f74e4['Account']['queueTransferTimeout']||0x12c),'interval':_0x8e00('0x65')}]},routingClient);})['then'](respondWithResult(_0x1770f0,null))[_0x8e00('0xe')](handleError(_0x1770f0,null));};};exports['agentNotify']=function(_0x43e6ea,_0x320e91){var _0xf2a891,_0x225bfb;if(_[_0x8e00('0x14')](_0x43e6ea[_0x8e00('0x2d')][_0x8e00('0x66')])){throw new Error(_0x8e00('0x67'));}var _0x1c99ed=_0x43e6ea[_0x8e00('0x2d')][_0x8e00('0x66')];var _0x5f49e1=_[_0x8e00('0x59')](_0x1c99ed);var _0xc009fd=_0x1c99ed===_0x8e00('0x5a')?_0x8e00('0x5b'):_0x8e00('0x5c');return db[_0x8e00('0x68')]['findOne']({'raw':!![],'where':{'id':_0x43e6ea[_0x8e00('0x19')]['id'],'role':_0x8e00('0x69')}})[_0x8e00('0xb')](function(_0x113664){if(_[_0x8e00('0x14')](_0x113664)){throw new Error(_0x8e00('0x6a'));}_0xf2a891=_0x113664;return db[_0x5f49e1+_0x8e00('0x6b')]['findOne']({'where':{'id':_0x43e6ea[_0x8e00('0x2d')]['messageId']},'include':[{'model':db[_0x5f49e1+'Interaction'],'as':_0x8e00('0x5e')},{'model':db[_0x5f49e1+_0xc009fd],'as':_0x8e00('0x5c')}]});})[_0x8e00('0xb')](function(_0x464d1b){if(_[_0x8e00('0x14')](_0x464d1b)){throw new Error(_0x5f49e1+_0x8e00('0x5f'));}_0x225bfb=_0x464d1b;return _0x464d1b[_0x8e00('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8e00('0xb')](function(){var _0x50836f={'uniqueid':_0x1c99ed+'.'+_0x225bfb['id']+'.'+_0x225bfb['Interaction']['id'],'FromUserId':_0x43e6ea[_0x8e00('0x2f')]['id'],'type':_0x8e00('0x60'),'ToUserId':_0xf2a891['id']};_0x50836f[_0x5f49e1+'MessageId']=_0x225bfb['id'];_0x50836f[_0x5f49e1+_0x8e00('0x61')]=_0x225bfb[_0x8e00('0x5e')]['id'];_0x50836f[_0x8e00('0x6d')+_0x5f49e1+_0xc009fd+'Id']=_0x225bfb[_0x8e00('0x5c')]['id'];return db[_0x5f49e1+'TransferReport'][_0x8e00('0x64')](_0x50836f);})[_0x8e00('0xb')](function(){return respondWithRpcPromise(_0x8e00('0x6e'),{'channel':_0x1c99ed,'interaction':_0x225bfb[_0x8e00('0x5e')],'message':_0x225bfb,'account':_0x225bfb[_0x8e00('0x5c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8e00('0x69'),'appdata':_0xf2a891['name']+','+(_0x225bfb['Account']['agentTransferTimeout']||0x12c),'interval':_0x8e00('0x65')}]},routingClient);})[_0x8e00('0xb')](respondWithResult(_0x320e91,null))[_0x8e00('0xe')](handleError(_0x320e91,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 9cf695e..244c955 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 _0x5d7f=['post','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x604470,_0x166e21){var _0x1db528=function(_0x442fd6){while(--_0x442fd6){_0x604470['push'](_0x604470['shift']());}};_0x1db528(++_0x166e21);}(_0x5d7f,0x135));var _0xf5d7=function(_0x5ca267,_0xe0e954){_0x5ca267=_0x5ca267-0x0;var _0x796d84=_0x5d7f[_0x5ca267];return _0x796d84;};'use strict';var multer=require(_0xf5d7('0x0'));var util=require(_0xf5d7('0x1'));var path=require(_0xf5d7('0x2'));var timeout=require(_0xf5d7('0x3'));var express=require(_0xf5d7('0x4'));var router=express[_0xf5d7('0x5')]();var auth=require(_0xf5d7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf5d7('0x7'));var controller=require('./schedule.controller');router[_0xf5d7('0x8')]('/',auth[_0xf5d7('0x9')](),controller[_0xf5d7('0xa')]);router[_0xf5d7('0x8')]('/:id',auth[_0xf5d7('0x9')](),controller['show']);router[_0xf5d7('0x8')]('/:id/run',auth[_0xf5d7('0x9')](),controller['run']);router[_0xf5d7('0xb')]('/',auth[_0xf5d7('0x9')](),controller['create']);router[_0xf5d7('0xc')](_0xf5d7('0xd'),auth['isAuthenticated'](),controller[_0xf5d7('0xe')]);router['delete'](_0xf5d7('0xd'),auth['isAuthenticated'](),controller[_0xf5d7('0xf')]);module['exports']=router; \ No newline at end of file +var _0x059b=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','run','create','put'];(function(_0x2f7a44,_0x2d4dd8){var _0x21b370=function(_0x3842ae){while(--_0x3842ae){_0x2f7a44['push'](_0x2f7a44['shift']());}};_0x21b370(++_0x2d4dd8);}(_0x059b,0x193));var _0xb059=function(_0x4be958,_0x12055c){_0x4be958=_0x4be958-0x0;var _0x50834b=_0x059b[_0x4be958];return _0x50834b;};'use strict';var multer=require(_0xb059('0x0'));var util=require('util');var path=require(_0xb059('0x1'));var timeout=require(_0xb059('0x2'));var express=require(_0xb059('0x3'));var router=express[_0xb059('0x4')]();var auth=require(_0xb059('0x5'));var interaction=require(_0xb059('0x6'));var config=require(_0xb059('0x7'));var controller=require(_0xb059('0x8'));router[_0xb059('0x9')]('/',auth[_0xb059('0xa')](),controller[_0xb059('0xb')]);router[_0xb059('0x9')](_0xb059('0xc'),auth[_0xb059('0xa')](),controller[_0xb059('0xd')]);router[_0xb059('0x9')]('/:id/run',auth[_0xb059('0xa')](),controller[_0xb059('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb059('0xf')]);router[_0xb059('0x10')](_0xb059('0xc'),auth['isAuthenticated'](),controller[_0xb059('0x11')]);router[_0xb059('0x12')](_0xb059('0xc'),auth[_0xb059('0xa')](),controller['destroy']);module[_0xb059('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 77a3825..b5f2e8e 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 _0xeb30=['ENUM','csv','pdf','xlsx','custom','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','hours','minutes','days'];(function(_0x4717ba,_0x55a227){var _0x4503c3=function(_0x1b0830){while(--_0x1b0830){_0x4717ba['push'](_0x4717ba['shift']());}};_0x4503c3(++_0x55a227);}(_0xeb30,0xe4));var _0x0eb3=function(_0x50aabf,_0x3909ea){_0x50aabf=_0x50aabf-0x0;var _0x1d959e=_0xeb30[_0x50aabf];return _0x1d959e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0eb3('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x0eb3('0x0')]},'active':{'type':Sequelize[_0x0eb3('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0eb3('0x0')],'allowNull':![],'defaultValue':_0x0eb3('0x2')},'startAt':{'type':Sequelize[_0x0eb3('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x0eb3('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0eb3('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x0eb3('0x5'),_0x0eb3('0x6'),'months','weeks','days',_0x0eb3('0x7'),_0x0eb3('0x8')),'allowNull':![],'defaultValue':_0x0eb3('0x9')},'output':{'type':Sequelize[_0x0eb3('0xa')](_0x0eb3('0xb'),_0x0eb3('0xc'),_0x0eb3('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x0eb3('0xe'),_0x0eb3('0xf')),'allowNull':![],'defaultValue':_0x0eb3('0xe')},'sendMail':{'type':Sequelize[_0x0eb3('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x0eb3('0x0')]},'cc':{'type':Sequelize[_0x0eb3('0x10')]},'bcc':{'type':Sequelize[_0x0eb3('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x0eb3('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xff15=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','hours','days','csv','pdf','xlsx','custom','default','sequelize','exports','STRING','BOOLEAN'];(function(_0x4539b6,_0x1643c9){var _0x5bb0c4=function(_0x1cc83d){while(--_0x1cc83d){_0x4539b6['push'](_0x4539b6['shift']());}};_0x5bb0c4(++_0x1643c9);}(_0xff15,0x8c));var _0x5ff1=function(_0x6c0123,_0x4c8d3b){_0x6c0123=_0x6c0123-0x0;var _0x5a87d2=_0xff15[_0x6c0123];return _0x5a87d2;};'use strict';var Sequelize=require(_0x5ff1('0x0'));module[_0x5ff1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5ff1('0x2')]},'active':{'type':Sequelize[_0x5ff1('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5ff1('0x4')},'startAt':{'type':Sequelize[_0x5ff1('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5ff1('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5ff1('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5ff1('0x7')](_0x5ff1('0x8'),_0x5ff1('0x9'),_0x5ff1('0xa'),'weeks','days',_0x5ff1('0xb'),'minutes'),'allowNull':![],'defaultValue':_0x5ff1('0xc')},'output':{'type':Sequelize['ENUM'](_0x5ff1('0xd'),_0x5ff1('0xe'),_0x5ff1('0xf')),'allowNull':![],'defaultValue':_0x5ff1('0xd')},'type':{'type':Sequelize[_0x5ff1('0x7')](_0x5ff1('0x10'),_0x5ff1('0x11')),'allowNull':![],'defaultValue':_0x5ff1('0x10')},'sendMail':{'type':Sequelize[_0x5ff1('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5ff1('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x5ff1('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 4cee3bf..4e1542d 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 _0x60b7=['destroy','get','Scheduler','UserProfileResource','error','name','index','rawAttributes','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','map','key','VIRTUAL','field','options','Schedule','findAll','rows','catch','show','params','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then'];(function(_0x4f9f75,_0x7e913a){var _0x2b7b95=function(_0x5d865a){while(--_0x5d865a){_0x4f9f75['push'](_0x4f9f75['shift']());}};_0x2b7b95(++_0x7e913a);}(_0x60b7,0xd3));var _0x760b=function(_0x1e8c4e,_0x4b6ba5){_0x1e8c4e=_0x1e8c4e-0x0;var _0x19088a=_0x60b7[_0x1e8c4e];return _0x19088a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x760b('0x0'));var rimraf=require(_0x760b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x760b('0x2'));var rp=require(_0x760b('0x3'));var moment=require(_0x760b('0x4'));var BPromise=require(_0x760b('0x5'));var Mustache=require(_0x760b('0x6'));var util=require(_0x760b('0x7'));var path=require(_0x760b('0x8'));var sox=require(_0x760b('0x9'));var csv=require(_0x760b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x760b('0xb'));var crypto=require(_0x760b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x760b('0xd'));var toCsv=require(_0x760b('0xa'));var querystring=require(_0x760b('0xe'));var Papa=require(_0x760b('0xf'));var authService=require(_0x760b('0x10'));var hardwareService=require(_0x760b('0x11'));var Redis=require(_0x760b('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x760b('0x13'))(_0x760b('0x14'));var utils=require('../../config/utils');var config=require(_0x760b('0x15'));var db=require(_0x760b('0x16'))['db'];function respondWithStatusCode(_0x16f780,_0x2de314){_0x2de314=_0x2de314||0xcc;return function(_0x278a01){if(_0x278a01){return _0x16f780[_0x760b('0x17')](_0x2de314);}return _0x16f780['status'](_0x2de314)['end']();};}function respondWithResult(_0xf97926,_0x542536){_0x542536=_0x542536||0xc8;return function(_0x156e74){if(_0x156e74){return _0xf97926[_0x760b('0x18')](_0x542536)['json'](_0x156e74);}};}function respondWithFilteredResult(_0x20fece,_0x3d7e1f){return function(_0x4ecc98){if(_0x4ecc98){var _0xb5eca7=_0x4ecc98[_0x760b('0x19')],_0x2165d2=_0x3d7e1f[_0x760b('0x1a')],_0x20fa2f=_0x3d7e1f[_0x760b('0x1a')]+_0x3d7e1f[_0x760b('0x1b')],_0x2581d4;if(_0x20fa2f>=_0xb5eca7){_0x20fa2f=_0xb5eca7;_0x2581d4=0xc8;}else{_0x2581d4=0xce;}_0x20fece[_0x760b('0x18')](_0x2581d4);return _0x20fece['set'](_0x760b('0x1c'),_0x2165d2+'-'+_0x20fa2f+'/'+_0xb5eca7)[_0x760b('0x1d')](_0x4ecc98);}return null;};}function patchUpdates(_0xbfb0ec){return function(_0x374b38){try{jsonpatch[_0x760b('0x1e')](_0x374b38,_0xbfb0ec,!![]);}catch(_0x1b1f08){return BPromise[_0x760b('0x1f')](_0x1b1f08);}return _0x374b38[_0x760b('0x20')]();};}function saveUpdates(_0x2d6a7e,_0x22ef99){return function(_0x3e6a86){if(_0x3e6a86){return _0x3e6a86[_0x760b('0x21')](_0x2d6a7e)[_0x760b('0x22')](function(_0x5ea034){return _0x5ea034;});}return null;};}function removeEntity(_0x44d868,_0x2a3008){return function(_0xe191b0){if(_0xe191b0){return _0xe191b0[_0x760b('0x23')]()[_0x760b('0x22')](function(){var _0x3a74eb=_0xe191b0[_0x760b('0x24')]({'plain':!![]});var _0x51def9=_0x760b('0x25');return db[_0x760b('0x26')][_0x760b('0x23')]({'where':{'type':_0x51def9,'resourceId':_0x3a74eb['id']}})['then'](function(){return _0xe191b0;});})[_0x760b('0x22')](function(){_0x44d868[_0x760b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cc59c,_0x5f0cbf){return function(_0x582847){if(!_0x582847){_0x3cc59c[_0x760b('0x17')](0x194);}return _0x582847;};}function handleError(_0x113c81,_0x14d08e){_0x14d08e=_0x14d08e||0x1f4;return function(_0x5395e6){logger[_0x760b('0x27')](_0x5395e6['stack']);if(_0x5395e6['name']){delete _0x5395e6[_0x760b('0x28')];}_0x113c81[_0x760b('0x18')](_0x14d08e)['send'](_0x5395e6);};}exports[_0x760b('0x29')]=function(_0x453f10,_0x6fc613){var _0x5661db={},_0x58a7a0={},_0x16e22a={'count':0x0,'rows':[]};var _0x26a616=db['Schedule'][_0x760b('0x2a')];_0x58a7a0[_0x760b('0x2b')]=_['keys'](_0x26a616);_0x58a7a0[_0x760b('0x2c')]=_[_0x760b('0x2d')](_0x453f10['query']);_0x58a7a0['filters']=_['intersection'](_0x58a7a0['model'],_0x58a7a0[_0x760b('0x2c')]);_0x5661db['attributes']=_[_0x760b('0x2e')](_0x58a7a0[_0x760b('0x2b')],qs[_0x760b('0x2f')](_0x453f10[_0x760b('0x2c')][_0x760b('0x2f')]));_0x5661db[_0x760b('0x30')]=_0x5661db[_0x760b('0x30')][_0x760b('0x31')]?_0x5661db[_0x760b('0x30')]:_0x58a7a0[_0x760b('0x2b')];if(!_0x453f10[_0x760b('0x2c')][_0x760b('0x32')](_0x760b('0x33'))){_0x5661db[_0x760b('0x1b')]=qs[_0x760b('0x1b')](_0x453f10[_0x760b('0x2c')][_0x760b('0x1b')]);_0x5661db[_0x760b('0x1a')]=qs[_0x760b('0x1a')](_0x453f10[_0x760b('0x2c')]['offset']);}_0x5661db[_0x760b('0x34')]=qs['sort'](_0x453f10['query'][_0x760b('0x35')]);_0x5661db['where']=qs['filters'](_[_0x760b('0x36')](_0x453f10[_0x760b('0x2c')],_0x58a7a0[_0x760b('0x37')]));if(_0x453f10[_0x760b('0x2c')][_0x760b('0x38')]){_0x5661db[_0x760b('0x39')]=_[_0x760b('0x3a')](_0x5661db[_0x760b('0x39')],{'$or':_[_0x760b('0x3b')](_0x26a616,function(_0x59ff9c){if(_0x59ff9c['type'][_0x760b('0x3c')]!==_0x760b('0x3d')){var _0x33fad9={};_0x33fad9[_0x59ff9c[_0x760b('0x3e')]]={'$like':'%'+_0x453f10[_0x760b('0x2c')][_0x760b('0x38')]+'%'};return _0x33fad9;}})});}_0x5661db=_['merge']({},_0x5661db,_0x453f10[_0x760b('0x3f')]);var _0x5df9ef={'where':_0x5661db[_0x760b('0x39')]};return db[_0x760b('0x40')][_0x760b('0x19')](_0x5df9ef)[_0x760b('0x22')](function(_0x1e72cf){_0x16e22a['count']=_0x1e72cf;if(_0x453f10['query']['includeAll']){_0x5661db['include']=[{'all':!![]}];}return db['Schedule'][_0x760b('0x41')](_0x5661db);})['then'](function(_0x450bff){_0x16e22a[_0x760b('0x42')]=_0x450bff;return _0x16e22a;})[_0x760b('0x22')](respondWithFilteredResult(_0x6fc613,_0x5661db))[_0x760b('0x43')](handleError(_0x6fc613,null));};exports[_0x760b('0x44')]=function(_0x5cd5fe,_0x28f5a8){var _0x501a91={'raw':![],'where':{'id':_0x5cd5fe[_0x760b('0x45')]['id']}},_0x4869e4={};_0x4869e4[_0x760b('0x2b')]=_[_0x760b('0x2d')](db[_0x760b('0x40')][_0x760b('0x2a')]);_0x4869e4['query']=_[_0x760b('0x2d')](_0x5cd5fe['query']);_0x4869e4[_0x760b('0x37')]=_[_0x760b('0x2e')](_0x4869e4['model'],_0x4869e4[_0x760b('0x2c')]);_0x501a91[_0x760b('0x30')]=_[_0x760b('0x2e')](_0x4869e4[_0x760b('0x2b')],qs[_0x760b('0x2f')](_0x5cd5fe[_0x760b('0x2c')][_0x760b('0x2f')]));_0x501a91[_0x760b('0x30')]=_0x501a91[_0x760b('0x30')]['length']?_0x501a91[_0x760b('0x30')]:_0x4869e4[_0x760b('0x2b')];if(_0x5cd5fe[_0x760b('0x2c')][_0x760b('0x46')]){_0x501a91[_0x760b('0x47')]=[{'all':!![]}];}_0x501a91=_[_0x760b('0x3a')]({},_0x501a91,_0x5cd5fe['options']);return db[_0x760b('0x40')]['find'](_0x501a91)[_0x760b('0x22')](handleEntityNotFound(_0x28f5a8,null))['then'](respondWithResult(_0x28f5a8,null))[_0x760b('0x43')](handleError(_0x28f5a8,null));};exports[_0x760b('0x48')]=function(_0x2f5987,_0x4155af){return db[_0x760b('0x40')][_0x760b('0x48')](_0x2f5987['body'],{})[_0x760b('0x22')](function(_0x31fa8a){var _0x1add8c=_0x2f5987[_0x760b('0x49')][_0x760b('0x24')]({'plain':!![]});if(!_0x1add8c)throw new Error(_0x760b('0x4a'));if(_0x1add8c[_0x760b('0x4b')]===_0x760b('0x49')){var _0x469746=_0x31fa8a[_0x760b('0x24')]({'plain':!![]});var _0x4659b7=_0x760b('0x25');return db[_0x760b('0x4c')][_0x760b('0x4d')]({'where':{'name':_0x4659b7,'userProfileId':_0x1add8c['userProfileId']},'raw':!![]})['then'](function(_0x1cdfe6){if(_0x1cdfe6&&_0x1cdfe6[_0x760b('0x4e')]===0x0){return db[_0x760b('0x26')]['create']({'name':_0x469746[_0x760b('0x28')],'resourceId':_0x469746['id'],'type':_0x1cdfe6[_0x760b('0x28')],'sectionId':_0x1cdfe6['id']},{})['then'](function(){return _0x31fa8a;});}else{return _0x31fa8a;}})[_0x760b('0x43')](function(_0x5a7077){logger[_0x760b('0x27')](_0x760b('0x4f'),_0x5a7077);throw _0x5a7077;});}return _0x31fa8a;})[_0x760b('0x22')](respondWithResult(_0x4155af,0xc9))[_0x760b('0x43')](handleError(_0x4155af,null));};exports['update']=function(_0xdf1e9c,_0x52d15d){if(_0xdf1e9c[_0x760b('0x50')]['id']){delete _0xdf1e9c['body']['id'];}return db[_0x760b('0x40')]['find']({'where':{'id':_0xdf1e9c[_0x760b('0x45')]['id']}})[_0x760b('0x22')](handleEntityNotFound(_0x52d15d,null))['then'](saveUpdates(_0xdf1e9c['body'],null))[_0x760b('0x22')](respondWithResult(_0x52d15d,null))[_0x760b('0x43')](handleError(_0x52d15d,null));};exports[_0x760b('0x23')]=function(_0x23f9d7,_0x50ee53){return db[_0x760b('0x40')][_0x760b('0x4d')]({'where':{'id':_0x23f9d7['params']['id']}})[_0x760b('0x22')](handleEntityNotFound(_0x50ee53,null))[_0x760b('0x22')](removeEntity(_0x50ee53,null))['catch'](handleError(_0x50ee53,null));};exports[_0x760b('0x51')]=function(_0x341bec,_0x266a84,_0x5eb045){var _0x2190a2=require('../../config/schedule');return db[_0x760b('0x40')]['find']({'where':{'id':_0x341bec[_0x760b('0x45')]['id']},'raw':!![]})[_0x760b('0x22')](handleEntityNotFound(_0x266a84,null))[_0x760b('0x22')](function(){_0x2190a2['run'](_0x341bec[_0x760b('0x45')]['id']);})['then'](respondWithStatusCode(_0x266a84,null))[_0x760b('0x43')](handleError(_0x266a84,null));}; \ No newline at end of file +var _0x0452=['path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','Schedule','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','map','type','key','VIRTUAL','field','filter','count','includeAll','findAll','rows','catch','show','params','include','merge','options','find','create','role','user','get','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','run','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util'];(function(_0x188352,_0x53c522){var _0x4e0825=function(_0x5ecf96){while(--_0x5ecf96){_0x188352['push'](_0x188352['shift']());}};_0x4e0825(++_0x53c522);}(_0x0452,0xf2));var _0x2045=function(_0x32fe52,_0x321580){_0x32fe52=_0x32fe52-0x0;var _0x5103d0=_0x0452[_0x32fe52];return _0x5103d0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2045('0x0'));var rimraf=require(_0x2045('0x1'));var zipdir=require(_0x2045('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2045('0x3'));var BPromise=require(_0x2045('0x4'));var Mustache=require(_0x2045('0x5'));var util=require(_0x2045('0x6'));var path=require(_0x2045('0x7'));var sox=require(_0x2045('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2045('0x9'));var crypto=require(_0x2045('0xa'));var jsforce=require(_0x2045('0xb'));var deskjs=require(_0x2045('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2045('0xd'));var Papa=require(_0x2045('0xe'));var authService=require(_0x2045('0xf'));var hardwareService=require(_0x2045('0x10'));var Redis=require('ioredis');var qs=require(_0x2045('0x11'));var logger=require(_0x2045('0x12'))(_0x2045('0x13'));var utils=require(_0x2045('0x14'));var config=require(_0x2045('0x15'));var db=require(_0x2045('0x16'))['db'];function respondWithStatusCode(_0x76f317,_0x86a88c){_0x86a88c=_0x86a88c||0xcc;return function(_0x32c2b8){if(_0x32c2b8){return _0x76f317['sendStatus'](_0x86a88c);}return _0x76f317[_0x2045('0x17')](_0x86a88c)[_0x2045('0x18')]();};}function respondWithResult(_0x5bc9bc,_0x435f29){_0x435f29=_0x435f29||0xc8;return function(_0x341798){if(_0x341798){return _0x5bc9bc[_0x2045('0x17')](_0x435f29)[_0x2045('0x19')](_0x341798);}};}function respondWithFilteredResult(_0x13b72e,_0xa4350e){return function(_0x3da81c){if(_0x3da81c){var _0x3a286f=_0x3da81c['count'],_0x3be5d3=_0xa4350e['offset'],_0x21fbab=_0xa4350e[_0x2045('0x1a')]+_0xa4350e[_0x2045('0x1b')],_0x1d0c1d;if(_0x21fbab>=_0x3a286f){_0x21fbab=_0x3a286f;_0x1d0c1d=0xc8;}else{_0x1d0c1d=0xce;}_0x13b72e[_0x2045('0x17')](_0x1d0c1d);return _0x13b72e[_0x2045('0x1c')]('Content-Range',_0x3be5d3+'-'+_0x21fbab+'/'+_0x3a286f)['json'](_0x3da81c);}return null;};}function patchUpdates(_0x38c978){return function(_0x455814){try{jsonpatch[_0x2045('0x1d')](_0x455814,_0x38c978,!![]);}catch(_0x55debe){return BPromise[_0x2045('0x1e')](_0x55debe);}return _0x455814[_0x2045('0x1f')]();};}function saveUpdates(_0x4775ff,_0x23a384){return function(_0xb5f15c){if(_0xb5f15c){return _0xb5f15c[_0x2045('0x20')](_0x4775ff)[_0x2045('0x21')](function(_0x133328){return _0x133328;});}return null;};}function removeEntity(_0x4ffe0e,_0x320320){return function(_0x43ff90){if(_0x43ff90){return _0x43ff90[_0x2045('0x22')]()[_0x2045('0x21')](function(){var _0x20bc0f=_0x43ff90['get']({'plain':!![]});var _0x2d1b21='Scheduler';return db['UserProfileResource'][_0x2045('0x22')]({'where':{'type':_0x2d1b21,'resourceId':_0x20bc0f['id']}})['then'](function(){return _0x43ff90;});})[_0x2045('0x21')](function(){_0x4ffe0e[_0x2045('0x17')](0xcc)[_0x2045('0x18')]();});}};}function handleEntityNotFound(_0x11bcb1,_0x36ff3d){return function(_0x56a640){if(!_0x56a640){_0x11bcb1[_0x2045('0x23')](0x194);}return _0x56a640;};}function handleError(_0x42b6f6,_0x49d26a){_0x49d26a=_0x49d26a||0x1f4;return function(_0x1211f8){logger[_0x2045('0x24')](_0x1211f8['stack']);if(_0x1211f8[_0x2045('0x25')]){delete _0x1211f8['name'];}_0x42b6f6[_0x2045('0x17')](_0x49d26a)[_0x2045('0x26')](_0x1211f8);};}exports[_0x2045('0x27')]=function(_0x5ef5e6,_0x5ea9f3){var _0x2c921f={},_0x120720={},_0x16ecf4={'count':0x0,'rows':[]};var _0x26e65e=db[_0x2045('0x28')]['rawAttributes'];_0x120720['model']=_[_0x2045('0x29')](_0x26e65e);_0x120720[_0x2045('0x2a')]=_['keys'](_0x5ef5e6['query']);_0x120720[_0x2045('0x2b')]=_[_0x2045('0x2c')](_0x120720[_0x2045('0x2d')],_0x120720['query']);_0x2c921f[_0x2045('0x2e')]=_[_0x2045('0x2c')](_0x120720[_0x2045('0x2d')],qs[_0x2045('0x2f')](_0x5ef5e6[_0x2045('0x2a')][_0x2045('0x2f')]));_0x2c921f[_0x2045('0x2e')]=_0x2c921f[_0x2045('0x2e')][_0x2045('0x30')]?_0x2c921f[_0x2045('0x2e')]:_0x120720[_0x2045('0x2d')];if(!_0x5ef5e6['query']['hasOwnProperty'](_0x2045('0x31'))){_0x2c921f[_0x2045('0x1b')]=qs['limit'](_0x5ef5e6[_0x2045('0x2a')]['limit']);_0x2c921f['offset']=qs[_0x2045('0x1a')](_0x5ef5e6[_0x2045('0x2a')][_0x2045('0x1a')]);}_0x2c921f[_0x2045('0x32')]=qs[_0x2045('0x33')](_0x5ef5e6['query'][_0x2045('0x33')]);_0x2c921f[_0x2045('0x34')]=qs[_0x2045('0x2b')](_[_0x2045('0x35')](_0x5ef5e6[_0x2045('0x2a')],_0x120720[_0x2045('0x2b')]));if(_0x5ef5e6[_0x2045('0x2a')]['filter']){_0x2c921f[_0x2045('0x34')]=_['merge'](_0x2c921f[_0x2045('0x34')],{'$or':_[_0x2045('0x36')](_0x26e65e,function(_0x4f7257){if(_0x4f7257[_0x2045('0x37')][_0x2045('0x38')]!==_0x2045('0x39')){var _0x3723ee={};_0x3723ee[_0x4f7257[_0x2045('0x3a')]]={'$like':'%'+_0x5ef5e6[_0x2045('0x2a')][_0x2045('0x3b')]+'%'};return _0x3723ee;}})});}_0x2c921f=_['merge']({},_0x2c921f,_0x5ef5e6['options']);var _0x2bb2c3={'where':_0x2c921f['where']};return db[_0x2045('0x28')][_0x2045('0x3c')](_0x2bb2c3)['then'](function(_0x4e1d91){_0x16ecf4[_0x2045('0x3c')]=_0x4e1d91;if(_0x5ef5e6[_0x2045('0x2a')][_0x2045('0x3d')]){_0x2c921f['include']=[{'all':!![]}];}return db['Schedule'][_0x2045('0x3e')](_0x2c921f);})['then'](function(_0x42b12b){_0x16ecf4[_0x2045('0x3f')]=_0x42b12b;return _0x16ecf4;})[_0x2045('0x21')](respondWithFilteredResult(_0x5ea9f3,_0x2c921f))[_0x2045('0x40')](handleError(_0x5ea9f3,null));};exports[_0x2045('0x41')]=function(_0x34903a,_0x3da219){var _0x1a69b6={'raw':![],'where':{'id':_0x34903a[_0x2045('0x42')]['id']}},_0xa4015f={};_0xa4015f[_0x2045('0x2d')]=_[_0x2045('0x29')](db[_0x2045('0x28')]['rawAttributes']);_0xa4015f[_0x2045('0x2a')]=_[_0x2045('0x29')](_0x34903a['query']);_0xa4015f['filters']=_[_0x2045('0x2c')](_0xa4015f[_0x2045('0x2d')],_0xa4015f[_0x2045('0x2a')]);_0x1a69b6[_0x2045('0x2e')]=_[_0x2045('0x2c')](_0xa4015f[_0x2045('0x2d')],qs[_0x2045('0x2f')](_0x34903a[_0x2045('0x2a')][_0x2045('0x2f')]));_0x1a69b6['attributes']=_0x1a69b6[_0x2045('0x2e')][_0x2045('0x30')]?_0x1a69b6[_0x2045('0x2e')]:_0xa4015f[_0x2045('0x2d')];if(_0x34903a[_0x2045('0x2a')][_0x2045('0x3d')]){_0x1a69b6[_0x2045('0x43')]=[{'all':!![]}];}_0x1a69b6=_[_0x2045('0x44')]({},_0x1a69b6,_0x34903a[_0x2045('0x45')]);return db[_0x2045('0x28')][_0x2045('0x46')](_0x1a69b6)[_0x2045('0x21')](handleEntityNotFound(_0x3da219,null))['then'](respondWithResult(_0x3da219,null))['catch'](handleError(_0x3da219,null));};exports[_0x2045('0x47')]=function(_0x49fc3a,_0x5aaf6e){return db[_0x2045('0x28')][_0x2045('0x47')](_0x49fc3a['body'],{})[_0x2045('0x21')](function(_0x47034f){var _0x3a696e=_0x49fc3a['user']['get']({'plain':!![]});if(!_0x3a696e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a696e[_0x2045('0x48')]===_0x2045('0x49')){var _0x5a79aa=_0x47034f[_0x2045('0x4a')]({'plain':!![]});var _0x429b46=_0x2045('0x4b');return db[_0x2045('0x4c')][_0x2045('0x46')]({'where':{'name':_0x429b46,'userProfileId':_0x3a696e[_0x2045('0x4d')]},'raw':!![]})[_0x2045('0x21')](function(_0x200145){if(_0x200145&&_0x200145[_0x2045('0x4e')]===0x0){return db['UserProfileResource'][_0x2045('0x47')]({'name':_0x5a79aa[_0x2045('0x25')],'resourceId':_0x5a79aa['id'],'type':_0x200145['name'],'sectionId':_0x200145['id']},{})[_0x2045('0x21')](function(){return _0x47034f;});}else{return _0x47034f;}})[_0x2045('0x40')](function(_0x2fafa8){logger[_0x2045('0x24')](_0x2045('0x4f'),_0x2fafa8);throw _0x2fafa8;});}return _0x47034f;})['then'](respondWithResult(_0x5aaf6e,0xc9))['catch'](handleError(_0x5aaf6e,null));};exports[_0x2045('0x20')]=function(_0x48099e,_0x18d126){if(_0x48099e[_0x2045('0x50')]['id']){delete _0x48099e[_0x2045('0x50')]['id'];}return db['Schedule'][_0x2045('0x46')]({'where':{'id':_0x48099e[_0x2045('0x42')]['id']}})[_0x2045('0x21')](handleEntityNotFound(_0x18d126,null))['then'](saveUpdates(_0x48099e[_0x2045('0x50')],null))[_0x2045('0x21')](respondWithResult(_0x18d126,null))[_0x2045('0x40')](handleError(_0x18d126,null));};exports[_0x2045('0x22')]=function(_0x31f193,_0x4cad29){return db['Schedule']['find']({'where':{'id':_0x31f193[_0x2045('0x42')]['id']}})['then'](handleEntityNotFound(_0x4cad29,null))[_0x2045('0x21')](removeEntity(_0x4cad29,null))[_0x2045('0x40')](handleError(_0x4cad29,null));};exports['run']=function(_0x2aa48b,_0x430121,_0x1cd598){var _0x57fa81=require(_0x2045('0x51'));return db['Schedule'][_0x2045('0x46')]({'where':{'id':_0x2aa48b[_0x2045('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x430121,null))['then'](function(){_0x57fa81[_0x2045('0x52')](_0x2aa48b[_0x2045('0x42')]['id']);})[_0x2045('0x21')](respondWithStatusCode(_0x430121,null))['catch'](handleError(_0x430121,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 65d0d8e..138013c 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 _0xb97a=['request-promise','./schedule.attributes','exports','Schedule','tools_schedules','util','api','moment'];(function(_0x29db66,_0x1ac56a){var _0x5651a2=function(_0x2a66c1){while(--_0x2a66c1){_0x29db66['push'](_0x29db66['shift']());}};_0x5651a2(++_0x1ac56a);}(_0xb97a,0x85));var _0xab97=function(_0x59612b,_0xa47e78){_0x59612b=_0x59612b-0x0;var _0x4ed15e=_0xb97a[_0x59612b];return _0x4ed15e;};'use strict';var _=require('lodash');var util=require(_0xab97('0x0'));var logger=require('../../config/logger')(_0xab97('0x1'));var moment=require(_0xab97('0x2'));var BPromise=require('bluebird');var rp=require(_0xab97('0x3'));var attributes=require(_0xab97('0x4'));module[_0xab97('0x5')]=function(_0x5348c7,_0x4be7b3){return _0x5348c7['define'](_0xab97('0x6'),attributes,{'tableName':_0xab97('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcc8=['./schedule.attributes','define','tools_schedules','util','api','moment','bluebird','request-promise'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xbcc8,0x9b));var _0x8bcc=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xbcc8[_0x599f41];return _0x2e4d58;};'use strict';var _=require('lodash');var util=require(_0x8bcc('0x0'));var logger=require('../../config/logger')(_0x8bcc('0x1'));var moment=require(_0x8bcc('0x2'));var BPromise=require(_0x8bcc('0x3'));var rp=require(_0x8bcc('0x4'));var attributes=require(_0x8bcc('0x5'));module['exports']=function(_0x4a0f57,_0x3bab70){return _0x4a0f57[_0x8bcc('0x6')]('Schedule',attributes,{'tableName':_0x8bcc('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index ff19bf4..a6e4f85 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 _0x777e=['debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x11f274,_0x5ce1ce){var _0x4ab6d0=function(_0x14a30f){while(--_0x14a30f){_0x11f274['push'](_0x11f274['shift']());}};_0x4ab6d0(++_0x5ce1ce);}(_0x777e,0xf8));var _0xe777=function(_0x365056,_0x5afa4f){_0x365056=_0x365056-0x0;var _0x412743=_0x777e[_0x365056];return _0x412743;};'use strict';var _=require(_0xe777('0x0'));var util=require('util');var moment=require(_0xe777('0x1'));var BPromise=require(_0xe777('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe777('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe777('0x4'))(_0xe777('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe777('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24708e,_0x37b0f8,_0x5c1900){return new BPromise(function(_0x599f9f,_0x4ff3e8){return client[_0xe777('0x7')](_0x24708e,_0x5c1900)[_0xe777('0x8')](function(_0x582461){logger[_0xe777('0x9')](_0xe777('0xa'),_0x37b0f8,_0xe777('0xb'));logger[_0xe777('0xc')](_0xe777('0xd'),_0x37b0f8,_0xe777('0xb'),JSON[_0xe777('0xe')](_0x582461));if(_0x582461[_0xe777('0xf')]){if(_0x582461[_0xe777('0xf')][_0xe777('0x10')]===0x1f4){logger[_0xe777('0xf')](_0xe777('0xa'),_0x37b0f8,_0x582461[_0xe777('0xf')]['message']);return _0x4ff3e8(_0x582461[_0xe777('0xf')][_0xe777('0x11')]);}logger[_0xe777('0xf')](_0xe777('0xa'),_0x37b0f8,_0x582461['error'][_0xe777('0x11')]);return _0x599f9f(_0x582461[_0xe777('0xf')][_0xe777('0x11')]);}else{logger[_0xe777('0x9')](_0xe777('0xa'),_0x37b0f8,_0xe777('0xb'));_0x599f9f(_0x582461[_0xe777('0x12')][_0xe777('0x11')]);}})[_0xe777('0x13')](function(_0x438037){logger['error'](_0xe777('0xa'),_0x37b0f8,_0x438037);_0x4ff3e8(_0x438037);});});} \ No newline at end of file +var _0x9af6=['message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3b8a26,_0x168cc4){var _0x31bafd=function(_0x3e8667){while(--_0x3e8667){_0x3b8a26['push'](_0x3b8a26['shift']());}};_0x31bafd(++_0x168cc4);}(_0x9af6,0x132));var _0x69af=function(_0xfaeb48,_0x35e639){_0xfaeb48=_0xfaeb48-0x0;var _0x2a6290=_0x9af6[_0xfaeb48];return _0x2a6290;};'use strict';var _=require(_0x69af('0x0'));var util=require('util');var moment=require(_0x69af('0x1'));var BPromise=require('bluebird');var rs=require(_0x69af('0x2'));var fs=require('fs');var Redis=require(_0x69af('0x3'));var db=require(_0x69af('0x4'))['db'];var utils=require(_0x69af('0x5'));var logger=require(_0x69af('0x6'))(_0x69af('0x7'));var config=require(_0x69af('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16c9f7,_0x3818e3,_0x3d0b8b){return new BPromise(function(_0x13e92c,_0x308f96){return client[_0x69af('0x9')](_0x16c9f7,_0x3d0b8b)['then'](function(_0x15794e){logger[_0x69af('0xa')](_0x69af('0xb'),_0x3818e3,'request\x20sent');logger['debug'](_0x69af('0xc'),_0x3818e3,_0x69af('0xd'),JSON[_0x69af('0xe')](_0x15794e));if(_0x15794e[_0x69af('0xf')]){if(_0x15794e[_0x69af('0xf')][_0x69af('0x10')]===0x1f4){logger[_0x69af('0xf')](_0x69af('0xb'),_0x3818e3,_0x15794e[_0x69af('0xf')][_0x69af('0x11')]);return _0x308f96(_0x15794e[_0x69af('0xf')][_0x69af('0x11')]);}logger['error'](_0x69af('0xb'),_0x3818e3,_0x15794e[_0x69af('0xf')][_0x69af('0x11')]);return _0x13e92c(_0x15794e[_0x69af('0xf')][_0x69af('0x11')]);}else{logger[_0x69af('0xa')](_0x69af('0xb'),_0x3818e3,_0x69af('0xd'));_0x13e92c(_0x15794e[_0x69af('0x12')]['message']);}})['catch'](function(_0x2930f8){logger[_0x69af('0xf')]('Schedule,\x20%s,\x20%s',_0x3818e3,_0x2930f8);_0x308f96(_0x2930f8);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 384b975..bdd7553 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 _0xd6ec=['logologin','originalname','file','addLogoLogin','preferred','extname','addPreferred','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','post','single','addLogo'];(function(_0x1c5835,_0x20431a){var _0x558ebf=function(_0x2bc9da){while(--_0x2bc9da){_0x1c5835['push'](_0x1c5835['shift']());}};_0x558ebf(++_0x20431a);}(_0xd6ec,0x11a));var _0xcd6e=function(_0x419dda,_0x1cd45b){_0x419dda=_0x419dda-0x0;var _0x134145=_0xd6ec[_0x419dda];return _0x134145;};'use strict';var multer=require(_0xcd6e('0x0'));var util=require(_0xcd6e('0x1'));var path=require(_0xcd6e('0x2'));var timeout=require(_0xcd6e('0x3'));var express=require(_0xcd6e('0x4'));var router=express[_0xcd6e('0x5')]();var auth=require(_0xcd6e('0x6'));var interaction=require(_0xcd6e('0x7'));var config=require('../../config/environment');var controller=require(_0xcd6e('0x8'));router[_0xcd6e('0x9')]('/',auth[_0xcd6e('0xa')](),controller['index']);router[_0xcd6e('0x9')](_0xcd6e('0xb'),controller[_0xcd6e('0xc')]);router[_0xcd6e('0x9')]('/:id/logo',controller[_0xcd6e('0xd')]);router['get'](_0xcd6e('0xe'),controller[_0xcd6e('0xf')]);router[_0xcd6e('0x9')](_0xcd6e('0x10'),controller[_0xcd6e('0x11')]);router[_0xcd6e('0x9')](_0xcd6e('0x12'),controller[_0xcd6e('0x13')]);var upload=multer({'storage':multer[_0xcd6e('0x14')]({'destination':function(_0x5e2b05,_0x227be1,_0x23bf35){_0x23bf35(null,path[_0xcd6e('0x15')](config[_0xcd6e('0x16')],_0xcd6e('0x17')));},'filename':function(_0xf8aab0,_0x3a6cc8,_0x2a1730){_0x2a1730(null,util[_0xcd6e('0x18')](_0xcd6e('0x19'),_0xcd6e('0x1a'),path['extname'](_0x3a6cc8['originalname'])));}})});router[_0xcd6e('0x1b')]('/:id/logo',upload[_0xcd6e('0x1c')]('file'),controller[_0xcd6e('0x1d')]);var upload=multer({'storage':multer[_0xcd6e('0x14')]({'destination':function(_0x1179f7,_0x1d5c2b,_0x19370f){_0x19370f(null,path[_0xcd6e('0x15')](config[_0xcd6e('0x16')],_0xcd6e('0x17')));},'filename':function(_0x29105c,_0x23d75a,_0x3b3a83){_0x3b3a83(null,util[_0xcd6e('0x18')](_0xcd6e('0x19'),_0xcd6e('0x1e'),path['extname'](_0x23d75a[_0xcd6e('0x1f')])));}})});router[_0xcd6e('0x1b')](_0xcd6e('0xe'),upload['single'](_0xcd6e('0x20')),controller[_0xcd6e('0x21')]);var upload=multer({'storage':multer[_0xcd6e('0x14')]({'destination':function(_0x44788e,_0x33281c,_0x1fe24a){_0x1fe24a(null,path[_0xcd6e('0x15')](config[_0xcd6e('0x16')],_0xcd6e('0x17')));},'filename':function(_0x1ce4c1,_0x2f613f,_0x5b25a0){_0x5b25a0(null,util[_0xcd6e('0x18')]('%s%s',_0xcd6e('0x22'),path[_0xcd6e('0x23')](_0x2f613f[_0xcd6e('0x1f')])));}})});router[_0xcd6e('0x1b')](_0xcd6e('0x12'),upload[_0xcd6e('0x1c')](_0xcd6e('0x20')),controller[_0xcd6e('0x24')]);router[_0xcd6e('0x25')](_0xcd6e('0xb'),auth['isAuthenticated'](),controller[_0xcd6e('0x26')]);module['exports']=router; \ No newline at end of file +var _0x0836=['../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','diskStorage','root','format','%s%s','logo','originalname','post','single','addLogo','join','server/files/images/logos/','logologin','extname','preferred','/:id/preferred','file','addPreferred','put','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x277212,_0x1d0079){var _0x3caed0=function(_0x28d6c2){while(--_0x28d6c2){_0x277212['push'](_0x277212['shift']());}};_0x3caed0(++_0x1d0079);}(_0x0836,0x159));var _0x6083=function(_0x4efa44,_0x1501e7){_0x4efa44=_0x4efa44-0x0;var _0x107cf7=_0x0836[_0x4efa44];return _0x107cf7;};'use strict';var multer=require(_0x6083('0x0'));var util=require(_0x6083('0x1'));var path=require(_0x6083('0x2'));var timeout=require(_0x6083('0x3'));var express=require(_0x6083('0x4'));var router=express[_0x6083('0x5')]();var auth=require(_0x6083('0x6'));var interaction=require(_0x6083('0x7'));var config=require(_0x6083('0x8'));var controller=require(_0x6083('0x9'));router[_0x6083('0xa')]('/',auth[_0x6083('0xb')](),controller[_0x6083('0xc')]);router[_0x6083('0xa')](_0x6083('0xd'),controller[_0x6083('0xe')]);router['get'](_0x6083('0xf'),controller['getLogo']);router[_0x6083('0xa')](_0x6083('0x10'),controller[_0x6083('0x11')]);router['get'](_0x6083('0x12'),controller['gdpr']);router['get']('/:id/preferred',controller[_0x6083('0x13')]);var upload=multer({'storage':multer[_0x6083('0x14')]({'destination':function(_0x21eee8,_0x5c06c5,_0x29f84e){_0x29f84e(null,path['join'](config[_0x6083('0x15')],'server/files/images/logos/'));},'filename':function(_0x24b8a4,_0x10acbe,_0x2eec38){_0x2eec38(null,util[_0x6083('0x16')](_0x6083('0x17'),_0x6083('0x18'),path['extname'](_0x10acbe[_0x6083('0x19')])));}})});router[_0x6083('0x1a')](_0x6083('0xf'),upload[_0x6083('0x1b')]('file'),controller[_0x6083('0x1c')]);var upload=multer({'storage':multer[_0x6083('0x14')]({'destination':function(_0x575376,_0xa8663e,_0x1bfe66){_0x1bfe66(null,path[_0x6083('0x1d')](config[_0x6083('0x15')],_0x6083('0x1e')));},'filename':function(_0x5f17ed,_0x277a59,_0x5ee37f){_0x5ee37f(null,util[_0x6083('0x16')](_0x6083('0x17'),_0x6083('0x1f'),path[_0x6083('0x20')](_0x277a59[_0x6083('0x19')])));}})});router[_0x6083('0x1a')](_0x6083('0x10'),upload[_0x6083('0x1b')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x8f2e19,_0x5267dc,_0x29fd61){_0x29fd61(null,path['join'](config[_0x6083('0x15')],_0x6083('0x1e')));},'filename':function(_0x327b79,_0x11607b,_0x510a2c){_0x510a2c(null,util['format'](_0x6083('0x17'),_0x6083('0x21'),path['extname'](_0x11607b[_0x6083('0x19')])));}})});router[_0x6083('0x1a')](_0x6083('0x22'),upload[_0x6083('0x1b')](_0x6083('0x23')),controller[_0x6083('0x24')]);router[_0x6083('0x25')](_0x6083('0xd'),auth['isAuthenticated'](),controller['update']);module[_0x6083('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 0bbbd8a..67dff05 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 _0x7a02=['alternate','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x7a02,0x1ba));var _0x27a0=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x7a02[_0x26f702];return _0x11417d;};'use strict';var Sequelize=require('sequelize');module[_0x27a0('0x0')]={'min_internal':{'type':Sequelize[_0x27a0('0x1')](0xb),'unique':_0x27a0('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x27a0('0x1')](0xb),'unique':_0x27a0('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x27a0('0x4')],'defaultValue':_0x27a0('0x5')},'logo':{'type':Sequelize[_0x27a0('0x4')]},'defaultLogo':{'type':Sequelize[_0x27a0('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x27a0('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x27a0('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x27a0('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x27a0('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x27a0('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x27a0('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x27a0('0x4')]},'turnaddr':{'type':Sequelize[_0x27a0('0x4')]},'turnusername':{'type':Sequelize[_0x27a0('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x27a0('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x27a0('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x27a0('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x27a0('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x27a0('0x4')],'defaultValue':_0x27a0('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x27a0('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x27a0('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x27a0('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x27a0('0x8')},'chatTimeout':{'type':Sequelize[_0x27a0('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x27a0('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x27a0('0x4')]},'defaultPreferred':{'type':Sequelize[_0x27a0('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe1d1=['/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','min_internal','INTEGER','min_mailbox'];(function(_0x259a98,_0x8d3d1){var _0x2f538a=function(_0x4240a6){while(--_0x4240a6){_0x259a98['push'](_0x259a98['shift']());}};_0x2f538a(++_0x8d3d1);}(_0xe1d1,0x131));var _0x1e1d=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xe1d1[_0x17406a];return _0x1501ff;};'use strict';var Sequelize=require(_0x1e1d('0x0'));module[_0x1e1d('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x1e1d('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1e1d('0x3')](0xb),'unique':_0x1e1d('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1e1d('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x1e1d('0x5')},'logo':{'type':Sequelize[_0x1e1d('0x6')]},'defaultLogo':{'type':Sequelize[_0x1e1d('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x1e1d('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0x1e1d('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1e1d('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x1e1d('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1e1d('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1e1d('0x6')]},'turnaddr':{'type':Sequelize[_0x1e1d('0x6')]},'turnusername':{'type':Sequelize[_0x1e1d('0x6')]},'turnpassword':{'type':Sequelize[_0x1e1d('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1e1d('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1e1d('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1e1d('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x1e1d('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1e1d('0x6')],'defaultValue':_0x1e1d('0x8')},'enableEmailPreview':{'type':Sequelize[_0x1e1d('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x1e1d('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1e1d('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1e1d('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1e1d('0x6')],'defaultValue':_0x1e1d('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1e1d('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1e1d('0x6')]},'defaultPreferred':{'type':Sequelize[_0x1e1d('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index dbc6c77..06d5f23 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 _0xae6e=['gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','json','count','offset','Content-Range','apply','reject','update','destroy','sendStatus','name','send','index','Setting','rawAttributes','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','fields','find','body','get','readFileSync','join','root','server/files/templates/stun.ejs','render','server/files/templates/turn.ejs','utf8','/etc/asterisk/stun_xcally.conf','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','addLogo','file','addLogoLogin','filename','loginLogo','../../config/license/util','getLogo','server/files/images/logos','logo','preferred','defaultLoginLogo','defaultPreferred','toLower','default_logo.png','default','upperFirst','custom','existsSync','Sequelize','Logo\x20not\x20found','getLogoLogin','getLicense','defaultLogo','default_loginLogo.png','ValidationError','download'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0xae6e,0x1e5));var _0xeae6=function(_0x2a4055,_0x29c3d7){_0x2a4055=_0x2a4055-0x0;var _0x51feae=_0xae6e[_0x2a4055];return _0x51feae;};'use strict';var pdf=require(_0xeae6('0x0'));var emlformat=require(_0xeae6('0x1'));var rimraf=require(_0xeae6('0x2'));var zipdir=require(_0xeae6('0x3'));var jsonpatch=require(_0xeae6('0x4'));var rp=require('request-promise');var moment=require(_0xeae6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeae6('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xeae6('0x7'));var ejs=require(_0xeae6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeae6('0x9'));var crypto=require(_0xeae6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeae6('0x7'));var querystring=require(_0xeae6('0xb'));var Papa=require(_0xeae6('0xc'));var authService=require(_0xeae6('0xd'));var hardwareService=require(_0xeae6('0xe'));var Redis=require('ioredis');var qs=require(_0xeae6('0xf'));var logger=require(_0xeae6('0x10'))(_0xeae6('0x11'));var utils=require(_0xeae6('0x12'));var config=require(_0xeae6('0x13'));var db=require(_0xeae6('0x14'))['db'];var jayson=require(_0xeae6('0x15'));var client=jayson[_0xeae6('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x429d80,_0x5050b5,_0x5aee8c,_0x12527f){return new BPromise(function(_0x433194,_0x1741a5){var _0x31f94a=_0x12527f||client;return _0x31f94a[_0xeae6('0x17')](_0x429d80,_0x5aee8c)[_0xeae6('0x18')](function(_0x209fe2){logger[_0xeae6('0x19')](_0xeae6('0x1a'),_0x5050b5,'request\x20sent');logger['debug'](_0xeae6('0x1b'),_0x5050b5,_0xeae6('0x1c'),JSON[_0xeae6('0x1d')](_0x209fe2));if(_0x209fe2[_0xeae6('0x1e')]){if(_0x209fe2['error'][_0xeae6('0x1f')]===0x1f4){logger[_0xeae6('0x1e')](_0xeae6('0x1a'),_0x5050b5,_0x209fe2[_0xeae6('0x1e')][_0xeae6('0x20')]);return _0x1741a5(_0x209fe2[_0xeae6('0x1e')][_0xeae6('0x20')]);}logger[_0xeae6('0x1e')]('Setting,\x20%s,\x20%s',_0x5050b5,_0x209fe2['error'][_0xeae6('0x20')]);return _0x433194(_0x209fe2['error'][_0xeae6('0x20')]);}else{logger[_0xeae6('0x19')](_0xeae6('0x1a'),_0x5050b5,'request\x20sent');_0x433194(_0x209fe2[_0xeae6('0x21')][_0xeae6('0x20')]);}})[_0xeae6('0x22')](function(_0x1e8c0f){logger[_0xeae6('0x1e')](_0xeae6('0x1a'),_0x5050b5,_0x1e8c0f);_0x1741a5(_0x1e8c0f);});});}function respondWithStatusCode(_0x3c4089,_0x1ed263){_0x1ed263=_0x1ed263||0xcc;return function(_0x4b8886){if(_0x4b8886){return _0x3c4089['sendStatus'](_0x1ed263);}return _0x3c4089['status'](_0x1ed263)[_0xeae6('0x23')]();};}function respondWithResult(_0x154415,_0x47435b){_0x47435b=_0x47435b||0xc8;return function(_0x1b0128){if(_0x1b0128){return _0x154415[_0xeae6('0x24')](_0x47435b)[_0xeae6('0x25')](_0x1b0128);}};}function respondWithFilteredResult(_0x172349,_0x4e9d77){return function(_0x34dfb4){if(_0x34dfb4){var _0x551720=_0x34dfb4[_0xeae6('0x26')],_0x5a5861=_0x4e9d77[_0xeae6('0x27')],_0x4ac10f=_0x4e9d77[_0xeae6('0x27')]+_0x4e9d77['limit'],_0x1399da;if(_0x4ac10f>=_0x551720){_0x4ac10f=_0x551720;_0x1399da=0xc8;}else{_0x1399da=0xce;}_0x172349['status'](_0x1399da);return _0x172349['set'](_0xeae6('0x28'),_0x5a5861+'-'+_0x4ac10f+'/'+_0x551720)[_0xeae6('0x25')](_0x34dfb4);}return null;};}function patchUpdates(_0x1f702a){return function(_0x5bacc6){try{jsonpatch[_0xeae6('0x29')](_0x5bacc6,_0x1f702a,!![]);}catch(_0xf7af49){return BPromise[_0xeae6('0x2a')](_0xf7af49);}return _0x5bacc6['save']();};}function saveUpdates(_0x54bee5,_0x2c3a4e){return function(_0x78163e){if(_0x78163e){return _0x78163e[_0xeae6('0x2b')](_0x54bee5)[_0xeae6('0x18')](function(_0x436854){return _0x436854;});}return null;};}function removeEntity(_0x95c2,_0x605dad){return function(_0x39eae4){if(_0x39eae4){return _0x39eae4[_0xeae6('0x2c')]()[_0xeae6('0x18')](function(){_0x95c2[_0xeae6('0x24')](0xcc)[_0xeae6('0x23')]();});}};}function handleEntityNotFound(_0x2b463d,_0x5c35ca){return function(_0x1d21df){if(!_0x1d21df){_0x2b463d[_0xeae6('0x2d')](0x194);}return _0x1d21df;};}function handleError(_0x284700,_0x6da4e7){_0x6da4e7=_0x6da4e7||0x1f4;return function(_0x242051){logger[_0xeae6('0x1e')](_0x242051['stack']);if(_0x242051[_0xeae6('0x2e')]){delete _0x242051[_0xeae6('0x2e')];}_0x284700[_0xeae6('0x24')](_0x6da4e7)[_0xeae6('0x2f')](_0x242051);};}exports[_0xeae6('0x30')]=function(_0x31cfe3,_0xc401f9){var _0x2d0a90={},_0x37b53c={},_0x5e1963={'count':0x0,'rows':[]};var _0x3d62b8=db[_0xeae6('0x31')][_0xeae6('0x32')];_0x37b53c[_0xeae6('0x33')]=_['keys'](_0x3d62b8);_0x37b53c[_0xeae6('0x34')]=_[_0xeae6('0x35')](_0x31cfe3[_0xeae6('0x34')]);_0x37b53c['filters']=_[_0xeae6('0x36')](_0x37b53c['model'],_0x37b53c[_0xeae6('0x34')]);_0x2d0a90['attributes']=_[_0xeae6('0x36')](_0x37b53c[_0xeae6('0x33')],qs['fields'](_0x31cfe3[_0xeae6('0x34')]['fields']));_0x2d0a90['attributes']=_0x2d0a90[_0xeae6('0x37')][_0xeae6('0x38')]?_0x2d0a90['attributes']:_0x37b53c[_0xeae6('0x33')];if(!_0x31cfe3[_0xeae6('0x34')][_0xeae6('0x39')](_0xeae6('0x3a'))){_0x2d0a90[_0xeae6('0x3b')]=qs['limit'](_0x31cfe3[_0xeae6('0x34')][_0xeae6('0x3b')]);_0x2d0a90[_0xeae6('0x27')]=qs['offset'](_0x31cfe3['query'][_0xeae6('0x27')]);}_0x2d0a90['order']=qs[_0xeae6('0x3c')](_0x31cfe3['query'][_0xeae6('0x3c')]);_0x2d0a90[_0xeae6('0x3d')]=qs[_0xeae6('0x3e')](_['pick'](_0x31cfe3['query'],_0x37b53c['filters']));if(_0x31cfe3[_0xeae6('0x34')]['filter']){_0x2d0a90[_0xeae6('0x3d')]=_[_0xeae6('0x3f')](_0x2d0a90['where'],{'$or':_[_0xeae6('0x40')](_0x3d62b8,function(_0x78664d){if(_0x78664d['type']['key']!==_0xeae6('0x41')){var _0x5a47c4={};_0x5a47c4[_0x78664d['field']]={'$like':'%'+_0x31cfe3[_0xeae6('0x34')][_0xeae6('0x42')]+'%'};return _0x5a47c4;}})});}_0x2d0a90=_['merge']({},_0x2d0a90,_0x31cfe3[_0xeae6('0x43')]);var _0x36f188={'where':_0x2d0a90[_0xeae6('0x3d')]};return db[_0xeae6('0x31')][_0xeae6('0x26')](_0x36f188)[_0xeae6('0x18')](function(_0x162e6b){_0x5e1963[_0xeae6('0x26')]=_0x162e6b;if(_0x31cfe3[_0xeae6('0x34')][_0xeae6('0x44')]){_0x2d0a90['include']=[{'all':!![]}];}return db[_0xeae6('0x31')][_0xeae6('0x45')](_0x2d0a90);})['then'](function(_0x31418f){_0x5e1963[_0xeae6('0x46')]=_0x31418f;return _0x5e1963;})['then'](respondWithFilteredResult(_0xc401f9,_0x2d0a90))[_0xeae6('0x22')](handleError(_0xc401f9,null));};exports[_0xeae6('0x47')]=function(_0x4aa301,_0xd0aaae){var _0x5783fd={'raw':![],'where':{'id':_0x4aa301[_0xeae6('0x48')]['id']}},_0x557d49={};_0x557d49['model']=_[_0xeae6('0x35')](db[_0xeae6('0x31')][_0xeae6('0x32')]);_0x557d49[_0xeae6('0x34')]=_[_0xeae6('0x35')](_0x4aa301[_0xeae6('0x34')]);_0x557d49['filters']=_[_0xeae6('0x36')](_0x557d49[_0xeae6('0x33')],_0x557d49[_0xeae6('0x34')]);_0x5783fd['attributes']=_['intersection'](_0x557d49[_0xeae6('0x33')],qs['fields'](_0x4aa301[_0xeae6('0x34')][_0xeae6('0x49')]));_0x5783fd['attributes']=_0x5783fd['attributes']['length']?_0x5783fd[_0xeae6('0x37')]:_0x557d49['model'];if(_0x4aa301[_0xeae6('0x34')][_0xeae6('0x44')]){_0x5783fd['include']=[{'all':!![]}];}_0x5783fd=_[_0xeae6('0x3f')]({},_0x5783fd,_0x4aa301['options']);return db[_0xeae6('0x31')][_0xeae6('0x4a')](_0x5783fd)[_0xeae6('0x18')](handleEntityNotFound(_0xd0aaae,null))[_0xeae6('0x18')](respondWithResult(_0xd0aaae,null))[_0xeae6('0x22')](handleError(_0xd0aaae,null));};exports['update']=function(_0x11256c,_0x3bb9bc,_0x111529){var _0x13ffe2;return db[_0xeae6('0x31')][_0xeae6('0x4a')]({'where':{'id':_0x11256c['params']['id']}})[_0xeae6('0x18')](handleEntityNotFound(_0x3bb9bc,null))[_0xeae6('0x18')](saveUpdates(_0x11256c[_0xeae6('0x4b')],null))[_0xeae6('0x18')](function(_0x12118a){if(_0x12118a){_0x13ffe2=_0x12118a[_0xeae6('0x4c')]({'plain':!![]});var _0x43f2b1=fs[_0xeae6('0x4d')](path[_0xeae6('0x4e')](config[_0xeae6('0x4f')],_0xeae6('0x50')),'utf8');var _0x20f0eb=ejs[_0xeae6('0x51')](_0x43f2b1,_0x13ffe2);var _0x96a261=fs[_0xeae6('0x4d')](path['join'](config[_0xeae6('0x4f')],_0xeae6('0x52')),_0xeae6('0x53'));var _0x201230=ejs[_0xeae6('0x51')](_0x96a261,_0x13ffe2);fs['writeFileSync'](_0xeae6('0x54'),_0x20f0eb);fs[_0xeae6('0x55')](_0xeae6('0x56'),_0x201230);return respondWithRpcPromise(_0xeae6('0x57'),_0xeae6('0x2b'),{'module':_0xeae6('0x58')});}})[_0xeae6('0x18')](function(){return respondWithRpcPromise(_0xeae6('0x57'),_0xeae6('0x2b'),{'module':'res_rtp_asterisk.so'});})[_0xeae6('0x18')](function(){return _0x13ffe2||null;})[_0xeae6('0x18')](respondWithResult(_0x3bb9bc,null))[_0xeae6('0x22')](handleError(_0x3bb9bc,null));};exports[_0xeae6('0x59')]=function(_0x930879,_0x1dcdad,_0xea078d){if(_0x930879[_0xeae6('0x5a')]&&_0x930879[_0xeae6('0x5a')]['filename']){_0x930879[_0xeae6('0x4b')]['logo']=_0x930879[_0xeae6('0x5a')]['filename'];}return db['Setting']['find']({'where':{'id':_0x930879[_0xeae6('0x48')]['id']}})[_0xeae6('0x18')](handleEntityNotFound(_0x1dcdad,null))[_0xeae6('0x18')](saveUpdates(_0x930879[_0xeae6('0x4b')],null))[_0xeae6('0x18')](respondWithResult(_0x1dcdad,null))[_0xeae6('0x22')](handleError(_0x1dcdad,null));};exports[_0xeae6('0x5b')]=function(_0x59f8c3,_0x323162,_0x3b6709){if(_0x59f8c3[_0xeae6('0x5a')]&&_0x59f8c3[_0xeae6('0x5a')][_0xeae6('0x5c')]){_0x59f8c3[_0xeae6('0x4b')][_0xeae6('0x5d')]=_0x59f8c3[_0xeae6('0x5a')][_0xeae6('0x5c')];}return db[_0xeae6('0x31')]['find']({'where':{'id':_0x59f8c3[_0xeae6('0x48')]['id']}})[_0xeae6('0x18')](handleEntityNotFound(_0x323162,null))[_0xeae6('0x18')](saveUpdates(_0x59f8c3[_0xeae6('0x4b')],null))[_0xeae6('0x18')](respondWithResult(_0x323162,null))[_0xeae6('0x22')](handleError(_0x323162,null));};var utilLicense=require(_0xeae6('0x5e'));exports[_0xeae6('0x5f')]=function(_0x2136d9,_0x5a7916,_0x56f4a7){var _0x37cc93=_0xeae6('0x60');var _0x22cee6={'custom':![]};return utilLicense['getLicense']()[_0xeae6('0x18')](function(_0x3a33e2){if(_0x3a33e2){_0x22cee6=_0x3a33e2;}return db[_0xeae6('0x31')][_0xeae6('0x4a')]({'where':{'id':_0x2136d9['params']['id']},'attributes':[_0xeae6('0x61'),_0xeae6('0x5d'),_0xeae6('0x62'),'defaultLogo',_0xeae6('0x63'),_0xeae6('0x64')],'raw':!![]});})[_0xeae6('0x18')](handleEntityNotFound(_0x5a7916,null))['then'](function(_0x2c2adb){if(_0x2c2adb){var _0x407cef=_0x2c2adb[_0xeae6('0x61')]&&fs['existsSync'](path['join'](config[_0xeae6('0x4f')],_0x37cc93,_[_0xeae6('0x65')](_0x2c2adb[_0xeae6('0x61')])))?path[_0xeae6('0x4e')](config[_0xeae6('0x4f')],_0x37cc93,_['toLower'](_0x2c2adb['logo'])):path['join'](config['root'],_0x37cc93,_[_0xeae6('0x65')](_0xeae6('0x66')));var _0x5ade6b=_0xeae6('0x67')+_[_0xeae6('0x68')](_0xeae6('0x61'));if(_0x2c2adb[_0x5ade6b]||!_0x22cee6[_0xeae6('0x69')]){_0x407cef=path[_0xeae6('0x4e')](config[_0xeae6('0x4f')],_0x37cc93,_[_0xeae6('0x65')]('default_logo.png'));}if(!fs[_0xeae6('0x6a')](_0x407cef)){throw new db[(_0xeae6('0x6b'))]['ValidationError'](_0xeae6('0x6c'));}return _0x5a7916['download'](_0x407cef);}})[_0xeae6('0x22')](handleError(_0x5a7916,null));};var utilLicense=require('../../config/license/util');exports[_0xeae6('0x6d')]=function(_0x2ecca5,_0x51b804,_0x391100){var _0x44622e=_0xeae6('0x60');var _0x5e31dc={'custom':![]};return utilLicense[_0xeae6('0x6e')]()[_0xeae6('0x18')](function(_0x53d877){if(_0x53d877){_0x5e31dc=_0x53d877;}return db[_0xeae6('0x31')][_0xeae6('0x4a')]({'where':{'id':_0x2ecca5[_0xeae6('0x48')]['id']},'attributes':[_0xeae6('0x61'),_0xeae6('0x5d'),_0xeae6('0x62'),_0xeae6('0x6f'),'defaultLoginLogo',_0xeae6('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x51b804,null))['then'](function(_0x566dce){if(_0x566dce){var _0x38f2cd=_0x566dce[_0xeae6('0x5d')]&&fs[_0xeae6('0x6a')](path[_0xeae6('0x4e')](config[_0xeae6('0x4f')],_0x44622e,_['toLower'](_0x566dce[_0xeae6('0x5d')])))?path['join'](config[_0xeae6('0x4f')],_0x44622e,_['toLower'](_0x566dce['loginLogo'])):path[_0xeae6('0x4e')](config[_0xeae6('0x4f')],_0x44622e,_[_0xeae6('0x65')](_0xeae6('0x70')));var _0x5e0d14='default'+_['upperFirst']('loginLogo');if(_0x566dce[_0x5e0d14]||!_0x5e31dc[_0xeae6('0x69')]){_0x38f2cd=path['join'](config[_0xeae6('0x4f')],_0x44622e,_['toLower'](_0xeae6('0x70')));}if(!fs[_0xeae6('0x6a')](_0x38f2cd)){throw new db[(_0xeae6('0x6b'))][(_0xeae6('0x71'))](_0xeae6('0x6c'));}return _0x51b804[_0xeae6('0x72')](_0x38f2cd);}})[_0xeae6('0x22')](handleError(_0x51b804,null));};exports[_0xeae6('0x73')]=function(_0x1e6542,_0x158fd6){return db['Setting']['find']({'where':{'id':_0x1e6542[_0xeae6('0x48')]['id']},'attributes':[_0xeae6('0x74')]})[_0xeae6('0x18')](respondWithResult(_0x158fd6,null))[_0xeae6('0x22')](handleError(_0x158fd6,null));};exports[_0xeae6('0x75')]=function(_0x4e9572,_0x3e1263,_0x37208f){if(_0x4e9572[_0xeae6('0x5a')]&&_0x4e9572[_0xeae6('0x5a')]['filename']){_0x4e9572[_0xeae6('0x4b')][_0xeae6('0x62')]=_0x4e9572[_0xeae6('0x5a')][_0xeae6('0x5c')];}return db['Setting'][_0xeae6('0x4a')]({'where':{'id':_0x4e9572['params']['id']}})[_0xeae6('0x18')](handleEntityNotFound(_0x3e1263,null))['then'](saveUpdates(_0x4e9572[_0xeae6('0x4b')],null))[_0xeae6('0x18')](respondWithResult(_0x3e1263,null))['catch'](handleError(_0x3e1263,null));};var utilLicense=require(_0xeae6('0x5e'));exports[_0xeae6('0x76')]=function(_0x127674,_0x46fa69,_0x186403){var _0x28948b=_0xeae6('0x60');var _0x561f8f={'custom':![]};return utilLicense[_0xeae6('0x6e')]()[_0xeae6('0x18')](function(_0x4f89c7){if(_0x4f89c7){_0x561f8f=_0x4f89c7;}return db[_0xeae6('0x31')]['find']({'where':{'id':_0x127674['params']['id']},'attributes':[_0xeae6('0x61'),_0xeae6('0x5d'),_0xeae6('0x62'),_0xeae6('0x6f'),_0xeae6('0x63'),_0xeae6('0x64')],'raw':!![]});})[_0xeae6('0x18')](handleEntityNotFound(_0x46fa69,null))[_0xeae6('0x18')](function(_0x4cae70){if(_0x4cae70){var _0x3e9f31=_0x4cae70[_0xeae6('0x62')]&&fs[_0xeae6('0x6a')](path[_0xeae6('0x4e')](config['root'],_0x28948b,_[_0xeae6('0x65')](_0x4cae70[_0xeae6('0x62')])))?path[_0xeae6('0x4e')](config['root'],_0x28948b,_[_0xeae6('0x65')](_0x4cae70[_0xeae6('0x62')])):path[_0xeae6('0x4e')](config[_0xeae6('0x4f')],_0x28948b,_[_0xeae6('0x65')](_0xeae6('0x77')));var _0x3c8a3e=_0xeae6('0x67')+_['upperFirst'](_0xeae6('0x62'));if(_0x4cae70[_0x3c8a3e]||!_0x561f8f['custom']||!_0x561f8f[_0xeae6('0x62')]){_0x3e9f31=path[_0xeae6('0x4e')](config[_0xeae6('0x4f')],_0x28948b,_['toLower'](_0xeae6('0x77')));}if(!fs[_0xeae6('0x6a')](_0x3e9f31)){throw new db[(_0xeae6('0x6b'))]['ValidationError'](_0xeae6('0x6c'));}return _0x46fa69[_0xeae6('0x72')](_0x3e9f31);}})[_0xeae6('0x22')](handleError(_0x46fa69,null));}; \ No newline at end of file +var _0xda2d=['defaultLogo','defaultPreferred','logo','existsSync','toLower','default_logo.png','upperFirst','custom','Sequelize','ValidationError','download','default_loginLogo.png','Logo\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','getLicense','default_preferred.png','default','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','stack','name','send','Setting','keys','query','intersection','model','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','map','type','key','VIRTUAL','field','where','includeAll','include','findAll','catch','show','options','find','params','body','get','join','root','server/files/templates/stun.ejs','render','readFileSync','server/files/templates/turn.ejs','utf8','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','res_rtp_asterisk.so','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0xda2d,0x102));var _0xdda2=function(_0x3ece07,_0x17c164){_0x3ece07=_0x3ece07-0x0;var _0x46bd80=_0xda2d[_0x3ece07];return _0x46bd80;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda2('0x0'));var rimraf=require(_0xdda2('0x1'));var zipdir=require(_0xdda2('0x2'));var jsonpatch=require(_0xdda2('0x3'));var rp=require(_0xdda2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdda2('0x5'));var path=require(_0xdda2('0x6'));var sox=require(_0xdda2('0x7'));var csv=require(_0xdda2('0x8'));var ejs=require(_0xdda2('0x9'));var fs=require('fs');var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0xdda2('0x11'));var Redis=require(_0xdda2('0x12'));var qs=require(_0xdda2('0x13'));var logger=require(_0xdda2('0x14'))(_0xdda2('0x15'));var utils=require(_0xdda2('0x16'));var config=require(_0xdda2('0x17'));var db=require(_0xdda2('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa6446b,_0x320f73,_0x3518b9,_0x1503a7){return new BPromise(function(_0x2e4132,_0x475222){var _0x3490f1=_0x1503a7||client;return _0x3490f1['request'](_0xa6446b,_0x3518b9)[_0xdda2('0x19')](function(_0x4b0220){logger[_0xdda2('0x1a')](_0xdda2('0x1b'),_0x320f73,_0xdda2('0x1c'));logger[_0xdda2('0x1d')](_0xdda2('0x1e'),_0x320f73,'request\x20sent',JSON['stringify'](_0x4b0220));if(_0x4b0220[_0xdda2('0x1f')]){if(_0x4b0220['error'][_0xdda2('0x20')]===0x1f4){logger[_0xdda2('0x1f')](_0xdda2('0x1b'),_0x320f73,_0x4b0220[_0xdda2('0x1f')][_0xdda2('0x21')]);return _0x475222(_0x4b0220[_0xdda2('0x1f')][_0xdda2('0x21')]);}logger[_0xdda2('0x1f')](_0xdda2('0x1b'),_0x320f73,_0x4b0220[_0xdda2('0x1f')][_0xdda2('0x21')]);return _0x2e4132(_0x4b0220[_0xdda2('0x1f')]['message']);}else{logger[_0xdda2('0x1a')]('Setting,\x20%s,\x20%s',_0x320f73,_0xdda2('0x1c'));_0x2e4132(_0x4b0220[_0xdda2('0x22')][_0xdda2('0x21')]);}})['catch'](function(_0x347ee6){logger['error'](_0xdda2('0x1b'),_0x320f73,_0x347ee6);_0x475222(_0x347ee6);});});}function respondWithStatusCode(_0x107ee4,_0x4ac3eb){_0x4ac3eb=_0x4ac3eb||0xcc;return function(_0x144f1e){if(_0x144f1e){return _0x107ee4[_0xdda2('0x23')](_0x4ac3eb);}return _0x107ee4[_0xdda2('0x24')](_0x4ac3eb)[_0xdda2('0x25')]();};}function respondWithResult(_0x45ee9d,_0x5739ad){_0x5739ad=_0x5739ad||0xc8;return function(_0x38cdf){if(_0x38cdf){return _0x45ee9d[_0xdda2('0x24')](_0x5739ad)[_0xdda2('0x26')](_0x38cdf);}};}function respondWithFilteredResult(_0x31d48b,_0x5436d1){return function(_0x4e97dc){if(_0x4e97dc){var _0x28da54=_0x4e97dc[_0xdda2('0x27')],_0x4567e7=_0x5436d1[_0xdda2('0x28')],_0x2e8591=_0x5436d1[_0xdda2('0x28')]+_0x5436d1[_0xdda2('0x29')],_0x5e9e74;if(_0x2e8591>=_0x28da54){_0x2e8591=_0x28da54;_0x5e9e74=0xc8;}else{_0x5e9e74=0xce;}_0x31d48b[_0xdda2('0x24')](_0x5e9e74);return _0x31d48b[_0xdda2('0x2a')]('Content-Range',_0x4567e7+'-'+_0x2e8591+'/'+_0x28da54)[_0xdda2('0x26')](_0x4e97dc);}return null;};}function patchUpdates(_0x255bbc){return function(_0x53acb5){try{jsonpatch[_0xdda2('0x2b')](_0x53acb5,_0x255bbc,!![]);}catch(_0x2cfaca){return BPromise[_0xdda2('0x2c')](_0x2cfaca);}return _0x53acb5[_0xdda2('0x2d')]();};}function saveUpdates(_0x5540e5,_0x129eba){return function(_0x5e107f){if(_0x5e107f){return _0x5e107f['update'](_0x5540e5)[_0xdda2('0x19')](function(_0x5edf7e){return _0x5edf7e;});}return null;};}function removeEntity(_0x2b8cd6,_0x55809a){return function(_0x53ff76){if(_0x53ff76){return _0x53ff76['destroy']()[_0xdda2('0x19')](function(){_0x2b8cd6['status'](0xcc)[_0xdda2('0x25')]();});}};}function handleEntityNotFound(_0x508664,_0x5cba58){return function(_0x52a509){if(!_0x52a509){_0x508664[_0xdda2('0x23')](0x194);}return _0x52a509;};}function handleError(_0x567717,_0xca6046){_0xca6046=_0xca6046||0x1f4;return function(_0x2fd592){logger[_0xdda2('0x1f')](_0x2fd592[_0xdda2('0x2e')]);if(_0x2fd592[_0xdda2('0x2f')]){delete _0x2fd592[_0xdda2('0x2f')];}_0x567717[_0xdda2('0x24')](_0xca6046)[_0xdda2('0x30')](_0x2fd592);};}exports['index']=function(_0x461621,_0x4212da){var _0x2f8674={},_0x3d510c={},_0x392373={'count':0x0,'rows':[]};var _0x33c4b0=db[_0xdda2('0x31')]['rawAttributes'];_0x3d510c['model']=_[_0xdda2('0x32')](_0x33c4b0);_0x3d510c[_0xdda2('0x33')]=_[_0xdda2('0x32')](_0x461621['query']);_0x3d510c['filters']=_[_0xdda2('0x34')](_0x3d510c[_0xdda2('0x35')],_0x3d510c[_0xdda2('0x33')]);_0x2f8674[_0xdda2('0x36')]=_[_0xdda2('0x34')](_0x3d510c['model'],qs[_0xdda2('0x37')](_0x461621[_0xdda2('0x33')]['fields']));_0x2f8674['attributes']=_0x2f8674[_0xdda2('0x36')][_0xdda2('0x38')]?_0x2f8674[_0xdda2('0x36')]:_0x3d510c[_0xdda2('0x35')];if(!_0x461621[_0xdda2('0x33')]['hasOwnProperty'](_0xdda2('0x39'))){_0x2f8674[_0xdda2('0x29')]=qs[_0xdda2('0x29')](_0x461621[_0xdda2('0x33')]['limit']);_0x2f8674['offset']=qs[_0xdda2('0x28')](_0x461621[_0xdda2('0x33')][_0xdda2('0x28')]);}_0x2f8674['order']=qs[_0xdda2('0x3a')](_0x461621['query'][_0xdda2('0x3a')]);_0x2f8674['where']=qs[_0xdda2('0x3b')](_[_0xdda2('0x3c')](_0x461621[_0xdda2('0x33')],_0x3d510c[_0xdda2('0x3b')]));if(_0x461621['query'][_0xdda2('0x3d')]){_0x2f8674['where']=_[_0xdda2('0x3e')](_0x2f8674['where'],{'$or':_[_0xdda2('0x3f')](_0x33c4b0,function(_0x12589b){if(_0x12589b[_0xdda2('0x40')][_0xdda2('0x41')]!==_0xdda2('0x42')){var _0x5acbb8={};_0x5acbb8[_0x12589b[_0xdda2('0x43')]]={'$like':'%'+_0x461621[_0xdda2('0x33')]['filter']+'%'};return _0x5acbb8;}})});}_0x2f8674=_[_0xdda2('0x3e')]({},_0x2f8674,_0x461621['options']);var _0x292e70={'where':_0x2f8674[_0xdda2('0x44')]};return db[_0xdda2('0x31')][_0xdda2('0x27')](_0x292e70)[_0xdda2('0x19')](function(_0x6718ea){_0x392373[_0xdda2('0x27')]=_0x6718ea;if(_0x461621[_0xdda2('0x33')][_0xdda2('0x45')]){_0x2f8674[_0xdda2('0x46')]=[{'all':!![]}];}return db[_0xdda2('0x31')][_0xdda2('0x47')](_0x2f8674);})[_0xdda2('0x19')](function(_0x4d22b3){_0x392373['rows']=_0x4d22b3;return _0x392373;})['then'](respondWithFilteredResult(_0x4212da,_0x2f8674))[_0xdda2('0x48')](handleError(_0x4212da,null));};exports[_0xdda2('0x49')]=function(_0x57b7b0,_0x2c41dc){var _0x18f229={'raw':![],'where':{'id':_0x57b7b0['params']['id']}},_0x22a99e={};_0x22a99e[_0xdda2('0x35')]=_[_0xdda2('0x32')](db['Setting']['rawAttributes']);_0x22a99e[_0xdda2('0x33')]=_['keys'](_0x57b7b0[_0xdda2('0x33')]);_0x22a99e['filters']=_[_0xdda2('0x34')](_0x22a99e[_0xdda2('0x35')],_0x22a99e['query']);_0x18f229['attributes']=_[_0xdda2('0x34')](_0x22a99e[_0xdda2('0x35')],qs[_0xdda2('0x37')](_0x57b7b0[_0xdda2('0x33')]['fields']));_0x18f229[_0xdda2('0x36')]=_0x18f229[_0xdda2('0x36')][_0xdda2('0x38')]?_0x18f229[_0xdda2('0x36')]:_0x22a99e[_0xdda2('0x35')];if(_0x57b7b0['query'][_0xdda2('0x45')]){_0x18f229[_0xdda2('0x46')]=[{'all':!![]}];}_0x18f229=_['merge']({},_0x18f229,_0x57b7b0[_0xdda2('0x4a')]);return db[_0xdda2('0x31')][_0xdda2('0x4b')](_0x18f229)[_0xdda2('0x19')](handleEntityNotFound(_0x2c41dc,null))[_0xdda2('0x19')](respondWithResult(_0x2c41dc,null))[_0xdda2('0x48')](handleError(_0x2c41dc,null));};exports['update']=function(_0x2c58c7,_0x4a9814,_0x361038){var _0x4a70ff;return db[_0xdda2('0x31')]['find']({'where':{'id':_0x2c58c7[_0xdda2('0x4c')]['id']}})[_0xdda2('0x19')](handleEntityNotFound(_0x4a9814,null))[_0xdda2('0x19')](saveUpdates(_0x2c58c7[_0xdda2('0x4d')],null))[_0xdda2('0x19')](function(_0x2b45f3){if(_0x2b45f3){_0x4a70ff=_0x2b45f3[_0xdda2('0x4e')]({'plain':!![]});var _0x40655d=fs['readFileSync'](path[_0xdda2('0x4f')](config[_0xdda2('0x50')],_0xdda2('0x51')),'utf8');var _0xf380b0=ejs[_0xdda2('0x52')](_0x40655d,_0x4a70ff);var _0x56ddf2=fs[_0xdda2('0x53')](path['join'](config[_0xdda2('0x50')],_0xdda2('0x54')),_0xdda2('0x55'));var _0xbfab73=ejs[_0xdda2('0x52')](_0x56ddf2,_0x4a70ff);fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0xf380b0);fs['writeFileSync'](_0xdda2('0x56'),_0xbfab73);return respondWithRpcPromise(_0xdda2('0x57'),'update',{'module':_0xdda2('0x58')});}})[_0xdda2('0x19')](function(){return respondWithRpcPromise(_0xdda2('0x57'),'update',{'module':_0xdda2('0x59')});})[_0xdda2('0x19')](function(){return _0x4a70ff||null;})[_0xdda2('0x19')](respondWithResult(_0x4a9814,null))['catch'](handleError(_0x4a9814,null));};exports[_0xdda2('0x5a')]=function(_0x4495e5,_0x7eb83f,_0x25c9a9){if(_0x4495e5['file']&&_0x4495e5[_0xdda2('0x5b')]['filename']){_0x4495e5['body']['logo']=_0x4495e5[_0xdda2('0x5b')][_0xdda2('0x5c')];}return db[_0xdda2('0x31')][_0xdda2('0x4b')]({'where':{'id':_0x4495e5[_0xdda2('0x4c')]['id']}})[_0xdda2('0x19')](handleEntityNotFound(_0x7eb83f,null))[_0xdda2('0x19')](saveUpdates(_0x4495e5[_0xdda2('0x4d')],null))[_0xdda2('0x19')](respondWithResult(_0x7eb83f,null))[_0xdda2('0x48')](handleError(_0x7eb83f,null));};exports[_0xdda2('0x5d')]=function(_0x5e6dcf,_0x215e2a,_0x173022){if(_0x5e6dcf[_0xdda2('0x5b')]&&_0x5e6dcf[_0xdda2('0x5b')][_0xdda2('0x5c')]){_0x5e6dcf[_0xdda2('0x4d')][_0xdda2('0x5e')]=_0x5e6dcf['file'][_0xdda2('0x5c')];}return db[_0xdda2('0x31')][_0xdda2('0x4b')]({'where':{'id':_0x5e6dcf[_0xdda2('0x4c')]['id']}})[_0xdda2('0x19')](handleEntityNotFound(_0x215e2a,null))['then'](saveUpdates(_0x5e6dcf[_0xdda2('0x4d')],null))[_0xdda2('0x19')](respondWithResult(_0x215e2a,null))[_0xdda2('0x48')](handleError(_0x215e2a,null));};var utilLicense=require(_0xdda2('0x5f'));exports[_0xdda2('0x60')]=function(_0x4a6f28,_0x17aaab,_0x18d251){var _0x3d49e8=_0xdda2('0x61');var _0x1ac15a={'custom':![]};return utilLicense['getLicense']()[_0xdda2('0x19')](function(_0x3d7951){if(_0x3d7951){_0x1ac15a=_0x3d7951;}return db[_0xdda2('0x31')]['find']({'where':{'id':_0x4a6f28[_0xdda2('0x4c')]['id']},'attributes':['logo',_0xdda2('0x5e'),_0xdda2('0x62'),_0xdda2('0x63'),'defaultLoginLogo',_0xdda2('0x64')],'raw':!![]});})[_0xdda2('0x19')](handleEntityNotFound(_0x17aaab,null))['then'](function(_0x13c0d9){if(_0x13c0d9){var _0x5adab5=_0x13c0d9[_0xdda2('0x65')]&&fs[_0xdda2('0x66')](path[_0xdda2('0x4f')](config[_0xdda2('0x50')],_0x3d49e8,_[_0xdda2('0x67')](_0x13c0d9['logo'])))?path['join'](config[_0xdda2('0x50')],_0x3d49e8,_[_0xdda2('0x67')](_0x13c0d9['logo'])):path['join'](config[_0xdda2('0x50')],_0x3d49e8,_['toLower'](_0xdda2('0x68')));var _0x1a33ba='default'+_[_0xdda2('0x69')](_0xdda2('0x65'));if(_0x13c0d9[_0x1a33ba]||!_0x1ac15a[_0xdda2('0x6a')]){_0x5adab5=path[_0xdda2('0x4f')](config[_0xdda2('0x50')],_0x3d49e8,_[_0xdda2('0x67')]('default_logo.png'));}if(!fs[_0xdda2('0x66')](_0x5adab5)){throw new db[(_0xdda2('0x6b'))][(_0xdda2('0x6c'))]('Logo\x20not\x20found');}return _0x17aaab[_0xdda2('0x6d')](_0x5adab5);}})[_0xdda2('0x48')](handleError(_0x17aaab,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x375921,_0x232823,_0x2f03b9){var _0x5b8382='server/files/images/logos';var _0x30be55={'custom':![]};return utilLicense['getLicense']()[_0xdda2('0x19')](function(_0x150dcd){if(_0x150dcd){_0x30be55=_0x150dcd;}return db[_0xdda2('0x31')][_0xdda2('0x4b')]({'where':{'id':_0x375921[_0xdda2('0x4c')]['id']},'attributes':[_0xdda2('0x65'),'loginLogo','preferred',_0xdda2('0x63'),'defaultLoginLogo',_0xdda2('0x64')],'raw':!![]});})[_0xdda2('0x19')](handleEntityNotFound(_0x232823,null))[_0xdda2('0x19')](function(_0x19d210){if(_0x19d210){var _0x79ed7=_0x19d210[_0xdda2('0x5e')]&&fs[_0xdda2('0x66')](path[_0xdda2('0x4f')](config[_0xdda2('0x50')],_0x5b8382,_['toLower'](_0x19d210[_0xdda2('0x5e')])))?path[_0xdda2('0x4f')](config[_0xdda2('0x50')],_0x5b8382,_[_0xdda2('0x67')](_0x19d210['loginLogo'])):path[_0xdda2('0x4f')](config[_0xdda2('0x50')],_0x5b8382,_[_0xdda2('0x67')](_0xdda2('0x6e')));var _0x595c84='default'+_[_0xdda2('0x69')](_0xdda2('0x5e'));if(_0x19d210[_0x595c84]||!_0x30be55[_0xdda2('0x6a')]){_0x79ed7=path[_0xdda2('0x4f')](config['root'],_0x5b8382,_[_0xdda2('0x67')](_0xdda2('0x6e')));}if(!fs[_0xdda2('0x66')](_0x79ed7)){throw new db[(_0xdda2('0x6b'))][(_0xdda2('0x6c'))](_0xdda2('0x6f'));}return _0x232823[_0xdda2('0x6d')](_0x79ed7);}})[_0xdda2('0x48')](handleError(_0x232823,null));};exports[_0xdda2('0x70')]=function(_0x10bc49,_0x12ff97){return db[_0xdda2('0x31')][_0xdda2('0x4b')]({'where':{'id':_0x10bc49[_0xdda2('0x4c')]['id']},'attributes':[_0xdda2('0x71')]})['then'](respondWithResult(_0x12ff97,null))[_0xdda2('0x48')](handleError(_0x12ff97,null));};exports[_0xdda2('0x72')]=function(_0x58fcea,_0x50f7f6,_0x3cb641){if(_0x58fcea[_0xdda2('0x5b')]&&_0x58fcea[_0xdda2('0x5b')][_0xdda2('0x5c')]){_0x58fcea[_0xdda2('0x4d')][_0xdda2('0x62')]=_0x58fcea['file'][_0xdda2('0x5c')];}return db[_0xdda2('0x31')][_0xdda2('0x4b')]({'where':{'id':_0x58fcea[_0xdda2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x50f7f6,null))[_0xdda2('0x19')](saveUpdates(_0x58fcea['body'],null))[_0xdda2('0x19')](respondWithResult(_0x50f7f6,null))[_0xdda2('0x48')](handleError(_0x50f7f6,null));};var utilLicense=require('../../config/license/util');exports[_0xdda2('0x73')]=function(_0x3d50fc,_0x1dcc02,_0x1dfe6d){var _0x222099=_0xdda2('0x61');var _0x1c6ef1={'custom':![]};return utilLicense[_0xdda2('0x74')]()[_0xdda2('0x19')](function(_0x3e82bb){if(_0x3e82bb){_0x1c6ef1=_0x3e82bb;}return db[_0xdda2('0x31')]['find']({'where':{'id':_0x3d50fc[_0xdda2('0x4c')]['id']},'attributes':[_0xdda2('0x65'),_0xdda2('0x5e'),_0xdda2('0x62'),_0xdda2('0x63'),'defaultLoginLogo',_0xdda2('0x64')],'raw':!![]});})[_0xdda2('0x19')](handleEntityNotFound(_0x1dcc02,null))['then'](function(_0x319af4){if(_0x319af4){var _0x2df7eb=_0x319af4['preferred']&&fs['existsSync'](path[_0xdda2('0x4f')](config[_0xdda2('0x50')],_0x222099,_[_0xdda2('0x67')](_0x319af4[_0xdda2('0x62')])))?path[_0xdda2('0x4f')](config[_0xdda2('0x50')],_0x222099,_['toLower'](_0x319af4[_0xdda2('0x62')])):path[_0xdda2('0x4f')](config['root'],_0x222099,_[_0xdda2('0x67')](_0xdda2('0x75')));var _0x4b57df=_0xdda2('0x76')+_[_0xdda2('0x69')](_0xdda2('0x62'));if(_0x319af4[_0x4b57df]||!_0x1c6ef1['custom']||!_0x1c6ef1[_0xdda2('0x62')]){_0x2df7eb=path['join'](config[_0xdda2('0x50')],_0x222099,_[_0xdda2('0x67')](_0xdda2('0x75')));}if(!fs[_0xdda2('0x66')](_0x2df7eb)){throw new db['Sequelize']['ValidationError'](_0xdda2('0x6f'));}return _0x1dcc02[_0xdda2('0x6d')](_0x2df7eb);}})['catch'](handleError(_0x1dcc02,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 461f071..01a777c 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 _0x47b0=['util','../../config/logger','api','moment','bluebird','request-promise','./setting.attributes','exports','define','Setting','settings','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47b0,0x18b));var _0x047b=function(_0x55ef14,_0x4a9ecd){_0x55ef14=_0x55ef14-0x0;var _0x66e49c=_0x47b0[_0x55ef14];return _0x66e49c;};'use strict';var _=require(_0x047b('0x0'));var util=require(_0x047b('0x1'));var logger=require(_0x047b('0x2'))(_0x047b('0x3'));var moment=require(_0x047b('0x4'));var BPromise=require(_0x047b('0x5'));var rp=require(_0x047b('0x6'));var attributes=require(_0x047b('0x7'));module[_0x047b('0x8')]=function(_0x16bd1d,_0x467790){return _0x16bd1d[_0x047b('0x9')](_0x047b('0xa'),attributes,{'tableName':_0x047b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04f9=['../../config/logger','api','moment','bluebird','request-promise','exports','define','Setting','settings','lodash','util'];(function(_0x127eee,_0x4ffc1c){var _0x5df898=function(_0xe8076){while(--_0xe8076){_0x127eee['push'](_0x127eee['shift']());}};_0x5df898(++_0x4ffc1c);}(_0x04f9,0x127));var _0x904f=function(_0x63bc8f,_0x552679){_0x63bc8f=_0x63bc8f-0x0;var _0x503fbd=_0x04f9[_0x63bc8f];return _0x503fbd;};'use strict';var _=require(_0x904f('0x0'));var util=require(_0x904f('0x1'));var logger=require(_0x904f('0x2'))(_0x904f('0x3'));var moment=require(_0x904f('0x4'));var BPromise=require(_0x904f('0x5'));var rp=require(_0x904f('0x6'));var attributes=require('./setting.attributes');module[_0x904f('0x7')]=function(_0x95bb07,_0x29bfa0){return _0x95bb07[_0x904f('0x8')](_0x904f('0x9'),attributes,{'tableName':_0x904f('0xa'),'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 61b1b70..fa167b8 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 _0xe974=['request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','Setting,\x20%s,\x20%s'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0xe974,0x14b));var _0x4e97=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0xe974[_0x4c2623];return _0x2be431;};'use strict';var _=require(_0x4e97('0x0'));var util=require(_0x4e97('0x1'));var moment=require(_0x4e97('0x2'));var BPromise=require(_0x4e97('0x3'));var rs=require(_0x4e97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e97('0x5'))['db'];var utils=require(_0x4e97('0x6'));var logger=require(_0x4e97('0x7'))('rpc');var config=require(_0x4e97('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4e97('0x9')][_0x4e97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd51aa6,_0x2d8c26,_0x538eb5){return new BPromise(function(_0x3092aa,_0x115500){return client[_0x4e97('0xb')](_0xd51aa6,_0x538eb5)[_0x4e97('0xc')](function(_0x4f7fbf){logger['info'](_0x4e97('0xd'),_0x2d8c26,_0x4e97('0xe'));logger[_0x4e97('0xf')](_0x4e97('0x10'),_0x2d8c26,_0x4e97('0xe'),JSON[_0x4e97('0x11')](_0x4f7fbf));if(_0x4f7fbf['error']){if(_0x4f7fbf[_0x4e97('0x12')][_0x4e97('0x13')]===0x1f4){logger[_0x4e97('0x12')]('Setting,\x20%s,\x20%s',_0x2d8c26,_0x4f7fbf[_0x4e97('0x12')][_0x4e97('0x14')]);return _0x115500(_0x4f7fbf['error'][_0x4e97('0x14')]);}logger['error'](_0x4e97('0xd'),_0x2d8c26,_0x4f7fbf[_0x4e97('0x12')]['message']);return _0x3092aa(_0x4f7fbf[_0x4e97('0x12')]['message']);}else{logger['info'](_0x4e97('0xd'),_0x2d8c26,_0x4e97('0xe'));_0x3092aa(_0x4f7fbf[_0x4e97('0x15')][_0x4e97('0x14')]);}})[_0x4e97('0x16')](function(_0x1b6e52){logger[_0x4e97('0x12')](_0x4e97('0xd'),_0x2d8c26,_0x1b6e52);_0x115500(_0x1b6e52);});});} \ No newline at end of file +var _0x0b18=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Setting,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x389fb1,_0x431673){var _0x3d3520=function(_0x2dcab7){while(--_0x2dcab7){_0x389fb1['push'](_0x389fb1['shift']());}};_0x3d3520(++_0x431673);}(_0x0b18,0x122));var _0x80b1=function(_0x779496,_0x9b0b0b){_0x779496=_0x779496-0x0;var _0x472493=_0x0b18[_0x779496];return _0x472493;};'use strict';var _=require(_0x80b1('0x0'));var util=require(_0x80b1('0x1'));var moment=require(_0x80b1('0x2'));var BPromise=require(_0x80b1('0x3'));var rs=require(_0x80b1('0x4'));var fs=require('fs');var Redis=require(_0x80b1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x80b1('0x6'));var logger=require(_0x80b1('0x7'))(_0x80b1('0x8'));var config=require('../../config/environment');var jayson=require(_0x80b1('0x9'));var client=jayson['client'][_0x80b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a54c4,_0x5773a8,_0xe1a215){return new BPromise(function(_0x1cbd5a,_0x404579){return client[_0x80b1('0xb')](_0x3a54c4,_0xe1a215)[_0x80b1('0xc')](function(_0x14b85e){logger[_0x80b1('0xd')]('Setting,\x20%s,\x20%s',_0x5773a8,'request\x20sent');logger['debug'](_0x80b1('0xe'),_0x5773a8,_0x80b1('0xf'),JSON[_0x80b1('0x10')](_0x14b85e));if(_0x14b85e['error']){if(_0x14b85e[_0x80b1('0x11')]['code']===0x1f4){logger[_0x80b1('0x11')](_0x80b1('0x12'),_0x5773a8,_0x14b85e[_0x80b1('0x11')]['message']);return _0x404579(_0x14b85e[_0x80b1('0x11')][_0x80b1('0x13')]);}logger['error'](_0x80b1('0x12'),_0x5773a8,_0x14b85e['error'][_0x80b1('0x13')]);return _0x1cbd5a(_0x14b85e[_0x80b1('0x11')][_0x80b1('0x13')]);}else{logger[_0x80b1('0xd')](_0x80b1('0x12'),_0x5773a8,_0x80b1('0xf'));_0x1cbd5a(_0x14b85e['result'][_0x80b1('0x13')]);}})[_0x80b1('0x14')](function(_0x1416b1){logger['error']('Setting,\x20%s,\x20%s',_0x5773a8,_0x1416b1);_0x404579(_0x1416b1);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index def5e1a..be0ea55 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 _0x959e=['status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','/:id/interactions','getInteractions','statusGet','/:id/users','post','addDisposition','notify','addApplications','/:id/send'];(function(_0x3c5c3c,_0x13b428){var _0x2a4714=function(_0x5d5ca3){while(--_0x5d5ca3){_0x3c5c3c['push'](_0x3c5c3c['shift']());}};_0x2a4714(++_0x13b428);}(_0x959e,0x18a));var _0xe959=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x959e[_0x120376];return _0x28c529;};'use strict';var multer=require('multer');var util=require(_0xe959('0x0'));var path=require('path');var timeout=require(_0xe959('0x1'));var express=require(_0xe959('0x2'));var router=express[_0xe959('0x3')]();var auth=require(_0xe959('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe959('0x5'));var controller=require(_0xe959('0x6'));router[_0xe959('0x7')]('/',auth[_0xe959('0x8')](),controller[_0xe959('0x9')]);router[_0xe959('0x7')](_0xe959('0xa'),auth['isAuthenticated'](),controller[_0xe959('0xb')]);router['get'](_0xe959('0xc'),auth[_0xe959('0x8')](),controller['show']);router[_0xe959('0x7')](_0xe959('0xd'),auth['isAuthenticated'](),controller[_0xe959('0xe')]);router['get'](_0xe959('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xe959('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0xe959('0x7')](_0xe959('0x11'),auth[_0xe959('0x8')](),controller[_0xe959('0x12')]);router['get']('/:id/status',controller[_0xe959('0x13')]);router[_0xe959('0x7')](_0xe959('0x14'),auth[_0xe959('0x8')](),controller['getAgents']);router[_0xe959('0x15')]('/',auth[_0xe959('0x8')](),controller['create']);router[_0xe959('0x15')](_0xe959('0xd'),auth[_0xe959('0x8')](),controller[_0xe959('0x16')]);router[_0xe959('0x15')](_0xe959('0xf'),auth[_0xe959('0x8')](),controller['addAnswer']);router[_0xe959('0x15')]('/:id/notify',controller[_0xe959('0x17')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xe959('0x18')]);router[_0xe959('0x15')](_0xe959('0x19'),auth['isAuthenticated'](),controller['send']);router['post']('/:id/status',controller[_0xe959('0x1a')]);router[_0xe959('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xe959('0x1b')]);router[_0xe959('0x1c')](_0xe959('0xc'),auth['isAuthenticated'](),controller[_0xe959('0x1d')]);router[_0xe959('0x1e')](_0xe959('0xc'),auth[_0xe959('0x8')](),controller[_0xe959('0x1f')]);router[_0xe959('0x1e')](_0xe959('0xd'),auth['isAuthenticated'](),controller[_0xe959('0x20')]);router[_0xe959('0x1e')](_0xe959('0xf'),auth[_0xe959('0x8')](),controller[_0xe959('0x21')]);router[_0xe959('0x1e')](_0xe959('0x14'),auth[_0xe959('0x8')](),controller['removeAgents']);module[_0xe959('0x22')]=router; \ No newline at end of file +var _0x3423=['/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','post','create','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0xa119e4,_0x29953b){var _0x459dc0=function(_0x1450a6){while(--_0x1450a6){_0xa119e4['push'](_0xa119e4['shift']());}};_0x459dc0(++_0x29953b);}(_0x3423,0x127));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3342('0x0'));var util=require(_0x3342('0x1'));var path=require('path');var timeout=require(_0x3342('0x2'));var express=require(_0x3342('0x3'));var router=express[_0x3342('0x4')]();var auth=require(_0x3342('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3342('0x6'));var controller=require(_0x3342('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3342('0x8')]);router[_0x3342('0x9')](_0x3342('0xa'),auth[_0x3342('0xb')](),controller[_0x3342('0xc')]);router[_0x3342('0x9')](_0x3342('0xd'),auth[_0x3342('0xb')](),controller[_0x3342('0xe')]);router[_0x3342('0x9')](_0x3342('0xf'),auth['isAuthenticated'](),controller[_0x3342('0x10')]);router['get'](_0x3342('0x11'),auth[_0x3342('0xb')](),controller[_0x3342('0x12')]);router[_0x3342('0x9')](_0x3342('0x13'),auth['isAuthenticated'](),controller[_0x3342('0x14')]);router[_0x3342('0x9')]('/:id/interactions',auth[_0x3342('0xb')](),controller[_0x3342('0x15')]);router[_0x3342('0x9')](_0x3342('0x16'),controller['statusGet']);router[_0x3342('0x9')]('/:id/users',auth[_0x3342('0xb')](),controller['getAgents']);router[_0x3342('0x17')]('/',auth['isAuthenticated'](),controller[_0x3342('0x18')]);router[_0x3342('0x17')]('/:id/dispositions',auth[_0x3342('0xb')](),controller['addDisposition']);router[_0x3342('0x17')](_0x3342('0x11'),auth[_0x3342('0xb')](),controller[_0x3342('0x19')]);router['post'](_0x3342('0x1a'),controller['notify']);router[_0x3342('0x17')](_0x3342('0x13'),auth['isAuthenticated'](),controller['addApplications']);router[_0x3342('0x17')](_0x3342('0x1b'),auth[_0x3342('0xb')](),controller[_0x3342('0x1c')]);router[_0x3342('0x17')](_0x3342('0x16'),controller[_0x3342('0x1d')]);router[_0x3342('0x17')](_0x3342('0x1e'),auth[_0x3342('0xb')](),controller[_0x3342('0x1f')]);router[_0x3342('0x20')](_0x3342('0xd'),auth[_0x3342('0xb')](),controller[_0x3342('0x21')]);router[_0x3342('0x22')](_0x3342('0xd'),auth[_0x3342('0xb')](),controller['destroy']);router[_0x3342('0x22')](_0x3342('0xf'),auth[_0x3342('0xb')](),controller[_0x3342('0x23')]);router['delete'](_0x3342('0x11'),auth['isAuthenticated'](),controller[_0x3342('0x24')]);router[_0x3342('0x22')](_0x3342('0x1e'),auth[_0x3342('0xb')](),controller[_0x3342('0x25')]);module[_0x3342('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 3e6addf..f5e9de5 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 _0xe3bb=['exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','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','mandatoryDisposition','sequelize','randomstring'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xe3bb,0xbb));var _0xbe3b=function(_0x3cff3a,_0x2dcc6b){_0x3cff3a=_0x3cff3a-0x0;var _0x31d709=_0xe3bb[_0x3cff3a];return _0x31d709;};'use strict';var Sequelize=require(_0xbe3b('0x0'));var rs=require(_0xbe3b('0x1'));module[_0xbe3b('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xbe3b('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xbe3b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xbe3b('0x3')],'defaultValue':function(){return rs[_0xbe3b('0x4')]();}},'phone':{'type':Sequelize[_0xbe3b('0x3')]},'type':{'type':Sequelize[_0xbe3b('0x5')](_0xbe3b('0x6'),_0xbe3b('0x7'),_0xbe3b('0x8'),_0xbe3b('0x9'),_0xbe3b('0xa'),_0xbe3b('0xb'),_0xbe3b('0xc'),'infobip',_0xbe3b('0xd'))},'accountSid':{'type':Sequelize[_0xbe3b('0x3')]},'authId':{'type':Sequelize[_0xbe3b('0x3')]},'authToken':{'type':Sequelize[_0xbe3b('0x3')]},'smsMethod':{'type':Sequelize[_0xbe3b('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xbe3b('0x3')]},'password':{'type':Sequelize[_0xbe3b('0x3')]},'apiKey':{'type':Sequelize[_0xbe3b('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xbe3b('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xbe3b('0xf')],'defaultValue':function(){return _0xbe3b('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbe3b('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbe3b('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbe3b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbe3b('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbe3b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xbe3b('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbe3b('0x11')],'comment':_0xbe3b('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbe3b('0x13'),'set':function(_0x26106b){if(!_0x26106b)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0xbe3b('0x14'),_0x26106b);}}}; \ No newline at end of file +var _0x0fda=['infobip','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','plivo','clickatell','csc'];(function(_0xa2bc44,_0x37fc46){var _0x36437e=function(_0x43053b){while(--_0x43053b){_0xa2bc44['push'](_0xa2bc44['shift']());}};_0x36437e(++_0x37fc46);}(_0x0fda,0xb1));var _0xa0fd=function(_0xadcac8,_0x5267ab){_0xadcac8=_0xadcac8-0x0;var _0x28ced9=_0x0fda[_0xadcac8];return _0x28ced9;};'use strict';var Sequelize=require(_0xa0fd('0x0'));var rs=require('randomstring');module[_0xa0fd('0x1')]={'name':{'type':Sequelize[_0xa0fd('0x2')],'unique':_0xa0fd('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa0fd('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa0fd('0x4')]();}},'phone':{'type':Sequelize[_0xa0fd('0x2')]},'type':{'type':Sequelize['ENUM'](_0xa0fd('0x5'),_0xa0fd('0x6'),_0xa0fd('0x7'),_0xa0fd('0x8'),_0xa0fd('0x9'),_0xa0fd('0xa'),_0xa0fd('0xb'),_0xa0fd('0xc'),_0xa0fd('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xa0fd('0x2')]},'authToken':{'type':Sequelize[_0xa0fd('0x2')]},'smsMethod':{'type':Sequelize[_0xa0fd('0xe')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xa0fd('0x2')]},'senderString':{'type':Sequelize[_0xa0fd('0x2')]},'deliveryReport':{'type':Sequelize[_0xa0fd('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xa0fd('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa0fd('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa0fd('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa0fd('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa0fd('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa0fd('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa0fd('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa0fd('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa0fd('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa0fd('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa0fd('0x11')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa0fd('0xf')],'defaultValue':![],'comment':_0xa0fd('0x12'),'set':function(_0x3019c5){if(!_0x3019c5)this[_0xa0fd('0x13')](_0xa0fd('0x14'),null);this[_0xa0fd('0x13')]('mandatoryDisposition',_0x3019c5);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4b4f67d..dbb0657 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 _0x9c90=['ejs','lodash','querystring','papaparse','../../components/auth/service','ioredis','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','http','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','status','count','offset','set','Content-Range','json','apply','reject','save','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','limit','sort','where','filter','merge','type','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','length','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','order','pick','map','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','account','twilio','From','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','replyMessageId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','startRouting','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','getApplications','getInteractions','fullname','internal','tag','to\x20is\x20mandatory','List','user','out','dataValues','Messages','push','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','skebby_dispatch_id','statusInt','requestid','status_code','groupName','clickatell','redif','inspect','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','intelepeer','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x5b967e,_0x97019b){var _0x327abd=function(_0x3ba3ab){while(--_0x3ba3ab){_0x5b967e['push'](_0x5b967e['shift']());}};_0x327abd(++_0x97019b);}(_0x9c90,0xd1));var _0x09c9=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x9c90[_0x2cc594];return _0x4abff7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x09c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x09c9('0x1'));var jsonpatch=require(_0x09c9('0x2'));var rp=require(_0x09c9('0x3'));var moment=require(_0x09c9('0x4'));var BPromise=require(_0x09c9('0x5'));var Mustache=require(_0x09c9('0x6'));var util=require(_0x09c9('0x7'));var path=require(_0x09c9('0x8'));var sox=require(_0x09c9('0x9'));var csv=require(_0x09c9('0xa'));var ejs=require(_0x09c9('0xb'));var fs=require('fs');var _=require(_0x09c9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x09c9('0xa'));var querystring=require(_0x09c9('0xd'));var Papa=require(_0x09c9('0xe'));var authService=require(_0x09c9('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x09c9('0x10'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x09c9('0x11'));var config=require(_0x09c9('0x12'));var db=require(_0x09c9('0x13'))['db'];config[_0x09c9('0x14')]=_[_0x09c9('0x15')](config['redis'],{'host':_0x09c9('0x16'),'port':0x18eb});var socket=require(_0x09c9('0x17'))(new Redis(config[_0x09c9('0x14')]));require(_0x09c9('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x09c9('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x2dabbc,_0x4143bc,_0x28916e,_0xfff3a6){return new BPromise(function(_0x814bb6,_0x94fce5){var _0x1be490=_0xfff3a6||client;return _0x1be490[_0x09c9('0x1a')](_0x2dabbc,_0x28916e)[_0x09c9('0x1b')](function(_0x45f29e){logger['info']('SmsAccount,\x20%s,\x20%s',_0x4143bc,_0x09c9('0x1c'));logger[_0x09c9('0x1d')](_0x09c9('0x1e'),_0x4143bc,_0x09c9('0x1c'),JSON[_0x09c9('0x1f')](_0x45f29e));if(_0x45f29e[_0x09c9('0x20')]){if(_0x45f29e[_0x09c9('0x20')][_0x09c9('0x21')]===0x1f4){logger[_0x09c9('0x20')](_0x09c9('0x22'),_0x4143bc,_0x45f29e['error'][_0x09c9('0x23')]);return _0x94fce5(_0x45f29e[_0x09c9('0x20')][_0x09c9('0x23')]);}logger[_0x09c9('0x20')](_0x09c9('0x22'),_0x4143bc,_0x45f29e[_0x09c9('0x20')]['message']);return _0x814bb6(_0x45f29e[_0x09c9('0x20')][_0x09c9('0x23')]);}else{logger['info'](_0x09c9('0x22'),_0x4143bc,_0x09c9('0x1c'));_0x814bb6(_0x45f29e[_0x09c9('0x24')]['message']);}})['catch'](function(_0x2d74d9){logger[_0x09c9('0x20')]('SmsAccount,\x20%s,\x20%s',_0x4143bc,_0x2d74d9);_0x94fce5(_0x2d74d9);});});}function respondWithStatusCode(_0x14df67,_0x2811a5){_0x2811a5=_0x2811a5||0xcc;return function(_0x1d31a4){if(_0x1d31a4){return _0x14df67['sendStatus'](_0x2811a5);}return _0x14df67[_0x09c9('0x25')](_0x2811a5)['end']();};}function respondWithResult(_0x1c9c5a,_0x6489fa){_0x6489fa=_0x6489fa||0xc8;return function(_0x5cd0b4){if(_0x5cd0b4){return _0x1c9c5a[_0x09c9('0x25')](_0x6489fa)['json'](_0x5cd0b4);}};}function respondWithFilteredResult(_0x53782c,_0x4f51b8){return function(_0x21db63){if(_0x21db63){var _0x45bf1c=_0x21db63[_0x09c9('0x26')],_0x8a9b12=_0x4f51b8['offset'],_0x1f79e6=_0x4f51b8[_0x09c9('0x27')]+_0x4f51b8['limit'],_0x531771;if(_0x1f79e6>=_0x45bf1c){_0x1f79e6=_0x45bf1c;_0x531771=0xc8;}else{_0x531771=0xce;}_0x53782c[_0x09c9('0x25')](_0x531771);return _0x53782c[_0x09c9('0x28')](_0x09c9('0x29'),_0x8a9b12+'-'+_0x1f79e6+'/'+_0x45bf1c)[_0x09c9('0x2a')](_0x21db63);}return null;};}function patchUpdates(_0x131846){return function(_0x253869){try{jsonpatch[_0x09c9('0x2b')](_0x253869,_0x131846,!![]);}catch(_0x1d3c75){return BPromise[_0x09c9('0x2c')](_0x1d3c75);}return _0x253869[_0x09c9('0x2d')]();};}function saveUpdates(_0xc79473,_0x1a6de6){return function(_0x337991){if(_0x337991){return _0x337991['update'](_0xc79473)[_0x09c9('0x1b')](function(_0x2a0ce8){return _0x2a0ce8;});}return null;};}function removeEntity(_0x1b9657,_0x2db4b5){return function(_0x4db780){if(_0x4db780){return _0x4db780[_0x09c9('0x2e')]()['then'](function(){var _0x4ceaa4=_0x4db780[_0x09c9('0x2f')]({'plain':!![]});var _0x258495=_0x09c9('0x30');return db[_0x09c9('0x31')]['destroy']({'where':{'type':_0x258495,'resourceId':_0x4ceaa4['id']}})['then'](function(){return _0x4db780;});})['then'](function(){_0x1b9657[_0x09c9('0x25')](0xcc)[_0x09c9('0x32')]();});}};}function handleEntityNotFound(_0x4b6d70,_0x452a7b){return function(_0x5db970){if(!_0x5db970){_0x4b6d70['sendStatus'](0x194);}return _0x5db970;};}function handleError(_0x2499e5,_0x18fb30){_0x18fb30=_0x18fb30||0x1f4;return function(_0x321790){logger['error'](_0x321790[_0x09c9('0x33')]);if(_0x321790[_0x09c9('0x34')]){delete _0x321790[_0x09c9('0x34')];}_0x2499e5[_0x09c9('0x25')](_0x18fb30)[_0x09c9('0x35')](_0x321790);};}exports[_0x09c9('0x36')]=function(_0x393e79,_0x4f2975){var _0x39def5={'include':[{'model':db[_0x09c9('0x37')],'as':_0x09c9('0x38')}]},_0x2d545e={},_0x1db48c={'count':0x0,'rows':[]};var _0x1dc9b6=db[_0x09c9('0x39')][_0x09c9('0x3a')];_0x2d545e['model']=_['keys'](_0x1dc9b6);_0x2d545e[_0x09c9('0x3b')]=_[_0x09c9('0x3c')](_0x393e79[_0x09c9('0x3b')]);_0x2d545e[_0x09c9('0x3d')]=_[_0x09c9('0x3e')](_0x2d545e['model'],_0x2d545e[_0x09c9('0x3b')]);_0x39def5['attributes']=_[_0x09c9('0x3e')](_0x2d545e['model'],qs[_0x09c9('0x3f')](_0x393e79[_0x09c9('0x3b')][_0x09c9('0x3f')]));_0x39def5['attributes']=_0x39def5[_0x09c9('0x40')]['length']?_0x39def5[_0x09c9('0x40')]:_0x2d545e[_0x09c9('0x41')];if(!_0x393e79['query'][_0x09c9('0x42')]('nolimit')){_0x39def5[_0x09c9('0x43')]=qs[_0x09c9('0x43')](_0x393e79[_0x09c9('0x3b')]['limit']);_0x39def5[_0x09c9('0x27')]=qs[_0x09c9('0x27')](_0x393e79[_0x09c9('0x3b')][_0x09c9('0x27')]);}_0x39def5['order']=qs[_0x09c9('0x44')](_0x393e79[_0x09c9('0x3b')][_0x09c9('0x44')]);_0x39def5[_0x09c9('0x45')]=qs[_0x09c9('0x3d')](_['pick'](_0x393e79[_0x09c9('0x3b')],_0x2d545e[_0x09c9('0x3d')]));if(_0x393e79[_0x09c9('0x3b')][_0x09c9('0x46')]){_0x39def5['where']=_[_0x09c9('0x47')](_0x39def5[_0x09c9('0x45')],{'$or':_['map'](_0x1dc9b6,function(_0x296ff6){if(_0x296ff6[_0x09c9('0x48')]['key']!==_0x09c9('0x49')){var _0x213d2c={};_0x213d2c[_0x296ff6[_0x09c9('0x4a')]]={'$like':'%'+_0x393e79[_0x09c9('0x3b')][_0x09c9('0x46')]+'%'};return _0x213d2c;}})});}_0x39def5=_['merge']({},_0x39def5,_0x393e79[_0x09c9('0x4b')]);var _0x35dfe8={'where':_0x39def5[_0x09c9('0x45')]};return db[_0x09c9('0x39')]['count'](_0x35dfe8)[_0x09c9('0x1b')](function(_0x36ef03){_0x1db48c[_0x09c9('0x26')]=_0x36ef03;if(_0x393e79[_0x09c9('0x3b')][_0x09c9('0x4c')]){_0x39def5[_0x09c9('0x4d')]=[{'all':!![]}];}return db['SmsAccount'][_0x09c9('0x4e')](_0x39def5);})['then'](function(_0x2f58c7){_0x1db48c[_0x09c9('0x4f')]=_0x2f58c7;return _0x1db48c;})[_0x09c9('0x1b')](respondWithFilteredResult(_0x4f2975,_0x39def5))['catch'](handleError(_0x4f2975,null));};exports[_0x09c9('0x50')]=function(_0x3a80fe,_0x37129a){var _0x28dbdd={'raw':![],'where':{'id':_0x3a80fe[_0x09c9('0x51')]['id']},'include':[{'model':db[_0x09c9('0x37')],'as':_0x09c9('0x38')}]},_0x55575f={};_0x55575f[_0x09c9('0x41')]=_[_0x09c9('0x3c')](db[_0x09c9('0x39')][_0x09c9('0x3a')]);_0x55575f[_0x09c9('0x3b')]=_[_0x09c9('0x3c')](_0x3a80fe[_0x09c9('0x3b')]);_0x55575f[_0x09c9('0x3d')]=_[_0x09c9('0x3e')](_0x55575f[_0x09c9('0x41')],_0x55575f[_0x09c9('0x3b')]);_0x28dbdd['attributes']=_[_0x09c9('0x3e')](_0x55575f[_0x09c9('0x41')],qs[_0x09c9('0x3f')](_0x3a80fe[_0x09c9('0x3b')][_0x09c9('0x3f')]));_0x28dbdd[_0x09c9('0x40')]=_0x28dbdd[_0x09c9('0x40')][_0x09c9('0x52')]?_0x28dbdd['attributes']:_0x55575f[_0x09c9('0x41')];if(_0x3a80fe[_0x09c9('0x3b')][_0x09c9('0x4c')]){_0x28dbdd['include']=[{'all':!![]}];}_0x28dbdd=_[_0x09c9('0x47')]({},_0x28dbdd,_0x3a80fe[_0x09c9('0x4b')]);return db[_0x09c9('0x39')][_0x09c9('0x53')](_0x28dbdd)[_0x09c9('0x1b')](handleEntityNotFound(_0x37129a,null))['then'](respondWithResult(_0x37129a,null))['catch'](handleError(_0x37129a,null));};exports['create']=function(_0x19aa3f,_0x105f88){return db[_0x09c9('0x39')]['create'](_0x19aa3f[_0x09c9('0x54')],{})['then'](function(_0x9a1847){var _0x36575d=_0x19aa3f['user'][_0x09c9('0x2f')]({'plain':!![]});if(!_0x36575d)throw new Error(_0x09c9('0x55'));if(_0x36575d['role']==='user'){var _0x3374a9=_0x9a1847[_0x09c9('0x2f')]({'plain':!![]});var _0x665892='SmsAccounts';return db[_0x09c9('0x56')][_0x09c9('0x53')]({'where':{'name':_0x665892,'userProfileId':_0x36575d[_0x09c9('0x57')]},'raw':!![]})[_0x09c9('0x1b')](function(_0x49fbd2){if(_0x49fbd2&&_0x49fbd2[_0x09c9('0x58')]===0x0){return db['UserProfileResource'][_0x09c9('0x59')]({'name':_0x3374a9[_0x09c9('0x34')],'resourceId':_0x3374a9['id'],'type':_0x49fbd2['name'],'sectionId':_0x49fbd2['id']},{})[_0x09c9('0x1b')](function(){return _0x9a1847;});}else{return _0x9a1847;}})['catch'](function(_0xe7aefd){logger[_0x09c9('0x20')](_0x09c9('0x5a'),_0xe7aefd);throw _0xe7aefd;});}return _0x9a1847;})[_0x09c9('0x1b')](respondWithResult(_0x105f88,0xc9))[_0x09c9('0x5b')](handleError(_0x105f88,null));};exports[_0x09c9('0x5c')]=function(_0x501d59,_0x38741f){if(_0x501d59['body']['id']){delete _0x501d59[_0x09c9('0x54')]['id'];}return db[_0x09c9('0x39')][_0x09c9('0x53')]({'where':{'id':_0x501d59['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x38741f,null))['then'](saveUpdates(_0x501d59[_0x09c9('0x54')],null))[_0x09c9('0x1b')](respondWithResult(_0x38741f,null))[_0x09c9('0x5b')](handleError(_0x38741f,null));};exports[_0x09c9('0x2e')]=function(_0x2c7c49,_0x31f17e){return db['SmsAccount'][_0x09c9('0x53')]({'where':{'id':_0x2c7c49[_0x09c9('0x51')]['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0x31f17e,null))[_0x09c9('0x1b')](removeEntity(_0x31f17e,null))[_0x09c9('0x5b')](handleError(_0x31f17e,null));};exports['describe']=function(_0x1c23b0,_0x4213b8){return db[_0x09c9('0x39')][_0x09c9('0x5d')]()[_0x09c9('0x1b')](respondWithResult(_0x4213b8,null))[_0x09c9('0x5b')](handleError(_0x4213b8,null));};exports[_0x09c9('0x5e')]=function(_0x4df8d9,_0xabfecf,_0xbb9d27){if(_0x4df8d9[_0x09c9('0x54')]['id']){delete _0x4df8d9[_0x09c9('0x54')]['id'];}return db[_0x09c9('0x39')][_0x09c9('0x53')]({'where':{'id':_0x4df8d9[_0x09c9('0x51')]['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0xabfecf,null))[_0x09c9('0x1b')](function(_0x2d400e){if(_0x2d400e){_0x4df8d9[_0x09c9('0x54')][_0x09c9('0x5f')]=_0x2d400e['id'];return db[_0x09c9('0x60')][_0x09c9('0x59')](_0x4df8d9[_0x09c9('0x54')]);}})[_0x09c9('0x1b')](respondWithResult(_0xabfecf,null))[_0x09c9('0x5b')](handleError(_0xabfecf,null));};exports[_0x09c9('0x61')]=function(_0x6ec6ff,_0xe2e53f,_0xc5619f){var _0x3d059e={'raw':![],'where':{}};var _0x5d70f3={};var _0x3f9036={'count':0x0,'rows':[]};return db['SmsAccount'][_0x09c9('0x62')]({'where':{'id':_0x6ec6ff['params']['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0xe2e53f,null))[_0x09c9('0x1b')](function(_0x390d3d){if(_0x390d3d){_0x5d70f3['model']=_[_0x09c9('0x3c')](db['Disposition'][_0x09c9('0x3a')]);_0x5d70f3['query']=_[_0x09c9('0x3c')](_0x6ec6ff['query']);_0x5d70f3[_0x09c9('0x3d')]=_[_0x09c9('0x3e')](_0x5d70f3[_0x09c9('0x41')],_0x5d70f3[_0x09c9('0x3b')]);_0x3d059e[_0x09c9('0x40')]=_['intersection'](_0x5d70f3[_0x09c9('0x41')],qs[_0x09c9('0x3f')](_0x6ec6ff[_0x09c9('0x3b')][_0x09c9('0x3f')]));_0x3d059e[_0x09c9('0x40')]=_0x3d059e[_0x09c9('0x40')][_0x09c9('0x52')]?_0x3d059e[_0x09c9('0x40')]:_0x5d70f3[_0x09c9('0x41')];if(!_0x6ec6ff[_0x09c9('0x3b')][_0x09c9('0x42')](_0x09c9('0x63'))){_0x3d059e[_0x09c9('0x43')]=qs['limit'](_0x6ec6ff['query'][_0x09c9('0x43')]);_0x3d059e[_0x09c9('0x27')]=qs['offset'](_0x6ec6ff[_0x09c9('0x3b')]['offset']);}_0x3d059e[_0x09c9('0x64')]=qs[_0x09c9('0x44')](_0x6ec6ff[_0x09c9('0x3b')][_0x09c9('0x44')]);_0x3d059e['where']=qs[_0x09c9('0x3d')](_[_0x09c9('0x65')](_0x6ec6ff[_0x09c9('0x3b')],_0x5d70f3[_0x09c9('0x3d')]));_0x3d059e[_0x09c9('0x45')][_0x09c9('0x5f')]=_0x390d3d['id'];if(_0x6ec6ff[_0x09c9('0x3b')][_0x09c9('0x46')]){_0x3d059e['where']=_[_0x09c9('0x47')](_0x3d059e[_0x09c9('0x45')],{'$or':_[_0x09c9('0x66')](_0x3d059e[_0x09c9('0x40')],function(_0x1a06d0){var _0x141f75={};_0x141f75[_0x1a06d0]={'$like':'%'+_0x6ec6ff[_0x09c9('0x3b')][_0x09c9('0x46')]+'%'};return _0x141f75;})});}_0x3d059e=_[_0x09c9('0x47')]({},_0x3d059e,_0x6ec6ff[_0x09c9('0x4b')]);return db[_0x09c9('0x60')][_0x09c9('0x26')]({'where':_0x3d059e[_0x09c9('0x45')]})[_0x09c9('0x1b')](function(_0x25da88){_0x3f9036[_0x09c9('0x26')]=_0x25da88;if(_0x6ec6ff[_0x09c9('0x3b')][_0x09c9('0x4c')]){_0x3d059e['include']=[{'all':!![]}];}return db['Disposition'][_0x09c9('0x4e')](_0x3d059e);})[_0x09c9('0x1b')](function(_0x41845f){_0x3f9036[_0x09c9('0x4f')]=_0x41845f;return _0x3f9036;});}})[_0x09c9('0x1b')](respondWithFilteredResult(_0xe2e53f,_0x3d059e))[_0x09c9('0x5b')](handleError(_0xe2e53f,null));};exports[_0x09c9('0x67')]=function(_0x469720,_0x4197bd,_0x1be045){var _0x38ccab;return db[_0x09c9('0x39')][_0x09c9('0x53')]({'where':{'id':_0x469720['params']['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0x4197bd,null))[_0x09c9('0x1b')](function(_0x148fb7){if(_0x148fb7){return _0x148fb7[_0x09c9('0x67')](_0x469720[_0x09c9('0x3b')][_0x09c9('0x68')]);}})['then'](respondWithStatusCode(_0x4197bd,null))[_0x09c9('0x5b')](handleError(_0x4197bd,null));};exports[_0x09c9('0x69')]=function(_0x494443,_0x5858d0,_0x41714f){if(_0x494443['body']['id']){delete _0x494443['body']['id'];}return db[_0x09c9('0x39')][_0x09c9('0x53')]({'where':{'id':_0x494443['params']['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0x5858d0,null))[_0x09c9('0x1b')](function(_0x36b976){if(_0x36b976){_0x494443[_0x09c9('0x54')][_0x09c9('0x5f')]=_0x36b976['id'];return db['CannedAnswer']['create'](_0x494443[_0x09c9('0x54')]);}})[_0x09c9('0x1b')](respondWithResult(_0x5858d0,null))[_0x09c9('0x5b')](handleError(_0x5858d0,null));};exports[_0x09c9('0x6a')]=function(_0xbb6173,_0x1def14,_0x19a266){var _0x1f40fb={'raw':![],'where':{}};var _0x5350f0={};var _0x410973={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0xbb6173['params']['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0x1def14,null))[_0x09c9('0x1b')](function(_0x4a0459){if(_0x4a0459){_0x5350f0[_0x09c9('0x41')]=_[_0x09c9('0x3c')](db[_0x09c9('0x6b')][_0x09c9('0x3a')]);_0x5350f0[_0x09c9('0x3b')]=_[_0x09c9('0x3c')](_0xbb6173[_0x09c9('0x3b')]);_0x5350f0[_0x09c9('0x3d')]=_['intersection'](_0x5350f0[_0x09c9('0x41')],_0x5350f0[_0x09c9('0x3b')]);_0x1f40fb[_0x09c9('0x40')]=_['intersection'](_0x5350f0['model'],qs[_0x09c9('0x3f')](_0xbb6173['query'][_0x09c9('0x3f')]));_0x1f40fb[_0x09c9('0x40')]=_0x1f40fb[_0x09c9('0x40')][_0x09c9('0x52')]?_0x1f40fb[_0x09c9('0x40')]:_0x5350f0[_0x09c9('0x41')];if(!_0xbb6173[_0x09c9('0x3b')][_0x09c9('0x42')](_0x09c9('0x63'))){_0x1f40fb[_0x09c9('0x43')]=qs[_0x09c9('0x43')](_0xbb6173['query'][_0x09c9('0x43')]);_0x1f40fb[_0x09c9('0x27')]=qs[_0x09c9('0x27')](_0xbb6173[_0x09c9('0x3b')][_0x09c9('0x27')]);}_0x1f40fb['order']=qs[_0x09c9('0x44')](_0xbb6173['query']['sort']);_0x1f40fb[_0x09c9('0x45')]=qs[_0x09c9('0x3d')](_[_0x09c9('0x65')](_0xbb6173[_0x09c9('0x3b')],_0x5350f0['filters']));_0x1f40fb[_0x09c9('0x45')][_0x09c9('0x5f')]=_0x4a0459['id'];if(_0xbb6173[_0x09c9('0x3b')][_0x09c9('0x46')]){_0x1f40fb[_0x09c9('0x45')]=_['merge'](_0x1f40fb[_0x09c9('0x45')],{'$or':_[_0x09c9('0x66')](_0x1f40fb[_0x09c9('0x40')],function(_0x26aa74){var _0x2caeff={};_0x2caeff[_0x26aa74]={'$like':'%'+_0xbb6173[_0x09c9('0x3b')][_0x09c9('0x46')]+'%'};return _0x2caeff;})});}_0x1f40fb=_[_0x09c9('0x47')]({},_0x1f40fb,_0xbb6173['options']);return db[_0x09c9('0x6b')][_0x09c9('0x26')]({'where':_0x1f40fb['where']})[_0x09c9('0x1b')](function(_0x569fab){_0x410973[_0x09c9('0x26')]=_0x569fab;if(_0xbb6173[_0x09c9('0x3b')][_0x09c9('0x4c')]){_0x1f40fb['include']=[{'all':!![]}];}return db[_0x09c9('0x6b')][_0x09c9('0x4e')](_0x1f40fb);})[_0x09c9('0x1b')](function(_0x4360c2){_0x410973['rows']=_0x4360c2;return _0x410973;});}})['then'](respondWithFilteredResult(_0x1def14,_0x1f40fb))[_0x09c9('0x5b')](handleError(_0x1def14,null));};exports[_0x09c9('0x6c')]=function(_0x5941df,_0x53690e,_0x362963){var _0x480b67;return db[_0x09c9('0x39')]['find']({'where':{'id':_0x5941df[_0x09c9('0x51')]['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0x53690e,null))['then'](function(_0x42cf00){if(_0x42cf00){return _0x42cf00['removeAnswers'](_0x5941df[_0x09c9('0x3b')][_0x09c9('0x68')]);}})['then'](respondWithStatusCode(_0x53690e,null))[_0x09c9('0x5b')](handleError(_0x53690e,null));};exports[_0x09c9('0x6d')]=function(_0x4d7b15,_0x110edf,_0x5f5b46){var _0x3c4b7e={'channel':_0x09c9('0x6e')};var _0x5ad1d3=[];var _0x4bf632=[];var _0x1f8b58={};return db[_0x09c9('0x39')][_0x09c9('0x53')]({'where':{'id':_0x4d7b15[_0x09c9('0x51')]['id']},'include':[{'model':db[_0x09c9('0x6f')],'as':_0x09c9('0x70')}]})[_0x09c9('0x1b')](handleEntityNotFound(_0x110edf,null))['then'](function(_0x46a151){_0x3c4b7e['account']=_0x46a151;_0x3c4b7e[_0x09c9('0x71')]=_[_0x09c9('0x72')](_0x46a151[_0x09c9('0x70')],[_0x09c9('0x73')],[_0x09c9('0x74')]);if(_0x3c4b7e['account'][_0x09c9('0x70')]){delete _0x3c4b7e['account'][_0x09c9('0x70')];}return db[_0x09c9('0x75')][_0x09c9('0x5d')]();})[_0x09c9('0x1b')](function(_0xf5a335){if(!_0xf5a335){throw new db['Sequelize'][(_0x09c9('0x76'))](_0x09c9('0x77'));}_0x5ad1d3=_[_0x09c9('0x78')](_[_0x09c9('0x3c')](_0xf5a335),['createdAt',_0x09c9('0x79')]);_0x4bf632=_[_0x09c9('0x78')](_[_0x09c9('0x3c')](_0xf5a335),[_0x09c9('0x7a'),_0x09c9('0x79'),_0x09c9('0x7b'),_0x09c9('0x7c')]);_0x3c4b7e[_0x09c9('0x54')]={'mapKey':_0x09c9('0x7d')};if(_0x3c4b7e[_0x09c9('0x7e')][_0x09c9('0x48')]){switch(_0x3c4b7e['account'][_0x09c9('0x48')]){case _0x09c9('0x7f'):_0x3c4b7e[_0x09c9('0x54')]['from']=_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x80')];_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x54')]=_0x4d7b15[_0x09c9('0x54')]['Body'];_0x3c4b7e['body'][_0x09c9('0x81')]=_0x4d7b15['body'][_0x09c9('0x82')];break;case _0x09c9('0x83'):_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x84')]='+'+_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x85')];_0x3c4b7e[_0x09c9('0x54')]['body']=_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x86')];break;case _0x09c9('0x87'):_0x3c4b7e['body']['from']=_0x4d7b15['body']['from'];_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x54')]=_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x23')];break;case _0x09c9('0x88'):_0x3c4b7e['body'][_0x09c9('0x84')]=_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x84')];_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x54')]=_0x4d7b15['body']['body'];_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x81')]=_0x4d7b15['body'][_0x09c9('0x89')];break;case _0x09c9('0x8a'):_0x3c4b7e['body'][_0x09c9('0x84')]=_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x80')];_0x3c4b7e['body'][_0x09c9('0x54')]=_0x4d7b15['body'][_0x09c9('0x8b')];_0x3c4b7e[_0x09c9('0x54')]['messageId']=_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x8c')];break;case _0x09c9('0x8d'):_0x3c4b7e['body']['from']='+'+_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x8e')][0x0]['from'];_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x54')]=_0x4d7b15[_0x09c9('0x54')]['results'][0x0][_0x09c9('0x86')];_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x81')]=_0x4d7b15[_0x09c9('0x54')]['results'][0x0][_0x09c9('0x81')];break;case _0x09c9('0x8f'):_0x3c4b7e[_0x09c9('0x54')]['from']=_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x90')];_0x3c4b7e[_0x09c9('0x54')]['body']=_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x91')][_0x09c9('0x23')];break;case'clickatell':_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x84')]=_0x4d7b15[_0x09c9('0x54')]['fromNumber'];_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x54')]=_0x4d7b15[_0x09c9('0x54')]['text'];_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x81')]=_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x92')];break;case'intelepeer':_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x84')]=_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x84')];_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x54')]=_0x4d7b15[_0x09c9('0x54')][_0x09c9('0x23')];_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x81')]=_0x4d7b15[_0x09c9('0x54')]['refid'];break;}}if(_0x3c4b7e[_0x09c9('0x54')]['id']){delete _0x3c4b7e[_0x09c9('0x54')]['id'];}if(_[_0x09c9('0x93')](_0x3c4b7e['body'][_0x09c9('0x84')])){throw new db[(_0x09c9('0x94'))][(_0x09c9('0x76'))](_0x09c9('0x95'));}if(_['isNil'](_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x54')])||_0x3c4b7e['body'][_0x09c9('0x54')]===''){throw new db[(_0x09c9('0x94'))][(_0x09c9('0x76'))](_0x09c9('0x96'));}if(_[_0x09c9('0x93')](_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x97')])){throw new db[(_0x09c9('0x94'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4bf632);}if(!_['includes'](_0x4bf632,_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x97')])){throw new db[(_0x09c9('0x94'))]['ValidationError'](_0x09c9('0x98')+_0x4bf632);}_0x1f8b58[_0x3c4b7e[_0x09c9('0x54')]['mapKey']]=_0x3c4b7e['body'][_0x09c9('0x84')];return db[_0x09c9('0x99')][_0x09c9('0x53')]({'where':{'id':_0x3c4b7e[_0x09c9('0x7e')][_0x09c9('0x7c')]},'include':[{'model':db[_0x09c9('0x75')],'as':_0x09c9('0x9a'),'where':_0x1f8b58,'limit':0x1,'order':[[_0x09c9('0x79'),_0x09c9('0x9b')]]}]});})[_0x09c9('0x1b')](handleEntityNotFound(_0x110edf,null))[_0x09c9('0x1b')](function(_0x5a16ca){if(_0x5a16ca){_0x3c4b7e['list']=_[_0x09c9('0x9c')](_0x5a16ca,[_0x09c9('0x9a')]);if(_0x5a16ca[_0x09c9('0x9a')][_0x09c9('0x52')]){return _0x5a16ca[_0x09c9('0x9a')][0x0];}var _0x4f6af9=_[_0x09c9('0x15')](_0x3c4b7e[_0x09c9('0x54')],{'firstName':_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x84')],'ListId':_0x5a16ca['id']});_0x4f6af9[_0x3c4b7e[_0x09c9('0x54')]['mapKey']]=_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x84')];return db[_0x09c9('0x75')][_0x09c9('0x59')](_0x4f6af9,{'fields':_0x5ad1d3,'raw':!![]});}})[_0x09c9('0x1b')](handleEntityNotFound(_0x110edf,null))[_0x09c9('0x1b')](function(_0x1f4a80){if(_0x1f4a80){_0x3c4b7e[_0x09c9('0x9d')]=_0x1f4a80;var _0x119105={'ContactId':_0x1f4a80['id'],'phone':_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x84')],'SmsAccountId':_0x4d7b15[_0x09c9('0x51')]['id']};var _0x36f92f={'ContactId':_0x1f4a80['id'],'SmsAccountId':_0x4d7b15[_0x09c9('0x51')]['id'],'closed':![]};return db['SmsInteraction'][_0x09c9('0x53')]({'where':_0x36f92f})[_0x09c9('0x1b')](function(_0x51a1d2){if(_0x51a1d2){return[_0x51a1d2,![]];}return db[_0x09c9('0x9e')][_0x09c9('0x59')](_0x119105)[_0x09c9('0x1b')](function(_0x547e87){return[_0x547e87,!![]];});});}})[_0x09c9('0x9f')](function(_0xb3aa6c,_0x575610){_0x3c4b7e['interaction']=_0xb3aa6c[_0x09c9('0x2f')]({'plain':!![]});_0x3c4b7e[_0x09c9('0xa0')][_0x09c9('0xa1')]=![];if(_0x575610){if(_0x3c4b7e[_0x09c9('0x7e')][_0x09c9('0xa2')]){_0x3c4b7e[_0x09c9('0x71')]['push']({'id':0x0,'priority':_0x3c4b7e[_0x09c9('0x71')][_0x09c9('0x52')]+0x1,'app':_0x09c9('0xa3'),'appdata':'unmanaged','interval':_0x09c9('0xa4')});}_0x3c4b7e['interaction'][_0x09c9('0xa1')]=!![];}return db[_0x09c9('0xa5')][_0x09c9('0x59')]({'phone':_0x3c4b7e[_0x09c9('0x54')]['from'],'messageId':_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x81')],'body':_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0x54')],'SmsAccountId':_0x4d7b15[_0x09c9('0x51')]['id'],'SmsInteractionId':_0xb3aa6c['id'],'direction':'in','ContactId':_0xb3aa6c[_0x09c9('0xa6')],'AttachmentId':_0x3c4b7e[_0x09c9('0x54')][_0x09c9('0xa7')]});})[_0x09c9('0x1b')](function(_0x15fd8b){_0x3c4b7e['message']=_0x15fd8b;if(_0x3c4b7e['interaction'][_0x09c9('0xa8')]){return db[_0x09c9('0xa9')]['find']({'attributes':['id',_0x09c9('0x34')],'where':{'id':_0x3c4b7e['interaction'][_0x09c9('0xa8')]}})['then'](function(_0x280f42){if(_0x280f42){_0x3c4b7e['applications'][_0x09c9('0xaa')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x280f42['name']+','+(_0x3c4b7e[_0x09c9('0x7e')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x09c9('0xab'),_0x3c4b7e);});}return respondWithRpcPromise(_0x09c9('0xac'),_0x09c9('0xab'),_0x3c4b7e);})[_0x09c9('0x1b')](function(_0x224804){if(_0x224804){var _0x4261e5=0xc8;var _0x4d645a=_0x09c9('0xad');logger['info'](_0x09c9('0x1e'),_0x4d645a,_0x4261e5,_0x09c9('0xae'));logger['debug'](_0x09c9('0xaf'),_0x4d645a,_0x4261e5,'entity\x20found',JSON[_0x09c9('0x1f')](_0x224804));if(_0x3c4b7e[_0x09c9('0x7e')][_0x09c9('0x48')]===_0x09c9('0x7f')){return _0x110edf[_0x09c9('0x25')](_0x4261e5)[_0x09c9('0x28')](_0x09c9('0xb0'),_0x09c9('0xb1'))['send'](_0x09c9('0xb2'));}else{return _0x110edf['status'](_0x4261e5)['json'](_0x224804);}}})[_0x09c9('0x5b')](handleError(_0x110edf,null));};exports[_0x09c9('0xb3')]=function(_0x4e9b87,_0x30ef54,_0x2798ad){return db['SmsAccount'][_0x09c9('0x62')]({'where':{'id':_0x4e9b87[_0x09c9('0x51')]['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0x30ef54,null))[_0x09c9('0x1b')](function(_0xf6efb6){if(_0xf6efb6){return db[_0x09c9('0xb4')][_0x09c9('0xb5')](function(_0x1c7ce6){return db[_0x09c9('0x6f')][_0x09c9('0x2e')]({'where':{'SmsAccountId':_0x4e9b87[_0x09c9('0x51')]['id']},'transaction':_0x1c7ce6})[_0x09c9('0x1b')](function(_0x3b0622){var _0x567e6a=_[_0x09c9('0x66')](_0x4e9b87['body'],function(_0x1b56d2){_0x1b56d2[_0x09c9('0x5f')]=_0x4e9b87[_0x09c9('0x51')]['id'];return _0x1b56d2;});return db[_0x09c9('0x6f')]['bulkCreate'](_0x567e6a,{'transaction':_0x1c7ce6});});})[_0x09c9('0x1b')](function(){return db[_0x09c9('0x6f')]['findAndCountAll']({'where':{'SmsAccountId':_0x4e9b87[_0x09c9('0x51')]['id']},'order':_0x09c9('0x73')});});}})[_0x09c9('0x1b')](respondWithResult(_0x30ef54,null))[_0x09c9('0x5b')](handleError(_0x30ef54,null));};exports['getApplications']=function(_0x217ae9,_0x55f414,_0x4eaf72){var _0x308479={};var _0x467911={};var _0x57bedc;var _0x752718;return db[_0x09c9('0x39')][_0x09c9('0x62')]({'where':{'id':_0x217ae9[_0x09c9('0x51')]['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0x55f414,null))['then'](function(_0x58a8ee){if(_0x58a8ee){_0x57bedc=_0x58a8ee;_0x467911[_0x09c9('0x41')]=_[_0x09c9('0x3c')](db[_0x09c9('0x6f')]['rawAttributes']);_0x467911[_0x09c9('0x3b')]=_[_0x09c9('0x3c')](_0x217ae9[_0x09c9('0x3b')]);_0x467911['filters']=_[_0x09c9('0x3e')](_0x467911[_0x09c9('0x41')],_0x467911[_0x09c9('0x3b')]);_0x308479[_0x09c9('0x40')]=_[_0x09c9('0x3e')](_0x467911[_0x09c9('0x41')],qs[_0x09c9('0x3f')](_0x217ae9[_0x09c9('0x3b')][_0x09c9('0x3f')]));_0x308479[_0x09c9('0x40')]=_0x308479['attributes'][_0x09c9('0x52')]?_0x308479[_0x09c9('0x40')]:_0x467911['model'];_0x308479[_0x09c9('0x64')]=qs[_0x09c9('0x44')](_0x217ae9[_0x09c9('0x3b')][_0x09c9('0x44')]);_0x308479[_0x09c9('0x45')]=qs[_0x09c9('0x3d')](_['pick'](_0x217ae9[_0x09c9('0x3b')],_0x467911[_0x09c9('0x3d')]));if(_0x217ae9[_0x09c9('0x3b')][_0x09c9('0x46')]){_0x308479[_0x09c9('0x45')]=_[_0x09c9('0x47')](_0x308479[_0x09c9('0x45')],{'$or':_[_0x09c9('0x66')](_0x308479[_0x09c9('0x40')],function(_0x424c93){var _0x1f47ae={};_0x1f47ae[_0x424c93]={'$like':'%'+_0x217ae9['query']['filter']+'%'};return _0x1f47ae;})});}_0x308479=_[_0x09c9('0x47')]({},_0x308479,_0x217ae9['options']);return _0x57bedc['getApplications'](_0x308479);}})[_0x09c9('0x1b')](function(_0x2c34cc){if(_0x2c34cc){_0x752718=_0x2c34cc[_0x09c9('0x52')];if(!_0x217ae9[_0x09c9('0x3b')][_0x09c9('0x42')](_0x09c9('0x63'))){_0x308479['limit']=qs[_0x09c9('0x43')](_0x217ae9[_0x09c9('0x3b')][_0x09c9('0x43')]);_0x308479[_0x09c9('0x27')]=qs[_0x09c9('0x27')](_0x217ae9[_0x09c9('0x3b')][_0x09c9('0x27')]);}return _0x57bedc[_0x09c9('0xb6')](_0x308479);}})[_0x09c9('0x1b')](function(_0x6cc2e5){if(_0x6cc2e5){return _0x6cc2e5?{'count':_0x752718,'rows':_0x6cc2e5}:null;}})[_0x09c9('0x1b')](respondWithResult(_0x55f414,null))[_0x09c9('0x5b')](handleError(_0x55f414,null));};exports[_0x09c9('0xb7')]=function(_0xa7e0ab,_0x63954c,_0x1a2e4e){var _0x5bc577={'raw':![],'where':{}};var _0x596f2e={};var _0x148f84={'count':0x0,'rows':[]};return db[_0x09c9('0x39')][_0x09c9('0x62')]({'where':{'id':_0xa7e0ab[_0x09c9('0x51')]['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0x63954c,null))[_0x09c9('0x1b')](function(_0x2a5b05){if(_0x2a5b05){_0x596f2e['model']=_[_0x09c9('0x3c')](db[_0x09c9('0x9e')][_0x09c9('0x3a')]);_0x596f2e[_0x09c9('0x3b')]=_[_0x09c9('0x3c')](_0xa7e0ab[_0x09c9('0x3b')]);_0x596f2e[_0x09c9('0x3d')]=_['intersection'](_0x596f2e[_0x09c9('0x41')],_0x596f2e[_0x09c9('0x3b')]);_0x5bc577[_0x09c9('0x40')]=_[_0x09c9('0x3e')](_0x596f2e[_0x09c9('0x41')],qs[_0x09c9('0x3f')](_0xa7e0ab['query'][_0x09c9('0x3f')]));_0x5bc577[_0x09c9('0x40')]=_0x5bc577['attributes']['length']?_0x5bc577[_0x09c9('0x40')]:_0x596f2e['model'];if(!_0xa7e0ab['query'][_0x09c9('0x42')](_0x09c9('0x63'))){_0x5bc577[_0x09c9('0x43')]=qs['limit'](_0xa7e0ab['query']['limit']);_0x5bc577[_0x09c9('0x27')]=qs[_0x09c9('0x27')](_0xa7e0ab[_0x09c9('0x3b')]['offset']);}_0x5bc577[_0x09c9('0x64')]=qs[_0x09c9('0x44')](_0xa7e0ab[_0x09c9('0x3b')]['sort']);_0x5bc577[_0x09c9('0x45')]=qs['filters'](_[_0x09c9('0x65')](_0xa7e0ab['query'],_0x596f2e[_0x09c9('0x3d')]));_0x5bc577[_0x09c9('0x45')][_0x09c9('0x5f')]=_0x2a5b05['id'];if(_0xa7e0ab['query'][_0x09c9('0x46')]){_0x5bc577[_0x09c9('0x45')]=_[_0x09c9('0x47')](_0x5bc577[_0x09c9('0x45')],{'$or':_[_0x09c9('0x66')](_0x5bc577[_0x09c9('0x40')],function(_0x255b10){var _0x49620a={};_0x49620a[_0x255b10]={'$like':'%'+_0xa7e0ab[_0x09c9('0x3b')][_0x09c9('0x46')]+'%'};return _0x49620a;})});}_0x5bc577=_[_0x09c9('0x47')]({},_0x5bc577,_0xa7e0ab[_0x09c9('0x4b')]);return db[_0x09c9('0x9e')][_0x09c9('0x26')]({'where':_0x5bc577['where']})[_0x09c9('0x1b')](function(_0x377c08){_0x148f84[_0x09c9('0x26')]=_0x377c08;if(_0xa7e0ab['query'][_0x09c9('0x4c')]){_0x5bc577['include']=[{'model':db[_0x09c9('0x75')],'as':'Contact','required':![]},{'model':db[_0x09c9('0xa9')],'as':'Owner','attributes':[_0x09c9('0x34'),_0x09c9('0xb8'),_0x09c9('0xb9')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x09c9('0x34'),'color'],'where':_0xa7e0ab[_0x09c9('0x3b')][_0x09c9('0xba')]?{'id':_0xa7e0ab[_0x09c9('0x3b')][_0x09c9('0xba')]}:undefined,'required':_0xa7e0ab['query']['tag']?!![]:![]}];}return db[_0x09c9('0x9e')][_0x09c9('0x4e')](_0x5bc577);})[_0x09c9('0x1b')](function(_0x378bfc){_0x148f84[_0x09c9('0x4f')]=_0x378bfc;return _0x148f84;});}})[_0x09c9('0x1b')](respondWithFilteredResult(_0x63954c,_0x5bc577))['catch'](handleError(_0x63954c,null));};exports[_0x09c9('0x35')]=function(_0x51ac10,_0x2673dc,_0x4a0f82){var _0x96ca8f,_0x47e4a3,_0x3b2eea;if(_[_0x09c9('0x93')](_0x51ac10[_0x09c9('0x54')][_0x09c9('0x54')])||_0x51ac10[_0x09c9('0x54')][_0x09c9('0x54')]===''){throw new db[(_0x09c9('0x94'))][(_0x09c9('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x09c9('0x93')](_0x51ac10[_0x09c9('0x54')]['to'])){throw new db[(_0x09c9('0x94'))]['ValidationError'](_0x09c9('0xbb'));}_0x96ca8f=_0x51ac10[_0x09c9('0x54')]['to'];return db[_0x09c9('0x39')][_0x09c9('0x53')]({'where':{'id':_0x51ac10[_0x09c9('0x51')]['id']},'include':[{'model':db[_0x09c9('0x99')],'as':'List','include':[{'model':db[_0x09c9('0x75')],'as':'Contacts','where':{'mobile':_0x96ca8f},'limit':0x1,'order':[[_0x09c9('0x79'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2673dc,null))[_0x09c9('0x1b')](function(_0x1452dc){if(_0x1452dc&&_0x1452dc['List']){_0x47e4a3=_0x1452dc[_0x09c9('0x2f')]({'plain':!![]});if(_0x47e4a3[_0x09c9('0xbc')]&&_0x47e4a3[_0x09c9('0xbc')]['Contacts'][_0x09c9('0x52')]){return _0x47e4a3[_0x09c9('0xbc')][_0x09c9('0x9a')][0x0];}return db['CmContact'][_0x09c9('0x59')](_[_0x09c9('0x15')](_0x51ac10[_0x09c9('0x54')],{'firstName':_0x96ca8f,'mobile':_0x96ca8f,'phone':_0x96ca8f,'ListId':_0x47e4a3['ListId']}));}})['then'](handleEntityNotFound(_0x2673dc,null))['then'](function(_0xf06e11){if(_0xf06e11){_0x3b2eea=_0xf06e11;return db[_0x09c9('0x9e')][_0x09c9('0x53')]({'where':{'ContactId':_0x3b2eea['id'],'closed':![],'SmsAccountId':_0x47e4a3['id']}})[_0x09c9('0x1b')](function(_0x52268a){if(_0x52268a){return[_0x52268a,![]];}return db['SmsInteraction'][_0x09c9('0x59')]({'UserId':_0x51ac10[_0x09c9('0xbd')]['id'],'ContactId':_0x3b2eea['id'],'SmsAccountId':_0x47e4a3['id'],'phone':_0x96ca8f,'firstMsgDirection':_0x09c9('0xbe'),'Messages':[_['merge'](_0x51ac10['body'],{'read':![],'body':_0x51ac10[_0x09c9('0x54')][_0x09c9('0x54')],'phone':_0x96ca8f,'SmsAccountId':_0x47e4a3['id'],'UserId':_0x51ac10[_0x09c9('0xbd')]['id'],'ContactId':_0x3b2eea['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x09c9('0x1b')](function(_0x3309f2){return[_0x3309f2,!![]];});});}})[_0x09c9('0x9f')](function(_0x582ad7,_0x4bf3ae){if(_0x4bf3ae){return _0x582ad7;}return db[_0x09c9('0xa5')][_0x09c9('0x59')](_['merge'](_0x51ac10[_0x09c9('0x54')],{'read':![],'body':_0x51ac10[_0x09c9('0x54')][_0x09c9('0x54')],'phone':_0x96ca8f,'SmsAccountId':_0x47e4a3['id'],'SmsInteractionId':_0x582ad7['id'],'UserId':_0x51ac10[_0x09c9('0xbd')]['id'],'ContactId':_0x3b2eea['id']}))['then'](function(_0x56a7ca){_0x582ad7[_0x09c9('0xbf')][_0x09c9('0xc0')]=[];_0x582ad7[_0x09c9('0xbf')][_0x09c9('0xc0')][_0x09c9('0xc1')](_0x56a7ca[_0x09c9('0xbf')]);return _0x582ad7;});})['then'](respondWithResult(_0x2673dc,null))[_0x09c9('0x5b')](handleError(_0x2673dc,null));};exports[_0x09c9('0x25')]=function(_0x1e25b5,_0x22cd96,_0xab865a){if(_0x1e25b5[_0x09c9('0x54')]['id']){delete _0x1e25b5[_0x09c9('0x54')]['id'];}console[_0x09c9('0xc2')](_0x09c9('0xc3'),_0x1e25b5[_0x09c9('0x54')]);var _0x5dd830,_0x2d3af6,_0x255163;return db[_0x09c9('0x39')]['find']({'where':{'id':_0x1e25b5[_0x09c9('0x51')]['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0x22cd96,null))[_0x09c9('0x1b')](function(_0x525c82){if(_0x525c82){_0x255163=_0x525c82;logger[_0x09c9('0x1d')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x09c9('0xc4'),_0x525c82[_0x09c9('0x48')],util['inspect'](_0x1e25b5[_0x09c9('0x54')],{'showHidden':![],'depth':null}));switch(_0x525c82['type']){case _0x09c9('0x83'):if(_0x1e25b5['body'][_0x09c9('0xc5')]&&_0x1e25b5['body']['status']){_0x2d3af6=_0x1e25b5['body'][_0x09c9('0x25')];return db[_0x09c9('0xa5')][_0x09c9('0x53')]({'where':{'messageId':_0x1e25b5['body'][_0x09c9('0xc5')]}});}break;case _0x09c9('0x87'):if(_0x1e25b5['body']['requestid']&&_0x1e25b5[_0x09c9('0x54')][_0x09c9('0xc6')]){_0x2d3af6=_0x1e25b5[_0x09c9('0x54')][_0x09c9('0xc6')];return db[_0x09c9('0xa5')][_0x09c9('0x53')]({'where':{'messageId':_0x1e25b5['body'][_0x09c9('0xc7')]}});}break;case _0x09c9('0x88'):if(_0x1e25b5[_0x09c9('0x54')][_0x09c9('0x89')]&&_0x1e25b5[_0x09c9('0x54')][_0x09c9('0xc8')]){_0x2d3af6=_0x1e25b5[_0x09c9('0x54')][_0x09c9('0xc8')];return db['SmsMessage']['find']({'where':{'messageId':_0x1e25b5[_0x09c9('0x54')][_0x09c9('0x89')]}});}break;case _0x09c9('0x8d'):var _0x19f2f9=_0x1e25b5[_0x09c9('0x54')][_0x09c9('0x8e')][0x0];if(_0x19f2f9[_0x09c9('0x81')]&&_0x19f2f9[_0x09c9('0x25')][_0x09c9('0xc9')]==='DELIVERED'){_0x2d3af6=_0x19f2f9[_0x09c9('0x25')][_0x09c9('0xc9')];return db[_0x09c9('0xa5')][_0x09c9('0x53')]({'where':{'messageId':_0x19f2f9[_0x09c9('0x81')]}});}break;case _0x09c9('0xca'):if(_0x1e25b5[_0x09c9('0x54')]['messageId']&&_0x1e25b5[_0x09c9('0x54')]['status']){_0x2d3af6=_0x1e25b5['body']['status'];return db[_0x09c9('0xa5')][_0x09c9('0x53')]({'where':{'messageId':_0x1e25b5['body']['messageId']}});}break;case'intelepeer':if(_0x1e25b5[_0x09c9('0x54')][_0x09c9('0xcb')]&&_0x1e25b5[_0x09c9('0x54')]['status']){_0x2d3af6=_0x1e25b5[_0x09c9('0x54')][_0x09c9('0x25')];return db[_0x09c9('0xa5')][_0x09c9('0x53')]({'where':{'messageId':_0x1e25b5['body'][_0x09c9('0xcb')]}});}break;}}})['then'](handleEntityNotFound(_0x22cd96,null))[_0x09c9('0x1b')](function(_0x596645){if(_0x596645){_0x5dd830=_0x596645;switch(_0x255163['type']){case _0x09c9('0x83'):if(_0x2d3af6==='DELIVERED'){return _0x5dd830[_0x09c9('0x5c')]({'read':!![]});}else{logger[_0x09c9('0x20')](_0x09c9('0x1e'),'status','skebby',util[_0x09c9('0xcc')](_0x1e25b5[_0x09c9('0x54')],{'showHidden':![],'depth':null}));}break;case _0x09c9('0x87'):if(_0x2d3af6==='1'){return _0x5dd830[_0x09c9('0x5c')]({'read':!![]});}else{logger[_0x09c9('0x20')](_0x09c9('0x1e'),_0x09c9('0x25'),_0x09c9('0x83'),util[_0x09c9('0xcc')](_0x1e25b5['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x1e25b5[_0x09c9('0x54')][_0x09c9('0xcd')]&&_0x2d3af6>=0xc8&&_0x2d3af6<=0xce){return _0x5dd830[_0x09c9('0x5c')]({'read':!![]});}else{logger[_0x09c9('0x20')](_0x09c9('0x1e'),_0x09c9('0x25'),_0x09c9('0x88'),util[_0x09c9('0xcc')](_0x1e25b5[_0x09c9('0x54')],{'showHidden':![],'depth':null}));}break;case _0x09c9('0x8d'):var _0x2a9ec6=_0x1e25b5['body'][_0x09c9('0x8e')][0x0];if(_0x2a9ec6[_0x09c9('0x25')][_0x09c9('0xc9')]===_0x09c9('0xce')){return _0x5dd830[_0x09c9('0x5c')]({'read':!![]});}else{logger[_0x09c9('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x09c9('0x25'),_0x09c9('0x8d'),util[_0x09c9('0xcc')](_0x1e25b5['body'],{'showHidden':![],'depth':null}));}break;case _0x09c9('0xca'):if(_0x2d3af6==_0x09c9('0xcf')||_0x2d3af6==_0x09c9('0xd0')){return _0x5dd830[_0x09c9('0x5c')]({'read':!![]});}else{logger[_0x09c9('0x20')](_0x09c9('0x1e'),_0x09c9('0x25'),_0x09c9('0xca'),util[_0x09c9('0xcc')](_0x1e25b5[_0x09c9('0x54')],{'showHidden':![],'depth':null}));}break;case _0x09c9('0xd1'):if(_0x2d3af6==='DELIVRD'||_0x2d3af6==='ACCEPTD'){return _0x5dd830[_0x09c9('0x5c')]({'read':!![]});}else{logger[_0x09c9('0x20')](_0x09c9('0x1e'),_0x09c9('0x25'),_0x09c9('0xd1'),util[_0x09c9('0xcc')](_0x1e25b5['body'],{'showHidden':![],'depth':null}));}break;}return _0x5dd830;}})[_0x09c9('0x1b')](respondWithResult(_0x22cd96,null))[_0x09c9('0x5b')](handleError(_0x22cd96,null));};exports[_0x09c9('0xd2')]=function(_0x184572,_0x4afe98,_0x48cc0b){var _0x133e8c,_0x2c463f,_0xae1013;return db[_0x09c9('0x39')][_0x09c9('0x53')]({'where':{'id':_0x184572[_0x09c9('0x51')]['id']}})[_0x09c9('0x1b')](handleEntityNotFound(_0x4afe98,null))[_0x09c9('0x1b')](function(_0x4e2fe6){if(_0x4e2fe6){_0xae1013=_0x4e2fe6;logger[_0x09c9('0x1d')](_0x09c9('0x1e'),'status','received\x20delivery\x20report\x20from',_0x4e2fe6['type'],util[_0x09c9('0xcc')](_0x184572['query'],{'showHidden':![],'depth':null}));switch(_0x4e2fe6[_0x09c9('0x48')]){case _0x09c9('0x8f'):if(_0x184572[_0x09c9('0x3b')][_0x09c9('0xd3')]&&_0x184572[_0x09c9('0x3b')][_0x09c9('0xd4')]){_0x2c463f=_0x184572[_0x09c9('0x3b')][_0x09c9('0xd4')];return db[_0x09c9('0xa5')][_0x09c9('0x53')]({'where':{'messageId':_0x184572['query'][_0x09c9('0xd3')]}});}break;}}})['then'](handleEntityNotFound(_0x4afe98,null))[_0x09c9('0x1b')](function(_0x594719){if(_0x594719){_0x133e8c=_0x594719;switch(_0xae1013['type']){case'csc':if(_0x2c463f==='2'||_0x2c463f==='6'){return _0x133e8c['update']({'read':!![]});}else{logger[_0x09c9('0x20')](_0x09c9('0x1e'),_0x09c9('0x25'),_0x09c9('0x8f'),util[_0x09c9('0xcc')](_0x184572['query'],{'showHidden':![],'depth':null}));};break;}return _0x133e8c;}})[_0x09c9('0x1b')](respondWithResult(_0x4afe98,null))[_0x09c9('0x5b')](handleError(_0x4afe98,null));};exports[_0x09c9('0xd5')]=function(_0x163e20,_0x40cc87,_0x38c943){return db[_0x09c9('0x39')][_0x09c9('0x53')]({'where':{'id':_0x163e20[_0x09c9('0x51')]['id']}})['then'](handleEntityNotFound(_0x40cc87,null))[_0x09c9('0x1b')](function(_0x13f112){if(_0x13f112){return _0x13f112[_0x09c9('0xd5')](_0x163e20[_0x09c9('0x54')]['ids'],_['omit'](_0x163e20[_0x09c9('0x54')],['ids','id'])||{})[_0x09c9('0x9f')](function(_0x357943){for(var _0x1b015e=0x0;_0x1b015e<_0x163e20[_0x09c9('0x54')]['ids']['length'];_0x1b015e+=0x1){socket['emit'](_0x09c9('0xd6'),{'UserId':_0x163e20[_0x09c9('0x54')][_0x09c9('0x68')][_0x1b015e],'SmsAccountId':_0x163e20[_0x09c9('0x51')]['id']});}return _0x357943;});}})[_0x09c9('0x1b')](respondWithResult(_0x40cc87,null))[_0x09c9('0x5b')](handleError(_0x40cc87,null));};exports['removeAgents']=function(_0x3c558f,_0x9d7093,_0x411e84){var _0x473986;return db[_0x09c9('0x39')][_0x09c9('0x53')]({'where':{'id':_0x3c558f[_0x09c9('0x51')]['id']}})['then'](handleEntityNotFound(_0x9d7093,null))[_0x09c9('0x1b')](function(_0x245eb1){if(_0x245eb1){return _0x245eb1[_0x09c9('0xd7')](_0x3c558f[_0x09c9('0x3b')][_0x09c9('0x68')])['then'](function(_0x1ed6f9){if(_[_0x09c9('0xd8')](_0x3c558f[_0x09c9('0x3b')][_0x09c9('0x68')])){for(var _0x83e423=0x0;_0x83e423<_0x3c558f[_0x09c9('0x3b')]['ids'][_0x09c9('0x52')];_0x83e423+=0x1){socket[_0x09c9('0xd9')]('userSmsAccount:remove',{'UserId':_0x3c558f[_0x09c9('0x3b')][_0x09c9('0x68')][_0x83e423],'SmsAccountId':_0x3c558f[_0x09c9('0x51')]['id']});}}else{socket[_0x09c9('0xd9')](_0x09c9('0xda'),{'UserId':_0x3c558f[_0x09c9('0x3b')][_0x09c9('0x68')],'SmsAccountId':_0x3c558f['params']['id']});}});}})[_0x09c9('0x1b')](respondWithStatusCode(_0x9d7093,null))['catch'](handleError(_0x9d7093,null));};exports['getAgents']=function(_0x590706,_0x50cc6a,_0x4565a8){var _0x133439={};var _0x411bc5={};var _0x181687;var _0xe0c190;return db[_0x09c9('0x39')][_0x09c9('0x62')]({'where':{'id':_0x590706['params']['id']}})['then'](handleEntityNotFound(_0x50cc6a,null))[_0x09c9('0x1b')](function(_0x2adb58){if(_0x2adb58){_0x181687=_0x2adb58;_0x411bc5['model']=_[_0x09c9('0x3c')](db[_0x09c9('0xa9')][_0x09c9('0x3a')]);_0x411bc5[_0x09c9('0x3b')]=_[_0x09c9('0x3c')](_0x590706[_0x09c9('0x3b')]);_0x411bc5[_0x09c9('0x3d')]=_['intersection'](_0x411bc5[_0x09c9('0x41')],_0x411bc5[_0x09c9('0x3b')]);_0x133439[_0x09c9('0x40')]=_[_0x09c9('0x3e')](_0x411bc5[_0x09c9('0x41')],qs['fields'](_0x590706[_0x09c9('0x3b')][_0x09c9('0x3f')]));_0x133439[_0x09c9('0x40')]=_0x133439['attributes'][_0x09c9('0x52')]?_0x133439[_0x09c9('0x40')]:_0x411bc5['model'];_0x133439[_0x09c9('0x64')]=qs[_0x09c9('0x44')](_0x590706[_0x09c9('0x3b')][_0x09c9('0x44')]);_0x133439[_0x09c9('0x45')]=qs[_0x09c9('0x3d')](_[_0x09c9('0x65')](_0x590706[_0x09c9('0x3b')],_0x411bc5[_0x09c9('0x3d')]));if(_0x590706[_0x09c9('0x3b')][_0x09c9('0x46')]){_0x133439[_0x09c9('0x45')]=_[_0x09c9('0x47')](_0x133439[_0x09c9('0x45')],{'$or':_[_0x09c9('0x66')](_0x133439[_0x09c9('0x40')],function(_0x4e1a26){var _0xfb9227={};_0xfb9227[_0x4e1a26]={'$like':'%'+_0x590706[_0x09c9('0x3b')][_0x09c9('0x46')]+'%'};return _0xfb9227;})});}_0x133439=_[_0x09c9('0x47')]({},_0x133439,_0x590706[_0x09c9('0x4b')]);return _0x181687[_0x09c9('0xdb')](_0x133439);}})[_0x09c9('0x1b')](function(_0xc3ee10){if(_0xc3ee10){_0xe0c190=_0xc3ee10[_0x09c9('0x52')];if(!_0x590706[_0x09c9('0x3b')][_0x09c9('0x42')]('nolimit')){_0x133439['limit']=qs[_0x09c9('0x43')](_0x590706['query'][_0x09c9('0x43')]);_0x133439[_0x09c9('0x27')]=qs[_0x09c9('0x27')](_0x590706[_0x09c9('0x3b')][_0x09c9('0x27')]);}return _0x181687[_0x09c9('0xdb')](_0x133439);}})['then'](function(_0xb601c6){if(_0xb601c6){return _0xb601c6?{'count':_0xe0c190,'rows':_0xb601c6}:null;}})['then'](respondWithResult(_0x50cc6a,null))[_0x09c9('0x5b')](handleError(_0x50cc6a,null));}; \ No newline at end of file +var _0xc0a7=['inspect','skebby_dispatch_id','statusInt','requestid','message_id','status_code','groupName','DELIVERED','redif','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','csc','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','status','end','json','count','Content-Range','apply','save','update','destroy','get','SmsAccounts','stack','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','include','catch','show','params','includeAll','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','create','name','body','describe','SmsAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','sms','account','applications','orderBy','Applications','priority','asc','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','plivo','From','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','push','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','addApplications','SmsApplication','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','send','to\x20is\x20mandatory','CmList','List','Messages','dataValues','log','received\x20delivery\x20report\x20from'];(function(_0x363842,_0x369636){var _0x257bc2=function(_0x2516cf){while(--_0x2516cf){_0x363842['push'](_0x363842['shift']());}};_0x257bc2(++_0x369636);}(_0xc0a7,0xee));var _0x7c0a=function(_0x3e266b,_0x2d2fcd){_0x3e266b=_0x3e266b-0x0;var _0x3d6c5a=_0xc0a7[_0x3e266b];return _0x3d6c5a;};'use strict';var pdf=require(_0x7c0a('0x0'));var emlformat=require(_0x7c0a('0x1'));var rimraf=require(_0x7c0a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c0a('0x3'));var rp=require(_0x7c0a('0x4'));var moment=require(_0x7c0a('0x5'));var BPromise=require(_0x7c0a('0x6'));var Mustache=require('mustache');var util=require(_0x7c0a('0x7'));var path=require(_0x7c0a('0x8'));var sox=require(_0x7c0a('0x9'));var csv=require(_0x7c0a('0xa'));var ejs=require(_0x7c0a('0xb'));var fs=require('fs');var _=require(_0x7c0a('0xc'));var squel=require(_0x7c0a('0xd'));var crypto=require(_0x7c0a('0xe'));var jsforce=require(_0x7c0a('0xf'));var deskjs=require(_0x7c0a('0x10'));var toCsv=require(_0x7c0a('0xa'));var querystring=require(_0x7c0a('0x11'));var Papa=require(_0x7c0a('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0x7c0a('0x13'));var Redis=require(_0x7c0a('0x14'));var qs=require(_0x7c0a('0x15'));var logger=require(_0x7c0a('0x16'))(_0x7c0a('0x17'));var utils=require(_0x7c0a('0x18'));var config=require(_0x7c0a('0x19'));var db=require(_0x7c0a('0x1a'))['db'];config[_0x7c0a('0x1b')]=_[_0x7c0a('0x1c')](config[_0x7c0a('0x1b')],{'host':_0x7c0a('0x1d'),'port':0x18eb});var socket=require(_0x7c0a('0x1e'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x7c0a('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7c0a('0x20')][_0x7c0a('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x80b70e,_0x119594,_0x1c4579,_0x5e2d33){return new BPromise(function(_0x1db595,_0x7828fb){var _0xcb7e63=_0x5e2d33||client;return _0xcb7e63[_0x7c0a('0x22')](_0x80b70e,_0x1c4579)[_0x7c0a('0x23')](function(_0x17be51){logger['info']('SmsAccount,\x20%s,\x20%s',_0x119594,_0x7c0a('0x24'));logger[_0x7c0a('0x25')](_0x7c0a('0x26'),_0x119594,_0x7c0a('0x24'),JSON[_0x7c0a('0x27')](_0x17be51));if(_0x17be51['error']){if(_0x17be51[_0x7c0a('0x28')][_0x7c0a('0x29')]===0x1f4){logger['error'](_0x7c0a('0x2a'),_0x119594,_0x17be51['error']['message']);return _0x7828fb(_0x17be51[_0x7c0a('0x28')]['message']);}logger[_0x7c0a('0x28')]('SmsAccount,\x20%s,\x20%s',_0x119594,_0x17be51[_0x7c0a('0x28')][_0x7c0a('0x2b')]);return _0x1db595(_0x17be51[_0x7c0a('0x28')][_0x7c0a('0x2b')]);}else{logger['info'](_0x7c0a('0x2a'),_0x119594,_0x7c0a('0x24'));_0x1db595(_0x17be51['result']['message']);}})['catch'](function(_0x1eaea9){logger[_0x7c0a('0x28')](_0x7c0a('0x2a'),_0x119594,_0x1eaea9);_0x7828fb(_0x1eaea9);});});}function respondWithStatusCode(_0x26e780,_0x3ddbe0){_0x3ddbe0=_0x3ddbe0||0xcc;return function(_0x15bc46){if(_0x15bc46){return _0x26e780['sendStatus'](_0x3ddbe0);}return _0x26e780[_0x7c0a('0x2c')](_0x3ddbe0)[_0x7c0a('0x2d')]();};}function respondWithResult(_0x408175,_0x247fed){_0x247fed=_0x247fed||0xc8;return function(_0x2a04e7){if(_0x2a04e7){return _0x408175[_0x7c0a('0x2c')](_0x247fed)[_0x7c0a('0x2e')](_0x2a04e7);}};}function respondWithFilteredResult(_0x257176,_0x38273f){return function(_0x42747c){if(_0x42747c){var _0x245db4=_0x42747c[_0x7c0a('0x2f')],_0x4dd12e=_0x38273f['offset'],_0x4561c2=_0x38273f['offset']+_0x38273f['limit'],_0x351af1;if(_0x4561c2>=_0x245db4){_0x4561c2=_0x245db4;_0x351af1=0xc8;}else{_0x351af1=0xce;}_0x257176['status'](_0x351af1);return _0x257176['set'](_0x7c0a('0x30'),_0x4dd12e+'-'+_0x4561c2+'/'+_0x245db4)[_0x7c0a('0x2e')](_0x42747c);}return null;};}function patchUpdates(_0x33c8e9){return function(_0x100f78){try{jsonpatch[_0x7c0a('0x31')](_0x100f78,_0x33c8e9,!![]);}catch(_0x5e8338){return BPromise['reject'](_0x5e8338);}return _0x100f78[_0x7c0a('0x32')]();};}function saveUpdates(_0x22de87,_0x484145){return function(_0x4d03d8){if(_0x4d03d8){return _0x4d03d8[_0x7c0a('0x33')](_0x22de87)[_0x7c0a('0x23')](function(_0x67aaf6){return _0x67aaf6;});}return null;};}function removeEntity(_0x48c5e6,_0x1a6f03){return function(_0x506a7a){if(_0x506a7a){return _0x506a7a[_0x7c0a('0x34')]()[_0x7c0a('0x23')](function(){var _0x51d825=_0x506a7a[_0x7c0a('0x35')]({'plain':!![]});var _0x9b79ac=_0x7c0a('0x36');return db['UserProfileResource'][_0x7c0a('0x34')]({'where':{'type':_0x9b79ac,'resourceId':_0x51d825['id']}})[_0x7c0a('0x23')](function(){return _0x506a7a;});})[_0x7c0a('0x23')](function(){_0x48c5e6[_0x7c0a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x87e1db,_0x560563){return function(_0x6629f8){if(!_0x6629f8){_0x87e1db['sendStatus'](0x194);}return _0x6629f8;};}function handleError(_0x51766a,_0x800a5e){_0x800a5e=_0x800a5e||0x1f4;return function(_0x2aa865){logger[_0x7c0a('0x28')](_0x2aa865[_0x7c0a('0x37')]);if(_0x2aa865['name']){delete _0x2aa865['name'];}_0x51766a[_0x7c0a('0x2c')](_0x800a5e)['send'](_0x2aa865);};}exports['index']=function(_0x17e00e,_0x1a1d8e){var _0x44648b={'include':[{'model':db[_0x7c0a('0x38')],'as':_0x7c0a('0x39')}]},_0x3d5056={},_0x1dead9={'count':0x0,'rows':[]};var _0x3cee96=db[_0x7c0a('0x3a')][_0x7c0a('0x3b')];_0x3d5056['model']=_[_0x7c0a('0x3c')](_0x3cee96);_0x3d5056['query']=_['keys'](_0x17e00e[_0x7c0a('0x3d')]);_0x3d5056[_0x7c0a('0x3e')]=_[_0x7c0a('0x3f')](_0x3d5056[_0x7c0a('0x40')],_0x3d5056[_0x7c0a('0x3d')]);_0x44648b['attributes']=_[_0x7c0a('0x3f')](_0x3d5056['model'],qs[_0x7c0a('0x41')](_0x17e00e[_0x7c0a('0x3d')][_0x7c0a('0x41')]));_0x44648b[_0x7c0a('0x42')]=_0x44648b['attributes'][_0x7c0a('0x43')]?_0x44648b[_0x7c0a('0x42')]:_0x3d5056[_0x7c0a('0x40')];if(!_0x17e00e[_0x7c0a('0x3d')][_0x7c0a('0x44')](_0x7c0a('0x45'))){_0x44648b[_0x7c0a('0x46')]=qs[_0x7c0a('0x46')](_0x17e00e['query'][_0x7c0a('0x46')]);_0x44648b[_0x7c0a('0x47')]=qs[_0x7c0a('0x47')](_0x17e00e[_0x7c0a('0x3d')][_0x7c0a('0x47')]);}_0x44648b[_0x7c0a('0x48')]=qs[_0x7c0a('0x49')](_0x17e00e[_0x7c0a('0x3d')][_0x7c0a('0x49')]);_0x44648b[_0x7c0a('0x4a')]=qs[_0x7c0a('0x3e')](_[_0x7c0a('0x4b')](_0x17e00e[_0x7c0a('0x3d')],_0x3d5056[_0x7c0a('0x3e')]));if(_0x17e00e[_0x7c0a('0x3d')][_0x7c0a('0x4c')]){_0x44648b['where']=_[_0x7c0a('0x4d')](_0x44648b[_0x7c0a('0x4a')],{'$or':_[_0x7c0a('0x4e')](_0x3cee96,function(_0x360eef){if(_0x360eef[_0x7c0a('0x4f')]['key']!==_0x7c0a('0x50')){var _0x393f3f={};_0x393f3f[_0x360eef['field']]={'$like':'%'+_0x17e00e[_0x7c0a('0x3d')]['filter']+'%'};return _0x393f3f;}})});}_0x44648b=_['merge']({},_0x44648b,_0x17e00e[_0x7c0a('0x51')]);var _0x4d8737={'where':_0x44648b[_0x7c0a('0x4a')]};return db['SmsAccount'][_0x7c0a('0x2f')](_0x4d8737)[_0x7c0a('0x23')](function(_0x1d596d){_0x1dead9[_0x7c0a('0x2f')]=_0x1d596d;if(_0x17e00e[_0x7c0a('0x3d')]['includeAll']){_0x44648b[_0x7c0a('0x52')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x44648b);})[_0x7c0a('0x23')](function(_0x53e2ed){_0x1dead9['rows']=_0x53e2ed;return _0x1dead9;})[_0x7c0a('0x23')](respondWithFilteredResult(_0x1a1d8e,_0x44648b))[_0x7c0a('0x53')](handleError(_0x1a1d8e,null));};exports[_0x7c0a('0x54')]=function(_0x10a500,_0x401434){var _0x590293={'raw':![],'where':{'id':_0x10a500[_0x7c0a('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x32a526={};_0x32a526[_0x7c0a('0x40')]=_['keys'](db[_0x7c0a('0x3a')]['rawAttributes']);_0x32a526[_0x7c0a('0x3d')]=_['keys'](_0x10a500[_0x7c0a('0x3d')]);_0x32a526[_0x7c0a('0x3e')]=_[_0x7c0a('0x3f')](_0x32a526[_0x7c0a('0x40')],_0x32a526[_0x7c0a('0x3d')]);_0x590293[_0x7c0a('0x42')]=_[_0x7c0a('0x3f')](_0x32a526[_0x7c0a('0x40')],qs[_0x7c0a('0x41')](_0x10a500[_0x7c0a('0x3d')][_0x7c0a('0x41')]));_0x590293['attributes']=_0x590293['attributes'][_0x7c0a('0x43')]?_0x590293['attributes']:_0x32a526['model'];if(_0x10a500[_0x7c0a('0x3d')][_0x7c0a('0x56')]){_0x590293[_0x7c0a('0x52')]=[{'all':!![]}];}_0x590293=_['merge']({},_0x590293,_0x10a500[_0x7c0a('0x51')]);return db[_0x7c0a('0x3a')][_0x7c0a('0x57')](_0x590293)[_0x7c0a('0x23')](handleEntityNotFound(_0x401434,null))[_0x7c0a('0x23')](respondWithResult(_0x401434,null))[_0x7c0a('0x53')](handleError(_0x401434,null));};exports['create']=function(_0x539d42,_0x2071a5){return db[_0x7c0a('0x3a')]['create'](_0x539d42['body'],{})['then'](function(_0x3a119a){var _0x308af7=_0x539d42['user'][_0x7c0a('0x35')]({'plain':!![]});if(!_0x308af7)throw new Error(_0x7c0a('0x58'));if(_0x308af7['role']===_0x7c0a('0x59')){var _0x12b5af=_0x3a119a[_0x7c0a('0x35')]({'plain':!![]});var _0x4fb49f=_0x7c0a('0x36');return db[_0x7c0a('0x5a')][_0x7c0a('0x57')]({'where':{'name':_0x4fb49f,'userProfileId':_0x308af7['userProfileId']},'raw':!![]})[_0x7c0a('0x23')](function(_0x53b72a){if(_0x53b72a&&_0x53b72a[_0x7c0a('0x5b')]===0x0){return db[_0x7c0a('0x5c')][_0x7c0a('0x5d')]({'name':_0x12b5af[_0x7c0a('0x5e')],'resourceId':_0x12b5af['id'],'type':_0x53b72a[_0x7c0a('0x5e')],'sectionId':_0x53b72a['id']},{})[_0x7c0a('0x23')](function(){return _0x3a119a;});}else{return _0x3a119a;}})[_0x7c0a('0x53')](function(_0xabbe3d){logger[_0x7c0a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xabbe3d);throw _0xabbe3d;});}return _0x3a119a;})[_0x7c0a('0x23')](respondWithResult(_0x2071a5,0xc9))[_0x7c0a('0x53')](handleError(_0x2071a5,null));};exports[_0x7c0a('0x33')]=function(_0x58e3cd,_0x20be42){if(_0x58e3cd['body']['id']){delete _0x58e3cd['body']['id'];}return db['SmsAccount'][_0x7c0a('0x57')]({'where':{'id':_0x58e3cd['params']['id']},'include':[{'model':db[_0x7c0a('0x38')],'as':'mandatoryDispositionPause'}]})[_0x7c0a('0x23')](handleEntityNotFound(_0x20be42,null))[_0x7c0a('0x23')](saveUpdates(_0x58e3cd[_0x7c0a('0x5f')],null))[_0x7c0a('0x23')](respondWithResult(_0x20be42,null))[_0x7c0a('0x53')](handleError(_0x20be42,null));};exports[_0x7c0a('0x34')]=function(_0x5b2bc9,_0x3b88f9){return db[_0x7c0a('0x3a')]['find']({'where':{'id':_0x5b2bc9[_0x7c0a('0x55')]['id']}})[_0x7c0a('0x23')](handleEntityNotFound(_0x3b88f9,null))[_0x7c0a('0x23')](removeEntity(_0x3b88f9,null))[_0x7c0a('0x53')](handleError(_0x3b88f9,null));};exports['describe']=function(_0x53830d,_0xd83133){return db[_0x7c0a('0x3a')][_0x7c0a('0x60')]()[_0x7c0a('0x23')](respondWithResult(_0xd83133,null))[_0x7c0a('0x53')](handleError(_0xd83133,null));};exports['addDisposition']=function(_0x2ad14c,_0x1027cd,_0x492248){if(_0x2ad14c[_0x7c0a('0x5f')]['id']){delete _0x2ad14c[_0x7c0a('0x5f')]['id'];}return db[_0x7c0a('0x3a')][_0x7c0a('0x57')]({'where':{'id':_0x2ad14c[_0x7c0a('0x55')]['id']}})[_0x7c0a('0x23')](handleEntityNotFound(_0x1027cd,null))['then'](function(_0x4b5f38){if(_0x4b5f38){_0x2ad14c[_0x7c0a('0x5f')][_0x7c0a('0x61')]=_0x4b5f38['id'];return db[_0x7c0a('0x62')]['create'](_0x2ad14c[_0x7c0a('0x5f')]);}})[_0x7c0a('0x23')](respondWithResult(_0x1027cd,null))[_0x7c0a('0x53')](handleError(_0x1027cd,null));};exports[_0x7c0a('0x63')]=function(_0x3938ae,_0x5d91bb,_0x11765f){var _0x5efe92={'raw':![],'where':{}};var _0x19366b={};var _0x3a4815={'count':0x0,'rows':[]};return db[_0x7c0a('0x3a')][_0x7c0a('0x64')]({'where':{'id':_0x3938ae[_0x7c0a('0x55')]['id']}})[_0x7c0a('0x23')](handleEntityNotFound(_0x5d91bb,null))[_0x7c0a('0x23')](function(_0x1482fe){if(_0x1482fe){_0x19366b[_0x7c0a('0x40')]=_['keys'](db[_0x7c0a('0x62')][_0x7c0a('0x3b')]);_0x19366b[_0x7c0a('0x3d')]=_[_0x7c0a('0x3c')](_0x3938ae[_0x7c0a('0x3d')]);_0x19366b[_0x7c0a('0x3e')]=_[_0x7c0a('0x3f')](_0x19366b['model'],_0x19366b['query']);_0x5efe92[_0x7c0a('0x42')]=_[_0x7c0a('0x3f')](_0x19366b[_0x7c0a('0x40')],qs['fields'](_0x3938ae[_0x7c0a('0x3d')][_0x7c0a('0x41')]));_0x5efe92[_0x7c0a('0x42')]=_0x5efe92[_0x7c0a('0x42')][_0x7c0a('0x43')]?_0x5efe92[_0x7c0a('0x42')]:_0x19366b[_0x7c0a('0x40')];if(!_0x3938ae[_0x7c0a('0x3d')][_0x7c0a('0x44')](_0x7c0a('0x45'))){_0x5efe92[_0x7c0a('0x46')]=qs[_0x7c0a('0x46')](_0x3938ae[_0x7c0a('0x3d')][_0x7c0a('0x46')]);_0x5efe92[_0x7c0a('0x47')]=qs[_0x7c0a('0x47')](_0x3938ae['query'][_0x7c0a('0x47')]);}_0x5efe92['order']=qs[_0x7c0a('0x49')](_0x3938ae[_0x7c0a('0x3d')]['sort']);_0x5efe92['where']=qs[_0x7c0a('0x3e')](_[_0x7c0a('0x4b')](_0x3938ae[_0x7c0a('0x3d')],_0x19366b[_0x7c0a('0x3e')]));_0x5efe92[_0x7c0a('0x4a')]['SmsAccountId']=_0x1482fe['id'];if(_0x3938ae[_0x7c0a('0x3d')][_0x7c0a('0x4c')]){_0x5efe92[_0x7c0a('0x4a')]=_[_0x7c0a('0x4d')](_0x5efe92[_0x7c0a('0x4a')],{'$or':_[_0x7c0a('0x4e')](_0x5efe92[_0x7c0a('0x42')],function(_0x2ca5a1){var _0x30f03f={};_0x30f03f[_0x2ca5a1]={'$like':'%'+_0x3938ae[_0x7c0a('0x3d')]['filter']+'%'};return _0x30f03f;})});}_0x5efe92=_['merge']({},_0x5efe92,_0x3938ae['options']);return db[_0x7c0a('0x62')][_0x7c0a('0x2f')]({'where':_0x5efe92[_0x7c0a('0x4a')]})[_0x7c0a('0x23')](function(_0x3ef7b5){_0x3a4815[_0x7c0a('0x2f')]=_0x3ef7b5;if(_0x3938ae['query'][_0x7c0a('0x56')]){_0x5efe92[_0x7c0a('0x52')]=[{'all':!![]}];}return db[_0x7c0a('0x62')][_0x7c0a('0x65')](_0x5efe92);})[_0x7c0a('0x23')](function(_0x5043f1){_0x3a4815['rows']=_0x5043f1;return _0x3a4815;});}})['then'](respondWithFilteredResult(_0x5d91bb,_0x5efe92))['catch'](handleError(_0x5d91bb,null));};exports[_0x7c0a('0x66')]=function(_0x397f1f,_0x3f7a92,_0xf2de97){var _0x49ee80;return db[_0x7c0a('0x3a')]['find']({'where':{'id':_0x397f1f[_0x7c0a('0x55')]['id']}})['then'](handleEntityNotFound(_0x3f7a92,null))['then'](function(_0x1eb99b){if(_0x1eb99b){return _0x1eb99b[_0x7c0a('0x66')](_0x397f1f[_0x7c0a('0x3d')][_0x7c0a('0x67')]);}})[_0x7c0a('0x23')](respondWithStatusCode(_0x3f7a92,null))['catch'](handleError(_0x3f7a92,null));};exports[_0x7c0a('0x68')]=function(_0x39a95f,_0x296b04,_0x2b14f6){if(_0x39a95f['body']['id']){delete _0x39a95f[_0x7c0a('0x5f')]['id'];}return db[_0x7c0a('0x3a')]['find']({'where':{'id':_0x39a95f['params']['id']}})['then'](handleEntityNotFound(_0x296b04,null))[_0x7c0a('0x23')](function(_0x261c10){if(_0x261c10){_0x39a95f[_0x7c0a('0x5f')][_0x7c0a('0x61')]=_0x261c10['id'];return db[_0x7c0a('0x69')][_0x7c0a('0x5d')](_0x39a95f[_0x7c0a('0x5f')]);}})[_0x7c0a('0x23')](respondWithResult(_0x296b04,null))['catch'](handleError(_0x296b04,null));};exports[_0x7c0a('0x6a')]=function(_0x49b4b6,_0x2a8936,_0x56040){var _0x2e83dc={'raw':![],'where':{}};var _0x2a41fb={};var _0x528930={'count':0x0,'rows':[]};return db[_0x7c0a('0x3a')][_0x7c0a('0x64')]({'where':{'id':_0x49b4b6[_0x7c0a('0x55')]['id']}})[_0x7c0a('0x23')](handleEntityNotFound(_0x2a8936,null))[_0x7c0a('0x23')](function(_0x4db357){if(_0x4db357){_0x2a41fb[_0x7c0a('0x40')]=_['keys'](db[_0x7c0a('0x69')][_0x7c0a('0x3b')]);_0x2a41fb[_0x7c0a('0x3d')]=_[_0x7c0a('0x3c')](_0x49b4b6[_0x7c0a('0x3d')]);_0x2a41fb[_0x7c0a('0x3e')]=_[_0x7c0a('0x3f')](_0x2a41fb['model'],_0x2a41fb[_0x7c0a('0x3d')]);_0x2e83dc[_0x7c0a('0x42')]=_[_0x7c0a('0x3f')](_0x2a41fb[_0x7c0a('0x40')],qs['fields'](_0x49b4b6['query'][_0x7c0a('0x41')]));_0x2e83dc['attributes']=_0x2e83dc[_0x7c0a('0x42')][_0x7c0a('0x43')]?_0x2e83dc[_0x7c0a('0x42')]:_0x2a41fb[_0x7c0a('0x40')];if(!_0x49b4b6[_0x7c0a('0x3d')][_0x7c0a('0x44')]('nolimit')){_0x2e83dc[_0x7c0a('0x46')]=qs[_0x7c0a('0x46')](_0x49b4b6[_0x7c0a('0x3d')][_0x7c0a('0x46')]);_0x2e83dc[_0x7c0a('0x47')]=qs[_0x7c0a('0x47')](_0x49b4b6[_0x7c0a('0x3d')][_0x7c0a('0x47')]);}_0x2e83dc[_0x7c0a('0x48')]=qs[_0x7c0a('0x49')](_0x49b4b6['query'][_0x7c0a('0x49')]);_0x2e83dc[_0x7c0a('0x4a')]=qs['filters'](_[_0x7c0a('0x4b')](_0x49b4b6[_0x7c0a('0x3d')],_0x2a41fb[_0x7c0a('0x3e')]));_0x2e83dc[_0x7c0a('0x4a')][_0x7c0a('0x61')]=_0x4db357['id'];if(_0x49b4b6[_0x7c0a('0x3d')]['filter']){_0x2e83dc[_0x7c0a('0x4a')]=_[_0x7c0a('0x4d')](_0x2e83dc[_0x7c0a('0x4a')],{'$or':_[_0x7c0a('0x4e')](_0x2e83dc[_0x7c0a('0x42')],function(_0x4ba03c){var _0x2d6376={};_0x2d6376[_0x4ba03c]={'$like':'%'+_0x49b4b6['query'][_0x7c0a('0x4c')]+'%'};return _0x2d6376;})});}_0x2e83dc=_['merge']({},_0x2e83dc,_0x49b4b6[_0x7c0a('0x51')]);return db[_0x7c0a('0x69')][_0x7c0a('0x2f')]({'where':_0x2e83dc['where']})[_0x7c0a('0x23')](function(_0x18f830){_0x528930[_0x7c0a('0x2f')]=_0x18f830;if(_0x49b4b6[_0x7c0a('0x3d')][_0x7c0a('0x56')]){_0x2e83dc[_0x7c0a('0x52')]=[{'all':!![]}];}return db[_0x7c0a('0x69')][_0x7c0a('0x65')](_0x2e83dc);})[_0x7c0a('0x23')](function(_0x565246){_0x528930['rows']=_0x565246;return _0x528930;});}})[_0x7c0a('0x23')](respondWithFilteredResult(_0x2a8936,_0x2e83dc))[_0x7c0a('0x53')](handleError(_0x2a8936,null));};exports['removeAnswers']=function(_0x4b1887,_0x22565e,_0x3567c9){var _0x1cdfaa;return db['SmsAccount'][_0x7c0a('0x57')]({'where':{'id':_0x4b1887[_0x7c0a('0x55')]['id']}})[_0x7c0a('0x23')](handleEntityNotFound(_0x22565e,null))['then'](function(_0x3c337b){if(_0x3c337b){return _0x3c337b['removeAnswers'](_0x4b1887[_0x7c0a('0x3d')]['ids']);}})[_0x7c0a('0x23')](respondWithStatusCode(_0x22565e,null))[_0x7c0a('0x53')](handleError(_0x22565e,null));};exports[_0x7c0a('0x6b')]=function(_0x491325,_0x2da9a1,_0x352c74){var _0x5b5504={'channel':_0x7c0a('0x6c')};var _0x44c5d7=[];var _0x59b298=[];var _0x1a6cc4={};return db[_0x7c0a('0x3a')]['find']({'where':{'id':_0x491325['params']['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0x7c0a('0x23')](handleEntityNotFound(_0x2da9a1,null))[_0x7c0a('0x23')](function(_0x3294fa){_0x5b5504[_0x7c0a('0x6d')]=_0x3294fa;_0x5b5504[_0x7c0a('0x6e')]=_[_0x7c0a('0x6f')](_0x3294fa[_0x7c0a('0x70')],[_0x7c0a('0x71')],[_0x7c0a('0x72')]);if(_0x5b5504[_0x7c0a('0x6d')][_0x7c0a('0x70')]){delete _0x5b5504[_0x7c0a('0x6d')][_0x7c0a('0x70')];}return db['CmContact'][_0x7c0a('0x60')]();})[_0x7c0a('0x23')](function(_0x111894){if(!_0x111894){throw new db[(_0x7c0a('0x73'))][(_0x7c0a('0x74'))]('no\x20available\x20attributes');}_0x44c5d7=_[_0x7c0a('0x75')](_[_0x7c0a('0x3c')](_0x111894),['createdAt','updatedAt']);_0x59b298=_[_0x7c0a('0x75')](_[_0x7c0a('0x3c')](_0x111894),[_0x7c0a('0x76'),_0x7c0a('0x77'),_0x7c0a('0x78'),_0x7c0a('0x79')]);_0x5b5504[_0x7c0a('0x5f')]={'mapKey':_0x7c0a('0x7a')};if(_0x5b5504[_0x7c0a('0x6d')][_0x7c0a('0x4f')]){switch(_0x5b5504[_0x7c0a('0x6d')][_0x7c0a('0x4f')]){case _0x7c0a('0x7b'):_0x5b5504['body'][_0x7c0a('0x7c')]=_0x491325[_0x7c0a('0x5f')]['From'];_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x5f')]=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x7d')];_0x5b5504['body'][_0x7c0a('0x7e')]=_0x491325['body'][_0x7c0a('0x7f')];break;case _0x7c0a('0x80'):_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7c')]='+'+_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x81')];_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x5f')]=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x82')];break;case _0x7c0a('0x83'):_0x5b5504[_0x7c0a('0x5f')]['from']=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x7c')];_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x5f')]=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x2b')];break;case _0x7c0a('0x84'):_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7c')]=_0x491325['body'][_0x7c0a('0x7c')];_0x5b5504['body'][_0x7c0a('0x5f')]=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x5f')];_0x5b5504['body'][_0x7c0a('0x7e')]=_0x491325[_0x7c0a('0x5f')]['message_id'];break;case _0x7c0a('0x85'):_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7c')]=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x86')];_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x5f')]=_0x491325['body']['Text'];_0x5b5504[_0x7c0a('0x5f')]['messageId']=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x87')];break;case _0x7c0a('0x88'):_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7c')]='+'+_0x491325['body'][_0x7c0a('0x89')][0x0][_0x7c0a('0x7c')];_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x5f')]=_0x491325[_0x7c0a('0x5f')]['results'][0x0][_0x7c0a('0x82')];_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7e')]=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x89')][0x0]['messageId'];break;case'csc':_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7c')]=_0x491325['body'][_0x7c0a('0x8a')];_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x5f')]=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x8b')]['message'];break;case _0x7c0a('0x8c'):_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7c')]=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x8d')];_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x5f')]=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x82')];_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7e')]=_0x491325['body'][_0x7c0a('0x8e')];break;case _0x7c0a('0x8f'):_0x5b5504[_0x7c0a('0x5f')]['from']=_0x491325['body'][_0x7c0a('0x7c')];_0x5b5504['body'][_0x7c0a('0x5f')]=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x2b')];_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7e')]=_0x491325[_0x7c0a('0x5f')][_0x7c0a('0x90')];break;}}if(_0x5b5504['body']['id']){delete _0x5b5504['body']['id'];}if(_['isNil'](_0x5b5504['body'][_0x7c0a('0x7c')])){throw new db[(_0x7c0a('0x73'))][(_0x7c0a('0x74'))](_0x7c0a('0x91'));}if(_[_0x7c0a('0x92')](_0x5b5504['body'][_0x7c0a('0x5f')])||_0x5b5504[_0x7c0a('0x5f')]['body']===''){throw new db[(_0x7c0a('0x73'))][(_0x7c0a('0x74'))](_0x7c0a('0x93'));}if(_[_0x7c0a('0x92')](_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x94')])){throw new db['Sequelize'][(_0x7c0a('0x74'))](_0x7c0a('0x95')+_0x59b298);}if(!_['includes'](_0x59b298,_0x5b5504['body'][_0x7c0a('0x94')])){throw new db[(_0x7c0a('0x73'))][(_0x7c0a('0x74'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x59b298);}_0x1a6cc4[_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x94')]]=_0x5b5504['body'][_0x7c0a('0x7c')];return db['CmList'][_0x7c0a('0x57')]({'where':{'id':_0x5b5504[_0x7c0a('0x6d')][_0x7c0a('0x79')]},'include':[{'model':db[_0x7c0a('0x96')],'as':'Contacts','where':_0x1a6cc4,'limit':0x1,'order':[['updatedAt',_0x7c0a('0x97')]]}]});})['then'](handleEntityNotFound(_0x2da9a1,null))[_0x7c0a('0x23')](function(_0x3f4063){if(_0x3f4063){_0x5b5504[_0x7c0a('0x98')]=_[_0x7c0a('0x99')](_0x3f4063,[_0x7c0a('0x9a')]);if(_0x3f4063[_0x7c0a('0x9a')][_0x7c0a('0x43')]){return _0x3f4063[_0x7c0a('0x9a')][0x0];}var _0x8c2851=_[_0x7c0a('0x1c')](_0x5b5504[_0x7c0a('0x5f')],{'firstName':_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7c')],'ListId':_0x3f4063['id']});_0x8c2851[_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x94')]]=_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7c')];return db['CmContact'][_0x7c0a('0x5d')](_0x8c2851,{'fields':_0x44c5d7,'raw':!![]});}})[_0x7c0a('0x23')](handleEntityNotFound(_0x2da9a1,null))[_0x7c0a('0x23')](function(_0x58e6ac){if(_0x58e6ac){_0x5b5504[_0x7c0a('0x9b')]=_0x58e6ac;var _0x22b7cd={'ContactId':_0x58e6ac['id'],'phone':_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7c')],'SmsAccountId':_0x491325['params']['id']};var _0x47bbf8={'ContactId':_0x58e6ac['id'],'SmsAccountId':_0x491325[_0x7c0a('0x55')]['id'],'closed':![]};return db[_0x7c0a('0x9c')][_0x7c0a('0x57')]({'where':_0x47bbf8})['then'](function(_0x5bc38b){if(_0x5bc38b){return[_0x5bc38b,![]];}return db[_0x7c0a('0x9c')][_0x7c0a('0x5d')](_0x22b7cd)[_0x7c0a('0x23')](function(_0xf9ec01){return[_0xf9ec01,!![]];});});}})[_0x7c0a('0x9d')](function(_0x3804f9,_0x1c6a3e){_0x5b5504[_0x7c0a('0x9e')]=_0x3804f9[_0x7c0a('0x35')]({'plain':!![]});_0x5b5504['interaction']['created']=![];if(_0x1c6a3e){if(_0x5b5504['account']['autoclose']){_0x5b5504[_0x7c0a('0x6e')][_0x7c0a('0x9f')]({'id':0x0,'priority':_0x5b5504[_0x7c0a('0x6e')][_0x7c0a('0x43')]+0x1,'app':'close','appdata':_0x7c0a('0xa0'),'interval':_0x7c0a('0xa1')});}_0x5b5504['interaction'][_0x7c0a('0xa2')]=!![];}return db[_0x7c0a('0xa3')][_0x7c0a('0x5d')]({'phone':_0x5b5504['body']['from'],'messageId':_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x7e')],'body':_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0x5f')],'SmsAccountId':_0x491325['params']['id'],'SmsInteractionId':_0x3804f9['id'],'direction':'in','ContactId':_0x3804f9[_0x7c0a('0xa4')],'AttachmentId':_0x5b5504[_0x7c0a('0x5f')][_0x7c0a('0xa5')]});})[_0x7c0a('0x23')](function(_0x1a0d84){_0x5b5504['message']=_0x1a0d84;if(_0x5b5504['interaction']['UserId']){return db[_0x7c0a('0xa6')][_0x7c0a('0x57')]({'attributes':['id','name'],'where':{'id':_0x5b5504[_0x7c0a('0x9e')]['UserId']}})[_0x7c0a('0x23')](function(_0x1f7594){if(_0x1f7594){_0x5b5504[_0x7c0a('0x6e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7c0a('0xa7'),'appdata':_0x1f7594[_0x7c0a('0x5e')]+','+(_0x5b5504[_0x7c0a('0x6d')][_0x7c0a('0xa8')]||0xa),'interval':_0x7c0a('0xa1')});}return respondWithRpcPromise(_0x7c0a('0xa9'),'startRouting',_0x5b5504);});}return respondWithRpcPromise(_0x7c0a('0xa9'),_0x7c0a('0xaa'),_0x5b5504);})['then'](function(_0x4925fb){if(_0x4925fb){var _0x14797b=0xc8;var _0x1eb0fb=_0x7c0a('0xab');logger['info'](_0x7c0a('0x26'),_0x1eb0fb,_0x14797b,'entity\x20found');logger[_0x7c0a('0x25')](_0x7c0a('0xac'),_0x1eb0fb,_0x14797b,_0x7c0a('0xad'),JSON['stringify'](_0x4925fb));if(_0x5b5504[_0x7c0a('0x6d')][_0x7c0a('0x4f')]===_0x7c0a('0x7b')){return _0x2da9a1['status'](_0x14797b)['set']('Content-Type',_0x7c0a('0xae'))['send']('\x0a');}else{return _0x2da9a1['status'](_0x14797b)[_0x7c0a('0x2e')](_0x4925fb);}}})[_0x7c0a('0x53')](handleError(_0x2da9a1,null));};exports[_0x7c0a('0xaf')]=function(_0x44dc6f,_0x3e57ec,_0x261153){return db[_0x7c0a('0x3a')]['findOne']({'where':{'id':_0x44dc6f[_0x7c0a('0x55')]['id']}})[_0x7c0a('0x23')](handleEntityNotFound(_0x3e57ec,null))[_0x7c0a('0x23')](function(_0x311aaf){if(_0x311aaf){return db['sequelize']['transaction'](function(_0x51f45b){return db[_0x7c0a('0xb0')]['destroy']({'where':{'SmsAccountId':_0x44dc6f[_0x7c0a('0x55')]['id']},'transaction':_0x51f45b})[_0x7c0a('0x23')](function(_0x27225f){var _0x52fca7=_['map'](_0x44dc6f[_0x7c0a('0x5f')],function(_0x2338dc){_0x2338dc[_0x7c0a('0x61')]=_0x44dc6f['params']['id'];return _0x2338dc;});return db[_0x7c0a('0xb0')][_0x7c0a('0xb1')](_0x52fca7,{'transaction':_0x51f45b});});})['then'](function(){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x44dc6f[_0x7c0a('0x55')]['id']},'order':_0x7c0a('0x71')});});}})[_0x7c0a('0x23')](respondWithResult(_0x3e57ec,null))[_0x7c0a('0x53')](handleError(_0x3e57ec,null));};exports['getApplications']=function(_0x4bd9e2,_0xf88ca5,_0x1a9696){var _0x3daa61={};var _0x4e9abd={};var _0x1fdf61;var _0x1d4bfa;return db[_0x7c0a('0x3a')][_0x7c0a('0x64')]({'where':{'id':_0x4bd9e2[_0x7c0a('0x55')]['id']}})[_0x7c0a('0x23')](handleEntityNotFound(_0xf88ca5,null))['then'](function(_0x289fb2){if(_0x289fb2){_0x1fdf61=_0x289fb2;_0x4e9abd[_0x7c0a('0x40')]=_[_0x7c0a('0x3c')](db[_0x7c0a('0xb0')][_0x7c0a('0x3b')]);_0x4e9abd[_0x7c0a('0x3d')]=_[_0x7c0a('0x3c')](_0x4bd9e2[_0x7c0a('0x3d')]);_0x4e9abd[_0x7c0a('0x3e')]=_[_0x7c0a('0x3f')](_0x4e9abd[_0x7c0a('0x40')],_0x4e9abd[_0x7c0a('0x3d')]);_0x3daa61[_0x7c0a('0x42')]=_[_0x7c0a('0x3f')](_0x4e9abd[_0x7c0a('0x40')],qs[_0x7c0a('0x41')](_0x4bd9e2[_0x7c0a('0x3d')][_0x7c0a('0x41')]));_0x3daa61['attributes']=_0x3daa61['attributes'][_0x7c0a('0x43')]?_0x3daa61[_0x7c0a('0x42')]:_0x4e9abd['model'];_0x3daa61[_0x7c0a('0x48')]=qs['sort'](_0x4bd9e2[_0x7c0a('0x3d')][_0x7c0a('0x49')]);_0x3daa61[_0x7c0a('0x4a')]=qs[_0x7c0a('0x3e')](_[_0x7c0a('0x4b')](_0x4bd9e2[_0x7c0a('0x3d')],_0x4e9abd['filters']));if(_0x4bd9e2[_0x7c0a('0x3d')][_0x7c0a('0x4c')]){_0x3daa61[_0x7c0a('0x4a')]=_['merge'](_0x3daa61[_0x7c0a('0x4a')],{'$or':_['map'](_0x3daa61[_0x7c0a('0x42')],function(_0x542c4d){var _0x268f10={};_0x268f10[_0x542c4d]={'$like':'%'+_0x4bd9e2[_0x7c0a('0x3d')][_0x7c0a('0x4c')]+'%'};return _0x268f10;})});}_0x3daa61=_['merge']({},_0x3daa61,_0x4bd9e2[_0x7c0a('0x51')]);return _0x1fdf61[_0x7c0a('0xb2')](_0x3daa61);}})[_0x7c0a('0x23')](function(_0x302014){if(_0x302014){_0x1d4bfa=_0x302014[_0x7c0a('0x43')];if(!_0x4bd9e2[_0x7c0a('0x3d')]['hasOwnProperty']('nolimit')){_0x3daa61[_0x7c0a('0x46')]=qs[_0x7c0a('0x46')](_0x4bd9e2[_0x7c0a('0x3d')]['limit']);_0x3daa61['offset']=qs['offset'](_0x4bd9e2['query'][_0x7c0a('0x47')]);}return _0x1fdf61[_0x7c0a('0xb2')](_0x3daa61);}})[_0x7c0a('0x23')](function(_0x4c4b81){if(_0x4c4b81){return _0x4c4b81?{'count':_0x1d4bfa,'rows':_0x4c4b81}:null;}})[_0x7c0a('0x23')](respondWithResult(_0xf88ca5,null))['catch'](handleError(_0xf88ca5,null));};exports[_0x7c0a('0xb3')]=function(_0x393c4e,_0x306ddd,_0x46448c){var _0x462c06={'raw':![],'where':{}};var _0x23c286={};var _0x5da184={'count':0x0,'rows':[]};return db[_0x7c0a('0x3a')][_0x7c0a('0x64')]({'where':{'id':_0x393c4e[_0x7c0a('0x55')]['id']}})['then'](handleEntityNotFound(_0x306ddd,null))['then'](function(_0x57b42d){if(_0x57b42d){_0x23c286[_0x7c0a('0x40')]=_[_0x7c0a('0x3c')](db['SmsInteraction']['rawAttributes']);_0x23c286[_0x7c0a('0x3d')]=_[_0x7c0a('0x3c')](_0x393c4e['query']);_0x23c286[_0x7c0a('0x3e')]=_[_0x7c0a('0x3f')](_0x23c286[_0x7c0a('0x40')],_0x23c286[_0x7c0a('0x3d')]);_0x462c06[_0x7c0a('0x42')]=_[_0x7c0a('0x3f')](_0x23c286[_0x7c0a('0x40')],qs[_0x7c0a('0x41')](_0x393c4e[_0x7c0a('0x3d')]['fields']));_0x462c06[_0x7c0a('0x42')]=_0x462c06[_0x7c0a('0x42')][_0x7c0a('0x43')]?_0x462c06[_0x7c0a('0x42')]:_0x23c286[_0x7c0a('0x40')];if(!_0x393c4e[_0x7c0a('0x3d')][_0x7c0a('0x44')]('nolimit')){_0x462c06[_0x7c0a('0x46')]=qs[_0x7c0a('0x46')](_0x393c4e[_0x7c0a('0x3d')]['limit']);_0x462c06[_0x7c0a('0x47')]=qs[_0x7c0a('0x47')](_0x393c4e[_0x7c0a('0x3d')]['offset']);}_0x462c06[_0x7c0a('0x48')]=qs[_0x7c0a('0x49')](_0x393c4e['query'][_0x7c0a('0x49')]);_0x462c06[_0x7c0a('0x4a')]=qs[_0x7c0a('0x3e')](_[_0x7c0a('0x4b')](_0x393c4e['query'],_0x23c286[_0x7c0a('0x3e')]));_0x462c06[_0x7c0a('0x4a')][_0x7c0a('0x61')]=_0x57b42d['id'];if(_0x393c4e[_0x7c0a('0x3d')][_0x7c0a('0x4c')]){_0x462c06[_0x7c0a('0x4a')]=_['merge'](_0x462c06[_0x7c0a('0x4a')],{'$or':_['map'](_0x462c06[_0x7c0a('0x42')],function(_0x1eb59e){var _0x5d8140={};_0x5d8140[_0x1eb59e]={'$like':'%'+_0x393c4e[_0x7c0a('0x3d')][_0x7c0a('0x4c')]+'%'};return _0x5d8140;})});}_0x462c06=_[_0x7c0a('0x4d')]({},_0x462c06,_0x393c4e[_0x7c0a('0x51')]);return db[_0x7c0a('0x9c')][_0x7c0a('0x2f')]({'where':_0x462c06['where']})[_0x7c0a('0x23')](function(_0x7cfa3e){_0x5da184[_0x7c0a('0x2f')]=_0x7cfa3e;if(_0x393c4e[_0x7c0a('0x3d')][_0x7c0a('0x56')]){_0x462c06[_0x7c0a('0x52')]=[{'model':db[_0x7c0a('0x96')],'as':_0x7c0a('0xb4'),'required':![]},{'model':db[_0x7c0a('0xa6')],'as':_0x7c0a('0xb5'),'attributes':[_0x7c0a('0x5e'),_0x7c0a('0xb6'),_0x7c0a('0xb7')],'required':![]},{'model':db[_0x7c0a('0xb8')],'as':_0x7c0a('0xb9'),'attributes':['id',_0x7c0a('0x5e'),_0x7c0a('0xba')],'where':_0x393c4e['query'][_0x7c0a('0xbb')]?{'id':_0x393c4e[_0x7c0a('0x3d')][_0x7c0a('0xbb')]}:undefined,'required':_0x393c4e['query'][_0x7c0a('0xbb')]?!![]:![]}];}return db[_0x7c0a('0x9c')]['findAll'](_0x462c06);})[_0x7c0a('0x23')](function(_0x3335be){_0x5da184['rows']=_0x3335be;return _0x5da184;});}})['then'](respondWithFilteredResult(_0x306ddd,_0x462c06))['catch'](handleError(_0x306ddd,null));};exports[_0x7c0a('0xbc')]=function(_0x34f868,_0xfdc604,_0x1c31b1){var _0xe7edf8,_0x46716c,_0x24ef9a;if(_[_0x7c0a('0x92')](_0x34f868[_0x7c0a('0x5f')][_0x7c0a('0x5f')])||_0x34f868[_0x7c0a('0x5f')][_0x7c0a('0x5f')]===''){throw new db['Sequelize']['ValidationError'](_0x7c0a('0x93'));}if(_['isNil'](_0x34f868[_0x7c0a('0x5f')]['to'])){throw new db[(_0x7c0a('0x73'))][(_0x7c0a('0x74'))](_0x7c0a('0xbd'));}_0xe7edf8=_0x34f868[_0x7c0a('0x5f')]['to'];return db['SmsAccount'][_0x7c0a('0x57')]({'where':{'id':_0x34f868[_0x7c0a('0x55')]['id']},'include':[{'model':db[_0x7c0a('0xbe')],'as':_0x7c0a('0xbf'),'include':[{'model':db[_0x7c0a('0x96')],'as':_0x7c0a('0x9a'),'where':{'mobile':_0xe7edf8},'limit':0x1,'order':[[_0x7c0a('0x77'),_0x7c0a('0x97')]]}]}]})[_0x7c0a('0x23')](handleEntityNotFound(_0xfdc604,null))[_0x7c0a('0x23')](function(_0x382543){if(_0x382543&&_0x382543[_0x7c0a('0xbf')]){_0x46716c=_0x382543[_0x7c0a('0x35')]({'plain':!![]});if(_0x46716c[_0x7c0a('0xbf')]&&_0x46716c[_0x7c0a('0xbf')]['Contacts'][_0x7c0a('0x43')]){return _0x46716c[_0x7c0a('0xbf')][_0x7c0a('0x9a')][0x0];}return db['CmContact'][_0x7c0a('0x5d')](_[_0x7c0a('0x1c')](_0x34f868[_0x7c0a('0x5f')],{'firstName':_0xe7edf8,'mobile':_0xe7edf8,'phone':_0xe7edf8,'ListId':_0x46716c[_0x7c0a('0x79')]}));}})[_0x7c0a('0x23')](handleEntityNotFound(_0xfdc604,null))[_0x7c0a('0x23')](function(_0x35007c){if(_0x35007c){_0x24ef9a=_0x35007c;return db[_0x7c0a('0x9c')][_0x7c0a('0x57')]({'where':{'ContactId':_0x24ef9a['id'],'closed':![],'SmsAccountId':_0x46716c['id']}})['then'](function(_0x343ba0){if(_0x343ba0){return[_0x343ba0,![]];}return db[_0x7c0a('0x9c')][_0x7c0a('0x5d')]({'UserId':_0x34f868[_0x7c0a('0x59')]['id'],'ContactId':_0x24ef9a['id'],'SmsAccountId':_0x46716c['id'],'phone':_0xe7edf8,'firstMsgDirection':'out','Messages':[_[_0x7c0a('0x4d')](_0x34f868['body'],{'read':![],'body':_0x34f868[_0x7c0a('0x5f')][_0x7c0a('0x5f')],'phone':_0xe7edf8,'SmsAccountId':_0x46716c['id'],'UserId':_0x34f868[_0x7c0a('0x59')]['id'],'ContactId':_0x24ef9a['id']})]},{'include':[{'model':db[_0x7c0a('0xa3')],'as':_0x7c0a('0xc0')}]})[_0x7c0a('0x23')](function(_0x571444){return[_0x571444,!![]];});});}})[_0x7c0a('0x9d')](function(_0x877832,_0x59ebe4){if(_0x59ebe4){return _0x877832;}return db[_0x7c0a('0xa3')]['create'](_['merge'](_0x34f868[_0x7c0a('0x5f')],{'read':![],'body':_0x34f868[_0x7c0a('0x5f')][_0x7c0a('0x5f')],'phone':_0xe7edf8,'SmsAccountId':_0x46716c['id'],'SmsInteractionId':_0x877832['id'],'UserId':_0x34f868['user']['id'],'ContactId':_0x24ef9a['id']}))[_0x7c0a('0x23')](function(_0x48358e){_0x877832['dataValues']['Messages']=[];_0x877832[_0x7c0a('0xc1')]['Messages'][_0x7c0a('0x9f')](_0x48358e['dataValues']);return _0x877832;});})[_0x7c0a('0x23')](respondWithResult(_0xfdc604,null))[_0x7c0a('0x53')](handleError(_0xfdc604,null));};exports[_0x7c0a('0x2c')]=function(_0x4b1bca,_0x4639a6,_0x29006f){if(_0x4b1bca[_0x7c0a('0x5f')]['id']){delete _0x4b1bca[_0x7c0a('0x5f')]['id'];}console[_0x7c0a('0xc2')]('endpoint\x20/status\x20POST\x20/',_0x4b1bca[_0x7c0a('0x5f')]);var _0x5b1d80,_0x286f16,_0xf2e480;return db[_0x7c0a('0x3a')][_0x7c0a('0x57')]({'where':{'id':_0x4b1bca['params']['id']}})[_0x7c0a('0x23')](handleEntityNotFound(_0x4639a6,null))['then'](function(_0x5aa2ef){if(_0x5aa2ef){_0xf2e480=_0x5aa2ef;logger[_0x7c0a('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7c0a('0x2c'),_0x7c0a('0xc3'),_0x5aa2ef['type'],util[_0x7c0a('0xc4')](_0x4b1bca[_0x7c0a('0x5f')],{'showHidden':![],'depth':null}));switch(_0x5aa2ef[_0x7c0a('0x4f')]){case _0x7c0a('0x80'):if(_0x4b1bca['body'][_0x7c0a('0xc5')]&&_0x4b1bca[_0x7c0a('0x5f')]['status']){_0x286f16=_0x4b1bca['body']['status'];return db['SmsMessage'][_0x7c0a('0x57')]({'where':{'messageId':_0x4b1bca[_0x7c0a('0x5f')]['skebby_dispatch_id']}});}break;case _0x7c0a('0x83'):if(_0x4b1bca['body']['requestid']&&_0x4b1bca[_0x7c0a('0x5f')][_0x7c0a('0xc6')]){_0x286f16=_0x4b1bca[_0x7c0a('0x5f')][_0x7c0a('0xc6')];return db[_0x7c0a('0xa3')]['find']({'where':{'messageId':_0x4b1bca['body'][_0x7c0a('0xc7')]}});}break;case _0x7c0a('0x84'):if(_0x4b1bca['body'][_0x7c0a('0xc8')]&&_0x4b1bca[_0x7c0a('0x5f')][_0x7c0a('0xc9')]){_0x286f16=_0x4b1bca[_0x7c0a('0x5f')]['status_code'];return db['SmsMessage'][_0x7c0a('0x57')]({'where':{'messageId':_0x4b1bca['body'][_0x7c0a('0xc8')]}});}break;case _0x7c0a('0x88'):var _0x33826b=_0x4b1bca[_0x7c0a('0x5f')][_0x7c0a('0x89')][0x0];if(_0x33826b[_0x7c0a('0x7e')]&&_0x33826b[_0x7c0a('0x2c')][_0x7c0a('0xca')]===_0x7c0a('0xcb')){_0x286f16=_0x33826b[_0x7c0a('0x2c')][_0x7c0a('0xca')];return db[_0x7c0a('0xa3')]['find']({'where':{'messageId':_0x33826b[_0x7c0a('0x7e')]}});}break;case _0x7c0a('0x8c'):if(_0x4b1bca[_0x7c0a('0x5f')][_0x7c0a('0x7e')]&&_0x4b1bca['body'][_0x7c0a('0x2c')]){_0x286f16=_0x4b1bca['body'][_0x7c0a('0x2c')];return db[_0x7c0a('0xa3')][_0x7c0a('0x57')]({'where':{'messageId':_0x4b1bca[_0x7c0a('0x5f')][_0x7c0a('0x7e')]}});}break;case'intelepeer':if(_0x4b1bca['body'][_0x7c0a('0xcc')]&&_0x4b1bca[_0x7c0a('0x5f')][_0x7c0a('0x2c')]){_0x286f16=_0x4b1bca['body']['status'];return db[_0x7c0a('0xa3')][_0x7c0a('0x57')]({'where':{'messageId':_0x4b1bca[_0x7c0a('0x5f')][_0x7c0a('0xcc')]}});}break;}}})['then'](handleEntityNotFound(_0x4639a6,null))['then'](function(_0xf1f28f){if(_0xf1f28f){_0x5b1d80=_0xf1f28f;switch(_0xf2e480[_0x7c0a('0x4f')]){case _0x7c0a('0x80'):if(_0x286f16===_0x7c0a('0xcb')){return _0x5b1d80[_0x7c0a('0x33')]({'read':!![]});}else{logger['error'](_0x7c0a('0x26'),_0x7c0a('0x2c'),_0x7c0a('0x80'),util['inspect'](_0x4b1bca['body'],{'showHidden':![],'depth':null}));}break;case _0x7c0a('0x83'):if(_0x286f16==='1'){return _0x5b1d80[_0x7c0a('0x33')]({'read':!![]});}else{logger[_0x7c0a('0x28')](_0x7c0a('0x26'),_0x7c0a('0x2c'),_0x7c0a('0x80'),util[_0x7c0a('0xc4')](_0x4b1bca[_0x7c0a('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x7c0a('0x84'):if(!_0x4b1bca['body']['error_code']&&_0x286f16>=0xc8&&_0x286f16<=0xce){return _0x5b1d80[_0x7c0a('0x33')]({'read':!![]});}else{logger[_0x7c0a('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x7c0a('0x84'),util[_0x7c0a('0xc4')](_0x4b1bca['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2e4e01=_0x4b1bca[_0x7c0a('0x5f')]['results'][0x0];if(_0x2e4e01['status'][_0x7c0a('0xca')]==='DELIVERED'){return _0x5b1d80[_0x7c0a('0x33')]({'read':!![]});}else{logger[_0x7c0a('0x28')](_0x7c0a('0x26'),_0x7c0a('0x2c'),'infobip',util[_0x7c0a('0xc4')](_0x4b1bca[_0x7c0a('0x5f')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x286f16=='DELIVERED_TO_GATEWAY'||_0x286f16==_0x7c0a('0xcd')){return _0x5b1d80[_0x7c0a('0x33')]({'read':!![]});}else{logger[_0x7c0a('0x28')](_0x7c0a('0x26'),_0x7c0a('0x2c'),_0x7c0a('0x8c'),util[_0x7c0a('0xc4')](_0x4b1bca[_0x7c0a('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x7c0a('0x8f'):if(_0x286f16===_0x7c0a('0xce')||_0x286f16==='ACCEPTD'){return _0x5b1d80[_0x7c0a('0x33')]({'read':!![]});}else{logger[_0x7c0a('0x28')](_0x7c0a('0x26'),_0x7c0a('0x2c'),_0x7c0a('0x8f'),util[_0x7c0a('0xc4')](_0x4b1bca[_0x7c0a('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x5b1d80;}})['then'](respondWithResult(_0x4639a6,null))[_0x7c0a('0x53')](handleError(_0x4639a6,null));};exports[_0x7c0a('0xcf')]=function(_0xd01e50,_0x1d33c9,_0x2cb80e){var _0x2dbaaa,_0x4f8b03,_0xb1bd2e;return db['SmsAccount'][_0x7c0a('0x57')]({'where':{'id':_0xd01e50[_0x7c0a('0x55')]['id']}})[_0x7c0a('0x23')](handleEntityNotFound(_0x1d33c9,null))['then'](function(_0x43ead8){if(_0x43ead8){_0xb1bd2e=_0x43ead8;logger[_0x7c0a('0x25')](_0x7c0a('0x26'),_0x7c0a('0x2c'),_0x7c0a('0xc3'),_0x43ead8[_0x7c0a('0x4f')],util[_0x7c0a('0xc4')](_0xd01e50[_0x7c0a('0x3d')],{'showHidden':![],'depth':null}));switch(_0x43ead8['type']){case _0x7c0a('0xd0'):if(_0xd01e50[_0x7c0a('0x3d')][_0x7c0a('0xd1')]&&_0xd01e50[_0x7c0a('0x3d')][_0x7c0a('0xd2')]){_0x4f8b03=_0xd01e50[_0x7c0a('0x3d')][_0x7c0a('0xd2')];return db[_0x7c0a('0xa3')]['find']({'where':{'messageId':_0xd01e50[_0x7c0a('0x3d')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x1d33c9,null))['then'](function(_0x21e6b5){if(_0x21e6b5){_0x2dbaaa=_0x21e6b5;switch(_0xb1bd2e[_0x7c0a('0x4f')]){case _0x7c0a('0xd0'):if(_0x4f8b03==='2'||_0x4f8b03==='6'){return _0x2dbaaa[_0x7c0a('0x33')]({'read':!![]});}else{logger[_0x7c0a('0x28')](_0x7c0a('0x26'),_0x7c0a('0x2c'),_0x7c0a('0xd0'),util['inspect'](_0xd01e50[_0x7c0a('0x3d')],{'showHidden':![],'depth':null}));};break;}return _0x2dbaaa;}})[_0x7c0a('0x23')](respondWithResult(_0x1d33c9,null))['catch'](handleError(_0x1d33c9,null));};exports[_0x7c0a('0xd3')]=function(_0x2399cb,_0x514760,_0x5e19e0){return db[_0x7c0a('0x3a')][_0x7c0a('0x57')]({'where':{'id':_0x2399cb['params']['id']}})[_0x7c0a('0x23')](handleEntityNotFound(_0x514760,null))['then'](function(_0x39a6f0){if(_0x39a6f0){return _0x39a6f0[_0x7c0a('0xd3')](_0x2399cb[_0x7c0a('0x5f')][_0x7c0a('0x67')],_[_0x7c0a('0x99')](_0x2399cb[_0x7c0a('0x5f')],[_0x7c0a('0x67'),'id'])||{})[_0x7c0a('0x9d')](function(_0x43e3ee){for(var _0x3db521=0x0;_0x3db521<_0x2399cb[_0x7c0a('0x5f')][_0x7c0a('0x67')][_0x7c0a('0x43')];_0x3db521+=0x1){socket[_0x7c0a('0xd4')]('userSmsAccount:save',{'UserId':_0x2399cb[_0x7c0a('0x5f')][_0x7c0a('0x67')][_0x3db521],'SmsAccountId':_0x2399cb['params']['id']});}return _0x43e3ee;});}})[_0x7c0a('0x23')](respondWithResult(_0x514760,null))[_0x7c0a('0x53')](handleError(_0x514760,null));};exports[_0x7c0a('0xd5')]=function(_0x5bf4c6,_0x494cf2,_0x4601c9){var _0x32362d;return db[_0x7c0a('0x3a')][_0x7c0a('0x57')]({'where':{'id':_0x5bf4c6[_0x7c0a('0x55')]['id']}})['then'](handleEntityNotFound(_0x494cf2,null))[_0x7c0a('0x23')](function(_0x378a94){if(_0x378a94){return _0x378a94[_0x7c0a('0xd5')](_0x5bf4c6[_0x7c0a('0x3d')]['ids'])['then'](function(_0x4105e8){if(_[_0x7c0a('0xd6')](_0x5bf4c6[_0x7c0a('0x3d')][_0x7c0a('0x67')])){for(var _0x50870e=0x0;_0x50870e<_0x5bf4c6[_0x7c0a('0x3d')][_0x7c0a('0x67')][_0x7c0a('0x43')];_0x50870e+=0x1){socket[_0x7c0a('0xd4')](_0x7c0a('0xd7'),{'UserId':_0x5bf4c6[_0x7c0a('0x3d')][_0x7c0a('0x67')][_0x50870e],'SmsAccountId':_0x5bf4c6['params']['id']});}}else{socket[_0x7c0a('0xd4')](_0x7c0a('0xd7'),{'UserId':_0x5bf4c6[_0x7c0a('0x3d')][_0x7c0a('0x67')],'SmsAccountId':_0x5bf4c6[_0x7c0a('0x55')]['id']});}});}})[_0x7c0a('0x23')](respondWithStatusCode(_0x494cf2,null))['catch'](handleError(_0x494cf2,null));};exports[_0x7c0a('0xd8')]=function(_0x543ee9,_0x1a5b70,_0x1d592d){var _0x5471f8={};var _0x535b49={};var _0x5ab2b8;var _0x4ab16f;return db[_0x7c0a('0x3a')][_0x7c0a('0x64')]({'where':{'id':_0x543ee9[_0x7c0a('0x55')]['id']}})[_0x7c0a('0x23')](handleEntityNotFound(_0x1a5b70,null))['then'](function(_0x23c4f1){if(_0x23c4f1){_0x5ab2b8=_0x23c4f1;_0x535b49[_0x7c0a('0x40')]=_[_0x7c0a('0x3c')](db[_0x7c0a('0xa6')][_0x7c0a('0x3b')]);_0x535b49['query']=_[_0x7c0a('0x3c')](_0x543ee9[_0x7c0a('0x3d')]);_0x535b49[_0x7c0a('0x3e')]=_[_0x7c0a('0x3f')](_0x535b49[_0x7c0a('0x40')],_0x535b49[_0x7c0a('0x3d')]);_0x5471f8[_0x7c0a('0x42')]=_[_0x7c0a('0x3f')](_0x535b49[_0x7c0a('0x40')],qs[_0x7c0a('0x41')](_0x543ee9[_0x7c0a('0x3d')]['fields']));_0x5471f8[_0x7c0a('0x42')]=_0x5471f8[_0x7c0a('0x42')][_0x7c0a('0x43')]?_0x5471f8['attributes']:_0x535b49[_0x7c0a('0x40')];_0x5471f8[_0x7c0a('0x48')]=qs[_0x7c0a('0x49')](_0x543ee9['query']['sort']);_0x5471f8[_0x7c0a('0x4a')]=qs[_0x7c0a('0x3e')](_[_0x7c0a('0x4b')](_0x543ee9[_0x7c0a('0x3d')],_0x535b49[_0x7c0a('0x3e')]));if(_0x543ee9[_0x7c0a('0x3d')]['filter']){_0x5471f8[_0x7c0a('0x4a')]=_[_0x7c0a('0x4d')](_0x5471f8[_0x7c0a('0x4a')],{'$or':_[_0x7c0a('0x4e')](_0x5471f8['attributes'],function(_0x1906bb){var _0x17cd3d={};_0x17cd3d[_0x1906bb]={'$like':'%'+_0x543ee9[_0x7c0a('0x3d')][_0x7c0a('0x4c')]+'%'};return _0x17cd3d;})});}_0x5471f8=_[_0x7c0a('0x4d')]({},_0x5471f8,_0x543ee9[_0x7c0a('0x51')]);return _0x5ab2b8[_0x7c0a('0xd8')](_0x5471f8);}})[_0x7c0a('0x23')](function(_0x143be8){if(_0x143be8){_0x4ab16f=_0x143be8[_0x7c0a('0x43')];if(!_0x543ee9[_0x7c0a('0x3d')][_0x7c0a('0x44')](_0x7c0a('0x45'))){_0x5471f8[_0x7c0a('0x46')]=qs['limit'](_0x543ee9[_0x7c0a('0x3d')]['limit']);_0x5471f8['offset']=qs['offset'](_0x543ee9[_0x7c0a('0x3d')][_0x7c0a('0x47')]);}return _0x5ab2b8['getAgents'](_0x5471f8);}})[_0x7c0a('0x23')](function(_0x5f5368){if(_0x5f5368){return _0x5f5368?{'count':_0x4ab16f,'rows':_0x5f5368}:null;}})[_0x7c0a('0x23')](respondWithResult(_0x1a5b70,null))[_0x7c0a('0x53')](handleError(_0x1a5b70,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 389a2de..53e0558 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 _0x08d8=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x548d5c,_0x3e305e){var _0x145401=function(_0x191af5){while(--_0x191af5){_0x548d5c['push'](_0x548d5c['shift']());}};_0x145401(++_0x3e305e);}(_0x08d8,0xce));var _0x808d=function(_0x444e8b,_0x3524cc){_0x444e8b=_0x444e8b-0x0;var _0x35eb37=_0x08d8[_0x444e8b];return _0x35eb37;};'use strict';var EventEmitter=require(_0x808d('0x0'));var SmsAccount=require(_0x808d('0x1'))['db'][_0x808d('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x808d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x808d('0x4'),'afterDestroy':_0x808d('0x5')};function emitEvent(_0x109e7f){return function(_0x1323c3,_0x451959,_0x14c9df){SmsAccountEvents[_0x808d('0x6')](_0x109e7f+':'+_0x1323c3['id'],_0x1323c3);SmsAccountEvents[_0x808d('0x6')](_0x109e7f,_0x1323c3);_0x14c9df(null);};}for(var e in events){if(events[_0x808d('0x7')](e)){var event=events[e];SmsAccount[_0x808d('0x8')](e,emitEvent(event));}}module[_0x808d('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xfce7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','save','update','remove'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfce7,0x13a));var _0x7fce=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0xfce7[_0x2b9e8a];return _0x520e67;};'use strict';var EventEmitter=require(_0x7fce('0x0'));var SmsAccount=require(_0x7fce('0x1'))['db'][_0x7fce('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7fce('0x3'),'afterUpdate':_0x7fce('0x4'),'afterDestroy':_0x7fce('0x5')};function emitEvent(_0x1c8a75){return function(_0x3c1d6a,_0x2b6960,_0x2ccc3a){SmsAccountEvents[_0x7fce('0x6')](_0x1c8a75+':'+_0x3c1d6a['id'],_0x3c1d6a);SmsAccountEvents['emit'](_0x1c8a75,_0x3c1d6a);_0x2ccc3a(null);};}for(var e in events){if(events[_0x7fce('0x7')](e)){var event=events[e];SmsAccount[_0x7fce('0x8')](e,emitEvent(event));}}module[_0x7fce('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index a894fd4..23c80ac 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 _0xc6aa=['request-promise','./smsAccount.attributes','exports','define','SmsAccount','lodash','api','bluebird'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xc6aa,0x75));var _0xac6a=function(_0x51df9c,_0x597b24){_0x51df9c=_0x51df9c-0x0;var _0x1bdb68=_0xc6aa[_0x51df9c];return _0x1bdb68;};'use strict';var _=require(_0xac6a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xac6a('0x1'));var moment=require('moment');var BPromise=require(_0xac6a('0x2'));var rp=require(_0xac6a('0x3'));var attributes=require(_0xac6a('0x4'));module[_0xac6a('0x5')]=function(_0x3164b7,_0xabeed7){return _0x3164b7[_0xac6a('0x6')](_0xac6a('0x7'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c2=['define','sms_accounts','util','../../config/logger','api','moment','bluebird','request-promise','./smsAccount.attributes','exports'];(function(_0x32431d,_0x5d8320){var _0x11efea=function(_0x7adca5){while(--_0x7adca5){_0x32431d['push'](_0x32431d['shift']());}};_0x11efea(++_0x5d8320);}(_0xb4c2,0x19c));var _0x2b4c=function(_0x3ce422,_0x170bef){_0x3ce422=_0x3ce422-0x0;var _0x39e306=_0xb4c2[_0x3ce422];return _0x39e306;};'use strict';var _=require('lodash');var util=require(_0x2b4c('0x0'));var logger=require(_0x2b4c('0x1'))(_0x2b4c('0x2'));var moment=require(_0x2b4c('0x3'));var BPromise=require(_0x2b4c('0x4'));var rp=require(_0x2b4c('0x5'));var attributes=require(_0x2b4c('0x6'));module[_0x2b4c('0x7')]=function(_0x11a289,_0x682899){return _0x11a289[_0x2b4c('0x8')]('SmsAccount',attributes,{'tableName':_0x2b4c('0x9'),'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 1c80e12..0c5b3b5 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 _0x96fb=['socket.io-emitter','register','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','SmsAccount','options','raw','where','attributes','include','map','model','ShowSmsAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96fb,0xac));var _0xb96f=function(_0x56b875,_0x384e19){_0x56b875=_0x56b875-0x0;var _0x296846=_0x96fb[_0x56b875];return _0x296846;};'use strict';var _=require('lodash');var util=require(_0xb96f('0x0'));var moment=require('moment');var BPromise=require(_0xb96f('0x1'));var rs=require(_0xb96f('0x2'));var fs=require('fs');var Redis=require(_0xb96f('0x3'));var db=require(_0xb96f('0x4'))['db'];var utils=require(_0xb96f('0x5'));var logger=require(_0xb96f('0x6'))(_0xb96f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb96f('0x8')][_0xb96f('0x9')]({'port':0x232a});config[_0xb96f('0xa')]=_[_0xb96f('0xb')](config[_0xb96f('0xa')],{'host':_0xb96f('0xc'),'port':0x18eb});var socket=require(_0xb96f('0xd'))(new Redis(config[_0xb96f('0xa')]));require('./smsAccount.socket')[_0xb96f('0xe')](socket);function respondWithRpcPromise(_0x2c31cc,_0x71679,_0x568608){return new BPromise(function(_0x5d524b,_0x1d021c){return client[_0xb96f('0xf')](_0x2c31cc,_0x568608)[_0xb96f('0x10')](function(_0x45d9e4){logger['info']('SmsAccount,\x20%s,\x20%s',_0x71679,_0xb96f('0x11'));logger[_0xb96f('0x12')](_0xb96f('0x13'),_0x71679,_0xb96f('0x11'),JSON[_0xb96f('0x14')](_0x45d9e4));if(_0x45d9e4[_0xb96f('0x15')]){if(_0x45d9e4[_0xb96f('0x15')][_0xb96f('0x16')]===0x1f4){logger[_0xb96f('0x15')](_0xb96f('0x17'),_0x71679,_0x45d9e4[_0xb96f('0x15')][_0xb96f('0x18')]);return _0x1d021c(_0x45d9e4['error'][_0xb96f('0x18')]);}logger['error'](_0xb96f('0x17'),_0x71679,_0x45d9e4['error'][_0xb96f('0x18')]);return _0x5d524b(_0x45d9e4[_0xb96f('0x15')][_0xb96f('0x18')]);}else{logger[_0xb96f('0x19')](_0xb96f('0x17'),_0x71679,'request\x20sent');_0x5d524b(_0x45d9e4[_0xb96f('0x1a')][_0xb96f('0x18')]);}})[_0xb96f('0x1b')](function(_0xa9c73f){logger[_0xb96f('0x15')](_0xb96f('0x17'),_0x71679,_0xa9c73f);_0x1d021c(_0xa9c73f);});});}exports['ShowSmsAccount']=function(_0x4a2b22){var _0x2b016c=this;return new Promise(function(_0x4e08b8,_0x9e7041){return db[_0xb96f('0x1c')]['find']({'raw':_0x4a2b22[_0xb96f('0x1d')]?_0x4a2b22[_0xb96f('0x1d')][_0xb96f('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a2b22[_0xb96f('0x1d')]?_0x4a2b22['options'][_0xb96f('0x1f')]||null:null,'attributes':_0x4a2b22[_0xb96f('0x1d')]?_0x4a2b22[_0xb96f('0x1d')][_0xb96f('0x20')]||null:null,'include':_0x4a2b22[_0xb96f('0x1d')]?_0x4a2b22['options'][_0xb96f('0x21')]?_[_0xb96f('0x22')](_0x4a2b22[_0xb96f('0x1d')][_0xb96f('0x21')],function(_0x2b0554){return{'model':db[_0x2b0554[_0xb96f('0x23')]],'as':_0x2b0554['as'],'attributes':_0x2b0554[_0xb96f('0x20')],'include':_0x2b0554[_0xb96f('0x21')]?_[_0xb96f('0x22')](_0x2b0554[_0xb96f('0x21')],function(_0x30f5c1){return{'model':db[_0x30f5c1[_0xb96f('0x23')]],'as':_0x30f5c1['as'],'attributes':_0x30f5c1[_0xb96f('0x20')],'include':_0x30f5c1['include']?_[_0xb96f('0x22')](_0x30f5c1[_0xb96f('0x21')],function(_0x551414){return{'model':db[_0x551414[_0xb96f('0x23')]],'as':_0x551414['as'],'attributes':_0x551414[_0xb96f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb96f('0x10')](function(_0x4bbcd7){logger[_0xb96f('0x19')](_0xb96f('0x24'),_0x4a2b22);logger['debug'](_0xb96f('0x24'),_0x4a2b22,JSON[_0xb96f('0x14')](_0x4bbcd7));_0x4e08b8(_0x4bbcd7);})['catch'](function(_0x13222b){logger[_0xb96f('0x15')](_0xb96f('0x24'),_0x13222b['message'],_0x4a2b22);_0x9e7041(_0x2b016c[_0xb96f('0x15')](0x1f4,_0x13222b[_0xb96f('0x18')]));});});}; \ No newline at end of file +var _0x9312=['request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options','attributes','include','map','model','then','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','info'];(function(_0x277c93,_0x33a8bb){var _0x1bc988=function(_0x4c1ffb){while(--_0x4c1ffb){_0x277c93['push'](_0x277c93['shift']());}};_0x1bc988(++_0x33a8bb);}(_0x9312,0x122));var _0x2931=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x9312[_0x174ef5];return _0x1cc379;};'use strict';var _=require('lodash');var util=require(_0x2931('0x0'));var moment=require('moment');var BPromise=require(_0x2931('0x1'));var rs=require(_0x2931('0x2'));var fs=require('fs');var Redis=require(_0x2931('0x3'));var db=require(_0x2931('0x4'))['db'];var utils=require(_0x2931('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2931('0x6'));var jayson=require(_0x2931('0x7'));var client=jayson[_0x2931('0x8')][_0x2931('0x9')]({'port':0x232a});config[_0x2931('0xa')]=_['defaults'](config[_0x2931('0xa')],{'host':_0x2931('0xb'),'port':0x18eb});var socket=require(_0x2931('0xc'))(new Redis(config[_0x2931('0xa')]));require(_0x2931('0xd'))[_0x2931('0xe')](socket);function respondWithRpcPromise(_0xa92a2e,_0x13539f,_0xc049f4){return new BPromise(function(_0x382d92,_0x155307){return client['request'](_0xa92a2e,_0xc049f4)['then'](function(_0x106ad1){logger[_0x2931('0xf')]('SmsAccount,\x20%s,\x20%s',_0x13539f,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x13539f,_0x2931('0x10'),JSON[_0x2931('0x11')](_0x106ad1));if(_0x106ad1[_0x2931('0x12')]){if(_0x106ad1['error'][_0x2931('0x13')]===0x1f4){logger[_0x2931('0x12')](_0x2931('0x14'),_0x13539f,_0x106ad1[_0x2931('0x12')][_0x2931('0x15')]);return _0x155307(_0x106ad1[_0x2931('0x12')][_0x2931('0x15')]);}logger[_0x2931('0x12')](_0x2931('0x14'),_0x13539f,_0x106ad1[_0x2931('0x12')][_0x2931('0x15')]);return _0x382d92(_0x106ad1[_0x2931('0x12')]['message']);}else{logger['info'](_0x2931('0x14'),_0x13539f,'request\x20sent');_0x382d92(_0x106ad1[_0x2931('0x16')][_0x2931('0x15')]);}})[_0x2931('0x17')](function(_0x3e31d4){logger[_0x2931('0x12')](_0x2931('0x14'),_0x13539f,_0x3e31d4);_0x155307(_0x3e31d4);});});}exports[_0x2931('0x18')]=function(_0x39c262){var _0x32dc7a=this;return new Promise(function(_0x52c98d,_0x20869b){return db[_0x2931('0x19')][_0x2931('0x1a')]({'raw':_0x39c262[_0x2931('0x1b')]?_0x39c262[_0x2931('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x39c262['options']?_0x39c262[_0x2931('0x1b')]['where']||null:null,'attributes':_0x39c262[_0x2931('0x1b')]?_0x39c262[_0x2931('0x1b')][_0x2931('0x1c')]||null:null,'include':_0x39c262[_0x2931('0x1b')]?_0x39c262[_0x2931('0x1b')][_0x2931('0x1d')]?_[_0x2931('0x1e')](_0x39c262[_0x2931('0x1b')][_0x2931('0x1d')],function(_0x24e7df){return{'model':db[_0x24e7df[_0x2931('0x1f')]],'as':_0x24e7df['as'],'attributes':_0x24e7df[_0x2931('0x1c')],'include':_0x24e7df[_0x2931('0x1d')]?_[_0x2931('0x1e')](_0x24e7df['include'],function(_0x1bb862){return{'model':db[_0x1bb862[_0x2931('0x1f')]],'as':_0x1bb862['as'],'attributes':_0x1bb862[_0x2931('0x1c')],'include':_0x1bb862[_0x2931('0x1d')]?_[_0x2931('0x1e')](_0x1bb862[_0x2931('0x1d')],function(_0xa57e35){return{'model':db[_0xa57e35[_0x2931('0x1f')]],'as':_0xa57e35['as'],'attributes':_0xa57e35[_0x2931('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2931('0x20')](function(_0x25d561){logger['info'](_0x2931('0x18'),_0x39c262);logger[_0x2931('0x21')](_0x2931('0x18'),_0x39c262,JSON['stringify'](_0x25d561));_0x52c98d(_0x25d561);})[_0x2931('0x17')](function(_0x2c0ff7){logger[_0x2931('0x12')](_0x2931('0x18'),_0x2c0ff7[_0x2931('0x15')],_0x39c262);_0x20869b(_0x32dc7a['error'](0x1f4,_0x2c0ff7[_0x2931('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7ac8d53..7e4f541 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 _0xf60d=['register','length','smsAccount:','save','remove','removeListener'];(function(_0x1df474,_0x57857f){var _0x26d9ca=function(_0x16dc01){while(--_0x16dc01){_0x1df474['push'](_0x1df474['shift']());}};_0x26d9ca(++_0x57857f);}(_0xf60d,0x1ad));var _0xdf60=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xf60d[_0x32f7d7];return _0x133d09;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0xdf60('0x0'),_0xdf60('0x1'),'update'];function createListener(_0x121b9e,_0x489a98){return function(_0x3a7664){_0x489a98['emit'](_0x121b9e,_0x3a7664);};}function removeListener(_0x4da45e,_0x25f0a1){return function(){SmsAccountEvents[_0xdf60('0x2')](_0x4da45e,_0x25f0a1);};}exports[_0xdf60('0x3')]=function(_0x45abf0){for(var _0x54a450=0x0,_0x4f8ee7=events[_0xdf60('0x4')];_0x54a450<_0x4f8ee7;_0x54a450++){var _0x2e13ec=events[_0x54a450];var _0x40f4fb=createListener(_0xdf60('0x5')+_0x2e13ec,_0x45abf0);SmsAccountEvents['on'](_0x2e13ec,_0x40f4fb);}}; \ No newline at end of file +var _0xb8d5=['length','smsAccount:','remove','update','emit','removeListener','register'];(function(_0x4f364e,_0x578486){var _0xbc70ac=function(_0x1b2d38){while(--_0x1b2d38){_0x4f364e['push'](_0x4f364e['shift']());}};_0xbc70ac(++_0x578486);}(_0xb8d5,0x12f));var _0x5b8d=function(_0xfb6e10,_0x3c3c4c){_0xfb6e10=_0xfb6e10-0x0;var _0x5cf224=_0xb8d5[_0xfb6e10];return _0x5cf224;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0x5b8d('0x0'),_0x5b8d('0x1')];function createListener(_0x2aa1d5,_0x3d0d9d){return function(_0x32fe75){_0x3d0d9d[_0x5b8d('0x2')](_0x2aa1d5,_0x32fe75);};}function removeListener(_0xc982a4,_0x3635cd){return function(){SmsAccountEvents[_0x5b8d('0x3')](_0xc982a4,_0x3635cd);};}exports[_0x5b8d('0x4')]=function(_0x4f92b9){for(var _0x47ee5e=0x0,_0x3b59a7=events[_0x5b8d('0x5')];_0x47ee5e<_0x3b59a7;_0x47ee5e++){var _0xf7598a=events[_0x47ee5e];var _0xaf24bd=createListener(_0x5b8d('0x6')+_0xf7598a,_0x4f92b9);SmsAccountEvents['on'](_0xf7598a,_0xaf24bd);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 7778944..eeb80a4 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 _0xa141=['post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0xa141,0x149));var _0x1a14=function(_0x4fb452,_0x2de8ab){_0x4fb452=_0x4fb452-0x0;var _0xddd780=_0xa141[_0x4fb452];return _0xddd780;};'use strict';var multer=require(_0x1a14('0x0'));var util=require(_0x1a14('0x1'));var path=require(_0x1a14('0x2'));var timeout=require(_0x1a14('0x3'));var express=require(_0x1a14('0x4'));var router=express[_0x1a14('0x5')]();var auth=require(_0x1a14('0x6'));var interaction=require(_0x1a14('0x7'));var config=require(_0x1a14('0x8'));var controller=require('./smsApplication.controller');router['get']('/',auth[_0x1a14('0x9')](),controller['index']);router[_0x1a14('0xa')](_0x1a14('0xb'),auth['isAuthenticated'](),controller[_0x1a14('0xc')]);router[_0x1a14('0xd')]('/',auth['isAuthenticated'](),controller[_0x1a14('0xe')]);router[_0x1a14('0xf')](_0x1a14('0xb'),auth[_0x1a14('0x9')](),controller['update']);router['delete'](_0x1a14('0xb'),auth['isAuthenticated'](),controller[_0x1a14('0x10')]);module[_0x1a14('0x11')]=router; \ No newline at end of file +var _0xe3b6=['show','post','create','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xe3b6,0x16e));var _0x6e3b=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xe3b6[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x6e3b('0x0'));var util=require(_0x6e3b('0x1'));var path=require('path');var timeout=require(_0x6e3b('0x2'));var express=require('express');var router=express[_0x6e3b('0x3')]();var auth=require(_0x6e3b('0x4'));var interaction=require(_0x6e3b('0x5'));var config=require(_0x6e3b('0x6'));var controller=require(_0x6e3b('0x7'));router[_0x6e3b('0x8')]('/',auth[_0x6e3b('0x9')](),controller[_0x6e3b('0xa')]);router['get'](_0x6e3b('0xb'),auth[_0x6e3b('0x9')](),controller[_0x6e3b('0xc')]);router[_0x6e3b('0xd')]('/',auth['isAuthenticated'](),controller[_0x6e3b('0xe')]);router['put'](_0x6e3b('0xb'),auth[_0x6e3b('0x9')](),controller[_0x6e3b('0xf')]);router[_0x6e3b('0x10')](_0x6e3b('0xb'),auth[_0x6e3b('0x9')](),controller[_0x6e3b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6873fde..1981c42 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 _0x434b=['STRING','TEXT','*,*,*,*','INTEGER'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x434b,0x17f));var _0xb434=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x434b[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb434('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb434('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb434('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb434('0x1')],'defaultValue':_0xb434('0x3')}}; \ No newline at end of file +var _0xdc7b=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0xdc7b,0x153));var _0xbdc7=function(_0x33bdbc,_0x4f10bf){_0x33bdbc=_0x33bdbc-0x0;var _0x2926fa=_0xdc7b[_0x33bdbc];return _0x2926fa;};'use strict';var Sequelize=require(_0xbdc7('0x0'));module[_0xbdc7('0x1')]={'priority':{'type':Sequelize[_0xbdc7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbdc7('0x3')],'allowNull':![],'defaultValue':_0xbdc7('0x4')},'appdata':{'type':Sequelize[_0xbdc7('0x5')]()},'description':{'type':Sequelize[_0xbdc7('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbdc7('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index d331424..9bb9cb3 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 _0x96b4=['SmsApplication','rawAttributes','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x96b4,0x6e));var _0x496b=function(_0x399581,_0x2c2fd4){_0x399581=_0x399581-0x0;var _0x8625aa=_0x96b4[_0x399581];return _0x8625aa;};'use strict';var pdf=require(_0x496b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x496b('0x1'));var jsonpatch=require(_0x496b('0x2'));var rp=require(_0x496b('0x3'));var moment=require(_0x496b('0x4'));var BPromise=require(_0x496b('0x5'));var Mustache=require(_0x496b('0x6'));var util=require(_0x496b('0x7'));var path=require('path');var sox=require(_0x496b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x496b('0x9'));var squel=require(_0x496b('0xa'));var crypto=require(_0x496b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x496b('0xc'));var querystring=require(_0x496b('0xd'));var Papa=require(_0x496b('0xe'));var authService=require(_0x496b('0xf'));var hardwareService=require(_0x496b('0x10'));var Redis=require(_0x496b('0x11'));var qs=require(_0x496b('0x12'));var logger=require('../../config/logger')(_0x496b('0x13'));var utils=require(_0x496b('0x14'));var config=require(_0x496b('0x15'));var db=require(_0x496b('0x16'))['db'];function respondWithStatusCode(_0x36a775,_0x56e219){_0x56e219=_0x56e219||0xcc;return function(_0x408fd8){if(_0x408fd8){return _0x36a775[_0x496b('0x17')](_0x56e219);}return _0x36a775['status'](_0x56e219)[_0x496b('0x18')]();};}function respondWithResult(_0x4692ca,_0x1badbe){_0x1badbe=_0x1badbe||0xc8;return function(_0x26a0aa){if(_0x26a0aa){return _0x4692ca[_0x496b('0x19')](_0x1badbe)[_0x496b('0x1a')](_0x26a0aa);}};}function respondWithFilteredResult(_0x214ec5,_0x266336){return function(_0x54a364){if(_0x54a364){var _0x53c2fc=_0x54a364['count'],_0x5390e2=_0x266336[_0x496b('0x1b')],_0x4b00f4=_0x266336['offset']+_0x266336[_0x496b('0x1c')],_0x4b1bdb;if(_0x4b00f4>=_0x53c2fc){_0x4b00f4=_0x53c2fc;_0x4b1bdb=0xc8;}else{_0x4b1bdb=0xce;}_0x214ec5[_0x496b('0x19')](_0x4b1bdb);return _0x214ec5[_0x496b('0x1d')](_0x496b('0x1e'),_0x5390e2+'-'+_0x4b00f4+'/'+_0x53c2fc)[_0x496b('0x1a')](_0x54a364);}return null;};}function patchUpdates(_0xf67c5){return function(_0x45271b){try{jsonpatch[_0x496b('0x1f')](_0x45271b,_0xf67c5,!![]);}catch(_0x385695){return BPromise[_0x496b('0x20')](_0x385695);}return _0x45271b['save']();};}function saveUpdates(_0x4050b7,_0x35a280){return function(_0x2b1409){if(_0x2b1409){return _0x2b1409[_0x496b('0x21')](_0x4050b7)[_0x496b('0x22')](function(_0x500eff){return _0x500eff;});}return null;};}function removeEntity(_0x1cc40b,_0x5d817c){return function(_0x5733e4){if(_0x5733e4){return _0x5733e4[_0x496b('0x23')]()[_0x496b('0x22')](function(){_0x1cc40b[_0x496b('0x19')](0xcc)[_0x496b('0x18')]();});}};}function handleEntityNotFound(_0x1c83c2,_0x208a75){return function(_0x47cc3a){if(!_0x47cc3a){_0x1c83c2[_0x496b('0x17')](0x194);}return _0x47cc3a;};}function handleError(_0x23f4ef,_0x5e5fc1){_0x5e5fc1=_0x5e5fc1||0x1f4;return function(_0x4c165e){logger[_0x496b('0x24')](_0x4c165e['stack']);if(_0x4c165e[_0x496b('0x25')]){delete _0x4c165e[_0x496b('0x25')];}_0x23f4ef[_0x496b('0x19')](_0x5e5fc1)[_0x496b('0x26')](_0x4c165e);};}exports[_0x496b('0x27')]=function(_0x1a014d,_0x52153a){var _0x5693a0={},_0x42c558={},_0x30b913={'count':0x0,'rows':[]};var _0x300c64=db[_0x496b('0x28')][_0x496b('0x29')];_0x42c558['model']=_['keys'](_0x300c64);_0x42c558[_0x496b('0x2a')]=_[_0x496b('0x2b')](_0x1a014d[_0x496b('0x2a')]);_0x42c558['filters']=_[_0x496b('0x2c')](_0x42c558[_0x496b('0x2d')],_0x42c558['query']);_0x5693a0['attributes']=_[_0x496b('0x2c')](_0x42c558[_0x496b('0x2d')],qs[_0x496b('0x2e')](_0x1a014d['query']['fields']));_0x5693a0['attributes']=_0x5693a0[_0x496b('0x2f')][_0x496b('0x30')]?_0x5693a0[_0x496b('0x2f')]:_0x42c558[_0x496b('0x2d')];if(!_0x1a014d['query'][_0x496b('0x31')](_0x496b('0x32'))){_0x5693a0['limit']=qs[_0x496b('0x1c')](_0x1a014d['query'][_0x496b('0x1c')]);_0x5693a0[_0x496b('0x1b')]=qs[_0x496b('0x1b')](_0x1a014d[_0x496b('0x2a')]['offset']);}_0x5693a0[_0x496b('0x33')]=qs[_0x496b('0x34')](_0x1a014d[_0x496b('0x2a')]['sort']);_0x5693a0['where']=qs[_0x496b('0x35')](_[_0x496b('0x36')](_0x1a014d[_0x496b('0x2a')],_0x42c558[_0x496b('0x35')]));if(_0x1a014d['query'][_0x496b('0x37')]){_0x5693a0[_0x496b('0x38')]=_[_0x496b('0x39')](_0x5693a0[_0x496b('0x38')],{'$or':_[_0x496b('0x3a')](_0x300c64,function(_0x3ac460){if(_0x3ac460[_0x496b('0x3b')][_0x496b('0x3c')]!==_0x496b('0x3d')){var _0x460d1c={};_0x460d1c[_0x3ac460[_0x496b('0x3e')]]={'$like':'%'+_0x1a014d[_0x496b('0x2a')]['filter']+'%'};return _0x460d1c;}})});}_0x5693a0=_[_0x496b('0x39')]({},_0x5693a0,_0x1a014d[_0x496b('0x3f')]);var _0x29b19d={'where':_0x5693a0[_0x496b('0x38')]};return db[_0x496b('0x28')][_0x496b('0x40')](_0x29b19d)[_0x496b('0x22')](function(_0x3fc57f){_0x30b913[_0x496b('0x40')]=_0x3fc57f;if(_0x1a014d[_0x496b('0x2a')][_0x496b('0x41')]){_0x5693a0[_0x496b('0x42')]=[{'all':!![]}];}return db['SmsApplication'][_0x496b('0x43')](_0x5693a0);})[_0x496b('0x22')](function(_0xe35e1e){_0x30b913[_0x496b('0x44')]=_0xe35e1e;return _0x30b913;})[_0x496b('0x22')](respondWithFilteredResult(_0x52153a,_0x5693a0))[_0x496b('0x45')](handleError(_0x52153a,null));};exports[_0x496b('0x46')]=function(_0x4b9b04,_0x33d453){var _0x3eb814={'raw':!![],'where':{'id':_0x4b9b04[_0x496b('0x47')]['id']}},_0x2aa8a8={};_0x2aa8a8['model']=_[_0x496b('0x2b')](db[_0x496b('0x28')][_0x496b('0x29')]);_0x2aa8a8['query']=_[_0x496b('0x2b')](_0x4b9b04[_0x496b('0x2a')]);_0x2aa8a8[_0x496b('0x35')]=_[_0x496b('0x2c')](_0x2aa8a8[_0x496b('0x2d')],_0x2aa8a8[_0x496b('0x2a')]);_0x3eb814['attributes']=_['intersection'](_0x2aa8a8[_0x496b('0x2d')],qs[_0x496b('0x2e')](_0x4b9b04[_0x496b('0x2a')]['fields']));_0x3eb814[_0x496b('0x2f')]=_0x3eb814[_0x496b('0x2f')][_0x496b('0x30')]?_0x3eb814['attributes']:_0x2aa8a8['model'];if(_0x4b9b04['query']['includeAll']){_0x3eb814[_0x496b('0x42')]=[{'all':!![]}];}_0x3eb814=_[_0x496b('0x39')]({},_0x3eb814,_0x4b9b04[_0x496b('0x3f')]);return db[_0x496b('0x28')][_0x496b('0x48')](_0x3eb814)['then'](handleEntityNotFound(_0x33d453,null))[_0x496b('0x22')](respondWithResult(_0x33d453,null))[_0x496b('0x45')](handleError(_0x33d453,null));};exports[_0x496b('0x49')]=function(_0x2fb2f5,_0x12f85d){return db[_0x496b('0x28')][_0x496b('0x49')](_0x2fb2f5['body'],{})['then'](respondWithResult(_0x12f85d,0xc9))[_0x496b('0x45')](handleError(_0x12f85d,null));};exports[_0x496b('0x21')]=function(_0x374253,_0x1005bb){if(_0x374253[_0x496b('0x4a')]['id']){delete _0x374253[_0x496b('0x4a')]['id'];}return db['SmsApplication'][_0x496b('0x48')]({'where':{'id':_0x374253[_0x496b('0x47')]['id']}})[_0x496b('0x22')](handleEntityNotFound(_0x1005bb,null))[_0x496b('0x22')](saveUpdates(_0x374253[_0x496b('0x4a')],null))[_0x496b('0x22')](respondWithResult(_0x1005bb,null))[_0x496b('0x45')](handleError(_0x1005bb,null));};exports['destroy']=function(_0x48f479,_0x175b60){return db[_0x496b('0x28')][_0x496b('0x48')]({'where':{'id':_0x48f479['params']['id']}})[_0x496b('0x22')](handleEntityNotFound(_0x175b60,null))[_0x496b('0x22')](removeEntity(_0x175b60,null))[_0x496b('0x45')](handleError(_0x175b60,null));}; \ No newline at end of file +var _0xf89c=['papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','reject','update','then','destroy','stack','name','index','SmsApplication','rawAttributes','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','map','type','key','VIRTUAL','field','options','count','include','rows','catch','show','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x41e2af,_0x3662f8){var _0x41df19=function(_0x3b307e){while(--_0x3b307e){_0x41e2af['push'](_0x41e2af['shift']());}};_0x41df19(++_0x3662f8);}(_0xf89c,0x7d));var _0xcf89=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf89c[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcf89('0x0'));var rimraf=require(_0xcf89('0x1'));var zipdir=require(_0xcf89('0x2'));var jsonpatch=require(_0xcf89('0x3'));var rp=require('request-promise');var moment=require(_0xcf89('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcf89('0x5'));var path=require(_0xcf89('0x6'));var sox=require('sox');var csv=require(_0xcf89('0x7'));var ejs=require(_0xcf89('0x8'));var fs=require('fs');var _=require(_0xcf89('0x9'));var squel=require(_0xcf89('0xa'));var crypto=require(_0xcf89('0xb'));var jsforce=require(_0xcf89('0xc'));var deskjs=require(_0xcf89('0xd'));var toCsv=require(_0xcf89('0x7'));var querystring=require(_0xcf89('0xe'));var Papa=require(_0xcf89('0xf'));var authService=require(_0xcf89('0x10'));var hardwareService=require(_0xcf89('0x11'));var Redis=require(_0xcf89('0x12'));var qs=require(_0xcf89('0x13'));var logger=require(_0xcf89('0x14'))(_0xcf89('0x15'));var utils=require('../../config/utils');var config=require(_0xcf89('0x16'));var db=require(_0xcf89('0x17'))['db'];function respondWithStatusCode(_0x4257c7,_0x3fcb39){_0x3fcb39=_0x3fcb39||0xcc;return function(_0x5216c8){if(_0x5216c8){return _0x4257c7[_0xcf89('0x18')](_0x3fcb39);}return _0x4257c7['status'](_0x3fcb39)[_0xcf89('0x19')]();};}function respondWithResult(_0x1d10b6,_0x41922b){_0x41922b=_0x41922b||0xc8;return function(_0x4c50df){if(_0x4c50df){return _0x1d10b6[_0xcf89('0x1a')](_0x41922b)[_0xcf89('0x1b')](_0x4c50df);}};}function respondWithFilteredResult(_0x15aa11,_0x56acb6){return function(_0x522f4c){if(_0x522f4c){var _0x2bf1b5=_0x522f4c['count'],_0x5a6ace=_0x56acb6[_0xcf89('0x1c')],_0x46b186=_0x56acb6['offset']+_0x56acb6[_0xcf89('0x1d')],_0x1a9053;if(_0x46b186>=_0x2bf1b5){_0x46b186=_0x2bf1b5;_0x1a9053=0xc8;}else{_0x1a9053=0xce;}_0x15aa11[_0xcf89('0x1a')](_0x1a9053);return _0x15aa11[_0xcf89('0x1e')]('Content-Range',_0x5a6ace+'-'+_0x46b186+'/'+_0x2bf1b5)[_0xcf89('0x1b')](_0x522f4c);}return null;};}function patchUpdates(_0x46cb07){return function(_0x2f33b2){try{jsonpatch['apply'](_0x2f33b2,_0x46cb07,!![]);}catch(_0x974a23){return BPromise[_0xcf89('0x1f')](_0x974a23);}return _0x2f33b2['save']();};}function saveUpdates(_0x113269,_0x2bdeec){return function(_0x3fc0ea){if(_0x3fc0ea){return _0x3fc0ea[_0xcf89('0x20')](_0x113269)[_0xcf89('0x21')](function(_0xb03b84){return _0xb03b84;});}return null;};}function removeEntity(_0x545641,_0xab3ad3){return function(_0x5025ac){if(_0x5025ac){return _0x5025ac[_0xcf89('0x22')]()[_0xcf89('0x21')](function(){_0x545641[_0xcf89('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x294c22,_0x2e4d3f){return function(_0x2dd2cf){if(!_0x2dd2cf){_0x294c22['sendStatus'](0x194);}return _0x2dd2cf;};}function handleError(_0x649542,_0x5bcfad){_0x5bcfad=_0x5bcfad||0x1f4;return function(_0x41c12d){logger['error'](_0x41c12d[_0xcf89('0x23')]);if(_0x41c12d['name']){delete _0x41c12d[_0xcf89('0x24')];}_0x649542['status'](_0x5bcfad)['send'](_0x41c12d);};}exports[_0xcf89('0x25')]=function(_0x46ec45,_0x6f258d){var _0x33298d={},_0x21b6a5={},_0x4d2983={'count':0x0,'rows':[]};var _0x87fb12=db[_0xcf89('0x26')][_0xcf89('0x27')];_0x21b6a5[_0xcf89('0x28')]=_[_0xcf89('0x29')](_0x87fb12);_0x21b6a5['query']=_[_0xcf89('0x29')](_0x46ec45['query']);_0x21b6a5[_0xcf89('0x2a')]=_[_0xcf89('0x2b')](_0x21b6a5[_0xcf89('0x28')],_0x21b6a5[_0xcf89('0x2c')]);_0x33298d[_0xcf89('0x2d')]=_[_0xcf89('0x2b')](_0x21b6a5[_0xcf89('0x28')],qs[_0xcf89('0x2e')](_0x46ec45[_0xcf89('0x2c')][_0xcf89('0x2e')]));_0x33298d[_0xcf89('0x2d')]=_0x33298d['attributes'][_0xcf89('0x2f')]?_0x33298d[_0xcf89('0x2d')]:_0x21b6a5['model'];if(!_0x46ec45[_0xcf89('0x2c')][_0xcf89('0x30')](_0xcf89('0x31'))){_0x33298d['limit']=qs[_0xcf89('0x1d')](_0x46ec45['query'][_0xcf89('0x1d')]);_0x33298d[_0xcf89('0x1c')]=qs[_0xcf89('0x1c')](_0x46ec45['query']['offset']);}_0x33298d['order']=qs[_0xcf89('0x32')](_0x46ec45[_0xcf89('0x2c')][_0xcf89('0x32')]);_0x33298d['where']=qs['filters'](_['pick'](_0x46ec45['query'],_0x21b6a5[_0xcf89('0x2a')]));if(_0x46ec45[_0xcf89('0x2c')][_0xcf89('0x33')]){_0x33298d[_0xcf89('0x34')]=_[_0xcf89('0x35')](_0x33298d[_0xcf89('0x34')],{'$or':_[_0xcf89('0x36')](_0x87fb12,function(_0x4c4b0c){if(_0x4c4b0c[_0xcf89('0x37')][_0xcf89('0x38')]!==_0xcf89('0x39')){var _0x5148ac={};_0x5148ac[_0x4c4b0c[_0xcf89('0x3a')]]={'$like':'%'+_0x46ec45['query'][_0xcf89('0x33')]+'%'};return _0x5148ac;}})});}_0x33298d=_[_0xcf89('0x35')]({},_0x33298d,_0x46ec45[_0xcf89('0x3b')]);var _0x37ca18={'where':_0x33298d['where']};return db[_0xcf89('0x26')][_0xcf89('0x3c')](_0x37ca18)[_0xcf89('0x21')](function(_0x11abdf){_0x4d2983[_0xcf89('0x3c')]=_0x11abdf;if(_0x46ec45[_0xcf89('0x2c')]['includeAll']){_0x33298d[_0xcf89('0x3d')]=[{'all':!![]}];}return db[_0xcf89('0x26')]['findAll'](_0x33298d);})['then'](function(_0x8580e){_0x4d2983[_0xcf89('0x3e')]=_0x8580e;return _0x4d2983;})[_0xcf89('0x21')](respondWithFilteredResult(_0x6f258d,_0x33298d))[_0xcf89('0x3f')](handleError(_0x6f258d,null));};exports[_0xcf89('0x40')]=function(_0x1b84b1,_0x13c358){var _0x561e51={'raw':!![],'where':{'id':_0x1b84b1['params']['id']}},_0x59e039={};_0x59e039['model']=_['keys'](db[_0xcf89('0x26')][_0xcf89('0x27')]);_0x59e039['query']=_['keys'](_0x1b84b1['query']);_0x59e039['filters']=_[_0xcf89('0x2b')](_0x59e039[_0xcf89('0x28')],_0x59e039[_0xcf89('0x2c')]);_0x561e51[_0xcf89('0x2d')]=_['intersection'](_0x59e039['model'],qs[_0xcf89('0x2e')](_0x1b84b1[_0xcf89('0x2c')][_0xcf89('0x2e')]));_0x561e51['attributes']=_0x561e51[_0xcf89('0x2d')][_0xcf89('0x2f')]?_0x561e51[_0xcf89('0x2d')]:_0x59e039[_0xcf89('0x28')];if(_0x1b84b1[_0xcf89('0x2c')][_0xcf89('0x41')]){_0x561e51[_0xcf89('0x3d')]=[{'all':!![]}];}_0x561e51=_['merge']({},_0x561e51,_0x1b84b1['options']);return db['SmsApplication'][_0xcf89('0x42')](_0x561e51)[_0xcf89('0x21')](handleEntityNotFound(_0x13c358,null))[_0xcf89('0x21')](respondWithResult(_0x13c358,null))[_0xcf89('0x3f')](handleError(_0x13c358,null));};exports[_0xcf89('0x43')]=function(_0x2a3f53,_0x3adc50){return db[_0xcf89('0x26')][_0xcf89('0x43')](_0x2a3f53[_0xcf89('0x44')],{})['then'](respondWithResult(_0x3adc50,0xc9))['catch'](handleError(_0x3adc50,null));};exports['update']=function(_0x5cf168,_0x46b986){if(_0x5cf168['body']['id']){delete _0x5cf168[_0xcf89('0x44')]['id'];}return db['SmsApplication'][_0xcf89('0x42')]({'where':{'id':_0x5cf168['params']['id']}})[_0xcf89('0x21')](handleEntityNotFound(_0x46b986,null))[_0xcf89('0x21')](saveUpdates(_0x5cf168[_0xcf89('0x44')],null))[_0xcf89('0x21')](respondWithResult(_0x46b986,null))[_0xcf89('0x3f')](handleError(_0x46b986,null));};exports[_0xcf89('0x22')]=function(_0x4d1aec,_0x1c76d2){return db[_0xcf89('0x26')]['find']({'where':{'id':_0x4d1aec[_0xcf89('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c76d2,null))[_0xcf89('0x21')](removeEntity(_0x1c76d2,null))[_0xcf89('0x3f')](handleError(_0x1c76d2,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 2a027e4..817f8c2 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 _0xcf10=['bluebird','request-promise','./smsApplication.attributes','exports','SmsApplication','sms_applications','lodash','util','api','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcf10,0x164));var _0x0cf1=function(_0x4d821c,_0x22bd0e){_0x4d821c=_0x4d821c-0x0;var _0x15dd5b=_0xcf10[_0x4d821c];return _0x15dd5b;};'use strict';var _=require(_0x0cf1('0x0'));var util=require(_0x0cf1('0x1'));var logger=require('../../config/logger')(_0x0cf1('0x2'));var moment=require(_0x0cf1('0x3'));var BPromise=require(_0x0cf1('0x4'));var rp=require(_0x0cf1('0x5'));var attributes=require(_0x0cf1('0x6'));module[_0x0cf1('0x7')]=function(_0x3f79d9,_0x334d56){return _0x3f79d9['define'](_0x0cf1('0x8'),attributes,{'tableName':_0x0cf1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb02d=['SmsApplication','sms_applications','lodash','../../config/logger','api','moment','bluebird','./smsApplication.attributes','exports','define'];(function(_0x5ac7d7,_0x109040){var _0x23955f=function(_0x52a2ac){while(--_0x52a2ac){_0x5ac7d7['push'](_0x5ac7d7['shift']());}};_0x23955f(++_0x109040);}(_0xb02d,0x98));var _0xdb02=function(_0xb2a530,_0x2b320e){_0xb2a530=_0xb2a530-0x0;var _0x104c8a=_0xb02d[_0xb2a530];return _0x104c8a;};'use strict';var _=require(_0xdb02('0x0'));var util=require('util');var logger=require(_0xdb02('0x1'))(_0xdb02('0x2'));var moment=require(_0xdb02('0x3'));var BPromise=require(_0xdb02('0x4'));var rp=require('request-promise');var attributes=require(_0xdb02('0x5'));module[_0xdb02('0x6')]=function(_0x465be7,_0x5ddbc5){return _0x465be7[_0xdb02('0x7')](_0xdb02('0x8'),attributes,{'tableName':_0xdb02('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 0daab90..bf58a6e 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 _0x7efd=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x736a72,_0x574f49){var _0x3741ad=function(_0x412a42){while(--_0x412a42){_0x736a72['push'](_0x736a72['shift']());}};_0x3741ad(++_0x574f49);}(_0x7efd,0xe7));var _0xd7ef=function(_0x53c33c,_0x27223d){_0x53c33c=_0x53c33c-0x0;var _0x277750=_0x7efd[_0x53c33c];return _0x277750;};'use strict';var _=require(_0xd7ef('0x0'));var util=require(_0xd7ef('0x1'));var moment=require(_0xd7ef('0x2'));var BPromise=require(_0xd7ef('0x3'));var rs=require(_0xd7ef('0x4'));var fs=require('fs');var Redis=require(_0xd7ef('0x5'));var db=require(_0xd7ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7ef('0x7'))(_0xd7ef('0x8'));var config=require(_0xd7ef('0x9'));var jayson=require(_0xd7ef('0xa'));var client=jayson[_0xd7ef('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46a6fc,_0x1aef97,_0x181d55){return new BPromise(function(_0x39462c,_0x52fdd7){return client[_0xd7ef('0xc')](_0x46a6fc,_0x181d55)[_0xd7ef('0xd')](function(_0x276993){logger[_0xd7ef('0xe')](_0xd7ef('0xf'),_0x1aef97,_0xd7ef('0x10'));logger[_0xd7ef('0x11')](_0xd7ef('0x12'),_0x1aef97,_0xd7ef('0x10'),JSON[_0xd7ef('0x13')](_0x276993));if(_0x276993[_0xd7ef('0x14')]){if(_0x276993[_0xd7ef('0x14')][_0xd7ef('0x15')]===0x1f4){logger[_0xd7ef('0x14')](_0xd7ef('0xf'),_0x1aef97,_0x276993[_0xd7ef('0x14')]['message']);return _0x52fdd7(_0x276993[_0xd7ef('0x14')]['message']);}logger[_0xd7ef('0x14')](_0xd7ef('0xf'),_0x1aef97,_0x276993['error'][_0xd7ef('0x16')]);return _0x39462c(_0x276993[_0xd7ef('0x14')]['message']);}else{logger['info'](_0xd7ef('0xf'),_0x1aef97,_0xd7ef('0x10'));_0x39462c(_0x276993[_0xd7ef('0x17')][_0xd7ef('0x16')]);}})[_0xd7ef('0x18')](function(_0x2182b9){logger[_0xd7ef('0x14')](_0xd7ef('0xf'),_0x1aef97,_0x2182b9);_0x52fdd7(_0x2182b9);});});} \ No newline at end of file +var _0xe09f=['code','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','stringify','error'];(function(_0x39681e,_0x3109ba){var _0x79eb6e=function(_0x1e6522){while(--_0x1e6522){_0x39681e['push'](_0x39681e['shift']());}};_0x79eb6e(++_0x3109ba);}(_0xe09f,0x191));var _0xfe09=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xe09f[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xfe09('0x0'));var util=require(_0xfe09('0x1'));var moment=require('moment');var BPromise=require(_0xfe09('0x2'));var rs=require(_0xfe09('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfe09('0x4'));var config=require(_0xfe09('0x5'));var jayson=require(_0xfe09('0x6'));var client=jayson[_0xfe09('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53f979,_0x18d33f,_0x111508){return new BPromise(function(_0x5ecb12,_0x1da9cc){return client['request'](_0x53f979,_0x111508)[_0xfe09('0x8')](function(_0x1c0759){logger[_0xfe09('0x9')]('SmsApplication,\x20%s,\x20%s',_0x18d33f,_0xfe09('0xa'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x18d33f,_0xfe09('0xa'),JSON[_0xfe09('0xb')](_0x1c0759));if(_0x1c0759[_0xfe09('0xc')]){if(_0x1c0759[_0xfe09('0xc')][_0xfe09('0xd')]===0x1f4){logger[_0xfe09('0xc')]('SmsApplication,\x20%s,\x20%s',_0x18d33f,_0x1c0759[_0xfe09('0xc')][_0xfe09('0xe')]);return _0x1da9cc(_0x1c0759[_0xfe09('0xc')]['message']);}logger[_0xfe09('0xc')]('SmsApplication,\x20%s,\x20%s',_0x18d33f,_0x1c0759[_0xfe09('0xc')][_0xfe09('0xe')]);return _0x5ecb12(_0x1c0759[_0xfe09('0xc')][_0xfe09('0xe')]);}else{logger[_0xfe09('0x9')](_0xfe09('0xf'),_0x18d33f,'request\x20sent');_0x5ecb12(_0x1c0759[_0xfe09('0x10')][_0xfe09('0xe')]);}})[_0xfe09('0x11')](function(_0x286922){logger[_0xfe09('0xc')](_0xfe09('0xf'),_0x18d33f,_0x286922);_0x1da9cc(_0x286922);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index b516e09..e8f45f7 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 _0x2591=['addTags','put','tracked','smsinteraction:update','delete','/:id','smsinteraction:destroy','destroy','removeTags','exports','multer','path','Router','../../components/auth/service','./smsInteraction.controller','isAuthenticated','/describe','describe','get','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags'];(function(_0x4f84d4,_0x39ee5b){var _0x16be7b=function(_0x5137e6){while(--_0x5137e6){_0x4f84d4['push'](_0x4f84d4['shift']());}};_0x16be7b(++_0x39ee5b);}(_0x2591,0xdc));var _0x1259=function(_0xad1484,_0x165cf1){_0xad1484=_0xad1484-0x0;var _0x47754e=_0x2591[_0xad1484];return _0x47754e;};'use strict';var multer=require(_0x1259('0x0'));var util=require('util');var path=require(_0x1259('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1259('0x2')]();var auth=require(_0x1259('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1259('0x4'));router['get']('/',auth[_0x1259('0x5')](),controller['index']);router['get'](_0x1259('0x6'),auth[_0x1259('0x5')](),controller[_0x1259('0x7')]);router[_0x1259('0x8')]('/:id',auth[_0x1259('0x5')](),controller[_0x1259('0x9')]);router[_0x1259('0x8')](_0x1259('0xa'),auth['isAuthenticated'](),controller[_0x1259('0xb')]);router[_0x1259('0x8')](_0x1259('0xc'),auth[_0x1259('0x5')](),controller[_0x1259('0xd')]);router[_0x1259('0xe')]('/',auth[_0x1259('0x5')](),controller[_0x1259('0xf')]);router[_0x1259('0xe')](_0x1259('0xa'),auth[_0x1259('0x5')](),controller[_0x1259('0x10')]);router[_0x1259('0xe')](_0x1259('0x11'),auth[_0x1259('0x5')](),interaction['tracked'](_0x1259('0x12'),_0x1259('0x13')),controller[_0x1259('0x14')]);router[_0x1259('0x15')]('/:id',auth[_0x1259('0x5')](),interaction[_0x1259('0x16')]('sms',_0x1259('0x17')),controller['update']);router[_0x1259('0x18')](_0x1259('0x19'),auth[_0x1259('0x5')](),interaction[_0x1259('0x16')](_0x1259('0x12'),_0x1259('0x1a')),controller[_0x1259('0x1b')]);router[_0x1259('0x18')](_0x1259('0x11'),auth['isAuthenticated'](),controller[_0x1259('0x1c')]);module[_0x1259('0x1d')]=router; \ No newline at end of file +var _0x8b5e=['sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/messages','download','post','create','addMessage','tracked'];(function(_0x3953a9,_0x41e8f5){var _0x5508aa=function(_0x5934a8){while(--_0x5934a8){_0x3953a9['push'](_0x3953a9['shift']());}};_0x5508aa(++_0x41e8f5);}(_0x8b5e,0x16b));var _0xe8b5=function(_0x144feb,_0x45090b){_0x144feb=_0x144feb-0x0;var _0x2a1f77=_0x8b5e[_0x144feb];return _0x2a1f77;};'use strict';var multer=require(_0xe8b5('0x0'));var util=require(_0xe8b5('0x1'));var path=require(_0xe8b5('0x2'));var timeout=require('connect-timeout');var express=require(_0xe8b5('0x3'));var router=express[_0xe8b5('0x4')]();var auth=require(_0xe8b5('0x5'));var interaction=require(_0xe8b5('0x6'));var config=require('../../config/environment');var controller=require(_0xe8b5('0x7'));router['get']('/',auth[_0xe8b5('0x8')](),controller[_0xe8b5('0x9')]);router['get'](_0xe8b5('0xa'),auth[_0xe8b5('0x8')](),controller[_0xe8b5('0xb')]);router[_0xe8b5('0xc')](_0xe8b5('0xd'),auth[_0xe8b5('0x8')](),controller[_0xe8b5('0xe')]);router[_0xe8b5('0xc')](_0xe8b5('0xf'),auth[_0xe8b5('0x8')](),controller['getMessages']);router['get']('/:id/download',auth[_0xe8b5('0x8')](),controller[_0xe8b5('0x10')]);router[_0xe8b5('0x11')]('/',auth['isAuthenticated'](),controller[_0xe8b5('0x12')]);router[_0xe8b5('0x11')](_0xe8b5('0xf'),auth[_0xe8b5('0x8')](),controller[_0xe8b5('0x13')]);router[_0xe8b5('0x11')]('/:id/tags',auth[_0xe8b5('0x8')](),interaction[_0xe8b5('0x14')](_0xe8b5('0x15'),_0xe8b5('0x16')),controller[_0xe8b5('0x17')]);router[_0xe8b5('0x18')]('/:id',auth[_0xe8b5('0x8')](),interaction['tracked'](_0xe8b5('0x15'),'smsinteraction:update'),controller[_0xe8b5('0x19')]);router[_0xe8b5('0x1a')](_0xe8b5('0xd'),auth[_0xe8b5('0x8')](),interaction[_0xe8b5('0x14')](_0xe8b5('0x15'),_0xe8b5('0x1b')),controller[_0xe8b5('0x1c')]);router[_0xe8b5('0x1a')](_0xe8b5('0x1d'),auth[_0xe8b5('0x8')](),controller[_0xe8b5('0x1e')]);module[_0xe8b5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 472401f..7ad38e5 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 _0x5f64=['sequelize','moment','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x21a1a6,_0x1474bf){var _0x5cec0e=function(_0x13abb9){while(--_0x13abb9){_0x21a1a6['push'](_0x21a1a6['shift']());}};_0x5cec0e(++_0x1474bf);}(_0x5f64,0x16c));var _0x45f6=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x5f64[_0x870b62];return _0x2dcb39;};'use strict';var Sequelize=require(_0x45f6('0x0'));var moment=require(_0x45f6('0x1'));module['exports']={'closed':{'type':Sequelize[_0x45f6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x45f6('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x45f6('0x3')]},'read1stAt':{'type':Sequelize[_0x45f6('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x45f6('0x5')]('in',_0x45f6('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x45f6('0x5')]('in',_0x45f6('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xeac7=['sequelize','moment','exports','DATE','STRING','ENUM','out'];(function(_0x40b797,_0xcfaf1f){var _0x53ca4b=function(_0x418758){while(--_0x418758){_0x40b797['push'](_0x40b797['shift']());}};_0x53ca4b(++_0xcfaf1f);}(_0xeac7,0x118));var _0x7eac=function(_0x1eebd6,_0x2a97a6){_0x1eebd6=_0x1eebd6-0x0;var _0x3ecd57=_0xeac7[_0x1eebd6];return _0x3ecd57;};'use strict';var Sequelize=require(_0x7eac('0x0'));var moment=require(_0x7eac('0x1'));module[_0x7eac('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7eac('0x3')]},'disposition':{'type':Sequelize[_0x7eac('0x4')]},'note':{'type':Sequelize[_0x7eac('0x4')]},'phone':{'type':Sequelize[_0x7eac('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7eac('0x5')]('in',_0x7eac('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7eac('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7eac('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index bcba744..fa52dbe 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 _0xc716=['../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsInteraction','rawAttributes','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','merge','where','map','key','VIRTUAL','field','filter','options','include','tag','push','Tag','Tags','distinct','SmsMessage','Messages','direction','createdAt','read','User','Users','fullname','CmContact','SmsAccount','Account','color','ThroughTags','findAll','rows','catch','params','includeAll','find','create','body','describe','ids','getMessages','findOne','SmsInteractionId','format','addTags','setTags','smsInteractionTags:save','removeTags','download','toString','join','server','files','tmp','attachments','interaction-%s.zip','Contact','firstName','Letter','1cm','mkdirSync','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','','%s:\x20%s

','','interaction-','.pdf','log','err','sendStatus','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment'];(function(_0x11b8c2,_0x3b9aab){var _0x3e9e85=function(_0x4c6158){while(--_0x4c6158){_0x11b8c2['push'](_0x11b8c2['shift']());}};_0x3e9e85(++_0x3b9aab);}(_0xc716,0x16c));var _0x6c71=function(_0x1f7a06,_0x37576c){_0x1f7a06=_0x1f7a06-0x0;var _0x57bd65=_0xc716[_0x1f7a06];return _0x57bd65;};'use strict';var pdf=require(_0x6c71('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6c71('0x1'));var zipdir=require(_0x6c71('0x2'));var jsonpatch=require(_0x6c71('0x3'));var rp=require(_0x6c71('0x4'));var moment=require(_0x6c71('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6c71('0x6'));var util=require('util');var path=require(_0x6c71('0x7'));var sox=require(_0x6c71('0x8'));var csv=require(_0x6c71('0x9'));var ejs=require(_0x6c71('0xa'));var fs=require('fs');var _=require(_0x6c71('0xb'));var squel=require(_0x6c71('0xc'));var crypto=require(_0x6c71('0xd'));var jsforce=require(_0x6c71('0xe'));var deskjs=require(_0x6c71('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6c71('0x10'));var Papa=require('papaparse');var authService=require(_0x6c71('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x6c71('0x12'));var qs=require(_0x6c71('0x13'));var logger=require('../../config/logger')(_0x6c71('0x14'));var utils=require(_0x6c71('0x15'));var config=require(_0x6c71('0x16'));var db=require(_0x6c71('0x17'))['db'];config[_0x6c71('0x18')]=_[_0x6c71('0x19')](config[_0x6c71('0x18')],{'host':_0x6c71('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c71('0x18')]));require(_0x6c71('0x1b'))[_0x6c71('0x1c')](socket);function respondWithStatusCode(_0x4a052c,_0x1c793e){_0x1c793e=_0x1c793e||0xcc;return function(_0x10d2c2){if(_0x10d2c2){return _0x4a052c['sendStatus'](_0x1c793e);}return _0x4a052c[_0x6c71('0x1d')](_0x1c793e)['end']();};}function respondWithResult(_0x87b25a,_0x599108){_0x599108=_0x599108||0xc8;return function(_0x599513){if(_0x599513){return _0x87b25a[_0x6c71('0x1d')](_0x599108)[_0x6c71('0x1e')](_0x599513);}};}function respondWithFilteredResult(_0x4e616e,_0x570947){return function(_0x4d7988){if(_0x4d7988){var _0x43bc41=_0x4d7988[_0x6c71('0x1f')],_0xe0cab2=_0x570947[_0x6c71('0x20')],_0x47fed3=_0x570947['offset']+_0x570947['limit'],_0x258134;if(_0x47fed3>=_0x43bc41){_0x47fed3=_0x43bc41;_0x258134=0xc8;}else{_0x258134=0xce;}_0x4e616e[_0x6c71('0x1d')](_0x258134);return _0x4e616e[_0x6c71('0x21')](_0x6c71('0x22'),_0xe0cab2+'-'+_0x47fed3+'/'+_0x43bc41)[_0x6c71('0x1e')](_0x4d7988);}return null;};}function patchUpdates(_0x84c2e3){return function(_0xe95606){try{jsonpatch[_0x6c71('0x23')](_0xe95606,_0x84c2e3,!![]);}catch(_0x1c4f82){return BPromise[_0x6c71('0x24')](_0x1c4f82);}return _0xe95606[_0x6c71('0x25')]();};}function saveUpdates(_0xec548e,_0x340e45){return function(_0x52bf33){if(_0x52bf33){return _0x52bf33[_0x6c71('0x26')](_0xec548e)[_0x6c71('0x27')](function(_0x1e13d8){return _0x1e13d8;});}return null;};}function removeEntity(_0x411028,_0x3e5ec4){return function(_0x202b0c){if(_0x202b0c){return _0x202b0c[_0x6c71('0x28')]()[_0x6c71('0x27')](function(){_0x411028[_0x6c71('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2523cb,_0x5d76ef){return function(_0x2299e2){if(!_0x2299e2){_0x2523cb['sendStatus'](0x194);}return _0x2299e2;};}function handleError(_0x36d29e,_0x2d3128){_0x2d3128=_0x2d3128||0x1f4;return function(_0x33bf5a){logger[_0x6c71('0x29')](_0x33bf5a[_0x6c71('0x2a')]);if(_0x33bf5a[_0x6c71('0x2b')]){delete _0x33bf5a[_0x6c71('0x2b')];}_0x36d29e[_0x6c71('0x1d')](_0x2d3128)[_0x6c71('0x2c')](_0x33bf5a);};}exports[_0x6c71('0x2d')]=function(_0x37e648,_0x158ad1){var _0x8c3a0e={},_0x2f3fe1={},_0x3ffac5={'count':0x0,'rows':[]};var _0x14f9b9=db[_0x6c71('0x2e')][_0x6c71('0x2f')];_0x2f3fe1['model']=_[_0x6c71('0x30')](_0x14f9b9);_0x2f3fe1[_0x6c71('0x31')]=_[_0x6c71('0x30')](_0x37e648[_0x6c71('0x31')]);_0x2f3fe1['filters']=_[_0x6c71('0x32')](_0x2f3fe1[_0x6c71('0x33')],_0x2f3fe1[_0x6c71('0x31')]);_0x8c3a0e[_0x6c71('0x34')]=_[_0x6c71('0x32')](_0x2f3fe1[_0x6c71('0x33')],qs[_0x6c71('0x35')](_0x37e648['query'][_0x6c71('0x35')]));_0x8c3a0e['attributes']=_0x8c3a0e[_0x6c71('0x34')][_0x6c71('0x36')]?_0x8c3a0e[_0x6c71('0x34')]:_0x2f3fe1['model'];if(!_0x37e648['query'][_0x6c71('0x37')](_0x6c71('0x38'))){_0x8c3a0e[_0x6c71('0x39')]=qs[_0x6c71('0x39')](_0x37e648[_0x6c71('0x31')]['limit']);_0x8c3a0e['offset']=qs['offset'](_0x37e648['query'][_0x6c71('0x20')]);}_0x8c3a0e[_0x6c71('0x3a')]=qs[_0x6c71('0x3b')](_0x37e648[_0x6c71('0x31')][_0x6c71('0x3b')]);_0x8c3a0e['where']=qs[_0x6c71('0x3c')](_[_0x6c71('0x3d')](_0x37e648[_0x6c71('0x31')],_0x2f3fe1[_0x6c71('0x3c')]));if(_0x37e648['query']['filter']){_0x8c3a0e['where']=_[_0x6c71('0x3e')](_0x8c3a0e[_0x6c71('0x3f')],{'$or':_[_0x6c71('0x40')](_0x14f9b9,function(_0x78140c){if(_0x78140c['type'][_0x6c71('0x41')]!==_0x6c71('0x42')){var _0x56aad0={};_0x56aad0[_0x78140c[_0x6c71('0x43')]]={'$like':'%'+_0x37e648[_0x6c71('0x31')][_0x6c71('0x44')]+'%'};return _0x56aad0;}})});}_0x8c3a0e=_[_0x6c71('0x3e')]({},_0x8c3a0e,_0x37e648[_0x6c71('0x45')]);var _0x557eda={'where':_0x8c3a0e['where']};_0x557eda[_0x6c71('0x46')]=[];if(_0x37e648[_0x6c71('0x31')][_0x6c71('0x47')]){_0x557eda[_0x6c71('0x46')][_0x6c71('0x48')]({'model':db[_0x6c71('0x49')],'as':_0x6c71('0x4a'),'attributes':['id'],'where':{'id':_0x37e648[_0x6c71('0x31')]['tag']},'required':!![]});_0x557eda[_0x6c71('0x4b')]=!![];}if(_0x37e648['query']['read']){_0x557eda[_0x6c71('0x46')][_0x6c71('0x48')]({'model':db[_0x6c71('0x4c')],'as':_0x6c71('0x4d'),'attributes':['id',_0x6c71('0x4e'),_0x6c71('0x4f'),'read'],'where':{'direction':'in','read':_0x37e648['query'][_0x6c71('0x50')]||![]},'required':!![]});_0x557eda[_0x6c71('0x4b')]=!![];}return db[_0x6c71('0x2e')][_0x6c71('0x1f')](_0x557eda)[_0x6c71('0x27')](function(_0x4d0580){_0x3ffac5[_0x6c71('0x1f')]=_0x4d0580;if(_0x37e648[_0x6c71('0x31')]['includeAll']){_0x8c3a0e[_0x6c71('0x46')]=[{'model':db[_0x6c71('0x51')],'as':_0x6c71('0x52'),'required':![],'attributes':['id','name',_0x6c71('0x53')]},{'model':db[_0x6c71('0x54')],'as':'Contact','required':![]},{'model':db[_0x6c71('0x51')],'as':'Owner','attributes':['name',_0x6c71('0x53'),'internal'],'required':![]},{'model':db[_0x6c71('0x55')],'as':_0x6c71('0x56'),'attributes':[_0x6c71('0x2b'),_0x6c71('0x41')],'required':![]},{'model':db[_0x6c71('0x4c')],'as':'Messages','attributes':['id',_0x6c71('0x4e'),_0x6c71('0x4f'),'read'],'where':{'direction':'in','read':_0x37e648[_0x6c71('0x31')][_0x6c71('0x50')]||![]},'required':_0x37e648[_0x6c71('0x31')][_0x6c71('0x50')]||![]},{'model':db[_0x6c71('0x49')],'as':'Tags','attributes':['id',_0x6c71('0x2b'),_0x6c71('0x57')],'required':_0x37e648[_0x6c71('0x31')][_0x6c71('0x47')]?!![]:![]},{'model':db[_0x6c71('0x49')],'as':_0x6c71('0x58'),'attributes':['id','name',_0x6c71('0x57')],'through':_0x37e648[_0x6c71('0x31')][_0x6c71('0x47')]?{'attributes':[],'where':{'TagId':_0x37e648[_0x6c71('0x31')][_0x6c71('0x47')]||undefined}}:{},'required':_0x37e648[_0x6c71('0x31')][_0x6c71('0x47')]?!![]:![]}];}return db[_0x6c71('0x2e')][_0x6c71('0x59')](_0x8c3a0e);})['then'](function(_0x26eb57){_0x3ffac5[_0x6c71('0x5a')]=_0x26eb57;return _0x3ffac5;})[_0x6c71('0x27')](respondWithFilteredResult(_0x158ad1,_0x8c3a0e))[_0x6c71('0x5b')](handleError(_0x158ad1,null));};exports['show']=function(_0x5bf3f1,_0x2f0b6c){var _0x3ef3d4={'raw':![],'where':{'id':_0x5bf3f1[_0x6c71('0x5c')]['id']}},_0x399672={};_0x399672[_0x6c71('0x33')]=_[_0x6c71('0x30')](db['SmsInteraction'][_0x6c71('0x2f')]);_0x399672[_0x6c71('0x31')]=_[_0x6c71('0x30')](_0x5bf3f1[_0x6c71('0x31')]);_0x399672[_0x6c71('0x3c')]=_['intersection'](_0x399672[_0x6c71('0x33')],_0x399672[_0x6c71('0x31')]);_0x3ef3d4[_0x6c71('0x34')]=_[_0x6c71('0x32')](_0x399672[_0x6c71('0x33')],qs['fields'](_0x5bf3f1[_0x6c71('0x31')][_0x6c71('0x35')]));_0x3ef3d4[_0x6c71('0x34')]=_0x3ef3d4[_0x6c71('0x34')][_0x6c71('0x36')]?_0x3ef3d4[_0x6c71('0x34')]:_0x399672['model'];if(_0x5bf3f1['query'][_0x6c71('0x5d')]){_0x3ef3d4['include']=[{'all':!![]}];}_0x3ef3d4=_['merge']({},_0x3ef3d4,_0x5bf3f1[_0x6c71('0x45')]);return db[_0x6c71('0x2e')][_0x6c71('0x5e')](_0x3ef3d4)[_0x6c71('0x27')](handleEntityNotFound(_0x2f0b6c,null))['then'](respondWithResult(_0x2f0b6c,null))[_0x6c71('0x5b')](handleError(_0x2f0b6c,null));};exports[_0x6c71('0x5f')]=function(_0x628c02,_0x1cefc){return db[_0x6c71('0x2e')][_0x6c71('0x5f')](_0x628c02[_0x6c71('0x60')],{})[_0x6c71('0x27')](respondWithResult(_0x1cefc,0xc9))[_0x6c71('0x5b')](handleError(_0x1cefc,null));};exports['update']=function(_0x57d698,_0x2cd731){if(_0x57d698['body']['id']){delete _0x57d698[_0x6c71('0x60')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x57d698['params']['id']}})['then'](handleEntityNotFound(_0x2cd731,null))[_0x6c71('0x27')](saveUpdates(_0x57d698[_0x6c71('0x60')],null))['then'](respondWithResult(_0x2cd731,null))[_0x6c71('0x5b')](handleError(_0x2cd731,null));};exports[_0x6c71('0x28')]=function(_0x1cf076,_0x24d64f){return db[_0x6c71('0x2e')][_0x6c71('0x5e')]({'where':{'id':_0x1cf076[_0x6c71('0x5c')]['id']}})[_0x6c71('0x27')](handleEntityNotFound(_0x24d64f,null))['then'](removeEntity(_0x24d64f,null))[_0x6c71('0x5b')](handleError(_0x24d64f,null));};exports[_0x6c71('0x61')]=function(_0x44a52c,_0xac1d8f){return db[_0x6c71('0x2e')][_0x6c71('0x61')]()[_0x6c71('0x27')](respondWithResult(_0xac1d8f,null))[_0x6c71('0x5b')](handleError(_0xac1d8f,null));};exports['addMessage']=function(_0x140d5c,_0x19e829,_0x47e06c){return db['SmsMessage'][_0x6c71('0x5e')]({'where':{'id':_0x140d5c[_0x6c71('0x5c')]['id']}})[_0x6c71('0x27')](handleEntityNotFound(_0x19e829,null))[_0x6c71('0x27')](function(_0x55c84a){if(_0x55c84a){return _0x55c84a['addMessage'](_0x140d5c[_0x6c71('0x60')][_0x6c71('0x62')],_['omit'](_0x140d5c[_0x6c71('0x60')],[_0x6c71('0x62'),'id'])||{});}})[_0x6c71('0x27')](respondWithResult(_0x19e829,null))[_0x6c71('0x5b')](handleError(_0x19e829,null));};exports[_0x6c71('0x63')]=function(_0x3b6c17,_0x196a41,_0x37dff0){var _0x15ef33={'raw':![],'where':{}};var _0x1e035b={};var _0x24cfc0={'count':0x0,'rows':[]};return db[_0x6c71('0x2e')][_0x6c71('0x64')]({'where':{'id':_0x3b6c17['params']['id']}})[_0x6c71('0x27')](handleEntityNotFound(_0x196a41,null))[_0x6c71('0x27')](function(_0x6fd78f){if(_0x6fd78f){_0x1e035b[_0x6c71('0x33')]=_[_0x6c71('0x30')](db[_0x6c71('0x4c')]['rawAttributes']);_0x1e035b[_0x6c71('0x31')]=_[_0x6c71('0x30')](_0x3b6c17[_0x6c71('0x31')]);_0x1e035b[_0x6c71('0x3c')]=_['intersection'](_0x1e035b['model'],_0x1e035b[_0x6c71('0x31')]);_0x15ef33[_0x6c71('0x34')]=_[_0x6c71('0x32')](_0x1e035b[_0x6c71('0x33')],qs['fields'](_0x3b6c17[_0x6c71('0x31')]['fields']));_0x15ef33[_0x6c71('0x34')]=_0x15ef33[_0x6c71('0x34')][_0x6c71('0x36')]?_0x15ef33[_0x6c71('0x34')]:_0x1e035b[_0x6c71('0x33')];if(!_0x3b6c17[_0x6c71('0x31')][_0x6c71('0x37')](_0x6c71('0x38'))){_0x15ef33[_0x6c71('0x39')]=qs[_0x6c71('0x39')](_0x3b6c17['query']['limit']);_0x15ef33['offset']=qs[_0x6c71('0x20')](_0x3b6c17[_0x6c71('0x31')][_0x6c71('0x20')]);}_0x15ef33[_0x6c71('0x3a')]=qs['sort'](_0x3b6c17['query']['sort']);_0x15ef33['where']=qs['filters'](_[_0x6c71('0x3d')](_0x3b6c17['query'],_0x1e035b[_0x6c71('0x3c')]));_0x15ef33[_0x6c71('0x3f')][_0x6c71('0x65')]=_0x6fd78f['id'];if(_0x3b6c17['query']['filter']){_0x15ef33[_0x6c71('0x3f')]=_[_0x6c71('0x3e')](_0x15ef33['where'],{'$or':_[_0x6c71('0x40')](_0x15ef33[_0x6c71('0x34')],function(_0xd9b40e){var _0x3b8079={};_0x3b8079[_0xd9b40e]={'$like':'%'+_0x3b6c17[_0x6c71('0x31')][_0x6c71('0x44')]+'%'};return _0x3b8079;})});}if(_0x3b6c17['query']['$gte']){var _0xf4b95=_0x3b6c17[_0x6c71('0x31')]['$gte']['split'](',');var _0x233f1b={};_0x233f1b[_0xf4b95[0x0]]={'$gte':moment(_0xf4b95[0x1])[_0x6c71('0x66')]('YYYY-MM-DD\x20HH:mm:ss')};_0x15ef33[_0x6c71('0x3f')]=_['merge'](_0x15ef33['where'],_0x233f1b);}_0x15ef33=_['merge']({},_0x15ef33,_0x3b6c17['options']);return db[_0x6c71('0x4c')][_0x6c71('0x1f')]({'where':_0x15ef33[_0x6c71('0x3f')]})[_0x6c71('0x27')](function(_0x449f65){_0x24cfc0[_0x6c71('0x1f')]=_0x449f65;if(_0x3b6c17[_0x6c71('0x31')][_0x6c71('0x5d')]){_0x15ef33[_0x6c71('0x46')]=[{'all':!![]}];}return db['SmsMessage'][_0x6c71('0x59')](_0x15ef33);})[_0x6c71('0x27')](function(_0x5e9ef1){_0x24cfc0[_0x6c71('0x5a')]=_0x5e9ef1;return _0x24cfc0;});}})[_0x6c71('0x27')](respondWithFilteredResult(_0x196a41,_0x15ef33))[_0x6c71('0x5b')](handleError(_0x196a41,null));};exports[_0x6c71('0x67')]=function(_0x92b2e0,_0x44d927,_0x14968e){return db['SmsInteraction'][_0x6c71('0x5e')]({'where':{'id':_0x92b2e0[_0x6c71('0x5c')]['id']}})[_0x6c71('0x27')](handleEntityNotFound(_0x44d927,null))['then'](function(_0x47facb){if(_0x47facb){return _0x47facb[_0x6c71('0x68')](_0x92b2e0[_0x6c71('0x60')][_0x6c71('0x62')],_['omit'](_0x92b2e0['body'],['ids','id'])||{})['spread'](function(){return db[_0x6c71('0x49')][_0x6c71('0x59')]({'attributes':['id',_0x6c71('0x2b'),_0x6c71('0x57')],'where':{'id':_0x92b2e0['body'][_0x6c71('0x62')]}});})[_0x6c71('0x27')](function(_0x3dafae){socket['emit'](_0x6c71('0x69'),{'id':Number(_0x92b2e0[_0x6c71('0x5c')]['id']),'tags':_0x3dafae||[]});return{'id':Number(_0x92b2e0[_0x6c71('0x5c')]['id']),'tags':_0x3dafae||[]};});}})[_0x6c71('0x27')](respondWithResult(_0x44d927,null))[_0x6c71('0x5b')](handleError(_0x44d927,null));};exports['removeTags']=function(_0x328e88,_0xcacded,_0x2dacc){var _0x55d9af;return db['SmsInteraction'][_0x6c71('0x5e')]({'where':{'id':_0x328e88[_0x6c71('0x5c')]['id']}})[_0x6c71('0x27')](handleEntityNotFound(_0xcacded,null))[_0x6c71('0x27')](function(_0x1b28ec){if(_0x1b28ec){return _0x1b28ec[_0x6c71('0x6a')](_0x328e88[_0x6c71('0x31')][_0x6c71('0x62')]);}})[_0x6c71('0x27')](respondWithStatusCode(_0xcacded,null))[_0x6c71('0x5b')](handleError(_0xcacded,null));};exports[_0x6c71('0x6b')]=function(_0x5ccf0d,_0x95e20){var _0x4d3b99=moment()['unix']()[_0x6c71('0x6c')]();var _0x2a9a4b=path[_0x6c71('0x6d')](config['root'],_0x6c71('0x6e'),_0x6c71('0x6f'),_0x6c71('0x70'));var _0x51aefd=path[_0x6c71('0x6d')](config['root'],_0x6c71('0x6e'),_0x6c71('0x6f'),_0x6c71('0x71'));var _0x3c0b63=path[_0x6c71('0x6d')](_0x2a9a4b,_0x4d3b99);var _0x363772=util[_0x6c71('0x66')](_0x6c71('0x72'),_0x4d3b99);var _0x132b4f=path[_0x6c71('0x6d')](_0x2a9a4b,_0x363772);var _0x10ba9e=![];return db[_0x6c71('0x2e')][_0x6c71('0x5e')]({'where':{'id':_0x5ccf0d[_0x6c71('0x5c')]['id']},'include':[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x6c71('0x60')],'include':[{'model':db['User'],'as':'User','attributes':['id',_0x6c71('0x53')],'raw':!![]},{'model':db[_0x6c71('0x54')],'as':_0x6c71('0x73'),'attributes':['id',_0x6c71('0x74')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x95e20,null))['then'](function(_0x256629){if(_0x256629){_0x10ba9e=!![];var _0x4399a8='';var _0x572324={'format':_0x6c71('0x75'),'border':_0x6c71('0x76')};fs[_0x6c71('0x77')](_0x3c0b63);_0x4399a8+=util[_0x6c71('0x66')]('

Sms\x20Interaction:\x20#%d

',_0x256629['id']);_0x4399a8+=util['format']('

Date:\x20%s

',moment()[_0x6c71('0x66')](_0x6c71('0x78'))['toString']());_0x4399a8+='
';for(var _0xade01c=0x0;_0xade01c<_0x256629[_0x6c71('0x4d')]['length'];_0xade01c++){var _0x4b425e=_0x256629[_0x6c71('0x4d')][_0xade01c];_0x4399a8+=_0x6c71('0x79');_0x4399a8+=util[_0x6c71('0x66')](_0x6c71('0x7a'),_0x4b425e[_0x6c71('0x51')]?_0x4b425e[_0x6c71('0x51')][_0x6c71('0x53')]:_0x4b425e[_0x6c71('0x73')][_0x6c71('0x74')],_0x4b425e[_0x6c71('0x60')]);_0x4399a8+=_0x6c71('0x7b');}return new BPromise(function(_0x42b453,_0x566bd9){pdf['create'](_0x4399a8,_0x572324)['toFile'](path['join'](_0x3c0b63,_0x6c71('0x7c')+_0x4d3b99+_0x6c71('0x7d')),function(_0x46ce72,_0x305663){if(_0x46ce72)return _0x566bd9(_0x46ce72);_0x42b453(_0x305663);});});}})['then'](function(){if(_0x10ba9e){return new BPromise(function(_0x3eda67,_0x44bd05){zipdir(_0x3c0b63,{'saveTo':_0x132b4f},function(_0x50e2b7,_0xbd4693){if(_0x50e2b7)return _0x44bd05(_0x50e2b7);return _0x3eda67(_0xbd4693);});});}})['then'](function(){if(_0x10ba9e){return new BPromise(function(_0x38ae0f,_0x99f5d0){rimraf(_0x3c0b63,function(_0x5928aa){if(_0x5928aa)_0x99f5d0(_0x5928aa);return _0x38ae0f();});});}})[_0x6c71('0x27')](function(){if(_0x10ba9e){return _0x95e20[_0x6c71('0x6b')](_0x132b4f,_0x363772,function(_0x46dc40){if(_0x46dc40){console[_0x6c71('0x7e')](_0x6c71('0x7f'),_0x46dc40);}else{fs['unlinkSync'](_0x132b4f);}});}else{return _0x95e20[_0x6c71('0x80')](0xc8);}})['catch'](handleError(_0x95e20,null));}; \ No newline at end of file +var _0x279d=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','key','VIRTUAL','field','options','include','push','Tag','Tags','tag','read','direction','createdAt','includeAll','User','Users','fullname','CmContact','Contact','Owner','internal','Account','SmsMessage','color','ThroughTags','findAll','rows','catch','show','create','body','params','describe','addMessage','find','ids','getMessages','findOne','$gte','split','format','setTags','omit','spread','smsInteractionTags:save','removeTags','download','unix','root','server','files','join','attachments','interaction-%s.zip','mkdirSync','

Sms\x20Interaction:\x20#%d

','
','Messages','','%s:\x20%s

','firstName','','toFile','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./smsInteraction.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','stack','name','send','SmsInteraction','rawAttributes'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x279d,0x1d8));var _0xd279=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x279d[_0x2faddb];return _0x273c05;};'use strict';var pdf=require(_0xd279('0x0'));var emlformat=require(_0xd279('0x1'));var rimraf=require(_0xd279('0x2'));var zipdir=require(_0xd279('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd279('0x4'));var BPromise=require(_0xd279('0x5'));var Mustache=require('mustache');var util=require(_0xd279('0x6'));var path=require(_0xd279('0x7'));var sox=require(_0xd279('0x8'));var csv=require(_0xd279('0x9'));var ejs=require(_0xd279('0xa'));var fs=require('fs');var _=require(_0xd279('0xb'));var squel=require(_0xd279('0xc'));var crypto=require('crypto');var jsforce=require(_0xd279('0xd'));var deskjs=require(_0xd279('0xe'));var toCsv=require(_0xd279('0x9'));var querystring=require(_0xd279('0xf'));var Papa=require(_0xd279('0x10'));var authService=require(_0xd279('0x11'));var hardwareService=require(_0xd279('0x12'));var Redis=require(_0xd279('0x13'));var qs=require(_0xd279('0x14'));var logger=require(_0xd279('0x15'))(_0xd279('0x16'));var utils=require('../../config/utils');var config=require(_0xd279('0x17'));var db=require('../../mysqldb')['db'];config[_0xd279('0x18')]=_[_0xd279('0x19')](config['redis'],{'host':_0xd279('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd279('0x1b'))['register'](socket);function respondWithStatusCode(_0x426d48,_0x5c3b48){_0x5c3b48=_0x5c3b48||0xcc;return function(_0x2bf8e3){if(_0x2bf8e3){return _0x426d48[_0xd279('0x1c')](_0x5c3b48);}return _0x426d48[_0xd279('0x1d')](_0x5c3b48)[_0xd279('0x1e')]();};}function respondWithResult(_0x5c1c0f,_0x55b3c5){_0x55b3c5=_0x55b3c5||0xc8;return function(_0x20db5d){if(_0x20db5d){return _0x5c1c0f[_0xd279('0x1d')](_0x55b3c5)[_0xd279('0x1f')](_0x20db5d);}};}function respondWithFilteredResult(_0x347f8b,_0x540695){return function(_0x5701c0){if(_0x5701c0){var _0x591f5f=_0x5701c0[_0xd279('0x20')],_0x5a52fd=_0x540695['offset'],_0x544e01=_0x540695[_0xd279('0x21')]+_0x540695[_0xd279('0x22')],_0x1394bb;if(_0x544e01>=_0x591f5f){_0x544e01=_0x591f5f;_0x1394bb=0xc8;}else{_0x1394bb=0xce;}_0x347f8b[_0xd279('0x1d')](_0x1394bb);return _0x347f8b[_0xd279('0x23')]('Content-Range',_0x5a52fd+'-'+_0x544e01+'/'+_0x591f5f)[_0xd279('0x1f')](_0x5701c0);}return null;};}function patchUpdates(_0x2be01c){return function(_0x5577fc){try{jsonpatch[_0xd279('0x24')](_0x5577fc,_0x2be01c,!![]);}catch(_0x395762){return BPromise[_0xd279('0x25')](_0x395762);}return _0x5577fc[_0xd279('0x26')]();};}function saveUpdates(_0x533ceb,_0x36fd44){return function(_0x2716f4){if(_0x2716f4){return _0x2716f4[_0xd279('0x27')](_0x533ceb)['then'](function(_0x7683bc){return _0x7683bc;});}return null;};}function removeEntity(_0x1a06e7,_0x3a9e73){return function(_0x307599){if(_0x307599){return _0x307599[_0xd279('0x28')]()[_0xd279('0x29')](function(){_0x1a06e7[_0xd279('0x1d')](0xcc)[_0xd279('0x1e')]();});}};}function handleEntityNotFound(_0x440293,_0x48f1b1){return function(_0x53e0f6){if(!_0x53e0f6){_0x440293[_0xd279('0x1c')](0x194);}return _0x53e0f6;};}function handleError(_0x299c67,_0x563637){_0x563637=_0x563637||0x1f4;return function(_0x46a162){logger[_0xd279('0x2a')](_0x46a162[_0xd279('0x2b')]);if(_0x46a162[_0xd279('0x2c')]){delete _0x46a162['name'];}_0x299c67[_0xd279('0x1d')](_0x563637)[_0xd279('0x2d')](_0x46a162);};}exports['index']=function(_0x43aacd,_0x577102){var _0x159ea4={},_0x2347ed={},_0x3e64f6={'count':0x0,'rows':[]};var _0x47175a=db[_0xd279('0x2e')][_0xd279('0x2f')];_0x2347ed[_0xd279('0x30')]=_[_0xd279('0x31')](_0x47175a);_0x2347ed[_0xd279('0x32')]=_['keys'](_0x43aacd[_0xd279('0x32')]);_0x2347ed[_0xd279('0x33')]=_[_0xd279('0x34')](_0x2347ed[_0xd279('0x30')],_0x2347ed[_0xd279('0x32')]);_0x159ea4[_0xd279('0x35')]=_[_0xd279('0x34')](_0x2347ed[_0xd279('0x30')],qs[_0xd279('0x36')](_0x43aacd['query']['fields']));_0x159ea4[_0xd279('0x35')]=_0x159ea4[_0xd279('0x35')][_0xd279('0x37')]?_0x159ea4[_0xd279('0x35')]:_0x2347ed['model'];if(!_0x43aacd[_0xd279('0x32')][_0xd279('0x38')](_0xd279('0x39'))){_0x159ea4[_0xd279('0x22')]=qs['limit'](_0x43aacd[_0xd279('0x32')][_0xd279('0x22')]);_0x159ea4[_0xd279('0x21')]=qs['offset'](_0x43aacd[_0xd279('0x32')]['offset']);}_0x159ea4[_0xd279('0x3a')]=qs['sort'](_0x43aacd[_0xd279('0x32')][_0xd279('0x3b')]);_0x159ea4['where']=qs[_0xd279('0x33')](_[_0xd279('0x3c')](_0x43aacd[_0xd279('0x32')],_0x2347ed['filters']));if(_0x43aacd[_0xd279('0x32')][_0xd279('0x3d')]){_0x159ea4[_0xd279('0x3e')]=_[_0xd279('0x3f')](_0x159ea4[_0xd279('0x3e')],{'$or':_[_0xd279('0x40')](_0x47175a,function(_0x4b27df){if(_0x4b27df['type'][_0xd279('0x41')]!==_0xd279('0x42')){var _0x3ba1ee={};_0x3ba1ee[_0x4b27df[_0xd279('0x43')]]={'$like':'%'+_0x43aacd[_0xd279('0x32')][_0xd279('0x3d')]+'%'};return _0x3ba1ee;}})});}_0x159ea4=_['merge']({},_0x159ea4,_0x43aacd[_0xd279('0x44')]);var _0x5c41d9={'where':_0x159ea4[_0xd279('0x3e')]};_0x5c41d9[_0xd279('0x45')]=[];if(_0x43aacd['query']['tag']){_0x5c41d9[_0xd279('0x45')][_0xd279('0x46')]({'model':db[_0xd279('0x47')],'as':_0xd279('0x48'),'attributes':['id'],'where':{'id':_0x43aacd['query'][_0xd279('0x49')]},'required':!![]});_0x5c41d9['distinct']=!![];}if(_0x43aacd[_0xd279('0x32')][_0xd279('0x4a')]){_0x5c41d9[_0xd279('0x45')][_0xd279('0x46')]({'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xd279('0x4b'),_0xd279('0x4c'),_0xd279('0x4a')],'where':{'direction':'in','read':_0x43aacd[_0xd279('0x32')][_0xd279('0x4a')]||![]},'required':!![]});_0x5c41d9['distinct']=!![];}return db['SmsInteraction'][_0xd279('0x20')](_0x5c41d9)[_0xd279('0x29')](function(_0x3353d8){_0x3e64f6['count']=_0x3353d8;if(_0x43aacd['query'][_0xd279('0x4d')]){_0x159ea4['include']=[{'model':db[_0xd279('0x4e')],'as':_0xd279('0x4f'),'required':![],'attributes':['id','name',_0xd279('0x50')]},{'model':db[_0xd279('0x51')],'as':_0xd279('0x52'),'required':![]},{'model':db[_0xd279('0x4e')],'as':_0xd279('0x53'),'attributes':[_0xd279('0x2c'),_0xd279('0x50'),_0xd279('0x54')],'required':![]},{'model':db['SmsAccount'],'as':_0xd279('0x55'),'attributes':[_0xd279('0x2c'),_0xd279('0x41')],'required':![]},{'model':db[_0xd279('0x56')],'as':'Messages','attributes':['id',_0xd279('0x4b'),_0xd279('0x4c'),_0xd279('0x4a')],'where':{'direction':'in','read':_0x43aacd[_0xd279('0x32')][_0xd279('0x4a')]||![]},'required':_0x43aacd[_0xd279('0x32')][_0xd279('0x4a')]||![]},{'model':db[_0xd279('0x47')],'as':_0xd279('0x48'),'attributes':['id',_0xd279('0x2c'),_0xd279('0x57')],'required':_0x43aacd['query']['tag']?!![]:![]},{'model':db['Tag'],'as':_0xd279('0x58'),'attributes':['id',_0xd279('0x2c'),_0xd279('0x57')],'through':_0x43aacd[_0xd279('0x32')][_0xd279('0x49')]?{'attributes':[],'where':{'TagId':_0x43aacd[_0xd279('0x32')][_0xd279('0x49')]||undefined}}:{},'required':_0x43aacd['query'][_0xd279('0x49')]?!![]:![]}];}return db[_0xd279('0x2e')][_0xd279('0x59')](_0x159ea4);})[_0xd279('0x29')](function(_0x3e95b9){_0x3e64f6[_0xd279('0x5a')]=_0x3e95b9;return _0x3e64f6;})[_0xd279('0x29')](respondWithFilteredResult(_0x577102,_0x159ea4))[_0xd279('0x5b')](handleError(_0x577102,null));};exports[_0xd279('0x5c')]=function(_0x3f43d6,_0x302c33){var _0x81278c={'raw':![],'where':{'id':_0x3f43d6['params']['id']}},_0x341d92={};_0x341d92[_0xd279('0x30')]=_['keys'](db[_0xd279('0x2e')][_0xd279('0x2f')]);_0x341d92[_0xd279('0x32')]=_[_0xd279('0x31')](_0x3f43d6['query']);_0x341d92[_0xd279('0x33')]=_[_0xd279('0x34')](_0x341d92[_0xd279('0x30')],_0x341d92[_0xd279('0x32')]);_0x81278c[_0xd279('0x35')]=_[_0xd279('0x34')](_0x341d92[_0xd279('0x30')],qs[_0xd279('0x36')](_0x3f43d6[_0xd279('0x32')][_0xd279('0x36')]));_0x81278c['attributes']=_0x81278c[_0xd279('0x35')][_0xd279('0x37')]?_0x81278c[_0xd279('0x35')]:_0x341d92['model'];if(_0x3f43d6['query'][_0xd279('0x4d')]){_0x81278c[_0xd279('0x45')]=[{'all':!![]}];}_0x81278c=_[_0xd279('0x3f')]({},_0x81278c,_0x3f43d6[_0xd279('0x44')]);return db[_0xd279('0x2e')]['find'](_0x81278c)[_0xd279('0x29')](handleEntityNotFound(_0x302c33,null))[_0xd279('0x29')](respondWithResult(_0x302c33,null))[_0xd279('0x5b')](handleError(_0x302c33,null));};exports[_0xd279('0x5d')]=function(_0x5df5ab,_0x1cf7ef){return db[_0xd279('0x2e')][_0xd279('0x5d')](_0x5df5ab[_0xd279('0x5e')],{})['then'](respondWithResult(_0x1cf7ef,0xc9))[_0xd279('0x5b')](handleError(_0x1cf7ef,null));};exports[_0xd279('0x27')]=function(_0x568376,_0x45ad2b){if(_0x568376[_0xd279('0x5e')]['id']){delete _0x568376[_0xd279('0x5e')]['id'];}return db[_0xd279('0x2e')]['find']({'where':{'id':_0x568376[_0xd279('0x5f')]['id']}})[_0xd279('0x29')](handleEntityNotFound(_0x45ad2b,null))[_0xd279('0x29')](saveUpdates(_0x568376[_0xd279('0x5e')],null))[_0xd279('0x29')](respondWithResult(_0x45ad2b,null))[_0xd279('0x5b')](handleError(_0x45ad2b,null));};exports[_0xd279('0x28')]=function(_0x384416,_0x30d8e1){return db[_0xd279('0x2e')]['find']({'where':{'id':_0x384416[_0xd279('0x5f')]['id']}})[_0xd279('0x29')](handleEntityNotFound(_0x30d8e1,null))[_0xd279('0x29')](removeEntity(_0x30d8e1,null))[_0xd279('0x5b')](handleError(_0x30d8e1,null));};exports[_0xd279('0x60')]=function(_0x5c4c29,_0x17477d){return db['SmsInteraction'][_0xd279('0x60')]()['then'](respondWithResult(_0x17477d,null))[_0xd279('0x5b')](handleError(_0x17477d,null));};exports[_0xd279('0x61')]=function(_0x54ebb7,_0x23fab9,_0x7577d9){return db['SmsMessage'][_0xd279('0x62')]({'where':{'id':_0x54ebb7[_0xd279('0x5f')]['id']}})[_0xd279('0x29')](handleEntityNotFound(_0x23fab9,null))['then'](function(_0x1ea931){if(_0x1ea931){return _0x1ea931[_0xd279('0x61')](_0x54ebb7['body'][_0xd279('0x63')],_['omit'](_0x54ebb7['body'],[_0xd279('0x63'),'id'])||{});}})[_0xd279('0x29')](respondWithResult(_0x23fab9,null))[_0xd279('0x5b')](handleError(_0x23fab9,null));};exports[_0xd279('0x64')]=function(_0x2758da,_0x3b0bb6,_0x53d77e){var _0x2cbd79={'raw':![],'where':{}};var _0x4868dd={};var _0x43d60f={'count':0x0,'rows':[]};return db[_0xd279('0x2e')][_0xd279('0x65')]({'where':{'id':_0x2758da[_0xd279('0x5f')]['id']}})[_0xd279('0x29')](handleEntityNotFound(_0x3b0bb6,null))[_0xd279('0x29')](function(_0x436000){if(_0x436000){_0x4868dd['model']=_[_0xd279('0x31')](db[_0xd279('0x56')]['rawAttributes']);_0x4868dd['query']=_[_0xd279('0x31')](_0x2758da['query']);_0x4868dd[_0xd279('0x33')]=_[_0xd279('0x34')](_0x4868dd[_0xd279('0x30')],_0x4868dd[_0xd279('0x32')]);_0x2cbd79['attributes']=_[_0xd279('0x34')](_0x4868dd[_0xd279('0x30')],qs[_0xd279('0x36')](_0x2758da['query'][_0xd279('0x36')]));_0x2cbd79[_0xd279('0x35')]=_0x2cbd79[_0xd279('0x35')][_0xd279('0x37')]?_0x2cbd79[_0xd279('0x35')]:_0x4868dd[_0xd279('0x30')];if(!_0x2758da[_0xd279('0x32')]['hasOwnProperty'](_0xd279('0x39'))){_0x2cbd79[_0xd279('0x22')]=qs[_0xd279('0x22')](_0x2758da[_0xd279('0x32')][_0xd279('0x22')]);_0x2cbd79[_0xd279('0x21')]=qs[_0xd279('0x21')](_0x2758da['query'][_0xd279('0x21')]);}_0x2cbd79['order']=qs[_0xd279('0x3b')](_0x2758da[_0xd279('0x32')]['sort']);_0x2cbd79['where']=qs['filters'](_[_0xd279('0x3c')](_0x2758da[_0xd279('0x32')],_0x4868dd['filters']));_0x2cbd79[_0xd279('0x3e')]['SmsInteractionId']=_0x436000['id'];if(_0x2758da[_0xd279('0x32')][_0xd279('0x3d')]){_0x2cbd79[_0xd279('0x3e')]=_[_0xd279('0x3f')](_0x2cbd79['where'],{'$or':_[_0xd279('0x40')](_0x2cbd79[_0xd279('0x35')],function(_0x4e3320){var _0x5aef5d={};_0x5aef5d[_0x4e3320]={'$like':'%'+_0x2758da[_0xd279('0x32')][_0xd279('0x3d')]+'%'};return _0x5aef5d;})});}if(_0x2758da[_0xd279('0x32')][_0xd279('0x66')]){var _0x5efa9d=_0x2758da['query'][_0xd279('0x66')][_0xd279('0x67')](',');var _0x23cd93={};_0x23cd93[_0x5efa9d[0x0]]={'$gte':moment(_0x5efa9d[0x1])[_0xd279('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2cbd79[_0xd279('0x3e')]=_[_0xd279('0x3f')](_0x2cbd79[_0xd279('0x3e')],_0x23cd93);}_0x2cbd79=_['merge']({},_0x2cbd79,_0x2758da['options']);return db['SmsMessage'][_0xd279('0x20')]({'where':_0x2cbd79[_0xd279('0x3e')]})[_0xd279('0x29')](function(_0x4ba16c){_0x43d60f['count']=_0x4ba16c;if(_0x2758da[_0xd279('0x32')][_0xd279('0x4d')]){_0x2cbd79[_0xd279('0x45')]=[{'all':!![]}];}return db['SmsMessage'][_0xd279('0x59')](_0x2cbd79);})[_0xd279('0x29')](function(_0x18f19a){_0x43d60f[_0xd279('0x5a')]=_0x18f19a;return _0x43d60f;});}})[_0xd279('0x29')](respondWithFilteredResult(_0x3b0bb6,_0x2cbd79))['catch'](handleError(_0x3b0bb6,null));};exports['addTags']=function(_0x4d1f43,_0x35cd3c,_0x6f6c0b){return db['SmsInteraction'][_0xd279('0x62')]({'where':{'id':_0x4d1f43[_0xd279('0x5f')]['id']}})[_0xd279('0x29')](handleEntityNotFound(_0x35cd3c,null))[_0xd279('0x29')](function(_0x54e82d){if(_0x54e82d){return _0x54e82d[_0xd279('0x69')](_0x4d1f43[_0xd279('0x5e')]['ids'],_[_0xd279('0x6a')](_0x4d1f43[_0xd279('0x5e')],[_0xd279('0x63'),'id'])||{})[_0xd279('0x6b')](function(){return db['Tag']['findAll']({'attributes':['id',_0xd279('0x2c'),_0xd279('0x57')],'where':{'id':_0x4d1f43['body']['ids']}});})[_0xd279('0x29')](function(_0x3c22e1){socket['emit'](_0xd279('0x6c'),{'id':Number(_0x4d1f43[_0xd279('0x5f')]['id']),'tags':_0x3c22e1||[]});return{'id':Number(_0x4d1f43[_0xd279('0x5f')]['id']),'tags':_0x3c22e1||[]};});}})[_0xd279('0x29')](respondWithResult(_0x35cd3c,null))['catch'](handleError(_0x35cd3c,null));};exports[_0xd279('0x6d')]=function(_0x4033d9,_0x39f5ce,_0x23865d){var _0x4109f1;return db[_0xd279('0x2e')][_0xd279('0x62')]({'where':{'id':_0x4033d9[_0xd279('0x5f')]['id']}})[_0xd279('0x29')](handleEntityNotFound(_0x39f5ce,null))['then'](function(_0x35407d){if(_0x35407d){return _0x35407d[_0xd279('0x6d')](_0x4033d9[_0xd279('0x32')][_0xd279('0x63')]);}})[_0xd279('0x29')](respondWithStatusCode(_0x39f5ce,null))[_0xd279('0x5b')](handleError(_0x39f5ce,null));};exports[_0xd279('0x6e')]=function(_0x8fcabe,_0x56339d){var _0xea4003=moment()[_0xd279('0x6f')]()['toString']();var _0x1de303=path['join'](config[_0xd279('0x70')],_0xd279('0x71'),_0xd279('0x72'),'tmp');var _0x1949cf=path[_0xd279('0x73')](config[_0xd279('0x70')],'server',_0xd279('0x72'),_0xd279('0x74'));var _0xaf3a29=path[_0xd279('0x73')](_0x1de303,_0xea4003);var _0x4bb51d=util[_0xd279('0x68')](_0xd279('0x75'),_0xea4003);var _0x3673c5=path[_0xd279('0x73')](_0x1de303,_0x4bb51d);var _0x56c1c5=![];return db[_0xd279('0x2e')][_0xd279('0x62')]({'where':{'id':_0x8fcabe[_0xd279('0x5f')]['id']},'include':[{'model':db[_0xd279('0x56')],'as':'Messages','attributes':['id',_0xd279('0x5e')],'include':[{'model':db[_0xd279('0x4e')],'as':_0xd279('0x4e'),'attributes':['id',_0xd279('0x50')],'raw':!![]},{'model':db[_0xd279('0x51')],'as':'Contact','attributes':['id','firstName'],'raw':!![]}]}]})[_0xd279('0x29')](handleEntityNotFound(_0x56339d,null))[_0xd279('0x29')](function(_0x236482){if(_0x236482){_0x56c1c5=!![];var _0x17ea9d='';var _0xbde294={'format':'Letter','border':'1cm'};fs[_0xd279('0x76')](_0xaf3a29);_0x17ea9d+=util[_0xd279('0x68')](_0xd279('0x77'),_0x236482['id']);_0x17ea9d+=util[_0xd279('0x68')]('

Date:\x20%s

',moment()['format']('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')['toString']());_0x17ea9d+=_0xd279('0x78');for(var _0x2db666=0x0;_0x2db666<_0x236482[_0xd279('0x79')]['length'];_0x2db666++){var _0xe8fb97=_0x236482[_0xd279('0x79')][_0x2db666];_0x17ea9d+=_0xd279('0x7a');_0x17ea9d+=util[_0xd279('0x68')](_0xd279('0x7b'),_0xe8fb97[_0xd279('0x4e')]?_0xe8fb97['User']['fullname']:_0xe8fb97[_0xd279('0x52')][_0xd279('0x7c')],_0xe8fb97['body']);_0x17ea9d+=_0xd279('0x7d');}return new BPromise(function(_0x46bdc2,_0x4642c0){pdf[_0xd279('0x5d')](_0x17ea9d,_0xbde294)[_0xd279('0x7e')](path[_0xd279('0x73')](_0xaf3a29,'interaction-'+_0xea4003+_0xd279('0x7f')),function(_0x4ab7f1,_0x30eb34){if(_0x4ab7f1)return _0x4642c0(_0x4ab7f1);_0x46bdc2(_0x30eb34);});});}})[_0xd279('0x29')](function(){if(_0x56c1c5){return new BPromise(function(_0x260111,_0x1dcd2a){zipdir(_0xaf3a29,{'saveTo':_0x3673c5},function(_0x12b7e1,_0x572171){if(_0x12b7e1)return _0x1dcd2a(_0x12b7e1);return _0x260111(_0x572171);});});}})[_0xd279('0x29')](function(){if(_0x56c1c5){return new BPromise(function(_0xfa401d,_0x1c90fb){rimraf(_0xaf3a29,function(_0x161afe){if(_0x161afe)_0x1c90fb(_0x161afe);return _0xfa401d();});});}})[_0xd279('0x29')](function(){if(_0x56c1c5){return _0x56339d[_0xd279('0x6e')](_0x3673c5,_0x4bb51d,function(_0x21c429){if(_0x21c429){console['log'](_0xd279('0x80'),_0x21c429);}else{fs[_0xd279('0x81')](_0x3673c5);}});}else{return _0x56339d['sendStatus'](0xc8);}})['catch'](handleError(_0x56339d,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 286e9dc..80bd015 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 _0x43bc=['SmsInteraction','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x43bc,0x16e));var _0xc43b=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0x43bc[_0x5ef55a];return _0x20ae40;};'use strict';var EventEmitter=require(_0xc43b('0x0'));var SmsInteraction=require(_0xc43b('0x1'))['db'][_0xc43b('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc43b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2124b6){return function(_0x1b74af,_0x3d4ba0,_0x330569){SmsInteractionEvents[_0xc43b('0x4')](_0x2124b6+':'+_0x1b74af['id'],_0x1b74af);SmsInteractionEvents['emit'](_0x2124b6,_0x1b74af);_0x330569(null);};}for(var e in events){if(events[_0xc43b('0x5')](e)){var event=events[e];SmsInteraction[_0xc43b('0x6')](e,emitEvent(event));}}module[_0xc43b('0x7')]=SmsInteractionEvents; \ No newline at end of file +var _0x0037=['../../mysqldb','setMaxListeners','save','remove','emit','hook','events'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x0037,0x14f));var _0x7003=function(_0x42981c,_0x4b81a2){_0x42981c=_0x42981c-0x0;var _0x55749b=_0x0037[_0x42981c];return _0x55749b;};'use strict';var EventEmitter=require(_0x7003('0x0'));var SmsInteraction=require(_0x7003('0x1'))['db']['SmsInteraction'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7003('0x2')](0x0);var events={'afterCreate':_0x7003('0x3'),'afterUpdate':'update','afterDestroy':_0x7003('0x4')};function emitEvent(_0x4d55d3){return function(_0xa42228,_0x3518f6,_0x2a8125){SmsInteractionEvents['emit'](_0x4d55d3+':'+_0xa42228['id'],_0xa42228);SmsInteractionEvents[_0x7003('0x5')](_0x4d55d3,_0xa42228);_0x2a8125(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x7003('0x6')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index f199dd9..7f237ab 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 _0x8d9b=['lodash','util','../../config/logger','api','moment','./smsInteraction.attributes','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x54a0ba,_0x54b615){var _0x4a9fa9=function(_0x5a2bc1){while(--_0x5a2bc1){_0x54a0ba['push'](_0x54a0ba['shift']());}};_0x4a9fa9(++_0x54b615);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var util=require(_0xb8d9('0x1'));var logger=require(_0xb8d9('0x2'))(_0xb8d9('0x3'));var moment=require(_0xb8d9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xb8d9('0x5'));module['exports']=function(_0x2192ff,_0x3da7ad){return _0x2192ff['define']('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21c87d,_0x537b18,_0x53339b){if(_0x21c87d['changed'](_0xb8d9('0x6'))){_0x21c87d[_0xb8d9('0x7')]=moment()[_0xb8d9('0x8')](_0xb8d9('0x9'));}_0x53339b(null,_0x21c87d);}}});}; \ No newline at end of file +var _0x48a7=['SmsInteraction','sms_interactions','changed','closedAt','format','util','../../config/logger','api','moment','request-promise','./smsInteraction.attributes','define'];(function(_0x3b69f9,_0x53443c){var _0x2caded=function(_0x5c18b3){while(--_0x5c18b3){_0x3b69f9['push'](_0x3b69f9['shift']());}};_0x2caded(++_0x53443c);}(_0x48a7,0x13d));var _0x748a=function(_0x4a6b97,_0x3f0f48){_0x4a6b97=_0x4a6b97-0x0;var _0x4a4d58=_0x48a7[_0x4a6b97];return _0x4a4d58;};'use strict';var _=require('lodash');var util=require(_0x748a('0x0'));var logger=require(_0x748a('0x1'))(_0x748a('0x2'));var moment=require(_0x748a('0x3'));var BPromise=require('bluebird');var rp=require(_0x748a('0x4'));var attributes=require(_0x748a('0x5'));module['exports']=function(_0x2ba071,_0x5e809c){return _0x2ba071[_0x748a('0x6')](_0x748a('0x7'),attributes,{'tableName':_0x748a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x307cc1,_0x3e0366,_0x43d6bc){if(_0x307cc1[_0x748a('0x9')]('closed')){_0x307cc1[_0x748a('0xa')]=moment()[_0x748a('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x43d6bc(null,_0x307cc1);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3216f33..57867bd 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 _0xeb39=['info','result','catch','SmsInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToSmsInteraction','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0xeb39,0x1bd));var _0x9eb3=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xeb39[_0x4de586];return _0x46baf5;};'use strict';var _=require(_0x9eb3('0x0'));var util=require(_0x9eb3('0x1'));var moment=require(_0x9eb3('0x2'));var BPromise=require(_0x9eb3('0x3'));var rs=require(_0x9eb3('0x4'));var fs=require('fs');var Redis=require(_0x9eb3('0x5'));var db=require(_0x9eb3('0x6'))['db'];var utils=require(_0x9eb3('0x7'));var logger=require(_0x9eb3('0x8'))('rpc');var config=require(_0x9eb3('0x9'));var jayson=require(_0x9eb3('0xa'));var client=jayson['client'][_0x9eb3('0xb')]({'port':0x232a});config[_0x9eb3('0xc')]=_[_0x9eb3('0xd')](config[_0x9eb3('0xc')],{'host':_0x9eb3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x14774e,_0x35a364,_0x43d81c){return new BPromise(function(_0x146c57,_0x39de21){return client[_0x9eb3('0xf')](_0x14774e,_0x43d81c)[_0x9eb3('0x10')](function(_0x54f9af){logger['info'](_0x9eb3('0x11'),_0x35a364,'request\x20sent');logger[_0x9eb3('0x12')](_0x9eb3('0x13'),_0x35a364,'request\x20sent',JSON['stringify'](_0x54f9af));if(_0x54f9af[_0x9eb3('0x14')]){if(_0x54f9af[_0x9eb3('0x14')][_0x9eb3('0x15')]===0x1f4){logger[_0x9eb3('0x14')](_0x9eb3('0x11'),_0x35a364,_0x54f9af['error'][_0x9eb3('0x16')]);return _0x39de21(_0x54f9af[_0x9eb3('0x14')]['message']);}logger[_0x9eb3('0x14')](_0x9eb3('0x11'),_0x35a364,_0x54f9af[_0x9eb3('0x14')]['message']);return _0x146c57(_0x54f9af[_0x9eb3('0x14')][_0x9eb3('0x16')]);}else{logger[_0x9eb3('0x17')](_0x9eb3('0x11'),_0x35a364,'request\x20sent');_0x146c57(_0x54f9af[_0x9eb3('0x18')][_0x9eb3('0x16')]);}})[_0x9eb3('0x19')](function(_0x314df6){logger['error'](_0x9eb3('0x11'),_0x35a364,_0x314df6);_0x39de21(_0x314df6);});});}exports['UpdateSmsInteraction']=function(_0x48a4d7){var _0x3b3ebf=this;return new Promise(function(_0x105f75,_0x177195){return db[_0x9eb3('0x1a')]['update'](_0x48a4d7[_0x9eb3('0x1b')],{'raw':_0x48a4d7[_0x9eb3('0x1c')]?_0x48a4d7[_0x9eb3('0x1c')][_0x9eb3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48a4d7[_0x9eb3('0x1c')]?_0x48a4d7[_0x9eb3('0x1c')][_0x9eb3('0x1e')]||null:null,'attributes':_0x48a4d7[_0x9eb3('0x1c')]?_0x48a4d7['options'][_0x9eb3('0x1f')]||null:null,'limit':_0x48a4d7[_0x9eb3('0x1c')]?_0x48a4d7[_0x9eb3('0x1c')][_0x9eb3('0x20')]||null:null})[_0x9eb3('0x10')](function(_0x1f3f0f){logger[_0x9eb3('0x17')]('UpdateSmsInteraction',_0x48a4d7);logger[_0x9eb3('0x12')]('UpdateSmsInteraction',_0x48a4d7,JSON[_0x9eb3('0x21')](_0x1f3f0f));_0x105f75(_0x1f3f0f);})[_0x9eb3('0x19')](function(_0x58bc0c){logger[_0x9eb3('0x14')]('UpdateSmsInteraction',_0x58bc0c[_0x9eb3('0x16')],_0x48a4d7);_0x177195(_0x3b3ebf['error'](0x1f4,_0x58bc0c['message']));});});};exports[_0x9eb3('0x22')]=function(_0x1387d5){return new Promise(function(_0x48aa3c,_0x244b8b){return db['SmsInteraction']['find']({'where':_0x1387d5[_0x9eb3('0x1c')]?_0x1387d5[_0x9eb3('0x1c')][_0x9eb3('0x1e')]||null:null})[_0x9eb3('0x10')](function(_0x5a09a6){if(_0x5a09a6){return _0x5a09a6[_0x9eb3('0x23')](_0x1387d5[_0x9eb3('0x1b')][_0x9eb3('0x24')],_[_0x9eb3('0x25')](_0x1387d5[_0x9eb3('0x1b')],[_0x9eb3('0x24'),'id'])||{});}})['spread'](function(_0x2ef499){logger[_0x9eb3('0x17')](_0x9eb3('0x26'),_0x1387d5);logger[_0x9eb3('0x12')]('AddTags',_0x1387d5,JSON[_0x9eb3('0x21')](_0x2ef499));_0x48aa3c(_0x2ef499);})['catch'](function(_0x48444f){logger['error'](_0x9eb3('0x26'),_0x48444f[_0x9eb3('0x16')],_0x1387d5);_0x244b8b(_this[_0x9eb3('0x14')](0x1f4,_0x48444f['message']));});});}; \ No newline at end of file +var _0xc3f6=['message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','then','debug','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0xc3f6,0x181));var _0x6c3f=function(_0x2a5ed,_0x19e228){_0x2a5ed=_0x2a5ed-0x0;var _0x4bf105=_0xc3f6[_0x2a5ed];return _0x4bf105;};'use strict';var _=require(_0x6c3f('0x0'));var util=require(_0x6c3f('0x1'));var moment=require(_0x6c3f('0x2'));var BPromise=require(_0x6c3f('0x3'));var rs=require(_0x6c3f('0x4'));var fs=require('fs');var Redis=require(_0x6c3f('0x5'));var db=require(_0x6c3f('0x6'))['db'];var utils=require(_0x6c3f('0x7'));var logger=require(_0x6c3f('0x8'))('rpc');var config=require(_0x6c3f('0x9'));var jayson=require(_0x6c3f('0xa'));var client=jayson[_0x6c3f('0xb')][_0x6c3f('0xc')]({'port':0x232a});config[_0x6c3f('0xd')]=_[_0x6c3f('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c3f('0xd')]));require(_0x6c3f('0xf'))[_0x6c3f('0x10')](socket);function respondWithRpcPromise(_0x5b73ca,_0x519a02,_0x4aad51){return new BPromise(function(_0x446b20,_0x36fb30){return client[_0x6c3f('0x11')](_0x5b73ca,_0x4aad51)['then'](function(_0x42e9d7){logger[_0x6c3f('0x12')](_0x6c3f('0x13'),_0x519a02,'request\x20sent');logger['debug'](_0x6c3f('0x14'),_0x519a02,_0x6c3f('0x15'),JSON[_0x6c3f('0x16')](_0x42e9d7));if(_0x42e9d7['error']){if(_0x42e9d7[_0x6c3f('0x17')][_0x6c3f('0x18')]===0x1f4){logger[_0x6c3f('0x17')](_0x6c3f('0x13'),_0x519a02,_0x42e9d7[_0x6c3f('0x17')][_0x6c3f('0x19')]);return _0x36fb30(_0x42e9d7[_0x6c3f('0x17')][_0x6c3f('0x19')]);}logger[_0x6c3f('0x17')](_0x6c3f('0x13'),_0x519a02,_0x42e9d7[_0x6c3f('0x17')][_0x6c3f('0x19')]);return _0x446b20(_0x42e9d7[_0x6c3f('0x17')][_0x6c3f('0x19')]);}else{logger[_0x6c3f('0x12')](_0x6c3f('0x13'),_0x519a02,_0x6c3f('0x15'));_0x446b20(_0x42e9d7['result'][_0x6c3f('0x19')]);}})[_0x6c3f('0x1a')](function(_0x3fa392){logger['error'](_0x6c3f('0x13'),_0x519a02,_0x3fa392);_0x36fb30(_0x3fa392);});});}exports[_0x6c3f('0x1b')]=function(_0x2ba657){var _0x20cd0a=this;return new Promise(function(_0x38f5c5,_0x56504e){return db[_0x6c3f('0x1c')][_0x6c3f('0x1d')](_0x2ba657[_0x6c3f('0x1e')],{'raw':_0x2ba657[_0x6c3f('0x1f')]?_0x2ba657[_0x6c3f('0x1f')][_0x6c3f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ba657['options']?_0x2ba657[_0x6c3f('0x1f')][_0x6c3f('0x21')]||null:null,'attributes':_0x2ba657['options']?_0x2ba657[_0x6c3f('0x1f')][_0x6c3f('0x22')]||null:null,'limit':_0x2ba657[_0x6c3f('0x1f')]?_0x2ba657['options']['limit']||null:null})[_0x6c3f('0x23')](function(_0x5d8472){logger[_0x6c3f('0x12')](_0x6c3f('0x1b'),_0x2ba657);logger[_0x6c3f('0x24')](_0x6c3f('0x1b'),_0x2ba657,JSON[_0x6c3f('0x16')](_0x5d8472));_0x38f5c5(_0x5d8472);})[_0x6c3f('0x1a')](function(_0x7c636d){logger[_0x6c3f('0x17')](_0x6c3f('0x1b'),_0x7c636d[_0x6c3f('0x19')],_0x2ba657);_0x56504e(_0x20cd0a['error'](0x1f4,_0x7c636d[_0x6c3f('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0xcdb9b6){return new Promise(function(_0x4e9d46,_0x5bfac3){return db[_0x6c3f('0x1c')]['find']({'where':_0xcdb9b6[_0x6c3f('0x1f')]?_0xcdb9b6[_0x6c3f('0x1f')][_0x6c3f('0x21')]||null:null})[_0x6c3f('0x23')](function(_0xe8086){if(_0xe8086){return _0xe8086[_0x6c3f('0x25')](_0xcdb9b6[_0x6c3f('0x1e')]['ids'],_[_0x6c3f('0x26')](_0xcdb9b6[_0x6c3f('0x1e')],[_0x6c3f('0x27'),'id'])||{});}})['spread'](function(_0x2ceeab){logger[_0x6c3f('0x12')](_0x6c3f('0x28'),_0xcdb9b6);logger[_0x6c3f('0x24')]('AddTags',_0xcdb9b6,JSON[_0x6c3f('0x16')](_0x2ceeab));_0x4e9d46(_0x2ceeab);})[_0x6c3f('0x1a')](function(_0x51c594){logger[_0x6c3f('0x17')](_0x6c3f('0x28'),_0x51c594[_0x6c3f('0x19')],_0xcdb9b6);_0x5bfac3(_this[_0x6c3f('0x17')](0x1f4,_0x51c594[_0x6c3f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b3358ce..5d170fa 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 _0xea08=['./smsInteraction.events','save','remove','update','emit','removeListener','register','length','smsInteraction:'];(function(_0x2c8802,_0x4ad8e4){var _0x29fefc=function(_0x92772b){while(--_0x92772b){_0x2c8802['push'](_0x2c8802['shift']());}};_0x29fefc(++_0x4ad8e4);}(_0xea08,0xe1));var _0x8ea0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xea08[_0x19950b];return _0x3c6b41;};'use strict';var SmsInteractionEvents=require(_0x8ea0('0x0'));var events=[_0x8ea0('0x1'),_0x8ea0('0x2'),_0x8ea0('0x3')];function createListener(_0x2c5fc6,_0x323e5d){return function(_0x3cef27){_0x323e5d[_0x8ea0('0x4')](_0x2c5fc6,_0x3cef27);};}function removeListener(_0x45e17a,_0x3ecd43){return function(){SmsInteractionEvents[_0x8ea0('0x5')](_0x45e17a,_0x3ecd43);};}exports[_0x8ea0('0x6')]=function(_0x4055d2){for(var _0xac4b97=0x0,_0x231e8e=events[_0x8ea0('0x7')];_0xac4b97<_0x231e8e;_0xac4b97++){var _0x2f7647=events[_0xac4b97];var _0x42c4fc=createListener(_0x8ea0('0x8')+_0x2f7647,_0x4055d2);SmsInteractionEvents['on'](_0x2f7647,_0x42c4fc);}}; \ No newline at end of file +var _0x0a16=['./smsInteraction.events','save','remove','update','emit','removeListener','register','length','smsInteraction:'];(function(_0x3de690,_0x156120){var _0x1ea832=function(_0x4ec7f){while(--_0x4ec7f){_0x3de690['push'](_0x3de690['shift']());}};_0x1ea832(++_0x156120);}(_0x0a16,0x10e));var _0x60a1=function(_0x2d5c8f,_0x1be1e3){_0x2d5c8f=_0x2d5c8f-0x0;var _0x205919=_0x0a16[_0x2d5c8f];return _0x205919;};'use strict';var SmsInteractionEvents=require(_0x60a1('0x0'));var events=[_0x60a1('0x1'),_0x60a1('0x2'),_0x60a1('0x3')];function createListener(_0x152028,_0x5751ea){return function(_0x28ca4c){_0x5751ea[_0x60a1('0x4')](_0x152028,_0x28ca4c);};}function removeListener(_0x461532,_0x1b4ba4){return function(){SmsInteractionEvents[_0x60a1('0x5')](_0x461532,_0x1b4ba4);};}exports[_0x60a1('0x6')]=function(_0x170ea6){for(var _0x537fb7=0x0,_0x4f7998=events[_0x60a1('0x7')];_0x537fb7<_0x4f7998;_0x537fb7++){var _0x282ade=events[_0x537fb7];var _0x425439=createListener(_0x60a1('0x8')+_0x282ade,_0x170ea6);SmsInteractionEvents['on'](_0x282ade,_0x425439);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c5c5e3d..88b41ef 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 _0xfaa1=['../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','smsmessage:create','/:id/status','status','put','/:id/accept','accept','reject','delete','exports','util','path','connect-timeout'];(function(_0x50889e,_0xeb0acf){var _0x4d59db=function(_0x33ff5a){while(--_0x33ff5a){_0x50889e['push'](_0x50889e['shift']());}};_0x4d59db(++_0xeb0acf);}(_0xfaa1,0xad));var _0x1faa=function(_0x3332b5,_0x2684c4){_0x3332b5=_0x3332b5-0x0;var _0x40cde6=_0xfaa1[_0x3332b5];return _0x40cde6;};'use strict';var multer=require('multer');var util=require(_0x1faa('0x0'));var path=require(_0x1faa('0x1'));var timeout=require(_0x1faa('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1faa('0x3'));var controller=require(_0x1faa('0x4'));router[_0x1faa('0x5')]('/',auth[_0x1faa('0x6')](),controller[_0x1faa('0x7')]);router[_0x1faa('0x5')]('/describe',auth[_0x1faa('0x6')](),controller[_0x1faa('0x8')]);router['get'](_0x1faa('0x9'),auth['isAuthenticated'](),controller[_0x1faa('0xa')]);router[_0x1faa('0xb')]('/',auth[_0x1faa('0x6')](),interaction[_0x1faa('0xc')]('sms',_0x1faa('0xd')),controller['create']);router[_0x1faa('0xb')](_0x1faa('0xe'),controller[_0x1faa('0xf')]);router[_0x1faa('0x10')](_0x1faa('0x9'),auth[_0x1faa('0x6')](),controller['update']);router[_0x1faa('0x10')](_0x1faa('0x11'),auth[_0x1faa('0x6')](),controller[_0x1faa('0x12')]);router['put']('/:id/reject',auth[_0x1faa('0x6')](),controller[_0x1faa('0x13')]);router[_0x1faa('0x14')](_0x1faa('0x9'),auth[_0x1faa('0x6')](),controller['destroy']);module[_0x1faa('0x15')]=router; \ No newline at end of file +var _0x795e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x795e,0x177));var _0xe795=function(_0x6b763a,_0x3975fe){_0x6b763a=_0x6b763a-0x0;var _0x54d2a3=_0x795e[_0x6b763a];return _0x54d2a3;};'use strict';var multer=require(_0xe795('0x0'));var util=require(_0xe795('0x1'));var path=require(_0xe795('0x2'));var timeout=require(_0xe795('0x3'));var express=require(_0xe795('0x4'));var router=express[_0xe795('0x5')]();var auth=require(_0xe795('0x6'));var interaction=require(_0xe795('0x7'));var config=require('../../config/environment');var controller=require(_0xe795('0x8'));router[_0xe795('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe795('0x9')]('/describe',auth[_0xe795('0xa')](),controller[_0xe795('0xb')]);router[_0xe795('0x9')](_0xe795('0xc'),auth[_0xe795('0xa')](),controller[_0xe795('0xd')]);router[_0xe795('0xe')]('/',auth['isAuthenticated'](),interaction[_0xe795('0xf')](_0xe795('0x10'),_0xe795('0x11')),controller[_0xe795('0x12')]);router['post']('/:id/status',controller[_0xe795('0x13')]);router[_0xe795('0x14')](_0xe795('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe795('0x14')](_0xe795('0x15'),auth['isAuthenticated'](),controller[_0xe795('0x16')]);router['put'](_0xe795('0x17'),auth['isAuthenticated'](),controller[_0xe795('0x18')]);router['delete'](_0xe795('0xc'),auth[_0xe795('0xa')](),controller[_0xe795('0x19')]);module[_0xe795('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 3a63abd..05750f9 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 _0x6132=['STRING','DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x6132,0x13a));var _0x2613=function(_0x56a344,_0x17fa4b){_0x56a344=_0x56a344-0x0;var _0x437105=_0x6132[_0x56a344];return _0x437105;};'use strict';var Sequelize=require(_0x2613('0x0'));module[_0x2613('0x1')]={'body':{'type':Sequelize[_0x2613('0x2')](_0x2613('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2613('0x4')]('in',_0x2613('0x5')),'defaultValue':_0x2613('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2613('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x2613('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x56da=['BOOLEAN','sequelize','TEXT','medium','ENUM','out','STRING','DATE'];(function(_0x156e60,_0x18ef4b){var _0xe8a8e3=function(_0x3960ea){while(--_0x3960ea){_0x156e60['push'](_0x156e60['shift']());}};_0xe8a8e3(++_0x18ef4b);}(_0x56da,0x119));var _0xa56d=function(_0x57bb3a,_0x237ede){_0x57bb3a=_0x57bb3a-0x0;var _0x5decaa=_0x56da[_0x57bb3a];return _0x5decaa;};'use strict';var Sequelize=require(_0xa56d('0x0'));module['exports']={'body':{'type':Sequelize[_0xa56d('0x1')](_0xa56d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa56d('0x3')]('in',_0xa56d('0x4')),'defaultValue':_0xa56d('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa56d('0x5')](0xbe)},'phone':{'type':Sequelize[_0xa56d('0x5')]},'readAt':{'type':Sequelize[_0xa56d('0x6')]},'secret':{'type':Sequelize[_0xa56d('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index f3d6c6d..b57b0d9 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 _0x7a54=['delivered','Status','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','set','Content-Range','apply','destroy','sendStatus','name','index','SmsMessage','rawAttributes','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','sort','where','pick','map','key','VIRTUAL','merge','options','includeAll','include','findAll','params','length','find','create','body','update','describe','../../config/logger','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteraction','isNil','read1stAt','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event','accept','EventManager','sms-interactions','reject','sms','agent','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','type','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent'];(function(_0xe7553f,_0x51f1be){var _0x37d7be=function(_0x264175){while(--_0x264175){_0xe7553f['push'](_0xe7553f['shift']());}};_0x37d7be(++_0x51f1be);}(_0x7a54,0x106));var _0x47a5=function(_0x5e95ac,_0x1fb216){_0x5e95ac=_0x5e95ac-0x0;var _0x17d3e0=_0x7a54[_0x5e95ac];return _0x17d3e0;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x47a5('0xe'));var hardwareService=require(_0x47a5('0xf'));var Redis=require('ioredis');var qs=require(_0x47a5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x47a5('0x11'));var config=require(_0x47a5('0x12'));var db=require(_0x47a5('0x13'))['db'];config[_0x47a5('0x14')]=_[_0x47a5('0x15')](config[_0x47a5('0x14')],{'host':_0x47a5('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x14')]));require(_0x47a5('0x17'))[_0x47a5('0x18')](socket);var jayson=require(_0x47a5('0x19'));var client=jayson[_0x47a5('0x1a')][_0x47a5('0x1b')]({'port':0x232c});var client9002=jayson[_0x47a5('0x1a')][_0x47a5('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4e99a8,_0x362359,_0x11faf5,_0x3b001e){return new BPromise(function(_0x2a2cbb,_0x1ef44c){var _0x574af6=_0x3b001e||client;return _0x574af6['request'](_0x4e99a8,_0x11faf5)[_0x47a5('0x1c')](function(_0x4b966e){logger['info'](_0x47a5('0x1d'),_0x362359,_0x47a5('0x1e'));logger[_0x47a5('0x1f')](_0x47a5('0x20'),_0x362359,_0x47a5('0x1e'),JSON[_0x47a5('0x21')](_0x4b966e));if(_0x4b966e[_0x47a5('0x22')]){if(_0x4b966e[_0x47a5('0x22')][_0x47a5('0x23')]===0x1f4){logger['error'](_0x47a5('0x1d'),_0x362359,_0x4b966e[_0x47a5('0x22')]['message']);return _0x1ef44c(_0x4b966e[_0x47a5('0x22')][_0x47a5('0x24')]);}logger[_0x47a5('0x22')]('SmsMessage,\x20%s,\x20%s',_0x362359,_0x4b966e[_0x47a5('0x22')][_0x47a5('0x24')]);return _0x2a2cbb(_0x4b966e[_0x47a5('0x22')][_0x47a5('0x24')]);}else{logger['info'](_0x47a5('0x1d'),_0x362359,_0x47a5('0x1e'));_0x2a2cbb(_0x4b966e['result'][_0x47a5('0x24')]);}})[_0x47a5('0x25')](function(_0x4437f1){logger[_0x47a5('0x22')](_0x47a5('0x1d'),_0x362359,_0x4437f1);_0x1ef44c(_0x4437f1);});});}function respondWithStatusCode(_0x50bf17,_0x53078a){_0x53078a=_0x53078a||0xcc;return function(_0x136745){if(_0x136745){return _0x50bf17['sendStatus'](_0x53078a);}return _0x50bf17[_0x47a5('0x26')](_0x53078a)['end']();};}function respondWithResult(_0x23cb77,_0x378208){_0x378208=_0x378208||0xc8;return function(_0x36ad34){if(_0x36ad34){return _0x23cb77[_0x47a5('0x26')](_0x378208)[_0x47a5('0x27')](_0x36ad34);}};}function respondWithFilteredResult(_0x3ba0b7,_0x24b162){return function(_0x136b14){if(_0x136b14){var _0x16631f=_0x136b14[_0x47a5('0x28')],_0x361bfa=_0x24b162['offset'],_0x1127f8=_0x24b162[_0x47a5('0x29')]+_0x24b162['limit'],_0x11a4fa;if(_0x1127f8>=_0x16631f){_0x1127f8=_0x16631f;_0x11a4fa=0xc8;}else{_0x11a4fa=0xce;}_0x3ba0b7[_0x47a5('0x26')](_0x11a4fa);return _0x3ba0b7[_0x47a5('0x2a')](_0x47a5('0x2b'),_0x361bfa+'-'+_0x1127f8+'/'+_0x16631f)['json'](_0x136b14);}return null;};}function patchUpdates(_0x256650){return function(_0x625952){try{jsonpatch[_0x47a5('0x2c')](_0x625952,_0x256650,!![]);}catch(_0x1f1c68){return BPromise['reject'](_0x1f1c68);}return _0x625952['save']();};}function saveUpdates(_0x6f9a12,_0xfb5ddb){return function(_0x5bd7eb){if(_0x5bd7eb){return _0x5bd7eb['update'](_0x6f9a12)[_0x47a5('0x1c')](function(_0x51544e){return _0x51544e;});}return null;};}function removeEntity(_0x57bff6,_0x42f70c){return function(_0x53119b){if(_0x53119b){return _0x53119b[_0x47a5('0x2d')]()[_0x47a5('0x1c')](function(){_0x57bff6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x274e34,_0x5910bb){return function(_0x403028){if(!_0x403028){_0x274e34[_0x47a5('0x2e')](0x194);}return _0x403028;};}function handleError(_0xf269a8,_0x52749b){_0x52749b=_0x52749b||0x1f4;return function(_0x18f7e9){logger['error'](_0x18f7e9['stack']);if(_0x18f7e9[_0x47a5('0x2f')]){delete _0x18f7e9['name'];}_0xf269a8[_0x47a5('0x26')](_0x52749b)['send'](_0x18f7e9);};}exports[_0x47a5('0x30')]=function(_0x3534cb,_0x38c8d4){var _0x199698={},_0x36add5={},_0xed6320={'count':0x0,'rows':[]};var _0xee582c=db[_0x47a5('0x31')][_0x47a5('0x32')];_0x36add5['model']=_[_0x47a5('0x33')](_0xee582c);_0x36add5[_0x47a5('0x34')]=_['keys'](_0x3534cb[_0x47a5('0x34')]);_0x36add5[_0x47a5('0x35')]=_[_0x47a5('0x36')](_0x36add5['model'],_0x36add5[_0x47a5('0x34')]);_0x199698[_0x47a5('0x37')]=_['intersection'](_0x36add5[_0x47a5('0x38')],qs[_0x47a5('0x39')](_0x3534cb['query']['fields']));_0x199698['attributes']=_0x199698[_0x47a5('0x37')]['length']?_0x199698[_0x47a5('0x37')]:_0x36add5[_0x47a5('0x38')];if(!_0x3534cb[_0x47a5('0x34')][_0x47a5('0x3a')](_0x47a5('0x3b'))){_0x199698[_0x47a5('0x3c')]=qs[_0x47a5('0x3c')](_0x3534cb[_0x47a5('0x34')][_0x47a5('0x3c')]);_0x199698[_0x47a5('0x29')]=qs[_0x47a5('0x29')](_0x3534cb[_0x47a5('0x34')][_0x47a5('0x29')]);}_0x199698['order']=qs[_0x47a5('0x3d')](_0x3534cb[_0x47a5('0x34')][_0x47a5('0x3d')]);_0x199698[_0x47a5('0x3e')]=qs['filters'](_[_0x47a5('0x3f')](_0x3534cb['query'],_0x36add5['filters']));if(_0x3534cb['query']['filter']){_0x199698[_0x47a5('0x3e')]=_['merge'](_0x199698[_0x47a5('0x3e')],{'$or':_[_0x47a5('0x40')](_0xee582c,function(_0x448610){if(_0x448610['type'][_0x47a5('0x41')]!==_0x47a5('0x42')){var _0x586747={};_0x586747[_0x448610['field']]={'$like':'%'+_0x3534cb[_0x47a5('0x34')]['filter']+'%'};return _0x586747;}})});}_0x199698=_[_0x47a5('0x43')]({},_0x199698,_0x3534cb[_0x47a5('0x44')]);var _0x188614={'where':_0x199698[_0x47a5('0x3e')]};return db[_0x47a5('0x31')][_0x47a5('0x28')](_0x188614)[_0x47a5('0x1c')](function(_0x17cc42){_0xed6320[_0x47a5('0x28')]=_0x17cc42;if(_0x3534cb[_0x47a5('0x34')][_0x47a5('0x45')]){_0x199698[_0x47a5('0x46')]=[{'all':!![]}];}return db[_0x47a5('0x31')][_0x47a5('0x47')](_0x199698);})[_0x47a5('0x1c')](function(_0x3a2b38){_0xed6320['rows']=_0x3a2b38;return _0xed6320;})[_0x47a5('0x1c')](respondWithFilteredResult(_0x38c8d4,_0x199698))[_0x47a5('0x25')](handleError(_0x38c8d4,null));};exports['show']=function(_0x52b3a8,_0x3d0a88){var _0x560e4e={'raw':!![],'where':{'id':_0x52b3a8[_0x47a5('0x48')]['id']}},_0x13750d={};_0x13750d['model']=_['keys'](db[_0x47a5('0x31')]['rawAttributes']);_0x13750d[_0x47a5('0x34')]=_[_0x47a5('0x33')](_0x52b3a8[_0x47a5('0x34')]);_0x13750d[_0x47a5('0x35')]=_[_0x47a5('0x36')](_0x13750d[_0x47a5('0x38')],_0x13750d[_0x47a5('0x34')]);_0x560e4e['attributes']=_['intersection'](_0x13750d[_0x47a5('0x38')],qs[_0x47a5('0x39')](_0x52b3a8[_0x47a5('0x34')][_0x47a5('0x39')]));_0x560e4e[_0x47a5('0x37')]=_0x560e4e[_0x47a5('0x37')][_0x47a5('0x49')]?_0x560e4e['attributes']:_0x13750d[_0x47a5('0x38')];if(_0x52b3a8[_0x47a5('0x34')][_0x47a5('0x45')]){_0x560e4e['include']=[{'all':!![]}];}_0x560e4e=_[_0x47a5('0x43')]({},_0x560e4e,_0x52b3a8['options']);return db[_0x47a5('0x31')][_0x47a5('0x4a')](_0x560e4e)[_0x47a5('0x1c')](handleEntityNotFound(_0x3d0a88,null))[_0x47a5('0x1c')](respondWithResult(_0x3d0a88,null))['catch'](handleError(_0x3d0a88,null));};exports[_0x47a5('0x4b')]=function(_0x1e6de3,_0x2f66e9){return db[_0x47a5('0x31')][_0x47a5('0x4b')](_0x1e6de3[_0x47a5('0x4c')],{})[_0x47a5('0x1c')](respondWithResult(_0x2f66e9,0xc9))['catch'](handleError(_0x2f66e9,null));};exports[_0x47a5('0x4d')]=function(_0x43721b,_0x187d7e){if(_0x43721b[_0x47a5('0x4c')]['id']){delete _0x43721b[_0x47a5('0x4c')]['id'];}return db[_0x47a5('0x31')]['find']({'where':{'id':_0x43721b[_0x47a5('0x48')]['id']}})[_0x47a5('0x1c')](handleEntityNotFound(_0x187d7e,null))[_0x47a5('0x1c')](saveUpdates(_0x43721b['body'],null))[_0x47a5('0x1c')](respondWithResult(_0x187d7e,null))[_0x47a5('0x25')](handleError(_0x187d7e,null));};exports[_0x47a5('0x2d')]=function(_0x5d8d4a,_0x57641e){return db[_0x47a5('0x31')][_0x47a5('0x4a')]({'where':{'id':_0x5d8d4a['params']['id']}})['then'](handleEntityNotFound(_0x57641e,null))[_0x47a5('0x1c')](removeEntity(_0x57641e,null))['catch'](handleError(_0x57641e,null));};exports[_0x47a5('0x4e')]=function(_0x5d383d,_0x482de6){return db[_0x47a5('0x31')][_0x47a5('0x4e')]()['then'](respondWithResult(_0x482de6,null))[_0x47a5('0x25')](handleError(_0x482de6,null));};var interaction_log=require(_0x47a5('0x4f'))('sms-interactions');exports['accept']=function(_0x16b4fd,_0x30d482,_0x867da0){var _0x2931e4={'channel':'sms'};if(_0x16b4fd[_0x47a5('0x4c')]['id']){delete _0x16b4fd[_0x47a5('0x4c')]['id'];}_0x16b4fd[_0x47a5('0x4c')]['read']=!![];_0x16b4fd[_0x47a5('0x4c')]['readAt']=moment()[_0x47a5('0x50')](_0x47a5('0x51'));_0x16b4fd[_0x47a5('0x4c')][_0x47a5('0x52')]=_0x16b4fd[_0x47a5('0x4c')]['UserId']||_0x16b4fd[_0x47a5('0x53')]['id'];return db['SmsMessage']['find']({'where':{'id':_0x16b4fd['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x47a5('0x54')}]})[_0x47a5('0x1c')](handleEntityNotFound(_0x30d482,null))[_0x47a5('0x1c')](saveUpdates(_0x16b4fd['body'],null))['then'](function(_0x139229){if(_0x139229){_0x2931e4[_0x47a5('0x24')]=_0x139229[_0x47a5('0x55')]({'plain':!![]});return db[_0x47a5('0x56')][_0x47a5('0x4a')]({'where':{'id':_0x139229['SmsInteractionId']}});}return null;})[_0x47a5('0x1c')](handleEntityNotFound(_0x30d482,null))['then'](function(_0x22c886){if(_0x22c886){return _0x22c886[_0x47a5('0x4d')]({'UserId':_0x16b4fd['body'][_0x47a5('0x52')],'read1stAt':_[_0x47a5('0x57')](_0x22c886[_0x47a5('0x58')])?moment()[_0x47a5('0x50')](_0x47a5('0x51')):undefined});}return null;})[_0x47a5('0x1c')](function(_0x35cca8){if(_0x35cca8){_0x2931e4[_0x47a5('0x59')]=_0x35cca8['get']({'plain':!![]});interaction_log[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x16b4fd[_0x47a5('0x53')]['id'],_0x16b4fd[_0x47a5('0x53')][_0x47a5('0x2f')],_0x16b4fd['user'][_0x47a5('0x5c')],_0x2931e4[_0x47a5('0x59')]['id'],_0x16b4fd[_0x47a5('0x4c')]?JSON[_0x47a5('0x21')](_0x16b4fd[_0x47a5('0x4c')]):_0x47a5('0x5d'));return respondWithRpcPromise(_0x47a5('0x5e'),_0x47a5('0x5f'),_0x2931e4);}return null;})[_0x47a5('0x1c')](function(_0x44cb90){if(_0x44cb90){if(_0x16b4fd[_0x47a5('0x4c')][_0x47a5('0x60')]){_0x2931e4[_0x47a5('0x24')][_0x47a5('0x61')]=util[_0x47a5('0x50')]('SIP/%s',_0x16b4fd[_0x47a5('0x53')][_0x47a5('0x2f')]);_0x2931e4[_0x47a5('0x24')]['channel']=_0x2931e4[_0x47a5('0x62')];_0x2931e4[_0x47a5('0x24')][_0x47a5('0x63')]=_0x47a5('0x64');return respondWithRpcPromise('EventManager',_0x47a5('0x65'),{'event':'acceptmessage','message':_0x2931e4[_0x47a5('0x24')]},client9002)['then'](function(){return _0x2931e4;});}return _0x2931e4;}return null;})[_0x47a5('0x1c')](respondWithResult(_0x30d482,null))['catch'](handleError(_0x30d482,null));};var interaction_log=require(_0x47a5('0x4f'))(_0x47a5('0x66'));exports[_0x47a5('0x67')]=function(_0x58473b,_0x4af557,_0x4b8084){var _0x4164a3={'agent':{},'channel':_0x47a5('0x68')};if(_0x58473b[_0x47a5('0x4c')]['id']){delete _0x58473b[_0x47a5('0x4c')]['id'];}_0x58473b['body'][_0x47a5('0x52')]=_0x58473b[_0x47a5('0x4c')][_0x47a5('0x52')]||_0x58473b[_0x47a5('0x53')]['id'];_0x4164a3[_0x47a5('0x69')]['id']=_0x58473b[_0x47a5('0x4c')][_0x47a5('0x52')];return db[_0x47a5('0x31')][_0x47a5('0x4a')]({'where':{'id':_0x58473b[_0x47a5('0x48')]['id'],'UserId':null}})[_0x47a5('0x1c')](handleEntityNotFound(_0x4af557,null))[_0x47a5('0x1c')](function(_0x49d3dc){if(_0x49d3dc){_0x4164a3[_0x47a5('0x24')]=_0x49d3dc['get']({'plain':!![]});return db[_0x47a5('0x56')][_0x47a5('0x4a')]({'where':{'id':_0x49d3dc[_0x47a5('0x6a')]}});}return null;})[_0x47a5('0x1c')](handleEntityNotFound(_0x4af557,null))[_0x47a5('0x1c')](function(_0xa9c853){if(_0xa9c853){_0x4164a3[_0x47a5('0x59')]=_0xa9c853[_0x47a5('0x55')]({'plain':!![]});interaction_log[_0x47a5('0x5a')](_0x47a5('0x6b'),_0x58473b[_0x47a5('0x53')]['id'],_0x58473b[_0x47a5('0x53')][_0x47a5('0x2f')],_0x58473b[_0x47a5('0x53')][_0x47a5('0x5c')],_0x4164a3['interaction']['id'],_0x58473b['body']?JSON['stringify'](_0x58473b['body']):_0x47a5('0x5d'));return respondWithRpcPromise(_0x47a5('0x6c'),'rejectMessage',_0x4164a3);}return null;})[_0x47a5('0x1c')](function(_0x44dda2){if(_0x44dda2){_0x44dda2[_0x47a5('0x24')][_0x47a5('0x61')]=util[_0x47a5('0x50')](_0x47a5('0x6d'),_0x58473b[_0x47a5('0x53')][_0x47a5('0x2f')]);_0x44dda2[_0x47a5('0x24')][_0x47a5('0x62')]=_0x4164a3[_0x47a5('0x62')];_0x44dda2['message'][_0x47a5('0x63')]=_0x47a5('0x67');respondWithRpcPromise(_0x47a5('0x65'),'EventManager',{'event':_0x47a5('0x6e'),'message':_0x44dda2[_0x47a5('0x24')]},client9002);return _0x4164a3;}return null;})[_0x47a5('0x1c')](respondWithResult(_0x4af557,null))['catch'](handleError(_0x4af557,null));};exports[_0x47a5('0x26')]=function(_0x5205ba,_0x49d93d,_0x356e16){if(_0x5205ba[_0x47a5('0x4c')]['id']){delete _0x5205ba[_0x47a5('0x4c')]['id'];}var _0x27333e;return db[_0x47a5('0x31')][_0x47a5('0x4a')]({'where':{'id':_0x5205ba['params']['id']}})['then'](handleEntityNotFound(_0x49d93d,null))[_0x47a5('0x1c')](function(_0x4f2361){if(_0x4f2361){_0x27333e=_0x4f2361;return db[_0x47a5('0x6f')][_0x47a5('0x4a')]({'where':{'id':_0x4f2361[_0x47a5('0x70')]}});}})[_0x47a5('0x1c')](handleEntityNotFound(_0x49d93d,null))['then'](function(_0x3c66e3){if(_0x3c66e3){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x47a5('0x26'),_0x47a5('0x71'),_0x3c66e3['type'],util[_0x47a5('0x72')](_0x5205ba[_0x47a5('0x4c')],{'showHidden':![],'depth':null}));switch(_0x3c66e3[_0x47a5('0x73')]){case'twilio':if(_0x5205ba[_0x47a5('0x4c')]['MessageSid']&&_0x5205ba[_0x47a5('0x4c')][_0x47a5('0x74')]===_0x27333e[_0x47a5('0x75')]){return _0x27333e['update']({'read':!![]});}else{logger[_0x47a5('0x22')](_0x47a5('0x76'),_0x47a5('0x26'),'twilio',util[_0x47a5('0x72')](_0x5205ba['body'],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x77'):if(_0x5205ba['body'][_0x47a5('0x78')]&&_0x5205ba[_0x47a5('0x4c')][_0x47a5('0x78')]===_0x27333e[_0x47a5('0x75')]&&_['indexOf']([_0x47a5('0x79'),_0x47a5('0x7a')],_0x5205ba[_0x47a5('0x4c')][_0x47a5('0x7b')])>=0x0){return _0x27333e[_0x47a5('0x4d')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x26'),'plivio',util[_0x47a5('0x72')](_0x5205ba[_0x47a5('0x4c')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7c'):var _0x5018e9=_0x5205ba[_0x47a5('0x4c')][_0x47a5('0x7d')][0x0];if(_0x5018e9['status'][_0x47a5('0x7e')]===_0x47a5('0x7f')){return _0x27333e[_0x47a5('0x4d')]({'read':!![]});}else{logger[_0x47a5('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7c'),util[_0x47a5('0x72')](_0x5205ba['body'],{'showHidden':![],'depth':null}));}break;}return _0x27333e;}})[_0x47a5('0x1c')](respondWithResult(_0x49d93d,null))[_0x47a5('0x25')](handleError(_0x49d93d,null));}; \ No newline at end of file +var _0x187d=['received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio','results','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./smsMessage.socket','register','jayson/promise','http','client','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','sendStatus','name','SmsMessage','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','map','key','VIRTUAL','field','options','includeAll','include','rows','catch','show','params','create','body','find','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','update','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','rejectMessage','interface','event','rejectmessage','SmsAccountId'];(function(_0x27e5be,_0x44ec00){var _0x29465e=function(_0x5292f0){while(--_0x5292f0){_0x27e5be['push'](_0x27e5be['shift']());}};_0x29465e(++_0x44ec00);}(_0x187d,0x93));var _0xd187=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x187d[_0x45e98e];return _0x374dba;};'use strict';var pdf=require(_0xd187('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd187('0x1'));var zipdir=require(_0xd187('0x2'));var jsonpatch=require(_0xd187('0x3'));var rp=require(_0xd187('0x4'));var moment=require(_0xd187('0x5'));var BPromise=require(_0xd187('0x6'));var Mustache=require('mustache');var util=require(_0xd187('0x7'));var path=require(_0xd187('0x8'));var sox=require('sox');var csv=require(_0xd187('0x9'));var ejs=require(_0xd187('0xa'));var fs=require('fs');var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x9'));var querystring=require('querystring');var Papa=require(_0xd187('0x10'));var authService=require(_0xd187('0x11'));var hardwareService=require(_0xd187('0x12'));var Redis=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var logger=require(_0xd187('0x15'))('api');var utils=require(_0xd187('0x16'));var config=require(_0xd187('0x17'));var db=require(_0xd187('0x18'))['db'];config['redis']=_[_0xd187('0x19')](config[_0xd187('0x1a')],{'host':_0xd187('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd187('0x1a')]));require(_0xd187('0x1c'))[_0xd187('0x1d')](socket);var jayson=require(_0xd187('0x1e'));var client=jayson['client'][_0xd187('0x1f')]({'port':0x232c});var client9002=jayson[_0xd187('0x20')][_0xd187('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x188cfe,_0x4c8f68,_0x245d3e,_0x52a208){return new BPromise(function(_0x5cf218,_0x40ed84){var _0x5a4986=_0x52a208||client;return _0x5a4986['request'](_0x188cfe,_0x245d3e)[_0xd187('0x21')](function(_0x2b3290){logger[_0xd187('0x22')](_0xd187('0x23'),_0x4c8f68,_0xd187('0x24'));logger[_0xd187('0x25')](_0xd187('0x26'),_0x4c8f68,_0xd187('0x24'),JSON[_0xd187('0x27')](_0x2b3290));if(_0x2b3290[_0xd187('0x28')]){if(_0x2b3290[_0xd187('0x28')][_0xd187('0x29')]===0x1f4){logger[_0xd187('0x28')]('SmsMessage,\x20%s,\x20%s',_0x4c8f68,_0x2b3290[_0xd187('0x28')][_0xd187('0x2a')]);return _0x40ed84(_0x2b3290[_0xd187('0x28')]['message']);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x4c8f68,_0x2b3290[_0xd187('0x28')][_0xd187('0x2a')]);return _0x5cf218(_0x2b3290[_0xd187('0x28')]['message']);}else{logger[_0xd187('0x22')]('SmsMessage,\x20%s,\x20%s',_0x4c8f68,_0xd187('0x24'));_0x5cf218(_0x2b3290['result'][_0xd187('0x2a')]);}})['catch'](function(_0x4f3879){logger[_0xd187('0x28')]('SmsMessage,\x20%s,\x20%s',_0x4c8f68,_0x4f3879);_0x40ed84(_0x4f3879);});});}function respondWithStatusCode(_0x12da33,_0x598aa4){_0x598aa4=_0x598aa4||0xcc;return function(_0x4ace17){if(_0x4ace17){return _0x12da33['sendStatus'](_0x598aa4);}return _0x12da33[_0xd187('0x2b')](_0x598aa4)[_0xd187('0x2c')]();};}function respondWithResult(_0x43079f,_0x4a7f6f){_0x4a7f6f=_0x4a7f6f||0xc8;return function(_0x5cf19a){if(_0x5cf19a){return _0x43079f[_0xd187('0x2b')](_0x4a7f6f)[_0xd187('0x2d')](_0x5cf19a);}};}function respondWithFilteredResult(_0x5c8e52,_0x3e9971){return function(_0x1c87ee){if(_0x1c87ee){var _0x34febe=_0x1c87ee[_0xd187('0x2e')],_0x4c50a5=_0x3e9971[_0xd187('0x2f')],_0x15e2e8=_0x3e9971[_0xd187('0x2f')]+_0x3e9971[_0xd187('0x30')],_0x56e292;if(_0x15e2e8>=_0x34febe){_0x15e2e8=_0x34febe;_0x56e292=0xc8;}else{_0x56e292=0xce;}_0x5c8e52['status'](_0x56e292);return _0x5c8e52[_0xd187('0x31')](_0xd187('0x32'),_0x4c50a5+'-'+_0x15e2e8+'/'+_0x34febe)['json'](_0x1c87ee);}return null;};}function patchUpdates(_0x4cc587){return function(_0x1a1922){try{jsonpatch[_0xd187('0x33')](_0x1a1922,_0x4cc587,!![]);}catch(_0x13f285){return BPromise[_0xd187('0x34')](_0x13f285);}return _0x1a1922[_0xd187('0x35')]();};}function saveUpdates(_0x2d8843,_0x3dc7f2){return function(_0x4713df){if(_0x4713df){return _0x4713df['update'](_0x2d8843)[_0xd187('0x21')](function(_0x9e5b1){return _0x9e5b1;});}return null;};}function removeEntity(_0x21cd12,_0x5e2f2e){return function(_0x22d84b){if(_0x22d84b){return _0x22d84b['destroy']()[_0xd187('0x21')](function(){_0x21cd12[_0xd187('0x2b')](0xcc)[_0xd187('0x2c')]();});}};}function handleEntityNotFound(_0x4d9d97,_0x49cf57){return function(_0x236ca4){if(!_0x236ca4){_0x4d9d97[_0xd187('0x36')](0x194);}return _0x236ca4;};}function handleError(_0x549c6a,_0x4591e0){_0x4591e0=_0x4591e0||0x1f4;return function(_0xa54b9e){logger[_0xd187('0x28')](_0xa54b9e['stack']);if(_0xa54b9e['name']){delete _0xa54b9e[_0xd187('0x37')];}_0x549c6a[_0xd187('0x2b')](_0x4591e0)['send'](_0xa54b9e);};}exports['index']=function(_0x57d10e,_0x31d7f4){var _0x578f87={},_0x28c252={},_0x35c381={'count':0x0,'rows':[]};var _0x5728be=db[_0xd187('0x38')]['rawAttributes'];_0x28c252[_0xd187('0x39')]=_[_0xd187('0x3a')](_0x5728be);_0x28c252['query']=_[_0xd187('0x3a')](_0x57d10e[_0xd187('0x3b')]);_0x28c252['filters']=_[_0xd187('0x3c')](_0x28c252['model'],_0x28c252['query']);_0x578f87[_0xd187('0x3d')]=_[_0xd187('0x3c')](_0x28c252[_0xd187('0x39')],qs[_0xd187('0x3e')](_0x57d10e[_0xd187('0x3b')]['fields']));_0x578f87[_0xd187('0x3d')]=_0x578f87[_0xd187('0x3d')][_0xd187('0x3f')]?_0x578f87['attributes']:_0x28c252['model'];if(!_0x57d10e['query']['hasOwnProperty'](_0xd187('0x40'))){_0x578f87[_0xd187('0x30')]=qs[_0xd187('0x30')](_0x57d10e[_0xd187('0x3b')][_0xd187('0x30')]);_0x578f87[_0xd187('0x2f')]=qs[_0xd187('0x2f')](_0x57d10e[_0xd187('0x3b')]['offset']);}_0x578f87[_0xd187('0x41')]=qs[_0xd187('0x42')](_0x57d10e[_0xd187('0x3b')]['sort']);_0x578f87[_0xd187('0x43')]=qs['filters'](_[_0xd187('0x44')](_0x57d10e[_0xd187('0x3b')],_0x28c252[_0xd187('0x45')]));if(_0x57d10e[_0xd187('0x3b')][_0xd187('0x46')]){_0x578f87['where']=_[_0xd187('0x47')](_0x578f87[_0xd187('0x43')],{'$or':_[_0xd187('0x48')](_0x5728be,function(_0x3fa19c){if(_0x3fa19c['type'][_0xd187('0x49')]!==_0xd187('0x4a')){var _0x5e765b={};_0x5e765b[_0x3fa19c[_0xd187('0x4b')]]={'$like':'%'+_0x57d10e[_0xd187('0x3b')]['filter']+'%'};return _0x5e765b;}})});}_0x578f87=_['merge']({},_0x578f87,_0x57d10e[_0xd187('0x4c')]);var _0x5b5d25={'where':_0x578f87['where']};return db['SmsMessage']['count'](_0x5b5d25)[_0xd187('0x21')](function(_0x358a72){_0x35c381[_0xd187('0x2e')]=_0x358a72;if(_0x57d10e[_0xd187('0x3b')][_0xd187('0x4d')]){_0x578f87[_0xd187('0x4e')]=[{'all':!![]}];}return db[_0xd187('0x38')]['findAll'](_0x578f87);})[_0xd187('0x21')](function(_0x12784c){_0x35c381[_0xd187('0x4f')]=_0x12784c;return _0x35c381;})[_0xd187('0x21')](respondWithFilteredResult(_0x31d7f4,_0x578f87))[_0xd187('0x50')](handleError(_0x31d7f4,null));};exports[_0xd187('0x51')]=function(_0x10c0f5,_0x3400a0){var _0x4e4a32={'raw':!![],'where':{'id':_0x10c0f5[_0xd187('0x52')]['id']}},_0x368348={};_0x368348[_0xd187('0x39')]=_[_0xd187('0x3a')](db[_0xd187('0x38')]['rawAttributes']);_0x368348[_0xd187('0x3b')]=_[_0xd187('0x3a')](_0x10c0f5['query']);_0x368348[_0xd187('0x45')]=_[_0xd187('0x3c')](_0x368348['model'],_0x368348['query']);_0x4e4a32['attributes']=_['intersection'](_0x368348[_0xd187('0x39')],qs[_0xd187('0x3e')](_0x10c0f5[_0xd187('0x3b')][_0xd187('0x3e')]));_0x4e4a32[_0xd187('0x3d')]=_0x4e4a32[_0xd187('0x3d')][_0xd187('0x3f')]?_0x4e4a32['attributes']:_0x368348[_0xd187('0x39')];if(_0x10c0f5[_0xd187('0x3b')][_0xd187('0x4d')]){_0x4e4a32[_0xd187('0x4e')]=[{'all':!![]}];}_0x4e4a32=_['merge']({},_0x4e4a32,_0x10c0f5[_0xd187('0x4c')]);return db['SmsMessage']['find'](_0x4e4a32)[_0xd187('0x21')](handleEntityNotFound(_0x3400a0,null))['then'](respondWithResult(_0x3400a0,null))[_0xd187('0x50')](handleError(_0x3400a0,null));};exports[_0xd187('0x53')]=function(_0x260be7,_0x4430b8){return db[_0xd187('0x38')][_0xd187('0x53')](_0x260be7[_0xd187('0x54')],{})[_0xd187('0x21')](respondWithResult(_0x4430b8,0xc9))[_0xd187('0x50')](handleError(_0x4430b8,null));};exports['update']=function(_0x247583,_0x298a34){if(_0x247583['body']['id']){delete _0x247583[_0xd187('0x54')]['id'];}return db[_0xd187('0x38')][_0xd187('0x55')]({'where':{'id':_0x247583['params']['id']}})[_0xd187('0x21')](handleEntityNotFound(_0x298a34,null))[_0xd187('0x21')](saveUpdates(_0x247583['body'],null))[_0xd187('0x21')](respondWithResult(_0x298a34,null))[_0xd187('0x50')](handleError(_0x298a34,null));};exports['destroy']=function(_0x456abb,_0x588f4b){return db[_0xd187('0x38')][_0xd187('0x55')]({'where':{'id':_0x456abb[_0xd187('0x52')]['id']}})[_0xd187('0x21')](handleEntityNotFound(_0x588f4b,null))[_0xd187('0x21')](removeEntity(_0x588f4b,null))[_0xd187('0x50')](handleError(_0x588f4b,null));};exports[_0xd187('0x56')]=function(_0x4eddd5,_0xcef6ca){return db[_0xd187('0x38')][_0xd187('0x56')]()['then'](respondWithResult(_0xcef6ca,null))[_0xd187('0x50')](handleError(_0xcef6ca,null));};var interaction_log=require(_0xd187('0x15'))(_0xd187('0x57'));exports[_0xd187('0x58')]=function(_0x236c51,_0x2c4f4d,_0x10ebf4){var _0x202f73={'channel':_0xd187('0x59')};if(_0x236c51[_0xd187('0x54')]['id']){delete _0x236c51[_0xd187('0x54')]['id'];}_0x236c51[_0xd187('0x54')][_0xd187('0x5a')]=!![];_0x236c51[_0xd187('0x54')][_0xd187('0x5b')]=moment()[_0xd187('0x5c')](_0xd187('0x5d'));_0x236c51[_0xd187('0x54')][_0xd187('0x5e')]=_0x236c51[_0xd187('0x54')]['UserId']||_0x236c51[_0xd187('0x5f')]['id'];return db['SmsMessage'][_0xd187('0x55')]({'where':{'id':_0x236c51[_0xd187('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xd187('0x60')],'as':_0xd187('0x61')}]})['then'](handleEntityNotFound(_0x2c4f4d,null))[_0xd187('0x21')](saveUpdates(_0x236c51[_0xd187('0x54')],null))['then'](function(_0x509815){if(_0x509815){_0x202f73[_0xd187('0x2a')]=_0x509815[_0xd187('0x62')]({'plain':!![]});return db[_0xd187('0x63')][_0xd187('0x55')]({'where':{'id':_0x509815['SmsInteractionId']}});}return null;})[_0xd187('0x21')](handleEntityNotFound(_0x2c4f4d,null))['then'](function(_0x1971b2){if(_0x1971b2){return _0x1971b2[_0xd187('0x64')]({'UserId':_0x236c51[_0xd187('0x54')][_0xd187('0x5e')],'read1stAt':_['isNil'](_0x1971b2[_0xd187('0x65')])?moment()[_0xd187('0x5c')](_0xd187('0x5d')):undefined});}return null;})[_0xd187('0x21')](function(_0x151f3c){if(_0x151f3c){_0x202f73['interaction']=_0x151f3c['get']({'plain':!![]});interaction_log[_0xd187('0x22')](_0xd187('0x66'),_0x236c51[_0xd187('0x5f')]['id'],_0x236c51[_0xd187('0x5f')][_0xd187('0x37')],_0x236c51[_0xd187('0x5f')][_0xd187('0x67')],_0x202f73[_0xd187('0x68')]['id'],_0x236c51[_0xd187('0x54')]?JSON[_0xd187('0x27')](_0x236c51[_0xd187('0x54')]):_0xd187('0x69'));return respondWithRpcPromise('AcceptMessage',_0xd187('0x6a'),_0x202f73);}return null;})[_0xd187('0x21')](function(_0x54e908){if(_0x54e908){if(_0x236c51[_0xd187('0x54')][_0xd187('0x6b')]){_0x202f73['message']['interface']=util[_0xd187('0x5c')](_0xd187('0x6c'),_0x236c51[_0xd187('0x5f')][_0xd187('0x37')]);_0x202f73['message'][_0xd187('0x6d')]=_0x202f73[_0xd187('0x6d')];_0x202f73['message']['event']=_0xd187('0x58');return respondWithRpcPromise('EventManager',_0xd187('0x6e'),{'event':_0xd187('0x6f'),'message':_0x202f73['message']},client9002)[_0xd187('0x21')](function(){return _0x202f73;});}return _0x202f73;}return null;})['then'](respondWithResult(_0x2c4f4d,null))[_0xd187('0x50')](handleError(_0x2c4f4d,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports['reject']=function(_0x16d9ea,_0x243063,_0x421585){var _0x216829={'agent':{},'channel':_0xd187('0x59')};if(_0x16d9ea[_0xd187('0x54')]['id']){delete _0x16d9ea[_0xd187('0x54')]['id'];}_0x16d9ea[_0xd187('0x54')]['UserId']=_0x16d9ea[_0xd187('0x54')][_0xd187('0x5e')]||_0x16d9ea[_0xd187('0x5f')]['id'];_0x216829['agent']['id']=_0x16d9ea[_0xd187('0x54')][_0xd187('0x5e')];return db[_0xd187('0x38')][_0xd187('0x55')]({'where':{'id':_0x16d9ea['params']['id'],'UserId':null}})[_0xd187('0x21')](handleEntityNotFound(_0x243063,null))[_0xd187('0x21')](function(_0x4c3255){if(_0x4c3255){_0x216829[_0xd187('0x2a')]=_0x4c3255[_0xd187('0x62')]({'plain':!![]});return db[_0xd187('0x63')][_0xd187('0x55')]({'where':{'id':_0x4c3255['SmsInteractionId']}});}return null;})[_0xd187('0x21')](handleEntityNotFound(_0x243063,null))[_0xd187('0x21')](function(_0x4e9338){if(_0x4e9338){_0x216829[_0xd187('0x68')]=_0x4e9338['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x16d9ea[_0xd187('0x5f')]['id'],_0x16d9ea[_0xd187('0x5f')][_0xd187('0x37')],_0x16d9ea[_0xd187('0x5f')][_0xd187('0x67')],_0x216829[_0xd187('0x68')]['id'],_0x16d9ea['body']?JSON[_0xd187('0x27')](_0x16d9ea[_0xd187('0x54')]):'null');return respondWithRpcPromise('RejectMessage',_0xd187('0x70'),_0x216829);}return null;})[_0xd187('0x21')](function(_0xaf156f){if(_0xaf156f){_0xaf156f[_0xd187('0x2a')][_0xd187('0x71')]=util[_0xd187('0x5c')]('SIP/%s',_0x16d9ea[_0xd187('0x5f')][_0xd187('0x37')]);_0xaf156f[_0xd187('0x2a')][_0xd187('0x6d')]=_0x216829[_0xd187('0x6d')];_0xaf156f[_0xd187('0x2a')][_0xd187('0x72')]=_0xd187('0x34');respondWithRpcPromise(_0xd187('0x6e'),_0xd187('0x6e'),{'event':_0xd187('0x73'),'message':_0xaf156f[_0xd187('0x2a')]},client9002);return _0x216829;}return null;})['then'](respondWithResult(_0x243063,null))['catch'](handleError(_0x243063,null));};exports[_0xd187('0x2b')]=function(_0x2b2c64,_0x3c611d,_0x147c96){if(_0x2b2c64[_0xd187('0x54')]['id']){delete _0x2b2c64[_0xd187('0x54')]['id'];}var _0x4dc675;return db[_0xd187('0x38')]['find']({'where':{'id':_0x2b2c64[_0xd187('0x52')]['id']}})['then'](handleEntityNotFound(_0x3c611d,null))['then'](function(_0x304117){if(_0x304117){_0x4dc675=_0x304117;return db['SmsAccount'][_0xd187('0x55')]({'where':{'id':_0x304117[_0xd187('0x74')]}});}})[_0xd187('0x21')](handleEntityNotFound(_0x3c611d,null))[_0xd187('0x21')](function(_0x1b93db){if(_0x1b93db){logger[_0xd187('0x25')](_0xd187('0x26'),_0xd187('0x2b'),_0xd187('0x75'),_0x1b93db[_0xd187('0x76')],util[_0xd187('0x77')](_0x2b2c64[_0xd187('0x54')],{'showHidden':![],'depth':null}));switch(_0x1b93db[_0xd187('0x76')]){case _0xd187('0x78'):if(_0x2b2c64[_0xd187('0x54')]['MessageSid']&&_0x2b2c64[_0xd187('0x54')][_0xd187('0x79')]===_0x4dc675[_0xd187('0x7a')]){return _0x4dc675[_0xd187('0x64')]({'read':!![]});}else{logger['error'](_0xd187('0x7b'),_0xd187('0x2b'),'twilio',util['inspect'](_0x2b2c64[_0xd187('0x54')],{'showHidden':![],'depth':null}));}break;case _0xd187('0x7c'):if(_0x2b2c64[_0xd187('0x54')][_0xd187('0x7d')]&&_0x2b2c64[_0xd187('0x54')][_0xd187('0x7d')]===_0x4dc675['messageId']&&_[_0xd187('0x7e')]([_0xd187('0x7f'),'delivered'],_0x2b2c64[_0xd187('0x54')][_0xd187('0x80')])>=0x0){return _0x4dc675[_0xd187('0x64')]({'read':!![]});}else{logger[_0xd187('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd187('0x81'),util[_0xd187('0x77')](_0x2b2c64[_0xd187('0x54')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1d9420=_0x2b2c64[_0xd187('0x54')][_0xd187('0x82')][0x0];if(_0x1d9420[_0xd187('0x2b')]['groupName']===_0xd187('0x83')){return _0x4dc675['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util['inspect'](_0x2b2c64['body'],{'showHidden':![],'depth':null}));}break;}return _0x4dc675;}})[_0xd187('0x21')](respondWithResult(_0x3c611d,null))[_0xd187('0x50')](handleError(_0x3c611d,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index fbdd6ab..3f235aa 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 _0x8c93=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x328bd3,_0x9cf5a5){var _0x458149=function(_0x3f60d9){while(--_0x3f60d9){_0x328bd3['push'](_0x328bd3['shift']());}};_0x458149(++_0x9cf5a5);}(_0x8c93,0xd4));var _0x38c9=function(_0x565457,_0x21c51c){_0x565457=_0x565457-0x0;var _0x1aec3a=_0x8c93[_0x565457];return _0x1aec3a;};'use strict';var EventEmitter=require(_0x38c9('0x0'));var SmsMessage=require(_0x38c9('0x1'))['db'][_0x38c9('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x38c9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1d4c6e){return function(_0x37d8e1,_0x406097,_0x4ca3e9){SmsMessageEvents[_0x38c9('0x4')](_0x1d4c6e+':'+_0x37d8e1['id'],_0x37d8e1);SmsMessageEvents['emit'](_0x1d4c6e,_0x37d8e1);_0x4ca3e9(null);};}for(var e in events){if(events[_0x38c9('0x5')](e)){var event=events[e];SmsMessage[_0x38c9('0x6')](e,emitEvent(event));}}module[_0x38c9('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xc324=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x365e31,_0x1b0af0){var _0x4b266b=function(_0x229a2c){while(--_0x229a2c){_0x365e31['push'](_0x365e31['shift']());}};_0x4b266b(++_0x1b0af0);}(_0xc324,0x67));var _0x4c32=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc324[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4c32('0x0'));var SmsMessage=require(_0x4c32('0x1'))['db'][_0x4c32('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4c32('0x3')](0x0);var events={'afterCreate':_0x4c32('0x4'),'afterUpdate':_0x4c32('0x5'),'afterDestroy':_0x4c32('0x6')};function emitEvent(_0x2a8086){return function(_0x4dc9dd,_0x519ad0,_0x27e11){SmsMessageEvents[_0x4c32('0x7')](_0x2a8086+':'+_0x4dc9dd['id'],_0x4dc9dd);SmsMessageEvents[_0x4c32('0x7')](_0x2a8086,_0x4dc9dd);_0x27e11(null);};}for(var e in events){if(events[_0x4c32('0x8')](e)){var event=events[e];SmsMessage[_0x4c32('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 750b843..1922313 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 _0xbb90=['SmsAccount','find','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','login?username=','&password=','GET','split','POST','session_key','total_sent','internal_order_id','smsMethod','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','Missing\x20parameters:\x20authToken','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','sender','text','timestamp','sort','md5','digest','hex','signature=','https://sms.csc.lv/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','utf8mb4','lodash','../../config/logger','api','moment','bluebird','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','models','get','toLowerCase','direction','out','secret','isNil','findOne','SmsInteractionId','then','update','body','catch','error'];(function(_0x3f17f7,_0x1c7312){var _0x1dbba1=function(_0x5b535a){while(--_0x5b535a){_0x3f17f7['push'](_0x3f17f7['shift']());}};_0x1dbba1(++_0x1c7312);}(_0xbb90,0xbe));var _0x0bb9=function(_0x3ffbe9,_0x4ba27c){_0x3ffbe9=_0x3ffbe9-0x0;var _0x3afb8b=_0xbb90[_0x3ffbe9];return _0x3afb8b;};'use strict';var _=require(_0x0bb9('0x0'));var util=require('util');var logger=require(_0x0bb9('0x1'))(_0x0bb9('0x2'));var moment=require(_0x0bb9('0x3'));var BPromise=require(_0x0bb9('0x4'));var rp=require('request-promise');var attributes=require(_0x0bb9('0x5'));module[_0x0bb9('0x6')]=function(_0x4a3277,_0x15fcdb){return _0x4a3277['define'](_0x0bb9('0x7'),attributes,{'tableName':_0x0bb9('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0bb9('0x9')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1431fc,_0x4b709c,_0xd1b83b){var _0x476399=_0x4a3277[_0x0bb9('0xa')];var _0x41ece9=_0x1431fc[_0x0bb9('0xb')]({'plain':!![]});if(_0x41ece9['direction'][_0x0bb9('0xc')]()==='in'||_0x41ece9[_0x0bb9('0xd')][_0x0bb9('0xc')]()===_0x0bb9('0xe')&&!_0x41ece9[_0x0bb9('0xf')]&&!_[_0x0bb9('0x10')](_0x41ece9['UserId'])){_0x476399['SmsInteraction'][_0x0bb9('0x11')]({'where':{'id':_0x41ece9[_0x0bb9('0x12')]}})[_0x0bb9('0x13')](function(_0x582e4c){if(_0x582e4c){_0x582e4c[_0x0bb9('0x14')]({'lastMsgAt':_0x41ece9['createdAt'],'lastMsgDirection':_0x41ece9['direction']['toLowerCase'](),'lastMsgBody':_0x41ece9[_0x0bb9('0x15')]});}})[_0x0bb9('0x16')](function(_0x20da56){console[_0x0bb9('0x17')](_0x20da56);});}if(_0x41ece9[_0x0bb9('0xd')]==='out'&&!_0x41ece9[_0x0bb9('0xf')]){var _0x2fe774;_0x476399[_0x0bb9('0x18')][_0x0bb9('0x19')]({'where':{'id':_0x41ece9['SmsAccountId']},'raw':!![]})['then'](function(_0x47d42d){_0x2fe774=_0x47d42d;if(_0x2fe774&&_0x2fe774['type']){switch(_0x2fe774['type']){case _0x0bb9('0x1a'):var _0x415bc5=require('twilio');if(_0x2fe774[_0x0bb9('0x1b')]&&_0x2fe774[_0x0bb9('0x1c')]&&_0x2fe774['phone']){var _0x449499=new _0x415bc5(_0x2fe774[_0x0bb9('0x1b')],_0x2fe774['authToken']);_0x449499[_0x0bb9('0x1d')][_0x0bb9('0x1e')]({'body':_0x41ece9[_0x0bb9('0x15')],'to':_0x41ece9[_0x0bb9('0x1f')],'from':_0x2fe774[_0x0bb9('0x1f')],'statusCallback':_0x2fe774[_0x0bb9('0x20')]+_0x0bb9('0x21')+_0x41ece9['id']+_0x0bb9('0x22')+_0x2fe774[_0x0bb9('0x23')]})[_0x0bb9('0x13')](function(_0x11d535){if(_0x11d535[_0x0bb9('0x24')]){return _0x1431fc[_0x0bb9('0x14')]({'messageId':_0x11d535['sid']});}})['catch'](function(_0x50d9a2){logger[_0x0bb9('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0bb9('0x25'),_0x0bb9('0x1a'),util['inspect'](_0x50d9a2,{'showHidden':![],'depth':null}));});}else{logger[_0x0bb9('0x17')](_0x0bb9('0x26'),'afterCreate',_0x0bb9('0x1a'),_0x0bb9('0x27'));}break;case _0x0bb9('0x28'):var _0x25d50b=_0x0bb9('0x29');if(_0x2fe774[_0x0bb9('0x2a')]&&_0x2fe774[_0x0bb9('0x2b')]){var _0xdbdbc8={'recipient':[_0x41ece9[_0x0bb9('0x1f')]],'message':_0x41ece9['body'],'message_type':_0x2fe774['smsMethod']};var _0x5d35fa={'url':_0x25d50b+_0x0bb9('0x2c')+_0x2fe774[_0x0bb9('0x2a')]+_0x0bb9('0x2d')+_0x2fe774[_0x0bb9('0x2b')],'method':_0x0bb9('0x2e')};rp(_0x5d35fa)[_0x0bb9('0x13')](function(_0xb92059){var _0x57008b=_0xb92059[_0x0bb9('0x2f')](';');var _0x51f042={'user_key':_0x57008b[0x0],'session_key':_0x57008b[0x1]};_0x5d35fa={'url':_0x25d50b+'sms','method':_0x0bb9('0x30'),'headers':{'user_key':_0x51f042['user_key'],'Session_key':_0x51f042[_0x0bb9('0x31')]},'json':!![],'body':_0xdbdbc8};return rp(_0x5d35fa);})[_0x0bb9('0x13')](function(_0x236494){if(_0x236494[_0x0bb9('0x32')]>=0x1){var _0x8c6bb8={'messageId':_0x236494[_0x0bb9('0x33')]};if(_0x2fe774[_0x0bb9('0x34')]!=='GP'||!_0x2fe774[_0x0bb9('0x35')]){_0x8c6bb8[_0x0bb9('0x36')]=!![];}return _0x1431fc[_0x0bb9('0x14')](_0x8c6bb8);}else{return logger['error'](_0x0bb9('0x26'),_0x0bb9('0x25'),_0x0bb9('0x28'),util[_0x0bb9('0x37')](_0x236494,{'showHidden':![],'depth':null}));}})[_0x0bb9('0x16')](function(_0x57708a){return logger['error'](_0x0bb9('0x26'),_0x0bb9('0x25'),_0x0bb9('0x28'),util['inspect'](_0x57708a,{'showHidden':![],'depth':null}));});}else{logger[_0x0bb9('0x17')](_0x0bb9('0x26'),'afterCreate',_0x0bb9('0x28'),_0x0bb9('0x38'));}break;case _0x0bb9('0x39'):if(_0x2fe774['authToken']){var _0x2041d7={'recipient':_0x41ece9[_0x0bb9('0x1f')],'message':_0x41ece9[_0x0bb9('0x15')],'sender':_0x2fe774[_0x0bb9('0x3a')]||_0x2fe774[_0x0bb9('0x1f')],'authorization':_0x2fe774['authToken']};var _0x4b709c={'method':_0x0bb9('0x30'),'uri':_0x0bb9('0x3b'),'body':_0x2041d7,'json':!![]};rp(_0x4b709c)[_0x0bb9('0x13')](function(_0x2f8107){var _0x1a8c9f={'messageId':_0x2f8107[_0x0bb9('0x3c')]};if(!_0x2fe774['deliveryReport']){_0x1a8c9f['read']=!![];}return _0x1431fc[_0x0bb9('0x14')](_0x1a8c9f);})['catch'](function(_0xa5a7c2){logger['error'](_0x0bb9('0x26'),_0x0bb9('0x25'),_0x0bb9('0x39'),util[_0x0bb9('0x37')](_0xa5a7c2,{'showHidden':![],'depth':null}));});}else{logger[_0x0bb9('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0bb9('0x25'),_0x0bb9('0x39'),_0x0bb9('0x3d'));}break;case'clicksend':if(_0x2fe774[_0x0bb9('0x2a')]&&_0x2fe774['password']){var _0x2041d7={'messages':[{'source':'xCALLY\x20Motion','to':_0x41ece9['phone'],'body':_0x41ece9[_0x0bb9('0x15')],'from':_0x2fe774[_0x0bb9('0x3a')]||_0x2fe774['phone']}]};var _0x5251ff=util['format'](_0x0bb9('0x3e'),_0x2fe774[_0x0bb9('0x2a')],_0x2fe774['password']);var _0x4b709c={'method':_0x0bb9('0x30'),'uri':_0x0bb9('0x3f'),'body':_0x2041d7,'headers':{'Authorization':util[_0x0bb9('0x40')](_0x0bb9('0x41'),new Buffer(_0x5251ff)[_0x0bb9('0x42')](_0x0bb9('0x43')))},'json':!![]};rp(_0x4b709c)['then'](function(_0x8869fd){if(_0x8869fd[_0x0bb9('0x44')]>=0xc8&&_0x8869fd[_0x0bb9('0x44')]<=0xce){if(_0x8869fd['data']&&_0x8869fd[_0x0bb9('0x45')]['queued_count']>0x0){var _0x5a4d13=_[_0x0bb9('0x46')](_0x8869fd[_0x0bb9('0x45')]['messages']);var _0x32bd69={'messageId':_0x5a4d13[_0x0bb9('0x47')]};if(!_0x2fe774[_0x0bb9('0x35')]){_0x32bd69[_0x0bb9('0x36')]=!![];}return _0x1431fc[_0x0bb9('0x14')](_0x32bd69);}else{logger[_0x0bb9('0x17')](_0x0bb9('0x26'),_0x0bb9('0x25'),'clickSend',util[_0x0bb9('0x37')](_0x8869fd,{'showHidden':![],'depth':null}));}}else{logger[_0x0bb9('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0bb9('0x25'),_0x0bb9('0x48'),util['inspect'](_0x8869fd,{'showHidden':![],'depth':null}));}})[_0x0bb9('0x16')](function(_0x28878d){logger[_0x0bb9('0x17')](_0x0bb9('0x26'),'afterCreate',_0x0bb9('0x48'),util[_0x0bb9('0x37')](_0x28878d,{'showHidden':![],'depth':null}));});}else{logger[_0x0bb9('0x17')](_0x0bb9('0x26'),'afterCreate','clickSend',_0x0bb9('0x38'));}break;case'plivo':if(_0x2fe774[_0x0bb9('0x49')]&&_0x2fe774[_0x0bb9('0x1c')]){var _0x2041d7={'dst':_0x41ece9[_0x0bb9('0x1f')],'text':_0x41ece9[_0x0bb9('0x15')],'src':_0x2fe774[_0x0bb9('0x3a')]||_0x2fe774[_0x0bb9('0x1f')],'url':_0x2fe774['remote']+_0x0bb9('0x21')+_0x41ece9['id']+_0x0bb9('0x22')+_0x2fe774[_0x0bb9('0x23')]};var _0x5251ff=util['format']('%s:%s',_0x2fe774[_0x0bb9('0x49')],_0x2fe774[_0x0bb9('0x1c')]);var _0x4b709c={'method':_0x0bb9('0x30'),'uri':util[_0x0bb9('0x40')](_0x0bb9('0x4a'),_0x2fe774[_0x0bb9('0x49')]),'body':_0x2041d7,'headers':{'Authorization':util[_0x0bb9('0x40')]('Basic\x20%s',new Buffer(_0x5251ff)[_0x0bb9('0x42')]('base64'))},'json':!![]};rp(_0x4b709c)['then'](function(_0x737696){var _0x491808={'messageId':_0x737696['message_uuid'][0x0]};return _0x1431fc['update'](_0x491808);})[_0x0bb9('0x16')](function(_0x161367){logger[_0x0bb9('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',util[_0x0bb9('0x37')](_0x161367,{'showHidden':![],'depth':null}));});}else{logger[_0x0bb9('0x17')](_0x0bb9('0x26'),'afterCreate','plivo',_0x0bb9('0x4b'));}break;case _0x0bb9('0x4c'):if(_0x2fe774[_0x0bb9('0x2a')]&&_0x2fe774['password']){if(_0x2fe774[_0x0bb9('0x4d')]){var _0xb4dccc={'method':_0x0bb9('0x30'),'uri':_0x2fe774[_0x0bb9('0x4d')]+_0x0bb9('0x4e'),'body':{'username':_0x2fe774[_0x0bb9('0x2a')],'password':_0x2fe774[_0x0bb9('0x2b')]},'json':!![]};return rp(_0xb4dccc)['then'](function(_0x5278d4){var _0x5ee726={'method':_0x0bb9('0x30'),'uri':_0x2fe774[_0x0bb9('0x4d')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2fe774[_0x0bb9('0x1f')],'destinations':[{'to':_0x41ece9[_0x0bb9('0x1f')]}],'text':_0x41ece9[_0x0bb9('0x15')],'notifyUrl':_0x2fe774[_0x0bb9('0x20')]+_0x0bb9('0x21')+_0x41ece9['id']+_0x0bb9('0x22')+_0x2fe774[_0x0bb9('0x23')],'notifyContentType':_0x0bb9('0x4f'),'callbackData':_0x2fe774[_0x0bb9('0x1f')]+';'+_0x41ece9['body']}]},'headers':{'Authorization':_0x0bb9('0x50')+_0x5278d4[_0x0bb9('0x23')]},'json':!![]};return rp(_0x5ee726)['then'](function(_0x28d735){if(_0x28d735[_0x0bb9('0x1d')]){var _0x4cb2db={'messageId':_0x28d735[_0x0bb9('0x1d')][0x0][_0x0bb9('0x9')]};if(!_0x2fe774[_0x0bb9('0x35')]){_0x4cb2db['read']=!![];}return _0x1431fc[_0x0bb9('0x14')](_0x4cb2db);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0bb9('0x25'),_0x0bb9('0x4c'),util[_0x0bb9('0x37')](_0x28d735,{'showHidden':![],'depth':null}));}});})[_0x0bb9('0x16')](function(_0x227114){return logger[_0x0bb9('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0bb9('0x4c'),util[_0x0bb9('0x37')](_0x227114,{'showHidden':![],'depth':null}));});}else{logger[_0x0bb9('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',_0x0bb9('0x51'));}}else{logger[_0x0bb9('0x17')](_0x0bb9('0x26'),'afterCreate',_0x0bb9('0x4c'),_0x0bb9('0x38'));}break;case _0x0bb9('0x52'):var _0x57ac48=require('crypto');if(_0x2fe774[_0x0bb9('0x53')]){var _0x196dd1={};_0x196dd1[_0x0bb9('0x54')]=_0x2fe774[_0x0bb9('0x2a')];_0x196dd1['phone']=_0x41ece9[_0x0bb9('0x1f')];_0x196dd1[_0x0bb9('0x55')]=_0x2fe774[_0x0bb9('0x1f')];_0x196dd1[_0x0bb9('0x56')]=_0x41ece9['body'];_0x196dd1[_0x0bb9('0x57')]=+new Date();var _0x3c3f6f='';var _0x324dbd='';var _0x5a80f6=Object['keys'](_0x196dd1);_0x5a80f6[_0x0bb9('0x58')]();for(var _0x596a18=0x0;_0x596a18<_0x5a80f6['length'];_0x596a18++){if(_0x3c3f6f!=''){_0x3c3f6f+='&';}_0x3c3f6f+=_0x5a80f6[_0x596a18]+'='+encodeURIComponent(_0x196dd1[_0x5a80f6[_0x596a18]]);_0x324dbd+=_0x196dd1[_0x5a80f6[_0x596a18]];}_0x324dbd+=_0x2fe774[_0x0bb9('0x53')];_0x324dbd=_0x57ac48['createHash'](_0x0bb9('0x59'))[_0x0bb9('0x14')](_0x324dbd)[_0x0bb9('0x5a')](_0x0bb9('0x5b'));if(_0x3c3f6f!==''){_0x3c3f6f+='&';}_0x3c3f6f+=_0x0bb9('0x5c')+_0x324dbd;var _0x5d35fa={'method':_0x0bb9('0x2e'),'uri':_0x0bb9('0x5d')+_0x3c3f6f,'json':!![]};return rp(_0x5d35fa)['then'](function(_0x5a1366){var _0x10eb50=Object['keys'](_0x5a1366);if(_0x5a1366[_0x10eb50[0x0]][_0x0bb9('0x17')]&&parseInt(_0x5a1366[_0x10eb50[0x0]]['error'])===0x0){var _0x632213={'messageId':_0x5a1366[_0x10eb50[0x0]][_0x0bb9('0x5e')]};if(!_0x2fe774[_0x0bb9('0x35')]){_0x632213[_0x0bb9('0x36')]=!![];}return _0x1431fc[_0x0bb9('0x14')](_0x632213);}else{return logger[_0x0bb9('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0bb9('0x25'),_0x0bb9('0x52'),util[_0x0bb9('0x37')](_0x5a1366[_0x0bb9('0x17')],{'showHidden':![],'depth':null}));}})[_0x0bb9('0x16')](function(_0x2a31e9){return logger['error'](_0x0bb9('0x26'),'afterCreate',_0x0bb9('0x52'),util[_0x0bb9('0x37')](_0x2a31e9,{'showHidden':![],'depth':null}));});}else{logger[_0x0bb9('0x17')](_0x0bb9('0x26'),'afterCreate',_0x0bb9('0x52'),_0x0bb9('0x5f'));}break;case'clickatell':if(_0x2fe774['apiKey']){var _0x1c96dc={'method':_0x0bb9('0x30'),'uri':_0x0bb9('0x60'),'headers':{'Authorization':_0x2fe774['apiKey']},'body':{'content':_0x41ece9[_0x0bb9('0x15')],'to':[_0x41ece9[_0x0bb9('0x1f')]],'from':_0x2fe774[_0x0bb9('0x1f')],'binary':![],'clientMessageId':_0x0bb9('0x61'),'charset':'UTF-8'},'json':!![]};rp(_0x1c96dc)[_0x0bb9('0x13')](function(_0x25a618){if(!_0x25a618[_0x0bb9('0x17')]){var _0x4eca42={'messageId':_0x25a618[_0x0bb9('0x1d')][0x0][_0x0bb9('0x62')]};if(!_0x2fe774[_0x0bb9('0x35')]){_0x4eca42['read']=!![];}return _0x1431fc[_0x0bb9('0x14')](_0x4eca42);}else{return logger[_0x0bb9('0x17')](_0x0bb9('0x26'),_0x0bb9('0x25'),_0x0bb9('0x63'),util['inspect'](_0x25a618[_0x0bb9('0x17')],{'showHidden':![],'depth':null}));}})[_0x0bb9('0x16')](function(_0x5eca1e){return logger['error'](_0x0bb9('0x26'),'afterCreate',_0x0bb9('0x63'),util[_0x0bb9('0x37')](_0x5eca1e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0bb9('0x26'),'afterCreate',_0x0bb9('0x63'),_0x0bb9('0x5f'));}break;case _0x0bb9('0x64'):if(_0x2fe774[_0x0bb9('0x53')]){var _0x344711={};var _0x5d35fa={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x0bb9('0x65')+_0x2fe774[_0x0bb9('0x53')],'Content-Type':_0x0bb9('0x4f')},'body':{'from':_0x2fe774[_0x0bb9('0x1f')],'to':_0x41ece9[_0x0bb9('0x1f')],'text':_0x41ece9['body']},'json':!![]};return rp(_0x5d35fa)['then'](function(_0x20b97c){if(_0x20b97c[_0x0bb9('0x66')]==0xca){_0x344711[_0x0bb9('0x67')]=_0x20b97c;var _0x49ef67={'method':_0x0bb9('0x30'),'uri':_0x0bb9('0x68'),'headers':{'Authorization':'Bearer\x20'+_0x2fe774[_0x0bb9('0x53')],'Content-Type':_0x0bb9('0x4f')},'body':{'refid':_0x344711[_0x0bb9('0x67')]['refid']},'json':!![]};return rp(_0x49ef67)[_0x0bb9('0x13')](function(_0x35ec2c){_0x344711['status']=_0x35ec2c;var _0x139ce3={'messageId':_0x344711['message'][_0x0bb9('0x69')],'read':!![]};return _0x1431fc[_0x0bb9('0x14')](_0x139ce3);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0bb9('0x25'),_0x0bb9('0x64'),util[_0x0bb9('0x37')](_0x20b97c,{'showHidden':![],'depth':null}));}})[_0x0bb9('0x16')](function(_0x58ac3b){return logger[_0x0bb9('0x17')](_0x0bb9('0x26'),_0x0bb9('0x25'),_0x0bb9('0x64'),util[_0x0bb9('0x37')](_0x58ac3b,{'showHidden':![],'depth':null}));});}else{return logger[_0x0bb9('0x17')](_0x0bb9('0x26'),'afterCreate',_0x0bb9('0x64'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0xd1b83b();});}else{_0xd1b83b();}}},'charset':_0x0bb9('0x6a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9001=['baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','infobip','crypto','login','sender','text','timestamp','keys','sort','apiKey','createHash','md5','digest','hex','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','define','sms_messages','messageId','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','then','update','body','catch','error','SmsAccount','find','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','&password=','password','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','base64','http_code','data','queued_count','head','clickSend','plivo','senderString','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken'];(function(_0x334afb,_0x2d13d9){var _0xf65e2=function(_0x46509a){while(--_0x46509a){_0x334afb['push'](_0x334afb['shift']());}};_0xf65e2(++_0x2d13d9);}(_0x9001,0x170));var _0x1900=function(_0x4eb99e,_0x8759ee){_0x4eb99e=_0x4eb99e-0x0;var _0x2a3a07=_0x9001[_0x4eb99e];return _0x2a3a07;};'use strict';var _=require(_0x1900('0x0'));var util=require(_0x1900('0x1'));var logger=require('../../config/logger')(_0x1900('0x2'));var moment=require(_0x1900('0x3'));var BPromise=require(_0x1900('0x4'));var rp=require('request-promise');var attributes=require('./smsMessage.attributes');module['exports']=function(_0x40d3e0,_0x187614){return _0x40d3e0[_0x1900('0x5')]('SmsMessage',attributes,{'tableName':_0x1900('0x6'),'paranoid':![],'indexes':[{'name':_0x1900('0x7'),'fields':[_0x1900('0x7')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x95318,_0x5e56d2,_0x1daf3d){var _0x551ddb=_0x40d3e0[_0x1900('0x8')];var _0x21ea2d=_0x95318[_0x1900('0x9')]({'plain':!![]});if(_0x21ea2d['direction'][_0x1900('0xa')]()==='in'||_0x21ea2d[_0x1900('0xb')][_0x1900('0xa')]()===_0x1900('0xc')&&!_0x21ea2d[_0x1900('0xd')]&&!_[_0x1900('0xe')](_0x21ea2d[_0x1900('0xf')])){_0x551ddb['SmsInteraction'][_0x1900('0x10')]({'where':{'id':_0x21ea2d['SmsInteractionId']}})[_0x1900('0x11')](function(_0x5b2a0e){if(_0x5b2a0e){_0x5b2a0e[_0x1900('0x12')]({'lastMsgAt':_0x21ea2d['createdAt'],'lastMsgDirection':_0x21ea2d[_0x1900('0xb')][_0x1900('0xa')](),'lastMsgBody':_0x21ea2d[_0x1900('0x13')]});}})[_0x1900('0x14')](function(_0x1c18f4){console[_0x1900('0x15')](_0x1c18f4);});}if(_0x21ea2d[_0x1900('0xb')]===_0x1900('0xc')&&!_0x21ea2d[_0x1900('0xd')]){var _0x3ecb51;_0x551ddb[_0x1900('0x16')][_0x1900('0x17')]({'where':{'id':_0x21ea2d['SmsAccountId']},'raw':!![]})[_0x1900('0x11')](function(_0x4095ac){_0x3ecb51=_0x4095ac;if(_0x3ecb51&&_0x3ecb51[_0x1900('0x18')]){switch(_0x3ecb51[_0x1900('0x18')]){case _0x1900('0x19'):var _0x173e08=require(_0x1900('0x19'));if(_0x3ecb51[_0x1900('0x1a')]&&_0x3ecb51[_0x1900('0x1b')]&&_0x3ecb51['phone']){var _0x558cba=new _0x173e08(_0x3ecb51[_0x1900('0x1a')],_0x3ecb51['authToken']);_0x558cba[_0x1900('0x1c')][_0x1900('0x1d')]({'body':_0x21ea2d['body'],'to':_0x21ea2d[_0x1900('0x1e')],'from':_0x3ecb51[_0x1900('0x1e')],'statusCallback':_0x3ecb51[_0x1900('0x1f')]+_0x1900('0x20')+_0x21ea2d['id']+'/status?token='+_0x3ecb51[_0x1900('0x21')]})[_0x1900('0x11')](function(_0x32efc9){if(_0x32efc9[_0x1900('0x22')]){return _0x95318[_0x1900('0x12')]({'messageId':_0x32efc9[_0x1900('0x22')]});}})[_0x1900('0x14')](function(_0x305917){logger['error'](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x19'),util[_0x1900('0x25')](_0x305917,{'showHidden':![],'depth':null}));});}else{logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x19'),_0x1900('0x26'));}break;case _0x1900('0x27'):var _0x3a3ed1=_0x1900('0x28');if(_0x3ecb51[_0x1900('0x29')]&&_0x3ecb51['password']){var _0x36dc9b={'recipient':[_0x21ea2d['phone']],'message':_0x21ea2d['body'],'message_type':_0x3ecb51[_0x1900('0x2a')]};var _0x45cebe={'url':_0x3a3ed1+_0x1900('0x2b')+_0x3ecb51['username']+_0x1900('0x2c')+_0x3ecb51[_0x1900('0x2d')],'method':_0x1900('0x2e')};rp(_0x45cebe)['then'](function(_0x2c586e){var _0x4fd70a=_0x2c586e[_0x1900('0x2f')](';');var _0x7165bc={'user_key':_0x4fd70a[0x0],'session_key':_0x4fd70a[0x1]};_0x45cebe={'url':_0x3a3ed1+_0x1900('0x30'),'method':_0x1900('0x31'),'headers':{'user_key':_0x7165bc[_0x1900('0x32')],'Session_key':_0x7165bc[_0x1900('0x33')]},'json':!![],'body':_0x36dc9b};return rp(_0x45cebe);})[_0x1900('0x11')](function(_0x4c1416){if(_0x4c1416[_0x1900('0x34')]>=0x1){var _0x221f81={'messageId':_0x4c1416['internal_order_id']};if(_0x3ecb51['smsMethod']!=='GP'||!_0x3ecb51[_0x1900('0x35')]){_0x221f81[_0x1900('0x36')]=!![];}return _0x95318['update'](_0x221f81);}else{return logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x27'),util[_0x1900('0x25')](_0x4c1416,{'showHidden':![],'depth':null}));}})[_0x1900('0x14')](function(_0x330223){return logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),'skebby',util[_0x1900('0x25')](_0x330223,{'showHidden':![],'depth':null}));});}else{logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x27'),_0x1900('0x37'));}break;case _0x1900('0x38'):if(_0x3ecb51[_0x1900('0x1b')]){var _0x7a4463={'recipient':_0x21ea2d[_0x1900('0x1e')],'message':_0x21ea2d['body'],'sender':_0x3ecb51['senderString']||_0x3ecb51[_0x1900('0x1e')],'authorization':_0x3ecb51['authToken']};var _0x5e56d2={'method':_0x1900('0x31'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x7a4463,'json':!![]};rp(_0x5e56d2)['then'](function(_0x2a1431){var _0x20e2bd={'messageId':_0x2a1431[_0x1900('0x39')]};if(!_0x3ecb51['deliveryReport']){_0x20e2bd[_0x1900('0x36')]=!![];}return _0x95318['update'](_0x20e2bd);})['catch'](function(_0x35a831){logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x38'),util['inspect'](_0x35a831,{'showHidden':![],'depth':null}));});}else{logger[_0x1900('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1900('0x24'),_0x1900('0x38'),'Missing\x20parameters:\x20authToken');}break;case _0x1900('0x3a'):if(_0x3ecb51[_0x1900('0x29')]&&_0x3ecb51[_0x1900('0x2d')]){var _0x7a4463={'messages':[{'source':_0x1900('0x3b'),'to':_0x21ea2d[_0x1900('0x1e')],'body':_0x21ea2d[_0x1900('0x13')],'from':_0x3ecb51['senderString']||_0x3ecb51['phone']}]};var _0x254c49=util[_0x1900('0x3c')](_0x1900('0x3d'),_0x3ecb51[_0x1900('0x29')],_0x3ecb51['password']);var _0x5e56d2={'method':_0x1900('0x31'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x7a4463,'headers':{'Authorization':util[_0x1900('0x3c')]('Basic\x20%s',new Buffer(_0x254c49)['toString'](_0x1900('0x3e')))},'json':!![]};rp(_0x5e56d2)['then'](function(_0x14f011){if(_0x14f011['http_code']>=0xc8&&_0x14f011[_0x1900('0x3f')]<=0xce){if(_0x14f011[_0x1900('0x40')]&&_0x14f011[_0x1900('0x40')][_0x1900('0x41')]>0x0){var _0x33962e=_[_0x1900('0x42')](_0x14f011['data']['messages']);var _0x55099f={'messageId':_0x33962e['message_id']};if(!_0x3ecb51[_0x1900('0x35')]){_0x55099f[_0x1900('0x36')]=!![];}return _0x95318[_0x1900('0x12')](_0x55099f);}else{logger['error'](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x43'),util[_0x1900('0x25')](_0x14f011,{'showHidden':![],'depth':null}));}}else{logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x43'),util[_0x1900('0x25')](_0x14f011,{'showHidden':![],'depth':null}));}})[_0x1900('0x14')](function(_0x1fa171){logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),'clickSend',util[_0x1900('0x25')](_0x1fa171,{'showHidden':![],'depth':null}));});}else{logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),'clickSend',_0x1900('0x37'));}break;case _0x1900('0x44'):if(_0x3ecb51['authId']&&_0x3ecb51[_0x1900('0x1b')]){var _0x7a4463={'dst':_0x21ea2d['phone'],'text':_0x21ea2d['body'],'src':_0x3ecb51[_0x1900('0x45')]||_0x3ecb51[_0x1900('0x1e')],'url':_0x3ecb51[_0x1900('0x1f')]+'/api/sms/messages/'+_0x21ea2d['id']+'/status?token='+_0x3ecb51[_0x1900('0x21')]};var _0x254c49=util[_0x1900('0x3c')](_0x1900('0x3d'),_0x3ecb51[_0x1900('0x46')],_0x3ecb51[_0x1900('0x1b')]);var _0x5e56d2={'method':_0x1900('0x31'),'uri':util[_0x1900('0x3c')](_0x1900('0x47'),_0x3ecb51[_0x1900('0x46')]),'body':_0x7a4463,'headers':{'Authorization':util['format'](_0x1900('0x48'),new Buffer(_0x254c49)[_0x1900('0x49')]('base64'))},'json':!![]};rp(_0x5e56d2)[_0x1900('0x11')](function(_0x5e5cb7){var _0x4db185={'messageId':_0x5e5cb7[_0x1900('0x4a')][0x0]};return _0x95318['update'](_0x4db185);})['catch'](function(_0x2b2608){logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x44'),util[_0x1900('0x25')](_0x2b2608,{'showHidden':![],'depth':null}));});}else{logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x44'),_0x1900('0x4b'));}break;case'infobip':if(_0x3ecb51['username']&&_0x3ecb51['password']){if(_0x3ecb51['baseUrl']){var _0x38c9c1={'method':_0x1900('0x31'),'uri':_0x3ecb51[_0x1900('0x4c')]+_0x1900('0x4d'),'body':{'username':_0x3ecb51['username'],'password':_0x3ecb51[_0x1900('0x2d')]},'json':!![]};return rp(_0x38c9c1)['then'](function(_0x50f527){var _0x19ed28={'method':_0x1900('0x31'),'uri':_0x3ecb51['baseUrl']+_0x1900('0x4e'),'body':{'messages':[{'from':_0x3ecb51[_0x1900('0x1e')],'destinations':[{'to':_0x21ea2d[_0x1900('0x1e')]}],'text':_0x21ea2d[_0x1900('0x13')],'notifyUrl':_0x3ecb51[_0x1900('0x1f')]+_0x1900('0x20')+_0x21ea2d['id']+_0x1900('0x4f')+_0x3ecb51['token'],'notifyContentType':_0x1900('0x50'),'callbackData':_0x3ecb51['phone']+';'+_0x21ea2d[_0x1900('0x13')]}]},'headers':{'Authorization':_0x1900('0x51')+_0x50f527[_0x1900('0x21')]},'json':!![]};return rp(_0x19ed28)[_0x1900('0x11')](function(_0x3e2098){if(_0x3e2098[_0x1900('0x1c')]){var _0x48a630={'messageId':_0x3e2098[_0x1900('0x1c')][0x0][_0x1900('0x7')]};if(!_0x3ecb51[_0x1900('0x35')]){_0x48a630[_0x1900('0x36')]=!![];}return _0x95318[_0x1900('0x12')](_0x48a630);}else{return logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x52'),util[_0x1900('0x25')](_0x3e2098,{'showHidden':![],'depth':null}));}});})[_0x1900('0x14')](function(_0x3f9bbc){return logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x52'),util[_0x1900('0x25')](_0x3f9bbc,{'showHidden':![],'depth':null}));});}else{logger[_0x1900('0x15')](_0x1900('0x23'),'afterCreate','infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x1900('0x15')](_0x1900('0x23'),'afterCreate',_0x1900('0x52'),_0x1900('0x37'));}break;case'csc':var _0x317c78=require(_0x1900('0x53'));if(_0x3ecb51['apiKey']){var _0x49db72={};_0x49db72[_0x1900('0x54')]=_0x3ecb51[_0x1900('0x29')];_0x49db72[_0x1900('0x1e')]=_0x21ea2d['phone'];_0x49db72[_0x1900('0x55')]=_0x3ecb51[_0x1900('0x1e')];_0x49db72[_0x1900('0x56')]=_0x21ea2d['body'];_0x49db72[_0x1900('0x57')]=+new Date();var _0x59e6a7='';var _0x1a8b61='';var _0x1424d6=Object[_0x1900('0x58')](_0x49db72);_0x1424d6[_0x1900('0x59')]();for(var _0x102c18=0x0;_0x102c18<_0x1424d6['length'];_0x102c18++){if(_0x59e6a7!=''){_0x59e6a7+='&';}_0x59e6a7+=_0x1424d6[_0x102c18]+'='+encodeURIComponent(_0x49db72[_0x1424d6[_0x102c18]]);_0x1a8b61+=_0x49db72[_0x1424d6[_0x102c18]];}_0x1a8b61+=_0x3ecb51[_0x1900('0x5a')];_0x1a8b61=_0x317c78[_0x1900('0x5b')](_0x1900('0x5c'))[_0x1900('0x12')](_0x1a8b61)[_0x1900('0x5d')](_0x1900('0x5e'));if(_0x59e6a7!==''){_0x59e6a7+='&';}_0x59e6a7+='signature='+_0x1a8b61;var _0x45cebe={'method':_0x1900('0x2e'),'uri':'https://sms.csc.lv/external/get/send.php?'+_0x59e6a7,'json':!![]};return rp(_0x45cebe)[_0x1900('0x11')](function(_0x23204a){var _0x4bd4ed=Object[_0x1900('0x58')](_0x23204a);if(_0x23204a[_0x4bd4ed[0x0]][_0x1900('0x15')]&&parseInt(_0x23204a[_0x4bd4ed[0x0]][_0x1900('0x15')])===0x0){var _0x43dd01={'messageId':_0x23204a[_0x4bd4ed[0x0]]['id_sms']};if(!_0x3ecb51['deliveryReport']){_0x43dd01['read']=!![];}return _0x95318[_0x1900('0x12')](_0x43dd01);}else{return logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x5f'),util[_0x1900('0x25')](_0x23204a[_0x1900('0x15')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2dbfe4){return logger[_0x1900('0x15')](_0x1900('0x23'),'afterCreate',_0x1900('0x5f'),util[_0x1900('0x25')](_0x2dbfe4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x5f'),_0x1900('0x60'));}break;case'clickatell':if(_0x3ecb51['apiKey']){var _0x3d53b8={'method':'POST','uri':_0x1900('0x61'),'headers':{'Authorization':_0x3ecb51['apiKey']},'body':{'content':_0x21ea2d[_0x1900('0x13')],'to':[_0x21ea2d[_0x1900('0x1e')]],'from':_0x3ecb51['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x1900('0x62')},'json':!![]};rp(_0x3d53b8)[_0x1900('0x11')](function(_0x31288b){if(!_0x31288b[_0x1900('0x15')]){var _0x480e26={'messageId':_0x31288b[_0x1900('0x1c')][0x0][_0x1900('0x63')]};if(!_0x3ecb51['deliveryReport']){_0x480e26[_0x1900('0x36')]=!![];}return _0x95318[_0x1900('0x12')](_0x480e26);}else{return logger['error'](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x64'),util['inspect'](_0x31288b[_0x1900('0x15')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x50f3e1){return logger[_0x1900('0x15')](_0x1900('0x23'),'afterCreate',_0x1900('0x64'),util['inspect'](_0x50f3e1,{'showHidden':![],'depth':null}));});}else{logger[_0x1900('0x15')](_0x1900('0x23'),'afterCreate',_0x1900('0x64'),_0x1900('0x60'));}break;case'intelepeer':if(_0x3ecb51[_0x1900('0x5a')]){var _0x423aee={};var _0x45cebe={'method':_0x1900('0x31'),'uri':_0x1900('0x65'),'headers':{'Authorization':_0x1900('0x66')+_0x3ecb51[_0x1900('0x5a')],'Content-Type':'application/json'},'body':{'from':_0x3ecb51['phone'],'to':_0x21ea2d[_0x1900('0x1e')],'text':_0x21ea2d[_0x1900('0x13')]},'json':!![]};return rp(_0x45cebe)[_0x1900('0x11')](function(_0x33ca4c){if(_0x33ca4c[_0x1900('0x67')]==0xca){_0x423aee[_0x1900('0x68')]=_0x33ca4c;var _0x497e59={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x1900('0x66')+_0x3ecb51[_0x1900('0x5a')],'Content-Type':_0x1900('0x50')},'body':{'refid':_0x423aee['message'][_0x1900('0x69')]},'json':!![]};return rp(_0x497e59)['then'](function(_0x152cf4){_0x423aee['status']=_0x152cf4;var _0x45a62c={'messageId':_0x423aee[_0x1900('0x68')][_0x1900('0x69')],'read':!![]};return _0x95318[_0x1900('0x12')](_0x45a62c);});}else{return logger[_0x1900('0x15')](_0x1900('0x23'),_0x1900('0x24'),_0x1900('0x6a'),util[_0x1900('0x25')](_0x33ca4c,{'showHidden':![],'depth':null}));}})[_0x1900('0x14')](function(_0xe8443){return logger['error'](_0x1900('0x23'),_0x1900('0x24'),'intelepeer',util[_0x1900('0x25')](_0xe8443,{'showHidden':![],'depth':null}));});}else{return logger[_0x1900('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1900('0x6a'),_0x1900('0x6b'));}break;}}})[_0x1900('0x6c')](function(){_0x1daf3d();});}else{_0x1daf3d();}}},'charset':_0x1900('0x6d'),'collate':_0x1900('0x6e')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index fadb0b9..3fe7187 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 _0xd682=['localhost','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateSmsMessage','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x576d30,_0x19fd89){var _0x6555e5=function(_0x49760f){while(--_0x49760f){_0x576d30['push'](_0x576d30['shift']());}};_0x6555e5(++_0x19fd89);}(_0xd682,0x1c6));var _0x2d68=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xd682[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0x2d68('0x0'));var moment=require(_0x2d68('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d68('0x2'));var fs=require('fs');var Redis=require(_0x2d68('0x3'));var db=require(_0x2d68('0x4'))['db'];var utils=require(_0x2d68('0x5'));var logger=require(_0x2d68('0x6'))(_0x2d68('0x7'));var config=require(_0x2d68('0x8'));var jayson=require(_0x2d68('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x2d68('0xa')]=_['defaults'](config[_0x2d68('0xa')],{'host':_0x2d68('0xb'),'port':0x18eb});var socket=require(_0x2d68('0xc'))(new Redis(config[_0x2d68('0xa')]));require(_0x2d68('0xd'))['register'](socket);function respondWithRpcPromise(_0xd5427a,_0xf29612,_0x1a2da4){return new BPromise(function(_0x4fea4f,_0x3dc5cf){return client[_0x2d68('0xe')](_0xd5427a,_0x1a2da4)[_0x2d68('0xf')](function(_0x4e22be){logger[_0x2d68('0x10')](_0x2d68('0x11'),_0xf29612,_0x2d68('0x12'));logger[_0x2d68('0x13')](_0x2d68('0x14'),_0xf29612,'request\x20sent',JSON[_0x2d68('0x15')](_0x4e22be));if(_0x4e22be[_0x2d68('0x16')]){if(_0x4e22be[_0x2d68('0x16')][_0x2d68('0x17')]===0x1f4){logger[_0x2d68('0x16')](_0x2d68('0x11'),_0xf29612,_0x4e22be[_0x2d68('0x16')][_0x2d68('0x18')]);return _0x3dc5cf(_0x4e22be[_0x2d68('0x16')][_0x2d68('0x18')]);}logger[_0x2d68('0x16')](_0x2d68('0x11'),_0xf29612,_0x4e22be[_0x2d68('0x16')][_0x2d68('0x18')]);return _0x4fea4f(_0x4e22be[_0x2d68('0x16')][_0x2d68('0x18')]);}else{logger[_0x2d68('0x10')](_0x2d68('0x11'),_0xf29612,_0x2d68('0x12'));_0x4fea4f(_0x4e22be['result'][_0x2d68('0x18')]);}})[_0x2d68('0x19')](function(_0x207879){logger['error'](_0x2d68('0x11'),_0xf29612,_0x207879);_0x3dc5cf(_0x207879);});});}exports['CreateSmsMessage']=function(_0xbb954c){var _0x5d67c9=this;return new Promise(function(_0x2772ea,_0x9cf915){return db['SmsMessage'][_0x2d68('0x1a')](_0xbb954c[_0x2d68('0x1b')],{'raw':_0xbb954c[_0x2d68('0x1c')]?_0xbb954c[_0x2d68('0x1c')][_0x2d68('0x1d')]===undefined?!![]:![]:!![]})[_0x2d68('0xf')](function(_0x5393c6){logger[_0x2d68('0x10')]('CreateSmsMessage',_0xbb954c);logger[_0x2d68('0x13')](_0x2d68('0x1e'),_0xbb954c,JSON[_0x2d68('0x15')](_0x5393c6));_0x2772ea(_0x5393c6);})[_0x2d68('0x19')](function(_0x31b3f5){logger[_0x2d68('0x16')](_0x2d68('0x1e'),_0x31b3f5[_0x2d68('0x18')],_0xbb954c);_0x9cf915(_0x5d67c9[_0x2d68('0x16')](0x1f4,_0x31b3f5[_0x2d68('0x18')]));});});}; \ No newline at end of file +var _0xcec7=['error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xb4df18,_0x4e4aec){var _0x1ca097=function(_0x206669){while(--_0x206669){_0xb4df18['push'](_0xb4df18['shift']());}};_0x1ca097(++_0x4e4aec);}(_0xcec7,0x14a));var _0x7cec=function(_0x585748,_0x4a86fb){_0x585748=_0x585748-0x0;var _0x35816e=_0xcec7[_0x585748];return _0x35816e;};'use strict';var _=require(_0x7cec('0x0'));var util=require(_0x7cec('0x1'));var moment=require('moment');var BPromise=require(_0x7cec('0x2'));var rs=require(_0x7cec('0x3'));var fs=require('fs');var Redis=require(_0x7cec('0x4'));var db=require(_0x7cec('0x5'))['db'];var utils=require(_0x7cec('0x6'));var logger=require(_0x7cec('0x7'))(_0x7cec('0x8'));var config=require(_0x7cec('0x9'));var jayson=require(_0x7cec('0xa'));var client=jayson[_0x7cec('0xb')][_0x7cec('0xc')]({'port':0x232a});config[_0x7cec('0xd')]=_[_0x7cec('0xe')](config[_0x7cec('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cec('0xf'))(new Redis(config[_0x7cec('0xd')]));require(_0x7cec('0x10'))['register'](socket);function respondWithRpcPromise(_0x54e02d,_0x5b4c77,_0x5d62c1){return new BPromise(function(_0x5e60cd,_0x3d37e4){return client['request'](_0x54e02d,_0x5d62c1)[_0x7cec('0x11')](function(_0x5f07f2){logger[_0x7cec('0x12')](_0x7cec('0x13'),_0x5b4c77,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5b4c77,_0x7cec('0x14'),JSON[_0x7cec('0x15')](_0x5f07f2));if(_0x5f07f2[_0x7cec('0x16')]){if(_0x5f07f2['error'][_0x7cec('0x17')]===0x1f4){logger[_0x7cec('0x16')](_0x7cec('0x13'),_0x5b4c77,_0x5f07f2[_0x7cec('0x16')][_0x7cec('0x18')]);return _0x3d37e4(_0x5f07f2[_0x7cec('0x16')][_0x7cec('0x18')]);}logger['error'](_0x7cec('0x13'),_0x5b4c77,_0x5f07f2[_0x7cec('0x16')][_0x7cec('0x18')]);return _0x5e60cd(_0x5f07f2[_0x7cec('0x16')][_0x7cec('0x18')]);}else{logger[_0x7cec('0x12')](_0x7cec('0x13'),_0x5b4c77,_0x7cec('0x14'));_0x5e60cd(_0x5f07f2[_0x7cec('0x19')][_0x7cec('0x18')]);}})[_0x7cec('0x1a')](function(_0x1550f3){logger['error'](_0x7cec('0x13'),_0x5b4c77,_0x1550f3);_0x3d37e4(_0x1550f3);});});}exports[_0x7cec('0x1b')]=function(_0x5863fb){var _0x24c950=this;return new Promise(function(_0x139d54,_0xd7054d){return db[_0x7cec('0x1c')][_0x7cec('0x1d')](_0x5863fb[_0x7cec('0x1e')],{'raw':_0x5863fb['options']?_0x5863fb[_0x7cec('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x7cec('0x11')](function(_0x10f446){logger['info'](_0x7cec('0x1b'),_0x5863fb);logger['debug'](_0x7cec('0x1b'),_0x5863fb,JSON[_0x7cec('0x15')](_0x10f446));_0x139d54(_0x10f446);})[_0x7cec('0x1a')](function(_0xbcc2d4){logger['error']('CreateSmsMessage',_0xbcc2d4[_0x7cec('0x18')],_0x5863fb);_0xd7054d(_0x24c950[_0x7cec('0x16')](0x1f4,_0xbcc2d4[_0x7cec('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index b7b75d3..fbadd4a 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 _0xb190=['remove','update','emit','removeListener','smsMessage:','./smsMessage.events','save'];(function(_0x3922cc,_0x5ec3ac){var _0x45fd94=function(_0x2b3e12){while(--_0x2b3e12){_0x3922cc['push'](_0x3922cc['shift']());}};_0x45fd94(++_0x5ec3ac);}(_0xb190,0x116));var _0x0b19=function(_0x3be3c5,_0x2796a7){_0x3be3c5=_0x3be3c5-0x0;var _0x1ccd77=_0xb190[_0x3be3c5];return _0x1ccd77;};'use strict';var SmsMessageEvents=require(_0x0b19('0x0'));var events=[_0x0b19('0x1'),_0x0b19('0x2'),_0x0b19('0x3')];function createListener(_0x8594c0,_0x1b3a74){return function(_0x50c88e){_0x1b3a74[_0x0b19('0x4')](_0x8594c0,_0x50c88e);};}function removeListener(_0x55c8d0,_0x4fad29){return function(){SmsMessageEvents[_0x0b19('0x5')](_0x55c8d0,_0x4fad29);};}exports['register']=function(_0x5e7403){for(var _0x53458e=0x0,_0x21a3bf=events['length'];_0x53458e<_0x21a3bf;_0x53458e++){var _0x5aeffe=events[_0x53458e];var _0xf3be53=createListener(_0x0b19('0x6')+_0x5aeffe,_0x5e7403);SmsMessageEvents['on'](_0x5aeffe,_0xf3be53);}}; \ No newline at end of file +var _0x836b=['removeListener','register','length','./smsMessage.events','save','remove','update','emit'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x836b,0x1ab));var _0xb836=function(_0x4268f5,_0x4d47d3){_0x4268f5=_0x4268f5-0x0;var _0x2379d0=_0x836b[_0x4268f5];return _0x2379d0;};'use strict';var SmsMessageEvents=require(_0xb836('0x0'));var events=[_0xb836('0x1'),_0xb836('0x2'),_0xb836('0x3')];function createListener(_0xf01742,_0x571968){return function(_0x420e01){_0x571968[_0xb836('0x4')](_0xf01742,_0x420e01);};}function removeListener(_0x4b5f94,_0x3cc8be){return function(){SmsMessageEvents[_0xb836('0x5')](_0x4b5f94,_0x3cc8be);};}exports[_0xb836('0x6')]=function(_0x15ca19){for(var _0x3a1679=0x0,_0x36861e=events[_0xb836('0x7')];_0x3a1679<_0x36861e;_0x3a1679++){var _0x58fc70=events[_0x3a1679];var _0x39d7ec=createListener('smsMessage:'+_0x58fc70,_0x15ca19);SmsMessageEvents['on'](_0x58fc70,_0x39d7ec);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 28c9a58..992c57f 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 _0xf821=['show','getMembers','getTeams','post','/:id/teams','addTeams','/:id/users','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','index','get','/describe','describe','/:id','isAuthenticated'];(function(_0x4959f2,_0x3d1162){var _0x12acdc=function(_0x4636f4){while(--_0x4636f4){_0x4959f2['push'](_0x4959f2['shift']());}};_0x12acdc(++_0x3d1162);}(_0xf821,0xcc));var _0x1f82=function(_0x492f01,_0x3b9e9a){_0x492f01=_0x492f01-0x0;var _0x2eed00=_0xf821[_0x492f01];return _0x2eed00;};'use strict';var multer=require(_0x1f82('0x0'));var util=require('util');var path=require(_0x1f82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f82('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x1f82('0x3'));var config=require(_0x1f82('0x4'));var controller=require(_0x1f82('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x1f82('0x6')]);router[_0x1f82('0x7')](_0x1f82('0x8'),auth['isAuthenticated'](),controller[_0x1f82('0x9')]);router[_0x1f82('0x7')](_0x1f82('0xa'),auth[_0x1f82('0xb')](),controller[_0x1f82('0xc')]);router[_0x1f82('0x7')]('/:id/members',auth[_0x1f82('0xb')](),controller[_0x1f82('0xd')]);router[_0x1f82('0x7')]('/:id/teams',auth[_0x1f82('0xb')](),controller[_0x1f82('0xe')]);router[_0x1f82('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x1f82('0xb')](),controller['create']);router[_0x1f82('0xf')](_0x1f82('0x10'),auth[_0x1f82('0xb')](),controller[_0x1f82('0x11')]);router[_0x1f82('0xf')](_0x1f82('0x12'),auth[_0x1f82('0xb')](),controller[_0x1f82('0x13')]);router[_0x1f82('0x14')](_0x1f82('0xa'),auth['isAuthenticated'](),controller[_0x1f82('0x15')]);router['delete'](_0x1f82('0xa'),auth[_0x1f82('0xb')](),controller[_0x1f82('0x16')]);router[_0x1f82('0x17')](_0x1f82('0x10'),auth[_0x1f82('0xb')](),controller[_0x1f82('0x18')]);router[_0x1f82('0x17')](_0x1f82('0x12'),auth[_0x1f82('0xb')](),controller[_0x1f82('0x19')]);module[_0x1f82('0x1a')]=router; \ No newline at end of file +var _0xe17f=['getAgents','post','create','/:id','update','delete','destroy','removeTeams','removeAgents','exports','connect-timeout','express','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0xe17f,0x104));var _0xfe17=function(_0x345f0b,_0x47219e){_0x345f0b=_0x345f0b-0x0;var _0x5528ec=_0xe17f[_0x345f0b];return _0x5528ec;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfe17('0x0'));var express=require(_0xfe17('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfe17('0x2'));var config=require('../../config/environment');var controller=require(_0xfe17('0x3'));router[_0xfe17('0x4')]('/',auth[_0xfe17('0x5')](),controller[_0xfe17('0x6')]);router['get'](_0xfe17('0x7'),auth['isAuthenticated'](),controller[_0xfe17('0x8')]);router[_0xfe17('0x4')]('/:id',auth[_0xfe17('0x5')](),controller[_0xfe17('0x9')]);router[_0xfe17('0x4')](_0xfe17('0xa'),auth[_0xfe17('0x5')](),controller[_0xfe17('0xb')]);router[_0xfe17('0x4')](_0xfe17('0xc'),auth['isAuthenticated'](),controller[_0xfe17('0xd')]);router['get'](_0xfe17('0xe'),auth['isAuthenticated'](),controller[_0xfe17('0xf')]);router[_0xfe17('0x10')]('/',auth[_0xfe17('0x5')](),controller[_0xfe17('0x11')]);router[_0xfe17('0x10')](_0xfe17('0xc'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xfe17('0xe'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xfe17('0x12'),auth[_0xfe17('0x5')](),controller[_0xfe17('0x13')]);router[_0xfe17('0x14')](_0xfe17('0x12'),auth[_0xfe17('0x5')](),controller[_0xfe17('0x15')]);router[_0xfe17('0x14')](_0xfe17('0xc'),auth[_0xfe17('0x5')](),controller[_0xfe17('0x16')]);router[_0xfe17('0x14')]('/:id/users',auth[_0xfe17('0x5')](),controller[_0xfe17('0x17')]);module[_0xfe17('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index dab3549..901f4d0 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 _0x14db=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x52e8d8,_0x957fe3){var _0x13ce8b=function(_0x5f3603){while(--_0x5f3603){_0x52e8d8['push'](_0x52e8d8['shift']());}};_0x13ce8b(++_0x957fe3);}(_0x14db,0xc0));var _0xb14d=function(_0xbd6595,_0x542c36){_0xbd6595=_0xbd6595-0x0;var _0x497b92=_0x14db[_0xbd6595];return _0x497b92;};'use strict';var Sequelize=require(_0xb14d('0x0'));module[_0xb14d('0x1')]={'name':{'type':Sequelize[_0xb14d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb14d('0x2')]},'timeout':{'type':Sequelize[_0xb14d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb14d('0x4')](_0xb14d('0x5'),'beepall',_0xb14d('0x6'))}}; \ No newline at end of file +var _0xf13f=['STRING','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x14dc8a,_0x4fe14d){var _0xc2be12=function(_0x3201d7){while(--_0x3201d7){_0x14dc8a['push'](_0x14dc8a['shift']());}};_0xc2be12(++_0x4fe14d);}(_0xf13f,0xb2));var _0xff13=function(_0x5baf49,_0x4d3996){_0x5baf49=_0x5baf49-0x0;var _0x1afae8=_0xf13f[_0x5baf49];return _0x1afae8;};'use strict';var Sequelize=require(_0xff13('0x0'));module[_0xff13('0x1')]={'name':{'type':Sequelize[_0xff13('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xff13('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xff13('0x3')](_0xff13('0x4'),'beepall',_0xff13('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ab26595..b6aa377 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 _0x9833=['key','options','include','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','merge','map','findAll','User','UserId','agent','createdAt','format','smsPause','updatedAt','getTeams','Team','addTeams','ids','Agents','union','addAgents','penalty','removeTeams','removeAgents','omit','spread','emit','isArray','userSmsQueue:remove','getAgents','html-pdf','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','count','offset','limit','set','Content-Range','save','update','then','destroy','get','UserProfileResource','error','name','index','SmsQueue','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type'];(function(_0x256c83,_0x4a5e23){var _0x3b8f3c=function(_0x509b15){while(--_0x509b15){_0x256c83['push'](_0x256c83['shift']());}};_0x3b8f3c(++_0x4a5e23);}(_0x9833,0x10a));var _0x3983=function(_0x2eefba,_0x5351b8){_0x2eefba=_0x2eefba-0x0;var _0x13d116=_0x9833[_0x2eefba];return _0x13d116;};'use strict';var pdf=require(_0x3983('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3983('0x1'));var zipdir=require(_0x3983('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3983('0x3'));var BPromise=require(_0x3983('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3983('0x5'));var sox=require(_0x3983('0x6'));var csv=require(_0x3983('0x7'));var ejs=require(_0x3983('0x8'));var fs=require('fs');var _=require(_0x3983('0x9'));var squel=require(_0x3983('0xa'));var crypto=require('crypto');var jsforce=require(_0x3983('0xb'));var deskjs=require(_0x3983('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3983('0xd'));var authService=require(_0x3983('0xe'));var hardwareService=require(_0x3983('0xf'));var Redis=require(_0x3983('0x10'));var qs=require(_0x3983('0x11'));var logger=require(_0x3983('0x12'))(_0x3983('0x13'));var utils=require(_0x3983('0x14'));var config=require(_0x3983('0x15'));var db=require(_0x3983('0x16'))['db'];config[_0x3983('0x17')]=_[_0x3983('0x18')](config[_0x3983('0x17')],{'host':_0x3983('0x19'),'port':0x18eb});var socket=require(_0x3983('0x1a'))(new Redis(config[_0x3983('0x17')]));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x1f1874,_0x1601a7){_0x1601a7=_0x1601a7||0xcc;return function(_0x3daf83){if(_0x3daf83){return _0x1f1874[_0x3983('0x1b')](_0x1601a7);}return _0x1f1874[_0x3983('0x1c')](_0x1601a7)['end']();};}function respondWithResult(_0x494000,_0x15a139){_0x15a139=_0x15a139||0xc8;return function(_0x5f2e8a){if(_0x5f2e8a){return _0x494000[_0x3983('0x1c')](_0x15a139)['json'](_0x5f2e8a);}};}function respondWithFilteredResult(_0x1c48ba,_0x9fb56){return function(_0x1bbff8){if(_0x1bbff8){var _0x4e5cc0=_0x1bbff8[_0x3983('0x1d')],_0x474449=_0x9fb56[_0x3983('0x1e')],_0x432211=_0x9fb56[_0x3983('0x1e')]+_0x9fb56[_0x3983('0x1f')],_0x48d4c7;if(_0x432211>=_0x4e5cc0){_0x432211=_0x4e5cc0;_0x48d4c7=0xc8;}else{_0x48d4c7=0xce;}_0x1c48ba['status'](_0x48d4c7);return _0x1c48ba[_0x3983('0x20')](_0x3983('0x21'),_0x474449+'-'+_0x432211+'/'+_0x4e5cc0)['json'](_0x1bbff8);}return null;};}function patchUpdates(_0x5666cf){return function(_0x54f882){try{jsonpatch['apply'](_0x54f882,_0x5666cf,!![]);}catch(_0x100e05){return BPromise['reject'](_0x100e05);}return _0x54f882[_0x3983('0x22')]();};}function saveUpdates(_0x4750ae,_0x39370c){return function(_0x5acd76){if(_0x5acd76){return _0x5acd76[_0x3983('0x23')](_0x4750ae)[_0x3983('0x24')](function(_0x49aa0c){return _0x49aa0c;});}return null;};}function removeEntity(_0x54a44e,_0x2692b5){return function(_0x1b1dc1){if(_0x1b1dc1){return _0x1b1dc1[_0x3983('0x25')]()[_0x3983('0x24')](function(){var _0x6cd470=_0x1b1dc1[_0x3983('0x26')]({'plain':!![]});var _0x19070d='SmsQueues';return db[_0x3983('0x27')][_0x3983('0x25')]({'where':{'type':_0x19070d,'resourceId':_0x6cd470['id']}})[_0x3983('0x24')](function(){return _0x1b1dc1;});})[_0x3983('0x24')](function(){_0x54a44e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33adcd,_0x16554c){return function(_0x17b6b4){if(!_0x17b6b4){_0x33adcd[_0x3983('0x1b')](0x194);}return _0x17b6b4;};}function handleError(_0x5d3782,_0x26aed0){_0x26aed0=_0x26aed0||0x1f4;return function(_0x2214d1){logger[_0x3983('0x28')](_0x2214d1['stack']);if(_0x2214d1[_0x3983('0x29')]){delete _0x2214d1[_0x3983('0x29')];}_0x5d3782['status'](_0x26aed0)['send'](_0x2214d1);};}exports[_0x3983('0x2a')]=function(_0x18a311,_0x1eaa17){var _0x241ccd={},_0x3016d4={},_0x383afb={'count':0x0,'rows':[]};var _0x338638=db[_0x3983('0x2b')][_0x3983('0x2c')];_0x3016d4[_0x3983('0x2d')]=_[_0x3983('0x2e')](_0x338638);_0x3016d4[_0x3983('0x2f')]=_[_0x3983('0x2e')](_0x18a311[_0x3983('0x2f')]);_0x3016d4[_0x3983('0x30')]=_['intersection'](_0x3016d4[_0x3983('0x2d')],_0x3016d4[_0x3983('0x2f')]);_0x241ccd[_0x3983('0x31')]=_[_0x3983('0x32')](_0x3016d4[_0x3983('0x2d')],qs[_0x3983('0x33')](_0x18a311[_0x3983('0x2f')]['fields']));_0x241ccd['attributes']=_0x241ccd[_0x3983('0x31')][_0x3983('0x34')]?_0x241ccd[_0x3983('0x31')]:_0x3016d4[_0x3983('0x2d')];if(!_0x18a311[_0x3983('0x2f')][_0x3983('0x35')](_0x3983('0x36'))){_0x241ccd[_0x3983('0x1f')]=qs[_0x3983('0x1f')](_0x18a311['query'][_0x3983('0x1f')]);_0x241ccd['offset']=qs['offset'](_0x18a311[_0x3983('0x2f')][_0x3983('0x1e')]);}_0x241ccd[_0x3983('0x37')]=qs[_0x3983('0x38')](_0x18a311[_0x3983('0x2f')]['sort']);_0x241ccd['where']=qs[_0x3983('0x30')](_[_0x3983('0x39')](_0x18a311[_0x3983('0x2f')],_0x3016d4[_0x3983('0x30')]));if(_0x18a311[_0x3983('0x2f')][_0x3983('0x3a')]){_0x241ccd[_0x3983('0x3b')]=_['merge'](_0x241ccd[_0x3983('0x3b')],{'$or':_['map'](_0x338638,function(_0x38d52d){if(_0x38d52d[_0x3983('0x3c')][_0x3983('0x3d')]!=='VIRTUAL'){var _0x102bea={};_0x102bea[_0x38d52d['field']]={'$like':'%'+_0x18a311[_0x3983('0x2f')][_0x3983('0x3a')]+'%'};return _0x102bea;}})});}_0x241ccd=_['merge']({},_0x241ccd,_0x18a311[_0x3983('0x3e')]);var _0x1346eb={'where':_0x241ccd[_0x3983('0x3b')]};return db[_0x3983('0x2b')]['count'](_0x1346eb)['then'](function(_0x455ad7){_0x383afb[_0x3983('0x1d')]=_0x455ad7;if(_0x18a311[_0x3983('0x2f')]['includeAll']){_0x241ccd[_0x3983('0x3f')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x241ccd);})[_0x3983('0x24')](function(_0x345bd8){_0x383afb[_0x3983('0x40')]=_0x345bd8;return _0x383afb;})[_0x3983('0x24')](respondWithFilteredResult(_0x1eaa17,_0x241ccd))[_0x3983('0x41')](handleError(_0x1eaa17,null));};exports[_0x3983('0x42')]=function(_0x140eb7,_0x128588){var _0x2025da={'raw':!![],'where':{'id':_0x140eb7[_0x3983('0x43')]['id']}},_0x4c2bad={};_0x4c2bad[_0x3983('0x2d')]=_[_0x3983('0x2e')](db[_0x3983('0x2b')][_0x3983('0x2c')]);_0x4c2bad[_0x3983('0x2f')]=_['keys'](_0x140eb7[_0x3983('0x2f')]);_0x4c2bad[_0x3983('0x30')]=_[_0x3983('0x32')](_0x4c2bad[_0x3983('0x2d')],_0x4c2bad[_0x3983('0x2f')]);_0x2025da[_0x3983('0x31')]=_[_0x3983('0x32')](_0x4c2bad[_0x3983('0x2d')],qs[_0x3983('0x33')](_0x140eb7[_0x3983('0x2f')][_0x3983('0x33')]));_0x2025da[_0x3983('0x31')]=_0x2025da[_0x3983('0x31')][_0x3983('0x34')]?_0x2025da[_0x3983('0x31')]:_0x4c2bad['model'];if(_0x140eb7[_0x3983('0x2f')][_0x3983('0x44')]){_0x2025da[_0x3983('0x3f')]=[{'all':!![]}];}_0x2025da=_['merge']({},_0x2025da,_0x140eb7[_0x3983('0x3e')]);return db['SmsQueue'][_0x3983('0x45')](_0x2025da)[_0x3983('0x24')](handleEntityNotFound(_0x128588,null))[_0x3983('0x24')](respondWithResult(_0x128588,null))[_0x3983('0x41')](handleError(_0x128588,null));};exports[_0x3983('0x46')]=function(_0x308fbb,_0xd8de3){return db[_0x3983('0x2b')][_0x3983('0x46')](_0x308fbb[_0x3983('0x47')],{})[_0x3983('0x24')](function(_0x1076ce){var _0x97e6a7=_0x308fbb['user'][_0x3983('0x26')]({'plain':!![]});if(!_0x97e6a7)throw new Error(_0x3983('0x48'));if(_0x97e6a7[_0x3983('0x49')]===_0x3983('0x4a')){var _0x309896=_0x1076ce[_0x3983('0x26')]({'plain':!![]});var _0xae897a=_0x3983('0x4b');return db[_0x3983('0x4c')][_0x3983('0x45')]({'where':{'name':_0xae897a,'userProfileId':_0x97e6a7[_0x3983('0x4d')]},'raw':!![]})['then'](function(_0x46e02f){if(_0x46e02f&&_0x46e02f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x309896['name'],'resourceId':_0x309896['id'],'type':_0x46e02f[_0x3983('0x29')],'sectionId':_0x46e02f['id']},{})['then'](function(){return _0x1076ce;});}else{return _0x1076ce;}})[_0x3983('0x41')](function(_0x36b849){logger[_0x3983('0x28')](_0x3983('0x4e'),_0x36b849);throw _0x36b849;});}return _0x1076ce;})[_0x3983('0x24')](respondWithResult(_0xd8de3,0xc9))[_0x3983('0x41')](handleError(_0xd8de3,null));};exports[_0x3983('0x23')]=function(_0x19ef42,_0x242e8f){if(_0x19ef42[_0x3983('0x47')]['id']){delete _0x19ef42[_0x3983('0x47')]['id'];}return db[_0x3983('0x2b')][_0x3983('0x45')]({'where':{'id':_0x19ef42[_0x3983('0x43')]['id']}})['then'](handleEntityNotFound(_0x242e8f,null))['then'](saveUpdates(_0x19ef42[_0x3983('0x47')],null))[_0x3983('0x24')](respondWithResult(_0x242e8f,null))[_0x3983('0x41')](handleError(_0x242e8f,null));};exports[_0x3983('0x25')]=function(_0x272112,_0x5d2cf2){return db[_0x3983('0x2b')][_0x3983('0x45')]({'where':{'id':_0x272112[_0x3983('0x43')]['id']}})[_0x3983('0x24')](handleEntityNotFound(_0x5d2cf2,null))[_0x3983('0x24')](removeEntity(_0x5d2cf2,null))['catch'](handleError(_0x5d2cf2,null));};exports[_0x3983('0x4f')]=function(_0x4577df,_0x32707d){return db['SmsQueue']['describe']()[_0x3983('0x24')](respondWithResult(_0x32707d,null))[_0x3983('0x41')](handleError(_0x32707d,null));};exports[_0x3983('0x50')]=function(_0x568126,_0x1ce97e,_0x301180){var _0x3043ce={'raw':!![],'where':{}},_0x809212={},_0x26ace2;return db[_0x3983('0x2b')][_0x3983('0x51')]({'where':{'id':_0x568126['params']['id']}})[_0x3983('0x24')](handleEntityNotFound(_0x1ce97e,null))[_0x3983('0x24')](function(_0x4d94f4){if(_0x4d94f4){_0x26ace2=_0x4d94f4[_0x3983('0x26')]({'plain':!![]});_0x809212[_0x3983('0x2d')]=_[_0x3983('0x2e')](db[_0x3983('0x52')][_0x3983('0x2c')]);_0x809212[_0x3983('0x2f')]=_[_0x3983('0x2e')](_0x568126[_0x3983('0x2f')]);_0x809212['filters']=_[_0x3983('0x32')](_0x809212[_0x3983('0x2d')],_0x809212[_0x3983('0x2f')]);_0x3043ce[_0x3983('0x31')]=_['intersection'](_0x809212[_0x3983('0x2d')],qs[_0x3983('0x33')](_0x568126['query'][_0x3983('0x33')]));_0x3043ce['attributes']=_0x3043ce[_0x3983('0x31')][_0x3983('0x34')]?_0x3043ce[_0x3983('0x31')]:_0x809212[_0x3983('0x2d')];if(!_0x568126[_0x3983('0x2f')]['hasOwnProperty'](_0x3983('0x36'))){_0x3043ce[_0x3983('0x1f')]=qs[_0x3983('0x1f')](_0x568126[_0x3983('0x2f')]['limit']);_0x3043ce[_0x3983('0x1e')]=qs[_0x3983('0x1e')](_0x568126[_0x3983('0x2f')]['offset']);}_0x3043ce[_0x3983('0x37')]=qs['sort'](_0x568126[_0x3983('0x2f')]['sort']);_0x3043ce['where']=qs['filters'](_[_0x3983('0x39')](_0x568126[_0x3983('0x2f')],_0x809212[_0x3983('0x30')]));_0x3043ce[_0x3983('0x3b')]['SmsQueueId']=_0x4d94f4['id'];if(_0x568126[_0x3983('0x2f')]['filter']){_0x3043ce[_0x3983('0x3b')]=_[_0x3983('0x53')](_0x3043ce[_0x3983('0x3b')],{'$or':_[_0x3983('0x54')](_0x3043ce['attributes'],function(_0x3a653c){var _0x513cfd={};_0x513cfd[_0x3a653c]={'$like':'%'+_0x568126['query'][_0x3983('0x3a')]+'%'};return _0x513cfd;})});}_0x3043ce=_[_0x3983('0x53')]({},_0x3043ce,_0x568126[_0x3983('0x3e')]);return db['UserSmsQueue'][_0x3983('0x55')](_0x3043ce);}})[_0x3983('0x24')](function(_0xdf0520){if(_0xdf0520){return db[_0x3983('0x56')]['findAndCountAll']({'where':{'id':_[_0x3983('0x54')](_0xdf0520,_0x3983('0x57')),'role':_0x3983('0x58')},'attributes':['id',_0x3983('0x29'),'smsPause','updatedAt',_0x3983('0x59')]});}})[_0x3983('0x24')](function(_0x4ceac7){if(_0x4ceac7){return{'count':_0x4ceac7[_0x3983('0x1d')],'rows':_[_0x3983('0x54')](_0x4ceac7[_0x3983('0x40')],function(_0x4c3369){return{'membername':_0x4c3369[_0x3983('0x29')],'UserId':_0x4c3369['id'],'queue_name':_0x26ace2[_0x3983('0x29')],'SmsQueueId':_0x26ace2['id'],'interface':util[_0x3983('0x5a')]('%s/%s','SIP',_0x4c3369[_0x3983('0x29')]),'penalty':0x0,'paused':_0x4c3369[_0x3983('0x5b')],'createdAt':_0x4c3369[_0x3983('0x59')],'updatedAt':_0x4c3369[_0x3983('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3983('0x24')](respondWithFilteredResult(_0x1ce97e,_0x3043ce))[_0x3983('0x41')](handleError(_0x1ce97e,null));};exports[_0x3983('0x5d')]=function(_0x3d27e8,_0x926f46,_0x331429){var _0x9351a4={};var _0x453917={};var _0x2dc663;var _0x1c04c9;return db[_0x3983('0x2b')]['findOne']({'where':{'id':_0x3d27e8[_0x3983('0x43')]['id']}})[_0x3983('0x24')](handleEntityNotFound(_0x926f46,null))[_0x3983('0x24')](function(_0xde8566){if(_0xde8566){_0x2dc663=_0xde8566;_0x453917[_0x3983('0x2d')]=_[_0x3983('0x2e')](db[_0x3983('0x5e')][_0x3983('0x2c')]);_0x453917[_0x3983('0x2f')]=_[_0x3983('0x2e')](_0x3d27e8['query']);_0x453917[_0x3983('0x30')]=_[_0x3983('0x32')](_0x453917[_0x3983('0x2d')],_0x453917[_0x3983('0x2f')]);_0x9351a4[_0x3983('0x31')]=_[_0x3983('0x32')](_0x453917[_0x3983('0x2d')],qs[_0x3983('0x33')](_0x3d27e8[_0x3983('0x2f')][_0x3983('0x33')]));_0x9351a4[_0x3983('0x31')]=_0x9351a4[_0x3983('0x31')][_0x3983('0x34')]?_0x9351a4['attributes']:_0x453917['model'];_0x9351a4[_0x3983('0x37')]=qs[_0x3983('0x38')](_0x3d27e8[_0x3983('0x2f')][_0x3983('0x38')]);_0x9351a4[_0x3983('0x3b')]=qs[_0x3983('0x30')](_['pick'](_0x3d27e8[_0x3983('0x2f')],_0x453917[_0x3983('0x30')]));if(_0x3d27e8[_0x3983('0x2f')][_0x3983('0x3a')]){_0x9351a4[_0x3983('0x3b')]=_[_0x3983('0x53')](_0x9351a4[_0x3983('0x3b')],{'$or':_['map'](_0x9351a4[_0x3983('0x31')],function(_0x2b31ab){var _0x4e1c63={};_0x4e1c63[_0x2b31ab]={'$like':'%'+_0x3d27e8[_0x3983('0x2f')]['filter']+'%'};return _0x4e1c63;})});}_0x9351a4=_[_0x3983('0x53')]({},_0x9351a4,_0x3d27e8[_0x3983('0x3e')]);return _0x2dc663['getTeams'](_0x9351a4);}})['then'](function(_0x3463ca){if(_0x3463ca){_0x1c04c9=_0x3463ca[_0x3983('0x34')];if(!_0x3d27e8[_0x3983('0x2f')][_0x3983('0x35')](_0x3983('0x36'))){_0x9351a4[_0x3983('0x1f')]=qs[_0x3983('0x1f')](_0x3d27e8[_0x3983('0x2f')]['limit']);_0x9351a4['offset']=qs[_0x3983('0x1e')](_0x3d27e8[_0x3983('0x2f')][_0x3983('0x1e')]);}return _0x2dc663[_0x3983('0x5d')](_0x9351a4);}})[_0x3983('0x24')](function(_0x2ee4c0){if(_0x2ee4c0){return _0x2ee4c0?{'count':_0x1c04c9,'rows':_0x2ee4c0}:null;}})[_0x3983('0x24')](respondWithResult(_0x926f46,null))[_0x3983('0x41')](handleError(_0x926f46,null));};exports[_0x3983('0x5f')]=function(_0x4ae415,_0x1d2915,_0x4fe581){var _0xbe160f=[];var _0x144bb5;return db[_0x3983('0x5e')][_0x3983('0x55')]({'where':{'id':_0x4ae415[_0x3983('0x47')][_0x3983('0x60')]},'attributes':['id'],'include':[{'model':db[_0x3983('0x56')],'as':_0x3983('0x61'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x3d863d){if(_0x3d863d){for(var _0x31753b=0x0;_0x31753b<_0x3d863d[_0x3983('0x34')];_0x31753b+=0x1){for(var _0x273c45=0x0;_0x273c45<_0x3d863d[_0x31753b][_0x3983('0x61')][_0x3983('0x34')];_0x273c45+=0x1){_0xbe160f=_[_0x3983('0x62')](_0xbe160f,[_0x3d863d[_0x31753b][_0x3983('0x61')][_0x273c45]['id']]);}}return _0xbe160f;}})[_0x3983('0x24')](function(_0xe86854){if(_0xe86854){return db['SmsQueue']['find']({'where':{'id':_0x4ae415[_0x3983('0x43')]['id']}});}})[_0x3983('0x24')](function(_0x50321b){if(_0x50321b){_0x144bb5=_0x50321b;return _0x144bb5[_0x3983('0x63')](_0xbe160f,{'penalty':_0x4ae415['body'][_0x3983('0x64')]});}})[_0x3983('0x24')](function(_0x4023ed){if(_0x4023ed){return _0x144bb5['addTeams'](_0x4ae415[_0x3983('0x47')][_0x3983('0x60')]);}})[_0x3983('0x24')](handleEntityNotFound(_0x1d2915,null))[_0x3983('0x24')](respondWithStatusCode(_0x1d2915,null))[_0x3983('0x41')](handleError(_0x1d2915,null));};exports[_0x3983('0x65')]=function(_0x5959ad,_0x5b8e2d,_0x3f05d6){var _0x4169e9=[];var _0x4f62a8;return db[_0x3983('0x5e')]['findAll']({'where':{'id':_0x5959ad[_0x3983('0x2f')][_0x3983('0x60')]},'attributes':['id'],'include':[{'model':db[_0x3983('0x56')],'as':_0x3983('0x61'),'attributes':['id'],'raw':!![]}]})[_0x3983('0x24')](function(_0x5a6fcf){if(_0x5a6fcf){for(var _0x1b0ae1=0x0;_0x1b0ae1<_0x5a6fcf['length'];_0x1b0ae1+=0x1){for(var _0x131206=0x0;_0x131206<_0x5a6fcf[_0x1b0ae1]['Agents']['length'];_0x131206+=0x1){_0x4169e9=_['union'](_0x4169e9,[_0x5a6fcf[_0x1b0ae1]['Agents'][_0x131206]['id']]);}}return _0x4169e9;}})[_0x3983('0x24')](function(_0x1629c8){if(_0x1629c8){return db['SmsQueue'][_0x3983('0x45')]({'where':{'id':_0x5959ad[_0x3983('0x43')]['id']}});}})[_0x3983('0x24')](function(_0xae2fb3){if(_0xae2fb3){_0x4f62a8=_0xae2fb3;return _0x4f62a8[_0x3983('0x66')](_0x4169e9);}})[_0x3983('0x24')](function(_0x5ad718){if(_0x4f62a8){return _0x4f62a8['removeTeams'](_0x5959ad[_0x3983('0x2f')][_0x3983('0x60')]);}})['then'](handleEntityNotFound(_0x5b8e2d,null))[_0x3983('0x24')](respondWithStatusCode(_0x5b8e2d,null))['catch'](handleError(_0x5b8e2d,null));};exports[_0x3983('0x63')]=function(_0x2d0823,_0x2ea977,_0x710d5){return db[_0x3983('0x2b')][_0x3983('0x45')]({'where':{'id':_0x2d0823[_0x3983('0x43')]['id']}})[_0x3983('0x24')](handleEntityNotFound(_0x2ea977,null))[_0x3983('0x24')](function(_0x4cd8c0){if(_0x4cd8c0){return _0x4cd8c0[_0x3983('0x63')](_0x2d0823[_0x3983('0x47')][_0x3983('0x60')],_[_0x3983('0x67')](_0x2d0823['body'],[_0x3983('0x60'),'id'])||{})[_0x3983('0x68')](function(_0x1bab7c){for(var _0x28f41b=0x0;_0x28f41b<_0x2d0823[_0x3983('0x47')][_0x3983('0x60')][_0x3983('0x34')];_0x28f41b+=0x1){socket[_0x3983('0x69')]('userSmsQueue:save',{'UserId':_0x2d0823[_0x3983('0x47')][_0x3983('0x60')][_0x28f41b],'SmsQueueId':_0x2d0823['params']['id']});}return _0x1bab7c;});}})[_0x3983('0x24')](respondWithResult(_0x2ea977,null))[_0x3983('0x41')](handleError(_0x2ea977,null));};exports[_0x3983('0x66')]=function(_0x198fe9,_0x21cfea,_0x284ce5){var _0x4a5e1a;return db[_0x3983('0x2b')][_0x3983('0x45')]({'where':{'id':_0x198fe9['params']['id']}})[_0x3983('0x24')](handleEntityNotFound(_0x21cfea,null))['then'](function(_0x40f31f){if(_0x40f31f){return _0x40f31f['removeAgents'](_0x198fe9[_0x3983('0x2f')][_0x3983('0x60')])[_0x3983('0x24')](function(_0xcab681){if(_[_0x3983('0x6a')](_0x198fe9[_0x3983('0x2f')][_0x3983('0x60')])){for(var _0x43b673=0x0;_0x43b673<_0x198fe9[_0x3983('0x2f')][_0x3983('0x60')][_0x3983('0x34')];_0x43b673+=0x1){socket[_0x3983('0x69')](_0x3983('0x6b'),{'UserId':_0x198fe9[_0x3983('0x2f')][_0x3983('0x60')][_0x43b673],'SmsQueueId':_0x198fe9['params']['id']});}}else{socket[_0x3983('0x69')](_0x3983('0x6b'),{'UserId':_0x198fe9[_0x3983('0x2f')][_0x3983('0x60')],'SmsQueueId':_0x198fe9[_0x3983('0x43')]['id']});}});}})[_0x3983('0x24')](respondWithStatusCode(_0x21cfea,null))['catch'](handleError(_0x21cfea,null));};exports['getAgents']=function(_0x504a74,_0x395773,_0x2d2b95){var _0x5b65f0={};var _0x1dcaee={};var _0x801ed4;var _0x5d0394;return db['SmsQueue'][_0x3983('0x51')]({'where':{'id':_0x504a74[_0x3983('0x43')]['id']}})[_0x3983('0x24')](handleEntityNotFound(_0x395773,null))[_0x3983('0x24')](function(_0x20e391){if(_0x20e391){_0x801ed4=_0x20e391;_0x1dcaee[_0x3983('0x2d')]=_['keys'](db[_0x3983('0x56')][_0x3983('0x2c')]);_0x1dcaee['query']=_['keys'](_0x504a74[_0x3983('0x2f')]);_0x1dcaee['filters']=_[_0x3983('0x32')](_0x1dcaee[_0x3983('0x2d')],_0x1dcaee['query']);_0x5b65f0[_0x3983('0x31')]=_[_0x3983('0x32')](_0x1dcaee[_0x3983('0x2d')],qs[_0x3983('0x33')](_0x504a74[_0x3983('0x2f')][_0x3983('0x33')]));_0x5b65f0[_0x3983('0x31')]=_0x5b65f0['attributes'][_0x3983('0x34')]?_0x5b65f0[_0x3983('0x31')]:_0x1dcaee['model'];_0x5b65f0[_0x3983('0x37')]=qs['sort'](_0x504a74[_0x3983('0x2f')][_0x3983('0x38')]);_0x5b65f0['where']=qs[_0x3983('0x30')](_[_0x3983('0x39')](_0x504a74['query'],_0x1dcaee[_0x3983('0x30')]));if(_0x504a74[_0x3983('0x2f')]['filter']){_0x5b65f0[_0x3983('0x3b')]=_[_0x3983('0x53')](_0x5b65f0[_0x3983('0x3b')],{'$or':_['map'](_0x5b65f0[_0x3983('0x31')],function(_0x1cc4c6){var _0x5a0e49={};_0x5a0e49[_0x1cc4c6]={'$like':'%'+_0x504a74[_0x3983('0x2f')][_0x3983('0x3a')]+'%'};return _0x5a0e49;})});}_0x5b65f0=_[_0x3983('0x53')]({},_0x5b65f0,_0x504a74[_0x3983('0x3e')]);return _0x801ed4['getAgents'](_0x5b65f0);}})['then'](function(_0x77063e){if(_0x77063e){_0x5d0394=_0x77063e[_0x3983('0x34')];if(!_0x504a74['query']['hasOwnProperty'](_0x3983('0x36'))){_0x5b65f0[_0x3983('0x1f')]=qs[_0x3983('0x1f')](_0x504a74[_0x3983('0x2f')][_0x3983('0x1f')]);_0x5b65f0[_0x3983('0x1e')]=qs[_0x3983('0x1e')](_0x504a74['query'][_0x3983('0x1e')]);}return _0x801ed4[_0x3983('0x6c')](_0x5b65f0);}})[_0x3983('0x24')](function(_0x2ab84a){if(_0x2ab84a){return _0x2ab84a?{'count':_0x5d0394,'rows':_0x2ab84a}:null;}})[_0x3983('0x24')](respondWithResult(_0x395773,null))[_0x3983('0x41')](handleError(_0x395773,null));}; \ No newline at end of file +var _0x22b8=['filters','pick','filter','map','type','VIRTUAL','field','merge','includeAll','include','findAll','rows','catch','keys','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','update','body','params','describe','getMembers','UserSmsQueue','length','SmsQueueId','User','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','options','hasOwnProperty','addTeams','addAgents','penalty','ids','Agents','union','removeAgents','removeTeams','spread','emit','isArray','userSmsQueue:remove','getAgents','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','end','error','name','send','SmsQueue','query','model','attributes','intersection','fields','nolimit','limit','order','sort','where'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x22b8,0xab));var _0x822b=function(_0x5f2098,_0x47308b){_0x5f2098=_0x5f2098-0x0;var _0x18af32=_0x22b8[_0x5f2098];return _0x18af32;};'use strict';var pdf=require(_0x822b('0x0'));var emlformat=require(_0x822b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x822b('0x2'));var jsonpatch=require(_0x822b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x822b('0x4'));var Mustache=require(_0x822b('0x5'));var util=require('util');var path=require(_0x822b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x822b('0x7'));var fs=require('fs');var _=require(_0x822b('0x8'));var squel=require('squel');var crypto=require(_0x822b('0x9'));var jsforce=require(_0x822b('0xa'));var deskjs=require(_0x822b('0xb'));var toCsv=require(_0x822b('0xc'));var querystring=require(_0x822b('0xd'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x822b('0xe'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x822b('0xf'))(_0x822b('0x10'));var utils=require(_0x822b('0x11'));var config=require(_0x822b('0x12'));var db=require(_0x822b('0x13'))['db'];config[_0x822b('0x14')]=_['defaults'](config[_0x822b('0x14')],{'host':_0x822b('0x15'),'port':0x18eb});var socket=require(_0x822b('0x16'))(new Redis(config[_0x822b('0x14')]));require(_0x822b('0x17'))[_0x822b('0x18')](socket);function respondWithStatusCode(_0x4428bc,_0x3fffad){_0x3fffad=_0x3fffad||0xcc;return function(_0x3a478b){if(_0x3a478b){return _0x4428bc[_0x822b('0x19')](_0x3fffad);}return _0x4428bc[_0x822b('0x1a')](_0x3fffad)['end']();};}function respondWithResult(_0xfc436,_0x4818f2){_0x4818f2=_0x4818f2||0xc8;return function(_0xc3f9e5){if(_0xc3f9e5){return _0xfc436[_0x822b('0x1a')](_0x4818f2)['json'](_0xc3f9e5);}};}function respondWithFilteredResult(_0x374467,_0x7bc690){return function(_0xad419a){if(_0xad419a){var _0x36c475=_0xad419a[_0x822b('0x1b')],_0x41d67f=_0x7bc690[_0x822b('0x1c')],_0xe510cc=_0x7bc690[_0x822b('0x1c')]+_0x7bc690['limit'],_0x5735f0;if(_0xe510cc>=_0x36c475){_0xe510cc=_0x36c475;_0x5735f0=0xc8;}else{_0x5735f0=0xce;}_0x374467[_0x822b('0x1a')](_0x5735f0);return _0x374467[_0x822b('0x1d')](_0x822b('0x1e'),_0x41d67f+'-'+_0xe510cc+'/'+_0x36c475)[_0x822b('0x1f')](_0xad419a);}return null;};}function patchUpdates(_0x3bf6de){return function(_0xd71b5c){try{jsonpatch[_0x822b('0x20')](_0xd71b5c,_0x3bf6de,!![]);}catch(_0x2a0f73){return BPromise[_0x822b('0x21')](_0x2a0f73);}return _0xd71b5c[_0x822b('0x22')]();};}function saveUpdates(_0x31cd3c,_0x4be384){return function(_0x5b3523){if(_0x5b3523){return _0x5b3523['update'](_0x31cd3c)[_0x822b('0x23')](function(_0x245544){return _0x245544;});}return null;};}function removeEntity(_0x515acb,_0x4a2156){return function(_0x388406){if(_0x388406){return _0x388406[_0x822b('0x24')]()[_0x822b('0x23')](function(){var _0x23bf61=_0x388406[_0x822b('0x25')]({'plain':!![]});var _0x5d19be='SmsQueues';return db['UserProfileResource'][_0x822b('0x24')]({'where':{'type':_0x5d19be,'resourceId':_0x23bf61['id']}})[_0x822b('0x23')](function(){return _0x388406;});})[_0x822b('0x23')](function(){_0x515acb[_0x822b('0x1a')](0xcc)[_0x822b('0x26')]();});}};}function handleEntityNotFound(_0x4f2e4d,_0x4eef3b){return function(_0x2027be){if(!_0x2027be){_0x4f2e4d[_0x822b('0x19')](0x194);}return _0x2027be;};}function handleError(_0x416386,_0x4a06d5){_0x4a06d5=_0x4a06d5||0x1f4;return function(_0x59281d){logger[_0x822b('0x27')](_0x59281d['stack']);if(_0x59281d['name']){delete _0x59281d[_0x822b('0x28')];}_0x416386[_0x822b('0x1a')](_0x4a06d5)[_0x822b('0x29')](_0x59281d);};}exports['index']=function(_0x35cd33,_0x4aa312){var _0x522f2c={},_0x4a98a0={},_0x4cb0f9={'count':0x0,'rows':[]};var _0x29b359=db[_0x822b('0x2a')]['rawAttributes'];_0x4a98a0['model']=_['keys'](_0x29b359);_0x4a98a0[_0x822b('0x2b')]=_['keys'](_0x35cd33[_0x822b('0x2b')]);_0x4a98a0['filters']=_['intersection'](_0x4a98a0[_0x822b('0x2c')],_0x4a98a0['query']);_0x522f2c[_0x822b('0x2d')]=_[_0x822b('0x2e')](_0x4a98a0[_0x822b('0x2c')],qs[_0x822b('0x2f')](_0x35cd33[_0x822b('0x2b')][_0x822b('0x2f')]));_0x522f2c[_0x822b('0x2d')]=_0x522f2c[_0x822b('0x2d')]['length']?_0x522f2c[_0x822b('0x2d')]:_0x4a98a0[_0x822b('0x2c')];if(!_0x35cd33[_0x822b('0x2b')]['hasOwnProperty'](_0x822b('0x30'))){_0x522f2c[_0x822b('0x31')]=qs[_0x822b('0x31')](_0x35cd33[_0x822b('0x2b')][_0x822b('0x31')]);_0x522f2c[_0x822b('0x1c')]=qs['offset'](_0x35cd33[_0x822b('0x2b')][_0x822b('0x1c')]);}_0x522f2c[_0x822b('0x32')]=qs[_0x822b('0x33')](_0x35cd33[_0x822b('0x2b')][_0x822b('0x33')]);_0x522f2c[_0x822b('0x34')]=qs[_0x822b('0x35')](_[_0x822b('0x36')](_0x35cd33[_0x822b('0x2b')],_0x4a98a0['filters']));if(_0x35cd33[_0x822b('0x2b')][_0x822b('0x37')]){_0x522f2c[_0x822b('0x34')]=_['merge'](_0x522f2c[_0x822b('0x34')],{'$or':_[_0x822b('0x38')](_0x29b359,function(_0x343006){if(_0x343006[_0x822b('0x39')]['key']!==_0x822b('0x3a')){var _0x16ea32={};_0x16ea32[_0x343006[_0x822b('0x3b')]]={'$like':'%'+_0x35cd33[_0x822b('0x2b')][_0x822b('0x37')]+'%'};return _0x16ea32;}})});}_0x522f2c=_[_0x822b('0x3c')]({},_0x522f2c,_0x35cd33['options']);var _0x3d080d={'where':_0x522f2c['where']};return db[_0x822b('0x2a')][_0x822b('0x1b')](_0x3d080d)[_0x822b('0x23')](function(_0x32123c){_0x4cb0f9[_0x822b('0x1b')]=_0x32123c;if(_0x35cd33[_0x822b('0x2b')][_0x822b('0x3d')]){_0x522f2c[_0x822b('0x3e')]=[{'all':!![]}];}return db[_0x822b('0x2a')][_0x822b('0x3f')](_0x522f2c);})['then'](function(_0x2d1d4a){_0x4cb0f9[_0x822b('0x40')]=_0x2d1d4a;return _0x4cb0f9;})['then'](respondWithFilteredResult(_0x4aa312,_0x522f2c))[_0x822b('0x41')](handleError(_0x4aa312,null));};exports['show']=function(_0x1c9cdf,_0x207882){var _0xbd3c73={'raw':!![],'where':{'id':_0x1c9cdf['params']['id']}},_0x191d54={};_0x191d54[_0x822b('0x2c')]=_[_0x822b('0x42')](db[_0x822b('0x2a')][_0x822b('0x43')]);_0x191d54[_0x822b('0x2b')]=_[_0x822b('0x42')](_0x1c9cdf[_0x822b('0x2b')]);_0x191d54['filters']=_[_0x822b('0x2e')](_0x191d54['model'],_0x191d54[_0x822b('0x2b')]);_0xbd3c73['attributes']=_[_0x822b('0x2e')](_0x191d54[_0x822b('0x2c')],qs[_0x822b('0x2f')](_0x1c9cdf[_0x822b('0x2b')]['fields']));_0xbd3c73['attributes']=_0xbd3c73[_0x822b('0x2d')]['length']?_0xbd3c73['attributes']:_0x191d54[_0x822b('0x2c')];if(_0x1c9cdf[_0x822b('0x2b')]['includeAll']){_0xbd3c73['include']=[{'all':!![]}];}_0xbd3c73=_[_0x822b('0x3c')]({},_0xbd3c73,_0x1c9cdf['options']);return db[_0x822b('0x2a')]['find'](_0xbd3c73)['then'](handleEntityNotFound(_0x207882,null))[_0x822b('0x23')](respondWithResult(_0x207882,null))[_0x822b('0x41')](handleError(_0x207882,null));};exports[_0x822b('0x44')]=function(_0x2d58cd,_0x2fe8ce){return db['SmsQueue'][_0x822b('0x44')](_0x2d58cd['body'],{})[_0x822b('0x23')](function(_0x5425ec){var _0x3ba132=_0x2d58cd[_0x822b('0x45')][_0x822b('0x25')]({'plain':!![]});if(!_0x3ba132)throw new Error(_0x822b('0x46'));if(_0x3ba132[_0x822b('0x47')]===_0x822b('0x45')){var _0x3b750e=_0x5425ec[_0x822b('0x25')]({'plain':!![]});var _0x34572f=_0x822b('0x48');return db[_0x822b('0x49')][_0x822b('0x4a')]({'where':{'name':_0x34572f,'userProfileId':_0x3ba132[_0x822b('0x4b')]},'raw':!![]})[_0x822b('0x23')](function(_0x39f41f){if(_0x39f41f&&_0x39f41f[_0x822b('0x4c')]===0x0){return db[_0x822b('0x4d')][_0x822b('0x44')]({'name':_0x3b750e[_0x822b('0x28')],'resourceId':_0x3b750e['id'],'type':_0x39f41f[_0x822b('0x28')],'sectionId':_0x39f41f['id']},{})[_0x822b('0x23')](function(){return _0x5425ec;});}else{return _0x5425ec;}})[_0x822b('0x41')](function(_0xcf2edf){logger[_0x822b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcf2edf);throw _0xcf2edf;});}return _0x5425ec;})[_0x822b('0x23')](respondWithResult(_0x2fe8ce,0xc9))['catch'](handleError(_0x2fe8ce,null));};exports[_0x822b('0x4e')]=function(_0xd0ccb2,_0x2177ce){if(_0xd0ccb2['body']['id']){delete _0xd0ccb2[_0x822b('0x4f')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0xd0ccb2[_0x822b('0x50')]['id']}})[_0x822b('0x23')](handleEntityNotFound(_0x2177ce,null))['then'](saveUpdates(_0xd0ccb2['body'],null))[_0x822b('0x23')](respondWithResult(_0x2177ce,null))[_0x822b('0x41')](handleError(_0x2177ce,null));};exports['destroy']=function(_0x66df52,_0x26b193){return db['SmsQueue'][_0x822b('0x4a')]({'where':{'id':_0x66df52['params']['id']}})['then'](handleEntityNotFound(_0x26b193,null))[_0x822b('0x23')](removeEntity(_0x26b193,null))['catch'](handleError(_0x26b193,null));};exports[_0x822b('0x51')]=function(_0x263f0a,_0x88efe3){return db[_0x822b('0x2a')][_0x822b('0x51')]()[_0x822b('0x23')](respondWithResult(_0x88efe3,null))['catch'](handleError(_0x88efe3,null));};exports[_0x822b('0x52')]=function(_0x106aa2,_0x342367,_0x15bc0f){var _0x53dfd1={'raw':!![],'where':{}},_0x4cf854={},_0x3b001a;return db[_0x822b('0x2a')]['findOne']({'where':{'id':_0x106aa2['params']['id']}})[_0x822b('0x23')](handleEntityNotFound(_0x342367,null))[_0x822b('0x23')](function(_0x180518){if(_0x180518){_0x3b001a=_0x180518[_0x822b('0x25')]({'plain':!![]});_0x4cf854[_0x822b('0x2c')]=_[_0x822b('0x42')](db[_0x822b('0x53')][_0x822b('0x43')]);_0x4cf854[_0x822b('0x2b')]=_[_0x822b('0x42')](_0x106aa2[_0x822b('0x2b')]);_0x4cf854['filters']=_['intersection'](_0x4cf854[_0x822b('0x2c')],_0x4cf854[_0x822b('0x2b')]);_0x53dfd1[_0x822b('0x2d')]=_[_0x822b('0x2e')](_0x4cf854['model'],qs[_0x822b('0x2f')](_0x106aa2[_0x822b('0x2b')][_0x822b('0x2f')]));_0x53dfd1[_0x822b('0x2d')]=_0x53dfd1[_0x822b('0x2d')][_0x822b('0x54')]?_0x53dfd1[_0x822b('0x2d')]:_0x4cf854[_0x822b('0x2c')];if(!_0x106aa2[_0x822b('0x2b')]['hasOwnProperty']('nolimit')){_0x53dfd1[_0x822b('0x31')]=qs[_0x822b('0x31')](_0x106aa2['query'][_0x822b('0x31')]);_0x53dfd1[_0x822b('0x1c')]=qs[_0x822b('0x1c')](_0x106aa2[_0x822b('0x2b')][_0x822b('0x1c')]);}_0x53dfd1[_0x822b('0x32')]=qs[_0x822b('0x33')](_0x106aa2[_0x822b('0x2b')][_0x822b('0x33')]);_0x53dfd1[_0x822b('0x34')]=qs[_0x822b('0x35')](_['pick'](_0x106aa2['query'],_0x4cf854[_0x822b('0x35')]));_0x53dfd1['where'][_0x822b('0x55')]=_0x180518['id'];if(_0x106aa2[_0x822b('0x2b')][_0x822b('0x37')]){_0x53dfd1['where']=_[_0x822b('0x3c')](_0x53dfd1[_0x822b('0x34')],{'$or':_[_0x822b('0x38')](_0x53dfd1[_0x822b('0x2d')],function(_0x3653b0){var _0x40a7d8={};_0x40a7d8[_0x3653b0]={'$like':'%'+_0x106aa2[_0x822b('0x2b')][_0x822b('0x37')]+'%'};return _0x40a7d8;})});}_0x53dfd1=_[_0x822b('0x3c')]({},_0x53dfd1,_0x106aa2['options']);return db['UserSmsQueue'][_0x822b('0x3f')](_0x53dfd1);}})['then'](function(_0x292246){if(_0x292246){return db[_0x822b('0x56')]['findAndCountAll']({'where':{'id':_[_0x822b('0x38')](_0x292246,'UserId'),'role':_0x822b('0x57')},'attributes':['id',_0x822b('0x28'),_0x822b('0x58'),_0x822b('0x59'),_0x822b('0x5a')]});}})[_0x822b('0x23')](function(_0x4fb0c1){if(_0x4fb0c1){return{'count':_0x4fb0c1['count'],'rows':_['map'](_0x4fb0c1[_0x822b('0x40')],function(_0x20d69d){return{'membername':_0x20d69d[_0x822b('0x28')],'UserId':_0x20d69d['id'],'queue_name':_0x3b001a[_0x822b('0x28')],'SmsQueueId':_0x3b001a['id'],'interface':util[_0x822b('0x5b')](_0x822b('0x5c'),_0x822b('0x5d'),_0x20d69d[_0x822b('0x28')]),'penalty':0x0,'paused':_0x20d69d[_0x822b('0x58')],'createdAt':_0x20d69d['createdAt'],'updatedAt':_0x20d69d[_0x822b('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x822b('0x23')](respondWithFilteredResult(_0x342367,_0x53dfd1))[_0x822b('0x41')](handleError(_0x342367,null));};exports[_0x822b('0x5e')]=function(_0x41c580,_0x49cef5,_0x50e899){var _0x323d99={};var _0x30deb2={};var _0x4bdbef;var _0xe34764;return db['SmsQueue']['findOne']({'where':{'id':_0x41c580['params']['id']}})[_0x822b('0x23')](handleEntityNotFound(_0x49cef5,null))['then'](function(_0x43dd47){if(_0x43dd47){_0x4bdbef=_0x43dd47;_0x30deb2[_0x822b('0x2c')]=_[_0x822b('0x42')](db[_0x822b('0x5f')][_0x822b('0x43')]);_0x30deb2[_0x822b('0x2b')]=_[_0x822b('0x42')](_0x41c580[_0x822b('0x2b')]);_0x30deb2[_0x822b('0x35')]=_[_0x822b('0x2e')](_0x30deb2[_0x822b('0x2c')],_0x30deb2[_0x822b('0x2b')]);_0x323d99['attributes']=_[_0x822b('0x2e')](_0x30deb2[_0x822b('0x2c')],qs[_0x822b('0x2f')](_0x41c580[_0x822b('0x2b')][_0x822b('0x2f')]));_0x323d99[_0x822b('0x2d')]=_0x323d99[_0x822b('0x2d')]['length']?_0x323d99[_0x822b('0x2d')]:_0x30deb2[_0x822b('0x2c')];_0x323d99[_0x822b('0x32')]=qs['sort'](_0x41c580[_0x822b('0x2b')]['sort']);_0x323d99[_0x822b('0x34')]=qs['filters'](_[_0x822b('0x36')](_0x41c580[_0x822b('0x2b')],_0x30deb2[_0x822b('0x35')]));if(_0x41c580[_0x822b('0x2b')][_0x822b('0x37')]){_0x323d99[_0x822b('0x34')]=_[_0x822b('0x3c')](_0x323d99[_0x822b('0x34')],{'$or':_[_0x822b('0x38')](_0x323d99[_0x822b('0x2d')],function(_0xd02092){var _0x229c70={};_0x229c70[_0xd02092]={'$like':'%'+_0x41c580['query'][_0x822b('0x37')]+'%'};return _0x229c70;})});}_0x323d99=_[_0x822b('0x3c')]({},_0x323d99,_0x41c580[_0x822b('0x60')]);return _0x4bdbef[_0x822b('0x5e')](_0x323d99);}})[_0x822b('0x23')](function(_0x16926c){if(_0x16926c){_0xe34764=_0x16926c['length'];if(!_0x41c580['query'][_0x822b('0x61')](_0x822b('0x30'))){_0x323d99['limit']=qs[_0x822b('0x31')](_0x41c580['query'][_0x822b('0x31')]);_0x323d99['offset']=qs['offset'](_0x41c580[_0x822b('0x2b')]['offset']);}return _0x4bdbef[_0x822b('0x5e')](_0x323d99);}})[_0x822b('0x23')](function(_0x3694b9){if(_0x3694b9){return _0x3694b9?{'count':_0xe34764,'rows':_0x3694b9}:null;}})[_0x822b('0x23')](respondWithResult(_0x49cef5,null))[_0x822b('0x41')](handleError(_0x49cef5,null));};exports[_0x822b('0x62')]=function(_0x1a3f07,_0x170c0a,_0x594a9b){var _0x39189c=[];var _0x215661;return db['Team'][_0x822b('0x3f')]({'where':{'id':_0x1a3f07[_0x822b('0x4f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x822b('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x822b('0x23')](function(_0x3fb3d1){if(_0x3fb3d1){for(var _0x5383a9=0x0;_0x5383a9<_0x3fb3d1['length'];_0x5383a9+=0x1){for(var _0x5dd76d=0x0;_0x5dd76d<_0x3fb3d1[_0x5383a9]['Agents']['length'];_0x5dd76d+=0x1){_0x39189c=_['union'](_0x39189c,[_0x3fb3d1[_0x5383a9]['Agents'][_0x5dd76d]['id']]);}}return _0x39189c;}})[_0x822b('0x23')](function(_0x2ce142){if(_0x2ce142){return db[_0x822b('0x2a')][_0x822b('0x4a')]({'where':{'id':_0x1a3f07[_0x822b('0x50')]['id']}});}})['then'](function(_0x2d1b1b){if(_0x2d1b1b){_0x215661=_0x2d1b1b;return _0x215661[_0x822b('0x63')](_0x39189c,{'penalty':_0x1a3f07[_0x822b('0x4f')][_0x822b('0x64')]});}})[_0x822b('0x23')](function(_0x490c35){if(_0x490c35){return _0x215661[_0x822b('0x62')](_0x1a3f07[_0x822b('0x4f')][_0x822b('0x65')]);}})[_0x822b('0x23')](handleEntityNotFound(_0x170c0a,null))[_0x822b('0x23')](respondWithStatusCode(_0x170c0a,null))['catch'](handleError(_0x170c0a,null));};exports['removeTeams']=function(_0x4d493a,_0x3fe7a4,_0x3a8b1e){var _0x5dbedf=[];var _0x2e9f47;return db['Team'][_0x822b('0x3f')]({'where':{'id':_0x4d493a[_0x822b('0x2b')][_0x822b('0x65')]},'attributes':['id'],'include':[{'model':db[_0x822b('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x822b('0x23')](function(_0x6bffa0){if(_0x6bffa0){for(var _0x149f80=0x0;_0x149f80<_0x6bffa0[_0x822b('0x54')];_0x149f80+=0x1){for(var _0x5d0b7e=0x0;_0x5d0b7e<_0x6bffa0[_0x149f80][_0x822b('0x66')]['length'];_0x5d0b7e+=0x1){_0x5dbedf=_[_0x822b('0x67')](_0x5dbedf,[_0x6bffa0[_0x149f80][_0x822b('0x66')][_0x5d0b7e]['id']]);}}return _0x5dbedf;}})[_0x822b('0x23')](function(_0x1e4b15){if(_0x1e4b15){return db[_0x822b('0x2a')][_0x822b('0x4a')]({'where':{'id':_0x4d493a[_0x822b('0x50')]['id']}});}})[_0x822b('0x23')](function(_0x1a3663){if(_0x1a3663){_0x2e9f47=_0x1a3663;return _0x2e9f47[_0x822b('0x68')](_0x5dbedf);}})[_0x822b('0x23')](function(_0xfb1cc8){if(_0x2e9f47){return _0x2e9f47[_0x822b('0x69')](_0x4d493a['query'][_0x822b('0x65')]);}})['then'](handleEntityNotFound(_0x3fe7a4,null))[_0x822b('0x23')](respondWithStatusCode(_0x3fe7a4,null))['catch'](handleError(_0x3fe7a4,null));};exports[_0x822b('0x63')]=function(_0x537996,_0x702b63,_0x4f252d){return db['SmsQueue'][_0x822b('0x4a')]({'where':{'id':_0x537996[_0x822b('0x50')]['id']}})[_0x822b('0x23')](handleEntityNotFound(_0x702b63,null))[_0x822b('0x23')](function(_0x15370b){if(_0x15370b){return _0x15370b[_0x822b('0x63')](_0x537996[_0x822b('0x4f')][_0x822b('0x65')],_['omit'](_0x537996['body'],[_0x822b('0x65'),'id'])||{})[_0x822b('0x6a')](function(_0x584b2f){for(var _0x2c8351=0x0;_0x2c8351<_0x537996[_0x822b('0x4f')]['ids'][_0x822b('0x54')];_0x2c8351+=0x1){socket[_0x822b('0x6b')]('userSmsQueue:save',{'UserId':_0x537996[_0x822b('0x4f')][_0x822b('0x65')][_0x2c8351],'SmsQueueId':_0x537996['params']['id']});}return _0x584b2f;});}})[_0x822b('0x23')](respondWithResult(_0x702b63,null))['catch'](handleError(_0x702b63,null));};exports['removeAgents']=function(_0x919220,_0x5467ce,_0x4a9dc1){var _0x321d62;return db[_0x822b('0x2a')]['find']({'where':{'id':_0x919220['params']['id']}})[_0x822b('0x23')](handleEntityNotFound(_0x5467ce,null))[_0x822b('0x23')](function(_0x152353){if(_0x152353){return _0x152353[_0x822b('0x68')](_0x919220[_0x822b('0x2b')][_0x822b('0x65')])[_0x822b('0x23')](function(_0x452162){if(_[_0x822b('0x6c')](_0x919220[_0x822b('0x2b')]['ids'])){for(var _0x44512e=0x0;_0x44512e<_0x919220['query']['ids'][_0x822b('0x54')];_0x44512e+=0x1){socket[_0x822b('0x6b')](_0x822b('0x6d'),{'UserId':_0x919220['query'][_0x822b('0x65')][_0x44512e],'SmsQueueId':_0x919220[_0x822b('0x50')]['id']});}}else{socket[_0x822b('0x6b')](_0x822b('0x6d'),{'UserId':_0x919220[_0x822b('0x2b')]['ids'],'SmsQueueId':_0x919220[_0x822b('0x50')]['id']});}});}})[_0x822b('0x23')](respondWithStatusCode(_0x5467ce,null))[_0x822b('0x41')](handleError(_0x5467ce,null));};exports[_0x822b('0x6e')]=function(_0x497fef,_0x5796f7,_0x537e17){var _0x3b9d74={};var _0x1efaf0={};var _0x11b438;var _0x12488c;return db[_0x822b('0x2a')][_0x822b('0x6f')]({'where':{'id':_0x497fef['params']['id']}})['then'](handleEntityNotFound(_0x5796f7,null))[_0x822b('0x23')](function(_0x3b9a91){if(_0x3b9a91){_0x11b438=_0x3b9a91;_0x1efaf0['model']=_[_0x822b('0x42')](db[_0x822b('0x56')][_0x822b('0x43')]);_0x1efaf0[_0x822b('0x2b')]=_[_0x822b('0x42')](_0x497fef['query']);_0x1efaf0[_0x822b('0x35')]=_[_0x822b('0x2e')](_0x1efaf0[_0x822b('0x2c')],_0x1efaf0[_0x822b('0x2b')]);_0x3b9d74['attributes']=_[_0x822b('0x2e')](_0x1efaf0[_0x822b('0x2c')],qs['fields'](_0x497fef[_0x822b('0x2b')][_0x822b('0x2f')]));_0x3b9d74[_0x822b('0x2d')]=_0x3b9d74['attributes'][_0x822b('0x54')]?_0x3b9d74['attributes']:_0x1efaf0[_0x822b('0x2c')];_0x3b9d74[_0x822b('0x32')]=qs[_0x822b('0x33')](_0x497fef[_0x822b('0x2b')][_0x822b('0x33')]);_0x3b9d74[_0x822b('0x34')]=qs['filters'](_['pick'](_0x497fef['query'],_0x1efaf0[_0x822b('0x35')]));if(_0x497fef[_0x822b('0x2b')]['filter']){_0x3b9d74['where']=_['merge'](_0x3b9d74[_0x822b('0x34')],{'$or':_['map'](_0x3b9d74['attributes'],function(_0x5e4c46){var _0x31a09e={};_0x31a09e[_0x5e4c46]={'$like':'%'+_0x497fef[_0x822b('0x2b')][_0x822b('0x37')]+'%'};return _0x31a09e;})});}_0x3b9d74=_['merge']({},_0x3b9d74,_0x497fef[_0x822b('0x60')]);return _0x11b438[_0x822b('0x6e')](_0x3b9d74);}})['then'](function(_0x1bca7f){if(_0x1bca7f){_0x12488c=_0x1bca7f['length'];if(!_0x497fef['query']['hasOwnProperty'](_0x822b('0x30'))){_0x3b9d74[_0x822b('0x31')]=qs[_0x822b('0x31')](_0x497fef['query'][_0x822b('0x31')]);_0x3b9d74[_0x822b('0x1c')]=qs[_0x822b('0x1c')](_0x497fef[_0x822b('0x2b')][_0x822b('0x1c')]);}return _0x11b438['getAgents'](_0x3b9d74);}})[_0x822b('0x23')](function(_0x5a234c){if(_0x5a234c){return _0x5a234c?{'count':_0x12488c,'rows':_0x5a234c}:null;}})[_0x822b('0x23')](respondWithResult(_0x5796f7,null))['catch'](handleError(_0x5796f7,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 774ef78..08de9b5 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 _0xdf11=['hasOwnProperty','exports','../../mysqldb','SmsQueue','setMaxListeners','save','update','emit'];(function(_0x1d61de,_0x2a303d){var _0x446d8f=function(_0xee1c0d){while(--_0xee1c0d){_0x1d61de['push'](_0x1d61de['shift']());}};_0x446d8f(++_0x2a303d);}(_0xdf11,0xa2));var _0x1df1=function(_0x38e1c1,_0x4382bb){_0x38e1c1=_0x38e1c1-0x0;var _0xd472f7=_0xdf11[_0x38e1c1];return _0xd472f7;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x1df1('0x0'))['db'][_0x1df1('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1df1('0x2')](0x0);var events={'afterCreate':_0x1df1('0x3'),'afterUpdate':_0x1df1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1df212){return function(_0x42e4ef,_0xf9c82b,_0x276630){SmsQueueEvents[_0x1df1('0x5')](_0x1df212+':'+_0x42e4ef['id'],_0x42e4ef);SmsQueueEvents[_0x1df1('0x5')](_0x1df212,_0x42e4ef);_0x276630(null);};}for(var e in events){if(events[_0x1df1('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x1df1('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x5f8d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0x5f8d,0xf7));var _0xd5f8=function(_0xf19845,_0x50b9bf){_0xf19845=_0xf19845-0x0;var _0x49e934=_0x5f8d[_0xf19845];return _0x49e934;};'use strict';var EventEmitter=require(_0xd5f8('0x0'));var SmsQueue=require(_0xd5f8('0x1'))['db'][_0xd5f8('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd5f8('0x3')](0x0);var events={'afterCreate':_0xd5f8('0x4'),'afterUpdate':'update','afterDestroy':_0xd5f8('0x5')};function emitEvent(_0x239f2f){return function(_0x147d63,_0xa7b32c,_0xcde876){SmsQueueEvents[_0xd5f8('0x6')](_0x239f2f+':'+_0x147d63['id'],_0x147d63);SmsQueueEvents[_0xd5f8('0x6')](_0x239f2f,_0x147d63);_0xcde876(null);};}for(var e in events){if(events[_0xd5f8('0x7')](e)){var event=events[e];SmsQueue[_0xd5f8('0x8')](e,emitEvent(event));}}module[_0xd5f8('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index db0a2f9..7906132 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 _0xabff=['define','SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise','exports'];(function(_0x5504ee,_0x542928){var _0x1c985c=function(_0x5c4dd3){while(--_0x5c4dd3){_0x5504ee['push'](_0x5504ee['shift']());}};_0x1c985c(++_0x542928);}(_0xabff,0x143));var _0xfabf=function(_0x386394,_0x543996){_0x386394=_0x386394-0x0;var _0x4f8d51=_0xabff[_0x386394];return _0x4f8d51;};'use strict';var _=require(_0xfabf('0x0'));var util=require(_0xfabf('0x1'));var logger=require('../../config/logger')(_0xfabf('0x2'));var moment=require(_0xfabf('0x3'));var BPromise=require(_0xfabf('0x4'));var rp=require(_0xfabf('0x5'));var attributes=require('./smsQueue.attributes');module[_0xfabf('0x6')]=function(_0x1e8b43,_0x56f3fb){return _0x1e8b43[_0xfabf('0x7')](_0xfabf('0x8'),attributes,{'tableName':_0xfabf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cb2=['./smsQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x53c04e,_0x441911){var _0x273722=function(_0x476739){while(--_0x476739){_0x53c04e['push'](_0x53c04e['shift']());}};_0x273722(++_0x441911);}(_0x2cb2,0x162));var _0x22cb=function(_0x5b29e1,_0x2ed6a4){_0x5b29e1=_0x5b29e1-0x0;var _0x4314b2=_0x2cb2[_0x5b29e1];return _0x4314b2;};'use strict';var _=require(_0x22cb('0x0'));var util=require(_0x22cb('0x1'));var logger=require(_0x22cb('0x2'))(_0x22cb('0x3'));var moment=require(_0x22cb('0x4'));var BPromise=require('bluebird');var rp=require(_0x22cb('0x5'));var attributes=require(_0x22cb('0x6'));module[_0x22cb('0x7')]=function(_0x37c1c0,_0x36d974){return _0x37c1c0[_0x22cb('0x8')]('SmsQueue',attributes,{'tableName':'sms_queues','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 6e896ca..191f06d 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 _0x0ccc=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsQueue.socket','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','SmsQueue','findAll','options','where','attributes','limit','include','model','GetSmsQueue','stringify','find','map','ShowSmsQueue','lodash','moment','randomstring','../../config/utils'];(function(_0x48764f,_0x580d9b){var _0x38df9c=function(_0x18bc8a){while(--_0x18bc8a){_0x48764f['push'](_0x48764f['shift']());}};_0x38df9c(++_0x580d9b);}(_0x0ccc,0x90));var _0xc0cc=function(_0x489334,_0x2ee06f){_0x489334=_0x489334-0x0;var _0x1aaf51=_0x0ccc[_0x489334];return _0x1aaf51;};'use strict';var _=require(_0xc0cc('0x0'));var util=require('util');var moment=require(_0xc0cc('0x1'));var BPromise=require('bluebird');var rs=require(_0xc0cc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc0cc('0x3'));var logger=require(_0xc0cc('0x4'))(_0xc0cc('0x5'));var config=require(_0xc0cc('0x6'));var jayson=require(_0xc0cc('0x7'));var client=jayson[_0xc0cc('0x8')][_0xc0cc('0x9')]({'port':0x232a});config['redis']=_[_0xc0cc('0xa')](config[_0xc0cc('0xb')],{'host':_0xc0cc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc0cc('0xd'))['register'](socket);function respondWithRpcPromise(_0x346246,_0x60ea84,_0x29782a){return new BPromise(function(_0x1ee24d,_0x1750e8){return client[_0xc0cc('0xe')](_0x346246,_0x29782a)[_0xc0cc('0xf')](function(_0x4b472b){logger['info'](_0xc0cc('0x10'),_0x60ea84,_0xc0cc('0x11'));logger[_0xc0cc('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x60ea84,'request\x20sent',JSON['stringify'](_0x4b472b));if(_0x4b472b[_0xc0cc('0x13')]){if(_0x4b472b['error'][_0xc0cc('0x14')]===0x1f4){logger[_0xc0cc('0x13')]('SmsQueue,\x20%s,\x20%s',_0x60ea84,_0x4b472b[_0xc0cc('0x13')]['message']);return _0x1750e8(_0x4b472b[_0xc0cc('0x13')][_0xc0cc('0x15')]);}logger['error'](_0xc0cc('0x10'),_0x60ea84,_0x4b472b[_0xc0cc('0x13')][_0xc0cc('0x15')]);return _0x1ee24d(_0x4b472b[_0xc0cc('0x13')]['message']);}else{logger[_0xc0cc('0x16')](_0xc0cc('0x10'),_0x60ea84,_0xc0cc('0x11'));_0x1ee24d(_0x4b472b['result'][_0xc0cc('0x15')]);}})[_0xc0cc('0x17')](function(_0xebf45f){logger['error'](_0xc0cc('0x10'),_0x60ea84,_0xebf45f);_0x1750e8(_0xebf45f);});});}exports['GetSmsQueue']=function(_0x19f6fd){var _0x12fa7e=this;return new Promise(function(_0x36af22,_0x2a7a84){return db[_0xc0cc('0x18')][_0xc0cc('0x19')]({'raw':_0x19f6fd['options']?_0x19f6fd[_0xc0cc('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x19f6fd[_0xc0cc('0x1a')]?_0x19f6fd[_0xc0cc('0x1a')][_0xc0cc('0x1b')]||null:null,'attributes':_0x19f6fd[_0xc0cc('0x1a')]?_0x19f6fd[_0xc0cc('0x1a')][_0xc0cc('0x1c')]||null:null,'limit':_0x19f6fd[_0xc0cc('0x1a')]?_0x19f6fd[_0xc0cc('0x1a')][_0xc0cc('0x1d')]||null:null,'include':_0x19f6fd[_0xc0cc('0x1a')]?_0x19f6fd['options'][_0xc0cc('0x1e')]?_['map'](_0x19f6fd[_0xc0cc('0x1a')]['include'],function(_0x357ed3){return{'model':db[_0x357ed3['model']],'as':_0x357ed3['as'],'attributes':_0x357ed3['attributes'],'include':_0x357ed3[_0xc0cc('0x1e')]?_['map'](_0x357ed3[_0xc0cc('0x1e')],function(_0x260334){return{'model':db[_0x260334[_0xc0cc('0x1f')]],'as':_0x260334['as'],'attributes':_0x260334['attributes'],'include':_0x260334[_0xc0cc('0x1e')]?_['map'](_0x260334[_0xc0cc('0x1e')],function(_0x479f80){return{'model':db[_0x479f80[_0xc0cc('0x1f')]],'as':_0x479f80['as'],'attributes':_0x479f80[_0xc0cc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc0cc('0xf')](function(_0x48f707){logger[_0xc0cc('0x16')](_0xc0cc('0x20'),_0x19f6fd);logger[_0xc0cc('0x12')](_0xc0cc('0x20'),_0x19f6fd,JSON[_0xc0cc('0x21')](_0x48f707));_0x36af22(_0x48f707);})[_0xc0cc('0x17')](function(_0x1651f9){logger[_0xc0cc('0x13')](_0xc0cc('0x20'),_0x1651f9[_0xc0cc('0x15')],_0x19f6fd);_0x2a7a84(_0x12fa7e['error'](0x1f4,_0x1651f9[_0xc0cc('0x15')]));});});};exports['ShowSmsQueue']=function(_0x9b45a){var _0x12a0a6=this;return new Promise(function(_0x51a3ff,_0x2900ef){return db['SmsQueue'][_0xc0cc('0x22')]({'raw':_0x9b45a[_0xc0cc('0x1a')]?_0x9b45a[_0xc0cc('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x9b45a[_0xc0cc('0x1a')]?_0x9b45a[_0xc0cc('0x1a')][_0xc0cc('0x1b')]||null:null,'attributes':_0x9b45a[_0xc0cc('0x1a')]?_0x9b45a['options'][_0xc0cc('0x1c')]||null:null,'include':_0x9b45a[_0xc0cc('0x1a')]?_0x9b45a[_0xc0cc('0x1a')][_0xc0cc('0x1e')]?_['map'](_0x9b45a[_0xc0cc('0x1a')][_0xc0cc('0x1e')],function(_0x4a55cf){return{'model':db[_0x4a55cf['model']],'as':_0x4a55cf['as'],'attributes':_0x4a55cf[_0xc0cc('0x1c')],'include':_0x4a55cf[_0xc0cc('0x1e')]?_[_0xc0cc('0x23')](_0x4a55cf[_0xc0cc('0x1e')],function(_0x162f32){return{'model':db[_0x162f32[_0xc0cc('0x1f')]],'as':_0x162f32['as'],'attributes':_0x162f32[_0xc0cc('0x1c')],'include':_0x162f32[_0xc0cc('0x1e')]?_[_0xc0cc('0x23')](_0x162f32['include'],function(_0x56a8c2){return{'model':db[_0x56a8c2[_0xc0cc('0x1f')]],'as':_0x56a8c2['as'],'attributes':_0x56a8c2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x20cc49){logger['info'](_0xc0cc('0x24'),_0x9b45a);logger['debug'](_0xc0cc('0x24'),_0x9b45a,JSON[_0xc0cc('0x21')](_0x20cc49));_0x51a3ff(_0x20cc49);})[_0xc0cc('0x17')](function(_0x1221a3){logger['error'](_0xc0cc('0x24'),_0x1221a3['message'],_0x9b45a);_0x2900ef(_0x12a0a6[_0xc0cc('0x13')](0x1f4,_0x1221a3[_0xc0cc('0x15')]));});});}; \ No newline at end of file +var _0x85d8=['rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','GetSmsQueue','SmsQueue','options','raw','where','limit','include','map','model','attributes','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xfc0206,_0x4df746){var _0x9d03c3=function(_0x345aa5){while(--_0x345aa5){_0xfc0206['push'](_0xfc0206['shift']());}};_0x9d03c3(++_0x4df746);}(_0x85d8,0x1b0));var _0x885d=function(_0x179d07,_0x38411f){_0x179d07=_0x179d07-0x0;var _0x122aad=_0x85d8[_0x179d07];return _0x122aad;};'use strict';var _=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var moment=require(_0x885d('0x2'));var BPromise=require(_0x885d('0x3'));var rs=require(_0x885d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x885d('0x5'))['db'];var utils=require(_0x885d('0x6'));var logger=require(_0x885d('0x7'))(_0x885d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x885d('0x9')][_0x885d('0xa')]({'port':0x232a});config[_0x885d('0xb')]=_[_0x885d('0xc')](config[_0x885d('0xb')],{'host':_0x885d('0xd'),'port':0x18eb});var socket=require(_0x885d('0xe'))(new Redis(config[_0x885d('0xb')]));require(_0x885d('0xf'))[_0x885d('0x10')](socket);function respondWithRpcPromise(_0x11e4e7,_0x125db6,_0x3ce28f){return new BPromise(function(_0x1e5761,_0x19c903){return client[_0x885d('0x11')](_0x11e4e7,_0x3ce28f)[_0x885d('0x12')](function(_0x2c680b){logger[_0x885d('0x13')]('SmsQueue,\x20%s,\x20%s',_0x125db6,'request\x20sent');logger[_0x885d('0x14')](_0x885d('0x15'),_0x125db6,'request\x20sent',JSON[_0x885d('0x16')](_0x2c680b));if(_0x2c680b[_0x885d('0x17')]){if(_0x2c680b['error']['code']===0x1f4){logger[_0x885d('0x17')](_0x885d('0x18'),_0x125db6,_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);return _0x19c903(_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x125db6,_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);return _0x1e5761(_0x2c680b[_0x885d('0x17')][_0x885d('0x19')]);}else{logger[_0x885d('0x13')](_0x885d('0x18'),_0x125db6,_0x885d('0x1a'));_0x1e5761(_0x2c680b[_0x885d('0x1b')]['message']);}})[_0x885d('0x1c')](function(_0x35dfcc){logger[_0x885d('0x17')](_0x885d('0x18'),_0x125db6,_0x35dfcc);_0x19c903(_0x35dfcc);});});}exports[_0x885d('0x1d')]=function(_0x5a72b8){var _0x1326a9=this;return new Promise(function(_0xb1c8de,_0x55738d){return db[_0x885d('0x1e')]['findAll']({'raw':_0x5a72b8[_0x885d('0x1f')]?_0x5a72b8[_0x885d('0x1f')][_0x885d('0x20')]===undefined?!![]:![]:!![],'where':_0x5a72b8[_0x885d('0x1f')]?_0x5a72b8[_0x885d('0x1f')][_0x885d('0x21')]||null:null,'attributes':_0x5a72b8[_0x885d('0x1f')]?_0x5a72b8[_0x885d('0x1f')]['attributes']||null:null,'limit':_0x5a72b8[_0x885d('0x1f')]?_0x5a72b8[_0x885d('0x1f')][_0x885d('0x22')]||null:null,'include':_0x5a72b8['options']?_0x5a72b8[_0x885d('0x1f')][_0x885d('0x23')]?_[_0x885d('0x24')](_0x5a72b8[_0x885d('0x1f')][_0x885d('0x23')],function(_0x3f0955){return{'model':db[_0x3f0955[_0x885d('0x25')]],'as':_0x3f0955['as'],'attributes':_0x3f0955[_0x885d('0x26')],'include':_0x3f0955[_0x885d('0x23')]?_['map'](_0x3f0955['include'],function(_0x13948c){return{'model':db[_0x13948c['model']],'as':_0x13948c['as'],'attributes':_0x13948c[_0x885d('0x26')],'include':_0x13948c[_0x885d('0x23')]?_[_0x885d('0x24')](_0x13948c[_0x885d('0x23')],function(_0x16f4c1){return{'model':db[_0x16f4c1[_0x885d('0x25')]],'as':_0x16f4c1['as'],'attributes':_0x16f4c1['attributes']};}):[]};}):[]};}):[]:[]})[_0x885d('0x12')](function(_0x3b139b){logger['info'](_0x885d('0x1d'),_0x5a72b8);logger['debug']('GetSmsQueue',_0x5a72b8,JSON[_0x885d('0x16')](_0x3b139b));_0xb1c8de(_0x3b139b);})['catch'](function(_0x3baf94){logger[_0x885d('0x17')](_0x885d('0x1d'),_0x3baf94[_0x885d('0x19')],_0x5a72b8);_0x55738d(_0x1326a9[_0x885d('0x17')](0x1f4,_0x3baf94[_0x885d('0x19')]));});});};exports['ShowSmsQueue']=function(_0x3347da){var _0x197c27=this;return new Promise(function(_0x3aab64,_0x151fb7){return db[_0x885d('0x1e')]['find']({'raw':_0x3347da[_0x885d('0x1f')]?_0x3347da[_0x885d('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3347da[_0x885d('0x1f')]?_0x3347da[_0x885d('0x1f')][_0x885d('0x21')]||null:null,'attributes':_0x3347da[_0x885d('0x1f')]?_0x3347da[_0x885d('0x1f')][_0x885d('0x26')]||null:null,'include':_0x3347da[_0x885d('0x1f')]?_0x3347da[_0x885d('0x1f')]['include']?_['map'](_0x3347da['options']['include'],function(_0x3d6ce7){return{'model':db[_0x3d6ce7[_0x885d('0x25')]],'as':_0x3d6ce7['as'],'attributes':_0x3d6ce7['attributes'],'include':_0x3d6ce7[_0x885d('0x23')]?_['map'](_0x3d6ce7[_0x885d('0x23')],function(_0x37e541){return{'model':db[_0x37e541[_0x885d('0x25')]],'as':_0x37e541['as'],'attributes':_0x37e541[_0x885d('0x26')],'include':_0x37e541[_0x885d('0x23')]?_[_0x885d('0x24')](_0x37e541[_0x885d('0x23')],function(_0x4ee55d){return{'model':db[_0x4ee55d['model']],'as':_0x4ee55d['as'],'attributes':_0x4ee55d[_0x885d('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xca172e){logger['info']('ShowSmsQueue',_0x3347da);logger[_0x885d('0x14')](_0x885d('0x27'),_0x3347da,JSON[_0x885d('0x16')](_0xca172e));_0x3aab64(_0xca172e);})[_0x885d('0x1c')](function(_0x3e2c0a){logger[_0x885d('0x17')](_0x885d('0x27'),_0x3e2c0a[_0x885d('0x19')],_0x3347da);_0x151fb7(_0x197c27[_0x885d('0x17')](0x1f4,_0x3e2c0a[_0x885d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9ac1d3f..5f04a5d 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 _0x6934=['save','remove','update','emit','register','length','smsQueue:','./smsQueue.events'];(function(_0x442576,_0xe45a1b){var _0x580877=function(_0x346366){while(--_0x346366){_0x442576['push'](_0x442576['shift']());}};_0x580877(++_0xe45a1b);}(_0x6934,0x17f));var _0x4693=function(_0x4acc32,_0x108507){_0x4acc32=_0x4acc32-0x0;var _0x29c7ee=_0x6934[_0x4acc32];return _0x29c7ee;};'use strict';var SmsQueueEvents=require(_0x4693('0x0'));var events=[_0x4693('0x1'),_0x4693('0x2'),_0x4693('0x3')];function createListener(_0x438c15,_0x5940cd){return function(_0x1bc798){_0x5940cd[_0x4693('0x4')](_0x438c15,_0x1bc798);};}function removeListener(_0x2812a9,_0x2cc753){return function(){SmsQueueEvents['removeListener'](_0x2812a9,_0x2cc753);};}exports[_0x4693('0x5')]=function(_0x19e7d1){for(var _0x344c63=0x0,_0x9f08b0=events[_0x4693('0x6')];_0x344c63<_0x9f08b0;_0x344c63++){var _0x389ea6=events[_0x344c63];var _0x259149=createListener(_0x4693('0x7')+_0x389ea6,_0x19e7d1);SmsQueueEvents['on'](_0x389ea6,_0x259149);}}; \ No newline at end of file +var _0xa2c8=['register','length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x55e649,_0x3263af){var _0x1319f0=function(_0x5eba06){while(--_0x5eba06){_0x55e649['push'](_0x55e649['shift']());}};_0x1319f0(++_0x3263af);}(_0xa2c8,0x81));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var SmsQueueEvents=require(_0x8a2c('0x0'));var events=[_0x8a2c('0x1'),_0x8a2c('0x2'),_0x8a2c('0x3')];function createListener(_0x585bf1,_0x3c458b){return function(_0x4952ce){_0x3c458b[_0x8a2c('0x4')](_0x585bf1,_0x4952ce);};}function removeListener(_0x443df3,_0x1ebdd9){return function(){SmsQueueEvents[_0x8a2c('0x5')](_0x443df3,_0x1ebdd9);};}exports[_0x8a2c('0x6')]=function(_0x161ae4){for(var _0x47cace=0x0,_0x3481c4=events[_0x8a2c('0x7')];_0x47cace<_0x3481c4;_0x47cace++){var _0x4688af=events[_0x47cace];var _0x589f71=createListener(_0x8a2c('0x8')+_0x4688af,_0x161ae4);SmsQueueEvents['on'](_0x4688af,_0x589f71);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 096dbd3..f8b92a9 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 _0x446c=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','index','get','describe','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x1213e5,_0x281e61){var _0x59a452=function(_0x32781f){while(--_0x32781f){_0x1213e5['push'](_0x1213e5['shift']());}};_0x59a452(++_0x281e61);}(_0x446c,0x156));var _0xc446=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0x446c[_0x32729c];return _0x482cfd;};'use strict';var multer=require(_0xc446('0x0'));var util=require(_0xc446('0x1'));var path=require(_0xc446('0x2'));var timeout=require(_0xc446('0x3'));var express=require('express');var router=express[_0xc446('0x4')]();var auth=require(_0xc446('0x5'));var interaction=require(_0xc446('0x6'));var config=require('../../config/environment');var controller=require(_0xc446('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc446('0x8')]);router[_0xc446('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc446('0xa')]);router[_0xc446('0x9')](_0xc446('0xb'),auth[_0xc446('0xc')](),controller[_0xc446('0xd')]);router['post']('/',auth[_0xc446('0xc')](),controller[_0xc446('0xe')]);router[_0xc446('0xf')](_0xc446('0xb'),auth['isAuthenticated'](),controller[_0xc446('0x10')]);router[_0xc446('0x11')](_0xc446('0xb'),auth[_0xc446('0xc')](),controller[_0xc446('0x12')]);module[_0xc446('0x13')]=router; \ No newline at end of file +var _0xd0c9=['isAuthenticated','describe','get','/:id','post','create','put','update','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','index','/describe'];(function(_0x1bb29c,_0x297df2){var _0x7262c6=function(_0x53057e){while(--_0x53057e){_0x1bb29c['push'](_0x1bb29c['shift']());}};_0x7262c6(++_0x297df2);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xd0c9[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0x9d0c('0x0'));var util=require(_0x9d0c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9d0c('0x2')]();var auth=require(_0x9d0c('0x3'));var interaction=require(_0x9d0c('0x4'));var config=require('../../config/environment');var controller=require(_0x9d0c('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x9d0c('0x6')]);router['get'](_0x9d0c('0x7'),auth[_0x9d0c('0x8')](),controller[_0x9d0c('0x9')]);router[_0x9d0c('0xa')](_0x9d0c('0xb'),auth[_0x9d0c('0x8')](),controller['show']);router[_0x9d0c('0xc')]('/',auth['isAuthenticated'](),controller[_0x9d0c('0xd')]);router[_0x9d0c('0xe')](_0x9d0c('0xb'),auth['isAuthenticated'](),controller[_0x9d0c('0xf')]);router[_0x9d0c('0x10')](_0x9d0c('0xb'),auth[_0x9d0c('0x8')](),controller['destroy']);module[_0x9d0c('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index fed9e97..5065f49 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 _0x8410=['STRING','DATE','moment','exports'];(function(_0x270fdd,_0x344deb){var _0x2b1455=function(_0x316ec4){while(--_0x316ec4){_0x270fdd['push'](_0x270fdd['shift']());}};_0x2b1455(++_0x344deb);}(_0x8410,0x1ca));var _0x0841=function(_0x10a259,_0x42db7d){_0x10a259=_0x10a259-0x0;var _0x296ccc=_0x8410[_0x10a259];return _0x296ccc;};'use strict';var moment=require(_0x0841('0x0'));var Sequelize=require('sequelize');module[_0x0841('0x1')]={'uniqueid':{'type':Sequelize[_0x0841('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0841('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0841('0x3')]},'acceptAt':{'type':Sequelize[_0x0841('0x3')]},'exitAt':{'type':Sequelize[_0x0841('0x3')]},'reason':{'type':Sequelize[_0x0841('0x2')]}}; \ No newline at end of file +var _0x68eb=['DATE','exports','STRING'];(function(_0x125b16,_0x1058f8){var _0x45d2a4=function(_0x5b8a9c){while(--_0x5b8a9c){_0x125b16['push'](_0x125b16['shift']());}};_0x45d2a4(++_0x1058f8);}(_0x68eb,0x196));var _0xb68e=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x68eb[_0x16dbcd];return _0x34706e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xb68e('0x0')]={'uniqueid':{'type':Sequelize[_0xb68e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xb68e('0x1')]},'joinAt':{'type':Sequelize[_0xb68e('0x2')]},'leaveAt':{'type':Sequelize[_0xb68e('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb68e('0x2')]},'reason':{'type':Sequelize[_0xb68e('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 679e165..59191e8 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 _0x7a54=['destroy','sendStatus','error','name','send','index','SmsQueueReport','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then'];(function(_0x3d332d,_0x86e9fe){var _0x5bb097=function(_0x142503){while(--_0x142503){_0x3d332d['push'](_0x3d332d['shift']());}};_0x5bb097(++_0x86e9fe);}(_0x7a54,0x14e));var _0x47a5=function(_0x176698,_0x595e95){_0x176698=_0x176698-0x0;var _0x1e744f=_0x7a54[_0x176698];return _0x1e744f;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require(_0x47a5('0x5'));var BPromise=require(_0x47a5('0x6'));var Mustache=require(_0x47a5('0x7'));var util=require(_0x47a5('0x8'));var path=require(_0x47a5('0x9'));var sox=require('sox');var csv=require(_0x47a5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x47a5('0xb'));var squel=require(_0x47a5('0xc'));var crypto=require('crypto');var jsforce=require(_0x47a5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x47a5('0xa'));var querystring=require(_0x47a5('0xe'));var Papa=require(_0x47a5('0xf'));var authService=require(_0x47a5('0x10'));var hardwareService=require(_0x47a5('0x11'));var Redis=require(_0x47a5('0x12'));var qs=require(_0x47a5('0x13'));var logger=require(_0x47a5('0x14'))(_0x47a5('0x15'));var utils=require('../../config/utils');var config=require(_0x47a5('0x16'));var db=require(_0x47a5('0x17'))['db'];function respondWithStatusCode(_0x386a2e,_0x2edd62){_0x2edd62=_0x2edd62||0xcc;return function(_0x147a09){if(_0x147a09){return _0x386a2e['sendStatus'](_0x2edd62);}return _0x386a2e[_0x47a5('0x18')](_0x2edd62)[_0x47a5('0x19')]();};}function respondWithResult(_0x3bdb36,_0x113cee){_0x113cee=_0x113cee||0xc8;return function(_0x49fb28){if(_0x49fb28){return _0x3bdb36[_0x47a5('0x18')](_0x113cee)[_0x47a5('0x1a')](_0x49fb28);}};}function respondWithFilteredResult(_0x2c1d37,_0x84234c){return function(_0x1a1596){if(_0x1a1596){var _0x334b8d=_0x1a1596[_0x47a5('0x1b')],_0x139804=_0x84234c['offset'],_0x415ca3=_0x84234c[_0x47a5('0x1c')]+_0x84234c[_0x47a5('0x1d')],_0x5eeaf7;if(_0x415ca3>=_0x334b8d){_0x415ca3=_0x334b8d;_0x5eeaf7=0xc8;}else{_0x5eeaf7=0xce;}_0x2c1d37['status'](_0x5eeaf7);return _0x2c1d37[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x139804+'-'+_0x415ca3+'/'+_0x334b8d)['json'](_0x1a1596);}return null;};}function patchUpdates(_0x15d05d){return function(_0x576a9d){try{jsonpatch[_0x47a5('0x20')](_0x576a9d,_0x15d05d,!![]);}catch(_0x1cfc86){return BPromise[_0x47a5('0x21')](_0x1cfc86);}return _0x576a9d[_0x47a5('0x22')]();};}function saveUpdates(_0x2e365f,_0xc4e715){return function(_0x4216f7){if(_0x4216f7){return _0x4216f7['update'](_0x2e365f)[_0x47a5('0x23')](function(_0x135606){return _0x135606;});}return null;};}function removeEntity(_0x1d4921,_0x1c6876){return function(_0x8e6edf){if(_0x8e6edf){return _0x8e6edf[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0x1d4921[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x5962f8,_0x59b0c6){return function(_0x524405){if(!_0x524405){_0x5962f8[_0x47a5('0x25')](0x194);}return _0x524405;};}function handleError(_0x34e2c7,_0x4a1848){_0x4a1848=_0x4a1848||0x1f4;return function(_0x5a9048){logger[_0x47a5('0x26')](_0x5a9048['stack']);if(_0x5a9048[_0x47a5('0x27')]){delete _0x5a9048[_0x47a5('0x27')];}_0x34e2c7['status'](_0x4a1848)[_0x47a5('0x28')](_0x5a9048);};}exports[_0x47a5('0x29')]=function(_0x5a2f59,_0xe4cc01){var _0x163cf2={},_0x117b24={},_0x250663={'count':0x0,'rows':[]};var _0x40966b=db[_0x47a5('0x2a')][_0x47a5('0x2b')];_0x117b24[_0x47a5('0x2c')]=_['keys'](_0x40966b);_0x117b24[_0x47a5('0x2d')]=_['keys'](_0x5a2f59[_0x47a5('0x2d')]);_0x117b24[_0x47a5('0x2e')]=_[_0x47a5('0x2f')](_0x117b24['model'],_0x117b24[_0x47a5('0x2d')]);_0x163cf2[_0x47a5('0x30')]=_[_0x47a5('0x2f')](_0x117b24[_0x47a5('0x2c')],qs[_0x47a5('0x31')](_0x5a2f59['query'][_0x47a5('0x31')]));_0x163cf2['attributes']=_0x163cf2[_0x47a5('0x30')][_0x47a5('0x32')]?_0x163cf2[_0x47a5('0x30')]:_0x117b24[_0x47a5('0x2c')];if(!_0x5a2f59[_0x47a5('0x2d')]['hasOwnProperty'](_0x47a5('0x33'))){_0x163cf2[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x5a2f59[_0x47a5('0x2d')][_0x47a5('0x1d')]);_0x163cf2[_0x47a5('0x1c')]=qs[_0x47a5('0x1c')](_0x5a2f59[_0x47a5('0x2d')][_0x47a5('0x1c')]);}_0x163cf2['order']=qs[_0x47a5('0x34')](_0x5a2f59[_0x47a5('0x2d')][_0x47a5('0x34')]);_0x163cf2[_0x47a5('0x35')]=qs[_0x47a5('0x2e')](_['pick'](_0x5a2f59[_0x47a5('0x2d')],_0x117b24[_0x47a5('0x2e')]));if(_0x5a2f59['query'][_0x47a5('0x36')]){_0x163cf2[_0x47a5('0x35')]=_[_0x47a5('0x37')](_0x163cf2[_0x47a5('0x35')],{'$or':_[_0x47a5('0x38')](_0x40966b,function(_0x1177a5){if(_0x1177a5[_0x47a5('0x39')][_0x47a5('0x3a')]!==_0x47a5('0x3b')){var _0x215fa5={};_0x215fa5[_0x1177a5[_0x47a5('0x3c')]]={'$like':'%'+_0x5a2f59[_0x47a5('0x2d')][_0x47a5('0x36')]+'%'};return _0x215fa5;}})});}_0x163cf2=_[_0x47a5('0x37')]({},_0x163cf2,_0x5a2f59[_0x47a5('0x3d')]);var _0x5c1e1b={'where':_0x163cf2[_0x47a5('0x35')]};return db[_0x47a5('0x2a')]['count'](_0x5c1e1b)['then'](function(_0x128bd9){_0x250663[_0x47a5('0x1b')]=_0x128bd9;if(_0x5a2f59[_0x47a5('0x2d')]['includeAll']){_0x163cf2[_0x47a5('0x3e')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3f')](_0x163cf2);})[_0x47a5('0x23')](function(_0x44bcf3){_0x250663[_0x47a5('0x40')]=_0x44bcf3;return _0x250663;})[_0x47a5('0x23')](respondWithFilteredResult(_0xe4cc01,_0x163cf2))[_0x47a5('0x41')](handleError(_0xe4cc01,null));};exports[_0x47a5('0x42')]=function(_0x48d3a0,_0x3deea4){var _0xb3f672={'raw':!![],'where':{'id':_0x48d3a0[_0x47a5('0x43')]['id']}},_0x42f0d6={};_0x42f0d6['model']=_[_0x47a5('0x44')](db[_0x47a5('0x2a')][_0x47a5('0x2b')]);_0x42f0d6[_0x47a5('0x2d')]=_[_0x47a5('0x44')](_0x48d3a0[_0x47a5('0x2d')]);_0x42f0d6[_0x47a5('0x2e')]=_['intersection'](_0x42f0d6[_0x47a5('0x2c')],_0x42f0d6[_0x47a5('0x2d')]);_0xb3f672[_0x47a5('0x30')]=_[_0x47a5('0x2f')](_0x42f0d6[_0x47a5('0x2c')],qs[_0x47a5('0x31')](_0x48d3a0[_0x47a5('0x2d')][_0x47a5('0x31')]));_0xb3f672['attributes']=_0xb3f672[_0x47a5('0x30')]['length']?_0xb3f672[_0x47a5('0x30')]:_0x42f0d6['model'];if(_0x48d3a0['query'][_0x47a5('0x45')]){_0xb3f672['include']=[{'all':!![]}];}_0xb3f672=_[_0x47a5('0x37')]({},_0xb3f672,_0x48d3a0[_0x47a5('0x3d')]);return db[_0x47a5('0x2a')][_0x47a5('0x46')](_0xb3f672)[_0x47a5('0x23')](handleEntityNotFound(_0x3deea4,null))[_0x47a5('0x23')](respondWithResult(_0x3deea4,null))[_0x47a5('0x41')](handleError(_0x3deea4,null));};exports[_0x47a5('0x47')]=function(_0x48b72e,_0x54d9cc){return db[_0x47a5('0x2a')][_0x47a5('0x47')](_0x48b72e[_0x47a5('0x48')],{})[_0x47a5('0x23')](respondWithResult(_0x54d9cc,0xc9))[_0x47a5('0x41')](handleError(_0x54d9cc,null));};exports['update']=function(_0x205aec,_0x2aa2a6){if(_0x205aec[_0x47a5('0x48')]['id']){delete _0x205aec['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x46')]({'where':{'id':_0x205aec['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x2aa2a6,null))['then'](saveUpdates(_0x205aec[_0x47a5('0x48')],null))[_0x47a5('0x23')](respondWithResult(_0x2aa2a6,null))[_0x47a5('0x41')](handleError(_0x2aa2a6,null));};exports['destroy']=function(_0x29d76b,_0x3481aa){return db[_0x47a5('0x2a')][_0x47a5('0x46')]({'where':{'id':_0x29d76b[_0x47a5('0x43')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x3481aa,null))[_0x47a5('0x23')](removeEntity(_0x3481aa,null))[_0x47a5('0x41')](handleError(_0x3481aa,null));};exports[_0x47a5('0x49')]=function(_0x168fff,_0x17d2c2){return db['SmsQueueReport']['describe']()[_0x47a5('0x23')](respondWithResult(_0x17d2c2,null))[_0x47a5('0x41')](handleError(_0x17d2c2,null));}; \ No newline at end of file +var _0xec85=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','destroy','then','error','name','send','index','SmsQueueReport','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0xec85,0x94));var _0x5ec8=function(_0x1b52b7,_0x10bcae){_0x1b52b7=_0x1b52b7-0x0;var _0x11e5f5=_0xec85[_0x1b52b7];return _0x11e5f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5ec8('0x0'));var rimraf=require(_0x5ec8('0x1'));var zipdir=require(_0x5ec8('0x2'));var jsonpatch=require(_0x5ec8('0x3'));var rp=require(_0x5ec8('0x4'));var moment=require(_0x5ec8('0x5'));var BPromise=require(_0x5ec8('0x6'));var Mustache=require(_0x5ec8('0x7'));var util=require(_0x5ec8('0x8'));var path=require(_0x5ec8('0x9'));var sox=require(_0x5ec8('0xa'));var csv=require(_0x5ec8('0xb'));var ejs=require(_0x5ec8('0xc'));var fs=require('fs');var _=require(_0x5ec8('0xd'));var squel=require(_0x5ec8('0xe'));var crypto=require(_0x5ec8('0xf'));var jsforce=require(_0x5ec8('0x10'));var deskjs=require(_0x5ec8('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5ec8('0x12'));var Papa=require(_0x5ec8('0x13'));var authService=require('../../components/auth/service');var hardwareService=require(_0x5ec8('0x14'));var Redis=require(_0x5ec8('0x15'));var qs=require(_0x5ec8('0x16'));var logger=require(_0x5ec8('0x17'))(_0x5ec8('0x18'));var utils=require('../../config/utils');var config=require(_0x5ec8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a8dbf,_0x41e5c0){_0x41e5c0=_0x41e5c0||0xcc;return function(_0x22a795){if(_0x22a795){return _0x4a8dbf[_0x5ec8('0x1a')](_0x41e5c0);}return _0x4a8dbf['status'](_0x41e5c0)[_0x5ec8('0x1b')]();};}function respondWithResult(_0x377c6d,_0x32398a){_0x32398a=_0x32398a||0xc8;return function(_0x31e581){if(_0x31e581){return _0x377c6d[_0x5ec8('0x1c')](_0x32398a)[_0x5ec8('0x1d')](_0x31e581);}};}function respondWithFilteredResult(_0x422845,_0x246a16){return function(_0x701a8a){if(_0x701a8a){var _0x1e69e5=_0x701a8a[_0x5ec8('0x1e')],_0x32f7da=_0x246a16[_0x5ec8('0x1f')],_0x242a4c=_0x246a16['offset']+_0x246a16[_0x5ec8('0x20')],_0x492531;if(_0x242a4c>=_0x1e69e5){_0x242a4c=_0x1e69e5;_0x492531=0xc8;}else{_0x492531=0xce;}_0x422845[_0x5ec8('0x1c')](_0x492531);return _0x422845[_0x5ec8('0x21')]('Content-Range',_0x32f7da+'-'+_0x242a4c+'/'+_0x1e69e5)[_0x5ec8('0x1d')](_0x701a8a);}return null;};}function patchUpdates(_0x2783d1){return function(_0x24ad18){try{jsonpatch['apply'](_0x24ad18,_0x2783d1,!![]);}catch(_0x4cff4a){return BPromise[_0x5ec8('0x22')](_0x4cff4a);}return _0x24ad18[_0x5ec8('0x23')]();};}function saveUpdates(_0x5a6153,_0xdc771a){return function(_0x12bc4a){if(_0x12bc4a){return _0x12bc4a[_0x5ec8('0x24')](_0x5a6153)['then'](function(_0x388f9f){return _0x388f9f;});}return null;};}function removeEntity(_0x1a675b,_0x36db67){return function(_0x298a15){if(_0x298a15){return _0x298a15[_0x5ec8('0x25')]()[_0x5ec8('0x26')](function(){_0x1a675b[_0x5ec8('0x1c')](0xcc)[_0x5ec8('0x1b')]();});}};}function handleEntityNotFound(_0x588e61,_0x112215){return function(_0x232307){if(!_0x232307){_0x588e61[_0x5ec8('0x1a')](0x194);}return _0x232307;};}function handleError(_0x38fdf7,_0x4b9446){_0x4b9446=_0x4b9446||0x1f4;return function(_0x463069){logger[_0x5ec8('0x27')](_0x463069['stack']);if(_0x463069[_0x5ec8('0x28')]){delete _0x463069[_0x5ec8('0x28')];}_0x38fdf7[_0x5ec8('0x1c')](_0x4b9446)[_0x5ec8('0x29')](_0x463069);};}exports[_0x5ec8('0x2a')]=function(_0x39266a,_0x429b66){var _0x1a6b07={},_0x38849c={},_0x192165={'count':0x0,'rows':[]};var _0x42a6c7=db[_0x5ec8('0x2b')][_0x5ec8('0x2c')];_0x38849c[_0x5ec8('0x2d')]=_[_0x5ec8('0x2e')](_0x42a6c7);_0x38849c[_0x5ec8('0x2f')]=_['keys'](_0x39266a[_0x5ec8('0x2f')]);_0x38849c[_0x5ec8('0x30')]=_['intersection'](_0x38849c['model'],_0x38849c[_0x5ec8('0x2f')]);_0x1a6b07['attributes']=_[_0x5ec8('0x31')](_0x38849c['model'],qs[_0x5ec8('0x32')](_0x39266a[_0x5ec8('0x2f')]['fields']));_0x1a6b07['attributes']=_0x1a6b07[_0x5ec8('0x33')][_0x5ec8('0x34')]?_0x1a6b07[_0x5ec8('0x33')]:_0x38849c['model'];if(!_0x39266a['query'][_0x5ec8('0x35')](_0x5ec8('0x36'))){_0x1a6b07['limit']=qs['limit'](_0x39266a[_0x5ec8('0x2f')]['limit']);_0x1a6b07[_0x5ec8('0x1f')]=qs[_0x5ec8('0x1f')](_0x39266a[_0x5ec8('0x2f')][_0x5ec8('0x1f')]);}_0x1a6b07[_0x5ec8('0x37')]=qs[_0x5ec8('0x38')](_0x39266a[_0x5ec8('0x2f')][_0x5ec8('0x38')]);_0x1a6b07[_0x5ec8('0x39')]=qs[_0x5ec8('0x30')](_[_0x5ec8('0x3a')](_0x39266a[_0x5ec8('0x2f')],_0x38849c['filters']));if(_0x39266a['query'][_0x5ec8('0x3b')]){_0x1a6b07[_0x5ec8('0x39')]=_[_0x5ec8('0x3c')](_0x1a6b07[_0x5ec8('0x39')],{'$or':_[_0x5ec8('0x3d')](_0x42a6c7,function(_0x5c2ca4){if(_0x5c2ca4[_0x5ec8('0x3e')][_0x5ec8('0x3f')]!==_0x5ec8('0x40')){var _0x27bd8d={};_0x27bd8d[_0x5c2ca4[_0x5ec8('0x41')]]={'$like':'%'+_0x39266a['query'][_0x5ec8('0x3b')]+'%'};return _0x27bd8d;}})});}_0x1a6b07=_[_0x5ec8('0x3c')]({},_0x1a6b07,_0x39266a[_0x5ec8('0x42')]);var _0x2c3daa={'where':_0x1a6b07['where']};return db[_0x5ec8('0x2b')][_0x5ec8('0x1e')](_0x2c3daa)[_0x5ec8('0x26')](function(_0x47956b){_0x192165[_0x5ec8('0x1e')]=_0x47956b;if(_0x39266a['query'][_0x5ec8('0x43')]){_0x1a6b07[_0x5ec8('0x44')]=[{'all':!![]}];}return db[_0x5ec8('0x2b')][_0x5ec8('0x45')](_0x1a6b07);})[_0x5ec8('0x26')](function(_0x5db9e0){_0x192165[_0x5ec8('0x46')]=_0x5db9e0;return _0x192165;})[_0x5ec8('0x26')](respondWithFilteredResult(_0x429b66,_0x1a6b07))[_0x5ec8('0x47')](handleError(_0x429b66,null));};exports[_0x5ec8('0x48')]=function(_0x115e1f,_0x5d12bd){var _0x5115d3={'raw':!![],'where':{'id':_0x115e1f[_0x5ec8('0x49')]['id']}},_0x1699cc={};_0x1699cc[_0x5ec8('0x2d')]=_[_0x5ec8('0x2e')](db[_0x5ec8('0x2b')][_0x5ec8('0x2c')]);_0x1699cc[_0x5ec8('0x2f')]=_[_0x5ec8('0x2e')](_0x115e1f[_0x5ec8('0x2f')]);_0x1699cc[_0x5ec8('0x30')]=_[_0x5ec8('0x31')](_0x1699cc[_0x5ec8('0x2d')],_0x1699cc['query']);_0x5115d3['attributes']=_['intersection'](_0x1699cc['model'],qs[_0x5ec8('0x32')](_0x115e1f[_0x5ec8('0x2f')][_0x5ec8('0x32')]));_0x5115d3['attributes']=_0x5115d3[_0x5ec8('0x33')][_0x5ec8('0x34')]?_0x5115d3[_0x5ec8('0x33')]:_0x1699cc[_0x5ec8('0x2d')];if(_0x115e1f[_0x5ec8('0x2f')][_0x5ec8('0x43')]){_0x5115d3[_0x5ec8('0x44')]=[{'all':!![]}];}_0x5115d3=_[_0x5ec8('0x3c')]({},_0x5115d3,_0x115e1f[_0x5ec8('0x42')]);return db[_0x5ec8('0x2b')]['find'](_0x5115d3)[_0x5ec8('0x26')](handleEntityNotFound(_0x5d12bd,null))[_0x5ec8('0x26')](respondWithResult(_0x5d12bd,null))[_0x5ec8('0x47')](handleError(_0x5d12bd,null));};exports[_0x5ec8('0x4a')]=function(_0x5a25ae,_0x37508f){return db[_0x5ec8('0x2b')][_0x5ec8('0x4a')](_0x5a25ae[_0x5ec8('0x4b')],{})['then'](respondWithResult(_0x37508f,0xc9))['catch'](handleError(_0x37508f,null));};exports[_0x5ec8('0x24')]=function(_0x58e632,_0x483878){if(_0x58e632[_0x5ec8('0x4b')]['id']){delete _0x58e632['body']['id'];}return db[_0x5ec8('0x2b')][_0x5ec8('0x4c')]({'where':{'id':_0x58e632[_0x5ec8('0x49')]['id']}})[_0x5ec8('0x26')](handleEntityNotFound(_0x483878,null))[_0x5ec8('0x26')](saveUpdates(_0x58e632[_0x5ec8('0x4b')],null))['then'](respondWithResult(_0x483878,null))[_0x5ec8('0x47')](handleError(_0x483878,null));};exports['destroy']=function(_0x4a24bf,_0x308bb6){return db[_0x5ec8('0x2b')][_0x5ec8('0x4c')]({'where':{'id':_0x4a24bf[_0x5ec8('0x49')]['id']}})[_0x5ec8('0x26')](handleEntityNotFound(_0x308bb6,null))[_0x5ec8('0x26')](removeEntity(_0x308bb6,null))[_0x5ec8('0x47')](handleError(_0x308bb6,null));};exports['describe']=function(_0x37141,_0x4a3d85){return db[_0x5ec8('0x2b')][_0x5ec8('0x4d')]()[_0x5ec8('0x26')](respondWithResult(_0x4a3d85,null))['catch'](handleError(_0x4a3d85,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 4da95bb..120e6ff 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 _0x201c=['moment','bluebird','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','../../config/logger','api'];(function(_0x4c1f1f,_0x3aa18d){var _0x4f9e3c=function(_0x1a94cb){while(--_0x1a94cb){_0x4c1f1f['push'](_0x4c1f1f['shift']());}};_0x4f9e3c(++_0x3aa18d);}(_0x201c,0x105));var _0xc201=function(_0x4ff615,_0x303731){_0x4ff615=_0x4ff615-0x0;var _0x17a721=_0x201c[_0x4ff615];return _0x17a721;};'use strict';var _=require(_0xc201('0x0'));var util=require('util');var logger=require(_0xc201('0x1'))(_0xc201('0x2'));var moment=require(_0xc201('0x3'));var BPromise=require(_0xc201('0x4'));var rp=require('request-promise');var attributes=require(_0xc201('0x5'));module[_0xc201('0x6')]=function(_0x3a8fd0,_0x25b191){return _0x3a8fd0[_0xc201('0x7')](_0xc201('0x8'),attributes,{'tableName':_0xc201('0x9'),'paranoid':![],'indexes':[{'name':_0xc201('0xa'),'fields':[_0xc201('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c92=['util','api','moment','bluebird','./smsQueueReport.attributes','exports','uniqueid','lodash'];(function(_0x8a912d,_0x53c52b){var _0x4fb44b=function(_0xb62428){while(--_0xb62428){_0x8a912d['push'](_0x8a912d['shift']());}};_0x4fb44b(++_0x53c52b);}(_0x0c92,0x1af));var _0x20c9=function(_0x3a723e,_0x59d99a){_0x3a723e=_0x3a723e-0x0;var _0x3e9c03=_0x0c92[_0x3a723e];return _0x3e9c03;};'use strict';var _=require(_0x20c9('0x0'));var util=require(_0x20c9('0x1'));var logger=require('../../config/logger')(_0x20c9('0x2'));var moment=require(_0x20c9('0x3'));var BPromise=require(_0x20c9('0x4'));var rp=require('request-promise');var attributes=require(_0x20c9('0x5'));module[_0x20c9('0x6')]=function(_0x5d89f9,_0x25a5c2){return _0x5d89f9['define']('SmsQueueReport',attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x20c9('0x7'),'fields':[_0x20c9('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 0b4d987..b67db3c 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 _0x87a0=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','then','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util'];(function(_0x4122e2,_0x105191){var _0x572cc0=function(_0x444c69){while(--_0x444c69){_0x4122e2['push'](_0x4122e2['shift']());}};_0x572cc0(++_0x105191);}(_0x87a0,0x196));var _0x087a=function(_0x1135f9,_0x4b2296){_0x1135f9=_0x1135f9-0x0;var _0x15ff54=_0x87a0[_0x1135f9];return _0x15ff54;};'use strict';var _=require(_0x087a('0x0'));var util=require(_0x087a('0x1'));var moment=require(_0x087a('0x2'));var BPromise=require(_0x087a('0x3'));var rs=require(_0x087a('0x4'));var fs=require('fs');var Redis=require(_0x087a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x087a('0x6'))(_0x087a('0x7'));var config=require(_0x087a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x087a('0x9')][_0x087a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x462298,_0x18599a,_0x3e02dc){return new BPromise(function(_0x1d4371,_0x4ef28c){return client[_0x087a('0xb')](_0x462298,_0x3e02dc)['then'](function(_0x3647a4){logger[_0x087a('0xc')](_0x087a('0xd'),_0x18599a,_0x087a('0xe'));logger[_0x087a('0xf')](_0x087a('0x10'),_0x18599a,_0x087a('0xe'),JSON[_0x087a('0x11')](_0x3647a4));if(_0x3647a4[_0x087a('0x12')]){if(_0x3647a4[_0x087a('0x12')][_0x087a('0x13')]===0x1f4){logger[_0x087a('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x18599a,_0x3647a4[_0x087a('0x12')][_0x087a('0x14')]);return _0x4ef28c(_0x3647a4[_0x087a('0x12')]['message']);}logger[_0x087a('0x12')](_0x087a('0xd'),_0x18599a,_0x3647a4[_0x087a('0x12')][_0x087a('0x14')]);return _0x1d4371(_0x3647a4[_0x087a('0x12')][_0x087a('0x14')]);}else{logger['info'](_0x087a('0xd'),_0x18599a,_0x087a('0xe'));_0x1d4371(_0x3647a4[_0x087a('0x15')][_0x087a('0x14')]);}})[_0x087a('0x16')](function(_0xbc76d){logger[_0x087a('0x12')](_0x087a('0xd'),_0x18599a,_0xbc76d);_0x4ef28c(_0xbc76d);});});}exports[_0x087a('0x17')]=function(_0x3de1c3){var _0x2fc9b2=this;return new Promise(function(_0x228597,_0x4694d2){return db[_0x087a('0x18')][_0x087a('0x19')](_0x3de1c3['body'],{'raw':_0x3de1c3[_0x087a('0x1a')]?_0x3de1c3[_0x087a('0x1a')][_0x087a('0x1b')]===undefined?!![]:![]:!![]})[_0x087a('0x1c')](function(_0x241485){logger[_0x087a('0xc')](_0x087a('0x17'),_0x3de1c3);logger[_0x087a('0xf')](_0x087a('0x17'),_0x3de1c3,JSON[_0x087a('0x11')](_0x241485));_0x228597(_0x241485);})[_0x087a('0x16')](function(_0x2d8b0b){logger[_0x087a('0x12')](_0x087a('0x17'),_0x2d8b0b['message'],_0x3de1c3);_0x4694d2(_0x2fc9b2['error'](0x1f4,_0x2d8b0b[_0x087a('0x14')]));});});};exports[_0x087a('0x1d')]=function(_0x54b541){var _0x1d2236=this;return new Promise(function(_0x4a24de,_0x34d27c){return db[_0x087a('0x18')][_0x087a('0x1e')](_0x54b541['body'],{'raw':_0x54b541[_0x087a('0x1a')]?_0x54b541['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54b541['options']?_0x54b541['options'][_0x087a('0x1f')]||null:null,'attributes':_0x54b541[_0x087a('0x1a')]?_0x54b541[_0x087a('0x1a')][_0x087a('0x20')]||null:null,'limit':_0x54b541[_0x087a('0x1a')]?_0x54b541['options'][_0x087a('0x21')]||null:null})[_0x087a('0x1c')](function(_0x44e56d){logger[_0x087a('0xc')](_0x087a('0x1d'),_0x54b541);logger['debug'](_0x087a('0x1d'),_0x54b541,JSON[_0x087a('0x11')](_0x44e56d));_0x4a24de(_0x44e56d);})[_0x087a('0x16')](function(_0x58c312){logger[_0x087a('0x12')](_0x087a('0x1d'),_0x58c312[_0x087a('0x14')],_0x54b541);_0x34d27c(_0x1d2236[_0x087a('0x12')](0x1f4,_0x58c312[_0x087a('0x14')]));});});}; \ No newline at end of file +var _0xff39=['create','body','options','raw','SmsQueueReport','attributes','limit','UpdateSmsQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport'];(function(_0x29131f,_0x226727){var _0x299226=function(_0x2b9e4e){while(--_0x2b9e4e){_0x29131f['push'](_0x29131f['shift']());}};_0x299226(++_0x226727);}(_0xff39,0x19b));var _0x9ff3=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0xff39[_0x4f2c3a];return _0x17d91c;};'use strict';var _=require('lodash');var util=require(_0x9ff3('0x0'));var moment=require(_0x9ff3('0x1'));var BPromise=require(_0x9ff3('0x2'));var rs=require(_0x9ff3('0x3'));var fs=require('fs');var Redis=require(_0x9ff3('0x4'));var db=require(_0x9ff3('0x5'))['db'];var utils=require(_0x9ff3('0x6'));var logger=require(_0x9ff3('0x7'))('rpc');var config=require(_0x9ff3('0x8'));var jayson=require(_0x9ff3('0x9'));var client=jayson[_0x9ff3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ac98b,_0x5b4182,_0x19b30d){return new BPromise(function(_0x158d7c,_0x199ff1){return client['request'](_0x2ac98b,_0x19b30d)[_0x9ff3('0xb')](function(_0x1b91f5){logger[_0x9ff3('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x5b4182,_0x9ff3('0xd'));logger['debug'](_0x9ff3('0xe'),_0x5b4182,'request\x20sent',JSON[_0x9ff3('0xf')](_0x1b91f5));if(_0x1b91f5[_0x9ff3('0x10')]){if(_0x1b91f5['error'][_0x9ff3('0x11')]===0x1f4){logger['error'](_0x9ff3('0x12'),_0x5b4182,_0x1b91f5[_0x9ff3('0x10')]['message']);return _0x199ff1(_0x1b91f5[_0x9ff3('0x10')][_0x9ff3('0x13')]);}logger[_0x9ff3('0x10')](_0x9ff3('0x12'),_0x5b4182,_0x1b91f5[_0x9ff3('0x10')]['message']);return _0x158d7c(_0x1b91f5[_0x9ff3('0x10')][_0x9ff3('0x13')]);}else{logger[_0x9ff3('0xc')](_0x9ff3('0x12'),_0x5b4182,'request\x20sent');_0x158d7c(_0x1b91f5[_0x9ff3('0x14')]['message']);}})[_0x9ff3('0x15')](function(_0x1e5d25){logger[_0x9ff3('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x5b4182,_0x1e5d25);_0x199ff1(_0x1e5d25);});});}exports[_0x9ff3('0x16')]=function(_0x4e80b2){var _0xc05141=this;return new Promise(function(_0x2b7352,_0x50ec08){return db['SmsQueueReport'][_0x9ff3('0x17')](_0x4e80b2[_0x9ff3('0x18')],{'raw':_0x4e80b2[_0x9ff3('0x19')]?_0x4e80b2[_0x9ff3('0x19')][_0x9ff3('0x1a')]===undefined?!![]:![]:!![]})[_0x9ff3('0xb')](function(_0x3fca55){logger[_0x9ff3('0xc')](_0x9ff3('0x16'),_0x4e80b2);logger['debug'](_0x9ff3('0x16'),_0x4e80b2,JSON[_0x9ff3('0xf')](_0x3fca55));_0x2b7352(_0x3fca55);})['catch'](function(_0x5a3547){logger['error'](_0x9ff3('0x16'),_0x5a3547[_0x9ff3('0x13')],_0x4e80b2);_0x50ec08(_0xc05141[_0x9ff3('0x10')](0x1f4,_0x5a3547['message']));});});};exports['UpdateSmsQueueReport']=function(_0x1126cf){var _0x582441=this;return new Promise(function(_0x346dc4,_0x1c2aac){return db[_0x9ff3('0x1b')]['update'](_0x1126cf['body'],{'raw':_0x1126cf[_0x9ff3('0x19')]?_0x1126cf[_0x9ff3('0x19')][_0x9ff3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1126cf['options']?_0x1126cf[_0x9ff3('0x19')]['where']||null:null,'attributes':_0x1126cf['options']?_0x1126cf[_0x9ff3('0x19')][_0x9ff3('0x1c')]||null:null,'limit':_0x1126cf[_0x9ff3('0x19')]?_0x1126cf[_0x9ff3('0x19')][_0x9ff3('0x1d')]||null:null})['then'](function(_0x3dc768){logger['info']('UpdateSmsQueueReport',_0x1126cf);logger['debug'](_0x9ff3('0x1e'),_0x1126cf,JSON[_0x9ff3('0xf')](_0x3dc768));_0x346dc4(_0x3dc768);})[_0x9ff3('0x15')](function(_0x5993b1){logger[_0x9ff3('0x10')](_0x9ff3('0x1e'),_0x5993b1[_0x9ff3('0x13')],_0x1126cf);_0x1c2aac(_0x582441[_0x9ff3('0x10')](0x1f4,_0x5993b1['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ca8c073..b401653 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 _0xdda8=['put','/:id','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','isAuthenticated','describe','post','create'];(function(_0x4baaf0,_0x5c4fbb){var _0x3b81d1=function(_0x245abf){while(--_0x245abf){_0x4baaf0['push'](_0x4baaf0['shift']());}};_0x3b81d1(++_0x5c4fbb);}(_0xdda8,0x1ba));var _0x8dda=function(_0x4cbcd4,_0x2831f5){_0x4cbcd4=_0x4cbcd4-0x0;var _0x3e934b=_0xdda8[_0x4cbcd4];return _0x3e934b;};'use strict';var multer=require(_0x8dda('0x0'));var util=require('util');var path=require(_0x8dda('0x1'));var timeout=require(_0x8dda('0x2'));var express=require('express');var router=express[_0x8dda('0x3')]();var auth=require(_0x8dda('0x4'));var interaction=require(_0x8dda('0x5'));var config=require(_0x8dda('0x6'));var controller=require(_0x8dda('0x7'));router[_0x8dda('0x8')]('/',auth['isAuthenticated'](),controller[_0x8dda('0x9')]);router['get']('/describe',auth[_0x8dda('0xa')](),controller[_0x8dda('0xb')]);router['get']('/:id',auth[_0x8dda('0xa')](),controller['show']);router[_0x8dda('0xc')]('/',auth['isAuthenticated'](),controller[_0x8dda('0xd')]);router[_0x8dda('0xe')](_0x8dda('0xf'),auth['isAuthenticated'](),controller[_0x8dda('0x10')]);router[_0x8dda('0x11')](_0x8dda('0xf'),auth[_0x8dda('0xa')](),controller['destroy']);module[_0x8dda('0x12')]=router; \ No newline at end of file +var _0xb5e9=['../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xe0b953,_0x46a717){var _0x1ef934=function(_0x528603){while(--_0x528603){_0xe0b953['push'](_0xe0b953['shift']());}};_0x1ef934(++_0x46a717);}(_0xb5e9,0x1c7));var _0x9b5e=function(_0x3f0d76,_0x378fed){_0x3f0d76=_0x3f0d76-0x0;var _0x12c12e=_0xb5e9[_0x3f0d76];return _0x12c12e;};'use strict';var multer=require(_0x9b5e('0x0'));var util=require(_0x9b5e('0x1'));var path=require('path');var timeout=require(_0x9b5e('0x2'));var express=require(_0x9b5e('0x3'));var router=express[_0x9b5e('0x4')]();var auth=require(_0x9b5e('0x5'));var interaction=require(_0x9b5e('0x6'));var config=require(_0x9b5e('0x7'));var controller=require(_0x9b5e('0x8'));router[_0x9b5e('0x9')]('/',auth[_0x9b5e('0xa')](),controller[_0x9b5e('0xb')]);router['get'](_0x9b5e('0xc'),auth[_0x9b5e('0xa')](),controller[_0x9b5e('0xd')]);router[_0x9b5e('0x9')](_0x9b5e('0xe'),auth[_0x9b5e('0xa')](),controller['show']);router[_0x9b5e('0xf')]('/',auth[_0x9b5e('0xa')](),controller[_0x9b5e('0x10')]);router[_0x9b5e('0x11')](_0x9b5e('0xe'),auth[_0x9b5e('0xa')](),controller[_0x9b5e('0x12')]);router[_0x9b5e('0x13')](_0x9b5e('0xe'),auth[_0x9b5e('0xa')](),controller[_0x9b5e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 0916eb4..b05c939 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 _0x5f75=['STRING','ENUM','account','agent','queue','DATE','moment','sequelize','exports'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x5f75,0x1e3));var _0x55f7=function(_0x406d39,_0xd3c8f1){_0x406d39=_0x406d39-0x0;var _0x2eb792=_0x5f75[_0x406d39];return _0x2eb792;};'use strict';var moment=require(_0x55f7('0x0'));var Sequelize=require(_0x55f7('0x1'));module[_0x55f7('0x2')]={'uniqueid':{'type':Sequelize[_0x55f7('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x55f7('0x4')](_0x55f7('0x5'),_0x55f7('0x6'),_0x55f7('0x7')),'allowNull':![],'defaultValue':_0x55f7('0x7')},'transferredAt':{'type':Sequelize[_0x55f7('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x6ee3=['ENUM','account','agent','queue','DATE','moment','sequelize','exports','STRING'];(function(_0x5dff26,_0x2a2f10){var _0x4b2734=function(_0x2834f1){while(--_0x2834f1){_0x5dff26['push'](_0x5dff26['shift']());}};_0x4b2734(++_0x2a2f10);}(_0x6ee3,0x12e));var _0x36ee=function(_0x406017,_0x5d7fba){_0x406017=_0x406017-0x0;var _0x4d4ed7=_0x6ee3[_0x406017];return _0x4d4ed7;};'use strict';var moment=require(_0x36ee('0x0'));var Sequelize=require(_0x36ee('0x1'));module[_0x36ee('0x2')]={'uniqueid':{'type':Sequelize[_0x36ee('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x36ee('0x4')](_0x36ee('0x5'),_0x36ee('0x6'),_0x36ee('0x7')),'allowNull':![],'defaultValue':_0x36ee('0x7')},'transferredAt':{'type':Sequelize[_0x36ee('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index d6ee805..d033c41 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 _0xaf13=['api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','error','stack','name','send','index','SmsTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','filter','merge','where','map','key','VIRTUAL','field','then','catch','show','includeAll','include','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x2007e6,_0x43b204){var _0x31a410=function(_0x3a0186){while(--_0x3a0186){_0x2007e6['push'](_0x2007e6['shift']());}};_0x31a410(++_0x43b204);}(_0xaf13,0x1e3));var _0x3af1=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xaf13[_0x27af45];return _0x18df21;};'use strict';var pdf=require(_0x3af1('0x0'));var emlformat=require(_0x3af1('0x1'));var rimraf=require(_0x3af1('0x2'));var zipdir=require(_0x3af1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3af1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3af1('0x5'));var path=require(_0x3af1('0x6'));var sox=require(_0x3af1('0x7'));var csv=require(_0x3af1('0x8'));var ejs=require(_0x3af1('0x9'));var fs=require('fs');var _=require(_0x3af1('0xa'));var squel=require(_0x3af1('0xb'));var crypto=require(_0x3af1('0xc'));var jsforce=require(_0x3af1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3af1('0xe'));var Papa=require(_0x3af1('0xf'));var authService=require(_0x3af1('0x10'));var hardwareService=require(_0x3af1('0x11'));var Redis=require(_0x3af1('0x12'));var qs=require(_0x3af1('0x13'));var logger=require(_0x3af1('0x14'))(_0x3af1('0x15'));var utils=require(_0x3af1('0x16'));var config=require('../../config/environment');var db=require(_0x3af1('0x17'))['db'];function respondWithStatusCode(_0x40e7a5,_0x489b5c){_0x489b5c=_0x489b5c||0xcc;return function(_0x38dbb9){if(_0x38dbb9){return _0x40e7a5[_0x3af1('0x18')](_0x489b5c);}return _0x40e7a5[_0x3af1('0x19')](_0x489b5c)[_0x3af1('0x1a')]();};}function respondWithResult(_0x5527ef,_0x490761){_0x490761=_0x490761||0xc8;return function(_0x40185f){if(_0x40185f){return _0x5527ef[_0x3af1('0x19')](_0x490761)[_0x3af1('0x1b')](_0x40185f);}};}function respondWithFilteredResult(_0x2e1b34,_0x1ffacb){return function(_0x4739ee){if(_0x4739ee){var _0x40b6a2=_0x4739ee[_0x3af1('0x1c')],_0x3e3d13=_0x1ffacb['offset'],_0xb42ad9=_0x1ffacb[_0x3af1('0x1d')]+_0x1ffacb['limit'],_0x32d598;if(_0xb42ad9>=_0x40b6a2){_0xb42ad9=_0x40b6a2;_0x32d598=0xc8;}else{_0x32d598=0xce;}_0x2e1b34['status'](_0x32d598);return _0x2e1b34[_0x3af1('0x1e')](_0x3af1('0x1f'),_0x3e3d13+'-'+_0xb42ad9+'/'+_0x40b6a2)[_0x3af1('0x1b')](_0x4739ee);}return null;};}function patchUpdates(_0x5601d0){return function(_0x3b1057){try{jsonpatch[_0x3af1('0x20')](_0x3b1057,_0x5601d0,!![]);}catch(_0x468282){return BPromise['reject'](_0x468282);}return _0x3b1057[_0x3af1('0x21')]();};}function saveUpdates(_0x5533e7,_0xe34699){return function(_0xb98e2f){if(_0xb98e2f){return _0xb98e2f[_0x3af1('0x22')](_0x5533e7)['then'](function(_0x5459fb){return _0x5459fb;});}return null;};}function removeEntity(_0x982fd2,_0x29b4f5){return function(_0x18a3fc){if(_0x18a3fc){return _0x18a3fc['destroy']()['then'](function(){_0x982fd2[_0x3af1('0x19')](0xcc)[_0x3af1('0x1a')]();});}};}function handleEntityNotFound(_0x5b6588,_0x74354e){return function(_0x4afad5){if(!_0x4afad5){_0x5b6588[_0x3af1('0x18')](0x194);}return _0x4afad5;};}function handleError(_0x1747dc,_0x3ab2d2){_0x3ab2d2=_0x3ab2d2||0x1f4;return function(_0x1d2dbb){logger[_0x3af1('0x23')](_0x1d2dbb[_0x3af1('0x24')]);if(_0x1d2dbb[_0x3af1('0x25')]){delete _0x1d2dbb[_0x3af1('0x25')];}_0x1747dc['status'](_0x3ab2d2)[_0x3af1('0x26')](_0x1d2dbb);};}exports[_0x3af1('0x27')]=function(_0x4a643a,_0x2aa7d6){var _0x25f601={},_0x5b1e00={},_0x25fb35={'count':0x0,'rows':[]};var _0x4535ed=db[_0x3af1('0x28')][_0x3af1('0x29')];_0x5b1e00[_0x3af1('0x2a')]=_[_0x3af1('0x2b')](_0x4535ed);_0x5b1e00[_0x3af1('0x2c')]=_[_0x3af1('0x2b')](_0x4a643a[_0x3af1('0x2c')]);_0x5b1e00[_0x3af1('0x2d')]=_[_0x3af1('0x2e')](_0x5b1e00[_0x3af1('0x2a')],_0x5b1e00[_0x3af1('0x2c')]);_0x25f601[_0x3af1('0x2f')]=_[_0x3af1('0x2e')](_0x5b1e00[_0x3af1('0x2a')],qs[_0x3af1('0x30')](_0x4a643a[_0x3af1('0x2c')][_0x3af1('0x30')]));_0x25f601[_0x3af1('0x2f')]=_0x25f601[_0x3af1('0x2f')][_0x3af1('0x31')]?_0x25f601['attributes']:_0x5b1e00[_0x3af1('0x2a')];if(!_0x4a643a[_0x3af1('0x2c')]['hasOwnProperty'](_0x3af1('0x32'))){_0x25f601[_0x3af1('0x33')]=qs[_0x3af1('0x33')](_0x4a643a[_0x3af1('0x2c')][_0x3af1('0x33')]);_0x25f601[_0x3af1('0x1d')]=qs['offset'](_0x4a643a[_0x3af1('0x2c')][_0x3af1('0x1d')]);}_0x25f601[_0x3af1('0x34')]=qs[_0x3af1('0x35')](_0x4a643a[_0x3af1('0x2c')][_0x3af1('0x35')]);_0x25f601['where']=qs[_0x3af1('0x2d')](_['pick'](_0x4a643a[_0x3af1('0x2c')],_0x5b1e00['filters']));if(_0x4a643a['query'][_0x3af1('0x36')]){_0x25f601['where']=_[_0x3af1('0x37')](_0x25f601[_0x3af1('0x38')],{'$or':_[_0x3af1('0x39')](_0x4535ed,function(_0x383dc1){if(_0x383dc1['type'][_0x3af1('0x3a')]!==_0x3af1('0x3b')){var _0x473364={};_0x473364[_0x383dc1[_0x3af1('0x3c')]]={'$like':'%'+_0x4a643a[_0x3af1('0x2c')][_0x3af1('0x36')]+'%'};return _0x473364;}})});}_0x25f601=_[_0x3af1('0x37')]({},_0x25f601,_0x4a643a['options']);var _0x54a7e3={'where':_0x25f601['where']};return db[_0x3af1('0x28')]['count'](_0x54a7e3)[_0x3af1('0x3d')](function(_0x221c97){_0x25fb35[_0x3af1('0x1c')]=_0x221c97;if(_0x4a643a[_0x3af1('0x2c')]['includeAll']){_0x25f601['include']=[{'all':!![]}];}return db[_0x3af1('0x28')]['findAll'](_0x25f601);})[_0x3af1('0x3d')](function(_0x5ef80b){_0x25fb35['rows']=_0x5ef80b;return _0x25fb35;})[_0x3af1('0x3d')](respondWithFilteredResult(_0x2aa7d6,_0x25f601))[_0x3af1('0x3e')](handleError(_0x2aa7d6,null));};exports[_0x3af1('0x3f')]=function(_0x3cb54b,_0x33da6d){var _0x3051ce={'raw':!![],'where':{'id':_0x3cb54b['params']['id']}},_0x58b0f0={};_0x58b0f0[_0x3af1('0x2a')]=_[_0x3af1('0x2b')](db[_0x3af1('0x28')][_0x3af1('0x29')]);_0x58b0f0[_0x3af1('0x2c')]=_[_0x3af1('0x2b')](_0x3cb54b[_0x3af1('0x2c')]);_0x58b0f0[_0x3af1('0x2d')]=_[_0x3af1('0x2e')](_0x58b0f0[_0x3af1('0x2a')],_0x58b0f0['query']);_0x3051ce[_0x3af1('0x2f')]=_[_0x3af1('0x2e')](_0x58b0f0[_0x3af1('0x2a')],qs[_0x3af1('0x30')](_0x3cb54b['query'][_0x3af1('0x30')]));_0x3051ce[_0x3af1('0x2f')]=_0x3051ce[_0x3af1('0x2f')][_0x3af1('0x31')]?_0x3051ce[_0x3af1('0x2f')]:_0x58b0f0['model'];if(_0x3cb54b['query'][_0x3af1('0x40')]){_0x3051ce[_0x3af1('0x41')]=[{'all':!![]}];}_0x3051ce=_[_0x3af1('0x37')]({},_0x3051ce,_0x3cb54b['options']);return db[_0x3af1('0x28')][_0x3af1('0x42')](_0x3051ce)[_0x3af1('0x3d')](handleEntityNotFound(_0x33da6d,null))[_0x3af1('0x3d')](respondWithResult(_0x33da6d,null))['catch'](handleError(_0x33da6d,null));};exports['create']=function(_0x4e2da8,_0x7ae340){return db[_0x3af1('0x28')][_0x3af1('0x43')](_0x4e2da8['body'],{})[_0x3af1('0x3d')](respondWithResult(_0x7ae340,0xc9))[_0x3af1('0x3e')](handleError(_0x7ae340,null));};exports[_0x3af1('0x22')]=function(_0x46ee6e,_0x558257){if(_0x46ee6e['body']['id']){delete _0x46ee6e[_0x3af1('0x44')]['id'];}return db[_0x3af1('0x28')][_0x3af1('0x42')]({'where':{'id':_0x46ee6e[_0x3af1('0x45')]['id']}})[_0x3af1('0x3d')](handleEntityNotFound(_0x558257,null))[_0x3af1('0x3d')](saveUpdates(_0x46ee6e[_0x3af1('0x44')],null))['then'](respondWithResult(_0x558257,null))[_0x3af1('0x3e')](handleError(_0x558257,null));};exports[_0x3af1('0x46')]=function(_0x57680b,_0x234f06){return db[_0x3af1('0x28')]['find']({'where':{'id':_0x57680b[_0x3af1('0x45')]['id']}})[_0x3af1('0x3d')](handleEntityNotFound(_0x234f06,null))['then'](removeEntity(_0x234f06,null))[_0x3af1('0x3e')](handleError(_0x234f06,null));};exports[_0x3af1('0x47')]=function(_0x237f88,_0x12c48f){return db[_0x3af1('0x28')][_0x3af1('0x47')]()[_0x3af1('0x3d')](respondWithResult(_0x12c48f,null))[_0x3af1('0x3e')](handleError(_0x12c48f,null));}; \ No newline at end of file +var _0x6b06=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','map','type','VIRTUAL','filter','options','SmsTransferReport','then','includeAll','include','findAll','rows','catch','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','crypto'];(function(_0x38d542,_0x200971){var _0x2dc026=function(_0x183238){while(--_0x183238){_0x38d542['push'](_0x38d542['shift']());}};_0x2dc026(++_0x200971);}(_0x6b06,0x7f));var _0x66b0=function(_0x5859d4,_0x557f6f){_0x5859d4=_0x5859d4-0x0;var _0xa5f2f7=_0x6b06[_0x5859d4];return _0xa5f2f7;};'use strict';var pdf=require(_0x66b0('0x0'));var emlformat=require(_0x66b0('0x1'));var rimraf=require(_0x66b0('0x2'));var zipdir=require(_0x66b0('0x3'));var jsonpatch=require(_0x66b0('0x4'));var rp=require('request-promise');var moment=require(_0x66b0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x66b0('0x6'));var util=require(_0x66b0('0x7'));var path=require('path');var sox=require(_0x66b0('0x8'));var csv=require(_0x66b0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x66b0('0xa'));var jsforce=require(_0x66b0('0xb'));var deskjs=require(_0x66b0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x66b0('0xd'));var Papa=require(_0x66b0('0xe'));var authService=require(_0x66b0('0xf'));var hardwareService=require(_0x66b0('0x10'));var Redis=require(_0x66b0('0x11'));var qs=require(_0x66b0('0x12'));var logger=require(_0x66b0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x66b0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37041b,_0x4c1a00){_0x4c1a00=_0x4c1a00||0xcc;return function(_0x5ab6ca){if(_0x5ab6ca){return _0x37041b['sendStatus'](_0x4c1a00);}return _0x37041b['status'](_0x4c1a00)['end']();};}function respondWithResult(_0x341fc1,_0x462c72){_0x462c72=_0x462c72||0xc8;return function(_0x230d7a){if(_0x230d7a){return _0x341fc1[_0x66b0('0x15')](_0x462c72)[_0x66b0('0x16')](_0x230d7a);}};}function respondWithFilteredResult(_0x551f19,_0x2318c9){return function(_0x5af567){if(_0x5af567){var _0x3e9a44=_0x5af567[_0x66b0('0x17')],_0x4b5be3=_0x2318c9['offset'],_0x1a7204=_0x2318c9[_0x66b0('0x18')]+_0x2318c9[_0x66b0('0x19')],_0x2d47ef;if(_0x1a7204>=_0x3e9a44){_0x1a7204=_0x3e9a44;_0x2d47ef=0xc8;}else{_0x2d47ef=0xce;}_0x551f19[_0x66b0('0x15')](_0x2d47ef);return _0x551f19['set'](_0x66b0('0x1a'),_0x4b5be3+'-'+_0x1a7204+'/'+_0x3e9a44)['json'](_0x5af567);}return null;};}function patchUpdates(_0x125513){return function(_0x2b18fa){try{jsonpatch[_0x66b0('0x1b')](_0x2b18fa,_0x125513,!![]);}catch(_0xe82e4c){return BPromise['reject'](_0xe82e4c);}return _0x2b18fa[_0x66b0('0x1c')]();};}function saveUpdates(_0x4a2fb6,_0x22d856){return function(_0x396667){if(_0x396667){return _0x396667[_0x66b0('0x1d')](_0x4a2fb6)['then'](function(_0x1c05b2){return _0x1c05b2;});}return null;};}function removeEntity(_0x2be666,_0x225b67){return function(_0x5df420){if(_0x5df420){return _0x5df420[_0x66b0('0x1e')]()['then'](function(){_0x2be666['status'](0xcc)[_0x66b0('0x1f')]();});}};}function handleEntityNotFound(_0x44f466,_0x440352){return function(_0x22656e){if(!_0x22656e){_0x44f466[_0x66b0('0x20')](0x194);}return _0x22656e;};}function handleError(_0x231127,_0x3b677d){_0x3b677d=_0x3b677d||0x1f4;return function(_0x3d9ac4){logger[_0x66b0('0x21')](_0x3d9ac4[_0x66b0('0x22')]);if(_0x3d9ac4[_0x66b0('0x23')]){delete _0x3d9ac4[_0x66b0('0x23')];}_0x231127[_0x66b0('0x15')](_0x3b677d)[_0x66b0('0x24')](_0x3d9ac4);};}exports[_0x66b0('0x25')]=function(_0x296cc0,_0x58daf9){var _0x5e92a9={},_0x1e1ddc={},_0x45c84c={'count':0x0,'rows':[]};var _0x193fd0=db['SmsTransferReport'][_0x66b0('0x26')];_0x1e1ddc[_0x66b0('0x27')]=_['keys'](_0x193fd0);_0x1e1ddc[_0x66b0('0x28')]=_[_0x66b0('0x29')](_0x296cc0[_0x66b0('0x28')]);_0x1e1ddc['filters']=_[_0x66b0('0x2a')](_0x1e1ddc[_0x66b0('0x27')],_0x1e1ddc[_0x66b0('0x28')]);_0x5e92a9[_0x66b0('0x2b')]=_[_0x66b0('0x2a')](_0x1e1ddc['model'],qs[_0x66b0('0x2c')](_0x296cc0[_0x66b0('0x28')]['fields']));_0x5e92a9[_0x66b0('0x2b')]=_0x5e92a9['attributes'][_0x66b0('0x2d')]?_0x5e92a9[_0x66b0('0x2b')]:_0x1e1ddc['model'];if(!_0x296cc0[_0x66b0('0x28')][_0x66b0('0x2e')](_0x66b0('0x2f'))){_0x5e92a9['limit']=qs['limit'](_0x296cc0[_0x66b0('0x28')][_0x66b0('0x19')]);_0x5e92a9[_0x66b0('0x18')]=qs[_0x66b0('0x18')](_0x296cc0[_0x66b0('0x28')][_0x66b0('0x18')]);}_0x5e92a9['order']=qs[_0x66b0('0x30')](_0x296cc0[_0x66b0('0x28')]['sort']);_0x5e92a9[_0x66b0('0x31')]=qs[_0x66b0('0x32')](_[_0x66b0('0x33')](_0x296cc0[_0x66b0('0x28')],_0x1e1ddc[_0x66b0('0x32')]));if(_0x296cc0[_0x66b0('0x28')]['filter']){_0x5e92a9[_0x66b0('0x31')]=_[_0x66b0('0x34')](_0x5e92a9[_0x66b0('0x31')],{'$or':_[_0x66b0('0x35')](_0x193fd0,function(_0x1b2c59){if(_0x1b2c59[_0x66b0('0x36')]['key']!==_0x66b0('0x37')){var _0x412bff={};_0x412bff[_0x1b2c59['field']]={'$like':'%'+_0x296cc0[_0x66b0('0x28')][_0x66b0('0x38')]+'%'};return _0x412bff;}})});}_0x5e92a9=_[_0x66b0('0x34')]({},_0x5e92a9,_0x296cc0[_0x66b0('0x39')]);var _0x5d7233={'where':_0x5e92a9[_0x66b0('0x31')]};return db[_0x66b0('0x3a')][_0x66b0('0x17')](_0x5d7233)[_0x66b0('0x3b')](function(_0x24f882){_0x45c84c[_0x66b0('0x17')]=_0x24f882;if(_0x296cc0['query'][_0x66b0('0x3c')]){_0x5e92a9[_0x66b0('0x3d')]=[{'all':!![]}];}return db[_0x66b0('0x3a')][_0x66b0('0x3e')](_0x5e92a9);})[_0x66b0('0x3b')](function(_0x17e306){_0x45c84c[_0x66b0('0x3f')]=_0x17e306;return _0x45c84c;})[_0x66b0('0x3b')](respondWithFilteredResult(_0x58daf9,_0x5e92a9))[_0x66b0('0x40')](handleError(_0x58daf9,null));};exports['show']=function(_0x43c050,_0xc453e9){var _0x2104a0={'raw':!![],'where':{'id':_0x43c050['params']['id']}},_0x4fea73={};_0x4fea73[_0x66b0('0x27')]=_['keys'](db[_0x66b0('0x3a')][_0x66b0('0x26')]);_0x4fea73[_0x66b0('0x28')]=_[_0x66b0('0x29')](_0x43c050[_0x66b0('0x28')]);_0x4fea73['filters']=_['intersection'](_0x4fea73[_0x66b0('0x27')],_0x4fea73[_0x66b0('0x28')]);_0x2104a0['attributes']=_['intersection'](_0x4fea73[_0x66b0('0x27')],qs[_0x66b0('0x2c')](_0x43c050['query'][_0x66b0('0x2c')]));_0x2104a0[_0x66b0('0x2b')]=_0x2104a0[_0x66b0('0x2b')]['length']?_0x2104a0[_0x66b0('0x2b')]:_0x4fea73['model'];if(_0x43c050[_0x66b0('0x28')]['includeAll']){_0x2104a0[_0x66b0('0x3d')]=[{'all':!![]}];}_0x2104a0=_[_0x66b0('0x34')]({},_0x2104a0,_0x43c050[_0x66b0('0x39')]);return db['SmsTransferReport'][_0x66b0('0x41')](_0x2104a0)[_0x66b0('0x3b')](handleEntityNotFound(_0xc453e9,null))[_0x66b0('0x3b')](respondWithResult(_0xc453e9,null))['catch'](handleError(_0xc453e9,null));};exports['create']=function(_0x5c11d4,_0x3efb08){return db[_0x66b0('0x3a')][_0x66b0('0x42')](_0x5c11d4['body'],{})[_0x66b0('0x3b')](respondWithResult(_0x3efb08,0xc9))[_0x66b0('0x40')](handleError(_0x3efb08,null));};exports[_0x66b0('0x1d')]=function(_0x323f28,_0x135da7){if(_0x323f28[_0x66b0('0x43')]['id']){delete _0x323f28[_0x66b0('0x43')]['id'];}return db[_0x66b0('0x3a')][_0x66b0('0x41')]({'where':{'id':_0x323f28[_0x66b0('0x44')]['id']}})[_0x66b0('0x3b')](handleEntityNotFound(_0x135da7,null))[_0x66b0('0x3b')](saveUpdates(_0x323f28['body'],null))[_0x66b0('0x3b')](respondWithResult(_0x135da7,null))[_0x66b0('0x40')](handleError(_0x135da7,null));};exports[_0x66b0('0x1e')]=function(_0x1c9bba,_0x5f0a25){return db[_0x66b0('0x3a')][_0x66b0('0x41')]({'where':{'id':_0x1c9bba[_0x66b0('0x44')]['id']}})[_0x66b0('0x3b')](handleEntityNotFound(_0x5f0a25,null))[_0x66b0('0x3b')](removeEntity(_0x5f0a25,null))[_0x66b0('0x40')](handleError(_0x5f0a25,null));};exports['describe']=function(_0x4de297,_0xc6576b){return db[_0x66b0('0x3a')]['describe']()['then'](respondWithResult(_0xc6576b,null))[_0x66b0('0x40')](handleError(_0xc6576b,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 9dc2cd7..da09765 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 _0x55ca=['request-promise','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','bluebird'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x55ca,0x126));var _0xa55c=function(_0x21eb3c,_0x7ce88b){_0x21eb3c=_0x21eb3c-0x0;var _0x4bd2aa=_0x55ca[_0x21eb3c];return _0x4bd2aa;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var attributes=require('./smsTransferReport.attributes');module[_0xa55c('0x4')]=function(_0x2db02a,_0xcb02e3){return _0x2db02a[_0xa55c('0x5')](_0xa55c('0x6'),attributes,{'tableName':_0xa55c('0x7'),'paranoid':![],'indexes':[{'name':_0xa55c('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['moment','bluebird','request-promise','./smsTransferReport.attributes','SmsTransferReport','report_sms_transfer','uniqueid','../../config/logger','api'];(function(_0x4811c5,_0x2a5982){var _0x2950f8=function(_0x1c996e){while(--_0x1c996e){_0x4811c5['push'](_0x4811c5['shift']());}};_0x2950f8(++_0x2a5982);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var attributes=require(_0x49c4('0x5'));module['exports']=function(_0x4941f1,_0x41a183){return _0x4941f1['define'](_0x49c4('0x6'),attributes,{'tableName':_0x49c4('0x7'),'paranoid':![],'indexes':[{'name':_0x49c4('0x8'),'fields':[_0x49c4('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index ddb9142..9095981 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 _0x97db=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','ioredis'];(function(_0x4a97e5,_0x237903){var _0x59096d=function(_0x4cb3cf){while(--_0x4cb3cf){_0x4a97e5['push'](_0x4a97e5['shift']());}};_0x59096d(++_0x237903);}(_0x97db,0x1b4));var _0xb97d=function(_0x3b008f,_0x36ef68){_0x3b008f=_0x3b008f-0x0;var _0x3d876=_0x97db[_0x3b008f];return _0x3d876;};'use strict';var _=require(_0xb97d('0x0'));var util=require(_0xb97d('0x1'));var moment=require(_0xb97d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb97d('0x3'));var db=require(_0xb97d('0x4'))['db'];var utils=require(_0xb97d('0x5'));var logger=require(_0xb97d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb97d('0x7'));var client=jayson[_0xb97d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533149,_0x2ff80e,_0x57cbd4){return new BPromise(function(_0x20f1e1,_0x2e1230){return client['request'](_0x533149,_0x57cbd4)[_0xb97d('0x9')](function(_0xe9acff){logger[_0xb97d('0xa')](_0xb97d('0xb'),_0x2ff80e,'request\x20sent');logger[_0xb97d('0xc')](_0xb97d('0xd'),_0x2ff80e,_0xb97d('0xe'),JSON[_0xb97d('0xf')](_0xe9acff));if(_0xe9acff[_0xb97d('0x10')]){if(_0xe9acff[_0xb97d('0x10')][_0xb97d('0x11')]===0x1f4){logger[_0xb97d('0x10')](_0xb97d('0xb'),_0x2ff80e,_0xe9acff[_0xb97d('0x10')][_0xb97d('0x12')]);return _0x2e1230(_0xe9acff[_0xb97d('0x10')][_0xb97d('0x12')]);}logger[_0xb97d('0x10')](_0xb97d('0xb'),_0x2ff80e,_0xe9acff[_0xb97d('0x10')][_0xb97d('0x12')]);return _0x20f1e1(_0xe9acff[_0xb97d('0x10')]['message']);}else{logger[_0xb97d('0xa')](_0xb97d('0xb'),_0x2ff80e,_0xb97d('0xe'));_0x20f1e1(_0xe9acff[_0xb97d('0x13')][_0xb97d('0x12')]);}})['catch'](function(_0x416d6a){logger[_0xb97d('0x10')](_0xb97d('0xb'),_0x2ff80e,_0x416d6a);_0x2e1230(_0x416d6a);});});} \ No newline at end of file +var _0x117c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','catch','bluebird'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x117c,0x71));var _0xc117=function(_0x56fd29,_0x17790b){_0x56fd29=_0x56fd29-0x0;var _0x2a0bf7=_0x117c[_0x56fd29];return _0x2a0bf7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc117('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc117('0x1'))['db'];var utils=require(_0xc117('0x2'));var logger=require(_0xc117('0x3'))(_0xc117('0x4'));var config=require(_0xc117('0x5'));var jayson=require(_0xc117('0x6'));var client=jayson['client'][_0xc117('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x389734,_0x48efbb,_0x181a70){return new BPromise(function(_0x56c9bd,_0x451447){return client[_0xc117('0x8')](_0x389734,_0x181a70)[_0xc117('0x9')](function(_0x39e33f){logger[_0xc117('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x48efbb,_0xc117('0xb'));logger['debug'](_0xc117('0xc'),_0x48efbb,'request\x20sent',JSON[_0xc117('0xd')](_0x39e33f));if(_0x39e33f[_0xc117('0xe')]){if(_0x39e33f['error'][_0xc117('0xf')]===0x1f4){logger['error'](_0xc117('0x10'),_0x48efbb,_0x39e33f[_0xc117('0xe')][_0xc117('0x11')]);return _0x451447(_0x39e33f[_0xc117('0xe')]['message']);}logger[_0xc117('0xe')](_0xc117('0x10'),_0x48efbb,_0x39e33f[_0xc117('0xe')][_0xc117('0x11')]);return _0x56c9bd(_0x39e33f[_0xc117('0xe')][_0xc117('0x11')]);}else{logger[_0xc117('0xa')](_0xc117('0x10'),_0x48efbb,_0xc117('0xb'));_0x56c9bd(_0x39e33f['result']['message']);}})[_0xc117('0x12')](function(_0x241ee7){logger[_0xc117('0xe')](_0xc117('0x10'),_0x48efbb,_0x241ee7);_0x451447(_0x241ee7);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index d876fe4..3705476 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 _0xeeff=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','single','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0xeeff,0x11f));var _0xfeef=function(_0x469830,_0x584dea){_0x469830=_0x469830-0x0;var _0x503fed=_0xeeff[_0x469830];return _0x503fed;};'use strict';var multer=require(_0xfeef('0x0'));var util=require(_0xfeef('0x1'));var path=require('path');var timeout=require(_0xfeef('0x2'));var express=require(_0xfeef('0x3'));var router=express[_0xfeef('0x4')]();var auth=require(_0xfeef('0x5'));var interaction=require(_0xfeef('0x6'));var config=require(_0xfeef('0x7'));var controller=require('./sound.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfeef('0x8')](_0xfeef('0x9'),auth[_0xfeef('0xa')](),controller[_0xfeef('0xb')]);router[_0xfeef('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xfeef('0xc')]);var upload=multer({'storage':multer[_0xfeef('0xd')]({'destination':function(_0x1a7dc8,_0x15f711,_0x635357){_0x635357(null,path[_0xfeef('0xe')](config[_0xfeef('0xf')],_0xfeef('0x10')));},'filename':function(_0x104e51,_0x214be4,_0x154aa2){_0x214be4[_0xfeef('0x11')]=_0x214be4[_0xfeef('0x11')][_0xfeef('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x154aa2(null,util[_0xfeef('0x13')](_0xfeef('0x14'),path[_0xfeef('0x15')](_0x214be4[_0xfeef('0x11')],path['extname'](_0x214be4['originalname'])),Date['now'](),path[_0xfeef('0x16')](_0x214be4[_0xfeef('0x11')])));}})});router['post']('/',upload[_0xfeef('0x17')]('file'),controller[_0xfeef('0x18')]);router[_0xfeef('0x19')](_0xfeef('0x9'),auth['isAuthenticated'](),controller[_0xfeef('0x1a')]);router[_0xfeef('0x1b')](_0xfeef('0x9'),auth[_0xfeef('0xa')](),controller['delete']);module[_0xfeef('0x1c')]=router; \ No newline at end of file +var _0x3472=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','/:id/download','download','diskStorage','root','originalname','replace','format','basename','now','extname','post','single','file','put','/:id','update','delete','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3472,0x15d));var _0x2347=function(_0x21cb50,_0x3a5e8a){_0x21cb50=_0x21cb50-0x0;var _0x36ecca=_0x3472[_0x21cb50];return _0x36ecca;};'use strict';var multer=require(_0x2347('0x0'));var util=require(_0x2347('0x1'));var path=require(_0x2347('0x2'));var timeout=require(_0x2347('0x3'));var express=require(_0x2347('0x4'));var router=express[_0x2347('0x5')]();var auth=require(_0x2347('0x6'));var interaction=require(_0x2347('0x7'));var config=require(_0x2347('0x8'));var controller=require(_0x2347('0x9'));router[_0x2347('0xa')]('/',auth[_0x2347('0xb')](),controller[_0x2347('0xc')]);router[_0x2347('0xa')]('/:id',auth[_0x2347('0xb')](),controller[_0x2347('0xd')]);router[_0x2347('0xa')](_0x2347('0xe'),auth[_0x2347('0xb')](),controller[_0x2347('0xf')]);var upload=multer({'storage':multer[_0x2347('0x10')]({'destination':function(_0x445172,_0x3d680f,_0x2e8c3d){_0x2e8c3d(null,path['join'](config[_0x2347('0x11')],'server/files/sounds/original/'));},'filename':function(_0x4ced93,_0x52b609,_0x12f7fb){_0x52b609[_0x2347('0x12')]=_0x52b609[_0x2347('0x12')][_0x2347('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x12f7fb(null,util[_0x2347('0x14')]('%s-%s%s',path[_0x2347('0x15')](_0x52b609[_0x2347('0x12')],path['extname'](_0x52b609[_0x2347('0x12')])),Date[_0x2347('0x16')](),path[_0x2347('0x17')](_0x52b609['originalname'])));}})});router[_0x2347('0x18')]('/',upload[_0x2347('0x19')](_0x2347('0x1a')),controller['create']);router[_0x2347('0x1b')](_0x2347('0x1c'),auth[_0x2347('0xb')](),controller[_0x2347('0x1d')]);router['delete'](_0x2347('0x1c'),auth['isAuthenticated'](),controller[_0x2347('0x1e')]);module[_0x2347('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 1fe38f6..d140842 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 _0xb253=['INTEGER','BIGINT','exports','STRING','name','FLOAT'];(function(_0x35e575,_0x5bb50b){var _0x4afbd8=function(_0xa1b5fa){while(--_0xa1b5fa){_0x35e575['push'](_0x35e575['shift']());}};_0x4afbd8(++_0x5bb50b);}(_0xb253,0x8c));var _0x3b25=function(_0xec69df,_0x2a8cc1){_0xec69df=_0xec69df-0x0;var _0x23f3d1=_0xb253[_0xec69df];return _0x23f3d1;};'use strict';var Sequelize=require('sequelize');module[_0x3b25('0x0')]={'name':{'type':Sequelize[_0x3b25('0x1')],'unique':_0x3b25('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x3b25('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x3b25('0x1')]},'original_format':{'type':Sequelize[_0x3b25('0x1')]},'original_duration':{'type':Sequelize[_0x3b25('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x3b25('0x4')]},'original_bitRate':{'type':Sequelize[_0x3b25('0x5')]},'original_sampleRate':{'type':Sequelize[_0x3b25('0x4')]},'converted_format':{'type':Sequelize[_0x3b25('0x1')]},'converted_duration':{'type':Sequelize[_0x3b25('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x3b25('0x5')]},'converted_channelCount':{'type':Sequelize[_0x3b25('0x4')]},'converted_bitRate':{'type':Sequelize[_0x3b25('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x411d=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x4e17eb,_0x59cd5a){var _0x1d7f0a=function(_0xed3cd){while(--_0xed3cd){_0x4e17eb['push'](_0x4e17eb['shift']());}};_0x1d7f0a(++_0x59cd5a);}(_0x411d,0xb7));var _0xd411=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x411d[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xd411('0x0'));module[_0xd411('0x1')]={'name':{'type':Sequelize[_0xd411('0x2')],'unique':_0xd411('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xd411('0x2')]},'display_name':{'type':Sequelize[_0xd411('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xd411('0x2')]},'original_format':{'type':Sequelize[_0xd411('0x2')]},'original_duration':{'type':Sequelize[_0xd411('0x4')]},'original_sampleCount':{'type':Sequelize[_0xd411('0x5')]},'original_channelCount':{'type':Sequelize[_0xd411('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xd411('0x6')]},'converted_format':{'type':Sequelize[_0xd411('0x2')]},'converted_duration':{'type':Sequelize[_0xd411('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xd411('0x5')]},'converted_channelCount':{'type':Sequelize[_0xd411('0x6')]},'converted_bitRate':{'type':Sequelize[_0xd411('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 347073c..65523fb 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 _0xc4aa=['attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','key','field','includeAll','include','findAll','rows','params','options','find','catch','download','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Sounds','sendStatus','error','stack','name','send','index','Sound','rawAttributes','query','keys','filters','intersection','fields'];(function(_0x26c20f,_0x3d6b21){var _0x486020=function(_0xba05f1){while(--_0xba05f1){_0x26c20f['push'](_0x26c20f['shift']());}};_0x486020(++_0x3d6b21);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4aa[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0xac4a('0x10'));var Redis=require(_0xac4a('0x11'));var qs=require(_0xac4a('0x12'));var logger=require('../../config/logger')(_0xac4a('0x13'));var utils=require('../../config/utils');var config=require(_0xac4a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x333ca5,_0x2a0776){_0x2a0776=_0x2a0776||0xcc;return function(_0x24291d){if(_0x24291d){return _0x333ca5['sendStatus'](_0x2a0776);}return _0x333ca5[_0xac4a('0x15')](_0x2a0776)[_0xac4a('0x16')]();};}function respondWithResult(_0x247b78,_0x6e00d4){_0x6e00d4=_0x6e00d4||0xc8;return function(_0x1b4313){if(_0x1b4313){return _0x247b78[_0xac4a('0x15')](_0x6e00d4)[_0xac4a('0x17')](_0x1b4313);}};}function respondWithFilteredResult(_0x33c287,_0x190418){return function(_0x42c7fc){if(_0x42c7fc){var _0x11e101=_0x42c7fc[_0xac4a('0x18')],_0x26dbb8=_0x190418[_0xac4a('0x19')],_0x4a2119=_0x190418[_0xac4a('0x19')]+_0x190418[_0xac4a('0x1a')],_0x402fff;if(_0x4a2119>=_0x11e101){_0x4a2119=_0x11e101;_0x402fff=0xc8;}else{_0x402fff=0xce;}_0x33c287[_0xac4a('0x15')](_0x402fff);return _0x33c287[_0xac4a('0x1b')](_0xac4a('0x1c'),_0x26dbb8+'-'+_0x4a2119+'/'+_0x11e101)['json'](_0x42c7fc);}return null;};}function patchUpdates(_0x5ac21e){return function(_0x21a729){try{jsonpatch[_0xac4a('0x1d')](_0x21a729,_0x5ac21e,!![]);}catch(_0x39b691){return BPromise['reject'](_0x39b691);}return _0x21a729[_0xac4a('0x1e')]();};}function saveUpdates(_0x15c223,_0x3752e4){return function(_0x3a3cdb){if(_0x3a3cdb){return _0x3a3cdb[_0xac4a('0x1f')](_0x15c223)[_0xac4a('0x20')](function(_0xe38996){return _0xe38996;});}return null;};}function removeEntity(_0x3ca790,_0x534092){return function(_0x3d8f0a){if(_0x3d8f0a){return _0x3d8f0a[_0xac4a('0x21')]()['then'](function(){var _0x3d7ce0=_0x3d8f0a[_0xac4a('0x22')]({'plain':!![]});var _0x3eacd3=_0xac4a('0x23');return db['UserProfileResource'][_0xac4a('0x21')]({'where':{'type':_0x3eacd3,'resourceId':_0x3d7ce0['id']}})[_0xac4a('0x20')](function(){return _0x3d8f0a;});})[_0xac4a('0x20')](function(){_0x3ca790[_0xac4a('0x15')](0xcc)[_0xac4a('0x16')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x24')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x25')](_0x215a31[_0xac4a('0x26')]);if(_0x215a31[_0xac4a('0x27')]){delete _0x215a31[_0xac4a('0x27')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x28')](_0x215a31);};}exports[_0xac4a('0x29')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=db[_0xac4a('0x2a')][_0xac4a('0x2b')];_0x4a5a9e['model']=_['keys'](_0xdb7e);_0x4a5a9e[_0xac4a('0x2c')]=_[_0xac4a('0x2d')](_0x42a33c[_0xac4a('0x2c')]);_0x4a5a9e[_0xac4a('0x2e')]=_[_0xac4a('0x2f')](_0x4a5a9e['model'],_0x4a5a9e[_0xac4a('0x2c')]);_0x116700['attributes']=_[_0xac4a('0x2f')](_0x4a5a9e['model'],qs[_0xac4a('0x30')](_0x42a33c[_0xac4a('0x2c')][_0xac4a('0x30')]));_0x116700[_0xac4a('0x31')]=_0x116700[_0xac4a('0x31')][_0xac4a('0x32')]?_0x116700[_0xac4a('0x31')]:_0x4a5a9e[_0xac4a('0x33')];if(!_0x42a33c[_0xac4a('0x2c')][_0xac4a('0x34')](_0xac4a('0x35'))){_0x116700[_0xac4a('0x1a')]=qs[_0xac4a('0x1a')](_0x42a33c[_0xac4a('0x2c')]['limit']);_0x116700[_0xac4a('0x19')]=qs[_0xac4a('0x19')](_0x42a33c['query'][_0xac4a('0x19')]);}_0x116700[_0xac4a('0x36')]=qs['sort'](_0x42a33c['query'][_0xac4a('0x37')]);_0x116700[_0xac4a('0x38')]=qs[_0xac4a('0x2e')](_[_0xac4a('0x39')](_0x42a33c['query'],_0x4a5a9e[_0xac4a('0x2e')]));if(_0x42a33c[_0xac4a('0x2c')]['filter']){_0x116700[_0xac4a('0x38')]=_[_0xac4a('0x3a')](_0x116700[_0xac4a('0x38')],{'$or':_['map'](_0xdb7e,function(_0x121328){if(_0x121328[_0xac4a('0x3b')][_0xac4a('0x3c')]!=='VIRTUAL'){var _0x35bc94={};_0x35bc94[_0x121328[_0xac4a('0x3d')]]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x35bc94;}})});}_0x116700=_[_0xac4a('0x3a')]({},_0x116700,_0x42a33c['options']);var _0x50e03e={'where':_0x116700['where']};return db['Sound'][_0xac4a('0x18')](_0x50e03e)[_0xac4a('0x20')](function(_0x37834b){_0x47f49c[_0xac4a('0x18')]=_0x37834b;if(_0x42a33c[_0xac4a('0x2c')][_0xac4a('0x3e')]){_0x116700[_0xac4a('0x3f')]=[{'all':!![]}];}return db[_0xac4a('0x2a')][_0xac4a('0x40')](_0x116700);})[_0xac4a('0x20')](function(_0x14f7d5){_0x47f49c[_0xac4a('0x41')]=_0x14f7d5;return _0x47f49c;})['then'](respondWithFilteredResult(_0x2772fe,_0x116700))['catch'](handleError(_0x2772fe,null));};exports['show']=function(_0x1e1cc5,_0x5c46a){var _0x14e80b={'raw':!![],'where':{'id':_0x1e1cc5[_0xac4a('0x42')]['id']}},_0x118be0={};_0x118be0[_0xac4a('0x33')]=_[_0xac4a('0x2d')](db[_0xac4a('0x2a')][_0xac4a('0x2b')]);_0x118be0[_0xac4a('0x2c')]=_['keys'](_0x1e1cc5[_0xac4a('0x2c')]);_0x118be0[_0xac4a('0x2e')]=_[_0xac4a('0x2f')](_0x118be0[_0xac4a('0x33')],_0x118be0[_0xac4a('0x2c')]);_0x14e80b['attributes']=_[_0xac4a('0x2f')](_0x118be0[_0xac4a('0x33')],qs['fields'](_0x1e1cc5[_0xac4a('0x2c')]['fields']));_0x14e80b[_0xac4a('0x31')]=_0x14e80b[_0xac4a('0x31')][_0xac4a('0x32')]?_0x14e80b[_0xac4a('0x31')]:_0x118be0[_0xac4a('0x33')];if(_0x1e1cc5[_0xac4a('0x2c')][_0xac4a('0x3e')]){_0x14e80b[_0xac4a('0x3f')]=[{'all':!![]}];}_0x14e80b=_[_0xac4a('0x3a')]({},_0x14e80b,_0x1e1cc5[_0xac4a('0x43')]);return db[_0xac4a('0x2a')][_0xac4a('0x44')](_0x14e80b)['then'](handleEntityNotFound(_0x5c46a,null))[_0xac4a('0x20')](respondWithResult(_0x5c46a,null))[_0xac4a('0x45')](handleError(_0x5c46a,null));};exports[_0xac4a('0x46')]=function(_0x58759a,_0x1764bf,_0x19276e){return db['Sound'][_0xac4a('0x44')]({'where':{'id':_0x58759a['params']['id']},'attributes':[_0xac4a('0x27'),_0xac4a('0x47'),_0xac4a('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x1764bf,null))['then'](function(_0x42fd9d){if(_0x42fd9d){if(!fs['existsSync'](path[_0xac4a('0x49')](config['root'],_0xac4a('0x4a'),_0x42fd9d['save_name']+'.'+_0x42fd9d[_0xac4a('0x48')]))){throw new db[(_0xac4a('0x4b'))][(_0xac4a('0x4c'))](_0xac4a('0x4d'));}return _0x1764bf['download'](path[_0xac4a('0x49')](config[_0xac4a('0x4e')],_0xac4a('0x4a'),util[_0xac4a('0x4f')](_0xac4a('0x50'),_0x42fd9d[_0xac4a('0x47')],_0x42fd9d[_0xac4a('0x48')])),util['format'](_0xac4a('0x50'),_0x42fd9d[_0xac4a('0x27')],_0x42fd9d['converted_format']));}return null;})[_0xac4a('0x45')](handleError(_0x1764bf,null));};exports[_0xac4a('0x51')]=function(_0x26e716,_0x3ac36e,_0x4bb2fb){var _0x3bd846={'name':path[_0xac4a('0x52')](_0x26e716[_0xac4a('0x53')][_0xac4a('0x54')],path[_0xac4a('0x55')](_0x26e716['file'][_0xac4a('0x54')])),'save_name':path['basename'](_0x26e716[_0xac4a('0x53')][_0xac4a('0x56')],path['extname'](_0x26e716['file'][_0xac4a('0x56')])),'original_format':path[_0xac4a('0x55')](_0x26e716['file'][_0xac4a('0x54')])[_0xac4a('0x57')](0x1),'converted_format':_0xac4a('0x58')};var _0x103d05=path['join'](config[_0xac4a('0x4e')],_0xac4a('0x59'),_0x26e716[_0xac4a('0x53')][_0xac4a('0x56')]);var _0xdc80e3=path[_0xac4a('0x49')](config[_0xac4a('0x4e')],'server/files/sounds/converted',util[_0xac4a('0x4f')](_0xac4a('0x50'),path[_0xac4a('0x52')](_0x26e716[_0xac4a('0x53')][_0xac4a('0x56')],path[_0xac4a('0x55')](_0x26e716[_0xac4a('0x53')][_0xac4a('0x56')])),_0x3bd846[_0xac4a('0x48')]));logger[_0xac4a('0x5a')](_0xac4a('0x5b'),_0x103d05);logger[_0xac4a('0x5a')](_0xac4a('0x5c'),_0xdc80e3);try{fs[_0xac4a('0x5d')](_0x103d05,parseInt(_0xac4a('0x5e'),0x8));var _0x11c753=sox['transcode'](_0x103d05,_0xdc80e3,{'sampleRate':0x1f40,'format':_0xac4a('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x11c753['on']('error',function(_0x2d598e){fs['unlinkSync'](_0x103d05);_0x3ac36e[_0xac4a('0x15')](0x1f4)['send'](_0x2d598e);});_0x11c753['on'](_0xac4a('0x5f'),function(_0x5cac9b){_0x3bd846['original_duration']=isNaN(_0x5cac9b[_0xac4a('0x60')])?null:_0x5cac9b[_0xac4a('0x60')]*0x3e8;_0x3bd846[_0xac4a('0x61')]=isNaN(_0x5cac9b[_0xac4a('0x62')])?null:_0x5cac9b[_0xac4a('0x62')];_0x3bd846[_0xac4a('0x63')]=isNaN(_0x5cac9b['channelCount'])?null:_0x5cac9b[_0xac4a('0x64')];_0x3bd846['original_bitRate']=isNaN(_0x5cac9b[_0xac4a('0x65')])?null:_0x5cac9b['bitRate'];_0x3bd846[_0xac4a('0x66')]=isNaN(_0x5cac9b[_0xac4a('0x67')])?null:_0x5cac9b[_0xac4a('0x67')];});_0x11c753['on'](_0xac4a('0x68'),function(_0x429273){_0x3bd846[_0xac4a('0x69')]=isNaN(_0x429273[_0xac4a('0x60')])?null:_0x429273[_0xac4a('0x60')]*0x3e8;_0x3bd846[_0xac4a('0x6a')]=isNaN(_0x429273[_0xac4a('0x62')])?null:_0x429273[_0xac4a('0x62')];_0x3bd846[_0xac4a('0x6b')]=isNaN(_0x429273[_0xac4a('0x64')])?null:_0x429273[_0xac4a('0x64')];_0x3bd846[_0xac4a('0x6c')]=isNaN(_0x429273[_0xac4a('0x65')])?null:_0x429273[_0xac4a('0x65')];_0x3bd846['converted_sampleRate']=isNaN(_0x429273[_0xac4a('0x67')])?null:_0x429273[_0xac4a('0x67')];});_0x11c753['on']('end',function(){fs[_0xac4a('0x5d')](_0xdc80e3,parseInt(_0xac4a('0x5e'),0x8));return db[_0xac4a('0x2a')][_0xac4a('0x51')](_0x3bd846)[_0xac4a('0x20')](function(_0x4d1440){var _0x47c6d8={'role':_0x26e716[_0xac4a('0x6d')][_0xac4a('0x6e')],'userProfileId':_0x26e716[_0xac4a('0x6d')][_0xac4a('0x6f')]};if(!_0x47c6d8)throw new Error(_0xac4a('0x70'));if(_0x47c6d8[_0xac4a('0x6e')]===_0xac4a('0x71')){var _0x2988d7=_0x4d1440[_0xac4a('0x22')]({'plain':!![]});return db[_0xac4a('0x72')][_0xac4a('0x44')]({'where':{'name':'Sounds','userProfileId':_0x47c6d8['userProfileId']},'raw':!![]})[_0xac4a('0x20')](function(_0x1febff){if(_0x1febff&&_0x1febff[_0xac4a('0x73')]===0x0){return db[_0xac4a('0x74')][_0xac4a('0x51')]({'name':_0x2988d7[_0xac4a('0x27')],'resourceId':_0x2988d7['id'],'type':_0x1febff[_0xac4a('0x27')],'sectionId':_0x1febff['id']},{})[_0xac4a('0x20')](function(){return _0x4d1440;});}else{return _0x4d1440;}})[_0xac4a('0x45')](function(_0x2a5acc){logger[_0xac4a('0x25')](_0xac4a('0x75'),_0x2a5acc);throw _0x2a5acc;});}return _0x4d1440;})['then'](respondWithResult(_0x3ac36e,null))[_0xac4a('0x45')](handleError(_0x3ac36e,null));});_0x11c753[_0xac4a('0x76')]();}catch(_0x26bd31){_0x3ac36e[_0xac4a('0x15')](0x1f4)['send'](_0x26bd31);}};exports[_0xac4a('0x1f')]=function(_0x5a30af,_0xab4305,_0x3af39a){return db['Sound']['find']({'where':{'id':_0x5a30af[_0xac4a('0x42')]['id']}})[_0xac4a('0x20')](handleEntityNotFound(_0xab4305,null))[_0xac4a('0x20')](saveUpdates(_['pick'](_0x5a30af[_0xac4a('0x6d')],['name',_0xac4a('0x77')]),null))['then'](respondWithResult(_0xab4305,null))['catch'](handleError(_0xab4305,null));};exports[_0xac4a('0x78')]=function(_0x56ef2a,_0xb776c4,_0x5df028){return db[_0xac4a('0x2a')][_0xac4a('0x44')]({'where':{'id':_0x56ef2a['params']['id']}})[_0xac4a('0x20')](function(_0x54fa7a){if(_0x54fa7a){return _0x54fa7a[_0xac4a('0x21')]();}})[_0xac4a('0x20')](function(_0x522949){var _0x12f1b2=path['join'](config['root'],_0xac4a('0x59'),util['format'](_0xac4a('0x50'),_0x522949['save_name'],_0x522949['original_format']));var _0x1588e2=path[_0xac4a('0x49')](config[_0xac4a('0x4e')],'server/files/sounds/converted',util['format'](_0xac4a('0x50'),_0x522949[_0xac4a('0x47')],_0x522949['converted_format']));fs['unlinkSync'](_0x12f1b2);fs[_0xac4a('0x79')](_0x1588e2);return _0x522949;})[_0xac4a('0x20')](function(_0x347c73){if(_0x347c73){return _0xb776c4[_0xac4a('0x15')](0xcc)[_0xac4a('0x16')]();}})[_0xac4a('0x20')](handleEntityNotFound(_0xb776c4,null))[_0xac4a('0x45')](handleError(_0xb776c4,null));}; \ No newline at end of file +var _0x6d38=['original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','server/files/sounds/original','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','../../config/license/hardware','ioredis','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','then','destroy','Sounds','UserProfileResource','stack','name','send','index','Sound','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','params','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','basename','file','originalname','extname','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','duration'];(function(_0x4f1c49,_0x12b1e7){var _0x2a467a=function(_0x558a8b){while(--_0x558a8b){_0x4f1c49['push'](_0x4f1c49['shift']());}};_0x2a467a(++_0x12b1e7);}(_0x6d38,0x1ef));var _0x86d3=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6d38[_0x5f0089];return _0x193892;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x86d3('0x0'));var rimraf=require(_0x86d3('0x1'));var zipdir=require(_0x86d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x86d3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x86d3('0x4'));var util=require(_0x86d3('0x5'));var path=require(_0x86d3('0x6'));var sox=require('sox');var csv=require(_0x86d3('0x7'));var ejs=require(_0x86d3('0x8'));var fs=require('fs');var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0x7'));var querystring=require(_0x86d3('0xc'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x86d3('0xd'));var Redis=require(_0x86d3('0xe'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x86d3('0xf'));var utils=require(_0x86d3('0x10'));var config=require('../../config/environment');var db=require(_0x86d3('0x11'))['db'];function respondWithStatusCode(_0x5e9606,_0x1a98e8){_0x1a98e8=_0x1a98e8||0xcc;return function(_0x7d4d2e){if(_0x7d4d2e){return _0x5e9606[_0x86d3('0x12')](_0x1a98e8);}return _0x5e9606[_0x86d3('0x13')](_0x1a98e8)[_0x86d3('0x14')]();};}function respondWithResult(_0x1b8d0a,_0xbbca86){_0xbbca86=_0xbbca86||0xc8;return function(_0x12ef4a){if(_0x12ef4a){return _0x1b8d0a['status'](_0xbbca86)[_0x86d3('0x15')](_0x12ef4a);}};}function respondWithFilteredResult(_0x1f35cf,_0x356e7d){return function(_0x207f6f){if(_0x207f6f){var _0x1ea535=_0x207f6f['count'],_0x34fb3b=_0x356e7d[_0x86d3('0x16')],_0x1ff008=_0x356e7d[_0x86d3('0x16')]+_0x356e7d[_0x86d3('0x17')],_0x44436d;if(_0x1ff008>=_0x1ea535){_0x1ff008=_0x1ea535;_0x44436d=0xc8;}else{_0x44436d=0xce;}_0x1f35cf[_0x86d3('0x13')](_0x44436d);return _0x1f35cf[_0x86d3('0x18')](_0x86d3('0x19'),_0x34fb3b+'-'+_0x1ff008+'/'+_0x1ea535)[_0x86d3('0x15')](_0x207f6f);}return null;};}function patchUpdates(_0x32dee7){return function(_0x9b76f2){try{jsonpatch['apply'](_0x9b76f2,_0x32dee7,!![]);}catch(_0x191ba5){return BPromise['reject'](_0x191ba5);}return _0x9b76f2[_0x86d3('0x1a')]();};}function saveUpdates(_0x5c4d55,_0x52293e){return function(_0x41486a){if(_0x41486a){return _0x41486a[_0x86d3('0x1b')](_0x5c4d55)[_0x86d3('0x1c')](function(_0x1720ae){return _0x1720ae;});}return null;};}function removeEntity(_0x5654ab,_0x2901de){return function(_0x55e1c3){if(_0x55e1c3){return _0x55e1c3[_0x86d3('0x1d')]()[_0x86d3('0x1c')](function(){var _0x1ce849=_0x55e1c3['get']({'plain':!![]});var _0x39d819=_0x86d3('0x1e');return db[_0x86d3('0x1f')]['destroy']({'where':{'type':_0x39d819,'resourceId':_0x1ce849['id']}})['then'](function(){return _0x55e1c3;});})[_0x86d3('0x1c')](function(){_0x5654ab['status'](0xcc)[_0x86d3('0x14')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x20')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x21')];}_0x481077[_0x86d3('0x13')](_0x3359e4)[_0x86d3('0x22')](_0x611764);};}exports[_0x86d3('0x23')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=db[_0x86d3('0x24')][_0x86d3('0x25')];_0x35d708[_0x86d3('0x26')]=_[_0x86d3('0x27')](_0x44dacf);_0x35d708['query']=_[_0x86d3('0x27')](_0x11a6fd[_0x86d3('0x28')]);_0x35d708[_0x86d3('0x29')]=_[_0x86d3('0x2a')](_0x35d708[_0x86d3('0x26')],_0x35d708[_0x86d3('0x28')]);_0x1f203e['attributes']=_[_0x86d3('0x2a')](_0x35d708['model'],qs['fields'](_0x11a6fd[_0x86d3('0x28')][_0x86d3('0x2b')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e['attributes'][_0x86d3('0x2d')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708['model'];if(!_0x11a6fd[_0x86d3('0x28')][_0x86d3('0x2e')](_0x86d3('0x2f'))){_0x1f203e[_0x86d3('0x17')]=qs[_0x86d3('0x17')](_0x11a6fd[_0x86d3('0x28')][_0x86d3('0x17')]);_0x1f203e[_0x86d3('0x16')]=qs['offset'](_0x11a6fd['query']['offset']);}_0x1f203e[_0x86d3('0x30')]=qs['sort'](_0x11a6fd[_0x86d3('0x28')]['sort']);_0x1f203e[_0x86d3('0x31')]=qs[_0x86d3('0x29')](_[_0x86d3('0x32')](_0x11a6fd[_0x86d3('0x28')],_0x35d708[_0x86d3('0x29')]));if(_0x11a6fd[_0x86d3('0x28')][_0x86d3('0x33')]){_0x1f203e['where']=_[_0x86d3('0x34')](_0x1f203e[_0x86d3('0x31')],{'$or':_['map'](_0x44dacf,function(_0x178fc6){if(_0x178fc6[_0x86d3('0x35')][_0x86d3('0x36')]!==_0x86d3('0x37')){var _0x53f549={};_0x53f549[_0x178fc6[_0x86d3('0x38')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x28')][_0x86d3('0x33')]+'%'};return _0x53f549;}})});}_0x1f203e=_['merge']({},_0x1f203e,_0x11a6fd[_0x86d3('0x39')]);var _0x15987d={'where':_0x1f203e[_0x86d3('0x31')]};return db[_0x86d3('0x24')][_0x86d3('0x3a')](_0x15987d)[_0x86d3('0x1c')](function(_0x3666fc){_0x303f13[_0x86d3('0x3a')]=_0x3666fc;if(_0x11a6fd['query'][_0x86d3('0x3b')]){_0x1f203e[_0x86d3('0x3c')]=[{'all':!![]}];}return db[_0x86d3('0x24')][_0x86d3('0x3d')](_0x1f203e);})['then'](function(_0x1231ee){_0x303f13[_0x86d3('0x3e')]=_0x1231ee;return _0x303f13;})[_0x86d3('0x1c')](respondWithFilteredResult(_0x14c9ff,_0x1f203e))[_0x86d3('0x3f')](handleError(_0x14c9ff,null));};exports['show']=function(_0x587747,_0x10978b){var _0x4f422b={'raw':!![],'where':{'id':_0x587747[_0x86d3('0x40')]['id']}},_0x53545a={};_0x53545a[_0x86d3('0x26')]=_[_0x86d3('0x27')](db[_0x86d3('0x24')][_0x86d3('0x25')]);_0x53545a['query']=_[_0x86d3('0x27')](_0x587747[_0x86d3('0x28')]);_0x53545a[_0x86d3('0x29')]=_['intersection'](_0x53545a[_0x86d3('0x26')],_0x53545a[_0x86d3('0x28')]);_0x4f422b['attributes']=_[_0x86d3('0x2a')](_0x53545a[_0x86d3('0x26')],qs['fields'](_0x587747['query']['fields']));_0x4f422b[_0x86d3('0x2c')]=_0x4f422b[_0x86d3('0x2c')][_0x86d3('0x2d')]?_0x4f422b[_0x86d3('0x2c')]:_0x53545a[_0x86d3('0x26')];if(_0x587747[_0x86d3('0x28')]['includeAll']){_0x4f422b[_0x86d3('0x3c')]=[{'all':!![]}];}_0x4f422b=_[_0x86d3('0x34')]({},_0x4f422b,_0x587747['options']);return db[_0x86d3('0x24')][_0x86d3('0x41')](_0x4f422b)[_0x86d3('0x1c')](handleEntityNotFound(_0x10978b,null))[_0x86d3('0x1c')](respondWithResult(_0x10978b,null))[_0x86d3('0x3f')](handleError(_0x10978b,null));};exports[_0x86d3('0x42')]=function(_0x4e2cf6,_0x318e1a,_0x474310){return db['Sound'][_0x86d3('0x41')]({'where':{'id':_0x4e2cf6[_0x86d3('0x40')]['id']},'attributes':[_0x86d3('0x21'),_0x86d3('0x43'),_0x86d3('0x44')],'raw':!![]})['then'](handleEntityNotFound(_0x318e1a,null))[_0x86d3('0x1c')](function(_0x3e6620){if(_0x3e6620){if(!fs[_0x86d3('0x45')](path[_0x86d3('0x46')](config[_0x86d3('0x47')],_0x86d3('0x48'),_0x3e6620[_0x86d3('0x43')]+'.'+_0x3e6620[_0x86d3('0x44')]))){throw new db[(_0x86d3('0x49'))][(_0x86d3('0x4a'))](_0x86d3('0x4b'));}return _0x318e1a[_0x86d3('0x42')](path['join'](config[_0x86d3('0x47')],_0x86d3('0x48'),util['format'](_0x86d3('0x4c'),_0x3e6620[_0x86d3('0x43')],_0x3e6620[_0x86d3('0x44')])),util[_0x86d3('0x4d')](_0x86d3('0x4c'),_0x3e6620[_0x86d3('0x21')],_0x3e6620['converted_format']));}return null;})['catch'](handleError(_0x318e1a,null));};exports['create']=function(_0x5bedc6,_0x159253,_0x3636ae){var _0x2ca2a4={'name':path[_0x86d3('0x4e')](_0x5bedc6[_0x86d3('0x4f')][_0x86d3('0x50')],path[_0x86d3('0x51')](_0x5bedc6['file'][_0x86d3('0x50')])),'save_name':path[_0x86d3('0x4e')](_0x5bedc6[_0x86d3('0x4f')][_0x86d3('0x52')],path[_0x86d3('0x51')](_0x5bedc6[_0x86d3('0x4f')][_0x86d3('0x52')])),'original_format':path['extname'](_0x5bedc6[_0x86d3('0x4f')]['originalname'])[_0x86d3('0x53')](0x1),'converted_format':_0x86d3('0x54')};var _0xd072f2=path[_0x86d3('0x46')](config[_0x86d3('0x47')],'server/files/sounds/original',_0x5bedc6[_0x86d3('0x4f')][_0x86d3('0x52')]);var _0x1908ff=path['join'](config['root'],'server/files/sounds/converted',util[_0x86d3('0x4d')]('%s.%s',path[_0x86d3('0x4e')](_0x5bedc6[_0x86d3('0x4f')][_0x86d3('0x52')],path[_0x86d3('0x51')](_0x5bedc6['file']['filename'])),_0x2ca2a4['converted_format']));logger[_0x86d3('0x55')](_0x86d3('0x56'),_0xd072f2);logger['info'](_0x86d3('0x57'),_0x1908ff);try{fs[_0x86d3('0x58')](_0xd072f2,parseInt(_0x86d3('0x59'),0x8));var _0x4584e5=sox[_0x86d3('0x5a')](_0xd072f2,_0x1908ff,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4584e5['on'](_0x86d3('0x5b'),function(_0x1c134b){fs[_0x86d3('0x5c')](_0xd072f2);_0x159253[_0x86d3('0x13')](0x1f4)['send'](_0x1c134b);});_0x4584e5['on'](_0x86d3('0x5d'),function(_0x41fad7){_0x2ca2a4['original_duration']=isNaN(_0x41fad7[_0x86d3('0x5e')])?null:_0x41fad7[_0x86d3('0x5e')]*0x3e8;_0x2ca2a4[_0x86d3('0x5f')]=isNaN(_0x41fad7[_0x86d3('0x60')])?null:_0x41fad7[_0x86d3('0x60')];_0x2ca2a4[_0x86d3('0x61')]=isNaN(_0x41fad7[_0x86d3('0x62')])?null:_0x41fad7['channelCount'];_0x2ca2a4['original_bitRate']=isNaN(_0x41fad7[_0x86d3('0x63')])?null:_0x41fad7['bitRate'];_0x2ca2a4['original_sampleRate']=isNaN(_0x41fad7['sampleRate'])?null:_0x41fad7[_0x86d3('0x64')];});_0x4584e5['on']('dest',function(_0x254ac3){_0x2ca2a4['converted_duration']=isNaN(_0x254ac3[_0x86d3('0x5e')])?null:_0x254ac3[_0x86d3('0x5e')]*0x3e8;_0x2ca2a4[_0x86d3('0x65')]=isNaN(_0x254ac3['sampleCount'])?null:_0x254ac3['sampleCount'];_0x2ca2a4[_0x86d3('0x66')]=isNaN(_0x254ac3[_0x86d3('0x62')])?null:_0x254ac3[_0x86d3('0x62')];_0x2ca2a4[_0x86d3('0x67')]=isNaN(_0x254ac3[_0x86d3('0x63')])?null:_0x254ac3[_0x86d3('0x63')];_0x2ca2a4[_0x86d3('0x68')]=isNaN(_0x254ac3[_0x86d3('0x64')])?null:_0x254ac3[_0x86d3('0x64')];});_0x4584e5['on'](_0x86d3('0x14'),function(){fs[_0x86d3('0x58')](_0x1908ff,parseInt(_0x86d3('0x59'),0x8));return db[_0x86d3('0x24')][_0x86d3('0x69')](_0x2ca2a4)[_0x86d3('0x1c')](function(_0x5e1835){var _0x1cd730={'role':_0x5bedc6[_0x86d3('0x6a')]['role'],'userProfileId':_0x5bedc6[_0x86d3('0x6a')][_0x86d3('0x6b')]};if(!_0x1cd730)throw new Error(_0x86d3('0x6c'));if(_0x1cd730['role']===_0x86d3('0x6d')){var _0x307baf=_0x5e1835[_0x86d3('0x6e')]({'plain':!![]});return db[_0x86d3('0x6f')]['find']({'where':{'name':_0x86d3('0x1e'),'userProfileId':_0x1cd730['userProfileId']},'raw':!![]})[_0x86d3('0x1c')](function(_0x42bb6f){if(_0x42bb6f&&_0x42bb6f[_0x86d3('0x70')]===0x0){return db[_0x86d3('0x1f')][_0x86d3('0x69')]({'name':_0x307baf['name'],'resourceId':_0x307baf['id'],'type':_0x42bb6f[_0x86d3('0x21')],'sectionId':_0x42bb6f['id']},{})['then'](function(){return _0x5e1835;});}else{return _0x5e1835;}})[_0x86d3('0x3f')](function(_0x11a01a){logger['error'](_0x86d3('0x71'),_0x11a01a);throw _0x11a01a;});}return _0x5e1835;})[_0x86d3('0x1c')](respondWithResult(_0x159253,null))[_0x86d3('0x3f')](handleError(_0x159253,null));});_0x4584e5[_0x86d3('0x72')]();}catch(_0x308fed){_0x159253[_0x86d3('0x13')](0x1f4)[_0x86d3('0x22')](_0x308fed);}};exports['update']=function(_0x19f9e1,_0x1a1a3e,_0x279951){return db[_0x86d3('0x24')][_0x86d3('0x41')]({'where':{'id':_0x19f9e1['params']['id']}})[_0x86d3('0x1c')](handleEntityNotFound(_0x1a1a3e,null))[_0x86d3('0x1c')](saveUpdates(_['pick'](_0x19f9e1[_0x86d3('0x6a')],[_0x86d3('0x21'),_0x86d3('0x73')]),null))[_0x86d3('0x1c')](respondWithResult(_0x1a1a3e,null))[_0x86d3('0x3f')](handleError(_0x1a1a3e,null));};exports[_0x86d3('0x74')]=function(_0x1bf5ba,_0x447ae6,_0x2be56e){return db[_0x86d3('0x24')][_0x86d3('0x41')]({'where':{'id':_0x1bf5ba[_0x86d3('0x40')]['id']}})[_0x86d3('0x1c')](function(_0xab8a80){if(_0xab8a80){return _0xab8a80['destroy']();}})[_0x86d3('0x1c')](function(_0x3fa37c){var _0xc14014=path[_0x86d3('0x46')](config['root'],_0x86d3('0x75'),util[_0x86d3('0x4d')](_0x86d3('0x4c'),_0x3fa37c[_0x86d3('0x43')],_0x3fa37c['original_format']));var _0x507e32=path[_0x86d3('0x46')](config['root'],_0x86d3('0x48'),util['format']('%s.%s',_0x3fa37c[_0x86d3('0x43')],_0x3fa37c[_0x86d3('0x44')]));fs[_0x86d3('0x5c')](_0xc14014);fs[_0x86d3('0x5c')](_0x507e32);return _0x3fa37c;})[_0x86d3('0x1c')](function(_0x5841d6){if(_0x5841d6){return _0x447ae6[_0x86d3('0x13')](0xcc)[_0x86d3('0x14')]();}})['then'](handleEntityNotFound(_0x447ae6,null))[_0x86d3('0x3f')](handleError(_0x447ae6,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ee3df6e..47461ac 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 _0xcef7=['request-promise','./sound.attributes','exports','tools_sounds','util','../../config/logger','api','bluebird'];(function(_0x3d7f6d,_0x3387e5){var _0x23d7d5=function(_0x137b19){while(--_0x137b19){_0x3d7f6d['push'](_0x3d7f6d['shift']());}};_0x23d7d5(++_0x3387e5);}(_0xcef7,0x174));var _0x7cef=function(_0x9b5f26,_0x3bff96){_0x9b5f26=_0x9b5f26-0x0;var _0x2279d1=_0xcef7[_0x9b5f26];return _0x2279d1;};'use strict';var _=require('lodash');var util=require(_0x7cef('0x0'));var logger=require(_0x7cef('0x1'))(_0x7cef('0x2'));var moment=require('moment');var BPromise=require(_0x7cef('0x3'));var rp=require(_0x7cef('0x4'));var attributes=require(_0x7cef('0x5'));module[_0x7cef('0x6')]=function(_0x1da0b2,_0x233391){return _0x1da0b2['define']('Sound',attributes,{'tableName':_0x7cef('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7a2=['api','bluebird','request-promise','./sound.attributes','exports','Sound','tools_sounds','lodash','../../config/logger'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0xb7a2,0x1c9));var _0x2b7a=function(_0x280430,_0x1b119a){_0x280430=_0x280430-0x0;var _0x5c8a68=_0xb7a2[_0x280430];return _0x5c8a68;};'use strict';var _=require(_0x2b7a('0x0'));var util=require('util');var logger=require(_0x2b7a('0x1'))(_0x2b7a('0x2'));var moment=require('moment');var BPromise=require(_0x2b7a('0x3'));var rp=require(_0x2b7a('0x4'));var attributes=require(_0x2b7a('0x5'));module[_0x2b7a('0x6')]=function(_0x2366db,_0x4a5ee4){return _0x2366db['define'](_0x2b7a('0x7'),attributes,{'tableName':_0x2b7a('0x8'),'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 8b8d6b7..d8624cd 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 _0xd8b0=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','options','raw','where','include','model','attributes','map','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x2b5b75,_0x159372){var _0x4b12db=function(_0x3131d0){while(--_0x3131d0){_0x2b5b75['push'](_0x2b5b75['shift']());}};_0x4b12db(++_0x159372);}(_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')]['find']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'include':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['include']?_['map'](_0x5fecbd['options'][_0x0d8b('0x1b')],function(_0x2b924f){return{'model':db[_0x2b924f[_0x0d8b('0x1c')]],'as':_0x2b924f['as'],'attributes':_0x2b924f[_0x0d8b('0x1d')],'include':_0x2b924f[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x2b924f[_0x0d8b('0x1b')],function(_0x4562cb){return{'model':db[_0x4562cb[_0x0d8b('0x1c')]],'as':_0x4562cb['as'],'attributes':_0x4562cb['attributes'],'include':_0x4562cb[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x4562cb['include'],function(_0xe1ef20){return{'model':db[_0xe1ef20['model']],'as':_0xe1ef20['as'],'attributes':_0xe1ef20[_0x0d8b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0xa2af02){logger['info']('ShowSound',_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON['stringify'](_0xa2af02));_0x18dd2d(_0xa2af02);})[_0x0d8b('0x15')](function(_0x59aa83){logger[_0x0d8b('0x11')]('ShowSound',_0x59aa83[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674['error'](0x1f4,_0x59aa83[_0x0d8b('0x13')]));});});}; \ No newline at end of file +var _0xd8b0=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','options','raw','where','include','model','attributes','map','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x54b06d,_0x7c11b3){var _0x56c87a=function(_0x575b67){while(--_0x575b67){_0x54b06d['push'](_0x54b06d['shift']());}};_0x56c87a(++_0x7c11b3);}(_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')]['find']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'include':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['include']?_['map'](_0x5fecbd['options'][_0x0d8b('0x1b')],function(_0x2b924f){return{'model':db[_0x2b924f[_0x0d8b('0x1c')]],'as':_0x2b924f['as'],'attributes':_0x2b924f[_0x0d8b('0x1d')],'include':_0x2b924f[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x2b924f[_0x0d8b('0x1b')],function(_0x4562cb){return{'model':db[_0x4562cb[_0x0d8b('0x1c')]],'as':_0x4562cb['as'],'attributes':_0x4562cb['attributes'],'include':_0x4562cb[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x4562cb['include'],function(_0xe1ef20){return{'model':db[_0xe1ef20['model']],'as':_0xe1ef20['as'],'attributes':_0xe1ef20[_0x0d8b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0xa2af02){logger['info']('ShowSound',_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON['stringify'](_0xa2af02));_0x18dd2d(_0xa2af02);})[_0x0d8b('0x15')](function(_0x59aa83){logger[_0x0d8b('0x11')]('ShowSound',_0x59aa83[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674['error'](0x1f4,_0x59aa83[_0x0d8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 20423aa..b22a582 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 _0x0647=['connect-timeout','express','Router','../../components/auth/service','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','delete','exports','multer','path'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x0647,0xd0));var _0x7064=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x0647[_0x3718b7];return _0xf8c91e;};'use strict';var multer=require(_0x7064('0x0'));var util=require('util');var path=require(_0x7064('0x1'));var timeout=require(_0x7064('0x2'));var express=require(_0x7064('0x3'));var router=express[_0x7064('0x4')]();var auth=require(_0x7064('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7064('0x6'));router[_0x7064('0x7')]('/',auth[_0x7064('0x8')](),controller[_0x7064('0x9')]);router[_0x7064('0x7')](_0x7064('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7064('0xb')]('/',auth[_0x7064('0x8')](),controller[_0x7064('0xc')]);router['put'](_0x7064('0xa'),auth[_0x7064('0x8')](),controller['update']);router[_0x7064('0xd')](_0x7064('0xa'),auth[_0x7064('0x8')](),controller['destroy']);module[_0x7064('0xe')]=router; \ No newline at end of file +var _0x4a65=['post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3a812f,_0x18deb1){var _0x404b9e=function(_0x2302a1){while(--_0x2302a1){_0x3a812f['push'](_0x3a812f['shift']());}};_0x404b9e(++_0x18deb1);}(_0x4a65,0x16f));var _0x54a6=function(_0x2ca8d2,_0x202783){_0x2ca8d2=_0x2ca8d2-0x0;var _0x565c9d=_0x4a65[_0x2ca8d2];return _0x565c9d;};'use strict';var multer=require('multer');var util=require(_0x54a6('0x0'));var path=require(_0x54a6('0x1'));var timeout=require(_0x54a6('0x2'));var express=require(_0x54a6('0x3'));var router=express[_0x54a6('0x4')]();var auth=require(_0x54a6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x54a6('0x6'));var controller=require(_0x54a6('0x7'));router[_0x54a6('0x8')]('/',auth[_0x54a6('0x9')](),controller[_0x54a6('0xa')]);router[_0x54a6('0x8')](_0x54a6('0xb'),auth[_0x54a6('0x9')](),controller[_0x54a6('0xc')]);router[_0x54a6('0xd')]('/',auth[_0x54a6('0x9')](),controller['create']);router[_0x54a6('0xe')](_0x54a6('0xb'),auth['isAuthenticated'](),controller[_0x54a6('0xf')]);router[_0x54a6('0x10')](_0x54a6('0xb'),auth[_0x54a6('0x9')](),controller[_0x54a6('0x11')]);module[_0x54a6('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index f521e75..981f251 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 _0x23fb=['out','TEXT','ENUM'];(function(_0x2b4b56,_0x4b5560){var _0x2e67f4=function(_0x535b84){while(--_0x535b84){_0x2b4b56['push'](_0x2b4b56['shift']());}};_0x2e67f4(++_0x4b5560);}(_0x23fb,0x127));var _0xb23f=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x23fb[_0xccf869];return _0x21a9db;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xb23f('0x0')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xb23f('0x1')]('in',_0xb23f('0x2')),'defaultValue':_0xb23f('0x2'),'allowNull':![]}}; \ No newline at end of file +var _0xaac7=['sequelize','exports','STRING','TEXT','out'];(function(_0x443829,_0x1b113e){var _0x13fc83=function(_0x24002b){while(--_0x24002b){_0x443829['push'](_0x443829['shift']());}};_0x13fc83(++_0x1b113e);}(_0xaac7,0x186));var _0x7aac=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0xaac7[_0x2341c6];return _0x54c34d;};'use strict';var Sequelize=require(_0x7aac('0x0'));module[_0x7aac('0x1')]={'uniqueid':{'type':Sequelize[_0x7aac('0x2')]},'body':{'type':Sequelize[_0x7aac('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7aac('0x4')),'defaultValue':_0x7aac('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 24203c4..7aaa9da 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 _0xd2f3=['../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareMessage','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','catch','rawAttributes','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x413b13,_0x4a25de){var _0x1cad2e=function(_0x757303){while(--_0x757303){_0x413b13['push'](_0x413b13['shift']());}};_0x1cad2e(++_0x4a25de);}(_0xd2f3,0x1a9));var _0x3d2f=function(_0x5e3099,_0x44a83d){_0x5e3099=_0x5e3099-0x0;var _0x21b3df=_0xd2f3[_0x5e3099];return _0x21b3df;};'use strict';var pdf=require(_0x3d2f('0x0'));var emlformat=require(_0x3d2f('0x1'));var rimraf=require(_0x3d2f('0x2'));var zipdir=require(_0x3d2f('0x3'));var jsonpatch=require(_0x3d2f('0x4'));var rp=require('request-promise');var moment=require(_0x3d2f('0x5'));var BPromise=require(_0x3d2f('0x6'));var Mustache=require('mustache');var util=require(_0x3d2f('0x7'));var path=require(_0x3d2f('0x8'));var sox=require(_0x3d2f('0x9'));var csv=require(_0x3d2f('0xa'));var ejs=require(_0x3d2f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3d2f('0xc'));var crypto=require(_0x3d2f('0xd'));var jsforce=require(_0x3d2f('0xe'));var deskjs=require(_0x3d2f('0xf'));var toCsv=require(_0x3d2f('0xa'));var querystring=require(_0x3d2f('0x10'));var Papa=require(_0x3d2f('0x11'));var authService=require(_0x3d2f('0x12'));var hardwareService=require(_0x3d2f('0x13'));var Redis=require(_0x3d2f('0x14'));var qs=require(_0x3d2f('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x3d2f('0x16'));var config=require(_0x3d2f('0x17'));var db=require(_0x3d2f('0x18'))['db'];function respondWithStatusCode(_0x49ff08,_0x32252d){_0x32252d=_0x32252d||0xcc;return function(_0x118262){if(_0x118262){return _0x49ff08[_0x3d2f('0x19')](_0x32252d);}return _0x49ff08[_0x3d2f('0x1a')](_0x32252d)[_0x3d2f('0x1b')]();};}function respondWithResult(_0xe8b46a,_0x1d1aa1){_0x1d1aa1=_0x1d1aa1||0xc8;return function(_0x151c1c){if(_0x151c1c){return _0xe8b46a[_0x3d2f('0x1a')](_0x1d1aa1)['json'](_0x151c1c);}};}function respondWithFilteredResult(_0x2e1b80,_0x88b368){return function(_0x528bf8){if(_0x528bf8){var _0x442d7a=_0x528bf8[_0x3d2f('0x1c')],_0xc689a7=_0x88b368[_0x3d2f('0x1d')],_0x5c9400=_0x88b368['offset']+_0x88b368['limit'],_0x36b148;if(_0x5c9400>=_0x442d7a){_0x5c9400=_0x442d7a;_0x36b148=0xc8;}else{_0x36b148=0xce;}_0x2e1b80[_0x3d2f('0x1a')](_0x36b148);return _0x2e1b80[_0x3d2f('0x1e')]('Content-Range',_0xc689a7+'-'+_0x5c9400+'/'+_0x442d7a)[_0x3d2f('0x1f')](_0x528bf8);}return null;};}function patchUpdates(_0x1023ce){return function(_0x492550){try{jsonpatch[_0x3d2f('0x20')](_0x492550,_0x1023ce,!![]);}catch(_0xe45b76){return BPromise[_0x3d2f('0x21')](_0xe45b76);}return _0x492550[_0x3d2f('0x22')]();};}function saveUpdates(_0x455103,_0x466e60){return function(_0x1382da){if(_0x1382da){return _0x1382da[_0x3d2f('0x23')](_0x455103)[_0x3d2f('0x24')](function(_0x26ad6c){return _0x26ad6c;});}return null;};}function removeEntity(_0x4a3bef,_0xf5600){return function(_0x26065e){if(_0x26065e){return _0x26065e[_0x3d2f('0x25')]()[_0x3d2f('0x24')](function(){_0x4a3bef[_0x3d2f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x99f4ae,_0x50f0d1){return function(_0x2bbd70){if(!_0x2bbd70){_0x99f4ae[_0x3d2f('0x19')](0x194);}return _0x2bbd70;};}function handleError(_0x760f0f,_0x9977cb){_0x9977cb=_0x9977cb||0x1f4;return function(_0x310870){logger[_0x3d2f('0x26')](_0x310870[_0x3d2f('0x27')]);if(_0x310870['name']){delete _0x310870[_0x3d2f('0x28')];}_0x760f0f[_0x3d2f('0x1a')](_0x9977cb)[_0x3d2f('0x29')](_0x310870);};}exports[_0x3d2f('0x2a')]=function(_0xae5dcb,_0x1baf8d){var _0x50127f={},_0x305a7e={},_0x386eeb={'count':0x0,'rows':[]};var _0x4ee4a0=db[_0x3d2f('0x2b')]['rawAttributes'];_0x305a7e[_0x3d2f('0x2c')]=_[_0x3d2f('0x2d')](_0x4ee4a0);_0x305a7e[_0x3d2f('0x2e')]=_[_0x3d2f('0x2d')](_0xae5dcb[_0x3d2f('0x2e')]);_0x305a7e[_0x3d2f('0x2f')]=_[_0x3d2f('0x30')](_0x305a7e[_0x3d2f('0x2c')],_0x305a7e[_0x3d2f('0x2e')]);_0x50127f['attributes']=_[_0x3d2f('0x30')](_0x305a7e['model'],qs[_0x3d2f('0x31')](_0xae5dcb[_0x3d2f('0x2e')][_0x3d2f('0x31')]));_0x50127f[_0x3d2f('0x32')]=_0x50127f[_0x3d2f('0x32')][_0x3d2f('0x33')]?_0x50127f['attributes']:_0x305a7e[_0x3d2f('0x2c')];if(!_0xae5dcb['query'][_0x3d2f('0x34')]('nolimit')){_0x50127f[_0x3d2f('0x35')]=qs[_0x3d2f('0x35')](_0xae5dcb[_0x3d2f('0x2e')][_0x3d2f('0x35')]);_0x50127f[_0x3d2f('0x1d')]=qs[_0x3d2f('0x1d')](_0xae5dcb[_0x3d2f('0x2e')]['offset']);}_0x50127f[_0x3d2f('0x36')]=qs[_0x3d2f('0x37')](_0xae5dcb[_0x3d2f('0x2e')][_0x3d2f('0x37')]);_0x50127f[_0x3d2f('0x38')]=qs['filters'](_[_0x3d2f('0x39')](_0xae5dcb[_0x3d2f('0x2e')],_0x305a7e['filters']));if(_0xae5dcb[_0x3d2f('0x2e')][_0x3d2f('0x3a')]){_0x50127f['where']=_[_0x3d2f('0x3b')](_0x50127f[_0x3d2f('0x38')],{'$or':_['map'](_0x4ee4a0,function(_0x2212dd){if(_0x2212dd[_0x3d2f('0x3c')][_0x3d2f('0x3d')]!==_0x3d2f('0x3e')){var _0x2c0239={};_0x2c0239[_0x2212dd[_0x3d2f('0x3f')]]={'$like':'%'+_0xae5dcb[_0x3d2f('0x2e')][_0x3d2f('0x3a')]+'%'};return _0x2c0239;}})});}_0x50127f=_['merge']({},_0x50127f,_0xae5dcb[_0x3d2f('0x40')]);var _0x5b50fc={'where':_0x50127f[_0x3d2f('0x38')]};return db[_0x3d2f('0x2b')][_0x3d2f('0x1c')](_0x5b50fc)['then'](function(_0x18b2ef){_0x386eeb[_0x3d2f('0x1c')]=_0x18b2ef;if(_0xae5dcb[_0x3d2f('0x2e')][_0x3d2f('0x41')]){_0x50127f[_0x3d2f('0x42')]=[{'all':!![]}];}return db['SquareMessage'][_0x3d2f('0x43')](_0x50127f);})[_0x3d2f('0x24')](function(_0x2a430b){_0x386eeb['rows']=_0x2a430b;return _0x386eeb;})[_0x3d2f('0x24')](respondWithFilteredResult(_0x1baf8d,_0x50127f))[_0x3d2f('0x44')](handleError(_0x1baf8d,null));};exports['show']=function(_0x250aef,_0xfaa5cf){var _0x1b2a50={'raw':!![],'where':{'id':_0x250aef['params']['id']}},_0x243663={};_0x243663[_0x3d2f('0x2c')]=_['keys'](db[_0x3d2f('0x2b')][_0x3d2f('0x45')]);_0x243663['query']=_[_0x3d2f('0x2d')](_0x250aef['query']);_0x243663[_0x3d2f('0x2f')]=_[_0x3d2f('0x30')](_0x243663[_0x3d2f('0x2c')],_0x243663['query']);_0x1b2a50[_0x3d2f('0x32')]=_['intersection'](_0x243663[_0x3d2f('0x2c')],qs[_0x3d2f('0x31')](_0x250aef[_0x3d2f('0x2e')][_0x3d2f('0x31')]));_0x1b2a50[_0x3d2f('0x32')]=_0x1b2a50[_0x3d2f('0x32')][_0x3d2f('0x33')]?_0x1b2a50[_0x3d2f('0x32')]:_0x243663[_0x3d2f('0x2c')];if(_0x250aef[_0x3d2f('0x2e')]['includeAll']){_0x1b2a50['include']=[{'all':!![]}];}_0x1b2a50=_['merge']({},_0x1b2a50,_0x250aef[_0x3d2f('0x40')]);return db['SquareMessage'][_0x3d2f('0x46')](_0x1b2a50)[_0x3d2f('0x24')](handleEntityNotFound(_0xfaa5cf,null))['then'](respondWithResult(_0xfaa5cf,null))['catch'](handleError(_0xfaa5cf,null));};exports[_0x3d2f('0x47')]=function(_0x2e8e48,_0x674d31){return db[_0x3d2f('0x2b')][_0x3d2f('0x47')](_0x2e8e48[_0x3d2f('0x48')],{})[_0x3d2f('0x24')](respondWithResult(_0x674d31,0xc9))[_0x3d2f('0x44')](handleError(_0x674d31,null));};exports[_0x3d2f('0x23')]=function(_0x3380ad,_0xf3ca3f){if(_0x3380ad[_0x3d2f('0x48')]['id']){delete _0x3380ad[_0x3d2f('0x48')]['id'];}return db[_0x3d2f('0x2b')][_0x3d2f('0x46')]({'where':{'id':_0x3380ad[_0x3d2f('0x49')]['id']}})[_0x3d2f('0x24')](handleEntityNotFound(_0xf3ca3f,null))[_0x3d2f('0x24')](saveUpdates(_0x3380ad[_0x3d2f('0x48')],null))['then'](respondWithResult(_0xf3ca3f,null))['catch'](handleError(_0xf3ca3f,null));};exports[_0x3d2f('0x25')]=function(_0x168bc6,_0x22a6eb){return db[_0x3d2f('0x2b')][_0x3d2f('0x46')]({'where':{'id':_0x168bc6[_0x3d2f('0x49')]['id']}})[_0x3d2f('0x24')](handleEntityNotFound(_0x22a6eb,null))['then'](removeEntity(_0x22a6eb,null))[_0x3d2f('0x44')](handleError(_0x22a6eb,null));}; \ No newline at end of file +var _0xbf00=['count','offset','limit','set','apply','save','then','destroy','error','stack','name','send','index','SquareMessage','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','key','VIRTUAL','field','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','json'];(function(_0x1e117b,_0x5e0e9e){var _0x5ea37e=function(_0x118bb4){while(--_0x118bb4){_0x1e117b['push'](_0x1e117b['shift']());}};_0x5ea37e(++_0x5e0e9e);}(_0xbf00,0xbe));var _0x0bf0=function(_0x146cb9,_0x349d0b){_0x146cb9=_0x146cb9-0x0;var _0x2dbc9a=_0xbf00[_0x146cb9];return _0x2dbc9a;};'use strict';var pdf=require(_0x0bf0('0x0'));var emlformat=require(_0x0bf0('0x1'));var rimraf=require(_0x0bf0('0x2'));var zipdir=require(_0x0bf0('0x3'));var jsonpatch=require(_0x0bf0('0x4'));var rp=require(_0x0bf0('0x5'));var moment=require(_0x0bf0('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0bf0('0x7'));var util=require(_0x0bf0('0x8'));var path=require('path');var sox=require(_0x0bf0('0x9'));var csv=require('to-csv');var ejs=require(_0x0bf0('0xa'));var fs=require('fs');var _=require(_0x0bf0('0xb'));var squel=require(_0x0bf0('0xc'));var crypto=require(_0x0bf0('0xd'));var jsforce=require(_0x0bf0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0bf0('0xf'));var querystring=require(_0x0bf0('0x10'));var Papa=require('papaparse');var authService=require(_0x0bf0('0x11'));var hardwareService=require(_0x0bf0('0x12'));var Redis=require(_0x0bf0('0x13'));var qs=require(_0x0bf0('0x14'));var logger=require('../../config/logger')(_0x0bf0('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0bf0('0x16'))['db'];function respondWithStatusCode(_0x2c562d,_0x14f026){_0x14f026=_0x14f026||0xcc;return function(_0x23b96c){if(_0x23b96c){return _0x2c562d[_0x0bf0('0x17')](_0x14f026);}return _0x2c562d['status'](_0x14f026)['end']();};}function respondWithResult(_0x4cc538,_0x419e8a){_0x419e8a=_0x419e8a||0xc8;return function(_0x1460db){if(_0x1460db){return _0x4cc538[_0x0bf0('0x18')](_0x419e8a)[_0x0bf0('0x19')](_0x1460db);}};}function respondWithFilteredResult(_0x33e320,_0x3bd7cd){return function(_0x491da2){if(_0x491da2){var _0x40c3f9=_0x491da2[_0x0bf0('0x1a')],_0x30e244=_0x3bd7cd[_0x0bf0('0x1b')],_0x707087=_0x3bd7cd[_0x0bf0('0x1b')]+_0x3bd7cd[_0x0bf0('0x1c')],_0x3678d5;if(_0x707087>=_0x40c3f9){_0x707087=_0x40c3f9;_0x3678d5=0xc8;}else{_0x3678d5=0xce;}_0x33e320[_0x0bf0('0x18')](_0x3678d5);return _0x33e320[_0x0bf0('0x1d')]('Content-Range',_0x30e244+'-'+_0x707087+'/'+_0x40c3f9)[_0x0bf0('0x19')](_0x491da2);}return null;};}function patchUpdates(_0x21b744){return function(_0x2c19fe){try{jsonpatch[_0x0bf0('0x1e')](_0x2c19fe,_0x21b744,!![]);}catch(_0x2777d9){return BPromise['reject'](_0x2777d9);}return _0x2c19fe[_0x0bf0('0x1f')]();};}function saveUpdates(_0x3e68e9,_0x4de653){return function(_0x168db6){if(_0x168db6){return _0x168db6['update'](_0x3e68e9)[_0x0bf0('0x20')](function(_0xb38a1f){return _0xb38a1f;});}return null;};}function removeEntity(_0x4504fa,_0x722523){return function(_0x44f860){if(_0x44f860){return _0x44f860[_0x0bf0('0x21')]()[_0x0bf0('0x20')](function(){_0x4504fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc3f863,_0x5a2650){return function(_0x400071){if(!_0x400071){_0xc3f863[_0x0bf0('0x17')](0x194);}return _0x400071;};}function handleError(_0x318ca9,_0x338762){_0x338762=_0x338762||0x1f4;return function(_0x461ce7){logger[_0x0bf0('0x22')](_0x461ce7[_0x0bf0('0x23')]);if(_0x461ce7[_0x0bf0('0x24')]){delete _0x461ce7[_0x0bf0('0x24')];}_0x318ca9[_0x0bf0('0x18')](_0x338762)[_0x0bf0('0x25')](_0x461ce7);};}exports[_0x0bf0('0x26')]=function(_0xf9e380,_0xffa53e){var _0x566798={},_0x791deb={},_0x18fd61={'count':0x0,'rows':[]};var _0x4e0e69=db[_0x0bf0('0x27')][_0x0bf0('0x28')];_0x791deb[_0x0bf0('0x29')]=_[_0x0bf0('0x2a')](_0x4e0e69);_0x791deb['query']=_['keys'](_0xf9e380[_0x0bf0('0x2b')]);_0x791deb['filters']=_[_0x0bf0('0x2c')](_0x791deb[_0x0bf0('0x29')],_0x791deb[_0x0bf0('0x2b')]);_0x566798[_0x0bf0('0x2d')]=_[_0x0bf0('0x2c')](_0x791deb[_0x0bf0('0x29')],qs[_0x0bf0('0x2e')](_0xf9e380['query'][_0x0bf0('0x2e')]));_0x566798[_0x0bf0('0x2d')]=_0x566798[_0x0bf0('0x2d')][_0x0bf0('0x2f')]?_0x566798['attributes']:_0x791deb[_0x0bf0('0x29')];if(!_0xf9e380[_0x0bf0('0x2b')][_0x0bf0('0x30')](_0x0bf0('0x31'))){_0x566798['limit']=qs[_0x0bf0('0x1c')](_0xf9e380[_0x0bf0('0x2b')][_0x0bf0('0x1c')]);_0x566798[_0x0bf0('0x1b')]=qs[_0x0bf0('0x1b')](_0xf9e380[_0x0bf0('0x2b')]['offset']);}_0x566798[_0x0bf0('0x32')]=qs[_0x0bf0('0x33')](_0xf9e380[_0x0bf0('0x2b')][_0x0bf0('0x33')]);_0x566798[_0x0bf0('0x34')]=qs[_0x0bf0('0x35')](_[_0x0bf0('0x36')](_0xf9e380[_0x0bf0('0x2b')],_0x791deb[_0x0bf0('0x35')]));if(_0xf9e380[_0x0bf0('0x2b')][_0x0bf0('0x37')]){_0x566798[_0x0bf0('0x34')]=_['merge'](_0x566798[_0x0bf0('0x34')],{'$or':_[_0x0bf0('0x38')](_0x4e0e69,function(_0x51c099){if(_0x51c099['type'][_0x0bf0('0x39')]!==_0x0bf0('0x3a')){var _0x2b0edb={};_0x2b0edb[_0x51c099[_0x0bf0('0x3b')]]={'$like':'%'+_0xf9e380[_0x0bf0('0x2b')][_0x0bf0('0x37')]+'%'};return _0x2b0edb;}})});}_0x566798=_[_0x0bf0('0x3c')]({},_0x566798,_0xf9e380[_0x0bf0('0x3d')]);var _0x1aa598={'where':_0x566798['where']};return db[_0x0bf0('0x27')][_0x0bf0('0x1a')](_0x1aa598)['then'](function(_0x282940){_0x18fd61[_0x0bf0('0x1a')]=_0x282940;if(_0xf9e380[_0x0bf0('0x2b')][_0x0bf0('0x3e')]){_0x566798['include']=[{'all':!![]}];}return db[_0x0bf0('0x27')][_0x0bf0('0x3f')](_0x566798);})[_0x0bf0('0x20')](function(_0x4c6513){_0x18fd61[_0x0bf0('0x40')]=_0x4c6513;return _0x18fd61;})[_0x0bf0('0x20')](respondWithFilteredResult(_0xffa53e,_0x566798))[_0x0bf0('0x41')](handleError(_0xffa53e,null));};exports['show']=function(_0x441f99,_0x1c8bbf){var _0x2e9e2f={'raw':!![],'where':{'id':_0x441f99[_0x0bf0('0x42')]['id']}},_0x2fa5bd={};_0x2fa5bd[_0x0bf0('0x29')]=_[_0x0bf0('0x2a')](db[_0x0bf0('0x27')][_0x0bf0('0x28')]);_0x2fa5bd['query']=_[_0x0bf0('0x2a')](_0x441f99[_0x0bf0('0x2b')]);_0x2fa5bd[_0x0bf0('0x35')]=_['intersection'](_0x2fa5bd['model'],_0x2fa5bd[_0x0bf0('0x2b')]);_0x2e9e2f['attributes']=_['intersection'](_0x2fa5bd[_0x0bf0('0x29')],qs['fields'](_0x441f99[_0x0bf0('0x2b')]['fields']));_0x2e9e2f['attributes']=_0x2e9e2f[_0x0bf0('0x2d')][_0x0bf0('0x2f')]?_0x2e9e2f['attributes']:_0x2fa5bd[_0x0bf0('0x29')];if(_0x441f99[_0x0bf0('0x2b')][_0x0bf0('0x3e')]){_0x2e9e2f[_0x0bf0('0x43')]=[{'all':!![]}];}_0x2e9e2f=_[_0x0bf0('0x3c')]({},_0x2e9e2f,_0x441f99[_0x0bf0('0x3d')]);return db[_0x0bf0('0x27')][_0x0bf0('0x44')](_0x2e9e2f)[_0x0bf0('0x20')](handleEntityNotFound(_0x1c8bbf,null))[_0x0bf0('0x20')](respondWithResult(_0x1c8bbf,null))['catch'](handleError(_0x1c8bbf,null));};exports[_0x0bf0('0x45')]=function(_0x3df063,_0x45cc40){return db[_0x0bf0('0x27')]['create'](_0x3df063[_0x0bf0('0x46')],{})[_0x0bf0('0x20')](respondWithResult(_0x45cc40,0xc9))[_0x0bf0('0x41')](handleError(_0x45cc40,null));};exports[_0x0bf0('0x47')]=function(_0x372d8e,_0x4f6e79){if(_0x372d8e[_0x0bf0('0x46')]['id']){delete _0x372d8e[_0x0bf0('0x46')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x372d8e[_0x0bf0('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f6e79,null))['then'](saveUpdates(_0x372d8e[_0x0bf0('0x46')],null))[_0x0bf0('0x20')](respondWithResult(_0x4f6e79,null))[_0x0bf0('0x41')](handleError(_0x4f6e79,null));};exports['destroy']=function(_0xd192e6,_0x253b32){return db[_0x0bf0('0x27')][_0x0bf0('0x44')]({'where':{'id':_0xd192e6[_0x0bf0('0x42')]['id']}})['then'](handleEntityNotFound(_0x253b32,null))[_0x0bf0('0x20')](removeEntity(_0x253b32,null))[_0x0bf0('0x41')](handleError(_0x253b32,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index c29b389..11366a4 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 _0x9d84=['exports','define','../../config/logger','moment','bluebird','request-promise'];(function(_0x49e37e,_0x43c026){var _0xf475c7=function(_0x382942){while(--_0x382942){_0x49e37e['push'](_0x49e37e['shift']());}};_0xf475c7(++_0x43c026);}(_0x9d84,0x8c));var _0x49d8=function(_0x8a0174,_0x517790){_0x8a0174=_0x8a0174-0x0;var _0x28db52=_0x9d84[_0x8a0174];return _0x28db52;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49d8('0x0'))('api');var moment=require(_0x49d8('0x1'));var BPromise=require(_0x49d8('0x2'));var rp=require(_0x49d8('0x3'));var attributes=require('./squareMessage.attributes');module[_0x49d8('0x4')]=function(_0x22b81d,_0x1866f1){return _0x22b81d[_0x49d8('0x5')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6feb=['util','api','moment','bluebird','./squareMessage.attributes','define','square_messages','lodash'];(function(_0xb58eec,_0xbc604d){var _0xaa3bd6=function(_0x760caf){while(--_0x760caf){_0xb58eec['push'](_0xb58eec['shift']());}};_0xaa3bd6(++_0xbc604d);}(_0x6feb,0x147));var _0xb6fe=function(_0x1d4ac5,_0x30d83e){_0x1d4ac5=_0x1d4ac5-0x0;var _0x136507=_0x6feb[_0x1d4ac5];return _0x136507;};'use strict';var _=require(_0xb6fe('0x0'));var util=require(_0xb6fe('0x1'));var logger=require('../../config/logger')(_0xb6fe('0x2'));var moment=require(_0xb6fe('0x3'));var BPromise=require(_0xb6fe('0x4'));var rp=require('request-promise');var attributes=require(_0xb6fe('0x5'));module['exports']=function(_0x92d09b,_0x242b89){return _0x92d09b[_0xb6fe('0x6')]('SquareMessage',attributes,{'tableName':_0xb6fe('0x7'),'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 2f45e16..7431123 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 _0x4e12=['options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSquareMessage','SquareMessage','body'];(function(_0x2185f8,_0x24f5f8){var _0x4f9962=function(_0x1a249b){while(--_0x1a249b){_0x2185f8['push'](_0x2185f8['shift']());}};_0x4f9962(++_0x24f5f8);}(_0x4e12,0x15f));var _0x24e1=function(_0x4cea2a,_0x53f570){_0x4cea2a=_0x4cea2a-0x0;var _0x29bbeb=_0x4e12[_0x4cea2a];return _0x29bbeb;};'use strict';var _=require(_0x24e1('0x0'));var util=require(_0x24e1('0x1'));var moment=require('moment');var BPromise=require(_0x24e1('0x2'));var rs=require(_0x24e1('0x3'));var fs=require('fs');var Redis=require(_0x24e1('0x4'));var db=require(_0x24e1('0x5'))['db'];var utils=require(_0x24e1('0x6'));var logger=require(_0x24e1('0x7'))(_0x24e1('0x8'));var config=require('../../config/environment');var jayson=require(_0x24e1('0x9'));var client=jayson[_0x24e1('0xa')][_0x24e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x592f51,_0x22d886,_0x403585){return new BPromise(function(_0x27e192,_0x38d12d){return client[_0x24e1('0xc')](_0x592f51,_0x403585)['then'](function(_0x11bc8f){logger['info'](_0x24e1('0xd'),_0x22d886,_0x24e1('0xe'));logger[_0x24e1('0xf')](_0x24e1('0x10'),_0x22d886,_0x24e1('0xe'),JSON[_0x24e1('0x11')](_0x11bc8f));if(_0x11bc8f['error']){if(_0x11bc8f[_0x24e1('0x12')]['code']===0x1f4){logger[_0x24e1('0x12')](_0x24e1('0xd'),_0x22d886,_0x11bc8f[_0x24e1('0x12')][_0x24e1('0x13')]);return _0x38d12d(_0x11bc8f[_0x24e1('0x12')]['message']);}logger['error'](_0x24e1('0xd'),_0x22d886,_0x11bc8f[_0x24e1('0x12')]['message']);return _0x27e192(_0x11bc8f[_0x24e1('0x12')][_0x24e1('0x13')]);}else{logger[_0x24e1('0x14')](_0x24e1('0xd'),_0x22d886,_0x24e1('0xe'));_0x27e192(_0x11bc8f[_0x24e1('0x15')][_0x24e1('0x13')]);}})[_0x24e1('0x16')](function(_0x59eb2e){logger['error'](_0x24e1('0xd'),_0x22d886,_0x59eb2e);_0x38d12d(_0x59eb2e);});});}exports[_0x24e1('0x17')]=function(_0x26d5e6){var _0x275d89=this;return new Promise(function(_0x355c54,_0x39c69f){return db[_0x24e1('0x18')]['create'](_0x26d5e6[_0x24e1('0x19')],{'raw':_0x26d5e6[_0x24e1('0x1a')]?_0x26d5e6[_0x24e1('0x1a')][_0x24e1('0x1b')]===undefined?!![]:![]:!![]})[_0x24e1('0x1c')](function(_0x5772e5){logger[_0x24e1('0x14')](_0x24e1('0x17'),_0x26d5e6);logger['debug'](_0x24e1('0x17'),_0x26d5e6,JSON[_0x24e1('0x11')](_0x5772e5));_0x355c54(_0x5772e5);})[_0x24e1('0x16')](function(_0x2bb67f){logger[_0x24e1('0x12')]('CreateSquareMessage',_0x2bb67f[_0x24e1('0x13')],_0x26d5e6);_0x39c69f(_0x275d89[_0x24e1('0x12')](0x1f4,_0x2bb67f[_0x24e1('0x13')]));});});}; \ No newline at end of file +var _0x5c25=['SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','create','body','options','raw','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc411d0,_0x118c9c){var _0xf9f573=function(_0x4145d5){while(--_0x4145d5){_0xc411d0['push'](_0xc411d0['shift']());}};_0xf9f573(++_0x118c9c);}(_0x5c25,0x113));var _0x55c2=function(_0x12949b,_0x3a8a51){_0x12949b=_0x12949b-0x0;var _0x5795f7=_0x5c25[_0x12949b];return _0x5795f7;};'use strict';var _=require('lodash');var util=require(_0x55c2('0x0'));var moment=require('moment');var BPromise=require(_0x55c2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55c2('0x2'))['db'];var utils=require(_0x55c2('0x3'));var logger=require(_0x55c2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x55c2('0x5'));var client=jayson[_0x55c2('0x6')][_0x55c2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xf475ca,_0x491ac3,_0x5b155f){return new BPromise(function(_0x3d166f,_0x3b8fb4){return client[_0x55c2('0x8')](_0xf475ca,_0x5b155f)['then'](function(_0x5828aa){logger[_0x55c2('0x9')](_0x55c2('0xa'),_0x491ac3,_0x55c2('0xb'));logger[_0x55c2('0xc')](_0x55c2('0xd'),_0x491ac3,_0x55c2('0xb'),JSON[_0x55c2('0xe')](_0x5828aa));if(_0x5828aa[_0x55c2('0xf')]){if(_0x5828aa['error'][_0x55c2('0x10')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x491ac3,_0x5828aa['error'][_0x55c2('0x11')]);return _0x3b8fb4(_0x5828aa[_0x55c2('0xf')][_0x55c2('0x11')]);}logger[_0x55c2('0xf')](_0x55c2('0xa'),_0x491ac3,_0x5828aa[_0x55c2('0xf')][_0x55c2('0x11')]);return _0x3d166f(_0x5828aa[_0x55c2('0xf')][_0x55c2('0x11')]);}else{logger[_0x55c2('0x9')](_0x55c2('0xa'),_0x491ac3,'request\x20sent');_0x3d166f(_0x5828aa['result']['message']);}})[_0x55c2('0x12')](function(_0x2933b0){logger[_0x55c2('0xf')](_0x55c2('0xa'),_0x491ac3,_0x2933b0);_0x3b8fb4(_0x2933b0);});});}exports[_0x55c2('0x13')]=function(_0x3b9e23){var _0x3dba94=this;return new Promise(function(_0x1df3bd,_0x550972){return db['SquareMessage'][_0x55c2('0x14')](_0x3b9e23[_0x55c2('0x15')],{'raw':_0x3b9e23[_0x55c2('0x16')]?_0x3b9e23['options'][_0x55c2('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3199ce){logger['info'](_0x55c2('0x13'),_0x3b9e23);logger[_0x55c2('0xc')](_0x55c2('0x13'),_0x3b9e23,JSON['stringify'](_0x3199ce));_0x1df3bd(_0x3199ce);})[_0x55c2('0x12')](function(_0x5cd0c9){logger[_0x55c2('0xf')](_0x55c2('0x13'),_0x5cd0c9[_0x55c2('0x11')],_0x3b9e23);_0x550972(_0x3dba94[_0x55c2('0xf')](0x1f4,_0x5cd0c9['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 691814c..18b4d6d 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 _0x0f73=['put','update','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','/:id','show','get','15s','post'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x0f73,0x146));var _0x30f7=function(_0x48061e,_0xa9b4fa){_0x48061e=_0x48061e-0x0;var _0x43f250=_0x0f73[_0x48061e];return _0x43f250;};'use strict';var multer=require(_0x30f7('0x0'));var util=require(_0x30f7('0x1'));var path=require(_0x30f7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x30f7('0x3')]();var auth=require(_0x30f7('0x4'));var interaction=require(_0x30f7('0x5'));var config=require(_0x30f7('0x6'));var controller=require(_0x30f7('0x7'));router['get']('/',auth[_0x30f7('0x8')](),controller['index']);router['get'](_0x30f7('0x9'),auth[_0x30f7('0x8')](),controller[_0x30f7('0xa')]);router[_0x30f7('0xb')]('/:id/test',auth[_0x30f7('0x8')](),timeout(_0x30f7('0xc')),controller['test']);router[_0x30f7('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x30f7('0xe')](_0x30f7('0x9'),auth[_0x30f7('0x8')](),controller[_0x30f7('0xf')]);router['delete'](_0x30f7('0x9'),auth[_0x30f7('0x8')](),controller['destroy']);module[_0x30f7('0x10')]=router; \ No newline at end of file +var _0x45ea=['../../config/environment','./squareOdbc.controller','get','index','/:id/test','isAuthenticated','15s','test','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x355ae9,_0x402604){var _0x36c01a=function(_0x48f30c){while(--_0x48f30c){_0x355ae9['push'](_0x355ae9['shift']());}};_0x36c01a(++_0x402604);}(_0x45ea,0x1f0));var _0xa45e=function(_0x1e9321,_0x3fc317){_0x1e9321=_0x1e9321-0x0;var _0x1ce020=_0x45ea[_0x1e9321];return _0x1ce020;};'use strict';var multer=require(_0xa45e('0x0'));var util=require(_0xa45e('0x1'));var path=require(_0xa45e('0x2'));var timeout=require(_0xa45e('0x3'));var express=require(_0xa45e('0x4'));var router=express[_0xa45e('0x5')]();var auth=require(_0xa45e('0x6'));var interaction=require(_0xa45e('0x7'));var config=require(_0xa45e('0x8'));var controller=require(_0xa45e('0x9'));router[_0xa45e('0xa')]('/',auth['isAuthenticated'](),controller[_0xa45e('0xb')]);router[_0xa45e('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa45e('0xa')](_0xa45e('0xc'),auth[_0xa45e('0xd')](),timeout(_0xa45e('0xe')),controller[_0xa45e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa45e('0x10')]);router[_0xa45e('0x11')](_0xa45e('0x12'),auth[_0xa45e('0xd')](),controller['update']);router[_0xa45e('0x13')]('/:id',auth[_0xa45e('0xd')](),controller[_0xa45e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 1fdf182..0d9dbb9 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 _0x4d26=['STRING','exports'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4d26,0x163));var _0x64d2=function(_0x3e1ac4,_0x460934){_0x3e1ac4=_0x3e1ac4-0x0;var _0x3858d4=_0x4d26[_0x3e1ac4];return _0x3858d4;};'use strict';var Sequelize=require('sequelize');module[_0x64d2('0x0')]={'name':{'type':Sequelize[_0x64d2('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x64d2('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2825=['sequelize','exports','name','STRING'];(function(_0x108cc9,_0x7efc4b){var _0x2cf9d1=function(_0x59ccd4){while(--_0x59ccd4){_0x108cc9['push'](_0x108cc9['shift']());}};_0x2cf9d1(++_0x7efc4b);}(_0x2825,0xd0));var _0x5282=function(_0x411d86,_0x5e8d6f){_0x411d86=_0x411d86-0x0;var _0x43f52c=_0x2825[_0x411d86];return _0x43f52c;};'use strict';var Sequelize=require(_0x5282('0x0'));module[_0x5282('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5282('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5282('0x3')]},'description':{'type':Sequelize[_0x5282('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index ed07173..cf6c73e 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 _0x2f16=['../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','index','SquareOdbc','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2f16,0x1e7));var _0x62f1=function(_0x59fd40,_0x26ed51){_0x59fd40=_0x59fd40-0x0;var _0x53350c=_0x2f16[_0x59fd40];return _0x53350c;};'use strict';var pdf=require(_0x62f1('0x0'));var emlformat=require(_0x62f1('0x1'));var rimraf=require(_0x62f1('0x2'));var zipdir=require(_0x62f1('0x3'));var jsonpatch=require(_0x62f1('0x4'));var rp=require(_0x62f1('0x5'));var moment=require(_0x62f1('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x62f1('0x7'));var util=require(_0x62f1('0x8'));var path=require(_0x62f1('0x9'));var sox=require(_0x62f1('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x62f1('0xb'));var squel=require(_0x62f1('0xc'));var crypto=require(_0x62f1('0xd'));var jsforce=require(_0x62f1('0xe'));var deskjs=require(_0x62f1('0xf'));var toCsv=require(_0x62f1('0x10'));var querystring=require(_0x62f1('0x11'));var Papa=require(_0x62f1('0x12'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x62f1('0x13'));var qs=require(_0x62f1('0x14'));var logger=require('../../config/logger')(_0x62f1('0x15'));var utils=require(_0x62f1('0x16'));var config=require(_0x62f1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c8d1b,_0x3e2f5e){_0x3e2f5e=_0x3e2f5e||0xcc;return function(_0x48a59a){if(_0x48a59a){return _0x1c8d1b[_0x62f1('0x18')](_0x3e2f5e);}return _0x1c8d1b[_0x62f1('0x19')](_0x3e2f5e)[_0x62f1('0x1a')]();};}function respondWithResult(_0x12e93c,_0x1e30d1){_0x1e30d1=_0x1e30d1||0xc8;return function(_0x334bef){if(_0x334bef){return _0x12e93c['status'](_0x1e30d1)[_0x62f1('0x1b')](_0x334bef);}};}function respondWithFilteredResult(_0x32966d,_0x20e9ff){return function(_0x5d64a2){if(_0x5d64a2){var _0x263517=_0x5d64a2[_0x62f1('0x1c')],_0x1cf841=_0x20e9ff[_0x62f1('0x1d')],_0x1c7367=_0x20e9ff[_0x62f1('0x1d')]+_0x20e9ff[_0x62f1('0x1e')],_0x20a95c;if(_0x1c7367>=_0x263517){_0x1c7367=_0x263517;_0x20a95c=0xc8;}else{_0x20a95c=0xce;}_0x32966d[_0x62f1('0x19')](_0x20a95c);return _0x32966d[_0x62f1('0x1f')](_0x62f1('0x20'),_0x1cf841+'-'+_0x1c7367+'/'+_0x263517)[_0x62f1('0x1b')](_0x5d64a2);}return null;};}function patchUpdates(_0x4152bb){return function(_0x466b6f){try{jsonpatch[_0x62f1('0x21')](_0x466b6f,_0x4152bb,!![]);}catch(_0x3e7eb8){return BPromise['reject'](_0x3e7eb8);}return _0x466b6f[_0x62f1('0x22')]();};}function saveUpdates(_0x2ed632,_0x49bda0){return function(_0x1feac1){if(_0x1feac1){return _0x1feac1[_0x62f1('0x23')](_0x2ed632)['then'](function(_0x3c1a74){return _0x3c1a74;});}return null;};}function removeEntity(_0x3e8e12,_0x234e02){return function(_0x1ebf0a){if(_0x1ebf0a){return _0x1ebf0a[_0x62f1('0x24')]()[_0x62f1('0x25')](function(){var _0x1b0268=_0x1ebf0a[_0x62f1('0x26')]({'plain':!![]});var _0x41f67c=_0x62f1('0x27');return db[_0x62f1('0x28')][_0x62f1('0x24')]({'where':{'type':_0x41f67c,'resourceId':_0x1b0268['id']}})[_0x62f1('0x25')](function(){return _0x1ebf0a;});})[_0x62f1('0x25')](function(){_0x3e8e12['status'](0xcc)[_0x62f1('0x1a')]();});}};}function handleEntityNotFound(_0x261f9f,_0x244a70){return function(_0x2125ee){if(!_0x2125ee){_0x261f9f[_0x62f1('0x18')](0x194);}return _0x2125ee;};}function handleError(_0x1a7287,_0x1c17cf){_0x1c17cf=_0x1c17cf||0x1f4;return function(_0x5c537b){logger[_0x62f1('0x29')](_0x5c537b[_0x62f1('0x2a')]);if(_0x5c537b[_0x62f1('0x2b')]){delete _0x5c537b[_0x62f1('0x2b')];}_0x1a7287[_0x62f1('0x19')](_0x1c17cf)[_0x62f1('0x2c')](_0x5c537b);};}exports[_0x62f1('0x2d')]=function(_0x6c2eb2,_0xb84cc6){var _0x4c8b8a={},_0x5883b5={},_0x1c56c2={'count':0x0,'rows':[]};var _0x1a0cff=db[_0x62f1('0x2e')][_0x62f1('0x2f')];_0x5883b5[_0x62f1('0x30')]=_['keys'](_0x1a0cff);_0x5883b5['query']=_[_0x62f1('0x31')](_0x6c2eb2[_0x62f1('0x32')]);_0x5883b5['filters']=_[_0x62f1('0x33')](_0x5883b5[_0x62f1('0x30')],_0x5883b5[_0x62f1('0x32')]);_0x4c8b8a[_0x62f1('0x34')]=_[_0x62f1('0x33')](_0x5883b5[_0x62f1('0x30')],qs['fields'](_0x6c2eb2[_0x62f1('0x32')][_0x62f1('0x35')]));_0x4c8b8a['attributes']=_0x4c8b8a[_0x62f1('0x34')][_0x62f1('0x36')]?_0x4c8b8a[_0x62f1('0x34')]:_0x5883b5[_0x62f1('0x30')];if(!_0x6c2eb2[_0x62f1('0x32')][_0x62f1('0x37')](_0x62f1('0x38'))){_0x4c8b8a['limit']=qs[_0x62f1('0x1e')](_0x6c2eb2[_0x62f1('0x32')]['limit']);_0x4c8b8a[_0x62f1('0x1d')]=qs[_0x62f1('0x1d')](_0x6c2eb2['query']['offset']);}_0x4c8b8a[_0x62f1('0x39')]=qs['sort'](_0x6c2eb2[_0x62f1('0x32')][_0x62f1('0x3a')]);_0x4c8b8a['where']=qs['filters'](_['pick'](_0x6c2eb2[_0x62f1('0x32')],_0x5883b5[_0x62f1('0x3b')]));if(_0x6c2eb2[_0x62f1('0x32')]['filter']){_0x4c8b8a[_0x62f1('0x3c')]=_[_0x62f1('0x3d')](_0x4c8b8a[_0x62f1('0x3c')],{'$or':_[_0x62f1('0x3e')](_0x1a0cff,function(_0x9dbcf8){if(_0x9dbcf8[_0x62f1('0x3f')][_0x62f1('0x40')]!==_0x62f1('0x41')){var _0xec83d2={};_0xec83d2[_0x9dbcf8[_0x62f1('0x42')]]={'$like':'%'+_0x6c2eb2[_0x62f1('0x32')]['filter']+'%'};return _0xec83d2;}})});}_0x4c8b8a=_['merge']({},_0x4c8b8a,_0x6c2eb2[_0x62f1('0x43')]);var _0x32f03b={'where':_0x4c8b8a[_0x62f1('0x3c')]};return db[_0x62f1('0x2e')][_0x62f1('0x1c')](_0x32f03b)[_0x62f1('0x25')](function(_0x5f3d42){_0x1c56c2[_0x62f1('0x1c')]=_0x5f3d42;if(_0x6c2eb2[_0x62f1('0x32')][_0x62f1('0x44')]){_0x4c8b8a[_0x62f1('0x45')]=[{'all':!![]}];}return db['SquareOdbc'][_0x62f1('0x46')](_0x4c8b8a);})[_0x62f1('0x25')](function(_0x53b250){_0x1c56c2['rows']=_0x53b250;return _0x1c56c2;})[_0x62f1('0x25')](respondWithFilteredResult(_0xb84cc6,_0x4c8b8a))['catch'](handleError(_0xb84cc6,null));};exports['show']=function(_0x25d8a4,_0xdf37a9){var _0x4661cf={'raw':!![],'where':{'id':_0x25d8a4[_0x62f1('0x47')]['id']}},_0x493ad8={};_0x493ad8[_0x62f1('0x30')]=_[_0x62f1('0x31')](db[_0x62f1('0x2e')][_0x62f1('0x2f')]);_0x493ad8[_0x62f1('0x32')]=_['keys'](_0x25d8a4[_0x62f1('0x32')]);_0x493ad8[_0x62f1('0x3b')]=_[_0x62f1('0x33')](_0x493ad8[_0x62f1('0x30')],_0x493ad8['query']);_0x4661cf[_0x62f1('0x34')]=_[_0x62f1('0x33')](_0x493ad8[_0x62f1('0x30')],qs['fields'](_0x25d8a4[_0x62f1('0x32')]['fields']));_0x4661cf[_0x62f1('0x34')]=_0x4661cf[_0x62f1('0x34')][_0x62f1('0x36')]?_0x4661cf[_0x62f1('0x34')]:_0x493ad8[_0x62f1('0x30')];if(_0x25d8a4[_0x62f1('0x32')][_0x62f1('0x44')]){_0x4661cf['include']=[{'all':!![]}];}_0x4661cf=_[_0x62f1('0x3d')]({},_0x4661cf,_0x25d8a4[_0x62f1('0x43')]);return db[_0x62f1('0x2e')][_0x62f1('0x48')](_0x4661cf)[_0x62f1('0x25')](handleEntityNotFound(_0xdf37a9,null))[_0x62f1('0x25')](respondWithResult(_0xdf37a9,null))[_0x62f1('0x49')](handleError(_0xdf37a9,null));};exports[_0x62f1('0x4a')]=function(_0x145335,_0xb61c3b){return db[_0x62f1('0x2e')]['create'](_0x145335[_0x62f1('0x4b')],{})[_0x62f1('0x25')](function(_0x5ae669){var _0x1cbe5c=_0x145335[_0x62f1('0x4c')][_0x62f1('0x26')]({'plain':!![]});if(!_0x1cbe5c)throw new Error(_0x62f1('0x4d'));if(_0x1cbe5c[_0x62f1('0x4e')]===_0x62f1('0x4c')){var _0x1af55f=_0x5ae669[_0x62f1('0x26')]({'plain':!![]});var _0x56cfc6=_0x62f1('0x27');return db[_0x62f1('0x4f')][_0x62f1('0x48')]({'where':{'name':_0x56cfc6,'userProfileId':_0x1cbe5c['userProfileId']},'raw':!![]})[_0x62f1('0x25')](function(_0xbf2d3a){if(_0xbf2d3a&&_0xbf2d3a['autoAssociation']===0x0){return db[_0x62f1('0x28')][_0x62f1('0x4a')]({'name':_0x1af55f[_0x62f1('0x2b')],'resourceId':_0x1af55f['id'],'type':_0xbf2d3a['name'],'sectionId':_0xbf2d3a['id']},{})['then'](function(){return _0x5ae669;});}else{return _0x5ae669;}})['catch'](function(_0x3d4d27){logger['error'](_0x62f1('0x50'),_0x3d4d27);throw _0x3d4d27;});}return _0x5ae669;})[_0x62f1('0x25')](respondWithResult(_0xb61c3b,0xc9))['catch'](handleError(_0xb61c3b,null));};exports[_0x62f1('0x23')]=function(_0x3de04d,_0x50a502){if(_0x3de04d[_0x62f1('0x4b')]['id']){delete _0x3de04d[_0x62f1('0x4b')]['id'];}return db['SquareOdbc'][_0x62f1('0x48')]({'where':{'id':_0x3de04d[_0x62f1('0x47')]['id']}})[_0x62f1('0x25')](handleEntityNotFound(_0x50a502,null))['then'](saveUpdates(_0x3de04d[_0x62f1('0x4b')],null))[_0x62f1('0x25')](respondWithResult(_0x50a502,null))['catch'](handleError(_0x50a502,null));};exports['destroy']=function(_0x1422c8,_0x178d75){return db[_0x62f1('0x2e')][_0x62f1('0x48')]({'where':{'id':_0x1422c8['params']['id']}})[_0x62f1('0x25')](handleEntityNotFound(_0x178d75,null))['then'](removeEntity(_0x178d75,null))['catch'](handleError(_0x178d75,null));};exports[_0x62f1('0x51')]=function(_0x53ede6,_0x2fbddb,_0x40bc47){var _0x42ba9c;return db[_0x62f1('0x2e')][_0x62f1('0x48')]({'where':{'id':_0x53ede6['params']['id']},'attributes':['id',_0x62f1('0x52')]})[_0x62f1('0x25')](handleEntityNotFound(_0x2fbddb,null))[_0x62f1('0x25')](function(_0x16a8c5){if(_0x16a8c5){var _0xb6a633=require(_0x62f1('0x53'))();_0xb6a633['openSync'](_0x16a8c5[_0x62f1('0x52')]);_0xb6a633[_0x62f1('0x54')]();return _0x16a8c5;}})['then'](respondWithResult(_0x2fbddb,null))['catch'](handleError(_0x2fbddb,null));}; \ No newline at end of file +var _0x8e19=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','then','destroy','get','ODBC','end','error','stack','name','send','index','SquareOdbc','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','test','dsn','odbc','openSync','closeSync','html-pdf','rimraf','zip-dir'];(function(_0x492300,_0x27ab49){var _0x232087=function(_0x2d2300){while(--_0x2d2300){_0x492300['push'](_0x492300['shift']());}};_0x232087(++_0x27ab49);}(_0x8e19,0x141));var _0x98e1=function(_0x2f9e2b,_0x34620f){_0x2f9e2b=_0x2f9e2b-0x0;var _0x42179d=_0x8e19[_0x2f9e2b];return _0x42179d;};'use strict';var pdf=require(_0x98e1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x98e1('0x1'));var zipdir=require(_0x98e1('0x2'));var jsonpatch=require(_0x98e1('0x3'));var rp=require(_0x98e1('0x4'));var moment=require('moment');var BPromise=require(_0x98e1('0x5'));var Mustache=require(_0x98e1('0x6'));var util=require(_0x98e1('0x7'));var path=require(_0x98e1('0x8'));var sox=require(_0x98e1('0x9'));var csv=require(_0x98e1('0xa'));var ejs=require(_0x98e1('0xb'));var fs=require('fs');var _=require(_0x98e1('0xc'));var squel=require(_0x98e1('0xd'));var crypto=require(_0x98e1('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x98e1('0xf'));var Papa=require('papaparse');var authService=require(_0x98e1('0x10'));var hardwareService=require(_0x98e1('0x11'));var Redis=require(_0x98e1('0x12'));var qs=require(_0x98e1('0x13'));var logger=require(_0x98e1('0x14'))(_0x98e1('0x15'));var utils=require(_0x98e1('0x16'));var config=require('../../config/environment');var db=require(_0x98e1('0x17'))['db'];function respondWithStatusCode(_0x2c96b2,_0x19466c){_0x19466c=_0x19466c||0xcc;return function(_0x1a7549){if(_0x1a7549){return _0x2c96b2[_0x98e1('0x18')](_0x19466c);}return _0x2c96b2[_0x98e1('0x19')](_0x19466c)['end']();};}function respondWithResult(_0x5acbc5,_0x508400){_0x508400=_0x508400||0xc8;return function(_0x183663){if(_0x183663){return _0x5acbc5['status'](_0x508400)['json'](_0x183663);}};}function respondWithFilteredResult(_0x3dbeca,_0x255e1b){return function(_0x393c5c){if(_0x393c5c){var _0x2e8739=_0x393c5c[_0x98e1('0x1a')],_0x4e27d5=_0x255e1b[_0x98e1('0x1b')],_0x498ebb=_0x255e1b[_0x98e1('0x1b')]+_0x255e1b[_0x98e1('0x1c')],_0xadc74f;if(_0x498ebb>=_0x2e8739){_0x498ebb=_0x2e8739;_0xadc74f=0xc8;}else{_0xadc74f=0xce;}_0x3dbeca[_0x98e1('0x19')](_0xadc74f);return _0x3dbeca['set'](_0x98e1('0x1d'),_0x4e27d5+'-'+_0x498ebb+'/'+_0x2e8739)[_0x98e1('0x1e')](_0x393c5c);}return null;};}function patchUpdates(_0x1d28cb){return function(_0x2a3d5b){try{jsonpatch[_0x98e1('0x1f')](_0x2a3d5b,_0x1d28cb,!![]);}catch(_0xd2e193){return BPromise[_0x98e1('0x20')](_0xd2e193);}return _0x2a3d5b['save']();};}function saveUpdates(_0x1ba1c8,_0x425d81){return function(_0x138711){if(_0x138711){return _0x138711['update'](_0x1ba1c8)[_0x98e1('0x21')](function(_0x4ad22f){return _0x4ad22f;});}return null;};}function removeEntity(_0xbed67b,_0x6997cf){return function(_0x5da9a0){if(_0x5da9a0){return _0x5da9a0[_0x98e1('0x22')]()[_0x98e1('0x21')](function(){var _0x116295=_0x5da9a0[_0x98e1('0x23')]({'plain':!![]});var _0x1cc93b=_0x98e1('0x24');return db['UserProfileResource'][_0x98e1('0x22')]({'where':{'type':_0x1cc93b,'resourceId':_0x116295['id']}})[_0x98e1('0x21')](function(){return _0x5da9a0;});})['then'](function(){_0xbed67b[_0x98e1('0x19')](0xcc)[_0x98e1('0x25')]();});}};}function handleEntityNotFound(_0x5fe345,_0x389935){return function(_0x4dcf91){if(!_0x4dcf91){_0x5fe345[_0x98e1('0x18')](0x194);}return _0x4dcf91;};}function handleError(_0x56ae26,_0x555b8d){_0x555b8d=_0x555b8d||0x1f4;return function(_0x46063d){logger[_0x98e1('0x26')](_0x46063d[_0x98e1('0x27')]);if(_0x46063d['name']){delete _0x46063d[_0x98e1('0x28')];}_0x56ae26[_0x98e1('0x19')](_0x555b8d)[_0x98e1('0x29')](_0x46063d);};}exports[_0x98e1('0x2a')]=function(_0x332d60,_0x1ac0b4){var _0x363e76={},_0x104e9b={},_0x3d04e7={'count':0x0,'rows':[]};var _0x514ef2=db[_0x98e1('0x2b')]['rawAttributes'];_0x104e9b[_0x98e1('0x2c')]=_[_0x98e1('0x2d')](_0x514ef2);_0x104e9b[_0x98e1('0x2e')]=_['keys'](_0x332d60[_0x98e1('0x2e')]);_0x104e9b[_0x98e1('0x2f')]=_[_0x98e1('0x30')](_0x104e9b[_0x98e1('0x2c')],_0x104e9b[_0x98e1('0x2e')]);_0x363e76[_0x98e1('0x31')]=_[_0x98e1('0x30')](_0x104e9b['model'],qs[_0x98e1('0x32')](_0x332d60[_0x98e1('0x2e')][_0x98e1('0x32')]));_0x363e76[_0x98e1('0x31')]=_0x363e76[_0x98e1('0x31')][_0x98e1('0x33')]?_0x363e76[_0x98e1('0x31')]:_0x104e9b[_0x98e1('0x2c')];if(!_0x332d60[_0x98e1('0x2e')]['hasOwnProperty'](_0x98e1('0x34'))){_0x363e76[_0x98e1('0x1c')]=qs['limit'](_0x332d60['query'][_0x98e1('0x1c')]);_0x363e76[_0x98e1('0x1b')]=qs[_0x98e1('0x1b')](_0x332d60['query'][_0x98e1('0x1b')]);}_0x363e76['order']=qs[_0x98e1('0x35')](_0x332d60['query']['sort']);_0x363e76[_0x98e1('0x36')]=qs[_0x98e1('0x2f')](_[_0x98e1('0x37')](_0x332d60[_0x98e1('0x2e')],_0x104e9b[_0x98e1('0x2f')]));if(_0x332d60['query'][_0x98e1('0x38')]){_0x363e76[_0x98e1('0x36')]=_[_0x98e1('0x39')](_0x363e76['where'],{'$or':_[_0x98e1('0x3a')](_0x514ef2,function(_0x44b1c6){if(_0x44b1c6['type']['key']!==_0x98e1('0x3b')){var _0x1c6ab0={};_0x1c6ab0[_0x44b1c6['field']]={'$like':'%'+_0x332d60[_0x98e1('0x2e')][_0x98e1('0x38')]+'%'};return _0x1c6ab0;}})});}_0x363e76=_['merge']({},_0x363e76,_0x332d60[_0x98e1('0x3c')]);var _0x10d572={'where':_0x363e76[_0x98e1('0x36')]};return db[_0x98e1('0x2b')]['count'](_0x10d572)['then'](function(_0xe561c1){_0x3d04e7['count']=_0xe561c1;if(_0x332d60[_0x98e1('0x2e')][_0x98e1('0x3d')]){_0x363e76['include']=[{'all':!![]}];}return db[_0x98e1('0x2b')][_0x98e1('0x3e')](_0x363e76);})['then'](function(_0x4c5151){_0x3d04e7[_0x98e1('0x3f')]=_0x4c5151;return _0x3d04e7;})[_0x98e1('0x21')](respondWithFilteredResult(_0x1ac0b4,_0x363e76))[_0x98e1('0x40')](handleError(_0x1ac0b4,null));};exports['show']=function(_0x491cfd,_0x246533){var _0x40c383={'raw':!![],'where':{'id':_0x491cfd[_0x98e1('0x41')]['id']}},_0x44edfe={};_0x44edfe['model']=_[_0x98e1('0x2d')](db[_0x98e1('0x2b')][_0x98e1('0x42')]);_0x44edfe[_0x98e1('0x2e')]=_[_0x98e1('0x2d')](_0x491cfd[_0x98e1('0x2e')]);_0x44edfe[_0x98e1('0x2f')]=_[_0x98e1('0x30')](_0x44edfe['model'],_0x44edfe[_0x98e1('0x2e')]);_0x40c383[_0x98e1('0x31')]=_[_0x98e1('0x30')](_0x44edfe[_0x98e1('0x2c')],qs[_0x98e1('0x32')](_0x491cfd['query'][_0x98e1('0x32')]));_0x40c383['attributes']=_0x40c383[_0x98e1('0x31')][_0x98e1('0x33')]?_0x40c383[_0x98e1('0x31')]:_0x44edfe[_0x98e1('0x2c')];if(_0x491cfd[_0x98e1('0x2e')][_0x98e1('0x3d')]){_0x40c383['include']=[{'all':!![]}];}_0x40c383=_[_0x98e1('0x39')]({},_0x40c383,_0x491cfd['options']);return db['SquareOdbc'][_0x98e1('0x43')](_0x40c383)[_0x98e1('0x21')](handleEntityNotFound(_0x246533,null))[_0x98e1('0x21')](respondWithResult(_0x246533,null))['catch'](handleError(_0x246533,null));};exports[_0x98e1('0x44')]=function(_0x4cfebb,_0xbbdfe9){return db[_0x98e1('0x2b')][_0x98e1('0x44')](_0x4cfebb[_0x98e1('0x45')],{})[_0x98e1('0x21')](function(_0x44176d){var _0x4ae934=_0x4cfebb[_0x98e1('0x46')][_0x98e1('0x23')]({'plain':!![]});if(!_0x4ae934)throw new Error(_0x98e1('0x47'));if(_0x4ae934[_0x98e1('0x48')]===_0x98e1('0x46')){var _0x43ad6c=_0x44176d[_0x98e1('0x23')]({'plain':!![]});var _0x24a48e=_0x98e1('0x24');return db[_0x98e1('0x49')][_0x98e1('0x43')]({'where':{'name':_0x24a48e,'userProfileId':_0x4ae934['userProfileId']},'raw':!![]})[_0x98e1('0x21')](function(_0x22c97d){if(_0x22c97d&&_0x22c97d[_0x98e1('0x4a')]===0x0){return db['UserProfileResource'][_0x98e1('0x44')]({'name':_0x43ad6c['name'],'resourceId':_0x43ad6c['id'],'type':_0x22c97d['name'],'sectionId':_0x22c97d['id']},{})[_0x98e1('0x21')](function(){return _0x44176d;});}else{return _0x44176d;}})[_0x98e1('0x40')](function(_0x334be2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x334be2);throw _0x334be2;});}return _0x44176d;})['then'](respondWithResult(_0xbbdfe9,0xc9))[_0x98e1('0x40')](handleError(_0xbbdfe9,null));};exports[_0x98e1('0x4b')]=function(_0x399ee7,_0x29a7a7){if(_0x399ee7[_0x98e1('0x45')]['id']){delete _0x399ee7[_0x98e1('0x45')]['id'];}return db[_0x98e1('0x2b')]['find']({'where':{'id':_0x399ee7[_0x98e1('0x41')]['id']}})[_0x98e1('0x21')](handleEntityNotFound(_0x29a7a7,null))[_0x98e1('0x21')](saveUpdates(_0x399ee7[_0x98e1('0x45')],null))[_0x98e1('0x21')](respondWithResult(_0x29a7a7,null))[_0x98e1('0x40')](handleError(_0x29a7a7,null));};exports[_0x98e1('0x22')]=function(_0x41b2f5,_0x3f4f7e){return db[_0x98e1('0x2b')][_0x98e1('0x43')]({'where':{'id':_0x41b2f5[_0x98e1('0x41')]['id']}})[_0x98e1('0x21')](handleEntityNotFound(_0x3f4f7e,null))[_0x98e1('0x21')](removeEntity(_0x3f4f7e,null))[_0x98e1('0x40')](handleError(_0x3f4f7e,null));};exports[_0x98e1('0x4c')]=function(_0x25f442,_0x4b085b,_0x168137){var _0x4cc230;return db[_0x98e1('0x2b')][_0x98e1('0x43')]({'where':{'id':_0x25f442['params']['id']},'attributes':['id',_0x98e1('0x4d')]})[_0x98e1('0x21')](handleEntityNotFound(_0x4b085b,null))['then'](function(_0x103cd9){if(_0x103cd9){var _0x5948f6=require(_0x98e1('0x4e'))();_0x5948f6[_0x98e1('0x4f')](_0x103cd9[_0x98e1('0x4d')]);_0x5948f6[_0x98e1('0x50')]();return _0x103cd9;}})[_0x98e1('0x21')](respondWithResult(_0x4b085b,null))['catch'](handleError(_0x4b085b,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 142684d..9a420c1 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 _0xdace=['moment','request-promise','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger','api'];(function(_0xd40a6b,_0x20f0ab){var _0x34f245=function(_0x22a412){while(--_0x22a412){_0xd40a6b['push'](_0xd40a6b['shift']());}};_0x34f245(++_0x20f0ab);}(_0xdace,0xc5));var _0xedac=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0xdace[_0x1e081a];return _0x428209;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var attributes=require(_0xedac('0x5'));module[_0xedac('0x6')]=function(_0xefb142,_0x5a97c0){return _0xefb142[_0xedac('0x7')](_0xedac('0x8'),attributes,{'tableName':_0xedac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['lodash','../../config/logger','api','moment','bluebird','request-promise','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x14b097,_0x2d6b02){var _0x37ae63=function(_0x40395e){while(--_0x40395e){_0x14b097['push'](_0x14b097['shift']());}};_0x37ae63(++_0x2d6b02);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xb4e6[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var attributes=require(_0x6b4e('0x6'));module[_0x6b4e('0x7')]=function(_0x52313b,_0x40da90){return _0x52313b[_0x6b4e('0x8')](_0x6b4e('0x9'),attributes,{'tableName':'square_odbc','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 d6c99fa..3411929 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 _0xba38=['stringify','error','code','message','result','ShowSquareOdbc','SquareOdbc','find','options','raw','map','include','model','attributes','then','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xba38,0x17c));var _0x8ba3=function(_0x33c0bf,_0xbba1b3){_0x33c0bf=_0x33c0bf-0x0;var _0x1910c6=_0xba38[_0x33c0bf];return _0x1910c6;};'use strict';var _=require(_0x8ba3('0x0'));var util=require(_0x8ba3('0x1'));var moment=require(_0x8ba3('0x2'));var BPromise=require(_0x8ba3('0x3'));var rs=require(_0x8ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8ba3('0x5'));var logger=require(_0x8ba3('0x6'))('rpc');var config=require(_0x8ba3('0x7'));var jayson=require(_0x8ba3('0x8'));var client=jayson[_0x8ba3('0x9')][_0x8ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b06cc,_0x4a968a,_0x5a3910){return new BPromise(function(_0x529a5c,_0x3c0ada){return client[_0x8ba3('0xb')](_0x2b06cc,_0x5a3910)['then'](function(_0x248921){logger['info'](_0x8ba3('0xc'),_0x4a968a,_0x8ba3('0xd'));logger[_0x8ba3('0xe')](_0x8ba3('0xf'),_0x4a968a,_0x8ba3('0xd'),JSON[_0x8ba3('0x10')](_0x248921));if(_0x248921['error']){if(_0x248921[_0x8ba3('0x11')][_0x8ba3('0x12')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x4a968a,_0x248921[_0x8ba3('0x11')][_0x8ba3('0x13')]);return _0x3c0ada(_0x248921['error']['message']);}logger[_0x8ba3('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4a968a,_0x248921[_0x8ba3('0x11')][_0x8ba3('0x13')]);return _0x529a5c(_0x248921[_0x8ba3('0x11')]['message']);}else{logger['info'](_0x8ba3('0xc'),_0x4a968a,_0x8ba3('0xd'));_0x529a5c(_0x248921[_0x8ba3('0x14')][_0x8ba3('0x13')]);}})['catch'](function(_0x4261a2){logger['error'](_0x8ba3('0xc'),_0x4a968a,_0x4261a2);_0x3c0ada(_0x4261a2);});});}exports[_0x8ba3('0x15')]=function(_0x91e2b6){var _0x244cfa=this;return new Promise(function(_0x397185,_0x2296fa){return db[_0x8ba3('0x16')][_0x8ba3('0x17')]({'raw':_0x91e2b6[_0x8ba3('0x18')]?_0x91e2b6[_0x8ba3('0x18')][_0x8ba3('0x19')]===undefined?!![]:![]:!![],'where':_0x91e2b6[_0x8ba3('0x18')]?_0x91e2b6['options']['where']||null:null,'attributes':_0x91e2b6['options']?_0x91e2b6[_0x8ba3('0x18')]['attributes']||null:null,'include':_0x91e2b6['options']?_0x91e2b6[_0x8ba3('0x18')]['include']?_[_0x8ba3('0x1a')](_0x91e2b6[_0x8ba3('0x18')][_0x8ba3('0x1b')],function(_0x5614bb){return{'model':db[_0x5614bb['model']],'as':_0x5614bb['as'],'attributes':_0x5614bb['attributes'],'include':_0x5614bb[_0x8ba3('0x1b')]?_['map'](_0x5614bb[_0x8ba3('0x1b')],function(_0x322b0e){return{'model':db[_0x322b0e[_0x8ba3('0x1c')]],'as':_0x322b0e['as'],'attributes':_0x322b0e[_0x8ba3('0x1d')],'include':_0x322b0e['include']?_[_0x8ba3('0x1a')](_0x322b0e['include'],function(_0x532201){return{'model':db[_0x532201['model']],'as':_0x532201['as'],'attributes':_0x532201['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ba3('0x1e')](function(_0x4aa1ba){logger[_0x8ba3('0x1f')](_0x8ba3('0x15'),_0x91e2b6);logger[_0x8ba3('0xe')]('ShowSquareOdbc',_0x91e2b6,JSON[_0x8ba3('0x10')](_0x4aa1ba));_0x397185(_0x4aa1ba);})[_0x8ba3('0x20')](function(_0x18c359){logger[_0x8ba3('0x11')](_0x8ba3('0x15'),_0x18c359[_0x8ba3('0x13')],_0x91e2b6);_0x2296fa(_0x244cfa['error'](0x1f4,_0x18c359[_0x8ba3('0x13')]));});});}; \ No newline at end of file +var _0x6029=['then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','catch','SquareOdbc','find','options','raw','where','attributes','include','model','map','ShowSquareOdbc','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request'];(function(_0xf93b19,_0x1881f4){var _0x53cf20=function(_0x4a2340){while(--_0x4a2340){_0xf93b19['push'](_0xf93b19['shift']());}};_0x53cf20(++_0x1881f4);}(_0x6029,0xee));var _0x9602=function(_0x3e89d0,_0x487173){_0x3e89d0=_0x3e89d0-0x0;var _0x263a8a=_0x6029[_0x3e89d0];return _0x263a8a;};'use strict';var _=require(_0x9602('0x0'));var util=require(_0x9602('0x1'));var moment=require('moment');var BPromise=require(_0x9602('0x2'));var rs=require(_0x9602('0x3'));var fs=require('fs');var Redis=require(_0x9602('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9602('0x5'));var logger=require('../../config/logger')(_0x9602('0x6'));var config=require('../../config/environment');var jayson=require(_0x9602('0x7'));var client=jayson[_0x9602('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14da49,_0xa43e57,_0x5df6c9){return new BPromise(function(_0x5d934b,_0x1cada0){return client[_0x9602('0x9')](_0x14da49,_0x5df6c9)[_0x9602('0xa')](function(_0x363f7e){logger[_0x9602('0xb')]('SquareOdbc,\x20%s,\x20%s',_0xa43e57,_0x9602('0xc'));logger[_0x9602('0xd')](_0x9602('0xe'),_0xa43e57,_0x9602('0xc'),JSON[_0x9602('0xf')](_0x363f7e));if(_0x363f7e[_0x9602('0x10')]){if(_0x363f7e[_0x9602('0x10')][_0x9602('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0xa43e57,_0x363f7e[_0x9602('0x10')][_0x9602('0x12')]);return _0x1cada0(_0x363f7e[_0x9602('0x10')][_0x9602('0x12')]);}logger[_0x9602('0x10')](_0x9602('0x13'),_0xa43e57,_0x363f7e[_0x9602('0x10')]['message']);return _0x5d934b(_0x363f7e[_0x9602('0x10')][_0x9602('0x12')]);}else{logger[_0x9602('0xb')](_0x9602('0x13'),_0xa43e57,_0x9602('0xc'));_0x5d934b(_0x363f7e['result']['message']);}})[_0x9602('0x14')](function(_0x121423){logger[_0x9602('0x10')](_0x9602('0x13'),_0xa43e57,_0x121423);_0x1cada0(_0x121423);});});}exports['ShowSquareOdbc']=function(_0x160ef9){var _0x4021c1=this;return new Promise(function(_0x4fe7a6,_0x14a08b){return db[_0x9602('0x15')][_0x9602('0x16')]({'raw':_0x160ef9[_0x9602('0x17')]?_0x160ef9['options'][_0x9602('0x18')]===undefined?!![]:![]:!![],'where':_0x160ef9[_0x9602('0x17')]?_0x160ef9[_0x9602('0x17')][_0x9602('0x19')]||null:null,'attributes':_0x160ef9[_0x9602('0x17')]?_0x160ef9[_0x9602('0x17')][_0x9602('0x1a')]||null:null,'include':_0x160ef9[_0x9602('0x17')]?_0x160ef9[_0x9602('0x17')][_0x9602('0x1b')]?_['map'](_0x160ef9[_0x9602('0x17')][_0x9602('0x1b')],function(_0x54b1bf){return{'model':db[_0x54b1bf[_0x9602('0x1c')]],'as':_0x54b1bf['as'],'attributes':_0x54b1bf['attributes'],'include':_0x54b1bf['include']?_[_0x9602('0x1d')](_0x54b1bf[_0x9602('0x1b')],function(_0x1caf45){return{'model':db[_0x1caf45[_0x9602('0x1c')]],'as':_0x1caf45['as'],'attributes':_0x1caf45[_0x9602('0x1a')],'include':_0x1caf45[_0x9602('0x1b')]?_['map'](_0x1caf45[_0x9602('0x1b')],function(_0x40d6b9){return{'model':db[_0x40d6b9[_0x9602('0x1c')]],'as':_0x40d6b9['as'],'attributes':_0x40d6b9[_0x9602('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9602('0xa')](function(_0x21e87b){logger[_0x9602('0xb')](_0x9602('0x1e'),_0x160ef9);logger['debug'](_0x9602('0x1e'),_0x160ef9,JSON[_0x9602('0xf')](_0x21e87b));_0x4fe7a6(_0x21e87b);})[_0x9602('0x14')](function(_0x3aabe7){logger[_0x9602('0x10')](_0x9602('0x1e'),_0x3aabe7[_0x9602('0x12')],_0x160ef9);_0x14a08b(_0x4021c1[_0x9602('0x10')](0x1f4,_0x3aabe7[_0x9602('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 9f5fccb..2858e22 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 _0x59fc=['show','/:id/users','getUsers','post','create','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','./squareProject.controller','get','isAuthenticated','index','/:id'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0x59fc,0xa1));var _0xc59f=function(_0x417b5,_0x4474b4){_0x417b5=_0x417b5-0x0;var _0x166387=_0x59fc[_0x417b5];return _0x166387;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc59f('0x0'));var timeout=require(_0xc59f('0x1'));var express=require(_0xc59f('0x2'));var router=express[_0xc59f('0x3')]();var auth=require(_0xc59f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc59f('0x5'));router[_0xc59f('0x6')]('/',auth[_0xc59f('0x7')](),controller[_0xc59f('0x8')]);router[_0xc59f('0x6')](_0xc59f('0x9'),auth['isAuthenticated'](),controller[_0xc59f('0xa')]);router['get'](_0xc59f('0xb'),auth['isAuthenticated'](),controller[_0xc59f('0xc')]);router[_0xc59f('0xd')]('/',auth[_0xc59f('0x7')](),controller[_0xc59f('0xe')]);router['post'](_0xc59f('0xb'),auth[_0xc59f('0x7')](),controller['addUsers']);router[_0xc59f('0xf')](_0xc59f('0x9'),auth[_0xc59f('0x7')](),controller[_0xc59f('0x10')]);router[_0xc59f('0x11')](_0xc59f('0x9'),auth[_0xc59f('0x7')](),controller['destroy']);router[_0xc59f('0x11')](_0xc59f('0xb'),auth[_0xc59f('0x7')](),controller['removeUsers']);module[_0xc59f('0x12')]=router; \ No newline at end of file +var _0x5066=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','get','/:id','show','/:id/users','getUsers','post','create','isAuthenticated','addUsers','put','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x5066,0x1be));var _0x6506=function(_0x4d3a9b,_0x20b47d){_0x4d3a9b=_0x4d3a9b-0x0;var _0x1b5471=_0x5066[_0x4d3a9b];return _0x1b5471;};'use strict';var multer=require(_0x6506('0x0'));var util=require(_0x6506('0x1'));var path=require(_0x6506('0x2'));var timeout=require(_0x6506('0x3'));var express=require(_0x6506('0x4'));var router=express[_0x6506('0x5')]();var auth=require(_0x6506('0x6'));var interaction=require(_0x6506('0x7'));var config=require(_0x6506('0x8'));var controller=require(_0x6506('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6506('0xa')]);router[_0x6506('0xb')](_0x6506('0xc'),auth['isAuthenticated'](),controller[_0x6506('0xd')]);router[_0x6506('0xb')](_0x6506('0xe'),auth['isAuthenticated'](),controller[_0x6506('0xf')]);router[_0x6506('0x10')]('/',auth['isAuthenticated'](),controller[_0x6506('0x11')]);router[_0x6506('0x10')]('/:id/users',auth[_0x6506('0x12')](),controller[_0x6506('0x13')]);router[_0x6506('0x14')](_0x6506('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6506('0x15')](_0x6506('0xc'),auth[_0x6506('0x12')](),controller[_0x6506('0x16')]);router[_0x6506('0x15')](_0x6506('0xe'),auth[_0x6506('0x12')](),controller[_0x6506('0x17')]);module[_0x6506('0x18')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 6ca9415..3f6d8de 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 _0x7046=['long','preproduction','getDataValue','toString','utf8','sequelize','exports','STRING','name','TEXT','BLOB'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x7046,0x144));var _0x6704=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7046[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x6704('0x0'));module[_0x6704('0x1')]={'name':{'type':Sequelize[_0x6704('0x2')],'unique':_0x6704('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x6704('0x4')]},'preproduction':{'type':Sequelize[_0x6704('0x5')](_0x6704('0x6')),'get':function(){if(this['getDataValue'](_0x6704('0x7'))){return this[_0x6704('0x8')](_0x6704('0x7'))[_0x6704('0x9')](_0x6704('0xa'));}}},'production':{'type':Sequelize['BLOB'](_0x6704('0x6')),'get':function(){if(this['getDataValue']('production')){return this[_0x6704('0x8')]('production')['toString'](_0x6704('0xa'));}}}}; \ No newline at end of file +var _0x8ca9=['sequelize','exports','STRING','name','TEXT','BLOB','preproduction','utf8','long','getDataValue','production','toString'];(function(_0x3463fb,_0x18f39a){var _0x3787bc=function(_0x1ae005){while(--_0x1ae005){_0x3463fb['push'](_0x3463fb['shift']());}};_0x3787bc(++_0x18f39a);}(_0x8ca9,0x9c));var _0x98ca=function(_0x304589,_0x4b9d0f){_0x304589=_0x304589-0x0;var _0x2a8d05=_0x8ca9[_0x304589];return _0x2a8d05;};'use strict';var Sequelize=require(_0x98ca('0x0'));module[_0x98ca('0x1')]={'name':{'type':Sequelize[_0x98ca('0x2')],'unique':_0x98ca('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x98ca('0x2')]},'notes':{'type':Sequelize[_0x98ca('0x4')]},'preproduction':{'type':Sequelize[_0x98ca('0x5')]('long'),'get':function(){if(this['getDataValue'](_0x98ca('0x6'))){return this['getDataValue'](_0x98ca('0x6'))['toString'](_0x98ca('0x7'));}}},'production':{'type':Sequelize[_0x98ca('0x5')](_0x98ca('0x8')),'get':function(){if(this[_0x98ca('0x9')](_0x98ca('0xa'))){return this[_0x98ca('0x9')](_0x98ca('0xa'))[_0x98ca('0xb')](_0x98ca('0x7'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 7d8065b..dd23786 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 _0xadb5=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./squareProject.socket','status','json','count','offset','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','sendStatus','name','send','index','SquareProject','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filters','map','key','VIRTUAL','field','includeAll','findAll','rows','catch','show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','sort','filter','merge','getUsers','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x42d35d,_0x33e6fc){var _0x445dbc=function(_0x45fb03){while(--_0x45fb03){_0x42d35d['push'](_0x42d35d['shift']());}};_0x445dbc(++_0x33e6fc);}(_0xadb5,0xad));var _0x5adb=function(_0x3b4d78,_0x373814){_0x3b4d78=_0x3b4d78-0x0;var _0x4b7cd6=_0xadb5[_0x3b4d78];return _0x4b7cd6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var authService=require(_0x5adb('0x11'));var hardwareService=require(_0x5adb('0x12'));var Redis=require(_0x5adb('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x5adb('0x14'));var utils=require(_0x5adb('0x15'));var config=require(_0x5adb('0x16'));var db=require('../../mysqldb')['db'];config[_0x5adb('0x17')]=_['defaults'](config[_0x5adb('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5adb('0x18'))(new Redis(config[_0x5adb('0x17')]));require(_0x5adb('0x19'))['register'](socket);function respondWithStatusCode(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xcc;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['sendStatus'](_0x34af2c);}return _0x2a545b[_0x5adb('0x1a')](_0x34af2c)['end']();};}function respondWithResult(_0x367d82,_0x42a482){_0x42a482=_0x42a482||0xc8;return function(_0x30614e){if(_0x30614e){return _0x367d82[_0x5adb('0x1a')](_0x42a482)[_0x5adb('0x1b')](_0x30614e);}};}function respondWithFilteredResult(_0x39d24d,_0xa29dc){return function(_0x42f4c6){if(_0x42f4c6){var _0xb953a6=_0x42f4c6[_0x5adb('0x1c')],_0x529b65=_0xa29dc['offset'],_0x3fff62=_0xa29dc[_0x5adb('0x1d')]+_0xa29dc['limit'],_0x5de028;if(_0x3fff62>=_0xb953a6){_0x3fff62=_0xb953a6;_0x5de028=0xc8;}else{_0x5de028=0xce;}_0x39d24d['status'](_0x5de028);return _0x39d24d[_0x5adb('0x1e')](_0x5adb('0x1f'),_0x529b65+'-'+_0x3fff62+'/'+_0xb953a6)[_0x5adb('0x1b')](_0x42f4c6);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x20')](_0x3754cc)[_0x5adb('0x21')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x22')]()[_0x5adb('0x21')](function(){var _0x3839fb=_0x4b1957[_0x5adb('0x23')]({'plain':!![]});var _0x49f203=_0x5adb('0x24');return db[_0x5adb('0x25')]['destroy']({'where':{'type':_0x49f203,'resourceId':_0x3839fb['id']}})[_0x5adb('0x21')](function(){return _0x4b1957;});})[_0x5adb('0x21')](function(){_0xfd9bb9[_0x5adb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ad1d,_0xbe21b1){return function(_0x3a4fca){if(!_0x3a4fca){_0x13ad1d[_0x5adb('0x26')](0x194);}return _0x3a4fca;};}function handleError(_0x36459b,_0x1c06c4){_0x1c06c4=_0x1c06c4||0x1f4;return function(_0x4a5d46){logger['error'](_0x4a5d46['stack']);if(_0x4a5d46[_0x5adb('0x27')]){delete _0x4a5d46[_0x5adb('0x27')];}_0x36459b[_0x5adb('0x1a')](_0x1c06c4)[_0x5adb('0x28')](_0x4a5d46);};}exports[_0x5adb('0x29')]=function(_0x4de310,_0x11ec2a){var _0x34b793={},_0x372da1={},_0x3b1fed={'count':0x0,'rows':[]};var _0x450169=db[_0x5adb('0x2a')][_0x5adb('0x2b')];_0x372da1[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](_0x450169);_0x372da1[_0x5adb('0x2e')]=_['keys'](_0x4de310[_0x5adb('0x2e')]);_0x372da1['filters']=_[_0x5adb('0x2f')](_0x372da1[_0x5adb('0x2c')],_0x372da1['query']);_0x34b793[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x372da1[_0x5adb('0x2c')],qs['fields'](_0x4de310[_0x5adb('0x2e')][_0x5adb('0x31')]));_0x34b793['attributes']=_0x34b793['attributes'][_0x5adb('0x32')]?_0x34b793['attributes']:_0x372da1[_0x5adb('0x2c')];if(!_0x4de310[_0x5adb('0x2e')][_0x5adb('0x33')](_0x5adb('0x34'))){_0x34b793[_0x5adb('0x35')]=qs['limit'](_0x4de310[_0x5adb('0x2e')][_0x5adb('0x35')]);_0x34b793[_0x5adb('0x1d')]=qs['offset'](_0x4de310['query'][_0x5adb('0x1d')]);}_0x34b793[_0x5adb('0x36')]=qs['sort'](_0x4de310[_0x5adb('0x2e')]['sort']);_0x34b793[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4de310['query'],_0x372da1[_0x5adb('0x39')]));if(_0x4de310[_0x5adb('0x2e')]['filter']){_0x34b793[_0x5adb('0x37')]=_['merge'](_0x34b793[_0x5adb('0x37')],{'$or':_[_0x5adb('0x3a')](_0x450169,function(_0xd5660c){if(_0xd5660c['type'][_0x5adb('0x3b')]!==_0x5adb('0x3c')){var _0xcdaf8e={};_0xcdaf8e[_0xd5660c[_0x5adb('0x3d')]]={'$like':'%'+_0x4de310[_0x5adb('0x2e')]['filter']+'%'};return _0xcdaf8e;}})});}_0x34b793=_['merge']({},_0x34b793,_0x4de310['options']);var _0x599999={'where':_0x34b793[_0x5adb('0x37')]};return db[_0x5adb('0x2a')][_0x5adb('0x1c')](_0x599999)[_0x5adb('0x21')](function(_0x130e18){_0x3b1fed[_0x5adb('0x1c')]=_0x130e18;if(_0x4de310[_0x5adb('0x2e')][_0x5adb('0x3e')]){_0x34b793['include']=[{'all':!![]}];}return db['SquareProject'][_0x5adb('0x3f')](_0x34b793);})['then'](function(_0xa9f72d){_0x3b1fed[_0x5adb('0x40')]=_0xa9f72d;return _0x3b1fed;})[_0x5adb('0x21')](respondWithFilteredResult(_0x11ec2a,_0x34b793))[_0x5adb('0x41')](handleError(_0x11ec2a,null));};exports[_0x5adb('0x42')]=function(_0x522ee5,_0x43d320){var _0x565b03={'raw':![],'where':{'id':_0x522ee5[_0x5adb('0x43')]['id']}},_0x508690={};_0x508690[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x2b')]);_0x508690[_0x5adb('0x2e')]=_[_0x5adb('0x2d')](_0x522ee5[_0x5adb('0x2e')]);_0x508690[_0x5adb('0x39')]=_[_0x5adb('0x2f')](_0x508690['model'],_0x508690['query']);_0x565b03[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x508690[_0x5adb('0x2c')],qs[_0x5adb('0x31')](_0x522ee5['query']['fields']));_0x565b03[_0x5adb('0x30')]=_0x565b03[_0x5adb('0x30')][_0x5adb('0x32')]?_0x565b03[_0x5adb('0x30')]:_0x508690[_0x5adb('0x2c')];if(_0x522ee5['query'][_0x5adb('0x3e')]){_0x565b03[_0x5adb('0x44')]=[{'all':!![]}];}_0x565b03=_['merge']({},_0x565b03,_0x522ee5[_0x5adb('0x45')]);return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x565b03)[_0x5adb('0x21')](handleEntityNotFound(_0x43d320,null))[_0x5adb('0x21')](respondWithResult(_0x43d320,null))[_0x5adb('0x41')](handleError(_0x43d320,null));};exports[_0x5adb('0x47')]=function(_0x54252,_0x49e1a1){return db[_0x5adb('0x2a')]['create'](_0x54252['body'],{})['then'](function(_0x3cd211){var _0x3fbac8=_0x54252[_0x5adb('0x48')]['get']({'plain':!![]});if(!_0x3fbac8)throw new Error(_0x5adb('0x49'));if(_0x3fbac8['role']===_0x5adb('0x48')){var _0x2c3f21=_0x3cd211[_0x5adb('0x23')]({'plain':!![]});var _0x541537=_0x5adb('0x24');return db['UserProfileSection'][_0x5adb('0x46')]({'where':{'name':_0x541537,'userProfileId':_0x3fbac8[_0x5adb('0x4a')]},'raw':!![]})['then'](function(_0x2402a3){if(_0x2402a3&&_0x2402a3[_0x5adb('0x4b')]===0x0){return db[_0x5adb('0x25')][_0x5adb('0x47')]({'name':_0x2c3f21[_0x5adb('0x27')],'resourceId':_0x2c3f21['id'],'type':_0x2402a3['name'],'sectionId':_0x2402a3['id']},{})[_0x5adb('0x21')](function(){return _0x3cd211;});}else{return _0x3cd211;}})[_0x5adb('0x41')](function(_0x3bcf6f){logger[_0x5adb('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bcf6f);throw _0x3bcf6f;});}return _0x3cd211;})[_0x5adb('0x21')](respondWithResult(_0x49e1a1,0xc9))[_0x5adb('0x41')](handleError(_0x49e1a1,null));};exports[_0x5adb('0x20')]=function(_0x4d98d0,_0x2b34a8){if(_0x4d98d0[_0x5adb('0x4d')]['id']){delete _0x4d98d0[_0x5adb('0x4d')]['id'];}return db[_0x5adb('0x2a')]['find']({'where':{'id':_0x4d98d0[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x2b34a8,null))[_0x5adb('0x21')](saveUpdates(_0x4d98d0[_0x5adb('0x4d')],null))[_0x5adb('0x21')](respondWithResult(_0x2b34a8,null))['catch'](handleError(_0x2b34a8,null));};exports[_0x5adb('0x22')]=function(_0x4b8d28,_0x2b790d){return db['SquareProject'][_0x5adb('0x46')]({'where':{'id':_0x4b8d28[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x2b790d,null))[_0x5adb('0x21')](removeEntity(_0x2b790d,null))['catch'](handleError(_0x2b790d,null));};exports[_0x5adb('0x4e')]=function(_0x229ae2,_0x24b1f1,_0x53d262){return db['SquareProject']['find']({'where':{'id':_0x229ae2[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x24b1f1,null))[_0x5adb('0x21')](function(_0x12a146){if(_0x12a146){return _0x12a146[_0x5adb('0x4e')](_0x229ae2[_0x5adb('0x4d')][_0x5adb('0x4f')],_[_0x5adb('0x50')](_0x229ae2[_0x5adb('0x4d')],[_0x5adb('0x4f'),'id'])||{});}})[_0x5adb('0x21')](respondWithResult(_0x24b1f1,null))[_0x5adb('0x41')](handleError(_0x24b1f1,null));};exports[_0x5adb('0x51')]=function(_0x511746,_0x49f4c8,_0x3d55c2){var _0x27a8e4;return db[_0x5adb('0x2a')][_0x5adb('0x46')]({'where':{'id':_0x511746['params']['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x49f4c8,null))[_0x5adb('0x21')](function(_0x5d2d2f){if(_0x5d2d2f){return _0x5d2d2f[_0x5adb('0x51')](_0x511746[_0x5adb('0x2e')][_0x5adb('0x4f')])['then'](function(_0x30d185){if(_[_0x5adb('0x52')](_0x511746[_0x5adb('0x2e')][_0x5adb('0x4f')])){for(var _0x330290=0x0;_0x330290<_0x511746[_0x5adb('0x2e')]['ids'][_0x5adb('0x32')];_0x330290+=0x1){socket[_0x5adb('0x53')](_0x5adb('0x54'),{'UserId':_0x511746['query'][_0x5adb('0x4f')][_0x330290],'SquareProjectId':_0x511746[_0x5adb('0x43')]['id']});}}else{socket[_0x5adb('0x53')]('userSquareProject:remove',{'UserId':_0x511746[_0x5adb('0x2e')]['ids'],'SquareProjectId':_0x511746[_0x5adb('0x43')]['id']});}});}})[_0x5adb('0x21')](respondWithStatusCode(_0x49f4c8,null))[_0x5adb('0x41')](handleError(_0x49f4c8,null));};exports['getUsers']=function(_0x192b1f,_0x3627d1,_0x539814){var _0x12711e={};var _0x432a3e={};var _0x248739;var _0x3fcad5;return db['SquareProject'][_0x5adb('0x55')]({'where':{'id':_0x192b1f[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x3627d1,null))[_0x5adb('0x21')](function(_0x5b7556){if(_0x5b7556){_0x248739=_0x5b7556;_0x432a3e['model']=_[_0x5adb('0x2d')](db['User']['rawAttributes']);_0x432a3e['query']=_[_0x5adb('0x2d')](_0x192b1f[_0x5adb('0x2e')]);_0x432a3e['filters']=_[_0x5adb('0x2f')](_0x432a3e[_0x5adb('0x2c')],_0x432a3e[_0x5adb('0x2e')]);_0x12711e[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x432a3e[_0x5adb('0x2c')],qs[_0x5adb('0x31')](_0x192b1f[_0x5adb('0x2e')]['fields']));_0x12711e['attributes']=_0x12711e['attributes'][_0x5adb('0x32')]?_0x12711e[_0x5adb('0x30')]:_0x432a3e[_0x5adb('0x2c')];_0x12711e[_0x5adb('0x36')]=qs[_0x5adb('0x56')](_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x56')]);_0x12711e[_0x5adb('0x37')]=qs['filters'](_['pick'](_0x192b1f[_0x5adb('0x2e')],_0x432a3e[_0x5adb('0x39')]));if(_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x57')]){_0x12711e[_0x5adb('0x37')]=_[_0x5adb('0x58')](_0x12711e[_0x5adb('0x37')],{'$or':_[_0x5adb('0x3a')](_0x12711e[_0x5adb('0x30')],function(_0x3b5ecf){var _0x484f3d={};_0x484f3d[_0x3b5ecf]={'$like':'%'+_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x57')]+'%'};return _0x484f3d;})});}_0x12711e=_[_0x5adb('0x58')]({},_0x12711e,_0x192b1f['options']);return _0x248739[_0x5adb('0x59')](_0x12711e);}})[_0x5adb('0x21')](function(_0x4f7bd0){if(_0x4f7bd0){_0x3fcad5=_0x4f7bd0[_0x5adb('0x32')];if(!_0x192b1f['query'][_0x5adb('0x33')](_0x5adb('0x34'))){_0x12711e['limit']=qs[_0x5adb('0x35')](_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x35')]);_0x12711e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x1d')]);}return _0x248739[_0x5adb('0x59')](_0x12711e);}})['then'](function(_0x3786b4){if(_0x3786b4){return _0x3786b4?{'count':_0x3fcad5,'rows':_0x3786b4}:null;}})[_0x5adb('0x21')](respondWithResult(_0x3627d1,null))[_0x5adb('0x41')](handleError(_0x3627d1,null));}; \ No newline at end of file +var _0x5f2f=['field','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','role','UserProfileSection','error','update','body','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','User','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','SquareProjects','UserProfileResource','destroy','stack','name','index','SquareProject','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','key','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f2f,0x73));var _0xf5f2=function(_0x14cb95,_0x41d1ba){_0x14cb95=_0x14cb95-0x0;var _0x4585b6=_0x5f2f[_0x14cb95];return _0x4585b6;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var authService=require(_0xf5f2('0x11'));var hardwareService=require(_0xf5f2('0x12'));var Redis=require('ioredis');var qs=require(_0xf5f2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xf5f2('0x14'));var config=require(_0xf5f2('0x15'));var db=require('../../mysqldb')['db'];config[_0xf5f2('0x16')]=_[_0xf5f2('0x17')](config[_0xf5f2('0x16')],{'host':_0xf5f2('0x18'),'port':0x18eb});var socket=require(_0xf5f2('0x19'))(new Redis(config[_0xf5f2('0x16')]));require('./squareProject.socket')[_0xf5f2('0x1a')](socket);function respondWithStatusCode(_0xea612c,_0x269909){_0x269909=_0x269909||0xcc;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1b')](_0x269909);}return _0xea612c['status'](_0x269909)[_0xf5f2('0x1c')]();};}function respondWithResult(_0x286197,_0x17d656){_0x17d656=_0x17d656||0xc8;return function(_0x1b6dd2){if(_0x1b6dd2){return _0x286197[_0xf5f2('0x1d')](_0x17d656)[_0xf5f2('0x1e')](_0x1b6dd2);}};}function respondWithFilteredResult(_0xdb61b3,_0x395a5a){return function(_0x11f702){if(_0x11f702){var _0x228ace=_0x11f702[_0xf5f2('0x1f')],_0x20fccd=_0x395a5a[_0xf5f2('0x20')],_0x28e097=_0x395a5a[_0xf5f2('0x20')]+_0x395a5a[_0xf5f2('0x21')],_0x4ff59b;if(_0x28e097>=_0x228ace){_0x28e097=_0x228ace;_0x4ff59b=0xc8;}else{_0x4ff59b=0xce;}_0xdb61b3['status'](_0x4ff59b);return _0xdb61b3[_0xf5f2('0x22')](_0xf5f2('0x23'),_0x20fccd+'-'+_0x28e097+'/'+_0x228ace)['json'](_0x11f702);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x24')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x25')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x26')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x27')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){var _0x5f1124=_0x287ad5[_0xf5f2('0x28')]({'plain':!![]});var _0x13da6f=_0xf5f2('0x29');return db[_0xf5f2('0x2a')][_0xf5f2('0x2b')]({'where':{'type':_0x13da6f,'resourceId':_0x5f1124['id']}})[_0xf5f2('0x27')](function(){return _0x287ad5;});})[_0xf5f2('0x27')](function(){_0x4e8bda[_0xf5f2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaa2602,_0x102449){return function(_0x375ca8){if(!_0x375ca8){_0xaa2602[_0xf5f2('0x1b')](0x194);}return _0x375ca8;};}function handleError(_0x198c73,_0x477604){_0x477604=_0x477604||0x1f4;return function(_0x5b6672){logger['error'](_0x5b6672[_0xf5f2('0x2c')]);if(_0x5b6672[_0xf5f2('0x2d')]){delete _0x5b6672[_0xf5f2('0x2d')];}_0x198c73['status'](_0x477604)['send'](_0x5b6672);};}exports[_0xf5f2('0x2e')]=function(_0x50b8a2,_0x17394a){var _0x153924={},_0x1b381e={},_0x54c0c8={'count':0x0,'rows':[]};var _0x52e959=db[_0xf5f2('0x2f')]['rawAttributes'];_0x1b381e[_0xf5f2('0x30')]=_['keys'](_0x52e959);_0x1b381e[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](_0x50b8a2[_0xf5f2('0x31')]);_0x1b381e[_0xf5f2('0x33')]=_[_0xf5f2('0x34')](_0x1b381e[_0xf5f2('0x30')],_0x1b381e[_0xf5f2('0x31')]);_0x153924[_0xf5f2('0x35')]=_['intersection'](_0x1b381e[_0xf5f2('0x30')],qs[_0xf5f2('0x36')](_0x50b8a2[_0xf5f2('0x31')][_0xf5f2('0x36')]));_0x153924[_0xf5f2('0x35')]=_0x153924[_0xf5f2('0x35')][_0xf5f2('0x37')]?_0x153924['attributes']:_0x1b381e[_0xf5f2('0x30')];if(!_0x50b8a2[_0xf5f2('0x31')]['hasOwnProperty'](_0xf5f2('0x38'))){_0x153924['limit']=qs[_0xf5f2('0x21')](_0x50b8a2[_0xf5f2('0x31')][_0xf5f2('0x21')]);_0x153924[_0xf5f2('0x20')]=qs['offset'](_0x50b8a2['query'][_0xf5f2('0x20')]);}_0x153924[_0xf5f2('0x39')]=qs[_0xf5f2('0x3a')](_0x50b8a2['query'][_0xf5f2('0x3a')]);_0x153924['where']=qs[_0xf5f2('0x33')](_['pick'](_0x50b8a2[_0xf5f2('0x31')],_0x1b381e[_0xf5f2('0x33')]));if(_0x50b8a2['query'][_0xf5f2('0x3b')]){_0x153924[_0xf5f2('0x3c')]=_[_0xf5f2('0x3d')](_0x153924[_0xf5f2('0x3c')],{'$or':_['map'](_0x52e959,function(_0x5d2d82){if(_0x5d2d82[_0xf5f2('0x3e')][_0xf5f2('0x3f')]!==_0xf5f2('0x40')){var _0x2d4400={};_0x2d4400[_0x5d2d82[_0xf5f2('0x41')]]={'$like':'%'+_0x50b8a2[_0xf5f2('0x31')][_0xf5f2('0x3b')]+'%'};return _0x2d4400;}})});}_0x153924=_['merge']({},_0x153924,_0x50b8a2[_0xf5f2('0x42')]);var _0x3b4ea6={'where':_0x153924['where']};return db[_0xf5f2('0x2f')][_0xf5f2('0x1f')](_0x3b4ea6)[_0xf5f2('0x27')](function(_0x85b6d0){_0x54c0c8[_0xf5f2('0x1f')]=_0x85b6d0;if(_0x50b8a2[_0xf5f2('0x31')][_0xf5f2('0x43')]){_0x153924[_0xf5f2('0x44')]=[{'all':!![]}];}return db['SquareProject'][_0xf5f2('0x45')](_0x153924);})[_0xf5f2('0x27')](function(_0x17a78e){_0x54c0c8['rows']=_0x17a78e;return _0x54c0c8;})['then'](respondWithFilteredResult(_0x17394a,_0x153924))['catch'](handleError(_0x17394a,null));};exports[_0xf5f2('0x46')]=function(_0x2ad13c,_0x4c8d8e){var _0x106272={'raw':![],'where':{'id':_0x2ad13c[_0xf5f2('0x47')]['id']}},_0xeed03d={};_0xeed03d[_0xf5f2('0x30')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x2f')][_0xf5f2('0x48')]);_0xeed03d[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](_0x2ad13c[_0xf5f2('0x31')]);_0xeed03d[_0xf5f2('0x33')]=_[_0xf5f2('0x34')](_0xeed03d[_0xf5f2('0x30')],_0xeed03d[_0xf5f2('0x31')]);_0x106272['attributes']=_[_0xf5f2('0x34')](_0xeed03d['model'],qs[_0xf5f2('0x36')](_0x2ad13c[_0xf5f2('0x31')][_0xf5f2('0x36')]));_0x106272[_0xf5f2('0x35')]=_0x106272[_0xf5f2('0x35')][_0xf5f2('0x37')]?_0x106272['attributes']:_0xeed03d[_0xf5f2('0x30')];if(_0x2ad13c[_0xf5f2('0x31')][_0xf5f2('0x43')]){_0x106272[_0xf5f2('0x44')]=[{'all':!![]}];}_0x106272=_[_0xf5f2('0x3d')]({},_0x106272,_0x2ad13c[_0xf5f2('0x42')]);return db[_0xf5f2('0x2f')][_0xf5f2('0x49')](_0x106272)['then'](handleEntityNotFound(_0x4c8d8e,null))[_0xf5f2('0x27')](respondWithResult(_0x4c8d8e,null))[_0xf5f2('0x4a')](handleError(_0x4c8d8e,null));};exports[_0xf5f2('0x4b')]=function(_0x492eea,_0x1177ba){return db[_0xf5f2('0x2f')][_0xf5f2('0x4b')](_0x492eea['body'],{})['then'](function(_0x7bb942){var _0x27c472=_0x492eea['user'][_0xf5f2('0x28')]({'plain':!![]});if(!_0x27c472)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27c472[_0xf5f2('0x4c')]==='user'){var _0x2cbd9d=_0x7bb942['get']({'plain':!![]});var _0x2d9017=_0xf5f2('0x29');return db[_0xf5f2('0x4d')][_0xf5f2('0x49')]({'where':{'name':_0x2d9017,'userProfileId':_0x27c472['userProfileId']},'raw':!![]})[_0xf5f2('0x27')](function(_0x2b782f){if(_0x2b782f&&_0x2b782f['autoAssociation']===0x0){return db['UserProfileResource'][_0xf5f2('0x4b')]({'name':_0x2cbd9d[_0xf5f2('0x2d')],'resourceId':_0x2cbd9d['id'],'type':_0x2b782f['name'],'sectionId':_0x2b782f['id']},{})[_0xf5f2('0x27')](function(){return _0x7bb942;});}else{return _0x7bb942;}})[_0xf5f2('0x4a')](function(_0x29c9b6){logger[_0xf5f2('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29c9b6);throw _0x29c9b6;});}return _0x7bb942;})['then'](respondWithResult(_0x1177ba,0xc9))[_0xf5f2('0x4a')](handleError(_0x1177ba,null));};exports[_0xf5f2('0x4f')]=function(_0x4b62fc,_0x40eef){if(_0x4b62fc[_0xf5f2('0x50')]['id']){delete _0x4b62fc[_0xf5f2('0x50')]['id'];}return db[_0xf5f2('0x2f')][_0xf5f2('0x49')]({'where':{'id':_0x4b62fc[_0xf5f2('0x47')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x40eef,null))['then'](saveUpdates(_0x4b62fc['body'],null))[_0xf5f2('0x27')](respondWithResult(_0x40eef,null))[_0xf5f2('0x4a')](handleError(_0x40eef,null));};exports[_0xf5f2('0x2b')]=function(_0x46a905,_0x21b0d3){return db['SquareProject'][_0xf5f2('0x49')]({'where':{'id':_0x46a905[_0xf5f2('0x47')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x21b0d3,null))['then'](removeEntity(_0x21b0d3,null))[_0xf5f2('0x4a')](handleError(_0x21b0d3,null));};exports['addUsers']=function(_0x78f1d2,_0x1a8d33,_0x28cce5){return db[_0xf5f2('0x2f')]['find']({'where':{'id':_0x78f1d2['params']['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x1a8d33,null))['then'](function(_0xa39c65){if(_0xa39c65){return _0xa39c65[_0xf5f2('0x51')](_0x78f1d2['body'][_0xf5f2('0x52')],_[_0xf5f2('0x53')](_0x78f1d2[_0xf5f2('0x50')],['ids','id'])||{});}})[_0xf5f2('0x27')](respondWithResult(_0x1a8d33,null))[_0xf5f2('0x4a')](handleError(_0x1a8d33,null));};exports[_0xf5f2('0x54')]=function(_0x4579f4,_0x51fa7e,_0x421692){var _0x506fe5;return db[_0xf5f2('0x2f')][_0xf5f2('0x49')]({'where':{'id':_0x4579f4[_0xf5f2('0x47')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x51fa7e,null))[_0xf5f2('0x27')](function(_0x5583c2){if(_0x5583c2){return _0x5583c2[_0xf5f2('0x54')](_0x4579f4[_0xf5f2('0x31')][_0xf5f2('0x52')])[_0xf5f2('0x27')](function(_0x2c5733){if(_['isArray'](_0x4579f4[_0xf5f2('0x31')]['ids'])){for(var _0x4c96ee=0x0;_0x4c96ee<_0x4579f4[_0xf5f2('0x31')]['ids'][_0xf5f2('0x37')];_0x4c96ee+=0x1){socket[_0xf5f2('0x55')](_0xf5f2('0x56'),{'UserId':_0x4579f4[_0xf5f2('0x31')]['ids'][_0x4c96ee],'SquareProjectId':_0x4579f4[_0xf5f2('0x47')]['id']});}}else{socket[_0xf5f2('0x55')](_0xf5f2('0x56'),{'UserId':_0x4579f4[_0xf5f2('0x31')][_0xf5f2('0x52')],'SquareProjectId':_0x4579f4[_0xf5f2('0x47')]['id']});}});}})[_0xf5f2('0x27')](respondWithStatusCode(_0x51fa7e,null))['catch'](handleError(_0x51fa7e,null));};exports[_0xf5f2('0x57')]=function(_0x2d171d,_0xb39a6e,_0x45c7c1){var _0x5a5b2b={};var _0x1de396={};var _0x4cce08;var _0x410866;return db[_0xf5f2('0x2f')]['findOne']({'where':{'id':_0x2d171d[_0xf5f2('0x47')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0xb39a6e,null))[_0xf5f2('0x27')](function(_0x138c55){if(_0x138c55){_0x4cce08=_0x138c55;_0x1de396[_0xf5f2('0x30')]=_['keys'](db[_0xf5f2('0x58')][_0xf5f2('0x48')]);_0x1de396[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](_0x2d171d[_0xf5f2('0x31')]);_0x1de396[_0xf5f2('0x33')]=_['intersection'](_0x1de396[_0xf5f2('0x30')],_0x1de396[_0xf5f2('0x31')]);_0x5a5b2b['attributes']=_[_0xf5f2('0x34')](_0x1de396[_0xf5f2('0x30')],qs[_0xf5f2('0x36')](_0x2d171d['query']['fields']));_0x5a5b2b['attributes']=_0x5a5b2b[_0xf5f2('0x35')][_0xf5f2('0x37')]?_0x5a5b2b[_0xf5f2('0x35')]:_0x1de396[_0xf5f2('0x30')];_0x5a5b2b[_0xf5f2('0x39')]=qs['sort'](_0x2d171d[_0xf5f2('0x31')][_0xf5f2('0x3a')]);_0x5a5b2b[_0xf5f2('0x3c')]=qs[_0xf5f2('0x33')](_[_0xf5f2('0x59')](_0x2d171d[_0xf5f2('0x31')],_0x1de396[_0xf5f2('0x33')]));if(_0x2d171d[_0xf5f2('0x31')][_0xf5f2('0x3b')]){_0x5a5b2b[_0xf5f2('0x3c')]=_[_0xf5f2('0x3d')](_0x5a5b2b['where'],{'$or':_['map'](_0x5a5b2b['attributes'],function(_0x40f362){var _0xafba8e={};_0xafba8e[_0x40f362]={'$like':'%'+_0x2d171d[_0xf5f2('0x31')][_0xf5f2('0x3b')]+'%'};return _0xafba8e;})});}_0x5a5b2b=_[_0xf5f2('0x3d')]({},_0x5a5b2b,_0x2d171d['options']);return _0x4cce08[_0xf5f2('0x57')](_0x5a5b2b);}})[_0xf5f2('0x27')](function(_0x301006){if(_0x301006){_0x410866=_0x301006[_0xf5f2('0x37')];if(!_0x2d171d[_0xf5f2('0x31')]['hasOwnProperty'](_0xf5f2('0x38'))){_0x5a5b2b[_0xf5f2('0x21')]=qs['limit'](_0x2d171d[_0xf5f2('0x31')][_0xf5f2('0x21')]);_0x5a5b2b[_0xf5f2('0x20')]=qs[_0xf5f2('0x20')](_0x2d171d['query'][_0xf5f2('0x20')]);}return _0x4cce08[_0xf5f2('0x57')](_0x5a5b2b);}})[_0xf5f2('0x27')](function(_0x2adeb4){if(_0x2adeb4){return _0x2adeb4?{'count':_0x410866,'rows':_0x2adeb4}:null;}})[_0xf5f2('0x27')](respondWithResult(_0xb39a6e,null))['catch'](handleError(_0xb39a6e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3a94ee5..0d06051 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 _0x316d=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x441f41,_0x4cf2c3){var _0x293a9e=function(_0x34a274){while(--_0x34a274){_0x441f41['push'](_0x441f41['shift']());}};_0x293a9e(++_0x4cf2c3);}(_0x316d,0xaf));var _0xd316=function(_0xdd96d5,_0x22195b){_0xdd96d5=_0xdd96d5-0x0;var _0x273ce0=_0x316d[_0xdd96d5];return _0x273ce0;};'use strict';var EventEmitter=require(_0xd316('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd316('0x1')](0x0);var events={'afterCreate':_0xd316('0x2'),'afterUpdate':_0xd316('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5eaae8){return function(_0x3be2bd,_0x59c0ca,_0x1d26ef){SquareProjectEvents[_0xd316('0x4')](_0x5eaae8+':'+_0x3be2bd['id'],_0x3be2bd);SquareProjectEvents[_0xd316('0x4')](_0x5eaae8,_0x3be2bd);_0x1d26ef(null);};}for(var e in events){if(events[_0xd316('0x5')](e)){var event=events[e];SquareProject[_0xd316('0x6')](e,emitEvent(event));}}module[_0xd316('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x47cb=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject'];(function(_0x4c0998,_0x165050){var _0x1110e2=function(_0x7cb8c3){while(--_0x7cb8c3){_0x4c0998['push'](_0x4c0998['shift']());}};_0x1110e2(++_0x165050);}(_0x47cb,0x10c));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xb47c('0x0'))['db'][_0xb47c('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb47c('0x2')](0x0);var events={'afterCreate':_0xb47c('0x3'),'afterUpdate':_0xb47c('0x4'),'afterDestroy':_0xb47c('0x5')};function emitEvent(_0x4e75e2){return function(_0x3817e5,_0x164052,_0xeb57ee){SquareProjectEvents[_0xb47c('0x6')](_0x4e75e2+':'+_0x3817e5['id'],_0x3817e5);SquareProjectEvents[_0xb47c('0x6')](_0x4e75e2,_0x3817e5);_0xeb57ee(null);};}for(var e in events){if(events[_0xb47c('0x7')](e)){var event=events[e];SquareProject[_0xb47c('0x8')](e,emitEvent(event));}}module[_0xb47c('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index cc4d74d..0e0880c 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 _0x0299=['define','SquareProject','square_projects','lodash','util','../../config/logger','moment','bluebird','exports'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x0299,0x93));var _0x9029=function(_0x958eee,_0x217efe){_0x958eee=_0x958eee-0x0;var _0x4a055c=_0x0299[_0x958eee];return _0x4a055c;};'use strict';var _=require(_0x9029('0x0'));var util=require(_0x9029('0x1'));var logger=require(_0x9029('0x2'))('api');var moment=require(_0x9029('0x3'));var BPromise=require(_0x9029('0x4'));var rp=require('request-promise');var attributes=require('./squareProject.attributes');module[_0x9029('0x5')]=function(_0x3bcfe2,_0x521a90){return _0x3bcfe2[_0x9029('0x6')](_0x9029('0x7'),attributes,{'tableName':_0x9029('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddc4=['moment','bluebird','request-promise','./squareProject.attributes','exports','define','square_projects','util','../../config/logger','api'];(function(_0x48cb2a,_0xef57e3){var _0x52a1a0=function(_0x303f2f){while(--_0x303f2f){_0x48cb2a['push'](_0x48cb2a['shift']());}};_0x52a1a0(++_0xef57e3);}(_0xddc4,0xa7));var _0x4ddc=function(_0x429b63,_0x3ff026){_0x429b63=_0x429b63-0x0;var _0x703972=_0xddc4[_0x429b63];return _0x703972;};'use strict';var _=require('lodash');var util=require(_0x4ddc('0x0'));var logger=require(_0x4ddc('0x1'))(_0x4ddc('0x2'));var moment=require(_0x4ddc('0x3'));var BPromise=require(_0x4ddc('0x4'));var rp=require(_0x4ddc('0x5'));var attributes=require(_0x4ddc('0x6'));module[_0x4ddc('0x7')]=function(_0x3f0d2c,_0x26da6d){return _0x3f0d2c[_0x4ddc('0x8')]('SquareProject',attributes,{'tableName':_0x4ddc('0x9'),'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 4ed13e9..e109248 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 _0xa9e0=['catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2d913d,_0x5f42dd){var _0x3991be=function(_0x4bd806){while(--_0x4bd806){_0x2d913d['push'](_0x2d913d['shift']());}};_0x3991be(++_0x5f42dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('SquareProject,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['SquareProject'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')],function(_0x42ac8f){return{'model':db[_0x42ac8f[_0x0a9e('0x21')]],'as':_0x42ac8f['as'],'attributes':_0x42ac8f['attributes'],'include':_0x42ac8f['include']?_[_0x0a9e('0x20')](_0x42ac8f[_0x0a9e('0x1f')],function(_0x40c424){return{'model':db[_0x40c424[_0x0a9e('0x21')]],'as':_0x40c424['as'],'attributes':_0x40c424['attributes'],'include':_0x40c424[_0x0a9e('0x1f')]?_['map'](_0x40c424[_0x0a9e('0x1f')],function(_0x5bfb33){return{'model':db[_0x5bfb33[_0x0a9e('0x21')]],'as':_0x5bfb33['as'],'attributes':_0x5bfb33[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x22')](function(_0x14433c){logger[_0x0a9e('0x16')](_0x0a9e('0x19'),_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON['stringify'](_0x14433c));_0x1c696a(_0x14433c);})[_0x0a9e('0x18')](function(_0x468813){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x468813['message'],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x468813[_0x0a9e('0x15')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x21ed98,_0x4a4209){var _0x4012bf=function(_0x46a9df){while(--_0x46a9df){_0x21ed98['push'](_0x21ed98['shift']());}};_0x4012bf(++_0x4a4209);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('SquareProject,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['SquareProject'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')],function(_0x42ac8f){return{'model':db[_0x42ac8f[_0x0a9e('0x21')]],'as':_0x42ac8f['as'],'attributes':_0x42ac8f['attributes'],'include':_0x42ac8f['include']?_[_0x0a9e('0x20')](_0x42ac8f[_0x0a9e('0x1f')],function(_0x40c424){return{'model':db[_0x40c424[_0x0a9e('0x21')]],'as':_0x40c424['as'],'attributes':_0x40c424['attributes'],'include':_0x40c424[_0x0a9e('0x1f')]?_['map'](_0x40c424[_0x0a9e('0x1f')],function(_0x5bfb33){return{'model':db[_0x5bfb33[_0x0a9e('0x21')]],'as':_0x5bfb33['as'],'attributes':_0x5bfb33[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x22')](function(_0x14433c){logger[_0x0a9e('0x16')](_0x0a9e('0x19'),_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON['stringify'](_0x14433c));_0x1c696a(_0x14433c);})[_0x0a9e('0x18')](function(_0x468813){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x468813['message'],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x468813[_0x0a9e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 915992a..94bb038 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 _0x59ce=['removeListener','squareProject:','./squareProject.events','save','remove','emit'];(function(_0x8eac1c,_0x4369d6){var _0x77e112=function(_0x3123ad){while(--_0x3123ad){_0x8eac1c['push'](_0x8eac1c['shift']());}};_0x77e112(++_0x4369d6);}(_0x59ce,0x92));var _0xe59c=function(_0x4d89fa,_0x56a49a){_0x4d89fa=_0x4d89fa-0x0;var _0x1b44a3=_0x59ce[_0x4d89fa];return _0x1b44a3;};'use strict';var SquareProjectEvents=require(_0xe59c('0x0'));var events=[_0xe59c('0x1'),_0xe59c('0x2'),'update'];function createListener(_0x9cdd6a,_0x18c8c3){return function(_0x455361){_0x18c8c3[_0xe59c('0x3')](_0x9cdd6a,_0x455361);};}function removeListener(_0x2ea56e,_0x42a856){return function(){SquareProjectEvents[_0xe59c('0x4')](_0x2ea56e,_0x42a856);};}exports['register']=function(_0x387c49){for(var _0x4ba903=0x0,_0x534601=events['length'];_0x4ba903<_0x534601;_0x4ba903++){var _0x2c1d11=events[_0x4ba903];var _0x101a79=createListener(_0xe59c('0x5')+_0x2c1d11,_0x387c49);SquareProjectEvents['on'](_0x2c1d11,_0x101a79);}}; \ No newline at end of file +var _0x720c=['removeListener','register','length','squareProject:','./squareProject.events','remove','update','emit'];(function(_0x29deb,_0x5669e3){var _0xf1667=function(_0x462361){while(--_0x462361){_0x29deb['push'](_0x29deb['shift']());}};_0xf1667(++_0x5669e3);}(_0x720c,0x154));var _0xc720=function(_0x4bc984,_0xd65bdd){_0x4bc984=_0x4bc984-0x0;var _0x500594=_0x720c[_0x4bc984];return _0x500594;};'use strict';var SquareProjectEvents=require(_0xc720('0x0'));var events=['save',_0xc720('0x1'),_0xc720('0x2')];function createListener(_0x304440,_0x127edb){return function(_0x5e0261){_0x127edb[_0xc720('0x3')](_0x304440,_0x5e0261);};}function removeListener(_0x2336e6,_0x3e4155){return function(){SquareProjectEvents[_0xc720('0x4')](_0x2336e6,_0x3e4155);};}exports[_0xc720('0x5')]=function(_0x6f8d9f){for(var _0x7d6830=0x0,_0x5bc8b0=events[_0xc720('0x6')];_0x7d6830<_0x5bc8b0;_0x7d6830++){var _0x8a01fc=events[_0x7d6830];var _0x10a2c8=createListener(_0xc720('0x7')+_0x8a01fc,_0x6f8d9f);SquareProjectEvents['on'](_0x8a01fc,_0x10a2c8);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 8143fa9..dbe6502 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 _0x6b76=['../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','/:id/download','download','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b76,0xa5));var _0x66b7=function(_0x5d3e7e,_0x384be2){_0x5d3e7e=_0x5d3e7e-0x0;var _0x2ad9ae=_0x6b76[_0x5d3e7e];return _0x2ad9ae;};'use strict';var multer=require(_0x66b7('0x0'));var util=require('util');var path=require(_0x66b7('0x1'));var timeout=require(_0x66b7('0x2'));var express=require(_0x66b7('0x3'));var router=express[_0x66b7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x66b7('0x5'));var config=require(_0x66b7('0x6'));var controller=require(_0x66b7('0x7'));router[_0x66b7('0x8')]('/',auth['isAuthenticated'](),controller[_0x66b7('0x9')]);router['get'](_0x66b7('0xa'),auth[_0x66b7('0xb')](),controller['show']);router[_0x66b7('0x8')](_0x66b7('0xc'),auth[_0x66b7('0xb')](),controller[_0x66b7('0xd')]);router['post']('/',auth[_0x66b7('0xb')](),controller['create']);router[_0x66b7('0xe')](_0x66b7('0xa'),auth['isAuthenticated'](),controller[_0x66b7('0xf')]);router[_0x66b7('0x10')](_0x66b7('0xa'),auth[_0x66b7('0xb')](),controller[_0x66b7('0x11')]);module[_0x66b7('0x12')]=router; \ No newline at end of file +var _0x56fe=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','post','create','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x56fe,0x19b));var _0xe56f=function(_0x2f2230,_0x3d5f55){_0x2f2230=_0x2f2230-0x0;var _0x3f9712=_0x56fe[_0x2f2230];return _0x3f9712;};'use strict';var multer=require('multer');var util=require(_0xe56f('0x0'));var path=require(_0xe56f('0x1'));var timeout=require(_0xe56f('0x2'));var express=require('express');var router=express[_0xe56f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe56f('0x4'));var config=require(_0xe56f('0x5'));var controller=require('./squareRecording.controller');router[_0xe56f('0x6')]('/',auth[_0xe56f('0x7')](),controller[_0xe56f('0x8')]);router[_0xe56f('0x6')](_0xe56f('0x9'),auth[_0xe56f('0x7')](),controller['show']);router['get'](_0xe56f('0xa'),auth['isAuthenticated'](),controller[_0xe56f('0xb')]);router[_0xe56f('0xc')]('/',auth[_0xe56f('0x7')](),controller[_0xe56f('0xd')]);router['put'](_0xe56f('0x9'),auth[_0xe56f('0x7')](),controller[_0xe56f('0xe')]);router[_0xe56f('0xf')](_0xe56f('0x9'),auth[_0xe56f('0x7')](),controller[_0xe56f('0x10')]);module[_0xe56f('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index e42dc91..2d214e6 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 _0x7916=['sequelize','exports','STRING'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x7916,0x15c));var _0x6791=function(_0xe03820,_0x596bf2){_0xe03820=_0xe03820-0x0;var _0x33160f=_0x7916[_0xe03820];return _0x33160f;};'use strict';var Sequelize=require(_0x6791('0x0'));module[_0x6791('0x1')]={'uniqueid':{'type':Sequelize[_0x6791('0x2')]},'callerid':{'type':Sequelize[_0x6791('0x2')]},'calleridname':{'type':Sequelize[_0x6791('0x2')]},'context':{'type':Sequelize[_0x6791('0x2')]},'extension':{'type':Sequelize[_0x6791('0x2')]},'priority':{'type':Sequelize[_0x6791('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x6791('0x2')]},'projectName':{'type':Sequelize[_0x6791('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x6791('0x2')]},'savePath':{'type':Sequelize[_0x6791('0x2')]}}; \ No newline at end of file +var _0xfb02=['exports','STRING','sequelize'];(function(_0xa8a539,_0x3f6c33){var _0xa56b53=function(_0x51ab31){while(--_0x51ab31){_0xa8a539['push'](_0xa8a539['shift']());}};_0xa56b53(++_0x3f6c33);}(_0xfb02,0x182));var _0x2fb0=function(_0x27c0f8,_0xd1bd2f){_0x27c0f8=_0x27c0f8-0x0;var _0x426b4e=_0xfb02[_0x27c0f8];return _0x426b4e;};'use strict';var Sequelize=require(_0x2fb0('0x0'));module[_0x2fb0('0x1')]={'uniqueid':{'type':Sequelize[_0x2fb0('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2fb0('0x2')]},'context':{'type':Sequelize[_0x2fb0('0x2')]},'extension':{'type':Sequelize[_0x2fb0('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2fb0('0x2')]},'dnid':{'type':Sequelize[_0x2fb0('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x2fb0('0x2')]},'filename':{'type':Sequelize[_0x2fb0('0x2')]},'savePath':{'type':Sequelize[_0x2fb0('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 5373041..75d239b 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 _0x80e4=['where','merge','map','type','key','VIRTUAL','field','includeAll','include','show','params','rawAttributes','fields','length','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','update','then','sendStatus','stack','name','send','SquareRecording','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x5b18bf,_0x2befce){var _0x2513e8=function(_0x3bf26a){while(--_0x3bf26a){_0x5b18bf['push'](_0x5b18bf['shift']());}};_0x2513e8(++_0x2befce);}(_0x80e4,0x111));var _0x480e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x80e4[_0x376b45];return _0x2341b3;};'use strict';var pdf=require(_0x480e('0x0'));var emlformat=require(_0x480e('0x1'));var rimraf=require(_0x480e('0x2'));var zipdir=require(_0x480e('0x3'));var jsonpatch=require(_0x480e('0x4'));var rp=require(_0x480e('0x5'));var moment=require(_0x480e('0x6'));var BPromise=require(_0x480e('0x7'));var Mustache=require(_0x480e('0x8'));var util=require(_0x480e('0x9'));var path=require(_0x480e('0xa'));var sox=require(_0x480e('0xb'));var csv=require('to-csv');var ejs=require(_0x480e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x480e('0xd'));var crypto=require('crypto');var jsforce=require(_0x480e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x480e('0xf'));var querystring=require('querystring');var Papa=require(_0x480e('0x10'));var authService=require(_0x480e('0x11'));var hardwareService=require(_0x480e('0x12'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x480e('0x13'))(_0x480e('0x14'));var utils=require(_0x480e('0x15'));var config=require(_0x480e('0x16'));var db=require(_0x480e('0x17'))['db'];function respondWithStatusCode(_0x2d48c4,_0x330ebf){_0x330ebf=_0x330ebf||0xcc;return function(_0x5655a5){if(_0x5655a5){return _0x2d48c4['sendStatus'](_0x330ebf);}return _0x2d48c4[_0x480e('0x18')](_0x330ebf)[_0x480e('0x19')]();};}function respondWithResult(_0x2405a1,_0x4d1c41){_0x4d1c41=_0x4d1c41||0xc8;return function(_0x2c7090){if(_0x2c7090){return _0x2405a1[_0x480e('0x18')](_0x4d1c41)[_0x480e('0x1a')](_0x2c7090);}};}function respondWithFilteredResult(_0x50c3b5,_0x2e2e77){return function(_0x1d475e){if(_0x1d475e){var _0x189fc0=_0x1d475e['count'],_0x372565=_0x2e2e77[_0x480e('0x1b')],_0x52dc96=_0x2e2e77[_0x480e('0x1b')]+_0x2e2e77[_0x480e('0x1c')],_0x567741;if(_0x52dc96>=_0x189fc0){_0x52dc96=_0x189fc0;_0x567741=0xc8;}else{_0x567741=0xce;}_0x50c3b5[_0x480e('0x18')](_0x567741);return _0x50c3b5[_0x480e('0x1d')]('Content-Range',_0x372565+'-'+_0x52dc96+'/'+_0x189fc0)[_0x480e('0x1a')](_0x1d475e);}return null;};}function patchUpdates(_0x3c2945){return function(_0x495246){try{jsonpatch[_0x480e('0x1e')](_0x495246,_0x3c2945,!![]);}catch(_0x28ff26){return BPromise[_0x480e('0x1f')](_0x28ff26);}return _0x495246[_0x480e('0x20')]();};}function saveUpdates(_0x164760,_0x17c033){return function(_0x593b13){if(_0x593b13){return _0x593b13[_0x480e('0x21')](_0x164760)[_0x480e('0x22')](function(_0x223c59){return _0x223c59;});}return null;};}function removeEntity(_0x3b9cd3,_0x49ea8a){return function(_0x19ff82){if(_0x19ff82){return _0x19ff82['destroy']()[_0x480e('0x22')](function(){_0x3b9cd3[_0x480e('0x18')](0xcc)[_0x480e('0x19')]();});}};}function handleEntityNotFound(_0x5ef10a,_0xa915b4){return function(_0x59591c){if(!_0x59591c){_0x5ef10a[_0x480e('0x23')](0x194);}return _0x59591c;};}function handleError(_0x52d9cd,_0x3bb86d){_0x3bb86d=_0x3bb86d||0x1f4;return function(_0x3e78a9){logger['error'](_0x3e78a9[_0x480e('0x24')]);if(_0x3e78a9['name']){delete _0x3e78a9[_0x480e('0x25')];}_0x52d9cd['status'](_0x3bb86d)[_0x480e('0x26')](_0x3e78a9);};}exports['index']=function(_0x2daeed,_0x17f33a){var _0x103175={},_0x18589c={},_0x3b1162={'count':0x0,'rows':[]};var _0x59927d=db[_0x480e('0x27')]['rawAttributes'];_0x18589c[_0x480e('0x28')]=_[_0x480e('0x29')](_0x59927d);_0x18589c[_0x480e('0x2a')]=_[_0x480e('0x29')](_0x2daeed[_0x480e('0x2a')]);_0x18589c[_0x480e('0x2b')]=_['intersection'](_0x18589c[_0x480e('0x28')],_0x18589c[_0x480e('0x2a')]);_0x103175['attributes']=_[_0x480e('0x2c')](_0x18589c[_0x480e('0x28')],qs['fields'](_0x2daeed[_0x480e('0x2a')]['fields']));_0x103175[_0x480e('0x2d')]=_0x103175[_0x480e('0x2d')]['length']?_0x103175[_0x480e('0x2d')]:_0x18589c[_0x480e('0x28')];if(!_0x2daeed['query'][_0x480e('0x2e')](_0x480e('0x2f'))){_0x103175[_0x480e('0x1c')]=qs[_0x480e('0x1c')](_0x2daeed[_0x480e('0x2a')][_0x480e('0x1c')]);_0x103175['offset']=qs[_0x480e('0x1b')](_0x2daeed[_0x480e('0x2a')][_0x480e('0x1b')]);}_0x103175[_0x480e('0x30')]=qs['sort'](_0x2daeed[_0x480e('0x2a')][_0x480e('0x31')]);_0x103175['where']=qs[_0x480e('0x2b')](_['pick'](_0x2daeed['query'],_0x18589c[_0x480e('0x2b')]));if(_0x2daeed[_0x480e('0x2a')][_0x480e('0x32')]){_0x103175[_0x480e('0x33')]=_[_0x480e('0x34')](_0x103175['where'],{'$or':_[_0x480e('0x35')](_0x59927d,function(_0x5adf68){if(_0x5adf68[_0x480e('0x36')][_0x480e('0x37')]!==_0x480e('0x38')){var _0x20ecfb={};_0x20ecfb[_0x5adf68[_0x480e('0x39')]]={'$like':'%'+_0x2daeed[_0x480e('0x2a')][_0x480e('0x32')]+'%'};return _0x20ecfb;}})});}_0x103175=_[_0x480e('0x34')]({},_0x103175,_0x2daeed['options']);var _0x3e1280={'where':_0x103175['where']};return db[_0x480e('0x27')]['count'](_0x3e1280)[_0x480e('0x22')](function(_0x4212e0){_0x3b1162['count']=_0x4212e0;if(_0x2daeed['query'][_0x480e('0x3a')]){_0x103175[_0x480e('0x3b')]=[{'all':!![]}];}return db[_0x480e('0x27')]['findAll'](_0x103175);})[_0x480e('0x22')](function(_0xab8e6f){_0x3b1162['rows']=_0xab8e6f;return _0x3b1162;})[_0x480e('0x22')](respondWithFilteredResult(_0x17f33a,_0x103175))['catch'](handleError(_0x17f33a,null));};exports[_0x480e('0x3c')]=function(_0x48e5b7,_0x4c8b8c){var _0x13ce3b={'raw':!![],'where':{'id':_0x48e5b7[_0x480e('0x3d')]['id']}},_0x43447a={};_0x43447a['model']=_['keys'](db['SquareRecording'][_0x480e('0x3e')]);_0x43447a['query']=_[_0x480e('0x29')](_0x48e5b7[_0x480e('0x2a')]);_0x43447a[_0x480e('0x2b')]=_[_0x480e('0x2c')](_0x43447a[_0x480e('0x28')],_0x43447a[_0x480e('0x2a')]);_0x13ce3b['attributes']=_['intersection'](_0x43447a['model'],qs[_0x480e('0x3f')](_0x48e5b7[_0x480e('0x2a')][_0x480e('0x3f')]));_0x13ce3b[_0x480e('0x2d')]=_0x13ce3b['attributes'][_0x480e('0x40')]?_0x13ce3b[_0x480e('0x2d')]:_0x43447a['model'];if(_0x48e5b7['query'][_0x480e('0x3a')]){_0x13ce3b['include']=[{'all':!![]}];}_0x13ce3b=_[_0x480e('0x34')]({},_0x13ce3b,_0x48e5b7['options']);return db[_0x480e('0x27')][_0x480e('0x41')](_0x13ce3b)[_0x480e('0x22')](handleEntityNotFound(_0x4c8b8c,null))['then'](respondWithResult(_0x4c8b8c,null))[_0x480e('0x42')](handleError(_0x4c8b8c,null));};exports[_0x480e('0x43')]=function(_0x39bbe5,_0x4dd8e1){return db[_0x480e('0x27')]['create'](_0x39bbe5['body'],{})['then'](respondWithResult(_0x4dd8e1,0xc9))['catch'](handleError(_0x4dd8e1,null));};exports[_0x480e('0x21')]=function(_0x4c4f28,_0x561ebb){if(_0x4c4f28[_0x480e('0x44')]['id']){delete _0x4c4f28[_0x480e('0x44')]['id'];}return db[_0x480e('0x27')][_0x480e('0x41')]({'where':{'id':_0x4c4f28[_0x480e('0x3d')]['id']}})[_0x480e('0x22')](handleEntityNotFound(_0x561ebb,null))['then'](saveUpdates(_0x4c4f28[_0x480e('0x44')],null))[_0x480e('0x22')](respondWithResult(_0x561ebb,null))[_0x480e('0x42')](handleError(_0x561ebb,null));};exports['destroy']=function(_0x2a3199,_0x49ceb4){return db['SquareRecording'][_0x480e('0x41')]({'where':{'id':_0x2a3199[_0x480e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x49ceb4,null))[_0x480e('0x22')](removeEntity(_0x49ceb4,null))[_0x480e('0x42')](handleError(_0x49ceb4,null));};exports[_0x480e('0x45')]=function(_0x48d000,_0x4c370d,_0x24d7d3){var _0x5ef940=require(_0x480e('0x46'));var _0x5f2cac=![];var _0x3489a5={};if(_0x48d000['query'][_0x480e('0x36')]&&_0x48d000['query']['type']===_0x480e('0x47')){_0x3489a5['uniqueid']=_0x48d000[_0x480e('0x3d')]['id'];}else{_0x3489a5['id']=_0x48d000[_0x480e('0x3d')]['id'];}return db['SquareRecording'][_0x480e('0x41')]({'where':_0x3489a5,'attributes':['id',_0x480e('0x48'),_0x480e('0x49')],'raw':!![]})[_0x480e('0x22')](handleEntityNotFound(_0x4c370d,null))[_0x480e('0x22')](function(_0x18e176){if(_0x18e176){var _0x4f798e=util[_0x480e('0x4a')](_0x480e('0x4b'),_0x18e176['value']);if(fs['existsSync'](_0x4f798e)){_0x5f2cac=!![];return _0x5ef940[_0x480e('0x4c')](_0x4f798e,_0x18e176[_0x480e('0x48')],config['secrets'][_0x480e('0x4d')])[_0x480e('0x22')](function(){return _0x18e176;});}return _0x18e176;}})[_0x480e('0x22')](function(_0xb57c2f){if(_0xb57c2f){if(!fs[_0x480e('0x4e')](_0xb57c2f[_0x480e('0x48')])){throw new db[(_0x480e('0x4f'))]['ValidationError'](_0x480e('0x50'));}if(_0xb57c2f[_0x480e('0x49')]){return _0x4c370d[_0x480e('0x45')](_0xb57c2f[_0x480e('0x48')],_0xb57c2f[_0x480e('0x49')]+path['extname'](_0xb57c2f['savePath']),function(){if(_0x5f2cac){fs['unlink'](_0xb57c2f[_0x480e('0x48')]);}});}else{return _0x4c370d[_0x480e('0x45')](_0xb57c2f[_0x480e('0x48')],function(_0x3a550d){if(_0x5f2cac){fs['unlink'](_0xb57c2f[_0x480e('0x48')]);}});}}})[_0x480e('0x42')](handleError(_0x4c370d,null));}; \ No newline at end of file +var _0x7a98=['type','VIRTUAL','field','merge','count','includeAll','include','rows','show','options','find','catch','create','body','download','../../components/encryptor','uniqueid','params','filename','format','%s.cypher','value','existsSync','decryptFile','savePath','secrets','ValidationError','SquareRecording\x20not\x20found','extname','unlink','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','send','index','SquareRecording','rawAttributes','model','keys','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0x7a98,0xc4));var _0x87a9=function(_0x2563a3,_0x2863fc){_0x2563a3=_0x2563a3-0x0;var _0x1b7e81=_0x7a98[_0x2563a3];return _0x1b7e81;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x87a9('0x0'));var rp=require(_0x87a9('0x1'));var moment=require(_0x87a9('0x2'));var BPromise=require(_0x87a9('0x3'));var Mustache=require('mustache');var util=require(_0x87a9('0x4'));var path=require(_0x87a9('0x5'));var sox=require(_0x87a9('0x6'));var csv=require(_0x87a9('0x7'));var ejs=require(_0x87a9('0x8'));var fs=require('fs');var _=require(_0x87a9('0x9'));var squel=require(_0x87a9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x87a9('0xb'));var toCsv=require(_0x87a9('0x7'));var querystring=require('querystring');var Papa=require(_0x87a9('0xc'));var authService=require('../../components/auth/service');var hardwareService=require(_0x87a9('0xd'));var Redis=require(_0x87a9('0xe'));var qs=require(_0x87a9('0xf'));var logger=require(_0x87a9('0x10'))(_0x87a9('0x11'));var utils=require(_0x87a9('0x12'));var config=require(_0x87a9('0x13'));var db=require(_0x87a9('0x14'))['db'];function respondWithStatusCode(_0x19021a,_0x5c18d7){_0x5c18d7=_0x5c18d7||0xcc;return function(_0x30d8e4){if(_0x30d8e4){return _0x19021a['sendStatus'](_0x5c18d7);}return _0x19021a[_0x87a9('0x15')](_0x5c18d7)[_0x87a9('0x16')]();};}function respondWithResult(_0x3303b0,_0x3e4d67){_0x3e4d67=_0x3e4d67||0xc8;return function(_0x1639c3){if(_0x1639c3){return _0x3303b0[_0x87a9('0x15')](_0x3e4d67)[_0x87a9('0x17')](_0x1639c3);}};}function respondWithFilteredResult(_0x5ba95f,_0x412f4f){return function(_0x229d9a){if(_0x229d9a){var _0x9d5e7a=_0x229d9a['count'],_0x17ce7d=_0x412f4f[_0x87a9('0x18')],_0x11a454=_0x412f4f[_0x87a9('0x18')]+_0x412f4f[_0x87a9('0x19')],_0x359a04;if(_0x11a454>=_0x9d5e7a){_0x11a454=_0x9d5e7a;_0x359a04=0xc8;}else{_0x359a04=0xce;}_0x5ba95f[_0x87a9('0x15')](_0x359a04);return _0x5ba95f[_0x87a9('0x1a')](_0x87a9('0x1b'),_0x17ce7d+'-'+_0x11a454+'/'+_0x9d5e7a)[_0x87a9('0x17')](_0x229d9a);}return null;};}function patchUpdates(_0x5a343c){return function(_0x5062e6){try{jsonpatch['apply'](_0x5062e6,_0x5a343c,!![]);}catch(_0x1a5128){return BPromise['reject'](_0x1a5128);}return _0x5062e6['save']();};}function saveUpdates(_0x21b3fc,_0x581346){return function(_0x5c8802){if(_0x5c8802){return _0x5c8802[_0x87a9('0x1c')](_0x21b3fc)[_0x87a9('0x1d')](function(_0x43c03d){return _0x43c03d;});}return null;};}function removeEntity(_0x43af30,_0xfe63fc){return function(_0xfc3be0){if(_0xfc3be0){return _0xfc3be0[_0x87a9('0x1e')]()['then'](function(){_0x43af30[_0x87a9('0x15')](0xcc)[_0x87a9('0x16')]();});}};}function handleEntityNotFound(_0x3c5e0e,_0x4b7e9e){return function(_0x4a261b){if(!_0x4a261b){_0x3c5e0e[_0x87a9('0x1f')](0x194);}return _0x4a261b;};}function handleError(_0x1a7b95,_0x131a1f){_0x131a1f=_0x131a1f||0x1f4;return function(_0xa58469){logger[_0x87a9('0x20')](_0xa58469[_0x87a9('0x21')]);if(_0xa58469['name']){delete _0xa58469['name'];}_0x1a7b95[_0x87a9('0x15')](_0x131a1f)[_0x87a9('0x22')](_0xa58469);};}exports[_0x87a9('0x23')]=function(_0x3384a6,_0x530d23){var _0x3e85ff={},_0x1d5467={},_0x506d85={'count':0x0,'rows':[]};var _0x5d767c=db[_0x87a9('0x24')][_0x87a9('0x25')];_0x1d5467[_0x87a9('0x26')]=_[_0x87a9('0x27')](_0x5d767c);_0x1d5467[_0x87a9('0x28')]=_[_0x87a9('0x27')](_0x3384a6[_0x87a9('0x28')]);_0x1d5467['filters']=_['intersection'](_0x1d5467[_0x87a9('0x26')],_0x1d5467[_0x87a9('0x28')]);_0x3e85ff[_0x87a9('0x29')]=_[_0x87a9('0x2a')](_0x1d5467[_0x87a9('0x26')],qs['fields'](_0x3384a6[_0x87a9('0x28')]['fields']));_0x3e85ff[_0x87a9('0x29')]=_0x3e85ff[_0x87a9('0x29')][_0x87a9('0x2b')]?_0x3e85ff['attributes']:_0x1d5467['model'];if(!_0x3384a6[_0x87a9('0x28')][_0x87a9('0x2c')](_0x87a9('0x2d'))){_0x3e85ff[_0x87a9('0x19')]=qs[_0x87a9('0x19')](_0x3384a6[_0x87a9('0x28')]['limit']);_0x3e85ff['offset']=qs[_0x87a9('0x18')](_0x3384a6[_0x87a9('0x28')][_0x87a9('0x18')]);}_0x3e85ff[_0x87a9('0x2e')]=qs[_0x87a9('0x2f')](_0x3384a6[_0x87a9('0x28')][_0x87a9('0x2f')]);_0x3e85ff[_0x87a9('0x30')]=qs[_0x87a9('0x31')](_[_0x87a9('0x32')](_0x3384a6[_0x87a9('0x28')],_0x1d5467[_0x87a9('0x31')]));if(_0x3384a6['query'][_0x87a9('0x33')]){_0x3e85ff[_0x87a9('0x30')]=_['merge'](_0x3e85ff[_0x87a9('0x30')],{'$or':_[_0x87a9('0x34')](_0x5d767c,function(_0x40b80e){if(_0x40b80e[_0x87a9('0x35')]['key']!==_0x87a9('0x36')){var _0x5d0f14={};_0x5d0f14[_0x40b80e[_0x87a9('0x37')]]={'$like':'%'+_0x3384a6[_0x87a9('0x28')][_0x87a9('0x33')]+'%'};return _0x5d0f14;}})});}_0x3e85ff=_[_0x87a9('0x38')]({},_0x3e85ff,_0x3384a6['options']);var _0x21b205={'where':_0x3e85ff['where']};return db[_0x87a9('0x24')][_0x87a9('0x39')](_0x21b205)[_0x87a9('0x1d')](function(_0x310a49){_0x506d85[_0x87a9('0x39')]=_0x310a49;if(_0x3384a6[_0x87a9('0x28')][_0x87a9('0x3a')]){_0x3e85ff[_0x87a9('0x3b')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x3e85ff);})[_0x87a9('0x1d')](function(_0x5dc7b5){_0x506d85[_0x87a9('0x3c')]=_0x5dc7b5;return _0x506d85;})['then'](respondWithFilteredResult(_0x530d23,_0x3e85ff))['catch'](handleError(_0x530d23,null));};exports[_0x87a9('0x3d')]=function(_0x223b9d,_0x242aff){var _0x3d4f94={'raw':!![],'where':{'id':_0x223b9d['params']['id']}},_0x48d907={};_0x48d907[_0x87a9('0x26')]=_[_0x87a9('0x27')](db[_0x87a9('0x24')][_0x87a9('0x25')]);_0x48d907[_0x87a9('0x28')]=_[_0x87a9('0x27')](_0x223b9d[_0x87a9('0x28')]);_0x48d907[_0x87a9('0x31')]=_['intersection'](_0x48d907[_0x87a9('0x26')],_0x48d907[_0x87a9('0x28')]);_0x3d4f94['attributes']=_['intersection'](_0x48d907[_0x87a9('0x26')],qs['fields'](_0x223b9d[_0x87a9('0x28')]['fields']));_0x3d4f94[_0x87a9('0x29')]=_0x3d4f94[_0x87a9('0x29')]['length']?_0x3d4f94[_0x87a9('0x29')]:_0x48d907[_0x87a9('0x26')];if(_0x223b9d[_0x87a9('0x28')][_0x87a9('0x3a')]){_0x3d4f94[_0x87a9('0x3b')]=[{'all':!![]}];}_0x3d4f94=_[_0x87a9('0x38')]({},_0x3d4f94,_0x223b9d[_0x87a9('0x3e')]);return db[_0x87a9('0x24')][_0x87a9('0x3f')](_0x3d4f94)[_0x87a9('0x1d')](handleEntityNotFound(_0x242aff,null))[_0x87a9('0x1d')](respondWithResult(_0x242aff,null))[_0x87a9('0x40')](handleError(_0x242aff,null));};exports['create']=function(_0x5173c5,_0x3179e0){return db[_0x87a9('0x24')][_0x87a9('0x41')](_0x5173c5[_0x87a9('0x42')],{})[_0x87a9('0x1d')](respondWithResult(_0x3179e0,0xc9))[_0x87a9('0x40')](handleError(_0x3179e0,null));};exports[_0x87a9('0x1c')]=function(_0x2f5726,_0x10944b){if(_0x2f5726[_0x87a9('0x42')]['id']){delete _0x2f5726['body']['id'];}return db[_0x87a9('0x24')]['find']({'where':{'id':_0x2f5726['params']['id']}})[_0x87a9('0x1d')](handleEntityNotFound(_0x10944b,null))[_0x87a9('0x1d')](saveUpdates(_0x2f5726['body'],null))[_0x87a9('0x1d')](respondWithResult(_0x10944b,null))[_0x87a9('0x40')](handleError(_0x10944b,null));};exports[_0x87a9('0x1e')]=function(_0x2e54be,_0x19c88b){return db[_0x87a9('0x24')]['find']({'where':{'id':_0x2e54be['params']['id']}})[_0x87a9('0x1d')](handleEntityNotFound(_0x19c88b,null))['then'](removeEntity(_0x19c88b,null))[_0x87a9('0x40')](handleError(_0x19c88b,null));};exports[_0x87a9('0x43')]=function(_0x21a946,_0x5c94e0,_0x4ae42b){var _0x258fed=require(_0x87a9('0x44'));var _0x54e8ca=![];var _0x4266a5={};if(_0x21a946['query']['type']&&_0x21a946[_0x87a9('0x28')][_0x87a9('0x35')]===_0x87a9('0x45')){_0x4266a5[_0x87a9('0x45')]=_0x21a946[_0x87a9('0x46')]['id'];}else{_0x4266a5['id']=_0x21a946[_0x87a9('0x46')]['id'];}return db['SquareRecording'][_0x87a9('0x3f')]({'where':_0x4266a5,'attributes':['id','savePath',_0x87a9('0x47')],'raw':!![]})[_0x87a9('0x1d')](handleEntityNotFound(_0x5c94e0,null))[_0x87a9('0x1d')](function(_0x4fb396){if(_0x4fb396){var _0x2425b8=util[_0x87a9('0x48')](_0x87a9('0x49'),_0x4fb396[_0x87a9('0x4a')]);if(fs[_0x87a9('0x4b')](_0x2425b8)){_0x54e8ca=!![];return _0x258fed[_0x87a9('0x4c')](_0x2425b8,_0x4fb396[_0x87a9('0x4d')],config[_0x87a9('0x4e')]['recording'])['then'](function(){return _0x4fb396;});}return _0x4fb396;}})[_0x87a9('0x1d')](function(_0x3d844a){if(_0x3d844a){if(!fs[_0x87a9('0x4b')](_0x3d844a['savePath'])){throw new db['Sequelize'][(_0x87a9('0x4f'))](_0x87a9('0x50'));}if(_0x3d844a[_0x87a9('0x47')]){return _0x5c94e0['download'](_0x3d844a['savePath'],_0x3d844a[_0x87a9('0x47')]+path[_0x87a9('0x51')](_0x3d844a[_0x87a9('0x4d')]),function(){if(_0x54e8ca){fs[_0x87a9('0x52')](_0x3d844a[_0x87a9('0x4d')]);}});}else{return _0x5c94e0[_0x87a9('0x43')](_0x3d844a['savePath'],function(_0x5d2431){if(_0x54e8ca){fs[_0x87a9('0x52')](_0x3d844a[_0x87a9('0x4d')]);}});}}})[_0x87a9('0x40')](handleError(_0x5c94e0,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 82fe402..af97520 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 _0xed5f=['util','../../config/logger','api','bluebird','request-promise','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x3bc4c7,_0x2c24b5){var _0x3e89c9=function(_0x4f6dab){while(--_0x4f6dab){_0x3bc4c7['push'](_0x3bc4c7['shift']());}};_0x3e89c9(++_0x2c24b5);}(_0xed5f,0x1e6));var _0xfed5=function(_0x619734,_0x282202){_0x619734=_0x619734-0x0;var _0xe9d75c=_0xed5f[_0x619734];return _0xe9d75c;};'use strict';var _=require('lodash');var util=require(_0xfed5('0x0'));var logger=require(_0xfed5('0x1'))(_0xfed5('0x2'));var moment=require('moment');var BPromise=require(_0xfed5('0x3'));var rp=require(_0xfed5('0x4'));var attributes=require(_0xfed5('0x5'));module[_0xfed5('0x6')]=function(_0x5df01a,_0x1abffa){return _0x5df01a[_0xfed5('0x7')](_0xfed5('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96aa=['request-promise','./squareRecording.attributes','SquareRecording','square_recordings','lodash','util','api','moment','bluebird'];(function(_0x4e76da,_0x291b71){var _0x5f14e8=function(_0x30ad0f){while(--_0x30ad0f){_0x4e76da['push'](_0x4e76da['shift']());}};_0x5f14e8(++_0x291b71);}(_0x96aa,0x67));var _0xa96a=function(_0x37df27,_0x4174f2){_0x37df27=_0x37df27-0x0;var _0x583292=_0x96aa[_0x37df27];return _0x583292;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var logger=require('../../config/logger')(_0xa96a('0x2'));var moment=require(_0xa96a('0x3'));var BPromise=require(_0xa96a('0x4'));var rp=require(_0xa96a('0x5'));var attributes=require(_0xa96a('0x6'));module['exports']=function(_0x1ce4a1,_0x1079a5){return _0x1ce4a1['define'](_0xa96a('0x7'),attributes,{'tableName':_0xa96a('0x8'),'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 8faaa48..35b7a04 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 _0x001b=['jayson/promise','request','then','info','SquareRecording,\x20%s,\x20%s','debug','request\x20sent','code','error','message','CreateSquareRecording','options','raw','stringify','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1e0f0e,_0x26d58f){var _0x3eda78=function(_0x599bbb){while(--_0x599bbb){_0x1e0f0e['push'](_0x1e0f0e['shift']());}};_0x3eda78(++_0x26d58f);}(_0x001b,0x185));var _0xb001=function(_0x55eb29,_0x435cd5){_0x55eb29=_0x55eb29-0x0;var _0x12d8b0=_0x001b[_0x55eb29];return _0x12d8b0;};'use strict';var _=require('lodash');var util=require(_0xb001('0x0'));var moment=require(_0xb001('0x1'));var BPromise=require('bluebird');var rs=require(_0xb001('0x2'));var fs=require('fs');var Redis=require(_0xb001('0x3'));var db=require(_0xb001('0x4'))['db'];var utils=require(_0xb001('0x5'));var logger=require('../../config/logger')(_0xb001('0x6'));var config=require('../../config/environment');var jayson=require(_0xb001('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x508d84,_0x920116,_0x1dc1e5){return new BPromise(function(_0x466ef1,_0x2e3a19){return client[_0xb001('0x8')](_0x508d84,_0x1dc1e5)[_0xb001('0x9')](function(_0x4bd75a){logger[_0xb001('0xa')](_0xb001('0xb'),_0x920116,'request\x20sent');logger[_0xb001('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x920116,_0xb001('0xd'),JSON['stringify'](_0x4bd75a));if(_0x4bd75a['error']){if(_0x4bd75a['error'][_0xb001('0xe')]===0x1f4){logger[_0xb001('0xf')]('SquareRecording,\x20%s,\x20%s',_0x920116,_0x4bd75a[_0xb001('0xf')]['message']);return _0x2e3a19(_0x4bd75a[_0xb001('0xf')][_0xb001('0x10')]);}logger[_0xb001('0xf')](_0xb001('0xb'),_0x920116,_0x4bd75a[_0xb001('0xf')][_0xb001('0x10')]);return _0x466ef1(_0x4bd75a[_0xb001('0xf')][_0xb001('0x10')]);}else{logger[_0xb001('0xa')](_0xb001('0xb'),_0x920116,_0xb001('0xd'));_0x466ef1(_0x4bd75a['result'][_0xb001('0x10')]);}})['catch'](function(_0x565862){logger[_0xb001('0xf')](_0xb001('0xb'),_0x920116,_0x565862);_0x2e3a19(_0x565862);});});}exports[_0xb001('0x11')]=function(_0x21edc1){var _0x24bdd0=this;return new Promise(function(_0xf68134,_0x3735bf){return db['SquareRecording']['create'](_0x21edc1['body'],{'raw':_0x21edc1[_0xb001('0x12')]?_0x21edc1[_0xb001('0x12')][_0xb001('0x13')]===undefined?!![]:![]:!![]})['then'](function(_0x4ac00d){logger[_0xb001('0xa')]('CreateSquareRecording',_0x21edc1);logger[_0xb001('0xc')](_0xb001('0x11'),_0x21edc1,JSON[_0xb001('0x14')](_0x4ac00d));_0xf68134(_0x4ac00d);})[_0xb001('0x15')](function(_0x14aa0c){logger[_0xb001('0xf')](_0xb001('0x11'),_0x14aa0c['message'],_0x21edc1);_0x3735bf(_0x24bdd0['error'](0x1f4,_0x14aa0c[_0xb001('0x10')]));});});}; \ No newline at end of file +var _0x5199=['client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateSquareRecording','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x337ef2,_0x242de8){var _0x1ba8bf=function(_0x59eca5){while(--_0x59eca5){_0x337ef2['push'](_0x337ef2['shift']());}};_0x1ba8bf(++_0x242de8);}(_0x5199,0x15e));var _0x9519=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5199[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x9519('0x0'));var util=require(_0x9519('0x1'));var moment=require(_0x9519('0x2'));var BPromise=require('bluebird');var rs=require(_0x9519('0x3'));var fs=require('fs');var Redis=require(_0x9519('0x4'));var db=require(_0x9519('0x5'))['db'];var utils=require(_0x9519('0x6'));var logger=require(_0x9519('0x7'))('rpc');var config=require(_0x9519('0x8'));var jayson=require(_0x9519('0x9'));var client=jayson[_0x9519('0xa')][_0x9519('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dd02e,_0xf5eb12,_0x11cd82){return new BPromise(function(_0xce482b,_0x50701e){return client[_0x9519('0xc')](_0x3dd02e,_0x11cd82)[_0x9519('0xd')](function(_0x489e6c){logger[_0x9519('0xe')](_0x9519('0xf'),_0xf5eb12,_0x9519('0x10'));logger[_0x9519('0x11')](_0x9519('0x12'),_0xf5eb12,'request\x20sent',JSON[_0x9519('0x13')](_0x489e6c));if(_0x489e6c[_0x9519('0x14')]){if(_0x489e6c['error'][_0x9519('0x15')]===0x1f4){logger['error'](_0x9519('0xf'),_0xf5eb12,_0x489e6c[_0x9519('0x14')][_0x9519('0x16')]);return _0x50701e(_0x489e6c[_0x9519('0x14')][_0x9519('0x16')]);}logger[_0x9519('0x14')](_0x9519('0xf'),_0xf5eb12,_0x489e6c[_0x9519('0x14')][_0x9519('0x16')]);return _0xce482b(_0x489e6c[_0x9519('0x14')][_0x9519('0x16')]);}else{logger[_0x9519('0xe')](_0x9519('0xf'),_0xf5eb12,_0x9519('0x10'));_0xce482b(_0x489e6c[_0x9519('0x17')][_0x9519('0x16')]);}})[_0x9519('0x18')](function(_0x539520){logger['error']('SquareRecording,\x20%s,\x20%s',_0xf5eb12,_0x539520);_0x50701e(_0x539520);});});}exports['CreateSquareRecording']=function(_0x1da20a){var _0x40d7c6=this;return new Promise(function(_0xbd0e18,_0x493266){return db['SquareRecording'][_0x9519('0x19')](_0x1da20a[_0x9519('0x1a')],{'raw':_0x1da20a[_0x9519('0x1b')]?_0x1da20a[_0x9519('0x1b')][_0x9519('0x1c')]===undefined?!![]:![]:!![]})[_0x9519('0xd')](function(_0x3f053a){logger[_0x9519('0xe')](_0x9519('0x1d'),_0x1da20a);logger[_0x9519('0x11')]('CreateSquareRecording',_0x1da20a,JSON[_0x9519('0x13')](_0x3f053a));_0xbd0e18(_0x3f053a);})[_0x9519('0x18')](function(_0x393786){logger[_0x9519('0x14')]('CreateSquareRecording',_0x393786['message'],_0x1da20a);_0x493266(_0x40d7c6[_0x9519('0x14')](0x1f4,_0x393786['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 9911e73..255cad9 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 _0x8db8=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','exports','multer'];(function(_0x4d9d1e,_0x3c2d20){var _0x1b9d54=function(_0x373c21){while(--_0x373c21){_0x4d9d1e['push'](_0x4d9d1e['shift']());}};_0x1b9d54(++_0x3c2d20);}(_0x8db8,0x71));var _0x88db=function(_0x4640af,_0x1029a7){_0x4640af=_0x4640af-0x0;var _0x276a6c=_0x8db8[_0x4640af];return _0x276a6c;};'use strict';var multer=require(_0x88db('0x0'));var util=require(_0x88db('0x1'));var path=require('path');var timeout=require(_0x88db('0x2'));var express=require('express');var router=express[_0x88db('0x3')]();var auth=require(_0x88db('0x4'));var interaction=require(_0x88db('0x5'));var config=require('../../config/environment');var controller=require(_0x88db('0x6'));router[_0x88db('0x7')]('/',auth[_0x88db('0x8')](),controller[_0x88db('0x9')]);router[_0x88db('0x7')]('/describe',auth[_0x88db('0x8')](),controller[_0x88db('0xa')]);router[_0x88db('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x88db('0xb')]);router[_0x88db('0xc')]('/',auth['isAuthenticated'](),controller[_0x88db('0xd')]);router[_0x88db('0xe')](_0x88db('0xf'),auth['isAuthenticated'](),controller[_0x88db('0x10')]);router[_0x88db('0x11')](_0x88db('0xf'),auth[_0x88db('0x8')](),controller['destroy']);module[_0x88db('0x12')]=router; \ No newline at end of file +var _0x6e26=['../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','describe','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xb6a1fc,_0x270184){var _0x45269f=function(_0x4b7760){while(--_0x4b7760){_0xb6a1fc['push'](_0xb6a1fc['shift']());}};_0x45269f(++_0x270184);}(_0x6e26,0x99));var _0x66e2=function(_0x2b9162,_0x197861){_0x2b9162=_0x2b9162-0x0;var _0x9b2b89=_0x6e26[_0x2b9162];return _0x9b2b89;};'use strict';var multer=require(_0x66e2('0x0'));var util=require(_0x66e2('0x1'));var path=require(_0x66e2('0x2'));var timeout=require(_0x66e2('0x3'));var express=require('express');var router=express[_0x66e2('0x4')]();var auth=require(_0x66e2('0x5'));var interaction=require(_0x66e2('0x6'));var config=require(_0x66e2('0x7'));var controller=require(_0x66e2('0x8'));router[_0x66e2('0x9')]('/',auth[_0x66e2('0xa')](),controller[_0x66e2('0xb')]);router[_0x66e2('0x9')](_0x66e2('0xc'),auth[_0x66e2('0xa')](),controller[_0x66e2('0xd')]);router['get']('/:id',auth[_0x66e2('0xa')](),controller['show']);router['post']('/',auth[_0x66e2('0xa')](),controller['create']);router[_0x66e2('0xe')](_0x66e2('0xf'),auth[_0x66e2('0xa')](),controller[_0x66e2('0x10')]);router[_0x66e2('0x11')]('/:id',auth[_0x66e2('0xa')](),controller[_0x66e2('0x12')]);module[_0x66e2('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3b8265f..33287ec 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 _0x330c=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0xf87244,_0x1c18ee){var _0x2e213f=function(_0x1de95b){while(--_0x1de95b){_0xf87244['push'](_0xf87244['shift']());}};_0x2e213f(++_0x1c18ee);}(_0x330c,0x186));var _0xc330=function(_0x1c3acb,_0x23dff6){_0x1c3acb=_0x1c3acb-0x0;var _0xee8a28=_0x330c[_0x1c3acb];return _0xee8a28;};'use strict';var Sequelize=require(_0xc330('0x0'));module[_0xc330('0x1')]={'network':{'type':Sequelize[_0xc330('0x2')]},'network_script':{'type':Sequelize[_0xc330('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc330('0x2')]},'language':{'type':Sequelize[_0xc330('0x2')]},'type':{'type':Sequelize[_0xc330('0x2')]},'uniqueid':{'type':Sequelize[_0xc330('0x2')]},'version':{'type':Sequelize[_0xc330('0x2')]},'callerid':{'type':Sequelize[_0xc330('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xc330('0x2')]},'callingtns':{'type':Sequelize[_0xc330('0x2')]},'dnid':{'type':Sequelize[_0xc330('0x2')]},'rdnis':{'type':Sequelize[_0xc330('0x2')]},'context':{'type':Sequelize[_0xc330('0x2')]},'extension':{'type':Sequelize[_0xc330('0x2')]},'priority':{'type':Sequelize[_0xc330('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc330('0x2')]},'threadid':{'type':Sequelize[_0xc330('0x2')]},'project_name':{'type':Sequelize[_0xc330('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc330('0x3')]},'bot':{'type':Sequelize[_0xc330('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x192f=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x192f,0xd6));var _0xf192=function(_0x51a97d,_0x2d18ab){_0x51a97d=_0x51a97d-0x0;var _0x348345=_0x192f[_0x51a97d];return _0x348345;};'use strict';var Sequelize=require(_0xf192('0x0'));module['exports']={'network':{'type':Sequelize[_0xf192('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xf192('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf192('0x1')]},'uniqueid':{'type':Sequelize[_0xf192('0x1')]},'version':{'type':Sequelize[_0xf192('0x1')]},'callerid':{'type':Sequelize[_0xf192('0x1')]},'calleridname':{'type':Sequelize[_0xf192('0x1')]},'callingpres':{'type':Sequelize[_0xf192('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xf192('0x1')]},'callingtns':{'type':Sequelize[_0xf192('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xf192('0x1')]},'context':{'type':Sequelize[_0xf192('0x1')]},'extension':{'type':Sequelize[_0xf192('0x1')]},'priority':{'type':Sequelize[_0xf192('0x1')]},'enhanced':{'type':Sequelize[_0xf192('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xf192('0x1')]},'joinAt':{'type':Sequelize[_0xf192('0x2')]},'leaveAt':{'type':Sequelize[_0xf192('0x2')]},'bot':{'type':Sequelize[_0xf192('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6dd5c74..15a11ef 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 _0xafae=['filter','merge','type','key','field','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','SquareReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick'];(function(_0x574d9f,_0x5314a2){var _0x414aca=function(_0x170c0a){while(--_0x170c0a){_0x574d9f['push'](_0x574d9f['shift']());}};_0x414aca(++_0x5314a2);}(_0xafae,0x98));var _0xeafa=function(_0x4adbb0,_0x5f5a74){_0x4adbb0=_0x4adbb0-0x0;var _0x5e235c=_0xafae[_0x4adbb0];return _0x5e235c;};'use strict';var pdf=require(_0xeafa('0x0'));var emlformat=require(_0xeafa('0x1'));var rimraf=require(_0xeafa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeafa('0x3'));var moment=require(_0xeafa('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeafa('0x5'));var path=require(_0xeafa('0x6'));var sox=require(_0xeafa('0x7'));var csv=require(_0xeafa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeafa('0x9'));var squel=require('squel');var crypto=require(_0xeafa('0xa'));var jsforce=require(_0xeafa('0xb'));var deskjs=require(_0xeafa('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeafa('0xd'));var Papa=require('papaparse');var authService=require(_0xeafa('0xe'));var hardwareService=require(_0xeafa('0xf'));var Redis=require(_0xeafa('0x10'));var qs=require(_0xeafa('0x11'));var logger=require(_0xeafa('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xeafa('0x13'));var db=require(_0xeafa('0x14'))['db'];function respondWithStatusCode(_0x475d67,_0x14439b){_0x14439b=_0x14439b||0xcc;return function(_0x2c9c19){if(_0x2c9c19){return _0x475d67[_0xeafa('0x15')](_0x14439b);}return _0x475d67[_0xeafa('0x16')](_0x14439b)['end']();};}function respondWithResult(_0x42480f,_0x484a58){_0x484a58=_0x484a58||0xc8;return function(_0x558300){if(_0x558300){return _0x42480f[_0xeafa('0x16')](_0x484a58)[_0xeafa('0x17')](_0x558300);}};}function respondWithFilteredResult(_0x38389f,_0x812b74){return function(_0x4e8af0){if(_0x4e8af0){var _0x1c6920=_0x4e8af0[_0xeafa('0x18')],_0x14eef1=_0x812b74[_0xeafa('0x19')],_0x147ee9=_0x812b74[_0xeafa('0x19')]+_0x812b74[_0xeafa('0x1a')],_0x301abd;if(_0x147ee9>=_0x1c6920){_0x147ee9=_0x1c6920;_0x301abd=0xc8;}else{_0x301abd=0xce;}_0x38389f[_0xeafa('0x16')](_0x301abd);return _0x38389f[_0xeafa('0x1b')](_0xeafa('0x1c'),_0x14eef1+'-'+_0x147ee9+'/'+_0x1c6920)[_0xeafa('0x17')](_0x4e8af0);}return null;};}function patchUpdates(_0xffe7ec){return function(_0x13c166){try{jsonpatch[_0xeafa('0x1d')](_0x13c166,_0xffe7ec,!![]);}catch(_0x225c83){return BPromise[_0xeafa('0x1e')](_0x225c83);}return _0x13c166[_0xeafa('0x1f')]();};}function saveUpdates(_0x1ad2b9,_0x2002b5){return function(_0x421759){if(_0x421759){return _0x421759[_0xeafa('0x20')](_0x1ad2b9)['then'](function(_0x153d17){return _0x153d17;});}return null;};}function removeEntity(_0x33a8e1,_0x3505ce){return function(_0x4ffeab){if(_0x4ffeab){return _0x4ffeab['destroy']()[_0xeafa('0x21')](function(){_0x33a8e1['status'](0xcc)[_0xeafa('0x22')]();});}};}function handleEntityNotFound(_0x5be899,_0x56467d){return function(_0x3d7bf9){if(!_0x3d7bf9){_0x5be899[_0xeafa('0x15')](0x194);}return _0x3d7bf9;};}function handleError(_0x2ebec9,_0x291206){_0x291206=_0x291206||0x1f4;return function(_0x4fc887){logger[_0xeafa('0x23')](_0x4fc887['stack']);if(_0x4fc887[_0xeafa('0x24')]){delete _0x4fc887[_0xeafa('0x24')];}_0x2ebec9[_0xeafa('0x16')](_0x291206)[_0xeafa('0x25')](_0x4fc887);};}exports[_0xeafa('0x26')]=function(_0x1525c3,_0x252efb){var _0x1d75e8={},_0x3654e3={},_0xfc577={'count':0x0,'rows':[]};var _0x37afa0=db[_0xeafa('0x27')][_0xeafa('0x28')];_0x3654e3[_0xeafa('0x29')]=_['keys'](_0x37afa0);_0x3654e3[_0xeafa('0x2a')]=_[_0xeafa('0x2b')](_0x1525c3[_0xeafa('0x2a')]);_0x3654e3[_0xeafa('0x2c')]=_[_0xeafa('0x2d')](_0x3654e3[_0xeafa('0x29')],_0x3654e3[_0xeafa('0x2a')]);_0x1d75e8[_0xeafa('0x2e')]=_[_0xeafa('0x2d')](_0x3654e3[_0xeafa('0x29')],qs[_0xeafa('0x2f')](_0x1525c3[_0xeafa('0x2a')][_0xeafa('0x2f')]));_0x1d75e8[_0xeafa('0x2e')]=_0x1d75e8[_0xeafa('0x2e')]['length']?_0x1d75e8[_0xeafa('0x2e')]:_0x3654e3[_0xeafa('0x29')];if(!_0x1525c3[_0xeafa('0x2a')]['hasOwnProperty'](_0xeafa('0x30'))){_0x1d75e8[_0xeafa('0x1a')]=qs[_0xeafa('0x1a')](_0x1525c3[_0xeafa('0x2a')][_0xeafa('0x1a')]);_0x1d75e8['offset']=qs[_0xeafa('0x19')](_0x1525c3['query']['offset']);}_0x1d75e8['order']=qs[_0xeafa('0x31')](_0x1525c3['query'][_0xeafa('0x31')]);_0x1d75e8[_0xeafa('0x32')]=qs['filters'](_[_0xeafa('0x33')](_0x1525c3[_0xeafa('0x2a')],_0x3654e3[_0xeafa('0x2c')]));if(_0x1525c3[_0xeafa('0x2a')][_0xeafa('0x34')]){_0x1d75e8[_0xeafa('0x32')]=_[_0xeafa('0x35')](_0x1d75e8[_0xeafa('0x32')],{'$or':_['map'](_0x37afa0,function(_0x3bcb12){if(_0x3bcb12[_0xeafa('0x36')][_0xeafa('0x37')]!=='VIRTUAL'){var _0x2f1368={};_0x2f1368[_0x3bcb12[_0xeafa('0x38')]]={'$like':'%'+_0x1525c3[_0xeafa('0x2a')][_0xeafa('0x34')]+'%'};return _0x2f1368;}})});}_0x1d75e8=_[_0xeafa('0x35')]({},_0x1d75e8,_0x1525c3['options']);var _0x5e408d={'where':_0x1d75e8['where']};return db[_0xeafa('0x27')][_0xeafa('0x18')](_0x5e408d)[_0xeafa('0x21')](function(_0x5933d2){_0xfc577[_0xeafa('0x18')]=_0x5933d2;if(_0x1525c3[_0xeafa('0x2a')]['includeAll']){_0x1d75e8[_0xeafa('0x39')]=[{'all':!![]}];}return db['SquareReport'][_0xeafa('0x3a')](_0x1d75e8);})['then'](function(_0x2a4707){_0xfc577[_0xeafa('0x3b')]=_0x2a4707;return _0xfc577;})[_0xeafa('0x21')](respondWithFilteredResult(_0x252efb,_0x1d75e8))[_0xeafa('0x3c')](handleError(_0x252efb,null));};exports['show']=function(_0x3db712,_0x5b2d54){var _0x3421e8={'raw':!![],'where':{'id':_0x3db712[_0xeafa('0x3d')]['id']}},_0x1a7862={};_0x1a7862[_0xeafa('0x29')]=_[_0xeafa('0x2b')](db[_0xeafa('0x27')]['rawAttributes']);_0x1a7862['query']=_[_0xeafa('0x2b')](_0x3db712[_0xeafa('0x2a')]);_0x1a7862[_0xeafa('0x2c')]=_['intersection'](_0x1a7862['model'],_0x1a7862[_0xeafa('0x2a')]);_0x3421e8[_0xeafa('0x2e')]=_['intersection'](_0x1a7862[_0xeafa('0x29')],qs[_0xeafa('0x2f')](_0x3db712['query'][_0xeafa('0x2f')]));_0x3421e8[_0xeafa('0x2e')]=_0x3421e8['attributes']['length']?_0x3421e8['attributes']:_0x1a7862[_0xeafa('0x29')];if(_0x3db712[_0xeafa('0x2a')][_0xeafa('0x3e')]){_0x3421e8[_0xeafa('0x39')]=[{'all':!![]}];}_0x3421e8=_[_0xeafa('0x35')]({},_0x3421e8,_0x3db712[_0xeafa('0x3f')]);return db[_0xeafa('0x27')][_0xeafa('0x40')](_0x3421e8)[_0xeafa('0x21')](handleEntityNotFound(_0x5b2d54,null))['then'](respondWithResult(_0x5b2d54,null))[_0xeafa('0x3c')](handleError(_0x5b2d54,null));};exports['create']=function(_0xae2933,_0x1cde46){return db[_0xeafa('0x27')][_0xeafa('0x41')](_0xae2933[_0xeafa('0x42')],{})[_0xeafa('0x21')](respondWithResult(_0x1cde46,0xc9))[_0xeafa('0x3c')](handleError(_0x1cde46,null));};exports['update']=function(_0x54d4e2,_0x5c83d){if(_0x54d4e2[_0xeafa('0x42')]['id']){delete _0x54d4e2[_0xeafa('0x42')]['id'];}return db[_0xeafa('0x27')][_0xeafa('0x40')]({'where':{'id':_0x54d4e2[_0xeafa('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5c83d,null))[_0xeafa('0x21')](saveUpdates(_0x54d4e2[_0xeafa('0x42')],null))[_0xeafa('0x21')](respondWithResult(_0x5c83d,null))['catch'](handleError(_0x5c83d,null));};exports['destroy']=function(_0x3e419f,_0x583ddb){return db['SquareReport']['find']({'where':{'id':_0x3e419f[_0xeafa('0x3d')]['id']}})[_0xeafa('0x21')](handleEntityNotFound(_0x583ddb,null))['then'](removeEntity(_0x583ddb,null))[_0xeafa('0x3c')](handleError(_0x583ddb,null));};exports['describe']=function(_0x72ac82,_0x2dc484){return db[_0xeafa('0x27')][_0xeafa('0x43')]()[_0xeafa('0x21')](respondWithResult(_0x2dc484,null))[_0xeafa('0x3c')](handleError(_0x2dc484,null));}; \ No newline at end of file +var _0xc2a2=['squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','save','update','then','end','error','stack','name','send','SquareReport','keys','filters','model','query','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','key','field','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','fields','find','body','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','lodash'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xc2a2,0x106));var _0x2c2a=function(_0x3a8dcc,_0x473ff5){_0x3a8dcc=_0x3a8dcc-0x0;var _0x446416=_0xc2a2[_0x3a8dcc];return _0x446416;};'use strict';var pdf=require(_0x2c2a('0x0'));var emlformat=require(_0x2c2a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2c2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c2a('0x3'));var moment=require(_0x2c2a('0x4'));var BPromise=require(_0x2c2a('0x5'));var Mustache=require('mustache');var util=require(_0x2c2a('0x6'));var path=require(_0x2c2a('0x7'));var sox=require(_0x2c2a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2c2a('0x9'));var squel=require(_0x2c2a('0xa'));var crypto=require(_0x2c2a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2c2a('0xc'));var toCsv=require(_0x2c2a('0xd'));var querystring=require(_0x2c2a('0xe'));var Papa=require(_0x2c2a('0xf'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x2c2a('0x10'));var qs=require(_0x2c2a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2c2a('0x12'));var config=require(_0x2c2a('0x13'));var db=require(_0x2c2a('0x14'))['db'];function respondWithStatusCode(_0x2d7577,_0x20a60b){_0x20a60b=_0x20a60b||0xcc;return function(_0x11df26){if(_0x11df26){return _0x2d7577[_0x2c2a('0x15')](_0x20a60b);}return _0x2d7577['status'](_0x20a60b)['end']();};}function respondWithResult(_0x1a490a,_0x35bda4){_0x35bda4=_0x35bda4||0xc8;return function(_0x5090c8){if(_0x5090c8){return _0x1a490a[_0x2c2a('0x16')](_0x35bda4)[_0x2c2a('0x17')](_0x5090c8);}};}function respondWithFilteredResult(_0x52f872,_0x272954){return function(_0x318dc5){if(_0x318dc5){var _0x2ed3de=_0x318dc5[_0x2c2a('0x18')],_0x4e1833=_0x272954[_0x2c2a('0x19')],_0x174883=_0x272954[_0x2c2a('0x19')]+_0x272954['limit'],_0x3846fb;if(_0x174883>=_0x2ed3de){_0x174883=_0x2ed3de;_0x3846fb=0xc8;}else{_0x3846fb=0xce;}_0x52f872[_0x2c2a('0x16')](_0x3846fb);return _0x52f872[_0x2c2a('0x1a')](_0x2c2a('0x1b'),_0x4e1833+'-'+_0x174883+'/'+_0x2ed3de)[_0x2c2a('0x17')](_0x318dc5);}return null;};}function patchUpdates(_0x53fcf1){return function(_0x177836){try{jsonpatch['apply'](_0x177836,_0x53fcf1,!![]);}catch(_0x5cca32){return BPromise['reject'](_0x5cca32);}return _0x177836[_0x2c2a('0x1c')]();};}function saveUpdates(_0x33a3be,_0x150b12){return function(_0x11279b){if(_0x11279b){return _0x11279b[_0x2c2a('0x1d')](_0x33a3be)['then'](function(_0x54da3b){return _0x54da3b;});}return null;};}function removeEntity(_0x4999d2,_0x22c3bf){return function(_0x37e72e){if(_0x37e72e){return _0x37e72e['destroy']()[_0x2c2a('0x1e')](function(){_0x4999d2[_0x2c2a('0x16')](0xcc)[_0x2c2a('0x1f')]();});}};}function handleEntityNotFound(_0x5b7e1a,_0x1e2236){return function(_0x2f94e3){if(!_0x2f94e3){_0x5b7e1a[_0x2c2a('0x15')](0x194);}return _0x2f94e3;};}function handleError(_0x2b6d25,_0xeefb20){_0xeefb20=_0xeefb20||0x1f4;return function(_0x22ff40){logger[_0x2c2a('0x20')](_0x22ff40[_0x2c2a('0x21')]);if(_0x22ff40[_0x2c2a('0x22')]){delete _0x22ff40[_0x2c2a('0x22')];}_0x2b6d25[_0x2c2a('0x16')](_0xeefb20)[_0x2c2a('0x23')](_0x22ff40);};}exports['index']=function(_0x45a8ca,_0xf17d48){var _0x36a190={},_0x689547={},_0x295648={'count':0x0,'rows':[]};var _0x7055ea=db[_0x2c2a('0x24')]['rawAttributes'];_0x689547['model']=_[_0x2c2a('0x25')](_0x7055ea);_0x689547['query']=_[_0x2c2a('0x25')](_0x45a8ca['query']);_0x689547[_0x2c2a('0x26')]=_['intersection'](_0x689547[_0x2c2a('0x27')],_0x689547[_0x2c2a('0x28')]);_0x36a190['attributes']=_['intersection'](_0x689547[_0x2c2a('0x27')],qs['fields'](_0x45a8ca[_0x2c2a('0x28')]['fields']));_0x36a190['attributes']=_0x36a190[_0x2c2a('0x29')][_0x2c2a('0x2a')]?_0x36a190[_0x2c2a('0x29')]:_0x689547[_0x2c2a('0x27')];if(!_0x45a8ca[_0x2c2a('0x28')][_0x2c2a('0x2b')]('nolimit')){_0x36a190[_0x2c2a('0x2c')]=qs[_0x2c2a('0x2c')](_0x45a8ca[_0x2c2a('0x28')][_0x2c2a('0x2c')]);_0x36a190['offset']=qs[_0x2c2a('0x19')](_0x45a8ca[_0x2c2a('0x28')][_0x2c2a('0x19')]);}_0x36a190[_0x2c2a('0x2d')]=qs[_0x2c2a('0x2e')](_0x45a8ca[_0x2c2a('0x28')]['sort']);_0x36a190[_0x2c2a('0x2f')]=qs[_0x2c2a('0x26')](_[_0x2c2a('0x30')](_0x45a8ca['query'],_0x689547['filters']));if(_0x45a8ca[_0x2c2a('0x28')][_0x2c2a('0x31')]){_0x36a190[_0x2c2a('0x2f')]=_[_0x2c2a('0x32')](_0x36a190[_0x2c2a('0x2f')],{'$or':_['map'](_0x7055ea,function(_0x198609){if(_0x198609[_0x2c2a('0x33')][_0x2c2a('0x34')]!=='VIRTUAL'){var _0x48fbbd={};_0x48fbbd[_0x198609[_0x2c2a('0x35')]]={'$like':'%'+_0x45a8ca[_0x2c2a('0x28')][_0x2c2a('0x31')]+'%'};return _0x48fbbd;}})});}_0x36a190=_[_0x2c2a('0x32')]({},_0x36a190,_0x45a8ca['options']);var _0x23875a={'where':_0x36a190[_0x2c2a('0x2f')]};return db[_0x2c2a('0x24')]['count'](_0x23875a)['then'](function(_0x2770a4){_0x295648[_0x2c2a('0x18')]=_0x2770a4;if(_0x45a8ca[_0x2c2a('0x28')][_0x2c2a('0x36')]){_0x36a190[_0x2c2a('0x37')]=[{'all':!![]}];}return db[_0x2c2a('0x24')][_0x2c2a('0x38')](_0x36a190);})[_0x2c2a('0x1e')](function(_0x5c4682){_0x295648[_0x2c2a('0x39')]=_0x5c4682;return _0x295648;})[_0x2c2a('0x1e')](respondWithFilteredResult(_0xf17d48,_0x36a190))[_0x2c2a('0x3a')](handleError(_0xf17d48,null));};exports[_0x2c2a('0x3b')]=function(_0x4de64c,_0x422cc1){var _0x399262={'raw':!![],'where':{'id':_0x4de64c[_0x2c2a('0x3c')]['id']}},_0xa9a082={};_0xa9a082[_0x2c2a('0x27')]=_[_0x2c2a('0x25')](db[_0x2c2a('0x24')][_0x2c2a('0x3d')]);_0xa9a082['query']=_['keys'](_0x4de64c[_0x2c2a('0x28')]);_0xa9a082[_0x2c2a('0x26')]=_[_0x2c2a('0x3e')](_0xa9a082[_0x2c2a('0x27')],_0xa9a082['query']);_0x399262[_0x2c2a('0x29')]=_[_0x2c2a('0x3e')](_0xa9a082[_0x2c2a('0x27')],qs[_0x2c2a('0x3f')](_0x4de64c[_0x2c2a('0x28')][_0x2c2a('0x3f')]));_0x399262[_0x2c2a('0x29')]=_0x399262[_0x2c2a('0x29')][_0x2c2a('0x2a')]?_0x399262[_0x2c2a('0x29')]:_0xa9a082[_0x2c2a('0x27')];if(_0x4de64c[_0x2c2a('0x28')][_0x2c2a('0x36')]){_0x399262[_0x2c2a('0x37')]=[{'all':!![]}];}_0x399262=_[_0x2c2a('0x32')]({},_0x399262,_0x4de64c['options']);return db[_0x2c2a('0x24')][_0x2c2a('0x40')](_0x399262)[_0x2c2a('0x1e')](handleEntityNotFound(_0x422cc1,null))[_0x2c2a('0x1e')](respondWithResult(_0x422cc1,null))[_0x2c2a('0x3a')](handleError(_0x422cc1,null));};exports['create']=function(_0x44830f,_0x4166f3){return db[_0x2c2a('0x24')]['create'](_0x44830f[_0x2c2a('0x41')],{})['then'](respondWithResult(_0x4166f3,0xc9))['catch'](handleError(_0x4166f3,null));};exports[_0x2c2a('0x1d')]=function(_0x39901d,_0x1712f2){if(_0x39901d[_0x2c2a('0x41')]['id']){delete _0x39901d[_0x2c2a('0x41')]['id'];}return db[_0x2c2a('0x24')][_0x2c2a('0x40')]({'where':{'id':_0x39901d[_0x2c2a('0x3c')]['id']}})[_0x2c2a('0x1e')](handleEntityNotFound(_0x1712f2,null))[_0x2c2a('0x1e')](saveUpdates(_0x39901d[_0x2c2a('0x41')],null))[_0x2c2a('0x1e')](respondWithResult(_0x1712f2,null))['catch'](handleError(_0x1712f2,null));};exports[_0x2c2a('0x42')]=function(_0x52ece0,_0x10494b){return db['SquareReport'][_0x2c2a('0x40')]({'where':{'id':_0x52ece0[_0x2c2a('0x3c')]['id']}})[_0x2c2a('0x1e')](handleEntityNotFound(_0x10494b,null))[_0x2c2a('0x1e')](removeEntity(_0x10494b,null))['catch'](handleError(_0x10494b,null));};exports[_0x2c2a('0x43')]=function(_0x1ab211,_0x1de8d3){return db[_0x2c2a('0x24')]['describe']()[_0x2c2a('0x1e')](respondWithResult(_0x1de8d3,null))[_0x2c2a('0x3a')](handleError(_0x1de8d3,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index d7bba42..6b5b0eb 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 _0x89da=['../../config/logger','api','moment','bluebird','request-promise','./squareReport.attributes','define','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x304e4f,_0x3fc490){var _0x236560=function(_0x48b2da){while(--_0x48b2da){_0x304e4f['push'](_0x304e4f['shift']());}};_0x236560(++_0x3fc490);}(_0x89da,0x174));var _0xa89d=function(_0x4688bd,_0x2f7caa){_0x4688bd=_0x4688bd-0x0;var _0x388a80=_0x89da[_0x4688bd];return _0x388a80;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa89d('0x0'))(_0xa89d('0x1'));var moment=require(_0xa89d('0x2'));var BPromise=require(_0xa89d('0x3'));var rp=require(_0xa89d('0x4'));var attributes=require(_0xa89d('0x5'));module['exports']=function(_0x2e35f5,_0x550986){return _0x2e35f5[_0xa89d('0x6')]('SquareReport',attributes,{'tableName':_0xa89d('0x7'),'paranoid':![],'indexes':[{'name':_0xa89d('0x8'),'fields':[_0xa89d('0x9'),_0xa89d('0xa')]},{'name':'leaveAt','fields':[_0xa89d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb68=['moment','bluebird','request-promise','./squareReport.attributes','exports','define','SquareReport','uniqueid','leaveAt','lodash','../../config/logger','api'];(function(_0x33a5ec,_0x10c014){var _0x38f89c=function(_0x15f7ee){while(--_0x15f7ee){_0x33a5ec['push'](_0x33a5ec['shift']());}};_0x38f89c(++_0x10c014);}(_0xeb68,0x189));var _0x8eb6=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0xeb68[_0x1f0724];return _0x253ffb;};'use strict';var _=require(_0x8eb6('0x0'));var util=require('util');var logger=require(_0x8eb6('0x1'))(_0x8eb6('0x2'));var moment=require(_0x8eb6('0x3'));var BPromise=require(_0x8eb6('0x4'));var rp=require(_0x8eb6('0x5'));var attributes=require(_0x8eb6('0x6'));module[_0x8eb6('0x7')]=function(_0x2bb290,_0x3c595c){return _0x2bb290[_0x8eb6('0x8')](_0x8eb6('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x8eb6('0xa'),'project_name']},{'name':_0x8eb6('0xb'),'fields':[_0x8eb6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index b454752..7174c85 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 _0xff69=['body','options','stringify','UpdateSquareReport','update','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateSquareReport','SquareReport','create'];(function(_0x64954c,_0x3ebec3){var _0x47c88b=function(_0x203439){while(--_0x203439){_0x64954c['push'](_0x64954c['shift']());}};_0x47c88b(++_0x3ebec3);}(_0xff69,0x119));var _0x9ff6=function(_0x3e9ef3,_0x21a7e4){_0x3e9ef3=_0x3e9ef3-0x0;var _0x333748=_0xff69[_0x3e9ef3];return _0x333748;};'use strict';var _=require(_0x9ff6('0x0'));var util=require(_0x9ff6('0x1'));var moment=require('moment');var BPromise=require(_0x9ff6('0x2'));var rs=require(_0x9ff6('0x3'));var fs=require('fs');var Redis=require(_0x9ff6('0x4'));var db=require(_0x9ff6('0x5'))['db'];var utils=require(_0x9ff6('0x6'));var logger=require('../../config/logger')(_0x9ff6('0x7'));var config=require(_0x9ff6('0x8'));var jayson=require(_0x9ff6('0x9'));var client=jayson['client'][_0x9ff6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45f400,_0x4ecbb7,_0x1f1273){return new BPromise(function(_0x3244db,_0x51a4f9){return client[_0x9ff6('0xb')](_0x45f400,_0x1f1273)[_0x9ff6('0xc')](function(_0x36f715){logger[_0x9ff6('0xd')](_0x9ff6('0xe'),_0x4ecbb7,'request\x20sent');logger[_0x9ff6('0xf')](_0x9ff6('0x10'),_0x4ecbb7,_0x9ff6('0x11'),JSON['stringify'](_0x36f715));if(_0x36f715[_0x9ff6('0x12')]){if(_0x36f715[_0x9ff6('0x12')]['code']===0x1f4){logger[_0x9ff6('0x12')]('SquareReport,\x20%s,\x20%s',_0x4ecbb7,_0x36f715['error']['message']);return _0x51a4f9(_0x36f715[_0x9ff6('0x12')]['message']);}logger[_0x9ff6('0x12')](_0x9ff6('0xe'),_0x4ecbb7,_0x36f715[_0x9ff6('0x12')][_0x9ff6('0x13')]);return _0x3244db(_0x36f715['error'][_0x9ff6('0x13')]);}else{logger[_0x9ff6('0xd')](_0x9ff6('0xe'),_0x4ecbb7,_0x9ff6('0x11'));_0x3244db(_0x36f715[_0x9ff6('0x14')][_0x9ff6('0x13')]);}})[_0x9ff6('0x15')](function(_0x10d367){logger['error'](_0x9ff6('0xe'),_0x4ecbb7,_0x10d367);_0x51a4f9(_0x10d367);});});}exports[_0x9ff6('0x16')]=function(_0x4e590f){var _0x74683b=this;return new Promise(function(_0x16a068,_0x1d5d70){return db[_0x9ff6('0x17')][_0x9ff6('0x18')](_0x4e590f[_0x9ff6('0x19')],{'raw':_0x4e590f[_0x9ff6('0x1a')]?_0x4e590f[_0x9ff6('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9ff6('0xc')](function(_0x46ea91){logger[_0x9ff6('0xd')]('CreateSquareReport',_0x4e590f);logger[_0x9ff6('0xf')](_0x9ff6('0x16'),_0x4e590f,JSON[_0x9ff6('0x1b')](_0x46ea91));_0x16a068(_0x46ea91);})[_0x9ff6('0x15')](function(_0x46a523){logger[_0x9ff6('0x12')]('CreateSquareReport',_0x46a523[_0x9ff6('0x13')],_0x4e590f);_0x1d5d70(_0x74683b['error'](0x1f4,_0x46a523['message']));});});};exports[_0x9ff6('0x1c')]=function(_0x38d281){var _0x55b9d7=this;return new Promise(function(_0x56388d,_0x4f500c){return db[_0x9ff6('0x17')][_0x9ff6('0x1d')](_0x38d281[_0x9ff6('0x19')],{'raw':_0x38d281[_0x9ff6('0x1a')]?_0x38d281['options'][_0x9ff6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38d281[_0x9ff6('0x1a')]?_0x38d281[_0x9ff6('0x1a')][_0x9ff6('0x1f')]||null:null,'attributes':_0x38d281['options']?_0x38d281[_0x9ff6('0x1a')][_0x9ff6('0x20')]||null:null,'limit':_0x38d281[_0x9ff6('0x1a')]?_0x38d281[_0x9ff6('0x1a')][_0x9ff6('0x21')]||null:null})[_0x9ff6('0xc')](function(_0x1158e0){logger[_0x9ff6('0xd')](_0x9ff6('0x1c'),_0x38d281);logger[_0x9ff6('0xf')]('UpdateSquareReport',_0x38d281,JSON[_0x9ff6('0x1b')](_0x1158e0));_0x56388d(_0x1158e0);})[_0x9ff6('0x15')](function(_0x1a8ed1){logger[_0x9ff6('0x12')]('UpdateSquareReport',_0x1a8ed1[_0x9ff6('0x13')],_0x38d281);_0x4f500c(_0x55b9d7[_0x9ff6('0x12')](0x1f4,_0x1a8ed1[_0x9ff6('0x13')]));});});}; \ No newline at end of file +var _0x2138=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','catch','SquareReport','create','body','raw','CreateSquareReport','UpdateSquareReport','update','options','where','limit'];(function(_0x1329e9,_0x766087){var _0x3c800b=function(_0x1e962b){while(--_0x1e962b){_0x1329e9['push'](_0x1329e9['shift']());}};_0x3c800b(++_0x766087);}(_0x2138,0xee));var _0x8213=function(_0x4efd00,_0x98725d){_0x4efd00=_0x4efd00-0x0;var _0x292819=_0x2138[_0x4efd00];return _0x292819;};'use strict';var _=require('lodash');var util=require(_0x8213('0x0'));var moment=require(_0x8213('0x1'));var BPromise=require(_0x8213('0x2'));var rs=require(_0x8213('0x3'));var fs=require('fs');var Redis=require(_0x8213('0x4'));var db=require(_0x8213('0x5'))['db'];var utils=require(_0x8213('0x6'));var logger=require(_0x8213('0x7'))('rpc');var config=require(_0x8213('0x8'));var jayson=require(_0x8213('0x9'));var client=jayson['client'][_0x8213('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc3b28a,_0x2dd5fd,_0x5557cf){return new BPromise(function(_0x40d1de,_0x27dab0){return client[_0x8213('0xb')](_0xc3b28a,_0x5557cf)[_0x8213('0xc')](function(_0x2f0abd){logger[_0x8213('0xd')]('SquareReport,\x20%s,\x20%s',_0x2dd5fd,_0x8213('0xe'));logger[_0x8213('0xf')](_0x8213('0x10'),_0x2dd5fd,_0x8213('0xe'),JSON[_0x8213('0x11')](_0x2f0abd));if(_0x2f0abd[_0x8213('0x12')]){if(_0x2f0abd[_0x8213('0x12')][_0x8213('0x13')]===0x1f4){logger[_0x8213('0x12')]('SquareReport,\x20%s,\x20%s',_0x2dd5fd,_0x2f0abd[_0x8213('0x12')][_0x8213('0x14')]);return _0x27dab0(_0x2f0abd[_0x8213('0x12')][_0x8213('0x14')]);}logger['error'](_0x8213('0x15'),_0x2dd5fd,_0x2f0abd[_0x8213('0x12')]['message']);return _0x40d1de(_0x2f0abd[_0x8213('0x12')][_0x8213('0x14')]);}else{logger[_0x8213('0xd')](_0x8213('0x15'),_0x2dd5fd,_0x8213('0xe'));_0x40d1de(_0x2f0abd[_0x8213('0x16')][_0x8213('0x14')]);}})[_0x8213('0x17')](function(_0x319c5c){logger[_0x8213('0x12')](_0x8213('0x15'),_0x2dd5fd,_0x319c5c);_0x27dab0(_0x319c5c);});});}exports['CreateSquareReport']=function(_0x5bb026){var _0x1d539f=this;return new Promise(function(_0x846d44,_0x3129d8){return db[_0x8213('0x18')][_0x8213('0x19')](_0x5bb026[_0x8213('0x1a')],{'raw':_0x5bb026['options']?_0x5bb026['options'][_0x8213('0x1b')]===undefined?!![]:![]:!![]})[_0x8213('0xc')](function(_0x467d33){logger[_0x8213('0xd')](_0x8213('0x1c'),_0x5bb026);logger[_0x8213('0xf')](_0x8213('0x1c'),_0x5bb026,JSON[_0x8213('0x11')](_0x467d33));_0x846d44(_0x467d33);})[_0x8213('0x17')](function(_0x555530){logger[_0x8213('0x12')]('CreateSquareReport',_0x555530[_0x8213('0x14')],_0x5bb026);_0x3129d8(_0x1d539f['error'](0x1f4,_0x555530['message']));});});};exports[_0x8213('0x1d')]=function(_0x1a756b){var _0xd4c3a1=this;return new Promise(function(_0x4a4bd5,_0x2c54cd){return db[_0x8213('0x18')][_0x8213('0x1e')](_0x1a756b['body'],{'raw':_0x1a756b[_0x8213('0x1f')]?_0x1a756b[_0x8213('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a756b[_0x8213('0x1f')]?_0x1a756b[_0x8213('0x1f')][_0x8213('0x20')]||null:null,'attributes':_0x1a756b['options']?_0x1a756b['options']['attributes']||null:null,'limit':_0x1a756b['options']?_0x1a756b['options'][_0x8213('0x21')]||null:null})[_0x8213('0xc')](function(_0x32723b){logger['info'](_0x8213('0x1d'),_0x1a756b);logger['debug']('UpdateSquareReport',_0x1a756b,JSON[_0x8213('0x11')](_0x32723b));_0x4a4bd5(_0x32723b);})[_0x8213('0x17')](function(_0x518f83){logger[_0x8213('0x12')](_0x8213('0x1d'),_0x518f83[_0x8213('0x14')],_0x1a756b);_0x2c54cd(_0xd4c3a1[_0x8213('0x12')](0x1f4,_0x518f83[_0x8213('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 7e2eaa8..4afe713 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 _0x09f0=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','/describe','get','/:id','show','post','put','delete','destroy','exports','multer'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x09f0,0xfb));var _0x009f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09f0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x009f('0x0'));var util=require('util');var path=require(_0x009f('0x1'));var timeout=require(_0x009f('0x2'));var express=require(_0x009f('0x3'));var router=express['Router']();var auth=require(_0x009f('0x4'));var interaction=require(_0x009f('0x5'));var config=require(_0x009f('0x6'));var controller=require(_0x009f('0x7'));router['get']('/',auth[_0x009f('0x8')](),controller['index']);router['get'](_0x009f('0x9'),auth[_0x009f('0x8')](),controller['describe']);router[_0x009f('0xa')](_0x009f('0xb'),auth[_0x009f('0x8')](),controller[_0x009f('0xc')]);router[_0x009f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x009f('0xe')](_0x009f('0xb'),auth[_0x009f('0x8')](),controller['update']);router[_0x009f('0xf')](_0x009f('0xb'),auth['isAuthenticated'](),controller[_0x009f('0x10')]);module[_0x009f('0x11')]=router; \ No newline at end of file +var _0x7cb4=['express','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','index','get','/describe','isAuthenticated','/:id','create','put','update','destroy','util','path','connect-timeout'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x7cb4,0x12d));var _0x47cb=function(_0x14d675,_0x1ec836){_0x14d675=_0x14d675-0x0;var _0x5d7ba4=_0x7cb4[_0x14d675];return _0x5d7ba4;};'use strict';var multer=require('multer');var util=require(_0x47cb('0x0'));var path=require(_0x47cb('0x1'));var timeout=require(_0x47cb('0x2'));var express=require(_0x47cb('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x47cb('0x4'));var config=require(_0x47cb('0x5'));var controller=require(_0x47cb('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x47cb('0x7')]);router[_0x47cb('0x8')](_0x47cb('0x9'),auth[_0x47cb('0xa')](),controller['describe']);router[_0x47cb('0x8')](_0x47cb('0xb'),auth[_0x47cb('0xa')](),controller['show']);router['post']('/',auth[_0x47cb('0xa')](),controller[_0x47cb('0xc')]);router[_0x47cb('0xd')]('/:id',auth[_0x47cb('0xa')](),controller[_0x47cb('0xe')]);router['delete'](_0x47cb('0xb'),auth[_0x47cb('0xa')](),controller[_0x47cb('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 61f8cce..6bce331 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 _0x57cf=['STRING','exports'];(function(_0x14a384,_0x46c371){var _0x1d3191=function(_0xfe20ba){while(--_0xfe20ba){_0x14a384['push'](_0x14a384['shift']());}};_0x1d3191(++_0x46c371);}(_0x57cf,0xc1));var _0xf57c=function(_0x246227,_0x12bfcb){_0x246227=_0x246227-0x0;var _0x37bd4a=_0x57cf[_0x246227];return _0x37bd4a;};'use strict';var Sequelize=require('sequelize');module[_0xf57c('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xf57c('0x1')]},'application':{'type':Sequelize[_0xf57c('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf57c('0x1')]}}; \ No newline at end of file +var _0xb80a=['STRING','TEXT','sequelize','exports'];(function(_0x2d13c1,_0xed35ab){var _0x265229=function(_0x27ec74){while(--_0x27ec74){_0x2d13c1['push'](_0x2d13c1['shift']());}};_0x265229(++_0xed35ab);}(_0xb80a,0x196));var _0xab80=function(_0x57e88d,_0x3a0a0d){_0x57e88d=_0x57e88d-0x0;var _0x56c660=_0xb80a[_0x57e88d];return _0x56c660;};'use strict';var Sequelize=require(_0xab80('0x0'));module[_0xab80('0x1')]={'uniqueid':{'type':Sequelize[_0xab80('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xab80('0x2')]},'data':{'type':Sequelize[_0xab80('0x3')]},'project_name':{'type':Sequelize[_0xab80('0x2')]},'callerid':{'type':Sequelize[_0xab80('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index fc179d5..9c71c2d 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 _0x59ae=['includeAll','include','findAll','rows','show','params','length','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','SquareDetailsReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','field','options','then'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x59ae,0xa4));var _0xe59a=function(_0x21c541,_0x3c24ca){_0x21c541=_0x21c541-0x0;var _0x5d9046=_0x59ae[_0x21c541];return _0x5d9046;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe59a('0x0'));var rimraf=require(_0xe59a('0x1'));var zipdir=require(_0xe59a('0x2'));var jsonpatch=require(_0xe59a('0x3'));var rp=require(_0xe59a('0x4'));var moment=require(_0xe59a('0x5'));var BPromise=require(_0xe59a('0x6'));var Mustache=require(_0xe59a('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe59a('0x8'));var ejs=require(_0xe59a('0x9'));var fs=require('fs');var _=require(_0xe59a('0xa'));var squel=require(_0xe59a('0xb'));var crypto=require(_0xe59a('0xc'));var jsforce=require(_0xe59a('0xd'));var deskjs=require(_0xe59a('0xe'));var toCsv=require(_0xe59a('0x8'));var querystring=require(_0xe59a('0xf'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xe59a('0x10'));var Redis=require(_0xe59a('0x11'));var qs=require(_0xe59a('0x12'));var logger=require(_0xe59a('0x13'))(_0xe59a('0x14'));var utils=require(_0xe59a('0x15'));var config=require(_0xe59a('0x16'));var db=require(_0xe59a('0x17'))['db'];function respondWithStatusCode(_0x1afb08,_0x5a7754){_0x5a7754=_0x5a7754||0xcc;return function(_0x1f0955){if(_0x1f0955){return _0x1afb08[_0xe59a('0x18')](_0x5a7754);}return _0x1afb08[_0xe59a('0x19')](_0x5a7754)['end']();};}function respondWithResult(_0x3d1ded,_0x247f5f){_0x247f5f=_0x247f5f||0xc8;return function(_0x254aa3){if(_0x254aa3){return _0x3d1ded['status'](_0x247f5f)[_0xe59a('0x1a')](_0x254aa3);}};}function respondWithFilteredResult(_0x3f41f8,_0x2076f1){return function(_0x59f449){if(_0x59f449){var _0x3b83ea=_0x59f449[_0xe59a('0x1b')],_0x478598=_0x2076f1[_0xe59a('0x1c')],_0x5d4ad4=_0x2076f1[_0xe59a('0x1c')]+_0x2076f1[_0xe59a('0x1d')],_0x15f2b6;if(_0x5d4ad4>=_0x3b83ea){_0x5d4ad4=_0x3b83ea;_0x15f2b6=0xc8;}else{_0x15f2b6=0xce;}_0x3f41f8[_0xe59a('0x19')](_0x15f2b6);return _0x3f41f8[_0xe59a('0x1e')](_0xe59a('0x1f'),_0x478598+'-'+_0x5d4ad4+'/'+_0x3b83ea)[_0xe59a('0x1a')](_0x59f449);}return null;};}function patchUpdates(_0x4647b1){return function(_0x45d32d){try{jsonpatch[_0xe59a('0x20')](_0x45d32d,_0x4647b1,!![]);}catch(_0x1a17ff){return BPromise[_0xe59a('0x21')](_0x1a17ff);}return _0x45d32d[_0xe59a('0x22')]();};}function saveUpdates(_0x694673,_0x5f0e97){return function(_0x3130f7){if(_0x3130f7){return _0x3130f7[_0xe59a('0x23')](_0x694673)['then'](function(_0x1888e8){return _0x1888e8;});}return null;};}function removeEntity(_0x2908ba,_0x35d9af){return function(_0x18eb9c){if(_0x18eb9c){return _0x18eb9c[_0xe59a('0x24')]()['then'](function(){_0x2908ba[_0xe59a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x288f41,_0x5289fc){return function(_0x3aad5){if(!_0x3aad5){_0x288f41[_0xe59a('0x18')](0x194);}return _0x3aad5;};}function handleError(_0x870035,_0x3db6d3){_0x3db6d3=_0x3db6d3||0x1f4;return function(_0x37e499){logger[_0xe59a('0x25')](_0x37e499[_0xe59a('0x26')]);if(_0x37e499[_0xe59a('0x27')]){delete _0x37e499[_0xe59a('0x27')];}_0x870035[_0xe59a('0x19')](_0x3db6d3)[_0xe59a('0x28')](_0x37e499);};}exports['index']=function(_0x1270ec,_0x18ac37){var _0x56a121={},_0x184bf6={},_0x630d75={'count':0x0,'rows':[]};var _0x545ee3=db[_0xe59a('0x29')][_0xe59a('0x2a')];_0x184bf6[_0xe59a('0x2b')]=_['keys'](_0x545ee3);_0x184bf6['query']=_[_0xe59a('0x2c')](_0x1270ec[_0xe59a('0x2d')]);_0x184bf6[_0xe59a('0x2e')]=_[_0xe59a('0x2f')](_0x184bf6[_0xe59a('0x2b')],_0x184bf6[_0xe59a('0x2d')]);_0x56a121[_0xe59a('0x30')]=_[_0xe59a('0x2f')](_0x184bf6['model'],qs[_0xe59a('0x31')](_0x1270ec['query'][_0xe59a('0x31')]));_0x56a121['attributes']=_0x56a121[_0xe59a('0x30')]['length']?_0x56a121[_0xe59a('0x30')]:_0x184bf6[_0xe59a('0x2b')];if(!_0x1270ec[_0xe59a('0x2d')][_0xe59a('0x32')](_0xe59a('0x33'))){_0x56a121[_0xe59a('0x1d')]=qs[_0xe59a('0x1d')](_0x1270ec[_0xe59a('0x2d')][_0xe59a('0x1d')]);_0x56a121[_0xe59a('0x1c')]=qs[_0xe59a('0x1c')](_0x1270ec[_0xe59a('0x2d')][_0xe59a('0x1c')]);}_0x56a121[_0xe59a('0x34')]=qs[_0xe59a('0x35')](_0x1270ec[_0xe59a('0x2d')]['sort']);_0x56a121['where']=qs[_0xe59a('0x2e')](_[_0xe59a('0x36')](_0x1270ec[_0xe59a('0x2d')],_0x184bf6[_0xe59a('0x2e')]));if(_0x1270ec[_0xe59a('0x2d')][_0xe59a('0x37')]){_0x56a121[_0xe59a('0x38')]=_[_0xe59a('0x39')](_0x56a121[_0xe59a('0x38')],{'$or':_[_0xe59a('0x3a')](_0x545ee3,function(_0x100174){if(_0x100174[_0xe59a('0x3b')]['key']!==_0xe59a('0x3c')){var _0xeae95e={};_0xeae95e[_0x100174[_0xe59a('0x3d')]]={'$like':'%'+_0x1270ec[_0xe59a('0x2d')][_0xe59a('0x37')]+'%'};return _0xeae95e;}})});}_0x56a121=_[_0xe59a('0x39')]({},_0x56a121,_0x1270ec[_0xe59a('0x3e')]);var _0x305ee8={'where':_0x56a121[_0xe59a('0x38')]};return db['SquareDetailsReport'][_0xe59a('0x1b')](_0x305ee8)[_0xe59a('0x3f')](function(_0x7e806b){_0x630d75[_0xe59a('0x1b')]=_0x7e806b;if(_0x1270ec[_0xe59a('0x2d')][_0xe59a('0x40')]){_0x56a121[_0xe59a('0x41')]=[{'all':!![]}];}return db[_0xe59a('0x29')][_0xe59a('0x42')](_0x56a121);})['then'](function(_0x3c0342){_0x630d75[_0xe59a('0x43')]=_0x3c0342;return _0x630d75;})[_0xe59a('0x3f')](respondWithFilteredResult(_0x18ac37,_0x56a121))['catch'](handleError(_0x18ac37,null));};exports[_0xe59a('0x44')]=function(_0x4038b3,_0x50b088){var _0x58c877={'raw':!![],'where':{'id':_0x4038b3[_0xe59a('0x45')]['id']}},_0x3f5f77={};_0x3f5f77[_0xe59a('0x2b')]=_[_0xe59a('0x2c')](db[_0xe59a('0x29')][_0xe59a('0x2a')]);_0x3f5f77[_0xe59a('0x2d')]=_[_0xe59a('0x2c')](_0x4038b3['query']);_0x3f5f77[_0xe59a('0x2e')]=_[_0xe59a('0x2f')](_0x3f5f77[_0xe59a('0x2b')],_0x3f5f77[_0xe59a('0x2d')]);_0x58c877[_0xe59a('0x30')]=_[_0xe59a('0x2f')](_0x3f5f77[_0xe59a('0x2b')],qs['fields'](_0x4038b3[_0xe59a('0x2d')][_0xe59a('0x31')]));_0x58c877[_0xe59a('0x30')]=_0x58c877[_0xe59a('0x30')][_0xe59a('0x46')]?_0x58c877[_0xe59a('0x30')]:_0x3f5f77[_0xe59a('0x2b')];if(_0x4038b3[_0xe59a('0x2d')]['includeAll']){_0x58c877[_0xe59a('0x41')]=[{'all':!![]}];}_0x58c877=_[_0xe59a('0x39')]({},_0x58c877,_0x4038b3[_0xe59a('0x3e')]);return db[_0xe59a('0x29')]['find'](_0x58c877)[_0xe59a('0x3f')](handleEntityNotFound(_0x50b088,null))[_0xe59a('0x3f')](respondWithResult(_0x50b088,null))['catch'](handleError(_0x50b088,null));};exports[_0xe59a('0x47')]=function(_0x3158c5,_0x165228){return db[_0xe59a('0x29')][_0xe59a('0x47')](_0x3158c5[_0xe59a('0x48')],{})['then'](respondWithResult(_0x165228,0xc9))[_0xe59a('0x49')](handleError(_0x165228,null));};exports[_0xe59a('0x23')]=function(_0x4b60f6,_0x4ed5f4){if(_0x4b60f6['body']['id']){delete _0x4b60f6[_0xe59a('0x48')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x4b60f6[_0xe59a('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ed5f4,null))[_0xe59a('0x3f')](saveUpdates(_0x4b60f6['body'],null))[_0xe59a('0x3f')](respondWithResult(_0x4ed5f4,null))['catch'](handleError(_0x4ed5f4,null));};exports['destroy']=function(_0x20f7b3,_0x117a0c){return db[_0xe59a('0x29')][_0xe59a('0x4a')]({'where':{'id':_0x20f7b3[_0xe59a('0x45')]['id']}})[_0xe59a('0x3f')](handleEntityNotFound(_0x117a0c,null))['then'](removeEntity(_0x117a0c,null))[_0xe59a('0x49')](handleError(_0x117a0c,null));};exports[_0xe59a('0x4b')]=function(_0x4c750d,_0x2cfe96){return db[_0xe59a('0x29')]['describe']()[_0xe59a('0x3f')](respondWithResult(_0x2cfe96,null))[_0xe59a('0x49')](handleError(_0x2cfe96,null));}; \ No newline at end of file +var _0x1685=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','api','../../config/utils','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','destroy','then','error','stack','send','index','SquareDetailsReport','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','key','VIRTUAL','field','options','includeAll','findAll','catch','params','rawAttributes','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x39075d,_0x2b8870){var _0x4b1154=function(_0x2a3a8b){while(--_0x2a3a8b){_0x39075d['push'](_0x39075d['shift']());}};_0x4b1154(++_0x2b8870);}(_0x1685,0x196));var _0x5168=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1685[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x5168('0x0'));var emlformat=require(_0x5168('0x1'));var rimraf=require(_0x5168('0x2'));var zipdir=require(_0x5168('0x3'));var jsonpatch=require(_0x5168('0x4'));var rp=require(_0x5168('0x5'));var moment=require(_0x5168('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5168('0x7'));var util=require(_0x5168('0x8'));var path=require(_0x5168('0x9'));var sox=require(_0x5168('0xa'));var csv=require(_0x5168('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5168('0xc'));var squel=require(_0x5168('0xd'));var crypto=require(_0x5168('0xe'));var jsforce=require(_0x5168('0xf'));var deskjs=require(_0x5168('0x10'));var toCsv=require(_0x5168('0xb'));var querystring=require(_0x5168('0x11'));var Papa=require(_0x5168('0x12'));var authService=require(_0x5168('0x13'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x5168('0x14'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x5168('0x15'));var utils=require(_0x5168('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a468d,_0x1f9e29){_0x1f9e29=_0x1f9e29||0xcc;return function(_0x5e0526){if(_0x5e0526){return _0x2a468d[_0x5168('0x17')](_0x1f9e29);}return _0x2a468d[_0x5168('0x18')](_0x1f9e29)[_0x5168('0x19')]();};}function respondWithResult(_0x35b9d3,_0x5d67c4){_0x5d67c4=_0x5d67c4||0xc8;return function(_0x311f4c){if(_0x311f4c){return _0x35b9d3[_0x5168('0x18')](_0x5d67c4)[_0x5168('0x1a')](_0x311f4c);}};}function respondWithFilteredResult(_0xa119ca,_0x466fa9){return function(_0x7cc27d){if(_0x7cc27d){var _0x5ccb78=_0x7cc27d[_0x5168('0x1b')],_0x25152d=_0x466fa9[_0x5168('0x1c')],_0x33ae54=_0x466fa9[_0x5168('0x1c')]+_0x466fa9['limit'],_0x5915a1;if(_0x33ae54>=_0x5ccb78){_0x33ae54=_0x5ccb78;_0x5915a1=0xc8;}else{_0x5915a1=0xce;}_0xa119ca[_0x5168('0x18')](_0x5915a1);return _0xa119ca[_0x5168('0x1d')](_0x5168('0x1e'),_0x25152d+'-'+_0x33ae54+'/'+_0x5ccb78)[_0x5168('0x1a')](_0x7cc27d);}return null;};}function patchUpdates(_0x191b5f){return function(_0x4ef227){try{jsonpatch[_0x5168('0x1f')](_0x4ef227,_0x191b5f,!![]);}catch(_0x1837ce){return BPromise[_0x5168('0x20')](_0x1837ce);}return _0x4ef227['save']();};}function saveUpdates(_0xd10567,_0x96ecb){return function(_0x2d1a47){if(_0x2d1a47){return _0x2d1a47['update'](_0xd10567)['then'](function(_0x3fa7a9){return _0x3fa7a9;});}return null;};}function removeEntity(_0x5f8363,_0x40ddd0){return function(_0x14185e){if(_0x14185e){return _0x14185e[_0x5168('0x21')]()[_0x5168('0x22')](function(){_0x5f8363[_0x5168('0x18')](0xcc)[_0x5168('0x19')]();});}};}function handleEntityNotFound(_0x54a6b7,_0x34755f){return function(_0x540840){if(!_0x540840){_0x54a6b7[_0x5168('0x17')](0x194);}return _0x540840;};}function handleError(_0x555181,_0x49c60b){_0x49c60b=_0x49c60b||0x1f4;return function(_0xf69315){logger[_0x5168('0x23')](_0xf69315[_0x5168('0x24')]);if(_0xf69315['name']){delete _0xf69315['name'];}_0x555181[_0x5168('0x18')](_0x49c60b)[_0x5168('0x25')](_0xf69315);};}exports[_0x5168('0x26')]=function(_0x17f17f,_0x288485){var _0x58014e={},_0x4f2dce={},_0x3f104d={'count':0x0,'rows':[]};var _0x1fba80=db[_0x5168('0x27')]['rawAttributes'];_0x4f2dce[_0x5168('0x28')]=_[_0x5168('0x29')](_0x1fba80);_0x4f2dce[_0x5168('0x2a')]=_[_0x5168('0x29')](_0x17f17f[_0x5168('0x2a')]);_0x4f2dce[_0x5168('0x2b')]=_[_0x5168('0x2c')](_0x4f2dce[_0x5168('0x28')],_0x4f2dce[_0x5168('0x2a')]);_0x58014e[_0x5168('0x2d')]=_['intersection'](_0x4f2dce[_0x5168('0x28')],qs[_0x5168('0x2e')](_0x17f17f[_0x5168('0x2a')][_0x5168('0x2e')]));_0x58014e[_0x5168('0x2d')]=_0x58014e[_0x5168('0x2d')][_0x5168('0x2f')]?_0x58014e[_0x5168('0x2d')]:_0x4f2dce[_0x5168('0x28')];if(!_0x17f17f['query'][_0x5168('0x30')](_0x5168('0x31'))){_0x58014e[_0x5168('0x32')]=qs[_0x5168('0x32')](_0x17f17f['query']['limit']);_0x58014e[_0x5168('0x1c')]=qs[_0x5168('0x1c')](_0x17f17f['query']['offset']);}_0x58014e[_0x5168('0x33')]=qs[_0x5168('0x34')](_0x17f17f['query'][_0x5168('0x34')]);_0x58014e[_0x5168('0x35')]=qs['filters'](_['pick'](_0x17f17f[_0x5168('0x2a')],_0x4f2dce['filters']));if(_0x17f17f[_0x5168('0x2a')][_0x5168('0x36')]){_0x58014e['where']=_[_0x5168('0x37')](_0x58014e[_0x5168('0x35')],{'$or':_['map'](_0x1fba80,function(_0x47434a){if(_0x47434a['type'][_0x5168('0x38')]!==_0x5168('0x39')){var _0x590c94={};_0x590c94[_0x47434a[_0x5168('0x3a')]]={'$like':'%'+_0x17f17f['query']['filter']+'%'};return _0x590c94;}})});}_0x58014e=_[_0x5168('0x37')]({},_0x58014e,_0x17f17f[_0x5168('0x3b')]);var _0xc98b44={'where':_0x58014e[_0x5168('0x35')]};return db[_0x5168('0x27')]['count'](_0xc98b44)[_0x5168('0x22')](function(_0x4bc859){_0x3f104d['count']=_0x4bc859;if(_0x17f17f[_0x5168('0x2a')][_0x5168('0x3c')]){_0x58014e['include']=[{'all':!![]}];}return db[_0x5168('0x27')][_0x5168('0x3d')](_0x58014e);})[_0x5168('0x22')](function(_0x24b98f){_0x3f104d['rows']=_0x24b98f;return _0x3f104d;})[_0x5168('0x22')](respondWithFilteredResult(_0x288485,_0x58014e))[_0x5168('0x3e')](handleError(_0x288485,null));};exports['show']=function(_0x52ab8f,_0x3d3e1a){var _0x352e68={'raw':!![],'where':{'id':_0x52ab8f[_0x5168('0x3f')]['id']}},_0x52ca1a={};_0x52ca1a['model']=_['keys'](db['SquareDetailsReport'][_0x5168('0x40')]);_0x52ca1a[_0x5168('0x2a')]=_[_0x5168('0x29')](_0x52ab8f[_0x5168('0x2a')]);_0x52ca1a[_0x5168('0x2b')]=_[_0x5168('0x2c')](_0x52ca1a[_0x5168('0x28')],_0x52ca1a[_0x5168('0x2a')]);_0x352e68[_0x5168('0x2d')]=_['intersection'](_0x52ca1a['model'],qs[_0x5168('0x2e')](_0x52ab8f[_0x5168('0x2a')][_0x5168('0x2e')]));_0x352e68[_0x5168('0x2d')]=_0x352e68[_0x5168('0x2d')][_0x5168('0x2f')]?_0x352e68[_0x5168('0x2d')]:_0x52ca1a[_0x5168('0x28')];if(_0x52ab8f[_0x5168('0x2a')][_0x5168('0x3c')]){_0x352e68[_0x5168('0x41')]=[{'all':!![]}];}_0x352e68=_[_0x5168('0x37')]({},_0x352e68,_0x52ab8f[_0x5168('0x3b')]);return db[_0x5168('0x27')][_0x5168('0x42')](_0x352e68)[_0x5168('0x22')](handleEntityNotFound(_0x3d3e1a,null))[_0x5168('0x22')](respondWithResult(_0x3d3e1a,null))[_0x5168('0x3e')](handleError(_0x3d3e1a,null));};exports[_0x5168('0x43')]=function(_0x3c39f2,_0xcdf343){return db['SquareDetailsReport'][_0x5168('0x43')](_0x3c39f2['body'],{})[_0x5168('0x22')](respondWithResult(_0xcdf343,0xc9))[_0x5168('0x3e')](handleError(_0xcdf343,null));};exports['update']=function(_0x2b97e7,_0x3758c1){if(_0x2b97e7[_0x5168('0x44')]['id']){delete _0x2b97e7[_0x5168('0x44')]['id'];}return db['SquareDetailsReport'][_0x5168('0x42')]({'where':{'id':_0x2b97e7['params']['id']}})[_0x5168('0x22')](handleEntityNotFound(_0x3758c1,null))[_0x5168('0x22')](saveUpdates(_0x2b97e7[_0x5168('0x44')],null))[_0x5168('0x22')](respondWithResult(_0x3758c1,null))[_0x5168('0x3e')](handleError(_0x3758c1,null));};exports['destroy']=function(_0x46f0cb,_0xa4f680){return db[_0x5168('0x27')][_0x5168('0x42')]({'where':{'id':_0x46f0cb[_0x5168('0x3f')]['id']}})[_0x5168('0x22')](handleEntityNotFound(_0xa4f680,null))[_0x5168('0x22')](removeEntity(_0xa4f680,null))[_0x5168('0x3e')](handleError(_0xa4f680,null));};exports[_0x5168('0x45')]=function(_0x5f90cd,_0x11c317){return db[_0x5168('0x27')][_0x5168('0x45')]()[_0x5168('0x22')](respondWithResult(_0x11c317,null))['catch'](handleError(_0x11c317,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 5b1c34b..82d1a74 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 _0x1b8c=['./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b8c,0x175));var _0xc1b8=function(_0xbba944,_0x1558b7){_0xbba944=_0xbba944-0x0;var _0x3e6b2c=_0x1b8c[_0xbba944];return _0x3e6b2c;};'use strict';var _=require(_0xc1b8('0x0'));var util=require('util');var logger=require(_0xc1b8('0x1'))(_0xc1b8('0x2'));var moment=require('moment');var BPromise=require(_0xc1b8('0x3'));var rp=require(_0xc1b8('0x4'));var attributes=require(_0xc1b8('0x5'));module['exports']=function(_0x4c71c0,_0x1127e8){return _0x4c71c0[_0xc1b8('0x6')](_0xc1b8('0x7'),attributes,{'tableName':_0xc1b8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90ae=['SquareDetailsReport','report_square_details','../../config/logger','api','bluebird','./squareReportDetail.attributes','exports','define'];(function(_0x59d94c,_0x33f979){var _0x4a6d77=function(_0x473b6c){while(--_0x473b6c){_0x59d94c['push'](_0x59d94c['shift']());}};_0x4a6d77(++_0x33f979);}(_0x90ae,0x14a));var _0xe90a=function(_0x4e8957,_0x5f0149){_0x4e8957=_0x4e8957-0x0;var _0x1e3d91=_0x90ae[_0x4e8957];return _0x1e3d91;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe90a('0x0'))(_0xe90a('0x1'));var moment=require('moment');var BPromise=require(_0xe90a('0x2'));var rp=require('request-promise');var attributes=require(_0xe90a('0x3'));module[_0xe90a('0x4')]=function(_0x1e7bda,_0x524f42){return _0x1e7bda[_0xe90a('0x5')](_0xe90a('0x6'),attributes,{'tableName':_0xe90a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index a7451f1..5546620 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 _0xdcc4=['error','message','result','catch','create','body','options','raw','CreateSquareDetailsReport','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0xdcc4,0xea));var _0x4dcc=function(_0x462997,_0x26480c){_0x462997=_0x462997-0x0;var _0x1b3346=_0xdcc4[_0x462997];return _0x1b3346;};'use strict';var _=require(_0x4dcc('0x0'));var util=require(_0x4dcc('0x1'));var moment=require(_0x4dcc('0x2'));var BPromise=require(_0x4dcc('0x3'));var rs=require(_0x4dcc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4dcc('0x5'))['db'];var utils=require(_0x4dcc('0x6'));var logger=require(_0x4dcc('0x7'))(_0x4dcc('0x8'));var config=require(_0x4dcc('0x9'));var jayson=require(_0x4dcc('0xa'));var client=jayson['client'][_0x4dcc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5561be,_0x3392ef,_0x1634f2){return new BPromise(function(_0x461e9c,_0x165bf5){return client['request'](_0x5561be,_0x1634f2)[_0x4dcc('0xc')](function(_0x31dd9d){logger[_0x4dcc('0xd')](_0x4dcc('0xe'),_0x3392ef,_0x4dcc('0xf'));logger[_0x4dcc('0x10')](_0x4dcc('0x11'),_0x3392ef,_0x4dcc('0xf'),JSON['stringify'](_0x31dd9d));if(_0x31dd9d[_0x4dcc('0x12')]){if(_0x31dd9d[_0x4dcc('0x12')]['code']===0x1f4){logger[_0x4dcc('0x12')](_0x4dcc('0xe'),_0x3392ef,_0x31dd9d['error'][_0x4dcc('0x13')]);return _0x165bf5(_0x31dd9d[_0x4dcc('0x12')][_0x4dcc('0x13')]);}logger[_0x4dcc('0x12')](_0x4dcc('0xe'),_0x3392ef,_0x31dd9d[_0x4dcc('0x12')][_0x4dcc('0x13')]);return _0x461e9c(_0x31dd9d[_0x4dcc('0x12')]['message']);}else{logger['info'](_0x4dcc('0xe'),_0x3392ef,_0x4dcc('0xf'));_0x461e9c(_0x31dd9d[_0x4dcc('0x14')][_0x4dcc('0x13')]);}})[_0x4dcc('0x15')](function(_0x5dacd1){logger[_0x4dcc('0x12')](_0x4dcc('0xe'),_0x3392ef,_0x5dacd1);_0x165bf5(_0x5dacd1);});});}exports['CreateSquareDetailsReport']=function(_0x4ba591){var _0x5ad971=this;return new Promise(function(_0x418392,_0x31d9fe){return db['SquareDetailsReport'][_0x4dcc('0x16')](_0x4ba591[_0x4dcc('0x17')],{'raw':_0x4ba591[_0x4dcc('0x18')]?_0x4ba591['options'][_0x4dcc('0x19')]===undefined?!![]:![]:!![]})[_0x4dcc('0xc')](function(_0x39209e){logger[_0x4dcc('0xd')](_0x4dcc('0x1a'),_0x4ba591);logger[_0x4dcc('0x10')](_0x4dcc('0x1a'),_0x4ba591,JSON[_0x4dcc('0x1b')](_0x39209e));_0x418392(_0x39209e);})[_0x4dcc('0x15')](function(_0x1ed6d0){logger[_0x4dcc('0x12')](_0x4dcc('0x1a'),_0x1ed6d0[_0x4dcc('0x13')],_0x4ba591);_0x31d9fe(_0x5ad971[_0x4dcc('0x12')](0x1f4,_0x1ed6d0[_0x4dcc('0x13')]));});});}; \ No newline at end of file +var _0x7118=['message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','raw','debug','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x7118,0x159));var _0x8711=function(_0x3e7742,_0xd25b89){_0x3e7742=_0x3e7742-0x0;var _0x4e0a87=_0x7118[_0x3e7742];return _0x4e0a87;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8711('0x0'));var BPromise=require(_0x8711('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8711('0x2'));var db=require(_0x8711('0x3'))['db'];var utils=require(_0x8711('0x4'));var logger=require(_0x8711('0x5'))(_0x8711('0x6'));var config=require(_0x8711('0x7'));var jayson=require(_0x8711('0x8'));var client=jayson['client'][_0x8711('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2244c2,_0x1f23a9,_0x3d82f2){return new BPromise(function(_0x189349,_0xa46f29){return client[_0x8711('0xa')](_0x2244c2,_0x3d82f2)[_0x8711('0xb')](function(_0x32a826){logger[_0x8711('0xc')](_0x8711('0xd'),_0x1f23a9,'request\x20sent');logger['debug'](_0x8711('0xe'),_0x1f23a9,_0x8711('0xf'),JSON[_0x8711('0x10')](_0x32a826));if(_0x32a826['error']){if(_0x32a826['error'][_0x8711('0x11')]===0x1f4){logger[_0x8711('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1f23a9,_0x32a826['error'][_0x8711('0x13')]);return _0xa46f29(_0x32a826[_0x8711('0x12')][_0x8711('0x13')]);}logger[_0x8711('0x12')](_0x8711('0xd'),_0x1f23a9,_0x32a826[_0x8711('0x12')][_0x8711('0x13')]);return _0x189349(_0x32a826['error'][_0x8711('0x13')]);}else{logger[_0x8711('0xc')](_0x8711('0xd'),_0x1f23a9,_0x8711('0xf'));_0x189349(_0x32a826[_0x8711('0x14')][_0x8711('0x13')]);}})['catch'](function(_0x2f96a0){logger[_0x8711('0x12')](_0x8711('0xd'),_0x1f23a9,_0x2f96a0);_0xa46f29(_0x2f96a0);});});}exports[_0x8711('0x15')]=function(_0x19a157){var _0x47d18b=this;return new Promise(function(_0x5b2bf8,_0x569412){return db[_0x8711('0x16')][_0x8711('0x17')](_0x19a157[_0x8711('0x18')],{'raw':_0x19a157['options']?_0x19a157['options'][_0x8711('0x19')]===undefined?!![]:![]:!![]})[_0x8711('0xb')](function(_0x1209e0){logger[_0x8711('0xc')](_0x8711('0x15'),_0x19a157);logger[_0x8711('0x1a')](_0x8711('0x15'),_0x19a157,JSON[_0x8711('0x10')](_0x1209e0));_0x5b2bf8(_0x1209e0);})[_0x8711('0x1b')](function(_0x41369d){logger['error'](_0x8711('0x15'),_0x41369d[_0x8711('0x13')],_0x19a157);_0x569412(_0x47d18b[_0x8711('0x12')](0x1f4,_0x41369d[_0x8711('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index a3b9717..5421b1d 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 _0x18f0=['get','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service'];(function(_0x4af03e,_0x4bf5c5){var _0x1c7f66=function(_0x45cbd8){while(--_0x45cbd8){_0x4af03e['push'](_0x4af03e['shift']());}};_0x1c7f66(++_0x4bf5c5);}(_0x18f0,0x170));var _0x018f=function(_0x3bbe4b,_0x35f067){_0x3bbe4b=_0x3bbe4b-0x0;var _0x402d37=_0x18f0[_0x3bbe4b];return _0x402d37;};'use strict';var express=require(_0x018f('0x0'));var router=express[_0x018f('0x1')]();var auth=require(_0x018f('0x2'));var controller=require('./system.controller');router[_0x018f('0x3')]('/',auth[_0x018f('0x4')](),controller['index']);router[_0x018f('0x3')]('/process/:pid/kill',auth[_0x018f('0x4')](),controller[_0x018f('0x5')]);module[_0x018f('0x6')]=router; \ No newline at end of file +var _0x4689=['isAuthenticated','index','/process/:pid/kill','killProcess','exports','Router','./system.controller','get'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x4689,0xe5));var _0x9468=function(_0x1a8d9a,_0x53d5d9){_0x1a8d9a=_0x1a8d9a-0x0;var _0x449f41=_0x4689[_0x1a8d9a];return _0x449f41;};'use strict';var express=require('express');var router=express[_0x9468('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x9468('0x1'));router[_0x9468('0x2')]('/',auth[_0x9468('0x3')](),controller[_0x9468('0x4')]);router['get'](_0x9468('0x5'),auth[_0x9468('0x3')](),controller[_0x9468('0x6')]);module[_0x9468('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index de69f08..dba3f63 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 _0xfcd2=['params','pid','split','length','format','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','index','getAllData','then','json','catch','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0xfcd2,0x1a8));var _0x2fcd=function(_0x1ea2d1,_0x26e867){_0x1ea2d1=_0x1ea2d1-0x0;var _0x173b4f=_0xfcd2[_0x1ea2d1];return _0x173b4f;};'use strict';var info=require(_0x2fcd('0x0'));var exec=require(_0x2fcd('0x1'))[_0x2fcd('0x2')];var logger=require(_0x2fcd('0x3'))(_0x2fcd('0x4'));var util=require('util');var BPromise=require(_0x2fcd('0x5'));var _=require(_0x2fcd('0x6'));function handleError(_0x3027c7,_0x512a2a,_0x4f2f2c){_0x512a2a=_0x512a2a||0x1f4;return function(_0x5c213d){logger[_0x2fcd('0x7')](_0x2fcd('0x8'),_0x4f2f2c,_0x512a2a,util[_0x2fcd('0x9')](_0x5c213d,{'showHidden':![],'depth':null}));delete _0x5c213d['name'];_0x3027c7[_0x2fcd('0xa')](_0x512a2a)['send'](_0x5c213d);};}exports[_0x2fcd('0xb')]=function(_0x5d7fc5,_0x5e0077){return info[_0x2fcd('0xc')]()[_0x2fcd('0xd')](function(_0x4e6d3b){return _0x5e0077[_0x2fcd('0xa')](0xc8)[_0x2fcd('0xe')](_0x4e6d3b);})[_0x2fcd('0xf')](function(_0x20e75c){return _0x5e0077['status'](0x1f4)[_0x2fcd('0xe')](_0x20e75c);});};exports['killProcess']=function(_0x38b320,_0x49d2b9){var _0x23a572=[_0x2fcd('0x10')];return new BPromise(function(_0x40e472,_0x2db324){return exec(util['format'](_0x2fcd('0x11'),_0x38b320[_0x2fcd('0x12')][_0x2fcd('0x13')]),function(_0x1a1788,_0x5e9cae,_0x30a50e){if(_0x1a1788){return _0x2db324(_0x1a1788);}return _0x40e472(_0x5e9cae);});})['then'](function(_0x758998){var _0xd5a023=![];var _0x12073a=_0x758998[_0x2fcd('0x14')](/\n/);for(var _0x3cfe45=0x0,_0x35677f=_0x23a572[_0x2fcd('0x15')];_0x3cfe45<_0x35677f,_0xd5a023===![];_0x3cfe45+=0x1){if(_0x758998['indexOf'](_0x23a572[_0x3cfe45])>=0x0){_0xd5a023=!![];}}if(!_0xd5a023){throw new Error(util[_0x2fcd('0x16')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x38b320[_0x2fcd('0x12')][_0x2fcd('0x13')]));}process['kill'](_0x38b320['params']['pid'],_0x2fcd('0x17'));return _0x49d2b9[_0x2fcd('0xa')](0xc8)['json']({'message':util[_0x2fcd('0x16')](_0x2fcd('0x18'),_0x38b320['params'][_0x2fcd('0x13')])});})[_0x2fcd('0xf')](handleError(_0x49d2b9,null,_0x2fcd('0x19')));}; \ No newline at end of file +var _0x7289=['index','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','bluebird','lodash','error','inspect','name','status','send'];(function(_0x26f00f,_0x26435a){var _0x2a070a=function(_0x38c6c2){while(--_0x38c6c2){_0x26f00f['push'](_0x26f00f['shift']());}};_0x2a070a(++_0x26435a);}(_0x7289,0xb2));var _0x9728=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7289[_0x4cf98e];return _0x1623ac;};'use strict';var info=require(_0x9728('0x0'));var exec=require(_0x9728('0x1'))[_0x9728('0x2')];var logger=require('../../config/logger')(_0x9728('0x3'));var util=require('util');var BPromise=require(_0x9728('0x4'));var _=require(_0x9728('0x5'));function handleError(_0x5c48de,_0x1439c5,_0x24e309){_0x1439c5=_0x1439c5||0x1f4;return function(_0xfd6c38){logger[_0x9728('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x24e309,_0x1439c5,util[_0x9728('0x7')](_0xfd6c38,{'showHidden':![],'depth':null}));delete _0xfd6c38[_0x9728('0x8')];_0x5c48de[_0x9728('0x9')](_0x1439c5)[_0x9728('0xa')](_0xfd6c38);};}exports[_0x9728('0xb')]=function(_0x50fd1d,_0x1851ca){return info['getAllData']()['then'](function(_0x31adf3){return _0x1851ca['status'](0xc8)[_0x9728('0xc')](_0x31adf3);})['catch'](function(_0x43ab78){return _0x1851ca[_0x9728('0x9')](0x1f4)[_0x9728('0xc')](_0x43ab78);});};exports[_0x9728('0xd')]=function(_0xcc1fa1,_0xcd5310){var _0xc8e95d=[_0x9728('0xe')];return new BPromise(function(_0x4f812f,_0xdc0d50){return exec(util[_0x9728('0xf')](_0x9728('0x10'),_0xcc1fa1[_0x9728('0x11')][_0x9728('0x12')]),function(_0x3a6e1e,_0x249834,_0x5dae31){if(_0x3a6e1e){return _0xdc0d50(_0x3a6e1e);}return _0x4f812f(_0x249834);});})[_0x9728('0x13')](function(_0x427bb4){var _0x173231=![];var _0x497f49=_0x427bb4[_0x9728('0x14')](/\n/);for(var _0x12ad85=0x0,_0x184beb=_0xc8e95d[_0x9728('0x15')];_0x12ad85<_0x184beb,_0x173231===![];_0x12ad85+=0x1){if(_0x427bb4[_0x9728('0x16')](_0xc8e95d[_0x12ad85])>=0x0){_0x173231=!![];}}if(!_0x173231){throw new Error(util[_0x9728('0xf')](_0x9728('0x17'),_0xcc1fa1['params'][_0x9728('0x12')]));}process[_0x9728('0x18')](_0xcc1fa1[_0x9728('0x11')]['pid'],_0x9728('0x19'));return _0xcd5310['status'](0xc8)[_0x9728('0xc')]({'message':util['format'](_0x9728('0x1a'),_0xcc1fa1[_0x9728('0x11')][_0x9728('0x12')])});})['catch'](handleError(_0xcd5310,null,_0x9728('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 52a8894..bed99d0 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 _0x14a0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','destroy','exports','util','path'];(function(_0x4c2b96,_0x17ab0d){var _0x2a62bf=function(_0x6069bd){while(--_0x6069bd){_0x4c2b96['push'](_0x4c2b96['shift']());}};_0x2a62bf(++_0x17ab0d);}(_0x14a0,0x8e));var _0x014a=function(_0x3b1331,_0x4910e7){_0x3b1331=_0x3b1331-0x0;var _0x2efc54=_0x14a0[_0x3b1331];return _0x2efc54;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var auth=require(_0x014a('0x5'));var interaction=require(_0x014a('0x6'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x014a('0x7')]('/',auth[_0x014a('0x8')](),controller[_0x014a('0x9')]);router['get']('/:id',auth[_0x014a('0x8')](),controller[_0x014a('0xa')]);router[_0x014a('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x014a('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x014a('0xd'),auth['isAuthenticated'](),controller[_0x014a('0xe')]);module[_0x014a('0xf')]=router; \ No newline at end of file +var _0xbaf0=['get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./tag.controller'];(function(_0x3b8363,_0x17bc8){var _0x4d8289=function(_0x520c1d){while(--_0x520c1d){_0x3b8363['push'](_0x3b8363['shift']());}};_0x4d8289(++_0x17bc8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'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['post']('/',auth[_0x0baf('0x9')](),controller['create']);router[_0x0baf('0xd')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);module[_0x0baf('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 1b2f817..7fe85ce 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 _0xd8e1=['STRING','#0091EA','exports'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd8e1,0x11f));var _0x1d8e=function(_0x3fab74,_0x5bbebe){_0x3fab74=_0x3fab74-0x0;var _0x4e0112=_0xd8e1[_0x3fab74];return _0x4e0112;};'use strict';var Sequelize=require('sequelize');module[_0x1d8e('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x1d8e('0x1')],'defaultValue':_0x1d8e('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7ba5=['sequelize','STRING','name','#0091EA'];(function(_0x1d1653,_0x215cb5){var _0x5ed9ca=function(_0x478980){while(--_0x478980){_0x1d1653['push'](_0x1d1653['shift']());}};_0x5ed9ca(++_0x215cb5);}(_0x7ba5,0xe4));var _0x57ba=function(_0x29323b,_0x5ed75d){_0x29323b=_0x29323b-0x0;var _0x2a19e2=_0x7ba5[_0x29323b];return _0x2a19e2;};'use strict';var Sequelize=require(_0x57ba('0x0'));module['exports']={'name':{'type':Sequelize[_0x57ba('0x1')],'unique':_0x57ba('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x57ba('0x1')],'defaultValue':_0x57ba('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 946977f..6f71c42 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 _0x32f4=['nolimit','sort','filters','pick','filter','merge','where','type','key','VIRTUAL','field','options','include','rows','catch','show','params','length','includeAll','create','body','user','get','role','Tags','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','Tag','rawAttributes','model','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x32f4,0x154));var _0x432f=function(_0x16f48d,_0x183735){_0x16f48d=_0x16f48d-0x0;var _0x9603c1=_0x32f4[_0x16f48d];return _0x9603c1;};'use strict';var pdf=require(_0x432f('0x0'));var emlformat=require(_0x432f('0x1'));var rimraf=require(_0x432f('0x2'));var zipdir=require(_0x432f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x432f('0x4'));var moment=require(_0x432f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x432f('0x6'));var util=require(_0x432f('0x7'));var path=require(_0x432f('0x8'));var sox=require(_0x432f('0x9'));var csv=require(_0x432f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x432f('0xb'));var crypto=require(_0x432f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x432f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x432f('0xe'));var Papa=require(_0x432f('0xf'));var authService=require(_0x432f('0x10'));var hardwareService=require(_0x432f('0x11'));var Redis=require(_0x432f('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x432f('0x13'))('api');var utils=require(_0x432f('0x14'));var config=require('../../config/environment');var db=require(_0x432f('0x15'))['db'];function respondWithStatusCode(_0x1454d9,_0x53459c){_0x53459c=_0x53459c||0xcc;return function(_0x457389){if(_0x457389){return _0x1454d9[_0x432f('0x16')](_0x53459c);}return _0x1454d9['status'](_0x53459c)[_0x432f('0x17')]();};}function respondWithResult(_0x26aa9a,_0x5dd518){_0x5dd518=_0x5dd518||0xc8;return function(_0x48a4db){if(_0x48a4db){return _0x26aa9a[_0x432f('0x18')](_0x5dd518)[_0x432f('0x19')](_0x48a4db);}};}function respondWithFilteredResult(_0x34add6,_0x453725){return function(_0x419bfe){if(_0x419bfe){var _0x4f91c5=_0x419bfe[_0x432f('0x1a')],_0x175ba7=_0x453725['offset'],_0x2f0708=_0x453725[_0x432f('0x1b')]+_0x453725[_0x432f('0x1c')],_0x1e2c30;if(_0x2f0708>=_0x4f91c5){_0x2f0708=_0x4f91c5;_0x1e2c30=0xc8;}else{_0x1e2c30=0xce;}_0x34add6[_0x432f('0x18')](_0x1e2c30);return _0x34add6[_0x432f('0x1d')](_0x432f('0x1e'),_0x175ba7+'-'+_0x2f0708+'/'+_0x4f91c5)[_0x432f('0x19')](_0x419bfe);}return null;};}function patchUpdates(_0x5ae24e){return function(_0x2d2c86){try{jsonpatch['apply'](_0x2d2c86,_0x5ae24e,!![]);}catch(_0x3d545d){return BPromise[_0x432f('0x1f')](_0x3d545d);}return _0x2d2c86[_0x432f('0x20')]();};}function saveUpdates(_0x391fd8,_0x1debda){return function(_0xf1f5d){if(_0xf1f5d){return _0xf1f5d[_0x432f('0x21')](_0x391fd8)[_0x432f('0x22')](function(_0x693eb3){return _0x693eb3;});}return null;};}function removeEntity(_0xf5b60c,_0x40176d){return function(_0x3446fd){if(_0x3446fd){return _0x3446fd['destroy']()['then'](function(){var _0x343d13=_0x3446fd['get']({'plain':!![]});var _0x28968e='Tags';return db[_0x432f('0x23')][_0x432f('0x24')]({'where':{'type':_0x28968e,'resourceId':_0x343d13['id']}})[_0x432f('0x22')](function(){return _0x3446fd;});})[_0x432f('0x22')](function(){_0xf5b60c[_0x432f('0x18')](0xcc)[_0x432f('0x17')]();});}};}function handleEntityNotFound(_0x59f352,_0x252b3b){return function(_0x33edec){if(!_0x33edec){_0x59f352['sendStatus'](0x194);}return _0x33edec;};}function handleError(_0x2cbde9,_0x3e37ec){_0x3e37ec=_0x3e37ec||0x1f4;return function(_0x2bcbb4){logger[_0x432f('0x25')](_0x2bcbb4[_0x432f('0x26')]);if(_0x2bcbb4[_0x432f('0x27')]){delete _0x2bcbb4[_0x432f('0x27')];}_0x2cbde9['status'](_0x3e37ec)[_0x432f('0x28')](_0x2bcbb4);};}exports['index']=function(_0x1f1fdd,_0x573cc5){var _0x20404d={},_0x5a2c14={},_0x3f768b={'count':0x0,'rows':[]};var _0x489ba6=db[_0x432f('0x29')][_0x432f('0x2a')];_0x5a2c14[_0x432f('0x2b')]=_['keys'](_0x489ba6);_0x5a2c14[_0x432f('0x2c')]=_[_0x432f('0x2d')](_0x1f1fdd['query']);_0x5a2c14['filters']=_[_0x432f('0x2e')](_0x5a2c14[_0x432f('0x2b')],_0x5a2c14[_0x432f('0x2c')]);_0x20404d[_0x432f('0x2f')]=_[_0x432f('0x2e')](_0x5a2c14[_0x432f('0x2b')],qs['fields'](_0x1f1fdd['query'][_0x432f('0x30')]));_0x20404d[_0x432f('0x2f')]=_0x20404d[_0x432f('0x2f')]['length']?_0x20404d[_0x432f('0x2f')]:_0x5a2c14[_0x432f('0x2b')];if(!_0x1f1fdd[_0x432f('0x2c')][_0x432f('0x31')](_0x432f('0x32'))){_0x20404d[_0x432f('0x1c')]=qs[_0x432f('0x1c')](_0x1f1fdd[_0x432f('0x2c')]['limit']);_0x20404d['offset']=qs[_0x432f('0x1b')](_0x1f1fdd[_0x432f('0x2c')]['offset']);}_0x20404d['order']=qs['sort'](_0x1f1fdd[_0x432f('0x2c')][_0x432f('0x33')]);_0x20404d['where']=qs[_0x432f('0x34')](_[_0x432f('0x35')](_0x1f1fdd[_0x432f('0x2c')],_0x5a2c14['filters']));if(_0x1f1fdd[_0x432f('0x2c')][_0x432f('0x36')]){_0x20404d['where']=_[_0x432f('0x37')](_0x20404d[_0x432f('0x38')],{'$or':_['map'](_0x489ba6,function(_0x28da2e){if(_0x28da2e[_0x432f('0x39')][_0x432f('0x3a')]!==_0x432f('0x3b')){var _0x4190c7={};_0x4190c7[_0x28da2e[_0x432f('0x3c')]]={'$like':'%'+_0x1f1fdd[_0x432f('0x2c')][_0x432f('0x36')]+'%'};return _0x4190c7;}})});}_0x20404d=_[_0x432f('0x37')]({},_0x20404d,_0x1f1fdd[_0x432f('0x3d')]);var _0xbb7bee={'where':_0x20404d['where']};return db[_0x432f('0x29')]['count'](_0xbb7bee)[_0x432f('0x22')](function(_0x3e8a0a){_0x3f768b['count']=_0x3e8a0a;if(_0x1f1fdd[_0x432f('0x2c')]['includeAll']){_0x20404d[_0x432f('0x3e')]=[{'all':!![]}];}return db[_0x432f('0x29')]['findAll'](_0x20404d);})['then'](function(_0xbd4240){_0x3f768b[_0x432f('0x3f')]=_0xbd4240;return _0x3f768b;})[_0x432f('0x22')](respondWithFilteredResult(_0x573cc5,_0x20404d))[_0x432f('0x40')](handleError(_0x573cc5,null));};exports[_0x432f('0x41')]=function(_0x513a57,_0x5dade1){var _0x53516d={'raw':!![],'where':{'id':_0x513a57[_0x432f('0x42')]['id']}},_0x1ceec7={};_0x1ceec7['model']=_[_0x432f('0x2d')](db[_0x432f('0x29')][_0x432f('0x2a')]);_0x1ceec7[_0x432f('0x2c')]=_[_0x432f('0x2d')](_0x513a57[_0x432f('0x2c')]);_0x1ceec7[_0x432f('0x34')]=_[_0x432f('0x2e')](_0x1ceec7[_0x432f('0x2b')],_0x1ceec7['query']);_0x53516d[_0x432f('0x2f')]=_[_0x432f('0x2e')](_0x1ceec7['model'],qs[_0x432f('0x30')](_0x513a57[_0x432f('0x2c')][_0x432f('0x30')]));_0x53516d[_0x432f('0x2f')]=_0x53516d[_0x432f('0x2f')][_0x432f('0x43')]?_0x53516d[_0x432f('0x2f')]:_0x1ceec7[_0x432f('0x2b')];if(_0x513a57[_0x432f('0x2c')][_0x432f('0x44')]){_0x53516d[_0x432f('0x3e')]=[{'all':!![]}];}_0x53516d=_[_0x432f('0x37')]({},_0x53516d,_0x513a57[_0x432f('0x3d')]);return db[_0x432f('0x29')]['find'](_0x53516d)['then'](handleEntityNotFound(_0x5dade1,null))[_0x432f('0x22')](respondWithResult(_0x5dade1,null))[_0x432f('0x40')](handleError(_0x5dade1,null));};exports[_0x432f('0x45')]=function(_0x4130cd,_0x12fd92){return db['Tag'][_0x432f('0x45')](_0x4130cd[_0x432f('0x46')],{})[_0x432f('0x22')](function(_0x2f88d6){var _0x322f34=_0x4130cd[_0x432f('0x47')][_0x432f('0x48')]({'plain':!![]});if(!_0x322f34)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x322f34[_0x432f('0x49')]===_0x432f('0x47')){var _0x359853=_0x2f88d6['get']({'plain':!![]});var _0x2c023d=_0x432f('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x2c023d,'userProfileId':_0x322f34[_0x432f('0x4b')]},'raw':!![]})[_0x432f('0x22')](function(_0x4a6d37){if(_0x4a6d37&&_0x4a6d37['autoAssociation']===0x0){return db[_0x432f('0x23')]['create']({'name':_0x359853[_0x432f('0x27')],'resourceId':_0x359853['id'],'type':_0x4a6d37[_0x432f('0x27')],'sectionId':_0x4a6d37['id']},{})['then'](function(){return _0x2f88d6;});}else{return _0x2f88d6;}})[_0x432f('0x40')](function(_0x560b3c){logger[_0x432f('0x25')](_0x432f('0x4c'),_0x560b3c);throw _0x560b3c;});}return _0x2f88d6;})[_0x432f('0x22')](respondWithResult(_0x12fd92,0xc9))[_0x432f('0x40')](handleError(_0x12fd92,null));};exports[_0x432f('0x21')]=function(_0x2a4d36,_0x56f526){if(_0x2a4d36[_0x432f('0x46')]['id']){delete _0x2a4d36['body']['id'];}return db[_0x432f('0x29')][_0x432f('0x4d')]({'where':{'id':_0x2a4d36[_0x432f('0x42')]['id']}})[_0x432f('0x22')](handleEntityNotFound(_0x56f526,null))['then'](saveUpdates(_0x2a4d36[_0x432f('0x46')],null))[_0x432f('0x22')](respondWithResult(_0x56f526,null))[_0x432f('0x40')](handleError(_0x56f526,null));};exports[_0x432f('0x24')]=function(_0x13aced,_0x2a26bd){return db[_0x432f('0x29')]['find']({'where':{'id':_0x13aced['params']['id']}})[_0x432f('0x22')](handleEntityNotFound(_0x2a26bd,null))[_0x432f('0x22')](removeEntity(_0x2a26bd,null))[_0x432f('0x40')](handleError(_0x2a26bd,null));}; \ No newline at end of file +var _0x160f=['where','pick','filters','filter','map','type','key','VIRTUAL','field','merge','options','Tag','includeAll','include','findAll','rows','catch','show','params','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort'];(function(_0x43371b,_0x1cb4cf){var _0x19cd26=function(_0x5f43bf){while(--_0x5f43bf){_0x43371b['push'](_0x43371b['shift']());}};_0x19cd26(++_0x1cb4cf);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf160('0x0'));var emlformat=require(_0xf160('0x1'));var rimraf=require(_0xf160('0x2'));var zipdir=require(_0xf160('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf160('0x4'));var moment=require(_0xf160('0x5'));var BPromise=require(_0xf160('0x6'));var Mustache=require(_0xf160('0x7'));var util=require(_0xf160('0x8'));var path=require(_0xf160('0x9'));var sox=require('sox');var csv=require(_0xf160('0xa'));var ejs=require(_0xf160('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var authService=require(_0xf160('0xf'));var hardwareService=require(_0xf160('0x10'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xf160('0x11'))(_0xf160('0x12'));var utils=require(_0xf160('0x13'));var config=require('../../config/environment');var db=require(_0xf160('0x14'))['db'];function respondWithStatusCode(_0x653d78,_0x25866c){_0x25866c=_0x25866c||0xcc;return function(_0x3b09ea){if(_0x3b09ea){return _0x653d78[_0xf160('0x15')](_0x25866c);}return _0x653d78['status'](_0x25866c)[_0xf160('0x16')]();};}function respondWithResult(_0x4f7cfe,_0x1496b6){_0x1496b6=_0x1496b6||0xc8;return function(_0x26951a){if(_0x26951a){return _0x4f7cfe[_0xf160('0x17')](_0x1496b6)[_0xf160('0x18')](_0x26951a);}};}function respondWithFilteredResult(_0x3a4faa,_0x31f7ae){return function(_0x2643ba){if(_0x2643ba){var _0x172337=_0x2643ba[_0xf160('0x19')],_0x1396ba=_0x31f7ae[_0xf160('0x1a')],_0x59ac02=_0x31f7ae[_0xf160('0x1a')]+_0x31f7ae['limit'],_0x477e4d;if(_0x59ac02>=_0x172337){_0x59ac02=_0x172337;_0x477e4d=0xc8;}else{_0x477e4d=0xce;}_0x3a4faa[_0xf160('0x17')](_0x477e4d);return _0x3a4faa['set'](_0xf160('0x1b'),_0x1396ba+'-'+_0x59ac02+'/'+_0x172337)[_0xf160('0x18')](_0x2643ba);}return null;};}function patchUpdates(_0x1e0c78){return function(_0x1e09f3){try{jsonpatch[_0xf160('0x1c')](_0x1e09f3,_0x1e0c78,!![]);}catch(_0x205afa){return BPromise[_0xf160('0x1d')](_0x205afa);}return _0x1e09f3[_0xf160('0x1e')]();};}function saveUpdates(_0x1fdb38,_0x4a58d9){return function(_0x40ccf0){if(_0x40ccf0){return _0x40ccf0[_0xf160('0x1f')](_0x1fdb38)[_0xf160('0x20')](function(_0x5ad173){return _0x5ad173;});}return null;};}function removeEntity(_0x435572,_0xff0491){return function(_0x454e63){if(_0x454e63){return _0x454e63[_0xf160('0x21')]()[_0xf160('0x20')](function(){var _0x1b0081=_0x454e63[_0xf160('0x22')]({'plain':!![]});var _0x5a72d1=_0xf160('0x23');return db[_0xf160('0x24')][_0xf160('0x21')]({'where':{'type':_0x5a72d1,'resourceId':_0x1b0081['id']}})[_0xf160('0x20')](function(){return _0x454e63;});})['then'](function(){_0x435572[_0xf160('0x17')](0xcc)[_0xf160('0x16')]();});}};}function handleEntityNotFound(_0x4a8003,_0x487c0c){return function(_0x168a09){if(!_0x168a09){_0x4a8003[_0xf160('0x15')](0x194);}return _0x168a09;};}function handleError(_0x39c0e3,_0x4c0c51){_0x4c0c51=_0x4c0c51||0x1f4;return function(_0xcfa9bd){logger[_0xf160('0x25')](_0xcfa9bd[_0xf160('0x26')]);if(_0xcfa9bd[_0xf160('0x27')]){delete _0xcfa9bd[_0xf160('0x27')];}_0x39c0e3[_0xf160('0x17')](_0x4c0c51)['send'](_0xcfa9bd);};}exports['index']=function(_0x48145e,_0x26e7b9){var _0x16a5fa={},_0xcaab39={},_0x26e06b={'count':0x0,'rows':[]};var _0x399cce=db['Tag']['rawAttributes'];_0xcaab39[_0xf160('0x28')]=_['keys'](_0x399cce);_0xcaab39['query']=_[_0xf160('0x29')](_0x48145e[_0xf160('0x2a')]);_0xcaab39['filters']=_[_0xf160('0x2b')](_0xcaab39[_0xf160('0x28')],_0xcaab39['query']);_0x16a5fa['attributes']=_['intersection'](_0xcaab39['model'],qs[_0xf160('0x2c')](_0x48145e[_0xf160('0x2a')][_0xf160('0x2c')]));_0x16a5fa[_0xf160('0x2d')]=_0x16a5fa[_0xf160('0x2d')][_0xf160('0x2e')]?_0x16a5fa['attributes']:_0xcaab39['model'];if(!_0x48145e['query'][_0xf160('0x2f')]('nolimit')){_0x16a5fa['limit']=qs[_0xf160('0x30')](_0x48145e[_0xf160('0x2a')]['limit']);_0x16a5fa[_0xf160('0x1a')]=qs[_0xf160('0x1a')](_0x48145e[_0xf160('0x2a')][_0xf160('0x1a')]);}_0x16a5fa[_0xf160('0x31')]=qs['sort'](_0x48145e[_0xf160('0x2a')][_0xf160('0x32')]);_0x16a5fa[_0xf160('0x33')]=qs['filters'](_[_0xf160('0x34')](_0x48145e[_0xf160('0x2a')],_0xcaab39[_0xf160('0x35')]));if(_0x48145e[_0xf160('0x2a')][_0xf160('0x36')]){_0x16a5fa[_0xf160('0x33')]=_['merge'](_0x16a5fa['where'],{'$or':_[_0xf160('0x37')](_0x399cce,function(_0x21c248){if(_0x21c248[_0xf160('0x38')][_0xf160('0x39')]!==_0xf160('0x3a')){var _0x24d668={};_0x24d668[_0x21c248[_0xf160('0x3b')]]={'$like':'%'+_0x48145e[_0xf160('0x2a')][_0xf160('0x36')]+'%'};return _0x24d668;}})});}_0x16a5fa=_[_0xf160('0x3c')]({},_0x16a5fa,_0x48145e[_0xf160('0x3d')]);var _0x275bd0={'where':_0x16a5fa[_0xf160('0x33')]};return db[_0xf160('0x3e')][_0xf160('0x19')](_0x275bd0)[_0xf160('0x20')](function(_0x161f06){_0x26e06b[_0xf160('0x19')]=_0x161f06;if(_0x48145e[_0xf160('0x2a')][_0xf160('0x3f')]){_0x16a5fa[_0xf160('0x40')]=[{'all':!![]}];}return db[_0xf160('0x3e')][_0xf160('0x41')](_0x16a5fa);})[_0xf160('0x20')](function(_0x494d76){_0x26e06b[_0xf160('0x42')]=_0x494d76;return _0x26e06b;})[_0xf160('0x20')](respondWithFilteredResult(_0x26e7b9,_0x16a5fa))[_0xf160('0x43')](handleError(_0x26e7b9,null));};exports[_0xf160('0x44')]=function(_0x3d273d,_0xed8784){var _0xcc3263={'raw':!![],'where':{'id':_0x3d273d[_0xf160('0x45')]['id']}},_0x4f65c9={};_0x4f65c9['model']=_[_0xf160('0x29')](db[_0xf160('0x3e')]['rawAttributes']);_0x4f65c9[_0xf160('0x2a')]=_[_0xf160('0x29')](_0x3d273d[_0xf160('0x2a')]);_0x4f65c9[_0xf160('0x35')]=_[_0xf160('0x2b')](_0x4f65c9[_0xf160('0x28')],_0x4f65c9[_0xf160('0x2a')]);_0xcc3263['attributes']=_[_0xf160('0x2b')](_0x4f65c9[_0xf160('0x28')],qs[_0xf160('0x2c')](_0x3d273d[_0xf160('0x2a')][_0xf160('0x2c')]));_0xcc3263[_0xf160('0x2d')]=_0xcc3263[_0xf160('0x2d')][_0xf160('0x2e')]?_0xcc3263[_0xf160('0x2d')]:_0x4f65c9[_0xf160('0x28')];if(_0x3d273d[_0xf160('0x2a')]['includeAll']){_0xcc3263['include']=[{'all':!![]}];}_0xcc3263=_[_0xf160('0x3c')]({},_0xcc3263,_0x3d273d[_0xf160('0x3d')]);return db[_0xf160('0x3e')][_0xf160('0x46')](_0xcc3263)[_0xf160('0x20')](handleEntityNotFound(_0xed8784,null))[_0xf160('0x20')](respondWithResult(_0xed8784,null))['catch'](handleError(_0xed8784,null));};exports[_0xf160('0x47')]=function(_0x5abc6a,_0x55ab52){return db[_0xf160('0x3e')][_0xf160('0x47')](_0x5abc6a['body'],{})['then'](function(_0x2f1648){var _0x2681f2=_0x5abc6a[_0xf160('0x48')][_0xf160('0x22')]({'plain':!![]});if(!_0x2681f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2681f2['role']==='user'){var _0x50a97d=_0x2f1648[_0xf160('0x22')]({'plain':!![]});var _0x57f5a9=_0xf160('0x23');return db[_0xf160('0x49')][_0xf160('0x46')]({'where':{'name':_0x57f5a9,'userProfileId':_0x2681f2[_0xf160('0x4a')]},'raw':!![]})['then'](function(_0x45af83){if(_0x45af83&&_0x45af83[_0xf160('0x4b')]===0x0){return db[_0xf160('0x24')]['create']({'name':_0x50a97d[_0xf160('0x27')],'resourceId':_0x50a97d['id'],'type':_0x45af83[_0xf160('0x27')],'sectionId':_0x45af83['id']},{})[_0xf160('0x20')](function(){return _0x2f1648;});}else{return _0x2f1648;}})['catch'](function(_0x2dba32){logger[_0xf160('0x25')](_0xf160('0x4c'),_0x2dba32);throw _0x2dba32;});}return _0x2f1648;})[_0xf160('0x20')](respondWithResult(_0x55ab52,0xc9))[_0xf160('0x43')](handleError(_0x55ab52,null));};exports['update']=function(_0x4c90ab,_0x3c8765){if(_0x4c90ab['body']['id']){delete _0x4c90ab[_0xf160('0x4d')]['id'];}return db[_0xf160('0x3e')]['find']({'where':{'id':_0x4c90ab['params']['id']}})[_0xf160('0x20')](handleEntityNotFound(_0x3c8765,null))[_0xf160('0x20')](saveUpdates(_0x4c90ab['body'],null))[_0xf160('0x20')](respondWithResult(_0x3c8765,null))[_0xf160('0x43')](handleError(_0x3c8765,null));};exports[_0xf160('0x21')]=function(_0x405d7e,_0x5f3ded){return db[_0xf160('0x3e')]['find']({'where':{'id':_0x405d7e[_0xf160('0x45')]['id']}})[_0xf160('0x20')](handleEntityNotFound(_0x5f3ded,null))[_0xf160('0x20')](removeEntity(_0x5f3ded,null))[_0xf160('0x43')](handleError(_0x5f3ded,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index bcdfd9b..aecbaf2 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 _0x794f=['Tag','tools_tags','../../config/logger','api','moment','bluebird','./tag.attributes','exports'];(function(_0x47047e,_0x32b892){var _0x29160b=function(_0x28b37a){while(--_0x28b37a){_0x47047e['push'](_0x47047e['shift']());}};_0x29160b(++_0x32b892);}(_0x794f,0x17a));var _0xf794=function(_0x3b9cbd,_0x4f8ed2){_0x3b9cbd=_0x3b9cbd-0x0;var _0x5e7946=_0x794f[_0x3b9cbd];return _0x5e7946;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf794('0x0'))(_0xf794('0x1'));var moment=require(_0xf794('0x2'));var BPromise=require(_0xf794('0x3'));var rp=require('request-promise');var attributes=require(_0xf794('0x4'));module[_0xf794('0x5')]=function(_0x5ef656,_0x2e16c3){return _0x5ef656['define'](_0xf794('0x6'),attributes,{'tableName':_0xf794('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfce=['./tag.attributes','Tag','tools_tags','api','moment','request-promise'];(function(_0x31c981,_0x18c6c0){var _0x44c461=function(_0xd0f6c2){while(--_0xd0f6c2){_0x31c981['push'](_0x31c981['shift']());}};_0x44c461(++_0x18c6c0);}(_0xbfce,0xe7));var _0xebfc=function(_0x4c062d,_0x13d802){_0x4c062d=_0x4c062d-0x0;var _0x30dcff=_0xbfce[_0x4c062d];return _0x30dcff;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xebfc('0x0'));var moment=require(_0xebfc('0x1'));var BPromise=require('bluebird');var rp=require(_0xebfc('0x2'));var attributes=require(_0xebfc('0x3'));module['exports']=function(_0x5807f5,_0x39ec31){return _0x5807f5['define'](_0xebfc('0x4'),attributes,{'tableName':_0xebfc('0x5'),'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 52364cd..59fc31e 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 _0xd86a=['stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x306e2d,_0x25c95b){var _0x36c3ac=function(_0x2348ef){while(--_0x2348ef){_0x306e2d['push'](_0x306e2d['shift']());}};_0x36c3ac(++_0x25c95b);}(_0xd86a,0x1ce));var _0xad86=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0xd86a[_0xb833b1];return _0x1ab87a;};'use strict';var _=require('lodash');var util=require(_0xad86('0x0'));var moment=require(_0xad86('0x1'));var BPromise=require(_0xad86('0x2'));var rs=require(_0xad86('0x3'));var fs=require('fs');var Redis=require(_0xad86('0x4'));var db=require(_0xad86('0x5'))['db'];var utils=require(_0xad86('0x6'));var logger=require(_0xad86('0x7'))('rpc');var config=require(_0xad86('0x8'));var jayson=require(_0xad86('0x9'));var client=jayson[_0xad86('0xa')][_0xad86('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x502999,_0x33cf04,_0x36a88c){return new BPromise(function(_0x8d3570,_0x582a77){return client[_0xad86('0xc')](_0x502999,_0x36a88c)[_0xad86('0xd')](function(_0x25f404){logger['info'](_0xad86('0xe'),_0x33cf04,'request\x20sent');logger[_0xad86('0xf')](_0xad86('0x10'),_0x33cf04,_0xad86('0x11'),JSON[_0xad86('0x12')](_0x25f404));if(_0x25f404[_0xad86('0x13')]){if(_0x25f404[_0xad86('0x13')]['code']===0x1f4){logger[_0xad86('0x13')](_0xad86('0xe'),_0x33cf04,_0x25f404['error'][_0xad86('0x14')]);return _0x582a77(_0x25f404[_0xad86('0x13')][_0xad86('0x14')]);}logger['error'](_0xad86('0xe'),_0x33cf04,_0x25f404[_0xad86('0x13')][_0xad86('0x14')]);return _0x8d3570(_0x25f404[_0xad86('0x13')][_0xad86('0x14')]);}else{logger[_0xad86('0x15')](_0xad86('0xe'),_0x33cf04,_0xad86('0x11'));_0x8d3570(_0x25f404[_0xad86('0x16')][_0xad86('0x14')]);}})[_0xad86('0x17')](function(_0x4c52a3){logger[_0xad86('0x13')]('Tag,\x20%s,\x20%s',_0x33cf04,_0x4c52a3);_0x582a77(_0x4c52a3);});});} \ No newline at end of file +var _0xe533=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x5e3ff7,_0x552770){var _0x5815c8=function(_0xacf204){while(--_0xacf204){_0x5e3ff7['push'](_0x5e3ff7['shift']());}};_0x5815c8(++_0x552770);}(_0xe533,0x8f));var _0x3e53=function(_0x558d7d,_0x4eb721){_0x558d7d=_0x558d7d-0x0;var _0x49d96f=_0xe533[_0x558d7d];return _0x49d96f;};'use strict';var _=require(_0x3e53('0x0'));var util=require(_0x3e53('0x1'));var moment=require('moment');var BPromise=require(_0x3e53('0x2'));var rs=require(_0x3e53('0x3'));var fs=require('fs');var Redis=require(_0x3e53('0x4'));var db=require(_0x3e53('0x5'))['db'];var utils=require(_0x3e53('0x6'));var logger=require(_0x3e53('0x7'))(_0x3e53('0x8'));var config=require(_0x3e53('0x9'));var jayson=require(_0x3e53('0xa'));var client=jayson['client'][_0x3e53('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x518685,_0x191869,_0x4eee3d){return new BPromise(function(_0x16fd28,_0xed4170){return client[_0x3e53('0xc')](_0x518685,_0x4eee3d)[_0x3e53('0xd')](function(_0x4a3ca1){logger[_0x3e53('0xe')](_0x3e53('0xf'),_0x191869,_0x3e53('0x10'));logger[_0x3e53('0x11')](_0x3e53('0x12'),_0x191869,_0x3e53('0x10'),JSON[_0x3e53('0x13')](_0x4a3ca1));if(_0x4a3ca1['error']){if(_0x4a3ca1[_0x3e53('0x14')][_0x3e53('0x15')]===0x1f4){logger[_0x3e53('0x14')](_0x3e53('0xf'),_0x191869,_0x4a3ca1[_0x3e53('0x14')][_0x3e53('0x16')]);return _0xed4170(_0x4a3ca1[_0x3e53('0x14')][_0x3e53('0x16')]);}logger['error'](_0x3e53('0xf'),_0x191869,_0x4a3ca1[_0x3e53('0x14')]['message']);return _0x16fd28(_0x4a3ca1[_0x3e53('0x14')][_0x3e53('0x16')]);}else{logger[_0x3e53('0xe')](_0x3e53('0xf'),_0x191869,_0x3e53('0x10'));_0x16fd28(_0x4a3ca1['result']['message']);}})[_0x3e53('0x17')](function(_0x473eab){logger[_0x3e53('0x14')](_0x3e53('0xf'),_0x191869,_0x473eab);_0xed4170(_0x473eab);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 442f96e..24a636c 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 _0x65da=['./team.controller','get','isAuthenticated','index','/:id','show','getQueues','getAgents','post','create','/:id/queues','addQueues','/:id/users','addAgents','put','destroy','delete','removeQueues','removeAgents','exports','path','connect-timeout','../../components/interaction/service','../../config/environment'];(function(_0x58d820,_0x41f53e){var _0xb24372=function(_0x1f25a3){while(--_0x1f25a3){_0x58d820['push'](_0x58d820['shift']());}};_0xb24372(++_0x41f53e);}(_0x65da,0x1ac));var _0xa65d=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x65da[_0x5cb1af];return _0x8d7940;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa65d('0x0'));var timeout=require(_0xa65d('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa65d('0x2'));var config=require(_0xa65d('0x3'));var controller=require(_0xa65d('0x4'));router[_0xa65d('0x5')]('/',auth[_0xa65d('0x6')](),controller[_0xa65d('0x7')]);router[_0xa65d('0x5')](_0xa65d('0x8'),auth[_0xa65d('0x6')](),controller[_0xa65d('0x9')]);router[_0xa65d('0x5')]('/:id/queues',auth['isAuthenticated'](),controller[_0xa65d('0xa')]);router[_0xa65d('0x5')]('/:id/users',auth[_0xa65d('0x6')](),controller[_0xa65d('0xb')]);router[_0xa65d('0xc')]('/',auth['isAuthenticated'](),controller[_0xa65d('0xd')]);router[_0xa65d('0xc')](_0xa65d('0xe'),auth[_0xa65d('0x6')](),controller[_0xa65d('0xf')]);router[_0xa65d('0xc')](_0xa65d('0x10'),auth[_0xa65d('0x6')](),controller[_0xa65d('0x11')]);router[_0xa65d('0x12')](_0xa65d('0x8'),auth[_0xa65d('0x6')](),controller['update']);router['delete'](_0xa65d('0x8'),auth[_0xa65d('0x6')](),controller[_0xa65d('0x13')]);router[_0xa65d('0x14')](_0xa65d('0xe'),auth[_0xa65d('0x6')](),controller[_0xa65d('0x15')]);router['delete'](_0xa65d('0x10'),auth['isAuthenticated'](),controller[_0xa65d('0x16')]);module[_0xa65d('0x17')]=router; \ No newline at end of file +var _0x8616=['update','delete','/:id','destroy','removeQueues','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','put'];(function(_0x4ce2b5,_0x1248d1){var _0x389c65=function(_0x16698e){while(--_0x16698e){_0x4ce2b5['push'](_0x4ce2b5['shift']());}};_0x389c65(++_0x1248d1);}(_0x8616,0x165));var _0x6861=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x8616[_0x496333];return _0x44256e;};'use strict';var multer=require(_0x6861('0x0'));var util=require(_0x6861('0x1'));var path=require(_0x6861('0x2'));var timeout=require(_0x6861('0x3'));var express=require('express');var router=express[_0x6861('0x4')]();var auth=require(_0x6861('0x5'));var interaction=require(_0x6861('0x6'));var config=require(_0x6861('0x7'));var controller=require('./team.controller');router[_0x6861('0x8')]('/',auth[_0x6861('0x9')](),controller[_0x6861('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6861('0xb')]);router[_0x6861('0x8')](_0x6861('0xc'),auth[_0x6861('0x9')](),controller[_0x6861('0xd')]);router['get'](_0x6861('0xe'),auth['isAuthenticated'](),controller[_0x6861('0xf')]);router[_0x6861('0x10')]('/',auth[_0x6861('0x9')](),controller[_0x6861('0x11')]);router['post'](_0x6861('0xc'),auth[_0x6861('0x9')](),controller[_0x6861('0x12')]);router['post'](_0x6861('0xe'),auth['isAuthenticated'](),controller[_0x6861('0x13')]);router[_0x6861('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x6861('0x15')]);router[_0x6861('0x16')](_0x6861('0x17'),auth[_0x6861('0x9')](),controller[_0x6861('0x18')]);router[_0x6861('0x16')]('/:id/queues',auth['isAuthenticated'](),controller[_0x6861('0x19')]);router[_0x6861('0x16')](_0x6861('0xe'),auth['isAuthenticated'](),controller[_0x6861('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 9154712..2ab46a9 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 _0x3023=['sequelize','exports','STRING'];(function(_0x17482c,_0x5c9016){var _0xaa8e60=function(_0x1fcf18){while(--_0x1fcf18){_0x17482c['push'](_0x17482c['shift']());}};_0xaa8e60(++_0x5c9016);}(_0x3023,0x1ec));var _0x3302=function(_0x5fd049,_0x2faf00){_0x5fd049=_0x5fd049-0x0;var _0x4b91f4=_0x3023[_0x5fd049];return _0x4b91f4;};'use strict';var Sequelize=require(_0x3302('0x0'));module[_0x3302('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x3302('0x2')]}}; \ No newline at end of file +var _0xc368=['sequelize','exports','name','STRING'];(function(_0xe1885b,_0x1f3ad7){var _0x3d2ab9=function(_0x43139c){while(--_0x43139c){_0xe1885b['push'](_0xe1885b['shift']());}};_0x3d2ab9(++_0x1f3ad7);}(_0xc368,0xd8));var _0x8c36=function(_0x23adca,_0x2d2e9d){_0x23adca=_0x23adca-0x0;var _0x477ddb=_0xc368[_0x23adca];return _0x477ddb;};'use strict';var Sequelize=require(_0x8c36('0x0'));module[_0x8c36('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8c36('0x2')},'description':{'type':Sequelize[_0x8c36('0x3')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index c867cc3..e921566 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 _0xa9e0=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','isValidChannel','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','addQueues','findOne','add','ids','removeQueues','remove','voice','chat','mail','sms','fax','openchannel','each','addAgents','User','findAll','loginInPause','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','omit','spread','userTeam:save','removeAgents','isArray','emit','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','Team','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./team.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='Teams';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['Team'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['Team'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931,_0x5ce9ac){return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x49c095[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](function(_0x5df0ad){if(!_0x49c095[_0x0a9e('0x2e')]['channel']||!utils[_0x0a9e('0x50')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}var _0xd10662={};var _0x28d814={};_0x28d814['model']=_[_0x0a9e('0x2d')](db[_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+_0x0a9e('0x57')]['rawAttributes']);_0x28d814[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x49c095['query']);_0x28d814[_0x0a9e('0x36')]=_['intersection'](_0x28d814[_0x0a9e('0x2c')],_0x28d814['query']);_0xd10662['attributes']=_['intersection'](_0x28d814[_0x0a9e('0x2c')],qs['fields'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0xd10662[_0x0a9e('0x30')]=_0xd10662[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0xd10662[_0x0a9e('0x30')]:_0x28d814['model'];_0xd10662[_0x0a9e('0x1d')]=qs['limit'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0xd10662[_0x0a9e('0x1c')]=qs['offset'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);_0xd10662[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x49c095['query'][_0x0a9e('0x35')]);_0xd10662[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x58')](_0x49c095[_0x0a9e('0x2e')],_0x28d814[_0x0a9e('0x36')]));_0xd10662=_[_0x0a9e('0x38')]({},_0xd10662,_0x49c095[_0x0a9e('0x3e')]);return _0x5df0ad['get'+_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')]['toLowerCase']())+_0x0a9e('0x59')](_0xd10662);})['then'](respondWithResult(_0x145931,null))['catch'](handleError(_0x145931,null));};exports[_0x0a9e('0x5a')]=function(_0x4556c5,_0x9375fb,_0x19c995){return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0x4556c5[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){if(!_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x2d7205[_0x0a9e('0x5c')+_['capitalize'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+'Queues'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x5d')]);}return null;})['then'](handleEntityNotFound(_0x9375fb,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x9375fb,null))[_0x0a9e('0x42')](handleError(_0x9375fb,null));};exports[_0x0a9e('0x5e')]=function(_0x427946,_0x13b5c0,_0x4a43a8){return db['Team']['findOne']({'where':{'id':_0x427946[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x1104ad){if(_0x1104ad){if(!_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db['Sequelize'][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x1104ad[_0x0a9e('0x5f')+_['capitalize'](_0x427946[_0x0a9e('0x2e')]['channel'][_0x0a9e('0x56')]())+_0x0a9e('0x59')](_0x427946['query'][_0x0a9e('0x5d')]);}return null;})[_0x0a9e('0x23')](handleEntityNotFound(_0x13b5c0,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x13b5c0,null))[_0x0a9e('0x42')](handleError(_0x13b5c0,null));};exports['addAgents']=function(_0x1d442c,_0x2e9552,_0x371533){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x1d442c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2e9552,null))[_0x0a9e('0x23')](function(_0x361b21){if(_0x361b21){return BPromise['each']([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x40fc56){return _0x361b21[_0x0a9e('0x25')+_[_0x0a9e('0x55')](_0x40fc56)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x25744a){return BPromise[_0x0a9e('0x66')](_0x25744a,function(_0x5b35db){return _0x5b35db[_0x0a9e('0x67')](_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')])['then'](function(){if(_0x40fc56===_0x0a9e('0x60')){return db[_0x0a9e('0x68')][_0x0a9e('0x69')]({'where':{'id':_0x1d442c[_0x0a9e('0x47')]['ids']},'attributes':['id','name',_0x0a9e('0x6a'),_0x0a9e('0x6b'),'interface'],'raw':!![]});}})[_0x0a9e('0x23')](function(_0x53a6a1){if(_0x40fc56===_0x0a9e('0x60')){return BPromise[_0x0a9e('0x66')](_0x53a6a1,function(_0x5637a1){return db[_0x0a9e('0x6c')][_0x0a9e('0x6d')]({'membername':_0x5637a1[_0x0a9e('0x28')],'UserId':_0x5637a1['id'],'queue_name':_0x5b35db[_0x0a9e('0x28')],'VoiceQueueId':_0x5b35db['id'],'interface':_[_0x0a9e('0x6e')](_0x5637a1[_0x0a9e('0x6f')])?util[_0x0a9e('0x70')]('SIP/%s',_0x5637a1[_0x0a9e('0x28')]):_0x5637a1[_0x0a9e('0x6f')],'paused':_0x5637a1[_0x0a9e('0x6b')]||![],'penalty':0x0});});}});});})[_0x0a9e('0x23')](function(){return _0x361b21;});})['then'](function(){return _0x361b21;});}})[_0x0a9e('0x23')](function(_0xf0db1){if(_0xf0db1){return _0xf0db1['addAgents'](_0x1d442c[_0x0a9e('0x47')]['ids'],_[_0x0a9e('0x71')](_0x1d442c[_0x0a9e('0x47')],[_0x0a9e('0x5d'),'id'])||{})[_0x0a9e('0x72')](function(_0x5af453){for(var _0x51ccd7=0x0;_0x51ccd7<_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x51ccd7+=0x1){socket['emit'](_0x0a9e('0x73'),{'UserId':_0x1d442c[_0x0a9e('0x47')]['ids'][_0x51ccd7],'TeamId':_0x1d442c['params']['id']});}return _0x5af453;});}})[_0x0a9e('0x23')](respondWithResult(_0x2e9552,null))['catch'](handleError(_0x2e9552,null));};exports['removeAgents']=function(_0x4dc6b3,_0x81d748,_0xf3601c){var _0x9044fe;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4dc6b3[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x81d748,null))[_0x0a9e('0x23')](function(_0x5955f1){if(_0x5955f1){return BPromise[_0x0a9e('0x66')]([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),'sms',_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x1d4877){return _0x5955f1['get'+_[_0x0a9e('0x55')](_0x1d4877)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x255e49){return BPromise[_0x0a9e('0x66')](_0x255e49,function(_0x32b9bd){return _0x32b9bd[_0x0a9e('0x74')](_0x4dc6b3['query'][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(){if(_0x1d4877==='voice'){return db[_0x0a9e('0x6c')][_0x0a9e('0x24')]({'where':{'VoiceQueueId':_0x32b9bd['id'],'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids']}});}});});})[_0x0a9e('0x23')](function(){return _0x5955f1;});})['then'](function(){return _0x5955f1;});}})[_0x0a9e('0x23')](function(_0x2b5148){if(_0x2b5148){return _0x2b5148[_0x0a9e('0x74')](_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(_0x16a039){if(_[_0x0a9e('0x75')](_0x4dc6b3['query'][_0x0a9e('0x5d')])){for(var _0x31d25a=0x0;_0x31d25a<_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x31d25a+=0x1){socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x31d25a],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids'],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x81d748,null))[_0x0a9e('0x42')](handleError(_0x81d748,null));};exports[_0x0a9e('0x78')]=function(_0xb0599a,_0x5d9ddb,_0x3afc8c){var _0x1756c7={};var _0x5ce99d={};var _0x23b447;var _0x5e725e;return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0xb0599a[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5d9ddb,null))['then'](function(_0x3ceba6){if(_0x3ceba6){_0x23b447=_0x3ceba6;_0x5ce99d['model']=_[_0x0a9e('0x2d')](db[_0x0a9e('0x68')]['rawAttributes']);_0x5ce99d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xb0599a[_0x0a9e('0x2e')]);_0x5ce99d['filters']=_['intersection'](_0x5ce99d[_0x0a9e('0x2c')],_0x5ce99d[_0x0a9e('0x2e')]);_0x1756c7[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5ce99d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x1756c7[_0x0a9e('0x30')]=_0x1756c7['attributes'][_0x0a9e('0x32')]?_0x1756c7['attributes']:_0x5ce99d[_0x0a9e('0x2c')];_0x1756c7[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x1756c7['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0x58')](_0xb0599a[_0x0a9e('0x2e')],_0x5ce99d[_0x0a9e('0x36')]));if(_0xb0599a[_0x0a9e('0x2e')]['filter']){_0x1756c7['where']=_[_0x0a9e('0x38')](_0x1756c7['where'],{'$or':_[_0x0a9e('0x3a')](_0x1756c7[_0x0a9e('0x30')],function(_0x4672e1){var _0x16313e={};_0x16313e[_0x4672e1]={'$like':'%'+_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x16313e;})});}_0x1756c7=_['merge']({},_0x1756c7,_0xb0599a['options']);return _0x23b447[_0x0a9e('0x78')](_0x1756c7);}})['then'](function(_0x2469d1){if(_0x2469d1){_0x5e725e=_0x2469d1['length'];if(!_0xb0599a[_0x0a9e('0x2e')]['hasOwnProperty']('nolimit')){_0x1756c7[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0xb0599a['query'][_0x0a9e('0x1d')]);_0x1756c7[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x23b447['getAgents'](_0x1756c7);}})['then'](function(_0x16449b){if(_0x16449b){return _0x16449b?{'count':_0x5e725e,'rows':_0x16449b}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x5d9ddb,null))[_0x0a9e('0x42')](handleError(_0x5d9ddb,null));}; \ No newline at end of file +var _0xa9e0=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','isValidChannel','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','addQueues','findOne','add','ids','removeQueues','remove','voice','chat','mail','sms','fax','openchannel','each','addAgents','User','findAll','loginInPause','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','omit','spread','userTeam:save','removeAgents','isArray','emit','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','Team','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./team.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='Teams';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['Team'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['Team'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931,_0x5ce9ac){return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x49c095[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](function(_0x5df0ad){if(!_0x49c095[_0x0a9e('0x2e')]['channel']||!utils[_0x0a9e('0x50')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}var _0xd10662={};var _0x28d814={};_0x28d814['model']=_[_0x0a9e('0x2d')](db[_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+_0x0a9e('0x57')]['rawAttributes']);_0x28d814[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x49c095['query']);_0x28d814[_0x0a9e('0x36')]=_['intersection'](_0x28d814[_0x0a9e('0x2c')],_0x28d814['query']);_0xd10662['attributes']=_['intersection'](_0x28d814[_0x0a9e('0x2c')],qs['fields'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0xd10662[_0x0a9e('0x30')]=_0xd10662[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0xd10662[_0x0a9e('0x30')]:_0x28d814['model'];_0xd10662[_0x0a9e('0x1d')]=qs['limit'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0xd10662[_0x0a9e('0x1c')]=qs['offset'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);_0xd10662[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x49c095['query'][_0x0a9e('0x35')]);_0xd10662[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x58')](_0x49c095[_0x0a9e('0x2e')],_0x28d814[_0x0a9e('0x36')]));_0xd10662=_[_0x0a9e('0x38')]({},_0xd10662,_0x49c095[_0x0a9e('0x3e')]);return _0x5df0ad['get'+_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')]['toLowerCase']())+_0x0a9e('0x59')](_0xd10662);})['then'](respondWithResult(_0x145931,null))['catch'](handleError(_0x145931,null));};exports[_0x0a9e('0x5a')]=function(_0x4556c5,_0x9375fb,_0x19c995){return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0x4556c5[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){if(!_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x2d7205[_0x0a9e('0x5c')+_['capitalize'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+'Queues'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x5d')]);}return null;})['then'](handleEntityNotFound(_0x9375fb,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x9375fb,null))[_0x0a9e('0x42')](handleError(_0x9375fb,null));};exports[_0x0a9e('0x5e')]=function(_0x427946,_0x13b5c0,_0x4a43a8){return db['Team']['findOne']({'where':{'id':_0x427946[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x1104ad){if(_0x1104ad){if(!_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db['Sequelize'][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x1104ad[_0x0a9e('0x5f')+_['capitalize'](_0x427946[_0x0a9e('0x2e')]['channel'][_0x0a9e('0x56')]())+_0x0a9e('0x59')](_0x427946['query'][_0x0a9e('0x5d')]);}return null;})[_0x0a9e('0x23')](handleEntityNotFound(_0x13b5c0,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x13b5c0,null))[_0x0a9e('0x42')](handleError(_0x13b5c0,null));};exports['addAgents']=function(_0x1d442c,_0x2e9552,_0x371533){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x1d442c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2e9552,null))[_0x0a9e('0x23')](function(_0x361b21){if(_0x361b21){return BPromise['each']([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x40fc56){return _0x361b21[_0x0a9e('0x25')+_[_0x0a9e('0x55')](_0x40fc56)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x25744a){return BPromise[_0x0a9e('0x66')](_0x25744a,function(_0x5b35db){return _0x5b35db[_0x0a9e('0x67')](_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')])['then'](function(){if(_0x40fc56===_0x0a9e('0x60')){return db[_0x0a9e('0x68')][_0x0a9e('0x69')]({'where':{'id':_0x1d442c[_0x0a9e('0x47')]['ids']},'attributes':['id','name',_0x0a9e('0x6a'),_0x0a9e('0x6b'),'interface'],'raw':!![]});}})[_0x0a9e('0x23')](function(_0x53a6a1){if(_0x40fc56===_0x0a9e('0x60')){return BPromise[_0x0a9e('0x66')](_0x53a6a1,function(_0x5637a1){return db[_0x0a9e('0x6c')][_0x0a9e('0x6d')]({'membername':_0x5637a1[_0x0a9e('0x28')],'UserId':_0x5637a1['id'],'queue_name':_0x5b35db[_0x0a9e('0x28')],'VoiceQueueId':_0x5b35db['id'],'interface':_[_0x0a9e('0x6e')](_0x5637a1[_0x0a9e('0x6f')])?util[_0x0a9e('0x70')]('SIP/%s',_0x5637a1[_0x0a9e('0x28')]):_0x5637a1[_0x0a9e('0x6f')],'paused':_0x5637a1[_0x0a9e('0x6b')]||![],'penalty':0x0});});}});});})[_0x0a9e('0x23')](function(){return _0x361b21;});})['then'](function(){return _0x361b21;});}})[_0x0a9e('0x23')](function(_0xf0db1){if(_0xf0db1){return _0xf0db1['addAgents'](_0x1d442c[_0x0a9e('0x47')]['ids'],_[_0x0a9e('0x71')](_0x1d442c[_0x0a9e('0x47')],[_0x0a9e('0x5d'),'id'])||{})[_0x0a9e('0x72')](function(_0x5af453){for(var _0x51ccd7=0x0;_0x51ccd7<_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x51ccd7+=0x1){socket['emit'](_0x0a9e('0x73'),{'UserId':_0x1d442c[_0x0a9e('0x47')]['ids'][_0x51ccd7],'TeamId':_0x1d442c['params']['id']});}return _0x5af453;});}})[_0x0a9e('0x23')](respondWithResult(_0x2e9552,null))['catch'](handleError(_0x2e9552,null));};exports['removeAgents']=function(_0x4dc6b3,_0x81d748,_0xf3601c){var _0x9044fe;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4dc6b3[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x81d748,null))[_0x0a9e('0x23')](function(_0x5955f1){if(_0x5955f1){return BPromise[_0x0a9e('0x66')]([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),'sms',_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x1d4877){return _0x5955f1['get'+_[_0x0a9e('0x55')](_0x1d4877)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x255e49){return BPromise[_0x0a9e('0x66')](_0x255e49,function(_0x32b9bd){return _0x32b9bd[_0x0a9e('0x74')](_0x4dc6b3['query'][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(){if(_0x1d4877==='voice'){return db[_0x0a9e('0x6c')][_0x0a9e('0x24')]({'where':{'VoiceQueueId':_0x32b9bd['id'],'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids']}});}});});})[_0x0a9e('0x23')](function(){return _0x5955f1;});})['then'](function(){return _0x5955f1;});}})[_0x0a9e('0x23')](function(_0x2b5148){if(_0x2b5148){return _0x2b5148[_0x0a9e('0x74')](_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(_0x16a039){if(_[_0x0a9e('0x75')](_0x4dc6b3['query'][_0x0a9e('0x5d')])){for(var _0x31d25a=0x0;_0x31d25a<_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x31d25a+=0x1){socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x31d25a],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids'],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x81d748,null))[_0x0a9e('0x42')](handleError(_0x81d748,null));};exports[_0x0a9e('0x78')]=function(_0xb0599a,_0x5d9ddb,_0x3afc8c){var _0x1756c7={};var _0x5ce99d={};var _0x23b447;var _0x5e725e;return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0xb0599a[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5d9ddb,null))['then'](function(_0x3ceba6){if(_0x3ceba6){_0x23b447=_0x3ceba6;_0x5ce99d['model']=_[_0x0a9e('0x2d')](db[_0x0a9e('0x68')]['rawAttributes']);_0x5ce99d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xb0599a[_0x0a9e('0x2e')]);_0x5ce99d['filters']=_['intersection'](_0x5ce99d[_0x0a9e('0x2c')],_0x5ce99d[_0x0a9e('0x2e')]);_0x1756c7[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5ce99d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x1756c7[_0x0a9e('0x30')]=_0x1756c7['attributes'][_0x0a9e('0x32')]?_0x1756c7['attributes']:_0x5ce99d[_0x0a9e('0x2c')];_0x1756c7[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x1756c7['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0x58')](_0xb0599a[_0x0a9e('0x2e')],_0x5ce99d[_0x0a9e('0x36')]));if(_0xb0599a[_0x0a9e('0x2e')]['filter']){_0x1756c7['where']=_[_0x0a9e('0x38')](_0x1756c7['where'],{'$or':_[_0x0a9e('0x3a')](_0x1756c7[_0x0a9e('0x30')],function(_0x4672e1){var _0x16313e={};_0x16313e[_0x4672e1]={'$like':'%'+_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x16313e;})});}_0x1756c7=_['merge']({},_0x1756c7,_0xb0599a['options']);return _0x23b447[_0x0a9e('0x78')](_0x1756c7);}})['then'](function(_0x2469d1){if(_0x2469d1){_0x5e725e=_0x2469d1['length'];if(!_0xb0599a[_0x0a9e('0x2e')]['hasOwnProperty']('nolimit')){_0x1756c7[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0xb0599a['query'][_0x0a9e('0x1d')]);_0x1756c7[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x23b447['getAgents'](_0x1756c7);}})['then'](function(_0x16449b){if(_0x16449b){return _0x16449b?{'count':_0x5e725e,'rows':_0x16449b}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x5d9ddb,null))[_0x0a9e('0x42')](handleError(_0x5d9ddb,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d99f433..2c8c54b 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 _0x51ca=['events','../../mysqldb','Team','save','remove','emit','hasOwnProperty','hook'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x51ca,0xd0));var _0xa51c=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x51ca[_0xef8146];return _0x5a6cb0;};'use strict';var EventEmitter=require(_0xa51c('0x0'));var Team=require(_0xa51c('0x1'))['db'][_0xa51c('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa51c('0x3'),'afterUpdate':'update','afterDestroy':_0xa51c('0x4')};function emitEvent(_0x520009){return function(_0x54d249,_0x43ac7d,_0x1e4a9a){TeamEvents[_0xa51c('0x5')](_0x520009+':'+_0x54d249['id'],_0x54d249);TeamEvents[_0xa51c('0x5')](_0x520009,_0x54d249);_0x1e4a9a(null);};}for(var e in events){if(events[_0xa51c('0x6')](e)){var event=events[e];Team[_0xa51c('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x5b85=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b85,0x18a));var _0x55b8=function(_0x3be311,_0x28edc6){_0x3be311=_0x3be311-0x0;var _0x11a827=_0x5b85[_0x3be311];return _0x11a827;};'use strict';var EventEmitter=require(_0x55b8('0x0'));var Team=require(_0x55b8('0x1'))['db'][_0x55b8('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x55b8('0x3')](0x0);var events={'afterCreate':_0x55b8('0x4'),'afterUpdate':'update','afterDestroy':_0x55b8('0x5')};function emitEvent(_0x2b4052){return function(_0x3fcb42,_0x4b7b11,_0xc00fe0){TeamEvents[_0x55b8('0x6')](_0x2b4052+':'+_0x3fcb42['id'],_0x3fcb42);TeamEvents[_0x55b8('0x6')](_0x2b4052,_0x3fcb42);_0xc00fe0(null);};}for(var e in events){if(events[_0x55b8('0x7')](e)){var event=events[e];Team[_0x55b8('0x8')](e,emitEvent(event));}}module[_0x55b8('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index e17aac8..49e31be 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','./team.attributes','exports','define','Team','teams','util'];(function(_0x2d76d7,_0x1c2318){var _0x5d6be1=function(_0xf98f5b){while(--_0xf98f5b){_0x2d76d7['push'](_0x2d76d7['shift']());}};_0x5d6be1(++_0x1c2318);}(_0xedd9,0xfc));var _0x9edd=function(_0x13efd8,_0x3e3c14){_0x13efd8=_0x13efd8-0x0;var _0x3f24dd=_0xedd9[_0x13efd8];return _0x3f24dd;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var attributes=require(_0x9edd('0x6'));module[_0x9edd('0x7')]=function(_0x5943b3,_0x33679f){return _0x5943b3[_0x9edd('0x8')](_0x9edd('0x9'),attributes,{'tableName':_0x9edd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','./team.attributes','exports','define','teams'];(function(_0x11f561,_0x4935e0){var _0x5b9e60=function(_0x14e1b7){while(--_0x14e1b7){_0x11f561['push'](_0x11f561['shift']());}};_0x5b9e60(++_0x4935e0);}(_0x34e8,0x12c));var _0x834e=function(_0xac8de6,_0x1c7de3){_0xac8de6=_0xac8de6-0x0;var _0x190c25=_0x34e8[_0xac8de6];return _0x190c25;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var attributes=require(_0x834e('0x6'));module[_0x834e('0x7')]=function(_0x289ef2,_0x19a3e0){return _0x289ef2[_0x834e('0x8')]('Team',attributes,{'tableName':_0x834e('0x9'),'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 c7afa2b..5d9c5f9 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 _0x9d44=['error','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./team.socket','register','request','then','Team,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0x9d44,0x18a));var _0x49d4=function(_0x4f8e06,_0x3226b1){_0x4f8e06=_0x4f8e06-0x0;var _0x327dad=_0x9d44[_0x4f8e06];return _0x327dad;};'use strict';var _=require(_0x49d4('0x0'));var util=require('util');var moment=require(_0x49d4('0x1'));var BPromise=require(_0x49d4('0x2'));var rs=require(_0x49d4('0x3'));var fs=require('fs');var Redis=require(_0x49d4('0x4'));var db=require(_0x49d4('0x5'))['db'];var utils=require(_0x49d4('0x6'));var logger=require(_0x49d4('0x7'))(_0x49d4('0x8'));var config=require(_0x49d4('0x9'));var jayson=require(_0x49d4('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x49d4('0xb')](config[_0x49d4('0xc')],{'host':_0x49d4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x49d4('0xc')]));require(_0x49d4('0xe'))[_0x49d4('0xf')](socket);function respondWithRpcPromise(_0x42906c,_0x6cd0f2,_0x4dd865){return new BPromise(function(_0x1a5c48,_0x2219bb){return client[_0x49d4('0x10')](_0x42906c,_0x4dd865)[_0x49d4('0x11')](function(_0x35d04b){logger['info'](_0x49d4('0x12'),_0x6cd0f2,'request\x20sent');logger[_0x49d4('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x6cd0f2,_0x49d4('0x14'),JSON[_0x49d4('0x15')](_0x35d04b));if(_0x35d04b[_0x49d4('0x16')]){if(_0x35d04b[_0x49d4('0x16')]['code']===0x1f4){logger[_0x49d4('0x16')](_0x49d4('0x12'),_0x6cd0f2,_0x35d04b[_0x49d4('0x16')][_0x49d4('0x17')]);return _0x2219bb(_0x35d04b[_0x49d4('0x16')]['message']);}logger[_0x49d4('0x16')](_0x49d4('0x12'),_0x6cd0f2,_0x35d04b['error'][_0x49d4('0x17')]);return _0x1a5c48(_0x35d04b[_0x49d4('0x16')]['message']);}else{logger[_0x49d4('0x18')](_0x49d4('0x12'),_0x6cd0f2,_0x49d4('0x14'));_0x1a5c48(_0x35d04b[_0x49d4('0x19')][_0x49d4('0x17')]);}})['catch'](function(_0x37b8d7){logger['error']('Team,\x20%s,\x20%s',_0x6cd0f2,_0x37b8d7);_0x2219bb(_0x37b8d7);});});} \ No newline at end of file +var _0x9ea7=['redis','localhost','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x85927e,_0x66206d){var _0x2a80b8=function(_0x2b2590){while(--_0x2b2590){_0x85927e['push'](_0x85927e['shift']());}};_0x2a80b8(++_0x66206d);}(_0x9ea7,0x6e));var _0x79ea=function(_0x3c43f6,_0x429058){_0x3c43f6=_0x3c43f6-0x0;var _0x5677a4=_0x9ea7[_0x3c43f6];return _0x5677a4;};'use strict';var _=require(_0x79ea('0x0'));var util=require('util');var moment=require(_0x79ea('0x1'));var BPromise=require(_0x79ea('0x2'));var rs=require(_0x79ea('0x3'));var fs=require('fs');var Redis=require(_0x79ea('0x4'));var db=require(_0x79ea('0x5'))['db'];var utils=require(_0x79ea('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x79ea('0x7'));var jayson=require(_0x79ea('0x8'));var client=jayson[_0x79ea('0x9')]['http']({'port':0x232a});config[_0x79ea('0xa')]=_['defaults'](config[_0x79ea('0xa')],{'host':_0x79ea('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x79ea('0xa')]));require(_0x79ea('0xc'))['register'](socket);function respondWithRpcPromise(_0xfdeee3,_0x2fef0d,_0xab86d0){return new BPromise(function(_0x512126,_0x1eab9b){return client[_0x79ea('0xd')](_0xfdeee3,_0xab86d0)['then'](function(_0x148f7a){logger[_0x79ea('0xe')](_0x79ea('0xf'),_0x2fef0d,_0x79ea('0x10'));logger[_0x79ea('0x11')]('Team,\x20%s,\x20%s,\x20%s',_0x2fef0d,_0x79ea('0x10'),JSON[_0x79ea('0x12')](_0x148f7a));if(_0x148f7a[_0x79ea('0x13')]){if(_0x148f7a[_0x79ea('0x13')][_0x79ea('0x14')]===0x1f4){logger[_0x79ea('0x13')](_0x79ea('0xf'),_0x2fef0d,_0x148f7a[_0x79ea('0x13')][_0x79ea('0x15')]);return _0x1eab9b(_0x148f7a[_0x79ea('0x13')]['message']);}logger[_0x79ea('0x13')](_0x79ea('0xf'),_0x2fef0d,_0x148f7a['error'][_0x79ea('0x15')]);return _0x512126(_0x148f7a[_0x79ea('0x13')][_0x79ea('0x15')]);}else{logger[_0x79ea('0xe')](_0x79ea('0xf'),_0x2fef0d,_0x79ea('0x10'));_0x512126(_0x148f7a[_0x79ea('0x16')][_0x79ea('0x15')]);}})[_0x79ea('0x17')](function(_0x221652){logger[_0x79ea('0x13')](_0x79ea('0xf'),_0x2fef0d,_0x221652);_0x1eab9b(_0x221652);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 543067b..b3f9a2e 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 _0x4869=['update','emit','removeListener','register','./team.events','save','remove'];(function(_0x3feb63,_0x45c598){var _0x5d4e7c=function(_0x3537ef){while(--_0x3537ef){_0x3feb63['push'](_0x3feb63['shift']());}};_0x5d4e7c(++_0x45c598);}(_0x4869,0x1a8));var _0x9486=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4869[_0x422905];return _0x33dc6c;};'use strict';var TeamEvents=require(_0x9486('0x0'));var events=[_0x9486('0x1'),_0x9486('0x2'),_0x9486('0x3')];function createListener(_0x2a64bd,_0x225123){return function(_0x4c5ed9){_0x225123[_0x9486('0x4')](_0x2a64bd,_0x4c5ed9);};}function removeListener(_0x597325,_0x4086b4){return function(){TeamEvents[_0x9486('0x5')](_0x597325,_0x4086b4);};}exports[_0x9486('0x6')]=function(_0x538d12){for(var _0x542cef=0x0,_0x583bcd=events['length'];_0x542cef<_0x583bcd;_0x542cef++){var _0x238c47=events[_0x542cef];var _0x5bcedd=createListener('team:'+_0x238c47,_0x538d12);TeamEvents['on'](_0x238c47,_0x5bcedd);}}; \ No newline at end of file +var _0x4bf9=['update','emit','removeListener','register','length','team:','./team.events','save','remove'];(function(_0x103234,_0x4e4332){var _0x4a7b39=function(_0x451703){while(--_0x451703){_0x103234['push'](_0x103234['shift']());}};_0x4a7b39(++_0x4e4332);}(_0x4bf9,0x1e3));var _0x94bf=function(_0x431c1f,_0xc62e31){_0x431c1f=_0x431c1f-0x0;var _0xfeb0bf=_0x4bf9[_0x431c1f];return _0xfeb0bf;};'use strict';var TeamEvents=require(_0x94bf('0x0'));var events=[_0x94bf('0x1'),_0x94bf('0x2'),_0x94bf('0x3')];function createListener(_0x3f8e4f,_0x1bac83){return function(_0x57ec39){_0x1bac83[_0x94bf('0x4')](_0x3f8e4f,_0x57ec39);};}function removeListener(_0x2ac1b5,_0x3ed20a){return function(){TeamEvents[_0x94bf('0x5')](_0x2ac1b5,_0x3ed20a);};}exports[_0x94bf('0x6')]=function(_0xdf7b5c){for(var _0x204f23=0x0,_0x41194e=events[_0x94bf('0x7')];_0x204f23<_0x41194e;_0x204f23++){var _0x5d1c67=events[_0x204f23];var _0x44a1e7=createListener(_0x94bf('0x8')+_0x5d1c67,_0xdf7b5c);TeamEvents['on'](_0x5d1c67,_0x44a1e7);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index fc28391..9b63b8b 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 _0x2284=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x2284,0xdd));var _0x4228=function(_0x28f79e,_0x3947af){_0x28f79e=_0x28f79e-0x0;var _0x5bfd79=_0x2284[_0x28f79e];return _0x5bfd79;};'use strict';var multer=require('multer');var util=require(_0x4228('0x0'));var path=require('path');var timeout=require(_0x4228('0x1'));var express=require(_0x4228('0x2'));var router=express[_0x4228('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4228('0x4'));var config=require(_0x4228('0x5'));var controller=require(_0x4228('0x6'));router[_0x4228('0x7')]('/',auth[_0x4228('0x8')](),controller[_0x4228('0x9')]);router[_0x4228('0x7')](_0x4228('0xa'),auth[_0x4228('0x8')](),controller['show']);router[_0x4228('0xb')]('/',auth['isAuthenticated'](),controller[_0x4228('0xc')]);router['put'](_0x4228('0xa'),auth[_0x4228('0x8')](),controller[_0x4228('0xd')]);router[_0x4228('0xe')](_0x4228('0xa'),auth[_0x4228('0x8')](),controller[_0x4228('0xf')]);module[_0x4228('0x10')]=router; \ No newline at end of file +var _0x3e95=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x427444,_0xf966d1){var _0x356dca=function(_0x28b183){while(--_0x28b183){_0x427444['push'](_0x427444['shift']());}};_0x356dca(++_0xf966d1);}(_0x3e95,0x172));var _0x53e9=function(_0x4626e9,_0x2f7148){_0x4626e9=_0x4626e9-0x0;var _0x3fc3a9=_0x3e95[_0x4626e9];return _0x3fc3a9;};'use strict';var multer=require(_0x53e9('0x0'));var util=require(_0x53e9('0x1'));var path=require('path');var timeout=require(_0x53e9('0x2'));var express=require(_0x53e9('0x3'));var router=express[_0x53e9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x53e9('0x5'));var config=require(_0x53e9('0x6'));var controller=require('./template.controller');router[_0x53e9('0x7')]('/',auth[_0x53e9('0x8')](),controller['index']);router[_0x53e9('0x7')](_0x53e9('0x9'),auth['isAuthenticated'](),controller[_0x53e9('0xa')]);router[_0x53e9('0xb')]('/',auth[_0x53e9('0x8')](),controller[_0x53e9('0xc')]);router[_0x53e9('0xd')](_0x53e9('0x9'),auth['isAuthenticated'](),controller[_0x53e9('0xe')]);router[_0x53e9('0xf')](_0x53e9('0x9'),auth[_0x53e9('0x8')](),controller[_0x53e9('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f6d8683..aab7d7f 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 _0x49ae=['TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49ae,0x165));var _0xe49a=function(_0x59cc03,_0x4e918e){_0x59cc03=_0x59cc03-0x0;var _0x565479=_0x49ae[_0x59cc03];return _0x565479;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe49a('0x0')]},'description':{'type':Sequelize[_0xe49a('0x0')]},'html':{'type':Sequelize[_0xe49a('0x1')]}}; \ No newline at end of file +var _0xa861=['STRING','TEXT','sequelize'];(function(_0x2d1bf7,_0x27194c){var _0x59a33c=function(_0x31bb65){while(--_0x31bb65){_0x2d1bf7['push'](_0x2d1bf7['shift']());}};_0x59a33c(++_0x27194c);}(_0xa861,0xd7));var _0x1a86=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xa861[_0x30cd7e];return _0x462a02;};'use strict';var Sequelize=require(_0x1a86('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a86('0x1')]},'description':{'type':Sequelize[_0x1a86('0x1')]},'html':{'type':Sequelize[_0x1a86('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index cf6799c..ab720bb 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 _0x86a4=['length','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','create','find','eml-format','rimraf','zip-dir','request-promise','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','rawAttributes','keys','query','intersection','attributes','model','fields','nolimit','sort','filters','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','Template','includeAll','rows','catch','show','params'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x86a4,0xa5));var _0x486a=function(_0x135c65,_0x462039){_0x135c65=_0x135c65-0x0;var _0x1148bc=_0x86a4[_0x135c65];return _0x1148bc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x486a('0x0'));var rimraf=require(_0x486a('0x1'));var zipdir=require(_0x486a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x486a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x486a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x486a('0x5'));var csv=require(_0x486a('0x6'));var ejs=require(_0x486a('0x7'));var fs=require('fs');var _=require(_0x486a('0x8'));var squel=require('squel');var crypto=require(_0x486a('0x9'));var jsforce=require(_0x486a('0xa'));var deskjs=require(_0x486a('0xb'));var toCsv=require(_0x486a('0x6'));var querystring=require('querystring');var Papa=require(_0x486a('0xc'));var authService=require('../../components/auth/service');var hardwareService=require(_0x486a('0xd'));var Redis=require(_0x486a('0xe'));var qs=require(_0x486a('0xf'));var logger=require(_0x486a('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x486a('0x11'));var db=require(_0x486a('0x12'))['db'];function respondWithStatusCode(_0x44d37c,_0x10d901){_0x10d901=_0x10d901||0xcc;return function(_0x59a6ba){if(_0x59a6ba){return _0x44d37c[_0x486a('0x13')](_0x10d901);}return _0x44d37c[_0x486a('0x14')](_0x10d901)[_0x486a('0x15')]();};}function respondWithResult(_0x370bef,_0x29a402){_0x29a402=_0x29a402||0xc8;return function(_0x555c77){if(_0x555c77){return _0x370bef[_0x486a('0x14')](_0x29a402)[_0x486a('0x16')](_0x555c77);}};}function respondWithFilteredResult(_0x56820a,_0x55568a){return function(_0x3aca62){if(_0x3aca62){var _0x3083e7=_0x3aca62[_0x486a('0x17')],_0x21d94f=_0x55568a[_0x486a('0x18')],_0x1d6e03=_0x55568a['offset']+_0x55568a[_0x486a('0x19')],_0x18dc51;if(_0x1d6e03>=_0x3083e7){_0x1d6e03=_0x3083e7;_0x18dc51=0xc8;}else{_0x18dc51=0xce;}_0x56820a[_0x486a('0x14')](_0x18dc51);return _0x56820a[_0x486a('0x1a')](_0x486a('0x1b'),_0x21d94f+'-'+_0x1d6e03+'/'+_0x3083e7)[_0x486a('0x16')](_0x3aca62);}return null;};}function patchUpdates(_0x16103a){return function(_0x19ff69){try{jsonpatch[_0x486a('0x1c')](_0x19ff69,_0x16103a,!![]);}catch(_0x49c65e){return BPromise[_0x486a('0x1d')](_0x49c65e);}return _0x19ff69['save']();};}function saveUpdates(_0x11d630,_0x1165fe){return function(_0x1db26e){if(_0x1db26e){return _0x1db26e[_0x486a('0x1e')](_0x11d630)[_0x486a('0x1f')](function(_0x58b04c){return _0x58b04c;});}return null;};}function removeEntity(_0x2f4459,_0x3f6235){return function(_0x56b386){if(_0x56b386){return _0x56b386[_0x486a('0x20')]()[_0x486a('0x1f')](function(){var _0x212251=_0x56b386[_0x486a('0x21')]({'plain':!![]});var _0x90441='Templates';return db[_0x486a('0x22')][_0x486a('0x20')]({'where':{'type':_0x90441,'resourceId':_0x212251['id']}})[_0x486a('0x1f')](function(){return _0x56b386;});})[_0x486a('0x1f')](function(){_0x2f4459['status'](0xcc)[_0x486a('0x15')]();});}};}function handleEntityNotFound(_0x99e581,_0x18f49a){return function(_0x168000){if(!_0x168000){_0x99e581['sendStatus'](0x194);}return _0x168000;};}function handleError(_0x35f282,_0x14c3b0){_0x14c3b0=_0x14c3b0||0x1f4;return function(_0x9aa8ad){logger[_0x486a('0x23')](_0x9aa8ad[_0x486a('0x24')]);if(_0x9aa8ad[_0x486a('0x25')]){delete _0x9aa8ad['name'];}_0x35f282[_0x486a('0x14')](_0x14c3b0)[_0x486a('0x26')](_0x9aa8ad);};}exports[_0x486a('0x27')]=function(_0xbc143c,_0x16c263){var _0x3763f2={},_0x219ee0={},_0x4169a4={'count':0x0,'rows':[]};var _0xe8f649=db['Template'][_0x486a('0x28')];_0x219ee0['model']=_[_0x486a('0x29')](_0xe8f649);_0x219ee0[_0x486a('0x2a')]=_[_0x486a('0x29')](_0xbc143c[_0x486a('0x2a')]);_0x219ee0['filters']=_[_0x486a('0x2b')](_0x219ee0['model'],_0x219ee0[_0x486a('0x2a')]);_0x3763f2[_0x486a('0x2c')]=_['intersection'](_0x219ee0[_0x486a('0x2d')],qs[_0x486a('0x2e')](_0xbc143c[_0x486a('0x2a')][_0x486a('0x2e')]));_0x3763f2[_0x486a('0x2c')]=_0x3763f2[_0x486a('0x2c')]['length']?_0x3763f2['attributes']:_0x219ee0[_0x486a('0x2d')];if(!_0xbc143c[_0x486a('0x2a')]['hasOwnProperty'](_0x486a('0x2f'))){_0x3763f2[_0x486a('0x19')]=qs[_0x486a('0x19')](_0xbc143c[_0x486a('0x2a')][_0x486a('0x19')]);_0x3763f2[_0x486a('0x18')]=qs['offset'](_0xbc143c['query'][_0x486a('0x18')]);}_0x3763f2['order']=qs[_0x486a('0x30')](_0xbc143c[_0x486a('0x2a')]['sort']);_0x3763f2['where']=qs[_0x486a('0x31')](_[_0x486a('0x32')](_0xbc143c[_0x486a('0x2a')],_0x219ee0[_0x486a('0x31')]));if(_0xbc143c[_0x486a('0x2a')][_0x486a('0x33')]){_0x3763f2[_0x486a('0x34')]=_[_0x486a('0x35')](_0x3763f2[_0x486a('0x34')],{'$or':_[_0x486a('0x36')](_0xe8f649,function(_0x1835cf){if(_0x1835cf[_0x486a('0x37')][_0x486a('0x38')]!==_0x486a('0x39')){var _0x487700={};_0x487700[_0x1835cf[_0x486a('0x3a')]]={'$like':'%'+_0xbc143c[_0x486a('0x2a')][_0x486a('0x33')]+'%'};return _0x487700;}})});}_0x3763f2=_[_0x486a('0x35')]({},_0x3763f2,_0xbc143c[_0x486a('0x3b')]);var _0x16b1b6={'where':_0x3763f2[_0x486a('0x34')]};return db[_0x486a('0x3c')][_0x486a('0x17')](_0x16b1b6)[_0x486a('0x1f')](function(_0x5c7586){_0x4169a4[_0x486a('0x17')]=_0x5c7586;if(_0xbc143c[_0x486a('0x2a')][_0x486a('0x3d')]){_0x3763f2['include']=[{'all':!![]}];}return db[_0x486a('0x3c')]['findAll'](_0x3763f2);})['then'](function(_0x5910cc){_0x4169a4[_0x486a('0x3e')]=_0x5910cc;return _0x4169a4;})[_0x486a('0x1f')](respondWithFilteredResult(_0x16c263,_0x3763f2))[_0x486a('0x3f')](handleError(_0x16c263,null));};exports[_0x486a('0x40')]=function(_0x386219,_0x1ee93d){var _0x12a203={'raw':!![],'where':{'id':_0x386219[_0x486a('0x41')]['id']}},_0x134f67={};_0x134f67[_0x486a('0x2d')]=_[_0x486a('0x29')](db['Template'][_0x486a('0x28')]);_0x134f67['query']=_[_0x486a('0x29')](_0x386219['query']);_0x134f67[_0x486a('0x31')]=_[_0x486a('0x2b')](_0x134f67[_0x486a('0x2d')],_0x134f67[_0x486a('0x2a')]);_0x12a203[_0x486a('0x2c')]=_[_0x486a('0x2b')](_0x134f67[_0x486a('0x2d')],qs[_0x486a('0x2e')](_0x386219[_0x486a('0x2a')][_0x486a('0x2e')]));_0x12a203[_0x486a('0x2c')]=_0x12a203[_0x486a('0x2c')][_0x486a('0x42')]?_0x12a203[_0x486a('0x2c')]:_0x134f67[_0x486a('0x2d')];if(_0x386219[_0x486a('0x2a')][_0x486a('0x3d')]){_0x12a203[_0x486a('0x43')]=[{'all':!![]}];}_0x12a203=_[_0x486a('0x35')]({},_0x12a203,_0x386219[_0x486a('0x3b')]);return db[_0x486a('0x3c')]['find'](_0x12a203)[_0x486a('0x1f')](handleEntityNotFound(_0x1ee93d,null))[_0x486a('0x1f')](respondWithResult(_0x1ee93d,null))[_0x486a('0x3f')](handleError(_0x1ee93d,null));};exports['create']=function(_0x21c3b0,_0x333f40){return db['Template']['create'](_0x21c3b0[_0x486a('0x44')],{})[_0x486a('0x1f')](function(_0x123ec2){var _0x17ae75=_0x21c3b0[_0x486a('0x45')][_0x486a('0x21')]({'plain':!![]});if(!_0x17ae75)throw new Error(_0x486a('0x46'));if(_0x17ae75[_0x486a('0x47')]===_0x486a('0x45')){var _0x5c770f=_0x123ec2[_0x486a('0x21')]({'plain':!![]});var _0x51d142=_0x486a('0x48');return db[_0x486a('0x49')]['find']({'where':{'name':_0x51d142,'userProfileId':_0x17ae75[_0x486a('0x4a')]},'raw':!![]})[_0x486a('0x1f')](function(_0x3e3e58){if(_0x3e3e58&&_0x3e3e58['autoAssociation']===0x0){return db[_0x486a('0x22')][_0x486a('0x4b')]({'name':_0x5c770f[_0x486a('0x25')],'resourceId':_0x5c770f['id'],'type':_0x3e3e58[_0x486a('0x25')],'sectionId':_0x3e3e58['id']},{})[_0x486a('0x1f')](function(){return _0x123ec2;});}else{return _0x123ec2;}})[_0x486a('0x3f')](function(_0x3fe4cd){logger[_0x486a('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fe4cd);throw _0x3fe4cd;});}return _0x123ec2;})[_0x486a('0x1f')](respondWithResult(_0x333f40,0xc9))[_0x486a('0x3f')](handleError(_0x333f40,null));};exports[_0x486a('0x1e')]=function(_0x2ea020,_0x1172f){if(_0x2ea020[_0x486a('0x44')]['id']){delete _0x2ea020['body']['id'];}return db['Template'][_0x486a('0x4c')]({'where':{'id':_0x2ea020[_0x486a('0x41')]['id']}})[_0x486a('0x1f')](handleEntityNotFound(_0x1172f,null))[_0x486a('0x1f')](saveUpdates(_0x2ea020[_0x486a('0x44')],null))['then'](respondWithResult(_0x1172f,null))['catch'](handleError(_0x1172f,null));};exports[_0x486a('0x20')]=function(_0xb2f9e6,_0x19c06c){return db[_0x486a('0x3c')][_0x486a('0x4c')]({'where':{'id':_0xb2f9e6[_0x486a('0x41')]['id']}})['then'](handleEntityNotFound(_0x19c06c,null))[_0x486a('0x1f')](removeEntity(_0x19c06c,null))['catch'](handleError(_0x19c06c,null));}; \ No newline at end of file +var _0x8195=['rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','map','type','key','VIRTUAL','Template','include','rows','show','params','length','find','catch','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','Templates','UserProfileResource','destroy','stack','name','send'];(function(_0x16520f,_0x3fab37){var _0x438d29=function(_0x2b28cc){while(--_0x2b28cc){_0x16520f['push'](_0x16520f['shift']());}};_0x438d29(++_0x3fab37);}(_0x8195,0x6d));var _0x5819=function(_0x2e370a,_0x25bcd2){_0x2e370a=_0x2e370a-0x0;var _0x36cff2=_0x8195[_0x2e370a];return _0x36cff2;};'use strict';var pdf=require(_0x5819('0x0'));var emlformat=require(_0x5819('0x1'));var rimraf=require(_0x5819('0x2'));var zipdir=require(_0x5819('0x3'));var jsonpatch=require(_0x5819('0x4'));var rp=require(_0x5819('0x5'));var moment=require(_0x5819('0x6'));var BPromise=require(_0x5819('0x7'));var Mustache=require('mustache');var util=require(_0x5819('0x8'));var path=require('path');var sox=require(_0x5819('0x9'));var csv=require(_0x5819('0xa'));var ejs=require(_0x5819('0xb'));var fs=require('fs');var _=require(_0x5819('0xc'));var squel=require('squel');var crypto=require(_0x5819('0xd'));var jsforce=require(_0x5819('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5819('0xf'));var Papa=require(_0x5819('0x10'));var authService=require(_0x5819('0x11'));var hardwareService=require(_0x5819('0x12'));var Redis=require(_0x5819('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x5819('0x14'))('api');var utils=require(_0x5819('0x15'));var config=require(_0x5819('0x16'));var db=require(_0x5819('0x17'))['db'];function respondWithStatusCode(_0x13832f,_0x1330e4){_0x1330e4=_0x1330e4||0xcc;return function(_0x271ca7){if(_0x271ca7){return _0x13832f['sendStatus'](_0x1330e4);}return _0x13832f['status'](_0x1330e4)[_0x5819('0x18')]();};}function respondWithResult(_0x3a1a3a,_0x445acc){_0x445acc=_0x445acc||0xc8;return function(_0x11447c){if(_0x11447c){return _0x3a1a3a[_0x5819('0x19')](_0x445acc)[_0x5819('0x1a')](_0x11447c);}};}function respondWithFilteredResult(_0x14682c,_0x51bceb){return function(_0x4e9ff5){if(_0x4e9ff5){var _0x6264b4=_0x4e9ff5[_0x5819('0x1b')],_0x1d7e7d=_0x51bceb['offset'],_0x159345=_0x51bceb[_0x5819('0x1c')]+_0x51bceb[_0x5819('0x1d')],_0x4ed536;if(_0x159345>=_0x6264b4){_0x159345=_0x6264b4;_0x4ed536=0xc8;}else{_0x4ed536=0xce;}_0x14682c[_0x5819('0x19')](_0x4ed536);return _0x14682c[_0x5819('0x1e')](_0x5819('0x1f'),_0x1d7e7d+'-'+_0x159345+'/'+_0x6264b4)[_0x5819('0x1a')](_0x4e9ff5);}return null;};}function patchUpdates(_0x42a9ee){return function(_0x3587f4){try{jsonpatch['apply'](_0x3587f4,_0x42a9ee,!![]);}catch(_0xd3bc25){return BPromise[_0x5819('0x20')](_0xd3bc25);}return _0x3587f4[_0x5819('0x21')]();};}function saveUpdates(_0x52ba12,_0x7b22ed){return function(_0x4b1dcf){if(_0x4b1dcf){return _0x4b1dcf[_0x5819('0x22')](_0x52ba12)[_0x5819('0x23')](function(_0x308c69){return _0x308c69;});}return null;};}function removeEntity(_0x200702,_0x2e1e76){return function(_0x2ea67a){if(_0x2ea67a){return _0x2ea67a['destroy']()[_0x5819('0x23')](function(){var _0x4ba91b=_0x2ea67a[_0x5819('0x24')]({'plain':!![]});var _0xfb286a=_0x5819('0x25');return db[_0x5819('0x26')][_0x5819('0x27')]({'where':{'type':_0xfb286a,'resourceId':_0x4ba91b['id']}})[_0x5819('0x23')](function(){return _0x2ea67a;});})[_0x5819('0x23')](function(){_0x200702[_0x5819('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d9341,_0x2d32b7){return function(_0x36c4d6){if(!_0x36c4d6){_0x2d9341['sendStatus'](0x194);}return _0x36c4d6;};}function handleError(_0x449054,_0x1f6569){_0x1f6569=_0x1f6569||0x1f4;return function(_0xdf206a){logger['error'](_0xdf206a[_0x5819('0x28')]);if(_0xdf206a[_0x5819('0x29')]){delete _0xdf206a['name'];}_0x449054[_0x5819('0x19')](_0x1f6569)[_0x5819('0x2a')](_0xdf206a);};}exports['index']=function(_0x1cb72f,_0x26748c){var _0x2657a7={},_0x493a51={},_0x166555={'count':0x0,'rows':[]};var _0x24fe2e=db['Template'][_0x5819('0x2b')];_0x493a51[_0x5819('0x2c')]=_[_0x5819('0x2d')](_0x24fe2e);_0x493a51[_0x5819('0x2e')]=_[_0x5819('0x2d')](_0x1cb72f[_0x5819('0x2e')]);_0x493a51['filters']=_[_0x5819('0x2f')](_0x493a51[_0x5819('0x2c')],_0x493a51[_0x5819('0x2e')]);_0x2657a7[_0x5819('0x30')]=_['intersection'](_0x493a51[_0x5819('0x2c')],qs[_0x5819('0x31')](_0x1cb72f[_0x5819('0x2e')][_0x5819('0x31')]));_0x2657a7[_0x5819('0x30')]=_0x2657a7[_0x5819('0x30')]['length']?_0x2657a7[_0x5819('0x30')]:_0x493a51['model'];if(!_0x1cb72f[_0x5819('0x2e')][_0x5819('0x32')]('nolimit')){_0x2657a7['limit']=qs['limit'](_0x1cb72f[_0x5819('0x2e')][_0x5819('0x1d')]);_0x2657a7['offset']=qs[_0x5819('0x1c')](_0x1cb72f[_0x5819('0x2e')][_0x5819('0x1c')]);}_0x2657a7[_0x5819('0x33')]=qs[_0x5819('0x34')](_0x1cb72f['query'][_0x5819('0x34')]);_0x2657a7[_0x5819('0x35')]=qs[_0x5819('0x36')](_['pick'](_0x1cb72f[_0x5819('0x2e')],_0x493a51[_0x5819('0x36')]));if(_0x1cb72f[_0x5819('0x2e')][_0x5819('0x37')]){_0x2657a7['where']=_[_0x5819('0x38')](_0x2657a7[_0x5819('0x35')],{'$or':_[_0x5819('0x39')](_0x24fe2e,function(_0x194665){if(_0x194665[_0x5819('0x3a')][_0x5819('0x3b')]!==_0x5819('0x3c')){var _0x4a8292={};_0x4a8292[_0x194665['field']]={'$like':'%'+_0x1cb72f[_0x5819('0x2e')]['filter']+'%'};return _0x4a8292;}})});}_0x2657a7=_[_0x5819('0x38')]({},_0x2657a7,_0x1cb72f['options']);var _0x4d3af8={'where':_0x2657a7[_0x5819('0x35')]};return db[_0x5819('0x3d')]['count'](_0x4d3af8)[_0x5819('0x23')](function(_0x36760){_0x166555[_0x5819('0x1b')]=_0x36760;if(_0x1cb72f[_0x5819('0x2e')]['includeAll']){_0x2657a7[_0x5819('0x3e')]=[{'all':!![]}];}return db[_0x5819('0x3d')]['findAll'](_0x2657a7);})[_0x5819('0x23')](function(_0x30259a){_0x166555[_0x5819('0x3f')]=_0x30259a;return _0x166555;})['then'](respondWithFilteredResult(_0x26748c,_0x2657a7))['catch'](handleError(_0x26748c,null));};exports[_0x5819('0x40')]=function(_0x536408,_0x390ad5){var _0x1121d5={'raw':!![],'where':{'id':_0x536408[_0x5819('0x41')]['id']}},_0x2282d3={};_0x2282d3[_0x5819('0x2c')]=_[_0x5819('0x2d')](db[_0x5819('0x3d')]['rawAttributes']);_0x2282d3[_0x5819('0x2e')]=_[_0x5819('0x2d')](_0x536408['query']);_0x2282d3[_0x5819('0x36')]=_[_0x5819('0x2f')](_0x2282d3['model'],_0x2282d3[_0x5819('0x2e')]);_0x1121d5['attributes']=_[_0x5819('0x2f')](_0x2282d3[_0x5819('0x2c')],qs['fields'](_0x536408['query'][_0x5819('0x31')]));_0x1121d5[_0x5819('0x30')]=_0x1121d5['attributes'][_0x5819('0x42')]?_0x1121d5['attributes']:_0x2282d3[_0x5819('0x2c')];if(_0x536408[_0x5819('0x2e')]['includeAll']){_0x1121d5[_0x5819('0x3e')]=[{'all':!![]}];}_0x1121d5=_[_0x5819('0x38')]({},_0x1121d5,_0x536408['options']);return db[_0x5819('0x3d')][_0x5819('0x43')](_0x1121d5)[_0x5819('0x23')](handleEntityNotFound(_0x390ad5,null))[_0x5819('0x23')](respondWithResult(_0x390ad5,null))[_0x5819('0x44')](handleError(_0x390ad5,null));};exports['create']=function(_0x5e4a38,_0x301abf){return db['Template'][_0x5819('0x45')](_0x5e4a38[_0x5819('0x46')],{})[_0x5819('0x23')](function(_0x1ea3c9){var _0x298b18=_0x5e4a38['user']['get']({'plain':!![]});if(!_0x298b18)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x298b18[_0x5819('0x47')]===_0x5819('0x48')){var _0x265ea3=_0x1ea3c9[_0x5819('0x24')]({'plain':!![]});var _0x220e2a='Templates';return db[_0x5819('0x49')][_0x5819('0x43')]({'where':{'name':_0x220e2a,'userProfileId':_0x298b18[_0x5819('0x4a')]},'raw':!![]})['then'](function(_0x511411){if(_0x511411&&_0x511411['autoAssociation']===0x0){return db[_0x5819('0x26')][_0x5819('0x45')]({'name':_0x265ea3[_0x5819('0x29')],'resourceId':_0x265ea3['id'],'type':_0x511411[_0x5819('0x29')],'sectionId':_0x511411['id']},{})['then'](function(){return _0x1ea3c9;});}else{return _0x1ea3c9;}})[_0x5819('0x44')](function(_0x5616e8){logger['error'](_0x5819('0x4b'),_0x5616e8);throw _0x5616e8;});}return _0x1ea3c9;})[_0x5819('0x23')](respondWithResult(_0x301abf,0xc9))[_0x5819('0x44')](handleError(_0x301abf,null));};exports[_0x5819('0x22')]=function(_0x21db49,_0x542133){if(_0x21db49['body']['id']){delete _0x21db49[_0x5819('0x46')]['id'];}return db['Template'][_0x5819('0x43')]({'where':{'id':_0x21db49[_0x5819('0x41')]['id']}})['then'](handleEntityNotFound(_0x542133,null))[_0x5819('0x23')](saveUpdates(_0x21db49[_0x5819('0x46')],null))[_0x5819('0x23')](respondWithResult(_0x542133,null))[_0x5819('0x44')](handleError(_0x542133,null));};exports['destroy']=function(_0x3db1d6,_0x293159){return db[_0x5819('0x3d')][_0x5819('0x43')]({'where':{'id':_0x3db1d6[_0x5819('0x41')]['id']}})[_0x5819('0x23')](handleEntityNotFound(_0x293159,null))[_0x5819('0x23')](removeEntity(_0x293159,null))['catch'](handleError(_0x293159,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index b69d2d2..bae0a8e 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 _0xfc82=['define','Template','lodash','api','moment','bluebird','request-promise','exports'];(function(_0x3d7c33,_0x12845e){var _0x434ebe=function(_0x3ed6d6){while(--_0x3ed6d6){_0x3d7c33['push'](_0x3d7c33['shift']());}};_0x434ebe(++_0x12845e);}(_0xfc82,0x82));var _0x2fc8=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xfc82[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x2fc8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2fc8('0x1'));var moment=require(_0x2fc8('0x2'));var BPromise=require(_0x2fc8('0x3'));var rp=require(_0x2fc8('0x4'));var attributes=require('./template.attributes');module[_0x2fc8('0x5')]=function(_0x2959b6,_0x42f8a){return _0x2959b6[_0x2fc8('0x6')](_0x2fc8('0x7'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e73=['./template.attributes','exports','Template','tools_templates','util','../../config/logger','request-promise'];(function(_0x3bdec9,_0x434ef0){var _0x2ea187=function(_0x219ce6){while(--_0x219ce6){_0x3bdec9['push'](_0x3bdec9['shift']());}};_0x2ea187(++_0x434ef0);}(_0x2e73,0x169));var _0x32e7=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0x2e73[_0x249e96];return _0x17444c;};'use strict';var _=require('lodash');var util=require(_0x32e7('0x0'));var logger=require(_0x32e7('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x32e7('0x2'));var attributes=require(_0x32e7('0x3'));module[_0x32e7('0x4')]=function(_0x2a0dcd,_0x3a9b19){return _0x2a0dcd['define'](_0x32e7('0x5'),attributes,{'tableName':_0x32e7('0x6'),'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 ff4a68d..556f6bc 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 _0xf273=['then','lodash','moment','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x5b5af1,_0x1db01b){var _0x45ab7b=function(_0x1e353a){while(--_0x1e353a){_0x5b5af1['push'](_0x5b5af1['shift']());}};_0x45ab7b(++_0x1db01b);}(_0xf273,0x75));var _0x3f27=function(_0x37f40e,_0x5c5a1d){_0x37f40e=_0x37f40e-0x0;var _0x1bab3f=_0xf273[_0x37f40e];return _0x1bab3f;};'use strict';var _=require(_0x3f27('0x0'));var util=require('util');var moment=require(_0x3f27('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f27('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3f27('0x3'));var jayson=require(_0x3f27('0x4'));var client=jayson[_0x3f27('0x5')][_0x3f27('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x26e5d0,_0x51736a,_0x1bd766){return new BPromise(function(_0x8c4062,_0x474757){return client[_0x3f27('0x7')](_0x26e5d0,_0x1bd766)['then'](function(_0xf3c9af){logger[_0x3f27('0x8')](_0x3f27('0x9'),_0x51736a,_0x3f27('0xa'));logger[_0x3f27('0xb')](_0x3f27('0xc'),_0x51736a,'request\x20sent',JSON[_0x3f27('0xd')](_0xf3c9af));if(_0xf3c9af['error']){if(_0xf3c9af['error']['code']===0x1f4){logger[_0x3f27('0xe')](_0x3f27('0x9'),_0x51736a,_0xf3c9af[_0x3f27('0xe')][_0x3f27('0xf')]);return _0x474757(_0xf3c9af['error'][_0x3f27('0xf')]);}logger[_0x3f27('0xe')]('Template,\x20%s,\x20%s',_0x51736a,_0xf3c9af[_0x3f27('0xe')]['message']);return _0x8c4062(_0xf3c9af['error'][_0x3f27('0xf')]);}else{logger['info'](_0x3f27('0x9'),_0x51736a,_0x3f27('0xa'));_0x8c4062(_0xf3c9af['result'][_0x3f27('0xf')]);}})[_0x3f27('0x10')](function(_0x15f7b6){logger[_0x3f27('0xe')](_0x3f27('0x9'),_0x51736a,_0x15f7b6);_0x474757(_0x15f7b6);});});}exports[_0x3f27('0x11')]=function(_0x47427b){var _0x47efd9=this;return new Promise(function(_0x48d2ac,_0x40857c){return db[_0x3f27('0x12')][_0x3f27('0x13')]({'raw':_0x47427b[_0x3f27('0x14')]?_0x47427b[_0x3f27('0x14')][_0x3f27('0x15')]===undefined?!![]:![]:!![],'where':_0x47427b[_0x3f27('0x14')]?_0x47427b['options'][_0x3f27('0x16')]||null:null,'attributes':_0x47427b[_0x3f27('0x14')]?_0x47427b[_0x3f27('0x14')][_0x3f27('0x17')]||null:null,'limit':_0x47427b[_0x3f27('0x14')]?_0x47427b[_0x3f27('0x14')][_0x3f27('0x18')]||null:null,'include':_0x47427b[_0x3f27('0x14')]?_0x47427b['options'][_0x3f27('0x19')]?_[_0x3f27('0x1a')](_0x47427b['options']['include'],function(_0x361ed9){return{'model':db[_0x361ed9[_0x3f27('0x1b')]],'as':_0x361ed9['as'],'attributes':_0x361ed9['attributes'],'include':_0x361ed9[_0x3f27('0x19')]?_[_0x3f27('0x1a')](_0x361ed9[_0x3f27('0x19')],function(_0x494a3c){return{'model':db[_0x494a3c[_0x3f27('0x1b')]],'as':_0x494a3c['as'],'attributes':_0x494a3c[_0x3f27('0x17')],'include':_0x494a3c['include']?_[_0x3f27('0x1a')](_0x494a3c['include'],function(_0x6d7bf1){return{'model':db[_0x6d7bf1[_0x3f27('0x1b')]],'as':_0x6d7bf1['as'],'attributes':_0x6d7bf1['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f27('0x1c')](function(_0x550fc6){logger[_0x3f27('0x8')]('GetTemplate',_0x47427b);logger[_0x3f27('0xb')](_0x3f27('0x11'),_0x47427b,JSON[_0x3f27('0xd')](_0x550fc6));_0x48d2ac(_0x550fc6);})[_0x3f27('0x10')](function(_0x3521d7){logger[_0x3f27('0xe')](_0x3f27('0x11'),_0x3521d7[_0x3f27('0xf')],_0x47427b);_0x40857c(_0x47efd9[_0x3f27('0xe')](0x1f4,_0x3521d7['message']));});});}; \ No newline at end of file +var _0x64d4=['jayson/promise','http','request','then','info','request\x20sent','debug','error','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','options','where','attributes','limit','include','map','model','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x185974,_0x1deaf9){var _0xf91fa7=function(_0x3814a7){while(--_0x3814a7){_0x185974['push'](_0x185974['shift']());}};_0xf91fa7(++_0x1deaf9);}(_0x64d4,0x12d));var _0x464d=function(_0x1f79bb,_0x402fb7){_0x1f79bb=_0x1f79bb-0x0;var _0x4ad987=_0x64d4[_0x1f79bb];return _0x4ad987;};'use strict';var _=require('lodash');var util=require(_0x464d('0x0'));var moment=require('moment');var BPromise=require(_0x464d('0x1'));var rs=require(_0x464d('0x2'));var fs=require('fs');var Redis=require(_0x464d('0x3'));var db=require(_0x464d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x464d('0x5'));var config=require(_0x464d('0x6'));var jayson=require(_0x464d('0x7'));var client=jayson['client'][_0x464d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a56ea,_0x36ca94,_0x40290f){return new BPromise(function(_0x4fc89b,_0xd1fdec){return client[_0x464d('0x9')](_0x5a56ea,_0x40290f)[_0x464d('0xa')](function(_0x14c14f){logger[_0x464d('0xb')]('Template,\x20%s,\x20%s',_0x36ca94,_0x464d('0xc'));logger[_0x464d('0xd')]('Template,\x20%s,\x20%s,\x20%s',_0x36ca94,_0x464d('0xc'),JSON['stringify'](_0x14c14f));if(_0x14c14f[_0x464d('0xe')]){if(_0x14c14f['error']['code']===0x1f4){logger['error'](_0x464d('0xf'),_0x36ca94,_0x14c14f[_0x464d('0xe')][_0x464d('0x10')]);return _0xd1fdec(_0x14c14f['error'][_0x464d('0x10')]);}logger['error'](_0x464d('0xf'),_0x36ca94,_0x14c14f[_0x464d('0xe')][_0x464d('0x10')]);return _0x4fc89b(_0x14c14f['error'][_0x464d('0x10')]);}else{logger[_0x464d('0xb')](_0x464d('0xf'),_0x36ca94,_0x464d('0xc'));_0x4fc89b(_0x14c14f[_0x464d('0x11')][_0x464d('0x10')]);}})[_0x464d('0x12')](function(_0x5ea734){logger['error'](_0x464d('0xf'),_0x36ca94,_0x5ea734);_0xd1fdec(_0x5ea734);});});}exports[_0x464d('0x13')]=function(_0x5407d0){var _0x1ac848=this;return new Promise(function(_0xa47e1e,_0x23f467){return db['Template']['findAll']({'raw':_0x5407d0[_0x464d('0x14')]?_0x5407d0[_0x464d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5407d0[_0x464d('0x14')]?_0x5407d0[_0x464d('0x14')][_0x464d('0x15')]||null:null,'attributes':_0x5407d0['options']?_0x5407d0['options'][_0x464d('0x16')]||null:null,'limit':_0x5407d0['options']?_0x5407d0['options'][_0x464d('0x17')]||null:null,'include':_0x5407d0[_0x464d('0x14')]?_0x5407d0[_0x464d('0x14')][_0x464d('0x18')]?_['map'](_0x5407d0[_0x464d('0x14')]['include'],function(_0x378319){return{'model':db[_0x378319['model']],'as':_0x378319['as'],'attributes':_0x378319[_0x464d('0x16')],'include':_0x378319[_0x464d('0x18')]?_[_0x464d('0x19')](_0x378319['include'],function(_0xf672c5){return{'model':db[_0xf672c5[_0x464d('0x1a')]],'as':_0xf672c5['as'],'attributes':_0xf672c5[_0x464d('0x16')],'include':_0xf672c5[_0x464d('0x18')]?_['map'](_0xf672c5[_0x464d('0x18')],function(_0x3fa738){return{'model':db[_0x3fa738[_0x464d('0x1a')]],'as':_0x3fa738['as'],'attributes':_0x3fa738['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59e190){logger[_0x464d('0xb')](_0x464d('0x13'),_0x5407d0);logger['debug'](_0x464d('0x13'),_0x5407d0,JSON[_0x464d('0x1b')](_0x59e190));_0xa47e1e(_0x59e190);})[_0x464d('0x12')](function(_0x3aa93b){logger[_0x464d('0xe')](_0x464d('0x13'),_0x3aa93b[_0x464d('0x10')],_0x5407d0);_0x23f467(_0x1ac848['error'](0x1f4,_0x3aa93b[_0x464d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 089f8b2..6812ca8 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 _0x570b=['../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id/all_conditions','getAllConditions','/:id/any_conditions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','put','/:id','update','delete','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x404c05,_0x3c8fdf){var _0x566b41=function(_0x3e71cb){while(--_0x3e71cb){_0x404c05['push'](_0x404c05['shift']());}};_0x566b41(++_0x3c8fdf);}(_0x570b,0x17a));var _0xb570=function(_0x3fd065,_0x112ccf){_0x3fd065=_0x3fd065-0x0;var _0x58c084=_0x570b[_0x3fd065];return _0x58c084;};'use strict';var multer=require(_0xb570('0x0'));var util=require(_0xb570('0x1'));var path=require(_0xb570('0x2'));var timeout=require(_0xb570('0x3'));var express=require('express');var router=express[_0xb570('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb570('0x5'));var config=require(_0xb570('0x6'));var controller=require(_0xb570('0x7'));router[_0xb570('0x8')]('/',auth[_0xb570('0x9')](),controller[_0xb570('0xa')]);router[_0xb570('0x8')]('/:id',auth[_0xb570('0x9')](),controller['show']);router[_0xb570('0x8')](_0xb570('0xb'),auth[_0xb570('0x9')](),controller[_0xb570('0xc')]);router['get'](_0xb570('0xd'),auth[_0xb570('0x9')](),controller['getAnyConditions']);router[_0xb570('0x8')]('/:id/actions',auth[_0xb570('0x9')](),controller['getActions']);router[_0xb570('0xe')]('/',auth['isAuthenticated'](),controller[_0xb570('0xf')]);router['post'](_0xb570('0xb'),auth['isAuthenticated'](),controller[_0xb570('0x10')]);router['post']('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xb570('0x11')]);router[_0xb570('0xe')](_0xb570('0x12'),auth[_0xb570('0x9')](),controller[_0xb570('0x13')]);router[_0xb570('0x14')](_0xb570('0x15'),auth[_0xb570('0x9')](),controller[_0xb570('0x16')]);router[_0xb570('0x17')](_0xb570('0x15'),auth[_0xb570('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcbfb=['isAuthenticated','index','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','post','create','addAnyCondition','addAction','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbfb,0xb0));var _0xbcbf=function(_0x34c71c,_0xa5ea4d){_0x34c71c=_0x34c71c-0x0;var _0x470b01=_0xcbfb[_0x34c71c];return _0x470b01;};'use strict';var multer=require(_0xbcbf('0x0'));var util=require(_0xbcbf('0x1'));var path=require(_0xbcbf('0x2'));var timeout=require('connect-timeout');var express=require(_0xbcbf('0x3'));var router=express[_0xbcbf('0x4')]();var auth=require(_0xbcbf('0x5'));var interaction=require(_0xbcbf('0x6'));var config=require(_0xbcbf('0x7'));var controller=require('./trigger.controller');router['get']('/',auth[_0xbcbf('0x8')](),controller[_0xbcbf('0x9')]);router[_0xbcbf('0xa')](_0xbcbf('0xb'),auth[_0xbcbf('0x8')](),controller[_0xbcbf('0xc')]);router[_0xbcbf('0xa')](_0xbcbf('0xd'),auth[_0xbcbf('0x8')](),controller[_0xbcbf('0xe')]);router[_0xbcbf('0xa')](_0xbcbf('0xf'),auth[_0xbcbf('0x8')](),controller['getAnyConditions']);router[_0xbcbf('0xa')]('/:id/actions',auth[_0xbcbf('0x8')](),controller['getActions']);router[_0xbcbf('0x10')]('/',auth[_0xbcbf('0x8')](),controller[_0xbcbf('0x11')]);router['post'](_0xbcbf('0xd'),auth[_0xbcbf('0x8')](),controller['addAllCondition']);router[_0xbcbf('0x10')](_0xbcbf('0xf'),auth[_0xbcbf('0x8')](),controller[_0xbcbf('0x12')]);router[_0xbcbf('0x10')]('/:id/actions',auth[_0xbcbf('0x8')](),controller[_0xbcbf('0x13')]);router['put'](_0xbcbf('0xb'),auth[_0xbcbf('0x8')](),controller['update']);router[_0xbcbf('0x14')](_0xbcbf('0xb'),auth[_0xbcbf('0x8')](),controller[_0xbcbf('0x15')]);module[_0xbcbf('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index d6419f7..1c573a6 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 _0x7773=['sequelize','STRING','BOOLEAN'];(function(_0x38250c,_0x5c31f3){var _0x359df7=function(_0x4eefa6){while(--_0x4eefa6){_0x38250c['push'](_0x38250c['shift']());}};_0x359df7(++_0x5c31f3);}(_0x7773,0x1e0));var _0x3777=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7773[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x3777('0x0'));module['exports']={'name':{'type':Sequelize[_0x3777('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3777('0x1')]},'status':{'type':Sequelize[_0x3777('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc055=['sequelize','exports','STRING'];(function(_0x4cf8f3,_0x3b9e86){var _0x4f2469=function(_0x42858e){while(--_0x42858e){_0x4cf8f3['push'](_0x4cf8f3['shift']());}};_0x4f2469(++_0x3b9e86);}(_0xc055,0x129));var _0x5c05=function(_0x4befae,_0x55b079){_0x4befae=_0x4befae-0x0;var _0x76c573=_0xc055[_0x4befae];return _0x76c573;};'use strict';var Sequelize=require(_0x5c05('0x0'));module[_0x5c05('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5c05('0x2')]},'description':{'type':Sequelize[_0x5c05('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 c826e1b..a5560e8 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 _0x0b41=['body','addAllCondition','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','addAction','getActions','Action','html-pdf','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','Trigger','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','filter','include','findAll','catch','show','params','includeAll','options','find','create','user','role','UserProfileSection','autoAssociation'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0x0b41,0x163));var _0x10b4=function(_0x379898,_0x485213){_0x379898=_0x379898-0x0;var _0x48a73b=_0x0b41[_0x379898];return _0x48a73b;};'use strict';var pdf=require(_0x10b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x10b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10b4('0x2'));var rp=require('request-promise');var moment=require(_0x10b4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x10b4('0x4'));var util=require(_0x10b4('0x5'));var path=require('path');var sox=require(_0x10b4('0x6'));var csv=require(_0x10b4('0x7'));var ejs=require(_0x10b4('0x8'));var fs=require('fs');var _=require(_0x10b4('0x9'));var squel=require(_0x10b4('0xa'));var crypto=require(_0x10b4('0xb'));var jsforce=require(_0x10b4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x10b4('0x7'));var querystring=require('querystring');var Papa=require(_0x10b4('0xd'));var authService=require(_0x10b4('0xe'));var hardwareService=require(_0x10b4('0xf'));var Redis=require(_0x10b4('0x10'));var qs=require(_0x10b4('0x11'));var logger=require(_0x10b4('0x12'))('api');var utils=require(_0x10b4('0x13'));var config=require(_0x10b4('0x14'));var db=require(_0x10b4('0x15'))['db'];function respondWithStatusCode(_0x5f3b85,_0x2d22a9){_0x2d22a9=_0x2d22a9||0xcc;return function(_0x216418){if(_0x216418){return _0x5f3b85[_0x10b4('0x16')](_0x2d22a9);}return _0x5f3b85['status'](_0x2d22a9)[_0x10b4('0x17')]();};}function respondWithResult(_0x371ba2,_0x1209af){_0x1209af=_0x1209af||0xc8;return function(_0x58f13a){if(_0x58f13a){return _0x371ba2[_0x10b4('0x18')](_0x1209af)[_0x10b4('0x19')](_0x58f13a);}};}function respondWithFilteredResult(_0x4f9533,_0x5a22c0){return function(_0x3a7fdf){if(_0x3a7fdf){var _0x2d95a5=_0x3a7fdf[_0x10b4('0x1a')],_0x2a2986=_0x5a22c0[_0x10b4('0x1b')],_0x5030ea=_0x5a22c0[_0x10b4('0x1b')]+_0x5a22c0['limit'],_0x5bf942;if(_0x5030ea>=_0x2d95a5){_0x5030ea=_0x2d95a5;_0x5bf942=0xc8;}else{_0x5bf942=0xce;}_0x4f9533['status'](_0x5bf942);return _0x4f9533[_0x10b4('0x1c')](_0x10b4('0x1d'),_0x2a2986+'-'+_0x5030ea+'/'+_0x2d95a5)[_0x10b4('0x19')](_0x3a7fdf);}return null;};}function patchUpdates(_0x10efb4){return function(_0x59aefb){try{jsonpatch[_0x10b4('0x1e')](_0x59aefb,_0x10efb4,!![]);}catch(_0x6a3cdc){return BPromise['reject'](_0x6a3cdc);}return _0x59aefb[_0x10b4('0x1f')]();};}function saveUpdates(_0x45d7e1,_0x235ac8){return function(_0x28c5dd){if(_0x28c5dd){return _0x28c5dd[_0x10b4('0x20')](_0x45d7e1)[_0x10b4('0x21')](function(_0x352117){return _0x352117;});}return null;};}function removeEntity(_0x33733d,_0x405440){return function(_0x14aaa3){if(_0x14aaa3){return _0x14aaa3[_0x10b4('0x22')]()[_0x10b4('0x21')](function(){var _0x183799=_0x14aaa3[_0x10b4('0x23')]({'plain':!![]});var _0x39af27=_0x10b4('0x24');return db[_0x10b4('0x25')][_0x10b4('0x22')]({'where':{'type':_0x39af27,'resourceId':_0x183799['id']}})[_0x10b4('0x21')](function(){return _0x14aaa3;});})[_0x10b4('0x21')](function(){_0x33733d[_0x10b4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x912fab,_0x377a37){return function(_0x27ded1){if(!_0x27ded1){_0x912fab[_0x10b4('0x16')](0x194);}return _0x27ded1;};}function handleError(_0x5b74a7,_0x39148d){_0x39148d=_0x39148d||0x1f4;return function(_0xfe5538){logger[_0x10b4('0x26')](_0xfe5538[_0x10b4('0x27')]);if(_0xfe5538['name']){delete _0xfe5538[_0x10b4('0x28')];}_0x5b74a7[_0x10b4('0x18')](_0x39148d)[_0x10b4('0x29')](_0xfe5538);};}exports['index']=function(_0x579072,_0x3b9276){var _0xf7782b={},_0x590307={},_0x4da169={'count':0x0,'rows':[]};var _0xab7ef7=db[_0x10b4('0x2a')][_0x10b4('0x2b')];_0x590307[_0x10b4('0x2c')]=_['keys'](_0xab7ef7);_0x590307[_0x10b4('0x2d')]=_[_0x10b4('0x2e')](_0x579072[_0x10b4('0x2d')]);_0x590307[_0x10b4('0x2f')]=_[_0x10b4('0x30')](_0x590307[_0x10b4('0x2c')],_0x590307[_0x10b4('0x2d')]);_0xf7782b[_0x10b4('0x31')]=_[_0x10b4('0x30')](_0x590307[_0x10b4('0x2c')],qs[_0x10b4('0x32')](_0x579072['query'][_0x10b4('0x32')]));_0xf7782b[_0x10b4('0x31')]=_0xf7782b[_0x10b4('0x31')][_0x10b4('0x33')]?_0xf7782b[_0x10b4('0x31')]:_0x590307[_0x10b4('0x2c')];if(!_0x579072[_0x10b4('0x2d')][_0x10b4('0x34')](_0x10b4('0x35'))){_0xf7782b[_0x10b4('0x36')]=qs[_0x10b4('0x36')](_0x579072['query'][_0x10b4('0x36')]);_0xf7782b[_0x10b4('0x1b')]=qs[_0x10b4('0x1b')](_0x579072[_0x10b4('0x2d')]['offset']);}_0xf7782b[_0x10b4('0x37')]=qs[_0x10b4('0x38')](_0x579072['query']['sort']);_0xf7782b[_0x10b4('0x39')]=qs['filters'](_[_0x10b4('0x3a')](_0x579072['query'],_0x590307[_0x10b4('0x2f')]));if(_0x579072[_0x10b4('0x2d')]['filter']){_0xf7782b['where']=_[_0x10b4('0x3b')](_0xf7782b[_0x10b4('0x39')],{'$or':_['map'](_0xab7ef7,function(_0x463f50){if(_0x463f50[_0x10b4('0x3c')]['key']!=='VIRTUAL'){var _0x19698d={};_0x19698d[_0x463f50['field']]={'$like':'%'+_0x579072[_0x10b4('0x2d')][_0x10b4('0x3d')]+'%'};return _0x19698d;}})});}_0xf7782b=_[_0x10b4('0x3b')]({},_0xf7782b,_0x579072['options']);var _0x2394bc={'where':_0xf7782b[_0x10b4('0x39')]};return db[_0x10b4('0x2a')]['count'](_0x2394bc)['then'](function(_0xcd9558){_0x4da169[_0x10b4('0x1a')]=_0xcd9558;if(_0x579072[_0x10b4('0x2d')]['includeAll']){_0xf7782b[_0x10b4('0x3e')]=[{'all':!![]}];}return db['Trigger'][_0x10b4('0x3f')](_0xf7782b);})[_0x10b4('0x21')](function(_0x51eadd){_0x4da169['rows']=_0x51eadd;return _0x4da169;})[_0x10b4('0x21')](respondWithFilteredResult(_0x3b9276,_0xf7782b))[_0x10b4('0x40')](handleError(_0x3b9276,null));};exports[_0x10b4('0x41')]=function(_0x4a50ab,_0x35159a){var _0x3d6304={'raw':![],'where':{'id':_0x4a50ab[_0x10b4('0x42')]['id']}},_0x3da129={};_0x3da129[_0x10b4('0x2c')]=_[_0x10b4('0x2e')](db['Trigger'][_0x10b4('0x2b')]);_0x3da129[_0x10b4('0x2d')]=_[_0x10b4('0x2e')](_0x4a50ab[_0x10b4('0x2d')]);_0x3da129[_0x10b4('0x2f')]=_[_0x10b4('0x30')](_0x3da129['model'],_0x3da129[_0x10b4('0x2d')]);_0x3d6304[_0x10b4('0x31')]=_['intersection'](_0x3da129['model'],qs[_0x10b4('0x32')](_0x4a50ab[_0x10b4('0x2d')][_0x10b4('0x32')]));_0x3d6304[_0x10b4('0x31')]=_0x3d6304[_0x10b4('0x31')][_0x10b4('0x33')]?_0x3d6304[_0x10b4('0x31')]:_0x3da129[_0x10b4('0x2c')];if(_0x4a50ab[_0x10b4('0x2d')][_0x10b4('0x43')]){_0x3d6304['include']=[{'all':!![]}];}_0x3d6304=_['merge']({},_0x3d6304,_0x4a50ab[_0x10b4('0x44')]);return db[_0x10b4('0x2a')][_0x10b4('0x45')](_0x3d6304)['then'](handleEntityNotFound(_0x35159a,null))['then'](respondWithResult(_0x35159a,null))[_0x10b4('0x40')](handleError(_0x35159a,null));};exports[_0x10b4('0x46')]=function(_0x1a3fa5,_0x377bef){return db[_0x10b4('0x2a')]['create'](_0x1a3fa5['body'],{})[_0x10b4('0x21')](function(_0xdf9335){var _0x1fc816=_0x1a3fa5[_0x10b4('0x47')][_0x10b4('0x23')]({'plain':!![]});if(!_0x1fc816)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fc816[_0x10b4('0x48')]===_0x10b4('0x47')){var _0x5629cd=_0xdf9335['get']({'plain':!![]});var _0xf5c0af=_0x10b4('0x24');return db[_0x10b4('0x49')][_0x10b4('0x45')]({'where':{'name':_0xf5c0af,'userProfileId':_0x1fc816['userProfileId']},'raw':!![]})[_0x10b4('0x21')](function(_0x227087){if(_0x227087&&_0x227087[_0x10b4('0x4a')]===0x0){return db[_0x10b4('0x25')][_0x10b4('0x46')]({'name':_0x5629cd['name'],'resourceId':_0x5629cd['id'],'type':_0x227087[_0x10b4('0x28')],'sectionId':_0x227087['id']},{})[_0x10b4('0x21')](function(){return _0xdf9335;});}else{return _0xdf9335;}})[_0x10b4('0x40')](function(_0x2eaa99){logger[_0x10b4('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2eaa99);throw _0x2eaa99;});}return _0xdf9335;})[_0x10b4('0x21')](respondWithResult(_0x377bef,0xc9))[_0x10b4('0x40')](handleError(_0x377bef,null));};exports[_0x10b4('0x20')]=function(_0x3873d6,_0x3f2a63){if(_0x3873d6['body']['id']){delete _0x3873d6[_0x10b4('0x4b')]['id'];}return db[_0x10b4('0x2a')][_0x10b4('0x45')]({'where':{'id':_0x3873d6[_0x10b4('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f2a63,null))['then'](saveUpdates(_0x3873d6[_0x10b4('0x4b')],null))[_0x10b4('0x21')](respondWithResult(_0x3f2a63,null))[_0x10b4('0x40')](handleError(_0x3f2a63,null));};exports[_0x10b4('0x22')]=function(_0x48cb72,_0x53a17e){return db[_0x10b4('0x2a')][_0x10b4('0x45')]({'where':{'id':_0x48cb72[_0x10b4('0x42')]['id']}})[_0x10b4('0x21')](handleEntityNotFound(_0x53a17e,null))['then'](removeEntity(_0x53a17e,null))[_0x10b4('0x40')](handleError(_0x53a17e,null));};exports[_0x10b4('0x4c')]=function(_0x284266,_0x8b2bc2,_0x539317){if(_0x284266[_0x10b4('0x4b')]['id']){delete _0x284266[_0x10b4('0x4b')]['id'];}return db['Trigger']['find']({'where':{'id':_0x284266[_0x10b4('0x42')]['id']}})[_0x10b4('0x21')](handleEntityNotFound(_0x8b2bc2,null))[_0x10b4('0x21')](function(_0x1cb10a){if(_0x1cb10a){_0x284266[_0x10b4('0x4b')]['TriggerAllId']=_0x1cb10a['id'];return db['Condition'][_0x10b4('0x46')](_0x284266['body']);}})[_0x10b4('0x21')](respondWithResult(_0x8b2bc2,null))['catch'](handleError(_0x8b2bc2,null));};exports[_0x10b4('0x4d')]=function(_0x476cd3,_0xbc6bff,_0x3506c4){if(_0x476cd3[_0x10b4('0x4b')]['id']){delete _0x476cd3['body']['id'];}return db[_0x10b4('0x2a')][_0x10b4('0x45')]({'where':{'id':_0x476cd3['params']['id']}})[_0x10b4('0x21')](handleEntityNotFound(_0xbc6bff,null))[_0x10b4('0x21')](function(_0x706399){if(_0x706399){_0x476cd3[_0x10b4('0x4b')][_0x10b4('0x4e')]=_0x706399['id'];return db[_0x10b4('0x4f')][_0x10b4('0x46')](_0x476cd3[_0x10b4('0x4b')]);}})[_0x10b4('0x21')](respondWithResult(_0xbc6bff,null))['catch'](handleError(_0xbc6bff,null));};exports[_0x10b4('0x50')]=function(_0x23e26c,_0x25a304,_0x2f99e0){var _0x7277c0={};var _0x284dd1={};var _0xde8a5d;var _0x2c3549;return db[_0x10b4('0x2a')][_0x10b4('0x51')]({'where':{'id':_0x23e26c[_0x10b4('0x42')]['id']}})[_0x10b4('0x21')](handleEntityNotFound(_0x25a304,null))[_0x10b4('0x21')](function(_0x494940){if(_0x494940){_0xde8a5d=_0x494940;_0x284dd1[_0x10b4('0x2c')]=_['keys'](db['Condition'][_0x10b4('0x2b')]);_0x284dd1[_0x10b4('0x2d')]=_[_0x10b4('0x2e')](_0x23e26c['query']);_0x284dd1['filters']=_['intersection'](_0x284dd1[_0x10b4('0x2c')],_0x284dd1[_0x10b4('0x2d')]);_0x7277c0['attributes']=_[_0x10b4('0x30')](_0x284dd1['model'],qs[_0x10b4('0x32')](_0x23e26c[_0x10b4('0x2d')]['fields']));_0x7277c0[_0x10b4('0x31')]=_0x7277c0[_0x10b4('0x31')][_0x10b4('0x33')]?_0x7277c0[_0x10b4('0x31')]:_0x284dd1[_0x10b4('0x2c')];_0x7277c0[_0x10b4('0x37')]=qs['sort'](_0x23e26c[_0x10b4('0x2d')][_0x10b4('0x38')]);_0x7277c0['where']=qs[_0x10b4('0x2f')](_[_0x10b4('0x3a')](_0x23e26c[_0x10b4('0x2d')],_0x284dd1[_0x10b4('0x2f')]));if(_0x23e26c[_0x10b4('0x2d')][_0x10b4('0x3d')]){_0x7277c0['where']=_[_0x10b4('0x3b')](_0x7277c0[_0x10b4('0x39')],{'$or':_['map'](_0x7277c0[_0x10b4('0x31')],function(_0x4d75b5){var _0x5954c7={};_0x5954c7[_0x4d75b5]={'$like':'%'+_0x23e26c['query'][_0x10b4('0x3d')]+'%'};return _0x5954c7;})});}_0x7277c0=_[_0x10b4('0x3b')]({},_0x7277c0,_0x23e26c[_0x10b4('0x44')]);return _0xde8a5d[_0x10b4('0x50')](_0x7277c0);}})['then'](function(_0x4381c5){if(_0x4381c5){_0x2c3549=_0x4381c5['length'];if(!_0x23e26c[_0x10b4('0x2d')][_0x10b4('0x34')](_0x10b4('0x35'))){_0x7277c0['limit']=qs[_0x10b4('0x36')](_0x23e26c[_0x10b4('0x2d')][_0x10b4('0x36')]);_0x7277c0['offset']=qs[_0x10b4('0x1b')](_0x23e26c[_0x10b4('0x2d')][_0x10b4('0x1b')]);}return _0xde8a5d[_0x10b4('0x50')](_0x7277c0);}})['then'](function(_0x2dc768){if(_0x2dc768){return _0x2dc768?{'count':_0x2c3549,'rows':_0x2dc768}:null;}})[_0x10b4('0x21')](respondWithResult(_0x25a304,null))[_0x10b4('0x40')](handleError(_0x25a304,null));};exports[_0x10b4('0x52')]=function(_0x13f795,_0x347071,_0x2c7755){var _0x25bd44={};var _0xb5de83={};var _0x316068;var _0x37483;return db[_0x10b4('0x2a')]['findOne']({'where':{'id':_0x13f795[_0x10b4('0x42')]['id']}})[_0x10b4('0x21')](handleEntityNotFound(_0x347071,null))[_0x10b4('0x21')](function(_0x138d3e){if(_0x138d3e){_0x316068=_0x138d3e;_0xb5de83[_0x10b4('0x2c')]=_['keys'](db[_0x10b4('0x4f')][_0x10b4('0x2b')]);_0xb5de83[_0x10b4('0x2d')]=_[_0x10b4('0x2e')](_0x13f795['query']);_0xb5de83[_0x10b4('0x2f')]=_['intersection'](_0xb5de83[_0x10b4('0x2c')],_0xb5de83[_0x10b4('0x2d')]);_0x25bd44[_0x10b4('0x31')]=_[_0x10b4('0x30')](_0xb5de83[_0x10b4('0x2c')],qs['fields'](_0x13f795['query']['fields']));_0x25bd44[_0x10b4('0x31')]=_0x25bd44[_0x10b4('0x31')]['length']?_0x25bd44['attributes']:_0xb5de83[_0x10b4('0x2c')];_0x25bd44[_0x10b4('0x37')]=qs['sort'](_0x13f795[_0x10b4('0x2d')]['sort']);_0x25bd44[_0x10b4('0x39')]=qs[_0x10b4('0x2f')](_['pick'](_0x13f795['query'],_0xb5de83[_0x10b4('0x2f')]));if(_0x13f795[_0x10b4('0x2d')][_0x10b4('0x3d')]){_0x25bd44[_0x10b4('0x39')]=_['merge'](_0x25bd44[_0x10b4('0x39')],{'$or':_['map'](_0x25bd44['attributes'],function(_0x4412c3){var _0x58d74a={};_0x58d74a[_0x4412c3]={'$like':'%'+_0x13f795[_0x10b4('0x2d')][_0x10b4('0x3d')]+'%'};return _0x58d74a;})});}_0x25bd44=_[_0x10b4('0x3b')]({},_0x25bd44,_0x13f795[_0x10b4('0x44')]);return _0x316068[_0x10b4('0x52')](_0x25bd44);}})['then'](function(_0x1bf6a8){if(_0x1bf6a8){_0x37483=_0x1bf6a8[_0x10b4('0x33')];if(!_0x13f795[_0x10b4('0x2d')][_0x10b4('0x34')](_0x10b4('0x35'))){_0x25bd44[_0x10b4('0x36')]=qs[_0x10b4('0x36')](_0x13f795[_0x10b4('0x2d')][_0x10b4('0x36')]);_0x25bd44['offset']=qs[_0x10b4('0x1b')](_0x13f795[_0x10b4('0x2d')]['offset']);}return _0x316068['getAnyConditions'](_0x25bd44);}})['then'](function(_0x368123){if(_0x368123){return _0x368123?{'count':_0x37483,'rows':_0x368123}:null;}})[_0x10b4('0x21')](respondWithResult(_0x347071,null))[_0x10b4('0x40')](handleError(_0x347071,null));};exports[_0x10b4('0x53')]=function(_0x5e04e6,_0x2439f6,_0x39e877){if(_0x5e04e6['body']['id']){delete _0x5e04e6[_0x10b4('0x4b')]['id'];}return db[_0x10b4('0x2a')][_0x10b4('0x45')]({'where':{'id':_0x5e04e6['params']['id']}})[_0x10b4('0x21')](handleEntityNotFound(_0x2439f6,null))[_0x10b4('0x21')](function(_0x149736){if(_0x149736){_0x5e04e6[_0x10b4('0x4b')]['TriggerId']=_0x149736['id'];return db['Action'][_0x10b4('0x46')](_0x5e04e6['body']);}})[_0x10b4('0x21')](respondWithResult(_0x2439f6,null))['catch'](handleError(_0x2439f6,null));};exports[_0x10b4('0x54')]=function(_0x1107cd,_0x113d9e,_0x223c5c){var _0x1cee4a={};var _0xdab0ad={};var _0x910960;var _0xdf457c;return db['Trigger'][_0x10b4('0x51')]({'where':{'id':_0x1107cd[_0x10b4('0x42')]['id']}})[_0x10b4('0x21')](handleEntityNotFound(_0x113d9e,null))['then'](function(_0x2c2200){if(_0x2c2200){_0x910960=_0x2c2200;_0xdab0ad['model']=_['keys'](db[_0x10b4('0x55')][_0x10b4('0x2b')]);_0xdab0ad[_0x10b4('0x2d')]=_['keys'](_0x1107cd[_0x10b4('0x2d')]);_0xdab0ad[_0x10b4('0x2f')]=_[_0x10b4('0x30')](_0xdab0ad[_0x10b4('0x2c')],_0xdab0ad[_0x10b4('0x2d')]);_0x1cee4a[_0x10b4('0x31')]=_[_0x10b4('0x30')](_0xdab0ad[_0x10b4('0x2c')],qs['fields'](_0x1107cd[_0x10b4('0x2d')][_0x10b4('0x32')]));_0x1cee4a['attributes']=_0x1cee4a['attributes'][_0x10b4('0x33')]?_0x1cee4a[_0x10b4('0x31')]:_0xdab0ad[_0x10b4('0x2c')];_0x1cee4a[_0x10b4('0x37')]=qs[_0x10b4('0x38')](_0x1107cd['query'][_0x10b4('0x38')]);_0x1cee4a['where']=qs[_0x10b4('0x2f')](_[_0x10b4('0x3a')](_0x1107cd[_0x10b4('0x2d')],_0xdab0ad[_0x10b4('0x2f')]));if(_0x1107cd[_0x10b4('0x2d')][_0x10b4('0x3d')]){_0x1cee4a[_0x10b4('0x39')]=_[_0x10b4('0x3b')](_0x1cee4a[_0x10b4('0x39')],{'$or':_['map'](_0x1cee4a['attributes'],function(_0x1fb6c0){var _0x9beb73={};_0x9beb73[_0x1fb6c0]={'$like':'%'+_0x1107cd[_0x10b4('0x2d')]['filter']+'%'};return _0x9beb73;})});}_0x1cee4a=_[_0x10b4('0x3b')]({},_0x1cee4a,_0x1107cd['options']);return _0x910960['getActions'](_0x1cee4a);}})[_0x10b4('0x21')](function(_0x49200c){if(_0x49200c){_0xdf457c=_0x49200c['length'];if(!_0x1107cd[_0x10b4('0x2d')][_0x10b4('0x34')]('nolimit')){_0x1cee4a[_0x10b4('0x36')]=qs['limit'](_0x1107cd[_0x10b4('0x2d')][_0x10b4('0x36')]);_0x1cee4a['offset']=qs[_0x10b4('0x1b')](_0x1107cd[_0x10b4('0x2d')][_0x10b4('0x1b')]);}return _0x910960[_0x10b4('0x54')](_0x1cee4a);}})[_0x10b4('0x21')](function(_0x32614e){if(_0x32614e){return _0x32614e?{'count':_0xdf457c,'rows':_0x32614e}:null;}})[_0x10b4('0x21')](respondWithResult(_0x113d9e,null))[_0x10b4('0x40')](handleError(_0x113d9e,null));}; \ No newline at end of file +var _0x41b1=['filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','map','getAnyConditions','nolimit','addAction','TriggerId','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','name','send','index','Trigger','rawAttributes','model','keys','query'];(function(_0x49c13b,_0x3c63a2){var _0x22262b=function(_0x12937c){while(--_0x12937c){_0x49c13b['push'](_0x49c13b['shift']());}};_0x22262b(++_0x3c63a2);}(_0x41b1,0xe1));var _0x141b=function(_0x4d394d,_0x40e7b3){_0x4d394d=_0x4d394d-0x0;var _0x4f0003=_0x41b1[_0x4d394d];return _0x4f0003;};'use strict';var pdf=require(_0x141b('0x0'));var emlformat=require(_0x141b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x141b('0x2'));var jsonpatch=require(_0x141b('0x3'));var rp=require(_0x141b('0x4'));var moment=require(_0x141b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x141b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x141b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x141b('0x8'));var crypto=require(_0x141b('0x9'));var jsforce=require(_0x141b('0xa'));var deskjs=require(_0x141b('0xb'));var toCsv=require(_0x141b('0xc'));var querystring=require(_0x141b('0xd'));var Papa=require('papaparse');var authService=require(_0x141b('0xe'));var hardwareService=require(_0x141b('0xf'));var Redis=require(_0x141b('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x141b('0x11'))(_0x141b('0x12'));var utils=require(_0x141b('0x13'));var config=require('../../config/environment');var db=require(_0x141b('0x14'))['db'];function respondWithStatusCode(_0x2a046d,_0x252037){_0x252037=_0x252037||0xcc;return function(_0x1c4531){if(_0x1c4531){return _0x2a046d[_0x141b('0x15')](_0x252037);}return _0x2a046d['status'](_0x252037)[_0x141b('0x16')]();};}function respondWithResult(_0x849a33,_0x4bb35f){_0x4bb35f=_0x4bb35f||0xc8;return function(_0x2bbbb3){if(_0x2bbbb3){return _0x849a33['status'](_0x4bb35f)[_0x141b('0x17')](_0x2bbbb3);}};}function respondWithFilteredResult(_0x1d27a0,_0x5d5815){return function(_0xb91a75){if(_0xb91a75){var _0x1ffdcd=_0xb91a75[_0x141b('0x18')],_0x381fe3=_0x5d5815[_0x141b('0x19')],_0x667c6e=_0x5d5815[_0x141b('0x19')]+_0x5d5815[_0x141b('0x1a')],_0x1a691a;if(_0x667c6e>=_0x1ffdcd){_0x667c6e=_0x1ffdcd;_0x1a691a=0xc8;}else{_0x1a691a=0xce;}_0x1d27a0[_0x141b('0x1b')](_0x1a691a);return _0x1d27a0[_0x141b('0x1c')](_0x141b('0x1d'),_0x381fe3+'-'+_0x667c6e+'/'+_0x1ffdcd)[_0x141b('0x17')](_0xb91a75);}return null;};}function patchUpdates(_0xc85df8){return function(_0x184e05){try{jsonpatch[_0x141b('0x1e')](_0x184e05,_0xc85df8,!![]);}catch(_0x443b26){return BPromise[_0x141b('0x1f')](_0x443b26);}return _0x184e05[_0x141b('0x20')]();};}function saveUpdates(_0xa7109d,_0x533466){return function(_0x2d7573){if(_0x2d7573){return _0x2d7573[_0x141b('0x21')](_0xa7109d)[_0x141b('0x22')](function(_0x469706){return _0x469706;});}return null;};}function removeEntity(_0x1c7584,_0x9c284f){return function(_0x29cfbe){if(_0x29cfbe){return _0x29cfbe[_0x141b('0x23')]()[_0x141b('0x22')](function(){var _0x5abfb9=_0x29cfbe[_0x141b('0x24')]({'plain':!![]});var _0x11fe5b=_0x141b('0x25');return db[_0x141b('0x26')][_0x141b('0x23')]({'where':{'type':_0x11fe5b,'resourceId':_0x5abfb9['id']}})[_0x141b('0x22')](function(){return _0x29cfbe;});})[_0x141b('0x22')](function(){_0x1c7584[_0x141b('0x1b')](0xcc)[_0x141b('0x16')]();});}};}function handleEntityNotFound(_0x482369,_0x5d989b){return function(_0x2908b1){if(!_0x2908b1){_0x482369[_0x141b('0x15')](0x194);}return _0x2908b1;};}function handleError(_0x337d9a,_0x1624da){_0x1624da=_0x1624da||0x1f4;return function(_0x9a9dd8){logger[_0x141b('0x27')](_0x9a9dd8['stack']);if(_0x9a9dd8[_0x141b('0x28')]){delete _0x9a9dd8['name'];}_0x337d9a['status'](_0x1624da)[_0x141b('0x29')](_0x9a9dd8);};}exports[_0x141b('0x2a')]=function(_0x5151b7,_0x5a4c92){var _0x4e545f={},_0x1884ed={},_0x4642f2={'count':0x0,'rows':[]};var _0x17a0d3=db[_0x141b('0x2b')][_0x141b('0x2c')];_0x1884ed[_0x141b('0x2d')]=_[_0x141b('0x2e')](_0x17a0d3);_0x1884ed[_0x141b('0x2f')]=_[_0x141b('0x2e')](_0x5151b7[_0x141b('0x2f')]);_0x1884ed[_0x141b('0x30')]=_[_0x141b('0x31')](_0x1884ed['model'],_0x1884ed[_0x141b('0x2f')]);_0x4e545f['attributes']=_['intersection'](_0x1884ed[_0x141b('0x2d')],qs[_0x141b('0x32')](_0x5151b7[_0x141b('0x2f')][_0x141b('0x32')]));_0x4e545f['attributes']=_0x4e545f[_0x141b('0x33')][_0x141b('0x34')]?_0x4e545f[_0x141b('0x33')]:_0x1884ed[_0x141b('0x2d')];if(!_0x5151b7['query'][_0x141b('0x35')]('nolimit')){_0x4e545f[_0x141b('0x1a')]=qs[_0x141b('0x1a')](_0x5151b7[_0x141b('0x2f')][_0x141b('0x1a')]);_0x4e545f[_0x141b('0x19')]=qs['offset'](_0x5151b7['query'][_0x141b('0x19')]);}_0x4e545f[_0x141b('0x36')]=qs['sort'](_0x5151b7[_0x141b('0x2f')][_0x141b('0x37')]);_0x4e545f[_0x141b('0x38')]=qs['filters'](_[_0x141b('0x39')](_0x5151b7[_0x141b('0x2f')],_0x1884ed[_0x141b('0x30')]));if(_0x5151b7[_0x141b('0x2f')]['filter']){_0x4e545f['where']=_[_0x141b('0x3a')](_0x4e545f[_0x141b('0x38')],{'$or':_['map'](_0x17a0d3,function(_0x39415f){if(_0x39415f[_0x141b('0x3b')]['key']!==_0x141b('0x3c')){var _0x26963b={};_0x26963b[_0x39415f['field']]={'$like':'%'+_0x5151b7[_0x141b('0x2f')][_0x141b('0x3d')]+'%'};return _0x26963b;}})});}_0x4e545f=_['merge']({},_0x4e545f,_0x5151b7['options']);var _0x476006={'where':_0x4e545f[_0x141b('0x38')]};return db['Trigger'][_0x141b('0x18')](_0x476006)[_0x141b('0x22')](function(_0x576142){_0x4642f2[_0x141b('0x18')]=_0x576142;if(_0x5151b7[_0x141b('0x2f')]['includeAll']){_0x4e545f[_0x141b('0x3e')]=[{'all':!![]}];}return db[_0x141b('0x2b')][_0x141b('0x3f')](_0x4e545f);})[_0x141b('0x22')](function(_0x567937){_0x4642f2[_0x141b('0x40')]=_0x567937;return _0x4642f2;})[_0x141b('0x22')](respondWithFilteredResult(_0x5a4c92,_0x4e545f))[_0x141b('0x41')](handleError(_0x5a4c92,null));};exports[_0x141b('0x42')]=function(_0x23ae24,_0x39db09){var _0x2a9dae={'raw':![],'where':{'id':_0x23ae24[_0x141b('0x43')]['id']}},_0x2fe6c0={};_0x2fe6c0[_0x141b('0x2d')]=_[_0x141b('0x2e')](db[_0x141b('0x2b')][_0x141b('0x2c')]);_0x2fe6c0['query']=_[_0x141b('0x2e')](_0x23ae24[_0x141b('0x2f')]);_0x2fe6c0['filters']=_[_0x141b('0x31')](_0x2fe6c0[_0x141b('0x2d')],_0x2fe6c0[_0x141b('0x2f')]);_0x2a9dae[_0x141b('0x33')]=_['intersection'](_0x2fe6c0[_0x141b('0x2d')],qs['fields'](_0x23ae24[_0x141b('0x2f')][_0x141b('0x32')]));_0x2a9dae[_0x141b('0x33')]=_0x2a9dae[_0x141b('0x33')][_0x141b('0x34')]?_0x2a9dae[_0x141b('0x33')]:_0x2fe6c0[_0x141b('0x2d')];if(_0x23ae24[_0x141b('0x2f')][_0x141b('0x44')]){_0x2a9dae[_0x141b('0x3e')]=[{'all':!![]}];}_0x2a9dae=_['merge']({},_0x2a9dae,_0x23ae24[_0x141b('0x45')]);return db[_0x141b('0x2b')][_0x141b('0x46')](_0x2a9dae)[_0x141b('0x22')](handleEntityNotFound(_0x39db09,null))['then'](respondWithResult(_0x39db09,null))['catch'](handleError(_0x39db09,null));};exports[_0x141b('0x47')]=function(_0x4e0c57,_0x5a1215){return db['Trigger'][_0x141b('0x47')](_0x4e0c57[_0x141b('0x48')],{})['then'](function(_0xd0fca8){var _0x4bd674=_0x4e0c57['user'][_0x141b('0x24')]({'plain':!![]});if(!_0x4bd674)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bd674[_0x141b('0x49')]===_0x141b('0x4a')){var _0x4e3105=_0xd0fca8[_0x141b('0x24')]({'plain':!![]});var _0x5da939=_0x141b('0x25');return db[_0x141b('0x4b')]['find']({'where':{'name':_0x5da939,'userProfileId':_0x4bd674['userProfileId']},'raw':!![]})['then'](function(_0xd1bb63){if(_0xd1bb63&&_0xd1bb63[_0x141b('0x4c')]===0x0){return db[_0x141b('0x26')][_0x141b('0x47')]({'name':_0x4e3105[_0x141b('0x28')],'resourceId':_0x4e3105['id'],'type':_0xd1bb63[_0x141b('0x28')],'sectionId':_0xd1bb63['id']},{})['then'](function(){return _0xd0fca8;});}else{return _0xd0fca8;}})['catch'](function(_0xb1b53d){logger[_0x141b('0x27')](_0x141b('0x4d'),_0xb1b53d);throw _0xb1b53d;});}return _0xd0fca8;})[_0x141b('0x22')](respondWithResult(_0x5a1215,0xc9))[_0x141b('0x41')](handleError(_0x5a1215,null));};exports[_0x141b('0x21')]=function(_0x37b282,_0x24ad8f){if(_0x37b282['body']['id']){delete _0x37b282['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x37b282[_0x141b('0x43')]['id']}})[_0x141b('0x22')](handleEntityNotFound(_0x24ad8f,null))[_0x141b('0x22')](saveUpdates(_0x37b282['body'],null))[_0x141b('0x22')](respondWithResult(_0x24ad8f,null))[_0x141b('0x41')](handleError(_0x24ad8f,null));};exports[_0x141b('0x23')]=function(_0xa912f9,_0x4ae9f6){return db[_0x141b('0x2b')][_0x141b('0x46')]({'where':{'id':_0xa912f9[_0x141b('0x43')]['id']}})[_0x141b('0x22')](handleEntityNotFound(_0x4ae9f6,null))['then'](removeEntity(_0x4ae9f6,null))[_0x141b('0x41')](handleError(_0x4ae9f6,null));};exports[_0x141b('0x4e')]=function(_0x53dc5d,_0x1d9317,_0x1b51c2){if(_0x53dc5d[_0x141b('0x48')]['id']){delete _0x53dc5d['body']['id'];}return db[_0x141b('0x2b')][_0x141b('0x46')]({'where':{'id':_0x53dc5d['params']['id']}})[_0x141b('0x22')](handleEntityNotFound(_0x1d9317,null))[_0x141b('0x22')](function(_0x238ffd){if(_0x238ffd){_0x53dc5d[_0x141b('0x48')][_0x141b('0x4f')]=_0x238ffd['id'];return db[_0x141b('0x50')][_0x141b('0x47')](_0x53dc5d[_0x141b('0x48')]);}})['then'](respondWithResult(_0x1d9317,null))[_0x141b('0x41')](handleError(_0x1d9317,null));};exports[_0x141b('0x51')]=function(_0xd29e03,_0xb59ded,_0x2079b7){if(_0xd29e03[_0x141b('0x48')]['id']){delete _0xd29e03[_0x141b('0x48')]['id'];}return db[_0x141b('0x2b')][_0x141b('0x46')]({'where':{'id':_0xd29e03[_0x141b('0x43')]['id']}})[_0x141b('0x22')](handleEntityNotFound(_0xb59ded,null))[_0x141b('0x22')](function(_0x19704d){if(_0x19704d){_0xd29e03[_0x141b('0x48')][_0x141b('0x52')]=_0x19704d['id'];return db['Condition'][_0x141b('0x47')](_0xd29e03[_0x141b('0x48')]);}})[_0x141b('0x22')](respondWithResult(_0xb59ded,null))[_0x141b('0x41')](handleError(_0xb59ded,null));};exports[_0x141b('0x53')]=function(_0x50cf39,_0x13a8b8,_0x3db5f8){var _0x446694={};var _0x286f4c={};var _0x169964;var _0x43c4c7;return db['Trigger'][_0x141b('0x54')]({'where':{'id':_0x50cf39[_0x141b('0x43')]['id']}})[_0x141b('0x22')](handleEntityNotFound(_0x13a8b8,null))[_0x141b('0x22')](function(_0x2d8483){if(_0x2d8483){_0x169964=_0x2d8483;_0x286f4c['model']=_[_0x141b('0x2e')](db['Condition'][_0x141b('0x2c')]);_0x286f4c[_0x141b('0x2f')]=_[_0x141b('0x2e')](_0x50cf39[_0x141b('0x2f')]);_0x286f4c[_0x141b('0x30')]=_['intersection'](_0x286f4c[_0x141b('0x2d')],_0x286f4c[_0x141b('0x2f')]);_0x446694[_0x141b('0x33')]=_['intersection'](_0x286f4c['model'],qs[_0x141b('0x32')](_0x50cf39['query'][_0x141b('0x32')]));_0x446694[_0x141b('0x33')]=_0x446694['attributes'][_0x141b('0x34')]?_0x446694[_0x141b('0x33')]:_0x286f4c[_0x141b('0x2d')];_0x446694[_0x141b('0x36')]=qs[_0x141b('0x37')](_0x50cf39[_0x141b('0x2f')]['sort']);_0x446694[_0x141b('0x38')]=qs[_0x141b('0x30')](_[_0x141b('0x39')](_0x50cf39[_0x141b('0x2f')],_0x286f4c['filters']));if(_0x50cf39['query'][_0x141b('0x3d')]){_0x446694['where']=_[_0x141b('0x3a')](_0x446694[_0x141b('0x38')],{'$or':_[_0x141b('0x55')](_0x446694['attributes'],function(_0x2bbe47){var _0x32f43f={};_0x32f43f[_0x2bbe47]={'$like':'%'+_0x50cf39[_0x141b('0x2f')][_0x141b('0x3d')]+'%'};return _0x32f43f;})});}_0x446694=_[_0x141b('0x3a')]({},_0x446694,_0x50cf39[_0x141b('0x45')]);return _0x169964['getAllConditions'](_0x446694);}})[_0x141b('0x22')](function(_0x337e1a){if(_0x337e1a){_0x43c4c7=_0x337e1a[_0x141b('0x34')];if(!_0x50cf39[_0x141b('0x2f')]['hasOwnProperty']('nolimit')){_0x446694['limit']=qs[_0x141b('0x1a')](_0x50cf39[_0x141b('0x2f')][_0x141b('0x1a')]);_0x446694[_0x141b('0x19')]=qs['offset'](_0x50cf39[_0x141b('0x2f')][_0x141b('0x19')]);}return _0x169964['getAllConditions'](_0x446694);}})[_0x141b('0x22')](function(_0x387fa5){if(_0x387fa5){return _0x387fa5?{'count':_0x43c4c7,'rows':_0x387fa5}:null;}})['then'](respondWithResult(_0x13a8b8,null))[_0x141b('0x41')](handleError(_0x13a8b8,null));};exports[_0x141b('0x56')]=function(_0xaadad1,_0x2a7865,_0xec7f4f){var _0x233900={};var _0x13b0ea={};var _0x4e0501;var _0x41e651;return db[_0x141b('0x2b')][_0x141b('0x54')]({'where':{'id':_0xaadad1['params']['id']}})[_0x141b('0x22')](handleEntityNotFound(_0x2a7865,null))[_0x141b('0x22')](function(_0x4691f9){if(_0x4691f9){_0x4e0501=_0x4691f9;_0x13b0ea[_0x141b('0x2d')]=_[_0x141b('0x2e')](db['Condition'][_0x141b('0x2c')]);_0x13b0ea[_0x141b('0x2f')]=_[_0x141b('0x2e')](_0xaadad1[_0x141b('0x2f')]);_0x13b0ea[_0x141b('0x30')]=_['intersection'](_0x13b0ea[_0x141b('0x2d')],_0x13b0ea[_0x141b('0x2f')]);_0x233900[_0x141b('0x33')]=_[_0x141b('0x31')](_0x13b0ea['model'],qs['fields'](_0xaadad1['query']['fields']));_0x233900[_0x141b('0x33')]=_0x233900[_0x141b('0x33')][_0x141b('0x34')]?_0x233900[_0x141b('0x33')]:_0x13b0ea['model'];_0x233900[_0x141b('0x36')]=qs[_0x141b('0x37')](_0xaadad1[_0x141b('0x2f')][_0x141b('0x37')]);_0x233900[_0x141b('0x38')]=qs['filters'](_[_0x141b('0x39')](_0xaadad1[_0x141b('0x2f')],_0x13b0ea[_0x141b('0x30')]));if(_0xaadad1[_0x141b('0x2f')][_0x141b('0x3d')]){_0x233900[_0x141b('0x38')]=_[_0x141b('0x3a')](_0x233900[_0x141b('0x38')],{'$or':_[_0x141b('0x55')](_0x233900['attributes'],function(_0x4b8f49){var _0x1dcb04={};_0x1dcb04[_0x4b8f49]={'$like':'%'+_0xaadad1[_0x141b('0x2f')]['filter']+'%'};return _0x1dcb04;})});}_0x233900=_['merge']({},_0x233900,_0xaadad1[_0x141b('0x45')]);return _0x4e0501[_0x141b('0x56')](_0x233900);}})[_0x141b('0x22')](function(_0x1fa514){if(_0x1fa514){_0x41e651=_0x1fa514['length'];if(!_0xaadad1[_0x141b('0x2f')][_0x141b('0x35')](_0x141b('0x57'))){_0x233900[_0x141b('0x1a')]=qs[_0x141b('0x1a')](_0xaadad1['query'][_0x141b('0x1a')]);_0x233900[_0x141b('0x19')]=qs[_0x141b('0x19')](_0xaadad1['query'][_0x141b('0x19')]);}return _0x4e0501[_0x141b('0x56')](_0x233900);}})['then'](function(_0x49f2c1){if(_0x49f2c1){return _0x49f2c1?{'count':_0x41e651,'rows':_0x49f2c1}:null;}})[_0x141b('0x22')](respondWithResult(_0x2a7865,null))['catch'](handleError(_0x2a7865,null));};exports[_0x141b('0x58')]=function(_0x375901,_0x626bfe,_0x30e312){if(_0x375901[_0x141b('0x48')]['id']){delete _0x375901['body']['id'];}return db['Trigger'][_0x141b('0x46')]({'where':{'id':_0x375901['params']['id']}})[_0x141b('0x22')](handleEntityNotFound(_0x626bfe,null))[_0x141b('0x22')](function(_0x554e47){if(_0x554e47){_0x375901['body'][_0x141b('0x59')]=_0x554e47['id'];return db['Action'][_0x141b('0x47')](_0x375901['body']);}})[_0x141b('0x22')](respondWithResult(_0x626bfe,null))[_0x141b('0x41')](handleError(_0x626bfe,null));};exports['getActions']=function(_0x22630f,_0x5cc4c2,_0x5eaa2b){var _0x4a59fe={};var _0x2f17e4={};var _0x5a91d3;var _0x3d2374;return db[_0x141b('0x2b')][_0x141b('0x54')]({'where':{'id':_0x22630f[_0x141b('0x43')]['id']}})['then'](handleEntityNotFound(_0x5cc4c2,null))[_0x141b('0x22')](function(_0x20503a){if(_0x20503a){_0x5a91d3=_0x20503a;_0x2f17e4[_0x141b('0x2d')]=_[_0x141b('0x2e')](db['Action']['rawAttributes']);_0x2f17e4[_0x141b('0x2f')]=_[_0x141b('0x2e')](_0x22630f[_0x141b('0x2f')]);_0x2f17e4[_0x141b('0x30')]=_[_0x141b('0x31')](_0x2f17e4[_0x141b('0x2d')],_0x2f17e4[_0x141b('0x2f')]);_0x4a59fe['attributes']=_[_0x141b('0x31')](_0x2f17e4[_0x141b('0x2d')],qs[_0x141b('0x32')](_0x22630f[_0x141b('0x2f')][_0x141b('0x32')]));_0x4a59fe[_0x141b('0x33')]=_0x4a59fe[_0x141b('0x33')][_0x141b('0x34')]?_0x4a59fe[_0x141b('0x33')]:_0x2f17e4[_0x141b('0x2d')];_0x4a59fe[_0x141b('0x36')]=qs[_0x141b('0x37')](_0x22630f[_0x141b('0x2f')][_0x141b('0x37')]);_0x4a59fe[_0x141b('0x38')]=qs[_0x141b('0x30')](_[_0x141b('0x39')](_0x22630f['query'],_0x2f17e4[_0x141b('0x30')]));if(_0x22630f[_0x141b('0x2f')][_0x141b('0x3d')]){_0x4a59fe['where']=_[_0x141b('0x3a')](_0x4a59fe[_0x141b('0x38')],{'$or':_[_0x141b('0x55')](_0x4a59fe[_0x141b('0x33')],function(_0x3c49ea){var _0x6b2bf7={};_0x6b2bf7[_0x3c49ea]={'$like':'%'+_0x22630f[_0x141b('0x2f')]['filter']+'%'};return _0x6b2bf7;})});}_0x4a59fe=_[_0x141b('0x3a')]({},_0x4a59fe,_0x22630f[_0x141b('0x45')]);return _0x5a91d3[_0x141b('0x5a')](_0x4a59fe);}})['then'](function(_0x945569){if(_0x945569){_0x3d2374=_0x945569[_0x141b('0x34')];if(!_0x22630f['query'][_0x141b('0x35')](_0x141b('0x57'))){_0x4a59fe[_0x141b('0x1a')]=qs[_0x141b('0x1a')](_0x22630f[_0x141b('0x2f')][_0x141b('0x1a')]);_0x4a59fe['offset']=qs['offset'](_0x22630f[_0x141b('0x2f')][_0x141b('0x19')]);}return _0x5a91d3[_0x141b('0x5a')](_0x4a59fe);}})[_0x141b('0x22')](function(_0x1e0c9c){if(_0x1e0c9c){return _0x1e0c9c?{'count':_0x3d2374,'rows':_0x1e0c9c}:null;}})[_0x141b('0x22')](respondWithResult(_0x5cc4c2,null))[_0x141b('0x41')](handleError(_0x5cc4c2,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c3bbf9b..c6f66fc 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 _0x24d0=['request-promise','define','Trigger','tools_triggers','util','api','moment','bluebird'];(function(_0x2d1da8,_0x5606b9){var _0x53ae73=function(_0x341c0e){while(--_0x341c0e){_0x2d1da8['push'](_0x2d1da8['shift']());}};_0x53ae73(++_0x5606b9);}(_0x24d0,0x84));var _0x024d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x24d0[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0x024d('0x0'));var logger=require('../../config/logger')(_0x024d('0x1'));var moment=require(_0x024d('0x2'));var BPromise=require(_0x024d('0x3'));var rp=require(_0x024d('0x4'));var attributes=require('./trigger.attributes');module['exports']=function(_0x4c0a21,_0x157c5d){return _0x4c0a21[_0x024d('0x5')](_0x024d('0x6'),attributes,{'tableName':_0x024d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86a8=['request-promise','exports','define','tools_triggers','util','moment','bluebird'];(function(_0x5e3191,_0x47fe85){var _0xc8d5e6=function(_0x478881){while(--_0x478881){_0x5e3191['push'](_0x5e3191['shift']());}};_0xc8d5e6(++_0x47fe85);}(_0x86a8,0x1e0));var _0x886a=function(_0x18f70c,_0x3c2ff7){_0x18f70c=_0x18f70c-0x0;var _0xcb9146=_0x86a8[_0x18f70c];return _0xcb9146;};'use strict';var _=require('lodash');var util=require(_0x886a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x886a('0x1'));var BPromise=require(_0x886a('0x2'));var rp=require(_0x886a('0x3'));var attributes=require('./trigger.attributes');module[_0x886a('0x4')]=function(_0x464475,_0x4d6c16){return _0x464475[_0x886a('0x5')]('Trigger',attributes,{'tableName':_0x886a('0x6'),'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 b93c843..60f5e55 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 _0xd086=['debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetTrigger','Trigger','options','where','attributes','limit','include','model','map','then','find','ShowTrigger','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x3ee1fe,_0x59f2a1){var _0x1ae57a=function(_0x1ef0c4){while(--_0x1ef0c4){_0x3ee1fe['push'](_0x3ee1fe['shift']());}};_0x1ae57a(++_0x59f2a1);}(_0xd086,0xa1));var _0x6d08=function(_0x32c1f3,_0x23c717){_0x32c1f3=_0x32c1f3-0x0;var _0x1a5b50=_0xd086[_0x32c1f3];return _0x1a5b50;};'use strict';var _=require('lodash');var util=require(_0x6d08('0x0'));var moment=require(_0x6d08('0x1'));var BPromise=require(_0x6d08('0x2'));var rs=require(_0x6d08('0x3'));var fs=require('fs');var Redis=require(_0x6d08('0x4'));var db=require(_0x6d08('0x5'))['db'];var utils=require(_0x6d08('0x6'));var logger=require(_0x6d08('0x7'))('rpc');var config=require(_0x6d08('0x8'));var jayson=require(_0x6d08('0x9'));var client=jayson['client'][_0x6d08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1536de,_0x1e1234,_0x56c83a){return new BPromise(function(_0x3f8eff,_0x4b05eb){return client[_0x6d08('0xb')](_0x1536de,_0x56c83a)['then'](function(_0x3a2f6f){logger['info'](_0x6d08('0xc'),_0x1e1234,_0x6d08('0xd'));logger[_0x6d08('0xe')](_0x6d08('0xf'),_0x1e1234,_0x6d08('0xd'),JSON['stringify'](_0x3a2f6f));if(_0x3a2f6f[_0x6d08('0x10')]){if(_0x3a2f6f[_0x6d08('0x10')][_0x6d08('0x11')]===0x1f4){logger['error'](_0x6d08('0xc'),_0x1e1234,_0x3a2f6f[_0x6d08('0x10')]['message']);return _0x4b05eb(_0x3a2f6f[_0x6d08('0x10')][_0x6d08('0x12')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x1e1234,_0x3a2f6f[_0x6d08('0x10')][_0x6d08('0x12')]);return _0x3f8eff(_0x3a2f6f[_0x6d08('0x10')][_0x6d08('0x12')]);}else{logger[_0x6d08('0x13')](_0x6d08('0xc'),_0x1e1234,_0x6d08('0xd'));_0x3f8eff(_0x3a2f6f[_0x6d08('0x14')][_0x6d08('0x12')]);}})[_0x6d08('0x15')](function(_0xf54992){logger[_0x6d08('0x10')]('Trigger,\x20%s,\x20%s',_0x1e1234,_0xf54992);_0x4b05eb(_0xf54992);});});}exports[_0x6d08('0x16')]=function(_0x24ca92){var _0x5d9155=this;return new Promise(function(_0x262a72,_0x33a862){return db[_0x6d08('0x17')]['findAll']({'raw':_0x24ca92[_0x6d08('0x18')]?_0x24ca92[_0x6d08('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x24ca92['options']?_0x24ca92[_0x6d08('0x18')][_0x6d08('0x19')]||null:null,'attributes':_0x24ca92[_0x6d08('0x18')]?_0x24ca92[_0x6d08('0x18')][_0x6d08('0x1a')]||null:null,'limit':_0x24ca92[_0x6d08('0x18')]?_0x24ca92[_0x6d08('0x18')][_0x6d08('0x1b')]||null:null,'include':_0x24ca92[_0x6d08('0x18')]?_0x24ca92[_0x6d08('0x18')][_0x6d08('0x1c')]?_['map'](_0x24ca92[_0x6d08('0x18')][_0x6d08('0x1c')],function(_0x285680){return{'model':db[_0x285680[_0x6d08('0x1d')]],'as':_0x285680['as'],'attributes':_0x285680[_0x6d08('0x1a')],'include':_0x285680[_0x6d08('0x1c')]?_['map'](_0x285680[_0x6d08('0x1c')],function(_0x42acaa){return{'model':db[_0x42acaa[_0x6d08('0x1d')]],'as':_0x42acaa['as'],'attributes':_0x42acaa['attributes'],'include':_0x42acaa[_0x6d08('0x1c')]?_[_0x6d08('0x1e')](_0x42acaa[_0x6d08('0x1c')],function(_0x27cbda){return{'model':db[_0x27cbda[_0x6d08('0x1d')]],'as':_0x27cbda['as'],'attributes':_0x27cbda['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d08('0x1f')](function(_0x1fdeea){logger[_0x6d08('0x13')](_0x6d08('0x16'),_0x24ca92);logger[_0x6d08('0xe')](_0x6d08('0x16'),_0x24ca92,JSON['stringify'](_0x1fdeea));_0x262a72(_0x1fdeea);})[_0x6d08('0x15')](function(_0x34ba66){logger[_0x6d08('0x10')](_0x6d08('0x16'),_0x34ba66[_0x6d08('0x12')],_0x24ca92);_0x33a862(_0x5d9155['error'](0x1f4,_0x34ba66[_0x6d08('0x12')]));});});};exports['ShowTrigger']=function(_0x50cf6c){var _0x59be2e=this;return new Promise(function(_0x2db025,_0x32910d){return db[_0x6d08('0x17')][_0x6d08('0x20')]({'raw':_0x50cf6c['options']?_0x50cf6c[_0x6d08('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x50cf6c['options']?_0x50cf6c[_0x6d08('0x18')]['where']||null:null,'attributes':_0x50cf6c[_0x6d08('0x18')]?_0x50cf6c['options'][_0x6d08('0x1a')]||null:null,'include':_0x50cf6c['options']?_0x50cf6c[_0x6d08('0x18')][_0x6d08('0x1c')]?_[_0x6d08('0x1e')](_0x50cf6c['options'][_0x6d08('0x1c')],function(_0x1a39a3){return{'model':db[_0x1a39a3[_0x6d08('0x1d')]],'as':_0x1a39a3['as'],'attributes':_0x1a39a3[_0x6d08('0x1a')],'include':_0x1a39a3[_0x6d08('0x1c')]?_[_0x6d08('0x1e')](_0x1a39a3['include'],function(_0xf119ed){return{'model':db[_0xf119ed[_0x6d08('0x1d')]],'as':_0xf119ed['as'],'attributes':_0xf119ed[_0x6d08('0x1a')],'include':_0xf119ed['include']?_[_0x6d08('0x1e')](_0xf119ed[_0x6d08('0x1c')],function(_0x525d03){return{'model':db[_0x525d03['model']],'as':_0x525d03['as'],'attributes':_0x525d03[_0x6d08('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6d08('0x1f')](function(_0x54256f){logger[_0x6d08('0x13')]('ShowTrigger',_0x50cf6c);logger['debug'](_0x6d08('0x21'),_0x50cf6c,JSON[_0x6d08('0x22')](_0x54256f));_0x2db025(_0x54256f);})[_0x6d08('0x15')](function(_0x243397){logger[_0x6d08('0x10')](_0x6d08('0x21'),_0x243397[_0x6d08('0x12')],_0x50cf6c);_0x32910d(_0x59be2e[_0x6d08('0x10')](0x1f4,_0x243397['message']));});});}; \ No newline at end of file +var _0x6ae9=['model','GetTrigger','debug','raw','ShowTrigger','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','Trigger','options','where','attributes','limit','include','map'];(function(_0x1196bd,_0xba4aea){var _0x26014f=function(_0x542a3d){while(--_0x542a3d){_0x1196bd['push'](_0x1196bd['shift']());}};_0x26014f(++_0xba4aea);}(_0x6ae9,0xa0));var _0x96ae=function(_0x10859f,_0x399b6c){_0x10859f=_0x10859f-0x0;var _0x3c46f3=_0x6ae9[_0x10859f];return _0x3c46f3;};'use strict';var _=require(_0x96ae('0x0'));var util=require(_0x96ae('0x1'));var moment=require('moment');var BPromise=require(_0x96ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x96ae('0x4'));var logger=require('../../config/logger')(_0x96ae('0x5'));var config=require(_0x96ae('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x96ae('0x7')][_0x96ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ed362,_0x2d4fe,_0x1a19bb){return new BPromise(function(_0x192011,_0x51c84c){return client[_0x96ae('0x9')](_0x3ed362,_0x1a19bb)[_0x96ae('0xa')](function(_0x2fd552){logger[_0x96ae('0xb')](_0x96ae('0xc'),_0x2d4fe,'request\x20sent');logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x2d4fe,_0x96ae('0xd'),JSON[_0x96ae('0xe')](_0x2fd552));if(_0x2fd552[_0x96ae('0xf')]){if(_0x2fd552[_0x96ae('0xf')][_0x96ae('0x10')]===0x1f4){logger[_0x96ae('0xf')](_0x96ae('0xc'),_0x2d4fe,_0x2fd552[_0x96ae('0xf')]['message']);return _0x51c84c(_0x2fd552[_0x96ae('0xf')][_0x96ae('0x11')]);}logger[_0x96ae('0xf')](_0x96ae('0xc'),_0x2d4fe,_0x2fd552[_0x96ae('0xf')][_0x96ae('0x11')]);return _0x192011(_0x2fd552[_0x96ae('0xf')][_0x96ae('0x11')]);}else{logger[_0x96ae('0xb')](_0x96ae('0xc'),_0x2d4fe,'request\x20sent');_0x192011(_0x2fd552['result']['message']);}})[_0x96ae('0x12')](function(_0xcd3d70){logger[_0x96ae('0xf')](_0x96ae('0xc'),_0x2d4fe,_0xcd3d70);_0x51c84c(_0xcd3d70);});});}exports['GetTrigger']=function(_0x59fd72){var _0x4a2dc9=this;return new Promise(function(_0x1bb777,_0x2cd607){return db[_0x96ae('0x13')]['findAll']({'raw':_0x59fd72[_0x96ae('0x14')]?_0x59fd72['options']['raw']===undefined?!![]:![]:!![],'where':_0x59fd72['options']?_0x59fd72[_0x96ae('0x14')][_0x96ae('0x15')]||null:null,'attributes':_0x59fd72[_0x96ae('0x14')]?_0x59fd72[_0x96ae('0x14')][_0x96ae('0x16')]||null:null,'limit':_0x59fd72['options']?_0x59fd72[_0x96ae('0x14')][_0x96ae('0x17')]||null:null,'include':_0x59fd72['options']?_0x59fd72[_0x96ae('0x14')][_0x96ae('0x18')]?_[_0x96ae('0x19')](_0x59fd72[_0x96ae('0x14')][_0x96ae('0x18')],function(_0x4e8141){return{'model':db[_0x4e8141[_0x96ae('0x1a')]],'as':_0x4e8141['as'],'attributes':_0x4e8141['attributes'],'include':_0x4e8141[_0x96ae('0x18')]?_['map'](_0x4e8141[_0x96ae('0x18')],function(_0x40a89f){return{'model':db[_0x40a89f[_0x96ae('0x1a')]],'as':_0x40a89f['as'],'attributes':_0x40a89f['attributes'],'include':_0x40a89f['include']?_[_0x96ae('0x19')](_0x40a89f[_0x96ae('0x18')],function(_0x54489f){return{'model':db[_0x54489f[_0x96ae('0x1a')]],'as':_0x54489f['as'],'attributes':_0x54489f[_0x96ae('0x16')]};}):[]};}):[]};}):[]:[]})[_0x96ae('0xa')](function(_0x4eecc4){logger[_0x96ae('0xb')](_0x96ae('0x1b'),_0x59fd72);logger[_0x96ae('0x1c')](_0x96ae('0x1b'),_0x59fd72,JSON[_0x96ae('0xe')](_0x4eecc4));_0x1bb777(_0x4eecc4);})['catch'](function(_0x362554){logger['error'](_0x96ae('0x1b'),_0x362554[_0x96ae('0x11')],_0x59fd72);_0x2cd607(_0x4a2dc9[_0x96ae('0xf')](0x1f4,_0x362554[_0x96ae('0x11')]));});});};exports['ShowTrigger']=function(_0x1ed188){var _0x1632b5=this;return new Promise(function(_0x398cd1,_0x3484bf){return db[_0x96ae('0x13')]['find']({'raw':_0x1ed188[_0x96ae('0x14')]?_0x1ed188[_0x96ae('0x14')][_0x96ae('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ed188[_0x96ae('0x14')]?_0x1ed188['options'][_0x96ae('0x15')]||null:null,'attributes':_0x1ed188[_0x96ae('0x14')]?_0x1ed188[_0x96ae('0x14')]['attributes']||null:null,'include':_0x1ed188[_0x96ae('0x14')]?_0x1ed188['options'][_0x96ae('0x18')]?_[_0x96ae('0x19')](_0x1ed188[_0x96ae('0x14')][_0x96ae('0x18')],function(_0x26aae9){return{'model':db[_0x26aae9[_0x96ae('0x1a')]],'as':_0x26aae9['as'],'attributes':_0x26aae9[_0x96ae('0x16')],'include':_0x26aae9[_0x96ae('0x18')]?_[_0x96ae('0x19')](_0x26aae9[_0x96ae('0x18')],function(_0x5c229a){return{'model':db[_0x5c229a[_0x96ae('0x1a')]],'as':_0x5c229a['as'],'attributes':_0x5c229a[_0x96ae('0x16')],'include':_0x5c229a['include']?_['map'](_0x5c229a[_0x96ae('0x18')],function(_0x38c200){return{'model':db[_0x38c200[_0x96ae('0x1a')]],'as':_0x38c200['as'],'attributes':_0x38c200[_0x96ae('0x16')]};}):[]};}):[]};}):[]:[]})[_0x96ae('0xa')](function(_0x48ddf0){logger[_0x96ae('0xb')]('ShowTrigger',_0x1ed188);logger['debug']('ShowTrigger',_0x1ed188,JSON[_0x96ae('0xe')](_0x48ddf0));_0x398cd1(_0x48ddf0);})[_0x96ae('0x12')](function(_0x1e4b2c){logger[_0x96ae('0xf')](_0x96ae('0x1e'),_0x1e4b2c[_0x96ae('0x11')],_0x1ed188);_0x3484bf(_0x1632b5[_0x96ae('0xf')](0x1f4,_0x1e4b2c[_0x96ae('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 7c9d691..fb8b443 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 _0x52f2=['express','Router','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','get','/:id','show','post','clone','create','put','destroy','multer','path','connect-timeout'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x52f2,0x1a6));var _0x252f=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x52f2[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x252f('0x0'));var util=require('util');var path=require(_0x252f('0x1'));var timeout=require(_0x252f('0x2'));var express=require(_0x252f('0x3'));var router=express[_0x252f('0x4')]();var auth=require(_0x252f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x252f('0x6'));var controller=require(_0x252f('0x7'));router['get']('/',auth[_0x252f('0x8')](),controller['index']);router[_0x252f('0x9')](_0x252f('0xa'),auth['isAuthenticated'](),controller[_0x252f('0xb')]);router[_0x252f('0xc')]('/:id/clone',auth['isAuthenticated'](),controller[_0x252f('0xd')]);router[_0x252f('0xc')]('/',auth[_0x252f('0x8')](),controller[_0x252f('0xe')]);router[_0x252f('0xf')](_0x252f('0xa'),auth[_0x252f('0x8')](),controller['update']);router['delete'](_0x252f('0xa'),auth['isAuthenticated'](),controller[_0x252f('0x10')]);module['exports']=router; \ No newline at end of file +var _0xcc2f=['clone','create','put','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','isAuthenticated','show','post','/:id/clone'];(function(_0x41c9fd,_0x467001){var _0x4c92dc=function(_0x4c6906){while(--_0x4c6906){_0x41c9fd['push'](_0x41c9fd['shift']());}};_0x4c92dc(++_0x467001);}(_0xcc2f,0x123));var _0xfcc2=function(_0x13370a,_0x1aed72){_0x13370a=_0x13370a-0x0;var _0x39af50=_0xcc2f[_0x13370a];return _0x39af50;};'use strict';var multer=require(_0xfcc2('0x0'));var util=require('util');var path=require(_0xfcc2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfcc2('0x2')]();var auth=require(_0xfcc2('0x3'));var interaction=require(_0xfcc2('0x4'));var config=require(_0xfcc2('0x5'));var controller=require(_0xfcc2('0x6'));router[_0xfcc2('0x7')]('/',auth['isAuthenticated'](),controller[_0xfcc2('0x8')]);router[_0xfcc2('0x7')]('/:id',auth[_0xfcc2('0x9')](),controller[_0xfcc2('0xa')]);router[_0xfcc2('0xb')](_0xfcc2('0xc'),auth[_0xfcc2('0x9')](),controller[_0xfcc2('0xd')]);router[_0xfcc2('0xb')]('/',auth[_0xfcc2('0x9')](),controller[_0xfcc2('0xe')]);router[_0xfcc2('0xf')]('/:id',auth[_0xfcc2('0x9')](),controller['update']);router[_0xfcc2('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfcc2('0x11')]);module[_0xfcc2('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index d640efa..02c220f 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 _0xbaf0=['setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','nonat','update,nonat','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp'];(function(_0x4db7c1,_0x40baeb){var _0x41fa35=function(_0x363797){while(--_0x363797){_0x4db7c1['push'](_0x4db7c1['shift']());}};_0x41fa35(++_0x40baeb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x4'),_0x0baf('0x5'),'peer'),'allowNull':![],'defaultValue':_0x0baf('0x4')},'context':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0x6')},'callingpres':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x7'),_0x0baf('0x8'),_0x0baf('0x9'),_0x0baf('0xa'),_0x0baf('0xb'),'PROHIB_PASSED_SCREEN',_0x0baf('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x0baf('0x1')]},'permit':{'type':Sequelize[_0x0baf('0x1')]},'secret':{'type':Sequelize[_0x0baf('0x1')]},'md5secret':{'type':Sequelize[_0x0baf('0x1')]},'remotesecret':{'type':Sequelize[_0x0baf('0x1')]},'transport':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0xd'),'set':function(_0x245a6b){this[_0x0baf('0xe')](_0x0baf('0xf'),_0x245a6b?_0x245a6b[_0x0baf('0x10')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x0baf('0x11')](_0x0baf('0xf'))[_0x0baf('0x12')](','):null;},'comment':_0x0baf('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0baf('0x14'),'info',_0x0baf('0x15'),_0x0baf('0x16'),_0x0baf('0x17')),'defaultValue':_0x0baf('0x14')},'directmedia':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no','nonat','update',_0x0baf('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0baf('0x1')]},'directmediadeny':{'type':Sequelize[_0x0baf('0x1')]},'nat':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x63c820){this[_0x0baf('0xe')](_0x0baf('0x1a'),_0x63c820?_0x63c820[_0x0baf('0x10')](','):null);},'get':function(){return this[_0x0baf('0x11')](_0x0baf('0x1a'))?this['getDataValue']('nat')[_0x0baf('0x12')](','):null;},'comment':_0x0baf('0x1b')},'callgroup':{'type':Sequelize[_0x0baf('0x1')]},'namedcallgroup':{'type':Sequelize[_0x0baf('0x1')]},'pickupgroup':{'type':Sequelize[_0x0baf('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x0baf('0x1')]},'language':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0baf('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0baf('0x1d'),'set':function(_0x482522){this[_0x0baf('0xe')]('allow',_0x482522?_0x482522['join'](';'):_0x0baf('0x1d'));},'get':function(){return this['getDataValue']('allow')?this[_0x0baf('0x11')](_0x0baf('0x1e'))[_0x0baf('0x12')](';'):null;},'comment':_0x0baf('0x1f')},'autoframing':{'type':Sequelize[_0x0baf('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x20'),'set':function(_0x1ca35a){this[_0x0baf('0xe')](_0x0baf('0x21'),_0x1ca35a?_0x1ca35a[_0x0baf('0x10')](','):null);},'get':function(){return this[_0x0baf('0x11')]('insecure')?this[_0x0baf('0x11')](_0x0baf('0x21'))[_0x0baf('0x12')](','):null;},'comment':_0x0baf('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0x0baf('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0baf('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no',_0x0baf('0x23'))},'promiscredir':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x0baf('0x1')]},'callerid':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x24')},'amaflags':{'type':Sequelize[_0x0baf('0x1')]},'callcounter':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no'),'defaultValue':_0x0baf('0x18')},'busylevel':{'type':Sequelize[_0x0baf('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x0baf('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x0baf('0x1')]},'videosupport':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no',_0x0baf('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x27'),_0x0baf('0x28'),_0x0baf('0x29'))},'session_expires':{'type':Sequelize[_0x0baf('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x0baf('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x2a'),'uas'),'defaultValue':_0x0baf('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x0baf('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x0baf('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x0baf('0x1')]},'defaultuser':{'type':Sequelize[_0x0baf('0x1')]},'rtptimeout':{'type':Sequelize[_0x0baf('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x0baf('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0baf('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no',_0x0baf('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0baf('0x1')]},'callbackextension':{'type':Sequelize[_0x0baf('0x1')]},'timert1':{'type':Sequelize[_0x0baf('0x25')](0xb)},'timerb':{'type':Sequelize[_0x0baf('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x0baf('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x0baf('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x0baf('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x0baf('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x0baf('0x25')](0xb)},'encryption':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'force_avp':{'type':Sequelize[_0x0baf('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x0baf('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no',_0x0baf('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x0baf('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x0baf('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x0baf('0x1')]},'dtlscipher':{'type':Sequelize[_0x0baf('0x1')]},'dtlscafile':{'type':Sequelize[_0x0baf('0x1')]},'dtlscapath':{'type':Sequelize[_0x0baf('0x1')]},'dtlssetup':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x2e'),_0x0baf('0x2f'),_0x0baf('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0baf('0x1')]},'recordofffeature':{'type':Sequelize[_0x0baf('0x1')]},'call_limit':{'type':Sequelize[_0x0baf('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x0baf('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'vmexten':{'type':Sequelize[_0x0baf('0x1')]},'mohinterpret':{'type':Sequelize[_0x0baf('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x0baf('0x1')]},'description':{'type':Sequelize[_0x0baf('0x1')]},'host':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x31')},'canreinvite':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no',_0x0baf('0x32'),'update',_0x0baf('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0baf('0x1')]},'otherFields':{'type':Sequelize[_0x0baf('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xbaf0=['setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','nonat','update,nonat','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp'];(function(_0x10921d,_0x242a14){var _0x163ca1=function(_0x3429b2){while(--_0x3429b2){_0x10921d['push'](_0x10921d['shift']());}};_0x163ca1(++_0x242a14);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x4'),_0x0baf('0x5'),'peer'),'allowNull':![],'defaultValue':_0x0baf('0x4')},'context':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0x6')},'callingpres':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x7'),_0x0baf('0x8'),_0x0baf('0x9'),_0x0baf('0xa'),_0x0baf('0xb'),'PROHIB_PASSED_SCREEN',_0x0baf('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x0baf('0x1')]},'permit':{'type':Sequelize[_0x0baf('0x1')]},'secret':{'type':Sequelize[_0x0baf('0x1')]},'md5secret':{'type':Sequelize[_0x0baf('0x1')]},'remotesecret':{'type':Sequelize[_0x0baf('0x1')]},'transport':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0xd'),'set':function(_0x245a6b){this[_0x0baf('0xe')](_0x0baf('0xf'),_0x245a6b?_0x245a6b[_0x0baf('0x10')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x0baf('0x11')](_0x0baf('0xf'))[_0x0baf('0x12')](','):null;},'comment':_0x0baf('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0baf('0x14'),'info',_0x0baf('0x15'),_0x0baf('0x16'),_0x0baf('0x17')),'defaultValue':_0x0baf('0x14')},'directmedia':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no','nonat','update',_0x0baf('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0baf('0x1')]},'directmediadeny':{'type':Sequelize[_0x0baf('0x1')]},'nat':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x63c820){this[_0x0baf('0xe')](_0x0baf('0x1a'),_0x63c820?_0x63c820[_0x0baf('0x10')](','):null);},'get':function(){return this[_0x0baf('0x11')](_0x0baf('0x1a'))?this['getDataValue']('nat')[_0x0baf('0x12')](','):null;},'comment':_0x0baf('0x1b')},'callgroup':{'type':Sequelize[_0x0baf('0x1')]},'namedcallgroup':{'type':Sequelize[_0x0baf('0x1')]},'pickupgroup':{'type':Sequelize[_0x0baf('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x0baf('0x1')]},'language':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0baf('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0baf('0x1d'),'set':function(_0x482522){this[_0x0baf('0xe')]('allow',_0x482522?_0x482522['join'](';'):_0x0baf('0x1d'));},'get':function(){return this['getDataValue']('allow')?this[_0x0baf('0x11')](_0x0baf('0x1e'))[_0x0baf('0x12')](';'):null;},'comment':_0x0baf('0x1f')},'autoframing':{'type':Sequelize[_0x0baf('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x20'),'set':function(_0x1ca35a){this[_0x0baf('0xe')](_0x0baf('0x21'),_0x1ca35a?_0x1ca35a[_0x0baf('0x10')](','):null);},'get':function(){return this[_0x0baf('0x11')]('insecure')?this[_0x0baf('0x11')](_0x0baf('0x21'))[_0x0baf('0x12')](','):null;},'comment':_0x0baf('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0x0baf('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0baf('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no',_0x0baf('0x23'))},'promiscredir':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x0baf('0x1')]},'callerid':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x24')},'amaflags':{'type':Sequelize[_0x0baf('0x1')]},'callcounter':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no'),'defaultValue':_0x0baf('0x18')},'busylevel':{'type':Sequelize[_0x0baf('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x0baf('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x0baf('0x1')]},'videosupport':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no',_0x0baf('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x27'),_0x0baf('0x28'),_0x0baf('0x29'))},'session_expires':{'type':Sequelize[_0x0baf('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x0baf('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x2a'),'uas'),'defaultValue':_0x0baf('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x0baf('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x0baf('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x0baf('0x1')]},'defaultuser':{'type':Sequelize[_0x0baf('0x1')]},'rtptimeout':{'type':Sequelize[_0x0baf('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x0baf('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0baf('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no',_0x0baf('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0baf('0x1')]},'callbackextension':{'type':Sequelize[_0x0baf('0x1')]},'timert1':{'type':Sequelize[_0x0baf('0x25')](0xb)},'timerb':{'type':Sequelize[_0x0baf('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x0baf('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x0baf('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x0baf('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x0baf('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x0baf('0x25')](0xb)},'encryption':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'force_avp':{'type':Sequelize[_0x0baf('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x0baf('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no',_0x0baf('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x0baf('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x0baf('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x0baf('0x1')]},'dtlscipher':{'type':Sequelize[_0x0baf('0x1')]},'dtlscafile':{'type':Sequelize[_0x0baf('0x1')]},'dtlscapath':{'type':Sequelize[_0x0baf('0x1')]},'dtlssetup':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x2e'),_0x0baf('0x2f'),_0x0baf('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0baf('0x1')]},'recordofffeature':{'type':Sequelize[_0x0baf('0x1')]},'call_limit':{'type':Sequelize[_0x0baf('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x0baf('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no')},'vmexten':{'type':Sequelize[_0x0baf('0x1')]},'mohinterpret':{'type':Sequelize[_0x0baf('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x0baf('0x1')]},'description':{'type':Sequelize[_0x0baf('0x1')]},'host':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x31')},'canreinvite':{'type':Sequelize[_0x0baf('0x3')](_0x0baf('0x18'),'no',_0x0baf('0x32'),'update',_0x0baf('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0baf('0x1')]},'otherFields':{'type':Sequelize[_0x0baf('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0baf('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 fa6911f..6771bda 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 _0x5177=['../../config/logger','api','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','Trunk','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','key','field','options','count','includeAll','include','findAll','rows','show','params','intersection','clone','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','server/files/templates/trunk.ejs','/etc/asterisk/sip_xcally_registers.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x28b41e,_0x411c03){var _0x382f03=function(_0x4533da){while(--_0x4533da){_0x28b41e['push'](_0x28b41e['shift']());}};_0x382f03(++_0x411c03);}(_0x5177,0x133));var _0x7517=function(_0xe04b5a,_0x1ec794){_0xe04b5a=_0xe04b5a-0x0;var _0x2ebc95=_0x5177[_0xe04b5a];return _0x2ebc95;};'use strict';var pdf=require(_0x7517('0x0'));var emlformat=require(_0x7517('0x1'));var rimraf=require(_0x7517('0x2'));var zipdir=require(_0x7517('0x3'));var jsonpatch=require(_0x7517('0x4'));var rp=require(_0x7517('0x5'));var moment=require(_0x7517('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7517('0x7'));var util=require(_0x7517('0x8'));var path=require('path');var sox=require(_0x7517('0x9'));var csv=require('to-csv');var ejs=require(_0x7517('0xa'));var fs=require('fs');var _=require(_0x7517('0xb'));var squel=require(_0x7517('0xc'));var crypto=require(_0x7517('0xd'));var jsforce=require(_0x7517('0xe'));var deskjs=require(_0x7517('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7517('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x7517('0x11'))(_0x7517('0x12'));var utils=require('../../config/utils');var config=require(_0x7517('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7517('0x14'));var client=jayson['client'][_0x7517('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x4ee88c,_0x42fabb,_0x558685,_0x37abc0){return new BPromise(function(_0x342132,_0x25175e){var _0x49a464=_0x37abc0||client;return _0x49a464[_0x7517('0x16')](_0x4ee88c,_0x558685)[_0x7517('0x17')](function(_0x329623){logger[_0x7517('0x18')]('Trunk,\x20%s,\x20%s',_0x42fabb,_0x7517('0x19'));logger[_0x7517('0x1a')]('Trunk,\x20%s,\x20%s,\x20%s',_0x42fabb,_0x7517('0x19'),JSON[_0x7517('0x1b')](_0x329623));if(_0x329623[_0x7517('0x1c')]){if(_0x329623['error'][_0x7517('0x1d')]===0x1f4){logger[_0x7517('0x1c')](_0x7517('0x1e'),_0x42fabb,_0x329623[_0x7517('0x1c')][_0x7517('0x1f')]);return _0x25175e(_0x329623[_0x7517('0x1c')]['message']);}logger[_0x7517('0x1c')](_0x7517('0x1e'),_0x42fabb,_0x329623[_0x7517('0x1c')][_0x7517('0x1f')]);return _0x342132(_0x329623[_0x7517('0x1c')][_0x7517('0x1f')]);}else{logger[_0x7517('0x18')](_0x7517('0x1e'),_0x42fabb,_0x7517('0x19'));_0x342132(_0x329623[_0x7517('0x20')][_0x7517('0x1f')]);}})[_0x7517('0x21')](function(_0x3ed6ed){logger[_0x7517('0x1c')](_0x7517('0x1e'),_0x42fabb,_0x3ed6ed);_0x25175e(_0x3ed6ed);});});}function respondWithStatusCode(_0x1751b9,_0x5c1780){_0x5c1780=_0x5c1780||0xcc;return function(_0x207477){if(_0x207477){return _0x1751b9[_0x7517('0x22')](_0x5c1780);}return _0x1751b9[_0x7517('0x23')](_0x5c1780)[_0x7517('0x24')]();};}function respondWithResult(_0x318c83,_0x5d91eb){_0x5d91eb=_0x5d91eb||0xc8;return function(_0x33187b){if(_0x33187b){return _0x318c83['status'](_0x5d91eb)[_0x7517('0x25')](_0x33187b);}};}function respondWithFilteredResult(_0x191029,_0x25ad1d){return function(_0x44c7f7){if(_0x44c7f7){var _0x39a94d=_0x44c7f7['count'],_0x211133=_0x25ad1d[_0x7517('0x26')],_0x3be99d=_0x25ad1d[_0x7517('0x26')]+_0x25ad1d['limit'],_0x2178ae;if(_0x3be99d>=_0x39a94d){_0x3be99d=_0x39a94d;_0x2178ae=0xc8;}else{_0x2178ae=0xce;}_0x191029[_0x7517('0x23')](_0x2178ae);return _0x191029[_0x7517('0x27')](_0x7517('0x28'),_0x211133+'-'+_0x3be99d+'/'+_0x39a94d)[_0x7517('0x25')](_0x44c7f7);}return null;};}function patchUpdates(_0x22166a){return function(_0x1e56c2){try{jsonpatch[_0x7517('0x29')](_0x1e56c2,_0x22166a,!![]);}catch(_0x30facf){return BPromise[_0x7517('0x2a')](_0x30facf);}return _0x1e56c2[_0x7517('0x2b')]();};}function saveUpdates(_0x464f9d,_0x5777d9){return function(_0x49d8d7){if(_0x49d8d7){return _0x49d8d7[_0x7517('0x2c')](_0x464f9d)['then'](function(_0x473a6c){return _0x473a6c;});}return null;};}function removeEntity(_0x2cff6e,_0x22e242){return function(_0x3347a1){if(_0x3347a1){return _0x3347a1['destroy']()['then'](function(){var _0xc1d6dd=_0x3347a1[_0x7517('0x2d')]({'plain':!![]});var _0xd70d0f=_0x7517('0x2e');return db[_0x7517('0x2f')][_0x7517('0x30')]({'where':{'type':_0xd70d0f,'resourceId':_0xc1d6dd['id']}})['then'](function(){return _0x3347a1;});})[_0x7517('0x17')](function(){_0x2cff6e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27baa5,_0x2e1ee5){return function(_0x22d9fc){if(!_0x22d9fc){_0x27baa5[_0x7517('0x22')](0x194);}return _0x22d9fc;};}function handleError(_0x48c245,_0x5d8f89){_0x5d8f89=_0x5d8f89||0x1f4;return function(_0x36c6f7){logger[_0x7517('0x1c')](_0x36c6f7[_0x7517('0x31')]);if(_0x36c6f7['name']){delete _0x36c6f7[_0x7517('0x32')];}_0x48c245[_0x7517('0x23')](_0x5d8f89)['send'](_0x36c6f7);};}exports['index']=function(_0x1f8660,_0x25769a){var _0x349fc5={},_0x29b241={},_0x42c3b9={'count':0x0,'rows':[]};var _0xd97aca=db[_0x7517('0x33')][_0x7517('0x34')];_0x29b241[_0x7517('0x35')]=_[_0x7517('0x36')](_0xd97aca);_0x29b241['query']=_['keys'](_0x1f8660[_0x7517('0x37')]);_0x29b241[_0x7517('0x38')]=_['intersection'](_0x29b241[_0x7517('0x35')],_0x29b241[_0x7517('0x37')]);_0x349fc5[_0x7517('0x39')]=_['intersection'](_0x29b241['model'],qs[_0x7517('0x3a')](_0x1f8660['query']['fields']));_0x349fc5[_0x7517('0x39')]=_0x349fc5[_0x7517('0x39')][_0x7517('0x3b')]?_0x349fc5[_0x7517('0x39')]:_0x29b241[_0x7517('0x35')];if(!_0x1f8660[_0x7517('0x37')][_0x7517('0x3c')](_0x7517('0x3d'))){_0x349fc5[_0x7517('0x3e')]=qs['limit'](_0x1f8660['query'][_0x7517('0x3e')]);_0x349fc5['offset']=qs[_0x7517('0x26')](_0x1f8660['query'][_0x7517('0x26')]);}_0x349fc5[_0x7517('0x3f')]=qs[_0x7517('0x40')](_0x1f8660[_0x7517('0x37')][_0x7517('0x40')]);_0x349fc5['where']=qs[_0x7517('0x38')](_[_0x7517('0x41')](_0x1f8660[_0x7517('0x37')],_0x29b241[_0x7517('0x38')]));if(_0x1f8660[_0x7517('0x37')][_0x7517('0x42')]){_0x349fc5[_0x7517('0x43')]=_[_0x7517('0x44')](_0x349fc5['where'],{'$or':_[_0x7517('0x45')](_0xd97aca,function(_0x1bb25f){if(_0x1bb25f['type'][_0x7517('0x46')]!=='VIRTUAL'){var _0x2aa13d={};_0x2aa13d[_0x1bb25f[_0x7517('0x47')]]={'$like':'%'+_0x1f8660[_0x7517('0x37')][_0x7517('0x42')]+'%'};return _0x2aa13d;}})});}_0x349fc5=_[_0x7517('0x44')]({},_0x349fc5,_0x1f8660[_0x7517('0x48')]);var _0x21e395={'where':_0x349fc5[_0x7517('0x43')]};return db[_0x7517('0x33')][_0x7517('0x49')](_0x21e395)['then'](function(_0x34c5b9){_0x42c3b9[_0x7517('0x49')]=_0x34c5b9;if(_0x1f8660[_0x7517('0x37')][_0x7517('0x4a')]){_0x349fc5[_0x7517('0x4b')]=[{'all':!![]}];}return db['Trunk'][_0x7517('0x4c')](_0x349fc5);})[_0x7517('0x17')](function(_0x138061){_0x42c3b9[_0x7517('0x4d')]=_0x138061;return _0x42c3b9;})[_0x7517('0x17')](respondWithFilteredResult(_0x25769a,_0x349fc5))['catch'](handleError(_0x25769a,null));};exports[_0x7517('0x4e')]=function(_0x1b5ac2,_0x343c33){var _0x526448={'raw':![],'where':{'id':_0x1b5ac2[_0x7517('0x4f')]['id']}},_0x547447={};_0x547447[_0x7517('0x35')]=_[_0x7517('0x36')](db[_0x7517('0x33')][_0x7517('0x34')]);_0x547447['query']=_[_0x7517('0x36')](_0x1b5ac2[_0x7517('0x37')]);_0x547447[_0x7517('0x38')]=_[_0x7517('0x50')](_0x547447[_0x7517('0x35')],_0x547447[_0x7517('0x37')]);_0x526448[_0x7517('0x39')]=_[_0x7517('0x50')](_0x547447[_0x7517('0x35')],qs[_0x7517('0x3a')](_0x1b5ac2[_0x7517('0x37')][_0x7517('0x3a')]));_0x526448[_0x7517('0x39')]=_0x526448[_0x7517('0x39')][_0x7517('0x3b')]?_0x526448[_0x7517('0x39')]:_0x547447[_0x7517('0x35')];if(_0x1b5ac2[_0x7517('0x37')][_0x7517('0x4a')]){_0x526448[_0x7517('0x4b')]=[{'all':!![]}];}_0x526448=_[_0x7517('0x44')]({},_0x526448,_0x1b5ac2[_0x7517('0x48')]);return db[_0x7517('0x33')]['find'](_0x526448)['then'](handleEntityNotFound(_0x343c33,null))['then'](respondWithResult(_0x343c33,null))[_0x7517('0x21')](handleError(_0x343c33,null));};exports[_0x7517('0x51')]=function(_0x46eb85,_0x471d93){var _0x9b0892={'raw':![],'where':{'id':_0x46eb85['params']['id']}},_0x451d8e={};_0x451d8e[_0x7517('0x35')]=_[_0x7517('0x36')](db[_0x7517('0x33')][_0x7517('0x34')]);_0x9b0892[_0x7517('0x39')]=_['intersection'](_0x451d8e[_0x7517('0x35')],qs[_0x7517('0x3a')](_0x46eb85[_0x7517('0x37')][_0x7517('0x3a')]));_0x9b0892[_0x7517('0x39')]=_0x9b0892[_0x7517('0x39')]['length']?_0x9b0892[_0x7517('0x39')]:_0x451d8e[_0x7517('0x35')];if(_0x46eb85[_0x7517('0x37')]['includeAll']){_0x9b0892[_0x7517('0x4b')]=[{'all':!![]}];}_0x9b0892=_[_0x7517('0x44')]({},_0x9b0892,_0x46eb85[_0x7517('0x48')]);return db['Trunk']['find'](_0x9b0892)[_0x7517('0x17')](handleEntityNotFound(_0x471d93,null))[_0x7517('0x17')](function(_0xc08421){if(_0xc08421){var _0x2b1502=_0xc08421[_0x7517('0x2d')]({'plain':!![]});_0x2b1502=qs[_0x7517('0x52')](_0x2b1502,['id',_0x7517('0x53'),_0x7517('0x54')]);_0x46eb85[_0x7517('0x55')]=_[_0x7517('0x52')](_0x46eb85[_0x7517('0x55')],['id',_0x7517('0x53'),'updatedAt']);return db[_0x7517('0x33')][_0x7517('0x56')](_[_0x7517('0x44')](_0x2b1502,_0x46eb85[_0x7517('0x55')]),{'include':_0x46eb85[_0x7517('0x37')][_0x7517('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x49c7b8){var _0x258e7a=_0x46eb85[_0x7517('0x57')][_0x7517('0x2d')]({'plain':!![]});if(!_0x258e7a)throw new Error(_0x7517('0x58'));if(_0x258e7a[_0x7517('0x59')]==='user'){var _0x271b50=_0x49c7b8[_0x7517('0x2d')]({'plain':!![]});var _0x209b7d=_0x7517('0x2e');return db[_0x7517('0x5a')][_0x7517('0x5b')]({'where':{'name':_0x209b7d,'userProfileId':_0x258e7a[_0x7517('0x5c')]},'raw':!![]})['then'](function(_0x5b5cf7){if(_0x5b5cf7&&_0x5b5cf7[_0x7517('0x5d')]===0x0){return db[_0x7517('0x2f')][_0x7517('0x56')]({'name':_0x271b50[_0x7517('0x32')],'resourceId':_0x271b50['id'],'type':_0x5b5cf7[_0x7517('0x32')],'sectionId':_0x5b5cf7['id']},{})[_0x7517('0x17')](function(){return _0x49c7b8;});}else{return _0x49c7b8;}})[_0x7517('0x21')](function(_0x2bbc54){logger[_0x7517('0x1c')](_0x7517('0x5e'),_0x2bbc54);throw _0x2bbc54;});}return _0x49c7b8;});}})['then'](respondWithResult(_0x471d93,0xc9))[_0x7517('0x21')](handleError(_0x471d93,null));};exports['create']=function(_0x5e23da,_0x197e5f,_0x354669){var _0x4649e9;return db[_0x7517('0x33')][_0x7517('0x56')](_0x5e23da[_0x7517('0x55')],{'raw':!![]})[_0x7517('0x17')](function(_0x322fa4){_0x4649e9=_0x322fa4;return db['Trunk'][_0x7517('0x4c')]({'raw':!![]});})['then'](function(_0x1f6cf1){var _0xe88a30=fs[_0x7517('0x5f')](path[_0x7517('0x60')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x59deba=fs['readFileSync'](path[_0x7517('0x60')](config[_0x7517('0x61')],_0x7517('0x62')),_0x7517('0x63'));var _0x431ad1=ejs['render'](_0xe88a30,{'trunks':_0x1f6cf1||[]});fs[_0x7517('0x64')](_0x7517('0x65'),_0x431ad1);if(_0x4649e9[_0x7517('0x66')]){var _0x11ebb5=ejs[_0x7517('0x67')](_0x59deba,{'trunks':_0x1f6cf1||[]});fs[_0x7517('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x11ebb5);}})['then'](function(){return respondWithRpcPromise(_0x7517('0x68'),_0x7517('0x56'),{'module':_0x7517('0x69')});})[_0x7517('0x17')](function(){var _0x2822af=_0x5e23da[_0x7517('0x57')][_0x7517('0x2d')]({'plain':!![]});if(!_0x2822af)throw new Error(_0x7517('0x58'));if(_0x2822af[_0x7517('0x59')]==='user'){var _0x37fb84=_0x4649e9[_0x7517('0x2d')]({'plain':!![]});return db[_0x7517('0x5a')]['find']({'where':{'name':'Trunks','userProfileId':_0x2822af[_0x7517('0x5c')]},'raw':!![]})[_0x7517('0x17')](function(_0x50fb21){if(_0x50fb21&&_0x50fb21[_0x7517('0x5d')]===0x0){return db[_0x7517('0x2f')]['create']({'name':_0x37fb84['name'],'resourceId':_0x37fb84['id'],'type':_0x50fb21[_0x7517('0x32')],'sectionId':_0x50fb21['id']},{})['then'](function(){return _0x4649e9;});}else{return _0x4649e9;}})[_0x7517('0x21')](function(_0x2ef4b5){logger[_0x7517('0x1c')](_0x7517('0x5e'),_0x2ef4b5);throw _0x2ef4b5;});}return _0x4649e9;})['then'](respondWithResult(_0x197e5f,0xc9))[_0x7517('0x21')](handleError(_0x197e5f,null));};exports[_0x7517('0x2c')]=function(_0x5086e5,_0x332d50,_0x534aad){var _0x1f9228;return db[_0x7517('0x33')]['find']({'where':{'id':_0x5086e5[_0x7517('0x4f')]['id']}})[_0x7517('0x17')](handleEntityNotFound(_0x332d50,null))[_0x7517('0x17')](saveUpdates(_0x5086e5[_0x7517('0x55')],null))[_0x7517('0x17')](function(_0x28b2e5){if(_0x28b2e5){_0x1f9228=_0x28b2e5;return db[_0x7517('0x33')][_0x7517('0x4c')]({'raw':!![]});}})['then'](function(_0x209b3a){if(_0x209b3a){var _0x2171e0=fs[_0x7517('0x5f')](path[_0x7517('0x60')](config[_0x7517('0x61')],_0x7517('0x6a')),'utf8');var _0x4399bf=fs[_0x7517('0x5f')](path[_0x7517('0x60')](config[_0x7517('0x61')],_0x7517('0x62')),_0x7517('0x63'));var _0x3ade81=ejs[_0x7517('0x67')](_0x2171e0,{'trunks':_0x209b3a||[]});fs[_0x7517('0x64')](_0x7517('0x65'),_0x3ade81);var _0xafc906=ejs[_0x7517('0x67')](_0x4399bf,{'trunks':_0x209b3a||[]});fs['writeFileSync'](_0x7517('0x6b'),_0xafc906);return respondWithRpcPromise(_0x7517('0x68'),_0x7517('0x2c'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x21ac1c){if(_0x21ac1c){return _0x1f9228;}})[_0x7517('0x17')](respondWithResult(_0x332d50,null))[_0x7517('0x21')](handleError(_0x332d50,null));};exports[_0x7517('0x30')]=function(_0x588f60,_0x52faac,_0x5d0cea){var _0x2932c6;return db['Trunk'][_0x7517('0x5b')]({'where':{'id':_0x588f60['params']['id']}})['then'](handleEntityNotFound(_0x52faac,null))[_0x7517('0x17')](removeEntity(_0x52faac,null))[_0x7517('0x17')](function(){return db[_0x7517('0x33')][_0x7517('0x4c')]({'raw':!![]});})['then'](function(_0x3acf6d){var _0x3c3a5a=fs[_0x7517('0x5f')](path[_0x7517('0x60')](config['root'],'server/files/templates/trunk.ejs'),_0x7517('0x63'));var _0x35ba64=fs['readFileSync'](path[_0x7517('0x60')](config[_0x7517('0x61')],_0x7517('0x62')),_0x7517('0x63'));var _0x3a49cb=ejs['render'](_0x3c3a5a,{'trunks':_0x3acf6d});var _0x2d021a=ejs[_0x7517('0x67')](_0x35ba64,{'trunks':_0x3acf6d});fs[_0x7517('0x64')](_0x7517('0x65'),_0x3a49cb);fs[_0x7517('0x64')](_0x7517('0x6b'),_0x2d021a);return respondWithRpcPromise(_0x7517('0x68'),'destroy',{'module':'chan_sip.so'});})[_0x7517('0x21')](handleError(_0x52faac,null));}; \ No newline at end of file +var _0xc49d=['Content-Range','apply','reject','save','update','then','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','key','VIRTUAL','field','Trunk','includeAll','include','findAll','rows','show','params','length','options','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Reload','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','ioredis','api','../../config/utils','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc49d,0xb1));var _0xdc49=function(_0x51774a,_0x2c007b){_0x51774a=_0x51774a-0x0;var _0x550199=_0xc49d[_0x51774a];return _0x550199;};'use strict';var pdf=require(_0xdc49('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdc49('0x1'));var zipdir=require(_0xdc49('0x2'));var jsonpatch=require(_0xdc49('0x3'));var rp=require(_0xdc49('0x4'));var moment=require(_0xdc49('0x5'));var BPromise=require(_0xdc49('0x6'));var Mustache=require(_0xdc49('0x7'));var util=require(_0xdc49('0x8'));var path=require('path');var sox=require(_0xdc49('0x9'));var csv=require('to-csv');var ejs=require(_0xdc49('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdc49('0xb'));var jsforce=require(_0xdc49('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdc49('0xd'));var querystring=require(_0xdc49('0xe'));var Papa=require(_0xdc49('0xf'));var authService=require(_0xdc49('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xdc49('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xdc49('0x12'));var utils=require(_0xdc49('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xdc49('0x14'));var client=jayson[_0xdc49('0x15')][_0xdc49('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3a9292,_0x183d13,_0x2d729b,_0xda5113){return new BPromise(function(_0xccb01f,_0x36adc7){var _0x53fa89=_0xda5113||client;return _0x53fa89[_0xdc49('0x17')](_0x3a9292,_0x2d729b)['then'](function(_0xb20a15){logger[_0xdc49('0x18')](_0xdc49('0x19'),_0x183d13,_0xdc49('0x1a'));logger['debug'](_0xdc49('0x1b'),_0x183d13,_0xdc49('0x1a'),JSON[_0xdc49('0x1c')](_0xb20a15));if(_0xb20a15[_0xdc49('0x1d')]){if(_0xb20a15[_0xdc49('0x1d')][_0xdc49('0x1e')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x183d13,_0xb20a15['error'][_0xdc49('0x1f')]);return _0x36adc7(_0xb20a15[_0xdc49('0x1d')][_0xdc49('0x1f')]);}logger[_0xdc49('0x1d')](_0xdc49('0x19'),_0x183d13,_0xb20a15[_0xdc49('0x1d')][_0xdc49('0x1f')]);return _0xccb01f(_0xb20a15[_0xdc49('0x1d')][_0xdc49('0x1f')]);}else{logger[_0xdc49('0x18')](_0xdc49('0x19'),_0x183d13,_0xdc49('0x1a'));_0xccb01f(_0xb20a15[_0xdc49('0x20')][_0xdc49('0x1f')]);}})[_0xdc49('0x21')](function(_0x3393f3){logger[_0xdc49('0x1d')](_0xdc49('0x19'),_0x183d13,_0x3393f3);_0x36adc7(_0x3393f3);});});}function respondWithStatusCode(_0x1ccbf5,_0xcb1c15){_0xcb1c15=_0xcb1c15||0xcc;return function(_0x4f9a78){if(_0x4f9a78){return _0x1ccbf5[_0xdc49('0x22')](_0xcb1c15);}return _0x1ccbf5[_0xdc49('0x23')](_0xcb1c15)[_0xdc49('0x24')]();};}function respondWithResult(_0x47df20,_0x360574){_0x360574=_0x360574||0xc8;return function(_0xadea74){if(_0xadea74){return _0x47df20[_0xdc49('0x23')](_0x360574)[_0xdc49('0x25')](_0xadea74);}};}function respondWithFilteredResult(_0x495e1f,_0x536884){return function(_0x30a1d7){if(_0x30a1d7){var _0xea6c07=_0x30a1d7[_0xdc49('0x26')],_0x2ec861=_0x536884[_0xdc49('0x27')],_0x2292e2=_0x536884[_0xdc49('0x27')]+_0x536884['limit'],_0x56a091;if(_0x2292e2>=_0xea6c07){_0x2292e2=_0xea6c07;_0x56a091=0xc8;}else{_0x56a091=0xce;}_0x495e1f['status'](_0x56a091);return _0x495e1f[_0xdc49('0x28')](_0xdc49('0x29'),_0x2ec861+'-'+_0x2292e2+'/'+_0xea6c07)[_0xdc49('0x25')](_0x30a1d7);}return null;};}function patchUpdates(_0x2b1ea1){return function(_0x25315a){try{jsonpatch[_0xdc49('0x2a')](_0x25315a,_0x2b1ea1,!![]);}catch(_0x4a1b3c){return BPromise[_0xdc49('0x2b')](_0x4a1b3c);}return _0x25315a[_0xdc49('0x2c')]();};}function saveUpdates(_0x2e18ef,_0x46d835){return function(_0x1ed0dc){if(_0x1ed0dc){return _0x1ed0dc[_0xdc49('0x2d')](_0x2e18ef)[_0xdc49('0x2e')](function(_0x4bd1ce){return _0x4bd1ce;});}return null;};}function removeEntity(_0x156f6a,_0x25e12e){return function(_0x4426e8){if(_0x4426e8){return _0x4426e8[_0xdc49('0x2f')]()[_0xdc49('0x2e')](function(){var _0x2588f9=_0x4426e8[_0xdc49('0x30')]({'plain':!![]});var _0x3aac39=_0xdc49('0x31');return db[_0xdc49('0x32')][_0xdc49('0x2f')]({'where':{'type':_0x3aac39,'resourceId':_0x2588f9['id']}})['then'](function(){return _0x4426e8;});})[_0xdc49('0x2e')](function(){_0x156f6a['status'](0xcc)[_0xdc49('0x24')]();});}};}function handleEntityNotFound(_0x1d0509,_0x752d2c){return function(_0x507ffa){if(!_0x507ffa){_0x1d0509[_0xdc49('0x22')](0x194);}return _0x507ffa;};}function handleError(_0x59a20c,_0x5c32e7){_0x5c32e7=_0x5c32e7||0x1f4;return function(_0x460bfa){logger[_0xdc49('0x1d')](_0x460bfa[_0xdc49('0x33')]);if(_0x460bfa[_0xdc49('0x34')]){delete _0x460bfa['name'];}_0x59a20c[_0xdc49('0x23')](_0x5c32e7)[_0xdc49('0x35')](_0x460bfa);};}exports[_0xdc49('0x36')]=function(_0x43222f,_0x542280){var _0x52c150={},_0xecd34b={},_0x42ef05={'count':0x0,'rows':[]};var _0x193e27=db['Trunk'][_0xdc49('0x37')];_0xecd34b['model']=_[_0xdc49('0x38')](_0x193e27);_0xecd34b[_0xdc49('0x39')]=_[_0xdc49('0x38')](_0x43222f[_0xdc49('0x39')]);_0xecd34b[_0xdc49('0x3a')]=_['intersection'](_0xecd34b['model'],_0xecd34b[_0xdc49('0x39')]);_0x52c150[_0xdc49('0x3b')]=_[_0xdc49('0x3c')](_0xecd34b[_0xdc49('0x3d')],qs[_0xdc49('0x3e')](_0x43222f[_0xdc49('0x39')][_0xdc49('0x3e')]));_0x52c150[_0xdc49('0x3b')]=_0x52c150[_0xdc49('0x3b')]['length']?_0x52c150[_0xdc49('0x3b')]:_0xecd34b['model'];if(!_0x43222f['query'][_0xdc49('0x3f')](_0xdc49('0x40'))){_0x52c150[_0xdc49('0x41')]=qs[_0xdc49('0x41')](_0x43222f[_0xdc49('0x39')]['limit']);_0x52c150['offset']=qs[_0xdc49('0x27')](_0x43222f[_0xdc49('0x39')]['offset']);}_0x52c150[_0xdc49('0x42')]=qs[_0xdc49('0x43')](_0x43222f['query']['sort']);_0x52c150[_0xdc49('0x44')]=qs[_0xdc49('0x3a')](_[_0xdc49('0x45')](_0x43222f['query'],_0xecd34b[_0xdc49('0x3a')]));if(_0x43222f[_0xdc49('0x39')]['filter']){_0x52c150[_0xdc49('0x44')]=_[_0xdc49('0x46')](_0x52c150['where'],{'$or':_[_0xdc49('0x47')](_0x193e27,function(_0x416b6c){if(_0x416b6c['type'][_0xdc49('0x48')]!==_0xdc49('0x49')){var _0x4a29e0={};_0x4a29e0[_0x416b6c[_0xdc49('0x4a')]]={'$like':'%'+_0x43222f[_0xdc49('0x39')]['filter']+'%'};return _0x4a29e0;}})});}_0x52c150=_['merge']({},_0x52c150,_0x43222f['options']);var _0x342988={'where':_0x52c150[_0xdc49('0x44')]};return db[_0xdc49('0x4b')][_0xdc49('0x26')](_0x342988)['then'](function(_0x10be71){_0x42ef05['count']=_0x10be71;if(_0x43222f['query'][_0xdc49('0x4c')]){_0x52c150[_0xdc49('0x4d')]=[{'all':!![]}];}return db[_0xdc49('0x4b')][_0xdc49('0x4e')](_0x52c150);})[_0xdc49('0x2e')](function(_0x5997a3){_0x42ef05[_0xdc49('0x4f')]=_0x5997a3;return _0x42ef05;})[_0xdc49('0x2e')](respondWithFilteredResult(_0x542280,_0x52c150))[_0xdc49('0x21')](handleError(_0x542280,null));};exports[_0xdc49('0x50')]=function(_0x124663,_0x206156){var _0x5de98e={'raw':![],'where':{'id':_0x124663[_0xdc49('0x51')]['id']}},_0x6979f1={};_0x6979f1[_0xdc49('0x3d')]=_[_0xdc49('0x38')](db[_0xdc49('0x4b')][_0xdc49('0x37')]);_0x6979f1[_0xdc49('0x39')]=_[_0xdc49('0x38')](_0x124663['query']);_0x6979f1[_0xdc49('0x3a')]=_['intersection'](_0x6979f1[_0xdc49('0x3d')],_0x6979f1['query']);_0x5de98e[_0xdc49('0x3b')]=_[_0xdc49('0x3c')](_0x6979f1[_0xdc49('0x3d')],qs[_0xdc49('0x3e')](_0x124663[_0xdc49('0x39')][_0xdc49('0x3e')]));_0x5de98e[_0xdc49('0x3b')]=_0x5de98e[_0xdc49('0x3b')][_0xdc49('0x52')]?_0x5de98e[_0xdc49('0x3b')]:_0x6979f1[_0xdc49('0x3d')];if(_0x124663[_0xdc49('0x39')][_0xdc49('0x4c')]){_0x5de98e[_0xdc49('0x4d')]=[{'all':!![]}];}_0x5de98e=_[_0xdc49('0x46')]({},_0x5de98e,_0x124663[_0xdc49('0x53')]);return db['Trunk'][_0xdc49('0x54')](_0x5de98e)['then'](handleEntityNotFound(_0x206156,null))[_0xdc49('0x2e')](respondWithResult(_0x206156,null))[_0xdc49('0x21')](handleError(_0x206156,null));};exports[_0xdc49('0x55')]=function(_0xf31895,_0x4c14db){var _0x44763d={'raw':![],'where':{'id':_0xf31895['params']['id']}},_0x40a8ac={};_0x40a8ac[_0xdc49('0x3d')]=_[_0xdc49('0x38')](db[_0xdc49('0x4b')][_0xdc49('0x37')]);_0x44763d['attributes']=_[_0xdc49('0x3c')](_0x40a8ac[_0xdc49('0x3d')],qs['fields'](_0xf31895[_0xdc49('0x39')][_0xdc49('0x3e')]));_0x44763d[_0xdc49('0x3b')]=_0x44763d[_0xdc49('0x3b')]['length']?_0x44763d[_0xdc49('0x3b')]:_0x40a8ac['model'];if(_0xf31895['query'][_0xdc49('0x4c')]){_0x44763d[_0xdc49('0x4d')]=[{'all':!![]}];}_0x44763d=_[_0xdc49('0x46')]({},_0x44763d,_0xf31895[_0xdc49('0x53')]);return db[_0xdc49('0x4b')][_0xdc49('0x54')](_0x44763d)[_0xdc49('0x2e')](handleEntityNotFound(_0x4c14db,null))[_0xdc49('0x2e')](function(_0x3ca6b4){if(_0x3ca6b4){var _0x5d5a5e=_0x3ca6b4[_0xdc49('0x30')]({'plain':!![]});_0x5d5a5e=qs[_0xdc49('0x56')](_0x5d5a5e,['id',_0xdc49('0x57'),_0xdc49('0x58')]);_0xf31895[_0xdc49('0x59')]=_['omit'](_0xf31895['body'],['id',_0xdc49('0x57'),'updatedAt']);return db[_0xdc49('0x4b')]['create'](_[_0xdc49('0x46')](_0x5d5a5e,_0xf31895[_0xdc49('0x59')]),{'include':_0xf31895['query'][_0xdc49('0x4c')]?[{'all':!![]}]:undefined})[_0xdc49('0x2e')](function(_0x54cf17){var _0x2d3b48=_0xf31895[_0xdc49('0x5a')][_0xdc49('0x30')]({'plain':!![]});if(!_0x2d3b48)throw new Error(_0xdc49('0x5b'));if(_0x2d3b48[_0xdc49('0x5c')]==='user'){var _0x54faa1=_0x54cf17[_0xdc49('0x30')]({'plain':!![]});var _0x2709b1=_0xdc49('0x31');return db[_0xdc49('0x5d')][_0xdc49('0x54')]({'where':{'name':_0x2709b1,'userProfileId':_0x2d3b48[_0xdc49('0x5e')]},'raw':!![]})[_0xdc49('0x2e')](function(_0x225421){if(_0x225421&&_0x225421[_0xdc49('0x5f')]===0x0){return db[_0xdc49('0x32')]['create']({'name':_0x54faa1[_0xdc49('0x34')],'resourceId':_0x54faa1['id'],'type':_0x225421[_0xdc49('0x34')],'sectionId':_0x225421['id']},{})[_0xdc49('0x2e')](function(){return _0x54cf17;});}else{return _0x54cf17;}})[_0xdc49('0x21')](function(_0x5ef34b){logger[_0xdc49('0x1d')](_0xdc49('0x60'),_0x5ef34b);throw _0x5ef34b;});}return _0x54cf17;});}})[_0xdc49('0x2e')](respondWithResult(_0x4c14db,0xc9))[_0xdc49('0x21')](handleError(_0x4c14db,null));};exports['create']=function(_0x1a710c,_0x4e3ca0,_0x9201d4){var _0x4051f9;return db[_0xdc49('0x4b')][_0xdc49('0x61')](_0x1a710c['body'],{'raw':!![]})[_0xdc49('0x2e')](function(_0x148515){_0x4051f9=_0x148515;return db[_0xdc49('0x4b')][_0xdc49('0x4e')]({'raw':!![]});})['then'](function(_0x5a28c8){var _0x660023=fs[_0xdc49('0x62')](path[_0xdc49('0x63')](config[_0xdc49('0x64')],'server/files/templates/trunk.ejs'),_0xdc49('0x65'));var _0x2568f1=fs[_0xdc49('0x62')](path['join'](config[_0xdc49('0x64')],_0xdc49('0x66')),_0xdc49('0x65'));var _0x5afe3e=ejs[_0xdc49('0x67')](_0x660023,{'trunks':_0x5a28c8||[]});fs[_0xdc49('0x68')](_0xdc49('0x69'),_0x5afe3e);if(_0x4051f9['registry']){var _0x1b2b67=ejs[_0xdc49('0x67')](_0x2568f1,{'trunks':_0x5a28c8||[]});fs[_0xdc49('0x68')](_0xdc49('0x6a'),_0x1b2b67);}})[_0xdc49('0x2e')](function(){return respondWithRpcPromise('Reload',_0xdc49('0x61'),{'module':_0xdc49('0x6b')});})[_0xdc49('0x2e')](function(){var _0x39377e=_0x1a710c['user'][_0xdc49('0x30')]({'plain':!![]});if(!_0x39377e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39377e[_0xdc49('0x5c')]==='user'){var _0x5dd46=_0x4051f9['get']({'plain':!![]});return db[_0xdc49('0x5d')][_0xdc49('0x54')]({'where':{'name':_0xdc49('0x31'),'userProfileId':_0x39377e[_0xdc49('0x5e')]},'raw':!![]})[_0xdc49('0x2e')](function(_0x32ad00){if(_0x32ad00&&_0x32ad00[_0xdc49('0x5f')]===0x0){return db[_0xdc49('0x32')][_0xdc49('0x61')]({'name':_0x5dd46[_0xdc49('0x34')],'resourceId':_0x5dd46['id'],'type':_0x32ad00[_0xdc49('0x34')],'sectionId':_0x32ad00['id']},{})[_0xdc49('0x2e')](function(){return _0x4051f9;});}else{return _0x4051f9;}})[_0xdc49('0x21')](function(_0x651971){logger[_0xdc49('0x1d')](_0xdc49('0x60'),_0x651971);throw _0x651971;});}return _0x4051f9;})[_0xdc49('0x2e')](respondWithResult(_0x4e3ca0,0xc9))[_0xdc49('0x21')](handleError(_0x4e3ca0,null));};exports[_0xdc49('0x2d')]=function(_0x3fb731,_0x3a22a1,_0x1d652f){var _0x4580f2;return db[_0xdc49('0x4b')][_0xdc49('0x54')]({'where':{'id':_0x3fb731[_0xdc49('0x51')]['id']}})['then'](handleEntityNotFound(_0x3a22a1,null))['then'](saveUpdates(_0x3fb731[_0xdc49('0x59')],null))[_0xdc49('0x2e')](function(_0x5c0910){if(_0x5c0910){_0x4580f2=_0x5c0910;return db[_0xdc49('0x4b')][_0xdc49('0x4e')]({'raw':!![]});}})[_0xdc49('0x2e')](function(_0x3e816f){if(_0x3e816f){var _0x2140c8=fs[_0xdc49('0x62')](path[_0xdc49('0x63')](config[_0xdc49('0x64')],'server/files/templates/trunk.ejs'),_0xdc49('0x65'));var _0x5ef889=fs[_0xdc49('0x62')](path[_0xdc49('0x63')](config[_0xdc49('0x64')],_0xdc49('0x66')),_0xdc49('0x65'));var _0x50b402=ejs[_0xdc49('0x67')](_0x2140c8,{'trunks':_0x3e816f||[]});fs[_0xdc49('0x68')](_0xdc49('0x69'),_0x50b402);var _0x31fd1b=ejs[_0xdc49('0x67')](_0x5ef889,{'trunks':_0x3e816f||[]});fs[_0xdc49('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x31fd1b);return respondWithRpcPromise(_0xdc49('0x6c'),'update',{'module':'chan_sip.so'});}return null;})[_0xdc49('0x2e')](function(_0x3557bc){if(_0x3557bc){return _0x4580f2;}})[_0xdc49('0x2e')](respondWithResult(_0x3a22a1,null))[_0xdc49('0x21')](handleError(_0x3a22a1,null));};exports[_0xdc49('0x2f')]=function(_0x4a97d0,_0x1627fc,_0x22d729){var _0x5d18fe;return db[_0xdc49('0x4b')]['find']({'where':{'id':_0x4a97d0['params']['id']}})[_0xdc49('0x2e')](handleEntityNotFound(_0x1627fc,null))['then'](removeEntity(_0x1627fc,null))[_0xdc49('0x2e')](function(){return db[_0xdc49('0x4b')]['findAll']({'raw':!![]});})[_0xdc49('0x2e')](function(_0x5b992e){var _0x53c782=fs['readFileSync'](path[_0xdc49('0x63')](config[_0xdc49('0x64')],'server/files/templates/trunk.ejs'),_0xdc49('0x65'));var _0x36b4ca=fs[_0xdc49('0x62')](path[_0xdc49('0x63')](config[_0xdc49('0x64')],_0xdc49('0x66')),'utf8');var _0x52b289=ejs[_0xdc49('0x67')](_0x53c782,{'trunks':_0x5b992e});var _0x462f4a=ejs['render'](_0x36b4ca,{'trunks':_0x5b992e});fs['writeFileSync'](_0xdc49('0x69'),_0x52b289);fs['writeFileSync'](_0xdc49('0x6a'),_0x462f4a);return respondWithRpcPromise(_0xdc49('0x6c'),'destroy',{'module':_0xdc49('0x6b')});})[_0xdc49('0x21')](handleError(_0x1627fc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index a183144..0733ba6 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 _0xa8d3=['exports','Trunk','tools_trunks','lodash','util','../../config/logger','request-promise','./trunk.attributes'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa8d3,0x9b));var _0x3a8d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa8d3[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x3a8d('0x0'));var util=require(_0x3a8d('0x1'));var logger=require(_0x3a8d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3a8d('0x3'));var attributes=require(_0x3a8d('0x4'));module[_0x3a8d('0x5')]=function(_0x58a70c,_0x3fce1a){return _0x58a70c['define'](_0x3a8d('0x6'),attributes,{'tableName':_0x3a8d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3992=['api','moment','bluebird','request-promise','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger'];(function(_0x41af74,_0x3707cc){var _0x17f66d=function(_0x41c554){while(--_0x41c554){_0x41af74['push'](_0x41af74['shift']());}};_0x17f66d(++_0x3707cc);}(_0x3992,0xef));var _0x2399=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3992[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x2399('0x0'));var util=require(_0x2399('0x1'));var logger=require(_0x2399('0x2'))(_0x2399('0x3'));var moment=require(_0x2399('0x4'));var BPromise=require(_0x2399('0x5'));var rp=require(_0x2399('0x6'));var attributes=require('./trunk.attributes');module[_0x2399('0x7')]=function(_0x4bb284,_0x5b13e5){return _0x4bb284[_0x2399('0x8')](_0x2399('0x9'),attributes,{'tableName':_0x2399('0xa'),'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 8b9b69b..2ed9a24 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 _0x650d=['raw','where','limit','include','map','model','attributes','then','ShowTrunk','find','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','result','catch','GetTrunk','findAll','options'];(function(_0x412656,_0x471054){var _0x255e9f=function(_0x4d8a6c){while(--_0x4d8a6c){_0x412656['push'](_0x412656['shift']());}};_0x255e9f(++_0x471054);}(_0x650d,0x1e6));var _0xd650=function(_0x33f5de,_0x5e4f9e){_0x33f5de=_0x33f5de-0x0;var _0x1add2f=_0x650d[_0x33f5de];return _0x1add2f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd650('0x0'));var BPromise=require(_0xd650('0x1'));var rs=require(_0xd650('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd650('0x3'))['db'];var utils=require(_0xd650('0x4'));var logger=require('../../config/logger')(_0xd650('0x5'));var config=require(_0xd650('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd650('0x7')][_0xd650('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xee5f32,_0x1424cb,_0x3bdb17){return new BPromise(function(_0x36925e,_0x1a2f51){return client[_0xd650('0x9')](_0xee5f32,_0x3bdb17)['then'](function(_0x3727c3){logger[_0xd650('0xa')]('Trunk,\x20%s,\x20%s',_0x1424cb,_0xd650('0xb'));logger[_0xd650('0xc')](_0xd650('0xd'),_0x1424cb,_0xd650('0xb'),JSON[_0xd650('0xe')](_0x3727c3));if(_0x3727c3[_0xd650('0xf')]){if(_0x3727c3[_0xd650('0xf')][_0xd650('0x10')]===0x1f4){logger[_0xd650('0xf')]('Trunk,\x20%s,\x20%s',_0x1424cb,_0x3727c3['error'][_0xd650('0x11')]);return _0x1a2f51(_0x3727c3[_0xd650('0xf')][_0xd650('0x11')]);}logger[_0xd650('0xf')](_0xd650('0x12'),_0x1424cb,_0x3727c3[_0xd650('0xf')][_0xd650('0x11')]);return _0x36925e(_0x3727c3[_0xd650('0xf')][_0xd650('0x11')]);}else{logger[_0xd650('0xa')](_0xd650('0x12'),_0x1424cb,'request\x20sent');_0x36925e(_0x3727c3[_0xd650('0x13')][_0xd650('0x11')]);}})[_0xd650('0x14')](function(_0x32738f){logger[_0xd650('0xf')]('Trunk,\x20%s,\x20%s',_0x1424cb,_0x32738f);_0x1a2f51(_0x32738f);});});}exports[_0xd650('0x15')]=function(_0x1de4ca){var _0x27d4a2=this;return new Promise(function(_0x1de952,_0x55b123){return db['Trunk'][_0xd650('0x16')]({'raw':_0x1de4ca[_0xd650('0x17')]?_0x1de4ca[_0xd650('0x17')][_0xd650('0x18')]===undefined?!![]:![]:!![],'where':_0x1de4ca[_0xd650('0x17')]?_0x1de4ca[_0xd650('0x17')][_0xd650('0x19')]||null:null,'attributes':_0x1de4ca['options']?_0x1de4ca[_0xd650('0x17')]['attributes']||null:null,'limit':_0x1de4ca[_0xd650('0x17')]?_0x1de4ca['options'][_0xd650('0x1a')]||null:null,'include':_0x1de4ca['options']?_0x1de4ca[_0xd650('0x17')][_0xd650('0x1b')]?_[_0xd650('0x1c')](_0x1de4ca[_0xd650('0x17')]['include'],function(_0x287d8f){return{'model':db[_0x287d8f[_0xd650('0x1d')]],'as':_0x287d8f['as'],'attributes':_0x287d8f[_0xd650('0x1e')],'include':_0x287d8f[_0xd650('0x1b')]?_[_0xd650('0x1c')](_0x287d8f[_0xd650('0x1b')],function(_0x3df4cc){return{'model':db[_0x3df4cc[_0xd650('0x1d')]],'as':_0x3df4cc['as'],'attributes':_0x3df4cc['attributes'],'include':_0x3df4cc['include']?_['map'](_0x3df4cc[_0xd650('0x1b')],function(_0x401b62){return{'model':db[_0x401b62[_0xd650('0x1d')]],'as':_0x401b62['as'],'attributes':_0x401b62[_0xd650('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd650('0x1f')](function(_0x1e4973){logger[_0xd650('0xa')](_0xd650('0x15'),_0x1de4ca);logger[_0xd650('0xc')](_0xd650('0x15'),_0x1de4ca,JSON[_0xd650('0xe')](_0x1e4973));_0x1de952(_0x1e4973);})['catch'](function(_0x3a8ddb){logger['error'](_0xd650('0x15'),_0x3a8ddb[_0xd650('0x11')],_0x1de4ca);_0x55b123(_0x27d4a2[_0xd650('0xf')](0x1f4,_0x3a8ddb[_0xd650('0x11')]));});});};exports[_0xd650('0x20')]=function(_0x13cecc){var _0x307a9c=this;return new Promise(function(_0x9f9d36,_0xa91935){return db['Trunk'][_0xd650('0x21')]({'raw':_0x13cecc['options']?_0x13cecc[_0xd650('0x17')][_0xd650('0x18')]===undefined?!![]:![]:!![],'where':_0x13cecc[_0xd650('0x17')]?_0x13cecc['options']['where']||null:null,'attributes':_0x13cecc[_0xd650('0x17')]?_0x13cecc[_0xd650('0x17')]['attributes']||null:null,'include':_0x13cecc[_0xd650('0x17')]?_0x13cecc['options']['include']?_[_0xd650('0x1c')](_0x13cecc[_0xd650('0x17')][_0xd650('0x1b')],function(_0x5a1c04){return{'model':db[_0x5a1c04[_0xd650('0x1d')]],'as':_0x5a1c04['as'],'attributes':_0x5a1c04[_0xd650('0x1e')],'include':_0x5a1c04[_0xd650('0x1b')]?_[_0xd650('0x1c')](_0x5a1c04[_0xd650('0x1b')],function(_0x41eb28){return{'model':db[_0x41eb28[_0xd650('0x1d')]],'as':_0x41eb28['as'],'attributes':_0x41eb28[_0xd650('0x1e')],'include':_0x41eb28[_0xd650('0x1b')]?_['map'](_0x41eb28[_0xd650('0x1b')],function(_0x2d501c){return{'model':db[_0x2d501c[_0xd650('0x1d')]],'as':_0x2d501c['as'],'attributes':_0x2d501c[_0xd650('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd650('0x1f')](function(_0x49d338){logger[_0xd650('0xa')](_0xd650('0x20'),_0x13cecc);logger[_0xd650('0xc')](_0xd650('0x20'),_0x13cecc,JSON[_0xd650('0xe')](_0x49d338));_0x9f9d36(_0x49d338);})[_0xd650('0x14')](function(_0x32deb3){logger[_0xd650('0xf')]('ShowTrunk',_0x32deb3[_0xd650('0x11')],_0x13cecc);_0xa91935(_0x307a9c[_0xd650('0xf')](0x1f4,_0x32deb3[_0xd650('0x11')]));});});}; \ No newline at end of file +var _0x1091=['client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','limit','include','map','model','attributes','then','stringify','ShowTrunk','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1df806,_0x12df9b){var _0x7a0c81=function(_0x3ffe1b){while(--_0x3ffe1b){_0x1df806['push'](_0x1df806['shift']());}};_0x7a0c81(++_0x12df9b);}(_0x1091,0x19b));var _0x1109=function(_0x38b551,_0x272fbd){_0x38b551=_0x38b551-0x0;var _0x2ee2e6=_0x1091[_0x38b551];return _0x2ee2e6;};'use strict';var _=require('lodash');var util=require(_0x1109('0x0'));var moment=require('moment');var BPromise=require(_0x1109('0x1'));var rs=require(_0x1109('0x2'));var fs=require('fs');var Redis=require(_0x1109('0x3'));var db=require(_0x1109('0x4'))['db'];var utils=require(_0x1109('0x5'));var logger=require(_0x1109('0x6'))(_0x1109('0x7'));var config=require('../../config/environment');var jayson=require(_0x1109('0x8'));var client=jayson[_0x1109('0x9')][_0x1109('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32d603,_0x1bc912,_0x431206){return new BPromise(function(_0x1f7b27,_0x3fd852){return client[_0x1109('0xb')](_0x32d603,_0x431206)['then'](function(_0x2a0a70){logger[_0x1109('0xc')](_0x1109('0xd'),_0x1bc912,_0x1109('0xe'));logger[_0x1109('0xf')](_0x1109('0x10'),_0x1bc912,_0x1109('0xe'),JSON['stringify'](_0x2a0a70));if(_0x2a0a70[_0x1109('0x11')]){if(_0x2a0a70[_0x1109('0x11')][_0x1109('0x12')]===0x1f4){logger[_0x1109('0x11')](_0x1109('0xd'),_0x1bc912,_0x2a0a70[_0x1109('0x11')][_0x1109('0x13')]);return _0x3fd852(_0x2a0a70[_0x1109('0x11')]['message']);}logger[_0x1109('0x11')](_0x1109('0xd'),_0x1bc912,_0x2a0a70[_0x1109('0x11')][_0x1109('0x13')]);return _0x1f7b27(_0x2a0a70['error'][_0x1109('0x13')]);}else{logger[_0x1109('0xc')](_0x1109('0xd'),_0x1bc912,_0x1109('0xe'));_0x1f7b27(_0x2a0a70['result'][_0x1109('0x13')]);}})[_0x1109('0x14')](function(_0x552a37){logger['error'](_0x1109('0xd'),_0x1bc912,_0x552a37);_0x3fd852(_0x552a37);});});}exports[_0x1109('0x15')]=function(_0x17c79a){var _0x1b1d25=this;return new Promise(function(_0x50b5a0,_0x243033){return db[_0x1109('0x16')][_0x1109('0x17')]({'raw':_0x17c79a[_0x1109('0x18')]?_0x17c79a['options'][_0x1109('0x19')]===undefined?!![]:![]:!![],'where':_0x17c79a['options']?_0x17c79a[_0x1109('0x18')]['where']||null:null,'attributes':_0x17c79a[_0x1109('0x18')]?_0x17c79a[_0x1109('0x18')]['attributes']||null:null,'limit':_0x17c79a[_0x1109('0x18')]?_0x17c79a['options'][_0x1109('0x1a')]||null:null,'include':_0x17c79a[_0x1109('0x18')]?_0x17c79a[_0x1109('0x18')][_0x1109('0x1b')]?_[_0x1109('0x1c')](_0x17c79a['options'][_0x1109('0x1b')],function(_0x4b127e){return{'model':db[_0x4b127e[_0x1109('0x1d')]],'as':_0x4b127e['as'],'attributes':_0x4b127e[_0x1109('0x1e')],'include':_0x4b127e[_0x1109('0x1b')]?_[_0x1109('0x1c')](_0x4b127e[_0x1109('0x1b')],function(_0x300163){return{'model':db[_0x300163[_0x1109('0x1d')]],'as':_0x300163['as'],'attributes':_0x300163[_0x1109('0x1e')],'include':_0x300163[_0x1109('0x1b')]?_['map'](_0x300163[_0x1109('0x1b')],function(_0x3dbada){return{'model':db[_0x3dbada[_0x1109('0x1d')]],'as':_0x3dbada['as'],'attributes':_0x3dbada[_0x1109('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1109('0x1f')](function(_0x22c752){logger['info'](_0x1109('0x15'),_0x17c79a);logger[_0x1109('0xf')](_0x1109('0x15'),_0x17c79a,JSON[_0x1109('0x20')](_0x22c752));_0x50b5a0(_0x22c752);})[_0x1109('0x14')](function(_0x4ece39){logger[_0x1109('0x11')](_0x1109('0x15'),_0x4ece39['message'],_0x17c79a);_0x243033(_0x1b1d25[_0x1109('0x11')](0x1f4,_0x4ece39[_0x1109('0x13')]));});});};exports[_0x1109('0x21')]=function(_0x3152ee){var _0x29d830=this;return new Promise(function(_0x721197,_0x5c2f38){return db[_0x1109('0x16')][_0x1109('0x22')]({'raw':_0x3152ee['options']?_0x3152ee['options'][_0x1109('0x19')]===undefined?!![]:![]:!![],'where':_0x3152ee[_0x1109('0x18')]?_0x3152ee[_0x1109('0x18')]['where']||null:null,'attributes':_0x3152ee[_0x1109('0x18')]?_0x3152ee[_0x1109('0x18')]['attributes']||null:null,'include':_0x3152ee['options']?_0x3152ee[_0x1109('0x18')][_0x1109('0x1b')]?_[_0x1109('0x1c')](_0x3152ee[_0x1109('0x18')][_0x1109('0x1b')],function(_0x28d62){return{'model':db[_0x28d62[_0x1109('0x1d')]],'as':_0x28d62['as'],'attributes':_0x28d62[_0x1109('0x1e')],'include':_0x28d62[_0x1109('0x1b')]?_['map'](_0x28d62['include'],function(_0xc3da37){return{'model':db[_0xc3da37[_0x1109('0x1d')]],'as':_0xc3da37['as'],'attributes':_0xc3da37[_0x1109('0x1e')],'include':_0xc3da37[_0x1109('0x1b')]?_[_0x1109('0x1c')](_0xc3da37[_0x1109('0x1b')],function(_0x2c95b8){return{'model':db[_0x2c95b8['model']],'as':_0x2c95b8['as'],'attributes':_0x2c95b8[_0x1109('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1109('0x1f')](function(_0x358efa){logger[_0x1109('0xc')](_0x1109('0x21'),_0x3152ee);logger[_0x1109('0xf')](_0x1109('0x21'),_0x3152ee,JSON['stringify'](_0x358efa));_0x721197(_0x358efa);})['catch'](function(_0x3e93c1){logger[_0x1109('0x11')](_0x1109('0x21'),_0x3e93c1[_0x1109('0x13')],_0x3152ee);_0x5c2f38(_0x29d830[_0x1109('0x11')](0x1f4,_0x3e93c1[_0x1109('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index eda42c2..e9ef102 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 _0x70a1=['/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','server/files/images/','format','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','addSquareProjects','createApiKey','put','/:id','update','/:id/password','delete','removeQueues','removeTeams','removeChatInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeSquareProjects','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x70a1,0xae));var _0x170a=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x70a1[_0x3f3f40];return _0x403b7a;};'use strict';var multer=require(_0x170a('0x0'));var util=require(_0x170a('0x1'));var path=require(_0x170a('0x2'));var timeout=require(_0x170a('0x3'));var express=require(_0x170a('0x4'));var router=express[_0x170a('0x5')]();var auth=require(_0x170a('0x6'));var interaction=require(_0x170a('0x7'));var config=require(_0x170a('0x8'));var controller=require(_0x170a('0x9'));router[_0x170a('0xa')]('/',auth[_0x170a('0xb')](),controller[_0x170a('0xc')]);router[_0x170a('0xa')](_0x170a('0xd'),auth[_0x170a('0xb')](),controller[_0x170a('0xe')]);router[_0x170a('0xa')]('/:id',auth[_0x170a('0xb')](),controller[_0x170a('0xf')]);router[_0x170a('0xa')]('/:id/avatar',controller['getAvatar']);router[_0x170a('0xa')](_0x170a('0x10'),auth[_0x170a('0xb')](),controller[_0x170a('0x11')]);router[_0x170a('0xa')](_0x170a('0x12'),auth[_0x170a('0xb')](),controller[_0x170a('0x13')]);router[_0x170a('0xa')](_0x170a('0x14'),auth[_0x170a('0xb')](),controller[_0x170a('0x15')]);router[_0x170a('0xa')](_0x170a('0x16'),auth[_0x170a('0xb')](),controller[_0x170a('0x17')]);router[_0x170a('0xa')](_0x170a('0x18'),auth[_0x170a('0xb')](),controller[_0x170a('0x19')]);router[_0x170a('0xa')](_0x170a('0x1a'),auth[_0x170a('0xb')](),controller['getChatInteractions']);router[_0x170a('0xa')]('/:id/openchannel/interactions',auth[_0x170a('0xb')](),controller[_0x170a('0x1b')]);router['get'](_0x170a('0x1c'),auth[_0x170a('0xb')](),controller[_0x170a('0x1d')]);router[_0x170a('0xa')](_0x170a('0x1e'),auth[_0x170a('0xb')](),controller[_0x170a('0x1f')]);router[_0x170a('0xa')](_0x170a('0x20'),auth[_0x170a('0xb')](),controller[_0x170a('0x21')]);router[_0x170a('0xa')](_0x170a('0x22'),auth[_0x170a('0xb')](),controller[_0x170a('0x23')]);router[_0x170a('0xa')](_0x170a('0x24'),auth[_0x170a('0xb')](),controller['getLists']);router['get'](_0x170a('0x25'),auth[_0x170a('0xb')](),controller['getAgents']);router[_0x170a('0xa')](_0x170a('0x26'),auth['isAuthenticated'](),controller[_0x170a('0x27')]);router['get']('/:id/fax_accounts',auth[_0x170a('0xb')](),controller[_0x170a('0x28')]);router[_0x170a('0xa')](_0x170a('0x29'),auth['isAuthenticated'](),controller[_0x170a('0x2a')]);router['get'](_0x170a('0x2b'),auth[_0x170a('0xb')](),controller[_0x170a('0x2c')]);router[_0x170a('0xa')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0x170a('0xa')]('/:id/chat_websites',auth[_0x170a('0xb')](),controller['getChatWebsites']);router[_0x170a('0xa')](_0x170a('0x2d'),auth[_0x170a('0xb')](),controller[_0x170a('0x2e')]);router['get'](_0x170a('0x2f'),auth[_0x170a('0xb')](),controller[_0x170a('0x30')]);router[_0x170a('0xa')](_0x170a('0x31'),auth['isAuthenticated'](),controller[_0x170a('0x32')]);router[_0x170a('0x33')](_0x170a('0x34'),auth['isAuthenticated'](),controller[_0x170a('0x35')]);router[_0x170a('0x33')](_0x170a('0x10'),auth[_0x170a('0xb')](),controller[_0x170a('0x36')]);router[_0x170a('0x33')]('/',auth[_0x170a('0xb')](),controller[_0x170a('0x37')]);router[_0x170a('0x33')]('/:id/queues',auth[_0x170a('0xb')](),controller[_0x170a('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4cddab,_0x4c49d6,_0x9f4bac){_0x9f4bac(null,path['join'](config['root'],_0x170a('0x39')));},'filename':function(_0x269f34,_0x56e8fb,_0x2656f4){_0x2656f4(null,util[_0x170a('0x3a')]('%s-%s',Date[_0x170a('0x3b')](),_0x56e8fb[_0x170a('0x3c')]));}})});router[_0x170a('0x33')](_0x170a('0x3d'),upload[_0x170a('0x3e')](_0x170a('0x3f')),controller[_0x170a('0x40')]);router[_0x170a('0x33')](_0x170a('0x41'),auth[_0x170a('0xb')](),controller[_0x170a('0x42')]);router[_0x170a('0x33')](_0x170a('0x43'),auth[_0x170a('0xb')](),controller[_0x170a('0x44')]);router[_0x170a('0x33')](_0x170a('0x45'),auth['isAuthenticated'](),controller[_0x170a('0x46')]);router[_0x170a('0x33')]('/:id/unpause',auth[_0x170a('0xb')](),controller[_0x170a('0x47')]);router['post'](_0x170a('0x22'),auth[_0x170a('0xb')](),controller['addTeams']);router['post']('/:id/chat_interactions',auth[_0x170a('0xb')](),controller[_0x170a('0x48')]);router[_0x170a('0x33')](_0x170a('0x49'),auth[_0x170a('0xb')](),controller['addMailInteractions']);router[_0x170a('0x33')](_0x170a('0x4a'),auth[_0x170a('0xb')](),controller[_0x170a('0x4b')]);router[_0x170a('0x33')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x170a('0x4c')]);router[_0x170a('0x33')](_0x170a('0x4d'),auth[_0x170a('0xb')](),controller[_0x170a('0x4e')]);router[_0x170a('0x33')](_0x170a('0x4f'),auth[_0x170a('0xb')](),controller[_0x170a('0x50')]);router['post']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x170a('0x51')]);router['post'](_0x170a('0x2b'),auth[_0x170a('0xb')](),controller[_0x170a('0x52')]);router[_0x170a('0x33')](_0x170a('0x53'),auth[_0x170a('0xb')](),controller['addSmsAccounts']);router[_0x170a('0x33')](_0x170a('0x54'),auth[_0x170a('0xb')](),controller['addChatWebsites']);router[_0x170a('0x33')](_0x170a('0x2d'),auth[_0x170a('0xb')](),controller[_0x170a('0x55')]);router[_0x170a('0x33')]('/:id/api_key',auth[_0x170a('0xb')](),controller[_0x170a('0x56')]);router[_0x170a('0x57')](_0x170a('0x58'),auth['isAuthenticated'](),controller[_0x170a('0x59')]);router['put'](_0x170a('0x5a'),auth[_0x170a('0xb')](),controller['changePassword']);router[_0x170a('0x5b')](_0x170a('0x12'),auth[_0x170a('0xb')](),controller[_0x170a('0x5c')]);router['delete'](_0x170a('0x22'),auth[_0x170a('0xb')](),controller[_0x170a('0x5d')]);router[_0x170a('0x5b')](_0x170a('0x58'),auth[_0x170a('0xb')](),controller['destroy']);router[_0x170a('0x5b')]('/:id/chat_interactions',auth[_0x170a('0xb')](),controller[_0x170a('0x5e')]);router['delete'](_0x170a('0x49'),auth['isAuthenticated'](),controller['removeMailInteractions']);router['delete']('/:id/fax_interactions',auth['isAuthenticated'](),controller['removeFaxInteractions']);router['delete']('/:id/sms_interactions',auth[_0x170a('0xb')](),controller[_0x170a('0x5f')]);router[_0x170a('0x5b')]('/:id/openchannel_interactions',auth[_0x170a('0xb')](),controller[_0x170a('0x60')]);router[_0x170a('0x5b')](_0x170a('0x4f'),auth[_0x170a('0xb')](),controller[_0x170a('0x61')]);router[_0x170a('0x5b')]('/:id/mail_accounts',auth[_0x170a('0xb')](),controller[_0x170a('0x62')]);router[_0x170a('0x5b')](_0x170a('0x2b'),auth[_0x170a('0xb')](),controller[_0x170a('0x63')]);router[_0x170a('0x5b')](_0x170a('0x53'),auth['isAuthenticated'](),controller[_0x170a('0x64')]);router[_0x170a('0x5b')]('/:id/chat_websites',auth[_0x170a('0xb')](),controller['removeChatWebsites']);router['delete']('/:id/square_projects',auth[_0x170a('0xb')](),controller[_0x170a('0x65')]);router['delete'](_0x170a('0x31'),auth[_0x170a('0xb')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0x6516=['addChatWebsites','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','getVoiceQueuesRt','/:id/groups','/:id/recordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getScheduledCalls','/:id/api_key','getApiKey','bulkCreate','post','addContacts','create','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts'];(function(_0x145e84,_0x124991){var _0x52d753=function(_0x2492d4){while(--_0x2492d4){_0x145e84['push'](_0x145e84['shift']());}};_0x52d753(++_0x124991);}(_0x6516,0x156));var _0x6651=function(_0x103110,_0x9a30ea){_0x103110=_0x103110-0x0;var _0x59d228=_0x6516[_0x103110];return _0x59d228;};'use strict';var multer=require(_0x6651('0x0'));var util=require(_0x6651('0x1'));var path=require(_0x6651('0x2'));var timeout=require(_0x6651('0x3'));var express=require('express');var router=express[_0x6651('0x4')]();var auth=require(_0x6651('0x5'));var interaction=require(_0x6651('0x6'));var config=require(_0x6651('0x7'));var controller=require(_0x6651('0x8'));router[_0x6651('0x9')]('/',auth[_0x6651('0xa')](),controller[_0x6651('0xb')]);router[_0x6651('0x9')](_0x6651('0xc'),auth[_0x6651('0xa')](),controller[_0x6651('0xd')]);router[_0x6651('0x9')](_0x6651('0xe'),auth[_0x6651('0xa')](),controller[_0x6651('0xf')]);router['get'](_0x6651('0x10'),controller[_0x6651('0x11')]);router[_0x6651('0x9')](_0x6651('0x12'),auth[_0x6651('0xa')](),controller[_0x6651('0x13')]);router[_0x6651('0x9')]('/:id/queues',auth[_0x6651('0xa')](),controller['getQueues']);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x6651('0x14')]);router[_0x6651('0x9')](_0x6651('0x15'),auth[_0x6651('0xa')](),controller['getGroups']);router[_0x6651('0x9')](_0x6651('0x16'),auth[_0x6651('0xa')](),controller['getRecordings']);router['get']('/:id/chat/interactions',auth[_0x6651('0xa')](),controller[_0x6651('0x17')]);router[_0x6651('0x9')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x6651('0x18')]);router[_0x6651('0x9')](_0x6651('0x19'),auth['isAuthenticated'](),controller[_0x6651('0x1a')]);router['get']('/:id/sms/interactions',auth[_0x6651('0xa')](),controller[_0x6651('0x1b')]);router[_0x6651('0x9')](_0x6651('0x1c'),auth[_0x6651('0xa')](),controller[_0x6651('0x1d')]);router['get'](_0x6651('0x1e'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6651('0x9')](_0x6651('0x1f'),auth[_0x6651('0xa')](),controller[_0x6651('0x20')]);router[_0x6651('0x9')](_0x6651('0x21'),auth[_0x6651('0xa')](),controller[_0x6651('0x22')]);router[_0x6651('0x9')](_0x6651('0x23'),auth['isAuthenticated'](),controller[_0x6651('0x24')]);router[_0x6651('0x9')](_0x6651('0x25'),auth[_0x6651('0xa')](),controller[_0x6651('0x26')]);router[_0x6651('0x9')](_0x6651('0x27'),auth[_0x6651('0xa')](),controller[_0x6651('0x28')]);router['get'](_0x6651('0x29'),auth[_0x6651('0xa')](),controller[_0x6651('0x2a')]);router[_0x6651('0x9')](_0x6651('0x2b'),auth[_0x6651('0xa')](),controller[_0x6651('0x2c')]);router[_0x6651('0x9')](_0x6651('0x2d'),auth['isAuthenticated'](),controller[_0x6651('0x2e')]);router[_0x6651('0x9')](_0x6651('0x2f'),auth[_0x6651('0xa')](),controller['getSquareProjects']);router[_0x6651('0x9')]('/:id/scheduled_calls',auth[_0x6651('0xa')](),controller[_0x6651('0x30')]);router[_0x6651('0x9')](_0x6651('0x31'),auth[_0x6651('0xa')](),controller[_0x6651('0x32')]);router['post']('/create_many',auth[_0x6651('0xa')](),controller[_0x6651('0x33')]);router[_0x6651('0x34')]('/:id/contacts',auth[_0x6651('0xa')](),controller[_0x6651('0x35')]);router['post']('/',auth[_0x6651('0xa')](),controller[_0x6651('0x36')]);router[_0x6651('0x34')](_0x6651('0x37'),auth[_0x6651('0xa')](),controller[_0x6651('0x38')]);var upload=multer({'storage':multer[_0x6651('0x39')]({'destination':function(_0x71745b,_0x423268,_0xfe13d4){_0xfe13d4(null,path[_0x6651('0x3a')](config[_0x6651('0x3b')],_0x6651('0x3c')));},'filename':function(_0x2f8925,_0x5aa4f6,_0x3fee34){_0x3fee34(null,util[_0x6651('0x3d')](_0x6651('0x3e'),Date[_0x6651('0x3f')](),_0x5aa4f6[_0x6651('0x40')]));}})});router[_0x6651('0x34')]('/:id/avatar',upload[_0x6651('0x41')](_0x6651('0x42')),controller[_0x6651('0x43')]);router[_0x6651('0x34')](_0x6651('0x44'),auth['isAuthenticated'](),controller[_0x6651('0x45')]);router['post'](_0x6651('0x46'),auth['isAuthenticated'](),controller['logout']);router['post']('/:id/pause',auth[_0x6651('0xa')](),controller['pause']);router[_0x6651('0x34')](_0x6651('0x47'),auth[_0x6651('0xa')](),controller[_0x6651('0x48')]);router[_0x6651('0x34')](_0x6651('0x1e'),auth[_0x6651('0xa')](),controller['addTeams']);router['post'](_0x6651('0x49'),auth[_0x6651('0xa')](),controller[_0x6651('0x4a')]);router[_0x6651('0x34')](_0x6651('0x4b'),auth[_0x6651('0xa')](),controller[_0x6651('0x4c')]);router[_0x6651('0x34')](_0x6651('0x4d'),auth[_0x6651('0xa')](),controller[_0x6651('0x4e')]);router['post']('/:id/sms_interactions',auth[_0x6651('0xa')](),controller[_0x6651('0x4f')]);router[_0x6651('0x34')](_0x6651('0x50'),auth[_0x6651('0xa')](),controller[_0x6651('0x51')]);router[_0x6651('0x34')]('/:id/fax_accounts',auth[_0x6651('0xa')](),controller[_0x6651('0x52')]);router[_0x6651('0x34')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x6651('0x53')]);router[_0x6651('0x34')](_0x6651('0x29'),auth[_0x6651('0xa')](),controller[_0x6651('0x54')]);router['post'](_0x6651('0x2b'),auth[_0x6651('0xa')](),controller[_0x6651('0x55')]);router['post']('/:id/chat_websites',auth[_0x6651('0xa')](),controller[_0x6651('0x56')]);router[_0x6651('0x34')](_0x6651('0x2f'),auth[_0x6651('0xa')](),controller[_0x6651('0x57')]);router[_0x6651('0x34')]('/:id/api_key',auth[_0x6651('0xa')](),controller[_0x6651('0x58')]);router[_0x6651('0x59')](_0x6651('0xe'),auth[_0x6651('0xa')](),controller[_0x6651('0x5a')]);router[_0x6651('0x59')](_0x6651('0x5b'),auth['isAuthenticated'](),controller[_0x6651('0x5c')]);router[_0x6651('0x5d')](_0x6651('0x37'),auth[_0x6651('0xa')](),controller[_0x6651('0x5e')]);router[_0x6651('0x5d')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6651('0x5f')]);router[_0x6651('0x5d')](_0x6651('0xe'),auth[_0x6651('0xa')](),controller['destroy']);router['delete'](_0x6651('0x49'),auth[_0x6651('0xa')](),controller[_0x6651('0x60')]);router[_0x6651('0x5d')](_0x6651('0x4b'),auth[_0x6651('0xa')](),controller[_0x6651('0x61')]);router[_0x6651('0x5d')](_0x6651('0x4d'),auth[_0x6651('0xa')](),controller[_0x6651('0x62')]);router['delete']('/:id/sms_interactions',auth[_0x6651('0xa')](),controller['removeSmsInteractions']);router[_0x6651('0x5d')](_0x6651('0x50'),auth[_0x6651('0xa')](),controller[_0x6651('0x63')]);router[_0x6651('0x5d')](_0x6651('0x25'),auth[_0x6651('0xa')](),controller[_0x6651('0x64')]);router[_0x6651('0x5d')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x6651('0x65')]);router[_0x6651('0x5d')](_0x6651('0x29'),auth[_0x6651('0xa')](),controller[_0x6651('0x66')]);router[_0x6651('0x5d')](_0x6651('0x2b'),auth[_0x6651('0xa')](),controller['removeSmsAccounts']);router['delete'](_0x6651('0x2d'),auth[_0x6651('0xa')](),controller[_0x6651('0x67')]);router['delete']('/:id/square_projects',auth['isAuthenticated'](),controller[_0x6651('0x68')]);router[_0x6651('0x5d')](_0x6651('0x31'),auth['isAuthenticated'](),controller[_0x6651('0x69')]);module[_0x6651('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d5cafaf..f15fa30 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 _0xdab2=['rfc2833','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','refuse','originate','uac','uas','fingerprint','active','passive','actpass','update','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','telephone','local','INTEGER','accountcode','callerid','fullname','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xdab2,0x17d));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2dab('0x0'));var moment=require(_0x2dab('0x1'));var util=require(_0x2dab('0x2'));var _=require(_0x2dab('0x3'));module[_0x2dab('0x4')]={'name':{'type':Sequelize[_0x2dab('0x5')],'allowNull':![],'unique':_0x2dab('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1ebe3d){this[_0x2dab('0x7')]('name',_0x1ebe3d);this[_0x2dab('0x7')](_0x2dab('0x8'),_0x1ebe3d);},'comment':_0x2dab('0x9')},'fullname':{'type':Sequelize[_0x2dab('0x5')],'allowNull':![],'set':function(_0x2d6f9f){this['setDataValue']('fullname',_0x2d6f9f);this['setDataValue']('callerid',util[_0x2dab('0xa')](_0x2dab('0xb'),_0x2d6f9f,this[_0x2dab('0xc')](_0x2dab('0xd'))));}},'alias':{'type':Sequelize[_0x2dab('0x5')]},'email':{'type':Sequelize[_0x2dab('0x5')],'allowNull':![],'unique':_0x2dab('0xe'),'validate':{'isEmail':!![]},'set':function(_0x3b8277){if(_0x3b8277){this[_0x2dab('0x7')]('email',_0x3b8277['toLowerCase']());}}},'role':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x10'),_0x2dab('0x11'),'agent',_0x2dab('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x2dab('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2dab('0x5')],'defaultValue':_0x2dab('0x13')},'internal':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x12dfd5){this[_0x2dab('0x7')]('internal',_0x12dfd5);this[_0x2dab('0x7')](_0x2dab('0x15'),_0x12dfd5);this[_0x2dab('0x7')](_0x2dab('0x16'),util[_0x2dab('0xa')]('\x22%s\x22\x20<%s>',this[_0x2dab('0xc')](_0x2dab('0x17')),_0x12dfd5));}},'salt':{'type':Sequelize[_0x2dab('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x2dab('0x5')]},'userpic':{'type':Sequelize[_0x2dab('0x5')]},'city':{'type':Sequelize[_0x2dab('0x5')]},'country':{'type':Sequelize[_0x2dab('0x5')]},'online':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2dab('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x2dab('0x19')]},'chatCapacity':{'type':Sequelize[_0x2dab('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2dab('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2dab('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2dab('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2dab('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2dab('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2dab('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![],'defaultValue':_0x2dab('0x1a')},'ipaddr':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x1b'),_0x2dab('0x11'),_0x2dab('0x1c')),'allowNull':!![],'defaultValue':_0x2dab('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x1d'),_0x2dab('0x1e'),'ALLOWED_FAILED_SCREEN',_0x2dab('0x1f'),_0x2dab('0x20'),_0x2dab('0x21'),'PROHIB_FAILED_SCREEN',_0x2dab('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![],'defaultValue':_0x2dab('0x23'),'set':function(_0x29b1dc){this[_0x2dab('0x7')]('transport',_0x29b1dc?_0x29b1dc['join'](','):null);},'get':function(){return this[_0x2dab('0xc')](_0x2dab('0x24'))?this[_0x2dab('0xc')](_0x2dab('0x24'))[_0x2dab('0x25')](','):null;},'comment':_0x2dab('0x26')},'dtmfmode':{'type':Sequelize['ENUM'](_0x2dab('0x27'),'info','shortinfo',_0x2dab('0x28'),_0x2dab('0x29')),'allowNull':!![],'defaultValue':_0x2dab('0x27')},'directmedia':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no',_0x2dab('0x2b'),'update',_0x2dab('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2dab('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![],'defaultValue':_0x2dab('0x2d'),'set':function(_0x4ab09d){this[_0x2dab('0x7')](_0x2dab('0x2e'),_0x4ab09d?_0x4ab09d[_0x2dab('0x2f')](','):null);},'get':function(){return this[_0x2dab('0xc')]('nat')?this[_0x2dab('0xc')](_0x2dab('0x2e'))['split'](','):null;},'comment':_0x2dab('0x30')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x2dab('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x2dab('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x2dab('0x5')],'allowNull':![],'defaultValue':_0x2dab('0x31')},'allow':{'type':Sequelize[_0x2dab('0x5')],'allowNull':![],'defaultValue':_0x2dab('0x32'),'set':function(_0x4f83ce){this[_0x2dab('0x7')](_0x2dab('0x33'),_0x4f83ce?_0x4f83ce['join'](';'):_0x2dab('0x32'));},'get':function(){return this['getDataValue'](_0x2dab('0x33'))?this[_0x2dab('0xc')](_0x2dab('0x33'))[_0x2dab('0x25')](';'):null;},'comment':_0x2dab('0x34')},'autoframing':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x126571){this[_0x2dab('0x7')](_0x2dab('0x35'),_0x126571?_0x126571[_0x2dab('0x2f')](','):null);},'get':function(){return this[_0x2dab('0xc')](_0x2dab('0x35'))?this[_0x2dab('0xc')](_0x2dab('0x35'))[_0x2dab('0x25')](','):null;},'comment':_0x2dab('0x36')},'trustrpid':{'type':Sequelize['ENUM'](_0x2dab('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2dab('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2dab('0x2a'),'no',_0x2dab('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x2dab('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2dab('0x38')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x2dab('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x2dab('0x2a')},'busylevel':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x2dab('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2dab('0xf')]('accept',_0x2dab('0x39'),_0x2dab('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x3b'),_0x2dab('0x3c')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2dab('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0x2dab('0x2a')},'keepalive':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2dab('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2dab('0xf')]('yes','no',_0x2dab('0x3d'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x2dab('0x3e'),_0x2dab('0x3f'),_0x2dab('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2dab('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x2dab('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x2dab('0x2b'),_0x2dab('0x41'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2dab('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize[_0x2dab('0x14')],'defaultValue':0x0,'set':function(_0x42ec27){this['setDataValue'](_0x2dab('0x42'),_0x42ec27);var _0xbe63b0=this[_0x2dab('0x43')]({'plain':!![]});switch(_0x42ec27){case 0x0:case 0x1:var _0x41da2b=_0xbe63b0['transport']?_[_0x2dab('0x44')](_0xbe63b0[_0x2dab('0x24')])?_0xbe63b0['transport'][_0x2dab('0x2f')]():_0xbe63b0['transport']:_0x2dab('0x23');if(_0x41da2b===_0x2dab('0x45')){_0x41da2b=_0x2dab('0x23');}this[_0x2dab('0x7')](_0x2dab('0x24'),_0x41da2b);this[_0x2dab('0x7')](_0x2dab('0x46'),'no');this[_0x2dab('0x7')](_0x2dab('0x47'),null);this['setDataValue'](_0x2dab('0x48'),null);this['setDataValue'](_0x2dab('0x49'),null);this[_0x2dab('0x7')](_0x2dab('0x4a'),null);this[_0x2dab('0x7')](_0x2dab('0x4b'),null);this['setDataValue']('dtlssetup',null);this[_0x2dab('0x7')]('dtlscertfile',null);this[_0x2dab('0x7')](_0x2dab('0x4c'),null);this[_0x2dab('0x7')](_0x2dab('0x4d'),'no');break;case 0x2:this[_0x2dab('0x7')](_0x2dab('0x24'),_0x2dab('0x45'));this['setDataValue']('encryption',_0x2dab('0x2a'));this[_0x2dab('0x7')](_0x2dab('0x47'),_0x2dab('0x2a'));this[_0x2dab('0x7')](_0x2dab('0x48'),'yes');this[_0x2dab('0x7')](_0x2dab('0x49'),_0x2dab('0x2a'));this[_0x2dab('0x7')]('dtlsenable',_0x2dab('0x2a'));this[_0x2dab('0x7')](_0x2dab('0x4b'),'no');this[_0x2dab('0x7')](_0x2dab('0x4e'),_0x2dab('0x40'));this[_0x2dab('0x7')](_0x2dab('0x4f'),_0xbe63b0['dtlscertfile']||_0x2dab('0x50'));this[_0x2dab('0x7')](_0x2dab('0x4c'),_0xbe63b0['dtlsprivatekey']||_0x2dab('0x51'));this[_0x2dab('0x7')](_0x2dab('0x4d'),_0x2dab('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x4e90c2){this[_0x2dab('0x7')](_0x2dab('0x52'),_0x4e90c2?_0x4e90c2[_0x2dab('0x2f')](','):[]);},'get':function(){return this[_0x2dab('0xc')]('permissions')?_[_0x2dab('0x53')](this[_0x2dab('0xc')](_0x2dab('0x52'))[_0x2dab('0x25')](','),function(_0x2886f1){return parseInt(_0x2886f1,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2dab('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2dab('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2dab('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2dab('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2dab('0xf')](_0x2dab('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2dab('0x5')]},'passwordResetAt':{'type':Sequelize[_0x2dab('0x19')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2dab('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2dab('0x5')],'allowNull':!![]}}; \ No newline at end of file +var _0x4d14=['PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','outgoing','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','internal','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','format','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED'];(function(_0x3db724,_0x2f0426){var _0x17b55a=function(_0x2d45c0){while(--_0x2d45c0){_0x3db724['push'](_0x3db724['shift']());}};_0x17b55a(++_0x2f0426);}(_0x4d14,0x1d7));var _0x44d1=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x4d14[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0x44d1('0x0'));var moment=require(_0x44d1('0x1'));var util=require(_0x44d1('0x2'));var _=require(_0x44d1('0x3'));module[_0x44d1('0x4')]={'name':{'type':Sequelize[_0x44d1('0x5')],'allowNull':![],'unique':_0x44d1('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e0651){this[_0x44d1('0x7')]('name',_0x3e0651);this[_0x44d1('0x7')]('defaultuser',_0x3e0651);},'comment':_0x44d1('0x8')},'fullname':{'type':Sequelize[_0x44d1('0x5')],'allowNull':![],'set':function(_0x708d4e){this[_0x44d1('0x7')](_0x44d1('0x9'),_0x708d4e);this[_0x44d1('0x7')](_0x44d1('0xa'),util['format']('\x22%s\x22\x20<%s>',_0x708d4e,this['getDataValue'](_0x44d1('0xb'))));}},'alias':{'type':Sequelize[_0x44d1('0x5')]},'email':{'type':Sequelize[_0x44d1('0x5')],'allowNull':![],'unique':_0x44d1('0xc'),'validate':{'isEmail':!![]},'set':function(_0x43c4e2){if(_0x43c4e2){this[_0x44d1('0x7')](_0x44d1('0xc'),_0x43c4e2[_0x44d1('0xd')]());}}},'role':{'type':Sequelize[_0x44d1('0xe')]('admin',_0x44d1('0xf'),_0x44d1('0x10'),_0x44d1('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x44d1('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x44d1('0x12')},'internal':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':![],'unique':_0x44d1('0xb'),'set':function(_0x1727d5){this['setDataValue'](_0x44d1('0xb'),_0x1727d5);this['setDataValue']('accountcode',_0x1727d5);this[_0x44d1('0x7')]('callerid',util[_0x44d1('0x14')](_0x44d1('0x15'),this['getDataValue'](_0x44d1('0x9')),_0x1727d5));}},'salt':{'type':Sequelize[_0x44d1('0x5')]},'phone':{'type':Sequelize[_0x44d1('0x5')]},'mobile':{'type':Sequelize[_0x44d1('0x5')]},'address':{'type':Sequelize[_0x44d1('0x5')]},'zipcode':{'type':Sequelize[_0x44d1('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x44d1('0x17')]},'voicePause':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x44d1('0x5')],'defaultValue':_0x44d1('0x18')},'lastPauseAt':{'type':Sequelize[_0x44d1('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x44d1('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x44d1('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x44d1('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x44d1('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x44d1('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![],'defaultValue':_0x44d1('0x19')},'ipaddr':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x44d1('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x44d1('0xe')]('friend','user',_0x44d1('0x1a')),'allowNull':!![],'defaultValue':_0x44d1('0x1b')},'context':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![],'defaultValue':_0x44d1('0x1c')},'callingpres':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x1d'),_0x44d1('0x1e'),_0x44d1('0x1f'),_0x44d1('0x20'),_0x44d1('0x21'),'PROHIB_PASSED_SCREEN',_0x44d1('0x22'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![],'defaultValue':_0x44d1('0x23'),'set':function(_0x442b12){this[_0x44d1('0x7')]('transport',_0x442b12?_0x442b12['join'](','):null);},'get':function(){return this[_0x44d1('0x24')](_0x44d1('0x25'))?this['getDataValue'](_0x44d1('0x25'))[_0x44d1('0x26')](','):null;},'comment':_0x44d1('0x27')},'dtmfmode':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x28'),_0x44d1('0x29'),_0x44d1('0x2a'),'inband',_0x44d1('0x2b')),'allowNull':!![],'defaultValue':_0x44d1('0x28')},'directmedia':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no',_0x44d1('0x2d'),_0x44d1('0x2e'),_0x44d1('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x44b211){this['setDataValue'](_0x44d1('0x30'),_0x44b211?_0x44b211[_0x44d1('0x31')](','):null);},'get':function(){return this['getDataValue'](_0x44d1('0x30'))?this['getDataValue']('nat')[_0x44d1('0x26')](','):null;},'comment':_0x44d1('0x32')},'callgroup':{'type':Sequelize[_0x44d1('0x5')]},'namedcallgroup':{'type':Sequelize[_0x44d1('0x5')]},'pickupgroup':{'type':Sequelize[_0x44d1('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x44d1('0x5')]},'language':{'type':Sequelize[_0x44d1('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x44d1('0x5')]},'disallow':{'type':Sequelize[_0x44d1('0x5')],'allowNull':![],'defaultValue':_0x44d1('0x33')},'allow':{'type':Sequelize[_0x44d1('0x5')],'allowNull':![],'defaultValue':_0x44d1('0x34'),'set':function(_0x5d9da4){this[_0x44d1('0x7')](_0x44d1('0x35'),_0x5d9da4?_0x5d9da4[_0x44d1('0x31')](';'):_0x44d1('0x34'));},'get':function(){return this[_0x44d1('0x24')]('allow')?this[_0x44d1('0x24')](_0x44d1('0x35'))[_0x44d1('0x26')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x44d1('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![],'set':function(_0x18d274){this[_0x44d1('0x7')](_0x44d1('0x36'),_0x18d274?_0x18d274[_0x44d1('0x31')](','):null);},'get':function(){return this[_0x44d1('0x24')](_0x44d1('0x36'))?this['getDataValue'](_0x44d1('0x36'))[_0x44d1('0x26')](','):null;},'comment':_0x44d1('0x37')},'trustrpid':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x44d1('0xe')]('yes','no',_0x44d1('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x44d1('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![],'defaultValue':_0x44d1('0x39')},'amaflags':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x44d1('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0x44d1('0x2c')},'busylevel':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x44d1('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x44d1('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x3b'),_0x44d1('0x3c'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x3d'),_0x44d1('0x3e')),'allowNull':!![],'defaultValue':_0x44d1('0x3e')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x44d1('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x44d1('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x44d1('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x44d1('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x44d1('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x44d1('0x2c'),'no',_0x44d1('0x3f'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x44d1('0xe')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x44d1('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x44d1('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x44d1('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x44d1('0x17')]},'showWebBar':{'type':Sequelize[_0x44d1('0x13')],'defaultValue':0x0,'set':function(_0x5bac74){this[_0x44d1('0x7')](_0x44d1('0x40'),_0x5bac74);var _0x157c25=this[_0x44d1('0x41')]({'plain':!![]});switch(_0x5bac74){case 0x0:case 0x1:var _0x323170=_0x157c25[_0x44d1('0x25')]?_[_0x44d1('0x42')](_0x157c25['transport'])?_0x157c25[_0x44d1('0x25')][_0x44d1('0x31')]():_0x157c25[_0x44d1('0x25')]:'udp';if(_0x323170===_0x44d1('0x43')){_0x323170='udp';}this[_0x44d1('0x7')](_0x44d1('0x25'),_0x323170);this[_0x44d1('0x7')](_0x44d1('0x44'),'no');this[_0x44d1('0x7')](_0x44d1('0x45'),null);this['setDataValue'](_0x44d1('0x46'),null);this[_0x44d1('0x7')](_0x44d1('0x47'),null);this[_0x44d1('0x7')](_0x44d1('0x48'),null);this[_0x44d1('0x7')](_0x44d1('0x49'),null);this['setDataValue'](_0x44d1('0x4a'),null);this[_0x44d1('0x7')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this['setDataValue'](_0x44d1('0x4b'),'no');break;case 0x2:this[_0x44d1('0x7')]('transport',_0x44d1('0x43'));this[_0x44d1('0x7')](_0x44d1('0x44'),_0x44d1('0x2c'));this['setDataValue'](_0x44d1('0x45'),'yes');this[_0x44d1('0x7')](_0x44d1('0x46'),_0x44d1('0x2c'));this[_0x44d1('0x7')]('icesupport','yes');this[_0x44d1('0x7')](_0x44d1('0x48'),_0x44d1('0x2c'));this[_0x44d1('0x7')](_0x44d1('0x49'),'no');this[_0x44d1('0x7')](_0x44d1('0x4a'),_0x44d1('0x4c'));this[_0x44d1('0x7')](_0x44d1('0x4d'),_0x157c25[_0x44d1('0x4d')]||_0x44d1('0x4e'));this[_0x44d1('0x7')](_0x44d1('0x4f'),_0x157c25[_0x44d1('0x4f')]||_0x44d1('0x50'));this[_0x44d1('0x7')]('rtcp_mux',_0x44d1('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x44d1('0x51')],'set':function(_0x220986){this[_0x44d1('0x7')](_0x44d1('0x52'),_0x220986?_0x220986[_0x44d1('0x31')](','):[]);},'get':function(){return this['getDataValue'](_0x44d1('0x52'))?_[_0x44d1('0x53')](this['getDataValue'](_0x44d1('0x52'))['split'](','),function(_0x527adf){return parseInt(_0x527adf,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x44d1('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x44d1('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x44d1('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x44d1('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x44d1('0xe')](_0x44d1('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize[_0x44d1('0x17')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x44d1('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x44d1('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x44d1('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 2194ed5..ab23ddb 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 _0x0a56=['getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privelages\x20to\x20access\x20this\x20resource.','createApiKey','apiKeyNonce','apiKeyIat','removeApiKey','API\x20key\x20not\x20available','html-pdf','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','destroy','get','Users','user','Agents','Telephones','telephone','filter','value','includes','find','role','name','User','rawAttributes','model','keys','password','salt','query','filters','intersection','attributes','fields','nolimit','order','sort','where','map','sequelize','lower','col','field','options','includeAll','include','findAll','rows','show','params','differenceBy','length','merge','bulkCreate','update','body','describe','addContacts','ids','omit','agent','agent\x20role','count','admin','../../config/license/util','getLicense','users','isNil','format','count\x20%s:\x20%s','create','internal','Setting','findById','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)','from','voicemail','mailbox','VoiceMail','permissions','103','110','104','105','107','108','100','111','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','loginInPause','voicePause','isValidChannel','channel','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','QueueId','emit','Queue:save','VoiceQueue','voice','push','interface','SIP/%s','each','UserVoiceQueueRt','removeQueues','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','existsSync','root','server/files/images/','download','getContacts','CmContact','pick','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','findOne','Unknown\x20role','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','UserVoiceQueue.penalty','upsert','MemberReport','forEach','all','getChannels','device','PAUSE','LOGININPAUSE','concat','YYYY-MM-DD\x20HH:mm:ss','pause','QueuePause','DEFAULT\x20PAUSE','type','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','manual','chat','fax','openchannel','set','Pause','getTeams','Team','addTeams','removeTeams','getLists','getVoiceQueues','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','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','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','firstName','lastName','Contact','dialActive'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x0a56,0x154));var _0x60a5=function(_0x156bde,_0x46622e){_0x156bde=_0x156bde-0x0;var _0x7f0d78=_0x0a56[_0x156bde];return _0x7f0d78;};'use strict';var pdf=require(_0x60a5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x60a5('0x1'));var zipdir=require(_0x60a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x60a5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x60a5('0x4'));var path=require(_0x60a5('0x5'));var sox=require(_0x60a5('0x6'));var csv=require(_0x60a5('0x7'));var ejs=require(_0x60a5('0x8'));var fs=require('fs');var _=require(_0x60a5('0x9'));var squel=require(_0x60a5('0xa'));var crypto=require(_0x60a5('0xb'));var jsforce=require(_0x60a5('0xc'));var deskjs=require(_0x60a5('0xd'));var toCsv=require(_0x60a5('0x7'));var querystring=require('querystring');var Papa=require(_0x60a5('0xe'));var authService=require(_0x60a5('0xf'));var hardwareService=require(_0x60a5('0x10'));var Redis=require('ioredis');var qs=require(_0x60a5('0x11'));var logger=require(_0x60a5('0x12'))(_0x60a5('0x13'));var utils=require(_0x60a5('0x14'));var config=require(_0x60a5('0x15'));var db=require(_0x60a5('0x16'))['db'];config[_0x60a5('0x17')]=_[_0x60a5('0x18')](config[_0x60a5('0x17')],{'host':_0x60a5('0x19'),'port':0x18eb});var socket=require(_0x60a5('0x1a'))(new Redis(config['redis']));require('./user.socket')[_0x60a5('0x1b')](socket);var jayson=require(_0x60a5('0x1c'));var client=jayson[_0x60a5('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ec7e5,_0x3795c7,_0x27fa29,_0x3ac620){return new BPromise(function(_0x2d8c9e,_0x2bbfac){var _0x308741=_0x3ac620||client;return _0x308741[_0x60a5('0x1e')](_0x4ec7e5,_0x27fa29)[_0x60a5('0x1f')](function(_0x298fe6){logger[_0x60a5('0x20')](_0x60a5('0x21'),_0x3795c7,_0x60a5('0x22'));logger[_0x60a5('0x23')](_0x60a5('0x24'),_0x3795c7,'request\x20sent',JSON[_0x60a5('0x25')](_0x298fe6));if(_0x298fe6[_0x60a5('0x26')]){if(_0x298fe6['error'][_0x60a5('0x27')]===0x1f4){logger[_0x60a5('0x26')](_0x60a5('0x21'),_0x3795c7,_0x298fe6['error'][_0x60a5('0x28')]);return _0x2bbfac(_0x298fe6[_0x60a5('0x26')][_0x60a5('0x28')]);}logger['error']('User,\x20%s,\x20%s',_0x3795c7,_0x298fe6[_0x60a5('0x26')][_0x60a5('0x28')]);return _0x2d8c9e(_0x298fe6[_0x60a5('0x26')][_0x60a5('0x28')]);}else{logger[_0x60a5('0x20')]('User,\x20%s,\x20%s',_0x3795c7,_0x60a5('0x22'));_0x2d8c9e(_0x298fe6[_0x60a5('0x29')][_0x60a5('0x28')]);}})[_0x60a5('0x2a')](function(_0x428978){logger['error'](_0x60a5('0x21'),_0x3795c7,_0x428978);_0x2bbfac(_0x428978);});});}function respondWithStatusCode(_0x373a15,_0x14ce5a){_0x14ce5a=_0x14ce5a||0xcc;return function(_0x46544a){if(_0x46544a){return _0x373a15[_0x60a5('0x2b')](_0x14ce5a);}return _0x373a15[_0x60a5('0x2c')](_0x14ce5a)[_0x60a5('0x2d')]();};}function respondWithResult(_0x3ac096,_0x2399fd){_0x2399fd=_0x2399fd||0xc8;return function(_0x5803df){if(_0x5803df){return _0x3ac096[_0x60a5('0x2c')](_0x2399fd)[_0x60a5('0x2e')](_0x5803df);}};}function respondWithFilteredResult(_0x3bf62d,_0x3026d9){return function(_0x40f926){if(_0x40f926){var _0xfbf149=_0x40f926['count'],_0x55ad9e=_0x3026d9[_0x60a5('0x2f')],_0x1bc465=_0x3026d9[_0x60a5('0x2f')]+_0x3026d9[_0x60a5('0x30')],_0x50b819;if(_0x1bc465>=_0xfbf149){_0x1bc465=_0xfbf149;_0x50b819=0xc8;}else{_0x50b819=0xce;}_0x3bf62d['status'](_0x50b819);return _0x3bf62d['set'](_0x60a5('0x31'),_0x55ad9e+'-'+_0x1bc465+'/'+_0xfbf149)[_0x60a5('0x2e')](_0x40f926);}return null;};}function patchUpdates(_0x22778a){return function(_0x463c34){try{jsonpatch[_0x60a5('0x32')](_0x463c34,_0x22778a,!![]);}catch(_0x14d712){return BPromise[_0x60a5('0x33')](_0x14d712);}return _0x463c34[_0x60a5('0x34')]();};}function saveUpdates(_0x443f17,_0x330084){return function(_0x3b2264){if(_0x3b2264){return _0x3b2264['update'](_0x443f17)[_0x60a5('0x1f')](function(_0x37950c){return _0x37950c;});}return null;};}function removeEntity(_0x414484,_0x1d254f){return function(_0x5bc050){if(_0x5bc050){return _0x5bc050[_0x60a5('0x35')]()[_0x60a5('0x1f')](function(){var _0x2a4915=_0x5bc050[_0x60a5('0x36')]({'plain':!![]});var _0x56dd66=[{'name':_0x60a5('0x37'),'value':_0x60a5('0x38'),'ignore':!![]},{'name':_0x60a5('0x39'),'value':'agent','ignore':![]},{'name':_0x60a5('0x3a'),'value':_0x60a5('0x3b'),'ignore':![]}];var _0x2dcf8d=_(_0x56dd66)[_0x60a5('0x3c')]('ignore')['map'](_0x60a5('0x3d'))[_0x60a5('0x3d')]();if(_[_0x60a5('0x3e')](_0x2dcf8d,_0x2a4915['role'])){return;}var _0x2ad238=_[_0x60a5('0x3f')](_0x56dd66,[_0x60a5('0x3d'),_0x2a4915[_0x60a5('0x40')]])[_0x60a5('0x41')];return db['UserProfileResource'][_0x60a5('0x35')]({'where':{'type':_0x2ad238,'resourceId':_0x2a4915['id']}})['then'](function(){return _0x5bc050;});})['then'](function(){_0x414484[_0x60a5('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ab9fb,_0x245a8b){return function(_0x513049){if(!_0x513049){_0x5ab9fb['sendStatus'](0x194);}return _0x513049;};}function handleError(_0x180084,_0x1d34a3){_0x1d34a3=_0x1d34a3||0x1f4;return function(_0x257a19){logger[_0x60a5('0x26')](_0x257a19['stack']);if(_0x257a19['name']){delete _0x257a19[_0x60a5('0x41')];}_0x180084[_0x60a5('0x2c')](_0x1d34a3)['send'](_0x257a19);};}exports['index']=function(_0x326382,_0x1e9b25){var _0x1a7342={},_0x42e5c8={},_0x34d91c={'count':0x0,'rows':[]};var _0x34be59=db[_0x60a5('0x42')][_0x60a5('0x43')];_0x42e5c8[_0x60a5('0x44')]=_['differenceBy'](_[_0x60a5('0x45')](_0x34be59),[_0x60a5('0x46'),_0x60a5('0x47')]);_0x42e5c8[_0x60a5('0x48')]=_['keys'](_0x326382[_0x60a5('0x48')]);_0x42e5c8[_0x60a5('0x49')]=_[_0x60a5('0x4a')](_0x42e5c8[_0x60a5('0x44')],_0x42e5c8['query']);_0x1a7342[_0x60a5('0x4b')]=_[_0x60a5('0x4a')](_0x42e5c8['model'],qs['fields'](_0x326382[_0x60a5('0x48')][_0x60a5('0x4c')]));_0x1a7342[_0x60a5('0x4b')]=_0x1a7342[_0x60a5('0x4b')]['length']?_0x1a7342['attributes']:_0x42e5c8[_0x60a5('0x44')];if(!_0x326382[_0x60a5('0x48')]['hasOwnProperty'](_0x60a5('0x4d'))){_0x1a7342['limit']=qs[_0x60a5('0x30')](_0x326382['query'][_0x60a5('0x30')]);_0x1a7342[_0x60a5('0x2f')]=qs['offset'](_0x326382[_0x60a5('0x48')][_0x60a5('0x2f')]);}_0x1a7342[_0x60a5('0x4e')]=qs[_0x60a5('0x4f')](_0x326382[_0x60a5('0x48')][_0x60a5('0x4f')]);_0x1a7342[_0x60a5('0x50')]=qs[_0x60a5('0x49')](_['pick'](_0x326382[_0x60a5('0x48')],_0x42e5c8[_0x60a5('0x49')]));if(_0x326382[_0x60a5('0x48')][_0x60a5('0x3c')]){_0x1a7342[_0x60a5('0x50')]=_['merge'](_0x1a7342[_0x60a5('0x50')],{'$or':_[_0x60a5('0x51')](_0x34be59,function(_0x3d56d9){return db['sequelize'][_0x60a5('0x50')](db[_0x60a5('0x52')]['fn'](_0x60a5('0x53'),db['sequelize'][_0x60a5('0x54')](_0x3d56d9[_0x60a5('0x55')])),{'$like':db[_0x60a5('0x52')]['fn']('lower','%'+_0x326382[_0x60a5('0x48')][_0x60a5('0x3c')]+'%')});})});}_0x1a7342=_['merge']({},_0x1a7342,_0x326382[_0x60a5('0x56')]);var _0x3310d2={'where':_0x1a7342[_0x60a5('0x50')]};return db[_0x60a5('0x42')]['count'](_0x3310d2)['then'](function(_0xb5d70e){_0x34d91c['count']=_0xb5d70e;if(_0x326382['query'][_0x60a5('0x57')]){_0x1a7342[_0x60a5('0x58')]=[{'all':!![]}];}return db[_0x60a5('0x42')][_0x60a5('0x59')](_0x1a7342);})['then'](function(_0x1527a6){_0x34d91c[_0x60a5('0x5a')]=_0x1527a6;return _0x34d91c;})[_0x60a5('0x1f')](respondWithFilteredResult(_0x1e9b25,_0x1a7342))[_0x60a5('0x2a')](handleError(_0x1e9b25,null));};exports[_0x60a5('0x5b')]=function(_0x45a2e1,_0x226c6d){var _0x1eeb89={'raw':![],'where':{'id':_0x45a2e1[_0x60a5('0x5c')]['id']}},_0x4d0718={};_0x4d0718[_0x60a5('0x44')]=_[_0x60a5('0x5d')](_[_0x60a5('0x45')](db[_0x60a5('0x42')][_0x60a5('0x43')]),[_0x60a5('0x46'),'salt']);_0x4d0718[_0x60a5('0x48')]=_[_0x60a5('0x45')](_0x45a2e1[_0x60a5('0x48')]);_0x4d0718[_0x60a5('0x49')]=_['intersection'](_0x4d0718[_0x60a5('0x44')],_0x4d0718[_0x60a5('0x48')]);_0x1eeb89['attributes']=_[_0x60a5('0x4a')](_0x4d0718['model'],qs[_0x60a5('0x4c')](_0x45a2e1['query']['fields']));_0x1eeb89[_0x60a5('0x4b')]=_0x1eeb89[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0x1eeb89[_0x60a5('0x4b')]:_0x4d0718[_0x60a5('0x44')];if(_0x45a2e1['query'][_0x60a5('0x57')]){_0x1eeb89[_0x60a5('0x58')]=[{'all':!![]}];}_0x1eeb89=_[_0x60a5('0x5f')]({},_0x1eeb89,_0x45a2e1['options']);return db[_0x60a5('0x42')][_0x60a5('0x3f')](_0x1eeb89)[_0x60a5('0x1f')](handleEntityNotFound(_0x226c6d,null))[_0x60a5('0x1f')](respondWithResult(_0x226c6d,null))['catch'](handleError(_0x226c6d,null));};exports[_0x60a5('0x60')]=function(_0x1e8b14,_0x14f910){return db[_0x60a5('0x42')][_0x60a5('0x60')](_0x1e8b14['body'],{'raw':![],'individualHooks':!![]})[_0x60a5('0x1f')](respondWithResult(_0x14f910,0xc9))[_0x60a5('0x2a')](handleError(_0x14f910,null));};exports[_0x60a5('0x61')]=function(_0x23830a,_0x41ab77){if(_0x23830a[_0x60a5('0x62')]['id']){delete _0x23830a[_0x60a5('0x62')]['id'];}delete _0x23830a['body']['role'];return db[_0x60a5('0x42')]['find']({'where':{'id':_0x23830a[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x41ab77,null))[_0x60a5('0x1f')](saveUpdates(_0x23830a[_0x60a5('0x62')],null))[_0x60a5('0x1f')](respondWithResult(_0x41ab77,null))[_0x60a5('0x2a')](handleError(_0x41ab77,null));};exports[_0x60a5('0x63')]=function(_0xd49bf1,_0x5d3086){return db['User']['describe']()[_0x60a5('0x1f')](respondWithResult(_0x5d3086,null))[_0x60a5('0x2a')](handleError(_0x5d3086,null));};exports[_0x60a5('0x64')]=function(_0x19cc69,_0x228446,_0x5a3ba5){return db[_0x60a5('0x42')][_0x60a5('0x3f')]({'where':{'id':_0x19cc69[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x228446,null))[_0x60a5('0x1f')](function(_0xdcdc0c){if(_0xdcdc0c){return _0xdcdc0c[_0x60a5('0x64')](_0x19cc69[_0x60a5('0x62')][_0x60a5('0x65')],_[_0x60a5('0x66')](_0x19cc69[_0x60a5('0x62')],[_0x60a5('0x65'),'id'])||{});}})[_0x60a5('0x1f')](respondWithResult(_0x228446,null))['catch'](handleError(_0x228446,null));};var getLicense=function(_0x121c90){return new BPromise(function(_0x1a3339,_0x28d4f8){var _0x5797c0=0x0;_0x121c90['body'][_0x60a5('0x40')]===_0x60a5('0x67')&&_0x1a3339(_0x60a5('0x68'));return db[_0x60a5('0x42')][_0x60a5('0x69')]({'where':{'$or':[{'role':_0x121c90[_0x60a5('0x62')][_0x60a5('0x40')]===_0x60a5('0x3b')?_0x60a5('0x3b'):[_0x60a5('0x6a'),_0x60a5('0x38')]}]}})[_0x60a5('0x1f')](function(_0x128718){_0x5797c0=_0x128718;return require(_0x60a5('0x6b'))[_0x60a5('0x6c')]();})[_0x60a5('0x1f')](function(_0x38d583){var _0x58a2b0=_0x121c90[_0x60a5('0x62')][_0x60a5('0x40')]==='telephone'?'telephones':_0x60a5('0x6d');if(!_[_0x60a5('0x6e')](_0x38d583[_0x58a2b0])&&_0x5797c0>=_0x38d583[_0x58a2b0]){return _0x28d4f8({'message':'License\x20limit\x20reached'});}return _0x1a3339(util[_0x60a5('0x6f')](_0x60a5('0x70'),_0x58a2b0,_0x5797c0));})[_0x60a5('0x2a')](function(_0x45d2ff){return _0x28d4f8(_0x45d2ff);});});};exports[_0x60a5('0x71')]=function(_0x378fb9,_0x2d5713){return getLicense(_0x378fb9)['then'](function(_0x1731f8){if(!_0x378fb9[_0x60a5('0x62')][_0x60a5('0x72')]){var _0x5e3798;return db[_0x60a5('0x73')][_0x60a5('0x74')](0x1)[_0x60a5('0x1f')](function(_0x291011){_0x5e3798=_0x291011[_0x60a5('0x75')];return db[_0x60a5('0x42')][_0x60a5('0x76')](_0x60a5('0x72'));})[_0x60a5('0x1f')](function(_0x15c593){if(_[_0x60a5('0x6e')](_0x15c593)){if(_0x5e3798){_0x378fb9[_0x60a5('0x62')]['internal']=_0x5e3798;}else{_0x378fb9['body']['internal']=0x1;}}else{if(_['isNil'](_0x5e3798)||_0x5e3798==_0x15c593){_0x378fb9[_0x60a5('0x62')]['internal']=_0x15c593+0x1;}else if(_0x5e3798>_0x15c593){_0x378fb9['body'][_0x60a5('0x72')]=_0x5e3798;}else{return db['sequelize'][_0x60a5('0x48')](_0x60a5('0x77'),{'type':db[_0x60a5('0x52')]['QueryTypes']['SELECT']})[_0x60a5('0x1f')](function(_0x797fdd){if(_0x797fdd&&_0x797fdd[_0x60a5('0x5e')]){for(var _0x2ab8f8=0x0,_0x25296d=_0x797fdd[_0x60a5('0x5e')];_0x2ab8f8<_0x25296d&&_[_0x60a5('0x6e')](_0x378fb9[_0x60a5('0x62')]['internal']);_0x2ab8f8++){if(_0x5e3798<=_0x797fdd[_0x2ab8f8][_0x60a5('0x78')]){_0x378fb9[_0x60a5('0x62')][_0x60a5('0x72')]=_0x797fdd[_0x2ab8f8]['from'];}else if(_0x5e3798>_0x797fdd[_0x2ab8f8][_0x60a5('0x78')]&&_0x5e3798<=_0x797fdd[_0x2ab8f8]['to']){_0x378fb9[_0x60a5('0x62')][_0x60a5('0x72')]=_0x5e3798;}}}if(_['isNil'](_0x378fb9[_0x60a5('0x62')][_0x60a5('0x72')])){_0x378fb9[_0x60a5('0x62')]['internal']=_0x15c593+0x1;}});}}});}})[_0x60a5('0x1f')](function(){if(_0x378fb9['body'][_0x60a5('0x79')]){_0x378fb9[_0x60a5('0x62')][_0x60a5('0x7a')]=_0x378fb9[_0x60a5('0x62')][_0x60a5('0x72')];_0x378fb9['body'][_0x60a5('0x7b')]={'mailbox':_0x378fb9[_0x60a5('0x62')]['internal'],'password':_0x378fb9['body'][_0x60a5('0x46')],'fullname':_0x378fb9[_0x60a5('0x62')]['fullname'],'email':_0x378fb9[_0x60a5('0x62')]['email']};}if(_0x378fb9[_0x60a5('0x62')]&&_0x378fb9[_0x60a5('0x62')][_0x60a5('0x40')]==='agent'){_0x378fb9[_0x60a5('0x62')][_0x60a5('0x7c')]=['101','102',_0x60a5('0x7d'),_0x60a5('0x7e'),_0x60a5('0x7f'),_0x60a5('0x80'),'106',_0x60a5('0x81'),_0x60a5('0x82'),'109',_0x60a5('0x83'),_0x60a5('0x84')];}return db[_0x60a5('0x42')][_0x60a5('0x71')](_0x378fb9['body'],{'include':[{'model':db[_0x60a5('0x7b')],'as':_0x60a5('0x7b')}]});})[_0x60a5('0x1f')](function(_0x34db20){if(_0x378fb9[_0x60a5('0x62')][_0x60a5('0x40')]===_0x60a5('0x38'))return _0x34db20;var _0x98931=_0x378fb9[_0x60a5('0x38')][_0x60a5('0x36')]({'plain':!![]});if(!_0x98931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x98931[_0x60a5('0x40')]===_0x60a5('0x38')){var _0x1425fe=_0x34db20[_0x60a5('0x36')]({'plain':!![]});var _0x3abdae=[{'name':_0x60a5('0x39'),'value':_0x60a5('0x67')},{'name':'Telephones','value':'telephone'}];var _0x48765c=_[_0x60a5('0x3f')](_0x3abdae,[_0x60a5('0x3d'),_0x1425fe[_0x60a5('0x40')]])[_0x60a5('0x41')];return db[_0x60a5('0x85')][_0x60a5('0x3f')]({'where':{'name':_0x48765c,'userProfileId':_0x98931['userProfileId']},'raw':!![]})[_0x60a5('0x1f')](function(_0x2637e9){if(_0x2637e9&&_0x2637e9[_0x60a5('0x86')]===0x0){return db[_0x60a5('0x87')][_0x60a5('0x71')]({'name':_0x1425fe['name'],'resourceId':_0x1425fe['id'],'type':_0x2637e9[_0x60a5('0x41')],'sectionId':_0x2637e9['id']},{})[_0x60a5('0x1f')](function(){return _0x34db20;});}else{return _0x34db20;}})[_0x60a5('0x2a')](function(_0x330c2a){logger[_0x60a5('0x26')](_0x60a5('0x88'),_0x330c2a);throw _0x330c2a;});}return _0x34db20;})['then'](respondWithResult(_0x2d5713,0xc9))[_0x60a5('0x2a')](handleError(_0x2d5713,null));};exports[_0x60a5('0x89')]=function(_0x4449d1,_0x28b13e,_0x5bdda0){if(_0x4449d1[_0x60a5('0x62')]['id']){delete _0x4449d1[_0x60a5('0x62')]['id'];}return db[_0x60a5('0x42')]['find']({'where':{'id':_0x4449d1['params']['id']}})['then'](function(_0x1ebf76){if(_0x1ebf76){if(_0x1ebf76['id']==_0x4449d1[_0x60a5('0x38')]['id']){if(!_0x4449d1['body'][_0x60a5('0x8a')]||!_0x4449d1[_0x60a5('0x62')]['newPassword']){throw new db[(_0x60a5('0x8b'))][(_0x60a5('0x8c'))](_0x60a5('0x8d'));}if(!_0x1ebf76[_0x60a5('0x8e')](_0x4449d1[_0x60a5('0x62')][_0x60a5('0x8a')])){throw new db[(_0x60a5('0x8b'))][(_0x60a5('0x8c'))]('Wrong\x20credentials');}if(_0x4449d1[_0x60a5('0x62')][_0x60a5('0x8a')]==_0x4449d1[_0x60a5('0x62')]['newPassword']){throw new db[(_0x60a5('0x8b'))][(_0x60a5('0x8c'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x1ebf76;}else if(_0x4449d1['user']['role']==_0x60a5('0x6a')){if(!_0x4449d1[_0x60a5('0x62')][_0x60a5('0x8f')]){throw new db['Sequelize'][(_0x60a5('0x8c'))](_0x60a5('0x90'));}return _0x1ebf76;}else if(_0x4449d1[_0x60a5('0x38')][_0x60a5('0x40')]==_0x60a5('0x38')){if(!_0x4449d1[_0x60a5('0x62')][_0x60a5('0x8f')]){throw new db['Sequelize'][(_0x60a5('0x8c'))](_0x60a5('0x90'));}if(_0x1ebf76['role']!=_0x60a5('0x67')){throw new db[(_0x60a5('0x8b'))][(_0x60a5('0x8c'))](_0x60a5('0x91'));}return _0x1ebf76;}else{throw new db[(_0x60a5('0x8b'))][(_0x60a5('0x8c'))]('Unauthorized');}}return null;})['then'](handleEntityNotFound(_0x28b13e,null))[_0x60a5('0x1f')](saveUpdates({'password':_0x4449d1[_0x60a5('0x62')][_0x60a5('0x8f')],'passwordResetAt':_0x4449d1[_0x60a5('0x38')]['id']==_0x4449d1['params']['id']?moment():null},null))['then'](respondWithResult(_0x28b13e,null))[_0x60a5('0x2a')](handleError(_0x28b13e,null));};exports[_0x60a5('0x92')]=function(_0x4083f9,_0x5da6a2,_0x46b849){var _0x3682d2;return db[_0x60a5('0x42')][_0x60a5('0x3f')]({'where':{'id':_0x4083f9[_0x60a5('0x5c')]['id']},'attributes':['id',_0x60a5('0x41'),'role',_0x60a5('0x93'),_0x60a5('0x94'),'interface']})['then'](handleEntityNotFound(_0x5da6a2,null))[_0x60a5('0x1f')](function(_0x47b57c){if(_0x47b57c){_0x3682d2=_0x47b57c;if(!utils[_0x60a5('0x95')](_0x4083f9[_0x60a5('0x62')][_0x60a5('0x96')])){throw new db['Sequelize'][(_0x60a5('0x8c'))](_0x60a5('0x97'));}return _0x47b57c[_0x60a5('0x98')+_['capitalize'](_0x4083f9['body']['channel'][_0x60a5('0x99')]())+_0x60a5('0x9a')](_0x4083f9[_0x60a5('0x62')][_0x60a5('0x65')],{'penalty':_0x4083f9['body'][_0x60a5('0x9b')]||0x0});}})[_0x60a5('0x9c')](function(_0x545154){for(var _0x1b99f6=0x0;_0x1b99f6<_0x4083f9[_0x60a5('0x62')]['ids'][_0x60a5('0x5e')];_0x1b99f6+=0x1){var _0x2bdd56={'UserId':_0x4083f9[_0x60a5('0x5c')]['id']};_0x2bdd56[_[_0x60a5('0x9d')](_0x4083f9[_0x60a5('0x62')][_0x60a5('0x96')]['toLowerCase']())+_0x60a5('0x9e')]=_0x4083f9[_0x60a5('0x62')][_0x60a5('0x65')][_0x1b99f6];socket[_0x60a5('0x9f')](_0x60a5('0x38')+_[_0x60a5('0x9d')](_0x4083f9[_0x60a5('0x62')][_0x60a5('0x96')][_0x60a5('0x99')]())+_0x60a5('0xa0'),_0x2bdd56);}return _0x545154;})[_0x60a5('0x1f')](function(){if(_0x4083f9['body'][_0x60a5('0x96')]==='voice'){return db[_0x60a5('0xa1')]['findAll']({'where':{'id':_0x4083f9[_0x60a5('0x62')][_0x60a5('0x65')]||[]},'raw':!![],'attributes':['id',_0x60a5('0x41')]});}})[_0x60a5('0x1f')](function(_0x95b771){var _0x20c46f=[];if(_0x4083f9['body']['channel']===_0x60a5('0xa2')&&_0x3682d2[_0x60a5('0x40')]===_0x60a5('0x67')){for(var _0x3a693a=0x0;_0x3a693a<_0x95b771[_0x60a5('0x5e')];_0x3a693a+=0x1){_0x20c46f[_0x60a5('0xa3')]({'membername':_0x3682d2[_0x60a5('0x41')],'UserId':_0x3682d2['id'],'queue_name':_0x95b771[_0x3a693a]['name'],'VoiceQueueId':_0x95b771[_0x3a693a]['id'],'interface':_[_0x60a5('0x6e')](_0x3682d2[_0x60a5('0xa4')])?util['format'](_0x60a5('0xa5'),_0x3682d2[_0x60a5('0x41')]):_0x3682d2[_0x60a5('0xa4')],'paused':_0x3682d2[_0x60a5('0x94')]||![],'penalty':_0x4083f9[_0x60a5('0x62')][_0x60a5('0x9b')]||0x0});}return BPromise[_0x60a5('0xa6')](_0x20c46f,function(_0x30dae8){return db[_0x60a5('0xa7')]['upsert'](_0x30dae8);});}return _0x3682d2;})[_0x60a5('0x1f')](respondWithStatusCode(_0x5da6a2,null))['catch'](handleError(_0x5da6a2,null));};exports[_0x60a5('0xa8')]=function(_0x4298da,_0x1b4635,_0xcbe208){var _0x270420;return db[_0x60a5('0x42')][_0x60a5('0x3f')]({'where':{'id':_0x4298da[_0x60a5('0x5c')]['id']},'attributes':['id',_0x60a5('0x41'),_0x60a5('0x40')]})[_0x60a5('0x1f')](handleEntityNotFound(_0x1b4635,null))[_0x60a5('0x1f')](function(_0x14c80d){if(_0x14c80d){_0x270420=_0x14c80d;if(!_0x4298da[_0x60a5('0x48')][_0x60a5('0x96')]||!utils[_0x60a5('0x95')](_0x4298da['query'][_0x60a5('0x96')])){throw new db[(_0x60a5('0x8b'))][(_0x60a5('0x8c'))](_0x60a5('0x97'));}return _0x14c80d[_0x60a5('0xa9')+_['capitalize'](_0x4298da[_0x60a5('0x48')][_0x60a5('0x96')]['toLowerCase']())+_0x60a5('0x9a')](_0x4298da[_0x60a5('0x48')][_0x60a5('0x65')]);}})[_0x60a5('0x1f')](function(_0x353ee6){for(var _0x389df5=0x0;_0x389df5<_0x4298da[_0x60a5('0x48')]['ids'][_0x60a5('0x5e')];_0x389df5+=0x1){var _0x2cb1be={'UserId':_0x4298da['params']['id']};_0x2cb1be[_['capitalize'](_0x4298da[_0x60a5('0x48')][_0x60a5('0x96')][_0x60a5('0x99')]())+_0x60a5('0x9e')]=_0x4298da['query'][_0x60a5('0x65')][_0x389df5];socket[_0x60a5('0x9f')](_0x60a5('0x38')+_['capitalize'](_0x4298da['query'][_0x60a5('0x96')][_0x60a5('0x99')]())+_0x60a5('0xaa'),_0x2cb1be);}return _0x353ee6;})['then'](function(){if(_0x4298da['query'][_0x60a5('0x96')]==='voice'){return db['UserVoiceQueueRt'][_0x60a5('0x35')]({'where':{'UserId':_0x4298da['params']['id'],'VoiceQueueId':_0x4298da[_0x60a5('0x48')]['ids']},'individualHooks':!![]})[_0x60a5('0x1f')](function(){return _0x270420;});}return _0x270420;})[_0x60a5('0x1f')](respondWithStatusCode(_0x1b4635,null))[_0x60a5('0x2a')](handleError(_0x1b4635,null));};exports[_0x60a5('0xab')]=function(_0x306534,_0x3a7222,_0x33ad24){_0x306534[_0x60a5('0x62')][_0x60a5('0xac')]=_0x306534[_0x60a5('0xad')][_0x60a5('0xae')];return db[_0x60a5('0x42')][_0x60a5('0x3f')]({'where':{'id':_0x306534[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x3a7222,null))['then'](saveUpdates(_0x306534['body'],null))['then'](respondWithResult(_0x3a7222,null))['catch'](handleError(_0x3a7222,null));};exports[_0x60a5('0xaf')]=function(_0x31cfdb,_0xa1e99f,_0x3fd948){var _0x14b7e2=path[_0x60a5('0xb0')](config['root'],_0x60a5('0xb1'));return db[_0x60a5('0x42')][_0x60a5('0x3f')]({'where':{'id':_0x31cfdb['params']['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0xa1e99f,null))[_0x60a5('0x1f')](function(_0x4ab003){if(_0x4ab003){if(_[_0x60a5('0x6e')](_0x4ab003['userpic'])){return _0xa1e99f['download'](_0x14b7e2);}else{if(!fs[_0x60a5('0xb2')](path[_0x60a5('0xb0')](config[_0x60a5('0xb3')],_0x60a5('0xb4'),_0x4ab003[_0x60a5('0xac')]))){return _0xa1e99f[_0x60a5('0xb5')](_0x14b7e2);}return _0xa1e99f[_0x60a5('0xb5')](path[_0x60a5('0xb0')](config[_0x60a5('0xb3')],_0x60a5('0xb4'),_0x4ab003[_0x60a5('0xac')]));}}})['catch'](handleError(_0xa1e99f,null));};exports[_0x60a5('0xb6')]=function(_0x548f2b,_0x2fbd64,_0x2e5658){var _0x207b73={};var _0x5367f4={};var _0x469501;var _0x2d667e;return db[_0x60a5('0x42')]['findOne']({'where':{'id':_0x548f2b[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x2fbd64,null))['then'](function(_0x578173){if(_0x578173){_0x469501=_0x578173;_0x5367f4[_0x60a5('0x44')]=_[_0x60a5('0x45')](db[_0x60a5('0xb7')][_0x60a5('0x43')]);_0x5367f4[_0x60a5('0x48')]=_[_0x60a5('0x45')](_0x548f2b[_0x60a5('0x48')]);_0x5367f4[_0x60a5('0x49')]=_[_0x60a5('0x4a')](_0x5367f4['model'],_0x5367f4[_0x60a5('0x48')]);_0x207b73[_0x60a5('0x4b')]=_['intersection'](_0x5367f4['model'],qs[_0x60a5('0x4c')](_0x548f2b[_0x60a5('0x48')][_0x60a5('0x4c')]));_0x207b73['attributes']=_0x207b73[_0x60a5('0x4b')]['length']?_0x207b73[_0x60a5('0x4b')]:_0x5367f4[_0x60a5('0x44')];_0x207b73[_0x60a5('0x4e')]=qs[_0x60a5('0x4f')](_0x548f2b[_0x60a5('0x48')]['sort']);_0x207b73[_0x60a5('0x50')]=qs[_0x60a5('0x49')](_[_0x60a5('0xb8')](_0x548f2b[_0x60a5('0x48')],_0x5367f4['filters']));if(_0x548f2b[_0x60a5('0x48')][_0x60a5('0x3c')]){_0x207b73[_0x60a5('0x50')]=_[_0x60a5('0x5f')](_0x207b73[_0x60a5('0x50')],{'$or':_['map'](_0x207b73['attributes'],function(_0x254b28){var _0x174f71={};_0x174f71[_0x254b28]={'$like':'%'+_0x548f2b[_0x60a5('0x48')][_0x60a5('0x3c')]+'%'};return _0x174f71;})});}_0x207b73=_[_0x60a5('0x5f')]({},_0x207b73,_0x548f2b['options']);return _0x469501['getContacts'](_0x207b73);}})[_0x60a5('0x1f')](function(_0x5044f0){if(_0x5044f0){_0x2d667e=_0x5044f0[_0x60a5('0x5e')];if(_0x548f2b[_0x60a5('0x48')][_0x60a5('0xb9')](_0x60a5('0x57'))){_0x207b73['include']=[{'model':db[_0x60a5('0xba')],'as':_0x60a5('0xbb'),'required':![]},{'model':db[_0x60a5('0xbc')],'as':_0x60a5('0xbd'),'attributes':['id',_0x60a5('0x41'),_0x60a5('0xbe')],'where':_0x548f2b[_0x60a5('0x48')][_0x60a5('0xbf')]?{'id':_0x548f2b[_0x60a5('0x48')][_0x60a5('0xbf')]}:undefined,'required':_0x548f2b[_0x60a5('0x48')][_0x60a5('0xbf')]?!![]:![]}];}if(!_0x548f2b[_0x60a5('0x48')]['hasOwnProperty'](_0x60a5('0x4d'))){_0x207b73[_0x60a5('0x30')]=qs[_0x60a5('0x30')](_0x548f2b['query'][_0x60a5('0x30')]);_0x207b73[_0x60a5('0x2f')]=qs[_0x60a5('0x2f')](_0x548f2b[_0x60a5('0x48')][_0x60a5('0x2f')]);}return _0x469501[_0x60a5('0xb6')](_0x207b73);}})[_0x60a5('0x1f')](function(_0x3cca83){if(_0x3cca83){return _0x3cca83?{'count':_0x2d667e,'rows':_0x3cca83}:null;}})[_0x60a5('0x1f')](respondWithResult(_0x2fbd64,null))[_0x60a5('0x2a')](handleError(_0x2fbd64,null));};exports[_0x60a5('0xc0')]=function(_0x2997f7,_0x4b8dff,_0x557b6a){var _0x4a2cc9;var _0xaf1eec;var _0x21b963={};var _0x4976f6;return db['User'][_0x60a5('0xc1')]({'where':{'id':_0x2997f7[_0x60a5('0x5c')]['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x4b8dff,null))[_0x60a5('0x1f')](function(_0x4e1d92){if(!utils[_0x60a5('0x95')](_0x2997f7[_0x60a5('0x48')][_0x60a5('0x96')])){throw new db[(_0x60a5('0x8b'))][(_0x60a5('0x8c'))](_0x60a5('0x97'));}_0x4a2cc9=_0x4e1d92;var _0x4f8b8c={};_0x4f8b8c[_0x60a5('0x44')]=_['keys'](db[_[_0x60a5('0x9d')](_0x2997f7[_0x60a5('0x48')][_0x60a5('0x96')])+'Queue'][_0x60a5('0x43')]);_0x4f8b8c[_0x60a5('0x48')]=_[_0x60a5('0x45')](_0x2997f7['query']);_0x4f8b8c[_0x60a5('0x49')]=_[_0x60a5('0x4a')](_0x4f8b8c[_0x60a5('0x44')],_0x4f8b8c[_0x60a5('0x48')]);_0x21b963[_0x60a5('0x4b')]=_[_0x60a5('0x4a')](_0x4f8b8c[_0x60a5('0x44')],qs[_0x60a5('0x4c')](_0x2997f7['query'][_0x60a5('0x4c')]));_0x21b963[_0x60a5('0x4b')]=_0x21b963[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0x21b963['attributes']:_0x4f8b8c[_0x60a5('0x44')];_0x21b963[_0x60a5('0x4e')]=qs[_0x60a5('0x4f')](_0x2997f7[_0x60a5('0x48')][_0x60a5('0x4f')]);_0x21b963['where']=qs['filters'](_[_0x60a5('0xb8')](_0x2997f7[_0x60a5('0x48')],_0x4f8b8c['filters']));if(_0x2997f7[_0x60a5('0x48')][_0x60a5('0x3c')]){_0x21b963[_0x60a5('0x50')]=_[_0x60a5('0x5f')](_0x21b963[_0x60a5('0x50')],{'$or':_[_0x60a5('0x51')](_0x21b963[_0x60a5('0x4b')],function(_0x43cffb){var _0x1e693b={};_0x1e693b[_0x43cffb]={'$like':'%'+_0x2997f7[_0x60a5('0x48')][_0x60a5('0x3c')]+'%'};return _0x1e693b;})});}_0x21b963=_[_0x60a5('0x5f')]({},_0x21b963,_0x2997f7[_0x60a5('0x56')]);switch(_0x4a2cc9[_0x60a5('0x40')]){case _0x60a5('0x6a'):return db[_['capitalize'](_0x2997f7[_0x60a5('0x48')][_0x60a5('0x96')])+'Queue'][_0x60a5('0x59')](_0x21b963);case _0x60a5('0x38'):case _0x60a5('0x67'):return _0x4a2cc9[_0x60a5('0x36')+_['capitalize'](_0x2997f7['query'][_0x60a5('0x96')])+_0x60a5('0x9a')](_0x21b963);default:throw new db['Sequelize']['ValidationError'](_0x60a5('0xc2'));}})[_0x60a5('0x1f')](function(_0x3621cb){_0x4976f6=_0x3621cb[_0x60a5('0x5e')];if(!_0x2997f7[_0x60a5('0x48')][_0x60a5('0xb9')](_0x60a5('0x4d'))){_0x21b963[_0x60a5('0x30')]=qs['limit'](_0x2997f7[_0x60a5('0x48')][_0x60a5('0x30')]);_0x21b963[_0x60a5('0x2f')]=qs[_0x60a5('0x2f')](_0x2997f7[_0x60a5('0x48')][_0x60a5('0x2f')]);}switch(_0x4a2cc9[_0x60a5('0x40')]){case _0x60a5('0x6a'):return db[_[_0x60a5('0x9d')](_0x2997f7[_0x60a5('0x48')][_0x60a5('0x96')])+_0x60a5('0xc3')]['findAll'](_0x21b963);case _0x60a5('0x38'):case _0x60a5('0x67'):return _0x4a2cc9['get'+_['capitalize'](_0x2997f7['query'][_0x60a5('0x96')])+_0x60a5('0x9a')](_0x21b963);}})[_0x60a5('0x1f')](function(_0x40523e){return{'count':_0x4976f6,'rows':_0x40523e};})[_0x60a5('0x1f')](respondWithResult(_0x4b8dff,null))[_0x60a5('0x2a')](handleError(_0x4b8dff,null));};exports[_0x60a5('0xc4')]=function(_0x1c9153,_0x847725,_0x1091ba){var _0x41a01c={};var _0x23a9fc={};var _0x5d3205;var _0x5767f3;return db[_0x60a5('0x42')][_0x60a5('0xc1')]({'where':{'id':_0x1c9153[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x847725,null))[_0x60a5('0x1f')](function(_0x373637){if(_0x373637){_0x5d3205=_0x373637;_0x23a9fc['model']=_[_0x60a5('0x45')](db[_0x60a5('0xa7')][_0x60a5('0x43')]);_0x23a9fc[_0x60a5('0x48')]=_[_0x60a5('0x45')](_0x1c9153[_0x60a5('0x48')]);_0x23a9fc[_0x60a5('0x49')]=_['intersection'](_0x23a9fc[_0x60a5('0x44')],_0x23a9fc[_0x60a5('0x48')]);_0x41a01c[_0x60a5('0x4b')]=_[_0x60a5('0x4a')](_0x23a9fc[_0x60a5('0x44')],qs['fields'](_0x1c9153[_0x60a5('0x48')]['fields']));_0x41a01c['attributes']=_0x41a01c[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0x41a01c['attributes']:_0x23a9fc[_0x60a5('0x44')];_0x41a01c[_0x60a5('0x4e')]=qs['sort'](_0x1c9153[_0x60a5('0x48')][_0x60a5('0x4f')]);_0x41a01c[_0x60a5('0x50')]=qs[_0x60a5('0x49')](_[_0x60a5('0xb8')](_0x1c9153[_0x60a5('0x48')],_0x23a9fc['filters']));if(_0x1c9153[_0x60a5('0x48')][_0x60a5('0x3c')]){_0x41a01c[_0x60a5('0x50')]=_[_0x60a5('0x5f')](_0x41a01c[_0x60a5('0x50')],{'$or':_[_0x60a5('0x51')](_0x41a01c[_0x60a5('0x4b')],function(_0x7e507b){var _0x118bcf={};_0x118bcf[_0x7e507b]={'$like':'%'+_0x1c9153[_0x60a5('0x48')][_0x60a5('0x3c')]+'%'};return _0x118bcf;})});}_0x41a01c=_[_0x60a5('0x5f')]({},_0x41a01c,_0x1c9153[_0x60a5('0x56')]);return _0x5d3205[_0x60a5('0xc4')](_0x41a01c);}})['then'](function(_0x52f903){if(_0x52f903){_0x5767f3=_0x52f903['length'];if(!_0x1c9153[_0x60a5('0x48')][_0x60a5('0xb9')](_0x60a5('0x4d'))){_0x41a01c[_0x60a5('0x30')]=qs['limit'](_0x1c9153[_0x60a5('0x48')]['limit']);_0x41a01c[_0x60a5('0x2f')]=qs[_0x60a5('0x2f')](_0x1c9153[_0x60a5('0x48')][_0x60a5('0x2f')]);}return _0x5d3205[_0x60a5('0xc4')](_0x41a01c);}})[_0x60a5('0x1f')](function(_0x44eb80){if(_0x44eb80){return _0x44eb80?{'count':_0x5767f3,'rows':_0x44eb80}:null;}})['then'](respondWithResult(_0x847725,null))[_0x60a5('0x2a')](handleError(_0x847725,null));};exports[_0x60a5('0xc5')]=function(_0x13bb55,_0x1fd5cc,_0x5b8526){var _0x483bbe={};var _0x1aa86a={};var _0x49e5de;var _0x462078;return db[_0x60a5('0x42')]['findOne']({'where':{'id':_0x13bb55[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x1fd5cc,null))[_0x60a5('0x1f')](function(_0x3dcb3e){if(_0x3dcb3e){_0x49e5de=_0x3dcb3e;_0x1aa86a[_0x60a5('0x44')]=_[_0x60a5('0x45')](db[_0x60a5('0xc6')][_0x60a5('0x43')]);_0x1aa86a[_0x60a5('0x48')]=_['keys'](_0x13bb55[_0x60a5('0x48')]);_0x1aa86a['filters']=_[_0x60a5('0x4a')](_0x1aa86a[_0x60a5('0x44')],_0x1aa86a[_0x60a5('0x48')]);_0x483bbe['attributes']=_[_0x60a5('0x4a')](_0x1aa86a[_0x60a5('0x44')],qs[_0x60a5('0x4c')](_0x13bb55[_0x60a5('0x48')][_0x60a5('0x4c')]));_0x483bbe[_0x60a5('0x4b')]=_0x483bbe[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0x483bbe['attributes']:_0x1aa86a['model'];_0x483bbe[_0x60a5('0x4e')]=qs[_0x60a5('0x4f')](_0x13bb55[_0x60a5('0x48')][_0x60a5('0x4f')]);_0x483bbe[_0x60a5('0x50')]=qs[_0x60a5('0x49')](_[_0x60a5('0xb8')](_0x13bb55[_0x60a5('0x48')],_0x1aa86a['filters']));if(_0x13bb55[_0x60a5('0x48')]['filter']){_0x483bbe[_0x60a5('0x50')]=_[_0x60a5('0x5f')](_0x483bbe[_0x60a5('0x50')],{'$or':_['map'](_0x483bbe['attributes'],function(_0x4f5a49){var _0x1545b9={};_0x1545b9[_0x4f5a49]={'$like':'%'+_0x13bb55[_0x60a5('0x48')][_0x60a5('0x3c')]+'%'};return _0x1545b9;})});}_0x483bbe=_[_0x60a5('0x5f')]({},_0x483bbe,_0x13bb55[_0x60a5('0x56')]);return _0x49e5de['getGroups'](_0x483bbe);}})['then'](function(_0x1b55a2){if(_0x1b55a2){_0x462078=_0x1b55a2[_0x60a5('0x5e')];if(!_0x13bb55[_0x60a5('0x48')]['hasOwnProperty'](_0x60a5('0x4d'))){_0x483bbe['limit']=qs[_0x60a5('0x30')](_0x13bb55['query'][_0x60a5('0x30')]);_0x483bbe[_0x60a5('0x2f')]=qs['offset'](_0x13bb55['query'][_0x60a5('0x2f')]);}return _0x49e5de['getGroups'](_0x483bbe);}})[_0x60a5('0x1f')](function(_0x167b8e){if(_0x167b8e){return _0x167b8e?{'count':_0x462078,'rows':_0x167b8e}:null;}})['then'](respondWithResult(_0x1fd5cc,null))[_0x60a5('0x2a')](handleError(_0x1fd5cc,null));};exports[_0x60a5('0xc7')]=function(_0x73b8a3,_0x1648d6,_0x59c53e){var _0x22e431={'raw':!![],'where':{}};var _0x4af723={};var _0x407ca8={'count':0x0,'rows':[]};return db[_0x60a5('0x42')][_0x60a5('0xc1')]({'where':{'id':_0x73b8a3[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x1648d6,null))[_0x60a5('0x1f')](function(_0x162653){if(_0x162653){_0x4af723[_0x60a5('0x44')]=_['keys'](db['VoiceRecording'][_0x60a5('0x43')]);_0x4af723[_0x60a5('0x48')]=_[_0x60a5('0x45')](_0x73b8a3[_0x60a5('0x48')]);_0x4af723[_0x60a5('0x49')]=_[_0x60a5('0x4a')](_0x4af723['model'],_0x4af723[_0x60a5('0x48')]);_0x22e431[_0x60a5('0x4b')]=_[_0x60a5('0x4a')](_0x4af723[_0x60a5('0x44')],qs[_0x60a5('0x4c')](_0x73b8a3[_0x60a5('0x48')][_0x60a5('0x4c')]));_0x22e431[_0x60a5('0x4b')]=_0x22e431[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0x22e431[_0x60a5('0x4b')]:_0x4af723[_0x60a5('0x44')];if(!_0x73b8a3[_0x60a5('0x48')][_0x60a5('0xb9')](_0x60a5('0x4d'))){_0x22e431[_0x60a5('0x30')]=qs[_0x60a5('0x30')](_0x73b8a3[_0x60a5('0x48')][_0x60a5('0x30')]);_0x22e431[_0x60a5('0x2f')]=qs[_0x60a5('0x2f')](_0x73b8a3[_0x60a5('0x48')]['offset']);}_0x22e431[_0x60a5('0x4e')]=qs[_0x60a5('0x4f')](_0x73b8a3[_0x60a5('0x48')][_0x60a5('0x4f')]);_0x22e431[_0x60a5('0x50')]=qs['filters'](_['pick'](_0x73b8a3['query'],_0x4af723[_0x60a5('0x49')]));_0x22e431['where']['UserId']=_0x162653['id'];if(_0x73b8a3['query'][_0x60a5('0x3c')]){_0x22e431[_0x60a5('0x50')]=_[_0x60a5('0x5f')](_0x22e431[_0x60a5('0x50')],{'$or':_[_0x60a5('0x51')](_0x22e431[_0x60a5('0x4b')],function(_0x255bc5){var _0x13311a={};_0x13311a[_0x255bc5]={'$like':'%'+_0x73b8a3[_0x60a5('0x48')][_0x60a5('0x3c')]+'%'};return _0x13311a;})});}_0x22e431=_[_0x60a5('0x5f')]({},_0x22e431,_0x73b8a3[_0x60a5('0x56')]);return db[_0x60a5('0xc8')][_0x60a5('0x69')]({'where':_0x22e431[_0x60a5('0x50')]})[_0x60a5('0x1f')](function(_0x308fef){_0x407ca8[_0x60a5('0x69')]=_0x308fef;if(_0x73b8a3[_0x60a5('0x48')][_0x60a5('0x57')]){_0x22e431[_0x60a5('0x58')]=[{'all':!![]}];}return db[_0x60a5('0xc8')][_0x60a5('0x59')](_0x22e431);})[_0x60a5('0x1f')](function(_0x55673a){_0x407ca8['rows']=_0x55673a;return _0x407ca8;});}})[_0x60a5('0x1f')](respondWithFilteredResult(_0x1648d6,_0x22e431))[_0x60a5('0x2a')](handleError(_0x1648d6,null));};exports[_0x60a5('0xc9')]=function(_0x1d63f8,_0x43e9b4,_0x4b1a6c){var _0x43c814={};var _0x4a2632={};var _0x2e6adb;var _0x131784;return db['User'][_0x60a5('0xc1')]({'where':{'id':_0x1d63f8[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x43e9b4,null))['then'](function(_0x3ed6f7){if(_0x3ed6f7){_0x2e6adb=_0x3ed6f7;_0x4a2632[_0x60a5('0x44')]=_[_0x60a5('0x45')](db['ChatInteraction'][_0x60a5('0x43')]);_0x4a2632[_0x60a5('0x48')]=_[_0x60a5('0x45')](_0x1d63f8[_0x60a5('0x48')]);_0x4a2632[_0x60a5('0x49')]=_['intersection'](_0x4a2632['model'],_0x4a2632['query']);_0x43c814['attributes']=_['intersection'](_0x4a2632[_0x60a5('0x44')],qs['fields'](_0x1d63f8[_0x60a5('0x48')][_0x60a5('0x4c')]));_0x43c814[_0x60a5('0x4b')]=_0x43c814[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0x43c814['attributes']:_0x4a2632['model'];_0x43c814[_0x60a5('0x4e')]=qs[_0x60a5('0x4f')](_0x1d63f8[_0x60a5('0x48')][_0x60a5('0x4f')]);_0x43c814[_0x60a5('0x50')]=qs[_0x60a5('0x49')](_['pick'](_0x1d63f8[_0x60a5('0x48')],_0x4a2632['filters']));if(_0x1d63f8['query']['filter']){_0x43c814[_0x60a5('0x50')]=_[_0x60a5('0x5f')](_0x43c814['where'],{'$or':_[_0x60a5('0x51')](_0x43c814[_0x60a5('0x4b')],function(_0x51cc48){var _0x2a5c02={};_0x2a5c02[_0x51cc48]={'$like':'%'+_0x1d63f8[_0x60a5('0x48')][_0x60a5('0x3c')]+'%'};return _0x2a5c02;})});}_0x43c814=_['merge']({},_0x43c814,_0x1d63f8[_0x60a5('0x56')]);return _0x2e6adb['getChatInteractions'](_0x43c814);}})[_0x60a5('0x1f')](function(_0x45c88b){if(_0x45c88b){_0x131784=_0x45c88b[_0x60a5('0x5e')];if(!_0x1d63f8[_0x60a5('0x48')]['hasOwnProperty'](_0x60a5('0x4d'))){_0x43c814[_0x60a5('0x30')]=qs[_0x60a5('0x30')](_0x1d63f8[_0x60a5('0x48')][_0x60a5('0x30')]);_0x43c814['offset']=qs[_0x60a5('0x2f')](_0x1d63f8['query'][_0x60a5('0x2f')]);}return _0x2e6adb[_0x60a5('0xc9')](_0x43c814);}})[_0x60a5('0x1f')](function(_0x5bf97c){if(_0x5bf97c){return _0x5bf97c?{'count':_0x131784,'rows':_0x5bf97c}:null;}})[_0x60a5('0x1f')](respondWithResult(_0x43e9b4,null))[_0x60a5('0x2a')](handleError(_0x43e9b4,null));};exports[_0x60a5('0xca')]=function(_0x417fd5,_0x25bb92,_0x340951){var _0x27868a={};var _0x823d37={};var _0x4b2b43;var _0x4d1410;return db[_0x60a5('0x42')][_0x60a5('0xc1')]({'where':{'id':_0x417fd5[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x25bb92,null))[_0x60a5('0x1f')](function(_0x524e28){if(_0x524e28){_0x4b2b43=_0x524e28;_0x823d37[_0x60a5('0x44')]=_[_0x60a5('0x45')](db[_0x60a5('0xcb')][_0x60a5('0x43')]);_0x823d37[_0x60a5('0x48')]=_[_0x60a5('0x45')](_0x417fd5[_0x60a5('0x48')]);_0x823d37[_0x60a5('0x49')]=_[_0x60a5('0x4a')](_0x823d37[_0x60a5('0x44')],_0x823d37[_0x60a5('0x48')]);_0x27868a[_0x60a5('0x4b')]=_['intersection'](_0x823d37[_0x60a5('0x44')],qs['fields'](_0x417fd5[_0x60a5('0x48')]['fields']));_0x27868a[_0x60a5('0x4b')]=_0x27868a[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0x27868a[_0x60a5('0x4b')]:_0x823d37[_0x60a5('0x44')];_0x27868a[_0x60a5('0x4e')]=qs[_0x60a5('0x4f')](_0x417fd5['query'][_0x60a5('0x4f')]);_0x27868a[_0x60a5('0x50')]=qs[_0x60a5('0x49')](_[_0x60a5('0xb8')](_0x417fd5['query'],_0x823d37[_0x60a5('0x49')]));if(_0x417fd5[_0x60a5('0x48')][_0x60a5('0x3c')]){_0x27868a[_0x60a5('0x50')]=_[_0x60a5('0x5f')](_0x27868a[_0x60a5('0x50')],{'$or':_[_0x60a5('0x51')](_0x27868a[_0x60a5('0x4b')],function(_0x8bb281){var _0x44b9cc={};_0x44b9cc[_0x8bb281]={'$like':'%'+_0x417fd5[_0x60a5('0x48')][_0x60a5('0x3c')]+'%'};return _0x44b9cc;})});}_0x27868a=_[_0x60a5('0x5f')]({},_0x27868a,_0x417fd5[_0x60a5('0x56')]);return _0x4b2b43[_0x60a5('0xca')](_0x27868a);}})[_0x60a5('0x1f')](function(_0x418c98){if(_0x418c98){_0x4d1410=_0x418c98['length'];if(!_0x417fd5['query'][_0x60a5('0xb9')]('nolimit')){_0x27868a[_0x60a5('0x30')]=qs[_0x60a5('0x30')](_0x417fd5[_0x60a5('0x48')][_0x60a5('0x30')]);_0x27868a['offset']=qs[_0x60a5('0x2f')](_0x417fd5[_0x60a5('0x48')]['offset']);}return _0x4b2b43[_0x60a5('0xca')](_0x27868a);}})[_0x60a5('0x1f')](function(_0x2aad81){if(_0x2aad81){return _0x2aad81?{'count':_0x4d1410,'rows':_0x2aad81}:null;}})['then'](respondWithResult(_0x25bb92,null))['catch'](handleError(_0x25bb92,null));};exports[_0x60a5('0xcc')]=function(_0x231ede,_0x3cb940,_0x2b8e56){var _0x3e420d={'raw':!![],'where':{}};var _0x42f6ac={};var _0xcfee07={'count':0x0,'rows':[]};return db[_0x60a5('0x42')][_0x60a5('0xc1')]({'where':{'id':_0x231ede[_0x60a5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3cb940,null))['then'](function(_0x3626fd){if(_0x3626fd){_0x42f6ac['model']=_[_0x60a5('0x45')](db[_0x60a5('0xcd')][_0x60a5('0x43')]);_0x42f6ac['query']=_[_0x60a5('0x45')](_0x231ede[_0x60a5('0x48')]);_0x42f6ac[_0x60a5('0x49')]=_[_0x60a5('0x4a')](_0x42f6ac[_0x60a5('0x44')],_0x42f6ac[_0x60a5('0x48')]);_0x3e420d['attributes']=_['intersection'](_0x42f6ac[_0x60a5('0x44')],qs[_0x60a5('0x4c')](_0x231ede[_0x60a5('0x48')][_0x60a5('0x4c')]));_0x3e420d['attributes']=_0x3e420d[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0x3e420d['attributes']:_0x42f6ac[_0x60a5('0x44')];if(!_0x231ede[_0x60a5('0x48')][_0x60a5('0xb9')](_0x60a5('0x4d'))){_0x3e420d[_0x60a5('0x30')]=qs[_0x60a5('0x30')](_0x231ede['query']['limit']);_0x3e420d['offset']=qs[_0x60a5('0x2f')](_0x231ede[_0x60a5('0x48')][_0x60a5('0x2f')]);}_0x3e420d[_0x60a5('0x4e')]=qs[_0x60a5('0x4f')](_0x231ede[_0x60a5('0x48')]['sort']);_0x3e420d[_0x60a5('0x50')]=qs['filters'](_[_0x60a5('0xb8')](_0x231ede[_0x60a5('0x48')],_0x42f6ac['filters']));_0x3e420d[_0x60a5('0x50')]['UserId']=_0x3626fd['id'];if(_0x231ede['query'][_0x60a5('0x3c')]){_0x3e420d[_0x60a5('0x50')]=_[_0x60a5('0x5f')](_0x3e420d['where'],{'$or':_['map'](_0x3e420d[_0x60a5('0x4b')],function(_0xede84f){var _0x4e4172={};_0x4e4172[_0xede84f]={'$like':'%'+_0x231ede['query']['filter']+'%'};return _0x4e4172;})});}_0x3e420d=_[_0x60a5('0x5f')]({},_0x3e420d,_0x231ede['options']);return db['MailInteraction']['count']({'where':_0x3e420d[_0x60a5('0x50')]})[_0x60a5('0x1f')](function(_0x501788){_0xcfee07[_0x60a5('0x69')]=_0x501788;if(_0x231ede[_0x60a5('0x48')][_0x60a5('0x57')]){_0x3e420d[_0x60a5('0x58')]=[{'all':!![]}];}return db[_0x60a5('0xcd')][_0x60a5('0x59')](_0x3e420d);})[_0x60a5('0x1f')](function(_0x93f0f2){_0xcfee07[_0x60a5('0x5a')]=_0x93f0f2;return _0xcfee07;});}})[_0x60a5('0x1f')](respondWithFilteredResult(_0x3cb940,_0x3e420d))[_0x60a5('0x2a')](handleError(_0x3cb940,null));};exports[_0x60a5('0xce')]=function(_0x17d003,_0x116adb,_0x1d8897){var _0xd14fbd={};var _0x3b11e3={};var _0xa1d2a4;var _0x452b79;return db[_0x60a5('0x42')][_0x60a5('0xc1')]({'where':{'id':_0x17d003[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x116adb,null))['then'](function(_0x331991){if(_0x331991){_0xa1d2a4=_0x331991;_0x3b11e3[_0x60a5('0x44')]=_[_0x60a5('0x45')](db[_0x60a5('0xcf')][_0x60a5('0x43')]);_0x3b11e3[_0x60a5('0x48')]=_['keys'](_0x17d003['query']);_0x3b11e3[_0x60a5('0x49')]=_['intersection'](_0x3b11e3['model'],_0x3b11e3[_0x60a5('0x48')]);_0xd14fbd['attributes']=_['intersection'](_0x3b11e3[_0x60a5('0x44')],qs[_0x60a5('0x4c')](_0x17d003[_0x60a5('0x48')][_0x60a5('0x4c')]));_0xd14fbd['attributes']=_0xd14fbd[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0xd14fbd[_0x60a5('0x4b')]:_0x3b11e3[_0x60a5('0x44')];_0xd14fbd['order']=qs[_0x60a5('0x4f')](_0x17d003[_0x60a5('0x48')][_0x60a5('0x4f')]);_0xd14fbd[_0x60a5('0x50')]=qs[_0x60a5('0x49')](_[_0x60a5('0xb8')](_0x17d003[_0x60a5('0x48')],_0x3b11e3[_0x60a5('0x49')]));if(_0x17d003['query']['filter']){_0xd14fbd[_0x60a5('0x50')]=_[_0x60a5('0x5f')](_0xd14fbd['where'],{'$or':_['map'](_0xd14fbd[_0x60a5('0x4b')],function(_0x1ac84b){var _0x350460={};_0x350460[_0x1ac84b]={'$like':'%'+_0x17d003[_0x60a5('0x48')][_0x60a5('0x3c')]+'%'};return _0x350460;})});}_0xd14fbd=_[_0x60a5('0x5f')]({},_0xd14fbd,_0x17d003[_0x60a5('0x56')]);return _0xa1d2a4[_0x60a5('0xce')](_0xd14fbd);}})[_0x60a5('0x1f')](function(_0x29ac80){if(_0x29ac80){_0x452b79=_0x29ac80[_0x60a5('0x5e')];if(!_0x17d003[_0x60a5('0x48')]['hasOwnProperty'](_0x60a5('0x4d'))){_0xd14fbd[_0x60a5('0x30')]=qs[_0x60a5('0x30')](_0x17d003[_0x60a5('0x48')][_0x60a5('0x30')]);_0xd14fbd[_0x60a5('0x2f')]=qs[_0x60a5('0x2f')](_0x17d003[_0x60a5('0x48')][_0x60a5('0x2f')]);}return _0xa1d2a4[_0x60a5('0xce')](_0xd14fbd);}})[_0x60a5('0x1f')](function(_0x12eed4){if(_0x12eed4){return _0x12eed4?{'count':_0x452b79,'rows':_0x12eed4}:null;}})[_0x60a5('0x1f')](respondWithResult(_0x116adb,null))[_0x60a5('0x2a')](handleError(_0x116adb,null));};exports[_0x60a5('0xd0')]=function(_0x1501d8,_0x1fcbca,_0x20afdd){var _0x555f0a={};var _0x5ab371={};var _0x539399;var _0x3c63f9;return db[_0x60a5('0x42')]['findOne']({'where':{'id':_0x1501d8[_0x60a5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1fcbca,null))['then'](function(_0xb5f80d){if(_0xb5f80d){_0x539399=_0xb5f80d;_0x5ab371['model']=_['keys'](db[_0x60a5('0xd1')][_0x60a5('0x43')]);_0x5ab371[_0x60a5('0x48')]=_[_0x60a5('0x45')](_0x1501d8['query']);_0x5ab371[_0x60a5('0x49')]=_[_0x60a5('0x4a')](_0x5ab371[_0x60a5('0x44')],_0x5ab371[_0x60a5('0x48')]);_0x555f0a['attributes']=_[_0x60a5('0x4a')](_0x5ab371[_0x60a5('0x44')],qs['fields'](_0x1501d8['query'][_0x60a5('0x4c')]));_0x555f0a[_0x60a5('0x4b')]=_0x555f0a[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0x555f0a[_0x60a5('0x4b')]:_0x5ab371[_0x60a5('0x44')];_0x555f0a[_0x60a5('0x4e')]=qs[_0x60a5('0x4f')](_0x1501d8[_0x60a5('0x48')][_0x60a5('0x4f')]);_0x555f0a[_0x60a5('0x50')]=qs[_0x60a5('0x49')](_['pick'](_0x1501d8[_0x60a5('0x48')],_0x5ab371[_0x60a5('0x49')]));if(_0x1501d8['query']['filter']){_0x555f0a['where']=_[_0x60a5('0x5f')](_0x555f0a['where'],{'$or':_[_0x60a5('0x51')](_0x555f0a[_0x60a5('0x4b')],function(_0x45b242){var _0xd81b1e={};_0xd81b1e[_0x45b242]={'$like':'%'+_0x1501d8[_0x60a5('0x48')][_0x60a5('0x3c')]+'%'};return _0xd81b1e;})});}_0x555f0a=_[_0x60a5('0x5f')]({},_0x555f0a,_0x1501d8[_0x60a5('0x56')]);return _0x539399[_0x60a5('0xd0')](_0x555f0a);}})[_0x60a5('0x1f')](function(_0xab957b){if(_0xab957b){_0x3c63f9=_0xab957b[_0x60a5('0x5e')];if(!_0x1501d8[_0x60a5('0x48')]['hasOwnProperty']('nolimit')){_0x555f0a[_0x60a5('0x30')]=qs['limit'](_0x1501d8['query'][_0x60a5('0x30')]);_0x555f0a[_0x60a5('0x2f')]=qs[_0x60a5('0x2f')](_0x1501d8['query'][_0x60a5('0x2f')]);}return _0x539399[_0x60a5('0xd0')](_0x555f0a);}})[_0x60a5('0x1f')](function(_0x3e160e){if(_0x3e160e){return _0x3e160e?{'count':_0x3c63f9,'rows':_0x3e160e}:null;}})[_0x60a5('0x1f')](respondWithResult(_0x1fcbca,null))[_0x60a5('0x2a')](handleError(_0x1fcbca,null));};exports[_0x60a5('0xd2')]=function(_0xa37fe7,_0xf0d489,_0x318df2){var _0x816920;var _0x599885;var _0x31d0df;return db['User']['find']({'where':{'id':_0xa37fe7[_0x60a5('0x5c')]['id'],'role':_0x60a5('0x67')},'attributes':['id','name',_0x60a5('0xd3'),_0x60a5('0xd4'),_0x60a5('0x40'),'internal','loginInPause']})[_0x60a5('0x1f')](handleEntityNotFound(_0xf0d489,null))[_0x60a5('0x1f')](function(_0x3257d2){if(_0x3257d2){_0x816920=_0x3257d2;if(_0xa37fe7[_0x60a5('0x62')][_0x60a5('0xa4')]){_0x31d0df=util[_0x60a5('0x6f')](_0x60a5('0xd5'),_0x816920[_0xa37fe7['body'][_0x60a5('0xa4')]]);}else if(_0xa37fe7[_0x60a5('0x62')]['intrf']){_0x31d0df=util['format'](_0x60a5('0xa5'),_0xa37fe7[_0x60a5('0x62')][_0x60a5('0xd6')]);}else{_0x31d0df=util[_0x60a5('0x6f')](_0x60a5('0xa5'),_0x816920[_0x60a5('0x41')]);}socket['to'](util['format'](_0x60a5('0xd7'),_0x816920[_0x60a5('0x41')]))['emit'](_0x60a5('0xd8'),{'ip':_0xa37fe7[_0x60a5('0xd9')][_0x60a5('0xda')]||_0xa37fe7[_0x60a5('0xdb')][_0x60a5('0xdc')]||_0xa37fe7[_0x60a5('0xdd')][_0x60a5('0xdc')]||_0xa37fe7[_0x60a5('0xdb')][_0x60a5('0xdd')][_0x60a5('0xdc')]});return db[_0x60a5('0xa7')][_0x60a5('0x35')]({'where':{'membername':_0x816920[_0x60a5('0x41')]},'individualHooks':!![]});}})['then'](function(_0x2e5277){if(_0x816920){return _0x816920['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x45b00f){var _0x183198=[];if(_0x45b00f){_0x599885=_0x45b00f;if(_0x599885['length']){for(var _0x899569=0x0;_0x899569<_0x599885[_0x60a5('0x5e')];_0x899569++){_0x183198[_0x60a5('0xa3')]({'membername':_0x816920[_0x60a5('0x41')],'UserId':_0x816920['id'],'queue_name':_0x599885[_0x899569][_0x60a5('0x41')],'VoiceQueueId':_0x599885[_0x899569]['id'],'interface':_0x31d0df,'paused':_0x816920[_0x60a5('0x93')]||![],'penalty':_0x599885[_0x899569][_0x60a5('0xde')]||0x0});}return BPromise[_0x60a5('0xa6')](_0x183198,function(_0xb7d1bc){return db[_0x60a5('0xa7')][_0x60a5('0xdf')](_0xb7d1bc);});}}})[_0x60a5('0x1f')](function(){return db[_0x60a5('0xe0')][_0x60a5('0x59')]({'where':{'membername':_0x816920['name'],'exitAt':null}});})['then'](function(_0x9645d3){var _0x25783c=[];_0x9645d3[_0x60a5('0xe1')](function(_0x46d60a){_0x25783c['push'](_0x46d60a[_0x60a5('0x61')]({'exitAt':moment()[_0x60a5('0x6f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x60a5('0xe2')](_0x25783c);})[_0x60a5('0x1f')](function(){var _0x4bbda6=[];var _0xc28974=[];var _0x38d758=utils[_0x60a5('0xe3')]();var _0x22c95c={'membername':_0x816920['name'],'interface':_0x31d0df,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x816920['role'],'internal':_0x816920[_0x60a5('0x72')]};_0x38d758[_0x60a5('0xe1')](function(_0xa16378){_0x4bbda6[_0x60a5('0xa3')](_[_0x60a5('0x5f')]({'channel':_0xa16378,'type':'LOGIN','data1':_0xa37fe7['body'][_0x60a5('0xe4')],'data2':_0x31d0df},_0x22c95c));if(_0x816920[_0x60a5('0x93')]){_0xc28974[_0x60a5('0xa3')](_[_0x60a5('0x5f')]({'channel':_0xa16378,'type':_0x60a5('0xe5'),'data1':_0x60a5('0xe6')},_0x22c95c));}});return db[_0x60a5('0xe0')][_0x60a5('0x60')](_0x4bbda6[_0x60a5('0xe7')](_0xc28974),{'individualHooks':!![]});})[_0x60a5('0x1f')](function(){return _0x816920['update']({'online':!![],'lastLoginAt':moment()[_0x60a5('0x6f')](_0x60a5('0xe8')),'voicePause':_0x816920[_0x60a5('0x93')]||![],'mailPause':_0x816920['loginInPause']||![],'chatPause':_0x816920[_0x60a5('0x93')]||![],'faxPause':_0x816920['loginInPause']||![],'smsPause':_0x816920[_0x60a5('0x93')]||![],'openchannelPause':_0x816920[_0x60a5('0x93')]||![],'pauseType':_0x816920[_0x60a5('0x93')]?_0x60a5('0xe6'):null,'interface':_0x31d0df,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x60a5('0x1f')](respondWithResult(_0xf0d489,null))['catch'](handleError(_0xf0d489,null));};exports['logout']=function(_0x5a5cde,_0x393dcd,_0x18567d){var _0x413cfb;return db[_0x60a5('0x42')][_0x60a5('0x3f')]({'where':{'id':_0x5a5cde[_0x60a5('0x5c')]['id'],'role':'agent'},'attributes':['id','name',_0x60a5('0x40')]})[_0x60a5('0x1f')](handleEntityNotFound(_0x393dcd,null))['then'](function(_0xad4d13){if(_0xad4d13){_0x413cfb=_0xad4d13;return db[_0x60a5('0xa7')][_0x60a5('0x35')]({'where':{'membername':_0x413cfb[_0x60a5('0x41')]},'individualHooks':!![]});}})[_0x60a5('0x1f')](function(){return db[_0x60a5('0xe0')][_0x60a5('0x59')]({'where':{'membername':_0x413cfb[_0x60a5('0x41')],'exitAt':null}});})[_0x60a5('0x1f')](function(_0x208f3a){var _0x3d57ea=[];_0x208f3a[_0x60a5('0xe1')](function(_0x3ca2ff){_0x3d57ea[_0x60a5('0xa3')](_0x3ca2ff[_0x60a5('0x61')]({'exitAt':moment()[_0x60a5('0x6f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x60a5('0xe2')](_0x3d57ea);})[_0x60a5('0x1f')](function(){return _0x413cfb[_0x60a5('0x61')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})['then'](respondWithResult(_0x393dcd,null))[_0x60a5('0x2a')](handleError(_0x393dcd,null));};exports[_0x60a5('0xe9')]=function(_0x8f89e2,_0x43ae82,_0x21555c){var _0x305882;return db[_0x60a5('0xa7')]['update']({'paused':0x1},{'where':{'UserId':_0x8f89e2[_0x60a5('0x5c')]['id']},'individualHooks':!![]})[_0x60a5('0x1f')](function(){return db['User'][_0x60a5('0x3f')]({'where':{'id':_0x8f89e2[_0x60a5('0x5c')]['id'],'role':'agent'},'attributes':['id',_0x60a5('0x41'),'role',_0x60a5('0x72'),_0x60a5('0xa4')]});})[_0x60a5('0x1f')](handleEntityNotFound(_0x43ae82,null))[_0x60a5('0x1f')](function(_0x334b26){if(_0x334b26){_0x305882=_0x334b26;return respondWithRpcPromise(_0x60a5('0xea'),_0x60a5('0xe9'),{'id':_0x305882['id'],'name':_0x305882[_0x60a5('0x41')],'pause':!![]});}})[_0x60a5('0x1f')](function(){if(_0x305882){return db[_0x60a5('0xe0')]['findAll']({'where':{'membername':_0x305882[_0x60a5('0x41')],'type':'PAUSE','exitAt':null}});}})[_0x60a5('0x1f')](function(_0x47b4c7){if(_0x47b4c7[_0x60a5('0x5e')]){var _0x51e751=moment()[_0x60a5('0x6f')](_0x60a5('0xe8'));for(var _0x37032a=0x0,_0x5bdd60=_0x47b4c7['length'];_0x37032a<_0x5bdd60;_0x37032a++){_0x47b4c7[_0x37032a]['updateAttributes']({'exitAt':_0x51e751});}}})[_0x60a5('0x1f')](function(){var _0x63cbe2=[];var _0x2178cc=utils[_0x60a5('0xe3')]();_0x2178cc[_0x60a5('0xe1')](function(_0x9f1e29){_0x63cbe2[_0x60a5('0xa3')]({'channel':_0x9f1e29,'membername':_0x305882['name'],'interface':_['isNil'](_0x305882['interface'])?util['format'](_0x60a5('0xa5'),_0x305882[_0x60a5('0x41')]):_0x305882[_0x60a5('0xa4')],'type':_0x60a5('0xe5'),'enterAt':moment()[_0x60a5('0x6f')](_0x60a5('0xe8')),'data1':_0x8f89e2[_0x60a5('0x62')]['type']||_0x60a5('0xeb'),'role':_0x305882[_0x60a5('0x40')],'internal':_0x305882['internal']});});return db['MemberReport']['bulkCreate'](_0x63cbe2,{'individualHooks':!![]});})['then'](function(){return _0x305882[_0x60a5('0x61')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x8f89e2['body'][_0x60a5('0xec')]||_0x60a5('0xeb'),'lastPauseAt':moment()[_0x60a5('0x6f')](_0x60a5('0xe8'))});})[_0x60a5('0x1f')](respondWithResult(_0x43ae82,null))['catch'](handleError(_0x43ae82,null));};exports[_0x60a5('0xed')]=function(_0x3f7094,_0x3000fc,_0x4ec79e){var _0x468bf0;return db[_0x60a5('0x42')][_0x60a5('0x3f')]({'where':{'id':_0x3f7094[_0x60a5('0x5c')]['id']},'attributes':['id',_0x60a5('0x41'),_0x60a5('0x40'),_0x60a5('0x94'),_0x60a5('0xee'),_0x60a5('0xef'),_0x60a5('0xf0'),_0x60a5('0xf1'),_0x60a5('0xf2'),_0x60a5('0xf3'),_0x60a5('0xf4')]})[_0x60a5('0x1f')](handleEntityNotFound(_0x3000fc,null))[_0x60a5('0x1f')](function(_0x340d37){if(_0x340d37){_0x468bf0=_0x340d37;if(_0x3f7094[_0x60a5('0x62')][_0x60a5('0x96')]&&!utils['isValidChannel'](_0x3f7094[_0x60a5('0x62')][_0x60a5('0x96')])){throw new db[(_0x60a5('0x8b'))][(_0x60a5('0x8c'))](_0x60a5('0x97'));}switch(_0x3f7094[_0x60a5('0x62')][_0x60a5('0x96')]){case _0x60a5('0xa2'):return respondWithRpcPromise('QueuePause',_0x60a5('0xed'),{'id':_0x468bf0['id'],'name':_0x468bf0[_0x60a5('0x41')],'pause':![]})[_0x60a5('0x1f')](function(){return db[_0x60a5('0xa7')]['update']({'paused':0x0},{'where':{'UserId':_0x468bf0['id']},'individualHooks':!![]});})[_0x60a5('0x1f')](function(){return db['MemberReport'][_0x60a5('0x3f')]({'where':{'channel':_0x3f7094['body'][_0x60a5('0x96')],'membername':_0x468bf0['name'],'type':_0x60a5('0xe5'),'exitAt':null}});})[_0x60a5('0x1f')](function(_0x5dcf42){if(_0x5dcf42){return _0x5dcf42[_0x60a5('0x61')]({'exitAt':moment()[_0x60a5('0x6f')](_0x60a5('0xe8')),'data2':_0x60a5('0xf5')},{'individualHooks':!![]});}return null;})[_0x60a5('0x1f')](function(){return _0x468bf0['update']({'voicePause':![]});});case'mail':case _0x60a5('0xf6'):case _0x60a5('0xf7'):case'sms':case _0x60a5('0xf8'):return db['MemberReport']['find']({'where':{'channel':_0x3f7094['body']['channel'],'membername':_0x468bf0[_0x60a5('0x41')],'type':_0x60a5('0xe5'),'exitAt':null}})[_0x60a5('0x1f')](function(_0x2477ab){if(_0x2477ab){return _0x2477ab[_0x60a5('0x61')]({'exitAt':moment()[_0x60a5('0x6f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x60a5('0xf5')},{'individualHooks':!![]});}return null;})[_0x60a5('0x1f')](function(){var _0x3dbe4b={};_[_0x60a5('0xf9')](_0x3dbe4b,util[_0x60a5('0x6f')]('%s%s',_0x3f7094[_0x60a5('0x62')][_0x60a5('0x96')],_0x60a5('0xfa')),![]);return _0x468bf0['update'](_0x3dbe4b);});default:return respondWithRpcPromise('QueuePause',_0x60a5('0xed'),{'id':_0x468bf0['id'],'name':_0x468bf0[_0x60a5('0x41')],'pause':![]})[_0x60a5('0x1f')](function(){return db['UserVoiceQueueRt'][_0x60a5('0x61')]({'paused':0x0},{'where':{'UserId':_0x468bf0['id']}});})[_0x60a5('0x1f')](function(){return db['MemberReport'][_0x60a5('0x59')]({'where':{'membername':_0x468bf0[_0x60a5('0x41')],'type':_0x60a5('0xe5'),'exitAt':null}});})['then'](function(_0x505617){var _0x57763e=[];_0x505617['forEach'](function(_0x33fed1){_0x57763e[_0x60a5('0xa3')](_0x33fed1['update']({'exitAt':moment()['format'](_0x60a5('0xe8')),'data2':_0x60a5('0xf5')}));});return BPromise[_0x60a5('0xe2')](_0x57763e);})['then'](function(){return _0x468bf0['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x60a5('0x1f')](respondWithResult(_0x3000fc,null))[_0x60a5('0x2a')](handleError(_0x3000fc,null));};exports[_0x60a5('0xfb')]=function(_0x2751e6,_0x4152a8,_0x4df511){var _0x34a3cf={};var _0x1566e1={};var _0x4beff0;var _0x88ec7a;return db[_0x60a5('0x42')][_0x60a5('0xc1')]({'where':{'id':_0x2751e6[_0x60a5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4152a8,null))[_0x60a5('0x1f')](function(_0x12c822){if(_0x12c822){_0x4beff0=_0x12c822;_0x1566e1[_0x60a5('0x44')]=_[_0x60a5('0x45')](db[_0x60a5('0xfc')][_0x60a5('0x43')]);_0x1566e1[_0x60a5('0x48')]=_[_0x60a5('0x45')](_0x2751e6[_0x60a5('0x48')]);_0x1566e1[_0x60a5('0x49')]=_[_0x60a5('0x4a')](_0x1566e1[_0x60a5('0x44')],_0x1566e1[_0x60a5('0x48')]);_0x34a3cf[_0x60a5('0x4b')]=_[_0x60a5('0x4a')](_0x1566e1[_0x60a5('0x44')],qs[_0x60a5('0x4c')](_0x2751e6[_0x60a5('0x48')][_0x60a5('0x4c')]));_0x34a3cf['attributes']=_0x34a3cf[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0x34a3cf[_0x60a5('0x4b')]:_0x1566e1[_0x60a5('0x44')];_0x34a3cf['order']=qs[_0x60a5('0x4f')](_0x2751e6[_0x60a5('0x48')][_0x60a5('0x4f')]);_0x34a3cf[_0x60a5('0x50')]=qs[_0x60a5('0x49')](_[_0x60a5('0xb8')](_0x2751e6[_0x60a5('0x48')],_0x1566e1[_0x60a5('0x49')]));if(_0x2751e6[_0x60a5('0x48')][_0x60a5('0x3c')]){_0x34a3cf['where']=_[_0x60a5('0x5f')](_0x34a3cf['where'],{'$or':_['map'](_0x34a3cf['attributes'],function(_0xe1af62){var _0x122d42={};_0x122d42[_0xe1af62]={'$like':'%'+_0x2751e6[_0x60a5('0x48')][_0x60a5('0x3c')]+'%'};return _0x122d42;})});}_0x34a3cf=_[_0x60a5('0x5f')]({},_0x34a3cf,_0x2751e6[_0x60a5('0x56')]);return _0x4beff0['getTeams'](_0x34a3cf);}})[_0x60a5('0x1f')](function(_0x35867f){if(_0x35867f){_0x88ec7a=_0x35867f['length'];if(!_0x2751e6['query']['hasOwnProperty'](_0x60a5('0x4d'))){_0x34a3cf[_0x60a5('0x30')]=qs[_0x60a5('0x30')](_0x2751e6[_0x60a5('0x48')][_0x60a5('0x30')]);_0x34a3cf[_0x60a5('0x2f')]=qs[_0x60a5('0x2f')](_0x2751e6[_0x60a5('0x48')][_0x60a5('0x2f')]);}return _0x4beff0['getTeams'](_0x34a3cf);}})[_0x60a5('0x1f')](function(_0x2e12e0){if(_0x2e12e0){return _0x2e12e0?{'count':_0x88ec7a,'rows':_0x2e12e0}:null;}})[_0x60a5('0x1f')](respondWithResult(_0x4152a8,null))[_0x60a5('0x2a')](handleError(_0x4152a8,null));};exports[_0x60a5('0xfd')]=function(_0x359e7b,_0x49a440,_0x448e5d){return db[_0x60a5('0x42')][_0x60a5('0x3f')]({'where':{'id':_0x359e7b[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x49a440,null))[_0x60a5('0x1f')](function(_0x49df19){if(_0x49df19){return _0x49df19[_0x60a5('0xfd')](_0x359e7b['body']['ids'],_[_0x60a5('0x66')](_0x359e7b[_0x60a5('0x62')],[_0x60a5('0x65'),'id'])||{});}})[_0x60a5('0x1f')](respondWithResult(_0x49a440,null))[_0x60a5('0x2a')](handleError(_0x49a440,null));};exports['removeTeams']=function(_0x370229,_0x386982,_0x344d82){var _0x1b14ca;return db['User']['find']({'where':{'id':_0x370229[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x386982,null))[_0x60a5('0x1f')](function(_0x3d1b51){if(_0x3d1b51){return _0x3d1b51[_0x60a5('0xfe')](_0x370229[_0x60a5('0x48')][_0x60a5('0x65')]);}})[_0x60a5('0x1f')](respondWithStatusCode(_0x386982,null))[_0x60a5('0x2a')](handleError(_0x386982,null));};exports[_0x60a5('0xff')]=function(_0x18beed,_0x7b888d,_0x5a73c9){var _0x57c27d={};var _0x3132a5={};var _0x20fdb9;var _0x2055e4;return db['User'][_0x60a5('0xc1')]({'where':{'id':_0x18beed[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x7b888d,null))[_0x60a5('0x1f')](function(_0x1d73eb){if(_0x1d73eb){_0x20fdb9=_0x1d73eb;_0x3132a5[_0x60a5('0x44')]=_[_0x60a5('0x45')](db[_0x60a5('0xba')][_0x60a5('0x43')]);_0x3132a5['query']=_[_0x60a5('0x45')](_0x18beed[_0x60a5('0x48')]);_0x3132a5[_0x60a5('0x49')]=_[_0x60a5('0x4a')](_0x3132a5[_0x60a5('0x44')],_0x3132a5['query']);_0x57c27d['attributes']=_[_0x60a5('0x4a')](_0x3132a5[_0x60a5('0x44')],qs['fields'](_0x18beed[_0x60a5('0x48')][_0x60a5('0x4c')]));_0x57c27d['attributes']=_0x57c27d[_0x60a5('0x4b')][_0x60a5('0x5e')]?_0x57c27d[_0x60a5('0x4b')]:_0x3132a5['model'];_0x57c27d[_0x60a5('0x4e')]=qs[_0x60a5('0x4f')](_0x18beed[_0x60a5('0x48')]['sort']);_0x57c27d[_0x60a5('0x50')]=qs[_0x60a5('0x49')](_[_0x60a5('0xb8')](_0x18beed[_0x60a5('0x48')],_0x3132a5[_0x60a5('0x49')]));if(_0x18beed['query'][_0x60a5('0x3c')]){_0x57c27d[_0x60a5('0x50')]=_['merge'](_0x57c27d[_0x60a5('0x50')],{'$or':_[_0x60a5('0x51')](_0x57c27d[_0x60a5('0x4b')],function(_0x3e7090){var _0x4809ca={};_0x4809ca[_0x3e7090]={'$like':'%'+_0x18beed[_0x60a5('0x48')][_0x60a5('0x3c')]+'%'};return _0x4809ca;})});}_0x57c27d=_[_0x60a5('0x5f')]({},_0x57c27d,_0x18beed[_0x60a5('0x56')]);return _0x20fdb9[_0x60a5('0xff')](_0x57c27d);}})[_0x60a5('0x1f')](function(_0x2a8838){if(_0x2a8838){_0x2055e4=_0x2a8838[_0x60a5('0x5e')];if(!_0x18beed['query'][_0x60a5('0xb9')]('nolimit')){_0x57c27d[_0x60a5('0x30')]=qs[_0x60a5('0x30')](_0x18beed[_0x60a5('0x48')]['limit']);_0x57c27d[_0x60a5('0x2f')]=qs[_0x60a5('0x2f')](_0x18beed[_0x60a5('0x48')][_0x60a5('0x2f')]);}return _0x20fdb9[_0x60a5('0xff')](_0x57c27d);}})['then'](function(_0x47a001){if(_0x47a001){return _0x47a001?{'count':_0x2055e4,'rows':_0x47a001}:null;}})[_0x60a5('0x1f')](respondWithResult(_0x7b888d,null))[_0x60a5('0x2a')](handleError(_0x7b888d,null));};exports['getAgents']=function(_0x2a3fb4,_0x351eaf,_0x592bb5){var _0x1aaa28={};var _0x169f47={};var _0x50646a;var _0x11c8c7;return db[_0x60a5('0x42')][_0x60a5('0xc1')]({'where':{'id':_0x2a3fb4[_0x60a5('0x5c')]['id']}})[_0x60a5('0x1f')](handleEntityNotFound(_0x351eaf,null))[_0x60a5('0x1f')](function(_0x57362f){if(_0x57362f){_0x50646a=_0x57362f;_0x169f47['model']=_[_0x60a5('0x45')](db[_0x60a5('0x42')][_0x60a5('0x43')]);_0x169f47[_0x60a5('0x48')]=_[_0x60a5('0x45')](_0x2a3fb4[_0x60a5('0x48')]);_0x169f47[_0x60a5('0x49')]=_['intersection'](_0x169f47[_0x60a5('0x44')],_0x169f47[_0x60a5('0x48')]);_0x1aaa28[_0x60a5('0x4b')]=_[_0x60a5('0x4a')](_0x169f47[_0x60a5('0x44')],qs[_0x60a5('0x4c')](_0x2a3fb4['query'][_0x60a5('0x4c')]));_0x1aaa28['attributes']=_0x1aaa28['attributes'][_0x60a5('0x5e')]?_0x1aaa28['attributes']:_0x169f47['model'];_0x1aaa28[_0x60a5('0x4e')]=qs[_0x60a5('0x4f')](_0x2a3fb4['query'][_0x60a5('0x4f')]);_0x1aaa28[_0x60a5('0x50')]=qs['filters'](_[_0x60a5('0xb8')](_0x2a3fb4[_0x60a5('0x48')],_0x169f47[_0x60a5('0x49')]));if(_0x2a3fb4[_0x60a5('0x48')][_0x60a5('0x3c')]){_0x1aaa28[_0x60a5('0x50')]=_[_0x60a5('0x5f')](_0x1aaa28[_0x60a5('0x50')],{'$or':_[_0x60a5('0x51')](_0x1aaa28[_0x60a5('0x4b')],function(_0x1c27d3){var _0x118cad={};_0x118cad[_0x1c27d3]={'$like':'%'+_0x2a3fb4['query'][_0x60a5('0x3c')]+'%'};return _0x118cad;})});}_0x1aaa28[_0x60a5('0x44')]=db['User'];_0x1aaa28['as']=_0x60a5('0x39');_0x1aaa28=_[_0x60a5('0x5f')]({},_0x1aaa28,_0x2a3fb4[_0x60a5('0x56')]);return _0x50646a[_0x60a5('0x100')]({'include':[_0x1aaa28]});}})[_0x60a5('0x1f')](function(_0x5bef45){if(_0x5bef45){var _0x4d4d72={},_0x305422=[],_0x80f0c6=0x0;for(var _0x530352=0x0;_0x530352<_0x5bef45[_0x60a5('0x5e')];_0x530352+=0x1){for(var _0x6a3dfb=0x0,_0x10939c;_0x6a3dfb<_0x5bef45[_0x530352][_0x60a5('0x39')][_0x60a5('0x5e')];_0x6a3dfb+=0x1){_0x10939c=_0x5bef45[_0x530352]['Agents'][_0x6a3dfb]['get']({'plain':!![]});_0x4d4d72[_0x10939c['id']]=_0x10939c;}}_0x4d4d72=_[_0x60a5('0x101')](_0x4d4d72);for(var _0x50007f=qs[_0x60a5('0x2f')](_0x2a3fb4[_0x60a5('0x48')][_0x60a5('0x2f')]);_0x50007f<_0x4d4d72[_0x60a5('0x5e')]&&_0x305422[_0x60a5('0x5e')]=_0x18d5f3){_0x54bb28=_0x18d5f3;_0x40664e=0xc8;}else{_0x40664e=0xce;}_0x25a9b4[_0xd6d6('0x24')](_0x40664e);return _0x25a9b4[_0xd6d6('0x2a')]('Content-Range',_0x233a54+'-'+_0x54bb28+'/'+_0x18d5f3)['json'](_0x3c327c);}return null;};}function patchUpdates(_0x181531){return function(_0x15f46e){try{jsonpatch['apply'](_0x15f46e,_0x181531,!![]);}catch(_0x259855){return BPromise['reject'](_0x259855);}return _0x15f46e['save']();};}function saveUpdates(_0x585a4e,_0x4db44b){return function(_0x550c30){if(_0x550c30){return _0x550c30[_0xd6d6('0x2b')](_0x585a4e)['then'](function(_0xcd9f94){return _0xcd9f94;});}return null;};}function removeEntity(_0x39e2aa,_0x4f8e2b){return function(_0x3c64fa){if(_0x3c64fa){return _0x3c64fa[_0xd6d6('0x2c')]()[_0xd6d6('0x1a')](function(){var _0x5b8829=_0x3c64fa[_0xd6d6('0x2d')]({'plain':!![]});var _0x33fdda=[{'name':'Users','value':_0xd6d6('0x2e'),'ignore':!![]},{'name':'Agents','value':_0xd6d6('0x2f'),'ignore':![]},{'name':_0xd6d6('0x30'),'value':_0xd6d6('0x31'),'ignore':![]}];var _0x51b524=_(_0x33fdda)[_0xd6d6('0x32')](_0xd6d6('0x33'))[_0xd6d6('0x34')](_0xd6d6('0x35'))[_0xd6d6('0x35')]();if(_[_0xd6d6('0x36')](_0x51b524,_0x5b8829[_0xd6d6('0x37')])){return;}var _0x1faf23=_['find'](_0x33fdda,[_0xd6d6('0x35'),_0x5b8829[_0xd6d6('0x37')]])[_0xd6d6('0x38')];return db[_0xd6d6('0x39')][_0xd6d6('0x2c')]({'where':{'type':_0x1faf23,'resourceId':_0x5b8829['id']}})[_0xd6d6('0x1a')](function(){return _0x3c64fa;});})[_0xd6d6('0x1a')](function(){_0x39e2aa[_0xd6d6('0x24')](0xcc)[_0xd6d6('0x25')]();});}};}function handleEntityNotFound(_0x5d09f3,_0x2b9ae1){return function(_0xd89978){if(!_0xd89978){_0x5d09f3['sendStatus'](0x194);}return _0xd89978;};}function handleError(_0x1e644e,_0x200574){_0x200574=_0x200574||0x1f4;return function(_0x41be3f){logger[_0xd6d6('0x20')](_0x41be3f[_0xd6d6('0x3a')]);if(_0x41be3f[_0xd6d6('0x38')]){delete _0x41be3f[_0xd6d6('0x38')];}_0x1e644e[_0xd6d6('0x24')](_0x200574)['send'](_0x41be3f);};}exports[_0xd6d6('0x3b')]=function(_0x5cd90d,_0x52071e){var _0x177052={},_0x4270ed={},_0xf5759e={'count':0x0,'rows':[]};var _0x1873f1=db[_0xd6d6('0x3c')][_0xd6d6('0x3d')];_0x4270ed['model']=_[_0xd6d6('0x3e')](_['keys'](_0x1873f1),[_0xd6d6('0x3f'),_0xd6d6('0x40')]);_0x4270ed[_0xd6d6('0x41')]=_[_0xd6d6('0x42')](_0x5cd90d['query']);_0x4270ed['filters']=_[_0xd6d6('0x43')](_0x4270ed[_0xd6d6('0x44')],_0x4270ed['query']);_0x177052[_0xd6d6('0x45')]=_[_0xd6d6('0x43')](_0x4270ed['model'],qs[_0xd6d6('0x46')](_0x5cd90d[_0xd6d6('0x41')][_0xd6d6('0x46')]));_0x177052[_0xd6d6('0x45')]=_0x177052[_0xd6d6('0x45')][_0xd6d6('0x47')]?_0x177052[_0xd6d6('0x45')]:_0x4270ed['model'];if(!_0x5cd90d[_0xd6d6('0x41')][_0xd6d6('0x48')]('nolimit')){_0x177052['limit']=qs[_0xd6d6('0x29')](_0x5cd90d[_0xd6d6('0x41')][_0xd6d6('0x29')]);_0x177052[_0xd6d6('0x28')]=qs['offset'](_0x5cd90d[_0xd6d6('0x41')][_0xd6d6('0x28')]);}_0x177052[_0xd6d6('0x49')]=qs[_0xd6d6('0x4a')](_0x5cd90d[_0xd6d6('0x41')]['sort']);_0x177052['where']=qs['filters'](_['pick'](_0x5cd90d[_0xd6d6('0x41')],_0x4270ed[_0xd6d6('0x4b')]));if(_0x5cd90d[_0xd6d6('0x41')]['filter']){_0x177052[_0xd6d6('0x4c')]=_['merge'](_0x177052['where'],{'$or':_[_0xd6d6('0x34')](_0x1873f1,function(_0x32c8df){return db['sequelize'][_0xd6d6('0x4c')](db['sequelize']['fn']('lower',db['sequelize'][_0xd6d6('0x4d')](_0x32c8df[_0xd6d6('0x4e')])),{'$like':db['sequelize']['fn'](_0xd6d6('0x4f'),'%'+_0x5cd90d[_0xd6d6('0x41')]['filter']+'%')});})});}_0x177052=_[_0xd6d6('0x50')]({},_0x177052,_0x5cd90d[_0xd6d6('0x51')]);var _0x3e123c={'where':_0x177052['where']};return db[_0xd6d6('0x3c')][_0xd6d6('0x27')](_0x3e123c)[_0xd6d6('0x1a')](function(_0x560f9f){_0xf5759e[_0xd6d6('0x27')]=_0x560f9f;if(_0x5cd90d[_0xd6d6('0x41')][_0xd6d6('0x52')]){_0x177052[_0xd6d6('0x53')]=[{'all':!![]}];}return db[_0xd6d6('0x3c')][_0xd6d6('0x54')](_0x177052);})[_0xd6d6('0x1a')](function(_0x2d0dfe){_0xf5759e[_0xd6d6('0x55')]=_0x2d0dfe;return _0xf5759e;})[_0xd6d6('0x1a')](respondWithFilteredResult(_0x52071e,_0x177052))[_0xd6d6('0x56')](handleError(_0x52071e,null));};exports[_0xd6d6('0x57')]=function(_0xb413e4,_0x2d5aec){var _0x14ee8c={'raw':![],'where':{'id':_0xb413e4[_0xd6d6('0x58')]['id']}},_0x4139df={};_0x4139df[_0xd6d6('0x44')]=_['differenceBy'](_[_0xd6d6('0x42')](db[_0xd6d6('0x3c')][_0xd6d6('0x3d')]),['password','salt']);_0x4139df['query']=_[_0xd6d6('0x42')](_0xb413e4['query']);_0x4139df[_0xd6d6('0x4b')]=_['intersection'](_0x4139df[_0xd6d6('0x44')],_0x4139df[_0xd6d6('0x41')]);_0x14ee8c[_0xd6d6('0x45')]=_[_0xd6d6('0x43')](_0x4139df[_0xd6d6('0x44')],qs[_0xd6d6('0x46')](_0xb413e4['query'][_0xd6d6('0x46')]));_0x14ee8c[_0xd6d6('0x45')]=_0x14ee8c['attributes'][_0xd6d6('0x47')]?_0x14ee8c[_0xd6d6('0x45')]:_0x4139df[_0xd6d6('0x44')];if(_0xb413e4['query'][_0xd6d6('0x52')]){_0x14ee8c['include']=[{'all':!![]}];}_0x14ee8c=_[_0xd6d6('0x50')]({},_0x14ee8c,_0xb413e4['options']);return db[_0xd6d6('0x3c')][_0xd6d6('0x59')](_0x14ee8c)['then'](handleEntityNotFound(_0x2d5aec,null))['then'](respondWithResult(_0x2d5aec,null))['catch'](handleError(_0x2d5aec,null));};exports[_0xd6d6('0x5a')]=function(_0x5ee5d7,_0x3b39b6){return db[_0xd6d6('0x3c')][_0xd6d6('0x5a')](_0x5ee5d7[_0xd6d6('0x5b')],{'raw':![],'individualHooks':!![]})[_0xd6d6('0x1a')](respondWithResult(_0x3b39b6,0xc9))['catch'](handleError(_0x3b39b6,null));};exports[_0xd6d6('0x2b')]=function(_0x871906,_0x1e32a9){if(_0x871906[_0xd6d6('0x5b')]['id']){delete _0x871906[_0xd6d6('0x5b')]['id'];}delete _0x871906['body'][_0xd6d6('0x37')];return db['User'][_0xd6d6('0x59')]({'where':{'id':_0x871906['params']['id']}})['then'](handleEntityNotFound(_0x1e32a9,null))['then'](saveUpdates(_0x871906[_0xd6d6('0x5b')],null))['then'](respondWithResult(_0x1e32a9,null))[_0xd6d6('0x56')](handleError(_0x1e32a9,null));};exports[_0xd6d6('0x5c')]=function(_0x4e5e18,_0x408aa1){return db['User'][_0xd6d6('0x5c')]()[_0xd6d6('0x1a')](respondWithResult(_0x408aa1,null))[_0xd6d6('0x56')](handleError(_0x408aa1,null));};exports[_0xd6d6('0x5d')]=function(_0x5f2bb4,_0x6f0212,_0x3080a6){return db[_0xd6d6('0x3c')]['find']({'where':{'id':_0x5f2bb4['params']['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0x6f0212,null))[_0xd6d6('0x1a')](function(_0x28a080){if(_0x28a080){return _0x28a080[_0xd6d6('0x5d')](_0x5f2bb4[_0xd6d6('0x5b')][_0xd6d6('0x5e')],_[_0xd6d6('0x5f')](_0x5f2bb4[_0xd6d6('0x5b')],[_0xd6d6('0x5e'),'id'])||{});}})[_0xd6d6('0x1a')](respondWithResult(_0x6f0212,null))[_0xd6d6('0x56')](handleError(_0x6f0212,null));};var getLicense=function(_0x239063){return new BPromise(function(_0x58fa6e,_0x49096d){var _0x18eb0c=0x0;_0x239063['body'][_0xd6d6('0x37')]==='agent'&&_0x58fa6e(_0xd6d6('0x60'));return db[_0xd6d6('0x3c')][_0xd6d6('0x27')]({'where':{'$or':[{'role':_0x239063[_0xd6d6('0x5b')]['role']===_0xd6d6('0x31')?_0xd6d6('0x31'):[_0xd6d6('0x61'),'user']}]}})['then'](function(_0x482695){_0x18eb0c=_0x482695;return require(_0xd6d6('0x62'))[_0xd6d6('0x63')]();})[_0xd6d6('0x1a')](function(_0x3d1f0a){var _0x110c23=_0x239063[_0xd6d6('0x5b')]['role']===_0xd6d6('0x31')?_0xd6d6('0x64'):_0xd6d6('0x65');if(!_[_0xd6d6('0x66')](_0x3d1f0a[_0x110c23])&&_0x18eb0c>=_0x3d1f0a[_0x110c23]){return _0x49096d({'message':_0xd6d6('0x67')});}return _0x58fa6e(util[_0xd6d6('0x68')](_0xd6d6('0x69'),_0x110c23,_0x18eb0c));})[_0xd6d6('0x56')](function(_0x385dde){return _0x49096d(_0x385dde);});});};exports[_0xd6d6('0x6a')]=function(_0x447611,_0x44dcd5){return getLicense(_0x447611)[_0xd6d6('0x1a')](function(_0x44e9cd){if(!_0x447611['body'][_0xd6d6('0x6b')]){var _0x25f3eb;return db['Setting'][_0xd6d6('0x6c')](0x1)[_0xd6d6('0x1a')](function(_0x3864e9){_0x25f3eb=_0x3864e9['min_internal'];return db[_0xd6d6('0x3c')][_0xd6d6('0x6d')](_0xd6d6('0x6b'));})[_0xd6d6('0x1a')](function(_0x455755){if(_[_0xd6d6('0x66')](_0x455755)){if(_0x25f3eb){_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x6b')]=_0x25f3eb;}else{_0x447611[_0xd6d6('0x5b')]['internal']=0x1;}}else{if(_[_0xd6d6('0x66')](_0x25f3eb)||_0x25f3eb==_0x455755){_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x6b')]=_0x455755+0x1;}else if(_0x25f3eb>_0x455755){_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x6b')]=_0x25f3eb;}else{return db[_0xd6d6('0x6e')][_0xd6d6('0x41')](_0xd6d6('0x6f'),{'type':db[_0xd6d6('0x6e')][_0xd6d6('0x70')]['SELECT']})['then'](function(_0x6cd583){if(_0x6cd583&&_0x6cd583[_0xd6d6('0x47')]){for(var _0x29f3ea=0x0,_0x61a62e=_0x6cd583[_0xd6d6('0x47')];_0x29f3ea<_0x61a62e&&_[_0xd6d6('0x66')](_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x6b')]);_0x29f3ea++){if(_0x25f3eb<=_0x6cd583[_0x29f3ea]['from']){_0x447611[_0xd6d6('0x5b')]['internal']=_0x6cd583[_0x29f3ea][_0xd6d6('0x71')];}else if(_0x25f3eb>_0x6cd583[_0x29f3ea][_0xd6d6('0x71')]&&_0x25f3eb<=_0x6cd583[_0x29f3ea]['to']){_0x447611['body'][_0xd6d6('0x6b')]=_0x25f3eb;}}}if(_[_0xd6d6('0x66')](_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x6b')])){_0x447611[_0xd6d6('0x5b')]['internal']=_0x455755+0x1;}});}}});}})[_0xd6d6('0x1a')](function(){if(_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x72')]){_0x447611[_0xd6d6('0x5b')]['mailbox']=_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x6b')];_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x73')]={'mailbox':_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x6b')],'password':_0x447611['body'][_0xd6d6('0x3f')],'fullname':_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x74')],'email':_0x447611['body'][_0xd6d6('0x75')]};}if(_0x447611[_0xd6d6('0x5b')]&&_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x37')]===_0xd6d6('0x2f')){_0x447611[_0xd6d6('0x5b')][_0xd6d6('0x76')]=[_0xd6d6('0x77'),'102','103',_0xd6d6('0x78'),_0xd6d6('0x79'),_0xd6d6('0x7a'),_0xd6d6('0x7b'),_0xd6d6('0x7c'),'108',_0xd6d6('0x7d'),_0xd6d6('0x7e'),_0xd6d6('0x7f')];}return db[_0xd6d6('0x3c')][_0xd6d6('0x6a')](_0x447611['body'],{'include':[{'model':db['VoiceMail'],'as':_0xd6d6('0x73')}]});})[_0xd6d6('0x1a')](function(_0x26a9da){if(_0x447611['body']['role']===_0xd6d6('0x2e'))return _0x26a9da;var _0x107c55=_0x447611['user'][_0xd6d6('0x2d')]({'plain':!![]});if(!_0x107c55)throw new Error(_0xd6d6('0x80'));if(_0x107c55[_0xd6d6('0x37')]===_0xd6d6('0x2e')){var _0x3e586b=_0x26a9da['get']({'plain':!![]});var _0x1edc9b=[{'name':_0xd6d6('0x81'),'value':_0xd6d6('0x2f')},{'name':_0xd6d6('0x30'),'value':'telephone'}];var _0x417434=_[_0xd6d6('0x59')](_0x1edc9b,['value',_0x3e586b[_0xd6d6('0x37')]])[_0xd6d6('0x38')];return db['UserProfileSection'][_0xd6d6('0x59')]({'where':{'name':_0x417434,'userProfileId':_0x107c55['userProfileId']},'raw':!![]})['then'](function(_0x53d004){if(_0x53d004&&_0x53d004[_0xd6d6('0x82')]===0x0){return db['UserProfileResource'][_0xd6d6('0x6a')]({'name':_0x3e586b[_0xd6d6('0x38')],'resourceId':_0x3e586b['id'],'type':_0x53d004['name'],'sectionId':_0x53d004['id']},{})[_0xd6d6('0x1a')](function(){return _0x26a9da;});}else{return _0x26a9da;}})[_0xd6d6('0x56')](function(_0x2bca08){logger['error'](_0xd6d6('0x83'),_0x2bca08);throw _0x2bca08;});}return _0x26a9da;})[_0xd6d6('0x1a')](respondWithResult(_0x44dcd5,0xc9))[_0xd6d6('0x56')](handleError(_0x44dcd5,null));};exports[_0xd6d6('0x84')]=function(_0x80b6a5,_0x1b90f7,_0x39d1d9){if(_0x80b6a5[_0xd6d6('0x5b')]['id']){delete _0x80b6a5[_0xd6d6('0x5b')]['id'];}return db['User'][_0xd6d6('0x59')]({'where':{'id':_0x80b6a5['params']['id']}})[_0xd6d6('0x1a')](function(_0x3d0b8e){if(_0x3d0b8e){if(_0x3d0b8e['id']==_0x80b6a5[_0xd6d6('0x2e')]['id']){if(!_0x80b6a5[_0xd6d6('0x5b')][_0xd6d6('0x85')]||!_0x80b6a5[_0xd6d6('0x5b')][_0xd6d6('0x86')]){throw new db['Sequelize']['ValidationError'](_0xd6d6('0x87'));}if(!_0x3d0b8e[_0xd6d6('0x88')](_0x80b6a5[_0xd6d6('0x5b')][_0xd6d6('0x85')])){throw new db[(_0xd6d6('0x89'))][(_0xd6d6('0x8a'))]('Wrong\x20credentials');}if(_0x80b6a5[_0xd6d6('0x5b')][_0xd6d6('0x85')]==_0x80b6a5[_0xd6d6('0x5b')][_0xd6d6('0x86')]){throw new db[(_0xd6d6('0x89'))][(_0xd6d6('0x8a'))](_0xd6d6('0x8b'));}return _0x3d0b8e;}else if(_0x80b6a5[_0xd6d6('0x2e')][_0xd6d6('0x37')]==_0xd6d6('0x61')){if(!_0x80b6a5[_0xd6d6('0x5b')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0xd6d6('0x8c'));}return _0x3d0b8e;}else if(_0x80b6a5[_0xd6d6('0x2e')]['role']==_0xd6d6('0x2e')){if(!_0x80b6a5[_0xd6d6('0x5b')]['newPassword']){throw new db[(_0xd6d6('0x89'))][(_0xd6d6('0x8a'))](_0xd6d6('0x8c'));}if(_0x3d0b8e[_0xd6d6('0x37')]!=_0xd6d6('0x2f')){throw new db[(_0xd6d6('0x89'))]['ValidationError'](_0xd6d6('0x8d'));}return _0x3d0b8e;}else{throw new db[(_0xd6d6('0x89'))][(_0xd6d6('0x8a'))](_0xd6d6('0x8d'));}}return null;})[_0xd6d6('0x1a')](handleEntityNotFound(_0x1b90f7,null))[_0xd6d6('0x1a')](saveUpdates({'password':_0x80b6a5[_0xd6d6('0x5b')][_0xd6d6('0x86')],'passwordResetAt':_0x80b6a5[_0xd6d6('0x2e')]['id']==_0x80b6a5[_0xd6d6('0x58')]['id']?moment():null},null))[_0xd6d6('0x1a')](respondWithResult(_0x1b90f7,null))[_0xd6d6('0x56')](handleError(_0x1b90f7,null));};exports[_0xd6d6('0x8e')]=function(_0x17218d,_0x26fe42,_0x4e8684){var _0x300744;return db[_0xd6d6('0x3c')][_0xd6d6('0x59')]({'where':{'id':_0x17218d[_0xd6d6('0x58')]['id']},'attributes':['id',_0xd6d6('0x38'),'role',_0xd6d6('0x8f'),_0xd6d6('0x90'),_0xd6d6('0x91')]})[_0xd6d6('0x1a')](handleEntityNotFound(_0x26fe42,null))[_0xd6d6('0x1a')](function(_0x406ec7){if(_0x406ec7){_0x300744=_0x406ec7;if(!utils[_0xd6d6('0x92')](_0x17218d[_0xd6d6('0x5b')][_0xd6d6('0x93')])){throw new db[(_0xd6d6('0x89'))][(_0xd6d6('0x8a'))]('Unknown\x20channel');}return _0x406ec7[_0xd6d6('0x94')+_[_0xd6d6('0x95')](_0x17218d[_0xd6d6('0x5b')][_0xd6d6('0x93')]['toLowerCase']())+'Queues'](_0x17218d[_0xd6d6('0x5b')][_0xd6d6('0x5e')],{'penalty':_0x17218d['body'][_0xd6d6('0x96')]||0x0});}})[_0xd6d6('0x97')](function(_0x852e78){for(var _0x1b87a9=0x0;_0x1b87a9<_0x17218d['body'][_0xd6d6('0x5e')]['length'];_0x1b87a9+=0x1){var _0x8c459={'UserId':_0x17218d[_0xd6d6('0x58')]['id']};_0x8c459[_['capitalize'](_0x17218d[_0xd6d6('0x5b')][_0xd6d6('0x93')][_0xd6d6('0x98')]())+_0xd6d6('0x99')]=_0x17218d['body'][_0xd6d6('0x5e')][_0x1b87a9];socket[_0xd6d6('0x9a')](_0xd6d6('0x2e')+_['capitalize'](_0x17218d[_0xd6d6('0x5b')]['channel'][_0xd6d6('0x98')]())+'Queue:save',_0x8c459);}return _0x852e78;})[_0xd6d6('0x1a')](function(){if(_0x17218d[_0xd6d6('0x5b')]['channel']===_0xd6d6('0x9b')){return db[_0xd6d6('0x9c')]['findAll']({'where':{'id':_0x17218d[_0xd6d6('0x5b')][_0xd6d6('0x5e')]||[]},'raw':!![],'attributes':['id',_0xd6d6('0x38')]});}})[_0xd6d6('0x1a')](function(_0x3a224c){var _0x594818=[];if(_0x17218d[_0xd6d6('0x5b')][_0xd6d6('0x93')]===_0xd6d6('0x9b')&&_0x300744[_0xd6d6('0x37')]==='agent'){for(var _0x253285=0x0;_0x253285<_0x3a224c[_0xd6d6('0x47')];_0x253285+=0x1){_0x594818['push']({'membername':_0x300744[_0xd6d6('0x38')],'UserId':_0x300744['id'],'queue_name':_0x3a224c[_0x253285][_0xd6d6('0x38')],'VoiceQueueId':_0x3a224c[_0x253285]['id'],'interface':_[_0xd6d6('0x66')](_0x300744[_0xd6d6('0x91')])?util[_0xd6d6('0x68')]('SIP/%s',_0x300744['name']):_0x300744[_0xd6d6('0x91')],'paused':_0x300744[_0xd6d6('0x90')]||![],'penalty':_0x17218d[_0xd6d6('0x5b')][_0xd6d6('0x96')]||0x0});}return BPromise[_0xd6d6('0x9d')](_0x594818,function(_0x54469f){return db[_0xd6d6('0x9e')][_0xd6d6('0x9f')](_0x54469f);});}return _0x300744;})[_0xd6d6('0x1a')](respondWithStatusCode(_0x26fe42,null))['catch'](handleError(_0x26fe42,null));};exports[_0xd6d6('0xa0')]=function(_0x3926ac,_0x3b7472,_0x12fe5d){var _0x678240;return db[_0xd6d6('0x3c')][_0xd6d6('0x59')]({'where':{'id':_0x3926ac[_0xd6d6('0x58')]['id']},'attributes':['id',_0xd6d6('0x38'),_0xd6d6('0x37')]})[_0xd6d6('0x1a')](handleEntityNotFound(_0x3b7472,null))[_0xd6d6('0x1a')](function(_0x21df63){if(_0x21df63){_0x678240=_0x21df63;if(!_0x3926ac[_0xd6d6('0x41')]['channel']||!utils[_0xd6d6('0x92')](_0x3926ac[_0xd6d6('0x41')][_0xd6d6('0x93')])){throw new db[(_0xd6d6('0x89'))][(_0xd6d6('0x8a'))](_0xd6d6('0xa1'));}return _0x21df63[_0xd6d6('0xa2')+_[_0xd6d6('0x95')](_0x3926ac[_0xd6d6('0x41')][_0xd6d6('0x93')][_0xd6d6('0x98')]())+_0xd6d6('0xa3')](_0x3926ac['query'][_0xd6d6('0x5e')]);}})[_0xd6d6('0x1a')](function(_0x1ba007){for(var _0x48ad9d=0x0;_0x48ad9d<_0x3926ac[_0xd6d6('0x41')][_0xd6d6('0x5e')][_0xd6d6('0x47')];_0x48ad9d+=0x1){var _0x302193={'UserId':_0x3926ac[_0xd6d6('0x58')]['id']};_0x302193[_[_0xd6d6('0x95')](_0x3926ac[_0xd6d6('0x41')][_0xd6d6('0x93')][_0xd6d6('0x98')]())+_0xd6d6('0x99')]=_0x3926ac[_0xd6d6('0x41')]['ids'][_0x48ad9d];socket[_0xd6d6('0x9a')](_0xd6d6('0x2e')+_['capitalize'](_0x3926ac['query'][_0xd6d6('0x93')][_0xd6d6('0x98')]())+_0xd6d6('0xa4'),_0x302193);}return _0x1ba007;})[_0xd6d6('0x1a')](function(){if(_0x3926ac[_0xd6d6('0x41')]['channel']===_0xd6d6('0x9b')){return db[_0xd6d6('0x9e')][_0xd6d6('0x2c')]({'where':{'UserId':_0x3926ac[_0xd6d6('0x58')]['id'],'VoiceQueueId':_0x3926ac['query']['ids']},'individualHooks':!![]})['then'](function(){return _0x678240;});}return _0x678240;})[_0xd6d6('0x1a')](respondWithStatusCode(_0x3b7472,null))[_0xd6d6('0x56')](handleError(_0x3b7472,null));};exports['addAvatar']=function(_0x2042f8,_0x26c6e7,_0x5d3d70){_0x2042f8['body'][_0xd6d6('0xa5')]=_0x2042f8[_0xd6d6('0xa6')][_0xd6d6('0xa7')];return db[_0xd6d6('0x3c')][_0xd6d6('0x59')]({'where':{'id':_0x2042f8['params']['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0x26c6e7,null))[_0xd6d6('0x1a')](saveUpdates(_0x2042f8[_0xd6d6('0x5b')],null))[_0xd6d6('0x1a')](respondWithResult(_0x26c6e7,null))[_0xd6d6('0x56')](handleError(_0x26c6e7,null));};exports['getAvatar']=function(_0x18e23c,_0x1d14b4,_0x558189){var _0x17d6c3=path[_0xd6d6('0xa8')](config[_0xd6d6('0xa9')],_0xd6d6('0xaa'));return db['User'][_0xd6d6('0x59')]({'where':{'id':_0x18e23c[_0xd6d6('0x58')]['id']},'attributes':['id',_0xd6d6('0xa5')],'raw':!![]})[_0xd6d6('0x1a')](handleEntityNotFound(_0x1d14b4,null))['then'](function(_0x45095c){if(_0x45095c){if(_['isNil'](_0x45095c[_0xd6d6('0xa5')])){return _0x1d14b4[_0xd6d6('0xab')](_0x17d6c3);}else{if(!fs[_0xd6d6('0xac')](path[_0xd6d6('0xa8')](config['root'],_0xd6d6('0xad'),_0x45095c[_0xd6d6('0xa5')]))){return _0x1d14b4[_0xd6d6('0xab')](_0x17d6c3);}return _0x1d14b4[_0xd6d6('0xab')](path[_0xd6d6('0xa8')](config[_0xd6d6('0xa9')],_0xd6d6('0xad'),_0x45095c[_0xd6d6('0xa5')]));}}})[_0xd6d6('0x56')](handleError(_0x1d14b4,null));};exports['getContacts']=function(_0x3c8062,_0x179a1d,_0x58d829){var _0xf8421f={};var _0x4f5bf3={};var _0x3763d8;var _0x5b95de;return db[_0xd6d6('0x3c')][_0xd6d6('0xae')]({'where':{'id':_0x3c8062[_0xd6d6('0x58')]['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0x179a1d,null))[_0xd6d6('0x1a')](function(_0x148e25){if(_0x148e25){_0x3763d8=_0x148e25;_0x4f5bf3[_0xd6d6('0x44')]=_[_0xd6d6('0x42')](db[_0xd6d6('0xaf')][_0xd6d6('0x3d')]);_0x4f5bf3[_0xd6d6('0x41')]=_[_0xd6d6('0x42')](_0x3c8062[_0xd6d6('0x41')]);_0x4f5bf3['filters']=_[_0xd6d6('0x43')](_0x4f5bf3['model'],_0x4f5bf3['query']);_0xf8421f[_0xd6d6('0x45')]=_[_0xd6d6('0x43')](_0x4f5bf3[_0xd6d6('0x44')],qs[_0xd6d6('0x46')](_0x3c8062[_0xd6d6('0x41')][_0xd6d6('0x46')]));_0xf8421f[_0xd6d6('0x45')]=_0xf8421f[_0xd6d6('0x45')]['length']?_0xf8421f[_0xd6d6('0x45')]:_0x4f5bf3[_0xd6d6('0x44')];_0xf8421f['order']=qs['sort'](_0x3c8062['query']['sort']);_0xf8421f[_0xd6d6('0x4c')]=qs[_0xd6d6('0x4b')](_['pick'](_0x3c8062[_0xd6d6('0x41')],_0x4f5bf3['filters']));if(_0x3c8062['query']['filter']){_0xf8421f[_0xd6d6('0x4c')]=_[_0xd6d6('0x50')](_0xf8421f[_0xd6d6('0x4c')],{'$or':_[_0xd6d6('0x34')](_0xf8421f['attributes'],function(_0x39f372){var _0x22dcff={};_0x22dcff[_0x39f372]={'$like':'%'+_0x3c8062['query'][_0xd6d6('0x32')]+'%'};return _0x22dcff;})});}_0xf8421f=_[_0xd6d6('0x50')]({},_0xf8421f,_0x3c8062[_0xd6d6('0x51')]);return _0x3763d8[_0xd6d6('0xb0')](_0xf8421f);}})['then'](function(_0x3aa022){if(_0x3aa022){_0x5b95de=_0x3aa022[_0xd6d6('0x47')];if(_0x3c8062[_0xd6d6('0x41')][_0xd6d6('0x48')](_0xd6d6('0x52'))){_0xf8421f[_0xd6d6('0x53')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0xd6d6('0xb1')],'as':'Tags','attributes':['id',_0xd6d6('0x38'),'color'],'where':_0x3c8062['query']['tag']?{'id':_0x3c8062[_0xd6d6('0x41')][_0xd6d6('0xb2')]}:undefined,'required':_0x3c8062['query'][_0xd6d6('0xb2')]?!![]:![]}];}if(!_0x3c8062[_0xd6d6('0x41')][_0xd6d6('0x48')](_0xd6d6('0xb3'))){_0xf8421f['limit']=qs['limit'](_0x3c8062['query'][_0xd6d6('0x29')]);_0xf8421f[_0xd6d6('0x28')]=qs[_0xd6d6('0x28')](_0x3c8062[_0xd6d6('0x41')][_0xd6d6('0x28')]);}return _0x3763d8[_0xd6d6('0xb0')](_0xf8421f);}})[_0xd6d6('0x1a')](function(_0x31108f){if(_0x31108f){return _0x31108f?{'count':_0x5b95de,'rows':_0x31108f}:null;}})['then'](respondWithResult(_0x179a1d,null))[_0xd6d6('0x56')](handleError(_0x179a1d,null));};exports['getQueues']=function(_0xf5e3dc,_0x56ae90,_0x59dd3f){var _0xbb71d9;var _0x53a014;var _0x124218={};var _0x1361f9;return db[_0xd6d6('0x3c')][_0xd6d6('0xae')]({'where':{'id':_0xf5e3dc[_0xd6d6('0x58')]['id']},'attributes':['id','name',_0xd6d6('0x37')]})['then'](handleEntityNotFound(_0x56ae90,null))['then'](function(_0x469ce4){if(!utils[_0xd6d6('0x92')](_0xf5e3dc[_0xd6d6('0x41')]['channel'])){throw new db[(_0xd6d6('0x89'))]['ValidationError'](_0xd6d6('0xa1'));}_0xbb71d9=_0x469ce4;var _0x2f18bb={};_0x2f18bb[_0xd6d6('0x44')]=_[_0xd6d6('0x42')](db[_[_0xd6d6('0x95')](_0xf5e3dc[_0xd6d6('0x41')][_0xd6d6('0x93')])+_0xd6d6('0xb4')][_0xd6d6('0x3d')]);_0x2f18bb['query']=_['keys'](_0xf5e3dc[_0xd6d6('0x41')]);_0x2f18bb[_0xd6d6('0x4b')]=_[_0xd6d6('0x43')](_0x2f18bb['model'],_0x2f18bb[_0xd6d6('0x41')]);_0x124218[_0xd6d6('0x45')]=_[_0xd6d6('0x43')](_0x2f18bb[_0xd6d6('0x44')],qs[_0xd6d6('0x46')](_0xf5e3dc[_0xd6d6('0x41')][_0xd6d6('0x46')]));_0x124218[_0xd6d6('0x45')]=_0x124218['attributes'][_0xd6d6('0x47')]?_0x124218[_0xd6d6('0x45')]:_0x2f18bb[_0xd6d6('0x44')];_0x124218[_0xd6d6('0x49')]=qs['sort'](_0xf5e3dc['query']['sort']);_0x124218[_0xd6d6('0x4c')]=qs[_0xd6d6('0x4b')](_[_0xd6d6('0xb5')](_0xf5e3dc[_0xd6d6('0x41')],_0x2f18bb['filters']));if(_0xf5e3dc[_0xd6d6('0x41')][_0xd6d6('0x32')]){_0x124218[_0xd6d6('0x4c')]=_[_0xd6d6('0x50')](_0x124218[_0xd6d6('0x4c')],{'$or':_[_0xd6d6('0x34')](_0x124218[_0xd6d6('0x45')],function(_0x26864e){var _0x352e8f={};_0x352e8f[_0x26864e]={'$like':'%'+_0xf5e3dc['query'][_0xd6d6('0x32')]+'%'};return _0x352e8f;})});}_0x124218=_[_0xd6d6('0x50')]({},_0x124218,_0xf5e3dc[_0xd6d6('0x51')]);switch(_0xbb71d9['role']){case'admin':return db[_[_0xd6d6('0x95')](_0xf5e3dc['query'][_0xd6d6('0x93')])+_0xd6d6('0xb4')]['findAll'](_0x124218);case _0xd6d6('0x2e'):case'agent':return _0xbb71d9[_0xd6d6('0x2d')+_[_0xd6d6('0x95')](_0xf5e3dc[_0xd6d6('0x41')][_0xd6d6('0x93')])+_0xd6d6('0xa3')](_0x124218);default:throw new db[(_0xd6d6('0x89'))][(_0xd6d6('0x8a'))]('Unknown\x20role');}})[_0xd6d6('0x1a')](function(_0x400ef7){_0x1361f9=_0x400ef7[_0xd6d6('0x47')];if(!_0xf5e3dc[_0xd6d6('0x41')][_0xd6d6('0x48')](_0xd6d6('0xb3'))){_0x124218[_0xd6d6('0x29')]=qs[_0xd6d6('0x29')](_0xf5e3dc[_0xd6d6('0x41')]['limit']);_0x124218[_0xd6d6('0x28')]=qs['offset'](_0xf5e3dc['query'][_0xd6d6('0x28')]);}switch(_0xbb71d9[_0xd6d6('0x37')]){case'admin':return db[_[_0xd6d6('0x95')](_0xf5e3dc['query'][_0xd6d6('0x93')])+_0xd6d6('0xb4')][_0xd6d6('0x54')](_0x124218);case _0xd6d6('0x2e'):case _0xd6d6('0x2f'):return _0xbb71d9[_0xd6d6('0x2d')+_[_0xd6d6('0x95')](_0xf5e3dc[_0xd6d6('0x41')][_0xd6d6('0x93')])+_0xd6d6('0xa3')](_0x124218);}})[_0xd6d6('0x1a')](function(_0x4f7b8d){return{'count':_0x1361f9,'rows':_0x4f7b8d};})['then'](respondWithResult(_0x56ae90,null))[_0xd6d6('0x56')](handleError(_0x56ae90,null));};exports[_0xd6d6('0xb6')]=function(_0xff3dba,_0x40222e,_0x717e7e){var _0x3fe636={};var _0x1bb749={};var _0x19440e;var _0x331c16;return db[_0xd6d6('0x3c')]['findOne']({'where':{'id':_0xff3dba[_0xd6d6('0x58')]['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0x40222e,null))[_0xd6d6('0x1a')](function(_0x3b06a4){if(_0x3b06a4){_0x19440e=_0x3b06a4;_0x1bb749[_0xd6d6('0x44')]=_[_0xd6d6('0x42')](db[_0xd6d6('0x9e')][_0xd6d6('0x3d')]);_0x1bb749[_0xd6d6('0x41')]=_[_0xd6d6('0x42')](_0xff3dba[_0xd6d6('0x41')]);_0x1bb749['filters']=_[_0xd6d6('0x43')](_0x1bb749[_0xd6d6('0x44')],_0x1bb749[_0xd6d6('0x41')]);_0x3fe636[_0xd6d6('0x45')]=_['intersection'](_0x1bb749['model'],qs['fields'](_0xff3dba['query'][_0xd6d6('0x46')]));_0x3fe636[_0xd6d6('0x45')]=_0x3fe636[_0xd6d6('0x45')][_0xd6d6('0x47')]?_0x3fe636[_0xd6d6('0x45')]:_0x1bb749[_0xd6d6('0x44')];_0x3fe636[_0xd6d6('0x49')]=qs['sort'](_0xff3dba[_0xd6d6('0x41')][_0xd6d6('0x4a')]);_0x3fe636[_0xd6d6('0x4c')]=qs['filters'](_[_0xd6d6('0xb5')](_0xff3dba['query'],_0x1bb749[_0xd6d6('0x4b')]));if(_0xff3dba[_0xd6d6('0x41')]['filter']){_0x3fe636[_0xd6d6('0x4c')]=_['merge'](_0x3fe636[_0xd6d6('0x4c')],{'$or':_[_0xd6d6('0x34')](_0x3fe636['attributes'],function(_0x4fd031){var _0x190972={};_0x190972[_0x4fd031]={'$like':'%'+_0xff3dba[_0xd6d6('0x41')][_0xd6d6('0x32')]+'%'};return _0x190972;})});}_0x3fe636=_['merge']({},_0x3fe636,_0xff3dba['options']);return _0x19440e[_0xd6d6('0xb6')](_0x3fe636);}})[_0xd6d6('0x1a')](function(_0x4ff89c){if(_0x4ff89c){_0x331c16=_0x4ff89c[_0xd6d6('0x47')];if(!_0xff3dba['query'][_0xd6d6('0x48')](_0xd6d6('0xb3'))){_0x3fe636[_0xd6d6('0x29')]=qs[_0xd6d6('0x29')](_0xff3dba[_0xd6d6('0x41')][_0xd6d6('0x29')]);_0x3fe636[_0xd6d6('0x28')]=qs['offset'](_0xff3dba['query'][_0xd6d6('0x28')]);}return _0x19440e[_0xd6d6('0xb6')](_0x3fe636);}})[_0xd6d6('0x1a')](function(_0x6eb1bd){if(_0x6eb1bd){return _0x6eb1bd?{'count':_0x331c16,'rows':_0x6eb1bd}:null;}})[_0xd6d6('0x1a')](respondWithResult(_0x40222e,null))[_0xd6d6('0x56')](handleError(_0x40222e,null));};exports[_0xd6d6('0xb7')]=function(_0x2e5543,_0x2b343f,_0x5f364f){var _0x160064={};var _0x3cc7cd={};var _0x5bd656;var _0x25b371;return db[_0xd6d6('0x3c')][_0xd6d6('0xae')]({'where':{'id':_0x2e5543[_0xd6d6('0x58')]['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0x2b343f,null))['then'](function(_0x1ebd6f){if(_0x1ebd6f){_0x5bd656=_0x1ebd6f;_0x3cc7cd[_0xd6d6('0x44')]=_[_0xd6d6('0x42')](db['ChatGroup'][_0xd6d6('0x3d')]);_0x3cc7cd[_0xd6d6('0x41')]=_[_0xd6d6('0x42')](_0x2e5543[_0xd6d6('0x41')]);_0x3cc7cd['filters']=_[_0xd6d6('0x43')](_0x3cc7cd[_0xd6d6('0x44')],_0x3cc7cd['query']);_0x160064['attributes']=_['intersection'](_0x3cc7cd['model'],qs['fields'](_0x2e5543[_0xd6d6('0x41')]['fields']));_0x160064[_0xd6d6('0x45')]=_0x160064['attributes'][_0xd6d6('0x47')]?_0x160064[_0xd6d6('0x45')]:_0x3cc7cd[_0xd6d6('0x44')];_0x160064[_0xd6d6('0x49')]=qs[_0xd6d6('0x4a')](_0x2e5543[_0xd6d6('0x41')][_0xd6d6('0x4a')]);_0x160064[_0xd6d6('0x4c')]=qs[_0xd6d6('0x4b')](_[_0xd6d6('0xb5')](_0x2e5543['query'],_0x3cc7cd[_0xd6d6('0x4b')]));if(_0x2e5543[_0xd6d6('0x41')]['filter']){_0x160064[_0xd6d6('0x4c')]=_[_0xd6d6('0x50')](_0x160064[_0xd6d6('0x4c')],{'$or':_[_0xd6d6('0x34')](_0x160064[_0xd6d6('0x45')],function(_0x5ea025){var _0x1272a6={};_0x1272a6[_0x5ea025]={'$like':'%'+_0x2e5543[_0xd6d6('0x41')][_0xd6d6('0x32')]+'%'};return _0x1272a6;})});}_0x160064=_[_0xd6d6('0x50')]({},_0x160064,_0x2e5543[_0xd6d6('0x51')]);return _0x5bd656['getGroups'](_0x160064);}})[_0xd6d6('0x1a')](function(_0x5a9146){if(_0x5a9146){_0x25b371=_0x5a9146[_0xd6d6('0x47')];if(!_0x2e5543[_0xd6d6('0x41')][_0xd6d6('0x48')]('nolimit')){_0x160064[_0xd6d6('0x29')]=qs[_0xd6d6('0x29')](_0x2e5543['query'][_0xd6d6('0x29')]);_0x160064['offset']=qs[_0xd6d6('0x28')](_0x2e5543[_0xd6d6('0x41')][_0xd6d6('0x28')]);}return _0x5bd656[_0xd6d6('0xb7')](_0x160064);}})[_0xd6d6('0x1a')](function(_0x5b0bed){if(_0x5b0bed){return _0x5b0bed?{'count':_0x25b371,'rows':_0x5b0bed}:null;}})[_0xd6d6('0x1a')](respondWithResult(_0x2b343f,null))[_0xd6d6('0x56')](handleError(_0x2b343f,null));};exports[_0xd6d6('0xb8')]=function(_0xb8364f,_0xd95d0a,_0x160035){var _0x476a1c={'raw':!![],'where':{}};var _0x383240={};var _0x5e9279={'count':0x0,'rows':[]};return db['User'][_0xd6d6('0xae')]({'where':{'id':_0xb8364f[_0xd6d6('0x58')]['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0xd95d0a,null))['then'](function(_0x4d7df1){if(_0x4d7df1){_0x383240[_0xd6d6('0x44')]=_[_0xd6d6('0x42')](db['VoiceRecording'][_0xd6d6('0x3d')]);_0x383240[_0xd6d6('0x41')]=_[_0xd6d6('0x42')](_0xb8364f[_0xd6d6('0x41')]);_0x383240[_0xd6d6('0x4b')]=_[_0xd6d6('0x43')](_0x383240['model'],_0x383240[_0xd6d6('0x41')]);_0x476a1c['attributes']=_[_0xd6d6('0x43')](_0x383240[_0xd6d6('0x44')],qs[_0xd6d6('0x46')](_0xb8364f[_0xd6d6('0x41')][_0xd6d6('0x46')]));_0x476a1c[_0xd6d6('0x45')]=_0x476a1c[_0xd6d6('0x45')]['length']?_0x476a1c['attributes']:_0x383240[_0xd6d6('0x44')];if(!_0xb8364f[_0xd6d6('0x41')][_0xd6d6('0x48')](_0xd6d6('0xb3'))){_0x476a1c[_0xd6d6('0x29')]=qs[_0xd6d6('0x29')](_0xb8364f['query'][_0xd6d6('0x29')]);_0x476a1c[_0xd6d6('0x28')]=qs['offset'](_0xb8364f[_0xd6d6('0x41')]['offset']);}_0x476a1c[_0xd6d6('0x49')]=qs[_0xd6d6('0x4a')](_0xb8364f[_0xd6d6('0x41')][_0xd6d6('0x4a')]);_0x476a1c[_0xd6d6('0x4c')]=qs['filters'](_[_0xd6d6('0xb5')](_0xb8364f[_0xd6d6('0x41')],_0x383240[_0xd6d6('0x4b')]));_0x476a1c[_0xd6d6('0x4c')][_0xd6d6('0xb9')]=_0x4d7df1['id'];if(_0xb8364f[_0xd6d6('0x41')][_0xd6d6('0x32')]){_0x476a1c[_0xd6d6('0x4c')]=_[_0xd6d6('0x50')](_0x476a1c[_0xd6d6('0x4c')],{'$or':_[_0xd6d6('0x34')](_0x476a1c[_0xd6d6('0x45')],function(_0x3b56b5){var _0x237483={};_0x237483[_0x3b56b5]={'$like':'%'+_0xb8364f[_0xd6d6('0x41')]['filter']+'%'};return _0x237483;})});}_0x476a1c=_['merge']({},_0x476a1c,_0xb8364f['options']);return db[_0xd6d6('0xba')][_0xd6d6('0x27')]({'where':_0x476a1c['where']})['then'](function(_0x256fc9){_0x5e9279[_0xd6d6('0x27')]=_0x256fc9;if(_0xb8364f[_0xd6d6('0x41')][_0xd6d6('0x52')]){_0x476a1c['include']=[{'all':!![]}];}return db[_0xd6d6('0xba')][_0xd6d6('0x54')](_0x476a1c);})[_0xd6d6('0x1a')](function(_0x43ad2b){_0x5e9279[_0xd6d6('0x55')]=_0x43ad2b;return _0x5e9279;});}})[_0xd6d6('0x1a')](respondWithFilteredResult(_0xd95d0a,_0x476a1c))[_0xd6d6('0x56')](handleError(_0xd95d0a,null));};exports[_0xd6d6('0xbb')]=function(_0xd298fe,_0x1c5b83,_0x17592e){var _0x591e27={};var _0x4ef0dd={};var _0x2a1441;var _0x48f265;return db[_0xd6d6('0x3c')][_0xd6d6('0xae')]({'where':{'id':_0xd298fe[_0xd6d6('0x58')]['id']}})['then'](handleEntityNotFound(_0x1c5b83,null))[_0xd6d6('0x1a')](function(_0x37b622){if(_0x37b622){_0x2a1441=_0x37b622;_0x4ef0dd[_0xd6d6('0x44')]=_[_0xd6d6('0x42')](db[_0xd6d6('0xbc')][_0xd6d6('0x3d')]);_0x4ef0dd[_0xd6d6('0x41')]=_[_0xd6d6('0x42')](_0xd298fe[_0xd6d6('0x41')]);_0x4ef0dd[_0xd6d6('0x4b')]=_[_0xd6d6('0x43')](_0x4ef0dd[_0xd6d6('0x44')],_0x4ef0dd[_0xd6d6('0x41')]);_0x591e27[_0xd6d6('0x45')]=_[_0xd6d6('0x43')](_0x4ef0dd[_0xd6d6('0x44')],qs[_0xd6d6('0x46')](_0xd298fe[_0xd6d6('0x41')][_0xd6d6('0x46')]));_0x591e27[_0xd6d6('0x45')]=_0x591e27[_0xd6d6('0x45')][_0xd6d6('0x47')]?_0x591e27[_0xd6d6('0x45')]:_0x4ef0dd[_0xd6d6('0x44')];_0x591e27[_0xd6d6('0x49')]=qs['sort'](_0xd298fe[_0xd6d6('0x41')][_0xd6d6('0x4a')]);_0x591e27[_0xd6d6('0x4c')]=qs[_0xd6d6('0x4b')](_[_0xd6d6('0xb5')](_0xd298fe[_0xd6d6('0x41')],_0x4ef0dd[_0xd6d6('0x4b')]));if(_0xd298fe[_0xd6d6('0x41')][_0xd6d6('0x32')]){_0x591e27[_0xd6d6('0x4c')]=_['merge'](_0x591e27[_0xd6d6('0x4c')],{'$or':_[_0xd6d6('0x34')](_0x591e27[_0xd6d6('0x45')],function(_0x3c8be4){var _0x1e001e={};_0x1e001e[_0x3c8be4]={'$like':'%'+_0xd298fe[_0xd6d6('0x41')][_0xd6d6('0x32')]+'%'};return _0x1e001e;})});}_0x591e27=_[_0xd6d6('0x50')]({},_0x591e27,_0xd298fe[_0xd6d6('0x51')]);return _0x2a1441[_0xd6d6('0xbb')](_0x591e27);}})[_0xd6d6('0x1a')](function(_0x4912ca){if(_0x4912ca){_0x48f265=_0x4912ca[_0xd6d6('0x47')];if(!_0xd298fe['query'][_0xd6d6('0x48')](_0xd6d6('0xb3'))){_0x591e27[_0xd6d6('0x29')]=qs['limit'](_0xd298fe[_0xd6d6('0x41')][_0xd6d6('0x29')]);_0x591e27[_0xd6d6('0x28')]=qs['offset'](_0xd298fe['query']['offset']);}return _0x2a1441[_0xd6d6('0xbb')](_0x591e27);}})[_0xd6d6('0x1a')](function(_0x37f30b){if(_0x37f30b){return _0x37f30b?{'count':_0x48f265,'rows':_0x37f30b}:null;}})[_0xd6d6('0x1a')](respondWithResult(_0x1c5b83,null))[_0xd6d6('0x56')](handleError(_0x1c5b83,null));};exports[_0xd6d6('0xbd')]=function(_0x58e409,_0x78cd40,_0x1df7a9){var _0x1ed9a2={};var _0x27a6d0={};var _0x539751;var _0xec6853;return db[_0xd6d6('0x3c')][_0xd6d6('0xae')]({'where':{'id':_0x58e409[_0xd6d6('0x58')]['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0x78cd40,null))['then'](function(_0x4ab0ca){if(_0x4ab0ca){_0x539751=_0x4ab0ca;_0x27a6d0['model']=_[_0xd6d6('0x42')](db[_0xd6d6('0xbe')][_0xd6d6('0x3d')]);_0x27a6d0[_0xd6d6('0x41')]=_['keys'](_0x58e409[_0xd6d6('0x41')]);_0x27a6d0['filters']=_[_0xd6d6('0x43')](_0x27a6d0[_0xd6d6('0x44')],_0x27a6d0[_0xd6d6('0x41')]);_0x1ed9a2[_0xd6d6('0x45')]=_[_0xd6d6('0x43')](_0x27a6d0['model'],qs[_0xd6d6('0x46')](_0x58e409[_0xd6d6('0x41')][_0xd6d6('0x46')]));_0x1ed9a2[_0xd6d6('0x45')]=_0x1ed9a2[_0xd6d6('0x45')][_0xd6d6('0x47')]?_0x1ed9a2[_0xd6d6('0x45')]:_0x27a6d0['model'];_0x1ed9a2[_0xd6d6('0x49')]=qs[_0xd6d6('0x4a')](_0x58e409['query'][_0xd6d6('0x4a')]);_0x1ed9a2[_0xd6d6('0x4c')]=qs[_0xd6d6('0x4b')](_[_0xd6d6('0xb5')](_0x58e409['query'],_0x27a6d0[_0xd6d6('0x4b')]));if(_0x58e409[_0xd6d6('0x41')][_0xd6d6('0x32')]){_0x1ed9a2['where']=_[_0xd6d6('0x50')](_0x1ed9a2[_0xd6d6('0x4c')],{'$or':_[_0xd6d6('0x34')](_0x1ed9a2[_0xd6d6('0x45')],function(_0x459bfb){var _0x10157c={};_0x10157c[_0x459bfb]={'$like':'%'+_0x58e409[_0xd6d6('0x41')][_0xd6d6('0x32')]+'%'};return _0x10157c;})});}_0x1ed9a2=_[_0xd6d6('0x50')]({},_0x1ed9a2,_0x58e409[_0xd6d6('0x51')]);return _0x539751['getOpenchannelInteractions'](_0x1ed9a2);}})[_0xd6d6('0x1a')](function(_0x5119be){if(_0x5119be){_0xec6853=_0x5119be['length'];if(!_0x58e409['query'][_0xd6d6('0x48')](_0xd6d6('0xb3'))){_0x1ed9a2[_0xd6d6('0x29')]=qs[_0xd6d6('0x29')](_0x58e409[_0xd6d6('0x41')][_0xd6d6('0x29')]);_0x1ed9a2[_0xd6d6('0x28')]=qs[_0xd6d6('0x28')](_0x58e409['query'][_0xd6d6('0x28')]);}return _0x539751[_0xd6d6('0xbd')](_0x1ed9a2);}})[_0xd6d6('0x1a')](function(_0x205039){if(_0x205039){return _0x205039?{'count':_0xec6853,'rows':_0x205039}:null;}})[_0xd6d6('0x1a')](respondWithResult(_0x78cd40,null))[_0xd6d6('0x56')](handleError(_0x78cd40,null));};exports[_0xd6d6('0xbf')]=function(_0x1e1e56,_0xb961c,_0x51a48b){var _0x5ea544={'raw':!![],'where':{}};var _0x4854b7={};var _0x384cb2={'count':0x0,'rows':[]};return db['User'][_0xd6d6('0xae')]({'where':{'id':_0x1e1e56[_0xd6d6('0x58')]['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0xb961c,null))[_0xd6d6('0x1a')](function(_0x26336c){if(_0x26336c){_0x4854b7[_0xd6d6('0x44')]=_[_0xd6d6('0x42')](db[_0xd6d6('0xc0')]['rawAttributes']);_0x4854b7[_0xd6d6('0x41')]=_[_0xd6d6('0x42')](_0x1e1e56[_0xd6d6('0x41')]);_0x4854b7[_0xd6d6('0x4b')]=_[_0xd6d6('0x43')](_0x4854b7[_0xd6d6('0x44')],_0x4854b7[_0xd6d6('0x41')]);_0x5ea544['attributes']=_[_0xd6d6('0x43')](_0x4854b7[_0xd6d6('0x44')],qs['fields'](_0x1e1e56[_0xd6d6('0x41')]['fields']));_0x5ea544[_0xd6d6('0x45')]=_0x5ea544[_0xd6d6('0x45')][_0xd6d6('0x47')]?_0x5ea544['attributes']:_0x4854b7[_0xd6d6('0x44')];if(!_0x1e1e56[_0xd6d6('0x41')]['hasOwnProperty'](_0xd6d6('0xb3'))){_0x5ea544[_0xd6d6('0x29')]=qs[_0xd6d6('0x29')](_0x1e1e56['query'][_0xd6d6('0x29')]);_0x5ea544[_0xd6d6('0x28')]=qs['offset'](_0x1e1e56[_0xd6d6('0x41')][_0xd6d6('0x28')]);}_0x5ea544[_0xd6d6('0x49')]=qs['sort'](_0x1e1e56[_0xd6d6('0x41')]['sort']);_0x5ea544['where']=qs[_0xd6d6('0x4b')](_[_0xd6d6('0xb5')](_0x1e1e56[_0xd6d6('0x41')],_0x4854b7[_0xd6d6('0x4b')]));_0x5ea544[_0xd6d6('0x4c')][_0xd6d6('0xb9')]=_0x26336c['id'];if(_0x1e1e56[_0xd6d6('0x41')][_0xd6d6('0x32')]){_0x5ea544[_0xd6d6('0x4c')]=_[_0xd6d6('0x50')](_0x5ea544['where'],{'$or':_[_0xd6d6('0x34')](_0x5ea544[_0xd6d6('0x45')],function(_0x14d09e){var _0x196f96={};_0x196f96[_0x14d09e]={'$like':'%'+_0x1e1e56[_0xd6d6('0x41')][_0xd6d6('0x32')]+'%'};return _0x196f96;})});}_0x5ea544=_[_0xd6d6('0x50')]({},_0x5ea544,_0x1e1e56[_0xd6d6('0x51')]);return db[_0xd6d6('0xc0')][_0xd6d6('0x27')]({'where':_0x5ea544[_0xd6d6('0x4c')]})[_0xd6d6('0x1a')](function(_0x2feca9){_0x384cb2[_0xd6d6('0x27')]=_0x2feca9;if(_0x1e1e56['query']['includeAll']){_0x5ea544[_0xd6d6('0x53')]=[{'all':!![]}];}return db['MailInteraction'][_0xd6d6('0x54')](_0x5ea544);})[_0xd6d6('0x1a')](function(_0x3cb271){_0x384cb2['rows']=_0x3cb271;return _0x384cb2;});}})[_0xd6d6('0x1a')](respondWithFilteredResult(_0xb961c,_0x5ea544))[_0xd6d6('0x56')](handleError(_0xb961c,null));};exports['getSmsInteractions']=function(_0x2d2e91,_0x343773,_0x32598c){var _0x1454f4={};var _0x4edb64={};var _0x2c495a;var _0x332cd3;return db['User'][_0xd6d6('0xae')]({'where':{'id':_0x2d2e91[_0xd6d6('0x58')]['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0x343773,null))['then'](function(_0x36bb39){if(_0x36bb39){_0x2c495a=_0x36bb39;_0x4edb64[_0xd6d6('0x44')]=_[_0xd6d6('0x42')](db['SmsInteraction'][_0xd6d6('0x3d')]);_0x4edb64[_0xd6d6('0x41')]=_[_0xd6d6('0x42')](_0x2d2e91[_0xd6d6('0x41')]);_0x4edb64[_0xd6d6('0x4b')]=_[_0xd6d6('0x43')](_0x4edb64[_0xd6d6('0x44')],_0x4edb64[_0xd6d6('0x41')]);_0x1454f4[_0xd6d6('0x45')]=_['intersection'](_0x4edb64[_0xd6d6('0x44')],qs['fields'](_0x2d2e91[_0xd6d6('0x41')][_0xd6d6('0x46')]));_0x1454f4[_0xd6d6('0x45')]=_0x1454f4[_0xd6d6('0x45')]['length']?_0x1454f4[_0xd6d6('0x45')]:_0x4edb64['model'];_0x1454f4[_0xd6d6('0x49')]=qs['sort'](_0x2d2e91[_0xd6d6('0x41')][_0xd6d6('0x4a')]);_0x1454f4[_0xd6d6('0x4c')]=qs[_0xd6d6('0x4b')](_[_0xd6d6('0xb5')](_0x2d2e91[_0xd6d6('0x41')],_0x4edb64['filters']));if(_0x2d2e91[_0xd6d6('0x41')][_0xd6d6('0x32')]){_0x1454f4['where']=_['merge'](_0x1454f4['where'],{'$or':_['map'](_0x1454f4[_0xd6d6('0x45')],function(_0x2778c9){var _0x490695={};_0x490695[_0x2778c9]={'$like':'%'+_0x2d2e91['query'][_0xd6d6('0x32')]+'%'};return _0x490695;})});}_0x1454f4=_[_0xd6d6('0x50')]({},_0x1454f4,_0x2d2e91[_0xd6d6('0x51')]);return _0x2c495a[_0xd6d6('0xc1')](_0x1454f4);}})[_0xd6d6('0x1a')](function(_0x10966d){if(_0x10966d){_0x332cd3=_0x10966d[_0xd6d6('0x47')];if(!_0x2d2e91[_0xd6d6('0x41')][_0xd6d6('0x48')](_0xd6d6('0xb3'))){_0x1454f4[_0xd6d6('0x29')]=qs[_0xd6d6('0x29')](_0x2d2e91[_0xd6d6('0x41')][_0xd6d6('0x29')]);_0x1454f4['offset']=qs[_0xd6d6('0x28')](_0x2d2e91[_0xd6d6('0x41')]['offset']);}return _0x2c495a[_0xd6d6('0xc1')](_0x1454f4);}})['then'](function(_0x143386){if(_0x143386){return _0x143386?{'count':_0x332cd3,'rows':_0x143386}:null;}})[_0xd6d6('0x1a')](respondWithResult(_0x343773,null))['catch'](handleError(_0x343773,null));};exports[_0xd6d6('0xc2')]=function(_0x4c6e46,_0x524ee3,_0x272acf){var _0xed8bc2={};var _0x5e5b1b={};var _0x1c78b1;var _0x4f0090;return db[_0xd6d6('0x3c')][_0xd6d6('0xae')]({'where':{'id':_0x4c6e46['params']['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0x524ee3,null))['then'](function(_0x27c6ca){if(_0x27c6ca){_0x1c78b1=_0x27c6ca;_0x5e5b1b[_0xd6d6('0x44')]=_[_0xd6d6('0x42')](db[_0xd6d6('0xc3')][_0xd6d6('0x3d')]);_0x5e5b1b[_0xd6d6('0x41')]=_[_0xd6d6('0x42')](_0x4c6e46[_0xd6d6('0x41')]);_0x5e5b1b[_0xd6d6('0x4b')]=_['intersection'](_0x5e5b1b['model'],_0x5e5b1b[_0xd6d6('0x41')]);_0xed8bc2[_0xd6d6('0x45')]=_[_0xd6d6('0x43')](_0x5e5b1b['model'],qs[_0xd6d6('0x46')](_0x4c6e46[_0xd6d6('0x41')][_0xd6d6('0x46')]));_0xed8bc2[_0xd6d6('0x45')]=_0xed8bc2[_0xd6d6('0x45')][_0xd6d6('0x47')]?_0xed8bc2[_0xd6d6('0x45')]:_0x5e5b1b[_0xd6d6('0x44')];_0xed8bc2[_0xd6d6('0x49')]=qs[_0xd6d6('0x4a')](_0x4c6e46[_0xd6d6('0x41')][_0xd6d6('0x4a')]);_0xed8bc2[_0xd6d6('0x4c')]=qs[_0xd6d6('0x4b')](_[_0xd6d6('0xb5')](_0x4c6e46[_0xd6d6('0x41')],_0x5e5b1b[_0xd6d6('0x4b')]));if(_0x4c6e46['query'][_0xd6d6('0x32')]){_0xed8bc2[_0xd6d6('0x4c')]=_[_0xd6d6('0x50')](_0xed8bc2['where'],{'$or':_[_0xd6d6('0x34')](_0xed8bc2[_0xd6d6('0x45')],function(_0x18404a){var _0x36b81a={};_0x36b81a[_0x18404a]={'$like':'%'+_0x4c6e46[_0xd6d6('0x41')][_0xd6d6('0x32')]+'%'};return _0x36b81a;})});}_0xed8bc2=_[_0xd6d6('0x50')]({},_0xed8bc2,_0x4c6e46[_0xd6d6('0x51')]);return _0x1c78b1[_0xd6d6('0xc2')](_0xed8bc2);}})[_0xd6d6('0x1a')](function(_0x301add){if(_0x301add){_0x4f0090=_0x301add[_0xd6d6('0x47')];if(!_0x4c6e46[_0xd6d6('0x41')]['hasOwnProperty'](_0xd6d6('0xb3'))){_0xed8bc2['limit']=qs[_0xd6d6('0x29')](_0x4c6e46['query'][_0xd6d6('0x29')]);_0xed8bc2[_0xd6d6('0x28')]=qs[_0xd6d6('0x28')](_0x4c6e46[_0xd6d6('0x41')][_0xd6d6('0x28')]);}return _0x1c78b1[_0xd6d6('0xc2')](_0xed8bc2);}})['then'](function(_0x923210){if(_0x923210){return _0x923210?{'count':_0x4f0090,'rows':_0x923210}:null;}})[_0xd6d6('0x1a')](respondWithResult(_0x524ee3,null))[_0xd6d6('0x56')](handleError(_0x524ee3,null));};exports[_0xd6d6('0xc4')]=function(_0x12aa38,_0xd44283,_0x658932){var _0x23223e;var _0x375667;var _0x56f06e;return db[_0xd6d6('0x3c')][_0xd6d6('0x59')]({'where':{'id':_0x12aa38['params']['id'],'role':_0xd6d6('0x2f')},'attributes':['id',_0xd6d6('0x38'),_0xd6d6('0xc5'),_0xd6d6('0xc6'),_0xd6d6('0x37'),_0xd6d6('0x6b'),_0xd6d6('0x8f')]})[_0xd6d6('0x1a')](handleEntityNotFound(_0xd44283,null))[_0xd6d6('0x1a')](function(_0x251646){if(_0x251646){_0x23223e=_0x251646;if(_0x12aa38[_0xd6d6('0x5b')][_0xd6d6('0x91')]){_0x56f06e=util['format']('LOCAL/%s@from-sip/n',_0x23223e[_0x12aa38[_0xd6d6('0x5b')][_0xd6d6('0x91')]]);}else if(_0x12aa38[_0xd6d6('0x5b')][_0xd6d6('0xc7')]){_0x56f06e=util[_0xd6d6('0x68')](_0xd6d6('0xc8'),_0x12aa38['body'][_0xd6d6('0xc7')]);}else{_0x56f06e=util['format'](_0xd6d6('0xc8'),_0x23223e[_0xd6d6('0x38')]);}socket['to'](util['format'](_0xd6d6('0xc9'),_0x23223e[_0xd6d6('0x38')]))['emit'](_0xd6d6('0xca'),{'ip':_0x12aa38['headers'][_0xd6d6('0xcb')]||_0x12aa38['connection']['remoteAddress']||_0x12aa38[_0xd6d6('0xcc')][_0xd6d6('0xcd')]||_0x12aa38[_0xd6d6('0xce')][_0xd6d6('0xcc')][_0xd6d6('0xcd')]});return db[_0xd6d6('0x9e')]['destroy']({'where':{'membername':_0x23223e[_0xd6d6('0x38')]},'individualHooks':!![]});}})[_0xd6d6('0x1a')](function(_0x1c0847){if(_0x23223e){return _0x23223e[_0xd6d6('0xcf')]({'raw':!![]});}})[_0xd6d6('0x1a')](function(_0x112ef3){var _0x149dd9=[];if(_0x112ef3){_0x375667=_0x112ef3;if(_0x375667[_0xd6d6('0x47')]){for(var _0x5539e4=0x0;_0x5539e4<_0x375667[_0xd6d6('0x47')];_0x5539e4++){_0x149dd9[_0xd6d6('0xd0')]({'membername':_0x23223e[_0xd6d6('0x38')],'UserId':_0x23223e['id'],'queue_name':_0x375667[_0x5539e4][_0xd6d6('0x38')],'VoiceQueueId':_0x375667[_0x5539e4]['id'],'interface':_0x56f06e,'paused':_0x23223e[_0xd6d6('0x8f')]||![],'penalty':_0x375667[_0x5539e4]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x149dd9,function(_0x32c179){return db[_0xd6d6('0x9e')][_0xd6d6('0x9f')](_0x32c179);});}}})['then'](function(){return db['MemberReport'][_0xd6d6('0x54')]({'where':{'membername':_0x23223e['name'],'exitAt':null}});})['then'](function(_0x10941d){var _0x8c579a=[];_0x10941d[_0xd6d6('0xd1')](function(_0x37f773){_0x8c579a['push'](_0x37f773[_0xd6d6('0x2b')]({'exitAt':moment()[_0xd6d6('0x68')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xd6d6('0xd2')](_0x8c579a);})[_0xd6d6('0x1a')](function(){var _0x3062f8=[];var _0x4724e1=[];var _0x38db48=utils[_0xd6d6('0xd3')]();var _0x450e5={'membername':_0x23223e[_0xd6d6('0x38')],'interface':_0x56f06e,'enterAt':moment()[_0xd6d6('0x68')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x23223e[_0xd6d6('0x37')],'internal':_0x23223e[_0xd6d6('0x6b')]};_0x38db48[_0xd6d6('0xd1')](function(_0x23e244){_0x3062f8[_0xd6d6('0xd0')](_['merge']({'channel':_0x23e244,'type':_0xd6d6('0xd4'),'data1':_0x12aa38['body'][_0xd6d6('0xd5')],'data2':_0x56f06e},_0x450e5));if(_0x23223e['loginInPause']){_0x4724e1[_0xd6d6('0xd0')](_['merge']({'channel':_0x23e244,'type':_0xd6d6('0xd6'),'data1':_0xd6d6('0xd7')},_0x450e5));}});return db[_0xd6d6('0xd8')][_0xd6d6('0x5a')](_0x3062f8[_0xd6d6('0xd9')](_0x4724e1),{'individualHooks':!![]});})[_0xd6d6('0x1a')](function(){return _0x23223e[_0xd6d6('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xd6d6('0x68')](_0xd6d6('0xda')),'voicePause':_0x23223e['loginInPause']||![],'mailPause':_0x23223e['loginInPause']||![],'chatPause':_0x23223e['loginInPause']||![],'faxPause':_0x23223e[_0xd6d6('0x8f')]||![],'smsPause':_0x23223e['loginInPause']||![],'openchannelPause':_0x23223e[_0xd6d6('0x8f')]||![],'pauseType':_0x23223e['loginInPause']?'LOGININPAUSE':null,'interface':_0x56f06e,'lastPauseAt':moment()[_0xd6d6('0x68')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xd6d6('0x1a')](respondWithResult(_0xd44283,null))[_0xd6d6('0x56')](handleError(_0xd44283,null));};exports[_0xd6d6('0xdb')]=function(_0x1f8cf6,_0xd514c0,_0x516147){var _0xa63c9;return db['User'][_0xd6d6('0x59')]({'where':{'id':_0x1f8cf6[_0xd6d6('0x58')]['id'],'role':_0xd6d6('0x2f')},'attributes':['id',_0xd6d6('0x38'),'role']})[_0xd6d6('0x1a')](handleEntityNotFound(_0xd514c0,null))[_0xd6d6('0x1a')](function(_0x523052){if(_0x523052){_0xa63c9=_0x523052;return db[_0xd6d6('0x9e')]['destroy']({'where':{'membername':_0xa63c9[_0xd6d6('0x38')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0xd6d6('0x54')]({'where':{'membername':_0xa63c9[_0xd6d6('0x38')],'exitAt':null}});})[_0xd6d6('0x1a')](function(_0x225002){var _0x391926=[];_0x225002['forEach'](function(_0x48af9c){_0x391926[_0xd6d6('0xd0')](_0x48af9c[_0xd6d6('0x2b')]({'exitAt':moment()[_0xd6d6('0x68')](_0xd6d6('0xda'))}));});return BPromise[_0xd6d6('0xd2')](_0x391926);})[_0xd6d6('0x1a')](function(){return _0xa63c9['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0xd6d6('0x1a')](respondWithResult(_0xd514c0,null))[_0xd6d6('0x56')](handleError(_0xd514c0,null));};exports[_0xd6d6('0xdc')]=function(_0x2cb795,_0x29e121,_0x2038a9){var _0x5b4223;return db[_0xd6d6('0x9e')]['update']({'paused':0x1},{'where':{'UserId':_0x2cb795['params']['id']},'individualHooks':!![]})[_0xd6d6('0x1a')](function(){return db['User'][_0xd6d6('0x59')]({'where':{'id':_0x2cb795[_0xd6d6('0x58')]['id'],'role':_0xd6d6('0x2f')},'attributes':['id',_0xd6d6('0x38'),_0xd6d6('0x37'),_0xd6d6('0x6b'),'interface']});})[_0xd6d6('0x1a')](handleEntityNotFound(_0x29e121,null))[_0xd6d6('0x1a')](function(_0x46c663){if(_0x46c663){_0x5b4223=_0x46c663;return respondWithRpcPromise(_0xd6d6('0xdd'),'pause',{'id':_0x5b4223['id'],'name':_0x5b4223['name'],'pause':!![]});}})['then'](function(){if(_0x5b4223){return db['MemberReport'][_0xd6d6('0x54')]({'where':{'membername':_0x5b4223[_0xd6d6('0x38')],'type':_0xd6d6('0xd6'),'exitAt':null}});}})['then'](function(_0x5c245b){if(_0x5c245b['length']){var _0x2f4851=moment()[_0xd6d6('0x68')](_0xd6d6('0xda'));for(var _0x3fd1d4=0x0,_0x531976=_0x5c245b[_0xd6d6('0x47')];_0x3fd1d4<_0x531976;_0x3fd1d4++){_0x5c245b[_0x3fd1d4]['updateAttributes']({'exitAt':_0x2f4851});}}})[_0xd6d6('0x1a')](function(){var _0x3c8da1=[];var _0x5a9734=utils['getChannels']();_0x5a9734[_0xd6d6('0xd1')](function(_0x114d7f){_0x3c8da1[_0xd6d6('0xd0')]({'channel':_0x114d7f,'membername':_0x5b4223[_0xd6d6('0x38')],'interface':_[_0xd6d6('0x66')](_0x5b4223[_0xd6d6('0x91')])?util[_0xd6d6('0x68')](_0xd6d6('0xc8'),_0x5b4223['name']):_0x5b4223['interface'],'type':_0xd6d6('0xd6'),'enterAt':moment()['format'](_0xd6d6('0xda')),'data1':_0x2cb795[_0xd6d6('0x5b')][_0xd6d6('0xde')]||_0xd6d6('0xdf'),'role':_0x5b4223[_0xd6d6('0x37')],'internal':_0x5b4223['internal']});});return db[_0xd6d6('0xd8')][_0xd6d6('0x5a')](_0x3c8da1,{'individualHooks':!![]});})['then'](function(){return _0x5b4223[_0xd6d6('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x2cb795[_0xd6d6('0x5b')][_0xd6d6('0xde')]||_0xd6d6('0xdf'),'lastPauseAt':moment()['format'](_0xd6d6('0xda'))});})[_0xd6d6('0x1a')](respondWithResult(_0x29e121,null))['catch'](handleError(_0x29e121,null));};exports[_0xd6d6('0xe0')]=function(_0x3ce7d3,_0x2ee8cf,_0x2f3bed){var _0x8cf5f5;return db[_0xd6d6('0x3c')]['find']({'where':{'id':_0x3ce7d3['params']['id']},'attributes':['id',_0xd6d6('0x38'),_0xd6d6('0x37'),_0xd6d6('0x90'),_0xd6d6('0xe1'),_0xd6d6('0xe2'),'faxPause',_0xd6d6('0xe3'),'smsPause','pauseType',_0xd6d6('0xe4')]})[_0xd6d6('0x1a')](handleEntityNotFound(_0x2ee8cf,null))[_0xd6d6('0x1a')](function(_0x834221){if(_0x834221){_0x8cf5f5=_0x834221;if(_0x3ce7d3[_0xd6d6('0x5b')][_0xd6d6('0x93')]&&!utils['isValidChannel'](_0x3ce7d3[_0xd6d6('0x5b')][_0xd6d6('0x93')])){throw new db['Sequelize'][(_0xd6d6('0x8a'))](_0xd6d6('0xa1'));}switch(_0x3ce7d3[_0xd6d6('0x5b')]['channel']){case _0xd6d6('0x9b'):return respondWithRpcPromise(_0xd6d6('0xdd'),_0xd6d6('0xe0'),{'id':_0x8cf5f5['id'],'name':_0x8cf5f5[_0xd6d6('0x38')],'pause':![]})['then'](function(){return db[_0xd6d6('0x9e')][_0xd6d6('0x2b')]({'paused':0x0},{'where':{'UserId':_0x8cf5f5['id']},'individualHooks':!![]});})[_0xd6d6('0x1a')](function(){return db[_0xd6d6('0xd8')][_0xd6d6('0x59')]({'where':{'channel':_0x3ce7d3[_0xd6d6('0x5b')]['channel'],'membername':_0x8cf5f5[_0xd6d6('0x38')],'type':_0xd6d6('0xd6'),'exitAt':null}});})[_0xd6d6('0x1a')](function(_0x4260e8){if(_0x4260e8){return _0x4260e8[_0xd6d6('0x2b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xd6d6('0x1a')](function(){return _0x8cf5f5[_0xd6d6('0x2b')]({'voicePause':![]});});case _0xd6d6('0xe5'):case _0xd6d6('0xe6'):case'fax':case _0xd6d6('0xe7'):case'openchannel':return db[_0xd6d6('0xd8')]['find']({'where':{'channel':_0x3ce7d3[_0xd6d6('0x5b')][_0xd6d6('0x93')],'membername':_0x8cf5f5['name'],'type':_0xd6d6('0xd6'),'exitAt':null}})['then'](function(_0x52a873){if(_0x52a873){return _0x52a873[_0xd6d6('0x2b')]({'exitAt':moment()[_0xd6d6('0x68')](_0xd6d6('0xda')),'data2':_0xd6d6('0xe8')},{'individualHooks':!![]});}return null;})[_0xd6d6('0x1a')](function(){var _0xba988e={};_[_0xd6d6('0x2a')](_0xba988e,util['format']('%s%s',_0x3ce7d3['body'][_0xd6d6('0x93')],_0xd6d6('0xe9')),![]);return _0x8cf5f5[_0xd6d6('0x2b')](_0xba988e);});default:return respondWithRpcPromise(_0xd6d6('0xdd'),'unpause',{'id':_0x8cf5f5['id'],'name':_0x8cf5f5[_0xd6d6('0x38')],'pause':![]})['then'](function(){return db[_0xd6d6('0x9e')]['update']({'paused':0x0},{'where':{'UserId':_0x8cf5f5['id']}});})[_0xd6d6('0x1a')](function(){return db[_0xd6d6('0xd8')]['findAll']({'where':{'membername':_0x8cf5f5[_0xd6d6('0x38')],'type':_0xd6d6('0xd6'),'exitAt':null}});})[_0xd6d6('0x1a')](function(_0x30ffca){var _0x29cf0c=[];_0x30ffca[_0xd6d6('0xd1')](function(_0x449530){_0x29cf0c[_0xd6d6('0xd0')](_0x449530[_0xd6d6('0x2b')]({'exitAt':moment()[_0xd6d6('0x68')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xd6d6('0xe8')}));});return BPromise['all'](_0x29cf0c);})[_0xd6d6('0x1a')](function(){return _0x8cf5f5['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xd6d6('0x1a')](respondWithResult(_0x2ee8cf,null))[_0xd6d6('0x56')](handleError(_0x2ee8cf,null));};exports['getTeams']=function(_0x556218,_0xa304dc,_0x23c546){var _0xe46172={};var _0x1dc5ce={};var _0x2bea23;var _0x3058c3;return db[_0xd6d6('0x3c')][_0xd6d6('0xae')]({'where':{'id':_0x556218[_0xd6d6('0x58')]['id']}})['then'](handleEntityNotFound(_0xa304dc,null))['then'](function(_0x5d6c10){if(_0x5d6c10){_0x2bea23=_0x5d6c10;_0x1dc5ce[_0xd6d6('0x44')]=_[_0xd6d6('0x42')](db['Team']['rawAttributes']);_0x1dc5ce['query']=_['keys'](_0x556218[_0xd6d6('0x41')]);_0x1dc5ce['filters']=_['intersection'](_0x1dc5ce[_0xd6d6('0x44')],_0x1dc5ce[_0xd6d6('0x41')]);_0xe46172[_0xd6d6('0x45')]=_[_0xd6d6('0x43')](_0x1dc5ce['model'],qs['fields'](_0x556218['query'][_0xd6d6('0x46')]));_0xe46172['attributes']=_0xe46172[_0xd6d6('0x45')][_0xd6d6('0x47')]?_0xe46172[_0xd6d6('0x45')]:_0x1dc5ce[_0xd6d6('0x44')];_0xe46172[_0xd6d6('0x49')]=qs[_0xd6d6('0x4a')](_0x556218[_0xd6d6('0x41')][_0xd6d6('0x4a')]);_0xe46172[_0xd6d6('0x4c')]=qs['filters'](_[_0xd6d6('0xb5')](_0x556218['query'],_0x1dc5ce[_0xd6d6('0x4b')]));if(_0x556218['query'][_0xd6d6('0x32')]){_0xe46172[_0xd6d6('0x4c')]=_[_0xd6d6('0x50')](_0xe46172[_0xd6d6('0x4c')],{'$or':_[_0xd6d6('0x34')](_0xe46172[_0xd6d6('0x45')],function(_0x4d5b9b){var _0x3f4448={};_0x3f4448[_0x4d5b9b]={'$like':'%'+_0x556218[_0xd6d6('0x41')][_0xd6d6('0x32')]+'%'};return _0x3f4448;})});}_0xe46172=_[_0xd6d6('0x50')]({},_0xe46172,_0x556218[_0xd6d6('0x51')]);return _0x2bea23[_0xd6d6('0xea')](_0xe46172);}})['then'](function(_0x13a7d2){if(_0x13a7d2){_0x3058c3=_0x13a7d2[_0xd6d6('0x47')];if(!_0x556218[_0xd6d6('0x41')]['hasOwnProperty']('nolimit')){_0xe46172[_0xd6d6('0x29')]=qs['limit'](_0x556218[_0xd6d6('0x41')]['limit']);_0xe46172[_0xd6d6('0x28')]=qs[_0xd6d6('0x28')](_0x556218['query'][_0xd6d6('0x28')]);}return _0x2bea23['getTeams'](_0xe46172);}})[_0xd6d6('0x1a')](function(_0x48b285){if(_0x48b285){return _0x48b285?{'count':_0x3058c3,'rows':_0x48b285}:null;}})[_0xd6d6('0x1a')](respondWithResult(_0xa304dc,null))[_0xd6d6('0x56')](handleError(_0xa304dc,null));};exports[_0xd6d6('0xeb')]=function(_0x3e48c8,_0x2f4fde,_0x19d26f){return db['User']['find']({'where':{'id':_0x3e48c8[_0xd6d6('0x58')]['id']}})['then'](handleEntityNotFound(_0x2f4fde,null))[_0xd6d6('0x1a')](function(_0x794314){if(_0x794314){return _0x794314[_0xd6d6('0xeb')](_0x3e48c8['body'][_0xd6d6('0x5e')],_[_0xd6d6('0x5f')](_0x3e48c8[_0xd6d6('0x5b')],[_0xd6d6('0x5e'),'id'])||{});}})[_0xd6d6('0x1a')](respondWithResult(_0x2f4fde,null))['catch'](handleError(_0x2f4fde,null));};exports[_0xd6d6('0xec')]=function(_0x3777a9,_0x117df5,_0x186fca){var _0x22ddf6;return db[_0xd6d6('0x3c')][_0xd6d6('0x59')]({'where':{'id':_0x3777a9[_0xd6d6('0x58')]['id']}})['then'](handleEntityNotFound(_0x117df5,null))[_0xd6d6('0x1a')](function(_0x5f0509){if(_0x5f0509){return _0x5f0509[_0xd6d6('0xec')](_0x3777a9[_0xd6d6('0x41')][_0xd6d6('0x5e')]);}})[_0xd6d6('0x1a')](respondWithStatusCode(_0x117df5,null))['catch'](handleError(_0x117df5,null));};exports[_0xd6d6('0xed')]=function(_0x4eec65,_0x269854,_0x240188){var _0x543cba={};var _0x12e4d8={};var _0x5ba33e;var _0x237092;return db[_0xd6d6('0x3c')][_0xd6d6('0xae')]({'where':{'id':_0x4eec65[_0xd6d6('0x58')]['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0x269854,null))[_0xd6d6('0x1a')](function(_0x2c639b){if(_0x2c639b){_0x5ba33e=_0x2c639b;_0x12e4d8['model']=_[_0xd6d6('0x42')](db[_0xd6d6('0xee')][_0xd6d6('0x3d')]);_0x12e4d8['query']=_['keys'](_0x4eec65[_0xd6d6('0x41')]);_0x12e4d8[_0xd6d6('0x4b')]=_['intersection'](_0x12e4d8[_0xd6d6('0x44')],_0x12e4d8['query']);_0x543cba[_0xd6d6('0x45')]=_[_0xd6d6('0x43')](_0x12e4d8['model'],qs['fields'](_0x4eec65[_0xd6d6('0x41')][_0xd6d6('0x46')]));_0x543cba[_0xd6d6('0x45')]=_0x543cba[_0xd6d6('0x45')]['length']?_0x543cba[_0xd6d6('0x45')]:_0x12e4d8[_0xd6d6('0x44')];_0x543cba[_0xd6d6('0x49')]=qs[_0xd6d6('0x4a')](_0x4eec65[_0xd6d6('0x41')][_0xd6d6('0x4a')]);_0x543cba['where']=qs[_0xd6d6('0x4b')](_['pick'](_0x4eec65['query'],_0x12e4d8[_0xd6d6('0x4b')]));if(_0x4eec65[_0xd6d6('0x41')]['filter']){_0x543cba['where']=_[_0xd6d6('0x50')](_0x543cba['where'],{'$or':_[_0xd6d6('0x34')](_0x543cba['attributes'],function(_0x415511){var _0x29079e={};_0x29079e[_0x415511]={'$like':'%'+_0x4eec65['query'][_0xd6d6('0x32')]+'%'};return _0x29079e;})});}_0x543cba=_[_0xd6d6('0x50')]({},_0x543cba,_0x4eec65[_0xd6d6('0x51')]);return _0x5ba33e['getLists'](_0x543cba);}})[_0xd6d6('0x1a')](function(_0x3088d7){if(_0x3088d7){_0x237092=_0x3088d7[_0xd6d6('0x47')];if(!_0x4eec65[_0xd6d6('0x41')]['hasOwnProperty'](_0xd6d6('0xb3'))){_0x543cba['limit']=qs[_0xd6d6('0x29')](_0x4eec65[_0xd6d6('0x41')][_0xd6d6('0x29')]);_0x543cba[_0xd6d6('0x28')]=qs[_0xd6d6('0x28')](_0x4eec65['query'][_0xd6d6('0x28')]);}return _0x5ba33e[_0xd6d6('0xed')](_0x543cba);}})[_0xd6d6('0x1a')](function(_0x619b5a){if(_0x619b5a){return _0x619b5a?{'count':_0x237092,'rows':_0x619b5a}:null;}})[_0xd6d6('0x1a')](respondWithResult(_0x269854,null))[_0xd6d6('0x56')](handleError(_0x269854,null));};exports['getAgents']=function(_0x146596,_0x57a095,_0x3c47ed){var _0x21214a={};var _0x2130b6={};var _0x4efd81;var _0x2950b4;return db[_0xd6d6('0x3c')][_0xd6d6('0xae')]({'where':{'id':_0x146596[_0xd6d6('0x58')]['id']}})[_0xd6d6('0x1a')](handleEntityNotFound(_0x57a095,null))[_0xd6d6('0x1a')](function(_0x13b884){if(_0x13b884){_0x4efd81=_0x13b884;_0x2130b6[_0xd6d6('0x44')]=_['keys'](db['User']['rawAttributes']);_0x2130b6['query']=_[_0xd6d6('0x42')](_0x146596['query']);_0x2130b6[_0xd6d6('0x4b')]=_[_0xd6d6('0x43')](_0x2130b6[_0xd6d6('0x44')],_0x2130b6[_0xd6d6('0x41')]);_0x21214a[_0xd6d6('0x45')]=_[_0xd6d6('0x43')](_0x2130b6['model'],qs[_0xd6d6('0x46')](_0x146596[_0xd6d6('0x41')]['fields']));_0x21214a[_0xd6d6('0x45')]=_0x21214a['attributes'][_0xd6d6('0x47')]?_0x21214a[_0xd6d6('0x45')]:_0x2130b6[_0xd6d6('0x44')];_0x21214a['order']=qs[_0xd6d6('0x4a')](_0x146596[_0xd6d6('0x41')][_0xd6d6('0x4a')]);_0x21214a['where']=qs[_0xd6d6('0x4b')](_[_0xd6d6('0xb5')](_0x146596[_0xd6d6('0x41')],_0x2130b6[_0xd6d6('0x4b')]));if(_0x146596['query']['filter']){_0x21214a[_0xd6d6('0x4c')]=_[_0xd6d6('0x50')](_0x21214a[_0xd6d6('0x4c')],{'$or':_[_0xd6d6('0x34')](_0x21214a[_0xd6d6('0x45')],function(_0x486d87){var _0xe189cf={};_0xe189cf[_0x486d87]={'$like':'%'+_0x146596[_0xd6d6('0x41')][_0xd6d6('0x32')]+'%'};return _0xe189cf;})});}_0x21214a['model']=db[_0xd6d6('0x3c')];_0x21214a['as']='Agents';_0x21214a=_[_0xd6d6('0x50')]({},_0x21214a,_0x146596[_0xd6d6('0x51')]);return _0x4efd81[_0xd6d6('0xcf')]({'include':[_0x21214a]});}})['then'](function(_0x5c347d){if(_0x5c347d){var _0x43aa48={},_0xa0dece=[],_0x215727=0x0;for(var _0x48fd25=0x0;_0x48fd25<_0x5c347d[_0xd6d6('0x47')];_0x48fd25+=0x1){for(var _0x19961e=0x0,_0x2fb834;_0x19961e<_0x5c347d[_0x48fd25][_0xd6d6('0x81')][_0xd6d6('0x47')];_0x19961e+=0x1){_0x2fb834=_0x5c347d[_0x48fd25][_0xd6d6('0x81')][_0x19961e]['get']({'plain':!![]});_0x43aa48[_0x2fb834['id']]=_0x2fb834;}}_0x43aa48=_['values'](_0x43aa48);for(var _0x172792=qs[_0xd6d6('0x28')](_0x146596['query'][_0xd6d6('0x28')]);_0x172792<_0x43aa48[_0xd6d6('0x47')]&&_0xa0dece[_0xd6d6('0x47')]=_0x165fe9[_0xbb10('0x55')]){throw new Error(_0xbb10('0x56'));}})[_0xbb10('0x11')](function(){if(_0xd9e743){return db['UserVoiceQueueRt'][_0xbb10('0x4e')]({'where':{'membername':_0xd9e743[_0xbb10('0x2a')]},'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0xd9e743){return _0xd9e743[_0xbb10('0x57')]({'raw':!![]});}})[_0xbb10('0x11')](function(_0x27f42f){if(_0xd9e743){if(_0x27f42f){var _0x174395=[];_0x3a9677=_0x27f42f;if(_0x3a9677['length']){for(var _0x387b10=0x0;_0x387b10<_0x3a9677[_0xbb10('0x4f')];_0x387b10++){_0x174395[_0xbb10('0x34')](db[_0xbb10('0x2d')][_0xbb10('0x58')]({'membername':_0xd9e743[_0xbb10('0x2a')],'UserId':_0xd9e743['id'],'queue_name':_0x3a9677[_0x387b10][_0xbb10('0x2a')],'VoiceQueueId':_0x3a9677[_0x387b10]['id'],'interface':_0x1ad2ed,'paused':_0xd9e743[_0xbb10('0x51')]||![],'penalty':_0x3a9677[_0x387b10]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xbb10('0x4c')](_0x174395);}}}})[_0xbb10('0x11')](function(){if(_0xd9e743){return db[_0xbb10('0x2e')]['findAll']({'where':{'membername':_0xd9e743['name'],'exitAt':null}});}})['then'](function(_0x23286d){if(_0xd9e743){if(_0x23286d&&_0x23286d['length']){var _0x4e3d6a=[];_0x23286d[_0xbb10('0x33')](function(_0x3ee56b){_0x4e3d6a[_0xbb10('0x34')](_0x3ee56b[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38'))}));});return BPromise[_0xbb10('0x4c')](_0x4e3d6a);}}})[_0xbb10('0x11')](function(_0x188b97){if(_0xd9e743){var _0x5206e1=[];var _0x318a14=[];var _0x1351eb=utils[_0xbb10('0x32')]();var _0x35b811={'membername':_0xd9e743['name'],'interface':_0x1ad2ed,'enterAt':moment()['format'](_0xbb10('0x38')),'role':_0xd9e743[_0xbb10('0x2b')],'internal':_0xd9e743[_0xbb10('0x3b')]};_0x1351eb[_0xbb10('0x33')](function(_0x5ee705){_0x5206e1[_0xbb10('0x34')](_[_0xbb10('0x59')]({'channel':_0x5ee705,'type':_0xbb10('0x5a'),'data1':_0xbb10('0x5b'),'data2':_0x1ad2ed},_0x35b811));if(_0xd9e743[_0xbb10('0x51')]){_0x318a14['push'](_['merge']({'channel':_0x5ee705,'type':_0xbb10('0x37'),'data1':_0xbb10('0x5c')},_0x35b811));}});return db[_0xbb10('0x2e')]['bulkCreate'](_0x5206e1[_0xbb10('0x5d')](_0x318a14),{'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0xd9e743){return _0xd9e743['update']({'online':!![],'lastLoginAt':moment()['format'](_0xbb10('0x38')),'voicePause':_0xd9e743[_0xbb10('0x51')]||![],'mailPause':_0xd9e743[_0xbb10('0x51')]||![],'chatPause':_0xd9e743['loginInPause']||![],'faxPause':_0xd9e743[_0xbb10('0x51')]||![],'smsPause':_0xd9e743[_0xbb10('0x51')]||![],'openchannelPause':_0xd9e743[_0xbb10('0x51')]||![],'pauseType':_0xd9e743[_0xbb10('0x51')]?_0xbb10('0x5c'):null,'lastPauseAt':moment()[_0xbb10('0x30')](_0xbb10('0x38')),'interface':_0x1ad2ed});}})[_0xbb10('0x11')](function(_0x3e6246){_0x46f462(_0x3e6246);})['catch'](function(_0x3367d4){_0x1b11c0(_0x5cd089[_0xbb10('0x17')](0x1f4,_0x3367d4[_0xbb10('0x1a')]));});});}; \ No newline at end of file +var _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','User','findAll','raw','options','attributes','limit','include','model','map','ShowUser','find','where','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','length','forEach','push','format','YYYY-MM-DD\x20HH:mm:ss','body','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','type','UnpauseUser','channel','Unknown\x20channel','voice','system','mail','chat','fax','sms','set','%s%s','Pause','PAUSE','findOne','destroy','all','LoginUser','mobile','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash'];(function(_0xe94179,_0x5623bb){var _0x5f49d8=function(_0x46f975){while(--_0x46f975){_0xe94179['push'](_0xe94179['shift']());}};_0x5f49d8(++_0x5623bb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')]({'raw':_0x196c0a['options']?_0x196c0a['options'][_0x0d8b('0x1c')]===undefined?!![]:![]:!![],'where':_0x196c0a['options']?_0x196c0a['options']['where']||null:null,'attributes':_0x196c0a[_0x0d8b('0x1d')]?_0x196c0a[_0x0d8b('0x1d')][_0x0d8b('0x1e')]||null:null,'limit':_0x196c0a[_0x0d8b('0x1d')]?_0x196c0a[_0x0d8b('0x1d')][_0x0d8b('0x1f')]||null:null,'include':_0x196c0a[_0x0d8b('0x1d')]?_0x196c0a[_0x0d8b('0x1d')][_0x0d8b('0x20')]?_['map'](_0x196c0a[_0x0d8b('0x1d')][_0x0d8b('0x20')],function(_0x5363e3){return{'model':db[_0x5363e3[_0x0d8b('0x21')]],'as':_0x5363e3['as'],'attributes':_0x5363e3['attributes'],'include':_0x5363e3[_0x0d8b('0x20')]?_[_0x0d8b('0x22')](_0x5363e3[_0x0d8b('0x20')],function(_0x4fe6f9){return{'model':db[_0x4fe6f9['model']],'as':_0x4fe6f9['as'],'attributes':_0x4fe6f9[_0x0d8b('0x1e')],'include':_0x4fe6f9[_0x0d8b('0x20')]?_['map'](_0x4fe6f9[_0x0d8b('0x20')],function(_0x59aa83){return{'model':db[_0x59aa83[_0x0d8b('0x21')]],'as':_0x59aa83['as'],'attributes':_0x59aa83['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xd')](function(_0x48f24f){logger[_0x0d8b('0xe')]('GetUser',_0x196c0a);logger[_0x0d8b('0x11')]('GetUser',_0x196c0a,JSON[_0x0d8b('0x13')](_0x48f24f));_0x24e8ed(_0x48f24f);})[_0x0d8b('0x18')](function(_0x2c058d){logger['error']('GetUser',_0x2c058d['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x2c058d['message']));});});};exports[_0x0d8b('0x23')]=function(_0x54f6f3){var _0x5d05fc=this;return new Promise(function(_0x36017a,_0x1b6920){return db[_0x0d8b('0x1a')][_0x0d8b('0x24')]({'raw':_0x54f6f3[_0x0d8b('0x1d')]?_0x54f6f3[_0x0d8b('0x1d')][_0x0d8b('0x1c')]===undefined?!![]:![]:!![],'where':_0x54f6f3[_0x0d8b('0x1d')]?_0x54f6f3['options'][_0x0d8b('0x25')]||null:null,'attributes':_0x54f6f3[_0x0d8b('0x1d')]?_0x54f6f3['options'][_0x0d8b('0x1e')]||null:null,'include':_0x54f6f3[_0x0d8b('0x1d')]?_0x54f6f3[_0x0d8b('0x1d')]['include']?_[_0x0d8b('0x22')](_0x54f6f3[_0x0d8b('0x1d')][_0x0d8b('0x20')],function(_0x31ceba){return{'model':db[_0x31ceba[_0x0d8b('0x21')]],'as':_0x31ceba['as'],'attributes':_0x31ceba['attributes'],'include':_0x31ceba[_0x0d8b('0x20')]?_[_0x0d8b('0x22')](_0x31ceba['include'],function(_0x1180ac){return{'model':db[_0x1180ac[_0x0d8b('0x21')]],'as':_0x1180ac['as'],'attributes':_0x1180ac[_0x0d8b('0x1e')],'include':_0x1180ac[_0x0d8b('0x20')]?_[_0x0d8b('0x22')](_0x1180ac['include'],function(_0x497a71){return{'model':db[_0x497a71[_0x0d8b('0x21')]],'as':_0x497a71['as'],'attributes':_0x497a71['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xc179bd){logger[_0x0d8b('0xe')](_0x0d8b('0x23'),_0x54f6f3);logger[_0x0d8b('0x11')](_0x0d8b('0x23'),_0x54f6f3,JSON[_0x0d8b('0x13')](_0xc179bd));_0x36017a(_0xc179bd);})['catch'](function(_0x6e5bab){logger[_0x0d8b('0x14')](_0x0d8b('0x23'),_0x6e5bab[_0x0d8b('0x16')],_0x54f6f3);_0x1b6920(_0x5d05fc[_0x0d8b('0x14')](0x1f4,_0x6e5bab[_0x0d8b('0x16')]));});});};exports[_0x0d8b('0x26')]=function(_0x5c980b){var _0x1d06b6=this;return new Promise(function(_0x34acb5,_0x3fa955){var _0x1f196d;return db['User'][_0x0d8b('0x24')]({'where':_0x5c980b['options'][_0x0d8b('0x25')]||{},'attributes':['id',_0x0d8b('0x27'),_0x0d8b('0x28'),_0x0d8b('0x29'),_0x0d8b('0x2a')]})[_0x0d8b('0xd')](function(_0x1ff17d){if(_0x1ff17d){_0x1f196d=_0x1ff17d;return db[_0x0d8b('0x2b')][_0x0d8b('0x2c')]({'paused':0x1},{'where':{'UserId':_0x1f196d['id']},'individualHooks':!![]});}})[_0x0d8b('0xd')](function(){if(_0x1f196d){return db['MemberReport']['findAll']({'where':{'membername':_0x1f196d['name'],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x1a46f6){if(_0x1f196d){if(_0x1a46f6&&_0x1a46f6[_0x0d8b('0x2d')]){var _0x1e2433=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1b216d=0x0,_0x192de1=_0x1a46f6[_0x0d8b('0x2d')];_0x1b216d<_0x192de1;_0x1b216d++){_0x1a46f6[_0x1b216d]['updateAttributes']({'exitAt':_0x1e2433});}}}})[_0x0d8b('0xd')](function(){if(_0x1f196d){var _0x26941a=[];var _0x5059ad=utils['getChannels']();_0x5059ad[_0x0d8b('0x2e')](function(_0x495870){_0x26941a[_0x0d8b('0x2f')]({'channel':_0x495870,'membername':_0x1f196d['name'],'interface':_['isNil'](_0x1f196d[_0x0d8b('0x2a')])?util[_0x0d8b('0x30')]('SIP/%s',_0x1f196d['name']):_0x1f196d['interface'],'type':'PAUSE','enterAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'data1':_0x5c980b[_0x0d8b('0x32')]['type']||_0x0d8b('0x33'),'role':_0x1f196d[_0x0d8b('0x28')],'internal':_0x1f196d[_0x0d8b('0x29')],'uniqueid':_0x5c980b[_0x0d8b('0x32')][_0x0d8b('0x34')]||null});});return db[_0x0d8b('0x35')][_0x0d8b('0x36')](_0x26941a,{'individualHooks':!![]});}})[_0x0d8b('0xd')](function(){if(_0x1f196d){return _0x1f196d[_0x0d8b('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x5c980b[_0x0d8b('0x32')][_0x0d8b('0x37')]||_0x0d8b('0x33'),'lastPauseAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31'))});}})[_0x0d8b('0xd')](function(_0xdfcf32){_0x34acb5(_0xdfcf32);})[_0x0d8b('0x18')](function(_0x1e162c){_0x3fa955(_0x1d06b6[_0x0d8b('0x14')](0x1f4,_0x1e162c['message']));});});};exports[_0x0d8b('0x38')]=function(_0x4d8850){var _0x5d29ab=this;return new Promise(function(_0x39a31d,_0x113fb7){var _0x3f943a;return db[_0x0d8b('0x1a')]['findOne']({'where':_0x4d8850[_0x0d8b('0x1d')][_0x0d8b('0x25')]||{},'attributes':['id',_0x0d8b('0x27')]})[_0x0d8b('0xd')](function(_0x45cd22){if(_0x45cd22){_0x3f943a=_0x45cd22;if(_0x4d8850['body']['channel']&&!utils['isValidChannel'](_0x4d8850['body'][_0x0d8b('0x39')])){throw new Error(_0x0d8b('0x3a'));}switch(_0x4d8850['body']['channel']){case _0x0d8b('0x3b'):return db[_0x0d8b('0x2b')]['update']({'paused':0x0},{'where':{'UserId':_0x3f943a['id']}})['then'](function(){return db[_0x0d8b('0x35')][_0x0d8b('0x24')]({'where':{'channel':_0x4d8850[_0x0d8b('0x32')][_0x0d8b('0x39')],'membername':_0x3f943a[_0x0d8b('0x27')],'type':'PAUSE','exitAt':null}});})[_0x0d8b('0xd')](function(_0x2afe34){if(_0x2afe34){return _0x2afe34['update']({'exitAt':moment()['format'](_0x0d8b('0x31')),'data2':_0x0d8b('0x3c')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x3f943a['update']({'voicePause':![]});});case _0x0d8b('0x3d'):case _0x0d8b('0x3e'):case _0x0d8b('0x3f'):case _0x0d8b('0x40'):case'openchannel':return db[_0x0d8b('0x35')]['find']({'where':{'channel':_0x4d8850['body'][_0x0d8b('0x39')],'membername':_0x3f943a[_0x0d8b('0x27')],'type':'PAUSE','exitAt':null}})['then'](function(_0x44ed23){return _0x44ed23[_0x0d8b('0x2c')]({'exitAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'data2':_0x0d8b('0x3c')},{'individualHooks':!![]});})[_0x0d8b('0xd')](function(){var _0x3978e5={};_[_0x0d8b('0x41')](_0x3978e5,util['format'](_0x0d8b('0x42'),_0x4d8850[_0x0d8b('0x32')][_0x0d8b('0x39')],_0x0d8b('0x43')),![]);return _0x3f943a[_0x0d8b('0x2c')](_0x3978e5);});default:return db[_0x0d8b('0x2b')][_0x0d8b('0x2c')]({'paused':0x0},{'where':{'UserId':_0x3f943a['id']}})[_0x0d8b('0xd')](function(){return db[_0x0d8b('0x35')]['findAll']({'where':{'membername':_0x3f943a[_0x0d8b('0x27')],'type':_0x0d8b('0x44'),'exitAt':null}});})[_0x0d8b('0xd')](function(_0x23de9e){var _0x43ad22=[];_0x23de9e['forEach'](function(_0x1e1dce){_0x43ad22[_0x0d8b('0x2f')](_0x1e1dce[_0x0d8b('0x2c')]({'exitAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'data2':'system'}));});return BPromise['all'](_0x43ad22);})[_0x0d8b('0xd')](function(){return _0x3f943a[_0x0d8b('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x0d8b('0xd')](function(_0xbbb520){_0x39a31d(_0xbbb520);})['catch'](function(_0x199122){_0x113fb7(_0x5d29ab[_0x0d8b('0x14')](0x1f4,_0x199122[_0x0d8b('0x16')]));});});};exports['LogoutUser']=function(_0x2f19f4){var _0x532a85=this;return new Promise(function(_0x2fce07,_0x3ed63e){var _0x1efce6;return db[_0x0d8b('0x1a')][_0x0d8b('0x45')]({'where':_0x2f19f4[_0x0d8b('0x1d')]['where']||{},'attributes':['id',_0x0d8b('0x27')]})['then'](function(_0x71e8d8){if(_0x71e8d8){_0x1efce6=_0x71e8d8;return db[_0x0d8b('0x2b')][_0x0d8b('0x46')]({'where':{'membername':_0x1efce6[_0x0d8b('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x1efce6){return db[_0x0d8b('0x35')][_0x0d8b('0x1b')]({'where':{'membername':_0x1efce6[_0x0d8b('0x27')],'exitAt':null}});}})[_0x0d8b('0xd')](function(_0x2ccdae){if(_0x1efce6){if(_0x2ccdae&&_0x2ccdae[_0x0d8b('0x2d')]){var _0x223fd8=[];_0x2ccdae[_0x0d8b('0x2e')](function(_0x2ce282){_0x223fd8[_0x0d8b('0x2f')](_0x2ce282['update']({'exitAt':moment()['format'](_0x0d8b('0x31'))}));});return BPromise[_0x0d8b('0x47')](_0x223fd8);}}})['then'](function(){if(_0x1efce6){return _0x1efce6[_0x0d8b('0x2c')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x5cc960){_0x2fce07(_0x5cc960);})[_0x0d8b('0x18')](function(_0x1c4e96){_0x3ed63e(_0x532a85['error'](0x1f4,_0x1c4e96['message']));});});};exports[_0x0d8b('0x48')]=function(_0x1c007b){var _0x70e4b2=this;return new Promise(function(_0x435090,_0x2ab72b){var _0x156859;var _0x40d265;var _0x5b4402;var _0x1ca60c;return db['User'][_0x0d8b('0x45')]({'where':_0x1c007b[_0x0d8b('0x1d')][_0x0d8b('0x25')]||{},'attributes':['id',_0x0d8b('0x27'),'role',_0x0d8b('0x49'),'phone',_0x0d8b('0x29'),_0x0d8b('0x4a'),_0x0d8b('0x2a')]})[_0x0d8b('0xd')](function(_0xc5c35f){if(_0xc5c35f){_0x156859=_0xc5c35f;_0x1ca60c=_0x1c007b[_0x0d8b('0x32')][_0x0d8b('0x2a')]?_0x1c007b[_0x0d8b('0x32')][_0x0d8b('0x2a')]:util[_0x0d8b('0x30')]('SIP/%s',_0x156859[_0x0d8b('0x27')]);return db['User'][_0x0d8b('0x4b')]({'where':{'role':_0x0d8b('0x4c'),'online':!![],'id':{'$ne':_0x156859['id']}}});}})['then'](function(_0x1a62b9){if(_0x1a62b9){_0x5b4402=_0x1a62b9;return require('../../config/license/util')[_0x0d8b('0x4d')]();}})[_0x0d8b('0xd')](function(_0x24f75){if(_0x24f75&&_0x24f75[_0x0d8b('0x4e')]&&_0x5b4402>=_0x24f75[_0x0d8b('0x4e')]){throw new Error(_0x0d8b('0x4f'));}})[_0x0d8b('0xd')](function(){if(_0x156859){return db[_0x0d8b('0x2b')]['destroy']({'where':{'membername':_0x156859[_0x0d8b('0x27')]},'individualHooks':!![]});}})[_0x0d8b('0xd')](function(){if(_0x156859){return _0x156859['getVoiceQueues']({'raw':!![]});}})[_0x0d8b('0xd')](function(_0x105df9){if(_0x156859){if(_0x105df9){var _0x303d6=[];_0x40d265=_0x105df9;if(_0x40d265[_0x0d8b('0x2d')]){for(var _0x16141a=0x0;_0x16141a<_0x40d265[_0x0d8b('0x2d')];_0x16141a++){_0x303d6[_0x0d8b('0x2f')](db[_0x0d8b('0x2b')][_0x0d8b('0x50')]({'membername':_0x156859[_0x0d8b('0x27')],'UserId':_0x156859['id'],'queue_name':_0x40d265[_0x16141a][_0x0d8b('0x27')],'VoiceQueueId':_0x40d265[_0x16141a]['id'],'interface':_0x1ca60c,'paused':_0x156859[_0x0d8b('0x4a')]||![],'penalty':_0x40d265[_0x16141a]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x0d8b('0x47')](_0x303d6);}}}})[_0x0d8b('0xd')](function(){if(_0x156859){return db[_0x0d8b('0x35')]['findAll']({'where':{'membername':_0x156859['name'],'exitAt':null}});}})[_0x0d8b('0xd')](function(_0x3aeb45){if(_0x156859){if(_0x3aeb45&&_0x3aeb45[_0x0d8b('0x2d')]){var _0x5b76af=[];_0x3aeb45['forEach'](function(_0x42de18){_0x5b76af[_0x0d8b('0x2f')](_0x42de18[_0x0d8b('0x2c')]({'exitAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31'))}));});return BPromise[_0x0d8b('0x47')](_0x5b76af);}}})[_0x0d8b('0xd')](function(_0x2c826b){if(_0x156859){var _0x20a3dd=[];var _0x3a5aea=[];var _0x195901=utils[_0x0d8b('0x51')]();var _0x3b060e={'membername':_0x156859['name'],'interface':_0x1ca60c,'enterAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'role':_0x156859['role'],'internal':_0x156859['internal']};_0x195901[_0x0d8b('0x2e')](function(_0x1dad9f){_0x20a3dd[_0x0d8b('0x2f')](_[_0x0d8b('0x52')]({'channel':_0x1dad9f,'type':_0x0d8b('0x53'),'data1':_0x0d8b('0x54'),'data2':_0x1ca60c},_0x3b060e));if(_0x156859['loginInPause']){_0x3a5aea['push'](_['merge']({'channel':_0x1dad9f,'type':_0x0d8b('0x44'),'data1':_0x0d8b('0x55')},_0x3b060e));}});return db[_0x0d8b('0x35')][_0x0d8b('0x36')](_0x20a3dd[_0x0d8b('0x56')](_0x3a5aea),{'individualHooks':!![]});}})[_0x0d8b('0xd')](function(){if(_0x156859){return _0x156859['update']({'online':!![],'lastLoginAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'voicePause':_0x156859['loginInPause']||![],'mailPause':_0x156859[_0x0d8b('0x4a')]||![],'chatPause':_0x156859['loginInPause']||![],'faxPause':_0x156859[_0x0d8b('0x4a')]||![],'smsPause':_0x156859[_0x0d8b('0x4a')]||![],'openchannelPause':_0x156859[_0x0d8b('0x4a')]||![],'pauseType':_0x156859[_0x0d8b('0x4a')]?_0x0d8b('0x55'):null,'lastPauseAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'interface':_0x1ca60c});}})[_0x0d8b('0xd')](function(_0x391121){_0x435090(_0x391121);})[_0x0d8b('0x18')](function(_0x276558){_0x2ab72b(_0x70e4b2[_0x0d8b('0x14')](0x1f4,_0x276558['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index eec325d..a4107fa 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 _0x00d4=['user:','save','remove','update','emit','removeListener','register','length'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x00d4,0xf1));var _0x400d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x00d4[_0x4a9fb1];return _0x348672;};'use strict';var UserEvents=require('./user.events');var events=[_0x400d('0x0'),_0x400d('0x1'),_0x400d('0x2')];function createListener(_0x8f73f8,_0x11908b){return function(_0x380f39){_0x11908b[_0x400d('0x3')](_0x8f73f8,_0x380f39);};}function removeListener(_0x2483f8,_0xbb1b21){return function(){UserEvents[_0x400d('0x4')](_0x2483f8,_0xbb1b21);};}exports[_0x400d('0x5')]=function(_0x5cfe53){for(var _0x366bfc=0x0,_0x2cd5d1=events[_0x400d('0x6')];_0x366bfc<_0x2cd5d1;_0x366bfc++){var _0x5f0123=events[_0x366bfc];var _0x5b53cc=createListener(_0x400d('0x7')+_0x5f0123,_0x5cfe53);UserEvents['on'](_0x5f0123,_0x5b53cc);}}; \ No newline at end of file +var _0xc196=['emit','length','user:','./user.events','save','remove','update'];(function(_0x5d1fdc,_0x21d3ef){var _0x43864e=function(_0x36e8c7){while(--_0x36e8c7){_0x5d1fdc['push'](_0x5d1fdc['shift']());}};_0x43864e(++_0x21d3ef);}(_0xc196,0xb2));var _0x6c19=function(_0x4f301a,_0x3b9d2c){_0x4f301a=_0x4f301a-0x0;var _0x50583b=_0xc196[_0x4f301a];return _0x50583b;};'use strict';var UserEvents=require(_0x6c19('0x0'));var events=[_0x6c19('0x1'),_0x6c19('0x2'),_0x6c19('0x3')];function createListener(_0x1cb649,_0x38a2d4){return function(_0x32d859){_0x38a2d4[_0x6c19('0x4')](_0x1cb649,_0x32d859);};}function removeListener(_0x53d72a,_0x3e600a){return function(){UserEvents['removeListener'](_0x53d72a,_0x3e600a);};}exports['register']=function(_0x3cbb79){for(var _0x49131d=0x0,_0x5edb30=events[_0x6c19('0x5')];_0x49131d<_0x5edb30;_0x49131d++){var _0x5d66c2=events[_0x49131d];var _0x21da91=createListener(_0x6c19('0x6')+_0x5d66c2,_0x3cbb79);UserEvents['on'](_0x5d66c2,_0x21da91);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 2279527..7fcb9ab 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 _0x539d=['exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x539d,0x17b));var _0xd539=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0x539d[_0x498334];return _0x13bb70;};'use strict';var multer=require(_0xd539('0x0'));var util=require('util');var path=require(_0xd539('0x1'));var timeout=require(_0xd539('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xd539('0x3'));var interaction=require(_0xd539('0x4'));var config=require(_0xd539('0x5'));module[_0xd539('0x6')]=router; \ No newline at end of file +var _0xcde7=['exports','path','connect-timeout','express','../../components/interaction/service'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xcde7,0x65));var _0x7cde=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcde7[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7cde('0x0'));var timeout=require(_0x7cde('0x1'));var express=require(_0x7cde('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7cde('0x3'));var config=require('../../config/environment');module[_0x7cde('0x4')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 14b6a51..9006424 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 _0x8492=['sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8492,0xc4));var _0x2849=function(_0x505f13,_0x2b8f01){_0x505f13=_0x505f13-0x0;var _0x182aa6=_0x8492[_0x505f13];return _0x182aa6;};'use strict';var Sequelize=require(_0x2849('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'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 2bea34e..4951b06 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 _0x955f=['moment','request-promise','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0x18ea99,_0x5d0dc6){var _0x4e1a63=function(_0x560366){while(--_0x560366){_0x18ea99['push'](_0x18ea99['shift']());}};_0x4e1a63(++_0x5d0dc6);}(_0x955f,0x1eb));var _0xf955=function(_0x90ac5f,_0x56d939){_0x90ac5f=_0x90ac5f-0x0;var _0x74a648=_0x955f[_0x90ac5f];return _0x74a648;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var logger=require(_0xf955('0x2'))(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var BPromise=require('bluebird');var rp=require(_0xf955('0x5'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x1db0dd,_0x5a20bc){return _0x1db0dd[_0xf955('0x6')](_0xf955('0x7'),attributes,{'tableName':_0xf955('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5423=['moment','request-promise','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5423,0xe3));var _0x3542=function(_0x3f6a16,_0x23e485){_0x3f6a16=_0x3f6a16-0x0;var _0x1e8cc5=_0x5423[_0x3f6a16];return _0x1e8cc5;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var attributes=require(_0x3542('0x5'));module[_0x3542('0x6')]=function(_0x2a1864,_0x54ea2f){return _0x2a1864[_0x3542('0x7')](_0x3542('0x8'),attributes,{'tableName':_0x3542('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 826e529..5b03350 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 _0xf807=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x37b0e7,_0x4c94e2){var _0x151101=function(_0xf0fce5){while(--_0xf0fce5){_0x37b0e7['push'](_0x37b0e7['shift']());}};_0x151101(++_0x4c94e2);}(_0xf807,0x75));var _0x7f80=function(_0x26ed29,_0x2288f1){_0x26ed29=_0x26ed29-0x0;var _0x26182c=_0xf807[_0x26ed29];return _0x26182c;};'use strict';var _=require(_0x7f80('0x0'));var util=require('util');var moment=require(_0x7f80('0x1'));var BPromise=require(_0x7f80('0x2'));var rs=require(_0x7f80('0x3'));var fs=require('fs');var Redis=require(_0x7f80('0x4'));var db=require(_0x7f80('0x5'))['db'];var utils=require(_0x7f80('0x6'));var logger=require(_0x7f80('0x7'))(_0x7f80('0x8'));var config=require(_0x7f80('0x9'));var jayson=require(_0x7f80('0xa'));var client=jayson[_0x7f80('0xb')][_0x7f80('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23b7d2,_0x327046,_0x46a945){return new BPromise(function(_0x5f13ab,_0x48ede2){return client[_0x7f80('0xd')](_0x23b7d2,_0x46a945)[_0x7f80('0xe')](function(_0x22921a){logger[_0x7f80('0xf')](_0x7f80('0x10'),_0x327046,_0x7f80('0x11'));logger[_0x7f80('0x12')](_0x7f80('0x13'),_0x327046,_0x7f80('0x11'),JSON[_0x7f80('0x14')](_0x22921a));if(_0x22921a[_0x7f80('0x15')]){if(_0x22921a['error']['code']===0x1f4){logger['error'](_0x7f80('0x10'),_0x327046,_0x22921a[_0x7f80('0x15')][_0x7f80('0x16')]);return _0x48ede2(_0x22921a[_0x7f80('0x15')][_0x7f80('0x16')]);}logger['error'](_0x7f80('0x10'),_0x327046,_0x22921a[_0x7f80('0x15')][_0x7f80('0x16')]);return _0x5f13ab(_0x22921a[_0x7f80('0x15')]['message']);}else{logger['info'](_0x7f80('0x10'),_0x327046,_0x7f80('0x11'));_0x5f13ab(_0x22921a[_0x7f80('0x17')][_0x7f80('0x16')]);}})[_0x7f80('0x18')](function(_0x3acabe){logger[_0x7f80('0x15')](_0x7f80('0x10'),_0x327046,_0x3acabe);_0x48ede2(_0x3acabe);});});} \ No newline at end of file +var _0x5460=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x180331,_0x49aaa7){var _0x4eb417=function(_0xfd6856){while(--_0xfd6856){_0x180331['push'](_0x180331['shift']());}};_0x4eb417(++_0x49aaa7);}(_0x5460,0x1e5));var _0x0546=function(_0x46229a,_0x5b7fbc){_0x46229a=_0x46229a-0x0;var _0xd68564=_0x5460[_0x46229a];return _0xd68564;};'use strict';var _=require(_0x0546('0x0'));var util=require(_0x0546('0x1'));var moment=require(_0x0546('0x2'));var BPromise=require(_0x0546('0x3'));var rs=require(_0x0546('0x4'));var fs=require('fs');var Redis=require(_0x0546('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0546('0x6'));var logger=require('../../config/logger')(_0x0546('0x7'));var config=require(_0x0546('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0546('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37cb77,_0x1b88bb,_0x513b97){return new BPromise(function(_0x49b2b9,_0x1b26bc){return client[_0x0546('0xa')](_0x37cb77,_0x513b97)[_0x0546('0xb')](function(_0x11d55f){logger[_0x0546('0xc')](_0x0546('0xd'),_0x1b88bb,_0x0546('0xe'));logger[_0x0546('0xf')](_0x0546('0x10'),_0x1b88bb,_0x0546('0xe'),JSON['stringify'](_0x11d55f));if(_0x11d55f[_0x0546('0x11')]){if(_0x11d55f[_0x0546('0x11')][_0x0546('0x12')]===0x1f4){logger[_0x0546('0x11')](_0x0546('0xd'),_0x1b88bb,_0x11d55f['error'][_0x0546('0x13')]);return _0x1b26bc(_0x11d55f[_0x0546('0x11')][_0x0546('0x13')]);}logger['error'](_0x0546('0xd'),_0x1b88bb,_0x11d55f[_0x0546('0x11')]['message']);return _0x49b2b9(_0x11d55f[_0x0546('0x11')]['message']);}else{logger['info'](_0x0546('0xd'),_0x1b88bb,_0x0546('0xe'));_0x49b2b9(_0x11d55f['result']['message']);}})[_0x0546('0x14')](function(_0xd2f17d){logger[_0x0546('0x11')](_0x0546('0xd'),_0x1b88bb,_0xd2f17d);_0x1b26bc(_0xd2f17d);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index a2dd552..39378df 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 _0x8ba0=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x3b91b9,_0x751934){var _0x37b825=function(_0x253842){while(--_0x253842){_0x3b91b9['push'](_0x3b91b9['shift']());}};_0x37b825(++_0x751934);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x5f2765,_0x38301b){_0x5f2765=_0x5f2765-0x0;var _0x70297c=_0x8ba0[_0x5f2765];return _0x70297c;};'use strict';var multer=require(_0x08ba('0x0'));var util=require(_0x08ba('0x1'));var path=require(_0x08ba('0x2'));var timeout=require(_0x08ba('0x3'));var express=require(_0x08ba('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x08ba('0x5'));var config=require(_0x08ba('0x6'));module[_0x08ba('0x7')]=router; \ No newline at end of file +var _0x90b1=['../../components/interaction/service','../../config/environment','multer','util','path','Router','../../components/auth/service'];(function(_0x73584,_0x1193f9){var _0x3de19f=function(_0x3f8d69){while(--_0x3f8d69){_0x73584['push'](_0x73584['shift']());}};_0x3de19f(++_0x1193f9);}(_0x90b1,0x1bb));var _0x190b=function(_0x443cdc,_0x1d1da7){_0x443cdc=_0x443cdc-0x0;var _0x13bd4b=_0x90b1[_0x443cdc];return _0x13bd4b;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var auth=require(_0x190b('0x4'));var interaction=require(_0x190b('0x5'));var config=require(_0x190b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ef708a0..96b3bfe 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 _0x7797=['sequelize','exports','INTEGER'];(function(_0x1833cc,_0x3c9f97){var _0x37d4a2=function(_0x2f8bd1){while(--_0x2f8bd1){_0x1833cc['push'](_0x1833cc['shift']());}};_0x37d4a2(++_0x3c9f97);}(_0x7797,0x19e));var _0x7779=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0x7797[_0x8af54b];return _0x27d8f0;};'use strict';var Sequelize=require(_0x7779('0x0'));module[_0x7779('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7779('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x40f6=['sequelize','exports','INTEGER','STRING'];(function(_0xaaa2c2,_0x236876){var _0x465914=function(_0x293962){while(--_0x293962){_0xaaa2c2['push'](_0xaaa2c2['shift']());}};_0x465914(++_0x236876);}(_0x40f6,0x1e8));var _0x640f=function(_0xfb2184,_0x186440){_0xfb2184=_0xfb2184-0x0;var _0x43a919=_0x40f6[_0xfb2184];return _0x43a919;};'use strict';var Sequelize=require(_0x640f('0x0'));module[_0x640f('0x1')]={'penalty':{'type':Sequelize[_0x640f('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x640f('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x640f('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index ef809c4..3bb4811 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 _0x5636=['UserFaxQueue','user_has_fax_queues','lodash','util','bluebird','request-promise','./userFaxQueue.attributes','define'];(function(_0x3de7e0,_0x28cbff){var _0x11d0b3=function(_0xd95412){while(--_0xd95412){_0x3de7e0['push'](_0x3de7e0['shift']());}};_0x11d0b3(++_0x28cbff);}(_0x5636,0x102));var _0x6563=function(_0x4c33ff,_0x51e5b1){_0x4c33ff=_0x4c33ff-0x0;var _0x17236e=_0x5636[_0x4c33ff];return _0x17236e;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6563('0x2'));var rp=require(_0x6563('0x3'));var attributes=require(_0x6563('0x4'));module['exports']=function(_0x166a58,_0x12f62f){return _0x166a58[_0x6563('0x5')](_0x6563('0x6'),attributes,{'tableName':_0x6563('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['moment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api'];(function(_0x5bf9de,_0x58c40f){var _0x25f66e=function(_0x54179d){while(--_0x54179d){_0x5bf9de['push'](_0x5bf9de['shift']());}};_0x25f66e(++_0x58c40f);}(_0x3e74,0x175));var _0x43e7=function(_0x1f675d,_0x37d313){_0x1f675d=_0x1f675d-0x0;var _0x2666fb=_0x3e74[_0x1f675d];return _0x2666fb;};'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 attributes=require(_0x43e7('0x4'));module['exports']=function(_0x128b0f,_0xe838b4){return _0x128b0f[_0x43e7('0x5')](_0x43e7('0x6'),attributes,{'tableName':_0x43e7('0x7'),'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 642c2be..2f209c3 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 _0xf218=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','UserFaxQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xf218,0x1df));var _0x8f21=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf218[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8f21('0x0'));var util=require(_0x8f21('0x1'));var moment=require(_0x8f21('0x2'));var BPromise=require(_0x8f21('0x3'));var rs=require(_0x8f21('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f21('0x5'))['db'];var utils=require(_0x8f21('0x6'));var logger=require(_0x8f21('0x7'))(_0x8f21('0x8'));var config=require(_0x8f21('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8f21('0xa')][_0x8f21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3de3c,_0x174a1a,_0x316bf2){return new BPromise(function(_0x48acbd,_0x44c31f){return client[_0x8f21('0xc')](_0x3de3c,_0x316bf2)[_0x8f21('0xd')](function(_0x26cc0b){logger[_0x8f21('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x174a1a,'request\x20sent');logger[_0x8f21('0xf')](_0x8f21('0x10'),_0x174a1a,_0x8f21('0x11'),JSON['stringify'](_0x26cc0b));if(_0x26cc0b[_0x8f21('0x12')]){if(_0x26cc0b[_0x8f21('0x12')]['code']===0x1f4){logger['error'](_0x8f21('0x13'),_0x174a1a,_0x26cc0b['error'][_0x8f21('0x14')]);return _0x44c31f(_0x26cc0b[_0x8f21('0x12')][_0x8f21('0x14')]);}logger[_0x8f21('0x12')](_0x8f21('0x13'),_0x174a1a,_0x26cc0b[_0x8f21('0x12')][_0x8f21('0x14')]);return _0x48acbd(_0x26cc0b[_0x8f21('0x12')]['message']);}else{logger[_0x8f21('0xe')](_0x8f21('0x13'),_0x174a1a,_0x8f21('0x11'));_0x48acbd(_0x26cc0b['result'][_0x8f21('0x14')]);}})[_0x8f21('0x15')](function(_0x11cb32){logger[_0x8f21('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x174a1a,_0x11cb32);_0x44c31f(_0x11cb32);});});} \ No newline at end of file +var _0xa447=['../../mysqldb','rpc','../../config/environment','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x5b79ca,_0x50d700){var _0x5c4f90=function(_0x44b3cc){while(--_0x44b3cc){_0x5b79ca['push'](_0x5b79ca['shift']());}};_0x5c4f90(++_0x50d700);}(_0xa447,0x164));var _0x7a44=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xa447[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x7a44('0x0'));var util=require(_0x7a44('0x1'));var moment=require(_0x7a44('0x2'));var BPromise=require(_0x7a44('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a44('0x4'));var db=require(_0x7a44('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7a44('0x6'));var config=require(_0x7a44('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x380213,_0x4dd18f,_0x509b1b){return new BPromise(function(_0x249bf0,_0x5dcc04){return client['request'](_0x380213,_0x509b1b)[_0x7a44('0x8')](function(_0x271801){logger[_0x7a44('0x9')](_0x7a44('0xa'),_0x4dd18f,_0x7a44('0xb'));logger[_0x7a44('0xc')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4dd18f,_0x7a44('0xb'),JSON[_0x7a44('0xd')](_0x271801));if(_0x271801['error']){if(_0x271801[_0x7a44('0xe')][_0x7a44('0xf')]===0x1f4){logger['error'](_0x7a44('0xa'),_0x4dd18f,_0x271801['error']['message']);return _0x5dcc04(_0x271801[_0x7a44('0xe')]['message']);}logger[_0x7a44('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x4dd18f,_0x271801[_0x7a44('0xe')][_0x7a44('0x10')]);return _0x249bf0(_0x271801['error'][_0x7a44('0x10')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x4dd18f,'request\x20sent');_0x249bf0(_0x271801[_0x7a44('0x11')]['message']);}})[_0x7a44('0x12')](function(_0x1f0ed0){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x4dd18f,_0x1f0ed0);_0x5dcc04(_0x1f0ed0);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 74c606a..5aae176 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 _0x8f9d=['../../components/interaction/service','../../config/environment','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x2e97c0,_0x5eb545){var _0x43ee13=function(_0x5b1b3a){while(--_0x5b1b3a){_0x2e97c0['push'](_0x2e97c0['shift']());}};_0x43ee13(++_0x5eb545);}(_0x8f9d,0x93));var _0xd8f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f9d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var auth=require(_0xd8f9('0x4'));var interaction=require(_0xd8f9('0x5'));var config=require(_0xd8f9('0x6'));module[_0xd8f9('0x7')]=router; \ No newline at end of file +var _0x5fc3=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x127e65,_0x5aea47){var _0x4a3717=function(_0x43c6f6){while(--_0x43c6f6){_0x127e65['push'](_0x127e65['shift']());}};_0x4a3717(++_0x5aea47);}(_0x5fc3,0xa8));var _0x35fc=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x5fc3[_0x46a3e8];return _0xf1442e;};'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');module[_0x35fc('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index eb8ce34..5ae3572 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 _0xe14d=['exports','INTEGER','sequelize'];(function(_0x5263f8,_0x1050f3){var _0x3765ba=function(_0xc5fd78){while(--_0xc5fd78){_0x5263f8['push'](_0x5263f8['shift']());}};_0x3765ba(++_0x1050f3);}(_0xe14d,0x1cd));var _0xde14=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xe14d[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'penalty':{'type':Sequelize[_0xde14('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x14de=['exports','INTEGER','sequelize'];(function(_0x24681b,_0x31424e){var _0x10d992=function(_0x1c04bc){while(--_0x1c04bc){_0x24681b['push'](_0x24681b['shift']());}};_0x10d992(++_0x31424e);}(_0x14de,0xcb));var _0xe14d=function(_0x27275c,_0xcf0aba){_0x27275c=_0x27275c-0x0;var _0x58e795=_0x14de[_0x27275c];return _0x58e795;};'use strict';var Sequelize=require(_0xe14d('0x0'));module[_0xe14d('0x1')]={'penalty':{'type':Sequelize[_0xe14d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 57bb49a..3bb5b66 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 _0xd506=['exports','UserMailQueue','user_has_mail_queues','lodash'];(function(_0x1db1c3,_0x295a91){var _0x4a1284=function(_0x19388c){while(--_0x19388c){_0x1db1c3['push'](_0x1db1c3['shift']());}};_0x4a1284(++_0x295a91);}(_0xd506,0x197));var _0x6d50=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xd506[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0x6d50('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./userMailQueue.attributes');module[_0x6d50('0x1')]=function(_0x56085b,_0x5d1867){return _0x56085b['define'](_0x6d50('0x2'),attributes,{'tableName':_0x6d50('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb982=['api','moment','bluebird','request-promise','./userMailQueue.attributes','exports','define','user_has_mail_queues','../../config/logger'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xb982,0x15e));var _0x2b98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb982[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b98('0x0'))(_0x2b98('0x1'));var moment=require(_0x2b98('0x2'));var BPromise=require(_0x2b98('0x3'));var rp=require(_0x2b98('0x4'));var attributes=require(_0x2b98('0x5'));module[_0x2b98('0x6')]=function(_0x1176d5,_0x2f9789){return _0x1176d5[_0x2b98('0x7')]('UserMailQueue',attributes,{'tableName':_0x2b98('0x8'),'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 a83287f..b86ca76 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 _0x4396=['info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x270e32,_0x9acec5){var _0x1f3ea5=function(_0x2a0436){while(--_0x2a0436){_0x270e32['push'](_0x270e32['shift']());}};_0x1f3ea5(++_0x9acec5);}(_0x4396,0x143));var _0x6439=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x4396[_0x58a4ac];return _0x545810;};'use strict';var _=require(_0x6439('0x0'));var util=require(_0x6439('0x1'));var moment=require(_0x6439('0x2'));var BPromise=require(_0x6439('0x3'));var rs=require(_0x6439('0x4'));var fs=require('fs');var Redis=require(_0x6439('0x5'));var db=require(_0x6439('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6439('0x7'))(_0x6439('0x8'));var config=require(_0x6439('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6439('0xa')][_0x6439('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2410a8,_0x4004b1,_0x1078b0){return new BPromise(function(_0x1e1844,_0x196665){return client['request'](_0x2410a8,_0x1078b0)[_0x6439('0xc')](function(_0x47d924){logger[_0x6439('0xd')](_0x6439('0xe'),_0x4004b1,_0x6439('0xf'));logger[_0x6439('0x10')](_0x6439('0x11'),_0x4004b1,_0x6439('0xf'),JSON[_0x6439('0x12')](_0x47d924));if(_0x47d924['error']){if(_0x47d924[_0x6439('0x13')][_0x6439('0x14')]===0x1f4){logger[_0x6439('0x13')](_0x6439('0xe'),_0x4004b1,_0x47d924[_0x6439('0x13')][_0x6439('0x15')]);return _0x196665(_0x47d924[_0x6439('0x13')][_0x6439('0x15')]);}logger[_0x6439('0x13')](_0x6439('0xe'),_0x4004b1,_0x47d924[_0x6439('0x13')][_0x6439('0x15')]);return _0x1e1844(_0x47d924['error'][_0x6439('0x15')]);}else{logger[_0x6439('0xd')](_0x6439('0xe'),_0x4004b1,'request\x20sent');_0x1e1844(_0x47d924[_0x6439('0x16')][_0x6439('0x15')]);}})[_0x6439('0x17')](function(_0x1c8782){logger['error'](_0x6439('0xe'),_0x4004b1,_0x1c8782);_0x196665(_0x1c8782);});});} \ No newline at end of file +var _0x3034=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x4587fe,_0x4b740c){var _0x379355=function(_0x24247c){while(--_0x24247c){_0x4587fe['push'](_0x4587fe['shift']());}};_0x379355(++_0x4b740c);}(_0x3034,0x11f));var _0x4303=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3034[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x4303('0x0'));var util=require('util');var moment=require(_0x4303('0x1'));var BPromise=require(_0x4303('0x2'));var rs=require(_0x4303('0x3'));var fs=require('fs');var Redis=require(_0x4303('0x4'));var db=require(_0x4303('0x5'))['db'];var utils=require(_0x4303('0x6'));var logger=require(_0x4303('0x7'))(_0x4303('0x8'));var config=require(_0x4303('0x9'));var jayson=require(_0x4303('0xa'));var client=jayson['client'][_0x4303('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12fd2d,_0x2c0461,_0x12f424){return new BPromise(function(_0x505c8c,_0x1b7d16){return client[_0x4303('0xc')](_0x12fd2d,_0x12f424)[_0x4303('0xd')](function(_0x47736b){logger[_0x4303('0xe')](_0x4303('0xf'),_0x2c0461,_0x4303('0x10'));logger['debug'](_0x4303('0x11'),_0x2c0461,_0x4303('0x10'),JSON['stringify'](_0x47736b));if(_0x47736b['error']){if(_0x47736b['error'][_0x4303('0x12')]===0x1f4){logger[_0x4303('0x13')](_0x4303('0xf'),_0x2c0461,_0x47736b[_0x4303('0x13')][_0x4303('0x14')]);return _0x1b7d16(_0x47736b[_0x4303('0x13')]['message']);}logger['error'](_0x4303('0xf'),_0x2c0461,_0x47736b[_0x4303('0x13')][_0x4303('0x14')]);return _0x505c8c(_0x47736b[_0x4303('0x13')][_0x4303('0x14')]);}else{logger[_0x4303('0xe')](_0x4303('0xf'),_0x2c0461,_0x4303('0x10'));_0x505c8c(_0x47736b['result'][_0x4303('0x14')]);}})[_0x4303('0x15')](function(_0x400a2d){logger[_0x4303('0x13')](_0x4303('0xf'),_0x2c0461,_0x400a2d);_0x1b7d16(_0x400a2d);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d14ea12..80deb9b 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 _0x0170=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0x0170,0x1d6));var _0x0017=function(_0x13f9ac,_0x56ee7f){_0x13f9ac=_0x13f9ac-0x0;var _0x563c3=_0x0170[_0x13f9ac];return _0x563c3;};'use strict';var multer=require(_0x0017('0x0'));var util=require(_0x0017('0x1'));var path=require('path');var timeout=require(_0x0017('0x2'));var express=require(_0x0017('0x3'));var router=express[_0x0017('0x4')]();var auth=require(_0x0017('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0017('0x6'));module[_0x0017('0x7')]=router; \ No newline at end of file +var _0xb4b6=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x2fb3fe,_0x3c9e51){var _0x1b489a=function(_0x3180b3){while(--_0x3180b3){_0x2fb3fe['push'](_0x2fb3fe['shift']());}};_0x1b489a(++_0x3c9e51);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x24119a,_0x3ea966){_0x24119a=_0x24119a-0x0;var _0x318223=_0xb4b6[_0x24119a];return _0x318223;};'use strict';var multer=require('multer');var util=require(_0x6b4b('0x0'));var path=require(_0x6b4b('0x1'));var timeout=require(_0x6b4b('0x2'));var express=require(_0x6b4b('0x3'));var router=express[_0x6b4b('0x4')]();var auth=require(_0x6b4b('0x5'));var interaction=require(_0x6b4b('0x6'));var config=require(_0x6b4b('0x7'));module[_0x6b4b('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 1e3c1f7..378b81b 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 _0x26f4=['exports'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0x26f4,0x170));var _0x426f=function(_0x504338,_0x571e7f){_0x504338=_0x504338-0x0;var _0x5884c9=_0x26f4[_0x504338];return _0x5884c9;};'use strict';var Sequelize=require('sequelize');module[_0x426f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd87b=['sequelize','exports'];(function(_0x459c47,_0x46180e){var _0x9cc94b=function(_0x194add){while(--_0x194add){_0x459c47['push'](_0x459c47['shift']());}};_0x9cc94b(++_0x46180e);}(_0xd87b,0x7a));var _0xbd87=function(_0x2023ed,_0x4b39b3){_0x2023ed=_0x2023ed-0x0;var _0x9dbafa=_0xd87b[_0x2023ed];return _0x9dbafa;};'use strict';var Sequelize=require(_0xbd87('0x0'));module[_0xbd87('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 e839f91..ace74b1 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 _0x6038=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x50e265,_0x31cf38){var _0x465539=function(_0x3ba2db){while(--_0x3ba2db){_0x50e265['push'](_0x50e265['shift']());}};_0x465539(++_0x31cf38);}(_0x6038,0x1f4));var _0x8603=function(_0xfd7f1c,_0x4970ee){_0xfd7f1c=_0xfd7f1c-0x0;var _0x3056c3=_0x6038[_0xfd7f1c];return _0x3056c3;};'use strict';var _=require(_0x8603('0x0'));var util=require(_0x8603('0x1'));var logger=require(_0x8603('0x2'))(_0x8603('0x3'));var moment=require(_0x8603('0x4'));var BPromise=require('bluebird');var rp=require(_0x8603('0x5'));var attributes=require(_0x8603('0x6'));module[_0x8603('0x7')]=function(_0x31f0c2,_0x467424){return _0x31f0c2[_0x8603('0x8')](_0x8603('0x9'),attributes,{'tableName':_0x8603('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64c7=['api','bluebird','request-promise','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x5038f6,_0x266e0e){var _0x6e4e37=function(_0x427b41){while(--_0x427b41){_0x5038f6['push'](_0x5038f6['shift']());}};_0x6e4e37(++_0x266e0e);}(_0x64c7,0x1b7));var _0x764c=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0x64c7[_0x44216d];return _0xeca523;};'use strict';var _=require(_0x764c('0x0'));var util=require(_0x764c('0x1'));var logger=require('../../config/logger')(_0x764c('0x2'));var moment=require('moment');var BPromise=require(_0x764c('0x3'));var rp=require(_0x764c('0x4'));var attributes=require(_0x764c('0x5'));module['exports']=function(_0x34de17,_0x31b512){return _0x34de17[_0x764c('0x6')](_0x764c('0x7'),attributes,{'tableName':_0x764c('0x8'),'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 af70a40..601dc2a 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 _0xc4d9=['ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','lodash','util'];(function(_0x213e07,_0x2b09e8){var _0x3e8915=function(_0x622320){while(--_0x622320){_0x213e07['push'](_0x213e07['shift']());}};_0x3e8915(++_0x2b09e8);}(_0xc4d9,0x1d2));var _0x9c4d=function(_0x4084ab,_0x37d540){_0x4084ab=_0x4084ab-0x0;var _0x53264b=_0xc4d9[_0x4084ab];return _0x53264b;};'use strict';var _=require(_0x9c4d('0x0'));var util=require(_0x9c4d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c4d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c4d('0x3'));var logger=require(_0x9c4d('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9c4d('0x5'));var client=jayson['client'][_0x9c4d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3a00d4,_0x5e6fe2,_0x283919){return new BPromise(function(_0x2c89d4,_0x56e38b){return client[_0x9c4d('0x7')](_0x3a00d4,_0x283919)[_0x9c4d('0x8')](function(_0x1e8a52){logger[_0x9c4d('0x9')](_0x9c4d('0xa'),_0x5e6fe2,'request\x20sent');logger[_0x9c4d('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5e6fe2,'request\x20sent',JSON[_0x9c4d('0xc')](_0x1e8a52));if(_0x1e8a52[_0x9c4d('0xd')]){if(_0x1e8a52[_0x9c4d('0xd')][_0x9c4d('0xe')]===0x1f4){logger[_0x9c4d('0xd')](_0x9c4d('0xa'),_0x5e6fe2,_0x1e8a52[_0x9c4d('0xd')][_0x9c4d('0xf')]);return _0x56e38b(_0x1e8a52[_0x9c4d('0xd')][_0x9c4d('0xf')]);}logger[_0x9c4d('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5e6fe2,_0x1e8a52[_0x9c4d('0xd')][_0x9c4d('0xf')]);return _0x2c89d4(_0x1e8a52[_0x9c4d('0xd')][_0x9c4d('0xf')]);}else{logger[_0x9c4d('0x9')](_0x9c4d('0xa'),_0x5e6fe2,_0x9c4d('0x10'));_0x2c89d4(_0x1e8a52[_0x9c4d('0x11')]['message']);}})['catch'](function(_0x48d92a){logger['error'](_0x9c4d('0xa'),_0x5e6fe2,_0x48d92a);_0x56e38b(_0x48d92a);});});} \ No newline at end of file +var _0xc8b5=['stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc8b5,0x1b6));var _0x5c8b=function(_0x55ec9b,_0x12ad19){_0x55ec9b=_0x55ec9b-0x0;var _0x32968c=_0xc8b5[_0x55ec9b];return _0x32968c;};'use strict';var _=require(_0x5c8b('0x0'));var util=require(_0x5c8b('0x1'));var moment=require(_0x5c8b('0x2'));var BPromise=require(_0x5c8b('0x3'));var rs=require(_0x5c8b('0x4'));var fs=require('fs');var Redis=require(_0x5c8b('0x5'));var db=require(_0x5c8b('0x6'))['db'];var utils=require(_0x5c8b('0x7'));var logger=require(_0x5c8b('0x8'))('rpc');var config=require(_0x5c8b('0x9'));var jayson=require(_0x5c8b('0xa'));var client=jayson[_0x5c8b('0xb')][_0x5c8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31efff,_0x128661,_0x4d71b6){return new BPromise(function(_0x515691,_0x5254e6){return client[_0x5c8b('0xd')](_0x31efff,_0x4d71b6)[_0x5c8b('0xe')](function(_0x44d822){logger[_0x5c8b('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x128661,_0x5c8b('0x10'));logger[_0x5c8b('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x128661,'request\x20sent',JSON[_0x5c8b('0x12')](_0x44d822));if(_0x44d822[_0x5c8b('0x13')]){if(_0x44d822['error'][_0x5c8b('0x14')]===0x1f4){logger[_0x5c8b('0x13')](_0x5c8b('0x15'),_0x128661,_0x44d822[_0x5c8b('0x13')][_0x5c8b('0x16')]);return _0x5254e6(_0x44d822[_0x5c8b('0x13')][_0x5c8b('0x16')]);}logger[_0x5c8b('0x13')](_0x5c8b('0x15'),_0x128661,_0x44d822['error'][_0x5c8b('0x16')]);return _0x515691(_0x44d822['error'][_0x5c8b('0x16')]);}else{logger[_0x5c8b('0xf')](_0x5c8b('0x15'),_0x128661,_0x5c8b('0x10'));_0x515691(_0x44d822['result'][_0x5c8b('0x16')]);}})[_0x5c8b('0x17')](function(_0x4e4e49){logger[_0x5c8b('0x13')](_0x5c8b('0x15'),_0x128661,_0x4e4e49);_0x5254e6(_0x4e4e49);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 6efad68..5f89e8b 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 _0xcfb9=['describe','/:id','show','getResources','/:id/clone','clone','post','/:id/sections','addSections','put','update','delete','destroy','removeSections','/:id/resources','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xcfb9,0xbf));var _0x9cfb=function(_0x12b83d,_0x4bcec7){_0x12b83d=_0x12b83d-0x0;var _0x1fd39d=_0xcfb9[_0x12b83d];return _0x1fd39d;};'use strict';var multer=require(_0x9cfb('0x0'));var util=require(_0x9cfb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cfb('0x2')]();var auth=require(_0x9cfb('0x3'));var interaction=require(_0x9cfb('0x4'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x9cfb('0x5')]('/',auth[_0x9cfb('0x6')](),controller[_0x9cfb('0x7')]);router['get'](_0x9cfb('0x8'),auth['isAuthenticated'](),controller[_0x9cfb('0x9')]);router[_0x9cfb('0x5')](_0x9cfb('0xa'),auth[_0x9cfb('0x6')](),controller[_0x9cfb('0xb')]);router[_0x9cfb('0x5')]('/:id/resources',auth[_0x9cfb('0x6')](),controller[_0x9cfb('0xc')]);router['post']('/',auth[_0x9cfb('0x6')](),controller['create']);router['post'](_0x9cfb('0xd'),auth[_0x9cfb('0x6')](),controller[_0x9cfb('0xe')]);router[_0x9cfb('0xf')](_0x9cfb('0x10'),auth[_0x9cfb('0x6')](),controller[_0x9cfb('0x11')]);router[_0x9cfb('0xf')]('/:id/resources',auth[_0x9cfb('0x6')](),controller['addResources']);router[_0x9cfb('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9cfb('0x13')]);router[_0x9cfb('0x14')](_0x9cfb('0xa'),auth['isAuthenticated'](),controller[_0x9cfb('0x15')]);router[_0x9cfb('0x14')](_0x9cfb('0x10'),auth[_0x9cfb('0x6')](),controller[_0x9cfb('0x16')]);router[_0x9cfb('0x14')](_0x9cfb('0x17'),auth[_0x9cfb('0x6')](),controller['removeResources']);module[_0x9cfb('0x18')]=router; \ No newline at end of file +var _0x36f6=['/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addResources','update','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','Router','../../config/environment','./userProfile.controller','get','isAuthenticated','/:id'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x36f6,0x14f));var _0x636f=function(_0x44714c,_0x2ac454){_0x44714c=_0x44714c-0x0;var _0x57d4d5=_0x36f6[_0x44714c];return _0x57d4d5;};'use strict';var multer=require(_0x636f('0x0'));var util=require(_0x636f('0x1'));var path=require(_0x636f('0x2'));var timeout=require(_0x636f('0x3'));var express=require('express');var router=express[_0x636f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x636f('0x5'));var controller=require(_0x636f('0x6'));router[_0x636f('0x7')]('/',auth[_0x636f('0x8')](),controller['index']);router['get']('/describe',auth[_0x636f('0x8')](),controller['describe']);router['get'](_0x636f('0x9'),auth[_0x636f('0x8')](),controller['show']);router[_0x636f('0x7')](_0x636f('0xa'),auth[_0x636f('0x8')](),controller[_0x636f('0xb')]);router[_0x636f('0xc')]('/',auth[_0x636f('0x8')](),controller[_0x636f('0xd')]);router[_0x636f('0xc')](_0x636f('0xe'),auth['isAuthenticated'](),controller[_0x636f('0xf')]);router[_0x636f('0xc')](_0x636f('0x10'),auth[_0x636f('0x8')](),controller['addSections']);router['post'](_0x636f('0xa'),auth[_0x636f('0x8')](),controller[_0x636f('0x11')]);router['put'](_0x636f('0x9'),auth[_0x636f('0x8')](),controller[_0x636f('0x12')]);router[_0x636f('0x13')](_0x636f('0x9'),auth[_0x636f('0x8')](),controller['destroy']);router[_0x636f('0x13')]('/:id/sections',auth[_0x636f('0x8')](),controller[_0x636f('0x14')]);router[_0x636f('0x13')](_0x636f('0xa'),auth[_0x636f('0x8')](),controller[_0x636f('0x15')]);module[_0x636f('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 822a077..92a408b 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 _0x6739=['join','getDataValue','split','sequelize','exports','STRING','setDataValue','crudPermissions'];(function(_0xf9332a,_0xb2f99b){var _0x2654ce=function(_0x4f2cb3){while(--_0x4f2cb3){_0xf9332a['push'](_0xf9332a['shift']());}};_0x2654ce(++_0xb2f99b);}(_0x6739,0x15b));var _0x9673=function(_0x4eaea7,_0x16457f){_0x4eaea7=_0x4eaea7-0x0;var _0x1c30a6=_0x6739[_0x4eaea7];return _0x1c30a6;};'use strict';var Sequelize=require(_0x9673('0x0'));module[_0x9673('0x1')]={'name':{'type':Sequelize[_0x9673('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2a81a5){this[_0x9673('0x3')](_0x9673('0x4'),_0x2a81a5?_0x2a81a5[_0x9673('0x5')](''):[]);},'get':function(){return this[_0x9673('0x6')](_0x9673('0x4'))?this[_0x9673('0x6')](_0x9673('0x4'))[_0x9673('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x1dd3=['sequelize','STRING','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x31e8a2,_0x157317){var _0x3fe467=function(_0x41d7db){while(--_0x41d7db){_0x31e8a2['push'](_0x31e8a2['shift']());}};_0x3fe467(++_0x157317);}(_0x1dd3,0x1f1));var _0x31dd=function(_0x4c3f13,_0x4c1782){_0x4c3f13=_0x4c3f13-0x0;var _0x74adc6=_0x1dd3[_0x4c3f13];return _0x74adc6;};'use strict';var Sequelize=require(_0x31dd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x31dd('0x1')],'set':function(_0xa5ca96){this[_0x31dd('0x2')](_0x31dd('0x3'),_0xa5ca96?_0xa5ca96[_0x31dd('0x4')](''):[]);},'get':function(){return this[_0x31dd('0x5')](_0x31dd('0x3'))?this[_0x31dd('0x5')](_0x31dd('0x3'))[_0x31dd('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x31dd('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 0f6bd3f..9dc234b 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 _0xf4f5=['FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','Agents','membername','role','agent','User','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','Users','admin','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','Trigger','trunks','Trunk','plugins','extractedreports','Reports','AnalyticMetric','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','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','map','VIRTUAL','field','filter','includeAll','include','UserProfile','findAll','rows','catch','show','params','intersection','create','clone','options','find','get','omit','createdAt','body','sequelize','transaction','UserProfileSection','each','autoAssociation','updatedAt','sectionId','userProfileId','UserProfileResource','describe','Resources','removeSections','ids','addResources','bulkCreate','removeResources','getResources','undefined','Sequelize','ValidationError','mergeResources','childModel','isEmpty','parentSections','findOne','all','ignore','union','push','sort','pick','key','foreignKey','associatedResources','forEach','reportType','default','type','DefaultReports','reportId','CustomReports','CmContact','tag','Tag','ThroughTags','color','value','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','SquareProject','odbc','SquareRecording','SquareProjects','projectName','projects','contacts','Lists','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','FaxQueue','faxaccounts'];(function(_0x41beff,_0x57e342){var _0x5928ad=function(_0x3b6d86){while(--_0x3b6d86){_0x41beff['push'](_0x41beff['shift']());}};_0x5928ad(++_0x57e342);}(_0xf4f5,0x12b));var _0x5f4f=function(_0x24bcf6,_0x51a557){_0x24bcf6=_0x24bcf6-0x0;var _0x2cb90c=_0xf4f5[_0x24bcf6];return _0x2cb90c;};'use strict';var pdf=require(_0x5f4f('0x0'));var emlformat=require(_0x5f4f('0x1'));var rimraf=require(_0x5f4f('0x2'));var zipdir=require(_0x5f4f('0x3'));var jsonpatch=require(_0x5f4f('0x4'));var rp=require(_0x5f4f('0x5'));var moment=require(_0x5f4f('0x6'));var BPromise=require(_0x5f4f('0x7'));var Mustache=require(_0x5f4f('0x8'));var util=require(_0x5f4f('0x9'));var path=require(_0x5f4f('0xa'));var sox=require('sox');var csv=require(_0x5f4f('0xb'));var ejs=require(_0x5f4f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5f4f('0xd'));var crypto=require(_0x5f4f('0xe'));var jsforce=require(_0x5f4f('0xf'));var deskjs=require(_0x5f4f('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5f4f('0x11'));var authService=require(_0x5f4f('0x12'));var hardwareService=require(_0x5f4f('0x13'));var Redis=require(_0x5f4f('0x14'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x5f4f('0x15'));var config=require(_0x5f4f('0x16'));var db=require(_0x5f4f('0x17'))['db'];config[_0x5f4f('0x18')]=_[_0x5f4f('0x19')](config[_0x5f4f('0x18')],{'host':_0x5f4f('0x1a'),'port':0x18eb});var socket=require(_0x5f4f('0x1b'))(new Redis(config[_0x5f4f('0x18')]));require(_0x5f4f('0x1c'))['register'](socket);function respondWithStatusCode(_0x518526,_0x53c7c4){_0x53c7c4=_0x53c7c4||0xcc;return function(_0x1f00e9){if(_0x1f00e9){return _0x518526['sendStatus'](_0x53c7c4);}return _0x518526[_0x5f4f('0x1d')](_0x53c7c4)[_0x5f4f('0x1e')]();};}function respondWithResult(_0x563e7b,_0x1a1e3d){_0x1a1e3d=_0x1a1e3d||0xc8;return function(_0x91f1d5){if(_0x91f1d5){return _0x563e7b['status'](_0x1a1e3d)[_0x5f4f('0x1f')](_0x91f1d5);}};}function respondWithFilteredResult(_0x1e695d,_0x3d8437){return function(_0x294e56){if(_0x294e56){var _0x2c484f=_0x294e56[_0x5f4f('0x20')],_0xc1e844=_0x3d8437[_0x5f4f('0x21')],_0x3d2cfb=_0x3d8437[_0x5f4f('0x21')]+_0x3d8437[_0x5f4f('0x22')],_0x1af21b;if(_0x3d2cfb>=_0x2c484f){_0x3d2cfb=_0x2c484f;_0x1af21b=0xc8;}else{_0x1af21b=0xce;}_0x1e695d['status'](_0x1af21b);return _0x1e695d['set'](_0x5f4f('0x23'),_0xc1e844+'-'+_0x3d2cfb+'/'+_0x2c484f)[_0x5f4f('0x1f')](_0x294e56);}return null;};}function patchUpdates(_0x5ad3d5){return function(_0x7e2e61){try{jsonpatch['apply'](_0x7e2e61,_0x5ad3d5,!![]);}catch(_0x37aed6){return BPromise[_0x5f4f('0x24')](_0x37aed6);}return _0x7e2e61['save']();};}function saveUpdates(_0x1eacda,_0x16c775){return function(_0x203002){if(_0x203002){return _0x203002[_0x5f4f('0x25')](_0x1eacda)[_0x5f4f('0x26')](function(_0x454f48){return _0x454f48;});}return null;};}function removeEntity(_0x1973b8,_0x4a5793){return function(_0x3522bf){if(_0x3522bf){return _0x3522bf[_0x5f4f('0x27')]()[_0x5f4f('0x26')](function(){_0x1973b8[_0x5f4f('0x1d')](0xcc)[_0x5f4f('0x1e')]();});}};}function handleEntityNotFound(_0x49fa0a,_0x3cc5fb){return function(_0x2c988e){if(!_0x2c988e){_0x49fa0a['sendStatus'](0x194);}return _0x2c988e;};}function handleError(_0x4f815b,_0x3d0af9){_0x3d0af9=_0x3d0af9||0x1f4;return function(_0x482929){logger['error'](_0x482929[_0x5f4f('0x28')]);if(_0x482929['name']){delete _0x482929[_0x5f4f('0x29')];}_0x4f815b[_0x5f4f('0x1d')](_0x3d0af9)[_0x5f4f('0x2a')](_0x482929);};}exports[_0x5f4f('0x2b')]=function(_0x2c44e2,_0x435439){var _0x1f8d09={},_0x114d34={},_0xb518f3={'count':0x0,'rows':[]};var _0x3332e5=db['UserProfile'][_0x5f4f('0x2c')];_0x114d34[_0x5f4f('0x2d')]=_[_0x5f4f('0x2e')](_0x3332e5);_0x114d34['query']=_[_0x5f4f('0x2e')](_0x2c44e2[_0x5f4f('0x2f')]);_0x114d34[_0x5f4f('0x30')]=_['intersection'](_0x114d34[_0x5f4f('0x2d')],_0x114d34[_0x5f4f('0x2f')]);_0x1f8d09[_0x5f4f('0x31')]=_['intersection'](_0x114d34['model'],qs[_0x5f4f('0x32')](_0x2c44e2[_0x5f4f('0x2f')][_0x5f4f('0x32')]));_0x1f8d09[_0x5f4f('0x31')]=_0x1f8d09[_0x5f4f('0x31')][_0x5f4f('0x33')]?_0x1f8d09['attributes']:_0x114d34[_0x5f4f('0x2d')];if(!_0x2c44e2[_0x5f4f('0x2f')][_0x5f4f('0x34')](_0x5f4f('0x35'))){_0x1f8d09[_0x5f4f('0x22')]=qs[_0x5f4f('0x22')](_0x2c44e2[_0x5f4f('0x2f')][_0x5f4f('0x22')]);_0x1f8d09['offset']=qs[_0x5f4f('0x21')](_0x2c44e2[_0x5f4f('0x2f')][_0x5f4f('0x21')]);}_0x1f8d09[_0x5f4f('0x36')]=qs['sort'](_0x2c44e2[_0x5f4f('0x2f')]['sort']);_0x1f8d09[_0x5f4f('0x37')]=qs[_0x5f4f('0x30')](_['pick'](_0x2c44e2[_0x5f4f('0x2f')],_0x114d34[_0x5f4f('0x30')]));if(_0x2c44e2['query']['filter']){_0x1f8d09[_0x5f4f('0x37')]=_[_0x5f4f('0x38')](_0x1f8d09['where'],{'$or':_[_0x5f4f('0x39')](_0x3332e5,function(_0x3b3a46){if(_0x3b3a46['type']['key']!==_0x5f4f('0x3a')){var _0x2f3878={};_0x2f3878[_0x3b3a46[_0x5f4f('0x3b')]]={'$like':'%'+_0x2c44e2[_0x5f4f('0x2f')][_0x5f4f('0x3c')]+'%'};return _0x2f3878;}})});}_0x1f8d09=_[_0x5f4f('0x38')]({},_0x1f8d09,_0x2c44e2['options']);var _0x40c1cf={'where':_0x1f8d09['where']};return db['UserProfile'][_0x5f4f('0x20')](_0x40c1cf)[_0x5f4f('0x26')](function(_0x431b8a){_0xb518f3[_0x5f4f('0x20')]=_0x431b8a;if(_0x2c44e2[_0x5f4f('0x2f')][_0x5f4f('0x3d')]){_0x1f8d09[_0x5f4f('0x3e')]=[{'all':!![]}];}return db[_0x5f4f('0x3f')][_0x5f4f('0x40')](_0x1f8d09);})[_0x5f4f('0x26')](function(_0x113b53){_0xb518f3[_0x5f4f('0x41')]=_0x113b53;return _0xb518f3;})[_0x5f4f('0x26')](respondWithFilteredResult(_0x435439,_0x1f8d09))[_0x5f4f('0x42')](handleError(_0x435439,null));};exports[_0x5f4f('0x43')]=function(_0x44ab95,_0x1fe2e0){var _0x1a97c0={'raw':![],'where':{'id':_0x44ab95[_0x5f4f('0x44')]['id']}},_0x1bd2a3={};_0x1bd2a3[_0x5f4f('0x2d')]=_[_0x5f4f('0x2e')](db[_0x5f4f('0x3f')][_0x5f4f('0x2c')]);_0x1bd2a3['query']=_[_0x5f4f('0x2e')](_0x44ab95[_0x5f4f('0x2f')]);_0x1bd2a3['filters']=_[_0x5f4f('0x45')](_0x1bd2a3[_0x5f4f('0x2d')],_0x1bd2a3[_0x5f4f('0x2f')]);_0x1a97c0[_0x5f4f('0x31')]=_[_0x5f4f('0x45')](_0x1bd2a3[_0x5f4f('0x2d')],qs[_0x5f4f('0x32')](_0x44ab95[_0x5f4f('0x2f')][_0x5f4f('0x32')]));_0x1a97c0[_0x5f4f('0x31')]=_0x1a97c0['attributes']['length']?_0x1a97c0[_0x5f4f('0x31')]:_0x1bd2a3['model'];if(_0x44ab95['query'][_0x5f4f('0x3d')]){_0x1a97c0[_0x5f4f('0x3e')]=[{'all':!![]}];}_0x1a97c0=_['merge']({},_0x1a97c0,_0x44ab95['options']);return db['UserProfile']['find'](_0x1a97c0)['then'](handleEntityNotFound(_0x1fe2e0,null))[_0x5f4f('0x26')](respondWithResult(_0x1fe2e0,null))['catch'](handleError(_0x1fe2e0,null));};exports[_0x5f4f('0x46')]=function(_0x712761,_0x195d8a){return db[_0x5f4f('0x3f')]['create'](_0x712761['body'],{})[_0x5f4f('0x26')](respondWithResult(_0x195d8a,0xc9))[_0x5f4f('0x42')](handleError(_0x195d8a,null));};exports[_0x5f4f('0x47')]=function(_0x3e3606,_0x55d6c0){var _0x438dc9={'raw':![],'where':{'id':_0x3e3606['params']['id']}},_0x50c463={};_0x50c463[_0x5f4f('0x2d')]=_[_0x5f4f('0x2e')](db[_0x5f4f('0x3f')][_0x5f4f('0x2c')]);_0x438dc9[_0x5f4f('0x31')]=_[_0x5f4f('0x45')](_0x50c463[_0x5f4f('0x2d')],qs[_0x5f4f('0x32')](_0x3e3606[_0x5f4f('0x2f')][_0x5f4f('0x32')]));_0x438dc9[_0x5f4f('0x31')]=_0x438dc9['attributes'][_0x5f4f('0x33')]?_0x438dc9[_0x5f4f('0x31')]:_0x50c463[_0x5f4f('0x2d')];if(_0x3e3606['query'][_0x5f4f('0x3d')]){_0x438dc9[_0x5f4f('0x3e')]=[{'all':!![]}];}_0x438dc9=_['merge']({},_0x438dc9,_0x3e3606[_0x5f4f('0x48')]);return db['UserProfile'][_0x5f4f('0x49')](_0x438dc9)[_0x5f4f('0x26')](handleEntityNotFound(_0x55d6c0,null))[_0x5f4f('0x26')](function(_0x5554ea){if(_0x5554ea){var _0x487c8f=_0x5554ea[_0x5f4f('0x4a')]({'plain':!![]});_0x487c8f=qs[_0x5f4f('0x4b')](_0x487c8f,['id',_0x5f4f('0x4c'),'updatedAt','crudPermissions']);_0x3e3606[_0x5f4f('0x4d')]=_['omit'](_0x3e3606['body'],['id','createdAt','updatedAt']);return db[_0x5f4f('0x4e')][_0x5f4f('0x4f')](function(_0x39da9e){return db[_0x5f4f('0x3f')][_0x5f4f('0x46')](_['merge'](_0x487c8f,_0x3e3606[_0x5f4f('0x4d')]),{'include':_0x3e3606[_0x5f4f('0x2f')][_0x5f4f('0x3d')]?[{'all':!![]}]:undefined,'transaction':_0x39da9e})['then'](function(_0x26d731){var _0x288e41=_0x26d731['get']({'plain':!![]});return db[_0x5f4f('0x50')][_0x5f4f('0x40')]({'where':{'userProfileId':_0x3e3606[_0x5f4f('0x44')]['id']},'raw':!![]})['then'](function(_0xf9941b){if(_0xf9941b){return BPromise[_0x5f4f('0x51')](_0xf9941b,function(_0x11b8ed){return new BPromise(function(_0x3bf37c,_0x204a2d){if(_0x11b8ed[_0x5f4f('0x52')]===null||_0x11b8ed[_0x5f4f('0x52')]===0x1)_0x3bf37c(null);return db['UserProfileResource'][_0x5f4f('0x40')]({'where':{'sectionId':_0x11b8ed['id']},'raw':!![]})[_0x5f4f('0x26')](function(_0x5e7715){var _0x3e7823=_['map'](_0x5e7715,function(_0x33ab53){return qs[_0x5f4f('0x4b')](_0x33ab53,['id',_0x5f4f('0x4c'),_0x5f4f('0x53'),_0x5f4f('0x54')]);});_0x3bf37c(_0x3e7823);})[_0x5f4f('0x42')](function(_0x3a121d){_0x204a2d(_0x3a121d);});})[_0x5f4f('0x26')](function(_0x4e4135){var _0x781c82=qs['omit'](_0x11b8ed,['id',_0x5f4f('0x4c'),_0x5f4f('0x53')]);_0x781c82[_0x5f4f('0x55')]=_0x288e41['id'];if(_0x4e4135)_0x781c82['Resources']=_0x4e4135;return _0x781c82;})[_0x5f4f('0x26')](function(_0x4a7b42){return db['UserProfileSection'][_0x5f4f('0x46')](_0x4a7b42,{'include':[{'model':db[_0x5f4f('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x39da9e});});})[_0x5f4f('0x26')](function(){return _0x288e41;});}});});});}})[_0x5f4f('0x26')](respondWithResult(_0x55d6c0,0xc9))[_0x5f4f('0x42')](handleError(_0x55d6c0,null));};exports['update']=function(_0x415055,_0x490c95){if(_0x415055[_0x5f4f('0x4d')]['id']){delete _0x415055[_0x5f4f('0x4d')]['id'];}return db[_0x5f4f('0x3f')]['find']({'where':{'id':_0x415055[_0x5f4f('0x44')]['id']}})['then'](handleEntityNotFound(_0x490c95,null))[_0x5f4f('0x26')](saveUpdates(_0x415055['body'],null))[_0x5f4f('0x26')](respondWithResult(_0x490c95,null))['catch'](handleError(_0x490c95,null));};exports[_0x5f4f('0x27')]=function(_0x421776,_0x19e5c4){return db[_0x5f4f('0x3f')][_0x5f4f('0x49')]({'where':{'id':_0x421776[_0x5f4f('0x44')]['id']}})['then'](handleEntityNotFound(_0x19e5c4,null))[_0x5f4f('0x26')](removeEntity(_0x19e5c4,null))[_0x5f4f('0x42')](handleError(_0x19e5c4,null));};exports['describe']=function(_0x17e8aa,_0x12b139){return db['UserProfile'][_0x5f4f('0x57')]()[_0x5f4f('0x26')](respondWithResult(_0x12b139,null))[_0x5f4f('0x42')](handleError(_0x12b139,null));};exports['addSections']=function(_0xe6d154,_0x54d415){var _0x250dc4=_0xe6d154['body'];return db['UserProfile']['find']({'where':{'id':_0xe6d154[_0x5f4f('0x44')]['id']}})[_0x5f4f('0x26')](handleEntityNotFound(_0x54d415,null))['then'](function(_0x1ac2f8){if(_0x1ac2f8){return db[_0x5f4f('0x4e')][_0x5f4f('0x4f')](function(_0x3787bc){return db[_0x5f4f('0x50')][_0x5f4f('0x27')]({'where':{'userProfileId':_0xe6d154[_0x5f4f('0x44')]['id'],'sectionId':_[_0x5f4f('0x39')](_0x250dc4,function(_0x16092b){return _0x16092b[_0x5f4f('0x54')];})},'transaction':_0x3787bc})[_0x5f4f('0x26')](function(){var _0x19ee42=_[_0x5f4f('0x39')](_0x250dc4,function(_0x43e096){_0x43e096[_0x5f4f('0x55')]=_0xe6d154['params']['id'];return _0x43e096;});var _0x4330a1=[];return BPromise['each'](_0x19ee42,function(_0x2ea8db){return db['UserProfileSection'][_0x5f4f('0x46')](_0x2ea8db,{'include':[{'model':db['UserProfileResource'],'as':_0x5f4f('0x58')}],'raw':!![],'transaction':_0x3787bc})['then'](function(_0x820474){_0x4330a1['push'](_0x820474[_0x5f4f('0x4a')]({'plain':!![]}));});})[_0x5f4f('0x26')](function(){return _0x4330a1;});});});}})['then'](function(_0x59b140){return _0x59b140;})[_0x5f4f('0x26')](respondWithResult(_0x54d415,null))[_0x5f4f('0x42')](handleError(_0x54d415,null));};exports[_0x5f4f('0x59')]=function(_0x3f6dcd,_0x4c8e8f){var _0x2241dc;return db['UserProfile'][_0x5f4f('0x49')]({'where':{'id':_0x3f6dcd[_0x5f4f('0x44')]['id']},'attributes':['id','name']})[_0x5f4f('0x26')](handleEntityNotFound(_0x4c8e8f,null))[_0x5f4f('0x26')](function(_0x3b7a0f){if(_0x3b7a0f){_0x2241dc=_0x3b7a0f;return db[_0x5f4f('0x50')][_0x5f4f('0x27')]({'where':{'userProfileId':_0x3f6dcd['params']['id'],'sectionId':_0x3f6dcd[_0x5f4f('0x2f')][_0x5f4f('0x5a')]}});}})[_0x5f4f('0x26')](function(){return _0x2241dc;})[_0x5f4f('0x26')](respondWithStatusCode(_0x4c8e8f,null))[_0x5f4f('0x42')](handleError(_0x4c8e8f,null));};exports[_0x5f4f('0x5b')]=function(_0x20b1e5,_0x3aefc5){return db[_0x5f4f('0x3f')][_0x5f4f('0x49')]({'where':{'id':_0x20b1e5['params']['id']}})[_0x5f4f('0x26')](handleEntityNotFound(_0x3aefc5,null))[_0x5f4f('0x26')](function(_0x3ef778){if(_0x3ef778){return db[_0x5f4f('0x4e')][_0x5f4f('0x4f')](function(_0x175e12){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x20b1e5[_0x5f4f('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0x5f4f('0x26')](function(_0x5857dd){if(_0x5857dd){return db[_0x5f4f('0x50')][_0x5f4f('0x27')]({'where':{'userProfileId':_0x20b1e5[_0x5f4f('0x44')]['id'],'id':_[_0x5f4f('0x39')](_0x5857dd,function(_0x2ef161){return _0x2ef161['id'];})},'transaction':_0x175e12});}})[_0x5f4f('0x26')](function(_0x41441b){var _0x1339e5=_['map'](_0x20b1e5['body'],function(_0x14f707){_0x14f707[_0x5f4f('0x55')]=_0x20b1e5[_0x5f4f('0x44')]['id'];return _0x14f707;});return db[_0x5f4f('0x50')][_0x5f4f('0x5c')](_0x1339e5,{'raw':!![],'transaction':_0x175e12});})[_0x5f4f('0x26')](function(_0x2f109b){var _0xf48d2=_['filter'](_[_0x5f4f('0x39')](_0x2f109b,function(_0x20dd34){return _0x20dd34[_0x5f4f('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0xf48d2){return db[_0x5f4f('0x50')]['findAll']({'where':{'userProfileId':_0x20b1e5[_0x5f4f('0x44')]['id'],'sectionId':_[_0x5f4f('0x39')](_0xf48d2,function(_0x889ba0){return _0x889ba0['sectionId'];})},'attributes':['id',_0x5f4f('0x54')],'raw':!![]})['then'](function(_0x270eb0){var _0x1a4166=_[_0x5f4f('0x39')](_0x20b1e5[_0x5f4f('0x4d')],function(_0x5d94ac){_0x5d94ac[_0x5f4f('0x55')]=_0x20b1e5[_0x5f4f('0x44')]['id'];return _0x5d94ac;});return db[_0x5f4f('0x56')][_0x5f4f('0x5c')](_0x1a4166,{'raw':!![],'transaction':_0x175e12});});}})[_0x5f4f('0x42')](handleError(_0x3aefc5,null));});}})[_0x5f4f('0x26')](function(_0x5b6400){var _0x268227=_[_0x5f4f('0x39')](_0x5b6400,function(_0x2cae4e){return _0x2cae4e[_0x5f4f('0x4a')]({'plain':!![]});});})[_0x5f4f('0x26')](respondWithResult(_0x3aefc5,null))[_0x5f4f('0x42')](handleError(_0x3aefc5,null));};exports[_0x5f4f('0x5d')]=function(_0xdd3c56,_0x584f03,_0x30038f){var _0x17aece;return db['UserProfile'][_0x5f4f('0x49')]({'where':{'id':_0xdd3c56[_0x5f4f('0x44')]['id']}})[_0x5f4f('0x26')](handleEntityNotFound(_0x584f03,null))['then'](function(_0x4e5297){if(_0x4e5297){return _0x4e5297[_0x5f4f('0x5d')](_0xdd3c56['query'][_0x5f4f('0x5a')]);}})[_0x5f4f('0x26')](respondWithStatusCode(_0x584f03,null))[_0x5f4f('0x42')](handleError(_0x584f03,null));};exports[_0x5f4f('0x5e')]=function(_0x898037,_0x75d9d8){var _0x1f916e={'raw':![],'where':{}};var _0x27f3bc={};var _0x1f1bae={'count':0x0,'rows':[]};var _0x3bfde9=_0x898037['query']['section'];if(typeof _0x3bfde9===_0x5f4f('0x5f')){throw new db[(_0x5f4f('0x60'))][(_0x5f4f('0x61'))]('Unknown\x20section');}var _0x214d64=_0x898037[_0x5f4f('0x2f')][_0x5f4f('0x62')]||![];var _0x235bf8=getQueryModels(_0x3bfde9,_0x214d64);if(typeof _0x235bf8[_0x5f4f('0x63')]===_0x5f4f('0x5f')){throw new db[(_0x5f4f('0x60'))][(_0x5f4f('0x61'))]('Invalid\x20section\x20\x27'+_0x3bfde9+'\x27');}var _0x5de28c=[];if(!_[_0x5f4f('0x64')](_0x235bf8[_0x5f4f('0x65')])){_0x5de28c=_0x235bf8[_0x5f4f('0x65')];}else{_0x5de28c=[{'name':_0x3bfde9}];}return db[_0x5f4f('0x3f')][_0x5f4f('0x66')]({'where':{'id':_0x898037['params']['id']}})[_0x5f4f('0x26')](handleEntityNotFound(_0x75d9d8,null))[_0x5f4f('0x26')](function(_0x4329dc){if(_0x4329dc){var _0x5df90a=[];for(var _0x3de282=0x0;_0x3de282<_0x5de28c[_0x5f4f('0x33')];_0x3de282++){_0x5df90a['push'](db[_0x5f4f('0x50')][_0x5f4f('0x66')]({'where':{'userProfileId':_0x4329dc['id'],'name':_0x5de28c[_0x3de282][_0x5f4f('0x29')]},'raw':!![]}));}return BPromise[_0x5f4f('0x67')](_0x5df90a);}})[_0x5f4f('0x26')](function(_0x42dd7a){var _0x5b798d=_['filter'](_0x42dd7a,function(_0x860bde){return _0x860bde?_0x860bde:undefined;});var _0xe39f31=_[_0x5f4f('0x3c')](_0x5de28c,[_0x5f4f('0x68'),!![]]);var _0x85ee9c=_[_0x5f4f('0x64')](_0x5b798d)&&_[_0x5f4f('0x64')](_0xe39f31)?null:_[_0x5f4f('0x69')](_0xe39f31,_0x5b798d);if(_0x85ee9c){var _0xd5f231=[];for(var _0x2dfa92=0x0;_0x2dfa92<_0x85ee9c[_0x5f4f('0x33')];_0x2dfa92++){var _0x1a9a65=_[_0x5f4f('0x49')](_0x5de28c,function(_0x4adcd6){return _0x85ee9c[_0x2dfa92]?_0x4adcd6[_0x5f4f('0x29')]===_0x85ee9c[_0x2dfa92][_0x5f4f('0x29')]:null;});if(_0x1a9a65){if(_0x85ee9c[_0x2dfa92][_0x5f4f('0x68')]){_0xd5f231[_0x5f4f('0x6a')](getAllResources(_0x235bf8[_0x5f4f('0x63')],_0x85ee9c[_0x2dfa92]));}else{if(!_0x85ee9c[_0x2dfa92][_0x5f4f('0x52')]){_0xd5f231[_0x5f4f('0x6a')](getAllowedResources(_0x1a9a65,_0x85ee9c[_0x2dfa92]));}else{if(_0x1a9a65[_0x5f4f('0x2d')]){_0xd5f231[_0x5f4f('0x6a')](getAllFilteredResources(_0x1a9a65,_0x85ee9c[_0x2dfa92]));}}}}}return BPromise[_0x5f4f('0x67')](_0xd5f231);}else{return null;}})['then'](function(_0xb7fade){var _0x568666=_0xb7fade;var _0x30c9fe=null;if(_0x568666){_0x30c9fe=_0x568666[_0x5f4f('0x33')]===0x1?_0x568666[0x0]:null;}if(_0x30c9fe||_0x568666){var _0x3ca628=db[_0x235bf8['childModel']][_0x5f4f('0x2c')];_0x27f3bc[_0x5f4f('0x2d')]=_['keys'](_0x3ca628);_0x27f3bc[_0x5f4f('0x2f')]=_[_0x5f4f('0x2e')](_0x898037[_0x5f4f('0x2f')]);_0x27f3bc[_0x5f4f('0x30')]=_[_0x5f4f('0x45')](_0x27f3bc[_0x5f4f('0x2d')],_0x27f3bc[_0x5f4f('0x2f')]);_0x1f916e[_0x5f4f('0x31')]=_[_0x5f4f('0x45')](_0x27f3bc[_0x5f4f('0x2d')],qs[_0x5f4f('0x32')](_0x898037[_0x5f4f('0x2f')][_0x5f4f('0x32')]));_0x1f916e[_0x5f4f('0x31')]=_0x1f916e[_0x5f4f('0x31')]['length']?_0x1f916e[_0x5f4f('0x31')]:_0x27f3bc[_0x5f4f('0x2d')];if(!_0x898037['query'][_0x5f4f('0x34')]('nolimit')){_0x1f916e[_0x5f4f('0x22')]=qs[_0x5f4f('0x22')](_0x898037[_0x5f4f('0x2f')]['limit']);_0x1f916e[_0x5f4f('0x21')]=qs[_0x5f4f('0x21')](_0x898037[_0x5f4f('0x2f')]['offset']);}_0x1f916e[_0x5f4f('0x36')]=qs[_0x5f4f('0x6b')](_0x898037[_0x5f4f('0x2f')]['sort']);_0x1f916e[_0x5f4f('0x37')]=qs['filters'](_[_0x5f4f('0x6c')](_0x898037[_0x5f4f('0x2f')],_0x27f3bc[_0x5f4f('0x30')]));if(_0x898037[_0x5f4f('0x2f')][_0x5f4f('0x3c')]){_0x1f916e['where']=_[_0x5f4f('0x38')](_0x1f916e[_0x5f4f('0x37')],{'$or':_[_0x5f4f('0x39')](_0x3ca628,function(_0x1d0b1b){if(_0x1d0b1b['type'][_0x5f4f('0x6d')]!==_0x5f4f('0x3a')){var _0x27c5bb={};_0x27c5bb[_0x1d0b1b['field']]={'$like':'%'+_0x898037[_0x5f4f('0x2f')]['filter']+'%'};return _0x27c5bb;}})});}var _0x4478a1=[];if(_0x30c9fe){var _0x125870=_[_0x5f4f('0x49')](_0x5de28c,[_0x5f4f('0x29'),_0x30c9fe[_0x5f4f('0x29')]]);if(_0x125870[_0x5f4f('0x3b')]){var _0x3fb0e0={};_0x3fb0e0[_0x125870[_0x5f4f('0x6e')]]=_0x30c9fe[_0x5f4f('0x6f')];_0x4478a1['push'](_0x3fb0e0);}else{_0x1f916e[_0x5f4f('0x37')]['id']=_0x30c9fe[_0x5f4f('0x6f')];}}else{for(var _0x4a2047=0x0;_0x4a2047<_0x568666[_0x5f4f('0x33')];_0x4a2047++){var _0x125870=_[_0x5f4f('0x49')](_0x5de28c,['name',_0x568666[_0x4a2047][_0x5f4f('0x29')]]);if(_0x125870[_0x5f4f('0x3b')]){var _0x3fb0e0={};_0x3fb0e0[_0x125870[_0x5f4f('0x6e')]]=_0x568666[_0x4a2047]['associatedResources'];_0x4478a1['push'](_0x3fb0e0);}else{if(!_0x1f916e[_0x5f4f('0x37')]['id'])_0x1f916e[_0x5f4f('0x37')]['id']=[];_0x568666[_0x4a2047][_0x5f4f('0x6f')]['forEach'](function(_0x1fc049){_0x1f916e['where']['id'][_0x5f4f('0x6a')](_0x1fc049);});}}}if(!_[_0x5f4f('0x64')](_0x4478a1)){_0x1f916e[_0x5f4f('0x37')]=_[_0x5f4f('0x38')](_0x1f916e[_0x5f4f('0x37')],{'$and':{'$or':_0x4478a1}});}_0x1f916e=_[_0x5f4f('0x38')]({},_0x1f916e,_0x898037['options']);if(_0x30c9fe&&!_0x30c9fe['autoAssociation']&&_0x235bf8[_0x5f4f('0x63')]==='AnalyticExtractedReport'){if(_0x898037[_0x5f4f('0x2f')][_0x5f4f('0x3d')]){_0x1f916e['include']=[{'all':!![]}];}return db[_0x235bf8[_0x5f4f('0x63')]][_0x5f4f('0x40')](_0x1f916e)[_0x5f4f('0x26')](function(_0x267b78){var _0x22753f=[];_0x267b78[_0x5f4f('0x70')](function(_0x41ea3c){var _0x11c341;switch(_0x41ea3c[_0x5f4f('0x71')]){case _0x5f4f('0x72'):_0x11c341=_[_0x5f4f('0x49')](_0x30c9fe[_0x5f4f('0x6f')],function(_0x124d92){return _0x124d92['id']===_0x41ea3c['reportId']&&_0x124d92[_0x5f4f('0x73')]===_0x5f4f('0x74');});break;case'custom':_0x11c341=_[_0x5f4f('0x49')](_0x30c9fe[_0x5f4f('0x6f')],function(_0x3d4342){return _0x3d4342['id']===_0x41ea3c[_0x5f4f('0x75')]&&_0x3d4342[_0x5f4f('0x73')]===_0x5f4f('0x76');});break;}if(_0x11c341)_0x22753f[_0x5f4f('0x6a')](_0x41ea3c);});_0x1f1bae['count']=_0x22753f[_0x5f4f('0x33')];_0x1f1bae[_0x5f4f('0x41')]=_0x22753f;return _0x1f1bae;});}else{return db[_0x235bf8[_0x5f4f('0x63')]][_0x5f4f('0x20')]({'where':_0x1f916e[_0x5f4f('0x37')]})[_0x5f4f('0x26')](function(_0x1ec11c){_0x1f1bae[_0x5f4f('0x20')]=_0x1ec11c;if(_0x898037[_0x5f4f('0x2f')][_0x5f4f('0x3d')]){if(_0x235bf8[_0x5f4f('0x63')]===_0x5f4f('0x77')){_0x1f916e[_0x5f4f('0x3e')]=[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x5f4f('0x29'),'color'],'required':_0x898037[_0x5f4f('0x2f')][_0x5f4f('0x78')]?!![]:![]},{'model':db[_0x5f4f('0x79')],'as':_0x5f4f('0x7a'),'attributes':['id',_0x5f4f('0x29'),_0x5f4f('0x7b')],'through':_0x898037[_0x5f4f('0x2f')][_0x5f4f('0x78')]?{'attributes':[],'where':{'TagId':_0x898037[_0x5f4f('0x2f')][_0x5f4f('0x78')]||undefined}}:{},'required':_0x898037['query'][_0x5f4f('0x78')]?!![]:![]}];}else{_0x1f916e[_0x5f4f('0x3e')]=[{'all':!![]}];}}return db[_0x235bf8[_0x5f4f('0x63')]][_0x5f4f('0x40')](_0x1f916e);})[_0x5f4f('0x26')](function(_0x4549e0){_0x1f1bae[_0x5f4f('0x41')]=_0x4549e0;return _0x1f1bae;});}}else{return _0x1f1bae;}})[_0x5f4f('0x26')](respondWithFilteredResult(_0x75d9d8,_0x1f916e))[_0x5f4f('0x42')](handleError(_0x75d9d8,null));};function getAllResources(_0x5e257e,_0x328a3a){return new BPromise(function(_0x1255b2,_0x302a5b){if(_0x328a3a){var _0x4d85f8=_0x328a3a[_0x5f4f('0x3c')]?{[_0x328a3a[_0x5f4f('0x3c')]['field']]:_0x328a3a[_0x5f4f('0x3c')][_0x5f4f('0x7c')]}:undefined;return db[_0x5e257e][_0x5f4f('0x40')]({'where':_0x4d85f8,'raw':!![]})['then'](function(_0x348683){_0x328a3a[_0x5f4f('0x6f')]=_[_0x5f4f('0x39')](_0x348683,'id');_0x1255b2(_0x328a3a);})[_0x5f4f('0x42')](function(_0xf0680){_0x302a5b(_0xf0680);});}else{_0x1255b2(null);}});}function getAllFilteredResources(_0x5e3590,_0x57ba1d){return new BPromise(function(_0x1ea741,_0x58bd20){var _0x2fae4f=_0x5e3590['filter']?{[_0x5e3590[_0x5f4f('0x3c')]['field']]:_0x5e3590[_0x5f4f('0x3c')]['value']}:undefined;return db[_0x5e3590['model']][_0x5f4f('0x40')]({'where':_0x2fae4f,'raw':!![]})[_0x5f4f('0x26')](function(_0x207768){_0x57ba1d[_0x5f4f('0x6f')]=_['map'](_0x207768,function(_0x273cc3){return _0x273cc3[_0x5f4f('0x29')];});_0x1ea741(_0x57ba1d);})[_0x5f4f('0x42')](function(_0xad2081){_0x58bd20(_0xad2081);});});}function getAllowedResources(_0x20ad88,_0x5b7461){return new BPromise(function(_0x3f9bf3,_0x24cc6f){if(_0x5b7461){return db[_0x5f4f('0x56')][_0x5f4f('0x40')]({'where':{'sectionId':_0x5b7461['id']},'raw':!![]})[_0x5f4f('0x26')](function(_0x26520f){if(_0x20ad88[_0x5f4f('0x3b')]&&_0x20ad88[_0x5f4f('0x3b')]!=='id'){_0x5b7461[_0x5f4f('0x6f')]=_[_0x5f4f('0x39')](_0x26520f,function(_0x542d47){return _0x542d47[_0x20ad88[_0x5f4f('0x3b')]];});}else{if(_0x20ad88[_0x5f4f('0x63')]===_0x5f4f('0x7d')){_0x5b7461[_0x5f4f('0x6f')]=_[_0x5f4f('0x39')](_0x26520f,function(_0x1d500c){return{'id':_0x1d500c['resourceId'],'type':_0x1d500c['type']};});}else{_0x5b7461[_0x5f4f('0x6f')]=_[_0x5f4f('0x39')](_0x26520f,function(_0x2acd5b){return _0x2acd5b[_0x5f4f('0x7e')];});}}_0x3f9bf3(_0x5b7461);})[_0x5f4f('0x42')](function(_0x19f0eb){_0x24cc6f(_0x19f0eb);});}else{_0x3f9bf3(null);}});}function getQueryModels(_0x1830d0,_0x23b1df){var _0x272433=_0x1830d0[_0x5f4f('0x7f')]();var _0x7aedd3={'childModel':undefined,'parentSections':[]};switch(_0x272433){case _0x5f4f('0x80'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x81');break;case _0x5f4f('0x82'):_0x7aedd3[_0x5f4f('0x63')]='SquareOdbc';break;case'squarerecordings':_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x83');_0x7aedd3['parentSections']=[{'name':_0x5f4f('0x84'),'field':_0x5f4f('0x29'),'foreignKey':_0x5f4f('0x85')}];break;case _0x5f4f('0x86'):_0x7aedd3['childModel']='JscriptyProject';break;case _0x5f4f('0x87'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x77');_0x7aedd3[_0x5f4f('0x65')]=[{'name':_0x5f4f('0x88'),'field':'id','foreignKey':'ListId'}];break;case _0x5f4f('0x89'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x8a');break;case'companies':_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x8b');break;case _0x5f4f('0x8c'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x8d');break;case _0x5f4f('0x8e'):_0x7aedd3['childModel']=_0x5f4f('0x8f');break;case _0x5f4f('0x90'):_0x7aedd3[_0x5f4f('0x63')]='ChatWebsite';break;case'faxqueues':_0x7aedd3['childModel']=_0x5f4f('0x91');break;case _0x5f4f('0x92'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x93');break;case _0x5f4f('0x94'):case _0x5f4f('0x95'):case _0x5f4f('0x96'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x97');break;case _0x5f4f('0x98'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x99');break;case'voicemails':_0x7aedd3[_0x5f4f('0x63')]='VoiceMail';break;case _0x5f4f('0x9a'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x9b');_0x7aedd3[_0x5f4f('0x65')]=[{'name':_0x5f4f('0x9c'),'field':'name','foreignKey':_0x5f4f('0x9d'),'model':'User','filter':{'field':_0x5f4f('0x9e'),'value':[_0x5f4f('0x9f')]}},{'name':'Telephones','field':_0x5f4f('0x29'),'foreignKey':_0x5f4f('0x9d'),'model':_0x5f4f('0xa0'),'filter':{'field':_0x5f4f('0x9e'),'value':[_0x5f4f('0xa1')]}},{'name':'VoiceQueues','field':_0x5f4f('0x29'),'foreignKey':_0x5f4f('0xa2'),'model':_0x5f4f('0xa3'),'filter':{'field':_0x5f4f('0x73'),'value':[_0x5f4f('0xa4')]}},{'name':_0x5f4f('0xa5'),'field':_0x5f4f('0x29'),'foreignKey':_0x5f4f('0xa2'),'model':_0x5f4f('0xa3'),'filter':{'field':_0x5f4f('0x73'),'value':[_0x5f4f('0xa6')]}}];break;case'musiconholds':_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xa7');break;case _0x5f4f('0xa8'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xa9');break;case _0x5f4f('0xaa'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xab');break;case'ivrcampaigns':_0x7aedd3[_0x5f4f('0x63')]='Campaign';break;case _0x5f4f('0xac'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xad');break;case _0x5f4f('0xae'):_0x7aedd3['childModel']='MailAccount';break;case _0x5f4f('0xaf'):_0x7aedd3[_0x5f4f('0x63')]='MailSubstatus';break;case _0x5f4f('0xb0'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xb1');break;case _0x5f4f('0xb2'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xb3');break;case _0x5f4f('0xb4'):_0x7aedd3['childModel']=_0x5f4f('0xb5');break;case'smsaccounts':_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xb6');break;case _0x5f4f('0xb7'):_0x7aedd3['childModel']=_0x5f4f('0xb8');break;case _0x5f4f('0xb9'):case _0x5f4f('0xba'):_0x7aedd3[_0x5f4f('0x63')]='VoiceQueue';if(_0x23b1df){_0x7aedd3['parentSections']=[{'name':_0x5f4f('0xbb')},{'name':_0x5f4f('0xa5')}];}break;case _0x5f4f('0xbc'):case _0x5f4f('0xbd'):case'telephones':_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xa0');if(_0x23b1df){_0x7aedd3[_0x5f4f('0x65')]=[{'name':_0x5f4f('0xbe'),'filter':{'field':_0x5f4f('0x9e'),'value':[_0x5f4f('0xbf'),'user']},'ignore':!![]},{'name':_0x5f4f('0x9c')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x7aedd3[_0x5f4f('0x63')]='ZendeskAccount';break;case _0x5f4f('0xc0'):_0x7aedd3[_0x5f4f('0x63')]='SalesforceAccount';break;case _0x5f4f('0xc1'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xc2');break;case _0x5f4f('0xc3'):_0x7aedd3['childModel']=_0x5f4f('0xc4');break;case _0x5f4f('0xc5'):_0x7aedd3['childModel']=_0x5f4f('0xc6');break;case _0x5f4f('0xc7'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xc8');break;case _0x5f4f('0xc9'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xa0');break;case _0x5f4f('0xca'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xcb');break;case _0x5f4f('0xcc'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xcd');break;case'customdashboards':_0x7aedd3[_0x5f4f('0x63')]='Dashboard';break;case _0x5f4f('0xce'):_0x7aedd3[_0x5f4f('0x63')]='Interval';break;case _0x5f4f('0xcf'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xd0');break;case _0x5f4f('0xd1'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xd2');break;case _0x5f4f('0xd3'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xd4');break;case _0x5f4f('0xd5'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x79');break;case _0x5f4f('0xd6'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xd7');break;case'triggers':_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xd8');break;case _0x5f4f('0xd9'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xda');break;case'variables':_0x7aedd3[_0x5f4f('0x63')]='Variable';break;case _0x5f4f('0xdb'):_0x7aedd3[_0x5f4f('0x63')]='Plugin';break;case _0x5f4f('0xdc'):_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0x7d');_0x7aedd3['parentSections']=[{'name':_0x5f4f('0xdd'),'field':'id','foreignKey':_0x5f4f('0x75')}];break;case'metrics':_0x7aedd3[_0x5f4f('0x63')]=_0x5f4f('0xde');break;default:return _0x7aedd3;}return _0x7aedd3;} \ No newline at end of file +var _0x6e06=['crypto','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','defaults','redis','localhost','./userProfile.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','rawAttributes','model','keys','filters','intersection','fields','attributes','length','query','hasOwnProperty','order','pick','filter','where','merge','map','type','VIRTUAL','field','options','UserProfile','includeAll','findAll','rows','catch','show','params','include','find','create','body','clone','get','omit','createdAt','updatedAt','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','transaction','push','ids','addResources','bulkCreate','removeResources','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','childModel','Invalid\x20section\x20\x27','isEmpty','findOne','all','ignore','union','nolimit','sort','foreignKey','associatedResources','forEach','AnalyticExtractedReport','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tags','Tag','ThroughTags','color','tag','value','resourceId','toLowerCase','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','projectName','projects','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','faxaccounts','FaxAccount','inboundroutes','outboundroutes','contexts','voicemails','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsAccount','teams','Team','voicequeues','users','agents','User','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Schedule','Sound','tags','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x33132c,_0x34c8e0){var _0x1160bb=function(_0x403df9){while(--_0x403df9){_0x33132c['push'](_0x33132c['shift']());}};_0x1160bb(++_0x34c8e0);}(_0x6e06,0xd4));var _0x66e0=function(_0x51f1bf,_0x402d95){_0x51f1bf=_0x51f1bf-0x0;var _0x481842=_0x6e06[_0x51f1bf];return _0x481842;};'use strict';var pdf=require(_0x66e0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x66e0('0x1'));var zipdir=require(_0x66e0('0x2'));var jsonpatch=require(_0x66e0('0x3'));var rp=require(_0x66e0('0x4'));var moment=require(_0x66e0('0x5'));var BPromise=require(_0x66e0('0x6'));var Mustache=require(_0x66e0('0x7'));var util=require(_0x66e0('0x8'));var path=require(_0x66e0('0x9'));var sox=require(_0x66e0('0xa'));var csv=require(_0x66e0('0xb'));var ejs=require(_0x66e0('0xc'));var fs=require('fs');var _=require(_0x66e0('0xd'));var squel=require(_0x66e0('0xe'));var crypto=require(_0x66e0('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x66e0('0x10'));var toCsv=require(_0x66e0('0xb'));var querystring=require('querystring');var Papa=require(_0x66e0('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0x66e0('0x12'));var Redis=require(_0x66e0('0x13'));var qs=require(_0x66e0('0x14'));var logger=require('../../config/logger')(_0x66e0('0x15'));var utils=require(_0x66e0('0x16'));var config=require('../../config/environment');var db=require(_0x66e0('0x17'))['db'];config['redis']=_[_0x66e0('0x18')](config[_0x66e0('0x19')],{'host':_0x66e0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x66e0('0x19')]));require(_0x66e0('0x1b'))[_0x66e0('0x1c')](socket);function respondWithStatusCode(_0x117a61,_0x397f6c){_0x397f6c=_0x397f6c||0xcc;return function(_0x1cd191){if(_0x1cd191){return _0x117a61[_0x66e0('0x1d')](_0x397f6c);}return _0x117a61[_0x66e0('0x1e')](_0x397f6c)[_0x66e0('0x1f')]();};}function respondWithResult(_0x5579da,_0x292106){_0x292106=_0x292106||0xc8;return function(_0x32a6ba){if(_0x32a6ba){return _0x5579da[_0x66e0('0x1e')](_0x292106)[_0x66e0('0x20')](_0x32a6ba);}};}function respondWithFilteredResult(_0x2319d3,_0xa12d39){return function(_0x2771af){if(_0x2771af){var _0x5d5988=_0x2771af[_0x66e0('0x21')],_0x3a7d38=_0xa12d39[_0x66e0('0x22')],_0x31a131=_0xa12d39[_0x66e0('0x22')]+_0xa12d39[_0x66e0('0x23')],_0x37a5ee;if(_0x31a131>=_0x5d5988){_0x31a131=_0x5d5988;_0x37a5ee=0xc8;}else{_0x37a5ee=0xce;}_0x2319d3[_0x66e0('0x1e')](_0x37a5ee);return _0x2319d3[_0x66e0('0x24')](_0x66e0('0x25'),_0x3a7d38+'-'+_0x31a131+'/'+_0x5d5988)[_0x66e0('0x20')](_0x2771af);}return null;};}function patchUpdates(_0x5321d1){return function(_0x2713f8){try{jsonpatch['apply'](_0x2713f8,_0x5321d1,!![]);}catch(_0x10a0e1){return BPromise[_0x66e0('0x26')](_0x10a0e1);}return _0x2713f8[_0x66e0('0x27')]();};}function saveUpdates(_0x3af5b1,_0x441218){return function(_0x52066a){if(_0x52066a){return _0x52066a['update'](_0x3af5b1)[_0x66e0('0x28')](function(_0x24ac34){return _0x24ac34;});}return null;};}function removeEntity(_0x4709b1,_0x6369a6){return function(_0x453faf){if(_0x453faf){return _0x453faf[_0x66e0('0x29')]()[_0x66e0('0x28')](function(){_0x4709b1[_0x66e0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x174d9b,_0x6b4ed7){return function(_0x48cb06){if(!_0x48cb06){_0x174d9b[_0x66e0('0x1d')](0x194);}return _0x48cb06;};}function handleError(_0x470d0e,_0x2ddc04){_0x2ddc04=_0x2ddc04||0x1f4;return function(_0x4f59d4){logger[_0x66e0('0x2a')](_0x4f59d4['stack']);if(_0x4f59d4[_0x66e0('0x2b')]){delete _0x4f59d4[_0x66e0('0x2b')];}_0x470d0e[_0x66e0('0x1e')](_0x2ddc04)[_0x66e0('0x2c')](_0x4f59d4);};}exports[_0x66e0('0x2d')]=function(_0x10572d,_0x559796){var _0x150044={},_0x3d8122={},_0x72b5e8={'count':0x0,'rows':[]};var _0x41c076=db['UserProfile'][_0x66e0('0x2e')];_0x3d8122[_0x66e0('0x2f')]=_[_0x66e0('0x30')](_0x41c076);_0x3d8122['query']=_[_0x66e0('0x30')](_0x10572d['query']);_0x3d8122[_0x66e0('0x31')]=_[_0x66e0('0x32')](_0x3d8122[_0x66e0('0x2f')],_0x3d8122['query']);_0x150044['attributes']=_[_0x66e0('0x32')](_0x3d8122[_0x66e0('0x2f')],qs[_0x66e0('0x33')](_0x10572d['query'][_0x66e0('0x33')]));_0x150044[_0x66e0('0x34')]=_0x150044['attributes'][_0x66e0('0x35')]?_0x150044[_0x66e0('0x34')]:_0x3d8122[_0x66e0('0x2f')];if(!_0x10572d[_0x66e0('0x36')][_0x66e0('0x37')]('nolimit')){_0x150044[_0x66e0('0x23')]=qs[_0x66e0('0x23')](_0x10572d[_0x66e0('0x36')][_0x66e0('0x23')]);_0x150044['offset']=qs[_0x66e0('0x22')](_0x10572d[_0x66e0('0x36')]['offset']);}_0x150044[_0x66e0('0x38')]=qs['sort'](_0x10572d['query']['sort']);_0x150044['where']=qs[_0x66e0('0x31')](_[_0x66e0('0x39')](_0x10572d[_0x66e0('0x36')],_0x3d8122[_0x66e0('0x31')]));if(_0x10572d[_0x66e0('0x36')][_0x66e0('0x3a')]){_0x150044[_0x66e0('0x3b')]=_[_0x66e0('0x3c')](_0x150044[_0x66e0('0x3b')],{'$or':_[_0x66e0('0x3d')](_0x41c076,function(_0x16f652){if(_0x16f652[_0x66e0('0x3e')]['key']!==_0x66e0('0x3f')){var _0x21dffd={};_0x21dffd[_0x16f652[_0x66e0('0x40')]]={'$like':'%'+_0x10572d[_0x66e0('0x36')][_0x66e0('0x3a')]+'%'};return _0x21dffd;}})});}_0x150044=_[_0x66e0('0x3c')]({},_0x150044,_0x10572d[_0x66e0('0x41')]);var _0xb60a53={'where':_0x150044[_0x66e0('0x3b')]};return db[_0x66e0('0x42')]['count'](_0xb60a53)[_0x66e0('0x28')](function(_0x21bc88){_0x72b5e8['count']=_0x21bc88;if(_0x10572d[_0x66e0('0x36')][_0x66e0('0x43')]){_0x150044['include']=[{'all':!![]}];}return db[_0x66e0('0x42')][_0x66e0('0x44')](_0x150044);})[_0x66e0('0x28')](function(_0x532ffa){_0x72b5e8[_0x66e0('0x45')]=_0x532ffa;return _0x72b5e8;})[_0x66e0('0x28')](respondWithFilteredResult(_0x559796,_0x150044))[_0x66e0('0x46')](handleError(_0x559796,null));};exports[_0x66e0('0x47')]=function(_0x3cda14,_0x232e19){var _0x582673={'raw':![],'where':{'id':_0x3cda14[_0x66e0('0x48')]['id']}},_0x29d746={};_0x29d746[_0x66e0('0x2f')]=_[_0x66e0('0x30')](db[_0x66e0('0x42')]['rawAttributes']);_0x29d746['query']=_['keys'](_0x3cda14[_0x66e0('0x36')]);_0x29d746[_0x66e0('0x31')]=_[_0x66e0('0x32')](_0x29d746['model'],_0x29d746[_0x66e0('0x36')]);_0x582673[_0x66e0('0x34')]=_[_0x66e0('0x32')](_0x29d746[_0x66e0('0x2f')],qs['fields'](_0x3cda14['query'][_0x66e0('0x33')]));_0x582673['attributes']=_0x582673[_0x66e0('0x34')][_0x66e0('0x35')]?_0x582673['attributes']:_0x29d746['model'];if(_0x3cda14[_0x66e0('0x36')][_0x66e0('0x43')]){_0x582673[_0x66e0('0x49')]=[{'all':!![]}];}_0x582673=_[_0x66e0('0x3c')]({},_0x582673,_0x3cda14[_0x66e0('0x41')]);return db['UserProfile'][_0x66e0('0x4a')](_0x582673)['then'](handleEntityNotFound(_0x232e19,null))[_0x66e0('0x28')](respondWithResult(_0x232e19,null))[_0x66e0('0x46')](handleError(_0x232e19,null));};exports[_0x66e0('0x4b')]=function(_0x19666e,_0x111879){return db[_0x66e0('0x42')][_0x66e0('0x4b')](_0x19666e[_0x66e0('0x4c')],{})['then'](respondWithResult(_0x111879,0xc9))[_0x66e0('0x46')](handleError(_0x111879,null));};exports[_0x66e0('0x4d')]=function(_0x4f441b,_0x557045){var _0x3af49a={'raw':![],'where':{'id':_0x4f441b[_0x66e0('0x48')]['id']}},_0x3e3862={};_0x3e3862[_0x66e0('0x2f')]=_[_0x66e0('0x30')](db['UserProfile'][_0x66e0('0x2e')]);_0x3af49a[_0x66e0('0x34')]=_[_0x66e0('0x32')](_0x3e3862[_0x66e0('0x2f')],qs[_0x66e0('0x33')](_0x4f441b[_0x66e0('0x36')][_0x66e0('0x33')]));_0x3af49a['attributes']=_0x3af49a['attributes']['length']?_0x3af49a[_0x66e0('0x34')]:_0x3e3862[_0x66e0('0x2f')];if(_0x4f441b[_0x66e0('0x36')][_0x66e0('0x43')]){_0x3af49a[_0x66e0('0x49')]=[{'all':!![]}];}_0x3af49a=_[_0x66e0('0x3c')]({},_0x3af49a,_0x4f441b['options']);return db[_0x66e0('0x42')]['find'](_0x3af49a)[_0x66e0('0x28')](handleEntityNotFound(_0x557045,null))['then'](function(_0x4becfb){if(_0x4becfb){var _0x1a4c51=_0x4becfb[_0x66e0('0x4e')]({'plain':!![]});_0x1a4c51=qs[_0x66e0('0x4f')](_0x1a4c51,['id',_0x66e0('0x50'),'updatedAt','crudPermissions']);_0x4f441b[_0x66e0('0x4c')]=_[_0x66e0('0x4f')](_0x4f441b[_0x66e0('0x4c')],['id',_0x66e0('0x50'),_0x66e0('0x51')]);return db[_0x66e0('0x52')]['transaction'](function(_0x3f39bb){return db[_0x66e0('0x42')][_0x66e0('0x4b')](_[_0x66e0('0x3c')](_0x1a4c51,_0x4f441b[_0x66e0('0x4c')]),{'include':_0x4f441b[_0x66e0('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3f39bb})['then'](function(_0x34018a){var _0x351e74=_0x34018a[_0x66e0('0x4e')]({'plain':!![]});return db[_0x66e0('0x53')][_0x66e0('0x44')]({'where':{'userProfileId':_0x4f441b['params']['id']},'raw':!![]})['then'](function(_0x8cedd9){if(_0x8cedd9){return BPromise[_0x66e0('0x54')](_0x8cedd9,function(_0x5b819a){return new BPromise(function(_0x38dbb6,_0x1aed6d){if(_0x5b819a[_0x66e0('0x55')]===null||_0x5b819a[_0x66e0('0x55')]===0x1)_0x38dbb6(null);return db[_0x66e0('0x56')][_0x66e0('0x44')]({'where':{'sectionId':_0x5b819a['id']},'raw':!![]})[_0x66e0('0x28')](function(_0x2ece8e){var _0x40ec0d=_[_0x66e0('0x3d')](_0x2ece8e,function(_0xedf6a6){return qs[_0x66e0('0x4f')](_0xedf6a6,['id',_0x66e0('0x50'),_0x66e0('0x51'),_0x66e0('0x57')]);});_0x38dbb6(_0x40ec0d);})[_0x66e0('0x46')](function(_0x370a65){_0x1aed6d(_0x370a65);});})[_0x66e0('0x28')](function(_0x32640){var _0x56b6bd=qs[_0x66e0('0x4f')](_0x5b819a,['id',_0x66e0('0x50'),'updatedAt']);_0x56b6bd[_0x66e0('0x58')]=_0x351e74['id'];if(_0x32640)_0x56b6bd[_0x66e0('0x59')]=_0x32640;return _0x56b6bd;})[_0x66e0('0x28')](function(_0x17a6af){return db[_0x66e0('0x53')][_0x66e0('0x4b')](_0x17a6af,{'include':[{'model':db[_0x66e0('0x56')],'as':_0x66e0('0x59')}],'raw':!![],'transaction':_0x3f39bb});});})[_0x66e0('0x28')](function(){return _0x351e74;});}});});});}})[_0x66e0('0x28')](respondWithResult(_0x557045,0xc9))['catch'](handleError(_0x557045,null));};exports[_0x66e0('0x5a')]=function(_0x1f33b8,_0x13f939){if(_0x1f33b8[_0x66e0('0x4c')]['id']){delete _0x1f33b8['body']['id'];}return db[_0x66e0('0x42')][_0x66e0('0x4a')]({'where':{'id':_0x1f33b8[_0x66e0('0x48')]['id']}})[_0x66e0('0x28')](handleEntityNotFound(_0x13f939,null))[_0x66e0('0x28')](saveUpdates(_0x1f33b8[_0x66e0('0x4c')],null))[_0x66e0('0x28')](respondWithResult(_0x13f939,null))['catch'](handleError(_0x13f939,null));};exports[_0x66e0('0x29')]=function(_0x2bc05b,_0x3c6125){return db[_0x66e0('0x42')][_0x66e0('0x4a')]({'where':{'id':_0x2bc05b[_0x66e0('0x48')]['id']}})[_0x66e0('0x28')](handleEntityNotFound(_0x3c6125,null))[_0x66e0('0x28')](removeEntity(_0x3c6125,null))[_0x66e0('0x46')](handleError(_0x3c6125,null));};exports[_0x66e0('0x5b')]=function(_0x4f5412,_0x33107b){return db[_0x66e0('0x42')][_0x66e0('0x5b')]()[_0x66e0('0x28')](respondWithResult(_0x33107b,null))['catch'](handleError(_0x33107b,null));};exports[_0x66e0('0x5c')]=function(_0x5148fb,_0x578300){var _0x65509d=_0x5148fb[_0x66e0('0x4c')];return db[_0x66e0('0x42')][_0x66e0('0x4a')]({'where':{'id':_0x5148fb['params']['id']}})[_0x66e0('0x28')](handleEntityNotFound(_0x578300,null))['then'](function(_0x48ae7f){if(_0x48ae7f){return db['sequelize'][_0x66e0('0x5d')](function(_0x1cd39f){return db[_0x66e0('0x53')][_0x66e0('0x29')]({'where':{'userProfileId':_0x5148fb[_0x66e0('0x48')]['id'],'sectionId':_['map'](_0x65509d,function(_0x510e6e){return _0x510e6e[_0x66e0('0x57')];})},'transaction':_0x1cd39f})[_0x66e0('0x28')](function(){var _0x2c0bc0=_[_0x66e0('0x3d')](_0x65509d,function(_0x536c88){_0x536c88[_0x66e0('0x58')]=_0x5148fb[_0x66e0('0x48')]['id'];return _0x536c88;});var _0x1442af=[];return BPromise[_0x66e0('0x54')](_0x2c0bc0,function(_0x5bbea8){return db[_0x66e0('0x53')]['create'](_0x5bbea8,{'include':[{'model':db[_0x66e0('0x56')],'as':_0x66e0('0x59')}],'raw':!![],'transaction':_0x1cd39f})[_0x66e0('0x28')](function(_0x291452){_0x1442af[_0x66e0('0x5e')](_0x291452['get']({'plain':!![]}));});})[_0x66e0('0x28')](function(){return _0x1442af;});});});}})[_0x66e0('0x28')](function(_0x21f7a6){return _0x21f7a6;})[_0x66e0('0x28')](respondWithResult(_0x578300,null))[_0x66e0('0x46')](handleError(_0x578300,null));};exports['removeSections']=function(_0x3ae8f4,_0x439727){var _0x574454;return db['UserProfile']['find']({'where':{'id':_0x3ae8f4[_0x66e0('0x48')]['id']},'attributes':['id',_0x66e0('0x2b')]})[_0x66e0('0x28')](handleEntityNotFound(_0x439727,null))['then'](function(_0x55a640){if(_0x55a640){_0x574454=_0x55a640;return db[_0x66e0('0x53')][_0x66e0('0x29')]({'where':{'userProfileId':_0x3ae8f4['params']['id'],'sectionId':_0x3ae8f4[_0x66e0('0x36')][_0x66e0('0x5f')]}});}})[_0x66e0('0x28')](function(){return _0x574454;})[_0x66e0('0x28')](respondWithStatusCode(_0x439727,null))[_0x66e0('0x46')](handleError(_0x439727,null));};exports[_0x66e0('0x60')]=function(_0x1a46b5,_0x481c3e){return db['UserProfile'][_0x66e0('0x4a')]({'where':{'id':_0x1a46b5[_0x66e0('0x48')]['id']}})[_0x66e0('0x28')](handleEntityNotFound(_0x481c3e,null))[_0x66e0('0x28')](function(_0x585c66){if(_0x585c66){return db[_0x66e0('0x52')]['transaction'](function(_0x4ea663){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x1a46b5[_0x66e0('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x66e0('0x28')](function(_0x5d502f){if(_0x5d502f){return db[_0x66e0('0x53')][_0x66e0('0x29')]({'where':{'userProfileId':_0x1a46b5[_0x66e0('0x48')]['id'],'id':_[_0x66e0('0x3d')](_0x5d502f,function(_0x41b0aa){return _0x41b0aa['id'];})},'transaction':_0x4ea663});}})[_0x66e0('0x28')](function(_0x1cdf72){var _0x3e50c9=_[_0x66e0('0x3d')](_0x1a46b5[_0x66e0('0x4c')],function(_0x1dca17){_0x1dca17[_0x66e0('0x58')]=_0x1a46b5[_0x66e0('0x48')]['id'];return _0x1dca17;});return db[_0x66e0('0x53')][_0x66e0('0x61')](_0x3e50c9,{'raw':!![],'transaction':_0x4ea663});})[_0x66e0('0x28')](function(_0x570d3c){var _0x11eb72=_[_0x66e0('0x3a')](_[_0x66e0('0x3d')](_0x570d3c,function(_0x59b5cc){return _0x59b5cc['get']({'plain':!![]});}),{'includeAll':![]});if(_0x11eb72){return db[_0x66e0('0x53')][_0x66e0('0x44')]({'where':{'userProfileId':_0x1a46b5[_0x66e0('0x48')]['id'],'sectionId':_[_0x66e0('0x3d')](_0x11eb72,function(_0x50e513){return _0x50e513['sectionId'];})},'attributes':['id',_0x66e0('0x57')],'raw':!![]})[_0x66e0('0x28')](function(_0x530149){var _0x116b7a=_[_0x66e0('0x3d')](_0x1a46b5['body'],function(_0x28fa3c){_0x28fa3c[_0x66e0('0x58')]=_0x1a46b5[_0x66e0('0x48')]['id'];return _0x28fa3c;});return db['UserProfileResource'][_0x66e0('0x61')](_0x116b7a,{'raw':!![],'transaction':_0x4ea663});});}})['catch'](handleError(_0x481c3e,null));});}})['then'](function(_0x87ab3){var _0x40c1f5=_[_0x66e0('0x3d')](_0x87ab3,function(_0x4def53){return _0x4def53[_0x66e0('0x4e')]({'plain':!![]});});})[_0x66e0('0x28')](respondWithResult(_0x481c3e,null))[_0x66e0('0x46')](handleError(_0x481c3e,null));};exports[_0x66e0('0x62')]=function(_0x810b26,_0xd2996a,_0x5d1075){var _0x477717;return db[_0x66e0('0x42')][_0x66e0('0x4a')]({'where':{'id':_0x810b26[_0x66e0('0x48')]['id']}})[_0x66e0('0x28')](handleEntityNotFound(_0xd2996a,null))[_0x66e0('0x28')](function(_0x43942){if(_0x43942){return _0x43942['removeResources'](_0x810b26[_0x66e0('0x36')]['ids']);}})[_0x66e0('0x28')](respondWithStatusCode(_0xd2996a,null))[_0x66e0('0x46')](handleError(_0xd2996a,null));};exports[_0x66e0('0x63')]=function(_0x5cc132,_0x94ddf9){var _0xe890c1={'raw':![],'where':{}};var _0x4ea465={};var _0x11b66a={'count':0x0,'rows':[]};var _0x4ba108=_0x5cc132['query']['section'];if(typeof _0x4ba108===_0x66e0('0x64')){throw new db[(_0x66e0('0x65'))][(_0x66e0('0x66'))](_0x66e0('0x67'));}var _0x206648=_0x5cc132[_0x66e0('0x36')]['mergeResources']||![];var _0x5f06ef=getQueryModels(_0x4ba108,_0x206648);if(typeof _0x5f06ef[_0x66e0('0x68')]===_0x66e0('0x64')){throw new db[(_0x66e0('0x65'))][(_0x66e0('0x66'))](_0x66e0('0x69')+_0x4ba108+'\x27');}var _0x20e52c=[];if(!_[_0x66e0('0x6a')](_0x5f06ef['parentSections'])){_0x20e52c=_0x5f06ef['parentSections'];}else{_0x20e52c=[{'name':_0x4ba108}];}return db[_0x66e0('0x42')][_0x66e0('0x6b')]({'where':{'id':_0x5cc132[_0x66e0('0x48')]['id']}})['then'](handleEntityNotFound(_0x94ddf9,null))[_0x66e0('0x28')](function(_0x50a29b){if(_0x50a29b){var _0x33aef6=[];for(var _0x26e516=0x0;_0x26e516<_0x20e52c[_0x66e0('0x35')];_0x26e516++){_0x33aef6[_0x66e0('0x5e')](db[_0x66e0('0x53')]['findOne']({'where':{'userProfileId':_0x50a29b['id'],'name':_0x20e52c[_0x26e516][_0x66e0('0x2b')]},'raw':!![]}));}return BPromise[_0x66e0('0x6c')](_0x33aef6);}})['then'](function(_0x3c87b1){var _0x2fb40b=_[_0x66e0('0x3a')](_0x3c87b1,function(_0x6beb0f){return _0x6beb0f?_0x6beb0f:undefined;});var _0x370f58=_[_0x66e0('0x3a')](_0x20e52c,[_0x66e0('0x6d'),!![]]);var _0x2912c5=_['isEmpty'](_0x2fb40b)&&_['isEmpty'](_0x370f58)?null:_[_0x66e0('0x6e')](_0x370f58,_0x2fb40b);if(_0x2912c5){var _0x2d1912=[];for(var _0x3c2dfe=0x0;_0x3c2dfe<_0x2912c5[_0x66e0('0x35')];_0x3c2dfe++){var _0x2ae578=_[_0x66e0('0x4a')](_0x20e52c,function(_0x15d332){return _0x2912c5[_0x3c2dfe]?_0x15d332[_0x66e0('0x2b')]===_0x2912c5[_0x3c2dfe]['name']:null;});if(_0x2ae578){if(_0x2912c5[_0x3c2dfe]['ignore']){_0x2d1912[_0x66e0('0x5e')](getAllResources(_0x5f06ef[_0x66e0('0x68')],_0x2912c5[_0x3c2dfe]));}else{if(!_0x2912c5[_0x3c2dfe]['autoAssociation']){_0x2d1912['push'](getAllowedResources(_0x2ae578,_0x2912c5[_0x3c2dfe]));}else{if(_0x2ae578['model']){_0x2d1912[_0x66e0('0x5e')](getAllFilteredResources(_0x2ae578,_0x2912c5[_0x3c2dfe]));}}}}}return BPromise['all'](_0x2d1912);}else{return null;}})[_0x66e0('0x28')](function(_0x469453){var _0x13b6a6=_0x469453;var _0x44b726=null;if(_0x13b6a6){_0x44b726=_0x13b6a6['length']===0x1?_0x13b6a6[0x0]:null;}if(_0x44b726||_0x13b6a6){var _0x5daccd=db[_0x5f06ef[_0x66e0('0x68')]][_0x66e0('0x2e')];_0x4ea465[_0x66e0('0x2f')]=_[_0x66e0('0x30')](_0x5daccd);_0x4ea465['query']=_[_0x66e0('0x30')](_0x5cc132[_0x66e0('0x36')]);_0x4ea465[_0x66e0('0x31')]=_['intersection'](_0x4ea465['model'],_0x4ea465[_0x66e0('0x36')]);_0xe890c1[_0x66e0('0x34')]=_[_0x66e0('0x32')](_0x4ea465['model'],qs['fields'](_0x5cc132[_0x66e0('0x36')][_0x66e0('0x33')]));_0xe890c1[_0x66e0('0x34')]=_0xe890c1[_0x66e0('0x34')]['length']?_0xe890c1[_0x66e0('0x34')]:_0x4ea465[_0x66e0('0x2f')];if(!_0x5cc132[_0x66e0('0x36')][_0x66e0('0x37')](_0x66e0('0x6f'))){_0xe890c1['limit']=qs[_0x66e0('0x23')](_0x5cc132[_0x66e0('0x36')][_0x66e0('0x23')]);_0xe890c1[_0x66e0('0x22')]=qs['offset'](_0x5cc132[_0x66e0('0x36')]['offset']);}_0xe890c1[_0x66e0('0x38')]=qs[_0x66e0('0x70')](_0x5cc132['query']['sort']);_0xe890c1[_0x66e0('0x3b')]=qs['filters'](_[_0x66e0('0x39')](_0x5cc132['query'],_0x4ea465[_0x66e0('0x31')]));if(_0x5cc132['query']['filter']){_0xe890c1['where']=_[_0x66e0('0x3c')](_0xe890c1[_0x66e0('0x3b')],{'$or':_[_0x66e0('0x3d')](_0x5daccd,function(_0x21e55b){if(_0x21e55b[_0x66e0('0x3e')]['key']!==_0x66e0('0x3f')){var _0x46d4bd={};_0x46d4bd[_0x21e55b['field']]={'$like':'%'+_0x5cc132['query'][_0x66e0('0x3a')]+'%'};return _0x46d4bd;}})});}var _0x259644=[];if(_0x44b726){var _0x43185f=_[_0x66e0('0x4a')](_0x20e52c,['name',_0x44b726['name']]);if(_0x43185f[_0x66e0('0x40')]){var _0x45ec3a={};_0x45ec3a[_0x43185f[_0x66e0('0x71')]]=_0x44b726[_0x66e0('0x72')];_0x259644[_0x66e0('0x5e')](_0x45ec3a);}else{_0xe890c1['where']['id']=_0x44b726[_0x66e0('0x72')];}}else{for(var _0x413ca1=0x0;_0x413ca1<_0x13b6a6['length'];_0x413ca1++){var _0x43185f=_[_0x66e0('0x4a')](_0x20e52c,[_0x66e0('0x2b'),_0x13b6a6[_0x413ca1][_0x66e0('0x2b')]]);if(_0x43185f[_0x66e0('0x40')]){var _0x45ec3a={};_0x45ec3a[_0x43185f['foreignKey']]=_0x13b6a6[_0x413ca1][_0x66e0('0x72')];_0x259644[_0x66e0('0x5e')](_0x45ec3a);}else{if(!_0xe890c1['where']['id'])_0xe890c1[_0x66e0('0x3b')]['id']=[];_0x13b6a6[_0x413ca1][_0x66e0('0x72')][_0x66e0('0x73')](function(_0x5014af){_0xe890c1[_0x66e0('0x3b')]['id'][_0x66e0('0x5e')](_0x5014af);});}}}if(!_[_0x66e0('0x6a')](_0x259644)){_0xe890c1[_0x66e0('0x3b')]=_['merge'](_0xe890c1[_0x66e0('0x3b')],{'$and':{'$or':_0x259644}});}_0xe890c1=_[_0x66e0('0x3c')]({},_0xe890c1,_0x5cc132[_0x66e0('0x41')]);if(_0x44b726&&!_0x44b726[_0x66e0('0x55')]&&_0x5f06ef[_0x66e0('0x68')]===_0x66e0('0x74')){if(_0x5cc132['query'][_0x66e0('0x43')]){_0xe890c1[_0x66e0('0x49')]=[{'all':!![]}];}return db[_0x5f06ef[_0x66e0('0x68')]][_0x66e0('0x44')](_0xe890c1)['then'](function(_0x4a16be){var _0x2d9526=[];_0x4a16be[_0x66e0('0x73')](function(_0xe291f3){var _0x2f8fa4;switch(_0xe291f3['reportType']){case _0x66e0('0x75'):_0x2f8fa4=_[_0x66e0('0x4a')](_0x44b726[_0x66e0('0x72')],function(_0x3ec1a5){return _0x3ec1a5['id']===_0xe291f3[_0x66e0('0x76')]&&_0x3ec1a5[_0x66e0('0x3e')]===_0x66e0('0x77');});break;case _0x66e0('0x78'):_0x2f8fa4=_[_0x66e0('0x4a')](_0x44b726['associatedResources'],function(_0x3b7b5a){return _0x3b7b5a['id']===_0xe291f3[_0x66e0('0x76')]&&_0x3b7b5a[_0x66e0('0x3e')]===_0x66e0('0x79');});break;}if(_0x2f8fa4)_0x2d9526[_0x66e0('0x5e')](_0xe291f3);});_0x11b66a[_0x66e0('0x21')]=_0x2d9526[_0x66e0('0x35')];_0x11b66a[_0x66e0('0x45')]=_0x2d9526;return _0x11b66a;});}else{return db[_0x5f06ef[_0x66e0('0x68')]][_0x66e0('0x21')]({'where':_0xe890c1[_0x66e0('0x3b')]})[_0x66e0('0x28')](function(_0x3cdc59){_0x11b66a[_0x66e0('0x21')]=_0x3cdc59;if(_0x5cc132[_0x66e0('0x36')][_0x66e0('0x43')]){if(_0x5f06ef['childModel']===_0x66e0('0x7a')){_0xe890c1[_0x66e0('0x49')]=[{'model':db['Tag'],'as':_0x66e0('0x7b'),'attributes':['id',_0x66e0('0x2b'),'color'],'required':_0x5cc132[_0x66e0('0x36')]['tag']?!![]:![]},{'model':db[_0x66e0('0x7c')],'as':_0x66e0('0x7d'),'attributes':['id','name',_0x66e0('0x7e')],'through':_0x5cc132['query']['tag']?{'attributes':[],'where':{'TagId':_0x5cc132[_0x66e0('0x36')][_0x66e0('0x7f')]||undefined}}:{},'required':_0x5cc132[_0x66e0('0x36')][_0x66e0('0x7f')]?!![]:![]}];}else{_0xe890c1[_0x66e0('0x49')]=[{'all':!![]}];}}return db[_0x5f06ef[_0x66e0('0x68')]][_0x66e0('0x44')](_0xe890c1);})[_0x66e0('0x28')](function(_0x59ddef){_0x11b66a[_0x66e0('0x45')]=_0x59ddef;return _0x11b66a;});}}else{return _0x11b66a;}})['then'](respondWithFilteredResult(_0x94ddf9,_0xe890c1))['catch'](handleError(_0x94ddf9,null));};function getAllResources(_0x351ed0,_0x16e3ba){return new BPromise(function(_0x15d0de,_0x4c51e4){if(_0x16e3ba){var _0x1f2163=_0x16e3ba[_0x66e0('0x3a')]?{[_0x16e3ba[_0x66e0('0x3a')][_0x66e0('0x40')]]:_0x16e3ba['filter'][_0x66e0('0x80')]}:undefined;return db[_0x351ed0][_0x66e0('0x44')]({'where':_0x1f2163,'raw':!![]})[_0x66e0('0x28')](function(_0x3fa4e0){_0x16e3ba['associatedResources']=_[_0x66e0('0x3d')](_0x3fa4e0,'id');_0x15d0de(_0x16e3ba);})[_0x66e0('0x46')](function(_0x571dc3){_0x4c51e4(_0x571dc3);});}else{_0x15d0de(null);}});}function getAllFilteredResources(_0x305129,_0x59e3ce){return new BPromise(function(_0xc7fa33,_0x91120f){var _0x588374=_0x305129[_0x66e0('0x3a')]?{[_0x305129['filter']['field']]:_0x305129[_0x66e0('0x3a')][_0x66e0('0x80')]}:undefined;return db[_0x305129['model']][_0x66e0('0x44')]({'where':_0x588374,'raw':!![]})[_0x66e0('0x28')](function(_0xa081a7){_0x59e3ce[_0x66e0('0x72')]=_['map'](_0xa081a7,function(_0x627bb4){return _0x627bb4['name'];});_0xc7fa33(_0x59e3ce);})[_0x66e0('0x46')](function(_0x56317c){_0x91120f(_0x56317c);});});}function getAllowedResources(_0x508575,_0x2534ee){return new BPromise(function(_0xae4e1f,_0x31e9c3){if(_0x2534ee){return db[_0x66e0('0x56')][_0x66e0('0x44')]({'where':{'sectionId':_0x2534ee['id']},'raw':!![]})[_0x66e0('0x28')](function(_0x2fa7d3){if(_0x508575[_0x66e0('0x40')]&&_0x508575[_0x66e0('0x40')]!=='id'){_0x2534ee[_0x66e0('0x72')]=_[_0x66e0('0x3d')](_0x2fa7d3,function(_0x1ae446){return _0x1ae446[_0x508575['field']];});}else{if(_0x508575[_0x66e0('0x68')]===_0x66e0('0x74')){_0x2534ee['associatedResources']=_[_0x66e0('0x3d')](_0x2fa7d3,function(_0x32520b){return{'id':_0x32520b[_0x66e0('0x81')],'type':_0x32520b[_0x66e0('0x3e')]};});}else{_0x2534ee[_0x66e0('0x72')]=_[_0x66e0('0x3d')](_0x2fa7d3,function(_0x196e75){return _0x196e75[_0x66e0('0x81')];});}}_0xae4e1f(_0x2534ee);})[_0x66e0('0x46')](function(_0x536b1b){_0x31e9c3(_0x536b1b);});}else{_0xae4e1f(null);}});}function getQueryModels(_0x6db138,_0x4dcce8){var _0x23efdf=_0x6db138[_0x66e0('0x82')]();var _0x56ac73={'childModel':undefined,'parentSections':[]};switch(_0x23efdf){case'squareprojects':_0x56ac73['childModel']=_0x66e0('0x83');break;case _0x66e0('0x84'):_0x56ac73[_0x66e0('0x68')]='SquareOdbc';break;case _0x66e0('0x85'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0x86');_0x56ac73[_0x66e0('0x87')]=[{'name':'SquareProjects','field':_0x66e0('0x2b'),'foreignKey':_0x66e0('0x88')}];break;case _0x66e0('0x89'):_0x56ac73[_0x66e0('0x68')]='JscriptyProject';break;case _0x66e0('0x8a'):_0x56ac73['childModel']=_0x66e0('0x7a');_0x56ac73[_0x66e0('0x87')]=[{'name':_0x66e0('0x8b'),'field':'id','foreignKey':'ListId'}];break;case _0x66e0('0x8c'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0x8d');break;case _0x66e0('0x8e'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0x8f');break;case _0x66e0('0x90'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0x91');break;case _0x66e0('0x92'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0x93');break;case _0x66e0('0x94'):_0x56ac73['childModel']='ChatWebsite';break;case _0x66e0('0x95'):_0x56ac73[_0x66e0('0x68')]='FaxQueue';break;case _0x66e0('0x96'):_0x56ac73['childModel']=_0x66e0('0x97');break;case _0x66e0('0x98'):case'internalroutes':case _0x66e0('0x99'):_0x56ac73[_0x66e0('0x68')]='VoiceExtension';break;case _0x66e0('0x9a'):_0x56ac73['childModel']='VoiceContext';break;case _0x66e0('0x9b'):_0x56ac73[_0x66e0('0x68')]='VoiceMail';break;case _0x66e0('0x9c'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0x9d');_0x56ac73[_0x66e0('0x87')]=[{'name':_0x66e0('0x9e'),'field':_0x66e0('0x2b'),'foreignKey':_0x66e0('0x9f'),'model':'User','filter':{'field':_0x66e0('0xa0'),'value':[_0x66e0('0xa1')]}},{'name':_0x66e0('0xa2'),'field':_0x66e0('0x2b'),'foreignKey':_0x66e0('0x9f'),'model':'User','filter':{'field':'role','value':[_0x66e0('0xa3')]}},{'name':_0x66e0('0xa4'),'field':_0x66e0('0x2b'),'foreignKey':'queue','model':_0x66e0('0xa5'),'filter':{'field':_0x66e0('0x3e'),'value':[_0x66e0('0xa6')]}},{'name':_0x66e0('0xa7'),'field':_0x66e0('0x2b'),'foreignKey':_0x66e0('0xa8'),'model':_0x66e0('0xa5'),'filter':{'field':_0x66e0('0x3e'),'value':[_0x66e0('0xa9')]}}];break;case _0x66e0('0xaa'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xab');break;case _0x66e0('0xac'):_0x56ac73[_0x66e0('0x68')]='VoiceChanSpy';break;case _0x66e0('0xad'):_0x56ac73['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xae');break;case _0x66e0('0xaf'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xb0');break;case _0x66e0('0xb1'):_0x56ac73[_0x66e0('0x68')]='MailAccount';break;case _0x66e0('0xb2'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xb3');break;case _0x66e0('0xb4'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xb5');break;case'openchannelaccounts':_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xb6');break;case _0x66e0('0xb7'):_0x56ac73[_0x66e0('0x68')]='SmsQueue';break;case'smsaccounts':_0x56ac73['childModel']=_0x66e0('0xb8');break;case _0x66e0('0xb9'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xba');break;case _0x66e0('0xbb'):case'queuecampaigns':_0x56ac73['childModel']='VoiceQueue';if(_0x4dcce8){_0x56ac73[_0x66e0('0x87')]=[{'name':_0x66e0('0xa4')},{'name':'QueueCampaigns'}];}break;case _0x66e0('0xbc'):case _0x66e0('0xbd'):case'telephones':_0x56ac73['childModel']=_0x66e0('0xbe');if(_0x4dcce8){_0x56ac73[_0x66e0('0x87')]=[{'name':_0x66e0('0xbf'),'filter':{'field':_0x66e0('0xa0'),'value':[_0x66e0('0xc0'),_0x66e0('0xc1')]},'ignore':!![]},{'name':_0x66e0('0x9e')},{'name':_0x66e0('0xa2')}];}break;case _0x66e0('0xc2'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xc3');break;case _0x66e0('0xc4'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xc5');break;case _0x66e0('0xc6'):_0x56ac73[_0x66e0('0x68')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x56ac73[_0x66e0('0x68')]='SugarcrmAccount';break;case _0x66e0('0xc7'):_0x56ac73['childModel']=_0x66e0('0xc8');break;case _0x66e0('0xc9'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xca');break;case _0x66e0('0xcb'):_0x56ac73['childModel']=_0x66e0('0xbe');break;case _0x66e0('0xcc'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xcd');break;case _0x66e0('0xce'):_0x56ac73['childModel']=_0x66e0('0xcf');break;case _0x66e0('0xd0'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xd1');break;case _0x66e0('0xd2'):_0x56ac73[_0x66e0('0x68')]='Interval';break;case _0x66e0('0xd3'):_0x56ac73['childModel']=_0x66e0('0xd4');break;case _0x66e0('0xd5'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xd6');break;case'sounds':_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xd7');break;case _0x66e0('0xd8'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0x7c');break;case _0x66e0('0xd9'):_0x56ac73[_0x66e0('0x68')]='Template';break;case _0x66e0('0xda'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xdb');break;case _0x66e0('0xdc'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xdd');break;case _0x66e0('0xde'):_0x56ac73['childModel']=_0x66e0('0xdf');break;case _0x66e0('0xe0'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0xe1');break;case _0x66e0('0xe2'):_0x56ac73[_0x66e0('0x68')]=_0x66e0('0x74');_0x56ac73[_0x66e0('0x87')]=[{'name':'Reports','field':'id','foreignKey':_0x66e0('0x76')}];break;case'metrics':_0x56ac73[_0x66e0('0x68')]='AnalyticMetric';break;default:return _0x56ac73;}return _0x56ac73;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e0460a1..4a32b17 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 _0x3c6c=['remove','emit','hasOwnProperty','events','UserProfile','setMaxListeners','save','update'];(function(_0x43ceb3,_0x462625){var _0x37015b=function(_0x298a6c){while(--_0x298a6c){_0x43ceb3['push'](_0x43ceb3['shift']());}};_0x37015b(++_0x462625);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x2c568,_0x5cf73d){_0x2c568=_0x2c568-0x0;var _0x18736b=_0x3c6c[_0x2c568];return _0x18736b;};'use strict';var EventEmitter=require(_0xc3c6('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xc3c6('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc3c6('0x2')](0x0);var events={'afterCreate':_0xc3c6('0x3'),'afterUpdate':_0xc3c6('0x4'),'afterDestroy':_0xc3c6('0x5')};function emitEvent(_0x37f15a){return function(_0x65a78,_0x34db2e,_0x5f5672){UserProfileEvents[_0xc3c6('0x6')](_0x37f15a+':'+_0x65a78['id'],_0x65a78);UserProfileEvents['emit'](_0x37f15a,_0x65a78);_0x5f5672(null);};}for(var e in events){if(events[_0xc3c6('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xc0f9=['../../mysqldb','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x14948a,_0x1a57ca){var _0x498ed9=function(_0x5d7417){while(--_0x5d7417){_0x14948a['push'](_0x14948a['shift']());}};_0x498ed9(++_0x1a57ca);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x3d2b19,_0x349a5b){_0x3d2b19=_0x3d2b19-0x0;var _0x29769b=_0xc0f9[_0x3d2b19];return _0x29769b;};'use strict';var EventEmitter=require(_0x9c0f('0x0'));var UserProfile=require(_0x9c0f('0x1'))['db'][_0x9c0f('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9c0f('0x3')](0x0);var events={'afterCreate':_0x9c0f('0x4'),'afterUpdate':_0x9c0f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x79623d){return function(_0x273940,_0x154d45,_0x54b878){UserProfileEvents[_0x9c0f('0x6')](_0x79623d+':'+_0x273940['id'],_0x273940);UserProfileEvents[_0x9c0f('0x6')](_0x79623d,_0x273940);_0x54b878(null);};}for(var e in events){if(events[_0x9c0f('0x7')](e)){var event=events[e];UserProfile[_0x9c0f('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index d3986ad..0f55eae 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 _0x7d6a=['moment','bluebird','request-promise','./userProfile.attributes','exports','UserProfile','user_profiles','lodash','util','api'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0x7d6a,0x1a1));var _0xa7d6=function(_0x5d5a6e,_0x540699){_0x5d5a6e=_0x5d5a6e-0x0;var _0x48002e=_0x7d6a[_0x5d5a6e];return _0x48002e;};'use strict';var _=require(_0xa7d6('0x0'));var util=require(_0xa7d6('0x1'));var logger=require('../../config/logger')(_0xa7d6('0x2'));var moment=require(_0xa7d6('0x3'));var BPromise=require(_0xa7d6('0x4'));var rp=require(_0xa7d6('0x5'));var attributes=require(_0xa7d6('0x6'));module[_0xa7d6('0x7')]=function(_0x279d79,_0x5e8b9a){return _0x279d79['define'](_0xa7d6('0x8'),attributes,{'tableName':_0xa7d6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x433a=['moment','bluebird','request-promise','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api'];(function(_0x289874,_0x1b6752){var _0x2f8bbb=function(_0x23ee80){while(--_0x23ee80){_0x289874['push'](_0x289874['shift']());}};_0x2f8bbb(++_0x1b6752);}(_0x433a,0xd8));var _0xa433=function(_0x27801c,_0x24bc5c){_0x27801c=_0x27801c-0x0;var _0x2cb365=_0x433a[_0x27801c];return _0x2cb365;};'use strict';var _=require(_0xa433('0x0'));var util=require(_0xa433('0x1'));var logger=require(_0xa433('0x2'))(_0xa433('0x3'));var moment=require(_0xa433('0x4'));var BPromise=require(_0xa433('0x5'));var rp=require(_0xa433('0x6'));var attributes=require('./userProfile.attributes');module[_0xa433('0x7')]=function(_0x20704f,_0x3d13e2){return _0x20704f[_0xa433('0x8')](_0xa433('0x9'),attributes,{'tableName':_0xa433('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 dabf4d4..836edab 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 _0x6e8f=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x53d698,_0x397dbe){var _0x1a93a6=function(_0x3c9f6e){while(--_0x3c9f6e){_0x53d698['push'](_0x53d698['shift']());}};_0x1a93a6(++_0x397dbe);}(_0x6e8f,0x16f));var _0xf6e8=function(_0x35cafd,_0x2f8f9e){_0x35cafd=_0x35cafd-0x0;var _0xbafff6=_0x6e8f[_0x35cafd];return _0xbafff6;};'use strict';var _=require(_0xf6e8('0x0'));var util=require(_0xf6e8('0x1'));var moment=require(_0xf6e8('0x2'));var BPromise=require(_0xf6e8('0x3'));var rs=require(_0xf6e8('0x4'));var fs=require('fs');var Redis=require(_0xf6e8('0x5'));var db=require(_0xf6e8('0x6'))['db'];var utils=require(_0xf6e8('0x7'));var logger=require(_0xf6e8('0x8'))('rpc');var config=require(_0xf6e8('0x9'));var jayson=require(_0xf6e8('0xa'));var client=jayson[_0xf6e8('0xb')]['http']({'port':0x232a});config[_0xf6e8('0xc')]=_[_0xf6e8('0xd')](config['redis'],{'host':_0xf6e8('0xe'),'port':0x18eb});var socket=require(_0xf6e8('0xf'))(new Redis(config[_0xf6e8('0xc')]));require(_0xf6e8('0x10'))[_0xf6e8('0x11')](socket);function respondWithRpcPromise(_0x8ed9d5,_0x50f502,_0x12765e){return new BPromise(function(_0x169f43,_0x3fa5ce){return client[_0xf6e8('0x12')](_0x8ed9d5,_0x12765e)[_0xf6e8('0x13')](function(_0x4ab743){logger['info'](_0xf6e8('0x14'),_0x50f502,_0xf6e8('0x15'));logger['debug'](_0xf6e8('0x16'),_0x50f502,_0xf6e8('0x15'),JSON['stringify'](_0x4ab743));if(_0x4ab743[_0xf6e8('0x17')]){if(_0x4ab743[_0xf6e8('0x17')][_0xf6e8('0x18')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x50f502,_0x4ab743['error']['message']);return _0x3fa5ce(_0x4ab743[_0xf6e8('0x17')]['message']);}logger[_0xf6e8('0x17')](_0xf6e8('0x14'),_0x50f502,_0x4ab743[_0xf6e8('0x17')][_0xf6e8('0x19')]);return _0x169f43(_0x4ab743['error']['message']);}else{logger['info'](_0xf6e8('0x14'),_0x50f502,_0xf6e8('0x15'));_0x169f43(_0x4ab743[_0xf6e8('0x1a')][_0xf6e8('0x19')]);}})[_0xf6e8('0x1b')](function(_0x5d8344){logger[_0xf6e8('0x17')](_0xf6e8('0x14'),_0x50f502,_0x5d8344);_0x3fa5ce(_0x5d8344);});});} \ No newline at end of file +var _0xbdbd=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0xbdbd,0x1c3));var _0xdbdb=function(_0x42be26,_0x1fec74){_0x42be26=_0x42be26-0x0;var _0x7dcf9=_0xbdbd[_0x42be26];return _0x7dcf9;};'use strict';var _=require('lodash');var util=require(_0xdbdb('0x0'));var moment=require('moment');var BPromise=require(_0xdbdb('0x1'));var rs=require(_0xdbdb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdbdb('0x3'));var logger=require(_0xdbdb('0x4'))('rpc');var config=require(_0xdbdb('0x5'));var jayson=require(_0xdbdb('0x6'));var client=jayson[_0xdbdb('0x7')][_0xdbdb('0x8')]({'port':0x232a});config[_0xdbdb('0x9')]=_[_0xdbdb('0xa')](config[_0xdbdb('0x9')],{'host':_0xdbdb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbdb('0x9')]));require('./userProfile.socket')[_0xdbdb('0xc')](socket);function respondWithRpcPromise(_0x2ca846,_0x180c7f,_0x58f414){return new BPromise(function(_0x492b3d,_0x1519be){return client['request'](_0x2ca846,_0x58f414)[_0xdbdb('0xd')](function(_0x316c09){logger['info'](_0xdbdb('0xe'),_0x180c7f,_0xdbdb('0xf'));logger[_0xdbdb('0x10')](_0xdbdb('0x11'),_0x180c7f,_0xdbdb('0xf'),JSON[_0xdbdb('0x12')](_0x316c09));if(_0x316c09[_0xdbdb('0x13')]){if(_0x316c09[_0xdbdb('0x13')][_0xdbdb('0x14')]===0x1f4){logger[_0xdbdb('0x13')](_0xdbdb('0xe'),_0x180c7f,_0x316c09[_0xdbdb('0x13')]['message']);return _0x1519be(_0x316c09[_0xdbdb('0x13')][_0xdbdb('0x15')]);}logger[_0xdbdb('0x13')](_0xdbdb('0xe'),_0x180c7f,_0x316c09[_0xdbdb('0x13')][_0xdbdb('0x15')]);return _0x492b3d(_0x316c09[_0xdbdb('0x13')]['message']);}else{logger['info'](_0xdbdb('0xe'),_0x180c7f,_0xdbdb('0xf'));_0x492b3d(_0x316c09[_0xdbdb('0x16')][_0xdbdb('0x15')]);}})[_0xdbdb('0x17')](function(_0x6a6540){logger['error'](_0xdbdb('0xe'),_0x180c7f,_0x6a6540);_0x1519be(_0x6a6540);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index da60d47..6650595 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 _0x6334=['length','userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register'];(function(_0x107500,_0x59c157){var _0x44ce3c=function(_0x48774f){while(--_0x48774f){_0x107500['push'](_0x107500['shift']());}};_0x44ce3c(++_0x59c157);}(_0x6334,0x119));var _0x4633=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0x6334[_0x1399d6];return _0x4a9db4;};'use strict';var UserProfileEvents=require(_0x4633('0x0'));var events=[_0x4633('0x1'),_0x4633('0x2'),_0x4633('0x3')];function createListener(_0x1e53a0,_0x47254b){return function(_0x5109db){_0x47254b[_0x4633('0x4')](_0x1e53a0,_0x5109db);};}function removeListener(_0x205442,_0x2a2b3c){return function(){UserProfileEvents[_0x4633('0x5')](_0x205442,_0x2a2b3c);};}exports[_0x4633('0x6')]=function(_0x6493dc){for(var _0x175e14=0x0,_0x4a8997=events[_0x4633('0x7')];_0x175e14<_0x4a8997;_0x175e14++){var _0x56891d=events[_0x175e14];var _0x21af74=createListener(_0x4633('0x8')+_0x56891d,_0x6493dc);UserProfileEvents['on'](_0x56891d,_0x21af74);}}; \ No newline at end of file +var _0xfcbd=['length','userProfile:','./userProfile.events','update','emit','removeListener','register'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xfcbd,0x160));var _0xdfcb=function(_0x4a74e5,_0x108772){_0x4a74e5=_0x4a74e5-0x0;var _0x1339c6=_0xfcbd[_0x4a74e5];return _0x1339c6;};'use strict';var UserProfileEvents=require(_0xdfcb('0x0'));var events=['save','remove',_0xdfcb('0x1')];function createListener(_0x3df05b,_0x2785df){return function(_0x3ec4cc){_0x2785df[_0xdfcb('0x2')](_0x3df05b,_0x3ec4cc);};}function removeListener(_0xde9380,_0x545391){return function(){UserProfileEvents[_0xdfcb('0x3')](_0xde9380,_0x545391);};}exports[_0xdfcb('0x4')]=function(_0x4bdf76){for(var _0x5615a6=0x0,_0x46956c=events[_0xdfcb('0x5')];_0x5615a6<_0x46956c;_0x5615a6++){var _0xb8de95=events[_0x5615a6];var _0x3c5431=createListener(_0xdfcb('0x6')+_0xb8de95,_0x4bdf76);UserProfileEvents['on'](_0xb8de95,_0x3c5431);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 827970e..0f1c931 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 _0x8d62=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x4d183d,_0x123de0){var _0x431236=function(_0x35642b){while(--_0x35642b){_0x4d183d['push'](_0x4d183d['shift']());}};_0x431236(++_0x123de0);}(_0x8d62,0xf8));var _0x28d6=function(_0x688e93,_0x35dea6){_0x688e93=_0x688e93-0x0;var _0x5692d9=_0x8d62[_0x688e93];return _0x5692d9;};'use strict';var multer=require('multer');var util=require(_0x28d6('0x0'));var path=require(_0x28d6('0x1'));var timeout=require(_0x28d6('0x2'));var express=require(_0x28d6('0x3'));var router=express[_0x28d6('0x4')]();var auth=require(_0x28d6('0x5'));var interaction=require(_0x28d6('0x6'));var config=require(_0x28d6('0x7'));var controller=require(_0x28d6('0x8'));router[_0x28d6('0x9')]('/',auth[_0x28d6('0xa')](),controller[_0x28d6('0xb')]);router[_0x28d6('0x9')](_0x28d6('0xc'),auth['isAuthenticated'](),controller[_0x28d6('0xd')]);router[_0x28d6('0x9')](_0x28d6('0xe'),auth['isAuthenticated'](),controller[_0x28d6('0xf')]);router['post']('/',auth[_0x28d6('0xa')](),controller[_0x28d6('0x10')]);router[_0x28d6('0x11')](_0x28d6('0xe'),auth[_0x28d6('0xa')](),controller['update']);router[_0x28d6('0x12')](_0x28d6('0xe'),auth[_0x28d6('0xa')](),controller[_0x28d6('0x13')]);module[_0x28d6('0x14')]=router; \ No newline at end of file +var _0xdc91=['./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xdc91,0x8b));var _0x1dc9=function(_0x46791f,_0x191d23){_0x46791f=_0x46791f-0x0;var _0x1fc2b1=_0xdc91[_0x46791f];return _0x1fc2b1;};'use strict';var multer=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x1dc9('0x2'));var interaction=require(_0x1dc9('0x3'));var config=require(_0x1dc9('0x4'));var controller=require(_0x1dc9('0x5'));router[_0x1dc9('0x6')]('/',auth[_0x1dc9('0x7')](),controller[_0x1dc9('0x8')]);router[_0x1dc9('0x6')]('/describe',auth[_0x1dc9('0x7')](),controller[_0x1dc9('0x9')]);router[_0x1dc9('0x6')](_0x1dc9('0xa'),auth[_0x1dc9('0x7')](),controller[_0x1dc9('0xb')]);router[_0x1dc9('0xc')]('/',auth[_0x1dc9('0x7')](),controller[_0x1dc9('0xd')]);router[_0x1dc9('0xe')]('/:id',auth[_0x1dc9('0x7')](),controller['update']);router[_0x1dc9('0xf')]('/:id',auth[_0x1dc9('0x7')](),controller[_0x1dc9('0x10')]);module[_0x1dc9('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8a271c2..b904599 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 _0xb4b6=['INTEGER','STRING','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb4b6,0xe9));var _0x6b4b=function(_0x207879,_0xd203ee){_0x207879=_0x207879-0x0;var _0x44943c=_0xb4b6[_0x207879];return _0x44943c;};'use strict';var Sequelize=require(_0x6b4b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6b4b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6b4b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdf86=['STRING','INTEGER','sequelize','exports'];(function(_0x59711e,_0x10a234){var _0x36cea3=function(_0x1b12cd){while(--_0x1b12cd){_0x59711e['push'](_0x59711e['shift']());}};_0x36cea3(++_0x10a234);}(_0xdf86,0x126));var _0x6df8=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0xdf86[_0x79cd47];return _0x3b9484;};'use strict';var Sequelize=require(_0x6df8('0x0'));module[_0x6df8('0x1')]={'name':{'type':Sequelize[_0x6df8('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6df8('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6df8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 9e4d9a2..69e7fa5 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 _0xb10b=['includeAll','findAll','catch','params','model','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','send','index','UserProfileResource','rawAttributes','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','field','count'];(function(_0x2976e7,_0x499872){var _0x55f650=function(_0x59a123){while(--_0x59a123){_0x2976e7['push'](_0x2976e7['shift']());}};_0x55f650(++_0x499872);}(_0xb10b,0x12a));var _0xbb10=function(_0x2de0ec,_0x38812f){_0x2de0ec=_0x2de0ec-0x0;var _0x13aa7b=_0xb10b[_0x2de0ec];return _0x13aa7b;};'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 authService=require(_0xbb10('0x12'));var hardwareService=require(_0xbb10('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xcc;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x18')](_0x44fb19);}return _0x5be7e0[_0xbb10('0x19')](_0x44fb19)[_0xbb10('0x1a')]();};}function respondWithResult(_0x147230,_0x58a612){_0x58a612=_0x58a612||0xc8;return function(_0x26e021){if(_0x26e021){return _0x147230[_0xbb10('0x19')](_0x58a612)[_0xbb10('0x1b')](_0x26e021);}};}function respondWithFilteredResult(_0x17fd46,_0x3df17b){return function(_0x2f2ebf){if(_0x2f2ebf){var _0x24a57b=_0x2f2ebf['count'],_0x36b5e8=_0x3df17b[_0xbb10('0x1c')],_0x3e26f4=_0x3df17b[_0xbb10('0x1c')]+_0x3df17b[_0xbb10('0x1d')],_0x2b184e;if(_0x3e26f4>=_0x24a57b){_0x3e26f4=_0x24a57b;_0x2b184e=0xc8;}else{_0x2b184e=0xce;}_0x17fd46[_0xbb10('0x19')](_0x2b184e);return _0x17fd46[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x36b5e8+'-'+_0x3e26f4+'/'+_0x24a57b)[_0xbb10('0x1b')](_0x2f2ebf);}return null;};}function patchUpdates(_0x30efc6){return function(_0xbf2906){try{jsonpatch[_0xbb10('0x20')](_0xbf2906,_0x30efc6,!![]);}catch(_0x48b6e9){return BPromise[_0xbb10('0x21')](_0x48b6e9);}return _0xbf2906[_0xbb10('0x22')]();};}function saveUpdates(_0x388fab,_0x109908){return function(_0xdf237d){if(_0xdf237d){return _0xdf237d[_0xbb10('0x23')](_0x388fab)['then'](function(_0x12f888){return _0x12f888;});}return null;};}function removeEntity(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(_0x4c4b0d){return _0x4c4b0d[_0xbb10('0x24')]()[_0xbb10('0x25')](function(){_0x12ef77[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x445761,_0x1824b7){return function(_0x407cb4){if(!_0x407cb4){_0x445761[_0xbb10('0x18')](0x194);}return _0x407cb4;};}function handleError(_0x7f2377,_0x395404){_0x395404=_0x395404||0x1f4;return function(_0x3ba6cd){logger[_0xbb10('0x26')](_0x3ba6cd['stack']);if(_0x3ba6cd['name']){delete _0x3ba6cd['name'];}_0x7f2377[_0xbb10('0x19')](_0x395404)[_0xbb10('0x27')](_0x3ba6cd);};}exports[_0xbb10('0x28')]=function(_0x4e25ff,_0x2fdde9){var _0x24d586={},_0x6ed43b={},_0x1d5e95={'count':0x0,'rows':[]};var _0x1acce9=db[_0xbb10('0x29')][_0xbb10('0x2a')];_0x6ed43b['model']=_[_0xbb10('0x2b')](_0x1acce9);_0x6ed43b[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0x4e25ff[_0xbb10('0x2c')]);_0x6ed43b[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x6ed43b['model'],_0x6ed43b[_0xbb10('0x2c')]);_0x24d586['attributes']=_[_0xbb10('0x2e')](_0x6ed43b['model'],qs[_0xbb10('0x2f')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x2f')]));_0x24d586['attributes']=_0x24d586['attributes'][_0xbb10('0x30')]?_0x24d586[_0xbb10('0x31')]:_0x6ed43b['model'];if(!_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x32')](_0xbb10('0x33'))){_0x24d586[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1d')]);_0x24d586['offset']=qs[_0xbb10('0x1c')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1c')]);}_0x24d586[_0xbb10('0x34')]=qs[_0xbb10('0x35')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x35')]);_0x24d586[_0xbb10('0x36')]=qs[_0xbb10('0x2d')](_['pick'](_0x4e25ff[_0xbb10('0x2c')],_0x6ed43b[_0xbb10('0x2d')]));if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x37')]){_0x24d586['where']=_[_0xbb10('0x38')](_0x24d586['where'],{'$or':_['map'](_0x1acce9,function(_0x3eb3cc){if(_0x3eb3cc[_0xbb10('0x39')][_0xbb10('0x3a')]!==_0xbb10('0x3b')){var _0x15d895={};_0x15d895[_0x3eb3cc[_0xbb10('0x3c')]]={'$like':'%'+_0x4e25ff['query'][_0xbb10('0x37')]+'%'};return _0x15d895;}})});}_0x24d586=_[_0xbb10('0x38')]({},_0x24d586,_0x4e25ff['options']);var _0x5e3fbd={'where':_0x24d586['where']};return db[_0xbb10('0x29')][_0xbb10('0x3d')](_0x5e3fbd)[_0xbb10('0x25')](function(_0x4d5a9b){_0x1d5e95[_0xbb10('0x3d')]=_0x4d5a9b;if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x24d586['include']=[{'all':!![]}];}return db[_0xbb10('0x29')][_0xbb10('0x3f')](_0x24d586);})[_0xbb10('0x25')](function(_0x446f49){_0x1d5e95['rows']=_0x446f49;return _0x1d5e95;})[_0xbb10('0x25')](respondWithFilteredResult(_0x2fdde9,_0x24d586))[_0xbb10('0x40')](handleError(_0x2fdde9,null));};exports['show']=function(_0xe2040f,_0x2e3214){var _0x44d6ae={'raw':![],'where':{'id':_0xe2040f[_0xbb10('0x41')]['id']}},_0x3a9934={};_0x3a9934[_0xbb10('0x42')]=_['keys'](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x3a9934[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0xe2040f['query']);_0x3a9934[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],_0x3a9934[_0xbb10('0x2c')]);_0x44d6ae['attributes']=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],qs['fields'](_0xe2040f['query'][_0xbb10('0x2f')]));_0x44d6ae['attributes']=_0x44d6ae[_0xbb10('0x31')][_0xbb10('0x30')]?_0x44d6ae['attributes']:_0x3a9934[_0xbb10('0x42')];if(_0xe2040f[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x44d6ae['include']=[{'all':!![]}];}_0x44d6ae=_[_0xbb10('0x38')]({},_0x44d6ae,_0xe2040f[_0xbb10('0x43')]);return db[_0xbb10('0x29')][_0xbb10('0x44')](_0x44d6ae)[_0xbb10('0x25')](handleEntityNotFound(_0x2e3214,null))[_0xbb10('0x25')](respondWithResult(_0x2e3214,null))[_0xbb10('0x40')](handleError(_0x2e3214,null));};exports[_0xbb10('0x45')]=function(_0x205bb4,_0x43b948){return db[_0xbb10('0x29')][_0xbb10('0x45')](_0x205bb4['body'],{})[_0xbb10('0x25')](respondWithResult(_0x43b948,0xc9))[_0xbb10('0x40')](handleError(_0x43b948,null));};exports['update']=function(_0x14e1cb,_0x2f5027){if(_0x14e1cb[_0xbb10('0x46')]['id']){delete _0x14e1cb[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x14e1cb[_0xbb10('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f5027,null))['then'](saveUpdates(_0x14e1cb[_0xbb10('0x46')],null))[_0xbb10('0x25')](respondWithResult(_0x2f5027,null))[_0xbb10('0x40')](handleError(_0x2f5027,null));};exports['destroy']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x5f0c12[_0xbb10('0x41')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x25')](removeEntity(_0x3cd6f3,null))[_0xbb10('0x40')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x47')]=function(_0x2626d8,_0x3d7e7e){return db['UserProfileResource']['describe']()[_0xbb10('0x25')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x40')](handleError(_0x3d7e7e,null));}; \ No newline at end of file +var _0xb10b=['includeAll','findAll','catch','params','model','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','send','index','UserProfileResource','rawAttributes','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','field','count'];(function(_0x2a41f2,_0x227d5e){var _0x4c94ac=function(_0x3a81bf){while(--_0x3a81bf){_0x2a41f2['push'](_0x2a41f2['shift']());}};_0x4c94ac(++_0x227d5e);}(_0xb10b,0x12a));var _0xbb10=function(_0x7de33e,_0x46a873){_0x7de33e=_0x7de33e-0x0;var _0x9b0f8=_0xb10b[_0x7de33e];return _0x9b0f8;};'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 authService=require(_0xbb10('0x12'));var hardwareService=require(_0xbb10('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xcc;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x18')](_0x44fb19);}return _0x5be7e0[_0xbb10('0x19')](_0x44fb19)[_0xbb10('0x1a')]();};}function respondWithResult(_0x147230,_0x58a612){_0x58a612=_0x58a612||0xc8;return function(_0x26e021){if(_0x26e021){return _0x147230[_0xbb10('0x19')](_0x58a612)[_0xbb10('0x1b')](_0x26e021);}};}function respondWithFilteredResult(_0x17fd46,_0x3df17b){return function(_0x2f2ebf){if(_0x2f2ebf){var _0x24a57b=_0x2f2ebf['count'],_0x36b5e8=_0x3df17b[_0xbb10('0x1c')],_0x3e26f4=_0x3df17b[_0xbb10('0x1c')]+_0x3df17b[_0xbb10('0x1d')],_0x2b184e;if(_0x3e26f4>=_0x24a57b){_0x3e26f4=_0x24a57b;_0x2b184e=0xc8;}else{_0x2b184e=0xce;}_0x17fd46[_0xbb10('0x19')](_0x2b184e);return _0x17fd46[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x36b5e8+'-'+_0x3e26f4+'/'+_0x24a57b)[_0xbb10('0x1b')](_0x2f2ebf);}return null;};}function patchUpdates(_0x30efc6){return function(_0xbf2906){try{jsonpatch[_0xbb10('0x20')](_0xbf2906,_0x30efc6,!![]);}catch(_0x48b6e9){return BPromise[_0xbb10('0x21')](_0x48b6e9);}return _0xbf2906[_0xbb10('0x22')]();};}function saveUpdates(_0x388fab,_0x109908){return function(_0xdf237d){if(_0xdf237d){return _0xdf237d[_0xbb10('0x23')](_0x388fab)['then'](function(_0x12f888){return _0x12f888;});}return null;};}function removeEntity(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(_0x4c4b0d){return _0x4c4b0d[_0xbb10('0x24')]()[_0xbb10('0x25')](function(){_0x12ef77[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x445761,_0x1824b7){return function(_0x407cb4){if(!_0x407cb4){_0x445761[_0xbb10('0x18')](0x194);}return _0x407cb4;};}function handleError(_0x7f2377,_0x395404){_0x395404=_0x395404||0x1f4;return function(_0x3ba6cd){logger[_0xbb10('0x26')](_0x3ba6cd['stack']);if(_0x3ba6cd['name']){delete _0x3ba6cd['name'];}_0x7f2377[_0xbb10('0x19')](_0x395404)[_0xbb10('0x27')](_0x3ba6cd);};}exports[_0xbb10('0x28')]=function(_0x4e25ff,_0x2fdde9){var _0x24d586={},_0x6ed43b={},_0x1d5e95={'count':0x0,'rows':[]};var _0x1acce9=db[_0xbb10('0x29')][_0xbb10('0x2a')];_0x6ed43b['model']=_[_0xbb10('0x2b')](_0x1acce9);_0x6ed43b[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0x4e25ff[_0xbb10('0x2c')]);_0x6ed43b[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x6ed43b['model'],_0x6ed43b[_0xbb10('0x2c')]);_0x24d586['attributes']=_[_0xbb10('0x2e')](_0x6ed43b['model'],qs[_0xbb10('0x2f')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x2f')]));_0x24d586['attributes']=_0x24d586['attributes'][_0xbb10('0x30')]?_0x24d586[_0xbb10('0x31')]:_0x6ed43b['model'];if(!_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x32')](_0xbb10('0x33'))){_0x24d586[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1d')]);_0x24d586['offset']=qs[_0xbb10('0x1c')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1c')]);}_0x24d586[_0xbb10('0x34')]=qs[_0xbb10('0x35')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x35')]);_0x24d586[_0xbb10('0x36')]=qs[_0xbb10('0x2d')](_['pick'](_0x4e25ff[_0xbb10('0x2c')],_0x6ed43b[_0xbb10('0x2d')]));if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x37')]){_0x24d586['where']=_[_0xbb10('0x38')](_0x24d586['where'],{'$or':_['map'](_0x1acce9,function(_0x3eb3cc){if(_0x3eb3cc[_0xbb10('0x39')][_0xbb10('0x3a')]!==_0xbb10('0x3b')){var _0x15d895={};_0x15d895[_0x3eb3cc[_0xbb10('0x3c')]]={'$like':'%'+_0x4e25ff['query'][_0xbb10('0x37')]+'%'};return _0x15d895;}})});}_0x24d586=_[_0xbb10('0x38')]({},_0x24d586,_0x4e25ff['options']);var _0x5e3fbd={'where':_0x24d586['where']};return db[_0xbb10('0x29')][_0xbb10('0x3d')](_0x5e3fbd)[_0xbb10('0x25')](function(_0x4d5a9b){_0x1d5e95[_0xbb10('0x3d')]=_0x4d5a9b;if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x24d586['include']=[{'all':!![]}];}return db[_0xbb10('0x29')][_0xbb10('0x3f')](_0x24d586);})[_0xbb10('0x25')](function(_0x446f49){_0x1d5e95['rows']=_0x446f49;return _0x1d5e95;})[_0xbb10('0x25')](respondWithFilteredResult(_0x2fdde9,_0x24d586))[_0xbb10('0x40')](handleError(_0x2fdde9,null));};exports['show']=function(_0xe2040f,_0x2e3214){var _0x44d6ae={'raw':![],'where':{'id':_0xe2040f[_0xbb10('0x41')]['id']}},_0x3a9934={};_0x3a9934[_0xbb10('0x42')]=_['keys'](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x3a9934[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0xe2040f['query']);_0x3a9934[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],_0x3a9934[_0xbb10('0x2c')]);_0x44d6ae['attributes']=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],qs['fields'](_0xe2040f['query'][_0xbb10('0x2f')]));_0x44d6ae['attributes']=_0x44d6ae[_0xbb10('0x31')][_0xbb10('0x30')]?_0x44d6ae['attributes']:_0x3a9934[_0xbb10('0x42')];if(_0xe2040f[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x44d6ae['include']=[{'all':!![]}];}_0x44d6ae=_[_0xbb10('0x38')]({},_0x44d6ae,_0xe2040f[_0xbb10('0x43')]);return db[_0xbb10('0x29')][_0xbb10('0x44')](_0x44d6ae)[_0xbb10('0x25')](handleEntityNotFound(_0x2e3214,null))[_0xbb10('0x25')](respondWithResult(_0x2e3214,null))[_0xbb10('0x40')](handleError(_0x2e3214,null));};exports[_0xbb10('0x45')]=function(_0x205bb4,_0x43b948){return db[_0xbb10('0x29')][_0xbb10('0x45')](_0x205bb4['body'],{})[_0xbb10('0x25')](respondWithResult(_0x43b948,0xc9))[_0xbb10('0x40')](handleError(_0x43b948,null));};exports['update']=function(_0x14e1cb,_0x2f5027){if(_0x14e1cb[_0xbb10('0x46')]['id']){delete _0x14e1cb[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x14e1cb[_0xbb10('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f5027,null))['then'](saveUpdates(_0x14e1cb[_0xbb10('0x46')],null))[_0xbb10('0x25')](respondWithResult(_0x2f5027,null))[_0xbb10('0x40')](handleError(_0x2f5027,null));};exports['destroy']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x5f0c12[_0xbb10('0x41')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x25')](removeEntity(_0x3cd6f3,null))[_0xbb10('0x40')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x47')]=function(_0x2626d8,_0x3d7e7e){return db['UserProfileResource']['describe']()[_0xbb10('0x25')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x40')](handleError(_0x3d7e7e,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7264832..1bf106c 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 _0x5249=['util','moment','bluebird','request-promise','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x5249,0x1c3));var _0x9524=function(_0x4a727b,_0x396546){_0x4a727b=_0x4a727b-0x0;var _0x299581=_0x5249[_0x4a727b];return _0x299581;};'use strict';var _=require('lodash');var util=require(_0x9524('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9524('0x1'));var BPromise=require(_0x9524('0x2'));var rp=require(_0x9524('0x3'));var attributes=require(_0x9524('0x4'));module[_0x9524('0x5')]=function(_0x2d7301,_0x30bdf7){return _0x2d7301[_0x9524('0x6')](_0x9524('0x7'),attributes,{'tableName':_0x9524('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x9524('0x9'),_0x9524('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6edb=['bluebird','./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','util','api','moment'];(function(_0x27b6c3,_0x258fd0){var _0x12f3c0=function(_0x3042f6){while(--_0x3042f6){_0x27b6c3['push'](_0x27b6c3['shift']());}};_0x12f3c0(++_0x258fd0);}(_0x6edb,0xc3));var _0xb6ed=function(_0x30f69d,_0xc75fdb){_0x30f69d=_0x30f69d-0x0;var _0x2bc4d4=_0x6edb[_0x30f69d];return _0x2bc4d4;};'use strict';var _=require('lodash');var util=require(_0xb6ed('0x0'));var logger=require('../../config/logger')(_0xb6ed('0x1'));var moment=require(_0xb6ed('0x2'));var BPromise=require(_0xb6ed('0x3'));var rp=require('request-promise');var attributes=require(_0xb6ed('0x4'));module[_0xb6ed('0x5')]=function(_0x34b699,_0x37fba9){return _0x34b699[_0xb6ed('0x6')](_0xb6ed('0x7'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xb6ed('0x8'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 345445e..a4fcc02 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 _0x5d17=['request','info','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x176cb2,_0x7e0ee2){var _0x965f73=function(_0x559fd5){while(--_0x559fd5){_0x176cb2['push'](_0x176cb2['shift']());}};_0x965f73(++_0x7e0ee2);}(_0x5d17,0x114));var _0x75d1=function(_0x2a7c2a,_0x37cc9e){_0x2a7c2a=_0x2a7c2a-0x0;var _0x195732=_0x5d17[_0x2a7c2a];return _0x195732;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){return client[_0x75d1('0xa')](_0x116a51,_0x1ee61b)['then'](function(_0x4cf632){logger[_0x75d1('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x5c957a,'request\x20sent');logger[_0x75d1('0xc')](_0x75d1('0xd'),_0x5c957a,'request\x20sent',JSON[_0x75d1('0xe')](_0x4cf632));if(_0x4cf632[_0x75d1('0xf')]){if(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x10')]===0x1f4){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x4cf632['error'][_0x75d1('0x12')]);return _0x105607(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}logger[_0x75d1('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x5c957a,_0x4cf632['error']['message']);return _0x3a9d5e(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}else{logger[_0x75d1('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x5c957a,_0x75d1('0x13'));_0x3a9d5e(_0x4cf632[_0x75d1('0x14')][_0x75d1('0x12')]);}})[_0x75d1('0x15')](function(_0x1160ca){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x1160ca);_0x105607(_0x1160ca);});});} \ No newline at end of file +var _0x7096=['code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0x7096,0x10c));var _0x6709=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7096[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 60ccdd9..63bfe7c 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 _0x59d5=['/:id','show','post','create','put','update','delete','destroy','multer','path','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','/describe','describe','get'];(function(_0x4e7b46,_0x1e5718){var _0x309599=function(_0x549658){while(--_0x549658){_0x4e7b46['push'](_0x4e7b46['shift']());}};_0x309599(++_0x1e5718);}(_0x59d5,0x67));var _0x559d=function(_0x57b039,_0x325462){_0x57b039=_0x57b039-0x0;var _0x1a2da5=_0x59d5[_0x57b039];return _0x1a2da5;};'use strict';var multer=require(_0x559d('0x0'));var util=require('util');var path=require(_0x559d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x559d('0x2')]();var auth=require(_0x559d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x559d('0x4'));var controller=require(_0x559d('0x5'));router['get']('/',auth[_0x559d('0x6')](),controller[_0x559d('0x7')]);router['get'](_0x559d('0x8'),auth['isAuthenticated'](),controller[_0x559d('0x9')]);router[_0x559d('0xa')](_0x559d('0xb'),auth[_0x559d('0x6')](),controller[_0x559d('0xc')]);router[_0x559d('0xd')]('/',auth[_0x559d('0x6')](),controller[_0x559d('0xe')]);router[_0x559d('0xf')](_0x559d('0xb'),auth['isAuthenticated'](),controller[_0x559d('0x10')]);router[_0x559d('0x11')](_0x559d('0xb'),auth['isAuthenticated'](),controller[_0x559d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x894d=['update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x894d,0xa5));var _0xd894=function(_0x375d6f,_0x2fb66e){_0x375d6f=_0x375d6f-0x0;var _0x2a74b6=_0x894d[_0x375d6f];return _0x2a74b6;};'use strict';var multer=require(_0xd894('0x0'));var util=require(_0xd894('0x1'));var path=require(_0xd894('0x2'));var timeout=require('connect-timeout');var express=require(_0xd894('0x3'));var router=express[_0xd894('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd894('0x5'));var config=require(_0xd894('0x6'));var controller=require('./userProfileSection.controller');router[_0xd894('0x7')]('/',auth[_0xd894('0x8')](),controller[_0xd894('0x9')]);router[_0xd894('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd894('0xa')]);router[_0xd894('0x7')](_0xd894('0xb'),auth[_0xd894('0x8')](),controller['show']);router[_0xd894('0xc')]('/',auth['isAuthenticated'](),controller[_0xd894('0xd')]);router[_0xd894('0xe')](_0xd894('0xb'),auth[_0xd894('0x8')](),controller[_0xd894('0xf')]);router[_0xd894('0x10')](_0xd894('0xb'),auth[_0xd894('0x8')](),controller[_0xd894('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3209cfc..2f07ed6 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 _0x3e74=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x375f55,_0x2a53ce){var _0x1c0b23=function(_0x2f86be){while(--_0x2f86be){_0x375f55['push'](_0x375f55['shift']());}};_0x1c0b23(++_0x2a53ce);}(_0x3e74,0x175));var _0x43e7=function(_0x26abbb,_0x5b1d1e){_0x26abbb=_0x26abbb-0x0;var _0xbb558e=_0x3e74[_0x26abbb];return _0xbb558e;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x43e7('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x43e7('0x1')],'set':function(_0x4f9bbe){this[_0x43e7('0x3')](_0x43e7('0x4'),_0x4f9bbe?_0x4f9bbe[_0x43e7('0x5')](''):[]);},'get':function(){return this[_0x43e7('0x6')](_0x43e7('0x4'))?this['getDataValue'](_0x43e7('0x4'))[_0x43e7('0x7')](''):[];}}}; \ No newline at end of file +var _0xedd9=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue'];(function(_0x41b306,_0x43383d){var _0x3c185b=function(_0x5adc83){while(--_0x5adc83){_0x41b306['push'](_0x41b306['shift']());}};_0x3c185b(++_0x43383d);}(_0xedd9,0xfc));var _0x9edd=function(_0x3d38af,_0xdcd2d9){_0x3d38af=_0x3d38af-0x0;var _0x254573=_0xedd9[_0x3d38af];return _0x254573;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'name':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x9edd('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x9edd('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x9edd('0x1')],'set':function(_0x36b53f){this['setDataValue'](_0x9edd('0x4'),_0x36b53f?_0x36b53f[_0x9edd('0x5')](''):[]);},'get':function(){return this[_0x9edd('0x6')](_0x9edd('0x4'))?this['getDataValue'](_0x9edd('0x4'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index ea0b07d..cfe8c27 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 _0x0793=['api','../../config/utils','../../config/environment','end','status','json','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','index','UserProfileSection','rawAttributes','keys','query','filters','model','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','pick','map','type','field','filter','merge','options','count','includeAll','include','findAll','catch','show','params','intersection','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/logger'];(function(_0x4ee79c,_0x247c69){var _0x1b3f4a=function(_0x45cbb5){while(--_0x45cbb5){_0x4ee79c['push'](_0x4ee79c['shift']());}};_0x1b3f4a(++_0x247c69);}(_0x0793,0xf9));var _0x3079=function(_0x50bc53,_0x250f35){_0x50bc53=_0x50bc53-0x0;var _0x578706=_0x0793[_0x50bc53];return _0x578706;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3079('0x0'));var zipdir=require(_0x3079('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3079('0x2'));var moment=require(_0x3079('0x3'));var BPromise=require(_0x3079('0x4'));var Mustache=require(_0x3079('0x5'));var util=require(_0x3079('0x6'));var path=require('path');var sox=require(_0x3079('0x7'));var csv=require(_0x3079('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3079('0x9'));var jsforce=require(_0x3079('0xa'));var deskjs=require(_0x3079('0xb'));var toCsv=require(_0x3079('0x8'));var querystring=require('querystring');var Papa=require(_0x3079('0xc'));var authService=require(_0x3079('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x3079('0xe'))(_0x3079('0xf'));var utils=require(_0x3079('0x10'));var config=require(_0x3079('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x233ffd,_0x5f3943){_0x5f3943=_0x5f3943||0xcc;return function(_0x1245c6){if(_0x1245c6){return _0x233ffd['sendStatus'](_0x5f3943);}return _0x233ffd['status'](_0x5f3943)[_0x3079('0x12')]();};}function respondWithResult(_0x55b9df,_0x42aa8e){_0x42aa8e=_0x42aa8e||0xc8;return function(_0x28e266){if(_0x28e266){return _0x55b9df[_0x3079('0x13')](_0x42aa8e)[_0x3079('0x14')](_0x28e266);}};}function respondWithFilteredResult(_0x405c63,_0x3a91e9){return function(_0x4633d9){if(_0x4633d9){var _0x3b7c74=_0x4633d9['count'],_0x19d276=_0x3a91e9['offset'],_0x1e2866=_0x3a91e9['offset']+_0x3a91e9['limit'],_0x3cc991;if(_0x1e2866>=_0x3b7c74){_0x1e2866=_0x3b7c74;_0x3cc991=0xc8;}else{_0x3cc991=0xce;}_0x405c63[_0x3079('0x13')](_0x3cc991);return _0x405c63[_0x3079('0x15')](_0x3079('0x16'),_0x19d276+'-'+_0x1e2866+'/'+_0x3b7c74)[_0x3079('0x14')](_0x4633d9);}return null;};}function patchUpdates(_0x5e621d){return function(_0x1291a1){try{jsonpatch[_0x3079('0x17')](_0x1291a1,_0x5e621d,!![]);}catch(_0x4f817d){return BPromise[_0x3079('0x18')](_0x4f817d);}return _0x1291a1['save']();};}function saveUpdates(_0x4bd979,_0x2ed756){return function(_0x404cdb){if(_0x404cdb){return _0x404cdb[_0x3079('0x19')](_0x4bd979)['then'](function(_0x29e0d7){return _0x29e0d7;});}return null;};}function removeEntity(_0x2a64a7,_0x5ec7d8){return function(_0xbc9bd){if(_0xbc9bd){return _0xbc9bd[_0x3079('0x1a')]()[_0x3079('0x1b')](function(){_0x2a64a7['status'](0xcc)[_0x3079('0x12')]();});}};}function handleEntityNotFound(_0x4b2ee6,_0x580b2e){return function(_0x15d513){if(!_0x15d513){_0x4b2ee6[_0x3079('0x1c')](0x194);}return _0x15d513;};}function handleError(_0x551250,_0x64f312){_0x64f312=_0x64f312||0x1f4;return function(_0x4cc07e){logger['error'](_0x4cc07e[_0x3079('0x1d')]);if(_0x4cc07e[_0x3079('0x1e')]){delete _0x4cc07e[_0x3079('0x1e')];}_0x551250[_0x3079('0x13')](_0x64f312)['send'](_0x4cc07e);};}exports[_0x3079('0x1f')]=function(_0x1da520,_0x1236b4){var _0x3f40c4={},_0x1b02df={},_0x26ba30={'count':0x0,'rows':[]};var _0x3d8665=db[_0x3079('0x20')][_0x3079('0x21')];_0x1b02df['model']=_[_0x3079('0x22')](_0x3d8665);_0x1b02df[_0x3079('0x23')]=_[_0x3079('0x22')](_0x1da520[_0x3079('0x23')]);_0x1b02df[_0x3079('0x24')]=_['intersection'](_0x1b02df[_0x3079('0x25')],_0x1b02df[_0x3079('0x23')]);_0x3f40c4[_0x3079('0x26')]=_['intersection'](_0x1b02df['model'],qs[_0x3079('0x27')](_0x1da520[_0x3079('0x23')]['fields']));_0x3f40c4[_0x3079('0x26')]=_0x3f40c4[_0x3079('0x26')][_0x3079('0x28')]?_0x3f40c4[_0x3079('0x26')]:_0x1b02df[_0x3079('0x25')];if(!_0x1da520[_0x3079('0x23')][_0x3079('0x29')]('nolimit')){_0x3f40c4[_0x3079('0x2a')]=qs[_0x3079('0x2a')](_0x1da520[_0x3079('0x23')][_0x3079('0x2a')]);_0x3f40c4[_0x3079('0x2b')]=qs[_0x3079('0x2b')](_0x1da520[_0x3079('0x23')][_0x3079('0x2b')]);}_0x3f40c4[_0x3079('0x2c')]=qs[_0x3079('0x2d')](_0x1da520['query'][_0x3079('0x2d')]);_0x3f40c4[_0x3079('0x2e')]=qs['filters'](_[_0x3079('0x2f')](_0x1da520[_0x3079('0x23')],_0x1b02df[_0x3079('0x24')]));if(_0x1da520[_0x3079('0x23')]['filter']){_0x3f40c4[_0x3079('0x2e')]=_['merge'](_0x3f40c4['where'],{'$or':_[_0x3079('0x30')](_0x3d8665,function(_0x3eb735){if(_0x3eb735[_0x3079('0x31')]['key']!=='VIRTUAL'){var _0x27ee20={};_0x27ee20[_0x3eb735[_0x3079('0x32')]]={'$like':'%'+_0x1da520[_0x3079('0x23')][_0x3079('0x33')]+'%'};return _0x27ee20;}})});}_0x3f40c4=_[_0x3079('0x34')]({},_0x3f40c4,_0x1da520[_0x3079('0x35')]);var _0x5265bc={'where':_0x3f40c4['where']};return db[_0x3079('0x20')][_0x3079('0x36')](_0x5265bc)[_0x3079('0x1b')](function(_0x55c8b6){_0x26ba30['count']=_0x55c8b6;if(_0x1da520[_0x3079('0x23')][_0x3079('0x37')]){_0x3f40c4[_0x3079('0x38')]=[{'all':!![]}];}return db['UserProfileSection'][_0x3079('0x39')](_0x3f40c4);})[_0x3079('0x1b')](function(_0x1b76be){_0x26ba30['rows']=_0x1b76be;return _0x26ba30;})[_0x3079('0x1b')](respondWithFilteredResult(_0x1236b4,_0x3f40c4))[_0x3079('0x3a')](handleError(_0x1236b4,null));};exports[_0x3079('0x3b')]=function(_0x465b74,_0x8e16c1){var _0x350da3={'raw':![],'where':{'id':_0x465b74[_0x3079('0x3c')]['id']}},_0x477c78={};_0x477c78['model']=_[_0x3079('0x22')](db[_0x3079('0x20')][_0x3079('0x21')]);_0x477c78['query']=_[_0x3079('0x22')](_0x465b74['query']);_0x477c78[_0x3079('0x24')]=_['intersection'](_0x477c78['model'],_0x477c78[_0x3079('0x23')]);_0x350da3['attributes']=_[_0x3079('0x3d')](_0x477c78[_0x3079('0x25')],qs['fields'](_0x465b74[_0x3079('0x23')][_0x3079('0x27')]));_0x350da3[_0x3079('0x26')]=_0x350da3[_0x3079('0x26')][_0x3079('0x28')]?_0x350da3[_0x3079('0x26')]:_0x477c78[_0x3079('0x25')];if(_0x465b74['query'][_0x3079('0x37')]){_0x350da3[_0x3079('0x38')]=[{'all':!![]}];}_0x350da3=_[_0x3079('0x34')]({},_0x350da3,_0x465b74['options']);return db[_0x3079('0x20')][_0x3079('0x3e')](_0x350da3)[_0x3079('0x1b')](handleEntityNotFound(_0x8e16c1,null))[_0x3079('0x1b')](respondWithResult(_0x8e16c1,null))[_0x3079('0x3a')](handleError(_0x8e16c1,null));};exports[_0x3079('0x3f')]=function(_0x1898b4,_0x18bcae){return db['UserProfileSection'][_0x3079('0x3f')](_0x1898b4[_0x3079('0x40')],{})['then'](respondWithResult(_0x18bcae,0xc9))['catch'](handleError(_0x18bcae,null));};exports[_0x3079('0x19')]=function(_0x3455ad,_0x547559){if(_0x3455ad['body']['id']){delete _0x3455ad[_0x3079('0x40')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x3455ad[_0x3079('0x3c')]['id']}})[_0x3079('0x1b')](handleEntityNotFound(_0x547559,null))[_0x3079('0x1b')](saveUpdates(_0x3455ad[_0x3079('0x40')],null))[_0x3079('0x1b')](respondWithResult(_0x547559,null))['catch'](handleError(_0x547559,null));};exports['destroy']=function(_0x353ae8,_0x355926){return db[_0x3079('0x20')][_0x3079('0x3e')]({'where':{'id':_0x353ae8['params']['id']}})['then'](handleEntityNotFound(_0x355926,null))['then'](removeEntity(_0x355926,null))[_0x3079('0x3a')](handleError(_0x355926,null));};exports['describe']=function(_0x15ca76,_0x53c644){return db[_0x3079('0x20')][_0x3079('0x41')]()[_0x3079('0x1b')](respondWithResult(_0x53c644,null))[_0x3079('0x3a')](handleError(_0x53c644,null));}; \ No newline at end of file +var _0x56f8=['then','destroy','end','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','key','field','merge','UserProfileSection','includeAll','include','rows','catch','params','find','create','body','describe','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','Content-Range','json','reject'];(function(_0x2d68bf,_0x5712e7){var _0x55475c=function(_0x4683c5){while(--_0x4683c5){_0x2d68bf['push'](_0x2d68bf['shift']());}};_0x55475c(++_0x5712e7);}(_0x56f8,0x1f4));var _0x856f=function(_0x5687cb,_0x37dbfe){_0x5687cb=_0x5687cb-0x0;var _0x5df739=_0x56f8[_0x5687cb];return _0x5df739;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x856f('0x0'));var rp=require(_0x856f('0x1'));var moment=require('moment');var BPromise=require(_0x856f('0x2'));var Mustache=require(_0x856f('0x3'));var util=require(_0x856f('0x4'));var path=require('path');var sox=require(_0x856f('0x5'));var csv=require(_0x856f('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x856f('0x7'));var squel=require(_0x856f('0x8'));var crypto=require(_0x856f('0x9'));var jsforce=require(_0x856f('0xa'));var deskjs=require(_0x856f('0xb'));var toCsv=require(_0x856f('0x6'));var querystring=require('querystring');var Papa=require(_0x856f('0xc'));var authService=require(_0x856f('0xd'));var hardwareService=require(_0x856f('0xe'));var Redis=require(_0x856f('0xf'));var qs=require(_0x856f('0x10'));var logger=require(_0x856f('0x11'))('api');var utils=require(_0x856f('0x12'));var config=require(_0x856f('0x13'));var db=require(_0x856f('0x14'))['db'];function respondWithStatusCode(_0x55a1fe,_0x59ebdd){_0x59ebdd=_0x59ebdd||0xcc;return function(_0xebe862){if(_0xebe862){return _0x55a1fe[_0x856f('0x15')](_0x59ebdd);}return _0x55a1fe[_0x856f('0x16')](_0x59ebdd)['end']();};}function respondWithResult(_0x1071fa,_0x286680){_0x286680=_0x286680||0xc8;return function(_0x2f81f2){if(_0x2f81f2){return _0x1071fa[_0x856f('0x16')](_0x286680)['json'](_0x2f81f2);}};}function respondWithFilteredResult(_0x377514,_0x4bd905){return function(_0x2bbc5d){if(_0x2bbc5d){var _0x481e86=_0x2bbc5d[_0x856f('0x17')],_0x172fa4=_0x4bd905[_0x856f('0x18')],_0x4bf19e=_0x4bd905[_0x856f('0x18')]+_0x4bd905['limit'],_0x2f2cda;if(_0x4bf19e>=_0x481e86){_0x4bf19e=_0x481e86;_0x2f2cda=0xc8;}else{_0x2f2cda=0xce;}_0x377514[_0x856f('0x16')](_0x2f2cda);return _0x377514['set'](_0x856f('0x19'),_0x172fa4+'-'+_0x4bf19e+'/'+_0x481e86)[_0x856f('0x1a')](_0x2bbc5d);}return null;};}function patchUpdates(_0x2ce627){return function(_0x40001f){try{jsonpatch['apply'](_0x40001f,_0x2ce627,!![]);}catch(_0x428120){return BPromise[_0x856f('0x1b')](_0x428120);}return _0x40001f['save']();};}function saveUpdates(_0x326545,_0xc91a9e){return function(_0xe730b1){if(_0xe730b1){return _0xe730b1['update'](_0x326545)[_0x856f('0x1c')](function(_0xb06387){return _0xb06387;});}return null;};}function removeEntity(_0x108363,_0x1e219c){return function(_0xb75c70){if(_0xb75c70){return _0xb75c70[_0x856f('0x1d')]()[_0x856f('0x1c')](function(){_0x108363['status'](0xcc)[_0x856f('0x1e')]();});}};}function handleEntityNotFound(_0x4186f4,_0x44c7a5){return function(_0x4686e4){if(!_0x4686e4){_0x4186f4[_0x856f('0x15')](0x194);}return _0x4686e4;};}function handleError(_0x2a929d,_0x19f494){_0x19f494=_0x19f494||0x1f4;return function(_0x34b71d){logger['error'](_0x34b71d[_0x856f('0x1f')]);if(_0x34b71d[_0x856f('0x20')]){delete _0x34b71d[_0x856f('0x20')];}_0x2a929d[_0x856f('0x16')](_0x19f494)[_0x856f('0x21')](_0x34b71d);};}exports[_0x856f('0x22')]=function(_0x4e558f,_0x1e98a0){var _0x12d830={},_0x59a2f1={},_0x56bb76={'count':0x0,'rows':[]};var _0x6cdf7c=db['UserProfileSection'][_0x856f('0x23')];_0x59a2f1[_0x856f('0x24')]=_[_0x856f('0x25')](_0x6cdf7c);_0x59a2f1[_0x856f('0x26')]=_[_0x856f('0x25')](_0x4e558f[_0x856f('0x26')]);_0x59a2f1[_0x856f('0x27')]=_[_0x856f('0x28')](_0x59a2f1[_0x856f('0x24')],_0x59a2f1[_0x856f('0x26')]);_0x12d830['attributes']=_[_0x856f('0x28')](_0x59a2f1[_0x856f('0x24')],qs[_0x856f('0x29')](_0x4e558f['query'][_0x856f('0x29')]));_0x12d830[_0x856f('0x2a')]=_0x12d830['attributes'][_0x856f('0x2b')]?_0x12d830[_0x856f('0x2a')]:_0x59a2f1[_0x856f('0x24')];if(!_0x4e558f[_0x856f('0x26')][_0x856f('0x2c')](_0x856f('0x2d'))){_0x12d830[_0x856f('0x2e')]=qs[_0x856f('0x2e')](_0x4e558f['query']['limit']);_0x12d830[_0x856f('0x18')]=qs[_0x856f('0x18')](_0x4e558f[_0x856f('0x26')][_0x856f('0x18')]);}_0x12d830[_0x856f('0x2f')]=qs[_0x856f('0x30')](_0x4e558f[_0x856f('0x26')][_0x856f('0x30')]);_0x12d830[_0x856f('0x31')]=qs[_0x856f('0x27')](_[_0x856f('0x32')](_0x4e558f[_0x856f('0x26')],_0x59a2f1[_0x856f('0x27')]));if(_0x4e558f[_0x856f('0x26')][_0x856f('0x33')]){_0x12d830[_0x856f('0x31')]=_['merge'](_0x12d830[_0x856f('0x31')],{'$or':_['map'](_0x6cdf7c,function(_0x20f98e){if(_0x20f98e[_0x856f('0x34')][_0x856f('0x35')]!=='VIRTUAL'){var _0x5d6f16={};_0x5d6f16[_0x20f98e[_0x856f('0x36')]]={'$like':'%'+_0x4e558f[_0x856f('0x26')]['filter']+'%'};return _0x5d6f16;}})});}_0x12d830=_[_0x856f('0x37')]({},_0x12d830,_0x4e558f['options']);var _0x4e3677={'where':_0x12d830[_0x856f('0x31')]};return db[_0x856f('0x38')][_0x856f('0x17')](_0x4e3677)[_0x856f('0x1c')](function(_0x50e97c){_0x56bb76[_0x856f('0x17')]=_0x50e97c;if(_0x4e558f[_0x856f('0x26')][_0x856f('0x39')]){_0x12d830[_0x856f('0x3a')]=[{'all':!![]}];}return db[_0x856f('0x38')]['findAll'](_0x12d830);})[_0x856f('0x1c')](function(_0x1c50c3){_0x56bb76[_0x856f('0x3b')]=_0x1c50c3;return _0x56bb76;})[_0x856f('0x1c')](respondWithFilteredResult(_0x1e98a0,_0x12d830))[_0x856f('0x3c')](handleError(_0x1e98a0,null));};exports['show']=function(_0x5717d3,_0x34ebab){var _0x63376f={'raw':![],'where':{'id':_0x5717d3[_0x856f('0x3d')]['id']}},_0x38a8a9={};_0x38a8a9[_0x856f('0x24')]=_[_0x856f('0x25')](db[_0x856f('0x38')][_0x856f('0x23')]);_0x38a8a9[_0x856f('0x26')]=_['keys'](_0x5717d3['query']);_0x38a8a9['filters']=_[_0x856f('0x28')](_0x38a8a9[_0x856f('0x24')],_0x38a8a9[_0x856f('0x26')]);_0x63376f[_0x856f('0x2a')]=_[_0x856f('0x28')](_0x38a8a9['model'],qs[_0x856f('0x29')](_0x5717d3['query'][_0x856f('0x29')]));_0x63376f[_0x856f('0x2a')]=_0x63376f['attributes'][_0x856f('0x2b')]?_0x63376f['attributes']:_0x38a8a9['model'];if(_0x5717d3[_0x856f('0x26')][_0x856f('0x39')]){_0x63376f[_0x856f('0x3a')]=[{'all':!![]}];}_0x63376f=_[_0x856f('0x37')]({},_0x63376f,_0x5717d3['options']);return db[_0x856f('0x38')][_0x856f('0x3e')](_0x63376f)[_0x856f('0x1c')](handleEntityNotFound(_0x34ebab,null))[_0x856f('0x1c')](respondWithResult(_0x34ebab,null))[_0x856f('0x3c')](handleError(_0x34ebab,null));};exports[_0x856f('0x3f')]=function(_0xb41624,_0x7d9a84){return db[_0x856f('0x38')][_0x856f('0x3f')](_0xb41624[_0x856f('0x40')],{})[_0x856f('0x1c')](respondWithResult(_0x7d9a84,0xc9))['catch'](handleError(_0x7d9a84,null));};exports['update']=function(_0x1e950e,_0x441f76){if(_0x1e950e[_0x856f('0x40')]['id']){delete _0x1e950e['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x1e950e[_0x856f('0x3d')]['id']}})[_0x856f('0x1c')](handleEntityNotFound(_0x441f76,null))[_0x856f('0x1c')](saveUpdates(_0x1e950e[_0x856f('0x40')],null))['then'](respondWithResult(_0x441f76,null))[_0x856f('0x3c')](handleError(_0x441f76,null));};exports[_0x856f('0x1d')]=function(_0x32ffae,_0x404693){return db[_0x856f('0x38')]['find']({'where':{'id':_0x32ffae[_0x856f('0x3d')]['id']}})[_0x856f('0x1c')](handleEntityNotFound(_0x404693,null))[_0x856f('0x1c')](removeEntity(_0x404693,null))[_0x856f('0x3c')](handleError(_0x404693,null));};exports[_0x856f('0x41')]=function(_0x36ec62,_0x1c558f){return db[_0x856f('0x38')][_0x856f('0x41')]()[_0x856f('0x1c')](respondWithResult(_0x1c558f,null))[_0x856f('0x3c')](handleError(_0x1c558f,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 237dd6d..bd665ce 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 _0xdd48=['define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','api','bluebird','request-promise','exports'];(function(_0x14bef3,_0x41112f){var _0x3d52aa=function(_0x17326d){while(--_0x17326d){_0x14bef3['push'](_0x14bef3['shift']());}};_0x3d52aa(++_0x41112f);}(_0xdd48,0xec));var _0x8dd4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdd48[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x8dd4('0x0'));var util=require(_0x8dd4('0x1'));var logger=require('../../config/logger')(_0x8dd4('0x2'));var moment=require('moment');var BPromise=require(_0x8dd4('0x3'));var rp=require(_0x8dd4('0x4'));var attributes=require('./userProfileSection.attributes');module[_0x8dd4('0x5')]=function(_0x34ac5f,_0x5b36f1){return _0x34ac5f[_0x8dd4('0x6')](_0x8dd4('0x7'),attributes,{'tableName':_0x8dd4('0x8'),'paranoid':![],'indexes':[{'name':_0x8dd4('0x9'),'fields':['sectionId',_0x8dd4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf958=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','api','moment','bluebird','request-promise','./userProfileSection.attributes','exports','define','UserProfileSection'];(function(_0x5beb95,_0x12b81f){var _0x2b71a6=function(_0x4bcf18){while(--_0x4bcf18){_0x5beb95['push'](_0x5beb95['shift']());}};_0x2b71a6(++_0x12b81f);}(_0xf958,0x1c0));var _0x8f95=function(_0x361161,_0x45fdf3){_0x361161=_0x361161-0x0;var _0x4b48be=_0xf958[_0x361161];return _0x4b48be;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8f95('0x0'));var moment=require(_0x8f95('0x1'));var BPromise=require(_0x8f95('0x2'));var rp=require(_0x8f95('0x3'));var attributes=require(_0x8f95('0x4'));module[_0x8f95('0x5')]=function(_0x5e82fc,_0x2a4dcd){return _0x5e82fc[_0x8f95('0x6')](_0x8f95('0x7'),attributes,{'tableName':_0x8f95('0x8'),'paranoid':![],'indexes':[{'name':_0x8f95('0x9'),'fields':[_0x8f95('0xa'),_0x8f95('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ea89504..cce6751 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 _0x2fa9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x5e07a7,_0x1438b3){var _0x22ced5=function(_0x7c975b){while(--_0x7c975b){_0x5e07a7['push'](_0x5e07a7['shift']());}};_0x22ced5(++_0x1438b3);}(_0x2fa9,0x91));var _0x92fa=function(_0x2eee62,_0x7128f7){_0x2eee62=_0x2eee62-0x0;var _0x49b9aa=_0x2fa9[_0x2eee62];return _0x49b9aa;};'use strict';var _=require(_0x92fa('0x0'));var util=require(_0x92fa('0x1'));var moment=require('moment');var BPromise=require(_0x92fa('0x2'));var rs=require(_0x92fa('0x3'));var fs=require('fs');var Redis=require(_0x92fa('0x4'));var db=require(_0x92fa('0x5'))['db'];var utils=require(_0x92fa('0x6'));var logger=require('../../config/logger')(_0x92fa('0x7'));var config=require(_0x92fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x92fa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5272d0,_0x51a8e1,_0x2c840c){return new BPromise(function(_0x44abb4,_0x3d410d){return client['request'](_0x5272d0,_0x2c840c)[_0x92fa('0xa')](function(_0x10f35d){logger[_0x92fa('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x51a8e1,_0x92fa('0xc'));logger['debug'](_0x92fa('0xd'),_0x51a8e1,_0x92fa('0xc'),JSON[_0x92fa('0xe')](_0x10f35d));if(_0x10f35d[_0x92fa('0xf')]){if(_0x10f35d['error'][_0x92fa('0x10')]===0x1f4){logger[_0x92fa('0xf')](_0x92fa('0x11'),_0x51a8e1,_0x10f35d[_0x92fa('0xf')][_0x92fa('0x12')]);return _0x3d410d(_0x10f35d[_0x92fa('0xf')][_0x92fa('0x12')]);}logger[_0x92fa('0xf')](_0x92fa('0x11'),_0x51a8e1,_0x10f35d[_0x92fa('0xf')][_0x92fa('0x12')]);return _0x44abb4(_0x10f35d[_0x92fa('0xf')][_0x92fa('0x12')]);}else{logger[_0x92fa('0xb')](_0x92fa('0x11'),_0x51a8e1,_0x92fa('0xc'));_0x44abb4(_0x10f35d[_0x92fa('0x13')][_0x92fa('0x12')]);}})[_0x92fa('0x14')](function(_0x45a0d3){logger[_0x92fa('0xf')](_0x92fa('0x11'),_0x51a8e1,_0x45a0d3);_0x3d410d(_0x45a0d3);});});} \ No newline at end of file +var _0x6cc1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x489fe3,_0x5ebb81){var _0x592190=function(_0x1612a7){while(--_0x1612a7){_0x489fe3['push'](_0x489fe3['shift']());}};_0x592190(++_0x5ebb81);}(_0x6cc1,0x126));var _0x16cc=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0x6cc1[_0x4b4638];return _0x59e92b;};'use strict';var _=require(_0x16cc('0x0'));var util=require(_0x16cc('0x1'));var moment=require(_0x16cc('0x2'));var BPromise=require(_0x16cc('0x3'));var rs=require(_0x16cc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x16cc('0x5'));var logger=require(_0x16cc('0x6'))(_0x16cc('0x7'));var config=require(_0x16cc('0x8'));var jayson=require(_0x16cc('0x9'));var client=jayson[_0x16cc('0xa')][_0x16cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44ed9c,_0x9a620b,_0x1c511a){return new BPromise(function(_0x2f3202,_0x10c8e1){return client[_0x16cc('0xc')](_0x44ed9c,_0x1c511a)[_0x16cc('0xd')](function(_0x4a8d2d){logger[_0x16cc('0xe')](_0x16cc('0xf'),_0x9a620b,_0x16cc('0x10'));logger[_0x16cc('0x11')](_0x16cc('0x12'),_0x9a620b,_0x16cc('0x10'),JSON['stringify'](_0x4a8d2d));if(_0x4a8d2d['error']){if(_0x4a8d2d[_0x16cc('0x13')]['code']===0x1f4){logger[_0x16cc('0x13')](_0x16cc('0xf'),_0x9a620b,_0x4a8d2d[_0x16cc('0x13')][_0x16cc('0x14')]);return _0x10c8e1(_0x4a8d2d[_0x16cc('0x13')][_0x16cc('0x14')]);}logger[_0x16cc('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x9a620b,_0x4a8d2d['error'][_0x16cc('0x14')]);return _0x2f3202(_0x4a8d2d[_0x16cc('0x13')]['message']);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x9a620b,_0x16cc('0x10'));_0x2f3202(_0x4a8d2d[_0x16cc('0x15')][_0x16cc('0x14')]);}})[_0x16cc('0x16')](function(_0x51539d){logger[_0x16cc('0x13')](_0x16cc('0xf'),_0x9a620b,_0x51539d);_0x10c8e1(_0x51539d);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ae04db8..e542376 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 _0xf03a=['../../components/auth/service','../../components/interaction/service','exports','util','path','connect-timeout','express'];(function(_0x13861f,_0xa09fd0){var _0x2c0685=function(_0x198356){while(--_0x198356){_0x13861f['push'](_0x13861f['shift']());}};_0x2c0685(++_0xa09fd0);}(_0xf03a,0x1a0));var _0xaf03=function(_0x320644,_0x2e5ded){_0x320644=_0x320644-0x0;var _0x44e0e6=_0xf03a[_0x320644];return _0x44e0e6;};'use strict';var multer=require('multer');var util=require(_0xaf03('0x0'));var path=require(_0xaf03('0x1'));var timeout=require(_0xaf03('0x2'));var express=require(_0xaf03('0x3'));var router=express['Router']();var auth=require(_0xaf03('0x4'));var interaction=require(_0xaf03('0x5'));var config=require('../../config/environment');module[_0xaf03('0x6')]=router; \ No newline at end of file +var _0xd916=['../../components/auth/service','../../components/interaction/service','multer','util','path','connect-timeout','express'];(function(_0x4fbbee,_0x11debc){var _0x18b9c1=function(_0x362062){while(--_0x362062){_0x4fbbee['push'](_0x4fbbee['shift']());}};_0x18b9c1(++_0x11debc);}(_0xd916,0x18a));var _0x6d91=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xd916[_0x2d34d6];return _0x1d3d12;};'use strict';var multer=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var path=require(_0x6d91('0x2'));var timeout=require(_0x6d91('0x3'));var express=require(_0x6d91('0x4'));var router=express['Router']();var auth=require(_0x6d91('0x5'));var interaction=require(_0x6d91('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 73925de..747178b 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 _0x10c4=['INTEGER','sequelize','exports'];(function(_0x4fc251,_0x5c397d){var _0x36eb2c=function(_0x497f95){while(--_0x497f95){_0x4fc251['push'](_0x4fc251['shift']());}};_0x36eb2c(++_0x5c397d);}(_0x10c4,0x13f));var _0x410c=function(_0x19a128,_0x5414d3){_0x19a128=_0x19a128-0x0;var _0x339af4=_0x10c4[_0x19a128];return _0x339af4;};'use strict';var Sequelize=require(_0x410c('0x0'));module[_0x410c('0x1')]={'penalty':{'type':Sequelize[_0x410c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70f1=['sequelize','exports','INTEGER'];(function(_0x459f68,_0x194353){var _0x9f0cb2=function(_0x1b41a2){while(--_0x1b41a2){_0x459f68['push'](_0x459f68['shift']());}};_0x9f0cb2(++_0x194353);}(_0x70f1,0xa5));var _0x170f=function(_0x3b3c58,_0x5a1081){_0x3b3c58=_0x3b3c58-0x0;var _0x128e68=_0x70f1[_0x3b3c58];return _0x128e68;};'use strict';var Sequelize=require(_0x170f('0x0'));module[_0x170f('0x1')]={'penalty':{'type':Sequelize[_0x170f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 4434f7b..d74987d 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 _0x48db=['moment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x1cbddf,_0x2dcdb2){var _0x2c19f6=function(_0x55cf2c){while(--_0x55cf2c){_0x1cbddf['push'](_0x1cbddf['shift']());}};_0x2c19f6(++_0x2dcdb2);}(_0x48db,0x18c));var _0xb48d=function(_0x33445a,_0x11e8c8){_0x33445a=_0x33445a-0x0;var _0xde4096=_0x48db[_0x33445a];return _0xde4096;};'use strict';var _=require(_0xb48d('0x0'));var util=require(_0xb48d('0x1'));var logger=require(_0xb48d('0x2'))(_0xb48d('0x3'));var moment=require(_0xb48d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xb48d('0x5'));module[_0xb48d('0x6')]=function(_0x4d7b61,_0x1d7db5){return _0x4d7b61[_0xb48d('0x7')](_0xb48d('0x8'),attributes,{'tableName':_0xb48d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca2c=['moment','bluebird','request-promise','./userSmsQueue.attributes','lodash','../../config/logger','api'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xca2c,0x131));var _0xcca2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xca2c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xcca2('0x0'));var util=require('util');var logger=require(_0xcca2('0x1'))(_0xcca2('0x2'));var moment=require(_0xcca2('0x3'));var BPromise=require(_0xcca2('0x4'));var rp=require(_0xcca2('0x5'));var attributes=require(_0xcca2('0x6'));module['exports']=function(_0x31a8eb,_0x225683){return _0x31a8eb['define']('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','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 5a2dfa6..a6adadd 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 _0x3b0e=['../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x3b0e,0xa2));var _0xe3b0=function(_0x4c6e1c,_0x7910b3){_0x4c6e1c=_0x4c6e1c-0x0;var _0x5add28=_0x3b0e[_0x4c6e1c];return _0x5add28;};'use strict';var _=require(_0xe3b0('0x0'));var util=require(_0xe3b0('0x1'));var moment=require(_0xe3b0('0x2'));var BPromise=require(_0xe3b0('0x3'));var rs=require(_0xe3b0('0x4'));var fs=require('fs');var Redis=require(_0xe3b0('0x5'));var db=require(_0xe3b0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe3b0('0x7'));var config=require(_0xe3b0('0x8'));var jayson=require(_0xe3b0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf6d0,_0x5e7f5d,_0x33f9dd){return new BPromise(function(_0x16adf0,_0x2a91cb){return client[_0xe3b0('0xa')](_0x5cf6d0,_0x33f9dd)[_0xe3b0('0xb')](function(_0x4e16f1){logger['info'](_0xe3b0('0xc'),_0x5e7f5d,_0xe3b0('0xd'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x5e7f5d,_0xe3b0('0xd'),JSON[_0xe3b0('0xe')](_0x4e16f1));if(_0x4e16f1[_0xe3b0('0xf')]){if(_0x4e16f1[_0xe3b0('0xf')][_0xe3b0('0x10')]===0x1f4){logger['error'](_0xe3b0('0xc'),_0x5e7f5d,_0x4e16f1[_0xe3b0('0xf')][_0xe3b0('0x11')]);return _0x2a91cb(_0x4e16f1['error'][_0xe3b0('0x11')]);}logger[_0xe3b0('0xf')](_0xe3b0('0xc'),_0x5e7f5d,_0x4e16f1[_0xe3b0('0xf')][_0xe3b0('0x11')]);return _0x16adf0(_0x4e16f1['error'][_0xe3b0('0x11')]);}else{logger[_0xe3b0('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x5e7f5d,'request\x20sent');_0x16adf0(_0x4e16f1[_0xe3b0('0x13')][_0xe3b0('0x11')]);}})[_0xe3b0('0x14')](function(_0x25766d){logger[_0xe3b0('0xf')](_0xe3b0('0xc'),_0x5e7f5d,_0x25766d);_0x2a91cb(_0x25766d);});});} \ No newline at end of file +var _0x082b=['error','code','UserSmsQueue,\x20%s,\x20%s','message','lodash','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4ac6e9,_0x2bc178){var _0x2c6b4c=function(_0x5e02c4){while(--_0x5e02c4){_0x4ac6e9['push'](_0x4ac6e9['shift']());}};_0x2c6b4c(++_0x2bc178);}(_0x082b,0xca));var _0xb082=function(_0x4d7cc4,_0x256991){_0x4d7cc4=_0x4d7cc4-0x0;var _0x24dd38=_0x082b[_0x4d7cc4];return _0x24dd38;};'use strict';var _=require(_0xb082('0x0'));var util=require('util');var moment=require(_0xb082('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb082('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb082('0x3'))(_0xb082('0x4'));var config=require(_0xb082('0x5'));var jayson=require(_0xb082('0x6'));var client=jayson[_0xb082('0x7')][_0xb082('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48aa04,_0x3870e9,_0x25eb70){return new BPromise(function(_0x5b48d8,_0xb32d63){return client[_0xb082('0x9')](_0x48aa04,_0x25eb70)['then'](function(_0x331405){logger[_0xb082('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x3870e9,_0xb082('0xb'));logger['debug'](_0xb082('0xc'),_0x3870e9,_0xb082('0xb'),JSON[_0xb082('0xd')](_0x331405));if(_0x331405['error']){if(_0x331405[_0xb082('0xe')][_0xb082('0xf')]===0x1f4){logger[_0xb082('0xe')](_0xb082('0x10'),_0x3870e9,_0x331405[_0xb082('0xe')][_0xb082('0x11')]);return _0xb32d63(_0x331405[_0xb082('0xe')][_0xb082('0x11')]);}logger[_0xb082('0xe')](_0xb082('0x10'),_0x3870e9,_0x331405['error'][_0xb082('0x11')]);return _0x5b48d8(_0x331405[_0xb082('0xe')][_0xb082('0x11')]);}else{logger[_0xb082('0xa')](_0xb082('0x10'),_0x3870e9,'request\x20sent');_0x5b48d8(_0x331405['result'][_0xb082('0x11')]);}})['catch'](function(_0x49b4b6){logger[_0xb082('0xe')](_0xb082('0x10'),_0x3870e9,_0x49b4b6);_0xb32d63(_0x49b4b6);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 5b8a51e..9e5b79c 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 _0xb4c7=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x230de2,_0x16e914){_0x230de2=_0x230de2-0x0;var _0x2f2aee=_0xb4c7[_0x230de2];return _0x2f2aee;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var auth=require(_0x7b4c('0x5'));var interaction=require(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));module[_0x7b4c('0x8')]=router; \ No newline at end of file +var _0x7919=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4279e1,_0x39cda4){var _0x1e33ea=function(_0x5b00ea){while(--_0x5b00ea){_0x4279e1['push'](_0x4279e1['shift']());}};_0x1e33ea(++_0x39cda4);}(_0x7919,0xeb));var _0x9791=function(_0x439204,_0x402d9a){_0x439204=_0x439204-0x0;var _0x24bc7c=_0x7919[_0x439204];return _0x24bc7c;};'use strict';var multer=require(_0x9791('0x0'));var util=require(_0x9791('0x1'));var path=require(_0x9791('0x2'));var timeout=require(_0x9791('0x3'));var express=require(_0x9791('0x4'));var router=express[_0x9791('0x5')]();var auth=require(_0x9791('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9791('0x7'));module[_0x9791('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 9006424..211a306 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x65a2=['exports','INTEGER'];(function(_0xcde160,_0x3bb5bb){var _0x2034ec=function(_0xde461c){while(--_0xde461c){_0xcde160['push'](_0xcde160['shift']());}};_0x2034ec(++_0x3bb5bb);}(_0x65a2,0xfa));var _0x265a=function(_0x1d2b68,_0x30fc30){_0x1d2b68=_0x1d2b68-0x0;var _0x4ef516=_0x65a2[_0x1d2b68];return _0x4ef516;};'use strict';var Sequelize=require('sequelize');module[_0x265a('0x0')]={'penalty':{'type':Sequelize[_0x265a('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 191cc57..9cce0c3 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 _0x0210=['exports','lodash','../../config/logger','api','bluebird','request-promise','./userVoiceQueue.attributes'];(function(_0xc1136d,_0x3d339f){var _0x3ba510=function(_0x1e5a6b){while(--_0x1e5a6b){_0xc1136d['push'](_0xc1136d['shift']());}};_0x3ba510(++_0x3d339f);}(_0x0210,0xf6));var _0x0021=function(_0x40d77c,_0x3adfcf){_0x40d77c=_0x40d77c-0x0;var _0x324ba1=_0x0210[_0x40d77c];return _0x324ba1;};'use strict';var _=require(_0x0021('0x0'));var util=require('util');var logger=require(_0x0021('0x1'))(_0x0021('0x2'));var moment=require('moment');var BPromise=require(_0x0021('0x3'));var rp=require(_0x0021('0x4'));var attributes=require(_0x0021('0x5'));module[_0x0021('0x6')]=function(_0x109477,_0x5643b7){return _0x109477['define']('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea9a=['UserVoiceQueue','lodash','../../config/logger','api','moment','request-promise','./userVoiceQueue.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea9a,0xd9));var _0xaea9=function(_0x3925c8,_0x2594b6){_0x3925c8=_0x3925c8-0x0;var _0x4c2567=_0xea9a[_0x3925c8];return _0x4c2567;};'use strict';var _=require(_0xaea9('0x0'));var util=require('util');var logger=require(_0xaea9('0x1'))(_0xaea9('0x2'));var moment=require(_0xaea9('0x3'));var BPromise=require('bluebird');var rp=require(_0xaea9('0x4'));var attributes=require(_0xaea9('0x5'));module[_0xaea9('0x6')]=function(_0x317460,_0x3e7365){return _0x317460[_0xaea9('0x7')](_0xaea9('0x8'),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 835830a..7f5406d 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 _0x045c=['error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x153d49,_0x4c5be1){var _0x23435a=function(_0x19a1e5){while(--_0x19a1e5){_0x153d49['push'](_0x153d49['shift']());}};_0x23435a(++_0x4c5be1);}(_0x045c,0xcb));var _0xc045=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x045c[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0xc045('0x0'));var util=require(_0xc045('0x1'));var moment=require(_0xc045('0x2'));var BPromise=require(_0xc045('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc045('0x4'));var db=require(_0xc045('0x5'))['db'];var utils=require(_0xc045('0x6'));var logger=require(_0xc045('0x7'))(_0xc045('0x8'));var config=require(_0xc045('0x9'));var jayson=require(_0xc045('0xa'));var client=jayson[_0xc045('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33a189,_0x4dd377,_0x4a37b6){return new BPromise(function(_0x4769f6,_0xbb7ccd){return client['request'](_0x33a189,_0x4a37b6)[_0xc045('0xc')](function(_0x388435){logger['info'](_0xc045('0xd'),_0x4dd377,_0xc045('0xe'));logger[_0xc045('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4dd377,_0xc045('0xe'),JSON[_0xc045('0x10')](_0x388435));if(_0x388435['error']){if(_0x388435['error']['code']===0x1f4){logger[_0xc045('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x4dd377,_0x388435[_0xc045('0x11')][_0xc045('0x12')]);return _0xbb7ccd(_0x388435[_0xc045('0x11')]['message']);}logger[_0xc045('0x11')](_0xc045('0xd'),_0x4dd377,_0x388435[_0xc045('0x11')][_0xc045('0x12')]);return _0x4769f6(_0x388435[_0xc045('0x11')][_0xc045('0x12')]);}else{logger['info'](_0xc045('0xd'),_0x4dd377,'request\x20sent');_0x4769f6(_0x388435['result']['message']);}})[_0xc045('0x13')](function(_0xa026e2){logger[_0xc045('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x4dd377,_0xa026e2);_0xbb7ccd(_0xa026e2);});});} \ No newline at end of file +var _0xe478=['stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x27c2d0,_0x23ee15){var _0x5da5ed=function(_0x44d165){while(--_0x44d165){_0x27c2d0['push'](_0x27c2d0['shift']());}};_0x5da5ed(++_0x23ee15);}(_0xe478,0x19e));var _0x8e47=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xe478[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x8e47('0x0'));var util=require('util');var moment=require(_0x8e47('0x1'));var BPromise=require(_0x8e47('0x2'));var rs=require(_0x8e47('0x3'));var fs=require('fs');var Redis=require(_0x8e47('0x4'));var db=require(_0x8e47('0x5'))['db'];var utils=require(_0x8e47('0x6'));var logger=require(_0x8e47('0x7'))(_0x8e47('0x8'));var config=require(_0x8e47('0x9'));var jayson=require(_0x8e47('0xa'));var client=jayson[_0x8e47('0xb')][_0x8e47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34f242,_0x29cc4e,_0x24125e){return new BPromise(function(_0x1658e2,_0x4c6c3d){return client[_0x8e47('0xd')](_0x34f242,_0x24125e)[_0x8e47('0xe')](function(_0x3a69f0){logger[_0x8e47('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x29cc4e,'request\x20sent');logger['debug'](_0x8e47('0x10'),_0x29cc4e,_0x8e47('0x11'),JSON[_0x8e47('0x12')](_0x3a69f0));if(_0x3a69f0['error']){if(_0x3a69f0[_0x8e47('0x13')][_0x8e47('0x14')]===0x1f4){logger[_0x8e47('0x13')](_0x8e47('0x15'),_0x29cc4e,_0x3a69f0[_0x8e47('0x13')][_0x8e47('0x16')]);return _0x4c6c3d(_0x3a69f0['error'][_0x8e47('0x16')]);}logger[_0x8e47('0x13')](_0x8e47('0x15'),_0x29cc4e,_0x3a69f0[_0x8e47('0x13')]['message']);return _0x1658e2(_0x3a69f0[_0x8e47('0x13')][_0x8e47('0x16')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x29cc4e,_0x8e47('0x11'));_0x1658e2(_0x3a69f0[_0x8e47('0x17')][_0x8e47('0x16')]);}})['catch'](function(_0x2b18f6){logger[_0x8e47('0x13')](_0x8e47('0x15'),_0x29cc4e,_0x2b18f6);_0x4c6c3d(_0x2b18f6);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3ca3321..6afdc4f 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 _0x46ed=['Router','../../components/interaction/service','../../config/environment','multer','util','connect-timeout','express'];(function(_0x2c6a0d,_0x28a135){var _0x4f9bde=function(_0x2e0f3d){while(--_0x2e0f3d){_0x2c6a0d['push'](_0x2c6a0d['shift']());}};_0x4f9bde(++_0x28a135);}(_0x46ed,0x168));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));module['exports']=router; \ No newline at end of file +var _0x9576=['../../config/environment','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x9576,0x182));var _0x6957=function(_0x1830ef,_0x356eab){_0x1830ef=_0x1830ef-0x0;var _0x144dc9=_0x9576[_0x1830ef];return _0x144dc9;};'use strict';var multer=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var path=require(_0x6957('0x2'));var timeout=require(_0x6957('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6957('0x4'));var interaction=require(_0x6957('0x5'));var config=require(_0x6957('0x6'));module[_0x6957('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 4483c73..b852e51 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 _0x87dc=['queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x31d225,_0x2c5df8){var _0x14f6a2=function(_0x5894de){while(--_0x5894de){_0x31d225['push'](_0x31d225['shift']());}};_0x14f6a2(++_0x2c5df8);}(_0x87dc,0x163));var _0xc87d=function(_0x3a390e,_0x345060){_0x3a390e=_0x3a390e-0x0;var _0xbb9204=_0x87dc[_0x3a390e];return _0xbb9204;};'use strict';var Sequelize=require(_0xc87d('0x0'));module[_0xc87d('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc87d('0x2')},'membername':{'type':Sequelize[_0xc87d('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xc87d('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc87d('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xc87d('0x2')},'VoiceQueueId':{'type':Sequelize[_0xc87d('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0xc87d('0x3')],'allowNull':![],'unique':_0xc87d('0x5'),'comment':_0xc87d('0x2')},'penalty':{'type':Sequelize[_0xc87d('0x4')](0xb),'defaultValue':0x0,'comment':_0xc87d('0x2')},'paused':{'type':Sequelize[_0xc87d('0x4')](0xb),'defaultValue':0x0,'comment':_0xc87d('0x2')}}; \ No newline at end of file +var _0xa97e=['STRING','queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk'];(function(_0x13d46e,_0xb71980){var _0x30e59b=function(_0x239cfc){while(--_0x239cfc){_0x13d46e['push'](_0x13d46e['shift']());}};_0x30e59b(++_0xb71980);}(_0xa97e,0xca));var _0xea97=function(_0x210b58,_0x916516){_0x210b58=_0x210b58-0x0;var _0x1029ef=_0xa97e[_0x210b58];return _0x1029ef;};'use strict';var Sequelize=require(_0xea97('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xea97('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xea97('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xea97('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xea97('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xea97('0x2')},'VoiceQueueId':{'type':Sequelize[_0xea97('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xea97('0x3')],'allowNull':![],'unique':_0xea97('0x4'),'comment':_0xea97('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xea97('0x2')},'paused':{'type':Sequelize[_0xea97('0x1')](0xb),'defaultValue':0x0,'comment':_0xea97('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 7019d95..e75df55 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 _0xa923=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x2e94da,_0x535c71){var _0x39a290=function(_0x2eb8e7){while(--_0x2eb8e7){_0x2e94da['push'](_0x2e94da['shift']());}};_0x39a290(++_0x535c71);}(_0xa923,0xf2));var _0x3a92=function(_0x1594b3,_0x32283d){_0x1594b3=_0x1594b3-0x0;var _0x1510de=_0xa923[_0x1594b3];return _0x1510de;};'use strict';var EventEmitter=require(_0x3a92('0x0'));var UserVoiceQueueRt=require(_0x3a92('0x1'))['db'][_0x3a92('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3a92('0x3')](0x0);var events={'afterCreate':_0x3a92('0x4'),'afterUpdate':'update','afterDestroy':_0x3a92('0x5')};function emitEvent(_0x42cf1e){return function(_0x4bc757,_0xc9f18f,_0x1e49f9){UserVoiceQueueRtEvents[_0x3a92('0x6')](_0x42cf1e+':'+_0x4bc757['id'],_0x4bc757);UserVoiceQueueRtEvents[_0x3a92('0x6')](_0x42cf1e,_0x4bc757);_0x1e49f9(null);};}for(var e in events){if(events[_0x3a92('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x3a92('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x3521=['exports','events','../../mysqldb','UserVoiceQueueRt','save','remove','emit','hook'];(function(_0x2cc386,_0x105121){var _0x731ae4=function(_0x35cfad){while(--_0x35cfad){_0x2cc386['push'](_0x2cc386['shift']());}};_0x731ae4(++_0x105121);}(_0x3521,0x131));var _0x1352=function(_0x60cd1f,_0x4e555){_0x60cd1f=_0x60cd1f-0x0;var _0x31ceb4=_0x3521[_0x60cd1f];return _0x31ceb4;};'use strict';var EventEmitter=require(_0x1352('0x0'));var UserVoiceQueueRt=require(_0x1352('0x1'))['db'][_0x1352('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1352('0x3'),'afterUpdate':'update','afterDestroy':_0x1352('0x4')};function emitEvent(_0xd02411){return function(_0xa7510a,_0x4a9f34,_0x1c13b3){UserVoiceQueueRtEvents['emit'](_0xd02411+':'+_0xa7510a['id'],_0xa7510a);UserVoiceQueueRtEvents[_0x1352('0x5')](_0xd02411,_0xa7510a);_0x1c13b3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x1352('0x6')](e,emitEvent(event));}}module[_0x1352('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index de22417..b4a8f72 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 _0xe86a=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','bluebird','request-promise','exports','define'];(function(_0x40d53b,_0x96e75f){var _0x6dce9e=function(_0x4bd947){while(--_0x4bd947){_0x40d53b['push'](_0x40d53b['shift']());}};_0x6dce9e(++_0x96e75f);}(_0xe86a,0xfe));var _0xae86=function(_0x281f26,_0xebacd3){_0x281f26=_0x281f26-0x0;var _0x2771fc=_0xe86a[_0x281f26];return _0x2771fc;};'use strict';var _=require(_0xae86('0x0'));var util=require(_0xae86('0x1'));var logger=require('../../config/logger')(_0xae86('0x2'));var moment=require('moment');var BPromise=require(_0xae86('0x3'));var rp=require(_0xae86('0x4'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xae86('0x5')]=function(_0x449f1c,_0x157a95){return _0x449f1c[_0xae86('0x6')](_0xae86('0x7'),attributes,{'tableName':_0xae86('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd2a=['lodash','util','../../config/logger','moment','request-promise','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x3dcd52,_0x2c151a){var _0x4fb1c2=function(_0x34081a){while(--_0x34081a){_0x3dcd52['push'](_0x3dcd52['shift']());}};_0x4fb1c2(++_0x2c151a);}(_0xcd2a,0x1ef));var _0xacd2=function(_0x3782f1,_0xdb9da7){_0x3782f1=_0x3782f1-0x0;var _0x59aa2c=_0xcd2a[_0x3782f1];return _0x59aa2c;};'use strict';var _=require(_0xacd2('0x0'));var util=require(_0xacd2('0x1'));var logger=require(_0xacd2('0x2'))('api');var moment=require(_0xacd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xacd2('0x4'));var attributes=require(_0xacd2('0x5'));module[_0xacd2('0x6')]=function(_0x3e592e,_0x36ad97){return _0x3e592e['define'](_0xacd2('0x7'),attributes,{'tableName':_0xacd2('0x8'),'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 a683e00..4dffcb9 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 _0xcbc5=['UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info'];(function(_0x35eb96,_0xe23472){var _0x4f214b=function(_0x45e507){while(--_0x45e507){_0x35eb96['push'](_0x35eb96['shift']());}};_0x4f214b(++_0xe23472);}(_0xcbc5,0xe9));var _0x5cbc=function(_0x5b3b6a,_0x906f49){_0x5b3b6a=_0x5b3b6a-0x0;var _0x4a9af7=_0xcbc5[_0x5b3b6a];return _0x4a9af7;};'use strict';var _=require(_0x5cbc('0x0'));var util=require(_0x5cbc('0x1'));var moment=require(_0x5cbc('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cbc('0x3'));var fs=require('fs');var Redis=require(_0x5cbc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5cbc('0x5'));var logger=require(_0x5cbc('0x6'))('rpc');var config=require(_0x5cbc('0x7'));var jayson=require(_0x5cbc('0x8'));var client=jayson[_0x5cbc('0x9')][_0x5cbc('0xa')]({'port':0x232a});config[_0x5cbc('0xb')]=_[_0x5cbc('0xc')](config[_0x5cbc('0xb')],{'host':_0x5cbc('0xd'),'port':0x18eb});var socket=require(_0x5cbc('0xe'))(new Redis(config[_0x5cbc('0xb')]));require(_0x5cbc('0xf'))['register'](socket);function respondWithRpcPromise(_0x510ff2,_0x1266cf,_0x2c649a){return new BPromise(function(_0x511feb,_0x13e96e){return client[_0x5cbc('0x10')](_0x510ff2,_0x2c649a)[_0x5cbc('0x11')](function(_0x17530f){logger[_0x5cbc('0x12')](_0x5cbc('0x13'),_0x1266cf,_0x5cbc('0x14'));logger[_0x5cbc('0x15')](_0x5cbc('0x16'),_0x1266cf,_0x5cbc('0x14'),JSON['stringify'](_0x17530f));if(_0x17530f['error']){if(_0x17530f[_0x5cbc('0x17')][_0x5cbc('0x18')]===0x1f4){logger[_0x5cbc('0x17')](_0x5cbc('0x13'),_0x1266cf,_0x17530f[_0x5cbc('0x17')][_0x5cbc('0x19')]);return _0x13e96e(_0x17530f[_0x5cbc('0x17')][_0x5cbc('0x19')]);}logger[_0x5cbc('0x17')](_0x5cbc('0x13'),_0x1266cf,_0x17530f[_0x5cbc('0x17')]['message']);return _0x511feb(_0x17530f[_0x5cbc('0x17')][_0x5cbc('0x19')]);}else{logger['info'](_0x5cbc('0x13'),_0x1266cf,_0x5cbc('0x14'));_0x511feb(_0x17530f[_0x5cbc('0x1a')][_0x5cbc('0x19')]);}})[_0x5cbc('0x1b')](function(_0x42957e){logger[_0x5cbc('0x17')](_0x5cbc('0x13'),_0x1266cf,_0x42957e);_0x13e96e(_0x42957e);});});}exports[_0x5cbc('0x1c')]=function(_0x3b382f){var _0x1d4c2c=this;return new Promise(function(_0x49d7f1,_0x37e298){return db[_0x5cbc('0x1d')][_0x5cbc('0x1e')]({'raw':_0x3b382f['options']?_0x3b382f[_0x5cbc('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3b382f[_0x5cbc('0x1f')]?_0x3b382f[_0x5cbc('0x1f')][_0x5cbc('0x20')]||null:null,'attributes':[[db[_0x5cbc('0x21')]['fn']('COUNT',db[_0x5cbc('0x21')]['fn']('IF',db['sequelize'][_0x5cbc('0x22')](_0x5cbc('0x23')))),'outboundQueuePauses']]})[_0x5cbc('0x11')](function(_0x29c3f8){logger[_0x5cbc('0x12')](_0x5cbc('0x1c'),_0x3b382f);logger[_0x5cbc('0x15')](_0x5cbc('0x1c'),_0x3b382f,JSON['stringify'](_0x29c3f8));_0x49d7f1(_0x29c3f8);})[_0x5cbc('0x1b')](function(_0x5243f5){logger[_0x5cbc('0x17')](_0x5cbc('0x1c'),_0x5243f5['message'],_0x3b382f);_0x37e298(_0x1d4c2c[_0x5cbc('0x17')](0x1f4,_0x5243f5[_0x5cbc('0x19')]));});});}; \ No newline at end of file +var _0x4476=['literal','stringify','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','UserVoiceQueueRt,\x20%s,\x20%s','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x4476,0x98));var _0x6447=function(_0x2aefff,_0x26a24b){_0x2aefff=_0x2aefff-0x0;var _0x4e4534=_0x4476[_0x2aefff];return _0x4e4534;};'use strict';var _=require('lodash');var util=require(_0x6447('0x0'));var moment=require('moment');var BPromise=require(_0x6447('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6447('0x2'));var logger=require(_0x6447('0x3'))(_0x6447('0x4'));var config=require(_0x6447('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6447('0x6')]['http']({'port':0x232a});config[_0x6447('0x7')]=_['defaults'](config[_0x6447('0x7')],{'host':_0x6447('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6447('0x7')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x184c35,_0x458fc9,_0x22c1f1){return new BPromise(function(_0x49313d,_0x37f682){return client[_0x6447('0x9')](_0x184c35,_0x22c1f1)[_0x6447('0xa')](function(_0x5c3851){logger[_0x6447('0xb')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x458fc9,_0x6447('0xc'));logger[_0x6447('0xd')](_0x6447('0xe'),_0x458fc9,_0x6447('0xc'),JSON['stringify'](_0x5c3851));if(_0x5c3851[_0x6447('0xf')]){if(_0x5c3851[_0x6447('0xf')]['code']===0x1f4){logger[_0x6447('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x458fc9,_0x5c3851[_0x6447('0xf')][_0x6447('0x10')]);return _0x37f682(_0x5c3851[_0x6447('0xf')]['message']);}logger['error'](_0x6447('0x11'),_0x458fc9,_0x5c3851[_0x6447('0xf')][_0x6447('0x10')]);return _0x49313d(_0x5c3851[_0x6447('0xf')][_0x6447('0x10')]);}else{logger['info'](_0x6447('0x11'),_0x458fc9,_0x6447('0xc'));_0x49313d(_0x5c3851[_0x6447('0x12')][_0x6447('0x10')]);}})[_0x6447('0x13')](function(_0x325558){logger['error'](_0x6447('0x11'),_0x458fc9,_0x325558);_0x37f682(_0x325558);});});}exports[_0x6447('0x14')]=function(_0x4d2032){var _0x142fb2=this;return new Promise(function(_0x170f4b,_0x1a5212){return db[_0x6447('0x15')][_0x6447('0x16')]({'raw':_0x4d2032['options']?_0x4d2032[_0x6447('0x17')][_0x6447('0x18')]===undefined?!![]:![]:!![],'where':_0x4d2032[_0x6447('0x17')]?_0x4d2032[_0x6447('0x17')][_0x6447('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6447('0x1a'),db[_0x6447('0x1b')]['fn']('IF',db['sequelize'][_0x6447('0x1c')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x6447('0xa')](function(_0x40a0f1){logger[_0x6447('0xb')](_0x6447('0x14'),_0x4d2032);logger['debug'](_0x6447('0x14'),_0x4d2032,JSON[_0x6447('0x1d')](_0x40a0f1));_0x170f4b(_0x40a0f1);})['catch'](function(_0xa83e5f){logger[_0x6447('0xf')](_0x6447('0x14'),_0xa83e5f[_0x6447('0x10')],_0x4d2032);_0x1a5212(_0x142fb2[_0x6447('0xf')](0x1f4,_0xa83e5f[_0x6447('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index d4274b0..c91b5d4 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 _0x0bde=['save','update','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bde,0xe7));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xe0bd('0x0'),'remove',_0xe0bd('0x1')];function createListener(_0x3dc984,_0x1d8922){return function(_0x1e198a){_0x1d8922[_0xe0bd('0x2')](_0x3dc984,_0x1e198a);};}function removeListener(_0x5541b9,_0x34df88){return function(){UserVoiceQueueRtEvents[_0xe0bd('0x3')](_0x5541b9,_0x34df88);};}exports[_0xe0bd('0x4')]=function(_0x3b712a){for(var _0x22bfd1=0x0,_0x26393f=events[_0xe0bd('0x5')];_0x22bfd1<_0x26393f;_0x22bfd1++){var _0x491dc7=events[_0x22bfd1];var _0x40b36a=createListener(_0xe0bd('0x6')+_0x491dc7,_0x3b712a);UserVoiceQueueRtEvents['on'](_0x491dc7,_0x40b36a);}}; \ No newline at end of file +var _0x741c=['remove','update','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0xb2eacd,_0x22e053){var _0x230f98=function(_0x2181d0){while(--_0x2181d0){_0xb2eacd['push'](_0xb2eacd['shift']());}};_0x230f98(++_0x22e053);}(_0x741c,0x196));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'use strict';var UserVoiceQueueRtEvents=require(_0xc741('0x0'));var events=[_0xc741('0x1'),_0xc741('0x2'),_0xc741('0x3')];function createListener(_0x1241fd,_0x31de60){return function(_0x5c8d3b){_0x31de60['emit'](_0x1241fd,_0x5c8d3b);};}function removeListener(_0x4089bf,_0x4ccc27){return function(){UserVoiceQueueRtEvents[_0xc741('0x4')](_0x4089bf,_0x4ccc27);};}exports[_0xc741('0x5')]=function(_0x3708ae){for(var _0x133bc4=0x0,_0x3f3d82=events[_0xc741('0x6')];_0x133bc4<_0x3f3d82;_0x133bc4++){var _0x46b743=events[_0x133bc4];var _0x598ead=createListener(_0xc741('0x7')+_0x46b743,_0x3708ae);UserVoiceQueueRtEvents['on'](_0x46b743,_0x598ead);}}; \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index b27f46a..1c5da8e 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 _0xbaf0=['get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./variable.controller'];(function(_0x10e74e,_0x1603ae){var _0x2198c1=function(_0x4b627c){while(--_0x4b627c){_0x10e74e['push'](_0x10e74e['shift']());}};_0x2198c1(++_0x1603ae);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'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['post']('/',auth[_0x0baf('0x9')](),controller['create']);router[_0x0baf('0xd')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);module[_0x0baf('0x11')]=router; \ No newline at end of file +var _0x3c81=['destroy','exports','multer','util','connect-timeout','express','./variable.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x2af368,_0x5e8ae8){var _0x21fd6a=function(_0xfc34d7){while(--_0xfc34d7){_0x2af368['push'](_0x2af368['shift']());}};_0x21fd6a(++_0x5e8ae8);}(_0x3c81,0x102));var _0x13c8=function(_0x18686b,_0x22da76){_0x18686b=_0x18686b-0x0;var _0x819ff=_0x3c81[_0x18686b];return _0x819ff;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x13c8('0x4'));router[_0x13c8('0x5')]('/',auth[_0x13c8('0x6')](),controller[_0x13c8('0x7')]);router[_0x13c8('0x5')](_0x13c8('0x8'),auth[_0x13c8('0x6')](),controller['show']);router[_0x13c8('0x9')]('/',auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router[_0x13c8('0xb')](_0x13c8('0x8'),auth[_0x13c8('0x6')](),controller[_0x13c8('0xc')]);router[_0x13c8('0xd')](_0x13c8('0x8'),auth[_0x13c8('0x6')](),controller[_0x13c8('0xe')]);module[_0x13c8('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 04416e4..6c63e8c 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 _0x2e57=['sequelize','exports','STRING','name'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x2e57,0x1cc));var _0x72e5=function(_0x1ecf6a,_0x4935b6){_0x1ecf6a=_0x1ecf6a-0x0;var _0x1aebe5=_0x2e57[_0x1ecf6a];return _0x1aebe5;};'use strict';var Sequelize=require(_0x72e5('0x0'));module[_0x72e5('0x1')]={'name':{'type':Sequelize[_0x72e5('0x2')],'unique':_0x72e5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x72e5('0x2')]}}; \ No newline at end of file +var _0x0b06=['exports','STRING','name','sequelize'];(function(_0x2cbfcc,_0x41c929){var _0x46dd12=function(_0x519978){while(--_0x519978){_0x2cbfcc['push'](_0x2cbfcc['shift']());}};_0x46dd12(++_0x41c929);}(_0x0b06,0x11f));var _0x60b0=function(_0x5a262d,_0x5f0a1f){_0x5a262d=_0x5a262d-0x0;var _0x15b9b8=_0x0b06[_0x5a262d];return _0x15b9b8;};'use strict';var Sequelize=require(_0x60b0('0x0'));module[_0x60b0('0x1')]={'name':{'type':Sequelize[_0x60b0('0x2')],'unique':_0x60b0('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x60b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 88a8f4a..9cd663b 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 _0x5bbb=['querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','Variable','rawAttributes','keys','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','params','intersection','length','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x3ff8ff,_0x487ea3){var _0xebf488=function(_0x178770){while(--_0x178770){_0x3ff8ff['push'](_0x3ff8ff['shift']());}};_0xebf488(++_0x487ea3);}(_0x5bbb,0xea));var _0xb5bb=function(_0x1e7468,_0x5bf9e3){_0x1e7468=_0x1e7468-0x0;var _0x53bb49=_0x5bbb[_0x1e7468];return _0x53bb49;};'use strict';var pdf=require(_0xb5bb('0x0'));var emlformat=require(_0xb5bb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5bb('0x2'));var jsonpatch=require(_0xb5bb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb5bb('0x4'));var Mustache=require(_0xb5bb('0x5'));var util=require(_0xb5bb('0x6'));var path=require(_0xb5bb('0x7'));var sox=require('sox');var csv=require(_0xb5bb('0x8'));var ejs=require(_0xb5bb('0x9'));var fs=require('fs');var _=require(_0xb5bb('0xa'));var squel=require(_0xb5bb('0xb'));var crypto=require(_0xb5bb('0xc'));var jsforce=require(_0xb5bb('0xd'));var deskjs=require(_0xb5bb('0xe'));var toCsv=require(_0xb5bb('0x8'));var querystring=require(_0xb5bb('0xf'));var Papa=require(_0xb5bb('0x10'));var authService=require(_0xb5bb('0x11'));var hardwareService=require(_0xb5bb('0x12'));var Redis=require(_0xb5bb('0x13'));var qs=require(_0xb5bb('0x14'));var logger=require('../../config/logger')(_0xb5bb('0x15'));var utils=require(_0xb5bb('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa94b3a,_0x20b78c){_0x20b78c=_0x20b78c||0xcc;return function(_0x7375e0){if(_0x7375e0){return _0xa94b3a[_0xb5bb('0x17')](_0x20b78c);}return _0xa94b3a['status'](_0x20b78c)[_0xb5bb('0x18')]();};}function respondWithResult(_0x4f2dee,_0x1c054b){_0x1c054b=_0x1c054b||0xc8;return function(_0x5a51aa){if(_0x5a51aa){return _0x4f2dee[_0xb5bb('0x19')](_0x1c054b)[_0xb5bb('0x1a')](_0x5a51aa);}};}function respondWithFilteredResult(_0x532555,_0x230214){return function(_0x2a1623){if(_0x2a1623){var _0x43a53c=_0x2a1623[_0xb5bb('0x1b')],_0x3497ec=_0x230214[_0xb5bb('0x1c')],_0x4dc7eb=_0x230214['offset']+_0x230214[_0xb5bb('0x1d')],_0x45c2f8;if(_0x4dc7eb>=_0x43a53c){_0x4dc7eb=_0x43a53c;_0x45c2f8=0xc8;}else{_0x45c2f8=0xce;}_0x532555[_0xb5bb('0x19')](_0x45c2f8);return _0x532555[_0xb5bb('0x1e')](_0xb5bb('0x1f'),_0x3497ec+'-'+_0x4dc7eb+'/'+_0x43a53c)[_0xb5bb('0x1a')](_0x2a1623);}return null;};}function patchUpdates(_0x3e493a){return function(_0x251e8e){try{jsonpatch[_0xb5bb('0x20')](_0x251e8e,_0x3e493a,!![]);}catch(_0x2164b1){return BPromise[_0xb5bb('0x21')](_0x2164b1);}return _0x251e8e[_0xb5bb('0x22')]();};}function saveUpdates(_0x4fcbf1,_0x22f23e){return function(_0x5048c5){if(_0x5048c5){return _0x5048c5[_0xb5bb('0x23')](_0x4fcbf1)[_0xb5bb('0x24')](function(_0x152334){return _0x152334;});}return null;};}function removeEntity(_0x19f0e6,_0x25925d){return function(_0x43f4dd){if(_0x43f4dd){return _0x43f4dd[_0xb5bb('0x25')]()[_0xb5bb('0x24')](function(){var _0x2b3200=_0x43f4dd[_0xb5bb('0x26')]({'plain':!![]});var _0xf441b0='Variables';return db[_0xb5bb('0x27')][_0xb5bb('0x25')]({'where':{'type':_0xf441b0,'resourceId':_0x2b3200['id']}})[_0xb5bb('0x24')](function(){return _0x43f4dd;});})[_0xb5bb('0x24')](function(){_0x19f0e6[_0xb5bb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa2ae06,_0x3574eb){return function(_0x392f07){if(!_0x392f07){_0xa2ae06['sendStatus'](0x194);}return _0x392f07;};}function handleError(_0x136be3,_0x22d79f){_0x22d79f=_0x22d79f||0x1f4;return function(_0x2030c9){logger[_0xb5bb('0x28')](_0x2030c9[_0xb5bb('0x29')]);if(_0x2030c9[_0xb5bb('0x2a')]){delete _0x2030c9[_0xb5bb('0x2a')];}_0x136be3[_0xb5bb('0x19')](_0x22d79f)[_0xb5bb('0x2b')](_0x2030c9);};}exports['index']=function(_0x379d9e,_0x373440){var _0x3661bf={},_0x260fc0={},_0x123dec={'count':0x0,'rows':[]};var _0x36653f=db[_0xb5bb('0x2c')][_0xb5bb('0x2d')];_0x260fc0['model']=_[_0xb5bb('0x2e')](_0x36653f);_0x260fc0[_0xb5bb('0x2f')]=_['keys'](_0x379d9e[_0xb5bb('0x2f')]);_0x260fc0[_0xb5bb('0x30')]=_['intersection'](_0x260fc0[_0xb5bb('0x31')],_0x260fc0[_0xb5bb('0x2f')]);_0x3661bf[_0xb5bb('0x32')]=_['intersection'](_0x260fc0[_0xb5bb('0x31')],qs[_0xb5bb('0x33')](_0x379d9e[_0xb5bb('0x2f')][_0xb5bb('0x33')]));_0x3661bf[_0xb5bb('0x32')]=_0x3661bf[_0xb5bb('0x32')]['length']?_0x3661bf['attributes']:_0x260fc0[_0xb5bb('0x31')];if(!_0x379d9e['query'][_0xb5bb('0x34')](_0xb5bb('0x35'))){_0x3661bf['limit']=qs[_0xb5bb('0x1d')](_0x379d9e['query']['limit']);_0x3661bf[_0xb5bb('0x1c')]=qs[_0xb5bb('0x1c')](_0x379d9e[_0xb5bb('0x2f')][_0xb5bb('0x1c')]);}_0x3661bf[_0xb5bb('0x36')]=qs[_0xb5bb('0x37')](_0x379d9e[_0xb5bb('0x2f')][_0xb5bb('0x37')]);_0x3661bf[_0xb5bb('0x38')]=qs['filters'](_[_0xb5bb('0x39')](_0x379d9e[_0xb5bb('0x2f')],_0x260fc0[_0xb5bb('0x30')]));if(_0x379d9e[_0xb5bb('0x2f')][_0xb5bb('0x3a')]){_0x3661bf[_0xb5bb('0x38')]=_[_0xb5bb('0x3b')](_0x3661bf[_0xb5bb('0x38')],{'$or':_[_0xb5bb('0x3c')](_0x36653f,function(_0x35675b){if(_0x35675b['type'][_0xb5bb('0x3d')]!==_0xb5bb('0x3e')){var _0x3217f7={};_0x3217f7[_0x35675b[_0xb5bb('0x3f')]]={'$like':'%'+_0x379d9e[_0xb5bb('0x2f')][_0xb5bb('0x3a')]+'%'};return _0x3217f7;}})});}_0x3661bf=_[_0xb5bb('0x3b')]({},_0x3661bf,_0x379d9e[_0xb5bb('0x40')]);var _0x36d69c={'where':_0x3661bf[_0xb5bb('0x38')]};return db[_0xb5bb('0x2c')][_0xb5bb('0x1b')](_0x36d69c)[_0xb5bb('0x24')](function(_0x56f663){_0x123dec[_0xb5bb('0x1b')]=_0x56f663;if(_0x379d9e['query'][_0xb5bb('0x41')]){_0x3661bf[_0xb5bb('0x42')]=[{'all':!![]}];}return db[_0xb5bb('0x2c')][_0xb5bb('0x43')](_0x3661bf);})[_0xb5bb('0x24')](function(_0x423fbd){_0x123dec['rows']=_0x423fbd;return _0x123dec;})['then'](respondWithFilteredResult(_0x373440,_0x3661bf))['catch'](handleError(_0x373440,null));};exports['show']=function(_0x3c54bc,_0x190659){var _0x3fd650={'raw':!![],'where':{'id':_0x3c54bc[_0xb5bb('0x44')]['id']}},_0x5329de={};_0x5329de[_0xb5bb('0x31')]=_['keys'](db['Variable'][_0xb5bb('0x2d')]);_0x5329de[_0xb5bb('0x2f')]=_[_0xb5bb('0x2e')](_0x3c54bc[_0xb5bb('0x2f')]);_0x5329de[_0xb5bb('0x30')]=_['intersection'](_0x5329de['model'],_0x5329de[_0xb5bb('0x2f')]);_0x3fd650[_0xb5bb('0x32')]=_[_0xb5bb('0x45')](_0x5329de['model'],qs['fields'](_0x3c54bc['query'][_0xb5bb('0x33')]));_0x3fd650[_0xb5bb('0x32')]=_0x3fd650[_0xb5bb('0x32')][_0xb5bb('0x46')]?_0x3fd650['attributes']:_0x5329de[_0xb5bb('0x31')];if(_0x3c54bc['query'][_0xb5bb('0x41')]){_0x3fd650[_0xb5bb('0x42')]=[{'all':!![]}];}_0x3fd650=_[_0xb5bb('0x3b')]({},_0x3fd650,_0x3c54bc['options']);return db['Variable'][_0xb5bb('0x47')](_0x3fd650)[_0xb5bb('0x24')](handleEntityNotFound(_0x190659,null))[_0xb5bb('0x24')](respondWithResult(_0x190659,null))[_0xb5bb('0x48')](handleError(_0x190659,null));};exports['create']=function(_0x1ad4de,_0x31db27){return db[_0xb5bb('0x2c')]['create'](_0x1ad4de[_0xb5bb('0x49')],{})[_0xb5bb('0x24')](function(_0x4426e4){var _0x221aea=_0x1ad4de[_0xb5bb('0x4a')][_0xb5bb('0x26')]({'plain':!![]});if(!_0x221aea)throw new Error(_0xb5bb('0x4b'));if(_0x221aea[_0xb5bb('0x4c')]===_0xb5bb('0x4a')){var _0x1561c1=_0x4426e4['get']({'plain':!![]});var _0x22eb8d=_0xb5bb('0x4d');return db[_0xb5bb('0x4e')][_0xb5bb('0x47')]({'where':{'name':_0x22eb8d,'userProfileId':_0x221aea[_0xb5bb('0x4f')]},'raw':!![]})[_0xb5bb('0x24')](function(_0x1bf926){if(_0x1bf926&&_0x1bf926[_0xb5bb('0x50')]===0x0){return db['UserProfileResource'][_0xb5bb('0x51')]({'name':_0x1561c1[_0xb5bb('0x2a')],'resourceId':_0x1561c1['id'],'type':_0x1bf926[_0xb5bb('0x2a')],'sectionId':_0x1bf926['id']},{})[_0xb5bb('0x24')](function(){return _0x4426e4;});}else{return _0x4426e4;}})[_0xb5bb('0x48')](function(_0x1ad5c3){logger['error'](_0xb5bb('0x52'),_0x1ad5c3);throw _0x1ad5c3;});}return _0x4426e4;})[_0xb5bb('0x24')](respondWithResult(_0x31db27,0xc9))[_0xb5bb('0x48')](handleError(_0x31db27,null));};exports[_0xb5bb('0x23')]=function(_0x257765,_0x1bb8e6){if(_0x257765[_0xb5bb('0x49')]['id']){delete _0x257765[_0xb5bb('0x49')]['id'];}return db[_0xb5bb('0x2c')][_0xb5bb('0x47')]({'where':{'id':_0x257765[_0xb5bb('0x44')]['id']}})[_0xb5bb('0x24')](handleEntityNotFound(_0x1bb8e6,null))[_0xb5bb('0x24')](saveUpdates(_0x257765[_0xb5bb('0x49')],null))['then'](respondWithResult(_0x1bb8e6,null))[_0xb5bb('0x48')](handleError(_0x1bb8e6,null));};exports[_0xb5bb('0x25')]=function(_0x2780a9,_0x8c98ce){return db[_0xb5bb('0x2c')][_0xb5bb('0x47')]({'where':{'id':_0x2780a9[_0xb5bb('0x44')]['id']}})[_0xb5bb('0x24')](handleEntityNotFound(_0x8c98ce,null))[_0xb5bb('0x24')](removeEntity(_0x8c98ce,null))[_0xb5bb('0x48')](handleError(_0x8c98ce,null));}; \ No newline at end of file +var _0x6a47=['count','offset','set','apply','reject','update','then','destroy','get','Variables','error','send','index','Variable','rawAttributes','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','merge','map','type','key','VIRTUAL','field','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x5cadc0,_0x37194f){var _0x416a53=function(_0x3a91c9){while(--_0x3a91c9){_0x5cadc0['push'](_0x5cadc0['shift']());}};_0x416a53(++_0x37194f);}(_0x6a47,0x16d));var _0x76a4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6a47[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0x76a4('0x0'));var emlformat=require(_0x76a4('0x1'));var rimraf=require(_0x76a4('0x2'));var zipdir=require(_0x76a4('0x3'));var jsonpatch=require(_0x76a4('0x4'));var rp=require(_0x76a4('0x5'));var moment=require(_0x76a4('0x6'));var BPromise=require(_0x76a4('0x7'));var Mustache=require('mustache');var util=require(_0x76a4('0x8'));var path=require('path');var sox=require(_0x76a4('0x9'));var csv=require(_0x76a4('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x76a4('0xb'));var squel=require(_0x76a4('0xc'));var crypto=require(_0x76a4('0xd'));var jsforce=require(_0x76a4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x76a4('0xa'));var querystring=require(_0x76a4('0xf'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x76a4('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x76a4('0x11'))('api');var utils=require(_0x76a4('0x12'));var config=require(_0x76a4('0x13'));var db=require(_0x76a4('0x14'))['db'];function respondWithStatusCode(_0xafb2f3,_0x568a2d){_0x568a2d=_0x568a2d||0xcc;return function(_0x1d4183){if(_0x1d4183){return _0xafb2f3[_0x76a4('0x15')](_0x568a2d);}return _0xafb2f3[_0x76a4('0x16')](_0x568a2d)[_0x76a4('0x17')]();};}function respondWithResult(_0x35dd1e,_0x2cca40){_0x2cca40=_0x2cca40||0xc8;return function(_0x6403bd){if(_0x6403bd){return _0x35dd1e[_0x76a4('0x16')](_0x2cca40)[_0x76a4('0x18')](_0x6403bd);}};}function respondWithFilteredResult(_0x599d19,_0x1acb72){return function(_0x4125ce){if(_0x4125ce){var _0x4111a5=_0x4125ce[_0x76a4('0x19')],_0xe41842=_0x1acb72[_0x76a4('0x1a')],_0x2892f5=_0x1acb72[_0x76a4('0x1a')]+_0x1acb72['limit'],_0x25f8c1;if(_0x2892f5>=_0x4111a5){_0x2892f5=_0x4111a5;_0x25f8c1=0xc8;}else{_0x25f8c1=0xce;}_0x599d19[_0x76a4('0x16')](_0x25f8c1);return _0x599d19[_0x76a4('0x1b')]('Content-Range',_0xe41842+'-'+_0x2892f5+'/'+_0x4111a5)['json'](_0x4125ce);}return null;};}function patchUpdates(_0x476020){return function(_0x5a8067){try{jsonpatch[_0x76a4('0x1c')](_0x5a8067,_0x476020,!![]);}catch(_0x55ac7d){return BPromise[_0x76a4('0x1d')](_0x55ac7d);}return _0x5a8067['save']();};}function saveUpdates(_0x66ef61,_0x28b8fd){return function(_0x570feb){if(_0x570feb){return _0x570feb[_0x76a4('0x1e')](_0x66ef61)[_0x76a4('0x1f')](function(_0x492707){return _0x492707;});}return null;};}function removeEntity(_0x1249ff,_0x10bf11){return function(_0x1198f1){if(_0x1198f1){return _0x1198f1[_0x76a4('0x20')]()[_0x76a4('0x1f')](function(){var _0x29c6c2=_0x1198f1[_0x76a4('0x21')]({'plain':!![]});var _0x21fa46=_0x76a4('0x22');return db['UserProfileResource'][_0x76a4('0x20')]({'where':{'type':_0x21fa46,'resourceId':_0x29c6c2['id']}})[_0x76a4('0x1f')](function(){return _0x1198f1;});})[_0x76a4('0x1f')](function(){_0x1249ff[_0x76a4('0x16')](0xcc)[_0x76a4('0x17')]();});}};}function handleEntityNotFound(_0x55c1ed,_0x367131){return function(_0x88af9a){if(!_0x88af9a){_0x55c1ed[_0x76a4('0x15')](0x194);}return _0x88af9a;};}function handleError(_0x41cca0,_0x1d1735){_0x1d1735=_0x1d1735||0x1f4;return function(_0xa4a017){logger[_0x76a4('0x23')](_0xa4a017['stack']);if(_0xa4a017['name']){delete _0xa4a017['name'];}_0x41cca0['status'](_0x1d1735)[_0x76a4('0x24')](_0xa4a017);};}exports[_0x76a4('0x25')]=function(_0x500d99,_0x130093){var _0x256bef={},_0x4c4a70={},_0x5cdf40={'count':0x0,'rows':[]};var _0x57a26d=db[_0x76a4('0x26')][_0x76a4('0x27')];_0x4c4a70[_0x76a4('0x28')]=_['keys'](_0x57a26d);_0x4c4a70[_0x76a4('0x29')]=_['keys'](_0x500d99['query']);_0x4c4a70['filters']=_[_0x76a4('0x2a')](_0x4c4a70[_0x76a4('0x28')],_0x4c4a70[_0x76a4('0x29')]);_0x256bef['attributes']=_['intersection'](_0x4c4a70['model'],qs[_0x76a4('0x2b')](_0x500d99['query'][_0x76a4('0x2b')]));_0x256bef[_0x76a4('0x2c')]=_0x256bef[_0x76a4('0x2c')][_0x76a4('0x2d')]?_0x256bef['attributes']:_0x4c4a70[_0x76a4('0x28')];if(!_0x500d99[_0x76a4('0x29')][_0x76a4('0x2e')](_0x76a4('0x2f'))){_0x256bef[_0x76a4('0x30')]=qs[_0x76a4('0x30')](_0x500d99['query'][_0x76a4('0x30')]);_0x256bef[_0x76a4('0x1a')]=qs[_0x76a4('0x1a')](_0x500d99[_0x76a4('0x29')][_0x76a4('0x1a')]);}_0x256bef[_0x76a4('0x31')]=qs[_0x76a4('0x32')](_0x500d99[_0x76a4('0x29')][_0x76a4('0x32')]);_0x256bef['where']=qs[_0x76a4('0x33')](_['pick'](_0x500d99[_0x76a4('0x29')],_0x4c4a70['filters']));if(_0x500d99[_0x76a4('0x29')][_0x76a4('0x34')]){_0x256bef[_0x76a4('0x35')]=_[_0x76a4('0x36')](_0x256bef[_0x76a4('0x35')],{'$or':_[_0x76a4('0x37')](_0x57a26d,function(_0x1498b2){if(_0x1498b2[_0x76a4('0x38')][_0x76a4('0x39')]!==_0x76a4('0x3a')){var _0x4caeb0={};_0x4caeb0[_0x1498b2[_0x76a4('0x3b')]]={'$like':'%'+_0x500d99[_0x76a4('0x29')][_0x76a4('0x34')]+'%'};return _0x4caeb0;}})});}_0x256bef=_[_0x76a4('0x36')]({},_0x256bef,_0x500d99['options']);var _0x424bff={'where':_0x256bef[_0x76a4('0x35')]};return db[_0x76a4('0x26')][_0x76a4('0x19')](_0x424bff)['then'](function(_0x301662){_0x5cdf40[_0x76a4('0x19')]=_0x301662;if(_0x500d99[_0x76a4('0x29')][_0x76a4('0x3c')]){_0x256bef[_0x76a4('0x3d')]=[{'all':!![]}];}return db[_0x76a4('0x26')][_0x76a4('0x3e')](_0x256bef);})[_0x76a4('0x1f')](function(_0x1921d7){_0x5cdf40[_0x76a4('0x3f')]=_0x1921d7;return _0x5cdf40;})['then'](respondWithFilteredResult(_0x130093,_0x256bef))[_0x76a4('0x40')](handleError(_0x130093,null));};exports[_0x76a4('0x41')]=function(_0x2d0aff,_0x15f8e7){var _0x5c532b={'raw':!![],'where':{'id':_0x2d0aff['params']['id']}},_0x4f5f47={};_0x4f5f47[_0x76a4('0x28')]=_['keys'](db[_0x76a4('0x26')][_0x76a4('0x27')]);_0x4f5f47['query']=_[_0x76a4('0x42')](_0x2d0aff[_0x76a4('0x29')]);_0x4f5f47[_0x76a4('0x33')]=_[_0x76a4('0x2a')](_0x4f5f47[_0x76a4('0x28')],_0x4f5f47[_0x76a4('0x29')]);_0x5c532b[_0x76a4('0x2c')]=_['intersection'](_0x4f5f47[_0x76a4('0x28')],qs[_0x76a4('0x2b')](_0x2d0aff[_0x76a4('0x29')][_0x76a4('0x2b')]));_0x5c532b[_0x76a4('0x2c')]=_0x5c532b['attributes'][_0x76a4('0x2d')]?_0x5c532b[_0x76a4('0x2c')]:_0x4f5f47[_0x76a4('0x28')];if(_0x2d0aff[_0x76a4('0x29')][_0x76a4('0x3c')]){_0x5c532b['include']=[{'all':!![]}];}_0x5c532b=_[_0x76a4('0x36')]({},_0x5c532b,_0x2d0aff[_0x76a4('0x43')]);return db[_0x76a4('0x26')][_0x76a4('0x44')](_0x5c532b)[_0x76a4('0x1f')](handleEntityNotFound(_0x15f8e7,null))['then'](respondWithResult(_0x15f8e7,null))[_0x76a4('0x40')](handleError(_0x15f8e7,null));};exports[_0x76a4('0x45')]=function(_0x3a4ccd,_0x3b3f9b){return db['Variable'][_0x76a4('0x45')](_0x3a4ccd[_0x76a4('0x46')],{})[_0x76a4('0x1f')](function(_0x2cd84b){var _0xe781fa=_0x3a4ccd[_0x76a4('0x47')][_0x76a4('0x21')]({'plain':!![]});if(!_0xe781fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe781fa[_0x76a4('0x48')]===_0x76a4('0x47')){var _0x1f250c=_0x2cd84b[_0x76a4('0x21')]({'plain':!![]});var _0x521084='Variables';return db[_0x76a4('0x49')][_0x76a4('0x44')]({'where':{'name':_0x521084,'userProfileId':_0xe781fa[_0x76a4('0x4a')]},'raw':!![]})[_0x76a4('0x1f')](function(_0x4176ca){if(_0x4176ca&&_0x4176ca[_0x76a4('0x4b')]===0x0){return db[_0x76a4('0x4c')][_0x76a4('0x45')]({'name':_0x1f250c['name'],'resourceId':_0x1f250c['id'],'type':_0x4176ca['name'],'sectionId':_0x4176ca['id']},{})[_0x76a4('0x1f')](function(){return _0x2cd84b;});}else{return _0x2cd84b;}})['catch'](function(_0x4281a6){logger[_0x76a4('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4281a6);throw _0x4281a6;});}return _0x2cd84b;})[_0x76a4('0x1f')](respondWithResult(_0x3b3f9b,0xc9))[_0x76a4('0x40')](handleError(_0x3b3f9b,null));};exports[_0x76a4('0x1e')]=function(_0x176fed,_0x3da7c5){if(_0x176fed[_0x76a4('0x46')]['id']){delete _0x176fed[_0x76a4('0x46')]['id'];}return db[_0x76a4('0x26')][_0x76a4('0x44')]({'where':{'id':_0x176fed[_0x76a4('0x4d')]['id']}})[_0x76a4('0x1f')](handleEntityNotFound(_0x3da7c5,null))[_0x76a4('0x1f')](saveUpdates(_0x176fed['body'],null))[_0x76a4('0x1f')](respondWithResult(_0x3da7c5,null))['catch'](handleError(_0x3da7c5,null));};exports['destroy']=function(_0x2d7e39,_0xfc5ab5){return db[_0x76a4('0x26')][_0x76a4('0x44')]({'where':{'id':_0x2d7e39[_0x76a4('0x4d')]['id']}})[_0x76a4('0x1f')](handleEntityNotFound(_0xfc5ab5,null))[_0x76a4('0x1f')](removeEntity(_0xfc5ab5,null))[_0x76a4('0x40')](handleError(_0xfc5ab5,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 8d39c37..52a7c43 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 _0x326f=['define','Variable','lodash','api','moment','bluebird','request-promise','./variable.attributes','exports'];(function(_0x5b64d8,_0x3ec77a){var _0x543364=function(_0x1cb343){while(--_0x1cb343){_0x5b64d8['push'](_0x5b64d8['shift']());}};_0x543364(++_0x3ec77a);}(_0x326f,0xd1));var _0xf326=function(_0x585432,_0x4ffbe4){_0x585432=_0x585432-0x0;var _0x51199f=_0x326f[_0x585432];return _0x51199f;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var attributes=require(_0xf326('0x5'));module[_0xf326('0x6')]=function(_0x9445c6,_0xf1c243){return _0x9445c6[_0xf326('0x7')](_0xf326('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['lodash','api','request-promise','./variable.attributes','exports','define','Variable','tools_variables'];(function(_0xd8d138,_0x2c83ec){var _0x1a618b=function(_0x4b7004){while(--_0x4b7004){_0xd8d138['push'](_0xd8d138['shift']());}};_0x1a618b(++_0x2c83ec);}(_0x0295,0x1f0));var _0x5029=function(_0x4f492c,_0x2f5d87){_0x4f492c=_0x4f492c-0x0;var _0x347ea5=_0x0295[_0x4f492c];return _0x347ea5;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var attributes=require(_0x5029('0x3'));module[_0x5029('0x4')]=function(_0x3d0af1,_0x170504){return _0x3d0af1[_0x5029('0x5')](_0x5029('0x6'),attributes,{'tableName':_0x5029('0x7'),'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 dcd6a80..a7e3406 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 _0x3ed6=['info','stringify','error','code','Variable,\x20%s,\x20%s','message','request\x20sent','result','catch','Variable','find','options','raw','attributes','include','map','model','ShowVariable','debug','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x50b1e4,_0x3057ce){var _0x12d199=function(_0x35ada2){while(--_0x35ada2){_0x50b1e4['push'](_0x50b1e4['shift']());}};_0x12d199(++_0x3057ce);}(_0x3ed6,0x8f));var _0x63ed=function(_0x19cd7d,_0x216c4a){_0x19cd7d=_0x19cd7d-0x0;var _0x3f084b=_0x3ed6[_0x19cd7d];return _0x3f084b;};'use strict';var _=require(_0x63ed('0x0'));var util=require(_0x63ed('0x1'));var moment=require('moment');var BPromise=require(_0x63ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63ed('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x63ed('0x4'));var logger=require(_0x63ed('0x5'))(_0x63ed('0x6'));var config=require(_0x63ed('0x7'));var jayson=require(_0x63ed('0x8'));var client=jayson[_0x63ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4980bd,_0x11d184,_0x5d4b03){return new BPromise(function(_0x471f2d,_0x3d8272){return client[_0x63ed('0xa')](_0x4980bd,_0x5d4b03)[_0x63ed('0xb')](function(_0x39bdc1){logger[_0x63ed('0xc')]('Variable,\x20%s,\x20%s',_0x11d184,'request\x20sent');logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0x11d184,'request\x20sent',JSON[_0x63ed('0xd')](_0x39bdc1));if(_0x39bdc1['error']){if(_0x39bdc1[_0x63ed('0xe')][_0x63ed('0xf')]===0x1f4){logger[_0x63ed('0xe')](_0x63ed('0x10'),_0x11d184,_0x39bdc1[_0x63ed('0xe')][_0x63ed('0x11')]);return _0x3d8272(_0x39bdc1[_0x63ed('0xe')]['message']);}logger[_0x63ed('0xe')](_0x63ed('0x10'),_0x11d184,_0x39bdc1[_0x63ed('0xe')][_0x63ed('0x11')]);return _0x471f2d(_0x39bdc1['error'][_0x63ed('0x11')]);}else{logger[_0x63ed('0xc')](_0x63ed('0x10'),_0x11d184,_0x63ed('0x12'));_0x471f2d(_0x39bdc1[_0x63ed('0x13')][_0x63ed('0x11')]);}})[_0x63ed('0x14')](function(_0x53ad3a){logger[_0x63ed('0xe')]('Variable,\x20%s,\x20%s',_0x11d184,_0x53ad3a);_0x3d8272(_0x53ad3a);});});}exports['ShowVariable']=function(_0x43e9c8){var _0x2ff668=this;return new Promise(function(_0x5bc5c8,_0x2e7a05){return db[_0x63ed('0x15')][_0x63ed('0x16')]({'raw':_0x43e9c8[_0x63ed('0x17')]?_0x43e9c8[_0x63ed('0x17')][_0x63ed('0x18')]===undefined?!![]:![]:!![],'where':_0x43e9c8['options']?_0x43e9c8[_0x63ed('0x17')]['where']||null:null,'attributes':_0x43e9c8[_0x63ed('0x17')]?_0x43e9c8[_0x63ed('0x17')][_0x63ed('0x19')]||null:null,'include':_0x43e9c8[_0x63ed('0x17')]?_0x43e9c8['options'][_0x63ed('0x1a')]?_['map'](_0x43e9c8[_0x63ed('0x17')][_0x63ed('0x1a')],function(_0x41ba69){return{'model':db[_0x41ba69['model']],'as':_0x41ba69['as'],'attributes':_0x41ba69['attributes'],'include':_0x41ba69[_0x63ed('0x1a')]?_[_0x63ed('0x1b')](_0x41ba69['include'],function(_0x511f60){return{'model':db[_0x511f60[_0x63ed('0x1c')]],'as':_0x511f60['as'],'attributes':_0x511f60['attributes'],'include':_0x511f60[_0x63ed('0x1a')]?_['map'](_0x511f60[_0x63ed('0x1a')],function(_0xa1dd4){return{'model':db[_0xa1dd4[_0x63ed('0x1c')]],'as':_0xa1dd4['as'],'attributes':_0xa1dd4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2aebed){logger['info'](_0x63ed('0x1d'),_0x43e9c8);logger[_0x63ed('0x1e')](_0x63ed('0x1d'),_0x43e9c8,JSON[_0x63ed('0xd')](_0x2aebed));_0x5bc5c8(_0x2aebed);})[_0x63ed('0x14')](function(_0x21bb1c){logger[_0x63ed('0xe')](_0x63ed('0x1d'),_0x21bb1c[_0x63ed('0x11')],_0x43e9c8);_0x2e7a05(_0x2ff668[_0x63ed('0xe')](0x1f4,_0x21bb1c[_0x63ed('0x11')]));});});}; \ No newline at end of file +var _0xd8cb=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','Variable,\x20%s,\x20%s','message','result','catch','ShowVariable','Variable','find','options','raw','where','map','model','attributes','include','lodash','bluebird','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd8cb,0x129));var _0xbd8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbd8c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbd8c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd8c('0x2'));var db=require(_0xbd8c('0x3'))['db'];var utils=require(_0xbd8c('0x4'));var logger=require(_0xbd8c('0x5'))(_0xbd8c('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd8c('0x7'));var client=jayson[_0xbd8c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52df63,_0x3c2f1d,_0xeceb47){return new BPromise(function(_0x32b8d9,_0x570562){return client[_0xbd8c('0x9')](_0x52df63,_0xeceb47)[_0xbd8c('0xa')](function(_0xe135e0){logger[_0xbd8c('0xb')]('Variable,\x20%s,\x20%s',_0x3c2f1d,_0xbd8c('0xc'));logger[_0xbd8c('0xd')]('Variable,\x20%s,\x20%s,\x20%s',_0x3c2f1d,_0xbd8c('0xc'),JSON[_0xbd8c('0xe')](_0xe135e0));if(_0xe135e0[_0xbd8c('0xf')]){if(_0xe135e0['error']['code']===0x1f4){logger[_0xbd8c('0xf')](_0xbd8c('0x10'),_0x3c2f1d,_0xe135e0[_0xbd8c('0xf')][_0xbd8c('0x11')]);return _0x570562(_0xe135e0[_0xbd8c('0xf')][_0xbd8c('0x11')]);}logger[_0xbd8c('0xf')](_0xbd8c('0x10'),_0x3c2f1d,_0xe135e0[_0xbd8c('0xf')]['message']);return _0x32b8d9(_0xe135e0[_0xbd8c('0xf')][_0xbd8c('0x11')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x3c2f1d,_0xbd8c('0xc'));_0x32b8d9(_0xe135e0[_0xbd8c('0x12')]['message']);}})[_0xbd8c('0x13')](function(_0x2bc549){logger['error']('Variable,\x20%s,\x20%s',_0x3c2f1d,_0x2bc549);_0x570562(_0x2bc549);});});}exports[_0xbd8c('0x14')]=function(_0x128f1f){var _0x16d260=this;return new Promise(function(_0x21e295,_0xcebbc2){return db[_0xbd8c('0x15')][_0xbd8c('0x16')]({'raw':_0x128f1f[_0xbd8c('0x17')]?_0x128f1f[_0xbd8c('0x17')][_0xbd8c('0x18')]===undefined?!![]:![]:!![],'where':_0x128f1f[_0xbd8c('0x17')]?_0x128f1f[_0xbd8c('0x17')][_0xbd8c('0x19')]||null:null,'attributes':_0x128f1f[_0xbd8c('0x17')]?_0x128f1f['options']['attributes']||null:null,'include':_0x128f1f['options']?_0x128f1f['options']['include']?_[_0xbd8c('0x1a')](_0x128f1f[_0xbd8c('0x17')]['include'],function(_0x2e30e7){return{'model':db[_0x2e30e7[_0xbd8c('0x1b')]],'as':_0x2e30e7['as'],'attributes':_0x2e30e7[_0xbd8c('0x1c')],'include':_0x2e30e7[_0xbd8c('0x1d')]?_[_0xbd8c('0x1a')](_0x2e30e7[_0xbd8c('0x1d')],function(_0x260ae1){return{'model':db[_0x260ae1[_0xbd8c('0x1b')]],'as':_0x260ae1['as'],'attributes':_0x260ae1[_0xbd8c('0x1c')],'include':_0x260ae1[_0xbd8c('0x1d')]?_[_0xbd8c('0x1a')](_0x260ae1[_0xbd8c('0x1d')],function(_0x368520){return{'model':db[_0x368520['model']],'as':_0x368520['as'],'attributes':_0x368520[_0xbd8c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34666f){logger[_0xbd8c('0xb')](_0xbd8c('0x14'),_0x128f1f);logger[_0xbd8c('0xd')](_0xbd8c('0x14'),_0x128f1f,JSON['stringify'](_0x34666f));_0x21e295(_0x34666f);})[_0xbd8c('0x13')](function(_0x1de9e0){logger[_0xbd8c('0xf')]('ShowVariable',_0x1de9e0['message'],_0x128f1f);_0xcebbc2(_0x16d260[_0xbd8c('0xf')](0x1f4,_0x1de9e0['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 0e5b4cc..c8fa135 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 _0xa825=['/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','/pull','pull'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa825,0x101));var _0x5a82=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa825[_0x3bf83f];return _0x22c4a9;};'use strict';var express=require(_0x5a82('0x0'));var router=express[_0x5a82('0x1')]();var auth=require(_0x5a82('0x2'));var controller=require(_0x5a82('0x3'));router[_0x5a82('0x4')]('/',controller['index']);router['get'](_0x5a82('0x5'),auth['isAuthenticated'](),auth[_0x5a82('0x6')](),controller[_0x5a82('0x7')]);router[_0x5a82('0x4')](_0x5a82('0x8'),auth[_0x5a82('0x9')](),auth[_0x5a82('0x6')](),controller[_0x5a82('0xa')]);router[_0x5a82('0x4')](_0x5a82('0xb'),auth[_0x5a82('0x9')](),auth[_0x5a82('0x6')](),controller[_0x5a82('0xc')]);router[_0x5a82('0x4')](_0x5a82('0xd'),auth[_0x5a82('0x9')](),controller[_0x5a82('0xe')]);router[_0x5a82('0x4')](_0x5a82('0xf'),controller[_0x5a82('0x10')]);module[_0x5a82('0x11')]=router; \ No newline at end of file +var _0x52b7=['restart','exports','Router','../../components/auth/service','get','index','isAuthenticated','fetch','/reset','reset','canUpdate','pull','/restart'];(function(_0x41e2d9,_0x1f0df0){var _0x4f9cfe=function(_0x51da59){while(--_0x51da59){_0x41e2d9['push'](_0x41e2d9['shift']());}};_0x4f9cfe(++_0x1f0df0);}(_0x52b7,0x154));var _0x752b=function(_0x518eaa,_0x466eda){_0x518eaa=_0x518eaa-0x0;var _0x175feb=_0x52b7[_0x518eaa];return _0x175feb;};'use strict';var express=require('express');var router=express[_0x752b('0x0')]();var auth=require(_0x752b('0x1'));var controller=require('./version.controller');router[_0x752b('0x2')]('/',controller[_0x752b('0x3')]);router[_0x752b('0x2')]('/fetch',auth[_0x752b('0x4')](),auth['canUpdate'](),controller[_0x752b('0x5')]);router[_0x752b('0x2')](_0x752b('0x6'),auth[_0x752b('0x4')](),auth['canUpdate'](),controller[_0x752b('0x7')]);router[_0x752b('0x2')]('/pull',auth['isAuthenticated'](),auth[_0x752b('0x8')](),controller[_0x752b('0x9')]);router['get'](_0x752b('0xa'),auth['isAuthenticated'](),controller[_0x752b('0xb')]);router[_0x752b('0x2')]('/migrations',controller['migrations']);module[_0x752b('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index dbfbbbd..be7039d 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 _0xa9e0=['master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','server','exports','.js','catch','umzug','path','pkginfo','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','version','latest','fetch','tags','status','json','origin'];(function(_0x4f01b8,_0x2a7c8){var _0xa2875b=function(_0x4ba1c8){while(--_0x4ba1c8){_0x4f01b8['push'](_0x4f01b8['shift']());}};_0xa2875b(++_0x2a7c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var Umzug=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var pkginfo=require(_0x0a9e('0x2'))(module,'version');var exec=require('child_process')[_0x0a9e('0x3')];var db=require('../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var pm2=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var git=require(_0x0a9e('0x8'))(config['root']);exports[_0x0a9e('0x9')]=function(_0x441e3a,_0x2cc193){var _0x5f41ea={'current':module['exports'][_0x0a9e('0xa')],'phonebar':0x2};if(_0x441e3a['query']&&_0x441e3a['query'][_0x0a9e('0xb')]){return git[_0x0a9e('0xc')]()[_0x0a9e('0xd')](function(_0x3ab53f,_0xfeb75b){_0x5f41ea[_0x0a9e('0xb')]=(_0x3ab53f?module['exports']['version']:_0xfeb75b['latest'])||'2.0.0';return _0x2cc193[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')](_0x5f41ea);});}else{return _0x2cc193[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')](_0x5f41ea);}};exports[_0x0a9e('0xc')]=function(_0x69aeb7,_0x5db4b0){return git[_0x0a9e('0xc')]([_0x0a9e('0x10'),_0x0a9e('0x11')],function(_0x281129){if(_0x281129){logger[_0x0a9e('0x12')](_0x281129);return _0x5db4b0[_0x0a9e('0xe')](0x1f4)['json'](_0x281129);}logger[_0x0a9e('0x13')]('git\x20fetch');return _0x5db4b0[_0x0a9e('0xe')](0xc8)['json']({'output':_0x0a9e('0x14')});});};exports[_0x0a9e('0x15')]=function(_0x48f32d,_0x225616){return git['reset']([_0x0a9e('0x16'),_0x0a9e('0x17')],function(_0x106033){if(_0x106033){logger[_0x0a9e('0x12')](_0x106033);return _0x225616[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x106033);}logger[_0x0a9e('0x13')](_0x0a9e('0x18'));return _0x225616[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':_0x0a9e('0x19')});});};exports[_0x0a9e('0x1a')]=function(_0x4bb1e3,_0x2c3407){exec(_0x0a9e('0x1b'),function(_0x53682f,_0x20f109,_0x5a09ef){logger['info'](_0x20f109);logger[_0x0a9e('0x13')](_0x5a09ef);if(_0x53682f){logger[_0x0a9e('0x12')](_0x53682f);return _0x2c3407[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x53682f);}return _0x2c3407['status'](0xc8)[_0x0a9e('0xf')]({'output':_0x20f109});});};exports[_0x0a9e('0x1c')]=function(_0x3b45bc,_0x4d00e6){return pm2[_0x0a9e('0x1c')](_0x0a9e('0x1d'))[_0x0a9e('0x1e')](function(_0x5ea472){logger['info'](_0x0a9e('0x1f'),_0x5ea472);return _0x4d00e6[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':_0x0a9e('0x20')});})['catch'](function(_0x384319){logger['error'](_0x384319);return _0x4d00e6[_0x0a9e('0xe')](0x1f4)['json'](_0x384319);});};exports[_0x0a9e('0x21')]=function(_0x34dc65,_0x25fba9){var _0x14433c=new Umzug({'storage':_0x0a9e('0x22'),'storageOptions':{'model':db[_0x0a9e('0x23')],'modelName':_0x0a9e('0x23'),'columnName':_0x0a9e('0xa')},'migrations':{'params':[db['sequelize'][_0x0a9e('0x24')](),db[_0x0a9e('0x22')][_0x0a9e('0x25')],function(){throw new Error(_0x0a9e('0x26'));}],'path':path['join'](config[_0x0a9e('0x27')],_0x0a9e('0x28'),_0x0a9e('0x21')),'pattern':/\.js$/}});_0x14433c['up']({'from':module[_0x0a9e('0x29')][_0x0a9e('0xa')]+_0x0a9e('0x2a')})[_0x0a9e('0x1e')](function(){return _0x25fba9[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':'Database\x20Migration\x20Completed!'});})[_0x0a9e('0x2b')](function(_0x5d1e0e){return _0x25fba9[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x5d1e0e);});}; \ No newline at end of file +var _0xa9e0=['master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','server','exports','.js','catch','umzug','path','pkginfo','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','version','latest','fetch','tags','status','json','origin'];(function(_0x2d3aab,_0x41f603){var _0x596079=function(_0x21c47a){while(--_0x21c47a){_0x2d3aab['push'](_0x2d3aab['shift']());}};_0x596079(++_0x41f603);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Umzug=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var pkginfo=require(_0x0a9e('0x2'))(module,'version');var exec=require('child_process')[_0x0a9e('0x3')];var db=require('../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var pm2=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var git=require(_0x0a9e('0x8'))(config['root']);exports[_0x0a9e('0x9')]=function(_0x441e3a,_0x2cc193){var _0x5f41ea={'current':module['exports'][_0x0a9e('0xa')],'phonebar':0x2};if(_0x441e3a['query']&&_0x441e3a['query'][_0x0a9e('0xb')]){return git[_0x0a9e('0xc')]()[_0x0a9e('0xd')](function(_0x3ab53f,_0xfeb75b){_0x5f41ea[_0x0a9e('0xb')]=(_0x3ab53f?module['exports']['version']:_0xfeb75b['latest'])||'2.0.0';return _0x2cc193[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')](_0x5f41ea);});}else{return _0x2cc193[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')](_0x5f41ea);}};exports[_0x0a9e('0xc')]=function(_0x69aeb7,_0x5db4b0){return git[_0x0a9e('0xc')]([_0x0a9e('0x10'),_0x0a9e('0x11')],function(_0x281129){if(_0x281129){logger[_0x0a9e('0x12')](_0x281129);return _0x5db4b0[_0x0a9e('0xe')](0x1f4)['json'](_0x281129);}logger[_0x0a9e('0x13')]('git\x20fetch');return _0x5db4b0[_0x0a9e('0xe')](0xc8)['json']({'output':_0x0a9e('0x14')});});};exports[_0x0a9e('0x15')]=function(_0x48f32d,_0x225616){return git['reset']([_0x0a9e('0x16'),_0x0a9e('0x17')],function(_0x106033){if(_0x106033){logger[_0x0a9e('0x12')](_0x106033);return _0x225616[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x106033);}logger[_0x0a9e('0x13')](_0x0a9e('0x18'));return _0x225616[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':_0x0a9e('0x19')});});};exports[_0x0a9e('0x1a')]=function(_0x4bb1e3,_0x2c3407){exec(_0x0a9e('0x1b'),function(_0x53682f,_0x20f109,_0x5a09ef){logger['info'](_0x20f109);logger[_0x0a9e('0x13')](_0x5a09ef);if(_0x53682f){logger[_0x0a9e('0x12')](_0x53682f);return _0x2c3407[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x53682f);}return _0x2c3407['status'](0xc8)[_0x0a9e('0xf')]({'output':_0x20f109});});};exports[_0x0a9e('0x1c')]=function(_0x3b45bc,_0x4d00e6){return pm2[_0x0a9e('0x1c')](_0x0a9e('0x1d'))[_0x0a9e('0x1e')](function(_0x5ea472){logger['info'](_0x0a9e('0x1f'),_0x5ea472);return _0x4d00e6[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':_0x0a9e('0x20')});})['catch'](function(_0x384319){logger['error'](_0x384319);return _0x4d00e6[_0x0a9e('0xe')](0x1f4)['json'](_0x384319);});};exports[_0x0a9e('0x21')]=function(_0x34dc65,_0x25fba9){var _0x14433c=new Umzug({'storage':_0x0a9e('0x22'),'storageOptions':{'model':db[_0x0a9e('0x23')],'modelName':_0x0a9e('0x23'),'columnName':_0x0a9e('0xa')},'migrations':{'params':[db['sequelize'][_0x0a9e('0x24')](),db[_0x0a9e('0x22')][_0x0a9e('0x25')],function(){throw new Error(_0x0a9e('0x26'));}],'path':path['join'](config[_0x0a9e('0x27')],_0x0a9e('0x28'),_0x0a9e('0x21')),'pattern':/\.js$/}});_0x14433c['up']({'from':module[_0x0a9e('0x29')][_0x0a9e('0xa')]+_0x0a9e('0x2a')})[_0x0a9e('0x1e')](function(){return _0x25fba9[_0x0a9e('0xe')](0xc8)[_0x0a9e('0xf')]({'output':'Database\x20Migration\x20Completed!'});})[_0x0a9e('0x2b')](function(_0x5d1e0e){return _0x25fba9[_0x0a9e('0xe')](0x1f4)[_0x0a9e('0xf')](_0x5d1e0e);});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index dcf6ba7..0a7e897 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 _0xd046=['delete','isAuthenticated','exports','util','path','connect-timeout','Router','../../config/environment','get','/describe','/:id','post','create','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd046,0x129));var _0x6d04=function(_0x23edf2,_0xf575f8){_0x23edf2=_0x23edf2-0x0;var _0xbd509e=_0xd046[_0x23edf2];return _0xbd509e;};'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('./voiceAgentReport.controller');router[_0x6d04('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6d04('0x5')](_0x6d04('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x6d04('0x5')](_0x6d04('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x6d04('0x8')]('/',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6d04('0xa')]);router[_0x6d04('0xb')](_0x6d04('0x7'),auth[_0x6d04('0xc')](),controller['destroy']);module[_0x6d04('0xd')]=router; \ No newline at end of file +var _0x0295=['exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','delete'];(function(_0xb836c0,_0x50e96c){var _0x42d89c=function(_0x3a063b){while(--_0x3a063b){_0xb836c0['push'](_0xb836c0['shift']());}};_0x42d89c(++_0x50e96c);}(_0x0295,0x1f0));var _0x5029=function(_0x1b7ad0,_0x25c5c3){_0x1b7ad0=_0x1b7ad0-0x0;var _0x424a5a=_0x0295[_0x1b7ad0];return _0x424a5a;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x5029('0x2'));var interaction=require(_0x5029('0x3'));var config=require(_0x5029('0x4'));var controller=require(_0x5029('0x5'));router[_0x5029('0x6')]('/',auth[_0x5029('0x7')](),controller[_0x5029('0x8')]);router[_0x5029('0x6')](_0x5029('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x5029('0xa'),auth['isAuthenticated'](),controller[_0x5029('0xb')]);router['post']('/',auth[_0x5029('0x7')](),controller['create']);router[_0x5029('0xc')](_0x5029('0xa'),auth[_0x5029('0x7')](),controller['update']);router[_0x5029('0xd')](_0x5029('0xa'),auth[_0x5029('0x7')](),controller['destroy']);module[_0x5029('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 18f0b96..c782d75 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 _0x21e6=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0x296039,_0x3f3e50){var _0x16e440=function(_0x4905ca){while(--_0x4905ca){_0x296039['push'](_0x296039['shift']());}};_0x16e440(++_0x3f3e50);}(_0x21e6,0xd0));var _0x621e=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0x21e6[_0x6dfbaa];return _0xfbe02;};'use strict';var Sequelize=require('sequelize');module[_0x621e('0x0')]={'type':{'type':Sequelize[_0x621e('0x1')]},'uniqueid':{'type':Sequelize[_0x621e('0x1')]},'calleridnum':{'type':Sequelize[_0x621e('0x1')]},'calleridname':{'type':Sequelize[_0x621e('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x621e('0x1')]},'agentcalledAt':{'type':Sequelize[_0x621e('0x2')]},'agentconnectAt':{'type':Sequelize[_0x621e('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x621e('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x621e('0x2')]},'agentdumpAt':{'type':Sequelize[_0x621e('0x2')]},'holdtime':{'type':Sequelize[_0x621e('0x3')]},'agentcomplete':{'type':Sequelize[_0x621e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x621e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x621e('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x621e('0x3')]},'agentacw':{'type':Sequelize[_0x621e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x621e('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x621e('0x1')]},'channel':{'type':Sequelize[_0x621e('0x1')]},'channelstate':{'type':Sequelize[_0x621e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x621e('0x1')]},'connectedlinenum':{'type':Sequelize[_0x621e('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x621e('0x1')]},'accountcode':{'type':Sequelize[_0x621e('0x1')]},'context':{'type':Sequelize[_0x621e('0x1')]},'exten':{'type':Sequelize[_0x621e('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x621e('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x621e('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x621e('0x1')]},'destlanguage':{'type':Sequelize[_0x621e('0x1')]},'destaccountcode':{'type':Sequelize[_0x621e('0x1')]},'destcontext':{'type':Sequelize[_0x621e('0x1')]},'destexten':{'type':Sequelize[_0x621e('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x621e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x621e('0x1')]},'transfer':{'type':Sequelize[_0x621e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x621e('0x1')],'comment':_0x621e('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x621e('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x754b=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x1fd29d,_0x1bd953){var _0x8d692c=function(_0x171162){while(--_0x171162){_0x1fd29d['push'](_0x1fd29d['shift']());}};_0x8d692c(++_0x1bd953);}(_0x754b,0x1ba));var _0xb754=function(_0x308374,_0x550e85){_0x308374=_0x308374-0x0;var _0x1f71e0=_0x754b[_0x308374];return _0x1f71e0;};'use strict';var Sequelize=require(_0xb754('0x0'));module[_0xb754('0x1')]={'type':{'type':Sequelize[_0xb754('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb754('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb754('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xb754('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xb754('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb754('0x4')]},'agentcomplete':{'type':Sequelize[_0xb754('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb754('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb754('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb754('0x4')]},'agentacw':{'type':Sequelize[_0xb754('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb754('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xb754('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb754('0x2')]},'connectedlinename':{'type':Sequelize[_0xb754('0x2')]},'language':{'type':Sequelize[_0xb754('0x2')]},'accountcode':{'type':Sequelize[_0xb754('0x2')]},'context':{'type':Sequelize[_0xb754('0x2')]},'exten':{'type':Sequelize[_0xb754('0x2')]},'priority':{'type':Sequelize[_0xb754('0x2')]},'destchannel':{'type':Sequelize[_0xb754('0x2')]},'destchannelstate':{'type':Sequelize[_0xb754('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xb754('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb754('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb754('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb754('0x2')]},'destlanguage':{'type':Sequelize[_0xb754('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xb754('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xb754('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb754('0x2')],'comment':_0xb754('0x6')},'transferexten':{'type':Sequelize[_0xb754('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb754('0x2')]},'agententerreason':{'type':Sequelize[_0xb754('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 66dd44e..f25d7f1 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 _0x0abe=['moment','bluebird','mustache','util','path','to-csv','ejs','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','stack','send','VoiceAgentReport','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','key','field','options','includeAll','include','findAll','catch','show','params','create','body','find','destroy','describe','html-pdf','rimraf','fast-json-patch','request-promise'];(function(_0x560c52,_0x36a57e){var _0x1e246a=function(_0x1812fb){while(--_0x1812fb){_0x560c52['push'](_0x560c52['shift']());}};_0x1e246a(++_0x36a57e);}(_0x0abe,0x188));var _0xe0ab=function(_0x103d9b,_0xf6678){_0x103d9b=_0x103d9b-0x0;var _0x12dad5=_0x0abe[_0x103d9b];return _0x12dad5;};'use strict';var pdf=require(_0xe0ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0ab('0x2'));var rp=require(_0xe0ab('0x3'));var moment=require(_0xe0ab('0x4'));var BPromise=require(_0xe0ab('0x5'));var Mustache=require(_0xe0ab('0x6'));var util=require(_0xe0ab('0x7'));var path=require(_0xe0ab('0x8'));var sox=require('sox');var csv=require(_0xe0ab('0x9'));var ejs=require(_0xe0ab('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0ab('0xb'));var deskjs=require(_0xe0ab('0xc'));var toCsv=require(_0xe0ab('0x9'));var querystring=require('querystring');var Papa=require(_0xe0ab('0xd'));var authService=require(_0xe0ab('0xe'));var hardwareService=require(_0xe0ab('0xf'));var Redis=require(_0xe0ab('0x10'));var qs=require(_0xe0ab('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xe0ab('0x12'));var config=require('../../config/environment');var db=require(_0xe0ab('0x13'))['db'];function respondWithStatusCode(_0x26ea3c,_0x5ec93c){_0x5ec93c=_0x5ec93c||0xcc;return function(_0x11ba06){if(_0x11ba06){return _0x26ea3c['sendStatus'](_0x5ec93c);}return _0x26ea3c[_0xe0ab('0x14')](_0x5ec93c)[_0xe0ab('0x15')]();};}function respondWithResult(_0x2344fd,_0x1a1a49){_0x1a1a49=_0x1a1a49||0xc8;return function(_0x14d5ad){if(_0x14d5ad){return _0x2344fd['status'](_0x1a1a49)['json'](_0x14d5ad);}};}function respondWithFilteredResult(_0x27f895,_0x44ee22){return function(_0x59f487){if(_0x59f487){var _0x10fe05=_0x59f487[_0xe0ab('0x16')],_0x12cce8=_0x44ee22['offset'],_0x572f13=_0x44ee22[_0xe0ab('0x17')]+_0x44ee22[_0xe0ab('0x18')],_0x232d3f;if(_0x572f13>=_0x10fe05){_0x572f13=_0x10fe05;_0x232d3f=0xc8;}else{_0x232d3f=0xce;}_0x27f895[_0xe0ab('0x14')](_0x232d3f);return _0x27f895[_0xe0ab('0x19')](_0xe0ab('0x1a'),_0x12cce8+'-'+_0x572f13+'/'+_0x10fe05)[_0xe0ab('0x1b')](_0x59f487);}return null;};}function patchUpdates(_0x4002a2){return function(_0x416d9d){try{jsonpatch[_0xe0ab('0x1c')](_0x416d9d,_0x4002a2,!![]);}catch(_0x10e882){return BPromise['reject'](_0x10e882);}return _0x416d9d[_0xe0ab('0x1d')]();};}function saveUpdates(_0xdc1a28,_0x3eab95){return function(_0x5853dc){if(_0x5853dc){return _0x5853dc[_0xe0ab('0x1e')](_0xdc1a28)[_0xe0ab('0x1f')](function(_0x816d3e){return _0x816d3e;});}return null;};}function removeEntity(_0x3948fc,_0xe66cda){return function(_0x13321f){if(_0x13321f){return _0x13321f['destroy']()[_0xe0ab('0x1f')](function(){_0x3948fc[_0xe0ab('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x395c20,_0x1650c3){return function(_0x1c85f1){if(!_0x1c85f1){_0x395c20['sendStatus'](0x194);}return _0x1c85f1;};}function handleError(_0x558bfa,_0x548804){_0x548804=_0x548804||0x1f4;return function(_0x55f54b){logger['error'](_0x55f54b[_0xe0ab('0x20')]);if(_0x55f54b['name']){delete _0x55f54b['name'];}_0x558bfa[_0xe0ab('0x14')](_0x548804)[_0xe0ab('0x21')](_0x55f54b);};}exports['index']=function(_0x5a2c1b,_0x1dd7c5){var _0x411102={},_0x48bfa2={},_0x4dd692={'count':0x0,'rows':[]};var _0x216101=db[_0xe0ab('0x22')][_0xe0ab('0x23')];_0x48bfa2[_0xe0ab('0x24')]=_[_0xe0ab('0x25')](_0x216101);_0x48bfa2[_0xe0ab('0x26')]=_[_0xe0ab('0x25')](_0x5a2c1b[_0xe0ab('0x26')]);_0x48bfa2[_0xe0ab('0x27')]=_[_0xe0ab('0x28')](_0x48bfa2[_0xe0ab('0x24')],_0x48bfa2[_0xe0ab('0x26')]);_0x411102['attributes']=_[_0xe0ab('0x28')](_0x48bfa2[_0xe0ab('0x24')],qs[_0xe0ab('0x29')](_0x5a2c1b[_0xe0ab('0x26')]['fields']));_0x411102[_0xe0ab('0x2a')]=_0x411102['attributes'][_0xe0ab('0x2b')]?_0x411102[_0xe0ab('0x2a')]:_0x48bfa2[_0xe0ab('0x24')];if(!_0x5a2c1b[_0xe0ab('0x26')]['hasOwnProperty'](_0xe0ab('0x2c'))){_0x411102[_0xe0ab('0x18')]=qs[_0xe0ab('0x18')](_0x5a2c1b[_0xe0ab('0x26')][_0xe0ab('0x18')]);_0x411102[_0xe0ab('0x17')]=qs[_0xe0ab('0x17')](_0x5a2c1b['query'][_0xe0ab('0x17')]);}_0x411102[_0xe0ab('0x2d')]=qs[_0xe0ab('0x2e')](_0x5a2c1b[_0xe0ab('0x26')][_0xe0ab('0x2e')]);_0x411102[_0xe0ab('0x2f')]=qs[_0xe0ab('0x27')](_[_0xe0ab('0x30')](_0x5a2c1b[_0xe0ab('0x26')],_0x48bfa2['filters']));if(_0x5a2c1b['query'][_0xe0ab('0x31')]){_0x411102['where']=_[_0xe0ab('0x32')](_0x411102['where'],{'$or':_['map'](_0x216101,function(_0x2bc115){if(_0x2bc115[_0xe0ab('0x33')][_0xe0ab('0x34')]!=='VIRTUAL'){var _0x406308={};_0x406308[_0x2bc115[_0xe0ab('0x35')]]={'$like':'%'+_0x5a2c1b[_0xe0ab('0x26')][_0xe0ab('0x31')]+'%'};return _0x406308;}})});}_0x411102=_[_0xe0ab('0x32')]({},_0x411102,_0x5a2c1b[_0xe0ab('0x36')]);var _0x88ba9f={'where':_0x411102[_0xe0ab('0x2f')]};return db[_0xe0ab('0x22')][_0xe0ab('0x16')](_0x88ba9f)[_0xe0ab('0x1f')](function(_0x92a716){_0x4dd692['count']=_0x92a716;if(_0x5a2c1b[_0xe0ab('0x26')][_0xe0ab('0x37')]){_0x411102[_0xe0ab('0x38')]=[{'all':!![]}];}return db[_0xe0ab('0x22')][_0xe0ab('0x39')](_0x411102);})[_0xe0ab('0x1f')](function(_0x7c288e){_0x4dd692['rows']=_0x7c288e;return _0x4dd692;})['then'](respondWithFilteredResult(_0x1dd7c5,_0x411102))[_0xe0ab('0x3a')](handleError(_0x1dd7c5,null));};exports[_0xe0ab('0x3b')]=function(_0x570f3b,_0x132e6f){var _0x18f0c5={'raw':![],'where':{'id':_0x570f3b[_0xe0ab('0x3c')]['id']}},_0x58635f={};_0x58635f[_0xe0ab('0x24')]=_['keys'](db[_0xe0ab('0x22')][_0xe0ab('0x23')]);_0x58635f[_0xe0ab('0x26')]=_['keys'](_0x570f3b[_0xe0ab('0x26')]);_0x58635f['filters']=_[_0xe0ab('0x28')](_0x58635f[_0xe0ab('0x24')],_0x58635f[_0xe0ab('0x26')]);_0x18f0c5[_0xe0ab('0x2a')]=_[_0xe0ab('0x28')](_0x58635f[_0xe0ab('0x24')],qs['fields'](_0x570f3b['query'][_0xe0ab('0x29')]));_0x18f0c5[_0xe0ab('0x2a')]=_0x18f0c5['attributes']['length']?_0x18f0c5[_0xe0ab('0x2a')]:_0x58635f[_0xe0ab('0x24')];if(_0x570f3b[_0xe0ab('0x26')][_0xe0ab('0x37')]){_0x18f0c5[_0xe0ab('0x38')]=[{'all':!![]}];}_0x18f0c5=_[_0xe0ab('0x32')]({},_0x18f0c5,_0x570f3b[_0xe0ab('0x36')]);return db[_0xe0ab('0x22')]['find'](_0x18f0c5)[_0xe0ab('0x1f')](handleEntityNotFound(_0x132e6f,null))[_0xe0ab('0x1f')](respondWithResult(_0x132e6f,null))[_0xe0ab('0x3a')](handleError(_0x132e6f,null));};exports[_0xe0ab('0x3d')]=function(_0x4c3021,_0x1f4447){return db[_0xe0ab('0x22')][_0xe0ab('0x3d')](_0x4c3021[_0xe0ab('0x3e')],{})[_0xe0ab('0x1f')](respondWithResult(_0x1f4447,0xc9))[_0xe0ab('0x3a')](handleError(_0x1f4447,null));};exports[_0xe0ab('0x1e')]=function(_0x1cc993,_0x59f931){if(_0x1cc993[_0xe0ab('0x3e')]['id']){delete _0x1cc993[_0xe0ab('0x3e')]['id'];}return db[_0xe0ab('0x22')][_0xe0ab('0x3f')]({'where':{'id':_0x1cc993[_0xe0ab('0x3c')]['id']}})['then'](handleEntityNotFound(_0x59f931,null))['then'](saveUpdates(_0x1cc993[_0xe0ab('0x3e')],null))[_0xe0ab('0x1f')](respondWithResult(_0x59f931,null))[_0xe0ab('0x3a')](handleError(_0x59f931,null));};exports[_0xe0ab('0x40')]=function(_0x1b04a4,_0x551d92){return db[_0xe0ab('0x22')][_0xe0ab('0x3f')]({'where':{'id':_0x1b04a4[_0xe0ab('0x3c')]['id']}})[_0xe0ab('0x1f')](handleEntityNotFound(_0x551d92,null))['then'](removeEntity(_0x551d92,null))[_0xe0ab('0x3a')](handleError(_0x551d92,null));};exports[_0xe0ab('0x41')]=function(_0x40cbca,_0x2c505c){return db[_0xe0ab('0x22')][_0xe0ab('0x41')]()['then'](respondWithResult(_0x2c505c,null))[_0xe0ab('0x3a')](handleError(_0x2c505c,null));}; \ No newline at end of file +var _0x28a0=['html-pdf','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','VoiceAgentReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','map','key','VIRTUAL','merge','includeAll','findAll','rows','catch','show','length','include','options','find','body','params','describe'];(function(_0x949616,_0x32abb3){var _0x3bcfdc=function(_0x2d66d1){while(--_0x2d66d1){_0x949616['push'](_0x949616['shift']());}};_0x3bcfdc(++_0x32abb3);}(_0x28a0,0x8a));var _0x028a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x28a0[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x028a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x028a('0x1'));var zipdir=require(_0x028a('0x2'));var jsonpatch=require(_0x028a('0x3'));var rp=require('request-promise');var moment=require(_0x028a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x028a('0x5'));var sox=require('sox');var csv=require(_0x028a('0x6'));var ejs=require(_0x028a('0x7'));var fs=require('fs');var _=require(_0x028a('0x8'));var squel=require(_0x028a('0x9'));var crypto=require(_0x028a('0xa'));var jsforce=require(_0x028a('0xb'));var deskjs=require(_0x028a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x028a('0xd'));var Papa=require(_0x028a('0xe'));var authService=require(_0x028a('0xf'));var hardwareService=require(_0x028a('0x10'));var Redis=require('ioredis');var qs=require(_0x028a('0x11'));var logger=require(_0x028a('0x12'))(_0x028a('0x13'));var utils=require(_0x028a('0x14'));var config=require('../../config/environment');var db=require(_0x028a('0x15'))['db'];function respondWithStatusCode(_0x352591,_0x2aa90c){_0x2aa90c=_0x2aa90c||0xcc;return function(_0x32a606){if(_0x32a606){return _0x352591[_0x028a('0x16')](_0x2aa90c);}return _0x352591[_0x028a('0x17')](_0x2aa90c)['end']();};}function respondWithResult(_0x178240,_0x5704b4){_0x5704b4=_0x5704b4||0xc8;return function(_0x572e74){if(_0x572e74){return _0x178240[_0x028a('0x17')](_0x5704b4)[_0x028a('0x18')](_0x572e74);}};}function respondWithFilteredResult(_0x5d2b0c,_0x9df638){return function(_0xe713cc){if(_0xe713cc){var _0x215d6b=_0xe713cc[_0x028a('0x19')],_0x5f2456=_0x9df638[_0x028a('0x1a')],_0x56e61c=_0x9df638[_0x028a('0x1a')]+_0x9df638[_0x028a('0x1b')],_0x4e7340;if(_0x56e61c>=_0x215d6b){_0x56e61c=_0x215d6b;_0x4e7340=0xc8;}else{_0x4e7340=0xce;}_0x5d2b0c[_0x028a('0x17')](_0x4e7340);return _0x5d2b0c[_0x028a('0x1c')](_0x028a('0x1d'),_0x5f2456+'-'+_0x56e61c+'/'+_0x215d6b)[_0x028a('0x18')](_0xe713cc);}return null;};}function patchUpdates(_0x4779cb){return function(_0x11beb8){try{jsonpatch['apply'](_0x11beb8,_0x4779cb,!![]);}catch(_0x1dc89c){return BPromise[_0x028a('0x1e')](_0x1dc89c);}return _0x11beb8[_0x028a('0x1f')]();};}function saveUpdates(_0x5373ae,_0x492844){return function(_0x14c203){if(_0x14c203){return _0x14c203[_0x028a('0x20')](_0x5373ae)[_0x028a('0x21')](function(_0x25deb0){return _0x25deb0;});}return null;};}function removeEntity(_0x5108d8,_0x6cda6){return function(_0x47b65d){if(_0x47b65d){return _0x47b65d[_0x028a('0x22')]()[_0x028a('0x21')](function(){_0x5108d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0857,_0x55b652){return function(_0x112f8d){if(!_0x112f8d){_0x5f0857[_0x028a('0x16')](0x194);}return _0x112f8d;};}function handleError(_0x5a9655,_0x40b133){_0x40b133=_0x40b133||0x1f4;return function(_0x75e3b7){logger[_0x028a('0x23')](_0x75e3b7[_0x028a('0x24')]);if(_0x75e3b7[_0x028a('0x25')]){delete _0x75e3b7[_0x028a('0x25')];}_0x5a9655[_0x028a('0x17')](_0x40b133)[_0x028a('0x26')](_0x75e3b7);};}exports['index']=function(_0xe0ad26,_0x2422d8){var _0x105327={},_0x56a92b={},_0x40c0fd={'count':0x0,'rows':[]};var _0x36a06e=db[_0x028a('0x27')][_0x028a('0x28')];_0x56a92b[_0x028a('0x29')]=_['keys'](_0x36a06e);_0x56a92b[_0x028a('0x2a')]=_[_0x028a('0x2b')](_0xe0ad26[_0x028a('0x2a')]);_0x56a92b[_0x028a('0x2c')]=_[_0x028a('0x2d')](_0x56a92b[_0x028a('0x29')],_0x56a92b['query']);_0x105327[_0x028a('0x2e')]=_[_0x028a('0x2d')](_0x56a92b[_0x028a('0x29')],qs[_0x028a('0x2f')](_0xe0ad26[_0x028a('0x2a')][_0x028a('0x2f')]));_0x105327[_0x028a('0x2e')]=_0x105327['attributes']['length']?_0x105327[_0x028a('0x2e')]:_0x56a92b[_0x028a('0x29')];if(!_0xe0ad26['query']['hasOwnProperty']('nolimit')){_0x105327[_0x028a('0x1b')]=qs['limit'](_0xe0ad26[_0x028a('0x2a')][_0x028a('0x1b')]);_0x105327[_0x028a('0x1a')]=qs['offset'](_0xe0ad26['query'][_0x028a('0x1a')]);}_0x105327[_0x028a('0x30')]=qs[_0x028a('0x31')](_0xe0ad26[_0x028a('0x2a')][_0x028a('0x31')]);_0x105327[_0x028a('0x32')]=qs[_0x028a('0x2c')](_[_0x028a('0x33')](_0xe0ad26[_0x028a('0x2a')],_0x56a92b['filters']));if(_0xe0ad26['query'][_0x028a('0x34')]){_0x105327[_0x028a('0x32')]=_['merge'](_0x105327[_0x028a('0x32')],{'$or':_[_0x028a('0x35')](_0x36a06e,function(_0x18cc7a){if(_0x18cc7a['type'][_0x028a('0x36')]!==_0x028a('0x37')){var _0x257726={};_0x257726[_0x18cc7a['field']]={'$like':'%'+_0xe0ad26[_0x028a('0x2a')][_0x028a('0x34')]+'%'};return _0x257726;}})});}_0x105327=_[_0x028a('0x38')]({},_0x105327,_0xe0ad26['options']);var _0x5200b6={'where':_0x105327['where']};return db[_0x028a('0x27')]['count'](_0x5200b6)[_0x028a('0x21')](function(_0x2e8e21){_0x40c0fd[_0x028a('0x19')]=_0x2e8e21;if(_0xe0ad26[_0x028a('0x2a')][_0x028a('0x39')]){_0x105327['include']=[{'all':!![]}];}return db['VoiceAgentReport'][_0x028a('0x3a')](_0x105327);})['then'](function(_0x2d80d4){_0x40c0fd[_0x028a('0x3b')]=_0x2d80d4;return _0x40c0fd;})[_0x028a('0x21')](respondWithFilteredResult(_0x2422d8,_0x105327))[_0x028a('0x3c')](handleError(_0x2422d8,null));};exports[_0x028a('0x3d')]=function(_0x620048,_0x318881){var _0x43da8e={'raw':![],'where':{'id':_0x620048['params']['id']}},_0x3fee9a={};_0x3fee9a['model']=_['keys'](db[_0x028a('0x27')][_0x028a('0x28')]);_0x3fee9a['query']=_[_0x028a('0x2b')](_0x620048[_0x028a('0x2a')]);_0x3fee9a['filters']=_[_0x028a('0x2d')](_0x3fee9a[_0x028a('0x29')],_0x3fee9a[_0x028a('0x2a')]);_0x43da8e[_0x028a('0x2e')]=_[_0x028a('0x2d')](_0x3fee9a['model'],qs[_0x028a('0x2f')](_0x620048['query']['fields']));_0x43da8e[_0x028a('0x2e')]=_0x43da8e['attributes'][_0x028a('0x3e')]?_0x43da8e[_0x028a('0x2e')]:_0x3fee9a['model'];if(_0x620048[_0x028a('0x2a')][_0x028a('0x39')]){_0x43da8e[_0x028a('0x3f')]=[{'all':!![]}];}_0x43da8e=_[_0x028a('0x38')]({},_0x43da8e,_0x620048[_0x028a('0x40')]);return db[_0x028a('0x27')][_0x028a('0x41')](_0x43da8e)[_0x028a('0x21')](handleEntityNotFound(_0x318881,null))[_0x028a('0x21')](respondWithResult(_0x318881,null))[_0x028a('0x3c')](handleError(_0x318881,null));};exports['create']=function(_0x2a4399,_0x660d25){return db[_0x028a('0x27')]['create'](_0x2a4399[_0x028a('0x42')],{})[_0x028a('0x21')](respondWithResult(_0x660d25,0xc9))['catch'](handleError(_0x660d25,null));};exports[_0x028a('0x20')]=function(_0x5d5a10,_0x2d415c){if(_0x5d5a10['body']['id']){delete _0x5d5a10[_0x028a('0x42')]['id'];}return db['VoiceAgentReport'][_0x028a('0x41')]({'where':{'id':_0x5d5a10['params']['id']}})[_0x028a('0x21')](handleEntityNotFound(_0x2d415c,null))[_0x028a('0x21')](saveUpdates(_0x5d5a10['body'],null))['then'](respondWithResult(_0x2d415c,null))[_0x028a('0x3c')](handleError(_0x2d415c,null));};exports[_0x028a('0x22')]=function(_0x28c5f7,_0x499440){return db[_0x028a('0x27')][_0x028a('0x41')]({'where':{'id':_0x28c5f7[_0x028a('0x43')]['id']}})[_0x028a('0x21')](handleEntityNotFound(_0x499440,null))['then'](removeEntity(_0x499440,null))[_0x028a('0x3c')](handleError(_0x499440,null));};exports[_0x028a('0x44')]=function(_0x307936,_0x19c976){return db['VoiceAgentReport'][_0x028a('0x44')]()['then'](respondWithResult(_0x19c976,null))[_0x028a('0x3c')](handleError(_0x19c976,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 85705e9..a14dcce 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 _0x79b2=['VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','./voiceAgentReport.attributes','exports','define'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x79b2,0x1ef));var _0x279b=function(_0x22093c,_0x14e82f){_0x22093c=_0x22093c-0x0;var _0x383396=_0x79b2[_0x22093c];return _0x383396;};'use strict';var _=require(_0x279b('0x0'));var util=require(_0x279b('0x1'));var logger=require(_0x279b('0x2'))(_0x279b('0x3'));var moment=require(_0x279b('0x4'));var BPromise=require(_0x279b('0x5'));var rp=require('request-promise');var attributes=require(_0x279b('0x6'));module[_0x279b('0x7')]=function(_0x36f51b,_0x320095){return _0x36f51b[_0x279b('0x8')](_0x279b('0x9'),attributes,{'tableName':_0x279b('0xa'),'paranoid':![],'indexes':[{'fields':[_0x279b('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd800=['request-promise','./voiceAgentReport.attributes','exports','report_agent','destuniqueid','lodash','../../config/logger','api','moment'];(function(_0x3cc724,_0x470b13){var _0x4b72d4=function(_0x1276c4){while(--_0x1276c4){_0x3cc724['push'](_0x3cc724['shift']());}};_0x4b72d4(++_0x470b13);}(_0xd800,0x1ac));var _0x0d80=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xd800[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0d80('0x0'));var util=require('util');var logger=require(_0x0d80('0x1'))(_0x0d80('0x2'));var moment=require(_0x0d80('0x3'));var BPromise=require('bluebird');var rp=require(_0x0d80('0x4'));var attributes=require(_0x0d80('0x5'));module[_0x0d80('0x6')]=function(_0x269ee8,_0x436246){return _0x269ee8['define']('VoiceAgentReport',attributes,{'tableName':_0x0d80('0x7'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x0d80('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d27a9cd..64c622a 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 _0x814b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceAgentReport','body','raw','stringify','VoiceAgentReport','update','options','where','attributes','limit','UpdateVoiceAgentReport','lodash','util'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x814b,0x1a2));var _0xb814=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x814b[_0x263f9d];return _0x4c4efa;};'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});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['VoiceAgentReport']['create'](_0x55ba16[_0xb814('0x19')],{'raw':_0x55ba16['options']?_0x55ba16['options'][_0xb814('0x1a')]===undefined?!![]:![]:!![]})[_0xb814('0xd')](function(_0x25b6b6){logger['info'](_0xb814('0x18'),_0x55ba16);logger['debug'](_0xb814('0x18'),_0x55ba16,JSON[_0xb814('0x1b')](_0x25b6b6));_0xfac75b(_0x25b6b6);})[_0xb814('0x17')](function(_0x470e81){logger[_0xb814('0x13')](_0xb814('0x18'),_0x470e81[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x470e81[_0xb814('0x15')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3f81d0){var _0x457dac=this;return new Promise(function(_0x31c7ec,_0x208927){return db[_0xb814('0x1c')][_0xb814('0x1d')](_0x3f81d0[_0xb814('0x19')],{'raw':_0x3f81d0['options']?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f81d0[_0xb814('0x1e')]?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x1f')]||null:null,'attributes':_0x3f81d0[_0xb814('0x1e')]?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x20')]||null:null,'limit':_0x3f81d0['options']?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x21')]||null:null})['then'](function(_0x9008b2){logger[_0xb814('0xe')](_0xb814('0x22'),_0x3f81d0);logger['debug'](_0xb814('0x22'),_0x3f81d0,JSON[_0xb814('0x1b')](_0x9008b2));_0x31c7ec(_0x9008b2);})['catch'](function(_0x338a28){logger['error'](_0xb814('0x22'),_0x338a28['message'],_0x3f81d0);_0x208927(_0x457dac['error'](0x1f4,_0x338a28[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceAgentReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','then','lodash','util'];(function(_0x166f5f,_0x3a282b){var _0x2d2190=function(_0x249033){while(--_0x249033){_0x166f5f['push'](_0x166f5f['shift']());}};_0x2d2190(++_0x3a282b);}(_0x7a54,0x106));var _0x47a5=function(_0x5c8791,_0x1a27dd){_0x5c8791=_0x5c8791-0x0;var _0x1f57ac=_0x7a54[_0x5c8791];return _0x1f57ac;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateVoiceAgentReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateVoiceAgentReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index df42409..0cde835 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 _0x4d34=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x3680a3,_0x7f385b){var _0x219561=function(_0x41f781){while(--_0x41f781){_0x3680a3['push'](_0x3680a3['shift']());}};_0x219561(++_0x7f385b);}(_0x4d34,0x13d));var _0x44d3=function(_0x4dcbcd,_0x5cf059){_0x4dcbcd=_0x4dcbcd-0x0;var _0x3b9772=_0x4d34[_0x4dcbcd];return _0x3b9772;};'use strict';var multer=require('multer');var util=require(_0x44d3('0x0'));var path=require(_0x44d3('0x1'));var timeout=require(_0x44d3('0x2'));var express=require(_0x44d3('0x3'));var router=express['Router']();var auth=require(_0x44d3('0x4'));var interaction=require(_0x44d3('0x5'));var config=require(_0x44d3('0x6'));var controller=require(_0x44d3('0x7'));router[_0x44d3('0x8')]('/',auth[_0x44d3('0x9')](),controller[_0x44d3('0xa')]);router['get'](_0x44d3('0xb'),auth[_0x44d3('0x9')](),controller[_0x44d3('0xc')]);router[_0x44d3('0x8')](_0x44d3('0xd'),auth['isAuthenticated'](),controller[_0x44d3('0xe')]);router[_0x44d3('0xf')]('/',auth[_0x44d3('0x9')](),controller[_0x44d3('0x10')]);router['put'](_0x44d3('0xd'),auth[_0x44d3('0x9')](),controller[_0x44d3('0x11')]);router[_0x44d3('0x12')]('/:id',auth[_0x44d3('0x9')](),controller[_0x44d3('0x13')]);module[_0x44d3('0x14')]=router; \ No newline at end of file +var _0x0f96=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','post','create','put','update','delete','/:id','destroy','exports','util','connect-timeout','express'];(function(_0x12c263,_0x2d9bce){var _0x192cd7=function(_0x3a1fc0){while(--_0x3a1fc0){_0x12c263['push'](_0x12c263['shift']());}};_0x192cd7(++_0x2d9bce);}(_0x0f96,0x165));var _0x60f9=function(_0x1f2a8e,_0x33f70e){_0x1f2a8e=_0x1f2a8e-0x0;var _0x4800ab=_0x0f96[_0x1f2a8e];return _0x4800ab;};'use strict';var multer=require('multer');var util=require(_0x60f9('0x0'));var path=require('path');var timeout=require(_0x60f9('0x1'));var express=require(_0x60f9('0x2'));var router=express[_0x60f9('0x3')]();var auth=require(_0x60f9('0x4'));var interaction=require(_0x60f9('0x5'));var config=require(_0x60f9('0x6'));var controller=require(_0x60f9('0x7'));router[_0x60f9('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x60f9('0x8')](_0x60f9('0x9'),auth[_0x60f9('0xa')](),controller[_0x60f9('0xb')]);router['get']('/:id',auth[_0x60f9('0xa')](),controller['show']);router[_0x60f9('0xc')]('/',auth[_0x60f9('0xa')](),controller[_0x60f9('0xd')]);router[_0x60f9('0xe')]('/:id',auth[_0x60f9('0xa')](),controller[_0x60f9('0xf')]);router[_0x60f9('0x10')](_0x60f9('0x11'),auth[_0x60f9('0xa')](),controller[_0x60f9('0x12')]);module[_0x60f9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 5b9a4b1..de63ca1 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 _0xf271=['TEXT','DATE','INTEGER','sequelize','exports','STRING','inbound','internal','outbound','outbound-fax','dialer'];(function(_0x24d6c1,_0x1fe3e0){var _0x4ceb97=function(_0xc4ab4d){while(--_0xc4ab4d){_0x24d6c1['push'](_0x24d6c1['shift']());}};_0x4ceb97(++_0x1fe3e0);}(_0xf271,0x100));var _0x1f27=function(_0x70dc3f,_0xfc371b){_0x70dc3f=_0x70dc3f-0x0;var _0x447aa4=_0xf271[_0x70dc3f];return _0x447aa4;};'use strict';var Sequelize=require(_0x1f27('0x0'));module[_0x1f27('0x1')]={'uniqueid':{'type':Sequelize[_0x1f27('0x2')]},'type':{'type':Sequelize['ENUM'](_0x1f27('0x3'),_0x1f27('0x4'),_0x1f27('0x5'),'inbound-fax',_0x1f27('0x6'),_0x1f27('0x7'))},'tag':{'type':Sequelize[_0x1f27('0x2')]},'accountcode':{'type':Sequelize[_0x1f27('0x2')]},'source':{'type':Sequelize[_0x1f27('0x2')]},'destination':{'type':Sequelize[_0x1f27('0x2')]},'destinationcontext':{'type':Sequelize[_0x1f27('0x2')]},'callerid':{'type':Sequelize[_0x1f27('0x2')]},'channel':{'type':Sequelize[_0x1f27('0x2')]},'destinationchannel':{'type':Sequelize[_0x1f27('0x2')]},'lastapplication':{'type':Sequelize[_0x1f27('0x2')]},'lastdata':{'type':Sequelize[_0x1f27('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x1f27('0x9')]},'answertime':{'type':Sequelize[_0x1f27('0x9')]},'endtime':{'type':Sequelize[_0x1f27('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x1f27('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1f27('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x1f27('0x2')]},'routeid':{'type':Sequelize[_0x1f27('0xa')]},'sipcallid':{'type':Sequelize[_0x1f27('0x2')]}}; \ No newline at end of file +var _0xbaf9=['INTEGER','sequelize','exports','STRING','inbound-fax','TEXT','DATE'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xbaf9,0x7f));var _0x9baf=function(_0x36b58d,_0x5ad279){_0x36b58d=_0x36b58d-0x0;var _0x4512bc=_0xbaf9[_0x36b58d];return _0x4512bc;};'use strict';var Sequelize=require(_0x9baf('0x0'));module[_0x9baf('0x1')]={'uniqueid':{'type':Sequelize[_0x9baf('0x2')]},'type':{'type':Sequelize['ENUM']('inbound','internal','outbound',_0x9baf('0x3'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x9baf('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x9baf('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x9baf('0x2')]},'lastapplication':{'type':Sequelize[_0x9baf('0x2')]},'lastdata':{'type':Sequelize[_0x9baf('0x4')]},'starttime':{'type':Sequelize[_0x9baf('0x5')]},'systemanswertime':{'type':Sequelize[_0x9baf('0x5')]},'answertime':{'type':Sequelize[_0x9baf('0x5')]},'endtime':{'type':Sequelize[_0x9baf('0x5')]},'duration':{'type':Sequelize[_0x9baf('0x6')]},'billableseconds':{'type':Sequelize[_0x9baf('0x6')]},'mohtime':{'type':Sequelize[_0x9baf('0x6')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9baf('0x2')]},'userfield':{'type':Sequelize[_0x9baf('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9baf('0x2')]},'prefix':{'type':Sequelize[_0x9baf('0x2')]},'routeid':{'type':Sequelize[_0x9baf('0x6')]},'sipcallid':{'type':Sequelize[_0x9baf('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 0030ab3..8a073f0 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 _0xb723=['rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','type','VIRTUAL','field','filter','options','count','then','fullname','alias','User','findAll','rows','catch','params','includeAll','create','body','describe','uniqueid','find','user','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','sendStatus','end','json','offset','limit','status','apply','reject','save','update','destroy','error','stack','name','send','index','VoiceCallReport'];(function(_0x44fc3f,_0x4774d1){var _0x926ba3=function(_0x2af2a9){while(--_0x2af2a9){_0x44fc3f['push'](_0x44fc3f['shift']());}};_0x926ba3(++_0x4774d1);}(_0xb723,0x1a1));var _0x3b72=function(_0x3b6648,_0x2d723a){_0x3b6648=_0x3b6648-0x0;var _0x5a0a0d=_0xb723[_0x3b6648];return _0x5a0a0d;};'use strict';var pdf=require(_0x3b72('0x0'));var emlformat=require(_0x3b72('0x1'));var rimraf=require(_0x3b72('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3b72('0x3'));var moment=require(_0x3b72('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b72('0x5'));var util=require(_0x3b72('0x6'));var path=require(_0x3b72('0x7'));var sox=require('sox');var csv=require(_0x3b72('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b72('0x9'));var squel=require(_0x3b72('0xa'));var crypto=require(_0x3b72('0xb'));var jsforce=require(_0x3b72('0xc'));var deskjs=require(_0x3b72('0xd'));var toCsv=require(_0x3b72('0x8'));var querystring=require(_0x3b72('0xe'));var Papa=require(_0x3b72('0xf'));var authService=require(_0x3b72('0x10'));var hardwareService=require(_0x3b72('0x11'));var Redis=require(_0x3b72('0x12'));var qs=require(_0x3b72('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3b72('0x14'));var config=require(_0x3b72('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4acbf6,_0x286274){_0x286274=_0x286274||0xcc;return function(_0x2d0e59){if(_0x2d0e59){return _0x4acbf6[_0x3b72('0x16')](_0x286274);}return _0x4acbf6['status'](_0x286274)[_0x3b72('0x17')]();};}function respondWithResult(_0x28f0dc,_0x29f3fd){_0x29f3fd=_0x29f3fd||0xc8;return function(_0x1b18d){if(_0x1b18d){return _0x28f0dc['status'](_0x29f3fd)[_0x3b72('0x18')](_0x1b18d);}};}function respondWithFilteredResult(_0x1be3e8,_0x35eede){return function(_0x493895){if(_0x493895){var _0x346f2b=_0x493895['count'],_0x38a841=_0x35eede['offset'],_0x39f8fb=_0x35eede[_0x3b72('0x19')]+_0x35eede[_0x3b72('0x1a')],_0x152a52;if(_0x39f8fb>=_0x346f2b){_0x39f8fb=_0x346f2b;_0x152a52=0xc8;}else{_0x152a52=0xce;}_0x1be3e8[_0x3b72('0x1b')](_0x152a52);return _0x1be3e8['set']('Content-Range',_0x38a841+'-'+_0x39f8fb+'/'+_0x346f2b)['json'](_0x493895);}return null;};}function patchUpdates(_0x18c513){return function(_0x564b40){try{jsonpatch[_0x3b72('0x1c')](_0x564b40,_0x18c513,!![]);}catch(_0x5e1815){return BPromise[_0x3b72('0x1d')](_0x5e1815);}return _0x564b40[_0x3b72('0x1e')]();};}function saveUpdates(_0x261bbf,_0x4024c1){return function(_0x2e8048){if(_0x2e8048){return _0x2e8048[_0x3b72('0x1f')](_0x261bbf)['then'](function(_0x5eaffb){return _0x5eaffb;});}return null;};}function removeEntity(_0x4d9b34,_0xc779a3){return function(_0x3a4c5d){if(_0x3a4c5d){return _0x3a4c5d[_0x3b72('0x20')]()['then'](function(){_0x4d9b34['status'](0xcc)[_0x3b72('0x17')]();});}};}function handleEntityNotFound(_0x14887d,_0x2ae8d9){return function(_0x387043){if(!_0x387043){_0x14887d[_0x3b72('0x16')](0x194);}return _0x387043;};}function handleError(_0x5c1c48,_0x46c5e4){_0x46c5e4=_0x46c5e4||0x1f4;return function(_0x3b47e5){logger[_0x3b72('0x21')](_0x3b47e5[_0x3b72('0x22')]);if(_0x3b47e5[_0x3b72('0x23')]){delete _0x3b47e5[_0x3b72('0x23')];}_0x5c1c48['status'](_0x46c5e4)[_0x3b72('0x24')](_0x3b47e5);};}exports[_0x3b72('0x25')]=function(_0x1d9cd0,_0x3b3cfe){var _0x4da8c5={},_0x40fdb5={},_0x46b912={'count':0x0,'rows':[]};var _0x23795a=db[_0x3b72('0x26')][_0x3b72('0x27')];_0x40fdb5['model']=_['keys'](_0x23795a);_0x40fdb5[_0x3b72('0x28')]=_[_0x3b72('0x29')](_0x1d9cd0['query']);_0x40fdb5[_0x3b72('0x2a')]=_[_0x3b72('0x2b')](_0x40fdb5[_0x3b72('0x2c')],_0x40fdb5[_0x3b72('0x28')]);_0x4da8c5[_0x3b72('0x2d')]=_[_0x3b72('0x2b')](_0x40fdb5['model'],qs[_0x3b72('0x2e')](_0x1d9cd0[_0x3b72('0x28')][_0x3b72('0x2e')]));_0x4da8c5[_0x3b72('0x2d')]=_0x4da8c5[_0x3b72('0x2d')][_0x3b72('0x2f')]?_0x4da8c5[_0x3b72('0x2d')]:_0x40fdb5[_0x3b72('0x2c')];if(!_0x1d9cd0[_0x3b72('0x28')][_0x3b72('0x30')](_0x3b72('0x31'))){_0x4da8c5[_0x3b72('0x1a')]=qs[_0x3b72('0x1a')](_0x1d9cd0[_0x3b72('0x28')]['limit']);_0x4da8c5['offset']=qs[_0x3b72('0x19')](_0x1d9cd0[_0x3b72('0x28')][_0x3b72('0x19')]);}_0x4da8c5[_0x3b72('0x32')]=qs[_0x3b72('0x33')](_0x1d9cd0[_0x3b72('0x28')][_0x3b72('0x33')]);_0x4da8c5[_0x3b72('0x34')]=qs['filters'](_['pick'](_0x1d9cd0[_0x3b72('0x28')],_0x40fdb5[_0x3b72('0x2a')]));if(_0x1d9cd0[_0x3b72('0x28')]['filter']){_0x4da8c5[_0x3b72('0x34')]=_[_0x3b72('0x35')](_0x4da8c5[_0x3b72('0x34')],{'$or':_[_0x3b72('0x36')](_0x23795a,function(_0x108431){if(_0x108431[_0x3b72('0x37')]['key']!==_0x3b72('0x38')){var _0x446edb={};_0x446edb[_0x108431[_0x3b72('0x39')]]={'$like':'%'+_0x1d9cd0['query'][_0x3b72('0x3a')]+'%'};return _0x446edb;}})});}_0x4da8c5=_[_0x3b72('0x35')]({},_0x4da8c5,_0x1d9cd0[_0x3b72('0x3b')]);var _0x258f01={'where':_0x4da8c5[_0x3b72('0x34')]};return db[_0x3b72('0x26')][_0x3b72('0x3c')](_0x258f01)[_0x3b72('0x3d')](function(_0x3ca309){_0x46b912[_0x3b72('0x3c')]=_0x3ca309;if(_0x1d9cd0['query']['includeAll']){_0x4da8c5['include']=[{'attributes':['id',_0x3b72('0x23'),_0x3b72('0x3e'),_0x3b72('0x3f')],'model':db[_0x3b72('0x40')],'as':'User'}];}return db[_0x3b72('0x26')][_0x3b72('0x41')](_0x4da8c5);})[_0x3b72('0x3d')](function(_0x18eecc){_0x46b912[_0x3b72('0x42')]=_0x18eecc;return _0x46b912;})[_0x3b72('0x3d')](respondWithFilteredResult(_0x3b3cfe,_0x4da8c5))[_0x3b72('0x43')](handleError(_0x3b3cfe,null));};exports['show']=function(_0x311421,_0x291d19){var _0xda4b4e={'raw':!![],'where':{'id':_0x311421[_0x3b72('0x44')]['id']}},_0x3bb5e5={};_0x3bb5e5['model']=_[_0x3b72('0x29')](db['VoiceCallReport'][_0x3b72('0x27')]);_0x3bb5e5[_0x3b72('0x28')]=_[_0x3b72('0x29')](_0x311421[_0x3b72('0x28')]);_0x3bb5e5['filters']=_[_0x3b72('0x2b')](_0x3bb5e5[_0x3b72('0x2c')],_0x3bb5e5['query']);_0xda4b4e[_0x3b72('0x2d')]=_[_0x3b72('0x2b')](_0x3bb5e5[_0x3b72('0x2c')],qs[_0x3b72('0x2e')](_0x311421['query'][_0x3b72('0x2e')]));_0xda4b4e[_0x3b72('0x2d')]=_0xda4b4e[_0x3b72('0x2d')][_0x3b72('0x2f')]?_0xda4b4e['attributes']:_0x3bb5e5[_0x3b72('0x2c')];if(_0x311421[_0x3b72('0x28')][_0x3b72('0x45')]){_0xda4b4e['include']=[{'all':!![]}];}_0xda4b4e=_['merge']({},_0xda4b4e,_0x311421[_0x3b72('0x3b')]);return db[_0x3b72('0x26')]['find'](_0xda4b4e)[_0x3b72('0x3d')](handleEntityNotFound(_0x291d19,null))['then'](respondWithResult(_0x291d19,null))[_0x3b72('0x43')](handleError(_0x291d19,null));};exports[_0x3b72('0x46')]=function(_0x4ffc6a,_0x4fca70){return db['VoiceCallReport'][_0x3b72('0x46')](_0x4ffc6a[_0x3b72('0x47')],{})[_0x3b72('0x3d')](respondWithResult(_0x4fca70,0xc9))['catch'](handleError(_0x4fca70,null));};exports['destroy']=function(_0x26b6f0,_0x3325a5){return db[_0x3b72('0x26')]['find']({'where':{'id':_0x26b6f0[_0x3b72('0x44')]['id']}})[_0x3b72('0x3d')](handleEntityNotFound(_0x3325a5,null))[_0x3b72('0x3d')](removeEntity(_0x3325a5,null))[_0x3b72('0x43')](handleError(_0x3325a5,null));};exports[_0x3b72('0x48')]=function(_0x14e151,_0x507b26){return db[_0x3b72('0x26')]['describe']()[_0x3b72('0x3d')](respondWithResult(_0x507b26,null))[_0x3b72('0x43')](handleError(_0x507b26,null));};exports[_0x3b72('0x1f')]=function(_0x339bb7,_0x2580d3){if(_0x339bb7['body'][_0x3b72('0x49')]){delete _0x339bb7[_0x3b72('0x47')][_0x3b72('0x49')];}return db[_0x3b72('0x26')][_0x3b72('0x4a')]({'where':{'uniqueid':_0x339bb7['params']['id'],'UserId':{'$or':[null,_0x339bb7[_0x3b72('0x4b')]['id']]}}})[_0x3b72('0x3d')](handleEntityNotFound(_0x2580d3,null))[_0x3b72('0x3d')](saveUpdates(_0x339bb7[_0x3b72('0x47')],null))['then'](respondWithResult(_0x2580d3,null))[_0x3b72('0x43')](handleError(_0x2580d3,null));}; \ No newline at end of file +var _0x622e=['request-promise','moment','bluebird','mustache','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','limit','set','Content-Range','apply','reject','save','update','then','status','error','stack','name','send','VoiceCallReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','map','VIRTUAL','field','options','include','fullname','alias','User','findAll','rows','show','params','includeAll','catch','create','body','destroy','describe','uniqueid','user','html-pdf','eml-format','fast-json-patch'];(function(_0x2bdebb,_0x4c906f){var _0x4ceea3=function(_0x3d0cf0){while(--_0x3d0cf0){_0x2bdebb['push'](_0x2bdebb['shift']());}};_0x4ceea3(++_0x4c906f);}(_0x622e,0x131));var _0xe622=function(_0x2cada4,_0x5007f8){_0x2cada4=_0x2cada4-0x0;var _0x9b6d2e=_0x622e[_0x2cada4];return _0x9b6d2e;};'use strict';var pdf=require(_0xe622('0x0'));var emlformat=require(_0xe622('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe622('0x2'));var rp=require(_0xe622('0x3'));var moment=require(_0xe622('0x4'));var BPromise=require(_0xe622('0x5'));var Mustache=require(_0xe622('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe622('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe622('0x8'));var squel=require(_0xe622('0x9'));var crypto=require(_0xe622('0xa'));var jsforce=require(_0xe622('0xb'));var deskjs=require(_0xe622('0xc'));var toCsv=require(_0xe622('0xd'));var querystring=require(_0xe622('0xe'));var Papa=require(_0xe622('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0xe622('0x10'));var Redis=require(_0xe622('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0xe622('0x12'))(_0xe622('0x13'));var utils=require(_0xe622('0x14'));var config=require(_0xe622('0x15'));var db=require(_0xe622('0x16'))['db'];function respondWithStatusCode(_0x47a25c,_0x1318b2){_0x1318b2=_0x1318b2||0xcc;return function(_0x550194){if(_0x550194){return _0x47a25c[_0xe622('0x17')](_0x1318b2);}return _0x47a25c['status'](_0x1318b2)[_0xe622('0x18')]();};}function respondWithResult(_0x4fa3bb,_0x10ac23){_0x10ac23=_0x10ac23||0xc8;return function(_0x33f105){if(_0x33f105){return _0x4fa3bb['status'](_0x10ac23)['json'](_0x33f105);}};}function respondWithFilteredResult(_0x45e6ea,_0x175e85){return function(_0x377d8a){if(_0x377d8a){var _0x1a2ab2=_0x377d8a[_0xe622('0x19')],_0x2ffca4=_0x175e85['offset'],_0x1d7bb6=_0x175e85['offset']+_0x175e85[_0xe622('0x1a')],_0x1f3a93;if(_0x1d7bb6>=_0x1a2ab2){_0x1d7bb6=_0x1a2ab2;_0x1f3a93=0xc8;}else{_0x1f3a93=0xce;}_0x45e6ea['status'](_0x1f3a93);return _0x45e6ea[_0xe622('0x1b')](_0xe622('0x1c'),_0x2ffca4+'-'+_0x1d7bb6+'/'+_0x1a2ab2)['json'](_0x377d8a);}return null;};}function patchUpdates(_0xbf1e86){return function(_0x587f26){try{jsonpatch[_0xe622('0x1d')](_0x587f26,_0xbf1e86,!![]);}catch(_0x23e9ad){return BPromise[_0xe622('0x1e')](_0x23e9ad);}return _0x587f26[_0xe622('0x1f')]();};}function saveUpdates(_0x4e0860,_0xb95b1a){return function(_0x13db6b){if(_0x13db6b){return _0x13db6b[_0xe622('0x20')](_0x4e0860)[_0xe622('0x21')](function(_0x55d3fa){return _0x55d3fa;});}return null;};}function removeEntity(_0x399dad,_0x50faed){return function(_0x34eba){if(_0x34eba){return _0x34eba['destroy']()[_0xe622('0x21')](function(){_0x399dad[_0xe622('0x22')](0xcc)[_0xe622('0x18')]();});}};}function handleEntityNotFound(_0x128277,_0x29d1db){return function(_0x53e79c){if(!_0x53e79c){_0x128277[_0xe622('0x17')](0x194);}return _0x53e79c;};}function handleError(_0x282c54,_0x563ad1){_0x563ad1=_0x563ad1||0x1f4;return function(_0x598d65){logger[_0xe622('0x23')](_0x598d65[_0xe622('0x24')]);if(_0x598d65[_0xe622('0x25')]){delete _0x598d65[_0xe622('0x25')];}_0x282c54[_0xe622('0x22')](_0x563ad1)[_0xe622('0x26')](_0x598d65);};}exports['index']=function(_0x4e1f56,_0x490ff0){var _0x9117e8={},_0x26ecd2={},_0x4e25cf={'count':0x0,'rows':[]};var _0x1d8d79=db[_0xe622('0x27')][_0xe622('0x28')];_0x26ecd2[_0xe622('0x29')]=_[_0xe622('0x2a')](_0x1d8d79);_0x26ecd2[_0xe622('0x2b')]=_[_0xe622('0x2a')](_0x4e1f56[_0xe622('0x2b')]);_0x26ecd2[_0xe622('0x2c')]=_[_0xe622('0x2d')](_0x26ecd2[_0xe622('0x29')],_0x26ecd2[_0xe622('0x2b')]);_0x9117e8[_0xe622('0x2e')]=_[_0xe622('0x2d')](_0x26ecd2[_0xe622('0x29')],qs[_0xe622('0x2f')](_0x4e1f56[_0xe622('0x2b')]['fields']));_0x9117e8['attributes']=_0x9117e8[_0xe622('0x2e')][_0xe622('0x30')]?_0x9117e8[_0xe622('0x2e')]:_0x26ecd2[_0xe622('0x29')];if(!_0x4e1f56[_0xe622('0x2b')][_0xe622('0x31')](_0xe622('0x32'))){_0x9117e8['limit']=qs[_0xe622('0x1a')](_0x4e1f56[_0xe622('0x2b')][_0xe622('0x1a')]);_0x9117e8[_0xe622('0x33')]=qs[_0xe622('0x33')](_0x4e1f56[_0xe622('0x2b')][_0xe622('0x33')]);}_0x9117e8['order']=qs[_0xe622('0x34')](_0x4e1f56[_0xe622('0x2b')]['sort']);_0x9117e8[_0xe622('0x35')]=qs[_0xe622('0x2c')](_[_0xe622('0x36')](_0x4e1f56[_0xe622('0x2b')],_0x26ecd2[_0xe622('0x2c')]));if(_0x4e1f56['query'][_0xe622('0x37')]){_0x9117e8[_0xe622('0x35')]=_[_0xe622('0x38')](_0x9117e8[_0xe622('0x35')],{'$or':_[_0xe622('0x39')](_0x1d8d79,function(_0x282ce5){if(_0x282ce5['type']['key']!==_0xe622('0x3a')){var _0x342c6b={};_0x342c6b[_0x282ce5[_0xe622('0x3b')]]={'$like':'%'+_0x4e1f56[_0xe622('0x2b')][_0xe622('0x37')]+'%'};return _0x342c6b;}})});}_0x9117e8=_['merge']({},_0x9117e8,_0x4e1f56[_0xe622('0x3c')]);var _0x2b80f9={'where':_0x9117e8[_0xe622('0x35')]};return db[_0xe622('0x27')][_0xe622('0x19')](_0x2b80f9)['then'](function(_0x4c059f){_0x4e25cf[_0xe622('0x19')]=_0x4c059f;if(_0x4e1f56[_0xe622('0x2b')]['includeAll']){_0x9117e8[_0xe622('0x3d')]=[{'attributes':['id','name',_0xe622('0x3e'),_0xe622('0x3f')],'model':db[_0xe622('0x40')],'as':_0xe622('0x40')}];}return db[_0xe622('0x27')][_0xe622('0x41')](_0x9117e8);})[_0xe622('0x21')](function(_0x25f1fe){_0x4e25cf[_0xe622('0x42')]=_0x25f1fe;return _0x4e25cf;})[_0xe622('0x21')](respondWithFilteredResult(_0x490ff0,_0x9117e8))['catch'](handleError(_0x490ff0,null));};exports[_0xe622('0x43')]=function(_0x3765a2,_0x3e9bd2){var _0xc01a9b={'raw':!![],'where':{'id':_0x3765a2[_0xe622('0x44')]['id']}},_0x1f6c54={};_0x1f6c54[_0xe622('0x29')]=_[_0xe622('0x2a')](db[_0xe622('0x27')]['rawAttributes']);_0x1f6c54[_0xe622('0x2b')]=_[_0xe622('0x2a')](_0x3765a2[_0xe622('0x2b')]);_0x1f6c54[_0xe622('0x2c')]=_['intersection'](_0x1f6c54['model'],_0x1f6c54['query']);_0xc01a9b[_0xe622('0x2e')]=_[_0xe622('0x2d')](_0x1f6c54[_0xe622('0x29')],qs[_0xe622('0x2f')](_0x3765a2[_0xe622('0x2b')][_0xe622('0x2f')]));_0xc01a9b[_0xe622('0x2e')]=_0xc01a9b['attributes'][_0xe622('0x30')]?_0xc01a9b['attributes']:_0x1f6c54[_0xe622('0x29')];if(_0x3765a2[_0xe622('0x2b')][_0xe622('0x45')]){_0xc01a9b[_0xe622('0x3d')]=[{'all':!![]}];}_0xc01a9b=_[_0xe622('0x38')]({},_0xc01a9b,_0x3765a2[_0xe622('0x3c')]);return db[_0xe622('0x27')]['find'](_0xc01a9b)[_0xe622('0x21')](handleEntityNotFound(_0x3e9bd2,null))[_0xe622('0x21')](respondWithResult(_0x3e9bd2,null))[_0xe622('0x46')](handleError(_0x3e9bd2,null));};exports[_0xe622('0x47')]=function(_0x1c4d5f,_0x2e7246){return db['VoiceCallReport'][_0xe622('0x47')](_0x1c4d5f[_0xe622('0x48')],{})[_0xe622('0x21')](respondWithResult(_0x2e7246,0xc9))[_0xe622('0x46')](handleError(_0x2e7246,null));};exports[_0xe622('0x49')]=function(_0x18e35f,_0x29e180){return db[_0xe622('0x27')]['find']({'where':{'id':_0x18e35f['params']['id']}})[_0xe622('0x21')](handleEntityNotFound(_0x29e180,null))['then'](removeEntity(_0x29e180,null))['catch'](handleError(_0x29e180,null));};exports[_0xe622('0x4a')]=function(_0x1c3d10,_0x5e800f){return db[_0xe622('0x27')]['describe']()[_0xe622('0x21')](respondWithResult(_0x5e800f,null))[_0xe622('0x46')](handleError(_0x5e800f,null));};exports[_0xe622('0x20')]=function(_0x8acce4,_0x379a72){if(_0x8acce4[_0xe622('0x48')][_0xe622('0x4b')]){delete _0x8acce4[_0xe622('0x48')][_0xe622('0x4b')];}return db[_0xe622('0x27')]['find']({'where':{'uniqueid':_0x8acce4[_0xe622('0x44')]['id'],'UserId':{'$or':[null,_0x8acce4[_0xe622('0x4c')]['id']]}}})['then'](handleEntityNotFound(_0x379a72,null))['then'](saveUpdates(_0x8acce4[_0xe622('0x48')],null))[_0xe622('0x21')](respondWithResult(_0x379a72,null))[_0xe622('0x46')](handleError(_0x379a72,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 529ac13..c5bd302 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 _0x8328=['report_call','uniqueid','../../config/logger','api','moment','bluebird','request-promise','./voiceCallReport.attributes','define','VoiceCallReport'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x8328,0x1c4));var _0x8832=function(_0x590072,_0x48fa47){_0x590072=_0x590072-0x0;var _0xb19be1=_0x8328[_0x590072];return _0xb19be1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8832('0x0'))(_0x8832('0x1'));var moment=require(_0x8832('0x2'));var BPromise=require(_0x8832('0x3'));var rp=require(_0x8832('0x4'));var attributes=require(_0x8832('0x5'));module['exports']=function(_0x2ada68,_0x47bc0e){return _0x2ada68[_0x8832('0x6')](_0x8832('0x7'),attributes,{'tableName':_0x8832('0x8'),'paranoid':![],'indexes':[{'fields':[_0x8832('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x73ac=['define','VoiceCallReport','report_call','uniqueid','util','bluebird','request-promise','./voiceCallReport.attributes','exports'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x73ac,0x12d));var _0xc73a=function(_0x32641c,_0x20e8b9){_0x32641c=_0x32641c-0x0;var _0x76cf9e=_0x73ac[_0x32641c];return _0x76cf9e;};'use strict';var _=require('lodash');var util=require(_0xc73a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc73a('0x1'));var rp=require(_0xc73a('0x2'));var attributes=require(_0xc73a('0x3'));module[_0xc73a('0x4')]=function(_0x1df80f,_0x542eb6){return _0x1df80f[_0xc73a('0x5')](_0xc73a('0x6'),attributes,{'tableName':_0xc73a('0x7'),'paranoid':![],'indexes':[{'fields':[_0xc73a('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ba72135..7c40188 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 _0xd003=['options','raw','where','attributes','include','map','model','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd003,0xde));var _0x3d00=function(_0x49a59c,_0x4aeb8f){_0x49a59c=_0x49a59c-0x0;var _0x242495=_0xd003[_0x49a59c];return _0x242495;};'use strict';var _=require(_0x3d00('0x0'));var util=require(_0x3d00('0x1'));var moment=require(_0x3d00('0x2'));var BPromise=require(_0x3d00('0x3'));var rs=require(_0x3d00('0x4'));var fs=require('fs');var Redis=require(_0x3d00('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3d00('0x6'))('rpc');var config=require(_0x3d00('0x7'));var jayson=require(_0x3d00('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e0535,_0x5bc14e,_0x29359f){return new BPromise(function(_0x11f993,_0x325669){return client['request'](_0x5e0535,_0x29359f)[_0x3d00('0x9')](function(_0x3ca0d0){logger[_0x3d00('0xa')](_0x3d00('0xb'),_0x5bc14e,'request\x20sent');logger[_0x3d00('0xc')](_0x3d00('0xd'),_0x5bc14e,_0x3d00('0xe'),JSON[_0x3d00('0xf')](_0x3ca0d0));if(_0x3ca0d0['error']){if(_0x3ca0d0[_0x3d00('0x10')][_0x3d00('0x11')]===0x1f4){logger[_0x3d00('0x10')](_0x3d00('0xb'),_0x5bc14e,_0x3ca0d0[_0x3d00('0x10')]['message']);return _0x325669(_0x3ca0d0[_0x3d00('0x10')]['message']);}logger[_0x3d00('0x10')](_0x3d00('0xb'),_0x5bc14e,_0x3ca0d0[_0x3d00('0x10')]['message']);return _0x11f993(_0x3ca0d0[_0x3d00('0x10')]['message']);}else{logger[_0x3d00('0xa')](_0x3d00('0xb'),_0x5bc14e,_0x3d00('0xe'));_0x11f993(_0x3ca0d0['result'][_0x3d00('0x12')]);}})[_0x3d00('0x13')](function(_0x31ab8d){logger[_0x3d00('0x10')](_0x3d00('0xb'),_0x5bc14e,_0x31ab8d);_0x325669(_0x31ab8d);});});}exports[_0x3d00('0x14')]=function(_0x4d44ef){var _0x37b0e6=this;return new Promise(function(_0x1943ba,_0x37116c){return db[_0x3d00('0x15')][_0x3d00('0x16')]({'raw':_0x4d44ef['options']?_0x4d44ef[_0x3d00('0x17')][_0x3d00('0x18')]===undefined?!![]:![]:!![],'where':_0x4d44ef[_0x3d00('0x17')]?_0x4d44ef[_0x3d00('0x17')][_0x3d00('0x19')]||null:null,'attributes':_0x4d44ef[_0x3d00('0x17')]?_0x4d44ef['options'][_0x3d00('0x1a')]||null:null,'limit':_0x4d44ef[_0x3d00('0x17')]?_0x4d44ef[_0x3d00('0x17')]['limit']||null:null,'include':_0x4d44ef[_0x3d00('0x17')]?_0x4d44ef[_0x3d00('0x17')][_0x3d00('0x1b')]?_[_0x3d00('0x1c')](_0x4d44ef['options'][_0x3d00('0x1b')],function(_0x421322){return{'model':db[_0x421322[_0x3d00('0x1d')]],'as':_0x421322['as'],'attributes':_0x421322['attributes'],'include':_0x421322[_0x3d00('0x1b')]?_['map'](_0x421322['include'],function(_0x1e637d){return{'model':db[_0x1e637d[_0x3d00('0x1d')]],'as':_0x1e637d['as'],'attributes':_0x1e637d[_0x3d00('0x1a')],'include':_0x1e637d[_0x3d00('0x1b')]?_['map'](_0x1e637d[_0x3d00('0x1b')],function(_0x54ca47){return{'model':db[_0x54ca47[_0x3d00('0x1d')]],'as':_0x54ca47['as'],'attributes':_0x54ca47['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d00('0x9')](function(_0x56b6de){logger[_0x3d00('0xa')](_0x3d00('0x14'),_0x4d44ef);logger['debug'](_0x3d00('0x14'),_0x4d44ef,JSON[_0x3d00('0xf')](_0x56b6de));_0x1943ba(_0x56b6de);})['catch'](function(_0x4d3bd9){logger[_0x3d00('0x10')]('GetVoiceCallReport',_0x4d3bd9['message'],_0x4d44ef);_0x37116c(_0x37b0e6['error'](0x1f4,_0x4d3bd9[_0x3d00('0x12')]));});});};exports[_0x3d00('0x1e')]=function(_0x1bb5f3){var _0x571fc5=this;return new Promise(function(_0x48e780,_0x272e59){return db[_0x3d00('0x15')]['create'](_0x1bb5f3[_0x3d00('0x1f')],{'raw':_0x1bb5f3[_0x3d00('0x17')]?_0x1bb5f3[_0x3d00('0x17')][_0x3d00('0x18')]===undefined?!![]:![]:!![]})[_0x3d00('0x9')](function(_0x2d6fa1){logger[_0x3d00('0xa')](_0x3d00('0x1e'),_0x1bb5f3);logger[_0x3d00('0xc')](_0x3d00('0x1e'),_0x1bb5f3,JSON[_0x3d00('0xf')](_0x2d6fa1));_0x48e780(_0x2d6fa1);})[_0x3d00('0x13')](function(_0x55087c){logger[_0x3d00('0x10')](_0x3d00('0x1e'),_0x55087c[_0x3d00('0x12')],_0x1bb5f3);_0x272e59(_0x571fc5[_0x3d00('0x10')](0x1f4,_0x55087c['message']));});});};exports[_0x3d00('0x20')]=function(_0x571cf4){var _0x55e92c=this;return new Promise(function(_0x369495,_0x83fca7){return db[_0x3d00('0x15')][_0x3d00('0x21')](_0x571cf4[_0x3d00('0x1f')],{'raw':_0x571cf4[_0x3d00('0x17')]?_0x571cf4[_0x3d00('0x17')][_0x3d00('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x571cf4[_0x3d00('0x17')]?_0x571cf4['options']['where']||null:null,'attributes':_0x571cf4[_0x3d00('0x17')]?_0x571cf4[_0x3d00('0x17')]['attributes']||null:null,'limit':_0x571cf4[_0x3d00('0x17')]?_0x571cf4[_0x3d00('0x17')][_0x3d00('0x22')]||null:null})[_0x3d00('0x9')](function(_0x531420){logger[_0x3d00('0xa')]('UpdateVoiceCallReport',_0x571cf4);logger[_0x3d00('0xc')](_0x3d00('0x20'),_0x571cf4,JSON['stringify'](_0x531420));_0x369495(_0x531420);})[_0x3d00('0x13')](function(_0x104286){logger[_0x3d00('0x10')]('UpdateVoiceCallReport',_0x104286[_0x3d00('0x12')],_0x571cf4);_0x83fca7(_0x55e92c[_0x3d00('0x10')](0x1f4,_0x104286['message']));});});}; \ No newline at end of file +var _0x7d25=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','create','body','then','CreateVoiceCallReport','update','UpdateVoiceCallReport','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x194f9a,_0xe8ab5b){var _0x183bb2=function(_0x27737f){while(--_0x27737f){_0x194f9a['push'](_0x194f9a['shift']());}};_0x183bb2(++_0xe8ab5b);}(_0x7d25,0x177));var _0x57d2=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x7d25[_0x500419];return _0x241c1a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x57d2('0x0'));var BPromise=require('bluebird');var rs=require(_0x57d2('0x1'));var fs=require('fs');var Redis=require(_0x57d2('0x2'));var db=require(_0x57d2('0x3'))['db'];var utils=require(_0x57d2('0x4'));var logger=require(_0x57d2('0x5'))(_0x57d2('0x6'));var config=require(_0x57d2('0x7'));var jayson=require(_0x57d2('0x8'));var client=jayson['client'][_0x57d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f1dd8,_0x122d83,_0x352741){return new BPromise(function(_0x3e8ac9,_0x1632b6){return client['request'](_0x3f1dd8,_0x352741)['then'](function(_0x115d1d){logger[_0x57d2('0xa')](_0x57d2('0xb'),_0x122d83,_0x57d2('0xc'));logger['debug'](_0x57d2('0xd'),_0x122d83,'request\x20sent',JSON[_0x57d2('0xe')](_0x115d1d));if(_0x115d1d[_0x57d2('0xf')]){if(_0x115d1d[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger['error'](_0x57d2('0xb'),_0x122d83,_0x115d1d['error'][_0x57d2('0x11')]);return _0x1632b6(_0x115d1d[_0x57d2('0xf')]['message']);}logger[_0x57d2('0xf')](_0x57d2('0xb'),_0x122d83,_0x115d1d[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x3e8ac9(_0x115d1d[_0x57d2('0xf')]['message']);}else{logger[_0x57d2('0xa')](_0x57d2('0xb'),_0x122d83,_0x57d2('0xc'));_0x3e8ac9(_0x115d1d[_0x57d2('0x12')][_0x57d2('0x11')]);}})['catch'](function(_0x9cd2b2){logger['error'](_0x57d2('0xb'),_0x122d83,_0x9cd2b2);_0x1632b6(_0x9cd2b2);});});}exports[_0x57d2('0x13')]=function(_0x39c099){var _0x298e22=this;return new Promise(function(_0xe8b091,_0x128cc5){return db[_0x57d2('0x14')][_0x57d2('0x15')]({'raw':_0x39c099[_0x57d2('0x16')]?_0x39c099[_0x57d2('0x16')][_0x57d2('0x17')]===undefined?!![]:![]:!![],'where':_0x39c099['options']?_0x39c099['options'][_0x57d2('0x18')]||null:null,'attributes':_0x39c099[_0x57d2('0x16')]?_0x39c099[_0x57d2('0x16')][_0x57d2('0x19')]||null:null,'limit':_0x39c099['options']?_0x39c099[_0x57d2('0x16')][_0x57d2('0x1a')]||null:null,'include':_0x39c099[_0x57d2('0x16')]?_0x39c099[_0x57d2('0x16')][_0x57d2('0x1b')]?_[_0x57d2('0x1c')](_0x39c099['options'][_0x57d2('0x1b')],function(_0x5ea78a){return{'model':db[_0x5ea78a[_0x57d2('0x1d')]],'as':_0x5ea78a['as'],'attributes':_0x5ea78a[_0x57d2('0x19')],'include':_0x5ea78a[_0x57d2('0x1b')]?_[_0x57d2('0x1c')](_0x5ea78a[_0x57d2('0x1b')],function(_0x2766c1){return{'model':db[_0x2766c1[_0x57d2('0x1d')]],'as':_0x2766c1['as'],'attributes':_0x2766c1[_0x57d2('0x19')],'include':_0x2766c1[_0x57d2('0x1b')]?_['map'](_0x2766c1[_0x57d2('0x1b')],function(_0x337f41){return{'model':db[_0x337f41[_0x57d2('0x1d')]],'as':_0x337f41['as'],'attributes':_0x337f41[_0x57d2('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x533868){logger['info'](_0x57d2('0x13'),_0x39c099);logger[_0x57d2('0x1e')](_0x57d2('0x13'),_0x39c099,JSON[_0x57d2('0xe')](_0x533868));_0xe8b091(_0x533868);})[_0x57d2('0x1f')](function(_0x3b473b){logger[_0x57d2('0xf')](_0x57d2('0x13'),_0x3b473b[_0x57d2('0x11')],_0x39c099);_0x128cc5(_0x298e22[_0x57d2('0xf')](0x1f4,_0x3b473b['message']));});});};exports['CreateVoiceCallReport']=function(_0xdd1e3f){var _0x12d23f=this;return new Promise(function(_0x28c3ee,_0x1e56fa){return db[_0x57d2('0x14')][_0x57d2('0x20')](_0xdd1e3f[_0x57d2('0x21')],{'raw':_0xdd1e3f[_0x57d2('0x16')]?_0xdd1e3f[_0x57d2('0x16')][_0x57d2('0x17')]===undefined?!![]:![]:!![]})[_0x57d2('0x22')](function(_0x271c5d){logger[_0x57d2('0xa')]('CreateVoiceCallReport',_0xdd1e3f);logger[_0x57d2('0x1e')](_0x57d2('0x23'),_0xdd1e3f,JSON[_0x57d2('0xe')](_0x271c5d));_0x28c3ee(_0x271c5d);})[_0x57d2('0x1f')](function(_0x234919){logger[_0x57d2('0xf')](_0x57d2('0x23'),_0x234919[_0x57d2('0x11')],_0xdd1e3f);_0x1e56fa(_0x12d23f[_0x57d2('0xf')](0x1f4,_0x234919[_0x57d2('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x5f2f8e){var _0x22e810=this;return new Promise(function(_0x5aa4bd,_0x386bbd){return db['VoiceCallReport'][_0x57d2('0x24')](_0x5f2f8e['body'],{'raw':_0x5f2f8e[_0x57d2('0x16')]?_0x5f2f8e[_0x57d2('0x16')][_0x57d2('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f2f8e[_0x57d2('0x16')]?_0x5f2f8e[_0x57d2('0x16')]['where']||null:null,'attributes':_0x5f2f8e[_0x57d2('0x16')]?_0x5f2f8e[_0x57d2('0x16')][_0x57d2('0x19')]||null:null,'limit':_0x5f2f8e[_0x57d2('0x16')]?_0x5f2f8e['options'][_0x57d2('0x1a')]||null:null})['then'](function(_0x2f7ff4){logger[_0x57d2('0xa')](_0x57d2('0x25'),_0x5f2f8e);logger[_0x57d2('0x1e')](_0x57d2('0x25'),_0x5f2f8e,JSON[_0x57d2('0xe')](_0x2f7ff4));_0x5aa4bd(_0x2f7ff4);})[_0x57d2('0x1f')](function(_0x269aec){logger[_0x57d2('0xf')](_0x57d2('0x25'),_0x269aec[_0x57d2('0x11')],_0x5f2f8e);_0x386bbd(_0x22e810[_0x57d2('0xf')](0x1f4,_0x269aec[_0x57d2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 835bfe4..a1ba7a4 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 _0x4427=['./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0x4427,0x12b));var _0x7442=function(_0x3da1c5,_0x53f43f){_0x3da1c5=_0x3da1c5-0x0;var _0x20d262=_0x4427[_0x3da1c5];return _0x20d262;};'use strict';var multer=require(_0x7442('0x0'));var util=require(_0x7442('0x1'));var path=require(_0x7442('0x2'));var timeout=require('connect-timeout');var express=require(_0x7442('0x3'));var router=express[_0x7442('0x4')]();var auth=require(_0x7442('0x5'));var interaction=require(_0x7442('0x6'));var config=require('../../config/environment');var controller=require(_0x7442('0x7'));router[_0x7442('0x8')]('/',auth[_0x7442('0x9')](),controller[_0x7442('0xa')]);router[_0x7442('0x8')](_0x7442('0xb'),auth[_0x7442('0x9')](),controller['show']);router[_0x7442('0xc')]('/',auth[_0x7442('0x9')](),controller[_0x7442('0xd')]);router[_0x7442('0xe')](_0x7442('0xb'),auth[_0x7442('0x9')](),controller[_0x7442('0xf')]);router[_0x7442('0x10')](_0x7442('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7442('0x11')]=router; \ No newline at end of file +var _0xa077=['isAuthenticated','index','/:id','show','post','create','put','update','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x26da5e,_0x2f4830){var _0x19932c=function(_0x681c95){while(--_0x681c95){_0x26da5e['push'](_0x26da5e['shift']());}};_0x19932c(++_0x2f4830);}(_0xa077,0xb8));var _0x7a07=function(_0x2d5c39,_0x1ae130){_0x2d5c39=_0x2d5c39-0x0;var _0x1a2a1a=_0xa077[_0x2d5c39];return _0x1a2a1a;};'use strict';var multer=require(_0x7a07('0x0'));var util=require('util');var path=require(_0x7a07('0x1'));var timeout=require(_0x7a07('0x2'));var express=require(_0x7a07('0x3'));var router=express[_0x7a07('0x4')]();var auth=require(_0x7a07('0x5'));var interaction=require(_0x7a07('0x6'));var config=require(_0x7a07('0x7'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x7a07('0x8')](),controller[_0x7a07('0x9')]);router['get'](_0x7a07('0xa'),auth[_0x7a07('0x8')](),controller[_0x7a07('0xb')]);router[_0x7a07('0xc')]('/',auth[_0x7a07('0x8')](),controller[_0x7a07('0xd')]);router[_0x7a07('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7a07('0xf')]);router['delete'](_0x7a07('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1099a72..f1a950b 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 _0x1111=['BOOLEAN','exports','STRING','name','setDataValue','options','join','split'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1111,0x111));var _0x1111=function(_0x4f5976,_0x2e61b8){_0x4f5976=_0x4f5976-0x0;var _0xda14d=_0x1111[_0x4f5976];return _0xda14d;};'use strict';var Sequelize=require('sequelize');module[_0x1111('0x0')]={'name':{'type':Sequelize[_0x1111('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x1111('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x1111('0x1')],'set':function(_0x384d36){this[_0x1111('0x3')](_0x1111('0x4'),_0x384d36?_0x384d36[_0x1111('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x1111('0x4'))?this['getDataValue'](_0x1111('0x4'))[_0x1111('0x6')](''):[];}},'auth':{'type':Sequelize[_0x1111('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x1111('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1111('0x1')]},'description':{'type':Sequelize[_0x1111('0x1')]}}; \ No newline at end of file +var _0xf29c=['setDataValue','getDataValue','options','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x3c6a3b,_0x362ae6){var _0x1c474e=function(_0x2d5cb6){while(--_0x2d5cb6){_0x3c6a3b['push'](_0x3c6a3b['shift']());}};_0x1c474e(++_0x362ae6);}(_0xf29c,0x64));var _0xcf29=function(_0x3f842f,_0x2cac87){_0x3f842f=_0x3f842f-0x0;var _0x4f4f30=_0xf29c[_0x3f842f];return _0x4f4f30;};'use strict';var Sequelize=require(_0xcf29('0x0'));module[_0xcf29('0x1')]={'name':{'type':Sequelize[_0xcf29('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xcf29('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xcf29('0x2')],'set':function(_0x40e922){this[_0xcf29('0x4')]('options',_0x40e922?_0x40e922['join'](''):[]);},'get':function(){return this[_0xcf29('0x5')](_0xcf29('0x6'))?this['getDataValue'](_0xcf29('0x6'))['split'](''):[];}},'auth':{'type':Sequelize[_0xcf29('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xcf29('0x2')]},'record':{'type':Sequelize[_0xcf29('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcf29('0x2')]},'description':{'type':Sequelize[_0xcf29('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 80a70e0..7af91dc 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 _0x1aa7=['../../config/utils','sendStatus','status','json','offset','limit','Content-Range','apply','save','then','get','ChanSpies','UserProfileResource','destroy','end','error','stack','name','index','VoiceChanSpy','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','update','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x4a3b18,_0x309e56){var _0x463476=function(_0x2891e9){while(--_0x2891e9){_0x4a3b18['push'](_0x4a3b18['shift']());}};_0x463476(++_0x309e56);}(_0x1aa7,0x172));var _0x71aa=function(_0xb5de59,_0x25fcc9){_0xb5de59=_0xb5de59-0x0;var _0x35a7b1=_0x1aa7[_0xb5de59];return _0x35a7b1;};'use strict';var pdf=require(_0x71aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x71aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x71aa('0x2'));var moment=require(_0x71aa('0x3'));var BPromise=require(_0x71aa('0x4'));var Mustache=require(_0x71aa('0x5'));var util=require(_0x71aa('0x6'));var path=require(_0x71aa('0x7'));var sox=require('sox');var csv=require(_0x71aa('0x8'));var ejs=require(_0x71aa('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x71aa('0xa'));var jsforce=require(_0x71aa('0xb'));var deskjs=require(_0x71aa('0xc'));var toCsv=require(_0x71aa('0x8'));var querystring=require('querystring');var Papa=require(_0x71aa('0xd'));var authService=require(_0x71aa('0xe'));var hardwareService=require(_0x71aa('0xf'));var Redis=require(_0x71aa('0x10'));var qs=require(_0x71aa('0x11'));var logger=require(_0x71aa('0x12'))(_0x71aa('0x13'));var utils=require(_0x71aa('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5815d0,_0x5c884e){_0x5c884e=_0x5c884e||0xcc;return function(_0x118115){if(_0x118115){return _0x5815d0[_0x71aa('0x15')](_0x5c884e);}return _0x5815d0['status'](_0x5c884e)['end']();};}function respondWithResult(_0xbd0090,_0x3356cb){_0x3356cb=_0x3356cb||0xc8;return function(_0x27a400){if(_0x27a400){return _0xbd0090[_0x71aa('0x16')](_0x3356cb)[_0x71aa('0x17')](_0x27a400);}};}function respondWithFilteredResult(_0x141928,_0x12617f){return function(_0x4a9d0f){if(_0x4a9d0f){var _0x229ba6=_0x4a9d0f['count'],_0xcc7e6f=_0x12617f[_0x71aa('0x18')],_0x8ba631=_0x12617f[_0x71aa('0x18')]+_0x12617f[_0x71aa('0x19')],_0x582a92;if(_0x8ba631>=_0x229ba6){_0x8ba631=_0x229ba6;_0x582a92=0xc8;}else{_0x582a92=0xce;}_0x141928[_0x71aa('0x16')](_0x582a92);return _0x141928['set'](_0x71aa('0x1a'),_0xcc7e6f+'-'+_0x8ba631+'/'+_0x229ba6)[_0x71aa('0x17')](_0x4a9d0f);}return null;};}function patchUpdates(_0x2807a0){return function(_0x39a512){try{jsonpatch[_0x71aa('0x1b')](_0x39a512,_0x2807a0,!![]);}catch(_0x85816b){return BPromise['reject'](_0x85816b);}return _0x39a512[_0x71aa('0x1c')]();};}function saveUpdates(_0x3773f6,_0x3e0ad8){return function(_0x3927e8){if(_0x3927e8){return _0x3927e8['update'](_0x3773f6)[_0x71aa('0x1d')](function(_0x5a372b){return _0x5a372b;});}return null;};}function removeEntity(_0x4942b8,_0x1dd5ed){return function(_0x132341){if(_0x132341){return _0x132341['destroy']()[_0x71aa('0x1d')](function(){var _0x4f1f40=_0x132341[_0x71aa('0x1e')]({'plain':!![]});var _0x18f237=_0x71aa('0x1f');return db[_0x71aa('0x20')][_0x71aa('0x21')]({'where':{'type':_0x18f237,'resourceId':_0x4f1f40['id']}})[_0x71aa('0x1d')](function(){return _0x132341;});})[_0x71aa('0x1d')](function(){_0x4942b8[_0x71aa('0x16')](0xcc)[_0x71aa('0x22')]();});}};}function handleEntityNotFound(_0x2149d4,_0xa3359c){return function(_0x249a74){if(!_0x249a74){_0x2149d4[_0x71aa('0x15')](0x194);}return _0x249a74;};}function handleError(_0x1ba157,_0x330672){_0x330672=_0x330672||0x1f4;return function(_0x234ef5){logger[_0x71aa('0x23')](_0x234ef5[_0x71aa('0x24')]);if(_0x234ef5[_0x71aa('0x25')]){delete _0x234ef5[_0x71aa('0x25')];}_0x1ba157[_0x71aa('0x16')](_0x330672)['send'](_0x234ef5);};}exports[_0x71aa('0x26')]=function(_0x3bc590,_0x34f57a){var _0x109a72={},_0x57ee84={},_0x18a722={'count':0x0,'rows':[]};var _0x23aa60=db[_0x71aa('0x27')][_0x71aa('0x28')];_0x57ee84[_0x71aa('0x29')]=_[_0x71aa('0x2a')](_0x23aa60);_0x57ee84[_0x71aa('0x2b')]=_[_0x71aa('0x2a')](_0x3bc590['query']);_0x57ee84[_0x71aa('0x2c')]=_['intersection'](_0x57ee84['model'],_0x57ee84['query']);_0x109a72[_0x71aa('0x2d')]=_[_0x71aa('0x2e')](_0x57ee84[_0x71aa('0x29')],qs['fields'](_0x3bc590[_0x71aa('0x2b')][_0x71aa('0x2f')]));_0x109a72[_0x71aa('0x2d')]=_0x109a72[_0x71aa('0x2d')][_0x71aa('0x30')]?_0x109a72[_0x71aa('0x2d')]:_0x57ee84['model'];if(!_0x3bc590[_0x71aa('0x2b')][_0x71aa('0x31')](_0x71aa('0x32'))){_0x109a72['limit']=qs[_0x71aa('0x19')](_0x3bc590[_0x71aa('0x2b')][_0x71aa('0x19')]);_0x109a72[_0x71aa('0x18')]=qs[_0x71aa('0x18')](_0x3bc590['query'][_0x71aa('0x18')]);}_0x109a72[_0x71aa('0x33')]=qs[_0x71aa('0x34')](_0x3bc590[_0x71aa('0x2b')][_0x71aa('0x34')]);_0x109a72[_0x71aa('0x35')]=qs[_0x71aa('0x2c')](_[_0x71aa('0x36')](_0x3bc590[_0x71aa('0x2b')],_0x57ee84[_0x71aa('0x2c')]));if(_0x3bc590[_0x71aa('0x2b')][_0x71aa('0x37')]){_0x109a72[_0x71aa('0x35')]=_[_0x71aa('0x38')](_0x109a72[_0x71aa('0x35')],{'$or':_[_0x71aa('0x39')](_0x23aa60,function(_0x127603){if(_0x127603[_0x71aa('0x3a')]['key']!==_0x71aa('0x3b')){var _0x2b21b4={};_0x2b21b4[_0x127603[_0x71aa('0x3c')]]={'$like':'%'+_0x3bc590[_0x71aa('0x2b')][_0x71aa('0x37')]+'%'};return _0x2b21b4;}})});}_0x109a72=_[_0x71aa('0x38')]({},_0x109a72,_0x3bc590[_0x71aa('0x3d')]);var _0x2ba99b={'where':_0x109a72[_0x71aa('0x35')]};return db[_0x71aa('0x27')][_0x71aa('0x3e')](_0x2ba99b)[_0x71aa('0x1d')](function(_0x3d7223){_0x18a722[_0x71aa('0x3e')]=_0x3d7223;if(_0x3bc590['query'][_0x71aa('0x3f')]){_0x109a72[_0x71aa('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x71aa('0x41')](_0x109a72);})[_0x71aa('0x1d')](function(_0xd9d3b0){_0x18a722[_0x71aa('0x42')]=_0xd9d3b0;return _0x18a722;})[_0x71aa('0x1d')](respondWithFilteredResult(_0x34f57a,_0x109a72))['catch'](handleError(_0x34f57a,null));};exports[_0x71aa('0x43')]=function(_0x59c9ff,_0x2fb132){var _0x80d08a={'raw':![],'where':{'id':_0x59c9ff[_0x71aa('0x44')]['id']}},_0x146e30={};_0x146e30[_0x71aa('0x29')]=_[_0x71aa('0x2a')](db[_0x71aa('0x27')][_0x71aa('0x28')]);_0x146e30[_0x71aa('0x2b')]=_[_0x71aa('0x2a')](_0x59c9ff['query']);_0x146e30[_0x71aa('0x2c')]=_['intersection'](_0x146e30[_0x71aa('0x29')],_0x146e30[_0x71aa('0x2b')]);_0x80d08a[_0x71aa('0x2d')]=_[_0x71aa('0x2e')](_0x146e30[_0x71aa('0x29')],qs['fields'](_0x59c9ff[_0x71aa('0x2b')][_0x71aa('0x2f')]));_0x80d08a[_0x71aa('0x2d')]=_0x80d08a[_0x71aa('0x2d')][_0x71aa('0x30')]?_0x80d08a[_0x71aa('0x2d')]:_0x146e30['model'];if(_0x59c9ff[_0x71aa('0x2b')]['includeAll']){_0x80d08a[_0x71aa('0x40')]=[{'all':!![]}];}_0x80d08a=_[_0x71aa('0x38')]({},_0x80d08a,_0x59c9ff['options']);return db[_0x71aa('0x27')]['find'](_0x80d08a)[_0x71aa('0x1d')](handleEntityNotFound(_0x2fb132,null))[_0x71aa('0x1d')](respondWithResult(_0x2fb132,null))[_0x71aa('0x45')](handleError(_0x2fb132,null));};exports['create']=function(_0x1841dc,_0x33084f){return db[_0x71aa('0x27')][_0x71aa('0x46')](_0x1841dc[_0x71aa('0x47')],{})[_0x71aa('0x1d')](function(_0x5281a6){var _0xc15cbe=_0x1841dc[_0x71aa('0x48')][_0x71aa('0x1e')]({'plain':!![]});if(!_0xc15cbe)throw new Error(_0x71aa('0x49'));if(_0xc15cbe['role']===_0x71aa('0x48')){var _0x46e8c7=_0x5281a6[_0x71aa('0x1e')]({'plain':!![]});var _0x28ed5a=_0x71aa('0x1f');return db['UserProfileSection'][_0x71aa('0x4a')]({'where':{'name':_0x28ed5a,'userProfileId':_0xc15cbe[_0x71aa('0x4b')]},'raw':!![]})[_0x71aa('0x1d')](function(_0x97305b){if(_0x97305b&&_0x97305b[_0x71aa('0x4c')]===0x0){return db[_0x71aa('0x20')]['create']({'name':_0x46e8c7['name'],'resourceId':_0x46e8c7['id'],'type':_0x97305b[_0x71aa('0x25')],'sectionId':_0x97305b['id']},{})[_0x71aa('0x1d')](function(){return _0x5281a6;});}else{return _0x5281a6;}})['catch'](function(_0x22f6d6){logger[_0x71aa('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22f6d6);throw _0x22f6d6;});}return _0x5281a6;})['then'](respondWithResult(_0x33084f,0xc9))[_0x71aa('0x45')](handleError(_0x33084f,null));};exports[_0x71aa('0x4d')]=function(_0x1afe47,_0x53366e){if(_0x1afe47[_0x71aa('0x47')]['id']){delete _0x1afe47[_0x71aa('0x47')]['id'];}return db[_0x71aa('0x27')][_0x71aa('0x4a')]({'where':{'id':_0x1afe47[_0x71aa('0x44')]['id']}})['then'](handleEntityNotFound(_0x53366e,null))[_0x71aa('0x1d')](saveUpdates(_0x1afe47[_0x71aa('0x47')],null))[_0x71aa('0x1d')](respondWithResult(_0x53366e,null))[_0x71aa('0x45')](handleError(_0x53366e,null));};exports[_0x71aa('0x21')]=function(_0x3d87b5,_0x2681ac){return db['VoiceChanSpy'][_0x71aa('0x4a')]({'where':{'id':_0x3d87b5[_0x71aa('0x44')]['id']}})[_0x71aa('0x1d')](handleEntityNotFound(_0x2681ac,null))[_0x71aa('0x1d')](removeEntity(_0x2681ac,null))['catch'](handleError(_0x2681ac,null));}; \ No newline at end of file +var _0xa703=['model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','type','key','VIRTUAL','VoiceChanSpy','includeAll','rows','catch','params','keys','include','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','ChanSpies','UserProfileResource','error','stack','rawAttributes'];(function(_0x7d0425,_0x493c72){var _0x36a572=function(_0x23f3c5){while(--_0x23f3c5){_0x7d0425['push'](_0x7d0425['shift']());}};_0x36a572(++_0x493c72);}(_0xa703,0x194));var _0x3a70=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xa703[_0x487b0c];return _0x1adbdc;};'use strict';var pdf=require(_0x3a70('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3a70('0x1'));var zipdir=require(_0x3a70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a70('0x3'));var moment=require('moment');var BPromise=require(_0x3a70('0x4'));var Mustache=require(_0x3a70('0x5'));var util=require('util');var path=require(_0x3a70('0x6'));var sox=require(_0x3a70('0x7'));var csv=require(_0x3a70('0x8'));var ejs=require(_0x3a70('0x9'));var fs=require('fs');var _=require(_0x3a70('0xa'));var squel=require(_0x3a70('0xb'));var crypto=require(_0x3a70('0xc'));var jsforce=require(_0x3a70('0xd'));var deskjs=require(_0x3a70('0xe'));var toCsv=require(_0x3a70('0x8'));var querystring=require(_0x3a70('0xf'));var Papa=require(_0x3a70('0x10'));var authService=require(_0x3a70('0x11'));var hardwareService=require(_0x3a70('0x12'));var Redis=require('ioredis');var qs=require(_0x3a70('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3a70('0x14'));var config=require(_0x3a70('0x15'));var db=require(_0x3a70('0x16'))['db'];function respondWithStatusCode(_0x5c831e,_0x499c36){_0x499c36=_0x499c36||0xcc;return function(_0x5b1ade){if(_0x5b1ade){return _0x5c831e[_0x3a70('0x17')](_0x499c36);}return _0x5c831e[_0x3a70('0x18')](_0x499c36)[_0x3a70('0x19')]();};}function respondWithResult(_0x4fcb09,_0xa8d9c2){_0xa8d9c2=_0xa8d9c2||0xc8;return function(_0x39dd02){if(_0x39dd02){return _0x4fcb09[_0x3a70('0x18')](_0xa8d9c2)[_0x3a70('0x1a')](_0x39dd02);}};}function respondWithFilteredResult(_0x12338b,_0x3126f7){return function(_0x554bb1){if(_0x554bb1){var _0x4d4c87=_0x554bb1[_0x3a70('0x1b')],_0x1ea677=_0x3126f7[_0x3a70('0x1c')],_0x30536d=_0x3126f7[_0x3a70('0x1c')]+_0x3126f7[_0x3a70('0x1d')],_0x384ca3;if(_0x30536d>=_0x4d4c87){_0x30536d=_0x4d4c87;_0x384ca3=0xc8;}else{_0x384ca3=0xce;}_0x12338b[_0x3a70('0x18')](_0x384ca3);return _0x12338b['set'](_0x3a70('0x1e'),_0x1ea677+'-'+_0x30536d+'/'+_0x4d4c87)[_0x3a70('0x1a')](_0x554bb1);}return null;};}function patchUpdates(_0x10e1df){return function(_0x5dff03){try{jsonpatch['apply'](_0x5dff03,_0x10e1df,!![]);}catch(_0x541b5c){return BPromise[_0x3a70('0x1f')](_0x541b5c);}return _0x5dff03[_0x3a70('0x20')]();};}function saveUpdates(_0x2c8714,_0x4b5365){return function(_0x220609){if(_0x220609){return _0x220609['update'](_0x2c8714)[_0x3a70('0x21')](function(_0x1320e6){return _0x1320e6;});}return null;};}function removeEntity(_0x71941,_0x4dd6de){return function(_0x2ac678){if(_0x2ac678){return _0x2ac678[_0x3a70('0x22')]()[_0x3a70('0x21')](function(){var _0x592f62=_0x2ac678['get']({'plain':!![]});var _0x148e16=_0x3a70('0x23');return db[_0x3a70('0x24')][_0x3a70('0x22')]({'where':{'type':_0x148e16,'resourceId':_0x592f62['id']}})[_0x3a70('0x21')](function(){return _0x2ac678;});})[_0x3a70('0x21')](function(){_0x71941[_0x3a70('0x18')](0xcc)[_0x3a70('0x19')]();});}};}function handleEntityNotFound(_0x1ad53f,_0x1ceda1){return function(_0x992ade){if(!_0x992ade){_0x1ad53f[_0x3a70('0x17')](0x194);}return _0x992ade;};}function handleError(_0xc9ca4,_0x2d9a82){_0x2d9a82=_0x2d9a82||0x1f4;return function(_0x4a785d){logger[_0x3a70('0x25')](_0x4a785d[_0x3a70('0x26')]);if(_0x4a785d['name']){delete _0x4a785d['name'];}_0xc9ca4[_0x3a70('0x18')](_0x2d9a82)['send'](_0x4a785d);};}exports['index']=function(_0x117225,_0x1a84a4){var _0x1c4a6d={},_0x52e015={},_0x509779={'count':0x0,'rows':[]};var _0x5a2b51=db['VoiceChanSpy'][_0x3a70('0x27')];_0x52e015[_0x3a70('0x28')]=_['keys'](_0x5a2b51);_0x52e015[_0x3a70('0x29')]=_['keys'](_0x117225[_0x3a70('0x29')]);_0x52e015['filters']=_[_0x3a70('0x2a')](_0x52e015[_0x3a70('0x28')],_0x52e015[_0x3a70('0x29')]);_0x1c4a6d[_0x3a70('0x2b')]=_[_0x3a70('0x2a')](_0x52e015['model'],qs[_0x3a70('0x2c')](_0x117225['query'][_0x3a70('0x2c')]));_0x1c4a6d[_0x3a70('0x2b')]=_0x1c4a6d[_0x3a70('0x2b')][_0x3a70('0x2d')]?_0x1c4a6d['attributes']:_0x52e015[_0x3a70('0x28')];if(!_0x117225['query'][_0x3a70('0x2e')](_0x3a70('0x2f'))){_0x1c4a6d['limit']=qs[_0x3a70('0x1d')](_0x117225[_0x3a70('0x29')]['limit']);_0x1c4a6d['offset']=qs[_0x3a70('0x1c')](_0x117225[_0x3a70('0x29')][_0x3a70('0x1c')]);}_0x1c4a6d['order']=qs['sort'](_0x117225[_0x3a70('0x29')][_0x3a70('0x30')]);_0x1c4a6d[_0x3a70('0x31')]=qs[_0x3a70('0x32')](_[_0x3a70('0x33')](_0x117225['query'],_0x52e015[_0x3a70('0x32')]));if(_0x117225[_0x3a70('0x29')][_0x3a70('0x34')]){_0x1c4a6d[_0x3a70('0x31')]=_['merge'](_0x1c4a6d[_0x3a70('0x31')],{'$or':_[_0x3a70('0x35')](_0x5a2b51,function(_0x22ed9e){if(_0x22ed9e[_0x3a70('0x36')][_0x3a70('0x37')]!==_0x3a70('0x38')){var _0x18849d={};_0x18849d[_0x22ed9e['field']]={'$like':'%'+_0x117225[_0x3a70('0x29')][_0x3a70('0x34')]+'%'};return _0x18849d;}})});}_0x1c4a6d=_['merge']({},_0x1c4a6d,_0x117225['options']);var _0x149619={'where':_0x1c4a6d[_0x3a70('0x31')]};return db[_0x3a70('0x39')]['count'](_0x149619)[_0x3a70('0x21')](function(_0x414015){_0x509779[_0x3a70('0x1b')]=_0x414015;if(_0x117225['query'][_0x3a70('0x3a')]){_0x1c4a6d['include']=[{'all':!![]}];}return db[_0x3a70('0x39')]['findAll'](_0x1c4a6d);})[_0x3a70('0x21')](function(_0x3eb7c4){_0x509779[_0x3a70('0x3b')]=_0x3eb7c4;return _0x509779;})[_0x3a70('0x21')](respondWithFilteredResult(_0x1a84a4,_0x1c4a6d))[_0x3a70('0x3c')](handleError(_0x1a84a4,null));};exports['show']=function(_0x4558d7,_0x3f2904){var _0x29569e={'raw':![],'where':{'id':_0x4558d7[_0x3a70('0x3d')]['id']}},_0x3384d7={};_0x3384d7[_0x3a70('0x28')]=_[_0x3a70('0x3e')](db[_0x3a70('0x39')]['rawAttributes']);_0x3384d7[_0x3a70('0x29')]=_['keys'](_0x4558d7[_0x3a70('0x29')]);_0x3384d7[_0x3a70('0x32')]=_[_0x3a70('0x2a')](_0x3384d7[_0x3a70('0x28')],_0x3384d7[_0x3a70('0x29')]);_0x29569e[_0x3a70('0x2b')]=_[_0x3a70('0x2a')](_0x3384d7[_0x3a70('0x28')],qs[_0x3a70('0x2c')](_0x4558d7[_0x3a70('0x29')][_0x3a70('0x2c')]));_0x29569e[_0x3a70('0x2b')]=_0x29569e[_0x3a70('0x2b')][_0x3a70('0x2d')]?_0x29569e[_0x3a70('0x2b')]:_0x3384d7['model'];if(_0x4558d7[_0x3a70('0x29')][_0x3a70('0x3a')]){_0x29569e[_0x3a70('0x3f')]=[{'all':!![]}];}_0x29569e=_[_0x3a70('0x40')]({},_0x29569e,_0x4558d7['options']);return db[_0x3a70('0x39')][_0x3a70('0x41')](_0x29569e)[_0x3a70('0x21')](handleEntityNotFound(_0x3f2904,null))['then'](respondWithResult(_0x3f2904,null))[_0x3a70('0x3c')](handleError(_0x3f2904,null));};exports[_0x3a70('0x42')]=function(_0x3797ce,_0x3fdb97){return db[_0x3a70('0x39')][_0x3a70('0x42')](_0x3797ce['body'],{})[_0x3a70('0x21')](function(_0xb39d69){var _0x2e69cd=_0x3797ce['user']['get']({'plain':!![]});if(!_0x2e69cd)throw new Error(_0x3a70('0x43'));if(_0x2e69cd[_0x3a70('0x44')]==='user'){var _0x5f4509=_0xb39d69[_0x3a70('0x45')]({'plain':!![]});var _0x2392af=_0x3a70('0x23');return db[_0x3a70('0x46')]['find']({'where':{'name':_0x2392af,'userProfileId':_0x2e69cd['userProfileId']},'raw':!![]})['then'](function(_0x4787c3){if(_0x4787c3&&_0x4787c3[_0x3a70('0x47')]===0x0){return db[_0x3a70('0x24')][_0x3a70('0x42')]({'name':_0x5f4509['name'],'resourceId':_0x5f4509['id'],'type':_0x4787c3['name'],'sectionId':_0x4787c3['id']},{})[_0x3a70('0x21')](function(){return _0xb39d69;});}else{return _0xb39d69;}})['catch'](function(_0x494180){logger[_0x3a70('0x25')](_0x3a70('0x48'),_0x494180);throw _0x494180;});}return _0xb39d69;})['then'](respondWithResult(_0x3fdb97,0xc9))[_0x3a70('0x3c')](handleError(_0x3fdb97,null));};exports['update']=function(_0x3a8a28,_0x31d744){if(_0x3a8a28[_0x3a70('0x49')]['id']){delete _0x3a8a28[_0x3a70('0x49')]['id'];}return db[_0x3a70('0x39')][_0x3a70('0x41')]({'where':{'id':_0x3a8a28[_0x3a70('0x3d')]['id']}})[_0x3a70('0x21')](handleEntityNotFound(_0x31d744,null))[_0x3a70('0x21')](saveUpdates(_0x3a8a28[_0x3a70('0x49')],null))[_0x3a70('0x21')](respondWithResult(_0x31d744,null))[_0x3a70('0x3c')](handleError(_0x31d744,null));};exports[_0x3a70('0x22')]=function(_0x4ec770,_0x225d5d){return db[_0x3a70('0x39')][_0x3a70('0x41')]({'where':{'id':_0x4ec770[_0x3a70('0x3d')]['id']}})[_0x3a70('0x21')](handleEntityNotFound(_0x225d5d,null))[_0x3a70('0x21')](removeEntity(_0x225d5d,null))[_0x3a70('0x3c')](handleError(_0x225d5d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 846ad34..3d6d4db 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 _0x6c4b=['system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','Authenticate','password','ChanSpy','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','format','prefix'];(function(_0x489283,_0x5f2f4a){var _0x4f5097=function(_0x52e497){while(--_0x52e497){_0x489283['push'](_0x489283['shift']());}};_0x4f5097(++_0x5f2f4a);}(_0x6c4b,0x93));var _0xb6c4=function(_0x66fa37,_0x49ff63){_0x66fa37=_0x66fa37-0x0;var _0x1374a0=_0x6c4b[_0x66fa37];return _0x1374a0;};'use strict';var _=require(_0xb6c4('0x0'));var util=require(_0xb6c4('0x1'));var BPromise=require(_0xb6c4('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x1f07f4,_0x2a1872,_0x235930){var _0x794568=0x1;var _0x459ef7=[];var _0x27f46b={'context':_0x2a1872['context']||'from-sip','exten':util[_0xb6c4('0x3')]('%s%s',_0x1f07f4[_0xb6c4('0x4')],_0x235930),'type':_0xb6c4('0x5'),'isApp':![],'ChanSpyId':_0x1f07f4['id'],'UserId':_0x2a1872['id']};_0x459ef7['push'](_[_0xb6c4('0x6')]({'app':_0xb6c4('0x7'),'appdata':util[_0xb6c4('0x3')](_0xb6c4('0x8'),_0xb6c4('0x9')),'priority':_0x794568++},_0x27f46b));if(_0x1f07f4[_0xb6c4('0xa')]){_0x459ef7[_0xb6c4('0xb')](_['merge']({'app':_0xb6c4('0xc'),'appdata':util[_0xb6c4('0x3')](_0xb6c4('0xd'),_0x1f07f4[_0xb6c4('0xe')]),'priority':_0x794568++},_0x27f46b));}if(_0x1f07f4['auth']){_0x459ef7[_0xb6c4('0xb')](_[_0xb6c4('0x6')]({'app':_0xb6c4('0xf'),'appdata':_0x1f07f4[_0xb6c4('0x10')],'priority':_0x794568++},_0x27f46b));}_0x459ef7[_0xb6c4('0xb')](_[_0xb6c4('0x6')]({'app':_0xb6c4('0x11'),'appdata':util[_0xb6c4('0x3')]('SIP/%s,%s',_0x2a1872['name'],_0x1f07f4[_0xb6c4('0x12')]?_0x1f07f4['options'][_0xb6c4('0x13')](''):''),'priority':_0x794568++},_0x27f46b));if(_0x1f07f4[_0xb6c4('0xa')]){_0x459ef7[_0xb6c4('0xb')](_['merge']({'app':_0xb6c4('0x14'),'priority':_0x794568++},_0x27f46b));}return _0x459ef7;};var getChanSpyApplications=function(_0x1566a8,_0xd9de6d){var _0x4b314e=[];for(var _0x417e00=0x0,_0x200e43=0x1;_0x417e00<_0xd9de6d[_0xb6c4('0x15')];_0x417e00++,_0x200e43=0x1){_0x4b314e=_0x4b314e[_0xb6c4('0x16')](getUserApplications(_0x1566a8,_0xd9de6d[_0x417e00],_0xd9de6d[_0x417e00][_0xb6c4('0x17')]));if(_0xd9de6d[_0x417e00][_0xb6c4('0x17')]!=_0xd9de6d[_0x417e00][_0xb6c4('0x18')]){_0x4b314e=_0x4b314e['concat'](getUserApplications(_0x1566a8,_0xd9de6d[_0x417e00],_0xd9de6d[_0x417e00]['name']));}}return _0x4b314e;};var getChanSpyPromise=function(_0x5d2906,_0x3226cd){return new BPromise(function(_0x1a7076,_0x2caec3){return _0x5d2906[_0xb6c4('0x19')][_0xb6c4('0x1a')]({'attributes':['id','name','internal'],'where':{'role':_0xb6c4('0x1b'),'chanspy':!![]},'raw':!![]})[_0xb6c4('0x1c')](function(_0x95a9d){if(_0x95a9d){return _0x1a7076(getChanSpyApplications(_0x3226cd,_0x95a9d));}return _0x1a7076([]);})[_0xb6c4('0x1d')](function(_0x124a49){_0x2caec3(_0x124a49);});});};module[_0xb6c4('0x1e')]=function(_0x30071b,_0x2cea6f){var _0x142c04=_0x30071b[_0xb6c4('0x1f')];return _0x30071b[_0xb6c4('0x20')](_0xb6c4('0x21'),attributes,{'tableName':_0xb6c4('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5da94d,_0x13d288,_0x11a4ff){return getChanSpyPromise(_0x142c04,_0x5da94d)[_0xb6c4('0x1c')](function(_0x547b25){if(_0x547b25&&_0x547b25[_0xb6c4('0x15')]){return _0x142c04[_0xb6c4('0x23')][_0xb6c4('0x24')](_0x547b25);}})[_0xb6c4('0x1c')](function(){_0x11a4ff();})[_0xb6c4('0x1d')](function(_0x58607d){_0x11a4ff(_0x58607d);});},'afterUpdate':function(_0x1f822e,_0x17beaa,_0x1808af){return _0x142c04[_0xb6c4('0x23')]['destroy']({'where':{'ChanSpyId':_0x1f822e['id']}})[_0xb6c4('0x1c')](function(){return getChanSpyPromise(_0x142c04,_0x1f822e);})['then'](function(_0xaacf17){if(_0xaacf17&&_0xaacf17['length']){return _0x142c04[_0xb6c4('0x23')][_0xb6c4('0x24')](_0xaacf17);}})[_0xb6c4('0x1c')](function(){_0x1808af();})[_0xb6c4('0x1d')](function(_0x324656){_0x1808af(_0x324656);});},'afterDestroy':function(_0x3d9c12,_0x298d10,_0x12a676){return _0x142c04[_0xb6c4('0x23')][_0xb6c4('0x25')]({'where':{'ChanSpyId':_0x3d9c12['id']}})[_0xb6c4('0x1c')](function(){_0x12a676();})[_0xb6c4('0x1d')](function(_0x50800e){_0x12a676(_0x50800e);});}}});}; \ No newline at end of file +var _0xc534=['StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','util','bluebird','context','from-sip','format','%s%s','prefix','system','push','merge','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc534,0x1ca));var _0x4c53=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0xc534[_0x5beda8];return _0x2aa042;};'use strict';var _=require('lodash');var util=require(_0x4c53('0x0'));var BPromise=require(_0x4c53('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3426ed,_0x1fb9d7,_0x1bb0cb){var _0x53bca0=0x1;var _0xd2f9d9=[];var _0x50f2d0={'context':_0x1fb9d7[_0x4c53('0x2')]||_0x4c53('0x3'),'exten':util[_0x4c53('0x4')](_0x4c53('0x5'),_0x3426ed[_0x4c53('0x6')],_0x1bb0cb),'type':_0x4c53('0x7'),'isApp':![],'ChanSpyId':_0x3426ed['id'],'UserId':_0x1fb9d7['id']};_0xd2f9d9[_0x4c53('0x8')](_[_0x4c53('0x9')]({'app':'Set','appdata':util[_0x4c53('0x4')](_0x4c53('0xa'),'chanspy'),'priority':_0x53bca0++},_0x50f2d0));if(_0x3426ed[_0x4c53('0xb')]){_0xd2f9d9[_0x4c53('0x8')](_[_0x4c53('0x9')]({'app':_0x4c53('0xc'),'appdata':util[_0x4c53('0x4')](_0x4c53('0xd'),_0x3426ed[_0x4c53('0xe')]),'priority':_0x53bca0++},_0x50f2d0));}if(_0x3426ed[_0x4c53('0xf')]){_0xd2f9d9[_0x4c53('0x8')](_[_0x4c53('0x9')]({'app':_0x4c53('0x10'),'appdata':_0x3426ed[_0x4c53('0x11')],'priority':_0x53bca0++},_0x50f2d0));}_0xd2f9d9[_0x4c53('0x8')](_[_0x4c53('0x9')]({'app':_0x4c53('0x12'),'appdata':util['format'](_0x4c53('0x13'),_0x1fb9d7['name'],_0x3426ed[_0x4c53('0x14')]?_0x3426ed[_0x4c53('0x14')][_0x4c53('0x15')](''):''),'priority':_0x53bca0++},_0x50f2d0));if(_0x3426ed[_0x4c53('0xb')]){_0xd2f9d9[_0x4c53('0x8')](_['merge']({'app':_0x4c53('0x16'),'priority':_0x53bca0++},_0x50f2d0));}return _0xd2f9d9;};var getChanSpyApplications=function(_0x199c42,_0x565f08){var _0x4705a3=[];for(var _0x880449=0x0,_0x19abd1=0x1;_0x880449<_0x565f08[_0x4c53('0x17')];_0x880449++,_0x19abd1=0x1){_0x4705a3=_0x4705a3[_0x4c53('0x18')](getUserApplications(_0x199c42,_0x565f08[_0x880449],_0x565f08[_0x880449][_0x4c53('0x19')]));if(_0x565f08[_0x880449][_0x4c53('0x19')]!=_0x565f08[_0x880449][_0x4c53('0x1a')]){_0x4705a3=_0x4705a3[_0x4c53('0x18')](getUserApplications(_0x199c42,_0x565f08[_0x880449],_0x565f08[_0x880449][_0x4c53('0x1a')]));}}return _0x4705a3;};var getChanSpyPromise=function(_0x3bf5a9,_0x50b4e1){return new BPromise(function(_0x8bf6a9,_0x48d72d){return _0x3bf5a9[_0x4c53('0x1b')][_0x4c53('0x1c')]({'attributes':['id',_0x4c53('0x1a'),_0x4c53('0x19')],'where':{'role':_0x4c53('0x1d'),'chanspy':!![]},'raw':!![]})[_0x4c53('0x1e')](function(_0x1fed39){if(_0x1fed39){return _0x8bf6a9(getChanSpyApplications(_0x50b4e1,_0x1fed39));}return _0x8bf6a9([]);})[_0x4c53('0x1f')](function(_0x4f139b){_0x48d72d(_0x4f139b);});});};module[_0x4c53('0x20')]=function(_0x1da82a,_0x2981e6){var _0xa620d7=_0x1da82a[_0x4c53('0x21')];return _0x1da82a[_0x4c53('0x22')](_0x4c53('0x23'),attributes,{'tableName':_0x4c53('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2700df,_0x107788,_0x14fde2){return getChanSpyPromise(_0xa620d7,_0x2700df)[_0x4c53('0x1e')](function(_0x3e3576){if(_0x3e3576&&_0x3e3576[_0x4c53('0x17')]){return _0xa620d7[_0x4c53('0x25')]['bulkCreate'](_0x3e3576);}})[_0x4c53('0x1e')](function(){_0x14fde2();})[_0x4c53('0x1f')](function(_0x29fd50){_0x14fde2(_0x29fd50);});},'afterUpdate':function(_0x5ecebd,_0xea2a5d,_0x3be0ba){return _0xa620d7['VoiceExtension'][_0x4c53('0x26')]({'where':{'ChanSpyId':_0x5ecebd['id']}})[_0x4c53('0x1e')](function(){return getChanSpyPromise(_0xa620d7,_0x5ecebd);})[_0x4c53('0x1e')](function(_0x467646){if(_0x467646&&_0x467646[_0x4c53('0x17')]){return _0xa620d7[_0x4c53('0x25')][_0x4c53('0x27')](_0x467646);}})[_0x4c53('0x1e')](function(){_0x3be0ba();})[_0x4c53('0x1f')](function(_0x92c41){_0x3be0ba(_0x92c41);});},'afterDestroy':function(_0x5220b0,_0x3393f6,_0xcecee3){return _0xa620d7[_0x4c53('0x25')][_0x4c53('0x26')]({'where':{'ChanSpyId':_0x5220b0['id']}})[_0x4c53('0x1e')](function(){_0xcecee3();})['catch'](function(_0xc94987){_0xcecee3(_0xc94987);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 3e2cafb..554dd80 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 _0xdaac=['request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x38436f,_0x2158a0){var _0x5eedfd=function(_0x5ebd2e){while(--_0x5ebd2e){_0x38436f['push'](_0x38436f['shift']());}};_0x5eedfd(++_0x2158a0);}(_0xdaac,0xf1));var _0xcdaa=function(_0x16b636,_0xb324dc){_0x16b636=_0x16b636-0x0;var _0x1fea59=_0xdaac[_0x16b636];return _0x1fea59;};'use strict';var _=require(_0xcdaa('0x0'));var util=require(_0xcdaa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcdaa('0x2'));var fs=require('fs');var Redis=require(_0xcdaa('0x3'));var db=require(_0xcdaa('0x4'))['db'];var utils=require(_0xcdaa('0x5'));var logger=require(_0xcdaa('0x6'))(_0xcdaa('0x7'));var config=require(_0xcdaa('0x8'));var jayson=require(_0xcdaa('0x9'));var client=jayson[_0xcdaa('0xa')][_0xcdaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x130e76,_0x1adba3,_0x5b0268){return new BPromise(function(_0x965df9,_0x5720c4){return client[_0xcdaa('0xc')](_0x130e76,_0x5b0268)[_0xcdaa('0xd')](function(_0x4c1cba){logger[_0xcdaa('0xe')](_0xcdaa('0xf'),_0x1adba3,_0xcdaa('0x10'));logger[_0xcdaa('0x11')](_0xcdaa('0x12'),_0x1adba3,_0xcdaa('0x10'),JSON[_0xcdaa('0x13')](_0x4c1cba));if(_0x4c1cba[_0xcdaa('0x14')]){if(_0x4c1cba[_0xcdaa('0x14')]['code']===0x1f4){logger[_0xcdaa('0x14')](_0xcdaa('0xf'),_0x1adba3,_0x4c1cba[_0xcdaa('0x14')][_0xcdaa('0x15')]);return _0x5720c4(_0x4c1cba[_0xcdaa('0x14')][_0xcdaa('0x15')]);}logger[_0xcdaa('0x14')](_0xcdaa('0xf'),_0x1adba3,_0x4c1cba[_0xcdaa('0x14')][_0xcdaa('0x15')]);return _0x965df9(_0x4c1cba[_0xcdaa('0x14')][_0xcdaa('0x15')]);}else{logger[_0xcdaa('0xe')](_0xcdaa('0xf'),_0x1adba3,'request\x20sent');_0x965df9(_0x4c1cba['result']['message']);}})[_0xcdaa('0x16')](function(_0x29b243){logger['error'](_0xcdaa('0xf'),_0x1adba3,_0x29b243);_0x5720c4(_0x29b243);});});} \ No newline at end of file +var _0xa794=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x131988,_0x5606dd){var _0x18d0f1=function(_0x57d3f8){while(--_0x57d3f8){_0x131988['push'](_0x131988['shift']());}};_0x18d0f1(++_0x5606dd);}(_0xa794,0x79));var _0x4a79=function(_0x287ecf,_0x104022){_0x287ecf=_0x287ecf-0x0;var _0xde9a29=_0xa794[_0x287ecf];return _0xde9a29;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4a79('0x0'));var rs=require(_0x4a79('0x1'));var fs=require('fs');var Redis=require(_0x4a79('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a79('0x3'));var logger=require(_0x4a79('0x4'))(_0x4a79('0x5'));var config=require(_0x4a79('0x6'));var jayson=require(_0x4a79('0x7'));var client=jayson['client'][_0x4a79('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3aec8f,_0xe74f00,_0x3b8827){return new BPromise(function(_0x4624a0,_0x5a4518){return client[_0x4a79('0x9')](_0x3aec8f,_0x3b8827)['then'](function(_0x5a7522){logger['info'](_0x4a79('0xa'),_0xe74f00,_0x4a79('0xb'));logger[_0x4a79('0xc')](_0x4a79('0xd'),_0xe74f00,'request\x20sent',JSON['stringify'](_0x5a7522));if(_0x5a7522['error']){if(_0x5a7522['error'][_0x4a79('0xe')]===0x1f4){logger[_0x4a79('0xf')](_0x4a79('0xa'),_0xe74f00,_0x5a7522[_0x4a79('0xf')]['message']);return _0x5a4518(_0x5a7522[_0x4a79('0xf')][_0x4a79('0x10')]);}logger[_0x4a79('0xf')](_0x4a79('0xa'),_0xe74f00,_0x5a7522['error'][_0x4a79('0x10')]);return _0x4624a0(_0x5a7522['error'][_0x4a79('0x10')]);}else{logger['info'](_0x4a79('0xa'),_0xe74f00,_0x4a79('0xb'));_0x4624a0(_0x5a7522[_0x4a79('0x11')][_0x4a79('0x10')]);}})[_0x4a79('0x12')](function(_0x2828eb){logger['error'](_0x4a79('0xa'),_0xe74f00,_0x2828eb);_0x5a4518(_0x2828eb);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b836886..3800785 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 _0x056b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x1a26d7,_0xb59032){var _0xa7c428=function(_0x504bb7){while(--_0x504bb7){_0x1a26d7['push'](_0x1a26d7['shift']());}};_0xa7c428(++_0xb59032);}(_0x056b,0xb6));var _0xb056=function(_0x40162a,_0x265b0c){_0x40162a=_0x40162a-0x0;var _0x488161=_0x056b[_0x40162a];return _0x488161;};'use strict';var multer=require('multer');var util=require(_0xb056('0x0'));var path=require(_0xb056('0x1'));var timeout=require(_0xb056('0x2'));var express=require(_0xb056('0x3'));var router=express[_0xb056('0x4')]();var auth=require(_0xb056('0x5'));var interaction=require(_0xb056('0x6'));var config=require(_0xb056('0x7'));var controller=require(_0xb056('0x8'));router[_0xb056('0x9')]('/',auth[_0xb056('0xa')](),controller['index']);router[_0xb056('0x9')](_0xb056('0xb'),auth[_0xb056('0xa')](),controller[_0xb056('0xc')]);router[_0xb056('0xd')]('/',auth[_0xb056('0xa')](),controller['create']);router['put'](_0xb056('0xb'),auth[_0xb056('0xa')](),controller[_0xb056('0xe')]);router[_0xb056('0xf')]('/:id',auth[_0xb056('0xa')](),controller['destroy']);module[_0xb056('0x10')]=router; \ No newline at end of file +var _0xa5c1=['util','path','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','update','exports','multer'];(function(_0x32405b,_0x5027b5){var _0x3c0b87=function(_0x38737b){while(--_0x38737b){_0x32405b['push'](_0x32405b['shift']());}};_0x3c0b87(++_0x5027b5);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x22acb4,_0x2001bc){_0x22acb4=_0x22acb4-0x0;var _0x2665fb=_0xa5c1[_0x22acb4];return _0x2665fb;};'use strict';var multer=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var path=require(_0x1a5c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1a5c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1a5c('0x4'));var config=require(_0x1a5c('0x5'));var controller=require(_0x1a5c('0x6'));router[_0x1a5c('0x7')]('/',auth[_0x1a5c('0x8')](),controller[_0x1a5c('0x9')]);router['get'](_0x1a5c('0xa'),auth['isAuthenticated'](),controller[_0x1a5c('0xb')]);router[_0x1a5c('0xc')]('/',auth[_0x1a5c('0x8')](),controller['create']);router[_0x1a5c('0xd')]('/:id',auth[_0x1a5c('0x8')](),controller[_0x1a5c('0xe')]);router['delete'](_0x1a5c('0xa'),auth[_0x1a5c('0x8')](),controller['destroy']);module[_0x1a5c('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f3ad44c..dd86689 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 _0xd7a9=['BOOLEAN','exports','STRING','name'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd7a9,0x1b1));var _0x9d7a=function(_0x284b22,_0x1e0f2c){_0x284b22=_0x284b22-0x0;var _0x261e08=_0xd7a9[_0x284b22];return _0x261e08;};'use strict';var Sequelize=require('sequelize');module[_0x9d7a('0x0')]={'name':{'type':Sequelize[_0x9d7a('0x1')],'unique':_0x9d7a('0x2')},'description':{'type':Sequelize[_0x9d7a('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9d7a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x57de=['sequelize','STRING','BOOLEAN'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x57de,0x108));var _0xe57d=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x57de[_0x3a1ea5];return _0xfac9b2;};'use strict';var Sequelize=require(_0xe57d('0x0'));module['exports']={'name':{'type':Sequelize[_0xe57d('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xe57d('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe57d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 6ae4bae..1280079 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 _0xba12=['Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','sendStatus','name','send','VoiceContext','rawAttributes','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','server/files/templates/context.ejs','utf8','chan_sip.so','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0xba12,0xa4));var _0x2ba1=function(_0x46e036,_0x374b97){_0x46e036=_0x46e036-0x0;var _0x232273=_0xba12[_0x46e036];return _0x232273;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2ba1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ba1('0x1'));var jsonpatch=require(_0x2ba1('0x2'));var rp=require(_0x2ba1('0x3'));var moment=require(_0x2ba1('0x4'));var BPromise=require(_0x2ba1('0x5'));var Mustache=require(_0x2ba1('0x6'));var util=require(_0x2ba1('0x7'));var path=require('path');var sox=require(_0x2ba1('0x8'));var csv=require(_0x2ba1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2ba1('0xa'));var squel=require(_0x2ba1('0xb'));var crypto=require(_0x2ba1('0xc'));var jsforce=require(_0x2ba1('0xd'));var deskjs=require(_0x2ba1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2ba1('0xf'));var Papa=require(_0x2ba1('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x2ba1('0x11'));var Redis=require('ioredis');var qs=require(_0x2ba1('0x12'));var logger=require(_0x2ba1('0x13'))(_0x2ba1('0x14'));var utils=require(_0x2ba1('0x15'));var config=require(_0x2ba1('0x16'));var db=require(_0x2ba1('0x17'))['db'];var jayson=require(_0x2ba1('0x18'));var client=jayson[_0x2ba1('0x19')][_0x2ba1('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x18ba66,_0x31d318,_0x1e276f,_0x3ce6f2){return new BPromise(function(_0xbde816,_0x51af71){var _0x2bad5c=_0x3ce6f2||client;return _0x2bad5c[_0x2ba1('0x1b')](_0x18ba66,_0x1e276f)[_0x2ba1('0x1c')](function(_0x520632){logger[_0x2ba1('0x1d')](_0x2ba1('0x1e'),_0x31d318,_0x2ba1('0x1f'));logger[_0x2ba1('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x31d318,_0x2ba1('0x1f'),JSON[_0x2ba1('0x21')](_0x520632));if(_0x520632[_0x2ba1('0x22')]){if(_0x520632[_0x2ba1('0x22')][_0x2ba1('0x23')]===0x1f4){logger[_0x2ba1('0x22')]('VoiceContext,\x20%s,\x20%s',_0x31d318,_0x520632[_0x2ba1('0x22')][_0x2ba1('0x24')]);return _0x51af71(_0x520632['error'][_0x2ba1('0x24')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x31d318,_0x520632[_0x2ba1('0x22')][_0x2ba1('0x24')]);return _0xbde816(_0x520632[_0x2ba1('0x22')][_0x2ba1('0x24')]);}else{logger[_0x2ba1('0x1d')](_0x2ba1('0x1e'),_0x31d318,_0x2ba1('0x1f'));_0xbde816(_0x520632[_0x2ba1('0x25')][_0x2ba1('0x24')]);}})[_0x2ba1('0x26')](function(_0xd5f65e){logger[_0x2ba1('0x22')](_0x2ba1('0x1e'),_0x31d318,_0xd5f65e);_0x51af71(_0xd5f65e);});});}function respondWithStatusCode(_0x2128ce,_0x20b8cd){_0x20b8cd=_0x20b8cd||0xcc;return function(_0x27b96d){if(_0x27b96d){return _0x2128ce['sendStatus'](_0x20b8cd);}return _0x2128ce['status'](_0x20b8cd)[_0x2ba1('0x27')]();};}function respondWithResult(_0x42c02c,_0x282964){_0x282964=_0x282964||0xc8;return function(_0x48f624){if(_0x48f624){return _0x42c02c[_0x2ba1('0x28')](_0x282964)[_0x2ba1('0x29')](_0x48f624);}};}function respondWithFilteredResult(_0x4d0881,_0x17f2c5){return function(_0x2dd239){if(_0x2dd239){var _0x521bb5=_0x2dd239[_0x2ba1('0x2a')],_0x215087=_0x17f2c5['offset'],_0x3664ec=_0x17f2c5[_0x2ba1('0x2b')]+_0x17f2c5[_0x2ba1('0x2c')],_0x4fcfff;if(_0x3664ec>=_0x521bb5){_0x3664ec=_0x521bb5;_0x4fcfff=0xc8;}else{_0x4fcfff=0xce;}_0x4d0881[_0x2ba1('0x28')](_0x4fcfff);return _0x4d0881[_0x2ba1('0x2d')](_0x2ba1('0x2e'),_0x215087+'-'+_0x3664ec+'/'+_0x521bb5)[_0x2ba1('0x29')](_0x2dd239);}return null;};}function patchUpdates(_0x40d46f){return function(_0x3fc675){try{jsonpatch[_0x2ba1('0x2f')](_0x3fc675,_0x40d46f,!![]);}catch(_0x3c23ce){return BPromise[_0x2ba1('0x30')](_0x3c23ce);}return _0x3fc675[_0x2ba1('0x31')]();};}function saveUpdates(_0x4433f3,_0x5c6fd0){return function(_0x58e99e){if(_0x58e99e){return _0x58e99e[_0x2ba1('0x32')](_0x4433f3)[_0x2ba1('0x1c')](function(_0x169f6e){return _0x169f6e;});}return null;};}function removeEntity(_0x20f8e0,_0x47d409){return function(_0x3e9fab){if(_0x3e9fab){return _0x3e9fab[_0x2ba1('0x33')]()[_0x2ba1('0x1c')](function(){var _0x4b33fc=_0x3e9fab[_0x2ba1('0x34')]({'plain':!![]});var _0x2ef266=_0x2ba1('0x35');return db[_0x2ba1('0x36')][_0x2ba1('0x33')]({'where':{'type':_0x2ef266,'resourceId':_0x4b33fc['id']}})[_0x2ba1('0x1c')](function(){return _0x3e9fab;});})[_0x2ba1('0x1c')](function(){_0x20f8e0[_0x2ba1('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36b3b7,_0x2688ed){return function(_0xfe4b15){if(!_0xfe4b15){_0x36b3b7[_0x2ba1('0x37')](0x194);}return _0xfe4b15;};}function handleError(_0xbeceeb,_0x223747){_0x223747=_0x223747||0x1f4;return function(_0x10ef09){logger['error'](_0x10ef09['stack']);if(_0x10ef09[_0x2ba1('0x38')]){delete _0x10ef09[_0x2ba1('0x38')];}_0xbeceeb['status'](_0x223747)[_0x2ba1('0x39')](_0x10ef09);};}exports['index']=function(_0x34914b,_0x4c843d){var _0xe9411b={},_0x1f646b={},_0x44f7a6={'count':0x0,'rows':[]};var _0x11b210=db[_0x2ba1('0x3a')][_0x2ba1('0x3b')];_0x1f646b['model']=_[_0x2ba1('0x3c')](_0x11b210);_0x1f646b[_0x2ba1('0x3d')]=_[_0x2ba1('0x3c')](_0x34914b[_0x2ba1('0x3d')]);_0x1f646b[_0x2ba1('0x3e')]=_['intersection'](_0x1f646b['model'],_0x1f646b[_0x2ba1('0x3d')]);_0xe9411b[_0x2ba1('0x3f')]=_[_0x2ba1('0x40')](_0x1f646b[_0x2ba1('0x41')],qs['fields'](_0x34914b[_0x2ba1('0x3d')][_0x2ba1('0x42')]));_0xe9411b['attributes']=_0xe9411b[_0x2ba1('0x3f')]['length']?_0xe9411b[_0x2ba1('0x3f')]:_0x1f646b[_0x2ba1('0x41')];if(!_0x34914b[_0x2ba1('0x3d')][_0x2ba1('0x43')](_0x2ba1('0x44'))){_0xe9411b[_0x2ba1('0x2c')]=qs[_0x2ba1('0x2c')](_0x34914b['query'][_0x2ba1('0x2c')]);_0xe9411b[_0x2ba1('0x2b')]=qs[_0x2ba1('0x2b')](_0x34914b[_0x2ba1('0x3d')][_0x2ba1('0x2b')]);}_0xe9411b[_0x2ba1('0x45')]=qs[_0x2ba1('0x46')](_0x34914b[_0x2ba1('0x3d')][_0x2ba1('0x46')]);_0xe9411b[_0x2ba1('0x47')]=qs[_0x2ba1('0x3e')](_[_0x2ba1('0x48')](_0x34914b['query'],_0x1f646b['filters']));if(_0x34914b[_0x2ba1('0x3d')][_0x2ba1('0x49')]){_0xe9411b[_0x2ba1('0x47')]=_[_0x2ba1('0x4a')](_0xe9411b['where'],{'$or':_[_0x2ba1('0x4b')](_0x11b210,function(_0x362ba5){if(_0x362ba5['type'][_0x2ba1('0x4c')]!==_0x2ba1('0x4d')){var _0x2b7e10={};_0x2b7e10[_0x362ba5[_0x2ba1('0x4e')]]={'$like':'%'+_0x34914b[_0x2ba1('0x3d')]['filter']+'%'};return _0x2b7e10;}})});}_0xe9411b=_[_0x2ba1('0x4a')]({},_0xe9411b,_0x34914b[_0x2ba1('0x4f')]);var _0x516f11={'where':_0xe9411b[_0x2ba1('0x47')]};return db[_0x2ba1('0x3a')][_0x2ba1('0x2a')](_0x516f11)[_0x2ba1('0x1c')](function(_0x32e915){_0x44f7a6[_0x2ba1('0x2a')]=_0x32e915;if(_0x34914b[_0x2ba1('0x3d')][_0x2ba1('0x50')]){_0xe9411b[_0x2ba1('0x51')]=[{'all':!![]}];}return db[_0x2ba1('0x3a')][_0x2ba1('0x52')](_0xe9411b);})[_0x2ba1('0x1c')](function(_0x35ab02){_0x44f7a6[_0x2ba1('0x53')]=_0x35ab02;return _0x44f7a6;})[_0x2ba1('0x1c')](respondWithFilteredResult(_0x4c843d,_0xe9411b))[_0x2ba1('0x26')](handleError(_0x4c843d,null));};exports[_0x2ba1('0x54')]=function(_0x2bbd86,_0xb96f17){var _0x283a00={'raw':![],'where':{'id':_0x2bbd86['params']['id']}},_0x3b854c={};_0x3b854c[_0x2ba1('0x41')]=_[_0x2ba1('0x3c')](db['VoiceContext'][_0x2ba1('0x3b')]);_0x3b854c[_0x2ba1('0x3d')]=_[_0x2ba1('0x3c')](_0x2bbd86[_0x2ba1('0x3d')]);_0x3b854c[_0x2ba1('0x3e')]=_[_0x2ba1('0x40')](_0x3b854c['model'],_0x3b854c[_0x2ba1('0x3d')]);_0x283a00['attributes']=_[_0x2ba1('0x40')](_0x3b854c[_0x2ba1('0x41')],qs[_0x2ba1('0x42')](_0x2bbd86[_0x2ba1('0x3d')]['fields']));_0x283a00[_0x2ba1('0x3f')]=_0x283a00[_0x2ba1('0x3f')][_0x2ba1('0x55')]?_0x283a00['attributes']:_0x3b854c['model'];if(_0x2bbd86[_0x2ba1('0x3d')]['includeAll']){_0x283a00['include']=[{'all':!![]}];}_0x283a00=_['merge']({},_0x283a00,_0x2bbd86[_0x2ba1('0x4f')]);return db[_0x2ba1('0x3a')][_0x2ba1('0x56')](_0x283a00)[_0x2ba1('0x1c')](handleEntityNotFound(_0xb96f17,null))[_0x2ba1('0x1c')](respondWithResult(_0xb96f17,null))[_0x2ba1('0x26')](handleError(_0xb96f17,null));};exports['create']=function(_0x2559e6,_0x5897b5,_0x1ba4f1){var _0x14491d;return db[_0x2ba1('0x3a')][_0x2ba1('0x57')](_0x2559e6[_0x2ba1('0x58')],{'raw':!![]})[_0x2ba1('0x1c')](function(_0x4fc009){_0x14491d=_0x4fc009;return db[_0x2ba1('0x3a')][_0x2ba1('0x52')]({'raw':!![]});})[_0x2ba1('0x1c')](function(_0x4f9720){var _0x7bfff4=fs[_0x2ba1('0x59')](path[_0x2ba1('0x5a')](config[_0x2ba1('0x5b')],'server/files/templates/context.ejs'),'utf8');var _0x358fd7=ejs[_0x2ba1('0x5c')](_0x7bfff4,{'contexts':_0x4f9720||[]});fs[_0x2ba1('0x5d')](_0x2ba1('0x5e'),_0x358fd7);})[_0x2ba1('0x1c')](function(){return respondWithRpcPromise(_0x2ba1('0x5f'),_0x2ba1('0x57'),{'module':'chan_sip.so'});})['then'](function(){var _0x5a320a=_0x2559e6[_0x2ba1('0x60')]['get']({'plain':!![]});if(!_0x5a320a)throw new Error(_0x2ba1('0x61'));if(_0x5a320a[_0x2ba1('0x62')]===_0x2ba1('0x60')){var _0x12bc21=_0x14491d[_0x2ba1('0x34')]({'plain':!![]});return db[_0x2ba1('0x63')]['find']({'where':{'name':'Contexts','userProfileId':_0x5a320a['userProfileId']},'raw':!![]})[_0x2ba1('0x1c')](function(_0x487042){if(_0x487042&&_0x487042[_0x2ba1('0x64')]===0x0){return db[_0x2ba1('0x36')][_0x2ba1('0x57')]({'name':_0x12bc21['name'],'resourceId':_0x12bc21['id'],'type':_0x487042[_0x2ba1('0x38')],'sectionId':_0x487042['id']},{})[_0x2ba1('0x1c')](function(){return _0x14491d;});}else{return _0x14491d;}})['catch'](function(_0x5570b4){logger[_0x2ba1('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5570b4);throw _0x5570b4;});}return _0x14491d;})[_0x2ba1('0x1c')](respondWithResult(_0x5897b5,0xc9))[_0x2ba1('0x26')](handleError(_0x5897b5,null));};exports[_0x2ba1('0x32')]=function(_0x296430,_0x3c6e1e,_0x3c5d1c){var _0x36f6ec;return db[_0x2ba1('0x3a')][_0x2ba1('0x56')]({'where':{'id':_0x296430[_0x2ba1('0x65')]['id']}})[_0x2ba1('0x1c')](handleEntityNotFound(_0x3c6e1e,null))['then'](saveUpdates(_0x296430[_0x2ba1('0x58')],null))[_0x2ba1('0x1c')](function(_0x187f73){if(_0x187f73){_0x36f6ec=_0x187f73;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x2ba1('0x1c')](function(_0x1da066){var _0x2680ae=fs[_0x2ba1('0x59')](path[_0x2ba1('0x5a')](config[_0x2ba1('0x5b')],_0x2ba1('0x66')),_0x2ba1('0x67'));var _0x5d1e64=ejs[_0x2ba1('0x5c')](_0x2680ae,{'contexts':_0x1da066||[]});fs['writeFileSync'](_0x2ba1('0x5e'),_0x5d1e64);})[_0x2ba1('0x1c')](function(){return respondWithRpcPromise(_0x2ba1('0x5f'),_0x2ba1('0x32'),{'module':_0x2ba1('0x68')});})[_0x2ba1('0x1c')](function(){return _0x36f6ec;})[_0x2ba1('0x1c')](respondWithResult(_0x3c6e1e,null))[_0x2ba1('0x26')](handleError(_0x3c6e1e,null));};exports[_0x2ba1('0x33')]=function(_0x2ac871,_0x5b0df9,_0x1e8078){var _0x1b7d3b;return db[_0x2ba1('0x3a')][_0x2ba1('0x56')]({'where':{'id':_0x2ac871[_0x2ba1('0x65')]['id']}})[_0x2ba1('0x1c')](handleEntityNotFound(_0x5b0df9,null))[_0x2ba1('0x1c')](removeEntity(_0x5b0df9,null))['then'](function(){return db[_0x2ba1('0x3a')][_0x2ba1('0x52')]({'raw':!![]});})[_0x2ba1('0x1c')](function(_0x2d0f23){var _0x55fa86=fs[_0x2ba1('0x59')](path[_0x2ba1('0x5a')](config[_0x2ba1('0x5b')],_0x2ba1('0x66')),_0x2ba1('0x67'));var _0x55c49c=ejs[_0x2ba1('0x5c')](_0x55fa86,{'contexts':_0x2d0f23});fs['writeFileSync'](_0x2ba1('0x5e'),_0x55c49c);return respondWithRpcPromise(_0x2ba1('0x5f'),'destroy',{'module':_0x2ba1('0x68')});})['catch'](handleError(_0x5b0df9,null));}; \ No newline at end of file +var _0x5af4=['params','find','create','readFileSync','join','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Contexts','autoAssociation','body','Reload','server/files/templates/context.ejs','render','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','get','UserProfileResource','destroy','name','send','index','VoiceContext','rawAttributes','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','map','type','key','VIRTUAL','field','merge','options','includeAll','include','findAll','rows','show'];(function(_0x2994f2,_0x464963){var _0x1e20f5=function(_0x52c32e){while(--_0x52c32e){_0x2994f2['push'](_0x2994f2['shift']());}};_0x1e20f5(++_0x464963);}(_0x5af4,0xd9));var _0x45af=function(_0x2c1df1,_0x5148f6){_0x2c1df1=_0x2c1df1-0x0;var _0x28e1f7=_0x5af4[_0x2c1df1];return _0x28e1f7;};'use strict';var pdf=require(_0x45af('0x0'));var emlformat=require(_0x45af('0x1'));var rimraf=require(_0x45af('0x2'));var zipdir=require(_0x45af('0x3'));var jsonpatch=require(_0x45af('0x4'));var rp=require('request-promise');var moment=require(_0x45af('0x5'));var BPromise=require(_0x45af('0x6'));var Mustache=require(_0x45af('0x7'));var util=require(_0x45af('0x8'));var path=require('path');var sox=require(_0x45af('0x9'));var csv=require(_0x45af('0xa'));var ejs=require(_0x45af('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x45af('0xc'));var crypto=require(_0x45af('0xd'));var jsforce=require(_0x45af('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x45af('0xa'));var querystring=require(_0x45af('0xf'));var Papa=require('papaparse');var authService=require(_0x45af('0x10'));var hardwareService=require(_0x45af('0x11'));var Redis=require('ioredis');var qs=require(_0x45af('0x12'));var logger=require('../../config/logger')(_0x45af('0x13'));var utils=require(_0x45af('0x14'));var config=require(_0x45af('0x15'));var db=require(_0x45af('0x16'))['db'];var jayson=require(_0x45af('0x17'));var client=jayson[_0x45af('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e71a2,_0x28c73b,_0x59ab24,_0x58a3a4){return new BPromise(function(_0x56db2c,_0x369cc4){var _0x23ff24=_0x58a3a4||client;return _0x23ff24[_0x45af('0x19')](_0x1e71a2,_0x59ab24)[_0x45af('0x1a')](function(_0x138617){logger[_0x45af('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x28c73b,_0x45af('0x1c'));logger[_0x45af('0x1d')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x28c73b,_0x45af('0x1c'),JSON[_0x45af('0x1e')](_0x138617));if(_0x138617[_0x45af('0x1f')]){if(_0x138617[_0x45af('0x1f')][_0x45af('0x20')]===0x1f4){logger[_0x45af('0x1f')](_0x45af('0x21'),_0x28c73b,_0x138617[_0x45af('0x1f')][_0x45af('0x22')]);return _0x369cc4(_0x138617['error'][_0x45af('0x22')]);}logger[_0x45af('0x1f')](_0x45af('0x21'),_0x28c73b,_0x138617[_0x45af('0x1f')]['message']);return _0x56db2c(_0x138617[_0x45af('0x1f')][_0x45af('0x22')]);}else{logger[_0x45af('0x1b')](_0x45af('0x21'),_0x28c73b,_0x45af('0x1c'));_0x56db2c(_0x138617['result'][_0x45af('0x22')]);}})[_0x45af('0x23')](function(_0x1bdf68){logger['error'](_0x45af('0x21'),_0x28c73b,_0x1bdf68);_0x369cc4(_0x1bdf68);});});}function respondWithStatusCode(_0x1ee9e4,_0x1e9f2b){_0x1e9f2b=_0x1e9f2b||0xcc;return function(_0x55dbc1){if(_0x55dbc1){return _0x1ee9e4[_0x45af('0x24')](_0x1e9f2b);}return _0x1ee9e4[_0x45af('0x25')](_0x1e9f2b)[_0x45af('0x26')]();};}function respondWithResult(_0xd9df79,_0x4c73f9){_0x4c73f9=_0x4c73f9||0xc8;return function(_0x4482b5){if(_0x4482b5){return _0xd9df79['status'](_0x4c73f9)[_0x45af('0x27')](_0x4482b5);}};}function respondWithFilteredResult(_0x577fa4,_0x3390be){return function(_0x251294){if(_0x251294){var _0x3725f6=_0x251294[_0x45af('0x28')],_0x21a0cb=_0x3390be['offset'],_0x3fc125=_0x3390be[_0x45af('0x29')]+_0x3390be[_0x45af('0x2a')],_0x31e58d;if(_0x3fc125>=_0x3725f6){_0x3fc125=_0x3725f6;_0x31e58d=0xc8;}else{_0x31e58d=0xce;}_0x577fa4[_0x45af('0x25')](_0x31e58d);return _0x577fa4[_0x45af('0x2b')](_0x45af('0x2c'),_0x21a0cb+'-'+_0x3fc125+'/'+_0x3725f6)[_0x45af('0x27')](_0x251294);}return null;};}function patchUpdates(_0x4dbab9){return function(_0x5a0962){try{jsonpatch['apply'](_0x5a0962,_0x4dbab9,!![]);}catch(_0x5a49e0){return BPromise[_0x45af('0x2d')](_0x5a49e0);}return _0x5a0962['save']();};}function saveUpdates(_0x1b6cd8,_0x3eeeb4){return function(_0x2fd30b){if(_0x2fd30b){return _0x2fd30b[_0x45af('0x2e')](_0x1b6cd8)[_0x45af('0x1a')](function(_0xbdaef2){return _0xbdaef2;});}return null;};}function removeEntity(_0x313846,_0x356bc2){return function(_0x24e725){if(_0x24e725){return _0x24e725['destroy']()['then'](function(){var _0x38ca33=_0x24e725[_0x45af('0x2f')]({'plain':!![]});var _0x219456='Contexts';return db[_0x45af('0x30')][_0x45af('0x31')]({'where':{'type':_0x219456,'resourceId':_0x38ca33['id']}})[_0x45af('0x1a')](function(){return _0x24e725;});})['then'](function(){_0x313846['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2fea7,_0x36b4cc){return function(_0x2824c7){if(!_0x2824c7){_0xe2fea7['sendStatus'](0x194);}return _0x2824c7;};}function handleError(_0x7faa4f,_0xec57ee){_0xec57ee=_0xec57ee||0x1f4;return function(_0x81d8d1){logger[_0x45af('0x1f')](_0x81d8d1['stack']);if(_0x81d8d1[_0x45af('0x32')]){delete _0x81d8d1[_0x45af('0x32')];}_0x7faa4f[_0x45af('0x25')](_0xec57ee)[_0x45af('0x33')](_0x81d8d1);};}exports[_0x45af('0x34')]=function(_0x533b89,_0x4b3691){var _0xd39af7={},_0x211e4f={},_0x9ece06={'count':0x0,'rows':[]};var _0x4cd84e=db[_0x45af('0x35')][_0x45af('0x36')];_0x211e4f['model']=_[_0x45af('0x37')](_0x4cd84e);_0x211e4f[_0x45af('0x38')]=_[_0x45af('0x37')](_0x533b89[_0x45af('0x38')]);_0x211e4f[_0x45af('0x39')]=_['intersection'](_0x211e4f[_0x45af('0x3a')],_0x211e4f[_0x45af('0x38')]);_0xd39af7[_0x45af('0x3b')]=_[_0x45af('0x3c')](_0x211e4f[_0x45af('0x3a')],qs[_0x45af('0x3d')](_0x533b89[_0x45af('0x38')][_0x45af('0x3d')]));_0xd39af7[_0x45af('0x3b')]=_0xd39af7[_0x45af('0x3b')][_0x45af('0x3e')]?_0xd39af7[_0x45af('0x3b')]:_0x211e4f[_0x45af('0x3a')];if(!_0x533b89['query'][_0x45af('0x3f')]('nolimit')){_0xd39af7['limit']=qs[_0x45af('0x2a')](_0x533b89[_0x45af('0x38')]['limit']);_0xd39af7[_0x45af('0x29')]=qs['offset'](_0x533b89[_0x45af('0x38')][_0x45af('0x29')]);}_0xd39af7[_0x45af('0x40')]=qs[_0x45af('0x41')](_0x533b89['query'][_0x45af('0x41')]);_0xd39af7[_0x45af('0x42')]=qs[_0x45af('0x39')](_['pick'](_0x533b89[_0x45af('0x38')],_0x211e4f[_0x45af('0x39')]));if(_0x533b89[_0x45af('0x38')][_0x45af('0x43')]){_0xd39af7['where']=_['merge'](_0xd39af7[_0x45af('0x42')],{'$or':_[_0x45af('0x44')](_0x4cd84e,function(_0x29a412){if(_0x29a412[_0x45af('0x45')][_0x45af('0x46')]!==_0x45af('0x47')){var _0x322771={};_0x322771[_0x29a412[_0x45af('0x48')]]={'$like':'%'+_0x533b89[_0x45af('0x38')][_0x45af('0x43')]+'%'};return _0x322771;}})});}_0xd39af7=_[_0x45af('0x49')]({},_0xd39af7,_0x533b89[_0x45af('0x4a')]);var _0x48aa52={'where':_0xd39af7[_0x45af('0x42')]};return db[_0x45af('0x35')][_0x45af('0x28')](_0x48aa52)['then'](function(_0x50fe62){_0x9ece06[_0x45af('0x28')]=_0x50fe62;if(_0x533b89[_0x45af('0x38')][_0x45af('0x4b')]){_0xd39af7[_0x45af('0x4c')]=[{'all':!![]}];}return db['VoiceContext'][_0x45af('0x4d')](_0xd39af7);})[_0x45af('0x1a')](function(_0x30af79){_0x9ece06[_0x45af('0x4e')]=_0x30af79;return _0x9ece06;})[_0x45af('0x1a')](respondWithFilteredResult(_0x4b3691,_0xd39af7))[_0x45af('0x23')](handleError(_0x4b3691,null));};exports[_0x45af('0x4f')]=function(_0xfa52e,_0x4d41a0){var _0x4ac161={'raw':![],'where':{'id':_0xfa52e[_0x45af('0x50')]['id']}},_0x2fc131={};_0x2fc131[_0x45af('0x3a')]=_[_0x45af('0x37')](db[_0x45af('0x35')]['rawAttributes']);_0x2fc131[_0x45af('0x38')]=_[_0x45af('0x37')](_0xfa52e['query']);_0x2fc131['filters']=_['intersection'](_0x2fc131['model'],_0x2fc131[_0x45af('0x38')]);_0x4ac161[_0x45af('0x3b')]=_['intersection'](_0x2fc131['model'],qs[_0x45af('0x3d')](_0xfa52e[_0x45af('0x38')][_0x45af('0x3d')]));_0x4ac161[_0x45af('0x3b')]=_0x4ac161['attributes']['length']?_0x4ac161[_0x45af('0x3b')]:_0x2fc131['model'];if(_0xfa52e[_0x45af('0x38')][_0x45af('0x4b')]){_0x4ac161[_0x45af('0x4c')]=[{'all':!![]}];}_0x4ac161=_['merge']({},_0x4ac161,_0xfa52e['options']);return db[_0x45af('0x35')][_0x45af('0x51')](_0x4ac161)[_0x45af('0x1a')](handleEntityNotFound(_0x4d41a0,null))[_0x45af('0x1a')](respondWithResult(_0x4d41a0,null))[_0x45af('0x23')](handleError(_0x4d41a0,null));};exports['create']=function(_0x23e803,_0x34af05,_0x2347b6){var _0x208281;return db['VoiceContext'][_0x45af('0x52')](_0x23e803['body'],{'raw':!![]})[_0x45af('0x1a')](function(_0x57da12){_0x208281=_0x57da12;return db[_0x45af('0x35')][_0x45af('0x4d')]({'raw':!![]});})[_0x45af('0x1a')](function(_0x5c713c){var _0x1f3992=fs[_0x45af('0x53')](path[_0x45af('0x54')](config[_0x45af('0x55')],'server/files/templates/context.ejs'),_0x45af('0x56'));var _0x42d1c8=ejs['render'](_0x1f3992,{'contexts':_0x5c713c||[]});fs[_0x45af('0x57')](_0x45af('0x58'),_0x42d1c8);})[_0x45af('0x1a')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x45af('0x59')});})['then'](function(){var _0x473269=_0x23e803[_0x45af('0x5a')][_0x45af('0x2f')]({'plain':!![]});if(!_0x473269)throw new Error(_0x45af('0x5b'));if(_0x473269['role']===_0x45af('0x5a')){var _0x56724f=_0x208281[_0x45af('0x2f')]({'plain':!![]});return db[_0x45af('0x5c')][_0x45af('0x51')]({'where':{'name':_0x45af('0x5d'),'userProfileId':_0x473269['userProfileId']},'raw':!![]})[_0x45af('0x1a')](function(_0x314614){if(_0x314614&&_0x314614[_0x45af('0x5e')]===0x0){return db['UserProfileResource'][_0x45af('0x52')]({'name':_0x56724f[_0x45af('0x32')],'resourceId':_0x56724f['id'],'type':_0x314614[_0x45af('0x32')],'sectionId':_0x314614['id']},{})[_0x45af('0x1a')](function(){return _0x208281;});}else{return _0x208281;}})[_0x45af('0x23')](function(_0x535265){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x535265);throw _0x535265;});}return _0x208281;})[_0x45af('0x1a')](respondWithResult(_0x34af05,0xc9))[_0x45af('0x23')](handleError(_0x34af05,null));};exports['update']=function(_0x4629ad,_0x163ad7,_0x36e6a0){var _0x30bfc3;return db[_0x45af('0x35')][_0x45af('0x51')]({'where':{'id':_0x4629ad[_0x45af('0x50')]['id']}})[_0x45af('0x1a')](handleEntityNotFound(_0x163ad7,null))[_0x45af('0x1a')](saveUpdates(_0x4629ad[_0x45af('0x5f')],null))[_0x45af('0x1a')](function(_0x720ca9){if(_0x720ca9){_0x30bfc3=_0x720ca9;return db[_0x45af('0x35')][_0x45af('0x4d')]({'raw':!![]});}})[_0x45af('0x1a')](function(_0x5e7669){var _0x1edae5=fs[_0x45af('0x53')](path['join'](config[_0x45af('0x55')],'server/files/templates/context.ejs'),_0x45af('0x56'));var _0x1f4e7d=ejs['render'](_0x1edae5,{'contexts':_0x5e7669||[]});fs[_0x45af('0x57')](_0x45af('0x58'),_0x1f4e7d);})[_0x45af('0x1a')](function(){return respondWithRpcPromise(_0x45af('0x60'),'update',{'module':'chan_sip.so'});})[_0x45af('0x1a')](function(){return _0x30bfc3;})[_0x45af('0x1a')](respondWithResult(_0x163ad7,null))[_0x45af('0x23')](handleError(_0x163ad7,null));};exports[_0x45af('0x31')]=function(_0x25a2af,_0x558260,_0x55019e){var _0x16a250;return db[_0x45af('0x35')][_0x45af('0x51')]({'where':{'id':_0x25a2af['params']['id']}})[_0x45af('0x1a')](handleEntityNotFound(_0x558260,null))['then'](removeEntity(_0x558260,null))[_0x45af('0x1a')](function(){return db[_0x45af('0x35')][_0x45af('0x4d')]({'raw':!![]});})[_0x45af('0x1a')](function(_0x54da77){var _0x328008=fs[_0x45af('0x53')](path[_0x45af('0x54')](config[_0x45af('0x55')],_0x45af('0x61')),_0x45af('0x56'));var _0x5500a1=ejs[_0x45af('0x62')](_0x328008,{'contexts':_0x54da77});fs[_0x45af('0x57')](_0x45af('0x58'),_0x5500a1);return respondWithRpcPromise('Reload',_0x45af('0x31'),{'module':_0x45af('0x59')});})[_0x45af('0x23')](handleError(_0x558260,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d3f928d..b24267d 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 _0x3bac=['define','VoiceContext','lodash','../../config/logger','api','moment','request-promise','./voiceContext.attributes','exports'];(function(_0x1125a4,_0x345783){var _0x5ebe11=function(_0x1b205c){while(--_0x1b205c){_0x1125a4['push'](_0x1125a4['shift']());}};_0x5ebe11(++_0x345783);}(_0x3bac,0x14f));var _0xc3ba=function(_0x35cabc,_0xc0f89a){_0x35cabc=_0x35cabc-0x0;var _0x2af2b9=_0x3bac[_0x35cabc];return _0x2af2b9;};'use strict';var _=require(_0xc3ba('0x0'));var util=require('util');var logger=require(_0xc3ba('0x1'))(_0xc3ba('0x2'));var moment=require(_0xc3ba('0x3'));var BPromise=require('bluebird');var rp=require(_0xc3ba('0x4'));var attributes=require(_0xc3ba('0x5'));module[_0xc3ba('0x6')]=function(_0xc29555,_0x45c90c){return _0xc29555[_0xc3ba('0x7')](_0xc3ba('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9023=['../../config/logger','api','moment','bluebird','request-promise','./voiceContext.attributes','define','VoiceContext','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9023,0xa1));var _0x3902=function(_0x5e24a9,_0x53da0c){_0x5e24a9=_0x5e24a9-0x0;var _0x5be7ac=_0x9023[_0x5e24a9];return _0x5be7ac;};'use strict';var _=require('lodash');var util=require(_0x3902('0x0'));var logger=require(_0x3902('0x1'))(_0x3902('0x2'));var moment=require(_0x3902('0x3'));var BPromise=require(_0x3902('0x4'));var rp=require(_0x3902('0x5'));var attributes=require(_0x3902('0x6'));module['exports']=function(_0x1c99fd,_0x1c0f51){return _0x1c99fd[_0x3902('0x7')](_0x3902('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 61e3e25..9d9ecfb 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 _0x5f76=['jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x150fa2,_0x156632){var _0x88e6ba=function(_0x23536e){while(--_0x23536e){_0x150fa2['push'](_0x150fa2['shift']());}};_0x88e6ba(++_0x156632);}(_0x5f76,0x123));var _0x65f7=function(_0x3c5f8d,_0x39891f){_0x3c5f8d=_0x3c5f8d-0x0;var _0x3b7beb=_0x5f76[_0x3c5f8d];return _0x3b7beb;};'use strict';var _=require(_0x65f7('0x0'));var util=require(_0x65f7('0x1'));var moment=require(_0x65f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x65f7('0x3'));var fs=require('fs');var Redis=require(_0x65f7('0x4'));var db=require(_0x65f7('0x5'))['db'];var utils=require(_0x65f7('0x6'));var logger=require('../../config/logger')(_0x65f7('0x7'));var config=require(_0x65f7('0x8'));var jayson=require(_0x65f7('0x9'));var client=jayson[_0x65f7('0xa')][_0x65f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x428fdf,_0x17480f,_0x322a31){return new BPromise(function(_0x1b2de9,_0x36125c){return client[_0x65f7('0xc')](_0x428fdf,_0x322a31)[_0x65f7('0xd')](function(_0x3dd972){logger[_0x65f7('0xe')](_0x65f7('0xf'),_0x17480f,'request\x20sent');logger[_0x65f7('0x10')](_0x65f7('0x11'),_0x17480f,_0x65f7('0x12'),JSON[_0x65f7('0x13')](_0x3dd972));if(_0x3dd972[_0x65f7('0x14')]){if(_0x3dd972[_0x65f7('0x14')][_0x65f7('0x15')]===0x1f4){logger[_0x65f7('0x14')](_0x65f7('0xf'),_0x17480f,_0x3dd972[_0x65f7('0x14')]['message']);return _0x36125c(_0x3dd972['error'][_0x65f7('0x16')]);}logger[_0x65f7('0x14')](_0x65f7('0xf'),_0x17480f,_0x3dd972['error'][_0x65f7('0x16')]);return _0x1b2de9(_0x3dd972[_0x65f7('0x14')][_0x65f7('0x16')]);}else{logger[_0x65f7('0xe')](_0x65f7('0xf'),_0x17480f,'request\x20sent');_0x1b2de9(_0x3dd972[_0x65f7('0x17')][_0x65f7('0x16')]);}})[_0x65f7('0x18')](function(_0x2e2531){logger[_0x65f7('0x14')](_0x65f7('0xf'),_0x17480f,_0x2e2531);_0x36125c(_0x2e2531);});});} \ No newline at end of file +var _0x9e3a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0x9e3a,0x107));var _0xa9e3=function(_0x43ac16,_0x435f99){_0x43ac16=_0x43ac16-0x0;var _0x156326=_0x9e3a[_0x43ac16];return _0x156326;};'use strict';var _=require(_0xa9e3('0x0'));var util=require(_0xa9e3('0x1'));var moment=require(_0xa9e3('0x2'));var BPromise=require(_0xa9e3('0x3'));var rs=require(_0xa9e3('0x4'));var fs=require('fs');var Redis=require(_0xa9e3('0x5'));var db=require(_0xa9e3('0x6'))['db'];var utils=require(_0xa9e3('0x7'));var logger=require(_0xa9e3('0x8'))(_0xa9e3('0x9'));var config=require(_0xa9e3('0xa'));var jayson=require(_0xa9e3('0xb'));var client=jayson[_0xa9e3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a5b17,_0xef0e52,_0x104fc0){return new BPromise(function(_0x7fdd31,_0x12076a){return client['request'](_0x5a5b17,_0x104fc0)[_0xa9e3('0xd')](function(_0x292d2c){logger['info'](_0xa9e3('0xe'),_0xef0e52,_0xa9e3('0xf'));logger[_0xa9e3('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xef0e52,'request\x20sent',JSON[_0xa9e3('0x11')](_0x292d2c));if(_0x292d2c[_0xa9e3('0x12')]){if(_0x292d2c[_0xa9e3('0x12')][_0xa9e3('0x13')]===0x1f4){logger[_0xa9e3('0x12')](_0xa9e3('0xe'),_0xef0e52,_0x292d2c[_0xa9e3('0x12')]['message']);return _0x12076a(_0x292d2c['error'][_0xa9e3('0x14')]);}logger[_0xa9e3('0x12')](_0xa9e3('0xe'),_0xef0e52,_0x292d2c['error'][_0xa9e3('0x14')]);return _0x7fdd31(_0x292d2c[_0xa9e3('0x12')]['message']);}else{logger[_0xa9e3('0x15')](_0xa9e3('0xe'),_0xef0e52,_0xa9e3('0xf'));_0x7fdd31(_0x292d2c[_0xa9e3('0x16')][_0xa9e3('0x14')]);}})[_0xa9e3('0x17')](function(_0x38b241){logger['error'](_0xa9e3('0xe'),_0xef0e52,_0x38b241);_0x12076a(_0x38b241);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index aa86005..2e69b7f 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 _0x0c28=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','index','get','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x2ed872,_0x43051a){var _0x393434=function(_0x36fb7c){while(--_0x36fb7c){_0x2ed872['push'](_0x2ed872['shift']());}};_0x393434(++_0x43051a);}(_0x0c28,0x118));var _0x80c2=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x0c28[_0xabbd2f];return _0x34a040;};'use strict';var multer=require('multer');var util=require(_0x80c2('0x0'));var path=require(_0x80c2('0x1'));var timeout=require(_0x80c2('0x2'));var express=require(_0x80c2('0x3'));var router=express[_0x80c2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x80c2('0x5'));var config=require(_0x80c2('0x6'));var controller=require(_0x80c2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x80c2('0x8')]);router[_0x80c2('0x9')]('/describe',auth[_0x80c2('0xa')](),controller[_0x80c2('0xb')]);router[_0x80c2('0x9')](_0x80c2('0xc'),auth[_0x80c2('0xa')](),controller[_0x80c2('0xd')]);router['post']('/',auth[_0x80c2('0xa')](),controller[_0x80c2('0xe')]);router[_0x80c2('0xf')](_0x80c2('0xc'),auth[_0x80c2('0xa')](),controller[_0x80c2('0x10')]);router[_0x80c2('0x11')](_0x80c2('0xc'),auth['isAuthenticated'](),controller[_0x80c2('0x12')]);module[_0x80c2('0x13')]=router; \ No newline at end of file +var _0x4301=['isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get'];(function(_0x146710,_0x132d83){var _0x519583=function(_0x297e49){while(--_0x297e49){_0x146710['push'](_0x146710['shift']());}};_0x519583(++_0x132d83);}(_0x4301,0x1d9));var _0x1430=function(_0x100759,_0x2a88f2){_0x100759=_0x100759-0x0;var _0x5db8f0=_0x4301[_0x100759];return _0x5db8f0;};'use strict';var multer=require(_0x1430('0x0'));var util=require(_0x1430('0x1'));var path=require(_0x1430('0x2'));var timeout=require(_0x1430('0x3'));var express=require(_0x1430('0x4'));var router=express['Router']();var auth=require(_0x1430('0x5'));var interaction=require(_0x1430('0x6'));var config=require(_0x1430('0x7'));var controller=require(_0x1430('0x8'));router[_0x1430('0x9')]('/',auth[_0x1430('0xa')](),controller[_0x1430('0xb')]);router[_0x1430('0x9')](_0x1430('0xc'),auth[_0x1430('0xa')](),controller[_0x1430('0xd')]);router[_0x1430('0x9')](_0x1430('0xe'),auth['isAuthenticated'](),controller[_0x1430('0xf')]);router['post']('/',auth[_0x1430('0xa')](),controller['create']);router[_0x1430('0x10')](_0x1430('0xe'),auth[_0x1430('0xa')](),controller[_0x1430('0x11')]);router[_0x1430('0x12')](_0x1430('0xe'),auth[_0x1430('0xa')](),controller[_0x1430('0x13')]);module[_0x1430('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 37b8b37..fdf5ac2 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 _0x810e=['INTEGER','DATE','sequelize','STRING'];(function(_0x45a790,_0x1e1d61){var _0x296200=function(_0x2e7f28){while(--_0x2e7f28){_0x45a790['push'](_0x45a790['shift']());}};_0x296200(++_0x1e1d61);}(_0x810e,0xe2));var _0xe810=function(_0x114574,_0x51c6aa){_0x114574=_0x114574-0x0;var _0x446bf4=_0x810e[_0x114574];return _0x446bf4;};'use strict';var Sequelize=require(_0xe810('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xe810('0x1')]},'channel':{'type':Sequelize[_0xe810('0x1')]},'channelstate':{'type':Sequelize[_0xe810('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe810('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe810('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe810('0x1')]},'accountcode':{'type':Sequelize[_0xe810('0x1')]},'context':{'type':Sequelize[_0xe810('0x1')]},'exten':{'type':Sequelize[_0xe810('0x1')]},'priority':{'type':Sequelize[_0xe810('0x2')]},'uniqueid':{'type':Sequelize[_0xe810('0x1')]},'linkedid':{'type':Sequelize[_0xe810('0x1')]},'destchannel':{'type':Sequelize[_0xe810('0x1')]},'destchannelstate':{'type':Sequelize[_0xe810('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe810('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe810('0x1')]},'destcalleridname':{'type':Sequelize[_0xe810('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe810('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xe810('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe810('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe810('0x1')]},'destpriority':{'type':Sequelize[_0xe810('0x2')]},'destuniqueid':{'type':Sequelize[_0xe810('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xe810('0x1')]},'dialstatus':{'type':Sequelize[_0xe810('0x1')]},'starttime':{'type':Sequelize[_0xe810('0x3')]},'answertime':{'type':Sequelize[_0xe810('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xe810('0x2')]},'duration':{'type':Sequelize[_0xe810('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe810('0x2')]}}; \ No newline at end of file +var _0x20b5=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x20b5,0x11a));var _0x520b=function(_0x21857e,_0x44af75){_0x21857e=_0x21857e-0x0;var _0x5886e8=_0x20b5[_0x21857e];return _0x5886e8;};'use strict';var Sequelize=require(_0x520b('0x0'));module[_0x520b('0x1')]={'privilege':{'type':Sequelize[_0x520b('0x2')]},'channel':{'type':Sequelize[_0x520b('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x520b('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x520b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x520b('0x2')]},'language':{'type':Sequelize[_0x520b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x520b('0x2')]},'exten':{'type':Sequelize[_0x520b('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x520b('0x2')]},'linkedid':{'type':Sequelize[_0x520b('0x2')]},'destchannel':{'type':Sequelize[_0x520b('0x2')]},'destchannelstate':{'type':Sequelize[_0x520b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x520b('0x2')]},'destcalleridnum':{'type':Sequelize[_0x520b('0x2')]},'destcalleridname':{'type':Sequelize[_0x520b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x520b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x520b('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x520b('0x2')]},'destcontext':{'type':Sequelize[_0x520b('0x2')]},'destexten':{'type':Sequelize[_0x520b('0x2')]},'destpriority':{'type':Sequelize[_0x520b('0x3')]},'destuniqueid':{'type':Sequelize[_0x520b('0x2')]},'destlinkedid':{'type':Sequelize[_0x520b('0x2')]},'dialstring':{'type':Sequelize[_0x520b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x520b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x520b('0x4')]},'lastevent':{'type':Sequelize[_0x520b('0x2')],'comment':_0x520b('0x5')},'routeId':{'type':Sequelize[_0x520b('0x3')]},'duration':{'type':Sequelize[_0x520b('0x3')]},'holdtime':{'type':Sequelize[_0x520b('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e0b82c7..ec403ce 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 _0xb431=['../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x5d8977,_0x4a58a3){var _0x40f190=function(_0x1d926d){while(--_0x1d926d){_0x5d8977['push'](_0x5d8977['shift']());}};_0x40f190(++_0x4a58a3);}(_0xb431,0x7f));var _0x1b43=function(_0x1b4b4e,_0x1797cf){_0x1b4b4e=_0x1b4b4e-0x0;var _0x2707e5=_0xb431[_0x1b4b4e];return _0x2707e5;};'use strict';var pdf=require(_0x1b43('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1b43('0x1'));var zipdir=require(_0x1b43('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b43('0x3'));var BPromise=require(_0x1b43('0x4'));var Mustache=require(_0x1b43('0x5'));var util=require(_0x1b43('0x6'));var path=require(_0x1b43('0x7'));var sox=require(_0x1b43('0x8'));var csv=require(_0x1b43('0x9'));var ejs=require(_0x1b43('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1b43('0xb'));var crypto=require(_0x1b43('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1b43('0xd'));var Papa=require(_0x1b43('0xe'));var authService=require(_0x1b43('0xf'));var hardwareService=require(_0x1b43('0x10'));var Redis=require('ioredis');var qs=require(_0x1b43('0x11'));var logger=require(_0x1b43('0x12'))(_0x1b43('0x13'));var utils=require(_0x1b43('0x14'));var config=require('../../config/environment');var db=require(_0x1b43('0x15'))['db'];function respondWithStatusCode(_0x334e63,_0x1376b6){_0x1376b6=_0x1376b6||0xcc;return function(_0x5a20c3){if(_0x5a20c3){return _0x334e63[_0x1b43('0x16')](_0x1376b6);}return _0x334e63[_0x1b43('0x17')](_0x1376b6)[_0x1b43('0x18')]();};}function respondWithResult(_0x589d8e,_0x388589){_0x388589=_0x388589||0xc8;return function(_0x5d46ef){if(_0x5d46ef){return _0x589d8e[_0x1b43('0x17')](_0x388589)['json'](_0x5d46ef);}};}function respondWithFilteredResult(_0x4fb5d5,_0x4347af){return function(_0xf14cb1){if(_0xf14cb1){var _0x422072=_0xf14cb1[_0x1b43('0x19')],_0x1a2141=_0x4347af[_0x1b43('0x1a')],_0x342ad4=_0x4347af[_0x1b43('0x1a')]+_0x4347af[_0x1b43('0x1b')],_0x1d96a9;if(_0x342ad4>=_0x422072){_0x342ad4=_0x422072;_0x1d96a9=0xc8;}else{_0x1d96a9=0xce;}_0x4fb5d5[_0x1b43('0x17')](_0x1d96a9);return _0x4fb5d5[_0x1b43('0x1c')](_0x1b43('0x1d'),_0x1a2141+'-'+_0x342ad4+'/'+_0x422072)[_0x1b43('0x1e')](_0xf14cb1);}return null;};}function patchUpdates(_0x1b43c3){return function(_0x55b466){try{jsonpatch[_0x1b43('0x1f')](_0x55b466,_0x1b43c3,!![]);}catch(_0x520209){return BPromise[_0x1b43('0x20')](_0x520209);}return _0x55b466[_0x1b43('0x21')]();};}function saveUpdates(_0x4e5775,_0x2048ce){return function(_0x595dbc){if(_0x595dbc){return _0x595dbc['update'](_0x4e5775)[_0x1b43('0x22')](function(_0x2c0a4a){return _0x2c0a4a;});}return null;};}function removeEntity(_0x413838,_0x4ddd6e){return function(_0x591576){if(_0x591576){return _0x591576[_0x1b43('0x23')]()[_0x1b43('0x22')](function(){_0x413838['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37985a,_0x2208d1){return function(_0x4b6e94){if(!_0x4b6e94){_0x37985a[_0x1b43('0x16')](0x194);}return _0x4b6e94;};}function handleError(_0x2b2bb3,_0x3e7343){_0x3e7343=_0x3e7343||0x1f4;return function(_0x5e84fb){logger[_0x1b43('0x24')](_0x5e84fb[_0x1b43('0x25')]);if(_0x5e84fb[_0x1b43('0x26')]){delete _0x5e84fb[_0x1b43('0x26')];}_0x2b2bb3[_0x1b43('0x17')](_0x3e7343)[_0x1b43('0x27')](_0x5e84fb);};}exports[_0x1b43('0x28')]=function(_0x3e8217,_0x426647){var _0x36ed2c={},_0x2fe006={},_0x3ddf6b={'count':0x0,'rows':[]};var _0x27ee4c=db[_0x1b43('0x29')][_0x1b43('0x2a')];_0x2fe006[_0x1b43('0x2b')]=_['keys'](_0x27ee4c);_0x2fe006['query']=_[_0x1b43('0x2c')](_0x3e8217['query']);_0x2fe006[_0x1b43('0x2d')]=_['intersection'](_0x2fe006[_0x1b43('0x2b')],_0x2fe006[_0x1b43('0x2e')]);_0x36ed2c['attributes']=_[_0x1b43('0x2f')](_0x2fe006['model'],qs[_0x1b43('0x30')](_0x3e8217[_0x1b43('0x2e')][_0x1b43('0x30')]));_0x36ed2c[_0x1b43('0x31')]=_0x36ed2c[_0x1b43('0x31')][_0x1b43('0x32')]?_0x36ed2c[_0x1b43('0x31')]:_0x2fe006[_0x1b43('0x2b')];if(!_0x3e8217['query'][_0x1b43('0x33')](_0x1b43('0x34'))){_0x36ed2c[_0x1b43('0x1b')]=qs[_0x1b43('0x1b')](_0x3e8217['query']['limit']);_0x36ed2c[_0x1b43('0x1a')]=qs[_0x1b43('0x1a')](_0x3e8217[_0x1b43('0x2e')][_0x1b43('0x1a')]);}_0x36ed2c['order']=qs[_0x1b43('0x35')](_0x3e8217['query'][_0x1b43('0x35')]);_0x36ed2c[_0x1b43('0x36')]=qs[_0x1b43('0x2d')](_['pick'](_0x3e8217[_0x1b43('0x2e')],_0x2fe006[_0x1b43('0x2d')]));if(_0x3e8217[_0x1b43('0x2e')][_0x1b43('0x37')]){_0x36ed2c[_0x1b43('0x36')]=_[_0x1b43('0x38')](_0x36ed2c['where'],{'$or':_[_0x1b43('0x39')](_0x27ee4c,function(_0x53ef8d){if(_0x53ef8d[_0x1b43('0x3a')][_0x1b43('0x3b')]!==_0x1b43('0x3c')){var _0x62e7fc={};_0x62e7fc[_0x53ef8d[_0x1b43('0x3d')]]={'$like':'%'+_0x3e8217['query']['filter']+'%'};return _0x62e7fc;}})});}_0x36ed2c=_[_0x1b43('0x38')]({},_0x36ed2c,_0x3e8217[_0x1b43('0x3e')]);var _0x40948c={'where':_0x36ed2c[_0x1b43('0x36')]};return db[_0x1b43('0x29')]['count'](_0x40948c)['then'](function(_0x3deb65){_0x3ddf6b[_0x1b43('0x19')]=_0x3deb65;if(_0x3e8217['query'][_0x1b43('0x3f')]){_0x36ed2c[_0x1b43('0x40')]=[{'all':!![]}];}return db[_0x1b43('0x29')][_0x1b43('0x41')](_0x36ed2c);})[_0x1b43('0x22')](function(_0x3c673d){_0x3ddf6b[_0x1b43('0x42')]=_0x3c673d;return _0x3ddf6b;})[_0x1b43('0x22')](respondWithFilteredResult(_0x426647,_0x36ed2c))[_0x1b43('0x43')](handleError(_0x426647,null));};exports[_0x1b43('0x44')]=function(_0x5e155f,_0x189f0e){var _0x194562={'raw':!![],'where':{'id':_0x5e155f[_0x1b43('0x45')]['id']}},_0x22680c={};_0x22680c[_0x1b43('0x2b')]=_[_0x1b43('0x2c')](db[_0x1b43('0x29')]['rawAttributes']);_0x22680c[_0x1b43('0x2e')]=_['keys'](_0x5e155f[_0x1b43('0x2e')]);_0x22680c['filters']=_[_0x1b43('0x2f')](_0x22680c['model'],_0x22680c[_0x1b43('0x2e')]);_0x194562['attributes']=_[_0x1b43('0x2f')](_0x22680c[_0x1b43('0x2b')],qs[_0x1b43('0x30')](_0x5e155f[_0x1b43('0x2e')][_0x1b43('0x30')]));_0x194562['attributes']=_0x194562[_0x1b43('0x31')][_0x1b43('0x32')]?_0x194562[_0x1b43('0x31')]:_0x22680c[_0x1b43('0x2b')];if(_0x5e155f[_0x1b43('0x2e')][_0x1b43('0x3f')]){_0x194562['include']=[{'all':!![]}];}_0x194562=_[_0x1b43('0x38')]({},_0x194562,_0x5e155f[_0x1b43('0x3e')]);return db[_0x1b43('0x29')][_0x1b43('0x46')](_0x194562)[_0x1b43('0x22')](handleEntityNotFound(_0x189f0e,null))[_0x1b43('0x22')](respondWithResult(_0x189f0e,null))[_0x1b43('0x43')](handleError(_0x189f0e,null));};exports['create']=function(_0x1d791b,_0x37fac3){return db['VoiceDialReport'][_0x1b43('0x47')](_0x1d791b[_0x1b43('0x48')],{})['then'](respondWithResult(_0x37fac3,0xc9))[_0x1b43('0x43')](handleError(_0x37fac3,null));};exports['update']=function(_0x162579,_0x2d86e8){if(_0x162579[_0x1b43('0x48')]['id']){delete _0x162579[_0x1b43('0x48')]['id'];}return db[_0x1b43('0x29')][_0x1b43('0x46')]({'where':{'id':_0x162579[_0x1b43('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d86e8,null))[_0x1b43('0x22')](saveUpdates(_0x162579[_0x1b43('0x48')],null))['then'](respondWithResult(_0x2d86e8,null))[_0x1b43('0x43')](handleError(_0x2d86e8,null));};exports[_0x1b43('0x23')]=function(_0x340efa,_0x2df52a){return db[_0x1b43('0x29')][_0x1b43('0x46')]({'where':{'id':_0x340efa[_0x1b43('0x45')]['id']}})[_0x1b43('0x22')](handleEntityNotFound(_0x2df52a,null))[_0x1b43('0x22')](removeEntity(_0x2df52a,null))[_0x1b43('0x43')](handleError(_0x2df52a,null));};exports[_0x1b43('0x49')]=function(_0x42c220,_0x73175c){return db['VoiceDialReport'][_0x1b43('0x49')]()[_0x1b43('0x22')](respondWithResult(_0x73175c,null))[_0x1b43('0x43')](handleError(_0x73175c,null));}; \ No newline at end of file +var _0xd6da=['hasOwnProperty','limit','order','sort','where','pick','filter','map','key','VIRTUAL','field','merge','options','include','rows','show','filters','length','includeAll','catch','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','then','destroy','end','stack','name','send','index','VoiceDialReport','rawAttributes','model','keys','query','intersection','attributes','fields'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd6da,0x1c9));var _0xad6d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6da[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xad6d('0x0'));var emlformat=require(_0xad6d('0x1'));var rimraf=require(_0xad6d('0x2'));var zipdir=require(_0xad6d('0x3'));var jsonpatch=require(_0xad6d('0x4'));var rp=require(_0xad6d('0x5'));var moment=require(_0xad6d('0x6'));var BPromise=require(_0xad6d('0x7'));var Mustache=require(_0xad6d('0x8'));var util=require('util');var path=require('path');var sox=require(_0xad6d('0x9'));var csv=require(_0xad6d('0xa'));var ejs=require(_0xad6d('0xb'));var fs=require('fs');var _=require(_0xad6d('0xc'));var squel=require(_0xad6d('0xd'));var crypto=require(_0xad6d('0xe'));var jsforce=require(_0xad6d('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xad6d('0x10'));var authService=require(_0xad6d('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xad6d('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0xad6d('0x13'))(_0xad6d('0x14'));var utils=require(_0xad6d('0x15'));var config=require(_0xad6d('0x16'));var db=require(_0xad6d('0x17'))['db'];function respondWithStatusCode(_0x2f4a26,_0x1e53ac){_0x1e53ac=_0x1e53ac||0xcc;return function(_0x21c845){if(_0x21c845){return _0x2f4a26[_0xad6d('0x18')](_0x1e53ac);}return _0x2f4a26[_0xad6d('0x19')](_0x1e53ac)['end']();};}function respondWithResult(_0x3d6f89,_0x13b702){_0x13b702=_0x13b702||0xc8;return function(_0x32955f){if(_0x32955f){return _0x3d6f89['status'](_0x13b702)['json'](_0x32955f);}};}function respondWithFilteredResult(_0x248e31,_0x51ebc3){return function(_0x459bbf){if(_0x459bbf){var _0x668487=_0x459bbf[_0xad6d('0x1a')],_0x26602d=_0x51ebc3[_0xad6d('0x1b')],_0xbca2b5=_0x51ebc3['offset']+_0x51ebc3['limit'],_0x902668;if(_0xbca2b5>=_0x668487){_0xbca2b5=_0x668487;_0x902668=0xc8;}else{_0x902668=0xce;}_0x248e31[_0xad6d('0x19')](_0x902668);return _0x248e31[_0xad6d('0x1c')](_0xad6d('0x1d'),_0x26602d+'-'+_0xbca2b5+'/'+_0x668487)[_0xad6d('0x1e')](_0x459bbf);}return null;};}function patchUpdates(_0x195828){return function(_0x1f8d93){try{jsonpatch[_0xad6d('0x1f')](_0x1f8d93,_0x195828,!![]);}catch(_0x3dabd9){return BPromise['reject'](_0x3dabd9);}return _0x1f8d93['save']();};}function saveUpdates(_0x5e72ef,_0x264119){return function(_0x161ebe){if(_0x161ebe){return _0x161ebe['update'](_0x5e72ef)[_0xad6d('0x20')](function(_0x520a31){return _0x520a31;});}return null;};}function removeEntity(_0x4e7d31,_0x36c4ae){return function(_0x16c2cb){if(_0x16c2cb){return _0x16c2cb[_0xad6d('0x21')]()['then'](function(){_0x4e7d31[_0xad6d('0x19')](0xcc)[_0xad6d('0x22')]();});}};}function handleEntityNotFound(_0x18dfe6,_0x58a86c){return function(_0x4f26a8){if(!_0x4f26a8){_0x18dfe6[_0xad6d('0x18')](0x194);}return _0x4f26a8;};}function handleError(_0x4c8b7f,_0x3f9a17){_0x3f9a17=_0x3f9a17||0x1f4;return function(_0x2f66b7){logger['error'](_0x2f66b7[_0xad6d('0x23')]);if(_0x2f66b7[_0xad6d('0x24')]){delete _0x2f66b7[_0xad6d('0x24')];}_0x4c8b7f[_0xad6d('0x19')](_0x3f9a17)[_0xad6d('0x25')](_0x2f66b7);};}exports[_0xad6d('0x26')]=function(_0x4b047b,_0x3c277a){var _0x4051b3={},_0x33f731={},_0x22278e={'count':0x0,'rows':[]};var _0x2744a6=db[_0xad6d('0x27')][_0xad6d('0x28')];_0x33f731[_0xad6d('0x29')]=_[_0xad6d('0x2a')](_0x2744a6);_0x33f731[_0xad6d('0x2b')]=_['keys'](_0x4b047b[_0xad6d('0x2b')]);_0x33f731['filters']=_[_0xad6d('0x2c')](_0x33f731[_0xad6d('0x29')],_0x33f731[_0xad6d('0x2b')]);_0x4051b3[_0xad6d('0x2d')]=_[_0xad6d('0x2c')](_0x33f731[_0xad6d('0x29')],qs[_0xad6d('0x2e')](_0x4b047b[_0xad6d('0x2b')]['fields']));_0x4051b3[_0xad6d('0x2d')]=_0x4051b3[_0xad6d('0x2d')]['length']?_0x4051b3[_0xad6d('0x2d')]:_0x33f731[_0xad6d('0x29')];if(!_0x4b047b[_0xad6d('0x2b')][_0xad6d('0x2f')]('nolimit')){_0x4051b3['limit']=qs[_0xad6d('0x30')](_0x4b047b['query'][_0xad6d('0x30')]);_0x4051b3['offset']=qs[_0xad6d('0x1b')](_0x4b047b['query'][_0xad6d('0x1b')]);}_0x4051b3[_0xad6d('0x31')]=qs[_0xad6d('0x32')](_0x4b047b[_0xad6d('0x2b')][_0xad6d('0x32')]);_0x4051b3[_0xad6d('0x33')]=qs['filters'](_[_0xad6d('0x34')](_0x4b047b[_0xad6d('0x2b')],_0x33f731['filters']));if(_0x4b047b[_0xad6d('0x2b')][_0xad6d('0x35')]){_0x4051b3[_0xad6d('0x33')]=_['merge'](_0x4051b3['where'],{'$or':_[_0xad6d('0x36')](_0x2744a6,function(_0x421ffe){if(_0x421ffe['type'][_0xad6d('0x37')]!==_0xad6d('0x38')){var _0x134a2a={};_0x134a2a[_0x421ffe[_0xad6d('0x39')]]={'$like':'%'+_0x4b047b[_0xad6d('0x2b')][_0xad6d('0x35')]+'%'};return _0x134a2a;}})});}_0x4051b3=_[_0xad6d('0x3a')]({},_0x4051b3,_0x4b047b[_0xad6d('0x3b')]);var _0x2c2bd4={'where':_0x4051b3[_0xad6d('0x33')]};return db['VoiceDialReport'][_0xad6d('0x1a')](_0x2c2bd4)['then'](function(_0x597a72){_0x22278e['count']=_0x597a72;if(_0x4b047b[_0xad6d('0x2b')]['includeAll']){_0x4051b3[_0xad6d('0x3c')]=[{'all':!![]}];}return db[_0xad6d('0x27')]['findAll'](_0x4051b3);})[_0xad6d('0x20')](function(_0x1621cb){_0x22278e[_0xad6d('0x3d')]=_0x1621cb;return _0x22278e;})[_0xad6d('0x20')](respondWithFilteredResult(_0x3c277a,_0x4051b3))['catch'](handleError(_0x3c277a,null));};exports[_0xad6d('0x3e')]=function(_0x5c30b2,_0xbfa624){var _0xe29c28={'raw':!![],'where':{'id':_0x5c30b2['params']['id']}},_0x37b489={};_0x37b489[_0xad6d('0x29')]=_[_0xad6d('0x2a')](db[_0xad6d('0x27')]['rawAttributes']);_0x37b489['query']=_[_0xad6d('0x2a')](_0x5c30b2[_0xad6d('0x2b')]);_0x37b489[_0xad6d('0x3f')]=_[_0xad6d('0x2c')](_0x37b489[_0xad6d('0x29')],_0x37b489[_0xad6d('0x2b')]);_0xe29c28[_0xad6d('0x2d')]=_['intersection'](_0x37b489['model'],qs[_0xad6d('0x2e')](_0x5c30b2[_0xad6d('0x2b')][_0xad6d('0x2e')]));_0xe29c28['attributes']=_0xe29c28[_0xad6d('0x2d')][_0xad6d('0x40')]?_0xe29c28[_0xad6d('0x2d')]:_0x37b489[_0xad6d('0x29')];if(_0x5c30b2[_0xad6d('0x2b')][_0xad6d('0x41')]){_0xe29c28[_0xad6d('0x3c')]=[{'all':!![]}];}_0xe29c28=_[_0xad6d('0x3a')]({},_0xe29c28,_0x5c30b2[_0xad6d('0x3b')]);return db[_0xad6d('0x27')]['find'](_0xe29c28)[_0xad6d('0x20')](handleEntityNotFound(_0xbfa624,null))[_0xad6d('0x20')](respondWithResult(_0xbfa624,null))[_0xad6d('0x42')](handleError(_0xbfa624,null));};exports[_0xad6d('0x43')]=function(_0x29a442,_0x5efc5f){return db[_0xad6d('0x27')]['create'](_0x29a442[_0xad6d('0x44')],{})[_0xad6d('0x20')](respondWithResult(_0x5efc5f,0xc9))[_0xad6d('0x42')](handleError(_0x5efc5f,null));};exports[_0xad6d('0x45')]=function(_0x32aa56,_0x1931ca){if(_0x32aa56[_0xad6d('0x44')]['id']){delete _0x32aa56[_0xad6d('0x44')]['id'];}return db[_0xad6d('0x27')][_0xad6d('0x46')]({'where':{'id':_0x32aa56['params']['id']}})['then'](handleEntityNotFound(_0x1931ca,null))[_0xad6d('0x20')](saveUpdates(_0x32aa56[_0xad6d('0x44')],null))[_0xad6d('0x20')](respondWithResult(_0x1931ca,null))[_0xad6d('0x42')](handleError(_0x1931ca,null));};exports[_0xad6d('0x21')]=function(_0x54ba3a,_0xd00342){return db[_0xad6d('0x27')][_0xad6d('0x46')]({'where':{'id':_0x54ba3a['params']['id']}})[_0xad6d('0x20')](handleEntityNotFound(_0xd00342,null))[_0xad6d('0x20')](removeEntity(_0xd00342,null))[_0xad6d('0x42')](handleError(_0xd00342,null));};exports['describe']=function(_0x17a71a,_0x357ce7){return db[_0xad6d('0x27')][_0xad6d('0x47')]()[_0xad6d('0x20')](respondWithResult(_0x357ce7,null))[_0xad6d('0x42')](handleError(_0x357ce7,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a68a4b8..f1639f7 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 _0x06e7=['./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','../../config/logger','api','moment','request-promise'];(function(_0x2b84d5,_0x428914){var _0x51452a=function(_0x3ddc9c){while(--_0x3ddc9c){_0x2b84d5['push'](_0x2b84d5['shift']());}};_0x51452a(++_0x428914);}(_0x06e7,0x1a9));var _0x706e=function(_0x2fc5d8,_0x254759){_0x2fc5d8=_0x2fc5d8-0x0;var _0xb82c5e=_0x06e7[_0x2fc5d8];return _0xb82c5e;};'use strict';var _=require(_0x706e('0x0'));var util=require('util');var logger=require(_0x706e('0x1'))(_0x706e('0x2'));var moment=require(_0x706e('0x3'));var BPromise=require('bluebird');var rp=require(_0x706e('0x4'));var attributes=require(_0x706e('0x5'));module[_0x706e('0x6')]=function(_0x1f5026,_0x276766){return _0x1f5026[_0x706e('0x7')](_0x706e('0x8'),attributes,{'tableName':_0x706e('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe37=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceDialReport.attributes','define','VoiceDialReport','report_dial'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xfe37,0x1a2));var _0x7fe3=function(_0x5f21fb,_0xb6f747){_0x5f21fb=_0x5f21fb-0x0;var _0x52144a=_0xfe37[_0x5f21fb];return _0x52144a;};'use strict';var _=require(_0x7fe3('0x0'));var util=require(_0x7fe3('0x1'));var logger=require(_0x7fe3('0x2'))(_0x7fe3('0x3'));var moment=require(_0x7fe3('0x4'));var BPromise=require(_0x7fe3('0x5'));var rp=require(_0x7fe3('0x6'));var attributes=require(_0x7fe3('0x7'));module['exports']=function(_0x9e5afb,_0x41834e){return _0x9e5afb[_0x7fe3('0x8')](_0x7fe3('0x9'),attributes,{'tableName':_0x7fe3('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index e3f3193..393f44b 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 _0xfa20=['UpdateVoiceDialReport','update','body','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','options','raw'];(function(_0xefa9b,_0x545095){var _0x10bcca=function(_0x52612d){while(--_0x52612d){_0xefa9b['push'](_0xefa9b['shift']());}};_0x10bcca(++_0x545095);}(_0xfa20,0x141));var _0x0fa2=function(_0x502417,_0x3b4a19){_0x502417=_0x502417-0x0;var _0x32e1f8=_0xfa20[_0x502417];return _0x32e1f8;};'use strict';var _=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var moment=require(_0x0fa2('0x2'));var BPromise=require(_0x0fa2('0x3'));var rs=require(_0x0fa2('0x4'));var fs=require('fs');var Redis=require(_0x0fa2('0x5'));var db=require(_0x0fa2('0x6'))['db'];var utils=require(_0x0fa2('0x7'));var logger=require(_0x0fa2('0x8'))(_0x0fa2('0x9'));var config=require(_0x0fa2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0fa2('0xb')][_0x0fa2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59b8ad,_0xf03dd3,_0x3fde44){return new BPromise(function(_0x1f3223,_0x11979c){return client[_0x0fa2('0xd')](_0x59b8ad,_0x3fde44)[_0x0fa2('0xe')](function(_0x3ec7f3){logger[_0x0fa2('0xf')](_0x0fa2('0x10'),_0xf03dd3,_0x0fa2('0x11'));logger['debug'](_0x0fa2('0x12'),_0xf03dd3,_0x0fa2('0x11'),JSON[_0x0fa2('0x13')](_0x3ec7f3));if(_0x3ec7f3[_0x0fa2('0x14')]){if(_0x3ec7f3[_0x0fa2('0x14')][_0x0fa2('0x15')]===0x1f4){logger[_0x0fa2('0x14')](_0x0fa2('0x10'),_0xf03dd3,_0x3ec7f3['error'][_0x0fa2('0x16')]);return _0x11979c(_0x3ec7f3['error'][_0x0fa2('0x16')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0xf03dd3,_0x3ec7f3['error'][_0x0fa2('0x16')]);return _0x1f3223(_0x3ec7f3[_0x0fa2('0x14')][_0x0fa2('0x16')]);}else{logger[_0x0fa2('0xf')](_0x0fa2('0x10'),_0xf03dd3,_0x0fa2('0x11'));_0x1f3223(_0x3ec7f3[_0x0fa2('0x17')][_0x0fa2('0x16')]);}})['catch'](function(_0x3cf25f){logger[_0x0fa2('0x14')](_0x0fa2('0x10'),_0xf03dd3,_0x3cf25f);_0x11979c(_0x3cf25f);});});}exports[_0x0fa2('0x18')]=function(_0x40f402){var _0x303ab8=this;return new Promise(function(_0x2083a0,_0x1b2da7){return db[_0x0fa2('0x19')][_0x0fa2('0x1a')](_0x40f402['body'],{'raw':_0x40f402['options']?_0x40f402[_0x0fa2('0x1b')][_0x0fa2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x383ebd){logger[_0x0fa2('0xf')](_0x0fa2('0x18'),_0x40f402);logger['debug'](_0x0fa2('0x18'),_0x40f402,JSON[_0x0fa2('0x13')](_0x383ebd));_0x2083a0(_0x383ebd);})['catch'](function(_0x3b51bc){logger['error'](_0x0fa2('0x18'),_0x3b51bc[_0x0fa2('0x16')],_0x40f402);_0x1b2da7(_0x303ab8[_0x0fa2('0x14')](0x1f4,_0x3b51bc[_0x0fa2('0x16')]));});});};exports[_0x0fa2('0x1d')]=function(_0x4d921b){var _0x4744ca=this;return new Promise(function(_0x47395f,_0x111028){return db[_0x0fa2('0x19')][_0x0fa2('0x1e')](_0x4d921b[_0x0fa2('0x1f')],{'raw':_0x4d921b[_0x0fa2('0x1b')]?_0x4d921b['options'][_0x0fa2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d921b['options']?_0x4d921b[_0x0fa2('0x1b')]['where']||null:null,'attributes':_0x4d921b[_0x0fa2('0x1b')]?_0x4d921b[_0x0fa2('0x1b')][_0x0fa2('0x20')]||null:null,'limit':_0x4d921b[_0x0fa2('0x1b')]?_0x4d921b[_0x0fa2('0x1b')][_0x0fa2('0x21')]||null:null})['then'](function(_0xda3cdf){logger['info']('UpdateVoiceDialReport',_0x4d921b);logger[_0x0fa2('0x22')](_0x0fa2('0x1d'),_0x4d921b,JSON[_0x0fa2('0x13')](_0xda3cdf));_0x47395f(_0xda3cdf);})['catch'](function(_0x5c371c){logger['error']('UpdateVoiceDialReport',_0x5c371c['message'],_0x4d921b);_0x111028(_0x4744ca[_0x0fa2('0x14')](0x1f4,_0x5c371c[_0x0fa2('0x16')]));});});}; \ No newline at end of file +var _0x1542=['message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','limit','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','VoiceDialReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1542,0x116));var _0x2154=function(_0x21a7ff,_0x5d8291){_0x21a7ff=_0x21a7ff-0x0;var _0x1d60ea=_0x1542[_0x21a7ff];return _0x1d60ea;};'use strict';var _=require(_0x2154('0x0'));var util=require(_0x2154('0x1'));var moment=require(_0x2154('0x2'));var BPromise=require(_0x2154('0x3'));var rs=require(_0x2154('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2154('0x5'))['db'];var utils=require(_0x2154('0x6'));var logger=require(_0x2154('0x7'))('rpc');var config=require(_0x2154('0x8'));var jayson=require(_0x2154('0x9'));var client=jayson['client'][_0x2154('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23abb5,_0x257835,_0x791345){return new BPromise(function(_0x2e6295,_0x3696f3){return client[_0x2154('0xb')](_0x23abb5,_0x791345)[_0x2154('0xc')](function(_0x39f2c9){logger[_0x2154('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x257835,_0x2154('0xe'));logger[_0x2154('0xf')](_0x2154('0x10'),_0x257835,_0x2154('0xe'),JSON['stringify'](_0x39f2c9));if(_0x39f2c9[_0x2154('0x11')]){if(_0x39f2c9[_0x2154('0x11')]['code']===0x1f4){logger[_0x2154('0x11')](_0x2154('0x12'),_0x257835,_0x39f2c9[_0x2154('0x11')][_0x2154('0x13')]);return _0x3696f3(_0x39f2c9[_0x2154('0x11')][_0x2154('0x13')]);}logger[_0x2154('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x257835,_0x39f2c9['error'][_0x2154('0x13')]);return _0x2e6295(_0x39f2c9['error'][_0x2154('0x13')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x257835,'request\x20sent');_0x2e6295(_0x39f2c9[_0x2154('0x14')]['message']);}})[_0x2154('0x15')](function(_0x4f9308){logger[_0x2154('0x11')](_0x2154('0x12'),_0x257835,_0x4f9308);_0x3696f3(_0x4f9308);});});}exports[_0x2154('0x16')]=function(_0x35b468){var _0x14d29a=this;return new Promise(function(_0x46b72c,_0x15c197){return db[_0x2154('0x17')][_0x2154('0x18')](_0x35b468[_0x2154('0x19')],{'raw':_0x35b468['options']?_0x35b468[_0x2154('0x1a')][_0x2154('0x1b')]===undefined?!![]:![]:!![]})[_0x2154('0xc')](function(_0x57bc6a){logger[_0x2154('0xd')](_0x2154('0x16'),_0x35b468);logger[_0x2154('0xf')](_0x2154('0x16'),_0x35b468,JSON['stringify'](_0x57bc6a));_0x46b72c(_0x57bc6a);})[_0x2154('0x15')](function(_0xb10044){logger[_0x2154('0x11')]('CreateVoiceDialReport',_0xb10044['message'],_0x35b468);_0x15c197(_0x14d29a[_0x2154('0x11')](0x1f4,_0xb10044[_0x2154('0x13')]));});});};exports[_0x2154('0x1c')]=function(_0x4ef4f7){var _0x54ba3b=this;return new Promise(function(_0x177b33,_0x33f1a0){return db[_0x2154('0x17')][_0x2154('0x1d')](_0x4ef4f7['body'],{'raw':_0x4ef4f7[_0x2154('0x1a')]?_0x4ef4f7[_0x2154('0x1a')][_0x2154('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ef4f7['options']?_0x4ef4f7['options'][_0x2154('0x1e')]||null:null,'attributes':_0x4ef4f7[_0x2154('0x1a')]?_0x4ef4f7[_0x2154('0x1a')]['attributes']||null:null,'limit':_0x4ef4f7[_0x2154('0x1a')]?_0x4ef4f7[_0x2154('0x1a')][_0x2154('0x1f')]||null:null})[_0x2154('0xc')](function(_0x375a57){logger['info'](_0x2154('0x1c'),_0x4ef4f7);logger[_0x2154('0xf')](_0x2154('0x1c'),_0x4ef4f7,JSON[_0x2154('0x20')](_0x375a57));_0x177b33(_0x375a57);})[_0x2154('0x15')](function(_0x2dee3e){logger[_0x2154('0x11')]('UpdateVoiceDialReport',_0x2dee3e[_0x2154('0x13')],_0x4ef4f7);_0x33f1a0(_0x54ba3b[_0x2154('0x11')](0x1f4,_0x2dee3e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index b6c0a8e..ee4d462 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 _0x174b=['post','create','put','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x379c62,_0x536566){var _0x5ca155=function(_0x384a71){while(--_0x384a71){_0x379c62['push'](_0x379c62['shift']());}};_0x5ca155(++_0x536566);}(_0x174b,0x19d));var _0xb174=function(_0x478861,_0x41f1de){_0x478861=_0x478861-0x0;var _0x5badfe=_0x174b[_0x478861];return _0x5badfe;};'use strict';var multer=require(_0xb174('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb174('0x1'));var express=require(_0xb174('0x2'));var router=express[_0xb174('0x3')]();var auth=require(_0xb174('0x4'));var interaction=require(_0xb174('0x5'));var config=require(_0xb174('0x6'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0xb174('0x7')](),controller[_0xb174('0x8')]);router[_0xb174('0x9')](_0xb174('0xa'),auth[_0xb174('0x7')](),controller[_0xb174('0xb')]);router[_0xb174('0xc')]('/',auth[_0xb174('0x7')](),controller[_0xb174('0xd')]);router[_0xb174('0xc')]('/:id/applications',auth[_0xb174('0x7')](),controller['addApplications']);router[_0xb174('0xe')](_0xb174('0xa'),auth['isAuthenticated'](),controller[_0xb174('0xf')]);router['delete'](_0xb174('0xa'),auth[_0xb174('0x7')](),controller['destroy']);module[_0xb174('0x10')]=router; \ No newline at end of file +var _0x2c91=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','/:id/applications','addApplications'];(function(_0x31737a,_0x49f148){var _0x37c46e=function(_0x44bb7e){while(--_0x44bb7e){_0x31737a['push'](_0x31737a['shift']());}};_0x37c46e(++_0x49f148);}(_0x2c91,0x158));var _0x12c9=function(_0x58153e,_0x2f91cd){_0x58153e=_0x58153e-0x0;var _0x263984=_0x2c91[_0x58153e];return _0x263984;};'use strict';var multer=require(_0x12c9('0x0'));var util=require(_0x12c9('0x1'));var path=require(_0x12c9('0x2'));var timeout=require(_0x12c9('0x3'));var express=require(_0x12c9('0x4'));var router=express[_0x12c9('0x5')]();var auth=require(_0x12c9('0x6'));var interaction=require(_0x12c9('0x7'));var config=require('../../config/environment');var controller=require(_0x12c9('0x8'));router[_0x12c9('0x9')]('/',auth[_0x12c9('0xa')](),controller[_0x12c9('0xb')]);router[_0x12c9('0x9')](_0x12c9('0xc'),auth[_0x12c9('0xa')](),controller['show']);router[_0x12c9('0xd')]('/',auth[_0x12c9('0xa')](),controller['create']);router[_0x12c9('0xd')](_0x12c9('0xe'),auth['isAuthenticated'](),controller[_0x12c9('0xf')]);router[_0x12c9('0x10')]('/:id',auth[_0x12c9('0xa')](),controller[_0x12c9('0x11')]);router['delete'](_0x12c9('0xc'),auth[_0x12c9('0xa')](),controller[_0x12c9('0x12')]);module[_0x12c9('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 1e7f01f..3318af4 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 _0xbdb7=['outbound','outbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound'];(function(_0x4ac48d,_0x171a68){var _0x7537af=function(_0x1c6ca6){while(--_0x1c6ca6){_0x4ac48d['push'](_0x4ac48d['shift']());}};_0x7537af(++_0x171a68);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x339da2,_0x3aa23a){_0x339da2=_0x339da2-0x0;var _0x4c6e10=_0xbdb7[_0x339da2];return _0x4c6e10;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'context':{'type':Sequelize[_0x7bdb('0x2')],'allowNull':![],'unique':_0x7bdb('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7bdb('0x2')],'allowNull':![],'unique':_0x7bdb('0x3')},'priority':{'type':Sequelize[_0x7bdb('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x7bdb('0x3')},'tag':{'type':Sequelize[_0x7bdb('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7bdb('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x7bdb('0x5'),_0x7bdb('0x6'),'internal','inbound-fax',_0x7bdb('0x7'),_0x7bdb('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7bdb('0x2')],'allowNull':![],'defaultValue':_0x7bdb('0x9')},'IntervalId':{'type':Sequelize[_0x7bdb('0xa')]},'isApp':{'type':Sequelize[_0x7bdb('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7bdb('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x7bdb('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7bdb('0xa')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x7bdb('0xc')],'get':function(_0x25e3cb){return this['getDataValue'](_0x7bdb('0xd'));}}}; \ No newline at end of file +var _0x6f7a=['INTEGER','wav','BOOLEAN','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','system','any','*,*,*,*'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x441737,_0x158ac5){_0x441737=_0x441737-0x0;var _0x2a16b6=_0x6f7a[_0x441737];return _0x2a16b6;};'use strict';var Sequelize=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]={'context':{'type':Sequelize[_0xa6f7('0x2')],'allowNull':![],'unique':_0xa6f7('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa6f7('0x3')},'priority':{'type':Sequelize[_0xa6f7('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xa6f7('0x3')},'tag':{'type':Sequelize[_0xa6f7('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xa6f7('0x2')],'allowNull':![],'defaultValue':_0xa6f7('0x4')},'appdata':{'type':Sequelize[_0xa6f7('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xa6f7('0x5')](_0xa6f7('0x6'),_0xa6f7('0x7'),_0xa6f7('0x8'),'inbound-fax','outbound-fax',_0xa6f7('0x9'),_0xa6f7('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xa6f7('0x2')]},'interval':{'type':Sequelize[_0xa6f7('0x2')],'allowNull':![],'defaultValue':_0xa6f7('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xa6f7('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xa6f7('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xa6f7('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xa6f7('0xd')},'answer':{'type':Sequelize[_0xa6f7('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0xa6f7('0xf')],'get':function(_0xd5558b){return this['getDataValue'](_0xa6f7('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 381d018..a0858f5 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 _0x8a8b=['./voiceExtension.socket','register','sendStatus','status','end','count','limit','json','apply','reject','update','destroy','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','find','UserProfileResource','then','error','stack','VoiceExtension','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','key','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','body','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','name','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','mandatoryDisposition','addApplications','findOne','sequelize','VoiceExtensionId','html-pdf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x65bebd,_0x482737){var _0x47f67f=function(_0x200d69){while(--_0x200d69){_0x65bebd['push'](_0x65bebd['shift']());}};_0x47f67f(++_0x482737);}(_0x8a8b,0xae));var _0xb8a8=function(_0x4667ec,_0x593a64){_0x4667ec=_0x4667ec-0x0;var _0x2126c8=_0x8a8b[_0x4667ec];return _0x2126c8;};'use strict';var pdf=require(_0xb8a8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb8a8('0x1'));var jsonpatch=require(_0xb8a8('0x2'));var rp=require('request-promise');var moment=require(_0xb8a8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb8a8('0x4'));var util=require('util');var path=require(_0xb8a8('0x5'));var sox=require(_0xb8a8('0x6'));var csv=require(_0xb8a8('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb8a8('0x8'));var squel=require('squel');var crypto=require(_0xb8a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb8a8('0xa'));var toCsv=require(_0xb8a8('0x7'));var querystring=require(_0xb8a8('0xb'));var Papa=require('papaparse');var authService=require(_0xb8a8('0xc'));var hardwareService=require(_0xb8a8('0xd'));var Redis=require(_0xb8a8('0xe'));var qs=require(_0xb8a8('0xf'));var logger=require(_0xb8a8('0x10'))(_0xb8a8('0x11'));var utils=require(_0xb8a8('0x12'));var config=require(_0xb8a8('0x13'));var db=require(_0xb8a8('0x14'))['db'];config[_0xb8a8('0x15')]=_[_0xb8a8('0x16')](config[_0xb8a8('0x15')],{'host':_0xb8a8('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb8a8('0x15')]));require(_0xb8a8('0x18'))[_0xb8a8('0x19')](socket);function respondWithStatusCode(_0xad6499,_0x42fb99){_0x42fb99=_0x42fb99||0xcc;return function(_0xf3750e){if(_0xf3750e){return _0xad6499[_0xb8a8('0x1a')](_0x42fb99);}return _0xad6499[_0xb8a8('0x1b')](_0x42fb99)[_0xb8a8('0x1c')]();};}function respondWithResult(_0x3d96dc,_0x3ca02e){_0x3ca02e=_0x3ca02e||0xc8;return function(_0x4f6cd0){if(_0x4f6cd0){return _0x3d96dc[_0xb8a8('0x1b')](_0x3ca02e)['json'](_0x4f6cd0);}};}function respondWithFilteredResult(_0x9bd9af,_0x1cb45a){return function(_0x412041){if(_0x412041){var _0x72df=_0x412041[_0xb8a8('0x1d')],_0x121be4=_0x1cb45a['offset'],_0x1ab317=_0x1cb45a['offset']+_0x1cb45a[_0xb8a8('0x1e')],_0x1d0898;if(_0x1ab317>=_0x72df){_0x1ab317=_0x72df;_0x1d0898=0xc8;}else{_0x1d0898=0xce;}_0x9bd9af['status'](_0x1d0898);return _0x9bd9af['set']('Content-Range',_0x121be4+'-'+_0x1ab317+'/'+_0x72df)[_0xb8a8('0x1f')](_0x412041);}return null;};}function patchUpdates(_0x44cdee){return function(_0x421b58){try{jsonpatch[_0xb8a8('0x20')](_0x421b58,_0x44cdee,!![]);}catch(_0x380fcb){return BPromise[_0xb8a8('0x21')](_0x380fcb);}return _0x421b58['save']();};}function saveUpdates(_0x17c2b8,_0x9ca4b){return function(_0x1a3ff2){if(_0x1a3ff2){return _0x1a3ff2[_0xb8a8('0x22')](_0x17c2b8)['then'](function(_0x404ca5){return _0x404ca5;});}return null;};}function removeEntity(_0x55c6aa,_0x32aba6){return function(_0x4bc82a){if(_0x4bc82a){return _0x4bc82a[_0xb8a8('0x23')]()['then'](function(){var _0x4ede21=_0x4bc82a['get']({'plain':!![]});var _0x5dadd6=[{'name':_0xb8a8('0x24'),'value':_0xb8a8('0x25'),'ignore':![]},{'name':_0xb8a8('0x26'),'value':_0xb8a8('0x27'),'ignore':![]},{'name':_0xb8a8('0x28'),'value':'internal','ignore':![]}];var _0x375db6=_(_0x5dadd6)[_0xb8a8('0x29')](_0xb8a8('0x2a'))[_0xb8a8('0x2b')](_0xb8a8('0x2c'))['value']();if(_[_0xb8a8('0x2d')](_0x375db6,_0x4ede21[_0xb8a8('0x2e')])){return;}var _0xe1772e=_[_0xb8a8('0x2f')](_0x5dadd6,[_0xb8a8('0x2c'),_0x4ede21['type']])['name'];return db[_0xb8a8('0x30')][_0xb8a8('0x23')]({'where':{'type':_0xe1772e,'resourceId':_0x4ede21['id']}})[_0xb8a8('0x31')](function(){return _0x4bc82a;});})[_0xb8a8('0x31')](function(){_0x55c6aa[_0xb8a8('0x1b')](0xcc)[_0xb8a8('0x1c')]();});}};}function handleEntityNotFound(_0x40daf7,_0x45049){return function(_0x1d17d1){if(!_0x1d17d1){_0x40daf7[_0xb8a8('0x1a')](0x194);}return _0x1d17d1;};}function handleError(_0x527c1d,_0x5aa416){_0x5aa416=_0x5aa416||0x1f4;return function(_0x180b39){logger[_0xb8a8('0x32')](_0x180b39[_0xb8a8('0x33')]);if(_0x180b39['name']){delete _0x180b39['name'];}_0x527c1d['status'](_0x5aa416)['send'](_0x180b39);};}exports['index']=function(_0x267866,_0x1baf40){var _0x1a6d18={},_0x58491c={},_0x21bfc6={'count':0x0,'rows':[]};var _0x139635=db[_0xb8a8('0x34')][_0xb8a8('0x35')];_0x58491c[_0xb8a8('0x36')]=_[_0xb8a8('0x37')](_0x139635);_0x58491c['query']=_[_0xb8a8('0x37')](_0x267866[_0xb8a8('0x38')]);_0x58491c[_0xb8a8('0x39')]=_[_0xb8a8('0x3a')](_0x58491c[_0xb8a8('0x36')],_0x58491c[_0xb8a8('0x38')]);_0x1a6d18['attributes']=_['intersection'](_0x58491c[_0xb8a8('0x36')],qs[_0xb8a8('0x3b')](_0x267866[_0xb8a8('0x38')][_0xb8a8('0x3b')]));_0x1a6d18[_0xb8a8('0x3c')]=_0x1a6d18[_0xb8a8('0x3c')][_0xb8a8('0x3d')]?_0x1a6d18['attributes']:_0x58491c[_0xb8a8('0x36')];if(!_0x267866[_0xb8a8('0x38')][_0xb8a8('0x3e')](_0xb8a8('0x3f'))){_0x1a6d18[_0xb8a8('0x1e')]=qs[_0xb8a8('0x1e')](_0x267866[_0xb8a8('0x38')][_0xb8a8('0x1e')]);_0x1a6d18[_0xb8a8('0x40')]=qs[_0xb8a8('0x40')](_0x267866[_0xb8a8('0x38')][_0xb8a8('0x40')]);}_0x1a6d18[_0xb8a8('0x41')]=qs[_0xb8a8('0x42')](_0x267866['query'][_0xb8a8('0x42')]);_0x1a6d18[_0xb8a8('0x43')]=qs[_0xb8a8('0x39')](_[_0xb8a8('0x44')](_0x267866[_0xb8a8('0x38')],_0x58491c[_0xb8a8('0x39')]));if(_0x267866[_0xb8a8('0x38')][_0xb8a8('0x29')]){_0x1a6d18['where']=_[_0xb8a8('0x45')](_0x1a6d18[_0xb8a8('0x43')],{'$or':_[_0xb8a8('0x2b')](_0x139635,function(_0x1c5977){if(_0x1c5977[_0xb8a8('0x2e')][_0xb8a8('0x46')]!==_0xb8a8('0x47')){var _0x12f9dc={};_0x12f9dc[_0x1c5977['field']]={'$like':'%'+_0x267866[_0xb8a8('0x38')][_0xb8a8('0x29')]+'%'};return _0x12f9dc;}})});}_0x1a6d18=_[_0xb8a8('0x45')]({},_0x1a6d18,_0x267866['options']);var _0x3590ac={'where':_0x1a6d18[_0xb8a8('0x43')]};return db[_0xb8a8('0x34')][_0xb8a8('0x1d')](_0x3590ac)['then'](function(_0x37e402){_0x21bfc6['count']=_0x37e402;if(_0x267866[_0xb8a8('0x38')]['includeAll']){_0x1a6d18[_0xb8a8('0x48')]=[{'all':!![]}];}return db[_0xb8a8('0x34')][_0xb8a8('0x49')](_0x1a6d18);})[_0xb8a8('0x31')](function(_0x237753){_0x21bfc6[_0xb8a8('0x4a')]=_0x237753;return _0x21bfc6;})[_0xb8a8('0x31')](respondWithFilteredResult(_0x1baf40,_0x1a6d18))[_0xb8a8('0x4b')](handleError(_0x1baf40,null));};exports[_0xb8a8('0x4c')]=function(_0x2ec8d3,_0x8b32fb){var _0x166ad5={'raw':![],'where':{'id':_0x2ec8d3[_0xb8a8('0x4d')]['id']}},_0x4fb3c2={};_0x4fb3c2['model']=_[_0xb8a8('0x37')](db['VoiceExtension'][_0xb8a8('0x35')]);_0x4fb3c2[_0xb8a8('0x38')]=_[_0xb8a8('0x37')](_0x2ec8d3[_0xb8a8('0x38')]);_0x4fb3c2[_0xb8a8('0x39')]=_[_0xb8a8('0x3a')](_0x4fb3c2[_0xb8a8('0x36')],_0x4fb3c2['query']);_0x166ad5[_0xb8a8('0x3c')]=_[_0xb8a8('0x3a')](_0x4fb3c2[_0xb8a8('0x36')],qs['fields'](_0x2ec8d3[_0xb8a8('0x38')][_0xb8a8('0x3b')]));_0x166ad5['attributes']=_0x166ad5['attributes'][_0xb8a8('0x3d')]?_0x166ad5[_0xb8a8('0x3c')]:_0x4fb3c2[_0xb8a8('0x36')];if(_0x2ec8d3['query'][_0xb8a8('0x4e')]){_0x166ad5[_0xb8a8('0x48')]=[{'all':!![]}];}_0x166ad5=_[_0xb8a8('0x45')]({},_0x166ad5,_0x2ec8d3[_0xb8a8('0x4f')]);return db['VoiceExtension'][_0xb8a8('0x2f')](_0x166ad5)[_0xb8a8('0x31')](handleEntityNotFound(_0x8b32fb,null))[_0xb8a8('0x31')](respondWithResult(_0x8b32fb,null))[_0xb8a8('0x4b')](handleError(_0x8b32fb,null));};exports['destroy']=function(_0xa46a18,_0x32f688){return db[_0xb8a8('0x34')][_0xb8a8('0x2f')]({'where':{'id':_0xa46a18[_0xb8a8('0x4d')]['id']}})[_0xb8a8('0x31')](handleEntityNotFound(_0x32f688,null))[_0xb8a8('0x31')](removeEntity(_0x32f688,null))['catch'](handleError(_0x32f688,null));};exports['create']=function(_0x823539,_0x2a7c05){if(_0x823539[_0xb8a8('0x50')][_0xb8a8('0x2e')]==='outbound'&&!_['startsWith'](_0x823539[_0xb8a8('0x50')][_0xb8a8('0x51')],'_')){_0x823539[_0xb8a8('0x50')][_0xb8a8('0x51')]='_'[_0xb8a8('0x52')](_0x823539['body']['exten']);}return db['VoiceExtension'][_0xb8a8('0x53')](_0x823539[_0xb8a8('0x50')],{'raw':![]})[_0xb8a8('0x31')](function(_0xbfaa7){var _0x40fea2=_0x823539[_0xb8a8('0x54')][_0xb8a8('0x55')]({'plain':!![]});if(!_0x40fea2)throw new Error(_0xb8a8('0x56'));if(_0x40fea2[_0xb8a8('0x57')]===_0xb8a8('0x54')){var _0x2d7f3e=_0xbfaa7[_0xb8a8('0x55')]({'plain':!![]});var _0x167bfa=[{'name':_0xb8a8('0x24'),'value':_0xb8a8('0x25')},{'name':_0xb8a8('0x26'),'value':_0xb8a8('0x27')},{'name':'InternalRoutes','value':'internal'}];var _0x5a7ada=_['find'](_0x167bfa,[_0xb8a8('0x2c'),_0x2d7f3e['type']])[_0xb8a8('0x58')];return db['UserProfileSection'][_0xb8a8('0x2f')]({'where':{'name':_0x5a7ada,'userProfileId':_0x40fea2[_0xb8a8('0x59')]},'raw':!![]})[_0xb8a8('0x31')](function(_0x383eed){if(_0x383eed&&_0x383eed[_0xb8a8('0x5a')]===0x0){return db['UserProfileResource'][_0xb8a8('0x53')]({'name':_0x2d7f3e['name'],'resourceId':_0x2d7f3e['id'],'type':_0x383eed[_0xb8a8('0x58')],'sectionId':_0x383eed['id']},{})['then'](function(){return _0xbfaa7;});}else{return _0xbfaa7;}})[_0xb8a8('0x4b')](function(_0x24f2c1){logger[_0xb8a8('0x32')](_0xb8a8('0x5b'),_0x24f2c1);throw _0x24f2c1;});}return _0xbfaa7;})[_0xb8a8('0x31')](respondWithResult(_0x2a7c05,0xc9))[_0xb8a8('0x4b')](handleError(_0x2a7c05,null));};exports[_0xb8a8('0x22')]=function(_0x1e7071,_0x37b77c){if(_0x1e7071[_0xb8a8('0x50')]['id']){delete _0x1e7071[_0xb8a8('0x50')]['id'];}return db['VoiceExtension'][_0xb8a8('0x2f')]({'where':{'id':_0x1e7071[_0xb8a8('0x4d')]['id']}})[_0xb8a8('0x31')](handleEntityNotFound(_0x37b77c,null))['then'](function(_0x147044){if(_0x147044){return db[_0xb8a8('0x34')][_0xb8a8('0x22')](_[_0xb8a8('0x44')](_0x1e7071[_0xb8a8('0x50')],['exten',_0xb8a8('0x5c'),'description',_0xb8a8('0x5d'),'cutdigits',_0xb8a8('0x5e')]),{'where':{'context':_0x147044[_0xb8a8('0x5c')],'exten':_0x147044['exten']},'individualHooks':!![]})['then'](function(_0x47a9fb){return _0x47a9fb;});}return null;})[_0xb8a8('0x31')](respondWithStatusCode(_0x37b77c,null))['catch'](handleError(_0x37b77c,null));};exports[_0xb8a8('0x5f')]=function(_0x1072d8,_0xfc1707,_0x260dd9){return db[_0xb8a8('0x34')][_0xb8a8('0x60')]({'where':{'id':_0x1072d8[_0xb8a8('0x4d')]['id']}})[_0xb8a8('0x31')](handleEntityNotFound(_0xfc1707,null))[_0xb8a8('0x31')](function(_0x522fb4){if(_0x522fb4){return db[_0xb8a8('0x61')]['transaction'](function(_0x39366e){return db[_0xb8a8('0x34')]['destroy']({'where':{'VoiceExtensionId':_0x1072d8[_0xb8a8('0x4d')]['id']},'transaction':_0x39366e})[_0xb8a8('0x31')](function(_0x45c8ec){var _0x3a6016=_[_0xb8a8('0x2b')](_0x1072d8[_0xb8a8('0x50')],function(_0x2b2069){_0x2b2069[_0xb8a8('0x62')]=_0x1072d8[_0xb8a8('0x4d')]['id'];return _0x2b2069;});return db[_0xb8a8('0x34')]['bulkCreate'](_0x3a6016,{'transaction':_0x39366e});});})['then'](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1072d8[_0xb8a8('0x4d')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xb8a8('0x31')](respondWithResult(_0xfc1707,null))[_0xb8a8('0x4b')](handleError(_0xfc1707,null));}; \ No newline at end of file +var _0xea81=['save','then','InboundRoutes','inbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','UserProfileResource','destroy','sendStatus','error','stack','index','rawAttributes','model','keys','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','key','field','merge','VoiceExtension','includeAll','include','findAll','catch','show','params','intersection','options','find','create','body','outbound','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','name','update','context','cutdigits','mandatoryDisposition','addApplications','findOne','transaction','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','count','offset','limit','set','json','apply','reject'];(function(_0x2da082,_0xb59d2b){var _0xc9b361=function(_0x41db5c){while(--_0x41db5c){_0x2da082['push'](_0x2da082['shift']());}};_0xc9b361(++_0xb59d2b);}(_0xea81,0x1ed));var _0x1ea8=function(_0x28a584,_0x53e1d5){_0x28a584=_0x28a584-0x0;var _0x1f121e=_0xea81[_0x28a584];return _0x1f121e;};'use strict';var pdf=require(_0x1ea8('0x0'));var emlformat=require(_0x1ea8('0x1'));var rimraf=require(_0x1ea8('0x2'));var zipdir=require(_0x1ea8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1ea8('0x4'));var BPromise=require(_0x1ea8('0x5'));var Mustache=require(_0x1ea8('0x6'));var util=require(_0x1ea8('0x7'));var path=require(_0x1ea8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ea8('0x9'));var squel=require(_0x1ea8('0xa'));var crypto=require(_0x1ea8('0xb'));var jsforce=require(_0x1ea8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1ea8('0xd'));var querystring=require(_0x1ea8('0xe'));var Papa=require(_0x1ea8('0xf'));var authService=require(_0x1ea8('0x10'));var hardwareService=require(_0x1ea8('0x11'));var Redis=require('ioredis');var qs=require(_0x1ea8('0x12'));var logger=require('../../config/logger')(_0x1ea8('0x13'));var utils=require(_0x1ea8('0x14'));var config=require(_0x1ea8('0x15'));var db=require(_0x1ea8('0x16'))['db'];config[_0x1ea8('0x17')]=_['defaults'](config['redis'],{'host':_0x1ea8('0x18'),'port':0x18eb});var socket=require(_0x1ea8('0x19'))(new Redis(config['redis']));require(_0x1ea8('0x1a'))[_0x1ea8('0x1b')](socket);function respondWithStatusCode(_0x97d328,_0x184601){_0x184601=_0x184601||0xcc;return function(_0x122406){if(_0x122406){return _0x97d328['sendStatus'](_0x184601);}return _0x97d328[_0x1ea8('0x1c')](_0x184601)[_0x1ea8('0x1d')]();};}function respondWithResult(_0x3e072d,_0x4f1197){_0x4f1197=_0x4f1197||0xc8;return function(_0x2d5b07){if(_0x2d5b07){return _0x3e072d[_0x1ea8('0x1c')](_0x4f1197)['json'](_0x2d5b07);}};}function respondWithFilteredResult(_0x5c053a,_0x3292bc){return function(_0x4b80f9){if(_0x4b80f9){var _0x46c78a=_0x4b80f9[_0x1ea8('0x1e')],_0x4cf432=_0x3292bc[_0x1ea8('0x1f')],_0x239c3d=_0x3292bc[_0x1ea8('0x1f')]+_0x3292bc[_0x1ea8('0x20')],_0x228391;if(_0x239c3d>=_0x46c78a){_0x239c3d=_0x46c78a;_0x228391=0xc8;}else{_0x228391=0xce;}_0x5c053a[_0x1ea8('0x1c')](_0x228391);return _0x5c053a[_0x1ea8('0x21')]('Content-Range',_0x4cf432+'-'+_0x239c3d+'/'+_0x46c78a)[_0x1ea8('0x22')](_0x4b80f9);}return null;};}function patchUpdates(_0x2a3b4c){return function(_0x1b0148){try{jsonpatch[_0x1ea8('0x23')](_0x1b0148,_0x2a3b4c,!![]);}catch(_0x106f33){return BPromise[_0x1ea8('0x24')](_0x106f33);}return _0x1b0148[_0x1ea8('0x25')]();};}function saveUpdates(_0x13f554,_0xad7ad3){return function(_0x247a47){if(_0x247a47){return _0x247a47['update'](_0x13f554)[_0x1ea8('0x26')](function(_0x489180){return _0x489180;});}return null;};}function removeEntity(_0x4276f0,_0x4e03ee){return function(_0x311e2e){if(_0x311e2e){return _0x311e2e['destroy']()[_0x1ea8('0x26')](function(){var _0x5106f7=_0x311e2e['get']({'plain':!![]});var _0x2d7b5c=[{'name':_0x1ea8('0x27'),'value':_0x1ea8('0x28'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x1ea8('0x29'),'value':_0x1ea8('0x2a'),'ignore':![]}];var _0x34e04b=_(_0x2d7b5c)[_0x1ea8('0x2b')](_0x1ea8('0x2c'))[_0x1ea8('0x2d')](_0x1ea8('0x2e'))['value']();if(_[_0x1ea8('0x2f')](_0x34e04b,_0x5106f7['type'])){return;}var _0x6129d4=_['find'](_0x2d7b5c,[_0x1ea8('0x2e'),_0x5106f7[_0x1ea8('0x30')]])['name'];return db[_0x1ea8('0x31')][_0x1ea8('0x32')]({'where':{'type':_0x6129d4,'resourceId':_0x5106f7['id']}})[_0x1ea8('0x26')](function(){return _0x311e2e;});})[_0x1ea8('0x26')](function(){_0x4276f0[_0x1ea8('0x1c')](0xcc)[_0x1ea8('0x1d')]();});}};}function handleEntityNotFound(_0x37cac7,_0x33d7c8){return function(_0x1091c2){if(!_0x1091c2){_0x37cac7[_0x1ea8('0x33')](0x194);}return _0x1091c2;};}function handleError(_0x3e236e,_0x39eb2d){_0x39eb2d=_0x39eb2d||0x1f4;return function(_0x752060){logger[_0x1ea8('0x34')](_0x752060[_0x1ea8('0x35')]);if(_0x752060['name']){delete _0x752060['name'];}_0x3e236e[_0x1ea8('0x1c')](_0x39eb2d)['send'](_0x752060);};}exports[_0x1ea8('0x36')]=function(_0x27f9e8,_0x123790){var _0x5b81b8={},_0x485ab4={},_0x349f9c={'count':0x0,'rows':[]};var _0x4ea0c0=db['VoiceExtension'][_0x1ea8('0x37')];_0x485ab4[_0x1ea8('0x38')]=_[_0x1ea8('0x39')](_0x4ea0c0);_0x485ab4[_0x1ea8('0x3a')]=_[_0x1ea8('0x39')](_0x27f9e8[_0x1ea8('0x3a')]);_0x485ab4[_0x1ea8('0x3b')]=_['intersection'](_0x485ab4[_0x1ea8('0x38')],_0x485ab4[_0x1ea8('0x3a')]);_0x5b81b8[_0x1ea8('0x3c')]=_['intersection'](_0x485ab4['model'],qs[_0x1ea8('0x3d')](_0x27f9e8[_0x1ea8('0x3a')][_0x1ea8('0x3d')]));_0x5b81b8['attributes']=_0x5b81b8[_0x1ea8('0x3c')][_0x1ea8('0x3e')]?_0x5b81b8[_0x1ea8('0x3c')]:_0x485ab4[_0x1ea8('0x38')];if(!_0x27f9e8[_0x1ea8('0x3a')]['hasOwnProperty'](_0x1ea8('0x3f'))){_0x5b81b8[_0x1ea8('0x20')]=qs['limit'](_0x27f9e8[_0x1ea8('0x3a')][_0x1ea8('0x20')]);_0x5b81b8['offset']=qs[_0x1ea8('0x1f')](_0x27f9e8[_0x1ea8('0x3a')]['offset']);}_0x5b81b8[_0x1ea8('0x40')]=qs[_0x1ea8('0x41')](_0x27f9e8[_0x1ea8('0x3a')]['sort']);_0x5b81b8[_0x1ea8('0x42')]=qs[_0x1ea8('0x3b')](_[_0x1ea8('0x43')](_0x27f9e8['query'],_0x485ab4[_0x1ea8('0x3b')]));if(_0x27f9e8['query'][_0x1ea8('0x2b')]){_0x5b81b8[_0x1ea8('0x42')]=_['merge'](_0x5b81b8['where'],{'$or':_[_0x1ea8('0x2d')](_0x4ea0c0,function(_0x4118cf){if(_0x4118cf[_0x1ea8('0x30')][_0x1ea8('0x44')]!=='VIRTUAL'){var _0x51d606={};_0x51d606[_0x4118cf[_0x1ea8('0x45')]]={'$like':'%'+_0x27f9e8['query'][_0x1ea8('0x2b')]+'%'};return _0x51d606;}})});}_0x5b81b8=_[_0x1ea8('0x46')]({},_0x5b81b8,_0x27f9e8['options']);var _0x11fab9={'where':_0x5b81b8[_0x1ea8('0x42')]};return db[_0x1ea8('0x47')]['count'](_0x11fab9)[_0x1ea8('0x26')](function(_0x32c9a7){_0x349f9c[_0x1ea8('0x1e')]=_0x32c9a7;if(_0x27f9e8[_0x1ea8('0x3a')][_0x1ea8('0x48')]){_0x5b81b8[_0x1ea8('0x49')]=[{'all':!![]}];}return db[_0x1ea8('0x47')][_0x1ea8('0x4a')](_0x5b81b8);})[_0x1ea8('0x26')](function(_0x42077c){_0x349f9c['rows']=_0x42077c;return _0x349f9c;})[_0x1ea8('0x26')](respondWithFilteredResult(_0x123790,_0x5b81b8))[_0x1ea8('0x4b')](handleError(_0x123790,null));};exports[_0x1ea8('0x4c')]=function(_0x52ec28,_0x4547e8){var _0x55e869={'raw':![],'where':{'id':_0x52ec28[_0x1ea8('0x4d')]['id']}},_0x1e3011={};_0x1e3011[_0x1ea8('0x38')]=_[_0x1ea8('0x39')](db[_0x1ea8('0x47')][_0x1ea8('0x37')]);_0x1e3011[_0x1ea8('0x3a')]=_[_0x1ea8('0x39')](_0x52ec28[_0x1ea8('0x3a')]);_0x1e3011['filters']=_['intersection'](_0x1e3011[_0x1ea8('0x38')],_0x1e3011[_0x1ea8('0x3a')]);_0x55e869[_0x1ea8('0x3c')]=_[_0x1ea8('0x4e')](_0x1e3011[_0x1ea8('0x38')],qs['fields'](_0x52ec28[_0x1ea8('0x3a')][_0x1ea8('0x3d')]));_0x55e869[_0x1ea8('0x3c')]=_0x55e869[_0x1ea8('0x3c')][_0x1ea8('0x3e')]?_0x55e869[_0x1ea8('0x3c')]:_0x1e3011[_0x1ea8('0x38')];if(_0x52ec28[_0x1ea8('0x3a')]['includeAll']){_0x55e869[_0x1ea8('0x49')]=[{'all':!![]}];}_0x55e869=_['merge']({},_0x55e869,_0x52ec28[_0x1ea8('0x4f')]);return db[_0x1ea8('0x47')][_0x1ea8('0x50')](_0x55e869)['then'](handleEntityNotFound(_0x4547e8,null))['then'](respondWithResult(_0x4547e8,null))['catch'](handleError(_0x4547e8,null));};exports[_0x1ea8('0x32')]=function(_0x2a8bd7,_0x3bb40c){return db['VoiceExtension'][_0x1ea8('0x50')]({'where':{'id':_0x2a8bd7[_0x1ea8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3bb40c,null))[_0x1ea8('0x26')](removeEntity(_0x3bb40c,null))[_0x1ea8('0x4b')](handleError(_0x3bb40c,null));};exports[_0x1ea8('0x51')]=function(_0xed1cd5,_0x2df89b){if(_0xed1cd5[_0x1ea8('0x52')][_0x1ea8('0x30')]===_0x1ea8('0x53')&&!_[_0x1ea8('0x54')](_0xed1cd5[_0x1ea8('0x52')][_0x1ea8('0x55')],'_')){_0xed1cd5[_0x1ea8('0x52')][_0x1ea8('0x55')]='_'[_0x1ea8('0x56')](_0xed1cd5[_0x1ea8('0x52')]['exten']);}return db['VoiceExtension'][_0x1ea8('0x51')](_0xed1cd5['body'],{'raw':![]})[_0x1ea8('0x26')](function(_0x37dbfd){var _0x38d717=_0xed1cd5[_0x1ea8('0x57')][_0x1ea8('0x58')]({'plain':!![]});if(!_0x38d717)throw new Error(_0x1ea8('0x59'));if(_0x38d717[_0x1ea8('0x5a')]===_0x1ea8('0x57')){var _0x137509=_0x37dbfd[_0x1ea8('0x58')]({'plain':!![]});var _0x19f945=[{'name':'InboundRoutes','value':_0x1ea8('0x28')},{'name':_0x1ea8('0x5b'),'value':'outbound'},{'name':_0x1ea8('0x29'),'value':_0x1ea8('0x2a')}];var _0x288820=_['find'](_0x19f945,[_0x1ea8('0x2e'),_0x137509[_0x1ea8('0x30')]])['name'];return db[_0x1ea8('0x5c')][_0x1ea8('0x50')]({'where':{'name':_0x288820,'userProfileId':_0x38d717[_0x1ea8('0x5d')]},'raw':!![]})['then'](function(_0x4bde99){if(_0x4bde99&&_0x4bde99[_0x1ea8('0x5e')]===0x0){return db[_0x1ea8('0x31')][_0x1ea8('0x51')]({'name':_0x137509[_0x1ea8('0x5f')],'resourceId':_0x137509['id'],'type':_0x4bde99[_0x1ea8('0x5f')],'sectionId':_0x4bde99['id']},{})[_0x1ea8('0x26')](function(){return _0x37dbfd;});}else{return _0x37dbfd;}})[_0x1ea8('0x4b')](function(_0x468e88){logger[_0x1ea8('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x468e88);throw _0x468e88;});}return _0x37dbfd;})[_0x1ea8('0x26')](respondWithResult(_0x2df89b,0xc9))[_0x1ea8('0x4b')](handleError(_0x2df89b,null));};exports[_0x1ea8('0x60')]=function(_0x28e71b,_0x4227b8){if(_0x28e71b['body']['id']){delete _0x28e71b[_0x1ea8('0x52')]['id'];}return db['VoiceExtension'][_0x1ea8('0x50')]({'where':{'id':_0x28e71b[_0x1ea8('0x4d')]['id']}})[_0x1ea8('0x26')](handleEntityNotFound(_0x4227b8,null))[_0x1ea8('0x26')](function(_0x334895){if(_0x334895){return db[_0x1ea8('0x47')][_0x1ea8('0x60')](_['pick'](_0x28e71b[_0x1ea8('0x52')],[_0x1ea8('0x55'),_0x1ea8('0x61'),'description','recordingFormat',_0x1ea8('0x62'),_0x1ea8('0x63')]),{'where':{'context':_0x334895[_0x1ea8('0x61')],'exten':_0x334895[_0x1ea8('0x55')]},'individualHooks':!![]})[_0x1ea8('0x26')](function(_0x2e476a){return _0x2e476a;});}return null;})[_0x1ea8('0x26')](respondWithStatusCode(_0x4227b8,null))['catch'](handleError(_0x4227b8,null));};exports[_0x1ea8('0x64')]=function(_0x1c21c3,_0x5928c9,_0x1e4f60){return db[_0x1ea8('0x47')][_0x1ea8('0x65')]({'where':{'id':_0x1c21c3[_0x1ea8('0x4d')]['id']}})[_0x1ea8('0x26')](handleEntityNotFound(_0x5928c9,null))['then'](function(_0xa16cda){if(_0xa16cda){return db['sequelize'][_0x1ea8('0x66')](function(_0x5dad07){return db[_0x1ea8('0x47')][_0x1ea8('0x32')]({'where':{'VoiceExtensionId':_0x1c21c3[_0x1ea8('0x4d')]['id']},'transaction':_0x5dad07})[_0x1ea8('0x26')](function(_0x10c8f2){var _0x2f5bdf=_[_0x1ea8('0x2d')](_0x1c21c3[_0x1ea8('0x52')],function(_0x4bedfa){_0x4bedfa[_0x1ea8('0x67')]=_0x1c21c3['params']['id'];return _0x4bedfa;});return db[_0x1ea8('0x47')][_0x1ea8('0x68')](_0x2f5bdf,{'transaction':_0x5dad07});});})['then'](function(){return db[_0x1ea8('0x47')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1c21c3[_0x1ea8('0x4d')]['id']},'order':_0x1ea8('0x69')});});}})[_0x1ea8('0x26')](respondWithResult(_0x5928c9,null))[_0x1ea8('0x4b')](handleError(_0x5928c9,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 8cb9d0a..cf943a3 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 _0x207f=['hasOwnProperty','exports','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x23399e,_0x49c9b3){var _0x4ff49a=function(_0x42e14a){while(--_0x42e14a){_0x23399e['push'](_0x23399e['shift']());}};_0x4ff49a(++_0x49c9b3);}(_0x207f,0x1a9));var _0xf207=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x207f[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xf207('0x0'))['db'][_0xf207('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf207('0x2')](0x0);var events={'afterCreate':_0xf207('0x3'),'afterUpdate':_0xf207('0x4'),'afterDestroy':_0xf207('0x5')};function emitEvent(_0x1b28c9){return function(_0x51892e,_0x1d78b9,_0xccd132){VoiceExtensionEvents[_0xf207('0x6')](_0x1b28c9+':'+_0x51892e['id'],_0x51892e);VoiceExtensionEvents[_0xf207('0x6')](_0x1b28c9,_0x51892e);_0xccd132(null);};}for(var e in events){if(events[_0xf207('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xf207('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x7823=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x362046,_0x5cf93f){var _0x419ffe=function(_0x18cb42){while(--_0x18cb42){_0x362046['push'](_0x362046['shift']());}};_0x419ffe(++_0x5cf93f);}(_0x7823,0x1cf));var _0x3782=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7823[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x3782('0x0'));var VoiceExtension=require(_0x3782('0x1'))['db'][_0x3782('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x3782('0x3')](0x0);var events={'afterCreate':_0x3782('0x4'),'afterUpdate':_0x3782('0x5'),'afterDestroy':_0x3782('0x6')};function emitEvent(_0x6b0609){return function(_0x30c4a1,_0x130585,_0x1ec752){VoiceExtensionEvents[_0x3782('0x7')](_0x6b0609+':'+_0x30c4a1['id'],_0x30c4a1);VoiceExtensionEvents['emit'](_0x6b0609,_0x30c4a1);_0x1ec752(null);};}for(var e in events){if(events[_0x3782('0x8')](e)){var event=events[e];VoiceExtension[_0x3782('0x9')](e,emitEvent(event));}}module[_0x3782('0xa')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a3ada47..f92003e 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 _0x2840=['lodash','../../config/logger','api','moment','bluebird','exports','VoiceExtension','voice_extensions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2840,0x178));var _0x0284=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x2840[_0x26b80e];return _0x84a8a8;};'use strict';var _=require(_0x0284('0x0'));var util=require('util');var logger=require(_0x0284('0x1'))(_0x0284('0x2'));var moment=require(_0x0284('0x3'));var BPromise=require(_0x0284('0x4'));var rp=require('request-promise');var attributes=require('./voiceExtension.attributes');module[_0x0284('0x5')]=function(_0x570049,_0x165602){return _0x570049['define'](_0x0284('0x6'),attributes,{'tableName':_0x0284('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94ad=['./voiceExtension.attributes','VoiceExtension','voice_extensions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x94ad,0x13e));var _0xd94a=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x94ad[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require(_0xd94a('0x0'));var logger=require(_0xd94a('0x1'))(_0xd94a('0x2'));var moment=require(_0xd94a('0x3'));var BPromise=require(_0xd94a('0x4'));var rp=require(_0xd94a('0x5'));var attributes=require(_0xd94a('0x6'));module['exports']=function(_0xeb6ada,_0x511422){return _0xeb6ada['define'](_0xd94a('0x7'),attributes,{'tableName':_0xd94a('0x8'),'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 189a72b..fa9bd32 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 _0xa9e0=['map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','findAll','options','raw','where','attributes','limit','include'];(function(_0x46409d,_0x28ee2e){var _0x21145d=function(_0x171795){while(--_0x171795){_0x46409d['push'](_0x46409d['shift']());}};_0x21145d(++_0x28ee2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['VoiceExtension'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'limit':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]||null:null,'include':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x1314ae[_0x0a9e('0x1b')]['include'],function(_0x59181e){return{'model':db[_0x59181e[_0x0a9e('0x22')]],'as':_0x59181e['as'],'attributes':_0x59181e[_0x0a9e('0x1e')],'include':_0x59181e[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x59181e['include'],function(_0x384319){return{'model':db[_0x384319['model']],'as':_0x384319['as'],'attributes':_0x384319[_0x0a9e('0x1e')],'include':_0x384319['include']?_[_0x0a9e('0x21')](_0x384319[_0x0a9e('0x20')],function(_0x25fba9){return{'model':db[_0x25fba9[_0x0a9e('0x22')]],'as':_0x25fba9['as'],'attributes':_0x25fba9[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x11c3b6){logger[_0x0a9e('0x16')]('GetVoiceExtension',_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON[_0x0a9e('0x12')](_0x11c3b6));_0x1c696a(_0x11c3b6);})[_0x0a9e('0x18')](function(_0x5c877d){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x5c877d[_0x0a9e('0x15')],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x5c877d[_0x0a9e('0x15')]));});});}; \ No newline at end of file +var _0xa9e0=['map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','findAll','options','raw','where','attributes','limit','include'];(function(_0x4e1549,_0x4da55c){var _0xe450c2=function(_0x5f4109){while(--_0x5f4109){_0x4e1549['push'](_0x4e1549['shift']());}};_0xe450c2(++_0x4da55c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['VoiceExtension'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'limit':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]||null:null,'include':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x1314ae[_0x0a9e('0x1b')]['include'],function(_0x59181e){return{'model':db[_0x59181e[_0x0a9e('0x22')]],'as':_0x59181e['as'],'attributes':_0x59181e[_0x0a9e('0x1e')],'include':_0x59181e[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x59181e['include'],function(_0x384319){return{'model':db[_0x384319['model']],'as':_0x384319['as'],'attributes':_0x384319[_0x0a9e('0x1e')],'include':_0x384319['include']?_[_0x0a9e('0x21')](_0x384319[_0x0a9e('0x20')],function(_0x25fba9){return{'model':db[_0x25fba9[_0x0a9e('0x22')]],'as':_0x25fba9['as'],'attributes':_0x25fba9[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x11c3b6){logger[_0x0a9e('0x16')]('GetVoiceExtension',_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON[_0x0a9e('0x12')](_0x11c3b6));_0x1c696a(_0x11c3b6);})[_0x0a9e('0x18')](function(_0x5c877d){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x5c877d[_0x0a9e('0x15')],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x5c877d[_0x0a9e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 703741b..b0f3490 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 _0x14a9=['removeListener','length','./voiceExtension.events','save','remove','update','emit'];(function(_0x371303,_0x272c73){var _0x21409f=function(_0x293ab9){while(--_0x293ab9){_0x371303['push'](_0x371303['shift']());}};_0x21409f(++_0x272c73);}(_0x14a9,0x160));var _0x914a=function(_0x3c4e42,_0x4df3e8){_0x3c4e42=_0x3c4e42-0x0;var _0x7378e0=_0x14a9[_0x3c4e42];return _0x7378e0;};'use strict';var VoiceExtensionEvents=require(_0x914a('0x0'));var events=[_0x914a('0x1'),_0x914a('0x2'),_0x914a('0x3')];function createListener(_0x1b3926,_0x54ea85){return function(_0x1a848a){_0x54ea85[_0x914a('0x4')](_0x1b3926,_0x1a848a);};}function removeListener(_0x5a411d,_0x80aaa9){return function(){VoiceExtensionEvents[_0x914a('0x5')](_0x5a411d,_0x80aaa9);};}exports['register']=function(_0x32b9d7){for(var _0x2bbd71=0x0,_0x2615d9=events[_0x914a('0x6')];_0x2bbd71<_0x2615d9;_0x2bbd71++){var _0x1f1320=events[_0x2bbd71];var _0x6b941f=createListener('voiceExtension:'+_0x1f1320,_0x32b9d7);VoiceExtensionEvents['on'](_0x1f1320,_0x6b941f);}}; \ No newline at end of file +var _0xd53c=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','register'];(function(_0x5dcaed,_0x1d7c10){var _0x28fff4=function(_0xa15b15){while(--_0xa15b15){_0x5dcaed['push'](_0x5dcaed['shift']());}};_0x28fff4(++_0x1d7c10);}(_0xd53c,0x1e2));var _0xcd53=function(_0x254175,_0x3a6fae){_0x254175=_0x254175-0x0;var _0x2ee652=_0xd53c[_0x254175];return _0x2ee652;};'use strict';var VoiceExtensionEvents=require(_0xcd53('0x0'));var events=[_0xcd53('0x1'),_0xcd53('0x2'),_0xcd53('0x3')];function createListener(_0x3268c7,_0x29f7f2){return function(_0x21ff68){_0x29f7f2[_0xcd53('0x4')](_0x3268c7,_0x21ff68);};}function removeListener(_0x15b37e,_0x1d57b7){return function(){VoiceExtensionEvents['removeListener'](_0x15b37e,_0x1d57b7);};}exports[_0xcd53('0x5')]=function(_0x22afcc){for(var _0x455930=0x0,_0x1cd0b8=events[_0xcd53('0x6')];_0x455930<_0x1cd0b8;_0x455930++){var _0x13dde2=events[_0x455930];var _0x29e2f8=createListener(_0xcd53('0x7')+_0x13dde2,_0x22afcc);VoiceExtensionEvents['on'](_0x13dde2,_0x29e2f8);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 76f0d49..c5edb20 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 _0x1144=['../../config/environment','isAuthenticated','index','/:id','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x570542,_0xafe5e9){var _0x33eb54=function(_0x528a43){while(--_0x528a43){_0x570542['push'](_0x570542['shift']());}};_0x33eb54(++_0xafe5e9);}(_0x1144,0x117));var _0x4114=function(_0x57fa3d,_0x4c6840){_0x57fa3d=_0x57fa3d-0x0;var _0x22523d=_0x1144[_0x57fa3d];return _0x22523d;};'use strict';var multer=require(_0x4114('0x0'));var util=require(_0x4114('0x1'));var path=require('path');var timeout=require(_0x4114('0x2'));var express=require(_0x4114('0x3'));var router=express[_0x4114('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4114('0x5'));var config=require(_0x4114('0x6'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0x4114('0x7')](),controller[_0x4114('0x8')]);router['get'](_0x4114('0x9'),auth[_0x4114('0x7')](),controller['show']);router['get'](_0x4114('0xa'),auth[_0x4114('0x7')](),controller[_0x4114('0xb')]);router[_0x4114('0xc')]('/',auth['isAuthenticated'](),controller[_0x4114('0xd')]);router[_0x4114('0xe')]('/:id',auth[_0x4114('0x7')](),controller[_0x4114('0xf')]);router[_0x4114('0x10')](_0x4114('0x9'),auth[_0x4114('0x7')](),controller[_0x4114('0x11')]);module[_0x4114('0x12')]=router; \ No newline at end of file +var _0xca06=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','post','put','update','delete'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xca06,0x74));var _0x6ca0=function(_0x1cc71f,_0x233689){_0x1cc71f=_0x1cc71f-0x0;var _0x33d0b5=_0xca06[_0x1cc71f];return _0x33d0b5;};'use strict';var multer=require(_0x6ca0('0x0'));var util=require(_0x6ca0('0x1'));var path=require(_0x6ca0('0x2'));var timeout=require(_0x6ca0('0x3'));var express=require(_0x6ca0('0x4'));var router=express[_0x6ca0('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ca0('0x6'));var controller=require(_0x6ca0('0x7'));router[_0x6ca0('0x8')]('/',auth[_0x6ca0('0x9')](),controller[_0x6ca0('0xa')]);router[_0x6ca0('0x8')](_0x6ca0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x6ca0('0x8')](_0x6ca0('0xc'),auth[_0x6ca0('0x9')](),controller['getMessages']);router[_0x6ca0('0xd')]('/',auth[_0x6ca0('0x9')](),controller['create']);router[_0x6ca0('0xe')](_0x6ca0('0xb'),auth[_0x6ca0('0x9')](),controller[_0x6ca0('0xf')]);router[_0x6ca0('0x10')](_0x6ca0('0xb'),auth['isAuthenticated'](),controller[_0x6ca0('0x11')]);module[_0x6ca0('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 6a65ce9..d373bab 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 _0x1340=['mailbox','sequelize','STRING','contest_mailbox','setDataValue','email','string','trim','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20'];(function(_0x39bcdf,_0x57a1d0){var _0x56e8a2=function(_0x544e50){while(--_0x544e50){_0x39bcdf['push'](_0x39bcdf['shift']());}};_0x56e8a2(++_0x57a1d0);}(_0x1340,0x89));var _0x0134=function(_0xd6dfba,_0x21065b){_0xd6dfba=_0xd6dfba-0x0;var _0x1db80e=_0x1340[_0xd6dfba];return _0x1db80e;};'use strict';var Sequelize=require(_0x0134('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x0134('0x1')]},'context':{'type':Sequelize[_0x0134('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x0134('0x1')],'defaultValue':'','allowNull':![],'unique':_0x0134('0x2')},'password':{'type':Sequelize[_0x0134('0x1')]},'fullname':{'type':Sequelize[_0x0134('0x1')]},'email':{'type':Sequelize[_0x0134('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1fd279){this[_0x0134('0x3')](_0x0134('0x4'),typeof _0x1fd279===_0x0134('0x5')&&_0x1fd279[_0x0134('0x6')]()?_0x1fd279['trim']():null);}},'pager':{'type':Sequelize[_0x0134('0x1')]},'tz':{'type':Sequelize[_0x0134('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x0134('0x7'),'no'),'defaultValue':_0x0134('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x0134('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x0134('0x1')]},'callback':{'type':Sequelize[_0x0134('0x1')]},'review':{'type':Sequelize[_0x0134('0x8')](_0x0134('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x0134('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x0134('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x0134('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0134('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0134('0x8')](_0x0134('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0134('0x8')](_0x0134('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0134('0x8')](_0x0134('0x7'),'no'),'defaultValue':_0x0134('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0134('0x8')](_0x0134('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x0134('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0134('0x8')](_0x0134('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x0134('0xa')},'emailsubject':{'type':Sequelize[_0x0134('0x1')]},'emailbody':{'type':Sequelize[_0x0134('0x1')]},'maxsecs':{'type':Sequelize[_0x0134('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0134('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0134('0xc')],'get':function(){return this[_0x0134('0xd')](_0x0134('0xe'))+_0x0134('0xf')+this[_0x0134('0xd')](_0x0134('0x10'));}}}; \ No newline at end of file +var _0x25b3=['exports','from-voicemail','contest_mailbox','STRING','trim','central','ENUM','yes','TIMESTAMP','INTEGER','fullname','\x20-\x20','getDataValue','mailbox','sequelize'];(function(_0x13fbf3,_0x9d385d){var _0x3abe39=function(_0x8e8d2a){while(--_0x8e8d2a){_0x13fbf3['push'](_0x13fbf3['shift']());}};_0x3abe39(++_0x9d385d);}(_0x25b3,0x1a3));var _0x325b=function(_0x4114dd,_0x2ad862){_0x4114dd=_0x4114dd-0x0;var _0x26f44c=_0x25b3[_0x4114dd];return _0x26f44c;};'use strict';var Sequelize=require(_0x325b('0x0'));module[_0x325b('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x325b('0x2'),'unique':_0x325b('0x3')},'mailbox':{'type':Sequelize[_0x325b('0x4')],'defaultValue':'','allowNull':![],'unique':_0x325b('0x3')},'password':{'type':Sequelize[_0x325b('0x4')]},'fullname':{'type':Sequelize[_0x325b('0x4')]},'email':{'type':Sequelize[_0x325b('0x4')],'validate':{'isEmail':!![]},'set':function(_0x3de6c0){this['setDataValue']('email',typeof _0x3de6c0==='string'&&_0x3de6c0[_0x325b('0x5')]()?_0x3de6c0[_0x325b('0x5')]():null);}},'pager':{'type':Sequelize[_0x325b('0x4')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x325b('0x6')},'attach':{'type':Sequelize[_0x325b('0x7')](_0x325b('0x8'),'no'),'defaultValue':_0x325b('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x325b('0x7')](_0x325b('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x325b('0x7')](_0x325b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x325b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x325b('0x7')](_0x325b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x325b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x325b('0x7')](_0x325b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x325b('0x7')](_0x325b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x325b('0x7')](_0x325b('0x8'),'no'),'defaultValue':_0x325b('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x325b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x325b('0x7')](_0x325b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x325b('0x7')](_0x325b('0x8'),'no'),'defaultValue':_0x325b('0x8'),'allowNull':![]},'stamp':{'type':_0x325b('0x9')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x325b('0x4')]},'maxsecs':{'type':Sequelize[_0x325b('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x325b('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x325b('0xb'))+_0x325b('0xc')+this[_0x325b('0xd')](_0x325b('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index bf83948..6868ea1 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 _0x9818=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','VoiceMail','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','include','findAll','rows','show','params','includeAll','options','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','html-pdf','rimraf'];(function(_0x4a0817,_0x291466){var _0x11aa9b=function(_0x5b5f87){while(--_0x5b5f87){_0x4a0817['push'](_0x4a0817['shift']());}};_0x11aa9b(++_0x291466);}(_0x9818,0x109));var _0x8981=function(_0x599e1e,_0x3069bf){_0x599e1e=_0x599e1e-0x0;var _0xf2e22a=_0x9818[_0x599e1e];return _0xf2e22a;};'use strict';var pdf=require(_0x8981('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8981('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8981('0x2'));var moment=require(_0x8981('0x3'));var BPromise=require(_0x8981('0x4'));var Mustache=require(_0x8981('0x5'));var util=require(_0x8981('0x6'));var path=require(_0x8981('0x7'));var sox=require(_0x8981('0x8'));var csv=require(_0x8981('0x9'));var ejs=require(_0x8981('0xa'));var fs=require('fs');var _=require(_0x8981('0xb'));var squel=require(_0x8981('0xc'));var crypto=require(_0x8981('0xd'));var jsforce=require(_0x8981('0xe'));var deskjs=require(_0x8981('0xf'));var toCsv=require(_0x8981('0x9'));var querystring=require(_0x8981('0x10'));var Papa=require(_0x8981('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0x8981('0x12'));var Redis=require(_0x8981('0x13'));var qs=require(_0x8981('0x14'));var logger=require('../../config/logger')(_0x8981('0x15'));var utils=require(_0x8981('0x16'));var config=require(_0x8981('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52c592,_0xe7767b){_0xe7767b=_0xe7767b||0xcc;return function(_0x297d07){if(_0x297d07){return _0x52c592[_0x8981('0x18')](_0xe7767b);}return _0x52c592['status'](_0xe7767b)[_0x8981('0x19')]();};}function respondWithResult(_0x1b4aa3,_0x2f8429){_0x2f8429=_0x2f8429||0xc8;return function(_0x51241c){if(_0x51241c){return _0x1b4aa3[_0x8981('0x1a')](_0x2f8429)[_0x8981('0x1b')](_0x51241c);}};}function respondWithFilteredResult(_0x448e40,_0x5296e4){return function(_0x144d31){if(_0x144d31){var _0x398e4a=_0x144d31[_0x8981('0x1c')],_0x2b2635=_0x5296e4[_0x8981('0x1d')],_0x3e1fb7=_0x5296e4['offset']+_0x5296e4[_0x8981('0x1e')],_0x210d65;if(_0x3e1fb7>=_0x398e4a){_0x3e1fb7=_0x398e4a;_0x210d65=0xc8;}else{_0x210d65=0xce;}_0x448e40['status'](_0x210d65);return _0x448e40[_0x8981('0x1f')](_0x8981('0x20'),_0x2b2635+'-'+_0x3e1fb7+'/'+_0x398e4a)[_0x8981('0x1b')](_0x144d31);}return null;};}function patchUpdates(_0x2c6138){return function(_0x1968c5){try{jsonpatch[_0x8981('0x21')](_0x1968c5,_0x2c6138,!![]);}catch(_0x1bf65c){return BPromise[_0x8981('0x22')](_0x1bf65c);}return _0x1968c5[_0x8981('0x23')]();};}function saveUpdates(_0x31a390,_0x4205af){return function(_0x20e646){if(_0x20e646){return _0x20e646[_0x8981('0x24')](_0x31a390)[_0x8981('0x25')](function(_0x5955e1){return _0x5955e1;});}return null;};}function removeEntity(_0x204bfe,_0x45f6a4){return function(_0x23ad9c){if(_0x23ad9c){return _0x23ad9c[_0x8981('0x26')]()[_0x8981('0x25')](function(){var _0x2bc2b7=_0x23ad9c['get']({'plain':!![]});var _0x29f966='Voicemails';return db[_0x8981('0x27')][_0x8981('0x26')]({'where':{'type':_0x29f966,'resourceId':_0x2bc2b7['id']}})[_0x8981('0x25')](function(){return _0x23ad9c;});})[_0x8981('0x25')](function(){_0x204bfe[_0x8981('0x1a')](0xcc)[_0x8981('0x19')]();});}};}function handleEntityNotFound(_0x5d3251,_0x1af5d3){return function(_0x264061){if(!_0x264061){_0x5d3251[_0x8981('0x18')](0x194);}return _0x264061;};}function handleError(_0x5c9ba9,_0x56e04d){_0x56e04d=_0x56e04d||0x1f4;return function(_0xe1d941){logger[_0x8981('0x28')](_0xe1d941[_0x8981('0x29')]);if(_0xe1d941[_0x8981('0x2a')]){delete _0xe1d941[_0x8981('0x2a')];}_0x5c9ba9[_0x8981('0x1a')](_0x56e04d)['send'](_0xe1d941);};}exports[_0x8981('0x2b')]=function(_0x1d3819,_0x300e9a){var _0x1f8e55={},_0x11321b={},_0x90105c={'count':0x0,'rows':[]};var _0x25b6c7=db[_0x8981('0x2c')][_0x8981('0x2d')];_0x11321b[_0x8981('0x2e')]=_[_0x8981('0x2f')](_0x25b6c7);_0x11321b[_0x8981('0x30')]=_[_0x8981('0x2f')](_0x1d3819[_0x8981('0x30')]);_0x11321b[_0x8981('0x31')]=_[_0x8981('0x32')](_0x11321b['model'],_0x11321b[_0x8981('0x30')]);_0x1f8e55[_0x8981('0x33')]=_[_0x8981('0x32')](_0x11321b['model'],qs[_0x8981('0x34')](_0x1d3819[_0x8981('0x30')][_0x8981('0x34')]));_0x1f8e55[_0x8981('0x33')]=_0x1f8e55[_0x8981('0x33')][_0x8981('0x35')]?_0x1f8e55['attributes']:_0x11321b[_0x8981('0x2e')];if(!_0x1d3819['query'][_0x8981('0x36')](_0x8981('0x37'))){_0x1f8e55[_0x8981('0x1e')]=qs[_0x8981('0x1e')](_0x1d3819[_0x8981('0x30')][_0x8981('0x1e')]);_0x1f8e55[_0x8981('0x1d')]=qs[_0x8981('0x1d')](_0x1d3819[_0x8981('0x30')]['offset']);}_0x1f8e55[_0x8981('0x38')]=qs['sort'](_0x1d3819[_0x8981('0x30')][_0x8981('0x39')]);_0x1f8e55[_0x8981('0x3a')]=qs['filters'](_[_0x8981('0x3b')](_0x1d3819[_0x8981('0x30')],_0x11321b[_0x8981('0x31')]));if(_0x1d3819[_0x8981('0x30')][_0x8981('0x3c')]){_0x1f8e55[_0x8981('0x3a')]=_[_0x8981('0x3d')](_0x1f8e55[_0x8981('0x3a')],{'$or':_[_0x8981('0x3e')](_0x25b6c7,function(_0x3d1ea1){if(_0x3d1ea1[_0x8981('0x3f')][_0x8981('0x40')]!==_0x8981('0x41')){var _0x478a5c={};_0x478a5c[_0x3d1ea1[_0x8981('0x42')]]={'$like':'%'+_0x1d3819['query'][_0x8981('0x3c')]+'%'};return _0x478a5c;}})});}_0x1f8e55=_[_0x8981('0x3d')]({},_0x1f8e55,_0x1d3819['options']);var _0x383599={'where':_0x1f8e55[_0x8981('0x3a')]};return db[_0x8981('0x2c')][_0x8981('0x1c')](_0x383599)[_0x8981('0x25')](function(_0x46cc82){_0x90105c['count']=_0x46cc82;if(_0x1d3819[_0x8981('0x30')]['includeAll']){_0x1f8e55[_0x8981('0x43')]=[{'all':!![]}];}return db[_0x8981('0x2c')][_0x8981('0x44')](_0x1f8e55);})[_0x8981('0x25')](function(_0x5c2b6e){_0x90105c[_0x8981('0x45')]=_0x5c2b6e;return _0x90105c;})[_0x8981('0x25')](respondWithFilteredResult(_0x300e9a,_0x1f8e55))['catch'](handleError(_0x300e9a,null));};exports[_0x8981('0x46')]=function(_0x394cf2,_0x4d0acb){var _0x568e5f={'raw':!![],'where':{'id':_0x394cf2[_0x8981('0x47')]['id']}},_0xfd0863={};_0xfd0863[_0x8981('0x2e')]=_[_0x8981('0x2f')](db[_0x8981('0x2c')][_0x8981('0x2d')]);_0xfd0863['query']=_[_0x8981('0x2f')](_0x394cf2['query']);_0xfd0863[_0x8981('0x31')]=_[_0x8981('0x32')](_0xfd0863[_0x8981('0x2e')],_0xfd0863[_0x8981('0x30')]);_0x568e5f[_0x8981('0x33')]=_['intersection'](_0xfd0863[_0x8981('0x2e')],qs['fields'](_0x394cf2['query'][_0x8981('0x34')]));_0x568e5f[_0x8981('0x33')]=_0x568e5f[_0x8981('0x33')]['length']?_0x568e5f[_0x8981('0x33')]:_0xfd0863[_0x8981('0x2e')];if(_0x394cf2['query'][_0x8981('0x48')]){_0x568e5f[_0x8981('0x43')]=[{'all':!![]}];}_0x568e5f=_['merge']({},_0x568e5f,_0x394cf2[_0x8981('0x49')]);return db[_0x8981('0x2c')]['find'](_0x568e5f)['then'](handleEntityNotFound(_0x4d0acb,null))[_0x8981('0x25')](respondWithResult(_0x4d0acb,null))[_0x8981('0x4a')](handleError(_0x4d0acb,null));};exports[_0x8981('0x4b')]=function(_0x2e40f5,_0xf33e57){return db[_0x8981('0x2c')]['create'](_0x2e40f5['body'],{})[_0x8981('0x25')](function(_0x139b1b){var _0x3852bf=_0x2e40f5['user'][_0x8981('0x4c')]({'plain':!![]});if(!_0x3852bf)throw new Error(_0x8981('0x4d'));if(_0x3852bf[_0x8981('0x4e')]==='user'){var _0xbba290=_0x139b1b[_0x8981('0x4c')]({'plain':!![]});var _0x4de79e='Voicemails';return db[_0x8981('0x4f')][_0x8981('0x50')]({'where':{'name':_0x4de79e,'userProfileId':_0x3852bf['userProfileId']},'raw':!![]})['then'](function(_0x6fec63){if(_0x6fec63&&_0x6fec63[_0x8981('0x51')]===0x0){return db['UserProfileResource'][_0x8981('0x4b')]({'name':_0xbba290[_0x8981('0x2a')],'resourceId':_0xbba290['id'],'type':_0x6fec63[_0x8981('0x2a')],'sectionId':_0x6fec63['id']},{})[_0x8981('0x25')](function(){return _0x139b1b;});}else{return _0x139b1b;}})['catch'](function(_0x52e28){logger['error'](_0x8981('0x52'),_0x52e28);throw _0x52e28;});}return _0x139b1b;})[_0x8981('0x25')](respondWithResult(_0xf33e57,0xc9))['catch'](handleError(_0xf33e57,null));};exports[_0x8981('0x24')]=function(_0x2fa28a,_0x149ccc){if(_0x2fa28a[_0x8981('0x53')]['id']){delete _0x2fa28a[_0x8981('0x53')]['id'];}return db[_0x8981('0x2c')][_0x8981('0x50')]({'where':{'id':_0x2fa28a[_0x8981('0x47')]['id']}})[_0x8981('0x25')](handleEntityNotFound(_0x149ccc,null))['then'](saveUpdates(_0x2fa28a[_0x8981('0x53')],null))[_0x8981('0x25')](respondWithResult(_0x149ccc,null))['catch'](handleError(_0x149ccc,null));};exports[_0x8981('0x26')]=function(_0x4375ce,_0x579740){return db['VoiceMail'][_0x8981('0x50')]({'where':{'id':_0x4375ce['params']['id']}})['then'](handleEntityNotFound(_0x579740,null))[_0x8981('0x25')](removeEntity(_0x579740,null))[_0x8981('0x4a')](handleError(_0x579740,null));};exports[_0x8981('0x54')]=function(_0x4f3e38,_0x5a5c3d,_0x3a375d){return db[_0x8981('0x2c')][_0x8981('0x55')]({'where':{'id':_0x4f3e38[_0x8981('0x47')]['id']}})['then'](handleEntityNotFound(_0x5a5c3d,null))['then'](function(_0x5c915b){var _0x260a08;var _0x511847={},_0x1282e1={};_0x1282e1[_0x8981('0x2e')]=_[_0x8981('0x2f')](db[_0x8981('0x56')][_0x8981('0x2d')]);_0x1282e1[_0x8981('0x30')]=_['keys'](_0x4f3e38[_0x8981('0x30')]);_0x1282e1[_0x8981('0x31')]=_['intersection'](_0x1282e1[_0x8981('0x2e')],_0x1282e1[_0x8981('0x30')]);_0x511847[_0x8981('0x33')]=_[_0x8981('0x32')](_0x1282e1[_0x8981('0x2e')],qs[_0x8981('0x34')](_0x4f3e38[_0x8981('0x30')][_0x8981('0x34')]));_0x511847[_0x8981('0x33')]=_0x511847[_0x8981('0x33')][_0x8981('0x35')]?_0x511847[_0x8981('0x33')]:_0x1282e1[_0x8981('0x2e')];if(!_0x4f3e38[_0x8981('0x30')][_0x8981('0x36')](_0x8981('0x37'))){_0x511847[_0x8981('0x1e')]=qs['limit'](_0x4f3e38[_0x8981('0x30')][_0x8981('0x1e')]);_0x511847[_0x8981('0x1d')]=qs[_0x8981('0x1d')](_0x4f3e38[_0x8981('0x30')][_0x8981('0x1d')]);}_0x511847[_0x8981('0x38')]=qs[_0x8981('0x39')](_0x4f3e38[_0x8981('0x30')][_0x8981('0x39')]);_0x511847[_0x8981('0x3a')]=qs[_0x8981('0x31')](_[_0x8981('0x3b')](_0x4f3e38[_0x8981('0x30')],_0x1282e1[_0x8981('0x31')]));if(_0x4f3e38[_0x8981('0x30')]['filter']){_0x511847[_0x8981('0x3a')]=_['merge'](_0x511847['where'],{'$or':_[_0x8981('0x3e')](_0x511847[_0x8981('0x33')],function(_0x379f8d){var _0x2b146b={};_0x2b146b[_0x379f8d]={'$like':'%'+_0x4f3e38[_0x8981('0x30')]['filter']+'%'};return _0x2b146b;})});}_0x511847['where']=_[_0x8981('0x3d')](_0x511847[_0x8981('0x3a')],{'mailboxuser':_0x5c915b[_0x8981('0x57')]});_0x511847=_['merge']({},_0x511847,_0x4f3e38[_0x8981('0x49')]);return db[_0x8981('0x56')][_0x8981('0x58')](_0x511847)['then'](respondWithFilteredResult(_0x5a5c3d,_0x511847));})['catch'](handleError(_0x5a5c3d,null));}; \ No newline at end of file +var _0xfdcb=['VoiceMail','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','field','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index'];(function(_0x4a5a5f,_0x282be6){var _0x4f8122=function(_0x2db965){while(--_0x2db965){_0x4a5a5f['push'](_0x4a5a5f['shift']());}};_0x4f8122(++_0x282be6);}(_0xfdcb,0xd4));var _0xbfdc=function(_0x3ec501,_0x1d035a){_0x3ec501=_0x3ec501-0x0;var _0x5a3037=_0xfdcb[_0x3ec501];return _0x5a3037;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbfdc('0x0'));var rimraf=require(_0xbfdc('0x1'));var zipdir=require(_0xbfdc('0x2'));var jsonpatch=require(_0xbfdc('0x3'));var rp=require(_0xbfdc('0x4'));var moment=require(_0xbfdc('0x5'));var BPromise=require(_0xbfdc('0x6'));var Mustache=require(_0xbfdc('0x7'));var util=require(_0xbfdc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xbfdc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbfdc('0xa'));var crypto=require(_0xbfdc('0xb'));var jsforce=require(_0xbfdc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbfdc('0x9'));var querystring=require(_0xbfdc('0xd'));var Papa=require(_0xbfdc('0xe'));var authService=require(_0xbfdc('0xf'));var hardwareService=require(_0xbfdc('0x10'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbfdc('0x11'))('api');var utils=require(_0xbfdc('0x12'));var config=require(_0xbfdc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20d435,_0x339c01){_0x339c01=_0x339c01||0xcc;return function(_0x47a906){if(_0x47a906){return _0x20d435[_0xbfdc('0x14')](_0x339c01);}return _0x20d435[_0xbfdc('0x15')](_0x339c01)['end']();};}function respondWithResult(_0x313618,_0x47fb83){_0x47fb83=_0x47fb83||0xc8;return function(_0x687758){if(_0x687758){return _0x313618['status'](_0x47fb83)[_0xbfdc('0x16')](_0x687758);}};}function respondWithFilteredResult(_0x4f30ab,_0x567544){return function(_0x56c866){if(_0x56c866){var _0x1e5e47=_0x56c866[_0xbfdc('0x17')],_0x281874=_0x567544[_0xbfdc('0x18')],_0xf64fc6=_0x567544['offset']+_0x567544[_0xbfdc('0x19')],_0xe3f5ab;if(_0xf64fc6>=_0x1e5e47){_0xf64fc6=_0x1e5e47;_0xe3f5ab=0xc8;}else{_0xe3f5ab=0xce;}_0x4f30ab[_0xbfdc('0x15')](_0xe3f5ab);return _0x4f30ab['set'](_0xbfdc('0x1a'),_0x281874+'-'+_0xf64fc6+'/'+_0x1e5e47)['json'](_0x56c866);}return null;};}function patchUpdates(_0x47702f){return function(_0x1cbc66){try{jsonpatch[_0xbfdc('0x1b')](_0x1cbc66,_0x47702f,!![]);}catch(_0xb75982){return BPromise[_0xbfdc('0x1c')](_0xb75982);}return _0x1cbc66[_0xbfdc('0x1d')]();};}function saveUpdates(_0x4dc116,_0x1856bd){return function(_0x4d541e){if(_0x4d541e){return _0x4d541e[_0xbfdc('0x1e')](_0x4dc116)[_0xbfdc('0x1f')](function(_0x26a766){return _0x26a766;});}return null;};}function removeEntity(_0x24cacc,_0x1bdae9){return function(_0x449a40){if(_0x449a40){return _0x449a40[_0xbfdc('0x20')]()[_0xbfdc('0x1f')](function(){var _0x1d0b6b=_0x449a40[_0xbfdc('0x21')]({'plain':!![]});var _0x135dab='Voicemails';return db['UserProfileResource'][_0xbfdc('0x20')]({'where':{'type':_0x135dab,'resourceId':_0x1d0b6b['id']}})[_0xbfdc('0x1f')](function(){return _0x449a40;});})['then'](function(){_0x24cacc[_0xbfdc('0x15')](0xcc)[_0xbfdc('0x22')]();});}};}function handleEntityNotFound(_0x5cd00c,_0x4cdcee){return function(_0x31f84b){if(!_0x31f84b){_0x5cd00c['sendStatus'](0x194);}return _0x31f84b;};}function handleError(_0x47fef6,_0x498689){_0x498689=_0x498689||0x1f4;return function(_0x2dc3f8){logger[_0xbfdc('0x23')](_0x2dc3f8[_0xbfdc('0x24')]);if(_0x2dc3f8[_0xbfdc('0x25')]){delete _0x2dc3f8[_0xbfdc('0x25')];}_0x47fef6['status'](_0x498689)[_0xbfdc('0x26')](_0x2dc3f8);};}exports[_0xbfdc('0x27')]=function(_0x214881,_0x36c68b){var _0x5cdf2f={},_0x639968={},_0x42fbcd={'count':0x0,'rows':[]};var _0xb4dec6=db[_0xbfdc('0x28')][_0xbfdc('0x29')];_0x639968[_0xbfdc('0x2a')]=_[_0xbfdc('0x2b')](_0xb4dec6);_0x639968[_0xbfdc('0x2c')]=_[_0xbfdc('0x2b')](_0x214881[_0xbfdc('0x2c')]);_0x639968[_0xbfdc('0x2d')]=_[_0xbfdc('0x2e')](_0x639968[_0xbfdc('0x2a')],_0x639968[_0xbfdc('0x2c')]);_0x5cdf2f['attributes']=_[_0xbfdc('0x2e')](_0x639968[_0xbfdc('0x2a')],qs[_0xbfdc('0x2f')](_0x214881['query'][_0xbfdc('0x2f')]));_0x5cdf2f[_0xbfdc('0x30')]=_0x5cdf2f['attributes'][_0xbfdc('0x31')]?_0x5cdf2f[_0xbfdc('0x30')]:_0x639968[_0xbfdc('0x2a')];if(!_0x214881[_0xbfdc('0x2c')][_0xbfdc('0x32')](_0xbfdc('0x33'))){_0x5cdf2f['limit']=qs[_0xbfdc('0x19')](_0x214881['query'][_0xbfdc('0x19')]);_0x5cdf2f['offset']=qs[_0xbfdc('0x18')](_0x214881[_0xbfdc('0x2c')]['offset']);}_0x5cdf2f[_0xbfdc('0x34')]=qs[_0xbfdc('0x35')](_0x214881[_0xbfdc('0x2c')]['sort']);_0x5cdf2f[_0xbfdc('0x36')]=qs['filters'](_[_0xbfdc('0x37')](_0x214881[_0xbfdc('0x2c')],_0x639968[_0xbfdc('0x2d')]));if(_0x214881[_0xbfdc('0x2c')][_0xbfdc('0x38')]){_0x5cdf2f[_0xbfdc('0x36')]=_[_0xbfdc('0x39')](_0x5cdf2f[_0xbfdc('0x36')],{'$or':_[_0xbfdc('0x3a')](_0xb4dec6,function(_0x1dae84){if(_0x1dae84['type']['key']!==_0xbfdc('0x3b')){var _0x3ba1d6={};_0x3ba1d6[_0x1dae84[_0xbfdc('0x3c')]]={'$like':'%'+_0x214881['query'][_0xbfdc('0x38')]+'%'};return _0x3ba1d6;}})});}_0x5cdf2f=_[_0xbfdc('0x39')]({},_0x5cdf2f,_0x214881['options']);var _0x38caa3={'where':_0x5cdf2f['where']};return db[_0xbfdc('0x28')][_0xbfdc('0x17')](_0x38caa3)[_0xbfdc('0x1f')](function(_0x387053){_0x42fbcd['count']=_0x387053;if(_0x214881[_0xbfdc('0x2c')][_0xbfdc('0x3d')]){_0x5cdf2f[_0xbfdc('0x3e')]=[{'all':!![]}];}return db[_0xbfdc('0x28')][_0xbfdc('0x3f')](_0x5cdf2f);})['then'](function(_0x17219e){_0x42fbcd[_0xbfdc('0x40')]=_0x17219e;return _0x42fbcd;})['then'](respondWithFilteredResult(_0x36c68b,_0x5cdf2f))['catch'](handleError(_0x36c68b,null));};exports[_0xbfdc('0x41')]=function(_0xf6227c,_0x18b94b){var _0xdcdb55={'raw':!![],'where':{'id':_0xf6227c[_0xbfdc('0x42')]['id']}},_0x5625a9={};_0x5625a9[_0xbfdc('0x2a')]=_[_0xbfdc('0x2b')](db['VoiceMail'][_0xbfdc('0x29')]);_0x5625a9['query']=_[_0xbfdc('0x2b')](_0xf6227c[_0xbfdc('0x2c')]);_0x5625a9['filters']=_[_0xbfdc('0x2e')](_0x5625a9['model'],_0x5625a9['query']);_0xdcdb55[_0xbfdc('0x30')]=_[_0xbfdc('0x2e')](_0x5625a9[_0xbfdc('0x2a')],qs[_0xbfdc('0x2f')](_0xf6227c['query']['fields']));_0xdcdb55[_0xbfdc('0x30')]=_0xdcdb55[_0xbfdc('0x30')][_0xbfdc('0x31')]?_0xdcdb55[_0xbfdc('0x30')]:_0x5625a9[_0xbfdc('0x2a')];if(_0xf6227c[_0xbfdc('0x2c')][_0xbfdc('0x3d')]){_0xdcdb55[_0xbfdc('0x3e')]=[{'all':!![]}];}_0xdcdb55=_[_0xbfdc('0x39')]({},_0xdcdb55,_0xf6227c['options']);return db[_0xbfdc('0x28')][_0xbfdc('0x43')](_0xdcdb55)['then'](handleEntityNotFound(_0x18b94b,null))['then'](respondWithResult(_0x18b94b,null))[_0xbfdc('0x44')](handleError(_0x18b94b,null));};exports[_0xbfdc('0x45')]=function(_0x581ef9,_0x5c5542){return db['VoiceMail']['create'](_0x581ef9[_0xbfdc('0x46')],{})['then'](function(_0x231d16){var _0x36a2b6=_0x581ef9[_0xbfdc('0x47')][_0xbfdc('0x21')]({'plain':!![]});if(!_0x36a2b6)throw new Error(_0xbfdc('0x48'));if(_0x36a2b6[_0xbfdc('0x49')]===_0xbfdc('0x47')){var _0x381f4d=_0x231d16['get']({'plain':!![]});var _0x3970b2='Voicemails';return db[_0xbfdc('0x4a')][_0xbfdc('0x43')]({'where':{'name':_0x3970b2,'userProfileId':_0x36a2b6[_0xbfdc('0x4b')]},'raw':!![]})[_0xbfdc('0x1f')](function(_0x538fdb){if(_0x538fdb&&_0x538fdb[_0xbfdc('0x4c')]===0x0){return db[_0xbfdc('0x4d')][_0xbfdc('0x45')]({'name':_0x381f4d[_0xbfdc('0x25')],'resourceId':_0x381f4d['id'],'type':_0x538fdb['name'],'sectionId':_0x538fdb['id']},{})['then'](function(){return _0x231d16;});}else{return _0x231d16;}})[_0xbfdc('0x44')](function(_0x4d5c24){logger[_0xbfdc('0x23')](_0xbfdc('0x4e'),_0x4d5c24);throw _0x4d5c24;});}return _0x231d16;})[_0xbfdc('0x1f')](respondWithResult(_0x5c5542,0xc9))[_0xbfdc('0x44')](handleError(_0x5c5542,null));};exports[_0xbfdc('0x1e')]=function(_0x2d2651,_0xb07cc2){if(_0x2d2651[_0xbfdc('0x46')]['id']){delete _0x2d2651[_0xbfdc('0x46')]['id'];}return db[_0xbfdc('0x28')][_0xbfdc('0x43')]({'where':{'id':_0x2d2651['params']['id']}})['then'](handleEntityNotFound(_0xb07cc2,null))[_0xbfdc('0x1f')](saveUpdates(_0x2d2651['body'],null))[_0xbfdc('0x1f')](respondWithResult(_0xb07cc2,null))['catch'](handleError(_0xb07cc2,null));};exports[_0xbfdc('0x20')]=function(_0x188769,_0x4be50d){return db[_0xbfdc('0x28')][_0xbfdc('0x43')]({'where':{'id':_0x188769['params']['id']}})[_0xbfdc('0x1f')](handleEntityNotFound(_0x4be50d,null))[_0xbfdc('0x1f')](removeEntity(_0x4be50d,null))[_0xbfdc('0x44')](handleError(_0x4be50d,null));};exports[_0xbfdc('0x4f')]=function(_0x4cff25,_0x528445,_0x1f0af9){return db[_0xbfdc('0x28')][_0xbfdc('0x50')]({'where':{'id':_0x4cff25['params']['id']}})[_0xbfdc('0x1f')](handleEntityNotFound(_0x528445,null))[_0xbfdc('0x1f')](function(_0x72f36d){var _0x48fe57;var _0x5a044f={},_0x348fe7={};_0x348fe7[_0xbfdc('0x2a')]=_[_0xbfdc('0x2b')](db[_0xbfdc('0x51')]['rawAttributes']);_0x348fe7[_0xbfdc('0x2c')]=_['keys'](_0x4cff25['query']);_0x348fe7[_0xbfdc('0x2d')]=_[_0xbfdc('0x2e')](_0x348fe7[_0xbfdc('0x2a')],_0x348fe7[_0xbfdc('0x2c')]);_0x5a044f[_0xbfdc('0x30')]=_[_0xbfdc('0x2e')](_0x348fe7[_0xbfdc('0x2a')],qs[_0xbfdc('0x2f')](_0x4cff25[_0xbfdc('0x2c')][_0xbfdc('0x2f')]));_0x5a044f[_0xbfdc('0x30')]=_0x5a044f[_0xbfdc('0x30')]['length']?_0x5a044f[_0xbfdc('0x30')]:_0x348fe7[_0xbfdc('0x2a')];if(!_0x4cff25[_0xbfdc('0x2c')][_0xbfdc('0x32')](_0xbfdc('0x33'))){_0x5a044f[_0xbfdc('0x19')]=qs['limit'](_0x4cff25[_0xbfdc('0x2c')][_0xbfdc('0x19')]);_0x5a044f[_0xbfdc('0x18')]=qs[_0xbfdc('0x18')](_0x4cff25['query']['offset']);}_0x5a044f[_0xbfdc('0x34')]=qs[_0xbfdc('0x35')](_0x4cff25[_0xbfdc('0x2c')]['sort']);_0x5a044f[_0xbfdc('0x36')]=qs[_0xbfdc('0x2d')](_[_0xbfdc('0x37')](_0x4cff25[_0xbfdc('0x2c')],_0x348fe7[_0xbfdc('0x2d')]));if(_0x4cff25[_0xbfdc('0x2c')][_0xbfdc('0x38')]){_0x5a044f[_0xbfdc('0x36')]=_[_0xbfdc('0x39')](_0x5a044f[_0xbfdc('0x36')],{'$or':_['map'](_0x5a044f['attributes'],function(_0x33f58a){var _0x5280d0={};_0x5280d0[_0x33f58a]={'$like':'%'+_0x4cff25[_0xbfdc('0x2c')][_0xbfdc('0x38')]+'%'};return _0x5280d0;})});}_0x5a044f[_0xbfdc('0x36')]=_[_0xbfdc('0x39')](_0x5a044f[_0xbfdc('0x36')],{'mailboxuser':_0x72f36d[_0xbfdc('0x52')]});_0x5a044f=_[_0xbfdc('0x39')]({},_0x5a044f,_0x4cff25['options']);return db[_0xbfdc('0x51')][_0xbfdc('0x53')](_0x5a044f)['then'](respondWithFilteredResult(_0x528445,_0x5a044f));})[_0xbfdc('0x44')](handleError(_0x528445,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 786db4b..1a91ab9 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 _0xcaba=['../../config/logger','api','moment','request-promise','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util'];(function(_0x268c2f,_0x16bb95){var _0x59afce=function(_0x157972){while(--_0x157972){_0x268c2f['push'](_0x268c2f['shift']());}};_0x59afce(++_0x16bb95);}(_0xcaba,0xee));var _0xacab=function(_0x30e99b,_0x5afb2f){_0x30e99b=_0x30e99b-0x0;var _0x7f0a8f=_0xcaba[_0x30e99b];return _0x7f0a8f;};'use strict';var _=require(_0xacab('0x0'));var util=require(_0xacab('0x1'));var logger=require(_0xacab('0x2'))(_0xacab('0x3'));var moment=require(_0xacab('0x4'));var BPromise=require('bluebird');var rp=require(_0xacab('0x5'));var attributes=require(_0xacab('0x6'));module['exports']=function(_0x3a973a,_0x37767e){return _0x3a973a[_0xacab('0x7')](_0xacab('0x8'),attributes,{'tableName':_0xacab('0x9'),'paranoid':![],'indexes':[{'name':_0xacab('0xa'),'fields':['mailbox',_0xacab('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42cf=['api','moment','bluebird','request-promise','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','util','../../config/logger'];(function(_0x3d0500,_0x367a79){var _0x482fb0=function(_0xc9d543){while(--_0xc9d543){_0x3d0500['push'](_0x3d0500['shift']());}};_0x482fb0(++_0x367a79);}(_0x42cf,0x1df));var _0xf42c=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x42cf[_0x39096d];return _0x13da4f;};'use strict';var _=require('lodash');var util=require(_0xf42c('0x0'));var logger=require(_0xf42c('0x1'))(_0xf42c('0x2'));var moment=require(_0xf42c('0x3'));var BPromise=require(_0xf42c('0x4'));var rp=require(_0xf42c('0x5'));var attributes=require(_0xf42c('0x6'));module[_0xf42c('0x7')]=function(_0x199e1b,_0x418295){return _0x199e1b[_0xf42c('0x8')](_0xf42c('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xf42c('0xa'),'fields':[_0xf42c('0xb'),_0xf42c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 5d78fb2..bf4b742 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 _0x7ab0=['http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31e1fa,_0x56c7f0){var _0xd518e6=function(_0x4d4809){while(--_0x4d4809){_0x31e1fa['push'](_0x31e1fa['shift']());}};_0xd518e6(++_0x56c7f0);}(_0x7ab0,0x67));var _0x07ab=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7ab0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x07ab('0x0'));var util=require(_0x07ab('0x1'));var moment=require(_0x07ab('0x2'));var BPromise=require(_0x07ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07ab('0x4'));var db=require(_0x07ab('0x5'))['db'];var utils=require(_0x07ab('0x6'));var logger=require(_0x07ab('0x7'))(_0x07ab('0x8'));var config=require(_0x07ab('0x9'));var jayson=require(_0x07ab('0xa'));var client=jayson[_0x07ab('0xb')][_0x07ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf2a4ee,_0x31098f,_0x39cda7){return new BPromise(function(_0x4edb73,_0x4b89d9){return client['request'](_0xf2a4ee,_0x39cda7)[_0x07ab('0xd')](function(_0x453d13){logger[_0x07ab('0xe')](_0x07ab('0xf'),_0x31098f,_0x07ab('0x10'));logger['debug'](_0x07ab('0x11'),_0x31098f,_0x07ab('0x10'),JSON['stringify'](_0x453d13));if(_0x453d13[_0x07ab('0x12')]){if(_0x453d13[_0x07ab('0x12')][_0x07ab('0x13')]===0x1f4){logger[_0x07ab('0x12')](_0x07ab('0xf'),_0x31098f,_0x453d13[_0x07ab('0x12')][_0x07ab('0x14')]);return _0x4b89d9(_0x453d13[_0x07ab('0x12')][_0x07ab('0x14')]);}logger[_0x07ab('0x12')]('VoiceMail,\x20%s,\x20%s',_0x31098f,_0x453d13[_0x07ab('0x12')][_0x07ab('0x14')]);return _0x4edb73(_0x453d13[_0x07ab('0x12')][_0x07ab('0x14')]);}else{logger[_0x07ab('0xe')](_0x07ab('0xf'),_0x31098f,_0x07ab('0x10'));_0x4edb73(_0x453d13[_0x07ab('0x15')]['message']);}})[_0x07ab('0x16')](function(_0x38b7c3){logger[_0x07ab('0x12')](_0x07ab('0xf'),_0x31098f,_0x38b7c3);_0x4b89d9(_0x38b7c3);});});} \ No newline at end of file +var _0xc1fa=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMail,\x20%s,\x20%s'];(function(_0x59b889,_0x4b026c){var _0x470d3f=function(_0x52eeb2){while(--_0x52eeb2){_0x59b889['push'](_0x59b889['shift']());}};_0x470d3f(++_0x4b026c);}(_0xc1fa,0x17f));var _0xac1f=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0xc1fa[_0x10291b];return _0x1d5fbe;};'use strict';var _=require(_0xac1f('0x0'));var util=require('util');var moment=require(_0xac1f('0x1'));var BPromise=require(_0xac1f('0x2'));var rs=require(_0xac1f('0x3'));var fs=require('fs');var Redis=require(_0xac1f('0x4'));var db=require(_0xac1f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac1f('0x6'));var config=require(_0xac1f('0x7'));var jayson=require(_0xac1f('0x8'));var client=jayson['client'][_0xac1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1001c0,_0x198279,_0x50c211){return new BPromise(function(_0x2af1c4,_0x47096a){return client['request'](_0x1001c0,_0x50c211)[_0xac1f('0xa')](function(_0x44bf32){logger[_0xac1f('0xb')]('VoiceMail,\x20%s,\x20%s',_0x198279,_0xac1f('0xc'));logger['debug'](_0xac1f('0xd'),_0x198279,_0xac1f('0xc'),JSON[_0xac1f('0xe')](_0x44bf32));if(_0x44bf32['error']){if(_0x44bf32[_0xac1f('0xf')]['code']===0x1f4){logger[_0xac1f('0xf')](_0xac1f('0x10'),_0x198279,_0x44bf32[_0xac1f('0xf')]['message']);return _0x47096a(_0x44bf32[_0xac1f('0xf')][_0xac1f('0x11')]);}logger[_0xac1f('0xf')](_0xac1f('0x10'),_0x198279,_0x44bf32[_0xac1f('0xf')]['message']);return _0x2af1c4(_0x44bf32[_0xac1f('0xf')]['message']);}else{logger[_0xac1f('0xb')](_0xac1f('0x10'),_0x198279,'request\x20sent');_0x2af1c4(_0x44bf32[_0xac1f('0x12')][_0xac1f('0x11')]);}})[_0xac1f('0x13')](function(_0x380204){logger['error'](_0xac1f('0x10'),_0x198279,_0x380204);_0x47096a(_0x380204);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6c5d54c..38500db 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 _0xb78c=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','download','post','create','/:id','update','delete','destroy'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xb78c,0x169));var _0xcb78=function(_0xdbd4f7,_0x4e3bdd){_0xdbd4f7=_0xdbd4f7-0x0;var _0x5c3f9d=_0xb78c[_0xdbd4f7];return _0x5c3f9d;};'use strict';var multer=require(_0xcb78('0x0'));var util=require(_0xcb78('0x1'));var path=require('path');var timeout=require(_0xcb78('0x2'));var express=require('express');var router=express[_0xcb78('0x3')]();var auth=require(_0xcb78('0x4'));var interaction=require(_0xcb78('0x5'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xcb78('0x6')]('/',auth['isAuthenticated'](),controller[_0xcb78('0x7')]);router[_0xcb78('0x6')]('/:id',auth[_0xcb78('0x8')](),controller[_0xcb78('0x9')]);router['get']('/:id/download',auth[_0xcb78('0x8')](),controller[_0xcb78('0xa')]);router[_0xcb78('0xb')]('/',auth['isAuthenticated'](),controller[_0xcb78('0xc')]);router['put'](_0xcb78('0xd'),auth['isAuthenticated'](),controller[_0xcb78('0xe')]);router[_0xcb78('0xf')]('/:id',auth[_0xcb78('0x8')](),controller[_0xcb78('0x10')]);module[_0xcb78('0x11')]=router; \ No newline at end of file +var _0xfd8b=['util','path','connect-timeout','Router','../../components/auth/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','create','update','destroy','multer'];(function(_0x404cc7,_0x281967){var _0x554b04=function(_0x497a74){while(--_0x497a74){_0x404cc7['push'](_0x404cc7['shift']());}};_0x554b04(++_0x281967);}(_0xfd8b,0x131));var _0xbfd8=function(_0x5e586f,_0x4d823e){_0x5e586f=_0x5e586f-0x0;var _0x430f35=_0xfd8b[_0x5e586f];return _0x430f35;};'use strict';var multer=require(_0xbfd8('0x0'));var util=require(_0xbfd8('0x1'));var path=require(_0xbfd8('0x2'));var timeout=require(_0xbfd8('0x3'));var express=require('express');var router=express[_0xbfd8('0x4')]();var auth=require(_0xbfd8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbfd8('0x6'));router[_0xbfd8('0x7')]('/',auth[_0xbfd8('0x8')](),controller[_0xbfd8('0x9')]);router['get'](_0xbfd8('0xa'),auth[_0xbfd8('0x8')](),controller[_0xbfd8('0xb')]);router[_0xbfd8('0x7')](_0xbfd8('0xc'),auth['isAuthenticated'](),controller[_0xbfd8('0xd')]);router['post']('/',auth[_0xbfd8('0x8')](),controller[_0xbfd8('0xe')]);router['put'](_0xbfd8('0xa'),auth[_0xbfd8('0x8')](),controller[_0xbfd8('0xf')]);router['delete']('/:id',auth[_0xbfd8('0x8')](),controller[_0xbfd8('0x10')]);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 333fa41..a6d4e42 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 _0xed5a=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP'];(function(_0x101c18,_0x608208){var _0x16de76=function(_0xb01c58){while(--_0xb01c58){_0x101c18['push'](_0x101c18['shift']());}};_0x16de76(++_0x608208);}(_0xed5a,0x180));var _0xaed5=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0xed5a[_0x10f6e8];return _0x35bb3c;};'use strict';var Sequelize=require(_0xaed5('0x0'));module[_0xaed5('0x1')]={'name':{'type':Sequelize[_0xaed5('0x2')],'get':function(_0x596a70){return this[_0xaed5('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xaed5('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xaed5('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xaed5('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xaed5('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xaed5('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xaed5('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xaed5('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xaed5('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xaed5('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xaed5('0x5')],'defaultValue':''},'stamp':{'type':_0xaed5('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0x1248=['INTEGER','STRING','long','exports','VIRTUAL','getDataValue'];(function(_0x32a582,_0x327807){var _0x3d3503=function(_0x260340){while(--_0x260340){_0x32a582['push'](_0x32a582['shift']());}};_0x3d3503(++_0x327807);}(_0x1248,0x19b));var _0x8124=function(_0x39f63f,_0x277e36){_0x39f63f=_0x39f63f-0x0;var _0x43b316=_0x1248[_0x39f63f];return _0x43b316;};'use strict';var Sequelize=require('sequelize');module[_0x8124('0x0')]={'name':{'type':Sequelize[_0x8124('0x1')],'get':function(_0x445e25){return this[_0x8124('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x8124('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8124('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x8124('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8124('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8124('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x8124('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x8124('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8124('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8124('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x8124('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8124('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 0e1f947..ebca5bb 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 _0x6b1b=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','error','name','index','VoiceMailMessage','rawAttributes','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x1e9287,_0x37f584){var _0x44342e=function(_0x2f559e){while(--_0x2f559e){_0x1e9287['push'](_0x1e9287['shift']());}};_0x44342e(++_0x37f584);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x6b1b[_0x424a9a];return _0xa7831c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb6b1('0x0'));var rimraf=require(_0xb6b1('0x1'));var zipdir=require(_0xb6b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6b1('0x3'));var moment=require(_0xb6b1('0x4'));var BPromise=require(_0xb6b1('0x5'));var Mustache=require(_0xb6b1('0x6'));var util=require(_0xb6b1('0x7'));var path=require(_0xb6b1('0x8'));var sox=require(_0xb6b1('0x9'));var csv=require(_0xb6b1('0xa'));var ejs=require(_0xb6b1('0xb'));var fs=require('fs');var _=require(_0xb6b1('0xc'));var squel=require(_0xb6b1('0xd'));var crypto=require('crypto');var jsforce=require(_0xb6b1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb6b1('0xf'));var Papa=require('papaparse');var authService=require(_0xb6b1('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xb6b1('0x11'));var utils=require(_0xb6b1('0x12'));var config=require('../../config/environment');var db=require(_0xb6b1('0x13'))['db'];function respondWithStatusCode(_0x59831e,_0x5c5837){_0x5c5837=_0x5c5837||0xcc;return function(_0x406dce){if(_0x406dce){return _0x59831e[_0xb6b1('0x14')](_0x5c5837);}return _0x59831e[_0xb6b1('0x15')](_0x5c5837)[_0xb6b1('0x16')]();};}function respondWithResult(_0x23881d,_0x18f6b5){_0x18f6b5=_0x18f6b5||0xc8;return function(_0x360fc7){if(_0x360fc7){return _0x23881d[_0xb6b1('0x15')](_0x18f6b5)[_0xb6b1('0x17')](_0x360fc7);}};}function respondWithFilteredResult(_0x218c98,_0x2629db){return function(_0x14fef6){if(_0x14fef6){var _0x4f770a=_0x14fef6[_0xb6b1('0x18')],_0x57572a=_0x2629db[_0xb6b1('0x19')],_0x513207=_0x2629db[_0xb6b1('0x19')]+_0x2629db[_0xb6b1('0x1a')],_0x51f25f;if(_0x513207>=_0x4f770a){_0x513207=_0x4f770a;_0x51f25f=0xc8;}else{_0x51f25f=0xce;}_0x218c98[_0xb6b1('0x15')](_0x51f25f);return _0x218c98[_0xb6b1('0x1b')]('Content-Range',_0x57572a+'-'+_0x513207+'/'+_0x4f770a)['json'](_0x14fef6);}return null;};}function patchUpdates(_0x1bdf63){return function(_0x15456d){try{jsonpatch[_0xb6b1('0x1c')](_0x15456d,_0x1bdf63,!![]);}catch(_0x11e8ae){return BPromise[_0xb6b1('0x1d')](_0x11e8ae);}return _0x15456d[_0xb6b1('0x1e')]();};}function saveUpdates(_0x5ba14d,_0x4e132a){return function(_0x43312e){if(_0x43312e){return _0x43312e[_0xb6b1('0x1f')](_0x5ba14d)['then'](function(_0x5ced4c){return _0x5ced4c;});}return null;};}function removeEntity(_0xfc247a,_0x5c8529){return function(_0x509c55){if(_0x509c55){return _0x509c55[_0xb6b1('0x20')]()[_0xb6b1('0x21')](function(){_0xfc247a[_0xb6b1('0x15')](0xcc)[_0xb6b1('0x16')]();});}};}function handleEntityNotFound(_0x164952,_0x3d0864){return function(_0x1eb1b2){if(!_0x1eb1b2){_0x164952[_0xb6b1('0x14')](0x194);}return _0x1eb1b2;};}function handleError(_0x472585,_0x20066f){_0x20066f=_0x20066f||0x1f4;return function(_0x5069cd){logger[_0xb6b1('0x22')](_0x5069cd['stack']);if(_0x5069cd[_0xb6b1('0x23')]){delete _0x5069cd['name'];}_0x472585[_0xb6b1('0x15')](_0x20066f)['send'](_0x5069cd);};}exports[_0xb6b1('0x24')]=function(_0x387603,_0xac4256){var _0x178401={},_0x13e841={},_0x188627={'count':0x0,'rows':[]};var _0x3e0915=db[_0xb6b1('0x25')][_0xb6b1('0x26')];_0x13e841['model']=_[_0xb6b1('0x27')](_['keys'](_0x3e0915),[_0xb6b1('0x23')]);_0x13e841[_0xb6b1('0x28')]=_[_0xb6b1('0x29')](_0x387603[_0xb6b1('0x28')]);_0x13e841[_0xb6b1('0x2a')]=_[_0xb6b1('0x2b')](_0x13e841[_0xb6b1('0x2c')],_0x13e841['query']);_0x178401[_0xb6b1('0x2d')]=_[_0xb6b1('0x2b')](_0x13e841[_0xb6b1('0x2c')],qs['fields'](_0x387603[_0xb6b1('0x28')][_0xb6b1('0x2e')]));_0x178401['attributes']=_0x178401[_0xb6b1('0x2d')][_0xb6b1('0x2f')]?_0x178401[_0xb6b1('0x2d')]:_0x13e841[_0xb6b1('0x2c')];if(!_0x387603[_0xb6b1('0x28')][_0xb6b1('0x30')]('nolimit')){_0x178401[_0xb6b1('0x1a')]=qs[_0xb6b1('0x1a')](_0x387603['query'][_0xb6b1('0x1a')]);_0x178401['offset']=qs[_0xb6b1('0x19')](_0x387603[_0xb6b1('0x28')][_0xb6b1('0x19')]);}_0x178401[_0xb6b1('0x31')]=qs[_0xb6b1('0x32')](_0x387603[_0xb6b1('0x28')]['sort']);_0x178401[_0xb6b1('0x33')]=qs[_0xb6b1('0x2a')](_[_0xb6b1('0x34')](_0x387603[_0xb6b1('0x28')],_0x13e841['filters']));if(_0x387603['query']['filter']){_0x178401[_0xb6b1('0x33')]=_[_0xb6b1('0x35')](_0x178401[_0xb6b1('0x33')],{'$or':_[_0xb6b1('0x36')](_0x3e0915,function(_0x1c83c4){if(_0x1c83c4[_0xb6b1('0x37')][_0xb6b1('0x38')]!==_0xb6b1('0x39')){var _0x206008={};_0x206008[_0x1c83c4[_0xb6b1('0x3a')]]={'$like':'%'+_0x387603[_0xb6b1('0x28')][_0xb6b1('0x3b')]+'%'};return _0x206008;}})});}_0x178401=_['merge']({},_0x178401,_0x387603[_0xb6b1('0x3c')]);var _0x3b9312={'where':_0x178401[_0xb6b1('0x33')]};return db[_0xb6b1('0x25')][_0xb6b1('0x18')](_0x3b9312)[_0xb6b1('0x21')](function(_0xfe126){_0x188627[_0xb6b1('0x18')]=_0xfe126;if(_0x387603[_0xb6b1('0x28')][_0xb6b1('0x3d')]){_0x178401[_0xb6b1('0x3e')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xb6b1('0x3f')](_0x178401);})[_0xb6b1('0x21')](function(_0x3090ac){_0x188627[_0xb6b1('0x40')]=_0x3090ac;return _0x188627;})[_0xb6b1('0x21')](respondWithFilteredResult(_0xac4256,_0x178401))[_0xb6b1('0x41')](handleError(_0xac4256,null));};exports[_0xb6b1('0x42')]=function(_0x22be21,_0x51e68c){var _0x4ef889={'raw':!![],'where':{'id':_0x22be21[_0xb6b1('0x43')]['id']}},_0x46070c={};_0x46070c[_0xb6b1('0x2c')]=_['keys'](db[_0xb6b1('0x25')][_0xb6b1('0x26')]);_0x46070c[_0xb6b1('0x28')]=_[_0xb6b1('0x29')](_0x22be21[_0xb6b1('0x28')]);_0x46070c[_0xb6b1('0x2a')]=_[_0xb6b1('0x2b')](_0x46070c[_0xb6b1('0x2c')],_0x46070c['query']);_0x4ef889[_0xb6b1('0x2d')]=_['intersection'](_0x46070c[_0xb6b1('0x2c')],qs[_0xb6b1('0x2e')](_0x22be21[_0xb6b1('0x28')][_0xb6b1('0x2e')]));_0x4ef889[_0xb6b1('0x2d')]=_0x4ef889[_0xb6b1('0x2d')]['length']?_0x4ef889[_0xb6b1('0x2d')]:_0x46070c[_0xb6b1('0x2c')];if(_0x22be21['query'][_0xb6b1('0x3d')]){_0x4ef889['include']=[{'all':!![]}];}_0x4ef889=_[_0xb6b1('0x35')]({},_0x4ef889,_0x22be21[_0xb6b1('0x3c')]);return db[_0xb6b1('0x25')][_0xb6b1('0x44')](_0x4ef889)[_0xb6b1('0x21')](handleEntityNotFound(_0x51e68c,null))[_0xb6b1('0x21')](respondWithResult(_0x51e68c,null))[_0xb6b1('0x41')](handleError(_0x51e68c,null));};exports[_0xb6b1('0x45')]=function(_0x1d5b09,_0x5e5bbe){return db['VoiceMailMessage'][_0xb6b1('0x45')](_0x1d5b09[_0xb6b1('0x46')],{})['then'](respondWithResult(_0x5e5bbe,0xc9))[_0xb6b1('0x41')](handleError(_0x5e5bbe,null));};exports[_0xb6b1('0x1f')]=function(_0x6f7b41,_0x1a95cf){if(_0x6f7b41[_0xb6b1('0x46')]['id']){delete _0x6f7b41['body']['id'];}return db[_0xb6b1('0x25')][_0xb6b1('0x44')]({'where':{'id':_0x6f7b41[_0xb6b1('0x43')]['id']}})[_0xb6b1('0x21')](handleEntityNotFound(_0x1a95cf,null))['then'](saveUpdates(_0x6f7b41['body'],null))[_0xb6b1('0x21')](respondWithResult(_0x1a95cf,null))['catch'](handleError(_0x1a95cf,null));};exports[_0xb6b1('0x20')]=function(_0x3f09dc,_0x5b2b3e){return db[_0xb6b1('0x25')]['find']({'where':{'id':_0x3f09dc[_0xb6b1('0x43')]['id']}})[_0xb6b1('0x21')](handleEntityNotFound(_0x5b2b3e,null))[_0xb6b1('0x21')](removeEntity(_0x5b2b3e,null))[_0xb6b1('0x41')](handleError(_0x5b2b3e,null));};exports[_0xb6b1('0x47')]=function(_0xc63bf5,_0xc9289e,_0x1c513c){return db[_0xb6b1('0x25')][_0xb6b1('0x44')]({'where':{'id':_0xc63bf5['params']['id']},'attributes':['id',_0xb6b1('0x48'),_0xb6b1('0x49')]})[_0xb6b1('0x21')](handleEntityNotFound(_0xc9289e,null))[_0xb6b1('0x21')](function(_0x46c4ef){if(_0x46c4ef){if(!_0x46c4ef[_0xb6b1('0x48')]){throw new db[(_0xb6b1('0x4a'))][(_0xb6b1('0x4b'))](_0xb6b1('0x4c'));}var _0x518b99={'Content-Type':_0xb6b1('0x4d'),'Content-Disposition':'attachment'};if(_0x46c4ef['msg_id']){_0x518b99[_0xb6b1('0x4e')]=_0xb6b1('0x4f')+_0x46c4ef['msg_id']+_0xb6b1('0x50');}_0xc9289e[_0xb6b1('0x1b')](_0x518b99);return _0xc9289e[_0xb6b1('0x51')](new Buffer(_0x46c4ef['recording']));}})[_0xb6b1('0x41')](handleError(_0xc9289e,null));}; \ No newline at end of file +var _0x77d4=['filter','merge','map','key','VIRTUAL','field','includeAll','findAll','rows','catch','show','params','include','find','create','body','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/utils','../../config/environment','status','end','count','offset','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','VoiceMailMessage','rawAttributes','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick'];(function(_0x47ad1a,_0x467d68){var _0x586211=function(_0x169364){while(--_0x169364){_0x47ad1a['push'](_0x47ad1a['shift']());}};_0x586211(++_0x467d68);}(_0x77d4,0x108));var _0x477d=function(_0x185d17,_0x36bb78){_0x185d17=_0x185d17-0x0;var _0x2debcb=_0x77d4[_0x185d17];return _0x2debcb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x477d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x477d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x477d('0x2'));var moment=require(_0x477d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x477d('0x4'));var path=require(_0x477d('0x5'));var sox=require(_0x477d('0x6'));var csv=require(_0x477d('0x7'));var ejs=require(_0x477d('0x8'));var fs=require('fs');var _=require(_0x477d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x477d('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x477d('0xb'));var Papa=require(_0x477d('0xc'));var authService=require(_0x477d('0xd'));var hardwareService=require(_0x477d('0xe'));var Redis=require(_0x477d('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x477d('0x10'))('api');var utils=require(_0x477d('0x11'));var config=require(_0x477d('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x472012,_0x3d362a){_0x3d362a=_0x3d362a||0xcc;return function(_0x5a190c){if(_0x5a190c){return _0x472012['sendStatus'](_0x3d362a);}return _0x472012[_0x477d('0x13')](_0x3d362a)[_0x477d('0x14')]();};}function respondWithResult(_0x55bdfd,_0x290d46){_0x290d46=_0x290d46||0xc8;return function(_0x1d5699){if(_0x1d5699){return _0x55bdfd['status'](_0x290d46)['json'](_0x1d5699);}};}function respondWithFilteredResult(_0x38a0a8,_0x4bbfef){return function(_0x30481f){if(_0x30481f){var _0x234b99=_0x30481f[_0x477d('0x15')],_0x25fc02=_0x4bbfef[_0x477d('0x16')],_0x5985b5=_0x4bbfef[_0x477d('0x16')]+_0x4bbfef['limit'],_0x116aa7;if(_0x5985b5>=_0x234b99){_0x5985b5=_0x234b99;_0x116aa7=0xc8;}else{_0x116aa7=0xce;}_0x38a0a8[_0x477d('0x13')](_0x116aa7);return _0x38a0a8['set'](_0x477d('0x17'),_0x25fc02+'-'+_0x5985b5+'/'+_0x234b99)[_0x477d('0x18')](_0x30481f);}return null;};}function patchUpdates(_0x159beb){return function(_0x458489){try{jsonpatch[_0x477d('0x19')](_0x458489,_0x159beb,!![]);}catch(_0x2145ce){return BPromise['reject'](_0x2145ce);}return _0x458489[_0x477d('0x1a')]();};}function saveUpdates(_0x49c442,_0xe934a7){return function(_0x24a6d5){if(_0x24a6d5){return _0x24a6d5[_0x477d('0x1b')](_0x49c442)[_0x477d('0x1c')](function(_0x27b3aa){return _0x27b3aa;});}return null;};}function removeEntity(_0x3b3cda,_0x435a3b){return function(_0x17154d){if(_0x17154d){return _0x17154d[_0x477d('0x1d')]()[_0x477d('0x1c')](function(){_0x3b3cda[_0x477d('0x13')](0xcc)[_0x477d('0x14')]();});}};}function handleEntityNotFound(_0x43c845,_0x1f3868){return function(_0x4e6a44){if(!_0x4e6a44){_0x43c845[_0x477d('0x1e')](0x194);}return _0x4e6a44;};}function handleError(_0x583444,_0x239b56){_0x239b56=_0x239b56||0x1f4;return function(_0x2506d8){logger[_0x477d('0x1f')](_0x2506d8[_0x477d('0x20')]);if(_0x2506d8['name']){delete _0x2506d8[_0x477d('0x21')];}_0x583444[_0x477d('0x13')](_0x239b56)[_0x477d('0x22')](_0x2506d8);};}exports['index']=function(_0x585648,_0x198697){var _0x3c6270={},_0x386df5={},_0x5c8ef1={'count':0x0,'rows':[]};var _0x254141=db[_0x477d('0x23')][_0x477d('0x24')];_0x386df5[_0x477d('0x25')]=_[_0x477d('0x26')](_['keys'](_0x254141),[_0x477d('0x21')]);_0x386df5[_0x477d('0x27')]=_[_0x477d('0x28')](_0x585648[_0x477d('0x27')]);_0x386df5[_0x477d('0x29')]=_[_0x477d('0x2a')](_0x386df5[_0x477d('0x25')],_0x386df5[_0x477d('0x27')]);_0x3c6270[_0x477d('0x2b')]=_[_0x477d('0x2a')](_0x386df5[_0x477d('0x25')],qs[_0x477d('0x2c')](_0x585648[_0x477d('0x27')][_0x477d('0x2c')]));_0x3c6270[_0x477d('0x2b')]=_0x3c6270[_0x477d('0x2b')][_0x477d('0x2d')]?_0x3c6270[_0x477d('0x2b')]:_0x386df5[_0x477d('0x25')];if(!_0x585648[_0x477d('0x27')]['hasOwnProperty'](_0x477d('0x2e'))){_0x3c6270['limit']=qs[_0x477d('0x2f')](_0x585648[_0x477d('0x27')][_0x477d('0x2f')]);_0x3c6270['offset']=qs[_0x477d('0x16')](_0x585648[_0x477d('0x27')][_0x477d('0x16')]);}_0x3c6270[_0x477d('0x30')]=qs[_0x477d('0x31')](_0x585648[_0x477d('0x27')][_0x477d('0x31')]);_0x3c6270[_0x477d('0x32')]=qs[_0x477d('0x29')](_[_0x477d('0x33')](_0x585648['query'],_0x386df5[_0x477d('0x29')]));if(_0x585648[_0x477d('0x27')][_0x477d('0x34')]){_0x3c6270['where']=_[_0x477d('0x35')](_0x3c6270[_0x477d('0x32')],{'$or':_[_0x477d('0x36')](_0x254141,function(_0x53c996){if(_0x53c996['type'][_0x477d('0x37')]!==_0x477d('0x38')){var _0x260e14={};_0x260e14[_0x53c996[_0x477d('0x39')]]={'$like':'%'+_0x585648[_0x477d('0x27')]['filter']+'%'};return _0x260e14;}})});}_0x3c6270=_[_0x477d('0x35')]({},_0x3c6270,_0x585648['options']);var _0x7b73b9={'where':_0x3c6270[_0x477d('0x32')]};return db[_0x477d('0x23')]['count'](_0x7b73b9)['then'](function(_0x184d50){_0x5c8ef1[_0x477d('0x15')]=_0x184d50;if(_0x585648[_0x477d('0x27')][_0x477d('0x3a')]){_0x3c6270['include']=[{'all':!![]}];}return db[_0x477d('0x23')][_0x477d('0x3b')](_0x3c6270);})[_0x477d('0x1c')](function(_0x3b2972){_0x5c8ef1[_0x477d('0x3c')]=_0x3b2972;return _0x5c8ef1;})['then'](respondWithFilteredResult(_0x198697,_0x3c6270))[_0x477d('0x3d')](handleError(_0x198697,null));};exports[_0x477d('0x3e')]=function(_0x4d1c8e,_0x473962){var _0x5c814c={'raw':!![],'where':{'id':_0x4d1c8e[_0x477d('0x3f')]['id']}},_0xa43df8={};_0xa43df8[_0x477d('0x25')]=_[_0x477d('0x28')](db[_0x477d('0x23')][_0x477d('0x24')]);_0xa43df8[_0x477d('0x27')]=_[_0x477d('0x28')](_0x4d1c8e[_0x477d('0x27')]);_0xa43df8['filters']=_[_0x477d('0x2a')](_0xa43df8[_0x477d('0x25')],_0xa43df8[_0x477d('0x27')]);_0x5c814c[_0x477d('0x2b')]=_['intersection'](_0xa43df8['model'],qs[_0x477d('0x2c')](_0x4d1c8e[_0x477d('0x27')]['fields']));_0x5c814c[_0x477d('0x2b')]=_0x5c814c['attributes']['length']?_0x5c814c[_0x477d('0x2b')]:_0xa43df8[_0x477d('0x25')];if(_0x4d1c8e[_0x477d('0x27')][_0x477d('0x3a')]){_0x5c814c[_0x477d('0x40')]=[{'all':!![]}];}_0x5c814c=_[_0x477d('0x35')]({},_0x5c814c,_0x4d1c8e['options']);return db[_0x477d('0x23')][_0x477d('0x41')](_0x5c814c)[_0x477d('0x1c')](handleEntityNotFound(_0x473962,null))[_0x477d('0x1c')](respondWithResult(_0x473962,null))[_0x477d('0x3d')](handleError(_0x473962,null));};exports['create']=function(_0x4aad41,_0xf5084c){return db[_0x477d('0x23')][_0x477d('0x42')](_0x4aad41['body'],{})[_0x477d('0x1c')](respondWithResult(_0xf5084c,0xc9))[_0x477d('0x3d')](handleError(_0xf5084c,null));};exports[_0x477d('0x1b')]=function(_0x1ad4d1,_0x247b40){if(_0x1ad4d1[_0x477d('0x43')]['id']){delete _0x1ad4d1[_0x477d('0x43')]['id'];}return db['VoiceMailMessage'][_0x477d('0x41')]({'where':{'id':_0x1ad4d1[_0x477d('0x3f')]['id']}})[_0x477d('0x1c')](handleEntityNotFound(_0x247b40,null))[_0x477d('0x1c')](saveUpdates(_0x1ad4d1[_0x477d('0x43')],null))[_0x477d('0x1c')](respondWithResult(_0x247b40,null))[_0x477d('0x3d')](handleError(_0x247b40,null));};exports[_0x477d('0x1d')]=function(_0x113162,_0x33df7f){return db[_0x477d('0x23')][_0x477d('0x41')]({'where':{'id':_0x113162[_0x477d('0x3f')]['id']}})[_0x477d('0x1c')](handleEntityNotFound(_0x33df7f,null))[_0x477d('0x1c')](removeEntity(_0x33df7f,null))['catch'](handleError(_0x33df7f,null));};exports[_0x477d('0x44')]=function(_0x23d85f,_0x47ee38,_0x566ba0){return db['VoiceMailMessage'][_0x477d('0x41')]({'where':{'id':_0x23d85f[_0x477d('0x3f')]['id']},'attributes':['id',_0x477d('0x45'),_0x477d('0x46')]})[_0x477d('0x1c')](handleEntityNotFound(_0x47ee38,null))[_0x477d('0x1c')](function(_0x4257ab){if(_0x4257ab){if(!_0x4257ab[_0x477d('0x45')]){throw new db['Sequelize'][(_0x477d('0x47'))](_0x477d('0x48'));}var _0x2a303c={'Content-Type':_0x477d('0x49'),'Content-Disposition':_0x477d('0x4a')};if(_0x4257ab[_0x477d('0x46')]){_0x2a303c[_0x477d('0x4b')]=_0x477d('0x4c')+_0x4257ab['msg_id']+_0x477d('0x4d');}_0x47ee38[_0x477d('0x4e')](_0x2a303c);return _0x47ee38[_0x477d('0x22')](new Buffer(_0x4257ab[_0x477d('0x45')]));}})[_0x477d('0x3d')](handleError(_0x47ee38,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 18af01f..64fe1e2 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 _0x9c47=['./voiceMailMessage.attributes','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x66acb3,_0x2f6440){var _0x289d45=function(_0x37821d){while(--_0x37821d){_0x66acb3['push'](_0x66acb3['shift']());}};_0x289d45(++_0x2f6440);}(_0x9c47,0x12c));var _0x79c4=function(_0x1a802c,_0x40e7d7){_0x1a802c=_0x1a802c-0x0;var _0x1b79a4=_0x9c47[_0x1a802c];return _0x1b79a4;};'use strict';var _=require(_0x79c4('0x0'));var util=require('util');var logger=require(_0x79c4('0x1'))(_0x79c4('0x2'));var moment=require(_0x79c4('0x3'));var BPromise=require(_0x79c4('0x4'));var rp=require(_0x79c4('0x5'));var attributes=require(_0x79c4('0x6'));module['exports']=function(_0x3aabd8,_0xb53b0d){return _0x3aabd8['define']('VoiceMailMessage',attributes,{'tableName':_0x79c4('0x7'),'paranoid':![],'indexes':[{'name':_0x79c4('0x8'),'fields':[_0x79c4('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5e09=['bluebird','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment'];(function(_0x22440d,_0x5272c1){var _0x2f692e=function(_0x4d3ce2){while(--_0x4d3ce2){_0x22440d['push'](_0x22440d['shift']());}};_0x2f692e(++_0x5272c1);}(_0x5e09,0xee));var _0x95e0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5e09[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x95e0('0x0'));var logger=require(_0x95e0('0x1'))(_0x95e0('0x2'));var moment=require(_0x95e0('0x3'));var BPromise=require(_0x95e0('0x4'));var rp=require('request-promise');var attributes=require(_0x95e0('0x5'));module[_0x95e0('0x6')]=function(_0x30b66c,_0x123fa9){return _0x30b66c[_0x95e0('0x7')](_0x95e0('0x8'),attributes,{'tableName':_0x95e0('0x9'),'paranoid':![],'indexes':[{'name':_0x95e0('0xa'),'fields':[_0x95e0('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 9508004..388cb29 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 _0x79d8=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79d8,0x1bb));var _0x879d=function(_0x32b006,_0x36590d){_0x32b006=_0x32b006-0x0;var _0x3e1e21=_0x79d8[_0x32b006];return _0x3e1e21;};'use strict';var _=require(_0x879d('0x0'));var util=require(_0x879d('0x1'));var moment=require(_0x879d('0x2'));var BPromise=require(_0x879d('0x3'));var rs=require(_0x879d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x879d('0x5'))['db'];var utils=require(_0x879d('0x6'));var logger=require(_0x879d('0x7'))(_0x879d('0x8'));var config=require(_0x879d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x879d('0xa')][_0x879d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c3e15,_0x21f04e,_0x25720c){return new BPromise(function(_0x233d84,_0x2220a7){return client[_0x879d('0xc')](_0x3c3e15,_0x25720c)[_0x879d('0xd')](function(_0x11b4bc){logger['info'](_0x879d('0xe'),_0x21f04e,_0x879d('0xf'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x21f04e,_0x879d('0xf'),JSON['stringify'](_0x11b4bc));if(_0x11b4bc[_0x879d('0x10')]){if(_0x11b4bc['error'][_0x879d('0x11')]===0x1f4){logger[_0x879d('0x10')](_0x879d('0xe'),_0x21f04e,_0x11b4bc[_0x879d('0x10')][_0x879d('0x12')]);return _0x2220a7(_0x11b4bc['error'][_0x879d('0x12')]);}logger[_0x879d('0x10')](_0x879d('0xe'),_0x21f04e,_0x11b4bc['error']['message']);return _0x233d84(_0x11b4bc[_0x879d('0x10')][_0x879d('0x12')]);}else{logger[_0x879d('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x21f04e,_0x879d('0xf'));_0x233d84(_0x11b4bc[_0x879d('0x14')][_0x879d('0x12')]);}})[_0x879d('0x15')](function(_0x34286b){logger[_0x879d('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x21f04e,_0x34286b);_0x2220a7(_0x34286b);});});} \ No newline at end of file +var _0xcc53=['info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x55e28f,_0x20cedb){var _0xee48e9=function(_0x1de3df){while(--_0x1de3df){_0x55e28f['push'](_0x55e28f['shift']());}};_0xee48e9(++_0x20cedb);}(_0xcc53,0x184));var _0x3cc5=function(_0x1fbdd1,_0x11ebc7){_0x1fbdd1=_0x1fbdd1-0x0;var _0x4101c7=_0xcc53[_0x1fbdd1];return _0x4101c7;};'use strict';var _=require(_0x3cc5('0x0'));var util=require(_0x3cc5('0x1'));var moment=require(_0x3cc5('0x2'));var BPromise=require('bluebird');var rs=require(_0x3cc5('0x3'));var fs=require('fs');var Redis=require(_0x3cc5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3cc5('0x5'));var logger=require(_0x3cc5('0x6'))(_0x3cc5('0x7'));var config=require(_0x3cc5('0x8'));var jayson=require(_0x3cc5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x401afe,_0x572fd9,_0x4ab3ef){return new BPromise(function(_0x365f2a,_0x495f22){return client[_0x3cc5('0xa')](_0x401afe,_0x4ab3ef)[_0x3cc5('0xb')](function(_0x4da747){logger[_0x3cc5('0xc')](_0x3cc5('0xd'),_0x572fd9,_0x3cc5('0xe'));logger['debug'](_0x3cc5('0xf'),_0x572fd9,_0x3cc5('0xe'),JSON[_0x3cc5('0x10')](_0x4da747));if(_0x4da747[_0x3cc5('0x11')]){if(_0x4da747[_0x3cc5('0x11')]['code']===0x1f4){logger[_0x3cc5('0x11')](_0x3cc5('0xd'),_0x572fd9,_0x4da747[_0x3cc5('0x11')][_0x3cc5('0x12')]);return _0x495f22(_0x4da747[_0x3cc5('0x11')][_0x3cc5('0x12')]);}logger[_0x3cc5('0x11')](_0x3cc5('0xd'),_0x572fd9,_0x4da747[_0x3cc5('0x11')][_0x3cc5('0x12')]);return _0x365f2a(_0x4da747[_0x3cc5('0x11')][_0x3cc5('0x12')]);}else{logger[_0x3cc5('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x572fd9,_0x3cc5('0xe'));_0x365f2a(_0x4da747['result']['message']);}})[_0x3cc5('0x13')](function(_0x28b213){logger[_0x3cc5('0x11')](_0x3cc5('0xd'),_0x572fd9,_0x28b213);_0x495f22(_0x28b213);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5feb1b6..01151ba 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 _0x39cb=['destroy','/:id/sounds/:id2','removeSound','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','getSounds','post','addSound','put','update','delete'];(function(_0x496f5c,_0x3e0ae2){var _0x22d812=function(_0x450b9a){while(--_0x450b9a){_0x496f5c['push'](_0x496f5c['shift']());}};_0x22d812(++_0x3e0ae2);}(_0x39cb,0x1bd));var _0xb39c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x39cb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb39c('0x4'));var config=require(_0xb39c('0x5'));var controller=require(_0xb39c('0x6'));router[_0xb39c('0x7')]('/',auth[_0xb39c('0x8')](),controller['index']);router[_0xb39c('0x7')](_0xb39c('0x9'),auth[_0xb39c('0x8')](),controller[_0xb39c('0xa')]);router['get']('/:id/sounds',auth[_0xb39c('0x8')](),controller[_0xb39c('0xb')]);router[_0xb39c('0xc')]('/',auth[_0xb39c('0x8')](),controller['create']);router['post']('/:id/sounds',auth[_0xb39c('0x8')](),controller[_0xb39c('0xd')]);router[_0xb39c('0xe')](_0xb39c('0x9'),auth[_0xb39c('0x8')](),controller[_0xb39c('0xf')]);router[_0xb39c('0x10')](_0xb39c('0x9'),auth['isAuthenticated'](),controller[_0xb39c('0x11')]);router[_0xb39c('0x10')](_0xb39c('0x12'),auth['isAuthenticated'](),controller[_0xb39c('0x13')]);module[_0xb39c('0x14')]=router; \ No newline at end of file +var _0x9aea=['exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','/:id/sounds','getSounds','post','create','addSound','update','delete','destroy','removeSound'];(function(_0x196995,_0x2575dd){var _0x1ff73a=function(_0x4b6aeb){while(--_0x4b6aeb){_0x196995['push'](_0x196995['shift']());}};_0x1ff73a(++_0x2575dd);}(_0x9aea,0xdd));var _0xa9ae=function(_0x2ebc59,_0x253204){_0x2ebc59=_0x2ebc59-0x0;var _0xd48ac3=_0x9aea[_0x2ebc59];return _0xd48ac3;};'use strict';var multer=require(_0xa9ae('0x0'));var util=require('util');var path=require(_0xa9ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xa9ae('0x2'));var router=express[_0xa9ae('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa9ae('0x4'));var config=require(_0xa9ae('0x5'));var controller=require(_0xa9ae('0x6'));router[_0xa9ae('0x7')]('/',auth[_0xa9ae('0x8')](),controller['index']);router[_0xa9ae('0x7')](_0xa9ae('0x9'),auth[_0xa9ae('0x8')](),controller['show']);router[_0xa9ae('0x7')](_0xa9ae('0xa'),auth[_0xa9ae('0x8')](),controller[_0xa9ae('0xb')]);router[_0xa9ae('0xc')]('/',auth[_0xa9ae('0x8')](),controller[_0xa9ae('0xd')]);router[_0xa9ae('0xc')](_0xa9ae('0xa'),auth['isAuthenticated'](),controller[_0xa9ae('0xe')]);router['put'](_0xa9ae('0x9'),auth[_0xa9ae('0x8')](),controller[_0xa9ae('0xf')]);router[_0xa9ae('0x10')](_0xa9ae('0x9'),auth[_0xa9ae('0x8')](),controller[_0xa9ae('0x11')]);router[_0xa9ae('0x10')]('/:id/sounds/:id2',auth[_0xa9ae('0x8')](),controller[_0xa9ae('0x12')]);module[_0xa9ae('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 7fea122..e96662f 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 _0x54e5=['files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x1b1604,_0x368535){var _0x57918d=function(_0x176c51){while(--_0x176c51){_0x1b1604['push'](_0x1b1604['shift']());}};_0x57918d(++_0x368535);}(_0x54e5,0x1dc));var _0x554e=function(_0x15b6d2,_0x3bf4be){_0x15b6d2=_0x15b6d2-0x0;var _0x36a1e2=_0x54e5[_0x15b6d2];return _0x36a1e2;};'use strict';var Sequelize=require(_0x554e('0x0'));module[_0x554e('0x1')]={'name':{'type':Sequelize[_0x554e('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x554e('0x3')]('custom',_0x554e('0x4'),_0x554e('0x5'),_0x554e('0x6'),_0x554e('0x7'),_0x554e('0x8')),'allowNull':!![],'defaultValue':_0x554e('0x4')},'directory':{'type':Sequelize[_0x554e('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x554e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x554e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x554e('0x2')],'allowNull':!![],'defaultValue':_0x554e('0x9')},'format':{'type':Sequelize[_0x554e('0x2')],'allowNull':!![]},'stamp':{'type':_0x554e('0xa')},'defaultEntry':{'type':Sequelize[_0x554e('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc43e=['files','mp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','STRING','name','ENUM','custom'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xc43e,0x11e));var _0xec43=function(_0x275b0d,_0xfa6f31){_0x275b0d=_0x275b0d-0x0;var _0x2d1453=_0xc43e[_0x275b0d];return _0x2d1453;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xec43('0x0')],'allowNull':![],'unique':_0xec43('0x1')},'mode':{'type':Sequelize[_0xec43('0x2')](_0xec43('0x3'),_0xec43('0x4'),_0xec43('0x5'),'quietmp3nb',_0xec43('0x6'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xec43('0x0')],'allowNull':!![]},'digit':{'type':Sequelize[_0xec43('0x0')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xec43('0x7')},'format':{'type':Sequelize[_0xec43('0x0')],'allowNull':!![]},'stamp':{'type':_0xec43('0x8')},'defaultEntry':{'type':Sequelize[_0xec43('0x9')],'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 e8eab2b..a054d0d 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 _0x5e09=['role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','rmdirSync','Sequelize','ValidationError','message','sequelize','addSound','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','removeSound','id2','Sound','findOne','getSounds','intersection','length','map','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','index','VoiceMusicOnHold','rawAttributes','model','keys','query','attributes','fields','limit','order','sort','where','filters','pick','merge','key','field','filter','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','transaction','mode','files','join','root','server/files/moh','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x258c89,_0x388857){var _0x27eba4=function(_0x4e6958){while(--_0x4e6958){_0x258c89['push'](_0x258c89['shift']());}};_0x27eba4(++_0x388857);}(_0x5e09,0xfb));var _0x95e0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5e09[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x95e0('0x0'));var emlformat=require(_0x95e0('0x1'));var rimraf=require(_0x95e0('0x2'));var zipdir=require(_0x95e0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95e0('0x4'));var moment=require(_0x95e0('0x5'));var BPromise=require(_0x95e0('0x6'));var Mustache=require(_0x95e0('0x7'));var util=require('util');var path=require(_0x95e0('0x8'));var sox=require(_0x95e0('0x9'));var csv=require('to-csv');var ejs=require(_0x95e0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x95e0('0xb'));var crypto=require(_0x95e0('0xc'));var jsforce=require(_0x95e0('0xd'));var deskjs=require(_0x95e0('0xe'));var toCsv=require(_0x95e0('0xf'));var querystring=require(_0x95e0('0x10'));var Papa=require(_0x95e0('0x11'));var authService=require(_0x95e0('0x12'));var hardwareService=require(_0x95e0('0x13'));var Redis=require(_0x95e0('0x14'));var qs=require(_0x95e0('0x15'));var logger=require(_0x95e0('0x16'))('api');var utils=require(_0x95e0('0x17'));var config=require(_0x95e0('0x18'));var db=require(_0x95e0('0x19'))['db'];function respondWithStatusCode(_0x20bb73,_0xa6db92){_0xa6db92=_0xa6db92||0xcc;return function(_0x2c6f54){if(_0x2c6f54){return _0x20bb73[_0x95e0('0x1a')](_0xa6db92);}return _0x20bb73[_0x95e0('0x1b')](_0xa6db92)[_0x95e0('0x1c')]();};}function respondWithResult(_0x5392bf,_0x4c564e){_0x4c564e=_0x4c564e||0xc8;return function(_0x5ab1da){if(_0x5ab1da){return _0x5392bf[_0x95e0('0x1b')](_0x4c564e)['json'](_0x5ab1da);}};}function respondWithFilteredResult(_0x2d3855,_0x5829e3){return function(_0x3e0751){if(_0x3e0751){var _0x35b0c9=_0x3e0751[_0x95e0('0x1d')],_0x1a897c=_0x5829e3['offset'],_0x4015f2=_0x5829e3[_0x95e0('0x1e')]+_0x5829e3['limit'],_0x4f3032;if(_0x4015f2>=_0x35b0c9){_0x4015f2=_0x35b0c9;_0x4f3032=0xc8;}else{_0x4f3032=0xce;}_0x2d3855[_0x95e0('0x1b')](_0x4f3032);return _0x2d3855[_0x95e0('0x1f')](_0x95e0('0x20'),_0x1a897c+'-'+_0x4015f2+'/'+_0x35b0c9)[_0x95e0('0x21')](_0x3e0751);}return null;};}function patchUpdates(_0x19e17b){return function(_0x4f3d1f){try{jsonpatch[_0x95e0('0x22')](_0x4f3d1f,_0x19e17b,!![]);}catch(_0x227865){return BPromise['reject'](_0x227865);}return _0x4f3d1f[_0x95e0('0x23')]();};}function saveUpdates(_0x3f2304,_0x2cfa0d){return function(_0x43402a){if(_0x43402a){return _0x43402a[_0x95e0('0x24')](_0x3f2304)[_0x95e0('0x25')](function(_0x3b976e){return _0x3b976e;});}return null;};}function removeEntity(_0x4e1ac6,_0x58c208){return function(_0x4905c5){if(_0x4905c5){return _0x4905c5[_0x95e0('0x26')]()[_0x95e0('0x25')](function(){var _0x1b9233=_0x4905c5[_0x95e0('0x27')]({'plain':!![]});var _0x4ba766=_0x95e0('0x28');return db[_0x95e0('0x29')]['destroy']({'where':{'type':_0x4ba766,'resourceId':_0x1b9233['id']}})[_0x95e0('0x25')](function(){return _0x4905c5;});})[_0x95e0('0x25')](function(){_0x4e1ac6[_0x95e0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ce9c,_0x3bd701){return function(_0x282117){if(!_0x282117){_0x13ce9c[_0x95e0('0x1a')](0x194);}return _0x282117;};}function handleError(_0x37006b,_0xbeb3c3){_0xbeb3c3=_0xbeb3c3||0x1f4;return function(_0x267e92){logger['error'](_0x267e92[_0x95e0('0x2a')]);if(_0x267e92[_0x95e0('0x2b')]){delete _0x267e92[_0x95e0('0x2b')];}_0x37006b[_0x95e0('0x1b')](_0xbeb3c3)['send'](_0x267e92);};}exports[_0x95e0('0x2c')]=function(_0x4d4b22,_0x8b548f){var _0x52acc3={},_0x102c0f={},_0x12a8a8={'count':0x0,'rows':[]};var _0x318245=db[_0x95e0('0x2d')][_0x95e0('0x2e')];_0x102c0f[_0x95e0('0x2f')]=_[_0x95e0('0x30')](_0x318245);_0x102c0f[_0x95e0('0x31')]=_['keys'](_0x4d4b22[_0x95e0('0x31')]);_0x102c0f['filters']=_['intersection'](_0x102c0f[_0x95e0('0x2f')],_0x102c0f[_0x95e0('0x31')]);_0x52acc3[_0x95e0('0x32')]=_['intersection'](_0x102c0f['model'],qs[_0x95e0('0x33')](_0x4d4b22[_0x95e0('0x31')][_0x95e0('0x33')]));_0x52acc3['attributes']=_0x52acc3[_0x95e0('0x32')]['length']?_0x52acc3['attributes']:_0x102c0f['model'];if(!_0x4d4b22[_0x95e0('0x31')]['hasOwnProperty']('nolimit')){_0x52acc3['limit']=qs['limit'](_0x4d4b22[_0x95e0('0x31')][_0x95e0('0x34')]);_0x52acc3[_0x95e0('0x1e')]=qs['offset'](_0x4d4b22[_0x95e0('0x31')][_0x95e0('0x1e')]);}_0x52acc3[_0x95e0('0x35')]=qs[_0x95e0('0x36')](_0x4d4b22[_0x95e0('0x31')][_0x95e0('0x36')]);_0x52acc3[_0x95e0('0x37')]=qs[_0x95e0('0x38')](_[_0x95e0('0x39')](_0x4d4b22['query'],_0x102c0f[_0x95e0('0x38')]));if(_0x4d4b22[_0x95e0('0x31')]['filter']){_0x52acc3['where']=_[_0x95e0('0x3a')](_0x52acc3[_0x95e0('0x37')],{'$or':_['map'](_0x318245,function(_0x36ae26){if(_0x36ae26['type'][_0x95e0('0x3b')]!=='VIRTUAL'){var _0x4b7f80={};_0x4b7f80[_0x36ae26[_0x95e0('0x3c')]]={'$like':'%'+_0x4d4b22[_0x95e0('0x31')][_0x95e0('0x3d')]+'%'};return _0x4b7f80;}})});}_0x52acc3=_[_0x95e0('0x3a')]({},_0x52acc3,_0x4d4b22[_0x95e0('0x3e')]);var _0x5d057c={'where':_0x52acc3[_0x95e0('0x37')]};return db[_0x95e0('0x2d')]['count'](_0x5d057c)[_0x95e0('0x25')](function(_0x497058){_0x12a8a8['count']=_0x497058;if(_0x4d4b22[_0x95e0('0x31')][_0x95e0('0x3f')]){_0x52acc3[_0x95e0('0x40')]=[{'all':!![]}];}return db[_0x95e0('0x2d')][_0x95e0('0x41')](_0x52acc3);})[_0x95e0('0x25')](function(_0xaa33eb){_0x12a8a8[_0x95e0('0x42')]=_0xaa33eb;return _0x12a8a8;})[_0x95e0('0x25')](respondWithFilteredResult(_0x8b548f,_0x52acc3))[_0x95e0('0x43')](handleError(_0x8b548f,null));};exports[_0x95e0('0x44')]=function(_0x1a1ca6,_0x4b3f2b){var _0x275a95={'raw':![],'where':{'id':_0x1a1ca6[_0x95e0('0x45')]['id']}},_0x5acd5b={};_0x5acd5b[_0x95e0('0x2f')]=_[_0x95e0('0x30')](db[_0x95e0('0x2d')][_0x95e0('0x2e')]);_0x5acd5b[_0x95e0('0x31')]=_[_0x95e0('0x30')](_0x1a1ca6[_0x95e0('0x31')]);_0x5acd5b[_0x95e0('0x38')]=_['intersection'](_0x5acd5b['model'],_0x5acd5b[_0x95e0('0x31')]);_0x275a95['attributes']=_['intersection'](_0x5acd5b['model'],qs[_0x95e0('0x33')](_0x1a1ca6['query'][_0x95e0('0x33')]));_0x275a95['attributes']=_0x275a95['attributes']['length']?_0x275a95['attributes']:_0x5acd5b[_0x95e0('0x2f')];if(_0x1a1ca6[_0x95e0('0x31')][_0x95e0('0x3f')]){_0x275a95[_0x95e0('0x40')]=[{'all':!![]}];}_0x275a95=_[_0x95e0('0x3a')]({},_0x275a95,_0x1a1ca6[_0x95e0('0x3e')]);return db[_0x95e0('0x2d')]['find'](_0x275a95)[_0x95e0('0x25')](handleEntityNotFound(_0x4b3f2b,null))[_0x95e0('0x25')](respondWithResult(_0x4b3f2b,null))[_0x95e0('0x43')](handleError(_0x4b3f2b,null));};exports[_0x95e0('0x24')]=function(_0x5916df,_0x2d7220){if(_0x5916df[_0x95e0('0x46')]['id']){delete _0x5916df['body']['id'];}return db[_0x95e0('0x2d')][_0x95e0('0x47')]({'where':{'id':_0x5916df[_0x95e0('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d7220,null))['then'](saveUpdates(_0x5916df[_0x95e0('0x46')],null))[_0x95e0('0x25')](respondWithResult(_0x2d7220,null))[_0x95e0('0x43')](handleError(_0x2d7220,null));};exports[_0x95e0('0x48')]=function(_0x216bd7,_0x1b5d32,_0x44196e){return db['sequelize'][_0x95e0('0x49')](function(_0x2f6541){if(_0x216bd7[_0x95e0('0x46')][_0x95e0('0x4a')]===_0x95e0('0x4b')){_0x216bd7[_0x95e0('0x46')]['directory']=path[_0x95e0('0x4c')](config[_0x95e0('0x4d')],_0x95e0('0x4e'),_0x216bd7['body'][_0x95e0('0x2b')]);}return db[_0x95e0('0x2d')][_0x95e0('0x48')](_0x216bd7[_0x95e0('0x46')],{'transaction':_0x2f6541})[_0x95e0('0x25')](function(_0x254c4a){if(_0x216bd7[_0x95e0('0x46')][_0x95e0('0x4a')]===_0x95e0('0x4b')){fs['mkdirSync'](_0x254c4a[_0x95e0('0x4f')],parseInt('0777',0x8));}var _0x1e6fee=_0x216bd7[_0x95e0('0x50')]['get']({'plain':!![]});if(!_0x1e6fee)throw new Error(_0x95e0('0x51'));if(_0x1e6fee[_0x95e0('0x52')]===_0x95e0('0x50')){var _0x412e87=_0x254c4a[_0x95e0('0x27')]({'plain':!![]});return db[_0x95e0('0x53')][_0x95e0('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x1e6fee[_0x95e0('0x54')]},'raw':!![]})['then'](function(_0x23d300){if(_0x23d300&&_0x23d300['autoAssociation']===0x0){return db['UserProfileResource'][_0x95e0('0x48')]({'name':_0x412e87[_0x95e0('0x2b')],'resourceId':_0x412e87['id'],'type':_0x23d300[_0x95e0('0x2b')],'sectionId':_0x23d300['id']},{})[_0x95e0('0x25')](function(){return _0x254c4a;});}else{return _0x254c4a;}})['catch'](function(_0x318bf0){logger['error'](_0x95e0('0x55'),_0x318bf0);});}return _0x254c4a;});})['then'](respondWithResult(_0x1b5d32,0xc9))['catch'](handleError(_0x1b5d32,null));};exports[_0x95e0('0x26')]=function(_0x38b371,_0xb437d,_0x2ed547){var _0x563b54;return db[_0x95e0('0x2d')][_0x95e0('0x47')]({'where':{'id':_0x38b371[_0x95e0('0x45')]['id']}})[_0x95e0('0x25')](function(_0x441067){if(_0x441067){return db['sequelize'][_0x95e0('0x49')](function(_0x59d6cb){return _0x441067[_0x95e0('0x26')]({'transaction':_0x59d6cb,'raw':!![]})[_0x95e0('0x25')](function(_0x14e7c8){if(_0x14e7c8[_0x95e0('0x4f')]){fs['readdirSync'](_0x14e7c8[_0x95e0('0x4f')])[_0x95e0('0x56')](function(_0xb68437){fs['unlinkSync'](path[_0x95e0('0x4c')](_0x14e7c8[_0x95e0('0x4f')],_0xb68437));});fs[_0x95e0('0x57')](_0x14e7c8[_0x95e0('0x4f')]);}return _0x14e7c8;});})['catch'](function(_0x527b96){throw new db[(_0x95e0('0x58'))][(_0x95e0('0x59'))](_0x527b96[_0x95e0('0x5a')]);});}})[_0x95e0('0x25')](handleEntityNotFound(_0xb437d,null))[_0x95e0('0x25')](removeEntity(_0xb437d,null))[_0x95e0('0x43')](handleError(_0xb437d,null));};exports['addSound']=function(_0x29ffc8,_0x3cbb12,_0x3a4cdc){return db[_0x95e0('0x5b')]['transaction'](function(_0xb8146d){var _0x59be54;return db['VoiceMusicOnHold'][_0x95e0('0x47')]({'where':{'id':_0x29ffc8[_0x95e0('0x45')]['id']}})[_0x95e0('0x25')](function(_0x5def65){if(_0x5def65){_0x59be54=_0x5def65;return _0x5def65[_0x95e0('0x5c')](_0x29ffc8[_0x95e0('0x46')]['id'],{'transaction':_0xb8146d});}})['then'](function(_0x312edd){if(_0x312edd){return db['Sound']['findOne']({'where':{'id':_0x29ffc8[_0x95e0('0x46')]['id']},'attributes':['id',_0x95e0('0x2b'),'save_name',_0x95e0('0x5d'),_0x95e0('0x5e')],'raw':!![]});}})[_0x95e0('0x25')](function(_0x33fccf){if(_0x33fccf){var _0x566370=path[_0x95e0('0x4c')](config[_0x95e0('0x4d')],_0x95e0('0x5f'),util[_0x95e0('0x60')]('%s.%s',path[_0x95e0('0x61')](_0x33fccf[_0x95e0('0x62')],path[_0x95e0('0x63')](_0x33fccf[_0x95e0('0x62')])),_0x33fccf['converted_format']));var _0x136d1d=path[_0x95e0('0x4c')](config['root'],'server/files/moh',_0x59be54[_0x95e0('0x2b')],util[_0x95e0('0x60')](_0x95e0('0x64'),_0x33fccf[_0x95e0('0x2b')],_0x33fccf[_0x95e0('0x5d')]));fs['symlinkSync'](_0x566370,_0x136d1d);return _0x33fccf;}})[_0x95e0('0x43')](function(_0x4381eb){throw new db[(_0x95e0('0x58'))]['ValidationError'](_0x4381eb['message']);});})[_0x95e0('0x25')](handleEntityNotFound(_0x3cbb12,null))[_0x95e0('0x25')](respondWithResult(_0x3cbb12,0xc9))[_0x95e0('0x43')](handleError(_0x3cbb12,null));};exports[_0x95e0('0x65')]=function(_0xd24e82,_0x14ea8f,_0x5a7062){return db[_0x95e0('0x5b')]['transaction'](function(_0x4b604d){var _0x50500f;return db[_0x95e0('0x2d')]['findOne']({'where':{'id':_0xd24e82[_0x95e0('0x45')]['id']}})[_0x95e0('0x25')](handleEntityNotFound(_0x14ea8f,null))[_0x95e0('0x25')](function(_0x48165c){if(_0x48165c){_0x50500f=_0x48165c;return _0x48165c[_0x95e0('0x65')](_0xd24e82[_0x95e0('0x45')][_0x95e0('0x66')]);}})[_0x95e0('0x25')](function(_0x46a72a){if(_0x46a72a){return db[_0x95e0('0x67')][_0x95e0('0x68')]({'where':{'id':_0xd24e82[_0x95e0('0x45')][_0x95e0('0x66')]},'attributes':['id',_0x95e0('0x2b'),'save_name',_0x95e0('0x5d'),_0x95e0('0x5e')],'raw':!![]});}})[_0x95e0('0x25')](function(_0x13f75d){if(_0x13f75d){fs['unlinkSync'](path[_0x95e0('0x4c')](_0x50500f['directory'],util[_0x95e0('0x60')](_0x95e0('0x64'),_0x13f75d[_0x95e0('0x2b')],_0x13f75d[_0x95e0('0x5d')])));return _0x13f75d;}})[_0x95e0('0x43')](function(_0x2efa2a){throw new db[(_0x95e0('0x58'))]['ValidationError'](_0x2efa2a[_0x95e0('0x5a')]);});})[_0x95e0('0x25')](handleEntityNotFound(_0x14ea8f,null))[_0x95e0('0x25')](respondWithStatusCode(_0x14ea8f,0xcc))['catch'](handleError(_0x14ea8f,null));};exports[_0x95e0('0x69')]=function(_0x12f3cb,_0x5b1528,_0x5f2393){var _0x123363={};var _0x54e285={};var _0x33e621;var _0x3fc0dd;return db[_0x95e0('0x2d')][_0x95e0('0x68')]({'where':{'id':_0x12f3cb[_0x95e0('0x45')]['id']}})[_0x95e0('0x25')](handleEntityNotFound(_0x5b1528,null))['then'](function(_0x422ae3){if(_0x422ae3){_0x33e621=_0x422ae3;_0x54e285[_0x95e0('0x2f')]=_[_0x95e0('0x30')](db[_0x95e0('0x67')][_0x95e0('0x2e')]);_0x54e285[_0x95e0('0x31')]=_['keys'](_0x12f3cb[_0x95e0('0x31')]);_0x54e285['filters']=_['intersection'](_0x54e285[_0x95e0('0x2f')],_0x54e285[_0x95e0('0x31')]);_0x123363[_0x95e0('0x32')]=_[_0x95e0('0x6a')](_0x54e285[_0x95e0('0x2f')],qs[_0x95e0('0x33')](_0x12f3cb[_0x95e0('0x31')][_0x95e0('0x33')]));_0x123363[_0x95e0('0x32')]=_0x123363['attributes'][_0x95e0('0x6b')]?_0x123363[_0x95e0('0x32')]:_0x54e285[_0x95e0('0x2f')];_0x123363[_0x95e0('0x35')]=qs[_0x95e0('0x36')](_0x12f3cb['query']['sort']);_0x123363[_0x95e0('0x37')]=qs['filters'](_[_0x95e0('0x39')](_0x12f3cb[_0x95e0('0x31')],_0x54e285[_0x95e0('0x38')]));if(_0x12f3cb['query'][_0x95e0('0x3d')]){_0x123363['where']=_[_0x95e0('0x3a')](_0x123363[_0x95e0('0x37')],{'$or':_[_0x95e0('0x6c')](_0x123363['attributes'],function(_0x53ac4a){var _0x18848b={};_0x18848b[_0x53ac4a]={'$like':'%'+_0x12f3cb[_0x95e0('0x31')][_0x95e0('0x3d')]+'%'};return _0x18848b;})});}_0x123363=_[_0x95e0('0x3a')]({},_0x123363,_0x12f3cb[_0x95e0('0x3e')]);return _0x33e621['getSounds'](_0x123363);}})[_0x95e0('0x25')](function(_0x4c3ecb){if(_0x4c3ecb){_0x3fc0dd=_0x4c3ecb[_0x95e0('0x6b')];if(!_0x12f3cb[_0x95e0('0x31')][_0x95e0('0x6d')](_0x95e0('0x6e'))){_0x123363[_0x95e0('0x34')]=qs[_0x95e0('0x34')](_0x12f3cb[_0x95e0('0x31')][_0x95e0('0x34')]);_0x123363[_0x95e0('0x1e')]=qs[_0x95e0('0x1e')](_0x12f3cb[_0x95e0('0x31')][_0x95e0('0x1e')]);}return _0x33e621[_0x95e0('0x69')](_0x123363);}})[_0x95e0('0x25')](function(_0x5a7ceb){if(_0x5a7ceb){return _0x5a7ceb?{'count':_0x3fc0dd,'rows':_0x5a7ceb}:null;}})[_0x95e0('0x25')](respondWithResult(_0x5b1528,null))[_0x95e0('0x43')](handleError(_0x5b1528,null));}; \ No newline at end of file +var _0x68e2=['count','offset','limit','set','apply','reject','save','destroy','then','get','MusicOnHolds','UserProfileResource','error','stack','name','index','VoiceMusicOnHold','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','map','type','VIRTUAL','field','options','includeAll','rows','show','params','intersection','include','find','catch','body','create','sequelize','files','join','root','server/files/moh','mode','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','unlinkSync','pick','getSounds','nolimit','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json'];(function(_0x124124,_0x2ba5a0){var _0x574a9f=function(_0x13678c){while(--_0x13678c){_0x124124['push'](_0x124124['shift']());}};_0x574a9f(++_0x2ba5a0);}(_0x68e2,0x131));var _0x268e=function(_0x29b147,_0x56339c){_0x29b147=_0x29b147-0x0;var _0x33efee=_0x68e2[_0x29b147];return _0x33efee;};'use strict';var pdf=require(_0x268e('0x0'));var emlformat=require(_0x268e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x268e('0x2'));var jsonpatch=require(_0x268e('0x3'));var rp=require(_0x268e('0x4'));var moment=require('moment');var BPromise=require(_0x268e('0x5'));var Mustache=require(_0x268e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x268e('0x7'));var csv=require(_0x268e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x268e('0x9'));var squel=require(_0x268e('0xa'));var crypto=require(_0x268e('0xb'));var jsforce=require(_0x268e('0xc'));var deskjs=require(_0x268e('0xd'));var toCsv=require(_0x268e('0x8'));var querystring=require(_0x268e('0xe'));var Papa=require(_0x268e('0xf'));var authService=require(_0x268e('0x10'));var hardwareService=require(_0x268e('0x11'));var Redis=require(_0x268e('0x12'));var qs=require(_0x268e('0x13'));var logger=require(_0x268e('0x14'))(_0x268e('0x15'));var utils=require(_0x268e('0x16'));var config=require('../../config/environment');var db=require(_0x268e('0x17'))['db'];function respondWithStatusCode(_0x37dce9,_0x1532fd){_0x1532fd=_0x1532fd||0xcc;return function(_0x1f478f){if(_0x1f478f){return _0x37dce9[_0x268e('0x18')](_0x1532fd);}return _0x37dce9[_0x268e('0x19')](_0x1532fd)[_0x268e('0x1a')]();};}function respondWithResult(_0x47f26f,_0x233f2e){_0x233f2e=_0x233f2e||0xc8;return function(_0x660dc0){if(_0x660dc0){return _0x47f26f[_0x268e('0x19')](_0x233f2e)[_0x268e('0x1b')](_0x660dc0);}};}function respondWithFilteredResult(_0x26f6d0,_0x3973c9){return function(_0x2192da){if(_0x2192da){var _0xf88209=_0x2192da[_0x268e('0x1c')],_0x5d7ab1=_0x3973c9[_0x268e('0x1d')],_0x52b6cf=_0x3973c9[_0x268e('0x1d')]+_0x3973c9[_0x268e('0x1e')],_0xcff47e;if(_0x52b6cf>=_0xf88209){_0x52b6cf=_0xf88209;_0xcff47e=0xc8;}else{_0xcff47e=0xce;}_0x26f6d0[_0x268e('0x19')](_0xcff47e);return _0x26f6d0[_0x268e('0x1f')]('Content-Range',_0x5d7ab1+'-'+_0x52b6cf+'/'+_0xf88209)[_0x268e('0x1b')](_0x2192da);}return null;};}function patchUpdates(_0x1713dc){return function(_0x937156){try{jsonpatch[_0x268e('0x20')](_0x937156,_0x1713dc,!![]);}catch(_0x2dd5be){return BPromise[_0x268e('0x21')](_0x2dd5be);}return _0x937156[_0x268e('0x22')]();};}function saveUpdates(_0x560b31,_0x3fb41a){return function(_0x838b2e){if(_0x838b2e){return _0x838b2e['update'](_0x560b31)['then'](function(_0x422347){return _0x422347;});}return null;};}function removeEntity(_0x606811,_0xf444e6){return function(_0x397d66){if(_0x397d66){return _0x397d66[_0x268e('0x23')]()[_0x268e('0x24')](function(){var _0x411ff5=_0x397d66[_0x268e('0x25')]({'plain':!![]});var _0x3932fc=_0x268e('0x26');return db[_0x268e('0x27')][_0x268e('0x23')]({'where':{'type':_0x3932fc,'resourceId':_0x411ff5['id']}})[_0x268e('0x24')](function(){return _0x397d66;});})[_0x268e('0x24')](function(){_0x606811[_0x268e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x382446,_0x52f85b){return function(_0x294984){if(!_0x294984){_0x382446[_0x268e('0x18')](0x194);}return _0x294984;};}function handleError(_0x2d482c,_0x11ee81){_0x11ee81=_0x11ee81||0x1f4;return function(_0x2bb44c){logger[_0x268e('0x28')](_0x2bb44c[_0x268e('0x29')]);if(_0x2bb44c[_0x268e('0x2a')]){delete _0x2bb44c[_0x268e('0x2a')];}_0x2d482c[_0x268e('0x19')](_0x11ee81)['send'](_0x2bb44c);};}exports[_0x268e('0x2b')]=function(_0x5c1b16,_0xe419d2){var _0x3a4c0a={},_0x59c75e={},_0x352412={'count':0x0,'rows':[]};var _0x240da9=db[_0x268e('0x2c')][_0x268e('0x2d')];_0x59c75e[_0x268e('0x2e')]=_['keys'](_0x240da9);_0x59c75e[_0x268e('0x2f')]=_[_0x268e('0x30')](_0x5c1b16[_0x268e('0x2f')]);_0x59c75e[_0x268e('0x31')]=_['intersection'](_0x59c75e[_0x268e('0x2e')],_0x59c75e[_0x268e('0x2f')]);_0x3a4c0a[_0x268e('0x32')]=_['intersection'](_0x59c75e['model'],qs[_0x268e('0x33')](_0x5c1b16['query'][_0x268e('0x33')]));_0x3a4c0a[_0x268e('0x32')]=_0x3a4c0a[_0x268e('0x32')][_0x268e('0x34')]?_0x3a4c0a[_0x268e('0x32')]:_0x59c75e['model'];if(!_0x5c1b16[_0x268e('0x2f')][_0x268e('0x35')]('nolimit')){_0x3a4c0a[_0x268e('0x1e')]=qs[_0x268e('0x1e')](_0x5c1b16[_0x268e('0x2f')][_0x268e('0x1e')]);_0x3a4c0a[_0x268e('0x1d')]=qs['offset'](_0x5c1b16[_0x268e('0x2f')][_0x268e('0x1d')]);}_0x3a4c0a['order']=qs['sort'](_0x5c1b16[_0x268e('0x2f')][_0x268e('0x36')]);_0x3a4c0a[_0x268e('0x37')]=qs[_0x268e('0x31')](_['pick'](_0x5c1b16[_0x268e('0x2f')],_0x59c75e[_0x268e('0x31')]));if(_0x5c1b16['query'][_0x268e('0x38')]){_0x3a4c0a[_0x268e('0x37')]=_[_0x268e('0x39')](_0x3a4c0a[_0x268e('0x37')],{'$or':_[_0x268e('0x3a')](_0x240da9,function(_0x1b8b47){if(_0x1b8b47[_0x268e('0x3b')]['key']!==_0x268e('0x3c')){var _0x198104={};_0x198104[_0x1b8b47[_0x268e('0x3d')]]={'$like':'%'+_0x5c1b16[_0x268e('0x2f')][_0x268e('0x38')]+'%'};return _0x198104;}})});}_0x3a4c0a=_[_0x268e('0x39')]({},_0x3a4c0a,_0x5c1b16[_0x268e('0x3e')]);var _0x1cfb83={'where':_0x3a4c0a[_0x268e('0x37')]};return db['VoiceMusicOnHold'][_0x268e('0x1c')](_0x1cfb83)[_0x268e('0x24')](function(_0x551ab7){_0x352412[_0x268e('0x1c')]=_0x551ab7;if(_0x5c1b16[_0x268e('0x2f')][_0x268e('0x3f')]){_0x3a4c0a['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x3a4c0a);})[_0x268e('0x24')](function(_0x3e27b1){_0x352412[_0x268e('0x40')]=_0x3e27b1;return _0x352412;})[_0x268e('0x24')](respondWithFilteredResult(_0xe419d2,_0x3a4c0a))['catch'](handleError(_0xe419d2,null));};exports[_0x268e('0x41')]=function(_0x3defd1,_0x343fa7){var _0x5557b5={'raw':![],'where':{'id':_0x3defd1[_0x268e('0x42')]['id']}},_0x1f644f={};_0x1f644f[_0x268e('0x2e')]=_[_0x268e('0x30')](db[_0x268e('0x2c')][_0x268e('0x2d')]);_0x1f644f[_0x268e('0x2f')]=_[_0x268e('0x30')](_0x3defd1['query']);_0x1f644f['filters']=_[_0x268e('0x43')](_0x1f644f[_0x268e('0x2e')],_0x1f644f[_0x268e('0x2f')]);_0x5557b5[_0x268e('0x32')]=_[_0x268e('0x43')](_0x1f644f[_0x268e('0x2e')],qs[_0x268e('0x33')](_0x3defd1[_0x268e('0x2f')][_0x268e('0x33')]));_0x5557b5[_0x268e('0x32')]=_0x5557b5['attributes']['length']?_0x5557b5[_0x268e('0x32')]:_0x1f644f[_0x268e('0x2e')];if(_0x3defd1['query'][_0x268e('0x3f')]){_0x5557b5[_0x268e('0x44')]=[{'all':!![]}];}_0x5557b5=_['merge']({},_0x5557b5,_0x3defd1[_0x268e('0x3e')]);return db[_0x268e('0x2c')][_0x268e('0x45')](_0x5557b5)[_0x268e('0x24')](handleEntityNotFound(_0x343fa7,null))[_0x268e('0x24')](respondWithResult(_0x343fa7,null))[_0x268e('0x46')](handleError(_0x343fa7,null));};exports['update']=function(_0x5ce4a5,_0x2564eb){if(_0x5ce4a5[_0x268e('0x47')]['id']){delete _0x5ce4a5[_0x268e('0x47')]['id'];}return db[_0x268e('0x2c')]['find']({'where':{'id':_0x5ce4a5[_0x268e('0x42')]['id']}})[_0x268e('0x24')](handleEntityNotFound(_0x2564eb,null))['then'](saveUpdates(_0x5ce4a5[_0x268e('0x47')],null))[_0x268e('0x24')](respondWithResult(_0x2564eb,null))[_0x268e('0x46')](handleError(_0x2564eb,null));};exports[_0x268e('0x48')]=function(_0x1714e9,_0x11c4ff,_0x58f6b5){return db[_0x268e('0x49')]['transaction'](function(_0x304234){if(_0x1714e9[_0x268e('0x47')]['mode']===_0x268e('0x4a')){_0x1714e9[_0x268e('0x47')]['directory']=path[_0x268e('0x4b')](config[_0x268e('0x4c')],_0x268e('0x4d'),_0x1714e9[_0x268e('0x47')][_0x268e('0x2a')]);}return db[_0x268e('0x2c')][_0x268e('0x48')](_0x1714e9[_0x268e('0x47')],{'transaction':_0x304234})[_0x268e('0x24')](function(_0x572298){if(_0x1714e9['body'][_0x268e('0x4e')]==='files'){fs['mkdirSync'](_0x572298[_0x268e('0x4f')],parseInt(_0x268e('0x50'),0x8));}var _0x1d27d0=_0x1714e9[_0x268e('0x51')][_0x268e('0x25')]({'plain':!![]});if(!_0x1d27d0)throw new Error(_0x268e('0x52'));if(_0x1d27d0[_0x268e('0x53')]===_0x268e('0x51')){var _0x2c7c53=_0x572298['get']({'plain':!![]});return db[_0x268e('0x54')][_0x268e('0x45')]({'where':{'name':'MusicOnHolds','userProfileId':_0x1d27d0['userProfileId']},'raw':!![]})['then'](function(_0x232d35){if(_0x232d35&&_0x232d35[_0x268e('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x2c7c53[_0x268e('0x2a')],'resourceId':_0x2c7c53['id'],'type':_0x232d35[_0x268e('0x2a')],'sectionId':_0x232d35['id']},{})[_0x268e('0x24')](function(){return _0x572298;});}else{return _0x572298;}})['catch'](function(_0x45fb80){logger[_0x268e('0x28')](_0x268e('0x56'),_0x45fb80);});}return _0x572298;});})[_0x268e('0x24')](respondWithResult(_0x11c4ff,0xc9))[_0x268e('0x46')](handleError(_0x11c4ff,null));};exports['destroy']=function(_0x55925e,_0x584733,_0x5f047d){var _0x1ac120;return db[_0x268e('0x2c')]['find']({'where':{'id':_0x55925e['params']['id']}})['then'](function(_0x2ac9ca){if(_0x2ac9ca){return db[_0x268e('0x49')][_0x268e('0x57')](function(_0x816932){return _0x2ac9ca[_0x268e('0x23')]({'transaction':_0x816932,'raw':!![]})[_0x268e('0x24')](function(_0x564745){if(_0x564745[_0x268e('0x4f')]){fs['readdirSync'](_0x564745[_0x268e('0x4f')])[_0x268e('0x58')](function(_0x396462){fs['unlinkSync'](path[_0x268e('0x4b')](_0x564745[_0x268e('0x4f')],_0x396462));});fs[_0x268e('0x59')](_0x564745[_0x268e('0x4f')]);}return _0x564745;});})[_0x268e('0x46')](function(_0xb4b436){throw new db[(_0x268e('0x5a'))][(_0x268e('0x5b'))](_0xb4b436[_0x268e('0x5c')]);});}})[_0x268e('0x24')](handleEntityNotFound(_0x584733,null))[_0x268e('0x24')](removeEntity(_0x584733,null))[_0x268e('0x46')](handleError(_0x584733,null));};exports[_0x268e('0x5d')]=function(_0x5d2adf,_0x2d8c84,_0xcf110f){return db[_0x268e('0x49')][_0x268e('0x57')](function(_0x5ad6e2){var _0x45948e;return db[_0x268e('0x2c')][_0x268e('0x45')]({'where':{'id':_0x5d2adf[_0x268e('0x42')]['id']}})['then'](function(_0x175496){if(_0x175496){_0x45948e=_0x175496;return _0x175496[_0x268e('0x5d')](_0x5d2adf[_0x268e('0x47')]['id'],{'transaction':_0x5ad6e2});}})[_0x268e('0x24')](function(_0x53297f){if(_0x53297f){return db[_0x268e('0x5e')][_0x268e('0x5f')]({'where':{'id':_0x5d2adf[_0x268e('0x47')]['id']},'attributes':['id',_0x268e('0x2a'),_0x268e('0x60'),_0x268e('0x61'),_0x268e('0x62')],'raw':!![]});}})[_0x268e('0x24')](function(_0x5d1d36){if(_0x5d1d36){var _0x19aad4=path[_0x268e('0x4b')](config[_0x268e('0x4c')],_0x268e('0x63'),util[_0x268e('0x64')](_0x268e('0x65'),path[_0x268e('0x66')](_0x5d1d36['save_name'],path[_0x268e('0x67')](_0x5d1d36[_0x268e('0x60')])),_0x5d1d36[_0x268e('0x61')]));var _0x578873=path[_0x268e('0x4b')](config[_0x268e('0x4c')],_0x268e('0x4d'),_0x45948e[_0x268e('0x2a')],util[_0x268e('0x64')]('%s.%s',_0x5d1d36['name'],_0x5d1d36['converted_format']));fs[_0x268e('0x68')](_0x19aad4,_0x578873);return _0x5d1d36;}})[_0x268e('0x46')](function(_0x32a33a){throw new db[(_0x268e('0x5a'))][(_0x268e('0x5b'))](_0x32a33a[_0x268e('0x5c')]);});})[_0x268e('0x24')](handleEntityNotFound(_0x2d8c84,null))['then'](respondWithResult(_0x2d8c84,0xc9))[_0x268e('0x46')](handleError(_0x2d8c84,null));};exports[_0x268e('0x69')]=function(_0xa26f84,_0x9f0b06,_0x3a44e6){return db[_0x268e('0x49')][_0x268e('0x57')](function(_0x360bdf){var _0xf14b14;return db['VoiceMusicOnHold'][_0x268e('0x5f')]({'where':{'id':_0xa26f84['params']['id']}})[_0x268e('0x24')](handleEntityNotFound(_0x9f0b06,null))[_0x268e('0x24')](function(_0x1801a4){if(_0x1801a4){_0xf14b14=_0x1801a4;return _0x1801a4['removeSound'](_0xa26f84[_0x268e('0x42')][_0x268e('0x6a')]);}})['then'](function(_0x379a74){if(_0x379a74){return db[_0x268e('0x5e')][_0x268e('0x5f')]({'where':{'id':_0xa26f84['params']['id2']},'attributes':['id',_0x268e('0x2a'),_0x268e('0x60'),_0x268e('0x61'),'createdAt'],'raw':!![]});}})['then'](function(_0x51a604){if(_0x51a604){fs[_0x268e('0x6b')](path[_0x268e('0x4b')](_0xf14b14[_0x268e('0x4f')],util[_0x268e('0x64')](_0x268e('0x65'),_0x51a604[_0x268e('0x2a')],_0x51a604[_0x268e('0x61')])));return _0x51a604;}})[_0x268e('0x46')](function(_0x2eb5b6){throw new db[(_0x268e('0x5a'))][(_0x268e('0x5b'))](_0x2eb5b6['message']);});})[_0x268e('0x24')](handleEntityNotFound(_0x9f0b06,null))[_0x268e('0x24')](respondWithStatusCode(_0x9f0b06,0xcc))['catch'](handleError(_0x9f0b06,null));};exports['getSounds']=function(_0x291a52,_0x5b7708,_0x2b828e){var _0x2e2293={};var _0x185a32={};var _0x4b8fad;var _0x3b44bf;return db['VoiceMusicOnHold'][_0x268e('0x5f')]({'where':{'id':_0x291a52[_0x268e('0x42')]['id']}})[_0x268e('0x24')](handleEntityNotFound(_0x5b7708,null))['then'](function(_0x49f6c1){if(_0x49f6c1){_0x4b8fad=_0x49f6c1;_0x185a32[_0x268e('0x2e')]=_[_0x268e('0x30')](db[_0x268e('0x5e')][_0x268e('0x2d')]);_0x185a32['query']=_[_0x268e('0x30')](_0x291a52[_0x268e('0x2f')]);_0x185a32[_0x268e('0x31')]=_[_0x268e('0x43')](_0x185a32['model'],_0x185a32[_0x268e('0x2f')]);_0x2e2293['attributes']=_[_0x268e('0x43')](_0x185a32[_0x268e('0x2e')],qs['fields'](_0x291a52[_0x268e('0x2f')][_0x268e('0x33')]));_0x2e2293[_0x268e('0x32')]=_0x2e2293[_0x268e('0x32')][_0x268e('0x34')]?_0x2e2293[_0x268e('0x32')]:_0x185a32[_0x268e('0x2e')];_0x2e2293['order']=qs[_0x268e('0x36')](_0x291a52[_0x268e('0x2f')][_0x268e('0x36')]);_0x2e2293[_0x268e('0x37')]=qs[_0x268e('0x31')](_[_0x268e('0x6c')](_0x291a52[_0x268e('0x2f')],_0x185a32[_0x268e('0x31')]));if(_0x291a52[_0x268e('0x2f')]['filter']){_0x2e2293[_0x268e('0x37')]=_['merge'](_0x2e2293[_0x268e('0x37')],{'$or':_[_0x268e('0x3a')](_0x2e2293[_0x268e('0x32')],function(_0x303b12){var _0x5954e5={};_0x5954e5[_0x303b12]={'$like':'%'+_0x291a52[_0x268e('0x2f')]['filter']+'%'};return _0x5954e5;})});}_0x2e2293=_[_0x268e('0x39')]({},_0x2e2293,_0x291a52[_0x268e('0x3e')]);return _0x4b8fad[_0x268e('0x6d')](_0x2e2293);}})[_0x268e('0x24')](function(_0xc1d925){if(_0xc1d925){_0x3b44bf=_0xc1d925[_0x268e('0x34')];if(!_0x291a52[_0x268e('0x2f')][_0x268e('0x35')](_0x268e('0x6e'))){_0x2e2293['limit']=qs['limit'](_0x291a52['query'][_0x268e('0x1e')]);_0x2e2293[_0x268e('0x1d')]=qs[_0x268e('0x1d')](_0x291a52[_0x268e('0x2f')]['offset']);}return _0x4b8fad['getSounds'](_0x2e2293);}})[_0x268e('0x24')](function(_0x5d4056){if(_0x5d4056){return _0x5d4056?{'count':_0x3b44bf,'rows':_0x5d4056}:null;}})[_0x268e('0x24')](respondWithResult(_0x5b7708,null))[_0x268e('0x46')](handleError(_0x5b7708,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 02f5536..0a9da00 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 _0xc1ef=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1ea613,_0x98d467){var _0x4cd394=function(_0x4fe39c){while(--_0x4fe39c){_0x1ea613['push'](_0x1ea613['shift']());}};_0x4cd394(++_0x98d467);}(_0xc1ef,0x191));var _0xfc1e=function(_0x29b3a9,_0x358962){_0x29b3a9=_0x29b3a9-0x0;var _0x48a264=_0xc1ef[_0x29b3a9];return _0x48a264;};'use strict';var _=require(_0xfc1e('0x0'));var util=require(_0xfc1e('0x1'));var logger=require(_0xfc1e('0x2'))(_0xfc1e('0x3'));var moment=require(_0xfc1e('0x4'));var BPromise=require('bluebird');var rp=require(_0xfc1e('0x5'));var attributes=require(_0xfc1e('0x6'));module[_0xfc1e('0x7')]=function(_0x1a085a,_0x25304f){return _0x1a085a[_0xfc1e('0x8')](_0xfc1e('0x9'),attributes,{'tableName':_0xfc1e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3680=['bluebird','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment'];(function(_0x11b19b,_0x213234){var _0x1daac1=function(_0x516d3b){while(--_0x516d3b){_0x11b19b['push'](_0x11b19b['shift']());}};_0x1daac1(++_0x213234);}(_0x3680,0xcd));var _0x0368=function(_0x406960,_0x5104b5){_0x406960=_0x406960-0x0;var _0x461635=_0x3680[_0x406960];return _0x461635;};'use strict';var _=require(_0x0368('0x0'));var util=require(_0x0368('0x1'));var logger=require(_0x0368('0x2'))(_0x0368('0x3'));var moment=require(_0x0368('0x4'));var BPromise=require(_0x0368('0x5'));var rp=require('request-promise');var attributes=require(_0x0368('0x6'));module[_0x0368('0x7')]=function(_0x6ce660,_0x2b4363){return _0x6ce660['define'](_0x0368('0x8'),attributes,{'tableName':_0x0368('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index e702494..4df145e 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 _0xbcc2=['util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash'];(function(_0x5e2c63,_0x46455){var _0x5a4e5c=function(_0x2b0319){while(--_0x2b0319){_0x5e2c63['push'](_0x5e2c63['shift']());}};_0x5a4e5c(++_0x46455);}(_0xbcc2,0xdb));var _0x2bcc=function(_0x3c1106,_0x437653){_0x3c1106=_0x3c1106-0x0;var _0xe58079=_0xbcc2[_0x3c1106];return _0xe58079;};'use strict';var _=require(_0x2bcc('0x0'));var util=require(_0x2bcc('0x1'));var moment=require(_0x2bcc('0x2'));var BPromise=require('bluebird');var rs=require(_0x2bcc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2bcc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2bcc('0x5'));var jayson=require(_0x2bcc('0x6'));var client=jayson['client'][_0x2bcc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ceb42,_0xd6a1cc,_0x4ea2fd){return new BPromise(function(_0x231409,_0x38a676){return client[_0x2bcc('0x8')](_0x3ceb42,_0x4ea2fd)[_0x2bcc('0x9')](function(_0x416db6){logger[_0x2bcc('0xa')](_0x2bcc('0xb'),_0xd6a1cc,'request\x20sent');logger[_0x2bcc('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xd6a1cc,_0x2bcc('0xd'),JSON[_0x2bcc('0xe')](_0x416db6));if(_0x416db6['error']){if(_0x416db6['error'][_0x2bcc('0xf')]===0x1f4){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0xd6a1cc,_0x416db6[_0x2bcc('0x10')][_0x2bcc('0x11')]);return _0x38a676(_0x416db6[_0x2bcc('0x10')]['message']);}logger[_0x2bcc('0x10')](_0x2bcc('0xb'),_0xd6a1cc,_0x416db6[_0x2bcc('0x10')][_0x2bcc('0x11')]);return _0x231409(_0x416db6['error'][_0x2bcc('0x11')]);}else{logger[_0x2bcc('0xa')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xd6a1cc,_0x2bcc('0xd'));_0x231409(_0x416db6[_0x2bcc('0x12')][_0x2bcc('0x11')]);}})[_0x2bcc('0x13')](function(_0x3b7525){logger[_0x2bcc('0x10')](_0x2bcc('0xb'),_0xd6a1cc,_0x3b7525);_0x38a676(_0x3b7525);});});} \ No newline at end of file +var _0xa204=['request\x20sent','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','error','code','message'];(function(_0x2d1a2b,_0x21c069){var _0x47f9d4=function(_0x494610){while(--_0x494610){_0x2d1a2b['push'](_0x2d1a2b['shift']());}};_0x47f9d4(++_0x21c069);}(_0xa204,0xb7));var _0x4a20=function(_0xca1091,_0x539dbf){_0xca1091=_0xca1091-0x0;var _0xd3019c=_0xa204[_0xca1091];return _0xd3019c;};'use strict';var _=require('lodash');var util=require(_0x4a20('0x0'));var moment=require(_0x4a20('0x1'));var BPromise=require(_0x4a20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a20('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a20('0x4'));var logger=require(_0x4a20('0x5'))(_0x4a20('0x6'));var config=require(_0x4a20('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a20('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x968beb,_0x1a9037,_0x4670a3){return new BPromise(function(_0xc08feb,_0x495162){return client[_0x4a20('0x9')](_0x968beb,_0x4670a3)[_0x4a20('0xa')](function(_0x4160cc){logger[_0x4a20('0xb')](_0x4a20('0xc'),_0x1a9037,'request\x20sent');logger[_0x4a20('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x1a9037,'request\x20sent',JSON['stringify'](_0x4160cc));if(_0x4160cc[_0x4a20('0xe')]){if(_0x4160cc[_0x4a20('0xe')][_0x4a20('0xf')]===0x1f4){logger[_0x4a20('0xe')](_0x4a20('0xc'),_0x1a9037,_0x4160cc[_0x4a20('0xe')][_0x4a20('0x10')]);return _0x495162(_0x4160cc[_0x4a20('0xe')]['message']);}logger[_0x4a20('0xe')](_0x4a20('0xc'),_0x1a9037,_0x4160cc[_0x4a20('0xe')][_0x4a20('0x10')]);return _0xc08feb(_0x4160cc[_0x4a20('0xe')][_0x4a20('0x10')]);}else{logger[_0x4a20('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x1a9037,_0x4a20('0x11'));_0xc08feb(_0x4160cc[_0x4a20('0x12')][_0x4a20('0x10')]);}})[_0x4a20('0x13')](function(_0x3e6c53){logger[_0x4a20('0xe')](_0x4a20('0xc'),_0x1a9037,_0x3e6c53);_0x495162(_0x3e6c53);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 01dc7f4..3a42992 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 _0xf951=['isAuthenticated','index','get','/describe','describe','/:id','show','post','/:id/users','addAgents','put','update','delete','destroy','removeAgents','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0xf951,0x1f3));var _0x1f95=function(_0x4a96ef,_0x5c1383){_0x4a96ef=_0x4a96ef-0x0;var _0x330714=_0xf951[_0x4a96ef];return _0x330714;};'use strict';var multer=require('multer');var util=require(_0x1f95('0x0'));var path=require('path');var timeout=require(_0x1f95('0x1'));var express=require(_0x1f95('0x2'));var router=express['Router']();var auth=require(_0x1f95('0x3'));var interaction=require(_0x1f95('0x4'));var config=require(_0x1f95('0x5'));var controller=require(_0x1f95('0x6'));router['get']('/',auth[_0x1f95('0x7')](),controller[_0x1f95('0x8')]);router[_0x1f95('0x9')](_0x1f95('0xa'),auth[_0x1f95('0x7')](),controller[_0x1f95('0xb')]);router[_0x1f95('0x9')](_0x1f95('0xc'),auth[_0x1f95('0x7')](),controller[_0x1f95('0xd')]);router['get']('/:id/users',auth[_0x1f95('0x7')](),controller['getAgents']);router['post']('/',auth[_0x1f95('0x7')](),controller['create']);router[_0x1f95('0xe')](_0x1f95('0xf'),auth[_0x1f95('0x7')](),controller[_0x1f95('0x10')]);router[_0x1f95('0x11')](_0x1f95('0xc'),auth[_0x1f95('0x7')](),controller[_0x1f95('0x12')]);router[_0x1f95('0x13')](_0x1f95('0xc'),auth['isAuthenticated'](),controller[_0x1f95('0x14')]);router[_0x1f95('0x13')](_0x1f95('0xf'),auth[_0x1f95('0x7')](),controller[_0x1f95('0x15')]);module['exports']=router; \ No newline at end of file +var _0x3d5d=['multer','util','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','create','update','delete','destroy','removeAgents'];(function(_0x14785d,_0x16fa0c){var _0x1b6e9a=function(_0x1e6c87){while(--_0x1e6c87){_0x14785d['push'](_0x14785d['shift']());}};_0x1b6e9a(++_0x16fa0c);}(_0x3d5d,0x104));var _0xd3d5=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x3d5d[_0x49aa7d];return _0xdd0d26;};'use strict';var multer=require(_0xd3d5('0x0'));var util=require(_0xd3d5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd3d5('0x2'));var router=express[_0xd3d5('0x3')]();var auth=require(_0xd3d5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd3d5('0x5'));var controller=require(_0xd3d5('0x6'));router[_0xd3d5('0x7')]('/',auth[_0xd3d5('0x8')](),controller['index']);router[_0xd3d5('0x7')]('/describe',auth[_0xd3d5('0x8')](),controller[_0xd3d5('0x9')]);router[_0xd3d5('0x7')](_0xd3d5('0xa'),auth['isAuthenticated'](),controller[_0xd3d5('0xb')]);router[_0xd3d5('0x7')](_0xd3d5('0xc'),auth['isAuthenticated'](),controller[_0xd3d5('0xd')]);router[_0xd3d5('0xe')]('/',auth['isAuthenticated'](),controller[_0xd3d5('0xf')]);router[_0xd3d5('0xe')](_0xd3d5('0xc'),auth[_0xd3d5('0x8')](),controller['addAgents']);router['put'](_0xd3d5('0xa'),auth[_0xd3d5('0x8')](),controller[_0xd3d5('0x10')]);router[_0xd3d5('0x11')](_0xd3d5('0xa'),auth['isAuthenticated'](),controller[_0xd3d5('0x12')]);router[_0xd3d5('0x11')](_0xd3d5('0xc'),auth['isAuthenticated'](),controller[_0xd3d5('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 46eba54..21b306c 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 _0x51ca=['system-','getDataValue','STRING','INTEGER','exports','name','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51ca,0x1e0));var _0xa51c=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x51ca[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require('sequelize');module[_0xa51c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa51c('0x1')},'prefix':{'type':Sequelize[_0xa51c('0x2')],'get':function(_0x78c9c1){return _0xa51c('0x3')+this[_0xa51c('0x4')](_0xa51c('0x1'))+'-';}},'description':{'type':Sequelize[_0xa51c('0x5')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xa51c('0x6')]}}; \ No newline at end of file +var _0x8436=['name','VIRTUAL','system-','getDataValue','INTEGER','exports','STRING'];(function(_0x5d93c7,_0x580b09){var _0x54a38b=function(_0x38c4c2){while(--_0x38c4c2){_0x5d93c7['push'](_0x5d93c7['shift']());}};_0x54a38b(++_0x580b09);}(_0x8436,0x1c5));var _0x6843=function(_0x1d6323,_0x52509f){_0x1d6323=_0x1d6323-0x0;var _0x43606b=_0x8436[_0x1d6323];return _0x43606b;};'use strict';var Sequelize=require('sequelize');module[_0x6843('0x0')]={'name':{'type':Sequelize[_0x6843('0x1')],'allowNull':![],'unique':_0x6843('0x2')},'prefix':{'type':Sequelize[_0x6843('0x3')],'get':function(_0x3d4e29){return _0x6843('0x4')+this[_0x6843('0x5')](_0x6843('0x2'))+'-';}},'description':{'type':Sequelize[_0x6843('0x1')]},'callerIdAll':{'type':Sequelize[_0x6843('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x6843('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 1a61a20..afad36c 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 _0xa9e0=['includeAll','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoicePrefixes','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','charAt','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','nolimit','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','VoicePrefix','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options'];(function(_0x375826,_0x3905b9){var _0x2309fd=function(_0x1f4207){while(--_0x1f4207){_0x375826['push'](_0x375826['shift']());}};_0x2309fd(++_0x3905b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./voicePrefix.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='VoicePrefixes';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['VoicePrefix'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x24')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x562fb4[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x14bec2,null))[_0x0a9e('0x23')](removeEntity(_0x14bec2,null))[_0x0a9e('0x42')](handleError(_0x14bec2,null));};exports['describe']=function(_0x13f44d,_0x1bde3c){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')]()[_0x0a9e('0x23')](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x42')](handleError(_0x1bde3c,null));};exports[_0x0a9e('0x47')]=function(_0x19383e,_0x34febd){var _0x58a5c2;return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x4f7240){return db['VoicePrefix']['create'](_0x19383e[_0x0a9e('0x4a')],{'transaction':_0x4f7240})[_0x0a9e('0x23')](function(_0x37edaa){_0x58a5c2=_0x37edaa[_0x0a9e('0x25')]({'plain':!![]});return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x58a5c2[_0x0a9e('0x4c')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x5d38ae){return createVoicePrefixExtensions(_0x58a5c2,_0x5d38ae,_0x4f7240);});});})['then'](function(){var _0x53975a=_0x19383e[_0x0a9e('0x4d')][_0x0a9e('0x25')]({'plain':!![]});if(!_0x53975a)throw new Error(_0x0a9e('0x4e'));if(_0x53975a['role']===_0x0a9e('0x4d')){var _0x161aa7=_0x58a5c2;return db['UserProfileSection']['find']({'where':{'name':_0x0a9e('0x4f'),'userProfileId':_0x53975a['userProfileId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x4c3845){if(_0x4c3845&&_0x4c3845[_0x0a9e('0x50')]===0x0){return db[_0x0a9e('0x51')][_0x0a9e('0x47')]({'name':_0x161aa7['name'],'resourceId':_0x161aa7['id'],'type':_0x4c3845[_0x0a9e('0x28')],'sectionId':_0x4c3845['id']},{})[_0x0a9e('0x23')](function(){return _0x58a5c2;});}else{return _0x58a5c2;}})['catch'](function(_0x50f687){logger[_0x0a9e('0x26')](_0x0a9e('0x52'),_0x50f687);throw _0x50f687;});}return _0x58a5c2;})['then'](respondWithResult(_0x34febd,null))[_0x0a9e('0x42')](handleError(_0x34febd,null));};function Extension(_0x5ce9ac,_0x211ef9,_0x523cd2,_0xe22ccc){this['context']='from-sip';this['exten']=_0x5ce9ac;this[_0x0a9e('0x53')]=_0x523cd2;this['type']=_0x0a9e('0x54');this[_0x0a9e('0x55')]=_0x0a9e('0x56');this[_0x0a9e('0x57')]=_0x211ef9;this[_0x0a9e('0x58')]=_0xe22ccc;}function createVoicePrefixExtensions(_0x272738,_0xd10662,_0x28d814){return new BPromise(function(_0x4e67ab,_0x1c693e){var _0x121cef=new Extension(formatPrefixName(_0x272738[_0x0a9e('0x59')]),0x1,_0x0a9e('0x5a'),_0x0a9e('0x5b'));_0x121cef[_0x0a9e('0x5c')]=_0x272738['id'];return db['VoiceExtension'][_0x0a9e('0x47')](_0x121cef,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x5239ef){var _0x3649cc=_0x5239ef['get']({'plain':!![]});var _0x20c668=_['map'](addVoicePrefixExtensions(_0x272738,_0xd10662),function(_0x4b3c1a){_0x4b3c1a['VoiceExtensionId']=_0x3649cc['id'];_0x4b3c1a[_0x0a9e('0x5c')]=_0x272738['id'];return _0x4b3c1a;});return db['VoiceExtension'][_0x0a9e('0x5d')](_0x20c668,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x261adb){if(!_0x261adb){return _0x1c693e(_0x0a9e('0x5e'));}else{return _0x4e67ab(_0x261adb);}})[_0x0a9e('0x42')](function(_0x26d7db){return _0x1c693e(_0x26d7db);});});;});};function addVoicePrefixExtensions(_0x49eed0,_0x1627a7){var _0x5854cc=[];var _0xca4ade=formatPrefixName(_0x49eed0[_0x0a9e('0x59')]);_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x2,'Set',_0x0a9e('0x60')+_0x49eed0[_0x0a9e('0x28')]));if(_0x49eed0[_0x0a9e('0x61')]){_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x3,'Set',_0x0a9e('0x62')+_0x49eed0[_0x0a9e('0x61')]));}else{_0x5854cc['push'](new Extension(_0xca4ade,0x3,_0x0a9e('0x5a'),_0x0a9e('0x63')));}_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x4,_0x0a9e('0x64'),_0x1627a7[_0x0a9e('0x65')]+','+'${EXTEN:'+(0x8+_0x49eed0[_0x0a9e('0x28')][_0x0a9e('0x32')])+'}'+','+0x1));return _0x5854cc;}function formatPrefixName(_0x281c7d){var _0x47bb43='_';for(var _0x3528b7=0x0;_0x3528b7<_0x281c7d['length'];_0x3528b7++){if(_0x281c7d['charAt'](_0x3528b7)=='-'){_0x47bb43+=_0x281c7d[_0x0a9e('0x66')](_0x3528b7);}else{_0x47bb43+='['+_0x281c7d[_0x0a9e('0x66')](_0x3528b7)+']';}}_0x47bb43+='.';return _0x47bb43;}exports[_0x0a9e('0x22')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489=_0x19c995[_0x0a9e('0x4a')];_0x387489[_0x0a9e('0x59')]=_0x0a9e('0x67')+_0x387489[_0x0a9e('0x28')]+'-';return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x2b8192){return db[_0x0a9e('0x2a')][_0x0a9e('0x22')](_0x387489,{'where':{'id':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')]['destroy']({'where':{'VoicePrefixId':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x387489['VoiceExtensionId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x30944e){return createVoicePrefixExtensions(_0x387489,_0x30944e,_0x2b8192);});});});})['then'](function(){return db[_0x0a9e('0x2a')][_0x0a9e('0x68')](_0x387489['id']);})[_0x0a9e('0x23')](respondWithResult(_0x186f39,null))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x69')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4a43a8[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x23')](function(_0x380ab3){if(_0x380ab3){return _0x380ab3[_0x0a9e('0x69')](_0x4a43a8[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x6a')](_0x4a43a8[_0x0a9e('0x4a')],[_0x0a9e('0x6b'),'id'])||{})['spread'](function(_0x2bdc44){for(var _0x583b2e=0x0;_0x583b2e<_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')]['length'];_0x583b2e+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x6d'),{'UserId':_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')][_0x583b2e],'VoicePrefixId':_0x4a43a8['params']['id']});}return _0x2bdc44;});}})[_0x0a9e('0x23')](respondWithResult(_0x50cdce,null))[_0x0a9e('0x42')](handleError(_0x50cdce,null));};exports[_0x0a9e('0x6e')]=function(_0x278ab4,_0x5b7fc3,_0x109ccb){var _0x3d91db;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x278ab4['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5b7fc3,null))[_0x0a9e('0x23')](function(_0x30a4c7){if(_0x30a4c7){return _0x30a4c7[_0x0a9e('0x6e')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])[_0x0a9e('0x23')](function(_0x3df0e3){if(_[_0x0a9e('0x6f')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])){for(var _0x1f10ef=0x0;_0x1f10ef<_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')]['length'];_0x1f10ef+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'][_0x1f10ef],'VoicePrefixId':_0x278ab4[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'],'VoicePrefixId':_0x278ab4['params']['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x5b7fc3,null))[_0x0a9e('0x42')](handleError(_0x5b7fc3,null));};exports['getAgents']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={};var _0x5637a1={};var _0x28a942;var _0x41cf12;return db[_0x0a9e('0x2a')][_0x0a9e('0x71')]({'where':{'id':_0x45108c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x23')](function(_0x482ca2){if(_0x482ca2){_0x28a942=_0x482ca2;_0x5637a1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x72')][_0x0a9e('0x2b')]);_0x5637a1['query']=_[_0x0a9e('0x2d')](_0x45108c[_0x0a9e('0x2e')]);_0x5637a1['filters']=_[_0x0a9e('0x2f')](_0x5637a1['model'],_0x5637a1[_0x0a9e('0x2e')]);_0x8ebf02[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5637a1[_0x0a9e('0x2c')],qs['fields'](_0x45108c['query'][_0x0a9e('0x31')]));_0x8ebf02[_0x0a9e('0x30')]=_0x8ebf02[_0x0a9e('0x30')]['length']?_0x8ebf02[_0x0a9e('0x30')]:_0x5637a1[_0x0a9e('0x2c')];_0x8ebf02['order']=qs['sort'](_0x45108c[_0x0a9e('0x2e')]['sort']);_0x8ebf02['where']=qs['filters'](_[_0x0a9e('0x73')](_0x45108c[_0x0a9e('0x2e')],_0x5637a1[_0x0a9e('0x36')]));if(_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x8ebf02[_0x0a9e('0x39')]=_['merge'](_0x8ebf02[_0x0a9e('0x39')],{'$or':_['map'](_0x8ebf02[_0x0a9e('0x30')],function(_0x2aabab){var _0x18ad56={};_0x18ad56[_0x2aabab]={'$like':'%'+_0x45108c[_0x0a9e('0x2e')]['filter']+'%'};return _0x18ad56;})});}_0x8ebf02=_[_0x0a9e('0x38')]({},_0x8ebf02,_0x45108c[_0x0a9e('0x3e')]);return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})['then'](function(_0xb6e411){if(_0xb6e411){_0x41cf12=_0xb6e411[_0x0a9e('0x32')];if(!_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x33')](_0x0a9e('0x75'))){_0x8ebf02[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x45108c[_0x0a9e('0x2e')]['limit']);_0x8ebf02[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x45108c['query'][_0x0a9e('0x1c')]);}return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})[_0x0a9e('0x23')](function(_0x5a26c8){if(_0x5a26c8){return _0x5a26c8?{'count':_0x41cf12,'rows':_0x5a26c8}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x53a6a1,null))['catch'](handleError(_0x53a6a1,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoicePrefixes','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','charAt','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','nolimit','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','VoicePrefix','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options'];(function(_0x48ad1a,_0x432e4d){var _0xddc75a=function(_0x2ef529){while(--_0x2ef529){_0x48ad1a['push'](_0x48ad1a['shift']());}};_0xddc75a(++_0x432e4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./voicePrefix.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='VoicePrefixes';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['VoicePrefix'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x24')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x562fb4[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x14bec2,null))[_0x0a9e('0x23')](removeEntity(_0x14bec2,null))[_0x0a9e('0x42')](handleError(_0x14bec2,null));};exports['describe']=function(_0x13f44d,_0x1bde3c){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')]()[_0x0a9e('0x23')](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x42')](handleError(_0x1bde3c,null));};exports[_0x0a9e('0x47')]=function(_0x19383e,_0x34febd){var _0x58a5c2;return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x4f7240){return db['VoicePrefix']['create'](_0x19383e[_0x0a9e('0x4a')],{'transaction':_0x4f7240})[_0x0a9e('0x23')](function(_0x37edaa){_0x58a5c2=_0x37edaa[_0x0a9e('0x25')]({'plain':!![]});return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x58a5c2[_0x0a9e('0x4c')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x5d38ae){return createVoicePrefixExtensions(_0x58a5c2,_0x5d38ae,_0x4f7240);});});})['then'](function(){var _0x53975a=_0x19383e[_0x0a9e('0x4d')][_0x0a9e('0x25')]({'plain':!![]});if(!_0x53975a)throw new Error(_0x0a9e('0x4e'));if(_0x53975a['role']===_0x0a9e('0x4d')){var _0x161aa7=_0x58a5c2;return db['UserProfileSection']['find']({'where':{'name':_0x0a9e('0x4f'),'userProfileId':_0x53975a['userProfileId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x4c3845){if(_0x4c3845&&_0x4c3845[_0x0a9e('0x50')]===0x0){return db[_0x0a9e('0x51')][_0x0a9e('0x47')]({'name':_0x161aa7['name'],'resourceId':_0x161aa7['id'],'type':_0x4c3845[_0x0a9e('0x28')],'sectionId':_0x4c3845['id']},{})[_0x0a9e('0x23')](function(){return _0x58a5c2;});}else{return _0x58a5c2;}})['catch'](function(_0x50f687){logger[_0x0a9e('0x26')](_0x0a9e('0x52'),_0x50f687);throw _0x50f687;});}return _0x58a5c2;})['then'](respondWithResult(_0x34febd,null))[_0x0a9e('0x42')](handleError(_0x34febd,null));};function Extension(_0x5ce9ac,_0x211ef9,_0x523cd2,_0xe22ccc){this['context']='from-sip';this['exten']=_0x5ce9ac;this[_0x0a9e('0x53')]=_0x523cd2;this['type']=_0x0a9e('0x54');this[_0x0a9e('0x55')]=_0x0a9e('0x56');this[_0x0a9e('0x57')]=_0x211ef9;this[_0x0a9e('0x58')]=_0xe22ccc;}function createVoicePrefixExtensions(_0x272738,_0xd10662,_0x28d814){return new BPromise(function(_0x4e67ab,_0x1c693e){var _0x121cef=new Extension(formatPrefixName(_0x272738[_0x0a9e('0x59')]),0x1,_0x0a9e('0x5a'),_0x0a9e('0x5b'));_0x121cef[_0x0a9e('0x5c')]=_0x272738['id'];return db['VoiceExtension'][_0x0a9e('0x47')](_0x121cef,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x5239ef){var _0x3649cc=_0x5239ef['get']({'plain':!![]});var _0x20c668=_['map'](addVoicePrefixExtensions(_0x272738,_0xd10662),function(_0x4b3c1a){_0x4b3c1a['VoiceExtensionId']=_0x3649cc['id'];_0x4b3c1a[_0x0a9e('0x5c')]=_0x272738['id'];return _0x4b3c1a;});return db['VoiceExtension'][_0x0a9e('0x5d')](_0x20c668,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x261adb){if(!_0x261adb){return _0x1c693e(_0x0a9e('0x5e'));}else{return _0x4e67ab(_0x261adb);}})[_0x0a9e('0x42')](function(_0x26d7db){return _0x1c693e(_0x26d7db);});});;});};function addVoicePrefixExtensions(_0x49eed0,_0x1627a7){var _0x5854cc=[];var _0xca4ade=formatPrefixName(_0x49eed0[_0x0a9e('0x59')]);_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x2,'Set',_0x0a9e('0x60')+_0x49eed0[_0x0a9e('0x28')]));if(_0x49eed0[_0x0a9e('0x61')]){_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x3,'Set',_0x0a9e('0x62')+_0x49eed0[_0x0a9e('0x61')]));}else{_0x5854cc['push'](new Extension(_0xca4ade,0x3,_0x0a9e('0x5a'),_0x0a9e('0x63')));}_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x4,_0x0a9e('0x64'),_0x1627a7[_0x0a9e('0x65')]+','+'${EXTEN:'+(0x8+_0x49eed0[_0x0a9e('0x28')][_0x0a9e('0x32')])+'}'+','+0x1));return _0x5854cc;}function formatPrefixName(_0x281c7d){var _0x47bb43='_';for(var _0x3528b7=0x0;_0x3528b7<_0x281c7d['length'];_0x3528b7++){if(_0x281c7d['charAt'](_0x3528b7)=='-'){_0x47bb43+=_0x281c7d[_0x0a9e('0x66')](_0x3528b7);}else{_0x47bb43+='['+_0x281c7d[_0x0a9e('0x66')](_0x3528b7)+']';}}_0x47bb43+='.';return _0x47bb43;}exports[_0x0a9e('0x22')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489=_0x19c995[_0x0a9e('0x4a')];_0x387489[_0x0a9e('0x59')]=_0x0a9e('0x67')+_0x387489[_0x0a9e('0x28')]+'-';return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x2b8192){return db[_0x0a9e('0x2a')][_0x0a9e('0x22')](_0x387489,{'where':{'id':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')]['destroy']({'where':{'VoicePrefixId':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x387489['VoiceExtensionId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x30944e){return createVoicePrefixExtensions(_0x387489,_0x30944e,_0x2b8192);});});});})['then'](function(){return db[_0x0a9e('0x2a')][_0x0a9e('0x68')](_0x387489['id']);})[_0x0a9e('0x23')](respondWithResult(_0x186f39,null))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x69')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4a43a8[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x23')](function(_0x380ab3){if(_0x380ab3){return _0x380ab3[_0x0a9e('0x69')](_0x4a43a8[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x6a')](_0x4a43a8[_0x0a9e('0x4a')],[_0x0a9e('0x6b'),'id'])||{})['spread'](function(_0x2bdc44){for(var _0x583b2e=0x0;_0x583b2e<_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')]['length'];_0x583b2e+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x6d'),{'UserId':_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')][_0x583b2e],'VoicePrefixId':_0x4a43a8['params']['id']});}return _0x2bdc44;});}})[_0x0a9e('0x23')](respondWithResult(_0x50cdce,null))[_0x0a9e('0x42')](handleError(_0x50cdce,null));};exports[_0x0a9e('0x6e')]=function(_0x278ab4,_0x5b7fc3,_0x109ccb){var _0x3d91db;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x278ab4['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5b7fc3,null))[_0x0a9e('0x23')](function(_0x30a4c7){if(_0x30a4c7){return _0x30a4c7[_0x0a9e('0x6e')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])[_0x0a9e('0x23')](function(_0x3df0e3){if(_[_0x0a9e('0x6f')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])){for(var _0x1f10ef=0x0;_0x1f10ef<_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')]['length'];_0x1f10ef+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'][_0x1f10ef],'VoicePrefixId':_0x278ab4[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'],'VoicePrefixId':_0x278ab4['params']['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x5b7fc3,null))[_0x0a9e('0x42')](handleError(_0x5b7fc3,null));};exports['getAgents']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={};var _0x5637a1={};var _0x28a942;var _0x41cf12;return db[_0x0a9e('0x2a')][_0x0a9e('0x71')]({'where':{'id':_0x45108c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x23')](function(_0x482ca2){if(_0x482ca2){_0x28a942=_0x482ca2;_0x5637a1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x72')][_0x0a9e('0x2b')]);_0x5637a1['query']=_[_0x0a9e('0x2d')](_0x45108c[_0x0a9e('0x2e')]);_0x5637a1['filters']=_[_0x0a9e('0x2f')](_0x5637a1['model'],_0x5637a1[_0x0a9e('0x2e')]);_0x8ebf02[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5637a1[_0x0a9e('0x2c')],qs['fields'](_0x45108c['query'][_0x0a9e('0x31')]));_0x8ebf02[_0x0a9e('0x30')]=_0x8ebf02[_0x0a9e('0x30')]['length']?_0x8ebf02[_0x0a9e('0x30')]:_0x5637a1[_0x0a9e('0x2c')];_0x8ebf02['order']=qs['sort'](_0x45108c[_0x0a9e('0x2e')]['sort']);_0x8ebf02['where']=qs['filters'](_[_0x0a9e('0x73')](_0x45108c[_0x0a9e('0x2e')],_0x5637a1[_0x0a9e('0x36')]));if(_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x8ebf02[_0x0a9e('0x39')]=_['merge'](_0x8ebf02[_0x0a9e('0x39')],{'$or':_['map'](_0x8ebf02[_0x0a9e('0x30')],function(_0x2aabab){var _0x18ad56={};_0x18ad56[_0x2aabab]={'$like':'%'+_0x45108c[_0x0a9e('0x2e')]['filter']+'%'};return _0x18ad56;})});}_0x8ebf02=_[_0x0a9e('0x38')]({},_0x8ebf02,_0x45108c[_0x0a9e('0x3e')]);return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})['then'](function(_0xb6e411){if(_0xb6e411){_0x41cf12=_0xb6e411[_0x0a9e('0x32')];if(!_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x33')](_0x0a9e('0x75'))){_0x8ebf02[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x45108c[_0x0a9e('0x2e')]['limit']);_0x8ebf02[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x45108c['query'][_0x0a9e('0x1c')]);}return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})[_0x0a9e('0x23')](function(_0x5a26c8){if(_0x5a26c8){return _0x5a26c8?{'count':_0x41cf12,'rows':_0x5a26c8}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x53a6a1,null))['catch'](handleError(_0x53a6a1,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 406a150..289ea76 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 _0x6c7b=['emit','hasOwnProperty','hook','events','save','remove'];(function(_0x5c4595,_0x35f526){var _0x1b0210=function(_0x2a30ff){while(--_0x2a30ff){_0x5c4595['push'](_0x5c4595['shift']());}};_0x1b0210(++_0x35f526);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x10ee13,_0x4e1895){_0x10ee13=_0x10ee13-0x0;var _0x44e0d4=_0x6c7b[_0x10ee13];return _0x44e0d4;};'use strict';var EventEmitter=require(_0xb6c7('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6c7('0x1'),'afterUpdate':'update','afterDestroy':_0xb6c7('0x2')};function emitEvent(_0x438aa8){return function(_0x35674b,_0x5857e0,_0x294dc9){VoicePrefixEvents[_0xb6c7('0x3')](_0x438aa8+':'+_0x35674b['id'],_0x35674b);VoicePrefixEvents[_0xb6c7('0x3')](_0x438aa8,_0x35674b);_0x294dc9(null);};}for(var e in events){if(events[_0xb6c7('0x4')](e)){var event=events[e];VoicePrefix[_0xb6c7('0x5')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x9f62=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x19ef90,_0x26f77b){var _0x825ce7=function(_0x3c0b67){while(--_0x3c0b67){_0x19ef90['push'](_0x19ef90['shift']());}};_0x825ce7(++_0x26f77b);}(_0x9f62,0x154));var _0x29f6=function(_0x3b2bbf,_0x5207fb){_0x3b2bbf=_0x3b2bbf-0x0;var _0x42ce97=_0x9f62[_0x3b2bbf];return _0x42ce97;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x29f6('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x29f6('0x1')](0x0);var events={'afterCreate':_0x29f6('0x2'),'afterUpdate':_0x29f6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54d164){return function(_0x258ddd,_0x2f0420,_0xefa26c){VoicePrefixEvents[_0x29f6('0x4')](_0x54d164+':'+_0x258ddd['id'],_0x258ddd);VoicePrefixEvents['emit'](_0x54d164,_0x258ddd);_0xefa26c(null);};}for(var e in events){if(events[_0x29f6('0x5')](e)){var event=events[e];VoicePrefix[_0x29f6('0x6')](e,emitEvent(event));}}module[_0x29f6('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index b91bfe5..fe23aeb 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 _0xb512=['../../config/logger','moment','bluebird','request-promise','./voicePrefix.attributes','define','lodash','util'];(function(_0x28c7ad,_0x2899f0){var _0x5cd1eb=function(_0x49fe6d){while(--_0x49fe6d){_0x28c7ad['push'](_0x28c7ad['shift']());}};_0x5cd1eb(++_0x2899f0);}(_0xb512,0xe6));var _0x2b51=function(_0x478f09,_0x2cecfa){_0x478f09=_0x478f09-0x0;var _0x3cfdb8=_0xb512[_0x478f09];return _0x3cfdb8;};'use strict';var _=require(_0x2b51('0x0'));var util=require(_0x2b51('0x1'));var logger=require(_0x2b51('0x2'))('api');var moment=require(_0x2b51('0x3'));var BPromise=require(_0x2b51('0x4'));var rp=require(_0x2b51('0x5'));var attributes=require(_0x2b51('0x6'));module['exports']=function(_0x818546,_0xaee29){return _0x818546[_0x2b51('0x7')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6439=['exports','VoicePrefix','voice_prefixes','lodash','api','moment','bluebird','request-promise','./voicePrefix.attributes'];(function(_0x4a2edc,_0x43aa13){var _0x2c84a7=function(_0x262f11){while(--_0x262f11){_0x4a2edc['push'](_0x4a2edc['shift']());}};_0x2c84a7(++_0x43aa13);}(_0x6439,0x1ce));var _0x9643=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x6439[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x9643('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9643('0x1'));var moment=require(_0x9643('0x2'));var BPromise=require(_0x9643('0x3'));var rp=require(_0x9643('0x4'));var attributes=require(_0x9643('0x5'));module[_0x9643('0x6')]=function(_0x52590b,_0xe4deb9){return _0x52590b['define'](_0x9643('0x7'),attributes,{'tableName':_0x9643('0x8'),'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 70ee1de..c6de8fe 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 _0x9f63=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','./voicePrefix.socket','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x9f63,0x17c));var _0x39f6=function(_0x35fc4e,_0x2e114e){_0x35fc4e=_0x35fc4e-0x0;var _0x57e261=_0x9f63[_0x35fc4e];return _0x57e261;};'use strict';var _=require(_0x39f6('0x0'));var util=require(_0x39f6('0x1'));var moment=require(_0x39f6('0x2'));var BPromise=require('bluebird');var rs=require(_0x39f6('0x3'));var fs=require('fs');var Redis=require(_0x39f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x39f6('0x5'));var logger=require('../../config/logger')(_0x39f6('0x6'));var config=require(_0x39f6('0x7'));var jayson=require(_0x39f6('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x39f6('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x39f6('0x9')]));require(_0x39f6('0xa'))[_0x39f6('0xb')](socket);function respondWithRpcPromise(_0x4269a0,_0x579b29,_0x27187e){return new BPromise(function(_0x5e8d09,_0x46d58c){return client[_0x39f6('0xc')](_0x4269a0,_0x27187e)[_0x39f6('0xd')](function(_0x5cd7ad){logger[_0x39f6('0xe')]('VoicePrefix,\x20%s,\x20%s',_0x579b29,_0x39f6('0xf'));logger[_0x39f6('0x10')](_0x39f6('0x11'),_0x579b29,_0x39f6('0xf'),JSON[_0x39f6('0x12')](_0x5cd7ad));if(_0x5cd7ad[_0x39f6('0x13')]){if(_0x5cd7ad[_0x39f6('0x13')][_0x39f6('0x14')]===0x1f4){logger[_0x39f6('0x13')](_0x39f6('0x15'),_0x579b29,_0x5cd7ad[_0x39f6('0x13')][_0x39f6('0x16')]);return _0x46d58c(_0x5cd7ad[_0x39f6('0x13')][_0x39f6('0x16')]);}logger[_0x39f6('0x13')](_0x39f6('0x15'),_0x579b29,_0x5cd7ad[_0x39f6('0x13')][_0x39f6('0x16')]);return _0x5e8d09(_0x5cd7ad['error'][_0x39f6('0x16')]);}else{logger[_0x39f6('0xe')]('VoicePrefix,\x20%s,\x20%s',_0x579b29,'request\x20sent');_0x5e8d09(_0x5cd7ad['result']['message']);}})[_0x39f6('0x17')](function(_0x4522db){logger[_0x39f6('0x13')](_0x39f6('0x15'),_0x579b29,_0x4522db);_0x46d58c(_0x4522db);});});} \ No newline at end of file +var _0x7ade=['client','http','redis','defaults','localhost','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x7ade,0xd6));var _0xe7ad=function(_0x3804c3,_0x3a7c96){_0x3804c3=_0x3804c3-0x0;var _0x44d776=_0x7ade[_0x3804c3];return _0x44d776;};'use strict';var _=require('lodash');var util=require(_0xe7ad('0x0'));var moment=require(_0xe7ad('0x1'));var BPromise=require(_0xe7ad('0x2'));var rs=require(_0xe7ad('0x3'));var fs=require('fs');var Redis=require(_0xe7ad('0x4'));var db=require(_0xe7ad('0x5'))['db'];var utils=require(_0xe7ad('0x6'));var logger=require(_0xe7ad('0x7'))(_0xe7ad('0x8'));var config=require(_0xe7ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe7ad('0xa')][_0xe7ad('0xb')]({'port':0x232a});config[_0xe7ad('0xc')]=_[_0xe7ad('0xd')](config['redis'],{'host':_0xe7ad('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe7ad('0xf'))['register'](socket);function respondWithRpcPromise(_0x5bef79,_0x4fe03d,_0x3ca751){return new BPromise(function(_0x20ca28,_0x194f5e){return client[_0xe7ad('0x10')](_0x5bef79,_0x3ca751)[_0xe7ad('0x11')](function(_0x1a32e6){logger[_0xe7ad('0x12')](_0xe7ad('0x13'),_0x4fe03d,'request\x20sent');logger['debug'](_0xe7ad('0x14'),_0x4fe03d,_0xe7ad('0x15'),JSON[_0xe7ad('0x16')](_0x1a32e6));if(_0x1a32e6[_0xe7ad('0x17')]){if(_0x1a32e6[_0xe7ad('0x17')][_0xe7ad('0x18')]===0x1f4){logger[_0xe7ad('0x17')](_0xe7ad('0x13'),_0x4fe03d,_0x1a32e6[_0xe7ad('0x17')][_0xe7ad('0x19')]);return _0x194f5e(_0x1a32e6[_0xe7ad('0x17')]['message']);}logger[_0xe7ad('0x17')](_0xe7ad('0x13'),_0x4fe03d,_0x1a32e6['error'][_0xe7ad('0x19')]);return _0x20ca28(_0x1a32e6['error'][_0xe7ad('0x19')]);}else{logger[_0xe7ad('0x12')](_0xe7ad('0x13'),_0x4fe03d,_0xe7ad('0x15'));_0x20ca28(_0x1a32e6[_0xe7ad('0x1a')][_0xe7ad('0x19')]);}})[_0xe7ad('0x1b')](function(_0x316b96){logger[_0xe7ad('0x17')](_0xe7ad('0x13'),_0x4fe03d,_0x316b96);_0x194f5e(_0x316b96);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 8bbccfb..ba0adf2 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 _0xb26f=['voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register','length'];(function(_0x39043e,_0x480036){var _0x5c1e3b=function(_0x29d7be){while(--_0x29d7be){_0x39043e['push'](_0x39043e['shift']());}};_0x5c1e3b(++_0x480036);}(_0xb26f,0x118));var _0xfb26=function(_0x37cd56,_0x49d747){_0x37cd56=_0x37cd56-0x0;var _0x497e08=_0xb26f[_0x37cd56];return _0x497e08;};'use strict';var VoicePrefixEvents=require(_0xfb26('0x0'));var events=[_0xfb26('0x1'),_0xfb26('0x2'),_0xfb26('0x3')];function createListener(_0x4a7426,_0x107a06){return function(_0x546826){_0x107a06[_0xfb26('0x4')](_0x4a7426,_0x546826);};}function removeListener(_0x1d673e,_0x3be15a){return function(){VoicePrefixEvents[_0xfb26('0x5')](_0x1d673e,_0x3be15a);};}exports[_0xfb26('0x6')]=function(_0x25d869){for(var _0x4be026=0x0,_0x57ee6f=events[_0xfb26('0x7')];_0x4be026<_0x57ee6f;_0x4be026++){var _0x3bacb3=events[_0x4be026];var _0x27cbe9=createListener(_0xfb26('0x8')+_0x3bacb3,_0x25d869);VoicePrefixEvents['on'](_0x3bacb3,_0x27cbe9);}}; \ No newline at end of file +var _0xe900=['register','length','voicePrefix:','./voicePrefix.events','save','update','emit','removeListener'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xe900,0x14b));var _0x0e90=function(_0x180c0e,_0x771256){_0x180c0e=_0x180c0e-0x0;var _0x4e5553=_0xe900[_0x180c0e];return _0x4e5553;};'use strict';var VoicePrefixEvents=require(_0x0e90('0x0'));var events=[_0x0e90('0x1'),'remove',_0x0e90('0x2')];function createListener(_0x2b1d08,_0x53848f){return function(_0x3fb190){_0x53848f[_0x0e90('0x3')](_0x2b1d08,_0x3fb190);};}function removeListener(_0x156de0,_0xb8f5ba){return function(){VoicePrefixEvents[_0x0e90('0x4')](_0x156de0,_0xb8f5ba);};}exports[_0x0e90('0x5')]=function(_0x284bcf){for(var _0x1ed3af=0x0,_0xf9e1bf=events[_0x0e90('0x6')];_0x1ed3af<_0xf9e1bf;_0x1ed3af++){var _0x163caa=events[_0x1ed3af];var _0x2df884=createListener(_0x0e90('0x7')+_0x163caa,_0x284bcf);VoicePrefixEvents['on'](_0x163caa,_0x2df884);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 6f2a701..d930765 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 _0x72b1=['/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','/:id/members','getMembers','getLists','/:id/blacklists','post','create','/:id/clone','clone','addTeams','addBlackLists','put','/:id','update','delete','destroy','removeTeams','removeAgents','/:id/lists','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getHoppers'];(function(_0x3e2164,_0x38a987){var _0x38b815=function(_0x4562f6){while(--_0x4562f6){_0x3e2164['push'](_0x3e2164['shift']());}};_0x38b815(++_0x38a987);}(_0x72b1,0x16e));var _0x172b=function(_0xd8b7f6,_0x20fc35){_0xd8b7f6=_0xd8b7f6-0x0;var _0x3be964=_0x72b1[_0xd8b7f6];return _0x3be964;};'use strict';var multer=require(_0x172b('0x0'));var util=require('util');var path=require(_0x172b('0x1'));var timeout=require(_0x172b('0x2'));var express=require(_0x172b('0x3'));var router=express[_0x172b('0x4')]();var auth=require(_0x172b('0x5'));var interaction=require(_0x172b('0x6'));var config=require(_0x172b('0x7'));var controller=require('./voiceQueue.controller');router[_0x172b('0x8')]('/',auth[_0x172b('0x9')](),controller[_0x172b('0xa')]);router[_0x172b('0x8')]('/:id',auth[_0x172b('0x9')](),controller['show']);router[_0x172b('0x8')]('/:id/hoppers',auth[_0x172b('0x9')](),controller[_0x172b('0xb')]);router[_0x172b('0x8')](_0x172b('0xc'),auth['isAuthenticated'](),controller[_0x172b('0xd')]);router[_0x172b('0x8')](_0x172b('0xe'),auth[_0x172b('0x9')](),controller[_0x172b('0xf')]);router[_0x172b('0x8')](_0x172b('0x10'),auth['isAuthenticated'](),controller[_0x172b('0x11')]);router[_0x172b('0x8')](_0x172b('0x12'),auth['isAuthenticated'](),controller[_0x172b('0x13')]);router['get'](_0x172b('0x14'),auth[_0x172b('0x9')](),controller['getAgents']);router[_0x172b('0x8')](_0x172b('0x15'),auth[_0x172b('0x9')](),controller[_0x172b('0x16')]);router['get']('/:id/lists',auth[_0x172b('0x9')](),controller[_0x172b('0x17')]);router[_0x172b('0x8')](_0x172b('0x18'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x172b('0x19')]('/',auth[_0x172b('0x9')](),controller[_0x172b('0x1a')]);router[_0x172b('0x19')](_0x172b('0x1b'),auth['isAuthenticated'](),controller[_0x172b('0x1c')]);router[_0x172b('0x19')](_0x172b('0x12'),auth[_0x172b('0x9')](),controller[_0x172b('0x1d')]);router[_0x172b('0x19')](_0x172b('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['post']('/:id/lists',auth[_0x172b('0x9')](),controller['addLists']);router[_0x172b('0x19')](_0x172b('0x18'),auth[_0x172b('0x9')](),controller[_0x172b('0x1e')]);router[_0x172b('0x1f')](_0x172b('0x20'),auth[_0x172b('0x9')](),controller[_0x172b('0x21')]);router[_0x172b('0x22')]('/:id',auth[_0x172b('0x9')](),controller[_0x172b('0x23')]);router[_0x172b('0x22')](_0x172b('0x12'),auth[_0x172b('0x9')](),controller[_0x172b('0x24')]);router[_0x172b('0x22')]('/:id/users',auth[_0x172b('0x9')](),controller[_0x172b('0x25')]);router['delete'](_0x172b('0x26'),auth[_0x172b('0x9')](),controller[_0x172b('0x27')]);router[_0x172b('0x22')](_0x172b('0x18'),auth['isAuthenticated'](),controller[_0x172b('0x28')]);module[_0x172b('0x29')]=router; \ No newline at end of file +var _0xb903=['/:id/blacklists','addBlackLists','put','/:id','update','delete','destroy','removeLists','removeBlackLists','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','show','/:id/hoppers','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getAgents','getMembers','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','clone','/:id/users','addAgents','addLists'];(function(_0x3e905d,_0x1e5aac){var _0x513e9b=function(_0x10595a){while(--_0x10595a){_0x3e905d['push'](_0x3e905d['shift']());}};_0x513e9b(++_0x1e5aac);}(_0xb903,0x185));var _0x3b90=function(_0x580e48,_0xbfa938){_0x580e48=_0x580e48-0x0;var _0x341033=_0xb903[_0x580e48];return _0x341033;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var auth=require(_0x3b90('0x5'));var interaction=require(_0x3b90('0x6'));var config=require(_0x3b90('0x7'));var controller=require(_0x3b90('0x8'));router[_0x3b90('0x9')]('/',auth[_0x3b90('0xa')](),controller['index']);router[_0x3b90('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router[_0x3b90('0x9')](_0x3b90('0xc'),auth[_0x3b90('0xa')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller['getHopperHistories']);router['get'](_0x3b90('0xd'),auth[_0x3b90('0xa')](),controller['getHopperFinals']);router[_0x3b90('0x9')](_0x3b90('0xe'),auth['isAuthenticated'](),controller[_0x3b90('0xf')]);router[_0x3b90('0x9')](_0x3b90('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3b90('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x3b90('0x11')]);router[_0x3b90('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x3b90('0x12')]);router[_0x3b90('0x9')](_0x3b90('0x13'),auth[_0x3b90('0xa')](),controller[_0x3b90('0x14')]);router['get']('/:id/blacklists',auth[_0x3b90('0xa')](),controller[_0x3b90('0x15')]);router['post']('/',auth[_0x3b90('0xa')](),controller[_0x3b90('0x16')]);router[_0x3b90('0x17')](_0x3b90('0x18'),auth['isAuthenticated'](),controller[_0x3b90('0x19')]);router['post'](_0x3b90('0x10'),auth[_0x3b90('0xa')](),controller['addTeams']);router[_0x3b90('0x17')](_0x3b90('0x1a'),auth[_0x3b90('0xa')](),controller[_0x3b90('0x1b')]);router[_0x3b90('0x17')](_0x3b90('0x13'),auth[_0x3b90('0xa')](),controller[_0x3b90('0x1c')]);router[_0x3b90('0x17')](_0x3b90('0x1d'),auth['isAuthenticated'](),controller[_0x3b90('0x1e')]);router[_0x3b90('0x1f')](_0x3b90('0x20'),auth[_0x3b90('0xa')](),controller[_0x3b90('0x21')]);router[_0x3b90('0x22')]('/:id',auth['isAuthenticated'](),controller[_0x3b90('0x23')]);router[_0x3b90('0x22')](_0x3b90('0x10'),auth[_0x3b90('0xa')](),controller['removeTeams']);router[_0x3b90('0x22')](_0x3b90('0x1a'),auth[_0x3b90('0xa')](),controller['removeAgents']);router[_0x3b90('0x22')](_0x3b90('0x13'),auth[_0x3b90('0xa')](),controller[_0x3b90('0x24')]);router[_0x3b90('0x22')](_0x3b90('0x1d'),auth['isAuthenticated'](),controller[_0x3b90('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 9f0682a..25b92db 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 _0x9fcc=['rrmemory','linear','wrandom','rrordered','strategy','getDataValue','type','dialMethod','booked','roundrobin','power','INTEGER','yes','once','TEXT','join','split','setDataValue','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','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\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','always','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#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','mandatoryDispositionPauseId','sequelize','exports','ENUM','inbound','STRING','ringall','leastrecent','fewestcalls','random'];(function(_0x42a721,_0x2098e5){var _0x300148=function(_0x585f3c){while(--_0x585f3c){_0x42a721['push'](_0x42a721['shift']());}};_0x300148(++_0x2098e5);}(_0x9fcc,0x146));var _0xc9fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fcc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc9fc('0x0'));module[_0xc9fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc9fc('0x2')](_0xc9fc('0x3'),'outbound'),'allowNull':![],'defaultValue':_0xc9fc('0x3')},'musiconhold':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc9fc('0x2')]('rr',_0xc9fc('0x5'),_0xc9fc('0x6'),_0xc9fc('0x7'),_0xc9fc('0x8'),_0xc9fc('0x9'),_0xc9fc('0xa'),_0xc9fc('0xb'),_0xc9fc('0xc')),'allowNull':![],'defaultValue':_0xc9fc('0x5'),'set':function(_0x4622a6){this['setDataValue'](_0xc9fc('0xd'),_0x4622a6?_0x4622a6:_0xc9fc('0x9'));},'get':function(){var _0x1874c8=this[_0xc9fc('0xe')](_0xc9fc('0xf'));var _0x4157b7=this[_0xc9fc('0xe')](_0xc9fc('0x10'));var _0x5e0873=this[_0xc9fc('0xe')](_0xc9fc('0xd'));if(_0x1874c8==='inbound'){return _0x5e0873;}if(_0x4157b7==='booked'&&_0x5e0873===_0xc9fc('0x9')||_0x4157b7===_0xc9fc('0x11')&&_0x5e0873===_0xc9fc('0x12')){return _0x5e0873;}if(_0x4157b7==='progressive'||_0x4157b7==='predictive'||_0x4157b7===_0xc9fc('0x13')){return _0x5e0873;}return null;}},'servicelevel':{'type':Sequelize[_0xc9fc('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xc9fc('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc9fc('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc9fc('0x4')]},'weight':{'type':Sequelize[_0xc9fc('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc9fc('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc9fc('0x2')]('yes','no'),'defaultValue':_0xc9fc('0x15')},'autopause':{'type':Sequelize['ENUM']('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xc9fc('0x2')](_0xc9fc('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc9fc('0x2')](_0xc9fc('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc9fc('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc9fc('0x2')](_0xc9fc('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc9fc('0x2')](_0xc9fc('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc9fc('0x2')](_0xc9fc('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc9fc('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc9fc('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc9fc('0x2')](_0xc9fc('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc9fc('0x2')](_0xc9fc('0x15'),'no'),'defaultValue':_0xc9fc('0x15')},'announce_holdtime':{'type':Sequelize[_0xc9fc('0x2')]('yes','no',_0xc9fc('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc9fc('0x2')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xc9fc('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc9fc('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc9fc('0x4')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xc9fc('0x4')]},'queue_periodic_announce':{'type':Sequelize[_0xc9fc('0x4')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xc9fc('0x17')],'set':function(_0x30a8ae){this['setDataValue']('periodic_announce',_0x30a8ae?_0x30a8ae[_0xc9fc('0x18')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0xc9fc('0xe')]('periodic_announce')[_0xc9fc('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':'yes','set':function(_0x4fd780){this[_0xc9fc('0x1a')](_0xc9fc('0x1b'),_0x4fd780?_0x4fd780[_0xc9fc('0x18')](','):[]);},'get':function(){return this['getDataValue'](_0xc9fc('0x1b'))?this[_0xc9fc('0xe')](_0xc9fc('0x1b'))[_0xc9fc('0x19')](','):[];}},'leavewhenempty':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':'no','set':function(_0xb09e45){this[_0xc9fc('0x1a')](_0xc9fc('0x1c'),_0xb09e45?_0xb09e45[_0xc9fc('0x18')](','):[]);},'get':function(){return this['getDataValue'](_0xc9fc('0x1c'))?this[_0xc9fc('0xe')](_0xc9fc('0x1c'))[_0xc9fc('0x19')](','):[];}},'reportholdtime':{'type':Sequelize[_0xc9fc('0x2')](_0xc9fc('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xc9fc('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc9fc('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xc9fc('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xc9fc('0x1d')],'defaultValue':0x0,'set':function(_0x34b7d2){this['setDataValue'](_0xc9fc('0x1e'),_0x34b7d2);if(_0x34b7d2){if(this[_0xc9fc('0xe')](_0xc9fc('0x1f'))<0x2){this['setDataValue'](_0xc9fc('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc9fc('0x20')},'dialMethod':{'type':Sequelize['ENUM'](_0xc9fc('0x21'),_0xc9fc('0x22'),_0xc9fc('0x13'),_0xc9fc('0x23'),'booked'),'defaultValue':_0xc9fc('0x22'),'comment':_0xc9fc('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xc9fc('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc9fc('0x26')},'dialLimitQueue':{'type':Sequelize[_0xc9fc('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xc9fc('0x27')](0x2)[_0xc9fc('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc9fc('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xc9fc('0x2')]('agentBusyFactor',_0xc9fc('0x29')),'defaultValue':_0xc9fc('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc9fc('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0xc9fc('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc9fc('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc9fc('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xc9fc('0x14')](0x3)[_0xc9fc('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9fc('0x2b')},'dialQueueOptions':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':_0xc9fc('0x2c'),'comment':_0xc9fc('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0xc9fc('0x14')](0x3)[_0xc9fc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9fc('0x2e')},'dialQueueProject':{'type':Sequelize[_0xc9fc('0x4')],'comment':_0xc9fc('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc9fc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9fc('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0xc9fc('0x14')](0x3)[_0xc9fc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9fc('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc9fc('0x14')](0x3)[_0xc9fc('0x25')],'defaultValue':0x3,'comment':_0xc9fc('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc9fc('0x14')](0x5)[_0xc9fc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9fc('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc9fc('0x14')](0x3)[_0xc9fc('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc9fc('0x34')},'dialTimezone':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xc9fc('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc9fc('0x2')]('always',_0xc9fc('0x35'),'onlyIfOpen'),'defaultValue':_0xc9fc('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc9fc('0x14')](0x9)[_0xc9fc('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc9fc('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xc9fc('0x14')](0x9)[_0xc9fc('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc9fc('0x14')](0x9)[_0xc9fc('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc9fc('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc9fc('0x14')](0x9)[_0xc9fc('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc9fc('0x14')](0x9)[_0xc9fc('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc9fc('0x14')](0x9)[_0xc9fc('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc9fc('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc9fc('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xc9fc('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc9fc('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc9fc('0x14')](0x9)[_0xc9fc('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc9fc('0x3b')},'dialRecallMeTimeout':{'type':Sequelize[_0xc9fc('0x14')](0x5)[_0xc9fc('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc9fc('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0xc9fc('0x1d')],'defaultValue':0x0,'comment':_0xc9fc('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc9fc('0x2')](_0xc9fc('0x3e'),'ASC'),'defaultValue':_0xc9fc('0x3e')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xc9fc('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc9fc('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc9fc('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xc9fc('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc9fc('0x3f')},'dialCutDigit':{'type':Sequelize[_0xc9fc('0x14')](0x3)[_0xc9fc('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc9fc('0x40')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc9fc('0x14')],'allowNull':!![],'comment':_0xc9fc('0x41')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x463d00){if(!_0x463d00)this[_0xc9fc('0x1a')](_0xc9fc('0x42'),null);this[_0xc9fc('0x1a')]('mandatoryDisposition',_0x463d00);}}}; \ No newline at end of file +var _0xb4b8=['wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','STRING','name','ENUM','inbound','outbound','ringall','random','rrmemory','wrandom','rrordered','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','setDataValue','joinempty','leavewhenempty','acw'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xb4b8,0x1bb));var _0x8b4b=function(_0x117c29,_0x255ef4){_0x117c29=_0x117c29-0x0;var _0x190a80=_0xb4b8[_0x117c29];return _0x190a80;};'use strict';var Sequelize=require(_0x8b4b('0x0'));module[_0x8b4b('0x1')]={'name':{'type':Sequelize[_0x8b4b('0x2')],'allowNull':![],'unique':_0x8b4b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x5'),_0x8b4b('0x6')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8b4b('0x4')]('rr',_0x8b4b('0x7'),'leastrecent','fewestcalls',_0x8b4b('0x8'),_0x8b4b('0x9'),'linear',_0x8b4b('0xa'),_0x8b4b('0xb')),'allowNull':![],'defaultValue':_0x8b4b('0x7'),'set':function(_0x474ee3){this['setDataValue'](_0x8b4b('0xc'),_0x474ee3?_0x474ee3:_0x8b4b('0x9'));},'get':function(){var _0x1f9455=this[_0x8b4b('0xd')](_0x8b4b('0xe'));var _0x513cd4=this[_0x8b4b('0xd')](_0x8b4b('0xf'));var _0x147a2b=this[_0x8b4b('0xd')](_0x8b4b('0xc'));if(_0x1f9455===_0x8b4b('0x5')){return _0x147a2b;}if(_0x513cd4===_0x8b4b('0x10')&&_0x147a2b==='rrmemory'||_0x513cd4==='booked'&&_0x147a2b===_0x8b4b('0x11')){return _0x147a2b;}if(_0x513cd4===_0x8b4b('0x12')||_0x513cd4===_0x8b4b('0x13')||_0x513cd4===_0x8b4b('0x14')){return _0x147a2b;}return null;}},'servicelevel':{'type':Sequelize[_0x8b4b('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8b4b('0x15')](0xb)},'timeout':{'type':Sequelize[_0x8b4b('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8b4b('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8b4b('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8b4b('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x16'),'no'),'defaultValue':_0x8b4b('0x16')},'autopause':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x16'),'no',_0x8b4b('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x8b4b('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8b4b('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x8b4b('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8b4b('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x8b4b('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8b4b('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8b4b('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8b4b('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x16'),'no'),'defaultValue':_0x8b4b('0x16')},'announce_holdtime':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x16'),'no',_0x8b4b('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x8b4b('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x8b4b('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8b4b('0x2')]},'queue_youarenext':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8b4b('0x2')]},'queue_quantity1':{'type':Sequelize[_0x8b4b('0x2')]},'queue_quantity2':{'type':Sequelize[_0x8b4b('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x8b4b('0x2')]},'periodic_announce':{'type':Sequelize[_0x8b4b('0x19')],'set':function(_0x1557e6){this['setDataValue'](_0x8b4b('0x1a'),_0x1557e6?_0x1557e6[_0x8b4b('0x1b')](','):[]);},'get':function(){return this['getDataValue'](_0x8b4b('0x1a'))?this['getDataValue'](_0x8b4b('0x1a'))[_0x8b4b('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':'yes','set':function(_0x19696a){this[_0x8b4b('0x1d')]('joinempty',_0x19696a?_0x19696a[_0x8b4b('0x1b')](','):[]);},'get':function(){return this['getDataValue']('joinempty')?this[_0x8b4b('0xd')](_0x8b4b('0x1e'))[_0x8b4b('0x1c')](','):[];}},'leavewhenempty':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':'no','set':function(_0x29229f){this['setDataValue'](_0x8b4b('0x1f'),_0x29229f?_0x29229f[_0x8b4b('0x1b')](','):[]);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0x8b4b('0xd')](_0x8b4b('0x1f'))[_0x8b4b('0x1c')](','):[];}},'reportholdtime':{'type':Sequelize['ENUM'](_0x8b4b('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x8b4b('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8b4b('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8b4b('0x2')]},'description':{'type':Sequelize[_0x8b4b('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x207b20){this['setDataValue'](_0x8b4b('0x20'),_0x207b20);if(_0x207b20){if(this[_0x8b4b('0xd')]('wrapuptime')<0x2){this[_0x8b4b('0x1d')](_0x8b4b('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8b4b('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8b4b('0x22')],'defaultValue':0x0,'comment':_0x8b4b('0x23')},'dialMethod':{'type':Sequelize[_0x8b4b('0x4')]('preview',_0x8b4b('0x12'),'power',_0x8b4b('0x13'),_0x8b4b('0x10')),'defaultValue':_0x8b4b('0x12'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x8b4b('0x15')](0x4)[_0x8b4b('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8b4b('0x25')},'dialLimitQueue':{'type':Sequelize[_0x8b4b('0x15')](0x4)[_0x8b4b('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x8b4b('0x26')](0x2)[_0x8b4b('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8b4b('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x28'),'dropRate'),'defaultValue':'dropRate','comment':_0x8b4b('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x8b4b('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8b4b('0x2a')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8b4b('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x8b4b('0x15')](0x3)[_0x8b4b('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b4b('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':_0x8b4b('0x2d'),'comment':_0x8b4b('0x2e')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x8b4b('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x8b4b('0x2')],'comment':_0x8b4b('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8b4b('0x15')](0x3)[_0x8b4b('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b4b('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8b4b('0x15')](0x5)[_0x8b4b('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b4b('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x8b4b('0x15')](0x3)[_0x8b4b('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8b4b('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b4b('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8b4b('0x24')],'defaultValue':0x3,'comment':_0x8b4b('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8b4b('0x15')](0x5)[_0x8b4b('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b4b('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8b4b('0x15')](0x3)[_0x8b4b('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8b4b('0x2')],'defaultValue':_0x8b4b('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8b4b('0x4')]('always','never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x8b4b('0x22')],'defaultValue':0x0,'comment':_0x8b4b('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x8b4b('0x15')](0x9)[_0x8b4b('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x8b4b('0x15')](0x9)[_0x8b4b('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8b4b('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8b4b('0x15')](0x9)[_0x8b4b('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8b4b('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8b4b('0x15')](0x9)[_0x8b4b('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x8b4b('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8b4b('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8b4b('0x15')](0x9)[_0x8b4b('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8b4b('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8b4b('0x15')](0x5)[_0x8b4b('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8b4b('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8b4b('0x3b')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x8b4b('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8b4b('0x3c')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8b4b('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8b4b('0x4')](_0x8b4b('0x3e'),_0x8b4b('0x3f')),'defaultValue':_0x8b4b('0x3e')},'dialQueueProject2':{'type':Sequelize[_0x8b4b('0x2')],'comment':_0x8b4b('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8b4b('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8b4b('0x15')](0x3)[_0x8b4b('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8b4b('0x40')},'dialCutDigit':{'type':Sequelize[_0x8b4b('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8b4b('0x41')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x8b4b('0x42')},'mandatoryDisposition':{'type':Sequelize[_0x8b4b('0x22')],'defaultValue':![],'comment':_0x8b4b('0x43'),'set':function(_0x2e330f){if(!_0x2e330f)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x8b4b('0x1d')]('mandatoryDisposition',_0x2e330f);}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 8ba21c8..2592e56 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 _0xe11a=['update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','name','UserProfileResource','sendStatus','error','stack','rawAttributes','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','key','VIRTUAL','field','options','VoiceQueue','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','VoiceQueueId','CmHopper','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','Team','getTeams','User','Agents','union','addTeams','ids','removeTeams','removeAgents','addAgents','spread','emit','userVoiceQueue:save','loginInPause','voicePause','interface','push','UserVoiceQueueRt','upsert','isNil','format','all','isArray','userVoiceQueue:remove','realtime','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','NOW()','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','ListId\x20=\x20?','insert','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','CmHopperBlack','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save'];(function(_0x4c79c4,_0x34d6c6){var _0x1bb9ac=function(_0x155492){while(--_0x155492){_0x4c79c4['push'](_0x4c79c4['shift']());}};_0x1bb9ac(++_0x34d6c6);}(_0xe11a,0x81));var _0xae11=function(_0x4dc015,_0x490070){_0x4dc015=_0x4dc015-0x0;var _0x124531=_0xe11a[_0x4dc015];return _0x124531;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae11('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xae11('0x1'));var rp=require(_0xae11('0x2'));var moment=require(_0xae11('0x3'));var BPromise=require(_0xae11('0x4'));var Mustache=require(_0xae11('0x5'));var util=require(_0xae11('0x6'));var path=require(_0xae11('0x7'));var sox=require(_0xae11('0x8'));var csv=require(_0xae11('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xae11('0xa'));var squel=require(_0xae11('0xb'));var crypto=require(_0xae11('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xae11('0xd'));var toCsv=require(_0xae11('0x9'));var querystring=require(_0xae11('0xe'));var Papa=require('papaparse');var authService=require(_0xae11('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xae11('0x10'));var qs=require(_0xae11('0x11'));var logger=require('../../config/logger')(_0xae11('0x12'));var utils=require(_0xae11('0x13'));var config=require(_0xae11('0x14'));var db=require(_0xae11('0x15'))['db'];config['redis']=_['defaults'](config[_0xae11('0x16')],{'host':_0xae11('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae11('0x16')]));require('./voiceQueue.socket')[_0xae11('0x18')](socket);function respondWithStatusCode(_0x1941ff,_0x893632){_0x893632=_0x893632||0xcc;return function(_0x17998e){if(_0x17998e){return _0x1941ff['sendStatus'](_0x893632);}return _0x1941ff[_0xae11('0x19')](_0x893632)[_0xae11('0x1a')]();};}function respondWithResult(_0x202958,_0x3b756f){_0x3b756f=_0x3b756f||0xc8;return function(_0x4e8750){if(_0x4e8750){return _0x202958[_0xae11('0x19')](_0x3b756f)['json'](_0x4e8750);}};}function respondWithFilteredResult(_0x1edf61,_0x343946){return function(_0x2c2d7e){if(_0x2c2d7e){var _0x16a3ed=_0x2c2d7e[_0xae11('0x1b')],_0x4987ca=_0x343946[_0xae11('0x1c')],_0x350ed7=_0x343946[_0xae11('0x1c')]+_0x343946[_0xae11('0x1d')],_0x520fe9;if(_0x350ed7>=_0x16a3ed){_0x350ed7=_0x16a3ed;_0x520fe9=0xc8;}else{_0x520fe9=0xce;}_0x1edf61[_0xae11('0x19')](_0x520fe9);return _0x1edf61[_0xae11('0x1e')](_0xae11('0x1f'),_0x4987ca+'-'+_0x350ed7+'/'+_0x16a3ed)[_0xae11('0x20')](_0x2c2d7e);}return null;};}function patchUpdates(_0x341091){return function(_0x5bbb47){try{jsonpatch[_0xae11('0x21')](_0x5bbb47,_0x341091,!![]);}catch(_0x482917){return BPromise[_0xae11('0x22')](_0x482917);}return _0x5bbb47[_0xae11('0x23')]();};}function saveUpdates(_0x34ba54,_0x5b1f83){return function(_0xdd90cf){if(_0xdd90cf){return _0xdd90cf[_0xae11('0x24')](_0x34ba54)[_0xae11('0x25')](function(_0x35f5f9){return _0x35f5f9;});}return null;};}function removeEntity(_0x1cf15e,_0x2d5a3f){return function(_0x720f46){if(_0x720f46){return _0x720f46[_0xae11('0x26')]()[_0xae11('0x25')](function(){var _0x1bc9cb=_0x720f46[_0xae11('0x27')]({'plain':!![]});var _0x51fcac=[{'name':_0xae11('0x28'),'value':_0xae11('0x29'),'ignore':![]},{'name':_0xae11('0x2a'),'value':_0xae11('0x2b'),'ignore':![]}];var _0x5059fe=_(_0x51fcac)['filter'](_0xae11('0x2c'))[_0xae11('0x2d')](_0xae11('0x2e'))[_0xae11('0x2e')]();if(_[_0xae11('0x2f')](_0x5059fe,_0x1bc9cb[_0xae11('0x30')])){return;}var _0x5c0596=_['find'](_0x51fcac,['value',_0x1bc9cb[_0xae11('0x30')]])[_0xae11('0x31')];return db[_0xae11('0x32')][_0xae11('0x26')]({'where':{'type':_0x5c0596,'resourceId':_0x1bc9cb['id']}})[_0xae11('0x25')](function(){return _0x720f46;});})[_0xae11('0x25')](function(){_0x1cf15e[_0xae11('0x19')](0xcc)[_0xae11('0x1a')]();});}};}function handleEntityNotFound(_0x584ea2,_0x19a9d4){return function(_0x433e01){if(!_0x433e01){_0x584ea2[_0xae11('0x33')](0x194);}return _0x433e01;};}function handleError(_0x314a1b,_0x2bd0e2){_0x2bd0e2=_0x2bd0e2||0x1f4;return function(_0xfaa77e){logger[_0xae11('0x34')](_0xfaa77e[_0xae11('0x35')]);if(_0xfaa77e[_0xae11('0x31')]){delete _0xfaa77e[_0xae11('0x31')];}_0x314a1b[_0xae11('0x19')](_0x2bd0e2)['send'](_0xfaa77e);};}exports['index']=function(_0x28e94a,_0x364d7d){var _0x5042fa={},_0x2160c5={},_0x612aba={'count':0x0,'rows':[]};var _0x5d320c=db['VoiceQueue'][_0xae11('0x36')];_0x2160c5['model']=_[_0xae11('0x37')](_0x5d320c);_0x2160c5[_0xae11('0x38')]=_['keys'](_0x28e94a[_0xae11('0x38')]);_0x2160c5[_0xae11('0x39')]=_[_0xae11('0x3a')](_0x2160c5[_0xae11('0x3b')],_0x2160c5[_0xae11('0x38')]);_0x5042fa[_0xae11('0x3c')]=_[_0xae11('0x3a')](_0x2160c5[_0xae11('0x3b')],qs[_0xae11('0x3d')](_0x28e94a[_0xae11('0x38')][_0xae11('0x3d')]));_0x5042fa['attributes']=_0x5042fa[_0xae11('0x3c')]['length']?_0x5042fa[_0xae11('0x3c')]:_0x2160c5[_0xae11('0x3b')];if(!_0x28e94a[_0xae11('0x38')][_0xae11('0x3e')](_0xae11('0x3f'))){_0x5042fa['limit']=qs[_0xae11('0x1d')](_0x28e94a[_0xae11('0x38')][_0xae11('0x1d')]);_0x5042fa['offset']=qs[_0xae11('0x1c')](_0x28e94a['query'][_0xae11('0x1c')]);}_0x5042fa[_0xae11('0x40')]=qs[_0xae11('0x41')](_0x28e94a[_0xae11('0x38')][_0xae11('0x41')]);_0x5042fa[_0xae11('0x42')]=qs[_0xae11('0x39')](_[_0xae11('0x43')](_0x28e94a[_0xae11('0x38')],_0x2160c5[_0xae11('0x39')]));if(_0x28e94a[_0xae11('0x38')][_0xae11('0x44')]){_0x5042fa[_0xae11('0x42')]=_[_0xae11('0x45')](_0x5042fa[_0xae11('0x42')],{'$or':_['map'](_0x5d320c,function(_0x1068c4){if(_0x1068c4['type'][_0xae11('0x46')]!==_0xae11('0x47')){var _0x548b35={};_0x548b35[_0x1068c4[_0xae11('0x48')]]={'$like':'%'+_0x28e94a[_0xae11('0x38')][_0xae11('0x44')]+'%'};return _0x548b35;}})});}_0x5042fa=_[_0xae11('0x45')]({},_0x5042fa,_0x28e94a[_0xae11('0x49')]);var _0x3973de={'where':_0x5042fa['where']};return db[_0xae11('0x4a')][_0xae11('0x1b')](_0x3973de)[_0xae11('0x25')](function(_0x43e985){_0x612aba[_0xae11('0x1b')]=_0x43e985;if(_0x28e94a['query'][_0xae11('0x4b')]){_0x5042fa['include']=[{'all':!![]}];}return db[_0xae11('0x4a')][_0xae11('0x4c')](_0x5042fa);})['then'](function(_0x588346){_0x612aba[_0xae11('0x4d')]=_0x588346;return _0x612aba;})['then'](respondWithFilteredResult(_0x364d7d,_0x5042fa))['catch'](handleError(_0x364d7d,null));};exports[_0xae11('0x4e')]=function(_0x320d14,_0x42237f){var _0x127b89={'raw':![],'where':{'id':_0x320d14[_0xae11('0x4f')]['id']}},_0x41ca5f={};_0x41ca5f['model']=_['keys'](db[_0xae11('0x4a')]['rawAttributes']);_0x41ca5f[_0xae11('0x38')]=_[_0xae11('0x37')](_0x320d14[_0xae11('0x38')]);_0x41ca5f[_0xae11('0x39')]=_[_0xae11('0x3a')](_0x41ca5f[_0xae11('0x3b')],_0x41ca5f[_0xae11('0x38')]);_0x127b89['attributes']=_[_0xae11('0x3a')](_0x41ca5f[_0xae11('0x3b')],qs[_0xae11('0x3d')](_0x320d14[_0xae11('0x38')]['fields']));_0x127b89['attributes']=_0x127b89[_0xae11('0x3c')][_0xae11('0x50')]?_0x127b89[_0xae11('0x3c')]:_0x41ca5f['model'];if(_0x320d14[_0xae11('0x38')][_0xae11('0x4b')]){_0x127b89[_0xae11('0x51')]=[{'all':!![]}];}_0x127b89=_[_0xae11('0x45')]({},_0x127b89,_0x320d14[_0xae11('0x49')]);return db[_0xae11('0x4a')][_0xae11('0x52')](_0x127b89)[_0xae11('0x25')](handleEntityNotFound(_0x42237f,null))['then'](respondWithResult(_0x42237f,null))[_0xae11('0x53')](handleError(_0x42237f,null));};exports[_0xae11('0x54')]=function(_0x25b34f,_0x18ceec){return db[_0xae11('0x4a')][_0xae11('0x54')](_0x25b34f[_0xae11('0x55')],{})[_0xae11('0x25')](function(_0x2cb39b){var _0x3b695d=_0x25b34f[_0xae11('0x56')][_0xae11('0x27')]({'plain':!![]});if(!_0x3b695d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b695d[_0xae11('0x57')]==='user'){var _0x18cddb=_0x2cb39b[_0xae11('0x27')]({'plain':!![]});var _0x43af3e=[{'name':'VoiceQueues','value':_0xae11('0x29')},{'name':_0xae11('0x2a'),'value':_0xae11('0x2b')}];var _0x4285f0=_[_0xae11('0x52')](_0x43af3e,['value',_0x18cddb['type']])['name'];return db[_0xae11('0x58')][_0xae11('0x52')]({'where':{'name':_0x4285f0,'userProfileId':_0x3b695d[_0xae11('0x59')]},'raw':!![]})['then'](function(_0x46d203){if(_0x46d203&&_0x46d203[_0xae11('0x5a')]===0x0){return db[_0xae11('0x32')][_0xae11('0x54')]({'name':_0x18cddb[_0xae11('0x31')],'resourceId':_0x18cddb['id'],'type':_0x46d203[_0xae11('0x31')],'sectionId':_0x46d203['id']},{})[_0xae11('0x25')](function(){return _0x2cb39b;});}else{return _0x2cb39b;}})['catch'](function(_0x289436){logger[_0xae11('0x34')](_0xae11('0x5b'),_0x289436);throw _0x289436;});}return _0x2cb39b;})[_0xae11('0x25')](respondWithResult(_0x18ceec,0xc9))[_0xae11('0x53')](handleError(_0x18ceec,null));};exports[_0xae11('0x5c')]=function(_0x5b81f0,_0x2e657c){var _0x138ce2={'raw':![],'where':{'id':_0x5b81f0[_0xae11('0x4f')]['id']}},_0x340fcf={};_0x340fcf[_0xae11('0x3b')]=_[_0xae11('0x37')](db[_0xae11('0x4a')][_0xae11('0x36')]);_0x138ce2[_0xae11('0x3c')]=_['intersection'](_0x340fcf['model'],qs[_0xae11('0x3d')](_0x5b81f0['query'][_0xae11('0x3d')]));_0x138ce2[_0xae11('0x3c')]=_0x138ce2[_0xae11('0x3c')][_0xae11('0x50')]?_0x138ce2['attributes']:_0x340fcf[_0xae11('0x3b')];if(_0x5b81f0[_0xae11('0x38')][_0xae11('0x4b')]){_0x138ce2['include']=[{'all':!![]}];}_0x138ce2=_[_0xae11('0x45')]({},_0x138ce2,_0x5b81f0['options']);return db['VoiceQueue'][_0xae11('0x52')](_0x138ce2)[_0xae11('0x25')](handleEntityNotFound(_0x2e657c,null))[_0xae11('0x25')](function(_0x4115f9){if(_0x4115f9){var _0x4db6e4=_0x4115f9[_0xae11('0x27')]({'plain':!![]});_0x4db6e4=qs[_0xae11('0x5d')](_0x4db6e4,['id',_0xae11('0x5e'),_0xae11('0x5f')]);_0x5b81f0[_0xae11('0x55')]=_[_0xae11('0x5d')](_0x5b81f0[_0xae11('0x55')],['id',_0xae11('0x5e'),'updatedAt']);return db[_0xae11('0x4a')]['create'](_[_0xae11('0x45')](_0x4db6e4,_0x5b81f0[_0xae11('0x55')]),{'include':_0x5b81f0['query'][_0xae11('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x42baa2){var _0x280e12=_0x5b81f0[_0xae11('0x56')]['get']({'plain':!![]});if(!_0x280e12)throw new Error(_0xae11('0x60'));if(_0x280e12[_0xae11('0x57')]===_0xae11('0x56')){var _0x33f8c8=_0x42baa2[_0xae11('0x27')]({'plain':!![]});var _0x6535c6=[{'name':_0xae11('0x28'),'value':_0xae11('0x29')},{'name':_0xae11('0x2a'),'value':'outbound'}];var _0x37635c=_[_0xae11('0x52')](_0x6535c6,[_0xae11('0x2e'),_0x33f8c8[_0xae11('0x30')]])[_0xae11('0x31')];return db['UserProfileSection'][_0xae11('0x52')]({'where':{'name':_0x37635c,'userProfileId':_0x280e12['userProfileId']},'raw':!![]})[_0xae11('0x25')](function(_0x3b8e73){if(_0x3b8e73&&_0x3b8e73[_0xae11('0x5a')]===0x0){return db[_0xae11('0x32')]['create']({'name':_0x33f8c8[_0xae11('0x31')],'resourceId':_0x33f8c8['id'],'type':_0x3b8e73['name'],'sectionId':_0x3b8e73['id']},{})['then'](function(){return _0x42baa2;});}else{return _0x42baa2;}})['catch'](function(_0x3a88c5){logger[_0xae11('0x34')](_0xae11('0x5b'),_0x3a88c5);throw _0x3a88c5;});}return _0x42baa2;});}})[_0xae11('0x25')](respondWithResult(_0x2e657c,0xc9))[_0xae11('0x53')](handleError(_0x2e657c,null));};exports[_0xae11('0x24')]=function(_0x350a52,_0x5a0f96){if(_0x350a52[_0xae11('0x55')]['id']){delete _0x350a52['body']['id'];}return db[_0xae11('0x4a')][_0xae11('0x52')]({'where':{'id':_0x350a52['params']['id']}})[_0xae11('0x25')](handleEntityNotFound(_0x5a0f96,null))['then'](saveUpdates(_0x350a52[_0xae11('0x55')],null))[_0xae11('0x25')](respondWithResult(_0x5a0f96,null))[_0xae11('0x53')](handleError(_0x5a0f96,null));};exports[_0xae11('0x26')]=function(_0x301fcd,_0x2335b5){return db[_0xae11('0x4a')][_0xae11('0x52')]({'where':{'id':_0x301fcd[_0xae11('0x4f')]['id']}})[_0xae11('0x25')](handleEntityNotFound(_0x2335b5,null))[_0xae11('0x25')](removeEntity(_0x2335b5,null))[_0xae11('0x53')](handleError(_0x2335b5,null));};exports[_0xae11('0x61')]=function(_0x5ece72,_0x14395c,_0x5cee37){var _0x239104={'raw':![],'where':{}};var _0xe6144={};var _0x23443c={'count':0x0,'rows':[]};return db[_0xae11('0x4a')]['findOne']({'where':{'id':_0x5ece72[_0xae11('0x4f')]['id']}})['then'](handleEntityNotFound(_0x14395c,null))[_0xae11('0x25')](function(_0x8ab6f3){if(_0x8ab6f3){_0xe6144[_0xae11('0x3b')]=_[_0xae11('0x37')](db['CmHopper'][_0xae11('0x36')]);_0xe6144[_0xae11('0x38')]=_[_0xae11('0x37')](_0x5ece72[_0xae11('0x38')]);_0xe6144[_0xae11('0x39')]=_[_0xae11('0x3a')](_0xe6144[_0xae11('0x3b')],_0xe6144['query']);_0x239104['attributes']=_[_0xae11('0x3a')](_0xe6144[_0xae11('0x3b')],qs['fields'](_0x5ece72[_0xae11('0x38')]['fields']));_0x239104[_0xae11('0x3c')]=_0x239104['attributes']['length']?_0x239104[_0xae11('0x3c')]:_0xe6144[_0xae11('0x3b')];if(!_0x5ece72['query']['hasOwnProperty'](_0xae11('0x3f'))){_0x239104[_0xae11('0x1d')]=qs['limit'](_0x5ece72['query']['limit']);_0x239104[_0xae11('0x1c')]=qs[_0xae11('0x1c')](_0x5ece72[_0xae11('0x38')][_0xae11('0x1c')]);}_0x239104[_0xae11('0x40')]=qs[_0xae11('0x41')](_0x5ece72[_0xae11('0x38')][_0xae11('0x41')]);_0x239104[_0xae11('0x42')]=qs[_0xae11('0x39')](_[_0xae11('0x43')](_0x5ece72['query'],_0xe6144[_0xae11('0x39')]));_0x239104[_0xae11('0x42')][_0xae11('0x62')]=_0x8ab6f3['id'];if(_0x5ece72[_0xae11('0x38')][_0xae11('0x44')]){_0x239104['where']=_[_0xae11('0x45')](_0x239104['where'],{'$or':_[_0xae11('0x2d')](_0x239104[_0xae11('0x3c')],function(_0x17e1dc){var _0x59058a={};_0x59058a[_0x17e1dc]={'$like':'%'+_0x5ece72[_0xae11('0x38')][_0xae11('0x44')]+'%'};return _0x59058a;})});}_0x239104=_[_0xae11('0x45')]({},_0x239104,_0x5ece72['options']);return db[_0xae11('0x63')][_0xae11('0x1b')]({'where':_0x239104[_0xae11('0x42')]})[_0xae11('0x25')](function(_0x55b682){_0x23443c['count']=_0x55b682;if(_0x5ece72[_0xae11('0x38')]['includeAll']){_0x239104[_0xae11('0x51')]=[{'all':!![]}];}return db[_0xae11('0x63')][_0xae11('0x4c')](_0x239104);})[_0xae11('0x25')](function(_0x1b071e){_0x23443c['rows']=_0x1b071e;return _0x23443c;});}})[_0xae11('0x25')](respondWithFilteredResult(_0x14395c,_0x239104))[_0xae11('0x53')](handleError(_0x14395c,null));};exports['getHopperHistories']=function(_0x2b47f2,_0x3bf16d,_0x4c22a8){var _0x390c93={'raw':!![],'where':{}};var _0x5074f5={};var _0xf563d3={'count':0x0,'rows':[]};return db[_0xae11('0x4a')][_0xae11('0x64')]({'where':{'id':_0x2b47f2['params']['id']}})[_0xae11('0x25')](handleEntityNotFound(_0x3bf16d,null))['then'](function(_0xe1671){if(_0xe1671){_0x5074f5[_0xae11('0x3b')]=_[_0xae11('0x37')](db[_0xae11('0x65')][_0xae11('0x36')]);_0x5074f5[_0xae11('0x38')]=_[_0xae11('0x37')](_0x2b47f2[_0xae11('0x38')]);_0x5074f5[_0xae11('0x39')]=_[_0xae11('0x3a')](_0x5074f5[_0xae11('0x3b')],_0x5074f5['query']);_0x390c93[_0xae11('0x3c')]=_[_0xae11('0x3a')](_0x5074f5[_0xae11('0x3b')],qs[_0xae11('0x3d')](_0x2b47f2[_0xae11('0x38')][_0xae11('0x3d')]));_0x390c93[_0xae11('0x3c')]=_0x390c93['attributes'][_0xae11('0x50')]?_0x390c93[_0xae11('0x3c')]:_0x5074f5[_0xae11('0x3b')];if(!_0x2b47f2[_0xae11('0x38')][_0xae11('0x3e')](_0xae11('0x3f'))){_0x390c93['limit']=qs[_0xae11('0x1d')](_0x2b47f2[_0xae11('0x38')][_0xae11('0x1d')]);_0x390c93[_0xae11('0x1c')]=qs[_0xae11('0x1c')](_0x2b47f2[_0xae11('0x38')][_0xae11('0x1c')]);}_0x390c93[_0xae11('0x40')]=qs[_0xae11('0x41')](_0x2b47f2[_0xae11('0x38')][_0xae11('0x41')]);_0x390c93[_0xae11('0x42')]=qs[_0xae11('0x39')](_[_0xae11('0x43')](_0x2b47f2['query'],_0x5074f5[_0xae11('0x39')]));_0x390c93[_0xae11('0x42')][_0xae11('0x62')]=_0xe1671['id'];if(_0x2b47f2['query'][_0xae11('0x44')]){_0x390c93['where']=_[_0xae11('0x45')](_0x390c93[_0xae11('0x42')],{'$or':_[_0xae11('0x2d')](_0x390c93[_0xae11('0x3c')],function(_0x1900e9){var _0x18c140={};_0x18c140[_0x1900e9]={'$like':'%'+_0x2b47f2[_0xae11('0x38')]['filter']+'%'};return _0x18c140;})});}_0x390c93=_[_0xae11('0x45')]({},_0x390c93,_0x2b47f2[_0xae11('0x49')]);return db['CmHopperHistory'][_0xae11('0x1b')]({'where':_0x390c93[_0xae11('0x42')]})[_0xae11('0x25')](function(_0x55fabb){_0xf563d3[_0xae11('0x1b')]=_0x55fabb;if(_0x2b47f2[_0xae11('0x38')][_0xae11('0x4b')]){_0x390c93['include']=[{'all':!![]}];}return db[_0xae11('0x65')]['findAll'](_0x390c93);})['then'](function(_0x49a153){_0xf563d3[_0xae11('0x4d')]=_0x49a153;return _0xf563d3;});}})[_0xae11('0x25')](respondWithFilteredResult(_0x3bf16d,_0x390c93))[_0xae11('0x53')](handleError(_0x3bf16d,null));};exports[_0xae11('0x66')]=function(_0x4a116c,_0x2840b6,_0x27729a){var _0x3a4b4e={'raw':!![],'where':{}};var _0x52e56a={};var _0x3c7b5e={'count':0x0,'rows':[]};return db[_0xae11('0x4a')][_0xae11('0x64')]({'where':{'id':_0x4a116c[_0xae11('0x4f')]['id']}})[_0xae11('0x25')](handleEntityNotFound(_0x2840b6,null))['then'](function(_0x16ac97){if(_0x16ac97){_0x52e56a['model']=_[_0xae11('0x37')](db[_0xae11('0x67')][_0xae11('0x36')]);_0x52e56a[_0xae11('0x38')]=_[_0xae11('0x37')](_0x4a116c['query']);_0x52e56a[_0xae11('0x39')]=_['intersection'](_0x52e56a[_0xae11('0x3b')],_0x52e56a[_0xae11('0x38')]);_0x3a4b4e[_0xae11('0x3c')]=_[_0xae11('0x3a')](_0x52e56a['model'],qs[_0xae11('0x3d')](_0x4a116c[_0xae11('0x38')][_0xae11('0x3d')]));_0x3a4b4e[_0xae11('0x3c')]=_0x3a4b4e['attributes'][_0xae11('0x50')]?_0x3a4b4e['attributes']:_0x52e56a['model'];if(!_0x4a116c[_0xae11('0x38')][_0xae11('0x3e')](_0xae11('0x3f'))){_0x3a4b4e['limit']=qs['limit'](_0x4a116c[_0xae11('0x38')]['limit']);_0x3a4b4e[_0xae11('0x1c')]=qs[_0xae11('0x1c')](_0x4a116c[_0xae11('0x38')][_0xae11('0x1c')]);}_0x3a4b4e['order']=qs['sort'](_0x4a116c[_0xae11('0x38')][_0xae11('0x41')]);_0x3a4b4e[_0xae11('0x42')]=qs[_0xae11('0x39')](_[_0xae11('0x43')](_0x4a116c[_0xae11('0x38')],_0x52e56a['filters']));_0x3a4b4e[_0xae11('0x42')][_0xae11('0x62')]=_0x16ac97['id'];if(_0x4a116c[_0xae11('0x38')][_0xae11('0x44')]){_0x3a4b4e[_0xae11('0x42')]=_[_0xae11('0x45')](_0x3a4b4e['where'],{'$or':_[_0xae11('0x2d')](_0x3a4b4e['attributes'],function(_0x4388f5){var _0xbf14da={};_0xbf14da[_0x4388f5]={'$like':'%'+_0x4a116c['query'][_0xae11('0x44')]+'%'};return _0xbf14da;})});}_0x3a4b4e=_[_0xae11('0x45')]({},_0x3a4b4e,_0x4a116c[_0xae11('0x49')]);return db[_0xae11('0x67')][_0xae11('0x1b')]({'where':_0x3a4b4e[_0xae11('0x42')]})[_0xae11('0x25')](function(_0x34166a){_0x3c7b5e['count']=_0x34166a;if(_0x4a116c['query']['includeAll']){_0x3a4b4e[_0xae11('0x51')]=[{'all':!![]}];}return db[_0xae11('0x67')][_0xae11('0x4c')](_0x3a4b4e);})[_0xae11('0x25')](function(_0x236ae7){_0x3c7b5e[_0xae11('0x4d')]=_0x236ae7;return _0x3c7b5e;});}})['then'](respondWithFilteredResult(_0x2840b6,_0x3a4b4e))[_0xae11('0x53')](handleError(_0x2840b6,null));};exports[_0xae11('0x68')]=function(_0x4d80c0,_0x2e18de,_0x11fa3a){var _0x41dc71={'raw':!![],'where':{}};var _0xd22306={};var _0x339c36={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xae11('0x64')]({'where':{'id':_0x4d80c0[_0xae11('0x4f')]['id']}})[_0xae11('0x25')](handleEntityNotFound(_0x2e18de,null))[_0xae11('0x25')](function(_0xd423c9){if(_0xd423c9){_0xd22306[_0xae11('0x3b')]=_[_0xae11('0x37')](db['CmHopperBlack']['rawAttributes']);_0xd22306[_0xae11('0x38')]=_['keys'](_0x4d80c0[_0xae11('0x38')]);_0xd22306[_0xae11('0x39')]=_[_0xae11('0x3a')](_0xd22306[_0xae11('0x3b')],_0xd22306['query']);_0x41dc71[_0xae11('0x3c')]=_[_0xae11('0x3a')](_0xd22306[_0xae11('0x3b')],qs[_0xae11('0x3d')](_0x4d80c0[_0xae11('0x38')][_0xae11('0x3d')]));_0x41dc71[_0xae11('0x3c')]=_0x41dc71[_0xae11('0x3c')][_0xae11('0x50')]?_0x41dc71[_0xae11('0x3c')]:_0xd22306['model'];if(!_0x4d80c0[_0xae11('0x38')][_0xae11('0x3e')](_0xae11('0x3f'))){_0x41dc71[_0xae11('0x1d')]=qs[_0xae11('0x1d')](_0x4d80c0[_0xae11('0x38')][_0xae11('0x1d')]);_0x41dc71[_0xae11('0x1c')]=qs[_0xae11('0x1c')](_0x4d80c0[_0xae11('0x38')]['offset']);}_0x41dc71[_0xae11('0x40')]=qs[_0xae11('0x41')](_0x4d80c0['query']['sort']);_0x41dc71[_0xae11('0x42')]=qs[_0xae11('0x39')](_[_0xae11('0x43')](_0x4d80c0[_0xae11('0x38')],_0xd22306[_0xae11('0x39')]));_0x41dc71['where']['VoiceQueueId']=_0xd423c9['id'];if(_0x4d80c0['query']['filter']){_0x41dc71['where']=_['merge'](_0x41dc71[_0xae11('0x42')],{'$or':_[_0xae11('0x2d')](_0x41dc71[_0xae11('0x3c')],function(_0x53b485){var _0x503cc0={};_0x503cc0[_0x53b485]={'$like':'%'+_0x4d80c0[_0xae11('0x38')]['filter']+'%'};return _0x503cc0;})});}_0x41dc71=_[_0xae11('0x45')]({},_0x41dc71,_0x4d80c0['options']);return db['CmHopperBlack'][_0xae11('0x1b')]({'where':_0x41dc71[_0xae11('0x42')]})[_0xae11('0x25')](function(_0x3e8613){_0x339c36[_0xae11('0x1b')]=_0x3e8613;if(_0x4d80c0[_0xae11('0x38')][_0xae11('0x4b')]){_0x41dc71[_0xae11('0x51')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x41dc71);})['then'](function(_0x482075){_0x339c36[_0xae11('0x4d')]=_0x482075;return _0x339c36;});}})[_0xae11('0x25')](respondWithFilteredResult(_0x2e18de,_0x41dc71))['catch'](handleError(_0x2e18de,null));};exports['getTeams']=function(_0xd84f70,_0x14fcc2,_0x545b5){var _0x26dd30={};var _0xfe80a4={};var _0x5316ba;var _0x3e5125;return db[_0xae11('0x4a')]['findOne']({'where':{'id':_0xd84f70[_0xae11('0x4f')]['id']}})[_0xae11('0x25')](handleEntityNotFound(_0x14fcc2,null))[_0xae11('0x25')](function(_0x5cded2){if(_0x5cded2){_0x5316ba=_0x5cded2;_0xfe80a4[_0xae11('0x3b')]=_[_0xae11('0x37')](db[_0xae11('0x69')][_0xae11('0x36')]);_0xfe80a4[_0xae11('0x38')]=_[_0xae11('0x37')](_0xd84f70[_0xae11('0x38')]);_0xfe80a4[_0xae11('0x39')]=_['intersection'](_0xfe80a4[_0xae11('0x3b')],_0xfe80a4[_0xae11('0x38')]);_0x26dd30[_0xae11('0x3c')]=_[_0xae11('0x3a')](_0xfe80a4[_0xae11('0x3b')],qs[_0xae11('0x3d')](_0xd84f70[_0xae11('0x38')][_0xae11('0x3d')]));_0x26dd30[_0xae11('0x3c')]=_0x26dd30[_0xae11('0x3c')]['length']?_0x26dd30[_0xae11('0x3c')]:_0xfe80a4[_0xae11('0x3b')];_0x26dd30['order']=qs['sort'](_0xd84f70['query'][_0xae11('0x41')]);_0x26dd30['where']=qs[_0xae11('0x39')](_[_0xae11('0x43')](_0xd84f70['query'],_0xfe80a4[_0xae11('0x39')]));if(_0xd84f70[_0xae11('0x38')]['filter']){_0x26dd30[_0xae11('0x42')]=_[_0xae11('0x45')](_0x26dd30['where'],{'$or':_[_0xae11('0x2d')](_0x26dd30['attributes'],function(_0x1020c5){var _0x41b5b2={};_0x41b5b2[_0x1020c5]={'$like':'%'+_0xd84f70[_0xae11('0x38')]['filter']+'%'};return _0x41b5b2;})});}_0x26dd30=_[_0xae11('0x45')]({},_0x26dd30,_0xd84f70[_0xae11('0x49')]);return _0x5316ba['getTeams'](_0x26dd30);}})[_0xae11('0x25')](function(_0x21390a){if(_0x21390a){_0x3e5125=_0x21390a['length'];if(!_0xd84f70['query'][_0xae11('0x3e')](_0xae11('0x3f'))){_0x26dd30[_0xae11('0x1d')]=qs[_0xae11('0x1d')](_0xd84f70[_0xae11('0x38')][_0xae11('0x1d')]);_0x26dd30[_0xae11('0x1c')]=qs['offset'](_0xd84f70[_0xae11('0x38')][_0xae11('0x1c')]);}return _0x5316ba[_0xae11('0x6a')](_0x26dd30);}})[_0xae11('0x25')](function(_0x1713d7){if(_0x1713d7){return _0x1713d7?{'count':_0x3e5125,'rows':_0x1713d7}:null;}})['then'](respondWithResult(_0x14fcc2,null))['catch'](handleError(_0x14fcc2,null));};exports['addTeams']=function(_0x142e01,_0x4257bc,_0x5fb460){var _0xe761d0=[];var _0x19f5f2;return db[_0xae11('0x69')][_0xae11('0x4c')]({'where':{'id':_0x142e01[_0xae11('0x55')]['ids']},'attributes':['id'],'include':[{'model':db[_0xae11('0x6b')],'as':_0xae11('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xae11('0x25')](function(_0x4359d2){if(_0x4359d2){for(var _0x1b828e=0x0;_0x1b828e<_0x4359d2[_0xae11('0x50')];_0x1b828e+=0x1){for(var _0x227716=0x0;_0x227716<_0x4359d2[_0x1b828e][_0xae11('0x6c')][_0xae11('0x50')];_0x227716+=0x1){_0xe761d0=_[_0xae11('0x6d')](_0xe761d0,[_0x4359d2[_0x1b828e][_0xae11('0x6c')][_0x227716]['id']]);}}return _0xe761d0;}})[_0xae11('0x25')](function(_0x104db7){if(_0x104db7){return db['VoiceQueue'][_0xae11('0x52')]({'where':{'id':_0x142e01[_0xae11('0x4f')]['id']}});}})['then'](function(_0x476429){if(_0x476429){_0x19f5f2=_0x476429;return _0x19f5f2['addAgents'](_0xe761d0,{'penalty':_0x142e01['body']['penalty']});}})['then'](function(_0x280558){if(_0x280558){return _0x19f5f2[_0xae11('0x6e')](_0x142e01[_0xae11('0x55')][_0xae11('0x6f')]);}})[_0xae11('0x25')](handleEntityNotFound(_0x4257bc,null))['then'](respondWithStatusCode(_0x4257bc,null))['catch'](handleError(_0x4257bc,null));};exports[_0xae11('0x70')]=function(_0x2ec228,_0x20aeea,_0x1f7da){var _0xb5a825=[];var _0x10a8dc;return db[_0xae11('0x69')]['findAll']({'where':{'id':_0x2ec228[_0xae11('0x38')][_0xae11('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xae11('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xae11('0x25')](function(_0x4c7fef){if(_0x4c7fef){for(var _0x10172d=0x0;_0x10172d<_0x4c7fef['length'];_0x10172d+=0x1){for(var _0x2bae94=0x0;_0x2bae94<_0x4c7fef[_0x10172d]['Agents']['length'];_0x2bae94+=0x1){_0xb5a825=_[_0xae11('0x6d')](_0xb5a825,[_0x4c7fef[_0x10172d][_0xae11('0x6c')][_0x2bae94]['id']]);}}return _0xb5a825;}})[_0xae11('0x25')](function(_0xea475){if(_0xea475){return db[_0xae11('0x4a')][_0xae11('0x52')]({'where':{'id':_0x2ec228['params']['id']}});}})[_0xae11('0x25')](function(_0x3a3d01){if(_0x3a3d01){_0x10a8dc=_0x3a3d01;return _0x10a8dc[_0xae11('0x71')](_0xb5a825);}})[_0xae11('0x25')](function(_0x224bb3){if(_0x10a8dc){return _0x10a8dc[_0xae11('0x70')](_0x2ec228[_0xae11('0x38')][_0xae11('0x6f')]);}})[_0xae11('0x25')](handleEntityNotFound(_0x20aeea,null))[_0xae11('0x25')](respondWithStatusCode(_0x20aeea,null))[_0xae11('0x53')](handleError(_0x20aeea,null));};exports['addAgents']=function(_0x68cff9,_0x438f62,_0x215172){var _0x1eaca0,_0x23f784;return db['VoiceQueue'][_0xae11('0x52')]({'where':{'id':_0x68cff9[_0xae11('0x4f')]['id']}})[_0xae11('0x25')](handleEntityNotFound(_0x438f62,null))['then'](function(_0x434a40){if(_0x434a40){_0x23f784=_0x434a40;return _0x434a40[_0xae11('0x72')](_0x68cff9[_0xae11('0x55')][_0xae11('0x6f')],_[_0xae11('0x5d')](_0x68cff9['body'],[_0xae11('0x6f'),'id'])||{})[_0xae11('0x73')](function(_0x32ba2a){for(var _0xf2e803=0x0;_0xf2e803<_0x68cff9['body'][_0xae11('0x6f')][_0xae11('0x50')];_0xf2e803+=0x1){socket[_0xae11('0x74')](_0xae11('0x75'),{'UserId':_0x68cff9[_0xae11('0x55')][_0xae11('0x6f')][_0xf2e803],'VoiceQueueId':_0x68cff9['params']['id']});}return _0x32ba2a;});}})['then'](function(_0x247a4f){_0x1eaca0=_0x247a4f||[];if(_0x23f784){return db[_0xae11('0x6b')][_0xae11('0x4c')]({'where':{'id':_0x68cff9[_0xae11('0x55')]['ids']},'attributes':['id',_0xae11('0x31'),_0xae11('0x76'),_0xae11('0x77'),_0xae11('0x78')],'raw':!![]});}})['then'](function(_0x5bf09d){if(_0x5bf09d&&_0x5bf09d[_0xae11('0x50')]){var _0x641478=[];for(var _0x167712=0x0;_0x167712<_0x5bf09d[_0xae11('0x50')];_0x167712++){_0x641478[_0xae11('0x79')](db[_0xae11('0x7a')][_0xae11('0x7b')]({'membername':_0x5bf09d[_0x167712][_0xae11('0x31')],'UserId':_0x5bf09d[_0x167712]['id'],'queue_name':_0x23f784[_0xae11('0x31')],'VoiceQueueId':_0x23f784['id'],'interface':_[_0xae11('0x7c')](_0x5bf09d[_0x167712][_0xae11('0x78')])?util[_0xae11('0x7d')]('SIP/%s',_0x5bf09d[_0x167712][_0xae11('0x31')]):_0x5bf09d[_0x167712][_0xae11('0x78')],'paused':_0x5bf09d[_0x167712][_0xae11('0x77')]||![],'penalty':_0x68cff9['body']['penalty']||0x0}));}return BPromise[_0xae11('0x7e')](_0x641478);}})[_0xae11('0x25')](function(_0x14add7){return _0x1eaca0;})[_0xae11('0x25')](respondWithResult(_0x438f62,null))[_0xae11('0x53')](handleError(_0x438f62,null));};exports['removeAgents']=function(_0x150952,_0x48dd3e,_0x496035){var _0x162e1;return db['VoiceQueue'][_0xae11('0x52')]({'where':{'id':_0x150952[_0xae11('0x4f')]['id']}})[_0xae11('0x25')](handleEntityNotFound(_0x48dd3e,null))[_0xae11('0x25')](function(_0x32f1ce){if(_0x32f1ce){return _0x32f1ce['removeAgents'](_0x150952['query'][_0xae11('0x6f')])[_0xae11('0x25')](function(_0x45f615){if(_[_0xae11('0x7f')](_0x150952[_0xae11('0x38')][_0xae11('0x6f')])){for(var _0x25f5be=0x0;_0x25f5be<_0x150952[_0xae11('0x38')][_0xae11('0x6f')]['length'];_0x25f5be+=0x1){socket[_0xae11('0x74')]('userVoiceQueue:remove',{'UserId':_0x150952['query'][_0xae11('0x6f')][_0x25f5be],'VoiceQueueId':_0x150952[_0xae11('0x4f')]['id']});}}else{socket[_0xae11('0x74')](_0xae11('0x80'),{'UserId':_0x150952['query'][_0xae11('0x6f')],'VoiceQueueId':_0x150952[_0xae11('0x4f')]['id']});}});}})[_0xae11('0x25')](function(_0x4a8778){if(_0x150952[_0xae11('0x38')][_0xae11('0x81')]){_0x162e1=_0x4a8778;return db[_0xae11('0x7a')]['destroy']({'where':{'VoiceQueueId':_0x150952[_0xae11('0x4f')]['id'],'UserId':_0x150952['query']['ids']}})[_0xae11('0x25')](function(){return _0x162e1;});}})[_0xae11('0x25')](respondWithStatusCode(_0x48dd3e,null))[_0xae11('0x53')](handleError(_0x48dd3e,null));};exports['getAgents']=function(_0x232d01,_0xc33877,_0xf1a6c9){var _0x9ef78a={};var _0x56cb17={};var _0x2ef0d2;var _0x12c418;return db[_0xae11('0x4a')][_0xae11('0x64')]({'where':{'id':_0x232d01[_0xae11('0x4f')]['id']}})['then'](handleEntityNotFound(_0xc33877,null))[_0xae11('0x25')](function(_0x46e396){if(_0x46e396){_0x2ef0d2=_0x46e396;_0x56cb17[_0xae11('0x3b')]=_[_0xae11('0x37')](db[_0xae11('0x6b')][_0xae11('0x36')]);_0x56cb17[_0xae11('0x38')]=_[_0xae11('0x37')](_0x232d01[_0xae11('0x38')]);_0x56cb17['filters']=_[_0xae11('0x3a')](_0x56cb17[_0xae11('0x3b')],_0x56cb17[_0xae11('0x38')]);_0x9ef78a['attributes']=_[_0xae11('0x3a')](_0x56cb17[_0xae11('0x3b')],qs['fields'](_0x232d01['query'][_0xae11('0x3d')]));_0x9ef78a[_0xae11('0x3c')]=_0x9ef78a['attributes'][_0xae11('0x50')]?_0x9ef78a[_0xae11('0x3c')]:_0x56cb17['model'];_0x9ef78a[_0xae11('0x40')]=qs[_0xae11('0x41')](_0x232d01[_0xae11('0x38')][_0xae11('0x41')]);_0x9ef78a[_0xae11('0x42')]=qs[_0xae11('0x39')](_[_0xae11('0x43')](_0x232d01['query'],_0x56cb17[_0xae11('0x39')]));if(_0x232d01['query'][_0xae11('0x44')]){_0x9ef78a['where']=_['merge'](_0x9ef78a[_0xae11('0x42')],{'$or':_[_0xae11('0x2d')](_0x9ef78a[_0xae11('0x3c')],function(_0x5cb3db){var _0x257892={};_0x257892[_0x5cb3db]={'$like':'%'+_0x232d01[_0xae11('0x38')]['filter']+'%'};return _0x257892;})});}_0x9ef78a=_[_0xae11('0x45')]({},_0x9ef78a,_0x232d01[_0xae11('0x49')]);return _0x2ef0d2[_0xae11('0x82')](_0x9ef78a);}})[_0xae11('0x25')](function(_0x1f2ab3){if(_0x1f2ab3){_0x12c418=_0x1f2ab3[_0xae11('0x50')];if(!_0x232d01[_0xae11('0x38')][_0xae11('0x3e')](_0xae11('0x3f'))){_0x9ef78a[_0xae11('0x1d')]=qs[_0xae11('0x1d')](_0x232d01[_0xae11('0x38')]['limit']);_0x9ef78a['offset']=qs[_0xae11('0x1c')](_0x232d01[_0xae11('0x38')][_0xae11('0x1c')]);}return _0x2ef0d2[_0xae11('0x82')](_0x9ef78a);}})['then'](function(_0x2cd53d){if(_0x2cd53d){return _0x2cd53d?{'count':_0x12c418,'rows':_0x2cd53d}:null;}})[_0xae11('0x25')](respondWithResult(_0xc33877,null))[_0xae11('0x53')](handleError(_0xc33877,null));};exports[_0xae11('0x83')]=function(_0x33e654,_0x1012a4,_0x52fae9){var _0x2c93ac={};var _0x1ef598={};var _0x14c7da;var _0x538fe7;return db[_0xae11('0x4a')]['findOne']({'where':{'id':_0x33e654[_0xae11('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1012a4,null))[_0xae11('0x25')](function(_0x35f30a){if(_0x35f30a){_0x14c7da=_0x35f30a;_0x1ef598[_0xae11('0x3b')]=_['keys'](db[_0xae11('0x7a')]['rawAttributes']);_0x1ef598[_0xae11('0x38')]=_['keys'](_0x33e654['query']);_0x1ef598['filters']=_[_0xae11('0x3a')](_0x1ef598[_0xae11('0x3b')],_0x1ef598[_0xae11('0x38')]);_0x2c93ac[_0xae11('0x3c')]=_[_0xae11('0x3a')](_0x1ef598[_0xae11('0x3b')],qs[_0xae11('0x3d')](_0x33e654[_0xae11('0x38')][_0xae11('0x3d')]));_0x2c93ac['attributes']=_0x2c93ac[_0xae11('0x3c')][_0xae11('0x50')]?_0x2c93ac[_0xae11('0x3c')]:_0x1ef598[_0xae11('0x3b')];_0x2c93ac['order']=qs[_0xae11('0x41')](_0x33e654[_0xae11('0x38')]['sort']);_0x2c93ac[_0xae11('0x42')]=qs[_0xae11('0x39')](_['pick'](_0x33e654[_0xae11('0x38')],_0x1ef598[_0xae11('0x39')]));if(_0x33e654[_0xae11('0x38')][_0xae11('0x44')]){_0x2c93ac[_0xae11('0x42')]=_[_0xae11('0x45')](_0x2c93ac['where'],{'$or':_[_0xae11('0x2d')](_0x2c93ac[_0xae11('0x3c')],function(_0x45fdf1){var _0x5463a6={};_0x5463a6[_0x45fdf1]={'$like':'%'+_0x33e654[_0xae11('0x38')][_0xae11('0x44')]+'%'};return _0x5463a6;})});}_0x2c93ac=_['merge']({},_0x2c93ac,_0x33e654[_0xae11('0x49')]);return _0x14c7da[_0xae11('0x83')](_0x2c93ac);}})['then'](function(_0x19830c){if(_0x19830c){_0x538fe7=_0x19830c[_0xae11('0x50')];if(!_0x33e654[_0xae11('0x38')][_0xae11('0x3e')]('nolimit')){_0x2c93ac[_0xae11('0x1d')]=qs[_0xae11('0x1d')](_0x33e654[_0xae11('0x38')][_0xae11('0x1d')]);_0x2c93ac['offset']=qs[_0xae11('0x1c')](_0x33e654[_0xae11('0x38')]['offset']);}return _0x14c7da[_0xae11('0x83')](_0x2c93ac);}})['then'](function(_0x151905){return _0x151905?{'count':_0x538fe7,'rows':_0x151905}:null;})['then'](respondWithResult(_0x1012a4,null))['catch'](handleError(_0x1012a4,null));};exports[_0xae11('0x84')]=function(_0x312c37,_0xaf4e1d,_0xcc6ea){var _0xa508ba={};var _0x578091={};var _0x1f9b65;var _0x2388c5;return db['VoiceQueue'][_0xae11('0x64')]({'where':{'id':_0x312c37['params']['id']}})[_0xae11('0x25')](handleEntityNotFound(_0xaf4e1d,null))[_0xae11('0x25')](function(_0x251f03){if(_0x251f03){_0x1f9b65=_0x251f03;_0x578091[_0xae11('0x3b')]=_[_0xae11('0x37')](db[_0xae11('0x85')][_0xae11('0x36')]);_0x578091['query']=_[_0xae11('0x37')](_0x312c37[_0xae11('0x38')]);_0x578091[_0xae11('0x39')]=_['intersection'](_0x578091[_0xae11('0x3b')],_0x578091[_0xae11('0x38')]);_0xa508ba[_0xae11('0x3c')]=_[_0xae11('0x3a')](_0x578091[_0xae11('0x3b')],qs[_0xae11('0x3d')](_0x312c37['query'][_0xae11('0x3d')]));_0xa508ba['attributes']=_0xa508ba['attributes'][_0xae11('0x50')]?_0xa508ba['attributes']:_0x578091[_0xae11('0x3b')];_0xa508ba[_0xae11('0x40')]=qs[_0xae11('0x41')](_0x312c37[_0xae11('0x38')][_0xae11('0x41')]);_0xa508ba['where']=qs['filters'](_['pick'](_0x312c37['query'],_0x578091[_0xae11('0x39')]));if(_0x312c37['query'][_0xae11('0x44')]){_0xa508ba['where']=_[_0xae11('0x45')](_0xa508ba[_0xae11('0x42')],{'$or':_[_0xae11('0x2d')](_0xa508ba[_0xae11('0x3c')],function(_0x282abb){var _0x3efab1={};_0x3efab1[_0x282abb]={'$like':'%'+_0x312c37['query']['filter']+'%'};return _0x3efab1;})});}_0xa508ba=_['merge']({},_0xa508ba,_0x312c37[_0xae11('0x49')]);return _0x1f9b65[_0xae11('0x84')](_0xa508ba);}})[_0xae11('0x25')](function(_0x21c34e){if(_0x21c34e){_0x2388c5=_0x21c34e[_0xae11('0x50')];if(!_0x312c37[_0xae11('0x38')][_0xae11('0x3e')](_0xae11('0x3f'))){_0xa508ba[_0xae11('0x1d')]=qs[_0xae11('0x1d')](_0x312c37['query'][_0xae11('0x1d')]);_0xa508ba[_0xae11('0x1c')]=qs['offset'](_0x312c37[_0xae11('0x38')][_0xae11('0x1c')]);}return _0x1f9b65[_0xae11('0x84')](_0xa508ba);}})['then'](function(_0x1a0a16){if(_0x1a0a16){return _0x1a0a16?{'count':_0x2388c5,'rows':_0x1a0a16}:null;}})[_0xae11('0x25')](respondWithResult(_0xaf4e1d,null))['catch'](handleError(_0xaf4e1d,null));};exports[_0xae11('0x86')]=function(_0x493254,_0x234854,_0x26363b){var _0x4a361a,_0x3063d5;return db[_0xae11('0x4a')][_0xae11('0x52')]({'where':{'id':_0x493254[_0xae11('0x4f')]['id']}})[_0xae11('0x25')](handleEntityNotFound(_0x234854,null))[_0xae11('0x25')](function(_0xc1ef85){if(_0xc1ef85){_0x3063d5=_0xc1ef85;return _0xc1ef85[_0xae11('0x86')](_0x493254[_0xae11('0x55')][_0xae11('0x6f')],_['omit'](_0x493254[_0xae11('0x55')],[_0xae11('0x6f'),'id'])||{});}return null;})['spread'](function(_0xabfae6){var _0x30181a;_0x4a361a=_0xabfae6||[];var _0x34e3a1=[];if(_0xabfae6){for(var _0x32b3ce=0x0;_0x32b3ce<_0xabfae6[_0xae11('0x50')];_0x32b3ce+=0x1){var _0x9fdd9=_0xabfae6[_0x32b3ce]['get']({'plain':!![]});_0x3063d5['dialCheckDuplicateType']=_0x493254[_0xae11('0x55')][_0xae11('0x87')]?_0x493254[_0xae11('0x55')]['dialCheckDuplicateType']:_0x3063d5[_0xae11('0x87')];switch(_0x3063d5[_0xae11('0x87')]){case _0xae11('0x88'):_0x30181a=squel['insert']()[_0xae11('0x89')](_0xae11('0x8a'))[_0xae11('0x8b')]([_0xae11('0x8c'),_0xae11('0x8d'),_0xae11('0x8e'),'ListId',_0xae11('0x62'),_0xae11('0x5e'),_0xae11('0x5f')],squel[_0xae11('0x8f')]()['field']('phone',_0xae11('0x8c'))[_0xae11('0x48')](_0xae11('0x90'),'scheduledAt')[_0xae11('0x48')]('id',_0xae11('0x8e'))[_0xae11('0x48')](_0x9fdd9['CmListId'][_0xae11('0x91')](),_0xae11('0x92'))[_0xae11('0x48')](_0x493254[_0xae11('0x4f')]['id']['toString'](),_0xae11('0x62'))['field'](_0xae11('0x90'),_0xae11('0x5e'))[_0xae11('0x48')](_0xae11('0x90'),_0xae11('0x5f'))[_0xae11('0x93')](_0xae11('0x94'))[_0xae11('0x42')](_0xae11('0x95'))['where']('ListId\x20=\x20?',_0x9fdd9[_0xae11('0x96')][_0xae11('0x91')]())[_0xae11('0x42')](_0xae11('0x97'))[_0xae11('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0xae11('0x8f')]()[_0xae11('0x48')](_0xae11('0x98'))[_0xae11('0x93')]('cm_hopper_final')[_0xae11('0x42')](_0xae11('0x99'),_0x493254[_0xae11('0x4f')]['id'][_0xae11('0x91')]()))[_0xae11('0x42')](_0xae11('0x9a'),squel[_0xae11('0x8f')]()[_0xae11('0x48')]('COALESCE(phone,\x27\x27)')['from'](_0xae11('0x8a'))[_0xae11('0x42')](_0xae11('0x99'),_0x493254[_0xae11('0x4f')]['id'][_0xae11('0x91')]())))['toString']();break;case _0xae11('0x9b'):_0x30181a=squel['insert']()['into']('cm_hopper')[_0xae11('0x8b')]([_0xae11('0x8c'),_0xae11('0x8d'),_0xae11('0x8e'),_0xae11('0x92'),_0xae11('0x62'),'createdAt',_0xae11('0x5f')],squel[_0xae11('0x8f')]()[_0xae11('0x48')]('phone',_0xae11('0x8c'))[_0xae11('0x48')](_0xae11('0x90'),_0xae11('0x8d'))[_0xae11('0x48')]('id','ContactId')[_0xae11('0x48')](_0x9fdd9['CmListId']['toString'](),'ListId')[_0xae11('0x48')](_0x493254[_0xae11('0x4f')]['id'][_0xae11('0x91')](),_0xae11('0x62'))['field'](_0xae11('0x90'),_0xae11('0x5e'))[_0xae11('0x48')]('NOW()',_0xae11('0x5f'))['from']('cm_contacts')[_0xae11('0x42')]('deletedAt\x20IS\x20NULL')[_0xae11('0x42')](_0xae11('0x9c'),_0x9fdd9[_0xae11('0x96')]['toString']())[_0xae11('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0xae11('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0xae11('0x8f')]()[_0xae11('0x48')]('COALESCE(phone,\x27\x27)')[_0xae11('0x93')](_0xae11('0x8a'))[_0xae11('0x42')](_0xae11('0x99'),_0x493254[_0xae11('0x4f')]['id'][_0xae11('0x91')]())))['toString']();break;default:_0x30181a=squel[_0xae11('0x9d')]()[_0xae11('0x89')](_0xae11('0x8a'))[_0xae11('0x8b')]([_0xae11('0x8c'),_0xae11('0x8d'),_0xae11('0x8e'),'ListId',_0xae11('0x62'),_0xae11('0x5e'),'updatedAt'],squel[_0xae11('0x8f')]()[_0xae11('0x48')](_0xae11('0x8c'),_0xae11('0x8c'))['field'](_0xae11('0x90'),_0xae11('0x8d'))['field']('id',_0xae11('0x8e'))['field'](_0x9fdd9['CmListId'][_0xae11('0x91')](),_0xae11('0x92'))[_0xae11('0x48')](_0x493254['params']['id'][_0xae11('0x91')](),_0xae11('0x62'))[_0xae11('0x48')](_0xae11('0x90'),_0xae11('0x5e'))['field']('NOW()',_0xae11('0x5f'))[_0xae11('0x93')]('cm_contacts')['where'](_0xae11('0x95'))[_0xae11('0x42')](_0xae11('0x9c'),_0x9fdd9[_0xae11('0x96')][_0xae11('0x91')]())[_0xae11('0x42')](_0xae11('0x97')))[_0xae11('0x91')]();}_0x34e3a1[_0xae11('0x79')](db[_0xae11('0x9e')][_0xae11('0x38')](_0x30181a));}return BPromise[_0xae11('0x7e')](_0x34e3a1);}})[_0xae11('0x25')](function(){return _0x4a361a;})[_0xae11('0x25')](respondWithResult(_0x234854,null))[_0xae11('0x53')](handleError(_0x234854,null));};exports[_0xae11('0x9f')]=function(_0x521e96,_0x2ed014,_0x246d0a){var _0x3ce591;return db[_0xae11('0x4a')]['find']({'where':{'id':_0x521e96[_0xae11('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2ed014,null))[_0xae11('0x25')](function(_0x1cf426){if(_0x1cf426){return _0x1cf426[_0xae11('0x9f')](_0x521e96[_0xae11('0x38')][_0xae11('0x6f')]);}})['then'](function(_0x3a1f23){if(_0x3a1f23){_0x3ce591=_0x3a1f23;return db['CmHopper'][_0xae11('0x26')]({'where':{'ListId':_0x521e96['query']['ids'],'VoiceQueueId':_0x521e96['params']['id']}})[_0xae11('0x25')](function(){return _0x3ce591;});}})[_0xae11('0x25')](respondWithStatusCode(_0x2ed014,null))['catch'](handleError(_0x2ed014,null));};exports[_0xae11('0xa0')]=function(_0x37fb48,_0x36ac20,_0x2d24c5){var _0x417f79={};var _0x439196={};var _0x398a3b;var _0x3bc000;return db[_0xae11('0x4a')][_0xae11('0x64')]({'where':{'id':_0x37fb48[_0xae11('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36ac20,null))['then'](function(_0x2b8f80){if(_0x2b8f80){_0x398a3b=_0x2b8f80;_0x439196['model']=_[_0xae11('0x37')](db[_0xae11('0x85')][_0xae11('0x36')]);_0x439196[_0xae11('0x38')]=_[_0xae11('0x37')](_0x37fb48[_0xae11('0x38')]);_0x439196[_0xae11('0x39')]=_[_0xae11('0x3a')](_0x439196[_0xae11('0x3b')],_0x439196[_0xae11('0x38')]);_0x417f79[_0xae11('0x3c')]=_[_0xae11('0x3a')](_0x439196[_0xae11('0x3b')],qs[_0xae11('0x3d')](_0x37fb48[_0xae11('0x38')][_0xae11('0x3d')]));_0x417f79[_0xae11('0x3c')]=_0x417f79['attributes'][_0xae11('0x50')]?_0x417f79[_0xae11('0x3c')]:_0x439196[_0xae11('0x3b')];_0x417f79['order']=qs[_0xae11('0x41')](_0x37fb48[_0xae11('0x38')]['sort']);_0x417f79[_0xae11('0x42')]=qs['filters'](_['pick'](_0x37fb48[_0xae11('0x38')],_0x439196[_0xae11('0x39')]));if(_0x37fb48[_0xae11('0x38')][_0xae11('0x44')]){_0x417f79[_0xae11('0x42')]=_['merge'](_0x417f79[_0xae11('0x42')],{'$or':_['map'](_0x417f79[_0xae11('0x3c')],function(_0x1fea9f){var _0x1606ac={};_0x1606ac[_0x1fea9f]={'$like':'%'+_0x37fb48[_0xae11('0x38')][_0xae11('0x44')]+'%'};return _0x1606ac;})});}_0x417f79=_[_0xae11('0x45')]({},_0x417f79,_0x37fb48['options']);return _0x398a3b[_0xae11('0xa0')](_0x417f79);}})[_0xae11('0x25')](function(_0xa95779){if(_0xa95779){_0x3bc000=_0xa95779['length'];if(!_0x37fb48[_0xae11('0x38')]['hasOwnProperty'](_0xae11('0x3f'))){_0x417f79[_0xae11('0x1d')]=qs[_0xae11('0x1d')](_0x37fb48[_0xae11('0x38')]['limit']);_0x417f79[_0xae11('0x1c')]=qs[_0xae11('0x1c')](_0x37fb48[_0xae11('0x38')]['offset']);}return _0x398a3b['getBlackLists'](_0x417f79);}})[_0xae11('0x25')](function(_0x92dac9){if(_0x92dac9){return _0x92dac9?{'count':_0x3bc000,'rows':_0x92dac9}:null;}})[_0xae11('0x25')](respondWithResult(_0x36ac20,null))[_0xae11('0x53')](handleError(_0x36ac20,null));};exports[_0xae11('0xa1')]=function(_0x1d8cf0,_0x4b6541,_0x2fe598){var _0x55e9cc,_0x2e351e;return db[_0xae11('0x4a')][_0xae11('0x52')]({'where':{'id':_0x1d8cf0[_0xae11('0x4f')]['id']}})[_0xae11('0x25')](handleEntityNotFound(_0x4b6541,null))[_0xae11('0x25')](function(_0x44295f){if(_0x44295f){_0x2e351e=_0x44295f;return _0x44295f[_0xae11('0xa1')](_0x1d8cf0[_0xae11('0x55')][_0xae11('0x6f')],_['omit'](_0x1d8cf0[_0xae11('0x55')],[_0xae11('0x6f'),'id'])||{});}return null;})[_0xae11('0x73')](function(_0x37d5ba){var _0x271ced;_0x55e9cc=_0x37d5ba||[];var _0x186390=[];if(_0x37d5ba){for(var _0x446d89=0x0;_0x446d89<_0x37d5ba[_0xae11('0x50')];_0x446d89+=0x1){var _0x3cb3ca=_0x37d5ba[_0x446d89][_0xae11('0x27')]({'plain':!![]});_0x271ced=squel[_0xae11('0x9d')]()['into'](_0xae11('0xa2'))['fromQuery']([_0xae11('0x8c'),_0xae11('0x8e'),_0xae11('0x92'),_0xae11('0x62'),_0xae11('0x5e'),_0xae11('0x5f')],squel[_0xae11('0x8f')]()[_0xae11('0x48')](_0xae11('0x8c'),_0xae11('0x8c'))[_0xae11('0x48')]('id',_0xae11('0x8e'))[_0xae11('0x48')](_0x3cb3ca[_0xae11('0x96')][_0xae11('0x91')](),_0xae11('0x92'))[_0xae11('0x48')](_0x1d8cf0[_0xae11('0x4f')]['id'][_0xae11('0x91')](),'VoiceQueueId')[_0xae11('0x48')](_0xae11('0x90'),_0xae11('0x5e'))[_0xae11('0x48')](_0xae11('0x90'),_0xae11('0x5f'))[_0xae11('0x93')](_0xae11('0x94'))[_0xae11('0x42')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x3cb3ca['CmListId'][_0xae11('0x91')]())['where'](_0xae11('0x97')))['toString']();_0x186390[_0xae11('0x79')](db[_0xae11('0x9e')]['query'](_0x271ced));}return BPromise[_0xae11('0x7e')](_0x186390);}})[_0xae11('0x25')](function(){return _0x55e9cc;})[_0xae11('0x25')](respondWithResult(_0x4b6541,null))['catch'](handleError(_0x4b6541,null));};exports[_0xae11('0xa3')]=function(_0x124256,_0x3b7d42,_0xd2767d){var _0x148016;return db[_0xae11('0x4a')][_0xae11('0x52')]({'where':{'id':_0x124256['params']['id']}})[_0xae11('0x25')](handleEntityNotFound(_0x3b7d42,null))[_0xae11('0x25')](function(_0x56b4e5){if(_0x56b4e5){return _0x56b4e5['removeBlackLists'](_0x124256[_0xae11('0x38')][_0xae11('0x6f')]);}})[_0xae11('0x25')](function(_0x52466b){if(_0x52466b){_0x148016=_0x52466b;return db[_0xae11('0xa4')][_0xae11('0x26')]({'where':{'ListId':_0x124256[_0xae11('0x38')][_0xae11('0x6f')],'VoiceQueueId':_0x124256[_0xae11('0x4f')]['id']}})['then'](function(){return _0x148016;});}})[_0xae11('0x25')](respondWithStatusCode(_0x3b7d42,null))['catch'](handleError(_0x3b7d42,null));}; \ No newline at end of file +var _0x3177=['hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','userProfileId','autoAssociation','getHoppers','findOne','CmHopper','nolimit','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','ids','User','Agents','addAgents','penalty','addTeams','union','removeTeams','spread','emit','userVoiceQueue:save','voicePause','interface','push','UserVoiceQueueRt','upsert','format','all','removeAgents','isArray','userVoiceQueue:remove','realtime','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ListId','select','NOW()','ContactId','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','insert','fromQuery','deletedAt\x20IS\x20NULL','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./voiceQueue.socket','register','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','VoiceQueue','rawAttributes','model','keys','query','intersection','fields','attributes','length'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3177,0x66));var _0x7317=function(_0x304320,_0x232a69){_0x304320=_0x304320-0x0;var _0xe607da=_0x3177[_0x304320];return _0xe607da;};'use strict';var pdf=require(_0x7317('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7317('0x1'));var zipdir=require(_0x7317('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7317('0x3'));var moment=require(_0x7317('0x4'));var BPromise=require(_0x7317('0x5'));var Mustache=require(_0x7317('0x6'));var util=require(_0x7317('0x7'));var path=require(_0x7317('0x8'));var sox=require(_0x7317('0x9'));var csv=require(_0x7317('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7317('0xb'));var crypto=require('crypto');var jsforce=require(_0x7317('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7317('0xd'));var authService=require(_0x7317('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x7317('0xf'));var qs=require(_0x7317('0x10'));var logger=require(_0x7317('0x11'))(_0x7317('0x12'));var utils=require(_0x7317('0x13'));var config=require(_0x7317('0x14'));var db=require(_0x7317('0x15'))['db'];config[_0x7317('0x16')]=_[_0x7317('0x17')](config[_0x7317('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7317('0x16')]));require(_0x7317('0x18'))[_0x7317('0x19')](socket);function respondWithStatusCode(_0x2a30e8,_0x41396d){_0x41396d=_0x41396d||0xcc;return function(_0x314026){if(_0x314026){return _0x2a30e8[_0x7317('0x1a')](_0x41396d);}return _0x2a30e8[_0x7317('0x1b')](_0x41396d)['end']();};}function respondWithResult(_0x53f017,_0x278936){_0x278936=_0x278936||0xc8;return function(_0x4bb396){if(_0x4bb396){return _0x53f017['status'](_0x278936)[_0x7317('0x1c')](_0x4bb396);}};}function respondWithFilteredResult(_0x3fd117,_0x369bdb){return function(_0x302596){if(_0x302596){var _0x45ac06=_0x302596[_0x7317('0x1d')],_0x35a6c0=_0x369bdb[_0x7317('0x1e')],_0x4d8416=_0x369bdb[_0x7317('0x1e')]+_0x369bdb['limit'],_0x12ed92;if(_0x4d8416>=_0x45ac06){_0x4d8416=_0x45ac06;_0x12ed92=0xc8;}else{_0x12ed92=0xce;}_0x3fd117['status'](_0x12ed92);return _0x3fd117[_0x7317('0x1f')](_0x7317('0x20'),_0x35a6c0+'-'+_0x4d8416+'/'+_0x45ac06)[_0x7317('0x1c')](_0x302596);}return null;};}function patchUpdates(_0x2dce4b){return function(_0x5ce20d){try{jsonpatch['apply'](_0x5ce20d,_0x2dce4b,!![]);}catch(_0x476fb3){return BPromise[_0x7317('0x21')](_0x476fb3);}return _0x5ce20d[_0x7317('0x22')]();};}function saveUpdates(_0x1d9923,_0x3d29a0){return function(_0x1268b7){if(_0x1268b7){return _0x1268b7[_0x7317('0x23')](_0x1d9923)[_0x7317('0x24')](function(_0x2ce710){return _0x2ce710;});}return null;};}function removeEntity(_0x32591c,_0x1e13f1){return function(_0x51b982){if(_0x51b982){return _0x51b982[_0x7317('0x25')]()['then'](function(){var _0x9cb868=_0x51b982[_0x7317('0x26')]({'plain':!![]});var _0x29c7a7=[{'name':_0x7317('0x27'),'value':_0x7317('0x28'),'ignore':![]},{'name':_0x7317('0x29'),'value':_0x7317('0x2a'),'ignore':![]}];var _0x14341b=_(_0x29c7a7)['filter'](_0x7317('0x2b'))['map']('value')[_0x7317('0x2c')]();if(_[_0x7317('0x2d')](_0x14341b,_0x9cb868[_0x7317('0x2e')])){return;}var _0x18336e=_[_0x7317('0x2f')](_0x29c7a7,[_0x7317('0x2c'),_0x9cb868[_0x7317('0x2e')]])[_0x7317('0x30')];return db[_0x7317('0x31')][_0x7317('0x25')]({'where':{'type':_0x18336e,'resourceId':_0x9cb868['id']}})[_0x7317('0x24')](function(){return _0x51b982;});})[_0x7317('0x24')](function(){_0x32591c[_0x7317('0x1b')](0xcc)[_0x7317('0x32')]();});}};}function handleEntityNotFound(_0x5bd085,_0x20252d){return function(_0x259c7f){if(!_0x259c7f){_0x5bd085['sendStatus'](0x194);}return _0x259c7f;};}function handleError(_0x3ba89d,_0x3a6bc4){_0x3a6bc4=_0x3a6bc4||0x1f4;return function(_0x40dce4){logger[_0x7317('0x33')](_0x40dce4[_0x7317('0x34')]);if(_0x40dce4[_0x7317('0x30')]){delete _0x40dce4[_0x7317('0x30')];}_0x3ba89d[_0x7317('0x1b')](_0x3a6bc4)[_0x7317('0x35')](_0x40dce4);};}exports[_0x7317('0x36')]=function(_0x13e44a,_0x155996){var _0x25e37a={},_0x7c55d={},_0x122bb9={'count':0x0,'rows':[]};var _0x1b84a6=db[_0x7317('0x37')][_0x7317('0x38')];_0x7c55d[_0x7317('0x39')]=_[_0x7317('0x3a')](_0x1b84a6);_0x7c55d[_0x7317('0x3b')]=_[_0x7317('0x3a')](_0x13e44a[_0x7317('0x3b')]);_0x7c55d['filters']=_['intersection'](_0x7c55d['model'],_0x7c55d[_0x7317('0x3b')]);_0x25e37a['attributes']=_[_0x7317('0x3c')](_0x7c55d[_0x7317('0x39')],qs[_0x7317('0x3d')](_0x13e44a['query'][_0x7317('0x3d')]));_0x25e37a['attributes']=_0x25e37a[_0x7317('0x3e')][_0x7317('0x3f')]?_0x25e37a['attributes']:_0x7c55d[_0x7317('0x39')];if(!_0x13e44a[_0x7317('0x3b')][_0x7317('0x40')]('nolimit')){_0x25e37a['limit']=qs[_0x7317('0x41')](_0x13e44a['query'][_0x7317('0x41')]);_0x25e37a[_0x7317('0x1e')]=qs[_0x7317('0x1e')](_0x13e44a[_0x7317('0x3b')][_0x7317('0x1e')]);}_0x25e37a[_0x7317('0x42')]=qs['sort'](_0x13e44a[_0x7317('0x3b')][_0x7317('0x43')]);_0x25e37a[_0x7317('0x44')]=qs[_0x7317('0x45')](_[_0x7317('0x46')](_0x13e44a[_0x7317('0x3b')],_0x7c55d['filters']));if(_0x13e44a[_0x7317('0x3b')][_0x7317('0x47')]){_0x25e37a[_0x7317('0x44')]=_[_0x7317('0x48')](_0x25e37a[_0x7317('0x44')],{'$or':_[_0x7317('0x49')](_0x1b84a6,function(_0xae5da5){if(_0xae5da5[_0x7317('0x2e')][_0x7317('0x4a')]!==_0x7317('0x4b')){var _0x2dec15={};_0x2dec15[_0xae5da5[_0x7317('0x4c')]]={'$like':'%'+_0x13e44a[_0x7317('0x3b')][_0x7317('0x47')]+'%'};return _0x2dec15;}})});}_0x25e37a=_[_0x7317('0x48')]({},_0x25e37a,_0x13e44a[_0x7317('0x4d')]);var _0x5ca780={'where':_0x25e37a['where']};return db[_0x7317('0x37')][_0x7317('0x1d')](_0x5ca780)['then'](function(_0x5a4a1d){_0x122bb9[_0x7317('0x1d')]=_0x5a4a1d;if(_0x13e44a['query'][_0x7317('0x4e')]){_0x25e37a[_0x7317('0x4f')]=[{'all':!![]}];}return db[_0x7317('0x37')][_0x7317('0x50')](_0x25e37a);})[_0x7317('0x24')](function(_0x97c722){_0x122bb9[_0x7317('0x51')]=_0x97c722;return _0x122bb9;})[_0x7317('0x24')](respondWithFilteredResult(_0x155996,_0x25e37a))[_0x7317('0x52')](handleError(_0x155996,null));};exports[_0x7317('0x53')]=function(_0x366025,_0x5e6adf){var _0x2dc506={'raw':![],'where':{'id':_0x366025[_0x7317('0x54')]['id']}},_0xb26125={};_0xb26125[_0x7317('0x39')]=_[_0x7317('0x3a')](db[_0x7317('0x37')][_0x7317('0x38')]);_0xb26125[_0x7317('0x3b')]=_['keys'](_0x366025[_0x7317('0x3b')]);_0xb26125['filters']=_[_0x7317('0x3c')](_0xb26125[_0x7317('0x39')],_0xb26125[_0x7317('0x3b')]);_0x2dc506[_0x7317('0x3e')]=_[_0x7317('0x3c')](_0xb26125['model'],qs['fields'](_0x366025[_0x7317('0x3b')]['fields']));_0x2dc506['attributes']=_0x2dc506[_0x7317('0x3e')][_0x7317('0x3f')]?_0x2dc506[_0x7317('0x3e')]:_0xb26125['model'];if(_0x366025[_0x7317('0x3b')][_0x7317('0x4e')]){_0x2dc506[_0x7317('0x4f')]=[{'all':!![]}];}_0x2dc506=_[_0x7317('0x48')]({},_0x2dc506,_0x366025[_0x7317('0x4d')]);return db[_0x7317('0x37')]['find'](_0x2dc506)[_0x7317('0x24')](handleEntityNotFound(_0x5e6adf,null))[_0x7317('0x24')](respondWithResult(_0x5e6adf,null))[_0x7317('0x52')](handleError(_0x5e6adf,null));};exports[_0x7317('0x55')]=function(_0x57325d,_0x550f00){return db[_0x7317('0x37')][_0x7317('0x55')](_0x57325d[_0x7317('0x56')],{})['then'](function(_0xfe6df3){var _0x353c5b=_0x57325d[_0x7317('0x57')][_0x7317('0x26')]({'plain':!![]});if(!_0x353c5b)throw new Error(_0x7317('0x58'));if(_0x353c5b[_0x7317('0x59')]===_0x7317('0x57')){var _0x520c52=_0xfe6df3[_0x7317('0x26')]({'plain':!![]});var _0x5f0f60=[{'name':_0x7317('0x27'),'value':'inbound'},{'name':_0x7317('0x29'),'value':'outbound'}];var _0x2f749a=_[_0x7317('0x2f')](_0x5f0f60,['value',_0x520c52[_0x7317('0x2e')]])[_0x7317('0x30')];return db[_0x7317('0x5a')][_0x7317('0x2f')]({'where':{'name':_0x2f749a,'userProfileId':_0x353c5b['userProfileId']},'raw':!![]})['then'](function(_0x51bd7f){if(_0x51bd7f&&_0x51bd7f['autoAssociation']===0x0){return db[_0x7317('0x31')]['create']({'name':_0x520c52[_0x7317('0x30')],'resourceId':_0x520c52['id'],'type':_0x51bd7f[_0x7317('0x30')],'sectionId':_0x51bd7f['id']},{})[_0x7317('0x24')](function(){return _0xfe6df3;});}else{return _0xfe6df3;}})['catch'](function(_0x42d198){logger[_0x7317('0x33')](_0x7317('0x5b'),_0x42d198);throw _0x42d198;});}return _0xfe6df3;})[_0x7317('0x24')](respondWithResult(_0x550f00,0xc9))[_0x7317('0x52')](handleError(_0x550f00,null));};exports[_0x7317('0x5c')]=function(_0x477eb4,_0x209f40){var _0x457e90={'raw':![],'where':{'id':_0x477eb4[_0x7317('0x54')]['id']}},_0x40a46d={};_0x40a46d[_0x7317('0x39')]=_['keys'](db[_0x7317('0x37')][_0x7317('0x38')]);_0x457e90[_0x7317('0x3e')]=_[_0x7317('0x3c')](_0x40a46d[_0x7317('0x39')],qs[_0x7317('0x3d')](_0x477eb4[_0x7317('0x3b')]['fields']));_0x457e90[_0x7317('0x3e')]=_0x457e90[_0x7317('0x3e')][_0x7317('0x3f')]?_0x457e90[_0x7317('0x3e')]:_0x40a46d['model'];if(_0x477eb4[_0x7317('0x3b')][_0x7317('0x4e')]){_0x457e90['include']=[{'all':!![]}];}_0x457e90=_[_0x7317('0x48')]({},_0x457e90,_0x477eb4[_0x7317('0x4d')]);return db[_0x7317('0x37')][_0x7317('0x2f')](_0x457e90)[_0x7317('0x24')](handleEntityNotFound(_0x209f40,null))[_0x7317('0x24')](function(_0x2d0e22){if(_0x2d0e22){var _0x52513d=_0x2d0e22[_0x7317('0x26')]({'plain':!![]});_0x52513d=qs[_0x7317('0x5d')](_0x52513d,['id','createdAt',_0x7317('0x5e')]);_0x477eb4[_0x7317('0x56')]=_['omit'](_0x477eb4[_0x7317('0x56')],['id',_0x7317('0x5f'),_0x7317('0x5e')]);return db[_0x7317('0x37')][_0x7317('0x55')](_['merge'](_0x52513d,_0x477eb4[_0x7317('0x56')]),{'include':_0x477eb4['query'][_0x7317('0x4e')]?[{'all':!![]}]:undefined})[_0x7317('0x24')](function(_0x5dcb34){var _0x1fdf46=_0x477eb4[_0x7317('0x57')]['get']({'plain':!![]});if(!_0x1fdf46)throw new Error(_0x7317('0x58'));if(_0x1fdf46[_0x7317('0x59')]===_0x7317('0x57')){var _0x38ccf6=_0x5dcb34[_0x7317('0x26')]({'plain':!![]});var _0x2daa13=[{'name':_0x7317('0x27'),'value':_0x7317('0x28')},{'name':'QueueCampaigns','value':_0x7317('0x2a')}];var _0x4ec522=_[_0x7317('0x2f')](_0x2daa13,[_0x7317('0x2c'),_0x38ccf6[_0x7317('0x2e')]])[_0x7317('0x30')];return db[_0x7317('0x5a')][_0x7317('0x2f')]({'where':{'name':_0x4ec522,'userProfileId':_0x1fdf46[_0x7317('0x60')]},'raw':!![]})['then'](function(_0x2f15a1){if(_0x2f15a1&&_0x2f15a1[_0x7317('0x61')]===0x0){return db[_0x7317('0x31')][_0x7317('0x55')]({'name':_0x38ccf6['name'],'resourceId':_0x38ccf6['id'],'type':_0x2f15a1[_0x7317('0x30')],'sectionId':_0x2f15a1['id']},{})[_0x7317('0x24')](function(){return _0x5dcb34;});}else{return _0x5dcb34;}})[_0x7317('0x52')](function(_0x3f682c){logger[_0x7317('0x33')](_0x7317('0x5b'),_0x3f682c);throw _0x3f682c;});}return _0x5dcb34;});}})['then'](respondWithResult(_0x209f40,0xc9))[_0x7317('0x52')](handleError(_0x209f40,null));};exports[_0x7317('0x23')]=function(_0x2d2234,_0x5939c0){if(_0x2d2234['body']['id']){delete _0x2d2234['body']['id'];}return db[_0x7317('0x37')][_0x7317('0x2f')]({'where':{'id':_0x2d2234[_0x7317('0x54')]['id']}})['then'](handleEntityNotFound(_0x5939c0,null))['then'](saveUpdates(_0x2d2234[_0x7317('0x56')],null))['then'](respondWithResult(_0x5939c0,null))[_0x7317('0x52')](handleError(_0x5939c0,null));};exports[_0x7317('0x25')]=function(_0x48192c,_0x475698){return db['VoiceQueue'][_0x7317('0x2f')]({'where':{'id':_0x48192c[_0x7317('0x54')]['id']}})[_0x7317('0x24')](handleEntityNotFound(_0x475698,null))['then'](removeEntity(_0x475698,null))[_0x7317('0x52')](handleError(_0x475698,null));};exports[_0x7317('0x62')]=function(_0x597ed1,_0x139209,_0x555483){var _0x8487db={'raw':![],'where':{}};var _0x43d101={};var _0x432674={'count':0x0,'rows':[]};return db[_0x7317('0x37')][_0x7317('0x63')]({'where':{'id':_0x597ed1['params']['id']}})[_0x7317('0x24')](handleEntityNotFound(_0x139209,null))[_0x7317('0x24')](function(_0x144bf1){if(_0x144bf1){_0x43d101[_0x7317('0x39')]=_[_0x7317('0x3a')](db[_0x7317('0x64')][_0x7317('0x38')]);_0x43d101[_0x7317('0x3b')]=_['keys'](_0x597ed1['query']);_0x43d101[_0x7317('0x45')]=_['intersection'](_0x43d101[_0x7317('0x39')],_0x43d101[_0x7317('0x3b')]);_0x8487db[_0x7317('0x3e')]=_[_0x7317('0x3c')](_0x43d101[_0x7317('0x39')],qs[_0x7317('0x3d')](_0x597ed1['query'][_0x7317('0x3d')]));_0x8487db['attributes']=_0x8487db[_0x7317('0x3e')][_0x7317('0x3f')]?_0x8487db['attributes']:_0x43d101[_0x7317('0x39')];if(!_0x597ed1['query'][_0x7317('0x40')](_0x7317('0x65'))){_0x8487db[_0x7317('0x41')]=qs['limit'](_0x597ed1['query']['limit']);_0x8487db['offset']=qs[_0x7317('0x1e')](_0x597ed1[_0x7317('0x3b')][_0x7317('0x1e')]);}_0x8487db[_0x7317('0x42')]=qs['sort'](_0x597ed1[_0x7317('0x3b')][_0x7317('0x43')]);_0x8487db[_0x7317('0x44')]=qs[_0x7317('0x45')](_[_0x7317('0x46')](_0x597ed1[_0x7317('0x3b')],_0x43d101[_0x7317('0x45')]));_0x8487db[_0x7317('0x44')][_0x7317('0x66')]=_0x144bf1['id'];if(_0x597ed1[_0x7317('0x3b')]['filter']){_0x8487db[_0x7317('0x44')]=_['merge'](_0x8487db[_0x7317('0x44')],{'$or':_[_0x7317('0x49')](_0x8487db[_0x7317('0x3e')],function(_0x59e1ea){var _0x2c7553={};_0x2c7553[_0x59e1ea]={'$like':'%'+_0x597ed1[_0x7317('0x3b')][_0x7317('0x47')]+'%'};return _0x2c7553;})});}_0x8487db=_['merge']({},_0x8487db,_0x597ed1[_0x7317('0x4d')]);return db['CmHopper'][_0x7317('0x1d')]({'where':_0x8487db[_0x7317('0x44')]})[_0x7317('0x24')](function(_0x2cd753){_0x432674[_0x7317('0x1d')]=_0x2cd753;if(_0x597ed1[_0x7317('0x3b')][_0x7317('0x4e')]){_0x8487db[_0x7317('0x4f')]=[{'all':!![]}];}return db[_0x7317('0x64')][_0x7317('0x50')](_0x8487db);})[_0x7317('0x24')](function(_0x5cf01b){_0x432674[_0x7317('0x51')]=_0x5cf01b;return _0x432674;});}})['then'](respondWithFilteredResult(_0x139209,_0x8487db))[_0x7317('0x52')](handleError(_0x139209,null));};exports[_0x7317('0x67')]=function(_0x2ed760,_0x44ee30,_0x441ff4){var _0x599063={'raw':!![],'where':{}};var _0x40bedd={};var _0x54637e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x7317('0x63')]({'where':{'id':_0x2ed760[_0x7317('0x54')]['id']}})['then'](handleEntityNotFound(_0x44ee30,null))[_0x7317('0x24')](function(_0x25c5d7){if(_0x25c5d7){_0x40bedd[_0x7317('0x39')]=_[_0x7317('0x3a')](db[_0x7317('0x68')][_0x7317('0x38')]);_0x40bedd[_0x7317('0x3b')]=_[_0x7317('0x3a')](_0x2ed760['query']);_0x40bedd[_0x7317('0x45')]=_[_0x7317('0x3c')](_0x40bedd['model'],_0x40bedd['query']);_0x599063[_0x7317('0x3e')]=_[_0x7317('0x3c')](_0x40bedd[_0x7317('0x39')],qs[_0x7317('0x3d')](_0x2ed760[_0x7317('0x3b')][_0x7317('0x3d')]));_0x599063[_0x7317('0x3e')]=_0x599063[_0x7317('0x3e')]['length']?_0x599063['attributes']:_0x40bedd[_0x7317('0x39')];if(!_0x2ed760[_0x7317('0x3b')]['hasOwnProperty'](_0x7317('0x65'))){_0x599063[_0x7317('0x41')]=qs[_0x7317('0x41')](_0x2ed760['query'][_0x7317('0x41')]);_0x599063[_0x7317('0x1e')]=qs[_0x7317('0x1e')](_0x2ed760[_0x7317('0x3b')][_0x7317('0x1e')]);}_0x599063[_0x7317('0x42')]=qs[_0x7317('0x43')](_0x2ed760[_0x7317('0x3b')][_0x7317('0x43')]);_0x599063['where']=qs['filters'](_['pick'](_0x2ed760[_0x7317('0x3b')],_0x40bedd['filters']));_0x599063['where'][_0x7317('0x66')]=_0x25c5d7['id'];if(_0x2ed760[_0x7317('0x3b')][_0x7317('0x47')]){_0x599063['where']=_[_0x7317('0x48')](_0x599063[_0x7317('0x44')],{'$or':_[_0x7317('0x49')](_0x599063[_0x7317('0x3e')],function(_0x38a0b9){var _0x4ee46e={};_0x4ee46e[_0x38a0b9]={'$like':'%'+_0x2ed760[_0x7317('0x3b')][_0x7317('0x47')]+'%'};return _0x4ee46e;})});}_0x599063=_[_0x7317('0x48')]({},_0x599063,_0x2ed760['options']);return db[_0x7317('0x68')]['count']({'where':_0x599063[_0x7317('0x44')]})[_0x7317('0x24')](function(_0x4b66e5){_0x54637e[_0x7317('0x1d')]=_0x4b66e5;if(_0x2ed760[_0x7317('0x3b')][_0x7317('0x4e')]){_0x599063['include']=[{'all':!![]}];}return db[_0x7317('0x68')][_0x7317('0x50')](_0x599063);})[_0x7317('0x24')](function(_0x461841){_0x54637e[_0x7317('0x51')]=_0x461841;return _0x54637e;});}})[_0x7317('0x24')](respondWithFilteredResult(_0x44ee30,_0x599063))[_0x7317('0x52')](handleError(_0x44ee30,null));};exports[_0x7317('0x69')]=function(_0x2fa08e,_0x167fb6,_0x4df0cf){var _0x175a35={'raw':!![],'where':{}};var _0x488632={};var _0x58b052={'count':0x0,'rows':[]};return db[_0x7317('0x37')][_0x7317('0x63')]({'where':{'id':_0x2fa08e[_0x7317('0x54')]['id']}})[_0x7317('0x24')](handleEntityNotFound(_0x167fb6,null))['then'](function(_0x5e31db){if(_0x5e31db){_0x488632[_0x7317('0x39')]=_[_0x7317('0x3a')](db['CmHopperFinal'][_0x7317('0x38')]);_0x488632[_0x7317('0x3b')]=_[_0x7317('0x3a')](_0x2fa08e[_0x7317('0x3b')]);_0x488632[_0x7317('0x45')]=_[_0x7317('0x3c')](_0x488632['model'],_0x488632[_0x7317('0x3b')]);_0x175a35[_0x7317('0x3e')]=_[_0x7317('0x3c')](_0x488632['model'],qs[_0x7317('0x3d')](_0x2fa08e[_0x7317('0x3b')][_0x7317('0x3d')]));_0x175a35[_0x7317('0x3e')]=_0x175a35['attributes'][_0x7317('0x3f')]?_0x175a35[_0x7317('0x3e')]:_0x488632[_0x7317('0x39')];if(!_0x2fa08e[_0x7317('0x3b')]['hasOwnProperty'](_0x7317('0x65'))){_0x175a35[_0x7317('0x41')]=qs[_0x7317('0x41')](_0x2fa08e[_0x7317('0x3b')]['limit']);_0x175a35[_0x7317('0x1e')]=qs[_0x7317('0x1e')](_0x2fa08e[_0x7317('0x3b')][_0x7317('0x1e')]);}_0x175a35['order']=qs[_0x7317('0x43')](_0x2fa08e[_0x7317('0x3b')][_0x7317('0x43')]);_0x175a35[_0x7317('0x44')]=qs[_0x7317('0x45')](_['pick'](_0x2fa08e[_0x7317('0x3b')],_0x488632[_0x7317('0x45')]));_0x175a35['where'][_0x7317('0x66')]=_0x5e31db['id'];if(_0x2fa08e[_0x7317('0x3b')]['filter']){_0x175a35['where']=_[_0x7317('0x48')](_0x175a35[_0x7317('0x44')],{'$or':_[_0x7317('0x49')](_0x175a35[_0x7317('0x3e')],function(_0x39a79e){var _0x170380={};_0x170380[_0x39a79e]={'$like':'%'+_0x2fa08e['query'][_0x7317('0x47')]+'%'};return _0x170380;})});}_0x175a35=_[_0x7317('0x48')]({},_0x175a35,_0x2fa08e[_0x7317('0x4d')]);return db[_0x7317('0x6a')][_0x7317('0x1d')]({'where':_0x175a35['where']})[_0x7317('0x24')](function(_0x56dca1){_0x58b052[_0x7317('0x1d')]=_0x56dca1;if(_0x2fa08e[_0x7317('0x3b')][_0x7317('0x4e')]){_0x175a35[_0x7317('0x4f')]=[{'all':!![]}];}return db[_0x7317('0x6a')]['findAll'](_0x175a35);})[_0x7317('0x24')](function(_0x153a24){_0x58b052['rows']=_0x153a24;return _0x58b052;});}})[_0x7317('0x24')](respondWithFilteredResult(_0x167fb6,_0x175a35))[_0x7317('0x52')](handleError(_0x167fb6,null));};exports[_0x7317('0x6b')]=function(_0x267546,_0x11a6e3,_0xdae176){var _0x154526={'raw':!![],'where':{}};var _0x48c48e={};var _0x195d8e={'count':0x0,'rows':[]};return db[_0x7317('0x37')][_0x7317('0x63')]({'where':{'id':_0x267546[_0x7317('0x54')]['id']}})[_0x7317('0x24')](handleEntityNotFound(_0x11a6e3,null))[_0x7317('0x24')](function(_0x27a2ea){if(_0x27a2ea){_0x48c48e['model']=_['keys'](db[_0x7317('0x6c')][_0x7317('0x38')]);_0x48c48e[_0x7317('0x3b')]=_['keys'](_0x267546[_0x7317('0x3b')]);_0x48c48e[_0x7317('0x45')]=_[_0x7317('0x3c')](_0x48c48e[_0x7317('0x39')],_0x48c48e[_0x7317('0x3b')]);_0x154526['attributes']=_[_0x7317('0x3c')](_0x48c48e[_0x7317('0x39')],qs['fields'](_0x267546[_0x7317('0x3b')]['fields']));_0x154526[_0x7317('0x3e')]=_0x154526[_0x7317('0x3e')][_0x7317('0x3f')]?_0x154526['attributes']:_0x48c48e[_0x7317('0x39')];if(!_0x267546[_0x7317('0x3b')][_0x7317('0x40')](_0x7317('0x65'))){_0x154526[_0x7317('0x41')]=qs['limit'](_0x267546[_0x7317('0x3b')]['limit']);_0x154526[_0x7317('0x1e')]=qs[_0x7317('0x1e')](_0x267546['query'][_0x7317('0x1e')]);}_0x154526[_0x7317('0x42')]=qs[_0x7317('0x43')](_0x267546[_0x7317('0x3b')][_0x7317('0x43')]);_0x154526['where']=qs[_0x7317('0x45')](_[_0x7317('0x46')](_0x267546[_0x7317('0x3b')],_0x48c48e['filters']));_0x154526[_0x7317('0x44')][_0x7317('0x66')]=_0x27a2ea['id'];if(_0x267546[_0x7317('0x3b')][_0x7317('0x47')]){_0x154526['where']=_[_0x7317('0x48')](_0x154526['where'],{'$or':_[_0x7317('0x49')](_0x154526[_0x7317('0x3e')],function(_0x55aaa1){var _0x38897d={};_0x38897d[_0x55aaa1]={'$like':'%'+_0x267546['query'][_0x7317('0x47')]+'%'};return _0x38897d;})});}_0x154526=_['merge']({},_0x154526,_0x267546['options']);return db[_0x7317('0x6c')][_0x7317('0x1d')]({'where':_0x154526['where']})['then'](function(_0x2f4026){_0x195d8e[_0x7317('0x1d')]=_0x2f4026;if(_0x267546[_0x7317('0x3b')][_0x7317('0x4e')]){_0x154526[_0x7317('0x4f')]=[{'all':!![]}];}return db[_0x7317('0x6c')]['findAll'](_0x154526);})[_0x7317('0x24')](function(_0x14d48f){_0x195d8e['rows']=_0x14d48f;return _0x195d8e;});}})[_0x7317('0x24')](respondWithFilteredResult(_0x11a6e3,_0x154526))['catch'](handleError(_0x11a6e3,null));};exports[_0x7317('0x6d')]=function(_0x5275b2,_0x2a8fd3,_0x1e6dee){var _0x165958={};var _0x328eb9={};var _0x332f4b;var _0x42c6a1;return db[_0x7317('0x37')][_0x7317('0x63')]({'where':{'id':_0x5275b2['params']['id']}})[_0x7317('0x24')](handleEntityNotFound(_0x2a8fd3,null))[_0x7317('0x24')](function(_0x2bc129){if(_0x2bc129){_0x332f4b=_0x2bc129;_0x328eb9[_0x7317('0x39')]=_[_0x7317('0x3a')](db[_0x7317('0x6e')][_0x7317('0x38')]);_0x328eb9[_0x7317('0x3b')]=_[_0x7317('0x3a')](_0x5275b2[_0x7317('0x3b')]);_0x328eb9[_0x7317('0x45')]=_[_0x7317('0x3c')](_0x328eb9[_0x7317('0x39')],_0x328eb9[_0x7317('0x3b')]);_0x165958['attributes']=_[_0x7317('0x3c')](_0x328eb9[_0x7317('0x39')],qs[_0x7317('0x3d')](_0x5275b2[_0x7317('0x3b')][_0x7317('0x3d')]));_0x165958[_0x7317('0x3e')]=_0x165958[_0x7317('0x3e')][_0x7317('0x3f')]?_0x165958[_0x7317('0x3e')]:_0x328eb9[_0x7317('0x39')];_0x165958['order']=qs[_0x7317('0x43')](_0x5275b2[_0x7317('0x3b')][_0x7317('0x43')]);_0x165958[_0x7317('0x44')]=qs[_0x7317('0x45')](_[_0x7317('0x46')](_0x5275b2['query'],_0x328eb9[_0x7317('0x45')]));if(_0x5275b2[_0x7317('0x3b')][_0x7317('0x47')]){_0x165958[_0x7317('0x44')]=_[_0x7317('0x48')](_0x165958[_0x7317('0x44')],{'$or':_[_0x7317('0x49')](_0x165958[_0x7317('0x3e')],function(_0x4d631e){var _0x89d2e1={};_0x89d2e1[_0x4d631e]={'$like':'%'+_0x5275b2[_0x7317('0x3b')][_0x7317('0x47')]+'%'};return _0x89d2e1;})});}_0x165958=_[_0x7317('0x48')]({},_0x165958,_0x5275b2[_0x7317('0x4d')]);return _0x332f4b[_0x7317('0x6d')](_0x165958);}})[_0x7317('0x24')](function(_0x1f5f5e){if(_0x1f5f5e){_0x42c6a1=_0x1f5f5e['length'];if(!_0x5275b2['query']['hasOwnProperty'](_0x7317('0x65'))){_0x165958[_0x7317('0x41')]=qs[_0x7317('0x41')](_0x5275b2[_0x7317('0x3b')]['limit']);_0x165958['offset']=qs['offset'](_0x5275b2[_0x7317('0x3b')]['offset']);}return _0x332f4b[_0x7317('0x6d')](_0x165958);}})[_0x7317('0x24')](function(_0x17641f){if(_0x17641f){return _0x17641f?{'count':_0x42c6a1,'rows':_0x17641f}:null;}})[_0x7317('0x24')](respondWithResult(_0x2a8fd3,null))[_0x7317('0x52')](handleError(_0x2a8fd3,null));};exports['addTeams']=function(_0x289c15,_0x22c1a5,_0x2f9cc6){var _0x14d1a6=[];var _0x491250;return db[_0x7317('0x6e')]['findAll']({'where':{'id':_0x289c15[_0x7317('0x56')][_0x7317('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x7317('0x70')],'as':_0x7317('0x71'),'attributes':['id'],'raw':!![]}]})[_0x7317('0x24')](function(_0x56cdae){if(_0x56cdae){for(var _0x23cba8=0x0;_0x23cba8<_0x56cdae[_0x7317('0x3f')];_0x23cba8+=0x1){for(var _0x301c59=0x0;_0x301c59<_0x56cdae[_0x23cba8][_0x7317('0x71')][_0x7317('0x3f')];_0x301c59+=0x1){_0x14d1a6=_['union'](_0x14d1a6,[_0x56cdae[_0x23cba8]['Agents'][_0x301c59]['id']]);}}return _0x14d1a6;}})[_0x7317('0x24')](function(_0x38e30f){if(_0x38e30f){return db[_0x7317('0x37')][_0x7317('0x2f')]({'where':{'id':_0x289c15['params']['id']}});}})[_0x7317('0x24')](function(_0x136e3d){if(_0x136e3d){_0x491250=_0x136e3d;return _0x491250[_0x7317('0x72')](_0x14d1a6,{'penalty':_0x289c15[_0x7317('0x56')][_0x7317('0x73')]});}})[_0x7317('0x24')](function(_0x574b1f){if(_0x574b1f){return _0x491250[_0x7317('0x74')](_0x289c15['body'][_0x7317('0x6f')]);}})[_0x7317('0x24')](handleEntityNotFound(_0x22c1a5,null))[_0x7317('0x24')](respondWithStatusCode(_0x22c1a5,null))[_0x7317('0x52')](handleError(_0x22c1a5,null));};exports['removeTeams']=function(_0x16c4f5,_0x452407,_0x35ff28){var _0x28c51e=[];var _0xe9a10a;return db['Team'][_0x7317('0x50')]({'where':{'id':_0x16c4f5['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7317('0x24')](function(_0x2f37fb){if(_0x2f37fb){for(var _0x4ae5b0=0x0;_0x4ae5b0<_0x2f37fb[_0x7317('0x3f')];_0x4ae5b0+=0x1){for(var _0x270fc5=0x0;_0x270fc5<_0x2f37fb[_0x4ae5b0]['Agents'][_0x7317('0x3f')];_0x270fc5+=0x1){_0x28c51e=_[_0x7317('0x75')](_0x28c51e,[_0x2f37fb[_0x4ae5b0]['Agents'][_0x270fc5]['id']]);}}return _0x28c51e;}})[_0x7317('0x24')](function(_0x23d450){if(_0x23d450){return db[_0x7317('0x37')][_0x7317('0x2f')]({'where':{'id':_0x16c4f5[_0x7317('0x54')]['id']}});}})[_0x7317('0x24')](function(_0x34150f){if(_0x34150f){_0xe9a10a=_0x34150f;return _0xe9a10a['removeAgents'](_0x28c51e);}})['then'](function(_0x24d07c){if(_0xe9a10a){return _0xe9a10a[_0x7317('0x76')](_0x16c4f5[_0x7317('0x3b')][_0x7317('0x6f')]);}})[_0x7317('0x24')](handleEntityNotFound(_0x452407,null))[_0x7317('0x24')](respondWithStatusCode(_0x452407,null))[_0x7317('0x52')](handleError(_0x452407,null));};exports[_0x7317('0x72')]=function(_0x5c0927,_0x1ff619,_0x7be2b8){var _0x177481,_0x3dbb32;return db['VoiceQueue'][_0x7317('0x2f')]({'where':{'id':_0x5c0927['params']['id']}})[_0x7317('0x24')](handleEntityNotFound(_0x1ff619,null))[_0x7317('0x24')](function(_0x1a5d21){if(_0x1a5d21){_0x3dbb32=_0x1a5d21;return _0x1a5d21['addAgents'](_0x5c0927[_0x7317('0x56')]['ids'],_[_0x7317('0x5d')](_0x5c0927['body'],[_0x7317('0x6f'),'id'])||{})[_0x7317('0x77')](function(_0x56cef3){for(var _0x3ec2aa=0x0;_0x3ec2aa<_0x5c0927[_0x7317('0x56')][_0x7317('0x6f')][_0x7317('0x3f')];_0x3ec2aa+=0x1){socket[_0x7317('0x78')](_0x7317('0x79'),{'UserId':_0x5c0927['body'][_0x7317('0x6f')][_0x3ec2aa],'VoiceQueueId':_0x5c0927[_0x7317('0x54')]['id']});}return _0x56cef3;});}})[_0x7317('0x24')](function(_0x33ecef){_0x177481=_0x33ecef||[];if(_0x3dbb32){return db[_0x7317('0x70')][_0x7317('0x50')]({'where':{'id':_0x5c0927[_0x7317('0x56')][_0x7317('0x6f')]},'attributes':['id',_0x7317('0x30'),'loginInPause',_0x7317('0x7a'),_0x7317('0x7b')],'raw':!![]});}})['then'](function(_0x24b5a1){if(_0x24b5a1&&_0x24b5a1[_0x7317('0x3f')]){var _0x1707a7=[];for(var _0x1aeb36=0x0;_0x1aeb36<_0x24b5a1[_0x7317('0x3f')];_0x1aeb36++){_0x1707a7[_0x7317('0x7c')](db[_0x7317('0x7d')][_0x7317('0x7e')]({'membername':_0x24b5a1[_0x1aeb36][_0x7317('0x30')],'UserId':_0x24b5a1[_0x1aeb36]['id'],'queue_name':_0x3dbb32[_0x7317('0x30')],'VoiceQueueId':_0x3dbb32['id'],'interface':_['isNil'](_0x24b5a1[_0x1aeb36]['interface'])?util[_0x7317('0x7f')]('SIP/%s',_0x24b5a1[_0x1aeb36][_0x7317('0x30')]):_0x24b5a1[_0x1aeb36][_0x7317('0x7b')],'paused':_0x24b5a1[_0x1aeb36][_0x7317('0x7a')]||![],'penalty':_0x5c0927[_0x7317('0x56')][_0x7317('0x73')]||0x0}));}return BPromise[_0x7317('0x80')](_0x1707a7);}})[_0x7317('0x24')](function(_0x45cf15){return _0x177481;})[_0x7317('0x24')](respondWithResult(_0x1ff619,null))[_0x7317('0x52')](handleError(_0x1ff619,null));};exports[_0x7317('0x81')]=function(_0x3f705c,_0x282af0,_0x1618a5){var _0x28f76b;return db[_0x7317('0x37')][_0x7317('0x2f')]({'where':{'id':_0x3f705c['params']['id']}})['then'](handleEntityNotFound(_0x282af0,null))[_0x7317('0x24')](function(_0x2186b2){if(_0x2186b2){return _0x2186b2['removeAgents'](_0x3f705c['query'][_0x7317('0x6f')])[_0x7317('0x24')](function(_0x243b94){if(_[_0x7317('0x82')](_0x3f705c[_0x7317('0x3b')]['ids'])){for(var _0x320b5c=0x0;_0x320b5c<_0x3f705c['query'][_0x7317('0x6f')][_0x7317('0x3f')];_0x320b5c+=0x1){socket[_0x7317('0x78')](_0x7317('0x83'),{'UserId':_0x3f705c[_0x7317('0x3b')][_0x7317('0x6f')][_0x320b5c],'VoiceQueueId':_0x3f705c[_0x7317('0x54')]['id']});}}else{socket[_0x7317('0x78')](_0x7317('0x83'),{'UserId':_0x3f705c[_0x7317('0x3b')][_0x7317('0x6f')],'VoiceQueueId':_0x3f705c[_0x7317('0x54')]['id']});}});}})[_0x7317('0x24')](function(_0x4d28a9){if(_0x3f705c['query'][_0x7317('0x84')]){_0x28f76b=_0x4d28a9;return db[_0x7317('0x7d')]['destroy']({'where':{'VoiceQueueId':_0x3f705c[_0x7317('0x54')]['id'],'UserId':_0x3f705c[_0x7317('0x3b')]['ids']}})[_0x7317('0x24')](function(){return _0x28f76b;});}})['then'](respondWithStatusCode(_0x282af0,null))[_0x7317('0x52')](handleError(_0x282af0,null));};exports[_0x7317('0x85')]=function(_0x5df21c,_0x10fe84,_0x1dd627){var _0x131e72={};var _0x3b21a2={};var _0x3a4580;var _0x27640a;return db[_0x7317('0x37')][_0x7317('0x63')]({'where':{'id':_0x5df21c[_0x7317('0x54')]['id']}})['then'](handleEntityNotFound(_0x10fe84,null))[_0x7317('0x24')](function(_0x4a90fb){if(_0x4a90fb){_0x3a4580=_0x4a90fb;_0x3b21a2[_0x7317('0x39')]=_['keys'](db[_0x7317('0x70')][_0x7317('0x38')]);_0x3b21a2[_0x7317('0x3b')]=_[_0x7317('0x3a')](_0x5df21c[_0x7317('0x3b')]);_0x3b21a2['filters']=_[_0x7317('0x3c')](_0x3b21a2[_0x7317('0x39')],_0x3b21a2[_0x7317('0x3b')]);_0x131e72[_0x7317('0x3e')]=_['intersection'](_0x3b21a2[_0x7317('0x39')],qs['fields'](_0x5df21c[_0x7317('0x3b')][_0x7317('0x3d')]));_0x131e72[_0x7317('0x3e')]=_0x131e72[_0x7317('0x3e')][_0x7317('0x3f')]?_0x131e72[_0x7317('0x3e')]:_0x3b21a2['model'];_0x131e72[_0x7317('0x42')]=qs['sort'](_0x5df21c[_0x7317('0x3b')][_0x7317('0x43')]);_0x131e72[_0x7317('0x44')]=qs['filters'](_[_0x7317('0x46')](_0x5df21c['query'],_0x3b21a2[_0x7317('0x45')]));if(_0x5df21c['query'][_0x7317('0x47')]){_0x131e72[_0x7317('0x44')]=_[_0x7317('0x48')](_0x131e72[_0x7317('0x44')],{'$or':_[_0x7317('0x49')](_0x131e72[_0x7317('0x3e')],function(_0x38472a){var _0x23c889={};_0x23c889[_0x38472a]={'$like':'%'+_0x5df21c[_0x7317('0x3b')][_0x7317('0x47')]+'%'};return _0x23c889;})});}_0x131e72=_[_0x7317('0x48')]({},_0x131e72,_0x5df21c[_0x7317('0x4d')]);return _0x3a4580['getAgents'](_0x131e72);}})['then'](function(_0x48cfaa){if(_0x48cfaa){_0x27640a=_0x48cfaa[_0x7317('0x3f')];if(!_0x5df21c[_0x7317('0x3b')][_0x7317('0x40')]('nolimit')){_0x131e72[_0x7317('0x41')]=qs[_0x7317('0x41')](_0x5df21c[_0x7317('0x3b')][_0x7317('0x41')]);_0x131e72[_0x7317('0x1e')]=qs['offset'](_0x5df21c[_0x7317('0x3b')]['offset']);}return _0x3a4580['getAgents'](_0x131e72);}})['then'](function(_0x19ebaf){if(_0x19ebaf){return _0x19ebaf?{'count':_0x27640a,'rows':_0x19ebaf}:null;}})[_0x7317('0x24')](respondWithResult(_0x10fe84,null))[_0x7317('0x52')](handleError(_0x10fe84,null));};exports['getMembers']=function(_0x1a7f3b,_0x3b91c9,_0x361874){var _0x25ba75={};var _0x3aa9e7={};var _0x33b0c7;var _0x42f251;return db['VoiceQueue'][_0x7317('0x63')]({'where':{'id':_0x1a7f3b['params']['id']}})[_0x7317('0x24')](handleEntityNotFound(_0x3b91c9,null))[_0x7317('0x24')](function(_0x588492){if(_0x588492){_0x33b0c7=_0x588492;_0x3aa9e7[_0x7317('0x39')]=_[_0x7317('0x3a')](db[_0x7317('0x7d')][_0x7317('0x38')]);_0x3aa9e7['query']=_[_0x7317('0x3a')](_0x1a7f3b[_0x7317('0x3b')]);_0x3aa9e7[_0x7317('0x45')]=_['intersection'](_0x3aa9e7[_0x7317('0x39')],_0x3aa9e7[_0x7317('0x3b')]);_0x25ba75['attributes']=_[_0x7317('0x3c')](_0x3aa9e7[_0x7317('0x39')],qs['fields'](_0x1a7f3b[_0x7317('0x3b')][_0x7317('0x3d')]));_0x25ba75[_0x7317('0x3e')]=_0x25ba75[_0x7317('0x3e')][_0x7317('0x3f')]?_0x25ba75[_0x7317('0x3e')]:_0x3aa9e7[_0x7317('0x39')];_0x25ba75[_0x7317('0x42')]=qs[_0x7317('0x43')](_0x1a7f3b[_0x7317('0x3b')][_0x7317('0x43')]);_0x25ba75[_0x7317('0x44')]=qs[_0x7317('0x45')](_[_0x7317('0x46')](_0x1a7f3b[_0x7317('0x3b')],_0x3aa9e7[_0x7317('0x45')]));if(_0x1a7f3b[_0x7317('0x3b')][_0x7317('0x47')]){_0x25ba75['where']=_[_0x7317('0x48')](_0x25ba75[_0x7317('0x44')],{'$or':_[_0x7317('0x49')](_0x25ba75[_0x7317('0x3e')],function(_0x39bdd6){var _0xd4419b={};_0xd4419b[_0x39bdd6]={'$like':'%'+_0x1a7f3b[_0x7317('0x3b')][_0x7317('0x47')]+'%'};return _0xd4419b;})});}_0x25ba75=_[_0x7317('0x48')]({},_0x25ba75,_0x1a7f3b[_0x7317('0x4d')]);return _0x33b0c7['getMembers'](_0x25ba75);}})[_0x7317('0x24')](function(_0x257b0e){if(_0x257b0e){_0x42f251=_0x257b0e[_0x7317('0x3f')];if(!_0x1a7f3b[_0x7317('0x3b')]['hasOwnProperty'](_0x7317('0x65'))){_0x25ba75[_0x7317('0x41')]=qs[_0x7317('0x41')](_0x1a7f3b[_0x7317('0x3b')][_0x7317('0x41')]);_0x25ba75['offset']=qs[_0x7317('0x1e')](_0x1a7f3b[_0x7317('0x3b')][_0x7317('0x1e')]);}return _0x33b0c7[_0x7317('0x86')](_0x25ba75);}})[_0x7317('0x24')](function(_0x5957d8){return _0x5957d8?{'count':_0x42f251,'rows':_0x5957d8}:null;})[_0x7317('0x24')](respondWithResult(_0x3b91c9,null))[_0x7317('0x52')](handleError(_0x3b91c9,null));};exports[_0x7317('0x87')]=function(_0x433022,_0x16e267,_0x290649){var _0x5a2568={};var _0xc163b0={};var _0x3e4ee0;var _0x2deef7;return db[_0x7317('0x37')][_0x7317('0x63')]({'where':{'id':_0x433022['params']['id']}})[_0x7317('0x24')](handleEntityNotFound(_0x16e267,null))[_0x7317('0x24')](function(_0x30ae18){if(_0x30ae18){_0x3e4ee0=_0x30ae18;_0xc163b0[_0x7317('0x39')]=_[_0x7317('0x3a')](db[_0x7317('0x88')]['rawAttributes']);_0xc163b0[_0x7317('0x3b')]=_[_0x7317('0x3a')](_0x433022[_0x7317('0x3b')]);_0xc163b0[_0x7317('0x45')]=_['intersection'](_0xc163b0[_0x7317('0x39')],_0xc163b0['query']);_0x5a2568[_0x7317('0x3e')]=_[_0x7317('0x3c')](_0xc163b0[_0x7317('0x39')],qs['fields'](_0x433022['query'][_0x7317('0x3d')]));_0x5a2568[_0x7317('0x3e')]=_0x5a2568[_0x7317('0x3e')][_0x7317('0x3f')]?_0x5a2568[_0x7317('0x3e')]:_0xc163b0[_0x7317('0x39')];_0x5a2568[_0x7317('0x42')]=qs[_0x7317('0x43')](_0x433022[_0x7317('0x3b')][_0x7317('0x43')]);_0x5a2568['where']=qs[_0x7317('0x45')](_[_0x7317('0x46')](_0x433022[_0x7317('0x3b')],_0xc163b0[_0x7317('0x45')]));if(_0x433022[_0x7317('0x3b')][_0x7317('0x47')]){_0x5a2568[_0x7317('0x44')]=_[_0x7317('0x48')](_0x5a2568[_0x7317('0x44')],{'$or':_['map'](_0x5a2568[_0x7317('0x3e')],function(_0x16ea1e){var _0x5ead46={};_0x5ead46[_0x16ea1e]={'$like':'%'+_0x433022['query'][_0x7317('0x47')]+'%'};return _0x5ead46;})});}_0x5a2568=_[_0x7317('0x48')]({},_0x5a2568,_0x433022[_0x7317('0x4d')]);return _0x3e4ee0['getLists'](_0x5a2568);}})[_0x7317('0x24')](function(_0x32089b){if(_0x32089b){_0x2deef7=_0x32089b[_0x7317('0x3f')];if(!_0x433022[_0x7317('0x3b')][_0x7317('0x40')](_0x7317('0x65'))){_0x5a2568[_0x7317('0x41')]=qs[_0x7317('0x41')](_0x433022[_0x7317('0x3b')][_0x7317('0x41')]);_0x5a2568['offset']=qs[_0x7317('0x1e')](_0x433022[_0x7317('0x3b')][_0x7317('0x1e')]);}return _0x3e4ee0[_0x7317('0x87')](_0x5a2568);}})['then'](function(_0x15b8f6){if(_0x15b8f6){return _0x15b8f6?{'count':_0x2deef7,'rows':_0x15b8f6}:null;}})['then'](respondWithResult(_0x16e267,null))[_0x7317('0x52')](handleError(_0x16e267,null));};exports[_0x7317('0x89')]=function(_0x24bbc3,_0x4215f7,_0x4edb78){var _0x202ec8,_0x2d972a;return db[_0x7317('0x37')]['find']({'where':{'id':_0x24bbc3['params']['id']}})[_0x7317('0x24')](handleEntityNotFound(_0x4215f7,null))[_0x7317('0x24')](function(_0x316d7f){if(_0x316d7f){_0x2d972a=_0x316d7f;return _0x316d7f[_0x7317('0x89')](_0x24bbc3['body']['ids'],_[_0x7317('0x5d')](_0x24bbc3[_0x7317('0x56')],[_0x7317('0x6f'),'id'])||{});}return null;})[_0x7317('0x77')](function(_0x3ced2f){var _0xcaed71;_0x202ec8=_0x3ced2f||[];var _0x2d6550=[];if(_0x3ced2f){for(var _0x2e6d9c=0x0;_0x2e6d9c<_0x3ced2f['length'];_0x2e6d9c+=0x1){var _0x160a97=_0x3ced2f[_0x2e6d9c][_0x7317('0x26')]({'plain':!![]});_0x2d972a['dialCheckDuplicateType']=_0x24bbc3[_0x7317('0x56')][_0x7317('0x8a')]?_0x24bbc3[_0x7317('0x56')]['dialCheckDuplicateType']:_0x2d972a[_0x7317('0x8a')];switch(_0x2d972a[_0x7317('0x8a')]){case _0x7317('0x8b'):_0xcaed71=squel['insert']()[_0x7317('0x8c')](_0x7317('0x8d'))['fromQuery']([_0x7317('0x8e'),_0x7317('0x8f'),'ContactId',_0x7317('0x90'),'VoiceQueueId',_0x7317('0x5f'),_0x7317('0x5e')],squel[_0x7317('0x91')]()[_0x7317('0x4c')]('phone',_0x7317('0x8e'))[_0x7317('0x4c')](_0x7317('0x92'),_0x7317('0x8f'))['field']('id',_0x7317('0x93'))['field'](_0x160a97[_0x7317('0x94')][_0x7317('0x95')](),_0x7317('0x90'))[_0x7317('0x4c')](_0x24bbc3['params']['id']['toString'](),_0x7317('0x66'))['field'](_0x7317('0x92'),_0x7317('0x5f'))[_0x7317('0x4c')](_0x7317('0x92'),_0x7317('0x5e'))[_0x7317('0x96')](_0x7317('0x97'))['where']('deletedAt\x20IS\x20NULL')[_0x7317('0x44')](_0x7317('0x98'),_0x160a97[_0x7317('0x94')][_0x7317('0x95')]())[_0x7317('0x44')](_0x7317('0x99'))[_0x7317('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7317('0x91')]()[_0x7317('0x4c')](_0x7317('0x9a'))['from']('cm_hopper_final')[_0x7317('0x44')](_0x7317('0x9b'),_0x24bbc3[_0x7317('0x54')]['id'][_0x7317('0x95')]()))[_0x7317('0x44')](_0x7317('0x9c'),squel[_0x7317('0x91')]()[_0x7317('0x4c')]('COALESCE(phone,\x27\x27)')[_0x7317('0x96')](_0x7317('0x8d'))[_0x7317('0x44')]('VoiceQueueId\x20=\x20?',_0x24bbc3['params']['id'][_0x7317('0x95')]())))[_0x7317('0x95')]();break;case'onlyIfOpen':_0xcaed71=squel[_0x7317('0x9d')]()[_0x7317('0x8c')]('cm_hopper')[_0x7317('0x9e')]([_0x7317('0x8e'),_0x7317('0x8f'),_0x7317('0x93'),_0x7317('0x90'),_0x7317('0x66'),'createdAt',_0x7317('0x5e')],squel[_0x7317('0x91')]()['field'](_0x7317('0x8e'),_0x7317('0x8e'))[_0x7317('0x4c')]('NOW()','scheduledAt')[_0x7317('0x4c')]('id','ContactId')[_0x7317('0x4c')](_0x160a97[_0x7317('0x94')][_0x7317('0x95')](),_0x7317('0x90'))[_0x7317('0x4c')](_0x24bbc3[_0x7317('0x54')]['id'][_0x7317('0x95')](),_0x7317('0x66'))[_0x7317('0x4c')](_0x7317('0x92'),_0x7317('0x5f'))['field'](_0x7317('0x92'),'updatedAt')[_0x7317('0x96')](_0x7317('0x97'))['where'](_0x7317('0x9f'))['where'](_0x7317('0x98'),_0x160a97['CmListId']['toString']())[_0x7317('0x44')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7317('0x4c')]('COALESCE(phone,\x27\x27)')[_0x7317('0x96')](_0x7317('0x8d'))[_0x7317('0x44')](_0x7317('0x9b'),_0x24bbc3['params']['id'][_0x7317('0x95')]())))[_0x7317('0x95')]();break;default:_0xcaed71=squel[_0x7317('0x9d')]()[_0x7317('0x8c')]('cm_hopper')[_0x7317('0x9e')]([_0x7317('0x8e'),_0x7317('0x8f'),_0x7317('0x93'),'ListId',_0x7317('0x66'),'createdAt',_0x7317('0x5e')],squel[_0x7317('0x91')]()[_0x7317('0x4c')](_0x7317('0x8e'),'phone')[_0x7317('0x4c')]('NOW()',_0x7317('0x8f'))[_0x7317('0x4c')]('id',_0x7317('0x93'))['field'](_0x160a97[_0x7317('0x94')]['toString'](),_0x7317('0x90'))['field'](_0x24bbc3[_0x7317('0x54')]['id']['toString'](),_0x7317('0x66'))['field'](_0x7317('0x92'),_0x7317('0x5f'))[_0x7317('0x4c')](_0x7317('0x92'),'updatedAt')[_0x7317('0x96')]('cm_contacts')[_0x7317('0x44')](_0x7317('0x9f'))['where'](_0x7317('0x98'),_0x160a97[_0x7317('0x94')]['toString']())[_0x7317('0x44')](_0x7317('0x99')))[_0x7317('0x95')]();}_0x2d6550[_0x7317('0x7c')](db[_0x7317('0xa0')][_0x7317('0x3b')](_0xcaed71));}return BPromise[_0x7317('0x80')](_0x2d6550);}})[_0x7317('0x24')](function(){return _0x202ec8;})[_0x7317('0x24')](respondWithResult(_0x4215f7,null))[_0x7317('0x52')](handleError(_0x4215f7,null));};exports[_0x7317('0xa1')]=function(_0x3da544,_0x292d09,_0x1628d0){var _0x396018;return db[_0x7317('0x37')][_0x7317('0x2f')]({'where':{'id':_0x3da544['params']['id']}})[_0x7317('0x24')](handleEntityNotFound(_0x292d09,null))[_0x7317('0x24')](function(_0x9d427a){if(_0x9d427a){return _0x9d427a[_0x7317('0xa1')](_0x3da544[_0x7317('0x3b')][_0x7317('0x6f')]);}})[_0x7317('0x24')](function(_0x2a628a){if(_0x2a628a){_0x396018=_0x2a628a;return db[_0x7317('0x64')][_0x7317('0x25')]({'where':{'ListId':_0x3da544[_0x7317('0x3b')]['ids'],'VoiceQueueId':_0x3da544[_0x7317('0x54')]['id']}})['then'](function(){return _0x396018;});}})[_0x7317('0x24')](respondWithStatusCode(_0x292d09,null))[_0x7317('0x52')](handleError(_0x292d09,null));};exports[_0x7317('0xa2')]=function(_0xbfd485,_0x175c72,_0x55d875){var _0x1a65a7={};var _0x351431={};var _0x57c667;var _0x3075fa;return db[_0x7317('0x37')][_0x7317('0x63')]({'where':{'id':_0xbfd485[_0x7317('0x54')]['id']}})[_0x7317('0x24')](handleEntityNotFound(_0x175c72,null))[_0x7317('0x24')](function(_0x552e4f){if(_0x552e4f){_0x57c667=_0x552e4f;_0x351431[_0x7317('0x39')]=_[_0x7317('0x3a')](db[_0x7317('0x88')][_0x7317('0x38')]);_0x351431[_0x7317('0x3b')]=_[_0x7317('0x3a')](_0xbfd485[_0x7317('0x3b')]);_0x351431['filters']=_['intersection'](_0x351431[_0x7317('0x39')],_0x351431[_0x7317('0x3b')]);_0x1a65a7['attributes']=_[_0x7317('0x3c')](_0x351431[_0x7317('0x39')],qs[_0x7317('0x3d')](_0xbfd485[_0x7317('0x3b')]['fields']));_0x1a65a7[_0x7317('0x3e')]=_0x1a65a7[_0x7317('0x3e')][_0x7317('0x3f')]?_0x1a65a7['attributes']:_0x351431[_0x7317('0x39')];_0x1a65a7[_0x7317('0x42')]=qs['sort'](_0xbfd485[_0x7317('0x3b')][_0x7317('0x43')]);_0x1a65a7['where']=qs[_0x7317('0x45')](_[_0x7317('0x46')](_0xbfd485[_0x7317('0x3b')],_0x351431[_0x7317('0x45')]));if(_0xbfd485[_0x7317('0x3b')][_0x7317('0x47')]){_0x1a65a7[_0x7317('0x44')]=_['merge'](_0x1a65a7[_0x7317('0x44')],{'$or':_['map'](_0x1a65a7[_0x7317('0x3e')],function(_0x514427){var _0x565554={};_0x565554[_0x514427]={'$like':'%'+_0xbfd485['query'][_0x7317('0x47')]+'%'};return _0x565554;})});}_0x1a65a7=_[_0x7317('0x48')]({},_0x1a65a7,_0xbfd485[_0x7317('0x4d')]);return _0x57c667['getBlackLists'](_0x1a65a7);}})[_0x7317('0x24')](function(_0x594f92){if(_0x594f92){_0x3075fa=_0x594f92[_0x7317('0x3f')];if(!_0xbfd485[_0x7317('0x3b')][_0x7317('0x40')](_0x7317('0x65'))){_0x1a65a7[_0x7317('0x41')]=qs['limit'](_0xbfd485[_0x7317('0x3b')]['limit']);_0x1a65a7[_0x7317('0x1e')]=qs[_0x7317('0x1e')](_0xbfd485[_0x7317('0x3b')][_0x7317('0x1e')]);}return _0x57c667[_0x7317('0xa2')](_0x1a65a7);}})[_0x7317('0x24')](function(_0x26fbac){if(_0x26fbac){return _0x26fbac?{'count':_0x3075fa,'rows':_0x26fbac}:null;}})[_0x7317('0x24')](respondWithResult(_0x175c72,null))[_0x7317('0x52')](handleError(_0x175c72,null));};exports[_0x7317('0xa3')]=function(_0x9f5797,_0x4efd6d,_0x4e778d){var _0x496633,_0x489a0b;return db[_0x7317('0x37')][_0x7317('0x2f')]({'where':{'id':_0x9f5797[_0x7317('0x54')]['id']}})['then'](handleEntityNotFound(_0x4efd6d,null))[_0x7317('0x24')](function(_0x22ded4){if(_0x22ded4){_0x489a0b=_0x22ded4;return _0x22ded4[_0x7317('0xa3')](_0x9f5797[_0x7317('0x56')][_0x7317('0x6f')],_[_0x7317('0x5d')](_0x9f5797['body'],[_0x7317('0x6f'),'id'])||{});}return null;})['spread'](function(_0x36d5be){var _0x3c5d44;_0x496633=_0x36d5be||[];var _0x1ad6bd=[];if(_0x36d5be){for(var _0xafef07=0x0;_0xafef07<_0x36d5be[_0x7317('0x3f')];_0xafef07+=0x1){var _0x296c33=_0x36d5be[_0xafef07]['get']({'plain':!![]});_0x3c5d44=squel[_0x7317('0x9d')]()[_0x7317('0x8c')](_0x7317('0xa4'))[_0x7317('0x9e')]([_0x7317('0x8e'),'ContactId','ListId',_0x7317('0x66'),_0x7317('0x5f'),'updatedAt'],squel[_0x7317('0x91')]()[_0x7317('0x4c')](_0x7317('0x8e'),_0x7317('0x8e'))[_0x7317('0x4c')]('id',_0x7317('0x93'))[_0x7317('0x4c')](_0x296c33[_0x7317('0x94')][_0x7317('0x95')](),_0x7317('0x90'))[_0x7317('0x4c')](_0x9f5797[_0x7317('0x54')]['id'][_0x7317('0x95')](),'VoiceQueueId')['field'](_0x7317('0x92'),_0x7317('0x5f'))[_0x7317('0x4c')](_0x7317('0x92'),_0x7317('0x5e'))[_0x7317('0x96')](_0x7317('0x97'))['where'](_0x7317('0x9f'))[_0x7317('0x44')]('ListId\x20=\x20?',_0x296c33[_0x7317('0x94')][_0x7317('0x95')]())[_0x7317('0x44')](_0x7317('0x99')))[_0x7317('0x95')]();_0x1ad6bd[_0x7317('0x7c')](db[_0x7317('0xa0')][_0x7317('0x3b')](_0x3c5d44));}return BPromise[_0x7317('0x80')](_0x1ad6bd);}})[_0x7317('0x24')](function(){return _0x496633;})['then'](respondWithResult(_0x4efd6d,null))['catch'](handleError(_0x4efd6d,null));};exports[_0x7317('0xa5')]=function(_0x41422e,_0x21db30,_0x2c6336){var _0x4c5dd1;return db['VoiceQueue'][_0x7317('0x2f')]({'where':{'id':_0x41422e[_0x7317('0x54')]['id']}})['then'](handleEntityNotFound(_0x21db30,null))[_0x7317('0x24')](function(_0x58c944){if(_0x58c944){return _0x58c944[_0x7317('0xa5')](_0x41422e[_0x7317('0x3b')][_0x7317('0x6f')]);}})['then'](function(_0x3fa819){if(_0x3fa819){_0x4c5dd1=_0x3fa819;return db[_0x7317('0x6c')]['destroy']({'where':{'ListId':_0x41422e['query']['ids'],'VoiceQueueId':_0x41422e[_0x7317('0x54')]['id']}})['then'](function(){return _0x4c5dd1;});}})[_0x7317('0x24')](respondWithStatusCode(_0x21db30,null))['catch'](handleError(_0x21db30,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index fcf6c39..f213854 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 _0xd4de=['VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd4de,0x1ac));var _0xed4d=function(_0x28e0e8,_0x4f8720){_0x28e0e8=_0x28e0e8-0x0;var _0x12a0cd=_0xd4de[_0x28e0e8];return _0x12a0cd;};'use strict';var EventEmitter=require(_0xed4d('0x0'));var VoiceQueue=require(_0xed4d('0x1'))['db'][_0xed4d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xed4d('0x3')](0x0);var events={'afterCreate':_0xed4d('0x4'),'afterUpdate':_0xed4d('0x5'),'afterDestroy':'remove'};function emitEvent(_0xc06a14){return function(_0x1436b3,_0x125dbe,_0x3b65bb){VoiceQueueEvents[_0xed4d('0x6')](_0xc06a14+':'+_0x1436b3['id'],_0x1436b3);VoiceQueueEvents[_0xed4d('0x6')](_0xc06a14,_0x1436b3);_0x3b65bb(null);};}for(var e in events){if(events[_0xed4d('0x7')](e)){var event=events[e];VoiceQueue[_0xed4d('0x8')](e,emitEvent(event));}}module[_0xed4d('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xac2c=['remove','emit','hasOwnProperty','VoiceQueue','setMaxListeners','save'];(function(_0x271539,_0x16796){var _0x46b336=function(_0x15a14d){while(--_0x15a14d){_0x271539['push'](_0x271539['shift']());}};_0x46b336(++_0x16796);}(_0xac2c,0x195));var _0xcac2=function(_0x19a028,_0x161bbc){_0x19a028=_0x19a028-0x0;var _0x2822b0=_0xac2c[_0x19a028];return _0x2822b0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0xcac2('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xcac2('0x1')](0x0);var events={'afterCreate':_0xcac2('0x2'),'afterUpdate':'update','afterDestroy':_0xcac2('0x3')};function emitEvent(_0x118d96){return function(_0x3ce04b,_0x4f9835,_0x5212e0){VoiceQueueEvents[_0xcac2('0x4')](_0x118d96+':'+_0x3ce04b['id'],_0x3ce04b);VoiceQueueEvents[_0xcac2('0x4')](_0x118d96,_0x3ce04b);_0x5212e0(null);};}for(var e in events){if(events[_0xcac2('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index d291943..3f76527 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 _0x3e50=['moment','request-promise','./voiceQueue.attributes','exports','VoiceQueue','voice_queues','util','api'];(function(_0x3d1f9f,_0x279623){var _0x19c23b=function(_0x3a7d15){while(--_0x3a7d15){_0x3d1f9f['push'](_0x3d1f9f['shift']());}};_0x19c23b(++_0x279623);}(_0x3e50,0x196));var _0x03e5=function(_0x255d94,_0x9c69db){_0x255d94=_0x255d94-0x0;var _0x265c39=_0x3e50[_0x255d94];return _0x265c39;};'use strict';var _=require('lodash');var util=require(_0x03e5('0x0'));var logger=require('../../config/logger')(_0x03e5('0x1'));var moment=require(_0x03e5('0x2'));var BPromise=require('bluebird');var rp=require(_0x03e5('0x3'));var attributes=require(_0x03e5('0x4'));module[_0x03e5('0x5')]=function(_0x495319,_0x12c1f7){return _0x495319['define'](_0x03e5('0x6'),attributes,{'tableName':_0x03e5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e1b=['./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1e8b1e,_0x407bbd){var _0x4a0fde=function(_0x4fd2be){while(--_0x4fd2be){_0x1e8b1e['push'](_0x1e8b1e['shift']());}};_0x4a0fde(++_0x407bbd);}(_0x7e1b,0xeb));var _0xb7e1=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x7e1b[_0x4a3898];return _0x25ceb0;};'use strict';var _=require('lodash');var util=require(_0xb7e1('0x0'));var logger=require(_0xb7e1('0x1'))('api');var moment=require(_0xb7e1('0x2'));var BPromise=require(_0xb7e1('0x3'));var rp=require(_0xb7e1('0x4'));var attributes=require(_0xb7e1('0x5'));module[_0xb7e1('0x6')]=function(_0x5db924,_0x5ee984){return _0x5db924[_0xb7e1('0x7')](_0xb7e1('0x8'),attributes,{'tableName':_0xb7e1('0x9'),'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 3dc552f..15d8fff 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 _0x9957=['register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','options','raw','where','attributes','limit','include','model','map','catch','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket'];(function(_0x41ee57,_0x324f7c){var _0x440e0e=function(_0x3b6263){while(--_0x3b6263){_0x41ee57['push'](_0x41ee57['shift']());}};_0x440e0e(++_0x324f7c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['GetVoiceQueue']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['VoiceQueue']['findAll']({'raw':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1e')]||null:null,'attributes':_0x3ec178['options']?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1f')]||null:null,'limit':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x20')]||null:null,'include':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x21')]?_['map'](_0x3ec178[_0x7995('0x1c')][_0x7995('0x21')],function(_0x401dc3){return{'model':db[_0x401dc3[_0x7995('0x22')]],'as':_0x401dc3['as'],'attributes':_0x401dc3[_0x7995('0x1f')],'include':_0x401dc3[_0x7995('0x21')]?_['map'](_0x401dc3[_0x7995('0x21')],function(_0x5911c3){return{'model':db[_0x5911c3[_0x7995('0x22')]],'as':_0x5911c3['as'],'attributes':_0x5911c3[_0x7995('0x1f')],'include':_0x5911c3[_0x7995('0x21')]?_[_0x7995('0x23')](_0x5911c3[_0x7995('0x21')],function(_0x4b6f99){return{'model':db[_0x4b6f99[_0x7995('0x22')]],'as':_0x4b6f99['as'],'attributes':_0x4b6f99['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x3250e0){logger[_0x7995('0x1a')]('GetVoiceQueue',_0x3ec178);logger['debug']('GetVoiceQueue',_0x3ec178,JSON[_0x7995('0x17')](_0x3250e0));_0x4cbe10(_0x3250e0);})[_0x7995('0x24')](function(_0x327a81){logger[_0x7995('0x18')](_0x7995('0x25'),_0x327a81[_0x7995('0x19')],_0x3ec178);_0x3a9b54(_0x3d463e['error'](0x1f4,_0x327a81['message']));});});};exports[_0x7995('0x26')]=function(_0x5524af){var _0x553671=this;return new Promise(function(_0x3eb566,_0x29fac5){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':_0x5524af['options']?_0x5524af[_0x7995('0x1c')][_0x7995('0x1d')]===undefined?!![]:![]:!![],'where':_0x5524af['options']?_0x5524af['options']['where']||null:null,'attributes':_0x5524af[_0x7995('0x1c')]?_0x5524af[_0x7995('0x1c')]['attributes']||null:null,'include':_0x5524af[_0x7995('0x1c')]?_0x5524af['options'][_0x7995('0x21')]?_[_0x7995('0x23')](_0x5524af[_0x7995('0x1c')]['include'],function(_0x52d76d){return{'model':db[_0x52d76d[_0x7995('0x22')]],'as':_0x52d76d['as'],'attributes':_0x52d76d['attributes'],'include':_0x52d76d['include']?_[_0x7995('0x23')](_0x52d76d[_0x7995('0x21')],function(_0x5212ff){return{'model':db[_0x5212ff[_0x7995('0x22')]],'as':_0x5212ff['as'],'attributes':_0x5212ff[_0x7995('0x1f')],'include':_0x5212ff[_0x7995('0x21')]?_[_0x7995('0x23')](_0x5212ff[_0x7995('0x21')],function(_0x53002a){return{'model':db[_0x53002a[_0x7995('0x22')]],'as':_0x53002a['as'],'attributes':_0x53002a[_0x7995('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x1d60b8){logger['info'](_0x7995('0x26'),_0x5524af);logger[_0x7995('0x15')](_0x7995('0x26'),_0x5524af,JSON[_0x7995('0x17')](_0x1d60b8));_0x3eb566(_0x1d60b8);})[_0x7995('0x24')](function(_0x1035dc){logger['error'](_0x7995('0x26'),_0x1035dc[_0x7995('0x19')],_0x5524af);_0x29fac5(_0x553671[_0x7995('0x18')](0x1f4,_0x1035dc[_0x7995('0x19')]));});});}; \ No newline at end of file +var _0xa9e0=['register','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVoiceQueue','VoiceQueue','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x5d8104,_0x53906b){var _0x3aeb9a=function(_0x341388){while(--_0x341388){_0x5d8104['push'](_0x5d8104['shift']());}};_0x3aeb9a(++_0x53906b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['VoiceQueue'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'limit':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]||null:null,'include':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x1314ae[_0x0a9e('0x1b')]['include'],function(_0x59181e){return{'model':db[_0x59181e[_0x0a9e('0x22')]],'as':_0x59181e['as'],'attributes':_0x59181e[_0x0a9e('0x1e')],'include':_0x59181e[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x59181e['include'],function(_0x384319){return{'model':db[_0x384319['model']],'as':_0x384319['as'],'attributes':_0x384319[_0x0a9e('0x1e')],'include':_0x384319['include']?_[_0x0a9e('0x21')](_0x384319[_0x0a9e('0x20')],function(_0x25fba9){return{'model':db[_0x25fba9[_0x0a9e('0x22')]],'as':_0x25fba9['as'],'attributes':_0x25fba9[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x11c3b6){logger[_0x0a9e('0x16')]('GetVoiceQueue',_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON[_0x0a9e('0x12')](_0x11c3b6));_0x1c696a(_0x11c3b6);})[_0x0a9e('0x18')](function(_0x5c877d){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x5c877d[_0x0a9e('0x15')],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x5c877d[_0x0a9e('0x15')]));});});};exports[_0x0a9e('0x24')]=function(_0x296f41){var _0x2e8759=this;return new Promise(function(_0x1dbde2,_0x540530){return db[_0x0a9e('0x25')]['find']({'raw':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')]['where']||null:null,'attributes':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x296f41[_0x0a9e('0x1b')]['include'],function(_0x44295a){return{'model':db[_0x44295a['model']],'as':_0x44295a['as'],'attributes':_0x44295a[_0x0a9e('0x1e')],'include':_0x44295a[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x44295a[_0x0a9e('0x20')],function(_0x567193){return{'model':db[_0x567193[_0x0a9e('0x22')]],'as':_0x567193['as'],'attributes':_0x567193[_0x0a9e('0x1e')],'include':_0x567193[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x567193['include'],function(_0x54135e){return{'model':db[_0x54135e[_0x0a9e('0x22')]],'as':_0x54135e['as'],'attributes':_0x54135e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x3d9717){logger[_0x0a9e('0x16')](_0x0a9e('0x24'),_0x296f41);logger['debug'](_0x0a9e('0x24'),_0x296f41,JSON[_0x0a9e('0x12')](_0x3d9717));_0x1dbde2(_0x3d9717);})[_0x0a9e('0x18')](function(_0x533942){logger[_0x0a9e('0x13')](_0x0a9e('0x24'),_0x533942[_0x0a9e('0x15')],_0x296f41);_0x540530(_0x2e8759['error'](0x1f4,_0x533942['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 268ffb6..cbe80ae 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 _0xfc62=['removeListener','register','length','save','remove','update'];(function(_0x16c73f,_0x39cd3e){var _0x1bb7ca=function(_0xc7926c){while(--_0xc7926c){_0x16c73f['push'](_0x16c73f['shift']());}};_0x1bb7ca(++_0x39cd3e);}(_0xfc62,0x1bf));var _0x2fc6=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xfc62[_0x18ab2a];return _0x16dcee;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x2fc6('0x0'),_0x2fc6('0x1'),_0x2fc6('0x2')];function createListener(_0x5350eb,_0x248922){return function(_0x300d14){_0x248922['emit'](_0x5350eb,_0x300d14);};}function removeListener(_0x252d58,_0x5c8348){return function(){VoiceQueueEvents[_0x2fc6('0x3')](_0x252d58,_0x5c8348);};}exports[_0x2fc6('0x4')]=function(_0x5b6c55){for(var _0x5cd9a0=0x0,_0x40856a=events[_0x2fc6('0x5')];_0x5cd9a0<_0x40856a;_0x5cd9a0++){var _0x1a2abf=events[_0x5cd9a0];var _0x3cdedf=createListener('voiceQueue:'+_0x1a2abf,_0x5b6c55);VoiceQueueEvents['on'](_0x1a2abf,_0x3cdedf);}}; \ No newline at end of file +var _0x2b27=['./voiceQueue.events','save','update','removeListener','register','length','voiceQueue:'];(function(_0x2ec26a,_0x48f9a2){var _0x56bffb=function(_0x364fa4){while(--_0x364fa4){_0x2ec26a['push'](_0x2ec26a['shift']());}};_0x56bffb(++_0x48f9a2);}(_0x2b27,0x134));var _0x72b2=function(_0x4c9d00,_0x5092d5){_0x4c9d00=_0x4c9d00-0x0;var _0x4a73f5=_0x2b27[_0x4c9d00];return _0x4a73f5;};'use strict';var VoiceQueueEvents=require(_0x72b2('0x0'));var events=[_0x72b2('0x1'),'remove',_0x72b2('0x2')];function createListener(_0xc92e25,_0x3805f6){return function(_0x361add){_0x3805f6['emit'](_0xc92e25,_0x361add);};}function removeListener(_0x3a7e8a,_0x45d841){return function(){VoiceQueueEvents[_0x72b2('0x3')](_0x3a7e8a,_0x45d841);};}exports[_0x72b2('0x4')]=function(_0x8d573d){for(var _0x3c2afc=0x0,_0x36b493=events[_0x72b2('0x5')];_0x3c2afc<_0x36b493;_0x3c2afc++){var _0x2ae41a=events[_0x3c2afc];var _0x544100=createListener(_0x72b2('0x6')+_0x2ae41a,_0x8d573d);VoiceQueueEvents['on'](_0x2ae41a,_0x544100);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 73013a7..2544ce5 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 _0x7aeb=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x355ff5,_0x17284f){var _0x36041b=function(_0x814e1a){while(--_0x814e1a){_0x355ff5['push'](_0x355ff5['shift']());}};_0x36041b(++_0x17284f);}(_0x7aeb,0x104));var _0xb7ae=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7aeb[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xb7ae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb7ae('0x1'));var express=require(_0xb7ae('0x2'));var router=express[_0xb7ae('0x3')]();var auth=require(_0xb7ae('0x4'));var interaction=require(_0xb7ae('0x5'));var config=require('../../config/environment');var controller=require(_0xb7ae('0x6'));router[_0xb7ae('0x7')]('/',auth[_0xb7ae('0x8')](),controller[_0xb7ae('0x9')]);router[_0xb7ae('0x7')]('/describe',auth[_0xb7ae('0x8')](),controller['describe']);router[_0xb7ae('0x7')](_0xb7ae('0xa'),auth[_0xb7ae('0x8')](),controller[_0xb7ae('0xb')]);router[_0xb7ae('0x7')](_0xb7ae('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb7ae('0xd')]('/',auth[_0xb7ae('0x8')](),controller[_0xb7ae('0xe')]);router[_0xb7ae('0xf')](_0xb7ae('0xc'),auth['isAuthenticated'](),controller[_0xb7ae('0x10')]);router[_0xb7ae('0x11')](_0xb7ae('0xc'),auth[_0xb7ae('0x8')](),controller[_0xb7ae('0x12')]);module[_0xb7ae('0x13')]=router; \ No newline at end of file +var _0xba8b=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','delete','destroy'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xba8b,0x121));var _0xbba8=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xba8b[_0x1b6186];return _0x186121;};'use strict';var multer=require(_0xbba8('0x0'));var util=require(_0xbba8('0x1'));var path=require(_0xbba8('0x2'));var timeout=require(_0xbba8('0x3'));var express=require(_0xbba8('0x4'));var router=express[_0xbba8('0x5')]();var auth=require(_0xbba8('0x6'));var interaction=require(_0xbba8('0x7'));var config=require(_0xbba8('0x8'));var controller=require(_0xbba8('0x9'));router[_0xbba8('0xa')]('/',auth[_0xbba8('0xb')](),controller['index']);router['get'](_0xbba8('0xc'),auth['isAuthenticated'](),controller[_0xbba8('0xd')]);router[_0xbba8('0xa')](_0xbba8('0xe'),auth[_0xbba8('0xb')](),controller[_0xbba8('0xf')]);router['get']('/:id',auth[_0xbba8('0xb')](),controller[_0xbba8('0x10')]);router[_0xbba8('0x11')]('/',auth[_0xbba8('0xb')](),controller[_0xbba8('0x12')]);router[_0xbba8('0x13')](_0xbba8('0x14'),auth[_0xbba8('0xb')](),controller['update']);router[_0xbba8('0x15')](_0xbba8('0x14'),auth['isAuthenticated'](),controller[_0xbba8('0x16')]);module[_0xbba8('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index b3814cb..92416a0 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 _0xca86=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x41d147,_0x5deedf){var _0x2f0501=function(_0x539980){while(--_0x539980){_0x41d147['push'](_0x41d147['shift']());}};_0x2f0501(++_0x5deedf);}(_0xca86,0x1a6));var _0x6ca8=function(_0x3d999b,_0x2c5774){_0x3d999b=_0x3d999b-0x0;var _0x5685c4=_0xca86[_0x3d999b];return _0x5685c4;};'use strict';var Sequelize=require(_0x6ca8('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x6ca8('0x1')]},'uniqueid':{'type':Sequelize[_0x6ca8('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6ca8('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x6ca8('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x6ca8('0x2')],'set':function(_0xe59dbd){var _0x38af11=moment(_0xe59dbd);var _0x8a1d5e=moment(this[_0x6ca8('0x3')](_0x6ca8('0x4')))[_0x6ca8('0x5')](_0x6ca8('0x6'));var _0x1d0485=_0x38af11[_0x6ca8('0x7')](_0x8a1d5e,_0x6ca8('0x8'));this[_0x6ca8('0x9')](_0x6ca8('0xa'),_0xe59dbd);this[_0x6ca8('0x9')](_0x6ca8('0xb'),_0x1d0485||null);}},'position':{'type':Sequelize[_0x6ca8('0xc')]},'count':{'type':Sequelize[_0x6ca8('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x6ca8('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x6ca8('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6ca8('0x2')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x6ca8('0x1')],'comment':_0x6ca8('0xe')},'originalposition':{'type':Sequelize[_0x6ca8('0xc')]},'channel':{'type':Sequelize[_0x6ca8('0x1')]},'connectedlinenum':{'type':Sequelize[_0x6ca8('0x1')]},'connectedlinename':{'type':Sequelize[_0x6ca8('0x1')]},'accountcode':{'type':Sequelize[_0x6ca8('0x1')]},'context':{'type':Sequelize[_0x6ca8('0x1')]},'exten':{'type':Sequelize[_0x6ca8('0x1')]},'priority':{'type':Sequelize[_0x6ca8('0x1')]},'holdtime':{'type':Sequelize[_0x6ca8('0xc')]},'mohtime':{'type':Sequelize[_0x6ca8('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6ca8('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6ca8('0x1')]},'transfer':{'type':Sequelize[_0x6ca8('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6ca8('0x1')]},'transferuniqueid':{'type':Sequelize[_0x6ca8('0x1')]},'disposition':{'type':Sequelize[_0x6ca8('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x6ca8('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x733a=['getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x733a,0x176));var _0xa733=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x733a[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0xa733('0x0'));var moment=require('moment');module[_0xa733('0x1')]={'type':{'type':Sequelize[_0xa733('0x2')]},'uniqueid':{'type':Sequelize[_0xa733('0x2')]},'calleridnum':{'type':Sequelize[_0xa733('0x2')]},'calleridname':{'type':Sequelize[_0xa733('0x2')]},'queue':{'type':Sequelize[_0xa733('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xa733('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xa733('0x3')],'set':function(_0x6b7747){var _0x22ca5b=moment(_0x6b7747);var _0x48f922=moment(this[_0xa733('0x4')]('queuecallerjoinAt'))[_0xa733('0x5')](_0xa733('0x6'));var _0x391f75=_0x22ca5b['diff'](_0x48f922,_0xa733('0x7'));this[_0xa733('0x8')](_0xa733('0x9'),_0x6b7747);this[_0xa733('0x8')](_0xa733('0xa'),_0x391f75||null);}},'position':{'type':Sequelize[_0xa733('0xb')]},'count':{'type':Sequelize[_0xa733('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xa733('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa733('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa733('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xa733('0x2')],'comment':_0xa733('0xd')},'originalposition':{'type':Sequelize[_0xa733('0xb')]},'channel':{'type':Sequelize[_0xa733('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa733('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa733('0x2')]},'context':{'type':Sequelize[_0xa733('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa733('0x2')]},'holdtime':{'type':Sequelize[_0xa733('0xb')]},'mohtime':{'type':Sequelize[_0xa733('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa733('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xa733('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa733('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xa733('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa733('0x2')]},'disposition':{'type':Sequelize[_0xa733('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xa733('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 01ce1f0..6629af0 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 _0x6785=['merge','VIRTUAL','field','options','includeAll','catch','show','params','find','create','body','describe','getVoiceQueuesReport','pick','map','include','findAll','rows','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','VoiceQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x2014d3,_0x88dc82){var _0x41ca0e=function(_0x3dfbf3){while(--_0x3dfbf3){_0x2014d3['push'](_0x2014d3['shift']());}};_0x41ca0e(++_0x88dc82);}(_0x6785,0x19d));var _0x5678=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x6785[_0x1b7368];return _0x25d54c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5678('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5678('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5678('0x2'));var moment=require(_0x5678('0x3'));var BPromise=require(_0x5678('0x4'));var Mustache=require(_0x5678('0x5'));var util=require(_0x5678('0x6'));var path=require(_0x5678('0x7'));var sox=require(_0x5678('0x8'));var csv=require(_0x5678('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5678('0xa'));var squel=require(_0x5678('0xb'));var crypto=require('crypto');var jsforce=require(_0x5678('0xc'));var deskjs=require(_0x5678('0xd'));var toCsv=require(_0x5678('0x9'));var querystring=require('querystring');var Papa=require(_0x5678('0xe'));var authService=require(_0x5678('0xf'));var hardwareService=require(_0x5678('0x10'));var Redis=require(_0x5678('0x11'));var qs=require(_0x5678('0x12'));var logger=require(_0x5678('0x13'))(_0x5678('0x14'));var utils=require(_0x5678('0x15'));var config=require(_0x5678('0x16'));var db=require('../../mysqldb')['db'];config[_0x5678('0x17')]=_[_0x5678('0x18')](config[_0x5678('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5678('0x19'))(new Redis(config[_0x5678('0x17')]));require(_0x5678('0x1a'))[_0x5678('0x1b')](socket);function respondWithStatusCode(_0x5c91a3,_0x4e8b5a){_0x4e8b5a=_0x4e8b5a||0xcc;return function(_0x9bfccf){if(_0x9bfccf){return _0x5c91a3[_0x5678('0x1c')](_0x4e8b5a);}return _0x5c91a3[_0x5678('0x1d')](_0x4e8b5a)[_0x5678('0x1e')]();};}function respondWithResult(_0x45ea9d,_0x5cbf23){_0x5cbf23=_0x5cbf23||0xc8;return function(_0x16dd39){if(_0x16dd39){return _0x45ea9d[_0x5678('0x1d')](_0x5cbf23)[_0x5678('0x1f')](_0x16dd39);}};}function respondWithFilteredResult(_0x57f3e2,_0x1a63c3){return function(_0x58ee2a){if(_0x58ee2a){var _0x2bf1b4=_0x58ee2a[_0x5678('0x20')],_0x5e82ac=_0x1a63c3[_0x5678('0x21')],_0x4304e0=_0x1a63c3['offset']+_0x1a63c3[_0x5678('0x22')],_0x2a8ffc;if(_0x4304e0>=_0x2bf1b4){_0x4304e0=_0x2bf1b4;_0x2a8ffc=0xc8;}else{_0x2a8ffc=0xce;}_0x57f3e2[_0x5678('0x1d')](_0x2a8ffc);return _0x57f3e2['set'](_0x5678('0x23'),_0x5e82ac+'-'+_0x4304e0+'/'+_0x2bf1b4)[_0x5678('0x1f')](_0x58ee2a);}return null;};}function patchUpdates(_0x579bd3){return function(_0x534fcd){try{jsonpatch[_0x5678('0x24')](_0x534fcd,_0x579bd3,!![]);}catch(_0x38d9e9){return BPromise['reject'](_0x38d9e9);}return _0x534fcd['save']();};}function saveUpdates(_0x5cc6fb,_0x59cf23){return function(_0x3bead6){if(_0x3bead6){return _0x3bead6[_0x5678('0x25')](_0x5cc6fb)[_0x5678('0x26')](function(_0x2b8d66){return _0x2b8d66;});}return null;};}function removeEntity(_0x51277e,_0x389e59){return function(_0x2ad952){if(_0x2ad952){return _0x2ad952[_0x5678('0x27')]()[_0x5678('0x26')](function(){_0x51277e['status'](0xcc)[_0x5678('0x1e')]();});}};}function handleEntityNotFound(_0x9487b6,_0x9ab229){return function(_0x23a72e){if(!_0x23a72e){_0x9487b6[_0x5678('0x1c')](0x194);}return _0x23a72e;};}function handleError(_0x885d71,_0x42dcf2){_0x42dcf2=_0x42dcf2||0x1f4;return function(_0x26e7af){logger[_0x5678('0x28')](_0x26e7af[_0x5678('0x29')]);if(_0x26e7af[_0x5678('0x2a')]){delete _0x26e7af['name'];}_0x885d71['status'](_0x42dcf2)[_0x5678('0x2b')](_0x26e7af);};}exports[_0x5678('0x2c')]=function(_0x37e7e6,_0x888f62){var _0x1de9ea={},_0x3f33a2={},_0x5488f2={'count':0x0,'rows':[]};var _0x1247c8=db[_0x5678('0x2d')][_0x5678('0x2e')];_0x3f33a2[_0x5678('0x2f')]=_[_0x5678('0x30')](_0x1247c8);_0x3f33a2[_0x5678('0x31')]=_[_0x5678('0x30')](_0x37e7e6[_0x5678('0x31')]);_0x3f33a2[_0x5678('0x32')]=_[_0x5678('0x33')](_0x3f33a2[_0x5678('0x2f')],_0x3f33a2['query']);_0x1de9ea[_0x5678('0x34')]=_[_0x5678('0x33')](_0x3f33a2[_0x5678('0x2f')],qs[_0x5678('0x35')](_0x37e7e6[_0x5678('0x31')][_0x5678('0x35')]));_0x1de9ea[_0x5678('0x34')]=_0x1de9ea['attributes'][_0x5678('0x36')]?_0x1de9ea[_0x5678('0x34')]:_0x3f33a2[_0x5678('0x2f')];if(!_0x37e7e6[_0x5678('0x31')][_0x5678('0x37')](_0x5678('0x38'))){_0x1de9ea[_0x5678('0x22')]=qs[_0x5678('0x22')](_0x37e7e6['query'][_0x5678('0x22')]);_0x1de9ea[_0x5678('0x21')]=qs[_0x5678('0x21')](_0x37e7e6[_0x5678('0x31')][_0x5678('0x21')]);}_0x1de9ea[_0x5678('0x39')]=qs[_0x5678('0x3a')](_0x37e7e6[_0x5678('0x31')][_0x5678('0x3a')]);_0x1de9ea[_0x5678('0x3b')]=qs[_0x5678('0x32')](_['pick'](_0x37e7e6[_0x5678('0x31')],_0x3f33a2['filters']));if(_0x37e7e6[_0x5678('0x31')][_0x5678('0x3c')]){_0x1de9ea[_0x5678('0x3b')]=_[_0x5678('0x3d')](_0x1de9ea[_0x5678('0x3b')],{'$or':_['map'](_0x1247c8,function(_0x165f4f){if(_0x165f4f['type']['key']!==_0x5678('0x3e')){var _0x41fee4={};_0x41fee4[_0x165f4f[_0x5678('0x3f')]]={'$like':'%'+_0x37e7e6[_0x5678('0x31')]['filter']+'%'};return _0x41fee4;}})});}_0x1de9ea=_[_0x5678('0x3d')]({},_0x1de9ea,_0x37e7e6[_0x5678('0x40')]);var _0x13c8f6={'where':_0x1de9ea[_0x5678('0x3b')]};return db['VoiceQueueReport'][_0x5678('0x20')](_0x13c8f6)['then'](function(_0x8790f9){_0x5488f2[_0x5678('0x20')]=_0x8790f9;if(_0x37e7e6['query'][_0x5678('0x41')]){_0x1de9ea['include']=[{'all':!![]}];}return db[_0x5678('0x2d')]['findAll'](_0x1de9ea);})[_0x5678('0x26')](function(_0x4e4ea0){_0x5488f2['rows']=_0x4e4ea0;return _0x5488f2;})[_0x5678('0x26')](respondWithFilteredResult(_0x888f62,_0x1de9ea))[_0x5678('0x42')](handleError(_0x888f62,null));};exports[_0x5678('0x43')]=function(_0xa08566,_0x439e0f){var _0x6a0d16={'raw':![],'where':{'id':_0xa08566[_0x5678('0x44')]['id']}},_0x3495bf={};_0x3495bf[_0x5678('0x2f')]=_[_0x5678('0x30')](db[_0x5678('0x2d')]['rawAttributes']);_0x3495bf[_0x5678('0x31')]=_['keys'](_0xa08566[_0x5678('0x31')]);_0x3495bf['filters']=_[_0x5678('0x33')](_0x3495bf[_0x5678('0x2f')],_0x3495bf['query']);_0x6a0d16[_0x5678('0x34')]=_[_0x5678('0x33')](_0x3495bf['model'],qs['fields'](_0xa08566[_0x5678('0x31')][_0x5678('0x35')]));_0x6a0d16[_0x5678('0x34')]=_0x6a0d16[_0x5678('0x34')]['length']?_0x6a0d16['attributes']:_0x3495bf['model'];if(_0xa08566[_0x5678('0x31')][_0x5678('0x41')]){_0x6a0d16['include']=[{'all':!![]}];}_0x6a0d16=_[_0x5678('0x3d')]({},_0x6a0d16,_0xa08566['options']);return db[_0x5678('0x2d')][_0x5678('0x45')](_0x6a0d16)[_0x5678('0x26')](handleEntityNotFound(_0x439e0f,null))['then'](respondWithResult(_0x439e0f,null))[_0x5678('0x42')](handleError(_0x439e0f,null));};exports[_0x5678('0x46')]=function(_0x4917c7,_0x4dd5ab){return db[_0x5678('0x2d')][_0x5678('0x46')](_0x4917c7[_0x5678('0x47')],{})['then'](respondWithResult(_0x4dd5ab,0xc9))['catch'](handleError(_0x4dd5ab,null));};exports['update']=function(_0x19726e,_0x9ad1f3){if(_0x19726e['body']['id']){delete _0x19726e['body']['id'];}return db[_0x5678('0x2d')]['find']({'where':{'id':_0x19726e[_0x5678('0x44')]['id']}})[_0x5678('0x26')](handleEntityNotFound(_0x9ad1f3,null))[_0x5678('0x26')](saveUpdates(_0x19726e[_0x5678('0x47')],null))['then'](respondWithResult(_0x9ad1f3,null))[_0x5678('0x42')](handleError(_0x9ad1f3,null));};exports[_0x5678('0x27')]=function(_0x2b0e07,_0x8204c1){return db['VoiceQueueReport'][_0x5678('0x45')]({'where':{'id':_0x2b0e07[_0x5678('0x44')]['id']}})[_0x5678('0x26')](handleEntityNotFound(_0x8204c1,null))['then'](removeEntity(_0x8204c1,null))['catch'](handleError(_0x8204c1,null));};exports['describe']=function(_0x36566c,_0xbdca56){return db[_0x5678('0x2d')][_0x5678('0x48')]()[_0x5678('0x26')](respondWithResult(_0xbdca56,null))['catch'](handleError(_0xbdca56,null));};exports[_0x5678('0x49')]=function(_0x1fb171,_0xece4d7){var _0x41fa9a={},_0x222d3c={},_0xbb9660={'count':0x0,'rows':[]};_0x222d3c[_0x5678('0x2f')]=_['keys'](db[_0x5678('0x2d')][_0x5678('0x2e')]);_0x222d3c[_0x5678('0x31')]=_[_0x5678('0x30')](_0x1fb171[_0x5678('0x31')]);_0x222d3c[_0x5678('0x32')]=_[_0x5678('0x33')](_0x222d3c[_0x5678('0x2f')],_0x222d3c[_0x5678('0x31')]);_0x41fa9a[_0x5678('0x34')]=_[_0x5678('0x33')](_0x222d3c['model'],qs[_0x5678('0x35')](_0x1fb171[_0x5678('0x31')][_0x5678('0x35')]));_0x41fa9a[_0x5678('0x34')]=_0x41fa9a['attributes']['length']?_0x41fa9a['attributes']:_0x222d3c[_0x5678('0x2f')];if(!_0x1fb171[_0x5678('0x31')]['hasOwnProperty'](_0x5678('0x38'))){_0x41fa9a[_0x5678('0x22')]=qs[_0x5678('0x22')](_0x1fb171[_0x5678('0x31')][_0x5678('0x22')]);_0x41fa9a[_0x5678('0x21')]=qs['offset'](_0x1fb171[_0x5678('0x31')][_0x5678('0x21')]);}_0x41fa9a[_0x5678('0x39')]=qs[_0x5678('0x3a')](_0x1fb171['query'][_0x5678('0x3a')]);_0x41fa9a[_0x5678('0x3b')]=qs[_0x5678('0x32')](_[_0x5678('0x4a')](_0x1fb171[_0x5678('0x31')],_0x222d3c[_0x5678('0x32')]));if(_0x1fb171[_0x5678('0x31')][_0x5678('0x3c')]){_0x41fa9a[_0x5678('0x3b')]=_['merge'](_0x41fa9a['where'],{'$or':_[_0x5678('0x4b')](_0x41fa9a[_0x5678('0x34')],function(_0x68ce0c){var _0x17cacc={};_0x17cacc[_0x68ce0c]={'$like':'%'+_0x1fb171[_0x5678('0x31')][_0x5678('0x3c')]+'%'};return _0x17cacc;})});}_0x41fa9a=_['merge']({},_0x41fa9a,_0x1fb171[_0x5678('0x40')]);var _0x1997de={'where':_0x41fa9a[_0x5678('0x3b')]};return db['VoiceQueueReport']['count'](_0x1997de)[_0x5678('0x26')](function(_0x7a0b52){_0xbb9660[_0x5678('0x20')]=_0x7a0b52;if(_0x1fb171[_0x5678('0x31')][_0x5678('0x41')]){_0x41fa9a[_0x5678('0x4c')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x5678('0x4d')](_0x41fa9a);})['then'](function(_0x383107){_0xbb9660[_0x5678('0x4e')]=_0x383107;return _0xbb9660;})['then'](respondWithFilteredResult(_0xece4d7,_0x41fa9a,'getVoiceQueuesReport'))[_0x5678('0x42')](handleError(_0xece4d7,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xc469=['desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','key','VIRTUAL','options','include','VoiceQueueReport','findAll','rows','show','params','find','catch','create','body','describe','getVoiceQueuesReport','includeAll','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel'];(function(_0x3b0248,_0x3bff86){var _0x37e905=function(_0x2da122){while(--_0x2da122){_0x3b0248['push'](_0x3b0248['shift']());}};_0x37e905(++_0x3bff86);}(_0xc469,0xe5));var _0x9c46=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0xc469[_0x548627];return _0x844a84;};'use strict';var pdf=require(_0x9c46('0x0'));var emlformat=require(_0x9c46('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9c46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c46('0x3'));var moment=require(_0x9c46('0x4'));var BPromise=require(_0x9c46('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9c46('0x6'));var sox=require(_0x9c46('0x7'));var csv=require(_0x9c46('0x8'));var ejs=require(_0x9c46('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9c46('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9c46('0xb'));var toCsv=require(_0x9c46('0x8'));var querystring=require(_0x9c46('0xc'));var Papa=require('papaparse');var authService=require(_0x9c46('0xd'));var hardwareService=require(_0x9c46('0xe'));var Redis=require(_0x9c46('0xf'));var qs=require(_0x9c46('0x10'));var logger=require(_0x9c46('0x11'))(_0x9c46('0x12'));var utils=require('../../config/utils');var config=require(_0x9c46('0x13'));var db=require(_0x9c46('0x14'))['db'];config[_0x9c46('0x15')]=_[_0x9c46('0x16')](config[_0x9c46('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x9c46('0x17'))(new Redis(config[_0x9c46('0x15')]));require(_0x9c46('0x18'))[_0x9c46('0x19')](socket);function respondWithStatusCode(_0x3216e9,_0x160b09){_0x160b09=_0x160b09||0xcc;return function(_0x1d624d){if(_0x1d624d){return _0x3216e9['sendStatus'](_0x160b09);}return _0x3216e9[_0x9c46('0x1a')](_0x160b09)['end']();};}function respondWithResult(_0x41c299,_0x35d368){_0x35d368=_0x35d368||0xc8;return function(_0x1fe612){if(_0x1fe612){return _0x41c299[_0x9c46('0x1a')](_0x35d368)[_0x9c46('0x1b')](_0x1fe612);}};}function respondWithFilteredResult(_0x2c251e,_0x188e3f){return function(_0x3d1e9d){if(_0x3d1e9d){var _0xcf7f0d=_0x3d1e9d[_0x9c46('0x1c')],_0x2ba416=_0x188e3f[_0x9c46('0x1d')],_0x484702=_0x188e3f['offset']+_0x188e3f[_0x9c46('0x1e')],_0x256bce;if(_0x484702>=_0xcf7f0d){_0x484702=_0xcf7f0d;_0x256bce=0xc8;}else{_0x256bce=0xce;}_0x2c251e['status'](_0x256bce);return _0x2c251e[_0x9c46('0x1f')](_0x9c46('0x20'),_0x2ba416+'-'+_0x484702+'/'+_0xcf7f0d)['json'](_0x3d1e9d);}return null;};}function patchUpdates(_0x2d24d1){return function(_0x3f5d3c){try{jsonpatch['apply'](_0x3f5d3c,_0x2d24d1,!![]);}catch(_0x5c591f){return BPromise[_0x9c46('0x21')](_0x5c591f);}return _0x3f5d3c[_0x9c46('0x22')]();};}function saveUpdates(_0x373e78,_0x4a7e6f){return function(_0x52a233){if(_0x52a233){return _0x52a233[_0x9c46('0x23')](_0x373e78)[_0x9c46('0x24')](function(_0x3e1107){return _0x3e1107;});}return null;};}function removeEntity(_0x321999,_0x2a0c1a){return function(_0x10ff11){if(_0x10ff11){return _0x10ff11[_0x9c46('0x25')]()[_0x9c46('0x24')](function(){_0x321999[_0x9c46('0x1a')](0xcc)[_0x9c46('0x26')]();});}};}function handleEntityNotFound(_0x56f186,_0x45025a){return function(_0x14dcff){if(!_0x14dcff){_0x56f186[_0x9c46('0x27')](0x194);}return _0x14dcff;};}function handleError(_0xb33adb,_0x829da4){_0x829da4=_0x829da4||0x1f4;return function(_0xc385e6){logger[_0x9c46('0x28')](_0xc385e6[_0x9c46('0x29')]);if(_0xc385e6[_0x9c46('0x2a')]){delete _0xc385e6[_0x9c46('0x2a')];}_0xb33adb[_0x9c46('0x1a')](_0x829da4)[_0x9c46('0x2b')](_0xc385e6);};}exports[_0x9c46('0x2c')]=function(_0x4bc4ea,_0x19bb60){var _0x1c4970={},_0x14a1de={},_0x1831e8={'count':0x0,'rows':[]};var _0x1b3e3c=db['VoiceQueueReport'][_0x9c46('0x2d')];_0x14a1de[_0x9c46('0x2e')]=_['keys'](_0x1b3e3c);_0x14a1de[_0x9c46('0x2f')]=_[_0x9c46('0x30')](_0x4bc4ea[_0x9c46('0x2f')]);_0x14a1de[_0x9c46('0x31')]=_[_0x9c46('0x32')](_0x14a1de[_0x9c46('0x2e')],_0x14a1de['query']);_0x1c4970[_0x9c46('0x33')]=_['intersection'](_0x14a1de['model'],qs[_0x9c46('0x34')](_0x4bc4ea['query'][_0x9c46('0x34')]));_0x1c4970[_0x9c46('0x33')]=_0x1c4970[_0x9c46('0x33')][_0x9c46('0x35')]?_0x1c4970[_0x9c46('0x33')]:_0x14a1de[_0x9c46('0x2e')];if(!_0x4bc4ea[_0x9c46('0x2f')][_0x9c46('0x36')](_0x9c46('0x37'))){_0x1c4970[_0x9c46('0x1e')]=qs[_0x9c46('0x1e')](_0x4bc4ea['query'][_0x9c46('0x1e')]);_0x1c4970['offset']=qs['offset'](_0x4bc4ea[_0x9c46('0x2f')][_0x9c46('0x1d')]);}_0x1c4970[_0x9c46('0x38')]=qs[_0x9c46('0x39')](_0x4bc4ea[_0x9c46('0x2f')][_0x9c46('0x39')]);_0x1c4970['where']=qs[_0x9c46('0x31')](_[_0x9c46('0x3a')](_0x4bc4ea[_0x9c46('0x2f')],_0x14a1de['filters']));if(_0x4bc4ea['query'][_0x9c46('0x3b')]){_0x1c4970[_0x9c46('0x3c')]=_[_0x9c46('0x3d')](_0x1c4970[_0x9c46('0x3c')],{'$or':_[_0x9c46('0x3e')](_0x1b3e3c,function(_0x52f635){if(_0x52f635[_0x9c46('0x3f')][_0x9c46('0x40')]!==_0x9c46('0x41')){var _0x2905f5={};_0x2905f5[_0x52f635['field']]={'$like':'%'+_0x4bc4ea[_0x9c46('0x2f')][_0x9c46('0x3b')]+'%'};return _0x2905f5;}})});}_0x1c4970=_[_0x9c46('0x3d')]({},_0x1c4970,_0x4bc4ea[_0x9c46('0x42')]);var _0x5ada85={'where':_0x1c4970[_0x9c46('0x3c')]};return db['VoiceQueueReport'][_0x9c46('0x1c')](_0x5ada85)['then'](function(_0x450b97){_0x1831e8[_0x9c46('0x1c')]=_0x450b97;if(_0x4bc4ea['query']['includeAll']){_0x1c4970[_0x9c46('0x43')]=[{'all':!![]}];}return db[_0x9c46('0x44')][_0x9c46('0x45')](_0x1c4970);})['then'](function(_0x1b159c){_0x1831e8[_0x9c46('0x46')]=_0x1b159c;return _0x1831e8;})['then'](respondWithFilteredResult(_0x19bb60,_0x1c4970))['catch'](handleError(_0x19bb60,null));};exports[_0x9c46('0x47')]=function(_0x3ea26d,_0x431c86){var _0x25424b={'raw':![],'where':{'id':_0x3ea26d[_0x9c46('0x48')]['id']}},_0xd8b639={};_0xd8b639[_0x9c46('0x2e')]=_[_0x9c46('0x30')](db[_0x9c46('0x44')][_0x9c46('0x2d')]);_0xd8b639[_0x9c46('0x2f')]=_[_0x9c46('0x30')](_0x3ea26d[_0x9c46('0x2f')]);_0xd8b639[_0x9c46('0x31')]=_[_0x9c46('0x32')](_0xd8b639[_0x9c46('0x2e')],_0xd8b639[_0x9c46('0x2f')]);_0x25424b['attributes']=_['intersection'](_0xd8b639[_0x9c46('0x2e')],qs[_0x9c46('0x34')](_0x3ea26d['query']['fields']));_0x25424b[_0x9c46('0x33')]=_0x25424b[_0x9c46('0x33')][_0x9c46('0x35')]?_0x25424b[_0x9c46('0x33')]:_0xd8b639['model'];if(_0x3ea26d[_0x9c46('0x2f')]['includeAll']){_0x25424b[_0x9c46('0x43')]=[{'all':!![]}];}_0x25424b=_[_0x9c46('0x3d')]({},_0x25424b,_0x3ea26d[_0x9c46('0x42')]);return db[_0x9c46('0x44')][_0x9c46('0x49')](_0x25424b)[_0x9c46('0x24')](handleEntityNotFound(_0x431c86,null))[_0x9c46('0x24')](respondWithResult(_0x431c86,null))[_0x9c46('0x4a')](handleError(_0x431c86,null));};exports[_0x9c46('0x4b')]=function(_0x40eedf,_0x2554ce){return db[_0x9c46('0x44')][_0x9c46('0x4b')](_0x40eedf[_0x9c46('0x4c')],{})['then'](respondWithResult(_0x2554ce,0xc9))['catch'](handleError(_0x2554ce,null));};exports[_0x9c46('0x23')]=function(_0xfa1cf8,_0x2e4267){if(_0xfa1cf8[_0x9c46('0x4c')]['id']){delete _0xfa1cf8['body']['id'];}return db[_0x9c46('0x44')][_0x9c46('0x49')]({'where':{'id':_0xfa1cf8['params']['id']}})[_0x9c46('0x24')](handleEntityNotFound(_0x2e4267,null))[_0x9c46('0x24')](saveUpdates(_0xfa1cf8['body'],null))[_0x9c46('0x24')](respondWithResult(_0x2e4267,null))['catch'](handleError(_0x2e4267,null));};exports[_0x9c46('0x25')]=function(_0x19f9c2,_0x22ac3b){return db[_0x9c46('0x44')][_0x9c46('0x49')]({'where':{'id':_0x19f9c2['params']['id']}})[_0x9c46('0x24')](handleEntityNotFound(_0x22ac3b,null))[_0x9c46('0x24')](removeEntity(_0x22ac3b,null))[_0x9c46('0x4a')](handleError(_0x22ac3b,null));};exports[_0x9c46('0x4d')]=function(_0x203f6d,_0x18e8e4){return db[_0x9c46('0x44')][_0x9c46('0x4d')]()[_0x9c46('0x24')](respondWithResult(_0x18e8e4,null))[_0x9c46('0x4a')](handleError(_0x18e8e4,null));};exports[_0x9c46('0x4e')]=function(_0x26dad8,_0x56b5af){var _0x51c727={},_0x5cd25b={},_0x4a792a={'count':0x0,'rows':[]};_0x5cd25b[_0x9c46('0x2e')]=_['keys'](db['VoiceQueueReport'][_0x9c46('0x2d')]);_0x5cd25b[_0x9c46('0x2f')]=_[_0x9c46('0x30')](_0x26dad8[_0x9c46('0x2f')]);_0x5cd25b['filters']=_[_0x9c46('0x32')](_0x5cd25b[_0x9c46('0x2e')],_0x5cd25b[_0x9c46('0x2f')]);_0x51c727[_0x9c46('0x33')]=_[_0x9c46('0x32')](_0x5cd25b[_0x9c46('0x2e')],qs[_0x9c46('0x34')](_0x26dad8[_0x9c46('0x2f')]['fields']));_0x51c727[_0x9c46('0x33')]=_0x51c727[_0x9c46('0x33')][_0x9c46('0x35')]?_0x51c727[_0x9c46('0x33')]:_0x5cd25b[_0x9c46('0x2e')];if(!_0x26dad8[_0x9c46('0x2f')][_0x9c46('0x36')](_0x9c46('0x37'))){_0x51c727[_0x9c46('0x1e')]=qs[_0x9c46('0x1e')](_0x26dad8[_0x9c46('0x2f')][_0x9c46('0x1e')]);_0x51c727[_0x9c46('0x1d')]=qs[_0x9c46('0x1d')](_0x26dad8[_0x9c46('0x2f')][_0x9c46('0x1d')]);}_0x51c727[_0x9c46('0x38')]=qs['sort'](_0x26dad8[_0x9c46('0x2f')][_0x9c46('0x39')]);_0x51c727[_0x9c46('0x3c')]=qs[_0x9c46('0x31')](_[_0x9c46('0x3a')](_0x26dad8[_0x9c46('0x2f')],_0x5cd25b[_0x9c46('0x31')]));if(_0x26dad8[_0x9c46('0x2f')][_0x9c46('0x3b')]){_0x51c727['where']=_[_0x9c46('0x3d')](_0x51c727[_0x9c46('0x3c')],{'$or':_[_0x9c46('0x3e')](_0x51c727[_0x9c46('0x33')],function(_0x10d4b4){var _0x5c27b8={};_0x5c27b8[_0x10d4b4]={'$like':'%'+_0x26dad8[_0x9c46('0x2f')][_0x9c46('0x3b')]+'%'};return _0x5c27b8;})});}_0x51c727=_[_0x9c46('0x3d')]({},_0x51c727,_0x26dad8[_0x9c46('0x42')]);var _0x3989f7={'where':_0x51c727[_0x9c46('0x3c')]};return db[_0x9c46('0x44')][_0x9c46('0x1c')](_0x3989f7)['then'](function(_0x11e2f8){_0x4a792a[_0x9c46('0x1c')]=_0x11e2f8;if(_0x26dad8[_0x9c46('0x2f')][_0x9c46('0x4f')]){_0x51c727[_0x9c46('0x43')]=[{'all':!![]}];}return db[_0x9c46('0x44')][_0x9c46('0x45')](_0x51c727);})[_0x9c46('0x24')](function(_0x253348){_0x4a792a[_0x9c46('0x46')]=_0x253348;return _0x4a792a;})[_0x9c46('0x24')](respondWithFilteredResult(_0x56b5af,_0x51c727,_0x9c46('0x4e')))[_0x9c46('0x4a')](handleError(_0x56b5af,null,_0x9c46('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 00c3535..9dace13 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 _0xef84=['hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1aa6cd,_0x43e8ba){var _0x30681d=function(_0x27d7fb){while(--_0x27d7fb){_0x1aa6cd['push'](_0x1aa6cd['shift']());}};_0x30681d(++_0x43e8ba);}(_0xef84,0xf2));var _0x4ef8=function(_0x4cae1e,_0x3447fb){_0x4cae1e=_0x4cae1e-0x0;var _0x17210e=_0xef84[_0x4cae1e];return _0x17210e;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x4ef8('0x0'))['db'][_0x4ef8('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x4ef8('0x2')](0x0);var events={'afterCreate':_0x4ef8('0x3'),'afterUpdate':_0x4ef8('0x4'),'afterDestroy':_0x4ef8('0x5')};function emitEvent(_0x2feeb1){return function(_0x34863e,_0x368044,_0x4d6fec){VoiceQueueReportEvents[_0x4ef8('0x6')](_0x2feeb1+':'+_0x34863e['id'],_0x34863e);VoiceQueueReportEvents[_0x4ef8('0x6')](_0x2feeb1,_0x34863e);_0x4d6fec(null);};}for(var e in events){if(events[_0x4ef8('0x7')](e)){var event=events[e];VoiceQueueReport[_0x4ef8('0x8')](e,emitEvent(event));}}module[_0x4ef8('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x9ff7=['hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit'];(function(_0x3ee7e2,_0x15cf09){var _0x1c1f18=function(_0x3426e0){while(--_0x3426e0){_0x3ee7e2['push'](_0x3ee7e2['shift']());}};_0x1c1f18(++_0x15cf09);}(_0x9ff7,0x110));var _0x79ff=function(_0xa88412,_0x5dfc58){_0xa88412=_0xa88412-0x0;var _0x3e8001=_0x9ff7[_0xa88412];return _0x3e8001;};'use strict';var EventEmitter=require(_0x79ff('0x0'));var VoiceQueueReport=require(_0x79ff('0x1'))['db'][_0x79ff('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x79ff('0x3')](0x0);var events={'afterCreate':_0x79ff('0x4'),'afterUpdate':_0x79ff('0x5'),'afterDestroy':'remove'};function emitEvent(_0xa8cd18){return function(_0x494aef,_0x492c5c,_0x167691){VoiceQueueReportEvents[_0x79ff('0x6')](_0xa8cd18+':'+_0x494aef['id'],_0x494aef);VoiceQueueReportEvents[_0x79ff('0x6')](_0xa8cd18,_0x494aef);_0x167691(null);};}for(var e in events){if(events[_0x79ff('0x7')](e)){var event=events[e];VoiceQueueReport[_0x79ff('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 190e624..27fffd0 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 _0x1f1b=['exports','VoiceQueueReport','report_queue','lodash','util','../../config/logger','api','bluebird','request-promise','./voiceQueueReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f1b,0x71));var _0xb1f1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1f1b[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xb1f1('0x0'));var util=require(_0xb1f1('0x1'));var logger=require(_0xb1f1('0x2'))(_0xb1f1('0x3'));var moment=require('moment');var BPromise=require(_0xb1f1('0x4'));var rp=require(_0xb1f1('0x5'));var attributes=require(_0xb1f1('0x6'));module[_0xb1f1('0x7')]=function(_0x5eab92,_0x1a4465){return _0x5eab92['define'](_0xb1f1('0x8'),attributes,{'tableName':_0xb1f1('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe62a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','define','VoiceQueueReport','report_queue'];(function(_0x8014d8,_0x134a36){var _0x581b7b=function(_0x45c7ce){while(--_0x45c7ce){_0x8014d8['push'](_0x8014d8['shift']());}};_0x581b7b(++_0x134a36);}(_0xe62a,0x12c));var _0xae62=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe62a[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xae62('0x0'));var util=require(_0xae62('0x1'));var logger=require(_0xae62('0x2'))(_0xae62('0x3'));var moment=require(_0xae62('0x4'));var BPromise=require(_0xae62('0x5'));var rp=require(_0xae62('0x6'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x189866,_0x30d17b){return _0x189866[_0xae62('0x7')](_0xae62('0x8'),attributes,{'tableName':_0xae62('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 39bd196..425b65d 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 _0xdd19=['GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','map','attributes','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0xdd19,0x87));var _0x9dd1=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xdd19[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x9dd1('0x0'));var util=require(_0x9dd1('0x1'));var moment=require(_0x9dd1('0x2'));var BPromise=require(_0x9dd1('0x3'));var rs=require(_0x9dd1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9dd1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9dd1('0x6'));var jayson=require(_0x9dd1('0x7'));var client=jayson[_0x9dd1('0x8')][_0x9dd1('0x9')]({'port':0x232a});config[_0x9dd1('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9dd1('0xb'))(new Redis(config[_0x9dd1('0xa')]));require('./voiceQueueReport.socket')[_0x9dd1('0xc')](socket);function respondWithRpcPromise(_0x1e4c3f,_0x2df888,_0x693ba9){return new BPromise(function(_0x22c641,_0x234649){return client[_0x9dd1('0xd')](_0x1e4c3f,_0x693ba9)[_0x9dd1('0xe')](function(_0x35accc){logger[_0x9dd1('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x2df888,_0x9dd1('0x10'));logger[_0x9dd1('0x11')](_0x9dd1('0x12'),_0x2df888,_0x9dd1('0x10'),JSON[_0x9dd1('0x13')](_0x35accc));if(_0x35accc['error']){if(_0x35accc[_0x9dd1('0x14')][_0x9dd1('0x15')]===0x1f4){logger[_0x9dd1('0x14')](_0x9dd1('0x16'),_0x2df888,_0x35accc[_0x9dd1('0x14')][_0x9dd1('0x17')]);return _0x234649(_0x35accc[_0x9dd1('0x14')][_0x9dd1('0x17')]);}logger[_0x9dd1('0x14')](_0x9dd1('0x16'),_0x2df888,_0x35accc[_0x9dd1('0x14')][_0x9dd1('0x17')]);return _0x22c641(_0x35accc[_0x9dd1('0x14')][_0x9dd1('0x17')]);}else{logger[_0x9dd1('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x2df888,_0x9dd1('0x10'));_0x22c641(_0x35accc['result'][_0x9dd1('0x17')]);}})[_0x9dd1('0x18')](function(_0x2bc9d3){logger['error'](_0x9dd1('0x16'),_0x2df888,_0x2bc9d3);_0x234649(_0x2bc9d3);});});}exports[_0x9dd1('0x19')]=function(_0x12d18a){var _0x4f19a0=this;return new Promise(function(_0x456456,_0x312828){return db[_0x9dd1('0x1a')][_0x9dd1('0x1b')]({'raw':_0x12d18a['options']?_0x12d18a[_0x9dd1('0x1c')][_0x9dd1('0x1d')]===undefined?!![]:![]:!![],'where':_0x12d18a[_0x9dd1('0x1c')]?_0x12d18a[_0x9dd1('0x1c')][_0x9dd1('0x1e')]||null:null,'attributes':_0x12d18a[_0x9dd1('0x1c')]?_0x12d18a[_0x9dd1('0x1c')]['attributes']||null:null,'limit':_0x12d18a[_0x9dd1('0x1c')]?_0x12d18a['options'][_0x9dd1('0x1f')]||null:null,'include':_0x12d18a[_0x9dd1('0x1c')]?_0x12d18a[_0x9dd1('0x1c')]['include']?_[_0x9dd1('0x20')](_0x12d18a[_0x9dd1('0x1c')]['include'],function(_0x1bc297){return{'model':db[_0x1bc297['model']],'as':_0x1bc297['as'],'attributes':_0x1bc297[_0x9dd1('0x21')],'include':_0x1bc297['include']?_[_0x9dd1('0x20')](_0x1bc297['include'],function(_0x263554){return{'model':db[_0x263554[_0x9dd1('0x22')]],'as':_0x263554['as'],'attributes':_0x263554[_0x9dd1('0x21')],'include':_0x263554['include']?_[_0x9dd1('0x20')](_0x263554['include'],function(_0x455c0f){return{'model':db[_0x455c0f[_0x9dd1('0x22')]],'as':_0x455c0f['as'],'attributes':_0x455c0f[_0x9dd1('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5325ae){logger[_0x9dd1('0xf')]('GetVoiceQueueReport',_0x12d18a);logger[_0x9dd1('0x11')](_0x9dd1('0x19'),_0x12d18a,JSON[_0x9dd1('0x13')](_0x5325ae));_0x456456(_0x5325ae);})[_0x9dd1('0x18')](function(_0x157a9c){logger['error']('GetVoiceQueueReport',_0x157a9c[_0x9dd1('0x17')],_0x12d18a);_0x312828(_0x4f19a0['error'](0x1f4,_0x157a9c['message']));});});};exports[_0x9dd1('0x23')]=function(_0x5ea8f4){var _0x423bff=this;return new Promise(function(_0x20edc4,_0xf6afe0){return db[_0x9dd1('0x1a')][_0x9dd1('0x24')](_0x5ea8f4[_0x9dd1('0x25')],{'raw':_0x5ea8f4['options']?_0x5ea8f4[_0x9dd1('0x1c')][_0x9dd1('0x1d')]===undefined?!![]:![]:!![]})[_0x9dd1('0xe')](function(_0x514d14){logger[_0x9dd1('0xf')]('CreateVoiceQueueReport',_0x5ea8f4);logger[_0x9dd1('0x11')](_0x9dd1('0x23'),_0x5ea8f4,JSON[_0x9dd1('0x13')](_0x514d14));_0x20edc4(_0x514d14);})['catch'](function(_0x5056d8){logger[_0x9dd1('0x14')](_0x9dd1('0x23'),_0x5056d8[_0x9dd1('0x17')],_0x5ea8f4);_0xf6afe0(_0x423bff[_0x9dd1('0x14')](0x1f4,_0x5056d8[_0x9dd1('0x17')]));});});};exports[_0x9dd1('0x26')]=function(_0x54c69a){var _0x30664e=this;return new Promise(function(_0x4cc008,_0x1940fe){return db['VoiceQueueReport'][_0x9dd1('0x27')](_0x54c69a[_0x9dd1('0x25')],{'raw':_0x54c69a[_0x9dd1('0x1c')]?_0x54c69a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54c69a[_0x9dd1('0x1c')]?_0x54c69a[_0x9dd1('0x1c')][_0x9dd1('0x1e')]||null:null,'attributes':_0x54c69a['options']?_0x54c69a['options']['attributes']||null:null,'limit':_0x54c69a[_0x9dd1('0x1c')]?_0x54c69a[_0x9dd1('0x1c')][_0x9dd1('0x1f')]||null:null})[_0x9dd1('0xe')](function(_0xc873de){logger['info'](_0x9dd1('0x26'),_0x54c69a);logger[_0x9dd1('0x11')](_0x9dd1('0x26'),_0x54c69a,JSON[_0x9dd1('0x13')](_0xc873de));_0x4cc008(_0xc873de);})[_0x9dd1('0x18')](function(_0x3d4781){logger[_0x9dd1('0x14')]('UpdateVoiceQueueReport',_0x3d4781[_0x9dd1('0x17')],_0x54c69a);_0x1940fe(_0x30664e['error'](0x1f4,_0x3d4781[_0x9dd1('0x17')]));});});}; \ No newline at end of file +var _0x70d0=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VoiceQueueReport','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','body','stringify','update','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','ioredis'];(function(_0x3cd83e,_0x45831b){var _0x581f3c=function(_0x24f6cd){while(--_0x24f6cd){_0x3cd83e['push'](_0x3cd83e['shift']());}};_0x581f3c(++_0x45831b);}(_0x70d0,0x79));var _0x070d=function(_0x3cf387,_0x31ed26){_0x3cf387=_0x3cf387-0x0;var _0x24425f=_0x70d0[_0x3cf387];return _0x24425f;};'use strict';var _=require('lodash');var util=require(_0x070d('0x0'));var moment=require(_0x070d('0x1'));var BPromise=require(_0x070d('0x2'));var rs=require(_0x070d('0x3'));var fs=require('fs');var Redis=require(_0x070d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x070d('0x5'))(_0x070d('0x6'));var config=require(_0x070d('0x7'));var jayson=require(_0x070d('0x8'));var client=jayson[_0x070d('0x9')][_0x070d('0xa')]({'port':0x232a});config['redis']=_[_0x070d('0xb')](config[_0x070d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x070d('0xd'))(new Redis(config['redis']));require(_0x070d('0xe'))['register'](socket);function respondWithRpcPromise(_0x2e4f97,_0x3c70f3,_0x3058a1){return new BPromise(function(_0x19e84f,_0x810eb4){return client[_0x070d('0xf')](_0x2e4f97,_0x3058a1)[_0x070d('0x10')](function(_0x3df3cb){logger[_0x070d('0x11')](_0x070d('0x12'),_0x3c70f3,'request\x20sent');logger[_0x070d('0x13')](_0x070d('0x14'),_0x3c70f3,_0x070d('0x15'),JSON['stringify'](_0x3df3cb));if(_0x3df3cb[_0x070d('0x16')]){if(_0x3df3cb[_0x070d('0x16')][_0x070d('0x17')]===0x1f4){logger[_0x070d('0x16')](_0x070d('0x12'),_0x3c70f3,_0x3df3cb[_0x070d('0x16')][_0x070d('0x18')]);return _0x810eb4(_0x3df3cb[_0x070d('0x16')]['message']);}logger[_0x070d('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x3c70f3,_0x3df3cb[_0x070d('0x16')][_0x070d('0x18')]);return _0x19e84f(_0x3df3cb['error'][_0x070d('0x18')]);}else{logger[_0x070d('0x11')](_0x070d('0x12'),_0x3c70f3,_0x070d('0x15'));_0x19e84f(_0x3df3cb[_0x070d('0x19')]['message']);}})[_0x070d('0x1a')](function(_0x44672f){logger[_0x070d('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x3c70f3,_0x44672f);_0x810eb4(_0x44672f);});});}exports['GetVoiceQueueReport']=function(_0x401cfb){var _0x26dfc3=this;return new Promise(function(_0x2837e6,_0xa0a7aa){return db[_0x070d('0x1b')]['findAll']({'raw':_0x401cfb['options']?_0x401cfb[_0x070d('0x1c')][_0x070d('0x1d')]===undefined?!![]:![]:!![],'where':_0x401cfb[_0x070d('0x1c')]?_0x401cfb[_0x070d('0x1c')][_0x070d('0x1e')]||null:null,'attributes':_0x401cfb['options']?_0x401cfb[_0x070d('0x1c')][_0x070d('0x1f')]||null:null,'limit':_0x401cfb[_0x070d('0x1c')]?_0x401cfb[_0x070d('0x1c')][_0x070d('0x20')]||null:null,'include':_0x401cfb[_0x070d('0x1c')]?_0x401cfb[_0x070d('0x1c')][_0x070d('0x21')]?_[_0x070d('0x22')](_0x401cfb[_0x070d('0x1c')][_0x070d('0x21')],function(_0x189c90){return{'model':db[_0x189c90[_0x070d('0x23')]],'as':_0x189c90['as'],'attributes':_0x189c90['attributes'],'include':_0x189c90['include']?_[_0x070d('0x22')](_0x189c90[_0x070d('0x21')],function(_0x257042){return{'model':db[_0x257042[_0x070d('0x23')]],'as':_0x257042['as'],'attributes':_0x257042['attributes'],'include':_0x257042[_0x070d('0x21')]?_[_0x070d('0x22')](_0x257042[_0x070d('0x21')],function(_0x49f5d0){return{'model':db[_0x49f5d0[_0x070d('0x23')]],'as':_0x49f5d0['as'],'attributes':_0x49f5d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x070d('0x10')](function(_0x34bf4a){logger[_0x070d('0x11')](_0x070d('0x24'),_0x401cfb);logger[_0x070d('0x13')](_0x070d('0x24'),_0x401cfb,JSON['stringify'](_0x34bf4a));_0x2837e6(_0x34bf4a);})[_0x070d('0x1a')](function(_0x9113c9){logger[_0x070d('0x16')](_0x070d('0x24'),_0x9113c9[_0x070d('0x18')],_0x401cfb);_0xa0a7aa(_0x26dfc3['error'](0x1f4,_0x9113c9[_0x070d('0x18')]));});});};exports[_0x070d('0x25')]=function(_0x6d4ab6){var _0x44db2e=this;return new Promise(function(_0x514642,_0x54bbab){return db[_0x070d('0x1b')]['create'](_0x6d4ab6[_0x070d('0x26')],{'raw':_0x6d4ab6[_0x070d('0x1c')]?_0x6d4ab6[_0x070d('0x1c')][_0x070d('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x283c2b){logger[_0x070d('0x11')](_0x070d('0x25'),_0x6d4ab6);logger[_0x070d('0x13')]('CreateVoiceQueueReport',_0x6d4ab6,JSON[_0x070d('0x27')](_0x283c2b));_0x514642(_0x283c2b);})[_0x070d('0x1a')](function(_0xf86050){logger[_0x070d('0x16')](_0x070d('0x25'),_0xf86050[_0x070d('0x18')],_0x6d4ab6);_0x54bbab(_0x44db2e[_0x070d('0x16')](0x1f4,_0xf86050['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x16a778){var _0x2f708f=this;return new Promise(function(_0x108685,_0x1bc1de){return db['VoiceQueueReport'][_0x070d('0x28')](_0x16a778[_0x070d('0x26')],{'raw':_0x16a778[_0x070d('0x1c')]?_0x16a778[_0x070d('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16a778['options']?_0x16a778[_0x070d('0x1c')][_0x070d('0x1e')]||null:null,'attributes':_0x16a778[_0x070d('0x1c')]?_0x16a778[_0x070d('0x1c')][_0x070d('0x1f')]||null:null,'limit':_0x16a778['options']?_0x16a778['options'][_0x070d('0x20')]||null:null})['then'](function(_0x51e243){logger['info'](_0x070d('0x29'),_0x16a778);logger['debug'](_0x070d('0x29'),_0x16a778,JSON[_0x070d('0x27')](_0x51e243));_0x108685(_0x51e243);})[_0x070d('0x1a')](function(_0x6c741b){logger[_0x070d('0x16')]('UpdateVoiceQueueReport',_0x6c741b[_0x070d('0x18')],_0x16a778);_0x1bc1de(_0x2f708f[_0x070d('0x16')](0x1f4,_0x6c741b[_0x070d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 2aa3477..3b2563a 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 _0x593b=['register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0xc9ddb1,_0x31f0ec){var _0xf5e4ed=function(_0x2ca958){while(--_0x2ca958){_0xc9ddb1['push'](_0xc9ddb1['shift']());}};_0xf5e4ed(++_0x31f0ec);}(_0x593b,0xba));var _0xb593=function(_0xace6cb,_0xcc4234){_0xace6cb=_0xace6cb-0x0;var _0x28d053=_0x593b[_0xace6cb];return _0x28d053;};'use strict';var VoiceQueueReportEvents=require(_0xb593('0x0'));var events=[_0xb593('0x1'),_0xb593('0x2'),_0xb593('0x3')];function createListener(_0x1043cc,_0x4d1558){return function(_0xf80d7a){_0x4d1558[_0xb593('0x4')](_0x1043cc,_0xf80d7a);};}function removeListener(_0x3a701b,_0x565804){return function(){VoiceQueueReportEvents[_0xb593('0x5')](_0x3a701b,_0x565804);};}exports[_0xb593('0x6')]=function(_0x568580){for(var _0x187cfd=0x0,_0x831ba8=events['length'];_0x187cfd<_0x831ba8;_0x187cfd++){var _0x1e17af=events[_0x187cfd];var _0x415eef=createListener(_0xb593('0x7')+_0x1e17af,_0x568580);VoiceQueueReportEvents['on'](_0x1e17af,_0x415eef);}}; \ No newline at end of file +var _0xa8b1=['remove','update','emit','register','length','save'];(function(_0x236209,_0x51b840){var _0x2afd5b=function(_0x15b5d6){while(--_0x15b5d6){_0x236209['push'](_0x236209['shift']());}};_0x2afd5b(++_0x51b840);}(_0xa8b1,0xd7));var _0x1a8b=function(_0x3389a3,_0x34a8){_0x3389a3=_0x3389a3-0x0;var _0x3c1845=_0xa8b1[_0x3389a3];return _0x3c1845;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x1a8b('0x0'),_0x1a8b('0x1'),_0x1a8b('0x2')];function createListener(_0x45639d,_0x17cccf){return function(_0x366ce7){_0x17cccf[_0x1a8b('0x3')](_0x45639d,_0x366ce7);};}function removeListener(_0x2d7428,_0x1bd8cd){return function(){VoiceQueueReportEvents['removeListener'](_0x2d7428,_0x1bd8cd);};}exports[_0x1a8b('0x4')]=function(_0x1da8c6){for(var _0x51f893=0x0,_0x4d30f6=events[_0x1a8b('0x5')];_0x51f893<_0x4d30f6;_0x51f893++){var _0x16ea06=events[_0x51f893];var _0x5c12a0=createListener('voiceQueueReport:'+_0x16ea06,_0x1da8c6);VoiceQueueReportEvents['on'](_0x16ea06,_0x5c12a0);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 1a70d73..8a12eef 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 _0x8921=['create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post'];(function(_0x1dba08,_0x3982d7){var _0x1a23fa=function(_0x230fd7){while(--_0x230fd7){_0x1dba08['push'](_0x1dba08['shift']());}};_0x1a23fa(++_0x3982d7);}(_0x8921,0x9a));var _0x1892=function(_0x5860de,_0xd400ee){_0x5860de=_0x5860de-0x0;var _0x234c33=_0x8921[_0x5860de];return _0x234c33;};'use strict';var multer=require(_0x1892('0x0'));var util=require('util');var path=require(_0x1892('0x1'));var timeout=require(_0x1892('0x2'));var express=require(_0x1892('0x3'));var router=express[_0x1892('0x4')]();var auth=require(_0x1892('0x5'));var interaction=require(_0x1892('0x6'));var config=require(_0x1892('0x7'));var controller=require(_0x1892('0x8'));router[_0x1892('0x9')]('/',auth[_0x1892('0xa')](),controller[_0x1892('0xb')]);router[_0x1892('0x9')]('/:id',auth[_0x1892('0xa')](),controller[_0x1892('0xc')]);router[_0x1892('0xd')]('/',auth[_0x1892('0xa')](),controller[_0x1892('0xe')]);router[_0x1892('0xf')]('/:id',auth[_0x1892('0xa')](),controller[_0x1892('0x10')]);router[_0x1892('0x11')](_0x1892('0x12'),auth[_0x1892('0xa')](),controller[_0x1892('0x13')]);module[_0x1892('0x14')]=router; \ No newline at end of file +var _0x6209=['Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x49c3e4,_0x138882){var _0x26f6e2=function(_0x2b66e7){while(--_0x2b66e7){_0x49c3e4['push'](_0x49c3e4['shift']());}};_0x26f6e2(++_0x138882);}(_0x6209,0x1e8));var _0x9620=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6209[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x9620('0x0'));var util=require(_0x9620('0x1'));var path=require(_0x9620('0x2'));var timeout=require(_0x9620('0x3'));var express=require(_0x9620('0x4'));var router=express[_0x9620('0x5')]();var auth=require(_0x9620('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9620('0x7'));var controller=require(_0x9620('0x8'));router[_0x9620('0x9')]('/',auth['isAuthenticated'](),controller[_0x9620('0xa')]);router[_0x9620('0x9')](_0x9620('0xb'),auth[_0x9620('0xc')](),controller['show']);router['post']('/',auth[_0x9620('0xc')](),controller['create']);router[_0x9620('0xd')](_0x9620('0xb'),auth[_0x9620('0xc')](),controller[_0x9620('0xe')]);router[_0x9620('0xf')](_0x9620('0xb'),auth[_0x9620('0xc')](),controller['destroy']);module[_0x9620('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index eef90f7..8704c35 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 _0x008c=['DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING'];(function(_0x31f5b0,_0x3ceb60){var _0x25dfd3=function(_0x4f81da){while(--_0x4f81da){_0x31f5b0['push'](_0x31f5b0['shift']());}};_0x25dfd3(++_0x3ceb60);}(_0x008c,0x188));var _0xc008=function(_0x43b4b5,_0x3efc1b){_0x43b4b5=_0x43b4b5-0x0;var _0x2df432=_0x008c[_0x43b4b5];return _0x2df432;};'use strict';var Sequelize=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));module[_0xc008('0x2')]={'time':{'type':Sequelize[_0xc008('0x3')]},'callid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc008('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc008('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc008('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc008('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc008('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc008('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc008('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc008('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc008('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0xc008('0x5'))}}; \ No newline at end of file +var _0xae24=['format','sequelize','exports','STRING','DATE'];(function(_0x42070c,_0x2d9af3){var _0xcda4e3=function(_0x3be997){while(--_0x3be997){_0x42070c['push'](_0x42070c['shift']());}};_0xcda4e3(++_0x2d9af3);}(_0xae24,0x182));var _0x4ae2=function(_0x5172d4,_0x1f9714){_0x5172d4=_0x5172d4-0x0;var _0x219ef8=_0xae24[_0x5172d4];return _0x219ef8;};'use strict';var Sequelize=require(_0x4ae2('0x0'));var moment=require('moment');module[_0x4ae2('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x4ae2('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4ae2('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4ae2('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4ae2('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4ae2('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4ae2('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4ae2('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4ae2('0x3')],'allowNull':![],'defaultValue':moment()[_0x4ae2('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 1cae953..3fc45dd 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 _0xce29=['path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','key','options','count','includeAll','include','findAll','rows','params','intersection','find','catch','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xce29,0x8b));var _0x9ce2=function(_0x4ccdc5,_0x3fead5){_0x4ccdc5=_0x4ccdc5-0x0;var _0x10442b=_0xce29[_0x4ccdc5];return _0x10442b;};'use strict';var pdf=require(_0x9ce2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9ce2('0x1'));var zipdir=require(_0x9ce2('0x2'));var jsonpatch=require(_0x9ce2('0x3'));var rp=require(_0x9ce2('0x4'));var moment=require(_0x9ce2('0x5'));var BPromise=require(_0x9ce2('0x6'));var Mustache=require(_0x9ce2('0x7'));var util=require(_0x9ce2('0x8'));var path=require(_0x9ce2('0x9'));var sox=require(_0x9ce2('0xa'));var csv=require(_0x9ce2('0xb'));var ejs=require(_0x9ce2('0xc'));var fs=require('fs');var _=require(_0x9ce2('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ce2('0xe'));var deskjs=require(_0x9ce2('0xf'));var toCsv=require(_0x9ce2('0xb'));var querystring=require(_0x9ce2('0x10'));var Papa=require(_0x9ce2('0x11'));var authService=require(_0x9ce2('0x12'));var hardwareService=require(_0x9ce2('0x13'));var Redis=require(_0x9ce2('0x14'));var qs=require(_0x9ce2('0x15'));var logger=require('../../config/logger')(_0x9ce2('0x16'));var utils=require(_0x9ce2('0x17'));var config=require(_0x9ce2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x525db7,_0x57c3e2){_0x57c3e2=_0x57c3e2||0xcc;return function(_0x8344ff){if(_0x8344ff){return _0x525db7[_0x9ce2('0x19')](_0x57c3e2);}return _0x525db7[_0x9ce2('0x1a')](_0x57c3e2)[_0x9ce2('0x1b')]();};}function respondWithResult(_0x2a2d14,_0x43a9e2){_0x43a9e2=_0x43a9e2||0xc8;return function(_0x59e3c8){if(_0x59e3c8){return _0x2a2d14[_0x9ce2('0x1a')](_0x43a9e2)['json'](_0x59e3c8);}};}function respondWithFilteredResult(_0x34e809,_0xa432c8){return function(_0x4c9ac0){if(_0x4c9ac0){var _0x3b2a3e=_0x4c9ac0['count'],_0x648b15=_0xa432c8[_0x9ce2('0x1c')],_0x1c6505=_0xa432c8['offset']+_0xa432c8[_0x9ce2('0x1d')],_0xa49c83;if(_0x1c6505>=_0x3b2a3e){_0x1c6505=_0x3b2a3e;_0xa49c83=0xc8;}else{_0xa49c83=0xce;}_0x34e809['status'](_0xa49c83);return _0x34e809['set'](_0x9ce2('0x1e'),_0x648b15+'-'+_0x1c6505+'/'+_0x3b2a3e)[_0x9ce2('0x1f')](_0x4c9ac0);}return null;};}function patchUpdates(_0x507c5f){return function(_0x4bc6d7){try{jsonpatch[_0x9ce2('0x20')](_0x4bc6d7,_0x507c5f,!![]);}catch(_0x332048){return BPromise['reject'](_0x332048);}return _0x4bc6d7[_0x9ce2('0x21')]();};}function saveUpdates(_0x36631b,_0x3e8d3d){return function(_0x2aa2dd){if(_0x2aa2dd){return _0x2aa2dd[_0x9ce2('0x22')](_0x36631b)['then'](function(_0x14906d){return _0x14906d;});}return null;};}function removeEntity(_0x6ff936,_0x55c718){return function(_0x109df2){if(_0x109df2){return _0x109df2[_0x9ce2('0x23')]()[_0x9ce2('0x24')](function(){_0x6ff936[_0x9ce2('0x1a')](0xcc)[_0x9ce2('0x1b')]();});}};}function handleEntityNotFound(_0x5387ce,_0x5cc699){return function(_0x311620){if(!_0x311620){_0x5387ce[_0x9ce2('0x19')](0x194);}return _0x311620;};}function handleError(_0x2b5571,_0x34aca1){_0x34aca1=_0x34aca1||0x1f4;return function(_0x49c6e7){logger[_0x9ce2('0x25')](_0x49c6e7[_0x9ce2('0x26')]);if(_0x49c6e7[_0x9ce2('0x27')]){delete _0x49c6e7[_0x9ce2('0x27')];}_0x2b5571[_0x9ce2('0x1a')](_0x34aca1)[_0x9ce2('0x28')](_0x49c6e7);};}exports[_0x9ce2('0x29')]=function(_0x5df715,_0x58d48f){var _0x2c9ee8={},_0x2f7d7a={},_0x89d17a={'count':0x0,'rows':[]};var _0x87ded0=db[_0x9ce2('0x2a')][_0x9ce2('0x2b')];_0x2f7d7a[_0x9ce2('0x2c')]=_['keys'](_0x87ded0);_0x2f7d7a[_0x9ce2('0x2d')]=_[_0x9ce2('0x2e')](_0x5df715[_0x9ce2('0x2d')]);_0x2f7d7a[_0x9ce2('0x2f')]=_['intersection'](_0x2f7d7a[_0x9ce2('0x2c')],_0x2f7d7a['query']);_0x2c9ee8[_0x9ce2('0x30')]=_['intersection'](_0x2f7d7a[_0x9ce2('0x2c')],qs[_0x9ce2('0x31')](_0x5df715['query'][_0x9ce2('0x31')]));_0x2c9ee8[_0x9ce2('0x30')]=_0x2c9ee8['attributes'][_0x9ce2('0x32')]?_0x2c9ee8['attributes']:_0x2f7d7a['model'];if(!_0x5df715[_0x9ce2('0x2d')][_0x9ce2('0x33')](_0x9ce2('0x34'))){_0x2c9ee8['limit']=qs[_0x9ce2('0x1d')](_0x5df715[_0x9ce2('0x2d')][_0x9ce2('0x1d')]);_0x2c9ee8[_0x9ce2('0x1c')]=qs['offset'](_0x5df715[_0x9ce2('0x2d')][_0x9ce2('0x1c')]);}_0x2c9ee8[_0x9ce2('0x35')]=qs[_0x9ce2('0x36')](_0x5df715[_0x9ce2('0x2d')][_0x9ce2('0x36')]);_0x2c9ee8['where']=qs[_0x9ce2('0x2f')](_[_0x9ce2('0x37')](_0x5df715[_0x9ce2('0x2d')],_0x2f7d7a[_0x9ce2('0x2f')]));if(_0x5df715[_0x9ce2('0x2d')][_0x9ce2('0x38')]){_0x2c9ee8[_0x9ce2('0x39')]=_[_0x9ce2('0x3a')](_0x2c9ee8['where'],{'$or':_[_0x9ce2('0x3b')](_0x87ded0,function(_0xf93f9f){if(_0xf93f9f[_0x9ce2('0x3c')][_0x9ce2('0x3d')]!=='VIRTUAL'){var _0x53d1b4={};_0x53d1b4[_0xf93f9f['field']]={'$like':'%'+_0x5df715['query'][_0x9ce2('0x38')]+'%'};return _0x53d1b4;}})});}_0x2c9ee8=_[_0x9ce2('0x3a')]({},_0x2c9ee8,_0x5df715[_0x9ce2('0x3e')]);var _0x272d69={'where':_0x2c9ee8[_0x9ce2('0x39')]};return db[_0x9ce2('0x2a')]['count'](_0x272d69)[_0x9ce2('0x24')](function(_0x202ef8){_0x89d17a[_0x9ce2('0x3f')]=_0x202ef8;if(_0x5df715['query'][_0x9ce2('0x40')]){_0x2c9ee8[_0x9ce2('0x41')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x9ce2('0x42')](_0x2c9ee8);})[_0x9ce2('0x24')](function(_0x2600f3){_0x89d17a[_0x9ce2('0x43')]=_0x2600f3;return _0x89d17a;})[_0x9ce2('0x24')](respondWithFilteredResult(_0x58d48f,_0x2c9ee8))['catch'](handleError(_0x58d48f,null));};exports['show']=function(_0x305694,_0x5419a0){var _0x290550={'raw':!![],'where':{'id':_0x305694[_0x9ce2('0x44')]['id']}},_0x21164b={};_0x21164b[_0x9ce2('0x2c')]=_[_0x9ce2('0x2e')](db[_0x9ce2('0x2a')][_0x9ce2('0x2b')]);_0x21164b[_0x9ce2('0x2d')]=_[_0x9ce2('0x2e')](_0x305694[_0x9ce2('0x2d')]);_0x21164b['filters']=_[_0x9ce2('0x45')](_0x21164b[_0x9ce2('0x2c')],_0x21164b[_0x9ce2('0x2d')]);_0x290550[_0x9ce2('0x30')]=_[_0x9ce2('0x45')](_0x21164b[_0x9ce2('0x2c')],qs[_0x9ce2('0x31')](_0x305694[_0x9ce2('0x2d')][_0x9ce2('0x31')]));_0x290550[_0x9ce2('0x30')]=_0x290550[_0x9ce2('0x30')][_0x9ce2('0x32')]?_0x290550[_0x9ce2('0x30')]:_0x21164b['model'];if(_0x305694['query'][_0x9ce2('0x40')]){_0x290550[_0x9ce2('0x41')]=[{'all':!![]}];}_0x290550=_[_0x9ce2('0x3a')]({},_0x290550,_0x305694['options']);return db['VoiceQueuesLog'][_0x9ce2('0x46')](_0x290550)[_0x9ce2('0x24')](handleEntityNotFound(_0x5419a0,null))[_0x9ce2('0x24')](respondWithResult(_0x5419a0,null))[_0x9ce2('0x47')](handleError(_0x5419a0,null));};exports['create']=function(_0x480aa7,_0x18cf50){return db[_0x9ce2('0x2a')][_0x9ce2('0x48')](_0x480aa7[_0x9ce2('0x49')],{})['then'](respondWithResult(_0x18cf50,0xc9))[_0x9ce2('0x47')](handleError(_0x18cf50,null));};exports[_0x9ce2('0x22')]=function(_0x4f1bc3,_0x1867f3){if(_0x4f1bc3[_0x9ce2('0x49')]['id']){delete _0x4f1bc3[_0x9ce2('0x49')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x4f1bc3[_0x9ce2('0x44')]['id']}})[_0x9ce2('0x24')](handleEntityNotFound(_0x1867f3,null))['then'](saveUpdates(_0x4f1bc3[_0x9ce2('0x49')],null))['then'](respondWithResult(_0x1867f3,null))[_0x9ce2('0x47')](handleError(_0x1867f3,null));};exports[_0x9ce2('0x23')]=function(_0x3b362a,_0x343f82){return db[_0x9ce2('0x2a')]['find']({'where':{'id':_0x3b362a[_0x9ce2('0x44')]['id']}})[_0x9ce2('0x24')](handleEntityNotFound(_0x343f82,null))[_0x9ce2('0x24')](removeEntity(_0x343f82,null))[_0x9ce2('0x47')](handleError(_0x343f82,null));}; \ No newline at end of file +var _0xb81b=['body','params','destroy','find','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','save','update','then','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','map','key','VIRTUAL','field','merge','options','count','includeAll','include','findAll','rows','show','catch','create'];(function(_0x308106,_0x21dd2c){var _0x4eb491=function(_0xcf6b61){while(--_0xcf6b61){_0x308106['push'](_0x308106['shift']());}};_0x4eb491(++_0x21dd2c);}(_0xb81b,0x15d));var _0xbb81=function(_0x407e6b,_0x311190){_0x407e6b=_0x407e6b-0x0;var _0x528c08=_0xb81b[_0x407e6b];return _0x528c08;};'use strict';var pdf=require(_0xbb81('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbb81('0x1'));var jsonpatch=require(_0xbb81('0x2'));var rp=require(_0xbb81('0x3'));var moment=require('moment');var BPromise=require(_0xbb81('0x4'));var Mustache=require('mustache');var util=require(_0xbb81('0x5'));var path=require(_0xbb81('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb81('0x7'));var fs=require('fs');var _=require(_0xbb81('0x8'));var squel=require('squel');var crypto=require(_0xbb81('0x9'));var jsforce=require(_0xbb81('0xa'));var deskjs=require(_0xbb81('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbb81('0xc'));var Papa=require('papaparse');var authService=require(_0xbb81('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0xbb81('0xe'));var logger=require('../../config/logger')(_0xbb81('0xf'));var utils=require(_0xbb81('0x10'));var config=require(_0xbb81('0x11'));var db=require(_0xbb81('0x12'))['db'];function respondWithStatusCode(_0x536451,_0x18a79d){_0x18a79d=_0x18a79d||0xcc;return function(_0x4e44e2){if(_0x4e44e2){return _0x536451[_0xbb81('0x13')](_0x18a79d);}return _0x536451[_0xbb81('0x14')](_0x18a79d)[_0xbb81('0x15')]();};}function respondWithResult(_0x4b8fba,_0xe3d1fc){_0xe3d1fc=_0xe3d1fc||0xc8;return function(_0x14869c){if(_0x14869c){return _0x4b8fba[_0xbb81('0x14')](_0xe3d1fc)['json'](_0x14869c);}};}function respondWithFilteredResult(_0x2564df,_0x42825d){return function(_0x27b3d8){if(_0x27b3d8){var _0x3d741d=_0x27b3d8['count'],_0x2dbccf=_0x42825d[_0xbb81('0x16')],_0x3c37a9=_0x42825d['offset']+_0x42825d[_0xbb81('0x17')],_0x3d59e7;if(_0x3c37a9>=_0x3d741d){_0x3c37a9=_0x3d741d;_0x3d59e7=0xc8;}else{_0x3d59e7=0xce;}_0x2564df[_0xbb81('0x14')](_0x3d59e7);return _0x2564df[_0xbb81('0x18')](_0xbb81('0x19'),_0x2dbccf+'-'+_0x3c37a9+'/'+_0x3d741d)[_0xbb81('0x1a')](_0x27b3d8);}return null;};}function patchUpdates(_0x2b603d){return function(_0x5b6a9f){try{jsonpatch['apply'](_0x5b6a9f,_0x2b603d,!![]);}catch(_0x516d3e){return BPromise['reject'](_0x516d3e);}return _0x5b6a9f[_0xbb81('0x1b')]();};}function saveUpdates(_0x57d3ca,_0x1a86ed){return function(_0x43801c){if(_0x43801c){return _0x43801c[_0xbb81('0x1c')](_0x57d3ca)['then'](function(_0x261895){return _0x261895;});}return null;};}function removeEntity(_0x15f229,_0x375a36){return function(_0xb434a3){if(_0xb434a3){return _0xb434a3['destroy']()[_0xbb81('0x1d')](function(){_0x15f229[_0xbb81('0x14')](0xcc)[_0xbb81('0x15')]();});}};}function handleEntityNotFound(_0x4973c6,_0xe65309){return function(_0x4d64e5){if(!_0x4d64e5){_0x4973c6[_0xbb81('0x13')](0x194);}return _0x4d64e5;};}function handleError(_0x5a2a49,_0x35cfb6){_0x35cfb6=_0x35cfb6||0x1f4;return function(_0x24b832){logger[_0xbb81('0x1e')](_0x24b832[_0xbb81('0x1f')]);if(_0x24b832[_0xbb81('0x20')]){delete _0x24b832['name'];}_0x5a2a49[_0xbb81('0x14')](_0x35cfb6)[_0xbb81('0x21')](_0x24b832);};}exports[_0xbb81('0x22')]=function(_0x4fdc6c,_0x3611c0){var _0xb8c16b={},_0x28ff7c={},_0xe03f85={'count':0x0,'rows':[]};var _0x498a63=db[_0xbb81('0x23')][_0xbb81('0x24')];_0x28ff7c[_0xbb81('0x25')]=_[_0xbb81('0x26')](_0x498a63);_0x28ff7c['query']=_[_0xbb81('0x26')](_0x4fdc6c[_0xbb81('0x27')]);_0x28ff7c[_0xbb81('0x28')]=_['intersection'](_0x28ff7c[_0xbb81('0x25')],_0x28ff7c['query']);_0xb8c16b[_0xbb81('0x29')]=_[_0xbb81('0x2a')](_0x28ff7c[_0xbb81('0x25')],qs[_0xbb81('0x2b')](_0x4fdc6c[_0xbb81('0x27')][_0xbb81('0x2b')]));_0xb8c16b[_0xbb81('0x29')]=_0xb8c16b[_0xbb81('0x29')][_0xbb81('0x2c')]?_0xb8c16b[_0xbb81('0x29')]:_0x28ff7c['model'];if(!_0x4fdc6c[_0xbb81('0x27')]['hasOwnProperty'](_0xbb81('0x2d'))){_0xb8c16b[_0xbb81('0x17')]=qs['limit'](_0x4fdc6c['query']['limit']);_0xb8c16b['offset']=qs['offset'](_0x4fdc6c['query'][_0xbb81('0x16')]);}_0xb8c16b[_0xbb81('0x2e')]=qs[_0xbb81('0x2f')](_0x4fdc6c[_0xbb81('0x27')][_0xbb81('0x2f')]);_0xb8c16b[_0xbb81('0x30')]=qs[_0xbb81('0x28')](_[_0xbb81('0x31')](_0x4fdc6c[_0xbb81('0x27')],_0x28ff7c['filters']));if(_0x4fdc6c['query'][_0xbb81('0x32')]){_0xb8c16b[_0xbb81('0x30')]=_['merge'](_0xb8c16b[_0xbb81('0x30')],{'$or':_[_0xbb81('0x33')](_0x498a63,function(_0x5afcd4){if(_0x5afcd4['type'][_0xbb81('0x34')]!==_0xbb81('0x35')){var _0x3122e3={};_0x3122e3[_0x5afcd4[_0xbb81('0x36')]]={'$like':'%'+_0x4fdc6c['query']['filter']+'%'};return _0x3122e3;}})});}_0xb8c16b=_[_0xbb81('0x37')]({},_0xb8c16b,_0x4fdc6c[_0xbb81('0x38')]);var _0xbb2447={'where':_0xb8c16b[_0xbb81('0x30')]};return db[_0xbb81('0x23')][_0xbb81('0x39')](_0xbb2447)['then'](function(_0x562493){_0xe03f85[_0xbb81('0x39')]=_0x562493;if(_0x4fdc6c['query'][_0xbb81('0x3a')]){_0xb8c16b[_0xbb81('0x3b')]=[{'all':!![]}];}return db[_0xbb81('0x23')][_0xbb81('0x3c')](_0xb8c16b);})['then'](function(_0x25455b){_0xe03f85[_0xbb81('0x3d')]=_0x25455b;return _0xe03f85;})[_0xbb81('0x1d')](respondWithFilteredResult(_0x3611c0,_0xb8c16b))['catch'](handleError(_0x3611c0,null));};exports[_0xbb81('0x3e')]=function(_0x4351f4,_0x22e524){var _0x37794d={'raw':!![],'where':{'id':_0x4351f4['params']['id']}},_0x1a9a4b={};_0x1a9a4b[_0xbb81('0x25')]=_[_0xbb81('0x26')](db[_0xbb81('0x23')][_0xbb81('0x24')]);_0x1a9a4b['query']=_[_0xbb81('0x26')](_0x4351f4[_0xbb81('0x27')]);_0x1a9a4b[_0xbb81('0x28')]=_[_0xbb81('0x2a')](_0x1a9a4b[_0xbb81('0x25')],_0x1a9a4b[_0xbb81('0x27')]);_0x37794d[_0xbb81('0x29')]=_[_0xbb81('0x2a')](_0x1a9a4b['model'],qs[_0xbb81('0x2b')](_0x4351f4['query']['fields']));_0x37794d['attributes']=_0x37794d[_0xbb81('0x29')][_0xbb81('0x2c')]?_0x37794d[_0xbb81('0x29')]:_0x1a9a4b['model'];if(_0x4351f4[_0xbb81('0x27')][_0xbb81('0x3a')]){_0x37794d['include']=[{'all':!![]}];}_0x37794d=_[_0xbb81('0x37')]({},_0x37794d,_0x4351f4[_0xbb81('0x38')]);return db[_0xbb81('0x23')]['find'](_0x37794d)['then'](handleEntityNotFound(_0x22e524,null))[_0xbb81('0x1d')](respondWithResult(_0x22e524,null))[_0xbb81('0x3f')](handleError(_0x22e524,null));};exports[_0xbb81('0x40')]=function(_0x5002d3,_0x30abd7){return db[_0xbb81('0x23')][_0xbb81('0x40')](_0x5002d3[_0xbb81('0x41')],{})[_0xbb81('0x1d')](respondWithResult(_0x30abd7,0xc9))[_0xbb81('0x3f')](handleError(_0x30abd7,null));};exports['update']=function(_0x1eb89f,_0x53178d){if(_0x1eb89f[_0xbb81('0x41')]['id']){delete _0x1eb89f[_0xbb81('0x41')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x1eb89f[_0xbb81('0x42')]['id']}})[_0xbb81('0x1d')](handleEntityNotFound(_0x53178d,null))['then'](saveUpdates(_0x1eb89f['body'],null))[_0xbb81('0x1d')](respondWithResult(_0x53178d,null))[_0xbb81('0x3f')](handleError(_0x53178d,null));};exports[_0xbb81('0x43')]=function(_0x4974ec,_0x58ebc1){return db['VoiceQueuesLog'][_0xbb81('0x44')]({'where':{'id':_0x4974ec[_0xbb81('0x42')]['id']}})[_0xbb81('0x1d')](handleEntityNotFound(_0x58ebc1,null))[_0xbb81('0x1d')](removeEntity(_0x58ebc1,null))[_0xbb81('0x3f')](handleError(_0x58ebc1,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 6ce8961..3afbe7c 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 _0x63d4=['event_dtm','event','dtm','../../config/logger','api','bluebird','request-promise','./voiceQueuesLog.attributes','exports','VoiceQueuesLog'];(function(_0x455eed,_0x822290){var _0x31cb46=function(_0x54e871){while(--_0x54e871){_0x455eed['push'](_0x455eed['shift']());}};_0x31cb46(++_0x822290);}(_0x63d4,0x8f));var _0x463d=function(_0x451f96,_0x3414dd){_0x451f96=_0x451f96-0x0;var _0x1f5dfd=_0x63d4[_0x451f96];return _0x1f5dfd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x463d('0x0'))(_0x463d('0x1'));var moment=require('moment');var BPromise=require(_0x463d('0x2'));var rp=require(_0x463d('0x3'));var attributes=require(_0x463d('0x4'));module[_0x463d('0x5')]=function(_0x1dc4f9,_0x4fea62){return _0x1dc4f9['define'](_0x463d('0x6'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x463d('0x7'),'fields':[_0x463d('0x8'),_0x463d('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0f37=['exports','define','VoiceQueuesLog','event_dtm','event','util','api','moment','bluebird','request-promise','./voiceQueuesLog.attributes'];(function(_0x171791,_0x5b7869){var _0x24d011=function(_0x3e2ab5){while(--_0x3e2ab5){_0x171791['push'](_0x171791['shift']());}};_0x24d011(++_0x5b7869);}(_0x0f37,0x191));var _0x70f3=function(_0x313e3d,_0x2d149f){_0x313e3d=_0x313e3d-0x0;var _0x3989d0=_0x0f37[_0x313e3d];return _0x3989d0;};'use strict';var _=require('lodash');var util=require(_0x70f3('0x0'));var logger=require('../../config/logger')(_0x70f3('0x1'));var moment=require(_0x70f3('0x2'));var BPromise=require(_0x70f3('0x3'));var rp=require(_0x70f3('0x4'));var attributes=require(_0x70f3('0x5'));module[_0x70f3('0x6')]=function(_0x37cc2d,_0x394aa4){return _0x37cc2d[_0x70f3('0x7')](_0x70f3('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x70f3('0x9'),'fields':[_0x70f3('0xa'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index ca446d4..0d926e1 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 _0xa004=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','catch'];(function(_0x130719,_0x2a7018){var _0x159865=function(_0x3a4d06){while(--_0x3a4d06){_0x130719['push'](_0x130719['shift']());}};_0x159865(++_0x2a7018);}(_0xa004,0x143));var _0x4a00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa004[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4a00('0x0'));var BPromise=require('bluebird');var rs=require(_0x4a00('0x1'));var fs=require('fs');var Redis=require(_0x4a00('0x2'));var db=require(_0x4a00('0x3'))['db'];var utils=require(_0x4a00('0x4'));var logger=require(_0x4a00('0x5'))(_0x4a00('0x6'));var config=require(_0x4a00('0x7'));var jayson=require(_0x4a00('0x8'));var client=jayson[_0x4a00('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x184edc,_0x53137a,_0x39156f){return new BPromise(function(_0x57cb24,_0x2626c0){return client[_0x4a00('0xa')](_0x184edc,_0x39156f)['then'](function(_0x26a592){logger[_0x4a00('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x53137a,_0x4a00('0xc'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x53137a,_0x4a00('0xc'),JSON[_0x4a00('0xd')](_0x26a592));if(_0x26a592[_0x4a00('0xe')]){if(_0x26a592[_0x4a00('0xe')][_0x4a00('0xf')]===0x1f4){logger['error'](_0x4a00('0x10'),_0x53137a,_0x26a592[_0x4a00('0xe')][_0x4a00('0x11')]);return _0x2626c0(_0x26a592['error']['message']);}logger[_0x4a00('0xe')](_0x4a00('0x10'),_0x53137a,_0x26a592[_0x4a00('0xe')][_0x4a00('0x11')]);return _0x57cb24(_0x26a592['error'][_0x4a00('0x11')]);}else{logger[_0x4a00('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x53137a,_0x4a00('0xc'));_0x57cb24(_0x26a592['result'][_0x4a00('0x11')]);}})[_0x4a00('0x12')](function(_0x272016){logger[_0x4a00('0xe')](_0x4a00('0x10'),_0x53137a,_0x272016);_0x2626c0(_0x272016);});});} \ No newline at end of file +var _0x9414=['error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5eb9c1,_0x477c4b){var _0x371df6=function(_0x360e73){while(--_0x360e73){_0x5eb9c1['push'](_0x5eb9c1['shift']());}};_0x371df6(++_0x477c4b);}(_0x9414,0x90));var _0x4941=function(_0x2067e9,_0x5e6a97){_0x2067e9=_0x2067e9-0x0;var _0x280ce4=_0x9414[_0x2067e9];return _0x280ce4;};'use strict';var _=require(_0x4941('0x0'));var util=require('util');var moment=require(_0x4941('0x1'));var BPromise=require('bluebird');var rs=require(_0x4941('0x2'));var fs=require('fs');var Redis=require(_0x4941('0x3'));var db=require(_0x4941('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4941('0x5'))(_0x4941('0x6'));var config=require(_0x4941('0x7'));var jayson=require(_0x4941('0x8'));var client=jayson[_0x4941('0x9')][_0x4941('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bd3fb,_0x48147a,_0x1bc90e){return new BPromise(function(_0x373246,_0x557583){return client[_0x4941('0xb')](_0x4bd3fb,_0x1bc90e)['then'](function(_0x2ed92a){logger[_0x4941('0xc')](_0x4941('0xd'),_0x48147a,_0x4941('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x48147a,'request\x20sent',JSON[_0x4941('0xf')](_0x2ed92a));if(_0x2ed92a['error']){if(_0x2ed92a[_0x4941('0x10')][_0x4941('0x11')]===0x1f4){logger[_0x4941('0x10')](_0x4941('0xd'),_0x48147a,_0x2ed92a['error'][_0x4941('0x12')]);return _0x557583(_0x2ed92a[_0x4941('0x10')]['message']);}logger[_0x4941('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x48147a,_0x2ed92a[_0x4941('0x10')][_0x4941('0x12')]);return _0x373246(_0x2ed92a[_0x4941('0x10')][_0x4941('0x12')]);}else{logger[_0x4941('0xc')](_0x4941('0xd'),_0x48147a,'request\x20sent');_0x373246(_0x2ed92a['result'][_0x4941('0x12')]);}})[_0x4941('0x13')](function(_0x495625){logger[_0x4941('0x10')](_0x4941('0xd'),_0x48147a,_0x495625);_0x557583(_0x495625);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 00b54f8..fe42bf2 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 _0xf3cd=['../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/download','download','/:id/downloads','downloads','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xf3cd[_0x10df18];return _0x1f9a1d;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf3c('0x6'));var config=require(_0xdf3c('0x7'));var controller=require(_0xdf3c('0x8'));router['get']('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xa')]);router[_0xdf3c('0xb')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xd')]);router['get'](_0xdf3c('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xdf3c('0xb')](_0xdf3c('0xf'),auth['isAuthenticated'](),controller[_0xdf3c('0x10')]);router[_0xdf3c('0xb')](_0xdf3c('0x11'),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')]('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x14')]);router[_0xdf3c('0x15')]('/:id',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x16')]);router[_0xdf3c('0x17')](_0xdf3c('0xe'),auth['isAuthenticated'](),controller[_0xdf3c('0x18')]);module[_0xdf3c('0x19')]=router; \ No newline at end of file +var _0x1752=['express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','downloads','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x122b00,_0x3ecf0b){var _0x1bc407=function(_0x935a39){while(--_0x935a39){_0x122b00['push'](_0x122b00['shift']());}};_0x1bc407(++_0x3ecf0b);}(_0x1752,0xa5));var _0x2175=function(_0x26a8c6,_0x177fde){_0x26a8c6=_0x26a8c6-0x0;var _0x24ca89=_0x1752[_0x26a8c6];return _0x24ca89;};'use strict';var multer=require('multer');var util=require(_0x2175('0x0'));var path=require(_0x2175('0x1'));var timeout=require(_0x2175('0x2'));var express=require(_0x2175('0x3'));var router=express[_0x2175('0x4')]();var auth=require(_0x2175('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2175('0x6'));var controller=require(_0x2175('0x7'));router[_0x2175('0x8')]('/',auth[_0x2175('0x9')](),controller[_0x2175('0xa')]);router[_0x2175('0x8')](_0x2175('0xb'),auth[_0x2175('0x9')](),controller[_0x2175('0xc')]);router[_0x2175('0x8')]('/:id',auth[_0x2175('0x9')](),controller[_0x2175('0xd')]);router[_0x2175('0x8')](_0x2175('0xe'),auth[_0x2175('0x9')](),controller['download']);router['get']('/:id/downloads',controller[_0x2175('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2175('0x10'),auth['isAuthenticated'](),controller[_0x2175('0x11')]);router[_0x2175('0x12')]('/:id',auth[_0x2175('0x9')](),controller[_0x2175('0x13')]);module[_0x2175('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index ace0111..8773b77 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 _0xeb35=['toString','updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','value','extname','STRING','channel','setDataValue','membername','split','INTEGER','DATE','format'];(function(_0x355a94,_0x9993b8){var _0x18f54e=function(_0x29e16c){while(--_0x29e16c){_0x355a94['push'](_0x355a94['shift']());}};_0x18f54e(++_0x9993b8);}(_0xeb35,0xbd));var _0x5eb3=function(_0x19722e,_0x39c37){_0x19722e=_0x19722e-0x0;var _0x5ae26e=_0xeb35[_0x19722e];return _0x5ae26e;};'use strict';var Sequelize=require(_0x5eb3('0x0'));var moment=require('moment');var path=require(_0x5eb3('0x1'));module[_0x5eb3('0x2')]={'format':{'type':Sequelize[_0x5eb3('0x3')],'get':function(){return this[_0x5eb3('0x4')](_0x5eb3('0x5'))?path[_0x5eb3('0x6')](this[_0x5eb3('0x4')](_0x5eb3('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x5eb3('0x7')]},'channel':{'type':Sequelize[_0x5eb3('0x7')],'set':function(_0x4cc624){if(_0x4cc624){this['setDataValue'](_0x5eb3('0x8'),_0x4cc624);this[_0x5eb3('0x9')](_0x5eb3('0xa'),_0x4cc624[_0x5eb3('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x5eb3('0x7')]},'calleridnum':{'type':Sequelize[_0x5eb3('0x7')]},'calleridname':{'type':Sequelize[_0x5eb3('0x7')]},'connectedlinenum':{'type':Sequelize[_0x5eb3('0x7')]},'connectedlinename':{'type':Sequelize[_0x5eb3('0x7')]},'accountcode':{'type':Sequelize[_0x5eb3('0x7')]},'context':{'type':Sequelize[_0x5eb3('0x7')]},'exten':{'type':Sequelize[_0x5eb3('0x7')]},'value':{'type':Sequelize[_0x5eb3('0x7')]},'type':{'type':Sequelize[_0x5eb3('0x7')]},'rating':{'type':Sequelize[_0x5eb3('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x5eb3('0x7')]},'userDisposition':{'type':Sequelize[_0x5eb3('0x7')]},'createdAt':{'type':Sequelize[_0x5eb3('0xd')],'get':function(){return moment(this[_0x5eb3('0x4')]('createdAt'))[_0x5eb3('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x5eb3('0xf')]();}},'updatedAt':{'type':Sequelize[_0x5eb3('0xd')],'get':function(){return moment(this[_0x5eb3('0x4')](_0x5eb3('0x10')))[_0x5eb3('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x5eb3('0xf')]();}}}; \ No newline at end of file +var _0x0a6a=['sequelize','VIRTUAL','getDataValue','extname','value','STRING','setDataValue','channel','membername','INTEGER','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0a6a,0x1dc));var _0xa0a6=function(_0x17e735,_0x328f40){_0x17e735=_0x17e735-0x0;var _0x1824d6=_0x0a6a[_0x17e735];return _0x1824d6;};'use strict';var Sequelize=require(_0xa0a6('0x0'));var moment=require('moment');var path=require('path');module['exports']={'format':{'type':Sequelize[_0xa0a6('0x1')],'get':function(){return this[_0xa0a6('0x2')]('value')?path[_0xa0a6('0x3')](this[_0xa0a6('0x2')](_0xa0a6('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0xa0a6('0x5')]},'channel':{'type':Sequelize[_0xa0a6('0x5')],'set':function(_0x214768){if(_0x214768){this[_0xa0a6('0x6')](_0xa0a6('0x7'),_0x214768);this['setDataValue'](_0xa0a6('0x8'),_0x214768['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xa0a6('0x5')]},'calleridnum':{'type':Sequelize[_0xa0a6('0x5')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa0a6('0x5')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa0a6('0x5')]},'context':{'type':Sequelize[_0xa0a6('0x5')]},'exten':{'type':Sequelize[_0xa0a6('0x5')]},'value':{'type':Sequelize[_0xa0a6('0x5')]},'type':{'type':Sequelize[_0xa0a6('0x5')]},'rating':{'type':Sequelize[_0xa0a6('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xa0a6('0x5')]},'userDisposition':{'type':Sequelize[_0xa0a6('0x5')]},'createdAt':{'type':Sequelize[_0xa0a6('0xa')],'get':function(){return moment(this[_0xa0a6('0x2')](_0xa0a6('0xb')))['format'](_0xa0a6('0xc'))[_0xa0a6('0xd')]();}},'updatedAt':{'type':Sequelize[_0xa0a6('0xa')],'get':function(){return moment(this[_0xa0a6('0x2')]('updatedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xa0a6('0xd')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index e539d06..1ae85c2 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 _0x9a5b=['sort','where','filters','merge','key','options','findAll','rows','catch','show','params','include','find','create','body','describe','download','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','sequelize','MD5','col','$and','push','decryptFile','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','name','send','index','VoiceRecording','rawAttributes','keys','format','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x9a5b,0xd4));var _0xb9a5=function(_0x5978f4,_0x35d1d1){_0x5978f4=_0x5978f4-0x0;var _0x4b8522=_0x9a5b[_0x5978f4];return _0x4b8522;};'use strict';var pdf=require(_0xb9a5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb9a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9a5('0x2'));var rp=require(_0xb9a5('0x3'));var moment=require(_0xb9a5('0x4'));var BPromise=require(_0xb9a5('0x5'));var Mustache=require('mustache');var util=require(_0xb9a5('0x6'));var path=require(_0xb9a5('0x7'));var sox=require('sox');var csv=require(_0xb9a5('0x8'));var ejs=require(_0xb9a5('0x9'));var fs=require('fs');var _=require(_0xb9a5('0xa'));var squel=require('squel');var crypto=require(_0xb9a5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb9a5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb9a5('0xd'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0xb9a5('0xe'));var logger=require('../../config/logger')(_0xb9a5('0xf'));var utils=require(_0xb9a5('0x10'));var config=require(_0xb9a5('0x11'));var db=require(_0xb9a5('0x12'))['db'];function respondWithStatusCode(_0x27ded6,_0x55206b){_0x55206b=_0x55206b||0xcc;return function(_0x40cab8){if(_0x40cab8){return _0x27ded6[_0xb9a5('0x13')](_0x55206b);}return _0x27ded6['status'](_0x55206b)[_0xb9a5('0x14')]();};}function respondWithResult(_0x101347,_0x36527c){_0x36527c=_0x36527c||0xc8;return function(_0x27ba52){if(_0x27ba52){return _0x101347[_0xb9a5('0x15')](_0x36527c)[_0xb9a5('0x16')](_0x27ba52);}};}function respondWithFilteredResult(_0x4eab93,_0x3672eb){return function(_0x194db2){if(_0x194db2){var _0x43f421=_0x194db2[_0xb9a5('0x17')],_0x24d073=_0x3672eb[_0xb9a5('0x18')],_0x2f92af=_0x3672eb[_0xb9a5('0x18')]+_0x3672eb[_0xb9a5('0x19')],_0x46c1e9;if(_0x2f92af>=_0x43f421){_0x2f92af=_0x43f421;_0x46c1e9=0xc8;}else{_0x46c1e9=0xce;}_0x4eab93[_0xb9a5('0x15')](_0x46c1e9);return _0x4eab93['set'](_0xb9a5('0x1a'),_0x24d073+'-'+_0x2f92af+'/'+_0x43f421)[_0xb9a5('0x16')](_0x194db2);}return null;};}function patchUpdates(_0x14eb7a){return function(_0x247bc9){try{jsonpatch[_0xb9a5('0x1b')](_0x247bc9,_0x14eb7a,!![]);}catch(_0x28173d){return BPromise[_0xb9a5('0x1c')](_0x28173d);}return _0x247bc9['save']();};}function saveUpdates(_0x309877,_0x5e21e3){return function(_0x2edc28){if(_0x2edc28){return _0x2edc28[_0xb9a5('0x1d')](_0x309877)[_0xb9a5('0x1e')](function(_0x25c8c0){return _0x25c8c0;});}return null;};}function removeEntity(_0x465075,_0x582d8f){return function(_0x2b78ec){if(_0x2b78ec){return _0x2b78ec[_0xb9a5('0x1f')]()[_0xb9a5('0x1e')](function(){_0x465075[_0xb9a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57b6f5,_0x292889){return function(_0x2afcd7){if(!_0x2afcd7){_0x57b6f5[_0xb9a5('0x13')](0x194);}return _0x2afcd7;};}function handleError(_0x3292e5,_0x1b9fd9){_0x1b9fd9=_0x1b9fd9||0x1f4;return function(_0x3bdb68){logger[_0xb9a5('0x20')](_0x3bdb68['stack']);if(_0x3bdb68[_0xb9a5('0x21')]){delete _0x3bdb68['name'];}_0x3292e5[_0xb9a5('0x15')](_0x1b9fd9)[_0xb9a5('0x22')](_0x3bdb68);};}exports[_0xb9a5('0x23')]=function(_0x4b8ee7,_0xb5d3c0){var _0x4dd805={},_0x373ce4={},_0x5f4106={'count':0x0,'rows':[]};var _0xc5b130=db[_0xb9a5('0x24')][_0xb9a5('0x25')];_0x373ce4['model']=_['differenceBy'](_[_0xb9a5('0x26')](_0xc5b130),[_0xb9a5('0x27')]);_0x373ce4[_0xb9a5('0x28')]=_[_0xb9a5('0x26')](_0x4b8ee7[_0xb9a5('0x28')]);_0x373ce4['filters']=_[_0xb9a5('0x29')](_0x373ce4[_0xb9a5('0x2a')],_0x373ce4[_0xb9a5('0x28')]);_0x4dd805[_0xb9a5('0x2b')]=_[_0xb9a5('0x29')](_0x373ce4[_0xb9a5('0x2a')],qs[_0xb9a5('0x2c')](_0x4b8ee7[_0xb9a5('0x28')]['fields']));_0x4dd805[_0xb9a5('0x2b')]=_0x4dd805[_0xb9a5('0x2b')][_0xb9a5('0x2d')]?_0x4dd805[_0xb9a5('0x2b')]:_0x373ce4[_0xb9a5('0x2a')];if(!_0x4b8ee7[_0xb9a5('0x28')][_0xb9a5('0x2e')](_0xb9a5('0x2f'))){_0x4dd805[_0xb9a5('0x19')]=qs[_0xb9a5('0x19')](_0x4b8ee7[_0xb9a5('0x28')]['limit']);_0x4dd805[_0xb9a5('0x18')]=qs[_0xb9a5('0x18')](_0x4b8ee7[_0xb9a5('0x28')]['offset']);}_0x4dd805[_0xb9a5('0x30')]=qs['sort'](_0x4b8ee7[_0xb9a5('0x28')][_0xb9a5('0x31')]);_0x4dd805[_0xb9a5('0x32')]=qs[_0xb9a5('0x33')](_['pick'](_0x4b8ee7[_0xb9a5('0x28')],_0x373ce4[_0xb9a5('0x33')]));if(_0x4b8ee7['query']['filter']){_0x4dd805['where']=_[_0xb9a5('0x34')](_0x4dd805[_0xb9a5('0x32')],{'$or':_['map'](_0xc5b130,function(_0x56f3ac){if(_0x56f3ac['type'][_0xb9a5('0x35')]!=='VIRTUAL'){var _0x34634c={};_0x34634c[_0x56f3ac['field']]={'$like':'%'+_0x4b8ee7['query']['filter']+'%'};return _0x34634c;}})});}_0x4dd805=_[_0xb9a5('0x34')]({},_0x4dd805,_0x4b8ee7[_0xb9a5('0x36')]);var _0x521471={'where':_0x4dd805['where']};return db[_0xb9a5('0x24')][_0xb9a5('0x17')](_0x521471)[_0xb9a5('0x1e')](function(_0x2d0a10){_0x5f4106[_0xb9a5('0x17')]=_0x2d0a10;if(_0x4b8ee7[_0xb9a5('0x28')]['includeAll']){_0x4dd805['include']=[{'all':!![]}];}return db[_0xb9a5('0x24')][_0xb9a5('0x37')](_0x4dd805);})[_0xb9a5('0x1e')](function(_0x15e1a9){_0x5f4106[_0xb9a5('0x38')]=_0x15e1a9;return _0x5f4106;})[_0xb9a5('0x1e')](respondWithFilteredResult(_0xb5d3c0,_0x4dd805))[_0xb9a5('0x39')](handleError(_0xb5d3c0,null));};exports[_0xb9a5('0x3a')]=function(_0x369e2b,_0x34cb98){var _0x88da27={'raw':![],'where':{'id':_0x369e2b[_0xb9a5('0x3b')]['id']}},_0x4d680d={};_0x4d680d[_0xb9a5('0x2a')]=_[_0xb9a5('0x26')](db[_0xb9a5('0x24')]['rawAttributes']);_0x4d680d[_0xb9a5('0x28')]=_[_0xb9a5('0x26')](_0x369e2b[_0xb9a5('0x28')]);_0x4d680d[_0xb9a5('0x33')]=_[_0xb9a5('0x29')](_0x4d680d[_0xb9a5('0x2a')],_0x4d680d['query']);_0x88da27[_0xb9a5('0x2b')]=_[_0xb9a5('0x29')](_0x4d680d[_0xb9a5('0x2a')],qs[_0xb9a5('0x2c')](_0x369e2b[_0xb9a5('0x28')][_0xb9a5('0x2c')]));_0x88da27[_0xb9a5('0x2b')]=_0x88da27[_0xb9a5('0x2b')][_0xb9a5('0x2d')]?_0x88da27['attributes']:_0x4d680d[_0xb9a5('0x2a')];if(_0x369e2b[_0xb9a5('0x28')]['includeAll']){_0x88da27[_0xb9a5('0x3c')]=[{'all':!![]}];}_0x88da27=_['merge']({},_0x88da27,_0x369e2b[_0xb9a5('0x36')]);return db[_0xb9a5('0x24')][_0xb9a5('0x3d')](_0x88da27)[_0xb9a5('0x1e')](handleEntityNotFound(_0x34cb98,null))[_0xb9a5('0x1e')](respondWithResult(_0x34cb98,null))['catch'](handleError(_0x34cb98,null));};exports['create']=function(_0x5ba853,_0x41b610){return db[_0xb9a5('0x24')][_0xb9a5('0x3e')](_0x5ba853[_0xb9a5('0x3f')],{})[_0xb9a5('0x1e')](respondWithResult(_0x41b610,0xc9))[_0xb9a5('0x39')](handleError(_0x41b610,null));};exports['update']=function(_0x364982,_0x34185a){if(_0x364982[_0xb9a5('0x3f')]['id']){delete _0x364982[_0xb9a5('0x3f')]['id'];}return db['VoiceRecording'][_0xb9a5('0x3d')]({'where':{'id':_0x364982['params']['id']}})['then'](handleEntityNotFound(_0x34185a,null))[_0xb9a5('0x1e')](saveUpdates(_0x364982[_0xb9a5('0x3f')],null))[_0xb9a5('0x1e')](respondWithResult(_0x34185a,null))[_0xb9a5('0x39')](handleError(_0x34185a,null));};exports[_0xb9a5('0x1f')]=function(_0x5ac1b5,_0x4ae38f){return db[_0xb9a5('0x24')][_0xb9a5('0x3d')]({'where':{'id':_0x5ac1b5['params']['id']}})['then'](handleEntityNotFound(_0x4ae38f,null))[_0xb9a5('0x1e')](removeEntity(_0x4ae38f,null))[_0xb9a5('0x39')](handleError(_0x4ae38f,null));};exports[_0xb9a5('0x40')]=function(_0x29c50f,_0x2af2f3){return db[_0xb9a5('0x24')][_0xb9a5('0x40')]()['then'](respondWithResult(_0x2af2f3,null))[_0xb9a5('0x39')](handleError(_0x2af2f3,null));};exports[_0xb9a5('0x41')]=function(_0x367a75,_0x4958cf,_0x3ecbab){var _0x5e60cb=require(_0xb9a5('0x42'));var _0x209045=![];var _0x339e62={};if(_0x367a75['query'][_0xb9a5('0x43')]&&_0x367a75[_0xb9a5('0x28')][_0xb9a5('0x43')]===_0xb9a5('0x44')){_0x339e62[_0xb9a5('0x44')]=_0x367a75[_0xb9a5('0x3b')]['id'];}else{_0x339e62['id']=_0x367a75[_0xb9a5('0x3b')]['id'];}return db[_0xb9a5('0x24')]['find']({'where':_0x339e62,'attributes':['id',_0xb9a5('0x45')],'raw':!![]})[_0xb9a5('0x1e')](handleEntityNotFound(_0x4958cf,null))[_0xb9a5('0x1e')](function(_0x2e2c23){if(_0x2e2c23){var _0x54d8ef=util[_0xb9a5('0x27')](_0xb9a5('0x46'),_0x2e2c23[_0xb9a5('0x45')]);if(fs[_0xb9a5('0x47')](_0x54d8ef)){_0x209045=!![];return _0x5e60cb['decryptFile'](_0x54d8ef,_0x2e2c23[_0xb9a5('0x45')],config[_0xb9a5('0x48')][_0xb9a5('0x49')])[_0xb9a5('0x1e')](function(){return _0x2e2c23;});}return _0x2e2c23;}})['then'](function(_0xa0ea5f){if(_0xa0ea5f){if(!fs[_0xb9a5('0x47')](_0xa0ea5f[_0xb9a5('0x45')])){throw new db[(_0xb9a5('0x4a'))][(_0xb9a5('0x4b'))](_0xb9a5('0x4c'));}if(_0xa0ea5f[_0xb9a5('0x4d')]){return _0x4958cf[_0xb9a5('0x41')](_0xa0ea5f['value'],_0xa0ea5f[_0xb9a5('0x4d')]+path[_0xb9a5('0x4e')](_0xa0ea5f[_0xb9a5('0x45')]),function(){if(_0x209045){fs[_0xb9a5('0x4f')](_0xa0ea5f[_0xb9a5('0x45')]);}});}else{return _0x4958cf[_0xb9a5('0x41')](_0xa0ea5f['value'],function(_0x3a37d6){if(_0x209045){fs[_0xb9a5('0x4f')](_0xa0ea5f[_0xb9a5('0x45')]);}});}}})['catch'](handleError(_0x4958cf,null));};exports[_0xb9a5('0x50')]=function(_0x301012,_0x2b3e95,_0x43b7b4){var _0x2734e8=require(_0xb9a5('0x42'));var _0x150ae5=![];var _0x327320={'$and':[db[_0xb9a5('0x51')][_0xb9a5('0x32')](db['sequelize']['fn'](_0xb9a5('0x52'),db[_0xb9a5('0x51')][_0xb9a5('0x53')](_0xb9a5('0x44'))),_0x301012[_0xb9a5('0x28')]['token'])]};if(_0x301012[_0xb9a5('0x28')]['type']&&_0x301012[_0xb9a5('0x28')][_0xb9a5('0x43')]===_0xb9a5('0x44')){_0x327320[_0xb9a5('0x54')][_0xb9a5('0x55')]({'uniqueid':_0x301012[_0xb9a5('0x3b')]['id']});}else{_0x327320[_0xb9a5('0x54')][_0xb9a5('0x55')]({'id':_0x301012[_0xb9a5('0x3b')]['id']});}return db['VoiceRecording']['find']({'where':_0x327320,'attributes':['id','value'],'raw':!![]})[_0xb9a5('0x1e')](handleEntityNotFound(_0x2b3e95,null))['then'](function(_0x3e0c36){if(_0x3e0c36){var _0x3ef2bc=util[_0xb9a5('0x27')](_0xb9a5('0x46'),_0x3e0c36[_0xb9a5('0x45')]);if(fs[_0xb9a5('0x47')](_0x3ef2bc)){_0x150ae5=!![];return _0x2734e8[_0xb9a5('0x56')](_0x3ef2bc,_0x3e0c36[_0xb9a5('0x45')],config['secrets']['recording'])[_0xb9a5('0x1e')](function(){return _0x3e0c36;});}return _0x3e0c36;}})[_0xb9a5('0x1e')](function(_0x3b7d4f){if(_0x3b7d4f){if(!fs[_0xb9a5('0x47')](_0x3b7d4f[_0xb9a5('0x45')])){throw new db[(_0xb9a5('0x4a'))][(_0xb9a5('0x4b'))](_0xb9a5('0x4c'));}if(_0x3b7d4f[_0xb9a5('0x4d')]){return _0x2b3e95['download'](_0x3b7d4f[_0xb9a5('0x45')],_0x3b7d4f[_0xb9a5('0x4d')]+path[_0xb9a5('0x4e')](_0x3b7d4f[_0xb9a5('0x45')]),function(){if(_0x150ae5){fs[_0xb9a5('0x4f')](_0x3b7d4f['value']);}});}else{return _0x2b3e95['download'](_0x3b7d4f[_0xb9a5('0x45')],function(_0x2fa2eb){if(_0x150ae5){fs[_0xb9a5('0x4f')](_0x3b7d4f['value']);}});}}})['catch'](handleError(_0x2b3e95,null));}; \ No newline at end of file +var _0xe0fc=['rawAttributes','model','keys','format','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','unlink','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','decryptFile','extname','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','update','then','destroy','end','error','stack','name','index','VoiceRecording'];(function(_0x1c88f9,_0x211646){var _0x1779f7=function(_0x1dc48e){while(--_0x1dc48e){_0x1c88f9['push'](_0x1c88f9['shift']());}};_0x1779f7(++_0x211646);}(_0xe0fc,0x98));var _0xce0f=function(_0x124096,_0xbb4341){_0x124096=_0x124096-0x0;var _0x123aed=_0xe0fc[_0x124096];return _0x123aed;};'use strict';var pdf=require(_0xce0f('0x0'));var emlformat=require(_0xce0f('0x1'));var rimraf=require(_0xce0f('0x2'));var zipdir=require(_0xce0f('0x3'));var jsonpatch=require(_0xce0f('0x4'));var rp=require(_0xce0f('0x5'));var moment=require('moment');var BPromise=require(_0xce0f('0x6'));var Mustache=require(_0xce0f('0x7'));var util=require(_0xce0f('0x8'));var path=require(_0xce0f('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xce0f('0xa'));var fs=require('fs');var _=require(_0xce0f('0xb'));var squel=require(_0xce0f('0xc'));var crypto=require(_0xce0f('0xd'));var jsforce=require(_0xce0f('0xe'));var deskjs=require(_0xce0f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xce0f('0x10'));var Papa=require('papaparse');var authService=require(_0xce0f('0x11'));var hardwareService=require(_0xce0f('0x12'));var Redis=require(_0xce0f('0x13'));var qs=require(_0xce0f('0x14'));var logger=require(_0xce0f('0x15'))(_0xce0f('0x16'));var utils=require(_0xce0f('0x17'));var config=require(_0xce0f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f3b20,_0x3c30e5){_0x3c30e5=_0x3c30e5||0xcc;return function(_0x533be7){if(_0x533be7){return _0x2f3b20[_0xce0f('0x19')](_0x3c30e5);}return _0x2f3b20['status'](_0x3c30e5)['end']();};}function respondWithResult(_0x4966fa,_0x19e0a1){_0x19e0a1=_0x19e0a1||0xc8;return function(_0x464b49){if(_0x464b49){return _0x4966fa[_0xce0f('0x1a')](_0x19e0a1)[_0xce0f('0x1b')](_0x464b49);}};}function respondWithFilteredResult(_0x5d5595,_0x3c274a){return function(_0x542fa7){if(_0x542fa7){var _0x35ca12=_0x542fa7[_0xce0f('0x1c')],_0x2e6c1f=_0x3c274a[_0xce0f('0x1d')],_0x4c71e4=_0x3c274a[_0xce0f('0x1d')]+_0x3c274a[_0xce0f('0x1e')],_0xbec7c3;if(_0x4c71e4>=_0x35ca12){_0x4c71e4=_0x35ca12;_0xbec7c3=0xc8;}else{_0xbec7c3=0xce;}_0x5d5595[_0xce0f('0x1a')](_0xbec7c3);return _0x5d5595['set'](_0xce0f('0x1f'),_0x2e6c1f+'-'+_0x4c71e4+'/'+_0x35ca12)[_0xce0f('0x1b')](_0x542fa7);}return null;};}function patchUpdates(_0x54c53a){return function(_0x41fd3e){try{jsonpatch[_0xce0f('0x20')](_0x41fd3e,_0x54c53a,!![]);}catch(_0x2f7cc0){return BPromise['reject'](_0x2f7cc0);}return _0x41fd3e['save']();};}function saveUpdates(_0x3489be,_0x3e38a4){return function(_0x3ad94c){if(_0x3ad94c){return _0x3ad94c[_0xce0f('0x21')](_0x3489be)[_0xce0f('0x22')](function(_0x55756a){return _0x55756a;});}return null;};}function removeEntity(_0x4d0d28,_0x779ec7){return function(_0x1c9791){if(_0x1c9791){return _0x1c9791[_0xce0f('0x23')]()[_0xce0f('0x22')](function(){_0x4d0d28[_0xce0f('0x1a')](0xcc)[_0xce0f('0x24')]();});}};}function handleEntityNotFound(_0x3579c7,_0x99bf6f){return function(_0x1c2ad6){if(!_0x1c2ad6){_0x3579c7[_0xce0f('0x19')](0x194);}return _0x1c2ad6;};}function handleError(_0x2b2577,_0x60a6e6){_0x60a6e6=_0x60a6e6||0x1f4;return function(_0x292a24){logger[_0xce0f('0x25')](_0x292a24[_0xce0f('0x26')]);if(_0x292a24[_0xce0f('0x27')]){delete _0x292a24[_0xce0f('0x27')];}_0x2b2577[_0xce0f('0x1a')](_0x60a6e6)['send'](_0x292a24);};}exports[_0xce0f('0x28')]=function(_0x239aea,_0x146e14){var _0x5521f8={},_0x4a1ca0={},_0x1cbb5a={'count':0x0,'rows':[]};var _0x19bb25=db[_0xce0f('0x29')][_0xce0f('0x2a')];_0x4a1ca0[_0xce0f('0x2b')]=_['differenceBy'](_[_0xce0f('0x2c')](_0x19bb25),[_0xce0f('0x2d')]);_0x4a1ca0[_0xce0f('0x2e')]=_[_0xce0f('0x2c')](_0x239aea['query']);_0x4a1ca0['filters']=_[_0xce0f('0x2f')](_0x4a1ca0['model'],_0x4a1ca0[_0xce0f('0x2e')]);_0x5521f8[_0xce0f('0x30')]=_[_0xce0f('0x2f')](_0x4a1ca0['model'],qs[_0xce0f('0x31')](_0x239aea[_0xce0f('0x2e')][_0xce0f('0x31')]));_0x5521f8[_0xce0f('0x30')]=_0x5521f8[_0xce0f('0x30')][_0xce0f('0x32')]?_0x5521f8['attributes']:_0x4a1ca0[_0xce0f('0x2b')];if(!_0x239aea['query']['hasOwnProperty'](_0xce0f('0x33'))){_0x5521f8[_0xce0f('0x1e')]=qs[_0xce0f('0x1e')](_0x239aea['query'][_0xce0f('0x1e')]);_0x5521f8[_0xce0f('0x1d')]=qs[_0xce0f('0x1d')](_0x239aea[_0xce0f('0x2e')][_0xce0f('0x1d')]);}_0x5521f8[_0xce0f('0x34')]=qs[_0xce0f('0x35')](_0x239aea[_0xce0f('0x2e')][_0xce0f('0x35')]);_0x5521f8[_0xce0f('0x36')]=qs[_0xce0f('0x37')](_[_0xce0f('0x38')](_0x239aea[_0xce0f('0x2e')],_0x4a1ca0[_0xce0f('0x37')]));if(_0x239aea[_0xce0f('0x2e')][_0xce0f('0x39')]){_0x5521f8[_0xce0f('0x36')]=_[_0xce0f('0x3a')](_0x5521f8[_0xce0f('0x36')],{'$or':_[_0xce0f('0x3b')](_0x19bb25,function(_0x21e0be){if(_0x21e0be[_0xce0f('0x3c')][_0xce0f('0x3d')]!==_0xce0f('0x3e')){var _0x20d2ef={};_0x20d2ef[_0x21e0be['field']]={'$like':'%'+_0x239aea[_0xce0f('0x2e')][_0xce0f('0x39')]+'%'};return _0x20d2ef;}})});}_0x5521f8=_[_0xce0f('0x3a')]({},_0x5521f8,_0x239aea[_0xce0f('0x3f')]);var _0x45bf43={'where':_0x5521f8['where']};return db[_0xce0f('0x29')]['count'](_0x45bf43)[_0xce0f('0x22')](function(_0x5a7f97){_0x1cbb5a['count']=_0x5a7f97;if(_0x239aea[_0xce0f('0x2e')][_0xce0f('0x40')]){_0x5521f8[_0xce0f('0x41')]=[{'all':!![]}];}return db[_0xce0f('0x29')][_0xce0f('0x42')](_0x5521f8);})['then'](function(_0x1dc7b0){_0x1cbb5a[_0xce0f('0x43')]=_0x1dc7b0;return _0x1cbb5a;})['then'](respondWithFilteredResult(_0x146e14,_0x5521f8))['catch'](handleError(_0x146e14,null));};exports[_0xce0f('0x44')]=function(_0x596742,_0x26e707){var _0x4d181f={'raw':![],'where':{'id':_0x596742['params']['id']}},_0x493968={};_0x493968[_0xce0f('0x2b')]=_[_0xce0f('0x2c')](db[_0xce0f('0x29')]['rawAttributes']);_0x493968['query']=_[_0xce0f('0x2c')](_0x596742[_0xce0f('0x2e')]);_0x493968['filters']=_[_0xce0f('0x2f')](_0x493968[_0xce0f('0x2b')],_0x493968['query']);_0x4d181f[_0xce0f('0x30')]=_[_0xce0f('0x2f')](_0x493968[_0xce0f('0x2b')],qs[_0xce0f('0x31')](_0x596742[_0xce0f('0x2e')]['fields']));_0x4d181f[_0xce0f('0x30')]=_0x4d181f[_0xce0f('0x30')]['length']?_0x4d181f[_0xce0f('0x30')]:_0x493968[_0xce0f('0x2b')];if(_0x596742[_0xce0f('0x2e')][_0xce0f('0x40')]){_0x4d181f[_0xce0f('0x41')]=[{'all':!![]}];}_0x4d181f=_['merge']({},_0x4d181f,_0x596742['options']);return db['VoiceRecording'][_0xce0f('0x45')](_0x4d181f)['then'](handleEntityNotFound(_0x26e707,null))[_0xce0f('0x22')](respondWithResult(_0x26e707,null))[_0xce0f('0x46')](handleError(_0x26e707,null));};exports[_0xce0f('0x47')]=function(_0x168d04,_0x1cf4f9){return db[_0xce0f('0x29')][_0xce0f('0x47')](_0x168d04[_0xce0f('0x48')],{})['then'](respondWithResult(_0x1cf4f9,0xc9))[_0xce0f('0x46')](handleError(_0x1cf4f9,null));};exports[_0xce0f('0x21')]=function(_0x15c35,_0x553d02){if(_0x15c35[_0xce0f('0x48')]['id']){delete _0x15c35[_0xce0f('0x48')]['id'];}return db[_0xce0f('0x29')][_0xce0f('0x45')]({'where':{'id':_0x15c35['params']['id']}})[_0xce0f('0x22')](handleEntityNotFound(_0x553d02,null))[_0xce0f('0x22')](saveUpdates(_0x15c35[_0xce0f('0x48')],null))[_0xce0f('0x22')](respondWithResult(_0x553d02,null))[_0xce0f('0x46')](handleError(_0x553d02,null));};exports[_0xce0f('0x23')]=function(_0x2c87c7,_0x31abb8){return db['VoiceRecording']['find']({'where':{'id':_0x2c87c7[_0xce0f('0x49')]['id']}})['then'](handleEntityNotFound(_0x31abb8,null))[_0xce0f('0x22')](removeEntity(_0x31abb8,null))[_0xce0f('0x46')](handleError(_0x31abb8,null));};exports[_0xce0f('0x4a')]=function(_0x308677,_0x37f6ac){return db['VoiceRecording'][_0xce0f('0x4a')]()[_0xce0f('0x22')](respondWithResult(_0x37f6ac,null))['catch'](handleError(_0x37f6ac,null));};exports['download']=function(_0x410d60,_0x23b3ca,_0x38e73b){var _0x539a79=require('../../components/encryptor');var _0x4927b1=![];var _0x4d80a2={};if(_0x410d60[_0xce0f('0x2e')][_0xce0f('0x3c')]&&_0x410d60['query']['type']===_0xce0f('0x4b')){_0x4d80a2[_0xce0f('0x4b')]=_0x410d60[_0xce0f('0x49')]['id'];}else{_0x4d80a2['id']=_0x410d60['params']['id'];}return db[_0xce0f('0x29')]['find']({'where':_0x4d80a2,'attributes':['id',_0xce0f('0x4c')],'raw':!![]})[_0xce0f('0x22')](handleEntityNotFound(_0x23b3ca,null))[_0xce0f('0x22')](function(_0x1ef7c2){if(_0x1ef7c2){var _0x825fd7=util[_0xce0f('0x2d')](_0xce0f('0x4d'),_0x1ef7c2[_0xce0f('0x4c')]);if(fs[_0xce0f('0x4e')](_0x825fd7)){_0x4927b1=!![];return _0x539a79['decryptFile'](_0x825fd7,_0x1ef7c2['value'],config[_0xce0f('0x4f')][_0xce0f('0x50')])[_0xce0f('0x22')](function(){return _0x1ef7c2;});}return _0x1ef7c2;}})[_0xce0f('0x22')](function(_0x20c127){if(_0x20c127){if(!fs[_0xce0f('0x4e')](_0x20c127[_0xce0f('0x4c')])){throw new db[(_0xce0f('0x51'))][(_0xce0f('0x52'))](_0xce0f('0x53'));}if(_0x20c127[_0xce0f('0x54')]){return _0x23b3ca[_0xce0f('0x55')](_0x20c127['value'],_0x20c127[_0xce0f('0x54')]+path['extname'](_0x20c127[_0xce0f('0x4c')]),function(){if(_0x4927b1){fs[_0xce0f('0x56')](_0x20c127[_0xce0f('0x4c')]);}});}else{return _0x23b3ca[_0xce0f('0x55')](_0x20c127[_0xce0f('0x4c')],function(_0xf279f2){if(_0x4927b1){fs[_0xce0f('0x56')](_0x20c127['value']);}});}}})[_0xce0f('0x46')](handleError(_0x23b3ca,null));};exports[_0xce0f('0x57')]=function(_0x25355f,_0x4fbf84,_0x13476d){var _0x50ceb1=require(_0xce0f('0x58'));var _0x355082=![];var _0x1de772={'$and':[db[_0xce0f('0x59')]['where'](db[_0xce0f('0x59')]['fn'](_0xce0f('0x5a'),db[_0xce0f('0x59')][_0xce0f('0x5b')]('uniqueid')),_0x25355f[_0xce0f('0x2e')][_0xce0f('0x5c')])]};if(_0x25355f[_0xce0f('0x2e')]['type']&&_0x25355f[_0xce0f('0x2e')][_0xce0f('0x3c')]==='uniqueid'){_0x1de772[_0xce0f('0x5d')]['push']({'uniqueid':_0x25355f[_0xce0f('0x49')]['id']});}else{_0x1de772['$and'][_0xce0f('0x5e')]({'id':_0x25355f['params']['id']});}return db[_0xce0f('0x29')]['find']({'where':_0x1de772,'attributes':['id','value'],'raw':!![]})[_0xce0f('0x22')](handleEntityNotFound(_0x4fbf84,null))['then'](function(_0x426c6d){if(_0x426c6d){var _0x37a063=util[_0xce0f('0x2d')]('%s.cypher',_0x426c6d['value']);if(fs[_0xce0f('0x4e')](_0x37a063)){_0x355082=!![];return _0x50ceb1[_0xce0f('0x5f')](_0x37a063,_0x426c6d[_0xce0f('0x4c')],config[_0xce0f('0x4f')][_0xce0f('0x50')])[_0xce0f('0x22')](function(){return _0x426c6d;});}return _0x426c6d;}})[_0xce0f('0x22')](function(_0x51a45c){if(_0x51a45c){if(!fs[_0xce0f('0x4e')](_0x51a45c['value'])){throw new db[(_0xce0f('0x51'))]['ValidationError'](_0xce0f('0x53'));}if(_0x51a45c[_0xce0f('0x54')]){return _0x4fbf84[_0xce0f('0x55')](_0x51a45c[_0xce0f('0x4c')],_0x51a45c[_0xce0f('0x54')]+path[_0xce0f('0x60')](_0x51a45c[_0xce0f('0x4c')]),function(){if(_0x355082){fs[_0xce0f('0x56')](_0x51a45c['value']);}});}else{return _0x4fbf84[_0xce0f('0x55')](_0x51a45c['value'],function(_0x2362ec){if(_0x355082){fs[_0xce0f('0x56')](_0x51a45c['value']);}});}}})[_0xce0f('0x46')](handleError(_0x4fbf84,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 92407b8..6d6feb5 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 _0xbc43=['bluebird','request-promise','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x165ce7,_0x28577b){var _0x163301=function(_0x9aef20){while(--_0x9aef20){_0x165ce7['push'](_0x165ce7['shift']());}};_0x163301(++_0x28577b);}(_0xbc43,0x13f));var _0x3bc4=function(_0x3ca80c,_0x5506a6){_0x3ca80c=_0x3ca80c-0x0;var _0x537b31=_0xbc43[_0x3ca80c];return _0x537b31;};'use strict';var _=require(_0x3bc4('0x0'));var util=require(_0x3bc4('0x1'));var logger=require(_0x3bc4('0x2'))(_0x3bc4('0x3'));var moment=require(_0x3bc4('0x4'));var BPromise=require(_0x3bc4('0x5'));var rp=require(_0x3bc4('0x6'));var attributes=require(_0x3bc4('0x7'));module[_0x3bc4('0x8')]=function(_0x2590f5,_0x5ac8cc){return _0x2590f5[_0x3bc4('0x9')](_0x3bc4('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x3bc4('0xb'),'fields':[_0x3bc4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0938=['exports','define','VoiceRecording','voice_recordings','uniqueid','util','moment','bluebird','request-promise','./voiceRecording.attributes'];(function(_0x2bb067,_0x30dcb9){var _0x65d9a3=function(_0x304000){while(--_0x304000){_0x2bb067['push'](_0x2bb067['shift']());}};_0x65d9a3(++_0x30dcb9);}(_0x0938,0x1d1));var _0x8093=function(_0x5717fa,_0x4c0526){_0x5717fa=_0x5717fa-0x0;var _0xcfcaa3=_0x0938[_0x5717fa];return _0xcfcaa3;};'use strict';var _=require('lodash');var util=require(_0x8093('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8093('0x1'));var BPromise=require(_0x8093('0x2'));var rp=require(_0x8093('0x3'));var attributes=require(_0x8093('0x4'));module[_0x8093('0x5')]=function(_0x2c397b,_0xc525a1){return _0x2c397b[_0x8093('0x6')](_0x8093('0x7'),attributes,{'tableName':_0x8093('0x8'),'paranoid':![],'indexes':[{'name':_0x8093('0x9'),'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 bf0a88b..470891a 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 _0x222e=['attributes','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','encryptFile','secrets','recording','then','unlink','CreateVoiceRecording\x20file\x20encrypted','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','VoiceRecording,\x20%s,\x20%s','message','catch','UpdateVoiceRecording','update','body','options','raw','where'];(function(_0x4310e0,_0x1787e4){var _0x515ad9=function(_0x544415){while(--_0x544415){_0x4310e0['push'](_0x4310e0['shift']());}};_0x515ad9(++_0x1787e4);}(_0x222e,0x9d));var _0xe222=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x222e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xe222('0x0'));var util=require('util');var moment=require(_0xe222('0x1'));var BPromise=require(_0xe222('0x2'));var rs=require(_0xe222('0x3'));var fs=require('fs');var Redis=require(_0xe222('0x4'));var db=require(_0xe222('0x5'))['db'];var utils=require(_0xe222('0x6'));var logger=require(_0xe222('0x7'))(_0xe222('0x8'));var config=require(_0xe222('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe222('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2037fd,_0x3d963d,_0x1af49e){return new BPromise(function(_0x182abe,_0x38c6a8){return client[_0xe222('0xb')](_0x2037fd,_0x1af49e)['then'](function(_0x45e17a){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x3d963d,'request\x20sent');logger[_0xe222('0xc')](_0xe222('0xd'),_0x3d963d,_0xe222('0xe'),JSON[_0xe222('0xf')](_0x45e17a));if(_0x45e17a['error']){if(_0x45e17a['error'][_0xe222('0x10')]===0x1f4){logger[_0xe222('0x11')](_0xe222('0x12'),_0x3d963d,_0x45e17a[_0xe222('0x11')]['message']);return _0x38c6a8(_0x45e17a[_0xe222('0x11')][_0xe222('0x13')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x3d963d,_0x45e17a[_0xe222('0x11')][_0xe222('0x13')]);return _0x182abe(_0x45e17a[_0xe222('0x11')][_0xe222('0x13')]);}else{logger['info'](_0xe222('0x12'),_0x3d963d,'request\x20sent');_0x182abe(_0x45e17a['result']['message']);}})[_0xe222('0x14')](function(_0x265977){logger['error'](_0xe222('0x12'),_0x3d963d,_0x265977);_0x38c6a8(_0x265977);});});}exports[_0xe222('0x15')]=function(_0xd396a3){var _0x3e35fc=this;return new Promise(function(_0x983773,_0x172c2e){return db['VoiceRecording'][_0xe222('0x16')](_0xd396a3[_0xe222('0x17')],{'raw':_0xd396a3[_0xe222('0x18')]?_0xd396a3[_0xe222('0x18')][_0xe222('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd396a3[_0xe222('0x18')]?_0xd396a3['options'][_0xe222('0x1a')]||null:null,'attributes':_0xd396a3[_0xe222('0x18')]?_0xd396a3[_0xe222('0x18')][_0xe222('0x1b')]||null:null,'limit':_0xd396a3[_0xe222('0x18')]?_0xd396a3[_0xe222('0x18')][_0xe222('0x1c')]||null:null})['then'](function(_0xc4838a){logger['info'](_0xe222('0x15'),_0xd396a3);logger[_0xe222('0xc')](_0xe222('0x15'),_0xd396a3,JSON['stringify'](_0xc4838a));_0x983773(_0xc4838a);})[_0xe222('0x14')](function(_0x1c2725){logger['error'](_0xe222('0x15'),_0x1c2725['message'],_0xd396a3);_0x172c2e(_0x3e35fc[_0xe222('0x11')](0x1f4,_0x1c2725['message']));});});};exports[_0xe222('0x1d')]=function(_0x25ad95){var _0x172043=this;return new Promise(function(_0x46f520,_0x3d42f6){var _0xd7e514=require(_0xe222('0x1e'));var _0x59e31d;return db[_0xe222('0x1f')][_0xe222('0x20')]({'attributes':['id',_0xe222('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x5e4a6a){_0x59e31d=_0x5e4a6a;return db[_0xe222('0x22')][_0xe222('0x23')](_0x25ad95[_0xe222('0x17')]);})['then'](function(_0x3dc4ba){if(_0x59e31d[_0xe222('0x21')]&&fs[_0xe222('0x24')](_0x3dc4ba[_0xe222('0x25')])){var _0x26a743=util[_0xe222('0x26')]('%s.cypher',_0x3dc4ba[_0xe222('0x25')]);return _0xd7e514[_0xe222('0x27')](_0x3dc4ba[_0xe222('0x25')],_0x26a743,config[_0xe222('0x28')][_0xe222('0x29')])[_0xe222('0x2a')](function(){fs[_0xe222('0x2b')](_0x3dc4ba[_0xe222('0x25')]);logger['info'](_0xe222('0x2c'));return _0x3dc4ba;});}return _0x3dc4ba;})[_0xe222('0x2a')](function(_0x3616f5){logger[_0xe222('0x2d')](_0xe222('0x1d'),_0x25ad95);logger[_0xe222('0xc')]('CreateVoiceRecording',_0x25ad95,JSON[_0xe222('0xf')](_0x3616f5));_0x46f520(_0x3616f5);})[_0xe222('0x14')](function(_0x112d41){logger['error'](_0xe222('0x1d'),_0x112d41[_0xe222('0x13')],_0x25ad95);_0x3d42f6(_0x172043[_0xe222('0x11')](0x1f4,_0x112d41[_0xe222('0x13')]));});});}; \ No newline at end of file +var _0xd2f8=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','VoiceRecording','update','body','raw','options','where','limit','UpdateVoiceRecording','debug','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2f8,0x1df));var _0x8d2f=function(_0x4906c7,_0x5e2ae3){_0x4906c7=_0x4906c7-0x0;var _0x44f12d=_0xd2f8[_0x4906c7];return _0x44f12d;};'use strict';var _=require(_0x8d2f('0x0'));var util=require(_0x8d2f('0x1'));var moment=require(_0x8d2f('0x2'));var BPromise=require(_0x8d2f('0x3'));var rs=require(_0x8d2f('0x4'));var fs=require('fs');var Redis=require(_0x8d2f('0x5'));var db=require(_0x8d2f('0x6'))['db'];var utils=require(_0x8d2f('0x7'));var logger=require('../../config/logger')(_0x8d2f('0x8'));var config=require(_0x8d2f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8d2f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x268394,_0x4c76ca,_0x2d38db){return new BPromise(function(_0x20d137,_0x14c6f9){return client[_0x8d2f('0xb')](_0x268394,_0x2d38db)[_0x8d2f('0xc')](function(_0x2d7b8e){logger[_0x8d2f('0xd')](_0x8d2f('0xe'),_0x4c76ca,_0x8d2f('0xf'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x4c76ca,_0x8d2f('0xf'),JSON[_0x8d2f('0x10')](_0x2d7b8e));if(_0x2d7b8e[_0x8d2f('0x11')]){if(_0x2d7b8e[_0x8d2f('0x11')]['code']===0x1f4){logger[_0x8d2f('0x11')](_0x8d2f('0xe'),_0x4c76ca,_0x2d7b8e[_0x8d2f('0x11')]['message']);return _0x14c6f9(_0x2d7b8e[_0x8d2f('0x11')][_0x8d2f('0x12')]);}logger[_0x8d2f('0x11')](_0x8d2f('0xe'),_0x4c76ca,_0x2d7b8e[_0x8d2f('0x11')]['message']);return _0x20d137(_0x2d7b8e['error'][_0x8d2f('0x12')]);}else{logger['info'](_0x8d2f('0xe'),_0x4c76ca,'request\x20sent');_0x20d137(_0x2d7b8e[_0x8d2f('0x13')][_0x8d2f('0x12')]);}})['catch'](function(_0x49146e){logger[_0x8d2f('0x11')](_0x8d2f('0xe'),_0x4c76ca,_0x49146e);_0x14c6f9(_0x49146e);});});}exports['UpdateVoiceRecording']=function(_0x57b476){var _0x5df9d9=this;return new Promise(function(_0x1a0dc1,_0x242fae){return db[_0x8d2f('0x14')][_0x8d2f('0x15')](_0x57b476[_0x8d2f('0x16')],{'raw':_0x57b476['options']?_0x57b476['options'][_0x8d2f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57b476[_0x8d2f('0x18')]?_0x57b476[_0x8d2f('0x18')][_0x8d2f('0x19')]||null:null,'attributes':_0x57b476[_0x8d2f('0x18')]?_0x57b476[_0x8d2f('0x18')]['attributes']||null:null,'limit':_0x57b476[_0x8d2f('0x18')]?_0x57b476['options'][_0x8d2f('0x1a')]||null:null})[_0x8d2f('0xc')](function(_0x2505c9){logger['info'](_0x8d2f('0x1b'),_0x57b476);logger[_0x8d2f('0x1c')]('UpdateVoiceRecording',_0x57b476,JSON['stringify'](_0x2505c9));_0x1a0dc1(_0x2505c9);})[_0x8d2f('0x1d')](function(_0x2752b0){logger[_0x8d2f('0x11')](_0x8d2f('0x1b'),_0x2752b0[_0x8d2f('0x12')],_0x57b476);_0x242fae(_0x5df9d9[_0x8d2f('0x11')](0x1f4,_0x2752b0['message']));});});};exports[_0x8d2f('0x1e')]=function(_0x5bf0c8){var _0x31c2fc=this;return new Promise(function(_0x99d511,_0x251aa0){var _0x3b3ae7=require(_0x8d2f('0x1f'));var _0x30ee72;return db[_0x8d2f('0x20')][_0x8d2f('0x21')]({'attributes':['id',_0x8d2f('0x22')],'where':{'id':0x1},'raw':!![]})[_0x8d2f('0xc')](function(_0x5e99e5){_0x30ee72=_0x5e99e5;return db[_0x8d2f('0x14')][_0x8d2f('0x23')](_0x5bf0c8[_0x8d2f('0x16')]);})[_0x8d2f('0xc')](function(_0x5b7e8b){if(_0x30ee72[_0x8d2f('0x22')]&&fs[_0x8d2f('0x24')](_0x5b7e8b['value'])){var _0xbf0cca=util['format'](_0x8d2f('0x25'),_0x5b7e8b[_0x8d2f('0x26')]);return _0x3b3ae7[_0x8d2f('0x27')](_0x5b7e8b['value'],_0xbf0cca,config[_0x8d2f('0x28')][_0x8d2f('0x29')])['then'](function(){fs[_0x8d2f('0x2a')](_0x5b7e8b['value']);logger['info'](_0x8d2f('0x2b'));return _0x5b7e8b;});}return _0x5b7e8b;})[_0x8d2f('0xc')](function(_0x49e06e){logger[_0x8d2f('0xd')]('CreateVoiceRecording',_0x5bf0c8);logger[_0x8d2f('0x1c')](_0x8d2f('0x1e'),_0x5bf0c8,JSON['stringify'](_0x49e06e));_0x99d511(_0x49e06e);})[_0x8d2f('0x1d')](function(_0x16d75d){logger[_0x8d2f('0x11')](_0x8d2f('0x1e'),_0x16d75d[_0x8d2f('0x12')],_0x5bf0c8);_0x251aa0(_0x31c2fc['error'](0x1f4,_0x16d75d[_0x8d2f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index d7d59bc..512433c 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 _0x7d5a=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','show','post','isAuthenticated','create','update'];(function(_0x58bf7c,_0x1ab137){var _0x292f7f=function(_0x20a4d5){while(--_0x20a4d5){_0x58bf7c['push'](_0x58bf7c['shift']());}};_0x292f7f(++_0x1ab137);}(_0x7d5a,0xec));var _0xa7d5=function(_0x35e879,_0x1c70bb){_0x35e879=_0x35e879-0x0;var _0x6d042c=_0x7d5a[_0x35e879];return _0x6d042c;};'use strict';var multer=require(_0xa7d5('0x0'));var util=require('util');var path=require(_0xa7d5('0x1'));var timeout=require(_0xa7d5('0x2'));var express=require(_0xa7d5('0x3'));var router=express[_0xa7d5('0x4')]();var auth=require(_0xa7d5('0x5'));var interaction=require(_0xa7d5('0x6'));var config=require(_0xa7d5('0x7'));var controller=require(_0xa7d5('0x8'));router[_0xa7d5('0x9')]('/',auth['isAuthenticated'](),controller[_0xa7d5('0xa')]);router[_0xa7d5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa7d5('0xb')]);router[_0xa7d5('0xc')]('/',auth[_0xa7d5('0xd')](),controller[_0xa7d5('0xe')]);router['put']('/:id',auth[_0xa7d5('0xd')](),controller[_0xa7d5('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa7d5('0x10')]);module[_0xa7d5('0x11')]=router; \ No newline at end of file +var _0x934e=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x5c679c,_0x509eac){var _0x513d47=function(_0x1dbd21){while(--_0x1dbd21){_0x5c679c['push'](_0x5c679c['shift']());}};_0x513d47(++_0x509eac);}(_0x934e,0x1a4));var _0xe934=function(_0x3917ce,_0x3e7959){_0x3917ce=_0x3917ce-0x0;var _0x10dfaf=_0x934e[_0x3917ce];return _0x10dfaf;};'use strict';var multer=require(_0xe934('0x0'));var util=require('util');var path=require(_0xe934('0x1'));var timeout=require(_0xe934('0x2'));var express=require(_0xe934('0x3'));var router=express[_0xe934('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe934('0x5'));var config=require(_0xe934('0x6'));var controller=require(_0xe934('0x7'));router[_0xe934('0x8')]('/',auth[_0xe934('0x9')](),controller[_0xe934('0xa')]);router[_0xe934('0x8')](_0xe934('0xb'),auth['isAuthenticated'](),controller[_0xe934('0xc')]);router[_0xe934('0xd')]('/',auth[_0xe934('0x9')](),controller[_0xe934('0xe')]);router['put'](_0xe934('0xb'),auth[_0xe934('0x9')](),controller[_0xe934('0xf')]);router[_0xe934('0x10')](_0xe934('0xb'),auth[_0xe934('0x9')](),controller[_0xe934('0x11')]);module[_0xe934('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b87a005..44fbadf 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 _0x382b=['blind','attended','STRING','sequelize','moment','ENUM'];(function(_0x119ada,_0x5e5332){var _0x3240d2=function(_0x32a75a){while(--_0x32a75a){_0x119ada['push'](_0x119ada['shift']());}};_0x3240d2(++_0x5e5332);}(_0x382b,0x177));var _0xb382=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x382b[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xb382('0x0'));var moment=require(_0xb382('0x1'));module['exports']={'type':{'type':Sequelize[_0xb382('0x2')](_0xb382('0x3'),_0xb382('0x4'))},'result':{'type':Sequelize[_0xb382('0x5')]},'transfererchannel':{'type':Sequelize[_0xb382('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xb382('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb382('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xb382('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xb382('0x5')]},'transfererexten':{'type':Sequelize[_0xb382('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xb382('0x5')]},'transfereechannel':{'type':Sequelize[_0xb382('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xb382('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb382('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb382('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xb382('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xb382('0x5')]},'isexternal':{'type':Sequelize[_0xb382('0x2')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xb382('0x5')]}}; \ No newline at end of file +var _0x3e2b=['blind','attended','STRING','Yes','sequelize','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3e2b,0x9a));var _0xb3e2=function(_0x471c91,_0x32996f){_0x471c91=_0x471c91-0x0;var _0x482951=_0x3e2b[_0x471c91];return _0x482951;};'use strict';var Sequelize=require(_0xb3e2('0x0'));var moment=require(_0xb3e2('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb3e2('0x2'),_0xb3e2('0x3'))},'result':{'type':Sequelize[_0xb3e2('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xb3e2('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xb3e2('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xb3e2('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xb3e2('0x4')]},'transferercontext':{'type':Sequelize[_0xb3e2('0x4')]},'transfererexten':{'type':Sequelize[_0xb3e2('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xb3e2('0x4')]},'transfereechannel':{'type':Sequelize[_0xb3e2('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xb3e2('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xb3e2('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xb3e2('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0xb3e2('0x5'),'No')},'context':{'type':Sequelize[_0xb3e2('0x4')]},'extension':{'type':Sequelize[_0xb3e2('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e4e4595..c78e914 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 _0xd61f=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','VoiceTransferReport','rawAttributes','keys','query','filters','intersection','model','fields','length','attributes','nolimit','order','sort','where','filter','merge','map','key','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs'];(function(_0xb4550c,_0x5d212d){var _0x2c6490=function(_0x43d7d9){while(--_0x43d7d9){_0xb4550c['push'](_0xb4550c['shift']());}};_0x2c6490(++_0x5d212d);}(_0xd61f,0x113));var _0xfd61=function(_0x62aa8e,_0x2b40f4){_0x62aa8e=_0x62aa8e-0x0;var _0x56cba3=_0xd61f[_0x62aa8e];return _0x56cba3;};'use strict';var pdf=require(_0xfd61('0x0'));var emlformat=require(_0xfd61('0x1'));var rimraf=require(_0xfd61('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd61('0x3'));var rp=require(_0xfd61('0x4'));var moment=require(_0xfd61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfd61('0x6'));var util=require(_0xfd61('0x7'));var path=require(_0xfd61('0x8'));var sox=require(_0xfd61('0x9'));var csv=require('to-csv');var ejs=require(_0xfd61('0xa'));var fs=require('fs');var _=require(_0xfd61('0xb'));var squel=require(_0xfd61('0xc'));var crypto=require(_0xfd61('0xd'));var jsforce=require(_0xfd61('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfd61('0xf'));var querystring=require(_0xfd61('0x10'));var Papa=require('papaparse');var authService=require(_0xfd61('0x11'));var hardwareService=require(_0xfd61('0x12'));var Redis=require(_0xfd61('0x13'));var qs=require(_0xfd61('0x14'));var logger=require(_0xfd61('0x15'))(_0xfd61('0x16'));var utils=require(_0xfd61('0x17'));var config=require(_0xfd61('0x18'));var db=require(_0xfd61('0x19'))['db'];function respondWithStatusCode(_0x17c649,_0x2e1f35){_0x2e1f35=_0x2e1f35||0xcc;return function(_0x35a9b2){if(_0x35a9b2){return _0x17c649[_0xfd61('0x1a')](_0x2e1f35);}return _0x17c649[_0xfd61('0x1b')](_0x2e1f35)[_0xfd61('0x1c')]();};}function respondWithResult(_0x4f62ba,_0x1e08e6){_0x1e08e6=_0x1e08e6||0xc8;return function(_0x5d23fe){if(_0x5d23fe){return _0x4f62ba[_0xfd61('0x1b')](_0x1e08e6)[_0xfd61('0x1d')](_0x5d23fe);}};}function respondWithFilteredResult(_0x374d87,_0x5a8829){return function(_0x5aa64a){if(_0x5aa64a){var _0x448e59=_0x5aa64a[_0xfd61('0x1e')],_0x27cd81=_0x5a8829[_0xfd61('0x1f')],_0x450661=_0x5a8829[_0xfd61('0x1f')]+_0x5a8829[_0xfd61('0x20')],_0x2db637;if(_0x450661>=_0x448e59){_0x450661=_0x448e59;_0x2db637=0xc8;}else{_0x2db637=0xce;}_0x374d87[_0xfd61('0x1b')](_0x2db637);return _0x374d87[_0xfd61('0x21')](_0xfd61('0x22'),_0x27cd81+'-'+_0x450661+'/'+_0x448e59)[_0xfd61('0x1d')](_0x5aa64a);}return null;};}function patchUpdates(_0x9039d2){return function(_0x1cb262){try{jsonpatch['apply'](_0x1cb262,_0x9039d2,!![]);}catch(_0x3ff017){return BPromise[_0xfd61('0x23')](_0x3ff017);}return _0x1cb262[_0xfd61('0x24')]();};}function saveUpdates(_0x93c816,_0x5622a5){return function(_0xef2234){if(_0xef2234){return _0xef2234['update'](_0x93c816)[_0xfd61('0x25')](function(_0x5daa3a){return _0x5daa3a;});}return null;};}function removeEntity(_0x588f6f,_0x4c365d){return function(_0x77d910){if(_0x77d910){return _0x77d910[_0xfd61('0x26')]()[_0xfd61('0x25')](function(){_0x588f6f['status'](0xcc)[_0xfd61('0x1c')]();});}};}function handleEntityNotFound(_0x354490,_0x31361e){return function(_0x3c0787){if(!_0x3c0787){_0x354490[_0xfd61('0x1a')](0x194);}return _0x3c0787;};}function handleError(_0x8d763d,_0x5aad94){_0x5aad94=_0x5aad94||0x1f4;return function(_0x6bb91b){logger[_0xfd61('0x27')](_0x6bb91b[_0xfd61('0x28')]);if(_0x6bb91b[_0xfd61('0x29')]){delete _0x6bb91b[_0xfd61('0x29')];}_0x8d763d[_0xfd61('0x1b')](_0x5aad94)[_0xfd61('0x2a')](_0x6bb91b);};}exports['index']=function(_0x1cacae,_0x51557e){var _0x5aa780={},_0x13fcf5={},_0x49e4a7={'count':0x0,'rows':[]};var _0x19b0cf=db[_0xfd61('0x2b')][_0xfd61('0x2c')];_0x13fcf5['model']=_[_0xfd61('0x2d')](_0x19b0cf);_0x13fcf5[_0xfd61('0x2e')]=_[_0xfd61('0x2d')](_0x1cacae[_0xfd61('0x2e')]);_0x13fcf5[_0xfd61('0x2f')]=_[_0xfd61('0x30')](_0x13fcf5[_0xfd61('0x31')],_0x13fcf5[_0xfd61('0x2e')]);_0x5aa780['attributes']=_[_0xfd61('0x30')](_0x13fcf5[_0xfd61('0x31')],qs[_0xfd61('0x32')](_0x1cacae[_0xfd61('0x2e')][_0xfd61('0x32')]));_0x5aa780['attributes']=_0x5aa780['attributes'][_0xfd61('0x33')]?_0x5aa780[_0xfd61('0x34')]:_0x13fcf5[_0xfd61('0x31')];if(!_0x1cacae[_0xfd61('0x2e')]['hasOwnProperty'](_0xfd61('0x35'))){_0x5aa780[_0xfd61('0x20')]=qs['limit'](_0x1cacae[_0xfd61('0x2e')]['limit']);_0x5aa780['offset']=qs['offset'](_0x1cacae['query'][_0xfd61('0x1f')]);}_0x5aa780[_0xfd61('0x36')]=qs['sort'](_0x1cacae['query'][_0xfd61('0x37')]);_0x5aa780[_0xfd61('0x38')]=qs[_0xfd61('0x2f')](_['pick'](_0x1cacae['query'],_0x13fcf5[_0xfd61('0x2f')]));if(_0x1cacae[_0xfd61('0x2e')][_0xfd61('0x39')]){_0x5aa780['where']=_[_0xfd61('0x3a')](_0x5aa780[_0xfd61('0x38')],{'$or':_[_0xfd61('0x3b')](_0x19b0cf,function(_0x299187){if(_0x299187['type'][_0xfd61('0x3c')]!==_0xfd61('0x3d')){var _0x9893db={};_0x9893db[_0x299187['field']]={'$like':'%'+_0x1cacae[_0xfd61('0x2e')][_0xfd61('0x39')]+'%'};return _0x9893db;}})});}_0x5aa780=_[_0xfd61('0x3a')]({},_0x5aa780,_0x1cacae[_0xfd61('0x3e')]);var _0x1df7d6={'where':_0x5aa780[_0xfd61('0x38')]};return db['VoiceTransferReport'][_0xfd61('0x1e')](_0x1df7d6)[_0xfd61('0x25')](function(_0xb03836){_0x49e4a7[_0xfd61('0x1e')]=_0xb03836;if(_0x1cacae['query']['includeAll']){_0x5aa780[_0xfd61('0x3f')]=[{'all':!![]}];}return db[_0xfd61('0x2b')][_0xfd61('0x40')](_0x5aa780);})[_0xfd61('0x25')](function(_0x221a49){_0x49e4a7[_0xfd61('0x41')]=_0x221a49;return _0x49e4a7;})[_0xfd61('0x25')](respondWithFilteredResult(_0x51557e,_0x5aa780))[_0xfd61('0x42')](handleError(_0x51557e,null));};exports[_0xfd61('0x43')]=function(_0x31ea1c,_0x44c88f){var _0x1f9814={'raw':!![],'where':{'id':_0x31ea1c['params']['id']}},_0x5a07e7={};_0x5a07e7[_0xfd61('0x31')]=_[_0xfd61('0x2d')](db[_0xfd61('0x2b')][_0xfd61('0x2c')]);_0x5a07e7['query']=_[_0xfd61('0x2d')](_0x31ea1c[_0xfd61('0x2e')]);_0x5a07e7[_0xfd61('0x2f')]=_[_0xfd61('0x30')](_0x5a07e7[_0xfd61('0x31')],_0x5a07e7[_0xfd61('0x2e')]);_0x1f9814[_0xfd61('0x34')]=_['intersection'](_0x5a07e7[_0xfd61('0x31')],qs[_0xfd61('0x32')](_0x31ea1c[_0xfd61('0x2e')][_0xfd61('0x32')]));_0x1f9814[_0xfd61('0x34')]=_0x1f9814[_0xfd61('0x34')][_0xfd61('0x33')]?_0x1f9814['attributes']:_0x5a07e7[_0xfd61('0x31')];if(_0x31ea1c[_0xfd61('0x2e')][_0xfd61('0x44')]){_0x1f9814[_0xfd61('0x3f')]=[{'all':!![]}];}_0x1f9814=_['merge']({},_0x1f9814,_0x31ea1c[_0xfd61('0x3e')]);return db[_0xfd61('0x2b')][_0xfd61('0x45')](_0x1f9814)[_0xfd61('0x25')](handleEntityNotFound(_0x44c88f,null))[_0xfd61('0x25')](respondWithResult(_0x44c88f,null))[_0xfd61('0x42')](handleError(_0x44c88f,null));};exports[_0xfd61('0x46')]=function(_0x4c8256,_0x72ea69){return db[_0xfd61('0x2b')][_0xfd61('0x46')](_0x4c8256[_0xfd61('0x47')],{})['then'](respondWithResult(_0x72ea69,0xc9))[_0xfd61('0x42')](handleError(_0x72ea69,null));};exports[_0xfd61('0x48')]=function(_0x17bd11,_0x2d8eaa){if(_0x17bd11['body']['id']){delete _0x17bd11[_0xfd61('0x47')]['id'];}return db[_0xfd61('0x2b')][_0xfd61('0x45')]({'where':{'id':_0x17bd11[_0xfd61('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d8eaa,null))[_0xfd61('0x25')](saveUpdates(_0x17bd11[_0xfd61('0x47')],null))[_0xfd61('0x25')](respondWithResult(_0x2d8eaa,null))[_0xfd61('0x42')](handleError(_0x2d8eaa,null));};exports[_0xfd61('0x26')]=function(_0x178edb,_0x23d386){return db[_0xfd61('0x2b')]['find']({'where':{'id':_0x178edb['params']['id']}})['then'](handleEntityNotFound(_0x23d386,null))['then'](removeEntity(_0x23d386,null))['catch'](handleError(_0x23d386,null));}; \ No newline at end of file +var _0x537a=['count','offset','limit','set','Content-Range','save','destroy','then','end','sendStatus','error','stack','name','index','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','VoiceTransferReport','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','status','json'];(function(_0x2bcd42,_0x946248){var _0x34d7fd=function(_0x5e3413){while(--_0x5e3413){_0x2bcd42['push'](_0x2bcd42['shift']());}};_0x34d7fd(++_0x946248);}(_0x537a,0xf7));var _0xa537=function(_0x4c660e,_0xf9298a){_0x4c660e=_0x4c660e-0x0;var _0x10a16d=_0x537a[_0x4c660e];return _0x10a16d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa537('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa537('0x1'));var jsonpatch=require(_0xa537('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa537('0x3'));var Mustache=require(_0xa537('0x4'));var util=require(_0xa537('0x5'));var path=require(_0xa537('0x6'));var sox=require(_0xa537('0x7'));var csv=require(_0xa537('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa537('0x9'));var squel=require(_0xa537('0xa'));var crypto=require(_0xa537('0xb'));var jsforce=require(_0xa537('0xc'));var deskjs=require(_0xa537('0xd'));var toCsv=require(_0xa537('0x8'));var querystring=require('querystring');var Papa=require(_0xa537('0xe'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0xa537('0xf'));var logger=require('../../config/logger')(_0xa537('0x10'));var utils=require(_0xa537('0x11'));var config=require('../../config/environment');var db=require(_0xa537('0x12'))['db'];function respondWithStatusCode(_0x15932f,_0x2aae2a){_0x2aae2a=_0x2aae2a||0xcc;return function(_0x29491d){if(_0x29491d){return _0x15932f['sendStatus'](_0x2aae2a);}return _0x15932f[_0xa537('0x13')](_0x2aae2a)['end']();};}function respondWithResult(_0x3c585e,_0x13f26f){_0x13f26f=_0x13f26f||0xc8;return function(_0x2464cb){if(_0x2464cb){return _0x3c585e[_0xa537('0x13')](_0x13f26f)[_0xa537('0x14')](_0x2464cb);}};}function respondWithFilteredResult(_0x498b09,_0x91bd37){return function(_0x43b677){if(_0x43b677){var _0x3f6396=_0x43b677[_0xa537('0x15')],_0x321b8e=_0x91bd37[_0xa537('0x16')],_0x3c399c=_0x91bd37[_0xa537('0x16')]+_0x91bd37[_0xa537('0x17')],_0x1796bf;if(_0x3c399c>=_0x3f6396){_0x3c399c=_0x3f6396;_0x1796bf=0xc8;}else{_0x1796bf=0xce;}_0x498b09[_0xa537('0x13')](_0x1796bf);return _0x498b09[_0xa537('0x18')](_0xa537('0x19'),_0x321b8e+'-'+_0x3c399c+'/'+_0x3f6396)[_0xa537('0x14')](_0x43b677);}return null;};}function patchUpdates(_0x51e608){return function(_0x3a6c1c){try{jsonpatch['apply'](_0x3a6c1c,_0x51e608,!![]);}catch(_0x2a9b6a){return BPromise['reject'](_0x2a9b6a);}return _0x3a6c1c[_0xa537('0x1a')]();};}function saveUpdates(_0x70c23d,_0x1c7697){return function(_0x278d02){if(_0x278d02){return _0x278d02['update'](_0x70c23d)['then'](function(_0x33555e){return _0x33555e;});}return null;};}function removeEntity(_0x5dba28,_0x156c16){return function(_0x3d6970){if(_0x3d6970){return _0x3d6970[_0xa537('0x1b')]()[_0xa537('0x1c')](function(){_0x5dba28['status'](0xcc)[_0xa537('0x1d')]();});}};}function handleEntityNotFound(_0xb6debc,_0x425584){return function(_0x341549){if(!_0x341549){_0xb6debc[_0xa537('0x1e')](0x194);}return _0x341549;};}function handleError(_0x330dbe,_0x4d682e){_0x4d682e=_0x4d682e||0x1f4;return function(_0x65afaf){logger[_0xa537('0x1f')](_0x65afaf[_0xa537('0x20')]);if(_0x65afaf[_0xa537('0x21')]){delete _0x65afaf['name'];}_0x330dbe['status'](_0x4d682e)['send'](_0x65afaf);};}exports[_0xa537('0x22')]=function(_0xfd1f49,_0x373c0b){var _0x3d1ea8={},_0x5c6054={},_0x3692c7={'count':0x0,'rows':[]};var _0x8601a6=db['VoiceTransferReport'][_0xa537('0x23')];_0x5c6054[_0xa537('0x24')]=_['keys'](_0x8601a6);_0x5c6054[_0xa537('0x25')]=_['keys'](_0xfd1f49['query']);_0x5c6054[_0xa537('0x26')]=_[_0xa537('0x27')](_0x5c6054['model'],_0x5c6054[_0xa537('0x25')]);_0x3d1ea8[_0xa537('0x28')]=_['intersection'](_0x5c6054['model'],qs[_0xa537('0x29')](_0xfd1f49[_0xa537('0x25')][_0xa537('0x29')]));_0x3d1ea8[_0xa537('0x28')]=_0x3d1ea8[_0xa537('0x28')][_0xa537('0x2a')]?_0x3d1ea8[_0xa537('0x28')]:_0x5c6054['model'];if(!_0xfd1f49[_0xa537('0x25')][_0xa537('0x2b')]('nolimit')){_0x3d1ea8['limit']=qs['limit'](_0xfd1f49[_0xa537('0x25')][_0xa537('0x17')]);_0x3d1ea8[_0xa537('0x16')]=qs[_0xa537('0x16')](_0xfd1f49['query']['offset']);}_0x3d1ea8['order']=qs[_0xa537('0x2c')](_0xfd1f49[_0xa537('0x25')][_0xa537('0x2c')]);_0x3d1ea8[_0xa537('0x2d')]=qs['filters'](_[_0xa537('0x2e')](_0xfd1f49[_0xa537('0x25')],_0x5c6054[_0xa537('0x26')]));if(_0xfd1f49[_0xa537('0x25')][_0xa537('0x2f')]){_0x3d1ea8[_0xa537('0x2d')]=_[_0xa537('0x30')](_0x3d1ea8[_0xa537('0x2d')],{'$or':_[_0xa537('0x31')](_0x8601a6,function(_0x14cc4b){if(_0x14cc4b[_0xa537('0x32')][_0xa537('0x33')]!==_0xa537('0x34')){var _0x1cc237={};_0x1cc237[_0x14cc4b[_0xa537('0x35')]]={'$like':'%'+_0xfd1f49['query']['filter']+'%'};return _0x1cc237;}})});}_0x3d1ea8=_[_0xa537('0x30')]({},_0x3d1ea8,_0xfd1f49[_0xa537('0x36')]);var _0x1c41fb={'where':_0x3d1ea8[_0xa537('0x2d')]};return db[_0xa537('0x37')]['count'](_0x1c41fb)[_0xa537('0x1c')](function(_0x2c2783){_0x3692c7['count']=_0x2c2783;if(_0xfd1f49[_0xa537('0x25')][_0xa537('0x38')]){_0x3d1ea8[_0xa537('0x39')]=[{'all':!![]}];}return db[_0xa537('0x37')][_0xa537('0x3a')](_0x3d1ea8);})[_0xa537('0x1c')](function(_0xd87c29){_0x3692c7['rows']=_0xd87c29;return _0x3692c7;})[_0xa537('0x1c')](respondWithFilteredResult(_0x373c0b,_0x3d1ea8))[_0xa537('0x3b')](handleError(_0x373c0b,null));};exports[_0xa537('0x3c')]=function(_0x2aa29b,_0x1fee5d){var _0x28fc55={'raw':!![],'where':{'id':_0x2aa29b[_0xa537('0x3d')]['id']}},_0x58e917={};_0x58e917['model']=_[_0xa537('0x3e')](db[_0xa537('0x37')][_0xa537('0x23')]);_0x58e917[_0xa537('0x25')]=_[_0xa537('0x3e')](_0x2aa29b[_0xa537('0x25')]);_0x58e917[_0xa537('0x26')]=_[_0xa537('0x27')](_0x58e917[_0xa537('0x24')],_0x58e917[_0xa537('0x25')]);_0x28fc55[_0xa537('0x28')]=_[_0xa537('0x27')](_0x58e917['model'],qs['fields'](_0x2aa29b['query']['fields']));_0x28fc55[_0xa537('0x28')]=_0x28fc55[_0xa537('0x28')][_0xa537('0x2a')]?_0x28fc55[_0xa537('0x28')]:_0x58e917[_0xa537('0x24')];if(_0x2aa29b[_0xa537('0x25')][_0xa537('0x38')]){_0x28fc55[_0xa537('0x39')]=[{'all':!![]}];}_0x28fc55=_[_0xa537('0x30')]({},_0x28fc55,_0x2aa29b[_0xa537('0x36')]);return db[_0xa537('0x37')][_0xa537('0x3f')](_0x28fc55)['then'](handleEntityNotFound(_0x1fee5d,null))['then'](respondWithResult(_0x1fee5d,null))[_0xa537('0x3b')](handleError(_0x1fee5d,null));};exports[_0xa537('0x40')]=function(_0x24a6b1,_0x23a8d1){return db['VoiceTransferReport'][_0xa537('0x40')](_0x24a6b1[_0xa537('0x41')],{})[_0xa537('0x1c')](respondWithResult(_0x23a8d1,0xc9))['catch'](handleError(_0x23a8d1,null));};exports[_0xa537('0x42')]=function(_0x325dc3,_0x148b29){if(_0x325dc3[_0xa537('0x41')]['id']){delete _0x325dc3['body']['id'];}return db[_0xa537('0x37')][_0xa537('0x3f')]({'where':{'id':_0x325dc3[_0xa537('0x3d')]['id']}})[_0xa537('0x1c')](handleEntityNotFound(_0x148b29,null))[_0xa537('0x1c')](saveUpdates(_0x325dc3[_0xa537('0x41')],null))[_0xa537('0x1c')](respondWithResult(_0x148b29,null))[_0xa537('0x3b')](handleError(_0x148b29,null));};exports[_0xa537('0x1b')]=function(_0x17bcb9,_0x2bfc20){return db[_0xa537('0x37')][_0xa537('0x3f')]({'where':{'id':_0x17bcb9[_0xa537('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2bfc20,null))[_0xa537('0x1c')](removeEntity(_0x2bfc20,null))['catch'](handleError(_0x2bfc20,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index da8f7b4..ee83544 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 _0xed3a=['moment','bluebird','request-promise','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util','api'];(function(_0x483e77,_0x433e9b){var _0x359df0=function(_0x3c3d57){while(--_0x3c3d57){_0x483e77['push'](_0x483e77['shift']());}};_0x359df0(++_0x433e9b);}(_0xed3a,0x6b));var _0xaed3=function(_0x25e48d,_0x310033){_0x25e48d=_0x25e48d-0x0;var _0x3fb2b4=_0xed3a[_0x25e48d];return _0x3fb2b4;};'use strict';var _=require(_0xaed3('0x0'));var util=require(_0xaed3('0x1'));var logger=require('../../config/logger')(_0xaed3('0x2'));var moment=require(_0xaed3('0x3'));var BPromise=require(_0xaed3('0x4'));var rp=require(_0xaed3('0x5'));var attributes=require(_0xaed3('0x6'));module[_0xaed3('0x7')]=function(_0x515e41,_0x3995a1){return _0x515e41[_0xaed3('0x8')]('VoiceTransferReport',attributes,{'tableName':_0xaed3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x762c=['VoiceTransferReport','report_call_transfer','../../config/logger','api','moment','./voiceTransferReport.attributes','exports','define'];(function(_0xf887c0,_0x444be9){var _0x7ad487=function(_0x1be345){while(--_0x1be345){_0xf887c0['push'](_0xf887c0['shift']());}};_0x7ad487(++_0x444be9);}(_0x762c,0x1f2));var _0xc762=function(_0x303b63,_0x321deb){_0x303b63=_0x303b63-0x0;var _0x33fdb5=_0x762c[_0x303b63];return _0x33fdb5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc762('0x0'))(_0xc762('0x1'));var moment=require(_0xc762('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xc762('0x3'));module[_0xc762('0x4')]=function(_0x2affa4,_0x2ed72e){return _0x2affa4[_0xc762('0x5')](_0xc762('0x6'),attributes,{'tableName':_0xc762('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 9f62888..4218a38 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 _0x0e65=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','result','CreateVoiceTransferReport','body','options','raw','info','debug','catch'];(function(_0xab3e1c,_0x15dfa0){var _0x548011=function(_0x5357df){while(--_0x5357df){_0xab3e1c['push'](_0xab3e1c['shift']());}};_0x548011(++_0x15dfa0);}(_0x0e65,0x129));var _0x50e6=function(_0x157acf,_0x3fc35f){_0x157acf=_0x157acf-0x0;var _0x26c2ac=_0x0e65[_0x157acf];return _0x26c2ac;};'use strict';var _=require(_0x50e6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x50e6('0x1'));var rs=require(_0x50e6('0x2'));var fs=require('fs');var Redis=require(_0x50e6('0x3'));var db=require(_0x50e6('0x4'))['db'];var utils=require(_0x50e6('0x5'));var logger=require(_0x50e6('0x6'))(_0x50e6('0x7'));var config=require(_0x50e6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x50e6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e0e9,_0x4df292,_0x2c98dc){return new BPromise(function(_0x2145ab,_0x6c0c9c){return client[_0x50e6('0xa')](_0x56e0e9,_0x2c98dc)[_0x50e6('0xb')](function(_0x16e009){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x4df292,'request\x20sent');logger['debug'](_0x50e6('0xc'),_0x4df292,'request\x20sent',JSON[_0x50e6('0xd')](_0x16e009));if(_0x16e009['error']){if(_0x16e009[_0x50e6('0xe')][_0x50e6('0xf')]===0x1f4){logger[_0x50e6('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x4df292,_0x16e009['error']['message']);return _0x6c0c9c(_0x16e009[_0x50e6('0xe')][_0x50e6('0x10')]);}logger[_0x50e6('0xe')](_0x50e6('0x11'),_0x4df292,_0x16e009[_0x50e6('0xe')][_0x50e6('0x10')]);return _0x2145ab(_0x16e009[_0x50e6('0xe')][_0x50e6('0x10')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x4df292,_0x50e6('0x12'));_0x2145ab(_0x16e009[_0x50e6('0x13')][_0x50e6('0x10')]);}})['catch'](function(_0x39032d){logger[_0x50e6('0xe')](_0x50e6('0x11'),_0x4df292,_0x39032d);_0x6c0c9c(_0x39032d);});});}exports[_0x50e6('0x14')]=function(_0x5aa19f){var _0x2f8502=this;return new Promise(function(_0x4f2b5b,_0x25e137){return db['VoiceTransferReport']['create'](_0x5aa19f[_0x50e6('0x15')],{'raw':_0x5aa19f[_0x50e6('0x16')]?_0x5aa19f[_0x50e6('0x16')][_0x50e6('0x17')]===undefined?!![]:![]:!![]})[_0x50e6('0xb')](function(_0x4b22da){logger[_0x50e6('0x18')](_0x50e6('0x14'),_0x5aa19f);logger[_0x50e6('0x19')]('CreateVoiceTransferReport',_0x5aa19f,JSON[_0x50e6('0xd')](_0x4b22da));_0x4f2b5b(_0x4b22da);})[_0x50e6('0x1a')](function(_0x4e62ee){logger['error'](_0x50e6('0x14'),_0x4e62ee[_0x50e6('0x10')],_0x5aa19f);_0x25e137(_0x2f8502[_0x50e6('0xe')](0x1f4,_0x4e62ee[_0x50e6('0x10')]));});});}; \ No newline at end of file +var _0x54c8=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x56ecb5,_0x27b6ae){var _0x3b0e5b=function(_0x32670d){while(--_0x32670d){_0x56ecb5['push'](_0x56ecb5['shift']());}};_0x3b0e5b(++_0x27b6ae);}(_0x54c8,0xb6));var _0x854c=function(_0x17db98,_0x12613f){_0x17db98=_0x17db98-0x0;var _0x5af064=_0x54c8[_0x17db98];return _0x5af064;};'use strict';var _=require(_0x854c('0x0'));var util=require(_0x854c('0x1'));var moment=require('moment');var BPromise=require(_0x854c('0x2'));var rs=require(_0x854c('0x3'));var fs=require('fs');var Redis=require(_0x854c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x854c('0x5'));var logger=require(_0x854c('0x6'))(_0x854c('0x7'));var config=require(_0x854c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x854c('0x9')][_0x854c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9daa75,_0x292368,_0x177d33){return new BPromise(function(_0xdfbc57,_0x45eda7){return client[_0x854c('0xb')](_0x9daa75,_0x177d33)[_0x854c('0xc')](function(_0x21d7d8){logger[_0x854c('0xd')](_0x854c('0xe'),_0x292368,_0x854c('0xf'));logger[_0x854c('0x10')](_0x854c('0x11'),_0x292368,_0x854c('0xf'),JSON['stringify'](_0x21d7d8));if(_0x21d7d8[_0x854c('0x12')]){if(_0x21d7d8[_0x854c('0x12')][_0x854c('0x13')]===0x1f4){logger[_0x854c('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x292368,_0x21d7d8[_0x854c('0x12')]['message']);return _0x45eda7(_0x21d7d8[_0x854c('0x12')][_0x854c('0x14')]);}logger[_0x854c('0x12')](_0x854c('0xe'),_0x292368,_0x21d7d8[_0x854c('0x12')][_0x854c('0x14')]);return _0xdfbc57(_0x21d7d8[_0x854c('0x12')]['message']);}else{logger[_0x854c('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x292368,_0x854c('0xf'));_0xdfbc57(_0x21d7d8[_0x854c('0x15')][_0x854c('0x14')]);}})[_0x854c('0x16')](function(_0x34d203){logger['error'](_0x854c('0xe'),_0x292368,_0x34d203);_0x45eda7(_0x34d203);});});}exports[_0x854c('0x17')]=function(_0x182f58){var _0x2d4df0=this;return new Promise(function(_0x26ab87,_0x56d364){return db[_0x854c('0x18')][_0x854c('0x19')](_0x182f58[_0x854c('0x1a')],{'raw':_0x182f58[_0x854c('0x1b')]?_0x182f58[_0x854c('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x854c('0xc')](function(_0x102477){logger[_0x854c('0xd')](_0x854c('0x17'),_0x182f58);logger[_0x854c('0x10')](_0x854c('0x17'),_0x182f58,JSON[_0x854c('0x1c')](_0x102477));_0x26ab87(_0x102477);})[_0x854c('0x16')](function(_0x4de2b9){logger['error'](_0x854c('0x17'),_0x4de2b9['message'],_0x182f58);_0x56d364(_0x2d4df0[_0x854c('0x12')](0x1f4,_0x4de2b9[_0x854c('0x14')]));});});}; \ No newline at end of file diff --git a/server/app.js b/server/app.js index 90c3035..341d650 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5467=['default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/logger','./config/schedule','./config/schedule/chat','sequelize','sync','then','start','info','Online\x20apps:','map','online','name','join','Offline\x20apps:','status','None','seedDB','./config/seedDB'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0x5467,0x183));var _0x7546=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x5467[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x7546('0x0'));var mysqldb=require(_0x7546('0x1'));var rpc=require(_0x7546('0x2'));var config=require('./config/environment');var logger=require(_0x7546('0x3'))('app');var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x7546('0x4'));var chat=require(_0x7546('0x5'));function main(){return mysqldb['db'][_0x7546('0x6')][_0x7546('0x7')]()['then'](function(){return rpc['listen']();})[_0x7546('0x8')](function(_0x314c4e){logger['info'](_0x314c4e);return chat[_0x7546('0x9')]();})['then'](function(){return schedule[_0x7546('0x9')]();})['then'](function(_0x7cdca6){logger[_0x7546('0xa')](_0x7cdca6);return pm2[_0x7546('0x9')](pm2Config);})[_0x7546('0x8')](function(_0x161dd5){logger[_0x7546('0xa')](_0x7546('0xb'),_[_0x7546('0xc')](_['filter'](_0x161dd5,{'status':_0x7546('0xd')}),_0x7546('0xe'))[_0x7546('0xf')]());logger[_0x7546('0xa')](_0x7546('0x10'),_[_0x7546('0xc')](_['filter'](_0x161dd5,function(_0xf3573b){return _0xf3573b[_0x7546('0x11')]!==_0x7546('0xd');}),'name')[_0x7546('0xf')]()||_0x7546('0x12'));config[_0x7546('0x13')]&&require(_0x7546('0x14'))[_0x7546('0x15')]();require('./config/license')['default']();})['catch'](function(_0x402803){logger[_0x7546('0x16')](_0x7546('0x17'),_0x402803);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xd4ad=['./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/schedule/chat','sequelize','then','start','info','Online\x20apps:','filter','online','join','map','None','./config/license','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash'];(function(_0x22e9af,_0x202f89){var _0x4daad8=function(_0x458864){while(--_0x458864){_0x22e9af['push'](_0x22e9af['shift']());}};_0x4daad8(++_0x202f89);}(_0xd4ad,0x158));var _0xdd4a=function(_0x273f27,_0x2b094e){_0x273f27=_0x273f27-0x0;var _0x1cd257=_0xd4ad[_0x273f27];return _0x1cd257;};'use strict';var _=require(_0xdd4a('0x0'));var mysqldb=require(_0xdd4a('0x1'));var rpc=require(_0xdd4a('0x2'));var config=require(_0xdd4a('0x3'));var logger=require('./config/logger')(_0xdd4a('0x4'));var pm2=require(_0xdd4a('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0xdd4a('0x6'));function main(){return mysqldb['db'][_0xdd4a('0x7')]['sync']()[_0xdd4a('0x8')](function(){return rpc['listen']();})[_0xdd4a('0x8')](function(_0xb14ae6){logger['info'](_0xb14ae6);return chat[_0xdd4a('0x9')]();})['then'](function(){return schedule[_0xdd4a('0x9')]();})[_0xdd4a('0x8')](function(_0x42fa33){logger[_0xdd4a('0xa')](_0x42fa33);return pm2[_0xdd4a('0x9')](pm2Config);})[_0xdd4a('0x8')](function(_0x4de3d5){logger['info'](_0xdd4a('0xb'),_['map'](_[_0xdd4a('0xc')](_0x4de3d5,{'status':_0xdd4a('0xd')}),'name')[_0xdd4a('0xe')]());logger[_0xdd4a('0xa')]('Offline\x20apps:',_[_0xdd4a('0xf')](_['filter'](_0x4de3d5,function(_0x2a24de){return _0x2a24de['status']!==_0xdd4a('0xd');}),'name')['join']()||_0xdd4a('0x10'));config['seedDB']&&require('./config/seedDB')['default']();require(_0xdd4a('0x11'))[_0xdd4a('0x12')]();})[_0xdd4a('0x13')](function(_0x2bdd14){logger[_0xdd4a('0x14')](_0xdd4a('0x15'),_0x2bdd14);process[_0xdd4a('0x16')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 4809088..f2f04a8 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 _0x34ab=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.user','stringify','pick','redirect','/dashboards/general','retrieveApiKey','isNil','generateApiKey','randomBytes','toString','hex','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','basic-auth','crypto','secrets','session','role','fullname','name','internal','userpic','permissions','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','phoneBarRemoteControlPort','phoneBarRemoteControl','interface','userProfileId','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','find','authenticate','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','apikey','verify','query','getUuid','User','sub','isEqual','apiKeyNonce','nonce','log','Unrecognized\x20API\x20access\x20key','User\x20object\x20not\x20found.','../../config/license/util','getLicense','update','Forbidden','canUpdate','signToken','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','indexOf','setTokenCookie'];(function(_0x4f4aae,_0x128fff){var _0x907cdc=function(_0x159161){while(--_0x159161){_0x4f4aae['push'](_0x4f4aae['shift']());}};_0x907cdc(++_0x128fff);}(_0x34ab,0x120));var _0xb34a=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x34ab[_0x8a969d];return _0x1d8dc7;};'use strict';var db=require(_0xb34a('0x0'))['db'];var config=require(_0xb34a('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require(_0xb34a('0x2'));var jwt=require(_0xb34a('0x3'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0xb34a('0x4'));var crypto=require(_0xb34a('0x5'));var ipaddr=require('ipaddr.js');var validateJwt=expressJwt({'secret':config[_0xb34a('0x6')][_0xb34a('0x7')]});var userAttributes=['id',_0xb34a('0x8'),_0xb34a('0x9'),_0xb34a('0xa'),_0xb34a('0xb'),'email',_0xb34a('0xc'),_0xb34a('0xd'),_0xb34a('0xe'),_0xb34a('0xf'),_0xb34a('0x10'),'faxPause',_0xb34a('0x11'),_0xb34a('0x12'),_0xb34a('0x13'),_0xb34a('0x14'),_0xb34a('0x15'),_0xb34a('0x16'),_0xb34a('0x17'),_0xb34a('0x18')];exports[_0xb34a('0x19')]=function(){return isAuthenticated(!![])[_0xb34a('0x1a')](function(_0x4eef7a,_0x1c9f00,_0x4aafaf){if(_0x4eef7a[_0xb34a('0x1b')]){_0x4aafaf();}else{return db[_0xb34a('0x1c')][_0xb34a('0x1d')]({'where':{'id':_0x4eef7a[_0xb34a('0x1e')]['id']},'attributes':['id',_0xb34a('0x1f'),_0xb34a('0x20')],'raw':!![]})[_0xb34a('0x21')](function(_0x3b0fdb){if(_0x3b0fdb&&_0x3b0fdb[_0xb34a('0x1f')]){return _0x1c9f00[_0xb34a('0x22')](_0x3b0fdb[_0xb34a('0x20')]===_0xb34a('0x23')?0x195:0x193)[_0xb34a('0x24')]({'message':_0x3b0fdb[_0xb34a('0x20')]===_0xb34a('0x23')?_0xb34a('0x25'):_0xb34a('0x26')});}else{_0x4aafaf();}})[_0xb34a('0x27')](function(_0x2e471b){_0x4aafaf(_0x2e471b);});}});};function isAuthenticated(_0x2835ec){return compose()['use'](function(_0x2f70f8,_0x164619,_0x44f239){if(_0x2f70f8['headers'][_0xb34a('0x28')]){if(_[_0xb34a('0x29')](_0x2f70f8[_0xb34a('0x2a')][_0xb34a('0x28')],_0xb34a('0x2b'))){var _0x5dc5ca=basicAuth(_0x2f70f8);db['User'][_0xb34a('0x2c')]({'where':{'name':_0x5dc5ca[_0xb34a('0xa')]}})['then'](function(_0xe5685){if(!_0xe5685||!_0xe5685[_0xb34a('0x2d')](_0x5dc5ca[_0xb34a('0x2e')])){return _0x164619[_0xb34a('0x22')](0x191)[_0xb34a('0x24')]({'message':_0xb34a('0x2f')});}_0x2f70f8[_0xb34a('0x1b')]={'id':_0xe5685['id']};_0x44f239();})[_0xb34a('0x27')](function(_0x4db9ef){_0x44f239(_0x4db9ef);});}else if(_['startsWith'](_0x2f70f8[_0xb34a('0x2a')][_0xb34a('0x28')],'Bearer')){validateJwt(_0x2f70f8,_0x164619,_0x44f239);}else{if(_0x2835ec){_0x44f239();}else{return _0x164619[_0xb34a('0x22')](0x193)[_0xb34a('0x24')]({'message':_0xb34a('0x30')});}}}else if(_0x2f70f8['query'][_0xb34a('0x31')]){try{var _0xd160c1=jwt[_0xb34a('0x32')](_0x2f70f8[_0xb34a('0x33')]['apikey'],config['secrets']['session'],{'audience':hardwareConf[_0xb34a('0x34')](),'issuer':hardwareConf['getUuid']()});db[_0xb34a('0x35')]['find']({'where':{'id':_0xd160c1[_0xb34a('0x36')]}})[_0xb34a('0x21')](function(_0x5e23f9){if(!_0x5e23f9||!_[_0xb34a('0x37')](_0x5e23f9[_0xb34a('0x38')],_0xd160c1[_0xb34a('0x39')])){return _0x164619[_0xb34a('0x22')](0x193)[_0xb34a('0x24')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x2f70f8[_0xb34a('0x1b')]={'id':_0x5e23f9['id']};_0x44f239();})[_0xb34a('0x27')](function(_0x5d3cb8){_0x44f239(_0x5d3cb8);});}catch(_0x5ef9ec){console[_0xb34a('0x3a')](_0x5ef9ec);return _0x164619['status'](0x193)[_0xb34a('0x24')]({'message':_0xb34a('0x3b')});}}else if(_0x2835ec){_0x44f239();}else{return _0x164619[_0xb34a('0x22')](0x193)['json']({'message':_0xb34a('0x30')});}})[_0xb34a('0x1a')](function(_0x41d102,_0x493892,_0x49d8e6){if(_0x41d102[_0xb34a('0x1b')]){db[_0xb34a('0x35')][_0xb34a('0x2c')]({'where':{'id':_0x41d102[_0xb34a('0x1b')]['id']},'attributes':userAttributes})[_0xb34a('0x21')](function(_0x2b2629){if(!_0x2b2629){return _0x493892[_0xb34a('0x22')](0x194)[_0xb34a('0x24')]({'message':'User\x20not\x20found.'});}_0x41d102[_0xb34a('0x1b')]=_0x2b2629;_0x49d8e6();})['catch'](function(_0xff4c35){_0x49d8e6(_0xff4c35);});}else if(_0x2835ec){_0x49d8e6();}else{return _0x493892[_0xb34a('0x22')](0x194)[_0xb34a('0x24')]({'message':_0xb34a('0x3c')});}});}exports['isAuthenticated']=isAuthenticated;function canUpdate(){return compose()[_0xb34a('0x1a')](function(_0x9fd81e,_0x4439c4,_0x44a98b){return require(_0xb34a('0x3d'))[_0xb34a('0x3e')]()[_0xb34a('0x21')](function(_0xe6e6c3){if(_0xe6e6c3[_0xb34a('0x3f')]){_0x44a98b();}else{return _0x4439c4[_0xb34a('0x22')](0x193)[_0xb34a('0x24')]({'message':_0xb34a('0x40')});}})[_0xb34a('0x27')](function(_0xff4d1){_0x44a98b(_0xff4d1);});});}exports[_0xb34a('0x41')]=canUpdate;function signToken(_0x496a7,_0xc76f29){return jwt['sign']({'id':_0x496a7,'role':_0xc76f29},config[_0xb34a('0x6')]['session'],{'expiresIn':0x15180});}exports[_0xb34a('0x42')]=signToken;exports[_0xb34a('0x43')]=function(_0x58483e){if(!_0x58483e){throw new Error(_0xb34a('0x44'));}return compose()[_0xb34a('0x1a')](isAuthenticated())[_0xb34a('0x1a')](function meetsRequirements(_0x2c5396,_0x50a2cd,_0xf6a4ea){if(config[_0xb34a('0x45')][_0xb34a('0x46')](_0x2c5396[_0xb34a('0x1b')][_0xb34a('0x8')])>=config['userRoles']['indexOf'](_0x58483e)){return _0xf6a4ea();}else{return _0x50a2cd[_0xb34a('0x22')](0x193)[_0xb34a('0x24')]({'message':_0xb34a('0x40')});}});};exports[_0xb34a('0x47')]=function(_0x193c5a,_0x274ec1){if(!_0x193c5a['user']){return _0x274ec1[_0xb34a('0x22')](0x194)['json']({'message':_0xb34a('0x48')});}var _0x1b5b88=signToken(_0x193c5a[_0xb34a('0x1b')]['id'],_0x193c5a[_0xb34a('0x1b')][_0xb34a('0x8')]);_0x274ec1['cookie']('motion.token',_0x1b5b88);_0x274ec1[_0xb34a('0x49')](_0xb34a('0x4a'),JSON[_0xb34a('0x4b')](_[_0xb34a('0x4c')](_0x193c5a[_0xb34a('0x1b')],userAttributes)));_0x274ec1[_0xb34a('0x4d')](_0xb34a('0x4e'));};exports[_0xb34a('0x4f')]=function(_0x20e52c){if(_['isNil'](_0x20e52c[_0xb34a('0x38')])||_[_0xb34a('0x50')](_0x20e52c['apiKeyIat']))return null;else return createJwt(_0x20e52c);};exports[_0xb34a('0x51')]=function(_0x35931b){_0x35931b['apiKeyNonce']=crypto[_0xb34a('0x52')](0x10)[_0xb34a('0x53')](_0xb34a('0x54'));_0x35931b[_0xb34a('0x55')]=Math['floor'](Date['now']()/0x3e8)[_0xb34a('0x53')]();return createJwt(_0x35931b);};exports[_0xb34a('0x56')]=function(_0xd21ec1,_0x1f0e50){if(_0xd21ec1[_0xb34a('0x33')][_0xb34a('0x31')]){jwt[_0xb34a('0x32')](_0xd21ec1['query'][_0xb34a('0x31')],config['secrets']['session'],{'nonce':_0x1f0e50[_0xb34a('0x38')],'iat':_0x1f0e50[_0xb34a('0x55')],'audience':hardwareConf[_0xb34a('0x34')](),'issuer':hardwareConf[_0xb34a('0x34')]()});return generateApiKey(_0x1f0e50);}else{throw{'message':_0xb34a('0x57')};}};function createJwt(_0x3f88c7){return jwt[_0xb34a('0x58')]({'iat':_0x3f88c7['apiKeyIat'],'nonce':_0x3f88c7[_0xb34a('0x38')]},config[_0xb34a('0x6')][_0xb34a('0x7')],{'algorithm':_0xb34a('0x59'),'subject':_0x3f88c7['id'][_0xb34a('0x53')](),'issuer':hardwareConf[_0xb34a('0x34')](),'audience':hardwareConf[_0xb34a('0x34')]()});} \ No newline at end of file +var _0xd8e3=['isAuthenticated','../../config/license/util','Forbidden','canUpdate','sign','signToken','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','indexOf','setTokenCookie','cookie','motion.token','motion.user','stringify','/dashboards/general','retrieveApiKey','isNil','generateApiKey','apiKeyIat','now','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','HS512','toString','../../mysqldb','../../config/environment','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','ipaddr.js','secrets','session','role','fullname','email','userpic','permissions','chatPause','openchannelPause','phoneBarRemoteControlPort','phoneBarRemoteControl','interface','userProfileId','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','then','closed','status','unmanaged','disposition','Unmanaged.','startsWith','headers','authorization','Basic','find','name','pass','Wrong\x20credentials.','user','catch','Bearer','json','query','verify','apikey','getUuid','User','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','log','Unrecognized\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xd8e3,0x164));var _0x3d8e=function(_0x579029,_0x50f822){_0x579029=_0x579029-0x0;var _0x4c2395=_0xd8e3[_0x579029];return _0x4c2395;};'use strict';var db=require(_0x3d8e('0x0'))['db'];var config=require(_0x3d8e('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require('lodash');var jwt=require(_0x3d8e('0x2'));var expressJwt=require(_0x3d8e('0x3'));var compose=require(_0x3d8e('0x4'));var basicAuth=require(_0x3d8e('0x5'));var crypto=require(_0x3d8e('0x6'));var ipaddr=require(_0x3d8e('0x7'));var validateJwt=expressJwt({'secret':config[_0x3d8e('0x8')][_0x3d8e('0x9')]});var userAttributes=['id',_0x3d8e('0xa'),_0x3d8e('0xb'),'name','internal',_0x3d8e('0xc'),_0x3d8e('0xd'),_0x3d8e('0xe'),'voicePause',_0x3d8e('0xf'),'mailPause','faxPause','smsPause',_0x3d8e('0x10'),'pauseType','showWebBar',_0x3d8e('0x11'),_0x3d8e('0x12'),_0x3d8e('0x13'),_0x3d8e('0x14')];exports[_0x3d8e('0x15')]=function(){return isAuthenticated(!![])[_0x3d8e('0x16')](function(_0xab9cc5,_0x5882a6,_0xaad803){if(_0xab9cc5['user']){_0xaad803();}else{return db[_0x3d8e('0x17')][_0x3d8e('0x18')]({'where':{'id':_0xab9cc5[_0x3d8e('0x19')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x3d8e('0x1a')](function(_0x547dce){if(_0x547dce&&_0x547dce[_0x3d8e('0x1b')]){return _0x5882a6[_0x3d8e('0x1c')](_0x547dce['disposition']===_0x3d8e('0x1d')?0x195:0x193)['json']({'message':_0x547dce[_0x3d8e('0x1e')]===_0x3d8e('0x1d')?_0x3d8e('0x1f'):'Forbidden.'});}else{_0xaad803();}})['catch'](function(_0x2d6fb4){_0xaad803(_0x2d6fb4);});}});};function isAuthenticated(_0x1dcc76){return compose()[_0x3d8e('0x16')](function(_0x5e3956,_0x30aea7,_0x16d539){if(_0x5e3956['headers']['authorization']){if(_[_0x3d8e('0x20')](_0x5e3956[_0x3d8e('0x21')][_0x3d8e('0x22')],_0x3d8e('0x23'))){var _0x12e2de=basicAuth(_0x5e3956);db['User'][_0x3d8e('0x24')]({'where':{'name':_0x12e2de[_0x3d8e('0x25')]}})[_0x3d8e('0x1a')](function(_0x4ae513){if(!_0x4ae513||!_0x4ae513['authenticate'](_0x12e2de[_0x3d8e('0x26')])){return _0x30aea7[_0x3d8e('0x1c')](0x191)['json']({'message':_0x3d8e('0x27')});}_0x5e3956[_0x3d8e('0x28')]={'id':_0x4ae513['id']};_0x16d539();})[_0x3d8e('0x29')](function(_0x3bb489){_0x16d539(_0x3bb489);});}else if(_[_0x3d8e('0x20')](_0x5e3956['headers']['authorization'],_0x3d8e('0x2a'))){validateJwt(_0x5e3956,_0x30aea7,_0x16d539);}else{if(_0x1dcc76){_0x16d539();}else{return _0x30aea7[_0x3d8e('0x1c')](0x193)[_0x3d8e('0x2b')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5e3956[_0x3d8e('0x2c')]['apikey']){try{var _0x33422f=jwt[_0x3d8e('0x2d')](_0x5e3956[_0x3d8e('0x2c')][_0x3d8e('0x2e')],config['secrets'][_0x3d8e('0x9')],{'audience':hardwareConf[_0x3d8e('0x2f')](),'issuer':hardwareConf[_0x3d8e('0x2f')]()});db[_0x3d8e('0x30')][_0x3d8e('0x24')]({'where':{'id':_0x33422f[_0x3d8e('0x31')]}})['then'](function(_0x118271){if(!_0x118271||!_[_0x3d8e('0x32')](_0x118271[_0x3d8e('0x33')],_0x33422f[_0x3d8e('0x34')])){return _0x30aea7[_0x3d8e('0x1c')](0x193)['json']({'message':_0x3d8e('0x35')});}_0x5e3956['user']={'id':_0x118271['id']};_0x16d539();})[_0x3d8e('0x29')](function(_0x214228){_0x16d539(_0x214228);});}catch(_0x3487e2){console[_0x3d8e('0x36')](_0x3487e2);return _0x30aea7[_0x3d8e('0x1c')](0x193)[_0x3d8e('0x2b')]({'message':_0x3d8e('0x37')});}}else if(_0x1dcc76){_0x16d539();}else{return _0x30aea7[_0x3d8e('0x1c')](0x193)[_0x3d8e('0x2b')]({'message':_0x3d8e('0x38')});}})[_0x3d8e('0x16')](function(_0x57628e,_0x4ef7bb,_0x3a7a74){if(_0x57628e['user']){db[_0x3d8e('0x30')][_0x3d8e('0x24')]({'where':{'id':_0x57628e['user']['id']},'attributes':userAttributes})[_0x3d8e('0x1a')](function(_0xcfd5d9){if(!_0xcfd5d9){return _0x4ef7bb[_0x3d8e('0x1c')](0x194)[_0x3d8e('0x2b')]({'message':_0x3d8e('0x39')});}_0x57628e['user']=_0xcfd5d9;_0x3a7a74();})[_0x3d8e('0x29')](function(_0x15ab5a){_0x3a7a74(_0x15ab5a);});}else if(_0x1dcc76){_0x3a7a74();}else{return _0x4ef7bb['status'](0x194)[_0x3d8e('0x2b')]({'message':_0x3d8e('0x3a')});}});}exports[_0x3d8e('0x3b')]=isAuthenticated;function canUpdate(){return compose()['use'](function(_0x1ed570,_0x1c73dd,_0xa285a4){return require(_0x3d8e('0x3c'))['getLicense']()[_0x3d8e('0x1a')](function(_0x3c59cd){if(_0x3c59cd['update']){_0xa285a4();}else{return _0x1c73dd[_0x3d8e('0x1c')](0x193)[_0x3d8e('0x2b')]({'message':_0x3d8e('0x3d')});}})[_0x3d8e('0x29')](function(_0x3e1fea){_0xa285a4(_0x3e1fea);});});}exports[_0x3d8e('0x3e')]=canUpdate;function signToken(_0x577667,_0x129f68){return jwt[_0x3d8e('0x3f')]({'id':_0x577667,'role':_0x129f68},config[_0x3d8e('0x8')][_0x3d8e('0x9')],{'expiresIn':0x15180});}exports[_0x3d8e('0x40')]=signToken;exports['hasRole']=function(_0x27426d){if(!_0x27426d){throw new Error(_0x3d8e('0x41'));}return compose()[_0x3d8e('0x16')](isAuthenticated())[_0x3d8e('0x16')](function meetsRequirements(_0x523eee,_0x3e9a44,_0x5a2fcf){if(config[_0x3d8e('0x42')][_0x3d8e('0x43')](_0x523eee['user'][_0x3d8e('0xa')])>=config['userRoles']['indexOf'](_0x27426d)){return _0x5a2fcf();}else{return _0x3e9a44['status'](0x193)[_0x3d8e('0x2b')]({'message':_0x3d8e('0x3d')});}});};exports[_0x3d8e('0x44')]=function(_0x43d3f5,_0x13f4ea){if(!_0x43d3f5[_0x3d8e('0x28')]){return _0x13f4ea['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x161446=signToken(_0x43d3f5['user']['id'],_0x43d3f5[_0x3d8e('0x28')][_0x3d8e('0xa')]);_0x13f4ea[_0x3d8e('0x45')](_0x3d8e('0x46'),_0x161446);_0x13f4ea[_0x3d8e('0x45')](_0x3d8e('0x47'),JSON[_0x3d8e('0x48')](_['pick'](_0x43d3f5[_0x3d8e('0x28')],userAttributes)));_0x13f4ea['redirect'](_0x3d8e('0x49'));};exports[_0x3d8e('0x4a')]=function(_0x2e1737){if(_[_0x3d8e('0x4b')](_0x2e1737[_0x3d8e('0x33')])||_[_0x3d8e('0x4b')](_0x2e1737['apiKeyIat']))return null;else return createJwt(_0x2e1737);};exports[_0x3d8e('0x4c')]=function(_0x2550c3){_0x2550c3['apiKeyNonce']=crypto['randomBytes'](0x10)['toString']('hex');_0x2550c3[_0x3d8e('0x4d')]=Math['floor'](Date[_0x3d8e('0x4e')]()/0x3e8)['toString']();return createJwt(_0x2550c3);};exports[_0x3d8e('0x4f')]=function(_0xdd3802,_0x5f1f15){if(_0xdd3802['query'][_0x3d8e('0x2e')]){jwt[_0x3d8e('0x2d')](_0xdd3802[_0x3d8e('0x2c')]['apikey'],config['secrets'][_0x3d8e('0x9')],{'nonce':_0x5f1f15[_0x3d8e('0x33')],'iat':_0x5f1f15['apiKeyIat'],'audience':hardwareConf[_0x3d8e('0x2f')](),'issuer':hardwareConf['getUuid']()});return generateApiKey(_0x5f1f15);}else{throw{'message':_0x3d8e('0x50')};}};function createJwt(_0x43a4c4){return jwt['sign']({'iat':_0x43a4c4[_0x3d8e('0x4d')],'nonce':_0x43a4c4['apiKeyNonce']},config[_0x3d8e('0x8')][_0x3d8e('0x9')],{'algorithm':_0x3d8e('0x51'),'subject':_0x43a4c4['id'][_0x3d8e('0x52')](),'issuer':hardwareConf[_0x3d8e('0x2f')](),'audience':hardwareConf[_0x3d8e('0x2f')]()});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e49145e..7bcf9e6 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 _0x67e8=['algorithm','data','write','end','final','binary','close','decryptFile','createWriteStream','createDecipher','update','unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x67e8,0x6b));var _0x867e=function(_0x7de919,_0x51f1a6){_0x7de919=_0x7de919-0x0;var _0x318034=_0x67e8[_0x7de919];return _0x318034;};'use strict';var crypto=require(_0x867e('0x0'));var fs=require('fs');var BPromise=require(_0x867e('0x1'));var defaultOptions={'algorithm':_0x867e('0x2')};function combineOptions(_0x227cd4){var _0x1ea386={};for(var _0x2aa9f0 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x2aa9f0)){_0x1ea386[_0x2aa9f0]=defaultOptions[_0x2aa9f0];}}if(_0x227cd4){for(var _0x329c8e in _0x227cd4){if(_0x227cd4[_0x867e('0x3')](_0x329c8e)){_0x1ea386[_0x329c8e]=_0x227cd4[_0x329c8e];}}}return _0x1ea386;}exports[_0x867e('0x4')]=function(_0x44eb59,_0x5161b0,_0x16475c,_0x339b6e){return new BPromise(function(_0x2b8b54,_0xef48d8){_0x339b6e=combineOptions(_0x339b6e);var _0x480210=new Buffer(_0x16475c);var _0x4ac02a=fs[_0x867e('0x5')](_0x44eb59);var _0x2c2d23=fs['createWriteStream'](_0x5161b0);var _0x264326=crypto[_0x867e('0x6')](_0x339b6e[_0x867e('0x7')],_0x480210);_0x4ac02a['on'](_0x867e('0x8'),function(_0x28a037){var _0x19f2fc=new Buffer(_0x264326['update'](_0x28a037),'binary');_0x2c2d23[_0x867e('0x9')](_0x19f2fc);});_0x4ac02a['on'](_0x867e('0xa'),function(){try{var _0x199256=new Buffer(_0x264326[_0x867e('0xb')]('binary'),_0x867e('0xc'));_0x2c2d23[_0x867e('0x9')](_0x199256);_0x2c2d23[_0x867e('0xa')]();_0x2c2d23['on'](_0x867e('0xd'),function(){return _0x2b8b54(_0x5161b0);});}catch(_0x483921){fs['unlink'](_0x5161b0);return _0xef48d8(_0x483921);}});});};exports[_0x867e('0xe')]=function(_0x2ee3d9,_0x4ce830,_0x2770d2,_0x511afe){return new BPromise(function(_0x457d6c,_0x316603){_0x511afe=combineOptions(_0x511afe);var _0x4c4e2f=new Buffer(_0x2770d2);var _0x9af907=fs[_0x867e('0x5')](_0x2ee3d9);var _0x1ca7d2=fs[_0x867e('0xf')](_0x4ce830);var _0x145eb1=crypto[_0x867e('0x10')](_0x511afe[_0x867e('0x7')],_0x4c4e2f);_0x9af907['on'](_0x867e('0x8'),function(_0x241922){var _0x11c63e=new Buffer(_0x145eb1[_0x867e('0x11')](_0x241922),_0x867e('0xc'));_0x1ca7d2[_0x867e('0x9')](_0x11c63e);});_0x9af907['on'](_0x867e('0xa'),function(){try{var _0x50e614=new Buffer(_0x145eb1[_0x867e('0xb')](_0x867e('0xc')),_0x867e('0xc'));_0x1ca7d2['write'](_0x50e614);_0x1ca7d2[_0x867e('0xa')]();_0x1ca7d2['on'](_0x867e('0xd'),function(){return _0x457d6c(_0x4ce830);});}catch(_0x498aaa){fs[_0x867e('0x12')](_0x4ce830);return _0x316603(_0x498aaa);}});});}; \ No newline at end of file +var _0x1443=['crypto','bluebird','aes192','createReadStream','createWriteStream','algorithm','data','update','binary','write','end','final','close','unlink','decryptFile'];(function(_0x196b4d,_0x1f408f){var _0x59bb06=function(_0x362467){while(--_0x362467){_0x196b4d['push'](_0x196b4d['shift']());}};_0x59bb06(++_0x1f408f);}(_0x1443,0x10e));var _0x3144=function(_0x3cbdd7,_0x50036a){_0x3cbdd7=_0x3cbdd7-0x0;var _0x50f8d8=_0x1443[_0x3cbdd7];return _0x50f8d8;};'use strict';var crypto=require(_0x3144('0x0'));var fs=require('fs');var BPromise=require(_0x3144('0x1'));var defaultOptions={'algorithm':_0x3144('0x2')};function combineOptions(_0x117193){var _0x252407={};for(var _0x3176 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x3176)){_0x252407[_0x3176]=defaultOptions[_0x3176];}}if(_0x117193){for(var _0x3c795d in _0x117193){if(_0x117193['hasOwnProperty'](_0x3c795d)){_0x252407[_0x3c795d]=_0x117193[_0x3c795d];}}}return _0x252407;}exports['encryptFile']=function(_0x3575c7,_0x14f915,_0x48d8da,_0x2d5184){return new BPromise(function(_0xc69b17,_0x51bde8){_0x2d5184=combineOptions(_0x2d5184);var _0x3c576c=new Buffer(_0x48d8da);var _0x2192bd=fs[_0x3144('0x3')](_0x3575c7);var _0x57b52f=fs[_0x3144('0x4')](_0x14f915);var _0xb0f45b=crypto['createCipher'](_0x2d5184[_0x3144('0x5')],_0x3c576c);_0x2192bd['on'](_0x3144('0x6'),function(_0x423af8){var _0x48a39e=new Buffer(_0xb0f45b[_0x3144('0x7')](_0x423af8),_0x3144('0x8'));_0x57b52f[_0x3144('0x9')](_0x48a39e);});_0x2192bd['on'](_0x3144('0xa'),function(){try{var _0x306500=new Buffer(_0xb0f45b[_0x3144('0xb')](_0x3144('0x8')),_0x3144('0x8'));_0x57b52f[_0x3144('0x9')](_0x306500);_0x57b52f[_0x3144('0xa')]();_0x57b52f['on'](_0x3144('0xc'),function(){return _0xc69b17(_0x14f915);});}catch(_0xba0df0){fs[_0x3144('0xd')](_0x14f915);return _0x51bde8(_0xba0df0);}});});};exports[_0x3144('0xe')]=function(_0x35bd78,_0x280a27,_0x1c6ea5,_0xa2c3db){return new BPromise(function(_0x363731,_0x5e1f90){_0xa2c3db=combineOptions(_0xa2c3db);var _0x486569=new Buffer(_0x1c6ea5);var _0x21f81f=fs[_0x3144('0x3')](_0x35bd78);var _0x74b59e=fs['createWriteStream'](_0x280a27);var _0x54e890=crypto['createDecipher'](_0xa2c3db[_0x3144('0x5')],_0x486569);_0x21f81f['on'](_0x3144('0x6'),function(_0x30f140){var _0x16b97d=new Buffer(_0x54e890[_0x3144('0x7')](_0x30f140),_0x3144('0x8'));_0x74b59e[_0x3144('0x9')](_0x16b97d);});_0x21f81f['on']('end',function(){try{var _0x2593ec=new Buffer(_0x54e890['final']('binary'),_0x3144('0x8'));_0x74b59e[_0x3144('0x9')](_0x2593ec);_0x74b59e[_0x3144('0xa')]();_0x74b59e['on'](_0x3144('0xc'),function(){return _0x363731(_0x280a27);});}catch(_0x3521a3){fs[_0x3144('0xd')](_0x280a27);return _0x5e1f90(_0x3521a3);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 6a94442..e2176b3 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 _0xf5fb=['util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x384320,_0x3e4418){var _0x175dec=function(_0x4ac5d0){while(--_0x4ac5d0){_0x384320['push'](_0x384320['shift']());}};_0x175dec(++_0x3e4418);}(_0xf5fb,0x1ef));var _0xbf5f=function(_0x42ead6,_0x24a33f){_0x42ead6=_0x42ead6-0x0;var _0x598d0c=_0xf5fb[_0x42ead6];return _0x598d0c;};'use strict';var util=require(_0xbf5f('0x0'));var path=require('path');var _=require(_0xbf5f('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xbf5f('0x2'));var zipdir=require(_0xbf5f('0x3'));var rimraf=require(_0xbf5f('0x4'));var db=require(_0xbf5f('0x5'))['db'];var dbH=require('../../mysqldb')[_0xbf5f('0x6')];var logger=require(_0xbf5f('0x7'))(_0xbf5f('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xbf5f('0x9')][0x2]);var QUERY=process[_0xbf5f('0x9')][0x3];var PATH=process[_0xbf5f('0x9')][0x4];function analyticExtractedReport(_0x35d782,_0x2ba849){var _0x407418={'status':_0x35d782};var _0xc77a02={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ba849){_0x407418[_0xbf5f('0xa')]=_0x2ba849;}return db[_0xbf5f('0xb')][_0xbf5f('0xc')](_0x407418,_0xc77a02);}function main(){var _0x49501a=0x1388;var _0x461469;logger[_0xbf5f('0xd')](util[_0xbf5f('0xe')](_0xbf5f('0xf'),EXTRACTED_REPORT_ID,_0xbf5f('0x10')));return db[_0xbf5f('0x11')][_0xbf5f('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbf5f('0x13'),_0xbf5f('0x14')]})[_0xbf5f('0x15')](function(_0x20687c){if(_0x20687c){_0x461469=_0x20687c;_0x49501a=_0x461469[_0xbf5f('0x14')]||0x1388;}})[_0xbf5f('0x15')](function(){return dbH[_0xbf5f('0x16')][_0xbf5f('0x17')](util[_0xbf5f('0xe')](_0xbf5f('0x18'),QUERY),{'type':dbH['sequelize'][_0xbf5f('0x19')]['SELECT']});})[_0xbf5f('0x15')](function(_0x555bf1){if(!_0x555bf1[0x0]['num']){return analyticExtractedReport('Empty');}var _0x227a13=[];var _0x15496d=0x0;var _0x21f75f=!![];if(_0x555bf1&&_0x555bf1[_0xbf5f('0x1a')]){var _0x30626f=_0x555bf1[0x0][_0xbf5f('0x1b')]%(_0x15496d+_0x49501a);if(_0x461469[_0xbf5f('0x13')]){for(;_0x21f75f;_0x15496d+=_0x49501a,_0x30626f=_0x555bf1[0x0][_0xbf5f('0x1b')]%(_0x15496d+_0x49501a)){if(_0x30626f==0x0||_0x30626f==_0x555bf1[0x0][_0xbf5f('0x1b')]){_0x21f75f=![];}_0x227a13['push'](dbH[_0xbf5f('0x16')][_0xbf5f('0x17')](util[_0xbf5f('0xe')](_0xbf5f('0x1c'),QUERY,_0x49501a,_0x15496d),{'type':dbH[_0xbf5f('0x16')]['QueryTypes'][_0xbf5f('0x1d')]}));}}else{_0x227a13[_0xbf5f('0x1e')](dbH[_0xbf5f('0x16')][_0xbf5f('0x17')](QUERY,{'type':dbH[_0xbf5f('0x16')]['QueryTypes'][_0xbf5f('0x1d')]}));}}var _0x89b5f0=path[_0xbf5f('0x1f')](PATH);var _0x1106fd=path['basename'](PATH,'.csv');var _0x56a91f=_0x461469[_0xbf5f('0x13')]&&_0x227a13[_0xbf5f('0x1a')]>0x1;var _0x2192ae=[];if(!fs['existsSync'](path['join'](_0x89b5f0,_0x1106fd))&&_0x56a91f){fs[_0xbf5f('0x20')](path[_0xbf5f('0x21')](_0x89b5f0,_0x1106fd));}return BPromise[_0xbf5f('0x22')](_0x227a13,function(_0x2458d6){_0x2192ae['push'](_0x2458d6);})[_0xbf5f('0x15')](function(){for(var _0x15e796=0x0;_0x15e796<_0x2192ae[_0xbf5f('0x1a')];_0x15e796+=0x1){var _0x4cbb99;var _0x4dc222=_0x2192ae[_0x15e796];if(_0x56a91f){_0x4cbb99=path[_0xbf5f('0x21')](_0x89b5f0,_0x1106fd,util[_0xbf5f('0xe')](_0xbf5f('0x23'),_0x1106fd,_0x15e796,_0xbf5f('0x24')));}else{_0x4cbb99=path[_0xbf5f('0x21')](_0x89b5f0,util[_0xbf5f('0xe')](_0xbf5f('0x25'),_0x1106fd,_0xbf5f('0x24')));}fs[_0xbf5f('0x26')](_0x4cbb99,csv(_0x4dc222));}})[_0xbf5f('0x15')](function(){if(_0x56a91f){zipdir(path[_0xbf5f('0x21')](_0x89b5f0,_0x1106fd),{'saveTo':path[_0xbf5f('0x21')](_0x89b5f0,util[_0xbf5f('0xe')](_0xbf5f('0x25'),_0x1106fd,_0xbf5f('0x27')))},function(_0x615d1a,_0x29a175){});rimraf(path[_0xbf5f('0x21')](_0x89b5f0,_0x1106fd),function(){});}})[_0xbf5f('0x15')](function(){logger[_0xbf5f('0xd')](util[_0xbf5f('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xbf5f('0x10')));return analyticExtractedReport(_0xbf5f('0x28'),_0x56a91f?util[_0xbf5f('0xe')](_0xbf5f('0x25'),_0x1106fd,_0x56a91f?_0xbf5f('0x27'):_0xbf5f('0x24')):null);});})[_0xbf5f('0x29')](function(_0xb75b6e){logger[_0xbf5f('0xd')](util[_0xbf5f('0xe')](_0xbf5f('0x2a'),EXTRACTED_REPORT_ID,_0xbf5f('0x10')),util[_0xbf5f('0x2b')](_0xb75b6e,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbf5f('0x2c'));});}main(); \ No newline at end of file +var _0x1f14=['AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeCsv','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','%s.%s','csv','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','inspect','Failed','util','path','lodash','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename'];(function(_0x546f9f,_0xcce640){var _0x3513dd=function(_0x2e5c79){while(--_0x2e5c79){_0x546f9f['push'](_0x546f9f['shift']());}};_0x3513dd(++_0xcce640);}(_0x1f14,0x18a));var _0x41f1=function(_0x149e0f,_0x5b59bb){_0x149e0f=_0x149e0f-0x0;var _0x3b54d8=_0x1f14[_0x149e0f];return _0x3b54d8;};'use strict';var util=require(_0x41f1('0x0'));var path=require(_0x41f1('0x1'));var _=require(_0x41f1('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x41f1('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x41f1('0x4'));var db=require(_0x41f1('0x5'))['db'];var dbH=require(_0x41f1('0x5'))[_0x41f1('0x6')];var logger=require(_0x41f1('0x7'))(_0x41f1('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x41f1('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x18de64,_0x52d899){var _0x3e904e={'status':_0x18de64};var _0x2fab74={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x52d899){_0x3e904e[_0x41f1('0xa')]=_0x52d899;}return db[_0x41f1('0xb')][_0x41f1('0xc')](_0x3e904e,_0x2fab74);}function main(){var _0x5017ab=0x1388;var _0x504acc;logger[_0x41f1('0xd')](util['format'](_0x41f1('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x41f1('0xf')][_0x41f1('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x41f1('0x11'),'splitSizeCsv']})[_0x41f1('0x12')](function(_0x4bdbde){if(_0x4bdbde){_0x504acc=_0x4bdbde;_0x5017ab=_0x504acc[_0x41f1('0x13')]||0x1388;}})[_0x41f1('0x12')](function(){return dbH[_0x41f1('0x14')][_0x41f1('0x15')](util[_0x41f1('0x16')](_0x41f1('0x17'),QUERY),{'type':dbH[_0x41f1('0x14')][_0x41f1('0x18')][_0x41f1('0x19')]});})['then'](function(_0x438c90){if(!_0x438c90[0x0][_0x41f1('0x1a')]){return analyticExtractedReport(_0x41f1('0x1b'));}var _0x53d351=[];var _0x2ea778=0x0;var _0x5d845c=!![];if(_0x438c90&&_0x438c90[_0x41f1('0x1c')]){var _0x32efb8=_0x438c90[0x0]['num']%(_0x2ea778+_0x5017ab);if(_0x504acc[_0x41f1('0x11')]){for(;_0x5d845c;_0x2ea778+=_0x5017ab,_0x32efb8=_0x438c90[0x0]['num']%(_0x2ea778+_0x5017ab)){if(_0x32efb8==0x0||_0x32efb8==_0x438c90[0x0][_0x41f1('0x1a')]){_0x5d845c=![];}_0x53d351[_0x41f1('0x1d')](dbH['sequelize']['query'](util['format'](_0x41f1('0x1e'),QUERY,_0x5017ab,_0x2ea778),{'type':dbH[_0x41f1('0x14')][_0x41f1('0x18')][_0x41f1('0x19')]}));}}else{_0x53d351['push'](dbH[_0x41f1('0x14')][_0x41f1('0x15')](QUERY,{'type':dbH['sequelize'][_0x41f1('0x18')]['SELECT']}));}}var _0x252228=path[_0x41f1('0x1f')](PATH);var _0x4d7e5b=path[_0x41f1('0x20')](PATH,'.csv');var _0x24c35c=_0x504acc[_0x41f1('0x11')]&&_0x53d351[_0x41f1('0x1c')]>0x1;var _0x45fc28=[];if(!fs[_0x41f1('0x21')](path[_0x41f1('0x22')](_0x252228,_0x4d7e5b))&&_0x24c35c){fs[_0x41f1('0x23')](path[_0x41f1('0x22')](_0x252228,_0x4d7e5b));}return BPromise[_0x41f1('0x24')](_0x53d351,function(_0x359410){_0x45fc28[_0x41f1('0x1d')](_0x359410);})[_0x41f1('0x12')](function(){for(var _0x32e741=0x0;_0x32e741<_0x45fc28[_0x41f1('0x1c')];_0x32e741+=0x1){var _0x2e8f37;var _0x25ae81=_0x45fc28[_0x32e741];if(_0x24c35c){_0x2e8f37=path['join'](_0x252228,_0x4d7e5b,util[_0x41f1('0x16')]('%s%d.%s',_0x4d7e5b,_0x32e741,'csv'));}else{_0x2e8f37=path[_0x41f1('0x22')](_0x252228,util[_0x41f1('0x16')](_0x41f1('0x25'),_0x4d7e5b,_0x41f1('0x26')));}fs[_0x41f1('0x27')](_0x2e8f37,csv(_0x25ae81));}})['then'](function(){if(_0x24c35c){zipdir(path[_0x41f1('0x22')](_0x252228,_0x4d7e5b),{'saveTo':path['join'](_0x252228,util['format']('%s.%s',_0x4d7e5b,'zip'))},function(_0x2d811d,_0x199516){});rimraf(path['join'](_0x252228,_0x4d7e5b),function(){});}})[_0x41f1('0x12')](function(){logger[_0x41f1('0xd')](util[_0x41f1('0x16')](_0x41f1('0x28'),EXTRACTED_REPORT_ID,_0x41f1('0x29')));return analyticExtractedReport('Completed',_0x24c35c?util[_0x41f1('0x16')]('%s.%s',_0x4d7e5b,_0x24c35c?'zip':_0x41f1('0x26')):null);});})[_0x41f1('0x2a')](function(_0x466c8e){logger[_0x41f1('0xd')](util[_0x41f1('0x16')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x41f1('0x29')),util[_0x41f1('0x2b')](_0x466c8e,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x41f1('0x2c'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index a2d864d..eb02c62 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 _0xbe1a=['dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','num','sequelize','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','name','startDate','black','body','content','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','log','err','end','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','hasOwnProperty','push','Empty'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0xbe1a,0x6c));var _0xabe1=function(_0x425e6a,_0x169c75){_0x425e6a=_0x425e6a-0x0;var _0x17f5e9=_0xbe1a[_0x425e6a];return _0x17f5e9;};'use strict';var _=require(_0xabe1('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xabe1('0x1'));var path=require('path');var moment=require('moment');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xabe1('0x2'));var rimraf=require(_0xabe1('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0xabe1('0x4'))[_0xabe1('0x5')];var logger=require(_0xabe1('0x6'))(_0xabe1('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xabe1('0x8')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xabe1('0x8')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var _extractedReport;function analyticExtractedReport(_0x76d9c1,_0x351135){var _0x50ea86={'status':_0x76d9c1};var _0x162aca={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x351135){_0x50ea86['savename']=_0x351135;}return db[_0xabe1('0x9')][_0xabe1('0xa')](_0x50ea86,_0x162aca);}function getHeader(_0x2ceb1f){var _0x54b9ba=[];for(var _0x112bce in _0x2ceb1f){if(_0x2ceb1f[_0xabe1('0xb')](_0x112bce)){_0x54b9ba[_0xabe1('0xc')]({'text':_0x112bce,'style':'tableHeader'});}}return _0x54b9ba;}function extractReport(_0x31af75){var _0x2c8f6b=0x1388;var _0x54d54a;if(!_0x31af75[0x0]['num']){return analyticExtractedReport(_0xabe1('0xd'));}var _0x3b8f6d=[];var _0x3e2e9c=0x0;var _0x43c1f6=!![];var _0x4a9e78=path[_0xabe1('0xe')](PATH);var _0x3e0bde=path[_0xabe1('0xf')](PATH,_0xabe1('0x10'));var _0x54e9fe=![];var _0x5041bf=[];return db[_0xabe1('0x11')][_0xabe1('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xabe1('0x13'),_0xabe1('0x14')]})[_0xabe1('0x15')](function(_0x4a0723){if(_0x4a0723){_0x54d54a=_0x4a0723;_0x2c8f6b=_0x54d54a[_0xabe1('0x14')]||0x3e8;}})[_0xabe1('0x15')](function(){if(_0x31af75&&_0x31af75[_0xabe1('0x16')]){var _0x38105a=_0x31af75[0x0][_0xabe1('0x17')]%(_0x3e2e9c+_0x2c8f6b);if(_0x54d54a[_0xabe1('0x13')]){for(;_0x43c1f6;_0x3e2e9c+=_0x2c8f6b,_0x38105a=_0x31af75[0x0][_0xabe1('0x17')]%(_0x3e2e9c+_0x2c8f6b)){if(_0x38105a==0x0||_0x38105a==_0x31af75[0x0][_0xabe1('0x17')]){_0x43c1f6=![];}_0x3b8f6d['push'](dbH[_0xabe1('0x18')][_0xabe1('0x19')](util[_0xabe1('0x1a')](_0xabe1('0x1b'),QUERY,_0x2c8f6b,_0x3e2e9c),{'type':dbH[_0xabe1('0x18')][_0xabe1('0x1c')][_0xabe1('0x1d')]}));}}else{_0x3b8f6d[_0xabe1('0xc')](dbH[_0xabe1('0x18')][_0xabe1('0x19')](QUERY,{'type':dbH['sequelize'][_0xabe1('0x1c')]['SELECT']}));}}_0x54e9fe=_0x54d54a[_0xabe1('0x13')]&&_0x3b8f6d[_0xabe1('0x16')]>0x1;if(!fs[_0xabe1('0x1e')](path[_0xabe1('0x1f')](_0x4a9e78,_0x3e0bde))&&_0x54e9fe){fs[_0xabe1('0x20')](path['join'](_0x4a9e78,_0x3e0bde));}return BPromise[_0xabe1('0x21')](_0x3b8f6d,function(_0x33433b){_0x5041bf[_0xabe1('0xc')](_0x33433b);});})['then'](function(){return BPromise[_0xabe1('0x21')](_0x3b8f6d,function(_0x2643bd,_0x1ccf71){var _0x3150de;var _0x312386=util[_0xabe1('0x1a')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xabe1('0x22')],moment(_extractedReport[_0xabe1('0x23')])[_0xabe1('0x1a')](FORMAT),moment(_extractedReport['endDate'])[_0xabe1('0x1a')](FORMAT));var _0x360e27={'pageSize':'A4','pageOrientation':'landscape','content':[{'text':_0x312386,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xabe1('0x24')}}};var _0x2c45cb={'headerRows':0x1,'body':[]};_0x2c45cb[_0xabe1('0x25')]['push'](getHeader(_0x2643bd[0x0]));var _0x3a0ab2;for(var _0x13b351=0x0;_0x13b351<_0x2643bd[_0xabe1('0x16')];_0x13b351+=0x1){_0x3a0ab2=[];for(var _0x2a8434 in _0x2643bd[_0x13b351]){if(_0x2643bd[_0x13b351]['hasOwnProperty'](_0x2a8434)){_0x3a0ab2[_0xabe1('0xc')](_0x2643bd[_0x13b351][_0x2a8434]?_['toString'](_0x2643bd[_0x13b351][_0x2a8434]):'');}}_0x2c45cb[_0xabe1('0x25')][_0xabe1('0xc')](_0x3a0ab2);}_0x360e27[_0xabe1('0x26')][_0xabe1('0xc')]({'table':_0x2c45cb});return new BPromise(function(_0x540d76,_0x1b45cb){var _0x12c13b=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+'/fonts/Roboto-Medium.ttf','italics':__dirname+_0xabe1('0x27'),'bolditalics':__dirname+_0xabe1('0x28')}});var _0x3ff732=_0x12c13b[_0xabe1('0x29')](_0x360e27);if(_0x54e9fe){_0x3150de=path[_0xabe1('0x1f')](_0x4a9e78,_0x3e0bde,util[_0xabe1('0x1a')](_0xabe1('0x2a'),_0x3e0bde,_0x1ccf71,_0xabe1('0x2b')));}else{_0x3150de=path[_0xabe1('0x1f')](_0x4a9e78,util[_0xabe1('0x1a')]('%s.%s',_0x3e0bde,'pdf'));}var _0x46109a=_0x3ff732[_0xabe1('0x2c')](fs['createWriteStream'](_0x3150de));_0x46109a['on'](_0xabe1('0x2d'),function(){_0x540d76();});_0x46109a['on']('error',function(_0x3433e6){console[_0xabe1('0x2e')](_0xabe1('0x2f'),_0x3433e6);_0x1b45cb(_0x3433e6);});_0x3ff732[_0xabe1('0x30')]();});});})[_0xabe1('0x15')](function(){if(_0x54e9fe){return new BPromise(function(_0x9e687a,_0x5b1dff){zipdir(path[_0xabe1('0x1f')](_0x4a9e78,_0x3e0bde),{'saveTo':path[_0xabe1('0x1f')](_0x4a9e78,util[_0xabe1('0x1a')](_0xabe1('0x31'),_0x3e0bde,'zip'))},function(_0x44c589){if(_0x44c589){_0x5b1dff(_0x44c589);}else{_0x9e687a();}});});}})[_0xabe1('0x15')](function(){if(_0x54e9fe){rimraf(path[_0xabe1('0x1f')](_0x4a9e78,_0x3e0bde),function(){});}})[_0xabe1('0x15')](function(){logger['info'](util[_0xabe1('0x1a')](_0xabe1('0x32'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xabe1('0x33'),_0x54e9fe?util[_0xabe1('0x1a')](_0xabe1('0x31'),_0x3e0bde,_0x54e9fe?_0xabe1('0x34'):_0xabe1('0x2b')):null);});}function main(){logger['info'](util[_0xabe1('0x1a')](_0xabe1('0x35'),EXTRACTED_REPORT_ID,_0xabe1('0x36')));return db['AnalyticExtractedReport'][_0xabe1('0x37')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xabe1('0x15')](function(_0x41fbc8){_extractedReport=_0x41fbc8;return dbH[_0xabe1('0x18')][_0xabe1('0x19')](util[_0xabe1('0x1a')](_0xabe1('0x38'),QUERY),{'type':dbH[_0xabe1('0x18')]['QueryTypes']['SELECT']});})['then'](extractReport)[_0xabe1('0x39')](function(_0x348ebe){logger[_0xabe1('0x3a')](util[_0xabe1('0x1a')](_0xabe1('0x3b'),EXTRACTED_REPORT_ID,_0xabe1('0x36')),util['inspect'](_0x348ebe,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xabe1('0x3c'));});}main(); \ No newline at end of file +var _0x1717=['PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','util','moment','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','push','num','Empty','dirname','basename','.pdf','Setting','find','splitSizePdf','then','length','split','sequelize','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','startDate','endDate','landscape','header','body','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','createWriteStream','finish','error','end','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip'];(function(_0x59e7e0,_0x3ec148){var _0x26b058=function(_0x212ee2){while(--_0x212ee2){_0x59e7e0['push'](_0x59e7e0['shift']());}};_0x26b058(++_0x3ec148);}(_0x1717,0xcf));var _0x7171=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x1717[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x7171('0x0'));var fs=require('fs');var BPromise=require(_0x7171('0x1'));var util=require(_0x7171('0x2'));var path=require('path');var moment=require(_0x7171('0x3'));var PdfPrinter=require(_0x7171('0x4'));var zipdir=require(_0x7171('0x5'));var rimraf=require(_0x7171('0x6'));var db=require(_0x7171('0x7'))['db'];var dbH=require(_0x7171('0x7'))[_0x7171('0x8')];var logger=require(_0x7171('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x7171('0xa')][0x2]);var QUERY=process[_0x7171('0xa')][0x3];var PATH=process[_0x7171('0xa')][0x4];var NAME=process[_0x7171('0xa')][0x5];var FORMAT=_0x7171('0xb');var _extractedReport;function analyticExtractedReport(_0x58c74e,_0x350723){var _0x1ab91c={'status':_0x58c74e};var _0x44e18a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x350723){_0x1ab91c[_0x7171('0xc')]=_0x350723;}return db[_0x7171('0xd')][_0x7171('0xe')](_0x1ab91c,_0x44e18a);}function getHeader(_0x461deb){var _0xbd10f6=[];for(var _0x3dcd75 in _0x461deb){if(_0x461deb[_0x7171('0xf')](_0x3dcd75)){_0xbd10f6[_0x7171('0x10')]({'text':_0x3dcd75,'style':'tableHeader'});}}return _0xbd10f6;}function extractReport(_0x215891){var _0x32765f=0x1388;var _0xda7d62;if(!_0x215891[0x0][_0x7171('0x11')]){return analyticExtractedReport(_0x7171('0x12'));}var _0x35052a=[];var _0x5067f5=0x0;var _0x24ad8b=!![];var _0x4f6b0f=path[_0x7171('0x13')](PATH);var _0x5466b7=path[_0x7171('0x14')](PATH,_0x7171('0x15'));var _0x522504=![];var _0x410274=[];return db[_0x7171('0x16')][_0x7171('0x17')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x7171('0x18')]})[_0x7171('0x19')](function(_0x2cd9a7){if(_0x2cd9a7){_0xda7d62=_0x2cd9a7;_0x32765f=_0xda7d62[_0x7171('0x18')]||0x3e8;}})[_0x7171('0x19')](function(){if(_0x215891&&_0x215891[_0x7171('0x1a')]){var _0x29ac5c=_0x215891[0x0][_0x7171('0x11')]%(_0x5067f5+_0x32765f);if(_0xda7d62[_0x7171('0x1b')]){for(;_0x24ad8b;_0x5067f5+=_0x32765f,_0x29ac5c=_0x215891[0x0]['num']%(_0x5067f5+_0x32765f)){if(_0x29ac5c==0x0||_0x29ac5c==_0x215891[0x0][_0x7171('0x11')]){_0x24ad8b=![];}_0x35052a[_0x7171('0x10')](dbH[_0x7171('0x1c')]['query'](util[_0x7171('0x1d')](_0x7171('0x1e'),QUERY,_0x32765f,_0x5067f5),{'type':dbH[_0x7171('0x1c')][_0x7171('0x1f')]['SELECT']}));}}else{_0x35052a[_0x7171('0x10')](dbH[_0x7171('0x1c')]['query'](QUERY,{'type':dbH[_0x7171('0x1c')][_0x7171('0x1f')][_0x7171('0x20')]}));}}_0x522504=_0xda7d62['split']&&_0x35052a[_0x7171('0x1a')]>0x1;if(!fs[_0x7171('0x21')](path[_0x7171('0x22')](_0x4f6b0f,_0x5466b7))&&_0x522504){fs[_0x7171('0x23')](path[_0x7171('0x22')](_0x4f6b0f,_0x5466b7));}return BPromise[_0x7171('0x24')](_0x35052a,function(_0x44a313){_0x410274['push'](_0x44a313);});})['then'](function(){return BPromise['each'](_0x35052a,function(_0x80ae84,_0x43e272){var _0x1e3244;var _0x23f4b3=util[_0x7171('0x1d')](_0x7171('0x25'),NAME,_extractedReport[_0x7171('0x26')],moment(_extractedReport[_0x7171('0x27')])[_0x7171('0x1d')](FORMAT),moment(_extractedReport[_0x7171('0x28')])['format'](FORMAT));var _0x5ad6a0={'pageSize':'A4','pageOrientation':_0x7171('0x29'),'content':[{'text':_0x23f4b3,'style':_0x7171('0x2a')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x47e53c={'headerRows':0x1,'body':[]};_0x47e53c[_0x7171('0x2b')]['push'](getHeader(_0x80ae84[0x0]));var _0x158afd;for(var _0x38fa11=0x0;_0x38fa11<_0x80ae84[_0x7171('0x1a')];_0x38fa11+=0x1){_0x158afd=[];for(var _0x136a67 in _0x80ae84[_0x38fa11]){if(_0x80ae84[_0x38fa11][_0x7171('0xf')](_0x136a67)){_0x158afd[_0x7171('0x10')](_0x80ae84[_0x38fa11][_0x136a67]?_['toString'](_0x80ae84[_0x38fa11][_0x136a67]):'');}}_0x47e53c[_0x7171('0x2b')][_0x7171('0x10')](_0x158afd);}_0x5ad6a0[_0x7171('0x2c')][_0x7171('0x10')]({'table':_0x47e53c});return new BPromise(function(_0x14d651,_0x39f823){var _0x23c723=new PdfPrinter({'Roboto':{'normal':__dirname+_0x7171('0x2d'),'bold':__dirname+_0x7171('0x2e'),'italics':__dirname+_0x7171('0x2f'),'bolditalics':__dirname+_0x7171('0x30')}});var _0x12c5d5=_0x23c723[_0x7171('0x31')](_0x5ad6a0);if(_0x522504){_0x1e3244=path[_0x7171('0x22')](_0x4f6b0f,_0x5466b7,util[_0x7171('0x1d')](_0x7171('0x32'),_0x5466b7,_0x43e272,_0x7171('0x33')));}else{_0x1e3244=path[_0x7171('0x22')](_0x4f6b0f,util[_0x7171('0x1d')]('%s.%s',_0x5466b7,_0x7171('0x33')));}var _0x25f17c=_0x12c5d5[_0x7171('0x34')](fs[_0x7171('0x35')](_0x1e3244));_0x25f17c['on'](_0x7171('0x36'),function(){_0x14d651();});_0x25f17c['on'](_0x7171('0x37'),function(_0x224813){console['log']('err',_0x224813);_0x39f823(_0x224813);});_0x12c5d5[_0x7171('0x38')]();});});})[_0x7171('0x19')](function(){if(_0x522504){return new BPromise(function(_0x20d95f,_0x5015b3){zipdir(path[_0x7171('0x22')](_0x4f6b0f,_0x5466b7),{'saveTo':path[_0x7171('0x22')](_0x4f6b0f,util[_0x7171('0x1d')](_0x7171('0x39'),_0x5466b7,'zip'))},function(_0x4dbef5){if(_0x4dbef5){_0x5015b3(_0x4dbef5);}else{_0x20d95f();}});});}})[_0x7171('0x19')](function(){if(_0x522504){rimraf(path[_0x7171('0x22')](_0x4f6b0f,_0x5466b7),function(){});}})[_0x7171('0x19')](function(){logger[_0x7171('0x3a')](util[_0x7171('0x1d')](_0x7171('0x3b'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x522504?util[_0x7171('0x1d')](_0x7171('0x39'),_0x5466b7,_0x522504?_0x7171('0x3c'):_0x7171('0x33')):null);});}function main(){logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7171('0x3d')));return db[_0x7171('0xd')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7171('0x19')](function(_0x193f76){_extractedReport=_0x193f76;return dbH[_0x7171('0x1c')]['query'](util['format'](_0x7171('0x3e'),QUERY),{'type':dbH[_0x7171('0x1c')][_0x7171('0x1f')][_0x7171('0x20')]});})[_0x7171('0x19')](extractReport)[_0x7171('0x3f')](function(_0x28bbee){logger[_0x7171('0x3a')](util[_0x7171('0x1d')](_0x7171('0x40'),EXTRACTED_REPORT_ID,_0x7171('0x3d')),util[_0x7171('0x41')](_0x28bbee,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x7171('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 2cd4e70..f1ce5cd 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 _0x2416=['%s%d.%s','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','xlsx','catch','inspect','Failed','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','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','mkdirSync','each'];(function(_0x38d5a3,_0x14e6ed){var _0x12d1dc=function(_0x39b30a){while(--_0x39b30a){_0x38d5a3['push'](_0x38d5a3['shift']());}};_0x12d1dc(++_0x14e6ed);}(_0x2416,0x94));var _0x6241=function(_0x4a83dc,_0x5a4863){_0x4a83dc=_0x4a83dc-0x0;var _0xd1d8dd=_0x2416[_0x4a83dc];return _0xd1d8dd;};'use strict';var util=require(_0x6241('0x0'));var path=require(_0x6241('0x1'));var _=require(_0x6241('0x2'));var fs=require('fs');var json2xls=require(_0x6241('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x6241('0x4'));var rimraf=require(_0x6241('0x5'));var db=require(_0x6241('0x6'))['db'];var dbH=require(_0x6241('0x6'))[_0x6241('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6241('0x8')][0x2]);var QUERY=process[_0x6241('0x8')][0x3];var PATH=process[_0x6241('0x8')][0x4];function analyticExtractedReport(_0xdf6997,_0x38f4ac){var _0x18e9b4={'status':_0xdf6997};var _0x5c0578={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x38f4ac){_0x18e9b4['savename']=_0x38f4ac;}return db[_0x6241('0x9')][_0x6241('0xa')](_0x18e9b4,_0x5c0578);}function main(){var _0x31975c=0x1388;var _0x1e4bf0;logger[_0x6241('0xb')](util[_0x6241('0xc')](_0x6241('0xd'),EXTRACTED_REPORT_ID,_0x6241('0xe')));return db['Setting'][_0x6241('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6241('0x10'),_0x6241('0x11')]})[_0x6241('0x12')](function(_0x4afbb7){if(_0x4afbb7){_0x1e4bf0=_0x4afbb7;_0x31975c=_0x1e4bf0[_0x6241('0x11')]||0x1388;}})[_0x6241('0x12')](function(){return dbH[_0x6241('0x13')][_0x6241('0x14')](util[_0x6241('0xc')](_0x6241('0x15'),QUERY),{'type':dbH[_0x6241('0x13')][_0x6241('0x16')][_0x6241('0x17')]});})[_0x6241('0x12')](function(_0x3ac9cc){if(!_0x3ac9cc[0x0][_0x6241('0x18')]){return analyticExtractedReport(_0x6241('0x19'));}var _0x3e6e37=[];var _0x577dff=0x0;var _0x141dad=!![];if(_0x1e4bf0[_0x6241('0x10')]){if(_0x3ac9cc&&_0x3ac9cc[_0x6241('0x1a')]){var _0x41ebac=_0x3ac9cc[0x0]['num']%(_0x577dff+_0x31975c);for(;_0x141dad;_0x577dff+=_0x31975c,_0x41ebac=_0x3ac9cc[0x0][_0x6241('0x18')]%(_0x577dff+_0x31975c)){if(_0x41ebac==0x0||_0x41ebac==_0x3ac9cc[0x0][_0x6241('0x18')]){_0x141dad=![];}_0x3e6e37['push'](dbH[_0x6241('0x13')]['query'](util[_0x6241('0xc')](_0x6241('0x1b'),QUERY,_0x31975c,_0x577dff),{'type':dbH['sequelize'][_0x6241('0x16')][_0x6241('0x17')]}));}}}else{_0x3e6e37[_0x6241('0x1c')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x6241('0x13')][_0x6241('0x16')]['SELECT']}));}var _0x26e5b2=path[_0x6241('0x1d')](PATH);var _0x36bfbd=path[_0x6241('0x1e')](PATH,_0x6241('0x1f'));var _0x1d9a6=_0x1e4bf0[_0x6241('0x10')]&&_0x3e6e37['length']>0x1;var _0x7ee2cb=[];if(!fs[_0x6241('0x20')](path[_0x6241('0x21')](_0x26e5b2,_0x36bfbd))&&_0x1d9a6){fs[_0x6241('0x22')](path['join'](_0x26e5b2,_0x36bfbd));}return BPromise[_0x6241('0x23')](_0x3e6e37,function(_0x18ac1a){_0x7ee2cb['push'](_0x18ac1a);})[_0x6241('0x12')](function(){for(var _0x28c2e3=0x0;_0x28c2e3<_0x7ee2cb[_0x6241('0x1a')];_0x28c2e3+=0x1){var _0x1115a5;var _0x4a17cd=_0x7ee2cb[_0x28c2e3];if(_0x1d9a6){_0x1115a5=path[_0x6241('0x21')](_0x26e5b2,_0x36bfbd,util[_0x6241('0xc')](_0x6241('0x24'),_0x36bfbd,_0x28c2e3,'xlsx'));}else{_0x1115a5=path[_0x6241('0x21')](_0x26e5b2,util['format']('%s.%s',_0x36bfbd,'xlsx'));}fs[_0x6241('0x25')](_0x1115a5,json2xls(_0x4a17cd),_0x6241('0x26'));}})[_0x6241('0x12')](function(){if(_0x1d9a6){zipdir(path['join'](_0x26e5b2,_0x36bfbd),{'saveTo':path[_0x6241('0x21')](_0x26e5b2,util['format'](_0x6241('0x27'),_0x36bfbd,_0x6241('0x28')))},function(_0x52cec7,_0x67b881){});rimraf(path[_0x6241('0x21')](_0x26e5b2,_0x36bfbd),function(){});}})[_0x6241('0x12')](function(){logger[_0x6241('0xb')](util[_0x6241('0xc')](_0x6241('0x29'),EXTRACTED_REPORT_ID,_0x6241('0xe')));return analyticExtractedReport('Completed',_0x1d9a6?util['format'](_0x6241('0x27'),_0x36bfbd,_0x1d9a6?_0x6241('0x28'):_0x6241('0x2a')):null);});})[_0x6241('0x2b')](function(_0x37b89d){logger[_0x6241('0xb')](util[_0x6241('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x6241('0x2c')](_0x37b89d,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6241('0x2d'));});}main(); \ No newline at end of file +var _0xc6fd=['splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','push','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','xlsx','%s.%s','binary','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split'];(function(_0x45a9d1,_0x55db72){var _0x1c2b05=function(_0x2c6b20){while(--_0x2c6b20){_0x45a9d1['push'](_0x45a9d1['shift']());}};_0x1c2b05(++_0x55db72);}(_0xc6fd,0x11d));var _0xdc6f=function(_0x317652,_0x323b13){_0x317652=_0x317652-0x0;var _0x26a1e2=_0xc6fd[_0x317652];return _0x26a1e2;};'use strict';var util=require(_0xdc6f('0x0'));var path=require(_0xdc6f('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xdc6f('0x2'));var BPromise=require(_0xdc6f('0x3'));var zipdir=require(_0xdc6f('0x4'));var rimraf=require('rimraf');var db=require(_0xdc6f('0x5'))['db'];var dbH=require(_0xdc6f('0x5'))[_0xdc6f('0x6')];var logger=require(_0xdc6f('0x7'))(_0xdc6f('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xdc6f('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xdc6f('0x9')][0x4];function analyticExtractedReport(_0x194353,_0x10092c){var _0xc4369c={'status':_0x194353};var _0x3a177d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x10092c){_0xc4369c[_0xdc6f('0xa')]=_0x10092c;}return db['AnalyticExtractedReport']['update'](_0xc4369c,_0x3a177d);}function main(){var _0x42c792=0x1388;var _0x2a8749;logger['info'](util[_0xdc6f('0xb')](_0xdc6f('0xc'),EXTRACTED_REPORT_ID,_0xdc6f('0xd')));return db[_0xdc6f('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdc6f('0xf'),_0xdc6f('0x10')]})[_0xdc6f('0x11')](function(_0x3e6cdd){if(_0x3e6cdd){_0x2a8749=_0x3e6cdd;_0x42c792=_0x2a8749[_0xdc6f('0x10')]||0x1388;}})[_0xdc6f('0x11')](function(){return dbH[_0xdc6f('0x12')][_0xdc6f('0x13')](util[_0xdc6f('0xb')](_0xdc6f('0x14'),QUERY),{'type':dbH[_0xdc6f('0x12')][_0xdc6f('0x15')][_0xdc6f('0x16')]});})['then'](function(_0x307033){if(!_0x307033[0x0][_0xdc6f('0x17')]){return analyticExtractedReport('Empty');}var _0x299f26=[];var _0x244eea=0x0;var _0x26872d=!![];if(_0x2a8749['split']){if(_0x307033&&_0x307033['length']){var _0x535dfa=_0x307033[0x0]['num']%(_0x244eea+_0x42c792);for(;_0x26872d;_0x244eea+=_0x42c792,_0x535dfa=_0x307033[0x0][_0xdc6f('0x17')]%(_0x244eea+_0x42c792)){if(_0x535dfa==0x0||_0x535dfa==_0x307033[0x0][_0xdc6f('0x17')]){_0x26872d=![];}_0x299f26[_0xdc6f('0x18')](dbH[_0xdc6f('0x12')][_0xdc6f('0x13')](util[_0xdc6f('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x42c792,_0x244eea),{'type':dbH[_0xdc6f('0x12')][_0xdc6f('0x15')]['SELECT']}));}}}else{_0x299f26[_0xdc6f('0x18')](dbH['sequelize'][_0xdc6f('0x13')](QUERY,{'type':dbH[_0xdc6f('0x12')]['QueryTypes'][_0xdc6f('0x16')]}));}var _0x5e88f0=path[_0xdc6f('0x19')](PATH);var _0x5bf860=path[_0xdc6f('0x1a')](PATH,_0xdc6f('0x1b'));var _0x3fbd4e=_0x2a8749['split']&&_0x299f26[_0xdc6f('0x1c')]>0x1;var _0x1c0539=[];if(!fs[_0xdc6f('0x1d')](path[_0xdc6f('0x1e')](_0x5e88f0,_0x5bf860))&&_0x3fbd4e){fs[_0xdc6f('0x1f')](path[_0xdc6f('0x1e')](_0x5e88f0,_0x5bf860));}return BPromise[_0xdc6f('0x20')](_0x299f26,function(_0x1e440f){_0x1c0539[_0xdc6f('0x18')](_0x1e440f);})[_0xdc6f('0x11')](function(){for(var _0x2e49bc=0x0;_0x2e49bc<_0x1c0539[_0xdc6f('0x1c')];_0x2e49bc+=0x1){var _0x18c7b3;var _0x4bc0e6=_0x1c0539[_0x2e49bc];if(_0x3fbd4e){_0x18c7b3=path['join'](_0x5e88f0,_0x5bf860,util[_0xdc6f('0xb')]('%s%d.%s',_0x5bf860,_0x2e49bc,_0xdc6f('0x21')));}else{_0x18c7b3=path[_0xdc6f('0x1e')](_0x5e88f0,util['format'](_0xdc6f('0x22'),_0x5bf860,_0xdc6f('0x21')));}fs['writeFileSync'](_0x18c7b3,json2xls(_0x4bc0e6),_0xdc6f('0x23'));}})[_0xdc6f('0x11')](function(){if(_0x3fbd4e){zipdir(path[_0xdc6f('0x1e')](_0x5e88f0,_0x5bf860),{'saveTo':path[_0xdc6f('0x1e')](_0x5e88f0,util['format'](_0xdc6f('0x22'),_0x5bf860,_0xdc6f('0x24')))},function(_0x307566,_0x219874){});rimraf(path[_0xdc6f('0x1e')](_0x5e88f0,_0x5bf860),function(){});}})['then'](function(){logger[_0xdc6f('0x25')](util[_0xdc6f('0xb')](_0xdc6f('0x26'),EXTRACTED_REPORT_ID,_0xdc6f('0xd')));return analyticExtractedReport(_0xdc6f('0x27'),_0x3fbd4e?util[_0xdc6f('0xb')]('%s.%s',_0x5bf860,_0x3fbd4e?_0xdc6f('0x24'):_0xdc6f('0x21')):null);});})[_0xdc6f('0x28')](function(_0x4135c1){logger[_0xdc6f('0x25')](util[_0xdc6f('0xb')](_0xdc6f('0x29'),EXTRACTED_REPORT_ID,_0xdc6f('0xd')),util[_0xdc6f('0x2a')](_0x4135c1,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 6ed997e..1644420 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 _0xddec=['last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','then','intervals','findAll','VoiceExtension','map','filter','groupBy','exten','queue','playback','priority','extensions','push','type','Set','format','context','VoiceExtensionId','outbound','extension','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','*,*,*,*','interval','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xddec,0x177));var _0xcdde=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xddec[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xcdde('0x0'));var util=require(_0xcdde('0x1'));function rewrite(_0x581eec,_0x3eebb6){var _0x22eb59=this;return _0x581eec[_0xcdde('0x2')][_0xcdde('0x3')]['findAll']({'raw':!![]})[_0xcdde('0x4')](function(_0x3bf6c8){_0x22eb59[_0xcdde('0x5')]=_0x3bf6c8;return _0x581eec[_0xcdde('0x2')]['VoiceExtension'][_0xcdde('0x6')]({'where':{'IntervalId':_0x3eebb6['IntervalId']},'raw':!![]});})[_0xcdde('0x4')](function(_0x405638){return _0x581eec[_0xcdde('0x2')][_0xcdde('0x7')][_0xcdde('0x6')]({'where':{'exten':{'$in':_['uniq'](_[_0xcdde('0x8')](_0x405638,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xcdde('0x4')](function(_0x385be3){var _0x4be6d6=_[_0xcdde('0x9')](_0x385be3,{'priority':'1'});var _0x4c6cc9=_[_0xcdde('0x9')](_0x385be3,{'isApp':0x1});var _0x28295d=_[_0xcdde('0xa')](_0x4c6cc9,_0xcdde('0xb'));var _0x4c47bd=[_0xcdde('0xc'),_0xcdde('0xd')];var _0x5a8dea=[];var _0x5901a5=[];for(var _0x418b4d in _0x28295d){if(_0x28295d['hasOwnProperty'](_0x418b4d)){_0x22eb59[_0xcdde('0xe')]=0x2;_0x22eb59[_0xcdde('0xf')]=[];_0x22eb59['extension']=_['find'](_0x4be6d6,{'exten':_0x28295d[_0x418b4d][0x0][_0xcdde('0xb')]});_0x22eb59[_0xcdde('0xf')][_0xcdde('0x10')]({'type':_0x28295d[_0x418b4d][0x0][_0xcdde('0x11')],'app':_0xcdde('0x12'),'appdata':util[_0xcdde('0x13')]('CDR(type)=%s',_0x28295d[_0x418b4d][0x0]['type']),'context':_0x28295d[_0x418b4d][0x0][_0xcdde('0x14')],'exten':_0x28295d[_0x418b4d][0x0]['exten'],'priority':_0x22eb59[_0xcdde('0xe')]++,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]});if(_0x28295d[_0x418b4d][0x0]['type']===_0xcdde('0x16')){if(_0x22eb59[_0xcdde('0x17')]){_0x22eb59[_0xcdde('0xf')]['push']({'type':_0x28295d[_0x418b4d][0x0][_0xcdde('0x11')],'app':_0xcdde('0x12'),'appdata':_0xcdde('0x18')+(_0x22eb59[_0xcdde('0x17')]['cutdigits']?_0xcdde('0x19')+_0x22eb59[_0xcdde('0x17')][_0xcdde('0x1a')]+'}':_0xcdde('0x1b')),'context':_0x28295d[_0x418b4d][0x0][_0xcdde('0x14')],'exten':_0x28295d[_0x418b4d][0x0]['exten'],'priority':_0x22eb59[_0xcdde('0xe')]++,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]});}_0x22eb59[_0xcdde('0xf')]['push']({'type':_0x28295d[_0x418b4d][0x0][_0xcdde('0x11')],'app':_0xcdde('0x12'),'appdata':_0xcdde('0x1c')+_0x28295d[_0x418b4d][0x0]['VoiceExtensionId'],'context':_0x28295d[_0x418b4d][0x0][_0xcdde('0x14')],'exten':_0x28295d[_0x418b4d][0x0][_0xcdde('0xb')],'priority':_0x22eb59['priority']++,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]});var _0x4f4299=_0x22eb59[_0xcdde('0xe')]++;_0x22eb59[_0xcdde('0xf')]['push']({'type':_0x28295d[_0x418b4d][0x0]['type'],'app':_0xcdde('0x1d'),'appdata':_0xcdde('0x1e')+(_0x4f4299+0x2)+_0xcdde('0x1f')+(_0x4f4299+0x1)+')','context':_0x28295d[_0x418b4d][0x0][_0xcdde('0x14')],'exten':_0x28295d[_0x418b4d][0x0][_0xcdde('0xb')],'priority':_0x4f4299,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0]['VoiceExtensionId']});if(_0x22eb59[_0xcdde('0x17')]){_0x22eb59[_0xcdde('0xf')][_0xcdde('0x10')]({'type':_0x28295d[_0x418b4d][0x0][_0xcdde('0x11')],'app':'Set','appdata':_0x22eb59['extension']['cutdigits']?_0xcdde('0x20')+_0x22eb59[_0xcdde('0x17')][_0xcdde('0x1a')]+'}':_0xcdde('0x21'),'context':_0x28295d[_0x418b4d][0x0]['context'],'exten':_0x28295d[_0x418b4d][0x0]['exten'],'priority':_0x22eb59['priority']++,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]});}_0x22eb59[_0xcdde('0xf')]['push']({'type':_0x28295d[_0x418b4d][0x0][_0xcdde('0x11')],'app':_0xcdde('0x12'),'appdata':_0xcdde('0x22')+_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')],'context':_0x28295d[_0x418b4d][0x0][_0xcdde('0x14')],'exten':_0x28295d[_0x418b4d][0x0][_0xcdde('0xb')],'priority':_0x22eb59[_0xcdde('0xe')]++,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]});if(_0x22eb59[_0xcdde('0x17')]&&_0x22eb59[_0xcdde('0x17')][_0xcdde('0x23')]('recordingFormat')&&_0x22eb59['extension']['recordingFormat']!==_0xcdde('0x24')){_0x22eb59[_0xcdde('0xf')]['push']({'type':_0x28295d[_0x418b4d][0x0][_0xcdde('0x11')],'app':_0xcdde('0x12'),'appdata':_0xcdde('0x25'),'context':_0x28295d[_0x418b4d][0x0][_0xcdde('0x14')],'exten':_0x28295d[_0x418b4d][0x0][_0xcdde('0xb')],'priority':_0x22eb59[_0xcdde('0xe')]++,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]});_0x22eb59[_0xcdde('0xf')][_0xcdde('0x10')]({'type':_0x28295d[_0x418b4d][0x0][_0xcdde('0x11')],'app':_0xcdde('0x12'),'appdata':_0xcdde('0x26')+_0x22eb59[_0xcdde('0x17')][_0xcdde('0x27')]||_0xcdde('0x28'),'context':_0x28295d[_0x418b4d][0x0]['context'],'exten':_0x28295d[_0x418b4d][0x0][_0xcdde('0xb')],'priority':_0x22eb59[_0xcdde('0xe')]++,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]});}}_0x22eb59[_0xcdde('0xf')]['push']({'type':_0x28295d[_0x418b4d][0x0][_0xcdde('0x11')],'app':_0xcdde('0x12'),'appdata':_0xcdde('0x29'),'context':_0x28295d[_0x418b4d][0x0][_0xcdde('0x14')],'exten':_0x28295d[_0x418b4d][0x0][_0xcdde('0xb')],'priority':_0x22eb59[_0xcdde('0xe')]++,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]});_0x22eb59[_0xcdde('0xf')][_0xcdde('0x10')]({'type':_0x28295d[_0x418b4d][0x0][_0xcdde('0x11')],'app':_0xcdde('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x28295d[_0x418b4d][0x0][_0xcdde('0x14')],'exten':_0x28295d[_0x418b4d][0x0][_0xcdde('0xb')],'priority':_0x22eb59[_0xcdde('0xe')]++,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]});_0x22eb59['extensions'][_0xcdde('0x10')]({'type':_0x28295d[_0x418b4d][0x0][_0xcdde('0x11')],'app':_0xcdde('0x12'),'appdata':_0xcdde('0x2a'),'context':_0x28295d[_0x418b4d][0x0][_0xcdde('0x14')],'exten':_0x28295d[_0x418b4d][0x0][_0xcdde('0xb')],'priority':_0x22eb59[_0xcdde('0xe')]++,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]});for(var _0x54f6f5=0x0,_0x4edcf8=0x0;_0x54f6f5<_0x28295d[_0x418b4d][_0xcdde('0x2b')];_0x54f6f5+=0x1,_0x4edcf8=0x0){var _0x51548b=_0x28295d[_0x418b4d][_0x54f6f5];if(_0x51548b['type']){_0x51548b[_0xcdde('0x11')]=_0x51548b[_0xcdde('0x11')][_0xcdde('0x2c')]();}var _0x378a5b=[];var _0x145569=[];delete _0x51548b['id'];delete _0x51548b[_0xcdde('0x2d')];delete _0x51548b['updatedAt'];var _0x47fca3=_0x51548b['interval']!==_0xcdde('0x2e')?[_0x51548b[_0xcdde('0x2f')]]:_0x51548b[_0xcdde('0x30')]?_[_0xcdde('0x8')](_[_0xcdde('0x9')](_0x22eb59['intervals'],{'IntervalId':_0x51548b[_0xcdde('0x30')]}),'interval'):[];if(_0x51548b['hasOwnProperty'](_0xcdde('0x31'))){if(_0x51548b[_0xcdde('0x31')]&&_0x51548b[_0xcdde('0x31')]!=='--'){_0x378a5b[_0xcdde('0x10')]({'type':_0x51548b['type'],'app':_0xcdde('0x12'),'appdata':_0xcdde('0x32')+_0x51548b[_0xcdde('0x31')],'context':_0x51548b[_0xcdde('0x14')],'exten':_0x51548b[_0xcdde('0xb')],'priority':_0x47fca3[_0xcdde('0x2b')]+_0x22eb59['priority']+_0x4edcf8++,'VoiceExtensionId':_0x51548b[_0xcdde('0x15')]});}}if(_0x51548b[_0xcdde('0x11')]===_0xcdde('0x16')&&_0x51548b['hasOwnProperty'](_0xcdde('0x33'))){if(_0x51548b[_0xcdde('0x33')]){_0x378a5b[_0xcdde('0x10')]({'type':_0x51548b[_0xcdde('0x11')],'app':'ExecIf','appdata':_0xcdde('0x34')+_0x51548b[_0xcdde('0x33')]+')','context':_0x51548b[_0xcdde('0x14')],'exten':_0x51548b[_0xcdde('0xb')],'priority':_0x47fca3[_0xcdde('0x2b')]+_0x22eb59['priority']+_0x4edcf8++,'VoiceExtensionId':_0x51548b['VoiceExtensionId']});}else{_0x378a5b[_0xcdde('0x10')]({'type':_0x51548b[_0xcdde('0x11')],'app':_0xcdde('0x1d'),'appdata':_0xcdde('0x35'),'context':_0x51548b[_0xcdde('0x14')],'exten':_0x51548b[_0xcdde('0xb')],'priority':_0x47fca3[_0xcdde('0x2b')]+_0x22eb59[_0xcdde('0xe')]+_0x4edcf8++,'VoiceExtensionId':_0x51548b[_0xcdde('0x15')]});}}if(_0x51548b[_0xcdde('0x23')](_0xcdde('0x36'))){if(_0x4c47bd['indexOf'](_0x51548b[_0xcdde('0x37')]['toLowerCase']())>=0x0&&_0x51548b[_0xcdde('0x38')]!==_0xcdde('0x39')){if(_0x51548b[_0xcdde('0x36')]){_0x378a5b[_0xcdde('0x10')]({'type':_0x51548b[_0xcdde('0x11')],'app':'ExecIf','appdata':_0xcdde('0x3a'),'context':_0x51548b['context'],'exten':_0x51548b[_0xcdde('0xb')],'priority':_0x47fca3[_0xcdde('0x2b')]+_0x22eb59['priority']+_0x4edcf8++,'VoiceExtensionId':_0x51548b[_0xcdde('0x15')]});_0x378a5b[_0xcdde('0x10')]({'type':_0x51548b[_0xcdde('0x11')],'app':_0xcdde('0x12'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x51548b[_0xcdde('0x14')],'exten':_0x51548b[_0xcdde('0xb')],'priority':_0x47fca3[_0xcdde('0x2b')]+_0x22eb59[_0xcdde('0xe')]+_0x4edcf8++,'VoiceExtensionId':_0x51548b[_0xcdde('0x15')]});}else{_0x378a5b['push']({'type':_0x51548b['type'],'app':_0xcdde('0x1d'),'appdata':_0xcdde('0x3b'),'context':_0x51548b[_0xcdde('0x14')],'exten':_0x51548b[_0xcdde('0xb')],'priority':_0x47fca3['length']+_0x22eb59[_0xcdde('0xe')]+_0x4edcf8++,'VoiceExtensionId':_0x51548b[_0xcdde('0x15')]});_0x378a5b[_0xcdde('0x10')]({'type':_0x51548b['type'],'app':'Set','appdata':_0xcdde('0x3c'),'context':_0x51548b[_0xcdde('0x14')],'exten':_0x51548b[_0xcdde('0xb')],'priority':_0x47fca3['length']+_0x22eb59[_0xcdde('0xe')]+_0x4edcf8++,'VoiceExtensionId':_0x51548b[_0xcdde('0x15')]});}}}for(var _0x2553a6=0x0;_0x2553a6<_0x47fca3[_0xcdde('0x2b')];_0x2553a6+=0x1){var _0x4a3b27=_0x22eb59['priority']+_0x47fca3[_0xcdde('0x2b')];var _0x574c8a=_0x2553a6===_0x47fca3['length']-0x1?_0x22eb59[_0xcdde('0xe')]+_0x378a5b[_0xcdde('0x2b')]+_0x145569['length']+0x2:_0x22eb59[_0xcdde('0xe')]+_0x2553a6+0x1;_0x378a5b[_0xcdde('0x3d')](_0x2553a6,0x0,{'type':_0x51548b[_0xcdde('0x11')],'app':'GotoIfTime','appdata':_0x47fca3[_0x2553a6]+'?'+_0x51548b['context']+_0xcdde('0x3e')+_0x4a3b27+':'+_0x51548b[_0xcdde('0x14')]+_0xcdde('0x3e')+_0x574c8a,'exten':_0x51548b['exten'],'context':_0x51548b[_0xcdde('0x14')],'priority':_0x22eb59[_0xcdde('0xe')]+_0x2553a6,'VoiceExtensionId':_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]});}_0x51548b['priority']=_0x378a5b[_0xcdde('0x2b')]?_[_0xcdde('0x3f')](_0x378a5b)['priority']+0x1:_0x22eb59[_0xcdde('0xe')];_0x22eb59[_0xcdde('0xe')]=(_0x145569[_0xcdde('0x2b')]?_['last'](_0x145569)['priority']:_0x51548b[_0xcdde('0xe')])+0x1;_0x22eb59['extensions']=_['concat'](_0x22eb59[_0xcdde('0xf')],_0x378a5b,[_0x51548b],_0x145569);}_0x22eb59[_0xcdde('0xf')][_0xcdde('0x10')]({'type':_0x28295d[_0x418b4d][0x0][_0xcdde('0x11')],'app':_0xcdde('0x40'),'exten':_0x28295d[_0x418b4d][0x0][_0xcdde('0xb')],'context':_0x28295d[_0x418b4d][0x0][_0xcdde('0x14')],'priority':_0x22eb59[_0xcdde('0xe')],'VoiceExtensionId':_0x28295d[_0x418b4d][0x0]['VoiceExtensionId']});_0x5a8dea[_0xcdde('0x10')](_0x28295d[_0x418b4d][0x0][_0xcdde('0x15')]);_0x5901a5=_[_0xcdde('0x41')](_0x5901a5,_0x22eb59[_0xcdde('0xf')]);}}return _0x581eec[_0xcdde('0x42')](function(_0x4839aa){return _0x581eec[_0xcdde('0x2')][_0xcdde('0x7')][_0xcdde('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x5a8dea}},'transaction':_0x4839aa})[_0xcdde('0x4')](function(_0xfcd238){return _0x581eec[_0xcdde('0x2')]['VoiceExtension'][_0xcdde('0x44')](_[_0xcdde('0x45')](_0x5901a5,_0xcdde('0xe')),{'transaction':_0x4839aa});});});})[_0xcdde('0x46')](function(_0x102ea0){console[_0xcdde('0x47')](_0x102ea0);});}exports[_0xcdde('0x48')]=rewrite; \ No newline at end of file +var _0xac63=['exten','filter','groupBy','queue','playback','hasOwnProperty','find','extensions','Set','format','type','context','priority','outbound','push','extension','cutdigits','${EXTEN:','CDR(routeid)=','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','models','Interval','findAll','then','intervals','VoiceExtension','map'];(function(_0x5d41de,_0x10afb3){var _0x2345b1=function(_0xd9be55){while(--_0xd9be55){_0x5d41de['push'](_0x5d41de['shift']());}};_0x2345b1(++_0x10afb3);}(_0xac63,0x19d));var _0x3ac6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xac63[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x129180,_0x26d0c0){var _0x354ee9=this;return _0x129180[_0x3ac6('0x0')][_0x3ac6('0x1')][_0x3ac6('0x2')]({'raw':!![]})[_0x3ac6('0x3')](function(_0x3227b5){_0x354ee9[_0x3ac6('0x4')]=_0x3227b5;return _0x129180[_0x3ac6('0x0')][_0x3ac6('0x5')][_0x3ac6('0x2')]({'where':{'IntervalId':_0x26d0c0['IntervalId']},'raw':!![]});})[_0x3ac6('0x3')](function(_0x4e0933){return _0x129180[_0x3ac6('0x0')][_0x3ac6('0x5')][_0x3ac6('0x2')]({'where':{'exten':{'$in':_['uniq'](_[_0x3ac6('0x6')](_0x4e0933,_0x3ac6('0x7')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x3ac6('0x3')](function(_0x30cc53){var _0x5c0d3b=_[_0x3ac6('0x8')](_0x30cc53,{'priority':'1'});var _0x2858d7=_[_0x3ac6('0x8')](_0x30cc53,{'isApp':0x1});var _0x2ec73f=_[_0x3ac6('0x9')](_0x2858d7,_0x3ac6('0x7'));var _0x1f0783=[_0x3ac6('0xa'),_0x3ac6('0xb')];var _0x426e0b=[];var _0x140f64=[];for(var _0x1e0c32 in _0x2ec73f){if(_0x2ec73f[_0x3ac6('0xc')](_0x1e0c32)){_0x354ee9['priority']=0x2;_0x354ee9['extensions']=[];_0x354ee9['extension']=_[_0x3ac6('0xd')](_0x5c0d3b,{'exten':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x7')]});_0x354ee9[_0x3ac6('0xe')]['push']({'type':_0x2ec73f[_0x1e0c32][0x0]['type'],'app':_0x3ac6('0xf'),'appdata':util[_0x3ac6('0x10')]('CDR(type)=%s',_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x11')]),'context':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x12')],'exten':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x7')],'priority':_0x354ee9[_0x3ac6('0x13')]++,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0]['VoiceExtensionId']});if(_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x11')]===_0x3ac6('0x14')){if(_0x354ee9['extension']){_0x354ee9[_0x3ac6('0xe')][_0x3ac6('0x15')]({'type':_0x2ec73f[_0x1e0c32][0x0]['type'],'app':_0x3ac6('0xf'),'appdata':'CDR(destination)='+(_0x354ee9[_0x3ac6('0x16')][_0x3ac6('0x17')]?_0x3ac6('0x18')+_0x354ee9['extension']['cutdigits']+'}':'${EXTEN}'),'context':_0x2ec73f[_0x1e0c32][0x0]['context'],'exten':_0x2ec73f[_0x1e0c32][0x0]['exten'],'priority':_0x354ee9[_0x3ac6('0x13')]++,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0]['VoiceExtensionId']});}_0x354ee9[_0x3ac6('0xe')]['push']({'type':_0x2ec73f[_0x1e0c32][0x0]['type'],'app':_0x3ac6('0xf'),'appdata':_0x3ac6('0x19')+_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x1a')],'context':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x12')],'exten':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x7')],'priority':_0x354ee9['priority']++,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0]['VoiceExtensionId']});var _0x328685=_0x354ee9[_0x3ac6('0x13')]++;_0x354ee9[_0x3ac6('0xe')][_0x3ac6('0x15')]({'type':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x11')],'app':_0x3ac6('0x1b'),'appdata':_0x3ac6('0x1c')+(_0x328685+0x2)+_0x3ac6('0x1d')+(_0x328685+0x1)+')','context':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x12')],'exten':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x7')],'priority':_0x328685,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0]['VoiceExtensionId']});if(_0x354ee9['extension']){_0x354ee9[_0x3ac6('0xe')][_0x3ac6('0x15')]({'type':_0x2ec73f[_0x1e0c32][0x0]['type'],'app':_0x3ac6('0xf'),'appdata':_0x354ee9[_0x3ac6('0x16')][_0x3ac6('0x17')]?_0x3ac6('0x1e')+_0x354ee9[_0x3ac6('0x16')][_0x3ac6('0x17')]+'}':_0x3ac6('0x1f'),'context':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x12')],'exten':_0x2ec73f[_0x1e0c32][0x0]['exten'],'priority':_0x354ee9['priority']++,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x1a')]});}_0x354ee9[_0x3ac6('0xe')][_0x3ac6('0x15')]({'type':_0x2ec73f[_0x1e0c32][0x0]['type'],'app':_0x3ac6('0xf'),'appdata':_0x3ac6('0x20')+_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x1a')],'context':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x12')],'exten':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x7')],'priority':_0x354ee9[_0x3ac6('0x13')]++,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0]['VoiceExtensionId']});if(_0x354ee9['extension']&&_0x354ee9['extension'][_0x3ac6('0xc')](_0x3ac6('0x21'))&&_0x354ee9[_0x3ac6('0x16')][_0x3ac6('0x21')]!=='none'){_0x354ee9[_0x3ac6('0xe')][_0x3ac6('0x15')]({'type':_0x2ec73f[_0x1e0c32][0x0]['type'],'app':_0x3ac6('0xf'),'appdata':_0x3ac6('0x22'),'context':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x12')],'exten':_0x2ec73f[_0x1e0c32][0x0]['exten'],'priority':_0x354ee9[_0x3ac6('0x13')]++,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x1a')]});_0x354ee9[_0x3ac6('0xe')][_0x3ac6('0x15')]({'type':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x11')],'app':_0x3ac6('0xf'),'appdata':_0x3ac6('0x23')+_0x354ee9[_0x3ac6('0x16')]['recordingFormat']||_0x3ac6('0x24'),'context':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x12')],'exten':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x7')],'priority':_0x354ee9[_0x3ac6('0x13')]++,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x1a')]});}}_0x354ee9[_0x3ac6('0xe')]['push']({'type':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x11')],'app':'Set','appdata':_0x3ac6('0x25'),'context':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x12')],'exten':_0x2ec73f[_0x1e0c32][0x0]['exten'],'priority':_0x354ee9[_0x3ac6('0x13')]++,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x1a')]});_0x354ee9['extensions'][_0x3ac6('0x15')]({'type':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x11')],'app':_0x3ac6('0xf'),'appdata':_0x3ac6('0x26'),'context':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x12')],'exten':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x7')],'priority':_0x354ee9[_0x3ac6('0x13')]++,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x1a')]});_0x354ee9[_0x3ac6('0xe')][_0x3ac6('0x15')]({'type':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x11')],'app':_0x3ac6('0xf'),'appdata':_0x3ac6('0x27'),'context':_0x2ec73f[_0x1e0c32][0x0]['context'],'exten':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x7')],'priority':_0x354ee9['priority']++,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x1a')]});for(var _0x18230d=0x0,_0xb2ea38=0x0;_0x18230d<_0x2ec73f[_0x1e0c32][_0x3ac6('0x28')];_0x18230d+=0x1,_0xb2ea38=0x0){var _0x1b6cca=_0x2ec73f[_0x1e0c32][_0x18230d];if(_0x1b6cca[_0x3ac6('0x11')]){_0x1b6cca['type']=_0x1b6cca[_0x3ac6('0x11')][_0x3ac6('0x29')]();}var _0x1ffd62=[];var _0x4202cf=[];delete _0x1b6cca['id'];delete _0x1b6cca[_0x3ac6('0x2a')];delete _0x1b6cca[_0x3ac6('0x2b')];var _0x3fd955=_0x1b6cca[_0x3ac6('0x2c')]!==_0x3ac6('0x2d')?[_0x1b6cca['interval']]:_0x1b6cca[_0x3ac6('0x2e')]?_['map'](_['filter'](_0x354ee9[_0x3ac6('0x4')],{'IntervalId':_0x1b6cca[_0x3ac6('0x2e')]}),'interval'):[];if(_0x1b6cca[_0x3ac6('0xc')](_0x3ac6('0x2f'))){if(_0x1b6cca[_0x3ac6('0x2f')]&&_0x1b6cca[_0x3ac6('0x2f')]!=='--'){_0x1ffd62['push']({'type':_0x1b6cca[_0x3ac6('0x11')],'app':_0x3ac6('0xf'),'appdata':_0x3ac6('0x30')+_0x1b6cca[_0x3ac6('0x2f')],'context':_0x1b6cca[_0x3ac6('0x12')],'exten':_0x1b6cca[_0x3ac6('0x7')],'priority':_0x3fd955[_0x3ac6('0x28')]+_0x354ee9['priority']+_0xb2ea38++,'VoiceExtensionId':_0x1b6cca[_0x3ac6('0x1a')]});}}if(_0x1b6cca[_0x3ac6('0x11')]==='outbound'&&_0x1b6cca[_0x3ac6('0xc')]('callerID')){if(_0x1b6cca[_0x3ac6('0x31')]){_0x1ffd62[_0x3ac6('0x15')]({'type':_0x1b6cca[_0x3ac6('0x11')],'app':_0x3ac6('0x1b'),'appdata':_0x3ac6('0x32')+_0x1b6cca['callerID']+')','context':_0x1b6cca['context'],'exten':_0x1b6cca[_0x3ac6('0x7')],'priority':_0x3fd955[_0x3ac6('0x28')]+_0x354ee9[_0x3ac6('0x13')]+_0xb2ea38++,'VoiceExtensionId':_0x1b6cca[_0x3ac6('0x1a')]});}else{_0x1ffd62['push']({'type':_0x1b6cca['type'],'app':'ExecIf','appdata':_0x3ac6('0x33'),'context':_0x1b6cca['context'],'exten':_0x1b6cca['exten'],'priority':_0x3fd955[_0x3ac6('0x28')]+_0x354ee9[_0x3ac6('0x13')]+_0xb2ea38++,'VoiceExtensionId':_0x1b6cca[_0x3ac6('0x1a')]});}}if(_0x1b6cca[_0x3ac6('0xc')](_0x3ac6('0x34'))){if(_0x1f0783['indexOf'](_0x1b6cca[_0x3ac6('0x35')][_0x3ac6('0x29')]())>=0x0&&_0x1b6cca['appType']!==_0x3ac6('0x36')){if(_0x1b6cca[_0x3ac6('0x34')]){_0x1ffd62[_0x3ac6('0x15')]({'type':_0x1b6cca[_0x3ac6('0x11')],'app':_0x3ac6('0x1b'),'appdata':_0x3ac6('0x37'),'context':_0x1b6cca[_0x3ac6('0x12')],'exten':_0x1b6cca[_0x3ac6('0x7')],'priority':_0x3fd955[_0x3ac6('0x28')]+_0x354ee9[_0x3ac6('0x13')]+_0xb2ea38++,'VoiceExtensionId':_0x1b6cca[_0x3ac6('0x1a')]});_0x1ffd62[_0x3ac6('0x15')]({'type':_0x1b6cca[_0x3ac6('0x11')],'app':_0x3ac6('0xf'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1b6cca[_0x3ac6('0x12')],'exten':_0x1b6cca[_0x3ac6('0x7')],'priority':_0x3fd955['length']+_0x354ee9[_0x3ac6('0x13')]+_0xb2ea38++,'VoiceExtensionId':_0x1b6cca['VoiceExtensionId']});}else{_0x1ffd62[_0x3ac6('0x15')]({'type':_0x1b6cca[_0x3ac6('0x11')],'app':_0x3ac6('0x1b'),'appdata':_0x3ac6('0x38'),'context':_0x1b6cca[_0x3ac6('0x12')],'exten':_0x1b6cca[_0x3ac6('0x7')],'priority':_0x3fd955[_0x3ac6('0x28')]+_0x354ee9[_0x3ac6('0x13')]+_0xb2ea38++,'VoiceExtensionId':_0x1b6cca[_0x3ac6('0x1a')]});_0x1ffd62['push']({'type':_0x1b6cca[_0x3ac6('0x11')],'app':_0x3ac6('0xf'),'appdata':_0x3ac6('0x39'),'context':_0x1b6cca['context'],'exten':_0x1b6cca[_0x3ac6('0x7')],'priority':_0x3fd955[_0x3ac6('0x28')]+_0x354ee9[_0x3ac6('0x13')]+_0xb2ea38++,'VoiceExtensionId':_0x1b6cca[_0x3ac6('0x1a')]});}}}for(var _0x5ad7c1=0x0;_0x5ad7c1<_0x3fd955['length'];_0x5ad7c1+=0x1){var _0x217d93=_0x354ee9[_0x3ac6('0x13')]+_0x3fd955[_0x3ac6('0x28')];var _0x31712d=_0x5ad7c1===_0x3fd955[_0x3ac6('0x28')]-0x1?_0x354ee9['priority']+_0x1ffd62[_0x3ac6('0x28')]+_0x4202cf['length']+0x2:_0x354ee9[_0x3ac6('0x13')]+_0x5ad7c1+0x1;_0x1ffd62[_0x3ac6('0x3a')](_0x5ad7c1,0x0,{'type':_0x1b6cca[_0x3ac6('0x11')],'app':_0x3ac6('0x3b'),'appdata':_0x3fd955[_0x5ad7c1]+'?'+_0x1b6cca['context']+_0x3ac6('0x3c')+_0x217d93+':'+_0x1b6cca[_0x3ac6('0x12')]+_0x3ac6('0x3c')+_0x31712d,'exten':_0x1b6cca[_0x3ac6('0x7')],'context':_0x1b6cca['context'],'priority':_0x354ee9[_0x3ac6('0x13')]+_0x5ad7c1,'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x1a')]});}_0x1b6cca['priority']=_0x1ffd62[_0x3ac6('0x28')]?_[_0x3ac6('0x3d')](_0x1ffd62)['priority']+0x1:_0x354ee9[_0x3ac6('0x13')];_0x354ee9[_0x3ac6('0x13')]=(_0x4202cf[_0x3ac6('0x28')]?_[_0x3ac6('0x3d')](_0x4202cf)[_0x3ac6('0x13')]:_0x1b6cca[_0x3ac6('0x13')])+0x1;_0x354ee9[_0x3ac6('0xe')]=_[_0x3ac6('0x3e')](_0x354ee9[_0x3ac6('0xe')],_0x1ffd62,[_0x1b6cca],_0x4202cf);}_0x354ee9[_0x3ac6('0xe')][_0x3ac6('0x15')]({'type':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x11')],'app':_0x3ac6('0x3f'),'exten':_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x7')],'context':_0x2ec73f[_0x1e0c32][0x0]['context'],'priority':_0x354ee9['priority'],'VoiceExtensionId':_0x2ec73f[_0x1e0c32][0x0]['VoiceExtensionId']});_0x426e0b['push'](_0x2ec73f[_0x1e0c32][0x0][_0x3ac6('0x1a')]);_0x140f64=_[_0x3ac6('0x3e')](_0x140f64,_0x354ee9[_0x3ac6('0xe')]);}}return _0x129180[_0x3ac6('0x40')](function(_0x177918){return _0x129180[_0x3ac6('0x0')][_0x3ac6('0x5')][_0x3ac6('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x426e0b}},'transaction':_0x177918})[_0x3ac6('0x3')](function(_0x96b41a){return _0x129180[_0x3ac6('0x0')][_0x3ac6('0x5')][_0x3ac6('0x42')](_[_0x3ac6('0x43')](_0x140f64,'priority'),{'transaction':_0x177918});});});})[_0x3ac6('0x44')](function(_0xb246b5){console[_0x3ac6('0x45')](_0xb246b5);});}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 e04e2b8..a17ff75 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 _0x1f79=['dialCheckDuplicateType','CmList','Lists','query','VoiceQueueId','onlyIfOpen','sequelize','BlackLists','get','all','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','info','CmContact','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../config/environment','../../../config/logger','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','errors','message','join','data','firstName','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','checkHopper','inspect','insert','into','fromQuery','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','phone','cm_hopper','\x20=\x20?','id\x20IN\x20?','calleridnum','cm_hopper_final','cm_hopper_black','str','VoiceQueue','findAll','outbound'];(function(_0x2ba3b9,_0x29a9ac){var _0x471692=function(_0x11d273){while(--_0x11d273){_0x2ba3b9['push'](_0x2ba3b9['shift']());}};_0x471692(++_0x29a9ac);}(_0x1f79,0xf4));var _0x91f7=function(_0x58e2fa,_0x1569af){_0x58e2fa=_0x58e2fa-0x0;var _0x465707=_0x1f79[_0x58e2fa];return _0x465707;};'use strict';var BPromise=require(_0x91f7('0x0'));var util=require(_0x91f7('0x1'));var _=require(_0x91f7('0x2'));var fs=require('fs');var squel=require(_0x91f7('0x3'));var Papa=require(_0x91f7('0x4'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x91f7('0x5'));var logger=require(_0x91f7('0x6'))(_0x91f7('0x7'));config[_0x91f7('0x8')]=_['defaults'](config[_0x91f7('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x91f7('0x9'))(new Redis(config[_0x91f7('0x8')]));require(_0x91f7('0xa'))[_0x91f7('0xb')](socket);try{if(!process[_0x91f7('0xc')][0x2]||process['argv'][0x2]===_0x91f7('0xd')||process[_0x91f7('0xc')][0x2]===_0x91f7('0xe')){throw new Error(_0x91f7('0xf'));}var FILEPATH=process['argv'][0x2];if(!process[_0x91f7('0xc')][0x3]||process[_0x91f7('0xc')][0x3]===_0x91f7('0xd')||process['argv'][0x3]===_0x91f7('0xe')||!process['argv'][0x4]||process[_0x91f7('0xc')][0x4]===_0x91f7('0xd')||process[_0x91f7('0xc')][0x4]==='null'){throw new Error(_0x91f7('0x10'));}var FIELDS=_[_0x91f7('0x11')](process[_0x91f7('0xc')][0x3][_0x91f7('0x12')](','),process[_0x91f7('0xc')][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x91f7('0xd')||process['argv'][0x5]===_0x91f7('0xe')){throw new Error(_0x91f7('0x13'));}var LISTID=process[_0x91f7('0xc')][0x5];var COMPANYID=process[_0x91f7('0xc')][0x6]&&process[_0x91f7('0xc')][0x6]!==_0x91f7('0xd')&&process['argv'][0x6]!==_0x91f7('0xe')?process[_0x91f7('0xc')][0x6]:null;var DUPLICATES=process[_0x91f7('0xc')][0x7]&&process[_0x91f7('0xc')][0x7]!=='undefined'&&process[_0x91f7('0xc')][0x7]!==_0x91f7('0xe')?process[_0x91f7('0xc')][0x7]:null;if(!process[_0x91f7('0xc')][0x8]||process[_0x91f7('0xc')][0x8]===_0x91f7('0xd')||process['argv'][0x8]===_0x91f7('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x91f7('0xc')][0x8];}catch(_0x2feabd){logger['error'](_0x2feabd);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(_0x42c124,_0x4ae3fa,_0x352139,_0x5540e6){var _0x822464={'message':_0x4ae3fa};_0x822464[_0x42c124]=!![];if(_0x352139){_0x822464[_0x91f7('0x14')]=_0x352139;}if(_0x5540e6){_0x822464[_0x91f7('0x15')]=_0x5540e6;}return _0x822464;}function isEmail(_0x5bf4e2){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))*$/[_0x91f7('0x16')](_0x5bf4e2);}function checkRow(_0x400dcd,_0x563aad,_0x5d388e){return new BPromise(function(_0x5a3d97,_0x121bf0){if(_['isNil'](_0x400dcd)){return _0x121bf0(handleCheckRowError(_0x91f7('0x17'),_0x91f7('0x18'),null,_0x5d388e));}if(_0x400dcd['errors']&&_0x400dcd['errors'][_0x91f7('0x19')]){var _0x3f60f7=_['map'](_0x400dcd[_0x91f7('0x1a')],_0x91f7('0x1b'))[_0x91f7('0x1c')](';');return _0x121bf0(handleCheckRowError(_0x91f7('0x17'),_0x3f60f7,null,_0x5d388e));}var _0xa51010={};for(var _0xc354f8 in FIELDS){if(FIELDS['hasOwnProperty'](_0xc354f8)&&FIELDS[_0xc354f8]){_0xa51010[_0xc354f8]=_0x400dcd[_0x91f7('0x1d')][0x0][FIELDS[_0xc354f8]]||_0x400dcd[_0x91f7('0x1d')][0x0]['\ufeff'+FIELDS[_0xc354f8]];}}if(!_0xa51010[_0x91f7('0x1e')]){return _0x121bf0(handleCheckRowError(_0x91f7('0x17'),'firstName\x20not\x20specified!',null,_0x5d388e));}if(!_0xa51010['phone']){return _0x121bf0(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x5d388e));}if(_0xa51010['birthDate']){var _0x27e2e7=moment(_0xa51010['birthDate'],'YYYY-MM-DD');if(!_0x27e2e7[_0x91f7('0x1f')]()){return _0x121bf0(handleCheckRowError(_0x91f7('0x17'),_0x91f7('0x20'),null,_0x5d388e));}}if(_0xa51010[_0x91f7('0x21')]){if(!isEmail(_0xa51010[_0x91f7('0x21')])){return _0x121bf0(handleCheckRowError('error',_0x91f7('0x22'),null,_0x5d388e));}}_0xa51010[_0x91f7('0x23')]=LISTID;_0xa51010[_0x91f7('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x91f7('0x19')]&&_0x563aad){var _0x1bcccb={};for(var _0x3f1551=0x0,_0x3518e5=DUPLICATES[_0x91f7('0x19')];_0x3f1551<_0x3518e5;_0x3f1551+=0x1){_0x1bcccb[DUPLICATES[_0x3f1551]]=_0xa51010[DUPLICATES[_0x3f1551]];}var _0x3a538d=_['find'](_0x563aad,_0x1bcccb);if(_0x3a538d){return _0x121bf0(handleCheckRowError(_0x91f7('0x25'),_0x91f7('0x26'),_0x3a538d,_0x5d388e));}}return db['CmContact'][_0x91f7('0x27')](_0xa51010,{'raw':!![],'hooks':![],'fields':_[_0x91f7('0x28')](_0xa51010)})[_0x91f7('0x29')](function(_0x4d1e31){if(DUPLICATES&&DUPLICATES[_0x91f7('0x19')]&&_0x563aad){_0x563aad[_0x91f7('0x2a')](_[_0x91f7('0x2b')](_0xa51010,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4d1e31['id'];return _0x5a3d97();})[_0x91f7('0x2c')](function(_0x519ed5){return _0x121bf0(handleCheckRowError(_0x91f7('0x17'),_0x91f7('0x2d')+(_0x519ed5[_0x91f7('0x1b')]||JSON['stringify'](_0x519ed5)),null,_0x5d388e));});});}function checkHopper(){function _0x23e640(){return function(_0x63956){logger['error']('cmContact',_0x91f7('0x2e'),util[_0x91f7('0x2f')](_0x63956,{'showHidden':![],'depth':null}));};}var _0x46888b=function(_0x5a619f,_0x54652a){var _0x3886a0=squel[_0x91f7('0x30')]()[_0x91f7('0x31')]('cm_hopper')[_0x91f7('0x32')](['phone',_0x91f7('0x33'),_0x91f7('0x34'),_0x91f7('0x23'),_0x54652a,_0x91f7('0x35'),'updatedAt'],squel[_0x91f7('0x36')]()[_0x91f7('0x37')]('phone','phone')[_0x91f7('0x37')](_0x91f7('0x38'),_0x91f7('0x33'))[_0x91f7('0x37')]('id','ContactId')['field'](LISTID['toString'](),'ListId')[_0x91f7('0x37')](_0x5a619f['id'][_0x91f7('0x39')](),_0x54652a)['field'](_0x91f7('0x38'),_0x91f7('0x35'))[_0x91f7('0x37')](_0x91f7('0x38'),_0x91f7('0x3a'))[_0x91f7('0x3b')](_0x91f7('0x3c'))[_0x91f7('0x3d')](_0x91f7('0x3e'))['where'](_0x91f7('0x3f'),LISTID['toString']())[_0x91f7('0x3d')](_0x91f7('0x40'))[_0x91f7('0x3d')](_0x91f7('0x41'),squel[_0x91f7('0x36')]()['field'](_0x91f7('0x42'))[_0x91f7('0x3b')](_0x91f7('0x43'))[_0x91f7('0x3d')](_0x54652a+_0x91f7('0x44'),_0x5a619f['id'][_0x91f7('0x39')]())))[_0x91f7('0x39')]();return _0x3886a0;};var _0x14344b=function(_0x3a263c,_0x5ea9fe){var _0x58c520=squel[_0x91f7('0x30')]()[_0x91f7('0x31')](_0x91f7('0x43'))[_0x91f7('0x32')]([_0x91f7('0x42'),_0x91f7('0x33'),_0x91f7('0x34'),_0x91f7('0x23'),_0x5ea9fe,_0x91f7('0x35'),_0x91f7('0x3a')],squel[_0x91f7('0x36')]()[_0x91f7('0x37')](_0x91f7('0x42'),'phone')[_0x91f7('0x37')](_0x91f7('0x38'),'scheduledAt')[_0x91f7('0x37')]('id',_0x91f7('0x34'))[_0x91f7('0x37')](LISTID[_0x91f7('0x39')](),_0x91f7('0x23'))[_0x91f7('0x37')](_0x3a263c['id'][_0x91f7('0x39')](),_0x5ea9fe)[_0x91f7('0x37')](_0x91f7('0x38'),_0x91f7('0x35'))[_0x91f7('0x37')](_0x91f7('0x38'),_0x91f7('0x3a'))[_0x91f7('0x3b')]('cm_contacts')[_0x91f7('0x3d')](_0x91f7('0x3e'))[_0x91f7('0x3d')](_0x91f7('0x3f'),LISTID[_0x91f7('0x39')]())['where'](_0x91f7('0x45'),squel['str'](hopperContacts))[_0x91f7('0x3d')](_0x91f7('0x40'))['where'](_0x91f7('0x41'),squel[_0x91f7('0x36')]()[_0x91f7('0x37')](_0x91f7('0x46'))['from'](_0x91f7('0x47'))['where'](_0x5ea9fe+_0x91f7('0x44'),_0x3a263c['id'][_0x91f7('0x39')]()))['where'](_0x91f7('0x41'),squel[_0x91f7('0x36')]()[_0x91f7('0x37')](_0x91f7('0x42'))[_0x91f7('0x3b')](_0x91f7('0x43'))[_0x91f7('0x3d')](_0x5ea9fe+_0x91f7('0x44'),_0x3a263c['id'][_0x91f7('0x39')]())))[_0x91f7('0x39')]();return _0x58c520;};function _0x2d88ba(_0x51993a,_0x321521){var _0x26eef9=squel[_0x91f7('0x30')]()[_0x91f7('0x31')]('cm_hopper')['fromQuery'](['phone',_0x91f7('0x33'),'ContactId',_0x91f7('0x23'),_0x321521,_0x91f7('0x35'),_0x91f7('0x3a')],squel[_0x91f7('0x36')]()[_0x91f7('0x37')]('phone',_0x91f7('0x42'))[_0x91f7('0x37')](_0x91f7('0x38'),_0x91f7('0x33'))[_0x91f7('0x37')]('id',_0x91f7('0x34'))[_0x91f7('0x37')](LISTID['toString'](),_0x91f7('0x23'))[_0x91f7('0x37')](_0x51993a['id'][_0x91f7('0x39')](),_0x321521)[_0x91f7('0x37')](_0x91f7('0x38'),_0x91f7('0x35'))[_0x91f7('0x37')](_0x91f7('0x38'),'updatedAt')[_0x91f7('0x3b')](_0x91f7('0x3c'))['where']('deletedAt\x20IS\x20NULL')[_0x91f7('0x3d')](_0x91f7('0x3f'),LISTID[_0x91f7('0x39')]())[_0x91f7('0x3d')](_0x91f7('0x45'),squel['str'](hopperContacts))[_0x91f7('0x3d')](_0x91f7('0x40')))[_0x91f7('0x39')]();return _0x26eef9;}function _0x2664b3(_0x227a6e,_0x2305e1){var _0x2f9d4f=squel[_0x91f7('0x30')]()[_0x91f7('0x31')](_0x91f7('0x48'))[_0x91f7('0x32')]([_0x91f7('0x42'),_0x91f7('0x34'),_0x91f7('0x23'),_0x2305e1,'createdAt',_0x91f7('0x3a')],squel[_0x91f7('0x36')]()[_0x91f7('0x37')]('phone',_0x91f7('0x42'))['field']('id','ContactId')[_0x91f7('0x37')](LISTID['toString'](),_0x91f7('0x23'))[_0x91f7('0x37')](_0x227a6e['id'][_0x91f7('0x39')](),_0x2305e1)[_0x91f7('0x37')](_0x91f7('0x38'),_0x91f7('0x35'))[_0x91f7('0x37')]('NOW()',_0x91f7('0x3a'))['from'](_0x91f7('0x3c'))[_0x91f7('0x3d')](_0x91f7('0x3e'))[_0x91f7('0x3d')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x91f7('0x45'),squel[_0x91f7('0x49')](hopperContacts))[_0x91f7('0x3d')](_0x91f7('0x40')))['toString']();return _0x2f9d4f;}return db[_0x91f7('0x4a')][_0x91f7('0x4b')]({'where':{'type':_0x91f7('0x4c')},'attributes':['id',_0x91f7('0x4d')],'include':[{'model':db[_0x91f7('0x4e')],'as':_0x91f7('0x4f'),'where':{'id':LISTID}}]})[_0x91f7('0x29')](function(_0x44af1d){var _0x22dcd5=[];if(_0x44af1d){var _0x459bd9;for(var _0x361840=0x0,_0x3bb2f7;_0x361840<_0x44af1d[_0x91f7('0x19')];_0x361840+=0x1){_0x3bb2f7=_0x44af1d[_0x361840]['get']({'plain':!![]});switch(_0x3bb2f7[_0x91f7('0x4d')]){case'always':_0x22dcd5[_0x91f7('0x2a')](db['sequelize'][_0x91f7('0x50')](_0x14344b(_0x3bb2f7,_0x91f7('0x51')))[_0x91f7('0x29')](function(){})[_0x91f7('0x2c')](_0x23e640()));break;case _0x91f7('0x52'):_0x22dcd5['push'](db[_0x91f7('0x53')][_0x91f7('0x50')](_0x46888b(_0x3bb2f7,_0x91f7('0x51')))[_0x91f7('0x29')](function(){})[_0x91f7('0x2c')](_0x23e640()));break;default:_0x22dcd5[_0x91f7('0x2a')](db[_0x91f7('0x53')][_0x91f7('0x50')](_0x2d88ba(_0x3bb2f7,_0x91f7('0x51')))[_0x91f7('0x29')](function(){})['catch'](_0x23e640()));}}}return _0x22dcd5;})['all']()[_0x91f7('0x29')](function(){return db[_0x91f7('0x4a')][_0x91f7('0x4b')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x91f7('0x4e')],'as':_0x91f7('0x54'),'where':{'id':LISTID}}]})[_0x91f7('0x29')](function(_0x38e945){var _0x391c94=[];if(_0x38e945){var _0x43251e;for(var _0x13c669=0x0,_0x128e3e;_0x13c669<_0x38e945[_0x91f7('0x19')];_0x13c669+=0x1){_0x128e3e=_0x38e945[_0x13c669][_0x91f7('0x55')]({'plain':!![]});_0x391c94[_0x91f7('0x2a')](db[_0x91f7('0x53')][_0x91f7('0x50')](_0x2664b3(_0x128e3e,_0x91f7('0x51')))[_0x91f7('0x29')](function(){})[_0x91f7('0x2c')](_0x23e640()));}}return _0x391c94;})[_0x91f7('0x56')]();})[_0x91f7('0x29')](function(){return db[_0x91f7('0x57')][_0x91f7('0x4b')]({'attributes':['id',_0x91f7('0x4d')],'include':[{'model':db[_0x91f7('0x4e')],'as':_0x91f7('0x4f'),'where':{'id':LISTID}}]})[_0x91f7('0x29')](function(_0x2f6b81){var _0x13ba38=[];if(_0x2f6b81){for(var _0x4781ab=0x0,_0x442641;_0x4781ab<_0x2f6b81[_0x91f7('0x19')];_0x4781ab+=0x1){_0x442641=_0x2f6b81[_0x4781ab][_0x91f7('0x55')]({'plain':!![]});switch(_0x442641[_0x91f7('0x4d')]){case _0x91f7('0x58'):_0x13ba38['push'](db['sequelize']['query'](_0x14344b(_0x442641,_0x91f7('0x59')))['then'](function(){})[_0x91f7('0x2c')](_0x23e640()));break;case _0x91f7('0x52'):_0x13ba38[_0x91f7('0x2a')](db[_0x91f7('0x53')]['query'](_0x46888b(_0x442641,_0x91f7('0x59')))[_0x91f7('0x29')](function(){})[_0x91f7('0x2c')](_0x23e640()));break;default:_0x13ba38['push'](db[_0x91f7('0x53')]['query'](_0x2d88ba(_0x442641,_0x91f7('0x59')))[_0x91f7('0x29')](function(){})[_0x91f7('0x2c')](_0x23e640()));}}}return _0x13ba38;})[_0x91f7('0x56')]();})[_0x91f7('0x29')](function(){return db[_0x91f7('0x57')][_0x91f7('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x91f7('0x4e')],'as':_0x91f7('0x54'),'where':{'id':LISTID}}]})[_0x91f7('0x29')](function(_0x409555){var _0x21a7bb=[];if(_0x409555){for(var _0x470885=0x0,_0x101d98;_0x470885<_0x409555[_0x91f7('0x19')];_0x470885+=0x1){_0x101d98=_0x409555[_0x470885][_0x91f7('0x55')]({'plain':!![]});_0x21a7bb[_0x91f7('0x2a')](db[_0x91f7('0x53')]['query'](_0x2664b3(_0x101d98,_0x91f7('0x59')))[_0x91f7('0x29')](function(){})['catch'](_0x23e640()));}}return _0x21a7bb;})[_0x91f7('0x56')]();})[_0x91f7('0x2c')](function(_0xf4669){logger[_0x91f7('0x17')](_0x91f7('0x5a'),'generalCheckHopper',_0xf4669[_0x91f7('0x1b')]);});}var processPromises=function(_0x332b41){return BPromise[_0x91f7('0x56')](promises)[_0x91f7('0x29')](function(_0x93403c){})[_0x91f7('0x2c')](function(_0x559cc6){logger[_0x91f7('0x17')](_0x91f7('0x5b'),JSON[_0x91f7('0x5c')](_0x559cc6));})[_0x91f7('0x5d')](function(){socket[_0x91f7('0x5e')](_0x91f7('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x332b41){return _0x332b41[_0x91f7('0x60')]();}});};var endCsv=function(){return BPromise[_0x91f7('0x61')]()[_0x91f7('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x91f7('0x29')](function(){socket[_0x91f7('0x5e')](_0x91f7('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x91f7('0x62')](FILEPATH);}catch(_0x37924e){logger[_0x91f7('0x17')](_0x91f7('0x63'),JSON[_0x91f7('0x5c')](_0x37924e));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x91f7('0x64')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x91f7('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x91f7('0x65')][_0x91f7('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x91f7('0x29')](function(_0x25d9c2){var _0x3606b8=fs[_0x91f7('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x91f7('0x67')](_0x3606b8,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2edace,_0x43c8ad){total+=0x1;var _0x42aa4e=total;promises[_0x91f7('0x2a')](checkRow(_0x2edace,_0x25d9c2,_0x42aa4e)[_0x91f7('0x29')](function(){success+=0x1;})[_0x91f7('0x2c')](function(_0x33c2d8){if(_0x33c2d8[_0x91f7('0x17')]){errors+=0x1;delete _0x33c2d8[_0x91f7('0x17')];}else if(_0x33c2d8[_0x91f7('0x25')]){duplicates+=0x1;delete _0x33c2d8[_0x91f7('0x25')];}rows[_0x91f7('0x2a')](_0x33c2d8);}));if(total%0xc8===0x0){_0x43c8ad['pause']();return processPromises(_0x43c8ad);}},'complete':function(){return processPromises()['then'](function(){logger[_0x91f7('0x64')](_0x91f7('0x68'));endCsv();});},'error':function(_0x508610,_0x10e053){logger[_0x91f7('0x64')](_0x91f7('0x69'),JSON[_0x91f7('0x5c')](_0x508610));endCsv();}});})[_0x91f7('0x2c')](function(_0x3eff17){logger[_0x91f7('0x17')](_0x91f7('0x6a'),JSON[_0x91f7('0x5c')](_0x3eff17));});}main(); \ No newline at end of file +var _0x03d2=['CmList','Lists','dialCheckDuplicateType','always','push','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','emit','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','parse','duplicate','pause','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','Duplicate\x20Contact','create','then','pick','catch','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','select','field','toString','createdAt','NOW()','updatedAt','from','cm_contacts','where','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','ListId\x20=\x20?','calleridnum','cm_hopper_final','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','findAll','outbound'];(function(_0x3496f3,_0xd090ac){var _0x39178e=function(_0xe6535e){while(--_0xe6535e){_0x3496f3['push'](_0x3496f3['shift']());}};_0x39178e(++_0xd090ac);}(_0x03d2,0xf6));var _0x203d=function(_0x8bf8a6,_0x4e869d){_0x8bf8a6=_0x8bf8a6-0x0;var _0x59e910=_0x03d2[_0x8bf8a6];return _0x59e910;};'use strict';var BPromise=require(_0x203d('0x0'));var util=require(_0x203d('0x1'));var _=require(_0x203d('0x2'));var fs=require('fs');var squel=require(_0x203d('0x3'));var Papa=require(_0x203d('0x4'));var Redis=require(_0x203d('0x5'));var db=require(_0x203d('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x203d('0x7'))(_0x203d('0x8'));config[_0x203d('0x9')]=_['defaults'](config[_0x203d('0x9')],{'host':_0x203d('0xa'),'port':0x18eb});var socket=require(_0x203d('0xb'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x203d('0xc')][0x2]||process[_0x203d('0xc')][0x2]===_0x203d('0xd')||process['argv'][0x2]===_0x203d('0xe')){throw new Error(_0x203d('0xf'));}var FILEPATH=process[_0x203d('0xc')][0x2];if(!process[_0x203d('0xc')][0x3]||process[_0x203d('0xc')][0x3]===_0x203d('0xd')||process[_0x203d('0xc')][0x3]===_0x203d('0xe')||!process['argv'][0x4]||process[_0x203d('0xc')][0x4]===_0x203d('0xd')||process[_0x203d('0xc')][0x4]===_0x203d('0xe')){throw new Error(_0x203d('0x10'));}var FIELDS=_[_0x203d('0x11')](process[_0x203d('0xc')][0x3][_0x203d('0x12')](','),process[_0x203d('0xc')][0x4]['split'](','));if(!process[_0x203d('0xc')][0x5]||process['argv'][0x5]===_0x203d('0xd')||process[_0x203d('0xc')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x203d('0xc')][0x5];var COMPANYID=process[_0x203d('0xc')][0x6]&&process['argv'][0x6]!==_0x203d('0xd')&&process[_0x203d('0xc')][0x6]!==_0x203d('0xe')?process[_0x203d('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x203d('0xc')][0x7]!==_0x203d('0xd')&&process[_0x203d('0xc')][0x7]!=='null'?process[_0x203d('0xc')][0x7]:null;if(!process[_0x203d('0xc')][0x8]||process['argv'][0x8]===_0x203d('0xd')||process[_0x203d('0xc')][0x8]===_0x203d('0xe')){throw new Error(_0x203d('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x21bb08){logger[_0x203d('0x14')](_0x21bb08);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(_0x4e8b92,_0x1a5ecb,_0x17238f,_0x1cdbba){var _0x5797e9={'message':_0x1a5ecb};_0x5797e9[_0x4e8b92]=!![];if(_0x17238f){_0x5797e9[_0x203d('0x15')]=_0x17238f;}if(_0x1cdbba){_0x5797e9[_0x203d('0x16')]=_0x1cdbba;}return _0x5797e9;}function isEmail(_0x4a13c1){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))*$/[_0x203d('0x17')](_0x4a13c1);}function checkRow(_0x3f8c3d,_0x3e8b01,_0x96ab6e){return new BPromise(function(_0x46a3f8,_0xc0c886){if(_[_0x203d('0x18')](_0x3f8c3d)){return _0xc0c886(handleCheckRowError(_0x203d('0x14'),_0x203d('0x19'),null,_0x96ab6e));}if(_0x3f8c3d[_0x203d('0x1a')]&&_0x3f8c3d['errors'][_0x203d('0x1b')]){var _0xd21719=_[_0x203d('0x1c')](_0x3f8c3d[_0x203d('0x1a')],_0x203d('0x1d'))[_0x203d('0x1e')](';');return _0xc0c886(handleCheckRowError(_0x203d('0x14'),_0xd21719,null,_0x96ab6e));}var _0x518b2a={};for(var _0x366be3 in FIELDS){if(FIELDS[_0x203d('0x1f')](_0x366be3)&&FIELDS[_0x366be3]){_0x518b2a[_0x366be3]=_0x3f8c3d[_0x203d('0x20')][0x0][FIELDS[_0x366be3]]||_0x3f8c3d[_0x203d('0x20')][0x0]['\ufeff'+FIELDS[_0x366be3]];}}if(!_0x518b2a['firstName']){return _0xc0c886(handleCheckRowError(_0x203d('0x14'),_0x203d('0x21'),null,_0x96ab6e));}if(!_0x518b2a[_0x203d('0x22')]){return _0xc0c886(handleCheckRowError(_0x203d('0x14'),'phone\x20not\x20specified!',null,_0x96ab6e));}if(_0x518b2a[_0x203d('0x23')]){var _0x486b89=moment(_0x518b2a[_0x203d('0x23')],_0x203d('0x24'));if(!_0x486b89[_0x203d('0x25')]()){return _0xc0c886(handleCheckRowError(_0x203d('0x14'),_0x203d('0x26'),null,_0x96ab6e));}}if(_0x518b2a['email']){if(!isEmail(_0x518b2a[_0x203d('0x27')])){return _0xc0c886(handleCheckRowError(_0x203d('0x14'),'email\x20format\x20is\x20not\x20valid!',null,_0x96ab6e));}}_0x518b2a[_0x203d('0x28')]=LISTID;_0x518b2a[_0x203d('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x203d('0x1b')]&&_0x3e8b01){var _0x189674={};for(var _0x181681=0x0,_0x3bf31f=DUPLICATES['length'];_0x181681<_0x3bf31f;_0x181681+=0x1){_0x189674[DUPLICATES[_0x181681]]=_0x518b2a[DUPLICATES[_0x181681]];}var _0x22d79a=_[_0x203d('0x2a')](_0x3e8b01,_0x189674);if(_0x22d79a){return _0xc0c886(handleCheckRowError('duplicate',_0x203d('0x2b'),_0x22d79a,_0x96ab6e));}}return db['CmContact'][_0x203d('0x2c')](_0x518b2a,{'raw':!![],'hooks':![],'fields':_['keys'](_0x518b2a)})[_0x203d('0x2d')](function(_0xd37258){if(DUPLICATES&&DUPLICATES[_0x203d('0x1b')]&&_0x3e8b01){_0x3e8b01['push'](_[_0x203d('0x2e')](_0x518b2a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xd37258['id'];return _0x46a3f8();})[_0x203d('0x2f')](function(_0x471d34){return _0xc0c886(handleCheckRowError(_0x203d('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x471d34[_0x203d('0x1d')]||JSON[_0x203d('0x30')](_0x471d34)),null,_0x96ab6e));});});}function checkHopper(){function _0x19ff50(){return function(_0x45ea23){logger[_0x203d('0x14')](_0x203d('0x31'),'checkHopper',util[_0x203d('0x32')](_0x45ea23,{'showHidden':![],'depth':null}));};}var _0x2ffbf=function(_0x2dbaae,_0x4776a9){var _0xd91ab6=squel[_0x203d('0x33')]()[_0x203d('0x34')](_0x203d('0x35'))[_0x203d('0x36')](['phone',_0x203d('0x37'),'ContactId',_0x203d('0x28'),_0x4776a9,'createdAt','updatedAt'],squel[_0x203d('0x38')]()[_0x203d('0x39')](_0x203d('0x22'),_0x203d('0x22'))[_0x203d('0x39')]('NOW()',_0x203d('0x37'))[_0x203d('0x39')]('id','ContactId')[_0x203d('0x39')](LISTID[_0x203d('0x3a')](),_0x203d('0x28'))[_0x203d('0x39')](_0x2dbaae['id'][_0x203d('0x3a')](),_0x4776a9)[_0x203d('0x39')]('NOW()',_0x203d('0x3b'))[_0x203d('0x39')](_0x203d('0x3c'),_0x203d('0x3d'))[_0x203d('0x3e')](_0x203d('0x3f'))['where']('deletedAt\x20IS\x20NULL')[_0x203d('0x40')]('ListId\x20=\x20?',LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x203d('0x40')](_0x203d('0x41'),squel[_0x203d('0x38')]()['field'](_0x203d('0x22'))['from'](_0x203d('0x35'))[_0x203d('0x40')](_0x4776a9+_0x203d('0x42'),_0x2dbaae['id'][_0x203d('0x3a')]())))[_0x203d('0x3a')]();return _0xd91ab6;};var _0x5395ba=function(_0x1aa585,_0x38721f){var _0x260199=squel[_0x203d('0x33')]()['into']('cm_hopper')['fromQuery']([_0x203d('0x22'),_0x203d('0x37'),_0x203d('0x43'),'ListId',_0x38721f,'createdAt',_0x203d('0x3d')],squel['select']()['field'](_0x203d('0x22'),'phone')['field'](_0x203d('0x3c'),_0x203d('0x37'))[_0x203d('0x39')]('id',_0x203d('0x43'))[_0x203d('0x39')](LISTID['toString'](),_0x203d('0x28'))[_0x203d('0x39')](_0x1aa585['id'][_0x203d('0x3a')](),_0x38721f)[_0x203d('0x39')](_0x203d('0x3c'),'createdAt')[_0x203d('0x39')](_0x203d('0x3c'),'updatedAt')[_0x203d('0x3e')](_0x203d('0x3f'))['where']('deletedAt\x20IS\x20NULL')[_0x203d('0x40')](_0x203d('0x44'),LISTID[_0x203d('0x3a')]())[_0x203d('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x203d('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x203d('0x40')](_0x203d('0x41'),squel['select']()[_0x203d('0x39')](_0x203d('0x45'))[_0x203d('0x3e')](_0x203d('0x46'))['where'](_0x38721f+'\x20=\x20?',_0x1aa585['id'][_0x203d('0x3a')]()))['where'](_0x203d('0x41'),squel['select']()[_0x203d('0x39')](_0x203d('0x22'))[_0x203d('0x3e')](_0x203d('0x35'))[_0x203d('0x40')](_0x38721f+_0x203d('0x42'),_0x1aa585['id'][_0x203d('0x3a')]())))[_0x203d('0x3a')]();return _0x260199;};function _0x1446c5(_0x4f9906,_0x2985cb){var _0x3dc8a3=squel[_0x203d('0x33')]()[_0x203d('0x34')](_0x203d('0x35'))[_0x203d('0x36')]([_0x203d('0x22'),_0x203d('0x37'),_0x203d('0x43'),_0x203d('0x28'),_0x2985cb,_0x203d('0x3b'),_0x203d('0x3d')],squel[_0x203d('0x38')]()[_0x203d('0x39')]('phone',_0x203d('0x22'))[_0x203d('0x39')]('NOW()','scheduledAt')[_0x203d('0x39')]('id',_0x203d('0x43'))['field'](LISTID[_0x203d('0x3a')](),_0x203d('0x28'))['field'](_0x4f9906['id'][_0x203d('0x3a')](),_0x2985cb)[_0x203d('0x39')](_0x203d('0x3c'),'createdAt')[_0x203d('0x39')](_0x203d('0x3c'),_0x203d('0x3d'))[_0x203d('0x3e')](_0x203d('0x3f'))['where'](_0x203d('0x47'))[_0x203d('0x40')](_0x203d('0x44'),LISTID[_0x203d('0x3a')]())[_0x203d('0x40')](_0x203d('0x48'),squel[_0x203d('0x49')](hopperContacts))['where'](_0x203d('0x4a')))[_0x203d('0x3a')]();return _0x3dc8a3;}function _0x14d979(_0x2fb9e9,_0x6a3d3c){var _0x27bc4b=squel[_0x203d('0x33')]()[_0x203d('0x34')](_0x203d('0x4b'))[_0x203d('0x36')](['phone',_0x203d('0x43'),'ListId',_0x6a3d3c,_0x203d('0x3b'),_0x203d('0x3d')],squel[_0x203d('0x38')]()['field'](_0x203d('0x22'),'phone')[_0x203d('0x39')]('id',_0x203d('0x43'))[_0x203d('0x39')](LISTID[_0x203d('0x3a')](),_0x203d('0x28'))['field'](_0x2fb9e9['id'][_0x203d('0x3a')](),_0x6a3d3c)['field'](_0x203d('0x3c'),'createdAt')[_0x203d('0x39')](_0x203d('0x3c'),'updatedAt')[_0x203d('0x3e')](_0x203d('0x3f'))[_0x203d('0x40')](_0x203d('0x47'))[_0x203d('0x40')](_0x203d('0x44'),LISTID[_0x203d('0x3a')]())[_0x203d('0x40')](_0x203d('0x48'),squel['str'](hopperContacts))[_0x203d('0x40')](_0x203d('0x4a')))[_0x203d('0x3a')]();return _0x27bc4b;}return db['VoiceQueue'][_0x203d('0x4c')]({'where':{'type':_0x203d('0x4d')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x203d('0x4e')],'as':_0x203d('0x4f'),'where':{'id':LISTID}}]})[_0x203d('0x2d')](function(_0x556284){var _0x389443=[];if(_0x556284){var _0x368feb;for(var _0x5ebced=0x0,_0x502fc3;_0x5ebced<_0x556284['length'];_0x5ebced+=0x1){_0x502fc3=_0x556284[_0x5ebced]['get']({'plain':!![]});switch(_0x502fc3[_0x203d('0x50')]){case _0x203d('0x51'):_0x389443[_0x203d('0x52')](db[_0x203d('0x53')][_0x203d('0x54')](_0x5395ba(_0x502fc3,'VoiceQueueId'))[_0x203d('0x2d')](function(){})[_0x203d('0x2f')](_0x19ff50()));break;case'onlyIfOpen':_0x389443[_0x203d('0x52')](db[_0x203d('0x53')][_0x203d('0x54')](_0x2ffbf(_0x502fc3,'VoiceQueueId'))[_0x203d('0x2d')](function(){})['catch'](_0x19ff50()));break;default:_0x389443[_0x203d('0x52')](db[_0x203d('0x53')][_0x203d('0x54')](_0x1446c5(_0x502fc3,_0x203d('0x55')))['then'](function(){})['catch'](_0x19ff50()));}}}return _0x389443;})[_0x203d('0x56')]()[_0x203d('0x2d')](function(){return db[_0x203d('0x57')][_0x203d('0x4c')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x203d('0x4e')],'as':_0x203d('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x31351d){var _0x21cf4b=[];if(_0x31351d){var _0x4bd89d;for(var _0x6a6461=0x0,_0x47d5ed;_0x6a6461<_0x31351d[_0x203d('0x1b')];_0x6a6461+=0x1){_0x47d5ed=_0x31351d[_0x6a6461][_0x203d('0x59')]({'plain':!![]});_0x21cf4b[_0x203d('0x52')](db[_0x203d('0x53')][_0x203d('0x54')](_0x14d979(_0x47d5ed,_0x203d('0x55')))[_0x203d('0x2d')](function(){})[_0x203d('0x2f')](_0x19ff50()));}}return _0x21cf4b;})[_0x203d('0x56')]();})['then'](function(){return db[_0x203d('0x5a')]['findAll']({'attributes':['id',_0x203d('0x50')],'include':[{'model':db['CmList'],'as':_0x203d('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x4bd116){var _0x3e2216=[];if(_0x4bd116){for(var _0x47141a=0x0,_0x356b26;_0x47141a<_0x4bd116[_0x203d('0x1b')];_0x47141a+=0x1){_0x356b26=_0x4bd116[_0x47141a][_0x203d('0x59')]({'plain':!![]});switch(_0x356b26['dialCheckDuplicateType']){case _0x203d('0x51'):_0x3e2216['push'](db[_0x203d('0x53')][_0x203d('0x54')](_0x5395ba(_0x356b26,_0x203d('0x5b')))[_0x203d('0x2d')](function(){})[_0x203d('0x2f')](_0x19ff50()));break;case _0x203d('0x5c'):_0x3e2216[_0x203d('0x52')](db[_0x203d('0x53')]['query'](_0x2ffbf(_0x356b26,_0x203d('0x5b')))[_0x203d('0x2d')](function(){})['catch'](_0x19ff50()));break;default:_0x3e2216[_0x203d('0x52')](db[_0x203d('0x53')][_0x203d('0x54')](_0x1446c5(_0x356b26,'CampaignId'))[_0x203d('0x2d')](function(){})[_0x203d('0x2f')](_0x19ff50()));}}}return _0x3e2216;})[_0x203d('0x56')]();})[_0x203d('0x2d')](function(){return db[_0x203d('0x5a')][_0x203d('0x4c')]({'attributes':['id'],'include':[{'model':db[_0x203d('0x4e')],'as':_0x203d('0x58'),'where':{'id':LISTID}}]})[_0x203d('0x2d')](function(_0x28b496){var _0x53efd4=[];if(_0x28b496){for(var _0x100240=0x0,_0x1ff05f;_0x100240<_0x28b496[_0x203d('0x1b')];_0x100240+=0x1){_0x1ff05f=_0x28b496[_0x100240]['get']({'plain':!![]});_0x53efd4[_0x203d('0x52')](db['sequelize'][_0x203d('0x54')](_0x14d979(_0x1ff05f,_0x203d('0x5b')))['then'](function(){})[_0x203d('0x2f')](_0x19ff50()));}}return _0x53efd4;})[_0x203d('0x56')]();})[_0x203d('0x2f')](function(_0x128371){logger['error'](_0x203d('0x5d'),_0x203d('0x5e'),_0x128371[_0x203d('0x1d')]);});}var processPromises=function(_0x155390){return BPromise[_0x203d('0x56')](promises)['then'](function(_0x24dbed){})[_0x203d('0x2f')](function(_0x18ab7a){logger[_0x203d('0x14')](_0x203d('0x5f'),JSON[_0x203d('0x30')](_0x18ab7a));})[_0x203d('0x60')](function(){socket['emit'](_0x203d('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x155390){return _0x155390[_0x203d('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x203d('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x203d('0x2d')](function(){socket[_0x203d('0x63')](_0x203d('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0xc20de7){logger[_0x203d('0x14')](_0x203d('0x64'),JSON[_0x203d('0x30')](_0xc20de7));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x203d('0x65')](_0x203d('0x66'));endCsv();});function main(){return BPromise[_0x203d('0x67')]()[_0x203d('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x203d('0x12')](',');return db[_0x203d('0x68')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x203d('0x2d')](function(_0x31caf0){var _0x860ee5=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x203d('0x69')](_0x860ee5,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c7d39,_0x243d99){total+=0x1;var _0x2d7dcc=total;promises[_0x203d('0x52')](checkRow(_0x3c7d39,_0x31caf0,_0x2d7dcc)['then'](function(){success+=0x1;})['catch'](function(_0x5954d5){if(_0x5954d5[_0x203d('0x14')]){errors+=0x1;delete _0x5954d5[_0x203d('0x14')];}else if(_0x5954d5['duplicate']){duplicates+=0x1;delete _0x5954d5[_0x203d('0x6a')];}rows[_0x203d('0x52')](_0x5954d5);}));if(total%0xc8===0x0){_0x243d99[_0x203d('0x6b')]();return processPromises(_0x243d99);}},'complete':function(){return processPromises()['then'](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x3085c8,_0x4306f3){logger[_0x203d('0x65')]('CSV\x20parse\x20error',JSON[_0x203d('0x30')](_0x3085c8));endCsv();}});})[_0x203d('0x2f')](function(_0x5944e7){logger[_0x203d('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x203d('0x30')](_0x5944e7));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 3524f9d..e4b3ebe 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 _0xea76=['error','main','stringify','send','start','root','server/files/tmp','header','writeFileSync','parse','length','rows','errors','data','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','binding','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','.CmListId','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','cm_contacts.phone','cm_contacts.createdAt','cm_hopper_black','fromQuery','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','toString','concat','keys','CompanyId','insert','into',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','message','exit','code','info','sequelize','push','catch'];(function(_0x5d07c5,_0x538ba7){var _0x58434e=function(_0x3d4e1a){while(--_0x3d4e1a){_0x5d07c5['push'](_0x5d07c5['shift']());}};_0x58434e(++_0x538ba7);}(_0xea76,0x1e0));var _0x6ea7=function(_0xe42921,_0x4888e5){_0xe42921=_0xe42921-0x0;var _0x3d2336=_0xea76[_0xe42921];return _0x3d2336;};'use strict';var fs=require('fs');var path=require(_0x6ea7('0x0'));var _=require(_0x6ea7('0x1'));var Papa=require('papaparse');var util=require(_0x6ea7('0x2'));var BPromise=require(_0x6ea7('0x3'));var moment=require(_0x6ea7('0x4'));var squel=require(_0x6ea7('0x5'));var Redis=require(_0x6ea7('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x6ea7('0x7'));var logger=require(_0x6ea7('0x8'))(_0x6ea7('0x9'));config[_0x6ea7('0xa')]=_[_0x6ea7('0xb')](config[_0x6ea7('0xa')],{'host':_0x6ea7('0xc'),'port':0x18eb});var socket=require(_0x6ea7('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x6ea7('0xe')](_0x6ea7('0xf'));function isEmail(_0x595c18){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))*$/[_0x6ea7('0x10')](_0x595c18);}function selectNotIn(_0x45c9c1,_0x334d88,_0x46c93f,_0x586982,_0xfeeb17){return squel[_0x6ea7('0x11')]()[_0x6ea7('0x12')](_0x6ea7('0x13'))[_0x6ea7('0x14')](_0x586982)[_0x6ea7('0x15')](_0x334d88,null,_0x334d88+_0x6ea7('0x16')+_0x586982+'.'+_0x46c93f)['where'](_0x586982+'.'+_0x46c93f+_0x6ea7('0x17')+_0x45c9c1+'.'+_0x46c93f)[_0x6ea7('0x18')](_0x334d88+'.dialCheckDuplicateType\x20IN\x20('+_0xfeeb17['join']()+')');}function insertCmHopper(_0x44be12,_0x5a8386,_0x5dc946,_0x31e8c6,_0x59c2b4){var _0x74a784=['cm_contacts.phone',_0x6ea7('0x19'),_0x6ea7('0x1a'),_0x6ea7('0x1b'),_0x5a8386+'.'+_0x31e8c6,'cm_contacts.createdAt',_0x6ea7('0x1c'),_0x6ea7('0x1d'),_0x6ea7('0x1e'),'\x22'+_0x59c2b4+'\x22'];return squel['insert']()['into']('cm_hopper')['fromQuery']([_0x6ea7('0x13'),_0x6ea7('0x1f'),_0x6ea7('0x20'),_0x6ea7('0x21'),_0x31e8c6,_0x6ea7('0x22'),_0x6ea7('0x23'),_0x6ea7('0x24'),_0x6ea7('0x25'),_0x6ea7('0x26')],squel[_0x6ea7('0x11')]()[_0x6ea7('0x27')](_0x74a784)[_0x6ea7('0x14')](_0x5a8386)[_0x6ea7('0x15')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x5a8386+_0x6ea7('0x28'))[_0x6ea7('0x15')](_0x5dc946,null,_0x5dc946+_0x6ea7('0x16')+_0x5a8386+'.'+_0x31e8c6)['where'](_0x5a8386+'.CmListId\x20=\x20?',_0x44be12)[_0x6ea7('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6ea7('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5a8386,_0x5dc946,_0x31e8c6,'cm_hopper',['\x22always\x22',_0x6ea7('0x29')]))[_0x6ea7('0x18')](_0x6ea7('0x2a'),selectNotIn(_0x5a8386,_0x5dc946,_0x31e8c6,_0x6ea7('0x2b'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x1f3d0c,_0x2a8d10,_0xfcc375,_0x1b6358){var _0xa93559=[_0x6ea7('0x2c'),_0x6ea7('0x1a'),_0x6ea7('0x1b'),_0x2a8d10+'.'+_0x1b6358,_0x6ea7('0x2d'),_0x6ea7('0x1c')];return squel['insert']()['into'](_0x6ea7('0x2e'))[_0x6ea7('0x2f')]([_0x6ea7('0x13'),'ContactId',_0x6ea7('0x21'),_0x1b6358,_0x6ea7('0x22'),_0x6ea7('0x23')],squel[_0x6ea7('0x11')]()[_0x6ea7('0x27')](_0xa93559)[_0x6ea7('0x14')](_0x2a8d10)[_0x6ea7('0x15')](_0x6ea7('0x30'),null,_0x6ea7('0x31')+_0x2a8d10+_0x6ea7('0x28'))['join'](_0xfcc375,null,_0xfcc375+_0x6ea7('0x16')+_0x2a8d10+'.'+_0x1b6358)[_0x6ea7('0x18')](_0x2a8d10+_0x6ea7('0x32'),_0x1f3d0c)[_0x6ea7('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6ea7('0x18')](_0x6ea7('0x2a'),squel[_0x6ea7('0x11')]()[_0x6ea7('0x12')](_0x6ea7('0x13'))[_0x6ea7('0x14')](_0x6ea7('0x2e'))[_0x6ea7('0x18')](_0x6ea7('0x33'),_0x1f3d0c)[_0x6ea7('0x18')](_0x1b6358+_0x6ea7('0x34'),_0x2a8d10+'.'+_0x1b6358)))[_0x6ea7('0x35')]();}function insertCmContact(_0x927c2a,_0x12b5a7,_0x4b845d,_0x21ac96){var _0x4c5058=_[_0x6ea7('0x36')](_[_0x6ea7('0x37')](_0x21ac96),[_0x6ea7('0x21'),_0x6ea7('0x38'),'createdAt','updatedAt']);return squel[_0x6ea7('0x39')]()[_0x6ea7('0x3a')](_0x6ea7('0x30'))[_0x6ea7('0x2f')](_0x4c5058,squel['select']()[_0x6ea7('0x27')](_0x4c5058)[_0x6ea7('0x14')](_0x12b5a7)[_0x6ea7('0x18')]('('+_0x4b845d[_0x6ea7('0x15')](',')+_0x6ea7('0x3b'),squel['select']()['fields'](_0x4b845d)['from'](_0x6ea7('0x30'))['where'](_0x6ea7('0x33'),_0x927c2a))[_0x6ea7('0x18')](_0x6ea7('0x3c'),squel['select']()['field'](_0x6ea7('0x3d'),_0x6ea7('0x3e'))[_0x6ea7('0x14')](_0x12b5a7)[_0x6ea7('0x3f')](_0x4b845d[_0x6ea7('0x15')](','))))[_0x6ea7('0x35')]();}function handleStop(){logger['info'](_0x6ea7('0x40'));stopped=!![];}function handleUncaughtException(_0x3c0c74){logger['error'](_0x3c0c74[_0x6ea7('0x41')]);process[_0x6ea7('0x42')](0x1);}function handleError(_0x50b573,_0x3b5adb){stats['errors']['push']({'name':_0x3b5adb[_0x6ea7('0x43')],'message':_0x3b5adb[_0x6ea7('0x41')],'row':_0x50b573});}function handleQuery(_0x215295){logger[_0x6ea7('0x44')](_0x215295);return db[_0x6ea7('0x45')]['query'](_0x215295)['spread'](function(_0x5292ed){results[_0x6ea7('0x46')](_0x5292ed);})[_0x6ea7('0x47')](function(_0x56fd91){logger[_0x6ea7('0x48')](_0x56fd91[_0x6ea7('0x41')]);});}function main(_0xccb867,_0x25e4e5,_0x541976,_0x2423e9){logger[_0x6ea7('0x44')](_0x6ea7('0x49'),_0xccb867,JSON[_0x6ea7('0x4a')](_0x25e4e5));process[_0x6ea7('0x4b')](_0x6ea7('0x4c'));var _0x2b7700=_0x25e4e5['binding'];var _0xb9ca6a=_0x25e4e5['socket_timestamp'];var _0x596eca=path[_0x6ea7('0x15')](config[_0x6ea7('0x4d')],_0x6ea7('0x4e'),_0xb9ca6a+'.csv');var _0x1fa6d2=_['keys'](_0x2b7700)[_0x6ea7('0x15')]();logger[_0x6ea7('0x44')](_0x6ea7('0x4f'),_0x1fa6d2);fs[_0x6ea7('0x50')](_0x596eca,_0x1fa6d2+'\x0a');Papa[_0x6ea7('0x51')](fs['createReadStream'](_0xccb867),{'header':!![],'skipEmptyLines':!![],'step':function(_0x205977,_0x5ba587){try{for(var _0x28013c=0x0,_0x230dd5=[];_0x28013c<_0x205977['data'][_0x6ea7('0x52')];_0x28013c++){stats[_0x6ea7('0x53')]+=0x1;if(_0x205977[_0x6ea7('0x54')][_0x28013c]){handleError(_0x205977[_0x6ea7('0x55')][_0x28013c],_0x205977[_0x6ea7('0x54')][_0x28013c]);}else{var _0x38b4e6=[];for(var _0x4b126b in _0x2b7700){if(_0x2b7700['hasOwnProperty'](_0x4b126b)){if(_0x205977[_0x6ea7('0x55')][_0x28013c][_0x2b7700[_0x4b126b]]){var _0x915665=_[_0x6ea7('0x56')](_0x205977[_0x6ea7('0x55')][_0x28013c][_0x2b7700[_0x4b126b]][_0x6ea7('0x57')](/"/g,'\x27'));switch(_0x4b126b){case _0x6ea7('0x1f'):var _0x4e63a9=moment(_0x915665,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4e63a9[_0x6ea7('0x58')]()){_0x230dd5[_0x6ea7('0x46')]('\x22'+_0x915665+'\x22');}else{_0x38b4e6['push'](_0x6ea7('0x59'));}break;case _0x6ea7('0x24'):var _0xefae76=parseInt(_0x915665);_0x915665=_[_0x6ea7('0x5a')](_0xefae76)||_0xefae76<0x0||_0xefae76>0x4?_0x2423e9?0x3:0x2:_0xefae76;_0x230dd5[_0x6ea7('0x46')]('\x22'+_0x915665+'\x22');break;case _0x6ea7('0x25'):var _0x4a9a7a=parseInt(_0x915665);if(_[_0x6ea7('0x5b')](_0x4a9a7a)&&_['includes'](_0x541976,_0x4a9a7a)){_0x230dd5['push']('\x22'+_0x4a9a7a+'\x22');}else{_0x38b4e6[_0x6ea7('0x46')](_0x6ea7('0x5c'));}break;case _0x6ea7('0x5d'):if(isEmail(_0x915665)){_0x230dd5['push']('\x22'+_0x915665+'\x22');}else{_0x38b4e6['push'](_0x6ea7('0x5e'));}break;case _0x6ea7('0x5f'):var _0x6d0882=moment(_0x915665,_0x6ea7('0x60'),!![]);if(_0x6d0882[_0x6ea7('0x58')]()){_0x230dd5[_0x6ea7('0x46')]('\x22'+_0x915665+'\x22');}else{_0x38b4e6[_0x6ea7('0x46')](_0x6ea7('0x61'));}break;default:_0x230dd5[_0x6ea7('0x46')]('\x22'+_0x915665+'\x22');}}else{switch(_0x4b126b){case _0x6ea7('0x62'):case _0x6ea7('0x13'):_0x38b4e6['push'](_0x4b126b+'\x20not\x20specified');break;default:_0x230dd5[_0x6ea7('0x46')]('\x22\x22');}}}}if(_0x38b4e6[_0x6ea7('0x52')]){handleError(_0x205977[_0x6ea7('0x55')][_0x28013c],{'code':_0x6ea7('0x63'),'message':_0x38b4e6[_0x6ea7('0x15')]()});}else{fs[_0x6ea7('0x64')](_0x596eca,_0x230dd5[_0x6ea7('0x15')]()+'\x0a');}_0x230dd5=[];}if(!(stats['rows']%0xc8)){socket[_0x6ea7('0x65')]('contact:import:'+_0xb9ca6a,stats);stats[_0x6ea7('0x54')]=[];}}if(stopped){logger[_0x6ea7('0x44')](_0x6ea7('0x66'));_0x5ba587[_0x6ea7('0x67')]();}}catch(_0x493252){handleError(_0x205977[_0x6ea7('0x55')][_0x28013c],{'code':_0x6ea7('0x68'),'message':_0x493252[_0x6ea7('0x41')]});logger[_0x6ea7('0x48')](_0x6ea7('0x69'),_0x493252[_0x6ea7('0x41')]);}},'complete':function(){try{var _0x2ac951=[];var _0x2e8973=_0x6ea7('0x30');if(_0x25e4e5['duplicates']&&_0x25e4e5[_0x6ea7('0x6a')][_0x6ea7('0x52')]){_0x2e8973=_0x6ea7('0x6b')+_0xb9ca6a;_0x2ac951[_0x6ea7('0x46')](_0x6ea7('0x6c')+_0x2e8973+_0x6ea7('0x6d'));}var _0x3104bd=util[_0x6ea7('0xe')](_0x6ea7('0x6e'),_0x596eca,_0x2e8973,_0x1fa6d2,_0x25e4e5[_0x6ea7('0x21')],_0x25e4e5[_0x6ea7('0x38')]||null,NOW,NOW);if(_[_0x6ea7('0x6f')](_0x2b7700[_0x6ea7('0x1f')])){_0x3104bd+=',\x20scheduledAt\x20=\x20NOW()';}_0x2ac951[_0x6ea7('0x46')](_0x3104bd);if(_0x25e4e5[_0x6ea7('0x6a')]&&_0x25e4e5[_0x6ea7('0x6a')][_0x6ea7('0x52')]){_0x2ac951['push'](insertCmContact(_0x25e4e5[_0x6ea7('0x21')],_0x2e8973,_0x25e4e5[_0x6ea7('0x6a')],_0x2b7700));_0x2ac951[_0x6ea7('0x46')](_0x6ea7('0x70')+_0x2e8973+';');}_0x2ac951[_0x6ea7('0x46')](insertCmHopper(_0x25e4e5['ListId'],_0x6ea7('0x71'),_0x6ea7('0x72'),_0x6ea7('0x73'),_0x2423e9));_0x2ac951[_0x6ea7('0x46')](insertCmHopperBlack(_0x25e4e5['ListId'],_0x6ea7('0x74'),'voice_queues',_0x6ea7('0x73')));_0x2ac951['push'](insertCmHopper(_0x25e4e5[_0x6ea7('0x21')],'campaigns_has_cm_lists',_0x6ea7('0x75'),_0x6ea7('0x76'),_0x2423e9));_0x2ac951[_0x6ea7('0x46')](insertCmHopperBlack(_0x25e4e5['ListId'],_0x6ea7('0x77'),_0x6ea7('0x75'),_0x6ea7('0x76')));BPromise['each'](_0x2ac951,handleQuery)[_0x6ea7('0x78')](function(_0x412773){stats[_0x6ea7('0x79')]=!![];stats[_0x6ea7('0x7a')]=_0x25e4e5[_0x6ea7('0x6a')]&&_0x25e4e5[_0x6ea7('0x6a')][_0x6ea7('0x52')]?results[0x2][_0x6ea7('0x7a')]:results[0x0][_0x6ea7('0x7a')];socket[_0x6ea7('0x65')](_0x6ea7('0x7b')+_0xb9ca6a,stats);fs[_0x6ea7('0x7c')](_0xccb867);fs[_0x6ea7('0x7c')](_0x596eca);process['exit'](0x0);})[_0x6ea7('0x47')](function(_0x480b1a){logger['error'](_0x480b1a[_0x6ea7('0x41')]);process[_0x6ea7('0x42')](0x1);});}catch(_0xfba01a){logger[_0x6ea7('0x48')](_0x6ea7('0x7d'),_0xfba01a[_0x6ea7('0x41')]);process['exit'](0x1);}},'error':function(_0x40ce4e,_0x3657ec,_0x2bba82,_0x305921){throw new Error(_0x305921);}});}function validate(){if(process['argv']&&process[_0x6ea7('0x7e')][_0x6ea7('0x52')]<0x4){throw new Error(_0x6ea7('0x7f'));}var _0x1f00b1=path[_0x6ea7('0x15')](config['root'],_0x6ea7('0x4e'),process['argv'][0x2]);if(!fs[_0x6ea7('0x80')](_0x1f00b1)){throw new Error(_0x6ea7('0x81'));}var _0x4a9a93={};try{_0x4a9a93=JSON[_0x6ea7('0x51')](process[_0x6ea7('0x7e')][0x3]);if(!_0x4a9a93['binding']){throw new Error(_0x6ea7('0x82'));}if(!_0x4a9a93['binding'][_0x6ea7('0x13')]){throw new Error(_0x6ea7('0x83'));}if(!_0x4a9a93[_0x6ea7('0x84')][_0x6ea7('0x62')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5c9e73=0x0;if(_0x4a9a93[_0x6ea7('0x84')][_0x6ea7('0x25')]){_0x5c9e73=0x1;}if(!_0x4a9a93[_0x6ea7('0x21')]){throw new Error(_0x6ea7('0x85'));}}catch(_0x481f1b){throw new Error(_0x6ea7('0x86'));}var _0x1aac93=[];try{_0x1aac93=_[_0x6ea7('0x87')](JSON[_0x6ea7('0x51')](process[_0x6ea7('0x7e')][0x4]),'id');}catch(_0x524076){logger['info'](_0x6ea7('0x88'));}main(_0x1f00b1,_0x4a9a93,_0x1aac93,_0x5c9e73);}validate();process['on'](_0x6ea7('0x89'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xef0d=['cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.ListId','cm_contacts.updatedAt','cm_hopper_black','updatedAt','fields','.CmListId','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','insert',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','code','query','spread','push','send','start','socket_timestamp','root','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','errors','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','firstName','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','unlink','catch','error','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','priority','UserId','from','cm_contacts','cm_contacts.ListId\x20=\x20'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xef0d,0x1e6));var _0xdef0=function(_0x53a57e,_0x80afd6){_0x53a57e=_0x53a57e-0x0;var _0x5ab05c=_0xef0d[_0x53a57e];return _0x5ab05c;};'use strict';var fs=require('fs');var path=require(_0xdef0('0x0'));var _=require('lodash');var Papa=require(_0xdef0('0x1'));var util=require('util');var BPromise=require(_0xdef0('0x2'));var moment=require(_0xdef0('0x3'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0xdef0('0x4'))['db'];var config=require(_0xdef0('0x5'));var logger=require(_0xdef0('0x6'))(_0xdef0('0x7'));config[_0xdef0('0x8')]=_['defaults'](config[_0xdef0('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xdef0('0x9'))(new Redis(config[_0xdef0('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xdef0('0xa')](_0xdef0('0xb'));function isEmail(_0x170fa4){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'](_0x170fa4);}function selectNotIn(_0x5874f3,_0x221e64,_0x5087af,_0x3affc5,_0x33471d){return squel[_0xdef0('0xc')]()[_0xdef0('0xd')](_0xdef0('0xe'))['from'](_0x3affc5)[_0xdef0('0xf')](_0x221e64,null,_0x221e64+_0xdef0('0x10')+_0x3affc5+'.'+_0x5087af)[_0xdef0('0x11')](_0x3affc5+'.'+_0x5087af+_0xdef0('0x12')+_0x5874f3+'.'+_0x5087af)[_0xdef0('0x11')](_0x221e64+_0xdef0('0x13')+_0x33471d[_0xdef0('0xf')]()+')');}function insertCmHopper(_0x1fb7ea,_0xa3a638,_0x385a92,_0x524283,_0x29e054){var _0x1b4c23=['cm_contacts.phone',_0xdef0('0x14'),_0xdef0('0x15'),'cm_contacts.ListId',_0xa3a638+'.'+_0x524283,_0xdef0('0x16'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x29e054+'\x22'];return squel['insert']()[_0xdef0('0x17')](_0xdef0('0x18'))[_0xdef0('0x19')](['phone','scheduledat',_0xdef0('0x1a'),_0xdef0('0x1b'),_0x524283,_0xdef0('0x1c'),'updatedAt',_0xdef0('0x1d'),_0xdef0('0x1e'),'recallme'],squel['select']()['fields'](_0x1b4c23)[_0xdef0('0x1f')](_0xa3a638)[_0xdef0('0xf')](_0xdef0('0x20'),null,_0xdef0('0x21')+_0xa3a638+'.CmListId')[_0xdef0('0xf')](_0x385a92,null,_0x385a92+'.id\x20=\x20'+_0xa3a638+'.'+_0x524283)[_0xdef0('0x11')](_0xa3a638+'.CmListId\x20=\x20?',_0x1fb7ea)[_0xdef0('0x11')](_0xdef0('0x22'),NOW)[_0xdef0('0x11')](_0xdef0('0x23'),selectNotIn(_0xa3a638,_0x385a92,_0x524283,_0xdef0('0x18'),[_0xdef0('0x24'),_0xdef0('0x25')]))[_0xdef0('0x11')](_0xdef0('0x23'),selectNotIn(_0xa3a638,_0x385a92,_0x524283,_0xdef0('0x18'),['\x22always\x22'])))[_0xdef0('0x26')]();}function insertCmHopperBlack(_0x14206a,_0x5644f1,_0x3ca26f,_0x4e7a51){var _0x5c064e=[_0xdef0('0x27'),_0xdef0('0x15'),_0xdef0('0x28'),_0x5644f1+'.'+_0x4e7a51,_0xdef0('0x16'),_0xdef0('0x29')];return squel['insert']()[_0xdef0('0x17')](_0xdef0('0x2a'))['fromQuery']([_0xdef0('0xe'),_0xdef0('0x1a'),'ListId',_0x4e7a51,_0xdef0('0x1c'),_0xdef0('0x2b')],squel[_0xdef0('0xc')]()[_0xdef0('0x2c')](_0x5c064e)[_0xdef0('0x1f')](_0x5644f1)[_0xdef0('0xf')](_0xdef0('0x20'),null,_0xdef0('0x21')+_0x5644f1+_0xdef0('0x2d'))[_0xdef0('0xf')](_0x3ca26f,null,_0x3ca26f+_0xdef0('0x10')+_0x5644f1+'.'+_0x4e7a51)['where'](_0x5644f1+'.CmListId\x20=\x20?',_0x14206a)[_0xdef0('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xdef0('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xdef0('0xd')](_0xdef0('0xe'))[_0xdef0('0x1f')](_0xdef0('0x2a'))['where'](_0xdef0('0x2e'),_0x14206a)[_0xdef0('0x11')](_0x4e7a51+_0xdef0('0x2f'),_0x5644f1+'.'+_0x4e7a51)))[_0xdef0('0x26')]();}function insertCmContact(_0x28565f,_0x196705,_0x5f004e,_0x492eda){var _0x23b502=_[_0xdef0('0x30')](_[_0xdef0('0x31')](_0x492eda),[_0xdef0('0x1b'),_0xdef0('0x32'),_0xdef0('0x1c'),_0xdef0('0x2b')]);return squel[_0xdef0('0x33')]()['into']('cm_contacts')[_0xdef0('0x19')](_0x23b502,squel[_0xdef0('0xc')]()[_0xdef0('0x2c')](_0x23b502)[_0xdef0('0x1f')](_0x196705)[_0xdef0('0x11')]('('+_0x5f004e['join'](',')+_0xdef0('0x34'),squel[_0xdef0('0xc')]()['fields'](_0x5f004e)[_0xdef0('0x1f')]('cm_contacts')['where'](_0xdef0('0x2e'),_0x28565f))[_0xdef0('0x11')](_0xdef0('0x35'),squel[_0xdef0('0xc')]()['field'](_0xdef0('0x36'),_0xdef0('0x37'))[_0xdef0('0x1f')](_0x196705)[_0xdef0('0x38')](_0x5f004e[_0xdef0('0xf')](','))))[_0xdef0('0x26')]();}function handleStop(){logger[_0xdef0('0x39')](_0xdef0('0x3a'));stopped=!![];}function handleUncaughtException(_0x2c69fb){logger['error'](_0x2c69fb[_0xdef0('0x3b')]);process[_0xdef0('0x3c')](0x1);}function handleError(_0x42c6f9,_0x7cf87c){stats['errors']['push']({'name':_0x7cf87c[_0xdef0('0x3d')],'message':_0x7cf87c[_0xdef0('0x3b')],'row':_0x42c6f9});}function handleQuery(_0x1078c9){logger[_0xdef0('0x39')](_0x1078c9);return db['sequelize'][_0xdef0('0x3e')](_0x1078c9)[_0xdef0('0x3f')](function(_0x465924){results[_0xdef0('0x40')](_0x465924);})['catch'](function(_0x4d38a1){logger['error'](_0x4d38a1['message']);});}function main(_0x582306,_0x3f62a8,_0x3a99f3,_0x50f1ae){logger[_0xdef0('0x39')]('main',_0x582306,JSON['stringify'](_0x3f62a8));process[_0xdef0('0x41')](_0xdef0('0x42'));var _0x1f01f5=_0x3f62a8['binding'];var _0xfe7242=_0x3f62a8[_0xdef0('0x43')];var _0x3cbf13=path[_0xdef0('0xf')](config[_0xdef0('0x44')],'server/files/tmp',_0xfe7242+_0xdef0('0x45'));var _0x216ee4=_[_0xdef0('0x31')](_0x1f01f5)['join']();logger[_0xdef0('0x39')](_0xdef0('0x46'),_0x216ee4);fs[_0xdef0('0x47')](_0x3cbf13,_0x216ee4+'\x0a');Papa[_0xdef0('0x48')](fs[_0xdef0('0x49')](_0x582306),{'header':!![],'skipEmptyLines':!![],'step':function(_0x29e9fd,_0x36133e){try{for(var _0x1240ce=0x0,_0x55e1fa=[];_0x1240ce<_0x29e9fd[_0xdef0('0x4a')][_0xdef0('0x4b')];_0x1240ce++){stats[_0xdef0('0x4c')]+=0x1;if(_0x29e9fd[_0xdef0('0x4d')][_0x1240ce]){handleError(_0x29e9fd[_0xdef0('0x4a')][_0x1240ce],_0x29e9fd[_0xdef0('0x4d')][_0x1240ce]);}else{var _0x4a214b=[];for(var _0x17f92c in _0x1f01f5){if(_0x1f01f5['hasOwnProperty'](_0x17f92c)){if(_0x29e9fd['data'][_0x1240ce][_0x1f01f5[_0x17f92c]]){var _0x5a25db=_['trim'](_0x29e9fd['data'][_0x1240ce][_0x1f01f5[_0x17f92c]][_0xdef0('0x4e')](/"/g,'\x27'));switch(_0x17f92c){case _0xdef0('0x4f'):var _0x2ed124=moment(_0x5a25db,_0xdef0('0xb'),!![]);if(_0x2ed124[_0xdef0('0x50')]()){_0x55e1fa[_0xdef0('0x40')]('\x22'+_0x5a25db+'\x22');}else{_0x4a214b[_0xdef0('0x40')](_0xdef0('0x51'));}break;case _0xdef0('0x1d'):var _0x50a98f=parseInt(_0x5a25db);_0x5a25db=_[_0xdef0('0x52')](_0x50a98f)||_0x50a98f<0x0||_0x50a98f>0x4?_0x50f1ae?0x3:0x2:_0x50a98f;_0x55e1fa['push']('\x22'+_0x5a25db+'\x22');break;case'UserId':var _0x3130b9=parseInt(_0x5a25db);if(_[_0xdef0('0x53')](_0x3130b9)&&_[_0xdef0('0x54')](_0x3a99f3,_0x3130b9)){_0x55e1fa[_0xdef0('0x40')]('\x22'+_0x3130b9+'\x22');}else{_0x4a214b[_0xdef0('0x40')](_0xdef0('0x55'));}break;case _0xdef0('0x56'):if(isEmail(_0x5a25db)){_0x55e1fa['push']('\x22'+_0x5a25db+'\x22');}else{_0x4a214b[_0xdef0('0x40')]('email\x20wrong\x20format');}break;case _0xdef0('0x57'):var _0x5aed94=moment(_0x5a25db,_0xdef0('0x58'),!![]);if(_0x5aed94[_0xdef0('0x50')]()){_0x55e1fa[_0xdef0('0x40')]('\x22'+_0x5a25db+'\x22');}else{_0x4a214b[_0xdef0('0x40')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x55e1fa[_0xdef0('0x40')]('\x22'+_0x5a25db+'\x22');}}else{switch(_0x17f92c){case _0xdef0('0x59'):case'phone':_0x4a214b[_0xdef0('0x40')](_0x17f92c+'\x20not\x20specified');break;default:_0x55e1fa[_0xdef0('0x40')]('\x22\x22');}}}}if(_0x4a214b[_0xdef0('0x4b')]){handleError(_0x29e9fd['data'][_0x1240ce],{'code':_0xdef0('0x5a'),'message':_0x4a214b[_0xdef0('0xf')]()});}else{fs['appendFileSync'](_0x3cbf13,_0x55e1fa[_0xdef0('0xf')]()+'\x0a');}_0x55e1fa=[];}if(!(stats['rows']%0xc8)){socket[_0xdef0('0x5b')](_0xdef0('0x5c')+_0xfe7242,stats);stats['errors']=[];}}if(stopped){logger['info'](_0xdef0('0x5d'));_0x36133e[_0xdef0('0x5e')]();}}catch(_0x58dc1f){handleError(_0x29e9fd[_0xdef0('0x4a')][_0x1240ce],{'code':_0xdef0('0x5f'),'message':_0x58dc1f[_0xdef0('0x3b')]});logger['error'](_0xdef0('0x60'),_0x58dc1f['message']);}},'complete':function(){try{var _0x165492=[];var _0x4f7eec=_0xdef0('0x20');if(_0x3f62a8[_0xdef0('0x61')]&&_0x3f62a8[_0xdef0('0x61')][_0xdef0('0x4b')]){_0x4f7eec=_0xdef0('0x62')+_0xfe7242;_0x165492['push'](_0xdef0('0x63')+_0x4f7eec+_0xdef0('0x64'));}var _0x4d2ae5=util[_0xdef0('0xa')](_0xdef0('0x65'),_0x3cbf13,_0x4f7eec,_0x216ee4,_0x3f62a8[_0xdef0('0x1b')],_0x3f62a8[_0xdef0('0x32')]||null,NOW,NOW);if(_[_0xdef0('0x66')](_0x1f01f5['scheduledat'])){_0x4d2ae5+=_0xdef0('0x67');}_0x165492[_0xdef0('0x40')](_0x4d2ae5);if(_0x3f62a8[_0xdef0('0x61')]&&_0x3f62a8[_0xdef0('0x61')]['length']){_0x165492[_0xdef0('0x40')](insertCmContact(_0x3f62a8[_0xdef0('0x1b')],_0x4f7eec,_0x3f62a8[_0xdef0('0x61')],_0x1f01f5));_0x165492[_0xdef0('0x40')](_0xdef0('0x68')+_0x4f7eec+';');}_0x165492[_0xdef0('0x40')](insertCmHopper(_0x3f62a8[_0xdef0('0x1b')],_0xdef0('0x69'),_0xdef0('0x6a'),_0xdef0('0x6b'),_0x50f1ae));_0x165492['push'](insertCmHopperBlack(_0x3f62a8[_0xdef0('0x1b')],'voice_queues_has_cm_blacklists',_0xdef0('0x6a'),_0xdef0('0x6b')));_0x165492[_0xdef0('0x40')](insertCmHopper(_0x3f62a8[_0xdef0('0x1b')],'campaigns_has_cm_lists','campaigns',_0xdef0('0x6c'),_0x50f1ae));_0x165492[_0xdef0('0x40')](insertCmHopperBlack(_0x3f62a8[_0xdef0('0x1b')],_0xdef0('0x6d'),'campaigns','CampaignId'));BPromise['each'](_0x165492,handleQuery)[_0xdef0('0x6e')](function(_0x2bbd90){stats[_0xdef0('0x6f')]=!![];stats['affectedRows']=_0x3f62a8[_0xdef0('0x61')]&&_0x3f62a8[_0xdef0('0x61')]['length']?results[0x2]['affectedRows']:results[0x0][_0xdef0('0x70')];socket[_0xdef0('0x5b')]('contact:import:'+_0xfe7242,stats);fs[_0xdef0('0x71')](_0x582306);fs[_0xdef0('0x71')](_0x3cbf13);process[_0xdef0('0x3c')](0x0);})[_0xdef0('0x72')](function(_0x4827aa){logger['error'](_0x4827aa[_0xdef0('0x3b')]);process[_0xdef0('0x3c')](0x1);});}catch(_0x49c66a){logger[_0xdef0('0x73')]('complete',_0x49c66a['message']);process['exit'](0x1);}},'error':function(_0x1f3780,_0x215d6f,_0xf05457,_0x4efaa4){throw new Error(_0x4efaa4);}});}function validate(){if(process[_0xdef0('0x74')]&&process[_0xdef0('0x74')][_0xdef0('0x4b')]<0x4){throw new Error(_0xdef0('0x75'));}var _0x32c393=path[_0xdef0('0xf')](config['root'],'server/files/tmp',process[_0xdef0('0x74')][0x2]);if(!fs[_0xdef0('0x76')](_0x32c393)){throw new Error(_0xdef0('0x77'));}var _0x1d0c28={};try{_0x1d0c28=JSON[_0xdef0('0x48')](process[_0xdef0('0x74')][0x3]);if(!_0x1d0c28[_0xdef0('0x78')]){throw new Error(_0xdef0('0x79'));}if(!_0x1d0c28[_0xdef0('0x78')][_0xdef0('0xe')]){throw new Error(_0xdef0('0x7a'));}if(!_0x1d0c28[_0xdef0('0x78')][_0xdef0('0x59')]){throw new Error(_0xdef0('0x7b'));}var _0x24ae54=0x0;if(_0x1d0c28[_0xdef0('0x78')][_0xdef0('0x1e')]){_0x24ae54=0x1;}if(!_0x1d0c28['ListId']){throw new Error(_0xdef0('0x7c'));}}catch(_0x4ec4cc){throw new Error(_0xdef0('0x7d'));}var _0x368922=[];try{_0x368922=_[_0xdef0('0x7e')](JSON[_0xdef0('0x48')](process[_0xdef0('0x74')][0x4]),'id');}catch(_0x61bbeb){logger['info'](_0xdef0('0x7f'));}main(_0x32c393,_0x1d0c28,_0x368922,_0x24ae54);}validate();process['on'](_0xdef0('0x80'),handleStop);process['on'](_0xdef0('0x81'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 82f1829..1b988bd 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 _0xb10b=['Complete\x20Time','Duration','duration','Billable\x20Time','getSubjects','string','toLowerCase','voice','inbound','push','variable','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','calleridname','Call\x20To','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Answer\x20Time'];(function(_0x21301e,_0x4fdfa4){var _0xf1c284=function(_0x256d86){while(--_0x256d86){_0x21301e['push'](_0x21301e['shift']());}};_0xf1c284(++_0x4fdfa4);}(_0xb10b,0x12a));var _0xbb10=function(_0x101383,_0x5bd543){_0x101383=_0x101383-0x0;var _0x46cfe9=_0xb10b[_0x101383];return _0x46cfe9;};'use strict';exports[_0xbb10('0x0')]=function(_0x4bb7bb,_0x390ae2){var _0x35bc5f=[{'type':_0xbb10('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x4bb7bb[_0xbb10('0x2')]()){case _0xbb10('0x3'):switch(_0x390ae2[_0xbb10('0x2')]()){case _0xbb10('0x4'):_0x35bc5f[_0xbb10('0x5')]({'type':_0xbb10('0x6'),'content':'','variableName':'queue'});_0x35bc5f[_0xbb10('0x5')]({'type':_0xbb10('0x6'),'content':'','variableName':'calleridnum'});break;case _0xbb10('0x7'):_0x35bc5f[_0xbb10('0x5')]({'type':_0xbb10('0x1'),'content':_0xbb10('0x8'),'variableName':null});_0x35bc5f[_0xbb10('0x5')]({'type':_0xbb10('0x6'),'content':'','variableName':_0xbb10('0x9')});break;}}return _0x35bc5f;};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){var _0x20bd61=[];switch(_0x5ab04a[_0xbb10('0x2')]()){case _0xbb10('0x3'):switch(_0x4e47f8['toLowerCase']()){case _0xbb10('0x4'):_0x20bd61=[{'type':'string','content':_0xbb10('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0xd'),'keyType':_0xbb10('0x6'),'variableName':_0xbb10('0xe')},{'type':_0xbb10('0xc'),'content':'','key':'Caller\x20Name','keyType':_0xbb10('0x6'),'variableName':_0xbb10('0xf')},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x10'),'keyType':_0xbb10('0x6'),'variableName':_0xbb10('0x11')},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x12'),'keyType':_0xbb10('0x6'),'variableName':_0xbb10('0x13')},{'type':'keyValue','content':'','key':_0xbb10('0x14'),'keyType':_0xbb10('0x6'),'variableName':_0xbb10('0x15')},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x16'),'keyType':_0xbb10('0x6'),'variableName':_0xbb10('0x17')},{'type':_0xbb10('0x1'),'content':_0xbb10('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xbb10('0xc'),'content':'','key':'Agent\x20Name','keyType':_0xbb10('0x6'),'variableName':_0xbb10('0x19')},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x1a'),'keyType':_0xbb10('0x6'),'variableName':_0xbb10('0x9')},{'type':'string','content':_0xbb10('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0xbb10('0xc'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0xbb10('0x17')},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x1c'),'keyType':_0xbb10('0x6'),'variableName':_0xbb10('0x1d')},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x1e'),'keyType':_0xbb10('0x6'),'variableName':_0xbb10('0x1f')},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x20'),'keyType':_0xbb10('0x6'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0xbb10('0x6'),'variableName':_0xbb10('0x21')}];break;case _0xbb10('0x7'):_0x20bd61=[{'type':'string','content':_0xbb10('0xb'),'variableName':null},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x22'),'keyType':_0xbb10('0x6'),'keyContent':'','variableName':_0xbb10('0x9')},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x23'),'keyType':'variable','keyContent':'','variableName':_0xbb10('0x24')},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x14'),'keyType':_0xbb10('0x6'),'keyContent':'','variableName':_0xbb10('0x15')},{'type':_0xbb10('0xc'),'content':'','key':'Date','keyType':_0xbb10('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0xbb10('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x25'),'keyType':_0xbb10('0x6'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0xbb10('0x26'),'keyType':_0xbb10('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x27'),'keyType':_0xbb10('0x6'),'keyContent':'','variableName':_0xbb10('0x28')},{'type':_0xbb10('0xc'),'content':'','key':_0xbb10('0x29'),'keyType':_0xbb10('0x6'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x20bd61;}; \ No newline at end of file +var _0x5f66=['***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','Billable\x20Time','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','calleridnum','outbound','push','Outbound\x20Call','getDescriptions','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Number','destcalleridnum'];(function(_0x3fbe8d,_0x5d5927){var _0x698fec=function(_0x31c38a){while(--_0x31c38a){_0x3fbe8d['push'](_0x3fbe8d['shift']());}};_0x698fec(++_0x5d5927);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';exports['getSubjects']=function(_0x61c60c,_0x4a3887){var _0x2d5fd9=[{'type':_0x65f6('0x0'),'content':_0x65f6('0x1'),'variableName':null}];switch(_0x61c60c[_0x65f6('0x2')]()){case _0x65f6('0x3'):switch(_0x4a3887['toLowerCase']()){case _0x65f6('0x4'):_0x2d5fd9['push']({'type':_0x65f6('0x5'),'content':'','variableName':_0x65f6('0x6')});_0x2d5fd9['push']({'type':'variable','content':'','variableName':_0x65f6('0x7')});break;case _0x65f6('0x8'):_0x2d5fd9[_0x65f6('0x9')]({'type':_0x65f6('0x0'),'content':_0x65f6('0xa'),'variableName':null});_0x2d5fd9[_0x65f6('0x9')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x2d5fd9;};exports[_0x65f6('0xb')]=function(_0x2f6d5b,_0x264647){var _0x25c416=[];switch(_0x2f6d5b['toLowerCase']()){case _0x65f6('0x3'):switch(_0x264647['toLowerCase']()){case'inbound':_0x25c416=[{'type':_0x65f6('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x65f6('0xc'),'content':'','key':'Caller\x20Number','keyType':_0x65f6('0x5'),'variableName':_0x65f6('0x7')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0xd'),'keyType':_0x65f6('0x5'),'variableName':_0x65f6('0xe')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0xf'),'keyType':_0x65f6('0x5'),'variableName':_0x65f6('0x10')},{'type':'keyValue','content':'','key':_0x65f6('0x11'),'keyType':'variable','variableName':'queue'},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x12'),'keyType':_0x65f6('0x5'),'variableName':_0x65f6('0x13')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x14'),'keyType':_0x65f6('0x5'),'variableName':_0x65f6('0x15')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x65f6('0xc'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':'destcalleridname'},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x16'),'keyType':'variable','variableName':_0x65f6('0x17')},{'type':_0x65f6('0x0'),'content':_0x65f6('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x19'),'keyType':_0x65f6('0x5'),'variableName':'agentcalledAt'},{'type':_0x65f6('0xc'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x65f6('0x1a')},{'type':_0x65f6('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0x65f6('0x5'),'variableName':_0x65f6('0x1b')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x1c'),'keyType':'variable','variableName':_0x65f6('0x1d')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x1e'),'keyType':'variable','variableName':'talktime'}];break;case'outbound':_0x25c416=[{'type':_0x65f6('0x0'),'content':_0x65f6('0x1f'),'variableName':null},{'type':'keyValue','content':'','key':_0x65f6('0x20'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x21'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x65f6('0x5'),'keyContent':'','variableName':_0x65f6('0x13')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x14'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':_0x65f6('0x22')},{'type':_0x65f6('0x0'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0x65f6('0x23'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0x65f6('0x24'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':_0x65f6('0x25')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x26'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':'duration'},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x27'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x25c416;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 3a94d35..15fcb76 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 _0x9ff7=['mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','chat-interactions','upperFirst','InteractionId','toLowerCase','toUpperCase','name','stringify','null','Interaction','findOne','then','update','catch','error','tracked','user','query','body','html','phone','fax'];(function(_0x5697e5,_0x410514){var _0x23730e=function(_0x187386){while(--_0x187386){_0x5697e5['push'](_0x5697e5['shift']());}};_0x23730e(++_0x410514);}(_0x9ff7,0x160));var _0x79ff=function(_0x1efb41,_0x556902){_0x1efb41=_0x1efb41-0x0;var _0x5ce9c4=_0x9ff7[_0x1efb41];return _0x5ce9c4;};'use strict';var _=require(_0x79ff('0x0'));var db=require(_0x79ff('0x1'))['db'];var loggers={'openchannel':require(_0x79ff('0x2'))('openchannel-interactions'),'mail':require(_0x79ff('0x2'))(_0x79ff('0x3')),'fax':require(_0x79ff('0x2'))(_0x79ff('0x4')),'sms':require(_0x79ff('0x2'))('sms-interactions'),'chat':require(_0x79ff('0x2'))(_0x79ff('0x5'))};function getInteractionId(_0x2975cc,_0x59fafa,_0x2b15bc){if(_0x2975cc&&_0x2975cc[_[_0x79ff('0x6')](_0x2b15bc)+'InteractionId']){return _0x2975cc[_[_0x79ff('0x6')](_0x2b15bc)+_0x79ff('0x7')];}else if(_0x2975cc&&_0x2975cc['id']){return _0x2975cc['id'];}else if(_0x59fafa&&_0x59fafa['id']){return _0x59fafa['id'];}else{return'unknown';}}function log(_0x40859b,_0x2025ce,_0x3c4475,_0x348597,_0x18e467,_0x556435){loggers[_0x18e467[_0x79ff('0x8')]()][_0x40859b]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x556435[_0x79ff('0x9')](),_0x2025ce?_0x2025ce['id']:null,_0x2025ce?_0x2025ce[_0x79ff('0xa')]:null,_0x2025ce?_0x2025ce['role']:null,getInteractionId(_0x3c4475,_0x348597,_0x18e467),_0x3c4475?JSON[_0x79ff('0xb')](_0x3c4475):_0x79ff('0xc'));}function updateUser(_0x86de14,_0x82be9e,_0x38c1c2,_0x196400,_0x27ba8e){db[_[_0x79ff('0x6')](_0x196400)+_0x79ff('0xd')][_0x79ff('0xe')]({'where':{'id':getInteractionId(_0x82be9e,_0x38c1c2,_0x196400)}})[_0x79ff('0xf')](function(_0x59e906){if(_0x59e906){return _0x59e906[_0x79ff('0x10')]({'UserId':_0x86de14?_0x86de14['id']:null});}})[_0x79ff('0xf')](function(_0x1742f4){if(_0x1742f4){log('info',_0x86de14,_0x82be9e,_0x38c1c2,_0x196400,_0x27ba8e);}})[_0x79ff('0x11')](function(){log(_0x79ff('0x12'),_0x86de14,_0x82be9e,_0x38c1c2,_0x196400,_0x27ba8e);});}exports[_0x79ff('0x13')]=function(_0x58f873,_0x26845a){return function(_0x8aed86,_0x11c993,_0x3272e2){var _0x1274df=_0x8aed86[_0x79ff('0x14')];var _0xb7a6c2={};var _0x3a4ce8=_0x8aed86[_0x79ff('0x15')];if(_0xb7a6c2){_0xb7a6c2=_['clone'](_0x8aed86[_0x79ff('0x16')]);_0xb7a6c2=_['omit'](_0xb7a6c2,[_0x79ff('0x16'),_0x79ff('0x17'),_0x79ff('0x18'),_0x79ff('0x19'),_0x79ff('0x1a')]);}updateUser(_0x1274df,_0xb7a6c2,_0x3a4ce8,_0x58f873,_0x26845a);_0x3272e2(null);};}; \ No newline at end of file +var _0x8e51=['html','phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','Interaction','findOne','then','update','info','catch','tracked','user','query','clone','body','omit'];(function(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0x8e51,0x1e4));var _0x18e5=function(_0x31b3f6,_0x501116){_0x31b3f6=_0x31b3f6-0x0;var _0x2dd8ae=_0x8e51[_0x31b3f6];return _0x2dd8ae;};'use strict';var _=require(_0x18e5('0x0'));var db=require(_0x18e5('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x18e5('0x2')),'mail':require(_0x18e5('0x3'))(_0x18e5('0x4')),'fax':require('../../config/logger')(_0x18e5('0x5')),'sms':require(_0x18e5('0x3'))(_0x18e5('0x6')),'chat':require(_0x18e5('0x3'))(_0x18e5('0x7'))};function getInteractionId(_0x303a9e,_0x13001a,_0x493f00){if(_0x303a9e&&_0x303a9e[_[_0x18e5('0x8')](_0x493f00)+_0x18e5('0x9')]){return _0x303a9e[_['upperFirst'](_0x493f00)+_0x18e5('0x9')];}else if(_0x303a9e&&_0x303a9e['id']){return _0x303a9e['id'];}else if(_0x13001a&&_0x13001a['id']){return _0x13001a['id'];}else{return _0x18e5('0xa');}}function log(_0x5d563e,_0x33b37b,_0x44e6e9,_0x2c162f,_0xb3608f,_0x557fac){loggers[_0xb3608f[_0x18e5('0xb')]()][_0x5d563e](_0x18e5('0xc'),_0x557fac['toUpperCase'](),_0x33b37b?_0x33b37b['id']:null,_0x33b37b?_0x33b37b[_0x18e5('0xd')]:null,_0x33b37b?_0x33b37b[_0x18e5('0xe')]:null,getInteractionId(_0x44e6e9,_0x2c162f,_0xb3608f),_0x44e6e9?JSON[_0x18e5('0xf')](_0x44e6e9):'null');}function updateUser(_0x202863,_0x303f63,_0x100dd2,_0x315b4b,_0x598ce6){db[_['upperFirst'](_0x315b4b)+_0x18e5('0x10')][_0x18e5('0x11')]({'where':{'id':getInteractionId(_0x303f63,_0x100dd2,_0x315b4b)}})[_0x18e5('0x12')](function(_0x251e0d){if(_0x251e0d){return _0x251e0d[_0x18e5('0x13')]({'UserId':_0x202863?_0x202863['id']:null});}})[_0x18e5('0x12')](function(_0x526eca){if(_0x526eca){log(_0x18e5('0x14'),_0x202863,_0x303f63,_0x100dd2,_0x315b4b,_0x598ce6);}})[_0x18e5('0x15')](function(){log('error',_0x202863,_0x303f63,_0x100dd2,_0x315b4b,_0x598ce6);});}exports[_0x18e5('0x16')]=function(_0x8a730c,_0x5475eb){return function(_0x34de2e,_0x1961ea,_0x12c082){var _0x549ff6=_0x34de2e[_0x18e5('0x17')];var _0x22d5c1={};var _0x574c52=_0x34de2e[_0x18e5('0x18')];if(_0x22d5c1){_0x22d5c1=_[_0x18e5('0x19')](_0x34de2e[_0x18e5('0x1a')]);_0x22d5c1=_[_0x18e5('0x1b')](_0x22d5c1,['body',_0x18e5('0x1c'),_0x18e5('0x1d'),_0x18e5('0x1e'),_0x18e5('0x1f')]);}updateUser(_0x549ff6,_0x22d5c1,_0x574c52,_0x8a730c,_0x5475eb);_0x12c082(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index c721a06..eb1e993 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 _0xfb21=['catch','User','admin','user','isUserLimit','crypto','util','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','base64','parse','use','License','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0x3e5d55,_0x23a922){var _0x404ce3=function(_0x2ba36d){while(--_0x2ba36d){_0x3e5d55['push'](_0x3e5d55['shift']());}};_0x404ce3(++_0x23a922);}(_0xfb21,0xeb));var _0x1fb2=function(_0x45bb39,_0x524eb5){_0x45bb39=_0x45bb39-0x0;var _0x4f1a9e=_0xfb21[_0x45bb39];return _0x4f1a9e;};'use strict';var crypto=require(_0x1fb2('0x0'));var util=require(_0x1fb2('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x1fb2('0x2'));function getValueFromLicense(_0x190e70,_0x575b67){if(_0x190e70&&_0x575b67){if(_0x575b67[_0x1fb2('0x3')]&&_0x575b67[_0x1fb2('0x4')]){var _0x70e309=_0x575b67['data1'];var _0x253679=_0x575b67['license'];var _0x5b090=_0x70e309[_0x1fb2('0x5')]('-')[0x4];var _0x566bcf=_0x70e309[_0x1fb2('0x5')]('-')[0x0];var _0x2b7adf=crypto[_0x1fb2('0x6')](_0x1fb2('0x7'),util['format'](_0x1fb2('0x8'),_0x5b090,_0x70e309,_0x566bcf));var _0x14fb6c=_0x2b7adf['update'](_0x253679,_0x1fb2('0x9'),'utf8');_0x14fb6c+=_0x2b7adf['final']('utf8');var _0x313cd1=JSON[_0x1fb2('0xa')](_0x14fb6c);return _0x313cd1['hasOwnProperty'](_0x190e70)?_0x313cd1[_0x190e70]:null;}}return null;}function isLimit(_0x959859,_0x4a5e02,_0x2af428,_0x894aee){var _0x497a38=_0x4a5e02;return compose()[_0x1fb2('0xb')](function(_0x15c57d,_0x1e38ed,_0x7dcdb1){return db[_0x1fb2('0xc')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x1fb2('0xd')](function(_0x2d9754){var _0x358213=getValueFromLicense(_0x959859,_0x2d9754);return _0x358213?_0x358213:_0x497a38;})['then'](function(_0x3d391a){_0x497a38=_0x3d391a;return _0x2af428[_0x1fb2('0xe')](_0x894aee);})[_0x1fb2('0xd')](function(_0x5f650a){if(_0x5f650a>=_0x497a38){return _0x1e38ed['status'](0x193)[_0x1fb2('0xf')]({'message':util[_0x1fb2('0x10')](_0x1fb2('0x11'),_0x959859)});}_0x7dcdb1();})[_0x1fb2('0x12')](function(_0xafdb8d){_0x7dcdb1(_0xafdb8d);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x1fb2('0x13')],{'where':{'$or':[{'role':_0x1fb2('0x14')},{'role':_0x1fb2('0x15')}]}});}exports[_0x1fb2('0x16')]=isUserLimit; \ No newline at end of file +var _0x2a2b=['format','%s:%s:%s','update','base64','utf8','parse','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','crypto','util','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr'];(function(_0x30bef2,_0x3d4186){var _0x567d67=function(_0x1acf17){while(--_0x1acf17){_0x30bef2['push'](_0x30bef2['shift']());}};_0x567d67(++_0x3d4186);}(_0x2a2b,0x1de));var _0xb2a2=function(_0x40ba1a,_0x5be2a2){_0x40ba1a=_0x40ba1a-0x0;var _0x1aadee=_0x2a2b[_0x40ba1a];return _0x1aadee;};'use strict';var crypto=require(_0xb2a2('0x0'));var util=require(_0xb2a2('0x1'));var compose=require('composable-middleware');var db=require(_0xb2a2('0x2'))['db'];var config=require(_0xb2a2('0x3'));function getValueFromLicense(_0x17cf23,_0x5a64a6){if(_0x17cf23&&_0x5a64a6){if(_0x5a64a6['data1']&&_0x5a64a6['license']){var _0x3df588=_0x5a64a6[_0xb2a2('0x4')];var _0x1637be=_0x5a64a6[_0xb2a2('0x5')];var _0x3db166=_0x3df588[_0xb2a2('0x6')]('-')[0x4];var _0x2d0168=_0x3df588['split']('-')[0x0];var _0x10ca5e=crypto['createDecipher'](_0xb2a2('0x7'),util[_0xb2a2('0x8')](_0xb2a2('0x9'),_0x3db166,_0x3df588,_0x2d0168));var _0x140d44=_0x10ca5e[_0xb2a2('0xa')](_0x1637be,_0xb2a2('0xb'),_0xb2a2('0xc'));_0x140d44+=_0x10ca5e['final'](_0xb2a2('0xc'));var _0x3a500c=JSON[_0xb2a2('0xd')](_0x140d44);return _0x3a500c['hasOwnProperty'](_0x17cf23)?_0x3a500c[_0x17cf23]:null;}}return null;}function isLimit(_0x348841,_0x2c9170,_0x202159,_0x596cee){var _0x52164b=_0x2c9170;return compose()[_0xb2a2('0xe')](function(_0x205f9d,_0x95aab0,_0x2b79b7){return db[_0xb2a2('0xf')][_0xb2a2('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xb2a2('0x11')](function(_0x477ea5){var _0x49542a=getValueFromLicense(_0x348841,_0x477ea5);return _0x49542a?_0x49542a:_0x52164b;})[_0xb2a2('0x11')](function(_0x1785aa){_0x52164b=_0x1785aa;return _0x202159[_0xb2a2('0x12')](_0x596cee);})[_0xb2a2('0x11')](function(_0x32025b){if(_0x32025b>=_0x52164b){return _0x95aab0[_0xb2a2('0x13')](0x193)[_0xb2a2('0x14')]({'message':util[_0xb2a2('0x8')](_0xb2a2('0x15'),_0x348841)});}_0x2b79b7();})[_0xb2a2('0x16')](function(_0x17b76d){_0x2b79b7(_0x17b76d);});});}function isUserLimit(){return isLimit(_0xb2a2('0x17'),0x1,db[_0xb2a2('0x18')],{'where':{'$or':[{'role':_0xb2a2('0x19')},{'role':_0xb2a2('0x1a')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e87fd4c..6f0f106 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 _0x0b78=['isEmpty','forOwn','isArray','split','limit','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','lodash','sequelize','filters'];(function(_0x4f957b,_0x20a7cb){var _0x1c56e5=function(_0x58f989){while(--_0x58f989){_0x4f957b['push'](_0x4f957b['shift']());}};_0x1c56e5(++_0x20a7cb);}(_0x0b78,0x1ad));var _0x80b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0b78[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x80b7('0x0'));var sequelize=require(_0x80b7('0x1'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x10e644){var _0x4f55ab=null;if(_0x10e644){_0x4f55ab=_0x10e644['split'](',');}return _0x4f55ab;};exports[_0x80b7('0x2')]=function(_0x4ee9b4){var _0x6a187e={};if(!_[_0x80b7('0x3')](_0x4ee9b4)){_0x6a187e={};_[_0x80b7('0x4')](_0x4ee9b4,function(_0x5d4a96,_0x49bc7f){try{_0x6a187e[_0x49bc7f]=_[_0x80b7('0x5')](_0x5d4a96)?_0x5d4a96:JSON['parse'](_0x5d4a96);}catch(_0x5e19ef){_0x6a187e[_0x49bc7f]=_0x5d4a96[_0x80b7('0x6')](',');}});}return _0x6a187e;};exports[_0x80b7('0x7')]=function(_0x445c23){_0x445c23=parseInt(_0x445c23,0xa);if(!_0x445c23||_0x445c23<0x0){_0x445c23=LIMIT_VALUE;}return _0x445c23;};exports['offset']=function(_0x74b4a8){_0x74b4a8=parseInt(_0x74b4a8,0xa);if(!_0x74b4a8||_0x74b4a8<0x0){_0x74b4a8=0x0;}return _0x74b4a8;};exports[_0x80b7('0x8')]=function(_0x374c52){var _0x5176b2,_0x467f38=null;if(_0x374c52){_0x5176b2=_0x374c52['split'](',');_0x467f38=_[_0x80b7('0x9')](_0x5176b2,function(_0x4599c1){if(_0x4599c1[_0x80b7('0xa')]('-')===0x0){return[_0x4599c1===_0x80b7('0xb')?sequelize[_0x80b7('0xc')](sequelize[_0x80b7('0xd')](_0x80b7('0xb')),_0x80b7('0xe')):_0x4599c1[_0x80b7('0xf')](0x1),_0x80b7('0x10')];}else{return[_0x4599c1===_0x80b7('0xb')?sequelize['cast'](sequelize[_0x80b7('0xd')](_0x80b7('0xb')),'unsigned'):_0x4599c1,_0x80b7('0x11')];}});}return _0x467f38;};exports[_0x80b7('0x12')]=function(_0x4aaa02,_0x46822c){if(_[_0x80b7('0x3')](_0x4aaa02)){return _0x4aaa02;}if(_[_0x80b7('0x5')](_0x4aaa02)){for(var _0x2c0c4e=0x0;_0x2c0c4e<_0x4aaa02[_0x80b7('0x13')];_0x2c0c4e+=0x1){_0x4aaa02[_0x2c0c4e]=this[_0x80b7('0x12')](_0x4aaa02[_0x2c0c4e],_0x46822c);}return _0x4aaa02;}if(!_[_0x80b7('0x14')](_0x4aaa02)){return _0x4aaa02;}if(_[_0x80b7('0x15')](_0x46822c)){_0x46822c=[_0x46822c];}if(!_[_0x80b7('0x5')](_0x46822c)){return _0x4aaa02;}for(var _0x34299c=0x0;_0x34299c<_0x46822c['length'];_0x34299c+=0x1){_[_0x80b7('0x16')](_0x4aaa02,_0x46822c[_0x34299c]);}for(var _0x1d62ed in _0x4aaa02){if(_0x4aaa02[_0x80b7('0x17')](_0x1d62ed)){_0x4aaa02[_0x1d62ed]=this[_0x80b7('0x12')](_0x4aaa02[_0x1d62ed],_0x46822c);}}return _0x4aaa02;}; \ No newline at end of file +var _0xd6d6=['col','ASC','omit','isObject','isString','length','unset','hasOwnProperty','lodash','sequelize','fields','split','filters','isEmpty','forOwn','isArray','parse','limit','offset','map','indexOf','priority','unsigned','substr','DESC','cast'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5ef4f7,_0x49208c){_0x5ef4f7=_0x5ef4f7-0x0;var _0x55b3b6=_0xd6d6[_0x5ef4f7];return _0x55b3b6;};'use strict';var _=require(_0x6d6d('0x0'));var sequelize=require(_0x6d6d('0x1'));var LIMIT_VALUE=0xfa;exports[_0x6d6d('0x2')]=function(_0x33226e){var _0x536523=null;if(_0x33226e){_0x536523=_0x33226e[_0x6d6d('0x3')](',');}return _0x536523;};exports[_0x6d6d('0x4')]=function(_0x1b8610){var _0x2a838a={};if(!_[_0x6d6d('0x5')](_0x1b8610)){_0x2a838a={};_[_0x6d6d('0x6')](_0x1b8610,function(_0x35a813,_0x5702dc){try{_0x2a838a[_0x5702dc]=_[_0x6d6d('0x7')](_0x35a813)?_0x35a813:JSON[_0x6d6d('0x8')](_0x35a813);}catch(_0x44f83d){_0x2a838a[_0x5702dc]=_0x35a813[_0x6d6d('0x3')](',');}});}return _0x2a838a;};exports[_0x6d6d('0x9')]=function(_0x408f88){_0x408f88=parseInt(_0x408f88,0xa);if(!_0x408f88||_0x408f88<0x0){_0x408f88=LIMIT_VALUE;}return _0x408f88;};exports[_0x6d6d('0xa')]=function(_0x51585f){_0x51585f=parseInt(_0x51585f,0xa);if(!_0x51585f||_0x51585f<0x0){_0x51585f=0x0;}return _0x51585f;};exports['sort']=function(_0x404c88){var _0x1fa46d,_0x23b18a=null;if(_0x404c88){_0x1fa46d=_0x404c88[_0x6d6d('0x3')](',');_0x23b18a=_[_0x6d6d('0xb')](_0x1fa46d,function(_0x576c88){if(_0x576c88[_0x6d6d('0xc')]('-')===0x0){return[_0x576c88===_0x6d6d('0xd')?sequelize['cast'](sequelize['col'](_0x6d6d('0xd')),_0x6d6d('0xe')):_0x576c88[_0x6d6d('0xf')](0x1),_0x6d6d('0x10')];}else{return[_0x576c88===_0x6d6d('0xd')?sequelize[_0x6d6d('0x11')](sequelize[_0x6d6d('0x12')](_0x6d6d('0xd')),'unsigned'):_0x576c88,_0x6d6d('0x13')];}});}return _0x23b18a;};exports[_0x6d6d('0x14')]=function(_0x1f2aac,_0xa3b05d){if(_[_0x6d6d('0x5')](_0x1f2aac)){return _0x1f2aac;}if(_['isArray'](_0x1f2aac)){for(var _0x2e6fdb=0x0;_0x2e6fdb<_0x1f2aac['length'];_0x2e6fdb+=0x1){_0x1f2aac[_0x2e6fdb]=this[_0x6d6d('0x14')](_0x1f2aac[_0x2e6fdb],_0xa3b05d);}return _0x1f2aac;}if(!_[_0x6d6d('0x15')](_0x1f2aac)){return _0x1f2aac;}if(_[_0x6d6d('0x16')](_0xa3b05d)){_0xa3b05d=[_0xa3b05d];}if(!_['isArray'](_0xa3b05d)){return _0x1f2aac;}for(var _0x499c2e=0x0;_0x499c2e<_0xa3b05d[_0x6d6d('0x17')];_0x499c2e+=0x1){_[_0x6d6d('0x18')](_0x1f2aac,_0xa3b05d[_0x499c2e]);}for(var _0x2b59d4 in _0x1f2aac){if(_0x1f2aac[_0x6d6d('0x19')](_0x2b59d4)){_0x1f2aac[_0x2b59d4]=this['omit'](_0x1f2aac[_0x2b59d4],_0xa3b05d);}}return _0x1f2aac;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a7ccc96..c9d05c2 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['test','client','set','json\x20replacer','split','static','get','views','/server/views','engine','html','renderFile','view\x20engine','json','50mb','initialize','express','serve-favicon','body-parser','errorhandler','path','passport','cors','./environment','default','env','production','use','join','root','public','favicon.ico','development'];(function(_0x5c224a,_0x44a597){var _0x3d2e9d=function(_0x2ed5e7){while(--_0x2ed5e7){_0x5c224a['push'](_0x5c224a['shift']());}};_0x3d2e9d(++_0x44a597);}(_0x70e0,0x17b));var _0x070e=function(_0x131d8f,_0x30e197){_0x131d8f=_0x131d8f-0x0;var _0xb0803d=_0x70e0[_0x131d8f];return _0xb0803d;};'use strict';var express=require(_0x070e('0x0'));var favicon=require(_0x070e('0x1'));var bodyParser=require(_0x070e('0x2'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0x070e('0x3'));var path=require(_0x070e('0x4'));var passport=require(_0x070e('0x5'));var cors=require(_0x070e('0x6'));var moment=require('moment');var config=require(_0x070e('0x7'));var db=require('../mysqldb')['db'];exports[_0x070e('0x8')]=function(_0x4b041d){var _0x56e420=_0x4b041d['get'](_0x070e('0x9'));if(_0x56e420===_0x070e('0xa')){_0x4b041d[_0x070e('0xb')](favicon(path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0xe'),_0x070e('0xf'))));_0x4b041d['set']('appPath',path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0xe')));}if(_0x56e420===_0x070e('0x10')||_0x56e420===_0x070e('0x11')){_0x4b041d[_0x070e('0xb')](favicon(path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0x12'),_0x070e('0xf'))));_0x4b041d[_0x070e('0x13')]('appPath',path['join'](config[_0x070e('0xd')],'client'));_0x4b041d['use'](errorHandler());}_0x4b041d['set'](_0x070e('0x14'),function(_0x14c3fd,_0x51d14d){if(this[_0x14c3fd]instanceof Date){_0x51d14d=this[_0x14c3fd]['toISOString']()[_0x070e('0x15')]('.')[0x0]+'Z';}return _0x51d14d;});_0x4b041d[_0x070e('0xb')](express[_0x070e('0x16')](_0x4b041d[_0x070e('0x17')]('appPath')));_0x4b041d['set'](_0x070e('0x18'),config[_0x070e('0xd')]+_0x070e('0x19'));_0x4b041d[_0x070e('0x1a')](_0x070e('0x1b'),require('ejs')[_0x070e('0x1c')]);_0x4b041d[_0x070e('0x13')](_0x070e('0x1d'),_0x070e('0x1b'));_0x4b041d[_0x070e('0xb')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x4b041d['use'](bodyParser[_0x070e('0x1e')]({'limit':_0x070e('0x1f')}));_0x4b041d[_0x070e('0xb')](cors());_0x4b041d['use'](methodOverride());_0x4b041d[_0x070e('0xb')](cookieParser());_0x4b041d['use'](passport[_0x070e('0x20')]());}; \ No newline at end of file +var _0x0713=['use','join','root','favicon.ico','set','appPath','development','test','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','body-parser','method-override','cookie-parser','errorhandler','path','cors','moment','./environment','../mysqldb','default','get','env','production'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x3071('0x0'));var methodOverride=require(_0x3071('0x1'));var cookieParser=require(_0x3071('0x2'));var errorHandler=require(_0x3071('0x3'));var path=require(_0x3071('0x4'));var passport=require('passport');var cors=require(_0x3071('0x5'));var moment=require(_0x3071('0x6'));var config=require(_0x3071('0x7'));var db=require(_0x3071('0x8'))['db'];exports[_0x3071('0x9')]=function(_0x41cf76){var _0x1d3dd6=_0x41cf76[_0x3071('0xa')](_0x3071('0xb'));if(_0x1d3dd6===_0x3071('0xc')){_0x41cf76[_0x3071('0xd')](favicon(path[_0x3071('0xe')](config[_0x3071('0xf')],'public',_0x3071('0x10'))));_0x41cf76[_0x3071('0x11')](_0x3071('0x12'),path[_0x3071('0xe')](config[_0x3071('0xf')],'public'));}if(_0x1d3dd6===_0x3071('0x13')||_0x1d3dd6===_0x3071('0x14')){_0x41cf76[_0x3071('0xd')](favicon(path[_0x3071('0xe')](config[_0x3071('0xf')],'client','favicon.ico')));_0x41cf76[_0x3071('0x11')]('appPath',path[_0x3071('0xe')](config[_0x3071('0xf')],'client'));_0x41cf76[_0x3071('0xd')](errorHandler());}_0x41cf76['set'](_0x3071('0x15'),function(_0x45c93b,_0x1271d0){if(this[_0x45c93b]instanceof Date){_0x1271d0=this[_0x45c93b][_0x3071('0x16')]()[_0x3071('0x17')]('.')[0x0]+'Z';}return _0x1271d0;});_0x41cf76[_0x3071('0xd')](express[_0x3071('0x18')](_0x41cf76[_0x3071('0xa')](_0x3071('0x12'))));_0x41cf76[_0x3071('0x11')]('views',config[_0x3071('0xf')]+_0x3071('0x19'));_0x41cf76[_0x3071('0x1a')](_0x3071('0x1b'),require(_0x3071('0x1c'))[_0x3071('0x1d')]);_0x41cf76[_0x3071('0x11')](_0x3071('0x1e'),'html');_0x41cf76[_0x3071('0xd')](bodyParser[_0x3071('0x1f')]({'limit':_0x3071('0x20'),'extended':!![]}));_0x41cf76['use'](bodyParser[_0x3071('0x21')]({'limit':'50mb'}));_0x41cf76[_0x3071('0xd')](cors());_0x41cf76[_0x3071('0xd')](methodOverride());_0x41cf76[_0x3071('0xd')](cookieParser());_0x41cf76[_0x3071('0xd')](passport[_0x3071('0x22')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 39fb4a8..d3fa2a4 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 _0x070f=['join','update','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','createHash','md5','substring','lodash','bimedia-machine-uuid','execSync','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x070f,0x8d));var _0xf070=function(_0x24041e,_0x28cf9c){_0x24041e=_0x24041e-0x0;var _0x3fe988=_0x070f[_0x24041e];return _0x3fe988;};'use strict';var _=require(_0xf070('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xf070('0x1'));var exec=require('child_process')[_0xf070('0x2')];function getInterfaces(){var _0x253b0b=[];var _0x1684e5=os[_0xf070('0x3')]();var _0x2fc86a=_[_0xf070('0x4')](_[_0xf070('0x5')](_0x1684e5));for(var _0x10324e=0x0;_0x10324e<_0x2fc86a[_0xf070('0x6')];_0x10324e++){var _0x510754=_0x1684e5[_0x2fc86a[_0x10324e]][_0xf070('0x7')](function(_0x69fe86){return _0x69fe86['family']===_0xf070('0x8')&&_0x69fe86[_0xf070('0x9')]===![];});_0x253b0b=_0x253b0b[_0xf070('0xa')](_0x510754);}return _0x253b0b;}function getFirstInterface(){var _0x19c77c=_[_0xf070('0xb')](getInterfaces());return{'macAddress':_0x19c77c&&_0x19c77c[_0xf070('0xc')]?_0x19c77c[_0xf070('0xc')]:_0xf070('0xd'),'ipAddress':_0x19c77c&&_0x19c77c[_0xf070('0xe')]?_0x19c77c[_0xf070('0xe')]:_0xf070('0xf')};}exports[_0xf070('0x10')]=getFirstInterface;function getCPUhash(){var _0x4ee8fe=_[_0xf070('0x4')](os['cpus']()[_0xf070('0x11')](function(_0xbbc029){return _0xbbc029[_0xf070('0x12')];}))[_0xf070('0x13')](':');return crypto['createHash']('md5')[_0xf070('0x14')](_0x4ee8fe)['digest'](_0xf070('0x15'));}exports[_0xf070('0x16')]=function(){switch(os[_0xf070('0x17')]()){case _0xf070('0x18'):return exec(_0xf070('0x19'),{'encoding':'utf8'})['replace']('\x0d\x0a','');default:var _0x26dcac=getFirstInterface();var _0x49c5f3=getCPUhash();var _0xd8b28c=_0x49c5f3+'|'+os[_0xf070('0x1a')]()+'|'+_0x26dcac[_0xf070('0x1b')]+'|'+_0x26dcac[_0xf070('0x1c')];var _0x86ac50=crypto[_0xf070('0x1d')](_0xf070('0x1e'))[_0xf070('0x14')](_0xd8b28c)['digest']('hex');return _0x86ac50[_0xf070('0x1f')](0x0,0x8)+'-'+_0x86ac50[_0xf070('0x1f')](0x8,0xc)+'-'+_0x86ac50[_0xf070('0x1f')](0xc,0x10)+'-'+_0x86ac50[_0xf070('0x1f')](0x10,0x14)+'-'+_0x86ac50['substring'](0x14);}}; \ No newline at end of file +var _0x94af=['getUuid','win32','utf8','hostname','macAddress','ipAddress','update','hex','substring','lodash','bimedia-machine-uuid','execSync','orderBy','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','digest'];(function(_0x4dfaa6,_0x5bf4af){var _0x1612e2=function(_0x29ca77){while(--_0x29ca77){_0x4dfaa6['push'](_0x4dfaa6['shift']());}};_0x1612e2(++_0x5bf4af);}(_0x94af,0x18f));var _0xf94a=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x94af[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xf94a('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xf94a('0x1'));var exec=require('child_process')[_0xf94a('0x2')];function getInterfaces(){var _0x5338d9=[];var _0x3afaf9=os['networkInterfaces']();var _0x26d8dd=_[_0xf94a('0x3')](_[_0xf94a('0x4')](_0x3afaf9));for(var _0x4e0a5c=0x0;_0x4e0a5c<_0x26d8dd[_0xf94a('0x5')];_0x4e0a5c++){var _0x2d118a=_0x3afaf9[_0x26d8dd[_0x4e0a5c]][_0xf94a('0x6')](function(_0x3ce2cd){return _0x3ce2cd['family']===_0xf94a('0x7')&&_0x3ce2cd[_0xf94a('0x8')]===![];});_0x5338d9=_0x5338d9[_0xf94a('0x9')](_0x2d118a);}return _0x5338d9;}function getFirstInterface(){var _0x45d224=_[_0xf94a('0xa')](getInterfaces());return{'macAddress':_0x45d224&&_0x45d224[_0xf94a('0xb')]?_0x45d224['mac']:_0xf94a('0xc'),'ipAddress':_0x45d224&&_0x45d224['address']?_0x45d224['address']:_0xf94a('0xd')};}exports[_0xf94a('0xe')]=getFirstInterface;function getCPUhash(){var _0x21ea10=_[_0xf94a('0x3')](os[_0xf94a('0xf')]()[_0xf94a('0x10')](function(_0x1a68ad){return _0x1a68ad['model'];}))[_0xf94a('0x11')](':');return crypto[_0xf94a('0x12')](_0xf94a('0x13'))['update'](_0x21ea10)[_0xf94a('0x14')]('hex');}exports[_0xf94a('0x15')]=function(){switch(os['platform']()){case _0xf94a('0x16'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xf94a('0x17')})['replace']('\x0d\x0a','');default:var _0x59d9d5=getFirstInterface();var _0x233e85=getCPUhash();var _0x2fe3c2=_0x233e85+'|'+os[_0xf94a('0x18')]()+'|'+_0x59d9d5[_0xf94a('0x19')]+'|'+_0x59d9d5[_0xf94a('0x1a')];var _0x8c0639=crypto[_0xf94a('0x12')](_0xf94a('0x13'))[_0xf94a('0x1b')](_0x2fe3c2)[_0xf94a('0x14')](_0xf94a('0x1c'));return _0x8c0639['substring'](0x0,0x8)+'-'+_0x8c0639[_0xf94a('0x1d')](0x8,0xc)+'-'+_0x8c0639['substring'](0xc,0x10)+'-'+_0x8c0639[_0xf94a('0x1d')](0x10,0x14)+'-'+_0x8c0639[_0xf94a('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 9559b16..c2d556f 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 _0xd707=['exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','aes-256-ctr','secrets','update','base64','createDecipher','session','utf8','final','findOne','admin','fullname','email','|reason|','|machineUuid|','|name|','|email|','getFirstInterface','openIssue','Motion\x20License\x20Alert','get','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','message','default','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s'];(function(_0x187662,_0x3cba81){var _0x2a22c9=function(_0x5a5c4a){while(--_0x5a5c4a){_0x187662['push'](_0x187662['shift']());}};_0x2a22c9(++_0x3cba81);}(_0xd707,0x1b2));var _0x7d70=function(_0x37c7f9,_0x547265){_0x37c7f9=_0x37c7f9-0x0;var _0x65fce2=_0xd707[_0x37c7f9];return _0x65fce2;};'use strict';var util=require(_0x7d70('0x0'));var crypto=require('crypto');var moment=require(_0x7d70('0x1'));var rp=require(_0x7d70('0x2'));var BPromise=require(_0x7d70('0x3'));var pkginfo=require(_0x7d70('0x4'))(module,'version');var db=require(_0x7d70('0x5'))['db'];var config=require(_0x7d70('0x6'));var hardware=require(_0x7d70('0x7'));var logger=require(_0x7d70('0x8'))(_0x7d70('0x9'));var jira=require(_0x7d70('0xa'));var HOST=_0x7d70('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x250c22){return new BPromise(function(_0x25db29,_0x4a086a){var _0x22b7a7=util[_0x7d70('0xc')](_0x7d70('0xd'),HOST,_0x250c22,module[_0x7d70('0xe')][_0x7d70('0xf')]);if(oldToken){_0x22b7a7=util['format'](_0x7d70('0x10'),HOST,_0x250c22,module['exports']['version'],oldToken);}var _0xc2ac1d={'uri':_0x22b7a7,'method':_0x7d70('0x11'),'timeout':0xea60,'json':!![]};return rp(_0xc2ac1d)[_0x7d70('0x12')](function(_0x3b13d2){_0x25db29(_0x3b13d2);})['catch'](function(_0x393e79){_0x4a086a(_0x393e79);});});}function encryptDate(_0xad6f4a){var _0x29659d=crypto['createCipher'](_0x7d70('0x13'),config[_0x7d70('0x14')]['session']);var _0x430bf0=_0x29659d[_0x7d70('0x15')](_0xad6f4a,'utf8',_0x7d70('0x16'));_0x430bf0+=_0x29659d['final'](_0x7d70('0x16'));return _0x430bf0;}function decryptDate(_0x405820){var _0x1230f7=crypto[_0x7d70('0x17')]('aes-256-ctr',config['secrets'][_0x7d70('0x18')]);var _0x234928=_0x1230f7[_0x7d70('0x15')](_0x405820,_0x7d70('0x16'),_0x7d70('0x19'));_0x234928+=_0x1230f7[_0x7d70('0x1a')](_0x7d70('0x19'));return _0x234928;}function sendJiraAlert(_0x556d63,_0x305b05,_0x3f20ba){var _0x1c6ba8='||FIELD||VALUE||\x0a';return db['User'][_0x7d70('0x1b')]({'where':{'role':_0x7d70('0x1c')},'attributes':[_0x7d70('0x1d'),_0x7d70('0x1e')],'raw':!![]})['then'](function(_0x3879f7){ADMIN=_0x3879f7;_0x1c6ba8+=_0x7d70('0x1f')+_0x3f20ba+'|\x0a';_0x1c6ba8+='|uuid|'+_0x556d63+'|\x0a';_0x1c6ba8+=_0x7d70('0x20')+_0x305b05+'|\x0a';_0x1c6ba8+=_0x7d70('0x21')+ADMIN[_0x7d70('0x1d')]+'|\x0a';_0x1c6ba8+=_0x7d70('0x22')+ADMIN[_0x7d70('0x1e')]+'|\x0a';return _0x1c6ba8;})['then'](function(_0x5cb3ed){var _0x4a8b9e=hardware[_0x7d70('0x23')]()['ipAddress'];return jira[_0x7d70('0x24')]({'key':'MOTLICENSE','summary':_0x7d70('0x25'),'description':_0x5cb3ed,'issuetype':'Alert','oldToken':_0x556d63,'newToken':_0x305b05,'email':ADMIN[_0x7d70('0x1e')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x4a8b9e});});}function manageLicense(_0x6750b9,_0x3bfeb6){var _0x167993=_0x3bfeb6[_0x7d70('0x26')]({'plain':!![]});httpRequest(_0x6750b9)[_0x7d70('0x12')](function(_0x356b96){if(oldToken){oldToken=undefined;}if(_0x356b96[_0x7d70('0x27')]){if(!_0x167993[_0x7d70('0x9')]&&_0x167993[_0x7d70('0x9')]!=_0x356b96[_0x7d70('0x9')]||_0x167993[_0x7d70('0x9')]&&_0x167993['data2']){logger[_0x7d70('0x28')](_0x7d70('0x29'));}if(_0x167993[_0x7d70('0x9')]&&!_0x167993[_0x7d70('0x2a')]&&_0x167993[_0x7d70('0x9')]!=_0x356b96[_0x7d70('0x9')]){logger[_0x7d70('0x28')](_0x7d70('0x2b'));}if(_0x167993[_0x7d70('0x9')]&&!_0x167993[_0x7d70('0x2a')]&&_0x167993['license']==_0x356b96[_0x7d70('0x9')]){return _0x3bfeb6;}return _0x3bfeb6['update']({'data1':_0x6750b9,'data2':null,'license':_0x356b96['license']});}else{if(_0x356b96[_0x7d70('0x9')]||_0x167993[_0x7d70('0x9')]){if(!_0x167993[_0x7d70('0x2a')]){if(_0x167993['data1']==_0x6750b9){GRAY_PERIOD_REASON=_0x7d70('0x2c');logger[_0x7d70('0x28')](_0x7d70('0x2d'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x167993[_0x7d70('0x2e')];logger[_0x7d70('0x28')](_0x7d70('0x2f'),_0x167993['data1'],_0x6750b9);}sendJiraAlert(_0x167993[_0x7d70('0x2e')],_0x356b96[_0x7d70('0x30')],GRAY_PERIOD_REASON);logger[_0x7d70('0x28')](_0x7d70('0x31'),GRAY_PERIOD_REASON[_0x7d70('0x32')](),moment()[_0x7d70('0xc')](_0x7d70('0x33')));return _0x3bfeb6['update']({'data2':encryptDate(moment()[_0x7d70('0xc')](_0x7d70('0x33')))});}else{if(moment()[_0x7d70('0x34')](decryptDate(_0x167993[_0x7d70('0x2a')]),_0x7d70('0x35'))>DAYS){logger[_0x7d70('0x28')](_0x7d70('0x36'),moment()[_0x7d70('0xc')](_0x7d70('0x33')));return _0x3bfeb6[_0x7d70('0x15')]({'data1':_0x6750b9,'data2':null,'license':null});}}}else{if(_0x167993[_0x7d70('0x2e')]!=_0x6750b9){logger['info'](_0x7d70('0x2f'),_0x167993[_0x7d70('0x2e')],_0x6750b9);return _0x3bfeb6['update']({'data1':_0x6750b9,'data2':null,'license':null});}}}return _0x3bfeb6;})[_0x7d70('0x12')](function(_0x206235){_0x3bfeb6=_0x206235;})['catch'](function(_0x21cfb3){logger[_0x7d70('0x37')](_0x21cfb3['message']);})[_0x7d70('0x38')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3bfeb6);},TIME);});}function defaultLicense(){var _0x21834f=hardware[_0x7d70('0x39')]();if(_0x21834f){return db['License'][_0x7d70('0x3a')]({'where':{'id':0x1},'defaults':{'data1':_0x21834f}})[_0x7d70('0x3b')](function(_0x9d10fc,_0xcda73){logger['info'](_0x7d70('0x3c'),_0x21834f);manageLicense(_0x21834f,_0x9d10fc);})[_0x7d70('0x3d')](function(_0x38cbf6){logger[_0x7d70('0x37')](_0x38cbf6[_0x7d70('0x3e')]);});}}exports[_0x7d70('0x3f')]=defaultLicense; \ No newline at end of file +var _0x990d=['utf8','base64','createDecipher','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|uuid|','|machineUuid|','getFirstInterface','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','active','license','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','crypto','moment','request-promise','bluebird','pkginfo','version','./hardware','../logger','../../api/jira/jira.controller','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','secrets','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x990d,0x65));var _0xd990=function(_0x162812,_0x1f1c3e){_0x162812=_0x162812-0x0;var _0x438899=_0x990d[_0x162812];return _0x438899;};'use strict';var util=require(_0xd990('0x0'));var crypto=require(_0xd990('0x1'));var moment=require(_0xd990('0x2'));var rp=require(_0xd990('0x3'));var BPromise=require(_0xd990('0x4'));var pkginfo=require(_0xd990('0x5'))(module,_0xd990('0x6'));var db=require('../../mysqldb')['db'];var config=require('../environment');var hardware=require(_0xd990('0x7'));var logger=require(_0xd990('0x8'))('license');var jira=require(_0xd990('0x9'));var HOST=_0xd990('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x232c24){return new BPromise(function(_0x3a7672,_0x307330){var _0x3197fc=util[_0xd990('0xb')]('%s/api/servers/%s/check?version=%s',HOST,_0x232c24,module[_0xd990('0xc')][_0xd990('0x6')]);if(oldToken){_0x3197fc=util['format'](_0xd990('0xd'),HOST,_0x232c24,module['exports'][_0xd990('0x6')],oldToken);}var _0x2d5043={'uri':_0x3197fc,'method':_0xd990('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2d5043)[_0xd990('0xf')](function(_0x219ebd){_0x3a7672(_0x219ebd);})[_0xd990('0x10')](function(_0x250dac){_0x307330(_0x250dac);});});}function encryptDate(_0x45819b){var _0x5d9d53=crypto[_0xd990('0x11')](_0xd990('0x12'),config[_0xd990('0x13')]['session']);var _0x5271d3=_0x5d9d53[_0xd990('0x14')](_0x45819b,_0xd990('0x15'),_0xd990('0x16'));_0x5271d3+=_0x5d9d53['final'](_0xd990('0x16'));return _0x5271d3;}function decryptDate(_0x590581){var _0x2469a6=crypto[_0xd990('0x17')](_0xd990('0x12'),config['secrets']['session']);var _0x2ebf05=_0x2469a6['update'](_0x590581,_0xd990('0x16'),_0xd990('0x15'));_0x2ebf05+=_0x2469a6['final'](_0xd990('0x15'));return _0x2ebf05;}function sendJiraAlert(_0x546f1e,_0x57d386,_0x234ea9){var _0x5bc883=_0xd990('0x18');return db[_0xd990('0x19')][_0xd990('0x1a')]({'where':{'role':_0xd990('0x1b')},'attributes':[_0xd990('0x1c'),_0xd990('0x1d')],'raw':!![]})['then'](function(_0x12e93d){ADMIN=_0x12e93d;_0x5bc883+=_0xd990('0x1e')+_0x234ea9+'|\x0a';_0x5bc883+=_0xd990('0x1f')+_0x546f1e+'|\x0a';_0x5bc883+=_0xd990('0x20')+_0x57d386+'|\x0a';_0x5bc883+='|name|'+ADMIN[_0xd990('0x1c')]+'|\x0a';_0x5bc883+='|email|'+ADMIN[_0xd990('0x1d')]+'|\x0a';return _0x5bc883;})['then'](function(_0x2554d1){var _0x1fa9c1=hardware[_0xd990('0x21')]()['ipAddress'];return jira[_0xd990('0x22')]({'key':_0xd990('0x23'),'summary':_0xd990('0x24'),'description':_0x2554d1,'issuetype':_0xd990('0x25'),'oldToken':_0x546f1e,'newToken':_0x57d386,'email':ADMIN[_0xd990('0x1d')],'name':ADMIN[_0xd990('0x1c')],'reason':GRAY_PERIOD_REASON,'ip':_0x1fa9c1});});}function manageLicense(_0x2e5abd,_0x420ab9){var _0x367368=_0x420ab9['get']({'plain':!![]});httpRequest(_0x2e5abd)[_0xd990('0xf')](function(_0x14e996){if(oldToken){oldToken=undefined;}if(_0x14e996[_0xd990('0x26')]){if(!_0x367368['license']&&_0x367368[_0xd990('0x27')]!=_0x14e996[_0xd990('0x27')]||_0x367368['license']&&_0x367368[_0xd990('0x28')]){logger['info'](_0xd990('0x29'));}if(_0x367368['license']&&!_0x367368[_0xd990('0x28')]&&_0x367368['license']!=_0x14e996[_0xd990('0x27')]){logger[_0xd990('0x2a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x367368[_0xd990('0x27')]&&!_0x367368['data2']&&_0x367368[_0xd990('0x27')]==_0x14e996['license']){return _0x420ab9;}return _0x420ab9[_0xd990('0x14')]({'data1':_0x2e5abd,'data2':null,'license':_0x14e996[_0xd990('0x27')]});}else{if(_0x14e996['license']||_0x367368['license']){if(!_0x367368[_0xd990('0x28')]){if(_0x367368['data1']==_0x2e5abd){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xd990('0x2b'));}else{GRAY_PERIOD_REASON=_0xd990('0x2c');oldToken=_0x367368[_0xd990('0x2d')];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x367368[_0xd990('0x2d')],_0x2e5abd);}sendJiraAlert(_0x367368['data1'],_0x14e996[_0xd990('0x2e')],GRAY_PERIOD_REASON);logger[_0xd990('0x2a')](_0xd990('0x2f'),GRAY_PERIOD_REASON[_0xd990('0x30')](),moment()[_0xd990('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x420ab9[_0xd990('0x14')]({'data2':encryptDate(moment()['format'](_0xd990('0x31')))});}else{if(moment()[_0xd990('0x32')](decryptDate(_0x367368['data2']),_0xd990('0x33'))>DAYS){logger[_0xd990('0x2a')](_0xd990('0x34'),moment()[_0xd990('0xb')](_0xd990('0x31')));return _0x420ab9['update']({'data1':_0x2e5abd,'data2':null,'license':null});}}}else{if(_0x367368[_0xd990('0x2d')]!=_0x2e5abd){logger[_0xd990('0x2a')](_0xd990('0x35'),_0x367368['data1'],_0x2e5abd);return _0x420ab9['update']({'data1':_0x2e5abd,'data2':null,'license':null});}}}return _0x420ab9;})[_0xd990('0xf')](function(_0x5a47e1){_0x420ab9=_0x5a47e1;})[_0xd990('0x10')](function(_0x4de442){logger['error'](_0x4de442[_0xd990('0x36')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x420ab9);},TIME);});}function defaultLicense(){var _0x181669=hardware[_0xd990('0x37')]();if(_0x181669){return db[_0xd990('0x38')][_0xd990('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0x181669}})[_0xd990('0x3a')](function(_0x3d69dd,_0x5e46d1){logger[_0xd990('0x2a')](_0xd990('0x3b'),_0x181669);manageLicense(_0x181669,_0x3d69dd);})[_0xd990('0x10')](function(_0x278d80){logger[_0xd990('0x3c')](_0x278d80[_0xd990('0x36')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 323b09f..140256c 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 _0x5b5d=['Demo\x20license','License','defaults','crypto','util','lodash','moment','./hardware','../environment','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','parse','demo','uuid','getUuid','secrets','session','gray','deadline','days','grayReason','changed','disabled','Breaking\x20license','message','2027-01-01T00:00:00.000Z'];(function(_0x483ba6,_0x70851b){var _0x45b9f3=function(_0x376404){while(--_0x376404){_0x483ba6['push'](_0x483ba6['shift']());}};_0x45b9f3(++_0x70851b);}(_0x5b5d,0x10d));var _0xd5b5=function(_0x46e580,_0x363e85){_0x46e580=_0x46e580-0x0;var _0x12325a=_0x5b5d[_0x46e580];return _0x12325a;};'use strict';var crypto=require(_0xd5b5('0x0'));var util=require(_0xd5b5('0x1'));var _=require(_0xd5b5('0x2'));var moment=require(_0xd5b5('0x3'));var hardware=require(_0xd5b5('0x4'));var config=require(_0xd5b5('0x5'));var db=require('../../mysqldb')['db'];function checkLicense(_0x4c78a9,_0x5c9074){if(_0x4c78a9){try{var _0x532eb5=_0x5c9074||_0x4c78a9[_0xd5b5('0x6')];if(_[_0xd5b5('0x7')](_0x532eb5)){throw new Error(_0xd5b5('0x8'));}var _0x236417=_0x4c78a9[_0xd5b5('0x9')];var _0x1464ce=_0x4c78a9[_0xd5b5('0xa')];var _0xff397=_0x236417[_0xd5b5('0xb')]('-')[0x4];var _0x37ba9e=_0x236417[_0xd5b5('0xb')]('-')[0x0];var _0x5fd1ad=crypto[_0xd5b5('0xc')](_0xd5b5('0xd'),util[_0xd5b5('0xe')](_0xd5b5('0xf'),_0xff397,_0x236417,_0x37ba9e));var _0x1f37c2=_0x5fd1ad[_0xd5b5('0x10')](_0x532eb5,_0xd5b5('0x11'),'utf8');_0x1f37c2+=_0x5fd1ad[_0xd5b5('0x12')](_0xd5b5('0x13'));var _0x96001a=JSON[_0xd5b5('0x14')](_0x1f37c2);_0x96001a[_0xd5b5('0x15')]=![];_0x96001a[_0xd5b5('0x16')]=_0x236417;_0x96001a['machineUuid']=hardware[_0xd5b5('0x17')]();if(_0x1464ce){var _0x4759c8=crypto[_0xd5b5('0xc')](_0xd5b5('0xd'),config[_0xd5b5('0x18')][_0xd5b5('0x19')]);var _0x44c52c=_0x4759c8[_0xd5b5('0x10')](_0x1464ce,'base64',_0xd5b5('0x13'));_0x44c52c+=_0x4759c8[_0xd5b5('0x12')]('utf8');_0x96001a[_0xd5b5('0x1a')]=_0x44c52c;_0x96001a[_0xd5b5('0x1b')]=moment(_0x44c52c)['add'](0x7,_0xd5b5('0x1c'))['format']();_0x96001a[_0xd5b5('0x1d')]=_0x96001a['uuid']!=_0x96001a['machineUuid']?_0xd5b5('0x1e'):_0xd5b5('0x1f');}return _0x96001a;}catch(_0x4f1972){return{'breaking':!![],'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':![],'update':![],'description':_0xd5b5('0x20'),'uuid':_0x4c78a9['data1'],'machineUuid':hardware[_0xd5b5('0x17')](),'message':_0x4f1972[_0xd5b5('0x21')],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd5b5('0x22'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd5b5('0x23'),'uuid':_0x4c78a9[_0xd5b5('0x9')],'machineUuid':hardware[_0xd5b5('0x17')](),'virtual':0x0,'voice':!![],'preferred':![]};}exports['getLicense']=function(_0x58e3fc){return db[_0xd5b5('0x24')]['find'](_[_0xd5b5('0x25')](_0x58e3fc,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xf51971){return checkLicense(_0xf51971,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0x8d49=['getUuid','getLicense','License','then','crypto','util','lodash','moment','./hardware','../environment','../../mysqldb','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','demo','uuid','gray','days','grayReason','machineUuid','changed','disabled','2027-01-01T00:00:00.000Z','message','Demo\x20license'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0x8d49,0x148));var _0x98d4=function(_0x19a1a4,_0x31e399){_0x19a1a4=_0x19a1a4-0x0;var _0x42e34b=_0x8d49[_0x19a1a4];return _0x42e34b;};'use strict';var crypto=require(_0x98d4('0x0'));var util=require(_0x98d4('0x1'));var _=require(_0x98d4('0x2'));var moment=require(_0x98d4('0x3'));var hardware=require(_0x98d4('0x4'));var config=require(_0x98d4('0x5'));var db=require(_0x98d4('0x6'))['db'];function checkLicense(_0x2f6859,_0x4a6665){if(_0x2f6859){try{var _0x2ef5e3=_0x4a6665||_0x2f6859['license'];if(_[_0x98d4('0x7')](_0x2ef5e3)){throw new Error(_0x98d4('0x8'));}var _0x4c80a8=_0x2f6859[_0x98d4('0x9')];var _0x697c9b=_0x2f6859[_0x98d4('0xa')];var _0x5b26b5=_0x4c80a8['split']('-')[0x4];var _0x9c2207=_0x4c80a8[_0x98d4('0xb')]('-')[0x0];var _0xe91079=crypto[_0x98d4('0xc')](_0x98d4('0xd'),util[_0x98d4('0xe')](_0x98d4('0xf'),_0x5b26b5,_0x4c80a8,_0x9c2207));var _0x5a96ce=_0xe91079[_0x98d4('0x10')](_0x2ef5e3,_0x98d4('0x11'),_0x98d4('0x12'));_0x5a96ce+=_0xe91079[_0x98d4('0x13')](_0x98d4('0x12'));var _0x2100a0=JSON[_0x98d4('0x14')](_0x5a96ce);_0x2100a0[_0x98d4('0x15')]=![];_0x2100a0[_0x98d4('0x16')]=_0x4c80a8;_0x2100a0['machineUuid']=hardware['getUuid']();if(_0x697c9b){var _0x28c9ac=crypto[_0x98d4('0xc')]('aes-256-ctr',config['secrets']['session']);var _0x513731=_0x28c9ac[_0x98d4('0x10')](_0x697c9b,_0x98d4('0x11'),_0x98d4('0x12'));_0x513731+=_0x28c9ac[_0x98d4('0x13')](_0x98d4('0x12'));_0x2100a0[_0x98d4('0x17')]=_0x513731;_0x2100a0['deadline']=moment(_0x513731)['add'](0x7,_0x98d4('0x18'))[_0x98d4('0xe')]();_0x2100a0[_0x98d4('0x19')]=_0x2100a0[_0x98d4('0x16')]!=_0x2100a0[_0x98d4('0x1a')]?_0x98d4('0x1b'):_0x98d4('0x1c');}return _0x2100a0;}catch(_0x14f9b){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x98d4('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x2f6859[_0x98d4('0x9')],'machineUuid':hardware['getUuid'](),'message':_0x14f9b[_0x98d4('0x1e')],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x98d4('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x98d4('0x1f'),'uuid':_0x2f6859[_0x98d4('0x9')],'machineUuid':hardware[_0x98d4('0x20')](),'virtual':0x0,'voice':!![],'preferred':![]};}exports[_0x98d4('0x21')]=function(_0x106c78){return db[_0x98d4('0x22')]['find'](_['defaults'](_0x106c78,{'raw':!![],'where':{'id':0x1}}))[_0x98d4('0x23')](function(_0x3ce437){return checkLicense(_0x3ce437,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 474a53f..6b5800b 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 _0x1ddc=['myappanuglar-secret','app-id','http://localhost:9000'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x146b6b,_0xdc6273){_0x146b6b=_0x146b6b-0x0;var _0xe218e3=_0x1ddc[_0x146b6b];return _0xe218e3;};'use strict';module['exports']={'DOMAIN':_0xc1dd('0x0'),'SESSION_SECRET':_0xc1dd('0x1'),'GOOGLE_ID':_0xc1dd('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xa1e8=['myappanuglar-secret','app-id','secret','exports'];(function(_0x5efab7,_0x13a59c){var _0xd52c41=function(_0x52e7f6){while(--_0x52e7f6){_0x5efab7['push'](_0x5efab7['shift']());}};_0xd52c41(++_0x13a59c);}(_0xa1e8,0x1af));var _0x8a1e=function(_0x2a4346,_0x3b51fb){_0x2a4346=_0x2a4346-0x0;var _0x13ff78=_0xa1e8[_0x2a4346];return _0x13ff78;};'use strict';module[_0x8a1e('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x8a1e('0x1'),'GOOGLE_ID':_0x8a1e('0x2'),'GOOGLE_SECRET':_0x8a1e('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index b821039..d8e4b60 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1796=['message','exports','Logger','transports','File','error','info','Console','debugLevel','moment','winston','util','INFO','join','/var','format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x4ba8d8,_0x36e552){var _0x4d14a8=function(_0xf35c42){while(--_0xf35c42){_0x4ba8d8['push'](_0x4ba8d8['shift']());}};_0x4d14a8(++_0x36e552);}(_0x1796,0x6d));var _0x6179=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x1796[_0x4bb66f];return _0xf2772f;};'use strict';var moment=require(_0x6179('0x0'));var winston=require(_0x6179('0x1'));var util=require(_0x6179('0x2'));var path=require('path');var debugLevel=_0x6179('0x3');function filename(_0x2954e2,_0x2b9a2c){return path[_0x6179('0x4')](_0x6179('0x5'),'log','xcally',util[_0x6179('0x6')](_0x6179('0x7'),_0x2954e2,_0x2b9a2c));}function formatter(_0x4c2a9e,_0x12121d){return util[_0x6179('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x6179('0x6')](_0x6179('0x8')),_0x12121d[_0x6179('0x9')][_0x6179('0xa')](),_0x4c2a9e,_0x12121d[_0x6179('0xb')]);}module[_0x6179('0xc')]=function(_0x5401a6){return new winston[(_0x6179('0xd'))]({'transports':[new winston[(_0x6179('0xe'))][(_0x6179('0xf'))]({'name':util[_0x6179('0x6')]('%s-%s',_0x5401a6,_0x6179('0x10')),'filename':filename(_0x5401a6,'error'),'level':_0x6179('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x37a568){return formatter(_0x5401a6,_0x37a568);}}),new winston[(_0x6179('0xe'))]['File']({'name':util[_0x6179('0x6')]('%s-%s',_0x5401a6,_0x6179('0x11')),'filename':filename(_0x5401a6,'info'),'level':_0x6179('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x451675){return formatter(_0x5401a6,_0x451675);}}),new winston[(_0x6179('0xe'))][(_0x6179('0x12'))]({'level':process['env'][_0x6179('0x13')]||debugLevel,'json':![],'formatter':function(_0x50483b){return formatter(_0x5401a6,_0x50483b);}})]});}; \ No newline at end of file +var _0xf1f5=['INFO','join','/var','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','message','Logger','File','%s-%s','error','transports','info','Console','env','moment','util','path'];(function(_0xa68cd9,_0x35b670){var _0x567abc=function(_0xad8435){while(--_0xad8435){_0xa68cd9['push'](_0xa68cd9['shift']());}};_0x567abc(++_0x35b670);}(_0xf1f5,0xe4));var _0x5f1f=function(_0x764c9,_0x3b04b7){_0x764c9=_0x764c9-0x0;var _0x537c82=_0xf1f5[_0x764c9];return _0x537c82;};'use strict';var moment=require(_0x5f1f('0x0'));var winston=require('winston');var util=require(_0x5f1f('0x1'));var path=require(_0x5f1f('0x2'));var debugLevel=_0x5f1f('0x3');function filename(_0x8fac06,_0xc4a086){return path[_0x5f1f('0x4')](_0x5f1f('0x5'),'log',_0x5f1f('0x6'),util[_0x5f1f('0x7')](_0x5f1f('0x8'),_0x8fac06,_0xc4a086));}function formatter(_0x32d996,_0x201eb3){return util[_0x5f1f('0x7')](_0x5f1f('0x9'),moment()[_0x5f1f('0x7')](_0x5f1f('0xa')),_0x201eb3[_0x5f1f('0xb')]['toUpperCase'](),_0x32d996,_0x201eb3[_0x5f1f('0xc')]);}module['exports']=function(_0x1d5c2f){return new winston[(_0x5f1f('0xd'))]({'transports':[new winston['transports'][(_0x5f1f('0xe'))]({'name':util['format'](_0x5f1f('0xf'),_0x1d5c2f,_0x5f1f('0x10')),'filename':filename(_0x1d5c2f,'error'),'level':_0x5f1f('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x33e6df){return formatter(_0x1d5c2f,_0x33e6df);}}),new winston[(_0x5f1f('0x11'))][(_0x5f1f('0xe'))]({'name':util[_0x5f1f('0x7')](_0x5f1f('0xf'),_0x1d5c2f,_0x5f1f('0x12')),'filename':filename(_0x1d5c2f,_0x5f1f('0x12')),'level':_0x5f1f('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1f1a74){return formatter(_0x1d5c2f,_0x1f1a74);}}),new winston[(_0x5f1f('0x11'))][(_0x5f1f('0x13'))]({'level':process[_0x5f1f('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x423915){return formatter(_0x1d5c2f,_0x423915);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 6bd8e9e..ec3c752 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 _0xc252=['../../services/routing/index.js','xdr','path','express','ami','join','../../services/agi/index.js','email','routing'];(function(_0x53d500,_0x16510b){var _0x1f675a=function(_0x33ae67){while(--_0x33ae67){_0x53d500['push'](_0x53d500['shift']());}};_0x1f675a(++_0x16510b);}(_0xc252,0x134));var _0x2c25=function(_0x1a52fe,_0x3c99b3){_0x1a52fe=_0x1a52fe-0x0;var _0x4dc100=_0xc252[_0x1a52fe];return _0x4dc100;};'use strict';var path=require(_0x2c25('0x0'));var os=require('os');var config={'apps':[{'name':_0x2c25('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x2c25('0x2'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x2c25('0x3')](__dirname,_0x2c25('0x4'))},{'name':_0x2c25('0x5'),'script':path[_0x2c25('0x3')](__dirname,'../../services/email/index.js')},{'name':_0x2c25('0x6'),'script':path[_0x2c25('0x3')](__dirname,_0x2c25('0x7'))},{'name':_0x2c25('0x8'),'script':path[_0x2c25('0x3')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file +var _0x1d4d=['../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x3eb090,_0x77fbba){var _0x4b0253=function(_0x25254f){while(--_0x25254f){_0x3eb090['push'](_0x3eb090['shift']());}};_0x4b0253(++_0x77fbba);}(_0x1d4d,0x160));var _0xd1d4=function(_0x4b12b5,_0x1dfec2){_0x4b12b5=_0x4b12b5-0x0;var _0x331a76=_0x1d4d[_0x4b12b5];return _0x331a76;};'use strict';var path=require(_0xd1d4('0x0'));var os=require('os');var config={'apps':[{'name':_0xd1d4('0x1'),'script':path[_0xd1d4('0x2')](__dirname,_0xd1d4('0x3'))},{'name':_0xd1d4('0x4'),'script':path[_0xd1d4('0x2')](__dirname,_0xd1d4('0x5'))},{'name':_0xd1d4('0x6'),'script':path[_0xd1d4('0x2')](__dirname,_0xd1d4('0x7'))},{'name':'email','script':path[_0xd1d4('0x2')](__dirname,_0xd1d4('0x8'))},{'name':_0xd1d4('0x9'),'script':path[_0xd1d4('0x2')](__dirname,_0xd1d4('0xa'))},{'name':_0xd1d4('0xb'),'script':path['join'](__dirname,_0xd1d4('0xc'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 2ef1859..55619e2 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 _0x7217=['connect','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config'];(function(_0x481f71,_0x1f61b0){var _0x4f1e44=function(_0x3d6943){while(--_0x3d6943){_0x481f71['push'](_0x481f71['shift']());}};_0x4f1e44(++_0x1f61b0);}(_0x7217,0x19e));var _0x7721=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7217[_0x37c22c];return _0x119d79;};'use strict';var pm2=require(_0x7721('0x0'));var BPromise=require('bluebird');var config=require(_0x7721('0x1'));function connect(){return new BPromise(function(_0x4170dd,_0x1de988){return pm2[_0x7721('0x2')](function(_0x115ab3){if(_0x115ab3){return _0x1de988(_0x115ab3);}return _0x4170dd('connected');});});};exports['start']=function(_0x472a96){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x46415c,_0x3fe47c){return pm2[_0x7721('0x4')](_0x472a96,function(_0xf7ff37,_0x18ab6b){if(_0xf7ff37){return _0x3fe47c(_0xf7ff37);}pm2[_0x7721('0x5')]();return _0x46415c(_0x18ab6b);});});});};exports[_0x7721('0x6')]=function(_0x2f99ed){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x2a66cb,_0xfa8835){return pm2[_0x7721('0x6')](_0x2f99ed,function(_0x2c3986,_0x578d59){if(_0x2c3986){return _0xfa8835(_0x2c3986);}pm2[_0x7721('0x5')]();return _0x2a66cb(_0x578d59);});});});};exports[_0x7721('0x7')]=function(_0x8729a6){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0xa8977c,_0x409b37){return pm2[_0x7721('0x7')](_0x8729a6,function(_0x27b36b,_0x55b4ca){if(_0x27b36b){return _0x409b37(_0x27b36b);}pm2[_0x7721('0x5')]();return _0xa8977c(_0x55b4ca);});});});};exports[_0x7721('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x109900,_0x30da54){return pm2[_0x7721('0x8')](function(_0x2e9752,_0x5069da){if(_0x2e9752){return _0x30da54(_0x2e9752);}pm2[_0x7721('0x5')]();return _0x109900(_0x5069da);});});});};exports[_0x7721('0x9')]=function(_0x534f1b){return connect()['then'](function(){return new BPromise(function(_0x4b183e,_0x5ed54){return pm2[_0x7721('0x9')](_0x534f1b,function(_0x3cc909,_0x32550d){if(_0x3cc909){return _0x5ed54(_0x3cc909);}pm2['disconnect']();return _0x4b183e(_0x32550d);});});});};exports[_0x7721('0xa')]=function(_0x54a838){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x5cb0e6,_0xfec626){return pm2[_0x7721('0xa')](_0x54a838,function(_0x3ab5a5,_0x3e140d){if(_0x3ab5a5){return _0xfec626(_0x3ab5a5);}pm2[_0x7721('0x5')]();return _0x5cb0e6(_0x3e140d);});});});};exports[_0x7721('0xb')]=function(){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x413263,_0x3b29ac){return pm2[_0x7721('0xb')](function(_0x4ce1db){if(_0x4ce1db){return _0x3b29ac(_0x4ce1db);}return _0x413263(_0x7721('0xc'));});});});}; \ No newline at end of file +var _0x34e8=['stop','restart','list','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect'];(function(_0x50182c,_0x51f1db){var _0x5819c8=function(_0x1fdd7c){while(--_0x1fdd7c){_0x50182c['push'](_0x50182c['shift']());}};_0x5819c8(++_0x51f1db);}(_0x34e8,0x12c));var _0x834e=function(_0x51c224,_0x1615c1){_0x51c224=_0x51c224-0x0;var _0x448dd8=_0x34e8[_0x51c224];return _0x448dd8;};'use strict';var pm2=require(_0x834e('0x0'));var BPromise=require(_0x834e('0x1'));var config=require(_0x834e('0x2'));function connect(){return new BPromise(function(_0x35e6fb,_0x530939){return pm2[_0x834e('0x3')](function(_0x21e2e0){if(_0x21e2e0){return _0x530939(_0x21e2e0);}return _0x35e6fb(_0x834e('0x4'));});});};exports[_0x834e('0x5')]=function(_0x289ef2){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x398bee,_0x4a2018){return pm2[_0x834e('0x5')](_0x289ef2,function(_0x52056d,_0x3e16d2){if(_0x52056d){return _0x4a2018(_0x52056d);}pm2[_0x834e('0x7')]();return _0x398bee(_0x3e16d2);});});});};exports[_0x834e('0x8')]=function(_0x2e69e2){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x23501c,_0x363786){return pm2[_0x834e('0x8')](_0x2e69e2,function(_0x3bdda9,_0x186b3b){if(_0x3bdda9){return _0x363786(_0x3bdda9);}pm2[_0x834e('0x7')]();return _0x23501c(_0x186b3b);});});});};exports[_0x834e('0x9')]=function(_0x14038b){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x293514,_0x1e00de){return pm2[_0x834e('0x9')](_0x14038b,function(_0x538bb3,_0x5e5b6d){if(_0x538bb3){return _0x1e00de(_0x538bb3);}pm2[_0x834e('0x7')]();return _0x293514(_0x5e5b6d);});});});};exports['list']=function(){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x2d95f2,_0x28e659){return pm2[_0x834e('0xa')](function(_0x50e860,_0x43156c){if(_0x50e860){return _0x28e659(_0x50e860);}pm2[_0x834e('0x7')]();return _0x2d95f2(_0x43156c);});});});};exports['describe']=function(_0x316205){return connect()['then'](function(){return new BPromise(function(_0x38a8cd,_0x36d443){return pm2['describe'](_0x316205,function(_0x43ac41,_0x22106e){if(_0x43ac41){return _0x36d443(_0x43ac41);}pm2[_0x834e('0x7')]();return _0x38a8cd(_0x22106e);});});});};exports['delete']=function(_0x283e56){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x34e41a,_0xb993a1){return pm2[_0x834e('0xb')](_0x283e56,function(_0x254677,_0x1dd214){if(_0x254677){return _0xb993a1(_0x254677);}pm2['disconnect']();return _0x34e41a(_0x1dd214);});});});};exports[_0x834e('0xc')]=function(){return connect()[_0x834e('0x6')](function(){return new BPromise(function(_0x113ff4,_0x325a99){return pm2['dump'](function(_0x45a630){if(_0x45a630){return _0x325a99(_0x45a630);}return _0x113ff4(_0x834e('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index fb18880..7b236df 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 _0x37b4=['lastMsgAt','subtract','minutes','ChatInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','catch','error','start','lodash','ioredis','../../mysqldb','../../config/environment','defaults','redis','localhost','socket.io-emitter','find','then','chatTimeout'];(function(_0x304bd5,_0xea943d){var _0x2bcd87=function(_0x53d3c5){while(--_0x53d3c5){_0x304bd5['push'](_0x304bd5['shift']());}};_0x2bcd87(++_0xea943d);}(_0x37b4,0xef));var _0x437b=function(_0xee209,_0x4858f4){_0xee209=_0xee209-0x0;var _0x48cd8c=_0x37b4[_0xee209];return _0x48cd8c;};'use strict';var _=require(_0x437b('0x0'));var moment=require('moment');var Redis=require(_0x437b('0x1'));var db=require(_0x437b('0x2'))['db'];var config=require(_0x437b('0x3'));config['redis']=_[_0x437b('0x4')](config[_0x437b('0x5')],{'host':_0x437b('0x6'),'port':0x18eb});var io=require(_0x437b('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x4d48c2=0x0;var _0x1bab79=[];return db['Setting'][_0x437b('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x437b('0x9')](function(_0x5df980){_0x4d48c2=_0x5df980[_0x437b('0xa')];if(_0x4d48c2){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x437b('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x437b('0xc')](_0x5df980['chatTimeout'],_0x437b('0xd'))}}});}else{return[];}})['then'](function(_0x4d5ec1){_0x1bab79=_0x4d5ec1;if(_0x4d48c2){return db[_0x437b('0xe')][_0x437b('0xf')]({'closeReason':_0x437b('0x10'),'disposition':_0x437b('0x11'),'closed':!![],'closedAt':moment()['format'](_0x437b('0x12'))},{'where':{'id':_[_0x437b('0x13')](_0x1bab79||[],'id')}});}})[_0x437b('0x9')](function(_0x5aa4d2){for(var _0x90c515=0x0;_0x90c515<_0x1bab79[_0x437b('0x14')];_0x90c515++){io[_0x437b('0x15')]('chatInteraction:update',{'id':_0x1bab79[_0x90c515]['id'],'closed':!![]});}})[_0x437b('0x16')](function(_0x56524c){console[_0x437b('0x17')](_0x56524c);});}exports[_0x437b('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x99b7=['find','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','then','timeout','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','catch','error','lodash','ioredis','defaults','redis','localhost','Setting'];(function(_0x4898c6,_0x1b522e){var _0x24c638=function(_0x15995c){while(--_0x15995c){_0x4898c6['push'](_0x4898c6['shift']());}};_0x24c638(++_0x1b522e);}(_0x99b7,0x14e));var _0x799b=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x99b7[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x799b('0x0'));var moment=require('moment');var Redis=require(_0x799b('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');config['redis']=_[_0x799b('0x2')](config[_0x799b('0x3')],{'host':_0x799b('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x799b('0x3')]));function closeInteractions(){var _0x1f8594=0x0;var _0x3959ed=[];return db[_0x799b('0x5')][_0x799b('0x6')]({'raw':!![],'attributes':['id',_0x799b('0x7')],'where':{'id':0x1}})['then'](function(_0x418a70){_0x1f8594=_0x418a70[_0x799b('0x7')];if(_0x1f8594){return db[_0x799b('0x8')][_0x799b('0x9')]({'raw':!![],'attributes':['id',_0x799b('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x418a70[_0x799b('0x7')],_0x799b('0xb'))}}});}else{return[];}})[_0x799b('0xc')](function(_0x4e4525){_0x3959ed=_0x4e4525;if(_0x1f8594){return db[_0x799b('0x8')]['update']({'closeReason':'system','disposition':_0x799b('0xd'),'closed':!![],'closedAt':moment()['format'](_0x799b('0xe'))},{'where':{'id':_['map'](_0x3959ed||[],'id')}});}})[_0x799b('0xc')](function(_0x4a6d53){for(var _0x4cdb0d=0x0;_0x4cdb0d<_0x3959ed[_0x799b('0xf')];_0x4cdb0d++){io[_0x799b('0x10')](_0x799b('0x11'),{'id':_0x3959ed[_0x4cdb0d]['id'],'closed':!![]});}})[_0x799b('0x12')](function(_0x3fbf4a){console[_0x799b('0x13')](_0x3fbf4a);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 6fb8b98..91727e8 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 _0x7451=['intersection','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update\x20cron','run','path','lodash','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','zip','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','email','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','name','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','toString','keyBy','difference'];(function(_0x1a9428,_0x42a5e3){var _0x5c5e78=function(_0x91e6b2){while(--_0x91e6b2){_0x1a9428['push'](_0x1a9428['shift']());}};_0x5c5e78(++_0x42a5e3);}(_0x7451,0x11e));var _0x1745=function(_0x2651e0,_0x4ba3e3){_0x2651e0=_0x2651e0-0x0;var _0x5d1c2b=_0x7451[_0x2651e0];return _0x5d1c2b;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x1745('0x0'));var _=require(_0x1745('0x1'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x1745('0x2'));var BPromise=require(_0x1745('0x3'));var logger=require(_0x1745('0x4'))(_0x1745('0x5'));var db=require(_0x1745('0x6'))['db'];var analyticCustomReportController=require(_0x1745('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1745('0x8')][_0x1745('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x45ecba,_0x300ebb){return function(){logger[_0x1745('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x45ecba['email']);var _0x30b5a9=!![];var _0x16fd52={'tls':{'rejectUnauthorized':![]}};if(_0x45ecba[_0x1745('0xb')][_0x1745('0xc')][_0x1745('0xd')]){_0x16fd52[_0x1745('0xd')]=_0x45ecba[_0x1745('0xb')][_0x1745('0xc')][_0x1745('0xd')];}else{_0x16fd52['host']=_0x45ecba[_0x1745('0xb')][_0x1745('0xc')][_0x1745('0xe')];_0x16fd52[_0x1745('0xf')]=_0x45ecba[_0x1745('0xb')][_0x1745('0xc')][_0x1745('0xf')];_0x16fd52[_0x1745('0x10')]=_0x45ecba[_0x1745('0xb')][_0x1745('0xc')][_0x1745('0x10')];}if(_0x45ecba[_0x1745('0xb')][_0x1745('0xc')][_0x1745('0x11')]){_0x16fd52[_0x1745('0x12')]={'user':_0x45ecba['MailAccount'][_0x1745('0xc')][_0x1745('0x13')],'pass':_0x45ecba[_0x1745('0xb')]['Smtp'][_0x1745('0x14')]};}var _0x1b6a71={'account':_0x16fd52,'message':{'from':util[_0x1745('0x15')](_0x1745('0x16'),_0x45ecba['MailAccount']['name'],_0x45ecba[_0x1745('0xb')]['email']||_0x45ecba[_0x1745('0xb')]['Smtp'][_0x1745('0x13')]),'to':_0x45ecba['email'],'cc':_0x45ecba['cc'],'bcc':_0x45ecba[_0x1745('0x17')],'subject':util[_0x1745('0x15')]('Report\x20%s\x20last\x20%s\x20%s',_0x300ebb['name'],_0x45ecba[_0x1745('0x18')],_0x45ecba[_0x1745('0x19')])}};var _0x4ee4b7=path[_0x1745('0x1a')](__dirname,_0x1745('0x1b'));var _0xf26188=_0x300ebb[_0x1745('0x1c')];var _0x313516=util[_0x1745('0x15')]('%s.%s',path[_0x1745('0x1d')](_0x300ebb['savename'],path[_0x1745('0x1e')](_0x300ebb[_0x1745('0x1c')])),_0x1745('0x1f'));var _0x5e2981=path[_0x1745('0x1a')](_0x4ee4b7,_0xf26188);var _0x10075b=path[_0x1745('0x1a')](_0x4ee4b7,_0x313516);if(fs['existsSync'](_0x5e2981)){_0x300ebb['status']=_0x1745('0x20');_0x1b6a71[_0x1745('0x21')][_0x1745('0x22')]=[{'filename':_0xf26188,'path':_0x5e2981}];_0x1b6a71[_0x1745('0x21')][_0x1745('0x23')]=util[_0x1745('0x15')](_0x1745('0x24'),JSON[_0x1745('0x25')](_0x300ebb,null,0x2));}else if(fs[_0x1745('0x26')](_0x10075b)){_0x300ebb[_0x1745('0x27')]='Sent';_0x1b6a71[_0x1745('0x21')][_0x1745('0x22')]=[{'filename':_0x313516,'path':_0x10075b}];}else{_0x1b6a71['message']['text']=_0x1745('0x28');if(!_0x45ecba['sendIfEmpty']){_0x30b5a9=![];logger[_0x1745('0xa')](_0x1745('0x29'));}}if(_0x30b5a9){return client[_0x1745('0x2a')](_0x1745('0x2b'),_0x1b6a71)[_0x1745('0x2c')](function(_0xe8c15){if(_0xe8c15['error']){return logger[_0x1745('0x2d')](_0x1745('0x2e'),JSON[_0x1745('0x25')](_0xe8c15));}return logger[_0x1745('0xa')](_0x1745('0x2f'));})[_0x1745('0x30')](function(_0x35e91f){return logger[_0x1745('0x2d')]('error\x20mail',JSON['stringify'](_0x35e91f));});}};}function handleError(){return function(_0x41d6c0){return logger[_0x1745('0x2d')](JSON[_0x1745('0x25')](_0x41d6c0));};}function handleResult(_0x2b9d69){return function(_0x9bc635){logger[_0x1745('0xa')]('data',JSON[_0x1745('0x25')](_0x9bc635));if(_0x2b9d69[_0x1745('0xb')]&&_0x2b9d69[_0x1745('0xb')][_0x1745('0xc')]&&!_[_0x1745('0x31')](_0x2b9d69[_0x1745('0x32')])){setTimeout(handleSendEmail(_0x2b9d69,_0x9bc635),0x3c*0x3e8);}};}function handleJob(_0x3992bb){return function(){try{if(_[_0x1745('0x31')](_0x3992bb[_0x1745('0x18')])){return logger[_0x1745('0xa')](_0x1745('0x33'));}if(_[_0x1745('0x31')](_0x3992bb['subtractUnit'])){return logger[_0x1745('0xa')](_0x1745('0x34'));}var _0x8db812={'startDate':moment()[_0x1745('0x35')](_0x3992bb[_0x1745('0x18')],_0x3992bb[_0x1745('0x19')])[_0x1745('0x15')](_0x1745('0x36')),'endDate':moment()[_0x1745('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x3992bb[_0x1745('0x37')],'name':_0x3992bb[_0x1745('0x38')]};if(!_['isNil'](_0x3992bb[_0x1745('0x39')])){logger[_0x1745('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x3992bb[_0x1745('0x39')]);return analyticDefaultReportController['runReport']({'id':_0x3992bb[_0x1745('0x39')]},_0x8db812)[_0x1745('0x2c')](handleResult(_0x3992bb))['catch'](handleError());}if(!_[_0x1745('0x31')](_0x3992bb[_0x1745('0x3a')])){logger[_0x1745('0xa')](_0x1745('0x3b'),_0x3992bb[_0x1745('0x3a')]);return analyticCustomReportController[_0x1745('0x3c')]({'id':_0x3992bb[_0x1745('0x3a')]},_0x8db812)[_0x1745('0x2c')](handleResult(_0x3992bb))[_0x1745('0x30')](handleError());}}catch(_0x42d633){logger[_0x1745('0x2d')](JSON[_0x1745('0x25')](_0x42d633));}return logger[_0x1745('0xa')](_0x1745('0x3d'));};}function getJobs(_0x24ef69){var _0x5284b4={};if(_0x24ef69){_0x5284b4['id']=_0x24ef69;}return db[_0x1745('0x3e')][_0x1745('0x3f')]({'where':_0x5284b4,'include':[{'model':db[_0x1745('0xb')],'attributes':['id',_0x1745('0x38'),'email'],'include':[{'model':db[_0x1745('0x40')],'as':_0x1745('0xc')}]}]})['then'](function(_0x30d21d){var _0x1b107b=_[_0x1745('0x41')](manager[_0x1745('0x42')]);var _0x36605b=_['map'](_0x30d21d,function(_0x409ab9){return _0x409ab9['id'][_0x1745('0x43')]();});var _0x10965c=_[_0x1745('0x44')](_0x30d21d,function(_0xf2641e){return _0xf2641e['id'][_0x1745('0x43')]();});var _0x487108=_0x24ef69?_0x36605b:_[_0x1745('0x45')](_0x36605b,_0x1b107b);var _0x3a7000=_[_0x1745('0x46')](_0x36605b,_0x1b107b);var _0x23b620=_[_0x1745('0x45')](_0x1b107b,_0x36605b);var _0x2596e4;var _0x5f33ae;for(_0x2596e4=0x0;_0x2596e4<_0x23b620['length']&&!_0x24ef69;_0x2596e4+=0x1){_0x5f33ae=_0x23b620[_0x2596e4]['toString']();if(manager[_0x1745('0x47')](_0x5f33ae)){manager[_0x1745('0x48')](_0x5f33ae);manager[_0x1745('0x49')](_0x5f33ae);logger['info'](_0x1745('0x4a'),_0x5f33ae);}}logger[_0x1745('0xa')](_0x1745('0x4b'),JSON[_0x1745('0x25')](_0x487108));for(_0x2596e4=0x0;_0x2596e4<_0x487108['length'];_0x2596e4+=0x1){_0x5f33ae=_0x487108[_0x2596e4]['toString']();logger[_0x1745('0xa')]('index',_0x5f33ae);if(_0x24ef69){logger[_0x1745('0xa')](_0x1745('0x4c'),_0x24ef69);logger[_0x1745('0xa')](JSON[_0x1745('0x25')](_0x10965c[_0x5f33ae]));BPromise[_0x1745('0x4d')]()[_0x1745('0x2c')](handleJob(_0x10965c[_0x5f33ae]));logger[_0x1745('0xa')]('run\x20job',_0x10965c[_0x5f33ae]['name'],_0x10965c[_0x5f33ae][_0x1745('0x4e')]);}else if(_0x10965c[_0x5f33ae][_0x1745('0x4e')]&&_0x10965c[_0x5f33ae][_0x1745('0x4f')]&&moment()[_0x1745('0x50')](_0x10965c[_0x5f33ae][_0x1745('0x51')],_0x10965c[_0x5f33ae][_0x1745('0x52')])){manager[_0x1745('0x53')](_0x5f33ae,_0x10965c[_0x5f33ae]['cron'],handleJob(_0x10965c[_0x5f33ae]));manager[_0x1745('0x54')](_0x5f33ae);logger['info'](_0x1745('0x55'),_0x10965c[_0x5f33ae]['name'],_0x10965c[_0x5f33ae][_0x1745('0x4e')]);}else if(manager['exists'](_0x5f33ae)){manager['stop'](_0x5f33ae);manager[_0x1745('0x49')](_0x5f33ae);logger[_0x1745('0xa')](_0x1745('0x56'),_0x10965c[_0x5f33ae][_0x1745('0x38')],_0x10965c[_0x5f33ae][_0x1745('0x4e')]);}}for(_0x2596e4=0x0,_0x5f33ae;_0x2596e4<_0x3a7000['length']&&!_0x24ef69;_0x2596e4+=0x1){_0x5f33ae=_0x3a7000[_0x2596e4][_0x1745('0x43')]();if(manager[_0x1745('0x47')](_0x5f33ae)){if(_0x10965c[_0x5f33ae][_0x1745('0x4e')]&&_0x10965c[_0x5f33ae][_0x1745('0x4f')]&&moment()[_0x1745('0x50')](_0x10965c[_0x5f33ae][_0x1745('0x51')],_0x10965c[_0x5f33ae][_0x1745('0x52')])){manager['update'](_0x5f33ae,_0x10965c[_0x5f33ae][_0x1745('0x4e')],handleJob(_0x10965c[_0x5f33ae]));logger[_0x1745('0xa')](_0x1745('0x57'),_0x10965c[_0x5f33ae][_0x1745('0x38')],_0x10965c[_0x5f33ae][_0x1745('0x4e')]);}else{manager['stop'](_0x5f33ae);manager[_0x1745('0x49')](_0x5f33ae);logger[_0x1745('0xa')](_0x1745('0x56'),_0x10965c[_0x5f33ae][_0x1745('0x38')],_0x10965c[_0x5f33ae][_0x1745('0x4e')]);}}}})[_0x1745('0x30')](function(_0x2aa8fe){logger[_0x1745('0x2d')](JSON[_0x1745('0x25')](_0x2aa8fe));});}exports[_0x1745('0x58')]=function(_0x31be6c){return getJobs(_0x31be6c);};exports[_0x1745('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xbfa6=['output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','Schedule','findAll','keys','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','my\x20id','resolve','run\x20job','cron','active','isBetween','add','add\x20cron','stop\x20cron','endAt','update','run','util','path','lodash','moment','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','../../files/reports','savename','%s.%s','basename','zip','join','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','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','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e0ef0,_0x51986b){var _0x322677=function(_0x5609ce){while(--_0x5609ce){_0x3e0ef0['push'](_0x3e0ef0['shift']());}};_0x322677(++_0x51986b);}(_0xbfa6,0x1d1));var _0x6bfa=function(_0x2335e6,_0x1bade8){_0x2335e6=_0x2335e6-0x0;var _0x370a50=_0xbfa6[_0x2335e6];return _0x370a50;};'use strict';var fs=require('fs');var util=require(_0x6bfa('0x0'));var path=require(_0x6bfa('0x1'));var _=require(_0x6bfa('0x2'));var moment=require(_0x6bfa('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x6bfa('0x4'));var BPromise=require('bluebird');var logger=require(_0x6bfa('0x5'))(_0x6bfa('0x6'));var db=require(_0x6bfa('0x7'))['db'];var analyticCustomReportController=require(_0x6bfa('0x8'));var analyticDefaultReportController=require(_0x6bfa('0x9'));var client=jayson[_0x6bfa('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x11c66d,_0x5dec97){return function(){logger['info'](_0x6bfa('0xb'),_0x11c66d[_0x6bfa('0xc')]);var _0x1320b2=!![];var _0x417d2c={'tls':{'rejectUnauthorized':![]}};if(_0x11c66d['MailAccount'][_0x6bfa('0xd')][_0x6bfa('0xe')]){_0x417d2c[_0x6bfa('0xe')]=_0x11c66d[_0x6bfa('0xf')][_0x6bfa('0xd')][_0x6bfa('0xe')];}else{_0x417d2c[_0x6bfa('0x10')]=_0x11c66d[_0x6bfa('0xf')][_0x6bfa('0xd')][_0x6bfa('0x10')];_0x417d2c[_0x6bfa('0x11')]=_0x11c66d[_0x6bfa('0xf')][_0x6bfa('0xd')][_0x6bfa('0x11')];_0x417d2c['secure']=_0x11c66d[_0x6bfa('0xf')][_0x6bfa('0xd')]['secure'];}if(_0x11c66d[_0x6bfa('0xf')][_0x6bfa('0xd')]['authentication']){_0x417d2c[_0x6bfa('0x12')]={'user':_0x11c66d[_0x6bfa('0xf')][_0x6bfa('0xd')][_0x6bfa('0x13')],'pass':_0x11c66d[_0x6bfa('0xf')][_0x6bfa('0xd')][_0x6bfa('0x14')]};}var _0x9685b0={'account':_0x417d2c,'message':{'from':util[_0x6bfa('0x15')](_0x6bfa('0x16'),_0x11c66d[_0x6bfa('0xf')]['name'],_0x11c66d[_0x6bfa('0xf')][_0x6bfa('0xc')]||_0x11c66d[_0x6bfa('0xf')][_0x6bfa('0xd')][_0x6bfa('0x13')]),'to':_0x11c66d[_0x6bfa('0xc')],'cc':_0x11c66d['cc'],'bcc':_0x11c66d[_0x6bfa('0x17')],'subject':util[_0x6bfa('0x15')](_0x6bfa('0x18'),_0x5dec97[_0x6bfa('0x19')],_0x11c66d['subtractNumber'],_0x11c66d['subtractUnit'])}};var _0x2c3a25=path['join'](__dirname,_0x6bfa('0x1a'));var _0x253304=_0x5dec97[_0x6bfa('0x1b')];var _0x236f7e=util[_0x6bfa('0x15')](_0x6bfa('0x1c'),path[_0x6bfa('0x1d')](_0x5dec97['savename'],path['extname'](_0x5dec97[_0x6bfa('0x1b')])),_0x6bfa('0x1e'));var _0x3ac35a=path[_0x6bfa('0x1f')](_0x2c3a25,_0x253304);var _0x484f6b=path['join'](_0x2c3a25,_0x236f7e);if(fs[_0x6bfa('0x20')](_0x3ac35a)){_0x5dec97[_0x6bfa('0x21')]=_0x6bfa('0x22');_0x9685b0[_0x6bfa('0x23')][_0x6bfa('0x24')]=[{'filename':_0x253304,'path':_0x3ac35a}];_0x9685b0['message'][_0x6bfa('0x25')]=util['format'](_0x6bfa('0x26'),JSON[_0x6bfa('0x27')](_0x5dec97,null,0x2));}else if(fs[_0x6bfa('0x20')](_0x484f6b)){_0x5dec97[_0x6bfa('0x21')]=_0x6bfa('0x22');_0x9685b0[_0x6bfa('0x23')][_0x6bfa('0x24')]=[{'filename':_0x236f7e,'path':_0x484f6b}];}else{_0x9685b0[_0x6bfa('0x23')]['text']=_0x6bfa('0x28');if(!_0x11c66d[_0x6bfa('0x29')]){_0x1320b2=![];logger[_0x6bfa('0x2a')](_0x6bfa('0x2b'));}}if(_0x1320b2){return client[_0x6bfa('0x2c')]('SendMail',_0x9685b0)[_0x6bfa('0x2d')](function(_0x2c3fc5){if(_0x2c3fc5[_0x6bfa('0x2e')]){return logger[_0x6bfa('0x2e')](_0x6bfa('0x2f'),JSON[_0x6bfa('0x27')](_0x2c3fc5));}return logger['info'](_0x6bfa('0x30'));})[_0x6bfa('0x31')](function(_0x1ce721){return logger[_0x6bfa('0x2e')]('error\x20mail',JSON[_0x6bfa('0x27')](_0x1ce721));});}};}function handleError(){return function(_0x189ba9){return logger[_0x6bfa('0x2e')](JSON[_0x6bfa('0x27')](_0x189ba9));};}function handleResult(_0x560b78){return function(_0x5036c0){logger[_0x6bfa('0x2a')](_0x6bfa('0x32'),JSON['stringify'](_0x5036c0));if(_0x560b78['MailAccount']&&_0x560b78[_0x6bfa('0xf')][_0x6bfa('0xd')]&&!_[_0x6bfa('0x33')](_0x560b78[_0x6bfa('0xc')])){setTimeout(handleSendEmail(_0x560b78,_0x5036c0),0x3c*0x3e8);}};}function handleJob(_0x5f4dd4){return function(){try{if(_[_0x6bfa('0x33')](_0x5f4dd4[_0x6bfa('0x34')])){return logger[_0x6bfa('0x2a')](_0x6bfa('0x35'));}if(_[_0x6bfa('0x33')](_0x5f4dd4[_0x6bfa('0x36')])){return logger[_0x6bfa('0x2a')](_0x6bfa('0x37'));}var _0x5a7e8c={'startDate':moment()['subtract'](_0x5f4dd4['subtractNumber'],_0x5f4dd4[_0x6bfa('0x36')])[_0x6bfa('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x6bfa('0x38')),'type':'scheduled','output':_0x5f4dd4[_0x6bfa('0x39')],'name':_0x5f4dd4[_0x6bfa('0x19')]};if(!_[_0x6bfa('0x33')](_0x5f4dd4[_0x6bfa('0x3a')])){logger[_0x6bfa('0x2a')](_0x6bfa('0x3b'),_0x5f4dd4[_0x6bfa('0x3a')]);return analyticDefaultReportController[_0x6bfa('0x3c')]({'id':_0x5f4dd4[_0x6bfa('0x3a')]},_0x5a7e8c)[_0x6bfa('0x2d')](handleResult(_0x5f4dd4))[_0x6bfa('0x31')](handleError());}if(!_[_0x6bfa('0x33')](_0x5f4dd4[_0x6bfa('0x3d')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x5f4dd4[_0x6bfa('0x3d')]);return analyticCustomReportController[_0x6bfa('0x3c')]({'id':_0x5f4dd4['CustomReportId']},_0x5a7e8c)[_0x6bfa('0x2d')](handleResult(_0x5f4dd4))['catch'](handleError());}}catch(_0x5515c4){logger[_0x6bfa('0x2e')](JSON['stringify'](_0x5515c4));}return logger[_0x6bfa('0x2a')]('no\x20report\x20id');};}function getJobs(_0x387c7e){var _0x4c0651={};if(_0x387c7e){_0x4c0651['id']=_0x387c7e;}return db[_0x6bfa('0x3e')][_0x6bfa('0x3f')]({'where':_0x4c0651,'include':[{'model':db[_0x6bfa('0xf')],'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':_0x6bfa('0xd')}]}]})[_0x6bfa('0x2d')](function(_0x25dadb){var _0x5e118d=_[_0x6bfa('0x40')](manager['jobs']);var _0x378ebd=_[_0x6bfa('0x41')](_0x25dadb,function(_0x36aa0d){return _0x36aa0d['id'][_0x6bfa('0x42')]();});var _0x23a0de=_[_0x6bfa('0x43')](_0x25dadb,function(_0x8a4b2f){return _0x8a4b2f['id'][_0x6bfa('0x42')]();});var _0x2b78f9=_0x387c7e?_0x378ebd:_[_0x6bfa('0x44')](_0x378ebd,_0x5e118d);var _0x5e0c2b=_[_0x6bfa('0x45')](_0x378ebd,_0x5e118d);var _0x53e52a=_[_0x6bfa('0x44')](_0x5e118d,_0x378ebd);var _0x249e65;var _0x83a821;for(_0x249e65=0x0;_0x249e65<_0x53e52a[_0x6bfa('0x46')]&&!_0x387c7e;_0x249e65+=0x1){_0x83a821=_0x53e52a[_0x249e65]['toString']();if(manager[_0x6bfa('0x47')](_0x83a821)){manager[_0x6bfa('0x48')](_0x83a821);manager[_0x6bfa('0x49')](_0x83a821);logger[_0x6bfa('0x2a')](_0x6bfa('0x4a'),_0x83a821);}}logger[_0x6bfa('0x2a')]('toRun',JSON['stringify'](_0x2b78f9));for(_0x249e65=0x0;_0x249e65<_0x2b78f9[_0x6bfa('0x46')];_0x249e65+=0x1){_0x83a821=_0x2b78f9[_0x249e65]['toString']();logger[_0x6bfa('0x2a')]('index',_0x83a821);if(_0x387c7e){logger[_0x6bfa('0x2a')](_0x6bfa('0x4b'),_0x387c7e);logger[_0x6bfa('0x2a')](JSON['stringify'](_0x23a0de[_0x83a821]));BPromise[_0x6bfa('0x4c')]()[_0x6bfa('0x2d')](handleJob(_0x23a0de[_0x83a821]));logger['info'](_0x6bfa('0x4d'),_0x23a0de[_0x83a821][_0x6bfa('0x19')],_0x23a0de[_0x83a821][_0x6bfa('0x4e')]);}else if(_0x23a0de[_0x83a821][_0x6bfa('0x4e')]&&_0x23a0de[_0x83a821][_0x6bfa('0x4f')]&&moment()[_0x6bfa('0x50')](_0x23a0de[_0x83a821]['startAt'],_0x23a0de[_0x83a821]['endAt'])){manager[_0x6bfa('0x51')](_0x83a821,_0x23a0de[_0x83a821][_0x6bfa('0x4e')],handleJob(_0x23a0de[_0x83a821]));manager['start'](_0x83a821);logger['info'](_0x6bfa('0x52'),_0x23a0de[_0x83a821]['name'],_0x23a0de[_0x83a821][_0x6bfa('0x4e')]);}else if(manager[_0x6bfa('0x47')](_0x83a821)){manager[_0x6bfa('0x48')](_0x83a821);manager['deleteJob'](_0x83a821);logger[_0x6bfa('0x2a')](_0x6bfa('0x53'),_0x23a0de[_0x83a821][_0x6bfa('0x19')],_0x23a0de[_0x83a821][_0x6bfa('0x4e')]);}}for(_0x249e65=0x0,_0x83a821;_0x249e65<_0x5e0c2b[_0x6bfa('0x46')]&&!_0x387c7e;_0x249e65+=0x1){_0x83a821=_0x5e0c2b[_0x249e65][_0x6bfa('0x42')]();if(manager['exists'](_0x83a821)){if(_0x23a0de[_0x83a821][_0x6bfa('0x4e')]&&_0x23a0de[_0x83a821]['active']&&moment()[_0x6bfa('0x50')](_0x23a0de[_0x83a821]['startAt'],_0x23a0de[_0x83a821][_0x6bfa('0x54')])){manager[_0x6bfa('0x55')](_0x83a821,_0x23a0de[_0x83a821][_0x6bfa('0x4e')],handleJob(_0x23a0de[_0x83a821]));logger[_0x6bfa('0x2a')]('update\x20cron',_0x23a0de[_0x83a821]['name'],_0x23a0de[_0x83a821]['cron']);}else{manager['stop'](_0x83a821);manager['deleteJob'](_0x83a821);logger[_0x6bfa('0x2a')](_0x6bfa('0x53'),_0x23a0de[_0x83a821][_0x6bfa('0x19')],_0x23a0de[_0x83a821][_0x6bfa('0x4e')]);}}}})[_0x6bfa('0x31')](function(_0x56b91f){logger[_0x6bfa('0x2e')](JSON[_0x6bfa('0x27')](_0x56b91f));});}exports[_0x6bfa('0x56')]=function(_0x3ecd56){return getJobs(_0x3ecd56);};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 a6dbc72..00d8407 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e53=['CmContact','destroy','then','finished\x20populating','CmHopper','bulkCreate','hopper1','log','contacts2','hopper2','catch','util','Innocenzo','innocenzo.biondo','@xcally.com','push','now','Biondo'];(function(_0x404b74,_0x5d6b8b){var _0x321b31=function(_0x53c9bc){while(--_0x53c9bc){_0x404b74['push'](_0x404b74['shift']());}};_0x321b31(++_0x5d6b8b);}(_0x5e53,0xf5));var _0x35e5=function(_0x54f464,_0x46cd21){_0x54f464=_0x54f464-0x0;var _0x244493=_0x5e53[_0x54f464];return _0x244493;};'use strict';var util=require(_0x35e5('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x35e5('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x35e5('0x2')+i+_0x35e5('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x35e5('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x35e5('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x35e5('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x35e5('0x4')]({'id':i,'firstName':_0x35e5('0x1')+i,'lastName':_0x35e5('0x6')+i,'phone':0xf879fb460+i,'email':_0x35e5('0x2')+i+_0x35e5('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x35e5('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x35e5('0x5')](),'updatedAt':Date[_0x35e5('0x5')]()});}db[_0x35e5('0x7')][_0x35e5('0x8')]({'where':{}})[_0x35e5('0x9')](function(){return db[_0x35e5('0x7')]['bulkCreate'](contacts);})[_0x35e5('0x9')](function(){console['log'](_0x35e5('0xa'),'contacts1');return db[_0x35e5('0xb')][_0x35e5('0x8')]({'where':{}});})[_0x35e5('0x9')](function(){return db['CmHopper'][_0x35e5('0xc')](hopper);})['then'](function(){console['log']('finished\x20populating',_0x35e5('0xd'));return db[_0x35e5('0x7')][_0x35e5('0xc')](contacts2);})['then'](function(){console[_0x35e5('0xe')](_0x35e5('0xa'),_0x35e5('0xf'));return db[_0x35e5('0xb')][_0x35e5('0xc')](hopper2);})['then'](function(){console[_0x35e5('0xe')]('finished\x20populating',_0x35e5('0x10'));})[_0x35e5('0x11')](function(_0x583d31){console['log'](_0x583d31);}); \ No newline at end of file +var _0xa8cc=['CmContact','then','bulkCreate','log','finished\x20populating','CmHopper','destroy','hopper1','contacts2','hopper2','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now'];(function(_0x3aac86,_0x51b2d2){var _0x1d3986=function(_0x3fa789){while(--_0x3fa789){_0x3aac86['push'](_0x3aac86['shift']());}};_0x1d3986(++_0x51b2d2);}(_0xa8cc,0xf8));var _0xca8c=function(_0x222185,_0x40228f){_0x222185=_0x222185-0x0;var _0x157f9f=_0xa8cc[_0x222185];return _0x157f9f;};'use strict';var util=require('util');var db=require(_0xca8c('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xca8c('0x1')]({'id':i,'firstName':_0xca8c('0x2')+i,'lastName':_0xca8c('0x3')+i,'phone':0xf879fb460+i,'email':_0xca8c('0x4')+i+_0xca8c('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xca8c('0x1')]({'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[_0xca8c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xca8c('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xca8c('0x4')+i+_0xca8c('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xca8c('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xca8c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xca8c('0x6')](),'updatedAt':Date[_0xca8c('0x6')]()});}db[_0xca8c('0x7')]['destroy']({'where':{}})[_0xca8c('0x8')](function(){return db[_0xca8c('0x7')][_0xca8c('0x9')](contacts);})['then'](function(){console[_0xca8c('0xa')](_0xca8c('0xb'),'contacts1');return db[_0xca8c('0xc')][_0xca8c('0xd')]({'where':{}});})[_0xca8c('0x8')](function(){return db[_0xca8c('0xc')]['bulkCreate'](hopper);})['then'](function(){console['log']('finished\x20populating',_0xca8c('0xe'));return db[_0xca8c('0x7')][_0xca8c('0x9')](contacts2);})[_0xca8c('0x8')](function(){console[_0xca8c('0xa')](_0xca8c('0xb'),_0xca8c('0xf'));return db[_0xca8c('0xc')]['bulkCreate'](hopper2);})[_0xca8c('0x8')](function(){console[_0xca8c('0xa')](_0xca8c('0xb'),_0xca8c('0x10'));})['catch'](function(_0x210f83){console['log'](_0x210f83);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 06daa50..87ff8cb 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6955=['\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','../mysqldb','push','format','agent','udp','all','%s%s','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x693b3d,_0x3b13fe){var _0xa67edd=function(_0x4b76bc){while(--_0x4b76bc){_0x693b3d['push'](_0x693b3d['shift']());}};_0xa67edd(++_0x3b13fe);}(_0x6955,0xf6));var _0x5695=function(_0x26e7c2,_0x569eab){_0x26e7c2=_0x26e7c2-0x0;var _0x2da461=_0x6955[_0x26e7c2];return _0x2da461;};'use strict';var util=require('util');var db=require(_0x5695('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5695('0x1')]({'name':util[_0x5695('0x2')]('%s%s',_0x5695('0x3'),i),'fullname':util[_0x5695('0x2')]('%s%s',_0x5695('0x3'),i),'email':util['format']('%s%s@xcally.com','agent',i),'role':_0x5695('0x3'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x5695('0x4'),'ws','wss'],'disallow':[_0x5695('0x5')],'allow':['ulaw'],'defaultuser':util['format'](_0x5695('0x6'),_0x5695('0x3'),i),'encryption':_0x5695('0x7'),'avpf':_0x5695('0x7'),'force_avp':_0x5695('0x7'),'icesupport':'yes','dtlsenable':_0x5695('0x7'),'dtlsverify':'no','dtlscertfile':_0x5695('0x8'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x5695('0x2')](_0x5695('0x9'),util[_0x5695('0x2')](_0x5695('0x6'),_0x5695('0x3'),i),0xfa0+i)});}db[_0x5695('0xa')][_0x5695('0xb')](users)[_0x5695('0xc')](function(){console[_0x5695('0xd')](_0x5695('0xe'));})['catch'](function(_0x4d032f){console[_0x5695('0xd')](_0x4d032f);}); \ No newline at end of file +var _0x55cf=['\x22%s\x22\x20<%s>','User','bulkCreate','then','util','../mysqldb','push','format','%s%s','agent','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x4827ea,_0x1478b1){var _0x50229a=function(_0x4f5126){while(--_0x4f5126){_0x4827ea['push'](_0x4827ea['shift']());}};_0x50229a(++_0x1478b1);}(_0x55cf,0x19c));var _0xf55c=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x55cf[_0x4dcc2d];return _0x1bbd79;};'use strict';var util=require(_0xf55c('0x0'));var db=require(_0xf55c('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf55c('0x2')]({'name':util[_0xf55c('0x3')](_0xf55c('0x4'),_0xf55c('0x5'),i),'fullname':util['format']('%s%s',_0xf55c('0x5'),i),'email':util[_0xf55c('0x3')]('%s%s@xcally.com',_0xf55c('0x5'),i),'role':_0xf55c('0x5'),'password':_0xf55c('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xf55c('0x7'),'ws',_0xf55c('0x8')],'disallow':[_0xf55c('0x9')],'allow':[_0xf55c('0xa')],'defaultuser':util[_0xf55c('0x3')](_0xf55c('0x4'),_0xf55c('0x5'),i),'encryption':_0xf55c('0xb'),'avpf':_0xf55c('0xb'),'force_avp':_0xf55c('0xb'),'icesupport':_0xf55c('0xb'),'dtlsenable':_0xf55c('0xb'),'dtlsverify':'no','dtlscertfile':_0xf55c('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xf55c('0x3')](_0xf55c('0xd'),util[_0xf55c('0x3')]('%s%s',_0xf55c('0x5'),i),0xfa0+i)});}db[_0xf55c('0xe')][_0xf55c('0xf')](users)[_0xf55c('0x10')](function(){console['log']('add\x20user');})['catch'](function(_0x3e4207){console['log'](_0x3e4207);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 5ae216d..dd3bb55 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4cf=['push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','ChatQueues','MailQueue','getChatQueues','getFaxQueues','all','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','type','ivr','findOne','VoiceQueues','FaxQueues','SmsQueues','MailQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','where','Campaign','then','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','voice:inbound','voice:outbound','hasOwnProperty','include'];(function(_0x28be4d,_0x5ed0ea){var _0x45e5ec=function(_0x2a7f27){while(--_0x2a7f27){_0x28be4d['push'](_0x28be4d['shift']());}};_0x45e5ec(++_0x5ed0ea);}(_0xb4cf,0xe2));var _0xfb4c=function(_0x20e970,_0x38b9d4){_0x20e970=_0x20e970-0x0;var _0x152290=_0xb4cf[_0x20e970];return _0x152290;};'use strict';var _=require(_0xfb4c('0x0'));var util=require('util');var BPromise=require(_0xfb4c('0x1'));var db=require(_0xfb4c('0x2'))['db'];var config=require(_0xfb4c('0x3'));var queryQueues={'attributes':['id',_0xfb4c('0x4')],'include':[{'as':_0xfb4c('0x5'),'model':db[_0xfb4c('0x6')],'attributes':['id',_0xfb4c('0x4'),_0xfb4c('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xfb4c('0x4')],'where':{'role':_0xfb4c('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xfb4c('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xfb4c('0x4')],'where':{'role':_0xfb4c('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xfb4c('0xa')],'where':{'type':_0xfb4c('0xb')}};function getAssociatedResources(_0x2e1f8c,_0xba815f,_0x259c10){return db['UserProfileSection'][_0xfb4c('0xc')]({'where':{'name':_0x2e1f8c,'userProfileId':_0xba815f},'raw':!![]})['then'](function(_0x307eab){if(_0x307eab){if(_0x307eab['autoAssociation']){switch(_0x2e1f8c){case _0xfb4c('0xd'):case'ChatQueues':case _0xfb4c('0xe'):case _0xfb4c('0xf'):case _0xfb4c('0x10'):case'OpenchannelQueues':return db[_0x259c10][_0xfb4c('0x11')](queryQueues);case _0xfb4c('0x12'):return db[_0x259c10][_0xfb4c('0x11')](queryTelephones);case _0xfb4c('0x13'):return db[_0x259c10][_0xfb4c('0x11')](queryTrunks);case _0xfb4c('0x14'):return db[_0x259c10][_0xfb4c('0x11')](queryCampaigns);}}else{return db['UserProfileResource'][_0xfb4c('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x307eab['id']},'raw':!![]})['then'](function(_0x4f654b){if(_0x4f654b){var _0x1fed4c={'where':{'id':_['map'](_0x4f654b,_0xfb4c('0x15'))},'raw':!![]};switch(_0x259c10){case _0xfb4c('0x6'):_0x1fed4c[_0xfb4c('0x16')][_0xfb4c('0x7')]=_0xfb4c('0x8');break;case _0xfb4c('0x17'):_0x1fed4c[_0xfb4c('0x16')]['type']=_0xfb4c('0xb');break;}return db[_0x259c10][_0xfb4c('0x11')](_0x1fed4c);}else{return[];}});}}else{return[];}})[_0xfb4c('0x18')](function(_0x4fcd42){return _0x4fcd42;});}function joinOrLeaveQueues(_0xb71698,_0x257897,_0x5eced0,_0x30bd4d){_0xb71698[_0x257897](util[_0xfb4c('0x19')](_0xfb4c('0x1a'),_0x5eced0,_0x30bd4d[_0xfb4c('0x4')]));if(_0x30bd4d[_0xfb4c('0x5')]){for(var _0x3e5b71=0x0;_0x3e5b71<_0x30bd4d[_0xfb4c('0x5')][_0xfb4c('0x1b')];_0x3e5b71+=0x1){_0xb71698[_0x257897](util['format'](_0xfb4c('0x1c'),_0x30bd4d[_0xfb4c('0x5')][_0x3e5b71][_0xfb4c('0x4')]));}}}function joinOrLeave(_0x1b362f,_0x29f27a,_0x29f167){var _0x56f1ce;if(_0x1b362f[_0xfb4c('0x1d')][_0xfb4c('0x1e')]['id']){db[_0xfb4c('0x6')][_0xfb4c('0x1f')]({'attributes':['id',_0xfb4c('0x4'),_0xfb4c('0x7'),_0xfb4c('0x20')],'where':{'id':_0x1b362f[_0xfb4c('0x1d')][_0xfb4c('0x1e')]['id']},'include':[{'model':db[_0xfb4c('0x21')],'as':_0xfb4c('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xfb4c('0x23')],'as':_0xfb4c('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xfb4c('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xfb4c('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xfb4c('0x27')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]}]})[_0xfb4c('0x18')](function(_0xd8c54a){if(_0xd8c54a){_0x56f1ce=_0xd8c54a;_0x1b362f[_0x29f27a](util[_0xfb4c('0x19')](_0xfb4c('0x1c'),_0xd8c54a[_0xfb4c('0x4')]));var _0x1ed419=[];switch(_0xd8c54a[_0xfb4c('0x7')]){case'admin':_0x1b362f[_0x29f27a](_0xfb4c('0x28'));_0x1b362f[_0x29f27a](_0xfb4c('0x29'));if(queryQueues[_0xfb4c('0x2a')](_0xfb4c('0x2b'))){delete queryQueues[_0xfb4c('0x2b')];}_0x1ed419[_0xfb4c('0x2c')](db[_0xfb4c('0x2d')][_0xfb4c('0x11')](queryQueues));_0x1ed419[_0xfb4c('0x2c')](db[_0xfb4c('0x2e')]['findAll'](queryQueues));_0x1ed419['push'](db[_0xfb4c('0x2f')][_0xfb4c('0x11')](queryQueues));_0x1ed419[_0xfb4c('0x2c')](db[_0xfb4c('0x30')]['findAll'](queryQueues));_0x1ed419[_0xfb4c('0x2c')](db['MailQueue'][_0xfb4c('0x11')](queryQueues));_0x1ed419[_0xfb4c('0x2c')](db[_0xfb4c('0x31')][_0xfb4c('0x11')](queryQueues));_0x1ed419[_0xfb4c('0x2c')](db[_0xfb4c('0x6')][_0xfb4c('0x11')](queryTelephones));_0x1ed419['push'](db[_0xfb4c('0x32')][_0xfb4c('0x11')](queryTrunks));_0x1ed419[_0xfb4c('0x2c')](db[_0xfb4c('0x17')]['findAll'](queryCampaigns));_0x1ed419[_0xfb4c('0x2c')](db[_0xfb4c('0x6')][_0xfb4c('0x11')](queryAgents));break;case _0xfb4c('0x33'):_0x1b362f[_0x29f27a](_0xfb4c('0x28'));_0x1b362f[_0x29f27a](_0xfb4c('0x29'));_0x1ed419[_0xfb4c('0x2c')](getAssociatedResources(_0xfb4c('0xd'),_0xd8c54a[_0xfb4c('0x20')],_0xfb4c('0x2d')));_0x1ed419['push'](getAssociatedResources(_0xfb4c('0x34'),_0xd8c54a[_0xfb4c('0x20')],_0xfb4c('0x2e')));_0x1ed419[_0xfb4c('0x2c')](getAssociatedResources(_0xfb4c('0xe'),_0xd8c54a['userProfileId'],_0xfb4c('0x2f')));_0x1ed419[_0xfb4c('0x2c')](getAssociatedResources(_0xfb4c('0xf'),_0xd8c54a[_0xfb4c('0x20')],_0xfb4c('0x30')));_0x1ed419['push'](getAssociatedResources(_0xfb4c('0x10'),_0xd8c54a[_0xfb4c('0x20')],_0xfb4c('0x35')));_0x1ed419[_0xfb4c('0x2c')](getAssociatedResources('OpenchannelQueues',_0xd8c54a[_0xfb4c('0x20')],'OpenchannelQueue'));_0x1ed419[_0xfb4c('0x2c')](getAssociatedResources(_0xfb4c('0x12'),_0xd8c54a[_0xfb4c('0x20')],'User'));_0x1ed419[_0xfb4c('0x2c')](getAssociatedResources(_0xfb4c('0x13'),_0xd8c54a[_0xfb4c('0x20')],_0xfb4c('0x32')));_0x1ed419[_0xfb4c('0x2c')](getAssociatedResources(_0xfb4c('0x14'),_0xd8c54a[_0xfb4c('0x20')],_0xfb4c('0x17')));_0x1ed419[_0xfb4c('0x2c')](db[_0xfb4c('0x6')][_0xfb4c('0x11')](queryAgents));break;case'agent':_0x1b362f[_0x29f27a]('voice:inbound');_0x1b362f[_0x29f27a](_0xfb4c('0x29'));_0x1ed419[_0xfb4c('0x2c')](_0xd8c54a['getVoiceQueues']({'attributes':['id',_0xfb4c('0x4')]}));_0x1ed419[_0xfb4c('0x2c')](_0xd8c54a[_0xfb4c('0x36')]({'attributes':['id',_0xfb4c('0x4')]}));_0x1ed419[_0xfb4c('0x2c')](_0xd8c54a[_0xfb4c('0x37')]({'attributes':['id',_0xfb4c('0x4')]}));_0x1ed419[_0xfb4c('0x2c')](_0xd8c54a['getSmsQueues']({'attributes':['id','name']}));_0x1ed419['push'](_0xd8c54a['getMailQueues']({'attributes':['id',_0xfb4c('0x4')]}));_0x1ed419[_0xfb4c('0x2c')](_0xd8c54a['getOpenchannelQueues']({'attributes':['id',_0xfb4c('0x4')]}));break;}return BPromise[_0xfb4c('0x38')](_0x1ed419);}})[_0xfb4c('0x18')](function(_0x103342){if(_0x103342&&_0x103342[_0xfb4c('0x1b')]){for(var _0x49e494=0x0;_0x49e494<_0x103342['length'];_0x49e494+=0x1){for(var _0x4ad725=0x0;_0x4ad725<_0x103342[_0x49e494][_0xfb4c('0x1b')];_0x4ad725+=0x1){switch(_0x49e494){case 0x0:joinOrLeaveQueues(_0x1b362f,_0x29f27a,'voice',_0x103342[_0x49e494][_0x4ad725]);break;case 0x1:joinOrLeaveQueues(_0x1b362f,_0x29f27a,_0xfb4c('0x39'),_0x103342[_0x49e494][_0x4ad725]);break;case 0x2:joinOrLeaveQueues(_0x1b362f,_0x29f27a,_0xfb4c('0x3a'),_0x103342[_0x49e494][_0x4ad725]);break;case 0x3:joinOrLeaveQueues(_0x1b362f,_0x29f27a,_0xfb4c('0x3b'),_0x103342[_0x49e494][_0x4ad725]);break;case 0x4:joinOrLeaveQueues(_0x1b362f,_0x29f27a,_0xfb4c('0x3c'),_0x103342[_0x49e494][_0x4ad725]);break;case 0x5:joinOrLeaveQueues(_0x1b362f,_0x29f27a,_0xfb4c('0x3d'),_0x103342[_0x49e494][_0x4ad725]);break;case 0x6:_0x1b362f[_0x29f27a](util[_0xfb4c('0x19')](_0xfb4c('0x3e'),_0x103342[_0x49e494][_0x4ad725]['name']));break;case 0x7:_0x1b362f[_0x29f27a](util[_0xfb4c('0x19')](_0xfb4c('0x3f'),_0x103342[_0x49e494][_0x4ad725][_0xfb4c('0x4')]));break;case 0x8:_0x1b362f[_0x29f27a](util[_0xfb4c('0x19')]('campaign:%s:%s',_0x103342[_0x49e494][_0x4ad725]['type'],_0x103342[_0x49e494][_0x4ad725]['name']));break;case 0x9:_0x1b362f[_0x29f27a](util[_0xfb4c('0x19')]('user:%s',_0x103342[_0x49e494][_0x4ad725][_0xfb4c('0x4')]));break;}}}}})[_0xfb4c('0x18')](function(){if(_0x29f27a===_0xfb4c('0x40')){var _0x449c3e=_[_0xfb4c('0x41')](_0x56f1ce[_0xfb4c('0x22')],'id');return _0x56f1ce[_0xfb4c('0x42')](_0x449c3e)['then'](function(){for(var _0xe4acbd=0x0;_0xe4acbd<_0x449c3e[_0xfb4c('0x1b')];_0xe4acbd+=0x1){_0x29f167[_0xfb4c('0x43')](_0xfb4c('0x44'),{'ChatInteractionId':Number(_0x449c3e[_0xe4acbd]),'UserId':Number(_0x56f1ce['id'])});}});}})['then'](function(){if(_0x29f27a===_0xfb4c('0x40')){var _0x554e80=_[_0xfb4c('0x41')](_0x56f1ce[_0xfb4c('0x24')],'id');return _0x56f1ce[_0xfb4c('0x45')](_0x554e80)[_0xfb4c('0x18')](function(){for(var _0x4f109f=0x0;_0x4f109f<_0x554e80[_0xfb4c('0x1b')];_0x4f109f+=0x1){_0x29f167[_0xfb4c('0x43')](_0xfb4c('0x46'),{'MailInteractionId':Number(_0x554e80[_0x4f109f]),'UserId':Number(_0x56f1ce['id'])});}});}})[_0xfb4c('0x18')](function(){if(_0x29f27a==='leave'){var _0x83cd4d=_[_0xfb4c('0x41')](_0x56f1ce[_0xfb4c('0x47')],'id');return _0x56f1ce['removeFaxInteractions'](_0x83cd4d)[_0xfb4c('0x18')](function(){for(var _0xea0f76=0x0;_0xea0f76<_0x83cd4d[_0xfb4c('0x1b')];_0xea0f76+=0x1){_0x29f167[_0xfb4c('0x43')](_0xfb4c('0x48'),{'FaxInteractionId':Number(_0x83cd4d[_0xea0f76]),'UserId':Number(_0x56f1ce['id'])});}});}})[_0xfb4c('0x18')](function(){if(_0x29f27a==='leave'){var _0x9bad61=_[_0xfb4c('0x41')](_0x56f1ce['SmsInteractions'],'id');return _0x56f1ce['removeSmsInteractions'](_0x9bad61)[_0xfb4c('0x18')](function(){for(var _0x2ebfd8=0x0;_0x2ebfd8<_0x9bad61[_0xfb4c('0x1b')];_0x2ebfd8+=0x1){_0x29f167[_0xfb4c('0x43')](_0xfb4c('0x49'),{'SmsInteractionId':Number(_0x9bad61[_0x2ebfd8]),'UserId':Number(_0x56f1ce['id'])});}});}})[_0xfb4c('0x18')](function(){if(_0x29f27a===_0xfb4c('0x40')){var _0x5347bb=_['map'](_0x56f1ce[_0xfb4c('0x4a')],'id');return _0x56f1ce[_0xfb4c('0x4b')](_0x5347bb)[_0xfb4c('0x18')](function(){for(var _0xd810c=0x0;_0xd810c<_0x5347bb['length'];_0xd810c+=0x1){_0x29f167[_0xfb4c('0x43')](_0xfb4c('0x4c'),{'OpenchannelInteractionId':Number(_0x5347bb[_0xd810c]),'UserId':Number(_0x56f1ce['id'])});}});}})[_0xfb4c('0x4d')](function(_0x32191e){_0x1b362f[_0xfb4c('0x4e')](_0x32191e);});}}function onDisconnect(_0x2b1172,_0x3c8c05){joinOrLeave(_0x2b1172,_0xfb4c('0x40'),_0x3c8c05);}function onConnect(_0x50605e){joinOrLeave(_0x50605e,_0xfb4c('0x4f'));}exports['default']=function(_0x756773){_0x756773['on'](_0xfb4c('0x50'),function(_0x2c9a0){_0x2c9a0['setMaxListeners'](0x0);_0x2c9a0[_0xfb4c('0x51')]=_0x2c9a0[_0xfb4c('0x52')][_0xfb4c('0x50')][_0xfb4c('0x53')]+':'+_0x2c9a0[_0xfb4c('0x52')][_0xfb4c('0x50')][_0xfb4c('0x54')];_0x2c9a0[_0xfb4c('0x55')]=new Date();_0x2c9a0['log']=function(_0x30f3aa){console['log'](_0xfb4c('0x56')+_0x2c9a0['nsp'][_0xfb4c('0x4')]+'['+_0x2c9a0[_0xfb4c('0x51')]+']',_0x30f3aa);};_0x2c9a0['on'](_0xfb4c('0x57'),function(){onDisconnect(_0x2c9a0,_0x756773);_0x2c9a0[_0xfb4c('0x4e')](_0xfb4c('0x58'));});onConnect(_0x2c9a0);_0x2c9a0['log'](_0xfb4c('0x59'));});}; \ No newline at end of file +var _0x4468=['VoiceQueue','ChatQueue','Trunk','getVoiceQueues','getFaxQueues','getMailQueues','all','chat','sms','mail','telephone:%s','trunk:%s','campaign:%s:%s','type','leave','ChatInteractions','MailInteractions','removeMailInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_openchannel_interactions:remove','log','join','connection','setMaxListeners','request','remotePort','connectedAt','address','CONNECTED','lodash','./environment','Agents','User','role','agent','name','telephone','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','where','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','FaxInteractions','OpenchannelInteraction','admin','voice:outbound','hasOwnProperty','include','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x4468,0x1b6));var _0x8446=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4468[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x8446('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x8446('0x1'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x8446('0x2'),'model':db[_0x8446('0x3')],'attributes':['id','name',_0x8446('0x4')],'raw':!![],'where':{'role':_0x8446('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8446('0x6')],'where':{'role':_0x8446('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8446('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x8446('0x6')],'where':{'role':_0x8446('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8446('0x6'),'type'],'where':{'type':_0x8446('0x8')}};function getAssociatedResources(_0x492420,_0x2f5dc0,_0x2c0cbe){return db[_0x8446('0x9')]['findOne']({'where':{'name':_0x492420,'userProfileId':_0x2f5dc0},'raw':!![]})[_0x8446('0xa')](function(_0x585a8c){if(_0x585a8c){if(_0x585a8c[_0x8446('0xb')]){switch(_0x492420){case _0x8446('0xc'):case _0x8446('0xd'):case _0x8446('0xe'):case _0x8446('0xf'):case _0x8446('0x10'):case _0x8446('0x11'):return db[_0x2c0cbe][_0x8446('0x12')](queryQueues);case _0x8446('0x13'):return db[_0x2c0cbe][_0x8446('0x12')](queryTelephones);case _0x8446('0x14'):return db[_0x2c0cbe][_0x8446('0x12')](queryTrunks);case _0x8446('0x15'):return db[_0x2c0cbe]['findAll'](queryCampaigns);}}else{return db[_0x8446('0x16')][_0x8446('0x12')]({'attributes':[_0x8446('0x17')],'where':{'sectionId':_0x585a8c['id']},'raw':!![]})[_0x8446('0xa')](function(_0x47dfe5){if(_0x47dfe5){var _0xcbd2a2={'where':{'id':_[_0x8446('0x18')](_0x47dfe5,_0x8446('0x17'))},'raw':!![]};switch(_0x2c0cbe){case _0x8446('0x3'):_0xcbd2a2['where'][_0x8446('0x4')]='telephone';break;case _0x8446('0x19'):_0xcbd2a2[_0x8446('0x1a')]['type']='ivr';break;}return db[_0x2c0cbe][_0x8446('0x12')](_0xcbd2a2);}else{return[];}});}}else{return[];}})[_0x8446('0xa')](function(_0x405ba6){return _0x405ba6;});}function joinOrLeaveQueues(_0x2815d6,_0x19e124,_0x1f6d05,_0x1634cc){_0x2815d6[_0x19e124](util[_0x8446('0x1b')](_0x8446('0x1c'),_0x1f6d05,_0x1634cc[_0x8446('0x6')]));if(_0x1634cc[_0x8446('0x2')]){for(var _0x34bcf3=0x0;_0x34bcf3<_0x1634cc[_0x8446('0x2')][_0x8446('0x1d')];_0x34bcf3+=0x1){_0x2815d6[_0x19e124](util[_0x8446('0x1b')](_0x8446('0x1e'),_0x1634cc[_0x8446('0x2')][_0x34bcf3][_0x8446('0x6')]));}}}function joinOrLeave(_0x1506f0,_0x4a4bc4,_0xd86fd4){var _0xf429fa;if(_0x1506f0[_0x8446('0x1f')][_0x8446('0x20')]['id']){db[_0x8446('0x3')][_0x8446('0x21')]({'attributes':['id',_0x8446('0x6'),'role',_0x8446('0x22')],'where':{'id':_0x1506f0[_0x8446('0x1f')][_0x8446('0x20')]['id']},'include':[{'model':db[_0x8446('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8446('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x8446('0x25'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8446('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x27614b){if(_0x27614b){_0xf429fa=_0x27614b;_0x1506f0[_0x4a4bc4](util[_0x8446('0x1b')](_0x8446('0x1e'),_0x27614b[_0x8446('0x6')]));var _0x7b5078=[];switch(_0x27614b['role']){case _0x8446('0x27'):_0x1506f0[_0x4a4bc4]('voice:inbound');_0x1506f0[_0x4a4bc4](_0x8446('0x28'));if(queryQueues[_0x8446('0x29')](_0x8446('0x2a'))){delete queryQueues[_0x8446('0x2a')];}_0x7b5078['push'](db['VoiceQueue']['findAll'](queryQueues));_0x7b5078[_0x8446('0x2b')](db['ChatQueue']['findAll'](queryQueues));_0x7b5078[_0x8446('0x2b')](db[_0x8446('0x2c')][_0x8446('0x12')](queryQueues));_0x7b5078['push'](db[_0x8446('0x2d')][_0x8446('0x12')](queryQueues));_0x7b5078['push'](db[_0x8446('0x2e')][_0x8446('0x12')](queryQueues));_0x7b5078[_0x8446('0x2b')](db[_0x8446('0x2f')][_0x8446('0x12')](queryQueues));_0x7b5078[_0x8446('0x2b')](db['User'][_0x8446('0x12')](queryTelephones));_0x7b5078[_0x8446('0x2b')](db['Trunk'][_0x8446('0x12')](queryTrunks));_0x7b5078['push'](db[_0x8446('0x19')]['findAll'](queryCampaigns));_0x7b5078['push'](db[_0x8446('0x3')][_0x8446('0x12')](queryAgents));break;case'user':_0x1506f0[_0x4a4bc4]('voice:inbound');_0x1506f0[_0x4a4bc4](_0x8446('0x28'));_0x7b5078['push'](getAssociatedResources(_0x8446('0xc'),_0x27614b[_0x8446('0x22')],_0x8446('0x30')));_0x7b5078[_0x8446('0x2b')](getAssociatedResources(_0x8446('0xd'),_0x27614b['userProfileId'],_0x8446('0x31')));_0x7b5078[_0x8446('0x2b')](getAssociatedResources(_0x8446('0xe'),_0x27614b[_0x8446('0x22')],_0x8446('0x2c')));_0x7b5078[_0x8446('0x2b')](getAssociatedResources(_0x8446('0xf'),_0x27614b['userProfileId'],_0x8446('0x2d')));_0x7b5078[_0x8446('0x2b')](getAssociatedResources(_0x8446('0x10'),_0x27614b[_0x8446('0x22')],_0x8446('0x2e')));_0x7b5078['push'](getAssociatedResources(_0x8446('0x11'),_0x27614b['userProfileId'],_0x8446('0x2f')));_0x7b5078[_0x8446('0x2b')](getAssociatedResources(_0x8446('0x13'),_0x27614b[_0x8446('0x22')],'User'));_0x7b5078[_0x8446('0x2b')](getAssociatedResources(_0x8446('0x14'),_0x27614b['userProfileId'],_0x8446('0x32')));_0x7b5078['push'](getAssociatedResources(_0x8446('0x15'),_0x27614b['userProfileId'],_0x8446('0x19')));_0x7b5078['push'](db[_0x8446('0x3')][_0x8446('0x12')](queryAgents));break;case _0x8446('0x5'):_0x1506f0[_0x4a4bc4]('voice:inbound');_0x1506f0[_0x4a4bc4](_0x8446('0x28'));_0x7b5078['push'](_0x27614b[_0x8446('0x33')]({'attributes':['id','name']}));_0x7b5078[_0x8446('0x2b')](_0x27614b['getChatQueues']({'attributes':['id',_0x8446('0x6')]}));_0x7b5078['push'](_0x27614b[_0x8446('0x34')]({'attributes':['id',_0x8446('0x6')]}));_0x7b5078[_0x8446('0x2b')](_0x27614b['getSmsQueues']({'attributes':['id',_0x8446('0x6')]}));_0x7b5078['push'](_0x27614b[_0x8446('0x35')]({'attributes':['id','name']}));_0x7b5078['push'](_0x27614b['getOpenchannelQueues']({'attributes':['id','name']}));break;}return BPromise[_0x8446('0x36')](_0x7b5078);}})[_0x8446('0xa')](function(_0x343220){if(_0x343220&&_0x343220[_0x8446('0x1d')]){for(var _0x2f78cc=0x0;_0x2f78cc<_0x343220['length'];_0x2f78cc+=0x1){for(var _0x3f77f4=0x0;_0x3f77f4<_0x343220[_0x2f78cc][_0x8446('0x1d')];_0x3f77f4+=0x1){switch(_0x2f78cc){case 0x0:joinOrLeaveQueues(_0x1506f0,_0x4a4bc4,'voice',_0x343220[_0x2f78cc][_0x3f77f4]);break;case 0x1:joinOrLeaveQueues(_0x1506f0,_0x4a4bc4,_0x8446('0x37'),_0x343220[_0x2f78cc][_0x3f77f4]);break;case 0x2:joinOrLeaveQueues(_0x1506f0,_0x4a4bc4,'fax',_0x343220[_0x2f78cc][_0x3f77f4]);break;case 0x3:joinOrLeaveQueues(_0x1506f0,_0x4a4bc4,_0x8446('0x38'),_0x343220[_0x2f78cc][_0x3f77f4]);break;case 0x4:joinOrLeaveQueues(_0x1506f0,_0x4a4bc4,_0x8446('0x39'),_0x343220[_0x2f78cc][_0x3f77f4]);break;case 0x5:joinOrLeaveQueues(_0x1506f0,_0x4a4bc4,'openchannel',_0x343220[_0x2f78cc][_0x3f77f4]);break;case 0x6:_0x1506f0[_0x4a4bc4](util[_0x8446('0x1b')](_0x8446('0x3a'),_0x343220[_0x2f78cc][_0x3f77f4]['name']));break;case 0x7:_0x1506f0[_0x4a4bc4](util[_0x8446('0x1b')](_0x8446('0x3b'),_0x343220[_0x2f78cc][_0x3f77f4]['name']));break;case 0x8:_0x1506f0[_0x4a4bc4](util[_0x8446('0x1b')](_0x8446('0x3c'),_0x343220[_0x2f78cc][_0x3f77f4][_0x8446('0x3d')],_0x343220[_0x2f78cc][_0x3f77f4][_0x8446('0x6')]));break;case 0x9:_0x1506f0[_0x4a4bc4](util[_0x8446('0x1b')](_0x8446('0x1e'),_0x343220[_0x2f78cc][_0x3f77f4][_0x8446('0x6')]));break;}}}}})[_0x8446('0xa')](function(){if(_0x4a4bc4===_0x8446('0x3e')){var _0x226c8c=_[_0x8446('0x18')](_0xf429fa[_0x8446('0x3f')],'id');return _0xf429fa['removeChatInteractions'](_0x226c8c)[_0x8446('0xa')](function(){for(var _0x32f6d9=0x0;_0x32f6d9<_0x226c8c[_0x8446('0x1d')];_0x32f6d9+=0x1){_0xd86fd4['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x226c8c[_0x32f6d9]),'UserId':Number(_0xf429fa['id'])});}});}})[_0x8446('0xa')](function(){if(_0x4a4bc4===_0x8446('0x3e')){var _0x19d51d=_[_0x8446('0x18')](_0xf429fa[_0x8446('0x40')],'id');return _0xf429fa[_0x8446('0x41')](_0x19d51d)[_0x8446('0xa')](function(){for(var _0x4dbdd2=0x0;_0x4dbdd2<_0x19d51d[_0x8446('0x1d')];_0x4dbdd2+=0x1){_0xd86fd4['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x19d51d[_0x4dbdd2]),'UserId':Number(_0xf429fa['id'])});}});}})[_0x8446('0xa')](function(){if(_0x4a4bc4===_0x8446('0x3e')){var _0x2cbebe=_[_0x8446('0x18')](_0xf429fa[_0x8446('0x25')],'id');return _0xf429fa['removeFaxInteractions'](_0x2cbebe)['then'](function(){for(var _0x29b785=0x0;_0x29b785<_0x2cbebe['length'];_0x29b785+=0x1){_0xd86fd4[_0x8446('0x42')](_0x8446('0x43'),{'FaxInteractionId':Number(_0x2cbebe[_0x29b785]),'UserId':Number(_0xf429fa['id'])});}});}})[_0x8446('0xa')](function(){if(_0x4a4bc4===_0x8446('0x3e')){var _0x483a61=_[_0x8446('0x18')](_0xf429fa['SmsInteractions'],'id');return _0xf429fa[_0x8446('0x44')](_0x483a61)[_0x8446('0xa')](function(){for(var _0xbf01f8=0x0;_0xbf01f8<_0x483a61[_0x8446('0x1d')];_0xbf01f8+=0x1){_0xd86fd4[_0x8446('0x42')](_0x8446('0x45'),{'SmsInteractionId':Number(_0x483a61[_0xbf01f8]),'UserId':Number(_0xf429fa['id'])});}});}})[_0x8446('0xa')](function(){if(_0x4a4bc4==='leave'){var _0x2d3f2e=_[_0x8446('0x18')](_0xf429fa[_0x8446('0x46')],'id');return _0xf429fa['removeOpenchannelInteractions'](_0x2d3f2e)[_0x8446('0xa')](function(){for(var _0x214139=0x0;_0x214139<_0x2d3f2e['length'];_0x214139+=0x1){_0xd86fd4['emit'](_0x8446('0x47'),{'OpenchannelInteractionId':Number(_0x2d3f2e[_0x214139]),'UserId':Number(_0xf429fa['id'])});}});}})['catch'](function(_0x494e94){_0x1506f0[_0x8446('0x48')](_0x494e94);});}}function onDisconnect(_0x13f26a,_0x47944d){joinOrLeave(_0x13f26a,'leave',_0x47944d);}function onConnect(_0x5912e3){joinOrLeave(_0x5912e3,_0x8446('0x49'));}exports['default']=function(_0x14e58f){_0x14e58f['on'](_0x8446('0x4a'),function(_0x35c3b0){_0x35c3b0[_0x8446('0x4b')](0x0);_0x35c3b0['address']=_0x35c3b0[_0x8446('0x4c')][_0x8446('0x4a')]['remoteAddress']+':'+_0x35c3b0[_0x8446('0x4c')][_0x8446('0x4a')][_0x8446('0x4d')];_0x35c3b0[_0x8446('0x4e')]=new Date();_0x35c3b0[_0x8446('0x48')]=function(_0x27f9ea){console[_0x8446('0x48')]('SocketIO\x20'+_0x35c3b0['nsp'][_0x8446('0x6')]+'['+_0x35c3b0[_0x8446('0x4f')]+']',_0x27f9ea);};_0x35c3b0['on']('disconnect',function(){onDisconnect(_0x35c3b0,_0x14e58f);_0x35c3b0['log']('DISCONNECTED');});onConnect(_0x35c3b0);_0x35c3b0['log'](_0x8446('0x50'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 8cdcbb8..a8d8511 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 _0x70b9=['direction','UserId','User','find','interface','format','SIP/%s','name','incomingmessage','outgoingmessage','channel','opened','changed','closed','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelMessage','request','then','Trigger,\x20%s','EventManager','error','code','catch','get','event'];(function(_0xd7b56a,_0x2b911a){var _0x1c1c9d=function(_0x224b29){while(--_0x224b29){_0xd7b56a['push'](_0xd7b56a['shift']());}};_0x1c1c9d(++_0x2b911a);}(_0x70b9,0x86));var _0x970b=function(_0x12b7ea,_0x2a0ae7){_0x12b7ea=_0x12b7ea-0x0;var _0x3c6650=_0x70b9[_0x12b7ea];return _0x3c6650;};'use strict';var util=require(_0x970b('0x0'));var db=require(_0x970b('0x1'))['db'];var jayson=require(_0x970b('0x2'));var logger=require(_0x970b('0x3'))(_0x970b('0x4'));var client=jayson[_0x970b('0x5')][_0x970b('0x6')]({'port':0x232a});var triggers=[{'channel':_0x970b('0x7'),'model':_0x970b('0x8'),'event':_0x970b('0x9'),'condition':_0x970b('0xa'),'callback':afterCreate},{'channel':_0x970b('0x7'),'model':_0x970b('0x8'),'event':_0x970b('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x970b('0x7'),'model':'ChatMessage','event':'afterCreate','condition':_0x970b('0xc'),'callback':afterCreateMessage},{'channel':_0x970b('0xd'),'model':'SmsInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0x970b('0xe'),'event':'afterUpdate','condition':_0x970b('0xf'),'callback':afterUpdate},{'channel':_0x970b('0xd'),'model':_0x970b('0x10'),'event':_0x970b('0x9'),'condition':_0x970b('0xc'),'callback':afterCreateMessage},{'channel':_0x970b('0x11'),'model':_0x970b('0x12'),'event':'afterCreate','condition':_0x970b('0xa'),'callback':afterCreate},{'channel':_0x970b('0x11'),'model':_0x970b('0x12'),'event':'afterUpdate','condition':_0x970b('0xf'),'callback':afterUpdate},{'channel':'Fax','model':_0x970b('0x13'),'event':_0x970b('0x9'),'condition':_0x970b('0xc'),'callback':afterCreateMessage},{'channel':_0x970b('0x14'),'model':'MailInteraction','event':'afterCreate','condition':_0x970b('0xa'),'callback':afterCreate},{'channel':_0x970b('0x14'),'model':_0x970b('0x15'),'event':_0x970b('0xb'),'condition':_0x970b('0xf'),'callback':afterUpdate},{'channel':_0x970b('0x14'),'model':_0x970b('0x16'),'event':_0x970b('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x970b('0x17'),'model':'OpenchannelInteraction','event':_0x970b('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x970b('0xf'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x970b('0x18'),'event':'afterCreate','condition':_0x970b('0xc'),'callback':afterCreateMessage}];function request(_0x5d27bd){return client[_0x970b('0x19')]('EventManager',_0x5d27bd)[_0x970b('0x1a')](function(_0x20a183){logger['info'](_0x970b('0x1b'),_0x970b('0x1c'),_0x20a183);if(_0x20a183[_0x970b('0x1d')]){if(_0x20a183[_0x970b('0x1d')][_0x970b('0x1e')]===0x1f4){logger[_0x970b('0x1d')](_0x970b('0x1b'),'EventManager',_0x20a183[_0x970b('0x1d')]);}}})[_0x970b('0x1f')](function(_0x4cc9ec){logger[_0x970b('0x1d')]('Trigger,\x20%s',_0x970b('0x1c'),_0x4cc9ec);});}function afterCreateMessage(_0x56bf38,_0x7667dd){return function(_0xf52da,_0x4e3307){_0xf52da=_0xf52da[_0x970b('0x20')]({'plain':!![]});_0xf52da['channel']=_0x56bf38;_0xf52da[_0x970b('0x21')]=_0xf52da[_0x970b('0x22')];if(_0xf52da[_0x970b('0x23')]){return db[_0x970b('0x24')][_0x970b('0x25')]({'where':{'id':_0xf52da['UserId']},'attributes':['id','name'],'raw':!![]})[_0x970b('0x1a')](function(_0x2c6128){_0xf52da[_0x970b('0x26')]=util[_0x970b('0x27')](_0x970b('0x28'),_0x2c6128[_0x970b('0x29')]);_0xf52da['channel']=_0x56bf38;return request({'event':_0x970b('0x2a'),'message':_0xf52da});})[_0x970b('0x1f')](function(_0x3759a5){console['error'](_0x3759a5);});}else{return request({'event':_0x970b('0x2b'),'message':_0xf52da});}};}function afterCreate(_0x137adb,_0x210e0f){return function(_0x217a47,_0x44d140){_0x217a47=_0x217a47[_0x970b('0x20')]({'plain':!![]});_0x217a47[_0x970b('0x2c')]=_0x137adb;_0x217a47[_0x970b('0x21')]=_0x970b('0x2d');return request({'event':_0x210e0f,'message':_0x217a47});};}function afterUpdate(_0x9d174e,_0x55f365){return function(_0x530f12,_0x55a595){if(_0x530f12[_0x970b('0x2e')](_0x970b('0x2f'))&&_0x530f12[_0x970b('0x2f')]){_0x530f12=_0x530f12[_0x970b('0x20')]({'plain':!![]});_0x530f12['channel']=_0x9d174e;_0x530f12['event']=_0x970b('0x2f');if(_0x530f12[_0x970b('0x23')]){return db[_0x970b('0x24')][_0x970b('0x25')]({'where':{'id':_0x530f12['UserId']},'attributes':['id',_0x970b('0x29')],'raw':!![]})[_0x970b('0x1a')](function(_0x5702b3){_0x530f12[_0x970b('0x26')]=util[_0x970b('0x27')](_0x970b('0x28'),_0x5702b3[_0x970b('0x29')]);return request({'event':_0x55f365,'message':_0x530f12});})[_0x970b('0x1f')](function(_0x6412b){console[_0x970b('0x1d')](_0x6412b);});}else{return request({'event':_0x55f365,'message':_0x530f12});}}};}exports[_0x970b('0x30')]=function(){for(var _0x397027=0x0;_0x3970270x3){var _0x5d983b=/\((.+)\)/;var _0xefc0d6=_0x23a646['rx'][_0xfdba('0x18')](_0x5d983b);if(_0xefc0d6){_0x77f64d=_0xefc0d6[0x1];}else{_0x77f64d=null;}}else{_0x77f64d=null;}_0x23a646['cb'](null,{'code':_0x7c20ea,'result':_0x36af2a,'extra':_0x77f64d});}});_0x48fff2['on'](_0xfdba('0x19'),function(_0x5bd82c){_0x2ecc4d[_0xfdba('0xc')](_0xfdba('0x19'),new AGIError(_0xfdba('0x1a'),_0x5bd82c[_0xfdba('0x1b')]));});_0x48fff2['on'](_0xfdba('0x1c'),function(){_0x2ecc4d[_0xfdba('0xc')](_0xfdba('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x48fff2['on']('timeout',function(){_0x2ecc4d['emit'](_0xfdba('0x1d'),new AGIError(_0xfdba('0x1e')));_0x48fff2[_0xfdba('0x1f')]();});_0x48fff2['pipe'](_0x3f0a56);this[_0xfdba('0x20')]=function(_0xee917d,_0x260ac6){var _0xee917d=_0xee917d||'',_0x260ac6=typeof _0x260ac6==_0xfdba('0x11')?_0x260ac6:new Function();_0x23a646={'tx':_0xee917d,'rx':'','cb':_0x260ac6};_0x48fff2[_0xfdba('0x21')](_0xee917d+'\x0a');},this[_0xfdba('0x1c')]=function(){_0x48fff2[_0xfdba('0x1f')]();};}util[_0xfdba('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xfdba('0x23')]=function(_0x3f9e77){return this[_0xfdba('0x20')]['sync'](this,_0x3f9e77);};AGIChannel[_0xfdba('0x24')][_0xfdba('0x25')]=function(){return this['sendRequest'](_0xfdba('0x26'));};AGIChannel[_0xfdba('0x24')][_0xfdba('0x27')]=function(_0x1a23e3,_0x5b8f5a,_0x1a91f1){_0x1a23e3=_0x1a23e3===undefined?_0xfdba('0x28'):_0x1a23e3;_0x5b8f5a=_0x5b8f5a===undefined?'5':_0x5b8f5a;_0x1a91f1=_0x1a91f1===undefined?'1':_0x1a91f1;return this[_0xfdba('0x23')](util[_0xfdba('0x29')](_0xfdba('0x2a'),_0x1a23e3,_0x5b8f5a*0x3e8,_0x1a91f1));};AGIChannel[_0xfdba('0x24')][_0xfdba('0x2b')]=function(_0x31c9f9){_0x31c9f9=_0x31c9f9||'NO\x20MESSAGE';return this[_0xfdba('0x23')](util[_0xfdba('0x29')]('VERBOSE\x20\x22%s\x22',_0x31c9f9));};AGIChannel[_0xfdba('0x24')][_0xfdba('0x2c')]=function(_0x58be16,_0x2c2319){if(_['isArray'](_0x2c2319)){return this[_0xfdba('0x23')](util[_0xfdba('0x29')]('EXEC\x20%s\x20%s',_0x58be16,_0x2c2319[_0xfdba('0x2d')](',')));}return this[_0xfdba('0x23')](util[_0xfdba('0x29')](_0xfdba('0x2e'),_0x58be16,_0x2c2319));};AGIChannel[_0xfdba('0x24')][_0xfdba('0x2f')]=function(_0x1bb3c3){return this['sendRequest'](util['format'](_0xfdba('0x30'),_0x1bb3c3));};AGIChannel['prototype'][_0xfdba('0x31')]=function(_0x34a66e){return this[_0xfdba('0x23')](util['format']('SET\x20EXTENSION\x20%s',_0x34a66e));};AGIChannel[_0xfdba('0x24')][_0xfdba('0x32')]=function(_0x3658c8){return this[_0xfdba('0x23')](util['format'](_0xfdba('0x33'),_0x3658c8));};AGIChannel[_0xfdba('0x24')]['hangup']=function(){return this['sendRequest'](_0xfdba('0x34'));};AGIChannel['prototype']['setVariable']=function(_0x4bbcc7,_0x4a6365){return this[_0xfdba('0x23')](util[_0xfdba('0x29')](_0xfdba('0x35'),_0x4bbcc7,_0x4a6365?_0x4a6365[_0xfdba('0x36')]()[_0xfdba('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xfdba('0x24')][_0xfdba('0x37')]=function(_0x176977,_0x3c05af){return this[_0xfdba('0x23')](util[_0xfdba('0x29')](_0xfdba('0x38'),_0x176977,_0x3c05af));};AGIChannel[_0xfdba('0x24')][_0xfdba('0x39')]=function(_0x3133e0,_0x2ccf21){return this[_0xfdba('0x23')](util[_0xfdba('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0x3133e0,_0x2ccf21));};AGIChannel[_0xfdba('0x24')]['sayPhonetic']=function(_0x327e32,_0xbdddc5){return this[_0xfdba('0x23')](util[_0xfdba('0x29')](_0xfdba('0x3a'),_0x327e32,_0xbdddc5));};AGIChannel['prototype'][_0xfdba('0x3b')]=function(_0x244615,_0x67319c,_0x5adb53){_0x67319c=_0x67319c||this[_0xfdba('0x3c')];_0x5adb53=_0x5adb53||0x1;this['setContext'](_0x244615);this[_0xfdba('0x31')](_0x67319c);this[_0xfdba('0x32')](_0x5adb53);return this['noop'](util[_0xfdba('0x29')](_0xfdba('0x3d'),_0x244615,_0x67319c,_0x5adb53));};AGIChannel[_0xfdba('0x24')][_0xfdba('0x3e')]=function(_0x2e3f24){return this[_0xfdba('0x23')](util['format'](_0xfdba('0x3f'),_0x2e3f24));};AGIChannel[_0xfdba('0x24')]['recordFile']=function(_0x3643ee,_0x5c0beb,_0x3c4f02,_0x474536,_0x5cb233,_0x8def89){_0x5c0beb=_0x5c0beb||_0xfdba('0x40');_0x3c4f02=_0x3c4f02||'';_0x474536=_0x474536===undefined?-0x1:_0x474536==='-1'?-0x1:_0x474536*0x3e8;_0x5cb233=_0x5cb233===undefined?'':'s='+_0x5cb233;_0x8def89=_0x8def89?_0xfdba('0x41'):'';return this[_0xfdba('0x23')](util['format'](_0xfdba('0x42'),_0x3643ee,_0x5c0beb,_0x3c4f02,_0x474536,_0x8def89,_0x5cb233));};AGIChannel['prototype'][_0xfdba('0x43')]=function(_0x205fc1,_0x887ebb){_0x887ebb=_0x887ebb||'';return this[_0xfdba('0x23')](util[_0xfdba('0x29')](_0xfdba('0x44'),_0x205fc1,_0x887ebb));};AGIChannel[_0xfdba('0x24')][_0xfdba('0x45')]=function(_0x1bc771){return this[_0xfdba('0x2c')](_0xfdba('0x46'),_0x1bc771);};AGIChannel[_0xfdba('0x24')][_0xfdba('0x47')]=function(_0xaf500){return this[_0xfdba('0x2c')](_0xfdba('0x48'),_0xaf500);};AGIChannel[_0xfdba('0x24')][_0xfdba('0x19')]=function(_0x1e6f27,_0x3747f8){this[_0xfdba('0x2b')](util[_0xfdba('0x29')](_0xfdba('0x49'),_0x1e6f27['id'],_0x1e6f27[_0xfdba('0x4a')],_0x3747f8));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xcd70=['prototype','sendRequest','answer','ANSWER','getData','format','noop','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','EventEmitter','./reply','./error','call','utf8','headers','emit','ready','line','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','destroy','command','write'];(function(_0x525f32,_0x42e307){var _0xcd07e4=function(_0x4b110c){while(--_0x4b110c){_0x525f32['push'](_0x525f32['shift']());}};_0xcd07e4(++_0x42e307);}(_0xcd70,0x143));var _0x0cd7=function(_0x53a93b,_0x21ff3a){_0x53a93b=_0x53a93b-0x0;var _0x3869d6=_0xcd70[_0x53a93b];return _0x3869d6;};'use strict';var util=require(_0x0cd7('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0x0cd7('0x1')];var AGIReply=require(_0x0cd7('0x2'));var AGIError=require(_0x0cd7('0x3'));function AGIChannel(_0x11cf86){var _0x416ad0=this,_0x4670d5=new AGIReply(),_0x362bf0=![],_0x1e0a6c={};EventEmitter[_0x0cd7('0x4')](_0x416ad0);_0x11cf86['setEncoding'](_0x0cd7('0x5'));_0x11cf86['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x4670d5['setEncoding'](_0x0cd7('0x5'));_0x4670d5['on'](_0x0cd7('0x6'),function(_0x2ae8b8){for(var _0x27a618 in _0x2ae8b8){_0x416ad0[_0x27a618]=_0x2ae8b8[_0x27a618];}_0x416ad0[_0x0cd7('0x7')](_0x0cd7('0x8'));});_0x4670d5['on'](_0x0cd7('0x9'),function(_0x43a613){if(_0x43a613['toLowerCase']()==_0x0cd7('0xa')){_0x416ad0['emit']('hangup');return;}if(_0x43a613['substring'](0x0,0xb)==_0x0cd7('0xb')){_0x362bf0=!![];}if(_0x362bf0){_0x1e0a6c['rx']+=_0x43a613+'\x0a';if(_0x43a613[_0x0cd7('0xc')](_0x0cd7('0xd'))!=-0x1){_0x362bf0=![];}}else{_0x1e0a6c['rx']=_0x43a613;}if(_0x362bf0){return;}if(typeof _0x1e0a6c['cb']==_0x0cd7('0xe')){var _0x174465=_0x1e0a6c['rx'][_0x0cd7('0xf')](0x0,0x3),_0x241c93=null,_0x5250c1=null;_0x174465=parseInt(_0x174465);if(isNaN(_0x174465)){_0x1e0a6c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x0cd7('0x10')});return;}if(_0x174465!=0xc8){_0x1e0a6c['cb'](null,{'code':_0x174465,'result':-0x1,'extra':'KO'});return;}_0x241c93=_0x1e0a6c['rx'][_0x0cd7('0xf')](0x4)[_0x0cd7('0x11')](_0x0cd7('0x12'),'');if(_0x241c93['indexOf']('\x20')!=-0x1){_0x241c93=_0x241c93[_0x0cd7('0x13')](0x0,_0x241c93[_0x0cd7('0x14')]('\x20'));}if(_[_0x0cd7('0x15')](_0x241c93,'-1')){_0x241c93=parseInt(_0x241c93);}_0x5250c1=_0x1e0a6c['rx'][_0x0cd7('0x16')]('\x20');if(_0x5250c1[_0x0cd7('0x17')]==0x3){_0x5250c1=_0x5250c1[0x2][_0x0cd7('0xf')](0x1,_0x5250c1[0x2][_0x0cd7('0x17')]-0x1);}else if(_0x5250c1[_0x0cd7('0x17')]>0x3){var _0xd33e81=/\((.+)\)/;var _0x576555=_0x1e0a6c['rx']['match'](_0xd33e81);if(_0x576555){_0x5250c1=_0x576555[0x1];}else{_0x5250c1=null;}}else{_0x5250c1=null;}_0x1e0a6c['cb'](null,{'code':_0x174465,'result':_0x241c93,'extra':_0x5250c1});}});_0x11cf86['on'](_0x0cd7('0x18'),function(_0x41f251){_0x416ad0[_0x0cd7('0x7')](_0x0cd7('0x18'),new AGIError(_0x0cd7('0x19'),_0x41f251[_0x0cd7('0x1a')]));});_0x11cf86['on']('close',function(){_0x416ad0[_0x0cd7('0x7')](_0x0cd7('0x1b'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x11cf86['on'](_0x0cd7('0x1c'),function(){_0x416ad0['emit'](_0x0cd7('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x11cf86[_0x0cd7('0x1d')]();});_0x11cf86['pipe'](_0x4670d5);this[_0x0cd7('0x1e')]=function(_0x2a0462,_0x4dc864){var _0x2a0462=_0x2a0462||'',_0x4dc864=typeof _0x4dc864==_0x0cd7('0xe')?_0x4dc864:new Function();_0x1e0a6c={'tx':_0x2a0462,'rx':'','cb':_0x4dc864};_0x11cf86[_0x0cd7('0x1f')](_0x2a0462+'\x0a');},this['close']=function(){_0x11cf86[_0x0cd7('0x1d')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x21')]=function(_0x53be19){return this[_0x0cd7('0x1e')]['sync'](this,_0x53be19);};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x22')]=function(){return this['sendRequest'](_0x0cd7('0x23'));};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x24')]=function(_0x1478ae,_0x3b0d35,_0x14304c){_0x1478ae=_0x1478ae===undefined?'beep':_0x1478ae;_0x3b0d35=_0x3b0d35===undefined?'5':_0x3b0d35;_0x14304c=_0x14304c===undefined?'1':_0x14304c;return this[_0x0cd7('0x21')](util[_0x0cd7('0x25')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x1478ae,_0x3b0d35*0x3e8,_0x14304c));};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x26')]=function(_0x248c25){_0x248c25=_0x248c25||'NO\x20MESSAGE';return this[_0x0cd7('0x21')](util['format']('VERBOSE\x20\x22%s\x22',_0x248c25));};AGIChannel[_0x0cd7('0x20')]['exec']=function(_0x5d2421,_0x101d89){if(_[_0x0cd7('0x27')](_0x101d89)){return this[_0x0cd7('0x21')](util[_0x0cd7('0x25')](_0x0cd7('0x28'),_0x5d2421,_0x101d89[_0x0cd7('0x29')](',')));}return this[_0x0cd7('0x21')](util[_0x0cd7('0x25')](_0x0cd7('0x28'),_0x5d2421,_0x101d89));};AGIChannel[_0x0cd7('0x20')]['setContext']=function(_0x50d4c7){return this['sendRequest'](util['format'](_0x0cd7('0x2a'),_0x50d4c7));};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x2b')]=function(_0x41a37f){return this[_0x0cd7('0x21')](util['format']('SET\x20EXTENSION\x20%s',_0x41a37f));};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x2c')]=function(_0x5368b8){return this['sendRequest'](util[_0x0cd7('0x25')](_0x0cd7('0x2d'),_0x5368b8));};AGIChannel['prototype'][_0x0cd7('0xa')]=function(){return this[_0x0cd7('0x21')](_0x0cd7('0x2e'));};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x2f')]=function(_0x3ccdeb,_0x9664ef){return this[_0x0cd7('0x21')](util[_0x0cd7('0x25')](_0x0cd7('0x30'),_0x3ccdeb,_0x9664ef?_0x9664ef[_0x0cd7('0x31')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x32')]=function(_0x295cfc,_0x52dcd7){return this[_0x0cd7('0x21')](util[_0x0cd7('0x25')](_0x0cd7('0x33'),_0x295cfc,_0x52dcd7));};AGIChannel[_0x0cd7('0x20')]['sayDigits']=function(_0x5d4d5f,_0x59da42){return this['sendRequest'](util['format'](_0x0cd7('0x34'),_0x5d4d5f,_0x59da42));};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x35')]=function(_0x31853f,_0x17e344){return this[_0x0cd7('0x21')](util['format'](_0x0cd7('0x36'),_0x31853f,_0x17e344));};AGIChannel[_0x0cd7('0x20')]['continueAt']=function(_0x5adda3,_0x36c5ac,_0x21409c){_0x36c5ac=_0x36c5ac||this[_0x0cd7('0x37')];_0x21409c=_0x21409c||0x1;this[_0x0cd7('0x38')](_0x5adda3);this[_0x0cd7('0x2b')](_0x36c5ac);this['setPriority'](_0x21409c);return this[_0x0cd7('0x26')](util['format'](_0x0cd7('0x39'),_0x5adda3,_0x36c5ac,_0x21409c));};AGIChannel['prototype']['getVariable']=function(_0xe33bce){return this[_0x0cd7('0x21')](util['format'](_0x0cd7('0x3a'),_0xe33bce));};AGIChannel['prototype'][_0x0cd7('0x3b')]=function(_0x168777,_0x40ccfb,_0x233233,_0x3e284a,_0x43243c,_0x3596ec){_0x40ccfb=_0x40ccfb||_0x0cd7('0x3c');_0x233233=_0x233233||'';_0x3e284a=_0x3e284a===undefined?-0x1:_0x3e284a==='-1'?-0x1:_0x3e284a*0x3e8;_0x43243c=_0x43243c===undefined?'':'s='+_0x43243c;_0x3596ec=_0x3596ec?_0x0cd7('0x3d'):'';return this[_0x0cd7('0x21')](util[_0x0cd7('0x25')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x168777,_0x40ccfb,_0x233233,_0x3e284a,_0x3596ec,_0x43243c));};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x3e')]=function(_0x487996,_0x4d68e8){_0x4d68e8=_0x4d68e8||'';return this['sendRequest'](util[_0x0cd7('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x487996,_0x4d68e8));};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x3f')]=function(_0x2e7cd4){return this[_0x0cd7('0x40')](_0x0cd7('0x41'),_0x2e7cd4);};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x42')]=function(_0x49b478){return this['exec'](_0x0cd7('0x43'),_0x49b478);};AGIChannel[_0x0cd7('0x20')][_0x0cd7('0x18')]=function(_0x135eeb,_0x524b17){this[_0x0cd7('0x26')](util['format'](_0x0cd7('0x44'),_0x135eeb['id'],_0x135eeb[_0x0cd7('0x45')],_0x524b17));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0cd7('0x46')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ae2098d..0957624 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 _0xd3bc=['E_AGI_UNDEFINED','push','format','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xd3bc,0xe7));var _0xcd3b=function(_0x32373d,_0xae7f42){_0x32373d=_0x32373d-0x0;var _0x16fdcf=_0xd3bc[_0x32373d];return _0x16fdcf;};'use strict';var util=require(_0xcd3b('0x0'));var error={'E_AGI_UNDEFINED':_0xcd3b('0x1'),'E_AGI_ARGUMENT_PORT':_0xcd3b('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xcd3b('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xcd3b('0x4'),'E_AGI_SOCKET_ERROR':_0xcd3b('0x5'),'E_AGI_SOCKET_CLOSE':_0xcd3b('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xcd3b('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xcd3b('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x1d3c1d){var _0x1d3c1d=_0x1d3c1d||null,_0x528b08=_0x528b08||[],_0x36415b=0x1,_0x4f5e09='';if(!error[_0x1d3c1d]){_0x1d3c1d=_0xcd3b('0x9');}_0x528b08['push'](error[_0x1d3c1d]);while(arguments[_0x36415b]){_0x528b08[_0xcd3b('0xa')](arguments[_0x36415b]);_0x36415b++;}_0x4f5e09=util[_0xcd3b('0xb')]['apply'](util,_0x528b08);this['message']=_0x4f5e09;this['name']=_0x1d3c1d;}module['exports']=AGIError; \ No newline at end of file +var _0xa966=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','message','name','exports','util'];(function(_0x5b620e,_0x266273){var _0x6b7008=function(_0x337322){while(--_0x337322){_0x5b620e['push'](_0x5b620e['shift']());}};_0x6b7008(++_0x266273);}(_0xa966,0x12f));var _0x6a96=function(_0xac1238,_0x36e7f4){_0xac1238=_0xac1238-0x0;var _0x4f010b=_0xa966[_0xac1238];return _0x4f010b;};'use strict';var util=require(_0x6a96('0x0'));var error={'E_AGI_UNDEFINED':_0x6a96('0x1'),'E_AGI_ARGUMENT_PORT':_0x6a96('0x2'),'E_AGI_SERVER_ERROR':_0x6a96('0x3'),'E_AGI_SERVER_CLOSE':_0x6a96('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x6a96('0x5'),'E_AGI_SOCKET_ERROR':_0x6a96('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x6a96('0x7'),'E_AGI_COMMAND_EMPTY':_0x6a96('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6a96('0x9'),'E_AGI_IVR_ENTRY':_0x6a96('0xa')};function AGIError(_0x4a8660){var _0x4a8660=_0x4a8660||null,_0x494f23=_0x494f23||[],_0x52b9c6=0x1,_0x4c0030='';if(!error[_0x4a8660]){_0x4a8660='E_AGI_UNDEFINED';}_0x494f23[_0x6a96('0xb')](error[_0x4a8660]);while(arguments[_0x52b9c6]){_0x494f23[_0x6a96('0xb')](arguments[_0x52b9c6]);_0x52b9c6++;}_0x4c0030=util['format'][_0x6a96('0xc')](util,_0x494f23);this[_0x6a96('0xd')]=_0x4c0030;this[_0x6a96('0xe')]=_0x4a8660;}module[_0x6a96('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 2b53fca..abbb8fb 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 _0xe5b5=['../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','traverseBFS','info','no\x20vertex\x20found','no\x20edge/s\x20available','condition','split','agicommand','target','default','invalid','vswitch','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash'];(function(_0x97993b,_0x20cbae){var _0x33bb5d=function(_0x32b021){while(--_0x32b021){_0x97993b['push'](_0x97993b['shift']());}};_0x33bb5d(++_0x20cbae);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x539fb2,_0x5b6718){_0x539fb2=_0x539fb2-0x0;var _0x4d583d=_0xe5b5[_0x539fb2];return _0x4d583d;};'use strict';var _=require(_0x5e5b('0x0'));var logger=require(_0x5e5b('0x1'))(_0x5e5b('0x2'));var verticesWithRetry=[_0x5e5b('0x3'),_0x5e5b('0x4'),_0x5e5b('0x5')];var Graph=function(){this[_0x5e5b('0x6')]={};this[_0x5e5b('0x7')]={};this[_0x5e5b('0x8')]=0x0;};Graph[_0x5e5b('0x9')][_0x5e5b('0xa')]=function(_0x40bc5b){this[_0x5e5b('0x6')][_0x40bc5b['id']]=_0x40bc5b;this[_0x5e5b('0x7')][_0x40bc5b['id']]=[];};Graph[_0x5e5b('0x9')][_0x5e5b('0xb')]=function(_0xe089b1,_0xcbd478,_0x258414){this[_0x5e5b('0x7')][_0xe089b1][_0x5e5b('0xc')]({'target':_0xcbd478,'condition':_0x258414});this[_0x5e5b('0x8')]+=0x1;};Graph[_0x5e5b('0x9')]['size']=function(){return _[_0x5e5b('0xd')](this['vertices']);};Graph[_0x5e5b('0x9')][_0x5e5b('0xe')]=function(){return this[_0x5e5b('0x8')];};Graph[_0x5e5b('0x9')]['getVertex']=function(_0x4a1424){return this['vertices'][_0x4a1424];};Graph[_0x5e5b('0x9')][_0x5e5b('0xf')]=function(_0x4559a0,_0x1694ff){if(!this[_0x5e5b('0x6')][_0x4559a0]){return logger[_0x5e5b('0x10')](_0x5e5b('0x11'));}var _0x49edd0=_0x1694ff(this[_0x5e5b('0x6')][_0x4559a0]);if(!_0x49edd0){return logger[_0x5e5b('0x10')]('stop\x20traverse');}if(this[_0x5e5b('0x7')][_0x4559a0]['length']===0x0){return logger['info'](_0x5e5b('0x12'));}for(var _0x444435=0x0,_0xaf9ace=[],_0x5c7148=![];_0x444435\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','listening','connection','xml2json','syncho','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','defaults','agi','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','evtHangup','toJson','mxGraphModel','root','agicommand','maxRetry','retry','addVertex','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','then','catch','createSquareReport','indexOf','agi_','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x421b76,_0x2e9558){var _0x5aab99=function(_0x1f0bc3){while(--_0x1f0bc3){_0x421b76['push'](_0x421b76['shift']());}};_0x5aab99(++_0x2e9558);}(_0xb66c,0x175));var _0xcb66=function(_0x20df54,_0x91def7){_0x20df54=_0x20df54-0x0;var _0x5c64c2=_0xb66c[_0x20df54];return _0x5c64c2;};'use strict';var parser=require(_0xcb66('0x0'));var _=require('lodash');var syncho=require(_0xcb66('0x1'));var util=require('util');var moment=require(_0xcb66('0x2'));var config=require(_0xcb66('0x3'));var logger=require(_0xcb66('0x4'))('agi');var utilLicense=require(_0xcb66('0x5'));var rpc=require(_0xcb66('0x6'));var mailRpc=require(_0xcb66('0x7'));var Graph=require(_0xcb66('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xcb66('0x9')](config[_0xcb66('0xa')],{'ip':_0xcb66('0xb'),'port':0x11dd});function connectionHandler(_0x439f3d){process[_0xcb66('0xc')](function(){syncho(function(){try{setChannelVariables(_0x439f3d);agiHandler(_0x439f3d);}catch(_0x58582b){logger[_0xcb66('0xd')](_0x58582b[_0xcb66('0xe')]);}});});}function listeningHandler(){console[_0xcb66('0xf')](_0xcb66('0x10'),config[_0xcb66('0xa')]['port']);logger[_0xcb66('0x11')](util[_0xcb66('0x12')](_0xcb66('0x13'),config[_0xcb66('0xa')]['ip'],config['agi'][_0xcb66('0x14')]));}function errorHandler(_0x3471f3){if(_0x3471f3&&_0x3471f3[_0xcb66('0x15')]&&_0x3471f3[_0xcb66('0x16')]){logger['error'](util[_0xcb66('0x12')](_0xcb66('0x17'),_0x3471f3[_0xcb66('0x15')],_0x3471f3[_0xcb66('0x16')]));}else{logger['error'](util[_0xcb66('0x12')]('[ERROR]\x20%s',_0x3471f3[_0xcb66('0xe')]));}}function closeHandler(){logger['info'](util[_0xcb66('0x12')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xcb66('0x18')],this[_0xcb66('0x19')],this[_0xcb66('0x1a')],this[_0xcb66('0x1b')]));try{createSquareReport(this);}catch(_0x4d99c0){logger[_0xcb66('0xd')](_0x4d99c0[_0xcb66('0xe')]);}}function timeoutHandler(){logger[_0xcb66('0x11')](util['format'](_0xcb66('0x1c'),this['arg_1'],this[_0xcb66('0x18')],this[_0xcb66('0x19')],this[_0xcb66('0x1a')],this[_0xcb66('0x1b')]));}function hangupHandler(){logger['info'](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xcb66('0x1d')],this['calleridname'],this['callerid'],this[_0xcb66('0x1a')],this['uniqueid']));this[_0xcb66('0x1e')]=!![];}function getRoot(_0x12e2bc){return parser[_0xcb66('0x1f')](_0x12e2bc,{'object':!![]})[_0xcb66('0x20')][_0xcb66('0x21')];}function addVertex(_0x204f15,_0x3391a0,_0x5977e1){_0x3391a0[_0xcb66('0x22')]=_0x5977e1;if(_0x3391a0['hasOwnProperty']('retry')){_0x3391a0[_0xcb66('0x23')]=parseInt(_0x3391a0[_0xcb66('0x24')],0xa);}_0x204f15[_0xcb66('0x25')](_['omit'](_0x3391a0,_0xcb66('0x26')));}function initGraph(_0x196ef6,_0x43cd8f){var _0x40e3de=new Graph();for(var _0x5affdb in _0x196ef6){if(_0x196ef6[_0xcb66('0x27')](_0x5affdb)){if(_[_0xcb66('0x28')](_0x196ef6[_0x5affdb])){for(var _0x134987=0x0;_0x134987<_0x196ef6[_0x5affdb][_0xcb66('0x29')];_0x134987+=0x1){addVertex(_0x40e3de,_0x196ef6[_0x5affdb][_0x134987],_0x5affdb);}}else{addVertex(_0x40e3de,_0x196ef6[_0x5affdb],_0x5affdb);}}}for(var _0x37a676=0x0;_0x37a676<_0x43cd8f[_0xcb66('0x29')];_0x37a676+=0x1){if(_0x43cd8f[_0x37a676][_0xcb66('0x2a')]&&_0x43cd8f[_0x37a676][_0xcb66('0x2b')]){_0x40e3de[_0xcb66('0x2c')](_0x43cd8f[_0x37a676][_0xcb66('0x2a')],_0x43cd8f[_0x37a676]['target'],_0x43cd8f[_0x37a676][_0xcb66('0x2d')]);}}return _0x40e3de;}function getSquareProject(_0x5b7cf2,_0x4dbb7f){rpc['getSquareProject'](_0x5b7cf2)[_0xcb66('0x2e')](function(_0x4ca8b4){_0x4dbb7f(null,_0x4ca8b4);})[_0xcb66('0x2f')](function(_0x228b0c){_0x4dbb7f(null,_0x228b0c);});}function createSquareReport(_0x1b8a79,_0x5d3fb5){rpc[_0xcb66('0x30')](_0x1b8a79)[_0xcb66('0x2e')](function(_0x266862){if(_0x5d3fb5){_0x5d3fb5(null,_0x266862);}})[_0xcb66('0x2f')](function(_0xa411e3){if(_0x5d3fb5){_0x5d3fb5(null,_0xa411e3);}});}function setChannelVariables(_0x375636){for(var _0x2a5e56 in _0x375636){if(_0x375636[_0xcb66('0x27')](_0x2a5e56)){if(_0x2a5e56[_0xcb66('0x31')](_0xcb66('0x32'))===0x0){_0x375636[_0x2a5e56['substring'](0x4)]=_0x375636[_0x2a5e56];delete _0x375636[_0x2a5e56];}}}}function getLogFromObject(_0x4529e8){return util[_0xcb66('0x33')](_0x4529e8,{'showHidden':![],'depth':null});}function agiHandler(_0xeba0d1){var _0x5f6d80,_0x1fea04,_0x128256,_0xec4052,_0x5a343f;logger[_0xcb66('0x34')](_0xcb66('0x35'),JSON[_0xcb66('0x36')](_0xeba0d1,null,0x2));logger[_0xcb66('0x11')](util['format'](_0xcb66('0x37'),_0xeba0d1[_0xcb66('0x1d')],_0xeba0d1[_0xcb66('0x18')],_0xeba0d1[_0xcb66('0x19')],_0xeba0d1[_0xcb66('0x1a')],_0xeba0d1[_0xcb66('0x1b')]));_0xeba0d1['on'](_0xcb66('0xd'),errorHandler);_0xeba0d1['on'](_0xcb66('0x38'),closeHandler);_0xeba0d1['on'](_0xcb66('0x39'),timeoutHandler);_0xeba0d1[_0xcb66('0x1e')]=![];_0xeba0d1['on'](_0xcb66('0x3a'),hangupHandler);var _0x17b087=getSquareProject['sync'](null,_0xeba0d1['arg_1']);if(_0x17b087){if(_0x17b087['production']){_0x5f6d80=getRoot(_0x17b087[_0xcb66('0x3b')]);if(_0x5f6d80&&_0x5f6d80[_0xcb66('0x3c')]){logger[_0xcb66('0x34')](_0xcb66('0x21'),JSON[_0xcb66('0x36')](_0x5f6d80,null,0x2));_0xeba0d1[_0xcb66('0x3d')]=moment()['format'](_0xcb66('0x3e'));_0x1fea04=initGraph(_['omit'](_0x5f6d80,'mxCell'),_0x5f6d80['mxCell']);_0x128256=new Vertices(_0xeba0d1,rpc,mailRpc);logger[_0xcb66('0x11')](util[_0xcb66('0x12')](_0xcb66('0x3f'),_0xeba0d1[_0xcb66('0x1d')],_0xeba0d1[_0xcb66('0x18')],_0xeba0d1[_0xcb66('0x19')],_0xeba0d1[_0xcb66('0x1a')],_0xeba0d1[_0xcb66('0x1b')]));_0x1fea04[_0xcb66('0x40')](_0x5f6d80['start']['id'],function(_0xe45331){try{_0xe45331=_0x128256[_0xcb66('0x41')](_0xe45331);logger[_0xcb66('0x34')]('vertex',JSON[_0xcb66('0x36')](_0xe45331,null,0x2));if(_0xe45331[_0xcb66('0x22')]==='gotoc'){logger['info'](_0xcb66('0x42'));_0xeba0d1['context']=_0xe45331['context']||_0xeba0d1[_0xcb66('0x43')];_0xeba0d1[_0xcb66('0x44')]=_0xe45331[_0xcb66('0x44')];_0xeba0d1[_0xcb66('0x45')]=_0xe45331[_0xcb66('0x45')]?_0xe45331[_0xcb66('0x45')]-0x1:0x1;return null;}else if(_0xe45331&&_0x128256[_0xe45331[_0xcb66('0x22')]]){_0x5a343f=_0x128256[_0xe45331[_0xcb66('0x22')]](_0xe45331);logger[_0xcb66('0x11')]('response',JSON['stringify'](_0x5a343f,null,0x2));if(_0x5a343f&&_0x5a343f['code']===AGI_CODE_SUCCESS&&_0x5a343f[_0xcb66('0x46')]!==AGI_RESULT_ERROR&&!_0xeba0d1['evtHangup']){logger[_0xcb66('0x34')]('response',getLogFromObject(_0x5a343f));return _[_0xcb66('0x47')](_0x5a343f[_0xcb66('0x46')])?null:_0x5a343f[_0xcb66('0x46')][_0xcb66('0x48')]();}else{logger[_0xcb66('0xd')](_0xcb66('0x49'),getLogFromObject(_0x5a343f));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x437490){logger[_0xcb66('0xd')](_0x437490[_0xcb66('0xe')]);return null;}});if(_0x5f6d80[_0xcb66('0x4a')]){logger[_0xcb66('0x11')](util[_0xcb66('0x12')](_0xcb66('0x4b'),_0xeba0d1[_0xcb66('0x1d')],_0xeba0d1[_0xcb66('0x18')],_0xeba0d1['callerid'],_0xeba0d1[_0xcb66('0x1a')],_0xeba0d1[_0xcb66('0x1b')]));_0x1fea04[_0xcb66('0x40')](_0x5f6d80[_0xcb66('0x4a')]['id'],function(_0x4a2465){try{_0x4a2465=_0x128256[_0xcb66('0x41')](_0x4a2465);logger[_0xcb66('0x34')](_0xcb66('0x4c'),JSON['stringify'](_0x4a2465,null,0x2));if(_0x4a2465&&_0x128256[_0x4a2465[_0xcb66('0x22')]]){_0x5a343f=_0x128256[_0x4a2465[_0xcb66('0x22')]](_0x4a2465);if(_0x5a343f){logger[_0xcb66('0x34')](_0xcb66('0x49'),getLogFromObject(_0x5a343f));return _['isUndefined'](_0x5a343f[_0xcb66('0x46')])?null:_0x5a343f[_0xcb66('0x46')][_0xcb66('0x48')]();}else{logger['error']('response',getLogFromObject(_0x5a343f));return null;}}else{logger[_0xcb66('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x37262a){logger['error'](_0x37262a[_0xcb66('0xe')]);return null;}});}logger[_0xcb66('0x11')](util[_0xcb66('0x12')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xeba0d1[_0xcb66('0x1d')],_0xeba0d1['calleridname'],_0xeba0d1[_0xcb66('0x19')],_0xeba0d1[_0xcb66('0x1a')],_0xeba0d1[_0xcb66('0x1b')]));logger[_0xcb66('0x11')](util[_0xcb66('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0xeba0d1[_0xcb66('0x43')],_0xeba0d1['extension'],parseInt(_0xeba0d1[_0xcb66('0x45')],0xa)+0x1));_0xeba0d1[_0xcb66('0x4d')](_0xeba0d1[_0xcb66('0x43')],_0xeba0d1['extension'],parseInt(_0xeba0d1['priority'],0xa)+0x1);_0xeba0d1['close']();}}else{logger[_0xcb66('0xd')](util[_0xcb66('0x12')](_0xcb66('0x4e'),_0xeba0d1[_0xcb66('0x1d')]));_0xeba0d1[_0xcb66('0x4d')](_0xeba0d1[_0xcb66('0x43')],_0xeba0d1[_0xcb66('0x44')],parseInt(_0xeba0d1[_0xcb66('0x45')],0xa)+0x1);_0xeba0d1[_0xcb66('0x38')]();}}else{logger[_0xcb66('0xd')](util['format'](_0xcb66('0x4f'),_0xeba0d1[_0xcb66('0x1d')]));_0xeba0d1[_0xcb66('0x4d')](_0xeba0d1[_0xcb66('0x43')],_0xeba0d1['extension'],parseInt(_0xeba0d1['priority'],0xa)+0x1);_0xeba0d1[_0xcb66('0x38')]();}}function main(){var _0x476c9a;return utilLicense[_0xcb66('0x50')]()[_0xcb66('0x2e')](function(_0xff3820){if(_0xff3820){if(_0xff3820[_0xcb66('0x51')]){if(_0xff3820['callysquare']&&_0xff3820[_0xcb66('0x52')]>0x0){logger[_0xcb66('0x11')](util[_0xcb66('0x12')](_0xcb66('0x53'),_0xff3820['callysquare']));_0x476c9a=_0xff3820[_0xcb66('0x52')];}else{logger['info'](_0xcb66('0x54'));}}else{logger['info'](_0xcb66('0x55'));_0x476c9a=-0x1;}}})[_0xcb66('0x2f')](function(_0x146a06){logger['error']('[LICENSE]',_0x146a06[_0xcb66('0xe')]);})[_0xcb66('0x4a')](function(){var _0x55ab08=require('./server')(config[_0xcb66('0xa')]['port'],config[_0xcb66('0xa')]['ip'],_0x476c9a);_0x55ab08['on']('error',errorHandler);_0x55ab08['on'](_0xcb66('0x56'),listeningHandler);_0x55ab08['on'](_0xcb66('0x57'),connectionHandler);_0x55ab08['on'](_0xcb66('0x38'),closeHandler);});}main(); \ No newline at end of file +var _0xf2ca=['[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','gotoc','context','priority','result','response','toString','agicommand\x20not\x20found','finally','clear','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','extension','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','catch','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./graph','./vertices','defaults','127.0.0.1','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','name','format','[%s]\x20%s','message','error','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','value','getSquareProject','then','agi_','substring','inspect','debug','stringify','close','timeout','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xf2ca[_0x46e363];return _0x3fb059;};'use strict';var parser=require(_0xaf2c('0x0'));var _=require(_0xaf2c('0x1'));var syncho=require(_0xaf2c('0x2'));var util=require('util');var moment=require(_0xaf2c('0x3'));var config=require(_0xaf2c('0x4'));var logger=require(_0xaf2c('0x5'))(_0xaf2c('0x6'));var utilLicense=require(_0xaf2c('0x7'));var rpc=require(_0xaf2c('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0xaf2c('0x9'));var Vertices=require(_0xaf2c('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xaf2c('0x6')]=_[_0xaf2c('0xb')](config['agi'],{'ip':_0xaf2c('0xc'),'port':0x11dd});function connectionHandler(_0x3c0421){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x3c0421);agiHandler(_0x3c0421);}catch(_0x2a011d){logger['error'](_0x2a011d[_0xaf2c('0xd')]);}});});}function listeningHandler(){console['log'](_0xaf2c('0xe'),config[_0xaf2c('0x6')][_0xaf2c('0xf')]);logger[_0xaf2c('0x10')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xaf2c('0x6')]['ip'],config[_0xaf2c('0x6')][_0xaf2c('0xf')]));}function errorHandler(_0xd56a5d){if(_0xd56a5d&&_0xd56a5d[_0xaf2c('0x11')]&&_0xd56a5d['message']){logger['error'](util[_0xaf2c('0x12')](_0xaf2c('0x13'),_0xd56a5d[_0xaf2c('0x11')],_0xd56a5d[_0xaf2c('0x14')]));}else{logger[_0xaf2c('0x15')](util[_0xaf2c('0x12')](_0xaf2c('0x16'),_0xd56a5d[_0xaf2c('0xd')]));}}function closeHandler(){logger[_0xaf2c('0x10')](util[_0xaf2c('0x12')](_0xaf2c('0x17'),this[_0xaf2c('0x18')],this[_0xaf2c('0x19')],this[_0xaf2c('0x1a')],this[_0xaf2c('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x3ca650){logger['error'](_0x3ca650[_0xaf2c('0xd')]);}}function timeoutHandler(){logger[_0xaf2c('0x10')](util[_0xaf2c('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xaf2c('0x18')],this[_0xaf2c('0x19')],this[_0xaf2c('0x1a')],this[_0xaf2c('0x1b')],this[_0xaf2c('0x1c')]));}function hangupHandler(){logger[_0xaf2c('0x10')](util['format'](_0xaf2c('0x1d'),this[_0xaf2c('0x18')],this[_0xaf2c('0x19')],this[_0xaf2c('0x1a')],this[_0xaf2c('0x1b')],this['uniqueid']));this[_0xaf2c('0x1e')]=!![];}function getRoot(_0xbf6f62){return parser[_0xaf2c('0x1f')](_0xbf6f62,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x29cbdf,_0x303546,_0x1cafad){_0x303546[_0xaf2c('0x20')]=_0x1cafad;if(_0x303546['hasOwnProperty'](_0xaf2c('0x21'))){_0x303546[_0xaf2c('0x22')]=parseInt(_0x303546[_0xaf2c('0x21')],0xa);}_0x29cbdf[_0xaf2c('0x23')](_[_0xaf2c('0x24')](_0x303546,_0xaf2c('0x25')));}function initGraph(_0xf0a56c,_0x4a8dd8){var _0x29f8b0=new Graph();for(var _0x2051be in _0xf0a56c){if(_0xf0a56c[_0xaf2c('0x26')](_0x2051be)){if(_[_0xaf2c('0x27')](_0xf0a56c[_0x2051be])){for(var _0x4b7cf2=0x0;_0x4b7cf2<_0xf0a56c[_0x2051be][_0xaf2c('0x28')];_0x4b7cf2+=0x1){addVertex(_0x29f8b0,_0xf0a56c[_0x2051be][_0x4b7cf2],_0x2051be);}}else{addVertex(_0x29f8b0,_0xf0a56c[_0x2051be],_0x2051be);}}}for(var _0x589d47=0x0;_0x589d47<_0x4a8dd8[_0xaf2c('0x28')];_0x589d47+=0x1){if(_0x4a8dd8[_0x589d47][_0xaf2c('0x29')]&&_0x4a8dd8[_0x589d47][_0xaf2c('0x2a')]){_0x29f8b0['addEdge'](_0x4a8dd8[_0x589d47][_0xaf2c('0x29')],_0x4a8dd8[_0x589d47][_0xaf2c('0x2a')],_0x4a8dd8[_0x589d47][_0xaf2c('0x2b')]);}}return _0x29f8b0;}function getSquareProject(_0x4a96d2,_0xe18ba7){rpc[_0xaf2c('0x2c')](_0x4a96d2)[_0xaf2c('0x2d')](function(_0x19364e){_0xe18ba7(null,_0x19364e);})['catch'](function(_0x3da072){_0xe18ba7(null,_0x3da072);});}function createSquareReport(_0x4072ff,_0x1be1ef){rpc['createSquareReport'](_0x4072ff)['then'](function(_0x359cab){if(_0x1be1ef){_0x1be1ef(null,_0x359cab);}})['catch'](function(_0x39c0ed){if(_0x1be1ef){_0x1be1ef(null,_0x39c0ed);}});}function setChannelVariables(_0x5e7247){for(var _0x337cea in _0x5e7247){if(_0x5e7247[_0xaf2c('0x26')](_0x337cea)){if(_0x337cea['indexOf'](_0xaf2c('0x2e'))===0x0){_0x5e7247[_0x337cea[_0xaf2c('0x2f')](0x4)]=_0x5e7247[_0x337cea];delete _0x5e7247[_0x337cea];}}}}function getLogFromObject(_0x54db57){return util[_0xaf2c('0x30')](_0x54db57,{'showHidden':![],'depth':null});}function agiHandler(_0xbec302){var _0x211a69,_0x53d58c,_0x2d6ed7,_0x30ae30,_0x5b1a7c;logger[_0xaf2c('0x31')]('variables',JSON[_0xaf2c('0x32')](_0xbec302,null,0x2));logger['info'](util[_0xaf2c('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbec302[_0xaf2c('0x18')],_0xbec302['calleridname'],_0xbec302[_0xaf2c('0x1a')],_0xbec302['dnid'],_0xbec302[_0xaf2c('0x1c')]));_0xbec302['on'](_0xaf2c('0x15'),errorHandler);_0xbec302['on'](_0xaf2c('0x33'),closeHandler);_0xbec302['on'](_0xaf2c('0x34'),timeoutHandler);_0xbec302[_0xaf2c('0x1e')]=![];_0xbec302['on']('hangup',hangupHandler);var _0x4cba13=getSquareProject[_0xaf2c('0x35')](null,_0xbec302[_0xaf2c('0x18')]);if(_0x4cba13){if(_0x4cba13[_0xaf2c('0x36')]){_0x211a69=getRoot(_0x4cba13[_0xaf2c('0x36')]);if(_0x211a69&&_0x211a69[_0xaf2c('0x37')]){logger[_0xaf2c('0x31')]('root',JSON[_0xaf2c('0x32')](_0x211a69,null,0x2));_0xbec302[_0xaf2c('0x38')]=moment()['format'](_0xaf2c('0x39'));_0x53d58c=initGraph(_[_0xaf2c('0x24')](_0x211a69,_0xaf2c('0x25')),_0x211a69[_0xaf2c('0x25')]);_0x2d6ed7=new Vertices(_0xbec302,rpc,mailRpc);logger[_0xaf2c('0x10')](util[_0xaf2c('0x12')](_0xaf2c('0x3a'),_0xbec302[_0xaf2c('0x18')],_0xbec302[_0xaf2c('0x19')],_0xbec302[_0xaf2c('0x1a')],_0xbec302[_0xaf2c('0x1b')],_0xbec302[_0xaf2c('0x1c')]));_0x53d58c[_0xaf2c('0x3b')](_0x211a69['start']['id'],function(_0x54a953){try{_0x54a953=_0x2d6ed7['clear'](_0x54a953);logger[_0xaf2c('0x31')](_0xaf2c('0x3c'),JSON[_0xaf2c('0x32')](_0x54a953,null,0x2));if(_0x54a953[_0xaf2c('0x20')]===_0xaf2c('0x3d')){logger[_0xaf2c('0x10')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0xbec302[_0xaf2c('0x3e')]=_0x54a953[_0xaf2c('0x3e')]||_0xbec302[_0xaf2c('0x3e')];_0xbec302['extension']=_0x54a953['extension'];_0xbec302[_0xaf2c('0x3f')]=_0x54a953['priority']?_0x54a953[_0xaf2c('0x3f')]-0x1:0x1;return null;}else if(_0x54a953&&_0x2d6ed7[_0x54a953[_0xaf2c('0x20')]]){_0x5b1a7c=_0x2d6ed7[_0x54a953[_0xaf2c('0x20')]](_0x54a953);logger[_0xaf2c('0x10')]('response',JSON[_0xaf2c('0x32')](_0x5b1a7c,null,0x2));if(_0x5b1a7c&&_0x5b1a7c['code']===AGI_CODE_SUCCESS&&_0x5b1a7c[_0xaf2c('0x40')]!==AGI_RESULT_ERROR&&!_0xbec302[_0xaf2c('0x1e')]){logger['debug'](_0xaf2c('0x41'),getLogFromObject(_0x5b1a7c));return _['isUndefined'](_0x5b1a7c[_0xaf2c('0x40')])?null:_0x5b1a7c[_0xaf2c('0x40')][_0xaf2c('0x42')]();}else{logger[_0xaf2c('0x15')](_0xaf2c('0x41'),getLogFromObject(_0x5b1a7c));return null;}}else{logger[_0xaf2c('0x15')](_0xaf2c('0x43'));return null;}}catch(_0x16b469){logger[_0xaf2c('0x15')](_0x16b469['stack']);return null;}});if(_0x211a69['finally']){logger[_0xaf2c('0x10')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbec302['arg_1'],_0xbec302[_0xaf2c('0x19')],_0xbec302[_0xaf2c('0x1a')],_0xbec302[_0xaf2c('0x1b')],_0xbec302[_0xaf2c('0x1c')]));_0x53d58c['traverseBFS'](_0x211a69[_0xaf2c('0x44')]['id'],function(_0x52e2c1){try{_0x52e2c1=_0x2d6ed7[_0xaf2c('0x45')](_0x52e2c1);logger['debug'](_0xaf2c('0x3c'),JSON[_0xaf2c('0x32')](_0x52e2c1,null,0x2));if(_0x52e2c1&&_0x2d6ed7[_0x52e2c1[_0xaf2c('0x20')]]){_0x5b1a7c=_0x2d6ed7[_0x52e2c1[_0xaf2c('0x20')]](_0x52e2c1);if(_0x5b1a7c){logger[_0xaf2c('0x31')]('response',getLogFromObject(_0x5b1a7c));return _[_0xaf2c('0x46')](_0x5b1a7c[_0xaf2c('0x40')])?null:_0x5b1a7c['result']['toString']();}else{logger[_0xaf2c('0x15')]('response',getLogFromObject(_0x5b1a7c));return null;}}else{logger[_0xaf2c('0x15')](_0xaf2c('0x43'));return null;}}catch(_0x17b9ec){logger[_0xaf2c('0x15')](_0x17b9ec[_0xaf2c('0xd')]);return null;}});}logger[_0xaf2c('0x10')](util[_0xaf2c('0x12')](_0xaf2c('0x47'),_0xbec302[_0xaf2c('0x18')],_0xbec302[_0xaf2c('0x19')],_0xbec302[_0xaf2c('0x1a')],_0xbec302['dnid'],_0xbec302[_0xaf2c('0x1c')]));logger[_0xaf2c('0x10')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0xbec302['context'],_0xbec302[_0xaf2c('0x48')],parseInt(_0xbec302[_0xaf2c('0x3f')],0xa)+0x1));_0xbec302['continueAt'](_0xbec302[_0xaf2c('0x3e')],_0xbec302[_0xaf2c('0x48')],parseInt(_0xbec302[_0xaf2c('0x3f')],0xa)+0x1);_0xbec302[_0xaf2c('0x33')]();}}else{logger[_0xaf2c('0x15')](util[_0xaf2c('0x12')](_0xaf2c('0x49'),_0xbec302['arg_1']));_0xbec302[_0xaf2c('0x4a')](_0xbec302[_0xaf2c('0x3e')],_0xbec302['extension'],parseInt(_0xbec302[_0xaf2c('0x3f')],0xa)+0x1);_0xbec302[_0xaf2c('0x33')]();}}else{logger[_0xaf2c('0x15')](util[_0xaf2c('0x12')](_0xaf2c('0x4b'),_0xbec302[_0xaf2c('0x18')]));_0xbec302[_0xaf2c('0x4a')](_0xbec302[_0xaf2c('0x3e')],_0xbec302[_0xaf2c('0x48')],parseInt(_0xbec302[_0xaf2c('0x3f')],0xa)+0x1);_0xbec302[_0xaf2c('0x33')]();}}function main(){var _0x10a270;return utilLicense[_0xaf2c('0x4c')]()[_0xaf2c('0x2d')](function(_0x297a22){if(_0x297a22){if(_0x297a22[_0xaf2c('0x4d')]){if(_0x297a22[_0xaf2c('0x4e')]&&_0x297a22[_0xaf2c('0x4e')]>0x0){logger[_0xaf2c('0x10')](util[_0xaf2c('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x297a22[_0xaf2c('0x4e')]));_0x10a270=_0x297a22[_0xaf2c('0x4e')];}else{logger[_0xaf2c('0x10')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xaf2c('0x10')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x10a270=-0x1;}}})[_0xaf2c('0x4f')](function(_0x2bce19){logger[_0xaf2c('0x15')](_0xaf2c('0x50'),_0x2bce19[_0xaf2c('0xd')]);})[_0xaf2c('0x44')](function(){var _0x118e03=require(_0xaf2c('0x51'))(config[_0xaf2c('0x6')]['port'],config[_0xaf2c('0x6')]['ip'],_0x10a270);_0x118e03['on'](_0xaf2c('0x15'),errorHandler);_0x118e03['on'](_0xaf2c('0x52'),listeningHandler);_0x118e03['on'](_0xaf2c('0x53'),connectionHandler);_0x118e03['on'](_0xaf2c('0x33'),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 8743c24..173b76d 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x2b6ab9,_0x2aef6e){var _0x633d8c=function(_0x5ac1b1){while(--_0x5ac1b1){_0x2b6ab9['push'](_0x2b6ab9['shift']());}};_0x633d8c(++_0x2aef6e);}(_0x814b,0x1a2));var _0xb814=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0x814b[_0x36d703];return _0x12c909;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x477d81,_0x32ed61){var _0xa9bd15=function(_0x370b9f){while(--_0x370b9f){_0x477d81['push'](_0x477d81['shift']());}};_0xa9bd15(++_0x32ed61);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 6296474..ab47372 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(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0xb10b[_0x4bb2b9];return _0x40e2a2;};'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 _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0xcf098d,_0x1b9e69){var _0x99daff=function(_0x3aedcc){while(--_0x3aedcc){_0xcf098d['push'](_0xcf098d['shift']());}};_0x99daff(++_0x1b9e69);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2272c3,_0x4e81bc){_0x2272c3=_0x2272c3-0x0;var _0x43645f=_0x5f2f[_0x2272c3];return _0x43645f;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 05482ba..d16aaf2 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 _0xc719=['agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','http','request','then','error','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','ShowUser','getTrunkById','name','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','CreateCmContact','ShowPause','agentLogin','PauseUser','UnpauseUser'];(function(_0xf4f960,_0x1c9a01){var _0x39ffba=function(_0x472f36){while(--_0x472f36){_0xf4f960['push'](_0xf4f960['shift']());}};_0x39ffba(++_0x1c9a01);}(_0xc719,0x1d2));var _0x9c71=function(_0x5491e5,_0x37a869){_0x5491e5=_0x5491e5-0x0;var _0x214eb5=_0xc719[_0x5491e5];return _0x214eb5;};'use strict';var BPromise=require(_0x9c71('0x0'));var moment=require(_0x9c71('0x1'));var _=require(_0x9c71('0x2'));var util=require(_0x9c71('0x3'));var jayson=require(_0x9c71('0x4'));var client=jayson['client'][_0x9c71('0x5')]({'port':0x2329});function request(_0x490aa1,_0x198665){return new BPromise(function(_0x1ecca1,_0x1e8835){return client[_0x9c71('0x6')](_0x490aa1,_0x198665)[_0x9c71('0x7')](function(_0x3c5d31){if(_0x3c5d31[_0x9c71('0x8')]){return _0x1e8835(_0x3c5d31[_0x9c71('0x8')]['message']);}else{return _0x1ecca1(_0x3c5d31[_0x9c71('0x9')]);}})[_0x9c71('0xa')](function(_0x27d63c){return _0x1e8835(_0x27d63c);});});}exports[_0x9c71('0xb')]=function(_0x37bc17){return request(_0x9c71('0xc'),{'options':{'raw':![],'where':{'name':_0x37bc17},'attributes':[_0x9c71('0xd')]}});};exports[_0x9c71('0xe')]=function(_0x4494c8){return request(_0x9c71('0xf'),{'options':{'raw':![],'where':{'id':_0x4494c8},'include':[{'model':_0x9c71('0x10'),'as':_0x9c71('0x11')}],'attributes':['id','name','email']}});};exports[_0x9c71('0x12')]=function(_0x53534e){return request(_0x9c71('0xc'),{'options':{'where':{'id':_0x53534e},'attributes':['name']}});};exports[_0x9c71('0x13')]=function(_0x2d99ab){return request(_0x9c71('0x14'),{'options':{'where':{'id':_0x2d99ab},'attributes':['name']}});};exports[_0x9c71('0x15')]=function(_0x4a5095){return request(_0x9c71('0x16'),{'options':{'where':{'id':_0x4a5095},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x232212){return request(_0x9c71('0x17'),{'options':{'where':{'id':_0x232212},'attributes':['dsn']}});};exports['getUserById']=function(_0x5c24b9){return request(_0x9c71('0x18'),{'options':{'where':{'id':_0x5c24b9},'attributes':['name']}});};exports[_0x9c71('0x19')]=function(_0x1e8f7f){return request('ShowTrunk',{'options':{'where':{'id':_0x1e8f7f},'attributes':[_0x9c71('0x1a')]}});};exports[_0x9c71('0x1b')]=function(_0x550bc1){return request(_0x9c71('0x1c'),{'options':{'where':{'id':_0x550bc1},'attributes':[_0x9c71('0x1d')]}});};exports[_0x9c71('0x1e')]=function(_0x34f171){return request(_0x9c71('0x1f'),{'options':{'raw':![],'where':{'id':_0x34f171},'include':[{'model':_0x9c71('0x20'),'as':_0x9c71('0x21')}]}});};exports[_0x9c71('0x22')]=function(_0x2a50f4){return request(_0x9c71('0x23'),{'options':{'where':{'id':_0x2a50f4},'attributes':['id',_0x9c71('0x1a')]}});};exports[_0x9c71('0x24')]=function(_0x249405){return request(_0x9c71('0x25'),{'body':_0x249405});};exports['createSquareDetailsReport']=function(_0x5bdddb){return request(_0x9c71('0x26'),{'body':_0x5bdddb});};exports['createSquareReport']=function(_0x108153){return request(_0x9c71('0x27'),{'body':_['merge'](_0x108153,{'project_name':_0x108153[_0x9c71('0x28')],'prev_project_name':_0x108153[_0x9c71('0x29')]||'','is_subproject':_0x108153[_0x9c71('0x29')]?!![]:![],'leaveAt':moment()[_0x9c71('0x2a')](_0x9c71('0x2b'))})});};exports[_0x9c71('0x2c')]=function(_0x5aa446){return request(_0x9c71('0x2d'),{'body':_0x5aa446});};exports[_0x9c71('0x2e')]=function(_0x170b4a){return request(_0x9c71('0x2f'),{'body':_0x170b4a});};exports[_0x9c71('0x30')]=function(_0x485804){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x485804[_0x9c71('0x31')],'ListId':_0x485804[_0x9c71('0x32')]}}})[_0x9c71('0x7')](function(_0x39670){if(_0x39670){return _0x39670;}return request(_0x9c71('0x33'),{'body':_0x485804});});};exports['getPauseById']=function(_0xd9ce71){return request(_0x9c71('0x34'),{'options':{'where':{'id':_0xd9ce71},'attributes':[_0x9c71('0x1a')]}});};exports[_0x9c71('0x35')]=function(_0x14bd5c,_0x172129){return request('LoginUser',{'body':{'interface':_0x172129},'options':{'where':_0x14bd5c}});};exports['agentPause']=function(_0x18a51a,_0x408b58,_0x3179e6){return request(_0x9c71('0x36'),{'body':{'type':_0x408b58,'uniqueid':_0x3179e6},'options':{'where':_0x18a51a}});};exports['agentUnpause']=function(_0x10afaf){return request(_0x9c71('0x37'),{'body':{},'options':{'where':_0x10afaf}});};exports[_0x9c71('0x38')]=function(_0x56f55d){return request(_0x9c71('0x39'),{'body':{},'options':{'where':_0x56f55d}});}; \ No newline at end of file +var _0xa9e7=['merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','moment','lodash','util','jayson/promise','client','request','then','error','message','result','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','dsn','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','createSquareReport'];(function(_0x210a54,_0x29be0a){var _0x425bb0=function(_0xa9ea41){while(--_0xa9ea41){_0x210a54['push'](_0x210a54['shift']());}};_0x425bb0(++_0x29be0a);}(_0xa9e7,0x79));var _0x7a9e=function(_0xb79c0b,_0x45f477){_0xb79c0b=_0xb79c0b-0x0;var _0xf40ed9=_0xa9e7[_0xb79c0b];return _0xf40ed9;};'use strict';var BPromise=require('bluebird');var moment=require(_0x7a9e('0x0'));var _=require(_0x7a9e('0x1'));var util=require(_0x7a9e('0x2'));var jayson=require(_0x7a9e('0x3'));var client=jayson[_0x7a9e('0x4')]['http']({'port':0x2329});function request(_0x3c5260,_0x29a132){return new BPromise(function(_0x1aea3a,_0x22dd2e){return client[_0x7a9e('0x5')](_0x3c5260,_0x29a132)[_0x7a9e('0x6')](function(_0x1f890a){if(_0x1f890a[_0x7a9e('0x7')]){return _0x22dd2e(_0x1f890a[_0x7a9e('0x7')][_0x7a9e('0x8')]);}else{return _0x1aea3a(_0x1f890a[_0x7a9e('0x9')]);}})[_0x7a9e('0xa')](function(_0x264650){return _0x22dd2e(_0x264650);});});}exports[_0x7a9e('0xb')]=function(_0x2dfd31){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x2dfd31},'attributes':[_0x7a9e('0xc')]}});};exports[_0x7a9e('0xd')]=function(_0x2b2e1d){return request(_0x7a9e('0xe'),{'options':{'raw':![],'where':{'id':_0x2b2e1d},'include':[{'model':_0x7a9e('0xf'),'as':'Smtp'}],'attributes':['id',_0x7a9e('0x10'),_0x7a9e('0x11')]}});};exports['getSquareProjectById']=function(_0x46b68a){return request(_0x7a9e('0x12'),{'options':{'where':{'id':_0x46b68a},'attributes':['name']}});};exports[_0x7a9e('0x13')]=function(_0x35476c){return request(_0x7a9e('0x14'),{'options':{'where':{'id':_0x35476c},'attributes':['name']}});};exports[_0x7a9e('0x15')]=function(_0x4baaf1){return request(_0x7a9e('0x16'),{'options':{'where':{'id':_0x4baaf1},'attributes':[_0x7a9e('0x10')]}});};exports['getSquareOdbcById']=function(_0x50e250){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x50e250},'attributes':[_0x7a9e('0x17')]}});};exports['getUserById']=function(_0x3c17d7){return request('ShowUser',{'options':{'where':{'id':_0x3c17d7},'attributes':[_0x7a9e('0x10')]}});};exports[_0x7a9e('0x18')]=function(_0x51fbc0){return request(_0x7a9e('0x19'),{'options':{'where':{'id':_0x51fbc0},'attributes':[_0x7a9e('0x10')]}});};exports['getSoundById']=function(_0x25e31f){return request(_0x7a9e('0x1a'),{'options':{'where':{'id':_0x25e31f},'attributes':[_0x7a9e('0x1b')]}});};exports[_0x7a9e('0x1c')]=function(_0x5540a9){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x5540a9},'include':[{'model':_0x7a9e('0x1d'),'as':_0x7a9e('0x1e')}]}});};exports[_0x7a9e('0x1f')]=function(_0xaa6435){return request(_0x7a9e('0x20'),{'options':{'where':{'id':_0xaa6435},'attributes':['id',_0x7a9e('0x10')]}});};exports['createSmsMessage']=function(_0x388714){return request('CreateSmsMessage',{'body':_0x388714});};exports[_0x7a9e('0x21')]=function(_0xfd39a8){return request('CreateSquareDetailsReport',{'body':_0xfd39a8});};exports[_0x7a9e('0x22')]=function(_0x25e997){return request('CreateSquareReport',{'body':_[_0x7a9e('0x23')](_0x25e997,{'project_name':_0x25e997['arg_1'],'prev_project_name':_0x25e997[_0x7a9e('0x24')]||'','is_subproject':_0x25e997[_0x7a9e('0x24')]?!![]:![],'leaveAt':moment()[_0x7a9e('0x25')](_0x7a9e('0x26'))})});};exports[_0x7a9e('0x27')]=function(_0x1c3af1){return request(_0x7a9e('0x28'),{'body':_0x1c3af1});};exports['createSquareMessage']=function(_0x90bc7a){return request(_0x7a9e('0x29'),{'body':_0x90bc7a});};exports[_0x7a9e('0x2a')]=function(_0x39d898){return request(_0x7a9e('0x2b'),{'options':{'raw':![],'where':{'phone':_0x39d898[_0x7a9e('0x2c')],'ListId':_0x39d898['ListId']}}})[_0x7a9e('0x6')](function(_0x49bccf){if(_0x49bccf){return _0x49bccf;}return request(_0x7a9e('0x2d'),{'body':_0x39d898});});};exports['getPauseById']=function(_0x2e05f0){return request(_0x7a9e('0x2e'),{'options':{'where':{'id':_0x2e05f0},'attributes':['name']}});};exports[_0x7a9e('0x2f')]=function(_0x3826d8,_0x4dac40){return request(_0x7a9e('0x30'),{'body':{'interface':_0x4dac40},'options':{'where':_0x3826d8}});};exports[_0x7a9e('0x31')]=function(_0x4757f4,_0x15534a,_0x5e47db){return request(_0x7a9e('0x32'),{'body':{'type':_0x15534a,'uniqueid':_0x5e47db},'options':{'where':_0x4757f4}});};exports['agentUnpause']=function(_0x9a0ee){return request(_0x7a9e('0x33'),{'body':{},'options':{'where':_0x9a0ee}});};exports['agentLogout']=function(_0xee354c){return request('LogoutUser',{'body':{},'options':{'where':_0xee354c}});}; \ 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 5017aa0..67038d2 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 _0x35f0=['./polly','./lex','exports'];(function(_0x35fc9f,_0x531f14){var _0xf7ff51=function(_0x68201f){while(--_0x68201f){_0x35fc9f['push'](_0x35fc9f['shift']());}};_0xf7ff51(++_0x531f14);}(_0x35f0,0x111));var _0x035f=function(_0x33e865,_0x448776){_0x33e865=_0x33e865-0x0;var _0x5c8fcf=_0x35f0[_0x33e865];return _0x5c8fcf;};var polly=require(_0x035f('0x0'));var lex=require(_0x035f('0x1'));module[_0x035f('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4e5d=['exports','./polly','./lex'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0x4e5d,0xd3));var _0xd4e5=function(_0x2de41e,_0x12a7dc){_0x2de41e=_0x2de41e-0x0;var _0x2e70d1=_0x4e5d[_0x2de41e];return _0x2e70d1;};var polly=require(_0xd4e5('0x0'));var lex=require(_0xd4e5('0x1'));module[_0xd4e5('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 005c00b..01070b1 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 _0x32ef=['exports','./lib/api'];(function(_0x421b89,_0x41a378){var _0x3fbba5=function(_0x3713b3){while(--_0x3713b3){_0x421b89['push'](_0x421b89['shift']());}};_0x3fbba5(++_0x41a378);}(_0x32ef,0xf9));var _0xf32e=function(_0x2df61f,_0x180ede){_0x2df61f=_0x2df61f-0x0;var _0x5ce3fb=_0x32ef[_0x2df61f];return _0x5ce3fb;};'use strict';var lex=require(_0xf32e('0x0'));module[_0xf32e('0x1')]=function(_0x1ec4de,_0x2aaadd,_0x286041,_0x82113b,_0x5da060,_0x232ead){return lex(_0x1ec4de,_0x2aaadd,_0x286041,_0x82113b,_0x5da060,_0x232ead);}; \ No newline at end of file +var _0xc91b=['exports','./lib/api'];(function(_0x46d62a,_0x193b92){var _0x43c746=function(_0x22bfbf){while(--_0x22bfbf){_0x46d62a['push'](_0x46d62a['shift']());}};_0x43c746(++_0x193b92);}(_0xc91b,0x16f));var _0xbc91=function(_0x531a81,_0x32cfa1){_0x531a81=_0x531a81-0x0;var _0x4b0956=_0xc91b[_0x531a81];return _0x4b0956;};'use strict';var lex=require(_0xbc91('0x0'));module[_0xbc91('0x1')]=function(_0x33a03d,_0xaca0fa,_0x2a5f39,_0xb4810d,_0x1ac340,_0x16ae0f){return lex(_0x33a03d,_0xaca0fa,_0x2a5f39,_0xb4810d,_0x1ac340,_0x16ae0f);}; \ 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 45f649a..916b578 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 _0x9480=['slots','hasOwnProperty','slot_','LexRuntime','$LATEST','bluebird','aws-sdk','postText'];(function(_0x378a60,_0x271d16){var _0x5964d6=function(_0x499487){while(--_0x499487){_0x378a60['push'](_0x378a60['shift']());}};_0x5964d6(++_0x271d16);}(_0x9480,0x11d));var _0x0948=function(_0x4303e1,_0x492c81){_0x4303e1=_0x4303e1-0x0;var _0x548ec9=_0x9480[_0x4303e1];return _0x548ec9;};'use strict';var BPromise=require(_0x0948('0x0'));var AWS=require(_0x0948('0x1'));function lexResult(_0x59bf45,_0x314e0e){return new BPromise(function(_0x2e30e0,_0xa9ad81){_0x59bf45[_0x0948('0x2')](_0x314e0e,function(_0xd07dc4,_0x4b0253){if(_0xd07dc4){_0xa9ad81(_0xd07dc4);}if(_0x4b0253[_0x0948('0x3')]){for(const _0x248705 in _0x4b0253[_0x0948('0x3')]){if(_0x4b0253['slots'][_0x0948('0x4')](_0x248705)){var _0x3aac2c=_0x4b0253[_0x0948('0x3')][_0x248705];_0x4b0253[_0x0948('0x5')+_0x248705]=_0x3aac2c;}}}_0x2e30e0(_0x4b0253);});});}module['exports']=function(_0x55b9ce,_0x311d4c,_0x4b0019,_0x744bef,_0x5be5c,_0x5547a1){var _0x551e8e=new AWS[(_0x0948('0x6'))]({'accessKeyId':_0x311d4c,'secretAccessKey':_0x4b0019,'region':_0x744bef});var _0x26a4d3={'botAlias':_0x0948('0x7'),'botName':_0x5547a1,'inputText':_0x5be5c,'userId':_0x55b9ce};return lexResult(_0x551e8e,_0x26a4d3);}; \ No newline at end of file +var _0xc682=['$LATEST','bluebird','postText','slots','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc682,0x9c));var _0x2c68=function(_0x1ad99e,_0x528ab4){_0x1ad99e=_0x1ad99e-0x0;var _0xfe2930=_0xc682[_0x1ad99e];return _0xfe2930;};'use strict';var BPromise=require(_0x2c68('0x0'));var AWS=require('aws-sdk');function lexResult(_0x4f3d00,_0x3877b0){return new BPromise(function(_0x573bc1,_0x26ba4a){_0x4f3d00[_0x2c68('0x1')](_0x3877b0,function(_0x1c3de2,_0x37844a){if(_0x1c3de2){_0x26ba4a(_0x1c3de2);}if(_0x37844a['slots']){for(const _0x300be4 in _0x37844a['slots']){if(_0x37844a['slots']['hasOwnProperty'](_0x300be4)){var _0x53e12c=_0x37844a[_0x2c68('0x2')][_0x300be4];_0x37844a['slot_'+_0x300be4]=_0x53e12c;}}}_0x573bc1(_0x37844a);});});}module[_0x2c68('0x3')]=function(_0x4abcee,_0xde5f9e,_0x1ff42c,_0x360b5f,_0x321593,_0x25731f){var _0x336ace=new AWS['LexRuntime']({'accessKeyId':_0xde5f9e,'secretAccessKey':_0x1ff42c,'region':_0x360b5f});var _0x27a33b={'botAlias':_0x2c68('0x4'),'botName':_0x25731f,'inputText':_0x321593,'userId':_0x4abcee};return lexResult(_0x336ace,_0x27a33b);}; \ 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 1bebdd9..11f8368 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 _0xc96c=['exports','./lib/api'];(function(_0x16ce92,_0x49f1b4){var _0xab9f7e=function(_0x3903ff){while(--_0x3903ff){_0x16ce92['push'](_0x16ce92['shift']());}};_0xab9f7e(++_0x49f1b4);}(_0xc96c,0xe7));var _0xcc96=function(_0x3503e5,_0x490a96){_0x3503e5=_0x3503e5-0x0;var _0x2059fa=_0xc96c[_0x3503e5];return _0x2059fa;};'use strict';var polly=require(_0xcc96('0x0'));module[_0xcc96('0x1')]=function(_0x16ee7c,_0x516f48,_0x5b43fb,_0x301100,_0x1348f0,_0x41a83c,_0x5acc13){return polly(_0x16ee7c,_0x516f48,_0x5b43fb,_0x301100,_0x1348f0,_0x41a83c,_0x5acc13);}; \ No newline at end of file +var _0xa2d6=['exports','./lib/api'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xa2d6,0x65));var _0x6a2d=function(_0x422a6a,_0x34cc4){_0x422a6a=_0x422a6a-0x0;var _0x137714=_0xa2d6[_0x422a6a];return _0x137714;};'use strict';var polly=require(_0x6a2d('0x0'));module[_0x6a2d('0x1')]=function(_0x461122,_0x29320d,_0x16f3a5,_0x1ca37d,_0x2b5962,_0xb2d414,_0x5c75ff){return polly(_0x461122,_0x29320d,_0x16f3a5,_0x1ca37d,_0x2b5962,_0xb2d414,_0x5c75ff);}; \ 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 3cef72f..a1ff5f6 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 _0x7690=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','randomstring','aws-sdk'];(function(_0x2a74a6,_0x10592f){var _0xc2e34a=function(_0x8497c9){while(--_0x8497c9){_0x2a74a6['push'](_0x2a74a6['shift']());}};_0xc2e34a(++_0x10592f);}(_0x7690,0xdf));var _0x0769=function(_0x320f22,_0x488293){_0x320f22=_0x320f22-0x0;var _0x281311=_0x7690[_0x320f22];return _0x281311;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x0769('0x0'));var AWS=require(_0x0769('0x1'));function pollyResult(_0x3a1978,_0x3ffc1c,_0x5b8f03){return new BPromise(function(_0x12761a,_0x49b9d0){_0x3a1978['synthesizeSpeech'](_0x3ffc1c,function(_0x41b7d2,_0x69498a){if(_0x41b7d2){_0x49b9d0(_0x41b7d2);}else if(_0x69498a){if(_0x69498a[_0x0769('0x2')]instanceof Buffer){fs[_0x0769('0x3')](_0x5b8f03,_0x69498a[_0x0769('0x2')],function(_0x546333){if(_0x546333){_0x49b9d0(_0x546333);}else{_0x12761a();}});}else{_0x49b9d0(new Error(_0x0769('0x4')));}}else{_0x49b9d0(new Error(_0x0769('0x5')));}});});}module[_0x0769('0x6')]=function(_0x2da448,_0x18da50,_0x3c0273,_0x4ef6e6,_0x325f35,_0x41668d,_0x253878){var _0x5d071d=new AWS[(_0x0769('0x7'))]({'accessKeyId':_0x2da448,'secretAccessKey':_0x18da50,'region':_0x3c0273});var _0x11a7bc={'Text':_0x325f35,'TextType':_0x41668d||'text','OutputFormat':_0x0769('0x8'),'VoiceId':_0x4ef6e6};return pollyResult(_0x5d071d,_0x11a7bc,_0x253878);}; \ No newline at end of file +var _0x3942=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird','randomstring'];(function(_0x38f6bc,_0x5bdccd){var _0x2930b8=function(_0x43b250){while(--_0x43b250){_0x38f6bc['push'](_0x38f6bc['shift']());}};_0x2930b8(++_0x5bdccd);}(_0x3942,0x12a));var _0x2394=function(_0x343fb6,_0x4b19fc){_0x343fb6=_0x343fb6-0x0;var _0x598f35=_0x3942[_0x343fb6];return _0x598f35;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x2394('0x0'));var rs=require(_0x2394('0x1'));var AWS=require(_0x2394('0x2'));function pollyResult(_0x1fe55d,_0x28ec5d,_0x455141){return new BPromise(function(_0x5ad480,_0x57dd37){_0x1fe55d[_0x2394('0x3')](_0x28ec5d,function(_0x23e823,_0x1b6a10){if(_0x23e823){_0x57dd37(_0x23e823);}else if(_0x1b6a10){if(_0x1b6a10[_0x2394('0x4')]instanceof Buffer){fs[_0x2394('0x5')](_0x455141,_0x1b6a10[_0x2394('0x4')],function(_0x2206ec){if(_0x2206ec){_0x57dd37(_0x2206ec);}else{_0x5ad480();}});}else{_0x57dd37(new Error(_0x2394('0x6')));}}else{_0x57dd37(new Error(_0x2394('0x7')));}});});}module[_0x2394('0x8')]=function(_0x5dd462,_0x36a626,_0x23aac9,_0x18c06c,_0x2b7e8f,_0x17a4d2,_0x1b0d5f){var _0x1f22d7=new AWS[(_0x2394('0x9'))]({'accessKeyId':_0x5dd462,'secretAccessKey':_0x36a626,'region':_0x23aac9});var _0x4cdbda={'Text':_0x2b7e8f,'TextType':_0x17a4d2||_0x2394('0xa'),'OutputFormat':_0x2394('0xb'),'VoiceId':_0x18c06c};return pollyResult(_0x1f22d7,_0x4cdbda,_0x1b0d5f);}; \ 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 22089f1..c1036b8 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 _0x7be1=['exports','./lib/api'];(function(_0x3c3b81,_0x3bd581){var _0x5a1daa=function(_0x4d3b20){while(--_0x4d3b20){_0x3c3b81['push'](_0x3c3b81['shift']());}};_0x5a1daa(++_0x3bd581);}(_0x7be1,0x165));var _0x17be=function(_0x31c201,_0x2f0396){_0x31c201=_0x31c201-0x0;var _0xe880b4=_0x7be1[_0x31c201];return _0xe880b4;};'use strict';var asr=require(_0x17be('0x0'));module[_0x17be('0x1')]=function(_0x6a550d,_0x5ec6c0,_0x295843,_0x343ec5){return asr(_0x6a550d,_0x5ec6c0,_0x295843);}; \ No newline at end of file +var _0x457b=['./lib/api','exports'];(function(_0xcc0387,_0x20b5f8){var _0x2cdc78=function(_0x5984fa){while(--_0x5984fa){_0xcc0387['push'](_0xcc0387['shift']());}};_0x2cdc78(++_0x20b5f8);}(_0x457b,0xca));var _0xb457=function(_0x5484cf,_0x153f52){_0x5484cf=_0x5484cf-0x0;var _0x5b7de7=_0x457b[_0x5484cf];return _0x5b7de7;};'use strict';var asr=require(_0xb457('0x0'));module[_0xb457('0x1')]=function(_0x4b9799,_0x376ea4,_0xf8abd6,_0x4120a4){return asr(_0x4b9799,_0x376ea4,_0xf8abd6);}; \ 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 d2a3699..00df6c5 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 _0x2a7e=['https://speech.googleapis.com','exports','length','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird'];(function(_0x20c3c2,_0x1b45e1){var _0x527149=function(_0x1b89d1){while(--_0x1b89d1){_0x20c3c2['push'](_0x20c3c2['shift']());}};_0x527149(++_0x1b45e1);}(_0x2a7e,0x140));var _0xe2a7=function(_0x2efdfc,_0x349b5f){_0x2efdfc=_0x2efdfc-0x0;var _0x52ea6f=_0x2a7e[_0x2efdfc];return _0x52ea6f;};'use strict';var url=require(_0xe2a7('0x0'));var BPromise=require(_0xe2a7('0x1'));var fs=require('fs');var host=_0xe2a7('0x2');module[_0xe2a7('0x3')]=function(_0x41a725,_0x197380,_0x31282b){return new BPromise(function(_0x300965,_0x8f93e7){var _0x40115c;if(typeof _0x41a725!=='string'||_0x41a725[_0xe2a7('0x4')]===0x0){return _0x8f93e7('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x197380!==_0xe2a7('0x5')||_0x197380[_0xe2a7('0x4')]===0x0){return _0x8f93e7(_0xe2a7('0x6'));}if(typeof _0x31282b!==_0xe2a7('0x7')&&(typeof _0x31282b!==_0xe2a7('0x5')||_0x31282b[_0xe2a7('0x4')]===0x0)){return _0x8f93e7(_0xe2a7('0x8'));}try{_0x40115c=fs[_0xe2a7('0x9')](_0x41a725)[_0xe2a7('0xa')](_0xe2a7('0xb'));}catch(_0x56a670){return _0x8f93e7(_0x56a670);}return _0x300965({'method':'POST','uri':host+_0xe2a7('0xc')+_0x197380,'body':{'config':{'encoding':_0xe2a7('0xd'),'sampleRateHertz':'8000','languageCode':_0x31282b},'audio':{'content':_0x40115c}},'json':!![]});});}; \ No newline at end of file +var _0x23f0=['LINEAR16','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key='];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x23f0,0xaa));var _0x023f=function(_0x125721,_0x2fde0c){_0x125721=_0x125721-0x0;var _0x165cba=_0x23f0[_0x125721];return _0x165cba;};'use strict';var url=require('url');var BPromise=require(_0x023f('0x0'));var fs=require('fs');var host=_0x023f('0x1');module['exports']=function(_0x1d4aa8,_0x47098f,_0x2d7d51){return new BPromise(function(_0x2572f4,_0x3131fd){var _0x4117eb;if(typeof _0x1d4aa8!==_0x023f('0x2')||_0x1d4aa8[_0x023f('0x3')]===0x0){return _0x3131fd(_0x023f('0x4'));}if(typeof _0x47098f!==_0x023f('0x2')||_0x47098f[_0x023f('0x3')]===0x0){return _0x3131fd('key\x20should\x20be\x20a\x20string');}if(typeof _0x2d7d51!==_0x023f('0x5')&&(typeof _0x2d7d51!=='string'||_0x2d7d51['length']===0x0)){return _0x3131fd(_0x023f('0x6'));}try{_0x4117eb=fs[_0x023f('0x7')](_0x1d4aa8)[_0x023f('0x8')](_0x023f('0x9'));}catch(_0x58a92a){return _0x3131fd(_0x58a92a);}return _0x2572f4({'method':_0x023f('0xa'),'uri':host+_0x023f('0xb')+_0x47098f,'body':{'config':{'encoding':_0x023f('0xc'),'sampleRateHertz':'8000','languageCode':_0x2d7d51},'audio':{'content':_0x4117eb}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 0392786..39f51a6 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 _0xa9e0=['text','channelData','CustomAction','AudioFromTts','Data','dirName','path','http','https','bluebird','sox','request-promise','util','querystring','moment','apiai-promise','md5','./google','./sestek','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','end','protocol','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','googleTTS','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','freeform=3','parse','sestekNDA','nda'];(function(_0x40aa10,_0xe03397){var _0xd4f3a0=function(_0x434981){while(--_0x434981){_0x40aa10['push'](_0x40aa10['shift']());}};_0xd4f3a0(++_0xe03397);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var fs=require('fs');var path=require(_0x0a9e('0x0'));var http=require(_0x0a9e('0x1'));var https=require(_0x0a9e('0x2'));var urlParse=require('url')['parse'];var BPromise=require(_0x0a9e('0x3'));var rs=require('randomstring');var sox=require(_0x0a9e('0x4'));var rp=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var querystring=require(_0x0a9e('0x7'));var moment=require(_0x0a9e('0x8'));var tts=require('google-tts-api');var apiai=require(_0x0a9e('0x9'));var md5=require(_0x0a9e('0xa'));var google=require(_0x0a9e('0xb'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x0a9e('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x0a9e('0xd');function downloadFile(_0xf81284,_0x307b3e){return new BPromise(function(_0x3ab53f,_0xfeb75b){var _0xbd1168=urlParse(_0xf81284);var _0x4a4c56=_0xbd1168['protocol']==='https:'?https:http;var _0x4cfe67={'host':_0xbd1168[_0x0a9e('0xe')],'path':_0xbd1168[_0x0a9e('0x0')],'headers':{'user-agent':_0x0a9e('0xf')}};_0x4a4c56[_0x0a9e('0x10')](_0x4cfe67,function(_0x32d742){if(_0x32d742[_0x0a9e('0x11')]!==0xc8){logger['error'](_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742[_0x0a9e('0x11')]+'\x20('+_0x32d742[_0x0a9e('0x14')]+')');_0xfeb75b(new Error(_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742['statusCode']+'\x20('+_0x32d742[_0x0a9e('0x14')]+')'));return;}var _0x5d0880=fs[_0x0a9e('0x15')](_0x307b3e);_0x5d0880['on']('finish',function(){logger[_0x0a9e('0x16')](_0x0a9e('0x17'));_0x5d0880['close'](_0x3ab53f);});_0x5d0880['on'](_0x0a9e('0x18'),function(_0x5a0a06){fs[_0x0a9e('0x19')](_0x307b3e);logger[_0x0a9e('0x18')](_0x0a9e('0x1a'),_0x5a0a06);_0xfeb75b(_0x5a0a06);});_0x32d742[_0x0a9e('0x1b')](_0x5d0880);})['on'](_0x0a9e('0x18'),function(_0x2eb11f){logger[_0x0a9e('0x18')](_0x2eb11f);_0xfeb75b(_0x2eb11f);})[_0x0a9e('0x1c')]();});}function uploadFile(_0x1314ae){return new BPromise(function(_0x112016,_0x1c696a){var _0x105080=urlParse(_0x1314ae);var _0x4bb1e3=_0x105080[_0x0a9e('0x1d')]===_0x0a9e('0x1e')?https:http;var _0x53682f={'host':_0x105080[_0x0a9e('0xe')],'path':_0x105080['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4bb1e3[_0x0a9e('0x10')](_0x53682f,function(_0x432e56){if(_0x432e56[_0x0a9e('0x11')]!==0xc8){_0x1c696a(new Error(_0x0a9e('0x12')+_0x1314ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x432e56[_0x0a9e('0x11')]+'\x20('+_0x432e56[_0x0a9e('0x14')]+')'));return;}var _0x3b45bc='';_0x432e56['on'](_0x0a9e('0x1f'),function(_0x370d86){_0x3b45bc+=_0x370d86;});_0x432e56['on'](_0x0a9e('0x1c'),function(){_0x112016(_0x3b45bc);});})['on'](_0x0a9e('0x18'),function(_0x5ea472){_0x1c696a(_0x5ea472);})['end']();});}function convertFile(_0x197ec0,_0x3a8e58){return new BPromise(function(_0x40c424,_0x33161b){var _0x526cf3=sox[_0x0a9e('0x20')](_0x197ec0,_0x3a8e58,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x526cf3['on'](_0x0a9e('0x18'),function(_0x5bfb33){logger[_0x0a9e('0x18')](_0x0a9e('0x21'),_0x5bfb33);_0x33161b(_0x5bfb33);});_0x526cf3['on'](_0x0a9e('0x1c'),function(){logger[_0x0a9e('0x16')](_0x0a9e('0x22'));_0x40c424();});_0x526cf3[_0x0a9e('0x23')]();});}function base64Decode(_0x11c3b6,_0x14de77){var _0x5a101a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));fs['writeFileSync'](_0x5a101a,_0x11c3b6,_0x0a9e('0x28'));return convertFile(_0x5a101a,_0x14de77)[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x5a101a);fs[_0x0a9e('0x2a')](_0x14de77,_0x0a9e('0x2b'));}catch(_0x563b45){logger[_0x0a9e('0x18')](_0x563b45);}return _0x14de77[_0x0a9e('0x2c')]('.')[0x0];});}function base64Encode(_0x1dbde2){var _0x540530=fs[_0x0a9e('0x2d')](_0x1dbde2);return new Buffer(_0x540530)['toString'](_0x0a9e('0x28'));}exports[_0x0a9e('0x2e')]=function(_0x1122db,_0x33bdb7){var _0x25ce3a,_0x5180f1;return tts(_0x1122db,_0x33bdb7||'en',0x1)[_0x0a9e('0x29')](function(_0x46f0a5){logger[_0x0a9e('0x16')](_0x46f0a5);_0x25ce3a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));return downloadFile(_0x46f0a5,_0x25ce3a);})[_0x0a9e('0x29')](function(){_0x5180f1=path['resolve'](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27'));return convertFile(_0x25ce3a,_0x5180f1);})[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x25ce3a);fs[_0x0a9e('0x2a')](_0x5180f1,'777');}catch(_0x191e91){logger[_0x0a9e('0x18')](_0x191e91);}logger[_0x0a9e('0x16')](_0x0a9e('0x30'),_0x5180f1['split']('.')[0x0]);return _0x5180f1['split']('.')[0x0];});};exports[_0x0a9e('0x31')]=function(_0x5640eb,_0x24936a,_0x3d9717){return google[_0x0a9e('0x32')](_0x5640eb,_0x24936a,_0x3d9717)[_0x0a9e('0x29')](function(_0x4f41ae){logger[_0x0a9e('0x16')](_0x4f41ae[_0x0a9e('0x33')]);return rp(_0x4f41ae);})[_0x0a9e('0x29')](function(_0x533942){var _0x1dbf74='';var _0x1a180b=0x0;try{fs[_0x0a9e('0x19')](_0x5640eb);}catch(_0x4c1c0e){logger['error'](_0x4c1c0e);}if(_0x533942&&_0x533942[_0x0a9e('0x34')]){_0x1dbf74=_0x533942[_0x0a9e('0x34')]['map'](function(_0x2b814e){return _0x2b814e&&_0x2b814e[_0x0a9e('0x35')][0x0]&&_0x2b814e[_0x0a9e('0x35')][0x0][_0x0a9e('0x36')]?_0x2b814e['alternatives'][0x0]['transcript']:'';})[_0x0a9e('0x37')]('\x0a');_0x1a180b=_0x533942[_0x0a9e('0x34')]['map'](function(_0x183991){return _0x183991&&_0x183991[_0x0a9e('0x35')][0x0]&&_0x183991[_0x0a9e('0x35')][0x0]['confidence']?_0x183991[_0x0a9e('0x35')][0x0][_0x0a9e('0x38')]:0x0;})[_0x0a9e('0x37')]('\x0a');}logger[_0x0a9e('0x16')](_0x0a9e('0x39'),_0x1dbf74);logger[_0x0a9e('0x16')](_0x0a9e('0x3a'),_0x1a180b);return{'transcript':_0x1dbf74,'confidence':_0x1a180b};})[_0x0a9e('0x3b')](function(_0x23b089){logger[_0x0a9e('0x18')](_0x0a9e('0x3c'),_0x23b089[_0x0a9e('0x11')],_0x23b089[_0x0a9e('0x3d')],_0x23b089[_0x0a9e('0x3e')]);});};exports[_0x0a9e('0x3f')]=function(_0x4d04c8,_0x52628e,_0x473fdc,_0xb3795a){var _0x405c8f=apiai(_0x52628e,{'language':_0xb3795a||'en'});return _0x405c8f[_0x0a9e('0x40')](_0x473fdc,{'sessionId':md5(_0x4d04c8)})[_0x0a9e('0x29')](function(_0xc9a702){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0xc9a702));return{'source':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x43')],'resolvedQuery':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x44')],'action':_0xc9a702['result'][_0x0a9e('0x45')],'actionIncomplete':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x46')],'speech':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x47')][_0x0a9e('0x48')],'score':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x49')],'statusCode':_0xc9a702['status'][_0x0a9e('0x4a')],'endConversation':_0xc9a702['result'][_0x0a9e('0x4b')][_0x0a9e('0x4c')]||![],'isFallbackIntent':_0xc9a702[_0x0a9e('0x42')]['metadata'][_0x0a9e('0x4d')]};});};exports[_0x0a9e('0x4e')]=function(_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73){return tilde[_0x0a9e('0x32')](_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73)['then'](function(_0x13f44d){try{fs[_0x0a9e('0x19')](_0x4774f4);}catch(_0x1b5e80){logger[_0x0a9e('0x18')](_0x1b5e80);}logger[_0x0a9e('0x16')](_0x0a9e('0x4f'),_0x13f44d[_0x0a9e('0x36')]);logger[_0x0a9e('0x16')](_0x0a9e('0x50'),_0x13f44d['confidence']);return _0x13f44d;});};exports[_0x0a9e('0x51')]=function(_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3){var _0x37edaa=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x375c18;return aws['polly'](_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3,_0x37edaa)['then'](function(){_0x375c18=path['resolve'](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x37edaa,_0x375c18);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x37edaa);fs[_0x0a9e('0x2a')](_0x375c18,'777');}catch(_0x5a88da){logger[_0x0a9e('0x18')](_0x5a88da);}return _0x375c18['split']('.')[0x0];});};exports[_0x0a9e('0x52')]=function(_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return aws[_0x0a9e('0x53')](_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da)['then'](function(_0x50f687){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0x50f687));return _0x50f687;});};exports['ispeechTTS']=function(_0x145931,_0x5ce9ac,_0x211ef9,_0x523cd2){var _0xe22ccc=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x145931,encodeURIComponent(_0x5ce9ac),_0x211ef9,_0x523cd2);var _0x5df0ad=path[_0x0a9e('0x24')](__dirname,'tmp',rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x3cfd00;return downloadFile(_0xe22ccc,_0x5df0ad)[_0x0a9e('0x29')](function(){_0x3cfd00=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x5df0ad,_0x3cfd00);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x5df0ad);fs[_0x0a9e('0x2a')](_0x3cfd00,_0x0a9e('0x2b'));}catch(_0x30c491){logger[_0x0a9e('0x18')](_0x30c491);}return _0x3cfd00[_0x0a9e('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x956fbe,_0x26bc80,_0x5239ef,_0x3649cc){var _0x5cc8fb=util[_0x0a9e('0x54')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x26bc80,_0x5239ef,base64Encode(_0x956fbe),_0x3649cc?util['format']('model=%s',encodeURIComponent(_0x3649cc)):_0x0a9e('0x55'));return uploadFile(_0x5cc8fb)['then'](function(_0x2244d6){return querystring[_0x0a9e('0x56')](_0x2244d6);});};exports[_0x0a9e('0x57')]=function(_0x7be420,_0x1cca9f){return sestek[_0x0a9e('0x58')](_0x7be420,_0x1cca9f)['then'](function(_0x1627a7){logger['info'](JSON[_0x0a9e('0x41')](_0x1627a7));var _0x1f07cb={'speech':_0x1627a7[_0x0a9e('0x59')],'action':_0x1627a7['channelData']?_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5b')]:undefined,'actiondata':_0x1627a7[_0x0a9e('0x5a')]?_0x1627a7[_0x0a9e('0x5a')]['CustomActionData']:undefined};if(_0x1627a7[_0x0a9e('0x5a')]&&_0x1627a7[_0x0a9e('0x5a')]['AudioFromTts']){return base64Decode(_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5c')][_0x0a9e('0x5d')],path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27')))[_0x0a9e('0x29')](function(_0x281c7d){_0x1f07cb['audiofile']=_0x281c7d;return _0x1f07cb;});}return _0x1f07cb;});};exports[_0x0a9e('0x5e')]=function(){return __dirname;}; \ No newline at end of file +var _0xb10b=['url','parse','randomstring','sox','request-promise','util','querystring','moment','apiai-promise','md5','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','https:','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','tmp','.wav','base64','then','readFileSync','toString','googleTTS','resolve','generate','.mp3','goggleTTS\x20path','split','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','catch','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','fulfillment','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','asr','Tilde\x20ASR\x20transcription','awsPolly','polly','chmodSync','777','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','https'];(function(_0x555069,_0x23d66a){var _0x100af7=function(_0x1606bd){while(--_0x1606bd){_0x555069['push'](_0x555069['shift']());}};_0x100af7(++_0x23d66a);}(_0xb10b,0x12a));var _0xbb10=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0xb10b[_0x71e493];return _0x3d40ab;};'use strict';var fs=require('fs');var path=require(_0xbb10('0x0'));var http=require('http');var https=require(_0xbb10('0x1'));var urlParse=require(_0xbb10('0x2'))[_0xbb10('0x3')];var BPromise=require('bluebird');var rs=require(_0xbb10('0x4'));var sox=require(_0xbb10('0x5'));var rp=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var querystring=require(_0xbb10('0x8'));var moment=require(_0xbb10('0x9'));var tts=require('google-tts-api');var apiai=require(_0xbb10('0xa'));var md5=require(_0xbb10('0xb'));var google=require('./google');var aws=require(_0xbb10('0xc'));var tilde=require(_0xbb10('0xd'));var sestek=require(_0xbb10('0xe'));var logger=require(_0xbb10('0xf'))(_0xbb10('0x10'));var ISPEECH_API=_0xbb10('0x11');function downloadFile(_0x229887,_0xa3adc8){return new BPromise(function(_0x5ab04a,_0x4e47f8){var _0x20bd61=urlParse(_0x229887);var _0x118a74=_0x20bd61[_0xbb10('0x12')]==='https:'?https:http;var _0x408248={'host':_0x20bd61['host'],'path':_0x20bd61[_0xbb10('0x0')],'headers':{'user-agent':_0xbb10('0x13')}};_0x118a74[_0xbb10('0x14')](_0x408248,function(_0x193a27){if(_0x193a27[_0xbb10('0x15')]!==0xc8){logger[_0xbb10('0x16')]('request\x20to\x20'+_0x229887+_0xbb10('0x17')+_0x193a27[_0xbb10('0x15')]+'\x20('+_0x193a27[_0xbb10('0x18')]+')');_0x4e47f8(new Error(_0xbb10('0x19')+_0x229887+_0xbb10('0x17')+_0x193a27[_0xbb10('0x15')]+'\x20('+_0x193a27[_0xbb10('0x18')]+')'));return;}var _0x36b5e8=fs[_0xbb10('0x1a')](_0xa3adc8);_0x36b5e8['on'](_0xbb10('0x1b'),function(){logger['info'](_0xbb10('0x1c'));_0x36b5e8[_0xbb10('0x1d')](_0x5ab04a);});_0x36b5e8['on'](_0xbb10('0x16'),function(_0x42db98){fs[_0xbb10('0x1e')](_0xa3adc8);logger[_0xbb10('0x16')](_0xbb10('0x1f'),_0x42db98);_0x4e47f8(_0x42db98);});_0x193a27[_0xbb10('0x20')](_0x36b5e8);})['on'](_0xbb10('0x16'),function(_0xe1c665){logger['error'](_0xe1c665);_0x4e47f8(_0xe1c665);})[_0xbb10('0x21')]();});}function uploadFile(_0x19f48d){return new BPromise(function(_0x388fab,_0x109908){var _0xdf237d=urlParse(_0x19f48d);var _0x44e563=_0xdf237d['protocol']===_0xbb10('0x22')?https:http;var _0x12ef77={'host':_0xdf237d['host'],'path':_0xdf237d['path'],'headers':{'user-agent':_0xbb10('0x13')}};_0x44e563[_0xbb10('0x14')](_0x12ef77,function(_0x2e911d){if(_0x2e911d[_0xbb10('0x15')]!==0xc8){_0x109908(new Error(_0xbb10('0x19')+_0x19f48d+_0xbb10('0x17')+_0x2e911d[_0xbb10('0x15')]+'\x20('+_0x2e911d[_0xbb10('0x18')]+')'));return;}var _0x7f2377='';_0x2e911d['on'](_0xbb10('0x23'),function(_0x3ba6cd){_0x7f2377+=_0x3ba6cd;});_0x2e911d['on'](_0xbb10('0x21'),function(){_0x388fab(_0x7f2377);});})['on']('error',function(_0x4fedac){_0x109908(_0x4fedac);})['end']();});}function convertFile(_0xc93a04,_0x3c5ae7){return new BPromise(function(_0x2c89b9,_0x4e25ff){var _0x2fdde9=sox[_0xbb10('0x24')](_0xc93a04,_0x3c5ae7,{'sampleRate':0x1f40,'format':_0xbb10('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2fdde9['on'](_0xbb10('0x16'),function(_0x1acce9){logger[_0xbb10('0x16')](_0xbb10('0x26'),_0x1acce9);_0x4e25ff(_0x1acce9);});_0x2fdde9['on']('end',function(){logger[_0xbb10('0x27')](_0xbb10('0x28'));_0x2c89b9();});_0x2fdde9[_0xbb10('0x29')]();});}function base64Decode(_0x2e0249,_0x1d30aa){var _0x2ff4c1=path['resolve'](__dirname,_0xbb10('0x2a'),rs['generate'](0x4)+_0xbb10('0x2b'));fs['writeFileSync'](_0x2ff4c1,_0x2e0249,_0xbb10('0x2c'));return convertFile(_0x2ff4c1,_0x1d30aa)[_0xbb10('0x2d')](function(){try{fs[_0xbb10('0x1e')](_0x2ff4c1);fs['chmodSync'](_0x1d30aa,'777');}catch(_0x4c3744){logger[_0xbb10('0x16')](_0x4c3744);}return _0x1d30aa['split']('.')[0x0];});}function base64Encode(_0x359ad4){var _0x37dde7=fs[_0xbb10('0x2e')](_0x359ad4);return new Buffer(_0x37dde7)[_0xbb10('0x2f')](_0xbb10('0x2c'));}exports[_0xbb10('0x30')]=function(_0xf85197,_0x4975f5){var _0x25acb3,_0x1da9c9;return tts(_0xf85197,_0x4975f5||'en',0x1)[_0xbb10('0x2d')](function(_0x8c1ce6){logger[_0xbb10('0x27')](_0x8c1ce6);_0x25acb3=path[_0xbb10('0x31')](__dirname,_0xbb10('0x2a'),rs[_0xbb10('0x32')](0x4)+_0xbb10('0x33'));return downloadFile(_0x8c1ce6,_0x25acb3);})['then'](function(){_0x1da9c9=path[_0xbb10('0x31')](__dirname,_0xbb10('0x2a'),rs[_0xbb10('0x32')](0x4)+_0xbb10('0x2b'));return convertFile(_0x25acb3,_0x1da9c9);})['then'](function(){try{fs[_0xbb10('0x1e')](_0x25acb3);fs['chmodSync'](_0x1da9c9,'777');}catch(_0x3eb3cc){logger[_0xbb10('0x16')](_0x3eb3cc);}logger[_0xbb10('0x27')](_0xbb10('0x34'),_0x1da9c9[_0xbb10('0x35')]('.')[0x0]);return _0x1da9c9[_0xbb10('0x35')]('.')[0x0];});};exports['googleASR']=function(_0x1e5bbd,_0x25d72f,_0x52de31){return google['asr'](_0x1e5bbd,_0x25d72f,_0x52de31)['then'](function(_0x31bee3){logger[_0xbb10('0x27')](_0x31bee3[_0xbb10('0x36')]);return rp(_0x31bee3);})['then'](function(_0x3c0cd7){var _0x3e8538='';var _0x4345f3=0x0;try{fs['unlink'](_0x1e5bbd);}catch(_0x17b6c5){logger[_0xbb10('0x16')](_0x17b6c5);}if(_0x3c0cd7&&_0x3c0cd7[_0xbb10('0x37')]){_0x3e8538=_0x3c0cd7[_0xbb10('0x37')]['map'](function(_0xd238e9){return _0xd238e9&&_0xd238e9[_0xbb10('0x38')][0x0]&&_0xd238e9['alternatives'][0x0][_0xbb10('0x39')]?_0xd238e9[_0xbb10('0x38')][0x0][_0xbb10('0x39')]:'';})[_0xbb10('0x3a')]('\x0a');_0x4345f3=_0x3c0cd7[_0xbb10('0x37')][_0xbb10('0x3b')](function(_0x5f3d67){return _0x5f3d67&&_0x5f3d67[_0xbb10('0x38')][0x0]&&_0x5f3d67[_0xbb10('0x38')][0x0][_0xbb10('0x3c')]?_0x5f3d67[_0xbb10('0x38')][0x0]['confidence']:0x0;})[_0xbb10('0x3a')]('\x0a');}logger[_0xbb10('0x27')](_0xbb10('0x3d'),_0x3e8538);logger[_0xbb10('0x27')]('googleASR\x20confidence',_0x4345f3);return{'transcript':_0x3e8538,'confidence':_0x4345f3};})[_0xbb10('0x3e')](function(_0x202c60){logger['error']('[%s]\x20%s:%s',_0x202c60[_0xbb10('0x15')],_0x202c60['name'],_0x202c60[_0xbb10('0x3f')]);});};exports[_0xbb10('0x40')]=function(_0x4c66d8,_0x366608,_0x1d82bf,_0x474e99){var _0x5cf4f8=apiai(_0x366608,{'language':_0x474e99||'en'});return _0x5cf4f8[_0xbb10('0x41')](_0x1d82bf,{'sessionId':md5(_0x4c66d8)})[_0xbb10('0x2d')](function(_0x3b9fdf){logger[_0xbb10('0x27')](JSON[_0xbb10('0x42')](_0x3b9fdf));return{'source':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x44')],'resolvedQuery':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x45')],'action':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x46')],'actionIncomplete':_0x3b9fdf[_0xbb10('0x43')]['actionIncomplete'],'speech':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x47')]['speech'],'score':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x48')],'statusCode':_0x3b9fdf[_0xbb10('0x49')][_0xbb10('0x4a')],'endConversation':_0x3b9fdf[_0xbb10('0x43')][_0xbb10('0x4b')][_0xbb10('0x4c')]||![],'isFallbackIntent':_0x3b9fdf['result']['metadata'][_0xbb10('0x4d')]};});};exports[_0xbb10('0x4e')]=function(_0x2b12bd,_0x57d2c0,_0x5f0c12,_0x3cd6f3){return tilde[_0xbb10('0x4f')](_0x2b12bd,_0x57d2c0,_0x5f0c12,_0x3cd6f3)[_0xbb10('0x2d')](function(_0xf820fe){try{fs[_0xbb10('0x1e')](_0x2b12bd);}catch(_0x22b315){logger[_0xbb10('0x16')](_0x22b315);}logger[_0xbb10('0x27')](_0xbb10('0x50'),_0xf820fe[_0xbb10('0x39')]);logger['info']('Tilde\x20ASR\x20confidence',_0xf820fe[_0xbb10('0x3c')]);return _0xf820fe;});};exports[_0xbb10('0x51')]=function(_0x36ab7d,_0xb014b0,_0x36aa7d,_0x440f9e,_0x358e7e,_0x445870){var _0x1c0d8f=path[_0xbb10('0x31')](__dirname,_0xbb10('0x2a'),rs[_0xbb10('0x32')](0x4)+_0xbb10('0x33'));var _0x2e6fd9;return aws[_0xbb10('0x52')](_0x36ab7d,_0xb014b0,_0x36aa7d,_0x440f9e,_0x358e7e,_0x445870,_0x1c0d8f)['then'](function(){_0x2e6fd9=path[_0xbb10('0x31')](__dirname,'tmp',rs[_0xbb10('0x32')](0x4)+_0xbb10('0x2b'));return convertFile(_0x1c0d8f,_0x2e6fd9);})[_0xbb10('0x2d')](function(){try{fs[_0xbb10('0x1e')](_0x1c0d8f);fs[_0xbb10('0x53')](_0x2e6fd9,_0xbb10('0x54'));}catch(_0x2e3326){logger[_0xbb10('0x16')](_0x2e3326);}return _0x2e6fd9[_0xbb10('0x35')]('.')[0x0];});};exports[_0xbb10('0x55')]=function(_0x44a056,_0x1c2dce,_0x1d49e1,_0x3d7e17,_0x4475e1,_0x5de0cc){return aws[_0xbb10('0x56')](_0x44a056,_0x1c2dce,_0x1d49e1,_0x3d7e17,_0x4475e1,_0x5de0cc)[_0xbb10('0x2d')](function(_0x1b83a9){logger[_0xbb10('0x27')](JSON[_0xbb10('0x42')](_0x1b83a9));return _0x1b83a9;});};exports[_0xbb10('0x57')]=function(_0x4bedd0,_0x120bda,_0x4731ce,_0x2909a1){var _0x14fed3=util[_0xbb10('0x58')](_0xbb10('0x59'),ISPEECH_API,_0x4bedd0,encodeURIComponent(_0x120bda),_0x4731ce,_0x2909a1);var _0x175872=path[_0xbb10('0x31')](__dirname,_0xbb10('0x2a'),rs[_0xbb10('0x32')](0x4)+_0xbb10('0x33'));var _0x2a1ce1;return downloadFile(_0x14fed3,_0x175872)[_0xbb10('0x2d')](function(){_0x2a1ce1=path['resolve'](__dirname,'tmp',rs[_0xbb10('0x32')](0x4)+_0xbb10('0x2b'));return convertFile(_0x175872,_0x2a1ce1);})[_0xbb10('0x2d')](function(){try{fs[_0xbb10('0x1e')](_0x175872);fs['chmodSync'](_0x2a1ce1,'777');}catch(_0x79411e){logger[_0xbb10('0x16')](_0x79411e);}return _0x2a1ce1[_0xbb10('0x35')]('.')[0x0];});};exports[_0xbb10('0x5a')]=function(_0x412f13,_0x3e9753,_0x45c0dc,_0x4a5fb9){var _0x117e84=util[_0xbb10('0x58')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3e9753,_0x45c0dc,base64Encode(_0x412f13),_0x4a5fb9?util['format']('model=%s',encodeURIComponent(_0x4a5fb9)):_0xbb10('0x5b'));return uploadFile(_0x117e84)[_0xbb10('0x2d')](function(_0x155dc5){return querystring['parse'](_0x155dc5);});};exports['sestekNDA']=function(_0x5846d1,_0x3ebc5f){return sestek[_0xbb10('0x5c')](_0x5846d1,_0x3ebc5f)[_0xbb10('0x2d')](function(_0x4e9fbd){logger[_0xbb10('0x27')](JSON[_0xbb10('0x42')](_0x4e9fbd));var _0x5a6538={'speech':_0x4e9fbd['text'],'action':_0x4e9fbd[_0xbb10('0x5d')]?_0x4e9fbd[_0xbb10('0x5d')][_0xbb10('0x5e')]:undefined,'actiondata':_0x4e9fbd[_0xbb10('0x5d')]?_0x4e9fbd['channelData'][_0xbb10('0x5f')]:undefined};if(_0x4e9fbd[_0xbb10('0x5d')]&&_0x4e9fbd[_0xbb10('0x5d')]['AudioFromTts']){return base64Decode(_0x4e9fbd[_0xbb10('0x5d')][_0xbb10('0x60')][_0xbb10('0x61')],path['resolve'](__dirname,_0xbb10('0x2a'),rs[_0xbb10('0x32')](0x4)+_0xbb10('0x2b')))[_0xbb10('0x2d')](function(_0x5e4a6e){_0x5a6538[_0xbb10('0x62')]=_0x5e4a6e;return _0x5a6538;});}return _0x5a6538;});};exports[_0xbb10('0x63')]=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 3eb7e17..a01b9c9 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 _0xfd67=['exports','./nda'];(function(_0x58b999,_0x2448d1){var _0x26af54=function(_0x196964){while(--_0x196964){_0x58b999['push'](_0x58b999['shift']());}};_0x26af54(++_0x2448d1);}(_0xfd67,0x117));var _0x7fd6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xfd67[_0xfae23b];return _0x200640;};var nda=require(_0x7fd6('0x0'));module[_0x7fd6('0x1')]={'nda':nda}; \ No newline at end of file +var _0x040d=['exports','./nda'];(function(_0x20a1b0,_0x18fe84){var _0x321e14=function(_0x69fdf6){while(--_0x69fdf6){_0x20a1b0['push'](_0x20a1b0['shift']());}};_0x321e14(++_0x18fe84);}(_0x040d,0x1af));var _0xd040=function(_0x44ff3a,_0x46f40d){_0x44ff3a=_0x44ff3a-0x0;var _0x333bc1=_0x040d[_0x44ff3a];return _0x333bc1;};var nda=require(_0xd040('0x0'));module[_0xd040('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 34c97f1..a9b090a 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 _0xd4d8=['callerid','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0xd4d8,0xcc));var _0x8d4d=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0xd4d8[_0x3f59b1];return _0x11d2e8;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x8d4d('0x0'))(_0x8d4d('0x1'));module[_0x8d4d('0x2')]=function(_0x4cd2fe,_0x54653e){var _0x4bb726={'method':_0x8d4d('0x3'),'uri':url[_0x8d4d('0x4')](_0x54653e[_0x8d4d('0x5')],'/token'),'form':{'grant_type':_0x8d4d('0x6'),'username':_0x54653e['username'],'password':_0x54653e[_0x8d4d('0x6')]},'json':!![]};return rp(_0x4bb726)['then'](function(_0x4d066c){var _0x38f25c={'method':_0x8d4d('0x3'),'uri':url[_0x8d4d('0x4')](_0x54653e[_0x8d4d('0x7')],_0x8d4d('0x8')),'body':{'type':_0x54653e[_0x8d4d('0x9')]||_0x8d4d('0xa'),'channelId':'Nda','conversation':{'id':_0x4cd2fe[_0x8d4d('0xb')]},'from':{'id':_0x4cd2fe[_0x8d4d('0xc')],'name':_0x4cd2fe['calleridname']},'recipient':{'id':_0x4cd2fe[_0x8d4d('0xd')],'name':_0x4cd2fe[_0x8d4d('0xe')]},'text':_0x54653e[_0x8d4d('0xf')],'channelData':{}},'headers':{'Authorization':_0x8d4d('0x10')+_0x4d066c['access_token']},'json':!![]};if(_0x54653e[_0x8d4d('0x11')]){_0x38f25c[_0x8d4d('0x12')][_0x8d4d('0x13')][_0x8d4d('0x14')]=_0x54653e[_0x8d4d('0x11')];}if(_0x54653e['ndagenerate_audio']=='1'){_0x38f25c[_0x8d4d('0x12')][_0x8d4d('0x13')][_0x8d4d('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8d4d('0x16')};}if(_0x54653e['custom_action']){_0x38f25c[_0x8d4d('0x12')][_0x8d4d('0x13')]['CustomAction']=_0x54653e[_0x8d4d('0x17')];if(_0x54653e[_0x8d4d('0x18')]){_0x38f25c[_0x8d4d('0x12')][_0x8d4d('0x13')][_0x8d4d('0x19')]=_0x54653e[_0x8d4d('0x18')];}}logger[_0x8d4d('0x1a')](JSON['stringify'](_0x38f25c));return rp(_0x38f25c);});}; \ No newline at end of file +var _0x6b90=['url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','CustomAction','custom_action_data','request-promise'];(function(_0xab9569,_0xf435d1){var _0x4e7ed5=function(_0x3d67b1){while(--_0x3d67b1){_0xab9569['push'](_0xab9569['shift']());}};_0x4e7ed5(++_0xf435d1);}(_0x6b90,0x135));var _0x06b9=function(_0x35cc24,_0x299db6){_0x35cc24=_0x35cc24-0x0;var _0x137359=_0x6b90[_0x35cc24];return _0x137359;};'use strict';var rp=require(_0x06b9('0x0'));var url=require(_0x06b9('0x1'));var logger=require(_0x06b9('0x2'))(_0x06b9('0x3'));module[_0x06b9('0x4')]=function(_0x2f5f46,_0xba1102){var _0x107e24={'method':_0x06b9('0x5'),'uri':url[_0x06b9('0x6')](_0xba1102[_0x06b9('0x7')],_0x06b9('0x8')),'form':{'grant_type':_0x06b9('0x9'),'username':_0xba1102['username'],'password':_0xba1102[_0x06b9('0x9')]},'json':!![]};return rp(_0x107e24)[_0x06b9('0xa')](function(_0x11b4e2){var _0x3eaba2={'method':'POST','uri':url[_0x06b9('0x6')](_0xba1102['ndassistant_url'],_0x06b9('0xb')),'body':{'type':_0xba1102[_0x06b9('0xc')]||_0x06b9('0xd'),'channelId':_0x06b9('0xe'),'conversation':{'id':_0x2f5f46[_0x06b9('0xf')]},'from':{'id':_0x2f5f46[_0x06b9('0x10')],'name':_0x2f5f46[_0x06b9('0x11')]},'recipient':{'id':_0x2f5f46[_0x06b9('0x12')],'name':_0x2f5f46[_0x06b9('0x13')]},'text':_0xba1102[_0x06b9('0x14')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x11b4e2[_0x06b9('0x15')]},'json':!![]};if(_0xba1102[_0x06b9('0x16')]){_0x3eaba2[_0x06b9('0x17')]['channelData'][_0x06b9('0x18')]=_0xba1102[_0x06b9('0x16')];}if(_0xba1102[_0x06b9('0x19')]=='1'){_0x3eaba2['body'][_0x06b9('0x1a')][_0x06b9('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x06b9('0x1c')};}if(_0xba1102['custom_action']){_0x3eaba2[_0x06b9('0x17')][_0x06b9('0x1a')][_0x06b9('0x1d')]=_0xba1102['custom_action'];if(_0xba1102[_0x06b9('0x1e')]){_0x3eaba2[_0x06b9('0x17')]['channelData']['CustomActionData']=_0xba1102['custom_action_data'];}}logger['info'](JSON['stringify'](_0x3eaba2));return rp(_0x3eaba2);});}; \ 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 ff60f46..8758aee 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 _0x36e5=['exports','./lib/api'];(function(_0x5c5006,_0x2283f3){var _0x1e20bb=function(_0x216abe){while(--_0x216abe){_0x5c5006['push'](_0x5c5006['shift']());}};_0x1e20bb(++_0x2283f3);}(_0x36e5,0xc3));var _0x536e=function(_0x401d67,_0xeb1592){_0x401d67=_0x401d67-0x0;var _0x25076b=_0x36e5[_0x401d67];return _0x25076b;};'use strict';var asr=require(_0x536e('0x0'));module[_0x536e('0x1')]=function(_0x2f33d6,_0x21c68a,_0x1461e4,_0x579510){return asr(_0x2f33d6,_0x21c68a,_0x1461e4,_0x579510);}; \ No newline at end of file +var _0x72e6=['exports'];(function(_0x3e5a8d,_0x14921a){var _0x1b0082=function(_0x55b848){while(--_0x55b848){_0x3e5a8d['push'](_0x3e5a8d['shift']());}};_0x1b0082(++_0x14921a);}(_0x72e6,0x66));var _0x672e=function(_0xec2175,_0x56516c){_0xec2175=_0xec2175-0x0;var _0x29314d=_0x72e6[_0xec2175];return _0x29314d;};'use strict';var asr=require('./lib/api');module[_0x672e('0x0')]=function(_0x4cdc76,_0x127c01,_0x5da380,_0x177943){return asr(_0x4cdc76,_0x127c01,_0x5da380,_0x177943);}; \ 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 5b04bb6..7d73c15 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 _0x7a59=['transcript','likelihood','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.','error','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','crypto','../../../../../../config/logger','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','Tilde\x20ASR\x20send\x20error','parse','result','Tilde\x20ASR\x20hypoteses','hypotheses'];(function(_0xba97d7,_0x55a949){var _0x311807=function(_0x455fd1){while(--_0x455fd1){_0xba97d7['push'](_0xba97d7['shift']());}};_0x311807(++_0x55a949);}(_0x7a59,0x1f0));var _0x97a5=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x7a59[_0x173f10];return _0x53142d;};'use strict';var BPromise=require('bluebird');var _=require(_0x97a5('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x97a5('0x1'));var logger=require(_0x97a5('0x2'))('agi');module['exports']=function(_0x597ecf,_0x3a7bfe,_0x891176,_0x2cc3d2){return new BPromise(function(_0x3bf821,_0x4d8f85){logger['info'](_0x97a5('0x3'),_0x2cc3d2||_0x97a5('0x4'));var _0x19fdd2=new WebSocket(_0x2cc3d2||_0x97a5('0x4'),{'perMessageDeflate':![]});var _0x5681bf='';var _0xdd3f47='0';var _0xb833b7='1';var _0x288e73='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x55c5d4(_0x2d5881){var _0x104d8f=crypto[_0x97a5('0x5')](_0x97a5('0x6'));_0x104d8f[_0x97a5('0x7')](_0x2d5881);return _0x104d8f[_0x97a5('0x8')](_0x97a5('0x9'));}function _0x2b0379(){try{logger[_0x97a5('0xa')](_0x97a5('0xb'));var _0x4a9691=moment()[_0x97a5('0xc')]();var _0x5afa19=_0x55c5d4(_0x4a9691+_0x3a7bfe+_0x891176);_0x19fdd2[_0x97a5('0xd')](JSON[_0x97a5('0xe')]({'appID':_0x3a7bfe,'timestamp':_0x4a9691,'appKey':_0x5afa19}));var _0x3c1fa6=fs['createReadStream'](_0x597ecf);_0x3c1fa6['on'](_0x97a5('0xf'),function(_0x258e03){_0x19fdd2[_0x97a5('0xd')](_0x258e03);});_0x3c1fa6['on'](_0x97a5('0x10'),function(){_0x19fdd2[_0x97a5('0xd')]('EOS');});}catch(_0x708eeb){logger['error'](_0x97a5('0x11'),JSON['stringify'](_0x708eeb));_0x19fdd2['terminate']();}}function _0x163e34(_0x15be80){try{if(_0x15be80){var _0x5cc097=JSON[_0x97a5('0x12')](_0x15be80);switch(_0x5cc097['status']){case 0x0:if(_0x5cc097[_0x97a5('0x13')]){if(_0x5cc097[_0x97a5('0x13')]['final']){logger[_0x97a5('0xa')](_0x97a5('0x14'),JSON['stringify'](_0x5cc097['result'][_0x97a5('0x15')]));_0x5681bf=_0x5cc097[_0x97a5('0x13')][_0x97a5('0x15')][0x0][_0x97a5('0x16')];_0xdd3f47=_0x5cc097['result'][_0x97a5('0x15')][0x0][_0x97a5('0x17')];_0xb833b7='0';_0x288e73='Success.';_0x19fdd2['terminate']();}}break;case 0x1:logger[_0x97a5('0xa')](_0x97a5('0x18'));_0xb833b7='1';_0x288e73='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0x97a5('0x19'));_0xb833b7='2';_0x288e73=_0x97a5('0x19');break;case 0x9:logger['info'](_0x97a5('0x1a'));_0xb833b7='9';_0x288e73='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x97a5('0xa')](_0x97a5('0x1b'));_0xb833b7='10';_0x288e73=_0x97a5('0x1b');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0xb833b7='11';_0x288e73='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x401744){logger[_0x97a5('0x1c')](_0x97a5('0x1d'),JSON['stringify'](_0x401744));_0x19fdd2[_0x97a5('0x1e')]();}}function _0x3453bf(){logger['info'](_0x97a5('0x1f'));_0x3bf821({'transcript':_0x5681bf,'confidence':_0xdd3f47,'status':_0xb833b7,'status_message':_0x288e73});}function _0x27c3a0(_0x5eac0c){logger['error'](_0x97a5('0x20'));if(!_[_0x97a5('0x21')](_0x5eac0c)){logger[_0x97a5('0x1c')](_[_0x97a5('0x22')](_0x5eac0c)?JSON[_0x97a5('0xe')](_0x5eac0c):_0x5eac0c);}}_0x19fdd2['on'](_0x97a5('0x23'),_0x2b0379);_0x19fdd2['on'](_0x97a5('0x24'),_0x163e34);_0x19fdd2['on'](_0x97a5('0x10'),_0x3453bf);_0x19fdd2['on'](_0x97a5('0x1c'),_0x27c3a0);});}; \ No newline at end of file +var _0xbd09=['unix','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','open','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x27074a,_0x40411b){var _0x57f316=function(_0x346df6){while(--_0x346df6){_0x27074a['push'](_0x27074a['shift']());}};_0x57f316(++_0x40411b);}(_0xbd09,0x1eb));var _0x9bd0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbd09[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x9bd0('0x0'));var _=require(_0x9bd0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9bd0('0x2'));var crypto=require(_0x9bd0('0x3'));var logger=require(_0x9bd0('0x4'))(_0x9bd0('0x5'));module[_0x9bd0('0x6')]=function(_0x364d3f,_0x12b336,_0x338631,_0x2ba7c5){return new BPromise(function(_0x28254d,_0x4a7a0a){logger[_0x9bd0('0x7')](_0x9bd0('0x8'),_0x2ba7c5||_0x9bd0('0x9'));var _0x53ede6=new WebSocket(_0x2ba7c5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x3aa334='';var _0x39f33e='0';var _0x1e87a9='1';var _0x119bdf=_0x9bd0('0xa');function _0x323c1b(_0x289627){var _0x3c5bc1=crypto[_0x9bd0('0xb')](_0x9bd0('0xc'));_0x3c5bc1['update'](_0x289627);return _0x3c5bc1[_0x9bd0('0xd')](_0x9bd0('0xe'));}function _0x1dda1e(){try{logger['info'](_0x9bd0('0xf'));var _0x290113=moment()[_0x9bd0('0x10')]();var _0x4e2101=_0x323c1b(_0x290113+_0x12b336+_0x338631);_0x53ede6[_0x9bd0('0x11')](JSON[_0x9bd0('0x12')]({'appID':_0x12b336,'timestamp':_0x290113,'appKey':_0x4e2101}));var _0x22b05b=fs[_0x9bd0('0x13')](_0x364d3f);_0x22b05b['on'](_0x9bd0('0x14'),function(_0x39ab44){_0x53ede6[_0x9bd0('0x11')](_0x39ab44);});_0x22b05b['on']('close',function(){_0x53ede6[_0x9bd0('0x11')](_0x9bd0('0x15'));});}catch(_0x3b08dd){logger[_0x9bd0('0x16')](_0x9bd0('0x17'),JSON[_0x9bd0('0x12')](_0x3b08dd));_0x53ede6[_0x9bd0('0x18')]();}}function _0x2dae5f(_0x347914){try{if(_0x347914){var _0x2ee024=JSON[_0x9bd0('0x19')](_0x347914);switch(_0x2ee024[_0x9bd0('0x1a')]){case 0x0:if(_0x2ee024[_0x9bd0('0x1b')]){if(_0x2ee024[_0x9bd0('0x1b')][_0x9bd0('0x1c')]){logger[_0x9bd0('0x7')]('Tilde\x20ASR\x20hypoteses',JSON[_0x9bd0('0x12')](_0x2ee024[_0x9bd0('0x1b')][_0x9bd0('0x1d')]));_0x3aa334=_0x2ee024[_0x9bd0('0x1b')][_0x9bd0('0x1d')][0x0][_0x9bd0('0x1e')];_0x39f33e=_0x2ee024[_0x9bd0('0x1b')][_0x9bd0('0x1d')][0x0]['likelihood'];_0x1e87a9='0';_0x119bdf=_0x9bd0('0x1f');_0x53ede6['terminate']();}}break;case 0x1:logger['info'](_0x9bd0('0xa'));_0x1e87a9='1';_0x119bdf=_0x9bd0('0xa');break;case 0x2:logger[_0x9bd0('0x7')](_0x9bd0('0x20'));_0x1e87a9='2';_0x119bdf=_0x9bd0('0x20');break;case 0x9:logger[_0x9bd0('0x7')](_0x9bd0('0x21'));_0x1e87a9='9';_0x119bdf=_0x9bd0('0x21');break;case 0xa:logger['info']('Authentication\x20failed.');_0x1e87a9='10';_0x119bdf='Authentication\x20failed.';break;case 0xb:logger[_0x9bd0('0x7')](_0x9bd0('0x22'));_0x1e87a9='11';_0x119bdf=_0x9bd0('0x22');}}}catch(_0x193149){logger['error'](_0x9bd0('0x23'),JSON['stringify'](_0x193149));_0x53ede6[_0x9bd0('0x18')]();}}function _0x4c3e6b(){logger[_0x9bd0('0x7')](_0x9bd0('0x24'));_0x28254d({'transcript':_0x3aa334,'confidence':_0x39f33e,'status':_0x1e87a9,'status_message':_0x119bdf});}function _0x4dcf37(_0x2670ec){logger[_0x9bd0('0x16')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x9bd0('0x25')](_0x2670ec)){logger[_0x9bd0('0x16')](_['isObject'](_0x2670ec)?JSON[_0x9bd0('0x12')](_0x2670ec):_0x2670ec);}}_0x53ede6['on'](_0x9bd0('0x26'),_0x1dda1e);_0x53ede6['on']('message',_0x2dae5f);_0x53ede6['on']('close',_0x4c3e6b);_0x53ede6['on']('error',_0x4dcf37);});}; \ 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 78c1500..10cb4be 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 _0x34e8=['./asr','exports'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x34e8,0x12c));var _0x834e=function(_0x21f021,_0x313887){_0x21f021=_0x21f021-0x0;var _0x32e6db=_0x34e8[_0x21f021];return _0x32e6db;};var asr=require(_0x834e('0x0'));module[_0x834e('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c079be4..54e9e35 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 _0x6038=['call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','127.0.0.1'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x6038,0x1f4));var _0x8603=function(_0x2bf698,_0x41086b){_0x2bf698=_0x2bf698-0x0;var _0x6a4e2b=_0x6038[_0x2bf698];return _0x6a4e2b;};'use strict';var util=require(_0x8603('0x0'));var net=require(_0x8603('0x1'));var EventEmitter=require(_0x8603('0x2'))[_0x8603('0x3')];var AGIError=require(_0x8603('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x471732,_0x2e167b,_0x43cb76){var _0x31f0c2=this,_0x471732=_0x471732||0x11dd,_0x2e167b=_0x2e167b||_0x8603('0x5'),_0x10c107=null,_0x2b4f22=0x0;EventEmitter[_0x8603('0x6')](_0x31f0c2);function _0x2fe54b(){if(!_0x471732){_0x31f0c2[_0x8603('0x7')](_0x8603('0x8'),new AGIError(_0x8603('0x9')));return![];}_0x10c107=net[_0x8603('0xa')]();_0x10c107[_0x8603('0xb')](_0x471732,_0x2e167b);_0x10c107['on'](_0x8603('0xc'),function(){_0x31f0c2[_0x8603('0x7')](_0x8603('0xc'));});_0x10c107['on'](_0x8603('0xd'),function(_0x108f61){_0x10c107[_0x8603('0xe')](function(_0x30c7bf,_0x45ba9c){if(_0x30c7bf){_0x31f0c2[_0x8603('0x7')](_0x8603('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x30c7bf));}else if(_0x43cb76&&_0x43cb76<0x0){_0x31f0c2[_0x8603('0x7')](_0x8603('0x8'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x108f61['destroy']();}else if(_0x43cb76&&_0x43cb76>0x0&&_0x43cb76<_0x45ba9c){_0x2b4f22+=0x1;_0x31f0c2[_0x8603('0x7')](_0x8603('0x8'),new AGIError(_0x8603('0xf'),_0x2b4f22));_0x108f61['destroy']();}else{var _0x215ed7=new AGIChannel(_0x108f61);_0x215ed7['on'](_0x8603('0x10'),function(){_0x31f0c2[_0x8603('0x7')](_0x8603('0xd'),_0x215ed7);});}});});_0x10c107['on'](_0x8603('0x8'),function(_0x1ebe59){_0x31f0c2[_0x8603('0x7')](_0x8603('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x1ebe59[_0x8603('0x11')]));});_0x10c107['on'](_0x8603('0x12'),function(){_0x31f0c2['emit'](_0x8603('0x12'),new AGIError(_0x8603('0x13')));});}process[_0x8603('0x14')](function(){_0x2fe54b();});};util[_0x8603('0x15')](AGIServer,EventEmitter);module[_0x8603('0x16')]=function(_0x659882,_0x11f5f3,_0x55b9ca){return new AGIServer(_0x659882,_0x11f5f3,_0x55b9ca);}; \ No newline at end of file +var _0xbe5e=['E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections'];(function(_0x432813,_0xab9e9a){var _0x353280=function(_0x51a3f3){while(--_0x51a3f3){_0x432813['push'](_0x432813['shift']());}};_0x353280(++_0xab9e9a);}(_0xbe5e,0x81));var _0xebe5=function(_0x48a010,_0x526602){_0x48a010=_0x48a010-0x0;var _0x423b5b=_0xbe5e[_0x48a010];return _0x423b5b;};'use strict';var util=require(_0xebe5('0x0'));var net=require(_0xebe5('0x1'));var EventEmitter=require('events')[_0xebe5('0x2')];var AGIError=require(_0xebe5('0x3'));var AGIChannel=require(_0xebe5('0x4'));var AGIServer=function(_0x2a1302,_0x4389c3,_0x43d7f7){var _0x1e3335=this,_0x2a1302=_0x2a1302||0x11dd,_0x4389c3=_0x4389c3||_0xebe5('0x5'),_0x5aa5e5=null,_0x35cf69=0x0;EventEmitter[_0xebe5('0x6')](_0x1e3335);function _0x73d4df(){if(!_0x2a1302){_0x1e3335[_0xebe5('0x7')](_0xebe5('0x8'),new AGIError(_0xebe5('0x9')));return![];}_0x5aa5e5=net[_0xebe5('0xa')]();_0x5aa5e5[_0xebe5('0xb')](_0x2a1302,_0x4389c3);_0x5aa5e5['on']('listening',function(){_0x1e3335['emit'](_0xebe5('0xc'));});_0x5aa5e5['on'](_0xebe5('0xd'),function(_0x5882ff){_0x5aa5e5[_0xebe5('0xe')](function(_0x1e8eec,_0x5d8bde){if(_0x1e8eec){_0x1e3335[_0xebe5('0x7')](_0xebe5('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x1e8eec));}else if(_0x43d7f7&&_0x43d7f7<0x0){_0x1e3335['emit']('error',new AGIError(_0xebe5('0xf')));_0x5882ff[_0xebe5('0x10')]();}else if(_0x43d7f7&&_0x43d7f7>0x0&&_0x43d7f7<_0x5d8bde){_0x35cf69+=0x1;_0x1e3335['emit'](_0xebe5('0x8'),new AGIError(_0xebe5('0x11'),_0x35cf69));_0x5882ff[_0xebe5('0x10')]();}else{var _0x493670=new AGIChannel(_0x5882ff);_0x493670['on'](_0xebe5('0x12'),function(){_0x1e3335[_0xebe5('0x7')](_0xebe5('0xd'),_0x493670);});}});});_0x5aa5e5['on']('error',function(_0x505224){_0x1e3335['emit'](_0xebe5('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x505224['code']));});_0x5aa5e5['on'](_0xebe5('0x13'),function(){_0x1e3335[_0xebe5('0x7')](_0xebe5('0x13'),new AGIError(_0xebe5('0x14')));});}process[_0xebe5('0x15')](function(){_0x73d4df();});};util[_0xebe5('0x16')](AGIServer,EventEmitter);module[_0xebe5('0x17')]=function(_0x521ac8,_0x3be153,_0x5eae64){return new AGIServer(_0x521ac8,_0x3be153,_0x5eae64);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 03d1c27..e906110 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 _0xc9b7=['findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','output','pause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','record','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','sendFax','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','debug','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','unlink','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','join','exports','path','lodash','shelljs','odbc','moment','mustache','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','then','getSquareOdbc','dsn','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','callerid','createSquareRecording','extension','priority','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','uniqueid','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','LOCAL','agentLogin','exec','replace','googleTTS','text','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','uri','clear','agicommand','clone','hasOwnProperty','isString','replaceAllVariables','split','length','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','agi','command','answer','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','add','minutes','sync','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','options','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20found','forEach','keys','setVariable','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','opts','url','Executed\x20command\x20%s','dialogflow','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','no\x20username\x20configured','password','no\x20password\x20configured','bot','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','mindigit','hiddendigitsnum','hiddendigitspos','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','aws_secret_access_key','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','toUpperCase','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','generate','%s.%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','stringify','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block'];(function(_0x1520d0,_0x50ec5d){var _0x5badba=function(_0x4c3013){while(--_0x4c3013){_0x1520d0['push'](_0x1520d0['shift']());}};_0x5badba(++_0x50ec5d);}(_0xc9b7,0x6a));var _0x7c9b=function(_0x13dd37,_0x1a62d7){_0x13dd37=_0x13dd37-0x0;var _0x4018ef=_0xc9b7[_0x13dd37];return _0x4018ef;};'use strict';var fs=require('fs');var path=require(_0x7c9b('0x0'));var util=require('util');var _=require(_0x7c9b('0x1'));var sh=require(_0x7c9b('0x2'));var odbc=require(_0x7c9b('0x3'))();var rs=require('randomstring');var moment=require(_0x7c9b('0x4'));var Mustache=require(_0x7c9b('0x5'));var logger=require('../../config/logger')('agi');var config=require(_0x7c9b('0x6'));var scripts=require(_0x7c9b('0x7'));var FILES_PATH=_0x7c9b('0x8');var verticesWithRetry=[_0x7c9b('0x9'),_0x7c9b('0xa'),_0x7c9b('0xb')];var AGIVertices=function(_0x4b0bee,_0x41d176,_0x25121d){this[_0x7c9b('0xc')]=_0x4b0bee;this[_0x7c9b('0xd')]=_0x41d176;this[_0x7c9b('0xe')]=_0x25121d;};AGIVertices['prototype'][_0x7c9b('0xf')]=function(_0x4214ec,_0x278933){this['rpc']['getVariableById'](_0x4214ec)['then'](function(_0x2d857a){_0x278933(null,_0x2d857a?_0x2d857a[_0x7c9b('0x10')]:![]);})[_0x7c9b('0x11')](function(_0x47b0db){_0x278933(_0x47b0db);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x13')]=function(_0x5e9bb1,_0x444dfe){this[_0x7c9b('0xd')][_0x7c9b('0x14')](_0x5e9bb1)['then'](function(_0x13be16){_0x444dfe(null,_0x13be16?_0x13be16[_0x7c9b('0x10')]:![]);})[_0x7c9b('0x11')](function(_0x25ec51){_0x444dfe(_0x25ec51);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x15')]=function(_0x67901f,_0x215782){this[_0x7c9b('0xd')][_0x7c9b('0x16')](_0x67901f)[_0x7c9b('0x17')](function(_0x2e3ea4){_0x215782(null,_0x2e3ea4?_0x2e3ea4[_0x7c9b('0x10')]:![]);})[_0x7c9b('0x11')](function(_0x325ac7){_0x215782(_0x325ac7);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x18')]=function(_0x3d4704,_0x1bebb4){this[_0x7c9b('0xd')]['getSquareOdbcById'](_0x3d4704)[_0x7c9b('0x17')](function(_0x3c6c22){_0x1bebb4(null,_0x3c6c22?_0x3c6c22[_0x7c9b('0x19')]:![]);})[_0x7c9b('0x11')](function(_0x5d5e02){_0x1bebb4(_0x5d5e02);});};AGIVertices[_0x7c9b('0x12')]['getUser']=function(_0x1cf1c2,_0x356b54){this[_0x7c9b('0xd')][_0x7c9b('0x1a')](_0x1cf1c2)[_0x7c9b('0x17')](function(_0x10c01b){_0x356b54(null,_0x10c01b?_0x10c01b[_0x7c9b('0x10')]:![]);})[_0x7c9b('0x11')](function(_0x321079){_0x356b54(_0x321079);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x1b')]=function(_0x8825ab,_0x336f1e){this['rpc'][_0x7c9b('0x1c')](_0x8825ab)[_0x7c9b('0x17')](function(_0x1e4523){_0x336f1e(null,_0x1e4523?_0x1e4523[_0x7c9b('0x10')]:![]);})[_0x7c9b('0x11')](function(_0x322120){_0x336f1e(_0x322120);});};AGIVertices[_0x7c9b('0x12')]['getSound']=function(_0x4178f1,_0xbf4ad0){var _0x57710f=this;this['rpc'][_0x7c9b('0x1d')](_0x4178f1)[_0x7c9b('0x17')](function(_0x49b936){_0xbf4ad0(null,_0x49b936?_0x57710f[_0x7c9b('0x1e')](_0x49b936[_0x7c9b('0x1f')]):![]);})[_0x7c9b('0x11')](function(_0xa48219){_0xbf4ad0(_0xa48219);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x20')]=function(_0x8b4110,_0x473d03){this[_0x7c9b('0xd')][_0x7c9b('0x21')](_0x8b4110)[_0x7c9b('0x17')](function(_0x2d0fd6){_0x473d03(null,_0x2d0fd6?_0x2d0fd6:![]);})[_0x7c9b('0x11')](function(_0x55829d){_0x473d03(_0x55829d);});};AGIVertices[_0x7c9b('0x12')]['sendMailMessage']=function(_0x315d2a,_0x5cb0fa,_0x5cab60){this[_0x7c9b('0xe')][_0x7c9b('0x22')](_0x315d2a,_0x5cb0fa)[_0x7c9b('0x17')](function(){_0x5cab60(null);})['catch'](function(_0xc0308){_0x5cab60(_0xc0308);});};AGIVertices[_0x7c9b('0x12')]['getIntervals']=function(_0x678740,_0x335043){this[_0x7c9b('0xd')]['getIntervalById'](_0x678740)[_0x7c9b('0x17')](function(_0x2e583f){if(_0x2e583f){if(_0x2e583f[_0x7c9b('0x23')]){_0x335043(null,[_0x2e583f[_0x7c9b('0x24')]]);}else{_0x335043(null,_['map'](_0x2e583f[_0x7c9b('0x25')],'interval'));}}else{_0x335043(null,![]);}})[_0x7c9b('0x11')](function(_0x5cd2c7){_0x335043(_0x5cd2c7);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x1e')]=function(_0x54b959){return util[_0x7c9b('0x26')]('%s/sounds/converted/%s',FILES_PATH,_0x54b959);};AGIVertices[_0x7c9b('0x12')]['getQueryOdbc']=function(_0x2c94da,_0x276058,_0x3eee78){odbc[_0x7c9b('0x27')](_0x2c94da,function(_0x298561){if(_0x298561){logger[_0x7c9b('0x28')](_0x7c9b('0x29'),_0x298561);_0x3eee78(_0x298561);}else{logger[_0x7c9b('0x2a')](_0x7c9b('0x2b'));odbc['query'](_0x276058,function(_0x5e6a83,_0x4c3036){if(_0x5e6a83){logger[_0x7c9b('0x2a')](_0x7c9b('0x2c'),_0x276058);_0x3eee78(_0x5e6a83);}else{logger[_0x7c9b('0x2a')](_0x7c9b('0x2d'),_0x276058);odbc[_0x7c9b('0x2e')](function(_0x5e2402){if(_0x5e2402){logger[_0x7c9b('0x28')](_0x7c9b('0x2f'),_0x5e2402);}_0x3eee78(null,_0x4c3036);});}});}});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x30')]=function(_0x4f9023,_0x825859){this[_0x7c9b('0xd')][_0x7c9b('0x31')](_0x4f9023)[_0x7c9b('0x17')](function(_0x424967){_0x825859(null,_0x424967?_0x424967:![]);})[_0x7c9b('0x11')](function(_0x5d0ea1){_0x825859(_0x5d0ea1);});};AGIVertices['prototype'][_0x7c9b('0x32')]=function(_0x11924b,_0x203bc3){this['rpc'][_0x7c9b('0x32')](_0x11924b)[_0x7c9b('0x17')](function(_0x290b7d){_0x203bc3(null,_0x290b7d);})['catch'](function(_0x33ea3e){_0x203bc3(_0x33ea3e);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x33')]=function(_0x4509d7,_0x1a551f,_0x1655ca){this['rpc'][_0x7c9b('0x33')]({'uniqueid':this[_0x7c9b('0xc')]['uniqueid'],'node':_0x4509d7[_0x7c9b('0x34')],'application':_0x4509d7['agicommand'],'data':_0x1a551f||null,'project_name':this[_0x7c9b('0xc')]['arg_1'],'callerid':this[_0x7c9b('0xc')][_0x7c9b('0x35')]})[_0x7c9b('0x17')](function(_0x7c728){if(_0x1655ca){_0x1655ca(null,_0x7c728);}})['catch'](function(_0x5090d5){if(_0x1655ca){_0x1655ca(_0x5090d5);}});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x36')]=function(_0x21d207,_0xd19fb2,_0x82a361,_0x475571){this[_0x7c9b('0xd')][_0x7c9b('0x36')]({'uniqueid':this[_0x7c9b('0xc')]['uniqueid'],'callerid':this['channel'][_0x7c9b('0x35')],'calleridname':this['channel']['calleridname'],'context':this[_0x7c9b('0xc')]['context'],'extension':this['channel'][_0x7c9b('0x37')],'priority':this[_0x7c9b('0xc')][_0x7c9b('0x38')],'accountcode':this[_0x7c9b('0xc')]['accountcode'],'dnid':this[_0x7c9b('0xc')]['dnid'],'projectName':this[_0x7c9b('0xc')][_0x7c9b('0x39')],'saveName':_0xd19fb2,'filename':_0x21d207[_0x7c9b('0x3a')]||_0xd19fb2,'savePath':_0x82a361})[_0x7c9b('0x17')](function(_0x244e46){_0x475571(null,_0x244e46);})[_0x7c9b('0x11')](function(_0x1581ed){_0x475571(_0x1581ed);});};AGIVertices['prototype'][_0x7c9b('0x3b')]=function(_0xf66f0b,_0x1dd685,_0xa0b19a){this[_0x7c9b('0xd')]['createSquareMessage']({'uniqueid':this[_0x7c9b('0xc')]['uniqueid'],'body':_0xf66f0b,'direction':_0x1dd685})[_0x7c9b('0x17')](function(_0x18cc3c){if(_0xa0b19a){_0xa0b19a(null,_0x18cc3c);}})[_0x7c9b('0x11')](function(_0x4b680a){if(_0xa0b19a){_0xa0b19a(_0x4b680a);}});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x3c')]=function(_0x3cf5be,_0x4d8b84){this[_0x7c9b('0xd')][_0x7c9b('0x3c')]({'firstName':_[_0x7c9b('0x3d')](_0x3cf5be[_0x7c9b('0x10')])||_[_0x7c9b('0x3e')](_0x3cf5be[_0x7c9b('0x10')])?_0x7c9b('0x3f')+Math[_0x7c9b('0x40')]():_0x3cf5be[_0x7c9b('0x10')],'lastName':_[_0x7c9b('0x3d')](_0x3cf5be[_0x7c9b('0x41')])||_[_0x7c9b('0x3e')](_0x3cf5be[_0x7c9b('0x41')])?null:_0x3cf5be['lastName'],'phone':_0x3cf5be['phone'],'ListId':_0x3cf5be[_0x7c9b('0x42')],'scheduledAt':_0x3cf5be[_0x7c9b('0x43')],'callbackUniqueid':this[_0x7c9b('0xc')][_0x7c9b('0x44')],'tags':_0x7c9b('0x45'),'description':_0x7c9b('0x46')+_0x3cf5be[_0x7c9b('0x43')][_0x7c9b('0x47')](),'priority':_0x3cf5be[_0x7c9b('0x48')]})[_0x7c9b('0x17')](function(_0xf111b3){_0x4d8b84(null,_0xf111b3);})['catch'](function(_0x2f2bdc){_0x4d8b84(_0x2f2bdc);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x49')]=function(_0x503d11,_0x3783a8){this[_0x7c9b('0xd')]['getPauseById'](_0x503d11)[_0x7c9b('0x17')](function(_0x30f9dd){_0x3783a8(null,_0x30f9dd?_0x30f9dd['name']:![]);})[_0x7c9b('0x11')](function(_0x34eacb){_0x3783a8(_0x34eacb);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x4a')]=function(_0x22ea60,_0x4517ff,_0x30aafd){var _0x571357={'role':_0x7c9b('0x4b')};_0x571357[_0x22ea60]=this['channel'][_0x7c9b('0x35')];this[_0x7c9b('0xd')][_0x7c9b('0x4a')](_0x571357,_0x4517ff,this[_0x7c9b('0xc')][_0x7c9b('0x44')])[_0x7c9b('0x17')](function(_0xf200c1){_0x30aafd(null,_[_0x7c9b('0x3e')](_0xf200c1)?![]:!![]);})['catch'](function(_0x3e2806){logger[_0x7c9b('0x28')](_0x3e2806);_0x30aafd(null,![]);});};AGIVertices['prototype'][_0x7c9b('0x4c')]=function(_0x539db3,_0x2c9301){var _0x155ee2={'role':_0x7c9b('0x4b')};_0x155ee2[_0x539db3]=this[_0x7c9b('0xc')][_0x7c9b('0x35')];this[_0x7c9b('0xd')]['agentUnpause'](_0x155ee2)['then'](function(_0x2b34bb){_0x2c9301(null,_[_0x7c9b('0x3e')](_0x2b34bb)?![]:!![]);})['catch'](function(_0x164879){logger[_0x7c9b('0x28')](_0x164879);_0x2c9301(null,![]);});};AGIVertices[_0x7c9b('0x12')]['agentLogout']=function(_0x3b1294,_0x65b643){var _0x3b7bf1={'role':'agent'};_0x3b7bf1[_0x3b1294]=this[_0x7c9b('0xc')][_0x7c9b('0x35')];this[_0x7c9b('0xd')][_0x7c9b('0x4d')](_0x3b7bf1)['then'](function(_0x2b60fa){_0x65b643(null,_[_0x7c9b('0x3e')](_0x2b60fa)?![]:!![]);})[_0x7c9b('0x11')](function(_0x4f5b60){logger['error'](_0x4f5b60);_0x65b643(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x30fe3e,_0x5dadd4){var _0x1afe58={'role':_0x7c9b('0x4b')};_0x1afe58[_0x30fe3e]=this[_0x7c9b('0xc')]['callerid'];var _0x3f4359=_0x30fe3e!=_0x7c9b('0x4e')?util['format']('%s/%s@from-sip/n',_0x7c9b('0x4f'),this[_0x7c9b('0xc')][_0x7c9b('0x35')]):undefined;this['rpc'][_0x7c9b('0x50')](_0x1afe58,_0x3f4359)[_0x7c9b('0x17')](function(_0x2a9a84){_0x5dadd4(null,_[_0x7c9b('0x3e')](_0x2a9a84)?![]:!![]);})[_0x7c9b('0x11')](function(_0x47eae3){logger['error'](_0x47eae3);_0x5dadd4(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x2fcb86,_0x49a71b){sh[_0x7c9b('0x51')](_['trim'](_0x2fcb86),function(_0x2cf14b,_0x5acade){var _0x3be57e=_0x5acade[_0x7c9b('0x52')](/(\r\n|\n|\r)/gm,'');_0x49a71b(null,_0x3be57e);});};AGIVertices['prototype'][_0x7c9b('0x53')]=function(_0x231c6d,_0x24a9a9){scripts[_0x7c9b('0x53')](_0x231c6d[_0x7c9b('0x54')],_0x231c6d['google_tts_language']||'en',0x1)[_0x7c9b('0x17')](function(_0x4515f1){_0x24a9a9(null,_0x4515f1);})[_0x7c9b('0x11')](function(_0x206fb7){_0x24a9a9(_0x206fb7);});};AGIVertices[_0x7c9b('0x12')]['googleDialogflow']=function(_0x54bed7,_0x4c6439){scripts[_0x7c9b('0x55')](this[_0x7c9b('0xc')][_0x7c9b('0x44')],_0x54bed7[_0x7c9b('0x56')],_0x54bed7[_0x7c9b('0x54')],_0x54bed7[_0x7c9b('0x57')]||'en')[_0x7c9b('0x17')](function(_0x3f4847){_0x4c6439(null,_0x3f4847);})[_0x7c9b('0x11')](function(_0x3aefb1){_0x4c6439(_0x3aefb1);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x58')]=function(_0x3c4d45,_0x1eed58){scripts['sestekNDA'](this[_0x7c9b('0xc')],_0x3c4d45)[_0x7c9b('0x17')](function(_0x1c77cf){_0x1eed58(null,_0x1c77cf);})[_0x7c9b('0x11')](function(_0x4588f4){_0x1eed58(_0x4588f4);});};AGIVertices['prototype'][_0x7c9b('0x59')]=function(_0x46e205,_0xbeab4f){scripts['ispeechTTS'](_0x46e205[_0x7c9b('0x56')],_0x46e205[_0x7c9b('0x54')],_0x46e205['ispeech_tts_language']||_0x7c9b('0x5a'),_0x46e205[_0x7c9b('0x5b')])[_0x7c9b('0x17')](function(_0x311200){_0xbeab4f(null,_0x311200);})[_0x7c9b('0x11')](function(_0x5640e2){_0xbeab4f(_0x5640e2);});};AGIVertices['prototype'][_0x7c9b('0x5c')]=function(_0xd519e3,_0x43368c,_0xd9672c){scripts[_0x7c9b('0x5c')](_0x43368c,_0xd519e3[_0x7c9b('0x56')],_0xd519e3[_0x7c9b('0x5d')]||'en-US',this[_0x7c9b('0x5e')](_0xd519e3[_0x7c9b('0x5f')])?_0xd519e3['model']:undefined)['then'](function(_0x11fa27){_0xd9672c(null,_0x11fa27);})['catch'](function(_0x23eb3f){_0xd9672c(_0x23eb3f);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x60')]=function(_0x91be28,_0x156286){scripts[_0x7c9b('0x60')](_0x91be28[_0x7c9b('0x61')],_0x91be28['aws_secret_access_key'],_0x91be28[_0x7c9b('0x62')],_0x91be28['aws_polly_voice']||_0x7c9b('0x63'),_0x91be28[_0x7c9b('0x54')],_0x91be28[_0x7c9b('0x64')]||_0x7c9b('0x54'))['then'](function(_0x375e9f){_0x156286(null,_0x375e9f);})[_0x7c9b('0x11')](function(_0x4e8e5b){_0x156286(_0x4e8e5b);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x65')]=function(_0x299da4,_0x185208){scripts[_0x7c9b('0x65')](this[_0x7c9b('0xc')]['uniqueid'],_0x299da4[_0x7c9b('0x61')],_0x299da4['aws_secret_access_key'],_0x299da4[_0x7c9b('0x66')],_0x299da4[_0x7c9b('0x54')],_0x299da4[_0x7c9b('0x67')])[_0x7c9b('0x17')](function(_0x510ab7){_0x185208(null,_0x510ab7);})['catch'](function(_0xd4e308){_0x185208(_0xd4e308);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x68')]=function(_0x21d660,_0x2c2ae4,_0x4a04cf){scripts[_0x7c9b('0x68')](_0x2c2ae4,_0x21d660[_0x7c9b('0x56')],_0x21d660['google_asr_language']||_0x7c9b('0x5a'))[_0x7c9b('0x17')](function(_0x3333dd){_0x4a04cf(null,_0x3333dd);})[_0x7c9b('0x11')](function(_0x16600f){_0x4a04cf(_0x16600f);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x69')]=function(_0xaf89a8,_0x5e1898,_0x3f1c7a){scripts[_0x7c9b('0x69')](_0x5e1898,_0xaf89a8['appid'],_0xaf89a8[_0x7c9b('0x6a')],_0xaf89a8[_0x7c9b('0x6b')])[_0x7c9b('0x17')](function(_0x1bcd10){_0x3f1c7a(null,_0x1bcd10);})[_0x7c9b('0x11')](function(_0x4d974f){_0x3f1c7a(_0x4d974f);});};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x6c')]=function(_0x41a9f5){var _0x360f9f=_['includes'](verticesWithRetry,_0x41a9f5[_0x7c9b('0x6d')])?_0x41a9f5:_[_0x7c9b('0x6e')](_0x41a9f5);for(var _0xbe2067 in _0x360f9f){if(_0x360f9f[_0x7c9b('0x6f')](_0xbe2067)){if(_0x360f9f[_0xbe2067]&&_[_0x7c9b('0x70')](_0x360f9f[_0xbe2067])){_0x360f9f[_0xbe2067]=this[_0x7c9b('0x71')](_0x360f9f[_0xbe2067]);}}}return _0x360f9f;};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x71')]=function(_0xc6daeb){var _0x2efcc9=_0xc6daeb[_0x7c9b('0x72')]('{');for(var _0x1b8a1f=0x1;_0x1b8a1f<_0x2efcc9[_0x7c9b('0x73')];_0x1b8a1f+=0x1){var _0x499fce=_0x2efcc9[_0x1b8a1f][_0x7c9b('0x72')]('}');if(_0x499fce['length']>0x1){_0xc6daeb=_0xc6daeb[_0x7c9b('0x74')]('{'+_0x499fce[0x0]+'}',this[_0x7c9b('0xc')][_0x7c9b('0xf')](_0x499fce[0x0])['extra']||_0x499fce[0x0]);}}if(_0x2efcc9['length']===0x1){return _0xc6daeb[_0x7c9b('0x47')]();}return this[_0x7c9b('0x71')](_0xc6daeb);};AGIVertices['prototype'][_0x7c9b('0x75')]=function(_0xfdb7b3,_0x4e48f8){var _0x105f90=this['channel']['getVariable'](_0xfdb7b3);if(_0x105f90[_0x7c9b('0x76')]===-0x1){return _0x105f90;}logger['info'](util[_0x7c9b('0x26')](_0x7c9b('0x77'),_0x4e48f8,_0x105f90['extra']));return this[_0x7c9b('0xc')]['setVariable'](_0x4e48f8,_0x105f90[_0x7c9b('0x78')]);};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x5e')]=function(_0x122d04){return _0x122d04&&_0x122d04!=='0'&&_0x122d04!=='-1'&&_0x122d04!=='';};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x79')]=function(_0x4315ee){this[_0x7c9b('0x33')]['sync'](this,_0x4315ee,'-');_0x4315ee[_0x7c9b('0x7a')]=_0x4315ee[_0x7c9b('0x79')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x7c9b('0x7b')]=function(_0x19ae1e){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x19ae1e[_0x7c9b('0x34')]));return this[_0x7c9b('0xc')][_0x7c9b('0x7b')]([_0x19ae1e[_0x7c9b('0x7c')],_0x19ae1e['args']]);};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x7d')]=function(_0x2d819e){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x2d819e[_0x7c9b('0x34')]));if(this[_0x7c9b('0x5e')](_0x2d819e[_0x7c9b('0x7e')])){logger['info'](util[_0x7c9b('0x26')](_0x7c9b('0x7f'),_0x2d819e[_0x7c9b('0x7e')]));var _0x722be2=this['channel'][_0x7c9b('0x80')](_0x2d819e[_0x7c9b('0x7e')]);if(_0x722be2[_0x7c9b('0x76')]===-0x1){return _0x722be2;}}return this[_0x7c9b('0xc')][_0x7c9b('0x7d')]();};AGIVertices[_0x7c9b('0x12')]['callback']=function(_0x2ba35f){logger['info'](util[_0x7c9b('0x26')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x2ba35f['label']));if(!this[_0x7c9b('0x5e')](_0x2ba35f[_0x7c9b('0x42')])){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x2ba35f,_0x7c9b('0x81'));}_0x2ba35f['scheduledAt']=moment();if(this['isConfigured'](_0x2ba35f[_0x7c9b('0x82')])){_0x2ba35f[_0x7c9b('0x43')]=moment()[_0x7c9b('0x83')](_0x2ba35f[_0x7c9b('0x82')],_0x7c9b('0x84'));}if(!this[_0x7c9b('0x5e')](_0x2ba35f[_0x7c9b('0x48')])){_0x2ba35f[_0x7c9b('0x48')]=0x2;}this['createCmContact'][_0x7c9b('0x85')](this,_0x2ba35f);return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x87'),_0x2ba35f[_0x7c9b('0x88')],_0x2ba35f[_0x7c9b('0x42')],_0x2ba35f[_0x7c9b('0x43')]));};AGIVertices['prototype'][_0x7c9b('0x89')]=function(_0x291ab4){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x8a'),_0x291ab4[_0x7c9b('0x34')]));var _0x3348eb=this[_0x7c9b('0xc')]['exec'](_0x291ab4['application'],_0x291ab4[_0x7c9b('0x8b')]);if(_0x3348eb[_0x7c9b('0x76')]===-0x1){return _0x3348eb;}return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x8c'),_0x291ab4[_0x7c9b('0x8d')],_0x291ab4[_0x7c9b('0x8b')]));};AGIVertices[_0x7c9b('0x12')]['lumenvoxtts']=function(_0x3c2fa5){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x8e'),_0x3c2fa5[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x3c2fa5[_0x7c9b('0x54')])){return this['channel'][_0x7c9b('0x86')](_0x7c9b('0x8f'));}var _0x5e63f5='\x22'+_0x3c2fa5[_0x7c9b('0x54')]+'\x22';if(this[_0x7c9b('0x5e')](_0x3c2fa5[_0x7c9b('0x8b')])){_0x5e63f5+=','+_0x3c2fa5[_0x7c9b('0x8b')];}var _0xc8a3b6=this[_0x7c9b('0xc')]['exec']('MRCPSynth',_0x5e63f5);if(_0xc8a3b6['result']===-0x1){return _0xc8a3b6;}return this[_0x7c9b('0xc')]['noop'](util[_0x7c9b('0x26')](_0x7c9b('0x90'),_0x5e63f5));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x91')]=function(_0x2ceb6a){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0x92'),_0x2ceb6a[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x2ceb6a[_0x7c9b('0x54')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0x8f'));}var _0x342f0e='\x22'+_0x2ceb6a[_0x7c9b('0x54')]+'\x22';if(this[_0x7c9b('0x5e')](_0x2ceb6a[_0x7c9b('0x8b')])){_0x342f0e+=','+_0x2ceb6a[_0x7c9b('0x8b')];}var _0x9d70f0=this[_0x7c9b('0xc')][_0x7c9b('0x51')](_0x7c9b('0x93'),_0x342f0e);if(_0x9d70f0[_0x7c9b('0x76')]===-0x1){return _0x9d70f0;}return this[_0x7c9b('0xc')]['noop'](util[_0x7c9b('0x26')](_0x7c9b('0x90'),_0x342f0e));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x94')]=function(_0x300ac8){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x300ac8['label']));if(!this[_0x7c9b('0x5e')](_0x300ac8[_0x7c9b('0x95')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0x96'));}var _0xa5b709=_0x300ac8['grammar'];if(this[_0x7c9b('0x5e')](_0x300ac8[_0x7c9b('0x8b')])){_0xa5b709+=','+_0x300ac8[_0x7c9b('0x8b')];}var _0x151e03=this[_0x7c9b('0xc')]['exec'](_0x7c9b('0x97'),_0xa5b709);if(_0x151e03['result']===-0x1){return _0x151e03;}var _0x1ec360=this[_0x7c9b('0x75')](_0x7c9b('0x98'),_0x7c9b('0x99'));if(_0x1ec360[_0x7c9b('0x76')]===-0x1){return _0x1ec360;}var _0x2d0651=this[_0x7c9b('0x75')](_0x7c9b('0x9a'),_0x7c9b('0x9b'));if(_0x2d0651[_0x7c9b('0x76')]===-0x1){return _0x2d0651;}var _0x49e1c5=this[_0x7c9b('0x75')](_0x7c9b('0x9c'),_0x7c9b('0x9d'));if(_0x49e1c5[_0x7c9b('0x76')]===-0x1){return _0x49e1c5;}return this[_0x7c9b('0xc')]['noop'](util[_0x7c9b('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0xa5b709));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x9e')]=function(_0x4f7411){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x9f'),_0x4f7411[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x4f7411[_0x7c9b('0x95')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0x96'));}var _0x2124da=_0x4f7411[_0x7c9b('0x95')];if(this[_0x7c9b('0x5e')](_0x4f7411[_0x7c9b('0x8b')])){_0x2124da+=','+_0x4f7411[_0x7c9b('0x8b')];}var _0x1274ea=this['channel'][_0x7c9b('0x51')](_0x7c9b('0x97'),_0x2124da);if(_0x1274ea[_0x7c9b('0x76')]===-0x1){return _0x1274ea;}var _0x53e696=this[_0x7c9b('0x75')](_0x7c9b('0x98'),_0x7c9b('0xa0'));if(_0x53e696[_0x7c9b('0x76')]===-0x1){return _0x53e696;}var _0x5659ce=this['getAndSetVariable'](_0x7c9b('0x9a'),_0x7c9b('0xa1'));if(_0x5659ce['result']===-0x1){return _0x5659ce;}var _0x52f82b=this[_0x7c9b('0x75')]('RECOG_INSTANCE()',_0x7c9b('0xa2'));if(_0x52f82b[_0x7c9b('0x76')]===-0x1){return _0x52f82b;}return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0xa3'),_0x2124da));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0xa4')]=function(_0x116ae4){logger['info'](util[_0x7c9b('0x26')](_0x7c9b('0xa5'),_0x116ae4[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x116ae4[_0x7c9b('0xa6')])){return this[_0x7c9b('0xc')]['error'](_0x116ae4,_0x7c9b('0xa7'));}var _0x3d1411=this['getSquareOdbc'][_0x7c9b('0x85')](this,_0x116ae4[_0x7c9b('0xa6')]);if(!_0x3d1411){return this[_0x7c9b('0xc')]['error'](_0x116ae4,_0x7c9b('0xa8'));}if(!this['isConfigured'](_0x116ae4[_0x7c9b('0xa9')])){return this['channel']['error'](_0x116ae4,_0x7c9b('0xaa'));}var _0x1bbcf5=_0x116ae4['query'][_0x7c9b('0x52')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0xab'),_0x1bbcf5));var _0x19c0f8=this[_0x7c9b('0xac')]['sync'](this,_0x3d1411,_0x1bbcf5);this[_0x7c9b('0x33')]['sync'](this,_0x116ae4,_0x1bbcf5);if(!this[_0x7c9b('0x5e')](_0x116ae4[_0x7c9b('0xad')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x58aa5d=this['getVariable'][_0x7c9b('0x85')](this,_0x116ae4[_0x7c9b('0xad')]);if(!_0x58aa5d){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x116ae4,_0x7c9b('0xae'));}var _0x30375c=this;_0x19c0f8[_0x7c9b('0xaf')](function(_0x2088b3,_0x15a7e2){Object[_0x7c9b('0xb0')](_0x2088b3)[_0x7c9b('0xaf')](function(_0x1b7b52){_0x30375c['channel'][_0x7c9b('0xb1')](util['format']('%s[%s][%s]',_0x58aa5d,_0x15a7e2,_0x1b7b52),_0x2088b3[_0x1b7b52]);});});this[_0x7c9b('0xc')][_0x7c9b('0xb1')](util[_0x7c9b('0x26')]('%s_ROWS_COUNT',_0x58aa5d),_0x19c0f8[_0x7c9b('0x73')]);return this[_0x7c9b('0xc')]['noop'](util[_0x7c9b('0x26')]('variable\x20%s\x20set',_0x58aa5d));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0xb2')]=function(_0x580845){logger['debug'](util[_0x7c9b('0x26')](_0x7c9b('0xb3'),_0x580845[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x580845[_0x7c9b('0xb4')])){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x580845,_0x7c9b('0xb5'));}var _0xf5ad85=this[_0x7c9b('0xb6')]['sync'](this,_0x580845[_0x7c9b('0xb4')]);if(!_0xf5ad85){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x580845,_0x7c9b('0xb7'));}var _0x1ca302=this['channel'][_0x7c9b('0x51')](_0x7c9b('0xb8'),[util[_0x7c9b('0x26')]('SIP/%s',_0xf5ad85),_0x580845[_0x7c9b('0x7e')],_0x580845[_0x7c9b('0xb9')],_0x580845[_0x7c9b('0xba')]]);if(_0x1ca302[_0x7c9b('0x76')]===-0x1){return _0x1ca302;}return this[_0x7c9b('0xc')]['noop'](util[_0x7c9b('0x26')](_0x7c9b('0xbb'),_0x7c9b('0xb8')));};AGIVertices['prototype'][_0x7c9b('0xbc')]=function(_0x495bd0){logger['info'](util[_0x7c9b('0x26')](_0x7c9b('0xbd'),_0x495bd0['label']));if(!this[_0x7c9b('0x5e')](_0x495bd0[_0x7c9b('0x56')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0xbe'));}if(!this['isConfigured'](_0x495bd0[_0x7c9b('0x54')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0x8f'));}this[_0x7c9b('0xc')]['bot']=!![];this[_0x7c9b('0x33')](_0x495bd0);this[_0x7c9b('0x3b')](_0x495bd0['text'],'in');this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0xbf'),_0x495bd0['text']));var _0xd6ec1=this[_0x7c9b('0x55')][_0x7c9b('0x85')](this,_0x495bd0);if(_0xd6ec1){for(var _0x19153f in _0xd6ec1){if(_0xd6ec1[_0x7c9b('0x6f')](_0x19153f)){this[_0x7c9b('0xc')]['setVariable'](util['format'](_0x7c9b('0xc0'),_0x19153f['toUpperCase']()),_0xd6ec1[_0x19153f]);}}this[_0x7c9b('0x3b')](_0xd6ec1[_0x7c9b('0xc1')],_0x7c9b('0xc2'));return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0xc3'),_0xd6ec1[_0x7c9b('0xc1')]));}return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x495bd0,_0x7c9b('0xc4'));};AGIVertices[_0x7c9b('0x12')]['sesteknda']=function(_0xfd9c9c){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0xc5'),_0xfd9c9c[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0xfd9c9c[_0x7c9b('0xc6')])){return this['channel']['noop'](_0x7c9b('0xc7'));}if(!this[_0x7c9b('0x5e')](_0xfd9c9c['username'])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0xc8'));}if(!this[_0x7c9b('0x5e')](_0xfd9c9c[_0x7c9b('0xc9')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0xca'));}if(!this[_0x7c9b('0x5e')](_0xfd9c9c['ndassistant_url'])){return this['channel'][_0x7c9b('0x86')]('no\x20text\x20configured');}this[_0x7c9b('0xc')][_0x7c9b('0xcb')]=!![];this[_0x7c9b('0x33')](_0xfd9c9c);this['createSquareMessage'](_0xfd9c9c[_0x7c9b('0x54')],'in');this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')]('Trying\x20SestekNDA:\x20%s',_0xfd9c9c['text']));var _0x1a7ad4=this['sestekNDA'][_0x7c9b('0x85')](this,_0xfd9c9c);if(_0x1a7ad4){for(var _0x2a693a in _0x1a7ad4){if(_0x1a7ad4[_0x7c9b('0x6f')](_0x2a693a)){this[_0x7c9b('0xc')][_0x7c9b('0xb1')](util[_0x7c9b('0x26')](_0x7c9b('0xcc'),_0x2a693a['toUpperCase']()),_0x1a7ad4[_0x2a693a]);}}this[_0x7c9b('0x3b')](_0x1a7ad4['speech'],_0x7c9b('0xc2'));if(_0x1a7ad4[_0x7c9b('0xcd')]){this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0xce'),_0x1a7ad4['audiofile']));var _0x20fb46=this[_0x7c9b('0xc')][_0x7c9b('0xcf')](_0x1a7ad4['audiofile']);try{fs['unlink'](_0x1a7ad4[_0x7c9b('0xcd')]+_0x7c9b('0xd0'));}catch(_0x3214ba){logger[_0x7c9b('0x28')](_0x3214ba);}return _0x20fb46;}else{return this['channel'][_0x7c9b('0x86')](util[_0x7c9b('0x26')]('SestekNDA\x20Result\x20%s',_0x1a7ad4[_0x7c9b('0xc1')]));}}return this[_0x7c9b('0xc')]['error'](_0xfd9c9c,_0x7c9b('0xd1'));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0xd2')]=function(_0x55ba1c){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0xd3'),_0x55ba1c[_0x7c9b('0x34')]));return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0xd2'));};AGIVertices['prototype'][_0x7c9b('0xd4')]=function(_0xfb10b9){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xfb10b9[_0x7c9b('0x34')]));var _0x3d2c79='';if(_0xfb10b9['trunk_id']){if(!this[_0x7c9b('0x5e')](_0xfb10b9[_0x7c9b('0xd5')])){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0xfb10b9,_0x7c9b('0xd6'));}else{var _0x439330=parseInt(_0xfb10b9[_0x7c9b('0xd5')],0xa);if(isNaN(_0x439330)){_0x3d2c79=_0xfb10b9['trunk_id'];}else{_0x3d2c79=this['getTrunk'][_0x7c9b('0x85')](this,_0xfb10b9['trunk_id']);if(!_0x3d2c79){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0xfb10b9,'no\x20trunk\x20found');}}}}else if(_0xfb10b9[_0x7c9b('0xd7')]){_0x3d2c79=_0xfb10b9[_0x7c9b('0xd7')];}else{return this['channel']['error'](_0xfb10b9,_0x7c9b('0xd6'));}var _0x2f4438=this[_0x7c9b('0xc')][_0x7c9b('0x51')]('DIAL',[util['format']('SIP/%s/%s',_0x3d2c79,_0xfb10b9[_0x7c9b('0x88')]),_0xfb10b9[_0x7c9b('0x7e')],_0xfb10b9['opts'],_0xfb10b9[_0x7c9b('0xba')]]);if(_0x2f4438[_0x7c9b('0x76')]===-0x1){return _0x2f4438;}return this['channel'][_0x7c9b('0x86')](util[_0x7c9b('0x26')]('Executed\x20command\x20%s',_0x7c9b('0xb8')));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0xd8')]=function(_0x149a33){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x149a33[_0x7c9b('0x34')]));return this[_0x7c9b('0xc')]['noop'](_0x7c9b('0xd8'));};AGIVertices['prototype'][_0x7c9b('0xa')]=function(_0xda0466){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0xd9'),_0xda0466[_0x7c9b('0x34')]));if(_0xda0466[_0x7c9b('0x7a')]===0x0){return this[_0x7c9b('0x79')](_0xda0466);}_0xda0466[_0x7c9b('0x7a')]-=0x1;if(!this[_0x7c9b('0x5e')](_0xda0466[_0x7c9b('0xda')])){return this[_0x7c9b('0xc')]['error'](_0xda0466,_0x7c9b('0xdb'));}var _0x965eb1=this[_0x7c9b('0xdc')]['sync'](this,_0xda0466[_0x7c9b('0xda')]);if(!_0x965eb1){return this['channel'][_0x7c9b('0x28')](_0xda0466,_0x7c9b('0xdd'));}if(!this[_0x7c9b('0x5e')](_0xda0466['variable_id'])){return this['channel'][_0x7c9b('0x28')](_0x7c9b('0xde'));}var _0x8947f7=this[_0x7c9b('0xc')][_0x7c9b('0xdf')](_0x965eb1,_0xda0466['response'],_0xda0466[_0x7c9b('0xe0')]);var _0x4c5a63=_0x8947f7[_0x7c9b('0x76')]?_0x8947f7[_0x7c9b('0x76')][_0x7c9b('0x47')]():'';logger[_0x7c9b('0x2a')]('test',JSON['stringify'](_0x8947f7));if(_0x8947f7['result']===-0x1){this[_0x7c9b('0x33')][_0x7c9b('0x85')](this,_0xda0466,_0x4c5a63);return _0x8947f7;}else if(_0x8947f7[_0x7c9b('0x78')]===_0x7c9b('0x7e')){_0x8947f7[_0x7c9b('0x76')]=_0x4c5a63['length']>=parseInt(_0xda0466[_0x7c9b('0xe1')])?'x':'i';}else{_0x8947f7['result']=_0x4c5a63[_0x7c9b('0x73')]>=parseInt(_0xda0466[_0x7c9b('0xe1')])&&_0x4c5a63[_0x7c9b('0x73')]<=parseInt(_0xda0466[_0x7c9b('0xe0')])?'x':'i';}var _0x39dcf0=this[_0x7c9b('0xf')][_0x7c9b('0x85')](this,_0xda0466[_0x7c9b('0xad')]);if(!_0x39dcf0){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0xda0466,_0x7c9b('0xae'));}this[_0x7c9b('0xc')][_0x7c9b('0xb1')](_0x39dcf0,_0x4c5a63);if(this['isConfigured'](_0xda0466[_0x7c9b('0xe2')])){var _0x333b65=parseInt(_0xda0466[_0x7c9b('0xe2')],0xa);var _0x287d08=rs['generate']({'charset':'*','length':_0x333b65});var _0x43b269=_0x4c5a63[_0x7c9b('0x73')];if(_0x43b269>0x0){if(_0x43b269>_0x333b65){this[_0x7c9b('0x33')][_0x7c9b('0x85')](this,_0xda0466,_0xda0466[_0x7c9b('0xe3')]==='first'?_0x287d08+_0x4c5a63['substr'](_0x333b65):_0x4c5a63['substr'](0x0,_0x43b269-_0x333b65)+_0x287d08);}else{this['createSquareDetailsReport'][_0x7c9b('0x85')](this,_0xda0466,rs['generate']({'charset':'*','length':_0x43b269}));}}else{this[_0x7c9b('0x33')][_0x7c9b('0x85')](this,_0xda0466,'');}}else{this[_0x7c9b('0x33')][_0x7c9b('0x85')](this,_0xda0466,_0x4c5a63);}return _0x8947f7;};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0xb')]=function(_0x381b72){logger['info'](util[_0x7c9b('0x26')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x381b72[_0x7c9b('0x34')]));return this[_0x7c9b('0xa')](_0x381b72);};AGIVertices[_0x7c9b('0x12')]['goal']=function(_0x4bf298){logger['info'](util['format'](_0x7c9b('0xe4'),_0x4bf298[_0x7c9b('0x34')]));this[_0x7c9b('0x33')][_0x7c9b('0x85')](this,_0x4bf298,_0x4bf298['goalname']);return this['channel']['noop'](util['format'](_0x7c9b('0xe5'),_0x4bf298[_0x7c9b('0xe6')]));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0xe7')]=function(_0x1dc2c8){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x1dc2c8[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x1dc2c8['aws_access_key_id'])||!this['isConfigured'](_0x1dc2c8[_0x7c9b('0xe8')])){return this['channel']['noop'](_0x7c9b('0xe9'));}if(!this[_0x7c9b('0x5e')](_0x1dc2c8['text'])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')]('no\x20text\x20configured');}this['channel'][_0x7c9b('0x86')](util[_0x7c9b('0x26')]('Trying\x20aws\x20Polly\x20%s',_0x1dc2c8['text']));var _0x166d9e=this[_0x7c9b('0x60')][_0x7c9b('0x85')](this,_0x1dc2c8);if(_0x166d9e){this[_0x7c9b('0xc')][_0x7c9b('0x86')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x166d9e));var _0x2c82d3=this[_0x7c9b('0xc')][_0x7c9b('0xcf')](_0x166d9e);try{fs['unlink'](_0x166d9e+_0x7c9b('0xd0'));}catch(_0x14accb){logger['error'](_0x14accb);}return _0x2c82d3;}return this['channel'][_0x7c9b('0x28')](_0x1dc2c8,_0x7c9b('0xea'));};AGIVertices[_0x7c9b('0x12')]['awslex']=function(_0x4d90a3){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0xeb'),_0x4d90a3[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x4d90a3[_0x7c9b('0x61')])||!this['isConfigured'](_0x4d90a3[_0x7c9b('0xe8')])){return this['channel'][_0x7c9b('0x86')](_0x7c9b('0xe9'));}if(!this['isConfigured'](_0x4d90a3['aws_bot_name'])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0xec'));}if(!this['isConfigured'](_0x4d90a3[_0x7c9b('0x54')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')]('no\x20text\x20configured');}this[_0x7c9b('0xc')][_0x7c9b('0xcb')]=!![];this[_0x7c9b('0x33')](_0x4d90a3);this[_0x7c9b('0x3b')](_0x4d90a3['text'],'in');this[_0x7c9b('0xc')]['noop'](util[_0x7c9b('0x26')](_0x7c9b('0xed'),_0x4d90a3[_0x7c9b('0x54')]));var _0x4bd3cc=this[_0x7c9b('0x65')][_0x7c9b('0x85')](this,_0x4d90a3);if(_0x4bd3cc){for(var _0x4605cb in _0x4bd3cc){if(_0x4bd3cc['hasOwnProperty'](_0x4605cb)&&_[_0x7c9b('0x70')](_0x4bd3cc[_0x4605cb])){this['channel'][_0x7c9b('0xb1')](util['format']('AWS_LEX_%s',_0x4605cb[_0x7c9b('0xee')]()),_0x4bd3cc[_0x4605cb]);}}if(_[_0x7c9b('0x3e')](_0x4bd3cc['message'])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0xef'));}else{this[_0x7c9b('0x3b')](_0x4bd3cc['message'],_0x7c9b('0xc2'));return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x4bd3cc[_0x7c9b('0xf0')]));}}return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x4d90a3,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0x7c9b('0xf1')]=function(_0x4aa5cf){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0xf2'),_0x4aa5cf[_0x7c9b('0x34')],_0x4aa5cf[_0x7c9b('0x7e')]));if(!this[_0x7c9b('0x5e')](_0x4aa5cf[_0x7c9b('0x56')])){return this[_0x7c9b('0xc')]['noop'](_0x7c9b('0xbe'));}var _0x4f77b3=_0x7c9b('0xf3');var _0x57f59c=util['format'](_0x7c9b('0xf4'),FILES_PATH,rs[_0x7c9b('0xf5')](0x4));var _0x25fbb7=util['format'](_0x7c9b('0xf6'),_0x57f59c,_0x4f77b3);var _0x41365b=!![];if(_0x4aa5cf[_0x7c9b('0xf7')]===_0x7c9b('0xf8')){_0x41365b=![];}var _0x2fc661=this[_0x7c9b('0xc')][_0x7c9b('0xf9')](_0x57f59c,_0x4f77b3,_0x4aa5cf[_0x7c9b('0xfa')],_0x4aa5cf['timeout'],undefined,_0x41365b);if(_0x2fc661[_0x7c9b('0x76')]!==-0x1){this['channel'][_0x7c9b('0x86')](util['format'](_0x7c9b('0xfb'),_0x25fbb7));var _0x396e79=this[_0x7c9b('0x68')][_0x7c9b('0x85')](this,_0x4aa5cf,_0x25fbb7);if(_0x396e79){for(var _0x3d8e6d in _0x396e79){if(_0x396e79[_0x7c9b('0x6f')](_0x3d8e6d)){this[_0x7c9b('0xc')][_0x7c9b('0xb1')](util[_0x7c9b('0x26')](_0x7c9b('0xfc'),_0x3d8e6d[_0x7c9b('0xee')]()),_0x396e79[_0x3d8e6d]);}}return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0xfd'),JSON[_0x7c9b('0xfe')](_0x396e79)));}}return _0x2fc661;};AGIVertices[_0x7c9b('0x12')]['tildeasr']=function(_0x5c33f0){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0xff'),_0x5c33f0[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x5c33f0[_0x7c9b('0x100')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')]('no\x20appid\x20configured');}if(!this[_0x7c9b('0x5e')](_0x5c33f0[_0x7c9b('0x6a')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')]('no\x20appsecret\x20configured');}var _0x548fda=_0x7c9b('0xf3');var _0x4349f2=util[_0x7c9b('0x26')](_0x7c9b('0xf4'),FILES_PATH,rs[_0x7c9b('0xf5')](0x4));var _0xd5ef9b=util[_0x7c9b('0x26')]('%s.%s',_0x4349f2,_0x548fda);var _0x37674b=!![];if(_0x5c33f0['beep']===_0x7c9b('0xf8')){_0x37674b=![];}var _0x3a9591=this[_0x7c9b('0xc')]['recordFile'](_0x4349f2,_0x548fda,_0x5c33f0[_0x7c9b('0xfa')],_0x5c33f0[_0x7c9b('0x7e')],undefined,_0x37674b);if(_0x3a9591[_0x7c9b('0x76')]!==-0x1){this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x101'),_0xd5ef9b));var _0x3adeec=this[_0x7c9b('0x69')][_0x7c9b('0x85')](this,_0x5c33f0,_0xd5ef9b);if(_0x3adeec){for(var _0x2fc7cd in _0x3adeec){if(_0x3adeec[_0x7c9b('0x6f')](_0x2fc7cd)){this['channel'][_0x7c9b('0xb1')](util[_0x7c9b('0x26')](_0x7c9b('0x102'),_0x2fc7cd['toUpperCase']()),_0x3adeec[_0x2fc7cd]);}}return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x103'),JSON[_0x7c9b('0xfe')](_0x3adeec)));}}return _0x3a9591;};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x104')]=function(_0x2f595b){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0x105'),_0x2f595b[_0x7c9b('0x34')]));return this['channel']['continueAt'](_0x2f595b[_0x7c9b('0x106')],_0x2f595b['extension'],_0x2f595b['priority']);};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x107')]=function(_0x1d83e6){logger[_0x7c9b('0x2a')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x1d83e6['label']));if(!this['isConfigured'](_0x1d83e6[_0x7c9b('0x108')])){return this['channel'][_0x7c9b('0x28')](_0x1d83e6,_0x7c9b('0x109'));}try{var _0x30a582=eval(_0x1d83e6[_0x7c9b('0x108')])?_0x7c9b('0x10a'):_0x7c9b('0x10b');this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x10c'),_0x1d83e6[_0x7c9b('0x108')],_0x30a582));return{'code':0xc8,'result':_0x30a582};}catch(_0x57034a){return{'code':0xc8,'result':_0x7c9b('0x10b')};}};AGIVertices['prototype'][_0x7c9b('0x10d')]=function(_0x3b158f){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x10e'),_0x3b158f[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x3b158f[_0x7c9b('0x10f')])){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x3b158f,_0x7c9b('0x110'));}var _0x5a9ef0=this[_0x7c9b('0x111')][_0x7c9b('0x85')](this,_0x3b158f[_0x7c9b('0x10f')]);if(!_0x5a9ef0){return this['channel'][_0x7c9b('0x28')](_0x3b158f,'no\x20intervals\x20found');}for(var _0x22aed3=0x0;_0x22aed3<_0x5a9ef0[_0x7c9b('0x73')];_0x22aed3+=0x1){var _0xfb29e2=this['channel'][_0x7c9b('0xf')](util[_0x7c9b('0x26')](_0x7c9b('0x112'),_0x5a9ef0[_0x22aed3]));if(_0xfb29e2[_0x7c9b('0x76')]===-0x1){return _0xfb29e2;}logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('IFTIME\x20%s\x20%s',_0x5a9ef0[_0x22aed3],_0xfb29e2[_0x7c9b('0x78')]));if(_0xfb29e2[_0x7c9b('0x78')]==='true'){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x113'),_0x5a9ef0[_0x22aed3],'true'));this['channel']['noop'](util[_0x7c9b('0x26')]('IFTIME\x20%s\x20%s',_0x5a9ef0[_0x22aed3],'true'));return{'code':0xc8,'result':_0x7c9b('0x10a')};}else{logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x113'),_0x5a9ef0[_0x22aed3],_0x7c9b('0x10b')));this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')]('IFTIME\x20%s\x20%s',_0x5a9ef0[_0x22aed3],'false'));}}return{'code':0xc8,'result':_0x7c9b('0x10b')};};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x114')]=function(_0x3041e7){logger[_0x7c9b('0x2a')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3041e7[_0x7c9b('0x34')]));return this[_0x7c9b('0xc')][_0x7c9b('0x114')]();};AGIVertices['prototype'][_0x7c9b('0x115')]=function(_0x3d9b8b){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x116'),_0x3d9b8b[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x3d9b8b['key'])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0xbe'));}var _0x8cbdaa=_0x7c9b('0xf3');var _0x235804=util[_0x7c9b('0x26')](_0x7c9b('0xf4'),FILES_PATH,rs[_0x7c9b('0xf5')](0x4));var _0x4f5e2d=util['format'](_0x7c9b('0xf6'),_0x235804,_0x8cbdaa);var _0x4c0afb=!![];if(_0x3d9b8b[_0x7c9b('0xf7')]===_0x7c9b('0xf8')){_0x4c0afb=![];}var _0x15355d=this[_0x7c9b('0xc')][_0x7c9b('0xf9')](_0x235804,_0x8cbdaa,_0x3d9b8b[_0x7c9b('0xfa')],_0x3d9b8b[_0x7c9b('0x7e')],undefined,_0x4c0afb);if(_0x15355d[_0x7c9b('0x76')]!==-0x1){this['channel'][_0x7c9b('0x86')](util[_0x7c9b('0x26')]('ispeech\x20%s\x20file\x20created',_0x4f5e2d));var _0x3cdf0a=this[_0x7c9b('0x5c')][_0x7c9b('0x85')](this,_0x3d9b8b,_0x4f5e2d);if(_0x3cdf0a){for(var _0x187daf in _0x3cdf0a){if(_0x3cdf0a['hasOwnProperty'](_0x187daf)){this[_0x7c9b('0xc')]['setVariable'](util[_0x7c9b('0x26')](_0x7c9b('0x117'),_0x187daf[_0x7c9b('0xee')]()),_0x3cdf0a[_0x187daf]);}}return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x118'),JSON['stringify'](_0x3cdf0a)));}}return _0x15355d;};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x119')]=function(_0x23c6ca){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x23c6ca[_0x7c9b('0x34')]));if(!this['isConfigured'](_0x23c6ca[_0x7c9b('0x56')])){return this['channel'][_0x7c9b('0x86')](_0x7c9b('0xbe'));}if(!this['isConfigured'](_0x23c6ca[_0x7c9b('0x54')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0x8f'));}this[_0x7c9b('0xc')]['noop'](util[_0x7c9b('0x26')](_0x7c9b('0x11a'),_0x23c6ca[_0x7c9b('0x54')]));var _0x1c9838=this['ispeechTTS']['sync'](this,_0x23c6ca);if(_0x1c9838){this['channel']['noop'](util[_0x7c9b('0x26')](_0x7c9b('0x11b'),_0x1c9838));var _0x4a5b3d=this[_0x7c9b('0xc')][_0x7c9b('0xcf')](_0x1c9838,_0x23c6ca[_0x7c9b('0xfa')]);try{fs['unlink'](_0x1c9838+_0x7c9b('0xd0'));}catch(_0x4a3601){logger[_0x7c9b('0x28')](_0x4a3601);}return _0x4a5b3d;}return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x23c6ca,_0x7c9b('0x11c'));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x11d')]=function(_0x1c75bc){logger['info'](util[_0x7c9b('0x26')](_0x7c9b('0x11e'),_0x1c75bc[_0x7c9b('0x34')]));if(!this['isConfigured'](_0x1c75bc[_0x7c9b('0x11f')])){return this[_0x7c9b('0xc')]['error'](_0x1c75bc,_0x7c9b('0x120'));}logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0x121'),this[_0x7c9b('0xc')][_0x7c9b('0x35')],_0x1c75bc[_0x7c9b('0x11f')]));var _0x2d5334=this[_0x7c9b('0x50')][_0x7c9b('0x85')](this,_0x1c75bc[_0x7c9b('0x11f')]);if(_0x2d5334){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x122'),this['channel'][_0x7c9b('0x35')],_0x1c75bc[_0x7c9b('0x11f')]));this[_0x7c9b('0xc')]['noop'](util[_0x7c9b('0x26')](_0x7c9b('0x122'),this[_0x7c9b('0xc')][_0x7c9b('0x35')],_0x1c75bc[_0x7c9b('0x11f')]));return{'code':0xc8,'result':_0x7c9b('0x123')};}else{logger['info'](util[_0x7c9b('0x26')](_0x7c9b('0x124'),this[_0x7c9b('0xc')][_0x7c9b('0x35')],_0x1c75bc[_0x7c9b('0x11f')]));this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x124'),this[_0x7c9b('0xc')][_0x7c9b('0x35')],_0x1c75bc[_0x7c9b('0x11f')]));return{'code':0xc8,'result':_0x7c9b('0x125')};}};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x126')]=function(_0x21e15f){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0x127'),_0x21e15f[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x21e15f[_0x7c9b('0x11f')])){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x21e15f,_0x7c9b('0x120'));}logger[_0x7c9b('0x2a')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7c9b('0xc')]['callerid'],_0x21e15f[_0x7c9b('0x11f')]));var _0x4f8bc0=this[_0x7c9b('0x4d')][_0x7c9b('0x85')](this,_0x21e15f['findBy']);if(_0x4f8bc0){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0x122'),this['channel'][_0x7c9b('0x35')],_0x21e15f[_0x7c9b('0x11f')]));this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7c9b('0xc')][_0x7c9b('0x35')],_0x21e15f[_0x7c9b('0x11f')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x7c9b('0x124'),this[_0x7c9b('0xc')]['callerid'],_0x21e15f['findBy']));this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x124'),this['channel']['callerid'],_0x21e15f[_0x7c9b('0x11f')]));return{'code':0xc8,'result':_0x7c9b('0x125')};}};AGIVertices['prototype'][_0x7c9b('0x128')]=function(_0x5720b4){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0x129'),_0x5720b4[_0x7c9b('0x34')]));if(!this['isConfigured'](_0x5720b4[_0x7c9b('0x12a')])){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x5720b4,_0x7c9b('0x12b'));}this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x12c'),_0x5720b4[_0x7c9b('0x12a')]));var _0xac8253=eval(_0x5720b4['operation']);if(!this['isConfigured'](_0x5720b4['variable_id'])){return this[_0x7c9b('0xc')]['noop'](_0x7c9b('0xde'));}var _0x16802b=this['getVariable'][_0x7c9b('0x85')](this,_0x5720b4[_0x7c9b('0xad')]);if(!_0x16802b){return this['channel']['error'](_0x5720b4,_0x7c9b('0xae'));}if(_[_0x7c9b('0x12d')](_0xac8253)){var _0x27a45f=this;_0xac8253['forEach'](function(_0x5c1486,_0x32b3a8){_0x27a45f[_0x7c9b('0xc')][_0x7c9b('0xb1')](util[_0x7c9b('0x26')](_0x7c9b('0x12e'),_0x16802b,_0x32b3a8),_0x5c1486);});return this['channel']['noop'](util[_0x7c9b('0x26')](_0x7c9b('0x12f'),_0x16802b));}else{return this['channel'][_0x7c9b('0xb1')](_0x16802b,_0xac8253);}};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x9')]=function(_0x5362ae){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x130'),_0x5362ae[_0x7c9b('0x34')]));if(_0x5362ae['retry']===0x0){return this['maxRetry'](_0x5362ae);}_0x5362ae[_0x7c9b('0x7a')]-=0x1;if(!this[_0x7c9b('0x5e')](_0x5362ae['file_id'])){return this[_0x7c9b('0xc')]['error'](_0x5362ae,_0x7c9b('0xdb'));}var _0x441ec3=this['getSound'][_0x7c9b('0x85')](this,_0x5362ae[_0x7c9b('0xda')]);if(!_0x441ec3){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x5362ae,_0x7c9b('0xdd'));}var _0x55160d=this[_0x7c9b('0xc')][_0x7c9b('0xdf')](_0x441ec3,_0x5362ae[_0x7c9b('0x131')],_0x5362ae[_0x7c9b('0x132')]);var _0xab3332=_0x55160d[_0x7c9b('0x76')];if(_0x55160d[_0x7c9b('0x76')]===-0x1){this['createSquareDetailsReport'][_0x7c9b('0x85')](this,_0x5362ae,'-1');return _0x55160d;}else if(_0x55160d[_0x7c9b('0x78')]===_0x7c9b('0x7e')){_0x55160d[_0x7c9b('0x76')]=_0x55160d[_0x7c9b('0x76')][_0x7c9b('0x73')]>0x0?_0x55160d[_0x7c9b('0x76')]:'t';}else if(_[_0x7c9b('0x3d')](_0x55160d[_0x7c9b('0x76')])){_0x55160d[_0x7c9b('0x76')]='#';_0xab3332='#';}if(!this['isConfigured'](_0x5362ae['variable_id'])){this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0xde'));}else{var _0x3f23b6=this[_0x7c9b('0xf')][_0x7c9b('0x85')](this,_0x5362ae['variable_id']);if(!_0x3f23b6){return this[_0x7c9b('0xc')]['error'](_0x5362ae,'no\x20variable\x20found');}this['channel'][_0x7c9b('0xb1')](_0x3f23b6,_0xab3332);}this[_0x7c9b('0x33')][_0x7c9b('0x85')](this,_0x5362ae,_0xab3332);return _0x55160d;};AGIVertices['prototype'][_0x7c9b('0x86')]=function(_0x428c74){logger['info'](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x428c74['label']));return this[_0x7c9b('0xc')]['noop'](_0x428c74[_0x7c9b('0x133')]||_0x428c74[_0x7c9b('0x34')]);};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x134')]=function(_0x418a4e){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x418a4e[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x418a4e['findBy'])){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x418a4e,_0x7c9b('0x120'));}logger['info'](util[_0x7c9b('0x26')](_0x7c9b('0x121'),this[_0x7c9b('0xc')]['callerid'],_0x418a4e[_0x7c9b('0x11f')]));var _0x146662=this[_0x7c9b('0x49')][_0x7c9b('0x85')](this,_0x418a4e[_0x7c9b('0x135')]);var _0x40abc7=this[_0x7c9b('0x4a')]['sync'](this,_0x418a4e['findBy'],_0x146662);if(_0x40abc7){logger['info'](util['format'](_0x7c9b('0x122'),this['channel']['callerid'],_0x418a4e[_0x7c9b('0x11f')]));this[_0x7c9b('0xc')][_0x7c9b('0x86')](util['format'](_0x7c9b('0x122'),this[_0x7c9b('0xc')]['callerid'],_0x418a4e[_0x7c9b('0x11f')]));return{'code':0xc8,'result':_0x7c9b('0x123')};}else{logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x124'),this[_0x7c9b('0xc')][_0x7c9b('0x35')],_0x418a4e['findBy']));this['channel'][_0x7c9b('0x86')](util[_0x7c9b('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7c9b('0xc')][_0x7c9b('0x35')],_0x418a4e[_0x7c9b('0x11f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7c9b('0x12')]['playback']=function(_0x3760a9){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x136'),_0x3760a9[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x3760a9[_0x7c9b('0xda')])){return this['channel'][_0x7c9b('0x28')](_0x3760a9,_0x7c9b('0xdb'));}var _0x18eb95=this[_0x7c9b('0xdc')][_0x7c9b('0x85')](this,_0x3760a9[_0x7c9b('0xda')]);if(!_0x18eb95){return this['channel'][_0x7c9b('0x28')](_0x3760a9,_0x7c9b('0xdd'));}var _0x2e0e66=this[_0x7c9b('0xc')]['exec'](_0x7c9b('0x137'),[_0x18eb95,_0x3760a9[_0x7c9b('0xb9')]]);if(_0x2e0e66['result']===-0x1){return _0x2e0e66;}return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x8c'),'PLAYBACK',_0x18eb95));};AGIVertices['prototype'][_0x7c9b('0x138')]=function(_0x55557d){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x139'),_0x55557d['label']));if(!this[_0x7c9b('0x5e')](_0x55557d[_0x7c9b('0x13a')])){return this['channel'][_0x7c9b('0x28')](_0x55557d,'no\x20queue\x20selected');}var _0x395af5='';var _0xa945a0=parseInt(_0x55557d[_0x7c9b('0x13a')],0xa);if(isNaN(_0xa945a0)){_0x395af5=_0x55557d['queue_id'];}else{_0x395af5=this[_0x7c9b('0x13')][_0x7c9b('0x85')](this,_0x55557d['queue_id']);if(!_0x395af5){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x55557d,_0x7c9b('0x13b'));}}var _0x128f7b='';if(this[_0x7c9b('0x5e')](_0x55557d[_0x7c9b('0xda')])){var _0xa982d3=this[_0x7c9b('0xdc')][_0x7c9b('0x85')](this,_0x55557d[_0x7c9b('0xda')]);if(_0xa982d3){_0x128f7b=_0xa982d3;}}this[_0x7c9b('0x33')]['sync'](this,_0x55557d,_0x395af5);if(_0x55557d[_0x7c9b('0xb9')]['indexOf']('x')<0x0){_0x55557d[_0x7c9b('0xb9')]+='x';}if(_0x55557d[_0x7c9b('0xb9')][_0x7c9b('0x13c')]('X')<0x0){_0x55557d[_0x7c9b('0xb9')]+='X';}this[_0x7c9b('0xc')][_0x7c9b('0xb1')](_0x7c9b('0x13d'),_0x395af5?_0x395af5['toLowerCase']():'');var _0x56fff7=this['channel']['exec'](_0x7c9b('0x13e'),[_0x395af5,_0x55557d[_0x7c9b('0xb9')],_0x55557d['url'],_0x128f7b,_0x55557d[_0x7c9b('0x7e')],_0x55557d[_0x7c9b('0x7b')],_0x55557d[_0x7c9b('0x13f')],_0x55557d[_0x7c9b('0x140')],'',_0x55557d['position']]);if(_0x56fff7['result']===-0x1){return _0x56fff7;}return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util['format'](_0x7c9b('0x8c'),_0x7c9b('0x13e'),_0x395af5));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x141')]=function(_0x447007){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x447007['label']));var _0x6e1e28=_0x447007['recordingFormat']||_0x7c9b('0xf3');var _0x1af5ce=util[_0x7c9b('0x26')]('%s_%s',this['channel'][_0x7c9b('0x44')],rs[_0x7c9b('0xf5')](0x5));var _0x48e980=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x1af5ce,_0x6e1e28);var _0x24592e=util['format'](_0x7c9b('0xf4'),FILES_PATH,_0x1af5ce);this[_0x7c9b('0x36')]['sync'](this,_0x447007,_0x1af5ce,_0x48e980);this[_0x7c9b('0xc')][_0x7c9b('0xb1')]('RECORDING_SAVENAME',_0x1af5ce);logger['info'](_0x7c9b('0x142'),_0x24592e,_0x6e1e28,_0x447007['escape_digits'],_0x447007[_0x7c9b('0x7e')]);return this[_0x7c9b('0xc')][_0x7c9b('0xf9')](_0x24592e,_0x6e1e28,_0x447007[_0x7c9b('0x143')],_0x447007[_0x7c9b('0x7e')],undefined,!![]);};AGIVertices['prototype'][_0x7c9b('0x144')]=function(_0x49718e){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x145'),_0x49718e[_0x7c9b('0x34')]));return this[_0x7c9b('0xc')][_0x7c9b('0x146')](_0x49718e[_0x7c9b('0x147')][_0x7c9b('0x52')](/\s+/g,''),_0x49718e['escape_digits']);};AGIVertices['prototype'][_0x7c9b('0x148')]=function(_0x4ce2d4){logger['info'](util['format'](_0x7c9b('0x149'),_0x4ce2d4['label']));return this[_0x7c9b('0xc')]['sayNumber'](_0x4ce2d4['number'][_0x7c9b('0x52')](/\s+/g,''),_0x4ce2d4[_0x7c9b('0x143')]);};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x14a')]=function(_0xa99516){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x14b'),_0xa99516[_0x7c9b('0x34')]));return this[_0x7c9b('0xc')]['sayPhonetic'](_0xa99516[_0x7c9b('0x54')],_0xa99516[_0x7c9b('0x143')]);};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x14c')]=function(_0x5c61b4){logger['info'](util[_0x7c9b('0x26')](_0x7c9b('0x14d'),_0x5c61b4[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x5c61b4['account_id'])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')]('no\x20mail\x20account\x20configured');}var _0x137d0c=this['getMailAccount']['sync'](this,_0x5c61b4[_0x7c9b('0x14e')]);if(!_0x137d0c||!_0x137d0c[_0x7c9b('0x14f')]){return this['channel'][_0x7c9b('0x28')](_0x5c61b4,_0x7c9b('0x150'));}var _0x264218={'from':util[_0x7c9b('0x26')](_0x7c9b('0x151'),_0x137d0c[_0x7c9b('0x10')],_0x137d0c[_0x7c9b('0x152')]||_0x137d0c[_0x7c9b('0x14f')][_0x7c9b('0x153')]),'to':_0x5c61b4['to']||'','cc':_0x5c61b4['cc']||'','bcc':_0x5c61b4[_0x7c9b('0x154')]||'','subject':_0x5c61b4[_0x7c9b('0x155')],'html':_0x5c61b4[_0x7c9b('0x54')],'text':_0x5c61b4[_0x7c9b('0x54')]};var _0xb5c663={'tls':{'rejectUnauthorized':![]}};if(_0x137d0c[_0x7c9b('0x14f')]['service']){_0xb5c663[_0x7c9b('0x156')]=_0x137d0c[_0x7c9b('0x14f')][_0x7c9b('0x156')];}else{_0xb5c663[_0x7c9b('0x157')]=_0x137d0c[_0x7c9b('0x14f')][_0x7c9b('0x157')];_0xb5c663[_0x7c9b('0x158')]=_0x137d0c['Smtp'][_0x7c9b('0x158')];_0xb5c663['secure']=_0x137d0c[_0x7c9b('0x14f')][_0x7c9b('0x159')];}if(_0x137d0c[_0x7c9b('0x14f')][_0x7c9b('0x15a')]){_0xb5c663[_0x7c9b('0x15b')]={'user':_0x137d0c[_0x7c9b('0x14f')][_0x7c9b('0x153')],'pass':_0x137d0c[_0x7c9b('0x14f')][_0x7c9b('0x15c')]};}if(this[_0x7c9b('0x5e')](_0x5c61b4[_0x7c9b('0x15d')])){}logger['debug'](_0x7c9b('0x15e'),JSON[_0x7c9b('0xfe')](_0x264218));this[_0x7c9b('0x33')][_0x7c9b('0x85')](this,_0x5c61b4,_0x5c61b4[_0x7c9b('0x14e')]);this[_0x7c9b('0xc')][_0x7c9b('0x86')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x137d0c[_0x7c9b('0x10')]));this['sendMailMessage'][_0x7c9b('0x85')](this,_0xb5c663,_0x264218);return this[_0x7c9b('0xc')][_0x7c9b('0x86')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x15f')]=function(_0xa02b79){logger[_0x7c9b('0x2a')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xa02b79[_0x7c9b('0x34')]));return this[_0x7c9b('0xc')][_0x7c9b('0x86')](_0x7c9b('0x160'));};AGIVertices['prototype']['sendSMS']=function(_0x21b46c){logger['info'](util['format'](_0x7c9b('0x161'),_0x21b46c[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x21b46c[_0x7c9b('0x162')])){return this[_0x7c9b('0xc')][_0x7c9b('0x86')]('no\x20sms\x20account\x20configured');}var _0x5f3e98=this[_0x7c9b('0x30')][_0x7c9b('0x85')](this,_0x21b46c['sms_account_id']);if(!_0x5f3e98){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x21b46c,_0x7c9b('0x163'));}var _0x1ffdbc={'body':_0x21b46c[_0x7c9b('0x164')],'phone':_0x21b46c['to']||'','SmsAccountId':_0x5f3e98['id']};logger[_0x7c9b('0x165')](_0x7c9b('0x166'),JSON[_0x7c9b('0xfe')](_0x1ffdbc));this[_0x7c9b('0x33')][_0x7c9b('0x85')](this,_0x21b46c,_0x21b46c[_0x7c9b('0x162')]);this[_0x7c9b('0xc')]['noop'](util[_0x7c9b('0x26')](_0x7c9b('0x167'),_0x5f3e98[_0x7c9b('0x10')]));this['createSmsMessage'][_0x7c9b('0x85')](this,_0x1ffdbc);return this[_0x7c9b('0xc')]['noop'](_0x7c9b('0x168'));};AGIVertices['prototype'][_0x7c9b('0x169')]=function(_0xae3435){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('Enter\x20in\x20SET\x20(%s)\x20block',_0xae3435[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0xae3435['variable_id'])){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0xae3435,_0x7c9b('0x16a'));}var _0x30dc19=this[_0x7c9b('0xf')][_0x7c9b('0x85')](this,_0xae3435['variable_id']);if(!_0x30dc19){return this['channel'][_0x7c9b('0x28')](_0xae3435,_0x7c9b('0xae'));}return this[_0x7c9b('0xc')][_0x7c9b('0xb1')](_0x30dc19,_0xae3435[_0x7c9b('0x16b')]);};AGIVertices['prototype'][_0x7c9b('0x16c')]=function(_0x238b54){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')]('Enter\x20in\x20START\x20(%s)\x20block',_0x238b54['label']));this['channel']['noop'](_0x7c9b('0x16d'));if(_0x238b54[_0x7c9b('0x7d')]===_0x7c9b('0x16e')){this['channel']['noop'](_0x7c9b('0x16f'));return this[_0x7c9b('0xc')][_0x7c9b('0x7d')]();}return this[_0x7c9b('0xc')][_0x7c9b('0x86')]('Skipped\x20Answer');};AGIVertices['prototype'][_0x7c9b('0x170')]=function(_0x1fe79e){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0x171'),_0x1fe79e[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x1fe79e[_0x7c9b('0x172')])){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x1fe79e,_0x7c9b('0x173'));}var _0x59c9ca=this[_0x7c9b('0x15')]['sync'](this,_0x1fe79e['project_id']);if(!this[_0x7c9b('0x5e')](_0x59c9ca)){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x1fe79e,util[_0x7c9b('0x26')](_0x7c9b('0x174'),_0x1fe79e[_0x7c9b('0x172')]));}if(_0x59c9ca===this['channel'][_0x7c9b('0x39')]){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x1fe79e,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x7c9b('0x33')][_0x7c9b('0x85')](this,_0x1fe79e,_0x59c9ca);var _0x13a5ea=this[_0x7c9b('0xc')][_0x7c9b('0x51')](_0x7c9b('0x175'),util[_0x7c9b('0x26')](_0x7c9b('0x176'),config[_0x7c9b('0x7b')][_0x7c9b('0x157')]||_0x7c9b('0x177'),_0x59c9ca,this[_0x7c9b('0xc')][_0x7c9b('0x39')]));if(_0x13a5ea[_0x7c9b('0x76')]===-0x1){return _0x13a5ea;}return this['channel'][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x8c'),_0x7c9b('0x175'),_0x59c9ca));};AGIVertices['prototype'][_0x7c9b('0x178')]=function(_0x2cf8ef){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0x179'),_0x2cf8ef['label']));var _0x5becaa=this[_0x7c9b('0x17a')]['sync'](this,_0x2cf8ef['command']);this[_0x7c9b('0x33')][_0x7c9b('0x85')](this,_0x2cf8ef,_0x2cf8ef[_0x7c9b('0x7c')]);if(this[_0x7c9b('0x5e')](_0x2cf8ef[_0x7c9b('0xad')])){var _0x8458e2=this[_0x7c9b('0xf')][_0x7c9b('0x85')](this,_0x2cf8ef[_0x7c9b('0xad')]);if(_0x8458e2){this['channel'][_0x7c9b('0xb1')](_0x8458e2,_0x5becaa);return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x17b'),_0x2cf8ef[_0x7c9b('0x7c')],_0x8458e2));}}return this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')](_0x7c9b('0x17c'),_0x2cf8ef['command']));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x17d')]=function(_0x22bc91){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x17e'),_0x22bc91[_0x7c9b('0x34')]));if(!this['isConfigured'](_0x22bc91[_0x7c9b('0x54')])){return this[_0x7c9b('0xc')]['noop']('no\x20text\x20configured');}this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')]('Trying\x20Google\x20TTS\x20%s',_0x22bc91[_0x7c9b('0x54')]));var _0x17e84e=this[_0x7c9b('0x53')][_0x7c9b('0x85')](this,_0x22bc91);if(_0x17e84e){this[_0x7c9b('0xc')]['noop'](util[_0x7c9b('0x26')]('Google\x20TTS\x20%s\x20file\x20created',_0x17e84e));var _0xeaedd3=this[_0x7c9b('0xc')][_0x7c9b('0xcf')](_0x17e84e);try{fs[_0x7c9b('0x17f')](_0x17e84e+_0x7c9b('0xd0'));}catch(_0x3e800a){logger[_0x7c9b('0x28')](_0x3e800a);}return _0xeaedd3;}return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x22bc91,_0x7c9b('0x180'));};AGIVertices['prototype'][_0x7c9b('0x181')]=function(_0x17f10f){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0x182'),_0x17f10f[_0x7c9b('0x34')]));if(!this[_0x7c9b('0x5e')](_0x17f10f[_0x7c9b('0x11f')])){return this[_0x7c9b('0xc')]['error'](_0x17f10f,'no\x20find\x20by\x20configured');}logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x121'),this[_0x7c9b('0xc')]['callerid'],_0x17f10f[_0x7c9b('0x11f')]));var _0xf63c44=this['agentUnpause'][_0x7c9b('0x85')](this,_0x17f10f['findBy']);if(_0xf63c44){logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x122'),this[_0x7c9b('0xc')]['callerid'],_0x17f10f[_0x7c9b('0x11f')]));this[_0x7c9b('0xc')][_0x7c9b('0x86')](util[_0x7c9b('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7c9b('0xc')]['callerid'],_0x17f10f['findBy']));return{'code':0xc8,'result':_0x7c9b('0x123')};}else{logger[_0x7c9b('0x2a')](util[_0x7c9b('0x26')](_0x7c9b('0x124'),this[_0x7c9b('0xc')][_0x7c9b('0x35')],_0x17f10f[_0x7c9b('0x11f')]));this['channel'][_0x7c9b('0x86')](util[_0x7c9b('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x7c9b('0x35')],_0x17f10f['findBy']));return{'code':0xc8,'result':_0x7c9b('0x125')};}};AGIVertices[_0x7c9b('0x12')]['voicemail']=function(_0x1c3da3){logger[_0x7c9b('0x2a')](util['format'](_0x7c9b('0x183'),_0x1c3da3[_0x7c9b('0x34')]));var _0x26a795=this[_0x7c9b('0xc')][_0x7c9b('0x51')]('VOICEMAIL',[_0x1c3da3[_0x7c9b('0x184')],_0x1c3da3[_0x7c9b('0x8b')]]);if(_0x26a795[_0x7c9b('0x76')]===-0x1){return _0x26a795;}return this[_0x7c9b('0xc')]['noop'](util['format'](_0x7c9b('0x8c'),_0x7c9b('0x185'),_0x1c3da3['mailbox']));};AGIVertices[_0x7c9b('0x12')][_0x7c9b('0x186')]=function(_0x32bb07){logger[_0x7c9b('0x2a')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x32bb07['label']));if(!this[_0x7c9b('0x5e')](_0x32bb07[_0x7c9b('0xad')])){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x32bb07,_0x7c9b('0x16a'));}var _0x14a60f=this[_0x7c9b('0xf')]['sync'](this,_0x32bb07['variable_id']);if(!_0x14a60f){return this[_0x7c9b('0xc')][_0x7c9b('0x28')](_0x32bb07,_0x7c9b('0xae'));}var _0x5a4605=this[_0x7c9b('0xc')][_0x7c9b('0xf')](_0x14a60f);return{'code':0xc8,'result':_0x5a4605[_0x7c9b('0x78')]?_0x5a4605[_0x7c9b('0x78')]:'-'};};String[_0x7c9b('0x12')][_0x7c9b('0x74')]=function(_0xf06525,_0x5c750c){return this[_0x7c9b('0x72')](_0xf06525)[_0x7c9b('0x187')](_0x5c750c);};module[_0x7c9b('0x188')]=AGIVertices; \ No newline at end of file +var _0x675b=['Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','unlink','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','forEach','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','saydigits','sayDigits','saynumber','sayNumber','number','sayphonetic','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','bcc','subject','service','host','port','secure','authentication','auth','user','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','replaceAll','exports','path','util','lodash','shelljs','odbc','randomstring','mustache','../../config/logger','agi','../../config/environment','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','getVoiceQueue','getVoiceQueueById','then','getSquareProject','catch','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleTTS','text','google_tts_language','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','en-US','isConfigured','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','clear','includes','clone','hasOwnProperty','isString','replaceAllVariables','split','length','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','sync','retry','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','timeout','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','options','result','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','url','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','no\x20password\x20configured','sestekNDA','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','stringify','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','%s.%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr'];(function(_0x40ea13,_0x47a965){var _0x4f60b0=function(_0xec54ee){while(--_0xec54ee){_0x40ea13['push'](_0x40ea13['shift']());}};_0x4f60b0(++_0x47a965);}(_0x675b,0x72));var _0xb675=function(_0x3de148,_0x21f2e3){_0x3de148=_0x3de148-0x0;var _0x5b304b=_0x675b[_0x3de148];return _0x5b304b;};'use strict';var fs=require('fs');var path=require(_0xb675('0x0'));var util=require(_0xb675('0x1'));var _=require(_0xb675('0x2'));var sh=require(_0xb675('0x3'));var odbc=require(_0xb675('0x4'))();var rs=require(_0xb675('0x5'));var moment=require('moment');var Mustache=require(_0xb675('0x6'));var logger=require(_0xb675('0x7'))(_0xb675('0x8'));var config=require(_0xb675('0x9'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var verticesWithRetry=[_0xb675('0xa'),_0xb675('0xb'),_0xb675('0xc')];var AGIVertices=function(_0x197331,_0x12ef7d,_0x1b5e6b){this[_0xb675('0xd')]=_0x197331;this[_0xb675('0xe')]=_0x12ef7d;this[_0xb675('0xf')]=_0x1b5e6b;};AGIVertices[_0xb675('0x10')][_0xb675('0x11')]=function(_0x3200c9,_0x4be3b3){this['rpc'][_0xb675('0x12')](_0x3200c9)['then'](function(_0x546dd4){_0x4be3b3(null,_0x546dd4?_0x546dd4[_0xb675('0x13')]:![]);})['catch'](function(_0x52ccfa){_0x4be3b3(_0x52ccfa);});};AGIVertices[_0xb675('0x10')][_0xb675('0x14')]=function(_0x4155d2,_0x58be46){this[_0xb675('0xe')][_0xb675('0x15')](_0x4155d2)[_0xb675('0x16')](function(_0x3d7526){_0x58be46(null,_0x3d7526?_0x3d7526[_0xb675('0x13')]:![]);})['catch'](function(_0x2c2030){_0x58be46(_0x2c2030);});};AGIVertices[_0xb675('0x10')][_0xb675('0x17')]=function(_0x20c0e4,_0xca68f9){this[_0xb675('0xe')]['getSquareProjectById'](_0x20c0e4)['then'](function(_0x345477){_0xca68f9(null,_0x345477?_0x345477[_0xb675('0x13')]:![]);})[_0xb675('0x18')](function(_0x25c2cf){_0xca68f9(_0x25c2cf);});};AGIVertices[_0xb675('0x10')][_0xb675('0x19')]=function(_0x51abf8,_0x1d98b5){this[_0xb675('0xe')][_0xb675('0x1a')](_0x51abf8)[_0xb675('0x16')](function(_0x3f46f1){_0x1d98b5(null,_0x3f46f1?_0x3f46f1[_0xb675('0x1b')]:![]);})['catch'](function(_0x32eecb){_0x1d98b5(_0x32eecb);});};AGIVertices[_0xb675('0x10')][_0xb675('0x1c')]=function(_0x3f82cb,_0x140422){this[_0xb675('0xe')][_0xb675('0x1d')](_0x3f82cb)[_0xb675('0x16')](function(_0x2fb02e){_0x140422(null,_0x2fb02e?_0x2fb02e['name']:![]);})[_0xb675('0x18')](function(_0x131824){_0x140422(_0x131824);});};AGIVertices[_0xb675('0x10')]['getTrunk']=function(_0x57e99b,_0xdc021e){this[_0xb675('0xe')][_0xb675('0x1e')](_0x57e99b)[_0xb675('0x16')](function(_0x2986f0){_0xdc021e(null,_0x2986f0?_0x2986f0[_0xb675('0x13')]:![]);})[_0xb675('0x18')](function(_0x1c4ed3){_0xdc021e(_0x1c4ed3);});};AGIVertices[_0xb675('0x10')][_0xb675('0x1f')]=function(_0x5da207,_0x2076d3){var _0xc439dc=this;this[_0xb675('0xe')][_0xb675('0x20')](_0x5da207)[_0xb675('0x16')](function(_0xcd20b4){_0x2076d3(null,_0xcd20b4?_0xc439dc[_0xb675('0x21')](_0xcd20b4[_0xb675('0x22')]):![]);})['catch'](function(_0x2f828c){_0x2076d3(_0x2f828c);});};AGIVertices['prototype'][_0xb675('0x23')]=function(_0x186ddc,_0x715e4b){this[_0xb675('0xe')]['getMailAccountById'](_0x186ddc)['then'](function(_0x3ed8c5){_0x715e4b(null,_0x3ed8c5?_0x3ed8c5:![]);})[_0xb675('0x18')](function(_0x24135e){_0x715e4b(_0x24135e);});};AGIVertices[_0xb675('0x10')]['sendMailMessage']=function(_0x4656a6,_0x4207df,_0x296ac1){this['mailRpc'][_0xb675('0x24')](_0x4656a6,_0x4207df)[_0xb675('0x16')](function(){_0x296ac1(null);})['catch'](function(_0x45b848){_0x296ac1(_0x45b848);});};AGIVertices['prototype']['getIntervals']=function(_0x2bb02b,_0x54e813){this['rpc'][_0xb675('0x25')](_0x2bb02b)[_0xb675('0x16')](function(_0x2d74b8){if(_0x2d74b8){if(_0x2d74b8[_0xb675('0x26')]){_0x54e813(null,[_0x2d74b8[_0xb675('0x27')]]);}else{_0x54e813(null,_[_0xb675('0x28')](_0x2d74b8[_0xb675('0x29')],_0xb675('0x27')));}}else{_0x54e813(null,![]);}})[_0xb675('0x18')](function(_0x3d0af3){_0x54e813(_0x3d0af3);});};AGIVertices['prototype'][_0xb675('0x21')]=function(_0xfd89e1){return util[_0xb675('0x2a')](_0xb675('0x2b'),FILES_PATH,_0xfd89e1);};AGIVertices[_0xb675('0x10')][_0xb675('0x2c')]=function(_0x312569,_0xc08cf6,_0x387e6c){odbc[_0xb675('0x2d')](_0x312569,function(_0x58b3d6){if(_0x58b3d6){logger[_0xb675('0x2e')](_0xb675('0x2f'),_0x58b3d6);_0x387e6c(_0x58b3d6);}else{logger[_0xb675('0x30')](_0xb675('0x31'));odbc[_0xb675('0x32')](_0xc08cf6,function(_0xf1cc3,_0x56e425){if(_0xf1cc3){logger[_0xb675('0x30')](_0xb675('0x33'),_0xc08cf6);_0x387e6c(_0xf1cc3);}else{logger[_0xb675('0x30')](_0xb675('0x34'),_0xc08cf6);odbc[_0xb675('0x35')](function(_0x54a663){if(_0x54a663){logger['error'](_0xb675('0x36'),_0x54a663);}_0x387e6c(null,_0x56e425);});}});}});};AGIVertices[_0xb675('0x10')][_0xb675('0x37')]=function(_0x293040,_0x1ca910){this[_0xb675('0xe')][_0xb675('0x38')](_0x293040)[_0xb675('0x16')](function(_0x132cbd){_0x1ca910(null,_0x132cbd?_0x132cbd:![]);})[_0xb675('0x18')](function(_0x5d6683){_0x1ca910(_0x5d6683);});};AGIVertices['prototype'][_0xb675('0x39')]=function(_0x21beac,_0x17c648){this[_0xb675('0xe')]['createSmsMessage'](_0x21beac)[_0xb675('0x16')](function(_0xe90c83){_0x17c648(null,_0xe90c83);})[_0xb675('0x18')](function(_0x473235){_0x17c648(_0x473235);});};AGIVertices[_0xb675('0x10')][_0xb675('0x3a')]=function(_0x22c9e5,_0x19a713,_0x1dda61){this[_0xb675('0xe')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0xb675('0x3b')],'node':_0x22c9e5[_0xb675('0x3c')],'application':_0x22c9e5[_0xb675('0x3d')],'data':_0x19a713||null,'project_name':this[_0xb675('0xd')][_0xb675('0x3e')],'callerid':this['channel']['callerid']})['then'](function(_0x434190){if(_0x1dda61){_0x1dda61(null,_0x434190);}})[_0xb675('0x18')](function(_0x599066){if(_0x1dda61){_0x1dda61(_0x599066);}});};AGIVertices[_0xb675('0x10')][_0xb675('0x3f')]=function(_0x9a2837,_0x45e8bf,_0x39d077,_0x408b1f){this[_0xb675('0xe')][_0xb675('0x3f')]({'uniqueid':this[_0xb675('0xd')][_0xb675('0x3b')],'callerid':this[_0xb675('0xd')][_0xb675('0x40')],'calleridname':this[_0xb675('0xd')][_0xb675('0x41')],'context':this[_0xb675('0xd')][_0xb675('0x42')],'extension':this['channel']['extension'],'priority':this['channel'][_0xb675('0x43')],'accountcode':this[_0xb675('0xd')][_0xb675('0x44')],'dnid':this[_0xb675('0xd')][_0xb675('0x45')],'projectName':this['channel'][_0xb675('0x3e')],'saveName':_0x45e8bf,'filename':_0x9a2837[_0xb675('0x46')]||_0x45e8bf,'savePath':_0x39d077})[_0xb675('0x16')](function(_0x2528c5){_0x408b1f(null,_0x2528c5);})[_0xb675('0x18')](function(_0x2f9dfb){_0x408b1f(_0x2f9dfb);});};AGIVertices[_0xb675('0x10')][_0xb675('0x47')]=function(_0x31d45d,_0x1394d8,_0x68fb27){this[_0xb675('0xe')][_0xb675('0x47')]({'uniqueid':this[_0xb675('0xd')][_0xb675('0x3b')],'body':_0x31d45d,'direction':_0x1394d8})[_0xb675('0x16')](function(_0x28d1b7){if(_0x68fb27){_0x68fb27(null,_0x28d1b7);}})[_0xb675('0x18')](function(_0x2ebc8d){if(_0x68fb27){_0x68fb27(_0x2ebc8d);}});};AGIVertices[_0xb675('0x10')][_0xb675('0x48')]=function(_0x1d156c,_0x5693dd){this[_0xb675('0xe')]['createCmContact']({'firstName':_[_0xb675('0x49')](_0x1d156c[_0xb675('0x13')])||_[_0xb675('0x4a')](_0x1d156c[_0xb675('0x13')])?_0xb675('0x4b')+Math[_0xb675('0x4c')]():_0x1d156c[_0xb675('0x13')],'lastName':_[_0xb675('0x49')](_0x1d156c[_0xb675('0x4d')])||_[_0xb675('0x4a')](_0x1d156c[_0xb675('0x4d')])?null:_0x1d156c[_0xb675('0x4d')],'phone':_0x1d156c['phone'],'ListId':_0x1d156c[_0xb675('0x4e')],'scheduledAt':_0x1d156c[_0xb675('0x4f')],'callbackUniqueid':this[_0xb675('0xd')][_0xb675('0x3b')],'tags':_0xb675('0x50'),'description':_0xb675('0x51')+_0x1d156c['scheduledAt'][_0xb675('0x52')](),'priority':_0x1d156c[_0xb675('0x53')]})['then'](function(_0x1b7f80){_0x5693dd(null,_0x1b7f80);})['catch'](function(_0x3fe425){_0x5693dd(_0x3fe425);});};AGIVertices[_0xb675('0x10')][_0xb675('0x54')]=function(_0x347cfa,_0x1289c3){this[_0xb675('0xe')][_0xb675('0x55')](_0x347cfa)['then'](function(_0x3e3190){_0x1289c3(null,_0x3e3190?_0x3e3190[_0xb675('0x13')]:![]);})['catch'](function(_0x19e030){_0x1289c3(_0x19e030);});};AGIVertices[_0xb675('0x10')][_0xb675('0x56')]=function(_0x3d3c07,_0x21d571,_0x481de0){var _0x38a8e2={'role':'agent'};_0x38a8e2[_0x3d3c07]=this['channel']['callerid'];this['rpc']['agentPause'](_0x38a8e2,_0x21d571,this['channel']['uniqueid'])[_0xb675('0x16')](function(_0x10066d){_0x481de0(null,_['isNil'](_0x10066d)?![]:!![]);})[_0xb675('0x18')](function(_0x37381f){logger[_0xb675('0x2e')](_0x37381f);_0x481de0(null,![]);});};AGIVertices[_0xb675('0x10')]['agentUnpause']=function(_0x1468ce,_0xfbefd1){var _0x3ff50a={'role':_0xb675('0x57')};_0x3ff50a[_0x1468ce]=this['channel']['callerid'];this[_0xb675('0xe')][_0xb675('0x58')](_0x3ff50a)[_0xb675('0x16')](function(_0x3f31d7){_0xfbefd1(null,_[_0xb675('0x4a')](_0x3f31d7)?![]:!![]);})[_0xb675('0x18')](function(_0x2f00b6){logger['error'](_0x2f00b6);_0xfbefd1(null,![]);});};AGIVertices[_0xb675('0x10')][_0xb675('0x59')]=function(_0x211eef,_0x19c5e0){var _0xacd83d={'role':_0xb675('0x57')};_0xacd83d[_0x211eef]=this[_0xb675('0xd')][_0xb675('0x40')];this[_0xb675('0xe')][_0xb675('0x59')](_0xacd83d)[_0xb675('0x16')](function(_0x32b4ca){_0x19c5e0(null,_['isNil'](_0x32b4ca)?![]:!![]);})['catch'](function(_0x31c117){logger[_0xb675('0x2e')](_0x31c117);_0x19c5e0(null,![]);});};AGIVertices[_0xb675('0x10')][_0xb675('0x5a')]=function(_0x29af65,_0x1e5ffb){var _0x5cc277={'role':_0xb675('0x57')};_0x5cc277[_0x29af65]=this[_0xb675('0xd')][_0xb675('0x40')];var _0x34c73a=_0x29af65!=_0xb675('0x5b')?util['format'](_0xb675('0x5c'),_0xb675('0x5d'),this[_0xb675('0xd')][_0xb675('0x40')]):undefined;this['rpc'][_0xb675('0x5a')](_0x5cc277,_0x34c73a)[_0xb675('0x16')](function(_0x1035a1){_0x1e5ffb(null,_[_0xb675('0x4a')](_0x1035a1)?![]:!![]);})[_0xb675('0x18')](function(_0x2ed107){logger[_0xb675('0x2e')](_0x2ed107);_0x1e5ffb(null,![]);});};AGIVertices['prototype'][_0xb675('0x5e')]=function(_0x34e592,_0x389c68){sh[_0xb675('0x5f')](_[_0xb675('0x60')](_0x34e592),function(_0x52d089,_0x150aad){var _0x2dfb1c=_0x150aad['replace'](/(\r\n|\n|\r)/gm,'');_0x389c68(null,_0x2dfb1c);});};AGIVertices[_0xb675('0x10')][_0xb675('0x61')]=function(_0x35fd66,_0x2e0f61){scripts[_0xb675('0x61')](_0x35fd66[_0xb675('0x62')],_0x35fd66[_0xb675('0x63')]||'en',0x1)[_0xb675('0x16')](function(_0x3c6f96){_0x2e0f61(null,_0x3c6f96);})[_0xb675('0x18')](function(_0x1ee39d){_0x2e0f61(_0x1ee39d);});};AGIVertices['prototype']['googleDialogflow']=function(_0x3d26e0,_0x29f244){scripts['googleDialogflow'](this[_0xb675('0xd')]['uniqueid'],_0x3d26e0['key'],_0x3d26e0[_0xb675('0x62')],_0x3d26e0['dialogflow_language']||'en')[_0xb675('0x16')](function(_0x4f11dc){_0x29f244(null,_0x4f11dc);})[_0xb675('0x18')](function(_0x5b0d39){_0x29f244(_0x5b0d39);});};AGIVertices['prototype']['sestekNDA']=function(_0x815adc,_0x5cff0a){scripts['sestekNDA'](this[_0xb675('0xd')],_0x815adc)[_0xb675('0x16')](function(_0x2648f6){_0x5cff0a(null,_0x2648f6);})[_0xb675('0x18')](function(_0x1d6488){_0x5cff0a(_0x1d6488);});};AGIVertices['prototype'][_0xb675('0x64')]=function(_0x4d9b95,_0x20b370){scripts[_0xb675('0x64')](_0x4d9b95[_0xb675('0x65')],_0x4d9b95[_0xb675('0x62')],_0x4d9b95[_0xb675('0x66')]||'en-US',_0x4d9b95[_0xb675('0x67')])['then'](function(_0x401b4a){_0x20b370(null,_0x401b4a);})[_0xb675('0x18')](function(_0x3d279c){_0x20b370(_0x3d279c);});};AGIVertices[_0xb675('0x10')][_0xb675('0x68')]=function(_0x46845d,_0x1e3e8a,_0x340e6){scripts[_0xb675('0x68')](_0x1e3e8a,_0x46845d[_0xb675('0x65')],_0x46845d['ispeech_asr_language']||_0xb675('0x69'),this[_0xb675('0x6a')](_0x46845d[_0xb675('0x6b')])?_0x46845d[_0xb675('0x6b')]:undefined)['then'](function(_0xd85c7c){_0x340e6(null,_0xd85c7c);})[_0xb675('0x18')](function(_0x1f6aa7){_0x340e6(_0x1f6aa7);});};AGIVertices[_0xb675('0x10')][_0xb675('0x6c')]=function(_0x398123,_0x328551){scripts['awsPolly'](_0x398123[_0xb675('0x6d')],_0x398123[_0xb675('0x6e')],_0x398123[_0xb675('0x6f')],_0x398123[_0xb675('0x70')]||_0xb675('0x71'),_0x398123['text'],_0x398123[_0xb675('0x72')]||_0xb675('0x62'))[_0xb675('0x16')](function(_0x4d362c){_0x328551(null,_0x4d362c);})[_0xb675('0x18')](function(_0x6256fa){_0x328551(_0x6256fa);});};AGIVertices[_0xb675('0x10')]['awsLex']=function(_0x1c0709,_0x1913b4){scripts[_0xb675('0x73')](this[_0xb675('0xd')][_0xb675('0x3b')],_0x1c0709['aws_access_key_id'],_0x1c0709[_0xb675('0x6e')],_0x1c0709[_0xb675('0x74')],_0x1c0709[_0xb675('0x62')],_0x1c0709[_0xb675('0x75')])[_0xb675('0x16')](function(_0x232e7f){_0x1913b4(null,_0x232e7f);})['catch'](function(_0x14b706){_0x1913b4(_0x14b706);});};AGIVertices[_0xb675('0x10')][_0xb675('0x76')]=function(_0x4277ae,_0x452f16,_0x72ceb5){scripts[_0xb675('0x76')](_0x452f16,_0x4277ae[_0xb675('0x65')],_0x4277ae[_0xb675('0x77')]||_0xb675('0x69'))[_0xb675('0x16')](function(_0x57142f){_0x72ceb5(null,_0x57142f);})['catch'](function(_0x4515e2){_0x72ceb5(_0x4515e2);});};AGIVertices['prototype']['tildeASR']=function(_0x7f4974,_0x35421c,_0x3d0cf6){scripts[_0xb675('0x78')](_0x35421c,_0x7f4974[_0xb675('0x79')],_0x7f4974[_0xb675('0x7a')],_0x7f4974['uri'])[_0xb675('0x16')](function(_0x1658b2){_0x3d0cf6(null,_0x1658b2);})['catch'](function(_0x6b9597){_0x3d0cf6(_0x6b9597);});};AGIVertices['prototype'][_0xb675('0x7b')]=function(_0x8dd21b){var _0x4fb2f6=_[_0xb675('0x7c')](verticesWithRetry,_0x8dd21b['agicommand'])?_0x8dd21b:_[_0xb675('0x7d')](_0x8dd21b);for(var _0x3afcc6 in _0x4fb2f6){if(_0x4fb2f6[_0xb675('0x7e')](_0x3afcc6)){if(_0x4fb2f6[_0x3afcc6]&&_[_0xb675('0x7f')](_0x4fb2f6[_0x3afcc6])){_0x4fb2f6[_0x3afcc6]=this[_0xb675('0x80')](_0x4fb2f6[_0x3afcc6]);}}}return _0x4fb2f6;};AGIVertices['prototype'][_0xb675('0x80')]=function(_0x21cd11){var _0x40fac7=_0x21cd11[_0xb675('0x81')]('{');for(var _0x2eb2d2=0x1;_0x2eb2d2<_0x40fac7['length'];_0x2eb2d2+=0x1){var _0x429f17=_0x40fac7[_0x2eb2d2][_0xb675('0x81')]('}');if(_0x429f17[_0xb675('0x82')]>0x1){_0x21cd11=_0x21cd11['replaceAll']('{'+_0x429f17[0x0]+'}',this[_0xb675('0xd')][_0xb675('0x11')](_0x429f17[0x0])[_0xb675('0x83')]||_0x429f17[0x0]);}}if(_0x40fac7[_0xb675('0x82')]===0x1){return _0x21cd11[_0xb675('0x52')]();}return this[_0xb675('0x80')](_0x21cd11);};AGIVertices['prototype'][_0xb675('0x84')]=function(_0x4be55f,_0x53be20){var _0x48d8a8=this[_0xb675('0xd')][_0xb675('0x11')](_0x4be55f);if(_0x48d8a8['result']===-0x1){return _0x48d8a8;}logger[_0xb675('0x30')](util['format'](_0xb675('0x85'),_0x53be20,_0x48d8a8[_0xb675('0x83')]));return this[_0xb675('0xd')][_0xb675('0x86')](_0x53be20,_0x48d8a8[_0xb675('0x83')]);};AGIVertices['prototype']['isConfigured']=function(_0x38eca0){return _0x38eca0&&_0x38eca0!=='0'&&_0x38eca0!=='-1'&&_0x38eca0!=='';};AGIVertices[_0xb675('0x10')][_0xb675('0x87')]=function(_0x2b96d2){this[_0xb675('0x3a')][_0xb675('0x88')](this,_0x2b96d2,'-');_0x2b96d2[_0xb675('0x89')]=_0x2b96d2[_0xb675('0x87')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb675('0x10')][_0xb675('0x8')]=function(_0x1850a8){logger[_0xb675('0x30')](util[_0xb675('0x2a')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1850a8[_0xb675('0x3c')]));return this[_0xb675('0xd')][_0xb675('0x8')]([_0x1850a8[_0xb675('0x8a')],_0x1850a8[_0xb675('0x8b')]]);};AGIVertices[_0xb675('0x10')][_0xb675('0x8c')]=function(_0x1e2818){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x8d'),_0x1e2818[_0xb675('0x3c')]));if(this[_0xb675('0x6a')](_0x1e2818['timeout'])){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x8e'),_0x1e2818[_0xb675('0x8f')]));var _0xd43dd9=this[_0xb675('0xd')][_0xb675('0x90')](_0x1e2818['timeout']);if(_0xd43dd9['result']===-0x1){return _0xd43dd9;}}return this['channel'][_0xb675('0x8c')]();};AGIVertices[_0xb675('0x10')][_0xb675('0x50')]=function(_0x540514){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x91'),_0x540514[_0xb675('0x3c')]));if(!this['isConfigured'](_0x540514[_0xb675('0x4e')])){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x540514,'no\x20list\x20selected');}_0x540514[_0xb675('0x4f')]=moment();if(this[_0xb675('0x6a')](_0x540514[_0xb675('0x92')])){_0x540514[_0xb675('0x4f')]=moment()[_0xb675('0x93')](_0x540514['delay'],_0xb675('0x94'));}if(!this[_0xb675('0x6a')](_0x540514[_0xb675('0x53')])){_0x540514['callback_priority']=0x2;}this[_0xb675('0x48')][_0xb675('0x88')](this,_0x540514);return this[_0xb675('0xd')][_0xb675('0x95')](util['format'](_0xb675('0x96'),_0x540514['phone'],_0x540514['list_id'],_0x540514['scheduledAt']));};AGIVertices[_0xb675('0x10')]['custom_app']=function(_0x4b163a){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x97'),_0x4b163a['label']));var _0x4da1e4=this[_0xb675('0xd')]['exec'](_0x4b163a[_0xb675('0x98')],_0x4b163a[_0xb675('0x99')]);if(_0x4da1e4[_0xb675('0x9a')]===-0x1){return _0x4da1e4;}return this[_0xb675('0xd')][_0xb675('0x95')](util['format'](_0xb675('0x9b'),_0x4b163a['application'],_0x4b163a[_0xb675('0x99')]));};AGIVertices['prototype'][_0xb675('0x9c')]=function(_0x17157b){logger[_0xb675('0x30')](util['format'](_0xb675('0x9d'),_0x17157b[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x17157b['text'])){return this[_0xb675('0xd')][_0xb675('0x95')]('no\x20text\x20configured');}var _0x2831e7='\x22'+_0x17157b[_0xb675('0x62')]+'\x22';if(this[_0xb675('0x6a')](_0x17157b['options'])){_0x2831e7+=','+_0x17157b[_0xb675('0x99')];}var _0x2efa09=this[_0xb675('0xd')][_0xb675('0x5f')](_0xb675('0x9e'),_0x2831e7);if(_0x2efa09[_0xb675('0x9a')]===-0x1){return _0x2efa09;}return this['channel'][_0xb675('0x95')](util[_0xb675('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2831e7));};AGIVertices[_0xb675('0x10')][_0xb675('0x9f')]=function(_0x58b93d){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0xa0'),_0x58b93d[_0xb675('0x3c')]));if(!this['isConfigured'](_0x58b93d[_0xb675('0x62')])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0xa1'));}var _0x17d85e='\x22'+_0x58b93d[_0xb675('0x62')]+'\x22';if(this[_0xb675('0x6a')](_0x58b93d[_0xb675('0x99')])){_0x17d85e+=','+_0x58b93d['options'];}var _0x3a4e53=this['channel']['exec'](_0xb675('0x9e'),_0x17d85e);if(_0x3a4e53[_0xb675('0x9a')]===-0x1){return _0x3a4e53;}return this[_0xb675('0xd')]['noop'](util[_0xb675('0x2a')](_0xb675('0xa2'),_0x17d85e));};AGIVertices[_0xb675('0x10')][_0xb675('0xa3')]=function(_0x365a43){logger['info'](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x365a43[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x365a43[_0xb675('0xa4')])){return this[_0xb675('0xd')]['noop'](_0xb675('0xa5'));}var _0x346535=_0x365a43[_0xb675('0xa4')];if(this[_0xb675('0x6a')](_0x365a43['options'])){_0x346535+=','+_0x365a43[_0xb675('0x99')];}var _0x142006=this['channel'][_0xb675('0x5f')](_0xb675('0xa6'),_0x346535);if(_0x142006[_0xb675('0x9a')]===-0x1){return _0x142006;}var _0x22c180=this[_0xb675('0x84')](_0xb675('0xa7'),'LUMENVOX_ASR_CONFIDENCE');if(_0x22c180[_0xb675('0x9a')]===-0x1){return _0x22c180;}var _0x143188=this[_0xb675('0x84')](_0xb675('0xa8'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x143188[_0xb675('0x9a')]===-0x1){return _0x143188;}var _0x1157db=this['getAndSetVariable']('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x1157db[_0xb675('0x9a')]===-0x1){return _0x1157db;}return this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0xa9'),_0x346535));};AGIVertices[_0xb675('0x10')][_0xb675('0xaa')]=function(_0x529443){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0xab'),_0x529443[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x529443['grammar'])){return this[_0xb675('0xd')]['noop'](_0xb675('0xa5'));}var _0x114224=_0x529443[_0xb675('0xa4')];if(this[_0xb675('0x6a')](_0x529443['options'])){_0x114224+=','+_0x529443['options'];}var _0x4fea4f=this[_0xb675('0xd')][_0xb675('0x5f')](_0xb675('0xa6'),_0x114224);if(_0x4fea4f[_0xb675('0x9a')]===-0x1){return _0x4fea4f;}var _0x137521=this[_0xb675('0x84')](_0xb675('0xa7'),'SESTEK_ASR_CONFIDENCE');if(_0x137521[_0xb675('0x9a')]===-0x1){return _0x137521;}var _0x243f67=this[_0xb675('0x84')](_0xb675('0xa8'),_0xb675('0xac'));if(_0x243f67['result']===-0x1){return _0x243f67;}var _0x2cbf76=this[_0xb675('0x84')](_0xb675('0xad'),'SESTEK_ASR_INSTANCE');if(_0x2cbf76[_0xb675('0x9a')]===-0x1){return _0x2cbf76;}return this['channel'][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0xa9'),_0x114224));};AGIVertices['prototype'][_0xb675('0xae')]=function(_0x2843b4){logger['info'](util[_0xb675('0x2a')](_0xb675('0xaf'),_0x2843b4[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x2843b4[_0xb675('0xb0')])){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x2843b4,_0xb675('0xb1'));}var _0x42d492=this[_0xb675('0x19')][_0xb675('0x88')](this,_0x2843b4[_0xb675('0xb0')]);if(!_0x42d492){return this[_0xb675('0xd')]['error'](_0x2843b4,'no\x20odbc\x20database\x20found');}if(!this[_0xb675('0x6a')](_0x2843b4[_0xb675('0x32')])){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x2843b4,_0xb675('0xb2'));}var _0x41d03d=_0x2843b4[_0xb675('0x32')][_0xb675('0xb3')](/(\r\n|\n|\r)/gm,'\x20');this[_0xb675('0xd')][_0xb675('0x95')](util['format'](_0xb675('0xb4'),_0x41d03d));var _0x55349c=this[_0xb675('0x2c')][_0xb675('0x88')](this,_0x42d492,_0x41d03d);this[_0xb675('0x3a')][_0xb675('0x88')](this,_0x2843b4,_0x41d03d);if(!this[_0xb675('0x6a')](_0x2843b4[_0xb675('0xb5')])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0xb6'));}var _0x4534fb=this[_0xb675('0x11')]['sync'](this,_0x2843b4['variable_id']);if(!_0x4534fb){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x2843b4,_0xb675('0xb7'));}var _0x272f6c=this;_0x55349c['forEach'](function(_0x5748f9,_0x46fc54){Object[_0xb675('0xb8')](_0x5748f9)['forEach'](function(_0x5cd7a4){_0x272f6c[_0xb675('0xd')][_0xb675('0x86')](util[_0xb675('0x2a')](_0xb675('0xb9'),_0x4534fb,_0x46fc54,_0x5cd7a4),_0x5748f9[_0x5cd7a4]);});});this[_0xb675('0xd')]['setVariable'](util[_0xb675('0x2a')](_0xb675('0xba'),_0x4534fb),_0x55349c[_0xb675('0x82')]);return this['channel'][_0xb675('0x95')](util[_0xb675('0x2a')]('variable\x20%s\x20set',_0x4534fb));};AGIVertices[_0xb675('0x10')][_0xb675('0xbb')]=function(_0x48c789){logger[_0xb675('0xbc')](util[_0xb675('0x2a')](_0xb675('0xbd'),_0x48c789['label']));if(!this[_0xb675('0x6a')](_0x48c789[_0xb675('0xbe')])){return this[_0xb675('0xd')]['error'](_0x48c789,_0xb675('0xbf'));}var _0x31d134=this[_0xb675('0x1c')][_0xb675('0x88')](this,_0x48c789[_0xb675('0xbe')]);if(!_0x31d134){return this[_0xb675('0xd')]['error'](_0x48c789,_0xb675('0xc0'));}var _0x4a7609=this[_0xb675('0xd')][_0xb675('0x5f')](_0xb675('0xc1'),[util[_0xb675('0x2a')](_0xb675('0xc2'),_0x31d134),_0x48c789[_0xb675('0x8f')],_0x48c789[_0xb675('0xc3')],_0x48c789[_0xb675('0xc4')]]);if(_0x4a7609[_0xb675('0x9a')]===-0x1){return _0x4a7609;}return this[_0xb675('0xd')][_0xb675('0x95')](util['format']('Executed\x20command\x20%s',_0xb675('0xc1')));};AGIVertices['prototype'][_0xb675('0xc5')]=function(_0x516c87){logger['info'](util['format'](_0xb675('0xc6'),_0x516c87[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x516c87[_0xb675('0x65')])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0xc7'));}if(!this[_0xb675('0x6a')](_0x516c87[_0xb675('0x62')])){return this[_0xb675('0xd')]['noop'](_0xb675('0xa1'));}this['channel'][_0xb675('0xc8')]=!![];this[_0xb675('0x3a')](_0x516c87);this[_0xb675('0x47')](_0x516c87['text'],'in');this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0xc9'),_0x516c87['text']));var _0x2242f6=this[_0xb675('0xca')][_0xb675('0x88')](this,_0x516c87);if(_0x2242f6){for(var _0x4ea69f in _0x2242f6){if(_0x2242f6[_0xb675('0x7e')](_0x4ea69f)){this['channel'][_0xb675('0x86')](util[_0xb675('0x2a')](_0xb675('0xcb'),_0x4ea69f[_0xb675('0xcc')]()),_0x2242f6[_0x4ea69f]);}}this[_0xb675('0x47')](_0x2242f6[_0xb675('0xcd')],_0xb675('0xce'));return this['channel']['noop'](util['format'](_0xb675('0xcf'),_0x2242f6[_0xb675('0xcd')]));}return this['channel'][_0xb675('0x2e')](_0x516c87,_0xb675('0xd0'));};AGIVertices[_0xb675('0x10')][_0xb675('0xd1')]=function(_0x26a320){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0xd2'),_0x26a320[_0xb675('0x3c')]));if(!this['isConfigured'](_0x26a320[_0xb675('0xd3')])){return this[_0xb675('0xd')][_0xb675('0x95')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xb675('0x6a')](_0x26a320[_0xb675('0xd4')])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0xd5'));}if(!this[_0xb675('0x6a')](_0x26a320['password'])){return this['channel']['noop'](_0xb675('0xd6'));}if(!this[_0xb675('0x6a')](_0x26a320['ndassistant_url'])){return this['channel'][_0xb675('0x95')](_0xb675('0xa1'));}this[_0xb675('0xd')][_0xb675('0xc8')]=!![];this['createSquareDetailsReport'](_0x26a320);this[_0xb675('0x47')](_0x26a320[_0xb675('0x62')],'in');this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')]('Trying\x20SestekNDA:\x20%s',_0x26a320['text']));var _0x3df6be=this[_0xb675('0xd7')][_0xb675('0x88')](this,_0x26a320);if(_0x3df6be){for(var _0x150c8b in _0x3df6be){if(_0x3df6be[_0xb675('0x7e')](_0x150c8b)){this['channel'][_0xb675('0x86')](util['format'](_0xb675('0xd8'),_0x150c8b[_0xb675('0xcc')]()),_0x3df6be[_0x150c8b]);}}this[_0xb675('0x47')](_0x3df6be[_0xb675('0xcd')],_0xb675('0xce'));if(_0x3df6be[_0xb675('0xd9')]){this[_0xb675('0xd')]['noop'](util[_0xb675('0x2a')](_0xb675('0xda'),_0x3df6be[_0xb675('0xd9')]));var _0x4b9254=this['channel'][_0xb675('0xdb')](_0x3df6be[_0xb675('0xd9')]);try{fs['unlink'](_0x3df6be[_0xb675('0xd9')]+_0xb675('0xdc'));}catch(_0x3d5a1c){logger[_0xb675('0x2e')](_0x3d5a1c);}return _0x4b9254;}else{return this[_0xb675('0xd')]['noop'](util[_0xb675('0x2a')](_0xb675('0xdd'),_0x3df6be[_0xb675('0xcd')]));}}return this['channel'][_0xb675('0x2e')](_0x26a320,_0xb675('0xde'));};AGIVertices[_0xb675('0x10')]['end']=function(_0x1942be){logger[_0xb675('0x30')](util['format'](_0xb675('0xdf'),_0x1942be[_0xb675('0x3c')]));return this['channel']['noop'](_0xb675('0xe0'));};AGIVertices['prototype']['ext_dial']=function(_0x481271){logger['info'](util[_0xb675('0x2a')](_0xb675('0xe1'),_0x481271[_0xb675('0x3c')]));var _0x154e68='';if(_0x481271['trunk_id']){if(!this['isConfigured'](_0x481271[_0xb675('0xe2')])){return this['channel']['error'](_0x481271,'no\x20trunk\x20selected');}else{var _0x45d89e=parseInt(_0x481271[_0xb675('0xe2')],0xa);if(isNaN(_0x45d89e)){_0x154e68=_0x481271[_0xb675('0xe2')];}else{_0x154e68=this[_0xb675('0xe3')]['sync'](this,_0x481271[_0xb675('0xe2')]);if(!_0x154e68){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x481271,'no\x20trunk\x20found');}}}}else if(_0x481271[_0xb675('0xe4')]){_0x154e68=_0x481271['trunk_name'];}else{return this[_0xb675('0xd')][_0xb675('0x2e')](_0x481271,'no\x20trunk\x20selected');}var _0xeeabda=this[_0xb675('0xd')][_0xb675('0x5f')](_0xb675('0xc1'),[util[_0xb675('0x2a')](_0xb675('0xe5'),_0x154e68,_0x481271['phone']),_0x481271['timeout'],_0x481271[_0xb675('0xc3')],_0x481271[_0xb675('0xc4')]]);if(_0xeeabda[_0xb675('0x9a')]===-0x1){return _0xeeabda;}return this['channel'][_0xb675('0x95')](util['format'](_0xb675('0xe6'),'DIAL'));};AGIVertices[_0xb675('0x10')]['finally']=function(_0x366eb2){logger['info'](util['format'](_0xb675('0xe7'),_0x366eb2[_0xb675('0x3c')]));return this[_0xb675('0xd')][_0xb675('0x95')]('finally');};AGIVertices['prototype']['getdigits']=function(_0x48d402){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0xe8'),_0x48d402[_0xb675('0x3c')]));if(_0x48d402[_0xb675('0x89')]===0x0){return this['maxRetry'](_0x48d402);}_0x48d402[_0xb675('0x89')]-=0x1;if(!this[_0xb675('0x6a')](_0x48d402[_0xb675('0xe9')])){return this['channel']['error'](_0x48d402,'no\x20file\x20audio\x20selected');}var _0x5c6139=this['getSound'][_0xb675('0x88')](this,_0x48d402[_0xb675('0xe9')]);if(!_0x5c6139){return this['channel'][_0xb675('0x2e')](_0x48d402,_0xb675('0xea'));}if(!this['isConfigured'](_0x48d402[_0xb675('0xb5')])){return this[_0xb675('0xd')][_0xb675('0x2e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4f8403=this[_0xb675('0xd')][_0xb675('0xeb')](_0x5c6139,_0x48d402[_0xb675('0xec')],_0x48d402[_0xb675('0xed')]);var _0x51ff4e=_0x4f8403[_0xb675('0x9a')]?_0x4f8403[_0xb675('0x9a')][_0xb675('0x52')]():'';logger['info'](_0xb675('0xee'),JSON[_0xb675('0xef')](_0x4f8403));if(_0x4f8403[_0xb675('0x9a')]===-0x1){this[_0xb675('0x3a')][_0xb675('0x88')](this,_0x48d402,_0x51ff4e);return _0x4f8403;}else if(_0x4f8403['extra']===_0xb675('0x8f')){_0x4f8403[_0xb675('0x9a')]=_0x51ff4e[_0xb675('0x82')]>=parseInt(_0x48d402[_0xb675('0xf0')])?'x':'i';}else{_0x4f8403[_0xb675('0x9a')]=_0x51ff4e[_0xb675('0x82')]>=parseInt(_0x48d402[_0xb675('0xf0')])&&_0x51ff4e['length']<=parseInt(_0x48d402[_0xb675('0xed')])?'x':'i';}var _0xeffa0f=this['getVariable']['sync'](this,_0x48d402[_0xb675('0xb5')]);if(!_0xeffa0f){return this[_0xb675('0xd')]['error'](_0x48d402,_0xb675('0xb7'));}this[_0xb675('0xd')][_0xb675('0x86')](_0xeffa0f,_0x51ff4e);if(this[_0xb675('0x6a')](_0x48d402[_0xb675('0xf1')])){var _0x43b6de=parseInt(_0x48d402['hiddendigitsnum'],0xa);var _0x2b9fc2=rs[_0xb675('0xf2')]({'charset':'*','length':_0x43b6de});var _0x1a5fdb=_0x51ff4e[_0xb675('0x82')];if(_0x1a5fdb>0x0){if(_0x1a5fdb>_0x43b6de){this[_0xb675('0x3a')]['sync'](this,_0x48d402,_0x48d402[_0xb675('0xf3')]===_0xb675('0xf4')?_0x2b9fc2+_0x51ff4e[_0xb675('0xf5')](_0x43b6de):_0x51ff4e[_0xb675('0xf5')](0x0,_0x1a5fdb-_0x43b6de)+_0x2b9fc2);}else{this[_0xb675('0x3a')][_0xb675('0x88')](this,_0x48d402,rs[_0xb675('0xf2')]({'charset':'*','length':_0x1a5fdb}));}}else{this['createSquareDetailsReport'][_0xb675('0x88')](this,_0x48d402,'');}}else{this[_0xb675('0x3a')]['sync'](this,_0x48d402,_0x51ff4e);}return _0x4f8403;};AGIVertices['prototype'][_0xb675('0xc')]=function(_0x2bfafd){logger[_0xb675('0x30')](util['format'](_0xb675('0xf6'),_0x2bfafd[_0xb675('0x3c')]));return this['getdigits'](_0x2bfafd);};AGIVertices[_0xb675('0x10')][_0xb675('0xf7')]=function(_0x261129){logger[_0xb675('0x30')](util['format'](_0xb675('0xf8'),_0x261129[_0xb675('0x3c')]));this[_0xb675('0x3a')][_0xb675('0x88')](this,_0x261129,_0x261129[_0xb675('0xf9')]);return this['channel'][_0xb675('0x95')](util[_0xb675('0x2a')]('GOAL\x20%s',_0x261129[_0xb675('0xf9')]));};AGIVertices['prototype'][_0xb675('0xfa')]=function(_0x457046){logger[_0xb675('0x30')](util[_0xb675('0x2a')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x457046[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x457046['aws_access_key_id'])||!this['isConfigured'](_0x457046['aws_secret_access_key'])){return this[_0xb675('0xd')][_0xb675('0x95')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xb675('0x6a')](_0x457046[_0xb675('0x62')])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0xa1'));}this['channel'][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0xfb'),_0x457046[_0xb675('0x62')]));var _0x5713c4=this[_0xb675('0x6c')][_0xb675('0x88')](this,_0x457046);if(_0x5713c4){this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0xfc'),_0x5713c4));var _0x5908a0=this[_0xb675('0xd')][_0xb675('0xdb')](_0x5713c4);try{fs['unlink'](_0x5713c4+'.wav');}catch(_0xaa1a2f){logger['error'](_0xaa1a2f);}return _0x5908a0;}return this['channel']['error'](_0x457046,_0xb675('0xfd'));};AGIVertices['prototype'][_0xb675('0xfe')]=function(_0x3f2e96){logger[_0xb675('0x30')](util['format'](_0xb675('0xff'),_0x3f2e96['label']));if(!this[_0xb675('0x6a')](_0x3f2e96[_0xb675('0x6d')])||!this[_0xb675('0x6a')](_0x3f2e96[_0xb675('0x6e')])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0x100'));}if(!this[_0xb675('0x6a')](_0x3f2e96[_0xb675('0x75')])){return this[_0xb675('0xd')]['noop'](_0xb675('0x101'));}if(!this[_0xb675('0x6a')](_0x3f2e96[_0xb675('0x62')])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0xa1'));}this[_0xb675('0xd')][_0xb675('0xc8')]=!![];this[_0xb675('0x3a')](_0x3f2e96);this[_0xb675('0x47')](_0x3f2e96['text'],'in');this['channel'][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x102'),_0x3f2e96[_0xb675('0x62')]));var _0x5a5ee=this[_0xb675('0x73')][_0xb675('0x88')](this,_0x3f2e96);if(_0x5a5ee){for(var _0x50b14c in _0x5a5ee){if(_0x5a5ee[_0xb675('0x7e')](_0x50b14c)&&_[_0xb675('0x7f')](_0x5a5ee[_0x50b14c])){this[_0xb675('0xd')][_0xb675('0x86')](util['format']('AWS_LEX_%s',_0x50b14c[_0xb675('0xcc')]()),_0x5a5ee[_0x50b14c]);}}if(_['isNil'](_0x5a5ee['message'])){return this[_0xb675('0xd')]['noop'](_0xb675('0x103'));}else{this[_0xb675('0x47')](_0x5a5ee[_0xb675('0x104')],_0xb675('0xce'));return this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x105'),_0x5a5ee[_0xb675('0x104')]));}}return this[_0xb675('0xd')][_0xb675('0x2e')](_0x3f2e96,_0xb675('0x106'));};AGIVertices[_0xb675('0x10')][_0xb675('0x107')]=function(_0x4c25dd){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x108'),_0x4c25dd[_0xb675('0x3c')],_0x4c25dd[_0xb675('0x8f')]));if(!this[_0xb675('0x6a')](_0x4c25dd[_0xb675('0x65')])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0xc7'));}var _0x407813=_0xb675('0x109');var _0x472244=util[_0xb675('0x2a')](_0xb675('0x10a'),FILES_PATH,rs[_0xb675('0xf2')](0x4));var _0x14413f=util['format'](_0xb675('0x10b'),_0x472244,_0x407813);var _0x451854=!![];if(_0x4c25dd[_0xb675('0x10c')]==='NOBEEP'){_0x451854=![];}var _0x32cb98=this[_0xb675('0xd')][_0xb675('0x10d')](_0x472244,_0x407813,_0x4c25dd[_0xb675('0x10e')],_0x4c25dd['timeout'],undefined,_0x451854);if(_0x32cb98[_0xb675('0x9a')]!==-0x1){this['channel'][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x10f'),_0x14413f));var _0x260818=this['googleASR'][_0xb675('0x88')](this,_0x4c25dd,_0x14413f);if(_0x260818){for(var _0x1277e1 in _0x260818){if(_0x260818[_0xb675('0x7e')](_0x1277e1)){this[_0xb675('0xd')][_0xb675('0x86')](util[_0xb675('0x2a')](_0xb675('0x110'),_0x1277e1['toUpperCase']()),_0x260818[_0x1277e1]);}}return this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x260818)));}}return _0x32cb98;};AGIVertices[_0xb675('0x10')][_0xb675('0x111')]=function(_0x59915c){logger[_0xb675('0x30')](util['format'](_0xb675('0x112'),_0x59915c[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x59915c['appid'])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0x113'));}if(!this[_0xb675('0x6a')](_0x59915c[_0xb675('0x7a')])){return this['channel'][_0xb675('0x95')](_0xb675('0x114'));}var _0x3932cc='wav';var _0x17bcc1=util[_0xb675('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0xb675('0xf2')](0x4));var _0x1568b5=util['format'](_0xb675('0x10b'),_0x17bcc1,_0x3932cc);var _0x16fdd9=!![];if(_0x59915c['beep']===_0xb675('0x115')){_0x16fdd9=![];}var _0x37b265=this[_0xb675('0xd')][_0xb675('0x10d')](_0x17bcc1,_0x3932cc,_0x59915c[_0xb675('0x10e')],_0x59915c[_0xb675('0x8f')],undefined,_0x16fdd9);if(_0x37b265[_0xb675('0x9a')]!==-0x1){this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x116'),_0x1568b5));var _0x4e1a14=this[_0xb675('0x78')][_0xb675('0x88')](this,_0x59915c,_0x1568b5);if(_0x4e1a14){for(var _0x198935 in _0x4e1a14){if(_0x4e1a14[_0xb675('0x7e')](_0x198935)){this[_0xb675('0xd')][_0xb675('0x86')](util[_0xb675('0x2a')]('TILDE_ASR_%s',_0x198935[_0xb675('0xcc')]()),_0x4e1a14[_0x198935]);}}return this[_0xb675('0xd')]['noop'](util[_0xb675('0x2a')]('TildeASR\x20Result\x20%s',JSON[_0xb675('0xef')](_0x4e1a14)));}}return _0x37b265;};AGIVertices[_0xb675('0x10')]['gotoc']=function(_0x137cfd){logger['info'](util['format'](_0xb675('0x117'),_0x137cfd[_0xb675('0x3c')]));return this[_0xb675('0xd')][_0xb675('0x118')](_0x137cfd['context'],_0x137cfd[_0xb675('0x119')],_0x137cfd['priority']);};AGIVertices['prototype'][_0xb675('0x11a')]=function(_0x4bc2b4){logger[_0xb675('0x30')](util['format'](_0xb675('0x11b'),_0x4bc2b4[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x4bc2b4[_0xb675('0x11c')])){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x4bc2b4,_0xb675('0x11d'));}try{var _0x2f31d8=eval(_0x4bc2b4[_0xb675('0x11c')])?_0xb675('0x11e'):_0xb675('0x11f');this['channel'][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x120'),_0x4bc2b4[_0xb675('0x11c')],_0x2f31d8));return{'code':0xc8,'result':_0x2f31d8};}catch(_0x223532){return{'code':0xc8,'result':_0xb675('0x11f')};}};AGIVertices['prototype']['gotoiftime']=function(_0xb12197){logger['info'](util[_0xb675('0x2a')](_0xb675('0x121'),_0xb12197[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0xb12197[_0xb675('0x122')])){return this['channel'][_0xb675('0x2e')](_0xb12197,_0xb675('0x123'));}var _0x3418df=this[_0xb675('0x124')][_0xb675('0x88')](this,_0xb12197[_0xb675('0x122')]);if(!_0x3418df){return this[_0xb675('0xd')][_0xb675('0x2e')](_0xb12197,'no\x20intervals\x20found');}for(var _0x23dfc8=0x0;_0x23dfc8<_0x3418df['length'];_0x23dfc8+=0x1){var _0x646759=this[_0xb675('0xd')][_0xb675('0x11')](util[_0xb675('0x2a')](_0xb675('0x125'),_0x3418df[_0x23dfc8]));if(_0x646759[_0xb675('0x9a')]===-0x1){return _0x646759;}logger['info'](util['format'](_0xb675('0x126'),_0x3418df[_0x23dfc8],_0x646759['extra']));if(_0x646759[_0xb675('0x83')]==='true'){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x126'),_0x3418df[_0x23dfc8],_0xb675('0x11e')));this[_0xb675('0xd')][_0xb675('0x95')](util['format'](_0xb675('0x126'),_0x3418df[_0x23dfc8],_0xb675('0x11e')));return{'code':0xc8,'result':_0xb675('0x11e')};}else{logger['info'](util['format'](_0xb675('0x126'),_0x3418df[_0x23dfc8],_0xb675('0x11f')));this['channel'][_0xb675('0x95')](util['format']('IFTIME\x20%s\x20%s',_0x3418df[_0x23dfc8],_0xb675('0x11f')));}}return{'code':0xc8,'result':_0xb675('0x11f')};};AGIVertices[_0xb675('0x10')][_0xb675('0x127')]=function(_0x297c52){logger[_0xb675('0x30')](util['format'](_0xb675('0x128'),_0x297c52['label']));return this['channel'][_0xb675('0x127')]();};AGIVertices[_0xb675('0x10')][_0xb675('0x129')]=function(_0x55a0b6){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x12a'),_0x55a0b6[_0xb675('0x3c')]));if(!this['isConfigured'](_0x55a0b6[_0xb675('0x65')])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0xc7'));}var _0x15beaf=_0xb675('0x109');var _0x2fda14=util[_0xb675('0x2a')](_0xb675('0x10a'),FILES_PATH,rs[_0xb675('0xf2')](0x4));var _0x3747a3=util[_0xb675('0x2a')](_0xb675('0x10b'),_0x2fda14,_0x15beaf);var _0x147514=!![];if(_0x55a0b6[_0xb675('0x10c')]===_0xb675('0x115')){_0x147514=![];}var _0xbfee37=this[_0xb675('0xd')][_0xb675('0x10d')](_0x2fda14,_0x15beaf,_0x55a0b6[_0xb675('0x10e')],_0x55a0b6['timeout'],undefined,_0x147514);if(_0xbfee37[_0xb675('0x9a')]!==-0x1){this['channel'][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x12b'),_0x3747a3));var _0x43e08b=this['ispeechASR'][_0xb675('0x88')](this,_0x55a0b6,_0x3747a3);if(_0x43e08b){for(var _0x5f1604 in _0x43e08b){if(_0x43e08b[_0xb675('0x7e')](_0x5f1604)){this[_0xb675('0xd')][_0xb675('0x86')](util[_0xb675('0x2a')](_0xb675('0x12c'),_0x5f1604[_0xb675('0xcc')]()),_0x43e08b[_0x5f1604]);}}return this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x12d'),JSON[_0xb675('0xef')](_0x43e08b)));}}return _0xbfee37;};AGIVertices[_0xb675('0x10')][_0xb675('0x12e')]=function(_0xfab4cb){logger['info'](util['format'](_0xb675('0x12f'),_0xfab4cb[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0xfab4cb[_0xb675('0x65')])){return this['channel'][_0xb675('0x95')](_0xb675('0xc7'));}if(!this[_0xb675('0x6a')](_0xfab4cb[_0xb675('0x62')])){return this['channel']['noop'](_0xb675('0xa1'));}this[_0xb675('0xd')]['noop'](util[_0xb675('0x2a')]('Trying\x20ispeech\x20TTS\x20%s',_0xfab4cb['text']));var _0x4e8a93=this[_0xb675('0x64')][_0xb675('0x88')](this,_0xfab4cb);if(_0x4e8a93){this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x12b'),_0x4e8a93));var _0x13b675=this['channel']['streamFile'](_0x4e8a93,_0xfab4cb[_0xb675('0x10e')]);try{fs[_0xb675('0x130')](_0x4e8a93+'.wav');}catch(_0x107593){logger[_0xb675('0x2e')](_0x107593);}return _0x13b675;}return this[_0xb675('0xd')][_0xb675('0x2e')](_0xfab4cb,_0xb675('0x131'));};AGIVertices[_0xb675('0x10')][_0xb675('0x132')]=function(_0x53e317){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x133'),_0x53e317[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x53e317[_0xb675('0x134')])){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x53e317,_0xb675('0x135'));}logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x136'),this['channel'][_0xb675('0x40')],_0x53e317[_0xb675('0x134')]));var _0xcb67e6=this[_0xb675('0x5a')]['sync'](this,_0x53e317['findBy']);if(_0xcb67e6){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x137'),this[_0xb675('0xd')][_0xb675('0x40')],_0x53e317[_0xb675('0x134')]));this[_0xb675('0xd')][_0xb675('0x95')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb675('0x40')],_0x53e317[_0xb675('0x134')]));return{'code':0xc8,'result':_0xb675('0x138')};}else{logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x139'),this[_0xb675('0xd')]['callerid'],_0x53e317['findBy']));this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x139'),this[_0xb675('0xd')][_0xb675('0x40')],_0x53e317[_0xb675('0x134')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb675('0x10')][_0xb675('0x13a')]=function(_0x4023a8){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x13b'),_0x4023a8[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x4023a8['findBy'])){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x4023a8,_0xb675('0x135'));}logger[_0xb675('0x30')](util[_0xb675('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xb675('0x40')],_0x4023a8[_0xb675('0x134')]));var _0x7f9f9b=this[_0xb675('0x59')][_0xb675('0x88')](this,_0x4023a8[_0xb675('0x134')]);if(_0x7f9f9b){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x137'),this[_0xb675('0xd')][_0xb675('0x40')],_0x4023a8[_0xb675('0x134')]));this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb675('0xd')]['callerid'],_0x4023a8[_0xb675('0x134')]));return{'code':0xc8,'result':_0xb675('0x138')};}else{logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x139'),this[_0xb675('0xd')][_0xb675('0x40')],_0x4023a8[_0xb675('0x134')]));this[_0xb675('0xd')]['noop'](util[_0xb675('0x2a')](_0xb675('0x139'),this[_0xb675('0xd')][_0xb675('0x40')],_0x4023a8[_0xb675('0x134')]));return{'code':0xc8,'result':_0xb675('0x13c')};}};AGIVertices['prototype'][_0xb675('0x13d')]=function(_0x4b0f70){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x13e'),_0x4b0f70['label']));if(!this[_0xb675('0x6a')](_0x4b0f70['operation'])){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x4b0f70,_0xb675('0x13f'));}this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x140'),_0x4b0f70[_0xb675('0x141')]));var _0xedcbbd=eval(_0x4b0f70[_0xb675('0x141')]);if(!this[_0xb675('0x6a')](_0x4b0f70[_0xb675('0xb5')])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0xb6'));}var _0x3adeb8=this['getVariable']['sync'](this,_0x4b0f70[_0xb675('0xb5')]);if(!_0x3adeb8){return this['channel'][_0xb675('0x2e')](_0x4b0f70,'no\x20variable\x20found');}if(_['isArray'](_0xedcbbd)){var _0x3e9f0c=this;_0xedcbbd[_0xb675('0x142')](function(_0x17e3d8,_0x24adc0){_0x3e9f0c[_0xb675('0xd')][_0xb675('0x86')](util['format']('%s[%s]',_0x3adeb8,_0x24adc0),_0x17e3d8);});return this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x143'),_0x3adeb8));}else{return this[_0xb675('0xd')][_0xb675('0x86')](_0x3adeb8,_0xedcbbd);}};AGIVertices['prototype'][_0xb675('0xa')]=function(_0x3afab6){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x144'),_0x3afab6[_0xb675('0x3c')]));if(_0x3afab6[_0xb675('0x89')]===0x0){return this['maxRetry'](_0x3afab6);}_0x3afab6['retry']-=0x1;if(!this[_0xb675('0x6a')](_0x3afab6['file_id'])){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x3afab6,_0xb675('0x145'));}var _0x1289d6=this[_0xb675('0x1f')][_0xb675('0x88')](this,_0x3afab6[_0xb675('0xe9')]);if(!_0x1289d6){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x3afab6,_0xb675('0xea'));}var _0x1a5a79=this[_0xb675('0xd')][_0xb675('0xeb')](_0x1289d6,_0x3afab6[_0xb675('0xec')],_0x3afab6[_0xb675('0x146')]);var _0x1d78b4=_0x1a5a79[_0xb675('0x9a')];if(_0x1a5a79[_0xb675('0x9a')]===-0x1){this[_0xb675('0x3a')][_0xb675('0x88')](this,_0x3afab6,'-1');return _0x1a5a79;}else if(_0x1a5a79['extra']===_0xb675('0x8f')){_0x1a5a79[_0xb675('0x9a')]=_0x1a5a79[_0xb675('0x9a')][_0xb675('0x82')]>0x0?_0x1a5a79[_0xb675('0x9a')]:'t';}else if(_[_0xb675('0x49')](_0x1a5a79[_0xb675('0x9a')])){_0x1a5a79[_0xb675('0x9a')]='#';_0x1d78b4='#';}if(!this[_0xb675('0x6a')](_0x3afab6[_0xb675('0xb5')])){this['channel'][_0xb675('0x95')](_0xb675('0xb6'));}else{var _0x57773a=this[_0xb675('0x11')]['sync'](this,_0x3afab6[_0xb675('0xb5')]);if(!_0x57773a){return this['channel']['error'](_0x3afab6,_0xb675('0xb7'));}this['channel']['setVariable'](_0x57773a,_0x1d78b4);}this[_0xb675('0x3a')][_0xb675('0x88')](this,_0x3afab6,_0x1d78b4);return _0x1a5a79;};AGIVertices[_0xb675('0x10')][_0xb675('0x95')]=function(_0x5e1924){logger[_0xb675('0x30')](util[_0xb675('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5e1924[_0xb675('0x3c')]));return this[_0xb675('0xd')][_0xb675('0x95')](_0x5e1924[_0xb675('0x147')]||_0x5e1924['label']);};AGIVertices['prototype']['pause']=function(_0xa9c2bf){logger[_0xb675('0x30')](util['format'](_0xb675('0x148'),_0xa9c2bf[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0xa9c2bf[_0xb675('0x134')])){return this['channel'][_0xb675('0x2e')](_0xa9c2bf,'no\x20find\x20by\x20configured');}logger[_0xb675('0x30')](util[_0xb675('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb675('0xd')][_0xb675('0x40')],_0xa9c2bf[_0xb675('0x134')]));var _0xfc2899=this[_0xb675('0x54')]['sync'](this,_0xa9c2bf['pause_id']);var _0x4b6cd7=this['agentPause'][_0xb675('0x88')](this,_0xa9c2bf['findBy'],_0xfc2899);if(_0x4b6cd7){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x137'),this[_0xb675('0xd')][_0xb675('0x40')],_0xa9c2bf['findBy']));this['channel'][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x137'),this[_0xb675('0xd')]['callerid'],_0xa9c2bf[_0xb675('0x134')]));return{'code':0xc8,'result':_0xb675('0x138')};}else{logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x139'),this[_0xb675('0xd')][_0xb675('0x40')],_0xa9c2bf[_0xb675('0x134')]));this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x137'),this[_0xb675('0xd')][_0xb675('0x40')],_0xa9c2bf[_0xb675('0x134')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb675('0x10')]['playback']=function(_0x18ef1a){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x149'),_0x18ef1a[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x18ef1a[_0xb675('0xe9')])){return this['channel'][_0xb675('0x2e')](_0x18ef1a,_0xb675('0x145'));}var _0x75277e=this[_0xb675('0x1f')][_0xb675('0x88')](this,_0x18ef1a['file_id']);if(!_0x75277e){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x18ef1a,_0xb675('0xea'));}var _0xb13619=this[_0xb675('0xd')][_0xb675('0x5f')]('PLAYBACK',[_0x75277e,_0x18ef1a[_0xb675('0xc3')]]);if(_0xb13619['result']===-0x1){return _0xb13619;}return this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x9b'),_0xb675('0x14a'),_0x75277e));};AGIVertices['prototype'][_0xb675('0x14b')]=function(_0x359695){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x14c'),_0x359695[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x359695[_0xb675('0x14d')])){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x359695,'no\x20queue\x20selected');}var _0x388468='';var _0x4bdb0d=parseInt(_0x359695[_0xb675('0x14d')],0xa);if(isNaN(_0x4bdb0d)){_0x388468=_0x359695[_0xb675('0x14d')];}else{_0x388468=this[_0xb675('0x14')][_0xb675('0x88')](this,_0x359695[_0xb675('0x14d')]);if(!_0x388468){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x359695,_0xb675('0x14e'));}}var _0x12ae4e='';if(this[_0xb675('0x6a')](_0x359695[_0xb675('0xe9')])){var _0x3608c4=this[_0xb675('0x1f')]['sync'](this,_0x359695[_0xb675('0xe9')]);if(_0x3608c4){_0x12ae4e=_0x3608c4;}}this[_0xb675('0x3a')]['sync'](this,_0x359695,_0x388468);if(_0x359695[_0xb675('0xc3')][_0xb675('0x14f')]('x')<0x0){_0x359695[_0xb675('0xc3')]+='x';}if(_0x359695[_0xb675('0xc3')]['indexOf']('X')<0x0){_0x359695[_0xb675('0xc3')]+='X';}this['channel'][_0xb675('0x86')](_0xb675('0x150'),_0x388468?_0x388468[_0xb675('0x151')]():'');var _0x53f8ce=this['channel']['exec'](_0xb675('0x152'),[_0x388468,_0x359695[_0xb675('0xc3')],_0x359695[_0xb675('0xc4')],_0x12ae4e,_0x359695[_0xb675('0x8f')],_0x359695[_0xb675('0x8')],_0x359695[_0xb675('0x153')],_0x359695[_0xb675('0x154')],'',_0x359695[_0xb675('0x155')]]);if(_0x53f8ce[_0xb675('0x9a')]===-0x1){return _0x53f8ce;}return this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x9b'),_0xb675('0x152'),_0x388468));};AGIVertices[_0xb675('0x10')]['record']=function(_0x580263){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x156'),_0x580263[_0xb675('0x3c')]));var _0x27a15d=_0x580263[_0xb675('0x157')]||_0xb675('0x109');var _0x11fb96=util[_0xb675('0x2a')](_0xb675('0x158'),this[_0xb675('0xd')][_0xb675('0x3b')],rs[_0xb675('0xf2')](0x5));var _0x4bb985=util[_0xb675('0x2a')](_0xb675('0x159'),FILES_PATH,_0x11fb96,_0x27a15d);var _0x83ca20=util[_0xb675('0x2a')](_0xb675('0x10a'),FILES_PATH,_0x11fb96);this[_0xb675('0x3f')][_0xb675('0x88')](this,_0x580263,_0x11fb96,_0x4bb985);this[_0xb675('0xd')][_0xb675('0x86')](_0xb675('0x15a'),_0x11fb96);logger[_0xb675('0x30')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x83ca20,_0x27a15d,_0x580263[_0xb675('0x15b')],_0x580263[_0xb675('0x8f')]);return this[_0xb675('0xd')][_0xb675('0x10d')](_0x83ca20,_0x27a15d,_0x580263[_0xb675('0x15b')],_0x580263[_0xb675('0x8f')],undefined,!![]);};AGIVertices['prototype'][_0xb675('0x15c')]=function(_0x51344f){logger[_0xb675('0x30')](util[_0xb675('0x2a')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x51344f[_0xb675('0x3c')]));return this['channel'][_0xb675('0x15d')](_0x51344f['digits'][_0xb675('0xb3')](/\s+/g,''),_0x51344f[_0xb675('0x15b')]);};AGIVertices[_0xb675('0x10')][_0xb675('0x15e')]=function(_0x5e918b){logger[_0xb675('0x30')](util[_0xb675('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x5e918b[_0xb675('0x3c')]));return this['channel'][_0xb675('0x15f')](_0x5e918b[_0xb675('0x160')]['replace'](/\s+/g,''),_0x5e918b[_0xb675('0x15b')]);};AGIVertices['prototype'][_0xb675('0x161')]=function(_0x1104ca){logger[_0xb675('0x30')](util[_0xb675('0x2a')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1104ca[_0xb675('0x3c')]));return this[_0xb675('0xd')][_0xb675('0x162')](_0x1104ca[_0xb675('0x62')],_0x1104ca[_0xb675('0x15b')]);};AGIVertices[_0xb675('0x10')]['sendMail']=function(_0x4e623b){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x163'),_0x4e623b[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x4e623b[_0xb675('0x164')])){return this['channel'][_0xb675('0x95')](_0xb675('0x165'));}var _0x3f51e3=this[_0xb675('0x23')]['sync'](this,_0x4e623b[_0xb675('0x164')]);if(!_0x3f51e3||!_0x3f51e3['Smtp']){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x4e623b,'no\x20mail\x20account\x20found');}var _0x288e8f={'from':util[_0xb675('0x2a')](_0xb675('0x166'),_0x3f51e3[_0xb675('0x13')],_0x3f51e3[_0xb675('0x167')]||_0x3f51e3[_0xb675('0x168')]['user']),'to':_0x4e623b['to']||'','cc':_0x4e623b['cc']||'','bcc':_0x4e623b[_0xb675('0x169')]||'','subject':_0x4e623b[_0xb675('0x16a')],'html':_0x4e623b[_0xb675('0x62')],'text':_0x4e623b[_0xb675('0x62')]};var _0x18ca42={'tls':{'rejectUnauthorized':![]}};if(_0x3f51e3['Smtp'][_0xb675('0x16b')]){_0x18ca42['service']=_0x3f51e3[_0xb675('0x168')][_0xb675('0x16b')];}else{_0x18ca42[_0xb675('0x16c')]=_0x3f51e3[_0xb675('0x168')][_0xb675('0x16c')];_0x18ca42[_0xb675('0x16d')]=_0x3f51e3[_0xb675('0x168')]['port'];_0x18ca42[_0xb675('0x16e')]=_0x3f51e3['Smtp'][_0xb675('0x16e')];}if(_0x3f51e3[_0xb675('0x168')][_0xb675('0x16f')]){_0x18ca42[_0xb675('0x170')]={'user':_0x3f51e3[_0xb675('0x168')][_0xb675('0x171')],'pass':_0x3f51e3['Smtp'][_0xb675('0x172')]};}if(this[_0xb675('0x6a')](_0x4e623b[_0xb675('0x173')])){}logger['debug']('sendMail\x20message',JSON['stringify'](_0x288e8f));this['createSquareDetailsReport'][_0xb675('0x88')](this,_0x4e623b,_0x4e623b[_0xb675('0x164')]);this[_0xb675('0xd')][_0xb675('0x95')](util['format'](_0xb675('0x174'),_0x3f51e3[_0xb675('0x13')]));this[_0xb675('0x24')][_0xb675('0x88')](this,_0x18ca42,_0x288e8f);return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0x175'));};AGIVertices['prototype'][_0xb675('0x176')]=function(_0x488471){logger['info'](util['format'](_0xb675('0x177'),_0x488471[_0xb675('0x3c')]));return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0x178'));};AGIVertices[_0xb675('0x10')][_0xb675('0x179')]=function(_0x665977){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x17a'),_0x665977[_0xb675('0x3c')]));if(!this['isConfigured'](_0x665977[_0xb675('0x17b')])){return this[_0xb675('0xd')]['noop'](_0xb675('0x17c'));}var _0x3fae71=this[_0xb675('0x37')][_0xb675('0x88')](this,_0x665977['sms_account_id']);if(!_0x3fae71){return this['channel'][_0xb675('0x2e')](_0x665977,_0xb675('0x17d'));}var _0x26dc7e={'body':_0x665977['sms_text'],'phone':_0x665977['to']||'','SmsAccountId':_0x3fae71['id']};logger[_0xb675('0xbc')](_0xb675('0x17e'),JSON[_0xb675('0xef')](_0x26dc7e));this[_0xb675('0x3a')]['sync'](this,_0x665977,_0x665977[_0xb675('0x17b')]);this['channel'][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x17f'),_0x3fae71[_0xb675('0x13')]));this[_0xb675('0x39')][_0xb675('0x88')](this,_0x26dc7e);return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0x180'));};AGIVertices[_0xb675('0x10')][_0xb675('0x181')]=function(_0x2f01f0){logger[_0xb675('0x30')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x2f01f0[_0xb675('0x3c')]));if(!this[_0xb675('0x6a')](_0x2f01f0[_0xb675('0xb5')])){return this[_0xb675('0xd')]['error'](_0x2f01f0,'no\x20variable\x20selected');}var _0x5b8cb9=this[_0xb675('0x11')][_0xb675('0x88')](this,_0x2f01f0[_0xb675('0xb5')]);if(!_0x5b8cb9){return this['channel'][_0xb675('0x2e')](_0x2f01f0,_0xb675('0xb7'));}return this[_0xb675('0xd')][_0xb675('0x86')](_0x5b8cb9,_0x2f01f0[_0xb675('0x182')]);};AGIVertices[_0xb675('0x10')]['start']=function(_0x59d129){logger['info'](util[_0xb675('0x2a')](_0xb675('0x183'),_0x59d129[_0xb675('0x3c')]));this[_0xb675('0xd')][_0xb675('0x95')]('START\x20CALLY\x20SQUARE');if(_0x59d129[_0xb675('0x8c')]===_0xb675('0x184')){this[_0xb675('0xd')][_0xb675('0x95')]('Answer');return this[_0xb675('0xd')][_0xb675('0x8c')]();}return this['channel'][_0xb675('0x95')](_0xb675('0x185'));};AGIVertices[_0xb675('0x10')][_0xb675('0x186')]=function(_0x1b3f8e){logger[_0xb675('0x30')](util[_0xb675('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x1b3f8e[_0xb675('0x3c')]));if(!this['isConfigured'](_0x1b3f8e[_0xb675('0x187')])){return this['channel'][_0xb675('0x2e')](_0x1b3f8e,'no\x20subproject\x20selected');}var _0x44f5c6=this[_0xb675('0x17')][_0xb675('0x88')](this,_0x1b3f8e[_0xb675('0x187')]);if(!this[_0xb675('0x6a')](_0x44f5c6)){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x1b3f8e,util[_0xb675('0x2a')](_0xb675('0x188'),_0x1b3f8e[_0xb675('0x187')]));}if(_0x44f5c6===this[_0xb675('0xd')][_0xb675('0x3e')]){return this['channel']['error'](_0x1b3f8e,_0xb675('0x189'));}this['createSquareDetailsReport'][_0xb675('0x88')](this,_0x1b3f8e,_0x44f5c6);var _0x4fd85d=this['channel'][_0xb675('0x5f')]('AGI',util[_0xb675('0x2a')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0xb675('0x16c')]||_0xb675('0x18a'),_0x44f5c6,this[_0xb675('0xd')][_0xb675('0x3e')]));if(_0x4fd85d[_0xb675('0x9a')]===-0x1){return _0x4fd85d;}return this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x9b'),_0xb675('0x18b'),_0x44f5c6));};AGIVertices[_0xb675('0x10')][_0xb675('0x18c')]=function(_0x4c002b){logger[_0xb675('0x30')](util['format'](_0xb675('0x18d'),_0x4c002b['label']));var _0x1bfc13=this[_0xb675('0x5e')][_0xb675('0x88')](this,_0x4c002b['command']);this[_0xb675('0x3a')][_0xb675('0x88')](this,_0x4c002b,_0x4c002b['command']);if(this[_0xb675('0x6a')](_0x4c002b[_0xb675('0xb5')])){var _0x12315a=this[_0xb675('0x11')]['sync'](this,_0x4c002b[_0xb675('0xb5')]);if(_0x12315a){this[_0xb675('0xd')][_0xb675('0x86')](_0x12315a,_0x1bfc13);return this[_0xb675('0xd')][_0xb675('0x95')](util['format'](_0xb675('0x18e'),_0x4c002b[_0xb675('0x8a')],_0x12315a));}}return this[_0xb675('0xd')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x4c002b[_0xb675('0x8a')]));};AGIVertices[_0xb675('0x10')][_0xb675('0x18f')]=function(_0x2557ac){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x190'),_0x2557ac['label']));if(!this[_0xb675('0x6a')](_0x2557ac[_0xb675('0x62')])){return this[_0xb675('0xd')][_0xb675('0x95')](_0xb675('0xa1'));}this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')]('Trying\x20Google\x20TTS\x20%s',_0x2557ac[_0xb675('0x62')]));var _0x2e1323=this[_0xb675('0x61')][_0xb675('0x88')](this,_0x2557ac);if(_0x2e1323){this[_0xb675('0xd')][_0xb675('0x95')](util['format'](_0xb675('0x191'),_0x2e1323));var _0x4944c2=this[_0xb675('0xd')][_0xb675('0xdb')](_0x2e1323);try{fs[_0xb675('0x130')](_0x2e1323+_0xb675('0xdc'));}catch(_0x2fc21a){logger[_0xb675('0x2e')](_0x2fc21a);}return _0x4944c2;}return this[_0xb675('0xd')][_0xb675('0x2e')](_0x2557ac,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xb675('0x10')][_0xb675('0x192')]=function(_0x1a482b){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x193'),_0x1a482b['label']));if(!this['isConfigured'](_0x1a482b['findBy'])){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x1a482b,'no\x20find\x20by\x20configured');}logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x136'),this[_0xb675('0xd')]['callerid'],_0x1a482b[_0xb675('0x134')]));var _0x934697=this['agentUnpause'][_0xb675('0x88')](this,_0x1a482b[_0xb675('0x134')]);if(_0x934697){logger['info'](util['format'](_0xb675('0x137'),this[_0xb675('0xd')]['callerid'],_0x1a482b[_0xb675('0x134')]));this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x137'),this[_0xb675('0xd')]['callerid'],_0x1a482b[_0xb675('0x134')]));return{'code':0xc8,'result':_0xb675('0x138')};}else{logger['info'](util['format'](_0xb675('0x139'),this[_0xb675('0xd')]['callerid'],_0x1a482b[_0xb675('0x134')]));this[_0xb675('0xd')][_0xb675('0x95')](util[_0xb675('0x2a')](_0xb675('0x139'),this['channel']['callerid'],_0x1a482b[_0xb675('0x134')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb675('0x10')][_0xb675('0x194')]=function(_0x1d96cc){logger[_0xb675('0x30')](util[_0xb675('0x2a')](_0xb675('0x195'),_0x1d96cc[_0xb675('0x3c')]));var _0x178361=this[_0xb675('0xd')][_0xb675('0x5f')](_0xb675('0x196'),[_0x1d96cc['mailbox'],_0x1d96cc[_0xb675('0x99')]]);if(_0x178361['result']===-0x1){return _0x178361;}return this['channel']['noop'](util[_0xb675('0x2a')](_0xb675('0x9b'),_0xb675('0x196'),_0x1d96cc[_0xb675('0x197')]));};AGIVertices[_0xb675('0x10')][_0xb675('0x198')]=function(_0x40c1fc){logger[_0xb675('0x30')](util[_0xb675('0x2a')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x40c1fc[_0xb675('0x3c')]));if(!this['isConfigured'](_0x40c1fc['variable_id'])){return this[_0xb675('0xd')][_0xb675('0x2e')](_0x40c1fc,_0xb675('0x199'));}var _0x3f535=this['getVariable'][_0xb675('0x88')](this,_0x40c1fc[_0xb675('0xb5')]);if(!_0x3f535){return this['channel']['error'](_0x40c1fc,_0xb675('0xb7'));}var _0x2bd8d2=this[_0xb675('0xd')][_0xb675('0x11')](_0x3f535);return{'code':0xc8,'result':_0x2bd8d2[_0xb675('0x83')]?_0x2bd8d2[_0xb675('0x83')]:'-'};};String[_0xb675('0x10')][_0xb675('0x19a')]=function(_0x54696e,_0x4eae52){return this[_0xb675('0x81')](_0x54696e)['join'](_0x4eae52);};module[_0xb675('0x19b')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3bcb8dd..da4f88a 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 _0xae24=['then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','format','updateAcw','lastPauseAt','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','prototype','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','stringify','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../../../config/logger','acw','voiceQueues','agents','timers','channels','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','startAcw','interface','queue','mandatoryDispositionPause','name','Action','QueuePause'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xae24,0x182));var _0x4ae2=function(_0x4c3ffd,_0x3fdf01){_0x4c3ffd=_0x4c3ffd-0x0;var _0x4985c2=_0xae24[_0x4c3ffd];return _0x4985c2;};'use strict';var util=require(_0x4ae2('0x0'));var _=require('lodash');var moment=require(_0x4ae2('0x1'));var ami=require('../ami');var logger=require(_0x4ae2('0x2'))(_0x4ae2('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1afc7a){this['voiceQueues']=_0x1afc7a[_0x4ae2('0x4')];this[_0x4ae2('0x5')]=_0x1afc7a[_0x4ae2('0x5')];this[_0x4ae2('0x6')]=_0x1afc7a[_0x4ae2('0x6')];this[_0x4ae2('0x7')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x4ae2('0x8')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x4ae2('0x8')](this));ami['on'](_0x4ae2('0x9'),this['syncHangup'][_0x4ae2('0x8')](this));ami['on'](_0x4ae2('0xa'),this[_0x4ae2('0xb')][_0x4ae2('0x8')](this));ami['on']('attendedtransfer',this[_0x4ae2('0xc')][_0x4ae2('0x8')](this));ami['on'](_0x4ae2('0xd'),this['syncBlindTransfer'][_0x4ae2('0x8')](this));ami['on'](_0x4ae2('0xe'),this[_0x4ae2('0xf')][_0x4ae2('0x8')](this));}function getDiff(_0x24de98){var _0x40954f=moment()[_0x4ae2('0x10')](0x0);var _0x3cabc9=moment(_0x24de98)[_0x4ae2('0x10')](0x0);return _0x40954f['diff'](_0x3cabc9,'seconds');}Acw['prototype'][_0x4ae2('0x11')]=function(_0xf834a1){try{var _0x5f447a=this;var _0x463765=this[_0x4ae2('0x7')][_0xf834a1][_0x4ae2('0x12')];var _0x1d5a78=this[_0x4ae2('0x7')][_0xf834a1][_0x4ae2('0x13')];var _0x3d4259=this[_0x4ae2('0x4')][_0x1d5a78];var _0x41b672=![];var _0x18936a='ACW';if(_0x3d4259['mandatoryDisposition']){if(_0x3d4259[_0x4ae2('0x14')][_0x4ae2('0x15')]){_0x41b672=!![];_0x18936a=_0x3d4259['mandatoryDispositionPause'][_0x4ae2('0x15')];}}ami[_0x4ae2('0x16')]({'action':_0x4ae2('0x17'),'interface':_0x463765,'paused':!![],'reason':_0x18936a})[_0x4ae2('0x18')](function(_0x8732bb){if(_0x5f447a['agents'][_0x463765]){return RpcUser[_0x4ae2('0x19')](_0x5f447a['agents'][_0x463765]['id'])['then'](function(_0x2ceec4){if(_0x2ceec4&&!_0x2ceec4[_0x4ae2('0x1a')]){logger[_0x4ae2('0x1b')](_0x4ae2('0x1c'),_0xf834a1,_0x463765,_0x1d5a78);var _0xca16bf=_0x5f447a['channels'][_0xf834a1][_0x4ae2('0x1d')]&&_0x5f447a['channels'][_0xf834a1][_0x4ae2('0x1e')]?_0x5f447a[_0x4ae2('0x7')][_0xf834a1][_0x4ae2('0x1e')]:_0xf834a1;return RpcUser['savePause'](_0x5f447a[_0x4ae2('0x5')][_0x463765],_0x18936a,_0xca16bf)[_0x4ae2('0x18')](function(_0x2454b3){if(!_0x41b672){_0x5f447a[_0x4ae2('0x6')][_0x463765]={};logger[_0x4ae2('0x1b')](_0x4ae2('0x1f'),_0xf834a1,_0x5f447a['voiceQueues'][_0x1d5a78]['acwTimeout'],_0x463765,_0x1d5a78);_0x5f447a[_0x4ae2('0x6')][_0x463765][_0x4ae2('0x20')]=setTimeout(_0x5f447a[_0x4ae2('0x21')][_0x4ae2('0x8')](_0x5f447a,_0x463765),_0x5f447a[_0x4ae2('0x4')][_0x1d5a78][_0x4ae2('0x22')]*0x3e8);_0x5f447a['timers'][_0x463765]['lastPauseAt']=moment()[_0x4ae2('0x23')]('YYYY-MM-DD\x20HH:mm:ss');_0x5f447a['timers'][_0x463765]['uniqueid']=_0xf834a1;_0x5f447a[_0x4ae2('0x6')][_0x463765][_0x4ae2('0x13')]=_0x1d5a78;_0x5f447a['timers'][_0x463765][_0x4ae2('0x24')]=function(){var _0x37e3e5=getDiff(_0x5f447a[_0x4ae2('0x6')][_0x463765][_0x4ae2('0x25')]);clearTimeout(_0x5f447a[_0x4ae2('0x6')][_0x463765][_0x4ae2('0x20')]);_0x5f447a[_0x4ae2('0x6')][_0x463765][_0x4ae2('0x20')]=![];RpcVoiceAgentReport[_0x4ae2('0x26')]({'acwtime':_0x37e3e5},_0x5f447a[_0x4ae2('0x6')][_0x463765][_0x4ae2('0x27')],_0x463765)[_0x4ae2('0x18')](function(_0x3ab303){logger[_0x4ae2('0x1b')](_0x4ae2('0x28'),_0xf834a1,_0x37e3e5,_0x3ab303);})[_0x4ae2('0x29')](function(_0x451d2a){logger['error'](_0x4ae2('0x2a'),_0xf834a1,_0x451d2a);});delete _0x5f447a['timers'][_0x463765];};}});}else{logger[_0x4ae2('0x1b')](_0x4ae2('0x2b'),_0xf834a1,_0x463765,_0x1d5a78);}});}})['catch'](function(_0x1516b8){logger[_0x4ae2('0x2c')](_0x4ae2('0x1f'),_0xf834a1,_0x5f447a[_0x4ae2('0x4')][_0x1d5a78]['acwTimeout'],_0x463765,_0x1d5a78);})[_0x4ae2('0x2d')](function(){delete _0x5f447a[_0x4ae2('0x7')][_0xf834a1];});}catch(_0x29458e){logger[_0x4ae2('0x2c')](_0x4ae2('0x2e'),_0x29458e[_0x4ae2('0x2f')]);}};Acw[_0x4ae2('0x30')][_0x4ae2('0x21')]=function(_0xe99f9d){try{var _0x5c5c7d=this;if(_0x5c5c7d[_0x4ae2('0x6')][_0xe99f9d]){_0x5c5c7d['timers'][_0xe99f9d][_0x4ae2('0x20')]=![];var _0x41b0f4=_0x5c5c7d[_0x4ae2('0x6')][_0xe99f9d][_0x4ae2('0x27')];var _0x771c14=_0x5c5c7d[_0x4ae2('0x6')][_0xe99f9d]['queue'];var _0x38f12f=_0x5c5c7d[_0x4ae2('0x4')][_0x771c14][_0x4ae2('0x22')];logger[_0x4ae2('0x1b')]('[TIMER][STOP][AGENT:%s]',_0xe99f9d);RpcUser[_0x4ae2('0x31')](this[_0x4ae2('0x5')][_0xe99f9d]);RpcVoiceAgentReport[_0x4ae2('0x26')]({'acwtime':_0x38f12f,'agentacw':!![]},_0x41b0f4,_0xe99f9d)[_0x4ae2('0x18')](function(_0x232243){logger[_0x4ae2('0x1b')](_0x4ae2('0x28'),_0x41b0f4,_0x38f12f,_0x232243);})[_0x4ae2('0x29')](function(_0x1d5888){logger[_0x4ae2('0x2c')](_0x4ae2('0x2a'),_0x41b0f4,_0x1d5888);});}else{logger['error'](_0x4ae2('0x32'),_0xe99f9d);if(_0x5c5c7d[_0x4ae2('0x6')]){logger[_0x4ae2('0x1b')](_0x4ae2('0x33'),JSON['stringify'](_0x5c5c7d['timers']));}}}catch(_0xd46eed){logger[_0x4ae2('0x2c')](_0x4ae2('0x34'),_0xd46eed[_0x4ae2('0x2f')]);}};Acw['prototype'][_0x4ae2('0x35')]=function(_0x178898){try{if(this['voiceQueues'][_0x178898[_0x4ae2('0x13')]]&&(this[_0x4ae2('0x4')][_0x178898[_0x4ae2('0x13')]]['acw']||this[_0x4ae2('0x4')][_0x178898[_0x4ae2('0x13')]][_0x4ae2('0x36')])){if(this[_0x4ae2('0x5')][_0x178898[_0x4ae2('0x12')]]){this[_0x4ae2('0x7')][_0x178898[_0x4ae2('0x27')]]={'queue':_0x178898[_0x4ae2('0x13')],'interface':_0x178898['interface'],'destlinkedid':_0x178898[_0x4ae2('0x1e')]};}}}catch(_0x1bb9e2){logger['error'](_0x4ae2('0x37'),_0x1bb9e2[_0x4ae2('0x2f')]);}};Acw['prototype'][_0x4ae2('0xf')]=function(_0x30ac85){try{if(this['voiceQueues'][_0x30ac85[_0x4ae2('0x13')]]&&(this[_0x4ae2('0x4')][_0x30ac85[_0x4ae2('0x13')]]['acw']||this['voiceQueues'][_0x30ac85[_0x4ae2('0x13')]][_0x4ae2('0x36')])){if(this[_0x4ae2('0x5')][_0x30ac85[_0x4ae2('0x12')]]){this['channels'][_0x30ac85[_0x4ae2('0x27')]]={'queue':_0x30ac85[_0x4ae2('0x13')],'interface':_0x30ac85[_0x4ae2('0x12')]};}}}catch(_0x5843d7){logger[_0x4ae2('0x2c')](_0x4ae2('0x38'),_0x5843d7[_0x4ae2('0x2f')]);}};Acw['prototype'][_0x4ae2('0x39')]=function(_0x24ec08){try{if(this[_0x4ae2('0x7')][_0x24ec08[_0x4ae2('0x27')]]&&_[_0x4ae2('0x3a')](this[_0x4ae2('0x7')][_0x24ec08[_0x4ae2('0x27')]][_0x4ae2('0x1d')])){logger[_0x4ae2('0x1b')](_0x4ae2('0x3b'),_0x24ec08['uniqueid']);this[_0x4ae2('0x11')](_0x24ec08[_0x4ae2('0x27')]);}else if(this[_0x4ae2('0x7')][_0x24ec08[_0x4ae2('0x3c')]]&&_[_0x4ae2('0x3a')](this[_0x4ae2('0x7')][_0x24ec08[_0x4ae2('0x3c')]][_0x4ae2('0x1d')])){logger['info'](_0x4ae2('0x3d'),_0x24ec08[_0x4ae2('0x3c')]);this['startAcw'](_0x24ec08[_0x4ae2('0x3c')]);}}catch(_0x3c5f8d){logger['error'](_0x4ae2('0x3e'),_0x3c5f8d['message']);}};Acw[_0x4ae2('0x30')]['syncHangup']=function(_0x1ae8bb){try{if(this[_0x4ae2('0x7')][_0x1ae8bb[_0x4ae2('0x27')]]&&this[_0x4ae2('0x7')][_0x1ae8bb[_0x4ae2('0x27')]][_0x4ae2('0x1d')]){logger[_0x4ae2('0x1b')](_0x4ae2('0x3f'),_0x1ae8bb[_0x4ae2('0x27')]);this['startAcw'](_0x1ae8bb[_0x4ae2('0x27')]);}else if(this[_0x4ae2('0x7')][_0x1ae8bb[_0x4ae2('0x3c')]]&&this[_0x4ae2('0x7')][_0x1ae8bb['linkedid']][_0x4ae2('0x1d')]){logger[_0x4ae2('0x1b')](_0x4ae2('0x40'),_0x1ae8bb['linkedid']);this['startAcw'](_0x1ae8bb[_0x4ae2('0x3c')]);}}catch(_0x1be528){logger[_0x4ae2('0x2c')](_0x4ae2('0x41'),_0x1be528[_0x4ae2('0x2f')]);}};Acw[_0x4ae2('0x30')][_0x4ae2('0xc')]=function(_0x390c1f){try{if(!_[_0x4ae2('0x42')](this['channels'][_0x390c1f[_0x4ae2('0x43')]])){this['startAcw'](_0x390c1f[_0x4ae2('0x43')]);if(this[_0x4ae2('0x7')][_0x390c1f[_0x4ae2('0x44')]]){this[_0x4ae2('0x7')][_0x390c1f[_0x4ae2('0x44')]][_0x4ae2('0x1d')]=!![];this[_0x4ae2('0x7')][_0x390c1f[_0x4ae2('0x45')]]=this['channels'][_0x390c1f['secondtransfereruniqueid']];delete this[_0x4ae2('0x7')][_0x390c1f[_0x4ae2('0x44')]];}}else if(!_[_0x4ae2('0x42')](this['channels'][_0x390c1f['transfertargetuniqueid']])){this[_0x4ae2('0x11')](_0x390c1f[_0x4ae2('0x45')]);if(this[_0x4ae2('0x7')][_0x390c1f[_0x4ae2('0x46')]]){this[_0x4ae2('0x7')][_0x390c1f['origtransfereruniqueid']]['attended']=!![];this['channels'][_0x390c1f[_0x4ae2('0x43')]]=this['channels'][_0x390c1f['origtransfereruniqueid']];delete this[_0x4ae2('0x7')][_0x390c1f['origtransfereruniqueid']];}}}catch(_0x3efbaf){logger['error'](_0x4ae2('0x47'),_0x3efbaf['message']);}};Acw[_0x4ae2('0x30')]['syncBlindTransfer']=function(_0x3d4f11){try{if(this[_0x4ae2('0x7')][_0x3d4f11[_0x4ae2('0x48')]]){logger[_0x4ae2('0x1b')](_0x4ae2('0x49'),JSON['stringify'](_0x3d4f11['transfereruniqueid']));this[_0x4ae2('0x11')](_0x3d4f11[_0x4ae2('0x48')]);}else if(this['channels'][_0x3d4f11[_0x4ae2('0x4a')]]){logger[_0x4ae2('0x1b')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x4ae2('0x4b')](_0x3d4f11[_0x4ae2('0x4a')]));this['startAcw'](_0x3d4f11['transfererlinkedid']);}}catch(_0x15a6aa){logger[_0x4ae2('0x2c')]('[ACW][syncBlindTransfer]\x20%s',_0x15a6aa[_0x4ae2('0x2f')]);}};Acw[_0x4ae2('0x30')][_0x4ae2('0xb')]=function(_0x30003b){try{if(this['voiceQueues'][_0x30003b[_0x4ae2('0x13')]]&&this[_0x4ae2('0x4')][_0x30003b['queue']][_0x4ae2('0x4c')]===_0x4ae2('0x4d')){if(this[_0x4ae2('0x5')][_0x30003b['interface']]){logger['info'](_0x4ae2('0x4e'),_0x30003b['uniqueid'],_0x30003b[_0x4ae2('0x12')],_0x30003b['queue']);return RpcUser[_0x4ae2('0x4f')](this['agents'][_0x30003b[_0x4ae2('0x12')]],'Auto-Pause',_0x30003b[_0x4ae2('0x27')]);}}}catch(_0x5e593e){logger['error'](_0x4ae2('0x50'),_0x5e593e[_0x4ae2('0x2f')]);}};module[_0x4ae2('0x51')]=Acw; \ No newline at end of file +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(_0x58dd9e,_0x283816){var _0xbcc1d1=function(_0x2d2ff4){while(--_0x2d2ff4){_0x58dd9e['push'](_0x58dd9e['shift']());}};_0xbcc1d1(++_0x283816);}(_0x7da7,0x10d));var _0x77da=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x7da7[_0x1627ae];return _0x34b38f;};'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 diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 491e235..bb17f57 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 _0x47f3=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','log','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','asterisk','port','username','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown'];(function(_0x5af0cc,_0x2db3ad){var _0x2b6078=function(_0x2de631){while(--_0x2de631){_0x5af0cc['push'](_0x5af0cc['shift']());}};_0x2b6078(++_0x2db3ad);}(_0x47f3,0xc0));var _0x347f=function(_0x5c6c48,_0x22ff27){_0x5c6c48=_0x5c6c48-0x0;var _0x4362dd=_0x47f3[_0x5c6c48];return _0x4362dd;};'use strict';var Manager=require(_0x347f('0x0'));var BPromise=require(_0x347f('0x1'));var moment=require('moment');var util=require(_0x347f('0x2'));var _=require(_0x347f('0x3'));var logger=require(_0x347f('0x4'))(_0x347f('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x347f('0x6')][_0x347f('0x7')],config[_0x347f('0x6')]['ip'],config[_0x347f('0x6')][_0x347f('0x8')],config['asterisk']['password'],!![]);ami[_0x347f('0x9')]();ami[_0x347f('0xa')]=BPromise[_0x347f('0xb')](ami[_0x347f('0xc')]);function error(_0x394888){logger[_0x347f('0xd')](util[_0x347f('0xe')](_0x347f('0xf'),config[_0x347f('0x6')]['username'],config['asterisk']['ip'],config[_0x347f('0x6')][_0x347f('0x7')],util[_0x347f('0x10')](_0x394888,![],null)));}function close(){logger[_0x347f('0xd')](util['format'](_0x347f('0x11'),config[_0x347f('0x6')]['username'],config[_0x347f('0x6')]['ip'],config[_0x347f('0x6')][_0x347f('0x7')]));}ami[_0x347f('0x12')]=function(){return function(){return ami[_0x347f('0xa')]({'action':_0x347f('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x347f('0x14')]=function(){return function(){return ami[_0x347f('0xa')]({'action':_0x347f('0x15')});};};ami[_0x347f('0x16')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x347f('0xa')]({'action':_0x347f('0x17')});};};function connect(_0x449ffb){logger[_0x347f('0x18')](util[_0x347f('0xe')](_0x347f('0x19'),config[_0x347f('0x6')][_0x347f('0x8')],config[_0x347f('0x6')]['ip'],config[_0x347f('0x6')][_0x347f('0x7')]));ami['once']('error',error);ami[_0x347f('0x1a')](_0x347f('0x1b'),close);}ami['on'](_0x347f('0x1c'),connect);ami['on'](_0x347f('0x1d'),function(_0x2257d6){logger[_0x347f('0x18')](util['format'](_0x347f('0x1e'),config[_0x347f('0x6')]['username'],config[_0x347f('0x6')]['ip'],config[_0x347f('0x6')][_0x347f('0x7')],util['inspect'](_0x2257d6,![],null)));});ami['on'](_0x347f('0x1f'),function(_0x30b4be){logger[_0x347f('0x18')](util[_0x347f('0xe')](_0x347f('0x20'),config[_0x347f('0x6')][_0x347f('0x8')],config[_0x347f('0x6')]['ip'],config[_0x347f('0x6')]['port']));return BPromise[_0x347f('0x21')]()['then'](ami['actionSipShowRegistry']())[_0x347f('0x22')](ami['actionDeviceStateList']())[_0x347f('0x22')](ami[_0x347f('0x14')]())[_0x347f('0x22')](ami[_0x347f('0x16')]())[_0x347f('0x22')](ami[_0x347f('0x23')]())['catch'](function(_0x29a7a3){console[_0x347f('0x24')](_0x29a7a3);});});ami[_0x347f('0x1a')]('error',error);ami[_0x347f('0x1a')]('close',close);module['exports']=ami; \ No newline at end of file +var _0x799e=['catch','log','bluebird','moment','util','lodash','../../config/logger','ami','port','asterisk','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels'];(function(_0x2e6dee,_0x1a61b0){var _0x47706=function(_0x365546){while(--_0x365546){_0x2e6dee['push'](_0x2e6dee['shift']());}};_0x47706(++_0x1a61b0);}(_0x799e,0x74));var _0xe799=function(_0x1cd14a,_0x2ee01b){_0x1cd14a=_0x1cd14a-0x0;var _0x434a4c=_0x799e[_0x1cd14a];return _0x434a4c;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xe799('0x0'));var moment=require(_0xe799('0x1'));var util=require(_0xe799('0x2'));var _=require(_0xe799('0x3'));var logger=require(_0xe799('0x4'))(_0xe799('0x5'));var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0xe799('0x6')],config[_0xe799('0x7')]['ip'],config[_0xe799('0x7')]['username'],config[_0xe799('0x7')][_0xe799('0x8')],!![]);ami[_0xe799('0x9')]();ami['Action']=BPromise[_0xe799('0xa')](ami[_0xe799('0xb')]);function error(_0x181a64){logger[_0xe799('0xc')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xe799('0x7')]['username'],config[_0xe799('0x7')]['ip'],config['asterisk'][_0xe799('0x6')],util['inspect'](_0x181a64,![],null)));}function close(){logger[_0xe799('0xc')](util[_0xe799('0xd')](_0xe799('0xe'),config['asterisk'][_0xe799('0xf')],config[_0xe799('0x7')]['ip'],config[_0xe799('0x7')][_0xe799('0x6')]));}ami[_0xe799('0x10')]=function(){return function(){return ami[_0xe799('0x11')]({'action':_0xe799('0x12')});};};ami[_0xe799('0x13')]=function(){return function(){return ami[_0xe799('0x11')]({'action':_0xe799('0x14')});};};ami[_0xe799('0x15')]=function(){return function(){return ami[_0xe799('0x11')]({'action':'sippeerstatus'});};};ami[_0xe799('0x16')]=function(){return function(){return ami[_0xe799('0x11')]({'action':_0xe799('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xe799('0x11')]({'action':_0xe799('0x18')});};};function connect(_0x173666){logger[_0xe799('0x19')](util[_0xe799('0xd')](_0xe799('0x1a'),config[_0xe799('0x7')]['username'],config[_0xe799('0x7')]['ip'],config[_0xe799('0x7')][_0xe799('0x6')]));ami[_0xe799('0x1b')](_0xe799('0xc'),error);ami[_0xe799('0x1b')](_0xe799('0x1c'),close);}ami['on'](_0xe799('0x1d'),connect);ami['on'](_0xe799('0x1e'),function(_0x42792d){logger[_0xe799('0x19')](util[_0xe799('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xe799('0xf')],config[_0xe799('0x7')]['ip'],config[_0xe799('0x7')][_0xe799('0x6')],util['inspect'](_0x42792d,![],null)));});ami['on'](_0xe799('0x1f'),function(_0x463a8f){logger['info'](util[_0xe799('0xd')](_0xe799('0x20'),config[_0xe799('0x7')]['username'],config[_0xe799('0x7')]['ip'],config[_0xe799('0x7')][_0xe799('0x6')]));return BPromise[_0xe799('0x21')]()[_0xe799('0x22')](ami['actionSipShowRegistry']())['then'](ami[_0xe799('0x13')]())[_0xe799('0x22')](ami['actionSipPeerStatus']())[_0xe799('0x22')](ami[_0xe799('0x16')]())[_0xe799('0x22')](ami[_0xe799('0x23')]())[_0xe799('0x24')](function(_0x32460b){console[_0xe799('0x25')](_0x32460b);});});ami[_0xe799('0x1b')]('error',error);ami[_0xe799('0x1b')](_0xe799('0x1c'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index e2166f7..58277b2 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 _0xb430=['Request','request','then','debug','rpc','memberReport','error','message','result','exports','jayson/promise','bluebird','ami','client','http'];(function(_0x5164b6,_0x14bbc1){var _0x397b10=function(_0x178361){while(--_0x178361){_0x5164b6['push'](_0x5164b6['shift']());}};_0x397b10(++_0x14bbc1);}(_0xb430,0x64));var _0x0b43=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0xb430[_0x5caf7e];return _0x5c3435;};'use strict';var jayson=require(_0x0b43('0x0'));var BPromise=require(_0x0b43('0x1'));var logger=require('../../config/logger')(_0x0b43('0x2'));var client=jayson[_0x0b43('0x3')][_0x0b43('0x4')]({'port':0x2329});client[_0x0b43('0x5')]=function(_0x5880fd,_0x4ce2b5){return new BPromise(function(_0xbfb8fc,_0x514ee9){return client[_0x0b43('0x6')](_0x5880fd,_0x4ce2b5)[_0x0b43('0x7')](function(_0x4e304b){logger[_0x0b43('0x8')](_0x0b43('0x9'),_0x0b43('0xa'),_0x5880fd,_0x4ce2b5,_0x4e304b);if(_0x4e304b['error']){logger['error'](_0x0b43('0x9'),_0x0b43('0xa'),_0x5880fd,_0x4e304b[_0x0b43('0xb')][_0x0b43('0xc')],_0x4ce2b5);return _0x514ee9(_0x4e304b[_0x0b43('0xb')]['message']);}else{return _0xbfb8fc(_0x4e304b[_0x0b43('0xd')]);}})['catch'](function(_0x4f52d7){logger[_0x0b43('0xb')]('rpc',_0x0b43('0xa'),_0x5880fd,_0x4f52d7,_0x4ce2b5);return _0x514ee9(_0x4f52d7);});});};module[_0x0b43('0xe')]=client; \ No newline at end of file +var _0xbc9c=['Request','request','then','debug','memberReport','error','rpc','message','bluebird','../../config/logger','ami','client','http'];(function(_0x9d29f5,_0x306876){var _0x4b950d=function(_0x2cc71d){while(--_0x2cc71d){_0x9d29f5['push'](_0x9d29f5['shift']());}};_0x4b950d(++_0x306876);}(_0xbc9c,0xf2));var _0xcbc9=function(_0x516997,_0x563e77){_0x516997=_0x516997-0x0;var _0x1d0185=_0xbc9c[_0x516997];return _0x1d0185;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xcbc9('0x0'));var logger=require(_0xcbc9('0x1'))(_0xcbc9('0x2'));var client=jayson[_0xcbc9('0x3')][_0xcbc9('0x4')]({'port':0x2329});client[_0xcbc9('0x5')]=function(_0x2fd3d3,_0x4bc233){return new BPromise(function(_0x12279b,_0x20297e){return client[_0xcbc9('0x6')](_0x2fd3d3,_0x4bc233)[_0xcbc9('0x7')](function(_0x1e4c51){logger[_0xcbc9('0x8')]('rpc',_0xcbc9('0x9'),_0x2fd3d3,_0x4bc233,_0x1e4c51);if(_0x1e4c51[_0xcbc9('0xa')]){logger['error'](_0xcbc9('0xb'),_0xcbc9('0x9'),_0x2fd3d3,_0x1e4c51[_0xcbc9('0xa')]['message'],_0x4bc233);return _0x20297e(_0x1e4c51[_0xcbc9('0xa')][_0xcbc9('0xc')]);}else{return _0x12279b(_0x1e4c51['result']);}})['catch'](function(_0xd28ae9){logger[_0xcbc9('0xa')](_0xcbc9('0xb'),_0xcbc9('0x9'),_0x2fd3d3,_0xd28ae9,_0x4bc233);return _0x20297e(_0xd28ae9);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index cc4c751..5f70dd6 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 _0x19ef=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','queue','exports','lodash','moment','string','isNil','voiceQueue','uniqueid','phone','firstName','Contact','lastName','number','name','active','type','dialQueueTimeout'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0x19ef,0x139));var _0xf19e=function(_0x33e20e,_0x36a759){_0x33e20e=_0x33e20e-0x0;var _0x1578a6=_0x19ef[_0x33e20e];return _0x1578a6;};'use strict';var util=require('util');var _=require(_0xf19e('0x0'));var moment=require(_0xf19e('0x1'));function checkNameSurname(_0x4c3c27,_0x3a2b37,_0x6d1655){var _0x5f33b8='';if(!_['isNil'](_0x3a2b37)&&_0xf19e('0x2')===typeof _0x3a2b37){_0x5f33b8+=_0x3a2b37;}if(!_[_0xf19e('0x3')](_0x6d1655)&&_0xf19e('0x2')===typeof _0x6d1655){_0x5f33b8+='\x20'+_0x6d1655;}if(_0x5f33b8!==''){return _0x5f33b8;}return _0x4c3c27;}function Action(_0x2de9fb,_0x32a250,_0x30ee74){this[_0xf19e('0x4')]=_0x2de9fb;this[_0xf19e('0x5')]=_0x30ee74||undefined;this['name']=checkNameSurname(_0x32a250['Contact'][_0xf19e('0x6')],_0x32a250['Contact'][_0xf19e('0x7')],_0x32a250[_0xf19e('0x8')][_0xf19e('0x9')]);this[_0xf19e('0xa')]=_0x32a250[_0xf19e('0x8')][_0xf19e('0x6')];this['queue']=_0x2de9fb[_0xf19e('0xb')];this[_0xf19e('0xc')]=_0x32a250[_0xf19e('0xc')]||![];this[_0xf19e('0xd')]=_0x2de9fb[_0xf19e('0xd')];this[_0xf19e('0xe')]=_0x2de9fb['dialQueueTimeout']||0x3;this[_0xf19e('0xf')]=_0x32a250['scheduledat'];this[_0xf19e('0x10')]=_0x32a250['countbusyretry'];this[_0xf19e('0x11')]=_0x32a250[_0xf19e('0x11')];this[_0xf19e('0x12')]=_0x32a250[_0xf19e('0x12')];this[_0xf19e('0x13')]=_0x32a250[_0xf19e('0x13')];this[_0xf19e('0x14')]=_0x32a250[_0xf19e('0x14')];this[_0xf19e('0x15')]=_0x32a250[_0xf19e('0x15')];this[_0xf19e('0x16')]=_0x32a250[_0xf19e('0x16')];this['CampaignId']=_0x32a250[_0xf19e('0x17')];this[_0xf19e('0x18')]=_0x32a250['id'];this['ContactFirstName']=_0x32a250[_0xf19e('0x8')][_0xf19e('0x7')]||'';this[_0xf19e('0x19')]=moment()[_0xf19e('0x1a')](_0xf19e('0x1b'));this[_0xf19e('0x1c')]=_0x32a250[_0xf19e('0x1c')];this['callbackuniqueid']=_0x32a250['callbackuniqueid'];this[_0xf19e('0x1d')]=_0x32a250[_0xf19e('0x1d')];this[_0xf19e('0x1e')]=_0x32a250['recallme'];this[_0xf19e('0x1f')]='';this[_0xf19e('0x20')]='';}Action[_0xf19e('0x21')][_0xf19e('0x22')]=function(){return util[_0xf19e('0x1a')](_0xf19e('0x23'),this[_0xf19e('0xb')],this[_0xf19e('0x4')]['dialCutDigit']>0x0?this['number'][_0xf19e('0x24')](this[_0xf19e('0x4')][_0xf19e('0x25')]):this[_0xf19e('0xa')]);};Action[_0xf19e('0x21')][_0xf19e('0x26')]=function(){return this[_0xf19e('0x27')];};module[_0xf19e('0x28')]=Action; \ No newline at end of file +var _0x2722=['dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','CampaignId','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','voiceQueue','dialCutDigit','getQueue','queue','exports','util','lodash','moment','isNil','string','uniqueid','name','phone','Contact','firstName','lastName','number','active','type'];(function(_0x10f145,_0x369821){var _0x8893af=function(_0x16ba07){while(--_0x16ba07){_0x10f145['push'](_0x10f145['shift']());}};_0x8893af(++_0x369821);}(_0x2722,0x164));var _0x2272=function(_0x2eb85f,_0x26c164){_0x2eb85f=_0x2eb85f-0x0;var _0x5ad856=_0x2722[_0x2eb85f];return _0x5ad856;};'use strict';var util=require(_0x2272('0x0'));var _=require(_0x2272('0x1'));var moment=require(_0x2272('0x2'));function checkNameSurname(_0x392835,_0x178b6a,_0x526416){var _0x5532c9='';if(!_[_0x2272('0x3')](_0x178b6a)&&_0x2272('0x4')===typeof _0x178b6a){_0x5532c9+=_0x178b6a;}if(!_[_0x2272('0x3')](_0x526416)&&_0x2272('0x4')===typeof _0x526416){_0x5532c9+='\x20'+_0x526416;}if(_0x5532c9!==''){return _0x5532c9;}return _0x392835;}function Action(_0x358f45,_0x52270a,_0xbf7d38){this['voiceQueue']=_0x358f45;this[_0x2272('0x5')]=_0xbf7d38||undefined;this[_0x2272('0x6')]=checkNameSurname(_0x52270a['Contact'][_0x2272('0x7')],_0x52270a[_0x2272('0x8')][_0x2272('0x9')],_0x52270a[_0x2272('0x8')][_0x2272('0xa')]);this[_0x2272('0xb')]=_0x52270a['Contact'][_0x2272('0x7')];this['queue']=_0x358f45[_0x2272('0x6')];this[_0x2272('0xc')]=_0x52270a['active']||![];this['type']=_0x358f45[_0x2272('0xd')];this[_0x2272('0xe')]=_0x358f45['dialQueueTimeout']||0x3;this['scheduledat']=_0x52270a['scheduledat'];this[_0x2272('0xf')]=_0x52270a[_0x2272('0xf')];this[_0x2272('0x10')]=_0x52270a['countcongestionretry'];this[_0x2272('0x11')]=_0x52270a[_0x2272('0x11')];this[_0x2272('0x12')]=_0x52270a[_0x2272('0x12')];this[_0x2272('0x13')]=_0x52270a['ListId'];this[_0x2272('0x14')]=_0x52270a[_0x2272('0x14')];this['VoiceQueueId']=_0x52270a['VoiceQueueId'];this[_0x2272('0x15')]=_0x52270a[_0x2272('0x15')];this['idHopper']=_0x52270a['id'];this[_0x2272('0x16')]=_0x52270a[_0x2272('0x8')][_0x2272('0x9')]||'';this[_0x2272('0x17')]=moment()[_0x2272('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2272('0x19')]=_0x52270a[_0x2272('0x19')];this['callbackuniqueid']=_0x52270a[_0x2272('0x1a')];this['callbackat']=_0x52270a[_0x2272('0x1b')];this[_0x2272('0x1c')]=_0x52270a[_0x2272('0x1c')];this[_0x2272('0x1d')]='';this[_0x2272('0x1e')]='';}Action[_0x2272('0x1f')]['getCaller']=function(){return util[_0x2272('0x18')]('\x22%s\x22\x20<%s>',this[_0x2272('0x6')],this[_0x2272('0x20')][_0x2272('0x21')]>0x0?this[_0x2272('0xb')]['substring'](this[_0x2272('0x20')]['dialCutDigit']):this['number']);};Action[_0x2272('0x1f')][_0x2272('0x22')]=function(){return this[_0x2272('0x23')];};module[_0x2272('0x24')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 3903d8c..9b5ba34 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 _0xdd4c=['starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','name','calleridnum','number'];(function(_0x51904f,_0x439694){var _0x24dc27=function(_0x3046b1){while(--_0x3046b1){_0x51904f['push'](_0x51904f['shift']());}};_0x24dc27(++_0x439694);}(_0xdd4c,0x112));var _0xcdd4=function(_0x4ce445,_0x3b03ec){_0x4ce445=_0x4ce445-0x0;var _0x11c667=_0xdd4c[_0x4ce445];return _0x11c667;};'use strict';var util=require(_0xcdd4('0x0'));var _=require(_0xcdd4('0x1'));var moment=require(_0xcdd4('0x2'));function getSeconds(_0x363a56,_0x5525c4){var _0x2aef97=moment(_0x363a56)[_0xcdd4('0x3')](0x0);var _0x2ceb8d=moment(_0x5525c4)['milliseconds'](0x0);return _0x2aef97[_0xcdd4('0x4')](_0x2ceb8d,_0xcdd4('0x5'));}function AgentComplete(_0x294d5d,_0x3f1edf){this[_0xcdd4('0x6')]=0x4;this[_0xcdd4('0x7')]='Answer';this['scheduledat']=_0x294d5d['scheduledat'];this[_0xcdd4('0x8')]=_0x294d5d[_0xcdd4('0x8')];this[_0xcdd4('0x9')]=_0x294d5d[_0xcdd4('0x8')]===_0xcdd4('0xa')?_0xcdd4('0xb'):_0x294d5d[_0xcdd4('0x8')];this[_0xcdd4('0xc')]=_0x294d5d['countbusyretry'];this[_0xcdd4('0xd')]=_0x294d5d[_0xcdd4('0xd')];this[_0xcdd4('0xe')]=_0x294d5d['countnoanswerretry'];this[_0xcdd4('0xf')]=_0x294d5d['countbusyretry']+_0x294d5d[_0xcdd4('0xd')]+_0x294d5d[_0xcdd4('0xe')];this[_0xcdd4('0x10')]=_0x3f1edf[_0xcdd4('0x10')];this['calleridname']=_0x294d5d[_0xcdd4('0x11')];this[_0xcdd4('0x12')]=_0x294d5d[_0xcdd4('0x13')];this[_0xcdd4('0x14')]=_0x294d5d[_0xcdd4('0x14')];this[_0xcdd4('0x15')]=_0x294d5d[_0xcdd4('0x15')];this[_0xcdd4('0x16')]=_0x294d5d['answertime'];this[_0xcdd4('0x17')]=moment()[_0xcdd4('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcdd4('0x19')]=getSeconds(_0x294d5d[_0xcdd4('0x15')],_0x294d5d['starttime']);this[_0xcdd4('0x1a')]=getSeconds(_0x294d5d[_0xcdd4('0x16')],_0x294d5d[_0xcdd4('0x15')]);this[_0xcdd4('0x1b')]=getSeconds(this[_0xcdd4('0x17')],_0x294d5d[_0xcdd4('0x16')]);this[_0xcdd4('0xb')]=_0x3f1edf[_0xcdd4('0xb')];this[_0xcdd4('0x1c')]=_0x3f1edf[_0xcdd4('0x1c')];this[_0xcdd4('0x1d')]=_0x3f1edf[_0xcdd4('0x1d')];this[_0xcdd4('0x1e')]=_0x294d5d[_0xcdd4('0x1e')];this[_0xcdd4('0x1f')]=_0x294d5d[_0xcdd4('0x1f')];this[_0xcdd4('0x20')]=_0x294d5d[_0xcdd4('0x20')];this[_0xcdd4('0x21')]=_0x294d5d[_0xcdd4('0x21')];this[_0xcdd4('0x22')]=_0x294d5d['ContactId'];this[_0xcdd4('0x23')]=_0x294d5d['ListId'];this[_0xcdd4('0x24')]=_0x294d5d[_0xcdd4('0x24')];this[_0xcdd4('0x25')]=_0x294d5d[_0xcdd4('0x25')];this[_0xcdd4('0x26')]=_0x294d5d[_0xcdd4('0x26')];this[_0xcdd4('0x27')]=_0x294d5d[_0xcdd4('0x27')]||'';this[_0xcdd4('0x28')]=_0x294d5d[_0xcdd4('0x28')]||'';}module[_0xcdd4('0x29')]=AgentComplete; \ No newline at end of file +var _0x036b=['starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','uniqueid','calleridname','name','calleridnum'];(function(_0x5805ee,_0x44dea5){var _0x506af5=function(_0x1d01c8){while(--_0x1d01c8){_0x5805ee['push'](_0x5805ee['shift']());}};_0x506af5(++_0x44dea5);}(_0x036b,0xe7));var _0xb036=function(_0x2a740c,_0x138a3f){_0x2a740c=_0x2a740c-0x0;var _0x1d663f=_0x036b[_0x2a740c];return _0x1d663f;};'use strict';var util=require(_0xb036('0x0'));var _=require(_0xb036('0x1'));var moment=require(_0xb036('0x2'));function getSeconds(_0x565988,_0x5198eb){var _0x3d0088=moment(_0x565988)[_0xb036('0x3')](0x0);var _0x266b47=moment(_0x5198eb)[_0xb036('0x3')](0x0);return _0x3d0088[_0xb036('0x4')](_0x266b47,_0xb036('0x5'));}function AgentComplete(_0x5ce982,_0x12e5bb){this[_0xb036('0x6')]=0x4;this['statedesc']=_0xb036('0x7');this[_0xb036('0x8')]=_0x5ce982[_0xb036('0x8')];this[_0xb036('0x9')]=_0x5ce982['type'];this[_0xb036('0xa')]=_0x5ce982[_0xb036('0x9')]===_0xb036('0xb')?_0xb036('0xc'):_0x5ce982['type'];this[_0xb036('0xd')]=_0x5ce982[_0xb036('0xd')];this[_0xb036('0xe')]=_0x5ce982[_0xb036('0xe')];this['countnoanswerretry']=_0x5ce982['countnoanswerretry'];this[_0xb036('0xf')]=_0x5ce982[_0xb036('0xd')]+_0x5ce982['countcongestionretry']+_0x5ce982[_0xb036('0x10')];this[_0xb036('0x11')]=_0x12e5bb[_0xb036('0x11')];this[_0xb036('0x12')]=_0x5ce982[_0xb036('0x13')];this[_0xb036('0x14')]=_0x5ce982['number'];this[_0xb036('0x15')]=_0x5ce982[_0xb036('0x15')];this['responsetime']=_0x5ce982[_0xb036('0x16')];this[_0xb036('0x17')]=_0x5ce982[_0xb036('0x17')];this[_0xb036('0x18')]=moment()[_0xb036('0x19')](_0xb036('0x1a'));this['ringtime']=getSeconds(_0x5ce982[_0xb036('0x16')],_0x5ce982[_0xb036('0x15')]);this[_0xb036('0x1b')]=getSeconds(_0x5ce982[_0xb036('0x17')],_0x5ce982[_0xb036('0x16')]);this[_0xb036('0x1c')]=getSeconds(this[_0xb036('0x18')],_0x5ce982['answertime']);this[_0xb036('0xc')]=_0x12e5bb[_0xb036('0xc')];this[_0xb036('0x1d')]=_0x12e5bb[_0xb036('0x1d')];this[_0xb036('0x1e')]=_0x12e5bb[_0xb036('0x1e')];this[_0xb036('0x1f')]=_0x5ce982[_0xb036('0x1f')];this[_0xb036('0x20')]=_0x5ce982[_0xb036('0x20')];this[_0xb036('0x21')]=_0x5ce982['callbackat'];this[_0xb036('0x22')]=_0x5ce982[_0xb036('0x22')];this[_0xb036('0x23')]=_0x5ce982[_0xb036('0x23')];this[_0xb036('0x24')]=_0x5ce982['ListId'];this[_0xb036('0x25')]=_0x5ce982['UserId'];this[_0xb036('0x26')]=_0x5ce982[_0xb036('0x26')];this[_0xb036('0x27')]=_0x5ce982[_0xb036('0x27')];this[_0xb036('0x28')]=_0x5ce982[_0xb036('0x28')]||'';this[_0xb036('0x29')]=_0x5ce982[_0xb036('0x29')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 6dfc130..b0a80a7 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 _0x4815=['campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type'];(function(_0x3a2877,_0x5d63ac){var _0x56647d=function(_0x3880dc){while(--_0x3880dc){_0x3a2877['push'](_0x3a2877['shift']());}};_0x56647d(++_0x5d63ac);}(_0x4815,0xff));var _0x5481=function(_0x3928a0,_0x1b38dd){_0x3928a0=_0x3928a0-0x0;var _0x2caa57=_0x4815[_0x3928a0];return _0x2caa57;};'use strict';var util=require(_0x5481('0x0'));var _=require(_0x5481('0x1'));var moment=require(_0x5481('0x2'));function getSeconds(_0x3ac100,_0x9fd940){var _0x32ee83=moment(_0x3ac100)[_0x5481('0x3')](0x0);var _0x4797f0=moment(_0x9fd940)['milliseconds'](0x0);return _0x32ee83[_0x5481('0x4')](_0x4797f0,_0x5481('0x5'));}function Final(_0xffafc3){this[_0x5481('0x6')]=_0xffafc3[_0x5481('0x6')];this[_0x5481('0x7')]=_0xffafc3[_0x5481('0x7')];this[_0x5481('0x8')]=_0xffafc3[_0x5481('0x8')];this[_0x5481('0x9')]=_0xffafc3[_0x5481('0x8')]===_0x5481('0xa')?_0x5481('0xb'):_0xffafc3[_0x5481('0x8')];this[_0x5481('0xc')]=_0xffafc3[_0x5481('0xc')];this['countcongestionretry']=_0xffafc3['countcongestionretry'];this[_0x5481('0xd')]=_0xffafc3[_0x5481('0xd')];this[_0x5481('0xe')]=_0xffafc3[_0x5481('0xc')]+_0xffafc3['countcongestionretry']+_0xffafc3[_0x5481('0xd')];this['queue']=_0xffafc3[_0x5481('0xb')];this[_0x5481('0xf')]=_0xffafc3[_0x5481('0xf')];this['calleridnum']=_0xffafc3[_0x5481('0x10')];this['starttime']=_0xffafc3[_0x5481('0x11')];this[_0x5481('0x12')]=_0xffafc3[_0x5481('0x12')];this[_0x5481('0x13')]=_0xffafc3[_0x5481('0x12')];this[_0x5481('0x14')]=_0xffafc3[_0x5481('0x14')]||0x0;this[_0x5481('0x15')]=_0xffafc3[_0x5481('0x15')]||0x0;this[_0x5481('0x16')]=_0xffafc3['talktime']||0x0;this[_0x5481('0x17')]=_0xffafc3[_0x5481('0x17')];this[_0x5481('0x18')]=_0xffafc3['callbackuniqueid'];this['callbackat']=_0xffafc3['callbackat'];this['recallme']=_0xffafc3[_0x5481('0x19')];this[_0x5481('0x1a')]=_0xffafc3[_0x5481('0x1a')];this['ListId']=_0xffafc3['ListId'];this['UserId']=_0xffafc3[_0x5481('0x1b')];this[_0x5481('0x1c')]=_0xffafc3[_0x5481('0x1c')];this[_0x5481('0x1d')]=_0xffafc3[_0x5481('0x1d')];this[_0x5481('0x1e')]=_0xffafc3[_0x5481('0x1e')]||'';this[_0x5481('0x1f')]=_0xffafc3[_0x5481('0x1f')]||'';}module[_0x5481('0x20')]=Final; \ No newline at end of file +var _0x9536=['type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x9536,0x179));var _0x6953=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x9536[_0x10004e];return _0x5af990;};'use strict';var util=require(_0x6953('0x0'));var _=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));function getSeconds(_0x40b3c3,_0x4d218f){var _0xc3e4dd=moment(_0x40b3c3)['milliseconds'](0x0);var _0x42fb54=moment(_0x4d218f)[_0x6953('0x3')](0x0);return _0xc3e4dd[_0x6953('0x4')](_0x42fb54,_0x6953('0x5'));}function Final(_0x2f3cc3){this['uniqueid']=_0x2f3cc3[_0x6953('0x6')];this[_0x6953('0x7')]=_0x2f3cc3[_0x6953('0x7')];this[_0x6953('0x8')]=_0x2f3cc3[_0x6953('0x8')];this['campaigntype']=_0x2f3cc3[_0x6953('0x8')]===_0x6953('0x9')?_0x6953('0xa'):_0x2f3cc3['type'];this[_0x6953('0xb')]=_0x2f3cc3[_0x6953('0xb')];this[_0x6953('0xc')]=_0x2f3cc3[_0x6953('0xc')];this[_0x6953('0xd')]=_0x2f3cc3[_0x6953('0xd')];this[_0x6953('0xe')]=_0x2f3cc3[_0x6953('0xb')]+_0x2f3cc3[_0x6953('0xc')]+_0x2f3cc3['countnoanswerretry'];this[_0x6953('0xa')]=_0x2f3cc3['queue'];this[_0x6953('0xf')]=_0x2f3cc3[_0x6953('0xf')];this[_0x6953('0x10')]=_0x2f3cc3[_0x6953('0x10')];this[_0x6953('0x11')]=_0x2f3cc3[_0x6953('0x11')];this[_0x6953('0x12')]=_0x2f3cc3[_0x6953('0x12')];this[_0x6953('0x13')]=_0x2f3cc3[_0x6953('0x12')];this[_0x6953('0x14')]=_0x2f3cc3['ringtime']||0x0;this['holdtime']=_0x2f3cc3[_0x6953('0x15')]||0x0;this[_0x6953('0x16')]=_0x2f3cc3[_0x6953('0x16')]||0x0;this[_0x6953('0x17')]=_0x2f3cc3['callback'];this[_0x6953('0x18')]=_0x2f3cc3[_0x6953('0x18')];this['callbackat']=_0x2f3cc3[_0x6953('0x19')];this[_0x6953('0x1a')]=_0x2f3cc3[_0x6953('0x1a')];this[_0x6953('0x1b')]=_0x2f3cc3[_0x6953('0x1b')];this['ListId']=_0x2f3cc3[_0x6953('0x1c')];this[_0x6953('0x1d')]=_0x2f3cc3[_0x6953('0x1d')];this[_0x6953('0x1e')]=_0x2f3cc3[_0x6953('0x1e')];this['CampaignId']=_0x2f3cc3[_0x6953('0x1f')];this[_0x6953('0x20')]=_0x2f3cc3['originatecalleridnum']||'';this[_0x6953('0x21')]=_0x2f3cc3[_0x6953('0x21')]||'';}module[_0x6953('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 1832dd5..09cf0e5 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 _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(_0x53ab5b,_0xa03b0){var _0x4b03f0=function(_0x3c2bd7){while(--_0x3c2bd7){_0x53ab5b['push'](_0x53ab5b['shift']());}};_0x4b03f0(++_0xa03b0);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 +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(_0x3185ad,_0x5e5ca2){var _0x4f77fb=function(_0x435aca){while(--_0x435aca){_0x3185ad['push'](_0x3185ad['shift']());}};_0x4f77fb(++_0x5e5ca2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 037c1f3..7dd2d4d 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 _0x0137=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff'];(function(_0x56f0be,_0x24d52f){var _0x239023=function(_0x40c440){while(--_0x40c440){_0x56f0be['push'](_0x56f0be['shift']());}};_0x239023(++_0x24d52f);}(_0x0137,0xea));var _0x7013=function(_0x56418e,_0x362812){_0x56418e=_0x56418e-0x0;var _0x5b160c=_0x0137[_0x56418e];return _0x5b160c;};'use strict';var util=require(_0x7013('0x0'));var _=require('lodash');var moment=require(_0x7013('0x1'));function getSeconds(_0x2bd3f0,_0x3f4d2b){var _0x534cec=moment(_0x2bd3f0)[_0x7013('0x2')](0x0);var _0xb05b63=moment(_0x3f4d2b)[_0x7013('0x2')](0x0);return _0x534cec[_0x7013('0x3')](_0xb05b63,_0x7013('0x4'));}function History(_0x5970e2){this[_0x7013('0x5')]=_0x5970e2[_0x7013('0x5')];this[_0x7013('0x6')]=_0x5970e2['scheduledat']||undefined;this[_0x7013('0x7')]=_0x5970e2[_0x7013('0x7')];this[_0x7013('0x8')]=_0x5970e2['type']===_0x7013('0x9')?_0x7013('0xa'):_0x5970e2[_0x7013('0x7')];this['countbusyretry']=_0x5970e2[_0x7013('0xb')];this[_0x7013('0xc')]=_0x5970e2[_0x7013('0xc')];this[_0x7013('0xd')]=_0x5970e2['countnoanswerretry'];this['countglobal']=_0x5970e2[_0x7013('0xb')]+_0x5970e2[_0x7013('0xc')]+_0x5970e2['countnoanswerretry'];this[_0x7013('0xa')]=_0x5970e2['queue'];this['calleridname']=_0x5970e2[_0x7013('0xe')];this[_0x7013('0xf')]=_0x5970e2['number'];this[_0x7013('0x10')]=_0x5970e2[_0x7013('0x10')];this[_0x7013('0x11')]=_0x5970e2[_0x7013('0x11')];this[_0x7013('0x12')]=_0x5970e2['responsetime'];this[_0x7013('0x13')]=getSeconds(_0x5970e2[_0x7013('0x11')],_0x5970e2[_0x7013('0x10')]);this[_0x7013('0x14')]=0x0;this[_0x7013('0x15')]=0x0;this[_0x7013('0x16')]=_0x5970e2[_0x7013('0x16')];this[_0x7013('0x17')]=_0x5970e2[_0x7013('0x17')];this[_0x7013('0x18')]=_0x5970e2[_0x7013('0x18')];this[_0x7013('0x19')]=_0x5970e2['recallme'];this[_0x7013('0x1a')]=_0x5970e2['ContactId'];this['ListId']=_0x5970e2[_0x7013('0x1b')];this['UserId']=_0x5970e2[_0x7013('0x1c')];this['VoiceQueueId']=_0x5970e2[_0x7013('0x1d')];this[_0x7013('0x1e')]=_0x5970e2[_0x7013('0x1e')];this[_0x7013('0x1f')]=_0x5970e2[_0x7013('0x1f')]||'';this[_0x7013('0x20')]=_0x5970e2['originatecalleridname']||'';}module[_0x7013('0x21')]=History; \ No newline at end of file +var _0xb6b7=['originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0xb6b7,0xe1));var _0x7b6b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb6b7[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x7b6b('0x0'));var _=require(_0x7b6b('0x1'));var moment=require(_0x7b6b('0x2'));function getSeconds(_0x442cd8,_0x22858f){var _0x2474fd=moment(_0x442cd8)[_0x7b6b('0x3')](0x0);var _0x5cfc5c=moment(_0x22858f)[_0x7b6b('0x3')](0x0);return _0x2474fd[_0x7b6b('0x4')](_0x5cfc5c,_0x7b6b('0x5'));}function History(_0x581411){this['uniqueid']=_0x581411[_0x7b6b('0x6')];this[_0x7b6b('0x7')]=_0x581411[_0x7b6b('0x7')]||undefined;this[_0x7b6b('0x8')]=_0x581411[_0x7b6b('0x8')];this[_0x7b6b('0x9')]=_0x581411['type']===_0x7b6b('0xa')?_0x7b6b('0xb'):_0x581411[_0x7b6b('0x8')];this['countbusyretry']=_0x581411[_0x7b6b('0xc')];this[_0x7b6b('0xd')]=_0x581411['countcongestionretry'];this['countnoanswerretry']=_0x581411[_0x7b6b('0xe')];this[_0x7b6b('0xf')]=_0x581411['countbusyretry']+_0x581411[_0x7b6b('0xd')]+_0x581411[_0x7b6b('0xe')];this[_0x7b6b('0xb')]=_0x581411[_0x7b6b('0xb')];this[_0x7b6b('0x10')]=_0x581411[_0x7b6b('0x11')];this[_0x7b6b('0x12')]=_0x581411[_0x7b6b('0x13')];this[_0x7b6b('0x14')]=_0x581411[_0x7b6b('0x14')];this[_0x7b6b('0x15')]=_0x581411[_0x7b6b('0x15')];this[_0x7b6b('0x16')]=_0x581411['responsetime'];this[_0x7b6b('0x17')]=getSeconds(_0x581411[_0x7b6b('0x15')],_0x581411[_0x7b6b('0x14')]);this['holdtime']=0x0;this[_0x7b6b('0x18')]=0x0;this[_0x7b6b('0x19')]=_0x581411['callback'];this[_0x7b6b('0x1a')]=_0x581411[_0x7b6b('0x1a')];this[_0x7b6b('0x1b')]=_0x581411[_0x7b6b('0x1b')];this[_0x7b6b('0x1c')]=_0x581411[_0x7b6b('0x1c')];this[_0x7b6b('0x1d')]=_0x581411[_0x7b6b('0x1d')];this[_0x7b6b('0x1e')]=_0x581411[_0x7b6b('0x1e')];this[_0x7b6b('0x1f')]=_0x581411[_0x7b6b('0x1f')];this[_0x7b6b('0x20')]=_0x581411[_0x7b6b('0x20')];this[_0x7b6b('0x21')]=_0x581411[_0x7b6b('0x21')];this['originatecalleridnum']=_0x581411[_0x7b6b('0x22')]||'';this[_0x7b6b('0x23')]=_0x581411[_0x7b6b('0x23')]||'';}module[_0x7b6b('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index d65cc1c..9205d78 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 _0xd4a2=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','predictiveIntervalAvgHoldtime','info','[checkGetDataPredictive][avgHoldtime]','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][objIsEmpty]','[checkGetDataPredictive][obj]','[ErlangB]','merge','seconds','[freeVariablesPredictive]','handlePredictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','hasOwnProperty','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','starttime','clearZombieChannels','uniqueId','enqueue','isNil','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerCallsDay','MACHINE','Machine','membername','amd','[syncMachine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','AMD','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','droptime','YYYY-MM-DD\x20HH:mm:ss','responsetime','dialQueueTimeout','Drop','TIMEOUT','queueCallerAbandonCreateState','Abandoned','dropreason','CALLEREXIT','channel','actionid','roundrobin','locked','paused','agents','stateinterface','rrmemory','pick','idHopper','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','VoiceQueueId','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','isArray','push','Action','command','content','indexOf','iftime\x20%s,%s','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIsTrunkReachable','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','endtime','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countnoanswerretry','dialGlobalMaxRetry','dialNoAnswerRetryFrequency','minutes','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','add','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','countcongestionretry','[rescheduleContact]\x20[Congestion]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','[syncAgentComplete][createHistory][0]','stateGlobal','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','countglobal','dialNoAnswerMaxRetry','createStateFinal','reason\x203\x20ringing\x20no\x20answer','Busy','reason\x205\x20busy','Congestion','reason\x208\x20congestion','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Date]','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]','agent\x20max\x20free\x20','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','[startMethodPredictive][StartPredictive][First]','startMethodPredictive','[averageHandleTime][ErlangB]\x20','[startMethodPredictive][StartPredictive][Repeat]','getDataPredictive','outboundQueuePauses','abandonmentRate','agentBusyFactor','busyFactor','[CatchErlangB]','[getDataPredictive]','floor','[handlePredictive]','checkContactBlack','queueStatusComplete','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','inBlackList','temp','[getContactCampaign2][Empty]','RUNNING','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','reachable','[actionOriginatePredictive]\x20','\x20interval\x20=\x20','\x20Ts\x20=\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','\x20m\x20=\x20','\x20p\x20=\x20','\x20Umin\x20=\x20','Amax\x20=\x20','exports','util','uuid','md5','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','sequence','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','Error','stringify','milliseconds','diff','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd4a2,0x173));var _0x2d4a=function(_0x5cd638,_0x32ef72){_0x5cd638=_0x5cd638-0x0;var _0x5d30ff=_0xd4a2[_0x5cd638];return _0x5d30ff;};'use strict';var util=require(_0x2d4a('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x2d4a('0x1'));var moment=require('moment');var rr=require('rr');var md5=require(_0x2d4a('0x2'));var Redis=require('ioredis');var config=require(_0x2d4a('0x3'));var logger=require('../../../config/logger')(_0x2d4a('0x4'));var loggerBooked=require(_0x2d4a('0x5'))(_0x2d4a('0x6'));var loggerPredictive=require(_0x2d4a('0x5'))(_0x2d4a('0x7'));var loggerPredictiveCalls=require('../../../config/logger')(_0x2d4a('0x8'));var loggerSyncQueueSummary=require(_0x2d4a('0x5'))(_0x2d4a('0x9'));var ami=require(_0x2d4a('0xa'));config[_0x2d4a('0xb')]=_[_0x2d4a('0xc')](config[_0x2d4a('0xb')],{'host':_0x2d4a('0xd'),'port':0x18eb});var io=require(_0x2d4a('0xe'))(new Redis(config[_0x2d4a('0xb')]));var cmHopper=require(_0x2d4a('0xf'));var cmHopperFinal=require(_0x2d4a('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x2d4a('0x11'));var Action=require('./action');var History=require(_0x2d4a('0x12'));var Final=require(_0x2d4a('0x13'));var AgentComplete=require(_0x2d4a('0x14'));var QueueCallerAbandon=require(_0x2d4a('0x15'));var Hangup=require(_0x2d4a('0x16'));var ipAgi=process[_0x2d4a('0x17')][_0x2d4a('0x18')]||_0x2d4a('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x2d4a('0x1a')]['enqueue']=function(_0x11c64a){this[_0x2d4a('0x1b')]=this[_0x2d4a('0x1b')]?this[_0x2d4a('0x1b')]['finally'](_0x11c64a):_0x11c64a();};function Dialer(_0x5f825d,_0x5a6378){this[_0x2d4a('0x1c')]=new Sequence();this['preview']=_0x5a6378;this[_0x2d4a('0x1d')]=_0x5f825d[_0x2d4a('0x1d')];this[_0x2d4a('0x1e')]=_0x5f825d[_0x2d4a('0x1e')];this['agents']=_0x5f825d['agents'];this['trunks']=_0x5f825d[_0x2d4a('0x1f')];this[_0x2d4a('0x20')]=config[_0x2d4a('0x20')]||0x2;this[_0x2d4a('0x21')]={};this[_0x2d4a('0x22')]={};this[_0x2d4a('0x23')]={};this['uniqueId']={};this['optionPredictive']={};this[_0x2d4a('0x24')]={};this[_0x2d4a('0x25')]={};this[_0x2d4a('0x26')]={};this[_0x2d4a('0x27')]={};this[_0x2d4a('0x28')]={};ami['on'](_0x2d4a('0x29'),this[_0x2d4a('0x2a')][_0x2d4a('0x2b')](this));ami['on']('queuecallerabandon',this[_0x2d4a('0x2c')][_0x2d4a('0x2b')](this));ami['on'](_0x2d4a('0x2d'),this[_0x2d4a('0x2e')][_0x2d4a('0x2b')](this));ami['on'](_0x2d4a('0x2f'),this[_0x2d4a('0x30')][_0x2d4a('0x2b')](this));ami['on']('custom:queuesummary',this['syncQueueSummary']['bind'](this));ami['on'](_0x2d4a('0x31'),this['syncHangup'][_0x2d4a('0x2b')](this));ami['on'](_0x2d4a('0x32'),this[_0x2d4a('0x33')][_0x2d4a('0x2b')](this));ami['on'](_0x2d4a('0x34'),this[_0x2d4a('0x35')][_0x2d4a('0x2b')](this));ami['on'](_0x2d4a('0x36'),this['syncQueueMember'][_0x2d4a('0x2b')](this));ami['on']('queuestatuscomplete',this[_0x2d4a('0x37')][_0x2d4a('0x2b')](this));this[_0x2d4a('0x38')]();this[_0x2d4a('0x39')]();}function isNotNull(_0x101382){return _0x101382!==null&&!_[_0x2d4a('0x3a')](_0x101382);}function checkIsLoggedIn(_0x25ac5c,_0x2e8063){return function(){if(_0x2e8063<=0x0){_0x25ac5c['message']=_0x2d4a('0x3b');throw _0x25ac5c[_0x2d4a('0x3c')]+_0x2d4a('0x3d');}};}function isActive(_0x286150){return _0x286150;}function checkIsActive(_0x2b66af,_0x57bf71){return function(){if(!isActive(_0x57bf71)){_0x2b66af[_0x2d4a('0x3e')]=_0x2d4a('0x3f');throw _0x2b66af[_0x2d4a('0x3c')]+_0x2d4a('0x40');}};}function checkInterval(_0x2bb93d){return function(){if(!isNotNull(_0x2bb93d['Interval'])){_0x2bb93d[_0x2d4a('0x3e')]=_0x2d4a('0x41');throw _0x2bb93d[_0x2d4a('0x3c')]+_0x2d4a('0x42');}if(!isNotNull(_0x2bb93d[_0x2d4a('0x43')][_0x2d4a('0x44')])){_0x2bb93d['message']=_0x2d4a('0x41');throw _0x2bb93d[_0x2d4a('0x3c')]+_0x2d4a('0x42');}if(!isNotNull(_[_0x2d4a('0x45')](_0x2bb93d[_0x2d4a('0x43')]['Intervals']))){_0x2bb93d[_0x2d4a('0x3e')]=_0x2d4a('0x41');throw _0x2bb93d['name']+_0x2d4a('0x42');}};}function msgResponse(_0x1d6313,_0x3dae78,_0x94e857){return{'action':_0x1d6313,'response':_0x3dae78,'message':_0x94e857};}function myreject(_0x2b9093){return function(_0x318ff0){return _0x2b9093(msgResponse('[ifTime][Action]',_0x2d4a('0x46'),JSON[_0x2d4a('0x47')](_0x318ff0)));};}function getSeconds(_0x3e3256,_0x13f120){var _0x103558=moment(_0x3e3256)[_0x2d4a('0x48')](0x0);var _0x5b49f9=moment(_0x13f120)['milliseconds'](0x0);return _0x103558[_0x2d4a('0x49')](_0x5b49f9,'seconds');}function emit(_0x6e0716,_0x309e33,_0x5aeae4){io['to'](_0x6e0716)[_0x2d4a('0x4a')](_0x309e33,_0x5aeae4);}function emitVoiceQueueSummary(_0x275598){if(_0x275598[_0x2d4a('0x4b')]===_0x2d4a('0x4c')){var _0x67bce3={'id':_0x275598['id'],'name':_0x275598[_0x2d4a('0x3c')],'strategy':_0x275598[_0x2d4a('0x4d')],'answered':_0x275598[_0x2d4a('0x4e')],'available':_0x275598[_0x2d4a('0x4f')],'loggedIn':_0x275598[_0x2d4a('0x50')],'pTalking':_0x275598[_0x2d4a('0x51')],'sumBillable':_0x275598['sumBillable'],'sumDuration':_0x275598[_0x2d4a('0x52')],'sumHoldTime':_0x275598[_0x2d4a('0x53')]||0x0,'talking':_0x275598[_0x2d4a('0x54')],'total':_0x275598[_0x2d4a('0x55')],'type':_0x275598[_0x2d4a('0x4b')],'unmanaged':_0x275598['unmanaged'],'abandoned':_0x275598['abandoned'],'waiting':_0x275598['waiting'],'loggedInDb':_0x275598['loggedInDb'],'dialActive':_0x275598[_0x2d4a('0x56')],'dialMethod':_0x275598[_0x2d4a('0x57')],'dialOriginateCallerIdName':_0x275598[_0x2d4a('0x58')],'dialOriginateCallerIdNumber':_0x275598[_0x2d4a('0x59')],'dialOriginateTimeout':_0x275598['dialOriginateTimeout'],'dialPrefix':_0x275598[_0x2d4a('0x5a')],'outboundAnswerAgiCallsDay':_0x275598[_0x2d4a('0x5b')],'outboundAnswerCallsDay':_0x275598['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x275598[_0x2d4a('0x5c')],'outboundBusyCallsDay':_0x275598[_0x2d4a('0x5d')],'outboundCongestionCallsDay':_0x275598[_0x2d4a('0x5e')],'outboundDropCallsDayACS':_0x275598[_0x2d4a('0x5f')],'outboundDropCallsDayCallersExit':_0x275598[_0x2d4a('0x60')],'outboundDropCallsDayTimeout':_0x275598[_0x2d4a('0x61')],'outboundNoAnswerCallsDay':_0x275598['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x275598[_0x2d4a('0x62')],'outboundOriginateFailureCallsDay':_0x275598[_0x2d4a('0x63')],'outboundReCallsDay':_0x275598[_0x2d4a('0x64')],'outboundRejectCallsDay':_0x275598[_0x2d4a('0x65')],'outboundUnknownCallsDay':_0x275598[_0x2d4a('0x66')],'predictiveIntervalAnsweredCalls':_0x275598[_0x2d4a('0x67')],'predictiveIntervalAvgHoldtime':_0x275598['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x275598[_0x2d4a('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x275598[_0x2d4a('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x275598[_0x2d4a('0x6a')],'predictiveIntervalErlangCalls':_0x275598['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x275598[_0x2d4a('0x6b')],'predictiveIntervalHitRate':_0x275598['predictiveIntervalHitRate'],'predictiveIntervalLowerLimit':_0x275598[_0x2d4a('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x275598[_0x2d4a('0x6d')],'predictiveIntervalPauses':_0x275598[_0x2d4a('0x6e')],'predictiveIntervalTotalCalls':_0x275598[_0x2d4a('0x6f')],'message':_0x275598[_0x2d4a('0x3e')],'originated':_0x275598['originated']};if(_0x275598['Trunk']){_0x67bce3[_0x2d4a('0x70')]={'id':_0x275598[_0x2d4a('0x70')]['id'],'name':_0x275598['Trunk'][_0x2d4a('0x3c')],'active':_0x275598['Trunk'][_0x2d4a('0x71')],'callerid':_0x275598[_0x2d4a('0x70')][_0x2d4a('0x72')]};}if(_0x275598['Interval']){_0x67bce3[_0x2d4a('0x43')]={'id':_0x275598['Interval']['id'],'name':_0x275598[_0x2d4a('0x43')][_0x2d4a('0x3c')]};}var _0x3c7a80=md5(JSON[_0x2d4a('0x47')](_0x67bce3));if(_0x275598[_0x2d4a('0x2')]!==_0x3c7a80){_0x275598[_0x2d4a('0x2')]=_0x3c7a80;emit(util[_0x2d4a('0x73')](_0x2d4a('0x74'),_0x67bce3[_0x2d4a('0x3c')]),_0x2d4a('0x75'),_0x67bce3);}}}function emitCampaignSummary(_0x299065){if(_0x299065['type']===_0x2d4a('0x76')){emit(util[_0x2d4a('0x73')](_0x2d4a('0x77'),_0x299065[_0x2d4a('0x3c')]),_0x2d4a('0x78'),_0x299065);}}function checkGetDataPredictive(_0x5b6086){if(isNotNull(_0x5b6086)){if(!_[_0x2d4a('0x45')](_0x5b6086)){if(_0x5b6086[_0x2d4a('0x6f')]>0x0){if(!_[_0x2d4a('0x3a')](_0x5b6086[_0x2d4a('0x68')])&&_0x5b6086[_0x2d4a('0x68')]>0x0){return!![];}else{loggerPredictive['info']('[checkGetDataPredictive][avgTalktime]',JSON[_0x2d4a('0x47')](_0x5b6086));}if(!_[_0x2d4a('0x3a')](_0x5b6086['predictiveIntervalAvgHoldtime'])&&_0x5b6086[_0x2d4a('0x79')]>0x0){return!![];}else{loggerPredictive[_0x2d4a('0x7a')](_0x2d4a('0x7b'),JSON[_0x2d4a('0x47')](_0x5b6086));}}else{loggerPredictive['info'](_0x2d4a('0x7c'),JSON['stringify'](_0x5b6086));}}else{loggerPredictive[_0x2d4a('0x7a')](_0x2d4a('0x7d'),JSON[_0x2d4a('0x47')](_0x5b6086));}}else{loggerPredictive[_0x2d4a('0x7a')](_0x2d4a('0x7e'),JSON[_0x2d4a('0x47')](_0x5b6086));}return![];}function mergeDataErlangB(_0x25fb59){return function(_0x1b088c){loggerPredictive['info'](_0x2d4a('0x7f'),JSON[_0x2d4a('0x47')](_0x1b088c));_[_0x2d4a('0x80')](_0x25fb59,_0x1b088c);};}function getDiff(_0x67ddff){var _0x3e3925=moment()[_0x2d4a('0x48')](0x0);var _0x142b8c=moment(_0x67ddff)[_0x2d4a('0x48')](0x0);return _0x3e3925[_0x2d4a('0x49')](_0x142b8c,_0x2d4a('0x81'));}function ifInterval(_0x2f4068,_0x113bc4){if(_[_0x2d4a('0x3a')](_0x113bc4)){return![];}if(getDiff(_0x113bc4)<_0x2f4068*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xf3df0f){if(isNotNull(_0xf3df0f)){if(!_[_0x2d4a('0x3a')](_0xf3df0f[_0x2d4a('0x25')])){_0xf3df0f[_0x2d4a('0x25')]=undefined;loggerPredictive['info'](_0x2d4a('0x82'),_0x2d4a('0x25'),_0xf3df0f['name']);}if(!_[_0x2d4a('0x3a')](_0xf3df0f[_0x2d4a('0x24')])){_0xf3df0f[_0x2d4a('0x24')]=undefined;loggerPredictive[_0x2d4a('0x7a')](_0x2d4a('0x82'),_0x2d4a('0x24'),_0xf3df0f[_0x2d4a('0x3c')]);}if(!_[_0x2d4a('0x3a')](_0xf3df0f[_0x2d4a('0x83')])){clearInterval(_0xf3df0f[_0x2d4a('0x83')]);_0xf3df0f[_0x2d4a('0x83')]=undefined;loggerPredictive[_0x2d4a('0x7a')]('[freeVariablesPredictive]',_0x2d4a('0x83'),_0xf3df0f[_0x2d4a('0x3c')]);}}}function erlangb(_0x48c1f9,_0xb5042d){if(_0xb5042d===0x0){return 0x0;}var _0x3f42eb=0x1;for(var _0x1930c6=0x1;_0x1930c6<=_0xb5042d;_0x1930c6+=0x1){_0x3f42eb=0x1+_0x3f42eb*_0x1930c6/_0x48c1f9;}return 0x1/_0x3f42eb;}function isVoiceQueueOutbound(_0xb4f74c){return _0xb4f74c===_0x2d4a('0x4c');}function isNotPreview(_0x1e86c3){return _0x1e86c3!==_0x2d4a('0x84');}function isCampaignIvr(_0x43e6a6){return _0x43e6a6===_0x2d4a('0x76');}function getCallerId(_0x282df8,_0x5bbc96,_0x2bd137){if(!_[_0x2d4a('0x3a')](_0x2bd137)&&_0x2d4a('0x85')===typeof _0x2bd137&&!_['isEmpty'](_0x2bd137)){if(!_[_0x2d4a('0x3a')](_0x5bbc96)&&_0x2d4a('0x85')===typeof _0x5bbc96&&!_[_0x2d4a('0x45')](_0x5bbc96)){return util[_0x2d4a('0x73')](_0x2d4a('0x86'),_0x5bbc96,_0x2bd137);}return util[_0x2d4a('0x73')](_0x2d4a('0x86'),_0x2bd137,_0x2bd137);}if(!_[_0x2d4a('0x3a')](_0x282df8)&&_0x2d4a('0x85')===typeof _0x282df8&&!_['isEmpty'](_0x282df8)){return _0x282df8;}return _0x2d4a('0x87');}function loggerCatchQueueSummary(_0x17ade0,_0x2a876b){return function(_0x17ef80){freeVariablesPredictive(_0x2a876b);emitVoiceQueueSummary(_0x2a876b);emitCampaignSummary(_0x2a876b);loggerSyncQueueSummary[_0x2d4a('0x88')](_0x17ade0,util[_0x2d4a('0x89')](_0x17ef80,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x53f52b,_0x38e4ae){return function(_0x3a675e){loggerPredictive[_0x2d4a('0x88')](_0x53f52b,JSON['stringify'](_0x3a675e));freeVariablesPredictive(_0x38e4ae);};}function loggerCatch(_0x465c89){return function(_0x442691){logger['error'](_0x465c89,util[_0x2d4a('0x89')](_0x442691,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xc1254b){return _0xc1254b&&!_['isUndefined'](_0xc1254b)&&_0xc1254b[_0x2d4a('0x8a')]>0x0;}function decremetOriginate(_0x5ad7f6){if(!_['isUndefined'](_0x5ad7f6)&&_0x5ad7f6!==null){if(_0x5ad7f6[_0x2d4a('0x8b')](_0x2d4a('0x8c'))){if(_0x5ad7f6[_0x2d4a('0x8c')]>0x0){_0x5ad7f6[_0x2d4a('0x8c')]-=0x1;}else{logger['error'](_0x2d4a('0x8d'));}}}else{logger[_0x2d4a('0x88')](_0x2d4a('0x8e'));}}function checkContactLowerLimitOriginate(_0x303815,_0x4ce85f,_0x4d8111){if(_0x4ce85f>_0x4d8111){for(var _0x34f1d0=0x0;_0x34f1d0<_0x4ce85f-_0x4d8111;_0x34f1d0+=0x1){decremetOriginate(_0x303815);}}}function loggerGetContactDialer(_0x56fecc,_0x2a2441,_0x2aa9e8){return function(_0x9e6321){checkContactLowerLimitOriginate(_0x2a2441,_0x2aa9e8,0x0);logger[_0x2d4a('0x88')](_0x56fecc,util[_0x2d4a('0x89')](_0x9e6321,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x50e8c2){return function(_0x2b42aa){if(isNotNull(_0x2b42aa)&&isNotNull(_0x2b42aa[0x0])){if(_0x2b42aa[0x0][_0x2d4a('0x8f')]>0x0){_0x50e8c2[_0x2d4a('0x3e')]=_0x2d4a('0x90');logger['info'](_0x2d4a('0x91')+_0x50e8c2[_0x2d4a('0x3c')],_0x2b42aa[0x0][_0x2d4a('0x8f')],_0x2d4a('0x92'));}else{_0x50e8c2['message']=_0x2d4a('0x93');logger[_0x2d4a('0x7a')]('[getContactDialer2][Empty]'+_0x50e8c2[_0x2d4a('0x3c')]);}}};}function notSendMessagesQueue(_0x1778ab){if(_0x1778ab[_0x2d4a('0x94')]){freeVariablesPredictive(_0x1778ab);if(_0x1778ab['originated']===0x0&&_0x1778ab[_0x2d4a('0x54')]===0x0&&_0x1778ab[_0x2d4a('0x95')]===0x0&&(_0x1778ab[_0x2d4a('0x51')]||0x0)===0x0){_0x1778ab[_0x2d4a('0x94')]=![];_0x1778ab[_0x2d4a('0x4f')]=0x0;_0x1778ab[_0x2d4a('0x3e')]=_0x2d4a('0x3f');loggerSyncQueueSummary['error'](_0x2d4a('0x96'),_0x1778ab[_0x2d4a('0x3c')],_0x2d4a('0x97'));}else{_0x1778ab[_0x2d4a('0x3e')]=_0x2d4a('0x98');loggerSyncQueueSummary['error'](_0x2d4a('0x96'),_0x1778ab['name'],_0x2d4a('0x99'));}emitVoiceQueueSummary(_0x1778ab);}}function notSendMessagesCampaign(_0x3b6117){if(_0x3b6117[_0x2d4a('0x94')]){if(_0x3b6117[_0x2d4a('0x8c')]===0x0){_0x3b6117[_0x2d4a('0x94')]=![];_0x3b6117[_0x2d4a('0x3e')]=_0x2d4a('0x3f');loggerSyncQueueSummary[_0x2d4a('0x88')](_0x2d4a('0x9a'),_0x3b6117[_0x2d4a('0x3c')],'is\x20not\x20active');}else{_0x3b6117[_0x2d4a('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x2d4a('0x88')](_0x2d4a('0x9a'),_0x3b6117[_0x2d4a('0x3c')],_0x2d4a('0x99'));}emitCampaignSummary(_0x3b6117);}}function createObjHistory(_0x21517f,_0x43a2b3,_0x30b58b,_0xefcbf6,_0x21633a){_0x21517f['message']=_0x30b58b;var _0x1a83a4=new Action(_0x21517f,_0x43a2b3);var _0x74bc62=new History(_0x1a83a4);_0x74bc62[_0x2d4a('0x9b')]=_0xefcbf6;_0x74bc62[_0x2d4a('0x9c')]=_0x21633a;_0x74bc62['endtime']=_0x1a83a4[_0x2d4a('0x9d')];return _0x74bc62;}Dialer[_0x2d4a('0x1a')][_0x2d4a('0x39')]=function(){var _0xbe362d=this;setInterval(function(){_0xbe362d[_0x2d4a('0x9e')](_0xbe362d[_0x2d4a('0x9f')],'[uniqueid]');_0xbe362d[_0x2d4a('0x9e')](_0xbe362d[_0x2d4a('0x22')],'[actions]');},0x32c8);};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x9e')]=function(_0x16565e,_0x2bc0d9){var _0x429579=this;for(var _0x3139fc in _0x16565e){if(_0x16565e[_0x2d4a('0x8b')](_0x3139fc)){this[_0x2d4a('0x1c')][_0x2d4a('0xa0')](function(){if(!_[_0x2d4a('0xa1')](_0x16565e[_0x3139fc])){return ami['Action']({'action':_0x2d4a('0xa2'),'channel':_0x16565e[_0x3139fc]['channel']})[_0x2d4a('0xa3')](function(_0x135ec0){if(_0x135ec0[_0x2d4a('0x3e')]===_0x2d4a('0xa4')){setTimeout(function(){if(_0x16565e[_0x3139fc]&&_0x16565e[_0x3139fc][_0x2d4a('0x4b')]!==_0x2d4a('0x76')){_0x429579[_0x2d4a('0xa5')](_0x429579['voiceQueues'][_0x16565e[_0x3139fc][_0x2d4a('0xa6')]]);logger[_0x2d4a('0x88')](_0x2d4a('0xa7'),_0x2bc0d9,_0x3139fc,_0x16565e[_0x3139fc][_0x2d4a('0xa6')]);delete _0x16565e[_0x3139fc];}if(_0x16565e[_0x3139fc]&&_0x16565e[_0x3139fc][_0x2d4a('0x4b')]==='ivr'){_0x429579['updateOriginated'](_0x429579['campaigns'][_0x16565e[_0x3139fc][_0x2d4a('0xa6')]]);logger[_0x2d4a('0x88')](_0x2d4a('0xa8'),_0x2bc0d9,_0x3139fc,_0x16565e[_0x3139fc]['queue']);delete _0x16565e[_0x3139fc];}},0x2328);}});}});}}};Dialer[_0x2d4a('0x1a')][_0x2d4a('0xa9')]=function(_0x24473e){return BPromise[_0x2d4a('0xaa')]()[_0x2d4a('0xab')](cmHopper[_0x2d4a('0xa9')](_0x24473e))['catch'](loggerCatch(_0x2d4a('0xac')));};Dialer['prototype'][_0x2d4a('0xad')]=function(_0xf76da6){return BPromise['resolve']()[_0x2d4a('0xab')](cmHopperBlack['checkIsBlackList'](_0xf76da6))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x2d4a('0x1a')][_0x2d4a('0xae')]=function(_0x3f0164){return BPromise['resolve']()[_0x2d4a('0xab')](cmHopperBlack[_0x2d4a('0xae')](_0x3f0164))[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xaf')));};Dialer['prototype'][_0x2d4a('0xb0')]=function(_0x36e8a5){return BPromise['resolve']()[_0x2d4a('0xab')](cmHopperHistory[_0x2d4a('0xb1')](_0x36e8a5))['catch'](loggerCatch(_0x2d4a('0xb2')));};Dialer['prototype']['rescheduleContact']=function(_0x417223){return BPromise['resolve']()[_0x2d4a('0xab')](cmHopper[_0x2d4a('0xb3')](_0x417223))[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xb4')));};Dialer['prototype'][_0x2d4a('0xb5')]=function(_0x561e7e,_0x1aa734,_0x41aa6e,_0x1f1588){return BPromise[_0x2d4a('0xaa')]()[_0x2d4a('0xab')](cmHopper['getContactDialer'](_0x561e7e,_0x1aa734,_0x41aa6e,_0x1f1588))[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xb6')));};Dialer[_0x2d4a('0x1a')]['getContactDialerIvr']=function(_0x40c666,_0x55682d,_0x562665){return BPromise[_0x2d4a('0xaa')]()[_0x2d4a('0xab')](cmHopper[_0x2d4a('0xb7')](_0x40c666,_0x55682d,_0x562665))[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xb6')));};Dialer[_0x2d4a('0x1a')][_0x2d4a('0xb8')]=function(_0x38ac6d){return BPromise[_0x2d4a('0xaa')]()[_0x2d4a('0xab')](voiceQueueRt['getVoiceQueueRtPauses'](_0x38ac6d))[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xb9')));};Dialer[_0x2d4a('0x1a')][_0x2d4a('0xba')]=function(_0x36b067){return BPromise[_0x2d4a('0xaa')]()[_0x2d4a('0xab')](cmHopper[_0x2d4a('0xba')](_0x36b067))['catch'](loggerCatch(_0x2d4a('0xbb')));};Dialer[_0x2d4a('0x1a')][_0x2d4a('0xbc')]=function(_0x5eb662){return BPromise[_0x2d4a('0xaa')]()['then'](cmHopperHistory[_0x2d4a('0xbc')](_0x5eb662))[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xbd')));};Dialer[_0x2d4a('0x1a')]['updateOriginated']=function(_0x203358){if(!_['isUndefined'](_0x203358)&&_0x203358!==null){if(_0x203358[_0x2d4a('0x8b')](_0x2d4a('0x8c'))){if(_0x203358[_0x2d4a('0x8c')]>0x0){_0x203358['originated']-=0x1;}else{logger[_0x2d4a('0x88')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x2d4a('0x88')](_0x2d4a('0xbe'));}};Dialer[_0x2d4a('0x1a')][_0x2d4a('0xbf')]=function(_0x3f10ad,_0xcca102){var _0x66cf1c=this;return function(_0x1dd8ed){_0x66cf1c[_0x2d4a('0xa5')](_0xcca102);logger['error'](_0x3f10ad,util['inspect'](_0x1dd8ed,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x2d4a('0xc0')]=function(_0x4ef017,_0x23b7d,_0x493429){var _0x65f72={'state':0x19,'statedesc':_0x2d4a('0xc1')};this['updateOriginated'](_0x23b7d);this['saveInDb'](_[_0x2d4a('0x80')](_0x65f72,_['pick'](_0x493429,[_0x2d4a('0xc2'),_0x2d4a('0xc3'),_0x2d4a('0xc4'),'VoiceQueueId',_0x2d4a('0xc5')])),_0x2d4a('0xc6'),_0x2d4a('0xc7'));logger[_0x2d4a('0x88')](_0x4ef017);};Dialer[_0x2d4a('0x1a')][_0x2d4a('0xc8')]=function(_0x41c298){return _0x41c298===_0x2d4a('0xc9');};Dialer[_0x2d4a('0x1a')][_0x2d4a('0xca')]=function(_0x1a0e40){return!_[_0x2d4a('0x3a')](_0x1a0e40)&&_0x1a0e40&&!_['isUndefined'](_0x1a0e40[_0x2d4a('0x3c')])&&!_[_0x2d4a('0x3a')](_0x1a0e40[_0x2d4a('0x71')])&&_0x1a0e40['active']&&(this[_0x2d4a('0x1f')][util[_0x2d4a('0x73')](_0x2d4a('0xcb'),_0x1a0e40[_0x2d4a('0x3c')])][_0x2d4a('0xa2')]==='reachable'||this[_0x2d4a('0x1f')][util[_0x2d4a('0x73')](_0x2d4a('0xcb'),_0x1a0e40[_0x2d4a('0x3c')])]['status']===_0x2d4a('0xcc'));};Dialer[_0x2d4a('0x1a')][_0x2d4a('0xcd')]=function(_0x42246c,_0x1bc431,_0x291053){this[_0x2d4a('0xbc')](_0x42246c)['catch'](loggerCatch(_0x1bc431));this[_0x2d4a('0xba')](_0x42246c)[_0x2d4a('0xa3')](loggerCatch(_0x291053));};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x35')]=function(_0x139e4e){var _0x34923f=this['uniqueId'][_0x139e4e[_0x2d4a('0xce')]];var _0x472e16;if(!_[_0x2d4a('0xa1')](_0x139e4e)&&!_[_0x2d4a('0xa1')](_0x139e4e[_0x2d4a('0xcf')])&&!_['isNil'](_0x139e4e['variable'][_0x2d4a('0xd0')])&&_0x139e4e[_0x2d4a('0xd1')]===_0x2d4a('0xd2')&&_0x34923f){if(_0x34923f[_0x2d4a('0x4b')]!==_0x2d4a('0x76')&&this[_0x2d4a('0x1d')][_0x34923f[_0x2d4a('0xa6')]][_0x2d4a('0xd3')]&&_0x139e4e[_0x2d4a('0xd4')]==='HANGUP'){delete this['uniqueId'][_0x139e4e[_0x2d4a('0xce')]];this[_0x2d4a('0xa5')](this[_0x2d4a('0x1d')][_0x34923f[_0x2d4a('0xa6')]]);this[_0x2d4a('0x1d')][_0x34923f[_0x2d4a('0xa6')]][_0x2d4a('0xd5')]+=0x1;this[_0x2d4a('0x1d')][_0x34923f[_0x2d4a('0xa6')]][_0x2d4a('0x5b')]+=0x1;_0x472e16=new Hangup(_0x34923f,_0x139e4e);_0x472e16[_0x2d4a('0x9b')]=0x12;_0x472e16[_0x2d4a('0x9c')]='HangupInAMD';_0x472e16['membername']='AMD';this[_0x2d4a('0xcd')](_0x472e16,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x34923f[_0x2d4a('0x4b')]!==_0x2d4a('0x76')&&this['voiceQueues'][_0x34923f['queue']]['dialAMDActive']&&_0x139e4e[_0x2d4a('0xd4')]===_0x2d4a('0xd6')){delete this[_0x2d4a('0x9f')][_0x139e4e[_0x2d4a('0xce')]];this[_0x2d4a('0xa5')](this[_0x2d4a('0x1d')][_0x34923f[_0x2d4a('0xa6')]]);this[_0x2d4a('0x1d')][_0x34923f[_0x2d4a('0xa6')]][_0x2d4a('0xd5')]+=0x1;this['voiceQueues'][_0x34923f[_0x2d4a('0xa6')]][_0x2d4a('0x5b')]+=0x1;_0x472e16=new Hangup(_0x34923f,_0x139e4e);_0x472e16[_0x2d4a('0x9b')]=0x13;_0x472e16[_0x2d4a('0x9c')]=_0x2d4a('0xd7');_0x472e16[_0x2d4a('0xd8')]='AMD';_0x472e16[_0x2d4a('0xd9')]=!![];this[_0x2d4a('0xcd')](_0x472e16,'[syncMachine][createHistory]',_0x2d4a('0xda'));}if(_0x34923f[_0x2d4a('0x4b')]==='ivr'&&this['campaigns'][_0x34923f['queue']]['dialAMDActive']&&_0x139e4e[_0x2d4a('0xd4')]==='HANGUP'){delete this[_0x2d4a('0x9f')][_0x139e4e[_0x2d4a('0xce')]];this[_0x2d4a('0xa5')](this[_0x2d4a('0x1e')][_0x34923f[_0x2d4a('0xa6')]]);_0x472e16=new Hangup(_0x34923f,_0x139e4e);_0x472e16[_0x2d4a('0x9b')]=0x12;_0x472e16[_0x2d4a('0x9c')]='HangupInAMD';_0x472e16[_0x2d4a('0xd8')]='AMD';this[_0x2d4a('0xcd')](_0x472e16,_0x2d4a('0xdb'),_0x2d4a('0xdc'));}if(_0x34923f[_0x2d4a('0x4b')]===_0x2d4a('0x76')&&this[_0x2d4a('0x1e')][_0x34923f[_0x2d4a('0xa6')]]['dialAMDActive']&&_0x139e4e[_0x2d4a('0xd4')]==='MACHINE'){delete this[_0x2d4a('0x9f')][_0x139e4e[_0x2d4a('0xce')]];this[_0x2d4a('0xa5')](this['campaigns'][_0x34923f[_0x2d4a('0xa6')]]);_0x472e16=new Hangup(_0x34923f,_0x139e4e);_0x472e16[_0x2d4a('0x9b')]=0x13;_0x472e16[_0x2d4a('0x9c')]=_0x2d4a('0xd7');_0x472e16[_0x2d4a('0xd8')]=_0x2d4a('0xdd');_0x472e16['amd']=!![];this[_0x2d4a('0xcd')](_0x472e16,'[syncMachineIvr][createHistory]',_0x2d4a('0xde'));}}};Dialer['prototype']['syncHangup']=function(_0x410874){var _0x5364e7=this['uniqueId'][_0x410874[_0x2d4a('0xce')]];var _0x206717=this;var _0x3c998d;if(_0x5364e7&&_0x5364e7[_0x2d4a('0x4b')]===_0x2d4a('0x76')){delete this[_0x2d4a('0x9f')][_0x410874[_0x2d4a('0xce')]];this['updateOriginated'](this['campaigns'][_0x5364e7[_0x2d4a('0xa6')]]);this[_0x2d4a('0x1e')][_0x5364e7[_0x2d4a('0xa6')]][_0x2d4a('0xdf')]+=0x1;_0x3c998d=new Hangup(_0x5364e7,_0x410874);this[_0x2d4a('0xbc')](_0x3c998d)[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xe0')));this['moveContactManagedDialer'](_0x3c998d)[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xe1')));}if(_0x5364e7&&_0x5364e7['type']!==_0x2d4a('0x76')&&isNotNull(this['voiceQueues'][_0x5364e7[_0x2d4a('0xa6')]][_0x2d4a('0xe2')])){delete this[_0x2d4a('0x9f')][_0x410874['uniqueid']];this[_0x2d4a('0xa5')](this['voiceQueues'][_0x5364e7['queue']]);this[_0x2d4a('0x1d')][_0x5364e7[_0x2d4a('0xa6')]][_0x2d4a('0xd5')]+=0x1;this['voiceQueues'][_0x5364e7[_0x2d4a('0xa6')]]['outboundAnswerAgiCallsDay']+=0x1;_0x3c998d=new Hangup(_0x5364e7,_0x410874);_0x3c998d[_0x2d4a('0x9b')]=0x10;_0x3c998d[_0x2d4a('0x9c')]='AnswerAGI';_0x3c998d[_0x2d4a('0xd8')]=_0x2d4a('0xe3');this[_0x2d4a('0xbc')](_0x3c998d)[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xe0')));this[_0x2d4a('0xba')](_0x3c998d)[_0x2d4a('0xa3')](loggerCatch('[syncHangupIvr]'));}if(_0x5364e7&&_0x5364e7[_0x2d4a('0x4b')]!==_0x2d4a('0x76')&&!isNotNull(this[_0x2d4a('0x1d')][_0x5364e7[_0x2d4a('0xa6')]][_0x2d4a('0xe2')])){delete this[_0x2d4a('0x9f')][_0x410874['uniqueid']];this['updateOriginated'](this[_0x2d4a('0x1d')][_0x5364e7[_0x2d4a('0xa6')]]);this[_0x2d4a('0x1d')][_0x5364e7[_0x2d4a('0xa6')]][_0x2d4a('0x66')]+=0x1;_0x3c998d=new Hangup(_0x5364e7,_0x410874);_0x3c998d[_0x2d4a('0x9b')]=0xc;_0x3c998d[_0x2d4a('0x9c')]=_0x410874[_0x2d4a('0xe4')];_0x3c998d['membername']=_0x2d4a('0xe5');this[_0x2d4a('0xbc')](_0x3c998d)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x2d4a('0xba')](_0x3c998d)[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xe1')));}};Dialer['prototype'][_0x2d4a('0x30')]=function(_0x377ce0){var _0x4ce66e=this[_0x2d4a('0x9f')][_0x377ce0[_0x2d4a('0xce')]];var _0x3b204d=this;if(this[_0x2d4a('0x1d')][_0x377ce0[_0x2d4a('0xa6')]]){if(_0x4ce66e&&_0x4ce66e['type']!=='ivr'){delete this[_0x2d4a('0x9f')][_0x377ce0['uniqueid']];this[_0x2d4a('0x1d')][_0x377ce0[_0x2d4a('0xa6')]][_0x2d4a('0xd5')]+=0x1;var _0x560627=new AgentComplete(_0x4ce66e,_0x377ce0);if(_0x377ce0[_0x2d4a('0xe6')]===_0x2d4a('0xe7')){_0x560627[_0x2d4a('0xe8')]=this[_0x2d4a('0x1d')][_0x377ce0[_0x2d4a('0xa6')]][_0x2d4a('0xe9')]&&this[_0x2d4a('0x1d')][_0x377ce0[_0x2d4a('0xa6')]]['dialAgiAfterHangupAgent']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x2d4a('0xbc')](_0x560627)[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xea')));this['moveContactManagedDialer'](_0x560627)[_0x2d4a('0xa3')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x2a')]=function(_0x272df1){if(this[_0x2d4a('0x1d')][_0x272df1[_0x2d4a('0xa6')]]){if(this[_0x2d4a('0x9f')][_0x272df1[_0x2d4a('0xce')]]&&this['uniqueId'][_0x272df1[_0x2d4a('0xce')]][_0x2d4a('0x4b')]!==_0x2d4a('0x76')){this['updateOriginated'](this['voiceQueues'][_0x272df1[_0x2d4a('0xa6')]]);this['uniqueId'][_0x272df1['uniqueid']]['answertime']=moment()[_0x2d4a('0x73')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x2d4a('0x1a')]['queueCallerAbandonCreateState']=function(_0x33672c){this['createHistory'](_0x33672c)[_0x2d4a('0xa3')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x2d4a('0xba')](_0x33672c)[_0x2d4a('0xa3')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x2c')]=function(_0x320f91){var _0x4fcd8e=this['uniqueId'][_0x320f91[_0x2d4a('0xce')]];var _0x1d1154=this;if(this[_0x2d4a('0x1d')][_0x320f91[_0x2d4a('0xa6')]]){if(_0x4fcd8e&&_0x4fcd8e[_0x2d4a('0x4b')]!==_0x2d4a('0x76')){delete this[_0x2d4a('0x9f')][_0x320f91[_0x2d4a('0xce')]];this[_0x2d4a('0xa5')](this[_0x2d4a('0x1d')][_0x320f91[_0x2d4a('0xa6')]]);_0x4fcd8e[_0x2d4a('0xeb')]=moment()[_0x2d4a('0x73')](_0x2d4a('0xec'));var _0x580e1c=new QueueCallerAbandon(_0x4fcd8e,_0x320f91);if(getSeconds(_0x4fcd8e[_0x2d4a('0xeb')],_0x4fcd8e[_0x2d4a('0xed')])>=_0x4fcd8e[_0x2d4a('0xee')]){this[_0x2d4a('0x1d')][_0x320f91[_0x2d4a('0xa6')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2d4a('0x1d')][_0x320f91[_0x2d4a('0xa6')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x320f91[_0x2d4a('0xa6')]][_0x2d4a('0x6b')]+=0x1;_0x580e1c[_0x2d4a('0x9b')]=0xa;_0x580e1c[_0x2d4a('0x9c')]=_0x2d4a('0xef');_0x580e1c['dropreason']=_0x2d4a('0xf0');_0x580e1c[_0x2d4a('0xe8')]=this[_0x2d4a('0x1d')][_0x320f91['queue']][_0x2d4a('0xe9')]?moment()[_0x2d4a('0x73')](_0x2d4a('0xec')):undefined;this[_0x2d4a('0xf1')](_0x580e1c);}else{this[_0x2d4a('0x1d')][_0x320f91[_0x2d4a('0xa6')]][_0x2d4a('0x69')]+=0x1;this['voiceQueues'][_0x320f91['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x580e1c['state']=0xb;_0x580e1c['statedesc']=_0x2d4a('0xf2');_0x580e1c[_0x2d4a('0xf3')]=_0x2d4a('0xf4');this[_0x2d4a('0xf1')](_0x580e1c);}}}};Dialer['prototype'][_0x2d4a('0x33')]=function(_0x6d82c8){if(this[_0x2d4a('0x22')][_0x6d82c8['uniqueid']]){this['actions'][_0x6d82c8[_0x2d4a('0xce')]][_0x2d4a('0xf5')]=_0x6d82c8[_0x2d4a('0xf5')];}if(this[_0x2d4a('0x9f')][_0x6d82c8['uniqueid']]){this[_0x2d4a('0x9f')][_0x6d82c8[_0x2d4a('0xce')]][_0x2d4a('0xf5')]=_0x6d82c8[_0x2d4a('0xf5')];}};Dialer['prototype']['syncQueueMember']=function(_0x22b7a0){if(strategy[this[_0x2d4a('0x1d')][this[_0x2d4a('0x22')][_0x22b7a0[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]][_0x2d4a('0x4d')]]===_0x2d4a('0xf7')){if(this[_0x2d4a('0x22')][_0x22b7a0[_0x2d4a('0xf6')]]&&_[_0x2d4a('0xa1')](this[_0x2d4a('0x22')][_0x22b7a0[_0x2d4a('0xf6')]][_0x2d4a('0xf8')])&&_0x22b7a0[_0x2d4a('0xa2')]==='1'&&_0x22b7a0[_0x2d4a('0xf9')]==='0'){if(this[_0x2d4a('0xfa')][_0x22b7a0[_0x2d4a('0xfb')]]){if(!this['agents'][_0x22b7a0[_0x2d4a('0xfb')]][_0x2d4a('0xf8')]){this[_0x2d4a('0xfa')][_0x22b7a0[_0x2d4a('0xfb')]][_0x2d4a('0xf8')]=!![];this['actions'][_0x22b7a0['actionid']][_0x2d4a('0xf8')]=!![];this['actions'][_0x22b7a0[_0x2d4a('0xf6')]][_0x2d4a('0xfb')]=_0x22b7a0[_0x2d4a('0xfb')];}}}}else if((strategy[this[_0x2d4a('0x1d')][this[_0x2d4a('0x22')][_0x22b7a0[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]]['strategy']]||_0x2d4a('0xfc'))===_0x2d4a('0xfc')){if(this['actions'][_0x22b7a0['actionid']]){if(this[_0x2d4a('0xfa')][_0x22b7a0[_0x2d4a('0xfb')]]){this[_0x2d4a('0x22')][_0x22b7a0[_0x2d4a('0xf6')]][_0x2d4a('0xfb')]=_0x22b7a0[_0x2d4a('0xfb')];if(_[_0x2d4a('0xa1')](this[_0x2d4a('0x27')][this[_0x2d4a('0x22')][_0x22b7a0['actionid']][_0x2d4a('0xa6')]])){this[_0x2d4a('0x27')][this[_0x2d4a('0x22')][_0x22b7a0['actionid']][_0x2d4a('0xa6')]]=[];}this[_0x2d4a('0x27')][this[_0x2d4a('0x22')][_0x22b7a0[_0x2d4a('0xf6')]]['queue']]['push'](_[_0x2d4a('0x80')](_[_0x2d4a('0xfd')](this['actions'][_0x22b7a0[_0x2d4a('0xf6')]],[_0x2d4a('0xfe'),'stateinterface']),{'status':_0x22b7a0[_0x2d4a('0xa2')],'paused':_0x22b7a0[_0x2d4a('0xf9')]}));}}}};function unlockQueueStatus(_0x553f08,_0x4f6705){setTimeout(function(){if(_[_0x2d4a('0x3a')](_0x553f08['queueStatusComplete'])){loggerBooked[_0x2d4a('0x88')](_0x2d4a('0xff'),_0x4f6705);}_0x553f08['queueStatusComplete']=!![];loggerBooked[_0x2d4a('0x7a')](_0x2d4a('0x100'),_0x4f6705,JSON[_0x2d4a('0x47')](_[_0x2d4a('0xfd')](_0x553f08,[_0x2d4a('0x3c'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x2d4a('0x1a')]['syncQueueStatusComplete']=function(_0x5e561c){var _0x19c4f6=this;var _0x5e3748=_0x19c4f6['voiceQueues'][_0x19c4f6[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]];if(strategy[this['voiceQueues'][this['actions'][_0x5e561c[_0x2d4a('0xf6')]]['queue']][_0x2d4a('0x4d')]]===_0x2d4a('0xf7')){if(this['actions'][_0x5e561c[_0x2d4a('0xf6')]]&&this[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xfb')]){this[_0x2d4a('0x84')][_0x2d4a('0x101')](this[_0x2d4a('0x22')][_0x5e561c['actionid']][_0x2d4a('0xfe')],this[_0x2d4a('0x22')][_0x5e561c['actionid']][_0x2d4a('0xfb')])[_0x2d4a('0xa3')](function(_0xff6002){logger['error'](_0x2d4a('0x102'),util[_0x2d4a('0x89')](_0xff6002,{'showHidden':![],'depth':null}));})[_0x2d4a('0x103')](function(){_0x19c4f6['updateOriginated'](_0x19c4f6[_0x2d4a('0x1d')][_0x19c4f6[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]]);_0x19c4f6['agents'][_0x19c4f6['actions'][_0x5e561c['actionid']][_0x2d4a('0xfb')]][_0x2d4a('0xf8')]=![];delete _0x19c4f6['actions'][_0x5e561c[_0x2d4a('0xf6')]];unlockQueueStatus(_0x5e3748);});}else{this[_0x2d4a('0xa5')](this[_0x2d4a('0x1d')][this[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]]);this[_0x2d4a('0xb3')]({'active':![],'ContactId':this[_0x2d4a('0x22')][_0x5e561c['actionid']][_0x2d4a('0xc2')],'ListId':this[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xc3')],'VoiceQueueId':this[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x2d4a('0x22')][_0x5e561c['actionid']][_0x2d4a('0xc5')]||undefined})[_0x2d4a('0xa3')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]];unlockQueueStatus(_0x5e3748);}}else if((strategy[this[_0x2d4a('0x1d')][this[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]][_0x2d4a('0x4d')]]||_0x2d4a('0xfc'))===_0x2d4a('0xfc')){var _0x3641dd;if(this['actions'][_0x5e561c[_0x2d4a('0xf6')]]&&!_[_0x2d4a('0x45')](this[_0x2d4a('0x27')][this[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]])){if(this['queueBookedRR'][_0x19c4f6[_0x2d4a('0x22')][_0x5e561c['actionid']][_0x2d4a('0xa6')]]){this[_0x2d4a('0x28')][_0x19c4f6['actions'][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]]=this['queueBookedRR'][this['actions'][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]]?this[_0x2d4a('0x28')][this['actions'][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]]:this[_0x2d4a('0x27')][this[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]]?this[_0x2d4a('0x27')][this[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]][_0x2d4a('0xa6')]][_0x2d4a('0x104')]||0x0:0x0;}this[_0x2d4a('0x27')][this[_0x2d4a('0x22')][_0x5e561c[_0x2d4a('0xf6')]]['queue']][_0x2d4a('0x104')]=this[_0x2d4a('0x28')][this['actions'][_0x5e561c[_0x2d4a('0xf6')]]['queue']];for(var _0x134656=0x0;_0x134656=0x0?!![]:![];})[_0x2d4a('0xa3')](myreject(_0x46754d)));}}else{_0x779fad[_0x2d4a('0x119')](ami[_0x2d4a('0x11a')]({'action':_0x2d4a('0x11b'),'command':util[_0x2d4a('0x73')](_0x2d4a('0x11e'),_0x2dda4b,!_['isUndefined'](config[_0x2d4a('0x116')][_0x35acfe])?_0x35acfe:'')})[_0x2d4a('0xab')](function(_0x5873aa){return _0x5873aa[_0x2d4a('0x11c')][_0x2d4a('0x11d')](_0x2d4a('0x11f'))>=0x0?!![]:![];})[_0x2d4a('0xa3')](myreject(_0x46754d)));}BPromise[_0x2d4a('0x120')](_0x779fad)['then'](function(_0x2be21a){var _0x4026ed=_[_0x2d4a('0x121')](_0x2be21a);if(_0x4026ed){return _0x4335c6(_0x4026ed);}else{_0x5937e4[_0x2d4a('0x3e')]=_0x10f433?_0x2d4a('0x122'):_0x2d4a('0x123');return _0x46754d(msgResponse('[ifTime][promiseAll]',_0x2d4a('0x113'),_0x2d4a('0x124')+_0x10f433+'\x20'+_0x1b0325+_0x2d4a('0x125')+util[_0x2d4a('0x89')](_0x2dda4b,{'showHidden':![],'depth':null})+_0x2d4a('0x126')+_0x35acfe));}})[_0x2d4a('0xa3')](function(_0x3c7087){return _0x46754d(msgResponse(_0x2d4a('0x111'),_0x2d4a('0x113'),JSON[_0x2d4a('0x47')](_0x3c7087)));});});};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x127')]=function(_0x1eedb5){var _0x10e626=this;return function(){switch(_0x1eedb5[_0x2d4a('0x57')]){case'progressive':freeVariablesPredictive(_0x1eedb5);_0x10e626[_0x2d4a('0x128')](_0x1eedb5,0x1);break;case _0x2d4a('0x129'):freeVariablesPredictive(_0x1eedb5);_0x10e626['handlePower'](_0x1eedb5,_0x1eedb5[_0x2d4a('0x12a')]);break;case _0x2d4a('0x7'):_0x10e626[_0x2d4a('0x7')](_0x1eedb5);break;case _0x2d4a('0x6'):freeVariablesPredictive(_0x1eedb5);_0x10e626['handlePower'](_0x1eedb5,0x1);break;default:freeVariablesPredictive(_0x1eedb5);logger[_0x2d4a('0x88')](_0x2d4a('0x12b'),_0x1eedb5[_0x2d4a('0x3c')],_0x2d4a('0x12c'));}};};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x12d')]=function(_0x3cfb52){var _0x187187=this;return function(){_0x187187[_0x2d4a('0x12e')](_0x3cfb52);};};Dialer[_0x2d4a('0x1a')]['syncQueueSummary']=function(_0x27baf3){var _0x22114c=this;if(isNotPreview(_0x27baf3['dialMethod'])){if(isVoiceQueueOutbound(_0x27baf3[_0x2d4a('0x4b')])&&isActive(_0x27baf3[_0x2d4a('0x56')])){_0x27baf3[_0x2d4a('0x94')]=!![];BPromise[_0x2d4a('0xaa')]()[_0x2d4a('0xab')](checkIsLoggedIn(_0x27baf3,_0x27baf3[_0x2d4a('0x50')]))[_0x2d4a('0xab')](checkIsActive(_0x27baf3,_0x27baf3[_0x2d4a('0x56')]))[_0x2d4a('0xab')](checkInterval(_0x27baf3))[_0x2d4a('0xab')](_0x22114c['checkIsTrunkReachable'](_0x27baf3))[_0x2d4a('0xab')](_0x22114c[_0x2d4a('0x110')](_0x27baf3[_0x2d4a('0x12f')],_0x27baf3[_0x2d4a('0x130')],_0x27baf3[_0x2d4a('0x3c')],_0x27baf3))[_0x2d4a('0xab')](_0x22114c[_0x2d4a('0x112')](_0x27baf3[_0x2d4a('0x43')],_0x27baf3['dialTimezone'],_0x27baf3[_0x2d4a('0x3c')],_0x27baf3))['then'](_0x22114c[_0x2d4a('0x127')](_0x27baf3))[_0x2d4a('0xa3')](loggerCatchQueueSummary(_0x2d4a('0x131'),_0x27baf3));}else{notSendMessagesQueue(_0x27baf3);}}else{freeVariablesPredictive(_0x27baf3);}};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x10e')]=function(){var _0x290e5f=this;var _0x4b05bc;for(var _0x1f1dec in this[_0x2d4a('0x1e')]){if(this[_0x2d4a('0x1e')][_0x2d4a('0x8b')](_0x1f1dec)){_0x4b05bc=this[_0x2d4a('0x1e')][_0x1f1dec];if(isCampaignIvr(_0x4b05bc[_0x2d4a('0x4b')])&&isActive(_0x4b05bc[_0x2d4a('0x71')])){_0x4b05bc[_0x2d4a('0x94')]=!![];BPromise[_0x2d4a('0xaa')]()['then'](checkIsActive(_0x4b05bc,_0x4b05bc[_0x2d4a('0x71')]))[_0x2d4a('0xab')](checkInterval(_0x4b05bc))[_0x2d4a('0xab')](_0x290e5f[_0x2d4a('0x132')](_0x4b05bc))[_0x2d4a('0xab')](_0x290e5f[_0x2d4a('0x110')](_0x4b05bc[_0x2d4a('0x12f')],_0x4b05bc['dialTimezone'],_0x4b05bc[_0x2d4a('0x3c')],_0x4b05bc))[_0x2d4a('0xab')](_0x290e5f[_0x2d4a('0x112')](_0x4b05bc[_0x2d4a('0x43')],_0x4b05bc[_0x2d4a('0x130')],_0x4b05bc[_0x2d4a('0x3c')],_0x4b05bc))[_0x2d4a('0xab')](_0x290e5f[_0x2d4a('0x12d')](_0x4b05bc))[_0x2d4a('0xa3')](loggerCatchQueueSummary(_0x2d4a('0x133'),_0x4b05bc));}else{notSendMessagesCampaign(_0x4b05bc);}}}};function getCallerIdRandom(_0x252c9d,_0x365959){var _0x2085c0,_0x3337a1,_0x3853d8;if(_0x365959<=0x0){_0x365959=0x1;}_0x2085c0=new RegExp(_0x2d4a('0x134')+_0x365959+'}$');_0x3337a1=Math[_0x2d4a('0x135')](0xa,_0x365959-0x1);_0x3853d8=Math[_0x2d4a('0x135')](0xa,_0x365959)-0x1;return util['format']('%s',_[_0x2d4a('0x136')](_0x252c9d,_0x2085c0,_[_0x2d4a('0x137')](_0x3337a1,_0x3853d8)));}function extractCalleridName(_0x2b4479){var _0x56acc7=_0x2b4479['match'](/"(.*?)"/);return _0x56acc7?_0x56acc7[0x1]:_0x2b4479;}function extractCalleridNumber(_0x52ecc0){var _0x16f84f=_0x52ecc0['match'](/<(.*?)>/);return _0x16f84f?_0x16f84f[0x1]:_0x52ecc0;}Dialer[_0x2d4a('0x1a')][_0x2d4a('0x138')]=function(_0x2a8766,_0x329388){var _0x3d5274=this;var _0x21cca3=uuid['v4']();this[_0x2d4a('0x22')][_0x21cca3]=new Action(_0x2a8766,_0x329388,_0x21cca3);return new BPromise(function(_0x4b9431,_0x1d69e5){if(_[_0x2d4a('0x3a')](_0x2a8766)&&_0x2d4a('0x139')!==typeof _0x2a8766){return _0x1d69e5(msgResponse(_0x2d4a('0x13a'),_0x2d4a('0x113'),_0x2d4a('0x13b')));}if(_['isUndefined'](_0x329388[_0x2d4a('0x13c')][_0x2d4a('0x13d')])||_0x329388[_0x2d4a('0x13c')][_0x2d4a('0x13d')]===null){return _0x1d69e5(msgResponse('originate',_0x2d4a('0x113'),'contact\x20is\x20undefine'));}var _0x35d623={'XMD-CALLERID':_0x3d5274[_0x2d4a('0x22')][_0x21cca3][_0x2d4a('0x13e')](),'XMD-AGI':_0x2a8766[_0x2d4a('0xe2')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2a8766[_0x2d4a('0xe2')]):_0x2d4a('0x13f'),'XMD-AGIAFTER':_0x2a8766[_0x2d4a('0xe9')]?util[_0x2d4a('0x73')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2a8766['dialQueueProject2']):'NONE','XMD-QUEUE':_0x2a8766[_0x2d4a('0x4b')]===_0x2d4a('0x4c')?util[_0x2d4a('0x73')](_0x2d4a('0x140'),_0x2a8766[_0x2d4a('0x3c')],_0x2a8766[_0x2d4a('0x141')]||'',_0x2a8766[_0x2d4a('0x142')]?'c':'',_0x2a8766[_0x2d4a('0xee')]||0x3):_0x2d4a('0x13f'),'XMD-CONTACTID':_0x329388[_0x2d4a('0xc2')],'XMD-CDRTYPE':_0x2d4a('0x4'),'CALLERID(all)':_0x3d5274[_0x2d4a('0x22')][_0x21cca3]['getCaller'](),'XMD-AMD':_0x2a8766[_0x2d4a('0xd3')]?_0x2d4a('0x143'):'NONE','XMD-DESTINATION':_0x2d4a('0xd2')};if(_0x2a8766[_0x2d4a('0xd3')]){_0x35d623['XMD-AMDINITIALSILENCE']=_0x2a8766[_0x2d4a('0x144')]||0x9c4;_0x35d623[_0x2d4a('0x145')]=_0x2a8766['dialAMDGreeting']||0x5dc;_0x35d623[_0x2d4a('0x146')]=_0x2a8766[_0x2d4a('0x147')]||0x320;_0x35d623[_0x2d4a('0x148')]=_0x2a8766[_0x2d4a('0x149')]||0x1388;_0x35d623[_0x2d4a('0x14a')]=_0x2a8766[_0x2d4a('0x14b')]||0x64;_0x35d623['XMD-AMDBETWEENWORDSSILENCE']=_0x2a8766['dialAMDBetweenWordsSilence']||0x32;_0x35d623[_0x2d4a('0x14c')]=_0x2a8766['dialAMDMaximumNumberOfWords']||0x3;_0x35d623[_0x2d4a('0x14d')]=_0x2a8766[_0x2d4a('0x14e')]||0x100;_0x35d623[_0x2d4a('0x14f')]=_0x2a8766[_0x2d4a('0x150')]||0x1388;}if(_0x2a8766[_0x2d4a('0x4b')]===_0x2d4a('0x4c')){_0x35d623[_0x2d4a('0x151')]=_0x329388[_0x2d4a('0x10b')];}else{_0x35d623['XMD-CAMPAIGNID']=_0x329388['CampaignId'];}for(var _0x56078b in _0x329388[_0x2d4a('0x13c')]){if(_0x329388['Contact'][_0x2d4a('0x8b')](_0x56078b)){if(isNotNull(_0x329388['Contact'][_0x56078b])&&_0x56078b!=='id'&&_0x56078b!=='tags'&&_0x56078b!==_0x2d4a('0x152')&&_0x56078b!=='updatedAt'){_0x35d623[util[_0x2d4a('0x73')](_0x2d4a('0x153'),_0x2d4a('0x154'),_[_0x2d4a('0x155')](_0x56078b))]=_0x329388[_0x2d4a('0x13c')][_0x56078b];}}}var _0x1bf89e=_0x3d5274[_0x2d4a('0xca')](_0x2a8766['Trunk'])?getCallerId(_0x2a8766[_0x2d4a('0x70')]['callerid'],_0x2a8766[_0x2d4a('0x58')],_0x2a8766[_0x2d4a('0x156')]>0x0?getCallerIdRandom(_0x2a8766[_0x2d4a('0x59')],_0x2a8766['dialRandomLastDigitCallerIdNumber']):_0x2a8766['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x2a8766[_0x2d4a('0x157')])?_0x2a8766[_0x2d4a('0x70')]['callerid']:_0x2a8766[_0x2d4a('0x157')][_0x2d4a('0x72')],_0x2a8766[_0x2d4a('0x58')],_0x2a8766['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2a8766['dialOriginateCallerIdNumber'],_0x2a8766[_0x2d4a('0x156')]):_0x2a8766[_0x2d4a('0x59')]);if(_0x1bf89e){_0x35d623['XMD-ORIGINATECALLERIDNAME']=_0x3d5274[_0x2d4a('0x22')][_0x21cca3][_0x2d4a('0x158')]=extractCalleridName(_0x1bf89e);_0x35d623[_0x2d4a('0x159')]=_0x3d5274[_0x2d4a('0x22')][_0x21cca3][_0x2d4a('0x15a')]=extractCalleridNumber(_0x1bf89e);}return ami[_0x2d4a('0x11a')]({'actionid':_0x21cca3,'action':_0x2d4a('0x13a'),'channel':_0x3d5274[_0x2d4a('0xca')](_0x2a8766['Trunk'])?util['format'](_0x2d4a('0x15b'),_0x2a8766[_0x2d4a('0x70')][_0x2d4a('0x3c')],isNotNull(_0x2a8766[_0x2d4a('0x5a')])?_0x2a8766[_0x2d4a('0x5a')][_0x2d4a('0x15c')]()||'':'',_0x2a8766['dialCutDigit']>0x0?_0x329388[_0x2d4a('0x13c')][_0x2d4a('0x13d')][_0x2d4a('0x15d')](_0x2a8766['dialCutDigit']):_0x329388[_0x2d4a('0x13c')][_0x2d4a('0x13d')]):util[_0x2d4a('0x73')](_0x2d4a('0x15b'),_[_0x2d4a('0xa1')](_0x2a8766[_0x2d4a('0x157')])?_0x2a8766[_0x2d4a('0x70')][_0x2d4a('0x3c')]:_0x2a8766[_0x2d4a('0x157')]['name'],isNotNull(_0x2a8766[_0x2d4a('0x5a')])?_0x2a8766[_0x2d4a('0x5a')][_0x2d4a('0x15c')]()||'':'',_0x2a8766[_0x2d4a('0x15e')]>0x0?_0x329388[_0x2d4a('0x13c')][_0x2d4a('0x13d')]['substring'](_0x2a8766['dialCutDigit']):_0x329388[_0x2d4a('0x13c')][_0x2d4a('0x13d')]),'callerid':_0x1bf89e,'Exten':_0x2d4a('0xd2'),'Context':_0x2d4a('0x15f'),'Priority':'1','variable':_0x35d623,'timeout':(_0x2a8766['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x21cca3})['then'](function(_0x21dd2d){return _0x4b9431(_0x21dd2d);})[_0x2d4a('0xa3')](function(_0x1d0dd3){_0x2a8766[_0x2d4a('0x63')]+=0x1;var _0xaec0ff=new History(_0x3d5274['actions'][_0x21cca3]);logger[_0x2d4a('0x88')](util[_0x2d4a('0x73')]('[originateError]:\x20%s',JSON['stringify'](_0x1d0dd3)));_0xaec0ff[_0x2d4a('0x9b')]=0xe;_0xaec0ff[_0x2d4a('0x9c')]='OriginateError';_0xaec0ff[_0x2d4a('0x9d')]=moment()[_0x2d4a('0x73')]('YYYY-MM-DD\x20HH:mm:ss');_0xaec0ff[_0x2d4a('0x160')]=_0xaec0ff[_0x2d4a('0x9d')];_0x3d5274['createHistory'](_0xaec0ff)[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0x161')));_0x3d5274[_0x2d4a('0xba')](_0xaec0ff)[_0x2d4a('0xa3')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x3d5274[_0x2d4a('0x22')][_0x21cca3];return _0x1d69e5(msgResponse(_0x2d4a('0x13a'),_0x2d4a('0x46'),_0x2d4a('0x162')));});});});};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x2e')]=function(_0x3b924f){var _0x4af902=this['actions'][_0x3b924f[_0x2d4a('0xf6')]];var _0x2d4aba=this;if(_0x4af902){delete this['actions'][_0x3b924f['actionid']];_0x4af902[_0x2d4a('0xed')]=moment()[_0x2d4a('0x73')](_0x2d4a('0xec'));var _0x465f5a=_0x4af902[_0x2d4a('0x4b')]===_0x2d4a('0x76')?this[_0x2d4a('0x1e')][_0x4af902[_0x2d4a('0xa6')]]:this['voiceQueues'][_0x4af902[_0x2d4a('0x163')]()];if(!this[_0x2d4a('0xc8')](_0x3b924f[_0x2d4a('0x164')])){this[_0x2d4a('0xa5')](_0x465f5a);return this[_0x2d4a('0x165')](_0x4af902,_0x465f5a,_0x3b924f)[_0x2d4a('0xab')](function(_0x306ed0){})[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0x166')));}else{this[_0x2d4a('0x9f')][_0x3b924f[_0x2d4a('0xce')]]=_0x4af902;}}};Dialer['prototype'][_0x2d4a('0x167')]=function(_0x3660b0,_0x2990b4,_0x563205){var _0x45a920=new History(_0x2990b4);if(_0x45a920[_0x2d4a('0x168')]+_0x45a920['countcongestionretry']+_0x45a920[_0x2d4a('0x169')]>=_0x563205[_0x2d4a('0x16a')]-0x1){return!![];}switch(_0x3660b0){case 0x3:if(_0x45a920[_0x2d4a('0x169')]>=_0x563205['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x2d4a('0xb3')]({'active':![],'countnoanswerretry':_0x45a920[_0x2d4a('0x169')]+=0x1,'scheduledat':moment()['add'](_0x563205[_0x2d4a('0x16b')],_0x2d4a('0x16c'))[_0x2d4a('0x73')](_0x2d4a('0xec')),'ContactId':_0x45a920[_0x2d4a('0xc2')],'ListId':_0x45a920['ListId'],'VoiceQueueId':_0x45a920[_0x2d4a('0x10b')]||undefined,'CampaignId':_0x45a920['CampaignId']||undefined})['catch'](loggerCatch(_0x2d4a('0x16d')));}break;case 0x5:if(_0x45a920[_0x2d4a('0x168')]>=_0x563205[_0x2d4a('0x16e')]-0x1){return!![];}else{this[_0x2d4a('0xb3')]({'active':![],'countbusyretry':_0x45a920[_0x2d4a('0x168')]+=0x1,'scheduledat':moment()[_0x2d4a('0x16f')](_0x563205[_0x2d4a('0x170')],_0x2d4a('0x16c'))['format'](_0x2d4a('0xec')),'ContactId':_0x45a920[_0x2d4a('0xc2')],'ListId':_0x45a920[_0x2d4a('0xc3')],'VoiceQueueId':_0x45a920[_0x2d4a('0x10b')]||undefined,'CampaignId':_0x45a920[_0x2d4a('0xc5')]||undefined})[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0x171')));}break;case 0x8:if(_0x45a920['countcongestionretry']>=_0x563205[_0x2d4a('0x172')]-0x1){return!![];}else{this[_0x2d4a('0xb3')]({'active':![],'countcongestionretry':_0x45a920[_0x2d4a('0x173')]+=0x1,'scheduledat':moment()['add'](_0x563205['dialCongestionRetryFrequency'],_0x2d4a('0x16c'))[_0x2d4a('0x73')](_0x2d4a('0xec')),'ContactId':_0x45a920['ContactId'],'ListId':_0x45a920[_0x2d4a('0xc3')],'VoiceQueueId':_0x45a920[_0x2d4a('0x10b')]||undefined,'CampaignId':_0x45a920[_0x2d4a('0xc5')]||undefined})['catch'](loggerCatch(_0x2d4a('0x174')));}break;default:return!![];}};Dialer[_0x2d4a('0x1a')]['callProgressDetecting']=function(_0x2e960e,_0x393f76,_0x5be090){var _0x36757f=this;var _0x59f7ca=new History(_0x2e960e);return new BPromise(function(_0x579b52,_0x4c6c1c){if(_[_0x2d4a('0x3a')](_0x393f76)&&_0x2d4a('0x139')!==typeof _0x393f76){return _0x4c6c1c(msgResponse(_0x2d4a('0x175'),_0x2d4a('0x113'),_0x2d4a('0x176')));}if(_[_0x2d4a('0x3a')](_0x5be090)&&_0x2d4a('0x139')!==typeof _0x5be090){return _0x4c6c1c(msgResponse(_0x2d4a('0x175'),_0x2d4a('0x113'),_0x2d4a('0x177')));}switch(_0x5be090[_0x2d4a('0xe6')]){case'0':_0x393f76[_0x2d4a('0x62')]+=0x1;_0x59f7ca['state']=0x0;_0x59f7ca[_0x2d4a('0x9c')]=_0x2d4a('0x178');_0x36757f['createHistory'](_0x59f7ca)[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0x179')));if(_0x36757f[_0x2d4a('0x167')](0x0,_0x2e960e,_0x393f76)){if(_0x59f7ca[_0x2d4a('0x168')]+_0x59f7ca[_0x2d4a('0x173')]+_0x59f7ca[_0x2d4a('0x169')]>=_0x393f76['dialGlobalMaxRetry']){_0x36757f[_0x2d4a('0x17a')](_0x59f7ca,_0x579b52,_0x4c6c1c,_0x2d4a('0x17b'));}else{_0x36757f['createStateFinal'](_0x59f7ca,_0x579b52,_0x4c6c1c,_0x2d4a('0x17b'));}}break;case'3':_0x393f76[_0x2d4a('0x17c')]+=0x1;_0x59f7ca[_0x2d4a('0x9b')]=0x3;_0x59f7ca[_0x2d4a('0x9c')]='NoAnswer';_0x59f7ca[_0x2d4a('0x169')]+=0x1;_0x59f7ca[_0x2d4a('0x17d')]+=0x1;_0x36757f[_0x2d4a('0xbc')](_0x59f7ca)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x36757f[_0x2d4a('0x167')](0x3,_0x2e960e,_0x393f76)){if(_0x59f7ca[_0x2d4a('0x169')]>=_0x393f76[_0x2d4a('0x17e')]){_0x36757f[_0x2d4a('0x17f')](_0x59f7ca,_0x579b52,_0x4c6c1c,_0x2d4a('0x180'));}else{_0x36757f['stateGlobal'](_0x59f7ca,_0x579b52,_0x4c6c1c,_0x2d4a('0x180'));}}break;case'5':_0x393f76[_0x2d4a('0x5d')]+=0x1;_0x59f7ca[_0x2d4a('0x9b')]=0x5;_0x59f7ca['statedesc']=_0x2d4a('0x181');_0x59f7ca[_0x2d4a('0x168')]+=0x1;_0x59f7ca['countglobal']+=0x1;_0x36757f[_0x2d4a('0xbc')](_0x59f7ca)[_0x2d4a('0xa3')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x36757f[_0x2d4a('0x167')](0x5,_0x2e960e,_0x393f76)){if(_0x59f7ca['countbusyretry']>=_0x393f76[_0x2d4a('0x16e')]){_0x36757f[_0x2d4a('0x17f')](_0x59f7ca,_0x579b52,_0x4c6c1c,_0x2d4a('0x182'));}else{_0x36757f['stateGlobal'](_0x59f7ca,_0x579b52,_0x4c6c1c,_0x2d4a('0x182'));}}break;case'8':_0x393f76['outboundCongestionCallsDay']+=0x1;_0x59f7ca[_0x2d4a('0x9b')]=0x8;_0x59f7ca[_0x2d4a('0x9c')]=_0x2d4a('0x183');_0x59f7ca[_0x2d4a('0x173')]+=0x1;_0x59f7ca[_0x2d4a('0x17d')]+=0x1;_0x36757f[_0x2d4a('0xbc')](_0x59f7ca)[_0x2d4a('0xa3')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x36757f[_0x2d4a('0x167')](0x8,_0x2e960e,_0x393f76)){if(_0x59f7ca[_0x2d4a('0x173')]>=_0x393f76[_0x2d4a('0x172')]){_0x36757f[_0x2d4a('0x17f')](_0x59f7ca,_0x579b52,_0x4c6c1c,_0x2d4a('0x184'));}else{_0x36757f[_0x2d4a('0x17a')](_0x59f7ca,_0x579b52,_0x4c6c1c,'reason\x208\x20congestion');}}break;default:_0x393f76['outboundUnknownCallsDay']+=0x1;_0x59f7ca[_0x2d4a('0x9b')]=0xc;_0x59f7ca[_0x2d4a('0x9c')]=_0x5be090[_0x2d4a('0xe6')];_0x36757f['createHistory'](_0x59f7ca)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x36757f[_0x2d4a('0x167')](_0x5be090['reason'],_0x2e960e,_0x393f76)){if(_0x59f7ca['countbusyretry']+_0x59f7ca['countcongestionretry']+_0x59f7ca[_0x2d4a('0x169')]>=_0x393f76[_0x2d4a('0x16a')]){_0x36757f[_0x2d4a('0x17a')](_0x59f7ca,_0x579b52,_0x4c6c1c,_0x5be090[_0x2d4a('0xe6')]);}else{_0x36757f[_0x2d4a('0x17f')](_0x59f7ca,_0x579b52,_0x4c6c1c,_0x5be090[_0x2d4a('0xe6')]);}}}});};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x17a')]=function(_0x3037f0,_0xe4571c,_0x45f74f,_0x4d3c2b){var _0x5a625f=new Final(_0x3037f0);_0x5a625f[_0x2d4a('0x9b')]=0xf;_0x5a625f['statedesc']=_0x2d4a('0x185');this[_0x2d4a('0x17f')](_0x5a625f,_0xe4571c,_0x45f74f,_0x4d3c2b);};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x17f')]=function(_0x38f6a9,_0x299982,_0x35ed14,_0x2ea801){this[_0x2d4a('0xba')](_0x38f6a9)[_0x2d4a('0xab')](function(_0x66c43a){return _0x299982(msgResponse('[callProgressDetecting]','Success',_0x2ea801));})['catch'](function(_0x5684be){return _0x35ed14(msgResponse(_0x2d4a('0x186'),_0x2d4a('0x113'),'contact\x20not\x20moved'));});};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x7')]=function(_0x52ec4a){var _0x3c5cae=this;var _0xa894c6=_0x52ec4a[_0x2d4a('0x187')]/0x64;var _0x29e4c0=_0x52ec4a[_0x2d4a('0x61')]/(_0x52ec4a['outboundDropCallsDayTimeout']+_0x52ec4a['outboundAnswerCallsDay']);var _0x1ee150=_0x52ec4a['loggedIn']-_0x52ec4a[_0x2d4a('0x6e')]-_0x52ec4a[_0x2d4a('0x95')]-_0x52ec4a['originated']-_0x52ec4a['talking'];var _0x33dfb6=(_0x52ec4a[_0x2d4a('0x50')]-_0x52ec4a[_0x2d4a('0x6e')])*_0x52ec4a[_0x2d4a('0x6c')];var _0x318ee4=Math['floor'](_0x52ec4a[_0x2d4a('0x188')]*_0x52ec4a['erlangAbandonmentRate']*_0x52ec4a[_0x2d4a('0x189')]*_0x52ec4a[_0x2d4a('0x6d')]);if(_[_0x2d4a('0x3a')](_0x52ec4a[_0x2d4a('0x25')])){loggerPredictive[_0x2d4a('0x7a')](_0x2d4a('0x18a'));if(!_[_0x2d4a('0x3a')](_0x52ec4a[_0x2d4a('0x24')])){_0x52ec4a[_0x2d4a('0x24')]=undefined;loggerPredictive[_0x2d4a('0x88')](_0x2d4a('0x18b'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x2d4a('0x3a')](_0x52ec4a[_0x2d4a('0x83')])){loggerPredictive[_0x2d4a('0x88')](_0x2d4a('0x18b'),_0x2d4a('0x18c'));clearInterval(_0x52ec4a[_0x2d4a('0x83')]);_0x52ec4a[_0x2d4a('0x83')]=undefined;}_0x52ec4a[_0x2d4a('0x25')]=moment()[_0x2d4a('0x73')](_0x2d4a('0xec'));loggerPredictive[_0x2d4a('0x7a')](_0x2d4a('0x18d'),_0x52ec4a['startProgressive'],_0x52ec4a['name']);this['handlePower'](_0x52ec4a,0x1);}else if(ifInterval(_0x52ec4a[_0x2d4a('0x18e')],_0x52ec4a['startProgressive'])){this['handlePower'](_0x52ec4a,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x52ec4a[_0x2d4a('0x25')],_0x52ec4a[_0x2d4a('0x3c')]);_0x52ec4a[_0x2d4a('0x188')]=0x0;_0x52ec4a[_0x2d4a('0x6b')]=0x0;}else if(_0xa894c6<_0x29e4c0&&_0x52ec4a[_0x2d4a('0x18f')]===_0x2d4a('0x190')){freeVariablesPredictive(_0x52ec4a);loggerPredictive[_0x2d4a('0x7a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x2d4a('0x191'),_0x29e4c0,_0x2d4a('0x25'),_0x52ec4a[_0x2d4a('0x3c')]);}else if(_0x1ee150>_0x33dfb6){freeVariablesPredictive(_0x52ec4a);loggerPredictive[_0x2d4a('0x7a')](_0x2d4a('0x192'),'Agent\x20free',_0x1ee150,_0x2d4a('0x193'),_0x33dfb6);}else if(_0x318ee4<_0x52ec4a[_0x2d4a('0x6b')]&&_0x52ec4a[_0x2d4a('0x18f')]===_0x2d4a('0x190')){freeVariablesPredictive(_0x52ec4a);loggerPredictive[_0x2d4a('0x7a')](_0x2d4a('0x194'),_0x2d4a('0x195'),_0x318ee4,_0x2d4a('0x196'),_0x52ec4a[_0x2d4a('0x6b')],'startProgressive',_0x52ec4a[_0x2d4a('0x3c')]);}else if(!ifInterval(_0x52ec4a[_0x2d4a('0x18e')],_0x52ec4a[_0x2d4a('0x25')])&&_[_0x2d4a('0x3a')](_0x52ec4a['startPredictive'])&&!_[_0x2d4a('0x3a')](_0x52ec4a[_0x2d4a('0x25')])){_0x52ec4a[_0x2d4a('0x24')]=moment()[_0x2d4a('0x73')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2d4a('0x7a')](_0x2d4a('0x197'),_0x52ec4a[_0x2d4a('0x24')],_0x52ec4a[_0x2d4a('0x3c')]);this[_0x2d4a('0xb0')](_0x52ec4a[_0x2d4a('0x18e')])[_0x2d4a('0xab')](this['getDataPredictive'](_0x52ec4a))[_0x2d4a('0xab')](mergeDataErlangB(_0x52ec4a))[_0x2d4a('0xab')](this[_0x2d4a('0x198')](_0x52ec4a))['catch'](loggerCatchPredictive(_0x2d4a('0x199'),_0x52ec4a));}else if(!ifInterval(_0x52ec4a['dialPredictiveInterval'],_0x52ec4a[_0x2d4a('0x24')])){_0x52ec4a[_0x2d4a('0x6b')]=0x0;_0x52ec4a[_0x2d4a('0x24')]=moment()[_0x2d4a('0x73')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2d4a('0x7a')](_0x2d4a('0x19a'),_0x52ec4a[_0x2d4a('0x24')],_0x52ec4a[_0x2d4a('0x3c')]);clearInterval(_0x52ec4a[_0x2d4a('0x83')]);_0x52ec4a[_0x2d4a('0x83')]=undefined;this[_0x2d4a('0xb0')](_0x52ec4a[_0x2d4a('0x18e')])['then'](this[_0x2d4a('0x19b')](_0x52ec4a))['then'](mergeDataErlangB(_0x52ec4a))[_0x2d4a('0xab')](this[_0x2d4a('0x198')](_0x52ec4a))[_0x2d4a('0xa3')](loggerCatchPredictive(_0x2d4a('0x199'),_0x52ec4a));}};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x19b')]=function(_0x4846db){var _0x47b24c=this;return function(_0x24d44e){return new BPromise(function(_0x4e4241,_0x21b588){_['merge'](_0x4846db,_0x24d44e[0x0]);if(checkGetDataPredictive(_0x24d44e[0x0])){loggerPredictive['info'](JSON[_0x2d4a('0x47')](_0x24d44e[0x0]));if(_0x4846db[_0x2d4a('0x18f')]==='dropRate'){return _0x47b24c[_0x2d4a('0xb8')](_0x4846db['id'])[_0x2d4a('0xab')](function(_0x3c1979){var _0x54b498=_0x4846db[_0x2d4a('0x50')]-_0x3c1979[0x0]['outboundQueuePauses'];var _0x2caabd=_0x4846db[_0x2d4a('0x18e')]*0x3c;var _0x652bb0=_0x24d44e[0x0][_0x2d4a('0x68')]+_0x24d44e[0x0]['predictiveIntervalAvgHoldtime'];var _0x24452c=(_0x24d44e[0x0][_0x2d4a('0x67')]+_0x24d44e[0x0][_0x2d4a('0x6a')]+_0x24d44e[0x0][_0x2d4a('0x69')])/_0x24d44e[0x0][_0x2d4a('0x6f')];var _0x319dbb=_0x4846db['dialPredictiveOptimizationPercentage']/0x64;_0x4846db[_0x2d4a('0x6e')]=_0x3c1979[0x0][_0x2d4a('0x19c')]||0x0;_0x4846db[_0x2d4a('0x189')]=_0x24452c>0x0?_0x24452c:0x1;return _0x47b24c[_0x2d4a('0x19d')](_0x54b498,_0x2caabd,_0x652bb0,_0x24452c,_0x319dbb);})[_0x2d4a('0xab')](function(_0x3a1dea){return _0x4e4241(_0x3a1dea);})[_0x2d4a('0xa3')](function(_0x40cdbc){return _0x21b588(msgResponse('[CatchErlangB]',_0x2d4a('0x113'),JSON['stringify'](_0x40cdbc)));});}if(_0x4846db[_0x2d4a('0x18f')]===_0x2d4a('0x19e')){return _0x47b24c[_0x2d4a('0xb8')](_0x4846db['id'])[_0x2d4a('0xab')](function(_0x5623e0){var _0x3b6be7=_0x4846db[_0x2d4a('0x50')]-_0x5623e0[0x0][_0x2d4a('0x19c')];var _0x3be202=_0x4846db[_0x2d4a('0x18e')]*0x3c;var _0x4af8b6=_0x24d44e[0x0][_0x2d4a('0x68')]+_0x24d44e[0x0]['predictiveIntervalAvgHoldtime'];var _0x4fb133=(_0x24d44e[0x0][_0x2d4a('0x67')]+_0x24d44e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x24d44e[0x0][_0x2d4a('0x69')])/_0x24d44e[0x0][_0x2d4a('0x6f')];var _0x2001a6=_0x4846db[_0x2d4a('0x187')]/0x64;_0x4846db[_0x2d4a('0x6e')]=_0x5623e0[0x0][_0x2d4a('0x19c')]||0x0;_0x4846db[_0x2d4a('0x189')]=_0x4fb133>0x0?_0x4fb133:0x1;return _0x47b24c[_0x2d4a('0x19f')](_0x3b6be7,_0x3be202,_0x4af8b6,_0x4fb133,_0x2001a6);})[_0x2d4a('0xab')](function(_0x5e47f0){return _0x4e4241(_0x5e47f0);})[_0x2d4a('0xa3')](function(_0x4a90d4){return _0x21b588(msgResponse(_0x2d4a('0x1a0'),_0x2d4a('0x113'),JSON['stringify'](_0x4a90d4)));});}}else{return _0x21b588(msgResponse(_0x2d4a('0x1a1'),_0x2d4a('0x113'),'check\x20failure'));}});};};Dialer[_0x2d4a('0x1a')]['startMethodPredictive']=function(_0x320c53){var _0x132153=this;return function(){var _0x35a9ce=0x0;var _0x532b54=Math[_0x2d4a('0x1a2')](_0x320c53['erlangCallToSecond']*0x3e8);if(_0x532b54>0x0){_0x532b54=_0x532b54<0x64?0x64:_0x532b54;loggerPredictive[_0x2d4a('0x7a')]('[startMethodPredictive]',_0x532b54);_0x320c53['handlePredictive']=setInterval(function(){_0x132153[_0x2d4a('0x83')](_0x320c53);loggerPredictiveCalls[_0x2d4a('0x7a')](_0x2d4a('0x1a3'),_0x35a9ce+=0x1);},_0x532b54);}else{loggerPredictive[_0x2d4a('0x7a')]('[startMethodPredictive][milliseconds]\x20','Failure\x20',_0x532b54);}};};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x1a4')]=function(_0x2ec0f9,_0x1e9d7b){var _0x310811=this;return function(_0x56dd36){if(_[_0x2d4a('0x45')](_0x56dd36)){if(_[_0x2d4a('0xa1')](_0x1e9d7b[_0x2d4a('0xc4')])||!_0x1e9d7b['recallme']){if(_0x2ec0f9[_0x2d4a('0x57')]===_0x2d4a('0x6')){_0x2ec0f9[_0x2d4a('0x1a5')]=_['isUndefined'](_0x2ec0f9['queueStatusComplete'])?!![]:_0x2ec0f9[_0x2d4a('0x1a5')];var _0x2ec8b5=uuid['v4']();_0x310811['actions'][_0x2ec8b5]=new Action(_0x2ec0f9,_0x1e9d7b,_0x2ec8b5);loggerBooked[_0x2d4a('0x7a')](_0x2d4a('0x1a6'),_0x2ec8b5,_0x2d4a('0x1a7'),JSON['stringify'](_0x2ec0f9['queueStatusComplete']),_0x2d4a('0x1a8'),_0x2ec0f9[_0x2d4a('0x3c')]);if(_0x2ec0f9[_0x2d4a('0x1a5')]){_0x2ec0f9[_0x2d4a('0x1a5')]=![];_0x310811['queueBooked'][_0x310811[_0x2d4a('0x22')][_0x2ec8b5][_0x2d4a('0xa6')]]=[];ami['Action']({'actionid':_0x2ec8b5,'action':_0x2d4a('0x1a9'),'queue':_0x2ec0f9[_0x2d4a('0x3c')]})[_0x2d4a('0xa3')](function(_0x12e8b2){_0x310811[_0x2d4a('0xa5')](_0x2ec0f9);_0x310811[_0x2d4a('0xb3')]({'active':![],'ContactId':_0x310811[_0x2d4a('0x22')][_0x2ec8b5][_0x2d4a('0xc2')],'ListId':_0x310811[_0x2d4a('0x22')][_0x2ec8b5][_0x2d4a('0xc3')],'VoiceQueueId':_0x310811[_0x2d4a('0x22')][_0x2ec8b5]['VoiceQueueId']||undefined,'CampaignId':_0x310811[_0x2d4a('0x22')][_0x2ec8b5][_0x2d4a('0xc5')]||undefined})[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0x1aa')));delete _0x310811[_0x2d4a('0x22')][_0x2ec8b5];});}else{loggerBooked[_0x2d4a('0x7a')]('[booked][checkContactBlack][else]',JSON[_0x2d4a('0x47')](_0x2ec0f9[_0x2d4a('0x1a5')]),_0x2d4a('0x1a8'),_0x2ec0f9[_0x2d4a('0x3c')]);_0x310811[_0x2d4a('0xa5')](_0x2ec0f9);_0x310811[_0x2d4a('0xb3')]({'active':![],'ContactId':_0x310811[_0x2d4a('0x22')][_0x2ec8b5][_0x2d4a('0xc2')],'ListId':_0x310811['actions'][_0x2ec8b5][_0x2d4a('0xc3')],'VoiceQueueId':_0x310811[_0x2d4a('0x22')][_0x2ec8b5][_0x2d4a('0x10b')]||undefined,'CampaignId':_0x310811[_0x2d4a('0x22')][_0x2ec8b5]['CampaignId']||undefined})[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0x1aa')));delete _0x310811['actions'][_0x2ec8b5];}}else{return _0x310811[_0x2d4a('0x138')](_0x2ec0f9,_0x1e9d7b);}}else{if(getDiff(_0x1e9d7b[_0x2d4a('0x1ab')])<_0x2ec0f9[_0x2d4a('0x1ac')]*0x3c){_0x310811[_0x2d4a('0x84')][_0x2d4a('0x101')](_0x1e9d7b['id'])[_0x2d4a('0x103')](function(){_0x310811[_0x2d4a('0xa5')](_0x2ec0f9);});}else{_0x2ec0f9[_0x2d4a('0x64')]+=0x1;_0x310811['updateOriginated'](_0x2ec0f9);if(_0x2ec0f9[_0x2d4a('0x1ad')]){_0x310811[_0x2d4a('0xb3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1e9d7b['ContactId'],'ListId':_0x1e9d7b['ListId'],'VoiceQueueId':_0x1e9d7b[_0x2d4a('0x10b')]||undefined,'CampaignId':_0x1e9d7b[_0x2d4a('0xc5')]||undefined})[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0x1ae')));_0x310811[_0x2d4a('0xbc')](createObjHistory(_0x2ec0f9,_0x1e9d7b,_0x2d4a('0x1af'),0x17,_0x2d4a('0x1b0')))[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0x1b1')));}else{_0x310811[_0x2d4a('0xcd')](createObjHistory(_0x2ec0f9,_0x1e9d7b,_0x2d4a('0x1b2'),0x16,_0x2d4a('0x1b3')),_0x2d4a('0x1b4'),_0x2d4a('0x1b5'));}}}}else{_0x2ec0f9[_0x2d4a('0x5c')]+=0x1;_0x310811[_0x2d4a('0xcd')](createObjHistory(_0x2ec0f9,_0x1e9d7b,_0x2d4a('0x1b6'),0xd,_0x2d4a('0x1b7')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x2d4a('0x1b8');}};};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x12e')]=function(_0x5ec860){var _0x2c5ca4=this;var _0x58df2f=[];var _0x28c2d3=_0x5ec860['limitCalls']-_0x5ec860[_0x2d4a('0x8c')]-_0x5ec860[_0x2d4a('0x1b9')];emitCampaignSummary(_0x5ec860);if(_0x28c2d3>0x0){if(_0x28c2d3>this[_0x2d4a('0x20')]){_0x28c2d3=this[_0x2d4a('0x20')];}_0x5ec860[_0x2d4a('0x1b9')]+=_0x28c2d3;this[_0x2d4a('0xb7')](_0x5ec860['id'],_0x28c2d3,_0x5ec860['dialOrderByScheduledAt'])[_0x2d4a('0xab')](function(_0x5d768a){_0x5ec860['temp']-=_0x28c2d3;_0x5ec860['temp']=_0x5ec860[_0x2d4a('0x1b9')]>0x0?_0x5ec860[_0x2d4a('0x1b9')]:0x0;if(!checkContactEmpty(_0x5d768a)){_0x5ec860['message']=_0x2d4a('0x93');logger[_0x2d4a('0x7a')](_0x2d4a('0x1ba')+_0x5ec860[_0x2d4a('0x3c')]);}else{_0x5ec860['originated']+=_0x5d768a[_0x2d4a('0x8a')];_0x5ec860[_0x2d4a('0x3e')]=_0x2d4a('0x1bb');for(var _0x5a4c57=0x0;_0x5a4c57<_0x5d768a['length'];_0x5a4c57+=0x1){_0x5ec860['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x5d768a[_0x5a4c57])||_[_0x2d4a('0xa1')](_0x5d768a[_0x5a4c57][_0x2d4a('0x13c')])||_[_0x2d4a('0xa1')](_0x5d768a[_0x5a4c57][_0x2d4a('0x13c')][_0x2d4a('0x13d')])){_0x2c5ca4[_0x2d4a('0xc0')]('[actionOriginate]\x20',_0x5ec860,_0x5d768a[_0x5a4c57]);}else{_0x2c5ca4['checkIsBlackListIvr'](_['pick'](_0x5d768a[_0x5a4c57],['CampaignId',_0x2d4a('0x1bc')]))['then'](_0x2c5ca4[_0x2d4a('0x1a4')](_0x5ec860,_0x5d768a[_0x5a4c57]))[_0x2d4a('0xa3')](_0x2c5ca4[_0x2d4a('0xbf')](_0x2d4a('0x1bd'),_0x5ec860));}}}})[_0x2d4a('0xa3')](loggerGetContactDialer(_0x2d4a('0x1be'),_0x5ec860,_0x28c2d3));}};Dialer['prototype']['handlePower']=function(_0x4d1d78,_0x15334d){var _0x2c74af=this;var _0x4e439d=[];var _0x313bf6=_0x15334d>=0x1?_0x15334d:0x1;var _0x1ce769=[];if(_0x4d1d78['dialMethod']===_0x2d4a('0x6')){_0x313bf6=0x1;}var _0x1b86cd=Math[_0x2d4a('0x1a2')](_0x4d1d78['available']*_0x313bf6)-_0x4d1d78[_0x2d4a('0x8c')]-_0x4d1d78[_0x2d4a('0x1b9')];emitVoiceQueueSummary(_0x4d1d78);if(_0x4d1d78[_0x2d4a('0x1bf')]>0x0){var _0x4d1404=_0x4d1d78['dialLimitQueue']-_0x4d1d78[_0x2d4a('0x8c')]-_0x4d1d78[_0x2d4a('0x54')]-_0x4d1d78[_0x2d4a('0x1b9')]-_0x4d1d78[_0x2d4a('0x51')];if(_0x1b86cd>_0x4d1404){_0x1b86cd=_0x4d1404;}}if(_0x1b86cd>0x0){if(_0x4d1d78['dialMethod']===_0x2d4a('0x6')){_0x1b86cd=0x1;}if(_0x1b86cd>this[_0x2d4a('0x20')]){_0x1b86cd=this['maxNumberOriginate'];}_0x4d1d78[_0x2d4a('0x1b9')]+=_0x1b86cd;for(var _0x43957a in this[_0x2d4a('0xfa')]){if(this[_0x2d4a('0xfa')]['hasOwnProperty'](_0x43957a)){if(this[_0x2d4a('0xfa')][_0x43957a]['state']===_0x2d4a('0x1c0')&&this[_0x2d4a('0xfa')][_0x43957a][_0x2d4a('0xa2')]==='reachable'){_0x4e439d['push'](this['agents'][_0x43957a]['id']);}}}this[_0x2d4a('0xb5')](_0x4d1d78['id'],_0x4e439d,_0x1b86cd,_0x4d1d78[_0x2d4a('0x1c1')])[_0x2d4a('0xab')](function(_0x3ade0a){_0x4d1d78[_0x2d4a('0x1b9')]-=_0x1b86cd;_0x4d1d78['temp']=_0x4d1d78['temp']>0x0?_0x4d1d78[_0x2d4a('0x1b9')]:0x0;if(!checkContactEmpty(_0x3ade0a)){_0x2c74af['countReScheduled'](_0x4d1d78)[_0x2d4a('0xab')](sendMessageReschedule(_0x4d1d78))[_0x2d4a('0xa3')](loggerCatch(_0x2d4a('0xac')));}else{_0x4d1d78[_0x2d4a('0x8c')]+=_0x3ade0a[_0x2d4a('0x8a')];_0x4d1d78[_0x2d4a('0x3e')]=_0x4d1d78[_0x2d4a('0x57')]===_0x2d4a('0x6')?_0x2d4a('0x143'):_0x2d4a('0x1bb');for(var _0x16b2a1=0x0;_0x16b2a1<_0x3ade0a[_0x2d4a('0x8a')];_0x16b2a1+=0x1){if(_[_0x2d4a('0xa1')](_0x3ade0a[_0x16b2a1])||_[_0x2d4a('0xa1')](_0x3ade0a[_0x16b2a1][_0x2d4a('0x13c')])||_[_0x2d4a('0xa1')](_0x3ade0a[_0x16b2a1][_0x2d4a('0x13c')][_0x2d4a('0x13d')])){_0x2c74af[_0x2d4a('0xc0')]('[actionOriginate]\x20',_0x4d1d78,_0x3ade0a[_0x16b2a1]);}else{_0x2c74af[_0x2d4a('0xad')](_[_0x2d4a('0xfd')](_0x3ade0a[_0x16b2a1],[_0x2d4a('0x10b'),_0x2d4a('0x1bc')]))[_0x2d4a('0xab')](_0x2c74af[_0x2d4a('0x1a4')](_0x4d1d78,_0x3ade0a[_0x16b2a1]))['catch'](_0x2c74af[_0x2d4a('0xbf')]('[actionOriginate]\x20',_0x4d1d78));}}}})['catch'](loggerGetContactDialer(_0x2d4a('0x1c2'),_0x4d1d78,_0x1b86cd));}};Dialer['prototype'][_0x2d4a('0x83')]=function(_0x39f77b){var _0x456253=this;if(_0x39f77b[_0x2d4a('0x1bf')]>0x0){var _0xd36f56=_0x39f77b[_0x2d4a('0x1bf')]-_0x39f77b[_0x2d4a('0x8c')]-_0x39f77b['talking'];if(_0xd36f56>0x0){this[_0x2d4a('0x1c3')](_0x39f77b);}else{loggerPredictiveCalls[_0x2d4a('0x7a')](_0x2d4a('0x1c4'));}}else{this[_0x2d4a('0x1c3')](_0x39f77b);}};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x1c3')]=function(_0x2e4e77){var _0x4ae034=this;var _0x3c4bfa=[];_0x2e4e77[_0x2d4a('0x8c')]+=0x1;for(var _0x2c516e in this[_0x2d4a('0xfa')]){if(this['agents'][_0x2d4a('0x8b')](_0x2c516e)){if(this[_0x2d4a('0xfa')][_0x2c516e]['state']==='not_inuse'&&this['agents'][_0x2c516e][_0x2d4a('0xa2')]===_0x2d4a('0x1c5')){_0x3c4bfa[_0x2d4a('0x119')](this['agents'][_0x2c516e]['id']);}}}this[_0x2d4a('0xb5')](_0x2e4e77['id'],_0x3c4bfa,0x1,_0x2e4e77['dialOrderByScheduledAt'])[_0x2d4a('0xab')](function(_0x4a67e9){if(!checkContactEmpty(_0x4a67e9)){checkContactLowerLimitOriginate(_0x2e4e77,0x1,0x0);_0x4ae034[_0x2d4a('0xa9')](_0x2e4e77)[_0x2d4a('0xab')](sendMessageReschedule(_0x2e4e77))['catch'](loggerCatch(_0x2d4a('0xac')));}else{_0x2e4e77[_0x2d4a('0x3e')]='RUNNING';if(_[_0x2d4a('0xa1')](_0x4a67e9[0x0])||_[_0x2d4a('0xa1')](_0x4a67e9[0x0][_0x2d4a('0x13c')])||_[_0x2d4a('0xa1')](_0x4a67e9[0x0][_0x2d4a('0x13c')][_0x2d4a('0x13d')])){_0x4ae034[_0x2d4a('0xc0')]('[actionOriginate]\x20',_0x2e4e77,_0x4a67e9[0x0]);}else{_0x4ae034[_0x2d4a('0xad')](_[_0x2d4a('0xfd')](_0x4a67e9[0x0],[_0x2d4a('0x10b'),_0x2d4a('0x1bc')]))[_0x2d4a('0xab')](_0x4ae034[_0x2d4a('0x1a4')](_0x2e4e77,_0x4a67e9[0x0]))[_0x2d4a('0xa3')](_0x4ae034[_0x2d4a('0xbf')](_0x2d4a('0x1c6'),_0x2e4e77));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x2e4e77,0x1));emitVoiceQueueSummary(_0x2e4e77);};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x19d')]=function(_0x466f5a,_0x2b3427,_0x3913c5,_0xf4243b,_0x5d0d36,_0x613d70){loggerPredictive[_0x2d4a('0x7a')]('[abandonmentRate]','\x20m\x20=\x20',_0x466f5a,_0x2d4a('0x1c7'),_0x2b3427,_0x2d4a('0x1c8'),_0x3913c5,'\x20p\x20=\x20',_0xf4243b,'\x20Amax\x20=\x20',_0x5d0d36);return new BPromise(function(_0xdc117,_0x4ff41d){if(_0x466f5a<=0x0||isNaN(_0x466f5a)){return _0x4ff41d(msgResponse(_0x2d4a('0x1c9'),_0x2d4a('0x46'),_0x2d4a('0x1ca')+_0x466f5a));}if(_0x3913c5<=0x0||isNaN(_0x3913c5)){return _0x4ff41d(msgResponse(_0x2d4a('0x1c9'),_0x2d4a('0x46'),_0x2d4a('0x1cb')+_0x3913c5));}if(_0xf4243b<=0x0||isNaN(_0xf4243b)){return _0x4ff41d(msgResponse('[abandonmentRate]',_0x2d4a('0x46'),_0x2d4a('0x1cc')+_0xf4243b));}if(_0x2b3427<=0x0||isNaN(_0x2b3427)){return _0x4ff41d(msgResponse(_0x2d4a('0x1c9'),_0x2d4a('0x46'),_0x2d4a('0x1cd')+_0x2b3427));}if(_0x5d0d36<=0x0||isNaN(_0x5d0d36)){return _0x4ff41d(msgResponse('[abandonmentRate]','Error','Amax\x20=\x20'+_0x5d0d36));}_0x613d70=_0x613d70||0x0;var _0x5cf828=0x1/_0x3913c5;var _0x1c492b=0x0;var _0x51538d=0x0;var _0xd8892b=0x0;var _0x312dd0=0x0;for(var _0x4b60e1=0x0;_0xd8892b<_0x5d0d36;_0x4b60e1+=0x1){_0x51538d=_0x4b60e1/_0x2b3427;_0x1c492b=(_0xf4243b*_0x51538d+_0x613d70)/_0x5cf828;_0xd8892b=erlangb(_0x1c492b,_0x466f5a);_0x312dd0=_0x1c492b/_0x466f5a*(0x1-erlangb(_0x1c492b,_0x466f5a));}return _0xdc117({'erlangCalls':_0x4b60e1,'erlangCallToSecond':_0x2b3427/_0x4b60e1,'erlangAbandonmentRate':_0xd8892b,'erlangBusyFactor':_0x312dd0});});};Dialer[_0x2d4a('0x1a')][_0x2d4a('0x19f')]=function(_0x57e201,_0x59f764,_0x309136,_0x13f410,_0x292b9e,_0x28456f){loggerPredictive[_0x2d4a('0x7a')]('[busyFactor]',_0x2d4a('0x1ce'),_0x57e201,_0x2d4a('0x1c7'),_0x59f764,_0x2d4a('0x1c8'),_0x309136,_0x2d4a('0x1cf'),_0x13f410,_0x2d4a('0x1d0'),_0x292b9e);return new BPromise(function(_0x11ac65,_0x2b974a){if(_0x57e201<=0x0||isNaN(_0x57e201)){return _0x2b974a(msgResponse(_0x2d4a('0x1c9'),_0x2d4a('0x46'),_0x2d4a('0x1ca')+_0x57e201));}if(_0x309136<=0x0||isNaN(_0x309136)){return _0x2b974a(msgResponse('[abandonmentRate]',_0x2d4a('0x46'),_0x2d4a('0x1cb')+_0x309136));}if(_0x13f410<=0x0||isNaN(_0x13f410)){return _0x2b974a(msgResponse(_0x2d4a('0x1c9'),'Error',_0x2d4a('0x1cc')+_0x13f410));}if(_0x59f764<=0x0||isNaN(_0x59f764)){return _0x2b974a(msgResponse(_0x2d4a('0x1c9'),_0x2d4a('0x46'),_0x2d4a('0x1cd')+_0x59f764));}if(_0x292b9e<=0x0||isNaN(_0x292b9e)){return _0x2b974a(msgResponse('[abandonmentRate]',_0x2d4a('0x46'),_0x2d4a('0x1d1')+_0x292b9e));}_0x28456f=_0x28456f||0x0;var _0x32adff=0x1/_0x309136;var _0x3d3e0f=0x0;var _0x400535=0x0;var _0x5ec625=0x0;var _0x29c331=0x0;for(var _0x1fd1d6=0x0;_0x29c331<_0x292b9e;_0x1fd1d6+=0x1){_0x400535=_0x1fd1d6/_0x59f764;_0x3d3e0f=(_0x13f410*_0x400535+_0x28456f)/_0x32adff;_0x5ec625=erlangb(_0x3d3e0f,_0x57e201);_0x29c331=_0x3d3e0f/_0x57e201*(0x1-erlangb(_0x3d3e0f,_0x57e201));}return _0x11ac65({'erlangCalls':_0x1fd1d6,'erlangCallToSecond':_0x59f764/_0x1fd1d6,'erlangAbandonmentRate':_0x5ec625,'erlangBusyFactor':_0x29c331});});};module[_0x2d4a('0x1d2')]=Dialer; \ No newline at end of file +var _0xb03e=['m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','busyFactor','\x20p\x20=\x20','\x20Umin\x20=\x20','Amax\x20=\x20','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','message','NOT_ACTIVE','name','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','Error','stringify','milliseconds','type','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalLowerLimit','originated','Trunk','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','isEmpty','predictiveIntervalTotalCalls','isUndefined','info','[checkGetDataPredictive][avgTalktime]','[checkGetDataPredictive][avgHoldtime]','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][obj]','[ErlangB]','merge','diff','seconds','[freeVariablesPredictive]','handlePredictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','statedesc','endtime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','hasOwnProperty','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','pick','ListId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','active','SIP/%s','reachable','uniqueid','isNil','variable','amdstatus','exten','dialAMDActive','value','HANGUP','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','amd','saveInDb','[syncMachine][createHistory]','[syncMachine]','AMD','[syncHangupInAMDIvr]','Machine','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','Abandoned','CALLEREXIT','actions','actionid','locked','paused','stateinterface','push','queueStatusComplete','[unlockQueueStatus][undefined]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','ContactId','CampaignId','[unlock][syncQueueStatusComplete]','rrmemory','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','indexOf','true','command','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','method\x20not\x20recognized','handleIvr','checkIfTime','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','xcally-motion-dialer','from-sip','OriginateError','starttime','[originate][error]','originate\x20action\x20Error','response','[callProgressDetecting]\x20','countbusyretry','countcongestionretry','countnoanswerretry','dialNoAnswerMaxRetry','add','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','minutes','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','reason','NoSuchNumber','checkRetriveMax','dialGlobalMaxRetry','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','countglobal','[syncAgentComplete][createHistory][3]','stateGlobal','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','outboundCongestionCallsDay','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','predictive','dialPredictiveOptimizationPercentage','predictiveIntervalPauses','floor','erlangAbandonmentRate','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Date]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]','Agent\x20free','agent\x20max\x20free\x20','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','[startMethodPredictive][StartPredictive][First]','getDataPredictive','[averageHandleTime][ErlangB]\x20','[startMethodPredictive][StartPredictive][Repeat]','averageHandleTime','outboundQueuePauses','abandonmentRate','[CatchErlangB]','agentBusyFactor','predictiveIntervalAnsweredCalls','check\x20failure','startMethodPredictive','erlangCallToSecond','[startMethodPredictive]','[startMethodPredictive][milliseconds]\x20','Failure\x20','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','[getContactCampaign2][Empty]','ivrTotalCallsDays','dialLimitQueue','not_inuse','getContactDialer','dialOrderByScheduledAt','RUNNING','Contact.phone','checkContactBlack','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[abandonmentRate]','\x20m\x20=\x20','\x20interval\x20=\x20','\x20Ts\x20=\x20','\x20Amax\x20=\x20'];(function(_0x415d59,_0x5549fc){var _0x3d0aaf=function(_0x520783){while(--_0x520783){_0x415d59['push'](_0x415d59['shift']());}};_0x3d0aaf(++_0x5549fc);}(_0xb03e,0x1eb));var _0xeb03=function(_0x3d6662,_0x486b0f){_0x3d6662=_0x3d6662-0x0;var _0x35cebf=_0xb03e[_0x3d6662];return _0x35cebf;};'use strict';var util=require('util');var _=require(_0xeb03('0x0'));var BPromise=require(_0xeb03('0x1'));var uuid=require(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var rr=require('rr');var md5=require(_0xeb03('0x4'));var Redis=require(_0xeb03('0x5'));var config=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var loggerBooked=require(_0xeb03('0x7'))(_0xeb03('0x9'));var loggerPredictive=require(_0xeb03('0x7'))('predictive');var loggerPredictiveCalls=require(_0xeb03('0x7'))(_0xeb03('0xa'));var loggerSyncQueueSummary=require(_0xeb03('0x7'))(_0xeb03('0xb'));var ami=require(_0xeb03('0xc'));config[_0xeb03('0xd')]=_['defaults'](config[_0xeb03('0xd')],{'host':_0xeb03('0xe'),'port':0x18eb});var io=require(_0xeb03('0xf'))(new Redis(config['redis']));var cmHopper=require(_0xeb03('0x10'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xeb03('0x11'));var cmHopperBlack=require(_0xeb03('0x12'));var voiceQueueRt=require(_0xeb03('0x13'));var Action=require(_0xeb03('0x14'));var History=require(_0xeb03('0x15'));var Final=require(_0xeb03('0x16'));var AgentComplete=require(_0xeb03('0x17'));var QueueCallerAbandon=require(_0xeb03('0x18'));var Hangup=require(_0xeb03('0x19'));var ipAgi=process[_0xeb03('0x1a')][_0xeb03('0x1b')]||_0xeb03('0x1c');var strategy={'rrmemory':'rrmemory','roundrobin':_0xeb03('0x1d')};var Sequence=function(){};Sequence[_0xeb03('0x1e')][_0xeb03('0x1f')]=function(_0x33f9ba){this['tail']=this[_0xeb03('0x20')]?this[_0xeb03('0x20')][_0xeb03('0x21')](_0x33f9ba):_0x33f9ba();};function Dialer(_0x478989,_0x7ce874){this[_0xeb03('0x22')]=new Sequence();this[_0xeb03('0x23')]=_0x7ce874;this[_0xeb03('0x24')]=_0x478989[_0xeb03('0x24')];this[_0xeb03('0x25')]=_0x478989[_0xeb03('0x25')];this[_0xeb03('0x26')]=_0x478989[_0xeb03('0x26')];this[_0xeb03('0x27')]=_0x478989[_0xeb03('0x27')];this[_0xeb03('0x28')]=config[_0xeb03('0x28')]||0x2;this[_0xeb03('0x29')]={};this['actions']={};this[_0xeb03('0x2a')]={};this[_0xeb03('0x2b')]={};this[_0xeb03('0x2c')]={};this[_0xeb03('0x2d')]={};this[_0xeb03('0x2e')]={};this[_0xeb03('0x2f')]={};this[_0xeb03('0x30')]={};this[_0xeb03('0x31')]={};ami['on'](_0xeb03('0x32'),this['syncAgentConnect'][_0xeb03('0x33')](this));ami['on'](_0xeb03('0x34'),this[_0xeb03('0x35')][_0xeb03('0x33')](this));ami['on'](_0xeb03('0x36'),this['syncOriginateResponse'][_0xeb03('0x33')](this));ami['on'](_0xeb03('0x37'),this[_0xeb03('0x38')][_0xeb03('0x33')](this));ami['on'](_0xeb03('0x39'),this[_0xeb03('0xb')][_0xeb03('0x33')](this));ami['on'](_0xeb03('0x3a'),this[_0xeb03('0x3b')]['bind'](this));ami['on'](_0xeb03('0x3c'),this[_0xeb03('0x3d')][_0xeb03('0x33')](this));ami['on'](_0xeb03('0x3e'),this['syncVarSet']['bind'](this));ami['on'](_0xeb03('0x3f'),this['syncQueueMember'][_0xeb03('0x33')](this));ami['on'](_0xeb03('0x40'),this[_0xeb03('0x41')]['bind'](this));this[_0xeb03('0x42')]();this['loopClearZombieChannels']();}function isNotNull(_0x5cb729){return _0x5cb729!==null&&!_['isUndefined'](_0x5cb729);}function checkIsLoggedIn(_0x538d19,_0x421a27){return function(){if(_0x421a27<=0x0){_0x538d19[_0xeb03('0x43')]='AGENTS_NOT_LOGGED';throw _0x538d19['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x47f7d8){return _0x47f7d8;}function checkIsActive(_0x1e8009,_0x3655c3){return function(){if(!isActive(_0x3655c3)){_0x1e8009[_0xeb03('0x43')]=_0xeb03('0x44');throw _0x1e8009[_0xeb03('0x45')]+'\x20NOT\x20Active';}};}function checkInterval(_0x13efc6){return function(){if(!isNotNull(_0x13efc6['Interval'])){_0x13efc6[_0xeb03('0x43')]=_0xeb03('0x46');throw _0x13efc6[_0xeb03('0x45')]+_0xeb03('0x47');}if(!isNotNull(_0x13efc6[_0xeb03('0x48')][_0xeb03('0x49')])){_0x13efc6[_0xeb03('0x43')]=_0xeb03('0x46');throw _0x13efc6['name']+_0xeb03('0x47');}if(!isNotNull(_['isEmpty'](_0x13efc6[_0xeb03('0x48')][_0xeb03('0x49')]))){_0x13efc6[_0xeb03('0x43')]=_0xeb03('0x46');throw _0x13efc6[_0xeb03('0x45')]+_0xeb03('0x47');}};}function msgResponse(_0x5a3915,_0x155b53,_0x4bfd68){return{'action':_0x5a3915,'response':_0x155b53,'message':_0x4bfd68};}function myreject(_0x585cb5){return function(_0x4c61e4){return _0x585cb5(msgResponse(_0xeb03('0x4a'),_0xeb03('0x4b'),JSON[_0xeb03('0x4c')](_0x4c61e4)));};}function getSeconds(_0x72f8bf,_0x2a9e6b){var _0x575ef1=moment(_0x72f8bf)[_0xeb03('0x4d')](0x0);var _0x166562=moment(_0x2a9e6b)[_0xeb03('0x4d')](0x0);return _0x575ef1['diff'](_0x166562,'seconds');}function emit(_0xac05c4,_0x27e61f,_0x47118d){io['to'](_0xac05c4)['emit'](_0x27e61f,_0x47118d);}function emitVoiceQueueSummary(_0x328f72){if(_0x328f72[_0xeb03('0x4e')]==='outbound'){var _0x49edb3={'id':_0x328f72['id'],'name':_0x328f72[_0xeb03('0x45')],'strategy':_0x328f72[_0xeb03('0x4f')],'answered':_0x328f72['answered'],'available':_0x328f72[_0xeb03('0x50')],'loggedIn':_0x328f72[_0xeb03('0x51')],'pTalking':_0x328f72[_0xeb03('0x52')],'sumBillable':_0x328f72[_0xeb03('0x53')],'sumDuration':_0x328f72[_0xeb03('0x54')],'sumHoldTime':_0x328f72[_0xeb03('0x55')]||0x0,'talking':_0x328f72[_0xeb03('0x56')],'total':_0x328f72[_0xeb03('0x57')],'type':_0x328f72[_0xeb03('0x4e')],'unmanaged':_0x328f72[_0xeb03('0x58')],'abandoned':_0x328f72[_0xeb03('0x59')],'waiting':_0x328f72[_0xeb03('0x5a')],'loggedInDb':_0x328f72[_0xeb03('0x5b')],'dialActive':_0x328f72[_0xeb03('0x5c')],'dialMethod':_0x328f72[_0xeb03('0x5d')],'dialOriginateCallerIdName':_0x328f72[_0xeb03('0x5e')],'dialOriginateCallerIdNumber':_0x328f72[_0xeb03('0x5f')],'dialOriginateTimeout':_0x328f72[_0xeb03('0x60')],'dialPrefix':_0x328f72[_0xeb03('0x61')],'outboundAnswerAgiCallsDay':_0x328f72[_0xeb03('0x62')],'outboundAnswerCallsDay':_0x328f72[_0xeb03('0x63')],'outboundBlacklistCallsDay':_0x328f72[_0xeb03('0x64')],'outboundBusyCallsDay':_0x328f72[_0xeb03('0x65')],'outboundCongestionCallsDay':_0x328f72['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x328f72['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x328f72[_0xeb03('0x66')],'outboundDropCallsDayTimeout':_0x328f72[_0xeb03('0x67')],'outboundNoAnswerCallsDay':_0x328f72[_0xeb03('0x68')],'outboundNoSuchCallsDay':_0x328f72[_0xeb03('0x69')],'outboundOriginateFailureCallsDay':_0x328f72[_0xeb03('0x6a')],'outboundReCallsDay':_0x328f72[_0xeb03('0x6b')],'outboundRejectCallsDay':_0x328f72[_0xeb03('0x6c')],'outboundUnknownCallsDay':_0x328f72[_0xeb03('0x6d')],'predictiveIntervalAnsweredCalls':_0x328f72['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x328f72[_0xeb03('0x6e')],'predictiveIntervalAvgTalktime':_0x328f72[_0xeb03('0x6f')],'predictiveIntervalDroppedCallsCallersExit':_0x328f72[_0xeb03('0x70')],'predictiveIntervalDroppedCallsTimeout':_0x328f72[_0xeb03('0x71')],'predictiveIntervalErlangCalls':_0x328f72[_0xeb03('0x72')],'predictiveIntervalErlangCallsDroppedCalls':_0x328f72['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x328f72['predictiveIntervalHitRate'],'predictiveIntervalLowerLimit':_0x328f72[_0xeb03('0x73')],'predictiveIntervalMultiplicativeFactor':_0x328f72['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x328f72['predictiveIntervalPauses'],'predictiveIntervalTotalCalls':_0x328f72['predictiveIntervalTotalCalls'],'message':_0x328f72[_0xeb03('0x43')],'originated':_0x328f72[_0xeb03('0x74')]};if(_0x328f72[_0xeb03('0x75')]){_0x49edb3[_0xeb03('0x75')]={'id':_0x328f72[_0xeb03('0x75')]['id'],'name':_0x328f72[_0xeb03('0x75')]['name'],'active':_0x328f72[_0xeb03('0x75')]['active'],'callerid':_0x328f72['Trunk'][_0xeb03('0x76')]};}if(_0x328f72[_0xeb03('0x48')]){_0x49edb3[_0xeb03('0x48')]={'id':_0x328f72['Interval']['id'],'name':_0x328f72[_0xeb03('0x48')][_0xeb03('0x45')]};}var _0x351055=md5(JSON[_0xeb03('0x4c')](_0x49edb3));if(_0x328f72[_0xeb03('0x4')]!==_0x351055){_0x328f72['md5']=_0x351055;emit(util[_0xeb03('0x77')]('voice:queue:%s',_0x49edb3[_0xeb03('0x45')]),_0xeb03('0x78'),_0x49edb3);}}}function emitCampaignSummary(_0x14f1d0){if(_0x14f1d0[_0xeb03('0x4e')]===_0xeb03('0x79')){emit(util[_0xeb03('0x77')](_0xeb03('0x7a'),_0x14f1d0[_0xeb03('0x45')]),_0xeb03('0x7b'),_0x14f1d0);}}function checkGetDataPredictive(_0x2fe435){if(isNotNull(_0x2fe435)){if(!_[_0xeb03('0x7c')](_0x2fe435)){if(_0x2fe435[_0xeb03('0x7d')]>0x0){if(!_[_0xeb03('0x7e')](_0x2fe435[_0xeb03('0x6f')])&&_0x2fe435[_0xeb03('0x6f')]>0x0){return!![];}else{loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x80'),JSON[_0xeb03('0x4c')](_0x2fe435));}if(!_[_0xeb03('0x7e')](_0x2fe435[_0xeb03('0x6e')])&&_0x2fe435[_0xeb03('0x6e')]>0x0){return!![];}else{loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x81'),JSON[_0xeb03('0x4c')](_0x2fe435));}}else{loggerPredictive['info'](_0xeb03('0x82'),JSON[_0xeb03('0x4c')](_0x2fe435));}}else{loggerPredictive[_0xeb03('0x7f')]('[checkGetDataPredictive][objIsEmpty]',JSON[_0xeb03('0x4c')](_0x2fe435));}}else{loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x83'),JSON[_0xeb03('0x4c')](_0x2fe435));}return![];}function mergeDataErlangB(_0x103da5){return function(_0x68d263){loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x84'),JSON[_0xeb03('0x4c')](_0x68d263));_[_0xeb03('0x85')](_0x103da5,_0x68d263);};}function getDiff(_0x46f52e){var _0x25de1f=moment()[_0xeb03('0x4d')](0x0);var _0xd4ecb3=moment(_0x46f52e)['milliseconds'](0x0);return _0x25de1f[_0xeb03('0x86')](_0xd4ecb3,_0xeb03('0x87'));}function ifInterval(_0x379cd0,_0x259db7){if(_[_0xeb03('0x7e')](_0x259db7)){return![];}if(getDiff(_0x259db7)<_0x379cd0*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x39e2c7){if(isNotNull(_0x39e2c7)){if(!_[_0xeb03('0x7e')](_0x39e2c7[_0xeb03('0x2e')])){_0x39e2c7[_0xeb03('0x2e')]=undefined;loggerPredictive[_0xeb03('0x7f')]('[freeVariablesPredictive]',_0xeb03('0x2e'),_0x39e2c7[_0xeb03('0x45')]);}if(!_[_0xeb03('0x7e')](_0x39e2c7[_0xeb03('0x2d')])){_0x39e2c7['startPredictive']=undefined;loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x88'),_0xeb03('0x2d'),_0x39e2c7[_0xeb03('0x45')]);}if(!_[_0xeb03('0x7e')](_0x39e2c7['handlePredictive'])){clearInterval(_0x39e2c7[_0xeb03('0x89')]);_0x39e2c7[_0xeb03('0x89')]=undefined;loggerPredictive[_0xeb03('0x7f')]('[freeVariablesPredictive]',_0xeb03('0x89'),_0x39e2c7[_0xeb03('0x45')]);}}}function erlangb(_0x4d9cfc,_0x1f6117){if(_0x1f6117===0x0){return 0x0;}var _0x3102e3=0x1;for(var _0x3750f1=0x1;_0x3750f1<=_0x1f6117;_0x3750f1+=0x1){_0x3102e3=0x1+_0x3102e3*_0x3750f1/_0x4d9cfc;}return 0x1/_0x3102e3;}function isVoiceQueueOutbound(_0x5693cf){return _0x5693cf===_0xeb03('0x8a');}function isNotPreview(_0x440f04){return _0x440f04!=='preview';}function isCampaignIvr(_0x3eb482){return _0x3eb482===_0xeb03('0x79');}function getCallerId(_0x1972fb,_0x3ac2de,_0x3963a7){if(!_[_0xeb03('0x7e')](_0x3963a7)&&_0xeb03('0x8b')===typeof _0x3963a7&&!_[_0xeb03('0x7c')](_0x3963a7)){if(!_['isUndefined'](_0x3ac2de)&&_0xeb03('0x8b')===typeof _0x3ac2de&&!_['isEmpty'](_0x3ac2de)){return util[_0xeb03('0x77')](_0xeb03('0x8c'),_0x3ac2de,_0x3963a7);}return util[_0xeb03('0x77')]('\x22%s\x22\x20<%s>',_0x3963a7,_0x3963a7);}if(!_[_0xeb03('0x7e')](_0x1972fb)&&_0xeb03('0x8b')===typeof _0x1972fb&&!_[_0xeb03('0x7c')](_0x1972fb)){return _0x1972fb;}return _0xeb03('0x8d');}function loggerCatchQueueSummary(_0x47c389,_0x3fe855){return function(_0x1cdf8e){freeVariablesPredictive(_0x3fe855);emitVoiceQueueSummary(_0x3fe855);emitCampaignSummary(_0x3fe855);loggerSyncQueueSummary['error'](_0x47c389,util['inspect'](_0x1cdf8e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x583518,_0x24ece0){return function(_0x1ad3b7){loggerPredictive[_0xeb03('0x8e')](_0x583518,JSON[_0xeb03('0x4c')](_0x1ad3b7));freeVariablesPredictive(_0x24ece0);};}function loggerCatch(_0x3da5f4){return function(_0x461777){logger[_0xeb03('0x8e')](_0x3da5f4,util[_0xeb03('0x8f')](_0x461777,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2c78dd){return _0x2c78dd&&!_['isUndefined'](_0x2c78dd)&&_0x2c78dd['length']>0x0;}function decremetOriginate(_0x43bc8f){if(!_[_0xeb03('0x7e')](_0x43bc8f)&&_0x43bc8f!==null){if(_0x43bc8f['hasOwnProperty'](_0xeb03('0x74'))){if(_0x43bc8f[_0xeb03('0x74')]>0x0){_0x43bc8f[_0xeb03('0x74')]-=0x1;}else{logger[_0xeb03('0x8e')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0xeb03('0x90'));}}function checkContactLowerLimitOriginate(_0x3c404d,_0x17f135,_0x50c482){if(_0x17f135>_0x50c482){for(var _0x34dd41=0x0;_0x34dd41<_0x17f135-_0x50c482;_0x34dd41+=0x1){decremetOriginate(_0x3c404d);}}}function loggerGetContactDialer(_0x3fe121,_0x1a8057,_0x2ee5c1){return function(_0x2e67a4){checkContactLowerLimitOriginate(_0x1a8057,_0x2ee5c1,0x0);logger[_0xeb03('0x8e')](_0x3fe121,util[_0xeb03('0x8f')](_0x2e67a4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x53b7ac){return function(_0x5113fd){if(isNotNull(_0x5113fd)&&isNotNull(_0x5113fd[0x0])){if(_0x5113fd[0x0][_0xeb03('0x91')]>0x0){_0x53b7ac['message']=_0xeb03('0x92');logger['info'](_0xeb03('0x93')+_0x53b7ac['name'],_0x5113fd[0x0][_0xeb03('0x91')],_0xeb03('0x94'));}else{_0x53b7ac['message']=_0xeb03('0x95');logger['info'](_0xeb03('0x96')+_0x53b7ac['name']);}}};}function notSendMessagesQueue(_0x375d5c){if(_0x375d5c['sendMessageOneNotActive']){freeVariablesPredictive(_0x375d5c);if(_0x375d5c['originated']===0x0&&_0x375d5c[_0xeb03('0x56')]===0x0&&_0x375d5c[_0xeb03('0x5a')]===0x0&&(_0x375d5c[_0xeb03('0x52')]||0x0)===0x0){_0x375d5c[_0xeb03('0x97')]=![];_0x375d5c[_0xeb03('0x50')]=0x0;_0x375d5c[_0xeb03('0x43')]=_0xeb03('0x44');loggerSyncQueueSummary['error'](_0xeb03('0x98'),_0x375d5c[_0xeb03('0x45')],_0xeb03('0x99'));}else{_0x375d5c[_0xeb03('0x43')]=_0xeb03('0x9a');loggerSyncQueueSummary[_0xeb03('0x8e')](_0xeb03('0x98'),_0x375d5c['name'],_0xeb03('0x9b'));}emitVoiceQueueSummary(_0x375d5c);}}function notSendMessagesCampaign(_0x24ddeb){if(_0x24ddeb[_0xeb03('0x97')]){if(_0x24ddeb[_0xeb03('0x74')]===0x0){_0x24ddeb[_0xeb03('0x97')]=![];_0x24ddeb[_0xeb03('0x43')]=_0xeb03('0x44');loggerSyncQueueSummary[_0xeb03('0x8e')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x24ddeb[_0xeb03('0x45')],_0xeb03('0x99'));}else{_0x24ddeb[_0xeb03('0x43')]=_0xeb03('0x9a');loggerSyncQueueSummary[_0xeb03('0x8e')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x24ddeb[_0xeb03('0x45')],_0xeb03('0x9b'));}emitCampaignSummary(_0x24ddeb);}}function createObjHistory(_0x25226e,_0x2d4767,_0x14a886,_0xdf980d,_0x39ec6e){_0x25226e['message']=_0x14a886;var _0x52b2c=new Action(_0x25226e,_0x2d4767);var _0x2db86b=new History(_0x52b2c);_0x2db86b[_0xeb03('0x9c')]=_0xdf980d;_0x2db86b[_0xeb03('0x9d')]=_0x39ec6e;_0x2db86b[_0xeb03('0x9e')]=_0x52b2c['starttime'];return _0x2db86b;}Dialer[_0xeb03('0x1e')][_0xeb03('0x9f')]=function(){var _0xfc8ac5=this;setInterval(function(){_0xfc8ac5[_0xeb03('0xa0')](_0xfc8ac5[_0xeb03('0x2b')],_0xeb03('0xa1'));_0xfc8ac5[_0xeb03('0xa0')](_0xfc8ac5['actions'],_0xeb03('0xa2'));},0x32c8);};Dialer[_0xeb03('0x1e')][_0xeb03('0xa0')]=function(_0x433780,_0x33b5f7){var _0x388fbd=this;for(var _0x5e3318 in _0x433780){if(_0x433780[_0xeb03('0xa3')](_0x5e3318)){this[_0xeb03('0x22')][_0xeb03('0x1f')](function(){if(!_['isNil'](_0x433780[_0x5e3318])){return ami[_0xeb03('0xa4')]({'action':_0xeb03('0xa5'),'channel':_0x433780[_0x5e3318][_0xeb03('0xa6')]})[_0xeb03('0xa7')](function(_0x291c43){if(_0x291c43[_0xeb03('0x43')]===_0xeb03('0xa8')){setTimeout(function(){if(_0x433780[_0x5e3318]&&_0x433780[_0x5e3318]['type']!=='ivr'){_0x388fbd[_0xeb03('0xa9')](_0x388fbd[_0xeb03('0x24')][_0x433780[_0x5e3318][_0xeb03('0xaa')]]);logger[_0xeb03('0x8e')]('[Dialer][checkChannel]',_0x33b5f7,_0x5e3318,_0x433780[_0x5e3318][_0xeb03('0xaa')]);delete _0x433780[_0x5e3318];}if(_0x433780[_0x5e3318]&&_0x433780[_0x5e3318][_0xeb03('0x4e')]==='ivr'){_0x388fbd[_0xeb03('0xa9')](_0x388fbd[_0xeb03('0x25')][_0x433780[_0x5e3318][_0xeb03('0xaa')]]);logger[_0xeb03('0x8e')](_0xeb03('0xab'),_0x33b5f7,_0x5e3318,_0x433780[_0x5e3318][_0xeb03('0xaa')]);delete _0x433780[_0x5e3318];}},0x2328);}});}});}}};Dialer['prototype'][_0xeb03('0xac')]=function(_0x1dd965){return BPromise[_0xeb03('0xad')]()[_0xeb03('0xae')](cmHopper[_0xeb03('0xac')](_0x1dd965))[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xaf')));};Dialer[_0xeb03('0x1e')][_0xeb03('0xb0')]=function(_0x3fd8c9){return BPromise['resolve']()[_0xeb03('0xae')](cmHopperBlack[_0xeb03('0xb0')](_0x3fd8c9))['catch'](loggerCatch(_0xeb03('0xb1')));};Dialer[_0xeb03('0x1e')]['checkIsBlackListIvr']=function(_0x2c60bd){return BPromise[_0xeb03('0xad')]()[_0xeb03('0xae')](cmHopperBlack[_0xeb03('0xb2')](_0x2c60bd))[_0xeb03('0xa7')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype']['averageHandleTime']=function(_0x3cead5){return BPromise['resolve']()[_0xeb03('0xae')](cmHopperHistory[_0xeb03('0xb3')](_0x3cead5))[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xb4')));};Dialer[_0xeb03('0x1e')][_0xeb03('0xb5')]=function(_0x1d46e7){return BPromise[_0xeb03('0xad')]()[_0xeb03('0xae')](cmHopper[_0xeb03('0xb5')](_0x1d46e7))[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xb6')));};Dialer['prototype']['getContactDialer']=function(_0x6b47e9,_0x5ea58f,_0x5d5962,_0x432577){return BPromise[_0xeb03('0xad')]()['then'](cmHopper['getContactDialer'](_0x6b47e9,_0x5ea58f,_0x5d5962,_0x432577))[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xb7')));};Dialer['prototype'][_0xeb03('0xb8')]=function(_0x30416a,_0x2efed6,_0x1d4e93){return BPromise[_0xeb03('0xad')]()['then'](cmHopper[_0xeb03('0xb8')](_0x30416a,_0x2efed6,_0x1d4e93))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xeb03('0x1e')][_0xeb03('0xb9')]=function(_0x521fea){return BPromise[_0xeb03('0xad')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x521fea))[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xba')));};Dialer[_0xeb03('0x1e')][_0xeb03('0xbb')]=function(_0x388642){return BPromise[_0xeb03('0xad')]()[_0xeb03('0xae')](cmHopper[_0xeb03('0xbb')](_0x388642))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xeb03('0x1e')]['createHistory']=function(_0x54c48b){return BPromise['resolve']()[_0xeb03('0xae')](cmHopperHistory[_0xeb03('0xbc')](_0x54c48b))[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xbd')));};Dialer[_0xeb03('0x1e')][_0xeb03('0xa9')]=function(_0x3c7766){if(!_[_0xeb03('0x7e')](_0x3c7766)&&_0x3c7766!==null){if(_0x3c7766['hasOwnProperty']('originated')){if(_0x3c7766[_0xeb03('0x74')]>0x0){_0x3c7766[_0xeb03('0x74')]-=0x1;}else{logger[_0xeb03('0x8e')](_0xeb03('0xbe'));}}}else{logger[_0xeb03('0x8e')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xeb03('0x1e')][_0xeb03('0xbf')]=function(_0x5a6f75,_0x1bba4a){var _0x3015b1=this;return function(_0x43105){_0x3015b1[_0xeb03('0xa9')](_0x1bba4a);logger[_0xeb03('0x8e')](_0x5a6f75,util[_0xeb03('0x8f')](_0x43105,{'showHidden':![],'depth':null}));};};Dialer[_0xeb03('0x1e')][_0xeb03('0xc0')]=function(_0x31dd49,_0x2ec6bb,_0x42ec33){var _0x2d8d4e={'state':0x19,'statedesc':_0xeb03('0xc1')};this[_0xeb03('0xa9')](_0x2ec6bb);this['saveInDb'](_[_0xeb03('0x85')](_0x2d8d4e,_[_0xeb03('0xc2')](_0x42ec33,['ContactId',_0xeb03('0xc3'),'UserId',_0xeb03('0xc4'),'CampaignId'])),_0xeb03('0xc5'),_0xeb03('0xc6'));logger[_0xeb03('0x8e')](_0x31dd49);};Dialer[_0xeb03('0x1e')][_0xeb03('0xc7')]=function(_0x2b126f){return _0x2b126f===_0xeb03('0xc8');};Dialer[_0xeb03('0x1e')]['isTrunkReachable']=function(_0x1b428e){return!_[_0xeb03('0x7e')](_0x1b428e)&&_0x1b428e&&!_[_0xeb03('0x7e')](_0x1b428e[_0xeb03('0x45')])&&!_['isUndefined'](_0x1b428e[_0xeb03('0xc9')])&&_0x1b428e['active']&&(this[_0xeb03('0x27')][util[_0xeb03('0x77')](_0xeb03('0xca'),_0x1b428e[_0xeb03('0x45')])]['status']===_0xeb03('0xcb')||this[_0xeb03('0x27')][util[_0xeb03('0x77')](_0xeb03('0xca'),_0x1b428e['name'])][_0xeb03('0xa5')]==='unmonitored');};Dialer[_0xeb03('0x1e')]['saveInDb']=function(_0x31a12d,_0x5c47e9,_0x2161cf){this[_0xeb03('0xbc')](_0x31a12d)[_0xeb03('0xa7')](loggerCatch(_0x5c47e9));this['moveContactManagedDialer'](_0x31a12d)['catch'](loggerCatch(_0x2161cf));};Dialer['prototype']['syncVarSet']=function(_0x5c7f6e){var _0x2cd43f=this[_0xeb03('0x2b')][_0x5c7f6e[_0xeb03('0xcc')]];var _0x3f58d3;if(!_[_0xeb03('0xcd')](_0x5c7f6e)&&!_[_0xeb03('0xcd')](_0x5c7f6e['variable'])&&!_[_0xeb03('0xcd')](_0x5c7f6e[_0xeb03('0xce')][_0xeb03('0xcf')])&&_0x5c7f6e[_0xeb03('0xd0')]==='xcally-motion-dialer'&&_0x2cd43f){if(_0x2cd43f['type']!==_0xeb03('0x79')&&this[_0xeb03('0x24')][_0x2cd43f['queue']][_0xeb03('0xd1')]&&_0x5c7f6e[_0xeb03('0xd2')]===_0xeb03('0xd3')){delete this[_0xeb03('0x2b')][_0x5c7f6e[_0xeb03('0xcc')]];this[_0xeb03('0xa9')](this[_0xeb03('0x24')][_0x2cd43f['queue']]);this[_0xeb03('0x24')][_0x2cd43f[_0xeb03('0xaa')]][_0xeb03('0x63')]+=0x1;this[_0xeb03('0x24')][_0x2cd43f[_0xeb03('0xaa')]][_0xeb03('0x62')]+=0x1;_0x3f58d3=new Hangup(_0x2cd43f,_0x5c7f6e);_0x3f58d3[_0xeb03('0x9c')]=0x12;_0x3f58d3[_0xeb03('0x9d')]='HangupInAMD';_0x3f58d3[_0xeb03('0xd4')]='AMD';this['saveInDb'](_0x3f58d3,_0xeb03('0xd5'),_0xeb03('0xd6'));}if(_0x2cd43f['type']!==_0xeb03('0x79')&&this['voiceQueues'][_0x2cd43f[_0xeb03('0xaa')]]['dialAMDActive']&&_0x5c7f6e[_0xeb03('0xd2')]===_0xeb03('0xd7')){delete this[_0xeb03('0x2b')][_0x5c7f6e[_0xeb03('0xcc')]];this[_0xeb03('0xa9')](this['voiceQueues'][_0x2cd43f[_0xeb03('0xaa')]]);this[_0xeb03('0x24')][_0x2cd43f[_0xeb03('0xaa')]][_0xeb03('0x63')]+=0x1;this[_0xeb03('0x24')][_0x2cd43f[_0xeb03('0xaa')]][_0xeb03('0x62')]+=0x1;_0x3f58d3=new Hangup(_0x2cd43f,_0x5c7f6e);_0x3f58d3[_0xeb03('0x9c')]=0x13;_0x3f58d3[_0xeb03('0x9d')]='Machine';_0x3f58d3['membername']='AMD';_0x3f58d3[_0xeb03('0xd8')]=!![];this[_0xeb03('0xd9')](_0x3f58d3,_0xeb03('0xda'),_0xeb03('0xdb'));}if(_0x2cd43f['type']==='ivr'&&this['campaigns'][_0x2cd43f[_0xeb03('0xaa')]][_0xeb03('0xd1')]&&_0x5c7f6e[_0xeb03('0xd2')]===_0xeb03('0xd3')){delete this[_0xeb03('0x2b')][_0x5c7f6e['uniqueid']];this[_0xeb03('0xa9')](this[_0xeb03('0x25')][_0x2cd43f['queue']]);_0x3f58d3=new Hangup(_0x2cd43f,_0x5c7f6e);_0x3f58d3[_0xeb03('0x9c')]=0x12;_0x3f58d3['statedesc']='HangupInAMD';_0x3f58d3[_0xeb03('0xd4')]=_0xeb03('0xdc');this[_0xeb03('0xd9')](_0x3f58d3,'[syncHangupInAMDIvr][createHistory]',_0xeb03('0xdd'));}if(_0x2cd43f[_0xeb03('0x4e')]==='ivr'&&this[_0xeb03('0x25')][_0x2cd43f['queue']]['dialAMDActive']&&_0x5c7f6e[_0xeb03('0xd2')]===_0xeb03('0xd7')){delete this[_0xeb03('0x2b')][_0x5c7f6e[_0xeb03('0xcc')]];this[_0xeb03('0xa9')](this[_0xeb03('0x25')][_0x2cd43f['queue']]);_0x3f58d3=new Hangup(_0x2cd43f,_0x5c7f6e);_0x3f58d3[_0xeb03('0x9c')]=0x13;_0x3f58d3[_0xeb03('0x9d')]=_0xeb03('0xde');_0x3f58d3[_0xeb03('0xd4')]=_0xeb03('0xdc');_0x3f58d3[_0xeb03('0xd8')]=!![];this[_0xeb03('0xd9')](_0x3f58d3,_0xeb03('0xdf'),_0xeb03('0xe0'));}}};Dialer[_0xeb03('0x1e')][_0xeb03('0x3b')]=function(_0x33e92d){var _0x132359=this[_0xeb03('0x2b')][_0x33e92d[_0xeb03('0xcc')]];var _0x1a0bb5=this;var _0x24e088;if(_0x132359&&_0x132359[_0xeb03('0x4e')]===_0xeb03('0x79')){delete this[_0xeb03('0x2b')][_0x33e92d[_0xeb03('0xcc')]];this[_0xeb03('0xa9')](this['campaigns'][_0x132359[_0xeb03('0xaa')]]);this['campaigns'][_0x132359[_0xeb03('0xaa')]][_0xeb03('0xe1')]+=0x1;_0x24e088=new Hangup(_0x132359,_0x33e92d);this[_0xeb03('0xbc')](_0x24e088)[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xe2')));this[_0xeb03('0xbb')](_0x24e088)['catch'](loggerCatch(_0xeb03('0xe3')));}if(_0x132359&&_0x132359[_0xeb03('0x4e')]!=='ivr'&&isNotNull(this[_0xeb03('0x24')][_0x132359['queue']][_0xeb03('0xe4')])){delete this[_0xeb03('0x2b')][_0x33e92d[_0xeb03('0xcc')]];this[_0xeb03('0xa9')](this[_0xeb03('0x24')][_0x132359[_0xeb03('0xaa')]]);this[_0xeb03('0x24')][_0x132359['queue']][_0xeb03('0x63')]+=0x1;this[_0xeb03('0x24')][_0x132359[_0xeb03('0xaa')]][_0xeb03('0x62')]+=0x1;_0x24e088=new Hangup(_0x132359,_0x33e92d);_0x24e088[_0xeb03('0x9c')]=0x10;_0x24e088[_0xeb03('0x9d')]=_0xeb03('0xe5');_0x24e088[_0xeb03('0xd4')]=_0xeb03('0xe6');this[_0xeb03('0xbc')](_0x24e088)[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xe2')));this[_0xeb03('0xbb')](_0x24e088)[_0xeb03('0xa7')](loggerCatch('[syncHangupIvr]'));}if(_0x132359&&_0x132359['type']!==_0xeb03('0x79')&&!isNotNull(this[_0xeb03('0x24')][_0x132359[_0xeb03('0xaa')]][_0xeb03('0xe4')])){delete this[_0xeb03('0x2b')][_0x33e92d['uniqueid']];this[_0xeb03('0xa9')](this['voiceQueues'][_0x132359[_0xeb03('0xaa')]]);this[_0xeb03('0x24')][_0x132359[_0xeb03('0xaa')]][_0xeb03('0x6d')]+=0x1;_0x24e088=new Hangup(_0x132359,_0x33e92d);_0x24e088[_0xeb03('0x9c')]=0xc;_0x24e088[_0xeb03('0x9d')]=_0x33e92d['cause-txt'];_0x24e088[_0xeb03('0xd4')]=_0xeb03('0xe7');this[_0xeb03('0xbc')](_0x24e088)[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xe2')));this[_0xeb03('0xbb')](_0x24e088)[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xe3')));}};Dialer['prototype'][_0xeb03('0x38')]=function(_0x17f775){var _0x4938af=this[_0xeb03('0x2b')][_0x17f775['uniqueid']];var _0x20ae80=this;if(this[_0xeb03('0x24')][_0x17f775[_0xeb03('0xaa')]]){if(_0x4938af&&_0x4938af[_0xeb03('0x4e')]!==_0xeb03('0x79')){delete this[_0xeb03('0x2b')][_0x17f775[_0xeb03('0xcc')]];this[_0xeb03('0x24')][_0x17f775[_0xeb03('0xaa')]][_0xeb03('0x63')]+=0x1;var _0x44bf70=new AgentComplete(_0x4938af,_0x17f775);if(_0x17f775['reason']==='agent'){_0x44bf70[_0xeb03('0xe8')]=this['voiceQueues'][_0x17f775['queue']][_0xeb03('0xe9')]&&this[_0xeb03('0x24')][_0x17f775[_0xeb03('0xaa')]][_0xeb03('0xea')]?moment()[_0xeb03('0x77')](_0xeb03('0xeb')):undefined;}this[_0xeb03('0xbc')](_0x44bf70)[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xec')));this['moveContactManagedDialer'](_0x44bf70)[_0xeb03('0xa7')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xeb03('0x1e')]['syncAgentConnect']=function(_0xce8064){if(this[_0xeb03('0x24')][_0xce8064[_0xeb03('0xaa')]]){if(this[_0xeb03('0x2b')][_0xce8064[_0xeb03('0xcc')]]&&this['uniqueId'][_0xce8064[_0xeb03('0xcc')]][_0xeb03('0x4e')]!==_0xeb03('0x79')){this[_0xeb03('0xa9')](this[_0xeb03('0x24')][_0xce8064[_0xeb03('0xaa')]]);this[_0xeb03('0x2b')][_0xce8064['uniqueid']][_0xeb03('0xed')]=moment()[_0xeb03('0x77')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0xeb03('0xee')]=function(_0x1e86b7){this['createHistory'](_0x1e86b7)[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xec')));this[_0xeb03('0xbb')](_0x1e86b7)[_0xeb03('0xa7')](loggerCatch(_0xeb03('0xef')));};Dialer[_0xeb03('0x1e')]['syncQueueCallerAbandon']=function(_0x4e3695){var _0x477be5=this[_0xeb03('0x2b')][_0x4e3695[_0xeb03('0xcc')]];var _0x823e01=this;if(this[_0xeb03('0x24')][_0x4e3695['queue']]){if(_0x477be5&&_0x477be5[_0xeb03('0x4e')]!==_0xeb03('0x79')){delete this[_0xeb03('0x2b')][_0x4e3695[_0xeb03('0xcc')]];this[_0xeb03('0xa9')](this[_0xeb03('0x24')][_0x4e3695[_0xeb03('0xaa')]]);_0x477be5[_0xeb03('0xf0')]=moment()[_0xeb03('0x77')](_0xeb03('0xeb'));var _0x349bc1=new QueueCallerAbandon(_0x477be5,_0x4e3695);if(getSeconds(_0x477be5[_0xeb03('0xf0')],_0x477be5[_0xeb03('0xf1')])>=_0x477be5[_0xeb03('0xf2')]){this[_0xeb03('0x24')][_0x4e3695[_0xeb03('0xaa')]][_0xeb03('0x71')]+=0x1;this['voiceQueues'][_0x4e3695[_0xeb03('0xaa')]][_0xeb03('0x67')]+=0x1;this[_0xeb03('0x24')][_0x4e3695['queue']][_0xeb03('0xf3')]+=0x1;_0x349bc1[_0xeb03('0x9c')]=0xa;_0x349bc1['statedesc']=_0xeb03('0xf4');_0x349bc1[_0xeb03('0xf5')]=_0xeb03('0xf6');_0x349bc1['agiafterat']=this[_0xeb03('0x24')][_0x4e3695['queue']][_0xeb03('0xe9')]?moment()[_0xeb03('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;this[_0xeb03('0xee')](_0x349bc1);}else{this['voiceQueues'][_0x4e3695['queue']][_0xeb03('0x70')]+=0x1;this[_0xeb03('0x24')][_0x4e3695[_0xeb03('0xaa')]][_0xeb03('0x66')]+=0x1;_0x349bc1[_0xeb03('0x9c')]=0xb;_0x349bc1[_0xeb03('0x9d')]=_0xeb03('0xf7');_0x349bc1[_0xeb03('0xf5')]=_0xeb03('0xf8');this['queueCallerAbandonCreateState'](_0x349bc1);}}}};Dialer[_0xeb03('0x1e')][_0xeb03('0x3d')]=function(_0x80582d){if(this[_0xeb03('0xf9')][_0x80582d[_0xeb03('0xcc')]]){this['actions'][_0x80582d['uniqueid']][_0xeb03('0xa6')]=_0x80582d[_0xeb03('0xa6')];}if(this[_0xeb03('0x2b')][_0x80582d[_0xeb03('0xcc')]]){this[_0xeb03('0x2b')][_0x80582d['uniqueid']][_0xeb03('0xa6')]=_0x80582d[_0xeb03('0xa6')];}};Dialer[_0xeb03('0x1e')]['syncQueueMember']=function(_0x199ff9){if(strategy[this['voiceQueues'][this[_0xeb03('0xf9')][_0x199ff9[_0xeb03('0xfa')]][_0xeb03('0xaa')]][_0xeb03('0x4f')]]===_0xeb03('0x1d')){if(this[_0xeb03('0xf9')][_0x199ff9[_0xeb03('0xfa')]]&&_['isNil'](this[_0xeb03('0xf9')][_0x199ff9[_0xeb03('0xfa')]][_0xeb03('0xfb')])&&_0x199ff9[_0xeb03('0xa5')]==='1'&&_0x199ff9[_0xeb03('0xfc')]==='0'){if(this[_0xeb03('0x26')][_0x199ff9[_0xeb03('0xfd')]]){if(!this['agents'][_0x199ff9['stateinterface']][_0xeb03('0xfb')]){this[_0xeb03('0x26')][_0x199ff9['stateinterface']][_0xeb03('0xfb')]=!![];this[_0xeb03('0xf9')][_0x199ff9[_0xeb03('0xfa')]][_0xeb03('0xfb')]=!![];this[_0xeb03('0xf9')][_0x199ff9[_0xeb03('0xfa')]][_0xeb03('0xfd')]=_0x199ff9['stateinterface'];}}}}else if((strategy[this[_0xeb03('0x24')][this['actions'][_0x199ff9[_0xeb03('0xfa')]][_0xeb03('0xaa')]][_0xeb03('0x4f')]]||'rrmemory')==='rrmemory'){if(this['actions'][_0x199ff9[_0xeb03('0xfa')]]){if(this[_0xeb03('0x26')][_0x199ff9[_0xeb03('0xfd')]]){this['actions'][_0x199ff9[_0xeb03('0xfa')]][_0xeb03('0xfd')]=_0x199ff9[_0xeb03('0xfd')];if(_['isNil'](this[_0xeb03('0x30')][this[_0xeb03('0xf9')][_0x199ff9[_0xeb03('0xfa')]][_0xeb03('0xaa')]])){this['queueBooked'][this['actions'][_0x199ff9['actionid']][_0xeb03('0xaa')]]=[];}this['queueBooked'][this[_0xeb03('0xf9')][_0x199ff9[_0xeb03('0xfa')]][_0xeb03('0xaa')]][_0xeb03('0xfe')](_['merge'](_[_0xeb03('0xc2')](this[_0xeb03('0xf9')][_0x199ff9['actionid']],['idHopper','stateinterface']),{'status':_0x199ff9['status'],'paused':_0x199ff9['paused']}));}}}};function unlockQueueStatus(_0xabe8cb,_0x5d28bd){setTimeout(function(){if(_[_0xeb03('0x7e')](_0xabe8cb[_0xeb03('0xff')])){loggerBooked[_0xeb03('0x8e')](_0xeb03('0x100'),_0x5d28bd);}_0xabe8cb['queueStatusComplete']=!![];loggerBooked[_0xeb03('0x7f')]('[booked][unlockQueueStatus]',_0x5d28bd,JSON[_0xeb03('0x4c')](_[_0xeb03('0xc2')](_0xabe8cb,[_0xeb03('0x45'),_0xeb03('0xff')])));},0x1f3);}Dialer[_0xeb03('0x1e')]['syncQueueStatusComplete']=function(_0x3ef33a){var _0x5975c7=this;var _0x3c3e9d=_0x5975c7[_0xeb03('0x24')][_0x5975c7[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]];if(strategy[this['voiceQueues'][this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]][_0xeb03('0x4f')]]===_0xeb03('0x1d')){if(this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]]&&this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xfd')]){this[_0xeb03('0x23')][_0xeb03('0x101')](this[_0xeb03('0xf9')][_0x3ef33a['actionid']][_0xeb03('0x102')],this['actions'][_0x3ef33a[_0xeb03('0xfa')]]['stateinterface'])[_0xeb03('0xa7')](function(_0x2543e1){logger['error'](_0xeb03('0x103'),util[_0xeb03('0x8f')](_0x2543e1,{'showHidden':![],'depth':null}));})[_0xeb03('0x21')](function(){_0x5975c7['updateOriginated'](_0x5975c7[_0xeb03('0x24')][_0x5975c7[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]]);_0x5975c7[_0xeb03('0x26')][_0x5975c7[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xfd')]][_0xeb03('0xfb')]=![];delete _0x5975c7[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]];unlockQueueStatus(_0x3c3e9d);});}else{this[_0xeb03('0xa9')](this[_0xeb03('0x24')][this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]]);this[_0xeb03('0xb5')]({'active':![],'ContactId':this[_0xeb03('0xf9')][_0x3ef33a['actionid']][_0xeb03('0x104')],'ListId':this[_0xeb03('0xf9')][_0x3ef33a['actionid']][_0xeb03('0xc3')],'VoiceQueueId':this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xc4')]||undefined,'CampaignId':this[_0xeb03('0xf9')][_0x3ef33a['actionid']][_0xeb03('0x105')]||undefined})[_0xeb03('0xa7')](loggerCatch(_0xeb03('0x106')));delete this['actions'][_0x3ef33a[_0xeb03('0xfa')]];unlockQueueStatus(_0x3c3e9d);}}else if((strategy[this['voiceQueues'][this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]]['strategy']]||_0xeb03('0x107'))==='rrmemory'){var _0x13a6dc;if(this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]]&&!_[_0xeb03('0x7c')](this[_0xeb03('0x30')][this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]])){if(this['queueBookedRR'][_0x5975c7['actions'][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]]){this[_0xeb03('0x31')][_0x5975c7[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]]=this[_0xeb03('0x31')][this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]]['queue']]?this[_0xeb03('0x31')][this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]]:this[_0xeb03('0x30')][this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]]['queue']]?this[_0xeb03('0x30')][this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]][_0xeb03('0x108')]||0x0:0x0;}this[_0xeb03('0x30')][this['actions'][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]][_0xeb03('0x108')]=this[_0xeb03('0x31')][this[_0xeb03('0xf9')][_0x3ef33a[_0xeb03('0xfa')]][_0xeb03('0xaa')]];for(var _0x2afc74=0x0;_0x2afc74=0x0?!![]:![];})[_0xeb03('0xa7')](myreject(_0x57a278)));}}else{_0x160323[_0xeb03('0xfe')](ami[_0xeb03('0xa4')]({'action':_0xeb03('0x122'),'command':util['format'](_0xeb03('0x11d'),_0x4ed80f,!_['isUndefined'](config['timezones'][_0xb83949])?_0xb83949:'')})['then'](function(_0x730e4e){return _0x730e4e[_0xeb03('0x11f')][_0xeb03('0x120')](_0xeb03('0x121'))>=0x0?!![]:![];})[_0xeb03('0xa7')](myreject(_0x57a278)));}BPromise[_0xeb03('0x123')](_0x160323)[_0xeb03('0xae')](function(_0x598125){var _0x4d2e3b=_[_0xeb03('0x124')](_0x598125);if(_0x4d2e3b){return _0x1f7125(_0x4d2e3b);}else{_0x2d45b6[_0xeb03('0x43')]=_0xd7724d?'GLOBAL_INTERVAL_IS_OVERTIME':_0xeb03('0x125');return _0x57a278(msgResponse(_0xeb03('0x126'),_0xeb03('0x116'),'Global:\x20'+_0xd7724d+'\x20'+_0x2e63b4+_0xeb03('0x127')+util[_0xeb03('0x8f')](_0x4ed80f,{'showHidden':![],'depth':null})+_0xeb03('0x128')+_0xb83949));}})[_0xeb03('0xa7')](function(_0x46f2b9){return _0x57a278(msgResponse(_0xeb03('0x115'),_0xeb03('0x116'),JSON[_0xeb03('0x4c')](_0x46f2b9)));});});};Dialer[_0xeb03('0x1e')][_0xeb03('0x129')]=function(_0x206a91){var _0x9f515f=this;return function(){switch(_0x206a91['dialMethod']){case'progressive':freeVariablesPredictive(_0x206a91);_0x9f515f[_0xeb03('0x12a')](_0x206a91,0x1);break;case'power':freeVariablesPredictive(_0x206a91);_0x9f515f[_0xeb03('0x12a')](_0x206a91,_0x206a91[_0xeb03('0x12b')]);break;case'predictive':_0x9f515f['predictive'](_0x206a91);break;case _0xeb03('0x9'):freeVariablesPredictive(_0x206a91);_0x9f515f[_0xeb03('0x12a')](_0x206a91,0x1);break;default:freeVariablesPredictive(_0x206a91);logger[_0xeb03('0x8e')]('Queue',_0x206a91[_0xeb03('0x45')],_0xeb03('0x12c'));}};};Dialer[_0xeb03('0x1e')]['launchHandleIvr']=function(_0xdf48b7){var _0x174f2e=this;return function(){_0x174f2e[_0xeb03('0x12d')](_0xdf48b7);};};Dialer[_0xeb03('0x1e')]['syncQueueSummary']=function(_0x1cda01){var _0x574a0c=this;if(isNotPreview(_0x1cda01['dialMethod'])){if(isVoiceQueueOutbound(_0x1cda01[_0xeb03('0x4e')])&&isActive(_0x1cda01['dialActive'])){_0x1cda01[_0xeb03('0x97')]=!![];BPromise[_0xeb03('0xad')]()[_0xeb03('0xae')](checkIsLoggedIn(_0x1cda01,_0x1cda01['loggedIn']))['then'](checkIsActive(_0x1cda01,_0x1cda01[_0xeb03('0x5c')]))[_0xeb03('0xae')](checkInterval(_0x1cda01))[_0xeb03('0xae')](_0x574a0c[_0xeb03('0x112')](_0x1cda01))['then'](_0x574a0c[_0xeb03('0x12e')](_0x1cda01[_0xeb03('0x12f')],_0x1cda01[_0xeb03('0x130')],_0x1cda01[_0xeb03('0x45')],_0x1cda01))[_0xeb03('0xae')](_0x574a0c[_0xeb03('0x131')](_0x1cda01['Interval'],_0x1cda01['dialTimezone'],_0x1cda01[_0xeb03('0x45')],_0x1cda01))[_0xeb03('0xae')](_0x574a0c[_0xeb03('0x129')](_0x1cda01))['catch'](loggerCatchQueueSummary(_0xeb03('0x132'),_0x1cda01));}else{notSendMessagesQueue(_0x1cda01);}}else{freeVariablesPredictive(_0x1cda01);}};Dialer[_0xeb03('0x1e')]['syncCampaigns']=function(){var _0x296b22=this;var _0xa0554;for(var _0x2da63e in this['campaigns']){if(this[_0xeb03('0x25')][_0xeb03('0xa3')](_0x2da63e)){_0xa0554=this[_0xeb03('0x25')][_0x2da63e];if(isCampaignIvr(_0xa0554[_0xeb03('0x4e')])&&isActive(_0xa0554[_0xeb03('0xc9')])){_0xa0554[_0xeb03('0x97')]=!![];BPromise[_0xeb03('0xad')]()[_0xeb03('0xae')](checkIsActive(_0xa0554,_0xa0554[_0xeb03('0xc9')]))[_0xeb03('0xae')](checkInterval(_0xa0554))[_0xeb03('0xae')](_0x296b22[_0xeb03('0x112')](_0xa0554))[_0xeb03('0xae')](_0x296b22[_0xeb03('0x12e')](_0xa0554[_0xeb03('0x12f')],_0xa0554['dialTimezone'],_0xa0554[_0xeb03('0x45')],_0xa0554))[_0xeb03('0xae')](_0x296b22[_0xeb03('0x131')](_0xa0554[_0xeb03('0x48')],_0xa0554[_0xeb03('0x130')],_0xa0554[_0xeb03('0x45')],_0xa0554))['then'](_0x296b22[_0xeb03('0x133')](_0xa0554))[_0xeb03('0xa7')](loggerCatchQueueSummary(_0xeb03('0x134'),_0xa0554));}else{notSendMessagesCampaign(_0xa0554);}}}};function getCallerIdRandom(_0x21f1a5,_0x184e0f){var _0x5dce4b,_0x128188,_0x2cd1b5;if(_0x184e0f<=0x0){_0x184e0f=0x1;}_0x5dce4b=new RegExp('\x5cw{0,'+_0x184e0f+'}$');_0x128188=Math[_0xeb03('0x135')](0xa,_0x184e0f-0x1);_0x2cd1b5=Math[_0xeb03('0x135')](0xa,_0x184e0f)-0x1;return util[_0xeb03('0x77')]('%s',_[_0xeb03('0x136')](_0x21f1a5,_0x5dce4b,_[_0xeb03('0x137')](_0x128188,_0x2cd1b5)));}function extractCalleridName(_0x361630){var _0x2e7d16=_0x361630[_0xeb03('0x138')](/"(.*?)"/);return _0x2e7d16?_0x2e7d16[0x1]:_0x361630;}function extractCalleridNumber(_0xea3597){var _0x6a2544=_0xea3597[_0xeb03('0x138')](/<(.*?)>/);return _0x6a2544?_0x6a2544[0x1]:_0xea3597;}Dialer[_0xeb03('0x1e')][_0xeb03('0x139')]=function(_0x4f9581,_0x307dc8){var _0x59ccc3=this;var _0x535299=uuid['v4']();this[_0xeb03('0xf9')][_0x535299]=new Action(_0x4f9581,_0x307dc8,_0x535299);return new BPromise(function(_0x3a6406,_0x8a50a7){if(_['isUndefined'](_0x4f9581)&&_0xeb03('0x13a')!==typeof _0x4f9581){return _0x8a50a7(msgResponse(_0xeb03('0x13b'),_0xeb03('0x116'),_0xeb03('0x13c')));}if(_[_0xeb03('0x7e')](_0x307dc8[_0xeb03('0x13d')][_0xeb03('0x13e')])||_0x307dc8[_0xeb03('0x13d')][_0xeb03('0x13e')]===null){return _0x8a50a7(msgResponse(_0xeb03('0x13b'),_0xeb03('0x116'),_0xeb03('0x13f')));}var _0x477350={'XMD-CALLERID':_0x59ccc3[_0xeb03('0xf9')][_0x535299]['getCaller'](),'XMD-AGI':_0x4f9581['dialQueueProject']?util[_0xeb03('0x77')](_0xeb03('0x140'),ipAgi,_0x4f9581['dialQueueProject']):_0xeb03('0x141'),'XMD-AGIAFTER':_0x4f9581[_0xeb03('0xe9')]?util[_0xeb03('0x77')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4f9581[_0xeb03('0xe9')]):_0xeb03('0x141'),'XMD-QUEUE':_0x4f9581[_0xeb03('0x4e')]==='outbound'?util[_0xeb03('0x77')](_0xeb03('0x142'),_0x4f9581[_0xeb03('0x45')],_0x4f9581[_0xeb03('0x143')]||'',_0x4f9581['dialAgiAfterHangupAgent']?'c':'',_0x4f9581[_0xeb03('0xf2')]||0x3):_0xeb03('0x141'),'XMD-CONTACTID':_0x307dc8['ContactId'],'XMD-CDRTYPE':_0xeb03('0x8'),'CALLERID(all)':_0x59ccc3['actions'][_0x535299][_0xeb03('0x144')](),'XMD-AMD':_0x4f9581[_0xeb03('0xd1')]?_0xeb03('0x145'):_0xeb03('0x141'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4f9581[_0xeb03('0xd1')]){_0x477350[_0xeb03('0x146')]=_0x4f9581[_0xeb03('0x147')]||0x9c4;_0x477350[_0xeb03('0x148')]=_0x4f9581[_0xeb03('0x149')]||0x5dc;_0x477350[_0xeb03('0x14a')]=_0x4f9581[_0xeb03('0x14b')]||0x320;_0x477350[_0xeb03('0x14c')]=_0x4f9581[_0xeb03('0x14d')]||0x1388;_0x477350[_0xeb03('0x14e')]=_0x4f9581[_0xeb03('0x14f')]||0x64;_0x477350[_0xeb03('0x150')]=_0x4f9581[_0xeb03('0x151')]||0x32;_0x477350['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4f9581['dialAMDMaximumNumberOfWords']||0x3;_0x477350['XMD-AMDSILENCETHRESHOLD']=_0x4f9581['dialAMDSilenceThreshold']||0x100;_0x477350[_0xeb03('0x152')]=_0x4f9581[_0xeb03('0x153')]||0x1388;}if(_0x4f9581[_0xeb03('0x4e')]===_0xeb03('0x8a')){_0x477350['XMD-VOICEQUEUEID']=_0x307dc8[_0xeb03('0xc4')];}else{_0x477350[_0xeb03('0x154')]=_0x307dc8['CampaignId'];}for(var _0x349e81 in _0x307dc8[_0xeb03('0x13d')]){if(_0x307dc8[_0xeb03('0x13d')][_0xeb03('0xa3')](_0x349e81)){if(isNotNull(_0x307dc8[_0xeb03('0x13d')][_0x349e81])&&_0x349e81!=='id'&&_0x349e81!==_0xeb03('0x155')&&_0x349e81!==_0xeb03('0x156')&&_0x349e81!=='updatedAt'){_0x477350[util[_0xeb03('0x77')]('%s%s',_0xeb03('0x157'),_[_0xeb03('0x158')](_0x349e81))]=_0x307dc8[_0xeb03('0x13d')][_0x349e81];}}}var _0x4c9fd4=_0x59ccc3[_0xeb03('0x113')](_0x4f9581[_0xeb03('0x75')])?getCallerId(_0x4f9581['Trunk']['callerid'],_0x4f9581[_0xeb03('0x5e')],_0x4f9581['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4f9581[_0xeb03('0x5f')],_0x4f9581[_0xeb03('0x159')]):_0x4f9581['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x4f9581[_0xeb03('0x114')])?_0x4f9581[_0xeb03('0x75')][_0xeb03('0x76')]:_0x4f9581[_0xeb03('0x114')][_0xeb03('0x76')],_0x4f9581[_0xeb03('0x5e')],_0x4f9581['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4f9581[_0xeb03('0x5f')],_0x4f9581[_0xeb03('0x159')]):_0x4f9581[_0xeb03('0x5f')]);if(_0x4c9fd4){_0x477350[_0xeb03('0x15a')]=_0x59ccc3[_0xeb03('0xf9')][_0x535299]['originatecalleridname']=extractCalleridName(_0x4c9fd4);_0x477350[_0xeb03('0x15b')]=_0x59ccc3[_0xeb03('0xf9')][_0x535299]['originatecalleridnum']=extractCalleridNumber(_0x4c9fd4);}return ami[_0xeb03('0xa4')]({'actionid':_0x535299,'action':_0xeb03('0x13b'),'channel':_0x59ccc3['isTrunkReachable'](_0x4f9581[_0xeb03('0x75')])?util['format'](_0xeb03('0x15c'),_0x4f9581['Trunk']['name'],isNotNull(_0x4f9581['dialPrefix'])?_0x4f9581[_0xeb03('0x61')][_0xeb03('0x15d')]()||'':'',_0x4f9581[_0xeb03('0x15e')]>0x0?_0x307dc8[_0xeb03('0x13d')][_0xeb03('0x13e')][_0xeb03('0x15f')](_0x4f9581[_0xeb03('0x15e')]):_0x307dc8[_0xeb03('0x13d')][_0xeb03('0x13e')]):util['format']('SIP/%s/%s%s',_[_0xeb03('0xcd')](_0x4f9581[_0xeb03('0x114')])?_0x4f9581[_0xeb03('0x75')]['name']:_0x4f9581[_0xeb03('0x114')][_0xeb03('0x45')],isNotNull(_0x4f9581['dialPrefix'])?_0x4f9581['dialPrefix'][_0xeb03('0x15d')]()||'':'',_0x4f9581[_0xeb03('0x15e')]>0x0?_0x307dc8[_0xeb03('0x13d')]['phone'][_0xeb03('0x15f')](_0x4f9581[_0xeb03('0x15e')]):_0x307dc8[_0xeb03('0x13d')]['phone']),'callerid':_0x4c9fd4,'Exten':_0xeb03('0x160'),'Context':_0xeb03('0x161'),'Priority':'1','variable':_0x477350,'timeout':(_0x4f9581[_0xeb03('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x535299})[_0xeb03('0xae')](function(_0xcf4bf5){return _0x3a6406(_0xcf4bf5);})[_0xeb03('0xa7')](function(_0x2ef45c){_0x4f9581['outboundOriginateFailureCallsDay']+=0x1;var _0x5ded55=new History(_0x59ccc3[_0xeb03('0xf9')][_0x535299]);logger['error'](util[_0xeb03('0x77')]('[originateError]:\x20%s',JSON[_0xeb03('0x4c')](_0x2ef45c)));_0x5ded55[_0xeb03('0x9c')]=0xe;_0x5ded55[_0xeb03('0x9d')]=_0xeb03('0x162');_0x5ded55[_0xeb03('0x163')]=moment()[_0xeb03('0x77')](_0xeb03('0xeb'));_0x5ded55[_0xeb03('0x9e')]=_0x5ded55[_0xeb03('0x163')];_0x59ccc3[_0xeb03('0xbc')](_0x5ded55)['catch'](loggerCatch(_0xeb03('0x164')));_0x59ccc3[_0xeb03('0xbb')](_0x5ded55)[_0xeb03('0xa7')](loggerCatch(_0xeb03('0x164')))[_0xeb03('0x21')](function(){delete _0x59ccc3['actions'][_0x535299];return _0x8a50a7(msgResponse(_0xeb03('0x13b'),_0xeb03('0x4b'),_0xeb03('0x165')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x35fbe6){var _0x4cbea2=this[_0xeb03('0xf9')][_0x35fbe6[_0xeb03('0xfa')]];var _0x50839c=this;if(_0x4cbea2){delete this[_0xeb03('0xf9')][_0x35fbe6['actionid']];_0x4cbea2[_0xeb03('0xf1')]=moment()[_0xeb03('0x77')](_0xeb03('0xeb'));var _0x3245f3=_0x4cbea2['type']===_0xeb03('0x79')?this[_0xeb03('0x25')][_0x4cbea2[_0xeb03('0xaa')]]:this['voiceQueues'][_0x4cbea2['getQueue']()];if(!this[_0xeb03('0xc7')](_0x35fbe6[_0xeb03('0x166')])){this[_0xeb03('0xa9')](_0x3245f3);return this['callProgressDetecting'](_0x4cbea2,_0x3245f3,_0x35fbe6)['then'](function(_0x1b72d4){})['catch'](loggerCatch(_0xeb03('0x167')));}else{this[_0xeb03('0x2b')][_0x35fbe6['uniqueid']]=_0x4cbea2;}}};Dialer['prototype']['checkRetriveMax']=function(_0x48a84d,_0x5f18f5,_0x3cbdac){var _0x3f5b66=new History(_0x5f18f5);if(_0x3f5b66[_0xeb03('0x168')]+_0x3f5b66[_0xeb03('0x169')]+_0x3f5b66[_0xeb03('0x16a')]>=_0x3cbdac['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x48a84d){case 0x3:if(_0x3f5b66[_0xeb03('0x16a')]>=_0x3cbdac[_0xeb03('0x16b')]-0x1){return!![];}else{this[_0xeb03('0xb5')]({'active':![],'countnoanswerretry':_0x3f5b66[_0xeb03('0x16a')]+=0x1,'scheduledat':moment()[_0xeb03('0x16c')](_0x3cbdac[_0xeb03('0x16d')],'minutes')['format'](_0xeb03('0xeb')),'ContactId':_0x3f5b66[_0xeb03('0x104')],'ListId':_0x3f5b66['ListId'],'VoiceQueueId':_0x3f5b66[_0xeb03('0xc4')]||undefined,'CampaignId':_0x3f5b66[_0xeb03('0x105')]||undefined})[_0xeb03('0xa7')](loggerCatch(_0xeb03('0x16e')));}break;case 0x5:if(_0x3f5b66[_0xeb03('0x168')]>=_0x3cbdac[_0xeb03('0x16f')]-0x1){return!![];}else{this[_0xeb03('0xb5')]({'active':![],'countbusyretry':_0x3f5b66['countbusyretry']+=0x1,'scheduledat':moment()[_0xeb03('0x16c')](_0x3cbdac[_0xeb03('0x170')],_0xeb03('0x171'))[_0xeb03('0x77')](_0xeb03('0xeb')),'ContactId':_0x3f5b66[_0xeb03('0x104')],'ListId':_0x3f5b66['ListId'],'VoiceQueueId':_0x3f5b66[_0xeb03('0xc4')]||undefined,'CampaignId':_0x3f5b66[_0xeb03('0x105')]||undefined})[_0xeb03('0xa7')](loggerCatch(_0xeb03('0x172')));}break;case 0x8:if(_0x3f5b66[_0xeb03('0x169')]>=_0x3cbdac[_0xeb03('0x173')]-0x1){return!![];}else{this[_0xeb03('0xb5')]({'active':![],'countcongestionretry':_0x3f5b66[_0xeb03('0x169')]+=0x1,'scheduledat':moment()[_0xeb03('0x16c')](_0x3cbdac[_0xeb03('0x174')],'minutes')[_0xeb03('0x77')](_0xeb03('0xeb')),'ContactId':_0x3f5b66[_0xeb03('0x104')],'ListId':_0x3f5b66[_0xeb03('0xc3')],'VoiceQueueId':_0x3f5b66[_0xeb03('0xc4')]||undefined,'CampaignId':_0x3f5b66['CampaignId']||undefined})[_0xeb03('0xa7')](loggerCatch(_0xeb03('0x175')));}break;default:return!![];}};Dialer[_0xeb03('0x1e')][_0xeb03('0x176')]=function(_0x355b3e,_0x20da33,_0x1c17d3){var _0x2de047=this;var _0x2ea3c2=new History(_0x355b3e);return new BPromise(function(_0x3bfce4,_0x4d1a25){if(_['isUndefined'](_0x20da33)&&'object'!==typeof _0x20da33){return _0x4d1a25(msgResponse(_0xeb03('0x177'),_0xeb03('0x116'),'entity\x20is\x20undefine'));}if(_[_0xeb03('0x7e')](_0x1c17d3)&&'object'!==typeof _0x1c17d3){return _0x4d1a25(msgResponse('[callProgressDetecting]',_0xeb03('0x116'),_0xeb03('0x178')));}switch(_0x1c17d3[_0xeb03('0x179')]){case'0':_0x20da33[_0xeb03('0x69')]+=0x1;_0x2ea3c2[_0xeb03('0x9c')]=0x0;_0x2ea3c2[_0xeb03('0x9d')]=_0xeb03('0x17a');_0x2de047['createHistory'](_0x2ea3c2)[_0xeb03('0xa7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2de047[_0xeb03('0x17b')](0x0,_0x355b3e,_0x20da33)){if(_0x2ea3c2[_0xeb03('0x168')]+_0x2ea3c2[_0xeb03('0x169')]+_0x2ea3c2['countnoanswerretry']>=_0x20da33[_0xeb03('0x17c')]){_0x2de047['stateGlobal'](_0x2ea3c2,_0x3bfce4,_0x4d1a25,_0xeb03('0x17d'));}else{_0x2de047[_0xeb03('0x17e')](_0x2ea3c2,_0x3bfce4,_0x4d1a25,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x20da33['outboundNoAnswerCallsDay']+=0x1;_0x2ea3c2[_0xeb03('0x9c')]=0x3;_0x2ea3c2[_0xeb03('0x9d')]=_0xeb03('0x17f');_0x2ea3c2[_0xeb03('0x16a')]+=0x1;_0x2ea3c2[_0xeb03('0x180')]+=0x1;_0x2de047['createHistory'](_0x2ea3c2)[_0xeb03('0xa7')](loggerCatch(_0xeb03('0x181')));if(_0x2de047['checkRetriveMax'](0x3,_0x355b3e,_0x20da33)){if(_0x2ea3c2[_0xeb03('0x16a')]>=_0x20da33[_0xeb03('0x16b')]){_0x2de047['createStateFinal'](_0x2ea3c2,_0x3bfce4,_0x4d1a25,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2de047[_0xeb03('0x182')](_0x2ea3c2,_0x3bfce4,_0x4d1a25,_0xeb03('0x183'));}}break;case'5':_0x20da33[_0xeb03('0x65')]+=0x1;_0x2ea3c2[_0xeb03('0x9c')]=0x5;_0x2ea3c2[_0xeb03('0x9d')]=_0xeb03('0x184');_0x2ea3c2[_0xeb03('0x168')]+=0x1;_0x2ea3c2[_0xeb03('0x180')]+=0x1;_0x2de047['createHistory'](_0x2ea3c2)[_0xeb03('0xa7')](loggerCatch(_0xeb03('0x185')));if(_0x2de047[_0xeb03('0x17b')](0x5,_0x355b3e,_0x20da33)){if(_0x2ea3c2[_0xeb03('0x168')]>=_0x20da33[_0xeb03('0x16f')]){_0x2de047[_0xeb03('0x17e')](_0x2ea3c2,_0x3bfce4,_0x4d1a25,'reason\x205\x20busy');}else{_0x2de047[_0xeb03('0x182')](_0x2ea3c2,_0x3bfce4,_0x4d1a25,'reason\x205\x20busy');}}break;case'8':_0x20da33[_0xeb03('0x186')]+=0x1;_0x2ea3c2[_0xeb03('0x9c')]=0x8;_0x2ea3c2[_0xeb03('0x9d')]=_0xeb03('0x187');_0x2ea3c2[_0xeb03('0x169')]+=0x1;_0x2ea3c2[_0xeb03('0x180')]+=0x1;_0x2de047['createHistory'](_0x2ea3c2)[_0xeb03('0xa7')](loggerCatch(_0xeb03('0x188')));if(_0x2de047[_0xeb03('0x17b')](0x8,_0x355b3e,_0x20da33)){if(_0x2ea3c2[_0xeb03('0x169')]>=_0x20da33[_0xeb03('0x173')]){_0x2de047[_0xeb03('0x17e')](_0x2ea3c2,_0x3bfce4,_0x4d1a25,'reason\x208\x20congestion');}else{_0x2de047['stateGlobal'](_0x2ea3c2,_0x3bfce4,_0x4d1a25,_0xeb03('0x189'));}}break;default:_0x20da33[_0xeb03('0x6d')]+=0x1;_0x2ea3c2[_0xeb03('0x9c')]=0xc;_0x2ea3c2[_0xeb03('0x9d')]=_0x1c17d3[_0xeb03('0x179')];_0x2de047[_0xeb03('0xbc')](_0x2ea3c2)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x2de047[_0xeb03('0x17b')](_0x1c17d3[_0xeb03('0x179')],_0x355b3e,_0x20da33)){if(_0x2ea3c2[_0xeb03('0x168')]+_0x2ea3c2[_0xeb03('0x169')]+_0x2ea3c2[_0xeb03('0x16a')]>=_0x20da33[_0xeb03('0x17c')]){_0x2de047['stateGlobal'](_0x2ea3c2,_0x3bfce4,_0x4d1a25,_0x1c17d3[_0xeb03('0x179')]);}else{_0x2de047[_0xeb03('0x17e')](_0x2ea3c2,_0x3bfce4,_0x4d1a25,_0x1c17d3[_0xeb03('0x179')]);}}}});};Dialer[_0xeb03('0x1e')][_0xeb03('0x182')]=function(_0x5a4ab5,_0x42205e,_0x22c795,_0x3af922){var _0x2ebfb7=new Final(_0x5a4ab5);_0x2ebfb7[_0xeb03('0x9c')]=0xf;_0x2ebfb7[_0xeb03('0x9d')]='Global';this['createStateFinal'](_0x2ebfb7,_0x42205e,_0x22c795,_0x3af922);};Dialer[_0xeb03('0x1e')][_0xeb03('0x17e')]=function(_0x5d8866,_0x572d6f,_0x4bd421,_0x360425){this[_0xeb03('0xbb')](_0x5d8866)[_0xeb03('0xae')](function(_0x576263){return _0x572d6f(msgResponse('[callProgressDetecting]','Success',_0x360425));})[_0xeb03('0xa7')](function(_0x2eb676){return _0x4bd421(msgResponse('[moveContactManagedDialer][0]',_0xeb03('0x116'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xeb03('0x18a')]=function(_0x3219c1){var _0x6d54d6=this;var _0x98de79=_0x3219c1[_0xeb03('0x18b')]/0x64;var _0x298092=_0x3219c1[_0xeb03('0x67')]/(_0x3219c1[_0xeb03('0x67')]+_0x3219c1['outboundAnswerCallsDay']);var _0x1a114c=_0x3219c1[_0xeb03('0x51')]-_0x3219c1[_0xeb03('0x18c')]-_0x3219c1[_0xeb03('0x5a')]-_0x3219c1[_0xeb03('0x74')]-_0x3219c1['talking'];var _0x46d357=(_0x3219c1[_0xeb03('0x51')]-_0x3219c1[_0xeb03('0x18c')])*_0x3219c1[_0xeb03('0x73')];var _0x1f3ea2=Math[_0xeb03('0x18d')](_0x3219c1['erlangCalls']*_0x3219c1[_0xeb03('0x18e')]*_0x3219c1[_0xeb03('0x18f')]*_0x3219c1[_0xeb03('0x190')]);if(_[_0xeb03('0x7e')](_0x3219c1['startProgressive'])){loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x191'));if(!_['isUndefined'](_0x3219c1[_0xeb03('0x2d')])){_0x3219c1[_0xeb03('0x2d')]=undefined;loggerPredictive[_0xeb03('0x8e')](_0xeb03('0x192'),_0xeb03('0x193'));}if(!_['isUndefined'](_0x3219c1['handlePredictive'])){loggerPredictive[_0xeb03('0x8e')](_0xeb03('0x192'),_0xeb03('0x194'));clearInterval(_0x3219c1['handlePredictive']);_0x3219c1[_0xeb03('0x89')]=undefined;}_0x3219c1[_0xeb03('0x2e')]=moment()[_0xeb03('0x77')](_0xeb03('0xeb'));loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x195'),_0x3219c1[_0xeb03('0x2e')],_0x3219c1[_0xeb03('0x45')]);this[_0xeb03('0x12a')](_0x3219c1,0x1);}else if(ifInterval(_0x3219c1[_0xeb03('0x196')],_0x3219c1[_0xeb03('0x2e')])){this[_0xeb03('0x12a')](_0x3219c1,0x1);loggerPredictiveCalls[_0xeb03('0x7f')](_0xeb03('0x197'),_0x3219c1[_0xeb03('0x2e')],_0x3219c1['name']);_0x3219c1[_0xeb03('0x198')]=0x0;_0x3219c1[_0xeb03('0xf3')]=0x0;}else if(_0x98de79<_0x298092&&_0x3219c1[_0xeb03('0x199')]===_0xeb03('0x19a')){freeVariablesPredictive(_0x3219c1);loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x19b'),'Dropped\x20calls\x20day',_0x298092,_0xeb03('0x2e'),_0x3219c1[_0xeb03('0x45')]);}else if(_0x1a114c>_0x46d357){freeVariablesPredictive(_0x3219c1);loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x19c'),_0xeb03('0x19d'),_0x1a114c,_0xeb03('0x19e'),_0x46d357);}else if(_0x1f3ea2<_0x3219c1[_0xeb03('0xf3')]&&_0x3219c1['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x3219c1);loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x19f'),_0xeb03('0x1a0'),_0x1f3ea2,'Drop\x20in\x20this\x20interval',_0x3219c1[_0xeb03('0xf3')],_0xeb03('0x2e'),_0x3219c1[_0xeb03('0x45')]);}else if(!ifInterval(_0x3219c1[_0xeb03('0x196')],_0x3219c1[_0xeb03('0x2e')])&&_[_0xeb03('0x7e')](_0x3219c1[_0xeb03('0x2d')])&&!_['isUndefined'](_0x3219c1[_0xeb03('0x2e')])){_0x3219c1[_0xeb03('0x2d')]=moment()[_0xeb03('0x77')](_0xeb03('0xeb'));loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x1a1'),_0x3219c1[_0xeb03('0x2d')],_0x3219c1['name']);this['averageHandleTime'](_0x3219c1[_0xeb03('0x196')])[_0xeb03('0xae')](this[_0xeb03('0x1a2')](_0x3219c1))[_0xeb03('0xae')](mergeDataErlangB(_0x3219c1))[_0xeb03('0xae')](this['startMethodPredictive'](_0x3219c1))['catch'](loggerCatchPredictive(_0xeb03('0x1a3'),_0x3219c1));}else if(!ifInterval(_0x3219c1[_0xeb03('0x196')],_0x3219c1[_0xeb03('0x2d')])){_0x3219c1[_0xeb03('0xf3')]=0x0;_0x3219c1[_0xeb03('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x1a4'),_0x3219c1['startPredictive'],_0x3219c1['name']);clearInterval(_0x3219c1[_0xeb03('0x89')]);_0x3219c1[_0xeb03('0x89')]=undefined;this[_0xeb03('0x1a5')](_0x3219c1[_0xeb03('0x196')])[_0xeb03('0xae')](this[_0xeb03('0x1a2')](_0x3219c1))['then'](mergeDataErlangB(_0x3219c1))[_0xeb03('0xae')](this['startMethodPredictive'](_0x3219c1))['catch'](loggerCatchPredictive('[averageHandleTime][ErlangB]\x20',_0x3219c1));}};Dialer['prototype'][_0xeb03('0x1a2')]=function(_0x1e1aaf){var _0x23210f=this;return function(_0x3a23f1){return new BPromise(function(_0x424ea4,_0x2cdbc0){_['merge'](_0x1e1aaf,_0x3a23f1[0x0]);if(checkGetDataPredictive(_0x3a23f1[0x0])){loggerPredictive[_0xeb03('0x7f')](JSON[_0xeb03('0x4c')](_0x3a23f1[0x0]));if(_0x1e1aaf[_0xeb03('0x199')]===_0xeb03('0x19a')){return _0x23210f['getVoiceQueueRtPauses'](_0x1e1aaf['id'])['then'](function(_0x58a03b){var _0x3592d4=_0x1e1aaf['loggedIn']-_0x58a03b[0x0][_0xeb03('0x1a6')];var _0x48e50b=_0x1e1aaf[_0xeb03('0x196')]*0x3c;var _0x258827=_0x3a23f1[0x0][_0xeb03('0x6f')]+_0x3a23f1[0x0][_0xeb03('0x6e')];var _0x2d9abd=(_0x3a23f1[0x0]['predictiveIntervalAnsweredCalls']+_0x3a23f1[0x0][_0xeb03('0x71')]+_0x3a23f1[0x0][_0xeb03('0x70')])/_0x3a23f1[0x0][_0xeb03('0x7d')];var _0x4ccdbb=_0x1e1aaf[_0xeb03('0x18b')]/0x64;_0x1e1aaf[_0xeb03('0x18c')]=_0x58a03b[0x0][_0xeb03('0x1a6')]||0x0;_0x1e1aaf[_0xeb03('0x18f')]=_0x2d9abd>0x0?_0x2d9abd:0x1;return _0x23210f[_0xeb03('0x1a7')](_0x3592d4,_0x48e50b,_0x258827,_0x2d9abd,_0x4ccdbb);})['then'](function(_0x320045){return _0x424ea4(_0x320045);})['catch'](function(_0x18a52d){return _0x2cdbc0(msgResponse(_0xeb03('0x1a8'),_0xeb03('0x116'),JSON[_0xeb03('0x4c')](_0x18a52d)));});}if(_0x1e1aaf[_0xeb03('0x199')]===_0xeb03('0x1a9')){return _0x23210f[_0xeb03('0xb9')](_0x1e1aaf['id'])[_0xeb03('0xae')](function(_0x393709){var _0x2f7003=_0x1e1aaf[_0xeb03('0x51')]-_0x393709[0x0][_0xeb03('0x1a6')];var _0x5e1d4a=_0x1e1aaf[_0xeb03('0x196')]*0x3c;var _0x47e0bb=_0x3a23f1[0x0]['predictiveIntervalAvgTalktime']+_0x3a23f1[0x0]['predictiveIntervalAvgHoldtime'];var _0x22bbe2=(_0x3a23f1[0x0][_0xeb03('0x1aa')]+_0x3a23f1[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3a23f1[0x0][_0xeb03('0x70')])/_0x3a23f1[0x0][_0xeb03('0x7d')];var _0x132de6=_0x1e1aaf['dialPredictiveOptimizationPercentage']/0x64;_0x1e1aaf[_0xeb03('0x18c')]=_0x393709[0x0]['outboundQueuePauses']||0x0;_0x1e1aaf[_0xeb03('0x18f')]=_0x22bbe2>0x0?_0x22bbe2:0x1;return _0x23210f['busyFactor'](_0x2f7003,_0x5e1d4a,_0x47e0bb,_0x22bbe2,_0x132de6);})['then'](function(_0x1f6bde){return _0x424ea4(_0x1f6bde);})[_0xeb03('0xa7')](function(_0x32b772){return _0x2cdbc0(msgResponse(_0xeb03('0x1a8'),'Failure',JSON['stringify'](_0x32b772)));});}}else{return _0x2cdbc0(msgResponse('[getDataPredictive]',_0xeb03('0x116'),_0xeb03('0x1ab')));}});};};Dialer['prototype'][_0xeb03('0x1ac')]=function(_0x2c6362){var _0x17aecc=this;return function(){var _0x3373d1=0x0;var _0x51f6ec=Math['floor'](_0x2c6362[_0xeb03('0x1ad')]*0x3e8);if(_0x51f6ec>0x0){_0x51f6ec=_0x51f6ec<0x64?0x64:_0x51f6ec;loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x1ae'),_0x51f6ec);_0x2c6362[_0xeb03('0x89')]=setInterval(function(){_0x17aecc['handlePredictive'](_0x2c6362);loggerPredictiveCalls['info']('[handlePredictive]',_0x3373d1+=0x1);},_0x51f6ec);}else{loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x1af'),_0xeb03('0x1b0'),_0x51f6ec);}};};Dialer['prototype']['checkContactBlack']=function(_0x2a1552,_0x1fbf57){var _0x48e489=this;return function(_0x2a3262){if(_['isEmpty'](_0x2a3262)){if(_[_0xeb03('0xcd')](_0x1fbf57[_0xeb03('0x1b1')])||!_0x1fbf57[_0xeb03('0x1b2')]){if(_0x2a1552[_0xeb03('0x5d')]===_0xeb03('0x9')){_0x2a1552[_0xeb03('0xff')]=_[_0xeb03('0x7e')](_0x2a1552[_0xeb03('0xff')])?!![]:_0x2a1552[_0xeb03('0xff')];var _0x1b12c1=uuid['v4']();_0x48e489[_0xeb03('0xf9')][_0x1b12c1]=new Action(_0x2a1552,_0x1fbf57,_0x1b12c1);loggerBooked[_0xeb03('0x7f')](_0xeb03('0x1b3'),_0x1b12c1,_0xeb03('0x1b4'),JSON[_0xeb03('0x4c')](_0x2a1552['queueStatusComplete']),_0xeb03('0x1b5'),_0x2a1552['name']);if(_0x2a1552['queueStatusComplete']){_0x2a1552['queueStatusComplete']=![];_0x48e489['queueBooked'][_0x48e489['actions'][_0x1b12c1][_0xeb03('0xaa')]]=[];ami[_0xeb03('0xa4')]({'actionid':_0x1b12c1,'action':_0xeb03('0x1b6'),'queue':_0x2a1552[_0xeb03('0x45')]})['catch'](function(_0x2acdb6){_0x48e489[_0xeb03('0xa9')](_0x2a1552);_0x48e489[_0xeb03('0xb5')]({'active':![],'ContactId':_0x48e489[_0xeb03('0xf9')][_0x1b12c1]['ContactId'],'ListId':_0x48e489[_0xeb03('0xf9')][_0x1b12c1]['ListId'],'VoiceQueueId':_0x48e489['actions'][_0x1b12c1]['VoiceQueueId']||undefined,'CampaignId':_0x48e489['actions'][_0x1b12c1][_0xeb03('0x105')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x48e489[_0xeb03('0xf9')][_0x1b12c1];});}else{loggerBooked[_0xeb03('0x7f')](_0xeb03('0x1b7'),JSON[_0xeb03('0x4c')](_0x2a1552[_0xeb03('0xff')]),_0xeb03('0x1b5'),_0x2a1552['name']);_0x48e489[_0xeb03('0xa9')](_0x2a1552);_0x48e489['rescheduleContact']({'active':![],'ContactId':_0x48e489[_0xeb03('0xf9')][_0x1b12c1][_0xeb03('0x104')],'ListId':_0x48e489[_0xeb03('0xf9')][_0x1b12c1][_0xeb03('0xc3')],'VoiceQueueId':_0x48e489[_0xeb03('0xf9')][_0x1b12c1][_0xeb03('0xc4')]||undefined,'CampaignId':_0x48e489[_0xeb03('0xf9')][_0x1b12c1]['CampaignId']||undefined})[_0xeb03('0xa7')](loggerCatch(_0xeb03('0x1b8')));delete _0x48e489[_0xeb03('0xf9')][_0x1b12c1];}}else{return _0x48e489[_0xeb03('0x139')](_0x2a1552,_0x1fbf57);}}else{if(getDiff(_0x1fbf57[_0xeb03('0x1b9')])<_0x2a1552[_0xeb03('0x1ba')]*0x3c){_0x48e489[_0xeb03('0x23')][_0xeb03('0x101')](_0x1fbf57['id'])[_0xeb03('0x21')](function(){_0x48e489[_0xeb03('0xa9')](_0x2a1552);});}else{_0x2a1552[_0xeb03('0x6b')]+=0x1;_0x48e489[_0xeb03('0xa9')](_0x2a1552);if(_0x2a1552['dialRecallInQueue']){_0x48e489[_0xeb03('0xb5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1fbf57['ContactId'],'ListId':_0x1fbf57[_0xeb03('0xc3')],'VoiceQueueId':_0x1fbf57['VoiceQueueId']||undefined,'CampaignId':_0x1fbf57[_0xeb03('0x105')]||undefined})[_0xeb03('0xa7')](loggerCatch(_0xeb03('0x1bb')));_0x48e489[_0xeb03('0xbc')](createObjHistory(_0x2a1552,_0x1fbf57,_0xeb03('0x1bc'),0x17,'RecallInQueue'))[_0xeb03('0xa7')](loggerCatch(_0xeb03('0x1bd')));}else{_0x48e489[_0xeb03('0xd9')](createObjHistory(_0x2a1552,_0x1fbf57,_0xeb03('0x1be'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0xeb03('0x1bf'));}}}}else{_0x2a1552[_0xeb03('0x64')]+=0x1;_0x48e489[_0xeb03('0xd9')](createObjHistory(_0x2a1552,_0x1fbf57,_0xeb03('0x1c0'),0xd,_0xeb03('0x1c1')),_0xeb03('0x1c2'),_0xeb03('0x1c3'));throw'inBlackList';}};};Dialer[_0xeb03('0x1e')][_0xeb03('0x12d')]=function(_0xe8d526){var _0x133bfc=this;var _0x324204=[];var _0x4c0703=_0xe8d526[_0xeb03('0x1c4')]-_0xe8d526[_0xeb03('0x74')]-_0xe8d526[_0xeb03('0x1c5')];emitCampaignSummary(_0xe8d526);if(_0x4c0703>0x0){if(_0x4c0703>this['maxNumberOriginate']){_0x4c0703=this[_0xeb03('0x28')];}_0xe8d526[_0xeb03('0x1c5')]+=_0x4c0703;this[_0xeb03('0xb8')](_0xe8d526['id'],_0x4c0703,_0xe8d526['dialOrderByScheduledAt'])[_0xeb03('0xae')](function(_0x2a3f01){_0xe8d526[_0xeb03('0x1c5')]-=_0x4c0703;_0xe8d526['temp']=_0xe8d526[_0xeb03('0x1c5')]>0x0?_0xe8d526[_0xeb03('0x1c5')]:0x0;if(!checkContactEmpty(_0x2a3f01)){_0xe8d526[_0xeb03('0x43')]=_0xeb03('0x95');logger['info'](_0xeb03('0x1c6')+_0xe8d526[_0xeb03('0x45')]);}else{_0xe8d526[_0xeb03('0x74')]+=_0x2a3f01[_0xeb03('0x109')];_0xe8d526[_0xeb03('0x43')]='RUNNING';for(var _0x54ce8a=0x0;_0x54ce8a<_0x2a3f01[_0xeb03('0x109')];_0x54ce8a+=0x1){_0xe8d526[_0xeb03('0x1c7')]+=0x1;if(_['isNil'](_0x2a3f01[_0x54ce8a])||_[_0xeb03('0xcd')](_0x2a3f01[_0x54ce8a][_0xeb03('0x13d')])||_[_0xeb03('0xcd')](_0x2a3f01[_0x54ce8a][_0xeb03('0x13d')][_0xeb03('0x13e')])){_0x133bfc['emptyContact']('[actionOriginate]\x20',_0xe8d526,_0x2a3f01[_0x54ce8a]);}else{_0x133bfc['checkIsBlackListIvr'](_[_0xeb03('0xc2')](_0x2a3f01[_0x54ce8a],[_0xeb03('0x105'),'Contact.phone']))[_0xeb03('0xae')](_0x133bfc['checkContactBlack'](_0xe8d526,_0x2a3f01[_0x54ce8a]))['catch'](_0x133bfc[_0xeb03('0xbf')]('[actionOriginateIvr]\x20',_0xe8d526));}}}})[_0xeb03('0xa7')](loggerGetContactDialer('[getContactCampaign2]',_0xe8d526,_0x4c0703));}};Dialer['prototype']['handlePower']=function(_0x210c20,_0x524720){var _0x10f852=this;var _0x3e55ed=[];var _0x52a4ac=_0x524720>=0x1?_0x524720:0x1;var _0x52775d=[];if(_0x210c20[_0xeb03('0x5d')]===_0xeb03('0x9')){_0x52a4ac=0x1;}var _0x57949c=Math[_0xeb03('0x18d')](_0x210c20['available']*_0x52a4ac)-_0x210c20[_0xeb03('0x74')]-_0x210c20[_0xeb03('0x1c5')];emitVoiceQueueSummary(_0x210c20);if(_0x210c20[_0xeb03('0x1c8')]>0x0){var _0x51c44e=_0x210c20[_0xeb03('0x1c8')]-_0x210c20[_0xeb03('0x74')]-_0x210c20[_0xeb03('0x56')]-_0x210c20[_0xeb03('0x1c5')]-_0x210c20[_0xeb03('0x52')];if(_0x57949c>_0x51c44e){_0x57949c=_0x51c44e;}}if(_0x57949c>0x0){if(_0x210c20[_0xeb03('0x5d')]==='booked'){_0x57949c=0x1;}if(_0x57949c>this['maxNumberOriginate']){_0x57949c=this[_0xeb03('0x28')];}_0x210c20['temp']+=_0x57949c;for(var _0xa29a6 in this[_0xeb03('0x26')]){if(this['agents'][_0xeb03('0xa3')](_0xa29a6)){if(this['agents'][_0xa29a6][_0xeb03('0x9c')]===_0xeb03('0x1c9')&&this['agents'][_0xa29a6][_0xeb03('0xa5')]===_0xeb03('0xcb')){_0x3e55ed[_0xeb03('0xfe')](this['agents'][_0xa29a6]['id']);}}}this[_0xeb03('0x1ca')](_0x210c20['id'],_0x3e55ed,_0x57949c,_0x210c20[_0xeb03('0x1cb')])['then'](function(_0x1a0f59){_0x210c20[_0xeb03('0x1c5')]-=_0x57949c;_0x210c20['temp']=_0x210c20['temp']>0x0?_0x210c20[_0xeb03('0x1c5')]:0x0;if(!checkContactEmpty(_0x1a0f59)){_0x10f852[_0xeb03('0xac')](_0x210c20)[_0xeb03('0xae')](sendMessageReschedule(_0x210c20))[_0xeb03('0xa7')](loggerCatch('[countReScheduled]\x20'));}else{_0x210c20[_0xeb03('0x74')]+=_0x1a0f59[_0xeb03('0x109')];_0x210c20['message']=_0x210c20[_0xeb03('0x5d')]===_0xeb03('0x9')?_0xeb03('0x145'):_0xeb03('0x1cc');for(var _0xcd0bc8=0x0;_0xcd0bc8<_0x1a0f59[_0xeb03('0x109')];_0xcd0bc8+=0x1){if(_[_0xeb03('0xcd')](_0x1a0f59[_0xcd0bc8])||_[_0xeb03('0xcd')](_0x1a0f59[_0xcd0bc8]['Contact'])||_[_0xeb03('0xcd')](_0x1a0f59[_0xcd0bc8]['Contact']['phone'])){_0x10f852[_0xeb03('0xc0')]('[actionOriginate]\x20',_0x210c20,_0x1a0f59[_0xcd0bc8]);}else{_0x10f852[_0xeb03('0xb0')](_[_0xeb03('0xc2')](_0x1a0f59[_0xcd0bc8],[_0xeb03('0xc4'),_0xeb03('0x1cd')]))[_0xeb03('0xae')](_0x10f852[_0xeb03('0x1ce')](_0x210c20,_0x1a0f59[_0xcd0bc8]))[_0xeb03('0xa7')](_0x10f852['loggerHandler'](_0xeb03('0x1cf'),_0x210c20));}}}})[_0xeb03('0xa7')](loggerGetContactDialer(_0xeb03('0x1d0'),_0x210c20,_0x57949c));}};Dialer[_0xeb03('0x1e')][_0xeb03('0x89')]=function(_0xe8c8ba){var _0x3c7cf3=this;if(_0xe8c8ba['dialLimitQueue']>0x0){var _0x4da558=_0xe8c8ba[_0xeb03('0x1c8')]-_0xe8c8ba['originated']-_0xe8c8ba[_0xeb03('0x56')];if(_0x4da558>0x0){this[_0xeb03('0x1d1')](_0xe8c8ba);}else{loggerPredictiveCalls[_0xeb03('0x7f')](_0xeb03('0x1d2'));}}else{this[_0xeb03('0x1d1')](_0xe8c8ba);}};Dialer[_0xeb03('0x1e')][_0xeb03('0x1d1')]=function(_0x28ec21){var _0x2fa402=this;var _0x2d718e=[];_0x28ec21[_0xeb03('0x74')]+=0x1;for(var _0x198072 in this[_0xeb03('0x26')]){if(this[_0xeb03('0x26')][_0xeb03('0xa3')](_0x198072)){if(this[_0xeb03('0x26')][_0x198072][_0xeb03('0x9c')]===_0xeb03('0x1c9')&&this[_0xeb03('0x26')][_0x198072]['status']===_0xeb03('0xcb')){_0x2d718e[_0xeb03('0xfe')](this[_0xeb03('0x26')][_0x198072]['id']);}}}this[_0xeb03('0x1ca')](_0x28ec21['id'],_0x2d718e,0x1,_0x28ec21[_0xeb03('0x1cb')])[_0xeb03('0xae')](function(_0x3ab5ec){if(!checkContactEmpty(_0x3ab5ec)){checkContactLowerLimitOriginate(_0x28ec21,0x1,0x0);_0x2fa402['countReScheduled'](_0x28ec21)[_0xeb03('0xae')](sendMessageReschedule(_0x28ec21))['catch'](loggerCatch(_0xeb03('0xaf')));}else{_0x28ec21[_0xeb03('0x43')]=_0xeb03('0x1cc');if(_[_0xeb03('0xcd')](_0x3ab5ec[0x0])||_[_0xeb03('0xcd')](_0x3ab5ec[0x0][_0xeb03('0x13d')])||_[_0xeb03('0xcd')](_0x3ab5ec[0x0][_0xeb03('0x13d')]['phone'])){_0x2fa402[_0xeb03('0xc0')]('[actionOriginate]\x20',_0x28ec21,_0x3ab5ec[0x0]);}else{_0x2fa402[_0xeb03('0xb0')](_[_0xeb03('0xc2')](_0x3ab5ec[0x0],[_0xeb03('0xc4'),_0xeb03('0x1cd')]))['then'](_0x2fa402[_0xeb03('0x1ce')](_0x28ec21,_0x3ab5ec[0x0]))[_0xeb03('0xa7')](_0x2fa402[_0xeb03('0xbf')](_0xeb03('0x1d3'),_0x28ec21));}}})[_0xeb03('0xa7')](loggerGetContactDialer('[getContactDialerPredictive]',_0x28ec21,0x1));emitVoiceQueueSummary(_0x28ec21);};Dialer[_0xeb03('0x1e')][_0xeb03('0x1a7')]=function(_0x2aecdb,_0x136e18,_0x4fa151,_0x1cc3d3,_0x5d2a1c,_0x5584d9){loggerPredictive[_0xeb03('0x7f')](_0xeb03('0x1d4'),_0xeb03('0x1d5'),_0x2aecdb,_0xeb03('0x1d6'),_0x136e18,_0xeb03('0x1d7'),_0x4fa151,'\x20p\x20=\x20',_0x1cc3d3,_0xeb03('0x1d8'),_0x5d2a1c);return new BPromise(function(_0x59ac3e,_0xa00619){if(_0x2aecdb<=0x0||isNaN(_0x2aecdb)){return _0xa00619(msgResponse(_0xeb03('0x1d4'),_0xeb03('0x4b'),_0xeb03('0x1d9')+_0x2aecdb));}if(_0x4fa151<=0x0||isNaN(_0x4fa151)){return _0xa00619(msgResponse('[abandonmentRate]',_0xeb03('0x4b'),_0xeb03('0x1da')+_0x4fa151));}if(_0x1cc3d3<=0x0||isNaN(_0x1cc3d3)){return _0xa00619(msgResponse(_0xeb03('0x1d4'),_0xeb03('0x4b'),_0xeb03('0x1db')+_0x1cc3d3));}if(_0x136e18<=0x0||isNaN(_0x136e18)){return _0xa00619(msgResponse(_0xeb03('0x1d4'),'Error',_0xeb03('0x1dc')+_0x136e18));}if(_0x5d2a1c<=0x0||isNaN(_0x5d2a1c)){return _0xa00619(msgResponse('[abandonmentRate]',_0xeb03('0x4b'),'Amax\x20=\x20'+_0x5d2a1c));}_0x5584d9=_0x5584d9||0x0;var _0x4c3f91=0x1/_0x4fa151;var _0x466eab=0x0;var _0x14fd16=0x0;var _0x2ec693=0x0;var _0x1b45a4=0x0;for(var _0xc9bff4=0x0;_0x2ec693<_0x5d2a1c;_0xc9bff4+=0x1){_0x14fd16=_0xc9bff4/_0x136e18;_0x466eab=(_0x1cc3d3*_0x14fd16+_0x5584d9)/_0x4c3f91;_0x2ec693=erlangb(_0x466eab,_0x2aecdb);_0x1b45a4=_0x466eab/_0x2aecdb*(0x1-erlangb(_0x466eab,_0x2aecdb));}return _0x59ac3e({'erlangCalls':_0xc9bff4,'erlangCallToSecond':_0x136e18/_0xc9bff4,'erlangAbandonmentRate':_0x2ec693,'erlangBusyFactor':_0x1b45a4});});};Dialer['prototype'][_0xeb03('0x1dd')]=function(_0x4ee5e5,_0x4621d6,_0x19dbf3,_0xd1f2d5,_0x3ed23d,_0x29a4ff){loggerPredictive['info']('[busyFactor]',_0xeb03('0x1d5'),_0x4ee5e5,_0xeb03('0x1d6'),_0x4621d6,'\x20Ts\x20=\x20',_0x19dbf3,_0xeb03('0x1de'),_0xd1f2d5,_0xeb03('0x1df'),_0x3ed23d);return new BPromise(function(_0x6f543d,_0xcf9916){if(_0x4ee5e5<=0x0||isNaN(_0x4ee5e5)){return _0xcf9916(msgResponse(_0xeb03('0x1d4'),_0xeb03('0x4b'),'m\x20=\x20'+_0x4ee5e5));}if(_0x19dbf3<=0x0||isNaN(_0x19dbf3)){return _0xcf9916(msgResponse(_0xeb03('0x1d4'),_0xeb03('0x4b'),_0xeb03('0x1da')+_0x19dbf3));}if(_0xd1f2d5<=0x0||isNaN(_0xd1f2d5)){return _0xcf9916(msgResponse(_0xeb03('0x1d4'),_0xeb03('0x4b'),_0xeb03('0x1db')+_0xd1f2d5));}if(_0x4621d6<=0x0||isNaN(_0x4621d6)){return _0xcf9916(msgResponse(_0xeb03('0x1d4'),'Error',_0xeb03('0x1dc')+_0x4621d6));}if(_0x3ed23d<=0x0||isNaN(_0x3ed23d)){return _0xcf9916(msgResponse(_0xeb03('0x1d4'),'Error',_0xeb03('0x1e0')+_0x3ed23d));}_0x29a4ff=_0x29a4ff||0x0;var _0x547b9f=0x1/_0x19dbf3;var _0x4e0b47=0x0;var _0x5ab20c=0x0;var _0x16b7de=0x0;var _0x5e6c7e=0x0;for(var _0x5667cf=0x0;_0x5e6c7e<_0x3ed23d;_0x5667cf+=0x1){_0x5ab20c=_0x5667cf/_0x4621d6;_0x4e0b47=(_0xd1f2d5*_0x5ab20c+_0x29a4ff)/_0x547b9f;_0x16b7de=erlangb(_0x4e0b47,_0x4ee5e5);_0x5e6c7e=_0x4e0b47/_0x4ee5e5*(0x1-erlangb(_0x4e0b47,_0x4ee5e5));}return _0x6f543d({'erlangCalls':_0x5667cf,'erlangCallToSecond':_0x4621d6/_0x5667cf,'erlangAbandonmentRate':_0x16b7de,'erlangBusyFactor':_0x5e6c7e});});};module[_0xeb03('0x1e1')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 50ed230..5916d9f 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 _0x1684=['scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x1684,0x147));var _0x4168=function(_0x412a90,_0x535c17){_0x412a90=_0x412a90-0x0;var _0x46f926=_0x1684[_0x412a90];return _0x46f926;};'use strict';var util=require(_0x4168('0x0'));var _=require(_0x4168('0x1'));var moment=require(_0x4168('0x2'));function getSeconds(_0x20755d,_0x1d377f){var _0x2ba0e5=moment(_0x20755d)[_0x4168('0x3')](0x0);var _0x356c7c=moment(_0x1d377f)['milliseconds'](0x0);return _0x2ba0e5[_0x4168('0x4')](_0x356c7c,_0x4168('0x5'));}function QueueCallerAbandon(_0xdde32b,_0x490bd2){this[_0x4168('0x6')]=_0xdde32b[_0x4168('0x6')];this['type']=_0xdde32b[_0x4168('0x7')];this[_0x4168('0x8')]=_0xdde32b[_0x4168('0x7')]==='outbound'?_0x4168('0x9'):_0xdde32b[_0x4168('0x7')];this['countbusyretry']=_0xdde32b[_0x4168('0xa')];this[_0x4168('0xb')]=_0xdde32b[_0x4168('0xb')];this[_0x4168('0xc')]=_0xdde32b[_0x4168('0xc')];this[_0x4168('0xd')]=_0xdde32b['countbusyretry']+_0xdde32b[_0x4168('0xb')]+_0xdde32b[_0x4168('0xc')];this[_0x4168('0xe')]=_0x490bd2[_0x4168('0xe')];this['calleridname']=_0xdde32b['name'];this[_0x4168('0xf')]=_0xdde32b[_0x4168('0x10')];this[_0x4168('0x11')]=_0xdde32b[_0x4168('0x11')];this['responsetime']=_0xdde32b[_0x4168('0x12')];this[_0x4168('0x13')]=_0xdde32b[_0x4168('0x13')];this[_0x4168('0x14')]=this['droptime'];this[_0x4168('0x15')]=getSeconds(_0xdde32b[_0x4168('0x12')],_0xdde32b[_0x4168('0x11')]);this['holdtime']=getSeconds(this[_0x4168('0x13')],_0xdde32b[_0x4168('0x12')]);this[_0x4168('0x16')]=0x0;this[_0x4168('0x9')]=_0x490bd2[_0x4168('0x9')];this[_0x4168('0x17')]=_0x490bd2['connectedlinename'];this['reason']=_0x490bd2[_0x4168('0x18')];this[_0x4168('0x19')]=_0xdde32b['callback'];this['callbackuniqueid']=_0xdde32b[_0x4168('0x1a')];this[_0x4168('0x1b')]=_0xdde32b[_0x4168('0x1b')];this[_0x4168('0x1c')]=_0xdde32b[_0x4168('0x1c')];this[_0x4168('0x1d')]=_0xdde32b[_0x4168('0x1d')];this['ListId']=_0xdde32b[_0x4168('0x1e')];this[_0x4168('0x1f')]=_0xdde32b[_0x4168('0x1f')];this[_0x4168('0x20')]=_0xdde32b['VoiceQueueId'];this['CampaignId']=_0xdde32b[_0x4168('0x21')];this[_0x4168('0x22')]=_0xdde32b[_0x4168('0x22')]||'';this['originatecalleridname']=_0xdde32b[_0x4168('0x23')]||'';}module[_0x4168('0x24')]=QueueCallerAbandon; \ No newline at end of file +var _0x2b24=['starttime','responsetime','droptime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name','calleridnum','number'];(function(_0x119846,_0x1308cc){var _0x550507=function(_0x18a39f){while(--_0x18a39f){_0x119846['push'](_0x119846['shift']());}};_0x550507(++_0x1308cc);}(_0x2b24,0x118));var _0x42b2=function(_0x2cfbe2,_0x3da4c7){_0x2cfbe2=_0x2cfbe2-0x0;var _0xdd4ff5=_0x2b24[_0x2cfbe2];return _0xdd4ff5;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x42b2('0x0'));function getSeconds(_0x2bb926,_0x3b3ad5){var _0x386764=moment(_0x2bb926)[_0x42b2('0x1')](0x0);var _0x5117e2=moment(_0x3b3ad5)[_0x42b2('0x1')](0x0);return _0x386764['diff'](_0x5117e2,_0x42b2('0x2'));}function QueueCallerAbandon(_0x30af08,_0x4c782d){this['scheduledat']=_0x30af08[_0x42b2('0x3')];this[_0x42b2('0x4')]=_0x30af08[_0x42b2('0x4')];this[_0x42b2('0x5')]=_0x30af08['type']===_0x42b2('0x6')?'queue':_0x30af08['type'];this['countbusyretry']=_0x30af08[_0x42b2('0x7')];this[_0x42b2('0x8')]=_0x30af08[_0x42b2('0x8')];this[_0x42b2('0x9')]=_0x30af08[_0x42b2('0x9')];this[_0x42b2('0xa')]=_0x30af08[_0x42b2('0x7')]+_0x30af08[_0x42b2('0x8')]+_0x30af08[_0x42b2('0x9')];this['uniqueid']=_0x4c782d[_0x42b2('0xb')];this[_0x42b2('0xc')]=_0x30af08[_0x42b2('0xd')];this[_0x42b2('0xe')]=_0x30af08[_0x42b2('0xf')];this[_0x42b2('0x10')]=_0x30af08[_0x42b2('0x10')];this[_0x42b2('0x11')]=_0x30af08[_0x42b2('0x11')];this[_0x42b2('0x12')]=_0x30af08['droptime'];this['endtime']=this['droptime'];this[_0x42b2('0x13')]=getSeconds(_0x30af08[_0x42b2('0x11')],_0x30af08[_0x42b2('0x10')]);this[_0x42b2('0x14')]=getSeconds(this[_0x42b2('0x12')],_0x30af08[_0x42b2('0x11')]);this[_0x42b2('0x15')]=0x0;this[_0x42b2('0x16')]=_0x4c782d[_0x42b2('0x16')];this[_0x42b2('0x17')]=_0x4c782d[_0x42b2('0x18')];this[_0x42b2('0x19')]=_0x4c782d[_0x42b2('0x19')];this['callback']=_0x30af08[_0x42b2('0x1a')];this[_0x42b2('0x1b')]=_0x30af08[_0x42b2('0x1b')];this[_0x42b2('0x1c')]=_0x30af08[_0x42b2('0x1c')];this[_0x42b2('0x1d')]=_0x30af08[_0x42b2('0x1d')];this[_0x42b2('0x1e')]=_0x30af08[_0x42b2('0x1e')];this['ListId']=_0x30af08[_0x42b2('0x1f')];this['UserId']=_0x30af08[_0x42b2('0x20')];this['VoiceQueueId']=_0x30af08[_0x42b2('0x21')];this[_0x42b2('0x22')]=_0x30af08[_0x42b2('0x22')];this[_0x42b2('0x23')]=_0x30af08['originatecalleridnum']||'';this[_0x42b2('0x24')]=_0x30af08[_0x42b2('0x24')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index b75fe54..74d19c8 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 _0x9b6c=['format','%s/%s/%s','tech','name','fax','localstationid','headerinfo','path','AttachmentId','util','moment','uniqueid'];(function(_0x38f8d8,_0x23dcd5){var _0x23ce4a=function(_0x58a9c3){while(--_0x58a9c3){_0x38f8d8['push'](_0x38f8d8['shift']());}};_0x23ce4a(++_0x23dcd5);}(_0x9b6c,0xf9));var _0xc9b6=function(_0x1be8ba,_0x2cb0d9){_0x1be8ba=_0x1be8ba-0x0;var _0x24b1b2=_0x9b6c[_0x1be8ba];return _0x24b1b2;};'use strict';var util=require(_0xc9b6('0x0'));var _=require('lodash');var moment=require(_0xc9b6('0x1'));function Action(_0x6d3248,_0x1cfcaf,_0x4ec965){this[_0xc9b6('0x2')]=_0x6d3248||undefined;this['channel']=util[_0xc9b6('0x3')](_0xc9b6('0x4'),_0x1cfcaf[_0xc9b6('0x5')],_0x1cfcaf['Trunk'][_0xc9b6('0x6')],_0x4ec965[_0xc9b6('0x7')]);this['localstationid']=_0x1cfcaf[_0xc9b6('0x8')];this[_0xc9b6('0x9')]=_0x1cfcaf[_0xc9b6('0x9')];this[_0xc9b6('0xa')]=_0x4ec965[_0xc9b6('0xa')];this[_0xc9b6('0xb')]=_0x4ec965[_0xc9b6('0xb')];}module['exports']=Action; \ No newline at end of file +var _0xd4b6=['AttachmentId','exports','util','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name','fax','path'];(function(_0x4f01ad,_0x5334cd){var _0x189341=function(_0x4db7d7){while(--_0x4db7d7){_0x4f01ad['push'](_0x4f01ad['shift']());}};_0x189341(++_0x5334cd);}(_0xd4b6,0x1d6));var _0x6d4b=function(_0x5dbc37,_0xdf1c57){_0x5dbc37=_0x5dbc37-0x0;var _0x1296f8=_0xd4b6[_0x5dbc37];return _0x1296f8;};'use strict';var util=require(_0x6d4b('0x0'));var _=require('lodash');var moment=require('moment');function Action(_0x228db6,_0x1e7343,_0x7b6b74){this[_0x6d4b('0x1')]=_0x228db6||undefined;this[_0x6d4b('0x2')]=util[_0x6d4b('0x3')](_0x6d4b('0x4'),_0x1e7343[_0x6d4b('0x5')],_0x1e7343[_0x6d4b('0x6')][_0x6d4b('0x7')],_0x7b6b74[_0x6d4b('0x8')]);this['localstationid']=_0x1e7343['localstationid'];this['headerinfo']=_0x1e7343['headerinfo'];this[_0x6d4b('0x9')]=_0x7b6b74[_0x6d4b('0x9')];this[_0x6d4b('0xa')]=_0x7b6b74[_0x6d4b('0xa')];}module[_0x6d4b('0xb')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 9172f3b..49490b6 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 _0xe4c1=['Trunk','isValid','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','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','moment','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','status','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','error','stringify','\x20receiveFax\x20','syncOriginateResponse','pick','response','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','catch','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xe4c1,0x91));var _0x1e4c=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xe4c1[_0x2642cb];return _0xe6e41;};'use strict';var util=require(_0x1e4c('0x0'));var _=require(_0x1e4c('0x1'));var BPromise=require(_0x1e4c('0x2'));var uuid=require('uuid');var moment=require(_0x1e4c('0x3'));var path=require(_0x1e4c('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x1e4c('0x5'));var logger=require(_0x1e4c('0x6'))(_0x1e4c('0x7'));var ami=require(_0x1e4c('0x8'));var rpcDb=require(_0x1e4c('0x9'));var Channel=require(_0x1e4c('0xa'));var ut=require(_0x1e4c('0xb'));var Action=require(_0x1e4c('0xc'));var faxAccount=require(_0x1e4c('0xd'));var attachment=require(_0x1e4c('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x412f14){this['channels']={};this[_0x1e4c('0xf')]=_0x412f14['faxAccounts'];this[_0x1e4c('0x10')]=_0x412f14[_0x1e4c('0x10')];this[_0x1e4c('0x11')]={};ami['on'](_0x1e4c('0x12'),this['syncNewchannel'][_0x1e4c('0x13')](this));ami['on'](_0x1e4c('0x14'),this[_0x1e4c('0x15')][_0x1e4c('0x13')](this));ami['on']('newstate',this[_0x1e4c('0x16')][_0x1e4c('0x13')](this));ami['on'](_0x1e4c('0x17'),this[_0x1e4c('0x18')][_0x1e4c('0x13')](this));ami['on'](_0x1e4c('0x19'),this[_0x1e4c('0x1a')]['bind'](this));ami['on'](_0x1e4c('0x1b'),this[_0x1e4c('0x1c')]['bind'](this));ami['on'](_0x1e4c('0x1d'),this[_0x1e4c('0x1e')][_0x1e4c('0x13')](this));ami['on'](_0x1e4c('0x1f'),this['syncOriginateResponse'][_0x1e4c('0x13')](this));}Fax[_0x1e4c('0x20')]['syncNewchannel']=function(_0x30e2cd){if(_0x30e2cd[_0x1e4c('0x21')]===_0x1e4c('0x22')){for(var _0x4610b1 in this[_0x1e4c('0xf')]){if(this['faxAccounts'][_0x1e4c('0x23')](_0x4610b1)){if(_0x30e2cd[_0x1e4c('0x24')]===this[_0x1e4c('0xf')][_0x4610b1][_0x1e4c('0x25')]){this[_0x1e4c('0x26')][_0x30e2cd[_0x1e4c('0x27')]]={};this[_0x1e4c('0x26')][_0x30e2cd[_0x1e4c('0x27')]][_0x1e4c('0x28')]=_0x30e2cd[_0x1e4c('0x28')];this[_0x1e4c('0x26')][_0x30e2cd[_0x1e4c('0x27')]]['id']=this[_0x1e4c('0xf')][_0x4610b1]['id'];this[_0x1e4c('0x26')][_0x30e2cd[_0x1e4c('0x27')]]['name']=this['faxAccounts'][_0x4610b1][_0x1e4c('0x29')];logger['info'](_0x30e2cd[_0x1e4c('0x27')],_0x1e4c('0x2a'));}}}}if(this[_0x1e4c('0x11')][_0x30e2cd[_0x1e4c('0x27')]]){this[_0x1e4c('0x26')][_0x30e2cd[_0x1e4c('0x27')]]={};this[_0x1e4c('0x26')][_0x30e2cd[_0x1e4c('0x27')]]['channel']=_0x30e2cd[_0x1e4c('0x28')];logger[_0x1e4c('0x2b')](_0x30e2cd['uniqueid'],_0x1e4c('0x2a'));}};Fax['prototype'][_0x1e4c('0x15')]=function(_0x48911f){if(this[_0x1e4c('0x26')][_0x48911f['uniqueid']]){for(var _0x414a31 in _0x48911f[_0x1e4c('0x2c')]){if(_0x48911f['variable'][_0x1e4c('0x23')](_0x414a31)){this['channels'][_0x48911f['uniqueid']][_0x414a31]=_0x48911f[_0x1e4c('0x2d')];}}}};Fax[_0x1e4c('0x20')]['syncNewState']=function(_0x53612b){if(this[_0x1e4c('0x26')][_0x53612b[_0x1e4c('0x27')]]){this[_0x1e4c('0x26')][_0x53612b['uniqueid']][_0x1e4c('0x2e')]=_0x53612b[_0x1e4c('0x2e')];this['channels'][_0x53612b[_0x1e4c('0x27')]][_0x1e4c('0x2f')]=_0x53612b[_0x1e4c('0x2f')];}};Fax[_0x1e4c('0x20')][_0x1e4c('0x18')]=function(_0x1ab5a8){if(this[_0x1e4c('0x26')][_0x1ab5a8['uniqueid']]){for(var _0x34bc77 in _0x1ab5a8[_0x1e4c('0x2c')]){if(_0x1ab5a8[_0x1e4c('0x2c')]['hasOwnProperty'](_0x34bc77)){this[_0x1e4c('0x26')][_0x1ab5a8['uniqueid']][_0x34bc77]=_0x1ab5a8[_0x1e4c('0x2d')];}}}};Fax['prototype'][_0x1e4c('0x1a')]=function(_0x35b56d){if(this[_0x1e4c('0x26')][_0x35b56d[_0x1e4c('0x27')]]){this[_0x1e4c('0x26')][_0x35b56d[_0x1e4c('0x27')]]['operation']=_0x35b56d['operation'];this[_0x1e4c('0x26')][_0x35b56d[_0x1e4c('0x27')]]['status']=_0x35b56d[_0x1e4c('0x30')];this[_0x1e4c('0x26')][_0x35b56d[_0x1e4c('0x27')]]['localstationid']=_0x35b56d['localstationid'];this[_0x1e4c('0x26')][_0x35b56d[_0x1e4c('0x27')]]['filename']=_0x35b56d['filename'];logger[_0x1e4c('0x2b')](_0x35b56d[_0x1e4c('0x27')],_0x1e4c('0x31'));}};Fax[_0x1e4c('0x20')][_0x1e4c('0x1c')]=function(_0xc4e336){var _0x8035c8=this;if(this[_0x1e4c('0x26')][_0xc4e336['uniqueid']]){var _0xa3fd1d=this[_0x1e4c('0x26')][_0xc4e336[_0x1e4c('0x27')]]['id'];this[_0x1e4c('0x26')][_0xc4e336[_0x1e4c('0x27')]][_0x1e4c('0x32')]=_0xc4e336[_0x1e4c('0x32')];this[_0x1e4c('0x26')][_0xc4e336[_0x1e4c('0x27')]]['pagestransferred']=_0xc4e336[_0x1e4c('0x33')];this[_0x1e4c('0x26')][_0xc4e336['uniqueid']][_0x1e4c('0x25')]=_0xc4e336[_0x1e4c('0x25')];this[_0x1e4c('0x26')][_0xc4e336['uniqueid']][_0x1e4c('0x34')]=_0xc4e336[_0x1e4c('0x34')];this[_0x1e4c('0x26')][_0xc4e336[_0x1e4c('0x27')]][_0x1e4c('0x35')]=_0xc4e336[_0x1e4c('0x35')];this[_0x1e4c('0x26')][_0xc4e336['uniqueid']]['filename']=_0xc4e336[_0x1e4c('0x36')];this[_0x1e4c('0x26')][_0xc4e336[_0x1e4c('0x27')]][_0x1e4c('0x37')]=_0xc4e336[_0x1e4c('0x37')];if(this[_0x1e4c('0x26')][_0xc4e336[_0x1e4c('0x27')]][_0x1e4c('0x33')]>0x0){tiff2pdf(_0xc4e336[_0x1e4c('0x36')],_0x1e4c('0x38'),function(_0x2d9851){logger[_0x1e4c('0x2b')](_0xc4e336[_0x1e4c('0x27')],'\x20result\x20conversion\x20file\x20',_0x2d9851[_0x1e4c('0x39')]);attachment[_0x1e4c('0x3a')]({'name':path[_0x1e4c('0x3b')](_0xc4e336[_0x1e4c('0x36')])[_0x1e4c('0x29')],'basename':path['parse'](_0xc4e336[_0x1e4c('0x36')])[_0x1e4c('0x29')]+_0x1e4c('0x3c'),'type':_0x1e4c('0x3d')})[_0x1e4c('0x3e')](function(_0x4e4499){faxAccount[_0x1e4c('0x3f')](_0xa3fd1d,{'from':_0xc4e336[_0x1e4c('0x37')],'mapKey':_0x1e4c('0x7'),'body':path['parse'](_0xc4e336['filename'])[_0x1e4c('0x29')]+'.pdf','AttachmentId':_0x4e4499['id']})['catch'](function(_0x122c23){logger[_0x1e4c('0x40')](_0xc4e336[_0x1e4c('0x27')],'\x20notify\x20',JSON[_0x1e4c('0x41')](_0x122c23));});})['catch'](function(_0x427c01){logger[_0x1e4c('0x40')](_0xc4e336['uniqueid'],_0x1e4c('0x42'),JSON[_0x1e4c('0x41')](_0x427c01));});});}logger['info'](_0xc4e336[_0x1e4c('0x27')],'\x20receiveFax\x20');}};Fax[_0x1e4c('0x20')][_0x1e4c('0x43')]=function(_0x498efd){if(this[_0x1e4c('0x11')][_0x498efd[_0x1e4c('0x27')]]){_['merge'](this[_0x1e4c('0x26')][_0x498efd[_0x1e4c('0x27')]],_[_0x1e4c('0x44')](_0x498efd,[_0x1e4c('0x45'),'reason']));}};function updateStatus(_0x498073){if(_0x498073[_0x1e4c('0x46')]){faxMessage[_0x1e4c('0x47')](_0x498073['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x661f9a){ut[_0x1e4c('0x48')](_0x1e4c('0x49'),_0x661f9a);})['catch'](function(_0x4bef49){ut[_0x1e4c('0x48')](_0x1e4c('0x4a'),_0x4bef49);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype']['updateStatus']=function(_0x3ff556,_0x54dc91,_0x36942e){var _0x531c4c=this;var _0x56af7b={};if(_0x54dc91){_0x56af7b={'read':_0x54dc91};}else{_0x56af7b={'failMessage':_0x36942e};}if(this[_0x1e4c('0x11')][_0x3ff556][_0x1e4c('0x46')]){faxMessage[_0x1e4c('0x47')](this[_0x1e4c('0x11')][_0x3ff556][_0x1e4c('0x46')],_0x56af7b)[_0x1e4c('0x3e')](function(_0x13d8d8){ut[_0x1e4c('0x48')](_0x1e4c('0x4b'),_0x13d8d8);})[_0x1e4c('0x4c')](function(_0x120316){ut['logger']('[Fax][Message][NoUpdate1]',_0x120316);})[_0x1e4c('0x4d')](function(){delete _0x531c4c[_0x1e4c('0x26')][_0x3ff556];delete _0x531c4c[_0x1e4c('0x11')][_0x3ff556];});}else{ut[_0x1e4c('0x48')](_0x1e4c('0x4e'));delete this[_0x1e4c('0x26')][_0x3ff556];delete this[_0x1e4c('0x11')][_0x3ff556];}};Fax[_0x1e4c('0x20')][_0x1e4c('0x1e')]=function(_0x58ae73){var _0x3d8a54=this;if(this['channels'][_0x58ae73[_0x1e4c('0x27')]]){if(this[_0x1e4c('0x11')][_0x58ae73['uniqueid']]){this['channels'][_0x58ae73[_0x1e4c('0x27')]]['id']=this[_0x1e4c('0x11')][_0x58ae73[_0x1e4c('0x27')]]['id'];this[_0x1e4c('0x26')][_0x58ae73[_0x1e4c('0x27')]][_0x1e4c('0x29')]=this[_0x1e4c('0x11')][_0x58ae73[_0x1e4c('0x27')]][_0x1e4c('0x29')];}logger[_0x1e4c('0x2b')](_0x58ae73[_0x1e4c('0x27')],this[_0x1e4c('0x11')][_0x58ae73[_0x1e4c('0x27')]]?_0x1e4c('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0x1e4c('0x41')](this[_0x1e4c('0x26')][_0x58ae73[_0x1e4c('0x27')]]));if(this['actions'][_0x58ae73[_0x1e4c('0x27')]]){if(this[_0x1e4c('0x26')][_0x58ae73[_0x1e4c('0x27')]][_0x1e4c('0x50')]>0x0&&this['channels'][_0x58ae73['uniqueid']][_0x1e4c('0x19')]===_0x1e4c('0x51')){this[_0x1e4c('0x52')](_0x58ae73[_0x1e4c('0x27')],!![]);}else{this[_0x1e4c('0x52')](_0x58ae73[_0x1e4c('0x27')],![],this[_0x1e4c('0x26')][_0x58ae73[_0x1e4c('0x27')]][_0x1e4c('0x53')]?_0x1e4c('0x54')+this[_0x1e4c('0x26')][_0x58ae73['uniqueid']][_0x1e4c('0x53')]:_0x1e4c('0x55'));}}}};Fax[_0x1e4c('0x20')][_0x1e4c('0x56')]=function(_0x3006bf){var _0xb165e9=this;return new BPromise(function(_0x24164e,_0x455e45){_0xb165e9['execOriginate'](_0x3006bf,_0xb165e9[_0x1e4c('0xf')][_0x3006bf[_0x1e4c('0x57')]])[_0x1e4c('0x3e')](function(_0x486e46){ut[_0x1e4c('0x48')](_0x1e4c('0x58'),_0x486e46);_0x24164e(ut[_0x1e4c('0x39')](_0x1e4c('0x59')));})[_0x1e4c('0x4c')](function(_0x3a2bc1){ut['logger'](_0x1e4c('0x5a'),_0x3a2bc1);updateStatus(_0x3006bf);_0x455e45(ut[_0x1e4c('0x39')](_0x1e4c('0x5b')));});});};Fax[_0x1e4c('0x20')][_0x1e4c('0x5c')]=function(_0x431919){var _0xe81bcb=this;return new BPromise(function(_0x3eac84,_0x339c40){var _0xec412=_0xe81bcb['checkTrunk'](_0xe81bcb[_0x1e4c('0xf')][_0x431919['FaxAccountId']][_0x1e4c('0x5d')],_0x431919);if(_0xec412[_0x1e4c('0x5e')]){_0x3eac84(ut[_0x1e4c('0x39')]('Trunk\x20Reachable'));}else{_0x339c40(ut[_0x1e4c('0x39')](_0xec412['message']));}});};function originate(_0x1bb467,_0x5dffd,_0x4087f6){return new BPromise(function(_0x5699d6,_0x40c350){if(_0x4087f6){var _0x2dd9f9=util[_0x1e4c('0x5f')](_0x1e4c('0x60'),path[_0x1e4c('0x3b')](_0x1bb467['path'])[_0x1e4c('0x29')],_0x1bb467[_0x1e4c('0x4')]);gs[_0x1e4c('0x61')](_0x2dd9f9)[_0x1e4c('0x3e')](function(){_0x1bb467['path']=util[_0x1e4c('0x5f')](_0x1e4c('0x62'),path[_0x1e4c('0x3b')](_0x1bb467[_0x1e4c('0x4')])[_0x1e4c('0x63')],path[_0x1e4c('0x3b')](_0x1bb467[_0x1e4c('0x4')])[_0x1e4c('0x29')]);_0x5dffd[_0x1e4c('0x64')]=_0x1bb467[_0x1e4c('0x4')];ut['logger'](_0x1e4c('0x65'),'');ami[_0x1e4c('0x66')](ut['variablesAction'](_0x1bb467,_0x5dffd))['then'](function(_0x3e00b2){_0x5699d6(_0x3e00b2);})[_0x1e4c('0x4c')](function(_0x30f7a6){_0x40c350(_0x30f7a6);});})[_0x1e4c('0x4c')](function(_0x301592){_0x40c350(_0x301592);});}else{ami[_0x1e4c('0x66')](ut[_0x1e4c('0x67')](_0x1bb467,_0x5dffd))['then'](function(_0x58c553){_0x5699d6(_0x58c553);})['catch'](function(_0x4fe009){_0x40c350(_0x4fe009);});}});}Fax['prototype'][_0x1e4c('0x68')]=function(_0x33b880,_0xcf20d6){var _0x35721c=this;return new BPromise(function(_0x5e5d9e,_0xdc254b){var _0x3af1d6=uuid['v4']();var _0x5464f5=ut[_0x1e4c('0x69')](_0x33b880,_0xcf20d6);_0x35721c[_0x1e4c('0x11')][_0x3af1d6]=new Action(_0x3af1d6,_0xcf20d6,_0x33b880);var _0x2abc9c=_0x35721c[_0x1e4c('0x11')][_0x3af1d6];if(path[_0x1e4c('0x3b')](_0x33b880[_0x1e4c('0x4')])[_0x1e4c('0x6a')]===_0x1e4c('0x3c')){originate(_0x2abc9c,_0x5464f5,!![])[_0x1e4c('0x3e')](function(_0x12def6){_0x5e5d9e(_0x12def6);})[_0x1e4c('0x4c')](function(_0x16e0e0){_0xdc254b(_0x16e0e0);});}else{originate(_0x2abc9c,_0x5464f5,![])[_0x1e4c('0x3e')](function(_0x1fc83){_0x5e5d9e(_0x1fc83);})['catch'](function(_0x17015c){_0xdc254b(_0x17015c);});}});};Fax[_0x1e4c('0x20')][_0x1e4c('0x6b')]=function(_0x35fdbc){return!_[_0x1e4c('0x6c')](_0x35fdbc)&&!_[_0x1e4c('0x6c')](_0x35fdbc[_0x1e4c('0x29')])&&!_[_0x1e4c('0x6c')](_0x35fdbc[_0x1e4c('0x6d')])&&_0x35fdbc[_0x1e4c('0x6d')]&&!_[_0x1e4c('0x6c')](this[_0x1e4c('0x10')][util[_0x1e4c('0x5f')](_0x1e4c('0x6e'),_0x35fdbc[_0x1e4c('0x29')])])&&!_['isNil'](this['trunks'][util['format'](_0x1e4c('0x6e'),_0x35fdbc[_0x1e4c('0x29')])][_0x1e4c('0x30')])&&(this[_0x1e4c('0x10')][util[_0x1e4c('0x5f')](_0x1e4c('0x6e'),_0x35fdbc[_0x1e4c('0x29')])][_0x1e4c('0x30')]===_0x1e4c('0x6f')||this[_0x1e4c('0x10')][util[_0x1e4c('0x5f')]('SIP/%s',_0x35fdbc[_0x1e4c('0x29')])]['status']==='unmonitored');};Fax[_0x1e4c('0x20')][_0x1e4c('0x70')]=function(_0xe2c307,_0x3b5407){if(!this[_0x1e4c('0x6b')](_0xe2c307)){ut[_0x1e4c('0x48')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x1e4c('0x6c')](_0xe2c307)?'':_0xe2c307[_0x1e4c('0x29')]+_0x1e4c('0x71'));return{'isValid':![],'message':_0x1e4c('0x72')};}if(_[_0x1e4c('0x6c')](_0x3b5407[_0x1e4c('0x7')])){ut[_0x1e4c('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x1e4c('0x41')](_0x3b5407));return{'isValid':![],'message':_0x1e4c('0x73')};}if(_[_0x1e4c('0x6c')](_0x3b5407[_0x1e4c('0x4')])){ut[_0x1e4c('0x48')](_0x1e4c('0x74'),JSON[_0x1e4c('0x41')](_0x3b5407));return{'isValid':![],'message':_0x1e4c('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x1e4c('0x76')]=Fax; \ No newline at end of file +var _0x54d8=['Fax\x20failed','checkAfterSend','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','./rpcDb','./channel','./action','../rpc/faxAccount','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','value','channelstate','channelstatedesc','variable','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]'];(function(_0x33ea2f,_0x405a7e){var _0x139800=function(_0x3dcd53){while(--_0x3dcd53){_0x33ea2f['push'](_0x33ea2f['shift']());}};_0x139800(++_0x405a7e);}(_0x54d8,0x1ec));var _0x854d=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x54d8[_0x178e48];return _0x440d7e;};'use strict';var util=require(_0x854d('0x0'));var _=require(_0x854d('0x1'));var BPromise=require(_0x854d('0x2'));var uuid=require(_0x854d('0x3'));var moment=require(_0x854d('0x4'));var path=require(_0x854d('0x5'));var tiff2pdf=require(_0x854d('0x6'));var gs=require('./util/gs');var logger=require(_0x854d('0x7'))(_0x854d('0x8'));var ami=require('../ami');var rpcDb=require(_0x854d('0x9'));var Channel=require(_0x854d('0xa'));var ut=require('./util/util');var Action=require(_0x854d('0xb'));var faxAccount=require(_0x854d('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x597144){this[_0x854d('0xd')]={};this[_0x854d('0xe')]=_0x597144['faxAccounts'];this[_0x854d('0xf')]=_0x597144['trunks'];this[_0x854d('0x10')]={};ami['on'](_0x854d('0x11'),this[_0x854d('0x12')]['bind'](this));ami['on']('varset',this[_0x854d('0x13')][_0x854d('0x14')](this));ami['on'](_0x854d('0x15'),this[_0x854d('0x16')][_0x854d('0x14')](this));ami['on'](_0x854d('0x17'),this[_0x854d('0x18')]['bind'](this));ami['on'](_0x854d('0x19'),this[_0x854d('0x1a')]['bind'](this));ami['on'](_0x854d('0x1b'),this[_0x854d('0x1c')][_0x854d('0x14')](this));ami['on'](_0x854d('0x1d'),this[_0x854d('0x1e')]['bind'](this));ami['on'](_0x854d('0x1f'),this[_0x854d('0x20')][_0x854d('0x14')](this));}Fax['prototype'][_0x854d('0x12')]=function(_0x2a40ca){if(_0x2a40ca['context']===_0x854d('0x21')){for(var _0x5878dc in this[_0x854d('0xe')]){if(this['faxAccounts'][_0x854d('0x22')](_0x5878dc)){if(_0x2a40ca['exten']===this[_0x854d('0xe')][_0x5878dc][_0x854d('0x23')]){this[_0x854d('0xd')][_0x2a40ca[_0x854d('0x24')]]={};this[_0x854d('0xd')][_0x2a40ca['uniqueid']]['channel']=_0x2a40ca[_0x854d('0x25')];this[_0x854d('0xd')][_0x2a40ca[_0x854d('0x24')]]['id']=this['faxAccounts'][_0x5878dc]['id'];this[_0x854d('0xd')][_0x2a40ca[_0x854d('0x24')]][_0x854d('0x26')]=this[_0x854d('0xe')][_0x5878dc]['name'];logger[_0x854d('0x27')](_0x2a40ca[_0x854d('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0x854d('0x10')][_0x2a40ca[_0x854d('0x24')]]){this[_0x854d('0xd')][_0x2a40ca[_0x854d('0x24')]]={};this[_0x854d('0xd')][_0x2a40ca['uniqueid']]['channel']=_0x2a40ca['channel'];logger[_0x854d('0x27')](_0x2a40ca['uniqueid'],_0x854d('0x28'));}};Fax[_0x854d('0x29')][_0x854d('0x13')]=function(_0x335c71){if(this[_0x854d('0xd')][_0x335c71[_0x854d('0x24')]]){for(var _0x3a5aa7 in _0x335c71['variable']){if(_0x335c71['variable']['hasOwnProperty'](_0x3a5aa7)){this['channels'][_0x335c71[_0x854d('0x24')]][_0x3a5aa7]=_0x335c71[_0x854d('0x2a')];}}}};Fax[_0x854d('0x29')][_0x854d('0x16')]=function(_0x4ec220){if(this[_0x854d('0xd')][_0x4ec220[_0x854d('0x24')]]){this['channels'][_0x4ec220['uniqueid']]['channelstate']=_0x4ec220[_0x854d('0x2b')];this[_0x854d('0xd')][_0x4ec220['uniqueid']]['channelstatedesc']=_0x4ec220[_0x854d('0x2c')];}};Fax[_0x854d('0x29')][_0x854d('0x18')]=function(_0x3b1229){if(this[_0x854d('0xd')][_0x3b1229[_0x854d('0x24')]]){for(var _0x4de937 in _0x3b1229[_0x854d('0x2d')]){if(_0x3b1229[_0x854d('0x2d')][_0x854d('0x22')](_0x4de937)){this[_0x854d('0xd')][_0x3b1229[_0x854d('0x24')]][_0x4de937]=_0x3b1229[_0x854d('0x2a')];}}}};Fax[_0x854d('0x29')][_0x854d('0x1a')]=function(_0x2f7432){if(this[_0x854d('0xd')][_0x2f7432[_0x854d('0x24')]]){this['channels'][_0x2f7432[_0x854d('0x24')]]['operation']=_0x2f7432[_0x854d('0x2e')];this[_0x854d('0xd')][_0x2f7432[_0x854d('0x24')]][_0x854d('0x2f')]=_0x2f7432[_0x854d('0x2f')];this[_0x854d('0xd')][_0x2f7432['uniqueid']][_0x854d('0x23')]=_0x2f7432['localstationid'];this[_0x854d('0xd')][_0x2f7432[_0x854d('0x24')]][_0x854d('0x30')]=_0x2f7432[_0x854d('0x30')];logger[_0x854d('0x27')](_0x2f7432[_0x854d('0x24')],_0x854d('0x31'));}};Fax[_0x854d('0x29')][_0x854d('0x1c')]=function(_0x501f35){var _0x292f43=this;if(this['channels'][_0x501f35[_0x854d('0x24')]]){var _0x181155=this[_0x854d('0xd')][_0x501f35['uniqueid']]['id'];this['channels'][_0x501f35[_0x854d('0x24')]][_0x854d('0x32')]=_0x501f35[_0x854d('0x32')];this[_0x854d('0xd')][_0x501f35['uniqueid']]['pagestransferred']=_0x501f35[_0x854d('0x33')];this[_0x854d('0xd')][_0x501f35[_0x854d('0x24')]][_0x854d('0x23')]=_0x501f35[_0x854d('0x23')];this[_0x854d('0xd')][_0x501f35[_0x854d('0x24')]][_0x854d('0x34')]=_0x501f35[_0x854d('0x34')];this[_0x854d('0xd')][_0x501f35['uniqueid']][_0x854d('0x35')]=_0x501f35[_0x854d('0x35')];this['channels'][_0x501f35[_0x854d('0x24')]][_0x854d('0x30')]=_0x501f35[_0x854d('0x30')];this[_0x854d('0xd')][_0x501f35[_0x854d('0x24')]][_0x854d('0x36')]=_0x501f35[_0x854d('0x36')];if(this[_0x854d('0xd')][_0x501f35[_0x854d('0x24')]][_0x854d('0x33')]>0x0){tiff2pdf(_0x501f35[_0x854d('0x30')],_0x854d('0x37'),function(_0x4f93cd){logger[_0x854d('0x27')](_0x501f35[_0x854d('0x24')],'\x20result\x20conversion\x20file\x20',_0x4f93cd[_0x854d('0x38')]);attachment['create']({'name':path[_0x854d('0x39')](_0x501f35[_0x854d('0x30')])[_0x854d('0x26')],'basename':path[_0x854d('0x39')](_0x501f35[_0x854d('0x30')])['name']+_0x854d('0x3a'),'type':_0x854d('0x3b')})[_0x854d('0x3c')](function(_0x2917dc){faxAccount[_0x854d('0x3d')](_0x181155,{'from':_0x501f35['calleridnum'],'mapKey':_0x854d('0x8'),'body':path[_0x854d('0x39')](_0x501f35[_0x854d('0x30')])[_0x854d('0x26')]+_0x854d('0x3a'),'AttachmentId':_0x2917dc['id']})[_0x854d('0x3e')](function(_0x2ca482){logger[_0x854d('0x3f')](_0x501f35['uniqueid'],_0x854d('0x40'),JSON[_0x854d('0x41')](_0x2ca482));});})[_0x854d('0x3e')](function(_0x223c82){logger[_0x854d('0x3f')](_0x501f35[_0x854d('0x24')],_0x854d('0x42'),JSON[_0x854d('0x41')](_0x223c82));});});}logger['info'](_0x501f35[_0x854d('0x24')],_0x854d('0x42'));}};Fax[_0x854d('0x29')][_0x854d('0x20')]=function(_0x3839a0){if(this[_0x854d('0x10')][_0x3839a0[_0x854d('0x24')]]){_[_0x854d('0x43')](this[_0x854d('0xd')][_0x3839a0[_0x854d('0x24')]],_[_0x854d('0x44')](_0x3839a0,[_0x854d('0x45'),_0x854d('0x46')]));}};function updateStatus(_0x3c56bd){if(_0x3c56bd[_0x854d('0x47')]){faxMessage[_0x854d('0x48')](_0x3c56bd[_0x854d('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x854d('0x3c')](function(_0xfe2c06){ut[_0x854d('0x49')](_0x854d('0x4a'),_0xfe2c06);})[_0x854d('0x3e')](function(_0x3791d2){ut[_0x854d('0x49')](_0x854d('0x4b'),_0x3791d2);});}else{ut[_0x854d('0x49')](_0x854d('0x4c'));}}Fax[_0x854d('0x29')]['updateStatus']=function(_0x33efdd,_0x262c34,_0x31602b){var _0x18b7a0=this;var _0x5b4bce={};if(_0x262c34){_0x5b4bce={'read':_0x262c34};}else{_0x5b4bce={'failMessage':_0x31602b};}if(this[_0x854d('0x10')][_0x33efdd][_0x854d('0x47')]){faxMessage[_0x854d('0x48')](this[_0x854d('0x10')][_0x33efdd][_0x854d('0x47')],_0x5b4bce)[_0x854d('0x3c')](function(_0x859193){ut[_0x854d('0x49')]('[Fax][Message][Updated]',_0x859193);})[_0x854d('0x3e')](function(_0xaa8268){ut[_0x854d('0x49')](_0x854d('0x4d'),_0xaa8268);})[_0x854d('0x4e')](function(){delete _0x18b7a0['channels'][_0x33efdd];delete _0x18b7a0[_0x854d('0x10')][_0x33efdd];});}else{ut[_0x854d('0x49')](_0x854d('0x4f'));delete this[_0x854d('0xd')][_0x33efdd];delete this[_0x854d('0x10')][_0x33efdd];}};Fax['prototype']['syncHangup']=function(_0x580995){var _0x5f2547=this;if(this['channels'][_0x580995[_0x854d('0x24')]]){if(this[_0x854d('0x10')][_0x580995[_0x854d('0x24')]]){this[_0x854d('0xd')][_0x580995[_0x854d('0x24')]]['id']=this[_0x854d('0x10')][_0x580995[_0x854d('0x24')]]['id'];this['channels'][_0x580995[_0x854d('0x24')]][_0x854d('0x26')]=this[_0x854d('0x10')][_0x580995['uniqueid']][_0x854d('0x26')];}logger[_0x854d('0x27')](_0x580995[_0x854d('0x24')],this['actions'][_0x580995[_0x854d('0x24')]]?_0x854d('0x50'):_0x854d('0x51'),JSON['stringify'](this[_0x854d('0xd')][_0x580995[_0x854d('0x24')]]));if(this[_0x854d('0x10')][_0x580995[_0x854d('0x24')]]){if(this['channels'][_0x580995[_0x854d('0x24')]][_0x854d('0x52')]>0x0&&this[_0x854d('0xd')][_0x580995['uniqueid']][_0x854d('0x19')]==='SUCCESS'){this[_0x854d('0x53')](_0x580995[_0x854d('0x24')],!![]);}else{this[_0x854d('0x53')](_0x580995[_0x854d('0x24')],![],this[_0x854d('0xd')][_0x580995[_0x854d('0x24')]]['faxstatusstring']?_0x854d('0x54')+this[_0x854d('0xd')][_0x580995[_0x854d('0x24')]][_0x854d('0x55')]:_0x854d('0x56'));}}}};Fax['prototype'][_0x854d('0x57')]=function(_0xe4983d){var _0x59d1d9=this;return new BPromise(function(_0x4619ce,_0x3f93d7){_0x59d1d9[_0x854d('0x58')](_0xe4983d,_0x59d1d9['faxAccounts'][_0xe4983d[_0x854d('0x59')]])['then'](function(_0x231466){ut[_0x854d('0x49')](_0x854d('0x5a'),_0x231466);_0x4619ce(ut[_0x854d('0x38')](_0x854d('0x5b')));})[_0x854d('0x3e')](function(_0x1c8c3b){ut[_0x854d('0x49')](_0x854d('0x5c'),_0x1c8c3b);updateStatus(_0xe4983d);_0x3f93d7(ut[_0x854d('0x38')](_0x854d('0x5d')));});});};Fax['prototype'][_0x854d('0x5e')]=function(_0x2185cb){var _0xde1071=this;return new BPromise(function(_0x10bbd4,_0x17f843){var _0x5f10c5=_0xde1071['checkTrunk'](_0xde1071[_0x854d('0xe')][_0x2185cb['FaxAccountId']][_0x854d('0x5f')],_0x2185cb);if(_0x5f10c5[_0x854d('0x60')]){_0x10bbd4(ut[_0x854d('0x38')]('Trunk\x20Reachable'));}else{_0x17f843(ut[_0x854d('0x38')](_0x5f10c5[_0x854d('0x38')]));}});};function originate(_0x49e0c6,_0x152c37,_0x4c7efa){return new BPromise(function(_0x1d2ed3,_0x241603){if(_0x4c7efa){var _0x2af8eb=util[_0x854d('0x61')](_0x854d('0x62'),path[_0x854d('0x39')](_0x49e0c6[_0x854d('0x5')])[_0x854d('0x26')],_0x49e0c6['path']);gs[_0x854d('0x63')](_0x2af8eb)[_0x854d('0x3c')](function(){_0x49e0c6['path']=util[_0x854d('0x61')]('%s/%s.tif',path[_0x854d('0x39')](_0x49e0c6[_0x854d('0x5')])[_0x854d('0x64')],path[_0x854d('0x39')](_0x49e0c6[_0x854d('0x5')])[_0x854d('0x26')]);_0x152c37[_0x854d('0x65')]=_0x49e0c6['path'];ut[_0x854d('0x49')](_0x854d('0x66'),'');ami[_0x854d('0x67')](ut[_0x854d('0x68')](_0x49e0c6,_0x152c37))[_0x854d('0x3c')](function(_0x1bb70b){_0x1d2ed3(_0x1bb70b);})['catch'](function(_0x122699){_0x241603(_0x122699);});})[_0x854d('0x3e')](function(_0x2db75c){_0x241603(_0x2db75c);});}else{ami[_0x854d('0x67')](ut[_0x854d('0x68')](_0x49e0c6,_0x152c37))['then'](function(_0x5b1667){_0x1d2ed3(_0x5b1667);})[_0x854d('0x3e')](function(_0x1f31de){_0x241603(_0x1f31de);});}});}Fax[_0x854d('0x29')][_0x854d('0x58')]=function(_0x2d3cc4,_0x451369){var _0x5142b5=this;return new BPromise(function(_0x2d42b5,_0x48327f){var _0x2b792d=uuid['v4']();var _0xf70f85=ut[_0x854d('0x69')](_0x2d3cc4,_0x451369);_0x5142b5['actions'][_0x2b792d]=new Action(_0x2b792d,_0x451369,_0x2d3cc4);var _0x4e126d=_0x5142b5[_0x854d('0x10')][_0x2b792d];if(path[_0x854d('0x39')](_0x2d3cc4[_0x854d('0x5')])['ext']===_0x854d('0x3a')){originate(_0x4e126d,_0xf70f85,!![])[_0x854d('0x3c')](function(_0x27384b){_0x2d42b5(_0x27384b);})[_0x854d('0x3e')](function(_0x4e6cd0){_0x48327f(_0x4e6cd0);});}else{originate(_0x4e126d,_0xf70f85,![])['then'](function(_0x4256ad){_0x2d42b5(_0x4256ad);})[_0x854d('0x3e')](function(_0x285e12){_0x48327f(_0x285e12);});}});};Fax['prototype'][_0x854d('0x6a')]=function(_0x704c4){return!_[_0x854d('0x6b')](_0x704c4)&&!_[_0x854d('0x6b')](_0x704c4['name'])&&!_[_0x854d('0x6b')](_0x704c4[_0x854d('0x6c')])&&_0x704c4[_0x854d('0x6c')]&&!_[_0x854d('0x6b')](this[_0x854d('0xf')][util['format'](_0x854d('0x6d'),_0x704c4[_0x854d('0x26')])])&&!_[_0x854d('0x6b')](this[_0x854d('0xf')][util[_0x854d('0x61')]('SIP/%s',_0x704c4[_0x854d('0x26')])][_0x854d('0x2f')])&&(this[_0x854d('0xf')][util['format'](_0x854d('0x6d'),_0x704c4[_0x854d('0x26')])][_0x854d('0x2f')]==='reachable'||this[_0x854d('0xf')][util[_0x854d('0x61')](_0x854d('0x6d'),_0x704c4[_0x854d('0x26')])][_0x854d('0x2f')]==='unmonitored');};Fax[_0x854d('0x29')][_0x854d('0x6e')]=function(_0x48e607,_0x429c42){if(!this[_0x854d('0x6a')](_0x48e607)){ut[_0x854d('0x49')](_0x854d('0x6f'),_[_0x854d('0x6b')](_0x48e607)?'':_0x48e607[_0x854d('0x26')]+_0x854d('0x70'));return{'isValid':![],'message':_0x854d('0x71')};}if(_[_0x854d('0x6b')](_0x429c42['fax'])){ut[_0x854d('0x49')](_0x854d('0x72'),JSON[_0x854d('0x41')](_0x429c42));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x854d('0x6b')](_0x429c42[_0x854d('0x5')])){ut[_0x854d('0x49')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x854d('0x41')](_0x429c42));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x854d('0x73')};};module[_0x854d('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 7fdfe50..49f46f6 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 _0x9cd6=['inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x9cd6,0x156));var _0x69cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cd6[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x69cd('0x0'));var BPromise=require(_0x69cd('0x1'));var logger=require(_0x69cd('0x2'))(_0x69cd('0x3'));var _=require('lodash');var faxAccount=require(_0x69cd('0x4'));function loggerCatch(_0x25b885){return function(_0x257690){logger[_0x69cd('0x5')](_0x25b885,util[_0x69cd('0x6')](_0x257690,{'showHidden':![],'depth':null}));};}exports[_0x69cd('0x7')]=function(_0x3d06ac,_0x4cc413){return BPromise[_0x69cd('0x8')]()[_0x69cd('0x9')](faxAccount[_0x69cd('0x7')](_0x3d06ac,_0x4cc413))[_0x69cd('0xa')](loggerCatch(_0x69cd('0xb')));}; \ No newline at end of file +var _0x12e5=['then','catch','[Notify]\x20','bluebird','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x12e5,0x92));var _0x512e=function(_0x4e4c7d,_0x34bfff){_0x4e4c7d=_0x4e4c7d-0x0;var _0x2f3a7c=_0x12e5[_0x4e4c7d];return _0x2f3a7c;};'use strict';var util=require('util');var BPromise=require(_0x512e('0x0'));var logger=require('../../../config/logger')(_0x512e('0x1'));var _=require(_0x512e('0x2'));var faxAccount=require(_0x512e('0x3'));function loggerCatch(_0x4efcfa){return function(_0x4cf551){logger[_0x512e('0x4')](_0x4efcfa,util[_0x512e('0x5')](_0x4cf551,{'showHidden':![],'depth':null}));};}exports[_0x512e('0x6')]=function(_0x266838,_0x511701){return BPromise[_0x512e('0x7')]()[_0x512e('0x8')](faxAccount['notify'](_0x266838,_0x511701))[_0x512e('0x9')](loggerCatch(_0x512e('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 3c3d28c..ab0e6ff 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 _0xe13b=['fax','bluebird','exec','execute','info','Exec\x20gs','inspect','util','../../../../config/logger'];(function(_0x1e1a55,_0x46c9f0){var _0x454435=function(_0x3a0ec0){while(--_0x3a0ec0){_0x1e1a55['push'](_0x1e1a55['shift']());}};_0x454435(++_0x46c9f0);}(_0xe13b,0xd6));var _0xbe13=function(_0x1de676,_0x409f75){_0x1de676=_0x1de676-0x0;var _0x4573be=_0xe13b[_0x1de676];return _0x4573be;};'use strict';var util=require(_0xbe13('0x0'));var logger=require(_0xbe13('0x1'))(_0xbe13('0x2'));var BPromise=require(_0xbe13('0x3'));var exec=require('child_process')[_0xbe13('0x4')];exports[_0xbe13('0x5')]=function(_0x588408){return new BPromise(function(_0x2b1b1b,_0x1d1ddd){exec(_0x588408,function(_0x4f6899,_0x26e935,_0x2951d1){logger[_0xbe13('0x6')](_0xbe13('0x7'),_0x26e935);if(_0x4f6899){logger[_0xbe13('0x6')](_0xbe13('0x7'),'\x20Error\x20:',util[_0xbe13('0x8')](_0x4f6899,{'showHidden':![],'depth':null}),_0x26e935,_0x2951d1);_0x1d1ddd(_0x4f6899);}_0x2b1b1b(_0x26e935);});});}; \ No newline at end of file +var _0x85a9=['execute','info','Exec\x20gs','\x20Error\x20:','util','fax','bluebird','exec'];(function(_0x4e23c0,_0x108adb){var _0x2731d8=function(_0x307fcf){while(--_0x307fcf){_0x4e23c0['push'](_0x4e23c0['shift']());}};_0x2731d8(++_0x108adb);}(_0x85a9,0xec));var _0x985a=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0x85a9[_0x118afa];return _0x167d76;};'use strict';var util=require(_0x985a('0x0'));var logger=require('../../../../config/logger')(_0x985a('0x1'));var BPromise=require(_0x985a('0x2'));var exec=require('child_process')[_0x985a('0x3')];exports[_0x985a('0x4')]=function(_0x9da326){return new BPromise(function(_0x345b3a,_0x296109){exec(_0x9da326,function(_0x1836f1,_0x4af267,_0x33d7f7){logger[_0x985a('0x5')](_0x985a('0x6'),_0x4af267);if(_0x1836f1){logger[_0x985a('0x5')](_0x985a('0x6'),_0x985a('0x7'),util['inspect'](_0x1836f1,{'showHidden':![],'depth':null}),_0x4af267,_0x33d7f7);_0x296109(_0x1836f1);}_0x345b3a(_0x4af267);});});}; \ 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 fe3d543..12079f4 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 _0xf89d=['originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','fax','message','logger','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','faxdetect','path','variablesAction','uniqueid'];(function(_0x501370,_0x471060){var _0x2b248d=function(_0x5d1bce){while(--_0x5d1bce){_0x501370['push'](_0x501370['shift']());}};_0x2b248d(++_0x471060);}(_0xf89d,0xe0));var _0xdf89=function(_0x1ef1ec,_0x1b46a8){_0x1ef1ec=_0x1ef1ec-0x0;var _0x40dcd0=_0xf89d[_0x1ef1ec];return _0x40dcd0;};'use strict';var util=require('util');var _=require(_0xdf89('0x0'));var moment=require(_0xdf89('0x1'));var logger=require('../../../../config/logger')(_0xdf89('0x2'));exports[_0xdf89('0x3')]=function(_0x415229){return{'message':_0x415229};};exports[_0xdf89('0x4')]=function(_0x3bb79e,_0x2ff918){logger['info'](_0x3bb79e,util[_0xdf89('0x5')](_0x2ff918,{'showHidden':![],'depth':null}));};exports[_0xdf89('0x6')]=function(_0xe7664a,_0x403a86){var _0x25452e={'XMF-ECM':_0x403a86[_0xdf89('0x7')],'XMF-HEADERINFO':_0x403a86[_0xdf89('0x8')],'XMF-MINRATE':_0x403a86[_0xdf89('0x9')],'XMF-MAXRATE':_0x403a86['maxrate'],'XMF-MODEM':util[_0xdf89('0xa')](_0xdf89('0xb'),_0x403a86['modem']),'XMF-GATEWAY':_0x403a86['gateway'],'XMF-FAXDETECT':_0x403a86[_0xdf89('0xc')],'XMF-T38TIMEOUT':_0x403a86['t38timeout'],'XMF-LOCALSTATIONID':_0x403a86['localstationid'],'XMF-PATH':_0xe7664a[_0xdf89('0xd')]};return _0x25452e;};exports[_0xdf89('0xe')]=function(_0x4d4455,_0x11c893){return{'actionid':_0x4d4455[_0xdf89('0xf')],'action':_0xdf89('0x10'),'channel':_0x4d4455['channel'],'Exten':_0xdf89('0x11'),'Context':_0xdf89('0x12'),'Priority':'1','callerid':util[_0xdf89('0xa')](_0xdf89('0x13'),_0x4d4455[_0xdf89('0x8')]?_0x4d4455[_0xdf89('0x8')]:'',_0x4d4455['localstationid']),'variable':_0x11c893,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4d4455[_0xdf89('0xf')]};}; \ No newline at end of file +var _0x0004=['moment','../../../../config/logger','fax','message','logger','ecm','maxrate','\x22%s\x22','gateway','t38timeout','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','headerinfo','localstationid','util','lodash'];(function(_0x15fdb5,_0x377c9){var _0xc01291=function(_0x5f4bb7){while(--_0x5f4bb7){_0x15fdb5['push'](_0x15fdb5['shift']());}};_0xc01291(++_0x377c9);}(_0x0004,0x166));var _0x4000=function(_0x5ab340,_0x3bf3e4){_0x5ab340=_0x5ab340-0x0;var _0x2ed5b7=_0x0004[_0x5ab340];return _0x2ed5b7;};'use strict';var util=require(_0x4000('0x0'));var _=require(_0x4000('0x1'));var moment=require(_0x4000('0x2'));var logger=require(_0x4000('0x3'))(_0x4000('0x4'));exports[_0x4000('0x5')]=function(_0x1bc45b){return{'message':_0x1bc45b};};exports[_0x4000('0x6')]=function(_0x2db122,_0x5413ab){logger['info'](_0x2db122,util['inspect'](_0x5413ab,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3cb4a1,_0x4c887f){var _0x4c58ae={'XMF-ECM':_0x4c887f[_0x4000('0x7')],'XMF-HEADERINFO':_0x4c887f['headerinfo'],'XMF-MINRATE':_0x4c887f['minrate'],'XMF-MAXRATE':_0x4c887f[_0x4000('0x8')],'XMF-MODEM':util['format'](_0x4000('0x9'),_0x4c887f['modem']),'XMF-GATEWAY':_0x4c887f[_0x4000('0xa')],'XMF-FAXDETECT':_0x4c887f['faxdetect'],'XMF-T38TIMEOUT':_0x4c887f[_0x4000('0xb')],'XMF-LOCALSTATIONID':_0x4c887f['localstationid'],'XMF-PATH':_0x3cb4a1[_0x4000('0xc')]};return _0x4c58ae;};exports['variablesAction']=function(_0x1f58c8,_0x3a5988){return{'actionid':_0x1f58c8[_0x4000('0xd')],'action':_0x4000('0xe'),'channel':_0x1f58c8[_0x4000('0xf')],'Exten':_0x4000('0x10'),'Context':_0x4000('0x11'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x1f58c8[_0x4000('0x12')]?_0x1f58c8[_0x4000('0x12')]:'',_0x1f58c8[_0x4000('0x13')]),'variable':_0x3a5988,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1f58c8['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index af2b3eb..90560c4 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 _0x51d8=['getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','get','hour','then','getAgents','getTelephones','initTelephones','getTrunks','initVoiceQueues','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initZohoAccounts'];(function(_0xe3f218,_0x2f5ed7){var _0x3c0a03=function(_0xc25f4c){while(--_0xc25f4c){_0xe3f218['push'](_0xe3f218['shift']());}};_0x3c0a03(++_0x2f5ed7);}(_0x51d8,0x89));var _0x851d=function(_0x3f5685,_0x1e4951){_0x3f5685=_0x3f5685-0x0;var _0xb0db99=_0x51d8[_0x3f5685];return _0xb0db99;};'use strict';var BPromise=require(_0x851d('0x0'));var util=require(_0x851d('0x1'));var moment=require(_0x851d('0x2'));var server=require(_0x851d('0x3'));var Realtime=require(_0x851d('0x4'));var Report=require(_0x851d('0x5'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x851d('0x6'));var Fax=require(_0x851d('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x851d('0x8'));var voiceQueueReport=require(_0x851d('0x9'));var voiceCallReport=require(_0x851d('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0x851d('0xb'));var template=require('./rpc/template');var cmHopperHistory=require(_0x851d('0xc'));var campaign=require(_0x851d('0xd'));var voiceExtension=require(_0x851d('0xe'));var faxAccount=require(_0x851d('0xf'));var zendesk=require(_0x851d('0x10'));var salesforce=require(_0x851d('0x11'));var sugarcrm=require(_0x851d('0x12'));var freshdesk=require(_0x851d('0x13'));var desk=require(_0x851d('0x14'));var zoho=require(_0x851d('0x15'));var vtiger=require(_0x851d('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x851d('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x851d('0x18')](_0x851d('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x851d('0x18')](_0x851d('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x851d('0x1a')](user[_0x851d('0x1b')]())[_0x851d('0x1a')](realtime['initAgents']())[_0x851d('0x1a')](user[_0x851d('0x1c')]())[_0x851d('0x1a')](realtime[_0x851d('0x1d')]())[_0x851d('0x1a')](trunk[_0x851d('0x1e')]())['then'](realtime['initTrunks']())['then'](voiceQueue['getVoiceQueues']())[_0x851d('0x1a')](realtime[_0x851d('0x1f')]())[_0x851d('0x1a')](trigger['getTriggers']())[_0x851d('0x1a')](realtime['initTriggers']())['then'](template['getTemplates']())[_0x851d('0x1a')](realtime[_0x851d('0x20')]())[_0x851d('0x1a')](zendesk[_0x851d('0x21')]())[_0x851d('0x1a')](realtime[_0x851d('0x22')]())[_0x851d('0x1a')](salesforce[_0x851d('0x23')]())[_0x851d('0x1a')](realtime['initSalesforceAccounts']())[_0x851d('0x1a')](sugarcrm[_0x851d('0x24')]())['then'](realtime['initSugarcrmAccounts']())[_0x851d('0x1a')](freshdesk[_0x851d('0x25')]())[_0x851d('0x1a')](realtime[_0x851d('0x26')]())[_0x851d('0x1a')](desk['getDeskAccounts']())[_0x851d('0x1a')](realtime['initDeskAccounts']())[_0x851d('0x1a')](zoho['getZohoAccounts']())[_0x851d('0x1a')](realtime[_0x851d('0x27')]())[_0x851d('0x1a')](vtiger[_0x851d('0x28')]())[_0x851d('0x1a')](realtime[_0x851d('0x29')]())[_0x851d('0x1a')](servicenow[_0x851d('0x2a')]())[_0x851d('0x1a')](realtime['initServicenowAccounts']())['then'](dynamics365['getDynamics365Accounts']())[_0x851d('0x1a')](realtime[_0x851d('0x2b')]())['then'](campaign['getCampaigns']())[_0x851d('0x1a')](realtime[_0x851d('0x2c')]())[_0x851d('0x1a')](voiceExtension[_0x851d('0x2d')]())[_0x851d('0x1a')](realtime[_0x851d('0x2e')]())[_0x851d('0x1a')](faxAccount['getFaxAccounts']())['then'](realtime[_0x851d('0x2f')]())[_0x851d('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0x851d('0x30')]()[_0x851d('0x1a')](voiceQueueReport[_0x851d('0x31')]())['then'](realtime[_0x851d('0x32')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x851d('0x1a')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x851d('0x33')]())[_0x851d('0x1a')](realtime[_0x851d('0x34')]())[_0x851d('0x1a')](voiceCallReport[_0x851d('0x35')]())[_0x851d('0x1a')](realtime[_0x851d('0x36')]())[_0x851d('0x1a')](function(_0x2f89f4){})[_0x851d('0x37')](function(_0x80c781){console[_0x851d('0x38')](_0x80c781);});}function main(){return server[_0x851d('0x39')](realtime,preview,fax)[_0x851d('0x1a')](function(_0x489c12){return initRealtime();})[_0x851d('0x1a')](function(){return initParams();})[_0x851d('0x1a')](function(){report[_0x851d('0x3a')]();setInterval(initRealtime,0x1388);})[_0x851d('0x37')](function(_0x466f81){console[_0x851d('0x38')](_0x466f81);});}main(); \ No newline at end of file +var _0x6fe3=['initVtigerAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','log','sync','catch','bluebird','util','moment','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./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','initAgents','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6fe3,0x8f));var _0x36fe=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x6fe3[_0x289e64];return _0x30246c;};'use strict';var BPromise=require(_0x36fe('0x0'));var util=require(_0x36fe('0x1'));var moment=require(_0x36fe('0x2'));var server=require('./server');var Realtime=require(_0x36fe('0x3'));var Report=require(_0x36fe('0x4'));var Acw=require('./acw');var Trigger=require(_0x36fe('0x5'));var Dialer=require(_0x36fe('0x6'));var Preview=require(_0x36fe('0x7'));var Fax=require(_0x36fe('0x8'));var user=require(_0x36fe('0x9'));var voiceQueue=require(_0x36fe('0xa'));var voiceQueueReport=require(_0x36fe('0xb'));var voiceCallReport=require(_0x36fe('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0x36fe('0xd'));var template=require(_0x36fe('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x36fe('0xf'));var voiceExtension=require(_0x36fe('0x10'));var faxAccount=require(_0x36fe('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x36fe('0x12'));var freshdesk=require(_0x36fe('0x13'));var desk=require(_0x36fe('0x14'));var zoho=require(_0x36fe('0x15'));var vtiger=require(_0x36fe('0x16'));var servicenow=require(_0x36fe('0x17'));var dynamics365=require(_0x36fe('0x18'));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()[_0x36fe('0x19')](_0x36fe('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x36fe('0x19')](_0x36fe('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x36fe('0x1b')]()[_0x36fe('0x1c')](user[_0x36fe('0x1d')]())[_0x36fe('0x1c')](realtime[_0x36fe('0x1e')]())[_0x36fe('0x1c')](user['getTelephones']())[_0x36fe('0x1c')](realtime[_0x36fe('0x1f')]())['then'](trunk[_0x36fe('0x20')]())[_0x36fe('0x1c')](realtime[_0x36fe('0x21')]())[_0x36fe('0x1c')](voiceQueue['getVoiceQueues']())[_0x36fe('0x1c')](realtime['initVoiceQueues']())[_0x36fe('0x1c')](trigger[_0x36fe('0x22')]())[_0x36fe('0x1c')](realtime[_0x36fe('0x23')]())['then'](template[_0x36fe('0x24')]())[_0x36fe('0x1c')](realtime[_0x36fe('0x25')]())[_0x36fe('0x1c')](zendesk[_0x36fe('0x26')]())[_0x36fe('0x1c')](realtime[_0x36fe('0x27')]())[_0x36fe('0x1c')](salesforce['getSalesforceAccounts']())[_0x36fe('0x1c')](realtime['initSalesforceAccounts']())[_0x36fe('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0x36fe('0x1c')](realtime[_0x36fe('0x28')]())['then'](freshdesk[_0x36fe('0x29')]())[_0x36fe('0x1c')](realtime[_0x36fe('0x2a')]())[_0x36fe('0x1c')](desk[_0x36fe('0x2b')]())[_0x36fe('0x1c')](realtime['initDeskAccounts']())[_0x36fe('0x1c')](zoho[_0x36fe('0x2c')]())['then'](realtime['initZohoAccounts']())[_0x36fe('0x1c')](vtiger[_0x36fe('0x2d')]())[_0x36fe('0x1c')](realtime[_0x36fe('0x2e')]())['then'](servicenow[_0x36fe('0x2f')]())[_0x36fe('0x1c')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x36fe('0x30')]())[_0x36fe('0x1c')](realtime[_0x36fe('0x31')]())['then'](campaign['getCampaigns']())['then'](realtime[_0x36fe('0x32')]())['then'](voiceExtension[_0x36fe('0x33')]())[_0x36fe('0x1c')](realtime['initVoiceExtensions']())[_0x36fe('0x1c')](faxAccount[_0x36fe('0x34')]())[_0x36fe('0x1c')](realtime[_0x36fe('0x35')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x36fe('0x1b')]()[_0x36fe('0x1c')](voiceQueueReport[_0x36fe('0x36')]())[_0x36fe('0x1c')](realtime[_0x36fe('0x37')]())['then'](cmHopperHistory[_0x36fe('0x38')]())[_0x36fe('0x1c')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x36fe('0x39')]())[_0x36fe('0x1c')](realtime[_0x36fe('0x3a')]())[_0x36fe('0x1c')](voiceCallReport[_0x36fe('0x3b')]())[_0x36fe('0x1c')](realtime['initVoiceCallReports']())[_0x36fe('0x1c')](function(_0x590670){})['catch'](function(_0x58e924){console[_0x36fe('0x3c')](_0x58e924);});}function main(){return server['listen'](realtime,preview,fax)[_0x36fe('0x1c')](function(_0x269063){return initRealtime();})[_0x36fe('0x1c')](function(){return initParams();})[_0x36fe('0x1c')](function(){report[_0x36fe('0x3d')]();setInterval(initRealtime,0x1388);})[_0x36fe('0x3e')](function(_0x27cadf){console[_0x36fe('0x3c')](_0x27cadf);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 2e66121..7a26778 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 _0x3647=['user:%s','emit','exports','moment','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','email','accountcode','fullname','unknown','status','mobile','online','voiceStatus','onhold','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','toNumber','stateTime','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','interface','stringify','md5','format'];(function(_0x5eb959,_0x27f32a){var _0x502558=function(_0x472abd){while(--_0x472abd){_0x5eb959['push'](_0x5eb959['shift']());}};_0x502558(++_0x27f32a);}(_0x3647,0x161));var _0x7364=function(_0x2f7f3c,_0x498da1){_0x2f7f3c=_0x2f7f3c-0x0;var _0x186f77=_0x3647[_0x2f7f3c];return _0x186f77;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7364('0x0'));var md5=require('md5');var Redis=require(_0x7364('0x1'));var config=require(_0x7364('0x2'));config['redis']=_[_0x7364('0x3')](config[_0x7364('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x7364('0x5'))(new Redis(config['redis']));function Agent(_0x5df079){this['id']=_0x5df079['id']||0x0;this[_0x7364('0x6')]=_0x5df079[_0x7364('0x6')]||'';this['email']=_0x5df079[_0x7364('0x7')]||'';this[_0x7364('0x8')]=_0x5df079[_0x7364('0x8')]||'';this[_0x7364('0x9')]=_0x5df079['fullname']||'';this['state']=_0x7364('0xa');this['stateTime']=0x0;this[_0x7364('0xb')]='unknown';this['address']='';this['phone']='';this[_0x7364('0xc')]='';this['interface']='';this[_0x7364('0xd')]=_0x5df079[_0x7364('0xd')]||![];this[_0x7364('0xe')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x7364('0xf')]=![];this['local']=![];this['md5']='';}Agent[_0x7364('0x10')][_0x7364('0x11')]=function(_0x167c34){var _0x2b265a;if(_0x167c34&&_0x167c34[_0x7364('0x12')]){_0x2b265a=_0x167c34['state'][_0x7364('0x13')]();switch(_0x2b265a){case _0x7364('0x14'):_0x2b265a=_0x7364('0x15');break;case _0x7364('0x16'):_0x2b265a='talking';break;}}if(_0x2b265a&&this['voiceStatus']!==_0x2b265a||_0x167c34['statePause']){this['voiceStatusTime']=_[_0x7364('0x17')](moment()['format']('x'));}if(_0x2b265a){this[_0x7364('0xe')]=_0x2b265a;}var _0xf0ae2d={'id':this['id'],'name':this[_0x7364('0x6')],'email':this[_0x7364('0x7')],'accountcode':this[_0x7364('0x8')],'fullname':this[_0x7364('0x9')],'state':this[_0x7364('0x12')],'stateTime':this[_0x7364('0x18')],'status':this[_0x7364('0xb')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x7364('0xe')],'voiceStatusTime':this[_0x7364('0x19')],'voiceStatusCallerIdNumber':this[_0x7364('0x1a')],'voiceStatusQueue':this[_0x7364('0x1b')],'interface':this[_0x7364('0x1c')],'onhold':this[_0x7364('0xf')]};var _0x38df10=md5(JSON[_0x7364('0x1d')](_0xf0ae2d));if(this[_0x7364('0x1e')]!==_0x38df10){this[_0x7364('0x1e')]=_0x38df10;io['to'](util[_0x7364('0x1f')](_0x7364('0x20'),_0xf0ae2d[_0x7364('0x6')]))[_0x7364('0x21')]('user:save',_0xf0ae2d);}};module[_0x7364('0x22')]=Agent; \ No newline at end of file +var _0xe49d=['toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','voiceStatusTime','toNumber','format','interface','user:%s','emit','user:save','exports','util','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype'];(function(_0x38a368,_0xcda100){var _0x98eb45=function(_0x4315f8){while(--_0x4315f8){_0x38a368['push'](_0x38a368['shift']());}};_0x98eb45(++_0xcda100);}(_0xe49d,0xd2));var _0xde49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe49d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xde49('0x0'));var moment=require('moment');var md5=require(_0xde49('0x1'));var Redis=require(_0xde49('0x2'));var config=require(_0xde49('0x3'));config[_0xde49('0x4')]=_[_0xde49('0x5')](config[_0xde49('0x4')],{'host':_0xde49('0x6'),'port':0x18eb});var io=require(_0xde49('0x7'))(new Redis(config[_0xde49('0x4')]));function Agent(_0x56e0ed){this['id']=_0x56e0ed['id']||0x0;this[_0xde49('0x8')]=_0x56e0ed[_0xde49('0x8')]||'';this[_0xde49('0x9')]=_0x56e0ed[_0xde49('0x9')]||'';this[_0xde49('0xa')]=_0x56e0ed['accountcode']||'';this[_0xde49('0xb')]=_0x56e0ed[_0xde49('0xb')]||'';this[_0xde49('0xc')]=_0xde49('0xd');this[_0xde49('0xe')]=0x0;this[_0xde49('0xf')]=_0xde49('0xd');this[_0xde49('0x10')]='';this[_0xde49('0x11')]='';this[_0xde49('0x12')]='';this['interface']='';this[_0xde49('0x13')]=_0x56e0ed[_0xde49('0x13')]||![];this['voiceStatus']=_0xde49('0xd');this['voiceStatusTime']=0x0;this[_0xde49('0x14')]='';this[_0xde49('0x15')]='';this[_0xde49('0x16')]=![];this['local']=![];this[_0xde49('0x1')]='';}Agent[_0xde49('0x17')]['updateStatusRealtime']=function(_0xf796a0){var _0x2c64a6;if(_0xf796a0&&_0xf796a0[_0xde49('0xc')]){_0x2c64a6=_0xf796a0[_0xde49('0xc')][_0xde49('0x18')]();switch(_0x2c64a6){case _0xde49('0x19'):_0x2c64a6=_0xde49('0x1a');break;case _0xde49('0x1b'):_0x2c64a6=_0xde49('0x1c');break;}}if(_0x2c64a6&&this[_0xde49('0x1d')]!==_0x2c64a6||_0xf796a0[_0xde49('0x1e')]){this[_0xde49('0x1f')]=_[_0xde49('0x20')](moment()[_0xde49('0x21')]('x'));}if(_0x2c64a6){this[_0xde49('0x1d')]=_0x2c64a6;}var _0x54f30c={'id':this['id'],'name':this[_0xde49('0x8')],'email':this[_0xde49('0x9')],'accountcode':this['accountcode'],'fullname':this[_0xde49('0xb')],'state':this[_0xde49('0xc')],'stateTime':this[_0xde49('0xe')],'status':this['status'],'address':this['address'],'online':this[_0xde49('0x13')],'voiceStatus':this[_0xde49('0x1d')],'voiceStatusTime':this[_0xde49('0x1f')],'voiceStatusCallerIdNumber':this[_0xde49('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xde49('0x22')],'onhold':this[_0xde49('0x16')]};var _0x482e34=md5(JSON['stringify'](_0x54f30c));if(this[_0xde49('0x1')]!==_0x482e34){this[_0xde49('0x1')]=_0x482e34;io['to'](util[_0xde49('0x21')](_0xde49('0x23'),_0x54f30c[_0xde49('0x8')]))[_0xde49('0x24')](_0xde49('0x25'),_0x54f30c);}};module[_0xde49('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index a29cc8d..62b56c8 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 _0x7d13=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x4b9218,_0x543224){var _0x178e79=function(_0x1be862){while(--_0x1be862){_0x4b9218['push'](_0x4b9218['shift']());}};_0x178e79(++_0x543224);}(_0x7d13,0x6c));var _0x37d1=function(_0x5e2d62,_0x1a042a){_0x5e2d62=_0x5e2d62-0x0;var _0x383a99=_0x7d13[_0x5e2d62];return _0x383a99;};'use strict';function Campaign(_0x155f88){this['id']=_0x155f88['id']||0x0;this[_0x37d1('0x0')]=_0x155f88['name']||'';this[_0x37d1('0x1')]=_0x155f88['type']||_0x37d1('0x2');this[_0x37d1('0x3')]=0x0;this[_0x37d1('0x4')]=0x0;this[_0x37d1('0x5')]=0x0;this[_0x37d1('0x6')]=0x0;this['message']='';this[_0x37d1('0x7')]=!![];this[_0x37d1('0x8')]=_0x155f88[_0x37d1('0x8')];this[_0x37d1('0x9')]=_0x155f88['limitCalls'];this[_0x37d1('0xa')]=_0x155f88[_0x37d1('0xa')]||null;this[_0x37d1('0xb')]=_0x155f88[_0x37d1('0xb')]?_0x155f88[_0x37d1('0xb')]:null;this[_0x37d1('0xc')]=_0x155f88[_0x37d1('0xc')];this['dialOriginateCallerIdNumber']=_0x155f88['dialOriginateCallerIdNumber'];this[_0x37d1('0xd')]=_0x155f88[_0x37d1('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x155f88[_0x37d1('0xe')];this[_0x37d1('0xf')]=_0x155f88[_0x37d1('0xf')];this[_0x37d1('0x10')]=_0x155f88[_0x37d1('0x10')];this[_0x37d1('0x11')]=_0x155f88[_0x37d1('0x11')];this[_0x37d1('0x12')]=_0x155f88['dialNoAnswerMaxRetry'];this[_0x37d1('0x13')]=_0x155f88[_0x37d1('0x13')];this['dialGlobalMaxRetry']=_0x155f88[_0x37d1('0x14')];this[_0x37d1('0x15')]=_0x155f88['dialOrderByScheduledAt']||_0x37d1('0x16');this[_0x37d1('0x17')]=_0x155f88['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x155f88[_0x37d1('0x18')]||undefined;this[_0x37d1('0x19')]=_0x155f88[_0x37d1('0x19')]||undefined;this['TrunkBackup']=_0x155f88[_0x37d1('0x1a')]?_0x155f88[_0x37d1('0x1a')]:undefined;this[_0x37d1('0x1b')]=_0x155f88['Trunk']?_0x155f88[_0x37d1('0x1b')]:undefined;this[_0x37d1('0x1c')]=_0x155f88['Interval']?_0x155f88[_0x37d1('0x1c')]:undefined;this[_0x37d1('0x1d')]=_0x155f88[_0x37d1('0x1d')]?_0x155f88[_0x37d1('0x1d')]:undefined;this[_0x37d1('0x1e')]=_0x155f88[_0x37d1('0x1d')]?_0x155f88[_0x37d1('0x1d')][_0x37d1('0x0')]:undefined;this['dialAMDActive']=_0x155f88[_0x37d1('0x1f')]||![];this[_0x37d1('0x20')]=_0x155f88[_0x37d1('0x20')];this[_0x37d1('0x21')]=_0x155f88['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x155f88[_0x37d1('0x22')];this[_0x37d1('0x23')]=_0x155f88[_0x37d1('0x23')];this[_0x37d1('0x24')]=_0x155f88[_0x37d1('0x24')];this[_0x37d1('0x25')]=_0x155f88[_0x37d1('0x25')];this[_0x37d1('0x26')]=_0x155f88[_0x37d1('0x26')];this[_0x37d1('0x27')]=_0x155f88[_0x37d1('0x27')];this['dialAMDMaximumWordLength']=_0x155f88[_0x37d1('0x28')];}module[_0x37d1('0x29')]=Campaign; \ No newline at end of file +var _0xe205=['Interval','SquareProject','dialQueueProject','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk'];(function(_0x108b03,_0x3c487d){var _0xd65f5c=function(_0x18f54f){while(--_0x18f54f){_0x108b03['push'](_0x108b03['shift']());}};_0xd65f5c(++_0x3c487d);}(_0xe205,0xa7));var _0x5e20=function(_0x4d6d5d,_0x2d00c8){_0x4d6d5d=_0x4d6d5d-0x0;var _0x5ee7c0=_0xe205[_0x4d6d5d];return _0x5ee7c0;};'use strict';function Campaign(_0x289a5c){this['id']=_0x289a5c['id']||0x0;this[_0x5e20('0x0')]=_0x289a5c[_0x5e20('0x0')]||'';this[_0x5e20('0x1')]=_0x289a5c[_0x5e20('0x1')]||_0x5e20('0x2');this[_0x5e20('0x3')]=0x0;this[_0x5e20('0x4')]=0x0;this[_0x5e20('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x5e20('0x6')]='';this[_0x5e20('0x7')]=!![];this[_0x5e20('0x8')]=_0x289a5c[_0x5e20('0x8')];this['limitCalls']=_0x289a5c['limitCalls'];this[_0x5e20('0x9')]=_0x289a5c['dialTimezone']||null;this['dialGlobalInterval']=_0x289a5c[_0x5e20('0xa')]?_0x289a5c[_0x5e20('0xa')]:null;this['dialOriginateCallerIdName']=_0x289a5c[_0x5e20('0xb')];this[_0x5e20('0xc')]=_0x289a5c[_0x5e20('0xc')];this[_0x5e20('0xd')]=_0x289a5c['dialOriginateTimeout']||0x1e;this[_0x5e20('0xe')]=_0x289a5c[_0x5e20('0xe')];this[_0x5e20('0xf')]=_0x289a5c[_0x5e20('0xf')];this[_0x5e20('0x10')]=_0x289a5c[_0x5e20('0x10')];this['dialBusyRetryFrequency']=_0x289a5c[_0x5e20('0x11')];this[_0x5e20('0x12')]=_0x289a5c[_0x5e20('0x12')];this['dialNoAnswerRetryFrequency']=_0x289a5c[_0x5e20('0x13')];this['dialGlobalMaxRetry']=_0x289a5c[_0x5e20('0x14')];this['dialOrderByScheduledAt']=_0x289a5c[_0x5e20('0x15')]||_0x5e20('0x16');this[_0x5e20('0x17')]=_0x289a5c[_0x5e20('0x17')]||undefined;this[_0x5e20('0x18')]=_0x289a5c['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x5e20('0x19')]=_0x289a5c[_0x5e20('0x19')]||undefined;this[_0x5e20('0x1a')]=_0x289a5c[_0x5e20('0x1a')]?_0x289a5c[_0x5e20('0x1a')]:undefined;this[_0x5e20('0x1b')]=_0x289a5c[_0x5e20('0x1b')]?_0x289a5c[_0x5e20('0x1b')]:undefined;this['Interval']=_0x289a5c[_0x5e20('0x1c')]?_0x289a5c[_0x5e20('0x1c')]:undefined;this['SquareProject']=_0x289a5c[_0x5e20('0x1d')]?_0x289a5c[_0x5e20('0x1d')]:undefined;this[_0x5e20('0x1e')]=_0x289a5c[_0x5e20('0x1d')]?_0x289a5c['SquareProject'][_0x5e20('0x0')]:undefined;this['dialAMDActive']=_0x289a5c['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x289a5c['dialAMDInitialSilence'];this[_0x5e20('0x1f')]=_0x289a5c['dialAMDGreeting'];this[_0x5e20('0x20')]=_0x289a5c[_0x5e20('0x20')];this[_0x5e20('0x21')]=_0x289a5c[_0x5e20('0x21')];this[_0x5e20('0x22')]=_0x289a5c[_0x5e20('0x22')];this['dialAMDBetweenWordsSilence']=_0x289a5c[_0x5e20('0x23')];this['dialAMDMaximumNumberOfWords']=_0x289a5c['dialAMDMaximumNumberOfWords'];this[_0x5e20('0x24')]=_0x289a5c[_0x5e20('0x24')];this[_0x5e20('0x25')]=_0x289a5c[_0x5e20('0x25')];}module[_0x5e20('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 a3b3274..df90235 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 _0x00b3=['context','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','monitor','monitorFilename','monitors','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode'];(function(_0x40c9bc,_0x6eb340){var _0x3acedf=function(_0x1c8532){while(--_0x1c8532){_0x40c9bc['push'](_0x40c9bc['shift']());}};_0x3acedf(++_0x6eb340);}(_0x00b3,0x157));var _0x300b=function(_0x314cff,_0x20a36a){_0x314cff=_0x314cff-0x0;var _0xb50bc5=_0x00b3[_0x314cff];return _0xb50bc5;};'use strict';function Channel(){this[_0x300b('0x0')]=null;this[_0x300b('0x1')]='';this[_0x300b('0x2')]='';this[_0x300b('0x3')]=0x0;this[_0x300b('0x4')]='';this[_0x300b('0x5')]=undefined;this['connectedlinename']=undefined;this[_0x300b('0x6')]=0x0;this[_0x300b('0x7')]='';this['uniqueid']=0x0;this[_0x300b('0x8')]=0x0;this['exten']=0x0;this[_0x300b('0x9')]=![];this[_0x300b('0xa')]=null;this[_0x300b('0xb')]=null;this[_0x300b('0xc')]=![];this[_0x300b('0xd')]=![];this['lastapplication']='';this[_0x300b('0xe')]='';this[_0x300b('0xf')]=0x0;this[_0x300b('0x10')]=0x0;this[_0x300b('0x11')]=0x0;this[_0x300b('0x12')]=null;this['tag']=null;this['disposition']=null;this[_0x300b('0x13')]=![];this[_0x300b('0x14')]=null;this['queue']=null;this[_0x300b('0x15')]=[];this[_0x300b('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x300b('0x17')]=0x0;}module[_0x300b('0x18')]=Channel; \ No newline at end of file +var _0xd052=['destinationchannel','calleridname','accountcode','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','monitorFilename','queue','monitors','transfercalleridnum','mohtime'];(function(_0x16468f,_0x53b313){var _0x432d5d=function(_0x4bdee0){while(--_0x4bdee0){_0x16468f['push'](_0x16468f['shift']());}};_0x432d5d(++_0x53b313);}(_0xd052,0x69));var _0x2d05=function(_0x1a15f9,_0x124b61){_0x1a15f9=_0x1a15f9-0x0;var _0x59b4d1=_0xd052[_0x1a15f9];return _0x59b4d1;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x2d05('0x0')]='';this['calleridnum']=0x0;this[_0x2d05('0x1')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x2d05('0x2')]=0x0;this['context']='';this[_0x2d05('0x3')]=0x0;this[_0x2d05('0x4')]=0x0;this['exten']=0x0;this[_0x2d05('0x5')]=![];this[_0x2d05('0x6')]=null;this[_0x2d05('0x7')]=null;this[_0x2d05('0x8')]=![];this[_0x2d05('0x9')]=![];this[_0x2d05('0xa')]='';this[_0x2d05('0xb')]='';this[_0x2d05('0xc')]=0x0;this[_0x2d05('0xd')]=0x0;this[_0x2d05('0xe')]=0x0;this[_0x2d05('0xf')]=null;this['tag']=null;this['disposition']=null;this['monitor']=![];this[_0x2d05('0x10')]=null;this[_0x2d05('0x11')]=null;this[_0x2d05('0x12')]=[];this[_0x2d05('0x13')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x2d05('0x14')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d66a863..10c81c0 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 _0xb382=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','type'];(function(_0xd440a9,_0x120579){var _0xc160e5=function(_0x576da0){while(--_0x576da0){_0xd440a9['push'](_0xd440a9['shift']());}};_0xc160e5(++_0x120579);}(_0xb382,0x87));var _0x2b38=function(_0x43be4d,_0x374dc2){_0x43be4d=_0x43be4d-0x0;var _0xc6b0cf=_0xb382[_0x43be4d];return _0xc6b0cf;};'use strict';function DeskAccount(_0x14f0f4){this['id']=_0x14f0f4['id']||0x0;this[_0x2b38('0x0')]=_0x14f0f4[_0x2b38('0x0')]||'';this[_0x2b38('0x1')]=_0x14f0f4[_0x2b38('0x1')]||'';this[_0x2b38('0x2')]=_0x14f0f4['remoteUri']||'';this[_0x2b38('0x3')]=_0x14f0f4[_0x2b38('0x3')]||'';this['password']=_0x14f0f4[_0x2b38('0x4')]||'';this['consumerKey']=_0x14f0f4[_0x2b38('0x5')]||'';this[_0x2b38('0x6')]=_0x14f0f4[_0x2b38('0x6')]||'';this['token']=_0x14f0f4[_0x2b38('0x7')]||'';this['tokenSecret']=_0x14f0f4['tokenSecret']||'';this[_0x2b38('0x8')]=_0x14f0f4[_0x2b38('0x8')]||'';this[_0x2b38('0x9')]=_0x14f0f4[_0x2b38('0x9')]||'';this[_0x2b38('0xa')]=_0x14f0f4[_0x2b38('0xa')]||{};}module[_0x2b38('0xb')]=DeskAccount; \ No newline at end of file +var _0x46b0=['exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x3af7b7,_0x208014){var _0x8408b5=function(_0x22161d){while(--_0x22161d){_0x3af7b7['push'](_0x3af7b7['shift']());}};_0x8408b5(++_0x208014);}(_0x46b0,0x76));var _0x046b=function(_0x4ff86c,_0x3ae599){_0x4ff86c=_0x4ff86c-0x0;var _0x189586=_0x46b0[_0x4ff86c];return _0x189586;};'use strict';function DeskAccount(_0x4cf479){this['id']=_0x4cf479['id']||0x0;this[_0x046b('0x0')]=_0x4cf479[_0x046b('0x0')]||'';this[_0x046b('0x1')]=_0x4cf479[_0x046b('0x1')]||'';this[_0x046b('0x2')]=_0x4cf479[_0x046b('0x2')]||'';this[_0x046b('0x3')]=_0x4cf479['authType']||'';this[_0x046b('0x4')]=_0x4cf479[_0x046b('0x4')]||'';this['consumerKey']=_0x4cf479[_0x046b('0x5')]||'';this[_0x046b('0x6')]=_0x4cf479[_0x046b('0x6')]||'';this['token']=_0x4cf479[_0x046b('0x7')]||'';this[_0x046b('0x8')]=_0x4cf479[_0x046b('0x8')]||'';this[_0x046b('0x9')]=_0x4cf479['type']||'';this[_0x046b('0xa')]=_0x4cf479['serverUrl']||'';this[_0x046b('0xb')]=_0x4cf479[_0x046b('0xb')]||{};}module[_0x046b('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 2d92091..941c12d 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 _0xa660=['name','username','password','remoteUri','tenantId','clientSecret','serverUrl','exports'];(function(_0x595d29,_0x3cab2a){var _0x254cdf=function(_0x2f3b9c){while(--_0x2f3b9c){_0x595d29['push'](_0x595d29['shift']());}};_0x254cdf(++_0x3cab2a);}(_0xa660,0x130));var _0x0a66=function(_0x530760,_0x5cc009){_0x530760=_0x530760-0x0;var _0x376e6e=_0xa660[_0x530760];return _0x376e6e;};'use strict';function Dynamics365Account(_0x3c75d9){this['id']=_0x3c75d9['id']||0x0;this[_0x0a66('0x0')]=_0x3c75d9['name']||'';this[_0x0a66('0x1')]=_0x3c75d9[_0x0a66('0x1')]||'';this[_0x0a66('0x2')]=_0x3c75d9['password']||'';this[_0x0a66('0x3')]=_0x3c75d9[_0x0a66('0x3')]||'';this[_0x0a66('0x4')]=_0x3c75d9[_0x0a66('0x4')]||'';this['clientId']=_0x3c75d9['clientId']||'';this[_0x0a66('0x5')]=_0x3c75d9[_0x0a66('0x5')]||{};this['serverUrl']=_0x3c75d9[_0x0a66('0x6')]||'';this['Configurations']=_0x3c75d9['Configurations']||{};}module[_0x0a66('0x7')]=Dynamics365Account; \ No newline at end of file +var _0x03d1=['username','password','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name'];(function(_0x3474fc,_0x4ad4c1){var _0x509e51=function(_0x1fca90){while(--_0x1fca90){_0x3474fc['push'](_0x3474fc['shift']());}};_0x509e51(++_0x4ad4c1);}(_0x03d1,0x1c1));var _0x103d=function(_0x14c0f8,_0x564869){_0x14c0f8=_0x14c0f8-0x0;var _0x4d9346=_0x03d1[_0x14c0f8];return _0x4d9346;};'use strict';function Dynamics365Account(_0x1f2976){this['id']=_0x1f2976['id']||0x0;this[_0x103d('0x0')]=_0x1f2976[_0x103d('0x0')]||'';this[_0x103d('0x1')]=_0x1f2976[_0x103d('0x1')]||'';this[_0x103d('0x2')]=_0x1f2976['password']||'';this['remoteUri']=_0x1f2976['remoteUri']||'';this[_0x103d('0x3')]=_0x1f2976[_0x103d('0x3')]||'';this[_0x103d('0x4')]=_0x1f2976[_0x103d('0x4')]||'';this[_0x103d('0x5')]=_0x1f2976[_0x103d('0x5')]||{};this[_0x103d('0x6')]=_0x1f2976[_0x103d('0x6')]||'';this['Configurations']=_0x1f2976[_0x103d('0x7')]||{};}module[_0x103d('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 7813d73..a633a45 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 _0xb7e7=['key','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x16f190,_0x51b226){var _0x7879cb=function(_0x316b16){while(--_0x316b16){_0x16f190['push'](_0x16f190['shift']());}};_0x7879cb(++_0x51b226);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'use strict';function FaxAccount(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['description']=_0x2e5e07[_0x7b7e('0x1')];this['ecm']=_0x2e5e07[_0x7b7e('0x2')];this['headerinfo']=_0x2e5e07[_0x7b7e('0x3')];this[_0x7b7e('0x4')]=_0x2e5e07[_0x7b7e('0x4')];this['minrate']=_0x2e5e07['minrate']||0x960;this[_0x7b7e('0x5')]=_0x2e5e07[_0x7b7e('0x5')]||0x3840;this[_0x7b7e('0x6')]=_0x2e5e07['modem']||_0x7b7e('0x7');this[_0x7b7e('0x8')]=_0x2e5e07[_0x7b7e('0x8')]||'no';this[_0x7b7e('0x9')]=_0x2e5e07[_0x7b7e('0x9')]||'no';this[_0x7b7e('0xa')]=_0x2e5e07[_0x7b7e('0xa')]||0x1388;this['tech']=_0x2e5e07[_0x7b7e('0xb')]||_0x7b7e('0xc');this[_0x7b7e('0xd')]=_0x2e5e07[_0x7b7e('0xd')]?_0x2e5e07[_0x7b7e('0xd')]:undefined;this[_0x7b7e('0xe')]=_0x2e5e07[_0x7b7e('0xe')];this[_0x7b7e('0xf')]=_0x2e5e07[_0x7b7e('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xb7e7=['key','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0xf6bf87,_0x10c5ab){var _0x58381f=function(_0x47b560){while(--_0x47b560){_0xf6bf87['push'](_0xf6bf87['shift']());}};_0x58381f(++_0x10c5ab);}(_0xb7e7,0x121));var _0x7b7e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb7e7[_0x465028];return _0xb783d4;};'use strict';function FaxAccount(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['description']=_0x2e5e07[_0x7b7e('0x1')];this['ecm']=_0x2e5e07[_0x7b7e('0x2')];this['headerinfo']=_0x2e5e07[_0x7b7e('0x3')];this[_0x7b7e('0x4')]=_0x2e5e07[_0x7b7e('0x4')];this['minrate']=_0x2e5e07['minrate']||0x960;this[_0x7b7e('0x5')]=_0x2e5e07[_0x7b7e('0x5')]||0x3840;this[_0x7b7e('0x6')]=_0x2e5e07['modem']||_0x7b7e('0x7');this[_0x7b7e('0x8')]=_0x2e5e07[_0x7b7e('0x8')]||'no';this[_0x7b7e('0x9')]=_0x2e5e07[_0x7b7e('0x9')]||'no';this[_0x7b7e('0xa')]=_0x2e5e07[_0x7b7e('0xa')]||0x1388;this['tech']=_0x2e5e07[_0x7b7e('0xb')]||_0x7b7e('0xc');this[_0x7b7e('0xd')]=_0x2e5e07[_0x7b7e('0xd')]?_0x2e5e07[_0x7b7e('0xd')]:undefined;this[_0x7b7e('0xe')]=_0x2e5e07[_0x7b7e('0xe')];this[_0x7b7e('0xf')]=_0x2e5e07[_0x7b7e('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 39dd00b..6226dc8 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 _0xa29b=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0xa29b,0xcd));var _0xba29=function(_0x118e16,_0x2a6f97){_0x118e16=_0x118e16-0x0;var _0x9f7b89=_0xa29b[_0x118e16];return _0x9f7b89;};'use strict';function FreshdeskAccount(_0x3014b2){this['id']=_0x3014b2['id']||0x0;this[_0xba29('0x0')]=_0x3014b2[_0xba29('0x0')]||'';this[_0xba29('0x1')]=_0x3014b2['username']||'';this[_0xba29('0x2')]=_0x3014b2[_0xba29('0x3')]||'';this[_0xba29('0x4')]=_0x3014b2[_0xba29('0x4')]||'';this[_0xba29('0x5')]=_0x3014b2[_0xba29('0x5')]||'';this[_0xba29('0x6')]=_0x3014b2[_0xba29('0x6')]||{};}module[_0xba29('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xb5a8=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb5a8,0x177));var _0x8b5a=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xb5a8[_0x411add];return _0x238242;};'use strict';function FreshdeskAccount(_0x41ac99){this['id']=_0x41ac99['id']||0x0;this[_0x8b5a('0x0')]=_0x41ac99[_0x8b5a('0x0')]||'';this[_0x8b5a('0x1')]=_0x41ac99[_0x8b5a('0x1')]||'';this[_0x8b5a('0x2')]=_0x41ac99[_0x8b5a('0x3')]||'';this[_0x8b5a('0x4')]=_0x41ac99['remoteUri']||'';this[_0x8b5a('0x5')]=_0x41ac99[_0x8b5a('0x5')]||'';this[_0x8b5a('0x6')]=_0x41ac99['Configurations']||{};}module[_0x8b5a('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index e94db98..de844a0 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 _0xba01=['type','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables'];(function(_0x311a60,_0x22da19){var _0xf8d10=function(_0x3905c2){while(--_0x3905c2){_0x311a60['push'](_0x311a60['shift']());}};_0xf8d10(++_0x22da19);}(_0xba01,0x9a));var _0x1ba0=function(_0x89dad3,_0x660f0){_0x89dad3=_0x89dad3-0x0;var _0x9913b1=_0xba01[_0x89dad3];return _0x9913b1;};'use strict';function QueueReport(){this[_0x1ba0('0x0')]='inbound';this[_0x1ba0('0x1')]='';this['calleridnum']='';this[_0x1ba0('0x2')]='';this[_0x1ba0('0x3')]='';this[_0x1ba0('0x4')]=null;this[_0x1ba0('0x5')]=null;this[_0x1ba0('0x6')]=0x1;this['count']=0x1;this[_0x1ba0('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x1ba0('0x8')]=![];this[_0x1ba0('0x9')]=null;this[_0x1ba0('0xa')]=![];this[_0x1ba0('0xb')]=null;this[_0x1ba0('0xc')]=0x1;this[_0x1ba0('0xd')]='';this['connectedlinenum']='';this[_0x1ba0('0xe')]='';this['accountcode']='';this['context']='';this[_0x1ba0('0xf')]='';this[_0x1ba0('0x10')]='';this[_0x1ba0('0x11')]=0x0;this[_0x1ba0('0x12')]=![];this[_0x1ba0('0x13')]='';this[_0x1ba0('0x14')]=0x0;this[_0x1ba0('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x0220=['type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','mohtime','exports'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0x0220,0x18f));var _0x0022=function(_0x900a8d,_0x1f009a){_0x900a8d=_0x900a8d-0x0;var _0x5b80fc=_0x0220[_0x900a8d];return _0x5b80fc;};'use strict';function QueueReport(){this[_0x0022('0x0')]=_0x0022('0x1');this[_0x0022('0x2')]='';this['calleridnum']='';this[_0x0022('0x3')]='';this[_0x0022('0x4')]='';this[_0x0022('0x5')]=null;this[_0x0022('0x6')]=null;this['position']=0x1;this['count']=0x1;this[_0x0022('0x7')]=![];this[_0x0022('0x8')]=null;this[_0x0022('0x9')]=![];this[_0x0022('0xa')]=null;this[_0x0022('0xb')]=![];this[_0x0022('0xc')]=null;this['originalposition']=0x1;this['channel']='';this[_0x0022('0xd')]='';this[_0x0022('0xe')]='';this[_0x0022('0xf')]='';this[_0x0022('0x10')]='';this[_0x0022('0x11')]='';this['priority']='';this[_0x0022('0x12')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x0022('0x13')]=0x0;this['variables']={};}module[_0x0022('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 49ac29f..03fcfa3 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 _0x6ead=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x534357,_0x47e71c){var _0x1196f8=function(_0xc2dc69){while(--_0xc2dc69){_0x534357['push'](_0x534357['shift']());}};_0x1196f8(++_0x47e71c);}(_0x6ead,0x7c));var _0xd6ea=function(_0x446a00,_0x148162){_0x446a00=_0x446a00-0x0;var _0x5b4922=_0x6ead[_0x446a00];return _0x5b4922;};'use strict';function SalesforceAccount(_0x2ac4d2){this['id']=_0x2ac4d2['id']||0x0;this[_0xd6ea('0x0')]=_0x2ac4d2['name']||'';this[_0xd6ea('0x1')]=_0x2ac4d2[_0xd6ea('0x1')]||'';this[_0xd6ea('0x2')]=_0x2ac4d2['remoteUri']||'';this[_0xd6ea('0x3')]=_0x2ac4d2[_0xd6ea('0x3')]||'';this[_0xd6ea('0x4')]=_0x2ac4d2[_0xd6ea('0x4')]||'';this[_0xd6ea('0x5')]=_0x2ac4d2[_0xd6ea('0x5')]||'';this['securityToken']=_0x2ac4d2[_0xd6ea('0x6')]||'';this[_0xd6ea('0x7')]=_0x2ac4d2[_0xd6ea('0x7')]||_0xd6ea('0x8');this[_0xd6ea('0x9')]=_0x2ac4d2[_0xd6ea('0x9')]||'';this[_0xd6ea('0xa')]=_0x2ac4d2[_0xd6ea('0xa')]||{};}module[_0xd6ea('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x3369=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x503103,_0x54af60){var _0x4ef8f3=function(_0x213e3d){while(--_0x213e3d){_0x503103['push'](_0x503103['shift']());}};_0x4ef8f3(++_0x54af60);}(_0x3369,0x1a5));var _0x9336=function(_0x3cfd5d,_0x5a35d3){_0x3cfd5d=_0x3cfd5d-0x0;var _0x1ffc55=_0x3369[_0x3cfd5d];return _0x1ffc55;};'use strict';function SalesforceAccount(_0x467a1e){this['id']=_0x467a1e['id']||0x0;this[_0x9336('0x0')]=_0x467a1e['name']||'';this[_0x9336('0x1')]=_0x467a1e['username']||'';this['remoteUri']=_0x467a1e[_0x9336('0x2')]||'';this[_0x9336('0x3')]=_0x467a1e[_0x9336('0x3')]||'';this[_0x9336('0x4')]=_0x467a1e['clientId']||'';this[_0x9336('0x5')]=_0x467a1e[_0x9336('0x5')]||'';this[_0x9336('0x6')]=_0x467a1e['securityToken']||'';this[_0x9336('0x7')]=_0x467a1e[_0x9336('0x7')]||_0x9336('0x8');this[_0x9336('0x9')]=_0x467a1e[_0x9336('0x9')]||'';this[_0x9336('0xa')]=_0x467a1e['Configurations']||{};}module[_0x9336('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 c028d3e..4acc65a 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 _0xf365=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1374f5,_0x2a5924){var _0x3e0034=function(_0x18fc48){while(--_0x18fc48){_0x1374f5['push'](_0x1374f5['shift']());}};_0x3e0034(++_0x2a5924);}(_0xf365,0xce));var _0x5f36=function(_0x42cc1f,_0xe9eb20){_0x42cc1f=_0x42cc1f-0x0;var _0x175df5=_0xf365[_0x42cc1f];return _0x175df5;};'use strict';function ServicenowAccount(_0x108974){this['id']=_0x108974['id']||0x0;this[_0x5f36('0x0')]=_0x108974[_0x5f36('0x0')]||'';this[_0x5f36('0x1')]=_0x108974['username']||'';this[_0x5f36('0x2')]=_0x108974[_0x5f36('0x2')]||'';this[_0x5f36('0x3')]=_0x108974[_0x5f36('0x3')]||'';this[_0x5f36('0x4')]=_0x108974['serverUrl']||'';this[_0x5f36('0x5')]=_0x108974['Configurations']||{};}module[_0x5f36('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xb05f=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x34cbbf,_0x540ce2){var _0x3ec76e=function(_0x4e77e1){while(--_0x4e77e1){_0x34cbbf['push'](_0x34cbbf['shift']());}};_0x3ec76e(++_0x540ce2);}(_0xb05f,0xf8));var _0xfb05=function(_0x564fd7,_0x3da350){_0x564fd7=_0x564fd7-0x0;var _0x33e4bc=_0xb05f[_0x564fd7];return _0x33e4bc;};'use strict';function ServicenowAccount(_0x3dd730){this['id']=_0x3dd730['id']||0x0;this['name']=_0x3dd730[_0xfb05('0x0')]||'';this[_0xfb05('0x1')]=_0x3dd730[_0xfb05('0x1')]||'';this[_0xfb05('0x2')]=_0x3dd730[_0xfb05('0x2')]||'';this[_0xfb05('0x3')]=_0x3dd730[_0xfb05('0x3')]||'';this[_0xfb05('0x4')]=_0x3dd730[_0xfb05('0x4')]||'';this[_0xfb05('0x5')]=_0x3dd730['Configurations']||{};}module[_0xfb05('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index f4db6d1..b4324c1 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 _0xd3db=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x21bb6e,_0x22658e){var _0x496b10=function(_0x176550){while(--_0x176550){_0x21bb6e['push'](_0x21bb6e['shift']());}};_0x496b10(++_0x22658e);}(_0xd3db,0x1c4));var _0xbd3d=function(_0x4a11e6,_0x397f59){_0x4a11e6=_0x4a11e6-0x0;var _0x3a75a0=_0xd3db[_0x4a11e6];return _0x3a75a0;};'use strict';function SugarcrmAccount(_0x2ff53e){this['id']=_0x2ff53e['id']||0x0;this[_0xbd3d('0x0')]=_0x2ff53e[_0xbd3d('0x0')]||'';this[_0xbd3d('0x1')]=_0x2ff53e[_0xbd3d('0x1')]||'';this[_0xbd3d('0x2')]=_0x2ff53e['password']||'';this[_0xbd3d('0x3')]=_0x2ff53e[_0xbd3d('0x3')]||'';this[_0xbd3d('0x4')]=_0x2ff53e[_0xbd3d('0x4')]||'';this[_0xbd3d('0x5')]=_0x2ff53e['Configurations']||{};}module[_0xbd3d('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xe1a1=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x29958d,_0x284264){var _0x3b8f7e=function(_0x1e3131){while(--_0x1e3131){_0x29958d['push'](_0x29958d['shift']());}};_0x3b8f7e(++_0x284264);}(_0xe1a1,0x1b8));var _0x1e1a=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xe1a1[_0x5f0089];return _0x193892;};'use strict';function SugarcrmAccount(_0x4f6731){this['id']=_0x4f6731['id']||0x0;this[_0x1e1a('0x0')]=_0x4f6731['name']||'';this[_0x1e1a('0x1')]=_0x4f6731['username']||'';this['password']=_0x4f6731[_0x1e1a('0x2')]||'';this[_0x1e1a('0x3')]=_0x4f6731[_0x1e1a('0x3')]||'';this[_0x1e1a('0x4')]=_0x4f6731[_0x1e1a('0x4')]||'';this[_0x1e1a('0x5')]=_0x4f6731[_0x1e1a('0x5')]||{};}module[_0x1e1a('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 f447404..836ec92 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 _0x8d52=['state','unknown','stateTime','status','address','name','accountcode'];(function(_0xfab00c,_0x3e3a55){var _0x13bf37=function(_0x4b2632){while(--_0x4b2632){_0xfab00c['push'](_0xfab00c['shift']());}};_0x13bf37(++_0x3e3a55);}(_0x8d52,0x1b7));var _0x28d5=function(_0x502132,_0x1aa49a){_0x502132=_0x502132-0x0;var _0x55d50e=_0x8d52[_0x502132];return _0x55d50e;};'use strict';function Telephone(_0x51356){this['id']=_0x51356['id']||0x0;this[_0x28d5('0x0')]=_0x51356[_0x28d5('0x0')]||'';this[_0x28d5('0x1')]=_0x51356['accountcode']||'';this[_0x28d5('0x2')]=_0x28d5('0x3');this[_0x28d5('0x4')]=0x0;this[_0x28d5('0x5')]=_0x28d5('0x3');this[_0x28d5('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xf197=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x4987bc,_0x64bea0){var _0x45558f=function(_0x1e2458){while(--_0x1e2458){_0x4987bc['push'](_0x4987bc['shift']());}};_0x45558f(++_0x64bea0);}(_0xf197,0x1a8));var _0x7f19=function(_0x5669d8,_0x366fdf){_0x5669d8=_0x5669d8-0x0;var _0x1e0464=_0xf197[_0x5669d8];return _0x1e0464;};'use strict';function Telephone(_0x43f998){this['id']=_0x43f998['id']||0x0;this[_0x7f19('0x0')]=_0x43f998['name']||'';this[_0x7f19('0x1')]=_0x43f998[_0x7f19('0x1')]||'';this[_0x7f19('0x2')]=_0x7f19('0x3');this[_0x7f19('0x4')]=0x0;this[_0x7f19('0x5')]=_0x7f19('0x3');this[_0x7f19('0x6')]='';}module[_0x7f19('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index c9ad588..85c9e5f 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 _0x0c02=['name','html','exports'];(function(_0x305a6e,_0x1f4a40){var _0xd23128=function(_0x230ce6){while(--_0x230ce6){_0x305a6e['push'](_0x305a6e['shift']());}};_0xd23128(++_0x1f4a40);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';function template(_0x434f02){this['id']=_0x434f02['id']||0x0;this[_0x20c0('0x0')]=_0x434f02[_0x20c0('0x0')]||'';this['html']=_0x434f02[_0x20c0('0x1')]||'';}module[_0x20c0('0x2')]=template; \ No newline at end of file +var _0x41bb=['html','exports','name'];(function(_0x232da4,_0x13adeb){var _0xcd3772=function(_0x52f826){while(--_0x52f826){_0x232da4['push'](_0x232da4['shift']());}};_0xcd3772(++_0x13adeb);}(_0x41bb,0xc5));var _0xb41b=function(_0x474cc5,_0x57be85){_0x474cc5=_0x474cc5-0x0;var _0x51e42e=_0x41bb[_0x474cc5];return _0x51e42e;};'use strict';function template(_0x4337f5){this['id']=_0x4337f5['id']||0x0;this[_0xb41b('0x0')]=_0x4337f5['name']||'';this[_0xb41b('0x1')]=_0x4337f5['html']||'';}module[_0xb41b('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 5c5c5ef..e9b1d57 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 _0x7046=['status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x7046,0x163));var _0x6704=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7046[_0x5d6456];return _0x4d66c1;};'use strict';function Trigger(_0x169052){this['id']=_0x169052['id']||0x0;this[_0x6704('0x0')]=_0x169052['name']||'';this[_0x6704('0x1')]=_0x169052['channel']||'voice';this[_0x6704('0x2')]=_0x169052[_0x6704('0x2')]||![];this[_0x6704('0x3')]=_0x169052[_0x6704('0x3')]||[];this['AnyConditions']=_0x169052[_0x6704('0x4')]||[];this[_0x6704('0x5')]=_0x169052[_0x6704('0x5')]||[];}module[_0x6704('0x6')]=Trigger; \ No newline at end of file +var _0x7590=['exports','name','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x555569,_0x15669b){var _0x2541ff=function(_0x5aef2b){while(--_0x5aef2b){_0x555569['push'](_0x555569['shift']());}};_0x2541ff(++_0x15669b);}(_0x7590,0x120));var _0x0759=function(_0x5edbc8,_0x3cba86){_0x5edbc8=_0x5edbc8-0x0;var _0x1381ac=_0x7590[_0x5edbc8];return _0x1381ac;};'use strict';function Trigger(_0x344ced){this['id']=_0x344ced['id']||0x0;this[_0x0759('0x0')]=_0x344ced[_0x0759('0x0')]||'';this['channel']=_0x344ced['channel']||_0x0759('0x1');this[_0x0759('0x2')]=_0x344ced[_0x0759('0x2')]||![];this[_0x0759('0x3')]=_0x344ced['AllConditions']||[];this[_0x0759('0x4')]=_0x344ced['AnyConditions']||[];this[_0x0759('0x5')]=_0x344ced[_0x0759('0x5')]||[];}module[_0x0759('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index e7c640d..a8cbfe1 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 _0xa3a6=['port','domain','domainport','stateRegistry','registrationtime','address','exports','active','name','state','unknown','stateTime','registry','indexOf','split','host'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xa3a6,0xa7));var _0x6a3a=function(_0x23632b,_0x3c82e7){_0x23632b=_0x23632b-0x0;var _0x54c1d0=_0xa3a6[_0x23632b];return _0x54c1d0;};'use strict';function Trunk(_0x17cea2){this['id']=_0x17cea2['id']||0x0;this[_0x6a3a('0x0')]=_0x17cea2[_0x6a3a('0x0')]||![];this[_0x6a3a('0x1')]=_0x17cea2[_0x6a3a('0x1')]||'';this[_0x6a3a('0x2')]=_0x6a3a('0x3');this[_0x6a3a('0x4')]=0x0;this['status']=_0x6a3a('0x3');this[_0x6a3a('0x5')]=_0x17cea2['registry']&&_0x17cea2[_0x6a3a('0x5')][_0x6a3a('0x6')](':')?_0x17cea2[_0x6a3a('0x5')][_0x6a3a('0x7')](':')[0x0]:'';this[_0x6a3a('0x8')]='';this[_0x6a3a('0x9')]='';this[_0x6a3a('0xa')]='';this[_0x6a3a('0xb')]='';this['refresh']='';this[_0x6a3a('0xc')]=_0x6a3a('0x3');this[_0x6a3a('0xd')]='';this[_0x6a3a('0xe')]='';}module[_0x6a3a('0xf')]=Trunk; \ No newline at end of file +var _0xc9cd=['exports','active','name','stateTime','status','unknown','registry','split','host','domain','domainport','refresh','registrationtime'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0xc9cd,0x1c8));var _0xdc9c=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0xc9cd[_0x403c8d];return _0x4ca60d;};'use strict';function Trunk(_0x1ee75f){this['id']=_0x1ee75f['id']||0x0;this[_0xdc9c('0x0')]=_0x1ee75f[_0xdc9c('0x0')]||![];this[_0xdc9c('0x1')]=_0x1ee75f['name']||'';this['state']='unknown';this[_0xdc9c('0x2')]=0x0;this[_0xdc9c('0x3')]=_0xdc9c('0x4');this[_0xdc9c('0x5')]=_0x1ee75f[_0xdc9c('0x5')]&&_0x1ee75f['registry']['indexOf'](':')?_0x1ee75f[_0xdc9c('0x5')][_0xdc9c('0x6')](':')[0x0]:'';this[_0xdc9c('0x7')]='';this['port']='';this[_0xdc9c('0x8')]='';this[_0xdc9c('0x9')]='';this[_0xdc9c('0xa')]='';this['stateRegistry']=_0xdc9c('0x4');this[_0xdc9c('0xb')]='';this['address']='';}module[_0xdc9c('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 d1301a1..a4d8c77 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 _0xbd83=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x13df34,_0x35db06){var _0x294d59=function(_0x5a8d50){while(--_0x5a8d50){_0x13df34['push'](_0x13df34['shift']());}};_0x294d59(++_0x35db06);}(_0xbd83,0x8d));var _0x3bd8=function(_0xdad237,_0x361a1d){_0xdad237=_0xdad237-0x0;var _0x15c575=_0xbd83[_0xdad237];return _0x15c575;};'use strict';function voiceExtension(_0x26fd48){this['id']=_0x26fd48['id']||0x0;this[_0x3bd8('0x0')]=_0x26fd48[_0x3bd8('0x0')]||'';this[_0x3bd8('0x1')]=_0x26fd48[_0x3bd8('0x1')]||_0x3bd8('0x2');this['mandatoryDisposition']=_0x26fd48[_0x3bd8('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x505d=['recordingFormat','none','exports','exten'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x505d,0xd3));var _0xd505=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0x505d[_0x55ff3e];return _0x2709eb;};'use strict';function voiceExtension(_0x2bbcdc){this['id']=_0x2bbcdc['id']||0x0;this[_0xd505('0x0')]=_0x2bbcdc[_0xd505('0x0')]||'';this['recordingFormat']=_0x2bbcdc[_0xd505('0x1')]||_0xd505('0x2');this['mandatoryDisposition']=_0x2bbcdc['mandatoryDisposition']||![];}module[_0xd505('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index f4ea316..5ca589a 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 _0xf14e=['dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalLowerLimit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','unavailable','ringinuse','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumBillable','unmanaged','abandoned','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout'];(function(_0x340c25,_0x48bc4f){var _0x267044=function(_0x462c0b){while(--_0x462c0b){_0x340c25['push'](_0x340c25['shift']());}};_0x267044(++_0x48bc4f);}(_0xf14e,0xa3));var _0xef14=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf14e[_0x4b369d];return _0x571a98;};'use strict';var statusDesc=[_0xef14('0x0'),'not_inuse',_0xef14('0x1'),_0xef14('0x2'),_0xef14('0x3'),_0xef14('0x4'),'ringing',_0xef14('0x5'),'onhold'];var monitorFormat={'wav':_0xef14('0x6'),'wav49':'wav49','gsm':_0xef14('0x7')};var strategy={'rrmemory':_0xef14('0x8'),'roundrobin':_0xef14('0x9')};function VoiceQueue(_0x3d1500){this['id']=_0x3d1500['id']||0x0;this[_0xef14('0xa')]=_0x3d1500[_0xef14('0xa')]||'';this[_0xef14('0xb')]=_0x3d1500[_0xef14('0xb')]||'';this[_0xef14('0xc')]=_0x3d1500[_0xef14('0xc')]||_0xef14('0xd');this[_0xef14('0xe')]=0x0;this['talking']=0x0;this[_0xef14('0xf')]=0x0;this[_0xef14('0x10')]=0x0;this[_0xef14('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0xef14('0x12')]=0x0;this[_0xef14('0x13')]=0x0;this[_0xef14('0x14')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0xef14('0x15')]=_0x3d1500['acw']||![];this[_0xef14('0x16')]=_0x3d1500['acwTimeout']||0xa;this['autopause']=_0x3d1500[_0xef14('0x17')]||'no';this[_0xef14('0x18')]=!![];this[_0xef14('0x19')]='';this[_0xef14('0x1a')]=0x0;this[_0xef14('0x1b')]=0x0;this[_0xef14('0x1c')]=_0x3d1500[_0xef14('0x1c')]||null;this[_0xef14('0x1d')]=_0x3d1500[_0xef14('0x1d')]?_0x3d1500[_0xef14('0x1d')]:null;this[_0xef14('0x1e')]=_0x3d1500[_0xef14('0x1e')];this[_0xef14('0x1f')]=_0x3d1500[_0xef14('0x1f')]||_0xef14('0x20');this[_0xef14('0x21')]=_0x3d1500['dialLimitChannel']||0x0;this[_0xef14('0x22')]=_0x3d1500[_0xef14('0x22')]||0x0;this[_0xef14('0x23')]=_0x3d1500[_0xef14('0x23')]||0x1;this[_0xef14('0x24')]=_0x3d1500[_0xef14('0x24')]||_0xef14('0x25');this[_0xef14('0x26')]=_0x3d1500[_0xef14('0x26')]||0.03;this[_0xef14('0x27')]=_0x3d1500[_0xef14('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x3d1500[_0xef14('0x28')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x3d1500['dialOriginateCallerIdNumber']||_0xef14('0x29');this['dialOriginateTimeout']=_0x3d1500[_0xef14('0x2a')]||0x1e;this[_0xef14('0x2b')]=_0x3d1500[_0xef14('0x2b')]||_0xef14('0x2c');this[_0xef14('0x2d')]=_0x3d1500[_0xef14('0x2d')]||0x3;this['dialQueueProject']=_0x3d1500['dialQueueProject']||undefined;this[_0xef14('0x2e')]=_0x3d1500[_0xef14('0x2e')]||0x3;this[_0xef14('0x2f')]=_0x3d1500[_0xef14('0x2f')]||0x96;this['dialBusyMaxRetry']=_0x3d1500['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x3d1500[_0xef14('0x30')]||0x96;this[_0xef14('0x31')]=_0x3d1500[_0xef14('0x31')]||0x3;this[_0xef14('0x32')]=_0x3d1500[_0xef14('0x32')]||0x96;this['dialGlobalMaxRetry']=_0x3d1500[_0xef14('0x33')]||0x4;this[_0xef14('0x34')]=_0x3d1500[_0xef14('0x34')]?_0x3d1500[_0xef14('0x34')]:undefined;this[_0xef14('0x35')]=_0x3d1500[_0xef14('0x35')]?_0x3d1500[_0xef14('0x35')]:undefined;this[_0xef14('0x36')]=_0x3d1500[_0xef14('0x36')]||undefined;this[_0xef14('0x37')]=_0x3d1500[_0xef14('0x37')]?_0x3d1500['Interval']:undefined;this[_0xef14('0x38')]=_0x3d1500[_0xef14('0x38')]||'DESC';this[_0xef14('0x39')]=_0x3d1500[_0xef14('0x39')]||undefined;this[_0xef14('0x3a')]=_0x3d1500[_0xef14('0x3a')]||undefined;this[_0xef14('0x3b')]=strategy[_0x3d1500[_0xef14('0x3b')]]||_0xef14('0x8');this[_0xef14('0x3c')]=!![];this['dialAMDActive']=_0x3d1500[_0xef14('0x3d')]||![];this[_0xef14('0x3e')]=_0x3d1500[_0xef14('0x3e')];this[_0xef14('0x3f')]=_0x3d1500[_0xef14('0x3f')];this[_0xef14('0x40')]=_0x3d1500[_0xef14('0x40')];this['dialAMDTotalAnalysisTime']=_0x3d1500['dialAMDTotalAnalysisTime'];this[_0xef14('0x41')]=_0x3d1500[_0xef14('0x41')];this[_0xef14('0x42')]=_0x3d1500[_0xef14('0x42')];this[_0xef14('0x43')]=_0x3d1500['dialAMDMaximumNumberOfWords'];this[_0xef14('0x44')]=_0x3d1500[_0xef14('0x44')];this[_0xef14('0x45')]=_0x3d1500['dialAMDMaximumWordLength'];this[_0xef14('0x46')]=0x0;this[_0xef14('0x47')]=0x0;this[_0xef14('0x48')]=_0x3d1500['timeout'];this[_0xef14('0x49')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xef14('0x4a')]=0x0;this[_0xef14('0x4b')]=0x0;this[_0xef14('0x4c')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xef14('0x4d')]=0x0;this[_0xef14('0x4e')]=0x0;this[_0xef14('0x4f')]=0x0;this[_0xef14('0x50')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xef14('0x51')]=0x0;this['outboundReCallsDay']=0x0;this['startProgressive']=undefined;this[_0xef14('0x52')]=undefined;this['handlePredictive']=undefined;this[_0xef14('0x53')]=1.05;this[_0xef14('0x54')]=0x0;this[_0xef14('0x55')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xef14('0x56')]=0x0;this[_0xef14('0x57')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xef14('0x58')]=0x0;this[_0xef14('0x59')]=0.4;this[_0xef14('0x5a')]=0x0;this[_0xef14('0x5b')]=0x0;this[_0xef14('0x5c')]=0x1;this['erlangCalls']=0x0;this[_0xef14('0x5d')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xef14('0x5e')]=0x0;this[_0xef14('0x5f')]=_0x3d1500[_0xef14('0x5f')]||0x1e;this[_0xef14('0x60')]=_0x3d1500[_0xef14('0x60')]||![];this[_0xef14('0x61')]=_0x3d1500['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x3d1500[_0xef14('0x62')]||![];this[_0xef14('0x63')]=_0x3d1500['dialAgiAfterHangupAgent']||![];this[_0xef14('0xb')]=monitorFormat[_0x3d1500['monitor_format']]?monitorFormat[_0x3d1500[_0xef14('0xb')]]:undefined;this[_0xef14('0x64')]=_0x3d1500[_0xef14('0x64')]||![];this[_0xef14('0x65')]=_0x3d1500[_0xef14('0x65')]?_0x3d1500[_0xef14('0x65')]:undefined;}module[_0xef14('0x66')]=VoiceQueue; \ No newline at end of file +var _0x0882=['outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalLowerLimit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','talking','total','answered','sumHoldTime','abandoned','loggedIn','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x0882,0x89));var _0x2088=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0x0882[_0x538c70];return _0x42ae01;};'use strict';var statusDesc=[_0x2088('0x0'),_0x2088('0x1'),_0x2088('0x2'),_0x2088('0x3'),_0x2088('0x4'),'unavailable',_0x2088('0x5'),_0x2088('0x6'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0x2088('0x7'),'gsm':_0x2088('0x8')};var strategy={'rrmemory':_0x2088('0x9'),'roundrobin':_0x2088('0xa')};function VoiceQueue(_0x2ade12){this['id']=_0x2ade12['id']||0x0;this[_0x2088('0xb')]=_0x2ade12[_0x2088('0xb')]||'';this['monitor_format']=_0x2ade12[_0x2088('0xc')]||'';this['type']=_0x2ade12[_0x2088('0xd')]||'inbound';this['waiting']=0x0;this[_0x2088('0xe')]=0x0;this[_0x2088('0xf')]=0x0;this[_0x2088('0x10')]=0x0;this['sumDuration']=0x0;this[_0x2088('0x11')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x2088('0x12')]=0x0;this[_0x2088('0x13')]=0x0;this['available']=0x0;this[_0x2088('0x14')]=_0x2ade12[_0x2088('0x14')]||![];this[_0x2088('0x15')]=_0x2ade12['acwTimeout']||0xa;this['autopause']=_0x2ade12[_0x2088('0x16')]||'no';this['sendMessageOneNotActive']=!![];this[_0x2088('0x17')]='';this[_0x2088('0x18')]=0x0;this[_0x2088('0x19')]=0x0;this[_0x2088('0x1a')]=_0x2ade12[_0x2088('0x1a')]||null;this['dialGlobalInterval']=_0x2ade12['dialGlobalInterval']?_0x2ade12[_0x2088('0x1b')]:null;this['dialActive']=_0x2ade12[_0x2088('0x1c')];this['dialMethod']=_0x2ade12['dialMethod']||_0x2088('0x1d');this['dialLimitChannel']=_0x2ade12[_0x2088('0x1e')]||0x0;this[_0x2088('0x1f')]=_0x2ade12[_0x2088('0x1f')]||0x0;this[_0x2088('0x20')]=_0x2ade12[_0x2088('0x20')]||0x1;this['dialPredictiveOptimization']=_0x2ade12[_0x2088('0x21')]||_0x2088('0x22');this[_0x2088('0x23')]=_0x2ade12['dialPredictiveOptimizationPercentage']||0.03;this[_0x2088('0x24')]=_0x2ade12[_0x2088('0x24')]||0x258;this[_0x2088('0x25')]=_0x2ade12[_0x2088('0x25')]||_0x2088('0x26');this[_0x2088('0x27')]=_0x2ade12[_0x2088('0x27')]||_0x2088('0x26');this[_0x2088('0x28')]=_0x2ade12[_0x2088('0x28')]||0x1e;this[_0x2088('0x29')]=_0x2ade12['dialQueueOptions']||_0x2088('0x2a');this[_0x2088('0x2b')]=_0x2ade12[_0x2088('0x2b')]||0x3;this['dialQueueProject']=_0x2ade12[_0x2088('0x2c')]||undefined;this['dialCongestionMaxRetry']=_0x2ade12[_0x2088('0x2d')]||0x3;this[_0x2088('0x2e')]=_0x2ade12['dialCongestionRetryFrequency']||0x96;this[_0x2088('0x2f')]=_0x2ade12['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x2ade12['dialBusyRetryFrequency']||0x96;this[_0x2088('0x30')]=_0x2ade12[_0x2088('0x30')]||0x3;this[_0x2088('0x31')]=_0x2ade12['dialNoAnswerRetryFrequency']||0x96;this[_0x2088('0x32')]=_0x2ade12[_0x2088('0x32')]||0x4;this[_0x2088('0x33')]=_0x2ade12[_0x2088('0x33')]?_0x2ade12[_0x2088('0x33')]:undefined;this[_0x2088('0x34')]=_0x2ade12['TrunkBackup']?_0x2ade12[_0x2088('0x34')]:undefined;this[_0x2088('0x35')]=_0x2ade12[_0x2088('0x35')]||undefined;this[_0x2088('0x36')]=_0x2ade12[_0x2088('0x36')]?_0x2ade12[_0x2088('0x36')]:undefined;this[_0x2088('0x37')]=_0x2ade12['dialOrderByScheduledAt']||_0x2088('0x38');this[_0x2088('0x39')]=_0x2ade12['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x2088('0x3a')]=_0x2ade12[_0x2088('0x3a')]||undefined;this['strategy']=strategy[_0x2ade12['strategy']]||_0x2088('0x9');this[_0x2088('0x3b')]=!![];this['dialAMDActive']=_0x2ade12[_0x2088('0x3c')]||![];this[_0x2088('0x3d')]=_0x2ade12['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x2ade12['dialAMDGreeting'];this[_0x2088('0x3e')]=_0x2ade12[_0x2088('0x3e')];this[_0x2088('0x3f')]=_0x2ade12['dialAMDTotalAnalysisTime'];this[_0x2088('0x40')]=_0x2ade12['dialAMDMinWordLength'];this[_0x2088('0x41')]=_0x2ade12[_0x2088('0x41')];this[_0x2088('0x42')]=_0x2ade12[_0x2088('0x42')];this[_0x2088('0x43')]=_0x2ade12[_0x2088('0x43')];this[_0x2088('0x44')]=_0x2ade12[_0x2088('0x44')];this[_0x2088('0x45')]=0x0;this['pTalking']=0x0;this['timeout']=_0x2ade12['timeout'];this[_0x2088('0x46')]=0x0;this[_0x2088('0x47')]=0x0;this[_0x2088('0x48')]=0x0;this[_0x2088('0x49')]=0x0;this[_0x2088('0x4a')]=0x0;this[_0x2088('0x4b')]=0x0;this[_0x2088('0x4c')]=0x0;this[_0x2088('0x4d')]=0x0;this[_0x2088('0x4e')]=0x0;this[_0x2088('0x4f')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x2088('0x50')]=0x0;this['outboundReCallsDay']=0x0;this[_0x2088('0x51')]=undefined;this[_0x2088('0x52')]=undefined;this[_0x2088('0x53')]=undefined;this[_0x2088('0x54')]=1.05;this[_0x2088('0x55')]=0x0;this[_0x2088('0x56')]=0x0;this[_0x2088('0x57')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x2088('0x58')]=0x0;this[_0x2088('0x59')]=0x0;this[_0x2088('0x5a')]=0x0;this[_0x2088('0x5b')]=0.4;this[_0x2088('0x5c')]=0x0;this[_0x2088('0x5d')]=0x0;this[_0x2088('0x5e')]=0x1;this[_0x2088('0x5f')]=0x0;this[_0x2088('0x60')]=0x0;this[_0x2088('0x61')]=0x0;this[_0x2088('0x62')]=0x0;this['dialRecallMeTimeout']=_0x2ade12[_0x2088('0x63')]||0x1e;this[_0x2088('0x64')]=_0x2ade12[_0x2088('0x64')]||![];this[_0x2088('0x65')]=_0x2ade12[_0x2088('0x65')]||undefined;this[_0x2088('0x66')]=_0x2ade12[_0x2088('0x66')]||![];this[_0x2088('0x67')]=_0x2ade12[_0x2088('0x67')]||![];this[_0x2088('0xc')]=monitorFormat[_0x2ade12['monitor_format']]?monitorFormat[_0x2ade12['monitor_format']]:undefined;this['mandatoryDisposition']=_0x2ade12['mandatoryDisposition']||![];this[_0x2088('0x68')]=_0x2ade12[_0x2088('0x68')]?_0x2ade12['mandatoryDispositionPause']:undefined;}module[_0x2088('0x69')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3a155da..6978590 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 _0xd6d1=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0xd6d1,0xe3));var _0x1d6d=function(_0x394a1a,_0x4fff50){_0x394a1a=_0x394a1a-0x0;var _0xcd5a3c=_0xd6d1[_0x394a1a];return _0xcd5a3c;};'use strict';function VtigerAccount(_0x128ac2){this['id']=_0x128ac2['id']||0x0;this[_0x1d6d('0x0')]=_0x128ac2['name']||'';this[_0x1d6d('0x1')]=_0x128ac2[_0x1d6d('0x1')]||'';this[_0x1d6d('0x2')]=_0x128ac2[_0x1d6d('0x2')]||'';this[_0x1d6d('0x3')]=_0x128ac2[_0x1d6d('0x3')]||'';this['serverUrl']=_0x128ac2[_0x1d6d('0x4')]||'';this[_0x1d6d('0x5')]=_0x128ac2[_0x1d6d('0x5')]||{};}module[_0x1d6d('0x6')]=VtigerAccount; \ No newline at end of file +var _0x1ba3=['remoteUri','serverUrl','Configurations','exports','accessKey'];(function(_0x5dfab2,_0x1de692){var _0x56150b=function(_0x227de4){while(--_0x227de4){_0x5dfab2['push'](_0x5dfab2['shift']());}};_0x56150b(++_0x1de692);}(_0x1ba3,0x153));var _0x31ba=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x1ba3[_0x289e64];return _0x30246c;};'use strict';function VtigerAccount(_0x2b015b){this['id']=_0x2b015b['id']||0x0;this['name']=_0x2b015b['name']||'';this['username']=_0x2b015b['username']||'';this[_0x31ba('0x0')]=_0x2b015b[_0x31ba('0x0')]||'';this[_0x31ba('0x1')]=_0x2b015b[_0x31ba('0x1')]||'';this[_0x31ba('0x2')]=_0x2b015b[_0x31ba('0x2')]||'';this['Configurations']=_0x2b015b[_0x31ba('0x3')]||{};}module[_0x31ba('0x4')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 9310468..0a0ba8f 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 _0x128f=['name','username','password','token','remoteUri','authType','serverUrl','Configurations','exports'];(function(_0x5d2c05,_0x54d42e){var _0x48cb7d=function(_0x40800f){while(--_0x40800f){_0x5d2c05['push'](_0x5d2c05['shift']());}};_0x48cb7d(++_0x54d42e);}(_0x128f,0x1a7));var _0xf128=function(_0x15c97c,_0x47772c){_0x15c97c=_0x15c97c-0x0;var _0x2db36e=_0x128f[_0x15c97c];return _0x2db36e;};'use strict';function ZendeskAccount(_0x3cb519){this['id']=_0x3cb519['id']||0x0;this[_0xf128('0x0')]=_0x3cb519[_0xf128('0x0')]||'';this['username']=_0x3cb519[_0xf128('0x1')]||'';this[_0xf128('0x2')]=_0x3cb519['password']||'';this['token']=_0x3cb519[_0xf128('0x3')]||'';this[_0xf128('0x4')]=_0x3cb519[_0xf128('0x4')]||'';this[_0xf128('0x5')]=_0x3cb519[_0xf128('0x5')]||'';this['type']=_0x3cb519['type']||'integrationTab';this[_0xf128('0x6')]=_0x3cb519[_0xf128('0x6')]||'';this[_0xf128('0x7')]=_0x3cb519[_0xf128('0x7')]||{};}module[_0xf128('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x5ce9=['authType','type','integrationTab','serverUrl','exports','name','username','password','token','remoteUri'];(function(_0x1242e7,_0x452932){var _0x3b16ce=function(_0x3f6152){while(--_0x3f6152){_0x1242e7['push'](_0x1242e7['shift']());}};_0x3b16ce(++_0x452932);}(_0x5ce9,0x177));var _0x95ce=function(_0xa8858,_0xfdf8de){_0xa8858=_0xa8858-0x0;var _0x5de30d=_0x5ce9[_0xa8858];return _0x5de30d;};'use strict';function ZendeskAccount(_0x4f0b4e){this['id']=_0x4f0b4e['id']||0x0;this[_0x95ce('0x0')]=_0x4f0b4e['name']||'';this['username']=_0x4f0b4e[_0x95ce('0x1')]||'';this[_0x95ce('0x2')]=_0x4f0b4e['password']||'';this[_0x95ce('0x3')]=_0x4f0b4e[_0x95ce('0x3')]||'';this[_0x95ce('0x4')]=_0x4f0b4e[_0x95ce('0x4')]||'';this[_0x95ce('0x5')]=_0x4f0b4e[_0x95ce('0x5')]||'';this[_0x95ce('0x6')]=_0x4f0b4e[_0x95ce('0x6')]||_0x95ce('0x7');this[_0x95ce('0x8')]=_0x4f0b4e[_0x95ce('0x8')]||'';this['Configurations']=_0x4f0b4e['Configurations']||{};}module[_0x95ce('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 976d38f..bdd68fa 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 _0x7096=['host','Configurations','serverUrl','exports','name','authToken'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7096,0x10c));var _0x6709=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7096[_0x47a7d0];return _0xb9bd08;};'use strict';function ZohoAccount(_0x442821){this['id']=_0x442821['id']||0x0;this[_0x6709('0x0')]=_0x442821['name']||'';this[_0x6709('0x1')]=_0x442821['authToken']||'';this[_0x6709('0x2')]=_0x442821[_0x6709('0x2')]||'';this[_0x6709('0x3')]=_0x442821[_0x6709('0x3')]||{};this[_0x6709('0x4')]=_0x442821[_0x6709('0x4')]||'';}module[_0x6709('0x5')]=ZohoAccount; \ No newline at end of file +var _0x4975=['serverUrl','exports','name','authToken','host','Configurations'];(function(_0x5a3085,_0x1f04ef){var _0x538282=function(_0x2d09b5){while(--_0x2d09b5){_0x5a3085['push'](_0x5a3085['shift']());}};_0x538282(++_0x1f04ef);}(_0x4975,0x86));var _0x5497=function(_0x1683c8,_0x6e591b){_0x1683c8=_0x1683c8-0x0;var _0x45f1b8=_0x4975[_0x1683c8];return _0x45f1b8;};'use strict';function ZohoAccount(_0x14a4b5){this['id']=_0x14a4b5['id']||0x0;this['name']=_0x14a4b5[_0x5497('0x0')]||'';this[_0x5497('0x1')]=_0x14a4b5[_0x5497('0x1')]||'';this[_0x5497('0x2')]=_0x14a4b5[_0x5497('0x2')]||'';this[_0x5497('0x3')]=_0x14a4b5[_0x5497('0x3')]||{};this[_0x5497('0x4')]=_0x14a4b5[_0x5497('0x4')]||'';}module[_0x5497('0x5')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ddbbcfe..6a34ae5 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 _0xf971=['queue','name','type','campaigntype','membername','Agent','channelAgent','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string'];(function(_0x44b9ec,_0x34d6b8){var _0xeb3c8=function(_0x5930c7){while(--_0x5930c7){_0x44b9ec['push'](_0x44b9ec['shift']());}};_0xeb3c8(++_0x34d6b8);}(_0xf971,0xd9));var _0x1f97=function(_0x2c3a60,_0x30765b){_0x2c3a60=_0x2c3a60-0x0;var _0x45904a=_0xf971[_0x2c3a60];return _0x45904a;};'use strict';var util=require(_0x1f97('0x0'));var _=require(_0x1f97('0x1'));var moment=require(_0x1f97('0x2'));function checkNameSurname(_0x5adc1d,_0x20c176,_0x284405){var _0x1a4dca='';if(!_[_0x1f97('0x3')](_0x20c176)&&_0x1f97('0x4')===typeof _0x20c176){_0x1a4dca+=_0x20c176;}if(!_[_0x1f97('0x3')](_0x284405)&&'string'===typeof _0x284405){_0x1a4dca+='\x20'+_0x284405;}if(_0x1a4dca!==''){return _0x1a4dca;}return _0x5adc1d;}function Action(_0x1463a6,_0x473dbe,_0x3c1da8,_0x59d155,_0x34329b){this['uniqueid']=_0x3c1da8||undefined;this['idContact']=_0x1463a6['id'];this[_0x1f97('0x5')]=_0x473dbe[_0x1f97('0x6')];this['type']=_0x473dbe[_0x1f97('0x7')];this[_0x1f97('0x8')]=_0x1f97('0x5');this['dialAnswer']=![];this[_0x1f97('0x9')]=_['isNil'](_0x1463a6[_0x1f97('0xa')])?undefined:_0x1463a6['Agent'][_0x1f97('0x6')];this[_0x1f97('0xb')]=this['membername']?util['format']('SIP/%s',this[_0x1f97('0x9')]):_0x59d155||undefined;this[_0x1f97('0xc')]=checkNameSurname(_0x1463a6[_0x1f97('0xd')][_0x1f97('0xe')],_0x1463a6[_0x1f97('0xd')][_0x1f97('0xf')],_0x1463a6[_0x1f97('0xd')][_0x1f97('0x10')]);this[_0x1f97('0x11')]=_0x1463a6[_0x1f97('0x11')]||![];this['calleridnum']=_0x1463a6[_0x1f97('0xd')][_0x1f97('0xe')];this[_0x1f97('0x12')]=_0x1463a6[_0x1f97('0x12')];this[_0x1f97('0x13')]=_0x1463a6[_0x1f97('0x13')]||0x0;this[_0x1f97('0x14')]=_0x1463a6[_0x1f97('0x14')]||0x0;this['countnoanswerretry']=_0x1463a6[_0x1f97('0x15')]||0x0;this[_0x1f97('0x16')]=(_0x1463a6[_0x1f97('0x13')]||0x0)+(_0x1463a6[_0x1f97('0x14')]||0x0)+(_0x1463a6[_0x1f97('0x15')]||0x0);this[_0x1f97('0x17')]=_0x1463a6[_0x1f97('0x17')];this['callbackuniqueid']=_0x1463a6[_0x1f97('0x18')];this['callbackat']=_0x1463a6[_0x1f97('0x19')];this[_0x1f97('0x1a')]=_0x1463a6[_0x1f97('0x1a')];this[_0x1f97('0x1b')]=_0x1463a6[_0x1f97('0x1b')];this[_0x1f97('0x1c')]=_0x1463a6['ListId'];this[_0x1f97('0x1d')]=_[_0x1f97('0x3')](_0x1463a6[_0x1f97('0xa')])?_0x1463a6[_0x1f97('0x1d')]:_0x1463a6[_0x1f97('0xa')]['id'];this[_0x1f97('0x1e')]=_0x1463a6[_0x1f97('0x1e')];this[_0x1f97('0x1f')]='';this['originatecalleridname']='';}Action['prototype'][_0x1f97('0x20')]=function(){return util[_0x1f97('0x21')](_0x1f97('0x22'),this[_0x1f97('0xc')],this[_0x1f97('0x23')]);};module[_0x1f97('0x24')]=Action; \ No newline at end of file +var _0x0c58=['recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','queue','dialAnswer','Agent','channelAgent','format','SIP/%s','membername','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat'];(function(_0x5b3e28,_0x2ad693){var _0x21a6f4=function(_0xea4216){while(--_0xea4216){_0x5b3e28['push'](_0x5b3e28['shift']());}};_0x21a6f4(++_0x2ad693);}(_0x0c58,0x152));var _0x80c5=function(_0x111f6c,_0xe54486){_0x111f6c=_0x111f6c-0x0;var _0x4c51af=_0x0c58[_0x111f6c];return _0x4c51af;};'use strict';var util=require(_0x80c5('0x0'));var _=require(_0x80c5('0x1'));var moment=require(_0x80c5('0x2'));function checkNameSurname(_0x196d2c,_0x50595a,_0x400b95){var _0x1d2703='';if(!_[_0x80c5('0x3')](_0x50595a)&&_0x80c5('0x4')===typeof _0x50595a){_0x1d2703+=_0x50595a;}if(!_[_0x80c5('0x3')](_0x400b95)&&_0x80c5('0x4')===typeof _0x400b95){_0x1d2703+='\x20'+_0x400b95;}if(_0x1d2703!==''){return _0x1d2703;}return _0x196d2c;}function Action(_0x5b5da9,_0x5d5919,_0x17dd09,_0x1685e3,_0x313fbd){this[_0x80c5('0x5')]=_0x17dd09||undefined;this[_0x80c5('0x6')]=_0x5b5da9['id'];this['queue']=_0x5d5919[_0x80c5('0x7')];this[_0x80c5('0x8')]=_0x5d5919[_0x80c5('0x8')];this['campaigntype']=_0x80c5('0x9');this[_0x80c5('0xa')]=![];this['membername']=_['isNil'](_0x5b5da9[_0x80c5('0xb')])?undefined:_0x5b5da9['Agent'][_0x80c5('0x7')];this[_0x80c5('0xc')]=this['membername']?util[_0x80c5('0xd')](_0x80c5('0xe'),this[_0x80c5('0xf')]):_0x1685e3||undefined;this[_0x80c5('0x10')]=checkNameSurname(_0x5b5da9[_0x80c5('0x11')]['phone'],_0x5b5da9[_0x80c5('0x11')][_0x80c5('0x12')],_0x5b5da9[_0x80c5('0x11')][_0x80c5('0x13')]);this[_0x80c5('0x14')]=_0x5b5da9['active']||![];this[_0x80c5('0x15')]=_0x5b5da9[_0x80c5('0x11')][_0x80c5('0x16')];this[_0x80c5('0x17')]=_0x5b5da9['scheduledat'];this[_0x80c5('0x18')]=_0x5b5da9[_0x80c5('0x18')]||0x0;this[_0x80c5('0x19')]=_0x5b5da9['countcongestionretry']||0x0;this[_0x80c5('0x1a')]=_0x5b5da9['countnoanswerretry']||0x0;this[_0x80c5('0x1b')]=(_0x5b5da9[_0x80c5('0x18')]||0x0)+(_0x5b5da9['countcongestionretry']||0x0)+(_0x5b5da9[_0x80c5('0x1a')]||0x0);this[_0x80c5('0x1c')]=_0x5b5da9[_0x80c5('0x1c')];this[_0x80c5('0x1d')]=_0x5b5da9[_0x80c5('0x1d')];this[_0x80c5('0x1e')]=_0x5b5da9[_0x80c5('0x1e')];this[_0x80c5('0x1f')]=_0x5b5da9[_0x80c5('0x1f')];this['ContactId']=_0x5b5da9[_0x80c5('0x20')];this[_0x80c5('0x21')]=_0x5b5da9[_0x80c5('0x21')];this['UserId']=_[_0x80c5('0x3')](_0x5b5da9[_0x80c5('0xb')])?_0x5b5da9[_0x80c5('0x22')]:_0x5b5da9['Agent']['id'];this[_0x80c5('0x23')]=_0x5b5da9[_0x80c5('0x23')];this[_0x80c5('0x24')]='';this[_0x80c5('0x25')]='';}Action['prototype'][_0x80c5('0x26')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x80c5('0x27')]);};module[_0x80c5('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index c85a9ae..81fd229 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 _0x941a=['syncBlindTransfer','emit','type','name','strategy','available','loggedIn','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','message','originated','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','clockClearZombieChannels','dialMethod','preview','outbound','clearZombieChannels','hasOwnProperty','recallMe','isNil','info','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','pTalking','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','[RecallMe]','logger2','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt','countbusyretry','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','[syncHangupRequest][logAgentReject]','unlockContact','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','SIP/%s','reachable','unmonitored','run','unlock','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','Call\x20unsuccessful','Agent','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','dialPrefix','trim','dialCutDigit','phone','SIP/%s/%s%s','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','addVariables','toLowerVariables','variablesAction','[originated][increment]','OriginateError','logLookAgent','clone','isFailure','response','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','dialstatus','addVariable','variables','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','defaults','localhost','socket.io-emitter','redis','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer'];(function(_0x5c7463,_0x52023b){var _0x3a51b8=function(_0x1c2e09){while(--_0x1c2e09){_0x5c7463['push'](_0x5c7463['shift']());}};_0x3a51b8(++_0x52023b);}(_0x941a,0x110));var _0xa941=function(_0x2e9a70,_0x4149d4){_0x2e9a70=_0x2e9a70-0x0;var _0x2547fd=_0x941a[_0x2e9a70];return _0x2547fd;};'use strict';var util=require(_0xa941('0x0'));var _=require(_0xa941('0x1'));var BPromise=require(_0xa941('0x2'));var uuid=require(_0xa941('0x3'));var moment=require(_0xa941('0x4'));var md5=require(_0xa941('0x5'));var Redis=require(_0xa941('0x6'));var config=require(_0xa941('0x7'));var logger=require(_0xa941('0x8'))('preview');var loggerAction=require(_0xa941('0x8'))('actionPreview');var ami=require(_0xa941('0x9'));var rpcDb=require(_0xa941('0xa'));var Action=require(_0xa941('0xb'));var ut=require('./util/util');config['redis']=_[_0xa941('0xc')](config['redis'],{'host':_0xa941('0xd'),'port':0x18eb});var io=require(_0xa941('0xe'))(new Redis(config[_0xa941('0xf')]));var Sequence=function(){};Sequence[_0xa941('0x10')][_0xa941('0x11')]=function(_0x5cdfe2){this['tail']=this['tail']?this[_0xa941('0x12')]['finally'](_0x5cdfe2):_0x5cdfe2();};function Preview(_0xfa02d3){this[_0xa941('0x13')]=new Sequence();this[_0xa941('0x14')]=_0xfa02d3[_0xa941('0x15')];this[_0xa941('0x16')]=_0xfa02d3[_0xa941('0x16')];this[_0xa941('0x17')]={};this[_0xa941('0x18')]=_0xfa02d3[_0xa941('0x18')];this['clockClearZombieChannels']=0x0;ami['on'](_0xa941('0x19'),this[_0xa941('0x1a')][_0xa941('0x1b')](this));ami['on'](_0xa941('0x1c'),this[_0xa941('0x1d')][_0xa941('0x1b')](this));ami['on']('hanguprequest',this[_0xa941('0x1e')]['bind'](this));ami['on'](_0xa941('0x1f'),this[_0xa941('0x20')][_0xa941('0x1b')](this));ami['on']('newexten',this[_0xa941('0x21')]['bind'](this));ami['on']('varset',this[_0xa941('0x22')][_0xa941('0x1b')](this));ami['on'](_0xa941('0x23'),this[_0xa941('0x24')][_0xa941('0x1b')](this));ami['on'](_0xa941('0x25'),this[_0xa941('0x26')][_0xa941('0x1b')](this));this['loopCampaigns'](this[_0xa941('0x14')]);}function emit(_0x56687c,_0x2f2586,_0x4f729a){io['to'](_0x56687c)[_0xa941('0x27')](_0x2f2586,_0x4f729a);}function emitCampaignPreview(_0x261055){if(_0x261055[_0xa941('0x28')]==='outbound'){var _0x1f46ed={'id':_0x261055['id'],'name':_0x261055[_0xa941('0x29')],'strategy':_0x261055[_0xa941('0x2a')],'answered':_0x261055['answered'],'available':_0x261055[_0xa941('0x2b')],'loggedIn':_0x261055[_0xa941('0x2c')],'pTalking':_0x261055['pTalking'],'sumBillable':_0x261055['sumBillable'],'sumDuration':_0x261055[_0xa941('0x2d')],'sumHoldTime':_0x261055[_0xa941('0x2e')]||0x0,'talking':_0x261055[_0xa941('0x2f')],'total':_0x261055[_0xa941('0x30')],'type':_0x261055[_0xa941('0x28')],'unmanaged':_0x261055[_0xa941('0x31')],'abandoned':_0x261055[_0xa941('0x32')],'waiting':_0x261055[_0xa941('0x33')],'loggedInDb':_0x261055[_0xa941('0x34')],'dialActive':_0x261055[_0xa941('0x35')],'dialMethod':_0x261055['dialMethod'],'dialOriginateCallerIdName':_0x261055['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x261055[_0xa941('0x36')],'dialOriginateTimeout':_0x261055[_0xa941('0x37')],'dialPrefix':_0x261055['dialPrefix'],'outboundAnswerAgiCallsDay':_0x261055[_0xa941('0x38')],'outboundAnswerCallsDay':_0x261055[_0xa941('0x39')],'outboundBlacklistCallsDay':_0x261055[_0xa941('0x3a')],'outboundBusyCallsDay':_0x261055[_0xa941('0x3b')],'outboundCongestionCallsDay':_0x261055[_0xa941('0x3c')],'outboundDropCallsDayACS':_0x261055[_0xa941('0x3d')],'outboundDropCallsDayCallersExit':_0x261055[_0xa941('0x3e')],'outboundDropCallsDayTimeout':_0x261055[_0xa941('0x3f')],'outboundNoAnswerCallsDay':_0x261055[_0xa941('0x40')],'outboundNoSuchCallsDay':_0x261055['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x261055['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x261055['outboundReCallsDay'],'outboundRejectCallsDay':_0x261055[_0xa941('0x41')],'outboundUnknownCallsDay':_0x261055[_0xa941('0x42')],'predictiveIntervalAnsweredCalls':_0x261055[_0xa941('0x43')],'predictiveIntervalAvgHoldtime':_0x261055[_0xa941('0x44')],'predictiveIntervalAvgTalktime':_0x261055[_0xa941('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x261055[_0xa941('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x261055[_0xa941('0x47')],'predictiveIntervalErlangCalls':_0x261055[_0xa941('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x261055[_0xa941('0x49')],'predictiveIntervalHitRate':_0x261055['predictiveIntervalHitRate'],'predictiveIntervalLowerLimit':_0x261055[_0xa941('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x261055[_0xa941('0x4b')],'predictiveIntervalPauses':_0x261055['predictiveIntervalPauses'],'predictiveIntervalTotalCalls':_0x261055['predictiveIntervalTotalCalls'],'message':_0x261055[_0xa941('0x4c')],'originated':_0x261055[_0xa941('0x4d')]};if(_0x261055[_0xa941('0x4e')]){_0x1f46ed[_0xa941('0x4e')]={'id':_0x261055[_0xa941('0x4e')]['id'],'name':_0x261055[_0xa941('0x4e')][_0xa941('0x29')],'active':_0x261055['Trunk'][_0xa941('0x4f')],'callerid':_0x261055['Trunk'][_0xa941('0x50')]};}if(_0x261055[_0xa941('0x51')]){_0x1f46ed['Interval']={'id':_0x261055[_0xa941('0x51')]['id'],'name':_0x261055[_0xa941('0x51')][_0xa941('0x29')]};}var _0x341e0b=md5(JSON[_0xa941('0x52')](_0x1f46ed));if(_0x261055[_0xa941('0x5')]!==_0x341e0b){_0x261055[_0xa941('0x5')]=_0x341e0b;emit(util[_0xa941('0x53')](_0xa941('0x54'),_0x1f46ed[_0xa941('0x29')]),_0xa941('0x55'),_0x1f46ed);}}}function emitVoiceQueueChannelRemove(_0x437566){emit(util[_0xa941('0x53')](_0xa941('0x54'),_0x437566[_0xa941('0x29')]),_0xa941('0x56'),_0x437566);}function notSendMessagesQueue(_0x51a428){if(_0x51a428[_0xa941('0x57')]){if(_0x51a428[_0xa941('0x4d')]===0x0&&_0x51a428['pTalking']===0x0){_0x51a428[_0xa941('0x57')]=![];_0x51a428[_0xa941('0x2b')]=0x0;_0x51a428[_0xa941('0x58')]=0x0;_0x51a428['message']=_0xa941('0x59');ut[_0xa941('0x5a')](_0xa941('0x5b'),_0x51a428['name']+_0xa941('0x5c'));}else{_0x51a428[_0xa941('0x4c')]=_0xa941('0x5d');ut[_0xa941('0x5a')](_0xa941('0x5b'),_0x51a428['name']+_0xa941('0x5e'));}emitCampaignPreview(_0x51a428);}}Preview[_0xa941('0x10')][_0xa941('0x5f')]=function(){var _0x488ed6=this;setInterval(function(){_0x488ed6[_0xa941('0x60')]();},0x7cf);};Preview[_0xa941('0x10')]['syncCampaigns']=function(){var _0x57ec9a=this['campaignsPreview'];this[_0xa941('0x61')]+=0x1;for(var _0x212051 in _0x57ec9a){if(_0x57ec9a['hasOwnProperty'](_0x212051)&&(_0x57ec9a[_0x212051][_0xa941('0x62')]===_0xa941('0x63')||_0x57ec9a[_0x212051][_0xa941('0x62')]==='booked')&&_0x57ec9a[_0x212051]['type']===_0xa941('0x64')){if(this[_0xa941('0x61')]>0x7){this[_0xa941('0x61')]=0x0;this[_0xa941('0x65')]();}}if(_0x57ec9a[_0xa941('0x66')](_0x212051)&&_0x57ec9a[_0x212051][_0xa941('0x62')]==='preview'&&_0x57ec9a[_0x212051][_0xa941('0x28')]===_0xa941('0x64')){if(_0x57ec9a[_0x212051][_0xa941('0x35')]){this['setMessage'](_0x57ec9a[_0x212051]);this[_0xa941('0x67')](_0x57ec9a[_0x212051]);}else{notSendMessagesQueue(_0x57ec9a[_0x212051]);}}}};Preview[_0xa941('0x10')]['clearZombieChannel']=function(_0x3a5cad){var _0x1aa0b9=this;this[_0xa941('0x13')][_0xa941('0x11')](function(){if(!_[_0xa941('0x68')](_0x1aa0b9[_0xa941('0x17')][_0x3a5cad])){loggerAction[_0xa941('0x69')](_0xa941('0x6a'),_0x3a5cad,_0xa941('0x6b'),_0x1aa0b9['actions'][_0x3a5cad]['queue'],_0xa941('0x6c'),JSON[_0xa941('0x52')](_0x1aa0b9['campaignsPreview'][_0x1aa0b9['actions'][_0x3a5cad][_0xa941('0x6d')]]['originated']),_0xa941('0x6e'),JSON[_0xa941('0x52')](_0x1aa0b9[_0xa941('0x14')][_0x1aa0b9[_0xa941('0x17')][_0x3a5cad][_0xa941('0x6d')]][_0xa941('0x6f')]),JSON[_0xa941('0x52')](_0x1aa0b9[_0xa941('0x17')][_0x3a5cad]['dialAnswer']),JSON[_0xa941('0x52')](_[_0xa941('0x70')](_0x1aa0b9[_0xa941('0x17')][_0x3a5cad],[_0xa941('0x71'),'UserId',_0xa941('0x72'),_0xa941('0x73')])));return ami[_0xa941('0x74')]({'action':_0xa941('0x75'),'channel':_0x1aa0b9['actions'][_0x3a5cad][_0xa941('0x76')]})[_0xa941('0x77')](function(_0x5a9e31){if(_0x5a9e31[_0xa941('0x4c')]===_0xa941('0x78')){setTimeout(function(){if(_0x1aa0b9[_0xa941('0x17')][_0x3a5cad]){ut[_0xa941('0x79')](_0x1aa0b9[_0xa941('0x14')][_0x1aa0b9[_0xa941('0x17')][_0x3a5cad][_0xa941('0x6d')]],_0xa941('0x7a'));if(_0x1aa0b9[_0xa941('0x17')][_0x3a5cad][_0xa941('0x7b')]===!![]){ut[_0xa941('0x7c')](_0x1aa0b9[_0xa941('0x14')][_0x1aa0b9[_0xa941('0x17')][_0x3a5cad][_0xa941('0x6d')]],_0xa941('0x7a'));ut[_0xa941('0x7d')]('[Dialer][checkChannel][pTalking][Preview]'+_0x3a5cad,_0x1aa0b9[_0xa941('0x17')][_0x3a5cad][_0xa941('0x6d')]);}ut[_0xa941('0x7d')]('[Dialer][checkChannel][Preview]'+_0x3a5cad,_0x1aa0b9[_0xa941('0x17')][_0x3a5cad][_0xa941('0x6d')]);delete _0x1aa0b9[_0xa941('0x17')][_0x3a5cad];}},0x2328);}});}});};Preview['prototype'][_0xa941('0x65')]=function(){var _0x7d0411=this;loggerAction[_0xa941('0x69')](_0xa941('0x7e'),_[_0xa941('0x7f')](this[_0xa941('0x17')]));for(var _0x525510 in this['actions']){if(_0x7d0411[_0xa941('0x17')]['hasOwnProperty'](_0x525510)){_0x7d0411[_0xa941('0x80')](_0x525510);}}};Preview[_0xa941('0x10')][_0xa941('0x67')]=function(_0x56337d){var _0x3520f2=this;rpcDb[_0xa941('0x81')](_0x56337d['id'],ut[_0xa941('0x82')](this[_0xa941('0x18')]))[_0xa941('0x83')](function(_0x5cd0e5){if(!_['isNil'](_0x5cd0e5)){for(var _0x536cf5=0x0;_0x536cf5<_0x5cd0e5[_0xa941('0x84')];_0x536cf5+=0x1){if(ut[_0xa941('0x85')](_0x5cd0e5[_0x536cf5][_0xa941('0x86')])<_0x56337d[_0xa941('0x87')]*0x3c){_0x3520f2['run'](_0x5cd0e5[_0x536cf5]['id'])[_0xa941('0x83')](ut['logger2'](_0xa941('0x88')))[_0xa941('0x77')](ut[_0xa941('0x89')](_0xa941('0x88')));}else{var _0x3e5f3f=new Action(_0x5cd0e5[_0x536cf5],_0x56337d);_0x3e5f3f[_0xa941('0x8a')]=moment()[_0xa941('0x53')](_0xa941('0x8b'));_0x56337d[_0xa941('0x8c')]+=0x1;ut[_0xa941('0x8d')](_0x3e5f3f,0x17,_0xa941('0x8e'));if(_0x56337d[_0xa941('0x8f')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x5cd0e5[_0x536cf5]));rpcDb[_0xa941('0x90')](_0x3e5f3f,_0xa941('0x91'));}else{ut[_0xa941('0x8d')](_0x3e5f3f,0x16,_0xa941('0x92'));rpcDb[_0xa941('0x90')](_0x3e5f3f,_0xa941('0x93'));rpcDb['createCustomerFinal'](_0x3e5f3f,'[HistoryRecallClose]');}}}}})[_0xa941('0x77')](ut[_0xa941('0x89')](_0xa941('0x94')));};Preview[_0xa941('0x10')][_0xa941('0x95')]=function(_0x702ce7){_0x702ce7['sendMessageOneNotActive']=!![];if(ut[_0xa941('0x96')](_0x702ce7['loggedIn'])){_0x702ce7[_0xa941('0x4c')]=_0xa941('0x97');}else if(!ut[_0xa941('0x98')](_0x702ce7['dialActive'])){_0x702ce7[_0xa941('0x4c')]=_0xa941('0x59');}else if(!this['isTrunkReachable'](_0x702ce7[_0xa941('0x4e')])){if(!this['isTrunkReachable'](_0x702ce7[_0xa941('0x99')])){_0x702ce7['message']=_0xa941('0x9a');}else{_0x702ce7[_0xa941('0x4c')]=_0xa941('0x9b');}}else{_0x702ce7['message']=_0xa941('0x9b');}emitCampaignPreview(_0x702ce7);};Preview[_0xa941('0x10')][_0xa941('0x9c')]=function(_0x210be4,_0x385288,_0x1c7877){var _0x56832d=this;var _0x2f66a6=this[_0xa941('0x17')][_0x385288];var _0x265c88=this[_0xa941('0x14')][_0x2f66a6['queue']];var _0x2cf0e7;if(_0x265c88){switch(_0x1c7877){case'1':_0x265c88[_0xa941('0x9d')]+=0x1;_0x2f66a6[_0xa941('0x9e')]=ut[_0xa941('0x9f')](_0x2f66a6);ut[_0xa941('0x8d')](_0x2f66a6,0x0,'NoSuchNumber');rpcDb[_0xa941('0x90')](_0x2f66a6,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0x2f66a6)>=_0x265c88['dialGlobalMaxRetry']){_0x2cf0e7=ut[_0xa941('0xa0')](_0x2f66a6,0xf,_0xa941('0xa1'));rpcDb[_0xa941('0xa2')](_0x2cf0e7,_0xa941('0xa3'));}else{rpcDb[_0xa941('0xa2')](_0x2f66a6,_0xa941('0xa3'));}delete this[_0xa941('0x17')][_0x210be4[_0xa941('0xa4')]];break;case _0xa941('0xa5'):var _0x1b46a8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2f66a6[_0xa941('0xa6')]=_0x1b46a8;_0x2f66a6[_0xa941('0xa7')]=_0x1b46a8;_0x2f66a6[_0xa941('0x7b')]=!![];_0x265c88[_0xa941('0x6f')]+=0x1;logger[_0xa941('0x69')](_0xa941('0xa8'),_0x2f66a6[_0xa941('0xa9')],_0xa941('0xaa'),_0x265c88[_0xa941('0x29')],'pTalking:\x20',_0x265c88[_0xa941('0x6f')]);ami[_0xa941('0x27')](_0xa941('0xab'),ut[_0xa941('0xac')](_0x2f66a6,'connect'));if(_0x265c88[_0xa941('0xad')]){ami[_0xa941('0x27')](_0xa941('0xae'),ut[_0xa941('0xaf')](_0x2f66a6));}break;case'16':ami[_0xa941('0x27')](_0xa941('0xb0'),ut[_0xa941('0xac')](_0x2f66a6,_0xa941('0xb1')));emitVoiceQueueChannelRemove(ut[_0xa941('0xac')](_0x2f66a6,_0xa941('0xb1')));_0x265c88['outboundAnswerCallsDay']+=0x1;_0x265c88[_0xa941('0x30')]+=0x1;_0x265c88[_0xa941('0xb2')]+=0x1;ut[_0xa941('0x7c')](_0x265c88,'[16]');_0x2f66a6[_0xa941('0x9e')]=ut[_0xa941('0x9f')](_0x2f66a6);ut[_0xa941('0x8d')](_0x2f66a6,0x4,_0xa941('0xb3'));rpcDb[_0xa941('0x90')](_0x2f66a6,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xa941('0xa2')](_0x2f66a6,_0xa941('0xb4'));rpcDb[_0xa941('0xb5')](_0x2f66a6);_0x265c88[_0xa941('0x2d')]+=_0x2f66a6[_0xa941('0xb6')];_0x265c88[_0xa941('0xb7')]+=_0x2f66a6[_0xa941('0xb6')];logger[_0xa941('0x69')]('[syncHangup][talking][decrement]',_0x2f66a6[_0xa941('0xa9')],_0xa941('0xaa'),_0x265c88[_0xa941('0x29')],_0xa941('0x6e'),_0x265c88[_0xa941('0x6f')]);delete this[_0xa941('0x17')][_0x210be4['linkedid']];break;case'BUSY':_0x265c88['outboundBusyCallsDay']+=0x1;_0x2f66a6['countbusyretry']+=0x1;_0x2f66a6[_0xa941('0x9e')]=ut[_0xa941('0x9f')](_0x2f66a6);ut[_0xa941('0x8d')](_0x2f66a6,0x5,'Busy');rpcDb[_0xa941('0x90')](_0x2f66a6,_0xa941('0xb8'));if(ut['totalGlobal'](_0x2f66a6)>=_0x265c88[_0xa941('0xb9')]){_0x2cf0e7=ut[_0xa941('0xa0')](_0x2f66a6,0xf,_0xa941('0xa1'));rpcDb[_0xa941('0xa2')](_0x2cf0e7,_0xa941('0xba'));}else{if(_0x2f66a6['countbusyretry']>=_0x265c88[_0xa941('0xbb')]){rpcDb[_0xa941('0xa2')](_0x2f66a6,_0xa941('0xb8'));}else{rpcDb[_0xa941('0xbc')](ut[_0xa941('0xbd')](_0x2f66a6,_0xa941('0xbe'),_0x265c88[_0xa941('0xbf')]),_0x2f66a6[_0xa941('0xc0')],_0x2f66a6[_0xa941('0xc1')]);}}break;case _0xa941('0xc2'):_0x265c88['outboundNoAnswerCallsDay']+=0x1;_0x2f66a6['countnoanswerretry']+=0x1;_0x2f66a6[_0xa941('0x9e')]=ut[_0xa941('0x9f')](_0x2f66a6);ut[_0xa941('0x8d')](_0x2f66a6,0x3,_0xa941('0xc3'));rpcDb[_0xa941('0x90')](_0x2f66a6,_0xa941('0xc4'));if(ut[_0xa941('0x9f')](_0x2f66a6)>=_0x265c88[_0xa941('0xb9')]){_0x2cf0e7=ut[_0xa941('0xa0')](_0x2f66a6,0xf,_0xa941('0xa1'));rpcDb[_0xa941('0xa2')](_0x2cf0e7,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2f66a6[_0xa941('0xc5')]>=_0x265c88[_0xa941('0xc6')]){rpcDb[_0xa941('0xa2')](_0x2f66a6,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xa941('0xbd')](_0x2f66a6,_0xa941('0xc5'),_0x265c88['dialNoAnswerRetryFrequency']),_0x2f66a6[_0xa941('0xc0')],_0x2f66a6['activeContact']);}}break;case _0xa941('0xc7'):_0x265c88['outboundCongestionCallsDay']+=0x1;_0x2f66a6[_0xa941('0xc8')]+=0x1;_0x2f66a6[_0xa941('0x9e')]=ut['totalGlobal'](_0x2f66a6);ut[_0xa941('0x8d')](_0x2f66a6,0x8,_0xa941('0xc9'));rpcDb[_0xa941('0x90')](_0x2f66a6,_0xa941('0xca'));if(ut['totalGlobal'](_0x2f66a6)>=_0x265c88[_0xa941('0xb9')]){_0x2cf0e7=ut[_0xa941('0xa0')](_0x2f66a6,0xf,_0xa941('0xa1'));rpcDb['createCustomerFinal'](_0x2cf0e7,_0xa941('0xcb'));}else{if(_0x2f66a6[_0xa941('0xc8')]>=_0x265c88['dialCongestionMaxRetry']){rpcDb[_0xa941('0xa2')](_0x2f66a6,_0xa941('0xca'));}else{rpcDb[_0xa941('0xbc')](ut[_0xa941('0xbd')](_0x2f66a6,_0xa941('0xc8'),_0x265c88[_0xa941('0xbf')]),_0x2f66a6[_0xa941('0xc0')],_0x2f66a6[_0xa941('0xc1')]);}}break;case _0xa941('0xcc'):_0x265c88['outboundRejectCallsDay']+=0x1;_0x2f66a6['countglobal']=ut['totalGlobal'](_0x2f66a6);ut[_0xa941('0x8d')](_0x2f66a6,0x14,'AgentReject');rpcDb['createCustomerHistory'](_0x2f66a6,_0xa941('0xcd'));if(_0x2f66a6['unlockAgent']){rpcDb[_0xa941('0xce')](_0x2f66a6[_0xa941('0xcf')]);}if(_0x2f66a6[_0xa941('0xc1')]){rpcDb['disableContact'](_0x2f66a6[_0xa941('0xcf')]);}break;default:if(_0x2f66a6[_0xa941('0x7b')]){ut[_0xa941('0x7c')](_0x265c88,_0xa941('0xd0'));ut[_0xa941('0x7d')](_0xa941('0xd1')+_0x265c88[_0xa941('0x29')],_0x210be4);}_0x265c88['outboundUnknownCallsDay']+=0x1;_0x2f66a6[_0xa941('0x9e')]=ut[_0xa941('0x9f')](_0x2f66a6);ut['logCustomer'](_0x2f66a6,0xc,_0x210be4['cause-txt']||_0x210be4['dialstatus']);rpcDb['createCustomerHistory'](_0x2f66a6,_0xa941('0xd2'));if(ut[_0xa941('0x9f')](_0x2f66a6)>=_0x265c88[_0xa941('0xb9')]){_0x2cf0e7=ut[_0xa941('0xa0')](_0x2f66a6,0xf,_0xa941('0xa1'));rpcDb[_0xa941('0xa2')](_0x2cf0e7,_0xa941('0xd3'));}else{rpcDb[_0xa941('0xa2')](_0x2f66a6,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xa941('0x17')][_0x210be4[_0xa941('0xa4')]];}if(!(_0x2f66a6['dialAnswer']&&_0x1c7877==='16')){ut[_0xa941('0x79')](_0x265c88,_0xa941('0xd4'));logger[_0xa941('0x69')](_0xa941('0xd5'),_0x2f66a6['uniqueid'],_0xa941('0xaa'),_0x265c88[_0xa941('0x29')],_0xa941('0x6c'),_0x265c88[_0xa941('0x4d')]);}if(_0x1c7877!==_0xa941('0xa5')){delete this[_0xa941('0x17')][_0x210be4[_0xa941('0xa4')]];delete this['actions'][_0x210be4[_0xa941('0xd6')]];}}};Preview['prototype'][_0xa941('0xd7')]=function(_0x1b3ecf,_0x1e47a1,_0x5a7d26){if(_[_0xa941('0xd8')](_0x1e47a1)&&_0xa941('0xd9')!==typeof _0x1e47a1){return;}if(_[_0xa941('0xd8')](_0x5a7d26)&&_0xa941('0xd9')!==typeof _0x5a7d26){return;}switch(_0x5a7d26[_0xa941('0xda')]){case'0':ut[_0xa941('0xdb')](_0x1b3ecf,0x0,'NoSuchNumber');rpcDb[_0xa941('0xdc')](_0x1b3ecf,_0xa941('0xdd'));break;case'3':ut[_0xa941('0xdb')](_0x1b3ecf,0x3,_0xa941('0xc3'));rpcDb['createAgentHistory'](_0x1b3ecf,_0xa941('0xde'));break;case'5':ut[_0xa941('0xdb')](_0x1b3ecf,0x5,'Busy');rpcDb['createAgentHistory'](_0x1b3ecf,_0xa941('0xdf'));break;case'8':ut[_0xa941('0xdb')](_0x1b3ecf,0x8,_0xa941('0xc9'));rpcDb[_0xa941('0xdc')](_0x1b3ecf,_0xa941('0xe0'));break;case'22':ut[_0xa941('0xdb')](_0x1b3ecf,0x16,_0xa941('0xe1'));rpcDb[_0xa941('0xdc')](_0x1b3ecf,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xa941('0xdb')](_0x1b3ecf,0xc,_0x5a7d26[_0xa941('0xda')]);rpcDb[_0xa941('0xdc')](_0x1b3ecf,'[callProgressDetectingAgent][logCongestion]');}ut[_0xa941('0x79')](_0x1e47a1,_0xa941('0xe2'));logger[_0xa941('0x69')](_0xa941('0xe3'),_0x1b3ecf[_0xa941('0xa9')],_0xa941('0xaa'),_0x1e47a1[_0xa941('0x29')],_0xa941('0x6c'),_0x1e47a1[_0xa941('0x4d')]);delete this[_0xa941('0x17')][_0x1b3ecf[_0xa941('0xa9')]];};Preview[_0xa941('0x10')][_0xa941('0xe4')]=function(_0xa88d4f,_0x454bbf,_0xe532c6,_0x4019ac,_0x45ad2f){var _0x19681e=this;return new BPromise(function(_0x43ab6f,_0x5fbe9f){if(_['isNil'](_0x454bbf)||_[_0xa941('0x68')](_0x454bbf['Contact'])||_[_0xa941('0x68')](_0x454bbf[_0xa941('0xe5')]['phone'])||_[_0xa941('0x68')](_0x454bbf[_0xa941('0x72')])){_0x5fbe9f(ut[_0xa941('0x4c')](_0xa941('0xe6'),_0x4019ac,_0x45ad2f));return;}var _0x236e9e=uuid['v4']();var _0xa7fafd=_0x19681e[_0xa941('0x14')][_0x454bbf[_0xa941('0x6b')][_0xa941('0x29')]];var _0x5b2668=_0xe532c6?_0x19681e['agents'][_0xe532c6]['id']:undefined;_0x19681e[_0xa941('0x17')][_0x236e9e]=new Action(_0x454bbf,_0xa7fafd,_0x236e9e,_0xe532c6,_0x5b2668);var _0x5c8daf=_0x19681e[_0xa941('0x17')][_0x236e9e];_0x5c8daf[_0xa941('0xc0')]=_0x4019ac;_0x5c8daf[_0xa941('0xc1')]=_0x45ad2f;_0x5c8daf[_0xa941('0xe7')]=_0xe532c6;if(_[_0xa941('0xe8')](_0xa88d4f)){_0x19681e['execCall'](_0x5c8daf,_0xa7fafd,_0x454bbf,_0xe532c6)[_0xa941('0x83')](function(_0x4cac29){logger[_0xa941('0x69')](_0xa941('0xe9'),_0xa941('0xea')+_0x5c8daf['queue']+_0xa941('0xeb')+_0x5c8daf['idContact'],JSON['stringify'](_0x4cac29));ami[_0xa941('0x27')](_0xa941('0xec'),ut[_0xa941('0xac')](_0x5c8daf,_0xa941('0xed')));_0x43ab6f(ut[_0xa941('0x4c')](_0xa941('0xee')));})[_0xa941('0x77')](function(_0x20dc51){ut[_0xa941('0x5a')]('[Preview][execCall][failure]',_0x20dc51);_0x5fbe9f(ut[_0xa941('0x4c')](_0xa941('0xef'),_0x4019ac,_0x45ad2f));});}else{_0xa7fafd['outboundBlacklistCallsDay']+=0x1;ut[_0xa941('0xf0')](_0x5c8daf);rpcDb[_0xa941('0xf1')](_0x5c8daf,_0xa941('0xf2'));delete _0x19681e['actions'][_0x236e9e];_0x5fbe9f(ut[_0xa941('0x4c')](_0xa941('0xf3'),_0x4019ac,_0x45ad2f));}});};Preview[_0xa941('0x10')][_0xa941('0xf4')]=function(_0x3fc7e4){return!_[_0xa941('0x68')](_0x3fc7e4)&&!_[_0xa941('0x68')](_0x3fc7e4['name'])&&!_[_0xa941('0x68')](_0x3fc7e4[_0xa941('0x4f')])&&_0x3fc7e4[_0xa941('0x4f')]&&!_['isNil'](this[_0xa941('0x16')][util[_0xa941('0x53')](_0xa941('0xf5'),_0x3fc7e4[_0xa941('0x29')])])&&!_['isNil'](this[_0xa941('0x16')][util[_0xa941('0x53')](_0xa941('0xf5'),_0x3fc7e4[_0xa941('0x29')])]['status'])&&(this[_0xa941('0x16')][util[_0xa941('0x53')](_0xa941('0xf5'),_0x3fc7e4['name'])][_0xa941('0x75')]===_0xa941('0xf6')||this['trunks'][util[_0xa941('0x53')](_0xa941('0xf5'),_0x3fc7e4[_0xa941('0x29')])][_0xa941('0x75')]===_0xa941('0xf7'));};Preview[_0xa941('0x10')][_0xa941('0xf8')]=function(_0x4c7e0d,_0x166041){var _0x8f48e4=this;return new BPromise(function(_0x37df58,_0x4c3058){_0x8f48e4['execRun'](_0x4c7e0d,_0x166041)['then'](function(_0x5084ab){_0x37df58(_['pick'](_0x5084ab,[_0xa941('0x4c')]));})[_0xa941('0x77')](function(_0x187209){if(_0x187209[_0xa941('0xf9')]){rpcDb[_0xa941('0xce')](_0x4c7e0d);}if(_0x187209[_0xa941('0x4f')]){rpcDb[_0xa941('0xfa')](_0x4c7e0d);}_0x4c3058(_['pick'](_0x187209,['message']));});});};Preview[_0xa941('0x10')][_0xa941('0xfb')]=function(_0x524ef0,_0x515d62){var _0x10b00a=this;return new BPromise(function(_0x53a3e2,_0x208d80){var _0x28652a,_0x13b738;rpcDb[_0xa941('0xfc')](_0x524ef0)[_0xa941('0x83')](function(_0x22713e){if(!_[_0xa941('0x68')](_0x22713e[0x0])){_0x13b738=_0x22713e[0x0][_0xa941('0xfd')]?![]:!![];_0x28652a=_0x22713e[0x0]['recallme']?!![]:![];_0x28652a=_0x515d62?!![]:_0x28652a;}var _0x15117b=_0x10b00a[_0xa941('0xfe')](_0x22713e);if(_0x15117b[_0xa941('0xff')]){rpcDb[_0xa941('0x100')](_[_0xa941('0x70')](_0x22713e[0x0],[_0xa941('0x72'),_0xa941('0x101')]))['then'](function(_0x1c1592){_0x10b00a[_0xa941('0xe4')](_0x1c1592,_0x22713e[0x0],_0x515d62,_0x13b738,_0x28652a)[_0xa941('0x83')](function(_0x569c72){_0x53a3e2(_0x569c72);})[_0xa941('0x77')](function(_0x493318){_0x208d80(_0x493318);});})[_0xa941('0x77')](function(_0x4053e2){ut['logger']('[Preview][checkIsBlackList]',_0x4053e2);_0x208d80(ut[_0xa941('0x4c')](_0xa941('0x102'),_0x13b738,_0x28652a));});}else{_0x208d80(ut[_0xa941('0x4c')](_0x15117b['message'],_0x13b738,_0x28652a));}})['catch'](function(_0x206007){ut['logger']('[Preview][getContactPreview]',_0x206007);_0x208d80(ut[_0xa941('0x4c')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xa941('0x10')][_0xa941('0xfe')]=function(_0x2a0651){if(_['isNil'](_0x2a0651)||_['isEmpty'](_0x2a0651)||!_[_0xa941('0x68')](_0x2a0651[0x0]['Agent'])&&_[_0xa941('0x68')](_0x2a0651[0x0][_0xa941('0x103')][_0xa941('0x29')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x2a0651);return{'isValid':![],'message':_0xa941('0x104')};}var _0x1150e4=this['campaignsPreview'][_0x2a0651[0x0][_0xa941('0x6b')][_0xa941('0x29')]];_0x1150e4['message']=_0xa941('0x9b');if(_[_0xa941('0x68')](_0x1150e4)){ut[_0xa941('0x5a')](_0xa941('0x105'),_0x1150e4);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x1150e4[_0xa941('0x4e')])){ut[_0xa941('0x5a')](_0xa941('0x106'),'campaign\x20Name:\x20'+_0x1150e4[_0xa941('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xa941('0xf4')](_0x1150e4[_0xa941('0x99')])){ut[_0xa941('0x5a')](_0xa941('0x106'),_0x1150e4[_0xa941('0x29')]+_0xa941('0x107'));return{'isValid':![],'message':_0xa941('0x108')};}}if(!ut['isActive'](_0x1150e4[_0xa941('0x35')])){ut[_0xa941('0x5a')](_0xa941('0x109'),_0x1150e4[_0xa941('0x29')]+_0xa941('0x10a'));return{'isValid':![],'message':_0xa941('0x10b')+_0x1150e4[_0xa941('0x29')]+_0xa941('0x10a')};}return{'isValid':!![],'message':_0xa941('0x10c')};};Preview[_0xa941('0x10')]['execCall']=function(_0x5b6301,_0x5f2c54,_0x129f90,_0x1547db){var _0x4e60f1=this;return new BPromise(function(_0x38e0cf,_0x466ff1){var _0x378913=_0x5b6301[_0xa941('0xa9')];var _0x1d3308=_0x4e60f1[_0xa941('0xf4')](_0x5f2c54[_0xa941('0x4e')])?util[_0xa941('0x53')]('SIP/%s/%s%s',_0x5f2c54[_0xa941('0x4e')][_0xa941('0x29')],_[_0xa941('0x68')](_0x5f2c54['dialPrefix'])?'':_0x5f2c54[_0xa941('0x10d')][_0xa941('0x10e')]()||'',_0x5f2c54[_0xa941('0x10f')]>0x0?_0x129f90[_0xa941('0xe5')][_0xa941('0x110')]['substring'](_0x5f2c54[_0xa941('0x10f')]):_0x129f90[_0xa941('0xe5')][_0xa941('0x110')]):util[_0xa941('0x53')](_0xa941('0x111'),_['isNil'](_0x5f2c54[_0xa941('0x99')])?_0x5f2c54[_0xa941('0x4e')]['name']:_0x5f2c54['TrunkBackup']['name'],_[_0xa941('0x68')](_0x5f2c54['dialPrefix'])?'':_0x5f2c54['dialPrefix'][_0xa941('0x10e')]()||'',_0x5f2c54[_0xa941('0x10f')]>0x0?_0x129f90[_0xa941('0xe5')][_0xa941('0x110')][_0xa941('0x112')](_0x5f2c54[_0xa941('0x10f')]):_0x129f90[_0xa941('0xe5')][_0xa941('0x110')]);var _0x187416=_0x4e60f1['isTrunkReachable'](_0x5f2c54[_0xa941('0x4e')])?ut[_0xa941('0x113')](_0x5f2c54[_0xa941('0x4e')]['callerid'],_0x5f2c54[_0xa941('0x114')],_0x5f2c54[_0xa941('0x115')]>0x0?ut[_0xa941('0x116')](_0x5f2c54[_0xa941('0x36')],_0x5f2c54[_0xa941('0x115')]):_0x5f2c54[_0xa941('0x36')]):ut[_0xa941('0x113')](_[_0xa941('0x68')](_0x5f2c54['TrunkBackup'])?_0x5f2c54[_0xa941('0x4e')][_0xa941('0x50')]:_0x5f2c54['TrunkBackup'][_0xa941('0x50')],_0x5f2c54['dialOriginateCallerIdName'],_0x5f2c54[_0xa941('0x115')]>0x0?ut[_0xa941('0x116')](_0x5f2c54[_0xa941('0x36')],_0x5f2c54[_0xa941('0x115')]):_0x5f2c54['dialOriginateCallerIdNumber']);if(_0x187416){_0x5b6301[_0xa941('0x117')]=ut[_0xa941('0x118')](_0x187416);_0x5b6301['originatecalleridnum']=ut['extractCalleridNumber'](_0x187416);}var _0x2288ba=ut[_0xa941('0x119')](_0x5f2c54,_0x129f90,_0x1d3308,_0x187416,_0x378913,_0x5b6301);_['merge'](_0x5b6301,ut[_0xa941('0x11a')](_0x2288ba));_0x5b6301[_0xa941('0x8a')]=moment()[_0xa941('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xa941('0x74')](ut[_0xa941('0x11b')](_0x5b6301,_0x5f2c54,_0x2288ba,_0x5b6301[_0xa941('0xc1')],_0x1547db))[_0xa941('0x83')](function(_0x30165e){_0x5f2c54[_0xa941('0x4d')]+=0x1;logger[_0xa941('0x69')](_0xa941('0x11c'),_0x378913,_0xa941('0xaa'),_0x5f2c54[_0xa941('0x29')],_0xa941('0x6c'),_0x5f2c54[_0xa941('0x4d')]);_0x38e0cf(_0x30165e);})[_0xa941('0x77')](function(_0x3d9ae1){ut[_0xa941('0xdb')](_0x5b6301,0xe,_0xa941('0x11d'));rpcDb[_0xa941('0xdc')](_0x5b6301,'[originateFailure][logOriginateFailure]');_0x466ff1(_0x3d9ae1);});});};Preview[_0xa941('0x10')][_0xa941('0x21')]=function(_0x212b7a){if(this[_0xa941('0x17')][_0x212b7a[_0xa941('0xa4')]]){this[_0xa941('0x17')][_0x212b7a[_0xa941('0xa4')]][_0xa941('0x76')]=_0x212b7a[_0xa941('0x76')];}};Preview[_0xa941('0x10')][_0xa941('0x1a')]=function(_0x45dba1){var _0x157f2c=this;var _0x27b465=this[_0xa941('0x17')][_0x45dba1['actionid']];if(_0x27b465){if(_0x27b465['lookAgent']&&this['agents'][_0x27b465[_0xa941('0xe7')]]){ut[_0xa941('0x11e')](_0x27b465,this[_0xa941('0x18')][_0x27b465[_0xa941('0xe7')]][_0xa941('0x29')],this['agents'][_0x27b465[_0xa941('0xe7')]]['id']);}var _0x17ae2f=_[_0xa941('0x11f')](_0x27b465);_0x17ae2f['responsetime']=moment()[_0xa941('0x53')](_0xa941('0x8b'));var _0x1e93b8=_0x157f2c[_0xa941('0x14')][_0x27b465['queue']];if(ut[_0xa941('0x120')](_0x45dba1[_0xa941('0x121')])){if(_0x27b465[_0xa941('0xc0')]){rpcDb[_0xa941('0xce')](_0x27b465[_0xa941('0xcf')]);}if(_0x27b465[_0xa941('0xc1')]){rpcDb[_0xa941('0xfa')](_0x27b465[_0xa941('0xcf')]);}ami[_0xa941('0x27')]('custom:agentringnoanswer',ut[_0xa941('0xac')](_0x27b465,'rejected'));this[_0xa941('0xd7')](_0x17ae2f,_0x1e93b8,_0x45dba1);}else{_0x27b465['starttime']=moment()[_0xa941('0x53')](_0xa941('0x8b'));ut[_0xa941('0xdb')](_0x17ae2f,0x4,_0xa941('0xb3'));rpcDb['createAgentHistory'](_0x17ae2f,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x1eef7b){var _0x55a0d0=this;var _0x480b99=this[_0xa941('0x17')][_0x1eef7b[_0xa941('0xa4')]];var _0x1d7935;if(_0x480b99){_0x1d7935=this[_0xa941('0x14')][_0x480b99['queue']];logger[_0xa941('0x69')](_0xa941('0x122'),_0x1eef7b[_0xa941('0xa4')],'\x20Queue',_0x1d7935[_0xa941('0x29')],_0xa941('0x6e'),_0x1d7935[_0xa941('0x6f')]);}if(this['actions'][_0x1eef7b[_0xa941('0xa4')]]&&_0x1eef7b[_0xa941('0xa4')]!==_0x1eef7b[_0xa941('0xa9')]){if(_0x1eef7b[_0xa941('0x123')]==='16'&&this[_0xa941('0x17')][_0x1eef7b[_0xa941('0xa4')]][_0xa941('0x7b')]){this['callProgressDetectingCustomer'](_0x1eef7b,_0x1eef7b[_0xa941('0xa4')],_0x1eef7b[_0xa941('0x123')]);}else if(this[_0xa941('0x17')][_0x1eef7b[_0xa941('0xa4')]][_0xa941('0x7b')]){logger[_0xa941('0x69')](_0xa941('0x124'),_0x1eef7b['linkedid'],_0x1eef7b[_0xa941('0x123')],'\x20Queue',_0x1d7935[_0xa941('0x29')],_0xa941('0x6e'),_0x1d7935[_0xa941('0x6f')]);this[_0xa941('0x9c')](_0x1eef7b,_0x1eef7b[_0xa941('0xa4')],_0x1eef7b[_0xa941('0x123')]);}}else if(_0x480b99&&_[_0xa941('0x68')](_0x480b99[_0xa941('0x125')])&&_0x1d7935[_0xa941('0x126')]&&_0x1eef7b[_0xa941('0xa4')]===_0x1eef7b[_0xa941('0xa9')]&&_[_0xa941('0x68')](_0x1eef7b[_0xa941('0xda')])&&_0x1eef7b[_0xa941('0x123')]==='16'&&_0x1eef7b[_0xa941('0x127')]==='6'&&_['isUndefined'](_0x480b99['transfer'])){if(_0x480b99[_0xa941('0xc0')]){rpcDb[_0xa941('0xce')](_0x480b99[_0xa941('0xcf')]);}if(_0x480b99[_0xa941('0xc1')]){rpcDb[_0xa941('0xfa')](_0x480b99[_0xa941('0xcf')]);}_0x1eef7b[_0xa941('0xda')]='22';this[_0xa941('0xd7')](_0x480b99,_0x1d7935,_0x1eef7b);}else if(_0x480b99&&_0x480b99[_0xa941('0x128')]){if(_0x1eef7b['cause']==='16'&&this[_0xa941('0x17')][_0x1eef7b[_0xa941('0xa4')]][_0xa941('0x7b')]){logger['info'](_0xa941('0x129'),_0x1eef7b[_0xa941('0xa4')],_0x1eef7b[_0xa941('0x123')],_0xa941('0xaa'),_0x1d7935[_0xa941('0x29')],_0xa941('0x6e'),_0x1d7935[_0xa941('0x6f')]);this['callProgressDetectingCustomer'](_0x1eef7b,_0x1eef7b[_0xa941('0xa4')],_0x1eef7b[_0xa941('0x123')]);}else if(this[_0xa941('0x17')][_0x1eef7b[_0xa941('0xa4')]][_0xa941('0x7b')]){logger['info'](_0xa941('0x124'),_0x1eef7b[_0xa941('0xa4')],_0x1eef7b[_0xa941('0x123')],_0xa941('0xaa'),_0x1d7935['name'],'pTalking:\x20',_0x1d7935[_0xa941('0x6f')]);this[_0xa941('0x9c')](_0x1eef7b,_0x1eef7b['linkedid'],_0x1eef7b[_0xa941('0x123')]);}}};Preview[_0xa941('0x10')]['syncDialEnd']=function(_0x22645f){if(this[_0xa941('0x17')][_0x22645f[_0xa941('0xd6')]]&&_0x22645f['destlinkedid']!==_0x22645f[_0xa941('0x12a')]){this[_0xa941('0x9c')](_0x22645f,_0x22645f[_0xa941('0xd6')],_0x22645f[_0xa941('0x12b')]);}};Preview[_0xa941('0x10')]['syncHangupRequest']=function(_0x1cabce){if(this[_0xa941('0x17')][_0x1cabce[_0xa941('0xa4')]]&&_0x1cabce[_0xa941('0xa4')]!==_0x1cabce[_0xa941('0xa9')]&&!this[_0xa941('0x17')][_0x1cabce['linkedid']][_0xa941('0x7b')]){if(_0x1cabce[_0xa941('0x123')]==='1'){this[_0xa941('0x9c')](_0x1cabce,_0x1cabce[_0xa941('0xa4')],_0x1cabce[_0xa941('0x123')]);}}};Preview[_0xa941('0x10')][_0xa941('0x12c')]=function(_0x57ff4f,_0x404fe3,_0x31f46e){if(this[_0xa941('0x17')][_0x57ff4f]){if(_[_0xa941('0x68')](this[_0xa941('0x17')][_0x57ff4f][_0xa941('0x12d')])){this[_0xa941('0x17')][_0x57ff4f][_0xa941('0x12d')]={};}this[_0xa941('0x17')][_0x57ff4f][_0xa941('0x12d')][_0x404fe3]=_0x31f46e;}};Preview[_0xa941('0x10')][_0xa941('0x22')]=function(_0xa61b){try{if(!_[_0xa941('0x68')](_0xa61b)){if(ut['filterKey'](_[_0xa941('0x12e')](_0xa61b[_0xa941('0x12f')])[0x0])){this[_0xa941('0x12c')](_0xa61b[_0xa941('0xa9')],_[_0xa941('0x12e')](_0xa61b[_0xa941('0x12f')])[0x0],_0xa61b[_0xa941('0x130')]);}}}catch(_0x537248){logger['error'](_0xa941('0x131'),util[_0xa941('0x132')](_0x537248,{'showHidden':![],'depth':null}));}};Preview[_0xa941('0x10')][_0xa941('0x24')]=function(_0x4492d7){if(_0x4492d7){if(this['actions'][_0x4492d7[_0xa941('0x133')]]){this[_0xa941('0x17')][_0x4492d7['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xa941('0x10')][_0xa941('0x26')]=function(_0x5e1e57){if(_0x5e1e57){if(this[_0xa941('0x17')][_0x5e1e57[_0xa941('0x134')]]){this[_0xa941('0x17')][_0x5e1e57[_0xa941('0x134')]]['transfer']=!![];}}};module[_0xa941('0x135')]=Preview; \ No newline at end of file +var _0xe917=['decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','getContactRecallMe','agentReadyId','length','getDiff','dialRecallMeTimeout','run','then','[RecallMe]','logger2','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','uniqueid','acw','custom:agentcomplete','buildObj','complete','Answer','[callProgressDetectingCustomer][logAnswer]','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','unlockAgent','NOANSWER','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','scheduledAt','CANCEL','AgentReject','[syncHangupRequest][logAgentReject]','unlockContact','idContact','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated','destlinkedid','object','createAgentHistory','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','isEmpty','execCall','emit','custom:agentcalled','called','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','unmonitored','execRun','unlock','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','Agent','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','\x20Queue','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','lookAgent','logLookAgent','clone','response','rejected','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','variable','error','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','lodash','bluebird','uuid','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncBlindTransfer','loopCampaigns','type','name','strategy','answered','available','loggedIn','pTalking','sumHoldTime','total','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','Trunk','active','callerid','Interval','md5','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','hasOwnProperty','outbound','setMessage','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','stringify','pick','contactId','UserId','ListId','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe917,0x1e5));var _0x7e91=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xe917[_0xa6cc5c];return _0x44803d;};'use strict';var util=require('util');var _=require(_0x7e91('0x0'));var BPromise=require(_0x7e91('0x1'));var uuid=require(_0x7e91('0x2'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x7e91('0x3'));var config=require(_0x7e91('0x4'));var logger=require(_0x7e91('0x5'))(_0x7e91('0x6'));var loggerAction=require(_0x7e91('0x5'))(_0x7e91('0x7'));var ami=require(_0x7e91('0x8'));var rpcDb=require(_0x7e91('0x9'));var Action=require('./action');var ut=require(_0x7e91('0xa'));config[_0x7e91('0xb')]=_[_0x7e91('0xc')](config['redis'],{'host':_0x7e91('0xd'),'port':0x18eb});var io=require(_0x7e91('0xe'))(new Redis(config[_0x7e91('0xb')]));var Sequence=function(){};Sequence[_0x7e91('0xf')][_0x7e91('0x10')]=function(_0x1ef91b){this[_0x7e91('0x11')]=this['tail']?this[_0x7e91('0x11')][_0x7e91('0x12')](_0x1ef91b):_0x1ef91b();};function Preview(_0x58843e){this[_0x7e91('0x13')]=new Sequence();this[_0x7e91('0x14')]=_0x58843e['voiceQueues'];this[_0x7e91('0x15')]=_0x58843e[_0x7e91('0x15')];this[_0x7e91('0x16')]={};this[_0x7e91('0x17')]=_0x58843e['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0x7e91('0x18'),this['syncOriginateResponse'][_0x7e91('0x19')](this));ami['on'](_0x7e91('0x1a'),this[_0x7e91('0x1b')]['bind'](this));ami['on'](_0x7e91('0x1c'),this[_0x7e91('0x1d')][_0x7e91('0x19')](this));ami['on'](_0x7e91('0x1e'),this[_0x7e91('0x1f')][_0x7e91('0x19')](this));ami['on'](_0x7e91('0x20'),this[_0x7e91('0x21')][_0x7e91('0x19')](this));ami['on'](_0x7e91('0x22'),this[_0x7e91('0x23')][_0x7e91('0x19')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x7e91('0x19')](this));ami['on']('blindtransfer',this[_0x7e91('0x24')][_0x7e91('0x19')](this));this[_0x7e91('0x25')](this[_0x7e91('0x14')]);}function emit(_0x1f7dba,_0x469efc,_0xd625ac){io['to'](_0x1f7dba)['emit'](_0x469efc,_0xd625ac);}function emitCampaignPreview(_0x416a67){if(_0x416a67[_0x7e91('0x26')]==='outbound'){var _0xe446e9={'id':_0x416a67['id'],'name':_0x416a67[_0x7e91('0x27')],'strategy':_0x416a67[_0x7e91('0x28')],'answered':_0x416a67[_0x7e91('0x29')],'available':_0x416a67[_0x7e91('0x2a')],'loggedIn':_0x416a67[_0x7e91('0x2b')],'pTalking':_0x416a67[_0x7e91('0x2c')],'sumBillable':_0x416a67['sumBillable'],'sumDuration':_0x416a67['sumDuration'],'sumHoldTime':_0x416a67[_0x7e91('0x2d')]||0x0,'talking':_0x416a67['talking'],'total':_0x416a67[_0x7e91('0x2e')],'type':_0x416a67['type'],'unmanaged':_0x416a67[_0x7e91('0x2f')],'abandoned':_0x416a67['abandoned'],'waiting':_0x416a67[_0x7e91('0x30')],'loggedInDb':_0x416a67['loggedInDb'],'dialActive':_0x416a67[_0x7e91('0x31')],'dialMethod':_0x416a67[_0x7e91('0x32')],'dialOriginateCallerIdName':_0x416a67['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x416a67[_0x7e91('0x33')],'dialOriginateTimeout':_0x416a67[_0x7e91('0x34')],'dialPrefix':_0x416a67['dialPrefix'],'outboundAnswerAgiCallsDay':_0x416a67[_0x7e91('0x35')],'outboundAnswerCallsDay':_0x416a67[_0x7e91('0x36')],'outboundBlacklistCallsDay':_0x416a67[_0x7e91('0x37')],'outboundBusyCallsDay':_0x416a67['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x416a67[_0x7e91('0x38')],'outboundDropCallsDayACS':_0x416a67['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x416a67['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x416a67[_0x7e91('0x39')],'outboundNoAnswerCallsDay':_0x416a67[_0x7e91('0x3a')],'outboundNoSuchCallsDay':_0x416a67[_0x7e91('0x3b')],'outboundOriginateFailureCallsDay':_0x416a67[_0x7e91('0x3c')],'outboundReCallsDay':_0x416a67[_0x7e91('0x3d')],'outboundRejectCallsDay':_0x416a67['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x416a67[_0x7e91('0x3e')],'predictiveIntervalAnsweredCalls':_0x416a67[_0x7e91('0x3f')],'predictiveIntervalAvgHoldtime':_0x416a67['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x416a67[_0x7e91('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x416a67['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x416a67[_0x7e91('0x41')],'predictiveIntervalErlangCalls':_0x416a67['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x416a67[_0x7e91('0x42')],'predictiveIntervalHitRate':_0x416a67[_0x7e91('0x43')],'predictiveIntervalLowerLimit':_0x416a67[_0x7e91('0x44')],'predictiveIntervalMultiplicativeFactor':_0x416a67['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x416a67[_0x7e91('0x45')],'predictiveIntervalTotalCalls':_0x416a67[_0x7e91('0x46')],'message':_0x416a67[_0x7e91('0x47')],'originated':_0x416a67['originated']};if(_0x416a67[_0x7e91('0x48')]){_0xe446e9[_0x7e91('0x48')]={'id':_0x416a67[_0x7e91('0x48')]['id'],'name':_0x416a67[_0x7e91('0x48')][_0x7e91('0x27')],'active':_0x416a67[_0x7e91('0x48')][_0x7e91('0x49')],'callerid':_0x416a67['Trunk'][_0x7e91('0x4a')]};}if(_0x416a67[_0x7e91('0x4b')]){_0xe446e9['Interval']={'id':_0x416a67['Interval']['id'],'name':_0x416a67[_0x7e91('0x4b')][_0x7e91('0x27')]};}var _0x5de3aa=md5(JSON['stringify'](_0xe446e9));if(_0x416a67[_0x7e91('0x4c')]!==_0x5de3aa){_0x416a67[_0x7e91('0x4c')]=_0x5de3aa;emit(util[_0x7e91('0x4d')](_0x7e91('0x4e'),_0xe446e9[_0x7e91('0x27')]),_0x7e91('0x4f'),_0xe446e9);}}}function emitVoiceQueueChannelRemove(_0x342016){emit(util[_0x7e91('0x4d')](_0x7e91('0x4e'),_0x342016[_0x7e91('0x27')]),_0x7e91('0x50'),_0x342016);}function notSendMessagesQueue(_0x1912ec){if(_0x1912ec[_0x7e91('0x51')]){if(_0x1912ec['originated']===0x0&&_0x1912ec['pTalking']===0x0){_0x1912ec['sendMessageOneNotActive']=![];_0x1912ec[_0x7e91('0x2a')]=0x0;_0x1912ec[_0x7e91('0x52')]=0x0;_0x1912ec[_0x7e91('0x47')]=_0x7e91('0x53');ut[_0x7e91('0x54')](_0x7e91('0x55'),_0x1912ec['name']+_0x7e91('0x56'));}else{_0x1912ec[_0x7e91('0x47')]=_0x7e91('0x57');ut[_0x7e91('0x54')](_0x7e91('0x55'),_0x1912ec[_0x7e91('0x27')]+_0x7e91('0x58'));}emitCampaignPreview(_0x1912ec);}}Preview['prototype'][_0x7e91('0x25')]=function(){var _0x197af4=this;setInterval(function(){_0x197af4[_0x7e91('0x59')]();},0x7cf);};Preview['prototype'][_0x7e91('0x59')]=function(){var _0x4fc5af=this[_0x7e91('0x14')];this[_0x7e91('0x5a')]+=0x1;for(var _0x324f6f in _0x4fc5af){if(_0x4fc5af[_0x7e91('0x5b')](_0x324f6f)&&(_0x4fc5af[_0x324f6f][_0x7e91('0x32')]===_0x7e91('0x6')||_0x4fc5af[_0x324f6f][_0x7e91('0x32')]==='booked')&&_0x4fc5af[_0x324f6f][_0x7e91('0x26')]==='outbound'){if(this[_0x7e91('0x5a')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x4fc5af['hasOwnProperty'](_0x324f6f)&&_0x4fc5af[_0x324f6f][_0x7e91('0x32')]===_0x7e91('0x6')&&_0x4fc5af[_0x324f6f]['type']===_0x7e91('0x5c')){if(_0x4fc5af[_0x324f6f][_0x7e91('0x31')]){this[_0x7e91('0x5d')](_0x4fc5af[_0x324f6f]);this[_0x7e91('0x5e')](_0x4fc5af[_0x324f6f]);}else{notSendMessagesQueue(_0x4fc5af[_0x324f6f]);}}}};Preview[_0x7e91('0xf')][_0x7e91('0x5f')]=function(_0x2fc372){var _0x5b8a20=this;this['sequence'][_0x7e91('0x10')](function(){if(!_[_0x7e91('0x60')](_0x5b8a20[_0x7e91('0x16')][_0x2fc372])){loggerAction[_0x7e91('0x61')](_0x7e91('0x62'),_0x2fc372,'Queue',_0x5b8a20[_0x7e91('0x16')][_0x2fc372][_0x7e91('0x63')],_0x7e91('0x64'),JSON['stringify'](_0x5b8a20['campaignsPreview'][_0x5b8a20[_0x7e91('0x16')][_0x2fc372][_0x7e91('0x63')]]['originated']),_0x7e91('0x65'),JSON[_0x7e91('0x66')](_0x5b8a20[_0x7e91('0x14')][_0x5b8a20[_0x7e91('0x16')][_0x2fc372]['queue']][_0x7e91('0x2c')]),JSON[_0x7e91('0x66')](_0x5b8a20[_0x7e91('0x16')][_0x2fc372]['dialAnswer']),JSON[_0x7e91('0x66')](_[_0x7e91('0x67')](_0x5b8a20[_0x7e91('0x16')][_0x2fc372],[_0x7e91('0x68'),_0x7e91('0x69'),'VoiceQueueId',_0x7e91('0x6a')])));return ami['Action']({'action':'status','channel':_0x5b8a20[_0x7e91('0x16')][_0x2fc372][_0x7e91('0x6b')]})[_0x7e91('0x6c')](function(_0xb7df05){if(_0xb7df05[_0x7e91('0x47')]===_0x7e91('0x6d')){setTimeout(function(){if(_0x5b8a20[_0x7e91('0x16')][_0x2fc372]){ut[_0x7e91('0x6e')](_0x5b8a20['campaignsPreview'][_0x5b8a20[_0x7e91('0x16')][_0x2fc372][_0x7e91('0x63')]],_0x7e91('0x6f'));if(_0x5b8a20[_0x7e91('0x16')][_0x2fc372][_0x7e91('0x70')]===!![]){ut[_0x7e91('0x71')](_0x5b8a20['campaignsPreview'][_0x5b8a20[_0x7e91('0x16')][_0x2fc372][_0x7e91('0x63')]],_0x7e91('0x6f'));ut[_0x7e91('0x72')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2fc372,_0x5b8a20[_0x7e91('0x16')][_0x2fc372][_0x7e91('0x63')]);}ut[_0x7e91('0x72')](_0x7e91('0x73')+_0x2fc372,_0x5b8a20['actions'][_0x2fc372][_0x7e91('0x63')]);delete _0x5b8a20[_0x7e91('0x16')][_0x2fc372];}},0x2328);}});}});};Preview[_0x7e91('0xf')][_0x7e91('0x74')]=function(){var _0x5eee4b=this;loggerAction['info'](_0x7e91('0x75'),_['size'](this['actions']));for(var _0x15a84b in this[_0x7e91('0x16')]){if(_0x5eee4b['actions']['hasOwnProperty'](_0x15a84b)){_0x5eee4b['clearZombieChannel'](_0x15a84b);}}};Preview[_0x7e91('0xf')]['recallMe']=function(_0x39a270){var _0x593809=this;rpcDb[_0x7e91('0x76')](_0x39a270['id'],ut[_0x7e91('0x77')](this['agents']))['then'](function(_0x29b71c){if(!_['isNil'](_0x29b71c)){for(var _0x510c6c=0x0;_0x510c6c<_0x29b71c[_0x7e91('0x78')];_0x510c6c+=0x1){if(ut[_0x7e91('0x79')](_0x29b71c[_0x510c6c]['scheduledat'])<_0x39a270[_0x7e91('0x7a')]*0x3c){_0x593809[_0x7e91('0x7b')](_0x29b71c[_0x510c6c]['id'])[_0x7e91('0x7c')](ut['logger2'](_0x7e91('0x7d')))['catch'](ut[_0x7e91('0x7e')](_0x7e91('0x7d')));}else{var _0x51a21b=new Action(_0x29b71c[_0x510c6c],_0x39a270);_0x51a21b[_0x7e91('0x7f')]=moment()[_0x7e91('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x39a270[_0x7e91('0x3d')]+=0x1;ut[_0x7e91('0x80')](_0x51a21b,0x17,_0x7e91('0x81'));if(_0x39a270[_0x7e91('0x82')]){rpcDb[_0x7e91('0x83')](ut[_0x7e91('0x84')](_0x29b71c[_0x510c6c]));rpcDb[_0x7e91('0x85')](_0x51a21b,_0x7e91('0x86'));}else{ut[_0x7e91('0x80')](_0x51a21b,0x16,_0x7e91('0x87'));rpcDb[_0x7e91('0x85')](_0x51a21b,_0x7e91('0x88'));rpcDb[_0x7e91('0x89')](_0x51a21b,'[HistoryRecallClose]');}}}}})[_0x7e91('0x6c')](ut[_0x7e91('0x7e')](_0x7e91('0x8a')));};Preview[_0x7e91('0xf')]['setMessage']=function(_0x4d376c){_0x4d376c[_0x7e91('0x51')]=!![];if(ut[_0x7e91('0x8b')](_0x4d376c[_0x7e91('0x2b')])){_0x4d376c['message']='AGENTS_NOT_LOGGED';}else if(!ut[_0x7e91('0x8c')](_0x4d376c['dialActive'])){_0x4d376c['message']='NOT_ACTIVE';}else if(!this[_0x7e91('0x8d')](_0x4d376c[_0x7e91('0x48')])){if(!this[_0x7e91('0x8d')](_0x4d376c[_0x7e91('0x8e')])){_0x4d376c[_0x7e91('0x47')]=_0x7e91('0x8f');}else{_0x4d376c['message']=_0x7e91('0x90');}}else{_0x4d376c[_0x7e91('0x47')]=_0x7e91('0x90');}emitCampaignPreview(_0x4d376c);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x28272a,_0x9c92b4,_0x4a7e5b){var _0x26f220=this;var _0x47e91f=this[_0x7e91('0x16')][_0x9c92b4];var _0xb93914=this[_0x7e91('0x14')][_0x47e91f[_0x7e91('0x63')]];var _0x6e6a21;if(_0xb93914){switch(_0x4a7e5b){case'1':_0xb93914[_0x7e91('0x3b')]+=0x1;_0x47e91f[_0x7e91('0x91')]=ut[_0x7e91('0x92')](_0x47e91f);ut[_0x7e91('0x80')](_0x47e91f,0x0,_0x7e91('0x93'));rpcDb[_0x7e91('0x85')](_0x47e91f,_0x7e91('0x94'));if(ut['totalGlobal'](_0x47e91f)>=_0xb93914['dialGlobalMaxRetry']){_0x6e6a21=ut[_0x7e91('0x95')](_0x47e91f,0xf,_0x7e91('0x96'));rpcDb[_0x7e91('0x89')](_0x6e6a21,_0x7e91('0x97'));}else{rpcDb['createCustomerFinal'](_0x47e91f,_0x7e91('0x97'));}delete this[_0x7e91('0x16')][_0x28272a[_0x7e91('0x98')]];break;case _0x7e91('0x99'):var _0x35f7f8=moment()[_0x7e91('0x4d')](_0x7e91('0x9a'));_0x47e91f[_0x7e91('0x9b')]=_0x35f7f8;_0x47e91f[_0x7e91('0x9c')]=_0x35f7f8;_0x47e91f[_0x7e91('0x70')]=!![];_0xb93914['pTalking']+=0x1;logger[_0x7e91('0x61')]('[syncHangup][talking][increment]',_0x47e91f[_0x7e91('0x9d')],'\x20Queue',_0xb93914[_0x7e91('0x27')],'pTalking:\x20',_0xb93914[_0x7e91('0x2c')]);ami['emit']('custom:agentconnect',ut['buildObj'](_0x47e91f,'connect'));if(_0xb93914[_0x7e91('0x9e')]){ami['emit']('custom:agentConnectPreview',ut['buildAcw'](_0x47e91f));}break;case'16':ami['emit'](_0x7e91('0x9f'),ut[_0x7e91('0xa0')](_0x47e91f,_0x7e91('0xa1')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x47e91f,_0x7e91('0xa1')));_0xb93914[_0x7e91('0x36')]+=0x1;_0xb93914['total']+=0x1;_0xb93914[_0x7e91('0x29')]+=0x1;ut['decrementTalkink'](_0xb93914,'[16]');_0x47e91f[_0x7e91('0x91')]=ut[_0x7e91('0x92')](_0x47e91f);ut['logCustomer'](_0x47e91f,0x4,_0x7e91('0xa2'));rpcDb[_0x7e91('0x85')](_0x47e91f,_0x7e91('0xa3'));rpcDb['createCustomerFinal'](_0x47e91f,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x47e91f);_0xb93914[_0x7e91('0xa4')]+=_0x47e91f['talktime'];_0xb93914[_0x7e91('0xa5')]+=_0x47e91f[_0x7e91('0xa6')];logger[_0x7e91('0x61')](_0x7e91('0xa7'),_0x47e91f[_0x7e91('0x9d')],'\x20Queue',_0xb93914[_0x7e91('0x27')],'pTalking:\x20',_0xb93914[_0x7e91('0x2c')]);delete this[_0x7e91('0x16')][_0x28272a[_0x7e91('0x98')]];break;case _0x7e91('0xa8'):_0xb93914[_0x7e91('0xa9')]+=0x1;_0x47e91f[_0x7e91('0xaa')]+=0x1;_0x47e91f[_0x7e91('0x91')]=ut[_0x7e91('0x92')](_0x47e91f);ut[_0x7e91('0x80')](_0x47e91f,0x5,_0x7e91('0xab'));rpcDb[_0x7e91('0x85')](_0x47e91f,_0x7e91('0xac'));if(ut[_0x7e91('0x92')](_0x47e91f)>=_0xb93914[_0x7e91('0xad')]){_0x6e6a21=ut[_0x7e91('0x95')](_0x47e91f,0xf,_0x7e91('0x96'));rpcDb[_0x7e91('0x89')](_0x6e6a21,_0x7e91('0xae'));}else{if(_0x47e91f['countbusyretry']>=_0xb93914[_0x7e91('0xaf')]){rpcDb[_0x7e91('0x89')](_0x47e91f,_0x7e91('0xac'));}else{rpcDb[_0x7e91('0xb0')](ut['scheduledAt'](_0x47e91f,'countbusyretry',_0xb93914[_0x7e91('0xb1')]),_0x47e91f[_0x7e91('0xb2')],_0x47e91f['activeContact']);}}break;case _0x7e91('0xb3'):_0xb93914[_0x7e91('0x3a')]+=0x1;_0x47e91f['countnoanswerretry']+=0x1;_0x47e91f[_0x7e91('0x91')]=ut[_0x7e91('0x92')](_0x47e91f);ut['logCustomer'](_0x47e91f,0x3,_0x7e91('0xb4'));rpcDb['createCustomerHistory'](_0x47e91f,_0x7e91('0xb5'));if(ut['totalGlobal'](_0x47e91f)>=_0xb93914['dialGlobalMaxRetry']){_0x6e6a21=ut[_0x7e91('0x95')](_0x47e91f,0xf,'Global');rpcDb[_0x7e91('0x89')](_0x6e6a21,_0x7e91('0xb6'));}else{if(_0x47e91f[_0x7e91('0xb7')]>=_0xb93914[_0x7e91('0xb8')]){rpcDb[_0x7e91('0x89')](_0x47e91f,_0x7e91('0xb5'));}else{rpcDb[_0x7e91('0xb0')](ut['scheduledAt'](_0x47e91f,_0x7e91('0xb7'),_0xb93914[_0x7e91('0xb9')]),_0x47e91f['unlockAgent'],_0x47e91f[_0x7e91('0xba')]);}}break;case _0x7e91('0xbb'):_0xb93914[_0x7e91('0x38')]+=0x1;_0x47e91f[_0x7e91('0xbc')]+=0x1;_0x47e91f[_0x7e91('0x91')]=ut['totalGlobal'](_0x47e91f);ut[_0x7e91('0x80')](_0x47e91f,0x8,_0x7e91('0xbd'));rpcDb['createCustomerHistory'](_0x47e91f,_0x7e91('0xbe'));if(ut[_0x7e91('0x92')](_0x47e91f)>=_0xb93914[_0x7e91('0xad')]){_0x6e6a21=ut[_0x7e91('0x95')](_0x47e91f,0xf,_0x7e91('0x96'));rpcDb[_0x7e91('0x89')](_0x6e6a21,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x47e91f[_0x7e91('0xbc')]>=_0xb93914[_0x7e91('0xbf')]){rpcDb[_0x7e91('0x89')](_0x47e91f,_0x7e91('0xbe'));}else{rpcDb[_0x7e91('0xb0')](ut[_0x7e91('0xc0')](_0x47e91f,'countcongestionretry',_0xb93914[_0x7e91('0xb1')]),_0x47e91f[_0x7e91('0xb2')],_0x47e91f['activeContact']);}}break;case _0x7e91('0xc1'):_0xb93914['outboundRejectCallsDay']+=0x1;_0x47e91f[_0x7e91('0x91')]=ut['totalGlobal'](_0x47e91f);ut[_0x7e91('0x80')](_0x47e91f,0x14,_0x7e91('0xc2'));rpcDb['createCustomerHistory'](_0x47e91f,_0x7e91('0xc3'));if(_0x47e91f[_0x7e91('0xb2')]){rpcDb[_0x7e91('0xc4')](_0x47e91f[_0x7e91('0xc5')]);}if(_0x47e91f['activeContact']){rpcDb['disableContact'](_0x47e91f[_0x7e91('0xc5')]);}break;default:if(_0x47e91f[_0x7e91('0x70')]){ut[_0x7e91('0x71')](_0xb93914,'[default]');ut[_0x7e91('0x72')](_0x7e91('0xc6')+_0xb93914['name'],_0x28272a);}_0xb93914['outboundUnknownCallsDay']+=0x1;_0x47e91f[_0x7e91('0x91')]=ut[_0x7e91('0x92')](_0x47e91f);ut[_0x7e91('0x80')](_0x47e91f,0xc,_0x28272a[_0x7e91('0xc7')]||_0x28272a[_0x7e91('0xc8')]);rpcDb[_0x7e91('0x85')](_0x47e91f,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x7e91('0x92')](_0x47e91f)>=_0xb93914[_0x7e91('0xad')]){_0x6e6a21=ut[_0x7e91('0x95')](_0x47e91f,0xf,'Global');rpcDb['createCustomerFinal'](_0x6e6a21,_0x7e91('0xc9'));}else{rpcDb['createCustomerFinal'](_0x47e91f,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x28272a[_0x7e91('0x98')]];}if(!(_0x47e91f[_0x7e91('0x70')]&&_0x4a7e5b==='16')){ut[_0x7e91('0x6e')](_0xb93914,'[callProgressDetectingCustomer]');logger[_0x7e91('0x61')](_0x7e91('0xca'),_0x47e91f[_0x7e91('0x9d')],'\x20Queue',_0xb93914['name'],_0x7e91('0x64'),_0xb93914[_0x7e91('0xcb')]);}if(_0x4a7e5b!=='ANSWER'){delete this[_0x7e91('0x16')][_0x28272a[_0x7e91('0x98')]];delete this['actions'][_0x28272a[_0x7e91('0xcc')]];}}};Preview[_0x7e91('0xf')]['callProgressDetectingAgent']=function(_0x25354c,_0x3e9692,_0x304394){if(_['isUndefined'](_0x3e9692)&&_0x7e91('0xcd')!==typeof _0x3e9692){return;}if(_['isUndefined'](_0x304394)&&_0x7e91('0xcd')!==typeof _0x304394){return;}switch(_0x304394['reason']){case'0':ut['logAgent'](_0x25354c,0x0,_0x7e91('0x93'));rpcDb[_0x7e91('0xce')](_0x25354c,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x7e91('0xcf')](_0x25354c,0x3,_0x7e91('0xb4'));rpcDb['createAgentHistory'](_0x25354c,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x7e91('0xcf')](_0x25354c,0x5,_0x7e91('0xab'));rpcDb['createAgentHistory'](_0x25354c,_0x7e91('0xd0'));break;case'8':ut[_0x7e91('0xcf')](_0x25354c,0x8,_0x7e91('0xbd'));rpcDb[_0x7e91('0xce')](_0x25354c,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x7e91('0xcf')](_0x25354c,0x16,'AnswerAGI');rpcDb[_0x7e91('0xce')](_0x25354c,_0x7e91('0xd1'));break;default:ut[_0x7e91('0xcf')](_0x25354c,0xc,_0x304394[_0x7e91('0xd2')]);rpcDb['createAgentHistory'](_0x25354c,'[callProgressDetectingAgent][logCongestion]');}ut[_0x7e91('0x6e')](_0x3e9692,_0x7e91('0xd3'));logger['info'](_0x7e91('0xd4'),_0x25354c['uniqueid'],'\x20Queue',_0x3e9692['name'],_0x7e91('0x64'),_0x3e9692['originated']);delete this[_0x7e91('0x16')][_0x25354c[_0x7e91('0x9d')]];};Preview[_0x7e91('0xf')][_0x7e91('0xd5')]=function(_0x55bacb,_0x1c63b2,_0x47369a,_0x18af23,_0x39b440){var _0x43dcd3=this;return new BPromise(function(_0x56b141,_0x45a852){if(_[_0x7e91('0x60')](_0x1c63b2)||_['isNil'](_0x1c63b2[_0x7e91('0xd6')])||_[_0x7e91('0x60')](_0x1c63b2[_0x7e91('0xd6')][_0x7e91('0xd7')])||_['isNil'](_0x1c63b2[_0x7e91('0xd8')])){_0x45a852(ut[_0x7e91('0x47')](_0x7e91('0xd9'),_0x18af23,_0x39b440));return;}var _0x174c76=uuid['v4']();var _0x1b7742=_0x43dcd3['campaignsPreview'][_0x1c63b2[_0x7e91('0xda')]['name']];var _0x1d41aa=_0x47369a?_0x43dcd3[_0x7e91('0x17')][_0x47369a]['id']:undefined;_0x43dcd3[_0x7e91('0x16')][_0x174c76]=new Action(_0x1c63b2,_0x1b7742,_0x174c76,_0x47369a,_0x1d41aa);var _0x535f00=_0x43dcd3[_0x7e91('0x16')][_0x174c76];_0x535f00[_0x7e91('0xb2')]=_0x18af23;_0x535f00[_0x7e91('0xba')]=_0x39b440;_0x535f00['lookAgent']=_0x47369a;if(_[_0x7e91('0xdb')](_0x55bacb)){_0x43dcd3[_0x7e91('0xdc')](_0x535f00,_0x1b7742,_0x1c63b2,_0x47369a)[_0x7e91('0x7c')](function(_0x5c5a89){logger[_0x7e91('0x61')]('[Preview][execCall][success]','Queue:\x20'+_0x535f00[_0x7e91('0x63')]+'\x20IdHopper:\x20'+_0x535f00['idContact'],JSON[_0x7e91('0x66')](_0x5c5a89));ami[_0x7e91('0xdd')](_0x7e91('0xde'),ut[_0x7e91('0xa0')](_0x535f00,_0x7e91('0xdf')));_0x56b141(ut['message'](_0x7e91('0xe0')));})[_0x7e91('0x6c')](function(_0x2d873d){ut[_0x7e91('0x54')]('[Preview][execCall][failure]',_0x2d873d);_0x45a852(ut[_0x7e91('0x47')](_0x7e91('0xe1'),_0x18af23,_0x39b440));});}else{_0x1b7742[_0x7e91('0x37')]+=0x1;ut[_0x7e91('0xe2')](_0x535f00);rpcDb[_0x7e91('0xe3')](_0x535f00,_0x7e91('0xe4'));delete _0x43dcd3[_0x7e91('0x16')][_0x174c76];_0x45a852(ut['message'](_0x7e91('0xe5'),_0x18af23,_0x39b440));}});};Preview['prototype']['isTrunkReachable']=function(_0x14640a){return!_[_0x7e91('0x60')](_0x14640a)&&!_[_0x7e91('0x60')](_0x14640a[_0x7e91('0x27')])&&!_['isNil'](_0x14640a[_0x7e91('0x49')])&&_0x14640a[_0x7e91('0x49')]&&!_['isNil'](this[_0x7e91('0x15')][util[_0x7e91('0x4d')](_0x7e91('0xe6'),_0x14640a[_0x7e91('0x27')])])&&!_['isNil'](this['trunks'][util[_0x7e91('0x4d')](_0x7e91('0xe6'),_0x14640a[_0x7e91('0x27')])][_0x7e91('0xe7')])&&(this[_0x7e91('0x15')][util[_0x7e91('0x4d')]('SIP/%s',_0x14640a[_0x7e91('0x27')])][_0x7e91('0xe7')]==='reachable'||this[_0x7e91('0x15')][util[_0x7e91('0x4d')](_0x7e91('0xe6'),_0x14640a['name'])][_0x7e91('0xe7')]===_0x7e91('0xe8'));};Preview[_0x7e91('0xf')][_0x7e91('0x7b')]=function(_0x293d16,_0x2b17fb){var _0x15316b=this;return new BPromise(function(_0x55b08a,_0x22a1b8){_0x15316b[_0x7e91('0xe9')](_0x293d16,_0x2b17fb)['then'](function(_0xb25fcc){_0x55b08a(_['pick'](_0xb25fcc,[_0x7e91('0x47')]));})[_0x7e91('0x6c')](function(_0x5a85b7){if(_0x5a85b7[_0x7e91('0xea')]){rpcDb[_0x7e91('0xc4')](_0x293d16);}if(_0x5a85b7[_0x7e91('0x49')]){rpcDb[_0x7e91('0xeb')](_0x293d16);}_0x22a1b8(_[_0x7e91('0x67')](_0x5a85b7,['message']));});});};Preview[_0x7e91('0xf')][_0x7e91('0xe9')]=function(_0x363039,_0x1e0927){var _0x374613=this;return new BPromise(function(_0x4dbb00,_0x28f139){var _0x1e114d,_0x479b0f;rpcDb[_0x7e91('0xec')](_0x363039)[_0x7e91('0x7c')](function(_0x1d6a49){if(!_[_0x7e91('0x60')](_0x1d6a49[0x0])){_0x479b0f=_0x1d6a49[0x0][_0x7e91('0xed')]?![]:!![];_0x1e114d=_0x1d6a49[0x0][_0x7e91('0xed')]?!![]:![];_0x1e114d=_0x1e0927?!![]:_0x1e114d;}var _0x4f5a2c=_0x374613[_0x7e91('0xee')](_0x1d6a49);if(_0x4f5a2c['isValid']){rpcDb[_0x7e91('0xef')](_[_0x7e91('0x67')](_0x1d6a49[0x0],[_0x7e91('0xd8'),_0x7e91('0xf0')]))[_0x7e91('0x7c')](function(_0x21d7fc){_0x374613[_0x7e91('0xd5')](_0x21d7fc,_0x1d6a49[0x0],_0x1e0927,_0x479b0f,_0x1e114d)[_0x7e91('0x7c')](function(_0x66aebf){_0x4dbb00(_0x66aebf);})[_0x7e91('0x6c')](function(_0x576879){_0x28f139(_0x576879);});})[_0x7e91('0x6c')](function(_0x328dca){ut[_0x7e91('0x54')](_0x7e91('0xf1'),_0x328dca);_0x28f139(ut[_0x7e91('0x47')](_0x7e91('0xf2'),_0x479b0f,_0x1e114d));});}else{_0x28f139(ut['message'](_0x4f5a2c[_0x7e91('0x47')],_0x479b0f,_0x1e114d));}})[_0x7e91('0x6c')](function(_0x562150){ut[_0x7e91('0x54')]('[Preview][getContactPreview]',_0x562150);_0x28f139(ut[_0x7e91('0x47')](_0x7e91('0xf2'),![],!![]));});});};Preview[_0x7e91('0xf')][_0x7e91('0xee')]=function(_0x7aa4d0){if(_[_0x7e91('0x60')](_0x7aa4d0)||_[_0x7e91('0xdb')](_0x7aa4d0)||!_['isNil'](_0x7aa4d0[0x0][_0x7e91('0xf3')])&&_[_0x7e91('0x60')](_0x7aa4d0[0x0]['Agent']['name'])){ut[_0x7e91('0x54')](_0x7e91('0xf4'),_0x7aa4d0);return{'isValid':![],'message':'Empty\x20Contact'};}var _0xa8a919=this[_0x7e91('0x14')][_0x7aa4d0[0x0][_0x7e91('0xda')][_0x7e91('0x27')]];_0xa8a919[_0x7e91('0x47')]=_0x7e91('0x90');if(_[_0x7e91('0x60')](_0xa8a919)){ut[_0x7e91('0x54')](_0x7e91('0xf5'),_0xa8a919);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x7e91('0x8d')](_0xa8a919['Trunk'])){ut[_0x7e91('0x54')](_0x7e91('0xf6'),_0x7e91('0xf7')+_0xa8a919[_0x7e91('0x27')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x7e91('0x8d')](_0xa8a919['TrunkBackup'])){ut[_0x7e91('0x54')](_0x7e91('0xf6'),_0xa8a919[_0x7e91('0x27')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x7e91('0xf8')};}}if(!ut[_0x7e91('0x8c')](_0xa8a919[_0x7e91('0x31')])){ut[_0x7e91('0x54')](_0x7e91('0xf9'),_0xa8a919[_0x7e91('0x27')]+_0x7e91('0xfa'));return{'isValid':![],'message':_0x7e91('0xf7')+_0xa8a919[_0x7e91('0x27')]+_0x7e91('0xfa')};}return{'isValid':!![],'message':_0x7e91('0xfb')};};Preview['prototype']['execCall']=function(_0xe52fcc,_0xf865f8,_0x117c6e,_0x306be9){var _0x35ff68=this;return new BPromise(function(_0x578cb2,_0x3a16b9){var _0x5cdd5c=_0xe52fcc[_0x7e91('0x9d')];var _0xb0e341=_0x35ff68[_0x7e91('0x8d')](_0xf865f8[_0x7e91('0x48')])?util[_0x7e91('0x4d')]('SIP/%s/%s%s',_0xf865f8[_0x7e91('0x48')][_0x7e91('0x27')],_[_0x7e91('0x60')](_0xf865f8[_0x7e91('0xfc')])?'':_0xf865f8['dialPrefix'][_0x7e91('0xfd')]()||'',_0xf865f8['dialCutDigit']>0x0?_0x117c6e['Contact'][_0x7e91('0xd7')]['substring'](_0xf865f8[_0x7e91('0xfe')]):_0x117c6e[_0x7e91('0xd6')][_0x7e91('0xd7')]):util[_0x7e91('0x4d')](_0x7e91('0xff'),_[_0x7e91('0x60')](_0xf865f8[_0x7e91('0x8e')])?_0xf865f8[_0x7e91('0x48')][_0x7e91('0x27')]:_0xf865f8[_0x7e91('0x8e')][_0x7e91('0x27')],_[_0x7e91('0x60')](_0xf865f8['dialPrefix'])?'':_0xf865f8['dialPrefix']['trim']()||'',_0xf865f8[_0x7e91('0xfe')]>0x0?_0x117c6e[_0x7e91('0xd6')][_0x7e91('0xd7')][_0x7e91('0x100')](_0xf865f8[_0x7e91('0xfe')]):_0x117c6e['Contact'][_0x7e91('0xd7')]);var _0x1e56f1=_0x35ff68[_0x7e91('0x8d')](_0xf865f8[_0x7e91('0x48')])?ut[_0x7e91('0x101')](_0xf865f8['Trunk'][_0x7e91('0x4a')],_0xf865f8[_0x7e91('0x102')],_0xf865f8['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0xf865f8[_0x7e91('0x33')],_0xf865f8[_0x7e91('0x103')]):_0xf865f8[_0x7e91('0x33')]):ut[_0x7e91('0x101')](_[_0x7e91('0x60')](_0xf865f8[_0x7e91('0x8e')])?_0xf865f8['Trunk'][_0x7e91('0x4a')]:_0xf865f8[_0x7e91('0x8e')]['callerid'],_0xf865f8[_0x7e91('0x102')],_0xf865f8[_0x7e91('0x103')]>0x0?ut[_0x7e91('0x104')](_0xf865f8['dialOriginateCallerIdNumber'],_0xf865f8[_0x7e91('0x103')]):_0xf865f8[_0x7e91('0x33')]);if(_0x1e56f1){_0xe52fcc[_0x7e91('0x105')]=ut[_0x7e91('0x106')](_0x1e56f1);_0xe52fcc[_0x7e91('0x107')]=ut[_0x7e91('0x108')](_0x1e56f1);}var _0xa6febe=ut[_0x7e91('0x109')](_0xf865f8,_0x117c6e,_0xb0e341,_0x1e56f1,_0x5cdd5c,_0xe52fcc);_[_0x7e91('0x10a')](_0xe52fcc,ut[_0x7e91('0x10b')](_0xa6febe));_0xe52fcc[_0x7e91('0x7f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x7e91('0x10c')](ut[_0x7e91('0x10d')](_0xe52fcc,_0xf865f8,_0xa6febe,_0xe52fcc[_0x7e91('0xba')],_0x306be9))[_0x7e91('0x7c')](function(_0x59437e){_0xf865f8[_0x7e91('0xcb')]+=0x1;logger[_0x7e91('0x61')](_0x7e91('0x10e'),_0x5cdd5c,_0x7e91('0x10f'),_0xf865f8[_0x7e91('0x27')],_0x7e91('0x64'),_0xf865f8[_0x7e91('0xcb')]);_0x578cb2(_0x59437e);})[_0x7e91('0x6c')](function(_0x41f12c){ut[_0x7e91('0xcf')](_0xe52fcc,0xe,'OriginateError');rpcDb['createAgentHistory'](_0xe52fcc,_0x7e91('0x110'));_0x3a16b9(_0x41f12c);});});};Preview[_0x7e91('0xf')][_0x7e91('0x21')]=function(_0x361de4){if(this[_0x7e91('0x16')][_0x361de4[_0x7e91('0x98')]]){this[_0x7e91('0x16')][_0x361de4[_0x7e91('0x98')]]['channel']=_0x361de4[_0x7e91('0x6b')];}};Preview[_0x7e91('0xf')][_0x7e91('0x111')]=function(_0x5ceeeb){var _0x419255=this;var _0x237a78=this['actions'][_0x5ceeeb[_0x7e91('0x112')]];if(_0x237a78){if(_0x237a78[_0x7e91('0x113')]&&this['agents'][_0x237a78[_0x7e91('0x113')]]){ut[_0x7e91('0x114')](_0x237a78,this[_0x7e91('0x17')][_0x237a78['lookAgent']][_0x7e91('0x27')],this[_0x7e91('0x17')][_0x237a78[_0x7e91('0x113')]]['id']);}var _0x1f7189=_[_0x7e91('0x115')](_0x237a78);_0x1f7189['responsetime']=moment()['format'](_0x7e91('0x9a'));var _0x38cf19=_0x419255[_0x7e91('0x14')][_0x237a78['queue']];if(ut['isFailure'](_0x5ceeeb[_0x7e91('0x116')])){if(_0x237a78[_0x7e91('0xb2')]){rpcDb[_0x7e91('0xc4')](_0x237a78[_0x7e91('0xc5')]);}if(_0x237a78['activeContact']){rpcDb[_0x7e91('0xeb')](_0x237a78['idContact']);}ami[_0x7e91('0xdd')]('custom:agentringnoanswer',ut[_0x7e91('0xa0')](_0x237a78,_0x7e91('0x117')));this['callProgressDetectingAgent'](_0x1f7189,_0x38cf19,_0x5ceeeb);}else{_0x237a78[_0x7e91('0x7f')]=moment()[_0x7e91('0x4d')](_0x7e91('0x9a'));ut[_0x7e91('0xcf')](_0x1f7189,0x4,_0x7e91('0xa2'));rpcDb[_0x7e91('0xce')](_0x1f7189,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x7e91('0xf')][_0x7e91('0x1b')]=function(_0x13eb00){var _0x1fdf14=this;var _0x2e06b5=this['actions'][_0x13eb00[_0x7e91('0x98')]];var _0x26f30b;if(_0x2e06b5){_0x26f30b=this[_0x7e91('0x14')][_0x2e06b5[_0x7e91('0x63')]];logger['info'](_0x7e91('0x118'),_0x13eb00[_0x7e91('0x98')],_0x7e91('0x10f'),_0x26f30b[_0x7e91('0x27')],'pTalking:\x20',_0x26f30b['pTalking']);}if(this[_0x7e91('0x16')][_0x13eb00[_0x7e91('0x98')]]&&_0x13eb00[_0x7e91('0x98')]!==_0x13eb00['uniqueid']){if(_0x13eb00[_0x7e91('0x119')]==='16'&&this[_0x7e91('0x16')][_0x13eb00[_0x7e91('0x98')]][_0x7e91('0x70')]){this[_0x7e91('0x11a')](_0x13eb00,_0x13eb00[_0x7e91('0x98')],_0x13eb00['cause']);}else if(this['actions'][_0x13eb00[_0x7e91('0x98')]][_0x7e91('0x70')]){logger['info'](_0x7e91('0x11b'),_0x13eb00['linkedid'],_0x13eb00[_0x7e91('0x119')],_0x7e91('0x10f'),_0x26f30b[_0x7e91('0x27')],'pTalking:\x20',_0x26f30b[_0x7e91('0x2c')]);this[_0x7e91('0x11a')](_0x13eb00,_0x13eb00[_0x7e91('0x98')],_0x13eb00['cause']);}}else if(_0x2e06b5&&_[_0x7e91('0x60')](_0x2e06b5['statedesc'])&&_0x26f30b[_0x7e91('0x11c')]&&_0x13eb00[_0x7e91('0x98')]===_0x13eb00[_0x7e91('0x9d')]&&_['isNil'](_0x13eb00[_0x7e91('0xd2')])&&_0x13eb00[_0x7e91('0x119')]==='16'&&_0x13eb00[_0x7e91('0x11d')]==='6'&&_['isUndefined'](_0x2e06b5[_0x7e91('0x11e')])){if(_0x2e06b5['unlockAgent']){rpcDb[_0x7e91('0xc4')](_0x2e06b5[_0x7e91('0xc5')]);}if(_0x2e06b5[_0x7e91('0xba')]){rpcDb[_0x7e91('0xeb')](_0x2e06b5[_0x7e91('0xc5')]);}_0x13eb00[_0x7e91('0xd2')]='22';this[_0x7e91('0x11f')](_0x2e06b5,_0x26f30b,_0x13eb00);}else if(_0x2e06b5&&_0x2e06b5[_0x7e91('0x11e')]){if(_0x13eb00['cause']==='16'&&this[_0x7e91('0x16')][_0x13eb00[_0x7e91('0x98')]]['dialAnswer']){logger[_0x7e91('0x61')](_0x7e91('0x120'),_0x13eb00[_0x7e91('0x98')],_0x13eb00[_0x7e91('0x119')],_0x7e91('0x10f'),_0x26f30b[_0x7e91('0x27')],_0x7e91('0x65'),_0x26f30b[_0x7e91('0x2c')]);this[_0x7e91('0x11a')](_0x13eb00,_0x13eb00['linkedid'],_0x13eb00['cause']);}else if(this[_0x7e91('0x16')][_0x13eb00[_0x7e91('0x98')]]['dialAnswer']){logger[_0x7e91('0x61')](_0x7e91('0x11b'),_0x13eb00[_0x7e91('0x98')],_0x13eb00['cause'],_0x7e91('0x10f'),_0x26f30b[_0x7e91('0x27')],'pTalking:\x20',_0x26f30b[_0x7e91('0x2c')]);this[_0x7e91('0x11a')](_0x13eb00,_0x13eb00['linkedid'],_0x13eb00[_0x7e91('0x119')]);}}};Preview[_0x7e91('0xf')][_0x7e91('0x1f')]=function(_0x37fef8){if(this['actions'][_0x37fef8['destlinkedid']]&&_0x37fef8[_0x7e91('0xcc')]!==_0x37fef8[_0x7e91('0x121')]){this['callProgressDetectingCustomer'](_0x37fef8,_0x37fef8[_0x7e91('0xcc')],_0x37fef8['dialstatus']);}};Preview[_0x7e91('0xf')][_0x7e91('0x1d')]=function(_0x525338){if(this['actions'][_0x525338[_0x7e91('0x98')]]&&_0x525338[_0x7e91('0x98')]!==_0x525338[_0x7e91('0x9d')]&&!this['actions'][_0x525338['linkedid']][_0x7e91('0x70')]){if(_0x525338[_0x7e91('0x119')]==='1'){this[_0x7e91('0x11a')](_0x525338,_0x525338[_0x7e91('0x98')],_0x525338[_0x7e91('0x119')]);}}};Preview[_0x7e91('0xf')][_0x7e91('0x122')]=function(_0xafa100,_0x1ff8be,_0x25767c){if(this['actions'][_0xafa100]){if(_[_0x7e91('0x60')](this[_0x7e91('0x16')][_0xafa100]['variables'])){this[_0x7e91('0x16')][_0xafa100][_0x7e91('0x123')]={};}this['actions'][_0xafa100][_0x7e91('0x123')][_0x1ff8be]=_0x25767c;}};Preview[_0x7e91('0xf')][_0x7e91('0x23')]=function(_0x354c8b){try{if(!_[_0x7e91('0x60')](_0x354c8b)){if(ut[_0x7e91('0x124')](_['keys'](_0x354c8b['variable'])[0x0])){this['addVariable'](_0x354c8b[_0x7e91('0x9d')],_['keys'](_0x354c8b[_0x7e91('0x125')])[0x0],_0x354c8b['value']);}}}catch(_0x721112){logger[_0x7e91('0x126')]('[syncVarSet][Preview]',util[_0x7e91('0x127')](_0x721112,{'showHidden':![],'depth':null}));}};Preview[_0x7e91('0xf')][_0x7e91('0x128')]=function(_0x5e275c){if(_0x5e275c){if(this[_0x7e91('0x16')][_0x5e275c[_0x7e91('0x129')]]){this[_0x7e91('0x16')][_0x5e275c['transfertargetlinkedid']][_0x7e91('0x11e')]=!![];}}};Preview[_0x7e91('0xf')][_0x7e91('0x24')]=function(_0xd87c70){if(_0xd87c70){if(this[_0x7e91('0x16')][_0xd87c70[_0x7e91('0x12a')]]){this[_0x7e91('0x16')][_0xd87c70[_0x7e91('0x12a')]][_0x7e91('0x11e')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index aa90e13..1f3d67d 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 _0x1d1f=['xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueReport','inspect','resolve','createHistory','catch','[createHistory]\x20','then','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','countReScheduled','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','endtime','connectedlinename','membername','context'];(function(_0x4d4208,_0x411613){var _0x58f3af=function(_0x4ba908){while(--_0x4ba908){_0x4d4208['push'](_0x4d4208['shift']());}};_0x58f3af(++_0x411613);}(_0x1d1f,0x98));var _0xf1d1=function(_0x36bc58,_0x27f03c){_0x36bc58=_0x36bc58-0x0;var _0x4a547e=_0x1d1f[_0x36bc58];return _0x4a547e;};'use strict';var util=require(_0xf1d1('0x0'));var BPromise=require(_0xf1d1('0x1'));var logger=require('../../../config/logger')(_0xf1d1('0x2'));var _=require('lodash');var cmHopper=require(_0xf1d1('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xf1d1('0x4'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xf1d1('0x5'));function loggerCatch(_0x2ec138){return function(_0x24afa8){logger['error'](_0x2ec138,util[_0xf1d1('0x6')](_0x24afa8,{'showHidden':![],'depth':null}));};}function create(_0x2993c3){return BPromise[_0xf1d1('0x7')]()['then'](cmHopperHistory[_0xf1d1('0x8')](_0x2993c3))[_0xf1d1('0x9')](loggerCatch(_0xf1d1('0xa')));}function createAgent(_0x21528a){return BPromise['resolve']()[_0xf1d1('0xb')](agentReportPreview[_0xf1d1('0x8')](_0x21528a))[_0xf1d1('0x9')](loggerCatch(_0xf1d1('0xa')));}function moveContact(_0x2a7a48){return BPromise[_0xf1d1('0x7')]()['then'](cmHopper['moveContactManagedDialer'](_0x2a7a48,!![]))[_0xf1d1('0x9')](loggerCatch(_0xf1d1('0xc')));}exports[_0xf1d1('0xd')]=function(_0x5284c5){return BPromise[_0xf1d1('0x7')]()[_0xf1d1('0xb')](cmHopperBlack[_0xf1d1('0xd')](_0x5284c5))[_0xf1d1('0x9')](loggerCatch(_0xf1d1('0xe')));};exports['getContactPreview']=function(_0x1143d){return BPromise['resolve']()[_0xf1d1('0xb')](cmHopper[_0xf1d1('0xf')](_0x1143d))[_0xf1d1('0x9')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x27a8b4,_0x2f12d6){create(_0x27a8b4)['catch'](loggerCatch(_0x2f12d6));moveContact(_0x27a8b4)[_0xf1d1('0x9')](loggerCatch(_0x2f12d6));};exports[_0xf1d1('0x10')]=function(_0x26a3c6,_0x4b8b46){createAgent(_0x26a3c6)[_0xf1d1('0x9')](loggerCatch(_0x4b8b46));};exports['createCustomerHistory']=function(_0x5303d1,_0x3a5aa5){create(_0x5303d1)['catch'](loggerCatch(_0x3a5aa5));};exports[_0xf1d1('0x11')]=function(_0xe1288b,_0x9ef06){moveContact(_0xe1288b)[_0xf1d1('0x9')](loggerCatch(_0x9ef06));};exports['rescheduleContact']=function(_0x337202,_0x2db4b2,_0x32e88b){if(_0x2db4b2){_0x337202['UserId']=null;}if(_0x32e88b){_0x337202['active']=![];}return BPromise[_0xf1d1('0x7')]()['then'](cmHopper[_0xf1d1('0x12')](_0x337202))[_0xf1d1('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xf1d1('0x13')]=function(_0x3e7149){return BPromise[_0xf1d1('0x7')]()['then'](cmHopper[_0xf1d1('0x13')](_0x3e7149))[_0xf1d1('0x9')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x27c023){return BPromise[_0xf1d1('0x7')]()[_0xf1d1('0xb')](cmHopper['unlockContact']({'UserId':null},_0x27c023,0x1))['catch'](loggerCatch(_0xf1d1('0x14')));};exports[_0xf1d1('0x15')]=function(_0x44a4b6){return BPromise[_0xf1d1('0x7')]()[_0xf1d1('0xb')](cmHopper[_0xf1d1('0x16')]({'active':![]},_0x44a4b6,0x1))[_0xf1d1('0x9')](loggerCatch(_0xf1d1('0x17')));};exports[_0xf1d1('0x18')]=function(_0x1cc22f){var _0xfbca3c={};_0xfbca3c[_0xf1d1('0x19')]=_0x1cc22f['type'];_0xfbca3c[_0xf1d1('0x1a')]=_0x1cc22f[_0xf1d1('0x1a')];_0xfbca3c[_0xf1d1('0x1b')]=_0x1cc22f['calleridnum'];_0xfbca3c[_0xf1d1('0x1c')]=_0x1cc22f[_0xf1d1('0x1c')];_0xfbca3c[_0xf1d1('0x1d')]=_0x1cc22f['queue'];_0xfbca3c['queuecallerjoinAt']=_0x1cc22f[_0xf1d1('0x1e')];_0xfbca3c['queuecallerleaveAt']=_0x1cc22f['answertime'];_0xfbca3c[_0xf1d1('0x1f')]=0x1;_0xfbca3c['queuecallercompleteAt']=_0x1cc22f[_0xf1d1('0x20')];_0xfbca3c[_0xf1d1('0x21')]=_0x1cc22f[_0xf1d1('0x22')];_0xfbca3c[_0xf1d1('0x23')]='from-sip';_0xfbca3c['exten']=_0xf1d1('0x24');_0xfbca3c[_0xf1d1('0x25')]=0x0;_0xfbca3c[_0xf1d1('0x26')]=0x1;_0xfbca3c[_0xf1d1('0x27')]=_0x1cc22f[_0xf1d1('0x22')];_0xfbca3c[_0xf1d1('0x28')]=_0xf1d1('0x29');return BPromise['resolve']()[_0xf1d1('0xb')](voiceQueueReport[_0xf1d1('0x2a')](_0xfbca3c))['catch'](loggerCatch(_0xf1d1('0x2b')));};exports[_0xf1d1('0x2c')]=function(_0x577a95,_0x4f3fa8){return BPromise['resolve']()[_0xf1d1('0xb')](cmHopper['getContactRecallMe'](_0x577a95,_0x4f3fa8))[_0xf1d1('0x9')](loggerCatch(_0xf1d1('0x2d')));};exports[_0xf1d1('0x2e')]=function(_0x1b48a1){return BPromise[_0xf1d1('0x7')]()[_0xf1d1('0xb')](cmHopper['rescheduleContact'](_0x1b48a1,!![],!![]))[_0xf1d1('0x9')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xf814=['rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x4c86ab,_0x1f1a25){var _0x5bdd92=function(_0x249ddb){while(--_0x249ddb){_0x4c86ab['push'](_0x4c86ab['shift']());}};_0x5bdd92(++_0x1f1a25);}(_0xf814,0x110));var _0x4f81=function(_0x3b3933,_0x4a5bd2){_0x3b3933=_0x3b3933-0x0;var _0x41d2c4=_0xf814[_0x3b3933];return _0x41d2c4;};'use strict';var util=require(_0x4f81('0x0'));var BPromise=require(_0x4f81('0x1'));var logger=require(_0x4f81('0x2'))(_0x4f81('0x3'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x4f81('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x4f81('0x5'));var voiceQueueRt=require(_0x4f81('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x4f81('0x7'));function loggerCatch(_0x12f362){return function(_0x314ade){logger[_0x4f81('0x8')](_0x12f362,util[_0x4f81('0x9')](_0x314ade,{'showHidden':![],'depth':null}));};}function create(_0x159d14){return BPromise[_0x4f81('0xa')]()[_0x4f81('0xb')](cmHopperHistory[_0x4f81('0xc')](_0x159d14))[_0x4f81('0xd')](loggerCatch(_0x4f81('0xe')));}function createAgent(_0x13994f){return BPromise['resolve']()['then'](agentReportPreview[_0x4f81('0xc')](_0x13994f))['catch'](loggerCatch(_0x4f81('0xe')));}function moveContact(_0x556f8a){return BPromise[_0x4f81('0xa')]()[_0x4f81('0xb')](cmHopper[_0x4f81('0xf')](_0x556f8a,!![]))[_0x4f81('0xd')](loggerCatch(_0x4f81('0x10')));}exports['checkIsBlackList']=function(_0x2d47f0){return BPromise['resolve']()[_0x4f81('0xb')](cmHopperBlack[_0x4f81('0x11')](_0x2d47f0))[_0x4f81('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x4f81('0x12')]=function(_0x227229){return BPromise['resolve']()[_0x4f81('0xb')](cmHopper[_0x4f81('0x12')](_0x227229))['catch'](loggerCatch(_0x4f81('0x13')));};exports[_0x4f81('0xc')]=function(_0x5d21de,_0x1609fa){create(_0x5d21de)[_0x4f81('0xd')](loggerCatch(_0x1609fa));moveContact(_0x5d21de)[_0x4f81('0xd')](loggerCatch(_0x1609fa));};exports[_0x4f81('0x14')]=function(_0x5a6cbe,_0x4620ae){createAgent(_0x5a6cbe)['catch'](loggerCatch(_0x4620ae));};exports[_0x4f81('0x15')]=function(_0x25a57b,_0x51510a){create(_0x25a57b)['catch'](loggerCatch(_0x51510a));};exports['createCustomerFinal']=function(_0x2ad23e,_0x1e8cdb){moveContact(_0x2ad23e)[_0x4f81('0xd')](loggerCatch(_0x1e8cdb));};exports[_0x4f81('0x16')]=function(_0x24af39,_0x555514,_0x434dce){if(_0x555514){_0x24af39[_0x4f81('0x17')]=null;}if(_0x434dce){_0x24af39['active']=![];}return BPromise[_0x4f81('0xa')]()[_0x4f81('0xb')](cmHopper['rescheduleContact'](_0x24af39))[_0x4f81('0xd')](loggerCatch(_0x4f81('0x18')));};exports[_0x4f81('0x19')]=function(_0x56b59d){return BPromise['resolve']()[_0x4f81('0xb')](cmHopper['countReScheduled'](_0x56b59d))['catch'](loggerCatch(_0x4f81('0x1a')));};exports['unlockContact']=function(_0x5b4965){return BPromise[_0x4f81('0xa')]()[_0x4f81('0xb')](cmHopper[_0x4f81('0x1b')]({'UserId':null},_0x5b4965,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x4f81('0x1c')]=function(_0x58733b){return BPromise[_0x4f81('0xa')]()['then'](cmHopper[_0x4f81('0x1b')]({'active':![]},_0x58733b,0x1))[_0x4f81('0xd')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x4b4156){var _0x4a8f80={};_0x4a8f80['type']=_0x4b4156[_0x4f81('0x1d')];_0x4a8f80[_0x4f81('0x1e')]=_0x4b4156[_0x4f81('0x1e')];_0x4a8f80[_0x4f81('0x1f')]=_0x4b4156[_0x4f81('0x1f')];_0x4a8f80[_0x4f81('0x20')]=_0x4b4156['calleridname'];_0x4a8f80[_0x4f81('0x21')]=_0x4b4156[_0x4f81('0x21')];_0x4a8f80[_0x4f81('0x22')]=_0x4b4156[_0x4f81('0x23')];_0x4a8f80[_0x4f81('0x24')]=_0x4b4156['answertime'];_0x4a8f80[_0x4f81('0x25')]=0x1;_0x4a8f80[_0x4f81('0x26')]=_0x4b4156[_0x4f81('0x27')];_0x4a8f80[_0x4f81('0x28')]=_0x4b4156[_0x4f81('0x29')];_0x4a8f80['context']=_0x4f81('0x2a');_0x4a8f80[_0x4f81('0x2b')]=_0x4f81('0x2c');_0x4a8f80[_0x4f81('0x2d')]=0x0;_0x4a8f80['assigned']=0x1;_0x4a8f80[_0x4f81('0x2e')]=_0x4b4156[_0x4f81('0x29')];_0x4a8f80[_0x4f81('0x2f')]=_0x4f81('0x30');return BPromise['resolve']()[_0x4f81('0xb')](voiceQueueReport[_0x4f81('0x31')](_0x4a8f80))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x4f81('0x32')]=function(_0x5b26c0,_0x11a1d3){return BPromise[_0x4f81('0xa')]()[_0x4f81('0xb')](cmHopper['getContactRecallMe'](_0x5b26c0,_0x11a1d3))[_0x4f81('0xd')](loggerCatch(_0x4f81('0x33')));};exports[_0x4f81('0x34')]=function(_0xe8bcb7){return BPromise[_0x4f81('0xa')]()['then'](cmHopper['rescheduleContact'](_0xe8bcb7,!![],!![]))[_0x4f81('0xd')](loggerCatch(_0x4f81('0x35')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 34c2862..dda7a5c 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 _0x54c6=['\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','error','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','membername','talktime','answertime','isFailure','variablesAction','calleridname','channelAgent','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','Global','scheduledAt','add','minutes','ContactId','ListId','decrementTalkink','pTalking','buildObj','lastevent','queue','interface','buildAcw','agentReadyId','not_inuse','status','push','getDiff','CampaignId','idContact','type','dialAnswer','active','scheduledat','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','inspect','info','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x54c6,0x17d));var _0x654c=function(_0x49c725,_0x24cd8e){_0x49c725=_0x49c725-0x0;var _0xe2e7e1=_0x54c6[_0x49c725];return _0xe2e7e1;};'use strict';var util=require(_0x654c('0x0'));var _=require(_0x654c('0x1'));var moment=require(_0x654c('0x2'));var logger=require('../../../../config/logger')(_0x654c('0x3'));var ipAgi=process[_0x654c('0x4')][_0x654c('0x5')]||'127.0.0.1';function getSeconds(_0x6f7848,_0xdf01be){var _0x4cab09=moment(_0x6f7848)[_0x654c('0x6')](0x0);var _0x29826d=moment(_0xdf01be)['milliseconds'](0x0);return _0x4cab09[_0x654c('0x7')](_0x29826d,_0x654c('0x8'));}exports[_0x654c('0x9')]=function(_0x250de0){return function(_0x2d7399){logger['error'](_0x250de0,util[_0x654c('0xa')](_0x2d7399,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x33fc7a,_0x18dc5d){logger[_0x654c('0xb')](_0x33fc7a,util['inspect'](_0x18dc5d,{'showHidden':![],'depth':null}));};exports[_0x654c('0xc')]=function(_0x120fde,_0x18c958){logger['error'](_0x120fde,util[_0x654c('0xa')](_0x18c958,{'showHidden':![],'depth':null}));};exports[_0x654c('0xd')]=function(_0x56e422){return function(_0x1c55cc){logger['info'](_0x56e422,util['inspect'](_0x1c55cc,{'showHidden':![],'depth':null}));};};exports[_0x654c('0xe')]=function(_0x112ab5,_0x4f3586,_0x24c392){return{'message':_0x112ab5,'unlock':_0x4f3586,'active':_0x24c392};};exports[_0x654c('0xf')]=function(_0x20125d,_0xc08f03,_0x5e8889){if(!_['isUndefined'](_0x5e8889)&&_0x654c('0x10')===typeof _0x5e8889&&!_[_0x654c('0x11')](_0x5e8889)){if(!_[_0x654c('0x12')](_0xc08f03)&&'string'===typeof _0xc08f03&&!_[_0x654c('0x11')](_0xc08f03)){return util['format']('\x22%s\x22\x20<%s>',_0xc08f03,_0x5e8889);}return util[_0x654c('0x13')](_0x654c('0x14'),_0x5e8889,_0x5e8889);}if(!_['isUndefined'](_0x20125d)&&'string'===typeof _0x20125d&&!_[_0x654c('0x11')](_0x20125d)){return _0x20125d;}return _0x654c('0x15');};exports[_0x654c('0x16')]=function(_0x5997f){if(_[_0x654c('0x17')](_0x5997f)){return![];}return _0x5997f;};exports[_0x654c('0x18')]=function(_0xae5e06,_0x5041e4,_0x53c3a2,_0x17b2fe,_0x4b0130,_0x59c414){var _0x548531={'XMD-QUEUE':_0x5041e4['Queue']?_0x5041e4['Queue'][_0x654c('0x19')]:'','XMD-CALLERID':_0x17b2fe,'XMD-CALLERID-PREVIEW':_0x59c414?util[_0x654c('0x13')](_0x654c('0x14'),_0x59c414['calleridname'],_0x59c414[_0x654c('0x1a')]):_0x17b2fe,'XMD-DIALID':_0x4b0130,'XMD-CONTACTID':_0x5041e4['ContactId'],'XMD-CDRTYPE':_0x654c('0x1b'),'CALLERID(all)':_0x17b2fe,'XMD-VOICEQUEUEID':_0x5041e4[_0x654c('0x1c')],'XMD-DIALCHANNEL':_0x53c3a2,'XMD-DIALTIMEOUT':_0xae5e06[_0x654c('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x654c('0x13')](_0x654c('0x1e'),_0xae5e06[_0x654c('0x1f')]?'g':'',_[_0x654c('0x11')](_0xae5e06[_0x654c('0x20')])?'':_0x654c('0x21')),'XMD-DIALURL':_0xae5e06[_0x654c('0x22')]||'','XMD-AGI':_0xae5e06['dialQueueProject']?util[_0x654c('0x13')](_0x654c('0x23'),ipAgi,_0xae5e06[_0x654c('0x24')]):_0x654c('0x25'),'XMD-AGIAFTER':_0xae5e06[_0x654c('0x1f')]?util['format'](_0x654c('0x23'),ipAgi,_0xae5e06['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x59c414?_0x59c414[_0x654c('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x59c414?_0x59c414[_0x654c('0x27')]:'','XMD-DESTINATION':_0x654c('0x28')};if(!_[_0x654c('0x11')](_0xae5e06[_0x654c('0x20')])){_0x548531[util[_0x654c('0x13')]('%s',_0x654c('0x29'))]=_0xae5e06[_0x654c('0x20')];_0x548531[util[_0x654c('0x13')]('%s',_0x654c('0x2a'))]=_0x4b0130;}if(_0x5041e4&&_0x5041e4[_0x654c('0x2b')]){for(var _0x2423b1 in _0x5041e4['Contact']){if(_0x5041e4[_0x654c('0x2b')][_0x654c('0x2c')](_0x2423b1)){if(!_[_0x654c('0x17')](_0x5041e4[_0x654c('0x2b')][_0x2423b1])&&_0x2423b1!=='id'&&_0x2423b1!==_0x654c('0x2d')&&_0x2423b1!==_0x654c('0x2e')&&_0x2423b1!==_0x654c('0x2f')){_0x548531[util[_0x654c('0x13')]('%s%s',_0x654c('0x30'),_[_0x654c('0x31')](_0x2423b1))]=_0x5041e4[_0x654c('0x2b')][_0x2423b1];}}}}return _0x548531;};exports['toLowerVariables']=function(_0x33130c){var _0x1685cc={};for(var _0x47ce47 in _0x33130c){if(_0x33130c[_0x654c('0x2c')](_0x47ce47)){_0x1685cc[util[_0x654c('0x13')]('%s',_[_0x654c('0x32')](_0x47ce47))]=_0x33130c[_0x47ce47];}}return{'variables':_0x1685cc};};exports[_0x654c('0x33')]=function(_0x443c0e,_0x3e510c){if(!_['isNil'](_0x443c0e)){if(_0x443c0e[_0x654c('0x2c')]('originated')){if(_0x443c0e['originated']>0x0){_0x443c0e[_0x654c('0x34')]-=0x1;}else{logger['error'](_0x654c('0x35'),_0x3e510c);}}}else{logger[_0x654c('0x36')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3e510c);}};exports[_0x654c('0x37')]=function(_0x5ab29c){var _0x3aba90=moment()['format'](_0x654c('0x38'));_0x5ab29c[_0x654c('0x39')]=0xd;_0x5ab29c[_0x654c('0x3a')]=_0x654c('0x3b');_0x5ab29c['starttime']=_0x3aba90;_0x5ab29c[_0x654c('0x3c')]=_0x3aba90;_0x5ab29c[_0x654c('0x3d')]=_0x3aba90;};exports[_0x654c('0x3e')]=function(_0x28bd30,_0x2b24da,_0x39e8e9){var _0x341719=moment()['format'](_0x654c('0x38'));_0x28bd30[_0x654c('0x39')]=_0x2b24da;_0x28bd30[_0x654c('0x3a')]=_0x39e8e9;_0x28bd30[_0x654c('0x3c')]=_0x341719;_0x28bd30[_0x654c('0x3f')]=getSeconds(_0x28bd30['responsetime'],_0x28bd30['starttime']);};exports['logLookAgent']=function(_0x332a0d,_0x135637,_0xd384a5){_0x332a0d[_0x654c('0x40')]=_0x135637;_0x332a0d['UserId']=_0xd384a5;};exports['logCustomer']=function(_0x237bf9,_0x39b8ce,_0x5ca375){var _0x14f435=moment()['format'](_0x654c('0x38'));_0x237bf9[_0x654c('0x39')]=_0x39b8ce;_0x237bf9[_0x654c('0x3a')]=_0x5ca375;_0x237bf9['responsetime']=_0x237bf9[_0x654c('0x3c')]?_0x237bf9['responsetime']:_0x14f435;_0x237bf9['endtime']=_0x237bf9[_0x654c('0x3d')]?_0x237bf9['endtime']:_0x14f435;_0x237bf9[_0x654c('0x3f')]=getSeconds(_0x237bf9[_0x654c('0x3c')]||0x0,_0x237bf9['starttime']||0x0);_0x237bf9[_0x654c('0x41')]=_0x237bf9[_0x654c('0x42')]?getSeconds(_0x237bf9['endtime'],_0x237bf9[_0x654c('0x42')]):0x0;};exports[_0x654c('0x43')]=function(_0x3d0657){return _0x3d0657==='Failure';};exports[_0x654c('0x44')]=function(_0x58d1c0,_0x5584e4,_0x375f39,_0x3163a8,_0xc67b99){var _0x374568=_0x3163a8?'RECALL':_0x58d1c0[_0x654c('0x45')];_0x374568=_0xc67b99?'BOOKED':_0x374568;return{'actionid':_0x58d1c0['uniqueid'],'action':'originate','channel':_0x58d1c0[_0x654c('0x46')],'callerid':util['format'](_0x654c('0x14'),_0x374568,_0x58d1c0[_0x654c('0x1a')]),'Exten':_0x654c('0x28'),'Context':'from-sip','Priority':'1','variable':_0x375f39,'timeout':(_0x5584e4[_0x654c('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x58d1c0[_0x654c('0x48')]};};exports[_0x654c('0x49')]=function(_0x8531d0){return _0x8531d0[_0x654c('0x4a')]+_0x8531d0[_0x654c('0x4b')]+_0x8531d0[_0x654c('0x4c')];};exports[_0x654c('0x4d')]=function(_0x51e450){var _0x55c5b7=_['clone'](_0x51e450);_0x55c5b7[_0x654c('0x39')]=0xf;_0x55c5b7['statedesc']=_0x654c('0x4e');return _0x55c5b7;};exports[_0x654c('0x4f')]=function(_0x39c164,_0x3bfb22,_0x344cf6){var _0x147e85={};_0x147e85[_0x3bfb22]=_0x39c164[_0x3bfb22];_0x147e85['active']=![];_0x147e85['scheduledat']=moment()[_0x654c('0x50')](_0x344cf6,_0x654c('0x51'))[_0x654c('0x13')](_0x654c('0x38'));_0x147e85[_0x654c('0x52')]=_0x39c164[_0x654c('0x52')];_0x147e85[_0x654c('0x53')]=_0x39c164[_0x654c('0x53')];_0x147e85[_0x654c('0x1c')]=_0x39c164[_0x654c('0x1c')]||undefined;return _0x147e85;};exports[_0x654c('0x54')]=function(_0x3e4d33,_0x1577a3){if(!_[_0x654c('0x17')](_0x3e4d33)){if(_0x3e4d33[_0x654c('0x55')]>0x0){_0x3e4d33['pTalking']-=0x1;}else{logger[_0x654c('0x36')](_0x1577a3,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x654c('0x36')](_0x1577a3,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x50d540){if(_0x50d540<=0x0){return!![];}return![];};exports[_0x654c('0x56')]=function(_0xd5f9ad,_0x37c67c){_0xd5f9ad[_0x654c('0x57')]=_0x37c67c;_0xd5f9ad[_0x654c('0x19')]=_0xd5f9ad[_0x654c('0x58')];_0xd5f9ad[_0x654c('0x59')]=_0xd5f9ad['channelAgent'];return _0xd5f9ad;};exports[_0x654c('0x5a')]=function(_0x263960){var _0x4560d={};_0x4560d['queue']=_0x263960[_0x654c('0x58')];_0x4560d[_0x654c('0x59')]=_0x263960[_0x654c('0x46')];_0x4560d[_0x654c('0x48')]=_0x263960['uniqueid'];return _0x4560d;};exports[_0x654c('0x5b')]=function(_0x3b8134){var _0x5e9dfe=[];for(var _0x2fe1c9 in _0x3b8134){if(_0x3b8134[_0x654c('0x2c')](_0x2fe1c9)){if(!_[_0x654c('0x17')](_0x3b8134[_0x2fe1c9])&&_0x3b8134[_0x2fe1c9]['state']===_0x654c('0x5c')&&_0x3b8134[_0x2fe1c9][_0x654c('0x5d')]==='reachable'){_0x5e9dfe[_0x654c('0x5e')](_0x3b8134[_0x2fe1c9]['id']);}}}return _0x5e9dfe;};exports[_0x654c('0x5f')]=function(_0x57d3d1){var _0x346345=moment()['milliseconds'](0x0);var _0x1484e4=moment(_0x57d3d1)[_0x654c('0x6')](0x0);return _0x346345['diff'](_0x1484e4,_0x654c('0x8'));};exports['createBody']=function(_0x271e2a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x271e2a[_0x654c('0x52')],'ListId':_0x271e2a['ListId'],'VoiceQueueId':_0x271e2a['VoiceQueueId']||undefined,'CampaignId':_0x271e2a[_0x654c('0x60')]||undefined};};exports['filterKey']=function(_0x5af33b){if(_0x5af33b==='uniqueid'||_0x5af33b===_0x654c('0x61')||_0x5af33b===_0x654c('0x58')||_0x5af33b===_0x654c('0x62')||_0x5af33b==='campaigntype'||_0x5af33b===_0x654c('0x63')||_0x5af33b===_0x654c('0x40')||_0x5af33b===_0x654c('0x46')||_0x5af33b===_0x654c('0x45')||_0x5af33b===_0x654c('0x64')||_0x5af33b===_0x654c('0x1a')||_0x5af33b===_0x654c('0x65')||_0x5af33b===_0x654c('0x4a')||_0x5af33b===_0x654c('0x4b')||_0x5af33b==='countnoanswerretry'||_0x5af33b==='countglobal'||_0x5af33b===_0x654c('0x66')||_0x5af33b===_0x654c('0x67')||_0x5af33b===_0x654c('0x68')||_0x5af33b===_0x654c('0x69')||_0x5af33b===_0x654c('0x52')||_0x5af33b==='ListId'||_0x5af33b==='UserId'||_0x5af33b===_0x654c('0x1c')||_0x5af33b===_0x654c('0x6a')||_0x5af33b===_0x654c('0x6b')||_0x5af33b===_0x654c('0x6c')||_0x5af33b===_0x654c('0x6d')||_0x5af33b===_0x654c('0x6e')||_0x5af33b===_0x654c('0x6f')||_0x5af33b===_0x654c('0x70')||_0x5af33b===_0x654c('0x71')||_0x5af33b===_0x654c('0x72')||_0x5af33b===_0x654c('0x73')||_0x5af33b===_0x654c('0x74')||_0x5af33b===_0x654c('0x75')||_0x5af33b===_0x654c('0x76')||_0x5af33b===_0x654c('0x77')||_0x5af33b==='xmd-agi'||_0x5af33b===_0x654c('0x78')||_0x5af33b===_0x654c('0x79')||_0x5af33b===_0x654c('0x7a')||_0x5af33b===_0x654c('0x7b')||_0x5af33b===_0x654c('0x7c')||_0x5af33b===_0x654c('0x7d')||_0x5af33b===_0x654c('0x7e')||_0x5af33b===_0x654c('0x7f')||_0x5af33b===_0x654c('0x78')||_0x5af33b===_0x654c('0x79')||_0x5af33b===_0x654c('0x7a')||_0x5af33b===_0x654c('0x7b')||_0x5af33b==='rtpaudioqosloss'||_0x5af33b==='rtpaudioqoslossbridged'||_0x5af33b===_0x654c('0x7e')||_0x5af33b===_0x654c('0x7f')||_0x5af33b===_0x654c('0x80')||_0x5af33b===_0x654c('0x81')||_0x5af33b===_0x654c('0x39')||_0x5af33b==='statedesc'){return![];}return!![];};exports[_0x654c('0x82')]=function(_0x2322f2,_0x19860e){var _0x5d1fdf,_0x4b952a,_0x5daf3c;if(_0x19860e<=0x0){_0x19860e=0x1;}_0x5d1fdf=new RegExp(_0x654c('0x83')+_0x19860e+'}$');_0x4b952a=Math['pow'](0xa,_0x19860e-0x1);_0x5daf3c=Math[_0x654c('0x84')](0xa,_0x19860e)-0x1;return util[_0x654c('0x13')]('%s',_['replace'](_0x2322f2,_0x5d1fdf,_[_0x654c('0x85')](_0x4b952a,_0x5daf3c)));};exports[_0x654c('0x86')]=function(_0x3b5a46){var _0x523727=_0x3b5a46[_0x654c('0x87')](/"(.*?)"/);return _0x523727?_0x523727[0x1]:_0x3b5a46;};exports[_0x654c('0x88')]=function(_0x285998){var _0x57d96b=_0x285998[_0x654c('0x87')](/<(.*?)>/);return _0x57d96b?_0x57d96b[0x1]:_0x285998;}; \ No newline at end of file +var _0x5142=['replace','random','extractCalleridName','match','util','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','loggerCatch','error','info','inspect','logger2','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','updatedAt','%s%s','XMD-','toUpper','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','statedesc','talktime','answertime','variablesAction','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','clone','scheduledAt','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','seconds','CampaignId','filterKey','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow'];(function(_0x22dab9,_0x157be6){var _0x21fd4a=function(_0x467083){while(--_0x467083){_0x22dab9['push'](_0x22dab9['shift']());}};_0x21fd4a(++_0x157be6);}(_0x5142,0x108));var _0x2514=function(_0x270ebd,_0x83d024){_0x270ebd=_0x270ebd-0x0;var _0x85b9f0=_0x5142[_0x270ebd];return _0x85b9f0;};'use strict';var util=require(_0x2514('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x2514('0x1'))(_0x2514('0x2'));var ipAgi=process[_0x2514('0x3')][_0x2514('0x4')]||'127.0.0.1';function getSeconds(_0x504cc2,_0x468131){var _0x401069=moment(_0x504cc2)[_0x2514('0x5')](0x0);var _0x7463e2=moment(_0x468131)[_0x2514('0x5')](0x0);return _0x401069[_0x2514('0x6')](_0x7463e2,'seconds');}exports[_0x2514('0x7')]=function(_0x56f99b){return function(_0x6690c1){logger[_0x2514('0x8')](_0x56f99b,util['inspect'](_0x6690c1,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5ed845,_0x38cadf){logger[_0x2514('0x9')](_0x5ed845,util[_0x2514('0xa')](_0x38cadf,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1f2890,_0x3b65f4){logger[_0x2514('0x8')](_0x1f2890,util['inspect'](_0x3b65f4,{'showHidden':![],'depth':null}));};exports[_0x2514('0xb')]=function(_0x4e0f60){return function(_0x1fe902){logger[_0x2514('0x9')](_0x4e0f60,util[_0x2514('0xa')](_0x1fe902,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x4000f7,_0x1718ca,_0x13ad95){return{'message':_0x4000f7,'unlock':_0x1718ca,'active':_0x13ad95};};exports[_0x2514('0xc')]=function(_0x10c4d3,_0x1d5425,_0x421084){if(!_[_0x2514('0xd')](_0x421084)&&'string'===typeof _0x421084&&!_[_0x2514('0xe')](_0x421084)){if(!_[_0x2514('0xd')](_0x1d5425)&&_0x2514('0xf')===typeof _0x1d5425&&!_[_0x2514('0xe')](_0x1d5425)){return util[_0x2514('0x10')](_0x2514('0x11'),_0x1d5425,_0x421084);}return util['format'](_0x2514('0x11'),_0x421084,_0x421084);}if(!_['isUndefined'](_0x10c4d3)&&_0x2514('0xf')===typeof _0x10c4d3&&!_[_0x2514('0xe')](_0x10c4d3)){return _0x10c4d3;}return _0x2514('0x12');};exports['isActive']=function(_0x1d3e91){if(_[_0x2514('0x13')](_0x1d3e91)){return![];}return _0x1d3e91;};exports[_0x2514('0x14')]=function(_0x14ecdf,_0x2b7a12,_0x270298,_0x590a4c,_0xa68b5f,_0x322af6){var _0x15e7b9={'XMD-QUEUE':_0x2b7a12[_0x2514('0x15')]?_0x2b7a12['Queue'][_0x2514('0x16')]:'','XMD-CALLERID':_0x590a4c,'XMD-CALLERID-PREVIEW':_0x322af6?util[_0x2514('0x10')]('\x22%s\x22\x20<%s>',_0x322af6[_0x2514('0x17')],_0x322af6[_0x2514('0x18')]):_0x590a4c,'XMD-DIALID':_0xa68b5f,'XMD-CONTACTID':_0x2b7a12[_0x2514('0x19')],'XMD-CDRTYPE':_0x2514('0x1a'),'CALLERID(all)':_0x590a4c,'XMD-VOICEQUEUEID':_0x2b7a12[_0x2514('0x1b')],'XMD-DIALCHANNEL':_0x270298,'XMD-DIALTIMEOUT':_0x14ecdf[_0x2514('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x2514('0x10')]('\x22rtTxX%s%s\x22',_0x14ecdf[_0x2514('0x1d')]?'g':'',_[_0x2514('0xe')](_0x14ecdf['monitor_format'])?'':_0x2514('0x1e')),'XMD-DIALURL':_0x14ecdf['dialPreviewUrl']||'','XMD-AGI':_0x14ecdf[_0x2514('0x1f')]?util[_0x2514('0x10')](_0x2514('0x20'),ipAgi,_0x14ecdf[_0x2514('0x1f')]):_0x2514('0x21'),'XMD-AGIAFTER':_0x14ecdf[_0x2514('0x1d')]?util['format'](_0x2514('0x20'),ipAgi,_0x14ecdf[_0x2514('0x1d')]):_0x2514('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x322af6?_0x322af6[_0x2514('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x322af6?_0x322af6[_0x2514('0x23')]:'','XMD-DESTINATION':_0x2514('0x24')};if(!_[_0x2514('0xe')](_0x14ecdf[_0x2514('0x25')])){_0x15e7b9[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x14ecdf[_0x2514('0x25')];_0x15e7b9[util['format']('%s',_0x2514('0x26'))]=_0xa68b5f;}if(_0x2b7a12&&_0x2b7a12['Contact']){for(var _0x1d7124 in _0x2b7a12[_0x2514('0x27')]){if(_0x2b7a12[_0x2514('0x27')]['hasOwnProperty'](_0x1d7124)){if(!_[_0x2514('0x13')](_0x2b7a12[_0x2514('0x27')][_0x1d7124])&&_0x1d7124!=='id'&&_0x1d7124!=='tags'&&_0x1d7124!=='createdAt'&&_0x1d7124!==_0x2514('0x28')){_0x15e7b9[util[_0x2514('0x10')](_0x2514('0x29'),_0x2514('0x2a'),_[_0x2514('0x2b')](_0x1d7124))]=_0x2b7a12[_0x2514('0x27')][_0x1d7124];}}}}return _0x15e7b9;};exports['toLowerVariables']=function(_0x28cb8a){var _0x58978f={};for(var _0xbafb3b in _0x28cb8a){if(_0x28cb8a[_0x2514('0x2c')](_0xbafb3b)){_0x58978f[util['format']('%s',_[_0x2514('0x2d')](_0xbafb3b))]=_0x28cb8a[_0xbafb3b];}}return{'variables':_0x58978f};};exports[_0x2514('0x2e')]=function(_0x54a521,_0x230434){if(!_[_0x2514('0x13')](_0x54a521)){if(_0x54a521[_0x2514('0x2c')](_0x2514('0x2f'))){if(_0x54a521['originated']>0x0){_0x54a521[_0x2514('0x2f')]-=0x1;}else{logger[_0x2514('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x230434);}}}else{logger['error'](_0x2514('0x30'),_0x230434);}};exports[_0x2514('0x31')]=function(_0xb269f7){var _0x5c92cc=moment()['format'](_0x2514('0x32'));_0xb269f7[_0x2514('0x33')]=0xd;_0xb269f7['statedesc']=_0x2514('0x34');_0xb269f7[_0x2514('0x35')]=_0x5c92cc;_0xb269f7[_0x2514('0x36')]=_0x5c92cc;_0xb269f7[_0x2514('0x37')]=_0x5c92cc;};exports[_0x2514('0x38')]=function(_0x1c0937,_0x34c40b,_0x1164c0){var _0x581a05=moment()[_0x2514('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c0937[_0x2514('0x33')]=_0x34c40b;_0x1c0937['statedesc']=_0x1164c0;_0x1c0937[_0x2514('0x36')]=_0x581a05;_0x1c0937[_0x2514('0x39')]=getSeconds(_0x1c0937[_0x2514('0x36')],_0x1c0937[_0x2514('0x35')]);};exports[_0x2514('0x3a')]=function(_0x1e24f6,_0x35eb5f,_0x247a05){_0x1e24f6[_0x2514('0x3b')]=_0x35eb5f;_0x1e24f6[_0x2514('0x3c')]=_0x247a05;};exports[_0x2514('0x3d')]=function(_0x4b930b,_0x4595b5,_0x3e58d4){var _0xe9225e=moment()['format'](_0x2514('0x32'));_0x4b930b['state']=_0x4595b5;_0x4b930b[_0x2514('0x3e')]=_0x3e58d4;_0x4b930b['responsetime']=_0x4b930b['responsetime']?_0x4b930b[_0x2514('0x36')]:_0xe9225e;_0x4b930b[_0x2514('0x37')]=_0x4b930b[_0x2514('0x37')]?_0x4b930b[_0x2514('0x37')]:_0xe9225e;_0x4b930b[_0x2514('0x39')]=getSeconds(_0x4b930b[_0x2514('0x36')]||0x0,_0x4b930b[_0x2514('0x35')]||0x0);_0x4b930b[_0x2514('0x3f')]=_0x4b930b['answertime']?getSeconds(_0x4b930b[_0x2514('0x37')],_0x4b930b[_0x2514('0x40')]):0x0;};exports['isFailure']=function(_0x12036a){return _0x12036a==='Failure';};exports[_0x2514('0x41')]=function(_0x5f458c,_0xe66e50,_0x90e8e5,_0x1a92ab,_0x109c23){var _0x15afa6=_0x1a92ab?'RECALL':_0x5f458c[_0x2514('0x17')];_0x15afa6=_0x109c23?_0x2514('0x42'):_0x15afa6;return{'actionid':_0x5f458c[_0x2514('0x43')],'action':_0x2514('0x44'),'channel':_0x5f458c[_0x2514('0x45')],'callerid':util['format'](_0x2514('0x11'),_0x15afa6,_0x5f458c['calleridnum']),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x90e8e5,'timeout':(_0xe66e50[_0x2514('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5f458c[_0x2514('0x43')]};};exports[_0x2514('0x47')]=function(_0x398a9a){return _0x398a9a[_0x2514('0x48')]+_0x398a9a[_0x2514('0x49')]+_0x398a9a[_0x2514('0x4a')];};exports['cloneAction']=function(_0x595045){var _0x4173fb=_[_0x2514('0x4b')](_0x595045);_0x4173fb[_0x2514('0x33')]=0xf;_0x4173fb[_0x2514('0x3e')]='Global';return _0x4173fb;};exports[_0x2514('0x4c')]=function(_0x114bf1,_0xe68265,_0x187c4a){var _0x1fa35b={};_0x1fa35b[_0xe68265]=_0x114bf1[_0xe68265];_0x1fa35b[_0x2514('0x4d')]=![];_0x1fa35b[_0x2514('0x4e')]=moment()['add'](_0x187c4a,_0x2514('0x4f'))[_0x2514('0x10')](_0x2514('0x32'));_0x1fa35b[_0x2514('0x19')]=_0x114bf1['ContactId'];_0x1fa35b[_0x2514('0x50')]=_0x114bf1[_0x2514('0x50')];_0x1fa35b[_0x2514('0x1b')]=_0x114bf1[_0x2514('0x1b')]||undefined;return _0x1fa35b;};exports[_0x2514('0x51')]=function(_0x576e1c,_0x20d909){if(!_[_0x2514('0x13')](_0x576e1c)){if(_0x576e1c[_0x2514('0x52')]>0x0){_0x576e1c[_0x2514('0x52')]-=0x1;}else{logger['error'](_0x20d909,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x20d909,_0x2514('0x53'));}};exports[_0x2514('0x54')]=function(_0x5a2898){if(_0x5a2898<=0x0){return!![];}return![];};exports['buildObj']=function(_0xde159c,_0x1a08f2){_0xde159c[_0x2514('0x55')]=_0x1a08f2;_0xde159c['name']=_0xde159c[_0x2514('0x56')];_0xde159c[_0x2514('0x57')]=_0xde159c[_0x2514('0x45')];return _0xde159c;};exports['buildAcw']=function(_0x485f48){var _0x22a289={};_0x22a289[_0x2514('0x56')]=_0x485f48['queue'];_0x22a289[_0x2514('0x57')]=_0x485f48['channelAgent'];_0x22a289[_0x2514('0x43')]=_0x485f48[_0x2514('0x43')];return _0x22a289;};exports[_0x2514('0x58')]=function(_0x3c1498){var _0x58686b=[];for(var _0x479dcd in _0x3c1498){if(_0x3c1498[_0x2514('0x2c')](_0x479dcd)){if(!_['isNil'](_0x3c1498[_0x479dcd])&&_0x3c1498[_0x479dcd][_0x2514('0x33')]===_0x2514('0x59')&&_0x3c1498[_0x479dcd][_0x2514('0x5a')]===_0x2514('0x5b')){_0x58686b[_0x2514('0x5c')](_0x3c1498[_0x479dcd]['id']);}}}return _0x58686b;};exports[_0x2514('0x5d')]=function(_0x1d89be){var _0x405822=moment()['milliseconds'](0x0);var _0x324e81=moment(_0x1d89be)['milliseconds'](0x0);return _0x405822[_0x2514('0x6')](_0x324e81,_0x2514('0x5e'));};exports['createBody']=function(_0x3a82f2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3a82f2[_0x2514('0x19')],'ListId':_0x3a82f2[_0x2514('0x50')],'VoiceQueueId':_0x3a82f2['VoiceQueueId']||undefined,'CampaignId':_0x3a82f2[_0x2514('0x5f')]||undefined};};exports[_0x2514('0x60')]=function(_0x37a203){if(_0x37a203===_0x2514('0x43')||_0x37a203==='idContact'||_0x37a203===_0x2514('0x56')||_0x37a203===_0x2514('0x61')||_0x37a203===_0x2514('0x62')||_0x37a203===_0x2514('0x63')||_0x37a203===_0x2514('0x3b')||_0x37a203===_0x2514('0x45')||_0x37a203===_0x2514('0x17')||_0x37a203==='active'||_0x37a203==='calleridnum'||_0x37a203===_0x2514('0x4e')||_0x37a203===_0x2514('0x48')||_0x37a203==='countcongestionretry'||_0x37a203==='countnoanswerretry'||_0x37a203===_0x2514('0x64')||_0x37a203===_0x2514('0x65')||_0x37a203===_0x2514('0x66')||_0x37a203===_0x2514('0x67')||_0x37a203===_0x2514('0x68')||_0x37a203===_0x2514('0x19')||_0x37a203===_0x2514('0x50')||_0x37a203==='UserId'||_0x37a203===_0x2514('0x1b')||_0x37a203===_0x2514('0x69')||_0x37a203==='xmd-voicequeueid'||_0x37a203==='xmd-queue'||_0x37a203===_0x2514('0x6a')||_0x37a203==='xmd-listid'||_0x37a203===_0x2514('0x6b')||_0x37a203==='xmd-dialtimeout'||_0x37a203===_0x2514('0x6c')||_0x37a203==='xmd-dialid'||_0x37a203===_0x2514('0x6d')||_0x37a203==='xmd-contactid'||_0x37a203===_0x2514('0x6e')||_0x37a203===_0x2514('0x6f')||_0x37a203===_0x2514('0x70')||_0x37a203===_0x2514('0x71')||_0x37a203===_0x2514('0x72')||_0x37a203==='rtpaudioqosbridged'||_0x37a203===_0x2514('0x73')||_0x37a203===_0x2514('0x74')||_0x37a203===_0x2514('0x75')||_0x37a203===_0x2514('0x76')||_0x37a203===_0x2514('0x77')||_0x37a203==='rtpaudioqosrttbridged'||_0x37a203===_0x2514('0x72')||_0x37a203===_0x2514('0x78')||_0x37a203===_0x2514('0x73')||_0x37a203==='rtpaudioqosjitterbridged'||_0x37a203===_0x2514('0x75')||_0x37a203===_0x2514('0x76')||_0x37a203===_0x2514('0x77')||_0x37a203===_0x2514('0x79')||_0x37a203===_0x2514('0x7a')||_0x37a203===_0x2514('0x7b')||_0x37a203===_0x2514('0x33')||_0x37a203==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x197ebb,_0x2f3688){var _0x219afe,_0x55711b,_0x1673b3;if(_0x2f3688<=0x0){_0x2f3688=0x1;}_0x219afe=new RegExp(_0x2514('0x7c')+_0x2f3688+'}$');_0x55711b=Math[_0x2514('0x7d')](0xa,_0x2f3688-0x1);_0x1673b3=Math[_0x2514('0x7d')](0xa,_0x2f3688)-0x1;return util[_0x2514('0x10')]('%s',_[_0x2514('0x7e')](_0x197ebb,_0x219afe,_[_0x2514('0x7f')](_0x55711b,_0x1673b3)));};exports[_0x2514('0x80')]=function(_0x9bac00){var _0x1f644a=_0x9bac00['match'](/"(.*?)"/);return _0x1f644a?_0x1f644a[0x1]:_0x9bac00;};exports['extractCalleridNumber']=function(_0x5bece7){var _0x3386c5=_0x5bece7[_0x2514('0x81')](/<(.*?)>/);return _0x3386c5?_0x3386c5[0x1]:_0x5bece7;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a4fbe8f..31efbfd 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 _0x2b83=['boolean','queueremove','queuepause','voicequeuechannel','voicechannel','string','number'];(function(_0x316b58,_0x3c3857){var _0x2ba740=function(_0x1428d2){while(--_0x1428d2){_0x316b58['push'](_0x316b58['shift']());}};_0x2ba740(++_0x3c3857);}(_0x2b83,0x1d3));var _0x32b8=function(_0x4f2bc5,_0x1ced74){_0x4f2bc5=_0x4f2bc5-0x0;var _0x103453=_0x2b83[_0x4f2bc5];return _0x103453;};'use strict';exports['queueadd']={'queue':{'type':_0x32b8('0x0'),'required':!![]},'interface':{'type':_0x32b8('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x32b8('0x1'),'required':![]},'paused':{'type':_0x32b8('0x2'),'required':![]}};exports[_0x32b8('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x32b8('0x4')]={'interface':{'type':_0x32b8('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x32b8('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x32b8('0x0'),'required':![]}};exports[_0x32b8('0x5')]={'uniqueid':{'type':_0x32b8('0x0'),'required':!![]}};exports[_0x32b8('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x32b8('0x0')},'format':{'type':_0x32b8('0x0')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x32b8('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x32b8('0x0'),'required':!![]},'exten':{'type':_0x32b8('0x0'),'required':!![]},'context':{'type':_0x32b8('0x0')}}; \ No newline at end of file +var _0x0c02=['number','boolean','queueremove','queuepause','reload','voicequeuechannelhangup','string'];(function(_0x2b3d55,_0x2e668f){var _0x2b759b=function(_0x36aa23){while(--_0x36aa23){_0x2b3d55['push'](_0x2b3d55['shift']());}};_0x2b759b(++_0x2e668f);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';exports['queueadd']={'queue':{'type':_0x20c0('0x0'),'required':!![]},'interface':{'type':_0x20c0('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x20c0('0x1'),'required':![]},'paused':{'type':_0x20c0('0x2'),'required':![]}};exports[_0x20c0('0x3')]={'queue':{'type':_0x20c0('0x0'),'required':!![]},'interface':{'type':_0x20c0('0x0'),'required':!![]}};exports[_0x20c0('0x4')]={'interface':{'type':_0x20c0('0x0'),'required':!![]},'paused':{'type':_0x20c0('0x2')},'reason':{'type':_0x20c0('0x0'),'required':![]}};exports[_0x20c0('0x5')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x20c0('0x0'),'required':!![]},'filename':{'type':_0x20c0('0x0')},'format':{'type':_0x20c0('0x0')},'mixmonitorid':{'type':_0x20c0('0x0')}};exports[_0x20c0('0x6')]={'uniqueid':{'type':_0x20c0('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','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 a22ba62..4eeb326 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 _0xde7f=['servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','agents','length','isUndefined','initTelephones','initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','seconds','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts'];(function(_0x4befb6,_0x4ff231){var _0x1e66ea=function(_0x5b0582){while(--_0x5b0582){_0x4befb6['push'](_0x4befb6['shift']());}};_0x1e66ea(++_0x4ff231);}(_0xde7f,0xa4));var _0xfde7=function(_0x43445e,_0x493edd){_0x43445e=_0x43445e-0x0;var _0x5a7264=_0xde7f[_0x43445e];return _0x5a7264;};'use strict';var BPromise=require(_0xfde7('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0xfde7('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xfde7('0x2'));var Trunk=require(_0xfde7('0x3'));var VoiceQueue=require(_0xfde7('0x4'));var Trigger=require(_0xfde7('0x5'));var Template=require(_0xfde7('0x6'));var Campaign=require(_0xfde7('0x7'));var VoiceExtension=require(_0xfde7('0x8'));var ZendeskAccount=require(_0xfde7('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xfde7('0xa'));var ZohoAccount=require(_0xfde7('0xb'));var DeskAccount=require(_0xfde7('0xc'));var VtigerAccount=require(_0xfde7('0xd'));var ServicenowAccount=require(_0xfde7('0xe'));var Dynamics365Account=require(_0xfde7('0xf'));var FaxAccount=require(_0xfde7('0x10'));var Realtime=function(){this['agents']={};this[_0xfde7('0x11')]={};this[_0xfde7('0x12')]={};this[_0xfde7('0x13')]={};this[_0xfde7('0x14')]={};this[_0xfde7('0x15')]={};this[_0xfde7('0x16')]={};this[_0xfde7('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xfde7('0x18')]={};this['channels']={};this['queueChannels']={};this[_0xfde7('0x19')]={};this[_0xfde7('0x1a')]={};this[_0xfde7('0x1b')]={};this['salesforceAccounts']={};this[_0xfde7('0x1c')]={};this[_0xfde7('0x1d')]={};this[_0xfde7('0x1e')]={};this[_0xfde7('0x1f')]={};this['vtigerAccounts']={};this[_0xfde7('0x20')]={};this[_0xfde7('0x21')]={};this[_0xfde7('0x22')]={};};function freeIsNotKey(_0x5c9545,_0x1c740c,_0x1fdd19){var _0x558918=_[_0xfde7('0x23')](_0x5c9545,function(_0x33d4a6,_0x2ef226){return _0x33d4a6[_0x1fdd19];});for(var _0x3c6949 in _0x1c740c){if(_0x1c740c[_0xfde7('0x24')](_0x3c6949)){if(!_0x558918[_0x3c6949]){delete _0x1c740c[_0x3c6949];}}}}function freeIsNotKeySip(_0x2e7a22,_0x39f100){var _0xa26f7e=_['mapKeys'](_0x2e7a22,function(_0x19a7b0,_0x386299){return util[_0xfde7('0x25')]('SIP/%s',_0x19a7b0[_0xfde7('0x26')]);});for(var _0x4e18c3 in _0x39f100){if(_0x39f100[_0xfde7('0x24')](_0x4e18c3)){if(!_0xa26f7e[_0x4e18c3]){delete _0x39f100[_0x4e18c3];}}}}function freeIsNotKeyAgent(_0x8fb774,_0x441a28){var _0x102da4=_[_0xfde7('0x23')](_0x8fb774,function(_0x211446,_0x3652e8){var _0x171695=_[_0xfde7('0x27')](_0x211446[_0xfde7('0x28')])?util[_0xfde7('0x25')](_0xfde7('0x29'),_0x211446[_0xfde7('0x26')]):_0x211446[_0xfde7('0x28')];return _0x171695;});for(var _0x35a765 in _0x441a28){if(_0x441a28[_0xfde7('0x24')](_0x35a765)){if(!_0x102da4[_0x35a765]){delete _0x441a28[_0x35a765];}}}}function clearVoiceCallReports(_0x12d1c9){_0x12d1c9[_0xfde7('0x2a')]=0x0;_0x12d1c9['answered']=0x0;_0x12d1c9[_0xfde7('0x2b')]=0x0;_0x12d1c9[_0xfde7('0x2c')]=0x0;_0x12d1c9[_0xfde7('0x2d')]=0x0;}function clearCampaigns(_0x1033de){if(!_[_0xfde7('0x2e')](_0x1033de)){for(var _0x1acc03 in _0x1033de){if(_0x1033de[_0xfde7('0x24')](_0x1acc03)){_0x1033de[_0x1acc03]['ivrTotalCallsDays']=0x0;_0x1033de[_0x1acc03][_0xfde7('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x2d927e){if(!_['isEmpty'](_0x2d927e)){for(var _0x2fde7f in _0x2d927e){if(_0x2d927e[_0xfde7('0x24')](_0x2fde7f)){_0x2d927e[_0x2fde7f][_0xfde7('0x2a')]=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x30')]=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x31')]=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x32')]=0x0;_0x2d927e[_0x2fde7f]['sumHoldTime']=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x2c')]=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x2d')]=0x0;_0x2d927e[_0x2fde7f]['outboundAnswerAgiCallsDay']=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x33')]=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x34')]=0x0;_0x2d927e[_0x2fde7f]['outboundCongestionCallsDay']=0x0;_0x2d927e[_0x2fde7f]['outboundNoSuchCallsDay']=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x35')]=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x36')]=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x37')]=0x0;_0x2d927e[_0x2fde7f]['outboundBlacklistCallsDay']=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x38')]=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x39')]=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x3a')]=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x3b')]=0x0;_0x2d927e[_0x2fde7f][_0xfde7('0x3c')]=0x0;_0x2d927e[_0x2fde7f]['queueStatusComplete']=!![];}}}}Realtime[_0xfde7('0x3d')][_0xfde7('0x3e')]=function(_0x59363c,_0x304d3c){for(var _0xc4946e in _0x304d3c){if(_0x59363c[_0xfde7('0x24')](_0xc4946e)){_0x59363c[_0xc4946e]=_0x304d3c[_0xc4946e];}}};Realtime['prototype']['initAgents']=function(){var _0x23124f=this;return function(_0x223f0a){if(_0x223f0a){freeIsNotKeyAgent(_0x223f0a,_0x23124f[_0xfde7('0x3f')]);for(var _0xa9a5e4=0x0,_0x3c7977={},_0xae81c7={};_0xa9a5e4<_0x223f0a[_0xfde7('0x40')];_0xa9a5e4+=0x1){_0x3c7977=_0x223f0a[_0xa9a5e4];var _0x406c1d=_[_0xfde7('0x27')](_0x3c7977[_0xfde7('0x28')])?util[_0xfde7('0x25')](_0xfde7('0x29'),_0x3c7977['name']):_0x3c7977['interface'];if(_[_0xfde7('0x41')](_0x23124f[_0xfde7('0x3f')][_0x406c1d])){_0x23124f['agents'][_0x406c1d]=new Agent(_0x3c7977);}else{_0x23124f[_0xfde7('0x3e')](_0x23124f[_0xfde7('0x3f')][_0x406c1d],_0x3c7977);}}}return _0x23124f[_0xfde7('0x3f')];};};Realtime[_0xfde7('0x3d')][_0xfde7('0x42')]=function(){var _0x69090e=this;return function(_0x3cc986){if(_0x3cc986){freeIsNotKeySip(_0x3cc986,_0x69090e[_0xfde7('0x11')]);for(var _0x25b4cc=0x0,_0x313a1c={},_0x1297e0={};_0x25b4cc<_0x3cc986[_0xfde7('0x40')];_0x25b4cc+=0x1){_0x313a1c=_0x3cc986[_0x25b4cc];if(_[_0xfde7('0x41')](_0x69090e['telephones'][util[_0xfde7('0x25')](_0xfde7('0x29'),_0x313a1c['name'])])){_0x69090e['telephones'][util[_0xfde7('0x25')](_0xfde7('0x29'),_0x313a1c[_0xfde7('0x26')])]=new Telephone(_0x313a1c);}else{_0x69090e[_0xfde7('0x3e')](_0x69090e[_0xfde7('0x11')][util['format']('SIP/%s',_0x313a1c[_0xfde7('0x26')])],_0x313a1c);}}}return _0x69090e[_0xfde7('0x11')];};};Realtime[_0xfde7('0x3d')]['initTrunks']=function(){var _0x3f18ba=this;return function(_0x1d80b1){if(_0x1d80b1){freeIsNotKeySip(_0x1d80b1,_0x3f18ba[_0xfde7('0x12')]);for(var _0x453661=0x0,_0xcc13c3={},_0x5769cd={};_0x453661<_0x1d80b1[_0xfde7('0x40')];_0x453661+=0x1){_0xcc13c3=_0x1d80b1[_0x453661];if(_['isUndefined'](_0x3f18ba['trunks'][util[_0xfde7('0x25')](_0xfde7('0x29'),_0xcc13c3[_0xfde7('0x26')])])){_0x3f18ba[_0xfde7('0x12')][util[_0xfde7('0x25')](_0xfde7('0x29'),_0xcc13c3[_0xfde7('0x26')])]=new Trunk(_0xcc13c3);}else{_0x3f18ba[_0xfde7('0x3e')](_0x3f18ba[_0xfde7('0x12')][util[_0xfde7('0x25')](_0xfde7('0x29'),_0xcc13c3[_0xfde7('0x26')])],_0xcc13c3);}}}return _0x3f18ba['trunks'];};};Realtime[_0xfde7('0x3d')][_0xfde7('0x43')]=function(){var _0x53d29f=this;return function(_0x31cea9){if(_0x31cea9){freeIsNotKey(_0x31cea9,_0x53d29f[_0xfde7('0x13')],_0xfde7('0x26'));for(var _0xffbabb=0x0,_0x3479af={},_0x45ab41={};_0xffbabb<_0x31cea9[_0xfde7('0x40')];_0xffbabb+=0x1){_0x3479af=_0x31cea9[_0xffbabb];if(_[_0xfde7('0x41')](_0x53d29f['voiceQueues'][_0x3479af[_0xfde7('0x26')]])){_0x53d29f[_0xfde7('0x13')][_0x3479af['name']]=new VoiceQueue(_0x3479af);}else{_0x53d29f[_0xfde7('0x3e')](_0x53d29f[_0xfde7('0x13')][_0x3479af[_0xfde7('0x26')]],_0x3479af);}}}return _0x53d29f[_0xfde7('0x13')];};};Realtime[_0xfde7('0x3d')][_0xfde7('0x44')]=function(){var _0x342212=this;return function(_0x4c9060){if(_0x4c9060){freeIsNotKey(_0x4c9060,_0x342212[_0xfde7('0x14')],'id');for(var _0xd10603=0x0,_0x4a9cb2={},_0x3745b7={};_0xd10603<_0x4c9060['length'];_0xd10603+=0x1){_0x4a9cb2=_0x4c9060[_0xd10603];if(_[_0xfde7('0x41')](_0x342212['triggers'][_0x4a9cb2['id']])){_0x342212[_0xfde7('0x14')][_0x4a9cb2['id']]=new Trigger(_0x4a9cb2);}else{_0x342212['mergeFromDatabase'](_0x342212[_0xfde7('0x14')][_0x4a9cb2['id']],_0x4a9cb2);}}}return _0x342212['triggers'];};};Realtime[_0xfde7('0x3d')][_0xfde7('0x45')]=function(){var _0x5243a6=this;return function(_0x24f51f){if(_0x24f51f){freeIsNotKey(_0x24f51f,_0x5243a6[_0xfde7('0x16')],'id');for(var _0x3a1931=0x0,_0x5a4f5e={},_0x295bc4={};_0x3a1931<_0x24f51f[_0xfde7('0x40')];_0x3a1931+=0x1){_0x5a4f5e=_0x24f51f[_0x3a1931];if(_[_0xfde7('0x41')](_0x5243a6['templates'][_0x5a4f5e['id']])){_0x5243a6['templates'][_0x5a4f5e['id']]=new Template(_0x5a4f5e);}else{_0x5243a6['mergeFromDatabase'](_0x5243a6[_0xfde7('0x16')][_0x5a4f5e['id']],_0x5a4f5e);}}}return _0x5243a6[_0xfde7('0x16')];};};Realtime[_0xfde7('0x3d')]['initZendeskAccounts']=function(){var _0x29808b=this;return function(_0x2d9ac5){if(_0x2d9ac5){freeIsNotKey(_0x2d9ac5,_0x29808b[_0xfde7('0x1b')],'id');for(var _0x135aa0=0x0,_0x21576e={},_0x443a08={};_0x135aa0<_0x2d9ac5[_0xfde7('0x40')];_0x135aa0+=0x1){_0x21576e=_0x2d9ac5[_0x135aa0];if(_['isUndefined'](_0x29808b[_0xfde7('0x1b')][_0x21576e['id']])){_0x29808b['zendeskAccounts'][_0x21576e['id']]=new ZendeskAccount(_0x21576e);}else{_0x29808b[_0xfde7('0x3e')](_0x29808b[_0xfde7('0x1b')][_0x21576e['id']],_0x21576e);}}}return _0x29808b[_0xfde7('0x1b')];};};Realtime['prototype'][_0xfde7('0x46')]=function(){var _0x355bbe=this;return function(_0x30211c){if(_0x30211c){freeIsNotKey(_0x30211c,_0x355bbe[_0xfde7('0x47')],'id');for(var _0x260782=0x0,_0x127589={},_0x138abe={};_0x260782<_0x30211c[_0xfde7('0x40')];_0x260782+=0x1){_0x127589=_0x30211c[_0x260782];if(_[_0xfde7('0x41')](_0x355bbe[_0xfde7('0x47')][_0x127589['id']])){_0x355bbe['salesforceAccounts'][_0x127589['id']]=new SalesforceAccount(_0x127589);}else{_0x355bbe[_0xfde7('0x3e')](_0x355bbe[_0xfde7('0x47')][_0x127589['id']],_0x127589);}}}return _0x355bbe[_0xfde7('0x47')];};};Realtime[_0xfde7('0x3d')][_0xfde7('0x48')]=function(){var _0x2108c=this;return function(_0x5df8b1){if(_0x5df8b1){freeIsNotKey(_0x5df8b1,_0x2108c[_0xfde7('0x1d')],'id');for(var _0x5aa015=0x0,_0x51c504={},_0x49b8ca={};_0x5aa015<_0x5df8b1[_0xfde7('0x40')];_0x5aa015+=0x1){_0x51c504=_0x5df8b1[_0x5aa015];if(_['isUndefined'](_0x2108c[_0xfde7('0x1d')][_0x51c504['id']])){_0x2108c[_0xfde7('0x1d')][_0x51c504['id']]=new FreshdeskAccount(_0x51c504);}else{_0x2108c[_0xfde7('0x3e')](_0x2108c[_0xfde7('0x1d')][_0x51c504['id']],_0x51c504);}}}return _0x2108c['freshdeskAccounts'];};};Realtime[_0xfde7('0x3d')]['initZohoAccounts']=function(){var _0xde4366=this;return function(_0x14ae52){if(_0x14ae52){freeIsNotKey(_0x14ae52,_0xde4366[_0xfde7('0x1e')],'id');for(var _0xcd0405=0x0,_0xe6d2e8={},_0x496135={};_0xcd0405<_0x14ae52['length'];_0xcd0405+=0x1){_0xe6d2e8=_0x14ae52[_0xcd0405];if(_[_0xfde7('0x41')](_0xde4366[_0xfde7('0x1e')][_0xe6d2e8['id']])){_0xde4366[_0xfde7('0x1e')][_0xe6d2e8['id']]=new ZohoAccount(_0xe6d2e8);}else{_0xde4366[_0xfde7('0x3e')](_0xde4366[_0xfde7('0x1e')][_0xe6d2e8['id']],_0xe6d2e8);}}}return _0xde4366['zohoAccounts'];};};Realtime[_0xfde7('0x3d')]['initDeskAccounts']=function(){var _0x44bca3=this;return function(_0x225450){if(_0x225450){freeIsNotKey(_0x225450,_0x44bca3['deskAccounts'],'id');for(var _0x2f4b9c=0x0,_0x2a5dfc={},_0x1f0747={};_0x2f4b9c<_0x225450[_0xfde7('0x40')];_0x2f4b9c+=0x1){_0x2a5dfc=_0x225450[_0x2f4b9c];if(_[_0xfde7('0x41')](_0x44bca3[_0xfde7('0x1f')][_0x2a5dfc['id']])){_0x44bca3[_0xfde7('0x1f')][_0x2a5dfc['id']]=new DeskAccount(_0x2a5dfc);}else{_0x44bca3[_0xfde7('0x3e')](_0x44bca3[_0xfde7('0x1f')][_0x2a5dfc['id']],_0x2a5dfc);}}}return _0x44bca3[_0xfde7('0x1f')];};};Realtime[_0xfde7('0x3d')]['initSugarcrmAccounts']=function(){var _0x351cf5=this;return function(_0xdfd2d0){if(_0xdfd2d0){freeIsNotKey(_0xdfd2d0,_0x351cf5['sugarcrmAccounts'],'id');for(var _0x5ae124=0x0,_0x25d283={},_0x3bafcf={};_0x5ae124<_0xdfd2d0[_0xfde7('0x40')];_0x5ae124+=0x1){_0x25d283=_0xdfd2d0[_0x5ae124];if(_[_0xfde7('0x41')](_0x351cf5[_0xfde7('0x1c')][_0x25d283['id']])){_0x351cf5[_0xfde7('0x1c')][_0x25d283['id']]=new SugarcrmAccount(_0x25d283);}else{_0x351cf5['mergeFromDatabase'](_0x351cf5[_0xfde7('0x1c')][_0x25d283['id']],_0x25d283);}}}return _0x351cf5[_0xfde7('0x1c')];};};Realtime[_0xfde7('0x3d')][_0xfde7('0x49')]=function(){var _0x4b0921=this;return function(_0x2f4325){if(_0x2f4325){freeIsNotKey(_0x2f4325,_0x4b0921[_0xfde7('0x4a')],'id');for(var _0x14503b=0x0,_0x5384a4={},_0x4456ec={};_0x14503b<_0x2f4325[_0xfde7('0x40')];_0x14503b+=0x1){_0x5384a4=_0x2f4325[_0x14503b];if(_['isUndefined'](_0x4b0921[_0xfde7('0x4a')][_0x5384a4['id']])){_0x4b0921[_0xfde7('0x4a')][_0x5384a4['id']]=new VtigerAccount(_0x5384a4);}else{_0x4b0921[_0xfde7('0x3e')](_0x4b0921[_0xfde7('0x4a')][_0x5384a4['id']],_0x5384a4);}}}return _0x4b0921[_0xfde7('0x4a')];};};Realtime['prototype'][_0xfde7('0x4b')]=function(){var _0x2bac1d=this;return function(_0x3918f0){if(_0x3918f0){freeIsNotKey(_0x3918f0,_0x2bac1d['servicenowAccounts'],'id');for(var _0x45512e=0x0,_0x5010ab={},_0x59ea7d={};_0x45512e<_0x3918f0[_0xfde7('0x40')];_0x45512e+=0x1){_0x5010ab=_0x3918f0[_0x45512e];if(_[_0xfde7('0x41')](_0x2bac1d[_0xfde7('0x20')][_0x5010ab['id']])){_0x2bac1d[_0xfde7('0x20')][_0x5010ab['id']]=new ServicenowAccount(_0x5010ab);}else{_0x2bac1d[_0xfde7('0x3e')](_0x2bac1d['servicenowAccounts'][_0x5010ab['id']],_0x5010ab);}}}return _0x2bac1d['servicenowAccounts'];};};Realtime[_0xfde7('0x3d')][_0xfde7('0x4c')]=function(){var _0x4bd1bf=this;return function(_0x8aecf9){if(_0x8aecf9){freeIsNotKey(_0x8aecf9,_0x4bd1bf[_0xfde7('0x21')],'id');for(var _0x148cb6=0x0,_0x22181d={},_0x4f7079={};_0x148cb6<_0x8aecf9['length'];_0x148cb6+=0x1){_0x22181d=_0x8aecf9[_0x148cb6];if(_[_0xfde7('0x41')](_0x4bd1bf['dynamics365Accounts'][_0x22181d['id']])){_0x4bd1bf['dynamics365Accounts'][_0x22181d['id']]=new Dynamics365Account(_0x22181d);}else{_0x4bd1bf[_0xfde7('0x3e')](_0x4bd1bf[_0xfde7('0x21')][_0x22181d['id']],_0x22181d);}}}return _0x4bd1bf['dynamics365Accounts'];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x24c336=this;return function(_0x2d8e43){for(var _0x5dbe01=0x0;_0x5dbe01<_0x2d8e43[_0xfde7('0x40')];_0x5dbe01+=0x1){_[_0xfde7('0x4d')](_0x24c336['voiceQueues'][_0x2d8e43[_0x5dbe01]['name']],_0x2d8e43[_0x5dbe01]);}return _0x24c336[_0xfde7('0x13')];};};Realtime[_0xfde7('0x3d')][_0xfde7('0x4e')]=function(){var _0x5dd89b=this;return function(_0x406c6b){clearVoiceQueues(_0x5dd89b[_0xfde7('0x13')]);if(_0x406c6b){_0x406c6b=_[_0xfde7('0x4f')](_0x406c6b,'uniqueid');for(var _0x342ee3 in _0x406c6b){if(_0x406c6b['hasOwnProperty'](_0x342ee3)){var _0x26b7b9={};for(var _0x1804d9=0x0;_0x1804d9<_0x406c6b[_0x342ee3]['length'];_0x1804d9+=0x1){var _0x483c34=_0x406c6b[_0x342ee3][_0x1804d9][_0xfde7('0x50')];if(_0x5dd89b[_0xfde7('0x13')][_0x483c34]){if(_0x406c6b[_0x342ee3][_0x1804d9][_0xfde7('0x51')]){_0x5dd89b[_0xfde7('0x13')][_0x483c34][_0xfde7('0x31')]+=0x1;}if(_0x406c6b[_0x342ee3][_0x1804d9][_0xfde7('0x52')]){_0x5dd89b[_0xfde7('0x13')][_0x483c34][_0xfde7('0x32')]+=0x1;}_0x5dd89b[_0xfde7('0x13')][_0x483c34]['sumHoldTime']+=moment(_0x406c6b[_0x342ee3][_0x1804d9]['queuecallerleaveAt'])[_0xfde7('0x53')](moment(_0x406c6b[_0x342ee3][_0x1804d9][_0xfde7('0x54')]),'seconds')||0x0;if(_0x1804d9===_0x406c6b[_0x342ee3][_0xfde7('0x40')]-0x1){_0x5dd89b[_0xfde7('0x13')][_0x483c34]['sumDuration']+=moment(_0x406c6b[_0x342ee3][_0x1804d9][_0xfde7('0x55')]||_0x406c6b[_0x342ee3][_0x1804d9][_0xfde7('0x56')]||_0x406c6b[_0x342ee3][_0x1804d9]['queuecallerexitAt'])[_0xfde7('0x53')](moment(_0x406c6b[_0x342ee3][_0x1804d9][_0xfde7('0x54')]),_0xfde7('0x57'))||0x0;_0x5dd89b['voiceQueues'][_0x483c34][_0xfde7('0x2a')]+=0x1;if(_0x406c6b[_0x342ee3][_0x1804d9]['queuecallercomplete']){_0x5dd89b[_0xfde7('0x13')][_0x483c34]['answered']+=0x1;_0x5dd89b['voiceQueues'][_0x483c34][_0xfde7('0x2d')]+=moment(_0x406c6b[_0x342ee3][_0x1804d9][_0xfde7('0x55')])[_0xfde7('0x53')](moment(_0x406c6b[_0x342ee3][_0x1804d9][_0xfde7('0x58')]),_0xfde7('0x57'))||0x0;}}else{_0x5dd89b[_0xfde7('0x13')][_0x483c34][_0xfde7('0x2c')]+=_0x5dd89b[_0xfde7('0x13')][_0x483c34][_0xfde7('0x2b')]||0x0;}}}}}}return _0x5dd89b[_0xfde7('0x13')];};};Realtime[_0xfde7('0x3d')][_0xfde7('0x59')]=function(){var _0xed4490=this;return function(_0x1dcfb2){clearVoiceCallReports(_0xed4490[_0xfde7('0x17')]);if(_0x1dcfb2){for(var _0x25c14f=0x0;_0x25c14f<_0x1dcfb2[_0xfde7('0x40')];_0x25c14f+=0x1){_0xed4490[_0xfde7('0x17')][_0xfde7('0x2a')]+=0x1;_0xed4490[_0xfde7('0x17')][_0xfde7('0x2c')]+=_0x1dcfb2[_0x25c14f][_0xfde7('0x5a')];if(_0x1dcfb2[_0x25c14f][_0xfde7('0x5b')]===_0xfde7('0x5c')){_0xed4490[_0xfde7('0x17')][_0xfde7('0x30')]+=0x1;_0xed4490[_0xfde7('0x17')]['sumHoldTime']+=_0x1dcfb2[_0x25c14f][_0xfde7('0x5a')]-_0x1dcfb2[_0x25c14f]['billableseconds']||0x0;_0xed4490[_0xfde7('0x17')][_0xfde7('0x2d')]+=_0x1dcfb2[_0x25c14f][_0xfde7('0x5d')];}}}return _0xed4490['outbound'];};};Realtime[_0xfde7('0x3d')]['initCampaigns']=function(){var _0x22b401=this;return function(_0x4e40bc){if(_0x4e40bc){freeIsNotKey(_0x4e40bc,_0x22b401[_0xfde7('0x15')],_0xfde7('0x26'));for(var _0x102f7f=0x0,_0x34278b={};_0x102f7f<_0x4e40bc[_0xfde7('0x40')];_0x102f7f+=0x1){_0x34278b=_0x4e40bc[_0x102f7f];if(_[_0xfde7('0x41')](_0x22b401[_0xfde7('0x15')][_0x34278b[_0xfde7('0x26')]])){_0x22b401[_0xfde7('0x15')][_0x34278b['name']]=new Campaign(_0x34278b);}else{_0x22b401['mergeFromDatabase'](_0x22b401[_0xfde7('0x15')][_0x34278b['name']],_0x34278b);}}}return _0x22b401[_0xfde7('0x15')];};};Realtime[_0xfde7('0x3d')][_0xfde7('0x5e')]=function(){var _0x47b1de=this;return function(_0x4d6ed2){if(_0x4d6ed2){freeIsNotKey(_0x4d6ed2,_0x47b1de[_0xfde7('0x18')],'id');for(var _0x574ece=0x0,_0x526d28={};_0x574ece<_0x4d6ed2[_0xfde7('0x40')];_0x574ece+=0x1){_0x526d28=_0x4d6ed2[_0x574ece];if(_['isUndefined'](_0x47b1de['voiceExtensions'][_0x526d28['id']])){_0x47b1de[_0xfde7('0x18')][_0x526d28['id']]=new VoiceExtension(_0x526d28);}else{_0x47b1de[_0xfde7('0x3e')](_0x47b1de[_0xfde7('0x18')][_0x526d28['id']],_0x526d28);}}}return _0x47b1de[_0xfde7('0x18')];};};Realtime[_0xfde7('0x3d')][_0xfde7('0x5f')]=function(){var _0x1abfcf=this;return function(_0x1539e3){clearCampaigns(_0x1abfcf['campaigns']);for(var _0x5861e9=0x0;_0x5861e9<_0x1539e3[_0xfde7('0x40')];_0x5861e9+=0x1){_[_0xfde7('0x4d')](_0x1abfcf[_0xfde7('0x15')][_0x1539e3[_0x5861e9]['name']],_0x1539e3[_0x5861e9]);}return _0x1abfcf[_0xfde7('0x15')];};};Realtime['prototype'][_0xfde7('0x60')]=function(){var _0x220834=this;return function(_0x377b32){if(_0x377b32){freeIsNotKey(_0x377b32,_0x220834[_0xfde7('0x22')],'id');for(var _0x121c8e=0x0,_0x5197ec={},_0x3b4cb9={};_0x121c8e<_0x377b32[_0xfde7('0x40')];_0x121c8e+=0x1){_0x5197ec=_0x377b32[_0x121c8e];if(_[_0xfde7('0x41')](_0x220834[_0xfde7('0x22')][_0x5197ec['id']])){_0x220834[_0xfde7('0x22')][_0x5197ec['id']]=new FaxAccount(_0x5197ec);}else{_0x220834[_0xfde7('0x3e')](_0x220834[_0xfde7('0x22')][_0x5197ec['id']],_0x5197ec);}}}return _0x220834[_0xfde7('0x22')];};};module[_0xfde7('0x61')]=Realtime; \ No newline at end of file +var _0x355e=['name','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumHoldTime','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','agents','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','total','queuecallercomplete','answered','queuecallercompleteAt','outbound','disposition','ANSWERED','duration','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','telephones','trunks','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','SIP/%s','hasOwnProperty','isNil','interface'];(function(_0xe37f31,_0x5cbeae){var _0x4890ec=function(_0xd94b81){while(--_0xd94b81){_0xe37f31['push'](_0xe37f31['shift']());}};_0x4890ec(++_0x5cbeae);}(_0x355e,0xa7));var _0xe355=function(_0x59f3c8,_0x269e43){_0x59f3c8=_0x59f3c8-0x0;var _0x320c2f=_0x355e[_0x59f3c8];return _0x320c2f;};'use strict';var BPromise=require(_0xe355('0x0'));var util=require(_0xe355('0x1'));var _=require('lodash');var moment=require(_0xe355('0x2'));var Agent=require(_0xe355('0x3'));var Telephone=require(_0xe355('0x4'));var Trunk=require(_0xe355('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0xe355('0x6'));var Campaign=require(_0xe355('0x7'));var VoiceExtension=require(_0xe355('0x8'));var ZendeskAccount=require(_0xe355('0x9'));var SalesforceAccount=require(_0xe355('0xa'));var FreshdeskAccount=require(_0xe355('0xb'));var SugarcrmAccount=require(_0xe355('0xc'));var ZohoAccount=require(_0xe355('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe355('0xe'));var ServicenowAccount=require(_0xe355('0xf'));var Dynamics365Account=require(_0xe355('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0xe355('0x11')]={};this[_0xe355('0x12')]={};this['voiceQueues']={};this[_0xe355('0x13')]={};this[_0xe355('0x14')]={};this[_0xe355('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe355('0x16')]={};this[_0xe355('0x17')]={};this[_0xe355('0x18')]={};this[_0xe355('0x19')]={};this[_0xe355('0x1a')]={};this[_0xe355('0x1b')]={};this[_0xe355('0x1c')]={};this[_0xe355('0x1d')]={};this[_0xe355('0x1e')]={};this['zohoAccounts']={};this[_0xe355('0x1f')]={};this[_0xe355('0x20')]={};this['servicenowAccounts']={};this[_0xe355('0x21')]={};this[_0xe355('0x22')]={};};function freeIsNotKey(_0x338099,_0x26abf6,_0x1a604){var _0x445d4d=_[_0xe355('0x23')](_0x338099,function(_0x548c1c,_0x2e2230){return _0x548c1c[_0x1a604];});for(var _0x1b602e in _0x26abf6){if(_0x26abf6['hasOwnProperty'](_0x1b602e)){if(!_0x445d4d[_0x1b602e]){delete _0x26abf6[_0x1b602e];}}}}function freeIsNotKeySip(_0x1266d5,_0x1d71b0){var _0x3d5fc5=_['mapKeys'](_0x1266d5,function(_0x2465ad,_0x7248dd){return util[_0xe355('0x24')](_0xe355('0x25'),_0x2465ad['name']);});for(var _0x38aaed in _0x1d71b0){if(_0x1d71b0[_0xe355('0x26')](_0x38aaed)){if(!_0x3d5fc5[_0x38aaed]){delete _0x1d71b0[_0x38aaed];}}}}function freeIsNotKeyAgent(_0x2f4c55,_0x4d100a){var _0x7c0106=_[_0xe355('0x23')](_0x2f4c55,function(_0x39a7c0,_0x43bcad){var _0x20f237=_[_0xe355('0x27')](_0x39a7c0[_0xe355('0x28')])?util[_0xe355('0x24')]('SIP/%s',_0x39a7c0[_0xe355('0x29')]):_0x39a7c0[_0xe355('0x28')];return _0x20f237;});for(var _0x5aae40 in _0x4d100a){if(_0x4d100a[_0xe355('0x26')](_0x5aae40)){if(!_0x7c0106[_0x5aae40]){delete _0x4d100a[_0x5aae40];}}}}function clearVoiceCallReports(_0x283a4f){_0x283a4f['total']=0x0;_0x283a4f['answered']=0x0;_0x283a4f['sumHoldTime']=0x0;_0x283a4f['sumDuration']=0x0;_0x283a4f[_0xe355('0x2a')]=0x0;}function clearCampaigns(_0x20858d){if(!_[_0xe355('0x2b')](_0x20858d)){for(var _0x5bad20 in _0x20858d){if(_0x20858d[_0xe355('0x26')](_0x5bad20)){_0x20858d[_0x5bad20][_0xe355('0x2c')]=0x0;_0x20858d[_0x5bad20][_0xe355('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x45d644){if(!_[_0xe355('0x2b')](_0x45d644)){for(var _0x482966 in _0x45d644){if(_0x45d644['hasOwnProperty'](_0x482966)){_0x45d644[_0x482966]['total']=0x0;_0x45d644[_0x482966]['answered']=0x0;_0x45d644[_0x482966][_0xe355('0x2e')]=0x0;_0x45d644[_0x482966]['abandoned']=0x0;_0x45d644[_0x482966][_0xe355('0x2f')]=0x0;_0x45d644[_0x482966][_0xe355('0x30')]=0x0;_0x45d644[_0x482966][_0xe355('0x2a')]=0x0;_0x45d644[_0x482966][_0xe355('0x31')]=0x0;_0x45d644[_0x482966][_0xe355('0x32')]=0x0;_0x45d644[_0x482966][_0xe355('0x33')]=0x0;_0x45d644[_0x482966][_0xe355('0x34')]=0x0;_0x45d644[_0x482966]['outboundNoSuchCallsDay']=0x0;_0x45d644[_0x482966]['outboundUnknownCallsDay']=0x0;_0x45d644[_0x482966][_0xe355('0x35')]=0x0;_0x45d644[_0x482966][_0xe355('0x36')]=0x0;_0x45d644[_0x482966]['outboundBlacklistCallsDay']=0x0;_0x45d644[_0x482966]['outboundOriginateFailureCallsDay']=0x0;_0x45d644[_0x482966]['outboundRejectCallsDay']=0x0;_0x45d644[_0x482966]['outboundReCallsDay']=0x0;_0x45d644[_0x482966]['outboundAnswerAgiCallsDay']=0x0;_0x45d644[_0x482966][_0xe355('0x37')]=0x0;_0x45d644[_0x482966][_0xe355('0x38')]=!![];}}}}Realtime['prototype'][_0xe355('0x39')]=function(_0x3d4712,_0x299541){for(var _0x2f2d15 in _0x299541){if(_0x3d4712[_0xe355('0x26')](_0x2f2d15)){_0x3d4712[_0x2f2d15]=_0x299541[_0x2f2d15];}}};Realtime[_0xe355('0x3a')][_0xe355('0x3b')]=function(){var _0x5ec887=this;return function(_0xc2301){if(_0xc2301){freeIsNotKeyAgent(_0xc2301,_0x5ec887['agents']);for(var _0x1379f0=0x0,_0x32769d={},_0x2b11f5={};_0x1379f0<_0xc2301[_0xe355('0x3c')];_0x1379f0+=0x1){_0x32769d=_0xc2301[_0x1379f0];var _0x229072=_[_0xe355('0x27')](_0x32769d[_0xe355('0x28')])?util['format']('SIP/%s',_0x32769d[_0xe355('0x29')]):_0x32769d[_0xe355('0x28')];if(_[_0xe355('0x3d')](_0x5ec887[_0xe355('0x3e')][_0x229072])){_0x5ec887[_0xe355('0x3e')][_0x229072]=new Agent(_0x32769d);}else{_0x5ec887[_0xe355('0x39')](_0x5ec887[_0xe355('0x3e')][_0x229072],_0x32769d);}}}return _0x5ec887[_0xe355('0x3e')];};};Realtime[_0xe355('0x3a')]['initTelephones']=function(){var _0x3743ca=this;return function(_0x55827e){if(_0x55827e){freeIsNotKeySip(_0x55827e,_0x3743ca[_0xe355('0x11')]);for(var _0x1f71d4=0x0,_0x46317c={},_0x3b7b47={};_0x1f71d4<_0x55827e[_0xe355('0x3c')];_0x1f71d4+=0x1){_0x46317c=_0x55827e[_0x1f71d4];if(_[_0xe355('0x3d')](_0x3743ca[_0xe355('0x11')][util['format'](_0xe355('0x25'),_0x46317c['name'])])){_0x3743ca['telephones'][util[_0xe355('0x24')](_0xe355('0x25'),_0x46317c[_0xe355('0x29')])]=new Telephone(_0x46317c);}else{_0x3743ca['mergeFromDatabase'](_0x3743ca[_0xe355('0x11')][util['format'](_0xe355('0x25'),_0x46317c[_0xe355('0x29')])],_0x46317c);}}}return _0x3743ca[_0xe355('0x11')];};};Realtime['prototype'][_0xe355('0x3f')]=function(){var _0x1dc102=this;return function(_0x2a701b){if(_0x2a701b){freeIsNotKeySip(_0x2a701b,_0x1dc102[_0xe355('0x12')]);for(var _0x3e63bd=0x0,_0x3ae0db={},_0x5d85f5={};_0x3e63bd<_0x2a701b[_0xe355('0x3c')];_0x3e63bd+=0x1){_0x3ae0db=_0x2a701b[_0x3e63bd];if(_['isUndefined'](_0x1dc102[_0xe355('0x12')][util['format'](_0xe355('0x25'),_0x3ae0db[_0xe355('0x29')])])){_0x1dc102['trunks'][util[_0xe355('0x24')]('SIP/%s',_0x3ae0db[_0xe355('0x29')])]=new Trunk(_0x3ae0db);}else{_0x1dc102[_0xe355('0x39')](_0x1dc102[_0xe355('0x12')][util[_0xe355('0x24')]('SIP/%s',_0x3ae0db[_0xe355('0x29')])],_0x3ae0db);}}}return _0x1dc102[_0xe355('0x12')];};};Realtime[_0xe355('0x3a')][_0xe355('0x40')]=function(){var _0x3db4e7=this;return function(_0x13bd37){if(_0x13bd37){freeIsNotKey(_0x13bd37,_0x3db4e7[_0xe355('0x41')],_0xe355('0x29'));for(var _0xf52d4c=0x0,_0x1186f4={},_0x4edbdb={};_0xf52d4c<_0x13bd37[_0xe355('0x3c')];_0xf52d4c+=0x1){_0x1186f4=_0x13bd37[_0xf52d4c];if(_[_0xe355('0x3d')](_0x3db4e7[_0xe355('0x41')][_0x1186f4['name']])){_0x3db4e7[_0xe355('0x41')][_0x1186f4[_0xe355('0x29')]]=new VoiceQueue(_0x1186f4);}else{_0x3db4e7[_0xe355('0x39')](_0x3db4e7[_0xe355('0x41')][_0x1186f4[_0xe355('0x29')]],_0x1186f4);}}}return _0x3db4e7[_0xe355('0x41')];};};Realtime[_0xe355('0x3a')][_0xe355('0x42')]=function(){var _0x576d72=this;return function(_0x41644c){if(_0x41644c){freeIsNotKey(_0x41644c,_0x576d72[_0xe355('0x13')],'id');for(var _0x539109=0x0,_0x5591cd={},_0x5a3d57={};_0x539109<_0x41644c[_0xe355('0x3c')];_0x539109+=0x1){_0x5591cd=_0x41644c[_0x539109];if(_[_0xe355('0x3d')](_0x576d72[_0xe355('0x13')][_0x5591cd['id']])){_0x576d72[_0xe355('0x13')][_0x5591cd['id']]=new Trigger(_0x5591cd);}else{_0x576d72[_0xe355('0x39')](_0x576d72[_0xe355('0x13')][_0x5591cd['id']],_0x5591cd);}}}return _0x576d72[_0xe355('0x13')];};};Realtime[_0xe355('0x3a')][_0xe355('0x43')]=function(){var _0x3c3545=this;return function(_0x33830b){if(_0x33830b){freeIsNotKey(_0x33830b,_0x3c3545[_0xe355('0x15')],'id');for(var _0x4c6bf2=0x0,_0x74f8b9={},_0x477cca={};_0x4c6bf2<_0x33830b['length'];_0x4c6bf2+=0x1){_0x74f8b9=_0x33830b[_0x4c6bf2];if(_['isUndefined'](_0x3c3545['templates'][_0x74f8b9['id']])){_0x3c3545['templates'][_0x74f8b9['id']]=new Template(_0x74f8b9);}else{_0x3c3545[_0xe355('0x39')](_0x3c3545[_0xe355('0x15')][_0x74f8b9['id']],_0x74f8b9);}}}return _0x3c3545[_0xe355('0x15')];};};Realtime['prototype'][_0xe355('0x44')]=function(){var _0x124bc9=this;return function(_0x3bbc8f){if(_0x3bbc8f){freeIsNotKey(_0x3bbc8f,_0x124bc9[_0xe355('0x1b')],'id');for(var _0x514e9e=0x0,_0x59a644={},_0x224ca9={};_0x514e9e<_0x3bbc8f[_0xe355('0x3c')];_0x514e9e+=0x1){_0x59a644=_0x3bbc8f[_0x514e9e];if(_[_0xe355('0x3d')](_0x124bc9[_0xe355('0x1b')][_0x59a644['id']])){_0x124bc9['zendeskAccounts'][_0x59a644['id']]=new ZendeskAccount(_0x59a644);}else{_0x124bc9[_0xe355('0x39')](_0x124bc9[_0xe355('0x1b')][_0x59a644['id']],_0x59a644);}}}return _0x124bc9[_0xe355('0x1b')];};};Realtime['prototype'][_0xe355('0x45')]=function(){var _0xab15df=this;return function(_0x8606a4){if(_0x8606a4){freeIsNotKey(_0x8606a4,_0xab15df[_0xe355('0x1c')],'id');for(var _0x7a21be=0x0,_0x241dcb={},_0x22d8a1={};_0x7a21be<_0x8606a4[_0xe355('0x3c')];_0x7a21be+=0x1){_0x241dcb=_0x8606a4[_0x7a21be];if(_[_0xe355('0x3d')](_0xab15df[_0xe355('0x1c')][_0x241dcb['id']])){_0xab15df[_0xe355('0x1c')][_0x241dcb['id']]=new SalesforceAccount(_0x241dcb);}else{_0xab15df[_0xe355('0x39')](_0xab15df[_0xe355('0x1c')][_0x241dcb['id']],_0x241dcb);}}}return _0xab15df['salesforceAccounts'];};};Realtime[_0xe355('0x3a')][_0xe355('0x46')]=function(){var _0x2da66d=this;return function(_0x3e8438){if(_0x3e8438){freeIsNotKey(_0x3e8438,_0x2da66d[_0xe355('0x1e')],'id');for(var _0x2e39b0=0x0,_0x266970={},_0x31fe2d={};_0x2e39b0<_0x3e8438[_0xe355('0x3c')];_0x2e39b0+=0x1){_0x266970=_0x3e8438[_0x2e39b0];if(_[_0xe355('0x3d')](_0x2da66d[_0xe355('0x1e')][_0x266970['id']])){_0x2da66d[_0xe355('0x1e')][_0x266970['id']]=new FreshdeskAccount(_0x266970);}else{_0x2da66d[_0xe355('0x39')](_0x2da66d[_0xe355('0x1e')][_0x266970['id']],_0x266970);}}}return _0x2da66d[_0xe355('0x1e')];};};Realtime[_0xe355('0x3a')][_0xe355('0x47')]=function(){var _0x5dcc8d=this;return function(_0x300767){if(_0x300767){freeIsNotKey(_0x300767,_0x5dcc8d[_0xe355('0x48')],'id');for(var _0x2241ea=0x0,_0x1c1092={},_0x533873={};_0x2241ea<_0x300767['length'];_0x2241ea+=0x1){_0x1c1092=_0x300767[_0x2241ea];if(_[_0xe355('0x3d')](_0x5dcc8d[_0xe355('0x48')][_0x1c1092['id']])){_0x5dcc8d[_0xe355('0x48')][_0x1c1092['id']]=new ZohoAccount(_0x1c1092);}else{_0x5dcc8d[_0xe355('0x39')](_0x5dcc8d[_0xe355('0x48')][_0x1c1092['id']],_0x1c1092);}}}return _0x5dcc8d[_0xe355('0x48')];};};Realtime[_0xe355('0x3a')][_0xe355('0x49')]=function(){var _0x235865=this;return function(_0x2c5ec3){if(_0x2c5ec3){freeIsNotKey(_0x2c5ec3,_0x235865[_0xe355('0x1f')],'id');for(var _0x954a5b=0x0,_0x1870f4={},_0x5ba438={};_0x954a5b<_0x2c5ec3[_0xe355('0x3c')];_0x954a5b+=0x1){_0x1870f4=_0x2c5ec3[_0x954a5b];if(_[_0xe355('0x3d')](_0x235865[_0xe355('0x1f')][_0x1870f4['id']])){_0x235865['deskAccounts'][_0x1870f4['id']]=new DeskAccount(_0x1870f4);}else{_0x235865['mergeFromDatabase'](_0x235865[_0xe355('0x1f')][_0x1870f4['id']],_0x1870f4);}}}return _0x235865[_0xe355('0x1f')];};};Realtime[_0xe355('0x3a')][_0xe355('0x4a')]=function(){var _0x26c288=this;return function(_0x2f3652){if(_0x2f3652){freeIsNotKey(_0x2f3652,_0x26c288[_0xe355('0x1d')],'id');for(var _0x43986e=0x0,_0x4fa75b={},_0x5e2dc5={};_0x43986e<_0x2f3652[_0xe355('0x3c')];_0x43986e+=0x1){_0x4fa75b=_0x2f3652[_0x43986e];if(_['isUndefined'](_0x26c288[_0xe355('0x1d')][_0x4fa75b['id']])){_0x26c288[_0xe355('0x1d')][_0x4fa75b['id']]=new SugarcrmAccount(_0x4fa75b);}else{_0x26c288[_0xe355('0x39')](_0x26c288[_0xe355('0x1d')][_0x4fa75b['id']],_0x4fa75b);}}}return _0x26c288[_0xe355('0x1d')];};};Realtime['prototype'][_0xe355('0x4b')]=function(){var _0x29dec5=this;return function(_0xf36af){if(_0xf36af){freeIsNotKey(_0xf36af,_0x29dec5[_0xe355('0x20')],'id');for(var _0xf1ded8=0x0,_0x5de9de={},_0x1585a0={};_0xf1ded8<_0xf36af[_0xe355('0x3c')];_0xf1ded8+=0x1){_0x5de9de=_0xf36af[_0xf1ded8];if(_['isUndefined'](_0x29dec5[_0xe355('0x20')][_0x5de9de['id']])){_0x29dec5[_0xe355('0x20')][_0x5de9de['id']]=new VtigerAccount(_0x5de9de);}else{_0x29dec5[_0xe355('0x39')](_0x29dec5['vtigerAccounts'][_0x5de9de['id']],_0x5de9de);}}}return _0x29dec5[_0xe355('0x20')];};};Realtime[_0xe355('0x3a')][_0xe355('0x4c')]=function(){var _0x5751e0=this;return function(_0x580398){if(_0x580398){freeIsNotKey(_0x580398,_0x5751e0[_0xe355('0x4d')],'id');for(var _0x5f4768=0x0,_0x41f05f={},_0x2208b7={};_0x5f4768<_0x580398[_0xe355('0x3c')];_0x5f4768+=0x1){_0x41f05f=_0x580398[_0x5f4768];if(_[_0xe355('0x3d')](_0x5751e0[_0xe355('0x4d')][_0x41f05f['id']])){_0x5751e0[_0xe355('0x4d')][_0x41f05f['id']]=new ServicenowAccount(_0x41f05f);}else{_0x5751e0[_0xe355('0x39')](_0x5751e0['servicenowAccounts'][_0x41f05f['id']],_0x41f05f);}}}return _0x5751e0[_0xe355('0x4d')];};};Realtime[_0xe355('0x3a')]['initDynamics365Accounts']=function(){var _0x1e5884=this;return function(_0x3aa857){if(_0x3aa857){freeIsNotKey(_0x3aa857,_0x1e5884[_0xe355('0x21')],'id');for(var _0x265a91=0x0,_0x1bf8c9={},_0xbf6eeb={};_0x265a91<_0x3aa857[_0xe355('0x3c')];_0x265a91+=0x1){_0x1bf8c9=_0x3aa857[_0x265a91];if(_['isUndefined'](_0x1e5884[_0xe355('0x21')][_0x1bf8c9['id']])){_0x1e5884[_0xe355('0x21')][_0x1bf8c9['id']]=new Dynamics365Account(_0x1bf8c9);}else{_0x1e5884[_0xe355('0x39')](_0x1e5884[_0xe355('0x21')][_0x1bf8c9['id']],_0x1bf8c9);}}}return _0x1e5884[_0xe355('0x21')];};};Realtime['prototype'][_0xe355('0x4e')]=function(){var _0x12c738=this;return function(_0x3170be){for(var _0x3825f6=0x0;_0x3825f6<_0x3170be[_0xe355('0x3c')];_0x3825f6+=0x1){_[_0xe355('0x4f')](_0x12c738[_0xe355('0x41')][_0x3170be[_0x3825f6][_0xe355('0x29')]],_0x3170be[_0x3825f6]);}return _0x12c738[_0xe355('0x41')];};};Realtime[_0xe355('0x3a')][_0xe355('0x50')]=function(){var _0x4eefc9=this;return function(_0x5861f5){clearVoiceQueues(_0x4eefc9[_0xe355('0x41')]);if(_0x5861f5){_0x5861f5=_[_0xe355('0x51')](_0x5861f5,_0xe355('0x52'));for(var _0x1818aa in _0x5861f5){if(_0x5861f5['hasOwnProperty'](_0x1818aa)){var _0x1a4278={};for(var _0x411695=0x0;_0x411695<_0x5861f5[_0x1818aa][_0xe355('0x3c')];_0x411695+=0x1){var _0x402550=_0x5861f5[_0x1818aa][_0x411695]['queue'];if(_0x4eefc9[_0xe355('0x41')][_0x402550]){if(_0x5861f5[_0x1818aa][_0x411695][_0xe355('0x53')]){_0x4eefc9[_0xe355('0x41')][_0x402550]['unmanaged']+=0x1;}if(_0x5861f5[_0x1818aa][_0x411695][_0xe355('0x54')]){_0x4eefc9['voiceQueues'][_0x402550][_0xe355('0x55')]+=0x1;}_0x4eefc9[_0xe355('0x41')][_0x402550]['sumHoldTime']+=moment(_0x5861f5[_0x1818aa][_0x411695][_0xe355('0x56')])[_0xe355('0x57')](moment(_0x5861f5[_0x1818aa][_0x411695][_0xe355('0x58')]),_0xe355('0x59'))||0x0;if(_0x411695===_0x5861f5[_0x1818aa][_0xe355('0x3c')]-0x1){_0x4eefc9['voiceQueues'][_0x402550][_0xe355('0x30')]+=moment(_0x5861f5[_0x1818aa][_0x411695]['queuecallercompleteAt']||_0x5861f5[_0x1818aa][_0x411695][_0xe355('0x5a')]||_0x5861f5[_0x1818aa][_0x411695]['queuecallerexitAt'])['diff'](moment(_0x5861f5[_0x1818aa][_0x411695]['queuecallerjoinAt']),_0xe355('0x59'))||0x0;_0x4eefc9[_0xe355('0x41')][_0x402550][_0xe355('0x5b')]+=0x1;if(_0x5861f5[_0x1818aa][_0x411695][_0xe355('0x5c')]){_0x4eefc9[_0xe355('0x41')][_0x402550][_0xe355('0x5d')]+=0x1;_0x4eefc9[_0xe355('0x41')][_0x402550][_0xe355('0x2a')]+=moment(_0x5861f5[_0x1818aa][_0x411695][_0xe355('0x5e')])[_0xe355('0x57')](moment(_0x5861f5[_0x1818aa][_0x411695][_0xe355('0x56')]),_0xe355('0x59'))||0x0;}}else{_0x4eefc9[_0xe355('0x41')][_0x402550]['sumDuration']+=_0x4eefc9['voiceQueues'][_0x402550][_0xe355('0x2f')]||0x0;}}}}}}return _0x4eefc9[_0xe355('0x41')];};};Realtime[_0xe355('0x3a')]['initVoiceCallReports']=function(){var _0x43e86f=this;return function(_0x5cd182){clearVoiceCallReports(_0x43e86f[_0xe355('0x5f')]);if(_0x5cd182){for(var _0x1e583c=0x0;_0x1e583c<_0x5cd182[_0xe355('0x3c')];_0x1e583c+=0x1){_0x43e86f[_0xe355('0x5f')][_0xe355('0x5b')]+=0x1;_0x43e86f['outbound']['sumDuration']+=_0x5cd182[_0x1e583c]['duration'];if(_0x5cd182[_0x1e583c][_0xe355('0x60')]===_0xe355('0x61')){_0x43e86f[_0xe355('0x5f')]['answered']+=0x1;_0x43e86f[_0xe355('0x5f')][_0xe355('0x2f')]+=_0x5cd182[_0x1e583c][_0xe355('0x62')]-_0x5cd182[_0x1e583c][_0xe355('0x63')]||0x0;_0x43e86f[_0xe355('0x5f')]['sumBillable']+=_0x5cd182[_0x1e583c]['billableseconds'];}}}return _0x43e86f[_0xe355('0x5f')];};};Realtime[_0xe355('0x3a')][_0xe355('0x64')]=function(){var _0x55f633=this;return function(_0x1766c7){if(_0x1766c7){freeIsNotKey(_0x1766c7,_0x55f633[_0xe355('0x14')],'name');for(var _0x40acc7=0x0,_0x338594={};_0x40acc7<_0x1766c7[_0xe355('0x3c')];_0x40acc7+=0x1){_0x338594=_0x1766c7[_0x40acc7];if(_[_0xe355('0x3d')](_0x55f633[_0xe355('0x14')][_0x338594[_0xe355('0x29')]])){_0x55f633[_0xe355('0x14')][_0x338594['name']]=new Campaign(_0x338594);}else{_0x55f633[_0xe355('0x39')](_0x55f633[_0xe355('0x14')][_0x338594[_0xe355('0x29')]],_0x338594);}}}return _0x55f633[_0xe355('0x14')];};};Realtime[_0xe355('0x3a')][_0xe355('0x65')]=function(){var _0x2dee7b=this;return function(_0x33f2ae){if(_0x33f2ae){freeIsNotKey(_0x33f2ae,_0x2dee7b[_0xe355('0x16')],'id');for(var _0x3ad617=0x0,_0x593002={};_0x3ad617<_0x33f2ae[_0xe355('0x3c')];_0x3ad617+=0x1){_0x593002=_0x33f2ae[_0x3ad617];if(_[_0xe355('0x3d')](_0x2dee7b[_0xe355('0x16')][_0x593002['id']])){_0x2dee7b['voiceExtensions'][_0x593002['id']]=new VoiceExtension(_0x593002);}else{_0x2dee7b[_0xe355('0x39')](_0x2dee7b['voiceExtensions'][_0x593002['id']],_0x593002);}}}return _0x2dee7b[_0xe355('0x16')];};};Realtime[_0xe355('0x3a')][_0xe355('0x66')]=function(){var _0x433a73=this;return function(_0x5b0671){clearCampaigns(_0x433a73[_0xe355('0x14')]);for(var _0x5ab0be=0x0;_0x5ab0be<_0x5b0671['length'];_0x5ab0be+=0x1){_['merge'](_0x433a73['campaigns'][_0x5b0671[_0x5ab0be][_0xe355('0x29')]],_0x5b0671[_0x5ab0be]);}return _0x433a73[_0xe355('0x14')];};};Realtime[_0xe355('0x3a')]['initFaxAccounts']=function(){var _0x39d121=this;return function(_0x43a190){if(_0x43a190){freeIsNotKey(_0x43a190,_0x39d121[_0xe355('0x22')],'id');for(var _0x47c672=0x0,_0x56618d={},_0x3c494f={};_0x47c672<_0x43a190['length'];_0x47c672+=0x1){_0x56618d=_0x43a190[_0x47c672];if(_[_0xe355('0x3d')](_0x39d121[_0xe355('0x22')][_0x56618d['id']])){_0x39d121[_0xe355('0x22')][_0x56618d['id']]=new FaxAccount(_0x56618d);}else{_0x39d121['mergeFromDatabase'](_0x39d121[_0xe355('0x22')][_0x56618d['id']],_0x56618d);}}}return _0x39d121[_0xe355('0x22')];};};module[_0xe355('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 25c6d98..e13b252 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 _0x7ed0=['xcally-motion-dialer','create','voiceAgentReport','voiceDialReport','startsWith','Local','substring','indexOf','mobile','blindTransfer','attendedTransfer','exports','bluebird','moment','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','findAgent','find','accountcode','name','isNil','interface','length','connectedlinenum','lastAssignedTo','SIP/%s','queuecallercomplete','format','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','voiceQueueReport','match','voiceCallReport','destination','exten','lastdata','queue','context','from-voip-provider','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','calleridname','monitorFilename','monitors','createdAt','connectedlinename','membername'];(function(_0x43168a,_0x390d1e){var _0x56775f=function(_0x4a4f38){while(--_0x4a4f38){_0x43168a['push'](_0x43168a['shift']());}};_0x56775f(++_0x390d1e);}(_0x7ed0,0x92));var _0x07ed=function(_0x352f6c,_0x31add4){_0x352f6c=_0x352f6c-0x0;var _0x3ec747=_0x7ed0[_0x352f6c];return _0x3ec747;};'use strict';var BPromise=require(_0x07ed('0x0'));var _=require('lodash');var moment=require(_0x07ed('0x1'));var util=require('util');var logger=require(_0x07ed('0x2'))('ami');var ami=require(_0x07ed('0x3'));var RpcVoiceAgentReport=require(_0x07ed('0x4'));var RpcVoiceCallReport=require(_0x07ed('0x5'));var RpcVoiceDialReport=require(_0x07ed('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x07ed('0x7'));var VoiceQueueReport=require(_0x07ed('0x8'));var VoiceCallReport=require(_0x07ed('0x9'));var VoiceAgentReport=require(_0x07ed('0xa'));var VoiceDialReport=require(_0x07ed('0xb'));var UserReport=require('./userReport');function Report(_0x185ded){this[_0x07ed('0xc')]=_0x185ded;this[_0x07ed('0xd')]=_0x185ded['agents'];this[_0x07ed('0xe')]=_0x185ded['telephones'];}Report[_0x07ed('0xf')][_0x07ed('0x10')]=function(_0x50cb11){var _0x1f9e2f=new VoiceQueueReport(this[_0x07ed('0xc')]);var _0x1bf45d=new VoiceAgentReport(this[_0x07ed('0xc')]);var _0x1072b6=new VoiceDialReport(this[_0x07ed('0xc')]);var _0x2ab491=new VoiceCallReport(this['realtime']);var _0x2092d8=new UserReport(this[_0x07ed('0xc')]);};Report['prototype'][_0x07ed('0x11')]=function(_0x1f259e){var _0x2f7556=undefined;_0x2f7556=_[_0x07ed('0x12')](this[_0x07ed('0xd')],function(_0x39720e){return _0x39720e[_0x07ed('0x13')]==_0x1f259e||_0x39720e[_0x07ed('0x14')]==_0x1f259e;});if(_[_0x07ed('0x15')](_0x2f7556)){var _0x1a548c=_['find'](this['telephones'],function(_0x5a4d6a){return _0x5a4d6a[_0x07ed('0x13')]==_0x1f259e||_0x5a4d6a[_0x07ed('0x14')]==_0x1f259e;});if(_0x1a548c){_0x2f7556=_[_0x07ed('0x12')](this['agents'],function(_0x2f5f9a){return _0x2f5f9a[_0x07ed('0x16')]==util['format']('SIP/%s',_0x1a548c[_0x07ed('0x14')]);});}}return _0x2f7556;};Report[_0x07ed('0xf')]['voiceQueueReport']=function(_0x3a3723){for(var _0x2005aa=0x0;_0x2005aa<_0x3a3723[_0x07ed('0x17')];_0x2005aa+=0x1){var _0x425daa=this[_0x07ed('0x11')](_0x3a3723[_0x2005aa][_0x07ed('0x18')]);if(_0x425daa){_0x3a3723[_0x2005aa][_0x07ed('0x13')]=_0x425daa['accountcode'];_0x3a3723[_0x2005aa]['assigned']=!![];_0x3a3723[_0x2005aa][_0x07ed('0x19')]=_0x425daa[_0x07ed('0x14')];_0x3a3723[_0x2005aa][_0x07ed('0x16')]=_[_0x07ed('0x15')](_0x425daa[_0x07ed('0x16')])?util['format'](_0x07ed('0x1a'),_0x425daa['name']):_0x425daa[_0x07ed('0x16')];if(_0x3a3723[_0x2005aa][_0x07ed('0x1b')]){_0x3a3723[_0x2005aa]['queuecallercompleteAt']=moment()[_0x07ed('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3a3723[_0x2005aa]['queuecallerexit']){_0x3a3723[_0x2005aa][_0x07ed('0x1d')]=moment()['format'](_0x07ed('0x1e'));}RpcMemberReport[_0x07ed('0x1f')](_0x3a3723[_0x2005aa]);}RpcVoiceQueueReport['create'](_0x3a3723[_0x2005aa]);}};function extractCalleridNumber(_0x2a4540){var _0x1884c0=_0x2a4540[_0x07ed('0x20')](/<(.*?)>/);return _0x1884c0?_0x1884c0[0x1]:_0x2a4540;}Report[_0x07ed('0xf')][_0x07ed('0x21')]=function(_0x1b56c0){_0x1b56c0['destination']=_0x1b56c0[_0x07ed('0x22')]||_0x1b56c0[_0x07ed('0x23')];if(_0x1b56c0['type']=='dialer'){_0x1b56c0['lastapplication']='queue';_0x1b56c0[_0x07ed('0x24')]=_0x1b56c0[_0x07ed('0x25')];if(_0x1b56c0[_0x07ed('0x26')]==_0x07ed('0x27')){_0x1b56c0[_0x07ed('0x13')]='';_0x1b56c0[_0x07ed('0x22')]=extractCalleridNumber(_0x1b56c0['callerid']);}else if(_0x1b56c0[_0x07ed('0x26')]=='from-sip'){if(_0x1b56c0[_0x07ed('0x22')]==_0x07ed('0x28')){_0x1b56c0[_0x07ed('0x22')]=extractCalleridNumber(_0x1b56c0[_0x07ed('0x29')]);_0x1b56c0[_0x07ed('0x2a')]=_0x1b56c0[_0x07ed('0x2b')];_0x1b56c0[_0x07ed('0x2c')]=[_0x1b56c0[_0x07ed('0x2d')],_0x1b56c0[_0x07ed('0x2d')]=_0x1b56c0['destinationchannel']][0x0];_0x1b56c0[_0x07ed('0x2e')]=_0x1b56c0[_0x07ed('0x29')];}else{_0x1b56c0[_0x07ed('0x22')]=_0x1b56c0[_0x07ed('0x2a')];_0x1b56c0['calleridnum']=_0x1b56c0[_0x07ed('0x2b')];if(_0x1b56c0[_0x07ed('0x2f')]==_0x07ed('0x30')){_0x1b56c0[_0x07ed('0x13')]=_0x1b56c0[_0x07ed('0x18')];}else{_0x1b56c0['accountcode']='';}}}}else{_0x1b56c0['callerid']=util[_0x07ed('0x1c')]('\x22%s\x22\x20<%s>',_0x1b56c0[_0x07ed('0x31')],_0x1b56c0[_0x07ed('0x2a')]);}RpcVoiceCallReport['create'](_0x1b56c0);if(_0x1b56c0['monitor']){for(var _0x55e3ff=0x0;_0x55e3ff<_0x1b56c0['monitors'][_0x07ed('0x17')];_0x55e3ff+=0x1){_0x1b56c0[_0x07ed('0x32')]=_0x1b56c0[_0x07ed('0x33')][_0x55e3ff]['filename'];_0x1b56c0[_0x07ed('0x34')]=_0x1b56c0[_0x07ed('0x33')][_0x55e3ff][_0x07ed('0x34')];if(_0x1b56c0['exten']==_0x07ed('0x28')){_0x1b56c0[_0x07ed('0x2a')]=_0x1b56c0[_0x07ed('0x18')];_0x1b56c0[_0x07ed('0x31')]=_0x1b56c0[_0x07ed('0x35')];_0x1b56c0[_0x07ed('0x18')]=_0x1b56c0[_0x07ed('0x13')];_0x1b56c0[_0x07ed('0x35')]=_0x1b56c0[_0x07ed('0x36')];_0x1b56c0[_0x07ed('0x23')]=_0x1b56c0[_0x07ed('0x2b')];}else if(_0x1b56c0[_0x07ed('0x23')]==_0x07ed('0x37')){_0x1b56c0[_0x07ed('0x2a')]=_0x1b56c0['destination'];_0x1b56c0['exten']=_0x1b56c0['originatecalleridnum'];}RpcVoiceRecording[_0x07ed('0x38')](_0x1b56c0);}}};Report[_0x07ed('0xf')][_0x07ed('0x39')]=function(_0x16ccba){RpcVoiceAgentReport[_0x07ed('0x38')](_0x16ccba);};Report['prototype'][_0x07ed('0x3a')]=function(_0x555654){RpcVoiceDialReport[_0x07ed('0x38')](_0x555654);var _0x2e56a0=undefined;var _0x41fd63=_0x555654[_0x07ed('0x2d')];if(_[_0x07ed('0x3b')](_0x41fd63,_0x07ed('0x3c'))){var _0x51b7de=_0x41fd63[_0x07ed('0x3d')](_0x41fd63[_0x07ed('0x3e')]('/')+0x1,_0x41fd63['indexOf']('@'));_0x2e56a0=_[_0x07ed('0x12')](this[_0x07ed('0xd')],function(_0x1cb67d){return _0x1cb67d[_0x07ed('0x3f')]==_0x51b7de||_0x1cb67d['phone']==_0x51b7de||_0x1cb67d['accountcode']==_0x51b7de;});}else{var _0x51b7de=_0x41fd63[_0x07ed('0x3d')](_0x41fd63[_0x07ed('0x3e')]('/')+0x1,_0x41fd63['lastIndexOf']('-'));_0x2e56a0=this[_0x07ed('0x11')](_0x51b7de);}if(_0x2e56a0){_0x555654[_0x07ed('0x16')]=_[_0x07ed('0x15')](_0x2e56a0[_0x07ed('0x16')])?util['format']('SIP/%s',_0x2e56a0[_0x07ed('0x14')]):_0x2e56a0[_0x07ed('0x16')];_0x555654[_0x07ed('0x36')]=_0x2e56a0['name'];_0x555654[_0x07ed('0x13')]=_0x2e56a0[_0x07ed('0x13')];RpcMemberReport[_0x07ed('0x3a')](_0x555654);}};Report[_0x07ed('0xf')][_0x07ed('0x40')]=function(_0x5d2872){RpcVoiceTransferReport[_0x07ed('0x40')](_0x5d2872);};Report[_0x07ed('0xf')][_0x07ed('0x41')]=function(_0x517e93){RpcVoiceTransferReport['attendedTransfer'](_0x517e93);};module[_0x07ed('0x42')]=Report; \ No newline at end of file +var _0xd536=['./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','findAgent','find','accountcode','name','isNil','interface','format','length','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','create','match','voiceCallReport','destination','exten','dialer','lastdata','queue','callerid','context','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','voiceDialReport','startsWith','Local','substring','indexOf','mobile','lastIndexOf','attendedTransfer','exports','moment','util','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport'];(function(_0x1477b2,_0x212c6a){var _0x137981=function(_0x2381fc){while(--_0x2381fc){_0x1477b2['push'](_0x1477b2['shift']());}};_0x137981(++_0x212c6a);}(_0xd536,0x1b1));var _0x6d53=function(_0x3c9334,_0x42693c){_0x3c9334=_0x3c9334-0x0;var _0x378b15=_0xd536[_0x3c9334];return _0x378b15;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0x6d53('0x0'));var util=require(_0x6d53('0x1'));var logger=require(_0x6d53('0x2'))(_0x6d53('0x3'));var ami=require(_0x6d53('0x4'));var RpcVoiceAgentReport=require(_0x6d53('0x5'));var RpcVoiceCallReport=require(_0x6d53('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x6d53('0x7'));var RpcVoiceQueueReport=require(_0x6d53('0x8'));var RpcVoiceRecording=require(_0x6d53('0x9'));var RpcVoiceTransferReport=require(_0x6d53('0xa'));var VoiceQueueReport=require(_0x6d53('0xb'));var VoiceCallReport=require(_0x6d53('0xc'));var VoiceAgentReport=require(_0x6d53('0xd'));var VoiceDialReport=require(_0x6d53('0xe'));var UserReport=require(_0x6d53('0xf'));function Report(_0x3b0f97){this[_0x6d53('0x10')]=_0x3b0f97;this['agents']=_0x3b0f97[_0x6d53('0x11')];this['telephones']=_0x3b0f97[_0x6d53('0x12')];}Report[_0x6d53('0x13')][_0x6d53('0x14')]=function(_0x216549){var _0x4f6fd0=new VoiceQueueReport(this[_0x6d53('0x10')]);var _0x462681=new VoiceAgentReport(this['realtime']);var _0x100771=new VoiceDialReport(this[_0x6d53('0x10')]);var _0x5916ab=new VoiceCallReport(this[_0x6d53('0x10')]);var _0x336df0=new UserReport(this[_0x6d53('0x10')]);};Report[_0x6d53('0x13')][_0x6d53('0x15')]=function(_0x35b686){var _0x3efc7f=undefined;_0x3efc7f=_[_0x6d53('0x16')](this[_0x6d53('0x11')],function(_0x4992a5){return _0x4992a5[_0x6d53('0x17')]==_0x35b686||_0x4992a5[_0x6d53('0x18')]==_0x35b686;});if(_[_0x6d53('0x19')](_0x3efc7f)){var _0x49f851=_[_0x6d53('0x16')](this['telephones'],function(_0xcff01c){return _0xcff01c[_0x6d53('0x17')]==_0x35b686||_0xcff01c[_0x6d53('0x18')]==_0x35b686;});if(_0x49f851){_0x3efc7f=_['find'](this[_0x6d53('0x11')],function(_0x217724){return _0x217724[_0x6d53('0x1a')]==util[_0x6d53('0x1b')]('SIP/%s',_0x49f851['name']);});}}return _0x3efc7f;};Report[_0x6d53('0x13')]['voiceQueueReport']=function(_0xcf36c4){for(var _0x4582fd=0x0;_0x4582fd<_0xcf36c4[_0x6d53('0x1c')];_0x4582fd+=0x1){var _0xac51f9=this[_0x6d53('0x15')](_0xcf36c4[_0x4582fd]['connectedlinenum']);if(_0xac51f9){_0xcf36c4[_0x4582fd][_0x6d53('0x17')]=_0xac51f9[_0x6d53('0x17')];_0xcf36c4[_0x4582fd][_0x6d53('0x1d')]=!![];_0xcf36c4[_0x4582fd][_0x6d53('0x1e')]=_0xac51f9[_0x6d53('0x18')];_0xcf36c4[_0x4582fd]['interface']=_[_0x6d53('0x19')](_0xac51f9[_0x6d53('0x1a')])?util[_0x6d53('0x1b')](_0x6d53('0x1f'),_0xac51f9[_0x6d53('0x18')]):_0xac51f9[_0x6d53('0x1a')];if(_0xcf36c4[_0x4582fd][_0x6d53('0x20')]){_0xcf36c4[_0x4582fd]['queuecallercompleteAt']=moment()[_0x6d53('0x1b')](_0x6d53('0x21'));}if(_0xcf36c4[_0x4582fd][_0x6d53('0x22')]){_0xcf36c4[_0x4582fd][_0x6d53('0x23')]=moment()[_0x6d53('0x1b')](_0x6d53('0x21'));}RpcMemberReport[_0x6d53('0x24')](_0xcf36c4[_0x4582fd]);}RpcVoiceQueueReport[_0x6d53('0x25')](_0xcf36c4[_0x4582fd]);}};function extractCalleridNumber(_0x262447){var _0x512d7b=_0x262447[_0x6d53('0x26')](/<(.*?)>/);return _0x512d7b?_0x512d7b[0x1]:_0x262447;}Report[_0x6d53('0x13')][_0x6d53('0x27')]=function(_0x3c94b2){_0x3c94b2[_0x6d53('0x28')]=_0x3c94b2[_0x6d53('0x28')]||_0x3c94b2[_0x6d53('0x29')];if(_0x3c94b2['type']==_0x6d53('0x2a')){_0x3c94b2['lastapplication']='queue';_0x3c94b2[_0x6d53('0x2b')]=_0x3c94b2[_0x6d53('0x2c')];if(_0x3c94b2['context']=='from-voip-provider'){_0x3c94b2[_0x6d53('0x17')]='';_0x3c94b2['destination']=extractCalleridNumber(_0x3c94b2[_0x6d53('0x2d')]);}else if(_0x3c94b2[_0x6d53('0x2e')]==_0x6d53('0x2f')){if(_0x3c94b2['destination']==_0x6d53('0x30')){_0x3c94b2[_0x6d53('0x28')]=extractCalleridNumber(_0x3c94b2['calleridpreview']);_0x3c94b2[_0x6d53('0x31')]=_0x3c94b2[_0x6d53('0x32')];_0x3c94b2['destinationchannel']=[_0x3c94b2['channel'],_0x3c94b2[_0x6d53('0x33')]=_0x3c94b2[_0x6d53('0x34')]][0x0];_0x3c94b2[_0x6d53('0x2d')]=_0x3c94b2['calleridpreview'];}else{_0x3c94b2[_0x6d53('0x28')]=_0x3c94b2[_0x6d53('0x31')];_0x3c94b2[_0x6d53('0x31')]=_0x3c94b2[_0x6d53('0x32')];if(_0x3c94b2[_0x6d53('0x35')]==_0x6d53('0x36')){_0x3c94b2['accountcode']=_0x3c94b2[_0x6d53('0x37')];}else{_0x3c94b2[_0x6d53('0x17')]='';}}}}else{_0x3c94b2[_0x6d53('0x2d')]=util['format'](_0x6d53('0x38'),_0x3c94b2[_0x6d53('0x39')],_0x3c94b2['calleridnum']);}RpcVoiceCallReport[_0x6d53('0x25')](_0x3c94b2);if(_0x3c94b2['monitor']){for(var _0x3dcad0=0x0;_0x3dcad0<_0x3c94b2[_0x6d53('0x3a')][_0x6d53('0x1c')];_0x3dcad0+=0x1){_0x3c94b2[_0x6d53('0x3b')]=_0x3c94b2[_0x6d53('0x3a')][_0x3dcad0][_0x6d53('0x3c')];_0x3c94b2['createdAt']=_0x3c94b2[_0x6d53('0x3a')][_0x3dcad0][_0x6d53('0x3d')];if(_0x3c94b2[_0x6d53('0x29')]==_0x6d53('0x30')){_0x3c94b2[_0x6d53('0x31')]=_0x3c94b2[_0x6d53('0x37')];_0x3c94b2[_0x6d53('0x39')]=_0x3c94b2[_0x6d53('0x3e')];_0x3c94b2[_0x6d53('0x37')]=_0x3c94b2[_0x6d53('0x17')];_0x3c94b2['connectedlinename']=_0x3c94b2[_0x6d53('0x3f')];_0x3c94b2[_0x6d53('0x29')]=_0x3c94b2[_0x6d53('0x32')];}else if(_0x3c94b2[_0x6d53('0x29')]==_0x6d53('0x40')){_0x3c94b2[_0x6d53('0x31')]=_0x3c94b2[_0x6d53('0x28')];_0x3c94b2['exten']=_0x3c94b2['originatecalleridnum'];}RpcVoiceRecording['create'](_0x3c94b2);}}};Report[_0x6d53('0x13')]['voiceAgentReport']=function(_0x3d7f7a){RpcVoiceAgentReport['create'](_0x3d7f7a);};Report['prototype'][_0x6d53('0x41')]=function(_0x52bdbe){RpcVoiceDialReport[_0x6d53('0x25')](_0x52bdbe);var _0x1b8eff=undefined;var _0x5e70f2=_0x52bdbe[_0x6d53('0x33')];if(_[_0x6d53('0x42')](_0x5e70f2,_0x6d53('0x43'))){var _0x549c97=_0x5e70f2[_0x6d53('0x44')](_0x5e70f2[_0x6d53('0x45')]('/')+0x1,_0x5e70f2[_0x6d53('0x45')]('@'));_0x1b8eff=_['find'](this[_0x6d53('0x11')],function(_0x4b134d){return _0x4b134d[_0x6d53('0x46')]==_0x549c97||_0x4b134d['phone']==_0x549c97||_0x4b134d[_0x6d53('0x17')]==_0x549c97;});}else{var _0x549c97=_0x5e70f2[_0x6d53('0x44')](_0x5e70f2[_0x6d53('0x45')]('/')+0x1,_0x5e70f2[_0x6d53('0x47')]('-'));_0x1b8eff=this[_0x6d53('0x15')](_0x549c97);}if(_0x1b8eff){_0x52bdbe[_0x6d53('0x1a')]=_[_0x6d53('0x19')](_0x1b8eff[_0x6d53('0x1a')])?util[_0x6d53('0x1b')](_0x6d53('0x1f'),_0x1b8eff[_0x6d53('0x18')]):_0x1b8eff['interface'];_0x52bdbe['membername']=_0x1b8eff[_0x6d53('0x18')];_0x52bdbe[_0x6d53('0x17')]=_0x1b8eff['accountcode'];RpcMemberReport[_0x6d53('0x41')](_0x52bdbe);}};Report['prototype']['blindTransfer']=function(_0x18323d){RpcVoiceTransferReport['blindTransfer'](_0x18323d);};Report[_0x6d53('0x13')][_0x6d53('0x48')]=function(_0x5822d6){RpcVoiceTransferReport['attendedTransfer'](_0x5822d6);};module[_0x6d53('0x49')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index bd83e26..5ef3a85 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 _0x1a5b=['loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','prototype','catch','isNotNull','username','stateRegistry','merge','omit','event','actionid','emit','trunk:%s','name','trunk:save','device','state','inuse','local','toLowerCase','stateTime','format','telephones','toNumber','telephone:%s','telephone:save','startsWith','Queue','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','syncPeerStatus','peerstatus','registered','peer','status','address','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','trunks','agents','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState'];(function(_0x33e89d,_0x4d1e10){var _0x59ef32=function(_0x43f557){while(--_0x43f557){_0x33e89d['push'](_0x33e89d['shift']());}};_0x59ef32(++_0x4d1e10);}(_0x1a5b,0x1bd));var _0xb1a5=function(_0x430a3,_0x1b61ba){_0x430a3=_0x430a3-0x0;var _0xdcf2b6=_0x1a5b[_0x430a3];return _0xdcf2b6;};'use strict';var _=require(_0xb1a5('0x0'));var moment=require(_0xb1a5('0x1'));var BPromise=require(_0xb1a5('0x2'));var util=require(_0xb1a5('0x3'));var Redis=require(_0xb1a5('0x4'));var config=require(_0xb1a5('0x5'));var logger=require(_0xb1a5('0x6'))(_0xb1a5('0x7'));var ami=require(_0xb1a5('0x8'));config[_0xb1a5('0x9')]=_['defaults'](config[_0xb1a5('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb1a5('0x9')]));function UserReport(_0x267b8a){this[_0xb1a5('0xa')]=_0x267b8a[_0xb1a5('0xa')];this[_0xb1a5('0xb')]=_0x267b8a[_0xb1a5('0xb')];this['telephones']=_0x267b8a['telephones'];ami['on'](_0xb1a5('0xc'),this[_0xb1a5('0xd')][_0xb1a5('0xe')](this));ami['on']('registry',this[_0xb1a5('0xd')][_0xb1a5('0xe')](this));ami['on'](_0xb1a5('0xf'),this[_0xb1a5('0x10')]['bind'](this));ami['on']('peerstatus',this['syncPeerStatus']['bind'](this));this[_0xb1a5('0x11')]();return BPromise[_0xb1a5('0x12')]()[_0xb1a5('0x13')](ami[_0xb1a5('0x14')]())[_0xb1a5('0x13')](ami[_0xb1a5('0x15')]())['then'](ami[_0xb1a5('0x16')]())['catch'](loggerCatch(_0xb1a5('0x17')));}function loggerCatch(_0x1072b3){return function(_0x15555a){logger[_0xb1a5('0x18')](_0x1072b3,util[_0xb1a5('0x19')](_0x15555a,{'showHidden':![],'depth':null}));};}UserReport[_0xb1a5('0x1a')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0xb1a5('0x12')]()['then'](ami[_0xb1a5('0x14')]())['then'](ami[_0xb1a5('0x15')]())['then'](ami[_0xb1a5('0x16')]())[_0xb1a5('0x1b')](loggerCatch(_0xb1a5('0x17')));},0x32c8);};UserReport[_0xb1a5('0x1a')][_0xb1a5('0x1c')]=function(_0xfc0859){return _0xfc0859!==null&&!_['isUndefined'](_0xfc0859);};UserReport[_0xb1a5('0x1a')]['emit']=function(_0xae013,_0x58c6b7,_0x201299){io['to'](_0xae013)['emit'](_0x58c6b7,_0x201299);};UserReport['prototype'][_0xb1a5('0xd')]=function(_0xd63ad8){try{if(this[_0xb1a5('0x1c')](_0xd63ad8)){var _0x3fd4c6=_['find'](this[_0xb1a5('0xa')],{'registry':_0xd63ad8[_0xb1a5('0x1d')]});if(_0x3fd4c6){_0xd63ad8[_0xb1a5('0x1e')]=_0xd63ad8['state'];_[_0xb1a5('0x1f')](_0x3fd4c6,_[_0xb1a5('0x20')](_0xd63ad8,[_0xb1a5('0x21'),_0xb1a5('0x22'),'username','state']));this[_0xb1a5('0x23')](util['format'](_0xb1a5('0x24'),_0x3fd4c6[_0xb1a5('0x25')]),_0xb1a5('0x26'),_0x3fd4c6);}}}catch(_0x2bea9a){logger[_0xb1a5('0x18')]('[syncRegistry][UserReport]',util[_0xb1a5('0x19')](_0x2bea9a,{'showHidden':![],'depth':null}));}};UserReport[_0xb1a5('0x1a')][_0xb1a5('0x10')]=function(_0x6291f9){try{if(this[_0xb1a5('0x1c')](_0x6291f9)){if(this[_0xb1a5('0xb')][_0x6291f9[_0xb1a5('0x27')]]){if(!this[_0xb1a5('0xb')][_0x6291f9[_0xb1a5('0x27')]]['local']||_0x6291f9[_0xb1a5('0x28')]['toLowerCase']()==_0xb1a5('0x29')){this[_0xb1a5('0xb')][_0x6291f9[_0xb1a5('0x27')]][_0xb1a5('0x2a')]=![];if(this['agents'][_0x6291f9[_0xb1a5('0x27')]]['state']!==_0x6291f9[_0xb1a5('0x28')][_0xb1a5('0x2b')]()){this[_0xb1a5('0xb')][_0x6291f9['device']][_0xb1a5('0x2c')]=_['toNumber'](moment()[_0xb1a5('0x2d')]('x'));}this[_0xb1a5('0xb')][_0x6291f9[_0xb1a5('0x27')]][_0xb1a5('0x28')]=_0x6291f9[_0xb1a5('0x28')][_0xb1a5('0x2b')]();this['agents'][_0x6291f9[_0xb1a5('0x27')]]['updateStatusRealtime'](_0x6291f9);}}else if(this[_0xb1a5('0x2e')][_0x6291f9['device']]){if(this[_0xb1a5('0x2e')][_0x6291f9['device']][_0xb1a5('0x28')]!==_0x6291f9[_0xb1a5('0x28')][_0xb1a5('0x2b')]()){this['telephones'][_0x6291f9['device']]['stateTime']=_[_0xb1a5('0x2f')](moment()[_0xb1a5('0x2d')]('x'));}this[_0xb1a5('0x2e')][_0x6291f9[_0xb1a5('0x27')]]['state']=_0x6291f9['state'][_0xb1a5('0x2b')]();this[_0xb1a5('0x23')](util['format'](_0xb1a5('0x30'),this['telephones'][_0x6291f9[_0xb1a5('0x27')]]['name']),_0xb1a5('0x31'),this[_0xb1a5('0x2e')][_0x6291f9[_0xb1a5('0x27')]]);}else if(this['trunks'][_0x6291f9[_0xb1a5('0x27')]]){if(this[_0xb1a5('0xa')][_0x6291f9[_0xb1a5('0x27')]][_0xb1a5('0x28')]!==_0x6291f9[_0xb1a5('0x28')][_0xb1a5('0x2b')]()){this['trunks'][_0x6291f9['device']][_0xb1a5('0x2c')]=_['toNumber'](moment()[_0xb1a5('0x2d')]('x'));}this['trunks'][_0x6291f9['device']][_0xb1a5('0x28')]=_0x6291f9['state'][_0xb1a5('0x2b')]();this[_0xb1a5('0x23')](util[_0xb1a5('0x2d')](_0xb1a5('0x24'),this[_0xb1a5('0xa')][_0x6291f9['device']][_0xb1a5('0x25')]),_0xb1a5('0x26'),this['trunks'][_0x6291f9['device']]);}else if(_[_0xb1a5('0x32')](_0x6291f9[_0xb1a5('0x27')],_0xb1a5('0x33'))){}else if(_[_0xb1a5('0x32')](_0x6291f9[_0xb1a5('0x27')],_0xb1a5('0x34'))){var _0x12d7d5=_0x6291f9[_0xb1a5('0x27')];var _0x1c9ba0=_0x12d7d5[_0xb1a5('0x35')](_0x12d7d5[_0xb1a5('0x36')]('/')+0x1,_0x12d7d5[_0xb1a5('0x36')]('@'));var _0x1d41d8=_['find'](this[_0xb1a5('0xb')],function(_0x3aa533){return _0x3aa533[_0xb1a5('0x37')]==_0x1c9ba0||_0x3aa533[_0xb1a5('0x38')]==_0x1c9ba0||_0x3aa533[_0xb1a5('0x39')]==_0x1c9ba0;});if(_0x1d41d8){if(_0x1d41d8[_0xb1a5('0x28')]!==_0x6291f9[_0xb1a5('0x28')][_0xb1a5('0x2b')]()){_0x1d41d8['stateTime']=_['toNumber'](moment()[_0xb1a5('0x2d')]('x'));}_0x1d41d8['state']=_0x6291f9['state'][_0xb1a5('0x2b')]();_0x1d41d8[_0xb1a5('0x2a')]=!![];_0x1d41d8[_0xb1a5('0x3a')](_0x6291f9);}}else{}}}catch(_0x511fe1){logger[_0xb1a5('0x18')]('[syncDeviceState][UserReport]',util[_0xb1a5('0x19')](_0x511fe1,{'showHidden':![],'depth':null}));}};UserReport[_0xb1a5('0x1a')][_0xb1a5('0x3b')]=function(_0x231666){try{if(this[_0xb1a5('0x1c')](_0x231666)&&this[_0xb1a5('0x1c')](_0x231666[_0xb1a5('0x3c')])){if(this[_0xb1a5('0xb')][_0x231666['peer']]){if(!this[_0xb1a5('0xb')][_0x231666['peer']][_0xb1a5('0x2a')]||_0x231666['peerstatus'][_0xb1a5('0x2b')]()==_0xb1a5('0x3d')){this['agents'][_0x231666[_0xb1a5('0x3e')]][_0xb1a5('0x2a')]=![];this['agents'][_0x231666[_0xb1a5('0x3e')]][_0xb1a5('0x3f')]=_0x231666[_0xb1a5('0x3c')][_0xb1a5('0x2b')]();this[_0xb1a5('0xb')][_0x231666['peer']][_0xb1a5('0x40')]=_0x231666[_0xb1a5('0x40')];this['agents'][_0x231666['peer']][_0xb1a5('0x3a')](_0x231666);}}else if(this[_0xb1a5('0x2e')][_0x231666[_0xb1a5('0x3e')]]){this['telephones'][_0x231666[_0xb1a5('0x3e')]][_0xb1a5('0x3f')]=_0x231666[_0xb1a5('0x3c')]['toLowerCase']();this['telephones'][_0x231666[_0xb1a5('0x3e')]][_0xb1a5('0x40')]=_0x231666[_0xb1a5('0x40')];this['emit'](util[_0xb1a5('0x2d')](_0xb1a5('0x30'),this[_0xb1a5('0x2e')][_0x231666['peer']]['name']),_0xb1a5('0x31'),this[_0xb1a5('0x2e')][_0x231666[_0xb1a5('0x3e')]]);}else if(this[_0xb1a5('0xa')][_0x231666[_0xb1a5('0x3e')]]){this[_0xb1a5('0xa')][_0x231666[_0xb1a5('0x3e')]]['status']=_0x231666['peerstatus'][_0xb1a5('0x2b')]();this[_0xb1a5('0xa')][_0x231666[_0xb1a5('0x3e')]][_0xb1a5('0x40')]=_0x231666['address'];this[_0xb1a5('0x23')](util[_0xb1a5('0x2d')](_0xb1a5('0x24'),this[_0xb1a5('0xa')][_0x231666[_0xb1a5('0x3e')]][_0xb1a5('0x25')]),_0xb1a5('0x26'),this[_0xb1a5('0xa')][_0x231666[_0xb1a5('0x3e')]]);}else{}}}catch(_0x153e71){logger[_0xb1a5('0x18')]('[syncPeerStatus][UserReport]',util[_0xb1a5('0x19')](_0x153e71,{'showHidden':![],'depth':null}));}};module[_0xb1a5('0x41')]=UserReport; \ No newline at end of file +var _0x5811=['loopSyncRealTimeShow','catch','isNotNull','isUndefined','emit','find','username','stateRegistry','merge','omit','actionid','state','format','trunk:%s','name','[syncRegistry][UserReport]','device','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','trunk:save','startsWith','Queue','Local','substring','indexOf','mobile','phone','accountcode','peer','registered','status','address','telephone:%s','telephone:save','exports','lodash','moment','bluebird','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','prototype'];(function(_0x13c006,_0x2284ab){var _0x13c8bd=function(_0x245b5d){while(--_0x245b5d){_0x13c006['push'](_0x13c006['shift']());}};_0x13c8bd(++_0x2284ab);}(_0x5811,0x68));var _0x1581=function(_0x1b85c3,_0x5b4794){_0x1b85c3=_0x1b85c3-0x0;var _0x41a2b8=_0x5811[_0x1b85c3];return _0x41a2b8;};'use strict';var _=require(_0x1581('0x0'));var moment=require(_0x1581('0x1'));var BPromise=require(_0x1581('0x2'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x1581('0x3'))(_0x1581('0x4'));var ami=require(_0x1581('0x5'));config[_0x1581('0x6')]=_['defaults'](config[_0x1581('0x6')],{'host':_0x1581('0x7'),'port':0x18eb});var io=require(_0x1581('0x8'))(new Redis(config['redis']));function UserReport(_0x2904d2){this[_0x1581('0x9')]=_0x2904d2[_0x1581('0x9')];this[_0x1581('0xa')]=_0x2904d2[_0x1581('0xa')];this[_0x1581('0xb')]=_0x2904d2[_0x1581('0xb')];ami['on']('registryentry',this[_0x1581('0xc')][_0x1581('0xd')](this));ami['on'](_0x1581('0xe'),this[_0x1581('0xc')][_0x1581('0xd')](this));ami['on'](_0x1581('0xf'),this[_0x1581('0x10')]['bind'](this));ami['on'](_0x1581('0x11'),this[_0x1581('0x12')][_0x1581('0xd')](this));this['loopSyncRealTimeShow']();return BPromise[_0x1581('0x13')]()[_0x1581('0x14')](ami[_0x1581('0x15')]())[_0x1581('0x14')](ami[_0x1581('0x16')]())[_0x1581('0x14')](ami[_0x1581('0x17')]())['catch'](loggerCatch(_0x1581('0x18')));}function loggerCatch(_0x48edf5){return function(_0x3ac459){logger[_0x1581('0x19')](_0x48edf5,util[_0x1581('0x1a')](_0x3ac459,{'showHidden':![],'depth':null}));};}UserReport[_0x1581('0x1b')][_0x1581('0x1c')]=function(){setInterval(function(){BPromise[_0x1581('0x13')]()[_0x1581('0x14')](ami[_0x1581('0x15')]())[_0x1581('0x14')](ami[_0x1581('0x16')]())['then'](ami[_0x1581('0x17')]())[_0x1581('0x1d')](loggerCatch(_0x1581('0x18')));},0x32c8);};UserReport[_0x1581('0x1b')][_0x1581('0x1e')]=function(_0x5cbb7d){return _0x5cbb7d!==null&&!_[_0x1581('0x1f')](_0x5cbb7d);};UserReport[_0x1581('0x1b')][_0x1581('0x20')]=function(_0x5cb567,_0x50c4f0,_0x35dadb){io['to'](_0x5cb567)[_0x1581('0x20')](_0x50c4f0,_0x35dadb);};UserReport['prototype'][_0x1581('0xc')]=function(_0x196da4){try{if(this[_0x1581('0x1e')](_0x196da4)){var _0x3f0beb=_[_0x1581('0x21')](this[_0x1581('0x9')],{'registry':_0x196da4[_0x1581('0x22')]});if(_0x3f0beb){_0x196da4[_0x1581('0x23')]=_0x196da4['state'];_[_0x1581('0x24')](_0x3f0beb,_[_0x1581('0x25')](_0x196da4,['event',_0x1581('0x26'),_0x1581('0x22'),_0x1581('0x27')]));this[_0x1581('0x20')](util[_0x1581('0x28')](_0x1581('0x29'),_0x3f0beb[_0x1581('0x2a')]),'trunk:save',_0x3f0beb);}}}catch(_0x283dbb){logger['error'](_0x1581('0x2b'),util[_0x1581('0x1a')](_0x283dbb,{'showHidden':![],'depth':null}));}};UserReport[_0x1581('0x1b')][_0x1581('0x10')]=function(_0xef45ce){try{if(this[_0x1581('0x1e')](_0xef45ce)){if(this['agents'][_0xef45ce[_0x1581('0x2c')]]){if(!this[_0x1581('0xa')][_0xef45ce[_0x1581('0x2c')]][_0x1581('0x2d')]||_0xef45ce[_0x1581('0x27')][_0x1581('0x2e')]()=='inuse'){this[_0x1581('0xa')][_0xef45ce['device']][_0x1581('0x2d')]=![];if(this[_0x1581('0xa')][_0xef45ce[_0x1581('0x2c')]][_0x1581('0x27')]!==_0xef45ce[_0x1581('0x27')][_0x1581('0x2e')]()){this[_0x1581('0xa')][_0xef45ce[_0x1581('0x2c')]][_0x1581('0x2f')]=_[_0x1581('0x30')](moment()[_0x1581('0x28')]('x'));}this[_0x1581('0xa')][_0xef45ce[_0x1581('0x2c')]][_0x1581('0x27')]=_0xef45ce['state']['toLowerCase']();this[_0x1581('0xa')][_0xef45ce['device']][_0x1581('0x31')](_0xef45ce);}}else if(this[_0x1581('0xb')][_0xef45ce[_0x1581('0x2c')]]){if(this[_0x1581('0xb')][_0xef45ce['device']][_0x1581('0x27')]!==_0xef45ce[_0x1581('0x27')][_0x1581('0x2e')]()){this[_0x1581('0xb')][_0xef45ce[_0x1581('0x2c')]]['stateTime']=_[_0x1581('0x30')](moment()['format']('x'));}this['telephones'][_0xef45ce['device']][_0x1581('0x27')]=_0xef45ce[_0x1581('0x27')][_0x1581('0x2e')]();this[_0x1581('0x20')](util[_0x1581('0x28')]('telephone:%s',this[_0x1581('0xb')][_0xef45ce['device']]['name']),'telephone:save',this[_0x1581('0xb')][_0xef45ce['device']]);}else if(this[_0x1581('0x9')][_0xef45ce[_0x1581('0x2c')]]){if(this['trunks'][_0xef45ce[_0x1581('0x2c')]][_0x1581('0x27')]!==_0xef45ce[_0x1581('0x27')][_0x1581('0x2e')]()){this[_0x1581('0x9')][_0xef45ce[_0x1581('0x2c')]][_0x1581('0x2f')]=_[_0x1581('0x30')](moment()['format']('x'));}this[_0x1581('0x9')][_0xef45ce[_0x1581('0x2c')]]['state']=_0xef45ce[_0x1581('0x27')][_0x1581('0x2e')]();this[_0x1581('0x20')](util[_0x1581('0x28')]('trunk:%s',this[_0x1581('0x9')][_0xef45ce[_0x1581('0x2c')]][_0x1581('0x2a')]),_0x1581('0x32'),this[_0x1581('0x9')][_0xef45ce['device']]);}else if(_[_0x1581('0x33')](_0xef45ce[_0x1581('0x2c')],_0x1581('0x34'))){}else if(_['startsWith'](_0xef45ce[_0x1581('0x2c')],_0x1581('0x35'))){var _0x5480f9=_0xef45ce[_0x1581('0x2c')];var _0x5a53a6=_0x5480f9[_0x1581('0x36')](_0x5480f9[_0x1581('0x37')]('/')+0x1,_0x5480f9['indexOf']('@'));var _0x379869=_[_0x1581('0x21')](this['agents'],function(_0x594db1){return _0x594db1[_0x1581('0x38')]==_0x5a53a6||_0x594db1[_0x1581('0x39')]==_0x5a53a6||_0x594db1[_0x1581('0x3a')]==_0x5a53a6;});if(_0x379869){if(_0x379869[_0x1581('0x27')]!==_0xef45ce[_0x1581('0x27')][_0x1581('0x2e')]()){_0x379869[_0x1581('0x2f')]=_[_0x1581('0x30')](moment()['format']('x'));}_0x379869[_0x1581('0x27')]=_0xef45ce[_0x1581('0x27')][_0x1581('0x2e')]();_0x379869['local']=!![];_0x379869[_0x1581('0x31')](_0xef45ce);}}else{}}}catch(_0x19b055){logger['error']('[syncDeviceState][UserReport]',util['inspect'](_0x19b055,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x1581('0x12')]=function(_0x3d0382){try{if(this[_0x1581('0x1e')](_0x3d0382)&&this[_0x1581('0x1e')](_0x3d0382[_0x1581('0x11')])){if(this[_0x1581('0xa')][_0x3d0382[_0x1581('0x3b')]]){if(!this[_0x1581('0xa')][_0x3d0382[_0x1581('0x3b')]][_0x1581('0x2d')]||_0x3d0382[_0x1581('0x11')]['toLowerCase']()==_0x1581('0x3c')){this[_0x1581('0xa')][_0x3d0382['peer']][_0x1581('0x2d')]=![];this[_0x1581('0xa')][_0x3d0382[_0x1581('0x3b')]][_0x1581('0x3d')]=_0x3d0382[_0x1581('0x11')][_0x1581('0x2e')]();this[_0x1581('0xa')][_0x3d0382[_0x1581('0x3b')]]['address']=_0x3d0382[_0x1581('0x3e')];this[_0x1581('0xa')][_0x3d0382[_0x1581('0x3b')]][_0x1581('0x31')](_0x3d0382);}}else if(this['telephones'][_0x3d0382[_0x1581('0x3b')]]){this['telephones'][_0x3d0382[_0x1581('0x3b')]]['status']=_0x3d0382[_0x1581('0x11')][_0x1581('0x2e')]();this[_0x1581('0xb')][_0x3d0382['peer']]['address']=_0x3d0382[_0x1581('0x3e')];this[_0x1581('0x20')](util[_0x1581('0x28')](_0x1581('0x3f'),this[_0x1581('0xb')][_0x3d0382[_0x1581('0x3b')]][_0x1581('0x2a')]),_0x1581('0x40'),this[_0x1581('0xb')][_0x3d0382[_0x1581('0x3b')]]);}else if(this[_0x1581('0x9')][_0x3d0382['peer']]){this[_0x1581('0x9')][_0x3d0382[_0x1581('0x3b')]]['status']=_0x3d0382[_0x1581('0x11')][_0x1581('0x2e')]();this['trunks'][_0x3d0382[_0x1581('0x3b')]]['address']=_0x3d0382['address'];this[_0x1581('0x20')](util[_0x1581('0x28')](_0x1581('0x29'),this[_0x1581('0x9')][_0x3d0382[_0x1581('0x3b')]][_0x1581('0x2a')]),_0x1581('0x32'),this[_0x1581('0x9')][_0x3d0382['peer']]);}else{}}}catch(_0x376454){logger[_0x1581('0x19')]('[syncPeerStatus][UserReport]',util['inspect'](_0x376454,{'showHidden':![],'depth':null}));}};module[_0x1581('0x41')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 1619d16..7b1a4dd 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 _0x15b8=['channel','destexten','context','priority','type','inbound','mandatoryDisposition','agent','custom:agentcalled','user:called','CALLED','error','stack','ringtime','agentcalledAt','custom:agentconnect','user:%s','user:agentconnect','CONNECT','find','onhold','updateStatusRealtime','rejected','agentringnoanswerAt','RINGNOANSWER','holdtime','position','originalposition','abandoned','CALLERABANDON','talktime','reason','transfer','acwTimeout','agentcompleteAt','COMPLETE','clear','cause','answered_elsewhere','destuniqueid','agentcomplete','custom:agentcomplete','user:agentcomplete','HANGUP','syncHangup','cause-txt','recalculate','complete','acw','agentconnectAt','origtransfererchannel','ATTENDED','secondtransfereruniqueid','secondtransferercontext','transfertargetchannel','syncBlindTransfer','transfererchannel','BLIND','syncVarSet','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberlastcall','memberpenalty','memberrealtime','keys','includes','value','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','channels','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','hangup','attendedtransfer','syncAttendedTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','prototype','log','info','format','uniqueid','membername','queue','exten','calleridnum','addTime','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','interface','isNil','assign','emit','user:save','destchannel','calleridname','destcalleridnum','destcalleridname','accountcode','destaccountcode'];(function(_0x136911,_0x26cb19){var _0x3a2b1c=function(_0x164371){while(--_0x164371){_0x136911['push'](_0x136911['shift']());}};_0x3a2b1c(++_0x26cb19);}(_0x15b8,0xcd));var _0x815b=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x15b8[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var moment=require(_0x815b('0x0'));var util=require(_0x815b('0x1'));var Redis=require(_0x815b('0x2'));var config=require(_0x815b('0x3'));var logger=require(_0x815b('0x4'))('ami');var ami=require(_0x815b('0x5'));config[_0x815b('0x6')]=_[_0x815b('0x7')](config[_0x815b('0x6')],{'host':_0x815b('0x8'),'port':0x18eb});var io=require(_0x815b('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x1e9fc0){this[_0x815b('0xa')]=_0x1e9fc0[_0x815b('0xa')];this[_0x815b('0xb')]=_0x1e9fc0[_0x815b('0xb')];this[_0x815b('0xc')]={};this[_0x815b('0xd')]={};ami['on'](_0x815b('0xe'),this[_0x815b('0xf')][_0x815b('0x10')](this));ami['on'](_0x815b('0x11'),this[_0x815b('0x12')][_0x815b('0x10')](this));ami['on'](_0x815b('0x13'),this[_0x815b('0x14')][_0x815b('0x10')](this));ami['on'](_0x815b('0x15'),this[_0x815b('0x16')]['bind'](this));ami['on']('agentcomplete',this[_0x815b('0x17')][_0x815b('0x10')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x815b('0x18'),this['syncHangup']['bind'](this));ami['on'](_0x815b('0x19'),this[_0x815b('0x1a')][_0x815b('0x10')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x815b('0x10')](this));ami['on'](_0x815b('0x1b'),this[_0x815b('0x1c')][_0x815b('0x10')](this));ami['on'](_0x815b('0x1d'),this[_0x815b('0x1e')][_0x815b('0x10')](this));}VoiceAgentReport[_0x815b('0x1f')][_0x815b('0x20')]=function(_0x2fa2bd,_0x2ade43){logger[_0x815b('0x21')](util[_0x815b('0x22')]('%s|%s',_0x2fa2bd,[_0x2ade43[_0x815b('0x23')],_0x2ade43[_0x815b('0x24')],_0x2ade43[_0x815b('0x25')],_0x2ade43[_0x815b('0x26')],_0x2ade43[_0x815b('0x27')]]['join']('|')));};VoiceAgentReport[_0x815b('0x1f')][_0x815b('0x28')]=function(_0x134b42,_0x5cda85){return moment(_0x134b42)['add'](_0x5cda85,_0x815b('0x29'))[_0x815b('0x22')](_0x815b('0x2a'));};VoiceAgentReport[_0x815b('0x1f')][_0x815b('0x2b')]=function(_0x31ab20,_0x11f1c1){return moment(_0x31ab20)['diff'](moment(_0x11f1c1),'seconds');};VoiceAgentReport[_0x815b('0x1f')][_0x815b('0xf')]=function(_0x2bb5bc){try{var _0x15098a=this[_0x815b('0xb')][_0x2bb5bc[_0x815b('0x2c')]];if(!_[_0x815b('0x2d')](_0x15098a)){_0x15098a=_[_0x815b('0x2e')](_0x15098a,{'queue':_0x2bb5bc['queue'],'destconnectedlinenum':_0x2bb5bc[_0x815b('0x27')]});io[_0x815b('0x2f')](_0x815b('0x30'),_0x15098a);}var _0x522b9e=this[_0x815b('0xc')][_0x2bb5bc[_0x815b('0x31')]]={'agentcalledAt':moment()['format'](_0x815b('0x2a')),'calleridnum':_0x2bb5bc[_0x815b('0x27')],'calleridname':_0x2bb5bc[_0x815b('0x32')],'connectedlinenum':_0x2bb5bc[_0x815b('0x33')],'connectedlinename':_0x2bb5bc[_0x815b('0x34')],'accountcode':_0x2bb5bc[_0x815b('0x35')],'destaccountcode':_0x2bb5bc[_0x815b('0x36')],'channel':_0x2bb5bc[_0x815b('0x37')],'destchannel':_0x2bb5bc[_0x815b('0x31')],'uniqueid':_0x2bb5bc[_0x815b('0x23')],'destuniqueid':_0x2bb5bc['destuniqueid'],'destcalleridnum':_0x2bb5bc[_0x815b('0x33')],'destcalleridname':_0x2bb5bc[_0x815b('0x34')],'destexten':_0x2bb5bc[_0x815b('0x38')],'context':_0x2bb5bc[_0x815b('0x39')],'exten':_0x2bb5bc[_0x815b('0x26')],'priority':_0x2bb5bc[_0x815b('0x3a')],'queue':_0x2bb5bc['queue'],'type':this[_0x815b('0xa')][_0x2bb5bc[_0x815b('0x25')]]?this[_0x815b('0xa')][_0x2bb5bc[_0x815b('0x25')]][_0x815b('0x3b')]||'inbound':_0x815b('0x3c'),'interface':_0x2bb5bc['interface'],'mandatoryDisposition':this[_0x815b('0xa')][_0x2bb5bc[_0x815b('0x25')]][_0x815b('0x3d')]||0x0,'membername':_0x2bb5bc['membername'],'agentconnect':![],'agentconnectAt':null,'holdtime':0x0,'ringtime':0x0,'agentcomplete':![],'agentcompleteAt':null,'talktime':0x0,'agentringnoanswer':![],'agentringnoanswerAt':null,'reason':_0x815b('0x3e'),'transfer':![],'transferAt':null,'transfertype':null,'transferuniqueid':null,'transfercontext':null,'transferextension':null,'position':null,'originalposition':null,'cause':'','cause-txt':'','UserId':this['agents'][_0x2bb5bc['interface']]?this['agents'][_0x2bb5bc[_0x815b('0x2c')]]['id']:null,'lastevent':'called','agentacw':![],'acwtime':0x0,'variables':this[_0x815b('0xd')][_0x2bb5bc['channel']]?this[_0x815b('0xd')][_0x2bb5bc[_0x815b('0x37')]]:{}};ami['emit'](_0x815b('0x3f'),_0x522b9e);io['to'](util['format']('user:%s',_0x522b9e[_0x815b('0x24')]))[_0x815b('0x2f')](_0x815b('0x40'),_0x522b9e);this['log'](_0x815b('0x41'),this[_0x815b('0xc')][_0x2bb5bc[_0x815b('0x31')]]);}catch(_0x531760){logger[_0x815b('0x42')](_0x531760[_0x815b('0x43')]);}};VoiceAgentReport[_0x815b('0x1f')]['syncAgentConnect']=function(_0x1d0e53){try{var _0x273125=this[_0x815b('0xc')][_0x1d0e53[_0x815b('0x31')]];if(!_[_0x815b('0x2d')](_0x273125)){_0x273125=_['assign'](_0x273125,{'holdtime':parseInt(_0x1d0e53['holdtime'],0xa),'ringtime':parseInt(_0x1d0e53[_0x815b('0x44')],0xa),'agentconnect':!![],'lastevent':'connect'});_0x273125['agentconnectAt']=this[_0x815b('0x28')](_0x273125[_0x815b('0x45')],_0x273125['ringtime']);ami[_0x815b('0x2f')](_0x815b('0x46'),_0x273125);io['to'](util[_0x815b('0x22')](_0x815b('0x47'),_0x273125[_0x815b('0x24')]))[_0x815b('0x2f')](_0x815b('0x48'),_0x273125);this['log'](_0x815b('0x49'),_0x273125);}}catch(_0x41ba11){logger[_0x815b('0x42')](_0x41ba11[_0x815b('0x43')]);}};VoiceAgentReport[_0x815b('0x1f')][_0x815b('0x1c')]=function(_0x58645b){try{var _0x1c9ae7=_[_0x815b('0x4a')](this[_0x815b('0xc')],{'channel':_0x58645b[_0x815b('0x37')],'agentconnect':!![]});if(!_[_0x815b('0x2d')](_0x1c9ae7)){if(!_['isNil'](this[_0x815b('0xb')][_0x1c9ae7[_0x815b('0x2c')]])){this[_0x815b('0xb')][_0x1c9ae7[_0x815b('0x2c')]][_0x815b('0x4b')]=!![];this['agents'][_0x1c9ae7[_0x815b('0x2c')]][_0x815b('0x4c')]();}}}catch(_0x40c4e8){logger[_0x815b('0x42')](_0x40c4e8[_0x815b('0x43')]);}};VoiceAgentReport[_0x815b('0x1f')][_0x815b('0x1e')]=function(_0x556905){try{var _0xbd4b25=_['find'](this[_0x815b('0xc')],{'channel':_0x556905[_0x815b('0x37')],'agentconnect':!![]});if(!_[_0x815b('0x2d')](_0xbd4b25)){if(!_[_0x815b('0x2d')](this[_0x815b('0xb')][_0xbd4b25[_0x815b('0x2c')]])){this[_0x815b('0xb')][_0xbd4b25['interface']][_0x815b('0x4b')]=![];this[_0x815b('0xb')][_0xbd4b25['interface']][_0x815b('0x4c')]();}}}catch(_0x3505aa){logger[_0x815b('0x42')](_0x3505aa[_0x815b('0x43')]);}};VoiceAgentReport[_0x815b('0x1f')][_0x815b('0x14')]=function(_0x1aa92a){try{var _0x3882a1=this['channels'][_0x1aa92a[_0x815b('0x31')]];if(!_[_0x815b('0x2d')](_0x3882a1)){_0x3882a1=_[_0x815b('0x2e')](_0x3882a1,{'ringtime':parseInt(_0x1aa92a[_0x815b('0x44')],0xa)/0x3e8,'agentringnoanswer':!![],'reason':'rejected','lastevent':_0x815b('0x4d')});_0x3882a1[_0x815b('0x4e')]=this[_0x815b('0x28')](_0x3882a1[_0x815b('0x45')],_0x3882a1[_0x815b('0x44')]);ami[_0x815b('0x2f')]('custom:agentringnoanswer',_0x3882a1);this[_0x815b('0x20')](_0x815b('0x4f'),_0x3882a1);}}catch(_0x2ebaa7){logger['error'](_0x2ebaa7['stack']);}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x372128){try{for(var _0x515ae3 in this[_0x815b('0xc')]){var _0x8bf43f=this['channels'][_0x515ae3];if(!_[_0x815b('0x2d')](_0x8bf43f)&&_0x8bf43f[_0x815b('0x37')]==_0x372128[_0x815b('0x37')]){_0x8bf43f=_[_0x815b('0x2e')](_0x8bf43f,{'holdtime':parseInt(_0x372128[_0x815b('0x50')],0xa),'position':parseInt(_0x372128[_0x815b('0x51')],0xa),'originalposition':parseInt(_0x372128[_0x815b('0x52')],0xa),'agentringnoanswer':!![],'agentringnoanswerAt':moment()['format'](_0x815b('0x2a')),'reason':_0x815b('0x53'),'lastevent':_0x815b('0x53')});ami[_0x815b('0x2f')]('custom:agentqueuecallerabandon',_0x8bf43f);this[_0x815b('0x20')](_0x815b('0x54'),_0x8bf43f);}}}catch(_0x3b315c){logger[_0x815b('0x42')](_0x3b315c[_0x815b('0x43')]);}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x575904){try{var _0x1a9291=this['channels'][_0x575904['destchannel']];if(!_['isNil'](_0x1a9291)){_0x1a9291=_[_0x815b('0x2e')](_0x1a9291,{'talktime':parseInt(_0x575904[_0x815b('0x55')],0xa),'reason':_0x575904[_0x815b('0x56')]==_0x815b('0x57')?_0x815b('0x3e'):_0x575904[_0x815b('0x56')],'agentcomplete':!![],'lastevent':'complete','agentacw':this[_0x815b('0xa')][_0x1a9291[_0x815b('0x25')]]&&this[_0x815b('0xa')][_0x1a9291[_0x815b('0x25')]]['acw']?!![]:![],'acwtime':this[_0x815b('0xa')][_0x1a9291['queue']]&&this[_0x815b('0xa')][_0x1a9291[_0x815b('0x25')]]['acw']?this[_0x815b('0xa')][_0x1a9291[_0x815b('0x25')]][_0x815b('0x58')]:0x0});_0x1a9291[_0x815b('0x59')]=this[_0x815b('0x28')](_0x1a9291['agentconnectAt'],_0x1a9291[_0x815b('0x55')]);this[_0x815b('0x20')](_0x815b('0x5a'),_0x1a9291);}}catch(_0x162723){logger[_0x815b('0x42')](_0x162723[_0x815b('0x43')]);}};VoiceAgentReport[_0x815b('0x1f')][_0x815b('0x5b')]=function(_0x1917b2){try{switch(_0x1917b2[_0x815b('0x5c')]){case 0x1a:_0x1917b2=_[_0x815b('0x2e')](_0x1917b2,{'agentringnoanswer':!![],'reason':_0x815b('0x5d'),'lastevent':_0x815b('0x5d')});var _0x283d63=_[_0x815b('0x4a')](this[_0x815b('0xc')],{'channel':_0x1917b2['channel'],'agentconnect':!![]});if(!_[_0x815b('0x2d')](_0x283d63)){_0x1917b2=_[_0x815b('0x2e')](_0x1917b2,{'agentringnoanswerAt':_0x283d63['agentconnectAt'],'answeredelsewheremembername':_0x283d63[_0x815b('0x24')],'answeredelsewheredestinationuniqueid':_0x283d63[_0x815b('0x5e')]});}ami[_0x815b('0x2f')]('custom:agentansweredelsewhere',_0x1917b2);break;}if(_0x1917b2[_0x815b('0x5f')]){ami[_0x815b('0x2f')](_0x815b('0x60'),_0x1917b2);io['to'](util[_0x815b('0x22')]('user:%s',_0x1917b2['membername']))[_0x815b('0x2f')](_0x815b('0x61'),_0x1917b2);}this[_0x815b('0x20')](_0x815b('0x62'),_0x1917b2);ami[_0x815b('0x2f')]('custom:voiceAgentReport',_0x1917b2);if(this[_0x815b('0xc')][_0x1917b2[_0x815b('0x31')]]){delete this[_0x815b('0xc')][_0x1917b2[_0x815b('0x31')]];}}catch(_0x3e87f9){logger[_0x815b('0x42')](_0x3e87f9);}};VoiceAgentReport[_0x815b('0x1f')][_0x815b('0x63')]=function(_0x4aa550){try{var _0x4a1172=this[_0x815b('0xc')][_0x4aa550[_0x815b('0x37')]];if(!_[_0x815b('0x2d')](_0x4a1172)){_0x4a1172=_[_0x815b('0x2e')](_0x4a1172,{'cause':parseInt(_0x4aa550[_0x815b('0x5c')],0xa),'cause-txt':_0x4aa550[_0x815b('0x64')]});if(_0x4a1172[_0x815b('0x65')]){_0x4a1172=_[_0x815b('0x2e')](_0x4a1172,{'agentcomplete':!![],'agentcompleteAt':moment()[_0x815b('0x22')](_0x815b('0x2a')),'lastevent':_0x815b('0x66'),'agentacw':this[_0x815b('0xa')][_0x4a1172['queue']]&&this[_0x815b('0xa')][_0x4a1172[_0x815b('0x25')]]['acw']?!![]:![],'acwtime':this[_0x815b('0xa')][_0x4a1172['queue']]&&this[_0x815b('0xa')][_0x4a1172[_0x815b('0x25')]][_0x815b('0x67')]?this[_0x815b('0xa')][_0x4a1172['queue']][_0x815b('0x58')]:0x0});_0x4a1172[_0x815b('0x55')]=this[_0x815b('0x2b')](_0x4a1172[_0x815b('0x59')],_0x4a1172[_0x815b('0x68')]);}var _0x1a6908=this[_0x815b('0xb')][_0x4a1172[_0x815b('0x2c')]];if(!_[_0x815b('0x2d')](_0x1a6908)){_0x1a6908=_[_0x815b('0x2e')](_0x1a6908,{'queue':null,'destconnectedlinenum':null});io[_0x815b('0x2f')](_0x815b('0x30'),_0x1a6908);}setTimeout(this[_0x815b('0x5b')][_0x815b('0x10')](this,_0x4a1172),0x3e8);}if(this[_0x815b('0xd')][_0x4aa550[_0x815b('0x37')]]){delete this[_0x815b('0xd')][_0x4aa550[_0x815b('0x37')]];}}catch(_0xf7e95b){logger['error'](_0xf7e95b[_0x815b('0x43')]);}};VoiceAgentReport[_0x815b('0x1f')]['syncAttendedTransfer']=function(_0x23b96c){try{var _0x56a0fd=this[_0x815b('0xc')][_0x23b96c[_0x815b('0x69')]];if(!_[_0x815b('0x2d')](_0x56a0fd)){_0x56a0fd=_[_0x815b('0x2e')](_0x56a0fd,{'transfer':!![],'transferAt':moment()[_0x815b('0x22')](_0x815b('0x2a')),'transfertype':_0x815b('0x6a'),'agentcomplete':!![],'agentcompleteAt':moment()[_0x815b('0x22')](_0x815b('0x2a')),'transferuniqueid':_0x23b96c[_0x815b('0x6b')],'transfercontext':_0x23b96c['secondtransfererexten'],'transferextension':_0x23b96c[_0x815b('0x6c')],'reason':_0x815b('0x57'),'lastevent':'complete','agentacw':this[_0x815b('0xa')][_0x56a0fd[_0x815b('0x25')]]&&this['voiceQueues'][_0x56a0fd[_0x815b('0x25')]]['acw']?!![]:![],'acwtime':this['voiceQueues'][_0x56a0fd[_0x815b('0x25')]]&&this[_0x815b('0xa')][_0x56a0fd['queue']][_0x815b('0x67')]?this[_0x815b('0xa')][_0x56a0fd[_0x815b('0x25')]][_0x815b('0x58')]:0x0});_0x56a0fd['talktime']=this[_0x815b('0x2b')](_0x56a0fd[_0x815b('0x59')],_0x56a0fd['agentconnectAt']);this['log'](_0x815b('0x6a'),_0x56a0fd);}if(!_[_0x815b('0x2d')](this[_0x815b('0xc')][_0x23b96c[_0x815b('0x6d')]])){this[_0x815b('0xc')][_0x23b96c[_0x815b('0x6d')]][_0x815b('0x65')]=!![];}}catch(_0x264d22){logger['error'](_0x264d22['stack']);}};VoiceAgentReport[_0x815b('0x1f')][_0x815b('0x6e')]=function(_0x99f338){try{var _0x16b23f=this[_0x815b('0xc')][_0x99f338[_0x815b('0x6f')]];if(!_[_0x815b('0x2d')](_0x16b23f)){_0x16b23f=_[_0x815b('0x2e')](_0x16b23f,{'transfer':!![],'transferAt':moment()['format'](_0x815b('0x2a')),'transfertype':_0x815b('0x70'),'transferuniqueid':_0x99f338['transfereeuniqueid'],'transfercontext':_0x99f338['context'],'transferextension':_0x99f338['extension'],'agentcomplete':!![],'agentcompleteAt':moment()[_0x815b('0x22')](_0x815b('0x2a')),'reason':'transfer','lastevent':_0x815b('0x66'),'agentacw':this[_0x815b('0xa')][_0x16b23f[_0x815b('0x25')]]&&this[_0x815b('0xa')][_0x16b23f[_0x815b('0x25')]]['acw']?!![]:![],'acwtime':this['voiceQueues'][_0x16b23f[_0x815b('0x25')]]&&this[_0x815b('0xa')][_0x16b23f[_0x815b('0x25')]]['acw']?this[_0x815b('0xa')][_0x16b23f[_0x815b('0x25')]][_0x815b('0x58')]:0x0});_0x16b23f[_0x815b('0x65')]=!![];this[_0x815b('0x20')]('BLIND',_0x16b23f);}}catch(_0x460b1d){logger['error'](_0x460b1d[_0x815b('0x43')]);}};VoiceAgentReport[_0x815b('0x1f')][_0x815b('0x71')]=function(_0x5ae6f2){var _0x4b5a29=[_0x815b('0x72'),_0x815b('0x73'),'rtpaudioqosjitter',_0x815b('0x74'),'rtpaudioqosloss',_0x815b('0x75'),'rtpaudioqosrtt',_0x815b('0x76'),_0x815b('0x77'),_0x815b('0x78'),_0x815b('0x79'),'bridgepvtcallid',_0x815b('0x7a'),'memberdynamic','memberinterface',_0x815b('0x7b'),_0x815b('0x24'),_0x815b('0x7c'),_0x815b('0x7d')];try{var _0x3d5f98=_[_0x815b('0x7e')](_0x5ae6f2['variable'])[0x0];if(!_[_0x815b('0x2d')](_0x3d5f98)&&!_[_0x815b('0x7f')](_0x4b5a29,_0x3d5f98)){if(!this[_0x815b('0xd')][_0x5ae6f2['channel']]){this[_0x815b('0xd')][_0x5ae6f2['channel']]={};}this['variables'][_0x5ae6f2[_0x815b('0x37')]][_0x3d5f98]=_0x5ae6f2[_0x815b('0x80')];}}catch(_0x4fcbcb){logger[_0x815b('0x42')](_0x4fcbcb[_0x815b('0x43')]);}};module[_0x815b('0x81')]=VoiceAgentReport; \ No newline at end of file +var _0x01d3=['clear','cause','answered_elsewhere','custom:agentansweredelsewhere','custom:agentcomplete','user:%s','user:agentcomplete','custom:voiceAgentReport','syncHangup','cause-txt','recalculate','ATTENDED','secondtransfereruniqueid','secondtransfererexten','secondtransferercontext','transfertargetchannel','syncBlindTransfer','transfererchannel','BLIND','transfereeuniqueid','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberrealtime','keys','value','exports','lodash','moment','util','ioredis','../../../config/logger','ami','redis','defaults','localhost','voiceQueues','agents','channels','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','syncAgentRingNoAnswer','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','attendedtransfer','syncAttendedTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','prototype','format','%s|%s','membername','exten','calleridnum','join','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','interface','isNil','queue','emit','user:save','calleridname','destcalleridname','destchannel','destuniqueid','destcalleridnum','destexten','context','priority','type','mandatoryDisposition','agent','called','custom:agentcalled','user:called','CALLED','error','stack','ringtime','connect','agentconnectAt','agentcalledAt','log','CONNECT','find','channel','onhold','updateStatusRealtime','assign','rejected','agentringnoanswerAt','RINGNOANSWER','syncQueueCallerAbandon','holdtime','position','originalposition','abandoned','custom:agentqueuecallerabandon','talktime','reason','transfer','complete','acw','acwTimeout','agentcompleteAt','COMPLETE'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x01d3,0xa2));var _0x301d=function(_0xfc4648,_0x7e8703){_0xfc4648=_0xfc4648-0x0;var _0x2fc96c=_0x01d3[_0xfc4648];return _0x2fc96c;};'use strict';var _=require(_0x301d('0x0'));var moment=require(_0x301d('0x1'));var util=require(_0x301d('0x2'));var Redis=require(_0x301d('0x3'));var config=require('../../../config/environment');var logger=require(_0x301d('0x4'))(_0x301d('0x5'));var ami=require('../ami');config[_0x301d('0x6')]=_[_0x301d('0x7')](config[_0x301d('0x6')],{'host':_0x301d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x301d('0x6')]));function VoiceAgentReport(_0x2d8fc2){this[_0x301d('0x9')]=_0x2d8fc2[_0x301d('0x9')];this[_0x301d('0xa')]=_0x2d8fc2[_0x301d('0xa')];this[_0x301d('0xb')]={};this[_0x301d('0xc')]={};ami['on'](_0x301d('0xd'),this[_0x301d('0xe')]['bind'](this));ami['on'](_0x301d('0xf'),this[_0x301d('0x10')][_0x301d('0x11')](this));ami['on']('agentringnoanswer',this[_0x301d('0x12')][_0x301d('0x11')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x301d('0x13'),this[_0x301d('0x14')][_0x301d('0x11')](this));ami['on'](_0x301d('0x15'),this[_0x301d('0x16')][_0x301d('0x11')](this));ami['on'](_0x301d('0x17'),this['syncHangup']['bind'](this));ami['on'](_0x301d('0x18'),this[_0x301d('0x19')][_0x301d('0x11')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));ami['on']('musiconholdstart',this[_0x301d('0x1a')][_0x301d('0x11')](this));ami['on'](_0x301d('0x1b'),this[_0x301d('0x1c')][_0x301d('0x11')](this));}VoiceAgentReport[_0x301d('0x1d')]['log']=function(_0x40a9ed,_0x4ed038){logger['info'](util[_0x301d('0x1e')](_0x301d('0x1f'),_0x40a9ed,[_0x4ed038['uniqueid'],_0x4ed038[_0x301d('0x20')],_0x4ed038['queue'],_0x4ed038[_0x301d('0x21')],_0x4ed038[_0x301d('0x22')]][_0x301d('0x23')]('|')));};VoiceAgentReport['prototype'][_0x301d('0x24')]=function(_0x53ed76,_0x3f9294){return moment(_0x53ed76)[_0x301d('0x25')](_0x3f9294,_0x301d('0x26'))['format'](_0x301d('0x27'));};VoiceAgentReport[_0x301d('0x1d')][_0x301d('0x28')]=function(_0x3b1f29,_0x21f186){return moment(_0x3b1f29)[_0x301d('0x29')](moment(_0x21f186),_0x301d('0x26'));};VoiceAgentReport['prototype'][_0x301d('0xe')]=function(_0x3ec2b6){try{var _0x45e7e3=this['agents'][_0x3ec2b6[_0x301d('0x2a')]];if(!_[_0x301d('0x2b')](_0x45e7e3)){_0x45e7e3=_['assign'](_0x45e7e3,{'queue':_0x3ec2b6[_0x301d('0x2c')],'destconnectedlinenum':_0x3ec2b6['calleridnum']});io[_0x301d('0x2d')](_0x301d('0x2e'),_0x45e7e3);}var _0x49f1ac=this[_0x301d('0xb')][_0x3ec2b6['destchannel']]={'agentcalledAt':moment()['format'](_0x301d('0x27')),'calleridnum':_0x3ec2b6[_0x301d('0x22')],'calleridname':_0x3ec2b6[_0x301d('0x2f')],'connectedlinenum':_0x3ec2b6['destcalleridnum'],'connectedlinename':_0x3ec2b6[_0x301d('0x30')],'accountcode':_0x3ec2b6['accountcode'],'destaccountcode':_0x3ec2b6['destaccountcode'],'channel':_0x3ec2b6['channel'],'destchannel':_0x3ec2b6[_0x301d('0x31')],'uniqueid':_0x3ec2b6['uniqueid'],'destuniqueid':_0x3ec2b6[_0x301d('0x32')],'destcalleridnum':_0x3ec2b6[_0x301d('0x33')],'destcalleridname':_0x3ec2b6[_0x301d('0x30')],'destexten':_0x3ec2b6[_0x301d('0x34')],'context':_0x3ec2b6[_0x301d('0x35')],'exten':_0x3ec2b6[_0x301d('0x21')],'priority':_0x3ec2b6[_0x301d('0x36')],'queue':_0x3ec2b6[_0x301d('0x2c')],'type':this['voiceQueues'][_0x3ec2b6[_0x301d('0x2c')]]?this['voiceQueues'][_0x3ec2b6[_0x301d('0x2c')]][_0x301d('0x37')]||'inbound':'inbound','interface':_0x3ec2b6[_0x301d('0x2a')],'mandatoryDisposition':this['voiceQueues'][_0x3ec2b6[_0x301d('0x2c')]][_0x301d('0x38')]||0x0,'membername':_0x3ec2b6[_0x301d('0x20')],'agentconnect':![],'agentconnectAt':null,'holdtime':0x0,'ringtime':0x0,'agentcomplete':![],'agentcompleteAt':null,'talktime':0x0,'agentringnoanswer':![],'agentringnoanswerAt':null,'reason':_0x301d('0x39'),'transfer':![],'transferAt':null,'transfertype':null,'transferuniqueid':null,'transfercontext':null,'transferextension':null,'position':null,'originalposition':null,'cause':'','cause-txt':'','UserId':this[_0x301d('0xa')][_0x3ec2b6[_0x301d('0x2a')]]?this[_0x301d('0xa')][_0x3ec2b6[_0x301d('0x2a')]]['id']:null,'lastevent':_0x301d('0x3a'),'agentacw':![],'acwtime':0x0,'variables':this[_0x301d('0xc')][_0x3ec2b6['channel']]?this['variables'][_0x3ec2b6['channel']]:{}};ami[_0x301d('0x2d')](_0x301d('0x3b'),_0x49f1ac);io['to'](util[_0x301d('0x1e')]('user:%s',_0x49f1ac[_0x301d('0x20')]))[_0x301d('0x2d')](_0x301d('0x3c'),_0x49f1ac);this['log'](_0x301d('0x3d'),this[_0x301d('0xb')][_0x3ec2b6[_0x301d('0x31')]]);}catch(_0x4c2692){logger[_0x301d('0x3e')](_0x4c2692[_0x301d('0x3f')]);}};VoiceAgentReport[_0x301d('0x1d')][_0x301d('0x10')]=function(_0x7160b2){try{var _0x16b5dc=this[_0x301d('0xb')][_0x7160b2[_0x301d('0x31')]];if(!_[_0x301d('0x2b')](_0x16b5dc)){_0x16b5dc=_['assign'](_0x16b5dc,{'holdtime':parseInt(_0x7160b2['holdtime'],0xa),'ringtime':parseInt(_0x7160b2[_0x301d('0x40')],0xa),'agentconnect':!![],'lastevent':_0x301d('0x41')});_0x16b5dc[_0x301d('0x42')]=this[_0x301d('0x24')](_0x16b5dc[_0x301d('0x43')],_0x16b5dc[_0x301d('0x40')]);ami[_0x301d('0x2d')]('custom:agentconnect',_0x16b5dc);io['to'](util[_0x301d('0x1e')]('user:%s',_0x16b5dc['membername']))[_0x301d('0x2d')]('user:agentconnect',_0x16b5dc);this[_0x301d('0x44')](_0x301d('0x45'),_0x16b5dc);}}catch(_0x46a968){logger['error'](_0x46a968['stack']);}};VoiceAgentReport[_0x301d('0x1d')][_0x301d('0x1a')]=function(_0x5759cb){try{var _0x5f4ce0=_[_0x301d('0x46')](this['channels'],{'channel':_0x5759cb['channel'],'agentconnect':!![]});if(!_[_0x301d('0x2b')](_0x5f4ce0)){if(!_[_0x301d('0x2b')](this[_0x301d('0xa')][_0x5f4ce0[_0x301d('0x2a')]])){this[_0x301d('0xa')][_0x5f4ce0[_0x301d('0x2a')]]['onhold']=!![];this['agents'][_0x5f4ce0['interface']]['updateStatusRealtime']();}}}catch(_0x882108){logger[_0x301d('0x3e')](_0x882108[_0x301d('0x3f')]);}};VoiceAgentReport[_0x301d('0x1d')][_0x301d('0x1c')]=function(_0x9549a1){try{var _0x57c90f=_[_0x301d('0x46')](this[_0x301d('0xb')],{'channel':_0x9549a1[_0x301d('0x47')],'agentconnect':!![]});if(!_[_0x301d('0x2b')](_0x57c90f)){if(!_[_0x301d('0x2b')](this[_0x301d('0xa')][_0x57c90f[_0x301d('0x2a')]])){this['agents'][_0x57c90f[_0x301d('0x2a')]][_0x301d('0x48')]=![];this[_0x301d('0xa')][_0x57c90f['interface']][_0x301d('0x49')]();}}}catch(_0x12d390){logger[_0x301d('0x3e')](_0x12d390[_0x301d('0x3f')]);}};VoiceAgentReport[_0x301d('0x1d')][_0x301d('0x12')]=function(_0x474650){try{var _0x415d54=this['channels'][_0x474650[_0x301d('0x31')]];if(!_[_0x301d('0x2b')](_0x415d54)){_0x415d54=_[_0x301d('0x4a')](_0x415d54,{'ringtime':parseInt(_0x474650['ringtime'],0xa)/0x3e8,'agentringnoanswer':!![],'reason':_0x301d('0x4b'),'lastevent':'rejected'});_0x415d54[_0x301d('0x4c')]=this[_0x301d('0x24')](_0x415d54['agentcalledAt'],_0x415d54['ringtime']);ami[_0x301d('0x2d')]('custom:agentringnoanswer',_0x415d54);this[_0x301d('0x44')](_0x301d('0x4d'),_0x415d54);}}catch(_0x525118){logger[_0x301d('0x3e')](_0x525118[_0x301d('0x3f')]);}};VoiceAgentReport[_0x301d('0x1d')][_0x301d('0x4e')]=function(_0x2bfe3e){try{for(var _0x26abf5 in this[_0x301d('0xb')]){var _0x254aac=this[_0x301d('0xb')][_0x26abf5];if(!_[_0x301d('0x2b')](_0x254aac)&&_0x254aac[_0x301d('0x47')]==_0x2bfe3e[_0x301d('0x47')]){_0x254aac=_['assign'](_0x254aac,{'holdtime':parseInt(_0x2bfe3e[_0x301d('0x4f')],0xa),'position':parseInt(_0x2bfe3e[_0x301d('0x50')],0xa),'originalposition':parseInt(_0x2bfe3e[_0x301d('0x51')],0xa),'agentringnoanswer':!![],'agentringnoanswerAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x301d('0x52'),'lastevent':_0x301d('0x52')});ami[_0x301d('0x2d')](_0x301d('0x53'),_0x254aac);this[_0x301d('0x44')]('CALLERABANDON',_0x254aac);}}}catch(_0x8f0202){logger[_0x301d('0x3e')](_0x8f0202[_0x301d('0x3f')]);}};VoiceAgentReport[_0x301d('0x1d')]['syncAgentComplete']=function(_0x314075){try{var _0x1db4c6=this['channels'][_0x314075[_0x301d('0x31')]];if(!_[_0x301d('0x2b')](_0x1db4c6)){_0x1db4c6=_[_0x301d('0x4a')](_0x1db4c6,{'talktime':parseInt(_0x314075[_0x301d('0x54')],0xa),'reason':_0x314075[_0x301d('0x55')]==_0x301d('0x56')?_0x301d('0x39'):_0x314075['reason'],'agentcomplete':!![],'lastevent':_0x301d('0x57'),'agentacw':this[_0x301d('0x9')][_0x1db4c6[_0x301d('0x2c')]]&&this[_0x301d('0x9')][_0x1db4c6['queue']][_0x301d('0x58')]?!![]:![],'acwtime':this['voiceQueues'][_0x1db4c6['queue']]&&this[_0x301d('0x9')][_0x1db4c6['queue']][_0x301d('0x58')]?this['voiceQueues'][_0x1db4c6[_0x301d('0x2c')]][_0x301d('0x59')]:0x0});_0x1db4c6[_0x301d('0x5a')]=this[_0x301d('0x24')](_0x1db4c6[_0x301d('0x42')],_0x1db4c6[_0x301d('0x54')]);this[_0x301d('0x44')](_0x301d('0x5b'),_0x1db4c6);}}catch(_0x51c347){logger[_0x301d('0x3e')](_0x51c347[_0x301d('0x3f')]);}};VoiceAgentReport['prototype'][_0x301d('0x5c')]=function(_0x5bffb4){try{switch(_0x5bffb4[_0x301d('0x5d')]){case 0x1a:_0x5bffb4=_[_0x301d('0x4a')](_0x5bffb4,{'agentringnoanswer':!![],'reason':'answered_elsewhere','lastevent':_0x301d('0x5e')});var _0x2015ca=_[_0x301d('0x46')](this[_0x301d('0xb')],{'channel':_0x5bffb4['channel'],'agentconnect':!![]});if(!_['isNil'](_0x2015ca)){_0x5bffb4=_['assign'](_0x5bffb4,{'agentringnoanswerAt':_0x2015ca[_0x301d('0x42')],'answeredelsewheremembername':_0x2015ca[_0x301d('0x20')],'answeredelsewheredestinationuniqueid':_0x2015ca[_0x301d('0x32')]});}ami[_0x301d('0x2d')](_0x301d('0x5f'),_0x5bffb4);break;}if(_0x5bffb4[_0x301d('0x13')]){ami[_0x301d('0x2d')](_0x301d('0x60'),_0x5bffb4);io['to'](util[_0x301d('0x1e')](_0x301d('0x61'),_0x5bffb4[_0x301d('0x20')]))['emit'](_0x301d('0x62'),_0x5bffb4);}this[_0x301d('0x44')]('HANGUP',_0x5bffb4);ami[_0x301d('0x2d')](_0x301d('0x63'),_0x5bffb4);if(this[_0x301d('0xb')][_0x5bffb4['destchannel']]){delete this[_0x301d('0xb')][_0x5bffb4[_0x301d('0x31')]];}}catch(_0x1be719){logger[_0x301d('0x3e')](_0x1be719);}};VoiceAgentReport['prototype'][_0x301d('0x64')]=function(_0x3b89bc){try{var _0x27b651=this[_0x301d('0xb')][_0x3b89bc[_0x301d('0x47')]];if(!_[_0x301d('0x2b')](_0x27b651)){_0x27b651=_['assign'](_0x27b651,{'cause':parseInt(_0x3b89bc[_0x301d('0x5d')],0xa),'cause-txt':_0x3b89bc[_0x301d('0x65')]});if(_0x27b651[_0x301d('0x66')]){_0x27b651=_['assign'](_0x27b651,{'agentcomplete':!![],'agentcompleteAt':moment()[_0x301d('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'complete','agentacw':this[_0x301d('0x9')][_0x27b651[_0x301d('0x2c')]]&&this[_0x301d('0x9')][_0x27b651['queue']][_0x301d('0x58')]?!![]:![],'acwtime':this[_0x301d('0x9')][_0x27b651[_0x301d('0x2c')]]&&this[_0x301d('0x9')][_0x27b651[_0x301d('0x2c')]][_0x301d('0x58')]?this[_0x301d('0x9')][_0x27b651[_0x301d('0x2c')]]['acwTimeout']:0x0});_0x27b651[_0x301d('0x54')]=this['diffTime'](_0x27b651[_0x301d('0x5a')],_0x27b651[_0x301d('0x42')]);}var _0x4e51f6=this[_0x301d('0xa')][_0x27b651[_0x301d('0x2a')]];if(!_[_0x301d('0x2b')](_0x4e51f6)){_0x4e51f6=_[_0x301d('0x4a')](_0x4e51f6,{'queue':null,'destconnectedlinenum':null});io['emit']('user:save',_0x4e51f6);}setTimeout(this[_0x301d('0x5c')][_0x301d('0x11')](this,_0x27b651),0x3e8);}if(this[_0x301d('0xc')][_0x3b89bc[_0x301d('0x47')]]){delete this[_0x301d('0xc')][_0x3b89bc[_0x301d('0x47')]];}}catch(_0x1a50ef){logger['error'](_0x1a50ef[_0x301d('0x3f')]);}};VoiceAgentReport[_0x301d('0x1d')][_0x301d('0x19')]=function(_0x5ca281){try{var _0x3d69ee=this['channels'][_0x5ca281['origtransfererchannel']];if(!_['isNil'](_0x3d69ee)){_0x3d69ee=_[_0x301d('0x4a')](_0x3d69ee,{'transfer':!![],'transferAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'transfertype':_0x301d('0x67'),'agentcomplete':!![],'agentcompleteAt':moment()[_0x301d('0x1e')](_0x301d('0x27')),'transferuniqueid':_0x5ca281[_0x301d('0x68')],'transfercontext':_0x5ca281[_0x301d('0x69')],'transferextension':_0x5ca281[_0x301d('0x6a')],'reason':_0x301d('0x56'),'lastevent':_0x301d('0x57'),'agentacw':this[_0x301d('0x9')][_0x3d69ee[_0x301d('0x2c')]]&&this[_0x301d('0x9')][_0x3d69ee['queue']][_0x301d('0x58')]?!![]:![],'acwtime':this[_0x301d('0x9')][_0x3d69ee[_0x301d('0x2c')]]&&this[_0x301d('0x9')][_0x3d69ee[_0x301d('0x2c')]]['acw']?this['voiceQueues'][_0x3d69ee[_0x301d('0x2c')]][_0x301d('0x59')]:0x0});_0x3d69ee[_0x301d('0x54')]=this[_0x301d('0x28')](_0x3d69ee[_0x301d('0x5a')],_0x3d69ee[_0x301d('0x42')]);this[_0x301d('0x44')](_0x301d('0x67'),_0x3d69ee);}if(!_[_0x301d('0x2b')](this[_0x301d('0xb')][_0x5ca281['transfertargetchannel']])){this[_0x301d('0xb')][_0x5ca281[_0x301d('0x6b')]]['recalculate']=!![];}}catch(_0xaf8c31){logger[_0x301d('0x3e')](_0xaf8c31[_0x301d('0x3f')]);}};VoiceAgentReport[_0x301d('0x1d')][_0x301d('0x6c')]=function(_0x29f286){try{var _0x37a32c=this[_0x301d('0xb')][_0x29f286[_0x301d('0x6d')]];if(!_[_0x301d('0x2b')](_0x37a32c)){_0x37a32c=_['assign'](_0x37a32c,{'transfer':!![],'transferAt':moment()[_0x301d('0x1e')](_0x301d('0x27')),'transfertype':_0x301d('0x6e'),'transferuniqueid':_0x29f286[_0x301d('0x6f')],'transfercontext':_0x29f286[_0x301d('0x35')],'transferextension':_0x29f286['extension'],'agentcomplete':!![],'agentcompleteAt':moment()[_0x301d('0x1e')](_0x301d('0x27')),'reason':'transfer','lastevent':'complete','agentacw':this[_0x301d('0x9')][_0x37a32c[_0x301d('0x2c')]]&&this[_0x301d('0x9')][_0x37a32c[_0x301d('0x2c')]]['acw']?!![]:![],'acwtime':this[_0x301d('0x9')][_0x37a32c['queue']]&&this['voiceQueues'][_0x37a32c[_0x301d('0x2c')]][_0x301d('0x58')]?this[_0x301d('0x9')][_0x37a32c[_0x301d('0x2c')]][_0x301d('0x59')]:0x0});_0x37a32c[_0x301d('0x66')]=!![];this[_0x301d('0x44')](_0x301d('0x6e'),_0x37a32c);}}catch(_0x5c07d6){logger[_0x301d('0x3e')](_0x5c07d6[_0x301d('0x3f')]);}};VoiceAgentReport[_0x301d('0x1d')][_0x301d('0x16')]=function(_0x4d6d97){var _0x113b20=['rtpaudioqos',_0x301d('0x70'),_0x301d('0x71'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x301d('0x72'),'rtpaudioqosrtt',_0x301d('0x73'),_0x301d('0x74'),_0x301d('0x75'),_0x301d('0x76'),_0x301d('0x77'),_0x301d('0x78'),_0x301d('0x79'),_0x301d('0x7a'),'memberlastcall',_0x301d('0x20'),'memberpenalty',_0x301d('0x7b')];try{var _0x53f759=_[_0x301d('0x7c')](_0x4d6d97['variable'])[0x0];if(!_[_0x301d('0x2b')](_0x53f759)&&!_['includes'](_0x113b20,_0x53f759)){if(!this[_0x301d('0xc')][_0x4d6d97[_0x301d('0x47')]]){this[_0x301d('0xc')][_0x4d6d97[_0x301d('0x47')]]={};}this[_0x301d('0xc')][_0x4d6d97[_0x301d('0x47')]][_0x53f759]=_0x4d6d97[_0x301d('0x7d')];}}catch(_0x4b1e72){logger[_0x301d('0x3e')](_0x4b1e72[_0x301d('0x3f')]);}};module[_0x301d('0x7e')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 77e0293..9114363 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 _0x6c3e=['syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','then','actionCoreShowChannels','log','prototype','isNotNull','isUndefined','emit','uniqueid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','linkedid','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','from-sip','split','destconnectedlinenum','user:%s','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','exten','application','appdata','toLowerCase','starttime','duration','seconds','lastapplication','lastdata','applicationdata','startsWith','cdr(','channelstate','answered','holdtime','diff','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','calleridname','UserId','membername','name','[syncNewState][VoiceCallReport]','monitor','endsWith','.wav49','replace','.WAV','find','monitors','isNil','variable','mixmonitor_filename','syncMixMonitorFilename','xmd-callerid','callerid','value','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','context','user:agentcomplete','custom:voiceCallReport','transfereeuniqueid','transfercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','origtransferercalleridnum','transfertargetuniqueid','transferconnectedlinenum','transfereecalleridnum','extension','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','answertime','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','syncMusicOnHoldStop','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','util','path','../../../config/logger','ami','../ami','unknown','busy','invalid','onhold','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel'];(function(_0x3c8499,_0x1e052e){var _0x51d346=function(_0x311729){while(--_0x311729){_0x3c8499['push'](_0x3c8499['shift']());}};_0x51d346(++_0x1e052e);}(_0x6c3e,0x10d));var _0xe6c3=function(_0x4cfdf7,_0x3fab87){_0x4cfdf7=_0x4cfdf7-0x0;var _0x299026=_0x6c3e[_0x4cfdf7];return _0x299026;};'use strict';var BPromise=require(_0xe6c3('0x0'));var _=require('lodash');var moment=require('moment');var util=require(_0xe6c3('0x1'));var path=require(_0xe6c3('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xe6c3('0x3'))(_0xe6c3('0x4'));var ami=require(_0xe6c3('0x5'));var Channel=require('../model/channel');var statusDesc=[_0xe6c3('0x6'),'not_inuse','inuse',_0xe6c3('0x7'),_0xe6c3('0x8'),'unavailable','ringing','ringinuse',_0xe6c3('0x9')];var applications=[_0xe6c3('0xa'),_0xe6c3('0xb'),'agi',_0xe6c3('0xc'),_0xe6c3('0xd'),_0xe6c3('0xe')];var dispositions=[_0xe6c3('0xf'),_0xe6c3('0x10'),_0xe6c3('0x10'),_0xe6c3('0xf'),'NO\x20ANSWER',_0xe6c3('0xf'),'ANSWERED',_0xe6c3('0x11'),_0xe6c3('0x10'),'FAILED',_0xe6c3('0x10')];var actions={};config[_0xe6c3('0x12')]=_[_0xe6c3('0x13')](config[_0xe6c3('0x12')],{'host':_0xe6c3('0x14'),'port':0x18eb});var io=require(_0xe6c3('0x15'))(new Redis(config[_0xe6c3('0x12')]));function VoiceCallReport(_0x57d5fc){this[_0xe6c3('0x16')]=_0x57d5fc[_0xe6c3('0x16')];this[_0xe6c3('0x17')]=_0x57d5fc[_0xe6c3('0x17')];ami['on'](_0xe6c3('0x18'),this[_0xe6c3('0x19')][_0xe6c3('0x1a')](this));ami['on'](_0xe6c3('0x1b'),this[_0xe6c3('0x19')][_0xe6c3('0x1a')](this));ami['on'](_0xe6c3('0x1c'),this[_0xe6c3('0x1d')][_0xe6c3('0x1a')](this));ami['on']('newstate',this[_0xe6c3('0x1e')][_0xe6c3('0x1a')](this));ami['on'](_0xe6c3('0x1f'),this[_0xe6c3('0x20')]['bind'](this));ami['on'](_0xe6c3('0x21'),this[_0xe6c3('0x22')][_0xe6c3('0x1a')](this));ami['on'](_0xe6c3('0x23'),this[_0xe6c3('0x24')][_0xe6c3('0x1a')](this));ami['on']('attendedtransfer',this[_0xe6c3('0x25')][_0xe6c3('0x1a')](this));ami['on']('blindtransfer',this[_0xe6c3('0x26')][_0xe6c3('0x1a')](this));ami['on'](_0xe6c3('0x27'),this[_0xe6c3('0x28')][_0xe6c3('0x1a')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xe6c3('0x1a')](this));return BPromise['resolve']()[_0xe6c3('0x29')](ami[_0xe6c3('0x2a')]())['catch'](function(_0x4a461c){console[_0xe6c3('0x2b')](_0x4a461c);});}VoiceCallReport[_0xe6c3('0x2c')][_0xe6c3('0x2d')]=function(_0x23bb7d){return _0x23bb7d!==null&&!_[_0xe6c3('0x2e')](_0x23bb7d);};VoiceCallReport['prototype']['emit']=function(_0x55aacd,_0x28d6ea,_0x18ba08){io['to'](_0x55aacd)[_0xe6c3('0x2f')](_0x28d6ea,_0x18ba08);};VoiceCallReport[_0xe6c3('0x2c')][_0xe6c3('0x24')]=function(_0x2e3db2){try{if(this[_0xe6c3('0x2d')](_0x2e3db2)){if(_0x2e3db2[_0xe6c3('0x30')]===_0x2e3db2['linkedid']){if(!_[_0xe6c3('0x2e')](this[_0xe6c3('0x16')][_0x2e3db2['uniqueid']])){_[_0xe6c3('0x31')](this['channels'][_0x2e3db2['uniqueid']],_[_0xe6c3('0x32')](_0x2e3db2,_[_0xe6c3('0x33')](this[_0xe6c3('0x16')][_0x2e3db2[_0xe6c3('0x30')]])));}}}}catch(_0x34cb75){logger[_0xe6c3('0x34')](_0xe6c3('0x35'),util[_0xe6c3('0x36')](_0x34cb75,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe6c3('0x1d')]=function(_0x3d20eb){try{if(this[_0xe6c3('0x2d')](_0x3d20eb)){if(_0x3d20eb[_0xe6c3('0x30')]===_0x3d20eb[_0xe6c3('0x37')]&&_0x3d20eb[_0xe6c3('0x38')]!=_0xe6c3('0x39')){if(_[_0xe6c3('0x2e')](this[_0xe6c3('0x16')][_0x3d20eb[_0xe6c3('0x30')]])){this['channels'][_0x3d20eb['uniqueid']]=new Channel();this['channels'][_0x3d20eb[_0xe6c3('0x30')]]['starttime']=moment()[_0xe6c3('0x3a')](_0xe6c3('0x3b'));this[_0xe6c3('0x16')][_0x3d20eb[_0xe6c3('0x30')]][_0xe6c3('0x3c')]=dispositions[_[_0xe6c3('0x3d')](_0x3d20eb['channelstate'])];_[_0xe6c3('0x31')](this[_0xe6c3('0x16')][_0x3d20eb['uniqueid']],_['pick'](_0x3d20eb,_[_0xe6c3('0x33')](this[_0xe6c3('0x16')][_0x3d20eb[_0xe6c3('0x30')]])));if(_0x3d20eb['context']===_0xe6c3('0x3e')){if(this[_0xe6c3('0x17')][_0x3d20eb[_0xe6c3('0x38')]['split']('-')[0x0]]){this[_0xe6c3('0x17')][_0x3d20eb[_0xe6c3('0x38')][_0xe6c3('0x3f')]('-')[0x0]][_0xe6c3('0x40')]=_0x3d20eb['exten'];this['emit'](util[_0xe6c3('0x3a')](_0xe6c3('0x41'),this['agents'][_0x3d20eb['channel'][_0xe6c3('0x3f')]('-')[0x0]]['name']),_0xe6c3('0x42'),{'destaccountcode':this[_0xe6c3('0x17')][_0x3d20eb[_0xe6c3('0x38')][_0xe6c3('0x3f')]('-')[0x0]][_0xe6c3('0x43')],'destconnectedlinenum':_0x3d20eb['exten']});}}}}}}catch(_0x4dc5a6){logger['error'](_0xe6c3('0x44'),util['inspect'](_0x4dc5a6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe6c3('0x2c')][_0xe6c3('0x19')]=function(_0x281757){try{if(this[_0xe6c3('0x2d')](_0x281757)){if(_0x281757[_0xe6c3('0x30')]===_0x281757[_0xe6c3('0x37')]&&_0x281757[_0xe6c3('0x45')]!='h'&&_0x281757['channel']!=_0xe6c3('0x39')){_0x281757[_0xe6c3('0x46')]=_0x281757[_0xe6c3('0x46')]['toLowerCase']();_0x281757['applicationdata']=(_0x281757[_0xe6c3('0x47')]||_0x281757['applicationdata'])[_0xe6c3('0x48')]();if(_['isUndefined'](this[_0xe6c3('0x16')][_0x281757[_0xe6c3('0x30')]])){this['channels'][_0x281757['uniqueid']]=new Channel();this[_0xe6c3('0x16')][_0x281757[_0xe6c3('0x30')]][_0xe6c3('0x49')]=_0x281757[_0xe6c3('0x4a')]?moment()['subtract'](moment['duration'](_0x281757[_0xe6c3('0x4a')])['seconds'](),_0xe6c3('0x4b'))[_0xe6c3('0x3a')](_0xe6c3('0x3b')):moment()[_0xe6c3('0x3a')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x281757['uniqueid']][_0xe6c3('0x3c')]='NO\x20ANSWER';}_[_0xe6c3('0x31')](this[_0xe6c3('0x16')][_0x281757[_0xe6c3('0x30')]],_[_0xe6c3('0x32')](_0x281757,_[_0xe6c3('0x33')](this[_0xe6c3('0x16')][_0x281757[_0xe6c3('0x30')]])));if(_['includes'](applications,_0x281757['application'])){this['channels'][_0x281757[_0xe6c3('0x30')]][_0xe6c3('0x4c')]=_0x281757[_0xe6c3('0x46')];this[_0xe6c3('0x16')][_0x281757[_0xe6c3('0x30')]][_0xe6c3('0x4d')]=_0x281757[_0xe6c3('0x4e')];if(_0x281757[_0xe6c3('0x46')]===_0xe6c3('0xa')&&_[_0xe6c3('0x4f')](_0x281757[_0xe6c3('0x4e')],_0xe6c3('0x50'))){var _0x274190=_0x281757[_0xe6c3('0x4e')]['split']('=');var _0x1045bc=_0x274190[0x0]['match'](/cdr\((.*)\)/);if(_0x1045bc){this[_0xe6c3('0x16')][_0x281757[_0xe6c3('0x30')]][_0x1045bc[0x1]]=_0x274190[0x1];}}else if(_0x281757[_0xe6c3('0x46')]===_0xe6c3('0xb')){this[_0xe6c3('0x16')][_0x281757[_0xe6c3('0x30')]]['queue']=_0x281757[_0xe6c3('0x4e')][_0xe6c3('0x3f')](',')[0x0];}}}}}catch(_0x4d786f){logger['error']('[syncNewExten][VoiceCallReport]',util[_0xe6c3('0x36')](_0x4d786f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe6c3('0x1e')]=function(_0xd53723){try{if(this[_0xe6c3('0x2d')](_0xd53723)){if(_0xd53723['uniqueid']!==_0xd53723[_0xe6c3('0x37')]){if(this[_0xe6c3('0x16')][_0xd53723[_0xe6c3('0x37')]]){if(_0xd53723[_0xe6c3('0x51')]==='6'){if(!this['channels'][_0xd53723[_0xe6c3('0x37')]][_0xe6c3('0x52')]){var _0xfe48a0=moment();this['channels'][_0xd53723[_0xe6c3('0x37')]]['answered']=!![];this[_0xe6c3('0x16')][_0xd53723[_0xe6c3('0x37')]]['answertime']=_0xfe48a0[_0xe6c3('0x3a')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0xd53723[_0xe6c3('0x37')]]['starttime']){this['channels'][_0xd53723[_0xe6c3('0x37')]][_0xe6c3('0x53')]=_0xfe48a0[_0xe6c3('0x54')](this[_0xe6c3('0x16')][_0xd53723[_0xe6c3('0x37')]][_0xe6c3('0x49')],_0xe6c3('0x4b'));}}this['channels'][_0xd53723['linkedid']]['linkedid']=_0xd53723[_0xe6c3('0x30')];if(_0xd53723['calleridnum']!==_0xe6c3('0x55')){this[_0xe6c3('0x16')][_0xd53723[_0xe6c3('0x37')]][_0xe6c3('0x56')]=_0xd53723[_0xe6c3('0x57')];}this[_0xe6c3('0x16')][_0xd53723[_0xe6c3('0x37')]][_0xe6c3('0x58')]=_0xd53723[_0xe6c3('0x59')];this['channels'][_0xd53723[_0xe6c3('0x37')]]['destinationchannel']=_0xd53723[_0xe6c3('0x38')];this[_0xe6c3('0x16')][_0xd53723[_0xe6c3('0x37')]][_0xe6c3('0x3c')]=dispositions[_[_0xe6c3('0x3d')](_0xd53723[_0xe6c3('0x51')])];if(this[_0xe6c3('0x17')][_0xd53723[_0xe6c3('0x38')]['split']('-')[0x0]]){this[_0xe6c3('0x16')][_0xd53723[_0xe6c3('0x37')]][_0xe6c3('0x5a')]=this['agents'][_0xd53723[_0xe6c3('0x38')][_0xe6c3('0x3f')]('-')[0x0]]['id'];this[_0xe6c3('0x16')][_0xd53723[_0xe6c3('0x37')]][_0xe6c3('0x5b')]=this[_0xe6c3('0x17')][_0xd53723[_0xe6c3('0x38')][_0xe6c3('0x3f')]('-')[0x0]][_0xe6c3('0x5c')];}}}}else{if(this[_0xe6c3('0x16')][_0xd53723[_0xe6c3('0x30')]]){if(_0xd53723[_0xe6c3('0x51')]==='6'){if(this[_0xe6c3('0x17')][_0xd53723[_0xe6c3('0x38')][_0xe6c3('0x3f')]('-')[0x0]]){this[_0xe6c3('0x16')][_0xd53723[_0xe6c3('0x30')]][_0xe6c3('0x5a')]=this[_0xe6c3('0x17')][_0xd53723[_0xe6c3('0x38')]['split']('-')[0x0]]['id'];this[_0xe6c3('0x16')][_0xd53723[_0xe6c3('0x30')]][_0xe6c3('0x5b')]=this[_0xe6c3('0x17')][_0xd53723[_0xe6c3('0x38')]['split']('-')[0x0]]['name'];}}}}}}catch(_0x2af0b9){logger[_0xe6c3('0x34')](_0xe6c3('0x5d'),util[_0xe6c3('0x36')](_0x2af0b9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe6c3('0x2c')]['syncMixMonitorFilename']=function(_0x2ecece,_0x18af94){if(this[_0xe6c3('0x16')][_0x2ecece]){this[_0xe6c3('0x16')][_0x2ecece][_0xe6c3('0x5e')]=!![];if(_[_0xe6c3('0x5f')](_0x18af94,_0xe6c3('0x60'))){_0x18af94=_0x18af94[_0xe6c3('0x61')](_0xe6c3('0x60'),_0xe6c3('0x62'));}this[_0xe6c3('0x16')][_0x2ecece]['monitorFilename']=_0x18af94;var _0x32fa27=_[_0xe6c3('0x63')](this['channels'][_0x2ecece][_0xe6c3('0x64')],{'filename':_0x18af94});if(_[_0xe6c3('0x65')](_0x32fa27)){this[_0xe6c3('0x16')][_0x2ecece][_0xe6c3('0x64')]['push']({'filename':_0x18af94,'createdAt':moment()[_0xe6c3('0x3a')](_0xe6c3('0x3b')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport['prototype'][_0xe6c3('0x20')]=function(_0x343f20){try{if(this[_0xe6c3('0x2d')](_0x343f20)){if(this['channels'][_0x343f20[_0xe6c3('0x30')]]&&_0x343f20[_0xe6c3('0x38')]!=_0xe6c3('0x39')){if(this[_0xe6c3('0x2d')](_0x343f20[_0xe6c3('0x66')])){if(this[_0xe6c3('0x2d')](_0x343f20['variable'][_0xe6c3('0x67')])){this[_0xe6c3('0x68')](_0x343f20['uniqueid'],_0x343f20['value']);}else if(this[_0xe6c3('0x2d')](_0x343f20[_0xe6c3('0x66')]['xmd-phone'])){this[_0xe6c3('0x16')][_0x343f20[_0xe6c3('0x30')]]['calleridnum']=_0x343f20['value'];}else if(this['isNotNull'](_0x343f20[_0xe6c3('0x66')][_0xe6c3('0x69')])){this['channels'][_0x343f20[_0xe6c3('0x30')]][_0xe6c3('0x6a')]=_0x343f20[_0xe6c3('0x6b')];}else if(this[_0xe6c3('0x2d')](_0x343f20[_0xe6c3('0x66')][_0xe6c3('0x6c')])){this[_0xe6c3('0x16')][_0x343f20[_0xe6c3('0x30')]][_0xe6c3('0x6d')]=_0x343f20[_0xe6c3('0x6b')];}else if(this[_0xe6c3('0x2d')](_0x343f20[_0xe6c3('0x66')][_0xe6c3('0x6e')])){this[_0xe6c3('0x16')][_0x343f20['uniqueid']]['queue']=_0x343f20[_0xe6c3('0x6b')][_0xe6c3('0x3f')](',')[0x0];}else if(this[_0xe6c3('0x2d')](_0x343f20[_0xe6c3('0x66')][_0xe6c3('0x6f')])){this[_0xe6c3('0x16')][_0x343f20['uniqueid']][_0xe6c3('0x70')]=_0x343f20[_0xe6c3('0x6b')];}else if(this[_0xe6c3('0x2d')](_0x343f20['variable'][_0xe6c3('0x71')])){this[_0xe6c3('0x16')][_0x343f20[_0xe6c3('0x30')]][_0xe6c3('0x72')]=_0x343f20[_0xe6c3('0x6b')];}else if(this[_0xe6c3('0x2d')](_0x343f20[_0xe6c3('0x66')][_0xe6c3('0x73')])){this[_0xe6c3('0x16')][_0x343f20[_0xe6c3('0x30')]][_0xe6c3('0x74')]=_0x343f20[_0xe6c3('0x6b')];}else if(this['isNotNull'](_0x343f20['variable'][_0xe6c3('0x75')])){this['channels'][_0x343f20['uniqueid']][_0xe6c3('0xb')]=_0x343f20[_0xe6c3('0x6b')];}else if(this[_0xe6c3('0x2d')](_0x343f20['variable'][_0xe6c3('0x76')])){this[_0xe6c3('0x16')][_0x343f20['uniqueid']][_0xe6c3('0x77')]=_0x343f20[_0xe6c3('0x6b')];}}}else if(this['isNotNull'](_0x343f20[_0xe6c3('0x66')]['mixmonitor_filename'])){if(_0x343f20[_0xe6c3('0x6b')]){var _0x4471a6=path[_0xe6c3('0x78')](_0x343f20[_0xe6c3('0x6b')])[_0xe6c3('0x5c')];this['syncMixMonitorFilename'](_0x4471a6,_0x343f20[_0xe6c3('0x6b')]);}}else if(this['channels'][_0x343f20[_0xe6c3('0x37')]]){if(this['isNotNull'](_0x343f20[_0xe6c3('0x66')])){if(this[_0xe6c3('0x2d')](_0x343f20[_0xe6c3('0x66')][_0xe6c3('0x76')])){this[_0xe6c3('0x16')][_0x343f20[_0xe6c3('0x37')]][_0xe6c3('0x79')]=_0x343f20['value'];}}}}}catch(_0x332a90){logger['error'](_0xe6c3('0x7a'),util[_0xe6c3('0x36')](_0x332a90,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe6c3('0x2c')][_0xe6c3('0x22')]=function(_0x23be08){try{if(this[_0xe6c3('0x2d')](_0x23be08)){if(this[_0xe6c3('0x16')][_0x23be08[_0xe6c3('0x30')]]){var _0x3f15a4=moment();this[_0xe6c3('0x16')][_0x23be08[_0xe6c3('0x30')]][_0xe6c3('0x7b')]=_0x3f15a4[_0xe6c3('0x3a')](_0xe6c3('0x3b'));this[_0xe6c3('0x16')][_0x23be08[_0xe6c3('0x30')]][_0xe6c3('0x4a')]=_0x3f15a4[_0xe6c3('0x54')](this['channels'][_0x23be08[_0xe6c3('0x30')]][_0xe6c3('0x49')],'seconds');if(this[_0xe6c3('0x16')][_0x23be08[_0xe6c3('0x30')]][_0xe6c3('0x52')]){this[_0xe6c3('0x16')][_0x23be08['uniqueid']]['billableseconds']=_0x3f15a4[_0xe6c3('0x54')](this[_0xe6c3('0x16')][_0x23be08['uniqueid']]['answertime'],_0xe6c3('0x4b'));this[_0xe6c3('0x16')][_0x23be08[_0xe6c3('0x30')]][_0xe6c3('0x53')]=this[_0xe6c3('0x16')][_0x23be08[_0xe6c3('0x30')]][_0xe6c3('0x4a')]-this['channels'][_0x23be08[_0xe6c3('0x30')]][_0xe6c3('0x7c')];}if(_0x23be08[_0xe6c3('0x7d')]===_0xe6c3('0x3e')){if(this[_0xe6c3('0x17')][_0x23be08[_0xe6c3('0x38')]['split']('-')[0x0]]){this[_0xe6c3('0x17')][_0x23be08[_0xe6c3('0x38')][_0xe6c3('0x3f')]('-')[0x0]]=_['omit'](this[_0xe6c3('0x17')][_0x23be08[_0xe6c3('0x38')][_0xe6c3('0x3f')]('-')[0x0]],[_0xe6c3('0x40')]);this[_0xe6c3('0x2f')](util[_0xe6c3('0x3a')]('user:%s',this[_0xe6c3('0x17')][_0x23be08[_0xe6c3('0x38')][_0xe6c3('0x3f')]('-')[0x0]]['name']),_0xe6c3('0x7e'),{'destaccountcode':this[_0xe6c3('0x17')][_0x23be08[_0xe6c3('0x38')][_0xe6c3('0x3f')]('-')[0x0]][_0xe6c3('0x43')]});}}ami[_0xe6c3('0x2f')](_0xe6c3('0x7f'),this[_0xe6c3('0x16')][_0x23be08[_0xe6c3('0x30')]]);delete this[_0xe6c3('0x16')][_0x23be08[_0xe6c3('0x30')]];}}}catch(_0x5c4a7d){logger[_0xe6c3('0x34')]('[syncHangup][VoiceCallReport]',util[_0xe6c3('0x36')](_0x5c4a7d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe6c3('0x2c')][_0xe6c3('0x25')]=function(_0x21ea9f){try{if(this[_0xe6c3('0x2d')](_0x21ea9f)){if(this[_0xe6c3('0x16')][_0x21ea9f[_0xe6c3('0x80')]]){this['channels'][_0x21ea9f[_0xe6c3('0x80')]][_0xe6c3('0x81')]=_0x21ea9f['origtransferercalleridnum'];this['channels'][_0x21ea9f[_0xe6c3('0x80')]]['transferconnectedlinenum']=_0x21ea9f[_0xe6c3('0x82')];if(this[_0xe6c3('0x16')][_0x21ea9f[_0xe6c3('0x83')]]){var _0x28a348=this[_0xe6c3('0x16')][_0x21ea9f[_0xe6c3('0x83')]];this[_0xe6c3('0x16')][_0x21ea9f[_0xe6c3('0x83')]]=this[_0xe6c3('0x16')][_0x21ea9f[_0xe6c3('0x80')]];this[_0xe6c3('0x16')][_0x21ea9f[_0xe6c3('0x80')]]=_0x28a348;}}else if(this[_0xe6c3('0x16')][_0x21ea9f['transfertargetuniqueid']]){this[_0xe6c3('0x16')][_0x21ea9f['transfertargetuniqueid']][_0xe6c3('0x81')]=_0x21ea9f[_0xe6c3('0x84')];this[_0xe6c3('0x16')][_0x21ea9f[_0xe6c3('0x85')]][_0xe6c3('0x86')]=_0x21ea9f[_0xe6c3('0x82')];if(this[_0xe6c3('0x16')][_0x21ea9f['origtransfereruniqueid']]){var _0x28a348=this[_0xe6c3('0x16')][_0x21ea9f['origtransfereruniqueid']];this[_0xe6c3('0x16')][_0x21ea9f['origtransfereruniqueid']]=this[_0xe6c3('0x16')][_0x21ea9f['transfertargetuniqueid']];this[_0xe6c3('0x16')][_0x21ea9f[_0xe6c3('0x85')]]=_0x28a348;}}}}catch(_0x8e80f7){logger[_0xe6c3('0x34')]('[syncAttendedTransfer][VoiceCallReport]',util['inspect'](_0x8e80f7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe6c3('0x2c')][_0xe6c3('0x26')]=function(_0x41ba88){try{if(this[_0xe6c3('0x2d')](_0x41ba88)){if(this[_0xe6c3('0x16')][_0x41ba88[_0xe6c3('0x80')]]){this['channels'][_0x41ba88[_0xe6c3('0x80')]][_0xe6c3('0x81')]=_0x41ba88[_0xe6c3('0x87')];this[_0xe6c3('0x16')][_0x41ba88[_0xe6c3('0x80')]][_0xe6c3('0x86')]=_0x41ba88[_0xe6c3('0x88')];this[_0xe6c3('0x22')]({'event':_0xe6c3('0x89'),'uniqueid':_0x41ba88[_0xe6c3('0x80')],'context':_0x41ba88[_0xe6c3('0x7d')],'channel':_0x41ba88['transfererchannel']});}}}catch(_0x550b05){logger['error'](_0xe6c3('0x8a'),util[_0xe6c3('0x36')](_0x550b05,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe6c3('0x2c')][_0xe6c3('0x28')]=function(_0x54a43e){try{if(this['isNotNull'](_0x54a43e)){if(this['channels'][_0x54a43e[_0xe6c3('0x30')]]){if(!_['isNil'](this[_0xe6c3('0x16')][_0x54a43e[_0xe6c3('0x30')]][_0xe6c3('0x8b')])){this['channels'][_0x54a43e[_0xe6c3('0x30')]][_0xe6c3('0x8c')]=moment()[_0xe6c3('0x3a')](_0xe6c3('0x3b'));}}}}catch(_0x23cba6){logger[_0xe6c3('0x34')](_0xe6c3('0x8d'),util[_0xe6c3('0x36')](_0x23cba6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe6c3('0x8e')]=function(_0x34e995){try{if(this[_0xe6c3('0x2d')](_0x34e995)){if(this[_0xe6c3('0x16')][_0x34e995[_0xe6c3('0x30')]]){if(!_[_0xe6c3('0x65')](this['channels'][_0x34e995[_0xe6c3('0x30')]]['mohstarttime'])){this[_0xe6c3('0x16')][_0x34e995[_0xe6c3('0x30')]][_0xe6c3('0x8f')]+=moment()[_0xe6c3('0x90')](0x0)['diff'](this['channels'][_0x34e995[_0xe6c3('0x30')]][_0xe6c3('0x8c')],_0xe6c3('0x4b'));delete this[_0xe6c3('0x16')][_0x34e995[_0xe6c3('0x30')]][_0xe6c3('0x8c')];}}}}catch(_0x328a05){logger[_0xe6c3('0x34')](_0xe6c3('0x91'),util[_0xe6c3('0x36')](_0x328a05,{'showHidden':![],'depth':null}));}};module[_0xe6c3('0x92')]=VoiceCallReport; \ No newline at end of file +var _0xe90f=['xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','xmd-callerid-preview','calleridpreview','sipcalluniqueid','parse','[syncVarSet][VoiceCallReport]','diff','billableseconds','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','transfertargetuniqueid','transfercalleridnum','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','uniqueid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','syncNewChannel','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','context','from-sip','split','exten','user:%s','accountcode','[syncNewChannel][VoiceCallReport]','linkedid','application','toLowerCase','applicationdata','appdata','starttime','duration','subtract','seconds','disposition','lastapplication','lastdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','channelstate','answered','answertime','holdtime','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','calleridname','destinationchannel','UserId','membername','name','[syncNewState][VoiceCallReport]','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','variable','mixmonitor_filename','syncMixMonitorFilename','value','xmd-phone'];(function(_0x20bc93,_0xab41ce){var _0x1f0213=function(_0x40f825){while(--_0x40f825){_0x20bc93['push'](_0x20bc93['shift']());}};_0x1f0213(++_0xab41ce);}(_0xe90f,0xb8));var _0xfe90=function(_0x5b7f48,_0x4d8a1d){_0x5b7f48=_0x5b7f48-0x0;var _0x2424b0=_0xe90f[_0x5b7f48];return _0x2424b0;};'use strict';var BPromise=require(_0xfe90('0x0'));var _=require(_0xfe90('0x1'));var moment=require(_0xfe90('0x2'));var util=require(_0xfe90('0x3'));var path=require('path');var Redis=require('ioredis');var config=require(_0xfe90('0x4'));var logger=require(_0xfe90('0x5'))('ami');var ami=require(_0xfe90('0x6'));var Channel=require(_0xfe90('0x7'));var statusDesc=[_0xfe90('0x8'),_0xfe90('0x9'),_0xfe90('0xa'),_0xfe90('0xb'),_0xfe90('0xc'),_0xfe90('0xd'),_0xfe90('0xe'),_0xfe90('0xf'),_0xfe90('0x10')];var applications=[_0xfe90('0x11'),_0xfe90('0x12'),_0xfe90('0x13'),_0xfe90('0x14'),'playback','voicemail'];var dispositions=[_0xfe90('0x15'),_0xfe90('0x16'),_0xfe90('0x16'),'NO\x20ANSWER','NO\x20ANSWER',_0xfe90('0x15'),_0xfe90('0x17'),'BUSY','FAILED',_0xfe90('0x16'),'FAILED'];var actions={};config[_0xfe90('0x18')]=_[_0xfe90('0x19')](config[_0xfe90('0x18')],{'host':'localhost','port':0x18eb});var io=require(_0xfe90('0x1a'))(new Redis(config[_0xfe90('0x18')]));function VoiceCallReport(_0x2f2915){this[_0xfe90('0x1b')]=_0x2f2915['channels'];this[_0xfe90('0x1c')]=_0x2f2915[_0xfe90('0x1c')];ami['on'](_0xfe90('0x1d'),this[_0xfe90('0x1e')][_0xfe90('0x1f')](this));ami['on']('newexten',this[_0xfe90('0x1e')]['bind'](this));ami['on']('newchannel',this['syncNewChannel'][_0xfe90('0x1f')](this));ami['on'](_0xfe90('0x20'),this[_0xfe90('0x21')][_0xfe90('0x1f')](this));ami['on'](_0xfe90('0x22'),this[_0xfe90('0x23')][_0xfe90('0x1f')](this));ami['on'](_0xfe90('0x24'),this[_0xfe90('0x25')][_0xfe90('0x1f')](this));ami['on'](_0xfe90('0x26'),this[_0xfe90('0x27')][_0xfe90('0x1f')](this));ami['on'](_0xfe90('0x28'),this[_0xfe90('0x29')][_0xfe90('0x1f')](this));ami['on']('blindtransfer',this[_0xfe90('0x2a')][_0xfe90('0x1f')](this));ami['on'](_0xfe90('0x2b'),this[_0xfe90('0x2c')]['bind'](this));ami['on'](_0xfe90('0x2d'),this[_0xfe90('0x2e')][_0xfe90('0x1f')](this));return BPromise['resolve']()[_0xfe90('0x2f')](ami[_0xfe90('0x30')]())[_0xfe90('0x31')](function(_0xd8ffe8){console[_0xfe90('0x32')](_0xd8ffe8);});}VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x34')]=function(_0x2ff0d1){return _0x2ff0d1!==null&&!_[_0xfe90('0x35')](_0x2ff0d1);};VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x36')]=function(_0x184f58,_0x29b1cb,_0x590d0a){io['to'](_0x184f58)[_0xfe90('0x36')](_0x29b1cb,_0x590d0a);};VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x27')]=function(_0x1392ec){try{if(this['isNotNull'](_0x1392ec)){if(_0x1392ec[_0xfe90('0x37')]===_0x1392ec['linkedid']){if(!_['isUndefined'](this[_0xfe90('0x1b')][_0x1392ec['uniqueid']])){_[_0xfe90('0x38')](this[_0xfe90('0x1b')][_0x1392ec[_0xfe90('0x37')]],_[_0xfe90('0x39')](_0x1392ec,_[_0xfe90('0x3a')](this[_0xfe90('0x1b')][_0x1392ec[_0xfe90('0x37')]])));}}}}catch(_0x2d9bf9){logger[_0xfe90('0x3b')](_0xfe90('0x3c'),util[_0xfe90('0x3d')](_0x2d9bf9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x3e')]=function(_0x23dd59){try{if(this['isNotNull'](_0x23dd59)){if(_0x23dd59[_0xfe90('0x37')]===_0x23dd59['linkedid']&&_0x23dd59[_0xfe90('0x3f')]!=_0xfe90('0x40')){if(_['isUndefined'](this['channels'][_0x23dd59[_0xfe90('0x37')]])){this[_0xfe90('0x1b')][_0x23dd59['uniqueid']]=new Channel();this[_0xfe90('0x1b')][_0x23dd59[_0xfe90('0x37')]]['starttime']=moment()[_0xfe90('0x41')](_0xfe90('0x42'));this[_0xfe90('0x1b')][_0x23dd59[_0xfe90('0x37')]]['disposition']=dispositions[_[_0xfe90('0x43')](_0x23dd59['channelstate'])];_[_0xfe90('0x38')](this[_0xfe90('0x1b')][_0x23dd59[_0xfe90('0x37')]],_[_0xfe90('0x39')](_0x23dd59,_[_0xfe90('0x3a')](this[_0xfe90('0x1b')][_0x23dd59[_0xfe90('0x37')]])));if(_0x23dd59[_0xfe90('0x44')]===_0xfe90('0x45')){if(this[_0xfe90('0x1c')][_0x23dd59[_0xfe90('0x3f')][_0xfe90('0x46')]('-')[0x0]]){this[_0xfe90('0x1c')][_0x23dd59[_0xfe90('0x3f')][_0xfe90('0x46')]('-')[0x0]]['destconnectedlinenum']=_0x23dd59[_0xfe90('0x47')];this['emit'](util[_0xfe90('0x41')](_0xfe90('0x48'),this[_0xfe90('0x1c')][_0x23dd59[_0xfe90('0x3f')][_0xfe90('0x46')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0xfe90('0x1c')][_0x23dd59[_0xfe90('0x3f')][_0xfe90('0x46')]('-')[0x0]][_0xfe90('0x49')],'destconnectedlinenum':_0x23dd59[_0xfe90('0x47')]});}}}}}}catch(_0x36f49f){logger[_0xfe90('0x3b')](_0xfe90('0x4a'),util[_0xfe90('0x3d')](_0x36f49f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x1e')]=function(_0x46cdf1){try{if(this[_0xfe90('0x34')](_0x46cdf1)){if(_0x46cdf1[_0xfe90('0x37')]===_0x46cdf1[_0xfe90('0x4b')]&&_0x46cdf1[_0xfe90('0x47')]!='h'&&_0x46cdf1[_0xfe90('0x3f')]!='OutgoingSpoolFailed'){_0x46cdf1[_0xfe90('0x4c')]=_0x46cdf1[_0xfe90('0x4c')][_0xfe90('0x4d')]();_0x46cdf1[_0xfe90('0x4e')]=(_0x46cdf1[_0xfe90('0x4f')]||_0x46cdf1['applicationdata'])[_0xfe90('0x4d')]();if(_[_0xfe90('0x35')](this[_0xfe90('0x1b')][_0x46cdf1[_0xfe90('0x37')]])){this[_0xfe90('0x1b')][_0x46cdf1['uniqueid']]=new Channel();this[_0xfe90('0x1b')][_0x46cdf1[_0xfe90('0x37')]][_0xfe90('0x50')]=_0x46cdf1[_0xfe90('0x51')]?moment()[_0xfe90('0x52')](moment['duration'](_0x46cdf1[_0xfe90('0x51')])['seconds'](),_0xfe90('0x53'))[_0xfe90('0x41')](_0xfe90('0x42')):moment()[_0xfe90('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfe90('0x1b')][_0x46cdf1[_0xfe90('0x37')]][_0xfe90('0x54')]=_0xfe90('0x15');}_[_0xfe90('0x38')](this[_0xfe90('0x1b')][_0x46cdf1[_0xfe90('0x37')]],_[_0xfe90('0x39')](_0x46cdf1,_['keys'](this['channels'][_0x46cdf1[_0xfe90('0x37')]])));if(_['includes'](applications,_0x46cdf1['application'])){this[_0xfe90('0x1b')][_0x46cdf1[_0xfe90('0x37')]][_0xfe90('0x55')]=_0x46cdf1['application'];this[_0xfe90('0x1b')][_0x46cdf1[_0xfe90('0x37')]][_0xfe90('0x56')]=_0x46cdf1['applicationdata'];if(_0x46cdf1[_0xfe90('0x4c')]==='set'&&_[_0xfe90('0x57')](_0x46cdf1[_0xfe90('0x4e')],_0xfe90('0x58'))){var _0x149cfa=_0x46cdf1[_0xfe90('0x4e')]['split']('=');var _0x51e0b0=_0x149cfa[0x0][_0xfe90('0x59')](/cdr\((.*)\)/);if(_0x51e0b0){this[_0xfe90('0x1b')][_0x46cdf1[_0xfe90('0x37')]][_0x51e0b0[0x1]]=_0x149cfa[0x1];}}else if(_0x46cdf1['application']===_0xfe90('0x12')){this[_0xfe90('0x1b')][_0x46cdf1[_0xfe90('0x37')]][_0xfe90('0x12')]=_0x46cdf1[_0xfe90('0x4e')]['split'](',')[0x0];}}}}}catch(_0x55a7ab){logger['error'](_0xfe90('0x5a'),util[_0xfe90('0x3d')](_0x55a7ab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x21')]=function(_0x170457){try{if(this['isNotNull'](_0x170457)){if(_0x170457[_0xfe90('0x37')]!==_0x170457['linkedid']){if(this[_0xfe90('0x1b')][_0x170457[_0xfe90('0x4b')]]){if(_0x170457[_0xfe90('0x5b')]==='6'){if(!this['channels'][_0x170457[_0xfe90('0x4b')]][_0xfe90('0x5c')]){var _0x277387=moment();this[_0xfe90('0x1b')][_0x170457[_0xfe90('0x4b')]]['answered']=!![];this[_0xfe90('0x1b')][_0x170457[_0xfe90('0x4b')]][_0xfe90('0x5d')]=_0x277387[_0xfe90('0x41')](_0xfe90('0x42'));if(this['channels'][_0x170457[_0xfe90('0x4b')]][_0xfe90('0x50')]){this[_0xfe90('0x1b')][_0x170457['linkedid']][_0xfe90('0x5e')]=_0x277387['diff'](this[_0xfe90('0x1b')][_0x170457['linkedid']][_0xfe90('0x50')],_0xfe90('0x53'));}}this[_0xfe90('0x1b')][_0x170457[_0xfe90('0x4b')]][_0xfe90('0x4b')]=_0x170457[_0xfe90('0x37')];if(_0x170457['calleridnum']!==_0xfe90('0x5f')){this['channels'][_0x170457[_0xfe90('0x4b')]][_0xfe90('0x60')]=_0x170457[_0xfe90('0x61')];}this[_0xfe90('0x1b')][_0x170457['linkedid']][_0xfe90('0x62')]=_0x170457[_0xfe90('0x63')];this['channels'][_0x170457['linkedid']][_0xfe90('0x64')]=_0x170457[_0xfe90('0x3f')];this[_0xfe90('0x1b')][_0x170457[_0xfe90('0x4b')]]['disposition']=dispositions[_[_0xfe90('0x43')](_0x170457['channelstate'])];if(this[_0xfe90('0x1c')][_0x170457['channel'][_0xfe90('0x46')]('-')[0x0]]){this[_0xfe90('0x1b')][_0x170457[_0xfe90('0x4b')]][_0xfe90('0x65')]=this[_0xfe90('0x1c')][_0x170457[_0xfe90('0x3f')]['split']('-')[0x0]]['id'];this[_0xfe90('0x1b')][_0x170457[_0xfe90('0x4b')]][_0xfe90('0x66')]=this['agents'][_0x170457[_0xfe90('0x3f')][_0xfe90('0x46')]('-')[0x0]][_0xfe90('0x67')];}}}}else{if(this[_0xfe90('0x1b')][_0x170457[_0xfe90('0x37')]]){if(_0x170457['channelstate']==='6'){if(this[_0xfe90('0x1c')][_0x170457[_0xfe90('0x3f')][_0xfe90('0x46')]('-')[0x0]]){this[_0xfe90('0x1b')][_0x170457[_0xfe90('0x37')]][_0xfe90('0x65')]=this[_0xfe90('0x1c')][_0x170457[_0xfe90('0x3f')][_0xfe90('0x46')]('-')[0x0]]['id'];this[_0xfe90('0x1b')][_0x170457['uniqueid']]['membername']=this[_0xfe90('0x1c')][_0x170457['channel']['split']('-')[0x0]][_0xfe90('0x67')];}}}}}}catch(_0xfc6ae8){logger['error'](_0xfe90('0x68'),util[_0xfe90('0x3d')](_0xfc6ae8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfe90('0x33')]['syncMixMonitorFilename']=function(_0x3186f5,_0x5dc424){if(this[_0xfe90('0x1b')][_0x3186f5]){this[_0xfe90('0x1b')][_0x3186f5][_0xfe90('0x69')]=!![];if(_['endsWith'](_0x5dc424,_0xfe90('0x6a'))){_0x5dc424=_0x5dc424[_0xfe90('0x6b')]('.wav49',_0xfe90('0x6c'));}this[_0xfe90('0x1b')][_0x3186f5][_0xfe90('0x6d')]=_0x5dc424;var _0x464bde=_[_0xfe90('0x6e')](this[_0xfe90('0x1b')][_0x3186f5][_0xfe90('0x6f')],{'filename':_0x5dc424});if(_[_0xfe90('0x70')](_0x464bde)){this['channels'][_0x3186f5][_0xfe90('0x6f')][_0xfe90('0x71')]({'filename':_0x5dc424,'createdAt':moment()['format'](_0xfe90('0x42')),'mixmonitorid':'','status':_0xfe90('0x72')});}}};VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x23')]=function(_0x338535){try{if(this[_0xfe90('0x34')](_0x338535)){if(this['channels'][_0x338535[_0xfe90('0x37')]]&&_0x338535[_0xfe90('0x3f')]!=_0xfe90('0x40')){if(this['isNotNull'](_0x338535[_0xfe90('0x73')])){if(this[_0xfe90('0x34')](_0x338535[_0xfe90('0x73')][_0xfe90('0x74')])){this[_0xfe90('0x75')](_0x338535[_0xfe90('0x37')],_0x338535[_0xfe90('0x76')]);}else if(this[_0xfe90('0x34')](_0x338535['variable'][_0xfe90('0x77')])){this[_0xfe90('0x1b')][_0x338535[_0xfe90('0x37')]][_0xfe90('0x61')]=_0x338535[_0xfe90('0x76')];}else if(this['isNotNull'](_0x338535['variable'][_0xfe90('0x78')])){this[_0xfe90('0x1b')][_0x338535[_0xfe90('0x37')]][_0xfe90('0x79')]=_0x338535[_0xfe90('0x76')];}else if(this['isNotNull'](_0x338535[_0xfe90('0x73')][_0xfe90('0x7a')])){this['channels'][_0x338535[_0xfe90('0x37')]][_0xfe90('0x7b')]=_0x338535[_0xfe90('0x76')];}else if(this[_0xfe90('0x34')](_0x338535[_0xfe90('0x73')][_0xfe90('0x7c')])){this[_0xfe90('0x1b')][_0x338535[_0xfe90('0x37')]]['queue']=_0x338535[_0xfe90('0x76')][_0xfe90('0x46')](',')[0x0];}else if(this['isNotNull'](_0x338535[_0xfe90('0x73')][_0xfe90('0x7d')])){this[_0xfe90('0x1b')][_0x338535['uniqueid']][_0xfe90('0x7e')]=_0x338535[_0xfe90('0x76')];}else if(this['isNotNull'](_0x338535[_0xfe90('0x73')][_0xfe90('0x7f')])){this['channels'][_0x338535['uniqueid']]['destination']=_0x338535['value'];}else if(this[_0xfe90('0x34')](_0x338535[_0xfe90('0x73')][_0xfe90('0x80')])){this[_0xfe90('0x1b')][_0x338535[_0xfe90('0x37')]][_0xfe90('0x81')]=_0x338535[_0xfe90('0x76')];}else if(this[_0xfe90('0x34')](_0x338535['variable']['xmcs-queue'])){this[_0xfe90('0x1b')][_0x338535['uniqueid']][_0xfe90('0x12')]=_0x338535[_0xfe90('0x76')];}else if(this[_0xfe90('0x34')](_0x338535[_0xfe90('0x73')]['sipcallid'])){this[_0xfe90('0x1b')][_0x338535[_0xfe90('0x37')]][_0xfe90('0x82')]=_0x338535[_0xfe90('0x76')];}}}else if(this['isNotNull'](_0x338535[_0xfe90('0x73')][_0xfe90('0x74')])){if(_0x338535[_0xfe90('0x76')]){var _0x5ad13b=path[_0xfe90('0x83')](_0x338535[_0xfe90('0x76')])['name'];this['syncMixMonitorFilename'](_0x5ad13b,_0x338535['value']);}}else if(this[_0xfe90('0x1b')][_0x338535[_0xfe90('0x4b')]]){if(this[_0xfe90('0x34')](_0x338535[_0xfe90('0x73')])){if(this[_0xfe90('0x34')](_0x338535[_0xfe90('0x73')]['sipcallid'])){this[_0xfe90('0x1b')][_0x338535[_0xfe90('0x4b')]]['sipcalllinkedid']=_0x338535['value'];}}}}}catch(_0x54718b){logger['error'](_0xfe90('0x84'),util[_0xfe90('0x3d')](_0x54718b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x25')]=function(_0x416d45){try{if(this[_0xfe90('0x34')](_0x416d45)){if(this[_0xfe90('0x1b')][_0x416d45[_0xfe90('0x37')]]){var _0x3130dc=moment();this['channels'][_0x416d45['uniqueid']]['endtime']=_0x3130dc[_0xfe90('0x41')](_0xfe90('0x42'));this['channels'][_0x416d45[_0xfe90('0x37')]][_0xfe90('0x51')]=_0x3130dc[_0xfe90('0x85')](this['channels'][_0x416d45[_0xfe90('0x37')]][_0xfe90('0x50')],'seconds');if(this[_0xfe90('0x1b')][_0x416d45['uniqueid']][_0xfe90('0x5c')]){this['channels'][_0x416d45[_0xfe90('0x37')]][_0xfe90('0x86')]=_0x3130dc[_0xfe90('0x85')](this[_0xfe90('0x1b')][_0x416d45['uniqueid']][_0xfe90('0x5d')],_0xfe90('0x53'));this['channels'][_0x416d45[_0xfe90('0x37')]][_0xfe90('0x5e')]=this[_0xfe90('0x1b')][_0x416d45[_0xfe90('0x37')]][_0xfe90('0x51')]-this[_0xfe90('0x1b')][_0x416d45[_0xfe90('0x37')]][_0xfe90('0x86')];}if(_0x416d45[_0xfe90('0x44')]===_0xfe90('0x45')){if(this[_0xfe90('0x1c')][_0x416d45[_0xfe90('0x3f')]['split']('-')[0x0]]){this[_0xfe90('0x1c')][_0x416d45['channel'][_0xfe90('0x46')]('-')[0x0]]=_['omit'](this['agents'][_0x416d45['channel'][_0xfe90('0x46')]('-')[0x0]],['destconnectedlinenum']);this['emit'](util[_0xfe90('0x41')](_0xfe90('0x48'),this['agents'][_0x416d45[_0xfe90('0x3f')]['split']('-')[0x0]][_0xfe90('0x67')]),_0xfe90('0x87'),{'destaccountcode':this[_0xfe90('0x1c')][_0x416d45[_0xfe90('0x3f')][_0xfe90('0x46')]('-')[0x0]][_0xfe90('0x49')]});}}ami[_0xfe90('0x36')](_0xfe90('0x88'),this[_0xfe90('0x1b')][_0x416d45['uniqueid']]);delete this[_0xfe90('0x1b')][_0x416d45['uniqueid']];}}}catch(_0x3a63b7){logger['error'](_0xfe90('0x89'),util[_0xfe90('0x3d')](_0x3a63b7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x29')]=function(_0xc9189c){try{if(this[_0xfe90('0x34')](_0xc9189c)){if(this[_0xfe90('0x1b')][_0xc9189c[_0xfe90('0x8a')]]){this[_0xfe90('0x1b')][_0xc9189c[_0xfe90('0x8a')]]['transfercalleridnum']=_0xc9189c[_0xfe90('0x8b')];this[_0xfe90('0x1b')][_0xc9189c['transfereeuniqueid']][_0xfe90('0x8c')]=_0xc9189c['transfertargetcalleridnum'];if(this[_0xfe90('0x1b')][_0xc9189c['secondtransfereruniqueid']]){var _0x1e6211=this[_0xfe90('0x1b')][_0xc9189c['secondtransfereruniqueid']];this[_0xfe90('0x1b')][_0xc9189c['secondtransfereruniqueid']]=this['channels'][_0xc9189c['transfereeuniqueid']];this[_0xfe90('0x1b')][_0xc9189c['transfereeuniqueid']]=_0x1e6211;}}else if(this['channels'][_0xc9189c['transfertargetuniqueid']]){this[_0xfe90('0x1b')][_0xc9189c[_0xfe90('0x8d')]][_0xfe90('0x8e')]=_0xc9189c['origtransferercalleridnum'];this['channels'][_0xc9189c[_0xfe90('0x8d')]][_0xfe90('0x8c')]=_0xc9189c[_0xfe90('0x8f')];if(this[_0xfe90('0x1b')][_0xc9189c[_0xfe90('0x90')]]){var _0x1e6211=this[_0xfe90('0x1b')][_0xc9189c[_0xfe90('0x90')]];this[_0xfe90('0x1b')][_0xc9189c[_0xfe90('0x90')]]=this['channels'][_0xc9189c[_0xfe90('0x8d')]];this['channels'][_0xc9189c[_0xfe90('0x8d')]]=_0x1e6211;}}}}catch(_0x3221ed){logger[_0xfe90('0x3b')](_0xfe90('0x91'),util['inspect'](_0x3221ed,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x2a')]=function(_0x2812d0){try{if(this['isNotNull'](_0x2812d0)){if(this[_0xfe90('0x1b')][_0x2812d0[_0xfe90('0x8a')]]){this[_0xfe90('0x1b')][_0x2812d0[_0xfe90('0x8a')]]['transfercalleridnum']=_0x2812d0[_0xfe90('0x92')];this['channels'][_0x2812d0[_0xfe90('0x8a')]][_0xfe90('0x8c')]=_0x2812d0['extension'];this[_0xfe90('0x25')]({'event':'BlindTransfer','uniqueid':_0x2812d0[_0xfe90('0x8a')],'context':_0x2812d0[_0xfe90('0x44')],'channel':_0x2812d0[_0xfe90('0x93')]});}}}catch(_0x3a8a8e){logger['error'](_0xfe90('0x94'),util[_0xfe90('0x3d')](_0x3a8a8e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x2c')]=function(_0x37135c){try{if(this[_0xfe90('0x34')](_0x37135c)){if(this['channels'][_0x37135c[_0xfe90('0x37')]]){if(!_[_0xfe90('0x70')](this[_0xfe90('0x1b')][_0x37135c[_0xfe90('0x37')]]['answertime'])){this[_0xfe90('0x1b')][_0x37135c[_0xfe90('0x37')]][_0xfe90('0x95')]=moment()[_0xfe90('0x41')]('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x14caf7){logger[_0xfe90('0x3b')]('[syncMusicOnHoldStart][VoiceCallReport]',util['inspect'](_0x14caf7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfe90('0x33')][_0xfe90('0x2e')]=function(_0x71ccd4){try{if(this[_0xfe90('0x34')](_0x71ccd4)){if(this[_0xfe90('0x1b')][_0x71ccd4['uniqueid']]){if(!_[_0xfe90('0x70')](this[_0xfe90('0x1b')][_0x71ccd4[_0xfe90('0x37')]]['mohstarttime'])){this[_0xfe90('0x1b')][_0x71ccd4[_0xfe90('0x37')]]['mohtime']+=moment()[_0xfe90('0x96')](0x0)[_0xfe90('0x85')](this[_0xfe90('0x1b')][_0x71ccd4[_0xfe90('0x37')]]['mohstarttime'],_0xfe90('0x53'));delete this[_0xfe90('0x1b')][_0x71ccd4['uniqueid']][_0xfe90('0x95')];}}}}catch(_0x429147){logger[_0xfe90('0x3b')](_0xfe90('0x97'),util[_0xfe90('0x3d')](_0x429147,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index e3ecdd3..b6a081a 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 _0xb6bc=['lastIndexOf','omit','event','privilege','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','answertime','connect','custom:dialconnect','voice:outbound','[syncDialEnd][VoiceDialReport]','syncVarSet','addVariable','keys','value','variable','outboundrouteid','isUndefined','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','membername','memberpenalty','isNil','endtime','YYYY-MM-DD\x20HH:mm:ss','duration','diff','starttime','seconds','total','answered','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','voice_outbound_channel:remove','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','prototype','isNotNull','emit','channels','uniqueid','format','called','channel','substring'];(function(_0x1a0cfa,_0xe59010){var _0x21c704=function(_0x597655){while(--_0x597655){_0x1a0cfa['push'](_0x1a0cfa['shift']());}};_0x21c704(++_0xe59010);}(_0xb6bc,0xe5));var _0xcb6b=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xb6bc[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0xcb6b('0x0'));var moment=require('moment');var util=require(_0xcb6b('0x1'));var Redis=require(_0xcb6b('0x2'));var config=require(_0xcb6b('0x3'));var logger=require(_0xcb6b('0x4'))(_0xcb6b('0x5'));var ami=require(_0xcb6b('0x6'));config['redis']=_['defaults'](config[_0xcb6b('0x7')],{'host':_0xcb6b('0x8'),'port':0x18eb});var io=require(_0xcb6b('0x9'))(new Redis(config[_0xcb6b('0x7')]));function VoiceDialReport(_0x68f767){this['channels']=_0x68f767['outboundChannels'];this['outbound']=_0x68f767[_0xcb6b('0xa')];this[_0xcb6b('0xb')]={};ami['on'](_0xcb6b('0xc'),this[_0xcb6b('0xd')][_0xcb6b('0xe')](this));ami['on'](_0xcb6b('0xf'),this[_0xcb6b('0x10')][_0xcb6b('0xe')](this));ami['on'](_0xcb6b('0x11'),this['syncVarSet']['bind'](this));ami['on'](_0xcb6b('0x12'),this[_0xcb6b('0x13')][_0xcb6b('0xe')](this));}VoiceDialReport[_0xcb6b('0x14')][_0xcb6b('0x15')]=function(_0x234a29){return _0x234a29!==null&&!_['isUndefined'](_0x234a29);};VoiceDialReport['prototype']['emit']=function(_0x3c6e4f,_0x2b9181,_0xf2c9e){io['to'](_0x3c6e4f)[_0xcb6b('0x16')](_0x2b9181,_0xf2c9e);};VoiceDialReport['prototype'][_0xcb6b('0xd')]=function(_0x422129){try{if(this['isNotNull'](_0x422129)){if(this[_0xcb6b('0x17')][_0x422129[_0xcb6b('0x18')]]){_['merge'](this[_0xcb6b('0x17')][_0x422129[_0xcb6b('0x18')]],{'starttime':moment()[_0xcb6b('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xcb6b('0x1a'),'interface':_0x422129[_0xcb6b('0x1b')][_0xcb6b('0x1c')](0x0,_0x422129[_0xcb6b('0x1b')]['lastIndexOf']('-')),'membername':_0x422129['channel']['substring'](_0x422129[_0xcb6b('0x1b')][_0xcb6b('0x1d')]('/')+0x1,_0x422129[_0xcb6b('0x1b')][_0xcb6b('0x1d')]('-'))},_[_0xcb6b('0x1e')](_0x422129,[_0xcb6b('0x1f'),_0xcb6b('0x20')]));this[_0xcb6b('0x16')]('voice:outbound',_0xcb6b('0x21'),this[_0xcb6b('0x17')][_0x422129['uniqueid']]);ami[_0xcb6b('0x16')](_0xcb6b('0x22'),this[_0xcb6b('0x17')][_0x422129[_0xcb6b('0x18')]]);}}}catch(_0x452d1b){logger[_0xcb6b('0x23')](_0xcb6b('0x24'),util[_0xcb6b('0x25')](_0x452d1b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xcb6b('0x10')]=function(_0x2d7d3e){try{if(this['isNotNull'](_0x2d7d3e)){if(this[_0xcb6b('0x17')][_0x2d7d3e[_0xcb6b('0x18')]]){this[_0xcb6b('0x17')][_0x2d7d3e['uniqueid']]['dialstatus']=_0x2d7d3e['dialstatus'];if(_0x2d7d3e[_0xcb6b('0x26')]===_0xcb6b('0x27')){this[_0xcb6b('0x17')][_0x2d7d3e[_0xcb6b('0x18')]][_0xcb6b('0x28')]=_0x2d7d3e[_0xcb6b('0x28')];this['channels'][_0x2d7d3e[_0xcb6b('0x18')]]['connectedlinename']=_0x2d7d3e['connectedlinename'];this[_0xcb6b('0x17')][_0x2d7d3e[_0xcb6b('0x18')]][_0xcb6b('0x29')]=moment()[_0xcb6b('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcb6b('0x17')][_0x2d7d3e[_0xcb6b('0x18')]]['lastevent']=_0xcb6b('0x2a');ami[_0xcb6b('0x16')](_0xcb6b('0x2b'),this['channels'][_0x2d7d3e[_0xcb6b('0x18')]]);}this[_0xcb6b('0x16')](_0xcb6b('0x2c'),'voice_outbound_channel:save',this['channels'][_0x2d7d3e[_0xcb6b('0x18')]]);}}}catch(_0x38a88e){logger[_0xcb6b('0x23')](_0xcb6b('0x2d'),util[_0xcb6b('0x25')](_0x38a88e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcb6b('0x14')][_0xcb6b('0x2e')]=function(_0x18dbdf){try{if(this['isNotNull'](_0x18dbdf)){this[_0xcb6b('0x2f')](_0x18dbdf[_0xcb6b('0x18')],_[_0xcb6b('0x30')](_0x18dbdf['variable'])[0x0],_0x18dbdf[_0xcb6b('0x31')]);if(this[_0xcb6b('0x15')](_0x18dbdf[_0xcb6b('0x32')])&&this['isNotNull'](_0x18dbdf[_0xcb6b('0x32')][_0xcb6b('0x33')])){if(_[_0xcb6b('0x34')](this[_0xcb6b('0x17')][_0x18dbdf[_0xcb6b('0x18')]])){this[_0xcb6b('0x17')][_0x18dbdf['uniqueid']]={'routeId':_0x18dbdf[_0xcb6b('0x31')],'variables':this['variables'][_0x18dbdf[_0xcb6b('0x18')]]};this[_0xcb6b('0x16')](_0xcb6b('0x2c'),_0xcb6b('0x21'),this['channels'][_0x18dbdf[_0xcb6b('0x18')]]);}}}}catch(_0x452164){logger[_0xcb6b('0x23')](_0xcb6b('0x35'),util['inspect'](_0x452164,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xcb6b('0x2f')]=function(_0x4d4269,_0x2711d1,_0x41c181){var _0x56f67e=['rtpaudioqos',_0xcb6b('0x36'),'rtpaudioqosjitter',_0xcb6b('0x37'),_0xcb6b('0x38'),_0xcb6b('0x39'),_0xcb6b('0x3a'),_0xcb6b('0x3b'),_0xcb6b('0x3c'),_0xcb6b('0x3d'),_0xcb6b('0x3e'),_0xcb6b('0x3f'),'membercalls','memberdynamic',_0xcb6b('0x40'),_0xcb6b('0x41'),_0xcb6b('0x42'),_0xcb6b('0x43'),'memberrealtime'];if(!_[_0xcb6b('0x44')](_0x2711d1)&&!_['includes'](_0x56f67e,_0x2711d1)){if(_[_0xcb6b('0x34')](this['variables'][_0x4d4269])){this[_0xcb6b('0xb')][_0x4d4269]={};}this[_0xcb6b('0xb')][_0x4d4269][_0x2711d1]=_0x41c181;}};VoiceDialReport[_0xcb6b('0x14')]['syncHangup']=function(_0x1909cd){try{if(this[_0xcb6b('0x15')](_0x1909cd)){if(this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]]){this['channels'][_0x1909cd[_0xcb6b('0x18')]][_0xcb6b('0x45')]=moment()[_0xcb6b('0x19')](_0xcb6b('0x46'));this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]][_0xcb6b('0x47')]=moment(this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]][_0xcb6b('0x45')])[_0xcb6b('0x48')](this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]][_0xcb6b('0x49')],_0xcb6b('0x4a'));this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]]['lastevent']='complete';this['outbound'][_0xcb6b('0x4b')]+=0x1;if(this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]][_0xcb6b('0x29')]){this[_0xcb6b('0xa')][_0xcb6b('0x4c')]+=0x1;this['channels'][_0x1909cd[_0xcb6b('0x18')]]['holdtime']=moment(this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]][_0xcb6b('0x29')])[_0xcb6b('0x48')](this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]][_0xcb6b('0x49')],_0xcb6b('0x4a'));this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]][_0xcb6b('0x4d')]=moment(this[_0xcb6b('0x17')][_0x1909cd['uniqueid']][_0xcb6b('0x45')])[_0xcb6b('0x48')](this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]]['answertime'],_0xcb6b('0x4a'));this[_0xcb6b('0xa')][_0xcb6b('0x4e')]+=this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]][_0xcb6b('0x4f')]||0x0;this['outbound'][_0xcb6b('0x50')]+=this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]]['billableseconds'];}this[_0xcb6b('0xa')][_0xcb6b('0x51')]+=this['channels'][_0x1909cd[_0xcb6b('0x18')]][_0xcb6b('0x47')];ami[_0xcb6b('0x16')](_0xcb6b('0x52'),this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]]);ami[_0xcb6b('0x16')](_0xcb6b('0x53'),this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]]);this['emit']('voice:outbound',_0xcb6b('0x54'),this[_0xcb6b('0xa')]);this['emit'](_0xcb6b('0x2c'),_0xcb6b('0x55'),this[_0xcb6b('0x17')][_0x1909cd['uniqueid']]);delete this[_0xcb6b('0x17')][_0x1909cd[_0xcb6b('0x18')]];}if(this[_0xcb6b('0xb')][_0x1909cd[_0xcb6b('0x18')]]){delete this['variables'][_0x1909cd[_0xcb6b('0x18')]];}}}catch(_0x3b79f3){logger[_0xcb6b('0x23')]('[syncHangup][VoiceDialReport]',util['inspect'](_0x3b79f3,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xef98=['memberrealtime','isNil','includes','syncHangup','endtime','duration','starttime','complete','diff','seconds','sumHoldTime','holdtime','sumBillable','billableseconds','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','[syncHangup][VoiceDialReport]','exports','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','outbound','variables','syncDialBegin','dialend','bind','varset','syncVarSet','prototype','isNotNull','isUndefined','emit','uniqueid','channels','format','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','memberdynamic','memberinterface','membername','memberpenalty'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0xef98,0x110));var _0x8ef9=function(_0x417acc,_0x23a23f){_0x417acc=_0x417acc-0x0;var _0x4bfbfc=_0xef98[_0x417acc];return _0x4bfbfc;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x8ef9('0x0'));var Redis=require(_0x8ef9('0x1'));var config=require(_0x8ef9('0x2'));var logger=require(_0x8ef9('0x3'))(_0x8ef9('0x4'));var ami=require(_0x8ef9('0x5'));config[_0x8ef9('0x6')]=_['defaults'](config[_0x8ef9('0x6')],{'host':_0x8ef9('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8ef9('0x6')]));function VoiceDialReport(_0x1011d1){this['channels']=_0x1011d1['outboundChannels'];this[_0x8ef9('0x8')]=_0x1011d1['outbound'];this[_0x8ef9('0x9')]={};ami['on']('dialbegin',this[_0x8ef9('0xa')]['bind'](this));ami['on'](_0x8ef9('0xb'),this['syncDialEnd'][_0x8ef9('0xc')](this));ami['on'](_0x8ef9('0xd'),this[_0x8ef9('0xe')][_0x8ef9('0xc')](this));ami['on']('hangup',this['syncHangup'][_0x8ef9('0xc')](this));}VoiceDialReport[_0x8ef9('0xf')][_0x8ef9('0x10')]=function(_0x1e8fa3){return _0x1e8fa3!==null&&!_[_0x8ef9('0x11')](_0x1e8fa3);};VoiceDialReport['prototype'][_0x8ef9('0x12')]=function(_0xfa528,_0x1d13e6,_0x2a2744){io['to'](_0xfa528)[_0x8ef9('0x12')](_0x1d13e6,_0x2a2744);};VoiceDialReport[_0x8ef9('0xf')]['syncDialBegin']=function(_0x3ff701){try{if(this[_0x8ef9('0x10')](_0x3ff701)){if(this['channels'][_0x3ff701[_0x8ef9('0x13')]]){_['merge'](this[_0x8ef9('0x14')][_0x3ff701[_0x8ef9('0x13')]],{'starttime':moment()[_0x8ef9('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x8ef9('0x16'),'interface':_0x3ff701[_0x8ef9('0x17')][_0x8ef9('0x18')](0x0,_0x3ff701['channel'][_0x8ef9('0x19')]('-')),'membername':_0x3ff701['channel'][_0x8ef9('0x18')](_0x3ff701[_0x8ef9('0x17')][_0x8ef9('0x19')]('/')+0x1,_0x3ff701[_0x8ef9('0x17')][_0x8ef9('0x19')]('-'))},_[_0x8ef9('0x1a')](_0x3ff701,[_0x8ef9('0x1b'),_0x8ef9('0x1c')]));this[_0x8ef9('0x12')](_0x8ef9('0x1d'),_0x8ef9('0x1e'),this[_0x8ef9('0x14')][_0x3ff701[_0x8ef9('0x13')]]);ami[_0x8ef9('0x12')](_0x8ef9('0x1f'),this[_0x8ef9('0x14')][_0x3ff701['uniqueid']]);}}}catch(_0x16a9b3){logger[_0x8ef9('0x20')](_0x8ef9('0x21'),util[_0x8ef9('0x22')](_0x16a9b3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8ef9('0xf')][_0x8ef9('0x23')]=function(_0x5f4303){try{if(this['isNotNull'](_0x5f4303)){if(this[_0x8ef9('0x14')][_0x5f4303[_0x8ef9('0x13')]]){this[_0x8ef9('0x14')][_0x5f4303[_0x8ef9('0x13')]][_0x8ef9('0x24')]=_0x5f4303[_0x8ef9('0x24')];if(_0x5f4303[_0x8ef9('0x24')]==='ANSWER'){this[_0x8ef9('0x14')][_0x5f4303[_0x8ef9('0x13')]][_0x8ef9('0x25')]=_0x5f4303[_0x8ef9('0x25')];this['channels'][_0x5f4303[_0x8ef9('0x13')]][_0x8ef9('0x26')]=_0x5f4303['connectedlinename'];this['channels'][_0x5f4303['uniqueid']][_0x8ef9('0x27')]=moment()[_0x8ef9('0x15')](_0x8ef9('0x28'));this[_0x8ef9('0x14')][_0x5f4303['uniqueid']][_0x8ef9('0x29')]=_0x8ef9('0x2a');ami[_0x8ef9('0x12')](_0x8ef9('0x2b'),this[_0x8ef9('0x14')][_0x5f4303['uniqueid']]);}this[_0x8ef9('0x12')]('voice:outbound',_0x8ef9('0x1e'),this['channels'][_0x5f4303[_0x8ef9('0x13')]]);}}}catch(_0x27f7bb){logger[_0x8ef9('0x20')](_0x8ef9('0x2c'),util[_0x8ef9('0x22')](_0x27f7bb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8ef9('0xf')]['syncVarSet']=function(_0x492f83){try{if(this['isNotNull'](_0x492f83)){this[_0x8ef9('0x2d')](_0x492f83[_0x8ef9('0x13')],_[_0x8ef9('0x2e')](_0x492f83[_0x8ef9('0x2f')])[0x0],_0x492f83[_0x8ef9('0x30')]);if(this['isNotNull'](_0x492f83['variable'])&&this[_0x8ef9('0x10')](_0x492f83[_0x8ef9('0x2f')][_0x8ef9('0x31')])){if(_['isUndefined'](this['channels'][_0x492f83[_0x8ef9('0x13')]])){this[_0x8ef9('0x14')][_0x492f83[_0x8ef9('0x13')]]={'routeId':_0x492f83[_0x8ef9('0x30')],'variables':this[_0x8ef9('0x9')][_0x492f83[_0x8ef9('0x13')]]};this[_0x8ef9('0x12')](_0x8ef9('0x1d'),_0x8ef9('0x1e'),this[_0x8ef9('0x14')][_0x492f83[_0x8ef9('0x13')]]);}}}}catch(_0x15f9b1){logger[_0x8ef9('0x20')](_0x8ef9('0x32'),util[_0x8ef9('0x22')](_0x15f9b1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8ef9('0xf')][_0x8ef9('0x2d')]=function(_0x42dd03,_0x58aa59,_0x43ea3a){var _0x11e913=[_0x8ef9('0x33'),_0x8ef9('0x34'),'rtpaudioqosjitter',_0x8ef9('0x35'),_0x8ef9('0x36'),_0x8ef9('0x37'),_0x8ef9('0x38'),_0x8ef9('0x39'),'sipcallid',_0x8ef9('0x3a'),_0x8ef9('0x3b'),'bridgepvtcallid','membercalls',_0x8ef9('0x3c'),_0x8ef9('0x3d'),'memberlastcall',_0x8ef9('0x3e'),_0x8ef9('0x3f'),_0x8ef9('0x40')];if(!_[_0x8ef9('0x41')](_0x58aa59)&&!_[_0x8ef9('0x42')](_0x11e913,_0x58aa59)){if(_[_0x8ef9('0x11')](this[_0x8ef9('0x9')][_0x42dd03])){this['variables'][_0x42dd03]={};}this[_0x8ef9('0x9')][_0x42dd03][_0x58aa59]=_0x43ea3a;}};VoiceDialReport[_0x8ef9('0xf')][_0x8ef9('0x43')]=function(_0x48d79d){try{if(this[_0x8ef9('0x10')](_0x48d79d)){if(this[_0x8ef9('0x14')][_0x48d79d[_0x8ef9('0x13')]]){this[_0x8ef9('0x14')][_0x48d79d[_0x8ef9('0x13')]][_0x8ef9('0x44')]=moment()[_0x8ef9('0x15')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8ef9('0x14')][_0x48d79d['uniqueid']][_0x8ef9('0x45')]=moment(this['channels'][_0x48d79d[_0x8ef9('0x13')]][_0x8ef9('0x44')])['diff'](this['channels'][_0x48d79d[_0x8ef9('0x13')]][_0x8ef9('0x46')],'seconds');this[_0x8ef9('0x14')][_0x48d79d['uniqueid']][_0x8ef9('0x29')]=_0x8ef9('0x47');this[_0x8ef9('0x8')]['total']+=0x1;if(this[_0x8ef9('0x14')][_0x48d79d[_0x8ef9('0x13')]][_0x8ef9('0x27')]){this[_0x8ef9('0x8')]['answered']+=0x1;this[_0x8ef9('0x14')][_0x48d79d['uniqueid']]['holdtime']=moment(this[_0x8ef9('0x14')][_0x48d79d[_0x8ef9('0x13')]][_0x8ef9('0x27')])[_0x8ef9('0x48')](this[_0x8ef9('0x14')][_0x48d79d[_0x8ef9('0x13')]]['starttime'],_0x8ef9('0x49'));this['channels'][_0x48d79d['uniqueid']]['billableseconds']=moment(this[_0x8ef9('0x14')][_0x48d79d[_0x8ef9('0x13')]][_0x8ef9('0x44')])['diff'](this['channels'][_0x48d79d[_0x8ef9('0x13')]][_0x8ef9('0x27')],'seconds');this['outbound'][_0x8ef9('0x4a')]+=this[_0x8ef9('0x14')][_0x48d79d[_0x8ef9('0x13')]][_0x8ef9('0x4b')]||0x0;this['outbound'][_0x8ef9('0x4c')]+=this['channels'][_0x48d79d[_0x8ef9('0x13')]][_0x8ef9('0x4d')];}this[_0x8ef9('0x8')][_0x8ef9('0x4e')]+=this[_0x8ef9('0x14')][_0x48d79d[_0x8ef9('0x13')]][_0x8ef9('0x45')];ami[_0x8ef9('0x12')](_0x8ef9('0x4f'),this['channels'][_0x48d79d[_0x8ef9('0x13')]]);ami[_0x8ef9('0x12')](_0x8ef9('0x50'),this[_0x8ef9('0x14')][_0x48d79d['uniqueid']]);this[_0x8ef9('0x12')](_0x8ef9('0x1d'),_0x8ef9('0x51'),this[_0x8ef9('0x8')]);this[_0x8ef9('0x12')](_0x8ef9('0x1d'),'voice_outbound_channel:remove',this[_0x8ef9('0x14')][_0x48d79d['uniqueid']]);delete this[_0x8ef9('0x14')][_0x48d79d[_0x8ef9('0x13')]];}if(this[_0x8ef9('0x9')][_0x48d79d[_0x8ef9('0x13')]]){delete this[_0x8ef9('0x9')][_0x48d79d['uniqueid']];}}}catch(_0x54666b){logger['error'](_0x8ef9('0x52'),util['inspect'](_0x54666b,{'showHidden':![],'depth':null}));}};module[_0x8ef9('0x53')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 792121c..e5d42c6 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 _0xe3bd=['[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','voice:queue:%s','voice_queue_channel:save','format','name','voice_queue_channel:remove','type','inbound','strategy','available','loggedIn','sumBillable','sumDuration','total','unmanaged','abandoned','Trunk','callerid','Interval','stringify','voice_queue:save','isNotNull','loopQueueShow','queues','[queues]','flagQueueSummary','then','queue','countBy','callers','toNumber','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','YYYY-MM-DD\x20HH:mm:ss','position','count','push','last','queuecallercomplete','holdtime','originalposition','queuecallerexitreason','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','syncAgentConnect','queuecallerabandonAt','assigned','queuecallerexit','queuecallerexitAt','reason','startsWith','channel','toLowerCase','local/','linkedid','queuecallerjoinAt','add','transfer','transfertype','FORWARD','destexten','transferuniqueid','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','keys','value','variable','queuestatus','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','memberdynamic','memberinterface','membername','memberpenalty','includes','sumHoldTime','diff','seconds','length','milliseconds','answered','queuecallercompleteAt','lastevent','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[syncAttendedTransfer][VoiceQueueReport]','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','[syncMusicOnHoldStart][VoiceQueueReport]','syncMusicOnHoldStop','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','md5','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','prototype','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','syncQueueSummary','syncQueueSummaryComplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','enqueue','isNil','Action','status','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]'];(function(_0x30766c,_0x26fead){var _0x122e07=function(_0xdddd6b){while(--_0xdddd6b){_0x30766c['push'](_0x30766c['shift']());}};_0x122e07(++_0x26fead);}(_0xe3bd,0x7f));var _0xde3b=function(_0x2586ad,_0x3a2816){_0x2586ad=_0x2586ad-0x0;var _0x4128db=_0xe3bd[_0x2586ad];return _0x4128db;};'use strict';var _=require(_0xde3b('0x0'));var moment=require(_0xde3b('0x1'));var BPromise=require(_0xde3b('0x2'));var util=require('util');var md5=require(_0xde3b('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xde3b('0x4'))(_0xde3b('0x5'));var ami=require(_0xde3b('0x6'));var QueueReport=require(_0xde3b('0x7'));config[_0xde3b('0x8')]=_[_0xde3b('0x9')](config[_0xde3b('0x8')],{'host':_0xde3b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xde3b('0x8')]));var Sequence=function(){};Sequence[_0xde3b('0xb')]['enqueue']=function(_0x122715){this[_0xde3b('0xc')]=this['tail']?this['tail'][_0xde3b('0xd')](_0x122715):_0x122715();};function VoiceQueueReport(_0x4b104d){this[_0xde3b('0xe')]=new Sequence();this[_0xde3b('0xf')]={};this[_0xde3b('0x10')]=_0x4b104d['agents'];this[_0xde3b('0x11')]=_0x4b104d[_0xde3b('0x12')];this['voiceQueues']=_0x4b104d[_0xde3b('0x13')];this['flagQueueSummary']=!![];this[_0xde3b('0x14')]=_0x4b104d['campaigns'];this[_0xde3b('0x15')]={};ami['on'](_0xde3b('0x16'),this[_0xde3b('0x17')]['bind'](this));ami['on']('queuesummarycomplete',this[_0xde3b('0x18')][_0xde3b('0x19')](this));ami['on'](_0xde3b('0x1a'),this[_0xde3b('0x1b')][_0xde3b('0x19')](this));ami['on'](_0xde3b('0x1c'),this[_0xde3b('0x1d')][_0xde3b('0x19')](this));ami['on'](_0xde3b('0x1e'),this[_0xde3b('0x1f')]['bind'](this));ami['on'](_0xde3b('0x20'),this[_0xde3b('0x21')][_0xde3b('0x19')](this));ami['on'](_0xde3b('0x22'),this['syncAgentConnect'][_0xde3b('0x19')](this));ami['on'](_0xde3b('0x23'),this[_0xde3b('0x24')][_0xde3b('0x19')](this));ami['on'](_0xde3b('0x25'),this[_0xde3b('0x26')][_0xde3b('0x19')](this));ami['on'](_0xde3b('0x27'),this[_0xde3b('0x28')][_0xde3b('0x19')](this));ami['on']('musiconholdstart',this[_0xde3b('0x29')][_0xde3b('0x19')](this));ami['on'](_0xde3b('0x2a'),this['syncMusicOnHoldStop'][_0xde3b('0x19')](this));ami['on'](_0xde3b('0x2b'),this[_0xde3b('0x2c')][_0xde3b('0x19')](this));ami['on'](_0xde3b('0x2d'),this[_0xde3b('0x2e')][_0xde3b('0x19')](this));this[_0xde3b('0x2f')]();this['loopQueueShow']();}function isNotNull(_0x17b009){return _0x17b009!==null&&!_[_0xde3b('0x30')](_0x17b009);}function clearChannels(_0x3995d8){if(!_[_0xde3b('0x31')](_0x3995d8)){for(var _0x4b003c in _0x3995d8){if(_0x3995d8[_0xde3b('0x32')](_0x4b003c)){delete _0x3995d8[_0x4b003c];}}}}function clearCampaigns(_0x10bdcf){if(!_[_0xde3b('0x31')](_0x10bdcf)){for(var _0x18653f in _0x10bdcf){if(_0x10bdcf[_0xde3b('0x32')](_0x18653f)){_0x10bdcf[_0x18653f][_0xde3b('0x33')]=0x0;}}}}function clearVoiceQueues(_0x26fcc9){if(!_[_0xde3b('0x31')](_0x26fcc9)){for(var _0x295961 in _0x26fcc9){if(_0x26fcc9['hasOwnProperty'](_0x295961)){_0x26fcc9[_0x295961][_0xde3b('0x33')]=0x0;_0x26fcc9[_0x295961][_0xde3b('0x34')]=0x0;_0x26fcc9[_0x295961][_0xde3b('0x35')]=0x0;_0x26fcc9[_0x295961][_0xde3b('0x36')]=0x0;_0x26fcc9[_0x295961][_0xde3b('0x37')]=!![];}}}}function clearAgentBooked(_0x4801a0){if(!_[_0xde3b('0x31')](_0x4801a0)){for(var _0x14ef23 in _0x4801a0){if(_0x4801a0['hasOwnProperty'](_0x14ef23)){_0x4801a0[_0x14ef23][_0xde3b('0x38')]=!![];}}}}VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x39')]=function(){var _0x159e10=this;for(var _0xf89f8d in this[_0xde3b('0x11')]){if(this['channels']['hasOwnProperty'](_0xf89f8d)&&!this['channels'][_0xf89f8d][_0xde3b('0x3a')]){this[_0xde3b('0xe')][_0xde3b('0x3b')](function(){if(!_[_0xde3b('0x3c')](_0x159e10[_0xde3b('0x11')][_0xf89f8d])){return ami[_0xde3b('0x3d')]({'action':_0xde3b('0x3e'),'channel':_0x159e10['channels'][_0xf89f8d]['channel']})[_0xde3b('0x3f')](function(_0x27e04c){if(_0x27e04c[_0xde3b('0x40')]===_0xde3b('0x41')){setTimeout(function(){if(_0x159e10[_0xde3b('0x11')][_0xf89f8d]){delete _0x159e10[_0xde3b('0x11')][_0xf89f8d];logger[_0xde3b('0x42')](_0xde3b('0x43'),_0xf89f8d);}if(_0x159e10['queueReports'][_0xf89f8d]){delete _0x159e10['queueReports'][_0xf89f8d];logger[_0xde3b('0x42')](_0xde3b('0x44'),_0xf89f8d);}if(_0x159e10[_0xde3b('0x15')][_0xf89f8d]){delete _0x159e10[_0xde3b('0x15')][_0xf89f8d];logger[_0xde3b('0x42')](_0xde3b('0x45'),_0xf89f8d);}},0x1f40);}});}});}}};VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x28')]=function(){logger[_0xde3b('0x42')](_0xde3b('0x46'));clearChannels(this['channels']);this[_0xde3b('0x47')](this[_0xde3b('0xf')]);clearAgentBooked(this[_0xde3b('0x10')]);clearVoiceQueues(this[_0xde3b('0x13')]);clearCampaigns(this[_0xde3b('0x14')]);};VoiceQueueReport[_0xde3b('0xb')]['clearQueueReport']=function(_0x3feb2b){var _0x35caa4=this;if(!_['isEmpty'](_0x3feb2b)){for(var _0x1e0a9b in _0x3feb2b){if(_0x3feb2b[_0xde3b('0x32')](_0x1e0a9b)){_0x35caa4[_0xde3b('0x48')](_0x3feb2b[_0x1e0a9b]);delete _0x3feb2b[_0x1e0a9b];}}}};function loggerCatch(_0x313724){return function(_0x3f1424){logger[_0xde3b('0x42')](_0x313724,util[_0xde3b('0x49')](_0x3f1424,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x4a')]=function(_0x3a6448,_0x357fd0,_0x4c6328){io['to'](_0x3a6448)['emit'](_0x357fd0,_0x4c6328);};VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x4b')]=function(_0x51e4f8){this[_0xde3b('0x4a')](util['format'](_0xde3b('0x4c'),_0x51e4f8['name']),_0xde3b('0x4d'),_0x51e4f8);};VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x48')]=function(_0x5d9d8c){this[_0xde3b('0x4a')](util[_0xde3b('0x4e')](_0xde3b('0x4c'),_0x5d9d8c[_0xde3b('0x4f')]),_0xde3b('0x50'),_0x5d9d8c);};VoiceQueueReport['prototype']['emitVoiceQueueSummary']=function(_0x20cc21){if(_0x20cc21[_0xde3b('0x51')]===_0xde3b('0x52')){var _0x4f87c3={'id':_0x20cc21['id'],'name':_0x20cc21[_0xde3b('0x4f')],'strategy':_0x20cc21[_0xde3b('0x53')],'answered':_0x20cc21['answered'],'available':_0x20cc21[_0xde3b('0x54')],'loggedIn':_0x20cc21[_0xde3b('0x55')],'pTalking':_0x20cc21[_0xde3b('0x35')],'sumBillable':_0x20cc21[_0xde3b('0x56')],'sumDuration':_0x20cc21[_0xde3b('0x57')],'sumHoldTime':_0x20cc21['sumHoldTime']||0x0,'talking':_0x20cc21[_0xde3b('0x34')],'total':_0x20cc21[_0xde3b('0x58')],'type':_0x20cc21[_0xde3b('0x51')],'unmanaged':_0x20cc21[_0xde3b('0x59')],'abandoned':_0x20cc21[_0xde3b('0x5a')],'waiting':_0x20cc21[_0xde3b('0x36')]};if(_0x20cc21[_0xde3b('0x5b')]){_0x4f87c3[_0xde3b('0x5b')]={'id':_0x20cc21[_0xde3b('0x5b')]['id'],'name':_0x20cc21[_0xde3b('0x5b')][_0xde3b('0x4f')],'active':_0x20cc21[_0xde3b('0x5b')]['active'],'callerid':_0x20cc21[_0xde3b('0x5b')][_0xde3b('0x5c')]};}if(_0x20cc21[_0xde3b('0x5d')]){_0x4f87c3[_0xde3b('0x5d')]={'id':_0x20cc21['Interval']['id'],'name':_0x20cc21[_0xde3b('0x5d')]['name']};}var _0x2aae0b=md5(JSON[_0xde3b('0x5e')](_0x4f87c3));if(_0x20cc21[_0xde3b('0x3')]!==_0x2aae0b){_0x20cc21[_0xde3b('0x3')]=_0x2aae0b;this[_0xde3b('0x4a')](util[_0xde3b('0x4e')](_0xde3b('0x4c'),_0x4f87c3['name']),_0xde3b('0x5f'),_0x4f87c3);}}};VoiceQueueReport['prototype'][_0xde3b('0x60')]=function(_0x4fb2de){return _0x4fb2de!==null&&!_['isUndefined'](_0x4fb2de);};VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x61')]=function(){var _0x3a6ec1=this;setInterval(function(){_0x3a6ec1['clearZombieChannels']();ami[_0xde3b('0x3d')]({'action':_0xde3b('0x62')})[_0xde3b('0x3f')](loggerCatch(_0xde3b('0x63')));},0x2710);};VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x2f')]=function(){var _0x127670=this;setInterval(function(){if(_0x127670[_0xde3b('0x64')]){return ami[_0xde3b('0x3d')]({'action':'queuesummary'})[_0xde3b('0x65')](function(_0x1c738e){_0x127670['flagQueueSummary']=![];})[_0xde3b('0x3f')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0xde3b('0xb')]['syncQueueSummary']=function(_0x1c99ce){try{if(this[_0xde3b('0x60')](_0x1c99ce)&&this[_0xde3b('0x60')](_0x1c99ce[_0xde3b('0x66')])){if(this[_0xde3b('0x13')][_0x1c99ce[_0xde3b('0x66')]]){var _0x375cc9=_[_0xde3b('0x67')](this[_0xde3b('0x11')],_0xde3b('0x66'))[_0x1c99ce[_0xde3b('0x66')]]||0x0;var _0x5c8854=_0x375cc9-_0x1c99ce['callers'];if(this[_0xde3b('0x13')][_0x1c99ce[_0xde3b('0x66')]][_0xde3b('0x36')]!==_['toNumber'](_0x1c99ce[_0xde3b('0x68')])||this[_0xde3b('0x13')][_0x1c99ce[_0xde3b('0x66')]]['loggedIn']!==_[_0xde3b('0x69')](_0x1c99ce[_0xde3b('0x6a')])||this['voiceQueues'][_0x1c99ce[_0xde3b('0x66')]][_0xde3b('0x54')]!==_[_0xde3b('0x69')](_0x1c99ce[_0xde3b('0x54')])||this[_0xde3b('0x13')][_0x1c99ce[_0xde3b('0x66')]][_0xde3b('0x34')]!==_0x5c8854){this[_0xde3b('0x13')][_0x1c99ce[_0xde3b('0x66')]][_0xde3b('0x36')]=_['toNumber'](_0x1c99ce[_0xde3b('0x68')]);this[_0xde3b('0x13')][_0x1c99ce[_0xde3b('0x66')]]['loggedIn']=_[_0xde3b('0x69')](_0x1c99ce[_0xde3b('0x6a')]);this['voiceQueues'][_0x1c99ce[_0xde3b('0x66')]][_0xde3b('0x54')]=_[_0xde3b('0x69')](_0x1c99ce['available']);this['voiceQueues'][_0x1c99ce['queue']]['talking']=_0x5c8854>0x0?_0x5c8854:0x0;this[_0xde3b('0x13')][_0x1c99ce[_0xde3b('0x66')]]['talking']=this[_0xde3b('0x13')][_0x1c99ce[_0xde3b('0x66')]][_0xde3b('0x34')]>_['toNumber'](_0x1c99ce[_0xde3b('0x6a')])?_[_0xde3b('0x69')](_0x1c99ce['loggedin']):this[_0xde3b('0x13')][_0x1c99ce[_0xde3b('0x66')]][_0xde3b('0x34')];this['emitVoiceQueueSummary'](this['voiceQueues'][_0x1c99ce[_0xde3b('0x66')]]);}ami[_0xde3b('0x4a')](_0xde3b('0x6b'),this['voiceQueues'][_0x1c99ce['queue']]);}}}catch(_0x5ef630){logger[_0xde3b('0x42')](_0xde3b('0x6c'),util['inspect'](_0x5ef630,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x18')]=function(_0x23c5fe){this['flagQueueSummary']=!![];};VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x6d')]=function(_0x49813d){};VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x1b')]=function(_0x420097){try{if(this[_0xde3b('0x60')](_0x420097)){if(_[_0xde3b('0x30')](this[_0xde3b('0xf')][_0x420097[_0xde3b('0x6e')]])){this['queueReports'][_0x420097[_0xde3b('0x6e')]]=[];this[_0xde3b('0x11')][_0x420097[_0xde3b('0x6e')]]={};}var _0x4f18b4=new QueueReport();_0x4f18b4[_0xde3b('0x4f')]=_0x420097['queue'];_0x4f18b4[_0xde3b('0x51')]=this[_0xde3b('0x13')][_0x4f18b4[_0xde3b('0x4f')]]&&this[_0xde3b('0x13')][_0x4f18b4['name']][_0xde3b('0x51')]?this[_0xde3b('0x13')][_0x4f18b4[_0xde3b('0x4f')]][_0xde3b('0x51')]||_0xde3b('0x52'):'inbound';_0x4f18b4[_0xde3b('0x66')]=_0x420097['queue'];_0x4f18b4['queuecallerjoinAt']=moment()['format'](_0xde3b('0x6f'));_0x4f18b4[_0xde3b('0x70')]=_0x420097[_0xde3b('0x70')];_0x4f18b4['count']=_0x420097[_0xde3b('0x71')];_['merge'](_0x4f18b4,_['pick'](_0x420097,_['keys'](_0x4f18b4)));this[_0xde3b('0xf')][_0x420097['uniqueid']][_0xde3b('0x72')](_0x4f18b4);this[_0xde3b('0x11')][_0x420097[_0xde3b('0x6e')]]=_0x4f18b4;this[_0xde3b('0x4b')](_0x4f18b4);}}catch(_0x56e583){logger[_0xde3b('0x42')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0xde3b('0x49')](_0x56e583,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x1d')]=function(_0x28d6a5){try{if(this[_0xde3b('0x60')](_0x28d6a5)){if(this[_0xde3b('0xf')][_0x28d6a5['uniqueid']]){var _0x5b7654=_[_0xde3b('0x73')](this[_0xde3b('0xf')][_0x28d6a5[_0xde3b('0x6e')]]);_0x5b7654[_0xde3b('0x74')]=![];_0x5b7654['queuecallercompleteAt']=null;_0x5b7654[_0xde3b('0x75')]=_0x28d6a5['holdtime'];_0x5b7654['originalposition']=_0x28d6a5[_0xde3b('0x76')];_0x5b7654['queuecallerabandon']=!![];_0x5b7654['queuecallerabandonAt']=moment()['format'](_0xde3b('0x6f'));_0x5b7654[_0xde3b('0x77')]='ABANDONED';_0x5b7654[_0xde3b('0x78')]=null;this['channels'][_0x28d6a5[_0xde3b('0x6e')]]=_0x5b7654;this[_0xde3b('0x48')](_0x5b7654);}}}catch(_0x3657b6){logger[_0xde3b('0x42')](_0xde3b('0x79'),util[_0xde3b('0x49')](_0x3657b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde3b('0xb')]['syncQueueCallerLeave']=function(_0x52fbc2){try{if(this[_0xde3b('0x60')](_0x52fbc2)){if(this[_0xde3b('0xf')][_0x52fbc2['uniqueid']]){var _0x2a5d2b=_[_0xde3b('0x73')](this[_0xde3b('0xf')][_0x52fbc2['uniqueid']]);_0x2a5d2b[_0xde3b('0x7a')]=moment()[_0xde3b('0x4e')](_0xde3b('0x6f'));_0x2a5d2b[_0xde3b('0x7b')]=_0x52fbc2[_0xde3b('0x7b')];_0x2a5d2b[_0xde3b('0x7c')]=_0x52fbc2[_0xde3b('0x7c')];this[_0xde3b('0x11')][_0x52fbc2[_0xde3b('0x6e')]]=_0x2a5d2b;this[_0xde3b('0x4b')](_0x2a5d2b);}}}catch(_0x38c7ad){logger['error'](_0xde3b('0x7d'),util['inspect'](_0x38c7ad,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x7e')]=function(_0x3dec8c){try{if(this[_0xde3b('0x60')](_0x3dec8c)){if(this[_0xde3b('0xf')][_0x3dec8c['uniqueid']]){var _0x5e23f8=_[_0xde3b('0x73')](this[_0xde3b('0xf')][_0x3dec8c[_0xde3b('0x6e')]]);_0x5e23f8[_0xde3b('0x74')]=!![];_0x5e23f8['queuecallerexitreason']='COMPLETEDBYAGENT';}}}catch(_0x27eca0){logger['error']('[syncAgentConnect][VoiceQueueReport]',util['inspect'](_0x27eca0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xde3b('0x21')]=function(_0x1322b8){try{if(this[_0xde3b('0x60')](_0x1322b8)){if(this[_0xde3b('0xf')][_0x1322b8[_0xde3b('0x6e')]]){var _0x4cf808=_[_0xde3b('0x73')](this['queueReports'][_0x1322b8[_0xde3b('0x6e')]]);_0x4cf808[_0xde3b('0x1c')]=![];_0x4cf808[_0xde3b('0x7f')]=null;_0x4cf808[_0xde3b('0x80')]=!![];_0x4cf808['lastAssignedTo']=_0x1322b8['membername'];_0x4cf808[_0xde3b('0x75')]=_0x1322b8[_0xde3b('0x75')];_0x4cf808['queuecallercomplete']=!![];_0x4cf808[_0xde3b('0x81')]=![];_0x4cf808[_0xde3b('0x82')]=null;if(!_0x4cf808['transfer']){if(_0x1322b8[_0xde3b('0x83')]=='transfer'){_0x4cf808[_0xde3b('0x77')]='COMPLETED';}else{if(_[_0xde3b('0x84')](_0x1322b8[_0xde3b('0x85')][_0xde3b('0x86')](),_0xde3b('0x87'))){if(this[_0xde3b('0xf')][_0x1322b8[_0xde3b('0x88')]]){var _0x51a78e=_[_0xde3b('0x73')](this['queueReports'][_0x1322b8['linkedid']]);_0x51a78e[_0xde3b('0x74')]=![];_0x51a78e[_0xde3b('0x81')]=!![];_0x51a78e['queuecallerexitAt']=moment(_0x4cf808[_0xde3b('0x89')])[_0xde3b('0x8a')](_0x1322b8[_0xde3b('0x75')],'seconds')['format'](_0xde3b('0x6f'));_0x51a78e[_0xde3b('0x77')]='FORWARDTRANSFER';_0x51a78e[_0xde3b('0x8b')]=!![];_0x51a78e[_0xde3b('0x8c')]=_0xde3b('0x8d');_0x51a78e['transferexten']=_0x1322b8[_0xde3b('0x8e')];_0x51a78e[_0xde3b('0x8f')]=_0x1322b8['uniqueid'];var _0x58638e=this[_0xde3b('0xf')][_0x1322b8[_0xde3b('0x88')]];this['queueReports'][_0x1322b8['linkedid']]=this['queueReports'][_0x1322b8[_0xde3b('0x6e')]];this[_0xde3b('0xf')][_0x1322b8['uniqueid']]=_0x58638e;}}else{_0x4cf808[_0xde3b('0x77')]='COMPLETEDBY'+_0x1322b8[_0xde3b('0x83')][_0xde3b('0x90')]();}}}this[_0xde3b('0x11')][_0x1322b8[_0xde3b('0x6e')]]=_0x4cf808;this[_0xde3b('0x48')](_0x4cf808);}}}catch(_0x71f5a7){logger[_0xde3b('0x42')](_0xde3b('0x91'),util[_0xde3b('0x49')](_0x71f5a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xde3b('0x24')]=function(_0x5e268f){try{if(this[_0xde3b('0x60')](_0x5e268f)){this[_0xde3b('0x92')](_0x5e268f[_0xde3b('0x6e')],_[_0xde3b('0x93')](_0x5e268f['variable'])[0x0],_0x5e268f[_0xde3b('0x94')]);if(this[_0xde3b('0xf')][_0x5e268f['uniqueid']]){var _0x34b568=_[_0xde3b('0x73')](this['queueReports'][_0x5e268f[_0xde3b('0x6e')]]);if(_0x34b568){if(this[_0xde3b('0x60')](_0x5e268f[_0xde3b('0x95')])&&this[_0xde3b('0x60')](_0x5e268f[_0xde3b('0x95')][_0xde3b('0x96')])){switch(_0x5e268f['value']){case'CONTINUE':_0x34b568[_0xde3b('0x81')]=![];_0x34b568['queuecallerexitAt']=null;break;default:_0x34b568[_0xde3b('0x81')]=!![];_0x34b568[_0xde3b('0x82')]=moment()[_0xde3b('0x4e')](_0xde3b('0x6f'));_0x34b568[_0xde3b('0x7a')]=moment()[_0xde3b('0x4e')](_0xde3b('0x6f'));}_0x34b568[_0xde3b('0x1c')]=![];_0x34b568[_0xde3b('0x7f')]=null;_0x34b568['queuecallerexitreason']=_0x5e268f[_0xde3b('0x94')];this[_0xde3b('0x11')][_0x5e268f[_0xde3b('0x6e')]]=_0x34b568;this['emitVoiceQueueChannelRemove'](_0x34b568);}else if(this[_0xde3b('0x60')](_0x5e268f[_0xde3b('0x95')])&&this[_0xde3b('0x60')](_0x5e268f[_0xde3b('0x95')][_0xde3b('0x97')])){if(!_0x34b568[_0xde3b('0x1c')]){_0x34b568[_0xde3b('0x81')]=!![];_0x34b568[_0xde3b('0x82')]=moment()[_0xde3b('0x4e')](_0xde3b('0x6f'));_0x34b568[_0xde3b('0x77')]=_0xde3b('0x98');_0x34b568[_0xde3b('0x7a')]=moment()[_0xde3b('0x4e')](_0xde3b('0x6f'));this[_0xde3b('0x11')][_0x5e268f[_0xde3b('0x6e')]]=_0x34b568;}}_0x34b568['variables']=this[_0xde3b('0x15')][_0x5e268f[_0xde3b('0x6e')]];}}}}catch(_0x566886){logger[_0xde3b('0x42')](_0xde3b('0x99'),util[_0xde3b('0x49')](_0x566886,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xde3b('0xb')][_0xde3b('0x92')]=function(_0x2d81bf,_0xc1be0a,_0x5dad04){var _0x1e85bc=[_0xde3b('0x9a'),'rtpaudioqosbridged',_0xde3b('0x9b'),_0xde3b('0x9c'),_0xde3b('0x9d'),_0xde3b('0x9e'),_0xde3b('0x9f'),'rtpaudioqosrttbridged','sipcallid','sipuri',_0xde3b('0xa0'),'bridgepvtcallid','membercalls',_0xde3b('0xa1'),_0xde3b('0xa2'),'memberlastcall',_0xde3b('0xa3'),_0xde3b('0xa4'),'memberrealtime'];if(!_[_0xde3b('0x3c')](_0xc1be0a)&&!_[_0xde3b('0xa5')](_0x1e85bc,_0xc1be0a)){if(_[_0xde3b('0x30')](this[_0xde3b('0x15')][_0x2d81bf])){this[_0xde3b('0x15')][_0x2d81bf]={};}this[_0xde3b('0x15')][_0x2d81bf][_0xc1be0a]=_0x5dad04;}};VoiceQueueReport['prototype'][_0xde3b('0x26')]=function(_0x4401d6){try{if(this['isNotNull'](_0x4401d6)){if(this[_0xde3b('0xf')][_0x4401d6[_0xde3b('0x6e')]]){for(var _0x19494f=0x0,_0x29c016={};_0x19494f0x0?_0x307341:0x0;this['voiceQueues'][_0x29d30a[_0x1d15('0x5f')]][_0x1d15('0x2e')]=this[_0x1d15('0x10')][_0x29d30a[_0x1d15('0x5f')]][_0x1d15('0x2e')]>_[_0x1d15('0x62')](_0x29d30a['loggedin'])?_[_0x1d15('0x62')](_0x29d30a['loggedin']):this[_0x1d15('0x10')][_0x29d30a[_0x1d15('0x5f')]][_0x1d15('0x2e')];this[_0x1d15('0x48')](this[_0x1d15('0x10')][_0x29d30a['queue']]);}ami[_0x1d15('0x42')](_0x1d15('0x64'),this[_0x1d15('0x10')][_0x29d30a[_0x1d15('0x5f')]]);}}}catch(_0x2b270f){logger[_0x1d15('0x3b')](_0x1d15('0x65'),util[_0x1d15('0x41')](_0x2b270f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1d15('0x17')]=function(_0x5dd39a){this[_0x1d15('0x5d')]=!![];};VoiceQueueReport[_0x1d15('0x32')][_0x1d15('0x66')]=function(_0xd29444){};VoiceQueueReport[_0x1d15('0x32')][_0x1d15('0x19')]=function(_0x406978){try{if(this[_0x1d15('0x59')](_0x406978)){if(_[_0x1d15('0x2b')](this[_0x1d15('0xc')][_0x406978['uniqueid']])){this['queueReports'][_0x406978[_0x1d15('0x67')]]=[];this[_0x1d15('0xe')][_0x406978[_0x1d15('0x67')]]={};}var _0x454577=new QueueReport();_0x454577[_0x1d15('0x46')]=_0x406978[_0x1d15('0x5f')];_0x454577['type']=this['voiceQueues'][_0x454577[_0x1d15('0x46')]]&&this['voiceQueues'][_0x454577[_0x1d15('0x46')]][_0x1d15('0x49')]?this[_0x1d15('0x10')][_0x454577[_0x1d15('0x46')]][_0x1d15('0x49')]||_0x1d15('0x68'):_0x1d15('0x68');_0x454577[_0x1d15('0x5f')]=_0x406978[_0x1d15('0x5f')];_0x454577[_0x1d15('0x69')]=moment()[_0x1d15('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x454577[_0x1d15('0x6a')]=_0x406978[_0x1d15('0x6a')];_0x454577[_0x1d15('0x6b')]=_0x406978[_0x1d15('0x6b')];_['merge'](_0x454577,_[_0x1d15('0x6c')](_0x406978,_[_0x1d15('0x6d')](_0x454577)));this[_0x1d15('0xc')][_0x406978[_0x1d15('0x67')]]['push'](_0x454577);this['channels'][_0x406978[_0x1d15('0x67')]]=_0x454577;this[_0x1d15('0x43')](_0x454577);}}catch(_0x123ff8){logger[_0x1d15('0x3b')](_0x1d15('0x6e'),util[_0x1d15('0x41')](_0x123ff8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1d15('0x6f')]=function(_0x2fbc15){try{if(this[_0x1d15('0x59')](_0x2fbc15)){if(this[_0x1d15('0xc')][_0x2fbc15[_0x1d15('0x67')]]){var _0x689007=_[_0x1d15('0x70')](this[_0x1d15('0xc')][_0x2fbc15[_0x1d15('0x67')]]);_0x689007['queuecallercomplete']=![];_0x689007[_0x1d15('0x71')]=null;_0x689007[_0x1d15('0x72')]=_0x2fbc15[_0x1d15('0x72')];_0x689007[_0x1d15('0x73')]=_0x2fbc15['originalposition'];_0x689007[_0x1d15('0x1a')]=!![];_0x689007[_0x1d15('0x74')]=moment()['format'](_0x1d15('0x75'));_0x689007[_0x1d15('0x76')]=_0x1d15('0x77');_0x689007[_0x1d15('0x78')]=null;this[_0x1d15('0xe')][_0x2fbc15[_0x1d15('0x67')]]=_0x689007;this[_0x1d15('0x40')](_0x689007);}}}catch(_0x2af8be){logger['error'](_0x1d15('0x79'),util[_0x1d15('0x41')](_0x2af8be,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d15('0x32')][_0x1d15('0x7a')]=function(_0x29feb7){try{if(this[_0x1d15('0x59')](_0x29feb7)){if(this[_0x1d15('0xc')][_0x29feb7['uniqueid']]){var _0xeb83a=_[_0x1d15('0x70')](this['queueReports'][_0x29feb7['uniqueid']]);_0xeb83a[_0x1d15('0x7b')]=moment()[_0x1d15('0x44')](_0x1d15('0x75'));_0xeb83a[_0x1d15('0x7c')]=_0x29feb7[_0x1d15('0x7c')];_0xeb83a[_0x1d15('0x7d')]=_0x29feb7[_0x1d15('0x7d')];this[_0x1d15('0xe')][_0x29feb7[_0x1d15('0x67')]]=_0xeb83a;this[_0x1d15('0x43')](_0xeb83a);}}}catch(_0x40b07b){logger['error'](_0x1d15('0x7e'),util[_0x1d15('0x41')](_0x40b07b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d15('0x32')][_0x1d15('0x1e')]=function(_0x4626c2){try{if(this['isNotNull'](_0x4626c2)){if(this[_0x1d15('0xc')][_0x4626c2[_0x1d15('0x67')]]){var _0x3f468b=_[_0x1d15('0x70')](this[_0x1d15('0xc')][_0x4626c2[_0x1d15('0x67')]]);_0x3f468b['queuecallercomplete']=!![];_0x3f468b['queuecallerexitreason']='COMPLETEDBYAGENT';}}}catch(_0x588214){logger['error'](_0x1d15('0x7f'),util[_0x1d15('0x41')](_0x588214,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d15('0x32')]['syncAgentComplete']=function(_0x4afa8c){try{if(this[_0x1d15('0x59')](_0x4afa8c)){if(this['queueReports'][_0x4afa8c[_0x1d15('0x67')]]){var _0x4cedfc=_[_0x1d15('0x70')](this[_0x1d15('0xc')][_0x4afa8c['uniqueid']]);_0x4cedfc[_0x1d15('0x1a')]=![];_0x4cedfc[_0x1d15('0x74')]=null;_0x4cedfc[_0x1d15('0x80')]=!![];_0x4cedfc[_0x1d15('0x78')]=_0x4afa8c['membername'];_0x4cedfc[_0x1d15('0x72')]=_0x4afa8c[_0x1d15('0x72')];_0x4cedfc[_0x1d15('0x81')]=!![];_0x4cedfc['queuecallerexit']=![];_0x4cedfc[_0x1d15('0x82')]=null;if(!_0x4cedfc['transfer']){if(_0x4afa8c[_0x1d15('0x83')]==_0x1d15('0x84')){_0x4cedfc[_0x1d15('0x76')]=_0x1d15('0x85');}else{if(_[_0x1d15('0x86')](_0x4afa8c[_0x1d15('0x38')][_0x1d15('0x87')](),_0x1d15('0x88'))){if(this[_0x1d15('0xc')][_0x4afa8c['linkedid']]){var _0x20bbe7=_[_0x1d15('0x70')](this[_0x1d15('0xc')][_0x4afa8c[_0x1d15('0x89')]]);_0x20bbe7['queuecallercomplete']=![];_0x20bbe7['queuecallerexit']=!![];_0x20bbe7[_0x1d15('0x82')]=moment(_0x4cedfc['queuecallerjoinAt'])['add'](_0x4afa8c[_0x1d15('0x72')],_0x1d15('0x8a'))[_0x1d15('0x44')](_0x1d15('0x75'));_0x20bbe7[_0x1d15('0x76')]='FORWARDTRANSFER';_0x20bbe7[_0x1d15('0x84')]=!![];_0x20bbe7[_0x1d15('0x8b')]=_0x1d15('0x8c');_0x20bbe7[_0x1d15('0x8d')]=_0x4afa8c['destexten'];_0x20bbe7[_0x1d15('0x8e')]=_0x4afa8c['uniqueid'];var _0x489819=this[_0x1d15('0xc')][_0x4afa8c[_0x1d15('0x89')]];this[_0x1d15('0xc')][_0x4afa8c[_0x1d15('0x89')]]=this[_0x1d15('0xc')][_0x4afa8c[_0x1d15('0x67')]];this[_0x1d15('0xc')][_0x4afa8c[_0x1d15('0x67')]]=_0x489819;}}else{_0x4cedfc[_0x1d15('0x76')]=_0x1d15('0x8f')+_0x4afa8c[_0x1d15('0x83')]['toUpperCase']();}}}this[_0x1d15('0xe')][_0x4afa8c['uniqueid']]=_0x4cedfc;this['emitVoiceQueueChannelRemove'](_0x4cedfc);}}}catch(_0x52b21c){logger['error']('[syncAgentComplete][VoiceQueueReport]',util[_0x1d15('0x41')](_0x52b21c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d15('0x32')]['syncVarSet']=function(_0x27b227){try{if(this[_0x1d15('0x59')](_0x27b227)){this[_0x1d15('0x90')](_0x27b227['uniqueid'],_[_0x1d15('0x6d')](_0x27b227['variable'])[0x0],_0x27b227['value']);if(this[_0x1d15('0xc')][_0x27b227['uniqueid']]){var _0xbffa87=_['last'](this['queueReports'][_0x27b227['uniqueid']]);if(_0xbffa87){if(this[_0x1d15('0x59')](_0x27b227[_0x1d15('0x91')])&&this[_0x1d15('0x59')](_0x27b227['variable']['queuestatus'])){switch(_0x27b227['value']){case _0x1d15('0x92'):_0xbffa87[_0x1d15('0x93')]=![];_0xbffa87[_0x1d15('0x82')]=null;break;default:_0xbffa87[_0x1d15('0x93')]=!![];_0xbffa87[_0x1d15('0x82')]=moment()['format'](_0x1d15('0x75'));_0xbffa87['queuecallerleaveAt']=moment()['format'](_0x1d15('0x75'));}_0xbffa87['queuecallerabandon']=![];_0xbffa87[_0x1d15('0x74')]=null;_0xbffa87[_0x1d15('0x76')]=_0x27b227[_0x1d15('0x94')];this['channels'][_0x27b227['uniqueid']]=_0xbffa87;this[_0x1d15('0x40')](_0xbffa87);}else if(this[_0x1d15('0x59')](_0x27b227[_0x1d15('0x91')])&&this[_0x1d15('0x59')](_0x27b227[_0x1d15('0x91')][_0x1d15('0x95')])){if(!_0xbffa87[_0x1d15('0x1a')]){_0xbffa87[_0x1d15('0x93')]=!![];_0xbffa87[_0x1d15('0x82')]=moment()[_0x1d15('0x44')](_0x1d15('0x75'));_0xbffa87[_0x1d15('0x76')]=_0x1d15('0x96');_0xbffa87[_0x1d15('0x7b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1d15('0xe')][_0x27b227[_0x1d15('0x67')]]=_0xbffa87;}}_0xbffa87[_0x1d15('0x12')]=this['variables'][_0x27b227[_0x1d15('0x67')]];}}}}catch(_0x26dc6c){logger[_0x1d15('0x3b')](_0x1d15('0x97'),util[_0x1d15('0x41')](_0x26dc6c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1d15('0x32')]['addVariable']=function(_0x595f3d,_0x4f4ebe,_0x1fe827){var _0x403418=[_0x1d15('0x98'),_0x1d15('0x99'),_0x1d15('0x9a'),'rtpaudioqosjitterbridged',_0x1d15('0x9b'),_0x1d15('0x9c'),_0x1d15('0x9d'),_0x1d15('0x9e'),_0x1d15('0x9f'),_0x1d15('0xa0'),_0x1d15('0xa1'),_0x1d15('0xa2'),_0x1d15('0xa3'),_0x1d15('0xa4'),_0x1d15('0xa5'),_0x1d15('0xa6'),_0x1d15('0xa7'),_0x1d15('0xa8'),_0x1d15('0xa9')];if(!_['isNil'](_0x4f4ebe)&&!_[_0x1d15('0xaa')](_0x403418,_0x4f4ebe)){if(_[_0x1d15('0x2b')](this[_0x1d15('0x12')][_0x595f3d])){this[_0x1d15('0x12')][_0x595f3d]={};}this['variables'][_0x595f3d][_0x4f4ebe]=_0x1fe827;}};VoiceQueueReport[_0x1d15('0x32')]['syncHangup']=function(_0x343161){try{if(this[_0x1d15('0x59')](_0x343161)){if(this[_0x1d15('0xc')][_0x343161[_0x1d15('0x67')]]){for(var _0x3d077a=0x0,_0x93b793={};_0x3d077a=0x0?moment(_0x534146[_0x2f96('0x1d')])[_0x2f96('0x10')](_0x534146[_0x2f96('0x1c')],_0x2f96('0x11')):null,'data1':_0x2f96('0x1e'),'data2':_0x534146['accountcode'],'data3':_0x534146[_0x2f96('0x14')],'data4':_0x534146[_0x2f96('0x1f')]||null,'role':_0x2f96('0x16'),'internal':_0x534146[_0x2f96('0x17')]?_['toNumber'](_0x534146[_0x2f96('0x17')]):undefined,'uniqueid':_0x534146[_0x2f96('0x19')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xd777=['dialstring','moment','lodash','../client','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','diff','seconds','inbound','calleridnum','exten','queue','agent','toNumber','uniqueid','membername','TALKING','starttime','outbound','accountcode'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd777,0x105));var _0x7d77=function(_0x5f55b5,_0x372ef9){_0x5f55b5=_0x5f55b5-0x0;var _0x489ba1=_0xd777[_0x5f55b5];return _0x489ba1;};'use strict';var moment=require(_0x7d77('0x0'));var _=require(_0x7d77('0x1'));var util=require('util');var client=require(_0x7d77('0x2'));exports['voiceQueueReport']=function(_0x9c3298){var _0x102dce=_0x9c3298['queuecallercompleteAt']||_0x9c3298['queuecallerexitAt'];return client[_0x7d77('0x3')](_0x7d77('0x4'),{'body':{'channel':_0x7d77('0x5'),'membername':_0x9c3298[_0x7d77('0x6')],'interface':_[_0x7d77('0x7')](_0x9c3298[_0x7d77('0x8')])?util[_0x7d77('0x9')](_0x7d77('0xa'),_0x9c3298[_0x7d77('0x6')]):_0x9c3298[_0x7d77('0x8')],'type':'TALKING','enterAt':_0x9c3298['queuecallerleaveAt'],'exitAt':_0x102dce,'duration':moment(_0x102dce)[_0x7d77('0xb')](_0x9c3298['queuecallerleaveAt'],_0x7d77('0xc')),'data1':_0x7d77('0xd'),'data2':_0x9c3298[_0x7d77('0xe')],'data3':_0x9c3298[_0x7d77('0xf')],'data4':null,'data5':_0x9c3298[_0x7d77('0x10')],'role':_0x7d77('0x11'),'internal':_0x9c3298['accountcode']?_[_0x7d77('0x12')](_0x9c3298['accountcode']):undefined,'uniqueid':_0x9c3298[_0x7d77('0x13')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x1c4515){return client['Request'](_0x7d77('0x4'),{'body':{'channel':_0x7d77('0x5'),'membername':_0x1c4515[_0x7d77('0x14')],'interface':_0x1c4515[_0x7d77('0x8')],'type':_0x7d77('0x15'),'enterAt':_0x1c4515['starttime'],'exitAt':_0x1c4515['endtime'],'duration':moment(_0x1c4515['endtime'])['diff'](_0x1c4515[_0x7d77('0x16')],_0x7d77('0xc'))>=0x0?moment(_0x1c4515['endtime'])[_0x7d77('0xb')](_0x1c4515[_0x7d77('0x16')],_0x7d77('0xc')):null,'data1':_0x7d77('0x17'),'data2':_0x1c4515[_0x7d77('0x18')],'data3':_0x1c4515[_0x7d77('0xf')],'data4':_0x1c4515[_0x7d77('0x19')]||null,'role':_0x7d77('0x11'),'internal':_0x1c4515[_0x7d77('0x18')]?_[_0x7d77('0x12')](_0x1c4515[_0x7d77('0x18')]):undefined,'uniqueid':_0x1c4515[_0x7d77('0x13')]},'log':_0x7d77('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 8191d3a..ee43c14 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 _0x620f=['name','getTemplates','Request','GetTemplate'];(function(_0x8be9fb,_0x2f90d9){var _0x3b41ac=function(_0x369a8f){while(--_0x369a8f){_0x8be9fb['push'](_0x8be9fb['shift']());}};_0x3b41ac(++_0x2f90d9);}(_0x620f,0x131));var _0xf620=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x620f[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require('../client');exports[_0xf620('0x0')]=function(_0x199a17){return function(_0xc70264){return client[_0xf620('0x1')](_0xf620('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf620('0x3'),'html']},'log':_0xf620('0x2')});};}; \ No newline at end of file +var _0x6722=['html','getTemplates','Request','GetTemplate','name'];(function(_0x1a24b8,_0x20079b){var _0x55ed64=function(_0x29734a){while(--_0x29734a){_0x1a24b8['push'](_0x1a24b8['shift']());}};_0x55ed64(++_0x20079b);}(_0x6722,0x132));var _0x2672=function(_0x401805,_0x2905fc){_0x401805=_0x401805-0x0;var _0x5b3a3d=_0x6722[_0x401805];return _0x5b3a3d;};'use strict';var client=require('../client');exports[_0x2672('0x0')]=function(_0x364d1d){return function(_0x1a14d9){return client[_0x2672('0x1')](_0x2672('0x2'),{'options':{'raw':!![],'attributes':['id',_0x2672('0x3'),_0x2672('0x4')]},'log':_0x2672('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7cba35f..821ec45 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 _0xa9e0=['data3','data4','data5','../client','getTriggers','GetTrigger','channel','status','Condition','AllConditions','field','value','AnyConditions','action','data1','data2'];(function(_0x362b6d,_0x20e7e9){var _0x11f9f1=function(_0x256f23){while(--_0x256f23){_0x362b6d['push'](_0x362b6d['shift']());}};_0x11f9f1(++_0x20e7e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(_0x29929c){return function(_0x5dd881){return client['Request'](_0x0a9e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),_0x0a9e('0x4')],'include':[{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x6'),'attributes':['id',_0x0a9e('0x7'),'operator',_0x0a9e('0x8')]},{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x9'),'attributes':['id','field','operator',_0x0a9e('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x0a9e('0xa'),_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),'data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xa9e0=['data3','data4','data5','../client','getTriggers','GetTrigger','channel','status','Condition','AllConditions','field','value','AnyConditions','action','data1','data2'];(function(_0x34dd20,_0xe7b817){var _0x4c2a01=function(_0x5980d5){while(--_0x5980d5){_0x34dd20['push'](_0x34dd20['shift']());}};_0x4c2a01(++_0xe7b817);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(_0x29929c){return function(_0x5dd881){return client['Request'](_0x0a9e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),_0x0a9e('0x4')],'include':[{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x6'),'attributes':['id',_0x0a9e('0x7'),'operator',_0x0a9e('0x8')]},{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x9'),'attributes':['id','field','operator',_0x0a9e('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x0a9e('0xa'),_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),'data6','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 591f6c2..2ad6bd1 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 _0x68b5=['name','registry','../client','getTrunks','Request','GetTrunk'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x68b5,0x74));var _0x568b=function(_0x32f44b,_0x4d637c){_0x32f44b=_0x32f44b-0x0;var _0x178f84=_0x68b5[_0x32f44b];return _0x178f84;};'use strict';var client=require(_0x568b('0x0'));exports[_0x568b('0x1')]=function(_0x3cfc0d){return function(_0x5a42e8){return client[_0x568b('0x2')](_0x568b('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x568b('0x4'),_0x568b('0x5')]},'log':_0x568b('0x3')});};}; \ No newline at end of file +var _0x206e=['getTrunks','Request','GetTrunk','name','registry','../client'];(function(_0x13f980,_0x1e1c56){var _0x27153c=function(_0x3953d5){while(--_0x3953d5){_0x13f980['push'](_0x13f980['shift']());}};_0x27153c(++_0x1e1c56);}(_0x206e,0x89));var _0xe206=function(_0x296e0e,_0x342fa4){_0x296e0e=_0x296e0e-0x0;var _0x101c03=_0x206e[_0x296e0e];return _0x101c03;};'use strict';var client=require(_0xe206('0x0'));exports[_0xe206('0x1')]=function(_0x3d8ad5){return function(_0x376d3e){return client[_0xe206('0x2')](_0xe206('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe206('0x4'),_0xe206('0x5')]},'log':_0xe206('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 0a5e3ea..03d6718 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 _0x967a=['interface','getTelephones','Request','telephone','name','accountcode','internal','savePause','saveUnpause','email','../client','getAgents','GetUser','agent','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile'];(function(_0x512fa7,_0x51f816){var _0x4b7aea=function(_0x3af08d){while(--_0x3af08d){_0x512fa7['push'](_0x512fa7['shift']());}};_0x4b7aea(++_0x51f816);}(_0x967a,0x73));var _0xa967=function(_0x14d67d,_0x32c7ec){_0x14d67d=_0x14d67d-0x0;var _0x2c82fb=_0x967a[_0x14d67d];return _0x2c82fb;};'use strict';var client=require(_0xa967('0x0'));exports[_0xa967('0x1')]=function(){return function(){return client['Request'](_0xa967('0x2'),{'options':{'raw':![],'where':{'role':_0xa967('0x3')},'attributes':['id','name','email','accountcode',_0xa967('0x4'),_0xa967('0x5'),_0xa967('0x6'),_0xa967('0x7'),'lastPauseAt',_0xa967('0x8'),_0xa967('0x9'),_0xa967('0xa'),_0xa967('0xb')]},'log':_0xa967('0x1')});};};exports[_0xa967('0xc')]=function(){return function(){return client[_0xa967('0xd')](_0xa967('0x2'),{'options':{'raw':!![],'where':{'role':_0xa967('0xe')},'attributes':['id',_0xa967('0xf'),_0xa967('0x10'),_0xa967('0x11')]},'log':_0xa967('0xc')});};};exports[_0xa967('0x12')]=function(_0x46061d,_0x29ca0e,_0x5ba88d){return client[_0xa967('0xd')]('PauseUser',{'body':{'type':_0x29ca0e,'uniqueid':_0x5ba88d},'options':{'where':{'id':_0x46061d['id']}},'log':_0xa967('0x12')});};exports[_0xa967('0x13')]=function(_0x380a7f){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x380a7f['id']}},'log':_0xa967('0x12')});};exports['getAgent']=function(_0x515658){return client[_0xa967('0xd')]('ShowUser',{'options':{'raw':![],'where':{'role':_0xa967('0x3'),'id':_0x515658},'attributes':['id',_0xa967('0xf'),_0xa967('0x14'),'accountcode',_0xa967('0x4'),_0xa967('0x5'),'lastLoginAt',_0xa967('0x7'),'lastPauseAt','voicePause',_0xa967('0xb')]},'log':'getAgent'});}; \ No newline at end of file +var _0x4af4=['GetUser','agent','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','Request','telephone','internal','getTelephones','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','email','lastPauseAt','interface','getAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4af4,0x14f));var _0x44af=function(_0x6e5de,_0x6dd40b){_0x6e5de=_0x6e5de-0x0;var _0x140ab0=_0x4af4[_0x6e5de];return _0x140ab0;};'use strict';var client=require('../client');exports[_0x44af('0x0')]=function(){return function(){return client['Request'](_0x44af('0x1'),{'options':{'raw':![],'where':{'role':_0x44af('0x2')},'attributes':['id',_0x44af('0x3'),'email',_0x44af('0x4'),_0x44af('0x5'),_0x44af('0x6'),_0x44af('0x7'),_0x44af('0x8'),'lastPauseAt',_0x44af('0x9'),_0x44af('0xa'),'mobile','interface']},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client[_0x44af('0xb')](_0x44af('0x1'),{'options':{'raw':!![],'where':{'role':_0x44af('0xc')},'attributes':['id',_0x44af('0x3'),_0x44af('0x4'),_0x44af('0xd')]},'log':_0x44af('0xe')});};};exports[_0x44af('0xf')]=function(_0x8be808,_0xb63cf9,_0x206768){return client[_0x44af('0xb')](_0x44af('0x10'),{'body':{'type':_0xb63cf9,'uniqueid':_0x206768},'options':{'where':{'id':_0x8be808['id']}},'log':_0x44af('0xf')});};exports[_0x44af('0x11')]=function(_0xe28b1f){return client['Request'](_0x44af('0x12'),{'body':{},'options':{'where':{'id':_0xe28b1f['id']}},'log':'savePause'});};exports[_0x44af('0x13')]=function(_0x419a73){return client[_0x44af('0xb')](_0x44af('0x14'),{'options':{'raw':![],'where':{'role':_0x44af('0x2'),'id':_0x419a73},'attributes':['id','name',_0x44af('0x15'),'accountcode',_0x44af('0x5'),'online',_0x44af('0x7'),_0x44af('0x8'),_0x44af('0x16'),'voicePause',_0x44af('0x17')]},'log':_0x44af('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 6aafca3..e5edffa 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 _0x2fe9=['create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2fe9,0x1a9));var _0x92fe=function(_0x377356,_0x3e73e9){_0x377356=_0x377356-0x0;var _0x40cded=_0x2fe9[_0x377356];return _0x40cded;};'use strict';var client=require(_0x92fe('0x0'));exports[_0x92fe('0x1')]=function(_0x47381b){return client['Request'](_0x92fe('0x2'),{'body':_0x47381b,'log':_0x92fe('0x2')});};exports[_0x92fe('0x3')]=function(_0x5517b7,_0x447f37,_0x5ec534){return client[_0x92fe('0x4')](_0x92fe('0x5'),{'body':_0x5517b7,'options':{'where':{'uniqueid':_0x447f37,'interface':_0x5ec534}},'log':_0x92fe('0x5')});}; \ No newline at end of file +var _0xeb3d=['update','UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport'];(function(_0x1ad81d,_0x47201f){var _0x1749ef=function(_0x544e78){while(--_0x544e78){_0x1ad81d['push'](_0x1ad81d['shift']());}};_0x1749ef(++_0x47201f);}(_0xeb3d,0x1b0));var _0xdeb3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb3d[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xdeb3('0x0'));exports['create']=function(_0x8fbd61){return client[_0xdeb3('0x1')](_0xdeb3('0x2'),{'body':_0x8fbd61,'log':'CreateVoiceAgentReport'});};exports[_0xdeb3('0x3')]=function(_0x5b31eb,_0x311a70,_0x40a2ac){return client[_0xdeb3('0x1')](_0xdeb3('0x4'),{'body':_0x5b31eb,'options':{'where':{'uniqueid':_0x311a70,'interface':_0x40a2ac}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 69d72ec..4c04b19 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 _0x1877=['Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','format','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0x1877,0x146));var _0x7187=function(_0x582e18,_0x4fd856){_0x582e18=_0x582e18-0x0;var _0x445d03=_0x1877[_0x582e18];return _0x445d03;};'use strict';var moment=require(_0x7187('0x0'));var util=require(_0x7187('0x1'));var _=require(_0x7187('0x2'));var client=require(_0x7187('0x3'));exports['create']=function(_0x40ee51){return client[_0x7187('0x4')](_0x7187('0x5'),{'body':_['merge'](_0x40ee51,{'source':_0x40ee51[_0x7187('0x6')],'destinationcontext':_0x40ee51[_0x7187('0x7')],'callerid':_0x40ee51[_0x7187('0x8')],'amaflags':_0x7187('0x9')}),'log':_0x7187('0x5')});};exports[_0x7187('0xa')]=function(){return function(){return client[_0x7187('0x4')](_0x7187('0xb'),{'options':{'where':{'type':[_0x7187('0xc')],'createdAt':{'$between':[moment()[_0x7187('0xd')]('day')['format'](_0x7187('0xe')),moment()[_0x7187('0xf')](_0x7187('0x10'))[_0x7187('0x11')](_0x7187('0xe'))]}},'attributes':[_0x7187('0x12'),'disposition',_0x7187('0x13'),_0x7187('0x14')]},'log':_0x7187('0x15')});};}; \ No newline at end of file +var _0x3add=['duration','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request','CreateVoiceCallReport','merge','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3add,0x13e));var _0xd3ad=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x3add[_0x381589];return _0x2a075d;};'use strict';var moment=require(_0xd3ad('0x0'));var util=require(_0xd3ad('0x1'));var _=require(_0xd3ad('0x2'));var client=require('../client');exports[_0xd3ad('0x3')]=function(_0x3f7cd5){return client[_0xd3ad('0x4')](_0xd3ad('0x5'),{'body':_[_0xd3ad('0x6')](_0x3f7cd5,{'source':_0x3f7cd5['calleridnum'],'destinationcontext':_0x3f7cd5['context'],'callerid':_0x3f7cd5[_0xd3ad('0x7')],'amaflags':_0xd3ad('0x8')}),'log':_0xd3ad('0x5')});};exports[_0xd3ad('0x9')]=function(){return function(){return client[_0xd3ad('0x4')](_0xd3ad('0xa'),{'options':{'where':{'type':[_0xd3ad('0xb')],'createdAt':{'$between':[moment()[_0xd3ad('0xc')](_0xd3ad('0xd'))[_0xd3ad('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xd3ad('0xd'))[_0xd3ad('0xe')](_0xd3ad('0xf'))]}},'attributes':[_0xd3ad('0x10'),_0xd3ad('0x11'),_0xd3ad('0x12'),_0xd3ad('0x13')]},'log':_0xd3ad('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 423203a..12d7351 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 _0xb129=['Request','CreateVoiceDialReport','create'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0xb129,0x137));var _0x9b12=function(_0x1cb574,_0x318720){_0x1cb574=_0x1cb574-0x0;var _0x3f11a5=_0xb129[_0x1cb574];return _0x3f11a5;};'use strict';var client=require('../client');exports[_0x9b12('0x0')]=function(_0x3aef5b){return client[_0x9b12('0x1')](_0x9b12('0x2'),{'body':_0x3aef5b,'log':_0x9b12('0x2')});}; \ No newline at end of file +var _0x2993=['../client','Request','CreateVoiceDialReport'];(function(_0x49b44d,_0xb8e24f){var _0x399a27=function(_0x47dc8b){while(--_0x47dc8b){_0x49b44d['push'](_0x49b44d['shift']());}};_0x399a27(++_0xb8e24f);}(_0x2993,0x1a7));var _0x3299=function(_0x38be5e,_0x5f227a){_0x38be5e=_0x38be5e-0x0;var _0x53604f=_0x2993[_0x38be5e];return _0x53604f;};'use strict';var client=require(_0x3299('0x0'));exports['create']=function(_0x5380fd){return client[_0x3299('0x1')](_0x3299('0x2'),{'body':_0x5380fd,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7afad1f..e323baa 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 _0x76fa=['getVoiceExtensions','Request','exten','recordingFormat','../client'];(function(_0x92116d,_0xa6ee1b){var _0xfe4f60=function(_0x1f052d){while(--_0x1f052d){_0x92116d['push'](_0x92116d['shift']());}};_0xfe4f60(++_0xa6ee1b);}(_0x76fa,0xfe));var _0xa76f=function(_0x5508b0,_0x4ecedc){_0x5508b0=_0x5508b0-0x0;var _0x641bdc=_0x76fa[_0x5508b0];return _0x641bdc;};'use strict';var client=require(_0xa76f('0x0'));exports[_0xa76f('0x1')]=function(){return function(){return client[_0xa76f('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xa76f('0x3'),_0xa76f('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xa76f('0x1')});};}; \ No newline at end of file +var _0xc6f4=['../client','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc6f4,0x78));var _0x4c6f=function(_0x5e2476,_0x30deec){_0x5e2476=_0x5e2476-0x0;var _0x1c44d5=_0xc6f4[_0x5e2476];return _0x1c44d5;};'use strict';var client=require(_0x4c6f('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x4c6f('0x1')](_0x4c6f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x4c6f('0x3'),_0x4c6f('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index a677fcc..077e781 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 _0x803f=['acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','mandatoryDisposition','Trunk','name','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','acw'];(function(_0x3c8aa5,_0x4e974e){var _0x22412e=function(_0x174678){while(--_0x174678){_0x3c8aa5['push'](_0x3c8aa5['shift']());}};_0x22412e(++_0x4e974e);}(_0x803f,0x64));var _0xf803=function(_0x44124b,_0x2b2b32){_0x44124b=_0x44124b-0x0;var _0xafe8bf=_0x803f[_0x44124b];return _0xafe8bf;};'use strict';var client=require(_0xf803('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xf803('0x1')](_0xf803('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xf803('0x3'),_0xf803('0x4'),_0xf803('0x5'),_0xf803('0x6'),_0xf803('0x7'),'dialActive',_0xf803('0x8'),_0xf803('0x9'),_0xf803('0xa'),'dialPowerLevel',_0xf803('0xb'),_0xf803('0xc'),'dialPredictiveInterval',_0xf803('0xd'),_0xf803('0xe'),_0xf803('0xf'),'dialQueueOptions',_0xf803('0x10'),'dialQueueProject',_0xf803('0x11'),_0xf803('0x12'),'dialBusyMaxRetry',_0xf803('0x13'),_0xf803('0x14'),_0xf803('0x15'),_0xf803('0x16'),_0xf803('0x17'),'dialGlobalInterval','dialPrefix',_0xf803('0x18'),_0xf803('0x19'),'dialAMDInitialSilence',_0xf803('0x1a'),'dialAMDAfterGreetingSilence',_0xf803('0x1b'),_0xf803('0x1c'),_0xf803('0x1d'),_0xf803('0x1e'),'dialAMDSilenceThreshold',_0xf803('0x1f'),_0xf803('0x20'),_0xf803('0x21'),_0xf803('0x22'),_0xf803('0x23'),_0xf803('0x24'),_0xf803('0x25'),'dialQueueProject2','monitor_format',_0xf803('0x26'),_0xf803('0x27'),_0xf803('0x28'),_0xf803('0x29')],'include':[{'model':_0xf803('0x2a'),'as':_0xf803('0x2a'),'attributes':['id',_0xf803('0x2b'),_0xf803('0x2c'),_0xf803('0x2d')]},{'model':_0xf803('0x2e'),'as':'mandatoryDispositionPause','attributes':['id',_0xf803('0x2b')]},{'model':_0xf803('0x2a'),'as':_0xf803('0x2f'),'attributes':['id',_0xf803('0x2b'),_0xf803('0x2c'),'active']},{'model':_0xf803('0x30'),'as':_0xf803('0x30'),'attributes':['id','name'],'include':[{'model':_0xf803('0x30'),'as':_0xf803('0x31'),'attributes':['id',_0xf803('0x2b'),_0xf803('0x32')]}]}]},'log':_0xf803('0x33')});};}; \ No newline at end of file +var _0xa4db=['dialAMDMaximumNumberOfWords','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialCutDigit','Trunk','mandatoryDispositionPause','active','Interval','Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x57ead4,_0x904b24){var _0x4f300e=function(_0x1e1804){while(--_0x1e1804){_0x57ead4['push'](_0x57ead4['shift']());}};_0x4f300e(++_0x904b24);}(_0xa4db,0x139));var _0xba4d=function(_0x51a02a,_0x4de650){_0x51a02a=_0x51a02a-0x0;var _0x19896f=_0xa4db[_0x51a02a];return _0x19896f;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xba4d('0x0'),{'options':{'raw':![],'attributes':['id',_0xba4d('0x1'),_0xba4d('0x2'),_0xba4d('0x3'),_0xba4d('0x4'),_0xba4d('0x5'),'type',_0xba4d('0x6'),'dialMethod',_0xba4d('0x7'),_0xba4d('0x8'),_0xba4d('0x9'),_0xba4d('0xa'),_0xba4d('0xb'),_0xba4d('0xc'),_0xba4d('0xd'),_0xba4d('0xe'),_0xba4d('0xf'),'dialQueueOptions',_0xba4d('0x10'),_0xba4d('0x11'),_0xba4d('0x12'),_0xba4d('0x13'),_0xba4d('0x14'),_0xba4d('0x15'),_0xba4d('0x16'),_0xba4d('0x17'),_0xba4d('0x18'),_0xba4d('0x19'),_0xba4d('0x1a'),_0xba4d('0x1b'),'dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence',_0xba4d('0x1c'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0xba4d('0x1d'),_0xba4d('0x1e'),_0xba4d('0x1f'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout',_0xba4d('0x20'),_0xba4d('0x21'),_0xba4d('0x22'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber',_0xba4d('0x23'),'mandatoryDisposition'],'include':[{'model':_0xba4d('0x24'),'as':'Trunk','attributes':['id','name','callerid','active']},{'model':'Pause','as':_0xba4d('0x25'),'attributes':['id',_0xba4d('0x1')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0xba4d('0x1'),'callerid',_0xba4d('0x26')]},{'model':_0xba4d('0x27'),'as':_0xba4d('0x27'),'attributes':['id',_0xba4d('0x1')],'include':[{'model':_0xba4d('0x27'),'as':_0xba4d('0x28'),'attributes':['id',_0xba4d('0x1'),_0xba4d('0x29')]}]}]},'log':_0xba4d('0x2a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index eeb91f4..71724d6 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 _0x1990=['queuecallerabandonAt','moment','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon'];(function(_0x2785fa,_0x5713eb){var _0xff2409=function(_0x409fd4){while(--_0x409fd4){_0x2785fa['push'](_0x2785fa['shift']());}};_0xff2409(++_0x5713eb);}(_0x1990,0xeb));var _0x0199=function(_0x241262,_0x421ba5){_0x241262=_0x241262-0x0;var _0x16551b=_0x1990[_0x241262];return _0x16551b;};'use strict';var moment=require(_0x0199('0x0'));var _=require('lodash');var client=require('../client');exports[_0x0199('0x1')]=function(_0x15943c){return client[_0x0199('0x2')](_0x0199('0x3'),{'body':_0x15943c,'log':_0x0199('0x3')});};exports[_0x0199('0x4')]=function(){return function(){return client[_0x0199('0x2')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x0199('0x5')](_0x0199('0x6'))[_0x0199('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x0199('0x6'))[_0x0199('0x7')](_0x0199('0x8'))]}},'attributes':[_0x0199('0x9'),_0x0199('0xa'),'queuecallerjoinAt',_0x0199('0xb'),_0x0199('0xc'),_0x0199('0xd'),_0x0199('0xe'),_0x0199('0xf'),_0x0199('0x10'),_0x0199('0x11')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0x2fe0=['GetVoiceQueueReports','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerexit','queuecallerabandon'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2fe0,0x157));var _0x02fe=function(_0x146f35,_0x162e07){_0x146f35=_0x146f35-0x0;var _0x44db42=_0x2fe0[_0x146f35];return _0x44db42;};'use strict';var moment=require('moment');var _=require(_0x02fe('0x0'));var client=require(_0x02fe('0x1'));exports[_0x02fe('0x2')]=function(_0x450e34){return client[_0x02fe('0x3')]('CreateVoiceQueueReport',{'body':_0x450e34,'log':_0x02fe('0x4')});};exports[_0x02fe('0x5')]=function(){return function(){return client[_0x02fe('0x3')](_0x02fe('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x02fe('0x7')](_0x02fe('0x8'))[_0x02fe('0x9')](_0x02fe('0xa')),moment()[_0x02fe('0xb')](_0x02fe('0x8'))['format'](_0x02fe('0xa'))]}},'attributes':['uniqueid',_0x02fe('0xc'),_0x02fe('0xd'),_0x02fe('0xe'),'queuecallercomplete','queuecallercompleteAt',_0x02fe('0xf'),'queuecallerexitAt',_0x02fe('0x10'),'queuecallerabandonAt']},'log':_0x02fe('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index f610dc1..3466da8 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 _0x9d23=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d23,0x1c8));var _0x39d2=function(_0x7aac0e,_0x1c742f){_0x7aac0e=_0x7aac0e-0x0;var _0x4f7920=_0x9d23[_0x7aac0e];return _0x4f7920;};'use strict';var client=require('../client');exports[_0x39d2('0x0')]=function(_0x341349){return function(){return client[_0x39d2('0x1')](_0x39d2('0x2'),{'options':{'where':{'VoiceQueueId':_0x341349,'paused':!![]},'raw':!![]},'log':_0x39d2('0x0')});};}; \ No newline at end of file +var _0xa5fd=['GetVoiceQueueRtPauses','Request'];(function(_0x2d9e45,_0x46f3ce){var _0x4d1035=function(_0x2c7b5a){while(--_0x2c7b5a){_0x2d9e45['push'](_0x2d9e45['shift']());}};_0x4d1035(++_0x46f3ce);}(_0xa5fd,0x173));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x3f4974){return function(){return client[_0xda5f('0x0')](_0xda5f('0x1'),{'options':{'where':{'VoiceQueueId':_0x3f4974,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 9ee42b1..d71963a 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 _0x78b7=['../client','create','Request','CreateVoiceRecording','monitorFilename'];(function(_0x1c8ea8,_0x461b8a){var _0x4135c3=function(_0x1eeff2){while(--_0x1eeff2){_0x1c8ea8['push'](_0x1c8ea8['shift']());}};_0x4135c3(++_0x461b8a);}(_0x78b7,0x1b3));var _0x778b=function(_0x2ffc5d,_0x564eba){_0x2ffc5d=_0x2ffc5d-0x0;var _0x57f0a=_0x78b7[_0x2ffc5d];return _0x57f0a;};'use strict';var _=require('lodash');var client=require(_0x778b('0x0'));exports[_0x778b('0x1')]=function(_0x3dcd54){return client[_0x778b('0x2')](_0x778b('0x3'),{'body':_['merge'](_0x3dcd54,{'value':_0x3dcd54[_0x778b('0x4')]}),'log':_0x778b('0x3')});}; \ No newline at end of file +var _0xdd45=['create','Request','CreateVoiceRecording','merge','monitorFilename','lodash'];(function(_0x140915,_0x5ca840){var _0x5c98c3=function(_0x1c49d3){while(--_0x1c49d3){_0x140915['push'](_0x140915['shift']());}};_0x5c98c3(++_0x5ca840);}(_0xdd45,0x1b5));var _0x5dd4=function(_0x8dbc24,_0xc6f7d1){_0x8dbc24=_0x8dbc24-0x0;var _0xaffa6e=_0xdd45[_0x8dbc24];return _0xaffa6e;};'use strict';var _=require(_0x5dd4('0x0'));var client=require('../client');exports[_0x5dd4('0x1')]=function(_0x199385){return client[_0x5dd4('0x2')](_0x5dd4('0x3'),{'body':_[_0x5dd4('0x4')](_0x199385,{'value':_0x199385[_0x5dd4('0x5')]}),'log':_0x5dd4('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 1b6fffc..dfa710d 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 _0x6509=['transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename'];(function(_0x32b2b7,_0x17d934){var _0x404a62=function(_0x571031){while(--_0x571031){_0x32b2b7['push'](_0x32b2b7['shift']());}};_0x404a62(++_0x17d934);}(_0x6509,0x1b1));var _0x9650=function(_0x27a900,_0x1cc305){_0x27a900=_0x27a900-0x0;var _0xea9b1f=_0x6509[_0x27a900];return _0xea9b1f;};'use strict';var client=require(_0x9650('0x0'));exports['blindTransfer']=function(_0xf2683b){return client[_0x9650('0x1')](_0x9650('0x2'),{'body':{'result':_0xf2683b['result'],'transfererchannel':_0xf2683b[_0x9650('0x3')],'transferercalleridnum':_0xf2683b[_0x9650('0x4')],'transferercalleridname':_0xf2683b[_0x9650('0x5')],'transfererconnectedlinenum':_0xf2683b['transfererconnectedlinenum'],'transfererconnectedlinename':_0xf2683b[_0x9650('0x6')],'transfereraccountcode':_0xf2683b[_0x9650('0x7')],'transferercontext':_0xf2683b[_0x9650('0x8')],'transfererexten':_0xf2683b['transfererexten'],'transfererlinkedid':_0xf2683b[_0x9650('0x9')],'transfereechannel':_0xf2683b[_0x9650('0xa')],'transfereecalleridnum':_0xf2683b[_0x9650('0xb')],'transfereecalleridname':_0xf2683b[_0x9650('0xc')],'transfereeconnectedlinenum':_0xf2683b['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0xf2683b[_0x9650('0xd')],'transfereeaccountcode':_0xf2683b[_0x9650('0xe')],'transfereecontext':_0xf2683b[_0x9650('0xf')],'transfereeexten':_0xf2683b[_0x9650('0x10')],'transfereelinkedid':_0xf2683b[_0x9650('0x11')],'isexternal':_0xf2683b[_0x9650('0x12')],'context':_0xf2683b[_0x9650('0x13')],'extension':_0xf2683b[_0x9650('0x14')],'type':_0x9650('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0x9650('0x16')]=function(_0x796d2b){return client[_0x9650('0x1')](_0x9650('0x2'),{'body':{'result':_0x796d2b[_0x9650('0x17')],'transfererchannel':_0x796d2b['origtransfererchannel'],'transferercalleridnum':_0x796d2b['origtransferercalleridnum'],'transferercalleridname':_0x796d2b[_0x9650('0x18')],'transfererconnectedlinenum':_0x796d2b[_0x9650('0x19')],'transfererconnectedlinename':_0x796d2b[_0x9650('0x1a')],'transfereraccountcode':_0x796d2b[_0x9650('0x1b')],'transferercontext':_0x796d2b[_0x9650('0x1c')],'transfererexten':_0x796d2b[_0x9650('0x1d')],'transfererlinkedid':_0x796d2b['origtransfererlinkedid'],'transfereechannel':_0x796d2b[_0x9650('0x1e')],'transfereecalleridnum':_0x796d2b[_0x9650('0x1f')],'transfereecalleridname':_0x796d2b[_0x9650('0x20')],'transfereeconnectedlinenum':_0x796d2b[_0x9650('0x21')],'transfereeconnectedlinename':_0x796d2b[_0x9650('0x22')],'transfereeaccountcode':_0x796d2b[_0x9650('0x23')],'transfereecontext':_0x796d2b[_0x9650('0x24')],'transfereeexten':_0x796d2b['transfertargetexten'],'transfereelinkedid':_0x796d2b['transfertargetlinkedid'],'isexternal':_0x796d2b[_0x9650('0x12')],'context':_0x796d2b[_0x9650('0x25')],'extension':_0x796d2b[_0x9650('0x26')],'type':_0x9650('0x27')},'log':_0x9650('0x2')});}; \ No newline at end of file +var _0x2cad=['origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel'];(function(_0x435a8e,_0x192d91){var _0xc54da1=function(_0xba7025){while(--_0xba7025){_0x435a8e['push'](_0x435a8e['shift']());}};_0xc54da1(++_0x192d91);}(_0x2cad,0x100));var _0xd2ca=function(_0x147bef,_0x5aa474){_0x147bef=_0x147bef-0x0;var _0x29d10c=_0x2cad[_0x147bef];return _0x29d10c;};'use strict';var client=require('../client');exports['blindTransfer']=function(_0x2f885b){return client[_0xd2ca('0x0')](_0xd2ca('0x1'),{'body':{'result':_0x2f885b[_0xd2ca('0x2')],'transfererchannel':_0x2f885b[_0xd2ca('0x3')],'transferercalleridnum':_0x2f885b[_0xd2ca('0x4')],'transferercalleridname':_0x2f885b[_0xd2ca('0x5')],'transfererconnectedlinenum':_0x2f885b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2f885b[_0xd2ca('0x6')],'transfereraccountcode':_0x2f885b['transfereraccountcode'],'transferercontext':_0x2f885b[_0xd2ca('0x7')],'transfererexten':_0x2f885b[_0xd2ca('0x8')],'transfererlinkedid':_0x2f885b[_0xd2ca('0x9')],'transfereechannel':_0x2f885b[_0xd2ca('0xa')],'transfereecalleridnum':_0x2f885b['transfereecalleridnum'],'transfereecalleridname':_0x2f885b[_0xd2ca('0xb')],'transfereeconnectedlinenum':_0x2f885b[_0xd2ca('0xc')],'transfereeconnectedlinename':_0x2f885b[_0xd2ca('0xd')],'transfereeaccountcode':_0x2f885b[_0xd2ca('0xe')],'transfereecontext':_0x2f885b[_0xd2ca('0xf')],'transfereeexten':_0x2f885b[_0xd2ca('0x10')],'transfereelinkedid':_0x2f885b[_0xd2ca('0x11')],'isexternal':_0x2f885b[_0xd2ca('0x12')],'context':_0x2f885b[_0xd2ca('0x13')],'extension':_0x2f885b[_0xd2ca('0x14')],'type':_0xd2ca('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0xd2ca('0x16')]=function(_0x3cfd57){return client[_0xd2ca('0x0')](_0xd2ca('0x1'),{'body':{'result':_0x3cfd57[_0xd2ca('0x2')],'transfererchannel':_0x3cfd57[_0xd2ca('0x17')],'transferercalleridnum':_0x3cfd57[_0xd2ca('0x18')],'transferercalleridname':_0x3cfd57[_0xd2ca('0x19')],'transfererconnectedlinenum':_0x3cfd57['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3cfd57[_0xd2ca('0x1a')],'transfereraccountcode':_0x3cfd57[_0xd2ca('0x1b')],'transferercontext':_0x3cfd57['secondtransferercontext'],'transfererexten':_0x3cfd57[_0xd2ca('0x1c')],'transfererlinkedid':_0x3cfd57[_0xd2ca('0x1d')],'transfereechannel':_0x3cfd57[_0xd2ca('0x1e')],'transfereecalleridnum':_0x3cfd57[_0xd2ca('0x1f')],'transfereecalleridname':_0x3cfd57[_0xd2ca('0x20')],'transfereeconnectedlinenum':_0x3cfd57[_0xd2ca('0x21')],'transfereeconnectedlinename':_0x3cfd57[_0xd2ca('0x22')],'transfereeaccountcode':_0x3cfd57[_0xd2ca('0x23')],'transfereecontext':_0x3cfd57[_0xd2ca('0x24')],'transfereeexten':_0x3cfd57[_0xd2ca('0x25')],'transfereelinkedid':_0x3cfd57['transfertargetlinkedid'],'isexternal':_0x3cfd57[_0xd2ca('0x12')],'context':_0x3cfd57[_0xd2ca('0x26')],'extension':_0x3cfd57[_0xd2ca('0x27')],'type':'attended'},'log':_0xd2ca('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 4a3e425..da84897 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 _0x988c=['content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','active','callerid','Interval','push','length','values','channels','join','voicechannel','channel','%s.%s','filename','uniqueid','wav','MixMonitor','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','destinationchannel','StopMixMonitor','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','exten','context','telephones','trunks','outboundChannels','campaigns','run','emit','custom:','event','faxAccounts','checkAfterSend','server','http','log','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','catch','error','message'];(function(_0x17cf02,_0x2331f1){var _0x36f646=function(_0x5e10cf){while(--_0x5e10cf){_0x17cf02['push'](_0x17cf02['shift']());}};_0x36f646(++_0x2331f1);}(_0x988c,0x170));var _0xc988=function(_0x3162d5,_0x2c560e){_0x3162d5=_0x3162d5-0x0;var _0x2c12bb=_0x988c[_0x3162d5];return _0x2c12bb;};'use strict';var _=require('lodash');var util=require(_0xc988('0x0'));var jayson=require(_0xc988('0x1'));var schema=require(_0xc988('0x2'));var BPromise=require(_0xc988('0x3'));var moment=require(_0xc988('0x4'));var config=require(_0xc988('0x5'));var properties=require(_0xc988('0x6'));var ami=require(_0xc988('0x7'));exports[_0xc988('0x8')]=function(_0x318708,_0x226850,_0x358bb3){return new BPromise(function(_0x2e6800,_0x52e2b9){var _0x48002d={'QueuePause':function(_0x12452d){return new Promise(function(_0x11067d,_0x1e5453){var _0x1c9519=util[_0xc988('0x9')](_0xc988('0xa'),_0xc988('0xb'),_0x12452d[_0xc988('0xc')]);if(_0x318708[_0xc988('0xd')]&&_0x318708[_0xc988('0xd')][_0x1c9519]&&_0x318708[_0xc988('0xd')][_0x1c9519][_0xc988('0xe')]){_0x318708[_0xc988('0xd')][_0x1c9519][_0xc988('0xf')]();}if(_0x318708[_0xc988('0x10')][_0x1c9519]){_0x318708['agents'][_0x1c9519][_0xc988('0x11')]({'statePause':_0x12452d[_0xc988('0x12')]?!![]:![]});}_0x11067d({'code':0xc8,'message':_0xc988('0x13')});});},'Reload':function(_0x178a73){var _0x17f2d6=this;return new Promise(function(_0x2f06b1,_0x418fb0){if(ami[_0xc988('0x14')]()==![]){return _0x418fb0(_0x17f2d6['error'](0x1f4,[config[_0xc988('0x15')]['ip'],config[_0xc988('0x15')][_0xc988('0x16')],_0xc988('0x17')]['join']('\x20')));}_0x178a73=_[_0xc988('0x18')](_0x178a73,_[_0xc988('0x19')](properties[_0xc988('0x1a')]));_0x178a73[_0xc988('0x1b')]=_0xc988('0x1c');return ami[_0xc988('0x1d')](_0x178a73)[_0xc988('0x1e')](function(_0x45157d){_0x2f06b1({'code':0xc8,'message':_0x45157d['message']});})[_0xc988('0x1f')](function(_0x72d386){_0x418fb0(_0x17f2d6[_0xc988('0x20')](0x1f5,_0x72d386[_0xc988('0x21')]));});});},'Command':function(_0x64d78){var _0x432d56=this;return new Promise(function(_0x5405c8,_0x67e366){if(ami[_0xc988('0x14')]()==![]){return _0x67e366(_0x432d56[_0xc988('0x20')](0x1f4,[config[_0xc988('0x15')]['ip'],config[_0xc988('0x15')][_0xc988('0x16')],_0xc988('0x17')]['join']('\x20')));}_0x64d78=_[_0xc988('0x18')](_0x64d78,'command');_0x64d78['action']='Command';return ami[_0xc988('0x1d')](_0x64d78)['then'](function(_0x4b9016){_0x5405c8({'code':0xc8,'message':_0x4b9016[_0xc988('0x22')]});})[_0xc988('0x1f')](function(_0x15e082){_0x67e366(_0x432d56[_0xc988('0x20')](0x1f5,_0x15e082['message']));});});},'VoiceQueues':function(_0x2550b0){return new Promise(function(_0x40b060,_0x1bb8d6){var _0x452661=[];for(var _0xfdb302 in _0x318708[_0xc988('0x23')]){if(_0x318708[_0xc988('0x23')][_0xc988('0x24')](_0xfdb302)){var _0x6aca8=_0x318708[_0xc988('0x23')][_0xfdb302];var _0x4a16dc={'id':_0x6aca8['id'],'name':_0x6aca8['name'],'strategy':_0x6aca8[_0xc988('0x25')],'answered':_0x6aca8[_0xc988('0x26')],'available':_0x6aca8[_0xc988('0x27')],'loggedIn':_0x6aca8[_0xc988('0x28')],'pTalking':_0x6aca8['pTalking'],'sumBillable':_0x6aca8['sumBillable'],'sumDuration':_0x6aca8[_0xc988('0x29')],'sumHoldTime':_0x6aca8[_0xc988('0x2a')]||0x0,'talking':_0x6aca8[_0xc988('0x2b')],'total':_0x6aca8[_0xc988('0x2c')],'type':_0x6aca8[_0xc988('0x2d')],'unmanaged':_0x6aca8[_0xc988('0x2e')],'abandoned':_0x6aca8[_0xc988('0x2f')],'waiting':_0x6aca8[_0xc988('0x30')],'loggedInDb':_0x6aca8[_0xc988('0x31')]};if(_0x6aca8['type']===_0xc988('0x32')){_0x4a16dc[_0xc988('0x33')]=_0x6aca8[_0xc988('0x33')];_0x4a16dc[_0xc988('0x34')]=_0x6aca8['dialMethod'];_0x4a16dc[_0xc988('0x35')]=_0x6aca8['dialOriginateCallerIdName'];_0x4a16dc[_0xc988('0x36')]=_0x6aca8['dialOriginateCallerIdNumber'];_0x4a16dc[_0xc988('0x37')]=_0x6aca8[_0xc988('0x37')];_0x4a16dc[_0xc988('0x38')]=_0x6aca8[_0xc988('0x38')];_0x4a16dc[_0xc988('0x39')]=_0x6aca8[_0xc988('0x39')];_0x4a16dc['outboundAnswerCallsDay']=_0x6aca8[_0xc988('0x3a')];_0x4a16dc[_0xc988('0x3b')]=_0x6aca8[_0xc988('0x3b')];_0x4a16dc[_0xc988('0x3c')]=_0x6aca8[_0xc988('0x3c')];_0x4a16dc['outboundCongestionCallsDay']=_0x6aca8[_0xc988('0x3d')];_0x4a16dc[_0xc988('0x3e')]=_0x6aca8['outboundDropCallsDayACS'];_0x4a16dc[_0xc988('0x3f')]=_0x6aca8[_0xc988('0x3f')];_0x4a16dc[_0xc988('0x40')]=_0x6aca8[_0xc988('0x40')];_0x4a16dc[_0xc988('0x41')]=_0x6aca8[_0xc988('0x41')];_0x4a16dc[_0xc988('0x42')]=_0x6aca8[_0xc988('0x42')];_0x4a16dc[_0xc988('0x43')]=_0x6aca8[_0xc988('0x43')];_0x4a16dc['outboundReCallsDay']=_0x6aca8[_0xc988('0x44')];_0x4a16dc[_0xc988('0x45')]=_0x6aca8[_0xc988('0x45')];_0x4a16dc[_0xc988('0x46')]=_0x6aca8[_0xc988('0x46')];_0x4a16dc[_0xc988('0x47')]=_0x6aca8[_0xc988('0x47')];_0x4a16dc[_0xc988('0x48')]=_0x6aca8[_0xc988('0x48')];_0x4a16dc[_0xc988('0x49')]=_0x6aca8['predictiveIntervalAvgTalktime'];_0x4a16dc['predictiveIntervalDroppedCallsCallersExit']=_0x6aca8[_0xc988('0x4a')];_0x4a16dc[_0xc988('0x4b')]=_0x6aca8[_0xc988('0x4b')];_0x4a16dc[_0xc988('0x4c')]=_0x6aca8[_0xc988('0x4c')];_0x4a16dc[_0xc988('0x4d')]=_0x6aca8[_0xc988('0x4d')];_0x4a16dc[_0xc988('0x4e')]=_0x6aca8['predictiveIntervalHitRate'];_0x4a16dc['predictiveIntervalLowerLimit']=_0x6aca8[_0xc988('0x4f')];_0x4a16dc['predictiveIntervalMultiplicativeFactor']=_0x6aca8[_0xc988('0x50')];_0x4a16dc[_0xc988('0x51')]=_0x6aca8[_0xc988('0x51')];_0x4a16dc[_0xc988('0x52')]=_0x6aca8[_0xc988('0x52')];_0x4a16dc[_0xc988('0x21')]=_0x6aca8[_0xc988('0x21')];_0x4a16dc['originated']=_0x6aca8[_0xc988('0x53')];}if(_0x6aca8['Trunk']){_0x4a16dc['Trunk']={'id':_0x6aca8[_0xc988('0x54')]['id'],'name':_0x6aca8[_0xc988('0x54')][_0xc988('0xc')],'active':_0x6aca8[_0xc988('0x54')][_0xc988('0x55')],'callerid':_0x6aca8[_0xc988('0x54')][_0xc988('0x56')]};}if(_0x6aca8[_0xc988('0x57')]){_0x4a16dc[_0xc988('0x57')]={'id':_0x6aca8[_0xc988('0x57')]['id'],'name':_0x6aca8[_0xc988('0x57')][_0xc988('0xc')]};}_0x452661[_0xc988('0x58')](_0x4a16dc);}}_0x40b060({'count':_0x452661[_0xc988('0x59')],'rows':_0x452661});});},'VoiceChannels':function(_0x4f8031){return new Promise(function(_0x56b5de,_0x4cee25){var _0x3a2260=_[_0xc988('0x5a')](_0x318708[_0xc988('0x5b')]);_0x56b5de({'count':_0x3a2260[_0xc988('0x59')],'rows':_0x3a2260});});},'VoiceChannelMixMonitor':function(_0x369ede){var _0x3ec279=this;return new Promise(function(_0x5b4d68,_0x5607bd){if(ami[_0xc988('0x14')]()==![]){return _0x5607bd(_0x3ec279[_0xc988('0x20')](0x1f4,[config['asterisk']['ip'],config[_0xc988('0x15')][_0xc988('0x16')],'ami\x20disconnected'][_0xc988('0x5c')]('\x20')));}var _0x1f0b06=schema(properties[_0xc988('0x5d')])['validate'](_0x369ede);if(_0x1f0b06['length']>0x0){return _0x5607bd(_0x3ec279[_0xc988('0x20')](0x1f4,_['map'](_0x1f0b06,'message')[_0xc988('0x5c')](',\x20')));}var _0x36a646=_['find'](_0x318708[_0xc988('0x5b')],{'uniqueid':_0x369ede['uniqueid']});if(_0x36a646&&_0x36a646[_0xc988('0x5e')]){var _0x18fed0=util[_0xc988('0x9')](_0xc988('0x5f'),_0x369ede[_0xc988('0x60')]||_0x369ede[_0xc988('0x61')],_0x369ede[_0xc988('0x9')]||_0xc988('0x62'));return ami[_0xc988('0x1d')]({'action':_0xc988('0x63'),'channel':_0x36a646[_0xc988('0x5e')],'file':_0x18fed0,'options':'ai(mixmonitorid)'})['then'](function(_0x1b3437){var _0xc8f510=_[_0xc988('0x64')](_0x36a646[_0xc988('0x65')],{'filename':_0xc988('0x66')+_0x18fed0[_0xc988('0x67')]()});if(_[_0xc988('0x68')](_0xc8f510)){_0x36a646[_0xc988('0x65')][_0xc988('0x58')]({'filename':_0xc988('0x66')+_0x18fed0[_0xc988('0x67')](),'createdAt':moment()[_0xc988('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x1b3437[_0xc988('0x69')],'status':'rec'});}else{_0xc8f510[_0xc988('0x69')]=_0x1b3437[_0xc988('0x69')];_0xc8f510[_0xc988('0x6a')]=_0xc988('0x6b');}_0x5b4d68({'code':0xc8,'message':[_0x369ede[_0xc988('0x61')],_0xc988('0x6c'),_0x1b3437['mixmonitorid']][_0xc988('0x5c')]('\x20'),'mixmonitorid':_0x1b3437[_0xc988('0x69')]});})[_0xc988('0x1f')](function(_0x408a98){_0x5607bd(_0x3ec279[_0xc988('0x20')](0x1f5,[_0x369ede[_0xc988('0x61')],_0x408a98[_0xc988('0x21')][_0xc988('0x67')]()][_0xc988('0x5c')]('\x20')));});}else{return _0x5607bd(_0x3ec279[_0xc988('0x20')](0x1f5,_0xc988('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x2a3307){var _0x222de9=this;return new Promise(function(_0x2c3a65,_0xcf41de){if(ami[_0xc988('0x14')]()==![]){return _0xcf41de(_0x222de9[_0xc988('0x20')](0x1f4,[config[_0xc988('0x15')]['ip'],config[_0xc988('0x15')][_0xc988('0x16')],_0xc988('0x17')][_0xc988('0x5c')]('\x20')));}var _0x5ec534=schema(properties[_0xc988('0x5d')])[_0xc988('0x2')](_0x2a3307);if(_0x5ec534[_0xc988('0x59')]>0x0){return _0xcf41de(_0x222de9[_0xc988('0x20')](0x1f4,_[_0xc988('0x6e')](_0x5ec534,_0xc988('0x21'))[_0xc988('0x5c')](',\x20')));}var _0x247c0f=_[_0xc988('0x64')](_0x318708[_0xc988('0x5b')],{'uniqueid':_0x2a3307['uniqueid']});if(_0x247c0f){return BPromise[_0xc988('0x6f')]()[_0xc988('0x1e')](function(){if(_0x247c0f[_0xc988('0x5e')]){return ami[_0xc988('0x1d')]({'action':'StopMixMonitor','channel':_0x247c0f[_0xc988('0x5e')],'mixmonitorid':_0x2a3307['mixmonitorid']})[_0xc988('0x1f')](function(_0x44dcbb){});}})[_0xc988('0x1e')](function(){if(_0x247c0f[_0xc988('0x70')]){return ami['Action']({'action':_0xc988('0x71'),'channel':_0x247c0f['destinationchannel'],'mixmonitorid':_0x2a3307[_0xc988('0x69')]})[_0xc988('0x1f')](function(_0x47c036){});}})[_0xc988('0x1e')](function(_0x4ea42b){var _0xe0d4ae=_[_0xc988('0x64')](_0x247c0f['monitors'],{'mixmonitorid':_0x2a3307['mixmonitorid']});if(_0xe0d4ae){_0xe0d4ae[_0xc988('0x6a')]='stop';}})[_0xc988('0x1e')](function(){var _0x30c274=util['format'](_0xc988('0x5f'),_0x2a3307[_0xc988('0x60')]||_0x2a3307[_0xc988('0x61')],_0x2a3307['format']||_0xc988('0x62'));var _0x848fea=_[_0xc988('0x64')](_0x247c0f['monitors'],{'filename':_0xc988('0x66')+_0x30c274[_0xc988('0x67')]()});if(_0x848fea){_0x848fea[_0xc988('0x6a')]='stop';}})[_0xc988('0x1e')](function(){_0x2c3a65({'code':0xc8,'message':[_0x2a3307['uniqueid'],_0xc988('0x72')][_0xc988('0x5c')]('\x20')});})[_0xc988('0x1f')](function(_0x1d4700){_0xcf41de(_0x222de9[_0xc988('0x20')](0x1f5,[_0x2a3307['uniqueid'],_0x1d4700[_0xc988('0x21')]['toLowerCase']()][_0xc988('0x5c')]('\x20')));});}else{return _0xcf41de(_0x222de9[_0xc988('0x20')](0x1f5,_0xc988('0x6d')));}});},'VoiceQueuesChannels':function(_0x35a65f){return new Promise(function(_0x47b6e8,_0x2efbde){var _0x5a47a0=_['values'](_0x318708[_0xc988('0x73')]);_0x47b6e8({'count':_0x5a47a0[_0xc988('0x59')],'rows':_0x5a47a0});});},'VoiceQueuesChannel':function(_0x2bc12e){var _0x2bb50e=this;return new Promise(function(_0x10b2c1,_0x2a71be){var _0x43e67f=schema(properties[_0xc988('0x74')])['validate'](_0x2bc12e);if(_0x43e67f['length']>0x0){return _0x2a71be(_0x2bb50e[_0xc988('0x20')](0x1f4,_[_0xc988('0x6e')](_0x43e67f,_0xc988('0x21'))[_0xc988('0x5c')](',\x20')));}var _0xf48721=_['find'](_0x318708[_0xc988('0x73')],{'uniqueid':_0x2bc12e['uniqueid']});if(_0xf48721){_0x10b2c1(_0xf48721);}else{return _0x2a71be(_0x2bb50e[_0xc988('0x20')](0x1f5,_0xc988('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x4b4931){var _0x1b43cf=this;return new Promise(function(_0x15f20e,_0x10b085){if(ami[_0xc988('0x14')]()==![]){return _0x10b085(_0x1b43cf['error'](0x1f4,[config[_0xc988('0x15')]['ip'],config[_0xc988('0x15')][_0xc988('0x16')],'ami\x20disconnected'][_0xc988('0x5c')]('\x20')));}var _0x434bd0=schema(properties[_0xc988('0x75')])['validate'](_0x4b4931);if(_0x434bd0[_0xc988('0x59')]>0x0){return _0x10b085(_0x1b43cf['error'](0x1f4,_[_0xc988('0x6e')](_0x434bd0,_0xc988('0x21'))[_0xc988('0x5c')](',\x20')));}var _0x56e30b=_['find'](_0x318708['queueChannels'],{'uniqueid':_0x4b4931[_0xc988('0x61')]});if(_0x56e30b&&_0x56e30b[_0xc988('0x5e')]){return ami[_0xc988('0x1d')]({'action':_0xc988('0x76'),'channel':_0x56e30b[_0xc988('0x5e')]})[_0xc988('0x1e')](function(_0x2723f7){_0x15f20e({'code':0xc8,'message':[_0x4b4931['uniqueid'],_0x2723f7[_0xc988('0x21')][_0xc988('0x67')]()][_0xc988('0x5c')]('\x20')});})[_0xc988('0x1f')](function(_0xa3a970){_0x10b085(_0x1b43cf[_0xc988('0x20')](0x1f5,[_0x4b4931['uniqueid'],_0xa3a970[_0xc988('0x21')]['toLowerCase']()][_0xc988('0x5c')]('\x20')));});}else{return _0x10b085(_0x1b43cf['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x5ad2af){var _0x733f86=this;return new Promise(function(_0xafb115,_0x28f56a){if(ami[_0xc988('0x14')]()==![]){return _0x28f56a(_0x733f86['error'](0x1f4,[config[_0xc988('0x15')]['ip'],config[_0xc988('0x15')][_0xc988('0x16')],_0xc988('0x17')][_0xc988('0x5c')]('\x20')));}var _0x136ff3=schema(properties['voicequeuechannelredirect'])[_0xc988('0x2')](_0x5ad2af);if(_0x136ff3[_0xc988('0x59')]>0x0){return _0x28f56a(_0x733f86[_0xc988('0x20')](0x1f4,_[_0xc988('0x6e')](_0x136ff3,'message')[_0xc988('0x5c')](',\x20')));}var _0x4a3938=_[_0xc988('0x64')](_0x318708[_0xc988('0x73')],{'uniqueid':_0x5ad2af['uniqueid']});if(_0x4a3938&&_0x4a3938['channel']){return ami['Action']({'action':'Redirect','channel':_0x4a3938['channel'],'exten':_0x5ad2af[_0xc988('0x77')],'context':_0x5ad2af['context']||_0x4a3938[_0xc988('0x78')],'priority':0x1})['then'](function(_0x13390b){_0xafb115({'code':0xc8,'message':[_0x5ad2af[_0xc988('0x61')],_0x13390b['message']['toLowerCase']()]['join']('\x20')});})[_0xc988('0x1f')](function(_0x2eae20){_0x28f56a(_0x733f86[_0xc988('0x20')](0x1f5,[_0x5ad2af[_0xc988('0x61')],_0x2eae20['message']['toLowerCase']()][_0xc988('0x5c')]('\x20')));});}else{return _0x28f56a(_0x733f86[_0xc988('0x20')](0x1f5,_0xc988('0x6d')));}});},'Agents':function(_0x1ef1ef){return new Promise(function(_0x49169b,_0x1f362e){var _0x11f684=_['values'](_0x318708['agents']);_0x49169b({'count':_0x11f684[_0xc988('0x59')],'rows':_0x11f684});});},'Telephones':function(_0x18201a){return new Promise(function(_0x55b17a,_0xd9e7a7){var _0x298945=_[_0xc988('0x5a')](_0x318708[_0xc988('0x79')]);_0x55b17a({'count':_0x298945[_0xc988('0x59')],'rows':_0x298945});});},'Trunks':function(_0x1fb65e){return new Promise(function(_0x5552ba,_0x58146c){var _0x560f6d=_[_0xc988('0x5a')](_0x318708[_0xc988('0x7a')]);_0x5552ba({'count':_0x560f6d['length'],'rows':_0x560f6d});});},'OutboundChannels':function(_0x591ded){return new Promise(function(_0x3c667e,_0x465ee7){var _0x3a533b=_['values'](_0x318708[_0xc988('0x7b')]);_0x3c667e({'count':_0x3a533b[_0xc988('0x59')],'rows':_0x3a533b});});},'Outbound':function(_0x3b4cce){return new Promise(function(_0x338bfa,_0x3c78ff){_0x338bfa(_0x318708['outbound']);});},'Campaigns':function(_0x285b5d){return new Promise(function(_0x418190,_0x9c71c1){var _0x3980b1=_[_0xc988('0x5a')](_0x318708[_0xc988('0x7c')]);_0x418190({'count':_0x3980b1[_0xc988('0x59')],'rows':_0x3980b1});});},'VoiceQueuesPreview':function(_0xe34ee2){var _0x2780cf=this;return new Promise(function(_0x116d45,_0x1a5288){_0x226850[_0xc988('0x7d')](_0xe34ee2['id'])['then'](function(_0x54b8f3){_0x116d45({'code':0xc8,'message':_0x54b8f3[_0xc988('0x21')]});})['catch'](function(_0x219b42){_0x1a5288(_0x2780cf[_0xc988('0x20')](0x1f4,_0x219b42[_0xc988('0x21')]));});});},'EventManager':function(_0x576a90){var _0x26199b=this;return new Promise(function(_0x16b838,_0x9047e7){if(!_0x576a90['event']){return _0x9047e7(_0x26199b[_0xc988('0x20')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xc988('0x7e')](_0xc988('0x7f')+_0x576a90[_0xc988('0x80')],_0x576a90['message']);_0x16b838({'code':0xc8,'message':_0x576a90});});},'FaxAccounts':function(_0x37a671){return new Promise(function(_0x1a3bf9,_0x4b3410){var _0x2634a2=_[_0xc988('0x5a')](_0x318708[_0xc988('0x81')]);_0x1a3bf9({'count':_0x2634a2[_0xc988('0x59')],'rows':_0x2634a2});});},'SendFax':function(_0x5db6ca){var _0x43e77c=this;return new Promise(function(_0x1b5566,_0x525936){_0x358bb3['send'](_0x5db6ca)[_0xc988('0x1e')](function(_0x272424){_0x1b5566({'code':0xc8,'message':_0x272424['message']});})['catch'](function(_0x258065){_0x525936(_0x43e77c[_0xc988('0x20')](0x1f4,_0x258065[_0xc988('0x21')]));});});},'CheckAfterSend':function(_0x463c0f){var _0x4d9dd4=this;return new Promise(function(_0x41b747,_0x2e4b50){_0x358bb3[_0xc988('0x82')](_0x463c0f)['then'](function(_0x39d6ee){_0x41b747({'code':0xc8,'message':_0x39d6ee[_0xc988('0x21')]});})[_0xc988('0x1f')](function(_0x175970){_0x2e4b50(_0x4d9dd4['error'](0x1f4,_0x175970['message']));});});}};var _0x2d411f=jayson[_0xc988('0x83')](_0x48002d)[_0xc988('0x84')]();_0x2d411f['on'](_0xc988('0x20'),function(_0x479e9e){return _0x52e2b9(_0x479e9e);});_0x2d411f['listen'](0x232a,'127.0.0.1',function(){console[_0xc988('0x85')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x2e6800('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x993f=['outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','callerid','Interval','push','channels','length','map','uniqueid','wav','MixMonitor','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','ami\x20disconnected','find','channel','StopMixMonitor','destinationchannel','status','stop','%s.%s','filename','StopMixMonitor\x20Success','values','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','emit','faxAccounts','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../properties','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','join','module','action','Reload','Action','then','message','username','pick','command','Command','content','catch','voiceQueues','hasOwnProperty','name','strategy','answered','pTalking','sumBillable','sumDuration','talking','unmanaged','abandoned','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit'];(function(_0x5ea69f,_0x1c0076){var _0x3e692d=function(_0x1b8e3c){while(--_0x1b8e3c){_0x5ea69f['push'](_0x5ea69f['shift']());}};_0x3e692d(++_0x1c0076);}(_0x993f,0x144));var _0xf993=function(_0x23e1e4,_0x41b7ef){_0x23e1e4=_0x23e1e4-0x0;var _0x445a06=_0x993f[_0x23e1e4];return _0x445a06;};'use strict';var _=require(_0xf993('0x0'));var util=require(_0xf993('0x1'));var jayson=require('jayson/promise');var schema=require(_0xf993('0x2'));var BPromise=require(_0xf993('0x3'));var moment=require(_0xf993('0x4'));var config=require('../../../config/environment');var properties=require(_0xf993('0x5'));var ami=require('../ami');exports[_0xf993('0x6')]=function(_0x4ba3c0,_0xf471a,_0x4f3bd8){return new BPromise(function(_0x593c21,_0x23614c){var _0x57baea={'QueuePause':function(_0x311edc){return new Promise(function(_0x39e067,_0x281c47){var _0x48270a=util[_0xf993('0x7')](_0xf993('0x8'),_0xf993('0x9'),_0x311edc['name']);if(_0x4ba3c0[_0xf993('0xa')]&&_0x4ba3c0[_0xf993('0xa')][_0x48270a]&&_0x4ba3c0['timers'][_0x48270a][_0xf993('0xb')]){_0x4ba3c0[_0xf993('0xa')][_0x48270a][_0xf993('0xc')]();}if(_0x4ba3c0[_0xf993('0xd')][_0x48270a]){_0x4ba3c0[_0xf993('0xd')][_0x48270a][_0xf993('0xe')]({'statePause':_0x311edc[_0xf993('0xf')]?!![]:![]});}_0x39e067({'code':0xc8,'message':_0xf993('0x10')});});},'Reload':function(_0x496e5d){var _0x3cd81b=this;return new Promise(function(_0x1f841d,_0x2a4de1){if(ami[_0xf993('0x11')]()==![]){return _0x2a4de1(_0x3cd81b[_0xf993('0x12')](0x1f4,[config[_0xf993('0x13')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0xf993('0x14')]('\x20')));}_0x496e5d=_['pick'](_0x496e5d,_['keys'](properties[_0xf993('0x15')]));_0x496e5d[_0xf993('0x16')]=_0xf993('0x17');return ami[_0xf993('0x18')](_0x496e5d)[_0xf993('0x19')](function(_0x150c63){_0x1f841d({'code':0xc8,'message':_0x150c63[_0xf993('0x1a')]});})['catch'](function(_0x134459){_0x2a4de1(_0x3cd81b[_0xf993('0x12')](0x1f5,_0x134459[_0xf993('0x1a')]));});});},'Command':function(_0xfe18a4){var _0x33b7b4=this;return new Promise(function(_0x44dad7,_0x2cd684){if(ami[_0xf993('0x11')]()==![]){return _0x2cd684(_0x33b7b4[_0xf993('0x12')](0x1f4,[config[_0xf993('0x13')]['ip'],config[_0xf993('0x13')][_0xf993('0x1b')],'ami\x20disconnected']['join']('\x20')));}_0xfe18a4=_[_0xf993('0x1c')](_0xfe18a4,_0xf993('0x1d'));_0xfe18a4[_0xf993('0x16')]=_0xf993('0x1e');return ami['Action'](_0xfe18a4)[_0xf993('0x19')](function(_0x1b400e){_0x44dad7({'code':0xc8,'message':_0x1b400e[_0xf993('0x1f')]});})[_0xf993('0x20')](function(_0xd3ae7c){_0x2cd684(_0x33b7b4[_0xf993('0x12')](0x1f5,_0xd3ae7c[_0xf993('0x1a')]));});});},'VoiceQueues':function(_0xef6c67){return new Promise(function(_0x4fafc4,_0x144d32){var _0x382d05=[];for(var _0x89282b in _0x4ba3c0[_0xf993('0x21')]){if(_0x4ba3c0['voiceQueues'][_0xf993('0x22')](_0x89282b)){var _0x531fe3=_0x4ba3c0[_0xf993('0x21')][_0x89282b];var _0x120bda={'id':_0x531fe3['id'],'name':_0x531fe3[_0xf993('0x23')],'strategy':_0x531fe3[_0xf993('0x24')],'answered':_0x531fe3[_0xf993('0x25')],'available':_0x531fe3['available'],'loggedIn':_0x531fe3['loggedIn'],'pTalking':_0x531fe3[_0xf993('0x26')],'sumBillable':_0x531fe3[_0xf993('0x27')],'sumDuration':_0x531fe3[_0xf993('0x28')],'sumHoldTime':_0x531fe3['sumHoldTime']||0x0,'talking':_0x531fe3[_0xf993('0x29')],'total':_0x531fe3['total'],'type':_0x531fe3['type'],'unmanaged':_0x531fe3[_0xf993('0x2a')],'abandoned':_0x531fe3[_0xf993('0x2b')],'waiting':_0x531fe3['waiting'],'loggedInDb':_0x531fe3[_0xf993('0x2c')]};if(_0x531fe3[_0xf993('0x2d')]===_0xf993('0x2e')){_0x120bda[_0xf993('0x2f')]=_0x531fe3[_0xf993('0x2f')];_0x120bda[_0xf993('0x30')]=_0x531fe3[_0xf993('0x30')];_0x120bda[_0xf993('0x31')]=_0x531fe3[_0xf993('0x31')];_0x120bda['dialOriginateCallerIdNumber']=_0x531fe3[_0xf993('0x32')];_0x120bda[_0xf993('0x33')]=_0x531fe3[_0xf993('0x33')];_0x120bda[_0xf993('0x34')]=_0x531fe3[_0xf993('0x34')];_0x120bda[_0xf993('0x35')]=_0x531fe3[_0xf993('0x35')];_0x120bda['outboundAnswerCallsDay']=_0x531fe3[_0xf993('0x36')];_0x120bda[_0xf993('0x37')]=_0x531fe3[_0xf993('0x37')];_0x120bda['outboundBusyCallsDay']=_0x531fe3[_0xf993('0x38')];_0x120bda[_0xf993('0x39')]=_0x531fe3[_0xf993('0x39')];_0x120bda[_0xf993('0x3a')]=_0x531fe3['outboundDropCallsDayACS'];_0x120bda[_0xf993('0x3b')]=_0x531fe3[_0xf993('0x3b')];_0x120bda[_0xf993('0x3c')]=_0x531fe3['outboundDropCallsDayTimeout'];_0x120bda[_0xf993('0x3d')]=_0x531fe3[_0xf993('0x3d')];_0x120bda[_0xf993('0x3e')]=_0x531fe3[_0xf993('0x3e')];_0x120bda[_0xf993('0x3f')]=_0x531fe3[_0xf993('0x3f')];_0x120bda['outboundReCallsDay']=_0x531fe3['outboundReCallsDay'];_0x120bda['outboundRejectCallsDay']=_0x531fe3[_0xf993('0x40')];_0x120bda[_0xf993('0x41')]=_0x531fe3['outboundUnknownCallsDay'];_0x120bda[_0xf993('0x42')]=_0x531fe3[_0xf993('0x42')];_0x120bda[_0xf993('0x43')]=_0x531fe3[_0xf993('0x43')];_0x120bda[_0xf993('0x44')]=_0x531fe3[_0xf993('0x44')];_0x120bda[_0xf993('0x45')]=_0x531fe3['predictiveIntervalDroppedCallsCallersExit'];_0x120bda[_0xf993('0x46')]=_0x531fe3[_0xf993('0x46')];_0x120bda[_0xf993('0x47')]=_0x531fe3[_0xf993('0x47')];_0x120bda[_0xf993('0x48')]=_0x531fe3[_0xf993('0x48')];_0x120bda[_0xf993('0x49')]=_0x531fe3[_0xf993('0x49')];_0x120bda['predictiveIntervalLowerLimit']=_0x531fe3[_0xf993('0x4a')];_0x120bda[_0xf993('0x4b')]=_0x531fe3[_0xf993('0x4b')];_0x120bda[_0xf993('0x4c')]=_0x531fe3[_0xf993('0x4c')];_0x120bda['predictiveIntervalTotalCalls']=_0x531fe3[_0xf993('0x4d')];_0x120bda[_0xf993('0x1a')]=_0x531fe3['message'];_0x120bda[_0xf993('0x4e')]=_0x531fe3[_0xf993('0x4e')];}if(_0x531fe3[_0xf993('0x4f')]){_0x120bda[_0xf993('0x4f')]={'id':_0x531fe3['Trunk']['id'],'name':_0x531fe3[_0xf993('0x4f')][_0xf993('0x23')],'active':_0x531fe3[_0xf993('0x4f')]['active'],'callerid':_0x531fe3[_0xf993('0x4f')][_0xf993('0x50')]};}if(_0x531fe3[_0xf993('0x51')]){_0x120bda['Interval']={'id':_0x531fe3[_0xf993('0x51')]['id'],'name':_0x531fe3[_0xf993('0x51')][_0xf993('0x23')]};}_0x382d05[_0xf993('0x52')](_0x120bda);}}_0x4fafc4({'count':_0x382d05['length'],'rows':_0x382d05});});},'VoiceChannels':function(_0x25ceb8){return new Promise(function(_0x2c3aea,_0xd1f413){var _0x42eef9=_['values'](_0x4ba3c0[_0xf993('0x53')]);_0x2c3aea({'count':_0x42eef9[_0xf993('0x54')],'rows':_0x42eef9});});},'VoiceChannelMixMonitor':function(_0x254248){var _0xbee473=this;return new Promise(function(_0x4dba2e,_0x217ef2){if(ami[_0xf993('0x11')]()==![]){return _0x217ef2(_0xbee473[_0xf993('0x12')](0x1f4,[config[_0xf993('0x13')]['ip'],config[_0xf993('0x13')][_0xf993('0x1b')],'ami\x20disconnected'][_0xf993('0x14')]('\x20')));}var _0x693bd7=schema(properties['voicechannel'])[_0xf993('0x2')](_0x254248);if(_0x693bd7['length']>0x0){return _0x217ef2(_0xbee473['error'](0x1f4,_[_0xf993('0x55')](_0x693bd7,'message')[_0xf993('0x14')](',\x20')));}var _0x5574de=_['find'](_0x4ba3c0['channels'],{'uniqueid':_0x254248['uniqueid']});if(_0x5574de&&_0x5574de['channel']){var _0x19dd7c=util[_0xf993('0x7')]('%s.%s',_0x254248['filename']||_0x254248[_0xf993('0x56')],_0x254248[_0xf993('0x7')]||_0xf993('0x57'));return ami[_0xf993('0x18')]({'action':_0xf993('0x58'),'channel':_0x5574de['channel'],'file':_0x19dd7c,'options':'ai(mixmonitorid)'})[_0xf993('0x19')](function(_0x1657c4){var _0x482985=_['find'](_0x5574de['monitors'],{'filename':_0xf993('0x59')+_0x19dd7c[_0xf993('0x5a')]()});if(_[_0xf993('0x5b')](_0x482985)){_0x5574de[_0xf993('0x5c')][_0xf993('0x52')]({'filename':_0xf993('0x59')+_0x19dd7c[_0xf993('0x5a')](),'createdAt':moment()[_0xf993('0x7')](_0xf993('0x5d')),'mixmonitorid':_0x1657c4[_0xf993('0x5e')],'status':'rec'});}else{_0x482985[_0xf993('0x5e')]=_0x1657c4['mixmonitorid'];_0x482985['status']='rec';}_0x4dba2e({'code':0xc8,'message':[_0x254248[_0xf993('0x56')],_0xf993('0x5f'),_0x1657c4[_0xf993('0x5e')]][_0xf993('0x14')]('\x20'),'mixmonitorid':_0x1657c4['mixmonitorid']});})[_0xf993('0x20')](function(_0x3c0c58){_0x217ef2(_0xbee473['error'](0x1f5,[_0x254248[_0xf993('0x56')],_0x3c0c58[_0xf993('0x1a')][_0xf993('0x5a')]()]['join']('\x20')));});}else{return _0x217ef2(_0xbee473['error'](0x1f5,_0xf993('0x60')));}});},'VoiceChannelStopMixMonitor':function(_0x193113){var _0x4da74e=this;return new Promise(function(_0x297e5e,_0x2d360e){if(ami[_0xf993('0x11')]()==![]){return _0x2d360e(_0x4da74e[_0xf993('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf993('0x1b')],_0xf993('0x61')][_0xf993('0x14')]('\x20')));}var _0x67261e=schema(properties['voicechannel'])[_0xf993('0x2')](_0x193113);if(_0x67261e['length']>0x0){return _0x2d360e(_0x4da74e['error'](0x1f4,_[_0xf993('0x55')](_0x67261e,_0xf993('0x1a'))[_0xf993('0x14')](',\x20')));}var _0x20daef=_[_0xf993('0x62')](_0x4ba3c0[_0xf993('0x53')],{'uniqueid':_0x193113[_0xf993('0x56')]});if(_0x20daef){return BPromise['resolve']()[_0xf993('0x19')](function(){if(_0x20daef[_0xf993('0x63')]){return ami[_0xf993('0x18')]({'action':_0xf993('0x64'),'channel':_0x20daef[_0xf993('0x63')],'mixmonitorid':_0x193113['mixmonitorid']})[_0xf993('0x20')](function(_0x3bcb83){});}})['then'](function(){if(_0x20daef[_0xf993('0x65')]){return ami[_0xf993('0x18')]({'action':_0xf993('0x64'),'channel':_0x20daef[_0xf993('0x65')],'mixmonitorid':_0x193113[_0xf993('0x5e')]})[_0xf993('0x20')](function(_0x4ad0af){});}})[_0xf993('0x19')](function(_0x4bbe00){var _0x4c557d=_[_0xf993('0x62')](_0x20daef[_0xf993('0x5c')],{'mixmonitorid':_0x193113[_0xf993('0x5e')]});if(_0x4c557d){_0x4c557d[_0xf993('0x66')]=_0xf993('0x67');}})[_0xf993('0x19')](function(){var _0x3e53c9=util['format'](_0xf993('0x68'),_0x193113[_0xf993('0x69')]||_0x193113['uniqueid'],_0x193113[_0xf993('0x7')]||_0xf993('0x57'));var _0x2232e2=_['find'](_0x20daef[_0xf993('0x5c')],{'filename':_0xf993('0x59')+_0x3e53c9['toLowerCase']()});if(_0x2232e2){_0x2232e2[_0xf993('0x66')]=_0xf993('0x67');}})['then'](function(){_0x297e5e({'code':0xc8,'message':[_0x193113[_0xf993('0x56')],_0xf993('0x6a')][_0xf993('0x14')]('\x20')});})[_0xf993('0x20')](function(_0x2516e2){_0x2d360e(_0x4da74e[_0xf993('0x12')](0x1f5,[_0x193113[_0xf993('0x56')],_0x2516e2[_0xf993('0x1a')][_0xf993('0x5a')]()]['join']('\x20')));});}else{return _0x2d360e(_0x4da74e['error'](0x1f5,_0xf993('0x60')));}});},'VoiceQueuesChannels':function(_0x2b91df){return new Promise(function(_0x159e20,_0x4d7682){var _0x328c78=_[_0xf993('0x6b')](_0x4ba3c0['queueChannels']);_0x159e20({'count':_0x328c78[_0xf993('0x54')],'rows':_0x328c78});});},'VoiceQueuesChannel':function(_0x13be32){var _0x20fe64=this;return new Promise(function(_0x903553,_0x3012ca){var _0x1b9ae5=schema(properties['voicequeuechannel'])['validate'](_0x13be32);if(_0x1b9ae5[_0xf993('0x54')]>0x0){return _0x3012ca(_0x20fe64[_0xf993('0x12')](0x1f4,_[_0xf993('0x55')](_0x1b9ae5,'message')[_0xf993('0x14')](',\x20')));}var _0x2f2dd2=_[_0xf993('0x62')](_0x4ba3c0[_0xf993('0x6c')],{'uniqueid':_0x13be32[_0xf993('0x56')]});if(_0x2f2dd2){_0x903553(_0x2f2dd2);}else{return _0x3012ca(_0x20fe64[_0xf993('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x9e0a8){var _0x3d8bcf=this;return new Promise(function(_0x47eba7,_0x549277){if(ami[_0xf993('0x11')]()==![]){return _0x549277(_0x3d8bcf['error'](0x1f4,[config[_0xf993('0x13')]['ip'],config[_0xf993('0x13')][_0xf993('0x1b')],_0xf993('0x61')][_0xf993('0x14')]('\x20')));}var _0x15f019=schema(properties['voicequeuechannelhangup'])[_0xf993('0x2')](_0x9e0a8);if(_0x15f019[_0xf993('0x54')]>0x0){return _0x549277(_0x3d8bcf['error'](0x1f4,_[_0xf993('0x55')](_0x15f019,'message')[_0xf993('0x14')](',\x20')));}var _0x3d4a02=_[_0xf993('0x62')](_0x4ba3c0[_0xf993('0x6c')],{'uniqueid':_0x9e0a8[_0xf993('0x56')]});if(_0x3d4a02&&_0x3d4a02['channel']){return ami[_0xf993('0x18')]({'action':_0xf993('0x6d'),'channel':_0x3d4a02['channel']})[_0xf993('0x19')](function(_0x2c25c1){_0x47eba7({'code':0xc8,'message':[_0x9e0a8['uniqueid'],_0x2c25c1[_0xf993('0x1a')][_0xf993('0x5a')]()][_0xf993('0x14')]('\x20')});})[_0xf993('0x20')](function(_0x2c0523){_0x549277(_0x3d8bcf[_0xf993('0x12')](0x1f5,[_0x9e0a8[_0xf993('0x56')],_0x2c0523[_0xf993('0x1a')][_0xf993('0x5a')]()][_0xf993('0x14')]('\x20')));});}else{return _0x549277(_0x3d8bcf[_0xf993('0x12')](0x1f5,_0xf993('0x60')));}});},'VoiceQueuesChannelRedirect':function(_0x51ee78){var _0x443f0a=this;return new Promise(function(_0x249b66,_0x59a25a){if(ami['isConnected']()==![]){return _0x59a25a(_0x443f0a['error'](0x1f4,[config[_0xf993('0x13')]['ip'],config[_0xf993('0x13')][_0xf993('0x1b')],'ami\x20disconnected']['join']('\x20')));}var _0x37969d=schema(properties[_0xf993('0x6e')])[_0xf993('0x2')](_0x51ee78);if(_0x37969d[_0xf993('0x54')]>0x0){return _0x59a25a(_0x443f0a['error'](0x1f4,_[_0xf993('0x55')](_0x37969d,_0xf993('0x1a'))[_0xf993('0x14')](',\x20')));}var _0x3f6f8f=_['find'](_0x4ba3c0[_0xf993('0x6c')],{'uniqueid':_0x51ee78['uniqueid']});if(_0x3f6f8f&&_0x3f6f8f['channel']){return ami['Action']({'action':_0xf993('0x6f'),'channel':_0x3f6f8f[_0xf993('0x63')],'exten':_0x51ee78[_0xf993('0x70')],'context':_0x51ee78[_0xf993('0x71')]||_0x3f6f8f[_0xf993('0x71')],'priority':0x1})[_0xf993('0x19')](function(_0x5f32f2){_0x249b66({'code':0xc8,'message':[_0x51ee78[_0xf993('0x56')],_0x5f32f2[_0xf993('0x1a')]['toLowerCase']()]['join']('\x20')});})[_0xf993('0x20')](function(_0x580cd4){_0x59a25a(_0x443f0a[_0xf993('0x12')](0x1f5,[_0x51ee78[_0xf993('0x56')],_0x580cd4[_0xf993('0x1a')][_0xf993('0x5a')]()][_0xf993('0x14')]('\x20')));});}else{return _0x59a25a(_0x443f0a[_0xf993('0x12')](0x1f5,_0xf993('0x60')));}});},'Agents':function(_0x17fec9){return new Promise(function(_0x1209a1,_0x1d790e){var _0x5b2b74=_[_0xf993('0x6b')](_0x4ba3c0['agents']);_0x1209a1({'count':_0x5b2b74[_0xf993('0x54')],'rows':_0x5b2b74});});},'Telephones':function(_0xd38a4f){return new Promise(function(_0x2de832,_0x1e5718){var _0x3ddb23=_[_0xf993('0x6b')](_0x4ba3c0[_0xf993('0x72')]);_0x2de832({'count':_0x3ddb23['length'],'rows':_0x3ddb23});});},'Trunks':function(_0x3d6627){return new Promise(function(_0x2f78cc,_0x3cfc62){var _0x21378f=_[_0xf993('0x6b')](_0x4ba3c0[_0xf993('0x73')]);_0x2f78cc({'count':_0x21378f[_0xf993('0x54')],'rows':_0x21378f});});},'OutboundChannels':function(_0x3c8031){return new Promise(function(_0x435fba,_0x214160){var _0x1d6adc=_[_0xf993('0x6b')](_0x4ba3c0[_0xf993('0x74')]);_0x435fba({'count':_0x1d6adc[_0xf993('0x54')],'rows':_0x1d6adc});});},'Outbound':function(_0x3ad948){return new Promise(function(_0x183aba,_0x5708f3){_0x183aba(_0x4ba3c0[_0xf993('0x2e')]);});},'Campaigns':function(_0x4fe51b){return new Promise(function(_0x24b2e6,_0x463a9f){var _0x2ffe81=_[_0xf993('0x6b')](_0x4ba3c0['campaigns']);_0x24b2e6({'count':_0x2ffe81['length'],'rows':_0x2ffe81});});},'VoiceQueuesPreview':function(_0x171f3d){var _0x19ae6d=this;return new Promise(function(_0x4a45ee,_0x4b8127){_0xf471a[_0xf993('0x75')](_0x171f3d['id'])[_0xf993('0x19')](function(_0x5debe7){_0x4a45ee({'code':0xc8,'message':_0x5debe7[_0xf993('0x1a')]});})[_0xf993('0x20')](function(_0x3ced6d){_0x4b8127(_0x19ae6d[_0xf993('0x12')](0x1f4,_0x3ced6d['message']));});});},'EventManager':function(_0x2d01c9){var _0x398890=this;return new Promise(function(_0x5c4af2,_0x553625){if(!_0x2d01c9[_0xf993('0x76')]){return _0x553625(_0x398890[_0xf993('0x12')](0x1f4,_0xf993('0x77')));}ami[_0xf993('0x78')]('custom:'+_0x2d01c9[_0xf993('0x76')],_0x2d01c9[_0xf993('0x1a')]);_0x5c4af2({'code':0xc8,'message':_0x2d01c9});});},'FaxAccounts':function(_0x4dad64){return new Promise(function(_0x4f242f,_0x2c686e){var _0x15a03e=_[_0xf993('0x6b')](_0x4ba3c0[_0xf993('0x79')]);_0x4f242f({'count':_0x15a03e[_0xf993('0x54')],'rows':_0x15a03e});});},'SendFax':function(_0x248616){var _0x3298b2=this;return new Promise(function(_0x242257,_0x32691f){_0x4f3bd8['send'](_0x248616)['then'](function(_0x17422f){_0x242257({'code':0xc8,'message':_0x17422f[_0xf993('0x1a')]});})[_0xf993('0x20')](function(_0x4edaf7){_0x32691f(_0x3298b2['error'](0x1f4,_0x4edaf7[_0xf993('0x1a')]));});});},'CheckAfterSend':function(_0x5c645d){var _0x5f1b30=this;return new Promise(function(_0x5478f0,_0x53386e){_0x4f3bd8[_0xf993('0x7a')](_0x5c645d)[_0xf993('0x19')](function(_0x578885){_0x5478f0({'code':0xc8,'message':_0x578885[_0xf993('0x1a')]});})['catch'](function(_0x5241c0){_0x53386e(_0x5f1b30[_0xf993('0x12')](0x1f4,_0x5241c0['message']));});});}};var _0x466a20=jayson['server'](_0x57baea)[_0xf993('0x7b')]();_0x466a20['on'](_0xf993('0x12'),function(_0x32ddcf){return _0x23614c(_0x32ddcf);});_0x466a20['listen'](0x232a,_0xf993('0x7c'),function(){console[_0xf993('0x7d')](_0xf993('0x7e'),0x232a);return _0x593c21(_0xf993('0x7f')+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 6622a47..62539e5 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 _0x6080=['../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','','uniqueid','destcalleridname','destcalleridnum','phone','resolve','then','showContact','xmd-contactid2','format','name','trigger:%s','action','toLowerCase','createContact','user:%s','merge','catch','error','Error\x20creating\x20contact','bluebird','util','lodash'];(function(_0x3bc6cc,_0x5511eb){var _0x4a277c=function(_0x177aa9){while(--_0x177aa9){_0x3bc6cc['push'](_0x3bc6cc['shift']());}};_0x4a277c(++_0x5511eb);}(_0x6080,0xf9));var _0x0608=function(_0x12e7e4,_0x37111e){_0x12e7e4=_0x12e7e4-0x0;var _0x2a5f75=_0x6080[_0x12e7e4];return _0x2a5f75;};'use strict';var BPromise=require(_0x0608('0x0'));var util=require(_0x0608('0x1'));var _=require(_0x0608('0x2'));var Redis=require('ioredis');var config=require(_0x0608('0x3'));var logger=require(_0x0608('0x4'))(_0x0608('0x5'));var cmContactRpc=require(_0x0608('0x6'));config[_0x0608('0x7')]=_[_0x0608('0x8')](config[_0x0608('0x7')],{'host':_0x0608('0x9'),'port':0x18eb});var io=require(_0x0608('0xa'))(new Redis(config[_0x0608('0x7')]));function emit(_0x41cb2e,_0x105caf,_0x1d8c04){logger[_0x0608('0xb')](_0x41cb2e,_0x105caf,JSON[_0x0608('0xc')](_0x1d8c04));io['to'](_0x41cb2e)[_0x0608('0xd')](_0x105caf,_0x1d8c04);}exports[_0x0608('0xe')]=function(_0x5254e3,_0x99d8d1,_0x38839d){_0x38839d[_0x0608('0xf')]=0x0;if(_0x99d8d1[_0x0608('0x10')]&&parseInt(_0x99d8d1['data2'],0xa)){var _0x399462={'ListId':parseInt(_0x99d8d1[_0x0608('0x11')],0xa),'phone':_0x38839d[_0x0608('0x12')]};if(_[_0x0608('0x13')](_0x38839d[_0x0608('0x14')])){_0x399462[_0x0608('0x15')]=_0x38839d['calleridname']&&_0x38839d['calleridname']!==_0x0608('0x16')?_0x38839d['calleridname']:_0x38839d['calleridnum']||_0x38839d[_0x0608('0x17')];}else{_0x399462[_0x0608('0x15')]=_0x38839d[_0x0608('0x18')]&&_0x38839d[_0x0608('0x18')]!==_0x0608('0x16')?_0x38839d[_0x0608('0x18')]:_0x38839d[_0x0608('0x19')]||_0x38839d['uniqueid'];_0x399462[_0x0608('0x1a')]=_0x38839d['destcalleridname']&&_0x38839d[_0x0608('0x18')]!==_0x0608('0x16')?_0x38839d[_0x0608('0x18')]:_0x38839d['destcalleridnum']||_0x38839d[_0x0608('0x17')];}BPromise[_0x0608('0x1b')]()[_0x0608('0x1c')](cmContactRpc[_0x0608('0x1d')]({'where':_['omit'](_0x399462,[_0x0608('0x15')])}))[_0x0608('0x1c')](function(_0x4d17d3){if(_0x4d17d3){_0x38839d[_0x0608('0x1e')]=_0x4d17d3['id'];emit(util[_0x0608('0x1f')]('user:%s',_0x5254e3[_0x0608('0x20')]),util[_0x0608('0x1f')](_0x0608('0x21'),_0x99d8d1[_0x0608('0x22')][_0x0608('0x23')]()),_['merge'](_0x38839d,{'ListId':parseInt(_0x99d8d1[_0x0608('0x11')],0xa)}));return;}else{return BPromise['resolve']()[_0x0608('0x1c')](cmContactRpc[_0x0608('0x24')](_0x399462));}})[_0x0608('0x1c')](function(_0x34477f){if(_0x34477f){_0x38839d[_0x0608('0x1e')]=_0x34477f['id'];emit(util['format'](_0x0608('0x25'),_0x5254e3['name']),util['format'](_0x0608('0x21'),_0x99d8d1[_0x0608('0x22')][_0x0608('0x23')]()),_[_0x0608('0x26')](_0x38839d,{'ListId':parseInt(_0x99d8d1[_0x0608('0x11')],0xa)}));}})[_0x0608('0x27')](function(_0x56006e){logger[_0x0608('0x28')](_0x0608('0x29'),JSON['stringify'](_0x56006e));});}else{if(_0x5254e3){emit(util['format'](_0x0608('0x25'),_0x5254e3[_0x0608('0x20')]),util[_0x0608('0x1f')](_0x0608('0x21'),_0x99d8d1[_0x0608('0x22')][_0x0608('0x23')]()),_[_0x0608('0x26')]({'ListId':parseInt(_0x99d8d1[_0x0608('0x11')],0xa)},_0x38839d));}}}; \ No newline at end of file +var _0x7bf5=['emit','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','calleridname','','destcalleridname','destcalleridnum','uniqueid','then','showContact','omit','xmd-contactid2','format','user:%s','trigger:%s','action','toLowerCase','merge','name','catch','error','Error\x20creating\x20contact','bluebird','lodash','ioredis','../../../../config/logger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7bf5,0x11e));var _0x57bf=function(_0x3a7972,_0x47dff9){_0x3a7972=_0x3a7972-0x0;var _0x4633be=_0x7bf5[_0x3a7972];return _0x4633be;};'use strict';var BPromise=require(_0x57bf('0x0'));var util=require('util');var _=require(_0x57bf('0x1'));var Redis=require(_0x57bf('0x2'));var config=require('../../../../config/environment');var logger=require(_0x57bf('0x3'))('trigger');var cmContactRpc=require(_0x57bf('0x4'));config[_0x57bf('0x5')]=_['defaults'](config[_0x57bf('0x5')],{'host':_0x57bf('0x6'),'port':0x18eb});var io=require(_0x57bf('0x7'))(new Redis(config[_0x57bf('0x5')]));function emit(_0x256481,_0x54d124,_0x53f294){logger[_0x57bf('0x8')](_0x256481,_0x54d124,JSON[_0x57bf('0x9')](_0x53f294));io['to'](_0x256481)[_0x57bf('0xa')](_0x54d124,_0x53f294);}exports['exec']=function(_0x45c039,_0xedbac3,_0x2e9ce5){_0x2e9ce5[_0x57bf('0xb')]=0x0;if(_0xedbac3[_0x57bf('0xc')]&&parseInt(_0xedbac3[_0x57bf('0xc')],0xa)){var _0x1dfe3c={'ListId':parseInt(_0xedbac3[_0x57bf('0xd')],0xa),'phone':_0x2e9ce5[_0x57bf('0xe')]};if(_[_0x57bf('0xf')](_0x2e9ce5[_0x57bf('0x10')])){_0x1dfe3c[_0x57bf('0x11')]=_0x2e9ce5[_0x57bf('0x12')]&&_0x2e9ce5['calleridname']!==_0x57bf('0x13')?_0x2e9ce5['calleridname']:_0x2e9ce5['calleridnum']||_0x2e9ce5['uniqueid'];}else{_0x1dfe3c['firstName']=_0x2e9ce5[_0x57bf('0x14')]&&_0x2e9ce5[_0x57bf('0x14')]!==''?_0x2e9ce5['destcalleridname']:_0x2e9ce5[_0x57bf('0x15')]||_0x2e9ce5[_0x57bf('0x16')];_0x1dfe3c['phone']=_0x2e9ce5[_0x57bf('0x14')]&&_0x2e9ce5[_0x57bf('0x14')]!==_0x57bf('0x13')?_0x2e9ce5[_0x57bf('0x14')]:_0x2e9ce5[_0x57bf('0x15')]||_0x2e9ce5['uniqueid'];}BPromise['resolve']()[_0x57bf('0x17')](cmContactRpc[_0x57bf('0x18')]({'where':_[_0x57bf('0x19')](_0x1dfe3c,[_0x57bf('0x11')])}))[_0x57bf('0x17')](function(_0x26a181){if(_0x26a181){_0x2e9ce5[_0x57bf('0x1a')]=_0x26a181['id'];emit(util[_0x57bf('0x1b')](_0x57bf('0x1c'),_0x45c039['name']),util[_0x57bf('0x1b')](_0x57bf('0x1d'),_0xedbac3[_0x57bf('0x1e')][_0x57bf('0x1f')]()),_[_0x57bf('0x20')](_0x2e9ce5,{'ListId':parseInt(_0xedbac3['data1'],0xa)}));return;}else{return BPromise['resolve']()[_0x57bf('0x17')](cmContactRpc['createContact'](_0x1dfe3c));}})[_0x57bf('0x17')](function(_0x3f5fd4){if(_0x3f5fd4){_0x2e9ce5[_0x57bf('0x1a')]=_0x3f5fd4['id'];emit(util[_0x57bf('0x1b')](_0x57bf('0x1c'),_0x45c039[_0x57bf('0x21')]),util[_0x57bf('0x1b')]('trigger:%s',_0xedbac3[_0x57bf('0x1e')][_0x57bf('0x1f')]()),_[_0x57bf('0x20')](_0x2e9ce5,{'ListId':parseInt(_0xedbac3['data1'],0xa)}));}})[_0x57bf('0x22')](function(_0x559186){logger[_0x57bf('0x23')](_0x57bf('0x24'),JSON['stringify'](_0x559186));});}else{if(_0x45c039){emit(util[_0x57bf('0x1b')](_0x57bf('0x1c'),_0x45c039[_0x57bf('0x21')]),util[_0x57bf('0x1b')]('trigger:%s',_0xedbac3[_0x57bf('0x1e')]['toLowerCase']()),_[_0x57bf('0x20')]({'ListId':parseInt(_0xedbac3[_0x57bf('0xd')],0xa)},_0x2e9ce5));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 5254dbd..942fbec 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 _0x5b02=['search','AllConditions','every','channel','some','AnyConditions','checkConditions','field','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','event','queue','lastevent','exports','util','lodash','url','mustache','./integration','../rpc/cmContact','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:queuecallerabandon','custom:dialconnect','custom:dialend','custom:newinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','stringify','clone','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','interface','action','toLowerCase','contactmanager','motionbar','data1','popup','data2','html','render','uri','buildUri','data3','isNil','data4','location','uriLocation','data5','800','windowHeight','data6','600','winApplication','winArguments','user:%s','name','trigger:%s:%s','jscripty','format','trigger:%s','integration','routeId','urlforward','exec','parse'];(function(_0x45e08e,_0x4e2af0){var _0x366232=function(_0x46a720){while(--_0x46a720){_0x45e08e['push'](_0x45e08e['shift']());}};_0x366232(++_0x4e2af0);}(_0x5b02,0xe9));var _0x25b0=function(_0x1a8357,_0x9b8d55){_0x1a8357=_0x1a8357-0x0;var _0x392f46=_0x5b02[_0x1a8357];return _0x392f46;};'use strict';var util=require(_0x25b0('0x0'));var _=require(_0x25b0('0x1'));var url=require(_0x25b0('0x2'));var Mustache=require(_0x25b0('0x3'));var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require(_0x25b0('0x4'));var cmContact=require('./cmContact');var cmContactRpc=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var logger=require(_0x25b0('0x7'))(_0x25b0('0x8'));var ami=require(_0x25b0('0x9'));config['redis']=_[_0x25b0('0xa')](config[_0x25b0('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x25b0('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x56feca,_0x24f98b){return _0x56feca==_0x24f98b;},'not_equals':function(_0x45429b,_0x358af0){return _0x45429b!=_0x358af0;}};var barAndWebActions=['popup',_0x25b0('0x2'),_0x25b0('0xd')];function Trigger(_0x135afb){this[_0x25b0('0xe')]=_0x135afb[_0x25b0('0xe')];this[_0x25b0('0xf')]=_0x135afb[_0x25b0('0xf')];this[_0x25b0('0x10')]=_0x135afb[_0x25b0('0x10')];this[_0x25b0('0x11')]=_0x135afb[_0x25b0('0x11')];this[_0x25b0('0x12')]=_0x135afb[_0x25b0('0x12')];this[_0x25b0('0x13')]=_0x135afb[_0x25b0('0x13')];this[_0x25b0('0x14')]=_0x135afb[_0x25b0('0x14')];this[_0x25b0('0x15')]=_0x135afb[_0x25b0('0x15')];this[_0x25b0('0x16')]=_0x135afb[_0x25b0('0x16')];this['zohoAccounts']=_0x135afb['zohoAccounts'];this[_0x25b0('0x17')]=_0x135afb['deskAccounts'];this[_0x25b0('0x18')]=_0x135afb[_0x25b0('0x18')];this[_0x25b0('0x19')]=_0x135afb[_0x25b0('0x19')];this['dynamics365Accounts']=_0x135afb[_0x25b0('0x1a')];this[_0x25b0('0x1b')]={'zendesk':this[_0x25b0('0x13')],'salesforce':this[_0x25b0('0x15')],'freshdesk':this[_0x25b0('0x14')],'sugarcrm':this[_0x25b0('0x16')],'zoho':this['zohoAccounts'],'desk':this[_0x25b0('0x17')],'vtiger':this[_0x25b0('0x18')],'servicenow':this[_0x25b0('0x19')],'dynamics365':this[_0x25b0('0x1a')]};ami['on'](_0x25b0('0x1c'),this[_0x25b0('0x1d')][_0x25b0('0x1e')](this));ami['on'](_0x25b0('0x1f'),this[_0x25b0('0x1d')][_0x25b0('0x1e')](this));ami['on'](_0x25b0('0x20'),this[_0x25b0('0x1d')]['bind'](this));ami['on'](_0x25b0('0x21'),this[_0x25b0('0x1d')]['bind'](this));ami['on'](_0x25b0('0x22'),this[_0x25b0('0x1d')][_0x25b0('0x1e')](this));ami['on']('custom:dialbegin',this['syncCustomEvent']['bind'](this));ami['on'](_0x25b0('0x23'),this[_0x25b0('0x1d')][_0x25b0('0x1e')](this));ami['on'](_0x25b0('0x24'),this[_0x25b0('0x1d')][_0x25b0('0x1e')](this));ami['on'](_0x25b0('0x25'),this[_0x25b0('0x1d')][_0x25b0('0x1e')](this));ami['on']('custom:closedinteraction',this[_0x25b0('0x1d')][_0x25b0('0x1e')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0x25b0('0x26'),this[_0x25b0('0x1d')][_0x25b0('0x1e')](this));ami['on'](_0x25b0('0x27'),this[_0x25b0('0x1d')][_0x25b0('0x1e')](this));ami['on'](_0x25b0('0x28'),this[_0x25b0('0x1d')][_0x25b0('0x1e')](this));}Trigger[_0x25b0('0x29')][_0x25b0('0x2a')]=function(_0x3161c1,_0x1ea374,_0x4f640f){logger['info'](_0x3161c1,_0x1ea374,JSON[_0x25b0('0x2b')](_0x4f640f));io['to'](_0x3161c1)['emit'](_0x1ea374,_0x4f640f);};Trigger['prototype'][_0x25b0('0x1d')]=function(_0x419975){var _0x46c5e8=_[_0x25b0('0x2c')](_0x419975);this[_0x25b0('0x2d')](_0x46c5e8);};Trigger['prototype'][_0x25b0('0x2d')]=function(_0x3636be){var _0x4dad3a;for(var _0x13ce9 in this[_0x25b0('0xe')]){if(this['triggers'][_0x25b0('0x2e')](_0x13ce9)){if(this['triggers'][_0x13ce9][_0x25b0('0x2f')]){_0x4dad3a=this[_0x25b0('0x30')](this[_0x25b0('0xe')][_0x13ce9],_0x3636be);if(_0x4dad3a){_[_0x25b0('0x31')](_0x3636be,_0x3636be[_0x25b0('0x32')]);for(var _0x1587a7=0x0,_0x12ce86,_0x206186,_0x2f123c;_0x1587a70x0){_0x5bca7f=_[_0xdb35('0x2b')](_0x14a645,_0x2f67e8);}return _0x5bca7f;}function getCustomFields(_0x8f6c7b,_0x5923af){var _0xe8859a=[];var _0x28aa44={'custom_fields':{}};if(_0x8f6c7b[_0xdb35('0x2c')]>0x0){_[_0xdb35('0x2d')](_0x8f6c7b,function(_0x45fcb5){if(_0x45fcb5[_0xdb35('0x2e')]===_0xdb35('0x2f')&&_0x45fcb5[_0xdb35('0x30')]&&!_0x45fcb5[_0xdb35('0x31')]){_0x28aa44[_0x45fcb5[_0xdb35('0x30')][_0xdb35('0x32')]()]=_0x45fcb5[_0xdb35('0x33')][_0xdb35('0x34')]();}else if(_0x45fcb5[_0xdb35('0x2e')]===_0xdb35('0x2f')&&_0x45fcb5[_0xdb35('0x35')]&&_0x45fcb5[_0xdb35('0x31')]){_0x28aa44[_0xdb35('0x36')][_0x45fcb5[_0xdb35('0x35')]]=_0x45fcb5[_0xdb35('0x33')][_0xdb35('0x34')]();}else if(_0x45fcb5['type']==='variable'&&_0x45fcb5['variableName']&&_0x45fcb5['idField']&&_0x45fcb5[_0xdb35('0x31')]){_0x5923af[_0x45fcb5['variableName']]&&(_0x28aa44[_0xdb35('0x36')][_0x45fcb5[_0xdb35('0x35')]]=_0x5923af[_0x45fcb5[_0xdb35('0x37')]][_0xdb35('0x34')]());}else if(_0x45fcb5[_0xdb35('0x2e')]===_0xdb35('0x38')&&_0x45fcb5[_0xdb35('0x39')]&&_0x45fcb5[_0xdb35('0x39')]['name']&&_0x45fcb5[_0xdb35('0x35')]&&_0x45fcb5[_0xdb35('0x31')]){_0x5923af[_0x45fcb5[_0xdb35('0x39')][_0xdb35('0x3a')]['toLowerCase']()]&&(_0x28aa44[_0xdb35('0x36')][_0x45fcb5[_0xdb35('0x35')]]=_0x5923af[_0x45fcb5[_0xdb35('0x39')][_0xdb35('0x3a')][_0xdb35('0x32')]()]['toString']());}});}if(_0x28aa44[_0xdb35('0x3b')]){_0x28aa44[_0xdb35('0x3b')]=Number(_0x28aa44[_0xdb35('0x3b')]);}return _0x28aa44;}function getTicket(_0x1e13d5,_0x24bfd8,_0x4873ad,_0x9f8593,_0x160d0a){logger[_0xdb35('0xe')](_0xdb35('0x3c'));var _0xa675ab=_[_0xdb35('0x3d')]({'subject':intUtil['getString'](_0x9f8593[_0xdb35('0x3e')],_0x160d0a,'\x20'),'type':_0xdb35('0x3f'),'status':'new','labels':[_0xdb35('0x40'),_0xdb35('0x41'),_0xdb35('0x42')][_0xdb35('0x43')](getTags(_0x9f8593[_0xdb35('0x44')],_0xdb35('0x3a'))),'description':intUtil[_0xdb35('0x45')](_0x9f8593[_0xdb35('0x46')],_0x160d0a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xdb35('0x18')](_0xdb35('0x47'),_0x24bfd8['id']),'class':_0xdb35('0x48')}},'message':{'direction':'in','body':intUtil['getString'](_0x9f8593['Descriptions'],_0x160d0a,'\x0a')}},getCustomFields(_0x9f8593[_0xdb35('0x49')],_0x160d0a));return request({'uri':util[_0xdb35('0x18')](_0xdb35('0x4a'),_0x1e13d5[_0xdb35('0x11')],_0x4873ad['id']),'method':_0xdb35('0x29'),'body':_0xa675ab});}exports['queue']=function(_0x3f4e04,_0x2939a1,_0x2f0b0a,_0x3139f1,_0x42cc10,_0x2c0a9a){var _0x2d2ee1,_0x2b4f83;_0x2c0a9a[_0xdb35('0x11')]=intUtil[_0xdb35('0x4b')](_0x2c0a9a[_0xdb35('0x11')]);_0x2c0a9a[_0xdb35('0x4c')]=intUtil[_0xdb35('0x4b')](_0x2c0a9a[_0xdb35('0x4c')]);if(_0x42cc10&&_0x42cc10[_0xdb35('0x4d')]){logger['info'](_0xdb35('0x4e'),_0xdb35('0x4f'));_0x2939a1[_0xdb35('0x50')]=util[_0xdb35('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c0a9a[_0xdb35('0x4c')],_0x2939a1[_0xdb35('0x51')],md5(_0x2939a1['uniqueid']));}else{_0x2939a1[_0xdb35('0x50')]='';}headers[_0xdb35('0x52')]=getAuth(_0x2c0a9a);return getUser(_0x2c0a9a,_0x3139f1['email'])[_0xdb35('0x12')](function(_0xe8757e){_0x2d2ee1=_0xe8757e;logger[_0xdb35('0xe')](_0xdb35('0x53'),_0x2d2ee1['id']);return getEndUser(_0x2c0a9a,_0x2939a1[_0xdb35('0x54')],_0x2939a1['calleridnum']);})['then'](function(_0x599d9d){_0x2b4f83=_0x599d9d;logger[_0xdb35('0xe')]('The\x20Enduser\x20ID\x20is:',_0x2b4f83['id']);return getTicket(_0x2c0a9a,_0x2d2ee1,_0x2b4f83,_0x2f0b0a,_0x2939a1);})[_0xdb35('0x12')](function(_0x528588){if(_0x528588){logger[_0xdb35('0xe')](_0xdb35('0x55'));logger[_0xdb35('0xe')](_0xdb35('0x56'),_0x528588['id']);switch(_0x2c0a9a[_0xdb35('0x2e')]){case _0xdb35('0x57'):logger[_0xdb35('0xe')](_0xdb35('0x4e'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xdb35('0x18')](_0xdb35('0x58'),_0x3139f1[_0xdb35('0x3a')]),_0xdb35('0x59'),{'recordId':_0x528588['id']});break;case'newTab':logger[_0xdb35('0xe')](_0xdb35('0x4e'),_0xdb35('0x5a'));emit(util[_0xdb35('0x18')]('user:%s',_0x3139f1[_0xdb35('0x3a')]),'trigger:browser:url',{'uri':util[_0xdb35('0x18')](_0xdb35('0x5b'),_0x528588['id'])});break;default:logger[_0xdb35('0x5c')](_0xdb35('0x4e'),_0xdb35('0x5d'));}}})[_0xdb35('0x5e')](function(_0x48a3f3){console[_0xdb35('0x5c')](_0x48a3f3);logger[_0xdb35('0x5c')](_0xdb35('0x4e'),JSON[_0xdb35('0x1d')](_0x48a3f3));});};exports[_0xdb35('0x5f')]=function(_0x106feb,_0x2d49f4,_0x42709e,_0x256587,_0x557b36,_0x116612,_0x10c0f){var _0x2e67c4,_0x18db4b;_0x116612['remoteUri']=intUtil['stripTrailingSlash'](_0x116612['remoteUri']);_0x116612[_0xdb35('0x4c')]=intUtil[_0xdb35('0x4b')](_0x116612['serverUrl']);if(_0x10c0f&&_0x10c0f['recordingFormat']&&_0x10c0f['recordingFormat']!==_0xdb35('0x60')){logger[_0xdb35('0xe')](_0xdb35('0x61'),'Recording\x20is\x20enabled!');_0x2d49f4[_0xdb35('0x50')]=util[_0xdb35('0x18')](_0xdb35('0x62'),_0x116612[_0xdb35('0x4c')],_0x2d49f4[_0xdb35('0x51')],md5(_0x2d49f4[_0xdb35('0x51')]));}headers[_0xdb35('0x52')]=getAuth(_0x116612);return getUser(_0x116612,_0x256587['email'])['then'](function(_0xbc6cb9){_0x2e67c4=_0xbc6cb9;logger[_0xdb35('0xe')](_0xdb35('0x53'),_0x2e67c4['id']);return getEndUser(_0x116612,_0x2d49f4[_0xdb35('0x63')],_0x2d49f4[_0xdb35('0x64')]);})[_0xdb35('0x12')](function(_0x33f300){_0x18db4b=_0x33f300;logger['info'](_0xdb35('0x65'),_0x18db4b['id']);return getTicket(_0x116612,_0x2e67c4,_0x18db4b,_0x42709e,_0x2d49f4);})[_0xdb35('0x12')](function(_0x509e4c){if(_0x509e4c){logger['info'](_0xdb35('0x55'));logger[_0xdb35('0xe')](_0xdb35('0x56'),_0x509e4c['id']);switch(_0x116612[_0xdb35('0x2e')]){case _0xdb35('0x57'):logger[_0xdb35('0xe')](_0xdb35('0x4e'),_0xdb35('0x66'));emit(util[_0xdb35('0x18')](_0xdb35('0x58'),_0x256587[_0xdb35('0x3a')]),_0xdb35('0x59'),{'recordId':_0x509e4c['id']});break;case _0xdb35('0x67'):logger[_0xdb35('0xe')](_0xdb35('0x4e'),_0xdb35('0x5a'));emit(util['format'](_0xdb35('0x58'),_0x256587[_0xdb35('0x3a')]),_0xdb35('0x68'),{'uri':util['format'](_0xdb35('0x69'),_0x116612[_0xdb35('0x11')],_0x509e4c['id'])});break;default:logger[_0xdb35('0x5c')](_0xdb35('0x61'),_0xdb35('0x5d'));}}})[_0xdb35('0x5e')](function(_0x187dff){logger[_0xdb35('0x5c')](_0xdb35('0x61'),JSON['stringify'](_0x187dff));});};exports[_0xdb35('0x6a')]=function(_0x31a701,_0x1dad49,_0x68a9ad,_0x349729,_0x562567,_0x556bd5){var _0x3c37ab,_0x1c109d;_0x556bd5['remoteUri']=intUtil[_0xdb35('0x4b')](_0x556bd5['remoteUri']);_0x556bd5[_0xdb35('0x4c')]=intUtil[_0xdb35('0x4b')](_0x556bd5['serverUrl']);if(_0x562567&&_0x562567[_0xdb35('0x4d')]){logger[_0xdb35('0xe')](_0xdb35('0x6b'),_0xdb35('0x4f'));_0x1dad49[_0xdb35('0x50')]=util['format'](_0xdb35('0x62'),_0x556bd5[_0xdb35('0x4c')],_0x1dad49[_0xdb35('0x51')],md5(_0x1dad49['uniqueid']));}else{_0x1dad49[_0xdb35('0x50')]='';}headers[_0xdb35('0x52')]=getAuth(_0x556bd5);return getUser(_0x556bd5)[_0xdb35('0x12')](function(_0x212abb){_0x3c37ab=_0x212abb;logger[_0xdb35('0xe')](_0xdb35('0x53'),_0x3c37ab['id']);return getEndUser(_0x556bd5,_0x1dad49[_0xdb35('0x54')],_0x1dad49['calleridnum']);})[_0xdb35('0x12')](function(_0x52f047){_0x1c109d=_0x52f047;logger[_0xdb35('0xe')](_0xdb35('0x65'),_0x1c109d['id']);return getTicket(_0x556bd5,_0x3c37ab,_0x1c109d,_0x68a9ad,_0x1dad49);})['then'](function(_0x3be53b){if(_0x3be53b){logger[_0xdb35('0xe')](_0xdb35('0x55'));logger[_0xdb35('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3be53b['id']);}})[_0xdb35('0x5e')](function(_0xd57759){logger[_0xdb35('0x5c')](_0xdb35('0x6b'),JSON[_0xdb35('0x1d')](_0xd57759));});}; \ No newline at end of file +var _0xcfd8=['destcalleridnum','The\x20Ticket\x20ID\x20is:','trigger:desk:display','%s/agent/tickets/%s','[OUTBOUND]','Desk\x20account\x20type\x20not\x20recognized','[ABANDONED]','calleridnum','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','application/json','validateEmail','info','format','%s/users','remoteUri','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','total_entries','Enduser\x20found!','%s/customers','POST','length','forEach','string','nameField','customField','toLowerCase','content','type','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','merge','Subjects','phone','new','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stripTrailingSlash','recordingFormat','none','destcalleridname'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcfd8,0xdc));var _0x8cfd=function(_0x1f9503,_0x8e450b){_0x1f9503=_0x1f9503-0x0;var _0xaab94f=_0xcfd8[_0x1f9503];return _0xaab94f;};'use strict';var _=require(_0x8cfd('0x0'));var rp=require(_0x8cfd('0x1'));var md5=require(_0x8cfd('0x2'));var util=require(_0x8cfd('0x3'));var Redis=require(_0x8cfd('0x4'));var intUtil=require(_0x8cfd('0x5'));var config=require(_0x8cfd('0x6'));var logger=require(_0x8cfd('0x7'))('desk');config[_0x8cfd('0x8')]=_[_0x8cfd('0x9')](config[_0x8cfd('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x8cfd('0xa'))(new Redis(config[_0x8cfd('0x8')]));function emit(_0x490ea0,_0x4af9f2,_0x2dd7ab){io['to'](_0x490ea0)['emit'](_0x4af9f2,_0x2dd7ab);}var headers={'Content-Type':_0x8cfd('0xb'),'Accept':_0x8cfd('0xb')};function getUser(_0xf1c68f,_0x36df6a){if(intUtil[_0x8cfd('0xc')](_0x36df6a)===!![]){logger[_0x8cfd('0xd')]('Getting\x20agent\x20with\x20email',_0x36df6a);return request({'uri':util[_0x8cfd('0xe')](_0x8cfd('0xf'),_0xf1c68f[_0x8cfd('0x10')])})[_0x8cfd('0x11')](function(_0x61e40a){if(_0x61e40a['total_entries']){return _[_0x8cfd('0x12')](_0x61e40a[_0x8cfd('0x13')][_0x8cfd('0x14')],{'email':_0x36df6a});}})[_0x8cfd('0x11')](function(_0x1ed21b){if(_0x1ed21b){logger[_0x8cfd('0xd')](_0x8cfd('0x15'));return _0x1ed21b;}else{logger[_0x8cfd('0xd')](_0x8cfd('0x16'));return request({'uri':util[_0x8cfd('0xe')](_0x8cfd('0x17'),_0xf1c68f[_0x8cfd('0x10')])});}});}else{logger[_0x8cfd('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x8cfd('0x17'),_0xf1c68f['remoteUri'])});}}function request(_0x268f56){logger[_0x8cfd('0x18')]('[HTTP]',JSON[_0x8cfd('0x19')](_0x268f56));return rp(_[_0x8cfd('0x9')](_0x268f56,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x1680e1){var _0x1402f8;if(_0x1680e1[_0x8cfd('0x1a')]==='basic'){_0x1402f8=util['format'](_0x8cfd('0x1b'),_0x1680e1[_0x8cfd('0x1c')],_0x1680e1['password']);}else if(_0x1680e1[_0x8cfd('0x1a')]===_0x8cfd('0x1d')){_0x1402f8=util['format'](_0x8cfd('0x1e'),_0x1680e1[_0x8cfd('0x1c')],_0x1680e1[_0x8cfd('0x1d')]);}return util[_0x8cfd('0xe')]('Basic\x20%s',new Buffer(_0x1402f8)[_0x8cfd('0x1f')](_0x8cfd('0x20')));}function getEndUser(_0x39d9b8,_0x54e2f6,_0x174af8){logger[_0x8cfd('0xd')](_0x8cfd('0x21'),_0x174af8);return request({'uri':util['format'](_0x8cfd('0x22'),_0x39d9b8[_0x8cfd('0x10')]),'qs':{'phone':_0x174af8}})[_0x8cfd('0x11')](function(_0x7a34ad){if(_0x7a34ad[_0x8cfd('0x23')]){logger[_0x8cfd('0xd')](_0x8cfd('0x24'));return _0x7a34ad[_0x8cfd('0x13')][_0x8cfd('0x14')][0x0];}else{logger[_0x8cfd('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x8cfd('0xe')](_0x8cfd('0x25'),_0x39d9b8[_0x8cfd('0x10')]),'method':_0x8cfd('0x26'),'body':{'first_name':_0x54e2f6,'title':_0x54e2f6,'phone_numbers':[{'type':'work','value':_0x174af8}]}});}});}function getTags(_0x57e19d,_0x55fdd8){var _0x55b851=[];if(_0x57e19d&&_0x57e19d[_0x8cfd('0x27')]>0x0){_0x55b851=_['map'](_0x57e19d,_0x55fdd8);}return _0x55b851;}function getCustomFields(_0x42f720,_0x49d358){var _0x2d08af=[];var _0x4ea367={'custom_fields':{}};if(_0x42f720[_0x8cfd('0x27')]>0x0){_[_0x8cfd('0x28')](_0x42f720,function(_0x1ed254){if(_0x1ed254['type']===_0x8cfd('0x29')&&_0x1ed254[_0x8cfd('0x2a')]&&!_0x1ed254[_0x8cfd('0x2b')]){_0x4ea367[_0x1ed254['nameField'][_0x8cfd('0x2c')]()]=_0x1ed254[_0x8cfd('0x2d')]['toString']();}else if(_0x1ed254[_0x8cfd('0x2e')]===_0x8cfd('0x29')&&_0x1ed254[_0x8cfd('0x2f')]&&_0x1ed254[_0x8cfd('0x2b')]){_0x4ea367[_0x8cfd('0x30')][_0x1ed254['idField']]=_0x1ed254[_0x8cfd('0x2d')][_0x8cfd('0x1f')]();}else if(_0x1ed254[_0x8cfd('0x2e')]===_0x8cfd('0x31')&&_0x1ed254[_0x8cfd('0x32')]&&_0x1ed254[_0x8cfd('0x2f')]&&_0x1ed254[_0x8cfd('0x2b')]){_0x49d358[_0x1ed254[_0x8cfd('0x32')]]&&(_0x4ea367[_0x8cfd('0x30')][_0x1ed254[_0x8cfd('0x2f')]]=_0x49d358[_0x1ed254[_0x8cfd('0x32')]][_0x8cfd('0x1f')]());}else if(_0x1ed254[_0x8cfd('0x2e')]===_0x8cfd('0x33')&&_0x1ed254[_0x8cfd('0x34')]&&_0x1ed254[_0x8cfd('0x34')][_0x8cfd('0x35')]&&_0x1ed254[_0x8cfd('0x2f')]&&_0x1ed254[_0x8cfd('0x2b')]){_0x49d358[_0x1ed254[_0x8cfd('0x34')][_0x8cfd('0x35')]['toLowerCase']()]&&(_0x4ea367[_0x8cfd('0x30')][_0x1ed254['idField']]=_0x49d358[_0x1ed254[_0x8cfd('0x34')][_0x8cfd('0x35')][_0x8cfd('0x2c')]()]['toString']());}});}if(_0x4ea367[_0x8cfd('0x36')]){_0x4ea367['priority']=Number(_0x4ea367[_0x8cfd('0x36')]);}return _0x4ea367;}function getTicket(_0x365f31,_0x575bc4,_0x695ba9,_0x5e368a,_0x2c88d7){logger[_0x8cfd('0xd')](_0x8cfd('0x37'));var _0xb779a4=_[_0x8cfd('0x38')]({'subject':intUtil['getString'](_0x5e368a[_0x8cfd('0x39')],_0x2c88d7,'\x20'),'type':_0x8cfd('0x3a'),'status':_0x8cfd('0x3b'),'labels':[_0x8cfd('0x3c'),_0x8cfd('0x3d'),_0x8cfd('0x3e')][_0x8cfd('0x3f')](getTags(_0x5e368a[_0x8cfd('0x40')],_0x8cfd('0x35'))),'description':intUtil[_0x8cfd('0x41')](_0x5e368a[_0x8cfd('0x42')],_0x2c88d7,'\x0a'),'_links':{'assigned_user':{'href':util[_0x8cfd('0xe')](_0x8cfd('0x43'),_0x575bc4['id']),'class':_0x8cfd('0x44')}},'message':{'direction':'in','body':intUtil[_0x8cfd('0x41')](_0x5e368a[_0x8cfd('0x42')],_0x2c88d7,'\x0a')}},getCustomFields(_0x5e368a[_0x8cfd('0x45')],_0x2c88d7));return request({'uri':util['format'](_0x8cfd('0x46'),_0x365f31[_0x8cfd('0x10')],_0x695ba9['id']),'method':'POST','body':_0xb779a4});}exports[_0x8cfd('0x47')]=function(_0x5257d3,_0x2d2bbe,_0x4fbed9,_0x1f46d0,_0x3c79e8,_0x27f38d){var _0x121351,_0x3dd022;_0x27f38d['remoteUri']=intUtil['stripTrailingSlash'](_0x27f38d['remoteUri']);_0x27f38d[_0x8cfd('0x48')]=intUtil['stripTrailingSlash'](_0x27f38d[_0x8cfd('0x48')]);if(_0x3c79e8&&_0x3c79e8[_0x8cfd('0x49')]){logger[_0x8cfd('0xd')]('[QUEUE]',_0x8cfd('0x4a'));_0x2d2bbe[_0x8cfd('0x4b')]=util[_0x8cfd('0xe')](_0x8cfd('0x4c'),_0x27f38d[_0x8cfd('0x48')],_0x2d2bbe[_0x8cfd('0x4d')],md5(_0x2d2bbe[_0x8cfd('0x4d')]));}else{_0x2d2bbe[_0x8cfd('0x4b')]='';}headers[_0x8cfd('0x4e')]=getAuth(_0x27f38d);return getUser(_0x27f38d,_0x1f46d0[_0x8cfd('0x4f')])[_0x8cfd('0x11')](function(_0x89ef15){_0x121351=_0x89ef15;logger[_0x8cfd('0xd')](_0x8cfd('0x50'),_0x121351['id']);return getEndUser(_0x27f38d,_0x2d2bbe[_0x8cfd('0x51')],_0x2d2bbe['calleridnum']);})[_0x8cfd('0x11')](function(_0x262341){_0x3dd022=_0x262341;logger[_0x8cfd('0xd')](_0x8cfd('0x52'),_0x3dd022['id']);return getTicket(_0x27f38d,_0x121351,_0x3dd022,_0x4fbed9,_0x2d2bbe);})['then'](function(_0x20d8f8){if(_0x20d8f8){logger[_0x8cfd('0xd')](_0x8cfd('0x53'));logger[_0x8cfd('0xd')]('The\x20Ticket\x20ID\x20is:',_0x20d8f8['id']);switch(_0x27f38d['type']){case _0x8cfd('0x54'):logger['info'](_0x8cfd('0x55'),_0x8cfd('0x56'));emit(util['format'](_0x8cfd('0x57'),_0x1f46d0['name']),'trigger:desk:display',{'recordId':_0x20d8f8['id']});break;case _0x8cfd('0x58'):logger[_0x8cfd('0xd')](_0x8cfd('0x55'),_0x8cfd('0x59'));emit(util['format'](_0x8cfd('0x57'),_0x1f46d0['name']),_0x8cfd('0x5a'),{'uri':util[_0x8cfd('0xe')](_0x8cfd('0x5b'),_0x20d8f8['id'])});break;default:logger['error'](_0x8cfd('0x55'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x8cfd('0x5c')](function(_0x5effec){console[_0x8cfd('0x5d')](_0x5effec);logger[_0x8cfd('0x5d')](_0x8cfd('0x55'),JSON['stringify'](_0x5effec));});};exports['outbound']=function(_0x22a4ec,_0x4b5364,_0x5f1c8c,_0x4ab3b3,_0x3bd82b,_0x53f49d,_0x1167f3){var _0x27b061,_0x51139a;_0x53f49d[_0x8cfd('0x10')]=intUtil[_0x8cfd('0x5e')](_0x53f49d[_0x8cfd('0x10')]);_0x53f49d[_0x8cfd('0x48')]=intUtil[_0x8cfd('0x5e')](_0x53f49d[_0x8cfd('0x48')]);if(_0x1167f3&&_0x1167f3[_0x8cfd('0x5f')]&&_0x1167f3[_0x8cfd('0x5f')]!==_0x8cfd('0x60')){logger['info']('[OUTBOUND]',_0x8cfd('0x4a'));_0x4b5364[_0x8cfd('0x4b')]=util[_0x8cfd('0xe')](_0x8cfd('0x4c'),_0x53f49d[_0x8cfd('0x48')],_0x4b5364[_0x8cfd('0x4d')],md5(_0x4b5364[_0x8cfd('0x4d')]));}headers['Authorization']=getAuth(_0x53f49d);return getUser(_0x53f49d,_0x4ab3b3[_0x8cfd('0x4f')])[_0x8cfd('0x11')](function(_0x36333d){_0x27b061=_0x36333d;logger[_0x8cfd('0xd')](_0x8cfd('0x50'),_0x27b061['id']);return getEndUser(_0x53f49d,_0x4b5364[_0x8cfd('0x61')],_0x4b5364[_0x8cfd('0x62')]);})['then'](function(_0x29b297){_0x51139a=_0x29b297;logger[_0x8cfd('0xd')]('The\x20Enduser\x20ID\x20is:',_0x51139a['id']);return getTicket(_0x53f49d,_0x27b061,_0x51139a,_0x5f1c8c,_0x4b5364);})['then'](function(_0x2275a2){if(_0x2275a2){logger[_0x8cfd('0xd')](_0x8cfd('0x53'));logger[_0x8cfd('0xd')](_0x8cfd('0x63'),_0x2275a2['id']);switch(_0x53f49d['type']){case _0x8cfd('0x54'):logger[_0x8cfd('0xd')](_0x8cfd('0x55'),_0x8cfd('0x56'));emit(util[_0x8cfd('0xe')](_0x8cfd('0x57'),_0x4ab3b3[_0x8cfd('0x35')]),_0x8cfd('0x64'),{'recordId':_0x2275a2['id']});break;case _0x8cfd('0x58'):logger['info'](_0x8cfd('0x55'),_0x8cfd('0x59'));emit(util['format'](_0x8cfd('0x57'),_0x4ab3b3[_0x8cfd('0x35')]),_0x8cfd('0x5a'),{'uri':util['format'](_0x8cfd('0x65'),_0x53f49d[_0x8cfd('0x10')],_0x2275a2['id'])});break;default:logger['error'](_0x8cfd('0x66'),_0x8cfd('0x67'));}}})[_0x8cfd('0x5c')](function(_0x17d71d){logger[_0x8cfd('0x5d')]('[OUTBOUND]',JSON[_0x8cfd('0x19')](_0x17d71d));});};exports['abandoned']=function(_0x595de2,_0x10d41a,_0x4acfe8,_0x545173,_0x496b92,_0x15d4a4){var _0xf7639a,_0x46dfcf;_0x15d4a4[_0x8cfd('0x10')]=intUtil['stripTrailingSlash'](_0x15d4a4[_0x8cfd('0x10')]);_0x15d4a4[_0x8cfd('0x48')]=intUtil['stripTrailingSlash'](_0x15d4a4[_0x8cfd('0x48')]);if(_0x496b92&&_0x496b92['monitor_format']){logger['info'](_0x8cfd('0x68'),_0x8cfd('0x4a'));_0x10d41a[_0x8cfd('0x4b')]=util[_0x8cfd('0xe')](_0x8cfd('0x4c'),_0x15d4a4[_0x8cfd('0x48')],_0x10d41a['uniqueid'],md5(_0x10d41a[_0x8cfd('0x4d')]));}else{_0x10d41a['recordingURL']='';}headers[_0x8cfd('0x4e')]=getAuth(_0x15d4a4);return getUser(_0x15d4a4)[_0x8cfd('0x11')](function(_0x98dd1c){_0xf7639a=_0x98dd1c;logger[_0x8cfd('0xd')]('The\x20User\x20ID\x20is:',_0xf7639a['id']);return getEndUser(_0x15d4a4,_0x10d41a[_0x8cfd('0x51')],_0x10d41a[_0x8cfd('0x69')]);})['then'](function(_0x2a4cd2){_0x46dfcf=_0x2a4cd2;logger['info'](_0x8cfd('0x52'),_0x46dfcf['id']);return getTicket(_0x15d4a4,_0xf7639a,_0x46dfcf,_0x4acfe8,_0x10d41a);})[_0x8cfd('0x11')](function(_0x33d182){if(_0x33d182){logger[_0x8cfd('0xd')]('Ticket\x20created!');logger[_0x8cfd('0xd')](_0x8cfd('0x63'),_0x33d182['id']);}})[_0x8cfd('0x5c')](function(_0x25ae76){logger['error'](_0x8cfd('0x68'),JSON[_0x8cfd('0x19')](_0x25ae76));});}; \ 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 0b688ae..c23677c 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 _0xb0c5=['4.0','value','isNil','email','internalemailaddress',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','length','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','indexOf','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','odata-entityid','ticketId','format','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','abandoned','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name','lodash','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','POST','clientId','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20'];(function(_0x1a8b70,_0x3afe5d){var _0x5f0075=function(_0x528ae6){while(--_0x528ae6){_0x1a8b70['push'](_0x1a8b70['shift']());}};_0x5f0075(++_0x3afe5d);}(_0xb0c5,0xfa));var _0x5b0c=function(_0x46d736,_0x5a042e){_0x46d736=_0x46d736-0x0;var _0x55ab62=_0xb0c5[_0x46d736];return _0x55ab62;};'use strict';var _=require(_0x5b0c('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require('util');var intUtil=require(_0x5b0c('0x1'));var md5=require(_0x5b0c('0x2'));var Redis=require(_0x5b0c('0x3'));var logger=require(_0x5b0c('0x4'))(_0x5b0c('0x5'));var config=require(_0x5b0c('0x6'));config[_0x5b0c('0x7')]=_[_0x5b0c('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5b0c('0x7')]));function getAuthToken(_0x28ea40,_0x5162f8,_0x282a90){var _0x5161f3={'method':_0x5b0c('0x9'),'uri':_0x5162f8,'form':{'client_id':_0x28ea40[_0x5b0c('0xa')],'resource':_0x28ea40['remoteUri'],'username':_0x28ea40[_0x5b0c('0xb')],'password':_0x28ea40[_0x5b0c('0xc')],'grant_type':'password','client_secret':_0x28ea40['clientSecret']},'json':!![]};return rp(_0x5161f3)[_0x5b0c('0xd')](function(_0x33ef53){return _0x33ef53[_0x5b0c('0xe')];})[_0x5b0c('0xf')](function(_0x36004e){logger[_0x5b0c('0x10')]('['+[_0x282a90[_0x5b0c('0x11')]()]+_0x5b0c('0x12'));return _0x36004e[_0x5b0c('0x13')];});}function getUser(_0x555e32,_0x1d946f,_0x5d5526,_0x4c1a56,_0x1f555f,_0x4d3ed3){return new BPromise(function(_0x1a68da,_0x49f0a8){return getAuthToken(_0x1d946f,_0x4c1a56,_0x4d3ed3)['then'](function(_0x2e709f){var _0x347a27={'method':_0x5b0c('0x14'),'uri':_0x1f555f+_0x5b0c('0x15'),'headers':{'Authorization':_0x5b0c('0x16')+_0x2e709f,'OData-Version':_0x5b0c('0x17')},'json':!![]};return rp(_0x347a27);})[_0x5b0c('0xd')](function(_0x5148ec){var _0x46cbc0=_0x5148ec[_0x5b0c('0x18')];var _0x150452=![];var _0x542ecb=null;if(!_[_0x5b0c('0x19')](_0x5d5526)){if(intUtil['validateEmail'](_0x5d5526[_0x5b0c('0x1a')])){_0x555e32['userEmail']=_0x5d5526[_0x5b0c('0x1a')];for(_0x542ecb=0x0;_0x542ecb<_0x46cbc0['length'];_0x542ecb++){if(_0x46cbc0[_0x542ecb][_0x5b0c('0x1b')]===_0x5d5526[_0x5b0c('0x1a')]&&!_0x46cbc0[_0x542ecb]['isdisabled']){_0x150452=!![];logger['info']('['+[_0x4d3ed3[_0x5b0c('0x11')]()]+_0x5b0c('0x1c')+_0x46cbc0[_0x542ecb][_0x5b0c('0x1d')]+'!');_0x555e32[_0x5b0c('0x1e')]=_0x46cbc0[_0x542ecb][_0x5b0c('0x1d')];}}}}if(!_0x150452){logger[_0x5b0c('0x1f')]('['+[_0x4d3ed3['toUpperCase']()]+_0x5b0c('0x20'));_0x555e32[_0x5b0c('0x21')]=_0x1d946f[_0x5b0c('0xb')];for(_0x542ecb=0x0;_0x542ecb<_0x46cbc0[_0x5b0c('0x22')];_0x542ecb++){if(_0x46cbc0[_0x542ecb][_0x5b0c('0x1b')]===_0x1d946f[_0x5b0c('0xb')]){_0x555e32[_0x5b0c('0x1e')]=_0x46cbc0[_0x542ecb][_0x5b0c('0x1d')];}}}_0x1a68da(_0x555e32);})[_0x5b0c('0xf')](function(_0x8a75e5){_0x49f0a8(_0x8a75e5[_0x5b0c('0x13')]);});});}function createEndUser(_0x553894,_0x7c5809,_0xcb101f,_0x5ba419,_0x41116d,_0xc659e6){return new BPromise(function(_0x1f4177,_0x454614){return getAuthToken(_0x7c5809,_0xcb101f,_0xc659e6)['then'](function(_0x2fe7f3){var _0x4f6ff1=_0xc659e6[_0x5b0c('0x23')]()===_0x5b0c('0x24')?_0x41116d[_0x5b0c('0x25')]:_0x41116d[_0x5b0c('0x26')];var _0xdc2d94={'method':_0x5b0c('0x9'),'uri':_0x5ba419+_0x5b0c('0x27'),'body':{'telephone1':_0x4f6ff1,'fullname':_0x4f6ff1,'firstname':_0x4f6ff1,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5b0c('0x28')+_0x553894['userId']+')'},'headers':{'Authorization':_0x5b0c('0x16')+_0x2fe7f3,'OData-Version':_0x5b0c('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xdc2d94);})['then'](function(_0x1bd336){var _0x228dbe=_0x1bd336['headers']['odata-entityid'];var _0x1e9e0c=_0x228dbe[_0x5b0c('0x29')](_0x228dbe[_0x5b0c('0x2a')]('(')+0x1,_0x228dbe[_0x5b0c('0x2a')](')'));_0x553894[_0x5b0c('0x2b')]=_0x1e9e0c;_0x1f4177(_0x553894);})[_0x5b0c('0xf')](function(_0xe50f9c){_0x454614(_0xe50f9c['message']);});});}function getEndUser(_0x1e8d3a,_0x948718,_0x2368f2,_0x403e23,_0x480562,_0x480400){return new BPromise(function(_0xb92559,_0x878b67){return getAuthToken(_0x948718,_0x2368f2,_0x480400)[_0x5b0c('0xd')](function(_0x5636fd){var _0x1fe05f={'method':'GET','uri':_0x403e23+_0x5b0c('0x2c'),'headers':{'Authorization':_0x5b0c('0x16')+_0x5636fd,'If-None-Match':null,'OData-Version':_0x5b0c('0x17')},'json':!![]};return rp(_0x1fe05f);})[_0x5b0c('0xd')](function(_0x4e3d01){var _0x2f112c=null;if(_0x4e3d01){var _0xc2e71e=_0x4e3d01[_0x5b0c('0x18')];var _0x460691=![];for(_0x2f112c=0x0;_0x2f112c<_0xc2e71e[_0x5b0c('0x22')];_0x2f112c++){var _0x552193=_0x480400[_0x5b0c('0x23')]()===_0x5b0c('0x24')?_0x480562[_0x5b0c('0x25')]:_0x480562['calleridnum'];if(_0xc2e71e[_0x2f112c][_0x5b0c('0x2d')]===_0x552193){_0x460691=!![];_0x1e8d3a[_0x5b0c('0x2b')]=_0xc2e71e[_0x2f112c]['contactid'];}}if(_0x460691){_0xb92559(_0x1e8d3a);}else{return createEndUser(_0x1e8d3a,_0x948718,_0x2368f2,_0x403e23,_0x480562,_0x480400)[_0x5b0c('0xd')](function(_0x3bacd1){logger[_0x5b0c('0x1f')]('['+[_0x480400[_0x5b0c('0x11')]()]+_0x5b0c('0x2e'),_0x3bacd1['enduserId']);_0xb92559(_0x3bacd1);});}}else{return createEndUser(_0x1e8d3a,_0x948718,_0x2368f2,_0x403e23,_0x480562,_0x480400)[_0x5b0c('0xd')](function(_0x304957){logger[_0x5b0c('0x1f')]('['+[_0x480400[_0x5b0c('0x11')]()]+_0x5b0c('0x2f'),_0x304957[_0x5b0c('0x2b')]);_0xb92559(_0x304957);});}});});}function getCustomFields(_0x2d3352,_0x47271c,_0x2d25dc){var _0xb84506={};if(_0x2d3352[_0x5b0c('0x22')]>0x0){_[_0x5b0c('0x30')](_0x2d3352,function(_0x1bf18f){if(_0x1bf18f[_0x5b0c('0x31')]===_0x5b0c('0x32')&&_0x1bf18f[_0x5b0c('0x33')]&&!_0x1bf18f[_0x5b0c('0x34')]){var _0x194949=_0x1bf18f['idField'][_0x5b0c('0x23')]();var _0x3cf59b=_0x194949[_0x5b0c('0x29')](0x0,_0x194949[_0x5b0c('0x35')]('_'));var _0x280ab6=_0x194949['substring'](_0x194949[_0x5b0c('0x35')]('_')+0x1);if(_0x3cf59b===_0x2d25dc){_0xb84506[_0x280ab6]=_0x1bf18f['content'];}}});}return _0xb84506;}function getTicket(_0x4092ad,_0x183a6a,_0xe6b57d,_0x4769c0,_0x5f28d7,_0x38fb73,_0x4ac0d7){return new BPromise(function(_0xe885dc,_0x13d8a9){var _0x12c9fd;return getAuthToken(_0x183a6a,_0xe6b57d,_0x4ac0d7)['then'](function(_0x54062d){if(_0x38fb73['ticketType']===_0x5b0c('0x36')){_0x12c9fd={'method':'POST','uri':_0x4769c0+'incidents','body':Object[_0x5b0c('0x37')]({},{'title':intUtil[_0x5b0c('0x38')](_0x38fb73[_0x5b0c('0x39')],_0x5f28d7,'\x20'),'description':intUtil['getString'](_0x38fb73[_0x5b0c('0x3a')],_0x5f28d7,'\x0a'),'customerid_contact@odata.bind':_0x5b0c('0x3b')+_0x4092ad[_0x5b0c('0x2b')]+')','ownerid@odata.bind':_0x5b0c('0x28')+_0x4092ad[_0x5b0c('0x1e')]+')','caseorigincode':'1'},getCustomFields(_0x38fb73[_0x5b0c('0x3c')],_0x5f28d7,_0x38fb73[_0x5b0c('0x3d')])),'headers':{'Authorization':_0x5b0c('0x16')+_0x54062d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x38fb73['ticketType']===_0x5b0c('0x3e')){_0x12c9fd={'method':'POST','uri':_0x4769c0+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x5b0c('0x38')](_0x38fb73[_0x5b0c('0x39')],_0x5f28d7,'\x20'),'phonenumber':String(_0x5f28d7[_0x5b0c('0x26')]),'description':intUtil[_0x5b0c('0x38')](_0x38fb73[_0x5b0c('0x3a')],_0x5f28d7,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5b0c('0x3b')+_0x4092ad[_0x5b0c('0x2b')]+')','ownerid@odata.bind':_0x5b0c('0x28')+_0x4092ad[_0x5b0c('0x1e')]+')','directioncode':_0x4092ad[_0x5b0c('0x3f')]===_0x5b0c('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x5b0c('0x28')+_0x4092ad[_0x5b0c('0x1e')]+')','participationtypemask':_0x4092ad['callDirection']===_0x5b0c('0x40')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4092ad[_0x5b0c('0x2b')]+')','participationtypemask':_0x4092ad[_0x5b0c('0x3f')]===_0x5b0c('0x40')?0x1:0x2}]},getCustomFields(_0x38fb73[_0x5b0c('0x3c')],_0x5f28d7,_0x38fb73[_0x5b0c('0x3d')])),'headers':{'Authorization':_0x5b0c('0x16')+_0x54062d,'OData-Version':_0x5b0c('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x12c9fd);})['then'](function(_0x331fd2){var _0x4ac93e=_0x331fd2['headers'][_0x5b0c('0x41')];var _0x320703=_0x4ac93e[_0x5b0c('0x29')](_0x4ac93e['lastIndexOf']('(')+0x1,_0x4ac93e[_0x5b0c('0x2a')](')'));_0x4092ad[_0x5b0c('0x42')]=_0x320703;_0xe885dc(_0x4092ad);})[_0x5b0c('0xf')](function(_0x1cde0b){_0x13d8a9(_0x1cde0b[_0x5b0c('0x13')]);});});}function emit(_0x5b1bc0,_0x4a785e,_0x304f4f,_0x161fe6){var _0x56e1c8={'uri':util[_0x5b0c('0x43')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x5b1bc0,_0x304f4f,_0x161fe6)};io['to'](util['format']('user:%s',_0x4a785e))[_0x5b0c('0x44')](_0x5b0c('0x45'),_0x56e1c8);}exports['cs']=function(_0x26671a,_0x475f68,_0x4c16b8,_0x50f4a3,_0x15e4a0,_0x4b2b4a,_0x43f960,_0x29b7c9){var _0x30a298={};_0x4b2b4a[_0x5b0c('0x46')]=intUtil[_0x5b0c('0x47')](_0x4b2b4a['remoteUri']);_0x4b2b4a['serverUrl']=intUtil[_0x5b0c('0x47')](_0x4b2b4a[_0x5b0c('0x48')]);_0x30a298['callDirection']=_0x29b7c9==='queue'||_0x29b7c9===_0x5b0c('0x49')?_0x5b0c('0x40'):'outbound';var _0x15a826=util[_0x5b0c('0x43')](_0x5b0c('0x4a'),_0x4b2b4a[_0x5b0c('0x46')]);var _0x536766=util[_0x5b0c('0x43')]('https://login.microsoftonline.com/%s/oauth2/token',_0x4b2b4a[_0x5b0c('0x4b')]);var _0x5a44af=util[_0x5b0c('0x43')](_0x5b0c('0x4c'),_0x4b2b4a['serverUrl'],_0x475f68[_0x5b0c('0x4d')],md5(_0x475f68[_0x5b0c('0x4d')]));if(_0x15e4a0&&_0x15e4a0[_0x5b0c('0x4e')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x475f68[_0x5b0c('0x4f')]=_0x5a44af;}else if(_0x43f960&&_0x43f960['recordingFormat']&&_0x43f960[_0x5b0c('0x50')]!==_0x5b0c('0x51')){logger[_0x5b0c('0x1f')](_0x5b0c('0x52'),_0x5b0c('0x53'));_0x475f68[_0x5b0c('0x4f')]=_0x5a44af;}else{_0x475f68[_0x5b0c('0x4f')]='';}return getUser(_0x30a298,_0x4b2b4a,_0x50f4a3,_0x536766,_0x15a826,_0x29b7c9)[_0x5b0c('0xd')](function(_0x3d2dbc){logger[_0x5b0c('0x1f')]('['+_0x29b7c9[_0x5b0c('0x11')]()+_0x5b0c('0x54'),_0x3d2dbc['userId']);logger[_0x5b0c('0x1f')]('['+_0x29b7c9[_0x5b0c('0x11')]()+_0x5b0c('0x55'),_0x3d2dbc[_0x5b0c('0x21')]);return getEndUser(_0x3d2dbc,_0x4b2b4a,_0x536766,_0x15a826,_0x475f68,_0x29b7c9);})['then'](function(_0x3111ae){logger['info']('['+_0x29b7c9['toUpperCase']()+_0x5b0c('0x56'),_0x3111ae[_0x5b0c('0x2b')]);logger[_0x5b0c('0x1f')]('['+_0x29b7c9['toUpperCase']()+_0x5b0c('0x57'),_0x475f68['calleridnum']);return getTicket(_0x3111ae,_0x4b2b4a,_0x536766,_0x15a826,_0x475f68,_0x4c16b8,_0x29b7c9);})[_0x5b0c('0xd')](function(_0x4ca9dd){logger[_0x5b0c('0x1f')](util[_0x5b0c('0x43')]('['+_0x29b7c9[_0x5b0c('0x11')]()+_0x5b0c('0x58'),_0x4c16b8[_0x5b0c('0x3d')],_0x4ca9dd[_0x5b0c('0x42')]));logger[_0x5b0c('0x1f')](util['format']('['+_0x29b7c9[_0x5b0c('0x11')]()+_0x5b0c('0x59'),_0x29b7c9));if(_0x29b7c9!==_0x5b0c('0x49')){logger[_0x5b0c('0x1f')]('['+_0x29b7c9['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4b2b4a['remoteUri'],_0x50f4a3[_0x5b0c('0x5a')],_0x4c16b8[_0x5b0c('0x3d')],_0x4ca9dd[_0x5b0c('0x42')]);}})['catch'](function(_0x13227a){logger[_0x5b0c('0x10')]('['+_0x29b7c9['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x13227a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x611b=['recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','socket.io-emitter','POST','clientId','remoteUri','password','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','calleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1','outbound','contactid',']\x20Enduser\x20created!','type','string','nameField','customField','toLowerCase','indexOf','ticketType','incident','assign','getString','Subjects','/contacts(','Fields','phonecall','phonecalls','Descriptions','callDirection','queue','headers','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','abandoned','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x611b,0xca));var _0xb611=function(_0x47da3c,_0x1ab06d){_0x47da3c=_0x47da3c-0x0;var _0x1d0942=_0x611b[_0x47da3c];return _0x1d0942;};'use strict';var _=require('lodash');var BPromise=require(_0xb611('0x0'));var rp=require(_0xb611('0x1'));var util=require(_0xb611('0x2'));var intUtil=require('./util');var md5=require(_0xb611('0x3'));var Redis=require(_0xb611('0x4'));var logger=require(_0xb611('0x5'))('dynamics365');var config=require(_0xb611('0x6'));config[_0xb611('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb611('0x8'))(new Redis(config[_0xb611('0x7')]));function getAuthToken(_0x4768fa,_0x4c39a8,_0xd66748){var _0x192c84={'method':_0xb611('0x9'),'uri':_0x4c39a8,'form':{'client_id':_0x4768fa[_0xb611('0xa')],'resource':_0x4768fa[_0xb611('0xb')],'username':_0x4768fa['username'],'password':_0x4768fa[_0xb611('0xc')],'grant_type':_0xb611('0xc'),'client_secret':_0x4768fa['clientSecret']},'json':!![]};return rp(_0x192c84)[_0xb611('0xd')](function(_0x56d8b8){return _0x56d8b8['access_token'];})[_0xb611('0xe')](function(_0x1a7c13){logger[_0xb611('0xf')]('['+[_0xd66748[_0xb611('0x10')]()]+_0xb611('0x11'));return _0x1a7c13[_0xb611('0x12')];});}function getUser(_0x43ed4a,_0x3508ed,_0x3d4be9,_0x5a8eae,_0xab418,_0x34bea6){return new BPromise(function(_0x50fb82,_0x1c0a94){return getAuthToken(_0x3508ed,_0x5a8eae,_0x34bea6)[_0xb611('0xd')](function(_0x47e87c){var _0x1f4a36={'method':'GET','uri':_0xab418+_0xb611('0x13'),'headers':{'Authorization':_0xb611('0x14')+_0x47e87c,'OData-Version':_0xb611('0x15')},'json':!![]};return rp(_0x1f4a36);})[_0xb611('0xd')](function(_0x3023b8){var _0xa0e499=_0x3023b8[_0xb611('0x16')];var _0x20b0ec=![];var _0x36395c=null;if(!_['isNil'](_0x3d4be9)){if(intUtil[_0xb611('0x17')](_0x3d4be9[_0xb611('0x18')])){_0x43ed4a[_0xb611('0x19')]=_0x3d4be9[_0xb611('0x18')];for(_0x36395c=0x0;_0x36395c<_0xa0e499[_0xb611('0x1a')];_0x36395c++){if(_0xa0e499[_0x36395c][_0xb611('0x1b')]===_0x3d4be9[_0xb611('0x18')]&&!_0xa0e499[_0x36395c][_0xb611('0x1c')]){_0x20b0ec=!![];logger[_0xb611('0x1d')]('['+[_0x34bea6[_0xb611('0x10')]()]+_0xb611('0x1e')+_0xa0e499[_0x36395c][_0xb611('0x1f')]+'!');_0x43ed4a[_0xb611('0x20')]=_0xa0e499[_0x36395c][_0xb611('0x1f')];}}}}if(!_0x20b0ec){logger['info']('['+[_0x34bea6['toUpperCase']()]+_0xb611('0x21'));_0x43ed4a[_0xb611('0x19')]=_0x3508ed['username'];for(_0x36395c=0x0;_0x36395c<_0xa0e499[_0xb611('0x1a')];_0x36395c++){if(_0xa0e499[_0x36395c][_0xb611('0x1b')]===_0x3508ed['username']){_0x43ed4a[_0xb611('0x20')]=_0xa0e499[_0x36395c][_0xb611('0x1f')];}}}_0x50fb82(_0x43ed4a);})[_0xb611('0xe')](function(_0x3359d7){_0x1c0a94(_0x3359d7['message']);});});}function createEndUser(_0x5a9188,_0x5ced8b,_0x2bf3d6,_0x383cd6,_0x6d7035,_0x5aba07){return new BPromise(function(_0xbcc804,_0x1822d9){return getAuthToken(_0x5ced8b,_0x2bf3d6,_0x5aba07)['then'](function(_0x115f45){var _0x5c95df=_0x5aba07['toLowerCase']()==='outbound'?_0x6d7035['destcalleridnum']:_0x6d7035[_0xb611('0x22')];var _0x47abcf={'method':_0xb611('0x9'),'uri':_0x383cd6+_0xb611('0x23'),'body':{'telephone1':_0x5c95df,'fullname':_0x5c95df,'firstname':_0x5c95df,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb611('0x24')+_0x5a9188[_0xb611('0x20')]+')'},'headers':{'Authorization':_0xb611('0x14')+_0x115f45,'OData-Version':_0xb611('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x47abcf);})['then'](function(_0x193c3f){var _0x450c34=_0x193c3f['headers'][_0xb611('0x25')];var _0x15071f=_0x450c34[_0xb611('0x26')](_0x450c34['lastIndexOf']('(')+0x1,_0x450c34[_0xb611('0x27')](')'));_0x5a9188[_0xb611('0x28')]=_0x15071f;_0xbcc804(_0x5a9188);})[_0xb611('0xe')](function(_0x42a435){_0x1822d9(_0x42a435['message']);});});}function getEndUser(_0x32f61d,_0x10ce0f,_0x26bf17,_0x367465,_0x43c306,_0x46304e){return new BPromise(function(_0x2b3f2c,_0x17b736){return getAuthToken(_0x10ce0f,_0x26bf17,_0x46304e)[_0xb611('0xd')](function(_0x300c8b){var _0x13ff9d={'method':_0xb611('0x29'),'uri':_0x367465+_0xb611('0x2a'),'headers':{'Authorization':_0xb611('0x14')+_0x300c8b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x13ff9d);})[_0xb611('0xd')](function(_0xf317d){var _0x46b9f2=null;if(_0xf317d){var _0x1b4e27=_0xf317d[_0xb611('0x16')];var _0x2eac27=![];for(_0x46b9f2=0x0;_0x46b9f2<_0x1b4e27[_0xb611('0x1a')];_0x46b9f2++){var _0x277375=_0x46304e['toLowerCase']()===_0xb611('0x2b')?_0x43c306['destcalleridnum']:_0x43c306['calleridnum'];if(_0x1b4e27[_0x46b9f2]['telephone1']===_0x277375){_0x2eac27=!![];_0x32f61d['enduserId']=_0x1b4e27[_0x46b9f2][_0xb611('0x2c')];}}if(_0x2eac27){_0x2b3f2c(_0x32f61d);}else{return createEndUser(_0x32f61d,_0x10ce0f,_0x26bf17,_0x367465,_0x43c306,_0x46304e)[_0xb611('0xd')](function(_0x598d88){logger[_0xb611('0x1d')]('['+[_0x46304e[_0xb611('0x10')]()]+_0xb611('0x2d'),_0x598d88[_0xb611('0x28')]);_0x2b3f2c(_0x598d88);});}}else{return createEndUser(_0x32f61d,_0x10ce0f,_0x26bf17,_0x367465,_0x43c306,_0x46304e)[_0xb611('0xd')](function(_0x12c4ff){logger[_0xb611('0x1d')]('['+[_0x46304e[_0xb611('0x10')]()]+']\x20Enduser\x20Created!',_0x12c4ff[_0xb611('0x28')]);_0x2b3f2c(_0x12c4ff);});}});});}function getCustomFields(_0x3f4cb9,_0x1a9a67,_0x370130){var _0xcea08={};if(_0x3f4cb9['length']>0x0){_['forEach'](_0x3f4cb9,function(_0x295b45){if(_0x295b45[_0xb611('0x2e')]===_0xb611('0x2f')&&_0x295b45[_0xb611('0x30')]&&!_0x295b45[_0xb611('0x31')]){var _0x51335b=_0x295b45['idField'][_0xb611('0x32')]();var _0x3208bd=_0x51335b[_0xb611('0x26')](0x0,_0x51335b[_0xb611('0x33')]('_'));var _0x2cd508=_0x51335b[_0xb611('0x26')](_0x51335b[_0xb611('0x33')]('_')+0x1);if(_0x3208bd===_0x370130){_0xcea08[_0x2cd508]=_0x295b45['content'];}}});}return _0xcea08;}function getTicket(_0x7df16d,_0x5c18c6,_0x85a52b,_0x318823,_0x1de0c7,_0x30f813,_0x3c5cf0){return new BPromise(function(_0x3b0300,_0x52be88){var _0x11a125;return getAuthToken(_0x5c18c6,_0x85a52b,_0x3c5cf0)[_0xb611('0xd')](function(_0x5634be){if(_0x30f813[_0xb611('0x34')]===_0xb611('0x35')){_0x11a125={'method':'POST','uri':_0x318823+'incidents','body':Object[_0xb611('0x36')]({},{'title':intUtil[_0xb611('0x37')](_0x30f813[_0xb611('0x38')],_0x1de0c7,'\x20'),'description':intUtil[_0xb611('0x37')](_0x30f813['Descriptions'],_0x1de0c7,'\x0a'),'customerid_contact@odata.bind':_0xb611('0x39')+_0x7df16d['enduserId']+')','ownerid@odata.bind':_0xb611('0x24')+_0x7df16d['userId']+')','caseorigincode':'1'},getCustomFields(_0x30f813[_0xb611('0x3a')],_0x1de0c7,_0x30f813[_0xb611('0x34')])),'headers':{'Authorization':_0xb611('0x14')+_0x5634be,'OData-Version':_0xb611('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x30f813[_0xb611('0x34')]===_0xb611('0x3b')){_0x11a125={'method':_0xb611('0x9'),'uri':_0x318823+_0xb611('0x3c'),'body':Object[_0xb611('0x36')]({},{'subject':intUtil['getString'](_0x30f813['Subjects'],_0x1de0c7,'\x20'),'phonenumber':String(_0x1de0c7[_0xb611('0x22')]),'description':intUtil[_0xb611('0x37')](_0x30f813[_0xb611('0x3d')],_0x1de0c7,'\x0a'),'regardingobjectid_contact@odata.bind':_0xb611('0x39')+_0x7df16d[_0xb611('0x28')]+')','ownerid@odata.bind':_0xb611('0x24')+_0x7df16d['userId']+')','directioncode':_0x7df16d[_0xb611('0x3e')]===_0xb611('0x3f')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xb611('0x24')+_0x7df16d[_0xb611('0x20')]+')','participationtypemask':_0x7df16d[_0xb611('0x3e')]===_0xb611('0x3f')?0x2:0x1},{'partyid_contact@odata.bind':_0xb611('0x39')+_0x7df16d[_0xb611('0x28')]+')','participationtypemask':_0x7df16d['callDirection']===_0xb611('0x3f')?0x1:0x2}]},getCustomFields(_0x30f813[_0xb611('0x3a')],_0x1de0c7,_0x30f813[_0xb611('0x34')])),'headers':{'Authorization':_0xb611('0x14')+_0x5634be,'OData-Version':_0xb611('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x11a125);})[_0xb611('0xd')](function(_0x441eda){var _0x34a18d=_0x441eda[_0xb611('0x40')][_0xb611('0x25')];var _0xef7719=_0x34a18d['substring'](_0x34a18d[_0xb611('0x27')]('(')+0x1,_0x34a18d[_0xb611('0x27')](')'));_0x7df16d[_0xb611('0x41')]=_0xef7719;_0x3b0300(_0x7df16d);})[_0xb611('0xe')](function(_0x52709e){_0x52be88(_0x52709e[_0xb611('0x12')]);});});}function emit(_0x342303,_0xe69ad9,_0x27a6e9,_0x373f17){var _0x2995b4={'uri':util['format'](_0xb611('0x42'),_0x342303,_0x27a6e9,_0x373f17)};io['to'](util[_0xb611('0x43')](_0xb611('0x44'),_0xe69ad9))['emit'](_0xb611('0x45'),_0x2995b4);}exports['cs']=function(_0x2a1250,_0x391641,_0x3bcb9b,_0x42ef46,_0x2bc531,_0x3b1e1d,_0x18c070,_0x2b432f){var _0x16913b={};_0x3b1e1d['remoteUri']=intUtil[_0xb611('0x46')](_0x3b1e1d[_0xb611('0xb')]);_0x3b1e1d[_0xb611('0x47')]=intUtil[_0xb611('0x46')](_0x3b1e1d[_0xb611('0x47')]);_0x16913b['callDirection']=_0x2b432f==='queue'||_0x2b432f===_0xb611('0x48')?_0xb611('0x3f'):_0xb611('0x2b');var _0x15b14a=util[_0xb611('0x43')](_0xb611('0x49'),_0x3b1e1d[_0xb611('0xb')]);var _0x438be7=util[_0xb611('0x43')](_0xb611('0x4a'),_0x3b1e1d[_0xb611('0x4b')]);var _0x13419e=util[_0xb611('0x43')](_0xb611('0x4c'),_0x3b1e1d[_0xb611('0x47')],_0x391641['uniqueid'],md5(_0x391641[_0xb611('0x4d')]));if(_0x2bc531&&_0x2bc531[_0xb611('0x4e')]){logger[_0xb611('0x1d')]('[QUEUE]',_0xb611('0x4f'));_0x391641['recordingURL']=_0x13419e;}else if(_0x18c070&&_0x18c070[_0xb611('0x50')]&&_0x18c070[_0xb611('0x50')]!==_0xb611('0x51')){logger['info'](_0xb611('0x52'),_0xb611('0x4f'));_0x391641[_0xb611('0x53')]=_0x13419e;}else{_0x391641[_0xb611('0x53')]='';}return getUser(_0x16913b,_0x3b1e1d,_0x42ef46,_0x438be7,_0x15b14a,_0x2b432f)[_0xb611('0xd')](function(_0xae000){logger[_0xb611('0x1d')]('['+_0x2b432f[_0xb611('0x10')]()+_0xb611('0x54'),_0xae000[_0xb611('0x20')]);logger[_0xb611('0x1d')]('['+_0x2b432f['toUpperCase']()+_0xb611('0x55'),_0xae000[_0xb611('0x19')]);return getEndUser(_0xae000,_0x3b1e1d,_0x438be7,_0x15b14a,_0x391641,_0x2b432f);})[_0xb611('0xd')](function(_0x130ece){logger[_0xb611('0x1d')]('['+_0x2b432f[_0xb611('0x10')]()+_0xb611('0x56'),_0x130ece['enduserId']);logger[_0xb611('0x1d')]('['+_0x2b432f[_0xb611('0x10')]()+_0xb611('0x57'),_0x391641['calleridnum']);return getTicket(_0x130ece,_0x3b1e1d,_0x438be7,_0x15b14a,_0x391641,_0x3bcb9b,_0x2b432f);})[_0xb611('0xd')](function(_0x130955){logger[_0xb611('0x1d')](util['format']('['+_0x2b432f[_0xb611('0x10')]()+_0xb611('0x58'),_0x3bcb9b[_0xb611('0x34')],_0x130955[_0xb611('0x41')]));logger['info'](util[_0xb611('0x43')]('['+_0x2b432f[_0xb611('0x10')]()+_0xb611('0x59'),_0x2b432f));if(_0x2b432f!=='abandoned'){logger[_0xb611('0x1d')]('['+_0x2b432f[_0xb611('0x10')]()+']',_0xb611('0x5a'));emit(_0x3b1e1d['remoteUri'],_0x42ef46[_0xb611('0x5b')],_0x3bcb9b[_0xb611('0x34')],_0x130955[_0xb611('0x41')]);}})[_0xb611('0xe')](function(_0x4885c7){logger['error']('['+_0x2b432f[_0xb611('0x10')]()+_0xb611('0x5c'),util[_0xb611('0x5d')](_0x4885c7,{'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 3270d22..775bf4c 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 _0x90e9=['Creating\x20new\x20ticket...','merge','calleridname','calleridnum','getString','Subjects','
','Tags','name','custom_fields','mapValues','value','format','remoteUri','then','validateEmail','%s/api/v2/agents','length','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','toString','base64','stringify','GET','map','string','customField','nameField','toLowerCase','content','type','idField','variable','variableName','push','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','abandoned','[ABANDONED]','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info'];(function(_0x4fde76,_0x2a7c2d){var _0x567e1d=function(_0x352304){while(--_0x352304){_0x4fde76['push'](_0x4fde76['shift']());}};_0x567e1d(++_0x2a7c2d);}(_0x90e9,0x13a));var _0x990e=function(_0x968e6c,_0x5b60a2){_0x968e6c=_0x968e6c-0x0;var _0x597005=_0x90e9[_0x968e6c];return _0x597005;};'use strict';var _=require(_0x990e('0x0'));var rp=require(_0x990e('0x1'));var md5=require(_0x990e('0x2'));var util=require(_0x990e('0x3'));var Redis=require(_0x990e('0x4'));var intUtil=require('./util');var config=require(_0x990e('0x5'));var logger=require(_0x990e('0x6'))(_0x990e('0x7'));config[_0x990e('0x8')]=_[_0x990e('0x9')](config[_0x990e('0x8')],{'host':_0x990e('0xa'),'port':0x18eb});var io=require(_0x990e('0xb'))(new Redis(config[_0x990e('0x8')]));var headers={'Content-Type':'application/json','Accept':_0x990e('0xc')};function emit(_0xd1a8a0,_0x4f4d29,_0x802712){io['to'](_0xd1a8a0)['emit'](_0x4f4d29,_0x802712);}function getTicket(_0x5b6387,_0x1806f7,_0xedde2f,_0x4aac1f,_0x3d9e46){logger[_0x990e('0xd')](_0x990e('0xe'));var _0x41dc42=_[_0x990e('0xf')]({'responder_id':_0x1806f7['id'],'requester_id':_0xedde2f['id'],'name':util['format']('Caller\x20-\x20%s',_0x3d9e46[_0x990e('0x10')]),'phone':_0x3d9e46[_0x990e('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x990e('0x12')](_0x4aac1f[_0x990e('0x13')],_0x3d9e46,'\x20'),'description':intUtil[_0x990e('0x12')](_0x4aac1f['Descriptions'],_0x3d9e46,_0x990e('0x14')),'tags':getTags(_0x4aac1f[_0x990e('0x15')],_0x990e('0x16'))},getCustomFields(_0x4aac1f['Fields'],_0x3d9e46));_0x41dc42[_0x990e('0x17')]=_[_0x990e('0x18')](_['keyBy'](_0x41dc42['custom_fields'],'id'),_0x990e('0x19'));return request({'uri':util[_0x990e('0x1a')]('%s/api/v2/tickets',_0x5b6387[_0x990e('0x1b')]),'method':'POST','body':_0x41dc42})[_0x990e('0x1c')](function(_0x3990b0){logger[_0x990e('0xd')]('Ticket\x20created!');return _0x3990b0;});}function getUser(_0x3b126e,_0x3888d0){if(intUtil[_0x990e('0x1d')](_0x3888d0)){return request({'uri':util[_0x990e('0x1a')](_0x990e('0x1e'),_0x3b126e['remoteUri']),'qs':{'email':_0x3888d0}})[_0x990e('0x1c')](function(_0x4c5766){if(_0x4c5766[_0x990e('0x1f')]){logger[_0x990e('0xd')]('Agent\x20found!');return _['find'](_0x4c5766,function(_0x386297){return _0x386297[_0x990e('0x20')]['email']===_0x3888d0;});}else{logger[_0x990e('0xd')](_0x990e('0x21'));return request({'uri':util[_0x990e('0x1a')](_0x990e('0x22'),_0x3b126e['remoteUri'])})[_0x990e('0x1c')](function(_0x369168){logger[_0x990e('0xd')](_0x990e('0x23'));return _0x369168;});}});}else{logger[_0x990e('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x990e('0x1a')](_0x990e('0x22'),_0x3b126e['remoteUri'])})[_0x990e('0x1c')](function(_0x5a6625){logger['info'](_0x990e('0x23'));return _0x5a6625;});}}function getEndUser(_0x5db4f9,_0x19a939,_0x4ba399){logger['info'](_0x990e('0x24'),_0x4ba399);return request({'uri':util[_0x990e('0x1a')]('%s/api/v2/contacts',_0x5db4f9[_0x990e('0x1b')]),'qs':{'phone':_0x4ba399}})[_0x990e('0x1c')](function(_0x3f57f1){if(_0x3f57f1[_0x990e('0x1f')]){logger[_0x990e('0xd')](_0x990e('0x25'));return _['find'](_0x3f57f1,{'phone':_0x4ba399});}else{logger[_0x990e('0xd')](_0x990e('0x26'));return request({'uri':util[_0x990e('0x1a')](_0x990e('0x27'),_0x5db4f9[_0x990e('0x1b')]),'method':'POST','body':{'name':_0x19a939,'phone':_0x4ba399}})['then'](function(_0x2594ec){logger[_0x990e('0xd')](_0x990e('0x28'));return _0x2594ec;});}});}function getAuth(_0x286a71){return util[_0x990e('0x1a')]('Basic\x20%s',new Buffer(_0x286a71['apiKey']+':X')[_0x990e('0x29')](_0x990e('0x2a')));}function request(_0x3a64b7){logger['debug']('[HTTP]',JSON[_0x990e('0x2b')](_0x3a64b7));return rp(_[_0x990e('0x9')](_0x3a64b7,{'method':_0x990e('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x2a2e40,_0x2cf160){var _0x5dd42e=[];if(_0x2a2e40&&_0x2a2e40[_0x990e('0x1f')]>0x0){_0x5dd42e=_[_0x990e('0x2d')](_0x2a2e40,_0x2cf160);}return _0x5dd42e;}function getCustomFields(_0x9ba097,_0x42011d){var _0x219d87=[];var _0x2f3270={'custom_fields':[]};if(_0x9ba097[_0x990e('0x1f')]>0x0){_['forEach'](_0x9ba097,function(_0x1a1b92){if(_0x1a1b92['type']===_0x990e('0x2e')&&_0x1a1b92['nameField']&&!_0x1a1b92[_0x990e('0x2f')]){_0x2f3270[_0x1a1b92[_0x990e('0x30')][_0x990e('0x31')]()]=_0x1a1b92[_0x990e('0x32')][_0x990e('0x29')]();}else if(_0x1a1b92[_0x990e('0x33')]===_0x990e('0x2e')&&_0x1a1b92['idField']&&_0x1a1b92[_0x990e('0x2f')]){_0x2f3270[_0x990e('0x17')]['push']({'id':_0x1a1b92[_0x990e('0x34')],'value':_0x1a1b92['content'][_0x990e('0x29')]()});}else if(_0x1a1b92[_0x990e('0x33')]===_0x990e('0x35')&&_0x1a1b92[_0x990e('0x36')]&&_0x1a1b92[_0x990e('0x34')]&&_0x1a1b92[_0x990e('0x2f')]){_0x42011d[_0x1a1b92[_0x990e('0x36')]]&&_0x2f3270[_0x990e('0x17')][_0x990e('0x37')]({'id':_0x1a1b92['idField'],'value':_0x42011d[_0x1a1b92['variableName']][_0x990e('0x29')]()});}else if(_0x1a1b92[_0x990e('0x33')]==='customVariable'&&_0x1a1b92['Variable']&&_0x1a1b92['Variable'][_0x990e('0x16')]&&_0x1a1b92[_0x990e('0x34')]&&_0x1a1b92['customField']){_0x42011d[_0x1a1b92[_0x990e('0x38')][_0x990e('0x16')]['toLowerCase']()]&&_0x2f3270[_0x990e('0x17')][_0x990e('0x37')]({'id':_0x1a1b92[_0x990e('0x34')],'value':_0x42011d[_0x1a1b92[_0x990e('0x38')][_0x990e('0x16')][_0x990e('0x31')]()][_0x990e('0x29')]()});}});}return _0x2f3270;}exports[_0x990e('0x39')]=function(_0xad729e,_0x8dc101,_0x4b529b,_0x2ccebb,_0x44adab,_0x3aa0a9){var _0x47c828,_0x4bac99;_0x3aa0a9[_0x990e('0x1b')]=intUtil[_0x990e('0x3a')](_0x3aa0a9['remoteUri']);_0x3aa0a9['serverUrl']=intUtil[_0x990e('0x3a')](_0x3aa0a9[_0x990e('0x3b')]);if(_0x44adab&&_0x44adab['monitor_format']){logger[_0x990e('0xd')](_0x990e('0x3c'),_0x990e('0x3d'));_0x8dc101[_0x990e('0x3e')]=util[_0x990e('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3aa0a9['serverUrl'],_0x8dc101['uniqueid'],md5(_0x8dc101['uniqueid']));}else{_0x8dc101[_0x990e('0x3e')]='';}headers[_0x990e('0x3f')]=getAuth(_0x3aa0a9);return getUser(_0x3aa0a9,_0x2ccebb[_0x990e('0x40')])[_0x990e('0x1c')](function(_0x1e079c){_0x47c828=_0x1e079c;logger['info'](_0x990e('0x41'),_0x47c828['id']);return getEndUser(_0x3aa0a9,_0x8dc101[_0x990e('0x10')],_0x8dc101[_0x990e('0x11')]);})[_0x990e('0x1c')](function(_0xd8155d){_0x4bac99=_0xd8155d;logger[_0x990e('0xd')](_0x990e('0x42'),_0x4bac99['id']);return getTicket(_0x3aa0a9,_0x47c828,_0x4bac99,_0x4b529b,_0x8dc101);})[_0x990e('0x1c')](function(_0x9e68ee){if(_0x9e68ee&&_0x9e68ee['id']){logger['info'](_0x990e('0x43'));logger[_0x990e('0xd')](_0x990e('0x44'),_0x9e68ee['id']);logger['info'](_0x990e('0x3c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x990e('0x1a')](_0x990e('0x45'),_0x2ccebb[_0x990e('0x16')]),'trigger:browser:url',{'uri':util[_0x990e('0x1a')](_0x990e('0x46'),_0x3aa0a9[_0x990e('0x1b')],_0x9e68ee['id'])});}})[_0x990e('0x47')](function(_0x1aae19){logger[_0x990e('0x48')]('[QUEUE]',JSON[_0x990e('0x2b')](_0x1aae19));});};exports[_0x990e('0x49')]=function(_0x2c1b57,_0x21f9c3,_0x2702fb,_0x5d9f90,_0x2fa1c8,_0x284468,_0x327447){var _0x16d6e6,_0x5a2f67;_0x284468[_0x990e('0x1b')]=intUtil[_0x990e('0x3a')](_0x284468[_0x990e('0x1b')]);_0x284468[_0x990e('0x3b')]=intUtil[_0x990e('0x3a')](_0x284468[_0x990e('0x3b')]);if(_0x327447&&_0x327447[_0x990e('0x4a')]&&_0x327447[_0x990e('0x4a')]!=='none'){logger[_0x990e('0xd')](_0x990e('0x4b'),_0x990e('0x3d'));_0x21f9c3[_0x990e('0x3e')]=util[_0x990e('0x1a')](_0x990e('0x4c'),_0x284468[_0x990e('0x3b')],_0x21f9c3[_0x990e('0x4d')],md5(_0x21f9c3[_0x990e('0x4d')]));}headers[_0x990e('0x3f')]=getAuth(_0x284468);return getUser(_0x284468,_0x5d9f90['email'])[_0x990e('0x1c')](function(_0x305e48){_0x16d6e6=_0x305e48;logger['info'](_0x990e('0x41'),_0x16d6e6['id']);return getEndUser(_0x284468,_0x21f9c3[_0x990e('0x4e')],_0x21f9c3['destcalleridnum']);})[_0x990e('0x1c')](function(_0x4def12){_0x5a2f67=_0x4def12;logger[_0x990e('0xd')](_0x990e('0x42'),_0x5a2f67['id']);return getTicket(_0x284468,_0x16d6e6,_0x5a2f67,_0x2702fb,_0x21f9c3);})[_0x990e('0x1c')](function(_0x4a4d27){if(_0x4a4d27&&_0x4a4d27['id']){logger[_0x990e('0xd')](_0x990e('0x43'));logger[_0x990e('0xd')](_0x990e('0x44'),_0x4a4d27['id']);logger[_0x990e('0xd')](_0x990e('0x4b'),_0x990e('0x4f'));emit(util[_0x990e('0x1a')](_0x990e('0x45'),_0x5d9f90[_0x990e('0x16')]),'trigger:browser:url',{'uri':util['format'](_0x990e('0x46'),_0x284468[_0x990e('0x1b')],_0x4a4d27['id'])});}})[_0x990e('0x47')](function(_0x12454a){logger['error'](_0x990e('0x4b'),JSON['stringify'](_0x12454a));});};exports[_0x990e('0x50')]=function(_0x598991,_0x226c35,_0x55182f,_0x588ab1,_0x58bb03,_0xa3865){var _0x5cb54a,_0x4d3111;_0xa3865[_0x990e('0x1b')]=intUtil[_0x990e('0x3a')](_0xa3865[_0x990e('0x1b')]);_0xa3865[_0x990e('0x3b')]=intUtil[_0x990e('0x3a')](_0xa3865[_0x990e('0x3b')]);if(_0x58bb03&&_0x58bb03['monitor_format']){logger[_0x990e('0xd')](_0x990e('0x51'),_0x990e('0x3d'));_0x226c35['recordingURL']=util[_0x990e('0x1a')](_0x990e('0x4c'),_0xa3865[_0x990e('0x3b')],_0x226c35[_0x990e('0x4d')],md5(_0x226c35[_0x990e('0x4d')]));}else{_0x226c35[_0x990e('0x3e')]='';}headers['Authorization']=getAuth(_0xa3865);return getUser(_0xa3865,'')[_0x990e('0x1c')](function(_0x3dd840){_0x5cb54a=_0x3dd840;logger['info']('The\x20User\x20ID\x20is:',_0x5cb54a['id']);return getEndUser(_0xa3865,_0x226c35['calleridname'],_0x226c35['calleridnum']);})['then'](function(_0x38d4d9){_0x4d3111=_0x38d4d9;logger[_0x990e('0xd')](_0x990e('0x42'),_0x4d3111['id']);return getTicket(_0xa3865,_0x5cb54a,_0x4d3111,_0x55182f,_0x226c35);})[_0x990e('0x1c')](function(_0x4f7031){if(_0x4f7031){logger[_0x990e('0xd')](_0x990e('0x43'));logger[_0x990e('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4f7031['id']);}})[_0x990e('0x47')](function(_0x298b87){logger[_0x990e('0x48')](_0x990e('0x51'),JSON[_0x990e('0x2b')](_0x298b87));});}; \ No newline at end of file +var _0x27fd=['push','content','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Ticket\x20ID\x20is:','trigger:browser:url','[ABANDONED]','catch','lodash','request-promise','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','mapValues','custom_fields','value','format','%s/api/v2/tickets','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','remoteUri','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','stringify','GET','length','map','type','string','customField','nameField','toLowerCase','idField'];(function(_0x9f6be9,_0x4f59a9){var _0x54b04d=function(_0x143a94){while(--_0x143a94){_0x9f6be9['push'](_0x9f6be9['shift']());}};_0x54b04d(++_0x4f59a9);}(_0x27fd,0x74));var _0xd27f=function(_0x2ce6c4,_0x1493e0){_0x2ce6c4=_0x2ce6c4-0x0;var _0x3fa5ef=_0x27fd[_0x2ce6c4];return _0x3fa5ef;};'use strict';var _=require(_0xd27f('0x0'));var rp=require(_0xd27f('0x1'));var md5=require('md5');var util=require(_0xd27f('0x2'));var Redis=require('ioredis');var intUtil=require(_0xd27f('0x3'));var config=require(_0xd27f('0x4'));var logger=require(_0xd27f('0x5'))(_0xd27f('0x6'));config[_0xd27f('0x7')]=_[_0xd27f('0x8')](config[_0xd27f('0x7')],{'host':_0xd27f('0x9'),'port':0x18eb});var io=require(_0xd27f('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0xd27f('0xb'),'Accept':_0xd27f('0xb')};function emit(_0x1b2389,_0x3467e2,_0x1b0e81){io['to'](_0x1b2389)[_0xd27f('0xc')](_0x3467e2,_0x1b0e81);}function getTicket(_0x464a48,_0x53f76e,_0xa9b67e,_0x5104d5,_0x38ec4d){logger['info'](_0xd27f('0xd'));var _0x2c9f8f=_['merge']({'responder_id':_0x53f76e['id'],'requester_id':_0xa9b67e['id'],'name':util['format']('Caller\x20-\x20%s',_0x38ec4d[_0xd27f('0xe')]),'phone':_0x38ec4d[_0xd27f('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xd27f('0x10')](_0x5104d5[_0xd27f('0x11')],_0x38ec4d,'\x20'),'description':intUtil[_0xd27f('0x10')](_0x5104d5[_0xd27f('0x12')],_0x38ec4d,_0xd27f('0x13')),'tags':getTags(_0x5104d5[_0xd27f('0x14')],'name')},getCustomFields(_0x5104d5[_0xd27f('0x15')],_0x38ec4d));_0x2c9f8f['custom_fields']=_[_0xd27f('0x16')](_['keyBy'](_0x2c9f8f[_0xd27f('0x17')],'id'),_0xd27f('0x18'));return request({'uri':util[_0xd27f('0x19')](_0xd27f('0x1a'),_0x464a48['remoteUri']),'method':_0xd27f('0x1b'),'body':_0x2c9f8f})[_0xd27f('0x1c')](function(_0x190fdf){logger[_0xd27f('0x1d')](_0xd27f('0x1e'));return _0x190fdf;});}function getUser(_0x26999a,_0x3c794c){if(intUtil[_0xd27f('0x1f')](_0x3c794c)){return request({'uri':util[_0xd27f('0x19')](_0xd27f('0x20'),_0x26999a['remoteUri']),'qs':{'email':_0x3c794c}})['then'](function(_0x3c48d0){if(_0x3c48d0['length']){logger[_0xd27f('0x1d')](_0xd27f('0x21'));return _[_0xd27f('0x22')](_0x3c48d0,function(_0x1ea447){return _0x1ea447['contact'][_0xd27f('0x23')]===_0x3c794c;});}else{logger[_0xd27f('0x1d')](_0xd27f('0x24'));return request({'uri':util[_0xd27f('0x19')](_0xd27f('0x25'),_0x26999a['remoteUri'])})[_0xd27f('0x1c')](function(_0x21e1d9){logger[_0xd27f('0x1d')]('Admin\x20account\x20selected.');return _0x21e1d9;});}});}else{logger[_0xd27f('0x1d')](_0xd27f('0x26'));return request({'uri':util[_0xd27f('0x19')](_0xd27f('0x25'),_0x26999a[_0xd27f('0x27')])})[_0xd27f('0x1c')](function(_0x1f3684){logger[_0xd27f('0x1d')]('Admin\x20account\x20selected.');return _0x1f3684;});}}function getEndUser(_0x2f1d6e,_0x1721d9,_0x1eb780){logger[_0xd27f('0x1d')]('Searching\x20enduser\x20with\x20phone',_0x1eb780);return request({'uri':util[_0xd27f('0x19')](_0xd27f('0x28'),_0x2f1d6e[_0xd27f('0x27')]),'qs':{'phone':_0x1eb780}})[_0xd27f('0x1c')](function(_0x59dcba){if(_0x59dcba['length']){logger[_0xd27f('0x1d')](_0xd27f('0x29'));return _[_0xd27f('0x22')](_0x59dcba,{'phone':_0x1eb780});}else{logger[_0xd27f('0x1d')](_0xd27f('0x2a'));return request({'uri':util[_0xd27f('0x19')](_0xd27f('0x28'),_0x2f1d6e[_0xd27f('0x27')]),'method':_0xd27f('0x1b'),'body':{'name':_0x1721d9,'phone':_0x1eb780}})['then'](function(_0x4b8ba7){logger['info'](_0xd27f('0x2b'));return _0x4b8ba7;});}});}function getAuth(_0x1c856d){return util[_0xd27f('0x19')](_0xd27f('0x2c'),new Buffer(_0x1c856d[_0xd27f('0x2d')]+':X')[_0xd27f('0x2e')]('base64'));}function request(_0x190812){logger[_0xd27f('0x2f')]('[HTTP]',JSON[_0xd27f('0x30')](_0x190812));return rp(_[_0xd27f('0x8')](_0x190812,{'method':_0xd27f('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x1b5746,_0x23ddf2){var _0x57d8eb=[];if(_0x1b5746&&_0x1b5746[_0xd27f('0x32')]>0x0){_0x57d8eb=_[_0xd27f('0x33')](_0x1b5746,_0x23ddf2);}return _0x57d8eb;}function getCustomFields(_0x444f1b,_0x4be393){var _0x4983e4=[];var _0x1f5c30={'custom_fields':[]};if(_0x444f1b[_0xd27f('0x32')]>0x0){_['forEach'](_0x444f1b,function(_0x4b30e7){if(_0x4b30e7[_0xd27f('0x34')]===_0xd27f('0x35')&&_0x4b30e7['nameField']&&!_0x4b30e7[_0xd27f('0x36')]){_0x1f5c30[_0x4b30e7[_0xd27f('0x37')][_0xd27f('0x38')]()]=_0x4b30e7['content'][_0xd27f('0x2e')]();}else if(_0x4b30e7[_0xd27f('0x34')]===_0xd27f('0x35')&&_0x4b30e7[_0xd27f('0x39')]&&_0x4b30e7[_0xd27f('0x36')]){_0x1f5c30[_0xd27f('0x17')][_0xd27f('0x3a')]({'id':_0x4b30e7[_0xd27f('0x39')],'value':_0x4b30e7[_0xd27f('0x3b')][_0xd27f('0x2e')]()});}else if(_0x4b30e7[_0xd27f('0x34')]===_0xd27f('0x3c')&&_0x4b30e7['variableName']&&_0x4b30e7[_0xd27f('0x39')]&&_0x4b30e7[_0xd27f('0x36')]){_0x4be393[_0x4b30e7[_0xd27f('0x3d')]]&&_0x1f5c30[_0xd27f('0x17')][_0xd27f('0x3a')]({'id':_0x4b30e7['idField'],'value':_0x4be393[_0x4b30e7[_0xd27f('0x3d')]]['toString']()});}else if(_0x4b30e7['type']===_0xd27f('0x3e')&&_0x4b30e7['Variable']&&_0x4b30e7[_0xd27f('0x3f')][_0xd27f('0x40')]&&_0x4b30e7[_0xd27f('0x39')]&&_0x4b30e7['customField']){_0x4be393[_0x4b30e7[_0xd27f('0x3f')][_0xd27f('0x40')][_0xd27f('0x38')]()]&&_0x1f5c30['custom_fields'][_0xd27f('0x3a')]({'id':_0x4b30e7['idField'],'value':_0x4be393[_0x4b30e7['Variable'][_0xd27f('0x40')][_0xd27f('0x38')]()][_0xd27f('0x2e')]()});}});}return _0x1f5c30;}exports[_0xd27f('0x41')]=function(_0x50afe3,_0x5540b9,_0x2dc7c0,_0x50186a,_0x93b679,_0x349070){var _0x2449ff,_0x809b81;_0x349070[_0xd27f('0x27')]=intUtil[_0xd27f('0x42')](_0x349070['remoteUri']);_0x349070[_0xd27f('0x43')]=intUtil[_0xd27f('0x42')](_0x349070[_0xd27f('0x43')]);if(_0x93b679&&_0x93b679[_0xd27f('0x44')]){logger[_0xd27f('0x1d')]('[QUEUE]',_0xd27f('0x45'));_0x5540b9[_0xd27f('0x46')]=util[_0xd27f('0x19')](_0xd27f('0x47'),_0x349070['serverUrl'],_0x5540b9[_0xd27f('0x48')],md5(_0x5540b9[_0xd27f('0x48')]));}else{_0x5540b9[_0xd27f('0x46')]='';}headers[_0xd27f('0x49')]=getAuth(_0x349070);return getUser(_0x349070,_0x50186a['email'])[_0xd27f('0x1c')](function(_0x4fbdf6){_0x2449ff=_0x4fbdf6;logger[_0xd27f('0x1d')]('The\x20User\x20ID\x20is:',_0x2449ff['id']);return getEndUser(_0x349070,_0x5540b9['calleridname'],_0x5540b9[_0xd27f('0xf')]);})[_0xd27f('0x1c')](function(_0x463a73){_0x809b81=_0x463a73;logger[_0xd27f('0x1d')](_0xd27f('0x4a'),_0x809b81['id']);return getTicket(_0x349070,_0x2449ff,_0x809b81,_0x2dc7c0,_0x5540b9);})[_0xd27f('0x1c')](function(_0x1a2147){if(_0x1a2147&&_0x1a2147['id']){logger[_0xd27f('0x1d')](_0xd27f('0x1e'));logger[_0xd27f('0x1d')]('The\x20Ticket\x20ID\x20is:',_0x1a2147['id']);logger[_0xd27f('0x1d')](_0xd27f('0x4b'),_0xd27f('0x4c'));emit(util['format'](_0xd27f('0x4d'),_0x50186a[_0xd27f('0x40')]),'trigger:browser:url',{'uri':util[_0xd27f('0x19')]('%s/helpdesk/tickets/%d',_0x349070[_0xd27f('0x27')],_0x1a2147['id'])});}})['catch'](function(_0x1e21e3){logger[_0xd27f('0x4e')](_0xd27f('0x4b'),JSON[_0xd27f('0x30')](_0x1e21e3));});};exports['outbound']=function(_0x320ffe,_0x34f981,_0x12e252,_0x1fc76a,_0x5d06d8,_0x59941e,_0x4e4335){var _0x46ee6c,_0x1a8220;_0x59941e[_0xd27f('0x27')]=intUtil['stripTrailingSlash'](_0x59941e[_0xd27f('0x27')]);_0x59941e[_0xd27f('0x43')]=intUtil[_0xd27f('0x42')](_0x59941e[_0xd27f('0x43')]);if(_0x4e4335&&_0x4e4335['recordingFormat']&&_0x4e4335['recordingFormat']!==_0xd27f('0x4f')){logger[_0xd27f('0x1d')](_0xd27f('0x50'),_0xd27f('0x45'));_0x34f981['recordingURL']=util[_0xd27f('0x19')](_0xd27f('0x47'),_0x59941e['serverUrl'],_0x34f981[_0xd27f('0x48')],md5(_0x34f981[_0xd27f('0x48')]));}headers[_0xd27f('0x49')]=getAuth(_0x59941e);return getUser(_0x59941e,_0x1fc76a['email'])[_0xd27f('0x1c')](function(_0x4aea23){_0x46ee6c=_0x4aea23;logger[_0xd27f('0x1d')](_0xd27f('0x51'),_0x46ee6c['id']);return getEndUser(_0x59941e,_0x34f981[_0xd27f('0x52')],_0x34f981['destcalleridnum']);})[_0xd27f('0x1c')](function(_0x4b311d){_0x1a8220=_0x4b311d;logger['info'](_0xd27f('0x4a'),_0x1a8220['id']);return getTicket(_0x59941e,_0x46ee6c,_0x1a8220,_0x12e252,_0x34f981);})['then'](function(_0x94ec1a){if(_0x94ec1a&&_0x94ec1a['id']){logger[_0xd27f('0x1d')](_0xd27f('0x1e'));logger[_0xd27f('0x1d')](_0xd27f('0x53'),_0x94ec1a['id']);logger[_0xd27f('0x1d')](_0xd27f('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x1fc76a[_0xd27f('0x40')]),_0xd27f('0x54'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x59941e[_0xd27f('0x27')],_0x94ec1a['id'])});}})['catch'](function(_0x1f6e99){logger[_0xd27f('0x4e')]('[OUTBOUND]',JSON[_0xd27f('0x30')](_0x1f6e99));});};exports['abandoned']=function(_0x4c9630,_0x50d776,_0x27e814,_0x53df07,_0x217094,_0x256121){var _0x13e636,_0x595615;_0x256121['remoteUri']=intUtil[_0xd27f('0x42')](_0x256121[_0xd27f('0x27')]);_0x256121[_0xd27f('0x43')]=intUtil[_0xd27f('0x42')](_0x256121['serverUrl']);if(_0x217094&&_0x217094[_0xd27f('0x44')]){logger['info'](_0xd27f('0x55'),_0xd27f('0x45'));_0x50d776[_0xd27f('0x46')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x256121['serverUrl'],_0x50d776[_0xd27f('0x48')],md5(_0x50d776[_0xd27f('0x48')]));}else{_0x50d776['recordingURL']='';}headers[_0xd27f('0x49')]=getAuth(_0x256121);return getUser(_0x256121,'')[_0xd27f('0x1c')](function(_0x150470){_0x13e636=_0x150470;logger[_0xd27f('0x1d')]('The\x20User\x20ID\x20is:',_0x13e636['id']);return getEndUser(_0x256121,_0x50d776[_0xd27f('0xe')],_0x50d776[_0xd27f('0xf')]);})[_0xd27f('0x1c')](function(_0x362b9f){_0x595615=_0x362b9f;logger[_0xd27f('0x1d')](_0xd27f('0x4a'),_0x595615['id']);return getTicket(_0x256121,_0x13e636,_0x595615,_0x27e814,_0x50d776);})[_0xd27f('0x1c')](function(_0x1e997b){if(_0x1e997b){logger['info'](_0xd27f('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x1e997b['id']);}})[_0xd27f('0x56')](function(_0x5bf04d){logger['error'](_0xd27f('0x55'),JSON[_0xd27f('0x30')](_0x5bf04d));});}; \ 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 22fb63d..12355ae 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 _0xa87f=['Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','abandoned','zendesk','vtiger','unknown\x20integration','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','salesforce','sugarcrm','freshdesk','zoho','desk','servicenow','dynamics365','exec','includes','toLowerCase','data1','data2'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa87f,0x16c));var _0xfa87=function(_0x3b7e17,_0x30e60f){_0x3b7e17=_0x3b7e17-0x0;var _0x1598ed=_0xa87f[_0x3b7e17];return _0x1598ed;};'use strict';var _=require('lodash');var util=require(_0xfa87('0x0'));var zendesk=require(_0xfa87('0x1'));var salesforce=require(_0xfa87('0x2'));var sugarcrm=require(_0xfa87('0x3'));var freshdesk=require(_0xfa87('0x4'));var zoho=require(_0xfa87('0x5'));var desk=require(_0xfa87('0x6'));var vtiger=require(_0xfa87('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0xfa87('0x8'));var integrations=['zendesk',_0xfa87('0x9'),_0xfa87('0xa'),_0xfa87('0xb'),_0xfa87('0xc'),_0xfa87('0xd'),'vtiger',_0xfa87('0xe'),_0xfa87('0xf')];exports[_0xfa87('0x10')]=function(_0x5c240f,_0x47defd,_0x5b5f1d,_0x5983a2,_0x9c297d,_0x3a91d4){if(_0x5b5f1d){if(_[_0xfa87('0x11')](integrations,_0x5c240f['data1'][_0xfa87('0x12')]())){try{var _0x2d1b1a=null;var _0x19d663='';var _0x3ac09b=_0x5b5f1d[_0x5c240f[_0xfa87('0x13')]['toLowerCase']()];if(_0x3ac09b){var _0x79c8b6=_0x3ac09b[_0x5c240f[_0xfa87('0x14')]];if(_0x79c8b6){var _0x331965=_['find'](_0x79c8b6[_0xfa87('0x15')],{'id':parseInt(_0x5c240f[_0xfa87('0x16')],0xa)});if(_0x331965){if(_0x5983a2){if(_0x9c297d&&_0x47defd[_0xfa87('0x17')]){_0x19d663=_0xfa87('0x17');}else if(_0x47defd[_0xfa87('0x18')]){_0x19d663=_0xfa87('0x19');}else{console[_0xfa87('0x1a')](_0xfa87('0x1b'),_0x47defd);}}else{_0x19d663=_0xfa87('0x1c');}switch(_0x5c240f[_0xfa87('0x13')][_0xfa87('0x12')]()){case _0xfa87('0x1d'):zendesk[_0x19d663](_0x5c240f,_0x47defd,_0x331965,_0x5983a2,_0x9c297d,_0x79c8b6,_0x3a91d4);break;case _0xfa87('0x9'):salesforce[_0x19d663](_0x5c240f,_0x47defd,_0x331965,_0x5983a2,_0x9c297d,_0x79c8b6,_0x3a91d4);break;case _0xfa87('0xa'):sugarcrm[_0x19d663](_0x5c240f,_0x47defd,_0x331965,_0x5983a2,_0x9c297d,_0x79c8b6,_0x3a91d4);break;case _0xfa87('0xb'):freshdesk[_0x19d663](_0x5c240f,_0x47defd,_0x331965,_0x5983a2,_0x9c297d,_0x79c8b6,_0x3a91d4);break;case _0xfa87('0xc'):zoho[_0x19d663](_0x5c240f,_0x47defd,_0x331965,_0x5983a2,_0x9c297d,_0x79c8b6,_0x3a91d4);break;case _0xfa87('0xd'):desk[_0x19d663](_0x5c240f,_0x47defd,_0x331965,_0x5983a2,_0x9c297d,_0x79c8b6,_0x3a91d4);break;case _0xfa87('0x1e'):vtiger[_0x19d663](_0x5c240f,_0x47defd,_0x331965,_0x5983a2,_0x9c297d,_0x79c8b6,_0x3a91d4);break;case'servicenow':servicenow['cs'](_0x5c240f,_0x47defd,_0x331965,_0x5983a2,_0x9c297d,_0x79c8b6,_0x3a91d4,_0x19d663);break;case _0xfa87('0xf'):dynamics365['cs'](_0x5c240f,_0x47defd,_0x331965,_0x5983a2,_0x9c297d,_0x79c8b6,_0x3a91d4,_0x19d663);break;default:console[_0xfa87('0x1a')](_0xfa87('0x1f'));}}else{_0x2d1b1a=require('../../../../config/logger')(_0x5c240f[_0xfa87('0x13')][_0xfa87('0x12')]());_0x2d1b1a[_0xfa87('0x20')](_0xfa87('0x21'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x5c240f[_0xfa87('0x13')]['toLowerCase'](),_0x5c240f[_0xfa87('0x16')]));}}else{_0x2d1b1a=require('../../../../config/logger')(_0x5c240f['data1'][_0xfa87('0x12')]());_0x2d1b1a[_0xfa87('0x20')](_0xfa87('0x21'),util['format'](_0xfa87('0x22'),_0x5c240f[_0xfa87('0x13')]['toLowerCase'](),_0x5c240f[_0xfa87('0x14')]));}}else{}}catch(_0x3b8ec6){console[_0xfa87('0x20')](_0x3b8ec6);}}}}; \ No newline at end of file +var _0x6a3a=['includes','data1','toLowerCase','find','queue','outbound','EVENT\x20UNKNOWN','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./zoho','./vtiger','./servicenow','./dynamics365','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','servicenow'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a3a,0x1f1));var _0xa6a3=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x6a3a[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0xa6a3('0x0'));var util=require(_0xa6a3('0x1'));var zendesk=require(_0xa6a3('0x2'));var salesforce=require(_0xa6a3('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xa6a3('0x4'));var desk=require('./desk');var vtiger=require(_0xa6a3('0x5'));var servicenow=require(_0xa6a3('0x6'));var dynamics365=require(_0xa6a3('0x7'));var integrations=[_0xa6a3('0x8'),'salesforce',_0xa6a3('0x9'),_0xa6a3('0xa'),_0xa6a3('0xb'),_0xa6a3('0xc'),_0xa6a3('0xd'),_0xa6a3('0xe'),'dynamics365'];exports['exec']=function(_0x49c001,_0xf2d739,_0xc3e6bb,_0x16bc1a,_0x24e7b7,_0x5687a2){if(_0xc3e6bb){if(_[_0xa6a3('0xf')](integrations,_0x49c001[_0xa6a3('0x10')]['toLowerCase']())){try{var _0x15d268=null;var _0x21d5fe='';var _0x53bb88=_0xc3e6bb[_0x49c001[_0xa6a3('0x10')][_0xa6a3('0x11')]()];if(_0x53bb88){var _0x9a220c=_0x53bb88[_0x49c001['data2']];if(_0x9a220c){var _0x309885=_[_0xa6a3('0x12')](_0x9a220c['Configurations'],{'id':parseInt(_0x49c001['data3'],0xa)});if(_0x309885){if(_0x16bc1a){if(_0x24e7b7&&_0xf2d739[_0xa6a3('0x13')]){_0x21d5fe=_0xa6a3('0x13');}else if(_0xf2d739['routeId']){_0x21d5fe=_0xa6a3('0x14');}else{console['log'](_0xa6a3('0x15'),_0xf2d739);}}else{_0x21d5fe='abandoned';}switch(_0x49c001[_0xa6a3('0x10')][_0xa6a3('0x11')]()){case _0xa6a3('0x8'):zendesk[_0x21d5fe](_0x49c001,_0xf2d739,_0x309885,_0x16bc1a,_0x24e7b7,_0x9a220c,_0x5687a2);break;case'salesforce':salesforce[_0x21d5fe](_0x49c001,_0xf2d739,_0x309885,_0x16bc1a,_0x24e7b7,_0x9a220c,_0x5687a2);break;case _0xa6a3('0x9'):sugarcrm[_0x21d5fe](_0x49c001,_0xf2d739,_0x309885,_0x16bc1a,_0x24e7b7,_0x9a220c,_0x5687a2);break;case _0xa6a3('0xa'):freshdesk[_0x21d5fe](_0x49c001,_0xf2d739,_0x309885,_0x16bc1a,_0x24e7b7,_0x9a220c,_0x5687a2);break;case _0xa6a3('0xb'):zoho[_0x21d5fe](_0x49c001,_0xf2d739,_0x309885,_0x16bc1a,_0x24e7b7,_0x9a220c,_0x5687a2);break;case _0xa6a3('0xc'):desk[_0x21d5fe](_0x49c001,_0xf2d739,_0x309885,_0x16bc1a,_0x24e7b7,_0x9a220c,_0x5687a2);break;case _0xa6a3('0xd'):vtiger[_0x21d5fe](_0x49c001,_0xf2d739,_0x309885,_0x16bc1a,_0x24e7b7,_0x9a220c,_0x5687a2);break;case _0xa6a3('0xe'):servicenow['cs'](_0x49c001,_0xf2d739,_0x309885,_0x16bc1a,_0x24e7b7,_0x9a220c,_0x5687a2,_0x21d5fe);break;case'dynamics365':dynamics365['cs'](_0x49c001,_0xf2d739,_0x309885,_0x16bc1a,_0x24e7b7,_0x9a220c,_0x5687a2,_0x21d5fe);break;default:console[_0xa6a3('0x16')](_0xa6a3('0x17'));}}else{_0x15d268=require(_0xa6a3('0x18'))(_0x49c001[_0xa6a3('0x10')]['toLowerCase']());_0x15d268[_0xa6a3('0x19')](_0xa6a3('0x1a'),util[_0xa6a3('0x1b')](_0xa6a3('0x1c'),_0x49c001[_0xa6a3('0x10')][_0xa6a3('0x11')](),_0x49c001[_0xa6a3('0x1d')]));}}else{_0x15d268=require(_0xa6a3('0x18'))(_0x49c001[_0xa6a3('0x10')][_0xa6a3('0x11')]());_0x15d268['error'](_0xa6a3('0x1a'),util[_0xa6a3('0x1b')](_0xa6a3('0x1e'),_0x49c001[_0xa6a3('0x10')]['toLowerCase'](),_0x49c001[_0xa6a3('0x1f')]));}}else{}}catch(_0x596f26){console['error'](_0x596f26);}}}}; \ 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 f7a81cd..0051bd0 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 _0xe706=['variable','variableName','customVariable','Variable','name','toLowerCase','toString','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','format','user:%s','trigger:salesforce:display','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.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','[ABANDONED]','calleridnum','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','assign','utc','getString','Subjects','Case','ContactId','create','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','info','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','sobject','Contact','contact','Lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','upperFirst','type','string','idField','content'];(function(_0x19b1c2,_0x205062){var _0x4e1ae5=function(_0x5a1cb7){while(--_0x5a1cb7){_0x19b1c2['push'](_0x19b1c2['shift']());}};_0x4e1ae5(++_0x205062);}(_0xe706,0xa3));var _0x6e70=function(_0x487cb0,_0x339d3e){_0x487cb0=_0x487cb0-0x0;var _0x5a8047=_0xe706[_0x487cb0];return _0x5a8047;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var md5=require(_0x6e70('0x3'));var jsforce=require(_0x6e70('0x4'));var util=require(_0x6e70('0x5'));var Redis=require(_0x6e70('0x6'));var intUtil=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var logger=require(_0x6e70('0x9'))(_0x6e70('0xa'));config[_0x6e70('0xb')]=_[_0x6e70('0xc')](config[_0x6e70('0xb')],{'host':_0x6e70('0xd'),'port':0x18eb});var io=require(_0x6e70('0xe'))(new Redis(config[_0x6e70('0xb')]));function emit(_0x3c4843,_0x449b48,_0x954545){io['to'](_0x3c4843)[_0x6e70('0xf')](_0x449b48,_0x954545);}function getTicket(_0x100eb7,_0x463853,_0x743eb5,_0x3f474a,_0x37b3e0,_0x4600f9,_0x5b3d07,_0x47f6b2){var _0x3594c1={};if(_0x3f474a[_0x6e70('0x10')]===_0x6e70('0x11')){_0x3594c1=Object[_0x6e70('0x12')]({},{'OwnerId':_0x463853['id'],'ActivityDate':moment[_0x6e70('0x13')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x6e70('0x14')](_0x3f474a[_0x6e70('0x15')],_0x37b3e0,'\x20'),'Description':intUtil[_0x6e70('0x14')](_0x3f474a['Descriptions'],_0x37b3e0,'\x0a')},getCustomFields(_0x4600f9,_0x37b3e0));if(_0x743eb5){_0x3594c1['WhoId']=_0x743eb5['id'];}}else if(_0x3f474a['ticketType']===_0x6e70('0x16')){_0x3594c1=Object['assign']({},{'OwnerId':_0x463853['id'],'Subject':intUtil['getString'](_0x3f474a[_0x6e70('0x15')],_0x37b3e0,'\x20'),'Description':intUtil[_0x6e70('0x14')](_0x3f474a['Descriptions'],_0x37b3e0,'\x0a')},getCustomFields(_0x4600f9,_0x37b3e0));if(_0x743eb5){_0x3594c1[_0x6e70('0x17')]=_0x743eb5['id'];}}return _0x5b3d07['sobject'](_0x3f474a[_0x6e70('0x10')])[_0x6e70('0x18')](_0x3594c1);}function getUser(_0x4ca554,_0x49029f,_0x3bd572){if(!_['isNil'](_0x49029f)&&intUtil[_0x6e70('0x19')](_0x49029f)){var _0x173afe={'Email':_0x49029f};var _0x53acdc={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3bd572['sobject'](_0x6e70('0x1a'))[_0x6e70('0x1b')](_0x173afe,_0x53acdc)[_0x6e70('0x1c')]()[_0x6e70('0x1d')](function(_0x3af484){if(_0x3af484[_0x6e70('0x1e')]){var _0x1b2453=_[_0x6e70('0x1b')](_0x3af484,function(_0x29326f){return _0x29326f[_0x6e70('0x1f')]===_0x49029f;});if(_0x1b2453){logger['info'](_0x6e70('0x20'),_0x49029f);return BPromise[_0x6e70('0x21')]({'id':_0x1b2453['Id'],'name':_0x1b2453[_0x6e70('0x22')]});}}else{logger['info'](_0x6e70('0x23'),_0x49029f);return _0x3bd572[_0x6e70('0x24')]()[_0x6e70('0x1d')](function(_0x50da2c){return BPromise[_0x6e70('0x21')]({'id':_0x50da2c['user_id'],'name':_0x50da2c['display_name']});});}});}else{logger['info'](_0x6e70('0x23'),_0x49029f);return _0x3bd572[_0x6e70('0x24')]()['then'](function(_0x3ecdf1){return BPromise[_0x6e70('0x21')]({'id':_0x3ecdf1['user_id'],'name':_0x3ecdf1[_0x6e70('0x25')]});});}}function getEndUser(_0x67fb43,_0x2bb231,_0x4a67ac,_0x54a5fe,_0x2c4d37){var _0x3af17f={'Phone':_0x54a5fe};var _0x83c836={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6e70('0x21')]()[_0x6e70('0x1d')](function(){if(_0x2bb231['ticketType']===_0x6e70('0x11')){logger[_0x6e70('0x26')](_0x6e70('0x27'),_0x54a5fe,_0x2bb231[_0x6e70('0x28')]);switch(_0x2bb231[_0x6e70('0x28')]){case _0x6e70('0x29'):return _0x2c4d37[_0x6e70('0x2a')](_0x6e70('0x2b'))[_0x6e70('0x1b')](_0x3af17f,_0x83c836)[_0x6e70('0x1c')]()['then'](function(_0x1b27d8){if(_0x1b27d8&&_0x1b27d8['length']){return _0x1b27d8;}else{return _0x2c4d37[_0x6e70('0x2a')]('Lead')[_0x6e70('0x1b')](_0x3af17f,_0x83c836);}});case _0x6e70('0x2c'):return _0x2c4d37[_0x6e70('0x2a')]('Contact')[_0x6e70('0x1b')](_0x3af17f,_0x83c836)[_0x6e70('0x1c')]();case'lead':return _0x2c4d37[_0x6e70('0x2a')](_0x6e70('0x2d'))['find'](_0x3af17f,_0x83c836);default:return null;}}else if(_0x2bb231[_0x6e70('0x10')]===_0x6e70('0x16')){logger[_0x6e70('0x26')](_0x6e70('0x27'),_0x54a5fe,_0x6e70('0x2c'));return _0x2c4d37[_0x6e70('0x2a')](_0x6e70('0x2b'))[_0x6e70('0x1b')](_0x3af17f,_0x83c836)[_0x6e70('0x1c')]();}})[_0x6e70('0x1d')](function(_0x4d32d8){if(_0x4d32d8&&_0x4d32d8[_0x6e70('0x1e')]){var _0x4795a0=_[_0x6e70('0x1b')](_0x4d32d8,function(_0x3222a2){return _0x3222a2[_0x6e70('0x2e')]===_0x54a5fe;});if(_0x4795a0){return BPromise[_0x6e70('0x21')]({'id':_0x4795a0['Id'],'name':_0x4795a0[_0x6e70('0x22')],'phone':_0x4795a0[_0x6e70('0x2e')]});}}})[_0x6e70('0x1d')](function(_0xdd0bee){if(_0xdd0bee){logger[_0x6e70('0x26')](_0x6e70('0x2f'),_0x54a5fe);return BPromise[_0x6e70('0x21')](_0xdd0bee);}else{logger[_0x6e70('0x26')](_0x6e70('0x30'),_0x54a5fe);var _0x501b53={'LastName':_0x4a67ac!==''?_0x4a67ac:util['format'](_0x6e70('0x31'),_0x54a5fe),'Phone':_0x54a5fe};if(_0x2bb231[_0x6e70('0x32')]){if(_0x2bb231[_0x6e70('0x32')]===_0x6e70('0x2c')){logger[_0x6e70('0x26')](_0x6e70('0x33'),_0x54a5fe,_0x2bb231['moduleCreate']);}else if(_0x2bb231[_0x6e70('0x32')]===_0x6e70('0x34')&&_0x2bb231[_0x6e70('0x10')]===_0x6e70('0x11')){logger[_0x6e70('0x26')](_0x6e70('0x33'),_0x54a5fe,_0x2bb231[_0x6e70('0x32')]);_0x501b53[_0x6e70('0x35')]='No\x20Company';}else{return null;}}return _0x2c4d37[_0x6e70('0x2a')](_[_0x6e70('0x36')](_0x2bb231[_0x6e70('0x32')]))[_0x6e70('0x18')](_0x501b53);}});}function getCustomFields(_0x201da9,_0x1de947){var _0x21b0e7={};if(_0x201da9['length']>0x0){_['forEach'](_0x201da9,function(_0x5ae898){if(_0x5ae898[_0x6e70('0x37')]===_0x6e70('0x38')&&_0x5ae898[_0x6e70('0x39')]){_0x21b0e7[_0x5ae898[_0x6e70('0x39')]]=_0x5ae898[_0x6e70('0x3a')]['toString']();}else if(_0x5ae898[_0x6e70('0x37')]===_0x6e70('0x3b')&&_0x5ae898[_0x6e70('0x3c')]&&_0x5ae898['idField']){_0x1de947[_0x5ae898['variableName']]&&(_0x21b0e7[_0x5ae898['idField']]=_0x1de947[_0x5ae898[_0x6e70('0x3c')]]['toString']());}else if(_0x5ae898[_0x6e70('0x37')]===_0x6e70('0x3d')&&_0x5ae898[_0x6e70('0x3e')]&&_0x5ae898[_0x6e70('0x3e')]['name']&&_0x5ae898[_0x6e70('0x39')]){_0x1de947[_0x5ae898['Variable'][_0x6e70('0x3f')][_0x6e70('0x40')]()]&&(_0x21b0e7[_0x5ae898[_0x6e70('0x39')]]=_0x1de947[_0x5ae898[_0x6e70('0x3e')]['name'][_0x6e70('0x40')]()][_0x6e70('0x41')]());}});}return _0x21b0e7;}function getConnection(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x42')][_0x6e70('0x43')](_0x3d39c3[_0x6e70('0x44')]);var _0x552e7e=new jsforce[(_0x6e70('0x45'))]({'oauth2':{'loginUrl':_0x3d39c3[_0x6e70('0x46')]||_0x6e70('0x47'),'clientId':_0x3d39c3[_0x6e70('0x48')],'clientSecret':_0x3d39c3[_0x6e70('0x49')]}});return _0x552e7e[_0x6e70('0x4a')](_0x3d39c3[_0x6e70('0x4b')],_0xac87d6)['then'](function(){logger[_0x6e70('0x26')]('Connection\x20established.');return _0x552e7e;});}exports[_0x6e70('0x4c')]=function(_0x3836e4,_0x4b351e,_0x53efc3,_0x333abd,_0x25a208,_0x18fa40){var _0x587f04,_0x4af9b1,_0x238ebb,_0x11ac3d;_0x18fa40[_0x6e70('0x4d')]=intUtil[_0x6e70('0x4e')](_0x18fa40[_0x6e70('0x4d')]);_0x18fa40[_0x6e70('0x46')]=intUtil['stripTrailingSlash'](_0x18fa40[_0x6e70('0x46')]);if(_0x25a208&&_0x25a208[_0x6e70('0x4f')]){logger[_0x6e70('0x26')](_0x6e70('0x50'),_0x6e70('0x51'));_0x4b351e['recordingURL']=util['format'](_0x6e70('0x52'),_0x18fa40[_0x6e70('0x4d')],_0x4b351e[_0x6e70('0x53')],md5(_0x4b351e[_0x6e70('0x53')]));}else{_0x4b351e[_0x6e70('0x54')]='';}return getConnection(_0x18fa40)['then'](function(_0x41bd0b){_0x11ac3d=_0x41bd0b;return getUser(_0x18fa40,_0x333abd[_0x6e70('0x55')],_0x11ac3d);})[_0x6e70('0x1d')](function(_0x23ebfb){_0x587f04=_0x23ebfb;return getEndUser(_0x18fa40,_0x53efc3,_0x4b351e[_0x6e70('0x56')],_0x4b351e['calleridnum'],_0x11ac3d);})[_0x6e70('0x1d')](function(_0x1dd242){_0x4af9b1=_0x1dd242;return getTicket(_0x18fa40,_0x587f04,_0x4af9b1,_0x53efc3,_0x4b351e,_0x53efc3[_0x6e70('0x57')],_0x11ac3d,_0x6e70('0x4c'));})[_0x6e70('0x1d')](function(_0x3fd03d){_0x238ebb=_0x3fd03d;logger['info'](_0x6e70('0x58'),_0x238ebb['id']);logger[_0x6e70('0x26')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x238ebb['id'],_0x333abd[_0x6e70('0x3f')],_0x18fa40[_0x6e70('0x37')]);switch(_0x18fa40['type']){case _0x6e70('0x59'):emit(util[_0x6e70('0x5a')](_0x6e70('0x5b'),_0x333abd[_0x6e70('0x3f')]),_0x6e70('0x5c'),{'recordId':_0x238ebb['id']});break;case'newTab':emit(util[_0x6e70('0x5a')](_0x6e70('0x5b'),_0x333abd[_0x6e70('0x3f')]),_0x6e70('0x5d'),{'uri':util[_0x6e70('0x5a')](_0x6e70('0x5e'),_0x11ac3d[_0x6e70('0x5f')],_0x238ebb['id'])});break;default:logger[_0x6e70('0x60')](_0x6e70('0x61'));}})[_0x6e70('0x62')](function(_0x13dd17){logger[_0x6e70('0x60')](_0x6e70('0x50'),JSON[_0x6e70('0x63')](_0x13dd17));});};exports[_0x6e70('0x64')]=function(_0x2240a1,_0x324fa6,_0x4329a6,_0x2a8627,_0x1c7dca,_0x4c6aab,_0x28898a){var _0x4434dd,_0x180a13,_0xeeab6e,_0x36757e;_0x4c6aab[_0x6e70('0x4d')]=intUtil['stripTrailingSlash'](_0x4c6aab[_0x6e70('0x4d')]);_0x4c6aab[_0x6e70('0x46')]=intUtil['stripTrailingSlash'](_0x4c6aab[_0x6e70('0x46')]);if(_0x28898a&&_0x28898a[_0x6e70('0x65')]&&_0x28898a[_0x6e70('0x65')]!=='none'){logger['info'](_0x6e70('0x66'),_0x6e70('0x51'));_0x324fa6[_0x6e70('0x54')]=util[_0x6e70('0x5a')](_0x6e70('0x52'),_0x4c6aab[_0x6e70('0x4d')],_0x324fa6[_0x6e70('0x53')],md5(_0x324fa6['uniqueid']));}return getConnection(_0x4c6aab)['then'](function(_0x2c8dc6){_0x36757e=_0x2c8dc6;return getUser(_0x4c6aab,_0x2a8627[_0x6e70('0x55')],_0x36757e);})[_0x6e70('0x1d')](function(_0x2ad395){_0x4434dd=_0x2ad395;return getEndUser(_0x4c6aab,_0x4329a6,_0x324fa6['destcalleridname'],_0x324fa6['destcalleridnum'],_0x36757e);})[_0x6e70('0x1d')](function(_0x4e5545){_0x180a13=_0x4e5545;return getTicket(_0x4c6aab,_0x4434dd,_0x180a13,_0x4329a6,_0x324fa6,_0x4329a6['Fields'],_0x36757e,'outbound');})[_0x6e70('0x1d')](function(_0x47fbed){_0xeeab6e=_0x47fbed;logger[_0x6e70('0x26')](_0x6e70('0x67'),_0xeeab6e['id']);logger[_0x6e70('0x26')](_0x6e70('0x68'),_0xeeab6e['id'],_0x2a8627[_0x6e70('0x3f')],_0x4c6aab[_0x6e70('0x37')]);switch(_0x4c6aab[_0x6e70('0x37')]){case _0x6e70('0x59'):emit(util['format'](_0x6e70('0x5b'),_0x2a8627[_0x6e70('0x3f')]),_0x6e70('0x5c'),{'recordId':_0xeeab6e['id']});break;case _0x6e70('0x69'):emit(util[_0x6e70('0x5a')]('user:%s',_0x2a8627['name']),'trigger:browser:url',{'uri':util[_0x6e70('0x5a')](_0x6e70('0x5e'),_0x36757e[_0x6e70('0x5f')],_0xeeab6e['id'])});break;default:logger['error']('[OUTBOUND]',_0x6e70('0x6a'));}})[_0x6e70('0x62')](function(_0x3c2830){logger[_0x6e70('0x60')](_0x6e70('0x66'),JSON[_0x6e70('0x63')](_0x3c2830));});};exports['abandoned']=function(_0x2d2855,_0x3f5896,_0x30d11b,_0x82a9a,_0x515c0c,_0xce964b){var _0x531097,_0x5b4046,_0x30487b,_0x3249a5;_0xce964b[_0x6e70('0x4d')]=intUtil[_0x6e70('0x4e')](_0xce964b[_0x6e70('0x4d')]);_0xce964b[_0x6e70('0x46')]=intUtil['stripTrailingSlash'](_0xce964b[_0x6e70('0x46')]);if(_0x515c0c&&_0x515c0c[_0x6e70('0x4f')]){logger[_0x6e70('0x26')](_0x6e70('0x6b'),_0x6e70('0x51'));_0x3f5896[_0x6e70('0x54')]=util[_0x6e70('0x5a')](_0x6e70('0x52'),_0xce964b[_0x6e70('0x4d')],_0x3f5896[_0x6e70('0x53')],md5(_0x3f5896['uniqueid']));}else{_0x3f5896[_0x6e70('0x54')]='';}return getConnection(_0xce964b)[_0x6e70('0x1d')](function(_0x577c3b){_0x3249a5=_0x577c3b;if(!_['isNil'](_0x82a9a)){return getUser(_0xce964b,_0x82a9a['name'],_0x3249a5);}else{return getUser(_0xce964b,null,_0x3249a5);}})[_0x6e70('0x1d')](function(_0x18ecf0){_0x531097=_0x18ecf0;return getEndUser(_0xce964b,_0x30d11b,_0x3f5896[_0x6e70('0x56')],_0x3f5896[_0x6e70('0x6c')],_0x3249a5);})[_0x6e70('0x1d')](function(_0x4ec29a){_0x5b4046=_0x4ec29a;return getTicket(_0xce964b,_0x531097,_0x5b4046,_0x30d11b,_0x3f5896,_0x30d11b['Fields'],_0x3249a5);})[_0x6e70('0x1d')](function(_0x241a21){_0x30487b=_0x241a21;logger['info'](_0x6e70('0x6d'),_0x30487b['id']);logger[_0x6e70('0x26')](_0x6e70('0x6e'),_0xce964b[_0x6e70('0x37')]);})[_0x6e70('0x62')](function(_0x44bf96){logger[_0x6e70('0x60')](_0x6e70('0x6b'),JSON[_0x6e70('0x63')](_0x44bf96));});}; \ No newline at end of file +var _0x9c44=['username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','catch','abandoned','isNil','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','[ABANDONED]','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','utc','getString','Descriptions','WhoId','Case','assign','Subjects','ContactId','sobject','create','find','then','length','Email','info','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','contact','lead','Phone','Name','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','forEach','type','string','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login'];(function(_0x266b00,_0x1a60c1){var _0x5e5565=function(_0xeb15bf){while(--_0xeb15bf){_0x266b00['push'](_0x266b00['shift']());}};_0x5e5565(++_0x1a60c1);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var md5=require(_0x49c4('0x2'));var jsforce=require(_0x49c4('0x3'));var util=require(_0x49c4('0x4'));var Redis=require(_0x49c4('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x49c4('0x6'))('salesforce');config[_0x49c4('0x7')]=_[_0x49c4('0x8')](config[_0x49c4('0x7')],{'host':_0x49c4('0x9'),'port':0x18eb});var io=require(_0x49c4('0xa'))(new Redis(config['redis']));function emit(_0x11c586,_0x42e4f8,_0x1d13fb){io['to'](_0x11c586)[_0x49c4('0xb')](_0x42e4f8,_0x1d13fb);}function getTicket(_0x4c7d3a,_0x5ab4a3,_0x451ea6,_0x313e73,_0x58cad7,_0xb611a1,_0x459d09,_0x4adb3c){var _0x536d42={};if(_0x313e73[_0x49c4('0xc')]===_0x49c4('0xd')){_0x536d42=Object['assign']({},{'OwnerId':_0x5ab4a3['id'],'ActivityDate':moment[_0x49c4('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x49c4('0xf')](_0x313e73['Subjects'],_0x58cad7,'\x20'),'Description':intUtil[_0x49c4('0xf')](_0x313e73[_0x49c4('0x10')],_0x58cad7,'\x0a')},getCustomFields(_0xb611a1,_0x58cad7));if(_0x451ea6){_0x536d42[_0x49c4('0x11')]=_0x451ea6['id'];}}else if(_0x313e73[_0x49c4('0xc')]===_0x49c4('0x12')){_0x536d42=Object[_0x49c4('0x13')]({},{'OwnerId':_0x5ab4a3['id'],'Subject':intUtil[_0x49c4('0xf')](_0x313e73[_0x49c4('0x14')],_0x58cad7,'\x20'),'Description':intUtil['getString'](_0x313e73[_0x49c4('0x10')],_0x58cad7,'\x0a')},getCustomFields(_0xb611a1,_0x58cad7));if(_0x451ea6){_0x536d42[_0x49c4('0x15')]=_0x451ea6['id'];}}return _0x459d09[_0x49c4('0x16')](_0x313e73[_0x49c4('0xc')])[_0x49c4('0x17')](_0x536d42);}function getUser(_0x53e3a2,_0x44e607,_0x2891f4){if(!_['isNil'](_0x44e607)&&intUtil['validateEmail'](_0x44e607)){var _0x3c782d={'Email':_0x44e607};var _0x2f82d5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2891f4[_0x49c4('0x16')]('User')[_0x49c4('0x18')](_0x3c782d,_0x2f82d5)['execute']()[_0x49c4('0x19')](function(_0x1806c2){if(_0x1806c2[_0x49c4('0x1a')]){var _0x291526=_[_0x49c4('0x18')](_0x1806c2,function(_0x41078c){return _0x41078c[_0x49c4('0x1b')]===_0x44e607;});if(_0x291526){logger[_0x49c4('0x1c')](_0x49c4('0x1d'),_0x44e607);return BPromise['resolve']({'id':_0x291526['Id'],'name':_0x291526['Name']});}}else{logger['info'](_0x49c4('0x1e'),_0x44e607);return _0x2891f4['identity']()['then'](function(_0x2263ae){return BPromise[_0x49c4('0x1f')]({'id':_0x2263ae[_0x49c4('0x20')],'name':_0x2263ae[_0x49c4('0x21')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x44e607);return _0x2891f4[_0x49c4('0x22')]()[_0x49c4('0x19')](function(_0x565423){return BPromise[_0x49c4('0x1f')]({'id':_0x565423[_0x49c4('0x20')],'name':_0x565423[_0x49c4('0x21')]});});}}function getEndUser(_0xa7a826,_0x531d92,_0x543ea2,_0x449960,_0x53c199){var _0x3800b7={'Phone':_0x449960};var _0x3852b2={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x49c4('0x1f')]()[_0x49c4('0x19')](function(){if(_0x531d92['ticketType']===_0x49c4('0xd')){logger[_0x49c4('0x1c')](_0x49c4('0x23'),_0x449960,_0x531d92[_0x49c4('0x24')]);switch(_0x531d92[_0x49c4('0x24')]){case _0x49c4('0x25'):return _0x53c199[_0x49c4('0x16')](_0x49c4('0x26'))[_0x49c4('0x18')](_0x3800b7,_0x3852b2)[_0x49c4('0x27')]()[_0x49c4('0x19')](function(_0x4ea6ea){if(_0x4ea6ea&&_0x4ea6ea['length']){return _0x4ea6ea;}else{return _0x53c199['sobject'](_0x49c4('0x28'))[_0x49c4('0x18')](_0x3800b7,_0x3852b2);}});case _0x49c4('0x29'):return _0x53c199[_0x49c4('0x16')](_0x49c4('0x26'))['find'](_0x3800b7,_0x3852b2)[_0x49c4('0x27')]();case _0x49c4('0x2a'):return _0x53c199[_0x49c4('0x16')](_0x49c4('0x28'))['find'](_0x3800b7,_0x3852b2);default:return null;}}else if(_0x531d92['ticketType']===_0x49c4('0x12')){logger[_0x49c4('0x1c')](_0x49c4('0x23'),_0x449960,_0x49c4('0x29'));return _0x53c199[_0x49c4('0x16')]('Contact')[_0x49c4('0x18')](_0x3800b7,_0x3852b2)[_0x49c4('0x27')]();}})[_0x49c4('0x19')](function(_0x512d02){if(_0x512d02&&_0x512d02['length']){var _0x85dce2=_[_0x49c4('0x18')](_0x512d02,function(_0x3bec0a){return _0x3bec0a[_0x49c4('0x2b')]===_0x449960;});if(_0x85dce2){return BPromise[_0x49c4('0x1f')]({'id':_0x85dce2['Id'],'name':_0x85dce2[_0x49c4('0x2c')],'phone':_0x85dce2[_0x49c4('0x2b')]});}}})[_0x49c4('0x19')](function(_0x3209cd){if(_0x3209cd){logger['info'](_0x49c4('0x2d'),_0x449960);return BPromise['resolve'](_0x3209cd);}else{logger[_0x49c4('0x1c')](_0x49c4('0x2e'),_0x449960);var _0x2625a6={'LastName':_0x543ea2!==_0x49c4('0x2f')?_0x543ea2:util['format'](_0x49c4('0x30'),_0x449960),'Phone':_0x449960};if(_0x531d92[_0x49c4('0x31')]){if(_0x531d92[_0x49c4('0x31')]==='contact'){logger[_0x49c4('0x1c')](_0x49c4('0x32'),_0x449960,_0x531d92[_0x49c4('0x31')]);}else if(_0x531d92[_0x49c4('0x31')]===_0x49c4('0x2a')&&_0x531d92[_0x49c4('0xc')]===_0x49c4('0xd')){logger[_0x49c4('0x1c')](_0x49c4('0x32'),_0x449960,_0x531d92[_0x49c4('0x31')]);_0x2625a6[_0x49c4('0x33')]='No\x20Company';}else{return null;}}return _0x53c199[_0x49c4('0x16')](_[_0x49c4('0x34')](_0x531d92[_0x49c4('0x31')]))[_0x49c4('0x17')](_0x2625a6);}});}function getCustomFields(_0x41ad28,_0x29dd5d){var _0x1be62d={};if(_0x41ad28[_0x49c4('0x1a')]>0x0){_[_0x49c4('0x35')](_0x41ad28,function(_0x2668ed){if(_0x2668ed[_0x49c4('0x36')]===_0x49c4('0x37')&&_0x2668ed[_0x49c4('0x38')]){_0x1be62d[_0x2668ed['idField']]=_0x2668ed[_0x49c4('0x39')]['toString']();}else if(_0x2668ed[_0x49c4('0x36')]===_0x49c4('0x3a')&&_0x2668ed[_0x49c4('0x3b')]&&_0x2668ed[_0x49c4('0x38')]){_0x29dd5d[_0x2668ed[_0x49c4('0x3b')]]&&(_0x1be62d[_0x2668ed[_0x49c4('0x38')]]=_0x29dd5d[_0x2668ed['variableName']]['toString']());}else if(_0x2668ed[_0x49c4('0x36')]===_0x49c4('0x3c')&&_0x2668ed[_0x49c4('0x3d')]&&_0x2668ed[_0x49c4('0x3d')]['name']&&_0x2668ed[_0x49c4('0x38')]){_0x29dd5d[_0x2668ed[_0x49c4('0x3d')][_0x49c4('0x3e')][_0x49c4('0x3f')]()]&&(_0x1be62d[_0x2668ed[_0x49c4('0x38')]]=_0x29dd5d[_0x2668ed[_0x49c4('0x3d')][_0x49c4('0x3e')][_0x49c4('0x3f')]()][_0x49c4('0x40')]());}});}return _0x1be62d;}function getConnection(_0x5640d3){var _0x2ad771=_0x5640d3['password'][_0x49c4('0x41')](_0x5640d3[_0x49c4('0x42')]);var _0x301def=new jsforce[(_0x49c4('0x43'))]({'oauth2':{'loginUrl':_0x5640d3[_0x49c4('0x44')]||'https://login.salesforce.com','clientId':_0x5640d3[_0x49c4('0x45')],'clientSecret':_0x5640d3[_0x49c4('0x46')]}});return _0x301def[_0x49c4('0x47')](_0x5640d3[_0x49c4('0x48')],_0x2ad771)[_0x49c4('0x19')](function(){logger[_0x49c4('0x1c')](_0x49c4('0x49'));return _0x301def;});}exports['queue']=function(_0x3bac1b,_0x5cfff9,_0x3f7379,_0x906d3,_0x29fe65,_0x27adfe){var _0x2d8087,_0x30bea5,_0x2c6be1,_0x506c71;_0x27adfe[_0x49c4('0x4a')]=intUtil[_0x49c4('0x4b')](_0x27adfe['serverUrl']);_0x27adfe[_0x49c4('0x44')]=intUtil[_0x49c4('0x4b')](_0x27adfe[_0x49c4('0x44')]);if(_0x29fe65&&_0x29fe65[_0x49c4('0x4c')]){logger['info']('[QUEUE]',_0x49c4('0x4d'));_0x5cfff9['recordingURL']=util[_0x49c4('0x4e')](_0x49c4('0x4f'),_0x27adfe[_0x49c4('0x4a')],_0x5cfff9[_0x49c4('0x50')],md5(_0x5cfff9[_0x49c4('0x50')]));}else{_0x5cfff9[_0x49c4('0x51')]='';}return getConnection(_0x27adfe)[_0x49c4('0x19')](function(_0x563f0b){_0x506c71=_0x563f0b;return getUser(_0x27adfe,_0x906d3[_0x49c4('0x52')],_0x506c71);})[_0x49c4('0x19')](function(_0x3936d3){_0x2d8087=_0x3936d3;return getEndUser(_0x27adfe,_0x3f7379,_0x5cfff9[_0x49c4('0x53')],_0x5cfff9[_0x49c4('0x54')],_0x506c71);})[_0x49c4('0x19')](function(_0x156748){_0x30bea5=_0x156748;return getTicket(_0x27adfe,_0x2d8087,_0x30bea5,_0x3f7379,_0x5cfff9,_0x3f7379[_0x49c4('0x55')],_0x506c71,_0x49c4('0x56'));})[_0x49c4('0x19')](function(_0x5b822f){_0x2c6be1=_0x5b822f;logger['info'](_0x49c4('0x57'),_0x2c6be1['id']);logger[_0x49c4('0x1c')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2c6be1['id'],_0x906d3['name'],_0x27adfe[_0x49c4('0x36')]);switch(_0x27adfe['type']){case'integrationTab':emit(util[_0x49c4('0x4e')](_0x49c4('0x58'),_0x906d3[_0x49c4('0x3e')]),_0x49c4('0x59'),{'recordId':_0x2c6be1['id']});break;case _0x49c4('0x5a'):emit(util[_0x49c4('0x4e')](_0x49c4('0x58'),_0x906d3['name']),_0x49c4('0x5b'),{'uri':util[_0x49c4('0x4e')](_0x49c4('0x5c'),_0x506c71[_0x49c4('0x5d')],_0x2c6be1['id'])});break;default:logger[_0x49c4('0x5e')](_0x49c4('0x5f'));}})['catch'](function(_0x5c7ddd){logger[_0x49c4('0x5e')](_0x49c4('0x60'),JSON[_0x49c4('0x61')](_0x5c7ddd));});};exports[_0x49c4('0x62')]=function(_0x23288e,_0x6b2592,_0xc2033f,_0x58dc5f,_0x45d715,_0x33c9a6,_0x4ba4eb){var _0x42928c,_0x53690f,_0x2f966c,_0x147ebd;_0x33c9a6[_0x49c4('0x4a')]=intUtil[_0x49c4('0x4b')](_0x33c9a6[_0x49c4('0x4a')]);_0x33c9a6[_0x49c4('0x44')]=intUtil[_0x49c4('0x4b')](_0x33c9a6[_0x49c4('0x44')]);if(_0x4ba4eb&&_0x4ba4eb['recordingFormat']&&_0x4ba4eb[_0x49c4('0x63')]!==_0x49c4('0x64')){logger['info'](_0x49c4('0x65'),_0x49c4('0x4d'));_0x6b2592['recordingURL']=util[_0x49c4('0x4e')](_0x49c4('0x4f'),_0x33c9a6['serverUrl'],_0x6b2592['uniqueid'],md5(_0x6b2592['uniqueid']));}return getConnection(_0x33c9a6)['then'](function(_0xc43386){_0x147ebd=_0xc43386;return getUser(_0x33c9a6,_0x58dc5f['email'],_0x147ebd);})[_0x49c4('0x19')](function(_0x32f344){_0x42928c=_0x32f344;return getEndUser(_0x33c9a6,_0xc2033f,_0x6b2592['destcalleridname'],_0x6b2592[_0x49c4('0x66')],_0x147ebd);})[_0x49c4('0x19')](function(_0x5ac9f0){_0x53690f=_0x5ac9f0;return getTicket(_0x33c9a6,_0x42928c,_0x53690f,_0xc2033f,_0x6b2592,_0xc2033f[_0x49c4('0x55')],_0x147ebd,_0x49c4('0x62'));})[_0x49c4('0x19')](function(_0x35f46f){_0x2f966c=_0x35f46f;logger['info'](_0x49c4('0x67'),_0x2f966c['id']);logger[_0x49c4('0x1c')](_0x49c4('0x68'),_0x2f966c['id'],_0x58dc5f[_0x49c4('0x3e')],_0x33c9a6['type']);switch(_0x33c9a6[_0x49c4('0x36')]){case'integrationTab':emit(util['format']('user:%s',_0x58dc5f['name']),_0x49c4('0x59'),{'recordId':_0x2f966c['id']});break;case _0x49c4('0x5a'):emit(util[_0x49c4('0x4e')](_0x49c4('0x58'),_0x58dc5f['name']),'trigger:browser:url',{'uri':util[_0x49c4('0x4e')](_0x49c4('0x5c'),_0x147ebd[_0x49c4('0x5d')],_0x2f966c['id'])});break;default:logger[_0x49c4('0x5e')](_0x49c4('0x65'),_0x49c4('0x69'));}})[_0x49c4('0x6a')](function(_0x3b949d){logger['error'](_0x49c4('0x65'),JSON['stringify'](_0x3b949d));});};exports[_0x49c4('0x6b')]=function(_0x264902,_0x1a5d4c,_0x1ea1b4,_0x3a1c81,_0x2e062f,_0x13d657){var _0x3feb0b,_0x13d951,_0x1743d0,_0x1e3911;_0x13d657[_0x49c4('0x4a')]=intUtil[_0x49c4('0x4b')](_0x13d657[_0x49c4('0x4a')]);_0x13d657[_0x49c4('0x44')]=intUtil[_0x49c4('0x4b')](_0x13d657[_0x49c4('0x44')]);if(_0x2e062f&&_0x2e062f[_0x49c4('0x4c')]){logger['info']('[ABANDONED]',_0x49c4('0x4d'));_0x1a5d4c[_0x49c4('0x51')]=util['format'](_0x49c4('0x4f'),_0x13d657[_0x49c4('0x4a')],_0x1a5d4c[_0x49c4('0x50')],md5(_0x1a5d4c[_0x49c4('0x50')]));}else{_0x1a5d4c['recordingURL']='';}return getConnection(_0x13d657)['then'](function(_0x4a85d4){_0x1e3911=_0x4a85d4;if(!_[_0x49c4('0x6c')](_0x3a1c81)){return getUser(_0x13d657,_0x3a1c81[_0x49c4('0x3e')],_0x1e3911);}else{return getUser(_0x13d657,null,_0x1e3911);}})[_0x49c4('0x19')](function(_0x2f4289){_0x3feb0b=_0x2f4289;return getEndUser(_0x13d657,_0x1ea1b4,_0x1a5d4c[_0x49c4('0x53')],_0x1a5d4c[_0x49c4('0x54')],_0x1e3911);})[_0x49c4('0x19')](function(_0x3692a4){_0x13d951=_0x3692a4;return getTicket(_0x13d657,_0x3feb0b,_0x13d951,_0x1ea1b4,_0x1a5d4c,_0x1ea1b4[_0x49c4('0x55')],_0x1e3911);})['then'](function(_0x363b2e){_0x1743d0=_0x363b2e;logger[_0x49c4('0x1c')](_0x49c4('0x6d'),_0x1743d0['id']);logger['info'](_0x49c4('0x6e'),_0x13d657[_0x49c4('0x36')]);})[_0x49c4('0x6a')](function(_0xb6031b){logger[_0x49c4('0x5e')](_0x49c4('0x6f'),JSON[_0x49c4('0x61')](_0xb6031b));});}; \ 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 c57c250..bac4565 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 _0xa348=['System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','string','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Fields','ticketId','ticketNumber','number','label','label_entry','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber'];(function(_0x33c25d,_0x2dee68){var _0x5dd34b=function(_0x5340ac){while(--_0x5340ac){_0x33c25d['push'](_0x33c25d['shift']());}};_0x5dd34b(++_0x2dee68);}(_0xa348,0xb2));var _0x8a34=function(_0x48b168,_0x3ad6f8){_0x48b168=_0x48b168-0x0;var _0xbe90=_0xa348[_0x48b168];return _0xbe90;};'use strict';var _=require(_0x8a34('0x0'));var Promise=require('bluebird');var rp=require(_0x8a34('0x1'));var util=require('util');var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x8a34('0x2'));var config=require(_0x8a34('0x3'));var logger=require(_0x8a34('0x4'))(_0x8a34('0x5'));config[_0x8a34('0x6')]=_[_0x8a34('0x7')](config[_0x8a34('0x6')],{'host':_0x8a34('0x8'),'port':0x18eb});var io=require(_0x8a34('0x9'))(new Redis(config[_0x8a34('0x6')]));function getAdminUser(_0x4d6455,_0x43043e,_0x160b71,_0x3863ce,_0x223e6d,_0x4cfb1d){return new Promise(function(_0xe58a55,_0x19043b){var _0x53d435={'method':_0x8a34('0xa'),'uri':_0x3863ce+_0x8a34('0xb')+'&'+_0x223e6d+'&'+_0x4cfb1d,'auth':_0x43043e,'json':!![]};return rp(_0x53d435)[_0x8a34('0xc')](function(_0x295084){if(_0x295084[_0x8a34('0xd')][_0x8a34('0xe')]>0x0){_0x160b71[_0x8a34('0xf')]=_0x295084[_0x8a34('0xd')][0x0]['sys_id'];}logger['info']('['+[_0x4d6455[_0x8a34('0x10')]()]+_0x8a34('0x11'),_0x160b71);_0xe58a55(_0x160b71);})['catch'](function(_0x37f56d){logger[_0x8a34('0x12')]('['+[_0x4d6455[_0x8a34('0x10')]()]+']',_0x37f56d[_0x8a34('0x13')]);_0x19043b(_0x37f56d[_0x8a34('0x13')]);});});}function getUser(_0x2f428b,_0x2ca994,_0x2f9e57,_0x165bc2,_0x390920){return function(_0x5e9171){logger[_0x8a34('0x14')]('['+[_0x2f428b[_0x8a34('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x5e9171);return new Promise(function(_0x541b72,_0x2f9073){if(intUtil[_0x8a34('0x15')](_0x5e9171[_0x8a34('0x16')])){var _0x4da529={'method':_0x8a34('0xa'),'uri':_0x2f9e57+'sys_user?sysparm_query=email%3D'+_0x5e9171[_0x8a34('0x16')]+'&'+_0x165bc2+'&'+_0x390920,'auth':_0x2ca994,'json':!![]};logger[_0x8a34('0x14')]('['+[_0x2f428b[_0x8a34('0x10')]()]+_0x8a34('0x17'),_0x4da529);return rp(_0x4da529)['then'](function(_0x1b5308){logger[_0x8a34('0x14')]('['+[_0x2f428b[_0x8a34('0x10')]()]+_0x8a34('0x18'),_0x1b5308);if(_0x1b5308['result'][_0x8a34('0xe')]>0x0&&String(_0x1b5308[_0x8a34('0xd')][0x0][_0x8a34('0x19')])===_0x8a34('0x1a')){_0x5e9171[_0x8a34('0x1b')]=_0x1b5308['result'][0x0][_0x8a34('0x1c')];}else{_0x5e9171[_0x8a34('0x1b')]=_0x5e9171['adminId'];_0x5e9171['userEmail']=_0x5e9171[_0x8a34('0x1d')];}logger[_0x8a34('0x14')]('['+[_0x2f428b['toUpperCase']()]+_0x8a34('0x1e'),_0x5e9171);_0x541b72(_0x5e9171);})[_0x8a34('0x1f')](function(_0x386c6d){logger[_0x8a34('0x12')]('['+[_0x2f428b[_0x8a34('0x10')]()]+']',_0x386c6d['message']);_0x2f9073(_0x386c6d[_0x8a34('0x13')]);});}else{logger[_0x8a34('0x14')]('['+[_0x2f428b[_0x8a34('0x10')]()]+_0x8a34('0x20'));_0x5e9171[_0x8a34('0x1b')]=_0x5e9171['adminId'];_0x5e9171['userEmail']=_0x5e9171[_0x8a34('0x1d')];_0x541b72(_0x5e9171);}});};}function createEndUser(_0x1d0b3f,_0x39e883,_0x18e624,_0x550acc,_0x3fbb7e){logger[_0x8a34('0x14')]('['+[_0x1d0b3f[_0x8a34('0x10')]()]+_0x8a34('0x21'),_0x18e624);return new Promise(function(_0x47b8a9,_0x1e4296){var _0x52dfd0={'method':_0x8a34('0x22'),'uri':_0x550acc+_0x8a34('0x23')+_0x3fbb7e,'body':{'user_name':_0x18e624['endUserNumber'],'roles':_0x8a34('0x24'),'first_name':_0x18e624[_0x8a34('0x25')],'active':'true','date_format':_0x8a34('0x26'),'phone':_0x18e624['endUserNumber']},'auth':_0x39e883,'json':!![]};return rp(_0x52dfd0)[_0x8a34('0xc')](function(_0x1b611a){logger[_0x8a34('0x14')]('['+[_0x1d0b3f['toUpperCase']()]+'],\x20EndUser\x20schema',_0x1b611a['result']);_0x18e624[_0x8a34('0x27')]=_0x1b611a[_0x8a34('0xd')][_0x8a34('0x1c')];_0x47b8a9(_0x18e624);})['catch'](function(_0x96ac13){logger[_0x8a34('0x12')]('['+[_0x1d0b3f[_0x8a34('0x10')]()]+']',_0x96ac13['message']);_0x1e4296(_0x96ac13[_0x8a34('0x13')]);});});}function getEndUser(_0x8439b8,_0x53ccbb,_0x1dba8e,_0x299339,_0x1c24c7){return function(_0x23f773){logger['info']('['+[_0x8439b8['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x23f773);return new Promise(function(_0xd56733,_0x137c42){var _0x23af48={'method':_0x8a34('0xa'),'uri':_0x1dba8e+_0x8a34('0x28')+_0x23f773[_0x8a34('0x25')]+'&'+_0x299339+'&'+_0x1c24c7,'auth':_0x53ccbb,'json':!![]};return rp(_0x23af48)[_0x8a34('0xc')](function(_0x561e7c){if(_0x561e7c['result'][_0x8a34('0xe')]>0x0){_0x23f773[_0x8a34('0x27')]=_0x561e7c[_0x8a34('0xd')][0x0][_0x8a34('0x1c')];logger[_0x8a34('0x14')]('['+[_0x8439b8[_0x8a34('0x10')]()]+_0x8a34('0x29'),_0x23f773);_0xd56733(_0x23f773);}else{return createEndUser(_0x8439b8,_0x53ccbb,_0x23f773,_0x1dba8e,_0x299339)[_0x8a34('0xc')](function(_0x48be45){logger[_0x8a34('0x14')]('['+[_0x8439b8['toUpperCase']()]+_0x8a34('0x2a'),_0x48be45);_0xd56733(_0x48be45);});}})[_0x8a34('0x1f')](function(_0x161e76){logger[_0x8a34('0x12')]('['+[_0x8439b8[_0x8a34('0x10')]()]+']',_0x161e76[_0x8a34('0x13')]);_0x137c42(_0x161e76[_0x8a34('0x13')]);});});};}function getCustomFields(_0x2de77b,_0x451ac8){var _0x455e22={};if(_0x2de77b[_0x8a34('0xe')]>0x0){_['forEach'](_0x2de77b,function(_0x81f4f){if(_0x81f4f[_0x8a34('0x2b')]===_0x8a34('0x2c')&&_0x81f4f[_0x8a34('0x2d')]&&!_0x81f4f[_0x8a34('0x2e')]){_0x455e22[_0x81f4f['idField'][_0x8a34('0x2f')]()]=_0x81f4f[_0x8a34('0x30')][_0x8a34('0x31')]();}else if(_0x81f4f['type']===_0x8a34('0x2c')&&_0x81f4f[_0x8a34('0x32')]&&_0x81f4f[_0x8a34('0x2e')]){_0x455e22[_0x81f4f[_0x8a34('0x32')][_0x8a34('0x2f')]()]=_0x81f4f[_0x8a34('0x30')][_0x8a34('0x31')]();}else if(_0x81f4f[_0x8a34('0x2b')]===_0x8a34('0x33')&&_0x81f4f[_0x8a34('0x34')]&&_0x81f4f['idField']&&_0x81f4f['customField']){_0x455e22[_0x81f4f[_0x8a34('0x32')][_0x8a34('0x2f')]()]=_0x451ac8[_0x81f4f[_0x8a34('0x34')]][_0x8a34('0x31')]();}else if(_0x81f4f[_0x8a34('0x2b')]===_0x8a34('0x35')&&_0x81f4f[_0x8a34('0x36')]&&_0x81f4f[_0x8a34('0x36')]['name']&&_0x81f4f[_0x8a34('0x32')]&&_0x81f4f['customField']){_0x455e22[_0x81f4f['idField'][_0x8a34('0x2f')]()]=_0x451ac8[_0x81f4f['Variable'][_0x8a34('0x37')][_0x8a34('0x2f')]()][_0x8a34('0x31')]();}});}return _0x455e22;}function getTicket(_0x32c8a6,_0x3f012f,_0x2aa5c0,_0x39ff06,_0x281c9b,_0x8aa6d){return function(_0xb3414e){logger['info']('['+[_0x32c8a6[_0x8a34('0x10')]()]+_0x8a34('0x38'),_0xb3414e);return new Promise(function(_0x189a4a,_0xcfda4){var _0x5e2924=_0x32c8a6['toLowerCase']()===_0x8a34('0x39')?_0xb3414e[_0x8a34('0x1b')]:_0xb3414e[_0x8a34('0x27')];var _0xe72205={'method':_0x8a34('0x22'),'uri':_0x2aa5c0+_0x8a34('0x3a')+'?'+_0x8aa6d,'body':Object['assign']({},{'active':_0x8a34('0x1a'),'caller_id':_0x5e2924,'assigned_to':_0xb3414e[_0x8a34('0x1b')],'short_description':intUtil[_0x8a34('0x3b')](_0x39ff06[_0x8a34('0x3c')],_0x281c9b,'\x20'),'description':intUtil[_0x8a34('0x3b')](_0x39ff06['Descriptions'],_0x281c9b,'\x0a')},getCustomFields(_0x39ff06[_0x8a34('0x3d')],_0x281c9b)),'auth':_0x3f012f,'json':!![]};return rp(_0xe72205)['then'](function(_0x354814){logger[_0x8a34('0x14')]('['+[_0x32c8a6[_0x8a34('0x10')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x354814['result']);_0xb3414e[_0x8a34('0x3e')]=_0x354814[_0x8a34('0xd')][_0x8a34('0x1c')];_0xb3414e[_0x8a34('0x3f')]=_0x354814['result'][_0x8a34('0x40')];logger[_0x8a34('0x14')]('['+[_0x32c8a6[_0x8a34('0x10')]()]+']\x20getTicket\x20crm',_0xb3414e);_0x189a4a(_0xb3414e);})['catch'](function(_0xa66cea){logger[_0x8a34('0x12')]('['+[_0x32c8a6[_0x8a34('0x10')]()]+']',_0xa66cea[_0x8a34('0x13')]);_0xcfda4(_0xa66cea['message']);});});};}function createRemoteTag(_0x47ba17,_0x294c96,_0x578312,_0x3094b4){return new Promise(function(_0x18848a,_0x335b0c){var _0x28c72e={'method':_0x8a34('0x22'),'uri':_0x578312+_0x8a34('0x41')+'?'+_0x3094b4,'body':{'short_description':_0x47ba17,'global':!![],'active':!![],'name':_0x47ba17},'auth':_0x294c96,'json':!![]};return rp(_0x28c72e)[_0x8a34('0xc')](function(_0x2c6953){var _0x10998d=_0x2c6953[_0x8a34('0xd')][_0x8a34('0x1c')];_0x18848a(_0x10998d);});});}function getRemoteTag(_0x25bb29,_0x13e6d2,_0x5af306,_0x4841f0,_0x1bf3dd){return new Promise(function(_0x3be2af,_0x23cb78){var _0x2a333a={'method':_0x8a34('0xa'),'uri':_0x5af306+_0x8a34('0x41')+'?sysparm_query=name%3D'+_0x25bb29+'&'+_0x4841f0,'auth':_0x13e6d2,'json':!![]};return rp(_0x2a333a)[_0x8a34('0xc')](function(_0x33af40){if(_0x33af40[_0x8a34('0xd')]['length']>0x0){var _0x346c0b=_0x33af40[_0x8a34('0xd')][0x0][_0x8a34('0x1c')];_0x3be2af(_0x346c0b);}else{return createRemoteTag(_0x25bb29,_0x13e6d2,_0x5af306,_0x4841f0)['then'](function(_0xb268ef){_0x3be2af(_0xb268ef);});}});});}function assignTagToIncident(_0x418b17,_0x1b23f5,_0x1636ff,_0x360c80,_0x231d2f){return new Promise(function(_0x42da8d,_0x4cd6df){var _0x54a790={'method':_0x8a34('0x22'),'uri':_0x1636ff+_0x8a34('0x42')+'?'+_0x231d2f,'body':{'label':_0x418b17,'table':_0x8a34('0x3a'),'id_type':_0x8a34('0x43'),'table_key':_0x360c80[_0x8a34('0x3e')],'title':_0x8a34('0x44')+_0x360c80[_0x8a34('0x3f')],'id_display':_0x360c80[_0x8a34('0x3f')]},'auth':_0x1b23f5,'json':!![]};return rp(_0x54a790)[_0x8a34('0xc')](function(_0xf6549d){_0x42da8d();})[_0x8a34('0x1f')](function(){_0x42da8d();});});}function manageTags(_0x3cd4c3,_0xf357c2,_0x3bcb46,_0x11dcf7,_0x22192a,_0x513b1e,_0x312f8d){return new Promise(function(_0x29e571,_0x1eea22){var _0x52bf18=[];_0xf357c2[_0x8a34('0x45')](function(_0x20453c){_0x52bf18[_0x8a34('0x46')](getRemoteTag(_0x20453c,_0x3bcb46,_0x11dcf7,_0x513b1e,_0x312f8d));});return Promise[_0x8a34('0x47')](_0x52bf18)[_0x8a34('0xc')](function(_0x40944f){if(_0x40944f[_0x8a34('0xe')]){logger['info']('['+[_0x3cd4c3[_0x8a34('0x10')]()]+_0x8a34('0x48'),_0x40944f);var _0x4332c3=[];_0x40944f[_0x8a34('0x45')](function(_0x465c1c){_0x4332c3[_0x8a34('0x46')](assignTagToIncident(_0x465c1c,_0x3bcb46,_0x11dcf7,_0x22192a,_0x513b1e));});return Promise[_0x8a34('0x47')](_0x4332c3)[_0x8a34('0xc')](function(){_0x29e571();})[_0x8a34('0x1f')](function(){_0x29e571();});}else{_0x29e571();}});});}function getTags(_0x5cca65,_0x11c96e,_0x5e30c2,_0x175fa4,_0x271997,_0x422b30){return function(_0x4e715f){return new Promise(function(_0x276187,_0x4b3420){var _0x582409=[];var _0xf7a1d8=_0x175fa4[_0x8a34('0x49')];if(_0xf7a1d8&&_0xf7a1d8[_0x8a34('0xe')]>0x0){_0x582409=_['map'](_0xf7a1d8,'name');}if(_0x582409[_0x8a34('0xe')]>0x0){return manageTags(_0x5cca65,_0x582409,_0x11c96e,_0x5e30c2,_0x4e715f,_0x271997,_0x422b30)[_0x8a34('0xc')](function(){_0x276187(_0x4e715f);});}else{_0x276187(_0x4e715f);}});};}function emit(_0x6f9970,_0x525919,_0xf455c8){var _0x2485a7=_0x8a34('0x4a')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x3813df={'uri':_0x6f9970+_0x8a34('0x4b')+_0xf455c8+_0x2485a7};io['to'](util[_0x8a34('0x4c')](_0x8a34('0x4d'),_0x525919))[_0x8a34('0x4e')](_0x8a34('0x4f'),_0x3813df);}exports['cs']=function(_0x486804,_0x5ec05a,_0x3dc1c8,_0x5088d6,_0x468314,_0x23a464,_0x5d3ea8,_0x491b71){var _0x5bcb8d={};var _0x3644a4={'user':_0x23a464[_0x8a34('0x50')],'pass':_0x23a464[_0x8a34('0x51')]};var _0x266ea9=_0x8a34('0x52');var _0x27c951=_0x8a34('0x53');_0x23a464[_0x8a34('0x54')]=intUtil[_0x8a34('0x55')](_0x23a464[_0x8a34('0x54')]);_0x23a464['serverUrl']=intUtil[_0x8a34('0x55')](_0x23a464[_0x8a34('0x56')]);var _0x36e7eb=util[_0x8a34('0x4c')](_0x8a34('0x57'),_0x23a464[_0x8a34('0x54')]);_0x5bcb8d['userEmail']=!_[_0x8a34('0x58')](_0x5088d6)?_0x5088d6[_0x8a34('0x59')]:null;_0x5bcb8d[_0x8a34('0x1d')]=_0x23a464[_0x8a34('0x59')];_0x5bcb8d[_0x8a34('0x25')]=_0x491b71[_0x8a34('0x2f')]()==='outbound'?_0x5ec05a[_0x8a34('0x5a')]:_0x5ec05a[_0x8a34('0x5b')];_0x5bcb8d[_0x8a34('0x5c')]=_0x491b71===_0x8a34('0x5d')||_0x491b71===_0x8a34('0x5e')?'queue':_0x8a34('0x39');var _0x2fa05f=util[_0x8a34('0x4c')](_0x8a34('0x5f'),_0x23a464[_0x8a34('0x56')],_0x5ec05a[_0x8a34('0x60')],md5(_0x5ec05a[_0x8a34('0x60')]));if(_0x468314&&_0x468314[_0x8a34('0x61')]){logger[_0x8a34('0x14')](_0x8a34('0x62'),'Recording\x20is\x20enabled!');_0x5ec05a[_0x8a34('0x63')]=_0x2fa05f;}else if(_0x5d3ea8&&_0x5d3ea8[_0x8a34('0x64')]&&_0x5d3ea8[_0x8a34('0x64')]!==_0x8a34('0x65')){logger[_0x8a34('0x14')](_0x8a34('0x66'),_0x8a34('0x67'));_0x5ec05a[_0x8a34('0x63')]=_0x2fa05f;}else{_0x5ec05a['recordingURL']='';}return getAdminUser(_0x491b71,_0x3644a4,_0x5bcb8d,_0x36e7eb,_0x27c951,_0x266ea9)['then'](getUser(_0x491b71,_0x3644a4,_0x36e7eb,_0x27c951,_0x266ea9))[_0x8a34('0xc')](getEndUser(_0x491b71,_0x3644a4,_0x36e7eb,_0x27c951,_0x266ea9))[_0x8a34('0xc')](getTicket(_0x491b71,_0x3644a4,_0x36e7eb,_0x3dc1c8,_0x5ec05a,_0x27c951))[_0x8a34('0xc')](function(_0x178ffd){logger[_0x8a34('0x14')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x178ffd[_0x8a34('0x3e')]));logger[_0x8a34('0x14')](util[_0x8a34('0x4c')](_0x8a34('0x68'),_0x491b71));if(_0x491b71!=='abandoned'){logger[_0x8a34('0x14')]('['+[_0x491b71[_0x8a34('0x10')]()]+']',_0x8a34('0x69'));emit(_0x23a464[_0x8a34('0x54')],_0x5088d6[_0x8a34('0x37')],_0x178ffd[_0x8a34('0x3e')]);}})[_0x8a34('0x1f')](function(_0x539017){logger[_0x8a34('0x12')]('['+[_0x491b71[_0x8a34('0x10')]()]+_0x8a34('0x6a'),util[_0x8a34('0x6b')](_0x539017,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x95f4=['/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','email','destcalleridnum','calleridnum','callDirection','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','ioredis','./util','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','nameField','customField','toLowerCase','content','toString','type','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','true','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','all','push','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber'];(function(_0x5cd23e,_0x20777b){var _0x216550=function(_0x2935bb){while(--_0x2935bb){_0x5cd23e['push'](_0x5cd23e['shift']());}};_0x216550(++_0x20777b);}(_0x95f4,0xf1));var _0x495f=function(_0x483573,_0x3d2e82){_0x483573=_0x483573-0x0;var _0x2bddf5=_0x95f4[_0x483573];return _0x2bddf5;};'use strict';var _=require(_0x495f('0x0'));var Promise=require(_0x495f('0x1'));var rp=require(_0x495f('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x495f('0x3'));var intUtil=require(_0x495f('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x495f('0x5'));config[_0x495f('0x6')]=_[_0x495f('0x7')](config['redis'],{'host':_0x495f('0x8'),'port':0x18eb});var io=require(_0x495f('0x9'))(new Redis(config[_0x495f('0x6')]));function getAdminUser(_0x4c17af,_0x2103a4,_0x4610a7,_0x380828,_0x568020,_0x55dc23){return new Promise(function(_0x3f5880,_0x48c225){var _0x415017={'method':'GET','uri':_0x380828+_0x495f('0xa')+'&'+_0x568020+'&'+_0x55dc23,'auth':_0x2103a4,'json':!![]};return rp(_0x415017)[_0x495f('0xb')](function(_0x192ee0){if(_0x192ee0[_0x495f('0xc')]['length']>0x0){_0x4610a7[_0x495f('0xd')]=_0x192ee0[_0x495f('0xc')][0x0][_0x495f('0xe')];}logger[_0x495f('0xf')]('['+[_0x4c17af[_0x495f('0x10')]()]+'],\x20getAdminUser\x20crm',_0x4610a7);_0x3f5880(_0x4610a7);})[_0x495f('0x11')](function(_0xd4afd1){logger[_0x495f('0x12')]('['+[_0x4c17af[_0x495f('0x10')]()]+']',_0xd4afd1[_0x495f('0x13')]);_0x48c225(_0xd4afd1[_0x495f('0x13')]);});});}function getUser(_0x101c57,_0x5ad821,_0x1fffeb,_0x18ecbd,_0x15ea87){return function(_0x135ebd){logger['info']('['+[_0x101c57[_0x495f('0x10')]()]+_0x495f('0x14'),_0x135ebd);return new Promise(function(_0x4a0f0f,_0x2ebb97){if(intUtil[_0x495f('0x15')](_0x135ebd[_0x495f('0x16')])){var _0x58bcc9={'method':_0x495f('0x17'),'uri':_0x1fffeb+_0x495f('0x18')+_0x135ebd[_0x495f('0x16')]+'&'+_0x18ecbd+'&'+_0x15ea87,'auth':_0x5ad821,'json':!![]};logger[_0x495f('0xf')]('['+[_0x101c57['toUpperCase']()]+_0x495f('0x19'),_0x58bcc9);return rp(_0x58bcc9)[_0x495f('0xb')](function(_0x5f2530){logger[_0x495f('0xf')]('['+[_0x101c57['toUpperCase']()]+_0x495f('0x1a'),_0x5f2530);if(_0x5f2530[_0x495f('0xc')][_0x495f('0x1b')]>0x0&&String(_0x5f2530[_0x495f('0xc')][0x0]['active'])==='true'){_0x135ebd[_0x495f('0x1c')]=_0x5f2530['result'][0x0][_0x495f('0xe')];}else{_0x135ebd[_0x495f('0x1c')]=_0x135ebd['adminId'];_0x135ebd[_0x495f('0x16')]=_0x135ebd[_0x495f('0x1d')];}logger[_0x495f('0xf')]('['+[_0x101c57[_0x495f('0x10')]()]+_0x495f('0x1e'),_0x135ebd);_0x4a0f0f(_0x135ebd);})[_0x495f('0x11')](function(_0x4afbad){logger['error']('['+[_0x101c57[_0x495f('0x10')]()]+']',_0x4afbad[_0x495f('0x13')]);_0x2ebb97(_0x4afbad[_0x495f('0x13')]);});}else{logger[_0x495f('0xf')]('['+[_0x101c57[_0x495f('0x10')]()]+_0x495f('0x1f'));_0x135ebd['userId']=_0x135ebd[_0x495f('0xd')];_0x135ebd[_0x495f('0x16')]=_0x135ebd[_0x495f('0x1d')];_0x4a0f0f(_0x135ebd);}});};}function createEndUser(_0x3b3461,_0xab919a,_0x34322c,_0x161b4a,_0x4e9737){logger[_0x495f('0xf')]('['+[_0x3b3461[_0x495f('0x10')]()]+_0x495f('0x20'),_0x34322c);return new Promise(function(_0x445b0b,_0x3efa51){var _0x3b8f0f={'method':_0x495f('0x21'),'uri':_0x161b4a+_0x495f('0x22')+_0x4e9737,'body':{'user_name':_0x34322c[_0x495f('0x23')],'roles':_0x495f('0x24'),'first_name':_0x34322c[_0x495f('0x23')],'active':'true','date_format':_0x495f('0x25'),'phone':_0x34322c[_0x495f('0x23')]},'auth':_0xab919a,'json':!![]};return rp(_0x3b8f0f)[_0x495f('0xb')](function(_0x2e9e8c){logger[_0x495f('0xf')]('['+[_0x3b3461['toUpperCase']()]+_0x495f('0x26'),_0x2e9e8c[_0x495f('0xc')]);_0x34322c[_0x495f('0x27')]=_0x2e9e8c[_0x495f('0xc')]['sys_id'];_0x445b0b(_0x34322c);})[_0x495f('0x11')](function(_0x2c26eb){logger[_0x495f('0x12')]('['+[_0x3b3461[_0x495f('0x10')]()]+']',_0x2c26eb['message']);_0x3efa51(_0x2c26eb[_0x495f('0x13')]);});});}function getEndUser(_0x230e88,_0x1f338b,_0x441a08,_0x46a028,_0x4503ad){return function(_0x459470){logger[_0x495f('0xf')]('['+[_0x230e88['toUpperCase']()]+_0x495f('0x28'),_0x459470);return new Promise(function(_0x577f71,_0x55d775){var _0x412189={'method':_0x495f('0x17'),'uri':_0x441a08+_0x495f('0x29')+_0x459470[_0x495f('0x23')]+'&'+_0x46a028+'&'+_0x4503ad,'auth':_0x1f338b,'json':!![]};return rp(_0x412189)[_0x495f('0xb')](function(_0x1287cb){if(_0x1287cb[_0x495f('0xc')][_0x495f('0x1b')]>0x0){_0x459470[_0x495f('0x27')]=_0x1287cb['result'][0x0][_0x495f('0xe')];logger[_0x495f('0xf')]('['+[_0x230e88['toUpperCase']()]+_0x495f('0x2a'),_0x459470);_0x577f71(_0x459470);}else{return createEndUser(_0x230e88,_0x1f338b,_0x459470,_0x441a08,_0x46a028)[_0x495f('0xb')](function(_0x1197d9){logger['info']('['+[_0x230e88[_0x495f('0x10')]()]+_0x495f('0x2b'),_0x1197d9);_0x577f71(_0x1197d9);});}})[_0x495f('0x11')](function(_0x4bce35){logger['error']('['+[_0x230e88[_0x495f('0x10')]()]+']',_0x4bce35[_0x495f('0x13')]);_0x55d775(_0x4bce35[_0x495f('0x13')]);});});};}function getCustomFields(_0x1e83db,_0x9bf232){var _0x46c494={};if(_0x1e83db[_0x495f('0x1b')]>0x0){_['forEach'](_0x1e83db,function(_0x551195){if(_0x551195['type']===_0x495f('0x2c')&&_0x551195[_0x495f('0x2d')]&&!_0x551195[_0x495f('0x2e')]){_0x46c494[_0x551195['idField'][_0x495f('0x2f')]()]=_0x551195[_0x495f('0x30')][_0x495f('0x31')]();}else if(_0x551195[_0x495f('0x32')]===_0x495f('0x2c')&&_0x551195[_0x495f('0x33')]&&_0x551195[_0x495f('0x2e')]){_0x46c494[_0x551195['idField']['toLowerCase']()]=_0x551195['content'][_0x495f('0x31')]();}else if(_0x551195[_0x495f('0x32')]===_0x495f('0x34')&&_0x551195[_0x495f('0x35')]&&_0x551195[_0x495f('0x33')]&&_0x551195[_0x495f('0x2e')]){_0x46c494[_0x551195[_0x495f('0x33')][_0x495f('0x2f')]()]=_0x9bf232[_0x551195[_0x495f('0x35')]][_0x495f('0x31')]();}else if(_0x551195['type']===_0x495f('0x36')&&_0x551195[_0x495f('0x37')]&&_0x551195[_0x495f('0x37')][_0x495f('0x38')]&&_0x551195['idField']&&_0x551195[_0x495f('0x2e')]){_0x46c494[_0x551195['idField'][_0x495f('0x2f')]()]=_0x9bf232[_0x551195['Variable']['name'][_0x495f('0x2f')]()][_0x495f('0x31')]();}});}return _0x46c494;}function getTicket(_0x42bd90,_0x5db7a9,_0x29e106,_0x5ba6f9,_0x25f71e,_0x54793c){return function(_0x197d93){logger[_0x495f('0xf')]('['+[_0x42bd90['toUpperCase']()]+_0x495f('0x39'),_0x197d93);return new Promise(function(_0x1daec5,_0x35d5c0){var _0x1fb6ae=_0x42bd90['toLowerCase']()===_0x495f('0x3a')?_0x197d93[_0x495f('0x1c')]:_0x197d93[_0x495f('0x27')];var _0x5e2d6d={'method':'POST','uri':_0x29e106+_0x495f('0x3b')+'?'+_0x54793c,'body':Object[_0x495f('0x3c')]({},{'active':_0x495f('0x3d'),'caller_id':_0x1fb6ae,'assigned_to':_0x197d93[_0x495f('0x1c')],'short_description':intUtil[_0x495f('0x3e')](_0x5ba6f9[_0x495f('0x3f')],_0x25f71e,'\x20'),'description':intUtil[_0x495f('0x3e')](_0x5ba6f9['Descriptions'],_0x25f71e,'\x0a')},getCustomFields(_0x5ba6f9[_0x495f('0x40')],_0x25f71e)),'auth':_0x5db7a9,'json':!![]};return rp(_0x5e2d6d)[_0x495f('0xb')](function(_0x3aa0e8){logger[_0x495f('0xf')]('['+[_0x42bd90[_0x495f('0x10')]()]+_0x495f('0x41'),_0x3aa0e8[_0x495f('0xc')]);_0x197d93[_0x495f('0x42')]=_0x3aa0e8[_0x495f('0xc')][_0x495f('0xe')];_0x197d93[_0x495f('0x43')]=_0x3aa0e8[_0x495f('0xc')][_0x495f('0x44')];logger[_0x495f('0xf')]('['+[_0x42bd90[_0x495f('0x10')]()]+_0x495f('0x45'),_0x197d93);_0x1daec5(_0x197d93);})[_0x495f('0x11')](function(_0x281149){logger[_0x495f('0x12')]('['+[_0x42bd90[_0x495f('0x10')]()]+']',_0x281149[_0x495f('0x13')]);_0x35d5c0(_0x281149[_0x495f('0x13')]);});});};}function createRemoteTag(_0x655447,_0x26085a,_0x5a5ef7,_0x521f22){return new Promise(function(_0x47b81b,_0x11c53a){var _0x2f8830={'method':_0x495f('0x21'),'uri':_0x5a5ef7+_0x495f('0x46')+'?'+_0x521f22,'body':{'short_description':_0x655447,'global':!![],'active':!![],'name':_0x655447},'auth':_0x26085a,'json':!![]};return rp(_0x2f8830)['then'](function(_0x1cd7c9){var _0x775d0d=_0x1cd7c9[_0x495f('0xc')]['sys_id'];_0x47b81b(_0x775d0d);});});}function getRemoteTag(_0x2889ef,_0x4a5fa4,_0x2ecf4e,_0x515bd3,_0x388858){return new Promise(function(_0x42c868,_0x4b9cb7){var _0xc4c18c={'method':_0x495f('0x17'),'uri':_0x2ecf4e+_0x495f('0x46')+'?sysparm_query=name%3D'+_0x2889ef+'&'+_0x515bd3,'auth':_0x4a5fa4,'json':!![]};return rp(_0xc4c18c)['then'](function(_0x47c218){if(_0x47c218[_0x495f('0xc')][_0x495f('0x1b')]>0x0){var _0x5dc289=_0x47c218[_0x495f('0xc')][0x0]['sys_id'];_0x42c868(_0x5dc289);}else{return createRemoteTag(_0x2889ef,_0x4a5fa4,_0x2ecf4e,_0x515bd3)[_0x495f('0xb')](function(_0x2dbf6e){_0x42c868(_0x2dbf6e);});}});});}function assignTagToIncident(_0x108c16,_0x3ccf73,_0x129b95,_0x37fde1,_0x3a5c33){return new Promise(function(_0x4550e7,_0x4910bd){var _0x44acbb={'method':_0x495f('0x21'),'uri':_0x129b95+_0x495f('0x47')+'?'+_0x3a5c33,'body':{'label':_0x108c16,'table':_0x495f('0x3b'),'id_type':_0x495f('0x48'),'table_key':_0x37fde1[_0x495f('0x42')],'title':_0x495f('0x49')+_0x37fde1[_0x495f('0x43')],'id_display':_0x37fde1[_0x495f('0x43')]},'auth':_0x3ccf73,'json':!![]};return rp(_0x44acbb)[_0x495f('0xb')](function(_0x200203){_0x4550e7();})[_0x495f('0x11')](function(){_0x4550e7();});});}function manageTags(_0x1febf7,_0x33f97d,_0xfd099b,_0x403df7,_0x92e35b,_0x5583be,_0x436ecd){return new Promise(function(_0x52a951,_0x149488){var _0x2eedea=[];_0x33f97d['forEach'](function(_0x496892){_0x2eedea['push'](getRemoteTag(_0x496892,_0xfd099b,_0x403df7,_0x5583be,_0x436ecd));});return Promise[_0x495f('0x4a')](_0x2eedea)[_0x495f('0xb')](function(_0x20b106){if(_0x20b106[_0x495f('0x1b')]){logger[_0x495f('0xf')]('['+[_0x1febf7[_0x495f('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x20b106);var _0x1eed02=[];_0x20b106['forEach'](function(_0x5edf8d){_0x1eed02[_0x495f('0x4b')](assignTagToIncident(_0x5edf8d,_0xfd099b,_0x403df7,_0x92e35b,_0x5583be));});return Promise['all'](_0x1eed02)[_0x495f('0xb')](function(){_0x52a951();})['catch'](function(){_0x52a951();});}else{_0x52a951();}});});}function getTags(_0x3054e0,_0x17092a,_0x4bf467,_0x4647c5,_0x51bcc,_0x3ee37e){return function(_0x22592e){return new Promise(function(_0x22ed4a,_0x4e8e90){var _0x33b000=[];var _0x362025=_0x4647c5[_0x495f('0x4c')];if(_0x362025&&_0x362025[_0x495f('0x1b')]>0x0){_0x33b000=_[_0x495f('0x4d')](_0x362025,_0x495f('0x38'));}if(_0x33b000['length']>0x0){return manageTags(_0x3054e0,_0x33b000,_0x17092a,_0x4bf467,_0x22592e,_0x51bcc,_0x3ee37e)[_0x495f('0xb')](function(){_0x22ed4a(_0x22592e);});}else{_0x22ed4a(_0x22592e);}});};}function emit(_0x177e50,_0x55d76d,_0x49a35e){var _0x4355f9=_0x495f('0x4e')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x495f('0x4f');var _0x280f73={'uri':_0x177e50+_0x495f('0x50')+_0x49a35e+_0x4355f9};io['to'](util[_0x495f('0x51')]('user:%s',_0x55d76d))['emit'](_0x495f('0x52'),_0x280f73);}exports['cs']=function(_0x2aa9d9,_0x39bd49,_0x5cf7f5,_0x34da11,_0xc9e7de,_0x4df702,_0xcfa977,_0x2366e3){var _0x230a5e={};var _0x4c4faa={'user':_0x4df702[_0x495f('0x53')],'pass':_0x4df702[_0x495f('0x54')]};var _0x151b1a=_0x495f('0x55');var _0x40c863=_0x495f('0x56');_0x4df702[_0x495f('0x57')]=intUtil[_0x495f('0x58')](_0x4df702[_0x495f('0x57')]);_0x4df702[_0x495f('0x59')]=intUtil[_0x495f('0x58')](_0x4df702[_0x495f('0x59')]);var _0xe15775=util[_0x495f('0x51')]('%s/api/now/table/',_0x4df702[_0x495f('0x57')]);_0x230a5e[_0x495f('0x16')]=!_['isNil'](_0x34da11)?_0x34da11[_0x495f('0x5a')]:null;_0x230a5e[_0x495f('0x1d')]=_0x4df702[_0x495f('0x5a')];_0x230a5e[_0x495f('0x23')]=_0x2366e3[_0x495f('0x2f')]()==='outbound'?_0x39bd49[_0x495f('0x5b')]:_0x39bd49[_0x495f('0x5c')];_0x230a5e[_0x495f('0x5d')]=_0x2366e3===_0x495f('0x5e')||_0x2366e3===_0x495f('0x5f')?'queue':_0x495f('0x3a');var _0x152786=util[_0x495f('0x51')](_0x495f('0x60'),_0x4df702[_0x495f('0x59')],_0x39bd49[_0x495f('0x61')],md5(_0x39bd49[_0x495f('0x61')]));if(_0xc9e7de&&_0xc9e7de[_0x495f('0x62')]){logger[_0x495f('0xf')](_0x495f('0x63'),_0x495f('0x64'));_0x39bd49['recordingURL']=_0x152786;}else if(_0xcfa977&&_0xcfa977[_0x495f('0x65')]&&_0xcfa977[_0x495f('0x65')]!=='none'){logger[_0x495f('0xf')]('[OUTBOUND]',_0x495f('0x64'));_0x39bd49['recordingURL']=_0x152786;}else{_0x39bd49[_0x495f('0x66')]='';}return getAdminUser(_0x2366e3,_0x4c4faa,_0x230a5e,_0xe15775,_0x40c863,_0x151b1a)[_0x495f('0xb')](getUser(_0x2366e3,_0x4c4faa,_0xe15775,_0x40c863,_0x151b1a))[_0x495f('0xb')](getEndUser(_0x2366e3,_0x4c4faa,_0xe15775,_0x40c863,_0x151b1a))[_0x495f('0xb')](getTicket(_0x2366e3,_0x4c4faa,_0xe15775,_0x5cf7f5,_0x39bd49,_0x40c863))['then'](function(_0x3261c3){logger[_0x495f('0xf')](util[_0x495f('0x51')](_0x495f('0x67'),_0x3261c3[_0x495f('0x42')]));logger[_0x495f('0xf')](util[_0x495f('0x51')]('call\x20direction:\x20%s',_0x2366e3));if(_0x2366e3!==_0x495f('0x5f')){logger[_0x495f('0xf')]('['+[_0x2366e3[_0x495f('0x10')]()]+']',_0x495f('0x68'));emit(_0x4df702['remoteUri'],_0x34da11[_0x495f('0x38')],_0x3261c3[_0x495f('0x42')]);}})[_0x495f('0x11')](function(_0x51d481){logger['error']('['+[_0x2366e3[_0x495f('0x10')]()]+_0x495f('0x69'),util[_0x495f('0x6a')](_0x51d481,{'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 611d562..79317c1 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 _0x97d8=['sugarcrm','defaults','redis','localhost','emit','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','stringify','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','user_name','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','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]','merge','type','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','POST','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','abandoned','[ABANDONED]','calleridname','lodash','bluebird','md5','util','../../../../config/environment'];(function(_0x2a8779,_0xc2b11c){var _0x1e6bbc=function(_0x4b812a){while(--_0x4b812a){_0x2a8779['push'](_0x2a8779['shift']());}};_0x1e6bbc(++_0xc2b11c);}(_0x97d8,0xf3));var _0x897d=function(_0x4d7ace,_0x39a022){_0x4d7ace=_0x4d7ace-0x0;var _0xba2b0c=_0x97d8[_0x4d7ace];return _0xba2b0c;};'use strict';var _=require(_0x897d('0x0'));var rp=require('request-promise');var BPromise=require(_0x897d('0x1'));var md5=require(_0x897d('0x2'));var util=require(_0x897d('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x897d('0x4'));var logger=require('../../../../config/logger')(_0x897d('0x5'));config['redis']=_[_0x897d('0x6')](config[_0x897d('0x7')],{'host':_0x897d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x897d('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x3c8565,_0x564552,_0x175204){io['to'](_0x3c8565)[_0x897d('0x9')](_0x564552,_0x175204);}function getTicket(_0x367472,_0x585f8b,_0x2e3105,_0x5076ec,_0x332a7c,_0xa8c919,_0x3866dd,_0x3fb5ad){logger['info']('Creating\x20new\x20ticket...');var _0x3b9f93=new Date();var _0xa1c35e=[{'name':_0x897d('0xa'),'value':intUtil[_0x897d('0xb')](_0x5076ec[_0x897d('0xc')],_0x332a7c,'\x20')},{'name':_0x897d('0xd'),'value':_0x585f8b['id']},{'name':_0x897d('0xe'),'value':_0x585f8b['id']},{'name':_0x897d('0xf'),'value':intUtil[_0x897d('0xb')](_0x5076ec[_0x897d('0x10')],_0x332a7c,'\x0a')},{'name':_0x897d('0x11'),'value':_0x3b9f93[_0x897d('0x12')]()[_0x897d('0x13')](0x0,0x13)[_0x897d('0x14')]('T','\x20')},{'name':_0x897d('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x897d('0x16'),'value':_0x2e3105['id']},{'name':_0x897d('0x17'),'value':_0x897d('0x18')},{'name':_0x897d('0x19'),'value':_0x2e3105[_0x897d('0xa')]},{'name':_0x897d('0x1a'),'value':_0x3fb5ad}];if(_0xa8c919[_0x897d('0x1b')]){_[_0x897d('0x1c')](_0xa8c919,function(_0xb55d5a){if(_0x332a7c[_0xb55d5a[_0x897d('0x1d')]]){_0xa1c35e[_0x897d('0x1e')]({'name':_0xb55d5a[_0x897d('0x1f')],'value':_0x332a7c[_0xb55d5a[_0x897d('0x1d')]]});}});}return request({'form':{'method':_0x897d('0x20'),'input_type':_0x897d('0x21'),'response_type':_0x897d('0x21'),'rest_data':JSON['stringify']({'session':_0x3866dd['id'],'module_name':_0x897d('0x22'),'name_value_list':_0xa1c35e})}});}function getAuth(_0x3981f1){return util[_0x897d('0x23')](_0x897d('0x24'),new Buffer(_0x3981f1[_0x897d('0x25')]+':X')[_0x897d('0x26')]('base64'));}function getServerInfo(_0x59d5f7){return request({'form':{'method':_0x897d('0x27'),'input_type':_0x897d('0x21'),'response_type':_0x897d('0x21'),'rest_data':JSON['stringify']({'session':_0x59d5f7['id']})}});}function getUser(_0x22bef3,_0x121fd2,_0x1ab4a1){if(!_[_0x897d('0x28')](_0x121fd2)){logger[_0x897d('0x29')](_0x897d('0x2a'),_0x121fd2);return request({'form':{'method':_0x897d('0x2b'),'input_type':_0x897d('0x21'),'response_type':'JSON','rest_data':JSON[_0x897d('0x2c')]({'session':_0x1ab4a1['id'],'module_name':_0x897d('0x2d'),'query':util[_0x897d('0x23')](_0x897d('0x2e'),_0x121fd2),'order_by':'','offset':'0','select_fields':['id',_0x897d('0xa'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x897d('0x2f')](function(_0x58cf2b){if(_0x58cf2b[_0x897d('0x30')][_0x897d('0x1b')]){var _0x31b318=_[_0x897d('0x31')](_0x58cf2b['entry_list'],function(_0x486a3a){return _0x486a3a['name_value_list'][_0x897d('0x32')][_0x897d('0x33')]===_0x121fd2;});if(_0x31b318){logger[_0x897d('0x29')]('Agent\x20found!');return BPromise[_0x897d('0x34')]({'id':_0x31b318[_0x897d('0x35')]['id'][_0x897d('0x33')],'name':_0x31b318['name_value_list'][_0x897d('0xa')]['value']});}}logger[_0x897d('0x29')](_0x897d('0x36'));return BPromise[_0x897d('0x34')]({'id':_0x1ab4a1['name_value_list'][_0x897d('0x37')][_0x897d('0x33')],'name':_0x1ab4a1[_0x897d('0x35')][_0x897d('0x32')][_0x897d('0x33')]});});}else{logger[_0x897d('0x29')](_0x897d('0x38'));return BPromise['resolve']({'id':_0x1ab4a1[_0x897d('0x35')][_0x897d('0x37')][_0x897d('0x33')],'name':_0x1ab4a1[_0x897d('0x35')][_0x897d('0x32')][_0x897d('0x33')]});}}function getEndUser(_0x42145b,_0x437321,_0x3b1850,_0x5d90a9){logger['info'](_0x897d('0x39'),_0x3b1850);return request({'form':{'method':_0x897d('0x2b'),'input_type':_0x897d('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5d90a9['id'],'module_name':'Contacts','query':util['format'](_0x897d('0x3a'),_0x3b1850),'order_by':'','offset':'0','select_fields':['id',_0x897d('0xa'),_0x897d('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x897d('0x2f')](function(_0x1353ee){if(_0x1353ee['entry_list'][_0x897d('0x1b')]){var _0x7335a6=_[_0x897d('0x31')](_0x1353ee[_0x897d('0x30')],function(_0x14179d){return _0x14179d[_0x897d('0x35')][_0x897d('0x3b')][_0x897d('0x33')]===_0x3b1850;});if(_0x7335a6){logger[_0x897d('0x29')](_0x897d('0x3c'));return BPromise[_0x897d('0x34')]({'id':_0x7335a6['name_value_list']['id']['value'],'name':_0x7335a6[_0x897d('0x35')][_0x897d('0xa')][_0x897d('0x33')],'phone':_0x7335a6[_0x897d('0x35')][_0x897d('0x3b')]['value']});}}else{logger['info'](_0x897d('0x3d'));return request({'form':{'method':_0x897d('0x20'),'input_type':_0x897d('0x21'),'response_type':_0x897d('0x21'),'rest_data':JSON[_0x897d('0x2c')]({'session':_0x5d90a9['id'],'module_name':'Contacts','name_value_list':[{'name':_0x897d('0x3e'),'value':_0x437321!==_0x897d('0x3f')?_0x437321:util[_0x897d('0x23')](_0x897d('0x40'),_0x3b1850)},{'name':_0x897d('0x3b'),'value':_0x3b1850}]})}})['then'](function(_0xb0f0cf){logger[_0x897d('0x29')](_0x897d('0x41'));return BPromise[_0x897d('0x34')]({'id':_0xb0f0cf['id'],'name':_0xb0f0cf[_0x897d('0x30')][_0x897d('0x3e')][_0x897d('0x33')],'phone':_0xb0f0cf[_0x897d('0x30')][_0x897d('0x3b')][_0x897d('0x33')]});});}});}function request(_0x5b9eab){logger[_0x897d('0x42')](_0x897d('0x43'),JSON[_0x897d('0x2c')](_0x5b9eab));return rp(_[_0x897d('0x44')](def,_0x5b9eab));}function getTags(_0x5a5e4a,_0x4fa4a3){var _0x5a666f=[];if(_0x5a5e4a&&_0x5a5e4a['length']>0x0){_0x5a666f=_['map'](_0x5a5e4a,_0x4fa4a3);}return _0x5a666f;}function getCustomFields(_0x337d91,_0x2e2f1a){var _0x2f038f=[];var _0x17d1b6={'custom_fields':[]};if(_0x337d91[_0x897d('0x1b')]>0x0){_[_0x897d('0x1c')](_0x337d91,function(_0x10102b){if(_0x10102b[_0x897d('0x45')]==='string'&&_0x10102b['nameField']&&!_0x10102b[_0x897d('0x46')]){_0x17d1b6[_0x10102b['nameField'][_0x897d('0x47')]()]=_0x10102b[_0x897d('0x48')]['toString']();}else if(_0x10102b[_0x897d('0x45')]==='string'&&_0x10102b[_0x897d('0x1f')]&&_0x10102b[_0x897d('0x46')]){_0x17d1b6[_0x897d('0x49')][_0x897d('0x1e')]({'id':_0x10102b[_0x897d('0x1f')],'value':_0x10102b['content'][_0x897d('0x26')]()});}else if(_0x10102b[_0x897d('0x45')]===_0x897d('0x4a')&&_0x10102b[_0x897d('0x1d')]&&_0x10102b[_0x897d('0x1f')]&&_0x10102b['customField']){_0x2e2f1a[_0x10102b['variableName']]&&_0x17d1b6[_0x897d('0x49')][_0x897d('0x1e')]({'id':_0x10102b[_0x897d('0x1f')],'value':_0x2e2f1a[_0x10102b['variableName']][_0x897d('0x26')]()});}else if(_0x10102b[_0x897d('0x45')]===_0x897d('0x4b')&&_0x10102b[_0x897d('0x4c')]&&_0x10102b[_0x897d('0x4c')]['name']&&_0x10102b[_0x897d('0x1f')]&&_0x10102b['customField']){_0x2e2f1a[_0x10102b[_0x897d('0x4c')]['name'][_0x897d('0x47')]()]&&_0x17d1b6['custom_fields'][_0x897d('0x1e')]({'id':_0x10102b[_0x897d('0x1f')],'value':_0x2e2f1a[_0x10102b[_0x897d('0x4c')][_0x897d('0xa')][_0x897d('0x47')]()][_0x897d('0x26')]()});}});}return _0x17d1b6;}function getConnection(_0x28d11c){return request({'method':_0x897d('0x4d'),'form':{'method':_0x897d('0x4e'),'input_type':_0x897d('0x21'),'response_type':_0x897d('0x21'),'rest_data':JSON[_0x897d('0x2c')]({'user_auth':{'user_name':_0x28d11c[_0x897d('0x4f')],'password':_0x28d11c[_0x897d('0x50')],'encryption':_0x897d('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x897d('0x2f')](function(_0x581ee5){var _0x2654bf=_0x581ee5;if(_0x2654bf['id']){def[_0x897d('0x52')]=_0x2654bf['id'];return BPromise[_0x897d('0x34')](_0x2654bf);}else{throw new Error(util[_0x897d('0x23')](_0x897d('0x53'),_0x28d11c['id']));}});}function setRelationship(_0x556c48,_0x3c1972,_0x33980c,_0x31476a){return request({'form':{'method':_0x897d('0x54'),'input_type':_0x897d('0x21'),'response_type':_0x897d('0x21'),'rest_data':JSON['stringify']({'session':_0x556c48['id'],'module_name':_0x897d('0x22'),'module_id':_0x33980c['id'],'link_field_name':_0x31476a,'related_ids':[_0x3c1972['id']]})}});}exports[_0x897d('0x55')]=function(_0x41a9bf,_0x38e605,_0x5c0f0b,_0x7a54a1,_0x1f7ee5,_0x4d5906){var _0x9cbb81,_0x16c067,_0x102ddb,_0x175d69;_0x4d5906['remoteUri']=intUtil[_0x897d('0x56')](_0x4d5906[_0x897d('0x57')]);_0x4d5906[_0x897d('0x58')]=intUtil['stripTrailingSlash'](_0x4d5906[_0x897d('0x58')]);def['uri']=util['format'](_0x897d('0x59'),_0x4d5906[_0x897d('0x57')]);if(_0x1f7ee5&&_0x1f7ee5[_0x897d('0x5a')]){logger[_0x897d('0x29')](_0x897d('0x5b'),_0x897d('0x5c'));_0x38e605['recordingURL']=util[_0x897d('0x23')](_0x897d('0x5d'),_0x4d5906[_0x897d('0x58')],_0x38e605[_0x897d('0x5e')],md5(_0x38e605[_0x897d('0x5e')]));}else{_0x38e605[_0x897d('0x5f')]='';}return getConnection(_0x4d5906)[_0x897d('0x2f')](function(_0x507ba7){_0x175d69=_0x507ba7;return getUser(_0x4d5906,_0x7a54a1['name'],_0x175d69);})[_0x897d('0x2f')](function(_0x19b52d){_0x9cbb81=_0x19b52d;logger[_0x897d('0x29')](_0x897d('0x60'),_0x9cbb81['id']);return getEndUser(_0x4d5906,_0x38e605['calleridname'],_0x38e605[_0x897d('0x61')],_0x175d69);})['then'](function(_0x1166c3){_0x16c067=_0x1166c3;logger[_0x897d('0x29')](_0x897d('0x62'),_0x16c067['id']);return getTicket(_0x4d5906,_0x9cbb81,_0x16c067,_0x5c0f0b,_0x38e605,_0x5c0f0b[_0x897d('0x63')],_0x175d69,_0x897d('0x64'));})[_0x897d('0x2f')](function(_0x5ba6f6){_0x102ddb=_0x5ba6f6;logger[_0x897d('0x29')](_0x897d('0x65'));logger[_0x897d('0x29')](_0x897d('0x66'),_0x102ddb['id']);return setRelationship(_0x175d69,_0x9cbb81,_0x102ddb,_0x897d('0x67'));})[_0x897d('0x2f')](function(){return setRelationship(_0x175d69,_0x16c067,_0x102ddb,_0x897d('0x68'));})['then'](function(){return getServerInfo(_0x175d69);})['then'](function(_0x1233cc){var _0x23461b=parseInt(_0x1233cc[_0x897d('0x69')]['charAt'](0x0));var _0x3842ec=util[_0x897d('0x23')](_0x897d('0x6a'),_0x4d5906['remoteUri'],_0x102ddb['id']);if(_0x23461b>0x6){_0x3842ec=util[_0x897d('0x23')](_0x897d('0x6b'),_0x4d5906['remoteUri'],_0x102ddb['id']);}logger['info'](_0x897d('0x5b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x897d('0x23')](_0x897d('0x6c'),_0x7a54a1[_0x897d('0xa')]),_0x897d('0x6d'),{'uri':_0x3842ec});})[_0x897d('0x6e')](function(_0x56c9da){logger['error'](_0x897d('0x5b'),JSON[_0x897d('0x2c')](_0x56c9da));});};exports['outbound']=function(_0x1466e4,_0xe719a6,_0x52894d,_0x52a726,_0x4ceb7b,_0x430b7a,_0x2ea567){var _0x3ab0c0,_0x2a009d,_0x63e05c,_0x1459f1;_0x430b7a[_0x897d('0x57')]=intUtil[_0x897d('0x56')](_0x430b7a['remoteUri']);_0x430b7a[_0x897d('0x58')]=intUtil[_0x897d('0x56')](_0x430b7a[_0x897d('0x58')]);def[_0x897d('0x6f')]=util[_0x897d('0x23')]('%s/service/v4_1/rest.php',_0x430b7a['remoteUri']);if(_0x2ea567&&_0x2ea567[_0x897d('0x70')]&&_0x2ea567[_0x897d('0x70')]!==_0x897d('0x71')){logger[_0x897d('0x29')](_0x897d('0x72'),_0x897d('0x5c'));_0xe719a6['recordingURL']=util[_0x897d('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x430b7a[_0x897d('0x58')],_0xe719a6['uniqueid'],md5(_0xe719a6[_0x897d('0x5e')]));}return getConnection(_0x430b7a)[_0x897d('0x2f')](function(_0x526211){_0x1459f1=_0x526211;return getUser(_0x430b7a,_0x52a726[_0x897d('0xa')],_0x1459f1);})[_0x897d('0x2f')](function(_0x2f0dc7){_0x3ab0c0=_0x2f0dc7;logger['info']('The\x20User\x20ID\x20is:',_0x3ab0c0['id']);return getEndUser(_0x430b7a,_0xe719a6[_0x897d('0x73')],_0xe719a6[_0x897d('0x74')],_0x1459f1);})[_0x897d('0x2f')](function(_0x3319ba){_0x2a009d=_0x3319ba;logger[_0x897d('0x29')](_0x897d('0x62'),_0x2a009d['id']);return getTicket(_0x430b7a,_0x3ab0c0,_0x2a009d,_0x52894d,_0xe719a6,_0x52894d['Fields'],_0x1459f1,_0x897d('0x75'));})[_0x897d('0x2f')](function(_0x3dfcca){_0x63e05c=_0x3dfcca;logger['info'](_0x897d('0x65'));logger[_0x897d('0x29')]('The\x20Ticket\x20ID\x20is:',_0x63e05c['id']);return setRelationship(_0x1459f1,_0x3ab0c0,_0x63e05c,_0x897d('0x67'));})['then'](function(){return setRelationship(_0x1459f1,_0x2a009d,_0x63e05c,_0x897d('0x68'));})['then'](function(){return getServerInfo(_0x1459f1);})[_0x897d('0x2f')](function(_0x55cac4){var _0x34e8e4=parseInt(_0x55cac4[_0x897d('0x69')][_0x897d('0x76')](0x0));var _0x3125bb=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x430b7a[_0x897d('0x57')],_0x63e05c['id']);if(_0x34e8e4>0x6){_0x3125bb=util['format'](_0x897d('0x6b'),_0x430b7a['remoteUri'],_0x63e05c['id']);}logger[_0x897d('0x29')]('[OUTBOUND]',_0x897d('0x77'));emit(util[_0x897d('0x23')]('user:%s',_0x52a726[_0x897d('0xa')]),_0x897d('0x6d'),{'uri':_0x3125bb});})[_0x897d('0x6e')](function(_0x4b09d4){logger[_0x897d('0x78')](_0x897d('0x72'),JSON[_0x897d('0x2c')](_0x4b09d4));});};exports[_0x897d('0x79')]=function(_0x176cce,_0x54b44d,_0x379614,_0x3b689d,_0x449281,_0x4d010a){var _0x23c236,_0x530d8f,_0x481dd9,_0xb9f09e;_0x4d010a[_0x897d('0x57')]=intUtil['stripTrailingSlash'](_0x4d010a['remoteUri']);_0x4d010a[_0x897d('0x58')]=intUtil['stripTrailingSlash'](_0x4d010a[_0x897d('0x58')]);def[_0x897d('0x6f')]=util[_0x897d('0x23')](_0x897d('0x59'),_0x4d010a['remoteUri']);if(_0x449281&&_0x449281[_0x897d('0x5a')]){logger[_0x897d('0x29')](_0x897d('0x7a'),_0x897d('0x5c'));_0x54b44d[_0x897d('0x5f')]=util['format'](_0x897d('0x5d'),_0x4d010a[_0x897d('0x58')],_0x54b44d[_0x897d('0x5e')],md5(_0x54b44d[_0x897d('0x5e')]));}else{_0x54b44d[_0x897d('0x5f')]='';}return getConnection(_0x4d010a)[_0x897d('0x2f')](function(_0x375647){_0xb9f09e=_0x375647;if(!_[_0x897d('0x28')](_0x3b689d)){return getUser(_0x4d010a,_0x3b689d[_0x897d('0xa')],_0xb9f09e);}else{return getUser(_0x4d010a,null,_0xb9f09e);}})[_0x897d('0x2f')](function(_0x36c667){_0x23c236=_0x36c667;logger[_0x897d('0x29')](_0x897d('0x60'),_0x23c236['id']);return getEndUser(_0x4d010a,_0x54b44d[_0x897d('0x7b')],_0x54b44d[_0x897d('0x61')],_0xb9f09e);})[_0x897d('0x2f')](function(_0x4fc6e5){_0x530d8f=_0x4fc6e5;logger[_0x897d('0x29')](_0x897d('0x62'),_0x530d8f['id']);return getTicket(_0x4d010a,_0x23c236,_0x530d8f,_0x379614,_0x54b44d,_0x379614['Fields'],_0xb9f09e,_0x897d('0x64'));})[_0x897d('0x2f')](function(_0x5a958c){_0x481dd9=_0x5a958c;logger[_0x897d('0x29')](_0x897d('0x65'));logger[_0x897d('0x29')](_0x897d('0x66'),_0x481dd9['id']);return setRelationship(_0xb9f09e,_0x23c236,_0x481dd9,_0x897d('0x67'));})['then'](function(){return setRelationship(_0xb9f09e,_0x530d8f,_0x481dd9,_0x897d('0x68'));})['then'](function(){return getServerInfo(_0xb9f09e);})[_0x897d('0x6e')](function(_0x508035){logger[_0x897d('0x78')](_0x897d('0x7a'),JSON[_0x897d('0x2c')](_0x508035));});}; \ No newline at end of file +var _0x6b1c=['value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','toLowerCase','content','toString','type','idField','customField','custom_fields','variable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%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','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','error','[ABANDONED]','Recording\x20is\x20enabled!','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','POST','info','getString','assigned_user_id','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','Contacts','direction','forEach','variableName','push','set_entry','JSON','Calls','format','apiKey','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','stringify','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','then','entry_list','length','find'];(function(_0x504a77,_0x5d6ae5){var _0x3a225d=function(_0x213b8a){while(--_0x213b8a){_0x504a77['push'](_0x504a77['shift']());}};_0x3a225d(++_0x5d6ae5);}(_0x6b1c,0xb5));var _0xc6b1=function(_0x2fe329,_0x59a823){_0x2fe329=_0x2fe329-0x0;var _0x27e985=_0x6b1c[_0x2fe329];return _0x27e985;};'use strict';var _=require('lodash');var rp=require(_0xc6b1('0x0'));var BPromise=require('bluebird');var md5=require(_0xc6b1('0x1'));var util=require(_0xc6b1('0x2'));var Redis=require(_0xc6b1('0x3'));var intUtil=require(_0xc6b1('0x4'));var config=require(_0xc6b1('0x5'));var logger=require(_0xc6b1('0x6'))(_0xc6b1('0x7'));config[_0xc6b1('0x8')]=_[_0xc6b1('0x9')](config[_0xc6b1('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc6b1('0x8')]));var def={'method':_0xc6b1('0xa'),'json':!![]};function emit(_0x3d437f,_0x15afeb,_0x3c565f){io['to'](_0x3d437f)['emit'](_0x15afeb,_0x3c565f);}function getTicket(_0x584c7e,_0x2423b6,_0xd0783a,_0x4d39c6,_0x1dc42f,_0x11e3f1,_0x3b802f,_0x4e0219){logger[_0xc6b1('0xb')]('Creating\x20new\x20ticket...');var _0x18dff1=new Date();var _0x139335=[{'name':'name','value':intUtil[_0xc6b1('0xc')](_0x4d39c6['Subjects'],_0x1dc42f,'\x20')},{'name':_0xc6b1('0xd'),'value':_0x2423b6['id']},{'name':'created_by','value':_0x2423b6['id']},{'name':'description','value':intUtil[_0xc6b1('0xc')](_0x4d39c6[_0xc6b1('0xe')],_0x1dc42f,'\x0a')},{'name':_0xc6b1('0xf'),'value':_0x18dff1[_0xc6b1('0x10')]()[_0xc6b1('0x11')](0x0,0x13)[_0xc6b1('0x12')]('T','\x20')},{'name':_0xc6b1('0x13'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xc6b1('0x14'),'value':_0xd0783a['id']},{'name':'parent_type','value':_0xc6b1('0x15')},{'name':'parent_name','value':_0xd0783a['name']},{'name':_0xc6b1('0x16'),'value':_0x4e0219}];if(_0x11e3f1['length']){_[_0xc6b1('0x17')](_0x11e3f1,function(_0x34f44d){if(_0x1dc42f[_0x34f44d[_0xc6b1('0x18')]]){_0x139335[_0xc6b1('0x19')]({'name':_0x34f44d['idField'],'value':_0x1dc42f[_0x34f44d[_0xc6b1('0x18')]]});}});}return request({'form':{'method':_0xc6b1('0x1a'),'input_type':_0xc6b1('0x1b'),'response_type':_0xc6b1('0x1b'),'rest_data':JSON['stringify']({'session':_0x3b802f['id'],'module_name':_0xc6b1('0x1c'),'name_value_list':_0x139335})}});}function getAuth(_0x483290){return util[_0xc6b1('0x1d')]('Basic\x20%s',new Buffer(_0x483290[_0xc6b1('0x1e')]+':X')['toString']('base64'));}function getServerInfo(_0x198669){return request({'form':{'method':_0xc6b1('0x1f'),'input_type':_0xc6b1('0x1b'),'response_type':_0xc6b1('0x1b'),'rest_data':JSON['stringify']({'session':_0x198669['id']})}});}function getUser(_0x19c86b,_0x298798,_0x14adfd){if(!_[_0xc6b1('0x20')](_0x298798)){logger[_0xc6b1('0xb')](_0xc6b1('0x21'),_0x298798);return request({'form':{'method':_0xc6b1('0x22'),'input_type':'JSON','response_type':_0xc6b1('0x1b'),'rest_data':JSON[_0xc6b1('0x23')]({'session':_0x14adfd['id'],'module_name':'Employees','query':util[_0xc6b1('0x1d')](_0xc6b1('0x24'),_0x298798),'order_by':'','offset':'0','select_fields':['id',_0xc6b1('0x25'),_0xc6b1('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc6b1('0x27')](function(_0x158840){if(_0x158840[_0xc6b1('0x28')][_0xc6b1('0x29')]){var _0x859a6d=_[_0xc6b1('0x2a')](_0x158840['entry_list'],function(_0x3bf834){return _0x3bf834['name_value_list']['user_name'][_0xc6b1('0x2b')]===_0x298798;});if(_0x859a6d){logger[_0xc6b1('0xb')](_0xc6b1('0x2c'));return BPromise[_0xc6b1('0x2d')]({'id':_0x859a6d[_0xc6b1('0x2e')]['id'][_0xc6b1('0x2b')],'name':_0x859a6d[_0xc6b1('0x2e')]['name'][_0xc6b1('0x2b')]});}}logger[_0xc6b1('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc6b1('0x2d')]({'id':_0x14adfd[_0xc6b1('0x2e')]['user_id'][_0xc6b1('0x2b')],'name':_0x14adfd[_0xc6b1('0x2e')][_0xc6b1('0x26')][_0xc6b1('0x2b')]});});}else{logger['info'](_0xc6b1('0x2f'));return BPromise['resolve']({'id':_0x14adfd[_0xc6b1('0x2e')]['user_id']['value'],'name':_0x14adfd[_0xc6b1('0x2e')]['user_name'][_0xc6b1('0x2b')]});}}function getEndUser(_0x387895,_0xce1846,_0x4012da,_0xcf0209){logger[_0xc6b1('0xb')](_0xc6b1('0x30'),_0x4012da);return request({'form':{'method':_0xc6b1('0x22'),'input_type':_0xc6b1('0x1b'),'response_type':'JSON','rest_data':JSON[_0xc6b1('0x23')]({'session':_0xcf0209['id'],'module_name':_0xc6b1('0x15'),'query':util[_0xc6b1('0x1d')](_0xc6b1('0x31'),_0x4012da),'order_by':'','offset':'0','select_fields':['id',_0xc6b1('0x25'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc6b1('0x27')](function(_0x3878ad){if(_0x3878ad[_0xc6b1('0x28')][_0xc6b1('0x29')]){var _0x47e27a=_[_0xc6b1('0x2a')](_0x3878ad[_0xc6b1('0x28')],function(_0x416e4d){return _0x416e4d[_0xc6b1('0x2e')][_0xc6b1('0x32')][_0xc6b1('0x2b')]===_0x4012da;});if(_0x47e27a){logger[_0xc6b1('0xb')]('Enduser\x20found!');return BPromise[_0xc6b1('0x2d')]({'id':_0x47e27a[_0xc6b1('0x2e')]['id'][_0xc6b1('0x2b')],'name':_0x47e27a[_0xc6b1('0x2e')][_0xc6b1('0x25')][_0xc6b1('0x2b')],'phone':_0x47e27a['name_value_list'][_0xc6b1('0x32')][_0xc6b1('0x2b')]});}}else{logger[_0xc6b1('0xb')](_0xc6b1('0x33'));return request({'form':{'method':'set_entry','input_type':_0xc6b1('0x1b'),'response_type':_0xc6b1('0x1b'),'rest_data':JSON['stringify']({'session':_0xcf0209['id'],'module_name':_0xc6b1('0x15'),'name_value_list':[{'name':_0xc6b1('0x34'),'value':_0xce1846!==''?_0xce1846:util['format'](_0xc6b1('0x35'),_0x4012da)},{'name':_0xc6b1('0x32'),'value':_0x4012da}]})}})[_0xc6b1('0x27')](function(_0x2729be){logger[_0xc6b1('0xb')](_0xc6b1('0x36'));return BPromise[_0xc6b1('0x2d')]({'id':_0x2729be['id'],'name':_0x2729be[_0xc6b1('0x28')][_0xc6b1('0x34')][_0xc6b1('0x2b')],'phone':_0x2729be[_0xc6b1('0x28')]['phone_home'][_0xc6b1('0x2b')]});});}});}function request(_0x26e416){logger[_0xc6b1('0x37')](_0xc6b1('0x38'),JSON['stringify'](_0x26e416));return rp(_[_0xc6b1('0x39')](def,_0x26e416));}function getTags(_0x1c2e42,_0x1301c6){var _0x380ed0=[];if(_0x1c2e42&&_0x1c2e42[_0xc6b1('0x29')]>0x0){_0x380ed0=_[_0xc6b1('0x3a')](_0x1c2e42,_0x1301c6);}return _0x380ed0;}function getCustomFields(_0x50211a,_0x5d09c7){var _0x5ef930=[];var _0x106ab6={'custom_fields':[]};if(_0x50211a[_0xc6b1('0x29')]>0x0){_[_0xc6b1('0x17')](_0x50211a,function(_0x13cc31){if(_0x13cc31['type']==='string'&&_0x13cc31['nameField']&&!_0x13cc31['customField']){_0x106ab6[_0x13cc31['nameField'][_0xc6b1('0x3b')]()]=_0x13cc31[_0xc6b1('0x3c')][_0xc6b1('0x3d')]();}else if(_0x13cc31[_0xc6b1('0x3e')]==='string'&&_0x13cc31[_0xc6b1('0x3f')]&&_0x13cc31[_0xc6b1('0x40')]){_0x106ab6[_0xc6b1('0x41')]['push']({'id':_0x13cc31[_0xc6b1('0x3f')],'value':_0x13cc31[_0xc6b1('0x3c')][_0xc6b1('0x3d')]()});}else if(_0x13cc31['type']===_0xc6b1('0x42')&&_0x13cc31[_0xc6b1('0x18')]&&_0x13cc31['idField']&&_0x13cc31[_0xc6b1('0x40')]){_0x5d09c7[_0x13cc31[_0xc6b1('0x18')]]&&_0x106ab6[_0xc6b1('0x41')][_0xc6b1('0x19')]({'id':_0x13cc31[_0xc6b1('0x3f')],'value':_0x5d09c7[_0x13cc31[_0xc6b1('0x18')]][_0xc6b1('0x3d')]()});}else if(_0x13cc31[_0xc6b1('0x3e')]==='customVariable'&&_0x13cc31['Variable']&&_0x13cc31[_0xc6b1('0x43')][_0xc6b1('0x25')]&&_0x13cc31[_0xc6b1('0x3f')]&&_0x13cc31['customField']){_0x5d09c7[_0x13cc31[_0xc6b1('0x43')][_0xc6b1('0x25')][_0xc6b1('0x3b')]()]&&_0x106ab6['custom_fields']['push']({'id':_0x13cc31[_0xc6b1('0x3f')],'value':_0x5d09c7[_0x13cc31[_0xc6b1('0x43')]['name']['toLowerCase']()][_0xc6b1('0x3d')]()});}});}return _0x106ab6;}function getConnection(_0x31b73c){return request({'method':_0xc6b1('0xa'),'form':{'method':_0xc6b1('0x44'),'input_type':_0xc6b1('0x1b'),'response_type':_0xc6b1('0x1b'),'rest_data':JSON[_0xc6b1('0x23')]({'user_auth':{'user_name':_0x31b73c[_0xc6b1('0x45')],'password':_0x31b73c[_0xc6b1('0x46')],'encryption':_0xc6b1('0x47')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xc6b1('0x27')](function(_0x37a68f){var _0x4f6921=_0x37a68f;if(_0x4f6921['id']){def[_0xc6b1('0x48')]=_0x4f6921['id'];return BPromise[_0xc6b1('0x2d')](_0x4f6921);}else{throw new Error(util['format'](_0xc6b1('0x49'),_0x31b73c['id']));}});}function setRelationship(_0x73c968,_0x1400de,_0x4ab159,_0x1b7dc7){return request({'form':{'method':'set_relationship','input_type':_0xc6b1('0x1b'),'response_type':_0xc6b1('0x1b'),'rest_data':JSON[_0xc6b1('0x23')]({'session':_0x73c968['id'],'module_name':_0xc6b1('0x1c'),'module_id':_0x4ab159['id'],'link_field_name':_0x1b7dc7,'related_ids':[_0x1400de['id']]})}});}exports[_0xc6b1('0x4a')]=function(_0x466932,_0x563661,_0x227e3e,_0x483abf,_0x102413,_0x2dee31){var _0x2c508b,_0x3817e2,_0x2529b0,_0x39f5b4;_0x2dee31[_0xc6b1('0x4b')]=intUtil['stripTrailingSlash'](_0x2dee31[_0xc6b1('0x4b')]);_0x2dee31[_0xc6b1('0x4c')]=intUtil[_0xc6b1('0x4d')](_0x2dee31[_0xc6b1('0x4c')]);def[_0xc6b1('0x4e')]=util['format'](_0xc6b1('0x4f'),_0x2dee31[_0xc6b1('0x4b')]);if(_0x102413&&_0x102413[_0xc6b1('0x50')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x563661[_0xc6b1('0x51')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2dee31['serverUrl'],_0x563661[_0xc6b1('0x52')],md5(_0x563661[_0xc6b1('0x52')]));}else{_0x563661[_0xc6b1('0x51')]='';}return getConnection(_0x2dee31)[_0xc6b1('0x27')](function(_0x344515){_0x39f5b4=_0x344515;return getUser(_0x2dee31,_0x483abf[_0xc6b1('0x25')],_0x39f5b4);})[_0xc6b1('0x27')](function(_0x1645f2){_0x2c508b=_0x1645f2;logger[_0xc6b1('0xb')]('The\x20User\x20ID\x20is:',_0x2c508b['id']);return getEndUser(_0x2dee31,_0x563661[_0xc6b1('0x53')],_0x563661[_0xc6b1('0x54')],_0x39f5b4);})[_0xc6b1('0x27')](function(_0x2188b0){_0x3817e2=_0x2188b0;logger[_0xc6b1('0xb')](_0xc6b1('0x55'),_0x3817e2['id']);return getTicket(_0x2dee31,_0x2c508b,_0x3817e2,_0x227e3e,_0x563661,_0x227e3e[_0xc6b1('0x56')],_0x39f5b4,_0xc6b1('0x57'));})[_0xc6b1('0x27')](function(_0x466220){_0x2529b0=_0x466220;logger[_0xc6b1('0xb')](_0xc6b1('0x58'));logger['info'](_0xc6b1('0x59'),_0x2529b0['id']);return setRelationship(_0x39f5b4,_0x2c508b,_0x2529b0,'users');})['then'](function(){return setRelationship(_0x39f5b4,_0x3817e2,_0x2529b0,_0xc6b1('0x5a'));})[_0xc6b1('0x27')](function(){return getServerInfo(_0x39f5b4);})[_0xc6b1('0x27')](function(_0x6b5215){var _0x5738d1=parseInt(_0x6b5215[_0xc6b1('0x5b')][_0xc6b1('0x5c')](0x0));var _0xdb9655=util[_0xc6b1('0x1d')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2dee31[_0xc6b1('0x4b')],_0x2529b0['id']);if(_0x5738d1>0x6){_0xdb9655=util[_0xc6b1('0x1d')](_0xc6b1('0x5d'),_0x2dee31[_0xc6b1('0x4b')],_0x2529b0['id']);}logger['info']('[QUEUE]',_0xc6b1('0x5e'));emit(util['format'](_0xc6b1('0x5f'),_0x483abf[_0xc6b1('0x25')]),_0xc6b1('0x60'),{'uri':_0xdb9655});})[_0xc6b1('0x61')](function(_0x772ca6){logger['error']('[QUEUE]',JSON[_0xc6b1('0x23')](_0x772ca6));});};exports[_0xc6b1('0x62')]=function(_0x4d4687,_0x5887a3,_0x3864cd,_0x19d370,_0x6f977a,_0x2e48f7,_0x1a49b9){var _0xaff67,_0x18ecce,_0xf2de74,_0x393c14;_0x2e48f7[_0xc6b1('0x4b')]=intUtil[_0xc6b1('0x4d')](_0x2e48f7['remoteUri']);_0x2e48f7[_0xc6b1('0x4c')]=intUtil[_0xc6b1('0x4d')](_0x2e48f7[_0xc6b1('0x4c')]);def[_0xc6b1('0x4e')]=util[_0xc6b1('0x1d')](_0xc6b1('0x4f'),_0x2e48f7[_0xc6b1('0x4b')]);if(_0x1a49b9&&_0x1a49b9[_0xc6b1('0x63')]&&_0x1a49b9[_0xc6b1('0x63')]!==_0xc6b1('0x64')){logger['info'](_0xc6b1('0x65'),'Recording\x20is\x20enabled!');_0x5887a3[_0xc6b1('0x51')]=util[_0xc6b1('0x1d')](_0xc6b1('0x66'),_0x2e48f7[_0xc6b1('0x4c')],_0x5887a3[_0xc6b1('0x52')],md5(_0x5887a3[_0xc6b1('0x52')]));}return getConnection(_0x2e48f7)[_0xc6b1('0x27')](function(_0x2c48d7){_0x393c14=_0x2c48d7;return getUser(_0x2e48f7,_0x19d370[_0xc6b1('0x25')],_0x393c14);})[_0xc6b1('0x27')](function(_0x22dcab){_0xaff67=_0x22dcab;logger['info'](_0xc6b1('0x67'),_0xaff67['id']);return getEndUser(_0x2e48f7,_0x5887a3[_0xc6b1('0x68')],_0x5887a3[_0xc6b1('0x69')],_0x393c14);})['then'](function(_0x181c44){_0x18ecce=_0x181c44;logger[_0xc6b1('0xb')](_0xc6b1('0x55'),_0x18ecce['id']);return getTicket(_0x2e48f7,_0xaff67,_0x18ecce,_0x3864cd,_0x5887a3,_0x3864cd[_0xc6b1('0x56')],_0x393c14,_0xc6b1('0x6a'));})[_0xc6b1('0x27')](function(_0x347310){_0xf2de74=_0x347310;logger[_0xc6b1('0xb')](_0xc6b1('0x58'));logger[_0xc6b1('0xb')]('The\x20Ticket\x20ID\x20is:',_0xf2de74['id']);return setRelationship(_0x393c14,_0xaff67,_0xf2de74,_0xc6b1('0x6b'));})[_0xc6b1('0x27')](function(){return setRelationship(_0x393c14,_0x18ecce,_0xf2de74,'contacts');})['then'](function(){return getServerInfo(_0x393c14);})[_0xc6b1('0x27')](function(_0x9165ff){var _0x1199ca=parseInt(_0x9165ff[_0xc6b1('0x5b')]['charAt'](0x0));var _0x427152=util[_0xc6b1('0x1d')](_0xc6b1('0x6c'),_0x2e48f7['remoteUri'],_0xf2de74['id']);if(_0x1199ca>0x6){_0x427152=util[_0xc6b1('0x1d')](_0xc6b1('0x5d'),_0x2e48f7[_0xc6b1('0x4b')],_0xf2de74['id']);}logger[_0xc6b1('0xb')](_0xc6b1('0x65'),_0xc6b1('0x5e'));emit(util[_0xc6b1('0x1d')]('user:%s',_0x19d370[_0xc6b1('0x25')]),_0xc6b1('0x60'),{'uri':_0x427152});})[_0xc6b1('0x61')](function(_0x142459){logger[_0xc6b1('0x6d')](_0xc6b1('0x65'),JSON[_0xc6b1('0x23')](_0x142459));});};exports['abandoned']=function(_0x3fd4b4,_0x4d6404,_0x4d64ff,_0x210d2b,_0x540d15,_0x3a122f){var _0x24e852,_0x19183e,_0x1dbcd3,_0x546a80;_0x3a122f['remoteUri']=intUtil['stripTrailingSlash'](_0x3a122f[_0xc6b1('0x4b')]);_0x3a122f[_0xc6b1('0x4c')]=intUtil[_0xc6b1('0x4d')](_0x3a122f[_0xc6b1('0x4c')]);def[_0xc6b1('0x4e')]=util[_0xc6b1('0x1d')](_0xc6b1('0x4f'),_0x3a122f['remoteUri']);if(_0x540d15&&_0x540d15[_0xc6b1('0x50')]){logger[_0xc6b1('0xb')](_0xc6b1('0x6e'),_0xc6b1('0x6f'));_0x4d6404[_0xc6b1('0x51')]=util['format'](_0xc6b1('0x66'),_0x3a122f[_0xc6b1('0x4c')],_0x4d6404[_0xc6b1('0x52')],md5(_0x4d6404[_0xc6b1('0x52')]));}else{_0x4d6404[_0xc6b1('0x51')]='';}return getConnection(_0x3a122f)['then'](function(_0x104d83){_0x546a80=_0x104d83;if(!_[_0xc6b1('0x20')](_0x210d2b)){return getUser(_0x3a122f,_0x210d2b[_0xc6b1('0x25')],_0x546a80);}else{return getUser(_0x3a122f,null,_0x546a80);}})[_0xc6b1('0x27')](function(_0x181494){_0x24e852=_0x181494;logger[_0xc6b1('0xb')](_0xc6b1('0x67'),_0x24e852['id']);return getEndUser(_0x3a122f,_0x4d6404['calleridname'],_0x4d6404[_0xc6b1('0x54')],_0x546a80);})['then'](function(_0x393065){_0x19183e=_0x393065;logger[_0xc6b1('0xb')](_0xc6b1('0x55'),_0x19183e['id']);return getTicket(_0x3a122f,_0x24e852,_0x19183e,_0x4d64ff,_0x4d6404,_0x4d64ff[_0xc6b1('0x56')],_0x546a80,_0xc6b1('0x57'));})[_0xc6b1('0x27')](function(_0x139faa){_0x1dbcd3=_0x139faa;logger['info'](_0xc6b1('0x58'));logger['info'](_0xc6b1('0x59'),_0x1dbcd3['id']);return setRelationship(_0x546a80,_0x24e852,_0x1dbcd3,_0xc6b1('0x6b'));})[_0xc6b1('0x27')](function(){return setRelationship(_0x546a80,_0x19183e,_0x1dbcd3,_0xc6b1('0x5a'));})['then'](function(){return getServerInfo(_0x546a80);})[_0xc6b1('0x61')](function(_0x5f33c7){logger['error'](_0xc6b1('0x6e'),JSON[_0xc6b1('0x23')](_0x5f33c7));});}; \ 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 560918d..1deb39a 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 _0x2153=['name','toLowerCase','toString','keyValue','keyType','format','key','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','substring','validateEmail','test','lodash','length','string','push','content','variable','variableName','type','customVariable','Variable'];(function(_0x3ff439,_0x4da705){var _0x479390=function(_0x3b50a8){while(--_0x3b50a8){_0x3ff439['push'](_0x3ff439['shift']());}};_0x479390(++_0x4da705);}(_0x2153,0xf0));var _0x3215=function(_0x3a7d41,_0x148c8f){_0x3a7d41=_0x3a7d41-0x0;var _0x2c6a08=_0x2153[_0x3a7d41];return _0x2c6a08;};'use strict';var _=require(_0x3215('0x0'));var util=require('util');exports['getString']=function(_0x4a9603,_0x17dcf4,_0xb4245a){var _0x3de60e=[];if(_0x4a9603[_0x3215('0x1')]>0x0){var _0x581007=_['sortBy'](_0x4a9603,['id']);for(var _0x311bf6=0x0;_0x311bf6<_0x581007['length'];_0x311bf6++){var _0x215c1b=_0x581007[_0x311bf6];if(_0x215c1b['type']===_0x3215('0x2')){_0x3de60e[_0x3215('0x3')](_0x215c1b[_0x3215('0x4')]);}else if(_0x215c1b['type']===_0x3215('0x5')&&_0x215c1b[_0x3215('0x6')]){_0x17dcf4[_0x215c1b['variableName']]&&_0x3de60e['push'](_0x17dcf4[_0x215c1b[_0x3215('0x6')]]['toString']());}else if(_0x215c1b[_0x3215('0x7')]===_0x3215('0x8')&&_0x215c1b['Variable']&&_0x215c1b[_0x3215('0x9')][_0x3215('0xa')]){_0x17dcf4[_0x215c1b['Variable']['name'][_0x3215('0xb')]()]&&_0x3de60e['push'](_0x17dcf4[_0x215c1b['Variable'][_0x3215('0xa')][_0x3215('0xb')]()][_0x3215('0xc')]());}else if(_0x215c1b[_0x3215('0x7')]===_0x3215('0xd')){if(_0x215c1b[_0x3215('0xe')]===_0x3215('0x2')&&_0x215c1b['key']){_0x3de60e['push'](util[_0x3215('0xf')]('%s:\x20%s',_0x215c1b[_0x3215('0x10')],_0x215c1b[_0x3215('0x11')]));}else if(_0x215c1b[_0x3215('0xe')]==='variable'&&_0x215c1b[_0x3215('0x6')]&&_0x215c1b[_0x3215('0x10')]){_0x17dcf4[_0x215c1b[_0x3215('0x6')]]&&_0x3de60e[_0x3215('0x3')](util[_0x3215('0xf')]('%s:\x20%s',_0x215c1b['key'],_0x17dcf4[_0x215c1b[_0x3215('0x6')]]));}else if(_0x215c1b[_0x3215('0xe')]===_0x3215('0x8')&&_0x215c1b[_0x3215('0x9')]&&_0x215c1b[_0x3215('0x9')][_0x3215('0xa')]&&_0x215c1b[_0x3215('0x10')]){_0x17dcf4[_0x215c1b[_0x3215('0x9')]['name'][_0x3215('0xb')]()]&&_0x3de60e[_0x3215('0x3')](util[_0x3215('0xf')](_0x3215('0x12'),_0x215c1b['key'],_0x17dcf4[_0x215c1b[_0x3215('0x9')][_0x3215('0xa')][_0x3215('0xb')]()]));}}}}return _0x3de60e[_0x3215('0x13')](_0xb4245a);};exports[_0x3215('0x14')]=function(_0x27fbc5){var _0x507ade=_0x27fbc5[_0x3215('0x15')](-0x1);if(_0x507ade==='/'){_0x27fbc5=_0x27fbc5[_0x3215('0x16')](0x0,_0x27fbc5['lastIndexOf'](_0x507ade));}return _0x27fbc5;};exports[_0x3215('0x17')]=function(_0x5734eb){if(!_['isNil'](_0x5734eb)&&_0x5734eb!==''){var _0x42f2ac=/^(([^<>()\[\]\\.,;:\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 _0x42f2ac[_0x3215('0x18')](String(_0x5734eb)[_0x3215('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x3954=['substring','lastIndexOf','validateEmail','test','lodash','util','getString','sortBy','string','push','content','type','variable','variableName','toString','customVariable','name','Variable','toLowerCase','keyType','format','%s:\x20%s','key','keyContent','join','stripTrailingSlash','slice'];(function(_0x4286f4,_0x408670){var _0x425680=function(_0x463c1e){while(--_0x463c1e){_0x4286f4['push'](_0x4286f4['shift']());}};_0x425680(++_0x408670);}(_0x3954,0xa6));var _0x4395=function(_0x90cb12,_0x41f4f1){_0x90cb12=_0x90cb12-0x0;var _0x128301=_0x3954[_0x90cb12];return _0x128301;};'use strict';var _=require(_0x4395('0x0'));var util=require(_0x4395('0x1'));exports[_0x4395('0x2')]=function(_0x72afb7,_0x189600,_0x498b26){var _0x17a35=[];if(_0x72afb7['length']>0x0){var _0x39a7d5=_[_0x4395('0x3')](_0x72afb7,['id']);for(var _0x15a4a4=0x0;_0x15a4a4<_0x39a7d5['length'];_0x15a4a4++){var _0x394906=_0x39a7d5[_0x15a4a4];if(_0x394906['type']===_0x4395('0x4')){_0x17a35[_0x4395('0x5')](_0x394906[_0x4395('0x6')]);}else if(_0x394906[_0x4395('0x7')]===_0x4395('0x8')&&_0x394906[_0x4395('0x9')]){_0x189600[_0x394906[_0x4395('0x9')]]&&_0x17a35[_0x4395('0x5')](_0x189600[_0x394906[_0x4395('0x9')]][_0x4395('0xa')]());}else if(_0x394906[_0x4395('0x7')]===_0x4395('0xb')&&_0x394906['Variable']&&_0x394906['Variable'][_0x4395('0xc')]){_0x189600[_0x394906['Variable'][_0x4395('0xc')]['toLowerCase']()]&&_0x17a35[_0x4395('0x5')](_0x189600[_0x394906[_0x4395('0xd')][_0x4395('0xc')][_0x4395('0xe')]()][_0x4395('0xa')]());}else if(_0x394906[_0x4395('0x7')]==='keyValue'){if(_0x394906[_0x4395('0xf')]===_0x4395('0x4')&&_0x394906['key']){_0x17a35[_0x4395('0x5')](util[_0x4395('0x10')](_0x4395('0x11'),_0x394906[_0x4395('0x12')],_0x394906[_0x4395('0x13')]));}else if(_0x394906[_0x4395('0xf')]===_0x4395('0x8')&&_0x394906[_0x4395('0x9')]&&_0x394906['key']){_0x189600[_0x394906[_0x4395('0x9')]]&&_0x17a35[_0x4395('0x5')](util[_0x4395('0x10')](_0x4395('0x11'),_0x394906[_0x4395('0x12')],_0x189600[_0x394906['variableName']]));}else if(_0x394906[_0x4395('0xf')]==='customVariable'&&_0x394906[_0x4395('0xd')]&&_0x394906[_0x4395('0xd')]['name']&&_0x394906[_0x4395('0x12')]){_0x189600[_0x394906['Variable']['name'][_0x4395('0xe')]()]&&_0x17a35[_0x4395('0x5')](util[_0x4395('0x10')](_0x4395('0x11'),_0x394906[_0x4395('0x12')],_0x189600[_0x394906['Variable'][_0x4395('0xc')][_0x4395('0xe')]()]));}}}}return _0x17a35[_0x4395('0x14')](_0x498b26);};exports[_0x4395('0x15')]=function(_0x430d41){var _0x447f5d=_0x430d41[_0x4395('0x16')](-0x1);if(_0x447f5d==='/'){_0x430d41=_0x430d41[_0x4395('0x17')](0x0,_0x430d41[_0x4395('0x18')](_0x447f5d));}return _0x430d41;};exports[_0x4395('0x19')]=function(_0x2a22de){if(!_['isNil'](_0x2a22de)&&_0x2a22de!==''){var _0x47ba24=/^(([^<>()\[\]\\.,;:\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 _0x47ba24[_0x4395('0x1a')](String(_0x2a22de)['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 eafb65d..73ea0e3 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 _0x9e9b=['The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','split','trigger:browser:url','abandoned','monitor_format','[ABANDONED]','calleridname','lodash','md5','util','ioredis','./util','../../../../config/logger','vTiger','defaults','redis','localhost','socket.io-emitter','emit','forEach','string','idField','type','variable','variableName','toString','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','%s/webservice.php','remoteUri','create','admin','sessionName','HelpDesk','stringify','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','Getting\x20agent\x20with\x20email','query','success','Agent\x20found!','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','username','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','length','Enduser\x20found!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum'];(function(_0x3a1b90,_0x3c0158){var _0xf6de77=function(_0x396533){while(--_0x396533){_0x3a1b90['push'](_0x3a1b90['shift']());}};_0xf6de77(++_0x3c0158);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0x9e9b[_0x2e41e2];return _0x2844d6;};'use strict';var _=require(_0xb9e9('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0xb9e9('0x1'));var util=require(_0xb9e9('0x2'));var Redis=require(_0xb9e9('0x3'));var intUtil=require(_0xb9e9('0x4'));var config=require('../../../../config/environment');var logger=require(_0xb9e9('0x5'))(_0xb9e9('0x6'));config['redis']=_[_0xb9e9('0x7')](config[_0xb9e9('0x8')],{'host':_0xb9e9('0x9'),'port':0x18eb});var io=require(_0xb9e9('0xa'))(new Redis(config[_0xb9e9('0x8')]));function emit(_0x3e199b,_0x2e9b34,_0x15cb68){io['to'](_0x3e199b)[_0xb9e9('0xb')](_0x2e9b34,_0x15cb68);}function getCustomFields(_0x198093,_0x44ede3){var _0x4369b0={};if(_0x198093['length']>0x0){_[_0xb9e9('0xc')](_0x198093,function(_0x4675c7){if(_0x4675c7['type']===_0xb9e9('0xd')&&_0x4675c7[_0xb9e9('0xe')]){_0x4369b0[_0x4675c7[_0xb9e9('0xe')]]=_0x4675c7['content']['toString']();}else if(_0x4675c7[_0xb9e9('0xf')]===_0xb9e9('0x10')&&_0x4675c7[_0xb9e9('0x11')]&&_0x4675c7[_0xb9e9('0xe')]&&_0x44ede3[_0x4675c7[_0xb9e9('0x11')]]){_0x4369b0[_0x4675c7['idField']]=_0x44ede3[_0x4675c7['variableName']][_0xb9e9('0x12')]();}else if(_0x4675c7[_0xb9e9('0xf')]==='customVariable'&&_0x4675c7[_0xb9e9('0x13')]&&_0x4675c7[_0xb9e9('0x13')][_0xb9e9('0x14')]&&_0x4675c7[_0xb9e9('0xe')]&&_0x44ede3[_0x4675c7['Variable'][_0xb9e9('0x14')][_0xb9e9('0x15')]()]){_0x4369b0[_0x4675c7[_0xb9e9('0xe')]]=_0x44ede3[_0x4675c7['Variable'][_0xb9e9('0x14')][_0xb9e9('0x15')]()][_0xb9e9('0x12')]();}});}return _0x4369b0;}function createTicket(_0x3f3a27,_0x407bf4,_0x258791,_0x2de020,_0x103c43,_0x30adea,_0x142694){logger[_0xb9e9('0x16')](_0xb9e9('0x17'));var _0x2a679f=_[_0xb9e9('0x18')]({'parent_id':'','assigned_user_id':_0x407bf4['id'],'ticketpriorities':_0xb9e9('0x19'),'ticketstatus':_0xb9e9('0x1a'),'ticket_title':intUtil[_0xb9e9('0x1b')](_0x2de020[_0xb9e9('0x1c')],_0x103c43,'\x20'),'description':intUtil[_0xb9e9('0x1b')](_0x2de020[_0xb9e9('0x1d')],_0x103c43,'\x0a'),'contact_id':_0x258791['id']},getCustomFields(_0x30adea,_0x103c43));var _0x52a8b9={'method':_0xb9e9('0x1e'),'uri':util['format'](_0xb9e9('0x1f'),_0x3f3a27[_0xb9e9('0x20')]),'form':{'operation':_0xb9e9('0x21'),'username':_0xb9e9('0x22'),'sessionName':_0x142694[_0xb9e9('0x23')],'elementType':_0xb9e9('0x24'),'element':JSON[_0xb9e9('0x25')](_0x2a679f)},'json':!![]};return request(_0x52a8b9)[_0xb9e9('0x26')](function(_0x5c3dc8){if(_0x5c3dc8['success']){return BPromise[_0xb9e9('0x27')]({'id':_0x5c3dc8[_0xb9e9('0x28')]['id']});}else{throw new Error(util[_0xb9e9('0x29')](_0xb9e9('0x2a'),JSON[_0xb9e9('0x25')](_0x5c3dc8[_0xb9e9('0x2b')])));}})['catch'](function(_0x51c6f5){var _0x5543b2=_0x51c6f5['statusCode']||0x1f4;logger[_0xb9e9('0x2b')]('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x5543b2,JSON[_0xb9e9('0x25')](_0x51c6f5));});}function getUser(_0x51bd72,_0x3ffa10,_0x9a28b8){if(intUtil['validateEmail'](_0x3ffa10)){logger['info'](_0xb9e9('0x2c'),_0x3ffa10);return request({'method':'GET','uri':util[_0xb9e9('0x29')]('%s/webservice.php',_0x51bd72[_0xb9e9('0x20')]),'qs':{'operation':_0xb9e9('0x2d'),'username':_0xb9e9('0x22'),'sessionName':_0x9a28b8[_0xb9e9('0x23')],'query':util['format']('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x3ffa10)},'json':!![]})[_0xb9e9('0x26')](function(_0x47ab12){if(_0x47ab12[_0xb9e9('0x2e')]&&_0x47ab12['result']['length']){logger[_0xb9e9('0x16')](_0xb9e9('0x2f'));return BPromise['resolve']({'id':_0x47ab12[_0xb9e9('0x28')][0x0]['id'],'email':_0x47ab12[_0xb9e9('0x28')][0x0][_0xb9e9('0x30')],'name':_0x47ab12['result'][0x0][_0xb9e9('0x31')]+'\x20'+_0x47ab12[_0xb9e9('0x28')]['last_name']});}else{logger[_0xb9e9('0x16')](_0xb9e9('0x32'));return BPromise[_0xb9e9('0x27')]({'id':_0x9a28b8[_0xb9e9('0x33')],'email':_0x51bd72[_0xb9e9('0x34')],'name':_0xb9e9('0x22')});}})[_0xb9e9('0x35')](function(_0x4ffbb3){var _0x1a7ab8=_0x4ffbb3[_0xb9e9('0x36')]||0x1f4;logger['error'](_0xb9e9('0x37'),_0xb9e9('0x38'),_0x1a7ab8,JSON[_0xb9e9('0x25')](_0x4ffbb3));});}else{logger[_0xb9e9('0x16')](_0xb9e9('0x32'));return BPromise[_0xb9e9('0x27')]({'id':_0x9a28b8[_0xb9e9('0x33')],'email':_0x51bd72['username'],'name':_0xb9e9('0x22')})[_0xb9e9('0x35')](function(_0x36737e){var _0x1c2454=_0x36737e[_0xb9e9('0x36')]||0x1f4;logger[_0xb9e9('0x2b')](_0xb9e9('0x37'),'getUser',_0x1c2454,JSON[_0xb9e9('0x25')](_0x36737e));});}}function getEndUser(_0x402629,_0x4f630d,_0x246842,_0x4ec7d4){logger[_0xb9e9('0x16')](_0xb9e9('0x39'),_0x246842);return request({'method':'GET','uri':util[_0xb9e9('0x29')](_0xb9e9('0x1f'),_0x402629[_0xb9e9('0x20')]),'qs':{'operation':'query','username':'admin','sessionName':_0x4ec7d4['sessionName'],'query':util[_0xb9e9('0x29')](_0xb9e9('0x3a'),_0x246842,_0x246842,_0x246842,_0x246842,_0x246842)},'json':!![]})[_0xb9e9('0x26')](function(_0x2bb4b0){if(_0x2bb4b0[_0xb9e9('0x2e')]&&_0x2bb4b0[_0xb9e9('0x28')][_0xb9e9('0x3b')]){logger[_0xb9e9('0x16')](_0xb9e9('0x3c'));return BPromise['resolve']({'id':_0x2bb4b0['result'][0x0]['id'],'name':_0x2bb4b0[_0xb9e9('0x28')][0x0]['firstname']+'\x20'+_0x2bb4b0[_0xb9e9('0x28')][0x0][_0xb9e9('0x3d')],'phone':_0x246842});}else{logger[_0xb9e9('0x16')](_0xb9e9('0x3e'));return request({'method':_0xb9e9('0x1e'),'uri':util[_0xb9e9('0x29')]('%s/webservice.php',_0x402629[_0xb9e9('0x20')]),'form':{'operation':_0xb9e9('0x21'),'sessionName':_0x4ec7d4[_0xb9e9('0x23')],'elementType':_0xb9e9('0x3f'),'element':JSON[_0xb9e9('0x25')]({'lastname':_0x4f630d,'phone':_0x246842,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x72110a){logger[_0xb9e9('0x16')]('Enduser\x20created.');return BPromise[_0xb9e9('0x27')]({'id':_0x72110a[_0xb9e9('0x28')]['id'],'name':_0x72110a['result']['lastname'],'phone':_0x72110a[_0xb9e9('0x28')]['phone']});})[_0xb9e9('0x35')](function(_0x28145f){var _0x4ffd39=_0x28145f['statusCode']||0x1f4;logger['error'](_0xb9e9('0x37'),'getEndUser',_0x4ffd39,JSON[_0xb9e9('0x25')](_0x28145f));});}});}function getConnection(_0x189c77){var _0x4886ed=_0x189c77[_0xb9e9('0x34')];var _0x59fedc=_0x189c77[_0xb9e9('0x40')];return request({'method':'GET','uri':util[_0xb9e9('0x29')](_0xb9e9('0x1f'),_0x189c77[_0xb9e9('0x20')]),'qs':{'operation':_0xb9e9('0x41'),'username':_0x4886ed},'json':!![]})[_0xb9e9('0x26')](function(_0x432c60){if(_0x432c60[_0xb9e9('0x2e')]){return request({'method':_0xb9e9('0x1e'),'uri':util['format'](_0xb9e9('0x1f'),_0x189c77['remoteUri']),'form':{'operation':_0xb9e9('0x42'),'username':_0xb9e9('0x22'),'accessKey':md5(_0x432c60[_0xb9e9('0x28')][_0xb9e9('0x43')]+_0x59fedc)},'json':!![]});}})[_0xb9e9('0x26')](function(_0x5a8abd){if(_0x5a8abd[_0xb9e9('0x2e')]){return BPromise[_0xb9e9('0x27')](_0x5a8abd[_0xb9e9('0x28')]);}else{throw new Error(util[_0xb9e9('0x29')](_0xb9e9('0x44'),_0x189c77['id']));}})[_0xb9e9('0x35')](function(_0x54cd7d){var _0x1dbbef=_0x54cd7d[_0xb9e9('0x36')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x1dbbef,JSON[_0xb9e9('0x25')](_0x54cd7d));});}function request(_0x4e9aa2){logger['info'](_0xb9e9('0x45'),JSON[_0xb9e9('0x25')](_0x4e9aa2));return rp(_0x4e9aa2);}exports[_0xb9e9('0x46')]=function(_0xbffc66,_0x2226c8,_0x4d9f32,_0x8ebf51,_0x2cc85d,_0x32e796){var _0x2231ad,_0x5af6df,_0x3d3675,_0xaaa8bd;_0x32e796[_0xb9e9('0x20')]=intUtil[_0xb9e9('0x47')](_0x32e796[_0xb9e9('0x20')]);if(_0x2cc85d&&_0x2cc85d['monitor_format']){logger[_0xb9e9('0x16')]('[QUEUE]',_0xb9e9('0x48'));_0x2226c8[_0xb9e9('0x49')]=util[_0xb9e9('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32e796['serverUrl'],_0x2226c8['uniqueid'],md5(_0x2226c8[_0xb9e9('0x4a')]));}else{_0x2226c8[_0xb9e9('0x49')]='';}return getConnection(_0x32e796)[_0xb9e9('0x26')](function(_0x206b7a){_0xaaa8bd=_0x206b7a;return getUser(_0x32e796,_0x8ebf51['email'],_0xaaa8bd);})[_0xb9e9('0x26')](function(_0x2dcf96){_0x2231ad=_0x2dcf96;logger['info'](_0xb9e9('0x4b'),_0x2231ad['id']);return getEndUser(_0x32e796,_0x2226c8['calleridname'],_0x2226c8[_0xb9e9('0x4c')],_0xaaa8bd);})[_0xb9e9('0x26')](function(_0x40cddc){_0x5af6df=_0x40cddc;logger['info'](_0xb9e9('0x4d'),_0x5af6df['id']);return createTicket(_0x32e796,_0x2231ad,_0x5af6df,_0x4d9f32,_0x2226c8,_0x4d9f32[_0xb9e9('0x4e')],_0xaaa8bd);})['then'](function(_0x5be841){_0x3d3675=_0x5be841;logger[_0xb9e9('0x16')](_0xb9e9('0x4f'));logger['info'](_0xb9e9('0x50'),_0x3d3675['id']);var _0x230a79=util[_0xb9e9('0x29')](_0xb9e9('0x51'),_0x32e796[_0xb9e9('0x20')],_['split'](_0x3d3675['id'],'x')[0x1]);logger[_0xb9e9('0x16')](_0xb9e9('0x52'),_0xb9e9('0x53'));emit(util[_0xb9e9('0x29')](_0xb9e9('0x54'),_0x8ebf51[_0xb9e9('0x14')]),'trigger:browser:url',{'uri':_0x230a79});})['catch'](function(_0x49aca2){logger[_0xb9e9('0x2b')](_0xb9e9('0x52'),JSON[_0xb9e9('0x25')](_0x49aca2));});};exports[_0xb9e9('0x55')]=function(_0x1e8235,_0x2aa2cc,_0x51c3e8,_0x1b01f5,_0x14e8af,_0x18b0d1,_0x457b49){var _0x518245,_0x5069b7,_0x571b78,_0x47f9d5;_0x18b0d1['remoteUri']=intUtil[_0xb9e9('0x47')](_0x18b0d1[_0xb9e9('0x20')]);_0x18b0d1[_0xb9e9('0x56')]=intUtil[_0xb9e9('0x47')](_0x18b0d1[_0xb9e9('0x56')]);if(_0x457b49&&_0x457b49[_0xb9e9('0x57')]&&_0x457b49[_0xb9e9('0x57')]!==_0xb9e9('0x58')){logger['info'](_0xb9e9('0x59'),_0xb9e9('0x48'));_0x2aa2cc[_0xb9e9('0x49')]=util[_0xb9e9('0x29')](_0xb9e9('0x5a'),_0x18b0d1[_0xb9e9('0x56')],_0x2aa2cc[_0xb9e9('0x4a')],md5(_0x2aa2cc['uniqueid']));}return getConnection(_0x18b0d1)[_0xb9e9('0x26')](function(_0x5e1234){_0x47f9d5=_0x5e1234;return getUser(_0x18b0d1,_0x1b01f5[_0xb9e9('0x5b')],_0x47f9d5);})['then'](function(_0x2e7e33){_0x518245=_0x2e7e33;logger[_0xb9e9('0x16')](_0xb9e9('0x4b'),_0x518245['id']);return getEndUser(_0x18b0d1,_0x2aa2cc[_0xb9e9('0x5c')],_0x2aa2cc[_0xb9e9('0x5d')],_0x47f9d5);})[_0xb9e9('0x26')](function(_0x364a7c){_0x5069b7=_0x364a7c;logger[_0xb9e9('0x16')](_0xb9e9('0x4d'),_0x5069b7['id']);return createTicket(_0x18b0d1,_0x518245,_0x5069b7,_0x51c3e8,_0x2aa2cc,_0x51c3e8[_0xb9e9('0x4e')],_0x47f9d5);})[_0xb9e9('0x26')](function(_0x1fce29){_0x571b78=_0x1fce29;logger['info'](_0xb9e9('0x4f'));logger[_0xb9e9('0x16')](_0xb9e9('0x50'),_0x571b78['id']);var _0xb9c4b6=util[_0xb9e9('0x29')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x18b0d1[_0xb9e9('0x20')],_[_0xb9e9('0x5e')](_0x571b78['id'],'x')[0x1]);logger[_0xb9e9('0x16')](_0xb9e9('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x1b01f5[_0xb9e9('0x14')]),_0xb9e9('0x5f'),{'uri':_0xb9c4b6});})[_0xb9e9('0x35')](function(_0xe9ca39){logger['error'](_0xb9e9('0x59'),JSON[_0xb9e9('0x25')](_0xe9ca39));});};exports[_0xb9e9('0x60')]=function(_0x111a2d,_0x34d3ad,_0x15d39e,_0x48c2f7,_0x163747,_0x49537d){var _0x5bb8a8,_0x33ebc4,_0x533b69,_0x26eaab;_0x49537d[_0xb9e9('0x20')]=intUtil[_0xb9e9('0x47')](_0x49537d[_0xb9e9('0x20')]);_0x49537d['serverUrl']=intUtil[_0xb9e9('0x47')](_0x49537d[_0xb9e9('0x56')]);if(_0x163747&&_0x163747[_0xb9e9('0x61')]){logger[_0xb9e9('0x16')](_0xb9e9('0x62'),_0xb9e9('0x48'));_0x34d3ad[_0xb9e9('0x49')]=util[_0xb9e9('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49537d['serverUrl'],_0x34d3ad[_0xb9e9('0x4a')],md5(_0x34d3ad[_0xb9e9('0x4a')]));}else{_0x34d3ad[_0xb9e9('0x49')]='';}return getConnection(_0x49537d)[_0xb9e9('0x26')](function(_0x4f484e){_0x26eaab=_0x4f484e;return getUser(_0x49537d,'',_0x26eaab);})[_0xb9e9('0x26')](function(_0x9b4843){_0x5bb8a8=_0x9b4843;logger[_0xb9e9('0x16')]('The\x20User\x20ID\x20is:',_0x5bb8a8['id']);return getEndUser(_0x49537d,_0x34d3ad[_0xb9e9('0x63')],_0x34d3ad[_0xb9e9('0x4c')],_0x26eaab);})[_0xb9e9('0x26')](function(_0x2d7595){_0x33ebc4=_0x2d7595;logger['info'](_0xb9e9('0x4d'),_0x33ebc4['id']);return createTicket(_0x49537d,_0x5bb8a8,_0x33ebc4,_0x15d39e,_0x34d3ad,_0x15d39e['Fields'],_0x26eaab);})[_0xb9e9('0x26')](function(_0x35ae6b){_0x533b69=_0x35ae6b;logger[_0xb9e9('0x16')]('Ticket\x20created!');logger[_0xb9e9('0x16')](_0xb9e9('0x50'),_0x533b69['id']);})[_0xb9e9('0x35')](function(_0x9867e0){logger[_0xb9e9('0x2b')](_0xb9e9('0x62'),JSON['stringify'](_0x9867e0));});}; \ No newline at end of file +var _0x235a=['lastname','Contacts','phone','getEndUser','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','user:%s','Recording\x20is\x20enabled!','recordingURL','[ABANDONED]','lodash','request-promise','bluebird','util','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','length','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','create','admin','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','query','Agent\x20found!','email1','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','username','catch','getUser','Searching\x20end\x20user\x20with\x20phone','GET','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;','firstname'];(function(_0x317c38,_0x9d154d){var _0x304c05=function(_0x27a100){while(--_0x27a100){_0x317c38['push'](_0x317c38['shift']());}};_0x304c05(++_0x9d154d);}(_0x235a,0x1ef));var _0xa235=function(_0x514705,_0x9abce){_0x514705=_0x514705-0x0;var _0x515369=_0x235a[_0x514705];return _0x515369;};'use strict';var _=require(_0xa235('0x0'));var rp=require(_0xa235('0x1'));var BPromise=require(_0xa235('0x2'));var md5=require('md5');var util=require(_0xa235('0x3'));var Redis=require('ioredis');var intUtil=require(_0xa235('0x4'));var config=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));config[_0xa235('0x8')]=_[_0xa235('0x9')](config[_0xa235('0x8')],{'host':_0xa235('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa235('0x8')]));function emit(_0x2dc1ba,_0x450e27,_0x2f3403){io['to'](_0x2dc1ba)['emit'](_0x450e27,_0x2f3403);}function getCustomFields(_0x2f73d3,_0x561602){var _0x560eb1={};if(_0x2f73d3[_0xa235('0xb')]>0x0){_['forEach'](_0x2f73d3,function(_0xbde1c7){if(_0xbde1c7['type']==='string'&&_0xbde1c7['idField']){_0x560eb1[_0xbde1c7[_0xa235('0xc')]]=_0xbde1c7[_0xa235('0xd')][_0xa235('0xe')]();}else if(_0xbde1c7[_0xa235('0xf')]==='variable'&&_0xbde1c7['variableName']&&_0xbde1c7['idField']&&_0x561602[_0xbde1c7[_0xa235('0x10')]]){_0x560eb1[_0xbde1c7[_0xa235('0xc')]]=_0x561602[_0xbde1c7[_0xa235('0x10')]][_0xa235('0xe')]();}else if(_0xbde1c7[_0xa235('0xf')]===_0xa235('0x11')&&_0xbde1c7[_0xa235('0x12')]&&_0xbde1c7[_0xa235('0x12')][_0xa235('0x13')]&&_0xbde1c7['idField']&&_0x561602[_0xbde1c7[_0xa235('0x12')][_0xa235('0x13')][_0xa235('0x14')]()]){_0x560eb1[_0xbde1c7[_0xa235('0xc')]]=_0x561602[_0xbde1c7[_0xa235('0x12')][_0xa235('0x13')]['toLowerCase']()]['toString']();}});}return _0x560eb1;}function createTicket(_0x446ea2,_0x24f9e1,_0x2b3769,_0x4af12b,_0x40b4a9,_0x219e41,_0x3ca514){logger[_0xa235('0x15')](_0xa235('0x16'));var _0x465b55=_[_0xa235('0x17')]({'parent_id':'','assigned_user_id':_0x24f9e1['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil[_0xa235('0x18')](_0x4af12b[_0xa235('0x19')],_0x40b4a9,'\x20'),'description':intUtil[_0xa235('0x18')](_0x4af12b[_0xa235('0x1a')],_0x40b4a9,'\x0a'),'contact_id':_0x2b3769['id']},getCustomFields(_0x219e41,_0x40b4a9));var _0x2e38e={'method':_0xa235('0x1b'),'uri':util[_0xa235('0x1c')](_0xa235('0x1d'),_0x446ea2[_0xa235('0x1e')]),'form':{'operation':_0xa235('0x1f'),'username':_0xa235('0x20'),'sessionName':_0x3ca514[_0xa235('0x21')],'elementType':_0xa235('0x22'),'element':JSON[_0xa235('0x23')](_0x465b55)},'json':!![]};return request(_0x2e38e)[_0xa235('0x24')](function(_0x3364ee){if(_0x3364ee[_0xa235('0x25')]){return BPromise[_0xa235('0x26')]({'id':_0x3364ee[_0xa235('0x27')]['id']});}else{throw new Error(util[_0xa235('0x1c')](_0xa235('0x28'),JSON['stringify'](_0x3364ee[_0xa235('0x29')])));}})['catch'](function(_0x19a673){var _0x53ec70=_0x19a673[_0xa235('0x2a')]||0x1f4;logger[_0xa235('0x29')](_0xa235('0x2b'),_0xa235('0x2c'),_0x53ec70,JSON[_0xa235('0x23')](_0x19a673));});}function getUser(_0x5d811a,_0x2585c7,_0x612f2){if(intUtil['validateEmail'](_0x2585c7)){logger['info']('Getting\x20agent\x20with\x20email',_0x2585c7);return request({'method':'GET','uri':util[_0xa235('0x1c')](_0xa235('0x1d'),_0x5d811a[_0xa235('0x1e')]),'qs':{'operation':_0xa235('0x2d'),'username':_0xa235('0x20'),'sessionName':_0x612f2[_0xa235('0x21')],'query':util[_0xa235('0x1c')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x2585c7)},'json':!![]})['then'](function(_0x2832be){if(_0x2832be[_0xa235('0x25')]&&_0x2832be['result'][_0xa235('0xb')]){logger[_0xa235('0x15')](_0xa235('0x2e'));return BPromise[_0xa235('0x26')]({'id':_0x2832be[_0xa235('0x27')][0x0]['id'],'email':_0x2832be[_0xa235('0x27')][0x0][_0xa235('0x2f')],'name':_0x2832be[_0xa235('0x27')][0x0]['first_name']+'\x20'+_0x2832be[_0xa235('0x27')]['last_name']});}else{logger[_0xa235('0x15')](_0xa235('0x30'));return BPromise[_0xa235('0x26')]({'id':_0x612f2[_0xa235('0x31')],'email':_0x5d811a[_0xa235('0x32')],'name':_0xa235('0x20')});}})[_0xa235('0x33')](function(_0x12a564){var _0xa1b9d2=_0x12a564[_0xa235('0x2a')]||0x1f4;logger[_0xa235('0x29')](_0xa235('0x2b'),_0xa235('0x34'),_0xa1b9d2,JSON['stringify'](_0x12a564));});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xa235('0x26')]({'id':_0x612f2['userId'],'email':_0x5d811a[_0xa235('0x32')],'name':_0xa235('0x20')})[_0xa235('0x33')](function(_0x21a835){var _0x473af7=_0x21a835[_0xa235('0x2a')]||0x1f4;logger[_0xa235('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa235('0x34'),_0x473af7,JSON[_0xa235('0x23')](_0x21a835));});}}function getEndUser(_0x594511,_0x380665,_0x3fa927,_0x1a2bcb){logger[_0xa235('0x15')](_0xa235('0x35'),_0x3fa927);return request({'method':_0xa235('0x36'),'uri':util[_0xa235('0x1c')](_0xa235('0x1d'),_0x594511[_0xa235('0x1e')]),'qs':{'operation':'query','username':_0xa235('0x20'),'sessionName':_0x1a2bcb[_0xa235('0x21')],'query':util[_0xa235('0x1c')](_0xa235('0x37'),_0x3fa927,_0x3fa927,_0x3fa927,_0x3fa927,_0x3fa927)},'json':!![]})[_0xa235('0x24')](function(_0x542755){if(_0x542755[_0xa235('0x25')]&&_0x542755[_0xa235('0x27')][_0xa235('0xb')]){logger[_0xa235('0x15')]('Enduser\x20found!');return BPromise[_0xa235('0x26')]({'id':_0x542755[_0xa235('0x27')][0x0]['id'],'name':_0x542755[_0xa235('0x27')][0x0][_0xa235('0x38')]+'\x20'+_0x542755[_0xa235('0x27')][0x0][_0xa235('0x39')],'phone':_0x3fa927});}else{logger[_0xa235('0x15')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0xa235('0x1b'),'uri':util[_0xa235('0x1c')](_0xa235('0x1d'),_0x594511[_0xa235('0x1e')]),'form':{'operation':_0xa235('0x1f'),'sessionName':_0x1a2bcb['sessionName'],'elementType':_0xa235('0x3a'),'element':JSON[_0xa235('0x23')]({'lastname':_0x380665,'phone':_0x3fa927,'assigned_user_id':'\x20'})},'json':!![]})[_0xa235('0x24')](function(_0x55619c){logger[_0xa235('0x15')]('Enduser\x20created.');return BPromise[_0xa235('0x26')]({'id':_0x55619c[_0xa235('0x27')]['id'],'name':_0x55619c[_0xa235('0x27')][_0xa235('0x39')],'phone':_0x55619c[_0xa235('0x27')][_0xa235('0x3b')]});})[_0xa235('0x33')](function(_0x34ccfd){var _0x4fd2bf=_0x34ccfd[_0xa235('0x2a')]||0x1f4;logger[_0xa235('0x29')](_0xa235('0x2b'),_0xa235('0x3c'),_0x4fd2bf,JSON[_0xa235('0x23')](_0x34ccfd));});}});}function getConnection(_0x461fa3){var _0x248692=_0x461fa3[_0xa235('0x32')];var _0xec860f=_0x461fa3['accessKey'];return request({'method':_0xa235('0x36'),'uri':util[_0xa235('0x1c')](_0xa235('0x1d'),_0x461fa3[_0xa235('0x1e')]),'qs':{'operation':_0xa235('0x3d'),'username':_0x248692},'json':!![]})['then'](function(_0x22f11c){if(_0x22f11c[_0xa235('0x25')]){return request({'method':'POST','uri':util[_0xa235('0x1c')](_0xa235('0x1d'),_0x461fa3[_0xa235('0x1e')]),'form':{'operation':_0xa235('0x3e'),'username':'admin','accessKey':md5(_0x22f11c[_0xa235('0x27')]['token']+_0xec860f)},'json':!![]});}})[_0xa235('0x24')](function(_0x454948){if(_0x454948['success']){return BPromise[_0xa235('0x26')](_0x454948[_0xa235('0x27')]);}else{throw new Error(util[_0xa235('0x1c')](_0xa235('0x3f'),_0x461fa3['id']));}})[_0xa235('0x33')](function(_0x3a24bf){var _0x16105c=_0x3a24bf[_0xa235('0x2a')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x16105c,JSON[_0xa235('0x23')](_0x3a24bf));});}function request(_0x1711a8){logger[_0xa235('0x15')](_0xa235('0x40'),JSON['stringify'](_0x1711a8));return rp(_0x1711a8);}exports[_0xa235('0x41')]=function(_0x5e4a80,_0x1d9ce8,_0x419092,_0x4571fb,_0x1c9f2b,_0x54edb0){var _0x5041f5,_0x51144e,_0x3048ec,_0xb4eabc;_0x54edb0['remoteUri']=intUtil[_0xa235('0x42')](_0x54edb0[_0xa235('0x1e')]);if(_0x1c9f2b&&_0x1c9f2b[_0xa235('0x43')]){logger[_0xa235('0x15')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1d9ce8['recordingURL']=util[_0xa235('0x1c')](_0xa235('0x44'),_0x54edb0['serverUrl'],_0x1d9ce8['uniqueid'],md5(_0x1d9ce8[_0xa235('0x45')]));}else{_0x1d9ce8['recordingURL']='';}return getConnection(_0x54edb0)['then'](function(_0x43fe92){_0xb4eabc=_0x43fe92;return getUser(_0x54edb0,_0x4571fb[_0xa235('0x46')],_0xb4eabc);})[_0xa235('0x24')](function(_0x2b7e0e){_0x5041f5=_0x2b7e0e;logger['info'](_0xa235('0x47'),_0x5041f5['id']);return getEndUser(_0x54edb0,_0x1d9ce8[_0xa235('0x48')],_0x1d9ce8[_0xa235('0x49')],_0xb4eabc);})[_0xa235('0x24')](function(_0x411ce6){_0x51144e=_0x411ce6;logger[_0xa235('0x15')](_0xa235('0x4a'),_0x51144e['id']);return createTicket(_0x54edb0,_0x5041f5,_0x51144e,_0x419092,_0x1d9ce8,_0x419092[_0xa235('0x4b')],_0xb4eabc);})[_0xa235('0x24')](function(_0x7917a5){_0x3048ec=_0x7917a5;logger['info'](_0xa235('0x4c'));logger[_0xa235('0x15')](_0xa235('0x4d'),_0x3048ec['id']);var _0x175431=util[_0xa235('0x1c')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x54edb0[_0xa235('0x1e')],_[_0xa235('0x4e')](_0x3048ec['id'],'x')[0x1]);logger['info'](_0xa235('0x4f'),_0xa235('0x50'));emit(util['format']('user:%s',_0x4571fb['name']),_0xa235('0x51'),{'uri':_0x175431});})[_0xa235('0x33')](function(_0x55392a){logger[_0xa235('0x29')]('[QUEUE]',JSON['stringify'](_0x55392a));});};exports[_0xa235('0x52')]=function(_0x557a31,_0x36b410,_0x412b21,_0x40ea0e,_0x234cd9,_0x1e42c5,_0x4453ea){var _0x2fb64c,_0x2eccb4,_0x38fe49,_0xa7749a;_0x1e42c5[_0xa235('0x1e')]=intUtil[_0xa235('0x42')](_0x1e42c5[_0xa235('0x1e')]);_0x1e42c5[_0xa235('0x53')]=intUtil[_0xa235('0x42')](_0x1e42c5[_0xa235('0x53')]);if(_0x4453ea&&_0x4453ea[_0xa235('0x54')]&&_0x4453ea['recordingFormat']!==_0xa235('0x55')){logger[_0xa235('0x15')](_0xa235('0x56'),'Recording\x20is\x20enabled!');_0x36b410['recordingURL']=util[_0xa235('0x1c')](_0xa235('0x44'),_0x1e42c5[_0xa235('0x53')],_0x36b410['uniqueid'],md5(_0x36b410[_0xa235('0x45')]));}return getConnection(_0x1e42c5)['then'](function(_0x3d45ee){_0xa7749a=_0x3d45ee;return getUser(_0x1e42c5,_0x40ea0e['email'],_0xa7749a);})['then'](function(_0x413436){_0x2fb64c=_0x413436;logger['info']('The\x20User\x20ID\x20is:',_0x2fb64c['id']);return getEndUser(_0x1e42c5,_0x36b410['destcalleridname'],_0x36b410['destcalleridnum'],_0xa7749a);})['then'](function(_0x30003c){_0x2eccb4=_0x30003c;logger[_0xa235('0x15')](_0xa235('0x4a'),_0x2eccb4['id']);return createTicket(_0x1e42c5,_0x2fb64c,_0x2eccb4,_0x412b21,_0x36b410,_0x412b21['Fields'],_0xa7749a);})[_0xa235('0x24')](function(_0x2a426b){_0x38fe49=_0x2a426b;logger[_0xa235('0x15')](_0xa235('0x4c'));logger[_0xa235('0x15')]('The\x20Ticket\x20ID\x20is:',_0x38fe49['id']);var _0x287694=util[_0xa235('0x1c')](_0xa235('0x57'),_0x1e42c5[_0xa235('0x1e')],_[_0xa235('0x4e')](_0x38fe49['id'],'x')[0x1]);logger[_0xa235('0x15')](_0xa235('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xa235('0x58'),_0x40ea0e[_0xa235('0x13')]),_0xa235('0x51'),{'uri':_0x287694});})['catch'](function(_0x3af05a){logger['error'](_0xa235('0x56'),JSON[_0xa235('0x23')](_0x3af05a));});};exports['abandoned']=function(_0x21cfac,_0x450ade,_0x411ec0,_0xf57a53,_0x2043ae,_0x3bf214){var _0x4f1576,_0x154f45,_0x35b07b,_0x2f9889;_0x3bf214[_0xa235('0x1e')]=intUtil[_0xa235('0x42')](_0x3bf214['remoteUri']);_0x3bf214[_0xa235('0x53')]=intUtil[_0xa235('0x42')](_0x3bf214[_0xa235('0x53')]);if(_0x2043ae&&_0x2043ae[_0xa235('0x43')]){logger[_0xa235('0x15')]('[ABANDONED]',_0xa235('0x59'));_0x450ade[_0xa235('0x5a')]=util[_0xa235('0x1c')](_0xa235('0x44'),_0x3bf214[_0xa235('0x53')],_0x450ade[_0xa235('0x45')],md5(_0x450ade['uniqueid']));}else{_0x450ade[_0xa235('0x5a')]='';}return getConnection(_0x3bf214)[_0xa235('0x24')](function(_0x4b7b04){_0x2f9889=_0x4b7b04;return getUser(_0x3bf214,'',_0x2f9889);})[_0xa235('0x24')](function(_0x4f3b5b){_0x4f1576=_0x4f3b5b;logger[_0xa235('0x15')](_0xa235('0x47'),_0x4f1576['id']);return getEndUser(_0x3bf214,_0x450ade['calleridname'],_0x450ade[_0xa235('0x49')],_0x2f9889);})['then'](function(_0x4a7248){_0x154f45=_0x4a7248;logger[_0xa235('0x15')](_0xa235('0x4a'),_0x154f45['id']);return createTicket(_0x3bf214,_0x4f1576,_0x154f45,_0x411ec0,_0x450ade,_0x411ec0[_0xa235('0x4b')],_0x2f9889);})[_0xa235('0x24')](function(_0x14046f){_0x35b07b=_0x14046f;logger[_0xa235('0x15')](_0xa235('0x4c'));logger[_0xa235('0x15')](_0xa235('0x4d'),_0x35b07b['id']);})['catch'](function(_0x2845a0){logger['error'](_0xa235('0x5b'),JSON[_0xa235('0x23')](_0x2845a0));});}; \ 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 a6402be..0b2cc88 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 _0x70aa=['forEach','type','string','nameField','customField','toLowerCase','content','toString','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','abandoned','[ABANDONED]','calleridname','calleridnum','request-promise','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','base64','[HTTP]','stringify','length','map'];(function(_0x2e227b,_0x704280){var _0x27faf4=function(_0x508464){while(--_0x508464){_0x2e227b['push'](_0x2e227b['shift']());}};_0x27faf4(++_0x704280);}(_0x70aa,0x178));var _0xa70a=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0x70aa[_0x3f2fea];return _0x69a4d5;};'use strict';var _=require('lodash');var rp=require(_0xa70a('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xa70a('0x1'));var logger=require(_0xa70a('0x2'))(_0xa70a('0x3'));config[_0xa70a('0x4')]=_[_0xa70a('0x5')](config[_0xa70a('0x4')],{'host':_0xa70a('0x6'),'port':0x18eb});var io=require(_0xa70a('0x7'))(new Redis(config[_0xa70a('0x4')]));function emit(_0x306844,_0x256df9,_0x5c866c){io['to'](_0x306844)[_0xa70a('0x8')](_0x256df9,_0x5c866c);}var headers={'Content-Type':'application/json','Accept':_0xa70a('0x9')};function getTicket(_0x507c86,_0x4975ec,_0x3580fd,_0x498bef,_0x2e4413){logger[_0xa70a('0xa')](_0xa70a('0xb'));return request({'uri':util[_0xa70a('0xc')]('%s/tickets.json',_0x507c86[_0xa70a('0xd')]),'method':_0xa70a('0xe'),'body':{'ticket':_[_0xa70a('0xf')]({'requester_id':_0x3580fd['id'],'submitter_id':_0x4975ec?_0x4975ec['id']:undefined,'assignee_id':_0x4975ec?_0x4975ec['id']:undefined,'tags':getTags(_0x498bef[_0xa70a('0x10')],_0xa70a('0x11')),'subject':intUtil[_0xa70a('0x12')](_0x498bef[_0xa70a('0x13')],_0x2e4413,'\x20'),'description':intUtil[_0xa70a('0x12')](_0x498bef[_0xa70a('0x14')],_0x2e4413,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x498bef[_0xa70a('0x14')],_0x2e4413,'\x0a')}},getCustomFields(_0x498bef[_0xa70a('0x15')],_0x2e4413))}})[_0xa70a('0x16')](function(_0x4388f3){logger['info']('Ticket\x20created!');return _0x4388f3[_0xa70a('0x17')];});}function getUser(_0x61f585,_0x3ec9d5){if(intUtil['validateEmail'](_0x3ec9d5)){logger[_0xa70a('0xa')](_0xa70a('0x18'),_0x3ec9d5);return request({'uri':util[_0xa70a('0xc')](_0xa70a('0x19'),_0x61f585['remoteUri']),'qs':{'query':util[_0xa70a('0xc')](_0xa70a('0x1a'),_0x3ec9d5)}})[_0xa70a('0x16')](function(_0x2cfd55){if(_0x2cfd55[_0xa70a('0x1b')]){logger[_0xa70a('0xa')](_0xa70a('0x1c'));return _[_0xa70a('0x1d')](_0x2cfd55['results'],{'email':_0x3ec9d5,'role':_0xa70a('0x1e')});}else{logger[_0xa70a('0xa')](_0xa70a('0x1f'));return request({'uri':util[_0xa70a('0xc')](_0xa70a('0x20'),_0x61f585[_0xa70a('0xd')])})[_0xa70a('0x16')](function(_0x229e64){logger[_0xa70a('0xa')](_0xa70a('0x21'));return _0x229e64[_0xa70a('0x22')];});}});}else{logger[_0xa70a('0xa')](_0xa70a('0x1f'));return request({'uri':util['format'](_0xa70a('0x20'),_0x61f585['remoteUri'])})[_0xa70a('0x16')](function(_0x3b38a7){logger['info'](_0xa70a('0x21'));return _0x3b38a7['user'];});}}function getEndUser(_0x207644,_0x3694d0,_0x45d19c){logger[_0xa70a('0xa')](_0xa70a('0x23'),_0x45d19c);return request({'uri':util['format'](_0xa70a('0x19'),_0x207644['remoteUri']),'qs':{'query':util[_0xa70a('0xc')](_0xa70a('0x24'),_0x45d19c)}})['then'](function(_0x4eb54d){var _0x280c94;if(_0x4eb54d['results']['length']){_0x4eb54d[_0xa70a('0x25')]=_[_0xa70a('0x26')](_0x4eb54d[_0xa70a('0x25')],{'suspended':![],'role':_0xa70a('0x27')});if(_0x4eb54d[_0xa70a('0x25')]['length']){_0x280c94=_[_0xa70a('0x28')](_0x4eb54d[_0xa70a('0x25')]);}}if(_0x280c94){logger[_0xa70a('0xa')](_0xa70a('0x29'));return _0x280c94;}else{logger[_0xa70a('0xa')](_0xa70a('0x2a'));return request({'uri':util['format']('%s/users.json',_0x207644[_0xa70a('0xd')]),'method':_0xa70a('0xe'),'body':{'user':{'role':_0xa70a('0x27'),'name':util['format'](_0xa70a('0x2b'),_0x3694d0||_0x45d19c),'phone':_0x45d19c}}})[_0xa70a('0x16')](function(_0x4a90d5){logger[_0xa70a('0xa')](_0xa70a('0x2c'));return _0x4a90d5[_0xa70a('0x22')];});}});}function getAuth(_0x1cb0da){var _0x4c81e2;if(_0x1cb0da[_0xa70a('0x2d')]===_0xa70a('0x2e')){_0x4c81e2=util['format'](_0xa70a('0x2f'),_0x1cb0da[_0xa70a('0x30')],_0x1cb0da[_0xa70a('0x2e')]);}else if(_0x1cb0da[_0xa70a('0x2d')]===_0xa70a('0x31')){_0x4c81e2=util[_0xa70a('0xc')]('%s/token:%s',_0x1cb0da[_0xa70a('0x30')],_0x1cb0da['token']);}return util['format'](_0xa70a('0x32'),new Buffer(_0x4c81e2)['toString'](_0xa70a('0x33')));}function request(_0x27c044){logger['debug'](_0xa70a('0x34'),JSON[_0xa70a('0x35')](_0x27c044));return rp(_['defaults'](_0x27c044,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3e555f,_0x4dfa15){var _0x43a720=[];if(_0x3e555f&&_0x3e555f[_0xa70a('0x36')]>0x0){_0x43a720=_[_0xa70a('0x37')](_0x3e555f,_0x4dfa15);}return _0x43a720;}function getCustomFields(_0x427e5d,_0x3f365f){var _0x446a2=[];var _0x34376d={'custom_fields':[]};if(_0x427e5d['length']>0x0){_[_0xa70a('0x38')](_0x427e5d,function(_0x3e9ea4){if(_0x3e9ea4[_0xa70a('0x39')]===_0xa70a('0x3a')&&_0x3e9ea4[_0xa70a('0x3b')]&&!_0x3e9ea4[_0xa70a('0x3c')]){_0x34376d[_0x3e9ea4[_0xa70a('0x3b')][_0xa70a('0x3d')]()]=_0x3e9ea4[_0xa70a('0x3e')][_0xa70a('0x3f')]();}else if(_0x3e9ea4[_0xa70a('0x39')]===_0xa70a('0x3a')&&_0x3e9ea4[_0xa70a('0x40')]&&_0x3e9ea4[_0xa70a('0x3c')]){_0x34376d[_0xa70a('0x41')][_0xa70a('0x42')]({'id':_0x3e9ea4[_0xa70a('0x40')],'value':_0x3e9ea4[_0xa70a('0x3e')][_0xa70a('0x3f')]()});}else if(_0x3e9ea4[_0xa70a('0x39')]===_0xa70a('0x43')&&_0x3e9ea4[_0xa70a('0x44')]&&_0x3e9ea4[_0xa70a('0x40')]&&_0x3e9ea4[_0xa70a('0x3c')]){_0x3f365f[_0x3e9ea4[_0xa70a('0x44')]]&&_0x34376d[_0xa70a('0x41')][_0xa70a('0x42')]({'id':_0x3e9ea4['idField'],'value':_0x3f365f[_0x3e9ea4[_0xa70a('0x44')]]['toString']()});}else if(_0x3e9ea4[_0xa70a('0x39')]===_0xa70a('0x45')&&_0x3e9ea4[_0xa70a('0x46')]&&_0x3e9ea4['Variable']['name']&&_0x3e9ea4[_0xa70a('0x40')]&&_0x3e9ea4[_0xa70a('0x3c')]){_0x3f365f[_0x3e9ea4['Variable'][_0xa70a('0x11')][_0xa70a('0x3d')]()]&&_0x34376d[_0xa70a('0x41')][_0xa70a('0x42')]({'id':_0x3e9ea4[_0xa70a('0x40')],'value':_0x3f365f[_0x3e9ea4[_0xa70a('0x46')][_0xa70a('0x11')][_0xa70a('0x3d')]()][_0xa70a('0x3f')]()});}});}return _0x34376d;}exports[_0xa70a('0x47')]=function(_0x467022,_0x6c7299,_0x554dfc,_0x2e9bb0,_0x39c264,_0xbdfdf1){var _0x1eb2ef,_0x1061df;_0xbdfdf1[_0xa70a('0xd')]=intUtil[_0xa70a('0x48')](_0xbdfdf1[_0xa70a('0xd')]);_0xbdfdf1['serverUrl']=intUtil[_0xa70a('0x48')](_0xbdfdf1['serverUrl']);if(_0x39c264&&_0x39c264[_0xa70a('0x49')]){logger[_0xa70a('0xa')](_0xa70a('0x4a'),_0xa70a('0x4b'));_0x6c7299['recordingURL']=util[_0xa70a('0xc')](_0xa70a('0x4c'),_0xbdfdf1[_0xa70a('0x4d')],_0x6c7299['uniqueid'],md5(_0x6c7299[_0xa70a('0x4e')]));}else{_0x6c7299[_0xa70a('0x4f')]='';}headers[_0xa70a('0x50')]=getAuth(_0xbdfdf1);return getUser(_0xbdfdf1,_0x2e9bb0['email'])['then'](function(_0x182bfc){_0x1eb2ef=_0x182bfc;logger[_0xa70a('0xa')](_0xa70a('0x51'),_0x1eb2ef['id']);return getEndUser(_0xbdfdf1,_0x6c7299['calleridname'],_0x6c7299['calleridnum']);})[_0xa70a('0x16')](function(_0x52dca7){_0x1061df=_0x52dca7;logger[_0xa70a('0xa')](_0xa70a('0x52'),_0x1061df['id']);return getTicket(_0xbdfdf1,_0x1eb2ef,_0x1061df,_0x554dfc,_0x6c7299);})[_0xa70a('0x16')](function(_0x2f4190){if(_0x2f4190){logger[_0xa70a('0xa')](_0xa70a('0x53'),_0x2f4190['id']);switch(_0xbdfdf1[_0xa70a('0x39')]){case _0xa70a('0x54'):logger[_0xa70a('0xa')](_0xa70a('0x4a'),_0xa70a('0x55'));return request({'uri':util[_0xa70a('0xc')](_0xa70a('0x56'),_0xbdfdf1[_0xa70a('0xd')],_0x1eb2ef['id'],_0x2f4190['id']),'method':'POST'});case _0xa70a('0x57'):logger[_0xa70a('0xa')](_0xa70a('0x4a'),_0xa70a('0x58'));emit(util[_0xa70a('0xc')](_0xa70a('0x59'),_0x2e9bb0['name']),_0xa70a('0x5a'),{'uri':util[_0xa70a('0xc')](_0xa70a('0x5b'),_0xbdfdf1['remoteUri'],_0x2f4190['id'])});break;default:logger[_0xa70a('0x5c')](_0xa70a('0x4a'),_0xa70a('0x5d'));}}})[_0xa70a('0x5e')](function(_0x27fb77){logger['error'](_0xa70a('0x5f'),util['inspect'](_0x27fb77,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x3af935,_0x395eaf,_0x1a106e,_0x130ca2,_0x5503df,_0x1de1e4,_0x2ea738){var _0x1d7fa1,_0x707564;_0x1de1e4[_0xa70a('0xd')]=intUtil[_0xa70a('0x48')](_0x1de1e4['remoteUri']);_0x1de1e4['serverUrl']=intUtil[_0xa70a('0x48')](_0x1de1e4[_0xa70a('0x4d')]);if(_0x2ea738&&_0x2ea738[_0xa70a('0x60')]&&_0x2ea738[_0xa70a('0x60')]!==_0xa70a('0x61')){logger['info'](_0xa70a('0x62'),_0xa70a('0x4b'));_0x395eaf[_0xa70a('0x4f')]=util['format'](_0xa70a('0x4c'),_0x1de1e4['serverUrl'],_0x395eaf['uniqueid'],md5(_0x395eaf[_0xa70a('0x4e')]));}headers[_0xa70a('0x50')]=getAuth(_0x1de1e4);return getUser(_0x1de1e4,_0x130ca2[_0xa70a('0x63')])['then'](function(_0x311824){_0x1d7fa1=_0x311824;logger[_0xa70a('0xa')](_0xa70a('0x51'),_0x1d7fa1['id']);return getEndUser(_0x1de1e4,_0x395eaf[_0xa70a('0x64')],_0x395eaf[_0xa70a('0x65')]);})[_0xa70a('0x16')](function(_0x28a959){_0x707564=_0x28a959;logger[_0xa70a('0xa')](_0xa70a('0x52'),_0x707564['id']);return getTicket(_0x1de1e4,_0x1d7fa1,_0x707564,_0x1a106e,_0x395eaf);})[_0xa70a('0x16')](function(_0x1a1a9f){if(_0x1a1a9f){logger[_0xa70a('0xa')](_0xa70a('0x53'),_0x1a1a9f['id']);switch(_0x1de1e4[_0xa70a('0x39')]){case _0xa70a('0x54'):logger[_0xa70a('0xa')](_0xa70a('0x62'),_0xa70a('0x55'));return request({'uri':util[_0xa70a('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1de1e4['remoteUri'],_0x1d7fa1['id'],_0x1a1a9f['id']),'method':_0xa70a('0xe')});case _0xa70a('0x57'):logger[_0xa70a('0xa')](_0xa70a('0x62'),_0xa70a('0x58'));emit(util[_0xa70a('0xc')](_0xa70a('0x59'),_0x130ca2['name']),_0xa70a('0x5a'),{'uri':util[_0xa70a('0xc')](_0xa70a('0x5b'),_0x1de1e4[_0xa70a('0xd')],_0x1a1a9f['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xa70a('0x5e')](function(_0x152002){logger[_0xa70a('0x5c')](_0xa70a('0x66'),util[_0xa70a('0x67')](_0x152002,{'showHidden':!![],'depth':null}));});};exports[_0xa70a('0x68')]=function(_0x4f8f76,_0x2c0968,_0x39d9d7,_0x5843b6,_0x539f8c,_0x3e40ab){var _0x9392f0,_0x1197bc;_0x3e40ab[_0xa70a('0xd')]=intUtil[_0xa70a('0x48')](_0x3e40ab[_0xa70a('0xd')]);_0x3e40ab[_0xa70a('0x4d')]=intUtil['stripTrailingSlash'](_0x3e40ab[_0xa70a('0x4d')]);if(_0x539f8c&&_0x539f8c[_0xa70a('0x49')]){logger[_0xa70a('0xa')](_0xa70a('0x69'),_0xa70a('0x4b'));_0x2c0968[_0xa70a('0x4f')]=util[_0xa70a('0xc')](_0xa70a('0x4c'),_0x3e40ab['serverUrl'],_0x2c0968['uniqueid'],md5(_0x2c0968[_0xa70a('0x4e')]));}else{_0x2c0968[_0xa70a('0x4f')]='';}headers[_0xa70a('0x50')]=getAuth(_0x3e40ab);return getUser(_0x3e40ab)['then'](function(_0x197a48){_0x9392f0=_0x197a48;logger['info'](_0xa70a('0x51'),_0x9392f0['id']);return getEndUser(_0x3e40ab,_0x2c0968[_0xa70a('0x6a')],_0x2c0968[_0xa70a('0x6b')]);})['then'](function(_0x254445){_0x1197bc=_0x254445;logger[_0xa70a('0xa')](_0xa70a('0x52'),_0x1197bc['id']);return getTicket(_0x3e40ab,_0x9392f0,_0x1197bc,_0x39d9d7,_0x2c0968);})[_0xa70a('0x16')](function(_0xd48aa5){if(_0xd48aa5){logger[_0xa70a('0xa')](_0xa70a('0x53'),_0xd48aa5['id']);}})[_0xa70a('0x5e')](function(_0x23b039){logger[_0xa70a('0x5c')]('[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration',util[_0xa70a('0x67')](_0x23b039,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xaf7a=['stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','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...','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','error','inspect','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','user:%s','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','name','Subjects','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','variableName','customVariable','Variable','push'];(function(_0x2747b2,_0x10dce8){var _0x540db0=function(_0xc33bcd){while(--_0xc33bcd){_0x2747b2['push'](_0x2747b2['shift']());}};_0x540db0(++_0x10dce8);}(_0xaf7a,0x8e));var _0xaaf7=function(_0x5ab468,_0x23f21e){_0x5ab468=_0x5ab468-0x0;var _0x2e98f5=_0xaf7a[_0x5ab468];return _0x2e98f5;};'use strict';var _=require(_0xaaf7('0x0'));var rp=require(_0xaaf7('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xaaf7('0x2'));var intUtil=require(_0xaaf7('0x3'));var config=require(_0xaaf7('0x4'));var logger=require(_0xaaf7('0x5'))(_0xaaf7('0x6'));config[_0xaaf7('0x7')]=_[_0xaaf7('0x8')](config[_0xaaf7('0x7')],{'host':_0xaaf7('0x9'),'port':0x18eb});var io=require(_0xaaf7('0xa'))(new Redis(config[_0xaaf7('0x7')]));function emit(_0x5ca350,_0x45e07c,_0x3154df){io['to'](_0x5ca350)[_0xaaf7('0xb')](_0x45e07c,_0x3154df);}var headers={'Content-Type':'application/json','Accept':_0xaaf7('0xc')};function getTicket(_0x4ba802,_0x10d155,_0x5a7c1c,_0x3590c9,_0x126023){logger[_0xaaf7('0xd')](_0xaaf7('0xe'));return request({'uri':util[_0xaaf7('0xf')](_0xaaf7('0x10'),_0x4ba802[_0xaaf7('0x11')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x5a7c1c['id'],'submitter_id':_0x10d155?_0x10d155['id']:undefined,'assignee_id':_0x10d155?_0x10d155['id']:undefined,'tags':getTags(_0x3590c9[_0xaaf7('0x12')],_0xaaf7('0x13')),'subject':intUtil['getString'](_0x3590c9[_0xaaf7('0x14')],_0x126023,'\x20'),'description':intUtil[_0xaaf7('0x15')](_0x3590c9[_0xaaf7('0x16')],_0x126023,'\x0a'),'comment':{'public':![],'body':intUtil[_0xaaf7('0x15')](_0x3590c9['Descriptions'],_0x126023,'\x0a')}},getCustomFields(_0x3590c9['Fields'],_0x126023))}})[_0xaaf7('0x17')](function(_0x3e9898){logger[_0xaaf7('0xd')](_0xaaf7('0x18'));return _0x3e9898[_0xaaf7('0x19')];});}function getUser(_0x100b1a,_0x4886b8){if(intUtil[_0xaaf7('0x1a')](_0x4886b8)){logger[_0xaaf7('0xd')]('Getting\x20agent\x20with\x20email',_0x4886b8);return request({'uri':util[_0xaaf7('0xf')](_0xaaf7('0x1b'),_0x100b1a['remoteUri']),'qs':{'query':util[_0xaaf7('0xf')](_0xaaf7('0x1c'),_0x4886b8)}})[_0xaaf7('0x17')](function(_0x332f4c){if(_0x332f4c['count']){logger[_0xaaf7('0xd')]('Agent\x20found!');return _[_0xaaf7('0x1d')](_0x332f4c[_0xaaf7('0x1e')],{'email':_0x4886b8,'role':_0xaaf7('0x1f')});}else{logger['info'](_0xaaf7('0x20'));return request({'uri':util[_0xaaf7('0xf')](_0xaaf7('0x21'),_0x100b1a[_0xaaf7('0x11')])})['then'](function(_0x199b41){logger[_0xaaf7('0xd')](_0xaaf7('0x22'));return _0x199b41[_0xaaf7('0x23')];});}});}else{logger[_0xaaf7('0xd')](_0xaaf7('0x20'));return request({'uri':util[_0xaaf7('0xf')](_0xaaf7('0x21'),_0x100b1a[_0xaaf7('0x11')])})['then'](function(_0x11526f){logger[_0xaaf7('0xd')](_0xaaf7('0x22'));return _0x11526f['user'];});}}function getEndUser(_0x53d04d,_0x2f9fb2,_0x56835b){logger[_0xaaf7('0xd')](_0xaaf7('0x24'),_0x56835b);return request({'uri':util[_0xaaf7('0xf')](_0xaaf7('0x1b'),_0x53d04d['remoteUri']),'qs':{'query':util[_0xaaf7('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x56835b)}})[_0xaaf7('0x17')](function(_0x57b45e){var _0x20cae2;if(_0x57b45e[_0xaaf7('0x1e')][_0xaaf7('0x25')]){_0x57b45e[_0xaaf7('0x1e')]=_[_0xaaf7('0x26')](_0x57b45e['results'],{'suspended':![],'role':_0xaaf7('0x27')});if(_0x57b45e[_0xaaf7('0x1e')][_0xaaf7('0x25')]){_0x20cae2=_[_0xaaf7('0x28')](_0x57b45e['results']);}}if(_0x20cae2){logger['info'](_0xaaf7('0x29'));return _0x20cae2;}else{logger[_0xaaf7('0xd')](_0xaaf7('0x2a'));return request({'uri':util['format'](_0xaaf7('0x2b'),_0x53d04d[_0xaaf7('0x11')]),'method':_0xaaf7('0x2c'),'body':{'user':{'role':_0xaaf7('0x27'),'name':util['format'](_0xaaf7('0x2d'),_0x2f9fb2||_0x56835b),'phone':_0x56835b}}})[_0xaaf7('0x17')](function(_0x27b3e1){logger['info'](_0xaaf7('0x2e'));return _0x27b3e1[_0xaaf7('0x23')];});}});}function getAuth(_0x505664){var _0x18dfc1;if(_0x505664['authType']===_0xaaf7('0x2f')){_0x18dfc1=util[_0xaaf7('0xf')](_0xaaf7('0x30'),_0x505664[_0xaaf7('0x31')],_0x505664[_0xaaf7('0x2f')]);}else if(_0x505664[_0xaaf7('0x32')]===_0xaaf7('0x33')){_0x18dfc1=util['format'](_0xaaf7('0x34'),_0x505664['username'],_0x505664[_0xaaf7('0x33')]);}return util[_0xaaf7('0xf')](_0xaaf7('0x35'),new Buffer(_0x18dfc1)[_0xaaf7('0x36')](_0xaaf7('0x37')));}function request(_0x4a25f1){logger[_0xaaf7('0x38')](_0xaaf7('0x39'),JSON[_0xaaf7('0x3a')](_0x4a25f1));return rp(_[_0xaaf7('0x8')](_0x4a25f1,{'method':_0xaaf7('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x44e98c,_0x16983b){var _0x14756d=[];if(_0x44e98c&&_0x44e98c[_0xaaf7('0x25')]>0x0){_0x14756d=_[_0xaaf7('0x3c')](_0x44e98c,_0x16983b);}return _0x14756d;}function getCustomFields(_0x458b4a,_0x424efd){var _0x378ba3=[];var _0x3a84fb={'custom_fields':[]};if(_0x458b4a[_0xaaf7('0x25')]>0x0){_[_0xaaf7('0x3d')](_0x458b4a,function(_0x38c56f){if(_0x38c56f[_0xaaf7('0x3e')]===_0xaaf7('0x3f')&&_0x38c56f[_0xaaf7('0x40')]&&!_0x38c56f[_0xaaf7('0x41')]){_0x3a84fb[_0x38c56f[_0xaaf7('0x40')][_0xaaf7('0x42')]()]=_0x38c56f[_0xaaf7('0x43')][_0xaaf7('0x36')]();}else if(_0x38c56f[_0xaaf7('0x3e')]===_0xaaf7('0x3f')&&_0x38c56f[_0xaaf7('0x44')]&&_0x38c56f[_0xaaf7('0x41')]){_0x3a84fb[_0xaaf7('0x45')]['push']({'id':_0x38c56f['idField'],'value':_0x38c56f[_0xaaf7('0x43')][_0xaaf7('0x36')]()});}else if(_0x38c56f[_0xaaf7('0x3e')]==='variable'&&_0x38c56f[_0xaaf7('0x46')]&&_0x38c56f[_0xaaf7('0x44')]&&_0x38c56f[_0xaaf7('0x41')]){_0x424efd[_0x38c56f['variableName']]&&_0x3a84fb[_0xaaf7('0x45')]['push']({'id':_0x38c56f[_0xaaf7('0x44')],'value':_0x424efd[_0x38c56f[_0xaaf7('0x46')]][_0xaaf7('0x36')]()});}else if(_0x38c56f[_0xaaf7('0x3e')]===_0xaaf7('0x47')&&_0x38c56f[_0xaaf7('0x48')]&&_0x38c56f['Variable'][_0xaaf7('0x13')]&&_0x38c56f['idField']&&_0x38c56f[_0xaaf7('0x41')]){_0x424efd[_0x38c56f[_0xaaf7('0x48')][_0xaaf7('0x13')][_0xaaf7('0x42')]()]&&_0x3a84fb[_0xaaf7('0x45')][_0xaaf7('0x49')]({'id':_0x38c56f[_0xaaf7('0x44')],'value':_0x424efd[_0x38c56f['Variable'][_0xaaf7('0x13')][_0xaaf7('0x42')]()][_0xaaf7('0x36')]()});}});}return _0x3a84fb;}exports['queue']=function(_0x7c33ad,_0xff4815,_0x3806ea,_0x2a7f88,_0x101af7,_0x5e2836){var _0x116c74,_0x39eb70;_0x5e2836[_0xaaf7('0x11')]=intUtil[_0xaaf7('0x4a')](_0x5e2836['remoteUri']);_0x5e2836[_0xaaf7('0x4b')]=intUtil[_0xaaf7('0x4a')](_0x5e2836[_0xaaf7('0x4b')]);if(_0x101af7&&_0x101af7[_0xaaf7('0x4c')]){logger[_0xaaf7('0xd')](_0xaaf7('0x4d'),_0xaaf7('0x4e'));_0xff4815[_0xaaf7('0x4f')]=util[_0xaaf7('0xf')](_0xaaf7('0x50'),_0x5e2836[_0xaaf7('0x4b')],_0xff4815[_0xaaf7('0x51')],md5(_0xff4815[_0xaaf7('0x51')]));}else{_0xff4815[_0xaaf7('0x4f')]='';}headers[_0xaaf7('0x52')]=getAuth(_0x5e2836);return getUser(_0x5e2836,_0x2a7f88['email'])[_0xaaf7('0x17')](function(_0x379a48){_0x116c74=_0x379a48;logger['info'](_0xaaf7('0x53'),_0x116c74['id']);return getEndUser(_0x5e2836,_0xff4815[_0xaaf7('0x54')],_0xff4815[_0xaaf7('0x55')]);})[_0xaaf7('0x17')](function(_0x7d4b6d){_0x39eb70=_0x7d4b6d;logger[_0xaaf7('0xd')](_0xaaf7('0x56'),_0x39eb70['id']);return getTicket(_0x5e2836,_0x116c74,_0x39eb70,_0x3806ea,_0xff4815);})[_0xaaf7('0x17')](function(_0x501941){if(_0x501941){logger[_0xaaf7('0xd')](_0xaaf7('0x57'),_0x501941['id']);switch(_0x5e2836[_0xaaf7('0x3e')]){case _0xaaf7('0x58'):logger['info'](_0xaaf7('0x4d'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xaaf7('0x59'),_0x5e2836[_0xaaf7('0x11')],_0x116c74['id'],_0x501941['id']),'method':_0xaaf7('0x2c')});case _0xaaf7('0x5a'):logger['info'](_0xaaf7('0x4d'),_0xaaf7('0x5b'));emit(util[_0xaaf7('0xf')]('user:%s',_0x2a7f88[_0xaaf7('0x13')]),_0xaaf7('0x5c'),{'uri':util[_0xaaf7('0xf')](_0xaaf7('0x5d'),_0x5e2836[_0xaaf7('0x11')],_0x501941['id'])});break;default:logger['error'](_0xaaf7('0x4d'),_0xaaf7('0x5e'));}}})['catch'](function(_0x21a97c){logger[_0xaaf7('0x5f')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xaaf7('0x60')](_0x21a97c,{'showHidden':!![],'depth':null}));});};exports[_0xaaf7('0x61')]=function(_0x549801,_0x3d491e,_0x23cf19,_0x2de6f6,_0xb3789d,_0x1f5c5b,_0xd30790){var _0x48a1f9,_0x1af4c3;_0x1f5c5b[_0xaaf7('0x11')]=intUtil[_0xaaf7('0x4a')](_0x1f5c5b[_0xaaf7('0x11')]);_0x1f5c5b['serverUrl']=intUtil[_0xaaf7('0x4a')](_0x1f5c5b[_0xaaf7('0x4b')]);if(_0xd30790&&_0xd30790[_0xaaf7('0x62')]&&_0xd30790[_0xaaf7('0x62')]!==_0xaaf7('0x63')){logger[_0xaaf7('0xd')](_0xaaf7('0x64'),_0xaaf7('0x4e'));_0x3d491e[_0xaaf7('0x4f')]=util[_0xaaf7('0xf')](_0xaaf7('0x50'),_0x1f5c5b[_0xaaf7('0x4b')],_0x3d491e['uniqueid'],md5(_0x3d491e[_0xaaf7('0x51')]));}headers[_0xaaf7('0x52')]=getAuth(_0x1f5c5b);return getUser(_0x1f5c5b,_0x2de6f6[_0xaaf7('0x65')])[_0xaaf7('0x17')](function(_0x3b73f3){_0x48a1f9=_0x3b73f3;logger[_0xaaf7('0xd')]('The\x20User\x20ID\x20is:',_0x48a1f9['id']);return getEndUser(_0x1f5c5b,_0x3d491e[_0xaaf7('0x66')],_0x3d491e['destcalleridnum']);})[_0xaaf7('0x17')](function(_0x50865b){_0x1af4c3=_0x50865b;logger[_0xaaf7('0xd')](_0xaaf7('0x56'),_0x1af4c3['id']);return getTicket(_0x1f5c5b,_0x48a1f9,_0x1af4c3,_0x23cf19,_0x3d491e);})[_0xaaf7('0x17')](function(_0x1cb47b){if(_0x1cb47b){logger[_0xaaf7('0xd')](_0xaaf7('0x57'),_0x1cb47b['id']);switch(_0x1f5c5b['type']){case'integrationTab':logger[_0xaaf7('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xaaf7('0xf')](_0xaaf7('0x59'),_0x1f5c5b[_0xaaf7('0x11')],_0x48a1f9['id'],_0x1cb47b['id']),'method':_0xaaf7('0x2c')});case _0xaaf7('0x5a'):logger['info'](_0xaaf7('0x64'),_0xaaf7('0x5b'));emit(util['format'](_0xaaf7('0x67'),_0x2de6f6['name']),'trigger:browser:url',{'uri':util[_0xaaf7('0xf')](_0xaaf7('0x5d'),_0x1f5c5b[_0xaaf7('0x11')],_0x1cb47b['id'])});break;default:logger[_0xaaf7('0x5f')](_0xaaf7('0x64'),_0xaaf7('0x5e'));}}})[_0xaaf7('0x68')](function(_0x1039a7){logger[_0xaaf7('0x5f')](_0xaaf7('0x69'),util[_0xaaf7('0x60')](_0x1039a7,{'showHidden':!![],'depth':null}));});};exports['abandoned']=function(_0x5a1c02,_0x530e84,_0x55bbd6,_0x4dbc1e,_0x3ef7c9,_0x2d0a6f){var _0x15abda,_0x3c160d;_0x2d0a6f[_0xaaf7('0x11')]=intUtil[_0xaaf7('0x4a')](_0x2d0a6f[_0xaaf7('0x11')]);_0x2d0a6f[_0xaaf7('0x4b')]=intUtil[_0xaaf7('0x4a')](_0x2d0a6f[_0xaaf7('0x4b')]);if(_0x3ef7c9&&_0x3ef7c9[_0xaaf7('0x4c')]){logger['info'](_0xaaf7('0x6a'),'Recording\x20is\x20enabled!');_0x530e84[_0xaaf7('0x4f')]=util[_0xaaf7('0xf')](_0xaaf7('0x50'),_0x2d0a6f[_0xaaf7('0x4b')],_0x530e84[_0xaaf7('0x51')],md5(_0x530e84[_0xaaf7('0x51')]));}else{_0x530e84[_0xaaf7('0x4f')]='';}headers['Authorization']=getAuth(_0x2d0a6f);return getUser(_0x2d0a6f)['then'](function(_0x5ee6e1){_0x15abda=_0x5ee6e1;logger['info'](_0xaaf7('0x53'),_0x15abda['id']);return getEndUser(_0x2d0a6f,_0x530e84[_0xaaf7('0x54')],_0x530e84[_0xaaf7('0x55')]);})[_0xaaf7('0x17')](function(_0x2fa2d0){_0x3c160d=_0x2fa2d0;logger[_0xaaf7('0xd')](_0xaaf7('0x56'),_0x3c160d['id']);return getTicket(_0x2d0a6f,_0x15abda,_0x3c160d,_0x55bbd6,_0x530e84);})[_0xaaf7('0x17')](function(_0x24d039){if(_0x24d039){logger[_0xaaf7('0xd')]('The\x20Ticket\x20ID\x20is:',_0x24d039['id']);}})[_0xaaf7('0x68')](function(_0x311366){logger[_0xaaf7('0x5f')](_0xaaf7('0x6b'),util[_0xaaf7('0x60')](_0x311366,{'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 a91b314..3083546 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 _0x7860=['md5','util','./util','xml2json','entities','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20call...','merge','outbound','starttime','agentcalledAt','format','YYYY-MM-DD\x20HH:mm:ss','getString','Descriptions','Fields','called','Call\x20Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Call\x20Duration','utc','talktime','mm:ss','endtime','diff','CONTACTID','SEMODULE','Leads','SEID','','hasOwnProperty','%s','encodeXML','POST','https://crm.%s/crm/private/xml/Calls/insertRecords','authToken','crmapi','then','parse','response','result','recorddetail','Call\x20created!','Error\x20on\x20call\x20creation:\x20','stringify','host','AllUsers','users','user','log','zoho\x20data\x20users','isArrayLikeObject','isNil','Standard','Agent\x20found!','Using\x20the\x20admin\x20account!','find','zoho\x20user','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','Searching\x20enduser\x20with\x20phone','https://crm.%s/crm/private/json/Contacts/searchRecords','((Phone:%s))','Enduser\x20found\x20in\x20Contacts!','Contacts','row','length','val','content','GET','https://crm.%s/crm/private/json/Leads/searchRecords','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','https://crm.%s/crm/private/xml/Leads/insertRecords','%s%s%s','toJson','Enduser\x20created.','https://crm.%s/crm/private/json/Leads/getRecordById','Error\x20on\x20Lead\x20retrieve:\x20','debug','forEach','type','string','idField','toString','variable','variableName','customVariable','name','Variable','toLowerCase','indexOf','split','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','LEADID','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','catch','stripTrailingSlash','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','monitor_format','[ABANDONED]','calleridnum','lodash','request-promise'];(function(_0x4fde35,_0x28e7be){var _0x23736e=function(_0x1b9eef){while(--_0x1b9eef){_0x4fde35['push'](_0x4fde35['shift']());}};_0x23736e(++_0x28e7be);}(_0x7860,0x114));var _0x0786=function(_0x150fa5,_0x3d007b){_0x150fa5=_0x150fa5-0x0;var _0x43c6d7=_0x7860[_0x150fa5];return _0x43c6d7;};'use strict';var _=require(_0x0786('0x0'));var rp=require(_0x0786('0x1'));var md5=require(_0x0786('0x2'));var util=require(_0x0786('0x3'));var intUtil=require(_0x0786('0x4'));var parser=require(_0x0786('0x5'));var entities=require(_0x0786('0x6'));var moment=require(_0x0786('0x7'));var Redis=require(_0x0786('0x8'));var config=require(_0x0786('0x9'));var logger=require(_0x0786('0xa'))('zoho');config[_0x0786('0xb')]=_[_0x0786('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0786('0xd'))(new Redis(config[_0x0786('0xb')]));function emit(_0x47b7ab,_0x49a3f0,_0x2d16de){io['to'](_0x47b7ab)[_0x0786('0xe')](_0x49a3f0,_0x2d16de);}var headers={'Content-Type':_0x0786('0xf'),'Accept':'application/json'};function getCall(_0x538ab6,_0x4c10ff,_0x2c5a96,_0x1e0fa3,_0x541906,_0x30db54){logger[_0x0786('0x10')](_0x0786('0x11'));var _0x534bc3=_[_0x0786('0x12')]({'SMOWNERID':_0x4c10ff['id'],'Call Type':_0x30db54||'inbound','Call Start Time':(_0x30db54===_0x0786('0x13')?_0x541906[_0x0786('0x14')]:_0x541906[_0x0786('0x15')])||moment()[_0x0786('0x16')](_0x0786('0x17')),'Subject':intUtil['getString'](_0x1e0fa3['Subjects'],_0x541906,'\x20'),'Description':intUtil[_0x0786('0x18')](_0x1e0fa3[_0x0786('0x19')],_0x541906,'\x0a')},getCustomFields(_0x1e0fa3[_0x0786('0x1a')],_0x541906));switch(_0x541906['lastevent']){case _0x0786('0x1b'):_0x534bc3[_0x0786('0x1c')]=_0x0786('0x1d');break;case _0x0786('0x1e'):case _0x0786('0x1f'):_0x534bc3[_0x0786('0x1c')]=_0x0786('0x20');break;case _0x0786('0x21'):_0x534bc3[_0x0786('0x1c')]=_0x0786('0x22');break;case _0x0786('0x23'):_0x534bc3[_0x0786('0x1c')]='Abandoned';break;default:}if(_0x541906['talktime']){_0x534bc3[_0x0786('0x24')]=moment[_0x0786('0x25')](parseInt(_0x541906[_0x0786('0x26')])*0x3e8)[_0x0786('0x16')](_0x0786('0x27'));}else if(_0x541906['answertime']&&_0x541906[_0x0786('0x28')]){_0x534bc3[_0x0786('0x24')]=moment['utc'](moment(_0x541906[_0x0786('0x28')],'YYYY-MM-DD\x20HH:mm:ss')[_0x0786('0x29')](moment(_0x541906[_0x0786('0x14')],_0x0786('0x17'))))[_0x0786('0x16')](_0x0786('0x27'));}if(_0x2c5a96['CONTACTID']){_0x534bc3[_0x0786('0x2a')]=_0x2c5a96[_0x0786('0x2a')];}else if(_0x2c5a96['LEADID']){_0x534bc3[_0x0786('0x2b')]=_0x0786('0x2c');_0x534bc3[_0x0786('0x2d')]=_0x2c5a96['LEADID'];}var _0x5d69e4=_0x0786('0x2e');for(var _0x3296ee in _0x534bc3){if(_0x534bc3[_0x0786('0x2f')](_0x3296ee)){_0x5d69e4+=util[_0x0786('0x16')](_0x0786('0x30'),entities[_0x0786('0x31')](_0x3296ee),entities[_0x0786('0x31')](_0x534bc3[_0x3296ee]));}}_0x5d69e4+='';return request({'method':_0x0786('0x32'),'uri':util[_0x0786('0x16')](_0x0786('0x33'),_0x538ab6['host']),'qs':{'authtoken':_0x538ab6[_0x0786('0x34')],'scope':_0x0786('0x35'),'xmlData':_0x5d69e4},'json':!![]})[_0x0786('0x36')](function(_0x3ef0cc){_0x3ef0cc=JSON[_0x0786('0x37')](parser['toJson'](_0x3ef0cc));if(_0x3ef0cc[_0x0786('0x38')]){if(_0x3ef0cc['response'][_0x0786('0x39')]&&_0x3ef0cc[_0x0786('0x38')][_0x0786('0x39')][_0x0786('0x3a')]){logger[_0x0786('0x10')](_0x0786('0x3b'));return{'id':_0x3ef0cc['response']['result'][_0x0786('0x3a')]['FL'][0x0]['$t']};}}throw new Error(_0x0786('0x3c')+JSON[_0x0786('0x3d')](_0x3ef0cc));});}function getUser(_0x113e96,_0x5a3eb7){return request({'method':'GET','uri':util[_0x0786('0x16')]('https://crm.%s/crm/private/json/Users/getUsers',_0x113e96[_0x0786('0x3e')]),'qs':{'type':_0x0786('0x3f'),'authtoken':_0x113e96['authToken'],'scope':_0x0786('0x35')},'json':!![]})[_0x0786('0x36')](function(_0x1052bf){if(_0x1052bf[_0x0786('0x40')]&&_0x1052bf[_0x0786('0x40')][_0x0786('0x41')]){var _0x4f7153;console[_0x0786('0x42')](_0x0786('0x43'),_0x1052bf['users']['user']);if(_[_0x0786('0x44')](_0x1052bf['users']['user'])){console['log'](_0x0786('0x43'),_0x1052bf[_0x0786('0x40')]['user']);if(!_[_0x0786('0x45')](_0x5a3eb7)){_0x4f7153=_['find'](_0x1052bf[_0x0786('0x40')][_0x0786('0x41')],{'email':_0x5a3eb7,'profile':_0x0786('0x46'),'status':'active'});}if(!_[_0x0786('0x45')](_0x4f7153)){logger[_0x0786('0x10')](_0x0786('0x47'));}else{logger[_0x0786('0x10')](_0x0786('0x48'));_0x4f7153=_[_0x0786('0x49')](_0x1052bf[_0x0786('0x40')][_0x0786('0x41')],{'profile':'Administrator'});}console[_0x0786('0x42')](_0x0786('0x4a'),_0x4f7153);return _0x4f7153;}else{if(_0x1052bf[_0x0786('0x40')]['user']['profile']===_0x0786('0x4b')){logger['info'](_0x0786('0x48'));_0x4f7153=_0x1052bf[_0x0786('0x40')][_0x0786('0x41')];return _0x4f7153;}else{logger[_0x0786('0x4c')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x1052bf));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x1052bf));}}}else{logger[_0x0786('0x4c')](_0x0786('0x4d'),JSON[_0x0786('0x3d')](_0x1052bf));throw new Error(_0x0786('0x4e')+JSON[_0x0786('0x3d')](_0x1052bf));}});}function getEndUser(_0x275855,_0xd4b27d,_0x2c1703){logger[_0x0786('0x10')](_0x0786('0x4f'),_0x2c1703);return request({'method':'GET','uri':util[_0x0786('0x16')](_0x0786('0x50'),_0x275855['host']),'qs':{'authtoken':_0x275855[_0x0786('0x34')],'scope':_0x0786('0x35'),'criteria':util[_0x0786('0x16')](_0x0786('0x51'),_0x2c1703)},'json':!![]})[_0x0786('0x36')](function(_0xe03195){if(_0xe03195[_0x0786('0x38')]&&_0xe03195['response'][_0x0786('0x39')]){logger[_0x0786('0x10')](_0x0786('0x52'));var _0x329273={};var _0x53ce5a=_0xe03195[_0x0786('0x38')][_0x0786('0x39')][_0x0786('0x53')][_0x0786('0x54')]['no']?_0xe03195[_0x0786('0x38')][_0x0786('0x39')][_0x0786('0x53')]['row']['FL']:_0xe03195['response'][_0x0786('0x39')]['Contacts'][_0x0786('0x54')][0x0]['FL'];for(var _0x5d7efc=0x0,_0x147f58=_0x53ce5a[_0x0786('0x55')];_0x5d7efc<_0x147f58;_0x5d7efc++){_0x329273[_0x53ce5a[_0x5d7efc][_0x0786('0x56')]]=_0x53ce5a[_0x5d7efc][_0x0786('0x57')];}return _0x329273;}else{return request({'method':_0x0786('0x58'),'uri':util[_0x0786('0x16')](_0x0786('0x59'),_0x275855['host']),'qs':{'authtoken':_0x275855['authToken'],'scope':_0x0786('0x35'),'criteria':util[_0x0786('0x16')](_0x0786('0x51'),_0x2c1703)},'json':!![]})[_0x0786('0x36')](function(_0x53c77b){if(_0x53c77b[_0x0786('0x38')]&&_0x53c77b[_0x0786('0x38')][_0x0786('0x39')]){logger[_0x0786('0x10')]('Enduser\x20found\x20in\x20Leads!');var _0x146d15={};var _0x172868=_0x53c77b[_0x0786('0x38')][_0x0786('0x39')][_0x0786('0x2c')][_0x0786('0x54')]['no']?_0x53c77b[_0x0786('0x38')][_0x0786('0x39')][_0x0786('0x2c')]['row']['FL']:_0x53c77b[_0x0786('0x38')][_0x0786('0x39')]['Leads'][_0x0786('0x54')][0x0]['FL'];for(var _0x2899a8=0x0,_0x55513a=_0x172868[_0x0786('0x55')];_0x2899a8<_0x55513a;_0x2899a8++){_0x146d15[_0x172868[_0x2899a8][_0x0786('0x56')]]=_0x172868[_0x2899a8][_0x0786('0x57')];}return _0x146d15;}else{logger[_0x0786('0x10')](_0x0786('0x5a'));_0xd4b27d=getName(_0xd4b27d);return request({'method':_0x0786('0x32'),'uri':util['format'](_0x0786('0x5b'),_0x275855[_0x0786('0x3e')]),'qs':{'authtoken':_0x275855[_0x0786('0x34')],'scope':_0x0786('0x35'),'xmlData':util[_0x0786('0x16')](_0x0786('0x5c'),entities[_0x0786('0x31')](_0xd4b27d[0x0]),entities[_0x0786('0x31')](_0xd4b27d[0x1]),_0x2c1703)},'json':!![]})[_0x0786('0x36')](function(_0x87143d){_0x87143d=JSON[_0x0786('0x37')](parser[_0x0786('0x5d')](_0x87143d));if(_0x87143d['response']){if(_0x87143d[_0x0786('0x38')][_0x0786('0x39')]&&_0x87143d[_0x0786('0x38')][_0x0786('0x39')]['recorddetail']){logger['info'](_0x0786('0x5e'));return request({'method':_0x0786('0x58'),'uri':util[_0x0786('0x16')](_0x0786('0x5f'),_0x275855['host']),'qs':{'authtoken':_0x275855['authToken'],'scope':'crmapi','id':_0x87143d[_0x0786('0x38')]['result'][_0x0786('0x3a')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error('Error\x20on\x20Lead\x20creation:\x20'+JSON[_0x0786('0x3d')](_0x87143d));})[_0x0786('0x36')](function(_0x21fce9){if(_0x21fce9[_0x0786('0x38')]){if(_0x21fce9[_0x0786('0x38')][_0x0786('0x39')]){var _0x16f478={};for(var _0x19f472=0x0,_0x269666=_0x21fce9['response'][_0x0786('0x39')]['Leads'][_0x0786('0x54')]['FL'][_0x0786('0x55')];_0x19f472<_0x269666;_0x19f472++){_0x16f478[_0x21fce9[_0x0786('0x38')][_0x0786('0x39')][_0x0786('0x2c')][_0x0786('0x54')]['FL'][_0x19f472]['val']]=_0x21fce9['response'][_0x0786('0x39')]['Leads'][_0x0786('0x54')]['FL'][_0x19f472]['content'];}return _0x16f478;}}throw new Error(_0x0786('0x60')+JSON[_0x0786('0x3d')](_0x21fce9));});}});}});}function request(_0x4a98d2){logger[_0x0786('0x61')]('[HTTP]',JSON[_0x0786('0x3d')](_0x4a98d2));return rp(_0x4a98d2);}function getCustomFields(_0x4128cd,_0x250ca9){var _0x2cc679={};if(_0x4128cd[_0x0786('0x55')]>0x0){_[_0x0786('0x62')](_0x4128cd,function(_0x291ab3){if(_0x291ab3[_0x0786('0x63')]===_0x0786('0x64')&&_0x291ab3[_0x0786('0x65')]){_0x2cc679[_0x291ab3[_0x0786('0x65')]]=_0x291ab3[_0x0786('0x57')][_0x0786('0x66')]();}else if(_0x291ab3[_0x0786('0x63')]===_0x0786('0x67')&&_0x291ab3[_0x0786('0x68')]&&_0x291ab3[_0x0786('0x65')]&&_0x250ca9[_0x291ab3[_0x0786('0x68')]]){_0x2cc679[_0x291ab3[_0x0786('0x65')]]=_0x250ca9[_0x291ab3['variableName']][_0x0786('0x66')]();}else if(_0x291ab3['type']===_0x0786('0x69')&&_0x291ab3['Variable']&&_0x291ab3['Variable'][_0x0786('0x6a')]&&_0x291ab3[_0x0786('0x65')]&&_0x250ca9[_0x291ab3[_0x0786('0x6b')][_0x0786('0x6a')][_0x0786('0x6c')]()]){_0x2cc679[_0x291ab3[_0x0786('0x65')]]=_0x250ca9[_0x291ab3[_0x0786('0x6b')][_0x0786('0x6a')][_0x0786('0x6c')]()]['toString']();}});}return _0x2cc679;}function getName(_0x8ec9d5){if(_0x8ec9d5[_0x0786('0x6d')]('\x20')>0x0){var _0x38c9da=_0x8ec9d5[_0x0786('0x6e')](/ (.+)/);if(_0x38c9da[0x1]){return _0x38c9da;}}return[_0x8ec9d5,_0x8ec9d5];}exports[_0x0786('0x6f')]=function(_0x710bd,_0x12d86d,_0xe97e6,_0x4d5cfe,_0x30d89c,_0x4b633f){var _0x802ee3,_0x549f9b;_0x4b633f['host']=intUtil['stripTrailingSlash'](_0x4b633f['host']);_0x4b633f[_0x0786('0x70')]=intUtil['stripTrailingSlash'](_0x4b633f[_0x0786('0x70')]);if(_0x30d89c&&_0x30d89c['monitor_format']){logger[_0x0786('0x10')](_0x0786('0x71'),_0x0786('0x72'));_0x12d86d[_0x0786('0x73')]=util[_0x0786('0x16')](_0x0786('0x74'),_0x4b633f['serverUrl'],_0x12d86d[_0x0786('0x75')],md5(_0x12d86d[_0x0786('0x75')]));}else{_0x12d86d[_0x0786('0x73')]='';}return getUser(_0x4b633f,_0x4d5cfe[_0x0786('0x76')])[_0x0786('0x36')](function(_0x4724e5){_0x802ee3=_0x4724e5;logger[_0x0786('0x10')](_0x0786('0x77'),_0x802ee3['id']);return getEndUser(_0x4b633f,_0x12d86d[_0x0786('0x78')],_0x12d86d['calleridnum']);})['then'](function(_0x20b827){_0x549f9b=_0x20b827;logger[_0x0786('0x10')](_0x0786('0x79'),_0x549f9b['CONTACTID']||_0x549f9b[_0x0786('0x7a')]);return getCall(_0x4b633f,_0x802ee3,_0x549f9b,_0xe97e6,_0x12d86d,_0x0786('0x7b'));})[_0x0786('0x36')](function(_0x1170dd){if(_0x1170dd){logger['info'](_0x0786('0x7c'),_0x1170dd['id']);logger['info'](_0x0786('0x71'),_0x0786('0x7d'));emit(util[_0x0786('0x16')](_0x0786('0x7e'),_0x4d5cfe[_0x0786('0x6a')]),'trigger:browser:url',{'uri':util[_0x0786('0x16')](_0x0786('0x7f'),_0x4b633f[_0x0786('0x3e')],_0x1170dd['id'])});}})[_0x0786('0x80')](function(_0x5ecc58){logger[_0x0786('0x4c')](_0x0786('0x71'),JSON[_0x0786('0x3d')](_0x5ecc58));});};exports['outbound']=function(_0x4a6245,_0x1f4bfe,_0x4d99c4,_0x313af5,_0x1a23a5,_0x5071cc,_0xa1e43c){var _0x21aaf7,_0x2afe3d;_0x5071cc[_0x0786('0x3e')]=intUtil['stripTrailingSlash'](_0x5071cc['host']);_0x5071cc[_0x0786('0x70')]=intUtil[_0x0786('0x81')](_0x5071cc[_0x0786('0x70')]);if(_0xa1e43c&&_0xa1e43c[_0x0786('0x82')]&&_0xa1e43c[_0x0786('0x82')]!==_0x0786('0x83')){logger['info']('[OUTBOUND]',_0x0786('0x72'));_0x1f4bfe[_0x0786('0x73')]=util[_0x0786('0x16')](_0x0786('0x74'),_0x5071cc['serverUrl'],_0x1f4bfe[_0x0786('0x75')],md5(_0x1f4bfe['uniqueid']));}return getUser(_0x5071cc,_0x313af5[_0x0786('0x76')])[_0x0786('0x36')](function(_0x1ee08f){_0x21aaf7=_0x1ee08f;logger[_0x0786('0x10')](_0x0786('0x77'),_0x21aaf7['id']);return getEndUser(_0x5071cc,_0x1f4bfe[_0x0786('0x84')],_0x1f4bfe[_0x0786('0x85')]);})[_0x0786('0x36')](function(_0x517493){_0x2afe3d=_0x517493;logger[_0x0786('0x10')](_0x0786('0x79'),_0x2afe3d[_0x0786('0x2a')]||_0x2afe3d[_0x0786('0x7a')]);return getCall(_0x5071cc,_0x21aaf7,_0x2afe3d,_0x4d99c4,_0x1f4bfe,_0x0786('0x86'));})[_0x0786('0x36')](function(_0x5a139d){if(_0x5a139d){logger[_0x0786('0x10')](_0x0786('0x7c'),_0x5a139d['id']);logger[_0x0786('0x10')](_0x0786('0x87'),_0x0786('0x7d'));emit(util[_0x0786('0x16')]('user:%s',_0x313af5[_0x0786('0x6a')]),'trigger:browser:url',{'uri':util[_0x0786('0x16')](_0x0786('0x7f'),_0x5071cc[_0x0786('0x3e')],_0x5a139d['id'])});}})['catch'](function(_0x341032){logger[_0x0786('0x4c')](_0x0786('0x87'),JSON['stringify'](_0x341032));});};exports['abandoned']=function(_0xf273b3,_0x36cf85,_0x4a6116,_0x440720,_0xb483a5,_0x3cdbe1){var _0x2ae41a,_0x16a329;_0x3cdbe1[_0x0786('0x3e')]=intUtil[_0x0786('0x81')](_0x3cdbe1[_0x0786('0x3e')]);_0x3cdbe1[_0x0786('0x70')]=intUtil[_0x0786('0x81')](_0x3cdbe1[_0x0786('0x70')]);if(_0xb483a5&&_0xb483a5[_0x0786('0x88')]){logger[_0x0786('0x10')](_0x0786('0x89'),_0x0786('0x72'));_0x36cf85['recordingURL']=util[_0x0786('0x16')](_0x0786('0x74'),_0x3cdbe1[_0x0786('0x70')],_0x36cf85[_0x0786('0x75')],md5(_0x36cf85[_0x0786('0x75')]));}else{_0x36cf85[_0x0786('0x73')]='';}return getUser(_0x3cdbe1)[_0x0786('0x36')](function(_0x22dc6c){_0x2ae41a=_0x22dc6c;logger['info']('The\x20User\x20ID\x20is:',_0x2ae41a['id']);return getEndUser(_0x3cdbe1,_0x36cf85['calleridname'],_0x36cf85[_0x0786('0x8a')]);})[_0x0786('0x36')](function(_0x330ba7){_0x16a329=_0x330ba7;logger[_0x0786('0x10')](_0x0786('0x79'),_0x16a329[_0x0786('0x2a')]||_0x16a329[_0x0786('0x7a')]);return getCall(_0x3cdbe1,_0x2ae41a,_0x16a329,_0x4a6116,_0x36cf85,_0x0786('0x7b'));})[_0x0786('0x36')](function(_0x4d811e){if(_0x4d811e){logger['info'](_0x0786('0x7c'),_0x4d811e['id']);}})[_0x0786('0x80')](function(_0x5c0f9b){logger['error'](_0x0786('0x89'),JSON['stringify'](_0x5c0f9b));});}; \ No newline at end of file +var _0x3598=['Standard','Agent\x20found!','Using\x20the\x20admin\x20account!','zoho\x20user','profile','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','Searching\x20enduser\x20with\x20phone','GET','((Phone:%s))','Contacts','row','val','content','https://crm.%s/crm/private/json/Leads/searchRecords','host','Enduser\x20found\x20in\x20Leads!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','https://crm.%s/crm/private/xml/Leads/insertRecords','%s%s%s','toJson','Enduser\x20created.','https://crm.%s/crm/private/json/Leads/getRecordById','recorddetail','Error\x20on\x20Lead\x20creation:\x20','Error\x20on\x20Lead\x20retrieve:\x20','debug','length','type','string','idField','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','catch','recordingFormat','[OUTBOUND]','destcalleridname','trigger:browser:url','[ABANDONED]','lodash','request-promise','md5','util','./util','xml2json','entities','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','emit','info','Creating\x20new\x20call...','inbound','outbound','starttime','agentcalledAt','format','YYYY-MM-DD\x20HH:mm:ss','getString','Subjects','Descriptions','Fields','lastevent','called','Call\x20Result','connect','Answered','rejected','Rejected','abandoned','Abandoned','talktime','utc','answertime','endtime','Call\x20Duration','mm:ss','CONTACTID','Leads','SEID','LEADID','','hasOwnProperty','encodeXML','','POST','https://crm.%s/crm/private/xml/Calls/insertRecords','authToken','crmapi','then','parse','response','result','stringify','https://crm.%s/crm/private/json/Users/getUsers','AllUsers','users','zoho\x20data\x20users','user','isArrayLikeObject','log','isNil'];(function(_0x23cc76,_0x9c756b){var _0x2f5c13=function(_0x57c44b){while(--_0x57c44b){_0x23cc76['push'](_0x23cc76['shift']());}};_0x2f5c13(++_0x9c756b);}(_0x3598,0x149));var _0x8359=function(_0x17f2c4,_0x409af0){_0x17f2c4=_0x17f2c4-0x0;var _0x4c8d4b=_0x3598[_0x17f2c4];return _0x4c8d4b;};'use strict';var _=require(_0x8359('0x0'));var rp=require(_0x8359('0x1'));var md5=require(_0x8359('0x2'));var util=require(_0x8359('0x3'));var intUtil=require(_0x8359('0x4'));var parser=require(_0x8359('0x5'));var entities=require(_0x8359('0x6'));var moment=require('moment');var Redis=require(_0x8359('0x7'));var config=require(_0x8359('0x8'));var logger=require(_0x8359('0x9'))(_0x8359('0xa'));config['redis']=_[_0x8359('0xb')](config[_0x8359('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x8359('0xd'))(new Redis(config[_0x8359('0xc')]));function emit(_0x381633,_0x2d7e08,_0x1d333d){io['to'](_0x381633)[_0x8359('0xe')](_0x2d7e08,_0x1d333d);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getCall(_0x4a7afb,_0x44ad9c,_0x11c38f,_0x56be14,_0x3cd229,_0x52430d){logger[_0x8359('0xf')](_0x8359('0x10'));var _0x396a14=_['merge']({'SMOWNERID':_0x44ad9c['id'],'Call Type':_0x52430d||_0x8359('0x11'),'Call Start Time':(_0x52430d===_0x8359('0x12')?_0x3cd229[_0x8359('0x13')]:_0x3cd229[_0x8359('0x14')])||moment()[_0x8359('0x15')](_0x8359('0x16')),'Subject':intUtil[_0x8359('0x17')](_0x56be14[_0x8359('0x18')],_0x3cd229,'\x20'),'Description':intUtil['getString'](_0x56be14[_0x8359('0x19')],_0x3cd229,'\x0a')},getCustomFields(_0x56be14[_0x8359('0x1a')],_0x3cd229));switch(_0x3cd229[_0x8359('0x1b')]){case _0x8359('0x1c'):_0x396a14[_0x8359('0x1d')]='Called';break;case'complete':case _0x8359('0x1e'):_0x396a14[_0x8359('0x1d')]=_0x8359('0x1f');break;case _0x8359('0x20'):_0x396a14[_0x8359('0x1d')]=_0x8359('0x21');break;case _0x8359('0x22'):_0x396a14[_0x8359('0x1d')]=_0x8359('0x23');break;default:}if(_0x3cd229[_0x8359('0x24')]){_0x396a14['Call\x20Duration']=moment[_0x8359('0x25')](parseInt(_0x3cd229[_0x8359('0x24')])*0x3e8)[_0x8359('0x15')]('mm:ss');}else if(_0x3cd229[_0x8359('0x26')]&&_0x3cd229[_0x8359('0x27')]){_0x396a14[_0x8359('0x28')]=moment[_0x8359('0x25')](moment(_0x3cd229[_0x8359('0x27')],_0x8359('0x16'))['diff'](moment(_0x3cd229[_0x8359('0x13')],_0x8359('0x16'))))[_0x8359('0x15')](_0x8359('0x29'));}if(_0x11c38f[_0x8359('0x2a')]){_0x396a14[_0x8359('0x2a')]=_0x11c38f[_0x8359('0x2a')];}else if(_0x11c38f['LEADID']){_0x396a14['SEMODULE']=_0x8359('0x2b');_0x396a14[_0x8359('0x2c')]=_0x11c38f[_0x8359('0x2d')];}var _0xd17465=_0x8359('0x2e');for(var _0x1281b0 in _0x396a14){if(_0x396a14[_0x8359('0x2f')](_0x1281b0)){_0xd17465+=util[_0x8359('0x15')]('%s',entities[_0x8359('0x30')](_0x1281b0),entities[_0x8359('0x30')](_0x396a14[_0x1281b0]));}}_0xd17465+=_0x8359('0x31');return request({'method':_0x8359('0x32'),'uri':util[_0x8359('0x15')](_0x8359('0x33'),_0x4a7afb['host']),'qs':{'authtoken':_0x4a7afb[_0x8359('0x34')],'scope':_0x8359('0x35'),'xmlData':_0xd17465},'json':!![]})[_0x8359('0x36')](function(_0x196a8d){_0x196a8d=JSON[_0x8359('0x37')](parser['toJson'](_0x196a8d));if(_0x196a8d[_0x8359('0x38')]){if(_0x196a8d[_0x8359('0x38')][_0x8359('0x39')]&&_0x196a8d[_0x8359('0x38')][_0x8359('0x39')]['recorddetail']){logger[_0x8359('0xf')]('Call\x20created!');return{'id':_0x196a8d[_0x8359('0x38')][_0x8359('0x39')]['recorddetail']['FL'][0x0]['$t']};}}throw new Error('Error\x20on\x20call\x20creation:\x20'+JSON[_0x8359('0x3a')](_0x196a8d));});}function getUser(_0x11c965,_0xffe02a){return request({'method':'GET','uri':util['format'](_0x8359('0x3b'),_0x11c965['host']),'qs':{'type':_0x8359('0x3c'),'authtoken':_0x11c965[_0x8359('0x34')],'scope':_0x8359('0x35')},'json':!![]})[_0x8359('0x36')](function(_0x4dcbc5){if(_0x4dcbc5[_0x8359('0x3d')]&&_0x4dcbc5[_0x8359('0x3d')]['user']){var _0x2c8826;console['log'](_0x8359('0x3e'),_0x4dcbc5['users'][_0x8359('0x3f')]);if(_[_0x8359('0x40')](_0x4dcbc5[_0x8359('0x3d')][_0x8359('0x3f')])){console[_0x8359('0x41')](_0x8359('0x3e'),_0x4dcbc5[_0x8359('0x3d')][_0x8359('0x3f')]);if(!_[_0x8359('0x42')](_0xffe02a)){_0x2c8826=_['find'](_0x4dcbc5[_0x8359('0x3d')][_0x8359('0x3f')],{'email':_0xffe02a,'profile':_0x8359('0x43'),'status':'active'});}if(!_['isNil'](_0x2c8826)){logger['info'](_0x8359('0x44'));}else{logger[_0x8359('0xf')](_0x8359('0x45'));_0x2c8826=_['find'](_0x4dcbc5[_0x8359('0x3d')][_0x8359('0x3f')],{'profile':'Administrator'});}console[_0x8359('0x41')](_0x8359('0x46'),_0x2c8826);return _0x2c8826;}else{if(_0x4dcbc5[_0x8359('0x3d')][_0x8359('0x3f')][_0x8359('0x47')]===_0x8359('0x48')){logger[_0x8359('0xf')](_0x8359('0x45'));_0x2c8826=_0x4dcbc5['users']['user'];return _0x2c8826;}else{logger[_0x8359('0x49')]('The\x20failing\x20result\x20is',JSON[_0x8359('0x3a')](_0x4dcbc5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x8359('0x3a')](_0x4dcbc5));}}}else{logger['error'](_0x8359('0x4a'),JSON[_0x8359('0x3a')](_0x4dcbc5));throw new Error(_0x8359('0x4b')+JSON[_0x8359('0x3a')](_0x4dcbc5));}});}function getEndUser(_0x53eb48,_0x1edbf,_0x15b411){logger[_0x8359('0xf')](_0x8359('0x4c'),_0x15b411);return request({'method':_0x8359('0x4d'),'uri':util['format']('https://crm.%s/crm/private/json/Contacts/searchRecords',_0x53eb48['host']),'qs':{'authtoken':_0x53eb48[_0x8359('0x34')],'scope':_0x8359('0x35'),'criteria':util['format'](_0x8359('0x4e'),_0x15b411)},'json':!![]})[_0x8359('0x36')](function(_0x185c45){if(_0x185c45[_0x8359('0x38')]&&_0x185c45[_0x8359('0x38')]['result']){logger[_0x8359('0xf')]('Enduser\x20found\x20in\x20Contacts!');var _0x38a139={};var _0x301cca=_0x185c45[_0x8359('0x38')][_0x8359('0x39')][_0x8359('0x4f')]['row']['no']?_0x185c45['response'][_0x8359('0x39')][_0x8359('0x4f')][_0x8359('0x50')]['FL']:_0x185c45['response'][_0x8359('0x39')][_0x8359('0x4f')][_0x8359('0x50')][0x0]['FL'];for(var _0x53322c=0x0,_0x5c1e00=_0x301cca['length'];_0x53322c<_0x5c1e00;_0x53322c++){_0x38a139[_0x301cca[_0x53322c][_0x8359('0x51')]]=_0x301cca[_0x53322c][_0x8359('0x52')];}return _0x38a139;}else{return request({'method':_0x8359('0x4d'),'uri':util[_0x8359('0x15')](_0x8359('0x53'),_0x53eb48[_0x8359('0x54')]),'qs':{'authtoken':_0x53eb48['authToken'],'scope':'crmapi','criteria':util[_0x8359('0x15')](_0x8359('0x4e'),_0x15b411)},'json':!![]})[_0x8359('0x36')](function(_0xcb4803){if(_0xcb4803['response']&&_0xcb4803['response'][_0x8359('0x39')]){logger[_0x8359('0xf')](_0x8359('0x55'));var _0x3a74fa={};var _0xc64023=_0xcb4803[_0x8359('0x38')][_0x8359('0x39')][_0x8359('0x2b')][_0x8359('0x50')]['no']?_0xcb4803[_0x8359('0x38')][_0x8359('0x39')][_0x8359('0x2b')][_0x8359('0x50')]['FL']:_0xcb4803[_0x8359('0x38')][_0x8359('0x39')][_0x8359('0x2b')]['row'][0x0]['FL'];for(var _0x58dd03=0x0,_0x4dbbc5=_0xc64023['length'];_0x58dd03<_0x4dbbc5;_0x58dd03++){_0x3a74fa[_0xc64023[_0x58dd03][_0x8359('0x51')]]=_0xc64023[_0x58dd03][_0x8359('0x52')];}return _0x3a74fa;}else{logger[_0x8359('0xf')](_0x8359('0x56'));_0x1edbf=getName(_0x1edbf);return request({'method':'POST','uri':util[_0x8359('0x15')](_0x8359('0x57'),_0x53eb48[_0x8359('0x54')]),'qs':{'authtoken':_0x53eb48[_0x8359('0x34')],'scope':_0x8359('0x35'),'xmlData':util[_0x8359('0x15')](_0x8359('0x58'),entities[_0x8359('0x30')](_0x1edbf[0x0]),entities['encodeXML'](_0x1edbf[0x1]),_0x15b411)},'json':!![]})[_0x8359('0x36')](function(_0x27b881){_0x27b881=JSON[_0x8359('0x37')](parser[_0x8359('0x59')](_0x27b881));if(_0x27b881['response']){if(_0x27b881['response'][_0x8359('0x39')]&&_0x27b881[_0x8359('0x38')]['result']['recorddetail']){logger[_0x8359('0xf')](_0x8359('0x5a'));return request({'method':_0x8359('0x4d'),'uri':util[_0x8359('0x15')](_0x8359('0x5b'),_0x53eb48['host']),'qs':{'authtoken':_0x53eb48[_0x8359('0x34')],'scope':_0x8359('0x35'),'id':_0x27b881[_0x8359('0x38')]['result'][_0x8359('0x5c')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0x8359('0x5d')+JSON[_0x8359('0x3a')](_0x27b881));})[_0x8359('0x36')](function(_0xbaeadb){if(_0xbaeadb[_0x8359('0x38')]){if(_0xbaeadb['response'][_0x8359('0x39')]){var _0x43657c={};for(var _0x11a441=0x0,_0x4a50fc=_0xbaeadb[_0x8359('0x38')]['result'][_0x8359('0x2b')]['row']['FL']['length'];_0x11a441<_0x4a50fc;_0x11a441++){_0x43657c[_0xbaeadb['response']['result'][_0x8359('0x2b')][_0x8359('0x50')]['FL'][_0x11a441]['val']]=_0xbaeadb[_0x8359('0x38')][_0x8359('0x39')]['Leads'][_0x8359('0x50')]['FL'][_0x11a441][_0x8359('0x52')];}return _0x43657c;}}throw new Error(_0x8359('0x5e')+JSON[_0x8359('0x3a')](_0xbaeadb));});}});}});}function request(_0x5d885f){logger[_0x8359('0x5f')]('[HTTP]',JSON[_0x8359('0x3a')](_0x5d885f));return rp(_0x5d885f);}function getCustomFields(_0x5923a2,_0x5122cd){var _0x280436={};if(_0x5923a2[_0x8359('0x60')]>0x0){_['forEach'](_0x5923a2,function(_0x2ec5e6){if(_0x2ec5e6[_0x8359('0x61')]===_0x8359('0x62')&&_0x2ec5e6[_0x8359('0x63')]){_0x280436[_0x2ec5e6[_0x8359('0x63')]]=_0x2ec5e6[_0x8359('0x52')][_0x8359('0x64')]();}else if(_0x2ec5e6['type']===_0x8359('0x65')&&_0x2ec5e6[_0x8359('0x66')]&&_0x2ec5e6[_0x8359('0x63')]&&_0x5122cd[_0x2ec5e6[_0x8359('0x66')]]){_0x280436[_0x2ec5e6[_0x8359('0x63')]]=_0x5122cd[_0x2ec5e6[_0x8359('0x66')]][_0x8359('0x64')]();}else if(_0x2ec5e6['type']==='customVariable'&&_0x2ec5e6[_0x8359('0x67')]&&_0x2ec5e6[_0x8359('0x67')][_0x8359('0x68')]&&_0x2ec5e6['idField']&&_0x5122cd[_0x2ec5e6[_0x8359('0x67')][_0x8359('0x68')][_0x8359('0x69')]()]){_0x280436[_0x2ec5e6['idField']]=_0x5122cd[_0x2ec5e6[_0x8359('0x67')]['name'][_0x8359('0x69')]()][_0x8359('0x64')]();}});}return _0x280436;}function getName(_0xd72cf7){if(_0xd72cf7[_0x8359('0x6a')]('\x20')>0x0){var _0x4f091a=_0xd72cf7[_0x8359('0x6b')](/ (.+)/);if(_0x4f091a[0x1]){return _0x4f091a;}}return[_0xd72cf7,_0xd72cf7];}exports['queue']=function(_0x10bdb6,_0x53970a,_0x3d461b,_0x302350,_0x15dc91,_0x38ef7b){var _0x4cb666,_0x1464ca;_0x38ef7b[_0x8359('0x54')]=intUtil[_0x8359('0x6c')](_0x38ef7b[_0x8359('0x54')]);_0x38ef7b[_0x8359('0x6d')]=intUtil['stripTrailingSlash'](_0x38ef7b[_0x8359('0x6d')]);if(_0x15dc91&&_0x15dc91[_0x8359('0x6e')]){logger['info'](_0x8359('0x6f'),_0x8359('0x70'));_0x53970a[_0x8359('0x71')]=util[_0x8359('0x15')](_0x8359('0x72'),_0x38ef7b[_0x8359('0x6d')],_0x53970a[_0x8359('0x73')],md5(_0x53970a[_0x8359('0x73')]));}else{_0x53970a[_0x8359('0x71')]='';}return getUser(_0x38ef7b,_0x302350[_0x8359('0x74')])[_0x8359('0x36')](function(_0x445639){_0x4cb666=_0x445639;logger[_0x8359('0xf')](_0x8359('0x75'),_0x4cb666['id']);return getEndUser(_0x38ef7b,_0x53970a[_0x8359('0x76')],_0x53970a[_0x8359('0x77')]);})[_0x8359('0x36')](function(_0x4c1d4d){_0x1464ca=_0x4c1d4d;logger['info'](_0x8359('0x78'),_0x1464ca[_0x8359('0x2a')]||_0x1464ca[_0x8359('0x2d')]);return getCall(_0x38ef7b,_0x4cb666,_0x1464ca,_0x3d461b,_0x53970a,_0x8359('0x79'));})[_0x8359('0x36')](function(_0x509079){if(_0x509079){logger['info'](_0x8359('0x7a'),_0x509079['id']);logger[_0x8359('0xf')](_0x8359('0x6f'),_0x8359('0x7b'));emit(util['format'](_0x8359('0x7c'),_0x302350[_0x8359('0x68')]),'trigger:browser:url',{'uri':util['format'](_0x8359('0x7d'),_0x38ef7b[_0x8359('0x54')],_0x509079['id'])});}})[_0x8359('0x7e')](function(_0x2e3a68){logger['error'](_0x8359('0x6f'),JSON['stringify'](_0x2e3a68));});};exports[_0x8359('0x12')]=function(_0x4ef210,_0x5f54da,_0x31993a,_0x26e45d,_0x43bdd1,_0x35adfc,_0x183af1){var _0x5db87f,_0x172fb5;_0x35adfc[_0x8359('0x54')]=intUtil['stripTrailingSlash'](_0x35adfc['host']);_0x35adfc[_0x8359('0x6d')]=intUtil['stripTrailingSlash'](_0x35adfc[_0x8359('0x6d')]);if(_0x183af1&&_0x183af1[_0x8359('0x7f')]&&_0x183af1['recordingFormat']!=='none'){logger['info'](_0x8359('0x80'),_0x8359('0x70'));_0x5f54da[_0x8359('0x71')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35adfc[_0x8359('0x6d')],_0x5f54da[_0x8359('0x73')],md5(_0x5f54da[_0x8359('0x73')]));}return getUser(_0x35adfc,_0x26e45d[_0x8359('0x74')])[_0x8359('0x36')](function(_0x5eddb6){_0x5db87f=_0x5eddb6;logger['info'](_0x8359('0x75'),_0x5db87f['id']);return getEndUser(_0x35adfc,_0x5f54da[_0x8359('0x81')],_0x5f54da['destcalleridnum']);})[_0x8359('0x36')](function(_0x487919){_0x172fb5=_0x487919;logger[_0x8359('0xf')](_0x8359('0x78'),_0x172fb5[_0x8359('0x2a')]||_0x172fb5[_0x8359('0x2d')]);return getCall(_0x35adfc,_0x5db87f,_0x172fb5,_0x31993a,_0x5f54da,'Outbound');})[_0x8359('0x36')](function(_0x56daf3){if(_0x56daf3){logger['info'](_0x8359('0x7a'),_0x56daf3['id']);logger[_0x8359('0xf')]('[OUTBOUND]',_0x8359('0x7b'));emit(util[_0x8359('0x15')](_0x8359('0x7c'),_0x26e45d[_0x8359('0x68')]),_0x8359('0x82'),{'uri':util[_0x8359('0x15')](_0x8359('0x7d'),_0x35adfc[_0x8359('0x54')],_0x56daf3['id'])});}})[_0x8359('0x7e')](function(_0x50d2b9){logger['error'](_0x8359('0x80'),JSON[_0x8359('0x3a')](_0x50d2b9));});};exports[_0x8359('0x22')]=function(_0x5d02a2,_0x5bfdde,_0x3e644a,_0x50e08f,_0x3f21f4,_0x614d8c){var _0x3a5273,_0x56bb0d;_0x614d8c[_0x8359('0x54')]=intUtil[_0x8359('0x6c')](_0x614d8c[_0x8359('0x54')]);_0x614d8c[_0x8359('0x6d')]=intUtil[_0x8359('0x6c')](_0x614d8c['serverUrl']);if(_0x3f21f4&&_0x3f21f4['monitor_format']){logger[_0x8359('0xf')](_0x8359('0x83'),_0x8359('0x70'));_0x5bfdde[_0x8359('0x71')]=util[_0x8359('0x15')](_0x8359('0x72'),_0x614d8c[_0x8359('0x6d')],_0x5bfdde[_0x8359('0x73')],md5(_0x5bfdde[_0x8359('0x73')]));}else{_0x5bfdde['recordingURL']='';}return getUser(_0x614d8c)[_0x8359('0x36')](function(_0x283a77){_0x3a5273=_0x283a77;logger['info'](_0x8359('0x75'),_0x3a5273['id']);return getEndUser(_0x614d8c,_0x5bfdde['calleridname'],_0x5bfdde['calleridnum']);})[_0x8359('0x36')](function(_0xce867c){_0x56bb0d=_0xce867c;logger[_0x8359('0xf')](_0x8359('0x78'),_0x56bb0d[_0x8359('0x2a')]||_0x56bb0d[_0x8359('0x2d')]);return getCall(_0x614d8c,_0x3a5273,_0x56bb0d,_0x3e644a,_0x5bfdde,_0x8359('0x79'));})[_0x8359('0x36')](function(_0x43448c){if(_0x43448c){logger[_0x8359('0xf')](_0x8359('0x7a'),_0x43448c['id']);}})[_0x8359('0x7e')](function(_0x132c17){logger[_0x8359('0x49')](_0x8359('0x83'),JSON[_0x8359('0x3a')](_0x132c17));});}; \ 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 ddc12ef..95ae0a0 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 _0x1ef0=['GET','POST','data7','render','then','info','statusCode','catch','error','format','%s\x20%s\x20%s\x20[%s]:%s','name','message','request-promise','util','mustache','../../../../config/logger','trigger','data1','toUpperCase','data2'];(function(_0x2f1a0a,_0x4133e3){var _0x188ecb=function(_0x3b3c4c){while(--_0x3b3c4c){_0x2f1a0a['push'](_0x2f1a0a['shift']());}};_0x188ecb(++_0x4133e3);}(_0x1ef0,0x172));var _0x01ef=function(_0x5e4e74,_0x53b7a5){_0x5e4e74=_0x5e4e74-0x0;var _0x217a4a=_0x1ef0[_0x5e4e74];return _0x217a4a;};'use strict';var rp=require(_0x01ef('0x0'));var util=require(_0x01ef('0x1'));var Mustache=require(_0x01ef('0x2'));var logger=require(_0x01ef('0x3'))(_0x01ef('0x4'));exports['exec']=function(_0x54c938,_0x437210){var _0x1ae266={'method':_0x54c938[_0x01ef('0x5')][_0x01ef('0x6')](),'uri':encodeURI(Mustache['render'](_0x54c938[_0x01ef('0x7')],_0x437210)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x54c938[_0x01ef('0x5')][_0x01ef('0x6')]()){case _0x01ef('0x8'):_0x1ae266['qs']=_0x437210;break;case _0x01ef('0x9'):_0x1ae266['body']=_0x54c938[_0x01ef('0xa')]?Mustache[_0x01ef('0xb')](_0x54c938[_0x01ef('0xa')],_0x437210):_0x437210;break;}rp(_0x1ae266)[_0x01ef('0xc')](function(_0x2e6a9a){logger[_0x01ef('0xd')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s',_0x54c938[_0x01ef('0x5')],_0x54c938['data2'],_0x2e6a9a[_0x01ef('0xe')],_0x2e6a9a['body']));})[_0x01ef('0xf')](function(_0x36e1fe){logger[_0x01ef('0x10')](util[_0x01ef('0x11')](_0x01ef('0x12'),_0x54c938[_0x01ef('0x5')],_0x54c938['data2'],_0x36e1fe[_0x01ef('0xe')],_0x36e1fe[_0x01ef('0x13')],_0x36e1fe[_0x01ef('0x14')]));});}; \ No newline at end of file +var _0x86a7=['request-promise','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','GET','data7','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s','statusCode','body','catch','error','format','%s\x20%s\x20%s\x20[%s]:%s','message'];(function(_0x3518b6,_0x1d6005){var _0x55a221=function(_0x25ebfa){while(--_0x25ebfa){_0x3518b6['push'](_0x3518b6['shift']());}};_0x55a221(++_0x1d6005);}(_0x86a7,0x12c));var _0x786a=function(_0x39c12e,_0x585534){_0x39c12e=_0x39c12e-0x0;var _0x58dbf4=_0x86a7[_0x39c12e];return _0x58dbf4;};'use strict';var rp=require(_0x786a('0x0'));var util=require('util');var Mustache=require(_0x786a('0x1'));var logger=require(_0x786a('0x2'))(_0x786a('0x3'));exports[_0x786a('0x4')]=function(_0x5a2c7b,_0x56eec){var _0x5f5d6c={'method':_0x5a2c7b[_0x786a('0x5')][_0x786a('0x6')](),'uri':encodeURI(Mustache[_0x786a('0x7')](_0x5a2c7b[_0x786a('0x8')],_0x56eec)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5a2c7b[_0x786a('0x5')]['toUpperCase']()){case _0x786a('0x9'):_0x5f5d6c['qs']=_0x56eec;break;case'POST':_0x5f5d6c['body']=_0x5a2c7b[_0x786a('0xa')]?Mustache[_0x786a('0x7')](_0x5a2c7b[_0x786a('0xa')],_0x56eec):_0x56eec;break;}rp(_0x5f5d6c)['then'](function(_0x4cf933){logger[_0x786a('0xb')](util['format'](_0x786a('0xc'),_0x5a2c7b['data1'],_0x5a2c7b['data2'],_0x4cf933[_0x786a('0xd')],_0x4cf933[_0x786a('0xe')]));})[_0x786a('0xf')](function(_0x5a7056){logger[_0x786a('0x10')](util[_0x786a('0x11')](_0x786a('0x12'),_0x5a2c7b[_0x786a('0x5')],_0x5a2c7b[_0x786a('0x8')],_0x5a7056[_0x786a('0xd')],_0x5a7056['name'],_0x5a7056[_0x786a('0x13')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 5ec617f..5ae460d 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 _0x80d9=['routing','client','Request','error','rpc','message','catch','exports','jayson/promise','../../config/logger'];(function(_0x104223,_0x5e4113){var _0x2f883f=function(_0x5bc5c0){while(--_0x5bc5c0){_0x104223['push'](_0x104223['shift']());}};_0x2f883f(++_0x5e4113);}(_0x80d9,0x15c));var _0x980d=function(_0x1b36a4,_0xc9f1e){_0x1b36a4=_0x1b36a4-0x0;var _0x16a5b8=_0x80d9[_0x1b36a4];return _0x16a5b8;};'use strict';var jayson=require(_0x980d('0x0'));var BPromise=require('bluebird');var logger=require(_0x980d('0x1'))(_0x980d('0x2'));var client=jayson[_0x980d('0x3')]['http']({'port':0x2329});client[_0x980d('0x4')]=function(_0x3a9d1e,_0x38d1b9){return new BPromise(function(_0x279d93,_0x290800){return client['request'](_0x3a9d1e,_0x38d1b9)['then'](function(_0x2fd4b9){logger['debug']('rpc',_0x980d('0x2'),_0x3a9d1e,_0x38d1b9,_0x2fd4b9);if(_0x2fd4b9[_0x980d('0x5')]){logger[_0x980d('0x5')](_0x980d('0x6'),_0x980d('0x2'),_0x3a9d1e,_0x2fd4b9[_0x980d('0x5')][_0x980d('0x7')],_0x38d1b9);return _0x290800(_0x2fd4b9['error']['message']);}else{return _0x279d93(_0x2fd4b9['result']);}})[_0x980d('0x8')](function(_0x10872c){logger['error'](_0x980d('0x6'),'routing',_0x3a9d1e,_0x10872c,_0x38d1b9);return _0x290800(_0x10872c);});});};module[_0x980d('0x9')]=client; \ No newline at end of file +var _0xd8ee=['debug','rpc','error','message','result','exports','jayson/promise','../../config/logger','routing','client','Request','request'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x1c6d8a,_0x4069eb){_0x1c6d8a=_0x1c6d8a-0x0;var _0x4396aa=_0xd8ee[_0x1c6d8a];return _0x4396aa;};'use strict';var jayson=require(_0xed8e('0x0'));var BPromise=require('bluebird');var logger=require(_0xed8e('0x1'))(_0xed8e('0x2'));var client=jayson[_0xed8e('0x3')]['http']({'port':0x2329});client[_0xed8e('0x4')]=function(_0x3db0fb,_0x3402ae){return new BPromise(function(_0x35aed7,_0x474f12){return client[_0xed8e('0x5')](_0x3db0fb,_0x3402ae)['then'](function(_0x3a030a){logger[_0xed8e('0x6')](_0xed8e('0x7'),_0xed8e('0x2'),_0x3db0fb,_0x3402ae,_0x3a030a);if(_0x3a030a[_0xed8e('0x8')]){logger[_0xed8e('0x8')](_0xed8e('0x7'),'routing',_0x3db0fb,_0x3a030a['error'][_0xed8e('0x9')],_0x3402ae);return _0x474f12(_0x3a030a['error']['message']);}else{return _0x35aed7(_0x3a030a[_0xed8e('0xa')]);}})['catch'](function(_0x7357ad){logger[_0xed8e('0x8')]('rpc',_0xed8e('0x2'),_0x3db0fb,_0x7357ad,_0x3402ae);return _0x474f12(_0x7357ad);});});};module[_0xed8e('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 21849c8..d44461d 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 _0x878f=['./lib/email','./rpc/mailAccount','getMailAccounts','then','initMailAccounts','mailAccounts','listen','catch','log','bluebird','./server','./realtime'];(function(_0x5cfd60,_0x49450d){var _0x403303=function(_0x25f533){while(--_0x25f533){_0x5cfd60['push'](_0x5cfd60['shift']());}};_0x403303(++_0x49450d);}(_0x878f,0x11d));var _0xf878=function(_0x2dbd70,_0x35bd80){_0x2dbd70=_0x2dbd70-0x0;var _0x37930d=_0x878f[_0x2dbd70];return _0x37930d;};'use strict';var BPromise=require(_0xf878('0x0'));var server=require(_0xf878('0x1'));var Realtime=require(_0xf878('0x2'));var EmailChannel=require(_0xf878('0x3'));var mailAccount=require(_0xf878('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()['then'](mailAccount[_0xf878('0x5')]())[_0xf878('0x6')](realtime[_0xf878('0x7')]())[_0xf878('0x6')](function(){email['refresh'](realtime[_0xf878('0x8')]);return realtime;});}function main(){return server[_0xf878('0x9')](realtime,email)[_0xf878('0x6')](function(_0x434863){return initRealtime();})['then'](function(_0x267f98){return setInterval(initRealtime,0x2710);})[_0xf878('0xa')](function(_0x2f1923){console[_0xf878('0xb')](_0x2f1923);});}main(); \ No newline at end of file +var _0xbe24=['listen','catch','log','./realtime','./lib/email','./rpc/mailAccount','resolve','then','initMailAccounts','refresh','mailAccounts'];(function(_0x3a7d3f,_0x8bc381){var _0x424e0c=function(_0x2e7b60){while(--_0x2e7b60){_0x3a7d3f['push'](_0x3a7d3f['shift']());}};_0x424e0c(++_0x8bc381);}(_0xbe24,0xd4));var _0x4be2=function(_0x4830e7,_0x33bdca){_0x4830e7=_0x4830e7-0x0;var _0x2ea197=_0xbe24[_0x4830e7];return _0x2ea197;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x4be2('0x0'));var EmailChannel=require(_0x4be2('0x1'));var mailAccount=require(_0x4be2('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x4be2('0x3')]()[_0x4be2('0x4')](mailAccount['getMailAccounts']())[_0x4be2('0x4')](realtime[_0x4be2('0x5')]())[_0x4be2('0x4')](function(){email[_0x4be2('0x6')](realtime[_0x4be2('0x7')]);return realtime;});}function main(){return server[_0x4be2('0x8')](realtime,email)[_0x4be2('0x4')](function(_0xc37f69){return initRealtime();})[_0x4be2('0x4')](function(_0x2f5f38){return setInterval(initRealtime,0x2710);})[_0x4be2('0x9')](function(_0x127e15){console[_0x4be2('0xa')](_0x127e15);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 109f6bd..5e4799f 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 _0x5f2f=['lastSync','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','box','bind','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','name','messages','handleImapEmail','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4f9644,_0x2c1768){_0x4f9644=_0x4f9644-0x0;var _0x152048=_0x5f2f[_0x4f9644];return _0x152048;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var BPromise=require(_0xf5f2('0x2'));var md5=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var config=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));config['redis']=_['defaults'](config[_0xf5f2('0x8')],{'host':_0xf5f2('0x9'),'port':0x18eb});var io=require(_0xf5f2('0xa'))(new Redis(config[_0xf5f2('0x8')]));var EmailImap=require(_0xf5f2('0xb'));var EmailSmtp=require(_0xf5f2('0xc'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x466882){logger[_0xf5f2('0xd')](_0xf5f2('0xe'));this['mailAccounts']=_0x466882[_0xf5f2('0xf')];this[_0xf5f2('0x10')]={};this[_0xf5f2('0x11')]=new EmailSmtp();}EmailChannel['prototype'][_0xf5f2('0x12')]=function(_0x4ebbbe){var _0x53fb33=this[_0xf5f2('0xf')][_0x4ebbbe];var _0x151aba={'id':_0x53fb33['id'],'name':_0x53fb33['name'],'key':_0x53fb33[_0xf5f2('0x13')],'active':_0x53fb33[_0xf5f2('0x14')],'Imap':{'status':_0x53fb33[_0xf5f2('0x15')][_0xf5f2('0x16')],'messageStatus':_0x53fb33[_0xf5f2('0x15')][_0xf5f2('0x17')],'total':_0x53fb33['Imap'][_0xf5f2('0x18')]}};if(_[_0xf5f2('0x19')](md5Accounts[_0x4ebbbe])){md5Accounts[_0x4ebbbe]={};}var _0x269909=md5(JSON[_0xf5f2('0x1a')](_0x151aba));if(md5Accounts[_0x4ebbbe][_0xf5f2('0x3')]!==_0x269909){md5Accounts[_0x4ebbbe]['md5']=_0x269909;io[_0xf5f2('0x12')](_0xf5f2('0x1b'),_0x151aba);}};EmailChannel[_0xf5f2('0x1c')][_0xf5f2('0x1d')]=function(_0x23e23a){for(var _0x3a9dbb in _0x23e23a){if(_0x23e23a[_0xf5f2('0x1e')](_0x3a9dbb)){if(_0x23e23a[_0x3a9dbb][_0xf5f2('0x15')]&&_0x23e23a[_0x3a9dbb][_0xf5f2('0x14')]){var _0x228ace=_0x23e23a[_0x3a9dbb][_0xf5f2('0x15')];if(!this[_0xf5f2('0x10')][_0xf5f2('0x1e')](_0x228ace['id'])){this[_0xf5f2('0x10')][_0x228ace['id']]=new EmailImap(_0x228ace,_0x23e23a[_0x3a9dbb][_0xf5f2('0x7')]);this[_0xf5f2('0x10')][_0x228ace['id']]['on'](_0xf5f2('0x1f'),this['handleImapBox'][_0xf5f2('0x20')](this,_0x3a9dbb));this[_0xf5f2('0x10')][_0x228ace['id']]['on']('email',this['handleImapEmail'][_0xf5f2('0x20')](this,_0x3a9dbb));this[_0xf5f2('0x10')][_0x228ace['id']]['on']('end',this[_0xf5f2('0x21')][_0xf5f2('0x20')](this,_0x3a9dbb));this[_0xf5f2('0x10')][_0x228ace['id']]['on'](_0xf5f2('0x22'),this[_0xf5f2('0x23')]['bind'](this,_0x3a9dbb));}}else{if(_[_0xf5f2('0x19')](this[_0xf5f2('0xf')][_0x3a9dbb][_0xf5f2('0x15')])){this[_0xf5f2('0xf')][_0x3a9dbb][_0xf5f2('0x15')]={};}this['mailAccounts'][_0x3a9dbb]['Imap'][_0xf5f2('0x16')]=_0xf5f2('0x24');this[_0xf5f2('0xf')][_0x3a9dbb][_0xf5f2('0x15')][_0xf5f2('0x17')]='';this[_0xf5f2('0x12')](_0x3a9dbb);}}}};EmailChannel[_0xf5f2('0x1c')][_0xf5f2('0x25')]=function(_0x294414,_0x4ab014){if(this[_0xf5f2('0xf')][_0x294414]){this[_0xf5f2('0xf')][_0x294414][_0xf5f2('0x15')][_0xf5f2('0x16')]=_0xf5f2('0x26');this[_0xf5f2('0xf')][_0x294414]['Imap']['messageStatus']=_0x4ab014[_0xf5f2('0x27')];if(_0x4ab014[_0xf5f2('0x28')]){this[_0xf5f2('0xf')][_0x294414]['Imap']['total']=_0x4ab014[_0xf5f2('0x28')][_0xf5f2('0x18')];}return this[_0xf5f2('0x12')](_0x294414);}};EmailChannel[_0xf5f2('0x1c')][_0xf5f2('0x29')]=function(_0x54c0c8,_0x52e959){logger[_0xf5f2('0xd')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x52e959[_0xf5f2('0x2a')],_0x52e959['lastName'],_0x52e959[_0xf5f2('0x2b')],_0x54c0c8);if(this[_0xf5f2('0xf')][_0x54c0c8]){return mailAccount[_0xf5f2('0x2c')](_0x54c0c8,_0x52e959)[_0xf5f2('0x2d')](function(_0x256bd9){if(_0x256bd9){logger[_0xf5f2('0xd')](_0xf5f2('0x2e'));}})[_0xf5f2('0x2f')](function(_0x5ca917){logger[_0xf5f2('0x22')](_0xf5f2('0x30'),JSON[_0xf5f2('0x1a')](_0x5ca917));});}};EmailChannel[_0xf5f2('0x1c')][_0xf5f2('0x21')]=function(_0x27c0e7){if(this[_0xf5f2('0xf')][_0x27c0e7]&&this['mailAccounts'][_0x27c0e7][_0xf5f2('0x15')]){if(this[_0xf5f2('0x10')][this['mailAccounts'][_0x27c0e7][_0xf5f2('0x15')]['id']]){delete this['imapAccounts'][this[_0xf5f2('0xf')][_0x27c0e7][_0xf5f2('0x15')]['id']];}this[_0xf5f2('0xf')][_0x27c0e7][_0xf5f2('0x15')]['lastSync']=moment();this['emit'](_0x27c0e7);}};EmailChannel[_0xf5f2('0x1c')][_0xf5f2('0x23')]=function(_0x20eb74,_0x4ec8fb){if(this[_0xf5f2('0xf')][_0x20eb74]){this['mailAccounts'][_0x20eb74][_0xf5f2('0x15')]['status']=_0xf5f2('0x22');this[_0xf5f2('0xf')][_0x20eb74]['Imap'][_0xf5f2('0x17')]=_0x4ec8fb;return this[_0xf5f2('0x12')](_0x20eb74);}};EmailChannel[_0xf5f2('0x1c')][_0xf5f2('0x31')]=function(_0x542cd6,_0x5d2d82){return this[_0xf5f2('0x11')][_0xf5f2('0x32')](_0x542cd6,_0x5d2d82);};EmailChannel[_0xf5f2('0x1c')][_0xf5f2('0x33')]=function(_0x2c7f65){var _0xe62b57=this;if(this[_0xf5f2('0xf')][_0x2c7f65['id']]){if(_['isNil'](this[_0xf5f2('0xf')][_0x2c7f65['id']][_0xf5f2('0x34')])){this['mailAccounts'][_0x2c7f65['id']][_0xf5f2('0x34')]={};}this[_0xf5f2('0xf')][_0x2c7f65['id']][_0xf5f2('0x34')][_0xf5f2('0x35')]=moment();return new BPromise(function(_0xd10701,_0x3b6372){return _0xe62b57[_0xf5f2('0x11')][_0xf5f2('0x36')](_0x2c7f65)['then'](function(_0x31c3c){_0xe62b57[_0xf5f2('0xf')][_0x2c7f65['id']][_0xf5f2('0x34')]['status']='verified';_0xe62b57['mailAccounts'][_0x2c7f65['id']][_0xf5f2('0x34')][_0xf5f2('0x17')]='';_0xe62b57['emit'](_0x2c7f65['id']);_0xd10701(_0x31c3c);})[_0xf5f2('0x2f')](function(_0xeed03d){_0xe62b57[_0xf5f2('0xf')][_0x2c7f65['id']][_0xf5f2('0x34')][_0xf5f2('0x16')]=_0xf5f2('0x22');_0xe62b57[_0xf5f2('0xf')][_0x2c7f65['id']][_0xf5f2('0x34')][_0xf5f2('0x17')]=_0xeed03d;_0xe62b57[_0xf5f2('0x12')](_0x2c7f65['id']);_0x3b6372(_0xeed03d);});});}return this[_0xf5f2('0x11')][_0xf5f2('0x36')](_0x2c7f65);};module[_0xf5f2('0x37')]=EmailChannel; \ No newline at end of file +var _0x53ec=['email','defaults','redis','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','status','total','isNil','stringify','mailAccount:update','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','messageStatus','connected','messages','firstName','from','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment'];(function(_0xbd9e5d,_0x26c392){var _0x4f580c=function(_0x108136){while(--_0x108136){_0xbd9e5d['push'](_0xbd9e5d['shift']());}};_0x4f580c(++_0x26c392);}(_0x53ec,0x192));var _0xc53e=function(_0x113dd1,_0x15aaa1){_0x113dd1=_0x113dd1-0x0;var _0x1605e0=_0x53ec[_0x113dd1];return _0x1605e0;};'use strict';var _=require(_0xc53e('0x0'));var moment=require(_0xc53e('0x1'));var BPromise=require(_0xc53e('0x2'));var md5=require(_0xc53e('0x3'));var Redis=require(_0xc53e('0x4'));var config=require(_0xc53e('0x5'));var logger=require('../../../config/logger')(_0xc53e('0x6'));config['redis']=_[_0xc53e('0x7')](config[_0xc53e('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc53e('0x9'))(new Redis(config['redis']));var EmailImap=require(_0xc53e('0xa'));var EmailSmtp=require(_0xc53e('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x1616ac){logger[_0xc53e('0xc')](_0xc53e('0xd'));this[_0xc53e('0xe')]=_0x1616ac[_0xc53e('0xe')];this[_0xc53e('0xf')]={};this[_0xc53e('0x10')]=new EmailSmtp();}EmailChannel[_0xc53e('0x11')][_0xc53e('0x12')]=function(_0x4b7cfa){var _0x57e818=this[_0xc53e('0xe')][_0x4b7cfa];var _0x5a2da7={'id':_0x57e818['id'],'name':_0x57e818['name'],'key':_0x57e818[_0xc53e('0x13')],'active':_0x57e818[_0xc53e('0x14')],'Imap':{'status':_0x57e818[_0xc53e('0x15')][_0xc53e('0x16')],'messageStatus':_0x57e818['Imap']['messageStatus'],'total':_0x57e818[_0xc53e('0x15')][_0xc53e('0x17')]}};if(_[_0xc53e('0x18')](md5Accounts[_0x4b7cfa])){md5Accounts[_0x4b7cfa]={};}var _0x3d2e17=md5(JSON[_0xc53e('0x19')](_0x5a2da7));if(md5Accounts[_0x4b7cfa][_0xc53e('0x3')]!==_0x3d2e17){md5Accounts[_0x4b7cfa][_0xc53e('0x3')]=_0x3d2e17;io[_0xc53e('0x12')](_0xc53e('0x1a'),_0x5a2da7);}};EmailChannel[_0xc53e('0x11')]['refresh']=function(_0x8a522e){for(var _0x191567 in _0x8a522e){if(_0x8a522e[_0xc53e('0x1b')](_0x191567)){if(_0x8a522e[_0x191567][_0xc53e('0x15')]&&_0x8a522e[_0x191567][_0xc53e('0x14')]){var _0x270c78=_0x8a522e[_0x191567][_0xc53e('0x15')];if(!this[_0xc53e('0xf')][_0xc53e('0x1b')](_0x270c78['id'])){this['imapAccounts'][_0x270c78['id']]=new EmailImap(_0x270c78,_0x8a522e[_0x191567]['email']);this[_0xc53e('0xf')][_0x270c78['id']]['on'](_0xc53e('0x1c'),this[_0xc53e('0x1d')][_0xc53e('0x1e')](this,_0x191567));this[_0xc53e('0xf')][_0x270c78['id']]['on'](_0xc53e('0x6'),this[_0xc53e('0x1f')][_0xc53e('0x1e')](this,_0x191567));this[_0xc53e('0xf')][_0x270c78['id']]['on'](_0xc53e('0x20'),this[_0xc53e('0x21')][_0xc53e('0x1e')](this,_0x191567));this[_0xc53e('0xf')][_0x270c78['id']]['on']('error',this['handleImapError']['bind'](this,_0x191567));}}else{if(_[_0xc53e('0x18')](this[_0xc53e('0xe')][_0x191567][_0xc53e('0x15')])){this[_0xc53e('0xe')][_0x191567][_0xc53e('0x15')]={};}this['mailAccounts'][_0x191567]['Imap'][_0xc53e('0x16')]='disabled';this[_0xc53e('0xe')][_0x191567][_0xc53e('0x15')][_0xc53e('0x22')]='';this[_0xc53e('0x12')](_0x191567);}}}};EmailChannel[_0xc53e('0x11')]['handleImapBox']=function(_0x398e7a,_0x4b9f6a){if(this['mailAccounts'][_0x398e7a]){this['mailAccounts'][_0x398e7a][_0xc53e('0x15')]['status']=_0xc53e('0x23');this['mailAccounts'][_0x398e7a][_0xc53e('0x15')]['messageStatus']=_0x4b9f6a['name'];if(_0x4b9f6a[_0xc53e('0x24')]){this[_0xc53e('0xe')][_0x398e7a][_0xc53e('0x15')][_0xc53e('0x17')]=_0x4b9f6a[_0xc53e('0x24')][_0xc53e('0x17')];}return this[_0xc53e('0x12')](_0x398e7a);}};EmailChannel[_0xc53e('0x11')]['handleImapEmail']=function(_0x437893,_0x311835){logger[_0xc53e('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x311835[_0xc53e('0x25')],_0x311835['lastName'],_0x311835[_0xc53e('0x26')],_0x437893);if(this[_0xc53e('0xe')][_0x437893]){return mailAccount['notify'](_0x437893,_0x311835)['then'](function(_0x3cd8a1){if(_0x3cd8a1){logger[_0xc53e('0xc')](_0xc53e('0x27'));}})[_0xc53e('0x28')](function(_0x1b95c2){logger[_0xc53e('0x29')](_0xc53e('0x2a'),JSON[_0xc53e('0x19')](_0x1b95c2));});}};EmailChannel['prototype'][_0xc53e('0x21')]=function(_0x3bae8a){if(this[_0xc53e('0xe')][_0x3bae8a]&&this[_0xc53e('0xe')][_0x3bae8a][_0xc53e('0x15')]){if(this[_0xc53e('0xf')][this[_0xc53e('0xe')][_0x3bae8a][_0xc53e('0x15')]['id']]){delete this[_0xc53e('0xf')][this['mailAccounts'][_0x3bae8a][_0xc53e('0x15')]['id']];}this['mailAccounts'][_0x3bae8a][_0xc53e('0x15')][_0xc53e('0x2b')]=moment();this['emit'](_0x3bae8a);}};EmailChannel[_0xc53e('0x11')][_0xc53e('0x2c')]=function(_0x3254e9,_0x5ed90b){if(this[_0xc53e('0xe')][_0x3254e9]){this[_0xc53e('0xe')][_0x3254e9][_0xc53e('0x15')][_0xc53e('0x16')]=_0xc53e('0x29');this[_0xc53e('0xe')][_0x3254e9][_0xc53e('0x15')]['messageStatus']=_0x5ed90b;return this[_0xc53e('0x12')](_0x3254e9);}};EmailChannel[_0xc53e('0x11')][_0xc53e('0x2d')]=function(_0x5d35b0,_0x70b6c3){return this['smtp'][_0xc53e('0x2e')](_0x5d35b0,_0x70b6c3);};EmailChannel[_0xc53e('0x11')][_0xc53e('0x2f')]=function(_0xad1232){var _0x3036e7=this;if(this['mailAccounts'][_0xad1232['id']]){if(_[_0xc53e('0x18')](this[_0xc53e('0xe')][_0xad1232['id']]['Smtp'])){this['mailAccounts'][_0xad1232['id']]['Smtp']={};}this['mailAccounts'][_0xad1232['id']][_0xc53e('0x30')][_0xc53e('0x2b')]=moment();return new BPromise(function(_0x49bd2c,_0x460ee6){return _0x3036e7['smtp']['verify'](_0xad1232)['then'](function(_0x255794){_0x3036e7['mailAccounts'][_0xad1232['id']]['Smtp'][_0xc53e('0x16')]='verified';_0x3036e7[_0xc53e('0xe')][_0xad1232['id']][_0xc53e('0x30')]['messageStatus']='';_0x3036e7[_0xc53e('0x12')](_0xad1232['id']);_0x49bd2c(_0x255794);})[_0xc53e('0x28')](function(_0x509a04){_0x3036e7[_0xc53e('0xe')][_0xad1232['id']]['Smtp']['status']='error';_0x3036e7['mailAccounts'][_0xad1232['id']][_0xc53e('0x30')][_0xc53e('0x22')]=_0x509a04;_0x3036e7[_0xc53e('0x12')](_0xad1232['id']);_0x460ee6(_0x509a04);});});}return this['smtp'][_0xc53e('0x31')](_0xad1232);};module[_0xc53e('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 41a3965..f96d288 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 _0x1667=['email','anonymous@xcally.com','openBox','handleOpenBox','box','handleCloseBox','end','readUnseen','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','emit','stringify','hasOwnProperty','exports','path','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','account','getAccount','once','bind','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','password','host','port','tls','required','getHost'];(function(_0x1dae71,_0x2dec32){var _0x281f2e=function(_0x2c5828){while(--_0x2c5828){_0x1dae71['push'](_0x1dae71['shift']());}};_0x281f2e(++_0x2dec32);}(_0x1667,0xfd));var _0x7166=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0x1667[_0x86b219];return _0x1f320c;};'use strict';var fs=require('fs');var path=require(_0x7166('0x0'));var util=require(_0x7166('0x1'));var Imap=require(_0x7166('0x2'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0x7166('0x3'))[_0x7166('0x4')];var Iconv=require(_0x7166('0x5'))[_0x7166('0x6')];var EventEmitter=require('events')[_0x7166('0x7')];var utils=require(_0x7166('0x8'));var logger=require(_0x7166('0x9'))('email');function EmailImap(_0x479d81,_0x2ff9e5){this[_0x7166('0xa')]=_0x7166('0xb');this[_0x7166('0xc')]=this[_0x7166('0xd')](_0x479d81,_0x2ff9e5);this[_0x7166('0x2')]=new Imap(this[_0x7166('0xc')]);this[_0x7166('0x2')][_0x7166('0xe')]('ready',this['handleReady'][_0x7166('0xf')](this));this[_0x7166('0x2')][_0x7166('0xe')]('end',this[_0x7166('0x10')][_0x7166('0xf')](this));this['imap']['on'](_0x7166('0x11'),this[_0x7166('0x12')][_0x7166('0xf')](this));this['imap'][_0x7166('0x13')]();}util[_0x7166('0x14')](EmailImap,EventEmitter);EmailImap[_0x7166('0x15')][_0x7166('0xd')]=function(_0x75b1d7,_0x5a1d81){var _0xb25588={'connTimeout':_0x75b1d7[_0x7166('0x16')]?_0x75b1d7[_0x7166('0x16')]*0x3e8:0x2710,'authTimeout':_0x75b1d7[_0x7166('0x17')]?_0x75b1d7[_0x7166('0x17')]*0x3e8:0x1388};if(_['isNil'](_0x75b1d7[_0x7166('0x18')])){if(_0x75b1d7['authentication']){_0xb25588[_0x7166('0x19')]=_0x75b1d7[_0x7166('0x19')];_0xb25588[_0x7166('0x1a')]=_0x75b1d7['password'];}_0xb25588[_0x7166('0x1b')]=_0x75b1d7[_0x7166('0x1b')];_0xb25588['port']=_0x75b1d7[_0x7166('0x1c')]||0x3e1;if(_0x75b1d7[_0x7166('0x1d')]){_0xb25588[_0x7166('0x1d')]=!![];}else{_0xb25588[_0x7166('0x1d')]=![];_0xb25588['autotls']=_0x7166('0x1e');}}else{_0xb25588[_0x7166('0x19')]=_0x75b1d7[_0x7166('0x19')];_0xb25588['password']=_0x75b1d7[_0x7166('0x1a')];_0xb25588[_0x7166('0x1b')]=utils[_0x7166('0x1f')](_0x75b1d7[_0x7166('0x18')]);_0xb25588['port']=0x3e1;_0xb25588[_0x7166('0x1d')]=!![];}_0xb25588[_0x7166('0x20')]=_0x5a1d81||_0x75b1d7[_0x7166('0x19')]||_0x7166('0x21');return _0xb25588;};EmailImap[_0x7166('0x15')]['handleReady']=function(){this[_0x7166('0x2')][_0x7166('0x22')](this[_0x7166('0xa')],![],this[_0x7166('0x23')]['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0x3a914d,_0x83c2c5){if(_0x3a914d){this['handleError'](_0x3a914d,!![]);}else{this['emit'](_0x7166('0x24'),_0x83c2c5);this['readUnseen']();}};EmailImap['prototype'][_0x7166('0x25')]=function(_0x288ed4){if(_0x288ed4){this['handleError'](_0x288ed4,!![]);}else{this['imap'][_0x7166('0x26')]();}};EmailImap[_0x7166('0x15')][_0x7166('0x27')]=function(){this[_0x7166('0x2')]['search']([_0x7166('0x28')],this[_0x7166('0x29')]['bind'](this));};EmailImap[_0x7166('0x15')][_0x7166('0x29')]=function(_0x424eed,_0x18ef18){if(_0x424eed){this['handleError'](_0x424eed,!![]);}else{if(_0x18ef18[_0x7166('0x2a')]){try{var _0x260c78=this[_0x7166('0x2')]['fetch'](_0x18ef18,{'bodies':'','markSeen':!![]});_0x260c78['on'](_0x7166('0x2b'),this[_0x7166('0x2c')]['bind'](this));_0x260c78[_0x7166('0xe')](_0x7166('0x11'),this[_0x7166('0x2d')][_0x7166('0xf')](this));_0x260c78['once'](_0x7166('0x26'),this[_0x7166('0x2e')][_0x7166('0xf')](this));}catch(_0x2c57e5){logger[_0x7166('0x11')](_0x2c57e5);}}else{this[_0x7166('0x2')][_0x7166('0x2f')](!![],this[_0x7166('0x25')][_0x7166('0xf')](this));}}};EmailImap[_0x7166('0x15')][_0x7166('0x2c')]=function(_0xb3e679,_0x2b79e9){_0xb3e679['on'](_0x7166('0x30'),this[_0x7166('0x31')]['bind'](this));_0xb3e679[_0x7166('0xe')]('attributes',this['handleMessageAttributes']['bind'](this));_0xb3e679[_0x7166('0xe')](_0x7166('0x26'),this['handleMessageEnd'][_0x7166('0xf')](this));};EmailImap[_0x7166('0x15')]['handleMessageBody']=function(_0x40e19e,_0xf11394){simpleParser(_0x40e19e,{'Iconv':Iconv},this['handleSimpleParser'][_0x7166('0xf')](this));};EmailImap[_0x7166('0x15')][_0x7166('0x32')]=function(_0x5e0cdf){};EmailImap[_0x7166('0x15')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0x7166('0x33')]=function(_0x4d3569,_0xbbde1c){if(_0x4d3569){logger[_0x7166('0x11')](_0x4d3569);}else{var _0x2a2262=this;utils[_0x7166('0x34')](this[_0x7166('0xc')],_0xbbde1c,function(_0x3ea80f){_0x2a2262[_0x7166('0x35')](_0x7166('0x20'),_0x3ea80f);});}};EmailImap[_0x7166('0x15')][_0x7166('0x2e')]=function(){this['imap']['closeBox'](!![],this[_0x7166('0x25')]['bind'](this));};EmailImap['prototype'][_0x7166('0x2d')]=function(_0xd39b09){this[_0x7166('0x12')](_0xd39b09);this[_0x7166('0x2')]['closeBox'](!![],this[_0x7166('0x25')][_0x7166('0xf')](this));};EmailImap[_0x7166('0x15')][_0x7166('0x10')]=function(){this[_0x7166('0x35')]('end');};EmailImap[_0x7166('0x15')][_0x7166('0x12')]=function(_0x4d951b,_0x1b6d18){logger[_0x7166('0x11')](_0x7166('0x12'),this[_0x7166('0xc')][_0x7166('0x20')],JSON[_0x7166('0x36')](_0x4d951b));var _0x3c2251='';if(_0x4d951b){if(_0x4d951b['textCode']){_0x3c2251=_0x4d951b['textCode'];}else{for(var _0x170535 in _0x4d951b){if(_0x4d951b[_0x7166('0x37')](_0x170535)){_0x3c2251+=_['upperFirst'](_0x170535)+':\x20'+_0x4d951b[_0x170535]+'\x0a';}}}}if(_0x1b6d18){this[_0x7166('0x2')]['end']();}else{this[_0x7166('0x35')]('error',_0x3c2251);this[_0x7166('0x35')](_0x7166('0x26'));}};module[_0x7166('0x38')]=EmailImap; \ No newline at end of file +var _0xe844=['events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','end','handleEnd','bind','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','host','port','tls','required','password','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode','upperFirst','exports','path','util','imap','mailparser','iconv','Iconv'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0xe844,0xba));var _0x4e84=function(_0x5e462e,_0x5b9aa7){_0x5e462e=_0x5e462e-0x0;var _0x4ce663=_0xe844[_0x5e462e];return _0x4ce663;};'use strict';var fs=require('fs');var path=require(_0x4e84('0x0'));var util=require(_0x4e84('0x1'));var Imap=require(_0x4e84('0x2'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0x4e84('0x3'))['simpleParser'];var Iconv=require(_0x4e84('0x4'))[_0x4e84('0x5')];var EventEmitter=require(_0x4e84('0x6'))[_0x4e84('0x7')];var utils=require('./utils');var logger=require(_0x4e84('0x8'))(_0x4e84('0x9'));function EmailImap(_0x19a679,_0x41d6b0){this[_0x4e84('0xa')]=_0x4e84('0xb');this[_0x4e84('0xc')]=this[_0x4e84('0xd')](_0x19a679,_0x41d6b0);this[_0x4e84('0x2')]=new Imap(this['account']);this[_0x4e84('0x2')][_0x4e84('0xe')](_0x4e84('0xf'),this[_0x4e84('0x10')]['bind'](this));this[_0x4e84('0x2')][_0x4e84('0xe')](_0x4e84('0x11'),this[_0x4e84('0x12')][_0x4e84('0x13')](this));this[_0x4e84('0x2')]['on']('error',this[_0x4e84('0x14')][_0x4e84('0x13')](this));this[_0x4e84('0x2')][_0x4e84('0x15')]();}util[_0x4e84('0x16')](EmailImap,EventEmitter);EmailImap[_0x4e84('0x17')][_0x4e84('0xd')]=function(_0x354062,_0x96befa){var _0x4b5081={'connTimeout':_0x354062[_0x4e84('0x18')]?_0x354062['connTimeout']*0x3e8:0x2710,'authTimeout':_0x354062[_0x4e84('0x19')]?_0x354062[_0x4e84('0x19')]*0x3e8:0x1388};if(_[_0x4e84('0x1a')](_0x354062[_0x4e84('0x1b')])){if(_0x354062[_0x4e84('0x1c')]){_0x4b5081['user']=_0x354062[_0x4e84('0x1d')];_0x4b5081['password']=_0x354062['password'];}_0x4b5081[_0x4e84('0x1e')]=_0x354062[_0x4e84('0x1e')];_0x4b5081[_0x4e84('0x1f')]=_0x354062[_0x4e84('0x1f')]||0x3e1;if(_0x354062[_0x4e84('0x20')]){_0x4b5081[_0x4e84('0x20')]=!![];}else{_0x4b5081[_0x4e84('0x20')]=![];_0x4b5081['autotls']=_0x4e84('0x21');}}else{_0x4b5081[_0x4e84('0x1d')]=_0x354062[_0x4e84('0x1d')];_0x4b5081[_0x4e84('0x22')]=_0x354062[_0x4e84('0x22')];_0x4b5081[_0x4e84('0x1e')]=utils[_0x4e84('0x23')](_0x354062[_0x4e84('0x1b')]);_0x4b5081['port']=0x3e1;_0x4b5081['tls']=!![];}_0x4b5081[_0x4e84('0x9')]=_0x96befa||_0x354062[_0x4e84('0x1d')]||_0x4e84('0x24');return _0x4b5081;};EmailImap[_0x4e84('0x17')][_0x4e84('0x10')]=function(){this[_0x4e84('0x2')][_0x4e84('0x25')](this['mailbox'],![],this[_0x4e84('0x26')][_0x4e84('0x13')](this));};EmailImap[_0x4e84('0x17')][_0x4e84('0x26')]=function(_0x3bbc7d,_0x5fb1f5){if(_0x3bbc7d){this['handleError'](_0x3bbc7d,!![]);}else{this[_0x4e84('0x27')](_0x4e84('0x28'),_0x5fb1f5);this[_0x4e84('0x29')]();}};EmailImap['prototype'][_0x4e84('0x2a')]=function(_0x49dcd4){if(_0x49dcd4){this[_0x4e84('0x14')](_0x49dcd4,!![]);}else{this[_0x4e84('0x2')][_0x4e84('0x11')]();}};EmailImap[_0x4e84('0x17')][_0x4e84('0x29')]=function(){this[_0x4e84('0x2')][_0x4e84('0x2b')]([_0x4e84('0x2c')],this[_0x4e84('0x2d')][_0x4e84('0x13')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x152e00,_0x45a84c){if(_0x152e00){this[_0x4e84('0x14')](_0x152e00,!![]);}else{if(_0x45a84c[_0x4e84('0x2e')]){try{var _0x12a484=this[_0x4e84('0x2')][_0x4e84('0x2f')](_0x45a84c,{'bodies':'','markSeen':!![]});_0x12a484['on'](_0x4e84('0x30'),this[_0x4e84('0x31')][_0x4e84('0x13')](this));_0x12a484[_0x4e84('0xe')](_0x4e84('0x32'),this[_0x4e84('0x33')]['bind'](this));_0x12a484[_0x4e84('0xe')]('end',this[_0x4e84('0x34')][_0x4e84('0x13')](this));}catch(_0xf7e904){logger['error'](_0xf7e904);}}else{this[_0x4e84('0x2')][_0x4e84('0x35')](!![],this[_0x4e84('0x2a')][_0x4e84('0x13')](this));}}};EmailImap[_0x4e84('0x17')][_0x4e84('0x31')]=function(_0x553537,_0x4f453b){_0x553537['on'](_0x4e84('0x36'),this[_0x4e84('0x37')]['bind'](this));_0x553537[_0x4e84('0xe')](_0x4e84('0x38'),this[_0x4e84('0x39')]['bind'](this));_0x553537['once'](_0x4e84('0x11'),this[_0x4e84('0x3a')]['bind'](this));};EmailImap['prototype'][_0x4e84('0x37')]=function(_0x317f52,_0x5e1264){simpleParser(_0x317f52,{'Iconv':Iconv},this[_0x4e84('0x3b')][_0x4e84('0x13')](this));};EmailImap['prototype'][_0x4e84('0x39')]=function(_0x314311){};EmailImap[_0x4e84('0x17')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0x4e84('0x3b')]=function(_0xd4511e,_0x1ee73e){if(_0xd4511e){logger['error'](_0xd4511e);}else{var _0x1d0acc=this;utils[_0x4e84('0x3c')](this[_0x4e84('0xc')],_0x1ee73e,function(_0x1f6f71){_0x1d0acc[_0x4e84('0x27')]('email',_0x1f6f71);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x4e84('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x4e84('0x13')](this));};EmailImap['prototype']['handleFetchError']=function(_0x1bd61){this[_0x4e84('0x14')](_0x1bd61);this['imap'][_0x4e84('0x35')](!![],this[_0x4e84('0x2a')][_0x4e84('0x13')](this));};EmailImap[_0x4e84('0x17')][_0x4e84('0x12')]=function(){this[_0x4e84('0x27')](_0x4e84('0x11'));};EmailImap['prototype']['handleError']=function(_0x3b5ae2,_0x46ac50){logger[_0x4e84('0x32')](_0x4e84('0x14'),this[_0x4e84('0xc')][_0x4e84('0x9')],JSON['stringify'](_0x3b5ae2));var _0x44df6c='';if(_0x3b5ae2){if(_0x3b5ae2[_0x4e84('0x3d')]){_0x44df6c=_0x3b5ae2[_0x4e84('0x3d')];}else{for(var _0x12994f in _0x3b5ae2){if(_0x3b5ae2['hasOwnProperty'](_0x12994f)){_0x44df6c+=_[_0x4e84('0x3e')](_0x12994f)+':\x20'+_0x3b5ae2[_0x12994f]+'\x0a';}}}}if(_0x46ac50){this['imap'][_0x4e84('0x11')]();}else{this[_0x4e84('0x27')](_0x4e84('0x32'),_0x44df6c);this[_0x4e84('0x27')](_0x4e84('0x11'));}};module[_0x4e84('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8253c23..47f44ff 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 _0x9bfc=['sendMail','toString','prototype','verify','exports','nodemailer','bluebird','createTransport','use','compile'];(function(_0x35c97a,_0x513aba){var _0x388917=function(_0xa1f4e1){while(--_0xa1f4e1){_0x35c97a['push'](_0x35c97a['shift']());}};_0x388917(++_0x513aba);}(_0x9bfc,0x177));var _0xc9bf=function(_0x3f4f44,_0x59b2fd){_0x3f4f44=_0x3f4f44-0x0;var _0x3e2e14=_0x9bfc[_0x3f4f44];return _0x3e2e14;};'use strict';var nodemailer=require(_0xc9bf('0x0'));var BPromise=require(_0xc9bf('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x46213d,_0x42d7c1){return new BPromise(function(_0x1f9606,_0x10a838){var _0x1154d7=nodemailer[_0xc9bf('0x2')](_0x46213d);_0x1154d7[_0xc9bf('0x3')](_0xc9bf('0x4'),inlineBase64());_0x1154d7[_0xc9bf('0x5')](_0x42d7c1,function(_0x2dff52,_0x3c71fc){if(_0x2dff52){_0x10a838(_0x2dff52[_0xc9bf('0x6')]());}else{_0x1f9606(_0x3c71fc);}});});};EmailSmtp[_0xc9bf('0x7')][_0xc9bf('0x8')]=function(_0x32f1e4){return new BPromise(function(_0x181575,_0x25a982){var _0x136cbd=nodemailer[_0xc9bf('0x2')](_0x32f1e4);_0x136cbd[_0xc9bf('0x8')](function(_0x5abc36,_0x455d33){if(_0x5abc36){_0x25a982(_0x5abc36[_0xc9bf('0x6')]());}else{if(_0x455d33){_0x181575(_0x455d33);}else{_0x25a982('Not\x20verifired');}}});});};module[_0xc9bf('0x9')]=EmailSmtp; \ No newline at end of file +var _0xb8a3=['verify','exports','bluebird','nodemailer-plugin-inline-base64','send','use','compile','sendMail','toString','prototype','createTransport'];(function(_0x1f92ad,_0x288ed1){var _0x196d1f=function(_0xa90eb4){while(--_0xa90eb4){_0x1f92ad['push'](_0x1f92ad['shift']());}};_0x196d1f(++_0x288ed1);}(_0xb8a3,0x1f1));var _0x3b8a=function(_0x222481,_0x2f3df6){_0x222481=_0x222481-0x0;var _0x227fb4=_0xb8a3[_0x222481];return _0x227fb4;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x3b8a('0x0'));var inlineBase64=require(_0x3b8a('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x3b8a('0x2')]=function(_0x44028c,_0x410734){return new BPromise(function(_0x401e5c,_0x24a877){var _0x4ad566=nodemailer['createTransport'](_0x44028c);_0x4ad566[_0x3b8a('0x3')](_0x3b8a('0x4'),inlineBase64());_0x4ad566[_0x3b8a('0x5')](_0x410734,function(_0x2aa519,_0x49b682){if(_0x2aa519){_0x24a877(_0x2aa519[_0x3b8a('0x6')]());}else{_0x401e5c(_0x49b682);}});});};EmailSmtp[_0x3b8a('0x7')]['verify']=function(_0x530457){return new BPromise(function(_0x18768d,_0x2f023e){var _0x3daf90=nodemailer[_0x3b8a('0x8')](_0x530457);_0x3daf90[_0x3b8a('0x9')](function(_0x34592c,_0x333eeb){if(_0x34592c){_0x2f023e(_0x34592c[_0x3b8a('0x6')]());}else{if(_0x333eeb){_0x18768d(_0x333eeb);}else{_0x2f023e('Not\x20verifired');}}});});};module[_0x3b8a('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 0f739f9..c60a40a 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 _0x5046=['originCc','includes','bcc','attachments','type','attachment','filename','%s-%s','now','server/files/attachments/','writeFileSync','content','push','contentType','parser','from','subject','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','anonymous','@xcally.com','name','split','length','slice','join','Anonymous','pop','address','isEmpty','generate','html','test','replace','body','textAsHtml','0x1?_0x3a60a9[_0x6504('0x13')]():'';}return'';}function getMails(_0x2b199e,_0x255b57){var _0x3df07c='';for(var _0x6b9e02=0x0;_0x6b9e02<_0x255b57['value'][_0x6504('0xf')];_0x6b9e02+=0x1){if(_0x255b57[_0x6504('0xa')][_0x6b9e02][_0x6504('0x14')]!==_0x2b199e){if(!_[_0x6504('0x15')](_0x3df07c)){_0x3df07c+=',';}_0x3df07c+=_0x255b57[_0x6504('0xa')][_0x6b9e02][_0x6504('0xd')]||_0x255b57[_0x6504('0xa')][_0x6b9e02]['address']||'';_0x3df07c+='\x20<';_0x3df07c+=_0x255b57[_0x6504('0xa')][_0x6b9e02]['address']?_0x255b57[_0x6504('0xa')][_0x6b9e02]['address']:_0x6504('0xb')+random[_0x6504('0x16')](0x6)+'@xcally.com';_0x3df07c+='>';}}return _0x3df07c;}function parseEmail(_0x351ff1,_0x2c2670,_0x240a00){if(_0x2c2670[_0x6504('0x17')]){var _0x365738=/)<[^<]*)*<\/script>/gi;while(_0x365738[_0x6504('0x18')](_0x2c2670[_0x6504('0x17')])){_0x2c2670['html']=_0x2c2670[_0x6504('0x17')][_0x6504('0x19')](_0x365738,'');}_0x240a00[_0x6504('0x1a')]=_0x2c2670[_0x6504('0x17')];}else{_0x240a00[_0x6504('0x1a')]=_0x2c2670[_0x6504('0x1b')];}if(_0x240a00[_0x6504('0x1a')]){_0x240a00[_0x6504('0x1a')]=_0x240a00[_0x6504('0x1a')]['replace'](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','path'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x3396,0x17d));var _0x6339=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3396[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x6339('0x0'));var moment=require(_0x6339('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x6339('0x2'));var util=require(_0x6339('0x3'));var tnef=require('node-tnef');var logger=require(_0x6339('0x4'))(_0x6339('0x5'));var config=require(_0x6339('0x6'));function getAddress(_0x26d847){var _0x26ff49=_[_0x6339('0x7')](_0x26d847[_0x6339('0x8')]);return _0x26ff49&&_0x26ff49[_0x6339('0x9')]?_0x26ff49[_0x6339('0x9')]:'anonymous'+random[_0x6339('0xa')](0x6)+_0x6339('0xb');}function getFirstName(_0x1b009c){var _0xda783=_[_0x6339('0x7')](_0x1b009c['value']);if(_0xda783&&_0xda783['name']){var _0x88de32=_0xda783[_0x6339('0xc')]['split'](/\s+/);return _0x88de32[_0x6339('0xd')]?_0x88de32['slice'](0x0,-0x1)[_0x6339('0xe')]('\x20'):_0xda783[_0x6339('0xc')];}return'Anonymous';}function getLastName(_0xb7aedb){var _0x46b9ab=_['head'](_0xb7aedb[_0x6339('0x8')]);if(_0x46b9ab&&_0x46b9ab[_0x6339('0xc')]){var _0x2a68c3=_0x46b9ab[_0x6339('0xc')][_0x6339('0xf')](/\s+/);return _0x2a68c3[_0x6339('0xd')]>0x1?_0x2a68c3[_0x6339('0x10')]():'';}return'';}function getMails(_0x532b67,_0x1c54e7){var _0x48de3e='';for(var _0x2d0c85=0x0;_0x2d0c85<_0x1c54e7[_0x6339('0x8')]['length'];_0x2d0c85+=0x1){if(_0x1c54e7['value'][_0x2d0c85][_0x6339('0x9')]!==_0x532b67){if(!_[_0x6339('0x11')](_0x48de3e)){_0x48de3e+=',';}_0x48de3e+=_0x1c54e7[_0x6339('0x8')][_0x2d0c85][_0x6339('0xc')]||_0x1c54e7[_0x6339('0x8')][_0x2d0c85]['address']||'';_0x48de3e+='\x20<';_0x48de3e+=_0x1c54e7[_0x6339('0x8')][_0x2d0c85][_0x6339('0x9')]?_0x1c54e7[_0x6339('0x8')][_0x2d0c85]['address']:'anonymous'+random['generate'](0x6)+_0x6339('0xb');_0x48de3e+='>';}}return _0x48de3e;}function parseEmail(_0xd74f90,_0x1fc7bb,_0x510d67){if(_0x1fc7bb[_0x6339('0x12')]){var _0x3e88c0=/)<[^<]*)*<\/script>/gi;while(_0x3e88c0[_0x6339('0x13')](_0x1fc7bb[_0x6339('0x12')])){_0x1fc7bb[_0x6339('0x12')]=_0x1fc7bb[_0x6339('0x12')]['replace'](_0x3e88c0,'');}_0x510d67[_0x6339('0x14')]=_0x1fc7bb['html'];}else{_0x510d67[_0x6339('0x14')]=_0x1fc7bb[_0x6339('0x15')];}if(_0x510d67[_0x6339('0x14')]){_0x510d67[_0x6339('0x14')]=_0x510d67[_0x6339('0x14')][_0x6339('0x16')](/0x0){if(this[_0x1c9bad+_0xba9f('0x26')]>0x0&&this[_0x1c9bad+_0xba9f('0x25')]>=this[_0x1c9bad+_0xba9f('0x26')]){return'maxcapacity';}else{return _0xba9f('0x27');}}else{return _0xba9f('0x28');}};Agent[_0xba9f('0x23')][_0xba9f('0x22')]=function(){var _0x13fc7d=[_0xba9f('0x29'),_0xba9f('0x2a'),'openchannel','fax',_0xba9f('0x2b')];for(var _0x4a62f7=0x0;_0x4a62f7<_0x13fc7d['length'];_0x4a62f7+=0x1){var _0x4bedb2=this[_0xba9f('0x24')](_0x13fc7d[_0x4a62f7]);if(this[_0x13fc7d[_0x4a62f7]+_0xba9f('0x2c')]!==_0x4bedb2){this[_0x13fc7d[_0x4a62f7]+_0xba9f('0x2d')]=_[_0xba9f('0x2e')](moment()[_0xba9f('0x2f')]('x'));}this[_0x13fc7d[_0x4a62f7]+_0xba9f('0x2c')]=_0x4bedb2;}var _0x308136={'id':this['id'],'name':this[_0xba9f('0x30')],'online':this[_0xba9f('0x6')],'voicePause':this['voicePause'],'chatPause':this[_0xba9f('0x8')],'mailPause':this['mailPause'],'smsPause':this[_0xba9f('0xb')],'faxPause':this[_0xba9f('0xa')],'openchannelPause':this[_0xba9f('0xc')],'chatStatus':this[_0xba9f('0xd')],'chatStatusTime':this[_0xba9f('0xf')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xba9f('0x11')],'mailStatus':this[_0xba9f('0x12')],'mailStatusTime':this[_0xba9f('0x13')],'mailCapacity':this[_0xba9f('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xba9f('0x15')],'faxStatusTime':this[_0xba9f('0x16')],'faxCapacity':this[_0xba9f('0x17')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xba9f('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xba9f('0x1c')],'openchannelStatus':this[_0xba9f('0x1d')],'openchannelStatusTime':this[_0xba9f('0x1e')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xba9f('0x20')],'busy':this[_0xba9f('0x21')],'busyQueue':this[_0xba9f('0x31')]};var _0x346406=md5(JSON[_0xba9f('0x32')](_0x308136));if(this[_0xba9f('0x1')]!==_0x346406){this[_0xba9f('0x1')]=_0x346406;io[_0xba9f('0x33')](_0xba9f('0x34'),_0x308136);}};module[_0xba9f('0x35')]=Agent; \ No newline at end of file +var _0xb21e=['mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','prototype','Capacity','working','idle','updateRealtime','mail','openchannel','fax','length','getChannelStatus','StatusTime','toNumber','format','voicePause','chatCurrentCapacity','faxStatusTime','openchannelCurrentCapacity','stringify','emit','lodash','md5','ioredis','../../../config/environment','redis','defaults','name','online','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity'];(function(_0x1f146e,_0x4ae2ad){var _0x35069f=function(_0xf8f9b1){while(--_0xf8f9b1){_0x1f146e['push'](_0x1f146e['shift']());}};_0x35069f(++_0x4ae2ad);}(_0xb21e,0x122));var _0xeb21=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb21e[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xeb21('0x0'));var moment=require('moment');var md5=require(_0xeb21('0x1'));var Redis=require(_0xeb21('0x2'));var config=require(_0xeb21('0x3'));config[_0xeb21('0x4')]=_[_0xeb21('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x578c0c){this['id']=_0x578c0c['id']||0x0;this['name']=_0x578c0c[_0xeb21('0x6')]||'';this[_0xeb21('0x7')]=_0x578c0c[_0xeb21('0x7')]||!![];this['voicePause']=_0x578c0c['voicePause']||![];this[_0xeb21('0x8')]=_0x578c0c[_0xeb21('0x8')]||![];this[_0xeb21('0x9')]=_0x578c0c[_0xeb21('0x9')]||![];this[_0xeb21('0xa')]=_0x578c0c[_0xeb21('0xa')]||![];this['smsPause']=_0x578c0c['smsPause']||![];this[_0xeb21('0xb')]=_0x578c0c['openchannelPause']||![];this[_0xeb21('0xc')]=_0xeb21('0xd');this[_0xeb21('0xe')]=0x0;this['chatCapacity']=_0x578c0c[_0xeb21('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xeb21('0x10')]='unknown';this[_0xeb21('0x11')]=0x0;this[_0xeb21('0x12')]=_0x578c0c[_0xeb21('0x12')]||0x0;this[_0xeb21('0x13')]=0x0;this[_0xeb21('0x14')]='unknown';this['faxStatusTime']=0x0;this[_0xeb21('0x15')]=_0x578c0c['faxCapacity']||0x0;this[_0xeb21('0x16')]=0x0;this[_0xeb21('0x17')]=_0xeb21('0xd');this[_0xeb21('0x18')]=0x0;this['smsCapacity']=_0x578c0c[_0xeb21('0x19')]||0x0;this[_0xeb21('0x1a')]=0x0;this[_0xeb21('0x1b')]='unknown';this[_0xeb21('0x1c')]=0x0;this[_0xeb21('0x1d')]=_0x578c0c['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xeb21('0x1e')]=![];this[_0xeb21('0x1f')]=undefined;this[_0xeb21('0x1')]='';this['updateRealtime']();}Agent[_0xeb21('0x20')]['getChannelStatus']=function(_0x551035){if(this[_0x551035+'CurrentCapacity']>0x0){if(this[_0x551035+'Capacity']>0x0&&this[_0x551035+'CurrentCapacity']>=this[_0x551035+_0xeb21('0x21')]){return'maxcapacity';}else{return _0xeb21('0x22');}}else{return _0xeb21('0x23');}};Agent[_0xeb21('0x20')][_0xeb21('0x24')]=function(){var _0x490159=[_0xeb21('0x25'),'chat',_0xeb21('0x26'),_0xeb21('0x27'),'sms'];for(var _0x2500fb=0x0;_0x2500fb<_0x490159[_0xeb21('0x28')];_0x2500fb+=0x1){var _0x3433ea=this[_0xeb21('0x29')](_0x490159[_0x2500fb]);if(this[_0x490159[_0x2500fb]+'Status']!==_0x3433ea){this[_0x490159[_0x2500fb]+_0xeb21('0x2a')]=_[_0xeb21('0x2b')](moment()[_0xeb21('0x2c')]('x'));}this[_0x490159[_0x2500fb]+'Status']=_0x3433ea;}var _0x258b63={'id':this['id'],'name':this[_0xeb21('0x6')],'online':this[_0xeb21('0x7')],'voicePause':this[_0xeb21('0x2d')],'chatPause':this[_0xeb21('0x8')],'mailPause':this[_0xeb21('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0xeb21('0xa')],'openchannelPause':this[_0xeb21('0xb')],'chatStatus':this[_0xeb21('0xc')],'chatStatusTime':this[_0xeb21('0xe')],'chatCapacity':this[_0xeb21('0xf')],'chatCurrentCapacity':this[_0xeb21('0x2e')],'mailStatus':this[_0xeb21('0x10')],'mailStatusTime':this[_0xeb21('0x11')],'mailCapacity':this[_0xeb21('0x12')],'mailCurrentCapacity':this[_0xeb21('0x13')],'faxStatus':this[_0xeb21('0x14')],'faxStatusTime':this[_0xeb21('0x2f')],'faxCapacity':this[_0xeb21('0x15')],'faxCurrentCapacity':this[_0xeb21('0x16')],'smsStatus':this[_0xeb21('0x17')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xeb21('0x19')],'smsCurrentCapacity':this[_0xeb21('0x1a')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xeb21('0x1c')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xeb21('0x30')],'busy':this[_0xeb21('0x1e')],'busyQueue':this[_0xeb21('0x1f')]};var _0x142280=md5(JSON[_0xeb21('0x31')](_0x258b63));if(this['md5']!==_0x142280){this[_0xeb21('0x1')]=_0x142280;io[_0xeb21('0x32')]('user:save',_0x258b63);}};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 b186e0d..8c33f63 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 _0x759e=['online','chatPause','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length'];(function(_0x1f392d,_0x4d5969){var _0x3d40ab=function(_0x55f7c0){while(--_0x55f7c0){_0x1f392d['push'](_0x1f392d['shift']());}};_0x3d40ab(++_0x4d5969);}(_0x759e,0x1c8));var _0xe759=function(_0x539d20,_0x294837){_0x539d20=_0x539d20-0x0;var _0x248817=_0x759e[_0x539d20];return _0x248817;};'use strict';var _=require(_0xe759('0x0'));var md5=require(_0xe759('0x1'));var util=require(_0xe759('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe759('0x3')]=_[_0xe759('0x4')](config['redis'],{'host':_0xe759('0x5'),'port':0x18eb});var io=require(_0xe759('0x6'))(new Redis(config['redis']));function ChatQueue(_0x31aa75){this['id']=_0x31aa75['id']||0x0;this['name']=_0x31aa75[_0xe759('0x7')]||'';this[_0xe759('0x8')]=_0x31aa75['timeout']||0xa;this[_0xe759('0x9')]=_0x31aa75['strategy']||'beepall';this[_0xe759('0xa')]=_0x31aa75[_0xe759('0xa')];this[_0xe759('0xb')]={};this[_0xe759('0xc')]=0x0;this['md5']='';this[_0xe759('0xd')]();this[_0xe759('0xe')]();}ChatQueue['prototype'][_0xe759('0xd')]=function(){var _0x4522f9=this[_0xe759('0xb')][_0xe759('0xf')];this[_0xe759('0xb')]=_[_0xe759('0x10')](this[_0xe759('0xa')],'id');this[_0xe759('0xb')][_0xe759('0xf')]=_0x4522f9;};ChatQueue['prototype'][_0xe759('0xe')]=function(){this[_0xe759('0x11')]=0x0;this[_0xe759('0x12')]=0x0;for(var _0x35305=0x0;_0x35305=0x0?this['available']:0x0;var _0x1d4b45={'id':this['id'],'available':this[_0xe759('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xe759('0x7')],'paused':this[_0xe759('0x12')],'waiting':this['waiting']};var _0x5939de=md5(JSON[_0xe759('0x17')](_0x1d4b45));if(this[_0xe759('0x1')]!==_0x5939de){this[_0xe759('0x1')]=_0x5939de;io['to'](util[_0xe759('0x18')]('chat:queue:%s',_0x1d4b45[_0xe759('0x7')]))[_0xe759('0x19')](_0xe759('0x1a'),_0x1d4b45);}};module[_0xe759('0x1b')]=ChatQueue; \ No newline at end of file +var _0x7ec8=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online','paused','available','stringify','format','chat:queue:%s','emit'];(function(_0x246eb8,_0x24c0bc){var _0x15c956=function(_0x1fce5c){while(--_0x1fce5c){_0x246eb8['push'](_0x246eb8['shift']());}};_0x15c956(++_0x24c0bc);}(_0x7ec8,0x1ed));var _0x87ec=function(_0x22f4dc,_0x26599c){_0x22f4dc=_0x22f4dc-0x0;var _0x233907=_0x7ec8[_0x22f4dc];return _0x233907;};'use strict';var _=require(_0x87ec('0x0'));var md5=require(_0x87ec('0x1'));var util=require(_0x87ec('0x2'));var Redis=require(_0x87ec('0x3'));var config=require(_0x87ec('0x4'));config[_0x87ec('0x5')]=_[_0x87ec('0x6')](config[_0x87ec('0x5')],{'host':_0x87ec('0x7'),'port':0x18eb});var io=require(_0x87ec('0x8'))(new Redis(config['redis']));function ChatQueue(_0x325aaf){this['id']=_0x325aaf['id']||0x0;this[_0x87ec('0x9')]=_0x325aaf['name']||'';this[_0x87ec('0xa')]=_0x325aaf[_0x87ec('0xa')]||0xa;this['strategy']=_0x325aaf[_0x87ec('0xb')]||'beepall';this[_0x87ec('0xc')]=_0x325aaf[_0x87ec('0xc')];this['mapAgentsId']={};this[_0x87ec('0xd')]=0x0;this[_0x87ec('0x1')]='';this[_0x87ec('0xe')]();this[_0x87ec('0xf')]();}ChatQueue[_0x87ec('0x10')]['updateRouting']=function(){var _0x3a5213=this[_0x87ec('0x11')][_0x87ec('0x12')];this[_0x87ec('0x11')]=_[_0x87ec('0x13')](this[_0x87ec('0xc')],'id');this[_0x87ec('0x11')][_0x87ec('0x12')]=_0x3a5213;};ChatQueue[_0x87ec('0x10')][_0x87ec('0xf')]=function(){this[_0x87ec('0x14')]=0x0;this['paused']=0x0;for(var _0x257345=0x0;_0x257345=0x0?this[_0x87ec('0x18')]:0x0;var _0x13b81f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x87ec('0x14')],'name':this[_0x87ec('0x9')],'paused':this[_0x87ec('0x17')],'waiting':this[_0x87ec('0xd')]};var _0x2e5df0=md5(JSON[_0x87ec('0x19')](_0x13b81f));if(this[_0x87ec('0x1')]!==_0x2e5df0){this[_0x87ec('0x1')]=_0x2e5df0;io['to'](util[_0x87ec('0x1a')](_0x87ec('0x1b'),_0x13b81f[_0x87ec('0x9')]))[_0x87ec('0x1c')]('chat_queue:save',_0x13b81f);}};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 e9e76d7..c847a9a 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 _0xca47=['length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused'];(function(_0x4c18ce,_0x5124d4){var _0x1f3fab=function(_0x3668b1){while(--_0x3668b1){_0x4c18ce['push'](_0x4c18ce['shift']());}};_0x1f3fab(++_0x5124d4);}(_0xca47,0xb7));var _0x7ca4=function(_0x4688f4,_0xcdb5a6){_0x4688f4=_0x4688f4-0x0;var _0x313619=_0xca47[_0x4688f4];return _0x313619;};'use strict';var _=require(_0x7ca4('0x0'));var md5=require(_0x7ca4('0x1'));var util=require(_0x7ca4('0x2'));var Redis=require(_0x7ca4('0x3'));var config=require(_0x7ca4('0x4'));config[_0x7ca4('0x5')]=_[_0x7ca4('0x6')](config[_0x7ca4('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x7ca4('0x7'))(new Redis(config[_0x7ca4('0x5')]));function FaxQueue(_0x1d5774){this['id']=_0x1d5774['id']||0x0;this[_0x7ca4('0x8')]=_0x1d5774['name']||'';this['timeout']=_0x1d5774['timeout']||0xa;this[_0x7ca4('0x9')]=_0x1d5774[_0x7ca4('0x9')]||'beepall';this['Agents']=_0x1d5774[_0x7ca4('0xa')];this['mapAgentsId']={};this[_0x7ca4('0xb')]=0x0;this[_0x7ca4('0x1')]='';this[_0x7ca4('0xc')]();this[_0x7ca4('0xd')]();}FaxQueue[_0x7ca4('0xe')][_0x7ca4('0xc')]=function(){var _0x4a71fb=this[_0x7ca4('0xf')][_0x7ca4('0x10')];this[_0x7ca4('0xf')]=_[_0x7ca4('0x11')](this[_0x7ca4('0xa')],'id');this['mapAgentsId']['_rr']=_0x4a71fb;};FaxQueue['prototype'][_0x7ca4('0xd')]=function(){this[_0x7ca4('0x12')]=0x0;this[_0x7ca4('0x13')]=0x0;for(var _0x1b8ba0=0x0;_0x1b8ba0=0x0?this['available']:0x0;var _0x51afea={'id':this['id'],'available':this[_0x7ca4('0x17')],'loggedIn':this[_0x7ca4('0x12')],'name':this[_0x7ca4('0x8')],'paused':this[_0x7ca4('0x13')],'waiting':this[_0x7ca4('0xb')]};var _0x4482f6=md5(JSON[_0x7ca4('0x18')](_0x51afea));if(this[_0x7ca4('0x1')]!==_0x4482f6){this['md5']=_0x4482f6;io['to'](util[_0x7ca4('0x19')](_0x7ca4('0x1a'),_0x51afea[_0x7ca4('0x8')]))[_0x7ca4('0x1b')](_0x7ca4('0x1c'),_0x51afea);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x2503=['md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','faxPause','available','format','emit','fax_queue:save'];(function(_0x3e0bea,_0xa74dbe){var _0x520030=function(_0x39d003){while(--_0x39d003){_0x3e0bea['push'](_0x3e0bea['shift']());}};_0x520030(++_0xa74dbe);}(_0x2503,0xfa));var _0x3250=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2503[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require(_0x3250('0x0'));var util=require('util');var Redis=require(_0x3250('0x1'));var config=require(_0x3250('0x2'));config[_0x3250('0x3')]=_[_0x3250('0x4')](config[_0x3250('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x3250('0x5'))(new Redis(config[_0x3250('0x3')]));function FaxQueue(_0x5a4f9e){this['id']=_0x5a4f9e['id']||0x0;this[_0x3250('0x6')]=_0x5a4f9e[_0x3250('0x6')]||'';this[_0x3250('0x7')]=_0x5a4f9e[_0x3250('0x7')]||0xa;this[_0x3250('0x8')]=_0x5a4f9e[_0x3250('0x8')]||_0x3250('0x9');this[_0x3250('0xa')]=_0x5a4f9e[_0x3250('0xa')];this[_0x3250('0xb')]={};this[_0x3250('0xc')]=0x0;this[_0x3250('0x0')]='';this[_0x3250('0xd')]();this[_0x3250('0xe')]();}FaxQueue[_0x3250('0xf')]['updateRouting']=function(){var _0x9d8d8e=this[_0x3250('0xb')][_0x3250('0x10')];this[_0x3250('0xb')]=_[_0x3250('0x11')](this[_0x3250('0xa')],'id');this[_0x3250('0xb')][_0x3250('0x10')]=_0x9d8d8e;};FaxQueue['prototype'][_0x3250('0xe')]=function(){this[_0x3250('0x12')]=0x0;this[_0x3250('0x13')]=0x0;for(var _0x55f13d=0x0;_0x55f13d=0x0?this[_0x3250('0x15')]:0x0;var _0x4eda32={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x3250('0xc')]};var _0x24a728=md5(JSON['stringify'](_0x4eda32));if(this[_0x3250('0x0')]!==_0x24a728){this[_0x3250('0x0')]=_0x24a728;io['to'](util[_0x3250('0x16')]('fax:queue:%s',_0x4eda32[_0x3250('0x6')]))[_0x3250('0x17')](_0x3250('0x18'),_0x4eda32);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 0191e43..b5834ad 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 _0xad38=['name','Intervals','exports'];(function(_0x5ce709,_0x327d30){var _0x33d6a6=function(_0x220d46){while(--_0x220d46){_0x5ce709['push'](_0x5ce709['shift']());}};_0x33d6a6(++_0x327d30);}(_0xad38,0x123));var _0x8ad3=function(_0x220882,_0x42619b){_0x220882=_0x220882-0x0;var _0xbcf788=_0xad38[_0x220882];return _0xbcf788;};'use strict';function Interval(_0xa39495){this['id']=_0xa39495['id']||0x0;this[_0x8ad3('0x0')]=_0xa39495['name']||'';this[_0x8ad3('0x1')]=_0xa39495[_0x8ad3('0x1')]||{};}module[_0x8ad3('0x2')]=Interval; \ No newline at end of file +var _0x49eb=['Intervals','exports','name'];(function(_0x2c9ccd,_0x4f3f3f){var _0x3c5182=function(_0x566ead){while(--_0x566ead){_0x2c9ccd['push'](_0x2c9ccd['shift']());}};_0x3c5182(++_0x4f3f3f);}(_0x49eb,0x110));var _0xb49e=function(_0x1bc01b,_0x1378a2){_0x1bc01b=_0x1bc01b-0x0;var _0x2ffbcc=_0x49eb[_0x1bc01b];return _0x2ffbcc;};'use strict';function Interval(_0xef8edb){this['id']=_0xef8edb['id']||0x0;this[_0xb49e('0x0')]=_0xef8edb['name']||'';this[_0xb49e('0x1')]=_0xef8edb[_0xb49e('0x1')]||{};}module[_0xb49e('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 4eee48a..0c2f6f1 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 _0x1561=['mailPause','paused','available','waiting','stringify','md5','format','mail:queue:%s','emit','mail_queue:save','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','loggedIn','length'];(function(_0x294945,_0x41a3a1){var _0x22a663=function(_0x556ed3){while(--_0x556ed3){_0x294945['push'](_0x294945['shift']());}};_0x22a663(++_0x41a3a1);}(_0x1561,0x1bd));var _0x1156=function(_0x4d46c3,_0x380759){_0x4d46c3=_0x4d46c3-0x0;var _0x2e45d8=_0x1561[_0x4d46c3];return _0x2e45d8;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1156('0x0'));var Redis=require(_0x1156('0x1'));var config=require(_0x1156('0x2'));config[_0x1156('0x3')]=_[_0x1156('0x4')](config['redis'],{'host':_0x1156('0x5'),'port':0x18eb});var io=require(_0x1156('0x6'))(new Redis(config[_0x1156('0x3')]));function MailQueue(_0x161b74){this['id']=_0x161b74['id']||0x0;this['name']=_0x161b74[_0x1156('0x7')]||'';this['timeout']=_0x161b74[_0x1156('0x8')]||0xa;this[_0x1156('0x9')]=_0x161b74[_0x1156('0x9')]||_0x1156('0xa');this[_0x1156('0xb')]=_0x161b74['Agents'];this[_0x1156('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x1156('0xd')]();this[_0x1156('0xe')]();}MailQueue['prototype'][_0x1156('0xd')]=function(){var _0x5d0c66=this[_0x1156('0xc')]['_rr'];this[_0x1156('0xc')]=_[_0x1156('0xf')](this['Agents'],'id');this['mapAgentsId'][_0x1156('0x10')]=_0x5d0c66;};MailQueue['prototype'][_0x1156('0xe')]=function(){this[_0x1156('0x11')]=0x0;this['paused']=0x0;for(var _0x5c3d85=0x0;_0x5c3d85=0x0?this[_0x1156('0x15')]:0x0;var _0x211e6b={'id':this['id'],'available':this[_0x1156('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x1156('0x7')],'paused':this[_0x1156('0x14')],'waiting':this[_0x1156('0x16')]};var _0x4ad077=md5(JSON[_0x1156('0x17')](_0x211e6b));if(this[_0x1156('0x18')]!==_0x4ad077){this[_0x1156('0x18')]=_0x4ad077;io['to'](util[_0x1156('0x19')](_0x1156('0x1a'),_0x211e6b[_0x1156('0x7')]))[_0x1156('0x1b')](_0x1156('0x1c'),_0x211e6b);}};module['exports']=MailQueue; \ No newline at end of file +var _0x8277=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','format','mail_queue:save','exports','md5','util','../../../config/environment','redis','localhost','name','timeout','strategy','beepall'];(function(_0x1a4e06,_0x2cb7c5){var _0x4b4cbf=function(_0x851014){while(--_0x851014){_0x1a4e06['push'](_0x1a4e06['shift']());}};_0x4b4cbf(++_0x2cb7c5);}(_0x8277,0xcf));var _0x7827=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0x8277[_0x261b8a];return _0x3455e8;};'use strict';var _=require('lodash');var md5=require(_0x7827('0x0'));var util=require(_0x7827('0x1'));var Redis=require('ioredis');var config=require(_0x7827('0x2'));config[_0x7827('0x3')]=_['defaults'](config[_0x7827('0x3')],{'host':_0x7827('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7827('0x3')]));function MailQueue(_0x14fc9b){this['id']=_0x14fc9b['id']||0x0;this[_0x7827('0x5')]=_0x14fc9b['name']||'';this[_0x7827('0x6')]=_0x14fc9b[_0x7827('0x6')]||0xa;this[_0x7827('0x7')]=_0x14fc9b[_0x7827('0x7')]||_0x7827('0x8');this[_0x7827('0x9')]=_0x14fc9b[_0x7827('0x9')];this[_0x7827('0xa')]={};this[_0x7827('0xb')]=0x0;this[_0x7827('0x0')]='';this[_0x7827('0xc')]();this[_0x7827('0xd')]();}MailQueue[_0x7827('0xe')][_0x7827('0xc')]=function(){var _0x51bc18=this[_0x7827('0xa')][_0x7827('0xf')];this[_0x7827('0xa')]=_[_0x7827('0x10')](this['Agents'],'id');this[_0x7827('0xa')][_0x7827('0xf')]=_0x51bc18;};MailQueue[_0x7827('0xe')][_0x7827('0xd')]=function(){this[_0x7827('0x11')]=0x0;this[_0x7827('0x12')]=0x0;for(var _0x35c668=0x0;_0x35c668=0x0?this[_0x7827('0x16')]:0x0;var _0x2e001d={'id':this['id'],'available':this[_0x7827('0x16')],'loggedIn':this[_0x7827('0x11')],'name':this['name'],'paused':this[_0x7827('0x12')],'waiting':this[_0x7827('0xb')]};var _0x30f90f=md5(JSON[_0x7827('0x17')](_0x2e001d));if(this[_0x7827('0x0')]!==_0x30f90f){this[_0x7827('0x0')]=_0x30f90f;io['to'](util[_0x7827('0x18')]('mail:queue:%s',_0x2e001d[_0x7827('0x5')]))['emit'](_0x7827('0x19'),_0x2e001d);}};module[_0x7827('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index d8d7141..9d36690 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 _0xb2a6=['waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','online','openchannelPause','available','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x43a5f3,_0x55a716){var _0x24d3e8=function(_0x4136dd){while(--_0x4136dd){_0x43a5f3['push'](_0x43a5f3['shift']());}};_0x24d3e8(++_0x55a716);}(_0xb2a6,0xf0));var _0x6b2a=function(_0x35fd93,_0xcb56d1){_0x35fd93=_0x35fd93-0x0;var _0x3695c7=_0xb2a6[_0x35fd93];return _0x3695c7;};'use strict';var _=require(_0x6b2a('0x0'));var md5=require(_0x6b2a('0x1'));var util=require('util');var Redis=require(_0x6b2a('0x2'));var config=require('../../../config/environment');config[_0x6b2a('0x3')]=_[_0x6b2a('0x4')](config[_0x6b2a('0x3')],{'host':_0x6b2a('0x5'),'port':0x18eb});var io=require(_0x6b2a('0x6'))(new Redis(config['redis']));function OpenchannelQueue(_0x5f4f1f){this['id']=_0x5f4f1f['id']||0x0;this['name']=_0x5f4f1f[_0x6b2a('0x7')]||'';this[_0x6b2a('0x8')]=_0x5f4f1f[_0x6b2a('0x8')]||0xa;this[_0x6b2a('0x9')]=_0x5f4f1f[_0x6b2a('0x9')]||_0x6b2a('0xa');this[_0x6b2a('0xb')]=_0x5f4f1f[_0x6b2a('0xb')];this['mapAgentsId']={};this[_0x6b2a('0xc')]=0x0;this[_0x6b2a('0x1')]='';this[_0x6b2a('0xd')]();this[_0x6b2a('0xe')]();}OpenchannelQueue['prototype'][_0x6b2a('0xd')]=function(){var _0x3688d2=this[_0x6b2a('0xf')][_0x6b2a('0x10')];this['mapAgentsId']=_[_0x6b2a('0x11')](this[_0x6b2a('0xb')],'id');this['mapAgentsId'][_0x6b2a('0x10')]=_0x3688d2;};OpenchannelQueue[_0x6b2a('0x12')][_0x6b2a('0xe')]=function(){this[_0x6b2a('0x13')]=0x0;this[_0x6b2a('0x14')]=0x0;for(var _0x246f92=0x0;_0x246f92=0x0?this[_0x6b2a('0x17')]:0x0;var _0x3840c6={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x6b2a('0x7')],'paused':this['paused'],'waiting':this[_0x6b2a('0xc')]};var _0x690dfa=md5(JSON['stringify'](_0x3840c6));if(this[_0x6b2a('0x1')]!==_0x690dfa){this[_0x6b2a('0x1')]=_0x690dfa;io['to'](util[_0x6b2a('0x18')](_0x6b2a('0x19'),_0x3840c6['name']))[_0x6b2a('0x1a')](_0x6b2a('0x1b'),_0x3840c6);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xa3d1=['waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId'];(function(_0x446d45,_0x39de0b){var _0x352b36=function(_0x18b265){while(--_0x18b265){_0x446d45['push'](_0x446d45['shift']());}};_0x352b36(++_0x39de0b);}(_0xa3d1,0x197));var _0x1a3d=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0xa3d1[_0x4c06a3];return _0x7ff53c;};'use strict';var _=require(_0x1a3d('0x0'));var md5=require(_0x1a3d('0x1'));var util=require(_0x1a3d('0x2'));var Redis=require(_0x1a3d('0x3'));var config=require(_0x1a3d('0x4'));config[_0x1a3d('0x5')]=_[_0x1a3d('0x6')](config['redis'],{'host':_0x1a3d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1a3d('0x5')]));function OpenchannelQueue(_0x2a01eb){this['id']=_0x2a01eb['id']||0x0;this[_0x1a3d('0x8')]=_0x2a01eb[_0x1a3d('0x8')]||'';this[_0x1a3d('0x9')]=_0x2a01eb[_0x1a3d('0x9')]||0xa;this[_0x1a3d('0xa')]=_0x2a01eb[_0x1a3d('0xa')]||'beepall';this[_0x1a3d('0xb')]=_0x2a01eb[_0x1a3d('0xb')];this[_0x1a3d('0xc')]={};this[_0x1a3d('0xd')]=0x0;this['md5']='';this[_0x1a3d('0xe')]();this[_0x1a3d('0xf')]();}OpenchannelQueue[_0x1a3d('0x10')][_0x1a3d('0xe')]=function(){var _0x30bf99=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x1a3d('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x1a3d('0x12')]=_0x30bf99;};OpenchannelQueue['prototype'][_0x1a3d('0xf')]=function(){this[_0x1a3d('0x13')]=0x0;this[_0x1a3d('0x14')]=0x0;for(var _0x322aa9=0x0;_0x322aa9=0x0?this[_0x1a3d('0x18')]:0x0;var _0xbeb5fc={'id':this['id'],'available':this[_0x1a3d('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x1a3d('0x8')],'paused':this[_0x1a3d('0x14')],'waiting':this[_0x1a3d('0xd')]};var _0x7b50af=md5(JSON[_0x1a3d('0x19')](_0xbeb5fc));if(this['md5']!==_0x7b50af){this[_0x1a3d('0x1')]=_0x7b50af;io['to'](util[_0x1a3d('0x1a')](_0x1a3d('0x1b'),_0xbeb5fc[_0x1a3d('0x8')]))['emit'](_0x1a3d('0x1c'),_0xbeb5fc);}};module[_0x1a3d('0x1d')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ed66650..45f2bdf 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 _0x9574=['online','smsPause','available','name','waiting','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length'];(function(_0x6512b6,_0x2ee305){var _0x16427b=function(_0x195cea){while(--_0x195cea){_0x6512b6['push'](_0x6512b6['shift']());}};_0x16427b(++_0x2ee305);}(_0x9574,0x1ea));var _0x4957=function(_0x2b0fda,_0x4cfaec){_0x2b0fda=_0x2b0fda-0x0;var _0x3acf71=_0x9574[_0x2b0fda];return _0x3acf71;};'use strict';var _=require(_0x4957('0x0'));var md5=require(_0x4957('0x1'));var util=require(_0x4957('0x2'));var Redis=require(_0x4957('0x3'));var config=require(_0x4957('0x4'));config[_0x4957('0x5')]=_[_0x4957('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4957('0x7'))(new Redis(config[_0x4957('0x5')]));function SmsQueue(_0x1e3b0e){this['id']=_0x1e3b0e['id']||0x0;this['name']=_0x1e3b0e['name']||'';this[_0x4957('0x8')]=_0x1e3b0e['timeout']||0xa;this[_0x4957('0x9')]=_0x1e3b0e[_0x4957('0x9')]||'beepall';this['Agents']=_0x1e3b0e[_0x4957('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x4957('0x1')]='';this[_0x4957('0xb')]();this[_0x4957('0xc')]();}SmsQueue[_0x4957('0xd')]['updateRouting']=function(){var _0x4213f9=this[_0x4957('0xe')]['_rr'];this[_0x4957('0xe')]=_[_0x4957('0xf')](this['Agents'],'id');this[_0x4957('0xe')][_0x4957('0x10')]=_0x4213f9;};SmsQueue[_0x4957('0xd')][_0x4957('0xc')]=function(){this[_0x4957('0x11')]=0x0;this[_0x4957('0x12')]=0x0;for(var _0x1c9de4=0x0;_0x1c9de4=0x0?this[_0x4957('0x16')]:0x0;var _0x3dafb9={'id':this['id'],'available':this[_0x4957('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x4957('0x17')],'paused':this[_0x4957('0x12')],'waiting':this[_0x4957('0x18')]};var _0x541dc4=md5(JSON[_0x4957('0x19')](_0x3dafb9));if(this[_0x4957('0x1')]!==_0x541dc4){this[_0x4957('0x1')]=_0x541dc4;io['to'](util[_0x4957('0x1a')](_0x4957('0x1b'),_0x3dafb9['name']))['emit'](_0x4957('0x1c'),_0x3dafb9);}};module[_0x4957('0x1d')]=SmsQueue; \ No newline at end of file +var _0xa344=['name','timeout','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','paused','length','online','available','loggedIn','waiting','md5','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','redis','defaults','socket.io-emitter'];(function(_0x4212ad,_0xd0e96){var _0x2b2f34=function(_0xfd854c){while(--_0xfd854c){_0x4212ad['push'](_0x4212ad['shift']());}};_0x2b2f34(++_0xd0e96);}(_0xa344,0xaa));var _0x4a34=function(_0x43f0fb,_0x26bbda){_0x43f0fb=_0x43f0fb-0x0;var _0x4f5715=_0xa344[_0x43f0fb];return _0x4f5715;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x4a34('0x0'));var Redis=require(_0x4a34('0x1'));var config=require('../../../config/environment');config[_0x4a34('0x2')]=_[_0x4a34('0x3')](config[_0x4a34('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x4a34('0x4'))(new Redis(config['redis']));function SmsQueue(_0x462bcd){this['id']=_0x462bcd['id']||0x0;this[_0x4a34('0x5')]=_0x462bcd[_0x4a34('0x5')]||'';this['timeout']=_0x462bcd[_0x4a34('0x6')]||0xa;this['strategy']=_0x462bcd['strategy']||_0x4a34('0x7');this[_0x4a34('0x8')]=_0x462bcd['Agents'];this[_0x4a34('0x9')]={};this['waiting']=0x0;this['md5']='';this[_0x4a34('0xa')]();this['updateRealtime']();}SmsQueue[_0x4a34('0xb')][_0x4a34('0xa')]=function(){var _0x516107=this[_0x4a34('0x9')][_0x4a34('0xc')];this[_0x4a34('0x9')]=_[_0x4a34('0xd')](this[_0x4a34('0x8')],'id');this[_0x4a34('0x9')][_0x4a34('0xc')]=_0x516107;};SmsQueue[_0x4a34('0xb')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x4a34('0xe')]=0x0;for(var _0x1fc528=0x0;_0x1fc528=0x0?this['available']:0x0;var _0x165c7b={'id':this['id'],'available':this[_0x4a34('0x11')],'loggedIn':this[_0x4a34('0x12')],'name':this[_0x4a34('0x5')],'paused':this[_0x4a34('0xe')],'waiting':this[_0x4a34('0x13')]};var _0x4ccbe7=md5(JSON['stringify'](_0x165c7b));if(this[_0x4a34('0x14')]!==_0x4ccbe7){this[_0x4a34('0x14')]=_0x4ccbe7;io['to'](util['format'](_0x4a34('0x15'),_0x165c7b[_0x4a34('0x5')]))[_0x4a34('0x16')](_0x4a34('0x17'),_0x165c7b);}};module[_0x4a34('0x18')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 07dc278..389adfe 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 _0x278b=['updateRouting','initChatQueues','updateRealtime','initSmsQueues','initMailQueues','initFaxQueues','util','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','initIntervals'];(function(_0x3caa43,_0x4d8a5b){var _0x35e7c4=function(_0x36e703){while(--_0x36e703){_0x3caa43['push'](_0x3caa43['shift']());}};_0x35e7c4(++_0x4d8a5b);}(_0x278b,0x11d));var _0xb278=function(_0x158a58,_0x28e8e7){_0x158a58=_0x158a58-0x0;var _0x4935d9=_0x278b[_0x158a58];return _0x4935d9;};'use strict';var BPromise=require('bluebird');var util=require(_0xb278('0x0'));var _=require('lodash');var moment=require(_0xb278('0x1'));var Agent=require(_0xb278('0x2'));var Interval=require(_0xb278('0x3'));var OpenchannelQueue=require(_0xb278('0x4'));var ChatQueue=require(_0xb278('0x5'));var SmsQueue=require(_0xb278('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0xb278('0x7'));var Realtime=function(){this[_0xb278('0x8')]={};this[_0xb278('0x9')]={};this[_0xb278('0xa')]={};this[_0xb278('0xb')]={};this[_0xb278('0xc')]={};this[_0xb278('0xd')]={};this[_0xb278('0xe')]={};this[_0xb278('0xf')]={};this[_0xb278('0x10')]={};this[_0xb278('0x11')]={};this[_0xb278('0x12')]={};this['faxQueuesWaitingInteractions']={};};function freeIsNotKey(_0x2933d3,_0x4419f9,_0x2f2a47){var _0x46cd46=_['mapKeys'](_0x2933d3,function(_0x1f0040,_0x2e0645){return _0x1f0040[_0x2f2a47];});for(var _0x26ba37 in _0x4419f9){if(_0x4419f9[_0xb278('0x13')](_0x26ba37)){if(!_0x46cd46[_0x26ba37]){delete _0x4419f9[_0x26ba37];}}}}Realtime[_0xb278('0x14')][_0xb278('0x15')]=function(_0x20d732,_0x14ec71){for(var _0x30534b in _0x14ec71){if(_0x20d732['hasOwnProperty'](_0x30534b)){_0x20d732[_0x30534b]=_0x14ec71[_0x30534b];}}};Realtime['prototype']['initAgents']=function(){var _0x2fdda5=this;return function(_0x59ca4d){if(_0x59ca4d){freeIsNotKey(_0x59ca4d,_0x2fdda5[_0xb278('0x8')],'id');for(var _0xe7e4b8=0x0,_0x10a262={},_0x1f23e6={};_0xe7e4b8<_0x59ca4d[_0xb278('0x16')];_0xe7e4b8+=0x1){_0x10a262=_0x59ca4d[_0xe7e4b8];if(_[_0xb278('0x17')](_0x2fdda5[_0xb278('0x8')][_0x10a262['id']])){_0x2fdda5[_0xb278('0x8')][_0x10a262['id']]=new Agent(_0x10a262);}else{_0x2fdda5['mergeFromDatabase'](_0x2fdda5[_0xb278('0x8')][_0x10a262['id']],_0x10a262);}}}return _0x2fdda5['agents'];};};Realtime[_0xb278('0x14')][_0xb278('0x18')]=function(){var _0x30973a=this;return function(_0x273ded){if(_0x273ded){freeIsNotKey(_0x273ded,_0x30973a[_0xb278('0x9')],'id');for(var _0x81f201=0x0,_0x5bd6bc={},_0x134f6e={};_0x81f201<_0x273ded['length'];_0x81f201+=0x1){_0x5bd6bc=_0x273ded[_0x81f201];if(_[_0xb278('0x17')](_0x30973a[_0xb278('0x9')][_0x5bd6bc['id']])){_0x30973a[_0xb278('0x9')][_0x5bd6bc['id']]=new Interval(_0x5bd6bc);}else{_0x30973a[_0xb278('0x15')](_0x30973a[_0xb278('0x9')][_0x5bd6bc['id']],_0x5bd6bc);}}}return _0x30973a['intervals'];};};Realtime[_0xb278('0x14')]['initOpenchannelQueues']=function(){var _0x25c1b2=this;return function(_0x17f0b0){if(_0x17f0b0){freeIsNotKey(_0x17f0b0,_0x25c1b2[_0xb278('0xa')],'id');for(var _0x100f51=0x0,_0xc88c48={},_0x15b623={};_0x100f51<_0x17f0b0[_0xb278('0x16')];_0x100f51+=0x1){_0xc88c48=_0x17f0b0[_0x100f51];if(_['isUndefined'](_0x25c1b2[_0xb278('0xa')][_0xc88c48['id']])){_0x25c1b2['openchannelQueues'][_0xc88c48['id']]=new OpenchannelQueue(_0xc88c48);}else{_0x25c1b2[_0xb278('0x15')](_0x25c1b2[_0xb278('0xa')][_0xc88c48['id']],_0xc88c48);}_0x25c1b2[_0xb278('0xa')][_0xc88c48['id']][_0xb278('0x19')]();_0x25c1b2[_0xb278('0xa')][_0xc88c48['id']]['updateRealtime']();}}return _0x25c1b2[_0xb278('0xa')];};};Realtime['prototype'][_0xb278('0x1a')]=function(){var _0x41a807=this;return function(_0x3d8e41){if(_0x3d8e41){freeIsNotKey(_0x3d8e41,_0x41a807[_0xb278('0xb')],'id');for(var _0x375755=0x0,_0x2725d1={},_0x34d2e7={};_0x375755<_0x3d8e41['length'];_0x375755+=0x1){_0x2725d1=_0x3d8e41[_0x375755];if(_['isUndefined'](_0x41a807['chatQueues'][_0x2725d1['id']])){_0x41a807['chatQueues'][_0x2725d1['id']]=new ChatQueue(_0x2725d1);}else{_0x41a807['mergeFromDatabase'](_0x41a807['chatQueues'][_0x2725d1['id']],_0x2725d1);}_0x41a807['chatQueues'][_0x2725d1['id']][_0xb278('0x19')]();_0x41a807[_0xb278('0xb')][_0x2725d1['id']][_0xb278('0x1b')]();}}return _0x41a807[_0xb278('0xb')];};};Realtime[_0xb278('0x14')][_0xb278('0x1c')]=function(){var _0x3ac3fc=this;return function(_0x5b891f){if(_0x5b891f){freeIsNotKey(_0x5b891f,_0x3ac3fc[_0xb278('0xc')],'id');for(var _0x1fe43e=0x0,_0xfaa1b9={},_0xfb5e3d={};_0x1fe43e<_0x5b891f['length'];_0x1fe43e+=0x1){_0xfaa1b9=_0x5b891f[_0x1fe43e];if(_['isUndefined'](_0x3ac3fc[_0xb278('0xc')][_0xfaa1b9['id']])){_0x3ac3fc[_0xb278('0xc')][_0xfaa1b9['id']]=new SmsQueue(_0xfaa1b9);}else{_0x3ac3fc[_0xb278('0x15')](_0x3ac3fc['smsQueues'][_0xfaa1b9['id']],_0xfaa1b9);}_0x3ac3fc['smsQueues'][_0xfaa1b9['id']][_0xb278('0x19')]();_0x3ac3fc[_0xb278('0xc')][_0xfaa1b9['id']][_0xb278('0x1b')]();}}return _0x3ac3fc[_0xb278('0xc')];};};Realtime[_0xb278('0x14')][_0xb278('0x1d')]=function(){var _0x1c9551=this;return function(_0x157441){if(_0x157441){freeIsNotKey(_0x157441,_0x1c9551['mailQueues'],'id');for(var _0x1ba0c6=0x0,_0x3622d1={},_0x540fcb={};_0x1ba0c6<_0x157441[_0xb278('0x16')];_0x1ba0c6+=0x1){_0x3622d1=_0x157441[_0x1ba0c6];if(_['isUndefined'](_0x1c9551[_0xb278('0xd')][_0x3622d1['id']])){_0x1c9551[_0xb278('0xd')][_0x3622d1['id']]=new MailQueue(_0x3622d1);}else{_0x1c9551[_0xb278('0x15')](_0x1c9551[_0xb278('0xd')][_0x3622d1['id']],_0x3622d1);}_0x1c9551['mailQueues'][_0x3622d1['id']][_0xb278('0x19')]();_0x1c9551[_0xb278('0xd')][_0x3622d1['id']][_0xb278('0x1b')]();}}return _0x1c9551[_0xb278('0xd')];};};Realtime[_0xb278('0x14')][_0xb278('0x1e')]=function(){var _0x57af13=this;return function(_0x3865c4){if(_0x3865c4){freeIsNotKey(_0x3865c4,_0x57af13[_0xb278('0xe')],'id');for(var _0x40940a=0x0,_0x1848c3={},_0x83d84d={};_0x40940a<_0x3865c4['length'];_0x40940a+=0x1){_0x1848c3=_0x3865c4[_0x40940a];if(_[_0xb278('0x17')](_0x57af13['faxQueues'][_0x1848c3['id']])){_0x57af13[_0xb278('0xe')][_0x1848c3['id']]=new FaxQueue(_0x1848c3);}else{_0x57af13['mergeFromDatabase'](_0x57af13[_0xb278('0xe')][_0x1848c3['id']],_0x1848c3);}_0x57af13[_0xb278('0xe')][_0x1848c3['id']]['updateRouting']();_0x57af13[_0xb278('0xe')][_0x1848c3['id']][_0xb278('0x1b')]();}}return _0x57af13[_0xb278('0xe')];};};module['exports']=Realtime; \ No newline at end of file +var _0xe29c=['../model/faxQueue','agents','chatQueues','smsQueues','mailQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','mergeFromDatabase','initAgents','length','isUndefined','prototype','intervals','initOpenchannelQueues','openchannelQueues','updateRealtime','initChatQueues','updateRouting','initSmsQueues','initMailQueues','initFaxQueues','bluebird','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe29c,0x1c6));var _0xce29=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe29c[_0x3ab51d];return _0x29a04e;};'use strict';var BPromise=require(_0xce29('0x0'));var util=require(_0xce29('0x1'));var _=require(_0xce29('0x2'));var moment=require(_0xce29('0x3'));var Agent=require('../model/agent');var Interval=require(_0xce29('0x4'));var OpenchannelQueue=require(_0xce29('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0xce29('0x6'));var MailQueue=require(_0xce29('0x7'));var FaxQueue=require(_0xce29('0x8'));var Realtime=function(){this[_0xce29('0x9')]={};this['intervals']={};this['openchannelQueues']={};this[_0xce29('0xa')]={};this[_0xce29('0xb')]={};this[_0xce29('0xc')]={};this[_0xce29('0xd')]={};this['chatQueuesWaitingInteractions']={};this[_0xce29('0xe')]={};this[_0xce29('0xf')]={};this['smsQueuesWaitingInteractions']={};this[_0xce29('0x10')]={};};function freeIsNotKey(_0xf6ae3e,_0x241c1d,_0x41e20b){var _0x240ba5=_[_0xce29('0x11')](_0xf6ae3e,function(_0x3a5c90,_0x236a7b){return _0x3a5c90[_0x41e20b];});for(var _0xd26b in _0x241c1d){if(_0x241c1d[_0xce29('0x12')](_0xd26b)){if(!_0x240ba5[_0xd26b]){delete _0x241c1d[_0xd26b];}}}}Realtime['prototype'][_0xce29('0x13')]=function(_0x6c721,_0x248566){for(var _0x3d90af in _0x248566){if(_0x6c721[_0xce29('0x12')](_0x3d90af)){_0x6c721[_0x3d90af]=_0x248566[_0x3d90af];}}};Realtime['prototype'][_0xce29('0x14')]=function(){var _0x3c3af1=this;return function(_0x264f3a){if(_0x264f3a){freeIsNotKey(_0x264f3a,_0x3c3af1[_0xce29('0x9')],'id');for(var _0x3580b8=0x0,_0x8267fd={},_0x2f06fd={};_0x3580b8<_0x264f3a[_0xce29('0x15')];_0x3580b8+=0x1){_0x8267fd=_0x264f3a[_0x3580b8];if(_[_0xce29('0x16')](_0x3c3af1['agents'][_0x8267fd['id']])){_0x3c3af1[_0xce29('0x9')][_0x8267fd['id']]=new Agent(_0x8267fd);}else{_0x3c3af1[_0xce29('0x13')](_0x3c3af1['agents'][_0x8267fd['id']],_0x8267fd);}}}return _0x3c3af1[_0xce29('0x9')];};};Realtime[_0xce29('0x17')]['initIntervals']=function(){var _0x2d67bf=this;return function(_0x16bc39){if(_0x16bc39){freeIsNotKey(_0x16bc39,_0x2d67bf[_0xce29('0x18')],'id');for(var _0x37a721=0x0,_0x20d0ca={},_0x1bf5d5={};_0x37a721<_0x16bc39[_0xce29('0x15')];_0x37a721+=0x1){_0x20d0ca=_0x16bc39[_0x37a721];if(_[_0xce29('0x16')](_0x2d67bf[_0xce29('0x18')][_0x20d0ca['id']])){_0x2d67bf[_0xce29('0x18')][_0x20d0ca['id']]=new Interval(_0x20d0ca);}else{_0x2d67bf[_0xce29('0x13')](_0x2d67bf[_0xce29('0x18')][_0x20d0ca['id']],_0x20d0ca);}}}return _0x2d67bf[_0xce29('0x18')];};};Realtime[_0xce29('0x17')][_0xce29('0x19')]=function(){var _0x30f85e=this;return function(_0x329bf3){if(_0x329bf3){freeIsNotKey(_0x329bf3,_0x30f85e[_0xce29('0x1a')],'id');for(var _0x4327e0=0x0,_0x5bf845={},_0x48ae9d={};_0x4327e0<_0x329bf3[_0xce29('0x15')];_0x4327e0+=0x1){_0x5bf845=_0x329bf3[_0x4327e0];if(_[_0xce29('0x16')](_0x30f85e[_0xce29('0x1a')][_0x5bf845['id']])){_0x30f85e[_0xce29('0x1a')][_0x5bf845['id']]=new OpenchannelQueue(_0x5bf845);}else{_0x30f85e[_0xce29('0x13')](_0x30f85e[_0xce29('0x1a')][_0x5bf845['id']],_0x5bf845);}_0x30f85e['openchannelQueues'][_0x5bf845['id']]['updateRouting']();_0x30f85e[_0xce29('0x1a')][_0x5bf845['id']][_0xce29('0x1b')]();}}return _0x30f85e[_0xce29('0x1a')];};};Realtime['prototype'][_0xce29('0x1c')]=function(){var _0x4a0d97=this;return function(_0x6b6c70){if(_0x6b6c70){freeIsNotKey(_0x6b6c70,_0x4a0d97[_0xce29('0xa')],'id');for(var _0x945eb6=0x0,_0x219776={},_0x4f9335={};_0x945eb6<_0x6b6c70[_0xce29('0x15')];_0x945eb6+=0x1){_0x219776=_0x6b6c70[_0x945eb6];if(_[_0xce29('0x16')](_0x4a0d97[_0xce29('0xa')][_0x219776['id']])){_0x4a0d97[_0xce29('0xa')][_0x219776['id']]=new ChatQueue(_0x219776);}else{_0x4a0d97[_0xce29('0x13')](_0x4a0d97[_0xce29('0xa')][_0x219776['id']],_0x219776);}_0x4a0d97[_0xce29('0xa')][_0x219776['id']][_0xce29('0x1d')]();_0x4a0d97[_0xce29('0xa')][_0x219776['id']]['updateRealtime']();}}return _0x4a0d97[_0xce29('0xa')];};};Realtime['prototype'][_0xce29('0x1e')]=function(){var _0x148c72=this;return function(_0x221513){if(_0x221513){freeIsNotKey(_0x221513,_0x148c72[_0xce29('0xb')],'id');for(var _0x42ced6=0x0,_0xff5da2={},_0x1ed63c={};_0x42ced6<_0x221513['length'];_0x42ced6+=0x1){_0xff5da2=_0x221513[_0x42ced6];if(_[_0xce29('0x16')](_0x148c72['smsQueues'][_0xff5da2['id']])){_0x148c72[_0xce29('0xb')][_0xff5da2['id']]=new SmsQueue(_0xff5da2);}else{_0x148c72[_0xce29('0x13')](_0x148c72['smsQueues'][_0xff5da2['id']],_0xff5da2);}_0x148c72[_0xce29('0xb')][_0xff5da2['id']][_0xce29('0x1d')]();_0x148c72['smsQueues'][_0xff5da2['id']][_0xce29('0x1b')]();}}return _0x148c72['smsQueues'];};};Realtime['prototype'][_0xce29('0x1f')]=function(){var _0x6b99ab=this;return function(_0x433125){if(_0x433125){freeIsNotKey(_0x433125,_0x6b99ab[_0xce29('0xc')],'id');for(var _0x2e1262=0x0,_0x5637c5={},_0x23d694={};_0x2e1262<_0x433125[_0xce29('0x15')];_0x2e1262+=0x1){_0x5637c5=_0x433125[_0x2e1262];if(_[_0xce29('0x16')](_0x6b99ab[_0xce29('0xc')][_0x5637c5['id']])){_0x6b99ab[_0xce29('0xc')][_0x5637c5['id']]=new MailQueue(_0x5637c5);}else{_0x6b99ab[_0xce29('0x13')](_0x6b99ab[_0xce29('0xc')][_0x5637c5['id']],_0x5637c5);}_0x6b99ab['mailQueues'][_0x5637c5['id']][_0xce29('0x1d')]();_0x6b99ab[_0xce29('0xc')][_0x5637c5['id']][_0xce29('0x1b')]();}}return _0x6b99ab[_0xce29('0xc')];};};Realtime['prototype'][_0xce29('0x20')]=function(){var _0x40d90d=this;return function(_0x2e14c0){if(_0x2e14c0){freeIsNotKey(_0x2e14c0,_0x40d90d[_0xce29('0xd')],'id');for(var _0x10e3e1=0x0,_0x44d394={},_0x47f55f={};_0x10e3e1<_0x2e14c0[_0xce29('0x15')];_0x10e3e1+=0x1){_0x44d394=_0x2e14c0[_0x10e3e1];if(_[_0xce29('0x16')](_0x40d90d[_0xce29('0xd')][_0x44d394['id']])){_0x40d90d['faxQueues'][_0x44d394['id']]=new FaxQueue(_0x44d394);}else{_0x40d90d[_0xce29('0x13')](_0x40d90d['faxQueues'][_0x44d394['id']],_0x44d394);}_0x40d90d[_0xce29('0xd')][_0x44d394['id']][_0xce29('0x1d')]();_0x40d90d[_0xce29('0xd')][_0x44d394['id']][_0xce29('0x1b')]();}}return _0x40d90d['faxQueues'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 6afb96c..dcb826d 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 _0x7fab=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x9da1f1,_0x4d0037){var _0x31279b=function(_0x205502){while(--_0x205502){_0x9da1f1['push'](_0x9da1f1['shift']());}};_0x31279b(++_0x4d0037);}(_0x7fab,0x71));var _0xb7fa=function(_0x4c19a1,_0x15197f){_0x4c19a1=_0x4c19a1-0x0;var _0x58ac50=_0x7fab[_0x4c19a1];return _0x58ac50;};'use strict';var client=require(_0xb7fa('0x0'));exports[_0xb7fa('0x1')]=function(_0x246c0d,_0x2afb0a){return client[_0xb7fa('0x2')](_0xb7fa('0x3'),{'body':_0x2afb0a,'options':{'where':{'id':_0x246c0d}},'log':_0xb7fa('0x4')});};exports[_0xb7fa('0x5')]=function(_0x21e01f,_0x57194b){return client[_0xb7fa('0x2')](_0xb7fa('0x6'),{'body':_0x57194b,'options':{'where':{'id':_0x21e01f}},'log':_0xb7fa('0x7')});}; \ No newline at end of file +var _0x94d3=['Request','updateChatInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x2f7079,_0x3858c3){var _0x481aa8=function(_0x4da44d){while(--_0x4da44d){_0x2f7079['push'](_0x2f7079['shift']());}};_0x481aa8(++_0x3858c3);}(_0x94d3,0x94));var _0x394d=function(_0x210a9e,_0x5c1a84){_0x210a9e=_0x210a9e-0x0;var _0x330ada=_0x94d3[_0x210a9e];return _0x330ada;};'use strict';var client=require(_0x394d('0x0'));exports[_0x394d('0x1')]=function(_0x371cb6,_0x6a74ca){return client[_0x394d('0x2')]('UpdateChatInteraction',{'body':_0x6a74ca,'options':{'where':{'id':_0x371cb6}},'log':_0x394d('0x3')});};exports[_0x394d('0x4')]=function(_0x2de43f,_0xdcd9e9){return client[_0x394d('0x2')]('AddTagsToChatInteraction',{'body':_0xdcd9e9,'options':{'where':{'id':_0x2de43f}},'log':_0x394d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 6252e86..866fb8e 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 _0xa93e=['create','CreateChatMessage','createChatMessage','../client'];(function(_0x3e079f,_0x189e15){var _0x296a34=function(_0xa31a0a){while(--_0xa31a0a){_0x3e079f['push'](_0x3e079f['shift']());}};_0x296a34(++_0x189e15);}(_0xa93e,0xaf));var _0xea93=function(_0x5777a9,_0x5ca0d4){_0x5777a9=_0x5777a9-0x0;var _0x3f71ce=_0xa93e[_0x5777a9];return _0x3f71ce;};'use strict';var client=require(_0xea93('0x0'));exports[_0xea93('0x1')]=function(_0x3cc7d4){return client['Request'](_0xea93('0x2'),{'body':_0x3cc7d4,'log':_0xea93('0x3')});}; \ No newline at end of file +var _0xb5d2=['../client','create','CreateChatMessage','createChatMessage'];(function(_0xbb51f3,_0x50f4aa){var _0x4261ef=function(_0x3eec19){while(--_0x3eec19){_0xbb51f3['push'](_0xbb51f3['shift']());}};_0x4261ef(++_0x50f4aa);}(_0xb5d2,0x1b4));var _0x2b5d=function(_0x453aa0,_0x1fd5d4){_0x453aa0=_0x453aa0-0x0;var _0x4f2810=_0xb5d2[_0x453aa0];return _0x4f2810;};'use strict';var client=require(_0x2b5d('0x0'));exports[_0x2b5d('0x1')]=function(_0x11fbb0){return client['Request'](_0x2b5d('0x2'),{'body':_0x11fbb0,'log':_0x2b5d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 2914186..5654f3c 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 _0x1912=['getChatQueues','../client','Request','GetChatQueue','timeout','strategy','Agents','name','chatPause'];(function(_0x3109f1,_0x31e90d){var _0x1b041b=function(_0x876ac8){while(--_0x876ac8){_0x3109f1['push'](_0x3109f1['shift']());}};_0x1b041b(++_0x31e90d);}(_0x1912,0x1a8));var _0x2191=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1912[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x2191('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x2191('0x1')](_0x2191('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x2191('0x3'),_0x2191('0x4')],'include':[{'model':'User','as':_0x2191('0x5'),'attributes':['id',_0x2191('0x6'),'online',_0x2191('0x7')]}]},'log':_0x2191('0x8')});};}; \ No newline at end of file +var _0xcb7a=['GetChatQueue','strategy','Agents','chatPause','getChatQueues','Request'];(function(_0xccb2d4,_0x55cf05){var _0x3e7bf7=function(_0x3ad37b){while(--_0x3ad37b){_0xccb2d4['push'](_0xccb2d4['shift']());}};_0x3e7bf7(++_0x55cf05);}(_0xcb7a,0x190));var _0xacb7=function(_0xd8de,_0x33ce05){_0xd8de=_0xd8de-0x0;var _0x59d32a=_0xcb7a[_0xd8de];return _0x59d32a;};'use strict';var client=require('../client');exports[_0xacb7('0x0')]=function(){return function(){return client[_0xacb7('0x1')](_0xacb7('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xacb7('0x3')],'include':[{'model':'User','as':_0xacb7('0x4'),'attributes':['id','name','online',_0xacb7('0x5')]}]},'log':_0xacb7('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 1620553..4ad3a11 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 _0x7aaf=['DESC','../client','Request','update','UpdateChatQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x2adb35,_0x41df6d){_0x2adb35=_0x2adb35-0x0;var _0x203c2b=_0x7aaf[_0x2adb35];return _0x203c2b;};'use strict';var client=require(_0xf7aa('0x0'));exports['create']=function(_0x3e729f){return client[_0xf7aa('0x1')]('CreateChatQueueReport',{'body':_0x3e729f,'log':'CreateChatQueueReport'});};exports[_0xf7aa('0x2')]=function(_0x573e43,_0x198d5c){return client['Request'](_0xf7aa('0x3'),{'body':_0x198d5c,'options':{'where':{'uniqueid':_0x573e43},'order':[['id',_0xf7aa('0x4')]],'limit':0x1},'log':_0xf7aa('0x3')});}; \ No newline at end of file +var _0x83d3=['update','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x4c7f79,_0x17b695){var _0x8d0051=function(_0x137146){while(--_0x137146){_0x4c7f79['push'](_0x4c7f79['shift']());}};_0x8d0051(++_0x17b695);}(_0x83d3,0x17c));var _0x383d=function(_0x16e1d5,_0x26b53b){_0x16e1d5=_0x16e1d5-0x0;var _0x534f2c=_0x83d3[_0x16e1d5];return _0x534f2c;};'use strict';var client=require(_0x383d('0x0'));exports[_0x383d('0x1')]=function(_0x249fdb){return client[_0x383d('0x2')](_0x383d('0x3'),{'body':_0x249fdb,'log':'CreateChatQueueReport'});};exports[_0x383d('0x4')]=function(_0x1184a6,_0x31cbfc){return client[_0x383d('0x2')]('UpdateChatQueueReport',{'body':_0x31cbfc,'options':{'where':{'uniqueid':_0x1184a6},'order':[['id',_0x383d('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ac8793f..05364d0 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 _0x55b1=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0x5abb00,_0x342d70){var _0xf9b854=function(_0x43ac30){while(--_0x43ac30){_0x5abb00['push'](_0x5abb00['shift']());}};_0xf9b854(++_0x342d70);}(_0x55b1,0x125));var _0x155b=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x55b1[_0x2261ce];return _0x524640;};'use strict';var client=require(_0x155b('0x0'));exports['update']=function(_0x5afccb,_0x736d47){return client[_0x155b('0x1')](_0x155b('0x2'),{'body':_0x736d47,'options':{'where':{'id':_0x5afccb}},'log':'updateFaxInteraction'});};exports[_0x155b('0x3')]=function(_0x4c504e,_0x7ec3e7){return client[_0x155b('0x1')](_0x155b('0x4'),{'body':_0x7ec3e7,'options':{'where':{'id':_0x4c504e}},'log':_0x155b('0x5')});}; \ No newline at end of file +var _0x7c13=['update','Request','addTagsToFaxInteraction','../client'];(function(_0x3e08e2,_0x20c249){var _0x32b418=function(_0x272ef7){while(--_0x272ef7){_0x3e08e2['push'](_0x3e08e2['shift']());}};_0x32b418(++_0x20c249);}(_0x7c13,0xbf));var _0x37c1=function(_0x4a3acd,_0x4bf641){_0x4a3acd=_0x4a3acd-0x0;var _0x3efdaa=_0x7c13[_0x4a3acd];return _0x3efdaa;};'use strict';var client=require(_0x37c1('0x0'));exports[_0x37c1('0x1')]=function(_0x4c8516,_0x94b13d){return client[_0x37c1('0x2')]('UpdateFaxInteraction',{'body':_0x94b13d,'options':{'where':{'id':_0x4c8516}},'log':'updateFaxInteraction'});};exports['addTags']=function(_0x55dc14,_0x42b2a6){return client['Request']('AddTagsToFaxInteraction',{'body':_0x42b2a6,'options':{'where':{'id':_0x55dc14}},'log':_0x37c1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index c42e741..c4716ff 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 _0xe749=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x1e6fe2,_0x267956){var _0x4db94b=function(_0x438284){while(--_0x438284){_0x1e6fe2['push'](_0x1e6fe2['shift']());}};_0x4db94b(++_0x267956);}(_0xe749,0x111));var _0x9e74=function(_0x4b4bf2,_0x2c464f){_0x4b4bf2=_0x4b4bf2-0x0;var _0x2e04df=_0xe749[_0x4b4bf2];return _0x2e04df;};'use strict';var client=require(_0x9e74('0x0'));exports[_0x9e74('0x1')]=function(_0x5d36c9){return client[_0x9e74('0x2')](_0x9e74('0x3'),{'body':_0x5d36c9,'log':_0x9e74('0x4')});}; \ No newline at end of file +var _0xfa92=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x5f4597,_0x2ba49c){var _0x3b2717=function(_0x360bd1){while(--_0x360bd1){_0x5f4597['push'](_0x5f4597['shift']());}};_0x3b2717(++_0x2ba49c);}(_0xfa92,0x74));var _0x2fa9=function(_0x31ebfb,_0x271c1f){_0x31ebfb=_0x31ebfb-0x0;var _0x453642=_0xfa92[_0x31ebfb];return _0x453642;};'use strict';var client=require(_0x2fa9('0x0'));exports[_0x2fa9('0x1')]=function(_0x33d4d4){return client[_0x2fa9('0x2')](_0x2fa9('0x3'),{'body':_0x33d4d4,'log':_0x2fa9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 522baff..5027403 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 _0x0d2b=['User','Agents','online','getFaxQueues','../client','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x2ece36,_0x213f3f){var _0x476fbc=function(_0x1583ff){while(--_0x1583ff){_0x2ece36['push'](_0x2ece36['shift']());}};_0x476fbc(++_0x213f3f);}(_0x0d2b,0x86));var _0xb0d2=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0x0d2b[_0x39f34f];return _0x59fee1;};'use strict';var client=require(_0xb0d2('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xb0d2('0x1')](_0xb0d2('0x2'),{'options':{'raw':![],'attributes':['id',_0xb0d2('0x3'),_0xb0d2('0x4'),_0xb0d2('0x5')],'include':[{'model':_0xb0d2('0x6'),'as':_0xb0d2('0x7'),'attributes':['id','name',_0xb0d2('0x8'),'faxPause']}]},'log':_0xb0d2('0x9')});};}; \ No newline at end of file +var _0x5b21=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x2e767e,_0x591c30){var _0x539d6c=function(_0x1122fc){while(--_0x1122fc){_0x2e767e['push'](_0x2e767e['shift']());}};_0x539d6c(++_0x591c30);}(_0x5b21,0x102));var _0x15b2=function(_0x3bbf52,_0x1e9197){_0x3bbf52=_0x3bbf52-0x0;var _0x4cb247=_0x5b21[_0x3bbf52];return _0x4cb247;};'use strict';var client=require(_0x15b2('0x0'));exports[_0x15b2('0x1')]=function(){return function(){return client[_0x15b2('0x2')](_0x15b2('0x3'),{'options':{'raw':![],'attributes':['id',_0x15b2('0x4'),_0x15b2('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x15b2('0x4'),_0x15b2('0x6'),_0x15b2('0x7')]}]},'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 0f606eb..726ba90 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 _0x0c9c=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x0c9c,0x188));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc0c9('0x0'));exports[_0xc0c9('0x1')]=function(_0xcd7544){return client[_0xc0c9('0x2')]('CreateFaxQueueReport',{'body':_0xcd7544,'log':_0xc0c9('0x3')});};exports['update']=function(_0x10d090,_0x7f8ea1){return client[_0xc0c9('0x2')](_0xc0c9('0x4'),{'body':_0x7f8ea1,'options':{'where':{'uniqueid':_0x10d090},'order':[['id',_0xc0c9('0x5')]],'limit':0x1},'log':_0xc0c9('0x4')});}; \ No newline at end of file +var _0x5704=['update','UpdateFaxQueueReport','DESC','Request','CreateFaxQueueReport'];(function(_0x387199,_0x3a16d5){var _0xc3d255=function(_0x5857ac){while(--_0x5857ac){_0x387199['push'](_0x387199['shift']());}};_0xc3d255(++_0x3a16d5);}(_0x5704,0x1e3));var _0x4570=function(_0x38cb4a,_0x14fe3d){_0x38cb4a=_0x38cb4a-0x0;var _0x7ef55b=_0x5704[_0x38cb4a];return _0x7ef55b;};'use strict';var client=require('../client');exports['create']=function(_0x168f9c){return client[_0x4570('0x0')](_0x4570('0x1'),{'body':_0x168f9c,'log':_0x4570('0x1')});};exports[_0x4570('0x2')]=function(_0x39e484,_0x3d3ef8){return client[_0x4570('0x0')](_0x4570('0x3'),{'body':_0x3d3ef8,'options':{'where':{'uniqueid':_0x39e484},'order':[['id',_0x4570('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 37786f6..a3f3b67 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 _0xefda=['../client','GetInterval','name','Intervals','interval','getIntervals'];(function(_0x444996,_0x1f5197){var _0x35130f=function(_0x325514){while(--_0x325514){_0x444996['push'](_0x444996['shift']());}};_0x35130f(++_0x1f5197);}(_0xefda,0x96));var _0xaefd=function(_0x59f612,_0x3a1d4c){_0x59f612=_0x59f612-0x0;var _0x38cb54=_0xefda[_0x59f612];return _0x38cb54;};'use strict';var client=require(_0xaefd('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0xaefd('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xaefd('0x2')],'include':[{'model':'Interval','as':_0xaefd('0x3'),'attributes':['id',_0xaefd('0x2'),_0xaefd('0x4')]}]},'log':_0xaefd('0x5')});};}; \ No newline at end of file +var _0x68a5=['../client','Request','GetInterval','Interval','Intervals','name','interval'];(function(_0x2c38da,_0x5d9497){var _0x18e668=function(_0x5a1765){while(--_0x5a1765){_0x2c38da['push'](_0x2c38da['shift']());}};_0x18e668(++_0x5d9497);}(_0x68a5,0xfc));var _0x568a=function(_0x13543b,_0x48c224){_0x13543b=_0x13543b-0x0;var _0x50edb7=_0x68a5[_0x13543b];return _0x50edb7;};'use strict';var client=require(_0x568a('0x0'));exports['getIntervals']=function(){return function(){return client[_0x568a('0x1')](_0x568a('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x568a('0x3'),'as':_0x568a('0x4'),'attributes':['id',_0x568a('0x5'),_0x568a('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 48a8f0b..37be80e 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 _0x9994=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0x9994,0x95));var _0x4999=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x9994[_0x34021d];return _0x16597b;};'use strict';var client=require(_0x4999('0x0'));exports[_0x4999('0x1')]=function(_0x370d3f,_0x36ed66){return client[_0x4999('0x2')]('UpdateMailInteraction',{'body':_0x36ed66,'options':{'where':{'id':_0x370d3f}},'log':_0x4999('0x3')});};exports[_0x4999('0x4')]=function(_0xd8042e,_0x2cc9ee){return client['Request'](_0x4999('0x5'),{'body':_0x2cc9ee,'options':{'where':{'id':_0xd8042e}},'log':_0x4999('0x6')});}; \ No newline at end of file +var _0xdde5=['addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdde5,0x127));var _0x5dde=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0xdde5[_0x5f0501];return _0x3c2c45;};'use strict';var client=require('../client');exports[_0x5dde('0x0')]=function(_0x5a55ac,_0x3c55b8){return client[_0x5dde('0x1')](_0x5dde('0x2'),{'body':_0x3c55b8,'options':{'where':{'id':_0x5a55ac}},'log':_0x5dde('0x3')});};exports[_0x5dde('0x4')]=function(_0x61cef2,_0x43b1fc){return client[_0x5dde('0x1')](_0x5dde('0x5'),{'body':_0x43b1fc,'options':{'where':{'id':_0x61cef2}},'log':_0x5dde('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 8358811..f4478bf 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 _0x7a4f=['createMailMessage','create','Request'];(function(_0x209ace,_0x59a3c3){var _0x2036b9=function(_0xea38a5){while(--_0xea38a5){_0x209ace['push'](_0x209ace['shift']());}};_0x2036b9(++_0x59a3c3);}(_0x7a4f,0xa3));var _0xf7a4=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x7a4f[_0x2c9b79];return _0x265032;};'use strict';var client=require('../client');exports[_0xf7a4('0x0')]=function(_0x848fe6){return client[_0xf7a4('0x1')]('CreateMailMessage',{'body':_0x848fe6,'log':_0xf7a4('0x2')});}; \ No newline at end of file +var _0x7ee5=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x7ee5,0xf1));var _0x57ee=function(_0x301148,_0x25b884){_0x301148=_0x301148-0x0;var _0x42ce24=_0x7ee5[_0x301148];return _0x42ce24;};'use strict';var client=require(_0x57ee('0x0'));exports['create']=function(_0x258193){return client[_0x57ee('0x1')](_0x57ee('0x2'),{'body':_0x258193,'log':_0x57ee('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index efbf523..15f127b 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 _0x88a8=['timeout','strategy','GetMailQueue','name'];(function(_0x3a31c0,_0x2c95c3){var _0x913b1f=function(_0x19f619){while(--_0x19f619){_0x3a31c0['push'](_0x3a31c0['shift']());}};_0x913b1f(++_0x2c95c3);}(_0x88a8,0xea));var _0x888a=function(_0xd6fe66,_0x26708a){_0xd6fe66=_0xd6fe66-0x0;var _0x3f590a=_0x88a8[_0xd6fe66];return _0x3f590a;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request'](_0x888a('0x0'),{'options':{'raw':![],'attributes':['id',_0x888a('0x1'),_0x888a('0x2'),_0x888a('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x888a('0x1'),'online','mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x1389=['name','online','mailPause','getMailQueues','../client','Request','GetMailQueue','strategy','User','Agents'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0x1389,0xf4));var _0x9138=function(_0x21b18e,_0x369e36){_0x21b18e=_0x21b18e-0x0;var _0x55f679=_0x1389[_0x21b18e];return _0x55f679;};'use strict';var client=require(_0x9138('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x9138('0x1')](_0x9138('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x9138('0x3')],'include':[{'model':_0x9138('0x4'),'as':_0x9138('0x5'),'attributes':['id',_0x9138('0x6'),_0x9138('0x7'),_0x9138('0x8')]}]},'log':_0x9138('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 10c4178..8bff851 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 _0x9324=['update','DESC','UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport'];(function(_0x172dd3,_0x1a5e88){var _0x1705b9=function(_0x586393){while(--_0x586393){_0x172dd3['push'](_0x172dd3['shift']());}};_0x1705b9(++_0x1a5e88);}(_0x9324,0x88));var _0x4932=function(_0x93d359,_0x133e38){_0x93d359=_0x93d359-0x0;var _0x3a9524=_0x9324[_0x93d359];return _0x3a9524;};'use strict';var client=require(_0x4932('0x0'));exports[_0x4932('0x1')]=function(_0x385598){return client[_0x4932('0x2')]('CreateMailQueueReport',{'body':_0x385598,'log':_0x4932('0x3')});};exports[_0x4932('0x4')]=function(_0x2c09a0,_0x5d5cfd){return client[_0x4932('0x2')]('UpdateMailQueueReport',{'body':_0x5d5cfd,'options':{'where':{'uniqueid':_0x2c09a0},'order':[['id',_0x4932('0x5')]],'limit':0x1},'log':_0x4932('0x6')});}; \ No newline at end of file +var _0xc4ba=['UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport','update'];(function(_0x5220b7,_0x1d70a3){var _0x2fd78d=function(_0x53c154){while(--_0x53c154){_0x5220b7['push'](_0x5220b7['shift']());}};_0x2fd78d(++_0x1d70a3);}(_0xc4ba,0x1b2));var _0xac4b=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xc4ba[_0x100e36];return _0x1df0c9;};'use strict';var client=require('../client');exports[_0xac4b('0x0')]=function(_0x50b3fc){return client[_0xac4b('0x1')](_0xac4b('0x2'),{'body':_0x50b3fc,'log':_0xac4b('0x2')});};exports[_0xac4b('0x3')]=function(_0x41e964,_0x180fbb){return client[_0xac4b('0x1')](_0xac4b('0x4'),{'body':_0x180fbb,'options':{'where':{'uniqueid':_0x41e964},'order':[['id',_0xac4b('0x5')]],'limit':0x1},'log':_0xac4b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 5d43932..2fe2d6c 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 _0xd796=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x176317,_0x4897b3){var _0xef2759=function(_0x581e2b){while(--_0x581e2b){_0x176317['push'](_0x176317['shift']());}};_0xef2759(++_0x4897b3);}(_0xd796,0x13b));var _0x6d79=function(_0x6088d5,_0xfaf001){_0x6088d5=_0x6088d5-0x0;var _0x57160b=_0xd796[_0x6088d5];return _0x57160b;};'use strict';var client=require(_0x6d79('0x0'));exports[_0x6d79('0x1')]=function(_0x9bdde9,_0x587242){return client[_0x6d79('0x2')](_0x6d79('0x3'),{'body':_0x587242,'options':{'where':{'id':_0x9bdde9}},'log':_0x6d79('0x4')});};exports[_0x6d79('0x5')]=function(_0x5455bf,_0x51a86e){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x51a86e,'options':{'where':{'id':_0x5455bf}},'log':_0x6d79('0x6')});}; \ No newline at end of file +var _0x336c=['UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x336c,0x1a7));var _0xc336=function(_0x5ccefd,_0x2410f2){_0x5ccefd=_0x5ccefd-0x0;var _0x262bc8=_0x336c[_0x5ccefd];return _0x262bc8;};'use strict';var client=require(_0xc336('0x0'));exports[_0xc336('0x1')]=function(_0x5eb8c1,_0x475faa){return client['Request'](_0xc336('0x2'),{'body':_0x475faa,'options':{'where':{'id':_0x5eb8c1}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x4ae000,_0x51ec08){return client['Request'](_0xc336('0x3'),{'body':_0x51ec08,'options':{'where':{'id':_0x4ae000}},'log':_0xc336('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index a5a5c74..ae7400d 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 _0x9bde=['create','Request','createOpenchannelMessage'];(function(_0x4eb9bd,_0x1a1e95){var _0x3d26ac=function(_0x1f2f14){while(--_0x1f2f14){_0x4eb9bd['push'](_0x4eb9bd['shift']());}};_0x3d26ac(++_0x1a1e95);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1f57d5,_0x2bcab5){_0x1f57d5=_0x1f57d5-0x0;var _0x2934fd=_0x9bde[_0x1f57d5];return _0x2934fd;};'use strict';var client=require('../client');exports[_0xe9bd('0x0')]=function(_0x4defda){return client[_0xe9bd('0x1')]('CreateOpenchannelMessage',{'body':_0x4defda,'log':_0xe9bd('0x2')});}; \ No newline at end of file +var _0x91a7=['create','Request','createOpenchannelMessage'];(function(_0x3f7d78,_0x169976){var _0x260c60=function(_0x46f03e){while(--_0x46f03e){_0x3f7d78['push'](_0x3f7d78['shift']());}};_0x260c60(++_0x169976);}(_0x91a7,0xe7));var _0x791a=function(_0x5ab6b3,_0x44e68c){_0x5ab6b3=_0x5ab6b3-0x0;var _0x4d4253=_0x91a7[_0x5ab6b3];return _0x4d4253;};'use strict';var client=require('../client');exports[_0x791a('0x0')]=function(_0x3d6eab){return client[_0x791a('0x1')]('CreateOpenchannelMessage',{'body':_0x3d6eab,'log':_0x791a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index b4c9ebf..2074630 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 _0xc072=['GetOpenchannelQueue','strategy','Agents','name','openchannelPause','../client','getOpenchannelQueues'];(function(_0x593db2,_0x30813b){var _0x3b92d1=function(_0x108f05){while(--_0x108f05){_0x593db2['push'](_0x593db2['shift']());}};_0x3b92d1(++_0x30813b);}(_0xc072,0x16a));var _0x2c07=function(_0x5f4497,_0x427ed5){_0x5f4497=_0x5f4497-0x0;var _0x3f4a70=_0xc072[_0x5f4497];return _0x3f4a70;};'use strict';var client=require(_0x2c07('0x0'));exports[_0x2c07('0x1')]=function(){return function(){return client['Request'](_0x2c07('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x2c07('0x3')],'include':[{'model':'User','as':_0x2c07('0x4'),'attributes':['id',_0x2c07('0x5'),'online',_0x2c07('0x6')]}]},'log':_0x2c07('0x1')});};}; \ No newline at end of file +var _0x0f7a=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','User','Agents','online','../client'];(function(_0x1da46b,_0x109ac4){var _0x3a94ef=function(_0x31a2b4){while(--_0x31a2b4){_0x1da46b['push'](_0x1da46b['shift']());}};_0x3a94ef(++_0x109ac4);}(_0x0f7a,0x1dc));var _0xa0f7=function(_0x3b9576,_0x3fcdbc){_0x3b9576=_0x3b9576-0x0;var _0x167d93=_0x0f7a[_0x3b9576];return _0x167d93;};'use strict';var client=require(_0xa0f7('0x0'));exports[_0xa0f7('0x1')]=function(){return function(){return client[_0xa0f7('0x2')](_0xa0f7('0x3'),{'options':{'raw':![],'attributes':['id',_0xa0f7('0x4'),_0xa0f7('0x5'),'strategy'],'include':[{'model':_0xa0f7('0x6'),'as':_0xa0f7('0x7'),'attributes':['id',_0xa0f7('0x4'),_0xa0f7('0x8'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a665a97..a73b1dd 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 _0xc8f1=['UpdateOpenchannelQueueReport','DESC','Request','CreateOpenchannelQueueReport','update'];(function(_0x413128,_0x50e08b){var _0x2691d5=function(_0x1ed6c7){while(--_0x1ed6c7){_0x413128['push'](_0x413128['shift']());}};_0x2691d5(++_0x50e08b);}(_0xc8f1,0x15b));var _0x1c8f=function(_0x292f9f,_0x12c54a){_0x292f9f=_0x292f9f-0x0;var _0x9f4e24=_0xc8f1[_0x292f9f];return _0x9f4e24;};'use strict';var client=require('../client');exports['create']=function(_0x1987bc){return client[_0x1c8f('0x0')](_0x1c8f('0x1'),{'body':_0x1987bc,'log':'CreateOpenchannelQueueReport'});};exports[_0x1c8f('0x2')]=function(_0x15d794,_0x5bc33f){return client['Request'](_0x1c8f('0x3'),{'body':_0x5bc33f,'options':{'where':{'uniqueid':_0x15d794},'order':[['id',_0x1c8f('0x4')]],'limit':0x1},'log':_0x1c8f('0x3')});}; \ No newline at end of file +var _0x4671=['UpdateOpenchannelQueueReport','../client','Request','CreateOpenchannelQueueReport','update','DESC'];(function(_0x37379a,_0x3cefcf){var _0x4956d9=function(_0x281859){while(--_0x281859){_0x37379a['push'](_0x37379a['shift']());}};_0x4956d9(++_0x3cefcf);}(_0x4671,0x157));var _0x1467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4671[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x1467('0x0'));exports['create']=function(_0xa43212){return client[_0x1467('0x1')](_0x1467('0x2'),{'body':_0xa43212,'log':_0x1467('0x2')});};exports[_0x1467('0x3')]=function(_0x4d70f1,_0xa68334){return client[_0x1467('0x1')]('UpdateOpenchannelQueueReport',{'body':_0xa68334,'options':{'where':{'uniqueid':_0x4d70f1},'order':[['id',_0x1467('0x4')]],'limit':0x1},'log':_0x1467('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index ce28d61..a6fadf7 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 _0xa825=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request'];(function(_0x181917,_0x298cd7){var _0x13b006=function(_0xe9a8da){while(--_0xe9a8da){_0x181917['push'](_0x181917['shift']());}};_0x13b006(++_0x298cd7);}(_0xa825,0xdd));var _0x5a82=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa825[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x5a82('0x0'));exports[_0x5a82('0x1')]=function(_0x412b4c,_0x481ab0){return client[_0x5a82('0x2')](_0x5a82('0x3'),{'body':_0x481ab0,'options':{'where':{'id':_0x412b4c}},'log':_0x5a82('0x4')});};exports[_0x5a82('0x5')]=function(_0x56d821,_0x41bbe9){return client[_0x5a82('0x2')](_0x5a82('0x6'),{'body':_0x41bbe9,'options':{'where':{'id':_0x56d821}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x6598=['AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x1fc4b8,_0x56613e){var _0x160ab5=function(_0x54f071){while(--_0x54f071){_0x1fc4b8['push'](_0x1fc4b8['shift']());}};_0x160ab5(++_0x56613e);}(_0x6598,0xe2));var _0x8659=function(_0x13a2de,_0x35b4e2){_0x13a2de=_0x13a2de-0x0;var _0x35e65d=_0x6598[_0x13a2de];return _0x35e65d;};'use strict';var client=require('../client');exports[_0x8659('0x0')]=function(_0x3579e7,_0x491abb){return client[_0x8659('0x1')](_0x8659('0x2'),{'body':_0x491abb,'options':{'where':{'id':_0x3579e7}},'log':_0x8659('0x3')});};exports[_0x8659('0x4')]=function(_0x2ec1b6,_0xf54f57){return client[_0x8659('0x1')](_0x8659('0x5'),{'body':_0xf54f57,'options':{'where':{'id':_0x2ec1b6}},'log':_0x8659('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index da24b36..0214e18 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 _0xc439=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x181e17,_0x1f90c8){var _0x3ed07c=function(_0x52c2e9){while(--_0x52c2e9){_0x181e17['push'](_0x181e17['shift']());}};_0x3ed07c(++_0x1f90c8);}(_0xc439,0x174));var _0x9c43=function(_0x54bd8b,_0x851970){_0x54bd8b=_0x54bd8b-0x0;var _0x2c6b34=_0xc439[_0x54bd8b];return _0x2c6b34;};'use strict';var client=require(_0x9c43('0x0'));exports[_0x9c43('0x1')]=function(_0x508030){return client[_0x9c43('0x2')](_0x9c43('0x3'),{'body':_0x508030,'log':_0x9c43('0x4')});}; \ No newline at end of file +var _0xf81b=['../client','Request'];(function(_0x538f2c,_0x1e3a0c){var _0x422997=function(_0x18f0e5){while(--_0x18f0e5){_0x538f2c['push'](_0x538f2c['shift']());}};_0x422997(++_0x1e3a0c);}(_0xf81b,0xdc));var _0xbf81=function(_0x3b4aaf,_0x568654){_0x3b4aaf=_0x3b4aaf-0x0;var _0xda9266=_0xf81b[_0x3b4aaf];return _0xda9266;};'use strict';var client=require(_0xbf81('0x0'));exports['create']=function(_0x2429bf){return client[_0xbf81('0x1')]('CreateSmsMessage',{'body':_0x2429bf,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 2816ead..53438af 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 _0xc002=['getSmsQueues','../client','Request','timeout','strategy','User','Agents','online','smsPause'];(function(_0x3809b7,_0x138e27){var _0x2f4df8=function(_0x593b5d){while(--_0x593b5d){_0x3809b7['push'](_0x3809b7['shift']());}};_0x2f4df8(++_0x138e27);}(_0xc002,0x19f));var _0x2c00=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xc002[_0x173441];return _0x2423a8;};'use strict';var client=require(_0x2c00('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x2c00('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x2c00('0x2'),_0x2c00('0x3')],'include':[{'model':_0x2c00('0x4'),'as':_0x2c00('0x5'),'attributes':['id','name',_0x2c00('0x6'),_0x2c00('0x7')]}]},'log':_0x2c00('0x8')});};}; \ No newline at end of file +var _0xd101=['Agents','smsPause','getSmsQueues','../client','Request','GetSmsQueue','name','timeout','strategy','User'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xd101,0xc1));var _0x1d10=function(_0xfd9fb0,_0x48bbcd){_0xfd9fb0=_0xfd9fb0-0x0;var _0x54c091=_0xd101[_0xfd9fb0];return _0x54c091;};'use strict';var client=require(_0x1d10('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x1d10('0x1')](_0x1d10('0x2'),{'options':{'raw':![],'attributes':['id',_0x1d10('0x3'),_0x1d10('0x4'),_0x1d10('0x5')],'include':[{'model':_0x1d10('0x6'),'as':_0x1d10('0x7'),'attributes':['id',_0x1d10('0x3'),'online',_0x1d10('0x8')]}]},'log':_0x1d10('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 5b1b61f..21c6e70 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 _0x95aa=['DESC','../client','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x28531b,_0xeec1ee){var _0x1874bc=function(_0x5ecda0){while(--_0x5ecda0){_0x28531b['push'](_0x28531b['shift']());}};_0x1874bc(++_0xeec1ee);}(_0x95aa,0x91));var _0xa95a=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x95aa[_0x49a57c];return _0x4e0316;};'use strict';var client=require(_0xa95a('0x0'));exports['create']=function(_0x2f1fe4){return client[_0xa95a('0x1')]('CreateSmsQueueReport',{'body':_0x2f1fe4,'log':_0xa95a('0x2')});};exports[_0xa95a('0x3')]=function(_0x4572ab,_0x2f58ce){return client[_0xa95a('0x1')](_0xa95a('0x4'),{'body':_0x2f58ce,'options':{'where':{'uniqueid':_0x4572ab},'order':[['id',_0xa95a('0x5')]],'limit':0x1},'log':_0xa95a('0x4')});}; \ No newline at end of file +var _0x67c4=['UpdateSmsQueueReport','../client','update','DESC'];(function(_0xc1f0cc,_0x2ba33b){var _0x406776=function(_0x4dd327){while(--_0x4dd327){_0xc1f0cc['push'](_0xc1f0cc['shift']());}};_0x406776(++_0x2ba33b);}(_0x67c4,0x121));var _0x467c=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x67c4[_0xfa634c];return _0x73e478;};'use strict';var client=require(_0x467c('0x0'));exports['create']=function(_0x2c3659){return client['Request']('CreateSmsQueueReport',{'body':_0x2c3659,'log':'CreateSmsQueueReport'});};exports[_0x467c('0x1')]=function(_0x128568,_0x3cb2ee){return client['Request']('UpdateSmsQueueReport',{'body':_0x3cb2ee,'options':{'where':{'uniqueid':_0x128568},'order':[['id',_0x467c('0x2')]],'limit':0x1},'log':_0x467c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index cf3a81c..4c51436 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 _0x46af=['mailCapacity','smsCapacity','getAgents','Request','GetUser','pauseType','lastPauseAt','chatPause','mailPause','smsPause','chatCapacity'];(function(_0x105a8e,_0x12dd9a){var _0x298729=function(_0x3e9079){while(--_0x3e9079){_0x105a8e['push'](_0x105a8e['shift']());}};_0x298729(++_0x12dd9a);}(_0x46af,0x199));var _0xf46a=function(_0x20315e,_0x2c4b60){_0x20315e=_0x20315e-0x0;var _0x3ae48c=_0x46af[_0x20315e];return _0x3ae48c;};'use strict';var client=require('../client');exports[_0xf46a('0x0')]=function(){return function(){return client[_0xf46a('0x1')](_0xf46a('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name','online',_0xf46a('0x3'),_0xf46a('0x4'),'voicePause',_0xf46a('0x5'),_0xf46a('0x6'),'faxPause',_0xf46a('0x7'),'openchannelPause',_0xf46a('0x8'),_0xf46a('0x9'),'faxCapacity',_0xf46a('0xa'),'openchannelCapacity']},'log':_0xf46a('0x0')});};}; \ No newline at end of file +var _0xcf98=['getAgents','Request','GetUser','agent','name','online','pauseType','voicePause','chatPause','mailPause','faxPause','openchannelPause','mailCapacity','smsCapacity','openchannelCapacity','../client'];(function(_0x14f6af,_0x579b70){var _0x21f19f=function(_0x2df1c2){while(--_0x2df1c2){_0x14f6af['push'](_0x14f6af['shift']());}};_0x21f19f(++_0x579b70);}(_0xcf98,0xcf));var _0x8cf9=function(_0x152d48,_0x361fec){_0x152d48=_0x152d48-0x0;var _0x26e21d=_0xcf98[_0x152d48];return _0x26e21d;};'use strict';var client=require(_0x8cf9('0x0'));exports[_0x8cf9('0x1')]=function(){return function(){return client[_0x8cf9('0x2')](_0x8cf9('0x3'),{'options':{'raw':!![],'where':{'role':_0x8cf9('0x4')},'attributes':['id',_0x8cf9('0x5'),_0x8cf9('0x6'),_0x8cf9('0x7'),'lastPauseAt',_0x8cf9('0x8'),_0x8cf9('0x9'),_0x8cf9('0xa'),_0x8cf9('0xb'),'smsPause',_0x8cf9('0xc'),'chatCapacity',_0x8cf9('0xd'),'faxCapacity',_0x8cf9('0xe'),_0x8cf9('0xf')]},'log':'getAgents'});};}; \ 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 0587992..4a2bd93 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 _0xa2ee=['atimeout','channel','START:%s','rules','end','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue'];(function(_0x4a5114,_0x386162){var _0x147874=function(_0x2f2d65){while(--_0x2f2d65){_0x4a5114['push'](_0x4a5114['shift']());}};_0x147874(++_0x386162);}(_0xa2ee,0x14f));var _0xea2e=function(_0x4a3e73,_0x4fea7c){_0x4a3e73=_0x4a3e73-0x0;var _0x2d8eb9=_0xa2ee[_0x4a3e73];return _0x2d8eb9;};'use strict';var schema=require(_0xea2e('0x0'));var _=require(_0xea2e('0x1'));var util=require(_0xea2e('0x2'));var seqqueue=require(_0xea2e('0x3'));var logger=require(_0xea2e('0x4'))(_0xea2e('0x5'));var strategy=require(_0xea2e('0x6'));var queue=schema({'name':{'type':_0xea2e('0x7'),'required':!![],'message':_0xea2e('0x8')},'timeout':{'type':_0xea2e('0x9'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5b59db,_0x1731d1,_0x52fe0c){return logger[_0xea2e('0xa')](util[_0xea2e('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5b59db,_0x1731d1[_0xea2e('0xc')],_0x52fe0c));}function handleFindAgent(_0x1c290d){return function(_0x2b7380){return _0x2b7380['name'][_0xea2e('0xd')]()===_0x1c290d['toLowerCase']();};}exports[_0xea2e('0xe')]=function(_0x594f78,_0x3ad5e8,_0x44f99e,_0x201cae){return function(_0x1381ee){try{var _0x456a85={'name':_0x3ad5e8[0x0],'timeout':_0x3ad5e8[0x1]};var _0x31c789=queue[_0xea2e('0x0')](_0x456a85,{'typecast':!![]});if(_0x31c789[_0xea2e('0xf')]){logger[_0xea2e('0x10')](_0xea2e('0x11'),_0x594f78,_[_0xea2e('0x12')](_0x31c789,_0xea2e('0x13'))['join'](',\x20'));_0x1381ee[_0xea2e('0x14')]();}else{var _0x59700b=_[_0xea2e('0x15')](_0x44f99e[_0xea2e('0x16')],handleFindAgent(_0x456a85[_0xea2e('0xc')]));if(_0x59700b){var _0x48dbdf=(_0x456a85[_0xea2e('0x17')]||0xa)*0x3e8;var _0x5c2aaf,_0x59bb52;var _0x2e5ac6=seqqueue[_0xea2e('0x18')](_0x48dbdf);_0x2e5ac6['id']=_0x594f78;_0x2e5ac6[_0xea2e('0x19')]=_0x48dbdf;_0x2e5ac6[_0xea2e('0x1a')]=_0x201cae[_0xea2e('0x1a')];writeLog(_0x594f78,_0x59700b,util[_0xea2e('0xb')](_0xea2e('0x1b'),_0x48dbdf));_0x44f99e[_0xea2e('0x1c')][_0x594f78]['on'](_0xea2e('0x1d'),function(){_0x2e5ac6[_0xea2e('0x1e')]();clearTimeout(_0x59bb52);_0x59bb52=undefined;if(_0x44f99e[_0xea2e('0x1c')][_0x594f78]){delete _0x44f99e[_0xea2e('0x1c')][_0x594f78];}logger[_0xea2e('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x594f78);_0x1381ee[_0xea2e('0x14')]();});_0x59bb52=setTimeout(function(){clearTimeout(_0x59bb52);_0x2e5ac6[_0xea2e('0x1e')]();logger[_0xea2e('0xa')]('[%s][AGENT]\x20ROUTING\x20END',_0x594f78);_0x1381ee[_0xea2e('0x1f')]();},_0x48dbdf);strategy[_0xea2e('0x20')](_0x2e5ac6,_0x59700b,_0x44f99e,_0x201cae);}else{logger[_0xea2e('0x10')](_0xea2e('0x21'),_0x594f78,_0x456a85[_0xea2e('0xc')]);_0x1381ee['stop']();}}}catch(_0x24d393){console['log'](_0x24d393);logger['error'](_0xea2e('0x22'),_0x594f78,_0x24d393[_0xea2e('0x23')]);_0x1381ee[_0xea2e('0x14')]();}};}; \ No newline at end of file +var _0x376e=['map','message','stop','timeout','createQueue','channel','START:%s','rules','end','close','[%s][AGENT]\x20ROUTING\x20STOPPED','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','lodash','util','seq-queue','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','length','error','[%s][AGENT]\x20%s'];(function(_0x25b109,_0x1b71c7){var _0x43fb25=function(_0x780e99){while(--_0x780e99){_0x25b109['push'](_0x25b109['shift']());}};_0x43fb25(++_0x1b71c7);}(_0x376e,0x1cf));var _0xe376=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x376e[_0x20a558];return _0x53d3f7;};'use strict';var schema=require('validate');var _=require(_0xe376('0x0'));var util=require(_0xe376('0x1'));var seqqueue=require(_0xe376('0x2'));var logger=require('../../../../config/logger')(_0xe376('0x3'));var strategy=require(_0xe376('0x4'));var queue=schema({'name':{'type':_0xe376('0x5'),'required':!![],'message':_0xe376('0x6')},'timeout':{'type':_0xe376('0x7'),'message':_0xe376('0x8')}});function writeLog(_0x318879,_0xfbb2e3,_0x57aa7f){return logger[_0xe376('0x9')](util[_0xe376('0xa')](_0xe376('0xb'),_0x318879,_0xfbb2e3['name'],_0x57aa7f));}function handleFindAgent(_0x36b7e1){return function(_0x47b8e5){return _0x47b8e5[_0xe376('0xc')][_0xe376('0xd')]()===_0x36b7e1['toLowerCase']();};}exports['consequence']=function(_0x371869,_0x1d55de,_0x4a7f76,_0x17f8f8){return function(_0xb7f65c){try{var _0x55d1ba={'name':_0x1d55de[0x0],'timeout':_0x1d55de[0x1]};var _0x171337=queue['validate'](_0x55d1ba,{'typecast':!![]});if(_0x171337[_0xe376('0xe')]){logger[_0xe376('0xf')](_0xe376('0x10'),_0x371869,_[_0xe376('0x11')](_0x171337,_0xe376('0x12'))['join'](',\x20'));_0xb7f65c[_0xe376('0x13')]();}else{var _0x230bc4=_['find'](_0x4a7f76['agents'],handleFindAgent(_0x55d1ba[_0xe376('0xc')]));if(_0x230bc4){var _0x200e0c=(_0x55d1ba[_0xe376('0x14')]||0xa)*0x3e8;var _0x8950bf,_0x5112af;var _0xe4a989=seqqueue[_0xe376('0x15')](_0x200e0c);_0xe4a989['id']=_0x371869;_0xe4a989['atimeout']=_0x200e0c;_0xe4a989[_0xe376('0x16')]=_0x17f8f8[_0xe376('0x16')];writeLog(_0x371869,_0x230bc4,util['format'](_0xe376('0x17'),_0x200e0c));_0x4a7f76[_0xe376('0x18')][_0x371869]['on'](_0xe376('0x19'),function(){_0xe4a989[_0xe376('0x1a')]();clearTimeout(_0x5112af);_0x5112af=undefined;if(_0x4a7f76[_0xe376('0x18')][_0x371869]){delete _0x4a7f76[_0xe376('0x18')][_0x371869];}logger[_0xe376('0x9')](_0xe376('0x1b'),_0x371869);_0xb7f65c['stop']();});_0x5112af=setTimeout(function(){clearTimeout(_0x5112af);_0xe4a989[_0xe376('0x1a')]();logger[_0xe376('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x371869);_0xb7f65c[_0xe376('0x1c')]();},_0x200e0c);strategy['agent'](_0xe4a989,_0x230bc4,_0x4a7f76,_0x17f8f8);}else{logger['error'](_0xe376('0x1d'),_0x371869,_0x55d1ba[_0xe376('0xc')]);_0xb7f65c['stop']();}}}catch(_0x496317){console[_0xe376('0x1e')](_0x496317);logger[_0xe376('0xf')](_0xe376('0x1f'),_0x371869,_0x496317['stack']);_0xb7f65c[_0xe376('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index f7df945..c4a5a0f 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 _0x33be=['create','body','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','toString','postText','message','amazonlex','then','stringify','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','Message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x33be,0x95));var _0xe33b=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x33be[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xe33b('0x0'));var moment=require(_0xe33b('0x1'));var AWS=require(_0xe33b('0x2'));var utils=require(_0xe33b('0x3'));var logger=require(_0xe33b('0x4'))(_0xe33b('0x5'));var rpc={'chatMessage':require(_0xe33b('0x6')),'openchannelMessage':require(_0xe33b('0x7')),'mailMessage':require(_0xe33b('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe33b('0x9'))};exports[_0xe33b('0xa')]=function(_0x308e08,_0x240eba){return function(_0x569e0b){try{if(!_[_0xe33b('0xb')](this[_0xe33b('0xc')][_0xe33b('0xd')])){logger[_0xe33b('0xe')](_0xe33b('0xf'),_0x308e08,_0xe33b('0x10'));return _0x569e0b[_0xe33b('0x11')]();}var _0xb2fe3d={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe33b('0x12')](_0xe33b('0x13')),'direction':_0xe33b('0x14')};var _0x328562=this[_0xe33b('0x15')];if(_0x328562===_0xe33b('0x16')){_0xb2fe3d[_0xe33b('0x17')]=this[_0xe33b('0x18')]['id'];}else{_0xb2fe3d[_[_0xe33b('0x19')](_0x328562)+_0xe33b('0x1a')]=this[_0xe33b('0x18')]['id'];}_0xb2fe3d[_[_0xe33b('0x19')](_0x328562)+'InteractionId']=this[_0xe33b('0xc')]['id'];if(this[_0xe33b('0xc')][_0xe33b('0x1b')]){var _0x3f2907=_0x240eba[0x4];if(!_[_0xe33b('0x1c')](_0x3f2907)){_0xb2fe3d['body']=utils[_0xe33b('0x1d')](_0x3f2907,this);return rpc[_0x328562+_0xe33b('0x1e')][_0xe33b('0x1f')](_0xb2fe3d)['then'](function(_0x3d585b){logger[_0xe33b('0xe')]('[%s][AMAZONLEX]\x20%s',_0x308e08,_0xb2fe3d[_0xe33b('0x20')]);})[_0xe33b('0x21')](function(_0x5061e9){logger[_0xe33b('0x22')](_0xe33b('0xf'),_0x308e08,JSON['stringify'](_0x5061e9));})['finally'](function(){logger['info'](_0xe33b('0x23'),_0x308e08);_0x569e0b['stop']();});}else{logger['info'](_0xe33b('0x24'),_0x308e08);_0x569e0b[_0xe33b('0x25')]();}}else{var _0x2aa8ad=this;var _0x28da2d=new AWS[(_0xe33b('0x26'))]({'accessKeyId':_0x240eba[0x0],'secretAccessKey':_0x240eba[0x1],'region':_0x240eba[0x2]});var _0x36c103={'botAlias':'$LATEST','botName':_0x240eba[0x3],'inputText':this['message'][_0xe33b('0x20')],'userId':this['interaction']['id'][_0xe33b('0x27')]()};_0x28da2d[_0xe33b('0x28')](_0x36c103,function(_0x58e5e0,_0x6a74a3){if(_0x58e5e0){logger[_0xe33b('0x22')](_0xe33b('0xf'),_0x308e08,_0x58e5e0[_0xe33b('0x29')]);_0x569e0b[_0xe33b('0x11')]();}else if(_0x6a74a3&&_0x6a74a3['message']){_0x2aa8ad[_0xe33b('0x20')][_0xe33b('0x2a')]=_0x6a74a3;_0xb2fe3d[_0xe33b('0x20')]=_0x6a74a3[_0xe33b('0x29')];return rpc[_0x328562+_0xe33b('0x1e')]['create'](_0xb2fe3d)[_0xe33b('0x2b')](function(_0x21b404){logger[_0xe33b('0xe')]('[%s][AMAZONLEX]\x20%s',_0x308e08,_0xb2fe3d[_0xe33b('0x20')]);if(_0x6a74a3['dialogState']=='Failed'){_0x569e0b['next']();}else{_0x569e0b[_0xe33b('0x25')]();}})[_0xe33b('0x21')](function(_0x14188c){logger[_0xe33b('0x22')]('[%s][AMAZONLEX]\x20%s',_0x308e08,JSON[_0xe33b('0x2c')](_0x14188c));_0x569e0b['next']();});}else{_0x569e0b[_0xe33b('0x11')]();}});}}catch(_0x1ec515){logger[_0xe33b('0x22')]('[%s][AMAZONLEX]\x20%s',_0x308e08,JSON[_0xe33b('0x2c')](_0x1ec515));_0x569e0b[_0xe33b('0x25')]();}};}; \ No newline at end of file +var _0xbf64=['consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\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','InteractionId','created','body','getMustacheRender','Message','create','then','error','stringify','[%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','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x1755a9,_0x1b0e63){var _0x307035=function(_0x487e09){while(--_0x487e09){_0x1755a9['push'](_0x1755a9['shift']());}};_0x307035(++_0x1b0e63);}(_0xbf64,0x1d0));var _0x4bf6=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0xbf64[_0x2e04ef];return _0x5722b0;};'use strict';var _=require(_0x4bf6('0x0'));var moment=require('moment');var AWS=require(_0x4bf6('0x1'));var utils=require(_0x4bf6('0x2'));var logger=require(_0x4bf6('0x3'))(_0x4bf6('0x4'));var rpc={'chatMessage':require(_0x4bf6('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4bf6('0x6')),'smsMessage':require(_0x4bf6('0x7')),'faxMessage':require(_0x4bf6('0x8'))};exports[_0x4bf6('0x9')]=function(_0x5e48a3,_0x38c025){return function(_0x1c7dbb){try{if(!_[_0x4bf6('0xa')](this[_0x4bf6('0xb')][_0x4bf6('0xc')])){logger[_0x4bf6('0xd')](_0x4bf6('0xe'),_0x5e48a3,_0x4bf6('0xf'));return _0x1c7dbb[_0x4bf6('0x10')]();}var _0x596a74={'ContactId':this[_0x4bf6('0x11')]['id'],'sentAt':moment()[_0x4bf6('0x12')](_0x4bf6('0x13')),'direction':_0x4bf6('0x14')};var _0x26b84c=this[_0x4bf6('0x15')];if(_0x26b84c===_0x4bf6('0x16')){_0x596a74[_0x4bf6('0x17')]=this[_0x4bf6('0x18')]['id'];}else{_0x596a74[_[_0x4bf6('0x19')](_0x26b84c)+'AccountId']=this[_0x4bf6('0x18')]['id'];}_0x596a74[_[_0x4bf6('0x19')](_0x26b84c)+_0x4bf6('0x1a')]=this['interaction']['id'];if(this[_0x4bf6('0xb')][_0x4bf6('0x1b')]){var _0x2d027d=_0x38c025[0x4];if(!_['isEmpty'](_0x2d027d)){_0x596a74[_0x4bf6('0x1c')]=utils[_0x4bf6('0x1d')](_0x2d027d,this);return rpc[_0x26b84c+_0x4bf6('0x1e')][_0x4bf6('0x1f')](_0x596a74)[_0x4bf6('0x20')](function(_0x4e1d47){logger[_0x4bf6('0xd')]('[%s][AMAZONLEX]\x20%s',_0x5e48a3,_0x596a74['body']);})['catch'](function(_0x1eaed6){logger[_0x4bf6('0x21')](_0x4bf6('0xe'),_0x5e48a3,JSON[_0x4bf6('0x22')](_0x1eaed6));})['finally'](function(){logger['info'](_0x4bf6('0x23'),_0x5e48a3);_0x1c7dbb[_0x4bf6('0x24')]();});}else{logger['info'](_0x4bf6('0x25'),_0x5e48a3);_0x1c7dbb[_0x4bf6('0x24')]();}}else{var _0x424348=this;var _0x2e6df2=new AWS['LexRuntime']({'accessKeyId':_0x38c025[0x0],'secretAccessKey':_0x38c025[0x1],'region':_0x38c025[0x2]});var _0x3388a7={'botAlias':_0x4bf6('0x26'),'botName':_0x38c025[0x3],'inputText':this[_0x4bf6('0x27')]['body'],'userId':this[_0x4bf6('0xb')]['id'][_0x4bf6('0x28')]()};_0x2e6df2['postText'](_0x3388a7,function(_0x32af20,_0x82903){if(_0x32af20){logger[_0x4bf6('0x21')]('[%s][AMAZONLEX]\x20%s',_0x5e48a3,_0x32af20['message']);_0x1c7dbb['next']();}else if(_0x82903&&_0x82903[_0x4bf6('0x27')]){_0x424348[_0x4bf6('0x1c')]['amazonlex']=_0x82903;_0x596a74[_0x4bf6('0x1c')]=_0x82903[_0x4bf6('0x27')];return rpc[_0x26b84c+_0x4bf6('0x1e')]['create'](_0x596a74)[_0x4bf6('0x20')](function(_0x2f5366){logger['info']('[%s][AMAZONLEX]\x20%s',_0x5e48a3,_0x596a74[_0x4bf6('0x1c')]);if(_0x82903[_0x4bf6('0x29')]==_0x4bf6('0x2a')){_0x1c7dbb[_0x4bf6('0x10')]();}else{_0x1c7dbb[_0x4bf6('0x24')]();}})['catch'](function(_0xeca4ab){logger['error'](_0x4bf6('0xe'),_0x5e48a3,JSON[_0x4bf6('0x22')](_0xeca4ab));_0x1c7dbb[_0x4bf6('0x10')]();});}else{_0x1c7dbb[_0x4bf6('0x10')]();}});}}catch(_0x3aa934){logger[_0x4bf6('0x21')](_0x4bf6('0xe'),_0x5e48a3,JSON[_0x4bf6('0x22')](_0x3aa934));_0x1c7dbb['stop']();}};}; \ 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 5367e53..1ffbc9c 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 _0x70e0=['from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','upperFirst','AccountId','account','Message','Smtp','service','host','port','secure','authentication','user','pass','inReplyTo','html','','replace','','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','then','error','finally','next','create','body','catch','stringify','stop','lodash','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../mailRpc','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message'];(function(_0x3d3c65,_0x48ee4e){var _0x523473=function(_0x1458e3){while(--_0x1458e3){_0x3d3c65['push'](_0x3d3c65['shift']());}};_0x523473(++_0x48ee4e);}(_0x70e0,0x17b));var _0x070e=function(_0x4d8099,_0x30bde2){_0x4d8099=_0x4d8099-0x0;var _0x1277df=_0x70e0[_0x4d8099];return _0x1277df;};'use strict';var _=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var utils=require(_0x070e('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x070e('0x3')),'openchannelMessage':require(_0x070e('0x4')),'mailMessage':require(_0x070e('0x5')),'smsMessage':require(_0x070e('0x6')),'faxMessage':require('../../rpc/faxMessage')};var mailRpc=require(_0x070e('0x7'));exports['consequence']=function(_0x46fe68,_0x4b041d){return function(_0x56e420){try{if(_0x4b041d[0x0]==='1'&&(_['isNil'](this[_0x070e('0x8')][_0x070e('0x9')])||!this[_0x070e('0x8')][_0x070e('0x9')])){logger[_0x070e('0xa')](_0x070e('0xb'),_0x46fe68,_0x070e('0xc'));return _0x56e420['next']();}var _0x49b2fb=this[_0x070e('0xd')];var _0x2e3e5e={'body':utils[_0x070e('0xe')](_0x4b041d[0x1],this),'ContactId':this[_0x070e('0xf')]['id'],'sentAt':moment()[_0x070e('0x10')](_0x070e('0x11')),'direction':_0x070e('0x12')};if(this[_0x070e('0x13')]){_0x2e3e5e['to']=this[_0x070e('0x13')][_0x070e('0x14')]||'';_0x2e3e5e['cc']=this[_0x070e('0x13')]['cc']||'';_0x2e3e5e['from']=this['message']['to']||'';_0x2e3e5e[_0x070e('0x15')]=this['message']['phone']||'';_0x2e3e5e['read']=!![];if(this[_0x070e('0x13')][_0x070e('0x16')]){_0x2e3e5e['subject']='';_0x2e3e5e['subject']+=_[_0x070e('0x17')](this[_0x070e('0x13')][_0x070e('0x16')],_0x070e('0x18'))?'':'Re:\x20';_0x2e3e5e['subject']+=this[_0x070e('0x13')][_0x070e('0x16')];}}if(this[_0x070e('0xd')]===_0x070e('0x19')){_0x2e3e5e[_0x070e('0x1a')]=this['account']['id'];}else{_0x2e3e5e[_[_0x070e('0x1b')](this[_0x070e('0xd')])+_0x070e('0x1c')]=this[_0x070e('0x1d')]['id'];}_0x2e3e5e[_[_0x070e('0x1b')](this['channel'])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x070e('0xd')]+_0x070e('0x1e')]){if(this[_0x070e('0xd')]==='mail'){var _0x5b184={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x070e('0x1f')][_0x070e('0x20')]){_0x5b184[_0x070e('0x20')]=this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x20')];}else{_0x5b184[_0x070e('0x21')]=this[_0x070e('0x1d')]['Smtp'][_0x070e('0x21')];_0x5b184[_0x070e('0x22')]=this[_0x070e('0x1d')]['Smtp'][_0x070e('0x22')];_0x5b184['secure']=this['account'][_0x070e('0x1f')][_0x070e('0x23')];}if(this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x24')]){_0x5b184['auth']={'user':this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x25')],'pass':this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x26')]};}_0x2e3e5e[_0x070e('0x27')]=this[_0x070e('0x13')]['messageId'];_0x2e3e5e[_0x070e('0x28')]=_0x070e('0x29')+_[_0x070e('0x2a')](_0x2e3e5e['body'],'','replace','body','';return mailRpc[_0x6e70('0x33')](_0x228350,_0x37b3e0)['then'](function(_0x259486){logger['info'](_0x6e70('0x34'),_0x1b0389);_0x37b3e0[_0x6e70('0x2c')]=_0x259486[_0x6e70('0x16')]['messageId'];return rpc[_0x743eb5+_0x6e70('0x22')][_0x6e70('0x35')](_0x37b3e0);})['then'](function(_0x13d673){logger[_0x6e70('0xe')]('[%s][AUTOREPLY]\x20%s',_0x1b0389,JSON[_0x6e70('0x36')](_0x13d673));})[_0x6e70('0x37')](function(_0x2d52bd){logger[_0x6e70('0x38')](_0x6e70('0x39'),_0x1b0389,JSON[_0x6e70('0x36')](_0x2d52bd));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}else{return rpc[this[_0x6e70('0x12')]+_0x6e70('0x22')]['create'](_0x37b3e0)[_0x6e70('0x3b')](function(_0x4795a0){logger[_0x6e70('0xe')](_0x6e70('0xf'),_0x1b0389,_0x37b3e0[_0x6e70('0x30')]);})[_0x6e70('0x37')](function(_0x233a83){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON[_0x6e70('0x36')](_0x233a83));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}}}catch(_0x2a5444){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON['stringify'](_0x2a5444));_0x36357b['stop']();}};}; \ 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 9f39eaa..29d77f7 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 _0x4b0f=['../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x3036b6,_0x27294c){var _0x34c081=function(_0x574df2){while(--_0x574df2){_0x3036b6['push'](_0x3036b6['shift']());}};_0x34c081(++_0x27294c);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x48eb11,_0x2a697c){_0x48eb11=_0x48eb11-0x0;var _0x2b1a9c=_0x4b0f[_0x48eb11];return _0x2b1a9c;};'use strict';var moment=require('moment');var logger=require(_0xf4b0('0x0'))(_0xf4b0('0x1'));var rpc={'chatInteraction':require(_0xf4b0('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xf4b0('0x3')),'mailInteraction':require(_0xf4b0('0x4')),'faxInteraction':require(_0xf4b0('0x5'))};exports[_0xf4b0('0x6')]=function(_0x2a08dc,_0x354cb3,_0x3c0f87,_0xbd59c1){return function(_0x2967ac){try{logger[_0xf4b0('0x7')](_0xf4b0('0x8'),_0x2a08dc,_0x354cb3[0x0]);var _0x35160f={'closed':0x1,'closedAt':moment()[_0xf4b0('0x9')](_0xf4b0('0xa')),'closeReason':_0xf4b0('0xb'),'disposition':_0x354cb3[0x0]};if(rpc[_0xbd59c1[_0xf4b0('0xc')]+'Interaction']){rpc[_0xbd59c1[_0xf4b0('0xc')]+_0xf4b0('0xd')][_0xf4b0('0xe')](_0xbd59c1[_0xf4b0('0xf')]['id'],_0x35160f)[_0xf4b0('0x10')](function(_0x3b5530){logger[_0xf4b0('0x7')](_0xf4b0('0x11'),_0x2a08dc,_0xbd59c1[_0xf4b0('0xf')]['id']);})[_0xf4b0('0x12')](function(_0x3ad68b){logger[_0xf4b0('0x13')](_0xf4b0('0x14'),_0x2a08dc,JSON[_0xf4b0('0x15')](_0x3ad68b));})[_0xf4b0('0x16')](function(){_0x2967ac[_0xf4b0('0x17')]();});}}catch(_0x18abb2){logger[_0xf4b0('0x13')](_0xf4b0('0x14'),_0x2a08dc,JSON[_0xf4b0('0x15')](_0x18abb2));_0x2967ac[_0xf4b0('0x17')]();}};}; \ No newline at end of file +var _0x23a8=['update','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','stringify','stop','../../../../config/logger','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x23a8,0x172));var _0x823a=function(_0x473b48,_0x325547){_0x473b48=_0x473b48-0x0;var _0x5eb3c8=_0x23a8[_0x473b48];return _0x5eb3c8;};'use strict';var moment=require('moment');var logger=require(_0x823a('0x0'))('routing');var rpc={'chatInteraction':require(_0x823a('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x823a('0x2')),'mailInteraction':require(_0x823a('0x3')),'faxInteraction':require('../../rpc/faxInteraction')};exports[_0x823a('0x4')]=function(_0x494856,_0x2d8217,_0x2ad2cb,_0x1862d3){return function(_0x35ae11){try{logger['info'](_0x823a('0x5'),_0x494856,_0x2d8217[0x0]);var _0x3f35db={'closed':0x1,'closedAt':moment()['format'](_0x823a('0x6')),'closeReason':_0x823a('0x7'),'disposition':_0x2d8217[0x0]};if(rpc[_0x1862d3['channel']+_0x823a('0x8')]){rpc[_0x1862d3[_0x823a('0x9')]+_0x823a('0x8')][_0x823a('0xa')](_0x1862d3['interaction']['id'],_0x3f35db)[_0x823a('0xb')](function(_0x11a700){logger[_0x823a('0xc')](_0x823a('0xd'),_0x494856,_0x1862d3[_0x823a('0xe')]['id']);})[_0x823a('0xf')](function(_0x812683){logger[_0x823a('0x10')]('[%s][CLOSE]\x20%s',_0x494856,JSON[_0x823a('0x11')](_0x812683));})['finally'](function(){_0x35ae11[_0x823a('0x12')]();});}}catch(_0x29d2cf){logger[_0x823a('0x10')]('[%s][CLOSE]\x20%s',_0x494856,JSON['stringify'](_0x29d2cf));_0x35ae11[_0x823a('0x12')]();}};}; \ 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 50132e0..7c60ea3 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 _0x4d91=['fulfillment','create','metadata','stringify','catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','isEmpty','getMustacheRender','Message','then','[%s][DIALOGFLOW]\x20%s','body','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result'];(function(_0x2c8afd,_0x115843){var _0x4d1e1f=function(_0x1fd1ef){while(--_0x1fd1ef){_0x2c8afd['push'](_0x2c8afd['shift']());}};_0x4d1e1f(++_0x115843);}(_0x4d91,0x16d));var _0x14d9=function(_0x47a5bd,_0x508329){_0x47a5bd=_0x47a5bd-0x0;var _0x5c2184=_0x4d91[_0x47a5bd];return _0x5c2184;};'use strict';var _=require(_0x14d9('0x0'));var moment=require(_0x14d9('0x1'));var apiai=require(_0x14d9('0x2'));var md5=require(_0x14d9('0x3'));var utils=require(_0x14d9('0x4'));var logger=require(_0x14d9('0x5'))(_0x14d9('0x6'));var rpc={'chatMessage':require(_0x14d9('0x7')),'openchannelMessage':require(_0x14d9('0x8')),'mailMessage':require(_0x14d9('0x9')),'smsMessage':require(_0x14d9('0xa')),'faxMessage':require(_0x14d9('0xb'))};exports[_0x14d9('0xc')]=function(_0x2ddc6a,_0x1f956d){return function(_0x2203f8){try{if(!_['isNil'](this['interaction'][_0x14d9('0xd')])){logger[_0x14d9('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x2ddc6a,_0x14d9('0xf'));return _0x2203f8[_0x14d9('0x10')]();}var _0x48fa1d={'ContactId':this[_0x14d9('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x14d9('0x12')};var _0x57918e=this[_0x14d9('0x13')];if(_0x57918e===_0x14d9('0x14')){_0x48fa1d[_0x14d9('0x15')]=this['account']['id'];}else{_0x48fa1d[_[_0x14d9('0x16')](_0x57918e)+_0x14d9('0x17')]=this[_0x14d9('0x18')]['id'];}_0x48fa1d[_[_0x14d9('0x16')](_0x57918e)+_0x14d9('0x19')]=this[_0x14d9('0x1a')]['id'];if(this[_0x14d9('0x1a')]['created']){var _0x524d3f=_0x1f956d[0x2];if(!_[_0x14d9('0x1b')](_0x524d3f)){_0x48fa1d['body']=utils[_0x14d9('0x1c')](_0x524d3f,this);return rpc[_0x57918e+_0x14d9('0x1d')]['create'](_0x48fa1d)[_0x14d9('0x1e')](function(_0x54ef){logger[_0x14d9('0xe')](_0x14d9('0x1f'),_0x2ddc6a,_0x48fa1d[_0x14d9('0x20')]);})['catch'](function(_0x349238){logger[_0x14d9('0x21')](_0x14d9('0x1f'),_0x2ddc6a,JSON['stringify'](_0x349238));})['finally'](function(){logger[_0x14d9('0xe')](_0x14d9('0x22'),_0x2ddc6a);_0x2203f8[_0x14d9('0x23')]();});}else{logger[_0x14d9('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2ddc6a);_0x2203f8[_0x14d9('0x23')]();}}else{var _0x33f8ba=this;var _0x26e45d=apiai(_0x1f956d[0x0],{'language':_0x1f956d[0x1]||'en'});return _0x26e45d[_0x14d9('0x24')](this[_0x14d9('0x25')][_0x14d9('0x20')],{'sessionId':md5(this['interaction']['id'])})[_0x14d9('0x1e')](function(_0x496eb9){_0x33f8ba['body'][_0x14d9('0x26')]=_0x496eb9;_0x48fa1d['body']=_0x496eb9[_0x14d9('0x27')][_0x14d9('0x28')]['speech'];return rpc[_0x57918e+_0x14d9('0x1d')][_0x14d9('0x29')](_0x48fa1d)[_0x14d9('0x1e')](function(_0x1aa630){logger[_0x14d9('0xe')](_0x14d9('0x1f'),_0x2ddc6a,_0x48fa1d[_0x14d9('0x20')]);if(_0x496eb9['result'][_0x14d9('0x2a')]['endConversation']){_0x2203f8['next']();}else{_0x2203f8[_0x14d9('0x23')]();}})['catch'](function(_0x128e0b){logger[_0x14d9('0x21')](_0x14d9('0x1f'),_0x2ddc6a,JSON[_0x14d9('0x2b')](_0x128e0b));_0x2203f8[_0x14d9('0x10')]();});})[_0x14d9('0x2c')](function(_0x4e1015){logger[_0x14d9('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x2ddc6a,_0x4e1015[_0x14d9('0x25')]);_0x2203f8[_0x14d9('0x10')]();});}}catch(_0x3fe71c){logger['error'](_0x14d9('0x1f'),_0x2ddc6a,JSON[_0x14d9('0x2b')](_0x3fe71c));_0x2203f8['stop']();}};}; \ No newline at end of file +var _0x91df=['textRequest','message','body','dialogflow','result','fulfillment','speech','Message','stringify','md5','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','create','then','catch','error','finally','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91df,0xed));var _0xf91d=function(_0x21c338,_0x576e4b){_0x21c338=_0x21c338-0x0;var _0x262fce=_0x91df[_0x21c338];return _0x262fce;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0xf91d('0x0'));var utils=require('./utils');var logger=require(_0xf91d('0x1'))(_0xf91d('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf91d('0x3')),'mailMessage':require(_0xf91d('0x4')),'smsMessage':require(_0xf91d('0x5')),'faxMessage':require(_0xf91d('0x6'))};exports[_0xf91d('0x7')]=function(_0xe498ee,_0x18e8ce){return function(_0x509710){try{if(!_['isNil'](this[_0xf91d('0x8')]['UserId'])){logger[_0xf91d('0x9')](_0xf91d('0xa'),_0xe498ee,_0xf91d('0xb'));return _0x509710[_0xf91d('0xc')]();}var _0x3b5346={'ContactId':this[_0xf91d('0xd')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf91d('0xe')};var _0x3c58d5=this[_0xf91d('0xf')];if(_0x3c58d5===_0xf91d('0x10')){_0x3b5346[_0xf91d('0x11')]=this[_0xf91d('0x12')]['id'];}else{_0x3b5346[_['upperFirst'](_0x3c58d5)+'AccountId']=this[_0xf91d('0x12')]['id'];}_0x3b5346[_[_0xf91d('0x13')](_0x3c58d5)+_0xf91d('0x14')]=this[_0xf91d('0x8')]['id'];if(this[_0xf91d('0x8')][_0xf91d('0x15')]){var _0x37cf2f=_0x18e8ce[0x2];if(!_[_0xf91d('0x16')](_0x37cf2f)){_0x3b5346['body']=utils['getMustacheRender'](_0x37cf2f,this);return rpc[_0x3c58d5+'Message'][_0xf91d('0x17')](_0x3b5346)[_0xf91d('0x18')](function(_0x48bdd2){logger[_0xf91d('0x9')](_0xf91d('0xa'),_0xe498ee,_0x3b5346['body']);})[_0xf91d('0x19')](function(_0x3fa376){logger[_0xf91d('0x1a')](_0xf91d('0xa'),_0xe498ee,JSON['stringify'](_0x3fa376));})[_0xf91d('0x1b')](function(){logger[_0xf91d('0x9')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xe498ee);_0x509710[_0xf91d('0x1c')]();});}else{logger[_0xf91d('0x9')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xe498ee);_0x509710[_0xf91d('0x1c')]();}}else{var _0xb20ef9=this;var _0x3c31b7=apiai(_0x18e8ce[0x0],{'language':_0x18e8ce[0x1]||'en'});return _0x3c31b7[_0xf91d('0x1d')](this[_0xf91d('0x1e')][_0xf91d('0x1f')],{'sessionId':md5(this[_0xf91d('0x8')]['id'])})[_0xf91d('0x18')](function(_0x18efc2){_0xb20ef9[_0xf91d('0x1f')][_0xf91d('0x20')]=_0x18efc2;_0x3b5346[_0xf91d('0x1f')]=_0x18efc2[_0xf91d('0x21')][_0xf91d('0x22')][_0xf91d('0x23')];return rpc[_0x3c58d5+_0xf91d('0x24')]['create'](_0x3b5346)[_0xf91d('0x18')](function(_0x3c3069){logger[_0xf91d('0x9')](_0xf91d('0xa'),_0xe498ee,_0x3b5346[_0xf91d('0x1f')]);if(_0x18efc2[_0xf91d('0x21')]['metadata']['endConversation']){_0x509710[_0xf91d('0xc')]();}else{_0x509710[_0xf91d('0x1c')]();}})[_0xf91d('0x19')](function(_0x5e5222){logger['error'](_0xf91d('0xa'),_0xe498ee,JSON[_0xf91d('0x25')](_0x5e5222));_0x509710[_0xf91d('0xc')]();});})[_0xf91d('0x19')](function(_0x14a9a9){logger[_0xf91d('0x1a')](_0xf91d('0xa'),_0xe498ee,_0x14a9a9[_0xf91d('0x1e')]);_0x509710['next']();});}}catch(_0x377129){logger['error'](_0xf91d('0xa'),_0xe498ee,JSON[_0xf91d('0x25')](_0x377129));_0x509710[_0xf91d('0x1c')]();}};}; \ 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 0b67891..2d681ee 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 _0x9939=['error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length'];(function(_0x41c018,_0x25a0d0){var _0x42af5f=function(_0x29a76e){while(--_0x29a76e){_0x41c018['push'](_0x41c018['shift']());}};_0x42af5f(++_0x25a0d0);}(_0x9939,0x64));var _0x9993=function(_0x597001,_0x44fa60){_0x597001=_0x597001-0x0;var _0x3d048b=_0x9939[_0x597001];return _0x3d048b;};'use strict';var schema=require(_0x9993('0x0'));var _=require(_0x9993('0x1'));var htmlToText=require(_0x9993('0x2'));var utils=require('./utils');var logger=require(_0x9993('0x3'))(_0x9993('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x9993('0x5')},'priorityTrue':{'type':'number','message':_0x9993('0x6')},'priorityFalse':{'type':_0x9993('0x7'),'message':_0x9993('0x8')}});exports['consequence']=function(_0x4ab292,_0xb5ce7d){return function(_0x5540d0){try{var _0x4b5aec={'condition':htmlToText['fromString'](utils[_0x9993('0x9')](_0xb5ce7d[0x0],this),{'wordwrap':![]})[_0x9993('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xb5ce7d[0x1],'priorityFalse':_0xb5ce7d[0x2]};var _0x45e365=gotoif['validate'](_0x4b5aec,{'typecast':!![]});if(_0x45e365[_0x9993('0xb')]){logger[_0x9993('0xc')](_0x9993('0xd'),_0x4ab292,_[_0x9993('0xe')](_0x45e365,_0x9993('0xf'))[_0x9993('0x10')](',\x20'));_0x5540d0[_0x9993('0x11')]();}else{try{var _0x566999=eval('('+_0x4b5aec[_0x9993('0x12')]+')');var _0x5bbf07=_0x566999?_0x4b5aec[_0x9993('0x13')]:_0x4b5aec[_0x9993('0x14')];logger[_0x9993('0x15')](_0x9993('0x16'),_0x4ab292,_0x4b5aec[_0x9993('0x12')],_0x566999,_0x5bbf07||_0x9993('0x17'));if(_0x5bbf07){var _0x1a51c6=_[_0x9993('0x18')](_0x5540d0[_0x9993('0x19')](),{'p':_0x5bbf07});if(_0x1a51c6>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4ab292,_0x5bbf07||'next',_0x1a51c6);_0x5540d0['next'](_0x1a51c6);}else{logger[_0x9993('0x15')](_0x9993('0x1a'),_0x4ab292,_0x5bbf07||_0x9993('0x17'));_0x5540d0[_0x9993('0x11')]();}}else{_0x5540d0[_0x9993('0x17')]();}}catch(_0x17c9a1){logger['error'](_0x9993('0x1b'),_0x4ab292,_0x17c9a1[_0x9993('0xf')]);_0x5540d0[_0x9993('0x11')]();}}}catch(_0x5be5d9){logger['error'](_0x9993('0xd'),_0x4ab292,JSON['stringify'](_0x5be5d9));_0x5540d0[_0x9993('0x11')]();}};}; \ No newline at end of file +var _0xcdb7=['[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','html-to-text','./utils','routing','priority\x20true\x20is\x20a\x20number','number','getMustacheRender','replace','validate','length'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xcdb7,0x1d2));var _0x7cdb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xcdb7[_0x501510];return _0x1e6ee5;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x7cdb('0x0'));var utils=require(_0x7cdb('0x1'));var logger=require('../../../../config/logger')(_0x7cdb('0x2'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x7cdb('0x3')},'priorityFalse':{'type':_0x7cdb('0x4'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0xd19ec7,_0x49649a){return function(_0x41863e){try{var _0x537687={'condition':htmlToText['fromString'](utils[_0x7cdb('0x5')](_0x49649a[0x0],this),{'wordwrap':![]})[_0x7cdb('0x6')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x49649a[0x1],'priorityFalse':_0x49649a[0x2]};var _0x2783b5=gotoif[_0x7cdb('0x7')](_0x537687,{'typecast':!![]});if(_0x2783b5[_0x7cdb('0x8')]){logger['error'](_0x7cdb('0x9'),_0xd19ec7,_[_0x7cdb('0xa')](_0x2783b5,'message')[_0x7cdb('0xb')](',\x20'));_0x41863e[_0x7cdb('0xc')]();}else{try{var _0x579a67=eval('('+_0x537687[_0x7cdb('0xd')]+')');var _0x1db57e=_0x579a67?_0x537687['priorityTrue']:_0x537687[_0x7cdb('0xe')];logger['info'](_0x7cdb('0xf'),_0xd19ec7,_0x537687[_0x7cdb('0xd')],_0x579a67,_0x1db57e||_0x7cdb('0x10'));if(_0x1db57e){var _0x571779=_['findIndex'](_0x41863e[_0x7cdb('0x11')](),{'p':_0x1db57e});if(_0x571779>=0x0){logger['info'](_0x7cdb('0x12'),_0xd19ec7,_0x1db57e||_0x7cdb('0x10'),_0x571779);_0x41863e[_0x7cdb('0x10')](_0x571779);}else{logger[_0x7cdb('0x13')](_0x7cdb('0x14'),_0xd19ec7,_0x1db57e||_0x7cdb('0x10'));_0x41863e[_0x7cdb('0xc')]();}}else{_0x41863e['next']();}}catch(_0x1d8076){logger[_0x7cdb('0x15')](_0x7cdb('0x16'),_0xd19ec7,_0x1d8076[_0x7cdb('0x17')]);_0x41863e[_0x7cdb('0xc')]();}}}catch(_0x560527){logger[_0x7cdb('0x15')](_0x7cdb('0x9'),_0xd19ec7,JSON[_0x7cdb('0x18')](_0x560527));_0x41863e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 6c59d91..ddb30e7 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 _0x62cd=['[%s][GOTOP]\x20%s','map','message','join','stop','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x62cd,0x19e));var _0xd62c=function(_0x492edf,_0x46280d){_0x492edf=_0x492edf-0x0;var _0x57140d=_0x62cd[_0x492edf];return _0x57140d;};'use strict';var schema=require('validate');var _=require(_0xd62c('0x0'));var logger=require('../../../../config/logger')(_0xd62c('0x1'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xd62c('0x2')}});exports[_0xd62c('0x3')]=function(_0x57d479,_0x422c79){return function(_0x62569f){try{var _0x22d952={'priority':_0x422c79[0x0]};var _0x4a2d91=gotop[_0xd62c('0x4')](_0x22d952,{'typecast':!![]});if(_0x4a2d91[_0xd62c('0x5')]){logger['error'](_0xd62c('0x6'),_0x57d479,_[_0xd62c('0x7')](_0x4a2d91,_0xd62c('0x8'))[_0xd62c('0x9')](',\x20'));_0x62569f[_0xd62c('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x57d479,_0x22d952[_0xd62c('0xb')]);if(_0x22d952[_0xd62c('0xb')]){var _0xd1a0d9=_[_0xd62c('0xc')](_0x62569f[_0xd62c('0xd')](),{'p':_0x22d952[_0xd62c('0xb')]});if(_0xd1a0d9>=0x0){logger[_0xd62c('0xe')](_0xd62c('0xf'),_0x57d479,_0x22d952[_0xd62c('0xb')]||_0xd62c('0x10'),_0xd1a0d9);_0x62569f[_0xd62c('0x10')](_0xd1a0d9);}else{logger[_0xd62c('0xe')](_0xd62c('0x11'),_0x57d479,_0x22d952[_0xd62c('0xb')]||'next');_0x62569f[_0xd62c('0xa')]();}}else{_0x62569f[_0xd62c('0x10')]();}}}catch(_0x1e6744){logger[_0xd62c('0x12')](_0xd62c('0x6'),_0x57d479,JSON[_0xd62c('0x13')](_0x1e6744));_0x62569f[_0xd62c('0xa')]();}};}; \ No newline at end of file +var _0xbb75=['error','[%s][GOTOP]\x20%s','validate','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','map','message','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x5e3fb7,_0x4f0c05){var _0x3c9228=function(_0x8636ae){while(--_0x8636ae){_0x5e3fb7['push'](_0x5e3fb7['shift']());}};_0x3c9228(++_0x4f0c05);}(_0xbb75,0xdf));var _0x5bb7=function(_0xf14a09,_0x29aa5a){_0xf14a09=_0xf14a09-0x0;var _0x1e253c=_0xbb75[_0xf14a09];return _0x1e253c;};'use strict';var schema=require(_0x5bb7('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x5bb7('0x1')}});exports['consequence']=function(_0x49d454,_0x2e4d23){return function(_0x5e495f){try{var _0x485eef={'priority':_0x2e4d23[0x0]};var _0x2c79e5=gotop['validate'](_0x485eef,{'typecast':!![]});if(_0x2c79e5['length']){logger['error']('[%s][GOTOP]\x20%s',_0x49d454,_[_0x5bb7('0x2')](_0x2c79e5,_0x5bb7('0x3'))[_0x5bb7('0x4')](',\x20'));_0x5e495f[_0x5bb7('0x5')]();}else{logger[_0x5bb7('0x6')]('[%s][GOTOP]\x20priority\x20%s',_0x49d454,_0x485eef['priority']);if(_0x485eef[_0x5bb7('0x7')]){var _0x17a7e0=_[_0x5bb7('0x8')](_0x5e495f['rules'](),{'p':_0x485eef[_0x5bb7('0x7')]});if(_0x17a7e0>=0x0){logger[_0x5bb7('0x6')](_0x5bb7('0x9'),_0x49d454,_0x485eef[_0x5bb7('0x7')]||_0x5bb7('0xa'),_0x17a7e0);_0x5e495f[_0x5bb7('0xa')](_0x17a7e0);}else{logger[_0x5bb7('0x6')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x49d454,_0x485eef[_0x5bb7('0x7')]||_0x5bb7('0xa'));_0x5e495f[_0x5bb7('0x5')]();}}else{_0x5e495f[_0x5bb7('0xa')]();}}}catch(_0x4c406){logger[_0x5bb7('0xb')](_0x5bb7('0xc'),_0x49d454,JSON['stringify'](_0x4c406));_0x5e495f['stop']();}};}; \ 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 0ef89fa..e9b3ebd 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 _0xef8b=['channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact'];(function(_0x2035be,_0x4403e0){var _0x2b497d=function(_0x3b61c0){while(--_0x3b61c0){_0x2035be['push'](_0x2035be['shift']());}};_0x2b497d(++_0x4403e0);}(_0xef8b,0x145));var _0xbef8=function(_0x469665,_0x394876){_0x469665=_0x469665-0x0;var _0x291ab5=_0xef8b[_0x469665];return _0x291ab5;};'use strict';var _=require(_0xbef8('0x0'));var utils=require(_0xbef8('0x1'));var logger=require(_0xbef8('0x2'))(_0xbef8('0x3'));var rpc={'chatMessage':require(_0xbef8('0x4')),'openchannelMessage':require(_0xbef8('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xbef8('0x6')),'faxMessage':require(_0xbef8('0x7'))};exports[_0xbef8('0x8')]=function(_0x50c018,_0x3161a9){return function(_0x40d392){try{var _0x2944c1={'body':utils[_0xbef8('0x9')](_0x3161a9[0x0],this),'ContactId':this[_0xbef8('0xa')]['id']};if(this[_0xbef8('0xb')]===_0xbef8('0xc')){_0x2944c1['ChatWebsiteId']=this[_0xbef8('0xd')]['id'];}else{_0x2944c1[_[_0xbef8('0xe')](this[_0xbef8('0xb')])+_0xbef8('0xf')]=this[_0xbef8('0xd')]['id'];}_0x2944c1[_['upperFirst'](this['channel'])+_0xbef8('0x10')]=this[_0xbef8('0x11')]['id'];if(rpc[this[_0xbef8('0xb')]+_0xbef8('0x12')]){return rpc[this[_0xbef8('0xb')]+_0xbef8('0x12')][_0xbef8('0x13')](_0x2944c1)['then'](function(_0x234651){logger[_0xbef8('0x14')](_0xbef8('0x15'),_0x50c018,_0x2944c1[_0xbef8('0x16')]);_0x40d392[_0xbef8('0x17')]();})[_0xbef8('0x18')](function(_0x5d4d45){logger[_0xbef8('0x19')](_0xbef8('0x15'),_0x50c018,JSON[_0xbef8('0x1a')](_0x5d4d45));_0x40d392[_0xbef8('0x1b')]();});}}catch(_0x166f83){logger[_0xbef8('0x19')]('[%s][MESSAGE]\x20%s',_0x50c018,JSON['stringify'](_0x166f83));_0x40d392['stop']();}};}; \ No newline at end of file +var _0x4cd2=['upperFirst','AccountId','Message','then','info','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account'];(function(_0xe6d3a,_0x4bb8df){var _0x22a951=function(_0x38cbe0){while(--_0x38cbe0){_0xe6d3a['push'](_0xe6d3a['shift']());}};_0x22a951(++_0x4bb8df);}(_0x4cd2,0xc2));var _0x24cd=function(_0xa0a817,_0x22b987){_0xa0a817=_0xa0a817-0x0;var _0x19f1ff=_0x4cd2[_0xa0a817];return _0x19f1ff;};'use strict';var _=require(_0x24cd('0x0'));var utils=require(_0x24cd('0x1'));var logger=require(_0x24cd('0x2'))(_0x24cd('0x3'));var rpc={'chatMessage':require(_0x24cd('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x24cd('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x24cd('0x6'))};exports[_0x24cd('0x7')]=function(_0x39a03c,_0x3ec540){return function(_0x46a90c){try{var _0x56634f={'body':utils[_0x24cd('0x8')](_0x3ec540[0x0],this),'ContactId':this[_0x24cd('0x9')]['id']};if(this[_0x24cd('0xa')]==='chat'){_0x56634f[_0x24cd('0xb')]=this[_0x24cd('0xc')]['id'];}else{_0x56634f[_[_0x24cd('0xd')](this[_0x24cd('0xa')])+_0x24cd('0xe')]=this[_0x24cd('0xc')]['id'];}_0x56634f[_['upperFirst'](this[_0x24cd('0xa')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x24cd('0xa')]+'Message']){return rpc[this['channel']+_0x24cd('0xf')]['create'](_0x56634f)[_0x24cd('0x10')](function(_0x105cbd){logger[_0x24cd('0x11')]('[%s][MESSAGE]\x20%s',_0x39a03c,_0x56634f[_0x24cd('0x12')]);_0x46a90c['next']();})[_0x24cd('0x13')](function(_0xfac153){logger[_0x24cd('0x14')]('[%s][MESSAGE]\x20%s',_0x39a03c,JSON[_0x24cd('0x15')](_0xfac153));_0x46a90c[_0x24cd('0x16')]();});}}catch(_0x4d028f){logger['error']('[%s][MESSAGE]\x20%s',_0x39a03c,JSON['stringify'](_0x4d028f));_0x46a90c['stop']();}};}; \ 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 cefaee6..e718a27 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 _0xe9f9=['./utils','routing','consequence','[%s][NOOP]\x20%s','next','stop'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xe9f9,0x174));var _0x9e9f=function(_0x200b35,_0x1929d4){_0x200b35=_0x200b35-0x0;var _0x32d3d7=_0xe9f9[_0x200b35];return _0x32d3d7;};'use strict';var utils=require(_0x9e9f('0x0'));var logger=require('../../../../config/logger')(_0x9e9f('0x1'));exports[_0x9e9f('0x2')]=function(_0x24e489,_0x439590){return function(_0x15d8d0){try{logger['info'](_0x9e9f('0x3'),_0x24e489,utils['getMustacheRender'](_0x439590[0x0],this));_0x15d8d0[_0x9e9f('0x4')]();}catch(_0xde96fc){logger['error'](_0x9e9f('0x3'),_0x24e489,JSON['stringify'](_0xde96fc));_0x15d8d0[_0x9e9f('0x5')]();}};}; \ No newline at end of file +var _0x13e2=['error','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','next'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x13e2,0x86));var _0x213e=function(_0x110d0d,_0x4cbd98){_0x110d0d=_0x110d0d-0x0;var _0x586e10=_0x13e2[_0x110d0d];return _0x586e10;};'use strict';var utils=require(_0x213e('0x0'));var logger=require(_0x213e('0x1'))(_0x213e('0x2'));exports[_0x213e('0x3')]=function(_0x252b92,_0x456dd4){return function(_0x57ca6e){try{logger[_0x213e('0x4')]('[%s][NOOP]\x20%s',_0x252b92,utils['getMustacheRender'](_0x456dd4[0x0],this));_0x57ca6e[_0x213e('0x5')]();}catch(_0x4ff4eb){logger[_0x213e('0x6')](_0x213e('0x7'),_0x252b92,JSON[_0x213e('0x8')](_0x4ff4eb));_0x57ca6e[_0x213e('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index c8333f3..027e001 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 _0x9fff=['close','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','[%s][QUEUE]\x20ROUTING\x20END','next','strategy','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','channel','QueueId','upperFirst','interaction','MessageId','message','AccountId','account','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','find','Queues','atimeout','qtimeout'];(function(_0x3d6135,_0x256136){var _0x16f3c1=function(_0x5e7576){while(--_0x5e7576){_0x3d6135['push'](_0x3d6135['shift']());}};_0x16f3c1(++_0x256136);}(_0x9fff,0x9b));var _0xf9ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fff[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xf9ff('0x0'));var _=require(_0xf9ff('0x1'));var util=require(_0xf9ff('0x2'));var seqqueue=require(_0xf9ff('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0xf9ff('0x4'))('routing');var strategy=require(_0xf9ff('0x5'));config['redis']=_[_0xf9ff('0x6')](config[_0xf9ff('0x7')],{'host':_0xf9ff('0x8'),'port':0x18eb});var io=require(_0xf9ff('0x9'))(new Redis(config[_0xf9ff('0x7')]));var attributes=['id',_0xf9ff('0xa'),'account',_0xf9ff('0xb'),_0xf9ff('0xc'),_0xf9ff('0xd')];function emit(_0x45eef7,_0x14fea8,_0x3f1d35){io['to'](_0x45eef7)[_0xf9ff('0xe')](_0x14fea8,_0x3f1d35);}function emitChannelQueueInteraction(_0x4ec88c,_0x5e0648,_0x2e1efe,_0x1c70d6,_0x14df76,_0x4d4e51,_0x162a42,_0xa2c485){_0x2e1efe[_0xf9ff('0xa')]=_0xa2c485;_0x2e1efe[_0xf9ff('0xb')]=_0x5e0648;_0x2e1efe['account']=_0x1c70d6;_0x2e1efe['id']=_0x14df76;if(_0x4d4e51){_0x162a42[util[_0xf9ff('0xf')]('%sQueuesWaitingInteractions',_0x4ec88c)][_0x14df76]=_['pick'](_0x2e1efe,attributes);}else{delete _0x162a42[util['format'](_0xf9ff('0x10'),_0x4ec88c)][_0x14df76];}emit(util[_0xf9ff('0xf')]('%s:queue:%s',_0x4ec88c,_0x5e0648),util[_0xf9ff('0xf')](_0xf9ff('0x11'),_0x4ec88c,_0x4d4e51?'save':_0xf9ff('0x12')),_[_0xf9ff('0x13')](_0x2e1efe,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xf9ff('0x14')),'chatQueueReport':require(_0xf9ff('0x15')),'smsQueueReport':require(_0xf9ff('0x16')),'faxQueueReport':require(_0xf9ff('0x17'))};var queue=schema({'name':{'type':_0xf9ff('0x18'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf9ff('0x19'),'message':_0xf9ff('0x1a')}});function startRouting(_0x107c49,_0x547903,_0x36a7cb,_0x38074c){if(_0x107c49&&_0x547903&&_0x36a7cb){_0x547903[_0xf9ff('0x1b')]+=0x1;var _0x4fe663={'uniqueid':_0x107c49,'from':_0x36a7cb[_0xf9ff('0x1c')]?_0x36a7cb['body'][_0xf9ff('0xc')]:'','joinAt':moment()[_0xf9ff('0xf')](_0xf9ff('0x1d')),'ContactId':_0x36a7cb[_0xf9ff('0x1e')]?_0x36a7cb[_0xf9ff('0x1e')]['id']:null,'ListId':_0x36a7cb['list']?_0x36a7cb['list']['id']:null};_0x4fe663[_['upperFirst'](_0x36a7cb[_0xf9ff('0x1f')])+_0xf9ff('0x20')]=_0x547903['id']||null;_0x4fe663[_[_0xf9ff('0x21')](_0x36a7cb['channel'])+'InteractionId']=_0x36a7cb[_0xf9ff('0x22')]?_0x36a7cb[_0xf9ff('0x22')]['id']:null;_0x4fe663[_['upperFirst'](_0x36a7cb['channel'])+_0xf9ff('0x23')]=_0x36a7cb[_0xf9ff('0x24')]?_0x36a7cb[_0xf9ff('0x24')]['id']:null;_0x4fe663[_[_0xf9ff('0x21')](_0x36a7cb[_0xf9ff('0x1f')])+(_0x36a7cb[_0xf9ff('0x1f')]!=='chat'?_0xf9ff('0x25'):'WebsiteId')]=_0x36a7cb[_0xf9ff('0x26')]?_0x36a7cb[_0xf9ff('0x26')]['id']:null;logger['info'](util[_0xf9ff('0xf')](_0xf9ff('0x27'),_0x107c49,_0x547903['name']));emitChannelQueueInteraction(_0x36a7cb[_0xf9ff('0x1f')],_0x547903['name'],_0x4fe663,_0x36a7cb['account'][_0xf9ff('0x28')],_0x36a7cb['message']['id'],!![],_0x38074c,_0x547903['id']);if(rpc[_0x36a7cb['channel']+_0xf9ff('0x29')]){return rpc[_0x36a7cb[_0xf9ff('0x1f')]+'QueueReport'][_0xf9ff('0x2a')](_0x4fe663)[_0xf9ff('0x2b')](function(_0x1d4e5d){logger[_0xf9ff('0x2c')](_0xf9ff('0x2d'));});}}}function stopRouting(_0x3d9cd6,_0x29a5e2,_0x7045b,_0x5cb358){if(_0x3d9cd6&&_0x29a5e2){_0x29a5e2[_0xf9ff('0x1b')]-=0x1;var _0x202892={'leaveAt':moment()[_0xf9ff('0xf')](_0xf9ff('0x1d')),'acceptAt':moment()['format'](_0xf9ff('0x1d')),'reason':'accepted'};logger[_0xf9ff('0x2e')](util[_0xf9ff('0xf')](_0xf9ff('0x2f'),_0x3d9cd6,_0x29a5e2[_0xf9ff('0x28')]));emitChannelQueueInteraction(_0x7045b[_0xf9ff('0x1f')],_0x29a5e2[_0xf9ff('0x28')],_0x7045b['body'],_0x7045b[_0xf9ff('0x26')][_0xf9ff('0x28')],_0x7045b[_0xf9ff('0x24')]['id'],![],_0x5cb358,_0x29a5e2['id']);if(rpc[_0x7045b['channel']+'QueueReport']){return rpc[_0x7045b[_0xf9ff('0x1f')]+_0xf9ff('0x29')][_0xf9ff('0x30')](_0x3d9cd6,_0x202892)[_0xf9ff('0x2b')](function(_0x250b41){logger[_0xf9ff('0x2c')](_0xf9ff('0x31'));});}}}function endRouting(_0x31f1c1,_0x6a3180,_0x12f8c1,_0xeda3c3){if(_0x31f1c1&&_0x6a3180){_0x6a3180[_0xf9ff('0x1b')]-=0x1;var _0x467a39={'leaveAt':moment()[_0xf9ff('0xf')](_0xf9ff('0x1d')),'exitAt':moment()[_0xf9ff('0xf')](_0xf9ff('0x1d')),'reason':_0xf9ff('0x32')};logger['info'](util[_0xf9ff('0xf')](_0xf9ff('0x33'),_0x31f1c1,_0x6a3180[_0xf9ff('0x28')]));emitChannelQueueInteraction(_0x12f8c1[_0xf9ff('0x1f')],_0x6a3180[_0xf9ff('0x28')],_0x12f8c1[_0xf9ff('0x1c')],_0x12f8c1['account'][_0xf9ff('0x28')],_0x12f8c1[_0xf9ff('0x24')]['id'],![],_0xeda3c3);if(rpc[_0x12f8c1['channel']+_0xf9ff('0x29')]){return rpc[_0x12f8c1[_0xf9ff('0x1f')]+_0xf9ff('0x29')][_0xf9ff('0x30')](_0x31f1c1,_0x467a39)[_0xf9ff('0x2b')](function(_0x13d7a0){logger['error'](_0xf9ff('0x31'));});}}}function handleFindQueue(_0x4d5dea){return function(_0x4b1142){return _0x4b1142[_0xf9ff('0x28')][_0xf9ff('0x34')]()===_0x4d5dea[_0xf9ff('0x34')]();};}exports[_0xf9ff('0x35')]=function(_0x201d71,_0x138d10,_0x2f2d50,_0x37df4d){return function(_0x2025e1){try{var _0x330c80={'name':_0x138d10[0x0],'timeout':_0x138d10[0x1]};var _0x5679f4=queue['validate'](_0x330c80,{'typecast':!![]});if(_0x5679f4[_0xf9ff('0x36')]){logger[_0xf9ff('0x2c')](_0xf9ff('0x37'),_0x201d71,_['map'](_0x5679f4,_0xf9ff('0x24'))[_0xf9ff('0x38')](',\x20'));_0x2025e1['stop']();}else{var _0x4c1219=_[_0xf9ff('0x39')](_0x2f2d50[_0x37df4d[_0xf9ff('0x1f')]+_0xf9ff('0x3a')],handleFindQueue(_0x330c80[_0xf9ff('0x28')]));if(_0x4c1219){startRouting(_0x201d71,_0x4c1219,_0x37df4d,_0x2f2d50);var _0x11b962=(_0x4c1219[_0xf9ff('0x32')]||0xa)*0x3e8;var _0x572eed=(_0x330c80[_0xf9ff('0x32')]||0x14)*0x3e8;var _0x213bd9,_0x4eb97a;if(_0x11b962>_0x572eed){_0x572eed=_0x11b962;}var _0x569b3c=seqqueue['createQueue'](_0x11b962);_0x569b3c['id']=_0x201d71;_0x569b3c[_0xf9ff('0x3b')]=_0x11b962;_0x569b3c[_0xf9ff('0x3c')]=_0x572eed;_0x569b3c[_0xf9ff('0x1f')]=_0x37df4d[_0xf9ff('0x1f')];_0x2f2d50['rules'][_0x201d71]['on']('end',function(){stopRouting(_0x201d71,_0x4c1219,_0x37df4d,_0x2f2d50);_0x569b3c[_0xf9ff('0x3d')](!![]);clearTimeout(_0x213bd9);_0x213bd9=undefined;if(_0x2f2d50['rules'][_0x201d71]){delete _0x2f2d50[_0xf9ff('0x3e')][_0x201d71];}logger[_0xf9ff('0x2e')](_0xf9ff('0x3f'),_0x201d71);_0x2025e1[_0xf9ff('0x40')]();});_0x213bd9=setTimeout(function(){endRouting(_0x201d71,_0x4c1219,_0x37df4d,_0x2f2d50);clearTimeout(_0x213bd9);_0x569b3c['close'](!![]);logger[_0xf9ff('0x2e')](_0xf9ff('0x41'),_0x201d71);_0x2025e1[_0xf9ff('0x42')]();},_0x572eed);switch(_0x4c1219[_0xf9ff('0x43')]){case _0xf9ff('0x44'):strategy[_0xf9ff('0x44')](_0x569b3c,_0x4c1219,_0x2f2d50,_0x37df4d);break;default:strategy[_0xf9ff('0x45')](_0x569b3c,_0x4c1219,_0x2f2d50,_0x37df4d);}}else{logger[_0xf9ff('0x2c')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x201d71,_0x330c80[_0xf9ff('0x28')]);_0x2025e1[_0xf9ff('0x40')]();}}}catch(_0x237a7d){console[_0xf9ff('0x46')](_0x237a7d);logger[_0xf9ff('0x2c')](_0xf9ff('0x37'),_0x201d71,_0x237a7d[_0xf9ff('0x47')]);_0x2025e1['stop']();}};}; \ No newline at end of file +var _0xd8cc=['rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','account','queue','from','queue_id','pick','format','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','stop','Queues','createQueue','atimeout','qtimeout','rules','end','close','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20ROUTING\x20END','strategy'];(function(_0x12a1d8,_0x1eb9dc){var _0x575284=function(_0x49b6e0){while(--_0x49b6e0){_0x12a1d8['push'](_0x12a1d8['shift']());}};_0x575284(++_0x1eb9dc);}(_0xd8cc,0x1d2));var _0xcd8c=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0xd8cc[_0x2ab365];return _0x49fef3;};'use strict';var schema=require(_0xcd8c('0x0'));var _=require(_0xcd8c('0x1'));var util=require(_0xcd8c('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xcd8c('0x3'));var Redis=require(_0xcd8c('0x4'));var config=require(_0xcd8c('0x5'));var logger=require(_0xcd8c('0x6'))(_0xcd8c('0x7'));var strategy=require('./strategy');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id','queue_id',_0xcd8c('0x8'),_0xcd8c('0x9'),_0xcd8c('0xa'),'joinAt'];function emit(_0x2647c5,_0x17c7ce,_0x418810){io['to'](_0x2647c5)['emit'](_0x17c7ce,_0x418810);}function emitChannelQueueInteraction(_0x37243e,_0x36abf1,_0x430547,_0x2de2a5,_0x56e7c9,_0x1de9ab,_0x4096ca,_0x5805fa){_0x430547[_0xcd8c('0xb')]=_0x5805fa;_0x430547['queue']=_0x36abf1;_0x430547[_0xcd8c('0x8')]=_0x2de2a5;_0x430547['id']=_0x56e7c9;if(_0x1de9ab){_0x4096ca[util['format']('%sQueuesWaitingInteractions',_0x37243e)][_0x56e7c9]=_[_0xcd8c('0xc')](_0x430547,attributes);}else{delete _0x4096ca[util[_0xcd8c('0xd')]('%sQueuesWaitingInteractions',_0x37243e)][_0x56e7c9];}emit(util[_0xcd8c('0xd')]('%s:queue:%s',_0x37243e,_0x36abf1),util['format'](_0xcd8c('0xe'),_0x37243e,_0x1de9ab?'save':_0xcd8c('0xf')),_[_0xcd8c('0xc')](_0x430547,attributes));}var rpc={'openchannelQueueReport':require(_0xcd8c('0x10')),'mailQueueReport':require(_0xcd8c('0x11')),'chatQueueReport':require(_0xcd8c('0x12')),'smsQueueReport':require(_0xcd8c('0x13')),'faxQueueReport':require(_0xcd8c('0x14'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xcd8c('0x15')},'timeout':{'type':_0xcd8c('0x16'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x13f964,_0x4bc2c8,_0x3238fd,_0x513621){if(_0x13f964&&_0x4bc2c8&&_0x3238fd){_0x4bc2c8['waiting']+=0x1;var _0x5dcd09={'uniqueid':_0x13f964,'from':_0x3238fd[_0xcd8c('0x17')]?_0x3238fd['body'][_0xcd8c('0xa')]:'','joinAt':moment()[_0xcd8c('0xd')](_0xcd8c('0x18')),'ContactId':_0x3238fd['contact']?_0x3238fd[_0xcd8c('0x19')]['id']:null,'ListId':_0x3238fd[_0xcd8c('0x1a')]?_0x3238fd[_0xcd8c('0x1a')]['id']:null};_0x5dcd09[_[_0xcd8c('0x1b')](_0x3238fd[_0xcd8c('0x1c')])+_0xcd8c('0x1d')]=_0x4bc2c8['id']||null;_0x5dcd09[_[_0xcd8c('0x1b')](_0x3238fd[_0xcd8c('0x1c')])+_0xcd8c('0x1e')]=_0x3238fd[_0xcd8c('0x1f')]?_0x3238fd[_0xcd8c('0x1f')]['id']:null;_0x5dcd09[_[_0xcd8c('0x1b')](_0x3238fd[_0xcd8c('0x1c')])+'MessageId']=_0x3238fd[_0xcd8c('0x20')]?_0x3238fd['message']['id']:null;_0x5dcd09[_[_0xcd8c('0x1b')](_0x3238fd['channel'])+(_0x3238fd[_0xcd8c('0x1c')]!=='chat'?'AccountId':'WebsiteId')]=_0x3238fd['account']?_0x3238fd[_0xcd8c('0x8')]['id']:null;logger[_0xcd8c('0x21')](util[_0xcd8c('0xd')](_0xcd8c('0x22'),_0x13f964,_0x4bc2c8[_0xcd8c('0x23')]));emitChannelQueueInteraction(_0x3238fd['channel'],_0x4bc2c8[_0xcd8c('0x23')],_0x5dcd09,_0x3238fd['account'][_0xcd8c('0x23')],_0x3238fd[_0xcd8c('0x20')]['id'],!![],_0x513621,_0x4bc2c8['id']);if(rpc[_0x3238fd[_0xcd8c('0x1c')]+_0xcd8c('0x24')]){return rpc[_0x3238fd[_0xcd8c('0x1c')]+_0xcd8c('0x24')]['create'](_0x5dcd09)[_0xcd8c('0x25')](function(_0x1e0f10){logger[_0xcd8c('0x26')](_0xcd8c('0x27'));});}}}function stopRouting(_0x1a1287,_0x37f5aa,_0x232450,_0x578c12){if(_0x1a1287&&_0x37f5aa){_0x37f5aa[_0xcd8c('0x28')]-=0x1;var _0x442474={'leaveAt':moment()[_0xcd8c('0xd')](_0xcd8c('0x18')),'acceptAt':moment()[_0xcd8c('0xd')](_0xcd8c('0x18')),'reason':_0xcd8c('0x29')};logger[_0xcd8c('0x21')](util[_0xcd8c('0xd')](_0xcd8c('0x2a'),_0x1a1287,_0x37f5aa['name']));emitChannelQueueInteraction(_0x232450[_0xcd8c('0x1c')],_0x37f5aa['name'],_0x232450[_0xcd8c('0x17')],_0x232450['account'][_0xcd8c('0x23')],_0x232450[_0xcd8c('0x20')]['id'],![],_0x578c12,_0x37f5aa['id']);if(rpc[_0x232450[_0xcd8c('0x1c')]+_0xcd8c('0x24')]){return rpc[_0x232450[_0xcd8c('0x1c')]+'QueueReport'][_0xcd8c('0x2b')](_0x1a1287,_0x442474)['catch'](function(_0x89766f){logger[_0xcd8c('0x26')]('update\x20queue\x20report');});}}}function endRouting(_0xed33d,_0x57e537,_0x423464,_0x8f4357){if(_0xed33d&&_0x57e537){_0x57e537[_0xcd8c('0x28')]-=0x1;var _0x4e63f6={'leaveAt':moment()[_0xcd8c('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xcd8c('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xcd8c('0x2c')};logger[_0xcd8c('0x21')](util[_0xcd8c('0xd')](_0xcd8c('0x2d'),_0xed33d,_0x57e537[_0xcd8c('0x23')]));emitChannelQueueInteraction(_0x423464[_0xcd8c('0x1c')],_0x57e537[_0xcd8c('0x23')],_0x423464[_0xcd8c('0x17')],_0x423464[_0xcd8c('0x8')]['name'],_0x423464['message']['id'],![],_0x8f4357);if(rpc[_0x423464[_0xcd8c('0x1c')]+_0xcd8c('0x24')]){return rpc[_0x423464[_0xcd8c('0x1c')]+_0xcd8c('0x24')][_0xcd8c('0x2b')](_0xed33d,_0x4e63f6)['catch'](function(_0x3ef4b4){logger[_0xcd8c('0x26')](_0xcd8c('0x2e'));});}}}function handleFindQueue(_0x4f9ecb){return function(_0x53b30d){return _0x53b30d['name'][_0xcd8c('0x2f')]()===_0x4f9ecb[_0xcd8c('0x2f')]();};}exports[_0xcd8c('0x30')]=function(_0x4c5221,_0x5c3000,_0x1f046f,_0x3103ff){return function(_0x37009f){try{var _0x55bc33={'name':_0x5c3000[0x0],'timeout':_0x5c3000[0x1]};var _0x3e85bd=queue[_0xcd8c('0x0')](_0x55bc33,{'typecast':!![]});if(_0x3e85bd[_0xcd8c('0x31')]){logger['error'](_0xcd8c('0x32'),_0x4c5221,_['map'](_0x3e85bd,_0xcd8c('0x20'))['join'](',\x20'));_0x37009f[_0xcd8c('0x33')]();}else{var _0x22cbef=_['find'](_0x1f046f[_0x3103ff['channel']+_0xcd8c('0x34')],handleFindQueue(_0x55bc33[_0xcd8c('0x23')]));if(_0x22cbef){startRouting(_0x4c5221,_0x22cbef,_0x3103ff,_0x1f046f);var _0x101a99=(_0x22cbef[_0xcd8c('0x2c')]||0xa)*0x3e8;var _0x59f3b4=(_0x55bc33['timeout']||0x14)*0x3e8;var _0x53b4fb,_0x33b608;if(_0x101a99>_0x59f3b4){_0x59f3b4=_0x101a99;}var _0xc9ab66=seqqueue[_0xcd8c('0x35')](_0x101a99);_0xc9ab66['id']=_0x4c5221;_0xc9ab66[_0xcd8c('0x36')]=_0x101a99;_0xc9ab66[_0xcd8c('0x37')]=_0x59f3b4;_0xc9ab66[_0xcd8c('0x1c')]=_0x3103ff[_0xcd8c('0x1c')];_0x1f046f[_0xcd8c('0x38')][_0x4c5221]['on'](_0xcd8c('0x39'),function(){stopRouting(_0x4c5221,_0x22cbef,_0x3103ff,_0x1f046f);_0xc9ab66[_0xcd8c('0x3a')](!![]);clearTimeout(_0x53b4fb);_0x53b4fb=undefined;if(_0x1f046f['rules'][_0x4c5221]){delete _0x1f046f[_0xcd8c('0x38')][_0x4c5221];}logger[_0xcd8c('0x21')](_0xcd8c('0x3b'),_0x4c5221);_0x37009f[_0xcd8c('0x33')]();});_0x53b4fb=setTimeout(function(){endRouting(_0x4c5221,_0x22cbef,_0x3103ff,_0x1f046f);clearTimeout(_0x53b4fb);_0xc9ab66[_0xcd8c('0x3a')](!![]);logger['info'](_0xcd8c('0x3c'),_0x4c5221);_0x37009f['next']();},_0x59f3b4);switch(_0x22cbef[_0xcd8c('0x3d')]){case'rrmemory':strategy[_0xcd8c('0x3e')](_0xc9ab66,_0x22cbef,_0x1f046f,_0x3103ff);break;default:strategy[_0xcd8c('0x3f')](_0xc9ab66,_0x22cbef,_0x1f046f,_0x3103ff);}}else{logger['error'](_0xcd8c('0x40'),_0x4c5221,_0x55bc33[_0xcd8c('0x23')]);_0x37009f[_0xcd8c('0x33')]();}}}catch(_0x4cf844){console['log'](_0x4cf844);logger[_0xcd8c('0x26')](_0xcd8c('0x32'),_0x4c5221,_0x4cf844[_0xcd8c('0x41')]);_0x37009f[_0xcd8c('0x33')]();}};}; \ 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 e13ded5..a0e8022 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 _0x3bd5=['../../../../../config/logger','routing','squeue','agent','realtime','push','bind','timeout','handleTimeout','drained','handleDrained','handleRun','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','busy','busyQueue','showNotification','notificationId',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','lodash','uuid'];(function(_0x1fbd9f,_0x3ae6e7){var _0x1f0d96=function(_0xa295a3){while(--_0xa295a3){_0x1fbd9f['push'](_0x1fbd9f['shift']());}};_0x1f0d96(++_0x3ae6e7);}(_0x3bd5,0x13e));var _0x53bd=function(_0x3ba885,_0x2811f2){_0x3ba885=_0x3ba885-0x0;var _0x5a7d62=_0x3bd5[_0x3ba885];return _0x5a7d62;};'use strict';var _=require(_0x53bd('0x0'));var uuid=require(_0x53bd('0x1'));var util=require('./util');var logger=require(_0x53bd('0x2'))(_0x53bd('0x3'));var Agent=function(_0x3a77af,_0xbc33a2,_0x32a8a3,_0x5b84b9){this['notificationId']=uuid['v4']();this[_0x53bd('0x4')]=_0x3a77af;this[_0x53bd('0x5')]=_0xbc33a2;this[_0x53bd('0x6')]=_0x32a8a3;this[_0x53bd('0x3')]=_0x5b84b9;this['squeue'][_0x53bd('0x7')](this['handleRun'][_0x53bd('0x8')](this),this['handleTimeout'][_0x53bd('0x8')](this));this['squeue']['on'](_0x53bd('0x9'),this[_0x53bd('0xa')][_0x53bd('0x8')](this));this[_0x53bd('0x4')]['on'](_0x53bd('0xb'),this[_0x53bd('0xc')][_0x53bd('0x8')](this));};Agent['prototype'][_0x53bd('0x7')]=function(){this['squeue'][_0x53bd('0x7')](this[_0x53bd('0xd')][_0x53bd('0x8')](this),this[_0x53bd('0xa')][_0x53bd('0x8')](this));};Agent[_0x53bd('0xe')][_0x53bd('0xc')]=function(){this[_0x53bd('0xa')](!![]);};Agent[_0x53bd('0xe')][_0x53bd('0xd')]=function(_0x240d50){logger[_0x53bd('0xf')](_0x53bd('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0x53bd('0x11')](this[_0x53bd('0x6')]['agents'][this[_0x53bd('0x5')]['id']])){logger[_0x53bd('0xf')](_0x53bd('0x12'),this['squeue']['id'],this[_0x53bd('0x5')]['id']);setTimeout(this[_0x53bd('0x7')][_0x53bd('0x8')](this),0x3e8);}else{if(this[_0x53bd('0x3')][_0x53bd('0x13')]||util['isAgentAvailable'](this[_0x53bd('0x4')]['id'],this[_0x53bd('0x6')][_0x53bd('0x14')][this[_0x53bd('0x5')]['id']],this[_0x53bd('0x4')]['channel'],![])){this[_0x53bd('0x6')][_0x53bd('0x14')][this[_0x53bd('0x5')]['id']][_0x53bd('0x15')]=!![];this[_0x53bd('0x6')]['agents'][this[_0x53bd('0x5')]['id']][_0x53bd('0x16')]=undefined;util[_0x53bd('0x17')](this[_0x53bd('0x18')],this[_0x53bd('0x4')]['id'],this[_0x53bd('0x6')][_0x53bd('0x14')][this[_0x53bd('0x5')]['id']],null,this['routing']);util['writeLog'](this[_0x53bd('0x4')]['id'],this['realtime'][_0x53bd('0x14')][this[_0x53bd('0x5')]['id']],'RINGING'+(this['routing'][_0x53bd('0x13')]?_0x53bd('0x19'):''));}else{logger[_0x53bd('0xf')](_0x53bd('0x1a'),this['squeue']['id'],this[_0x53bd('0x5')]['id']);setTimeout(this[_0x53bd('0x7')]['bind'](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x536199){if(_[_0x53bd('0x11')](this[_0x53bd('0x6')]['agents'][this[_0x53bd('0x5')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x53bd('0x4')]['id'],this[_0x53bd('0x5')]['id']);}else{logger['info'](_0x53bd('0x1b'),this[_0x53bd('0x4')]['id'],this[_0x53bd('0x5')]['id']);util[_0x53bd('0x1c')](this[_0x53bd('0x18')],this[_0x53bd('0x4')]['id'],this[_0x53bd('0x6')][_0x53bd('0x14')][this[_0x53bd('0x5')]['id']],null,this['routing']);this[_0x53bd('0x6')][_0x53bd('0x14')][this[_0x53bd('0x5')]['id']][_0x53bd('0x15')]=![];this[_0x53bd('0x6')][_0x53bd('0x14')][this[_0x53bd('0x5')]['id']]['busyQueue']=undefined;util[_0x53bd('0x1d')](this['squeue']['id'],this[_0x53bd('0x6')][_0x53bd('0x14')][this[_0x53bd('0x5')]['id']],_0x536199?_0x53bd('0x1e'):_0x53bd('0x1f'));}if(!_0x536199){setTimeout(this[_0x53bd('0x7')]['bind'](this),0x3e8);}};function agent(_0x562b8a,_0x5335e2,_0x22c50c,_0x7145cc){return new Agent(_0x562b8a,_0x5335e2,_0x22c50c,_0x7145cc);}module['exports']=agent; \ No newline at end of file +var _0x1f4b=['drained','handleDrained','handleTimeout','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT','exports','lodash','../../../../../config/logger','notificationId','realtime','routing','push','handleRun','bind','squeue'];(function(_0x30c6e3,_0x6f1fb0){var _0x1baf11=function(_0x2a6473){while(--_0x2a6473){_0x30c6e3['push'](_0x30c6e3['shift']());}};_0x1baf11(++_0x6f1fb0);}(_0x1f4b,0x1a4));var _0xb1f4=function(_0x5e73de,_0x48194d){_0x5e73de=_0x5e73de-0x0;var _0x1b1f6b=_0x1f4b[_0x5e73de];return _0x1b1f6b;};'use strict';var _=require(_0xb1f4('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0xb1f4('0x1'))('routing');var Agent=function(_0x5d95ab,_0x8e678f,_0x43d438,_0x361f4b){this[_0xb1f4('0x2')]=uuid['v4']();this['squeue']=_0x5d95ab;this['agent']=_0x8e678f;this[_0xb1f4('0x3')]=_0x43d438;this[_0xb1f4('0x4')]=_0x361f4b;this['squeue'][_0xb1f4('0x5')](this[_0xb1f4('0x6')]['bind'](this),this['handleTimeout'][_0xb1f4('0x7')](this));this['squeue']['on']('timeout',this['handleTimeout'][_0xb1f4('0x7')](this));this[_0xb1f4('0x8')]['on'](_0xb1f4('0x9'),this[_0xb1f4('0xa')][_0xb1f4('0x7')](this));};Agent['prototype'][_0xb1f4('0x5')]=function(){this[_0xb1f4('0x8')][_0xb1f4('0x5')](this[_0xb1f4('0x6')]['bind'](this),this[_0xb1f4('0xb')][_0xb1f4('0x7')](this));};Agent[_0xb1f4('0xc')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0xb1f4('0xc')]['handleRun']=function(_0x3a71f7){logger[_0xb1f4('0xd')](_0xb1f4('0xe'),this['squeue']['id'],this['agent']['id']);if(_[_0xb1f4('0xf')](this[_0xb1f4('0x3')][_0xb1f4('0x10')][this[_0xb1f4('0x11')]['id']])){logger['info'](_0xb1f4('0x12'),this['squeue']['id'],this[_0xb1f4('0x11')]['id']);setTimeout(this[_0xb1f4('0x5')][_0xb1f4('0x7')](this),0x3e8);}else{if(this[_0xb1f4('0x4')][_0xb1f4('0x13')]||util[_0xb1f4('0x14')](this[_0xb1f4('0x8')]['id'],this['realtime'][_0xb1f4('0x10')][this[_0xb1f4('0x11')]['id']],this['squeue'][_0xb1f4('0x15')],![])){this[_0xb1f4('0x3')][_0xb1f4('0x10')][this[_0xb1f4('0x11')]['id']][_0xb1f4('0x16')]=!![];this[_0xb1f4('0x3')][_0xb1f4('0x10')][this[_0xb1f4('0x11')]['id']][_0xb1f4('0x17')]=undefined;util[_0xb1f4('0x18')](this[_0xb1f4('0x2')],this[_0xb1f4('0x8')]['id'],this[_0xb1f4('0x3')][_0xb1f4('0x10')][this['agent']['id']],null,this[_0xb1f4('0x4')]);util[_0xb1f4('0x19')](this[_0xb1f4('0x8')]['id'],this[_0xb1f4('0x3')][_0xb1f4('0x10')][this[_0xb1f4('0x11')]['id']],_0xb1f4('0x1a')+(this[_0xb1f4('0x4')][_0xb1f4('0x13')]?_0xb1f4('0x1b'):''));}else{logger[_0xb1f4('0xd')](_0xb1f4('0x1c'),this[_0xb1f4('0x8')]['id'],this['agent']['id']);setTimeout(this['push'][_0xb1f4('0x7')](this),0x3e8);}}};Agent[_0xb1f4('0xc')][_0xb1f4('0xb')]=function(_0x383ac1){if(_[_0xb1f4('0xf')](this[_0xb1f4('0x3')][_0xb1f4('0x10')][this[_0xb1f4('0x11')]['id']])){return logger[_0xb1f4('0xd')](_0xb1f4('0x12'),this[_0xb1f4('0x8')]['id'],this[_0xb1f4('0x11')]['id']);}else{logger[_0xb1f4('0xd')](_0xb1f4('0x1d'),this[_0xb1f4('0x8')]['id'],this[_0xb1f4('0x11')]['id']);util['hideNotification'](this[_0xb1f4('0x2')],this[_0xb1f4('0x8')]['id'],this['realtime'][_0xb1f4('0x10')][this[_0xb1f4('0x11')]['id']],null,this['routing']);this[_0xb1f4('0x3')][_0xb1f4('0x10')][this['agent']['id']][_0xb1f4('0x16')]=![];this['realtime']['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0xb1f4('0x19')](this['squeue']['id'],this[_0xb1f4('0x3')][_0xb1f4('0x10')][this[_0xb1f4('0x11')]['id']],_0x383ac1?_0xb1f4('0x1e'):_0xb1f4('0x1f'));}if(!_0x383ac1){setTimeout(this[_0xb1f4('0x5')][_0xb1f4('0x7')](this),0x3e8);}};function agent(_0x19a030,_0x42f610,_0x119660,_0x2bcddc){return new Agent(_0x19a030,_0x42f610,_0x119660,_0x2bcddc);}module[_0xb1f4('0x20')]=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 62dfca4..a22a57f 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 _0xc946=['queue','realtime','push','handleTimeout','bind','timeout','drained','prototype','handleRun','handleDrained','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','exports','lodash','uuid','../../../../../config/logger','routing','squeue'];(function(_0x35a779,_0x27f8fb){var _0xca723b=function(_0x298df7){while(--_0x298df7){_0x35a779['push'](_0x35a779['shift']());}};_0xca723b(++_0x27f8fb);}(_0xc946,0x193));var _0x6c94=function(_0x452c12,_0x10cc09){_0x452c12=_0x452c12-0x0;var _0x10be71=_0xc946[_0x452c12];return _0x10be71;};'use strict';var _=require(_0x6c94('0x0'));var uuid=require(_0x6c94('0x1'));var util=require('./util');var logger=require(_0x6c94('0x2'))(_0x6c94('0x3'));var Beepall=function(_0x3582ac,_0x2ea238,_0x1eb3ff,_0x16ecb1){this['notificationId']=uuid['v4']();this[_0x6c94('0x4')]=_0x3582ac;this[_0x6c94('0x5')]=_0x2ea238;this[_0x6c94('0x6')]=_0x1eb3ff;this['routing']=_0x16ecb1;this[_0x6c94('0x4')][_0x6c94('0x7')](this['handleRun']['bind'](this),this[_0x6c94('0x8')][_0x6c94('0x9')](this));this[_0x6c94('0x4')]['on'](_0x6c94('0xa'),this['handleTimeout'][_0x6c94('0x9')](this));this[_0x6c94('0x4')]['on'](_0x6c94('0xb'),this['handleDrained'][_0x6c94('0x9')](this));};Beepall[_0x6c94('0xc')][_0x6c94('0x7')]=function(){this[_0x6c94('0x4')]['push'](this[_0x6c94('0xd')][_0x6c94('0x9')](this),this[_0x6c94('0x8')][_0x6c94('0x9')](this));};Beepall[_0x6c94('0xc')][_0x6c94('0xe')]=function(_0x4e76ed){this[_0x6c94('0x8')](!![]);};Beepall[_0x6c94('0xc')][_0x6c94('0xd')]=function(_0x2140be){var _0x76b786=!![];if(!_['isNil'](this['queue'])&&!_[_0x6c94('0xf')](this[_0x6c94('0x5')][_0x6c94('0x10')])&&this[_0x6c94('0x5')][_0x6c94('0x10')][_0x6c94('0x11')]>0x0){for(var _0xbe8d70=0x0,_0x5f5b07;_0xbe8d700x0){for(var _0x455080=0x0,_0x25c1a9;_0x4550800x0&&_0x35d727[_0x276765+_0x4e02('0x21')]>=_0x35d727[_0x276765+_0x4e02('0x20')]){writeLog(_0x1638be,_0x35d727,_0x276765[_0x4e02('0x22')]()+_0x4e02('0x23'));return![];}}return!![];};exports[_0x4e02('0x24')]=function(_0x138992,_0x2bfb54,_0x2706bd,_0x12df84,_0x15161f){return sendNotification(!![],_0x138992,_0x2bfb54,_0x2706bd,_0x12df84,_0x15161f);};exports[_0x4e02('0x25')]=function(_0x49fcd2,_0x366b91,_0x267a63,_0x4fb3df,_0x32ddd0){return sendNotification(![],_0x49fcd2,_0x366b91,_0x267a63,_0x4fb3df,_0x32ddd0);};exports[_0x4e02('0x26')]=writeLog; \ No newline at end of file +var _0x9953=['body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','emit','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','util','../utils','mustache','../../../../../config/environment','routing','defaults','redis','format','user:%s','name','split','\x20interaction','notificationSound','account','notificationShake'];(function(_0x54f266,_0x337eb8){var _0x2b242b=function(_0x42b6b6){while(--_0x42b6b6){_0x54f266['push'](_0x54f266['shift']());}};_0x2b242b(++_0x337eb8);}(_0x9953,0x1ca));var _0x3995=function(_0x4d593e,_0x131776){_0x4d593e=_0x4d593e-0x0;var _0x31e2df=_0x9953[_0x4d593e];return _0x31e2df;};'use strict';var _=require('lodash');var util=require(_0x3995('0x0'));var utils=require(_0x3995('0x1'));var Mustache=require(_0x3995('0x2'));var Redis=require('ioredis');var config=require(_0x3995('0x3'));var logger=require('../../../../../config/logger')(_0x3995('0x4'));config['redis']=_[_0x3995('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3995('0x6')]));function emit(_0x3cb541,_0x3029dc,_0x45574c){io['to'](_0x3cb541)['emit'](_0x3029dc,_0x45574c);}function sendNotification(_0x475c42,_0x5c6271,_0x3fe717,_0x5dee3b,_0x5ac6ca,_0x564bef){io['to'](util[_0x3995('0x7')](_0x3995('0x8'),_0x5dee3b[_0x3995('0x9')]))['emit']('user:save',_0x5dee3b);var _0x4dc34f=_0x564bef||{};var _0x220415=_0x3fe717[_0x3995('0xa')]('.');var _0x86a27b={'uniqueid':_0x5c6271,'channel':_0x220415[0x0],'id':_0x220415[0x1],'title':_0x220415[0x0]+_0x3995('0xb'),'interactionId':_0x220415[0x2],'queue':_0x5ac6ca?_0x5ac6ca[_0x3995('0x9')]:null,'sound':_0x4dc34f['account'][_0x3995('0xc')],'shake':_0x4dc34f[_0x3995('0xd')][_0x3995('0xe')]};try{if(!_0x4dc34f[_0x3995('0xf')]){_0x4dc34f[_0x3995('0xf')]={};}if(_0x5ac6ca){_0x4dc34f[_0x3995('0xf')][_0x3995('0x10')]=_0x5ac6ca;}else if(_0x4dc34f[_0x3995('0xf')]['queue']){delete _0x4dc34f[_0x3995('0xf')]['queue'];}_0x86a27b['msg']=utils[_0x3995('0x11')](_0x4dc34f['account'][_0x3995('0x12')],_0x4dc34f);}catch(_0x55b0ef){_0x86a27b[_0x3995('0x13')]=_0x3995('0x14');logger[_0x3995('0x15')](util[_0x3995('0x7')]('[%s][QUEUE]\x20%s',_0x5c6271,_0x55b0ef['message']));}io['to'](util[_0x3995('0x7')]('user:%s',_0x5dee3b[_0x3995('0x9')]))[_0x3995('0x16')](util[_0x3995('0x7')](_0x3995('0x17'),_0x475c42?_0x3995('0x18'):_0x3995('0x19')),_0x86a27b);}function writeLog(_0xb90465,_0x497966,_0x13d1f7){return logger[_0x3995('0x1a')](util[_0x3995('0x7')](_0x3995('0x1b'),_0xb90465,_0x497966['name'],_0x13d1f7));}exports[_0x3995('0x1c')]=function(_0x1d38a6,_0x36ea6f,_0x197c93,_0xde37fe){if(_0x36ea6f[_0x3995('0x1d')]){writeLog(_0x1d38a6,_0x36ea6f,_0x3995('0x1e'));return![];}if(!_0x36ea6f[_0x3995('0x1f')]){writeLog(_0x1d38a6,_0x36ea6f,_0x3995('0x20'));return![];}if(_0x36ea6f[_0x197c93+_0x3995('0x21')]){writeLog(_0x1d38a6,_0x36ea6f,_0x3995('0x22'));return![];}if(_0xde37fe&&_0x36ea6f['hasOwnProperty'](_0x197c93+_0x3995('0x23'))&&_0x36ea6f[_0x3995('0x24')](_0x197c93+_0x3995('0x25'))){if(_0x36ea6f[_0x197c93+_0x3995('0x23')]>0x0&&_0x36ea6f[_0x197c93+'CurrentCapacity']>=_0x36ea6f[_0x197c93+_0x3995('0x23')]){writeLog(_0x1d38a6,_0x36ea6f,_0x197c93[_0x3995('0x26')]()+_0x3995('0x27'));return![];}}return!![];};exports[_0x3995('0x28')]=function(_0xbf90f0,_0x1bbfd7,_0x2a6461,_0x2f6e82,_0x210731){return sendNotification(!![],_0xbf90f0,_0x1bbfd7,_0x2a6461,_0x2f6e82,_0x210731);};exports[_0x3995('0x29')]=function(_0x436825,_0x5270ed,_0x578054,_0x2eb1fa,_0x1439a8){return sendNotification(![],_0x436825,_0x5270ed,_0x578054,_0x2eb1fa,_0x1439a8);};exports[_0x3995('0x2a')]=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 e483110..9fef975 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 _0x16b4=['consequence','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x1c0114,_0x903be0){var _0x13c28b=function(_0x31ca09){while(--_0x31ca09){_0x1c0114['push'](_0x1c0114['shift']());}};_0x13c28b(++_0x903be0);}(_0x16b4,0x18a));var _0x416b=function(_0x1427b6,_0x271efc){_0x1427b6=_0x1427b6-0x0;var _0x20dea9=_0x16b4[_0x1427b6];return _0x20dea9;};'use strict';var schema=require(_0x416b('0x0'));var sh=require(_0x416b('0x1'));var _=require(_0x416b('0x2'));var utils=require(_0x416b('0x3'));var logger=require('../../../../config/logger')(_0x416b('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x416b('0x5')}});exports[_0x416b('0x6')]=function(_0x31cae4,_0x561510){return function(_0x538bcf){try{var _0x5ddedc={'command':_0x561510[0x0]};var _0x46d27c=system[_0x416b('0x0')](_0x5ddedc,{'typecast':!![]});if(_0x46d27c['length']){logger[_0x416b('0x7')](_0x416b('0x8'),_0x31cae4,_['map'](_0x46d27c,_0x416b('0x9'))[_0x416b('0xa')](',\x20'));logger[_0x416b('0xb')](_0x416b('0xc'),_0x31cae4);_0x538bcf[_0x416b('0xd')]();}else{var _0x510648=this;var _0x1ad47c=utils[_0x416b('0xe')](_0x561510[0x0],this);logger[_0x416b('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x31cae4,_0x1ad47c);sh[_0x416b('0xf')](_[_0x416b('0x10')](_0x1ad47c),function(_0x128229,_0x211183){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x31cae4,_0x128229);if(_0x128229==0x0){var _0x2d7dd8=_0x211183[_0x416b('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x416b('0x12')](_0x561510[0x1])||_[_0x416b('0x13')](_0x561510[0x1])){logger['info'](_0x416b('0x14'),_0x31cae4);_0x510648[_0x416b('0x15')][_0x561510[0x1]]=_0x2d7dd8;}else{logger[_0x416b('0xb')](_0x416b('0x16'),_0x31cae4,_0x561510[0x1],_0x2d7dd8);_0x510648[_0x416b('0x15')][_0x561510[0x1]]=_0x2d7dd8;}}_0x538bcf[_0x416b('0xd')]();});}}catch(_0x12453){logger[_0x416b('0x7')]('[%s][SYSTEM]\x20%s',_0x31cae4,_[_0x416b('0x17')](_0x12453)?JSON[_0x416b('0x18')](_0x12453):_0x12453);logger[_0x416b('0xb')](_0x416b('0xc'),_0x31cae4);_0x538bcf[_0x416b('0xd')]();}};}; \ No newline at end of file +var _0xfb68=['stringify','validate','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject'];(function(_0x2949f4,_0x130f2e){var _0x322b7f=function(_0x1664a0){while(--_0x1664a0){_0x2949f4['push'](_0x2949f4['shift']());}};_0x322b7f(++_0x130f2e);}(_0xfb68,0x1e1));var _0x8fb6=function(_0x1eade0,_0x332df3){_0x1eade0=_0x1eade0-0x0;var _0x4121d6=_0xfb68[_0x1eade0];return _0x4121d6;};'use strict';var schema=require(_0x8fb6('0x0'));var sh=require('shelljs');var _=require(_0x8fb6('0x1'));var utils=require('./utils');var logger=require(_0x8fb6('0x2'))(_0x8fb6('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x8fb6('0x4')}});exports[_0x8fb6('0x5')]=function(_0xba32c2,_0x33b1b2){return function(_0x3988c5){try{var _0x355cdf={'command':_0x33b1b2[0x0]};var _0x4ba462=system[_0x8fb6('0x0')](_0x355cdf,{'typecast':!![]});if(_0x4ba462[_0x8fb6('0x6')]){logger[_0x8fb6('0x7')]('[%s][SYSTEM]\x20%s',_0xba32c2,_[_0x8fb6('0x8')](_0x4ba462,'message')[_0x8fb6('0x9')](',\x20'));logger[_0x8fb6('0xa')](_0x8fb6('0xb'),_0xba32c2);_0x3988c5[_0x8fb6('0xc')]();}else{var _0x22ca17=this;var _0x2c977b=utils['getMustacheRender'](_0x33b1b2[0x0],this);logger[_0x8fb6('0xa')]('[%s][SYSTEM]\x20commnad:\x20%s',_0xba32c2,_0x2c977b);sh[_0x8fb6('0xd')](_[_0x8fb6('0xe')](_0x2c977b),function(_0x2bfd2e,_0x4f9f06){logger[_0x8fb6('0xa')](_0x8fb6('0xf'),_0xba32c2,_0x2bfd2e);if(_0x2bfd2e==0x0){var _0x17b7ca=_0x4f9f06[_0x8fb6('0x10')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x33b1b2[0x1])||_[_0x8fb6('0x11')](_0x33b1b2[0x1])){logger['info'](_0x8fb6('0x12'),_0xba32c2);_0x22ca17[_0x8fb6('0x13')][_0x33b1b2[0x1]]=_0x17b7ca;}else{logger[_0x8fb6('0xa')](_0x8fb6('0x14'),_0xba32c2,_0x33b1b2[0x1],_0x17b7ca);_0x22ca17[_0x8fb6('0x13')][_0x33b1b2[0x1]]=_0x17b7ca;}}_0x3988c5[_0x8fb6('0xc')]();});}}catch(_0xc121c9){logger['error'](_0x8fb6('0x15'),_0xba32c2,_[_0x8fb6('0x16')](_0xc121c9)?JSON[_0x8fb6('0x17')](_0xc121c9):_0xc121c9);logger[_0x8fb6('0xa')](_0x8fb6('0xb'),_0xba32c2);_0x3988c5[_0x8fb6('0xc')]();}};}; \ 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 3428c6f..2c98365 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0xd6de92,_0x35f97f){var _0x3423cc=function(_0x9d63ec){while(--_0x9d63ec){_0xd6de92['push'](_0xd6de92['shift']());}};_0x3423cc(++_0x35f97f);}(_0x7a54,0x106));var _0x47a5=function(_0x26522d,_0x17d2b0){_0x26522d=_0x26522d-0x0;var _0x1f5624=_0x7a54[_0x26522d];return _0x1f5624;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file +var _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x267b78,_0x5966ad){var _0x145f94=function(_0x450e33){while(--_0x450e33){_0x267b78['push'](_0x267b78['shift']());}};_0x145f94(++_0x5966ad);}(_0x7a54,0x106));var _0x47a5=function(_0x4be8e1,_0x551a98){_0x4be8e1=_0x4be8e1-0x0;var _0x2fafe6=_0x7a54[_0x4be8e1];return _0x2fafe6;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 4038d10..ed0fe84 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 _0x1061=['body','contact','message','account','interaction','mustache','render','merge'];(function(_0x21c48,_0x49ac0a){var _0x1f2cea=function(_0x51a5eb){while(--_0x51a5eb){_0x21c48['push'](_0x21c48['shift']());}};_0x1f2cea(++_0x49ac0a);}(_0x1061,0x1b5));var _0x1106=function(_0x272fac,_0x3b7c65){_0x272fac=_0x272fac-0x0;var _0x35b001=_0x1061[_0x272fac];return _0x35b001;};'use strict';var Mustache=require(_0x1106('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x592486,_0x986553){return Mustache[_0x1106('0x1')](_0x592486,_[_0x1106('0x2')](_0x986553[_0x1106('0x3')],{'contact':_0x986553[_0x1106('0x4')],'message':_0x986553[_0x1106('0x5')],'account':_0x986553[_0x1106('0x6')],'interaction':_0x986553[_0x1106('0x7')],'list':_0x986553['list']}))||'';}}; \ No newline at end of file +var _0xa75b=['render','merge','body','contact','message','account','interaction','list','mustache'];(function(_0xbb9f33,_0x5c2052){var _0x53b937=function(_0x3bb891){while(--_0x3bb891){_0xbb9f33['push'](_0xbb9f33['shift']());}};_0x53b937(++_0x5c2052);}(_0xa75b,0x170));var _0xba75=function(_0x5a6f82,_0x1cbf86){_0x5a6f82=_0x5a6f82-0x0;var _0x2b8caf=_0xa75b[_0x5a6f82];return _0x2b8caf;};'use strict';var Mustache=require(_0xba75('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x10c0dd,_0x39dc19){return Mustache[_0xba75('0x1')](_0x10c0dd,_[_0xba75('0x2')](_0x39dc19[_0xba75('0x3')],{'contact':_0x39dc19[_0xba75('0x4')],'message':_0x39dc19[_0xba75('0x5')],'account':_0x39dc19[_0xba75('0x6')],'interaction':_0x39dc19[_0xba75('0x7')],'list':_0x39dc19[_0xba75('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2a71579..6ce487e 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 _0x7795=['message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','stringify','listen','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/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','rules','message','interaction','applications','isArray','length','existsSync','.js','app','appdata','split','push','join','dialogflow','slice','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','channel','end','QueueReport','update','catch','stack'];(function(_0x1485d2,_0x2fc97b){var _0x3da8bb=function(_0xdb4674){while(--_0xdb4674){_0x1485d2['push'](_0x1485d2['shift']());}};_0x3da8bb(++_0x2fc97b);}(_0x7795,0x1d6));var _0x5779=function(_0x5843d0,_0x6e4e76){_0x5843d0=_0x5843d0-0x0;var _0x3632b7=_0x7795[_0x5843d0];return _0x3632b7;};'use strict';var _=require('lodash');var util=require(_0x5779('0x0'));var path=require(_0x5779('0x1'));var fs=require('fs');var jayson=require(_0x5779('0x2'));var BPromise=require(_0x5779('0x3'));var uuid=require(_0x5779('0x4'));var config=require(_0x5779('0x5'));var logger=require(_0x5779('0x6'))(_0x5779('0x7'));var rpc={'openchannelQueueReport':require(_0x5779('0x8'))};var rpc={'openchannelQueueReport':require(_0x5779('0x8')),'mailQueueReport':require(_0x5779('0x9')),'chatQueueReport':require(_0x5779('0xa')),'smsQueueReport':require(_0x5779('0xb')),'faxQueueReport':require('../rpc/faxQueueReport')};var RuleEngine=require(_0x5779('0xc'));function getId(_0x33b365,_0x5df680,_0x4cdc09){return util[_0x5779('0xd')](_0x5779('0xe'),_0x33b365,_0x5df680||0x0,_0x4cdc09||0x0);}function getIntervals(_0x15f5c5,_0x46f8e3){var _0x14f672=[];if(!_[_0x5779('0xf')](_0x46f8e3[_0x5779('0x10')])&&!_[_0x5779('0xf')](_0x15f5c5[_0x46f8e3['IntervalId']])&&!_[_0x5779('0xf')](_0x15f5c5[_0x46f8e3[_0x5779('0x10')]]['Intervals'])){_0x14f672=_['map'](_0x15f5c5[_0x46f8e3[_0x5779('0x10')]][_0x5779('0x11')],_0x5779('0x12'));}else if(!_['isNil'](_0x46f8e3['interval'])){_0x14f672=[_0x46f8e3['interval']];}return _0x14f672;}exports['listen']=function(_0x19c5e2){_0x19c5e2[_0x5779('0x13')]={};return new BPromise(function(_0x434c22,_0x427e4a){var _0x37c3c7={'Start':function(_0x46b981){var _0x4f612d=this;return new Promise(function(_0x2b1eb9,_0x2771e8){if(_0x46b981){try{var _0x20d25c=[];var _0x3be4ab=getId(_0x46b981['channel'],_0x46b981[_0x5779('0x14')]?_0x46b981[_0x5779('0x14')]['id']:0x0,_0x46b981['interaction']?_0x46b981[_0x5779('0x15')]['id']:0x0);if(_0x46b981[_0x5779('0x16')]&&_[_0x5779('0x17')](_0x46b981['applications'])&&_0x46b981['applications']['length']){for(var _0x3668c4=0x0;_0x3668c4<_0x46b981[_0x5779('0x16')][_0x5779('0x18')];_0x3668c4+=0x1){var _0x5c6806=_0x46b981[_0x5779('0x16')][_0x3668c4];if(fs[_0x5779('0x19')](path['join'](__dirname,'applications',_0x5c6806['app']+_0x5779('0x1a')))){var _0x3b362e=[];switch(_0x5c6806[_0x5779('0x1b')]['toLowerCase']()){case'autoreply':var _0x17f266=_0x5c6806[_0x5779('0x1c')][_0x5779('0x1d')](',');_0x3b362e[_0x5779('0x1e')](_0x17f266[0x0]);_0x3b362e['push'](_0x17f266['slice'](0x1,_0x17f266[_0x5779('0x18')])[_0x5779('0x1f')](','));break;case _0x5779('0x20'):var _0x17f266=_0x5c6806[_0x5779('0x1c')]['split'](',');_0x3b362e[_0x5779('0x1e')](_0x17f266[0x0]);_0x3b362e['push'](_0x17f266[0x1]);_0x3b362e[_0x5779('0x1e')](_0x17f266[_0x5779('0x21')](0x2,_0x17f266['length'])[_0x5779('0x1f')](','));break;case'amazonlex':var _0x17f266=_0x5c6806[_0x5779('0x1c')][_0x5779('0x1d')](',');_0x3b362e[_0x5779('0x1e')](_0x17f266[0x0]);_0x3b362e[_0x5779('0x1e')](_0x17f266[0x1]);_0x3b362e[_0x5779('0x1e')](_0x17f266[0x2]);_0x3b362e[_0x5779('0x1e')](_0x17f266[0x3]);_0x3b362e['push'](_0x17f266[_0x5779('0x21')](0x4,_0x17f266['length'])[_0x5779('0x1f')](','));break;case _0x5779('0x14'):_0x3b362e[_0x5779('0x1e')](_0x5c6806[_0x5779('0x1c')]);break;case _0x5779('0x22'):_0x3b362e['push'](_0x5c6806[_0x5779('0x23')]);_0x3b362e[_0x5779('0x1e')](_0x5c6806[_0x5779('0x1c')]);break;default:_0x3b362e=_[_0x5779('0xf')](_0x5c6806['appdata'])?[]:_0x5c6806[_0x5779('0x1c')][_0x5779('0x1d')](',');}var _0x400ed8={'id':util[_0x5779('0xd')](_0x5779('0x24'),_0x3be4ab,_0x5c6806['id'],_0x5c6806[_0x5779('0x1b')]),'condition':require(_0x5779('0x25'))[_0x5779('0x26')](_0x3be4ab,getIntervals(_0x19c5e2[_0x5779('0x27')],_0x5c6806),_0x19c5e2),'consequence':require(_0x5779('0x28')+_0x5c6806[_0x5779('0x1b')])[_0x5779('0x29')](_0x3be4ab,_0x3b362e,_0x19c5e2,_0x46b981),'p':_0x5c6806[_0x5779('0x2a')]||0x0};logger['info']('Push\x20new\x20rule',_0x400ed8['id'],_0x5779('0x2b'),getIntervals(_0x19c5e2[_0x5779('0x27')],_0x5c6806)[_0x5779('0x1f')](_0x5779('0x2c')));_0x20d25c[_0x5779('0x1e')](_0x400ed8);}else{logger[_0x5779('0x2d')](_0x5779('0x2e'),path[_0x5779('0x1f')](__dirname,_0x5779('0x16'),_0x5c6806['app']+_0x5779('0x1a')));}}_0x19c5e2[_0x5779('0x13')][_0x3be4ab]=new RuleEngine(_0x20d25c);_0x19c5e2[_0x5779('0x13')][_0x3be4ab]['execute'](_0x46b981,function(_0x11b81c){logger[_0x5779('0x2f')](_0x5779('0x30'),JSON['stringify'](_0x11b81c[_0x5779('0x31')]));if(_0x19c5e2[_0x5779('0x13')][_0x3be4ab]){_0x19c5e2[_0x5779('0x13')][_0x3be4ab][_0x5779('0x32')]('end');}});return _0x2b1eb9({'code':0xc8,'message':_0x46b981});}else{logger[_0x5779('0x2f')](_0x5779('0x33'));return _0x2b1eb9({'code':0xc8,'message':_0x46b981});}}catch(_0x317c0b){logger[_0x5779('0x2d')](_0x317c0b['stack']);return _0x2771e8(_0x4f612d[_0x5779('0x2d')](0x1f4,_0x317c0b));}}return _0x2771e8('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4e1ed4){var _0x110515=this;return new Promise(function(_0x4a6f86,_0xe5e08e){if(_0x4e1ed4['message']&&_0x4e1ed4[_0x5779('0x14')]['id']){try{var _0x5dcfd0=getId(_0x4e1ed4[_0x5779('0x34')],_0x4e1ed4['message']?_0x4e1ed4['message']['id']:0x0,_0x4e1ed4[_0x5779('0x15')]?_0x4e1ed4['interaction']['id']:0x0);if(_0x19c5e2['rules'][_0x5dcfd0]){_0x19c5e2[_0x5779('0x13')][_0x5dcfd0][_0x5779('0x32')](_0x5779('0x35'));if(rpc[_0x4e1ed4[_0x5779('0x34')]+_0x5779('0x36')]){rpc[_0x4e1ed4[_0x5779('0x34')]+_0x5779('0x36')][_0x5779('0x37')](_0x5dcfd0,{'UserId':_0x4e1ed4[_0x5779('0x14')]['UserId']})[_0x5779('0x38')](function(_0x74eeb){logger[_0x5779('0x2d')]('error\x20update\x20queue\x20report');});}}return _0x4a6f86({'code':0xc8,'message':_0x4e1ed4});}catch(_0x3ebdfa){logger[_0x5779('0x2d')](_0x3ebdfa[_0x5779('0x39')]);return _0xe5e08e(_0x110515[_0x5779('0x2d')](0x1f4,_0x3ebdfa));}}logger[_0x5779('0x2d')]('message\x20is\x20empty');return _0xe5e08e(_0x110515['error'](0x1f4,_0x5779('0x3a')));});},'RejectMessage':function(_0x37226f){var _0x407904=this;return new Promise(function(_0x5c99be,_0x41c932){if(_0x37226f['agent']&&_0x37226f[_0x5779('0x3b')]['id']){try{if(_0x19c5e2[_0x5779('0x3c')][_0x37226f[_0x5779('0x3b')]['id']]){_0x19c5e2[_0x5779('0x3c')][_0x37226f[_0x5779('0x3b')]['id']]['busy']=![];_0x19c5e2['agents'][_0x37226f[_0x5779('0x3b')]['id']][_0x5779('0x3d')]=undefined;}return _0x5c99be({'code':0xc8,'message':_0x37226f});}catch(_0x1a7ff1){logger[_0x5779('0x2d')](_0x1a7ff1[_0x5779('0x39')]);return _0x41c932(_0x407904[_0x5779('0x2d')](0x1f4,_0x1a7ff1));}}logger[_0x5779('0x2d')](_0x5779('0x3a'));return _0x41c932(_0x407904[_0x5779('0x2d')](0x1f4,_0x5779('0x3a')));});},'AbandonInteraction':function(_0x8e6f2b){var _0x28ca3c=this;return new Promise(function(_0x1f0f5a,_0x269ad6){if(_0x8e6f2b[_0x5779('0x34')]&&_0x8e6f2b['interaction']&&_0x8e6f2b['interaction']['id']){try{var _0x1de613=getId(_0x8e6f2b[_0x5779('0x34')],_0x8e6f2b['message']?_0x8e6f2b[_0x5779('0x14')]['id']:0x0,_0x8e6f2b[_0x5779('0x15')]?_0x8e6f2b[_0x5779('0x15')]['id']:0x0);if(_0x19c5e2[_0x5779('0x13')][_0x1de613]){_0x19c5e2[_0x5779('0x13')][_0x1de613]['emit'](_0x5779('0x35'));}return _0x1f0f5a({'code':0xc8,'message':_0x8e6f2b});}catch(_0x5799f2){logger[_0x5779('0x2d')](_0x5799f2[_0x5779('0x39')]);return _0x269ad6(_0x28ca3c['error'](0x1f4,_0x5799f2));}}logger['error'](_0x5779('0x3a'));return _0x269ad6(_0x28ca3c[_0x5779('0x2d')](0x1f4,_0x5779('0x3a')));});},'AgentCapacity':function(_0x5efad2){var _0x4e526b=this;return new Promise(function(_0x2d49ce,_0x2dbd3b){if(_0x19c5e2['agents'][_0x5779('0x3e')](_0x5efad2['id'])){for(var _0x2db3ae in _0x5efad2[_0x5779('0x3f')]){if(_0x5efad2[_0x5779('0x3f')][_0x5779('0x3e')](_0x2db3ae)){if(_0x19c5e2[_0x5779('0x3c')][_0x5efad2['id']][_0x5779('0x3e')](_0x2db3ae+_0x5779('0x40'))){_0x19c5e2['agents'][_0x5efad2['id']][_0x2db3ae+_0x5779('0x40')]=parseInt(_0x5efad2[_0x5779('0x3f')][_0x2db3ae],0xa);}}}_0x19c5e2[_0x5779('0x3c')][_0x5efad2['id']][_0x5779('0x41')]();return _0x2d49ce({'code':0xc8,'message':_0x19c5e2[_0x5779('0x3c')][_0x5efad2['id']]});}else{return _0x2dbd3b(_0x4e526b['error'](0x1f4,_0x5779('0x42')));}});},'Agents':function(_0x55e430){return new Promise(function(_0x43627c,_0x237e93){var _0x2d69a0=_[_0x5779('0x43')](_0x19c5e2['agents']);_0x43627c({'count':_0x2d69a0[_0x5779('0x18')],'rows':_0x2d69a0});});},'ChatQueues':function(_0x410b99){return new Promise(function(_0x5bbfe3,_0x406eef){var _0x30eff5=[];for(var _0x103281 in _0x19c5e2[_0x5779('0x44')]){if(_0x19c5e2[_0x5779('0x44')][_0x5779('0x3e')](_0x103281)){var _0x5d5a6e=_0x19c5e2['chatQueues'][_0x103281];var _0x5a3da9={'id':_0x5d5a6e['id'],'available':_0x5d5a6e['available'],'loggedIn':_0x5d5a6e[_0x5779('0x45')],'name':_0x5d5a6e[_0x5779('0x46')],'paused':_0x5d5a6e[_0x5779('0x47')],'waiting':_0x5d5a6e[_0x5779('0x48')]};_0x30eff5[_0x5779('0x1e')](_0x5a3da9);}}_0x5bbfe3({'count':_0x30eff5[_0x5779('0x18')],'rows':_0x30eff5});});},'MailQueues':function(_0x4c3661){return new Promise(function(_0x4d2def,_0x9fc7d8){var _0xcaed8=[];for(var _0x36686a in _0x19c5e2[_0x5779('0x49')]){if(_0x19c5e2[_0x5779('0x49')][_0x5779('0x3e')](_0x36686a)){var _0x52f849=_0x19c5e2[_0x5779('0x49')][_0x36686a];var _0x15eff5={'id':_0x52f849['id'],'available':_0x52f849[_0x5779('0x4a')],'loggedIn':_0x52f849[_0x5779('0x45')],'name':_0x52f849[_0x5779('0x46')],'paused':_0x52f849[_0x5779('0x47')],'waiting':_0x52f849[_0x5779('0x48')]};_0xcaed8[_0x5779('0x1e')](_0x15eff5);}}_0x4d2def({'count':_0xcaed8[_0x5779('0x18')],'rows':_0xcaed8});});},'OpenchannelQueues':function(_0x3db815){return new Promise(function(_0x4a422f,_0x5c7590){var _0x4336e8=[];for(var _0xa2ed5c in _0x19c5e2[_0x5779('0x4b')]){if(_0x19c5e2[_0x5779('0x4b')][_0x5779('0x3e')](_0xa2ed5c)){var _0x2ffdc4=_0x19c5e2['openchannelQueues'][_0xa2ed5c];var _0xc71cc7={'id':_0x2ffdc4['id'],'available':_0x2ffdc4[_0x5779('0x4a')],'loggedIn':_0x2ffdc4[_0x5779('0x45')],'name':_0x2ffdc4[_0x5779('0x46')],'paused':_0x2ffdc4['paused'],'waiting':_0x2ffdc4[_0x5779('0x48')]};_0x4336e8['push'](_0xc71cc7);}}_0x4a422f({'count':_0x4336e8[_0x5779('0x18')],'rows':_0x4336e8});});},'SmsQueues':function(_0xc9a1c1){return new Promise(function(_0x25563b,_0x4abbea){var _0x49ce70=[];for(var _0x185ed5 in _0x19c5e2[_0x5779('0x4c')]){if(_0x19c5e2[_0x5779('0x4c')]['hasOwnProperty'](_0x185ed5)){var _0x2d4028=_0x19c5e2['smsQueues'][_0x185ed5];var _0xf33831={'id':_0x2d4028['id'],'available':_0x2d4028[_0x5779('0x4a')],'loggedIn':_0x2d4028[_0x5779('0x45')],'name':_0x2d4028[_0x5779('0x46')],'paused':_0x2d4028[_0x5779('0x47')],'waiting':_0x2d4028[_0x5779('0x48')]};_0x49ce70['push'](_0xf33831);}}_0x25563b({'count':_0x49ce70['length'],'rows':_0x49ce70});});},'FaxQueues':function(_0x56e55d){return new Promise(function(_0x264d78,_0x3b66f0){var _0x12dd62=[];for(var _0x1c01ab in _0x19c5e2[_0x5779('0x4d')]){if(_0x19c5e2[_0x5779('0x4d')]['hasOwnProperty'](_0x1c01ab)){var _0x22d248=_0x19c5e2['faxQueues'][_0x1c01ab];var _0x3703d9={'id':_0x22d248['id'],'available':_0x22d248[_0x5779('0x4a')],'loggedIn':_0x22d248['loggedIn'],'name':_0x22d248[_0x5779('0x46')],'paused':_0x22d248[_0x5779('0x47')],'waiting':_0x22d248[_0x5779('0x48')]};_0x12dd62['push'](_0x3703d9);}}_0x264d78({'count':_0x12dd62[_0x5779('0x18')],'rows':_0x12dd62});});},'ChatQueuesWaitingInteractions':function(_0x7b860a){return new Promise(function(_0x11502e,_0x3a3d6a){var _0x343554=_['values'](_0x19c5e2['chatQueuesWaitingInteractions']);_0x11502e({'count':_0x343554[_0x5779('0x18')],'rows':_0x343554});});},'MailQueuesWaitingInteractions':function(_0x26ef35){return new Promise(function(_0x5b2273,_0x451fea){var _0x24ade7=_[_0x5779('0x43')](_0x19c5e2[_0x5779('0x4e')]);_0x5b2273({'count':_0x24ade7['length'],'rows':_0x24ade7});});},'OpenchannelQueuesWaitingInteractions':function(_0x2daac9){return new Promise(function(_0x291273,_0x50c957){var _0x30141c=_[_0x5779('0x43')](_0x19c5e2[_0x5779('0x4f')]);_0x291273({'count':_0x30141c['length'],'rows':_0x30141c});});},'SmsQueuesWaitingInteractions':function(_0x3e563e){return new Promise(function(_0x88f9a5,_0x1be633){var _0x54d2a1=_[_0x5779('0x43')](_0x19c5e2[_0x5779('0x50')]);_0x88f9a5({'count':_0x54d2a1[_0x5779('0x18')],'rows':_0x54d2a1});});},'FaxQueuesWaitingInteractions':function(_0x265638){return new Promise(function(_0x5ea766,_0x1f01c7){var _0x381245=_[_0x5779('0x43')](_0x19c5e2['faxQueuesWaitingInteractions']);_0x5ea766({'count':_0x381245['length'],'rows':_0x381245});});}};var _0x325533=jayson[_0x5779('0x51')](_0x37c3c7)[_0x5779('0x52')]();_0x325533['on'](_0x5779('0x2d'),function(_0x5dd864){logger[_0x5779('0x2d')](JSON[_0x5779('0x53')](_0x5dd864));return _0x427e4a(_0x5dd864);});_0x325533[_0x5779('0x54')](0x232c,'127.0.0.1',function(){console[_0x5779('0x55')](_0x5779('0x56'),0x232c);return _0x434c22(_0x5779('0x57')+0x232c);});});}; \ No newline at end of file +var _0x6d6d=['execute','stringify','matchPath','emit','end','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','mailQueues','openchannelQueues','waiting','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','channel','message','interaction','applications','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','push','slice','amazonlex','split','tag','TagId','%s:%s:%s','condition','intervals','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules'];(function(_0x4eb5f8,_0x578fe0){var _0x3e23d8=function(_0x469c77){while(--_0x469c77){_0x4eb5f8['push'](_0x4eb5f8['shift']());}};_0x3e23d8(++_0x578fe0);}(_0x6d6d,0x132));var _0xd6d6=function(_0x2fb192,_0x3e291e){_0x2fb192=_0x2fb192-0x0;var _0x248b70=_0x6d6d[_0x2fb192];return _0x248b70;};'use strict';var _=require('lodash');var util=require(_0xd6d6('0x0'));var path=require(_0xd6d6('0x1'));var fs=require('fs');var jayson=require(_0xd6d6('0x2'));var BPromise=require(_0xd6d6('0x3'));var uuid=require(_0xd6d6('0x4'));var config=require(_0xd6d6('0x5'));var logger=require('../../../config/logger')(_0xd6d6('0x6'));var rpc={'openchannelQueueReport':require(_0xd6d6('0x7'))};var rpc={'openchannelQueueReport':require(_0xd6d6('0x7')),'mailQueueReport':require(_0xd6d6('0x8')),'chatQueueReport':require(_0xd6d6('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xd6d6('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x7c798f,_0xb851c7,_0x3870cc){return util[_0xd6d6('0xb')](_0xd6d6('0xc'),_0x7c798f,_0xb851c7||0x0,_0x3870cc||0x0);}function getIntervals(_0x53d983,_0x328823){var _0x302131=[];if(!_[_0xd6d6('0xd')](_0x328823[_0xd6d6('0xe')])&&!_[_0xd6d6('0xd')](_0x53d983[_0x328823[_0xd6d6('0xe')]])&&!_[_0xd6d6('0xd')](_0x53d983[_0x328823[_0xd6d6('0xe')]]['Intervals'])){_0x302131=_[_0xd6d6('0xf')](_0x53d983[_0x328823[_0xd6d6('0xe')]][_0xd6d6('0x10')],'interval');}else if(!_[_0xd6d6('0xd')](_0x328823[_0xd6d6('0x11')])){_0x302131=[_0x328823[_0xd6d6('0x11')]];}return _0x302131;}exports['listen']=function(_0xd472e7){_0xd472e7['rules']={};return new BPromise(function(_0x510c66,_0x5e2416){var _0x856719={'Start':function(_0x4ee48f){var _0x53e20c=this;return new Promise(function(_0x9a41f3,_0x4e4149){if(_0x4ee48f){try{var _0x108e31=[];var _0x27100b=getId(_0x4ee48f[_0xd6d6('0x12')],_0x4ee48f[_0xd6d6('0x13')]?_0x4ee48f['message']['id']:0x0,_0x4ee48f[_0xd6d6('0x14')]?_0x4ee48f[_0xd6d6('0x14')]['id']:0x0);if(_0x4ee48f['applications']&&_['isArray'](_0x4ee48f['applications'])&&_0x4ee48f[_0xd6d6('0x15')]['length']){for(var _0x53bb2a=0x0;_0x53bb2a<_0x4ee48f[_0xd6d6('0x15')][_0xd6d6('0x16')];_0x53bb2a+=0x1){var _0x50000b=_0x4ee48f['applications'][_0x53bb2a];if(fs[_0xd6d6('0x17')](path[_0xd6d6('0x18')](__dirname,'applications',_0x50000b['app']+_0xd6d6('0x19')))){var _0x2b7f04=[];switch(_0x50000b[_0xd6d6('0x1a')][_0xd6d6('0x1b')]()){case _0xd6d6('0x1c'):var _0x505e86=_0x50000b[_0xd6d6('0x1d')]['split'](',');_0x2b7f04[_0xd6d6('0x1e')](_0x505e86[0x0]);_0x2b7f04[_0xd6d6('0x1e')](_0x505e86[_0xd6d6('0x1f')](0x1,_0x505e86[_0xd6d6('0x16')])[_0xd6d6('0x18')](','));break;case'dialogflow':var _0x505e86=_0x50000b[_0xd6d6('0x1d')]['split'](',');_0x2b7f04[_0xd6d6('0x1e')](_0x505e86[0x0]);_0x2b7f04[_0xd6d6('0x1e')](_0x505e86[0x1]);_0x2b7f04[_0xd6d6('0x1e')](_0x505e86['slice'](0x2,_0x505e86['length'])[_0xd6d6('0x18')](','));break;case _0xd6d6('0x20'):var _0x505e86=_0x50000b[_0xd6d6('0x1d')][_0xd6d6('0x21')](',');_0x2b7f04[_0xd6d6('0x1e')](_0x505e86[0x0]);_0x2b7f04[_0xd6d6('0x1e')](_0x505e86[0x1]);_0x2b7f04[_0xd6d6('0x1e')](_0x505e86[0x2]);_0x2b7f04[_0xd6d6('0x1e')](_0x505e86[0x3]);_0x2b7f04[_0xd6d6('0x1e')](_0x505e86[_0xd6d6('0x1f')](0x4,_0x505e86[_0xd6d6('0x16')])[_0xd6d6('0x18')](','));break;case'message':_0x2b7f04[_0xd6d6('0x1e')](_0x50000b[_0xd6d6('0x1d')]);break;case _0xd6d6('0x22'):_0x2b7f04['push'](_0x50000b[_0xd6d6('0x23')]);_0x2b7f04[_0xd6d6('0x1e')](_0x50000b[_0xd6d6('0x1d')]);break;default:_0x2b7f04=_['isNil'](_0x50000b['appdata'])?[]:_0x50000b[_0xd6d6('0x1d')]['split'](',');}var _0x3aa829={'id':util[_0xd6d6('0xb')](_0xd6d6('0x24'),_0x27100b,_0x50000b['id'],_0x50000b['app']),'condition':require('./interval')[_0xd6d6('0x25')](_0x27100b,getIntervals(_0xd472e7[_0xd6d6('0x26')],_0x50000b),_0xd472e7),'consequence':require('./applications/'+_0x50000b[_0xd6d6('0x1a')])['consequence'](_0x27100b,_0x2b7f04,_0xd472e7,_0x4ee48f),'p':_0x50000b[_0xd6d6('0x27')]||0x0};logger[_0xd6d6('0x28')](_0xd6d6('0x29'),_0x3aa829['id'],'on\x20interval',getIntervals(_0xd472e7[_0xd6d6('0x26')],_0x50000b)[_0xd6d6('0x18')](_0xd6d6('0x2a')));_0x108e31[_0xd6d6('0x1e')](_0x3aa829);}else{logger[_0xd6d6('0x2b')](_0xd6d6('0x2c'),path[_0xd6d6('0x18')](__dirname,'applications',_0x50000b['app']+'.js'));}}_0xd472e7[_0xd6d6('0x2d')][_0x27100b]=new RuleEngine(_0x108e31);_0xd472e7['rules'][_0x27100b][_0xd6d6('0x2e')](_0x4ee48f,function(_0x7579d){logger[_0xd6d6('0x28')]('Applications\x20executed',JSON[_0xd6d6('0x2f')](_0x7579d[_0xd6d6('0x30')]));if(_0xd472e7['rules'][_0x27100b]){_0xd472e7[_0xd6d6('0x2d')][_0x27100b][_0xd6d6('0x31')](_0xd6d6('0x32'));}});return _0x9a41f3({'code':0xc8,'message':_0x4ee48f});}else{logger['info'](_0xd6d6('0x33'));return _0x9a41f3({'code':0xc8,'message':_0x4ee48f});}}catch(_0xf43857){logger['error'](_0xf43857[_0xd6d6('0x34')]);return _0x4e4149(_0x53e20c[_0xd6d6('0x2b')](0x1f4,_0xf43857));}}return _0x4e4149(_0xd6d6('0x35'));});},'AcceptMessage':function(_0x456f64){var _0xa0df85=this;return new Promise(function(_0x30c5cd,_0x3a73dd){if(_0x456f64[_0xd6d6('0x13')]&&_0x456f64[_0xd6d6('0x13')]['id']){try{var _0x53bc00=getId(_0x456f64[_0xd6d6('0x12')],_0x456f64[_0xd6d6('0x13')]?_0x456f64[_0xd6d6('0x13')]['id']:0x0,_0x456f64['interaction']?_0x456f64[_0xd6d6('0x14')]['id']:0x0);if(_0xd472e7['rules'][_0x53bc00]){_0xd472e7[_0xd6d6('0x2d')][_0x53bc00]['emit'](_0xd6d6('0x32'));if(rpc[_0x456f64[_0xd6d6('0x12')]+_0xd6d6('0x36')]){rpc[_0x456f64[_0xd6d6('0x12')]+'QueueReport'][_0xd6d6('0x37')](_0x53bc00,{'UserId':_0x456f64['message'][_0xd6d6('0x38')]})[_0xd6d6('0x39')](function(_0x24702d){logger[_0xd6d6('0x2b')](_0xd6d6('0x3a'));});}}return _0x30c5cd({'code':0xc8,'message':_0x456f64});}catch(_0x178f99){logger['error'](_0x178f99[_0xd6d6('0x34')]);return _0x3a73dd(_0xa0df85[_0xd6d6('0x2b')](0x1f4,_0x178f99));}}logger[_0xd6d6('0x2b')](_0xd6d6('0x3b'));return _0x3a73dd(_0xa0df85['error'](0x1f4,_0xd6d6('0x3b')));});},'RejectMessage':function(_0x1daae8){var _0xd3b0=this;return new Promise(function(_0x4a40ca,_0x582646){if(_0x1daae8[_0xd6d6('0x3c')]&&_0x1daae8[_0xd6d6('0x3c')]['id']){try{if(_0xd472e7['agents'][_0x1daae8[_0xd6d6('0x3c')]['id']]){_0xd472e7['agents'][_0x1daae8[_0xd6d6('0x3c')]['id']]['busy']=![];_0xd472e7[_0xd6d6('0x3d')][_0x1daae8[_0xd6d6('0x3c')]['id']]['busyQueue']=undefined;}return _0x4a40ca({'code':0xc8,'message':_0x1daae8});}catch(_0x5d0645){logger[_0xd6d6('0x2b')](_0x5d0645['stack']);return _0x582646(_0xd3b0[_0xd6d6('0x2b')](0x1f4,_0x5d0645));}}logger[_0xd6d6('0x2b')](_0xd6d6('0x3b'));return _0x582646(_0xd3b0['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2631b9){var _0x50d420=this;return new Promise(function(_0x19b64f,_0xee07cb){if(_0x2631b9[_0xd6d6('0x12')]&&_0x2631b9[_0xd6d6('0x14')]&&_0x2631b9[_0xd6d6('0x14')]['id']){try{var _0x3d40b5=getId(_0x2631b9['channel'],_0x2631b9[_0xd6d6('0x13')]?_0x2631b9[_0xd6d6('0x13')]['id']:0x0,_0x2631b9[_0xd6d6('0x14')]?_0x2631b9['interaction']['id']:0x0);if(_0xd472e7[_0xd6d6('0x2d')][_0x3d40b5]){_0xd472e7[_0xd6d6('0x2d')][_0x3d40b5][_0xd6d6('0x31')](_0xd6d6('0x32'));}return _0x19b64f({'code':0xc8,'message':_0x2631b9});}catch(_0x473a57){logger['error'](_0x473a57['stack']);return _0xee07cb(_0x50d420[_0xd6d6('0x2b')](0x1f4,_0x473a57));}}logger[_0xd6d6('0x2b')]('message\x20is\x20empty');return _0xee07cb(_0x50d420[_0xd6d6('0x2b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x1096a9){var _0xedae33=this;return new Promise(function(_0x7b4c98,_0x50e17d){if(_0xd472e7[_0xd6d6('0x3d')][_0xd6d6('0x3e')](_0x1096a9['id'])){for(var _0x37abed in _0x1096a9[_0xd6d6('0x3f')]){if(_0x1096a9[_0xd6d6('0x3f')][_0xd6d6('0x3e')](_0x37abed)){if(_0xd472e7[_0xd6d6('0x3d')][_0x1096a9['id']][_0xd6d6('0x3e')](_0x37abed+_0xd6d6('0x40'))){_0xd472e7['agents'][_0x1096a9['id']][_0x37abed+_0xd6d6('0x40')]=parseInt(_0x1096a9['capacity'][_0x37abed],0xa);}}}_0xd472e7[_0xd6d6('0x3d')][_0x1096a9['id']][_0xd6d6('0x41')]();return _0x7b4c98({'code':0xc8,'message':_0xd472e7[_0xd6d6('0x3d')][_0x1096a9['id']]});}else{return _0x50e17d(_0xedae33[_0xd6d6('0x2b')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2ef6c7){return new Promise(function(_0x5a3dcb,_0x3d0f16){var _0xe9d1d7=_[_0xd6d6('0x42')](_0xd472e7[_0xd6d6('0x3d')]);_0x5a3dcb({'count':_0xe9d1d7[_0xd6d6('0x16')],'rows':_0xe9d1d7});});},'ChatQueues':function(_0x21146a){return new Promise(function(_0xcff305,_0x24fa12){var _0x6ec67c=[];for(var _0x5832ef in _0xd472e7[_0xd6d6('0x43')]){if(_0xd472e7['chatQueues']['hasOwnProperty'](_0x5832ef)){var _0x1ec219=_0xd472e7[_0xd6d6('0x43')][_0x5832ef];var _0x261808={'id':_0x1ec219['id'],'available':_0x1ec219[_0xd6d6('0x44')],'loggedIn':_0x1ec219[_0xd6d6('0x45')],'name':_0x1ec219[_0xd6d6('0x46')],'paused':_0x1ec219[_0xd6d6('0x47')],'waiting':_0x1ec219['waiting']};_0x6ec67c[_0xd6d6('0x1e')](_0x261808);}}_0xcff305({'count':_0x6ec67c[_0xd6d6('0x16')],'rows':_0x6ec67c});});},'MailQueues':function(_0x47707e){return new Promise(function(_0x49c2f5,_0x561037){var _0x27be06=[];for(var _0x32a44b in _0xd472e7[_0xd6d6('0x48')]){if(_0xd472e7[_0xd6d6('0x48')][_0xd6d6('0x3e')](_0x32a44b)){var _0x1ec599=_0xd472e7[_0xd6d6('0x48')][_0x32a44b];var _0x1ebbdb={'id':_0x1ec599['id'],'available':_0x1ec599[_0xd6d6('0x44')],'loggedIn':_0x1ec599[_0xd6d6('0x45')],'name':_0x1ec599['name'],'paused':_0x1ec599[_0xd6d6('0x47')],'waiting':_0x1ec599['waiting']};_0x27be06['push'](_0x1ebbdb);}}_0x49c2f5({'count':_0x27be06[_0xd6d6('0x16')],'rows':_0x27be06});});},'OpenchannelQueues':function(_0x20af9a){return new Promise(function(_0x494f82,_0x28fd4b){var _0x363fa9=[];for(var _0x3ff679 in _0xd472e7[_0xd6d6('0x49')]){if(_0xd472e7[_0xd6d6('0x49')]['hasOwnProperty'](_0x3ff679)){var _0x374efe=_0xd472e7[_0xd6d6('0x49')][_0x3ff679];var _0x49c788={'id':_0x374efe['id'],'available':_0x374efe[_0xd6d6('0x44')],'loggedIn':_0x374efe['loggedIn'],'name':_0x374efe['name'],'paused':_0x374efe['paused'],'waiting':_0x374efe[_0xd6d6('0x4a')]};_0x363fa9['push'](_0x49c788);}}_0x494f82({'count':_0x363fa9[_0xd6d6('0x16')],'rows':_0x363fa9});});},'SmsQueues':function(_0x50c55e){return new Promise(function(_0x21a5df,_0x469927){var _0x30a3d2=[];for(var _0x5a0e3b in _0xd472e7[_0xd6d6('0x4b')]){if(_0xd472e7[_0xd6d6('0x4b')][_0xd6d6('0x3e')](_0x5a0e3b)){var _0x53cd39=_0xd472e7[_0xd6d6('0x4b')][_0x5a0e3b];var _0x26c622={'id':_0x53cd39['id'],'available':_0x53cd39['available'],'loggedIn':_0x53cd39[_0xd6d6('0x45')],'name':_0x53cd39[_0xd6d6('0x46')],'paused':_0x53cd39['paused'],'waiting':_0x53cd39[_0xd6d6('0x4a')]};_0x30a3d2[_0xd6d6('0x1e')](_0x26c622);}}_0x21a5df({'count':_0x30a3d2[_0xd6d6('0x16')],'rows':_0x30a3d2});});},'FaxQueues':function(_0x42f10a){return new Promise(function(_0x3c79a4,_0x563a9c){var _0x104102=[];for(var _0x44917a in _0xd472e7[_0xd6d6('0x4c')]){if(_0xd472e7['faxQueues'][_0xd6d6('0x3e')](_0x44917a)){var _0x8391c=_0xd472e7[_0xd6d6('0x4c')][_0x44917a];var _0x4588d3={'id':_0x8391c['id'],'available':_0x8391c['available'],'loggedIn':_0x8391c[_0xd6d6('0x45')],'name':_0x8391c[_0xd6d6('0x46')],'paused':_0x8391c['paused'],'waiting':_0x8391c[_0xd6d6('0x4a')]};_0x104102[_0xd6d6('0x1e')](_0x4588d3);}}_0x3c79a4({'count':_0x104102['length'],'rows':_0x104102});});},'ChatQueuesWaitingInteractions':function(_0x7507fa){return new Promise(function(_0x15a717,_0x1e2569){var _0x5b7322=_[_0xd6d6('0x42')](_0xd472e7[_0xd6d6('0x4d')]);_0x15a717({'count':_0x5b7322[_0xd6d6('0x16')],'rows':_0x5b7322});});},'MailQueuesWaitingInteractions':function(_0x4603a3){return new Promise(function(_0x13a774,_0x4293f5){var _0x2c63f2=_[_0xd6d6('0x42')](_0xd472e7[_0xd6d6('0x4e')]);_0x13a774({'count':_0x2c63f2[_0xd6d6('0x16')],'rows':_0x2c63f2});});},'OpenchannelQueuesWaitingInteractions':function(_0x3b38fe){return new Promise(function(_0x293a85,_0xde5d9f){var _0x113779=_[_0xd6d6('0x42')](_0xd472e7[_0xd6d6('0x4f')]);_0x293a85({'count':_0x113779['length'],'rows':_0x113779});});},'SmsQueuesWaitingInteractions':function(_0x1e50ca){return new Promise(function(_0x5421c2,_0x5bc314){var _0x80e7ee=_['values'](_0xd472e7[_0xd6d6('0x50')]);_0x5421c2({'count':_0x80e7ee['length'],'rows':_0x80e7ee});});},'FaxQueuesWaitingInteractions':function(_0x1505cd){return new Promise(function(_0x4ef267,_0x72da6){var _0x287f9b=_[_0xd6d6('0x42')](_0xd472e7[_0xd6d6('0x51')]);_0x4ef267({'count':_0x287f9b[_0xd6d6('0x16')],'rows':_0x287f9b});});}};var _0x2521f3=jayson[_0xd6d6('0x52')](_0x856719)[_0xd6d6('0x53')]();_0x2521f3['on']('error',function(_0x37edc3){logger[_0xd6d6('0x2b')](JSON[_0xd6d6('0x2f')](_0x37edc3));return _0x5e2416(_0x37edc3);});_0x2521f3[_0xd6d6('0x54')](0x232c,'127.0.0.1',function(){console[_0xd6d6('0x55')](_0xd6d6('0x56'),0x232c);return _0x510c66(_0xd6d6('0x57')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 726a7cd..d3e2804 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 _0x3cb1=['bluebird','jayson/promise','lodash','../../../config/logger','routing','http','request','then','error','message','catch','condition','rules','stop','push','Command','format','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x3cb1,0xad));var _0x13cb=function(_0x2e57dc,_0x22b86){_0x2e57dc=_0x2e57dc-0x0;var _0x4879d1=_0x3cb1[_0x2e57dc];return _0x4879d1;};'use strict';var util=require(_0x13cb('0x0'));var BPromise=require(_0x13cb('0x1'));var jayson=require(_0x13cb('0x2'));var _=require(_0x13cb('0x3'));var logger=require(_0x13cb('0x4'))(_0x13cb('0x5'));var client=jayson['client'][_0x13cb('0x6')]({'port':0x232a});function request(_0x4fa33e,_0x3b6fd9){return new BPromise(function(_0xc01b30,_0x3a5f61){return client[_0x13cb('0x7')](_0x4fa33e,_0x3b6fd9)[_0x13cb('0x8')](function(_0x17878f){if(_0x17878f[_0x13cb('0x9')]){return _0x3a5f61(_0x17878f[_0x13cb('0x9')][_0x13cb('0xa')]);}else{return _0xc01b30(_0x17878f['result']);}})[_0x13cb('0xb')](function(_0x3d3cb0){return _0x3a5f61(_0x3d3cb0);});});}exports[_0x13cb('0xc')]=function(_0x12be70,_0x29cbc5,_0x2f2446){return function(_0x5182f2){if(_0x2f2446[_0x13cb('0xd')]&&!_0x2f2446['rules'][_0x12be70]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x12be70);return _0x5182f2[_0x13cb('0xe')]();}var _0x46850b=[];for(var _0x52aecc=0x0;_0x52aecc<_0x29cbc5['length'];_0x52aecc+=0x1){_0x46850b[_0x13cb('0xf')](request(_0x13cb('0x10'),{'command':util[_0x13cb('0x11')](_0x13cb('0x12'),_0x29cbc5[_0x52aecc])})[_0x13cb('0x8')](function(_0x331013){return _0x331013&&_0x331013[_0x13cb('0xa')]&&_0x331013['message'][_0x13cb('0x13')]('true')>=0x0?!![]:![];})[_0x13cb('0xb')](function(_0x126cff){logger[_0x13cb('0x9')](_0x13cb('0x14'),_0x12be70,_0x29cbc5[_0x52aecc]);}));}BPromise[_0x13cb('0x15')](_0x46850b)[_0x13cb('0x8')](function(_0x52e70b){var _0x45f9c3=_[_0x13cb('0x16')](_0x52e70b);logger[_0x13cb('0x17')](_0x13cb('0x18'),_0x12be70,_0x29cbc5[_0x13cb('0x19')](_0x13cb('0x1a')),_0x45f9c3);_0x5182f2[_0x13cb('0x1b')](_0x45f9c3);})['catch'](function(_0x1b5b20){console['log'](_0x1b5b20);logger[_0x13cb('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x12be70,_0x29cbc5['join']('\x20|\x20'),_0x1b5b20[_0x13cb('0x1c')]);_0x5182f2[_0x13cb('0xe')]();});};}; \ No newline at end of file +var _0x7f21=['true','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util','jayson/promise','lodash','../../../config/logger','routing','client','http','request','error','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','then','message','indexOf'];(function(_0x122d83,_0x202c23){var _0x331d23=function(_0x4c73d6){while(--_0x4c73d6){_0x122d83['push'](_0x122d83['shift']());}};_0x331d23(++_0x202c23);}(_0x7f21,0x102));var _0x17f2=function(_0x1b8e4c,_0x11e22d){_0x1b8e4c=_0x1b8e4c-0x0;var _0x3ddac7=_0x7f21[_0x1b8e4c];return _0x3ddac7;};'use strict';var util=require(_0x17f2('0x0'));var BPromise=require('bluebird');var jayson=require(_0x17f2('0x1'));var _=require(_0x17f2('0x2'));var logger=require(_0x17f2('0x3'))(_0x17f2('0x4'));var client=jayson[_0x17f2('0x5')][_0x17f2('0x6')]({'port':0x232a});function request(_0x1aa6cd,_0x44f808){return new BPromise(function(_0x40433e,_0x24fc16){return client[_0x17f2('0x7')](_0x1aa6cd,_0x44f808)['then'](function(_0x121009){if(_0x121009[_0x17f2('0x8')]){return _0x24fc16(_0x121009[_0x17f2('0x8')]['message']);}else{return _0x40433e(_0x121009[_0x17f2('0x9')]);}})['catch'](function(_0x10a268){return _0x24fc16(_0x10a268);});});}exports[_0x17f2('0xa')]=function(_0x28b3a7,_0x2d1421,_0x351182){return function(_0x354470){if(_0x351182['rules']&&!_0x351182[_0x17f2('0xb')][_0x28b3a7]){logger[_0x17f2('0xc')](_0x17f2('0xd'),_0x28b3a7);return _0x354470[_0x17f2('0xe')]();}var _0x2e6bd7=[];for(var _0x3f9e20=0x0;_0x3f9e20<_0x2d1421['length'];_0x3f9e20+=0x1){_0x2e6bd7[_0x17f2('0xf')](request(_0x17f2('0x10'),{'command':util[_0x17f2('0x11')]('iftime\x20%s',_0x2d1421[_0x3f9e20])})[_0x17f2('0x12')](function(_0x2690f5){return _0x2690f5&&_0x2690f5[_0x17f2('0x13')]&&_0x2690f5[_0x17f2('0x13')][_0x17f2('0x14')](_0x17f2('0x15'))>=0x0?!![]:![];})[_0x17f2('0x16')](function(_0xc71251){logger[_0x17f2('0x8')](_0x17f2('0x17'),_0x28b3a7,_0x2d1421[_0x3f9e20]);}));}BPromise[_0x17f2('0x18')](_0x2e6bd7)['then'](function(_0x2665ce){var _0x56c680=_[_0x17f2('0x19')](_0x2665ce);logger[_0x17f2('0xc')](_0x17f2('0x1a'),_0x28b3a7,_0x2d1421[_0x17f2('0x1b')](_0x17f2('0x1c')),_0x56c680);_0x354470['when'](_0x56c680);})['catch'](function(_0x4ed0c4){console[_0x17f2('0x1d')](_0x4ed0c4);logger['error'](_0x17f2('0x1a'),_0x28b3a7,_0x2d1421[_0x17f2('0x1b')]('\x20|\x20'),_0x4ed0c4[_0x17f2('0x1e')]);_0x354470[_0x17f2('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 66306a4..28c16f4 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 _0xf7a3=['connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','reason','rejected','holdtime','ringtime','talktime','abandoned','agentconnect','connect','forIn','answered_elsewhere','answeredelsewheremembername','membername','agentcompleteAt','agentconnectAt','complete','blindtransfer','transfereruniqueid','transfertype','blind','transferexten','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','diffTime','lodash','util','./utils','info','format','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwtime','agentacw','CreateVoiceAgentReport','request','destuniqueid','agentcalled','agentcalledAt','now','called'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xf7a3,0x1bc));var _0x3f7a=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0xf7a3[_0x81f000];return _0x337aa2;};'use strict';var _=require(_0x3f7a('0x0'));var util=require(_0x3f7a('0x1'));var utils=require(_0x3f7a('0x2'));var agents={};var transfers={};function writeDB(_0x460fb9,_0x57df0b){utils[_0x3f7a('0x3')](util[_0x3f7a('0x4')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x460fb9[_0x3f7a('0x5')],_0x460fb9[_0x3f7a('0x6')],_0x460fb9[_0x3f7a('0x7')],_0x460fb9['membername'],_0x460fb9[_0x3f7a('0x8')],_0x460fb9[_0x3f7a('0x9')],_0x460fb9[_0x3f7a('0xa')],_0x460fb9[_0x3f7a('0xb')]));if(_0x460fb9[_0x3f7a('0x7')]){utils[_0x3f7a('0xc')](_0x460fb9[_0x3f7a('0x7')])['then'](function(_0x3fc40a){if(_0x3fc40a){_0x460fb9[_0x3f7a('0xd')]=_0x3fc40a[_0x3f7a('0xd')];_0x460fb9['agentacw']=_0x460fb9[_0x3f7a('0xe')]?_0x3fc40a[_0x3f7a('0xf')]:![];_0x460fb9[_0x3f7a('0x10')]=_0x460fb9[_0x3f7a('0x11')]?_0x3fc40a['acwTimeout']:0x0;}utils['request'](_0x3f7a('0x12'),_0x460fb9);});}else{utils[_0x3f7a('0x13')](_0x3f7a('0x12'),_0x460fb9);}if(_0x57df0b){delete transfers[_0x460fb9[_0x3f7a('0x5')]];}else{delete agents[_0x460fb9[_0x3f7a('0x14')]];}}exports[_0x3f7a('0x15')]=function(_0x185ee1){try{agents[_0x185ee1[_0x3f7a('0x14')]]=_0x185ee1;agents[_0x185ee1[_0x3f7a('0x14')]][_0x3f7a('0x16')]=utils[_0x3f7a('0x17')]();agents[_0x185ee1[_0x3f7a('0x14')]][_0x3f7a('0xb')]=_0x3f7a('0x18');agents[_0x185ee1[_0x3f7a('0x14')]][_0x3f7a('0xa')]=null;agents[_0x185ee1['destuniqueid']][_0x3f7a('0x19')]=null;}catch(_0xa4456d){utils[_0x3f7a('0x1a')](_0xa4456d[_0x3f7a('0x1b')]);}};exports[_0x3f7a('0x1c')]=function(_0x49cf57){try{if(!_[_0x3f7a('0x1d')](agents[_0x49cf57[_0x3f7a('0x14')]])){agents[_0x49cf57[_0x3f7a('0x14')]][_0x3f7a('0x1c')]=!![];agents[_0x49cf57['destuniqueid']][_0x3f7a('0x1e')]=utils[_0x3f7a('0x17')]();agents[_0x49cf57[_0x3f7a('0x14')]][_0x3f7a('0xb')]='rejected';agents[_0x49cf57['destuniqueid']][_0x3f7a('0x1f')]=_0x3f7a('0x20');agents[_0x49cf57[_0x3f7a('0x14')]][_0x3f7a('0x21')]=_0x49cf57['ringtime']?parseInt(_0x49cf57[_0x3f7a('0x22')])/0x3e8:0x0;agents[_0x49cf57[_0x3f7a('0x14')]][_0x3f7a('0x23')]=0x0;writeDB(agents[_0x49cf57[_0x3f7a('0x14')]]);}}catch(_0x4aef41){utils[_0x3f7a('0x1a')](_0x4aef41[_0x3f7a('0x1b')]);}};exports['queuecallerabandon']=function(_0x4134be){try{_['forIn'](agents,function(_0x1156b6,_0x262b18){if(_0x1156b6[_0x3f7a('0x5')]==_0x4134be[_0x3f7a('0x5')]){_0x1156b6['agentringnoanswer']=!![];_0x1156b6[_0x3f7a('0x1e')]=utils[_0x3f7a('0x17')]();_0x1156b6[_0x3f7a('0xb')]=_0x3f7a('0x24');_0x1156b6['reason']=_0x3f7a('0x24');_0x1156b6['holdtime']=_0x4134be['holdtime'];_0x1156b6[_0x3f7a('0x23')]=0x0;writeDB(_0x1156b6);}});}catch(_0x590c8d){utils[_0x3f7a('0x1a')](_0x590c8d[_0x3f7a('0x1b')]);}};exports[_0x3f7a('0x25')]=function(_0x232324){try{if(agents[_0x232324[_0x3f7a('0x14')]]){agents[_0x232324[_0x3f7a('0x14')]]['agentconnectAt']=utils[_0x3f7a('0x17')]();agents[_0x232324[_0x3f7a('0x14')]]['connectedlinenum']=_0x232324[_0x3f7a('0xa')];agents[_0x232324[_0x3f7a('0x14')]][_0x3f7a('0x19')]=_0x232324[_0x3f7a('0x19')];agents[_0x232324[_0x3f7a('0x14')]][_0x3f7a('0x21')]=_0x232324['ringtime'];agents[_0x232324['destuniqueid']][_0x3f7a('0xb')]=_0x3f7a('0x26');_[_0x3f7a('0x27')](agents,function(_0x22203c,_0x205ea7){if(_0x22203c['destuniqueid']!=_0x232324[_0x3f7a('0x14')]&&_0x22203c[_0x3f7a('0x5')]==_0x232324[_0x3f7a('0x5')]){_0x22203c['talktime']=0x0;_0x22203c['holdtime']=_0x232324[_0x3f7a('0x22')];_0x22203c['agentringnoanswer']=!![];_0x22203c[_0x3f7a('0x1e')]=utils[_0x3f7a('0x17')]();_0x22203c['lastevent']='answered_elsewhere';_0x22203c[_0x3f7a('0x1f')]=_0x3f7a('0x28');_0x22203c['answeredelsewheredestinationuniqueid']=_0x232324[_0x3f7a('0x14')];_0x22203c[_0x3f7a('0x29')]=_0x232324[_0x3f7a('0x2a')];writeDB(_0x22203c);}});}}catch(_0x67bed7){utils[_0x3f7a('0x1a')](_0x67bed7['stack']);}};exports[_0x3f7a('0xe')]=function(_0x3aafb3){try{if(!_['isNil'](agents[_0x3aafb3[_0x3f7a('0x14')]])){agents[_0x3aafb3[_0x3f7a('0x14')]][_0x3f7a('0xe')]=!![];agents[_0x3aafb3[_0x3f7a('0x14')]][_0x3f7a('0x2b')]=utils[_0x3f7a('0x17')]();agents[_0x3aafb3['destuniqueid']][_0x3f7a('0x23')]=utils['diffTime'](agents[_0x3aafb3[_0x3f7a('0x14')]]['agentcompleteAt'],agents[_0x3aafb3[_0x3f7a('0x14')]][_0x3f7a('0x2c')]);agents[_0x3aafb3[_0x3f7a('0x14')]][_0x3f7a('0x1f')]=_0x3aafb3[_0x3f7a('0x1f')];agents[_0x3aafb3['destuniqueid']][_0x3f7a('0xb')]=_0x3f7a('0x2d');writeDB(agents[_0x3aafb3['destuniqueid']]);}}catch(_0x54d268){utils[_0x3f7a('0x1a')](_0x54d268[_0x3f7a('0x1b')]);}};exports[_0x3f7a('0x2e')]=function(_0x435f9e){try{if(!_[_0x3f7a('0x1d')](agents[_0x435f9e[_0x3f7a('0x2f')]])){agents[_0x435f9e['transfereruniqueid']]['transfer']=!![];agents[_0x435f9e[_0x3f7a('0x2f')]][_0x3f7a('0x30')]=_0x3f7a('0x31');agents[_0x435f9e[_0x3f7a('0x2f')]][_0x3f7a('0x32')]=_0x435f9e['extension'];agents[_0x435f9e[_0x3f7a('0x2f')]][_0x3f7a('0x33')]=agents[_0x435f9e[_0x3f7a('0x2f')]][_0x3f7a('0x5')];}}catch(_0x18017f){utils[_0x3f7a('0x1a')](_0x18017f[_0x3f7a('0x1b')]);}};exports['attendedtransfer']=function(_0x179f37){try{if(_0x179f37[_0x3f7a('0x34')]==_0x179f37[_0x3f7a('0x35')]){if(!_[_0x3f7a('0x1d')](agents[_0x179f37[_0x3f7a('0x36')]])){agents[_0x179f37[_0x3f7a('0x36')]][_0x3f7a('0x37')]=!![];agents[_0x179f37['secondtransfereruniqueid']][_0x3f7a('0x30')]=_0x3f7a('0x38');agents[_0x179f37[_0x3f7a('0x36')]][_0x3f7a('0x32')]=_0x179f37[_0x3f7a('0x39')];agents[_0x179f37[_0x3f7a('0x36')]]['transferuniqueid']=_0x179f37['origtransfereruniqueid'];}if(_0x179f37['transfereeuniqueid']&&agents[_0x179f37[_0x3f7a('0x3a')]]){agents[_0x179f37[_0x3f7a('0x3a')]][_0x3f7a('0x3b')]=0x1;transfers[_0x179f37[_0x3f7a('0x3a')]]=_[_0x3f7a('0x3c')](agents[_0x179f37['transfereeuniqueid']]);transfers[_0x179f37[_0x3f7a('0x3a')]]['calleridnum']=agents[_0x179f37['secondtransfereruniqueid']][_0x3f7a('0x9')];transfers[_0x179f37[_0x3f7a('0x3a')]][_0x3f7a('0x3d')]=agents[_0x179f37[_0x3f7a('0x36')]]['calleridname'];transfers[_0x179f37[_0x3f7a('0x3a')]][_0x3f7a('0x16')]=utils[_0x3f7a('0x17')]();transfers[_0x179f37[_0x3f7a('0x3a')]][_0x3f7a('0x2c')]=utils[_0x3f7a('0x17')]();transfers[_0x179f37[_0x3f7a('0x3a')]]['holdtime']=0x0;transfers[_0x179f37[_0x3f7a('0x3a')]]['agententerreason']=0x2;}}else if(_0x179f37['secondtransfereruniqueid']==_0x179f37[_0x3f7a('0x3e')]){if(!_[_0x3f7a('0x1d')](agents[_0x179f37['origtransfereruniqueid']])){agents[_0x179f37[_0x3f7a('0x34')]][_0x3f7a('0x37')]=!![];agents[_0x179f37[_0x3f7a('0x34')]][_0x3f7a('0x30')]=_0x3f7a('0x38');agents[_0x179f37[_0x3f7a('0x34')]][_0x3f7a('0x32')]=_0x179f37[_0x3f7a('0x3f')];agents[_0x179f37[_0x3f7a('0x34')]][_0x3f7a('0x33')]=_0x179f37[_0x3f7a('0x36')];}if(_0x179f37['transfertargetuniqueid']&&agents[_0x179f37[_0x3f7a('0x40')]]){agents[_0x179f37[_0x3f7a('0x40')]][_0x3f7a('0x3b')]=0x1;transfers[_0x179f37['transfertargetuniqueid']]=_[_0x3f7a('0x3c')](agents[_0x179f37[_0x3f7a('0x40')]]);transfers[_0x179f37[_0x3f7a('0x40')]][_0x3f7a('0x9')]=agents[_0x179f37[_0x3f7a('0x34')]]['calleridnum'];transfers[_0x179f37[_0x3f7a('0x40')]]['calleridname']=agents[_0x179f37[_0x3f7a('0x34')]][_0x3f7a('0x3d')];transfers[_0x179f37[_0x3f7a('0x40')]]['agentcalledAt']=utils['now']();transfers[_0x179f37[_0x3f7a('0x40')]][_0x3f7a('0x2c')]=utils[_0x3f7a('0x17')]();transfers[_0x179f37['transfertargetuniqueid']][_0x3f7a('0x21')]=0x0;transfers[_0x179f37[_0x3f7a('0x40')]][_0x3f7a('0x3b')]=0x2;}}}catch(_0x29488a){utils[_0x3f7a('0x1a')](_0x29488a[_0x3f7a('0x1b')]);}};exports[_0x3f7a('0x41')]=function(_0x565a59){try{if(transfers[_0x565a59[_0x3f7a('0x5')]]){transfers[_0x565a59['uniqueid']]['agentcomplete']=!![];transfers[_0x565a59[_0x3f7a('0x5')]][_0x3f7a('0x2b')]=utils[_0x3f7a('0x17')]();transfers[_0x565a59[_0x3f7a('0x5')]][_0x3f7a('0x23')]=utils[_0x3f7a('0x42')](transfers[_0x565a59[_0x3f7a('0x5')]][_0x3f7a('0x2b')],transfers[_0x565a59['uniqueid']][_0x3f7a('0x2c')]);transfers[_0x565a59[_0x3f7a('0x5')]][_0x3f7a('0x1f')]='agent';transfers[_0x565a59[_0x3f7a('0x5')]][_0x3f7a('0xb')]=_0x3f7a('0x2d');writeDB(transfers[_0x565a59[_0x3f7a('0x5')]],!![]);}if(agents[_0x565a59[_0x3f7a('0x5')]]&&agents[_0x565a59[_0x3f7a('0x5')]]['agentconnectAt']){agents[_0x565a59[_0x3f7a('0x5')]][_0x3f7a('0xe')]=!![];agents[_0x565a59[_0x3f7a('0x5')]][_0x3f7a('0x2b')]=utils['now']();agents[_0x565a59[_0x3f7a('0x5')]][_0x3f7a('0x23')]=utils[_0x3f7a('0x42')](agents[_0x565a59[_0x3f7a('0x5')]][_0x3f7a('0x2b')],agents[_0x565a59['uniqueid']][_0x3f7a('0x2c')]);agents[_0x565a59[_0x3f7a('0x5')]]['reason']=agents[_0x565a59[_0x3f7a('0x5')]]['transfer']?_0x3f7a('0x37'):'agent';agents[_0x565a59['uniqueid']][_0x3f7a('0xb')]=_0x3f7a('0x2d');writeDB(agents[_0x565a59[_0x3f7a('0x5')]]);}}catch(_0x3bbcc9){utils[_0x3f7a('0x1a')](_0x3bbcc9['stack']);}}; \ No newline at end of file +var _0xb4ef=['blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agentcalledAt','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','agent','lodash','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','destuniqueid','now','called','connectedlinenum','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','rejected','holdtime','ringtime','talktime','queuecallerabandon','forIn','reason','abandoned','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','membername','diffTime','agentcompleteAt','complete'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xb4ef,0x175));var _0xfb4e=function(_0x305d1e,_0x219641){_0x305d1e=_0x305d1e-0x0;var _0x198115=_0xb4ef[_0x305d1e];return _0x198115;};'use strict';var _=require(_0xfb4e('0x0'));var util=require(_0xfb4e('0x1'));var utils=require(_0xfb4e('0x2'));var agents={};var transfers={};function writeDB(_0x5dc6fb,_0x32412d){utils['info'](util[_0xfb4e('0x3')](_0xfb4e('0x4'),_0x5dc6fb[_0xfb4e('0x5')],_0x5dc6fb['channel'],_0x5dc6fb[_0xfb4e('0x6')],_0x5dc6fb['membername'],_0x5dc6fb['interface'],_0x5dc6fb[_0xfb4e('0x7')],_0x5dc6fb['connectedlinenum'],_0x5dc6fb[_0xfb4e('0x8')]));if(_0x5dc6fb[_0xfb4e('0x6')]){utils[_0xfb4e('0x9')](_0x5dc6fb[_0xfb4e('0x6')])[_0xfb4e('0xa')](function(_0x2ee20){if(_0x2ee20){_0x5dc6fb[_0xfb4e('0xb')]=_0x2ee20[_0xfb4e('0xb')];_0x5dc6fb[_0xfb4e('0xc')]=_0x5dc6fb[_0xfb4e('0xd')]?_0x2ee20[_0xfb4e('0xe')]:![];_0x5dc6fb[_0xfb4e('0xf')]=_0x5dc6fb[_0xfb4e('0xc')]?_0x2ee20[_0xfb4e('0x10')]:0x0;}utils['request'](_0xfb4e('0x11'),_0x5dc6fb);});}else{utils[_0xfb4e('0x12')](_0xfb4e('0x11'),_0x5dc6fb);}if(_0x32412d){delete transfers[_0x5dc6fb[_0xfb4e('0x5')]];}else{delete agents[_0x5dc6fb['destuniqueid']];}}exports[_0xfb4e('0x13')]=function(_0x4caa8c){try{agents[_0x4caa8c[_0xfb4e('0x14')]]=_0x4caa8c;agents[_0x4caa8c[_0xfb4e('0x14')]]['agentcalledAt']=utils[_0xfb4e('0x15')]();agents[_0x4caa8c[_0xfb4e('0x14')]][_0xfb4e('0x8')]=_0xfb4e('0x16');agents[_0x4caa8c[_0xfb4e('0x14')]][_0xfb4e('0x17')]=null;agents[_0x4caa8c[_0xfb4e('0x14')]][_0xfb4e('0x18')]=null;}catch(_0x5d216b){utils[_0xfb4e('0x19')](_0x5d216b[_0xfb4e('0x1a')]);}};exports[_0xfb4e('0x1b')]=function(_0x24196d){try{if(!_[_0xfb4e('0x1c')](agents[_0x24196d['destuniqueid']])){agents[_0x24196d[_0xfb4e('0x14')]]['agentringnoanswer']=!![];agents[_0x24196d[_0xfb4e('0x14')]][_0xfb4e('0x1d')]=utils[_0xfb4e('0x15')]();agents[_0x24196d[_0xfb4e('0x14')]][_0xfb4e('0x8')]=_0xfb4e('0x1e');agents[_0x24196d[_0xfb4e('0x14')]]['reason']=_0xfb4e('0x1e');agents[_0x24196d[_0xfb4e('0x14')]][_0xfb4e('0x1f')]=_0x24196d[_0xfb4e('0x20')]?parseInt(_0x24196d['ringtime'])/0x3e8:0x0;agents[_0x24196d[_0xfb4e('0x14')]][_0xfb4e('0x21')]=0x0;writeDB(agents[_0x24196d[_0xfb4e('0x14')]]);}}catch(_0x5aa3b9){utils[_0xfb4e('0x19')](_0x5aa3b9['stack']);}};exports[_0xfb4e('0x22')]=function(_0x287015){try{_[_0xfb4e('0x23')](agents,function(_0x578eb5,_0x4071ef){if(_0x578eb5[_0xfb4e('0x5')]==_0x287015[_0xfb4e('0x5')]){_0x578eb5[_0xfb4e('0x1b')]=!![];_0x578eb5[_0xfb4e('0x1d')]=utils['now']();_0x578eb5[_0xfb4e('0x8')]='abandoned';_0x578eb5[_0xfb4e('0x24')]=_0xfb4e('0x25');_0x578eb5[_0xfb4e('0x1f')]=_0x287015[_0xfb4e('0x1f')];_0x578eb5[_0xfb4e('0x21')]=0x0;writeDB(_0x578eb5);}});}catch(_0x3c1ae3){utils['error'](_0x3c1ae3[_0xfb4e('0x1a')]);}};exports[_0xfb4e('0x26')]=function(_0x22e07b){try{if(agents[_0x22e07b[_0xfb4e('0x14')]]){agents[_0x22e07b[_0xfb4e('0x14')]][_0xfb4e('0x27')]=utils[_0xfb4e('0x15')]();agents[_0x22e07b[_0xfb4e('0x14')]][_0xfb4e('0x17')]=_0x22e07b[_0xfb4e('0x17')];agents[_0x22e07b[_0xfb4e('0x14')]]['connectedlinename']=_0x22e07b[_0xfb4e('0x18')];agents[_0x22e07b['destuniqueid']][_0xfb4e('0x1f')]=_0x22e07b[_0xfb4e('0x20')];agents[_0x22e07b[_0xfb4e('0x14')]][_0xfb4e('0x8')]=_0xfb4e('0x28');_['forIn'](agents,function(_0xc55a73,_0x2aaa77){if(_0xc55a73['destuniqueid']!=_0x22e07b['destuniqueid']&&_0xc55a73[_0xfb4e('0x5')]==_0x22e07b['uniqueid']){_0xc55a73['talktime']=0x0;_0xc55a73[_0xfb4e('0x1f')]=_0x22e07b[_0xfb4e('0x20')];_0xc55a73[_0xfb4e('0x1b')]=!![];_0xc55a73[_0xfb4e('0x1d')]=utils[_0xfb4e('0x15')]();_0xc55a73['lastevent']='answered_elsewhere';_0xc55a73['reason']=_0xfb4e('0x29');_0xc55a73[_0xfb4e('0x2a')]=_0x22e07b[_0xfb4e('0x14')];_0xc55a73['answeredelsewheremembername']=_0x22e07b[_0xfb4e('0x2b')];writeDB(_0xc55a73);}});}}catch(_0x773085){utils['error'](_0x773085[_0xfb4e('0x1a')]);}};exports[_0xfb4e('0xd')]=function(_0x45cc0){try{if(!_[_0xfb4e('0x1c')](agents[_0x45cc0[_0xfb4e('0x14')]])){agents[_0x45cc0[_0xfb4e('0x14')]][_0xfb4e('0xd')]=!![];agents[_0x45cc0[_0xfb4e('0x14')]]['agentcompleteAt']=utils[_0xfb4e('0x15')]();agents[_0x45cc0['destuniqueid']][_0xfb4e('0x21')]=utils[_0xfb4e('0x2c')](agents[_0x45cc0[_0xfb4e('0x14')]][_0xfb4e('0x2d')],agents[_0x45cc0[_0xfb4e('0x14')]]['agentconnectAt']);agents[_0x45cc0[_0xfb4e('0x14')]][_0xfb4e('0x24')]=_0x45cc0[_0xfb4e('0x24')];agents[_0x45cc0[_0xfb4e('0x14')]]['lastevent']=_0xfb4e('0x2e');writeDB(agents[_0x45cc0[_0xfb4e('0x14')]]);}}catch(_0x41921a){utils[_0xfb4e('0x19')](_0x41921a[_0xfb4e('0x1a')]);}};exports[_0xfb4e('0x2f')]=function(_0x1a9ce1){try{if(!_[_0xfb4e('0x1c')](agents[_0x1a9ce1[_0xfb4e('0x30')]])){agents[_0x1a9ce1[_0xfb4e('0x30')]][_0xfb4e('0x31')]=!![];agents[_0x1a9ce1[_0xfb4e('0x30')]][_0xfb4e('0x32')]=_0xfb4e('0x33');agents[_0x1a9ce1[_0xfb4e('0x30')]][_0xfb4e('0x34')]=_0x1a9ce1[_0xfb4e('0x35')];agents[_0x1a9ce1[_0xfb4e('0x30')]][_0xfb4e('0x36')]=agents[_0x1a9ce1[_0xfb4e('0x30')]][_0xfb4e('0x5')];}}catch(_0x1f55b1){utils[_0xfb4e('0x19')](_0x1f55b1['stack']);}};exports[_0xfb4e('0x37')]=function(_0x1ff7d8){try{if(_0x1ff7d8[_0xfb4e('0x38')]==_0x1ff7d8[_0xfb4e('0x39')]){if(!_[_0xfb4e('0x1c')](agents[_0x1ff7d8[_0xfb4e('0x3a')]])){agents[_0x1ff7d8[_0xfb4e('0x3a')]][_0xfb4e('0x31')]=!![];agents[_0x1ff7d8['secondtransfereruniqueid']][_0xfb4e('0x32')]=_0xfb4e('0x3b');agents[_0x1ff7d8[_0xfb4e('0x3a')]][_0xfb4e('0x34')]=_0x1ff7d8[_0xfb4e('0x3c')];agents[_0x1ff7d8[_0xfb4e('0x3a')]][_0xfb4e('0x36')]=_0x1ff7d8[_0xfb4e('0x38')];}if(_0x1ff7d8[_0xfb4e('0x3d')]&&agents[_0x1ff7d8[_0xfb4e('0x3d')]]){agents[_0x1ff7d8[_0xfb4e('0x3d')]]['agententerreason']=0x1;transfers[_0x1ff7d8[_0xfb4e('0x3d')]]=_[_0xfb4e('0x3e')](agents[_0x1ff7d8[_0xfb4e('0x3d')]]);transfers[_0x1ff7d8[_0xfb4e('0x3d')]][_0xfb4e('0x7')]=agents[_0x1ff7d8['secondtransfereruniqueid']]['calleridnum'];transfers[_0x1ff7d8['transfereeuniqueid']][_0xfb4e('0x3f')]=agents[_0x1ff7d8[_0xfb4e('0x3a')]][_0xfb4e('0x3f')];transfers[_0x1ff7d8[_0xfb4e('0x3d')]][_0xfb4e('0x40')]=utils[_0xfb4e('0x15')]();transfers[_0x1ff7d8[_0xfb4e('0x3d')]]['agentconnectAt']=utils[_0xfb4e('0x15')]();transfers[_0x1ff7d8[_0xfb4e('0x3d')]][_0xfb4e('0x1f')]=0x0;transfers[_0x1ff7d8[_0xfb4e('0x3d')]]['agententerreason']=0x2;}}else if(_0x1ff7d8[_0xfb4e('0x3a')]==_0x1ff7d8['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x1ff7d8[_0xfb4e('0x38')]])){agents[_0x1ff7d8[_0xfb4e('0x38')]][_0xfb4e('0x31')]=!![];agents[_0x1ff7d8[_0xfb4e('0x38')]][_0xfb4e('0x32')]=_0xfb4e('0x3b');agents[_0x1ff7d8[_0xfb4e('0x38')]]['transferexten']=_0x1ff7d8[_0xfb4e('0x41')];agents[_0x1ff7d8[_0xfb4e('0x38')]][_0xfb4e('0x36')]=_0x1ff7d8[_0xfb4e('0x3a')];}if(_0x1ff7d8[_0xfb4e('0x42')]&&agents[_0x1ff7d8[_0xfb4e('0x42')]]){agents[_0x1ff7d8['transfertargetuniqueid']][_0xfb4e('0x43')]=0x1;transfers[_0x1ff7d8[_0xfb4e('0x42')]]=_[_0xfb4e('0x3e')](agents[_0x1ff7d8[_0xfb4e('0x42')]]);transfers[_0x1ff7d8[_0xfb4e('0x42')]][_0xfb4e('0x7')]=agents[_0x1ff7d8[_0xfb4e('0x38')]][_0xfb4e('0x7')];transfers[_0x1ff7d8[_0xfb4e('0x42')]][_0xfb4e('0x3f')]=agents[_0x1ff7d8[_0xfb4e('0x38')]][_0xfb4e('0x3f')];transfers[_0x1ff7d8[_0xfb4e('0x42')]][_0xfb4e('0x40')]=utils[_0xfb4e('0x15')]();transfers[_0x1ff7d8['transfertargetuniqueid']][_0xfb4e('0x27')]=utils[_0xfb4e('0x15')]();transfers[_0x1ff7d8['transfertargetuniqueid']][_0xfb4e('0x1f')]=0x0;transfers[_0x1ff7d8['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0xf3154b){utils[_0xfb4e('0x19')](_0xf3154b[_0xfb4e('0x1a')]);}};exports[_0xfb4e('0x44')]=function(_0x25a9ba){try{if(transfers[_0x25a9ba[_0xfb4e('0x5')]]){transfers[_0x25a9ba[_0xfb4e('0x5')]]['agentcomplete']=!![];transfers[_0x25a9ba['uniqueid']][_0xfb4e('0x2d')]=utils['now']();transfers[_0x25a9ba[_0xfb4e('0x5')]]['talktime']=utils['diffTime'](transfers[_0x25a9ba[_0xfb4e('0x5')]][_0xfb4e('0x2d')],transfers[_0x25a9ba[_0xfb4e('0x5')]]['agentconnectAt']);transfers[_0x25a9ba['uniqueid']][_0xfb4e('0x24')]='agent';transfers[_0x25a9ba['uniqueid']][_0xfb4e('0x8')]=_0xfb4e('0x2e');writeDB(transfers[_0x25a9ba['uniqueid']],!![]);}if(agents[_0x25a9ba[_0xfb4e('0x5')]]&&agents[_0x25a9ba[_0xfb4e('0x5')]]['agentconnectAt']){agents[_0x25a9ba[_0xfb4e('0x5')]]['agentcomplete']=!![];agents[_0x25a9ba[_0xfb4e('0x5')]][_0xfb4e('0x2d')]=utils['now']();agents[_0x25a9ba['uniqueid']][_0xfb4e('0x21')]=utils['diffTime'](agents[_0x25a9ba[_0xfb4e('0x5')]][_0xfb4e('0x2d')],agents[_0x25a9ba['uniqueid']]['agentconnectAt']);agents[_0x25a9ba['uniqueid']][_0xfb4e('0x24')]=agents[_0x25a9ba['uniqueid']][_0xfb4e('0x31')]?'transfer':_0xfb4e('0x45');agents[_0x25a9ba['uniqueid']][_0xfb4e('0x8')]=_0xfb4e('0x2e');writeDB(agents[_0x25a9ba[_0xfb4e('0x5')]]);}}catch(_0x183c8b){utils[_0xfb4e('0x19')](_0x183c8b['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index a0213c6..90b2865 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 _0xf01a=['ANSWERED','BUSY','info','format','uniqueid','channel','type','accountcode','source','destination','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','linkedid','calleridnum','context','now','DOCUMENTATION','error','stack','newstate','isNil','systemanswertime','channelstate','answertime','toNumber','hangup','\x22\x20<','calleridname','endtime','duration','starttime','attendedtransfer','localtwolinkedid','transfereechannel','destinationchannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstartAt','mohtime','diffTime','varset','variable','xmd-originatecalleridnum','xmd-phone','value','xmd-callerid-preview','xmd-callerid','xmd-queue','lastapplication','Queue','lastdata','queue','ContactId','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xf01a,0x9b));var _0xaf01=function(_0x141f9c,_0x4caebc){_0x141f9c=_0x141f9c-0x0;var _0x556891=_0xf01a[_0x141f9c];return _0x556891;};'use strict';var _=require(_0xaf01('0x0'));var util=require(_0xaf01('0x1'));var utils=require(_0xaf01('0x2'));var dispositions=[_0xaf01('0x3'),_0xaf01('0x4'),_0xaf01('0x4'),_0xaf01('0x3'),_0xaf01('0x3'),_0xaf01('0x3'),_0xaf01('0x5'),_0xaf01('0x6'),_0xaf01('0x4'),'FAILED',_0xaf01('0x4')];var channels={};function writeDB(_0x53321e){utils[_0xaf01('0x7')](util[_0xaf01('0x8')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x53321e[_0xaf01('0x9')],_0x53321e[_0xaf01('0xa')],_0x53321e[_0xaf01('0xb')],_0x53321e[_0xaf01('0xc')],_0x53321e[_0xaf01('0xd')],_0x53321e[_0xaf01('0xe')],_0x53321e[_0xaf01('0xf')],_0x53321e[_0xaf01('0x10')]));if(_0x53321e['accountcode']){utils[_0xaf01('0x11')](_0x53321e[_0xaf01('0xc')])[_0xaf01('0x12')](function(_0x11dcc1){if(_0x11dcc1){_0x53321e[_0xaf01('0x13')]=_0x11dcc1['id'];}utils[_0xaf01('0x14')](_0xaf01('0x15'),_0x53321e);});}else{utils['request']('CreateVoiceCallReport',_0x53321e);}if(channels[_0x53321e[_0xaf01('0x9')]]){delete channels[_0x53321e[_0xaf01('0x9')]];}}exports[_0xaf01('0x16')]=function(_0x92b2cf){try{if(_0x92b2cf[_0xaf01('0x9')]==_0x92b2cf[_0xaf01('0x17')]){channels[_0x92b2cf[_0xaf01('0x9')]]={'uniqueid':_0x92b2cf[_0xaf01('0x9')],'accountcode':_0x92b2cf['accountcode'],'source':_0x92b2cf[_0xaf01('0x18')],'destination':_0x92b2cf['exten'],'destinationcontext':_0x92b2cf[_0xaf01('0x19')],'channel':_0x92b2cf[_0xaf01('0xa')],'starttime':utils[_0xaf01('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xaf01('0x3'),'amaflags':_0xaf01('0x1b')};}}catch(_0x59dbce){utils[_0xaf01('0x1c')](_0x59dbce[_0xaf01('0x1d')]);}};exports[_0xaf01('0x1e')]=function(_0x463ca1){try{if(!_[_0xaf01('0x1f')](channels[_0x463ca1[_0xaf01('0x9')]])&&_0x463ca1['channelstate']==0x6){if(_[_0xaf01('0x1f')](channels[_0x463ca1[_0xaf01('0x9')]][_0xaf01('0x20')])){channels[_0x463ca1[_0xaf01('0x9')]][_0xaf01('0x20')]=utils[_0xaf01('0x1a')]();}}else if(!_['isNil'](channels[_0x463ca1['linkedid']])&&_0x463ca1[_0xaf01('0x21')]==0x6&&_0x463ca1[_0xaf01('0x19')]!='transfer'){channels[_0x463ca1[_0xaf01('0x17')]]['accountcode']=_0x463ca1['accountcode'];channels[_0x463ca1[_0xaf01('0x17')]]['destinationchannel']=_0x463ca1['channel'];if(_[_0xaf01('0x1f')](channels[_0x463ca1[_0xaf01('0x17')]][_0xaf01('0x22')])){channels[_0x463ca1[_0xaf01('0x17')]][_0xaf01('0x22')]=utils[_0xaf01('0x1a')]();}channels[_0x463ca1[_0xaf01('0x17')]][_0xaf01('0x10')]=dispositions[_[_0xaf01('0x23')](_0x463ca1[_0xaf01('0x21')])]||_0xaf01('0x5');}}catch(_0x12a39d){utils[_0xaf01('0x1c')](_0x12a39d[_0xaf01('0x1d')]);}};exports[_0xaf01('0x24')]=function(_0x77b300){try{if(!_['isNil'](channels[_0x77b300['uniqueid']])){channels[_0x77b300['uniqueid']][_0xaf01('0xf')]='\x22'+_0x77b300[_0xaf01('0x18')]+_0xaf01('0x25')+_0x77b300[_0xaf01('0x26')]+'>';channels[_0x77b300['uniqueid']][_0xaf01('0x27')]=utils[_0xaf01('0x1a')]();channels[_0x77b300[_0xaf01('0x9')]][_0xaf01('0x28')]=utils['diffTime'](channels[_0x77b300[_0xaf01('0x9')]][_0xaf01('0x27')],channels[_0x77b300[_0xaf01('0x9')]][_0xaf01('0x29')]);channels[_0x77b300[_0xaf01('0x9')]]['billableseconds']=channels[_0x77b300[_0xaf01('0x9')]][_0xaf01('0x22')]?utils['diffTime'](channels[_0x77b300[_0xaf01('0x9')]][_0xaf01('0x27')],channels[_0x77b300['uniqueid']][_0xaf01('0x22')]):0x0;writeDB(channels[_0x77b300[_0xaf01('0x9')]]);}}catch(_0x36a861){utils[_0xaf01('0x1c')](_0x36a861['stack']);}};exports[_0xaf01('0x2a')]=function(_0x3d7a9f){try{if(!_['isNil'](channels[_0x3d7a9f[_0xaf01('0x2b')]])){if(channels[_0x3d7a9f[_0xaf01('0x2b')]]['channel']==_0x3d7a9f[_0xaf01('0x2c')]){channels[_0x3d7a9f[_0xaf01('0x2b')]][_0xaf01('0x2d')]=_0x3d7a9f[_0xaf01('0x2e')];channels[_0x3d7a9f[_0xaf01('0x2b')]][_0xaf01('0x2f')]=_0xaf01('0x30');}else if(channels[_0x3d7a9f[_0xaf01('0x2b')]]['channel']=_0x3d7a9f['transfertargetchannel']){channels[_0x3d7a9f['localtwolinkedid']][_0xaf01('0x2d')]=_0x3d7a9f[_0xaf01('0x31')];channels[_0x3d7a9f[_0xaf01('0x2b')]][_0xaf01('0x2f')]='_attended';}}}catch(_0x3e8b5c){utils[_0xaf01('0x1c')](_0x3e8b5c['stack']);}};exports['musiconholdstart']=function(_0x985600){try{if(!_[_0xaf01('0x1f')](channels[_0x985600[_0xaf01('0x9')]])){channels[_0x985600[_0xaf01('0x9')]][_0xaf01('0x32')]=utils[_0xaf01('0x1a')]();}}catch(_0x13d742){utils[_0xaf01('0x1c')](_0x13d742[_0xaf01('0x1d')]);}};exports['musiconholdstop']=function(_0x45bd0d){try{if(!_['isNil'](channels[_0x45bd0d[_0xaf01('0x9')]])){if(!_[_0xaf01('0x1f')](channels[_0x45bd0d['uniqueid']][_0xaf01('0x32')])){channels[_0x45bd0d['uniqueid']][_0xaf01('0x33')]+=utils[_0xaf01('0x34')](utils[_0xaf01('0x1a')](),channels[_0x45bd0d[_0xaf01('0x9')]][_0xaf01('0x32')]);delete channels[_0x45bd0d[_0xaf01('0x9')]][_0xaf01('0x32')];}}}catch(_0x60f52f){utils['error'](_0x60f52f[_0xaf01('0x1d')]);}};exports[_0xaf01('0x35')]=function(_0x531dcc){try{if(!_[_0xaf01('0x1f')](channels[_0x531dcc['uniqueid']])){if(!_['isNil'](_0x531dcc[_0xaf01('0x36')][_0xaf01('0x37')])){channels[_0x531dcc[_0xaf01('0x9')]][_0xaf01('0xd')]=_0x531dcc['value'];}if(!_[_0xaf01('0x1f')](_0x531dcc[_0xaf01('0x36')][_0xaf01('0x38')])){channels[_0x531dcc[_0xaf01('0x9')]][_0xaf01('0xe')]=_0x531dcc[_0xaf01('0x39')];}if(!_['isNil'](_0x531dcc[_0xaf01('0x36')][_0xaf01('0x3a')])||!_['isNil'](_0x531dcc[_0xaf01('0x36')][_0xaf01('0x3b')])){channels[_0x531dcc[_0xaf01('0x9')]][_0xaf01('0xf')]=_0x531dcc[_0xaf01('0x39')];}if(!_[_0xaf01('0x1f')](_0x531dcc[_0xaf01('0x36')][_0xaf01('0x3c')])){channels[_0x531dcc[_0xaf01('0x9')]][_0xaf01('0x3d')]=_0xaf01('0x3e');channels[_0x531dcc[_0xaf01('0x9')]][_0xaf01('0x3f')]=_0x531dcc[_0xaf01('0x39')];channels[_0x531dcc['uniqueid']][_0xaf01('0x40')]=!![];}if(!_[_0xaf01('0x1f')](_0x531dcc[_0xaf01('0x36')]['xmd-contactid'])){channels[_0x531dcc[_0xaf01('0x9')]][_0xaf01('0x41')]=_0x531dcc[_0xaf01('0x39')];}if(!_[_0xaf01('0x1f')](_0x531dcc[_0xaf01('0x36')]['outboundrouteid'])){channels[_0x531dcc[_0xaf01('0x9')]]['routeid']=_0x531dcc['value'];}if(!_[_0xaf01('0x1f')](_0x531dcc[_0xaf01('0x36')][_0xaf01('0x42')])){channels[_0x531dcc[_0xaf01('0x9')]][_0xaf01('0x42')]=_0x531dcc[_0xaf01('0x39')];}}}catch(_0x2db75b){utils[_0xaf01('0x1c')](_0x2db75b[_0xaf01('0x1d')]);}};exports[_0xaf01('0x43')]=function(_0x226e7e){try{if(!_[_0xaf01('0x1f')](channels[_0x226e7e[_0xaf01('0x9')]])){if(_0x226e7e[_0xaf01('0x44')][_0xaf01('0x45')]()==_0xaf01('0x46')&&_[_0xaf01('0x47')](_0x226e7e[_0xaf01('0x48')]['toLowerCase'](),_0xaf01('0x49'))){var _0x28c960=_0x226e7e[_0xaf01('0x48')][_0xaf01('0x4a')]('=');var _0x1d4737=_0x28c960[0x0][_0xaf01('0x4b')](_0x28c960[0x0][_0xaf01('0x4c')]('(')+0x1,_0x28c960[0x0][_0xaf01('0x4c')](')'));var _0x2111bd=_0x28c960[0x1];channels[_0x226e7e['uniqueid']][_0x1d4737]=_0x2111bd;}if(!_[_0xaf01('0x4d')](['hangup','noop',_0xaf01('0x4e'),_0xaf01('0x46'),_0xaf01('0x4f')],_0x226e7e[_0xaf01('0x44')][_0xaf01('0x45')]())){channels[_0x226e7e[_0xaf01('0x9')]][_0xaf01('0x3d')]=_0x226e7e[_0xaf01('0x44')];channels[_0x226e7e[_0xaf01('0x9')]][_0xaf01('0x3f')]=_0x226e7e['appdata'];}}}catch(_0x48b6aa){utils[_0xaf01('0x1c')](_0x48b6aa[_0xaf01('0x1d')]);}}; \ No newline at end of file +var _0xf0c7=['newstate','isNil','systemanswertime','linkedid','channelstate','transfer','destinationchannel','answertime','hangup','calleridname','endtime','diffTime','starttime','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstartAt','musiconholdstop','mohtime','variable','xmd-originatecalleridnum','xmd-phone','value','xmd-callerid-preview','xmd-callerid','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','routeid','sipcallid','application','toLowerCase','set','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','source','destination','callerid','disposition','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','calleridnum','context','now','DOCUMENTATION','error','stack'];(function(_0x6fef13,_0x936c3b){var _0x5f45d4=function(_0xd3f3e7){while(--_0xd3f3e7){_0x6fef13['push'](_0x6fef13['shift']());}};_0x5f45d4(++_0x936c3b);}(_0xf0c7,0xc9));var _0x7f0c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf0c7[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x7f0c('0x0'));var util=require('util');var utils=require(_0x7f0c('0x1'));var dispositions=[_0x7f0c('0x2'),_0x7f0c('0x3'),_0x7f0c('0x3'),_0x7f0c('0x2'),_0x7f0c('0x2'),_0x7f0c('0x2'),_0x7f0c('0x4'),'BUSY',_0x7f0c('0x3'),'FAILED',_0x7f0c('0x3')];var channels={};function writeDB(_0x236529){utils['info'](util[_0x7f0c('0x5')](_0x7f0c('0x6'),_0x236529[_0x7f0c('0x7')],_0x236529[_0x7f0c('0x8')],_0x236529[_0x7f0c('0x9')],_0x236529[_0x7f0c('0xa')],_0x236529[_0x7f0c('0xb')],_0x236529[_0x7f0c('0xc')],_0x236529[_0x7f0c('0xd')],_0x236529[_0x7f0c('0xe')]));if(_0x236529['accountcode']){utils[_0x7f0c('0xf')](_0x236529[_0x7f0c('0xa')])[_0x7f0c('0x10')](function(_0x112920){if(_0x112920){_0x236529[_0x7f0c('0x11')]=_0x112920['id'];}utils['request'](_0x7f0c('0x12'),_0x236529);});}else{utils[_0x7f0c('0x13')](_0x7f0c('0x12'),_0x236529);}if(channels[_0x236529[_0x7f0c('0x7')]]){delete channels[_0x236529['uniqueid']];}}exports[_0x7f0c('0x14')]=function(_0x2f7c6b){try{if(_0x2f7c6b[_0x7f0c('0x7')]==_0x2f7c6b['linkedid']){channels[_0x2f7c6b[_0x7f0c('0x7')]]={'uniqueid':_0x2f7c6b[_0x7f0c('0x7')],'accountcode':_0x2f7c6b[_0x7f0c('0xa')],'source':_0x2f7c6b[_0x7f0c('0x15')],'destination':_0x2f7c6b['exten'],'destinationcontext':_0x2f7c6b[_0x7f0c('0x16')],'channel':_0x2f7c6b[_0x7f0c('0x8')],'starttime':utils[_0x7f0c('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7f0c('0x2'),'amaflags':_0x7f0c('0x18')};}}catch(_0x4583cd){utils[_0x7f0c('0x19')](_0x4583cd[_0x7f0c('0x1a')]);}};exports[_0x7f0c('0x1b')]=function(_0x55d0ab){try{if(!_['isNil'](channels[_0x55d0ab[_0x7f0c('0x7')]])&&_0x55d0ab['channelstate']==0x6){if(_[_0x7f0c('0x1c')](channels[_0x55d0ab[_0x7f0c('0x7')]][_0x7f0c('0x1d')])){channels[_0x55d0ab['uniqueid']][_0x7f0c('0x1d')]=utils[_0x7f0c('0x17')]();}}else if(!_[_0x7f0c('0x1c')](channels[_0x55d0ab[_0x7f0c('0x1e')]])&&_0x55d0ab[_0x7f0c('0x1f')]==0x6&&_0x55d0ab[_0x7f0c('0x16')]!=_0x7f0c('0x20')){channels[_0x55d0ab[_0x7f0c('0x1e')]][_0x7f0c('0xa')]=_0x55d0ab[_0x7f0c('0xa')];channels[_0x55d0ab['linkedid']][_0x7f0c('0x21')]=_0x55d0ab[_0x7f0c('0x8')];if(_[_0x7f0c('0x1c')](channels[_0x55d0ab[_0x7f0c('0x1e')]][_0x7f0c('0x22')])){channels[_0x55d0ab[_0x7f0c('0x1e')]][_0x7f0c('0x22')]=utils[_0x7f0c('0x17')]();}channels[_0x55d0ab[_0x7f0c('0x1e')]][_0x7f0c('0xe')]=dispositions[_['toNumber'](_0x55d0ab['channelstate'])]||_0x7f0c('0x4');}}catch(_0x3d3ef8){utils['error'](_0x3d3ef8[_0x7f0c('0x1a')]);}};exports[_0x7f0c('0x23')]=function(_0x58a000){try{if(!_[_0x7f0c('0x1c')](channels[_0x58a000[_0x7f0c('0x7')]])){channels[_0x58a000['uniqueid']]['callerid']='\x22'+_0x58a000[_0x7f0c('0x15')]+'\x22\x20<'+_0x58a000[_0x7f0c('0x24')]+'>';channels[_0x58a000[_0x7f0c('0x7')]][_0x7f0c('0x25')]=utils[_0x7f0c('0x17')]();channels[_0x58a000[_0x7f0c('0x7')]]['duration']=utils[_0x7f0c('0x26')](channels[_0x58a000['uniqueid']][_0x7f0c('0x25')],channels[_0x58a000[_0x7f0c('0x7')]][_0x7f0c('0x27')]);channels[_0x58a000[_0x7f0c('0x7')]]['billableseconds']=channels[_0x58a000[_0x7f0c('0x7')]][_0x7f0c('0x22')]?utils[_0x7f0c('0x26')](channels[_0x58a000[_0x7f0c('0x7')]]['endtime'],channels[_0x58a000['uniqueid']]['answertime']):0x0;writeDB(channels[_0x58a000[_0x7f0c('0x7')]]);}}catch(_0x1719df){utils[_0x7f0c('0x19')](_0x1719df['stack']);}};exports['attendedtransfer']=function(_0x3b5d02){try{if(!_['isNil'](channels[_0x3b5d02['localtwolinkedid']])){if(channels[_0x3b5d02[_0x7f0c('0x28')]]['channel']==_0x3b5d02['transfereechannel']){channels[_0x3b5d02[_0x7f0c('0x28')]][_0x7f0c('0x21')]=_0x3b5d02[_0x7f0c('0x29')];channels[_0x3b5d02['localtwolinkedid']][_0x7f0c('0x2a')]=_0x7f0c('0x2b');}else if(channels[_0x3b5d02[_0x7f0c('0x28')]][_0x7f0c('0x8')]=_0x3b5d02[_0x7f0c('0x2c')]){channels[_0x3b5d02[_0x7f0c('0x28')]]['destinationchannel']=_0x3b5d02[_0x7f0c('0x2d')];channels[_0x3b5d02[_0x7f0c('0x28')]][_0x7f0c('0x2a')]=_0x7f0c('0x2b');}}}catch(_0x5ea9b8){utils[_0x7f0c('0x19')](_0x5ea9b8[_0x7f0c('0x1a')]);}};exports['musiconholdstart']=function(_0x12fa8d){try{if(!_['isNil'](channels[_0x12fa8d[_0x7f0c('0x7')]])){channels[_0x12fa8d[_0x7f0c('0x7')]][_0x7f0c('0x2e')]=utils[_0x7f0c('0x17')]();}}catch(_0x163cdf){utils[_0x7f0c('0x19')](_0x163cdf['stack']);}};exports[_0x7f0c('0x2f')]=function(_0x57563b){try{if(!_['isNil'](channels[_0x57563b['uniqueid']])){if(!_[_0x7f0c('0x1c')](channels[_0x57563b[_0x7f0c('0x7')]][_0x7f0c('0x2e')])){channels[_0x57563b['uniqueid']][_0x7f0c('0x30')]+=utils['diffTime'](utils[_0x7f0c('0x17')](),channels[_0x57563b[_0x7f0c('0x7')]]['musiconholdstartAt']);delete channels[_0x57563b[_0x7f0c('0x7')]][_0x7f0c('0x2e')];}}}catch(_0x346861){utils[_0x7f0c('0x19')](_0x346861[_0x7f0c('0x1a')]);}};exports['varset']=function(_0x51605c){try{if(!_[_0x7f0c('0x1c')](channels[_0x51605c[_0x7f0c('0x7')]])){if(!_[_0x7f0c('0x1c')](_0x51605c[_0x7f0c('0x31')][_0x7f0c('0x32')])){channels[_0x51605c[_0x7f0c('0x7')]][_0x7f0c('0xb')]=_0x51605c['value'];}if(!_[_0x7f0c('0x1c')](_0x51605c[_0x7f0c('0x31')][_0x7f0c('0x33')])){channels[_0x51605c[_0x7f0c('0x7')]][_0x7f0c('0xc')]=_0x51605c[_0x7f0c('0x34')];}if(!_['isNil'](_0x51605c['variable'][_0x7f0c('0x35')])||!_[_0x7f0c('0x1c')](_0x51605c[_0x7f0c('0x31')][_0x7f0c('0x36')])){channels[_0x51605c['uniqueid']][_0x7f0c('0xd')]=_0x51605c[_0x7f0c('0x34')];}if(!_[_0x7f0c('0x1c')](_0x51605c[_0x7f0c('0x31')][_0x7f0c('0x37')])){channels[_0x51605c[_0x7f0c('0x7')]][_0x7f0c('0x38')]=_0x7f0c('0x39');channels[_0x51605c['uniqueid']][_0x7f0c('0x3a')]=_0x51605c[_0x7f0c('0x34')];channels[_0x51605c['uniqueid']][_0x7f0c('0x3b')]=!![];}if(!_['isNil'](_0x51605c['variable'][_0x7f0c('0x3c')])){channels[_0x51605c[_0x7f0c('0x7')]][_0x7f0c('0x3d')]=_0x51605c[_0x7f0c('0x34')];}if(!_[_0x7f0c('0x1c')](_0x51605c[_0x7f0c('0x31')]['outboundrouteid'])){channels[_0x51605c['uniqueid']][_0x7f0c('0x3e')]=_0x51605c[_0x7f0c('0x34')];}if(!_[_0x7f0c('0x1c')](_0x51605c[_0x7f0c('0x31')][_0x7f0c('0x3f')])){channels[_0x51605c[_0x7f0c('0x7')]][_0x7f0c('0x3f')]=_0x51605c[_0x7f0c('0x34')];}}}catch(_0x474d91){utils[_0x7f0c('0x19')](_0x474d91[_0x7f0c('0x1a')]);}};exports['newexten']=function(_0x4a6b56){try{if(!_['isNil'](channels[_0x4a6b56['uniqueid']])){if(_0x4a6b56[_0x7f0c('0x40')][_0x7f0c('0x41')]()==_0x7f0c('0x42')&&_['startsWith'](_0x4a6b56[_0x7f0c('0x43')][_0x7f0c('0x41')](),_0x7f0c('0x44'))){var _0x1dc9d4=_0x4a6b56[_0x7f0c('0x43')][_0x7f0c('0x45')]('=');var _0xaed84d=_0x1dc9d4[0x0][_0x7f0c('0x46')](_0x1dc9d4[0x0][_0x7f0c('0x47')]('(')+0x1,_0x1dc9d4[0x0]['lastIndexOf'](')'));var _0x4f26ac=_0x1dc9d4[0x1];channels[_0x4a6b56[_0x7f0c('0x7')]][_0xaed84d]=_0x4f26ac;}if(!_[_0x7f0c('0x48')](['hangup',_0x7f0c('0x49'),_0x7f0c('0x4a'),_0x7f0c('0x42'),_0x7f0c('0x4b')],_0x4a6b56['application'][_0x7f0c('0x41')]())){channels[_0x4a6b56[_0x7f0c('0x7')]][_0x7f0c('0x38')]=_0x4a6b56[_0x7f0c('0x40')];channels[_0x4a6b56[_0x7f0c('0x7')]]['lastdata']=_0x4a6b56['appdata'];}}}catch(_0x226196){utils[_0x7f0c('0x19')](_0x226196['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d1296a6..ed1d40a 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 _0x3eea=['info','CONNECTED','shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','managerevent','./utils','connect'];(function(_0x29d849,_0x209ceb){var _0x30b104=function(_0x2a1669){while(--_0x2a1669){_0x29d849['push'](_0x29d849['shift']());}};_0x30b104(++_0x209ceb);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x2c66b9,_0x33a84b){_0x2c66b9=_0x2c66b9-0x0;var _0x1593d0=_0x3eea[_0x2c66b9];return _0x1593d0;};'use strict';var utils=require(_0xa3ee('0x0'));var _=require('lodash');exports[_0xa3ee('0x1')]=function(){utils[_0xa3ee('0x2')](_0xa3ee('0x3'));};exports[_0xa3ee('0x4')]=function(){utils[_0xa3ee('0x2')](_0xa3ee('0x5'));};exports[_0xa3ee('0x6')]=function(){utils[_0xa3ee('0x2')](_0xa3ee('0x7'));};exports[_0xa3ee('0x8')]=function(_0xb93cdb){utils['error'](_0xb93cdb);};exports['close']=function(){utils[_0xa3ee('0x2')]('CLOSE');};exports[_0xa3ee('0x9')]=function(_0x56f37b){}; \ No newline at end of file +var _0x5a5a=['SHUTDOWN','fullybooted','error','CLOSE','managerevent','lodash','connect','info','CONNECTED','shutdown'];(function(_0xca95cd,_0x143af0){var _0x511417=function(_0x1a52c6){while(--_0x1a52c6){_0xca95cd['push'](_0xca95cd['shift']());}};_0x511417(++_0x143af0);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0xb02766,_0xa37d90){_0xb02766=_0xb02766-0x0;var _0x560e6c=_0x5a5a[_0xb02766];return _0x560e6c;};'use strict';var utils=require('./utils');var _=require(_0xa5a5('0x0'));exports[_0xa5a5('0x1')]=function(){utils[_0xa5a5('0x2')](_0xa5a5('0x3'));};exports[_0xa5a5('0x4')]=function(){utils['info'](_0xa5a5('0x5'));};exports[_0xa5a5('0x6')]=function(){utils[_0xa5a5('0x2')]('FULLYBOOTED');};exports['error']=function(_0x43943d){utils[_0xa5a5('0x7')](_0x43943d);};exports['close']=function(){utils[_0xa5a5('0x2')](_0xa5a5('0x8'));};exports[_0xa5a5('0x9')]=function(_0x3a23f4){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c58a285..cac783b 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 _0xf188=['called','dialend','ANSWER','answertime','lastevent','connect','hangup','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','format','uniqueid','channel','connectedlinenum','dialstatus','request','CreateVoiceDialReport','application','toLowerCase','set','startsWith','appdata','split','error','stack','varset','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','now'];(function(_0x494a42,_0x15fe5e){var _0x16f545=function(_0x240612){while(--_0x240612){_0x494a42['push'](_0x494a42['shift']());}};_0x16f545(++_0x15fe5e);}(_0xf188,0xcf));var _0x8f18=function(_0x59907e,_0x5f098d){_0x59907e=_0x59907e-0x0;var _0x400ce9=_0xf188[_0x59907e];return _0x400ce9;};'use strict';var _=require(_0x8f18('0x0'));var util=require(_0x8f18('0x1'));var utils=require(_0x8f18('0x2'));var dials={};function writeDB(_0x59e082){utils['info'](util[_0x8f18('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x59e082[_0x8f18('0x4')],_0x59e082[_0x8f18('0x5')],_0x59e082['dialstring'],_0x59e082['calleridnum'],_0x59e082[_0x8f18('0x6')],_0x59e082[_0x8f18('0x7')]));utils[_0x8f18('0x8')](_0x8f18('0x9'),_0x59e082);delete dials[_0x59e082[_0x8f18('0x4')]];}exports['newexten']=function(_0xe19e33){try{if(_0xe19e33[_0x8f18('0xa')][_0x8f18('0xb')]()==_0x8f18('0xc')&&_[_0x8f18('0xd')](_0xe19e33[_0x8f18('0xe')][_0x8f18('0xb')](),'cdr(routeid)')){var _0x1f4783=_0xe19e33['appdata'][_0x8f18('0xf')]('=');dials[_0xe19e33['uniqueid']]={'routeId':_0x1f4783[0x1]};}}catch(_0x25c5c0){utils[_0x8f18('0x10')](_0x25c5c0[_0x8f18('0x11')]);}};exports[_0x8f18('0x12')]=function(_0x156849){try{if(!_[_0x8f18('0x13')](_0x156849[_0x8f18('0x14')][_0x8f18('0x15')])){dials[_0x156849['uniqueid']]={'routeId':_0x156849[_0x8f18('0x16')]};}}catch(_0x29422a){utils[_0x8f18('0x10')](_0x29422a[_0x8f18('0x11')]);}};exports[_0x8f18('0x17')]=function(_0x157175){try{if(!_[_0x8f18('0x13')](dials[_0x157175['uniqueid']])){dials[_0x157175['uniqueid']]=_[_0x8f18('0x18')](dials[_0x157175['uniqueid']],_0x157175);dials[_0x157175[_0x8f18('0x4')]][_0x8f18('0x19')]=utils[_0x8f18('0x1a')]();dials[_0x157175[_0x8f18('0x4')]]['lastevent']=_0x8f18('0x1b');}}catch(_0x1ca785){utils['error'](_0x1ca785[_0x8f18('0x11')]);}};exports[_0x8f18('0x1c')]=function(_0x56b3e4){try{if(!_[_0x8f18('0x13')](dials[_0x56b3e4[_0x8f18('0x4')]])){dials[_0x56b3e4[_0x8f18('0x4')]]['dialstatus']=_0x56b3e4['dialstatus'];if(_0x56b3e4[_0x8f18('0x7')]==_0x8f18('0x1d')){dials[_0x56b3e4[_0x8f18('0x4')]]=_[_0x8f18('0x18')](dials[_0x56b3e4['uniqueid']],_0x56b3e4);dials[_0x56b3e4[_0x8f18('0x4')]][_0x8f18('0x1e')]=utils[_0x8f18('0x1a')]();dials[_0x56b3e4[_0x8f18('0x4')]][_0x8f18('0x1f')]=_0x8f18('0x20');}}}catch(_0x27a024){utils['error'](_0x27a024[_0x8f18('0x11')]);}};exports[_0x8f18('0x21')]=function(_0x562afa){try{if(!_[_0x8f18('0x13')](dials[_0x562afa[_0x8f18('0x4')]])){dials[_0x562afa[_0x8f18('0x4')]]=_[_0x8f18('0x18')](dials[_0x562afa[_0x8f18('0x4')]],{'endtime':utils[_0x8f18('0x1a')](),'lastevent':'complete'});dials[_0x562afa[_0x8f18('0x4')]][_0x8f18('0x22')]=utils[_0x8f18('0x23')](dials[_0x562afa['uniqueid']][_0x8f18('0x24')],dials[_0x562afa[_0x8f18('0x4')]]['starttime']);dials[_0x562afa['uniqueid']][_0x8f18('0x25')]=utils['diffTime'](dials[_0x562afa[_0x8f18('0x4')]][_0x8f18('0x1e')]||dials[_0x562afa['uniqueid']][_0x8f18('0x24')],dials[_0x562afa[_0x8f18('0x4')]][_0x8f18('0x19')]);dials[_0x562afa[_0x8f18('0x4')]][_0x8f18('0x26')]=dials[_0x562afa[_0x8f18('0x4')]][_0x8f18('0x1e')]?utils[_0x8f18('0x23')](dials[_0x562afa[_0x8f18('0x4')]][_0x8f18('0x24')],dials[_0x562afa[_0x8f18('0x4')]][_0x8f18('0x1e')]):0x0;writeDB(dials[_0x562afa[_0x8f18('0x4')]]);}}catch(_0x460735){utils[_0x8f18('0x10')](_0x460735[_0x8f18('0x11')]);}}; \ No newline at end of file +var _0xace2=['newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','isNil','variable','outboundrouteid','value','stack','dialbegin','starttime','now','called','dialend','ANSWER','answertime','hangup','assign','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xace2,0xb9));var _0x2ace=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0xace2[_0x255c48];return _0xaebda3;};'use strict';var _=require(_0x2ace('0x0'));var util=require(_0x2ace('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x27ade5){utils['info'](util[_0x2ace('0x2')](_0x2ace('0x3'),_0x27ade5[_0x2ace('0x4')],_0x27ade5[_0x2ace('0x5')],_0x27ade5['dialstring'],_0x27ade5[_0x2ace('0x6')],_0x27ade5[_0x2ace('0x7')],_0x27ade5[_0x2ace('0x8')]));utils[_0x2ace('0x9')]('CreateVoiceDialReport',_0x27ade5);delete dials[_0x27ade5[_0x2ace('0x4')]];}exports[_0x2ace('0xa')]=function(_0x4a0a2c){try{if(_0x4a0a2c[_0x2ace('0xb')][_0x2ace('0xc')]()==_0x2ace('0xd')&&_[_0x2ace('0xe')](_0x4a0a2c[_0x2ace('0xf')][_0x2ace('0xc')](),_0x2ace('0x10'))){var _0x493b68=_0x4a0a2c[_0x2ace('0xf')][_0x2ace('0x11')]('=');dials[_0x4a0a2c[_0x2ace('0x4')]]={'routeId':_0x493b68[0x1]};}}catch(_0x167a71){utils[_0x2ace('0x12')](_0x167a71['stack']);}};exports['varset']=function(_0x542a5a){try{if(!_[_0x2ace('0x13')](_0x542a5a[_0x2ace('0x14')][_0x2ace('0x15')])){dials[_0x542a5a[_0x2ace('0x4')]]={'routeId':_0x542a5a[_0x2ace('0x16')]};}}catch(_0x4526bf){utils[_0x2ace('0x12')](_0x4526bf[_0x2ace('0x17')]);}};exports[_0x2ace('0x18')]=function(_0x2ea4b1){try{if(!_[_0x2ace('0x13')](dials[_0x2ea4b1[_0x2ace('0x4')]])){dials[_0x2ea4b1[_0x2ace('0x4')]]=_['assign'](dials[_0x2ea4b1[_0x2ace('0x4')]],_0x2ea4b1);dials[_0x2ea4b1[_0x2ace('0x4')]][_0x2ace('0x19')]=utils[_0x2ace('0x1a')]();dials[_0x2ea4b1[_0x2ace('0x4')]]['lastevent']=_0x2ace('0x1b');}}catch(_0x10e9f3){utils['error'](_0x10e9f3['stack']);}};exports[_0x2ace('0x1c')]=function(_0x1404ef){try{if(!_[_0x2ace('0x13')](dials[_0x1404ef[_0x2ace('0x4')]])){dials[_0x1404ef['uniqueid']][_0x2ace('0x8')]=_0x1404ef[_0x2ace('0x8')];if(_0x1404ef[_0x2ace('0x8')]==_0x2ace('0x1d')){dials[_0x1404ef[_0x2ace('0x4')]]=_['assign'](dials[_0x1404ef[_0x2ace('0x4')]],_0x1404ef);dials[_0x1404ef[_0x2ace('0x4')]][_0x2ace('0x1e')]=utils[_0x2ace('0x1a')]();dials[_0x1404ef[_0x2ace('0x4')]]['lastevent']='connect';}}}catch(_0x2119e2){utils[_0x2ace('0x12')](_0x2119e2[_0x2ace('0x17')]);}};exports[_0x2ace('0x1f')]=function(_0x56d7bf){try{if(!_[_0x2ace('0x13')](dials[_0x56d7bf[_0x2ace('0x4')]])){dials[_0x56d7bf[_0x2ace('0x4')]]=_[_0x2ace('0x20')](dials[_0x56d7bf[_0x2ace('0x4')]],{'endtime':utils[_0x2ace('0x1a')](),'lastevent':_0x2ace('0x21')});dials[_0x56d7bf[_0x2ace('0x4')]][_0x2ace('0x22')]=utils[_0x2ace('0x23')](dials[_0x56d7bf[_0x2ace('0x4')]][_0x2ace('0x24')],dials[_0x56d7bf[_0x2ace('0x4')]][_0x2ace('0x19')]);dials[_0x56d7bf['uniqueid']][_0x2ace('0x25')]=utils[_0x2ace('0x23')](dials[_0x56d7bf[_0x2ace('0x4')]][_0x2ace('0x1e')]||dials[_0x56d7bf[_0x2ace('0x4')]][_0x2ace('0x24')],dials[_0x56d7bf[_0x2ace('0x4')]][_0x2ace('0x19')]);dials[_0x56d7bf[_0x2ace('0x4')]][_0x2ace('0x26')]=dials[_0x56d7bf[_0x2ace('0x4')]][_0x2ace('0x1e')]?utils[_0x2ace('0x23')](dials[_0x56d7bf[_0x2ace('0x4')]][_0x2ace('0x24')],dials[_0x56d7bf[_0x2ace('0x4')]][_0x2ace('0x1e')]):0x0;writeDB(dials[_0x56d7bf['uniqueid']]);}}catch(_0x42d5ed){utils['error'](_0x42d5ed[_0x2ace('0x17')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 85ceeff..58d35be 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 _0xd8b0=['newexten','newchannel','dialbegin','asterisk-manager','../../config/environment','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','port','asterisk','password','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};var AsteriskManager=require(_0x0d8b('0x0'));var config=require(_0x0d8b('0x1'));var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x0d8b('0x2'));var members=require(_0x0d8b('0x3'));var dials=require(_0x0d8b('0x4'));var transfers=require(_0x0d8b('0x5'));var core=require(_0x0d8b('0x6'));var utils=require('./utils');var ami=new AsteriskManager(config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x8')]['ip'],config[_0x0d8b('0x8')]['username'],config[_0x0d8b('0x8')][_0x0d8b('0x9')],!![]);ami['keepConnected']();ami['on'](_0x0d8b('0xa'),core[_0x0d8b('0xa')]);ami['on'](_0x0d8b('0xb'),core[_0x0d8b('0xb')]);ami['on'](_0x0d8b('0xc'),core[_0x0d8b('0xc')]);ami['on'](_0x0d8b('0xd'),core[_0x0d8b('0xd')]);ami['on']('close',core[_0x0d8b('0xe')]);ami['on']('managerevent',core[_0x0d8b('0xf')]);ami['on'](_0x0d8b('0x10'),function(_0x340cc4){try{members[_0x0d8b('0x10')](_0x340cc4);}catch(_0x35a07b){utils[_0x0d8b('0xd')](_0x35a07b);}});ami['on'](_0x0d8b('0x11'),function(_0x31a8cc){try{agents[_0x0d8b('0x11')](_0x31a8cc);}catch(_0x2ce75e){utils[_0x0d8b('0xd')](_0x2ce75e);}});ami['on'](_0x0d8b('0x12'),function(_0x1567ce){try{agents[_0x0d8b('0x12')](_0x1567ce);}catch(_0x4f6f21){utils[_0x0d8b('0xd')](_0x4f6f21);}});ami['on'](_0x0d8b('0x13'),function(_0x17f7df){try{agents[_0x0d8b('0x13')](_0x17f7df);queues[_0x0d8b('0x13')](_0x17f7df);}catch(_0x5cd485){utils[_0x0d8b('0xd')](_0x5cd485);}});ami['on'](_0x0d8b('0x14'),function(_0x2fd0fc){try{agents[_0x0d8b('0x14')](_0x2fd0fc);queues[_0x0d8b('0x14')](_0x2fd0fc);members[_0x0d8b('0x14')](_0x2fd0fc);}catch(_0x264b39){utils[_0x0d8b('0xd')](_0x264b39);}});ami['on']('queuecallerabandon',function(_0x27512e){try{agents[_0x0d8b('0x15')](_0x27512e);queues[_0x0d8b('0x15')](_0x27512e);}catch(_0x143372){utils[_0x0d8b('0xd')](_0x143372);}});ami['on'](_0x0d8b('0x16'),function(_0x393beb){try{queues[_0x0d8b('0x16')](_0x393beb);recordings['queuecallerjoin'](_0x393beb);}catch(_0x4f0a1a){utils[_0x0d8b('0xd')](_0x4f0a1a);}});ami['on']('queuecallerleave',function(_0x56c729){try{queues['queuecallerleave'](_0x56c729);}catch(_0x238728){utils[_0x0d8b('0xd')](_0x238728);}});ami['on'](_0x0d8b('0x17'),function(_0x38efc8){try{queues[_0x0d8b('0x17')](_0x38efc8);calls[_0x0d8b('0x17')](_0x38efc8);}catch(_0x30980c){utils[_0x0d8b('0xd')](_0x30980c);}});ami['on'](_0x0d8b('0x18'),function(_0x5e5bc3){try{queues[_0x0d8b('0x18')](_0x5e5bc3);calls[_0x0d8b('0x18')](_0x5e5bc3);}catch(_0x5363e3){utils[_0x0d8b('0xd')](_0x5363e3);}});ami['on']('newstate',function(_0x3dd149){try{calls[_0x0d8b('0x19')](_0x3dd149);recordings[_0x0d8b('0x19')](_0x3dd149);}catch(_0x4fe6f9){utils['error'](_0x4fe6f9);}});ami['on'](_0x0d8b('0x1a'),function(_0x3ef745){try{calls['hangup'](_0x3ef745);recordings[_0x0d8b('0x1a')](_0x3ef745);dials['hangup'](_0x3ef745);agents[_0x0d8b('0x1a')](_0x3ef745);queues['hangup'](_0x3ef745);}catch(_0x97050a){utils['error'](_0x97050a);}});ami['on'](_0x0d8b('0x1b'),function(_0x546bf6){try{members[_0x0d8b('0x1b')](_0x546bf6);}catch(_0x544735){utils[_0x0d8b('0xd')](_0x544735);}});ami['on'](_0x0d8b('0x1c'),function(_0x2c058d){try{queues['blindtransfer'](_0x2c058d);agents['blindtransfer'](_0x2c058d);transfers['blindtransfer'](_0x2c058d);}catch(_0x4e8992){utils['error'](_0x4e8992);}});ami['on'](_0x0d8b('0x1d'),function(_0x54f6f3){try{queues['attendedtransfer'](_0x54f6f3);transfers[_0x0d8b('0x1d')](_0x54f6f3);agents[_0x0d8b('0x1d')](_0x54f6f3);calls[_0x0d8b('0x1d')](_0x54f6f3);}catch(_0xdeee5d){utils[_0x0d8b('0xd')](_0xdeee5d);}});ami['on'](_0x0d8b('0x1e'),function(_0x4a99d3){try{queues[_0x0d8b('0x1e')](_0x4a99d3);recordings['varset'](_0x4a99d3);calls[_0x0d8b('0x1e')](_0x4a99d3);dials[_0x0d8b('0x1e')](_0x4a99d3);}catch(_0x4b3ea0){utils[_0x0d8b('0xd')](_0x4b3ea0);}});ami['on'](_0x0d8b('0x1f'),function(_0x18a905){try{calls['newexten'](_0x18a905);recordings[_0x0d8b('0x1f')](_0x18a905);dials[_0x0d8b('0x1f')](_0x18a905);}catch(_0x206157){utils[_0x0d8b('0xd')](_0x206157);}});ami['on'](_0x0d8b('0x20'),function(_0x55d742){try{calls[_0x0d8b('0x20')](_0x55d742);recordings[_0x0d8b('0x20')](_0x55d742);}catch(_0x5ad0fe){utils[_0x0d8b('0xd')](_0x5ad0fe);}});ami['on'](_0x0d8b('0x21'),function(_0x188af2){try{dials[_0x0d8b('0x21')](_0x188af2);}catch(_0x373544){utils['error'](_0x373544);}});ami['on']('dialend',function(_0x41b4f9){try{dials['dialend'](_0x41b4f9);}catch(_0x531c55){utils[_0x0d8b('0xd')](_0x531c55);}}); \ No newline at end of file +var _0xd8b0=['newexten','newchannel','dialbegin','asterisk-manager','../../config/environment','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','port','asterisk','password','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};var AsteriskManager=require(_0x0d8b('0x0'));var config=require(_0x0d8b('0x1'));var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x0d8b('0x2'));var members=require(_0x0d8b('0x3'));var dials=require(_0x0d8b('0x4'));var transfers=require(_0x0d8b('0x5'));var core=require(_0x0d8b('0x6'));var utils=require('./utils');var ami=new AsteriskManager(config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x8')]['ip'],config[_0x0d8b('0x8')]['username'],config[_0x0d8b('0x8')][_0x0d8b('0x9')],!![]);ami['keepConnected']();ami['on'](_0x0d8b('0xa'),core[_0x0d8b('0xa')]);ami['on'](_0x0d8b('0xb'),core[_0x0d8b('0xb')]);ami['on'](_0x0d8b('0xc'),core[_0x0d8b('0xc')]);ami['on'](_0x0d8b('0xd'),core[_0x0d8b('0xd')]);ami['on']('close',core[_0x0d8b('0xe')]);ami['on']('managerevent',core[_0x0d8b('0xf')]);ami['on'](_0x0d8b('0x10'),function(_0x340cc4){try{members[_0x0d8b('0x10')](_0x340cc4);}catch(_0x35a07b){utils[_0x0d8b('0xd')](_0x35a07b);}});ami['on'](_0x0d8b('0x11'),function(_0x31a8cc){try{agents[_0x0d8b('0x11')](_0x31a8cc);}catch(_0x2ce75e){utils[_0x0d8b('0xd')](_0x2ce75e);}});ami['on'](_0x0d8b('0x12'),function(_0x1567ce){try{agents[_0x0d8b('0x12')](_0x1567ce);}catch(_0x4f6f21){utils[_0x0d8b('0xd')](_0x4f6f21);}});ami['on'](_0x0d8b('0x13'),function(_0x17f7df){try{agents[_0x0d8b('0x13')](_0x17f7df);queues[_0x0d8b('0x13')](_0x17f7df);}catch(_0x5cd485){utils[_0x0d8b('0xd')](_0x5cd485);}});ami['on'](_0x0d8b('0x14'),function(_0x2fd0fc){try{agents[_0x0d8b('0x14')](_0x2fd0fc);queues[_0x0d8b('0x14')](_0x2fd0fc);members[_0x0d8b('0x14')](_0x2fd0fc);}catch(_0x264b39){utils[_0x0d8b('0xd')](_0x264b39);}});ami['on']('queuecallerabandon',function(_0x27512e){try{agents[_0x0d8b('0x15')](_0x27512e);queues[_0x0d8b('0x15')](_0x27512e);}catch(_0x143372){utils[_0x0d8b('0xd')](_0x143372);}});ami['on'](_0x0d8b('0x16'),function(_0x393beb){try{queues[_0x0d8b('0x16')](_0x393beb);recordings['queuecallerjoin'](_0x393beb);}catch(_0x4f0a1a){utils[_0x0d8b('0xd')](_0x4f0a1a);}});ami['on']('queuecallerleave',function(_0x56c729){try{queues['queuecallerleave'](_0x56c729);}catch(_0x238728){utils[_0x0d8b('0xd')](_0x238728);}});ami['on'](_0x0d8b('0x17'),function(_0x38efc8){try{queues[_0x0d8b('0x17')](_0x38efc8);calls[_0x0d8b('0x17')](_0x38efc8);}catch(_0x30980c){utils[_0x0d8b('0xd')](_0x30980c);}});ami['on'](_0x0d8b('0x18'),function(_0x5e5bc3){try{queues[_0x0d8b('0x18')](_0x5e5bc3);calls[_0x0d8b('0x18')](_0x5e5bc3);}catch(_0x5363e3){utils[_0x0d8b('0xd')](_0x5363e3);}});ami['on']('newstate',function(_0x3dd149){try{calls[_0x0d8b('0x19')](_0x3dd149);recordings[_0x0d8b('0x19')](_0x3dd149);}catch(_0x4fe6f9){utils['error'](_0x4fe6f9);}});ami['on'](_0x0d8b('0x1a'),function(_0x3ef745){try{calls['hangup'](_0x3ef745);recordings[_0x0d8b('0x1a')](_0x3ef745);dials['hangup'](_0x3ef745);agents[_0x0d8b('0x1a')](_0x3ef745);queues['hangup'](_0x3ef745);}catch(_0x97050a){utils['error'](_0x97050a);}});ami['on'](_0x0d8b('0x1b'),function(_0x546bf6){try{members[_0x0d8b('0x1b')](_0x546bf6);}catch(_0x544735){utils[_0x0d8b('0xd')](_0x544735);}});ami['on'](_0x0d8b('0x1c'),function(_0x2c058d){try{queues['blindtransfer'](_0x2c058d);agents['blindtransfer'](_0x2c058d);transfers['blindtransfer'](_0x2c058d);}catch(_0x4e8992){utils['error'](_0x4e8992);}});ami['on'](_0x0d8b('0x1d'),function(_0x54f6f3){try{queues['attendedtransfer'](_0x54f6f3);transfers[_0x0d8b('0x1d')](_0x54f6f3);agents[_0x0d8b('0x1d')](_0x54f6f3);calls[_0x0d8b('0x1d')](_0x54f6f3);}catch(_0xdeee5d){utils[_0x0d8b('0xd')](_0xdeee5d);}});ami['on'](_0x0d8b('0x1e'),function(_0x4a99d3){try{queues[_0x0d8b('0x1e')](_0x4a99d3);recordings['varset'](_0x4a99d3);calls[_0x0d8b('0x1e')](_0x4a99d3);dials[_0x0d8b('0x1e')](_0x4a99d3);}catch(_0x4b3ea0){utils[_0x0d8b('0xd')](_0x4b3ea0);}});ami['on'](_0x0d8b('0x1f'),function(_0x18a905){try{calls['newexten'](_0x18a905);recordings[_0x0d8b('0x1f')](_0x18a905);dials[_0x0d8b('0x1f')](_0x18a905);}catch(_0x206157){utils[_0x0d8b('0xd')](_0x206157);}});ami['on'](_0x0d8b('0x20'),function(_0x55d742){try{calls[_0x0d8b('0x20')](_0x55d742);recordings[_0x0d8b('0x20')](_0x55d742);}catch(_0x5ad0fe){utils[_0x0d8b('0xd')](_0x5ad0fe);}});ami['on'](_0x0d8b('0x21'),function(_0x188af2){try{dials[_0x0d8b('0x21')](_0x188af2);}catch(_0x373544){utils['error'](_0x373544);}});ami['on']('dialend',function(_0x41b4f9){try{dials['dialend'](_0x41b4f9);}catch(_0x531c55){utils[_0x0d8b('0xd')](_0x531c55);}}); \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ecde726..83862b6 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 _0x5ab4=['channel','data2','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','membername','request','catch','some','startsWith','devicestatechange','state','INUSE','device','TALKING','now','NOT_INUSE','exitAt','duration','diffTime','agentcomplete','isNil','assign','queue','cdr','data1','destination','destinationchannel','source','data3','util','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface'];(function(_0x4cdaee,_0x307ea3){var _0x447826=function(_0x4bdbd1){while(--_0x4bdbd1){_0x4cdaee['push'](_0x4cdaee['shift']());}};_0x447826(++_0x307ea3);}(_0x5ab4,0xa1));var _0x45ab=function(_0x14af1c,_0x5f4e93){_0x14af1c=_0x14af1c-0x0;var _0x3e8bf5=_0x5ab4[_0x14af1c];return _0x3e8bf5;};'use strict';var _=require('lodash');var util=require(_0x45ab('0x0'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0x45ab('0x1')];function writeDB(_0x234cbf){utils[_0x45ab('0x2')](util[_0x45ab('0x3')](_0x45ab('0x4'),_0x234cbf[_0x45ab('0x5')],_0x234cbf[_0x45ab('0x6')],_0x234cbf[_0x45ab('0x7')],_0x234cbf[_0x45ab('0x8')],_0x234cbf['membername'],_0x234cbf[_0x45ab('0x9')]));if(_0x234cbf[_0x45ab('0x6')]){utils[_0x45ab('0xa')](_0x234cbf[_0x45ab('0x6')])[_0x45ab('0xb')](function(_0xf83750){if(_0xf83750){_0x234cbf['membername']=_0xf83750[_0x45ab('0xc')];_0x234cbf[_0x45ab('0xd')]=_0xf83750['internal'];utils['request'](_0x45ab('0xe'),_0x234cbf);}else{utils[_0x45ab('0xf')](_0x234cbf[_0x45ab('0x6')][_0x45ab('0x10')]('/')[0x1])[_0x45ab('0xb')](function(_0x2e52e1){if(_0x2e52e1){_0x234cbf[_0x45ab('0x11')]=_0x2e52e1['name'];_0x234cbf[_0x45ab('0xd')]=_0x2e52e1[_0x45ab('0xd')];utils[_0x45ab('0x12')]('CreateMemberReport',_0x234cbf);}});}})[_0x45ab('0x13')](function(_0x2973cb){utils['error'](_0x2973cb);});}delete members[_0x234cbf[_0x45ab('0x6')]];}function startsWith(_0x2664f0,_0x7f4ba3){return _[_0x45ab('0x14')](_0x2664f0,function(_0x36a4d3){return _[_0x45ab('0x15')](_0x7f4ba3,_0x36a4d3);});}exports[_0x45ab('0x16')]=function(_0x2df0c0){switch(_0x2df0c0[_0x45ab('0x17')]){case _0x45ab('0x18'):case'BUSY':if(!startsWith(exclude,_0x2df0c0[_0x45ab('0x19')])){members[_0x2df0c0[_0x45ab('0x19')]]={'channel':'voice','interface':_0x2df0c0[_0x45ab('0x19')],'type':_0x45ab('0x1a'),'enterAt':utils[_0x45ab('0x1b')](),'role':'agent'};}break;case _0x45ab('0x1c'):if(!_['isNil'](members[_0x2df0c0['device']])){members[_0x2df0c0[_0x45ab('0x19')]][_0x45ab('0x1d')]=utils['now']();members[_0x2df0c0[_0x45ab('0x19')]][_0x45ab('0x1e')]=utils[_0x45ab('0x1f')](members[_0x2df0c0['device']]['exitAt'],members[_0x2df0c0['device']]['enterAt']);if(members[_0x2df0c0[_0x45ab('0x19')]]['uniqueid']){writeDB(members[_0x2df0c0[_0x45ab('0x19')]]);}}default:break;}};exports[_0x45ab('0x20')]=function(_0x3bd46b){if(!_[_0x45ab('0x21')](members[_0x3bd46b['interface']])){members[_0x3bd46b[_0x45ab('0x6')]]=_[_0x45ab('0x22')](members[_0x3bd46b[_0x45ab('0x6')]],{'data4':_0x3bd46b[_0x45ab('0x23')],'uniqueid':_0x3bd46b['uniqueid']});}};exports[_0x45ab('0x24')]=function(_0x5a2875){if(_0x5a2875[_0x45ab('0x7')]){var _0x2775fb=_0x5a2875[_0x45ab('0x7')][_0x45ab('0x10')]('-')[0x0];if(!_[_0x45ab('0x21')](members[_0x2775fb])){members[_0x2775fb]=_['assign'](members[_0x2775fb],{'data1':members[_0x2775fb][_0x45ab('0x25')]||_0x5a2875[_0x45ab('0x9')],'data2':members[_0x2775fb][_0x45ab('0x8')]||_0x5a2875['source'],'data3':members[_0x2775fb]['data3']||_0x5a2875[_0x45ab('0x26')],'uniqueid':members[_0x2775fb][_0x45ab('0x5')]||_0x5a2875[_0x45ab('0x5')]});if(members[_0x2775fb][_0x45ab('0x1d')]){writeDB(members[_0x2775fb]);}}}if(_0x5a2875[_0x45ab('0x27')]){var _0x401022=_0x5a2875[_0x45ab('0x27')]['split']('-')[0x0];if(!_[_0x45ab('0x21')](members[_0x401022])){members[_0x401022]=_[_0x45ab('0x22')](members[_0x401022],{'data1':members[_0x401022][_0x45ab('0x25')]||_0x5a2875['type'],'data2':members[_0x401022][_0x45ab('0x8')]||_0x5a2875[_0x45ab('0x28')],'data3':members[_0x401022][_0x45ab('0x29')]||_0x5a2875[_0x45ab('0x26')],'uniqueid':members[_0x401022][_0x45ab('0x5')]||_0x5a2875[_0x45ab('0x5')]});if(members[_0x401022][_0x45ab('0x1d')]){writeDB(members[_0x401022]);}}}}; \ No newline at end of file +var _0x7c0f=['agentcomplete','queue','cdr','assign','data1','source','data3','destination','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','channel','data2','type','interface','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','some','startsWith','devicestatechange','INUSE','BUSY','device','voice','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt'];(function(_0xc0038b,_0x368bff){var _0x4a0358=function(_0x19673e){while(--_0x19673e){_0xc0038b['push'](_0xc0038b['shift']());}};_0x4a0358(++_0x368bff);}(_0x7c0f,0x1a7));var _0xf7c0=function(_0x2501f0,_0x30a6df){_0x2501f0=_0x2501f0-0x0;var _0x53c30e=_0x7c0f[_0x2501f0];return _0x53c30e;};'use strict';var _=require(_0xf7c0('0x0'));var util=require(_0xf7c0('0x1'));var utils=require(_0xf7c0('0x2'));var members={};var exclude=[_0xf7c0('0x3'),_0xf7c0('0x4')];function writeDB(_0x38df8d){utils[_0xf7c0('0x5')](util[_0xf7c0('0x6')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x38df8d[_0xf7c0('0x7')],_0x38df8d['interface'],_0x38df8d[_0xf7c0('0x8')],_0x38df8d[_0xf7c0('0x9')],_0x38df8d['membername'],_0x38df8d[_0xf7c0('0xa')]));if(_0x38df8d[_0xf7c0('0xb')]){utils[_0xf7c0('0xc')](_0x38df8d[_0xf7c0('0xb')])[_0xf7c0('0xd')](function(_0x4e2813){if(_0x4e2813){_0x38df8d[_0xf7c0('0xe')]=_0x4e2813[_0xf7c0('0xf')];_0x38df8d[_0xf7c0('0x10')]=_0x4e2813[_0xf7c0('0x10')];utils[_0xf7c0('0x11')](_0xf7c0('0x12'),_0x38df8d);}else{utils[_0xf7c0('0x13')](_0x38df8d[_0xf7c0('0xb')][_0xf7c0('0x14')]('/')[0x1])[_0xf7c0('0xd')](function(_0xb071bd){if(_0xb071bd){_0x38df8d[_0xf7c0('0xe')]=_0xb071bd['name'];_0x38df8d[_0xf7c0('0x10')]=_0xb071bd['internal'];utils[_0xf7c0('0x11')](_0xf7c0('0x12'),_0x38df8d);}});}})[_0xf7c0('0x15')](function(_0x3dfe32){utils[_0xf7c0('0x16')](_0x3dfe32);});}delete members[_0x38df8d[_0xf7c0('0xb')]];}function startsWith(_0x951603,_0xc8c470){return _[_0xf7c0('0x17')](_0x951603,function(_0x1eb691){return _[_0xf7c0('0x18')](_0xc8c470,_0x1eb691);});}exports[_0xf7c0('0x19')]=function(_0x3d9bdb){switch(_0x3d9bdb['state']){case _0xf7c0('0x1a'):case _0xf7c0('0x1b'):if(!startsWith(exclude,_0x3d9bdb[_0xf7c0('0x1c')])){members[_0x3d9bdb[_0xf7c0('0x1c')]]={'channel':_0xf7c0('0x1d'),'interface':_0x3d9bdb[_0xf7c0('0x1c')],'type':'TALKING','enterAt':utils[_0xf7c0('0x1e')](),'role':'agent'};}break;case _0xf7c0('0x1f'):if(!_[_0xf7c0('0x20')](members[_0x3d9bdb[_0xf7c0('0x1c')]])){members[_0x3d9bdb[_0xf7c0('0x1c')]][_0xf7c0('0x21')]=utils['now']();members[_0x3d9bdb['device']][_0xf7c0('0x22')]=utils[_0xf7c0('0x23')](members[_0x3d9bdb[_0xf7c0('0x1c')]][_0xf7c0('0x21')],members[_0x3d9bdb[_0xf7c0('0x1c')]][_0xf7c0('0x24')]);if(members[_0x3d9bdb[_0xf7c0('0x1c')]][_0xf7c0('0x7')]){writeDB(members[_0x3d9bdb[_0xf7c0('0x1c')]]);}}default:break;}};exports[_0xf7c0('0x25')]=function(_0x2d804d){if(!_[_0xf7c0('0x20')](members[_0x2d804d['interface']])){members[_0x2d804d[_0xf7c0('0xb')]]=_['assign'](members[_0x2d804d[_0xf7c0('0xb')]],{'data4':_0x2d804d[_0xf7c0('0x26')],'uniqueid':_0x2d804d[_0xf7c0('0x7')]});}};exports[_0xf7c0('0x27')]=function(_0x35cf9c){if(_0x35cf9c[_0xf7c0('0x8')]){var _0x3fdbb0=_0x35cf9c[_0xf7c0('0x8')][_0xf7c0('0x14')]('-')[0x0];if(!_['isNil'](members[_0x3fdbb0])){members[_0x3fdbb0]=_[_0xf7c0('0x28')](members[_0x3fdbb0],{'data1':members[_0x3fdbb0][_0xf7c0('0x29')]||_0x35cf9c['type'],'data2':members[_0x3fdbb0]['data2']||_0x35cf9c[_0xf7c0('0x2a')],'data3':members[_0x3fdbb0][_0xf7c0('0x2b')]||_0x35cf9c[_0xf7c0('0x2c')],'uniqueid':members[_0x3fdbb0][_0xf7c0('0x7')]||_0x35cf9c[_0xf7c0('0x7')]});if(members[_0x3fdbb0]['exitAt']){writeDB(members[_0x3fdbb0]);}}}if(_0x35cf9c['destinationchannel']){var _0x3ac4d2=_0x35cf9c[_0xf7c0('0x2d')]['split']('-')[0x0];if(!_[_0xf7c0('0x20')](members[_0x3ac4d2])){members[_0x3ac4d2]=_[_0xf7c0('0x28')](members[_0x3ac4d2],{'data1':members[_0x3ac4d2]['data1']||_0x35cf9c[_0xf7c0('0xa')],'data2':members[_0x3ac4d2][_0xf7c0('0x9')]||_0x35cf9c['source'],'data3':members[_0x3ac4d2][_0xf7c0('0x2b')]||_0x35cf9c[_0xf7c0('0x2c')],'uniqueid':members[_0x3ac4d2][_0xf7c0('0x7')]||_0x35cf9c[_0xf7c0('0x7')]});if(members[_0x3ac4d2][_0xf7c0('0x21')]){writeDB(members[_0x3ac4d2]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 67ca6f4..a30aecc 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 _0xc4f0=['EXITWITHKEY','diffTime','queuecallerjoinAt','position','count','connectedlinename','agentconnect','assigned','agentcomplete','membername','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','BLINDTRANSFER','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','origtransfereruniqueid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','secondtransfereruniqueid','transferexten','transfertargetlinkedid','error','stack','musiconholdstart','musiconholdstartAt','lodash','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','now','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','queuecallerenterreason','varset','variable','queuestatus','queuecallerabandon','queuecallerabandonAt','value','queueposition','queuecallerexitAt'];(function(_0x114429,_0x4a15f7){var _0x28f0fa=function(_0xa29c5f){while(--_0xa29c5f){_0x114429['push'](_0x114429['shift']());}};_0x28f0fa(++_0x4a15f7);}(_0xc4f0,0xbd));var _0x0c4f=function(_0x5efa28,_0x131b69){_0x5efa28=_0x5efa28-0x0;var _0x43c6bf=_0xc4f0[_0x5efa28];return _0x43c6bf;};'use strict';var _=require(_0x0c4f('0x0'));var util=require('util');var utils=require(_0x0c4f('0x1'));var queues={};function writeDB(_0xde47ee){utils[_0x0c4f('0x2')](util[_0x0c4f('0x3')](_0x0c4f('0x4'),_0xde47ee[_0x0c4f('0x5')],_0xde47ee[_0x0c4f('0x6')],_0xde47ee[_0x0c4f('0x7')],_0xde47ee[_0x0c4f('0x8')],_0xde47ee[_0x0c4f('0x9')],_0xde47ee[_0x0c4f('0xa')],_0xde47ee[_0x0c4f('0xb')]));if(_0xde47ee[_0x0c4f('0x7')]){utils[_0x0c4f('0xc')](_0xde47ee[_0x0c4f('0x7')])[_0x0c4f('0xd')](function(_0x3c47aa){if(_0x3c47aa){_0xde47ee[_0x0c4f('0xe')]=_0x3c47aa[_0x0c4f('0xe')];}utils[_0x0c4f('0xf')](_0x0c4f('0x10'),_0xde47ee);});}else{utils[_0x0c4f('0xf')](_0x0c4f('0x10'),_0xde47ee);}if(_0xde47ee[_0x0c4f('0x11')]){delete queues[_0xde47ee[_0x0c4f('0x11')]];}else{delete queues[_0xde47ee[_0x0c4f('0x5')]];}}exports[_0x0c4f('0x12')]=function(_0x4f5fd6){queues[_0x4f5fd6[_0x0c4f('0x5')]]=_[_0x0c4f('0x13')](_0x4f5fd6,{'originalposition':_0x4f5fd6['position'],'queuecallerjoinAt':utils[_0x0c4f('0x14')](),'mohtime':0x0});};exports[_0x0c4f('0x15')]=function(_0x8f5843){if(!_[_0x0c4f('0x16')](queues[_0x8f5843[_0x0c4f('0x5')]])){if(queues[_0x8f5843[_0x0c4f('0x5')]][_0x0c4f('0x17')]){if(!queues[_0x8f5843[_0x0c4f('0x5')]]['queuecallerabandon']&&!queues[_0x8f5843[_0x0c4f('0x5')]][_0x0c4f('0x18')]){queues[_0x8f5843[_0x0c4f('0x5')]][_0x0c4f('0x19')]=!![];queues[_0x8f5843['uniqueid']]['queuecallercompleteAt']=utils['now']();queues[_0x8f5843[_0x0c4f('0x5')]][_0x0c4f('0xb')]=_0x0c4f('0x1a');}writeDB(queues[_0x8f5843[_0x0c4f('0x5')]]);}else{if(queues[_0x8f5843['uniqueid']][_0x0c4f('0x11')]){queues[queues[_0x8f5843[_0x0c4f('0x5')]][_0x0c4f('0x11')]]=queues[_0x8f5843[_0x0c4f('0x5')]];queues[queues[_0x8f5843['uniqueid']][_0x0c4f('0x11')]][_0x0c4f('0x1b')]=0x2;delete queues[_0x8f5843[_0x0c4f('0x5')]];}}}};exports[_0x0c4f('0x1c')]=function(_0x1a9884){if(!_[_0x0c4f('0x16')](_0x1a9884[_0x0c4f('0x1d')][_0x0c4f('0x1e')])){if(!_['isNil'](queues[_0x1a9884[_0x0c4f('0x5')]])){queues[_0x1a9884['uniqueid']][_0x0c4f('0x1f')]=![];queues[_0x1a9884['uniqueid']][_0x0c4f('0x20')]=null;queues[_0x1a9884[_0x0c4f('0x5')]][_0x0c4f('0x18')]=!![];queues[_0x1a9884[_0x0c4f('0x5')]]['queuecallerexitAt']=utils['now']();queues[_0x1a9884['uniqueid']][_0x0c4f('0xb')]=_0x1a9884[_0x0c4f('0x21')]['toUpperCase']();writeDB(queues[_0x1a9884[_0x0c4f('0x5')]]);}}else if(!_[_0x0c4f('0x16')](_0x1a9884[_0x0c4f('0x1d')][_0x0c4f('0x22')])){if(!_[_0x0c4f('0x16')](queues[_0x1a9884[_0x0c4f('0x5')]])&&!queues[_0x1a9884['uniqueid']][_0x0c4f('0x1f')]){queues[_0x1a9884[_0x0c4f('0x5')]][_0x0c4f('0x1f')]=![];queues[_0x1a9884[_0x0c4f('0x5')]][_0x0c4f('0x20')]=null;queues[_0x1a9884[_0x0c4f('0x5')]][_0x0c4f('0x18')]=!![];queues[_0x1a9884[_0x0c4f('0x5')]][_0x0c4f('0x23')]=utils[_0x0c4f('0x14')]();queues[_0x1a9884[_0x0c4f('0x5')]][_0x0c4f('0xb')]=_0x0c4f('0x24');}}};exports[_0x0c4f('0x1f')]=function(_0x4cfff1){if(!_[_0x0c4f('0x16')](queues[_0x4cfff1[_0x0c4f('0x5')]])){queues[_0x4cfff1[_0x0c4f('0x5')]][_0x0c4f('0x18')]=![];queues[_0x4cfff1['uniqueid']][_0x0c4f('0x23')]=null;queues[_0x4cfff1[_0x0c4f('0x5')]][_0x0c4f('0x1f')]=!![];queues[_0x4cfff1[_0x0c4f('0x5')]]['queuecallerabandonAt']=utils[_0x0c4f('0x14')]();queues[_0x4cfff1[_0x0c4f('0x5')]][_0x0c4f('0xb')]='ABANDONED';}};exports['queuecallerleave']=function(_0x12f4a1){if(!_[_0x0c4f('0x16')](queues[_0x12f4a1[_0x0c4f('0x5')]])){queues[_0x12f4a1[_0x0c4f('0x5')]]['queuecallerleave']=!![];queues[_0x12f4a1[_0x0c4f('0x5')]][_0x0c4f('0x17')]=utils[_0x0c4f('0x14')]();queues[_0x12f4a1[_0x0c4f('0x5')]]['holdtime']=utils[_0x0c4f('0x25')](queues[_0x12f4a1[_0x0c4f('0x5')]][_0x0c4f('0x17')],queues[_0x12f4a1[_0x0c4f('0x5')]][_0x0c4f('0x26')]);queues[_0x12f4a1[_0x0c4f('0x5')]][_0x0c4f('0x27')]=_0x12f4a1[_0x0c4f('0x27')];queues[_0x12f4a1[_0x0c4f('0x5')]][_0x0c4f('0x28')]=_0x12f4a1[_0x0c4f('0x28')];queues[_0x12f4a1[_0x0c4f('0x5')]]['connectedlinenum']=_0x12f4a1['connectedlinenum'];queues[_0x12f4a1[_0x0c4f('0x5')]][_0x0c4f('0x29')]=_0x12f4a1[_0x0c4f('0x29')];}};exports[_0x0c4f('0x2a')]=function(_0x17ee61){if(!_[_0x0c4f('0x16')](queues[_0x17ee61['uniqueid']])){queues[_0x17ee61[_0x0c4f('0x5')]][_0x0c4f('0x1f')]=![];queues[_0x17ee61[_0x0c4f('0x5')]][_0x0c4f('0x1f')]=![];queues[_0x17ee61['uniqueid']]['queuecallerabandonAt']=null;queues[_0x17ee61[_0x0c4f('0x5')]][_0x0c4f('0x18')]=![];queues[_0x17ee61['uniqueid']][_0x0c4f('0x23')]=null;queues[_0x17ee61['uniqueid']][_0x0c4f('0x2b')]=!![];queues[_0x17ee61[_0x0c4f('0x5')]][_0x0c4f('0x8')]=_0x17ee61['membername'];}};exports[_0x0c4f('0x2c')]=function(_0x4d8423){if(!_[_0x0c4f('0x16')](queues[_0x4d8423['uniqueid']])){if(queues[_0x4d8423['uniqueid']][_0x0c4f('0x17')]){queues[_0x4d8423['uniqueid']][_0x0c4f('0x1f')]=![];queues[_0x4d8423[_0x0c4f('0x5')]][_0x0c4f('0x1f')]=![];queues[_0x4d8423[_0x0c4f('0x5')]][_0x0c4f('0x20')]=null;queues[_0x4d8423[_0x0c4f('0x5')]][_0x0c4f('0x18')]=![];queues[_0x4d8423[_0x0c4f('0x5')]]['queuecallerexitAt']=null;queues[_0x4d8423['uniqueid']][_0x0c4f('0x2b')]=!![];queues[_0x4d8423[_0x0c4f('0x5')]]['lastAssignedTo']=_0x4d8423[_0x0c4f('0x2d')];queues[_0x4d8423['uniqueid']][_0x0c4f('0x19')]=!![];queues[_0x4d8423[_0x0c4f('0x5')]][_0x0c4f('0x2e')]=utils['now']();if(_0x4d8423[_0x0c4f('0x2f')]=='transfer'){if(!queues[_0x4d8423[_0x0c4f('0x5')]][_0x0c4f('0x30')]){queues[_0x4d8423['uniqueid']][_0x0c4f('0xb')]=_0x0c4f('0x31');}}else{queues[_0x4d8423['uniqueid']][_0x0c4f('0xb')]=_0x0c4f('0x32')+_0x4d8423[_0x0c4f('0x2f')]['toUpperCase']();}writeDB(queues[_0x4d8423[_0x0c4f('0x5')]]);}}};exports[_0x0c4f('0x33')]=function(_0xf0a9b6){if(!_[_0x0c4f('0x16')](queues[_0xf0a9b6['transfereeuniqueid']])){queues[_0xf0a9b6[_0x0c4f('0x34')]][_0x0c4f('0x30')]=!![];queues[_0xf0a9b6[_0x0c4f('0x34')]][_0x0c4f('0x35')]=_0x0c4f('0x36');queues[_0xf0a9b6['transfereeuniqueid']]['transferexten']=_0xf0a9b6[_0x0c4f('0x37')];queues[_0xf0a9b6[_0x0c4f('0x34')]]['transferuniqueid']=_0xf0a9b6[_0x0c4f('0x34')];queues[_0xf0a9b6[_0x0c4f('0x34')]]['queuecallerexitreason']=_0x0c4f('0x38');}};exports[_0x0c4f('0x39')]=function(_0x1cf96e){try{if(_0x1cf96e['origtransfereruniqueid']==_0x1cf96e[_0x0c4f('0x3a')]){if(!_[_0x0c4f('0x16')](queues[_0x1cf96e[_0x0c4f('0x3b')]])){queues[_0x1cf96e[_0x0c4f('0x3b')]][_0x0c4f('0x30')]=!![];queues[_0x1cf96e[_0x0c4f('0x3b')]][_0x0c4f('0x35')]=_0x0c4f('0x3c');queues[_0x1cf96e['secondtransfererlinkedid']]['transferexten']=_0x1cf96e[_0x0c4f('0x3d')];queues[_0x1cf96e[_0x0c4f('0x3b')]]['transferuniqueid']=_0x1cf96e[_0x0c4f('0x3e')];queues[_0x1cf96e[_0x0c4f('0x3b')]][_0x0c4f('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x0c4f('0x16')](queues[_0x1cf96e[_0x0c4f('0x3a')]])){if(_0x1cf96e[_0x0c4f('0x3f')]&&queues[_0x1cf96e['transfereelinkedid']]){queues[_0x1cf96e[_0x0c4f('0x3f')]][_0x0c4f('0x1b')]=0x1;queues[_0x1cf96e[_0x0c4f('0x34')]]=_[_0x0c4f('0x40')](queues[_0x1cf96e['transfereelinkedid']]);queues[_0x1cf96e[_0x0c4f('0x34')]][_0x0c4f('0x11')]=_0x1cf96e[_0x0c4f('0x41')];queues[_0x1cf96e[_0x0c4f('0x34')]][_0x0c4f('0x1b')]=0x2;queues[_0x1cf96e[_0x0c4f('0x34')]][_0x0c4f('0x9')]=queues[_0x1cf96e['secondtransfererlinkedid']][_0x0c4f('0x9')];queues[_0x1cf96e[_0x0c4f('0x34')]][_0x0c4f('0x42')]=queues[_0x1cf96e[_0x0c4f('0x3b')]][_0x0c4f('0x42')];queues[_0x1cf96e[_0x0c4f('0x34')]][_0x0c4f('0x26')]=utils[_0x0c4f('0x14')]();queues[_0x1cf96e[_0x0c4f('0x34')]]['queuecallerleaveAt']=utils['now']();queues[_0x1cf96e[_0x0c4f('0x34')]][_0x0c4f('0x43')]=0x0;queues[_0x1cf96e[_0x0c4f('0x34')]]['mohtime']=0x0;}else{queues[_0x1cf96e[_0x0c4f('0x3a')]][_0x0c4f('0x11')]=_0x1cf96e[_0x0c4f('0x3b')];}}}else if(_0x1cf96e[_0x0c4f('0x44')]==_0x1cf96e[_0x0c4f('0x3b')]){if(!_[_0x0c4f('0x16')](queues[_0x1cf96e[_0x0c4f('0x3a')]])){queues[_0x1cf96e[_0x0c4f('0x3a')]][_0x0c4f('0x30')]=!![];queues[_0x1cf96e[_0x0c4f('0x3a')]]['transfertype']='ATTENDED';queues[_0x1cf96e[_0x0c4f('0x3a')]][_0x0c4f('0x45')]=_0x1cf96e['secondtransfererexten'];queues[_0x1cf96e[_0x0c4f('0x3a')]]['transferuniqueid']=_0x1cf96e[_0x0c4f('0x44')];queues[_0x1cf96e[_0x0c4f('0x3a')]][_0x0c4f('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x0c4f('0x16')](queues[_0x1cf96e[_0x0c4f('0x3b')]])){if(_0x1cf96e[_0x0c4f('0x46')]&&queues[_0x1cf96e[_0x0c4f('0x46')]]){queues[_0x1cf96e[_0x0c4f('0x46')]]['queuecallerenterreason']=0x1;queues[_0x1cf96e[_0x0c4f('0x41')]]=_[_0x0c4f('0x40')](queues[_0x1cf96e[_0x0c4f('0x46')]]);queues[_0x1cf96e[_0x0c4f('0x41')]][_0x0c4f('0x11')]=_0x1cf96e['transfertargetuniqueid'];queues[_0x1cf96e['transfertargetuniqueid']][_0x0c4f('0x1b')]=0x2;queues[_0x1cf96e[_0x0c4f('0x41')]][_0x0c4f('0x9')]=queues[_0x1cf96e[_0x0c4f('0x3a')]]['calleridnum'];queues[_0x1cf96e[_0x0c4f('0x41')]][_0x0c4f('0x42')]=queues[_0x1cf96e[_0x0c4f('0x3a')]][_0x0c4f('0x42')];queues[_0x1cf96e[_0x0c4f('0x41')]]['queuecallerjoinAt']=utils[_0x0c4f('0x14')]();queues[_0x1cf96e[_0x0c4f('0x41')]][_0x0c4f('0x17')]=utils[_0x0c4f('0x14')]();queues[_0x1cf96e[_0x0c4f('0x41')]]['holdtime']=0x0;queues[_0x1cf96e[_0x0c4f('0x41')]]['mohtime']=0x0;}else{queues[_0x1cf96e['secondtransfererlinkedid']][_0x0c4f('0x11')]=_0x1cf96e[_0x0c4f('0x3a')];}}}}catch(_0x2e9062){utils[_0x0c4f('0x47')](_0x2e9062[_0x0c4f('0x48')]);}};exports[_0x0c4f('0x49')]=function(_0xe719e1){if(!_['isNil'](queues[_0xe719e1[_0x0c4f('0x5')]])){queues[_0xe719e1[_0x0c4f('0x5')]][_0x0c4f('0x4a')]=utils[_0x0c4f('0x14')]();}};exports['musiconholdstop']=function(_0x4bdc23){if(!_['isNil'](queues[_0x4bdc23[_0x0c4f('0x5')]])){if(!_[_0x0c4f('0x16')](queues[_0x4bdc23['uniqueid']]['musiconholdstartAt'])){queues[_0x4bdc23[_0x0c4f('0x5')]]['mohtime']+=utils[_0x0c4f('0x25')](utils['now'](),queues[_0x4bdc23[_0x0c4f('0x5')]]['musiconholdstartAt']);delete queues[_0x4bdc23['uniqueid']][_0x0c4f('0x4a')];}}}; \ No newline at end of file +var _0x3aa9=['then','type','request','CreateVoiceQueueReport','transfereduniqueid','assign','position','now','hangup','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','varset','isNil','variable','queuestatus','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','count','connectedlinenum','connectedlinename','agentconnect','agentcomplete','assigned','membername','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','secondtransfererlinkedid','ATTENDED','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','queuecallerjoinAt','error','musiconholdstart','musiconholdstop','musiconholdstartAt','lodash','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','getVoiceQueueByName'];(function(_0x531262,_0x461bac){var _0x53cb3e=function(_0x2a5e0a){while(--_0x2a5e0a){_0x531262['push'](_0x531262['shift']());}};_0x53cb3e(++_0x461bac);}(_0x3aa9,0x92));var _0x93aa=function(_0x2c8b4f,_0x2be2f9){_0x2c8b4f=_0x2c8b4f-0x0;var _0x3dbd8f=_0x3aa9[_0x2c8b4f];return _0x3dbd8f;};'use strict';var _=require(_0x93aa('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x23cb8d){utils[_0x93aa('0x1')](util[_0x93aa('0x2')](_0x93aa('0x3'),_0x23cb8d[_0x93aa('0x4')],_0x23cb8d[_0x93aa('0x5')],_0x23cb8d[_0x93aa('0x6')],_0x23cb8d[_0x93aa('0x7')],_0x23cb8d[_0x93aa('0x8')],_0x23cb8d['accountcode'],_0x23cb8d['queuecallerexitreason']));if(_0x23cb8d[_0x93aa('0x6')]){utils[_0x93aa('0x9')](_0x23cb8d['queue'])[_0x93aa('0xa')](function(_0x20165e){if(_0x20165e){_0x23cb8d[_0x93aa('0xb')]=_0x20165e[_0x93aa('0xb')];}utils[_0x93aa('0xc')]('CreateVoiceQueueReport',_0x23cb8d);});}else{utils[_0x93aa('0xc')](_0x93aa('0xd'),_0x23cb8d);}if(_0x23cb8d[_0x93aa('0xe')]){delete queues[_0x23cb8d['transfereduniqueid']];}else{delete queues[_0x23cb8d[_0x93aa('0x4')]];}}exports['queuecallerjoin']=function(_0x2a54b1){queues[_0x2a54b1['uniqueid']]=_[_0x93aa('0xf')](_0x2a54b1,{'originalposition':_0x2a54b1[_0x93aa('0x10')],'queuecallerjoinAt':utils[_0x93aa('0x11')](),'mohtime':0x0});};exports[_0x93aa('0x12')]=function(_0x23a46f){if(!_['isNil'](queues[_0x23a46f['uniqueid']])){if(queues[_0x23a46f['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x23a46f[_0x93aa('0x4')]][_0x93aa('0x13')]&&!queues[_0x23a46f['uniqueid']]['queuecallerexit']){queues[_0x23a46f['uniqueid']][_0x93aa('0x14')]=!![];queues[_0x23a46f[_0x93aa('0x4')]][_0x93aa('0x15')]=utils[_0x93aa('0x11')]();queues[_0x23a46f[_0x93aa('0x4')]][_0x93aa('0x16')]=_0x93aa('0x17');}writeDB(queues[_0x23a46f['uniqueid']]);}else{if(queues[_0x23a46f['uniqueid']][_0x93aa('0xe')]){queues[queues[_0x23a46f[_0x93aa('0x4')]]['transfereduniqueid']]=queues[_0x23a46f[_0x93aa('0x4')]];queues[queues[_0x23a46f[_0x93aa('0x4')]][_0x93aa('0xe')]][_0x93aa('0x18')]=0x2;delete queues[_0x23a46f['uniqueid']];}}}};exports[_0x93aa('0x19')]=function(_0x3bf15e){if(!_[_0x93aa('0x1a')](_0x3bf15e[_0x93aa('0x1b')][_0x93aa('0x1c')])){if(!_['isNil'](queues[_0x3bf15e[_0x93aa('0x4')]])){queues[_0x3bf15e[_0x93aa('0x4')]][_0x93aa('0x13')]=![];queues[_0x3bf15e['uniqueid']][_0x93aa('0x1d')]=null;queues[_0x3bf15e[_0x93aa('0x4')]][_0x93aa('0x1e')]=!![];queues[_0x3bf15e['uniqueid']][_0x93aa('0x1f')]=utils[_0x93aa('0x11')]();queues[_0x3bf15e['uniqueid']]['queuecallerexitreason']=_0x3bf15e['value'][_0x93aa('0x20')]();writeDB(queues[_0x3bf15e[_0x93aa('0x4')]]);}}else if(!_[_0x93aa('0x1a')](_0x3bf15e[_0x93aa('0x1b')][_0x93aa('0x21')])){if(!_[_0x93aa('0x1a')](queues[_0x3bf15e[_0x93aa('0x4')]])&&!queues[_0x3bf15e[_0x93aa('0x4')]][_0x93aa('0x13')]){queues[_0x3bf15e['uniqueid']]['queuecallerabandon']=![];queues[_0x3bf15e[_0x93aa('0x4')]][_0x93aa('0x1d')]=null;queues[_0x3bf15e[_0x93aa('0x4')]][_0x93aa('0x1e')]=!![];queues[_0x3bf15e['uniqueid']][_0x93aa('0x1f')]=utils[_0x93aa('0x11')]();queues[_0x3bf15e[_0x93aa('0x4')]]['queuecallerexitreason']=_0x93aa('0x22');}}};exports[_0x93aa('0x13')]=function(_0x122907){if(!_['isNil'](queues[_0x122907['uniqueid']])){queues[_0x122907[_0x93aa('0x4')]][_0x93aa('0x1e')]=![];queues[_0x122907[_0x93aa('0x4')]][_0x93aa('0x1f')]=null;queues[_0x122907[_0x93aa('0x4')]][_0x93aa('0x13')]=!![];queues[_0x122907[_0x93aa('0x4')]][_0x93aa('0x1d')]=utils[_0x93aa('0x11')]();queues[_0x122907[_0x93aa('0x4')]][_0x93aa('0x16')]=_0x93aa('0x23');}};exports[_0x93aa('0x24')]=function(_0x167797){if(!_[_0x93aa('0x1a')](queues[_0x167797[_0x93aa('0x4')]])){queues[_0x167797[_0x93aa('0x4')]][_0x93aa('0x24')]=!![];queues[_0x167797[_0x93aa('0x4')]][_0x93aa('0x25')]=utils[_0x93aa('0x11')]();queues[_0x167797[_0x93aa('0x4')]][_0x93aa('0x26')]=utils[_0x93aa('0x27')](queues[_0x167797['uniqueid']]['queuecallerleaveAt'],queues[_0x167797['uniqueid']]['queuecallerjoinAt']);queues[_0x167797[_0x93aa('0x4')]]['position']=_0x167797[_0x93aa('0x10')];queues[_0x167797[_0x93aa('0x4')]]['count']=_0x167797[_0x93aa('0x28')];queues[_0x167797[_0x93aa('0x4')]][_0x93aa('0x29')]=_0x167797['connectedlinenum'];queues[_0x167797[_0x93aa('0x4')]][_0x93aa('0x2a')]=_0x167797['connectedlinename'];}};exports[_0x93aa('0x2b')]=function(_0x3ee72b){if(!_[_0x93aa('0x1a')](queues[_0x3ee72b[_0x93aa('0x4')]])){queues[_0x3ee72b[_0x93aa('0x4')]][_0x93aa('0x13')]=![];queues[_0x3ee72b[_0x93aa('0x4')]]['queuecallerabandon']=![];queues[_0x3ee72b[_0x93aa('0x4')]][_0x93aa('0x1d')]=null;queues[_0x3ee72b['uniqueid']][_0x93aa('0x1e')]=![];queues[_0x3ee72b[_0x93aa('0x4')]][_0x93aa('0x1f')]=null;queues[_0x3ee72b[_0x93aa('0x4')]]['assigned']=!![];queues[_0x3ee72b[_0x93aa('0x4')]]['lastAssignedTo']=_0x3ee72b['membername'];}};exports[_0x93aa('0x2c')]=function(_0x470649){if(!_[_0x93aa('0x1a')](queues[_0x470649[_0x93aa('0x4')]])){if(queues[_0x470649['uniqueid']][_0x93aa('0x25')]){queues[_0x470649[_0x93aa('0x4')]][_0x93aa('0x13')]=![];queues[_0x470649['uniqueid']][_0x93aa('0x13')]=![];queues[_0x470649[_0x93aa('0x4')]]['queuecallerabandonAt']=null;queues[_0x470649['uniqueid']][_0x93aa('0x1e')]=![];queues[_0x470649[_0x93aa('0x4')]][_0x93aa('0x1f')]=null;queues[_0x470649[_0x93aa('0x4')]][_0x93aa('0x2d')]=!![];queues[_0x470649[_0x93aa('0x4')]][_0x93aa('0x7')]=_0x470649[_0x93aa('0x2e')];queues[_0x470649['uniqueid']]['queuecallercomplete']=!![];queues[_0x470649[_0x93aa('0x4')]][_0x93aa('0x15')]=utils[_0x93aa('0x11')]();if(_0x470649[_0x93aa('0x2f')]=='transfer'){if(!queues[_0x470649['uniqueid']][_0x93aa('0x30')]){queues[_0x470649[_0x93aa('0x4')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x470649['uniqueid']][_0x93aa('0x16')]=_0x93aa('0x31')+_0x470649[_0x93aa('0x2f')][_0x93aa('0x20')]();}writeDB(queues[_0x470649[_0x93aa('0x4')]]);}}};exports[_0x93aa('0x32')]=function(_0x19c7c4){if(!_['isNil'](queues[_0x19c7c4[_0x93aa('0x33')]])){queues[_0x19c7c4[_0x93aa('0x33')]]['transfer']=!![];queues[_0x19c7c4[_0x93aa('0x33')]][_0x93aa('0x34')]=_0x93aa('0x35');queues[_0x19c7c4[_0x93aa('0x33')]][_0x93aa('0x36')]=_0x19c7c4[_0x93aa('0x37')];queues[_0x19c7c4[_0x93aa('0x33')]][_0x93aa('0x38')]=_0x19c7c4['transfereeuniqueid'];queues[_0x19c7c4[_0x93aa('0x33')]]['queuecallerexitreason']=_0x93aa('0x39');}};exports[_0x93aa('0x3a')]=function(_0x13a00d){try{if(_0x13a00d['origtransfereruniqueid']==_0x13a00d['origtransfererlinkedid']){if(!_[_0x93aa('0x1a')](queues[_0x13a00d[_0x93aa('0x3b')]])){queues[_0x13a00d[_0x93aa('0x3b')]]['transfer']=!![];queues[_0x13a00d[_0x93aa('0x3b')]][_0x93aa('0x34')]=_0x93aa('0x3c');queues[_0x13a00d['secondtransfererlinkedid']]['transferexten']=_0x13a00d[_0x93aa('0x3d')];queues[_0x13a00d['secondtransfererlinkedid']][_0x93aa('0x38')]=_0x13a00d[_0x93aa('0x3e')];queues[_0x13a00d[_0x93aa('0x3b')]][_0x93aa('0x16')]=_0x93aa('0x3f');}if(!_[_0x93aa('0x1a')](queues[_0x13a00d[_0x93aa('0x40')]])){if(_0x13a00d[_0x93aa('0x41')]&&queues[_0x13a00d[_0x93aa('0x41')]]){queues[_0x13a00d[_0x93aa('0x41')]]['queuecallerenterreason']=0x1;queues[_0x13a00d[_0x93aa('0x33')]]=_[_0x93aa('0x42')](queues[_0x13a00d[_0x93aa('0x41')]]);queues[_0x13a00d[_0x93aa('0x33')]][_0x93aa('0xe')]=_0x13a00d[_0x93aa('0x43')];queues[_0x13a00d[_0x93aa('0x33')]][_0x93aa('0x18')]=0x2;queues[_0x13a00d[_0x93aa('0x33')]][_0x93aa('0x8')]=queues[_0x13a00d[_0x93aa('0x3b')]]['calleridnum'];queues[_0x13a00d[_0x93aa('0x33')]][_0x93aa('0x44')]=queues[_0x13a00d[_0x93aa('0x3b')]]['calleridname'];queues[_0x13a00d[_0x93aa('0x33')]]['queuecallerjoinAt']=utils[_0x93aa('0x11')]();queues[_0x13a00d['transfereeuniqueid']][_0x93aa('0x25')]=utils['now']();queues[_0x13a00d['transfereeuniqueid']][_0x93aa('0x26')]=0x0;queues[_0x13a00d[_0x93aa('0x33')]][_0x93aa('0x45')]=0x0;}else{queues[_0x13a00d[_0x93aa('0x40')]]['transfereduniqueid']=_0x13a00d[_0x93aa('0x3b')];}}}else if(_0x13a00d[_0x93aa('0x46')]==_0x13a00d[_0x93aa('0x3b')]){if(!_[_0x93aa('0x1a')](queues[_0x13a00d[_0x93aa('0x40')]])){queues[_0x13a00d[_0x93aa('0x40')]][_0x93aa('0x30')]=!![];queues[_0x13a00d['origtransfererlinkedid']][_0x93aa('0x34')]=_0x93aa('0x3c');queues[_0x13a00d[_0x93aa('0x40')]][_0x93aa('0x36')]=_0x13a00d[_0x93aa('0x47')];queues[_0x13a00d[_0x93aa('0x40')]][_0x93aa('0x38')]=_0x13a00d[_0x93aa('0x46')];queues[_0x13a00d[_0x93aa('0x40')]][_0x93aa('0x16')]=_0x93aa('0x3f');}if(!_[_0x93aa('0x1a')](queues[_0x13a00d[_0x93aa('0x3b')]])){if(_0x13a00d[_0x93aa('0x48')]&&queues[_0x13a00d[_0x93aa('0x48')]]){queues[_0x13a00d[_0x93aa('0x48')]][_0x93aa('0x18')]=0x1;queues[_0x13a00d[_0x93aa('0x43')]]=_[_0x93aa('0x42')](queues[_0x13a00d[_0x93aa('0x48')]]);queues[_0x13a00d[_0x93aa('0x43')]][_0x93aa('0xe')]=_0x13a00d['transfertargetuniqueid'];queues[_0x13a00d[_0x93aa('0x43')]][_0x93aa('0x18')]=0x2;queues[_0x13a00d[_0x93aa('0x43')]][_0x93aa('0x8')]=queues[_0x13a00d[_0x93aa('0x40')]][_0x93aa('0x8')];queues[_0x13a00d[_0x93aa('0x43')]][_0x93aa('0x44')]=queues[_0x13a00d[_0x93aa('0x40')]][_0x93aa('0x44')];queues[_0x13a00d['transfertargetuniqueid']][_0x93aa('0x49')]=utils[_0x93aa('0x11')]();queues[_0x13a00d['transfertargetuniqueid']][_0x93aa('0x25')]=utils['now']();queues[_0x13a00d[_0x93aa('0x43')]]['holdtime']=0x0;queues[_0x13a00d[_0x93aa('0x43')]]['mohtime']=0x0;}else{queues[_0x13a00d[_0x93aa('0x3b')]][_0x93aa('0xe')]=_0x13a00d[_0x93aa('0x40')];}}}}catch(_0x104732){utils[_0x93aa('0x4a')](_0x104732['stack']);}};exports[_0x93aa('0x4b')]=function(_0x2c0942){if(!_[_0x93aa('0x1a')](queues[_0x2c0942[_0x93aa('0x4')]])){queues[_0x2c0942['uniqueid']]['musiconholdstartAt']=utils['now']();}};exports[_0x93aa('0x4c')]=function(_0x2e5937){if(!_['isNil'](queues[_0x2e5937[_0x93aa('0x4')]])){if(!_[_0x93aa('0x1a')](queues[_0x2e5937[_0x93aa('0x4')]]['musiconholdstartAt'])){queues[_0x2e5937['uniqueid']][_0x93aa('0x45')]+=utils[_0x93aa('0x27')](utils[_0x93aa('0x11')](),queues[_0x2e5937[_0x93aa('0x4')]][_0x93aa('0x4d')]);delete queues[_0x2e5937[_0x93aa('0x4')]][_0x93aa('0x4d')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c6dc708..6966252 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 _0x9c44=['getUserByInternal','then','name','request','CreateVoiceRecording','newchannel','uniqueid','linkedid','context','channel','error','stack','isNil','transfer','variable','endsWith','value','replace','.wav49','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode'];(function(_0x539678,_0x3025b1){var _0x422b92=function(_0x40a81c){while(--_0x40a81c){_0x539678['push'](_0x539678['shift']());}};_0x422b92(++_0x3025b1);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x1ffbbf){utils[_0x49c4('0x0')](_0x1ffbbf);if(_0x1ffbbf[_0x49c4('0x1')]){utils[_0x49c4('0x2')](_0x1ffbbf[_0x49c4('0x1')])[_0x49c4('0x3')](function(_0x4e0313){if(_0x4e0313){_0x1ffbbf['membername']=_0x4e0313[_0x49c4('0x4')];_0x1ffbbf['UserId']=_0x4e0313['id'];}utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);});}else{utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);}}exports[_0x49c4('0x7')]=function(_0x511d53){try{if(_0x511d53[_0x49c4('0x8')]==_0x511d53[_0x49c4('0x9')]){recordings[_0x511d53[_0x49c4('0x8')]]={'uniqueid':_0x511d53[_0x49c4('0x8')],'accountcode':_0x511d53['accountcode'],'exten':_0x511d53['exten'],'context':_0x511d53[_0x49c4('0xa')],'channel':_0x511d53[_0x49c4('0xb')],'monitors':[]};}}catch(_0x58cad7){utils[_0x49c4('0xc')](_0x58cad7[_0x49c4('0xd')]);}};exports['newstate']=function(_0x536d42){try{if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x8')]])&&_0x536d42['channelstate']==0x6){}else if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x9')]])&&_0x536d42['channelstate']==0x6&&_0x536d42[_0x49c4('0xa')]!=_0x49c4('0xf')){recordings[_0x536d42[_0x49c4('0x9')]][_0x49c4('0x1')]=_0x536d42[_0x49c4('0x1')];}}catch(_0x18211c){utils[_0x49c4('0xc')](_0x18211c[_0x49c4('0xd')]);}};exports['varset']=function(_0x3acd06){try{if(!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')])&&!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')]['mixmonitor_filename'])){if(_[_0x49c4('0x11')](_0x3acd06[_0x49c4('0x12')],'.wav49')){_0x3acd06['value']=_0x3acd06[_0x49c4('0x12')][_0x49c4('0x13')](_0x49c4('0x14'),'.WAV');}if(recordings[_0x3acd06[_0x49c4('0x9')]]){var _0x50b151=_[_0x49c4('0x15')](recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')],{'value':_0x3acd06[_0x49c4('0x12')]});if(_[_0x49c4('0xe')](_0x50b151)){recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')][_0x49c4('0x17')]({'value':_0x3acd06[_0x49c4('0x12')]});}}}}catch(_0x578447){utils['error'](_0x578447['stack']);}};exports[_0x49c4('0x18')]=function(_0x4f0b62){try{if(!_['isNil'](recordings[_0x4f0b62[_0x49c4('0x8')]])){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x19')]=_0x4f0b62[_0x49c4('0x19')];recordings[_0x4f0b62['uniqueid']]['calleridname']=_0x4f0b62[_0x49c4('0x1a')];recordings[_0x4f0b62[_0x49c4('0x8')]]['connectedlinenum']=_0x4f0b62[_0x49c4('0x1b')];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]=_0x4f0b62[_0x49c4('0x1c')];if(recordings[_0x4f0b62['uniqueid']]['type']==_0x49c4('0x1d')&&recordings[_0x4f0b62['uniqueid']][_0x49c4('0x1')]){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1b')]=recordings[_0x4f0b62[_0x49c4('0x8')]]['accountcode'];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]='';}recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x16')][_0x49c4('0x1e')](_0x29f835=>{var _0x26ba17=_[_0x49c4('0x1f')](recordings[_0x4f0b62[_0x49c4('0x8')]]);_0x26ba17[_0x49c4('0x12')]=_0x29f835[_0x49c4('0x12')];writeDB(_0x26ba17);});delete recordings[_0x4f0b62['uniqueid']];}}catch(_0x4f4495){utils['error'](_0x4f4495[_0x49c4('0xd')]);}};exports[_0x49c4('0x20')]=function(_0x1eb035){try{if(!_[_0x49c4('0xe')](recordings[_0x1eb035[_0x49c4('0x8')]])){if(_0x1eb035['application'][_0x49c4('0x21')]()==_0x49c4('0x22')&&_[_0x49c4('0x23')](_0x1eb035[_0x49c4('0x24')]['toLowerCase'](),'cdr')){var _0xce57ef=_0x1eb035[_0x49c4('0x24')][_0x49c4('0x25')]('=');var _0x13b3b4=_0xce57ef[0x0][_0x49c4('0x26')](_0xce57ef[0x0]['lastIndexOf']('(')+0x1,_0xce57ef[0x0][_0x49c4('0x27')](')'));var _0x84c621=_0xce57ef[0x1];recordings[_0x1eb035[_0x49c4('0x8')]][_0x13b3b4]=_0x84c621;}}}catch(_0x512d02){utils['error'](_0x512d02[_0x49c4('0xd')]);}};exports[_0x49c4('0x28')]=function(_0x3bec0a){try{if(!_[_0x49c4('0xe')](recordings[_0x3bec0a[_0x49c4('0x8')]])){recordings[_0x3bec0a[_0x49c4('0x8')]][_0x49c4('0x29')]=_0x3bec0a[_0x49c4('0x29')];}}catch(_0x3209cd){utils['error'](_0x3209cd[_0x49c4('0xd')]);}}; \ No newline at end of file +var _0x9c44=['getUserByInternal','then','name','request','CreateVoiceRecording','newchannel','uniqueid','linkedid','context','channel','error','stack','isNil','transfer','variable','endsWith','value','replace','.wav49','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode'];(function(_0x5cbdf3,_0x1dbb5c){var _0x4cb15f=function(_0x5be353){while(--_0x5be353){_0x5cbdf3['push'](_0x5cbdf3['shift']());}};_0x4cb15f(++_0x1dbb5c);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x1ffbbf){utils[_0x49c4('0x0')](_0x1ffbbf);if(_0x1ffbbf[_0x49c4('0x1')]){utils[_0x49c4('0x2')](_0x1ffbbf[_0x49c4('0x1')])[_0x49c4('0x3')](function(_0x4e0313){if(_0x4e0313){_0x1ffbbf['membername']=_0x4e0313[_0x49c4('0x4')];_0x1ffbbf['UserId']=_0x4e0313['id'];}utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);});}else{utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);}}exports[_0x49c4('0x7')]=function(_0x511d53){try{if(_0x511d53[_0x49c4('0x8')]==_0x511d53[_0x49c4('0x9')]){recordings[_0x511d53[_0x49c4('0x8')]]={'uniqueid':_0x511d53[_0x49c4('0x8')],'accountcode':_0x511d53['accountcode'],'exten':_0x511d53['exten'],'context':_0x511d53[_0x49c4('0xa')],'channel':_0x511d53[_0x49c4('0xb')],'monitors':[]};}}catch(_0x58cad7){utils[_0x49c4('0xc')](_0x58cad7[_0x49c4('0xd')]);}};exports['newstate']=function(_0x536d42){try{if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x8')]])&&_0x536d42['channelstate']==0x6){}else if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x9')]])&&_0x536d42['channelstate']==0x6&&_0x536d42[_0x49c4('0xa')]!=_0x49c4('0xf')){recordings[_0x536d42[_0x49c4('0x9')]][_0x49c4('0x1')]=_0x536d42[_0x49c4('0x1')];}}catch(_0x18211c){utils[_0x49c4('0xc')](_0x18211c[_0x49c4('0xd')]);}};exports['varset']=function(_0x3acd06){try{if(!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')])&&!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')]['mixmonitor_filename'])){if(_[_0x49c4('0x11')](_0x3acd06[_0x49c4('0x12')],'.wav49')){_0x3acd06['value']=_0x3acd06[_0x49c4('0x12')][_0x49c4('0x13')](_0x49c4('0x14'),'.WAV');}if(recordings[_0x3acd06[_0x49c4('0x9')]]){var _0x50b151=_[_0x49c4('0x15')](recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')],{'value':_0x3acd06[_0x49c4('0x12')]});if(_[_0x49c4('0xe')](_0x50b151)){recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')][_0x49c4('0x17')]({'value':_0x3acd06[_0x49c4('0x12')]});}}}}catch(_0x578447){utils['error'](_0x578447['stack']);}};exports[_0x49c4('0x18')]=function(_0x4f0b62){try{if(!_['isNil'](recordings[_0x4f0b62[_0x49c4('0x8')]])){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x19')]=_0x4f0b62[_0x49c4('0x19')];recordings[_0x4f0b62['uniqueid']]['calleridname']=_0x4f0b62[_0x49c4('0x1a')];recordings[_0x4f0b62[_0x49c4('0x8')]]['connectedlinenum']=_0x4f0b62[_0x49c4('0x1b')];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]=_0x4f0b62[_0x49c4('0x1c')];if(recordings[_0x4f0b62['uniqueid']]['type']==_0x49c4('0x1d')&&recordings[_0x4f0b62['uniqueid']][_0x49c4('0x1')]){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1b')]=recordings[_0x4f0b62[_0x49c4('0x8')]]['accountcode'];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]='';}recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x16')][_0x49c4('0x1e')](_0x29f835=>{var _0x26ba17=_[_0x49c4('0x1f')](recordings[_0x4f0b62[_0x49c4('0x8')]]);_0x26ba17[_0x49c4('0x12')]=_0x29f835[_0x49c4('0x12')];writeDB(_0x26ba17);});delete recordings[_0x4f0b62['uniqueid']];}}catch(_0x4f4495){utils['error'](_0x4f4495[_0x49c4('0xd')]);}};exports[_0x49c4('0x20')]=function(_0x1eb035){try{if(!_[_0x49c4('0xe')](recordings[_0x1eb035[_0x49c4('0x8')]])){if(_0x1eb035['application'][_0x49c4('0x21')]()==_0x49c4('0x22')&&_[_0x49c4('0x23')](_0x1eb035[_0x49c4('0x24')]['toLowerCase'](),'cdr')){var _0xce57ef=_0x1eb035[_0x49c4('0x24')][_0x49c4('0x25')]('=');var _0x13b3b4=_0xce57ef[0x0][_0x49c4('0x26')](_0xce57ef[0x0]['lastIndexOf']('(')+0x1,_0xce57ef[0x0][_0x49c4('0x27')](')'));var _0x84c621=_0xce57ef[0x1];recordings[_0x1eb035[_0x49c4('0x8')]][_0x13b3b4]=_0x84c621;}}}catch(_0x512d02){utils['error'](_0x512d02[_0x49c4('0xd')]);}};exports[_0x49c4('0x28')]=function(_0x3bec0a){try{if(!_[_0x49c4('0xe')](recordings[_0x3bec0a[_0x49c4('0x8')]])){recordings[_0x3bec0a[_0x49c4('0x8')]][_0x49c4('0x29')]=_0x3bec0a[_0x49c4('0x29')];}}catch(_0x3209cd){utils['error'](_0x3209cd[_0x49c4('0xd')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index c6f5ff4..81ff6c9 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 _0x7af4=['transfertargetexten','transfertargetlinkedid','util','./utils','info','format','TRANSFER|%s','type','request','blind','error','stack','attendedtransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','assign','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x370126,_0x190e54){var _0x3139df=function(_0x8d5253){while(--_0x8d5253){_0x370126['push'](_0x370126['shift']());}};_0x3139df(++_0x190e54);}(_0x7af4,0xc2));var _0x47af=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x7af4[_0x396466];return _0x5e9ab4;};'use strict';var _=require('lodash');var util=require(_0x47af('0x0'));var utils=require(_0x47af('0x1'));function writeDB(_0x4d9196){utils[_0x47af('0x2')](util[_0x47af('0x3')](_0x47af('0x4'),_0x4d9196[_0x47af('0x5')]));utils[_0x47af('0x6')]('CreateVoiceTransferReport',_0x4d9196);}exports['blindtransfer']=function(_0x4f92e7){try{_0x4f92e7[_0x47af('0x5')]=_0x47af('0x7');writeDB(_0x4f92e7);}catch(_0xbefd4b){utils[_0x47af('0x8')](_0xbefd4b[_0x47af('0x9')]);}};exports[_0x47af('0xa')]=function(_0x56b664){try{_0x56b664=_['assign'](_0x56b664,{'transfererchannel':_0x56b664[_0x47af('0xb')],'transferercalleridnum':_0x56b664[_0x47af('0xc')],'transferercalleridname':_0x56b664[_0x47af('0xd')],'transfererconnectedlinenum':_0x56b664[_0x47af('0xe')],'transfererconnectedlinename':_0x56b664[_0x47af('0xf')],'transfereraccountcode':_0x56b664[_0x47af('0x10')],'transferercontext':_0x56b664[_0x47af('0x11')],'transfererexten':_0x56b664[_0x47af('0x12')],'transfererlinkedid':_0x56b664[_0x47af('0x13')],'context':_0x56b664['origtransferercontext'],'extension':_0x56b664[_0x47af('0x14')],'type':'attended'});if(_[_0x47af('0x15')](_0x56b664[_0x47af('0x16')])){_0x56b664=_[_0x47af('0x17')](_0x56b664,{'transfereechannel':_0x56b664['transfertargetchannel'],'transfereecalleridnum':_0x56b664[_0x47af('0x18')],'transfereecalleridname':_0x56b664[_0x47af('0x19')],'transfereeconnectedlinenum':_0x56b664[_0x47af('0x1a')],'transfereeconnectedlinename':_0x56b664[_0x47af('0x1b')],'transfereeaccountcode':_0x56b664[_0x47af('0x1c')],'transfereecontext':_0x56b664[_0x47af('0x1d')],'transfereeexten':_0x56b664[_0x47af('0x1e')],'transfereelinkedid':_0x56b664[_0x47af('0x1f')]});}writeDB(_0x56b664);}catch(_0x1f616c){utils[_0x47af('0x8')](_0x1f616c[_0x47af('0x9')]);}}; \ No newline at end of file +var _0x176d=['stack','assign','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','./utils','info','type','CreateVoiceTransferReport','blind','error'];(function(_0xfe36de,_0x303b03){var _0x2072ce=function(_0x1cb93f){while(--_0x1cb93f){_0xfe36de['push'](_0xfe36de['shift']());}};_0x2072ce(++_0x303b03);}(_0x176d,0xb0));var _0xd176=function(_0x44ea0f,_0x4be8fb){_0x44ea0f=_0x44ea0f-0x0;var _0x305c58=_0x176d[_0x44ea0f];return _0x305c58;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xd176('0x0'));function writeDB(_0xeda2b){utils[_0xd176('0x1')](util['format']('TRANSFER|%s',_0xeda2b[_0xd176('0x2')]));utils['request'](_0xd176('0x3'),_0xeda2b);}exports['blindtransfer']=function(_0x323cf2){try{_0x323cf2[_0xd176('0x2')]=_0xd176('0x4');writeDB(_0x323cf2);}catch(_0x23823b){utils[_0xd176('0x5')](_0x23823b[_0xd176('0x6')]);}};exports['attendedtransfer']=function(_0x1b3d86){try{_0x1b3d86=_[_0xd176('0x7')](_0x1b3d86,{'transfererchannel':_0x1b3d86['origtransfererchannel'],'transferercalleridnum':_0x1b3d86[_0xd176('0x8')],'transferercalleridname':_0x1b3d86['origtransferercalleridname'],'transfererconnectedlinenum':_0x1b3d86[_0xd176('0x9')],'transfererconnectedlinename':_0x1b3d86[_0xd176('0xa')],'transfereraccountcode':_0x1b3d86[_0xd176('0xb')],'transferercontext':_0x1b3d86[_0xd176('0xc')],'transfererexten':_0x1b3d86[_0xd176('0xd')],'transfererlinkedid':_0x1b3d86[_0xd176('0xe')],'context':_0x1b3d86[_0xd176('0xf')],'extension':_0x1b3d86[_0xd176('0x10')],'type':_0xd176('0x11')});if(_[_0xd176('0x12')](_0x1b3d86[_0xd176('0x13')])){_0x1b3d86=_['assign'](_0x1b3d86,{'transfereechannel':_0x1b3d86['transfertargetchannel'],'transfereecalleridnum':_0x1b3d86[_0xd176('0x14')],'transfereecalleridname':_0x1b3d86[_0xd176('0x15')],'transfereeconnectedlinenum':_0x1b3d86[_0xd176('0x16')],'transfereeconnectedlinename':_0x1b3d86[_0xd176('0x17')],'transfereeaccountcode':_0x1b3d86[_0xd176('0x18')],'transfereecontext':_0x1b3d86['transfertargetcontext'],'transfereeexten':_0x1b3d86[_0xd176('0x19')],'transfereelinkedid':_0x1b3d86['transfertargetlinkedid']});}writeDB(_0x1b3d86);}catch(_0x46f29d){utils[_0xd176('0x5')](_0x46f29d[_0xd176('0x6')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 0f98c33..53de12d 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 _0x63a6=['GETVOICEQUEUEBYNAME|','FOUND','addTime','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','sumTime','now','isAfter','isBefore','bluebird','client','http','info','debug','error','stack','request','stringify','catch','GetUser','internal','name','interface','then','result','length','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','acwTimeout'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x63a6,0x1e0));var _0x663a=function(_0x5a1b6b,_0x320036){_0x5a1b6b=_0x5a1b6b-0x0;var _0xca9688=_0x63a6[_0x5a1b6b];return _0xca9688;};'use strict';var jayson=require('jayson/promise');var moment=require('moment');var BPromise=require(_0x663a('0x0'));var client=jayson[_0x663a('0x1')][_0x663a('0x2')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x663a('0x3')]=function(_0x47cfa9){logger[_0x663a('0x3')](_0x47cfa9);};exports['debug']=function(_0x5d64c7){logger[_0x663a('0x4')](JSON['stringify'](_0x5d64c7));};exports['error']=function(_0x406227){logger[_0x663a('0x5')](_0x406227[_0x663a('0x6')]);};exports[_0x663a('0x7')]=function(_0x3b92b5,_0x43a508){return client['request'](_0x3b92b5,{'body':_0x43a508})['then'](function(_0xa5ab06){logger[_0x663a('0x4')](JSON[_0x663a('0x8')](_0xa5ab06));})[_0x663a('0x9')](function(_0x3c0eb3){logger['error'](_0x3c0eb3[_0x663a('0x6')]);});};function getUser(_0x209ecc){return client['request'](_0x663a('0xa'),{'options':{'raw':!![],'attributes':['id',_0x663a('0xb'),_0x663a('0xc'),_0x663a('0xd')],'where':_0x209ecc,'limit':0x1}})[_0x663a('0xe')](function(_0x3af8e8){logger['info']('GETUSER|'+JSON[_0x663a('0x8')](_0x209ecc)+'|'+(_0x3af8e8[_0x663a('0xf')][_0x663a('0x10')]?'FOUND':_0x663a('0x11')));return _0x3af8e8[_0x663a('0xf')]['length']?_0x3af8e8[_0x663a('0xf')][0x0]:null;});}exports[_0x663a('0x12')]=function(_0x31d8ca){return new BPromise(function(_0x3564e4,_0x1b0deb){if(_0x31d8ca){return getUser({'internal':_0x31d8ca})[_0x663a('0xe')](function(_0x329a8b){return _0x3564e4(_0x329a8b);})[_0x663a('0x9')](function(_0xbc5d44){logger['error'](_0xbc5d44[_0x663a('0x6')]);return _0x3564e4(null);});}else{return _0x3564e4(null);}});};exports[_0x663a('0x13')]=function(_0x2fe20c){return new BPromise(function(_0x542f92,_0x38a844){if(_0x2fe20c){return getUser({'interface':_0x2fe20c})['then'](function(_0x23e67c){return _0x542f92(_0x23e67c);})[_0x663a('0x9')](function(_0x24f3cb){logger[_0x663a('0x5')](_0x24f3cb[_0x663a('0x6')]);return _0x542f92(null);});}else{return _0x542f92(null);}});};exports[_0x663a('0x14')]=function(_0x471957){return new BPromise(function(_0x5eeece,_0x32bcd8){if(_0x471957){return getUser({'name':_0x471957})[_0x663a('0xe')](function(_0x5a0732){return _0x5eeece(_0x5a0732);})[_0x663a('0x9')](function(_0x4ea619){logger[_0x663a('0x5')](_0x4ea619['stack']);return _0x5eeece(null);});}else{return _0x5eeece(null);}});};exports[_0x663a('0x15')]=function(_0x541088){return new BPromise(function(_0xd59df2,_0x5c62b6){if(_0x541088){return client[_0x663a('0x7')](_0x663a('0x16'),{'options':{'raw':!![],'attributes':['id',_0x663a('0xc'),'type','acw',_0x663a('0x17')],'where':{'name':_0x541088},'limit':0x1}})['then'](function(_0x6544ab){logger['info'](_0x663a('0x18')+_0x541088+'|'+(_0x6544ab[_0x663a('0xf')][_0x663a('0x10')]?_0x663a('0x19'):_0x663a('0x11')));return _0xd59df2(_0x6544ab[_0x663a('0xf')][_0x663a('0x10')]?_0x6544ab[_0x663a('0xf')][0x0]:null);})[_0x663a('0x9')](function(_0x31ed1f){logger['error'](_0x31ed1f['stack']);return _0xd59df2(null);});}else{return _0xd59df2(null);}});};exports[_0x663a('0x1a')]=function(_0x256084,_0x2682dc){return moment(_0x256084)['add'](_0x2682dc,_0x663a('0x1b'))[_0x663a('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x663a('0x1d')]=function(_0x395a8d,_0x159c70){return moment(_0x395a8d)[_0x663a('0x1e')](_0x159c70,'seconds')['format'](_0x663a('0x1f'));};exports['diffTime']=function(_0x3b13b1,_0x2a5728){return moment(_0x3b13b1)['diff'](moment(_0x2a5728),'seconds');};exports[_0x663a('0x20')]=function(_0x28504f,_0x14fe7a){return parseInt(_0x28504f,0xa)+parseInt(_0x14fe7a,0xa);};exports[_0x663a('0x21')]=function(){return moment()[_0x663a('0x1c')](_0x663a('0x1f'));};exports[_0x663a('0x22')]=function(_0x4bf60a,_0x3b0fc4){if(_0x3b0fc4){return moment(_0x4bf60a)['isAfter'](_0x3b0fc4);}else{return!![];}};exports['isBefore']=function(_0x4c84a9,_0x4ed770){if(_0x4ed770){return moment(_0x4c84a9)[_0x663a('0x23')](_0x4ed770);}else if(_0x4c84a9){return!![];}else{return![];}}; \ No newline at end of file +var _0x263e=['addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diff','sumTime','isAfter','isBefore','jayson/promise','moment','bluebird','../../config/logger','info','stringify','error','stack','request','then','debug','catch','name','GETUSER|','NOTFOUND','length','result','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND'];(function(_0x496d3c,_0x3eab1e){var _0x3700b8=function(_0x4c271c){while(--_0x4c271c){_0x496d3c['push'](_0x496d3c['shift']());}};_0x3700b8(++_0x3eab1e);}(_0x263e,0x76));var _0xe263=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x263e[_0x307d86];return _0x361745;};'use strict';var jayson=require(_0xe263('0x0'));var moment=require(_0xe263('0x1'));var BPromise=require(_0xe263('0x2'));var client=jayson['client']['http']({'port':0x2329});var logger=require(_0xe263('0x3'))('xdr');exports[_0xe263('0x4')]=function(_0x3580e4){logger[_0xe263('0x4')](_0x3580e4);};exports['debug']=function(_0x4a12aa){logger['debug'](JSON[_0xe263('0x5')](_0x4a12aa));};exports[_0xe263('0x6')]=function(_0x532735){logger[_0xe263('0x6')](_0x532735[_0xe263('0x7')]);};exports[_0xe263('0x8')]=function(_0x500264,_0x9a3fa0){return client[_0xe263('0x8')](_0x500264,{'body':_0x9a3fa0})[_0xe263('0x9')](function(_0x3b0cca){logger[_0xe263('0xa')](JSON[_0xe263('0x5')](_0x3b0cca));})[_0xe263('0xb')](function(_0x4ece1){logger[_0xe263('0x6')](_0x4ece1[_0xe263('0x7')]);});};function getUser(_0x1ea2ac){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xe263('0xc'),'interface'],'where':_0x1ea2ac,'limit':0x1}})[_0xe263('0x9')](function(_0x1e3448){logger[_0xe263('0x4')](_0xe263('0xd')+JSON[_0xe263('0x5')](_0x1ea2ac)+'|'+(_0x1e3448['result']['length']?'FOUND':_0xe263('0xe')));return _0x1e3448['result'][_0xe263('0xf')]?_0x1e3448[_0xe263('0x10')][0x0]:null;});}exports[_0xe263('0x11')]=function(_0x2db0a1){return new BPromise(function(_0x391d91,_0x2d3139){if(_0x2db0a1){return getUser({'internal':_0x2db0a1})[_0xe263('0x9')](function(_0x52a23c){return _0x391d91(_0x52a23c);})['catch'](function(_0x588cf3){logger['error'](_0x588cf3['stack']);return _0x391d91(null);});}else{return _0x391d91(null);}});};exports[_0xe263('0x12')]=function(_0x4d2f5f){return new BPromise(function(_0x52dec6,_0x21530a){if(_0x4d2f5f){return getUser({'interface':_0x4d2f5f})[_0xe263('0x9')](function(_0x3b430b){return _0x52dec6(_0x3b430b);})[_0xe263('0xb')](function(_0x118595){logger['error'](_0x118595[_0xe263('0x7')]);return _0x52dec6(null);});}else{return _0x52dec6(null);}});};exports[_0xe263('0x13')]=function(_0x4ca68b){return new BPromise(function(_0x58291c,_0x5a0840){if(_0x4ca68b){return getUser({'name':_0x4ca68b})['then'](function(_0x172826){return _0x58291c(_0x172826);})[_0xe263('0xb')](function(_0x3df0c2){logger[_0xe263('0x6')](_0x3df0c2[_0xe263('0x7')]);return _0x58291c(null);});}else{return _0x58291c(null);}});};exports[_0xe263('0x14')]=function(_0x38bf6b){return new BPromise(function(_0x2623bc,_0x18e468){if(_0x38bf6b){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xe263('0xc'),_0xe263('0x15'),_0xe263('0x16'),_0xe263('0x17')],'where':{'name':_0x38bf6b},'limit':0x1}})['then'](function(_0x36855f){logger[_0xe263('0x4')](_0xe263('0x18')+_0x38bf6b+'|'+(_0x36855f[_0xe263('0x10')]['length']?_0xe263('0x19'):_0xe263('0xe')));return _0x2623bc(_0x36855f[_0xe263('0x10')]['length']?_0x36855f['result'][0x0]:null);})['catch'](function(_0x1623d7){logger[_0xe263('0x6')](_0x1623d7[_0xe263('0x7')]);return _0x2623bc(null);});}else{return _0x2623bc(null);}});};exports[_0xe263('0x1a')]=function(_0x7b58b1,_0x87802f){return moment(_0x7b58b1)[_0xe263('0x1b')](_0x87802f,_0xe263('0x1c'))[_0xe263('0x1d')](_0xe263('0x1e'));};exports['subtractTime']=function(_0x4b4781,_0x54a543){return moment(_0x4b4781)[_0xe263('0x1f')](_0x54a543,_0xe263('0x1c'))[_0xe263('0x1d')](_0xe263('0x1e'));};exports['diffTime']=function(_0x30682a,_0x2b28b4){return moment(_0x30682a)[_0xe263('0x20')](moment(_0x2b28b4),_0xe263('0x1c'));};exports[_0xe263('0x21')]=function(_0x349453,_0x558cec){return parseInt(_0x349453,0xa)+parseInt(_0x558cec,0xa);};exports['now']=function(){return moment()[_0xe263('0x1d')](_0xe263('0x1e'));};exports['isAfter']=function(_0xbfe92f,_0x1976ff){if(_0x1976ff){return moment(_0xbfe92f)[_0xe263('0x22')](_0x1976ff);}else{return!![];}};exports['isBefore']=function(_0x22c98f,_0x427aff){if(_0x427aff){return moment(_0x22c98f)[_0xe263('0x23')](_0x427aff);}else if(_0x22c98f){return!![];}else{return![];}}; \ No newline at end of file